summaryrefslogtreecommitdiff
path: root/cui/source
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-10-31 00:36:06 +0100
committerMathias Bauer <mba@openoffice.org>2009-10-31 00:36:06 +0100
commitd32b3a714fe55892bdead03502c5a9b0e77fa61d (patch)
tree05a682f7a6b9210ddeb38b2afb05c7886caaf4cf /cui/source
parent7176bc595f46ef90375de21314f86e02249b69f8 (diff)
#i106421#: move svx/source/cui to cui
Diffstat (limited to 'cui/source')
-rw-r--r--cui/source/customize/acccfg.cxx1700
-rw-r--r--cui/source/customize/acccfg.hrc78
-rw-r--r--cui/source/customize/acccfg.src360
-rw-r--r--cui/source/customize/cfg.cxx6059
-rw-r--r--cui/source/customize/cfg.hrc108
-rw-r--r--cui/source/customize/cfg.src875
-rw-r--r--cui/source/customize/cfgutil.cxx1801
-rw-r--r--cui/source/customize/eventdlg.cxx250
-rw-r--r--cui/source/customize/eventdlg.hrc46
-rw-r--r--cui/source/customize/eventdlg.hxx81
-rw-r--r--cui/source/customize/eventdlg.src114
-rw-r--r--cui/source/customize/macropg.cxx1054
-rw-r--r--cui/source/customize/macropg.hrc104
-rw-r--r--cui/source/customize/macropg.src461
-rw-r--r--cui/source/customize/macropg_impl.hxx76
-rwxr-xr-xcui/source/customize/makefile.mk67
-rw-r--r--cui/source/customize/selector.cxx1255
-rw-r--r--cui/source/customize/selector.hrc60
-rw-r--r--cui/source/customize/selector.src215
-rw-r--r--cui/source/dialogs/SpellAttrib.cxx175
-rw-r--r--cui/source/dialogs/SpellAttrib.hxx176
-rw-r--r--cui/source/dialogs/SpellDialog.cxx2155
-rw-r--r--cui/source/dialogs/SpellDialog.hrc58
-rw-r--r--cui/source/dialogs/SpellDialog.src245
-rw-r--r--cui/source/dialogs/charmap.hrc54
-rw-r--r--cui/source/dialogs/charmap.src161
-rw-r--r--cui/source/dialogs/commonlingui.cxx292
-rw-r--r--cui/source/dialogs/commonlingui.hxx174
-rw-r--r--cui/source/dialogs/commonlingui.src156
-rw-r--r--cui/source/dialogs/cuicharmap.cxx589
-rw-r--r--cui/source/dialogs/cuifmsearch.cxx969
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx1271
-rw-r--r--cui/source/dialogs/cuigrfflt.cxx758
-rw-r--r--cui/source/dialogs/cuihyperdlg.cxx416
-rwxr-xr-xcui/source/dialogs/cuiimapdlg.hrc50
-rwxr-xr-xcui/source/dialogs/cuiimapdlg.src151
-rw-r--r--cui/source/dialogs/cuiimapwnd.cxx101
-rw-r--r--cui/source/dialogs/cuitbxform.cxx68
-rw-r--r--cui/source/dialogs/dlgname.cxx239
-rw-r--r--cui/source/dialogs/dlgname.hrc49
-rw-r--r--cui/source/dialogs/dlgname.src272
-rw-r--r--cui/source/dialogs/fmsearch.hrc89
-rw-r--r--cui/source/dialogs/fmsearch.src332
-rw-r--r--cui/source/dialogs/gallery.src407
-rw-r--r--cui/source/dialogs/grfflt.hrc83
-rw-r--r--cui/source/dialogs/grfflt.src456
-rw-r--r--cui/source/dialogs/hangulhanjadlg.cxx1913
-rw-r--r--cui/source/dialogs/hangulhanjadlg.hrc200
-rw-r--r--cui/source/dialogs/hangulhanjadlg.src431
-rw-r--r--cui/source/dialogs/hldocntp.cxx521
-rw-r--r--cui/source/dialogs/hldoctp.cxx383
-rw-r--r--cui/source/dialogs/hlinettp.cxx547
-rw-r--r--cui/source/dialogs/hlmailtp.cxx364
-rw-r--r--cui/source/dialogs/hlmarkwn.cxx546
-rw-r--r--cui/source/dialogs/hlmarkwn.hrc37
-rw-r--r--cui/source/dialogs/hlmarkwn.src98
-rw-r--r--cui/source/dialogs/hltpbase.cxx873
-rw-r--r--cui/source/dialogs/hyperdlg.hrc103
-rw-r--r--cui/source/dialogs/hyperdlg.src971
-rw-r--r--cui/source/dialogs/iconcdlg.cxx1438
-rw-r--r--cui/source/dialogs/iconcdlg.src63
-rw-r--r--cui/source/dialogs/insdlg.cxx1060
-rw-r--r--cui/source/dialogs/insrc.cxx85
-rw-r--r--cui/source/dialogs/insrc.hrc43
-rw-r--r--cui/source/dialogs/insrc.src118
-rw-r--r--cui/source/dialogs/linkdlg.cxx718
-rwxr-xr-xcui/source/dialogs/makefile.mk118
-rw-r--r--cui/source/dialogs/multifil.cxx187
-rw-r--r--cui/source/dialogs/multipat.cxx363
-rw-r--r--cui/source/dialogs/multipat.hrc47
-rw-r--r--cui/source/dialogs/multipat.src153
-rw-r--r--cui/source/dialogs/newtabledlg.cxx74
-rw-r--r--cui/source/dialogs/newtabledlg.hrc38
-rw-r--r--cui/source/dialogs/newtabledlg.src138
-rw-r--r--cui/source/dialogs/pastedlg.cxx310
-rw-r--r--cui/source/dialogs/plfilter.cxx129
-rw-r--r--cui/source/dialogs/postdlg.cxx260
-rw-r--r--cui/source/dialogs/postdlg.hrc54
-rw-r--r--cui/source/dialogs/postdlg.src161
-rw-r--r--cui/source/dialogs/scriptdlg.cxx1694
-rw-r--r--cui/source/dialogs/scriptdlg.hrc83
-rw-r--r--cui/source/dialogs/scriptdlg.src310
-rw-r--r--cui/source/dialogs/sdrcelldlg.cxx103
-rw-r--r--cui/source/dialogs/sdrcelldlg.src142
-rw-r--r--cui/source/dialogs/showcols.cxx141
-rw-r--r--cui/source/dialogs/showcols.src106
-rw-r--r--cui/source/dialogs/splitcelldlg.cxx114
-rw-r--r--cui/source/dialogs/splitcelldlg.hrc45
-rw-r--r--cui/source/dialogs/splitcelldlg.src135
-rw-r--r--cui/source/dialogs/srchxtra.cxx291
-rw-r--r--cui/source/dialogs/srchxtra.hrc54
-rw-r--r--cui/source/dialogs/srchxtra.src281
-rw-r--r--cui/source/dialogs/svuidlg.hrc137
-rw-r--r--cui/source/dialogs/svuidlg.src711
-rw-r--r--cui/source/dialogs/tbxform.src68
-rw-r--r--cui/source/dialogs/winpluginlib.cpp233
-rw-r--r--cui/source/dialogs/zoom.cxx537
-rw-r--r--cui/source/dialogs/zoom.hrc56
-rw-r--r--cui/source/dialogs/zoom.src159
-rw-r--r--cui/source/factory/cuiexp.cxx54
-rw-r--r--cui/source/factory/dlgfact.cxx2286
-rw-r--r--cui/source/factory/dlgfact.hxx802
-rw-r--r--cui/source/factory/init.cxx56
-rwxr-xr-xcui/source/factory/makefile.mk55
-rw-r--r--cui/source/inc/ControlFocusHelper.hxx51
-rw-r--r--cui/source/inc/SpellDialog.hxx261
-rw-r--r--cui/source/inc/acccfg.hxx288
-rw-r--r--cui/source/inc/align.hxx104
-rw-r--r--cui/source/inc/autocdlg.hxx508
-rw-r--r--cui/source/inc/backgrnd.hxx173
-rw-r--r--cui/source/inc/bbdlg.hxx59
-rw-r--r--cui/source/inc/border.hxx159
-rw-r--r--cui/source/inc/cfg.hxx836
-rw-r--r--cui/source/inc/cfgutil.hxx220
-rw-r--r--cui/source/inc/chardlg.hxx400
-rw-r--r--cui/source/inc/connect.hxx121
-rw-r--r--cui/source/inc/cuicharmap.hxx146
-rw-r--r--cui/source/inc/cuifmsearch.hxx230
-rw-r--r--cui/source/inc/cuigaldlg.hxx375
-rw-r--r--cui/source/inc/cuigrfflt.hxx256
-rw-r--r--cui/source/inc/cuihyperdlg.hxx117
-rw-r--r--cui/source/inc/cuiimapwnd.hxx54
-rw-r--r--cui/source/inc/cuioptgenrl.hxx131
-rw-r--r--cui/source/inc/cuisrchdlg.hxx90
-rw-r--r--cui/source/inc/cuitabarea.hxx805
-rw-r--r--cui/source/inc/cuitabline.hxx433
-rw-r--r--cui/source/inc/cuitbxform.hxx29
-rw-r--r--cui/source/inc/dbregister.hxx163
-rw-r--r--cui/source/inc/defdlgname.hxx43
-rw-r--r--cui/source/inc/dlgname.hxx207
-rw-r--r--cui/source/inc/dstribut.hxx128
-rw-r--r--cui/source/inc/gallery.hrc104
-rw-r--r--cui/source/inc/grfpage.hxx143
-rw-r--r--cui/source/inc/hangulhanjadlg.hxx353
-rwxr-xr-xcui/source/inc/headertablistbox.hxx71
-rw-r--r--cui/source/inc/helpid.hrc387
-rw-r--r--cui/source/inc/hldocntp.hxx81
-rw-r--r--cui/source/inc/hldoctp.hxx96
-rw-r--r--cui/source/inc/hlinettp.hxx110
-rw-r--r--cui/source/inc/hlmailtp.hxx80
-rw-r--r--cui/source/inc/hlmarkwn.hxx114
-rw-r--r--cui/source/inc/hlmarkwn_def.hxx39
-rw-r--r--cui/source/inc/hltpbase.hxx211
-rw-r--r--cui/source/inc/iconcdlg.hxx292
-rw-r--r--cui/source/inc/insdlg.hxx217
-rw-r--r--cui/source/inc/insrc.hxx72
-rw-r--r--cui/source/inc/internationaloptions.hxx61
-rw-r--r--cui/source/inc/labdlg.hxx147
-rw-r--r--cui/source/inc/linkdlg.hxx137
-rwxr-xr-xcui/source/inc/macroass.hxx146
-rw-r--r--cui/source/inc/macropg.hxx178
-rw-r--r--cui/source/inc/measure.hxx130
-rw-r--r--cui/source/inc/multifil.hxx62
-rw-r--r--cui/source/inc/multipat.hxx92
-rw-r--r--cui/source/inc/newtabledlg.hxx65
-rw-r--r--cui/source/inc/numfmt.hxx191
-rw-r--r--cui/source/inc/numpages.hxx472
-rw-r--r--cui/source/inc/optasian.hxx84
-rw-r--r--cui/source/inc/optdict.hxx191
-rw-r--r--cui/source/inc/optimprove.hxx143
-rw-r--r--cui/source/inc/optlingu.hxx185
-rw-r--r--cui/source/inc/optpath.hxx119
-rw-r--r--cui/source/inc/page.hxx241
-rw-r--r--cui/source/inc/paragrph.hxx330
-rw-r--r--cui/source/inc/pastedlg.hxx98
-rw-r--r--cui/source/inc/postdlg.hxx129
-rw-r--r--cui/source/inc/radiobtnbox.hxx66
-rw-r--r--cui/source/inc/scriptdlg.hxx251
-rw-r--r--cui/source/inc/sdrcelldlg.hxx66
-rw-r--r--cui/source/inc/selector.hxx249
-rw-r--r--cui/source/inc/showcols.hxx69
-rw-r--r--cui/source/inc/splitcelldlg.hxx72
-rw-r--r--cui/source/inc/srchxtra.hxx111
-rw-r--r--cui/source/inc/tabstpge.hxx162
-rw-r--r--cui/source/inc/textanim.hxx131
-rw-r--r--cui/source/inc/textattr.hxx138
-rw-r--r--cui/source/inc/transfrm.hxx308
-rw-r--r--cui/source/inc/treeopt.hxx362
-rw-r--r--cui/source/inc/zoom.hxx120
-rw-r--r--cui/source/options/cfgchart.cxx327
-rw-r--r--cui/source/options/cfgchart.hxx119
-rw-r--r--cui/source/options/connpoolconfig.cxx228
-rw-r--r--cui/source/options/connpoolconfig.hxx57
-rw-r--r--cui/source/options/connpooloptions.cxx516
-rw-r--r--cui/source/options/connpooloptions.hrc52
-rw-r--r--cui/source/options/connpooloptions.hxx95
-rw-r--r--cui/source/options/connpooloptions.src169
-rw-r--r--cui/source/options/connpoolsettings.cxx126
-rw-r--r--cui/source/options/connpoolsettings.hxx111
-rw-r--r--cui/source/options/cuisrchdlg.cxx104
-rw-r--r--cui/source/options/dbregister.cxx512
-rw-r--r--cui/source/options/dbregister.hrc45
-rw-r--r--cui/source/options/dbregister.src97
-rw-r--r--cui/source/options/dbregisterednamesconfig.cxx188
-rw-r--r--cui/source/options/dbregisterednamesconfig.hxx57
-rw-r--r--cui/source/options/dbregistersettings.cxx77
-rw-r--r--cui/source/options/dbregistersettings.hxx66
-rw-r--r--cui/source/options/doclinkdialog.cxx235
-rw-r--r--cui/source/options/doclinkdialog.hrc53
-rw-r--r--cui/source/options/doclinkdialog.hxx96
-rw-r--r--cui/source/options/doclinkdialog.src154
-rw-r--r--cui/source/options/fontsubs.cxx614
-rw-r--r--cui/source/options/fontsubs.hrc65
-rw-r--r--cui/source/options/fontsubs.hxx137
-rw-r--r--cui/source/options/fontsubs.src200
-rw-r--r--cui/source/options/internationaloptions.cxx166
-rw-r--r--cui/source/options/internationaloptions.hrc75
-rw-r--r--cui/source/options/internationaloptions.src105
-rwxr-xr-xcui/source/options/makefile.mk122
-rw-r--r--cui/source/options/optHeaderTabListbox.cxx90
-rw-r--r--cui/source/options/optHeaderTabListbox.hxx48
-rw-r--r--cui/source/options/optaccessibility.cxx188
-rw-r--r--cui/source/options/optaccessibility.hrc87
-rw-r--r--cui/source/options/optaccessibility.hxx68
-rw-r--r--cui/source/options/optaccessibility.src155
-rw-r--r--cui/source/options/optasian.cxx470
-rw-r--r--cui/source/options/optasian.hrc52
-rw-r--r--cui/source/options/optasian.src177
-rw-r--r--cui/source/options/optchart.cxx238
-rw-r--r--cui/source/options/optchart.hrc40
-rw-r--r--cui/source/options/optchart.hxx92
-rw-r--r--cui/source/options/optchart.src86
-rw-r--r--cui/source/options/optcolor.cxx1634
-rw-r--r--cui/source/options/optcolor.hrc222
-rw-r--r--cui/source/options/optcolor.hxx84
-rw-r--r--cui/source/options/optcolor.src552
-rw-r--r--cui/source/options/optctl.cxx173
-rw-r--r--cui/source/options/optctl.hrc61
-rw-r--r--cui/source/options/optctl.hxx73
-rw-r--r--cui/source/options/optctl.src119
-rw-r--r--cui/source/options/optdict.cxx804
-rw-r--r--cui/source/options/optdict.hrc68
-rw-r--r--cui/source/options/optdict.src282
-rw-r--r--cui/source/options/optfltr.cxx439
-rw-r--r--cui/source/options/optfltr.hrc58
-rw-r--r--cui/source/options/optfltr.hxx118
-rw-r--r--cui/source/options/optfltr.src204
-rw-r--r--cui/source/options/optgdlg.cxx1918
-rw-r--r--cui/source/options/optgdlg.hrc208
-rw-r--r--cui/source/options/optgdlg.hxx217
-rw-r--r--cui/source/options/optgdlg.src642
-rw-r--r--cui/source/options/optgenrl.cxx583
-rw-r--r--cui/source/options/optgenrl.hrc88
-rw-r--r--cui/source/options/optgenrl.src333
-rw-r--r--cui/source/options/opthtml.cxx271
-rw-r--r--cui/source/options/opthtml.hrc66
-rw-r--r--cui/source/options/opthtml.hxx92
-rw-r--r--cui/source/options/opthtml.src290
-rw-r--r--cui/source/options/optimprove.cxx230
-rw-r--r--cui/source/options/optimprove.hrc53
-rw-r--r--cui/source/options/optimprove.src123
-rw-r--r--cui/source/options/optimprove2.cxx266
-rw-r--r--cui/source/options/optinet2.cxx2338
-rw-r--r--cui/source/options/optinet2.hrc175
-rw-r--r--cui/source/options/optinet2.hxx355
-rw-r--r--cui/source/options/optinet2.src647
-rw-r--r--cui/source/options/optjava.cxx1138
-rw-r--r--cui/source/options/optjava.hrc86
-rw-r--r--cui/source/options/optjava.hxx217
-rw-r--r--cui/source/options/optjava.src290
-rw-r--r--cui/source/options/optjsearch.cxx385
-rw-r--r--cui/source/options/optjsearch.hrc53
-rw-r--r--cui/source/options/optjsearch.hxx96
-rw-r--r--cui/source/options/optjsearch.src223
-rw-r--r--cui/source/options/optlingu.cxx2555
-rw-r--r--cui/source/options/optlingu.hrc91
-rw-r--r--cui/source/options/optlingu.src357
-rw-r--r--cui/source/options/optmemory.cxx274
-rw-r--r--cui/source/options/optmemory.hrc89
-rw-r--r--cui/source/options/optmemory.hxx92
-rw-r--r--cui/source/options/optmemory.src210
-rw-r--r--cui/source/options/optpath.cxx866
-rw-r--r--cui/source/options/optpath.hrc46
-rw-r--r--cui/source/options/optpath.src203
-rw-r--r--cui/source/options/optsave.cxx822
-rw-r--r--cui/source/options/optsave.hrc84
-rw-r--r--cui/source/options/optsave.hxx108
-rw-r--r--cui/source/options/optsave.src325
-rw-r--r--cui/source/options/optspell.hrc45
-rw-r--r--cui/source/options/optspell.src128
-rw-r--r--cui/source/options/optupdt.cxx415
-rw-r--r--cui/source/options/optupdt.hrc52
-rw-r--r--cui/source/options/optupdt.hxx84
-rw-r--r--cui/source/options/optupdt.src114
-rw-r--r--cui/source/options/radiobtnbox.cxx118
-rw-r--r--cui/source/options/readonlyimage.cxx84
-rw-r--r--cui/source/options/readonlyimage.hxx46
-rw-r--r--cui/source/options/readonlyimage.src55
-rw-r--r--cui/source/options/sdbcdriverenum.cxx132
-rw-r--r--cui/source/options/sdbcdriverenum.hxx79
-rw-r--r--cui/source/options/securityoptions.cxx107
-rw-r--r--cui/source/options/securityoptions.hrc83
-rw-r--r--cui/source/options/securityoptions.hxx94
-rw-r--r--cui/source/options/securityoptions.src168
-rw-r--r--cui/source/options/treeopt.cxx2849
-rw-r--r--cui/source/options/treeopt.hrc103
-rw-r--r--cui/source/options/treeopt.src386
-rw-r--r--cui/source/options/webconninfo.cxx377
-rw-r--r--cui/source/options/webconninfo.hrc65
-rw-r--r--cui/source/options/webconninfo.hxx88
-rw-r--r--cui/source/options/webconninfo.src106
-rw-r--r--cui/source/tabpages/align.cxx299
-rw-r--r--cui/source/tabpages/align.hrc87
-rw-r--r--cui/source/tabpages/align.src251
-rw-r--r--cui/source/tabpages/autocdlg.cxx2775
-rw-r--r--cui/source/tabpages/autocdlg.hrc162
-rw-r--r--cui/source/tabpages/autocdlg.src856
-rw-r--r--cui/source/tabpages/backgrnd.cxx1979
-rw-r--r--cui/source/tabpages/backgrnd.hrc73
-rw-r--r--cui/source/tabpages/backgrnd.src307
-rw-r--r--cui/source/tabpages/bbdlg.cxx75
-rw-r--r--cui/source/tabpages/bbdlg.src88
-rw-r--r--cui/source/tabpages/border.cxx1271
-rw-r--r--cui/source/tabpages/border.hrc109
-rw-r--r--cui/source/tabpages/border.src431
-rw-r--r--cui/source/tabpages/borderconn.cxx314
-rw-r--r--cui/source/tabpages/borderconn.hxx79
-rw-r--r--cui/source/tabpages/chardlg.cxx4066
-rw-r--r--cui/source/tabpages/chardlg.h74
-rw-r--r--cui/source/tabpages/chardlg.hrc184
-rw-r--r--cui/source/tabpages/chardlg.src1133
-rw-r--r--cui/source/tabpages/connect.cxx565
-rw-r--r--cui/source/tabpages/connect.hrc48
-rw-r--r--cui/source/tabpages/connect.src268
-rw-r--r--cui/source/tabpages/dstribut.cxx247
-rw-r--r--cui/source/tabpages/dstribut.hrc58
-rw-r--r--cui/source/tabpages/dstribut.src293
-rw-r--r--cui/source/tabpages/grfpage.cxx838
-rw-r--r--cui/source/tabpages/grfpage.hrc56
-rw-r--r--cui/source/tabpages/grfpage.src334
-rw-r--r--cui/source/tabpages/labdlg.cxx653
-rw-r--r--cui/source/tabpages/labdlg.hrc80
-rw-r--r--cui/source/tabpages/labdlg.src301
-rw-r--r--cui/source/tabpages/macroass.cxx719
-rw-r--r--cui/source/tabpages/macroass.hrc85
-rw-r--r--cui/source/tabpages/macroass.src143
-rwxr-xr-xcui/source/tabpages/makefile.mk112
-rw-r--r--cui/source/tabpages/measure.cxx876
-rw-r--r--cui/source/tabpages/measure.hrc56
-rw-r--r--cui/source/tabpages/measure.src310
-rw-r--r--cui/source/tabpages/numfmt.cxx1953
-rw-r--r--cui/source/tabpages/numfmt.hrc77
-rw-r--r--cui/source/tabpages/numfmt.src297
-rw-r--r--cui/source/tabpages/numpages.cxx4038
-rw-r--r--cui/source/tabpages/numpages.hrc135
-rw-r--r--cui/source/tabpages/numpages.src910
-rw-r--r--cui/source/tabpages/page.cxx1771
-rw-r--r--cui/source/tabpages/page.h74
-rw-r--r--cui/source/tabpages/page.hrc87
-rw-r--r--cui/source/tabpages/page.src668
-rw-r--r--cui/source/tabpages/paragrph.cxx2374
-rw-r--r--cui/source/tabpages/paragrph.hrc124
-rw-r--r--cui/source/tabpages/paragrph.src734
-rw-r--r--cui/source/tabpages/swpossizetabpage.cxx1973
-rw-r--r--cui/source/tabpages/swpossizetabpage.hrc62
-rw-r--r--cui/source/tabpages/swpossizetabpage.hxx161
-rw-r--r--cui/source/tabpages/swpossizetabpage.src299
-rw-r--r--cui/source/tabpages/tabarea.cxx370
-rw-r--r--cui/source/tabpages/tabarea.hrc190
-rw-r--r--cui/source/tabpages/tabarea.src1541
-rw-r--r--cui/source/tabpages/tabline.cxx300
-rw-r--r--cui/source/tabpages/tabline.hrc109
-rw-r--r--cui/source/tabpages/tabline.src803
-rw-r--r--cui/source/tabpages/tabstpge.cxx746
-rw-r--r--cui/source/tabpages/tabstpge.hrc66
-rw-r--r--cui/source/tabpages/tabstpge.src234
-rw-r--r--cui/source/tabpages/textanim.cxx759
-rw-r--r--cui/source/tabpages/textanim.hrc50
-rw-r--r--cui/source/tabpages/textanim.src322
-rw-r--r--cui/source/tabpages/textattr.cxx801
-rw-r--r--cui/source/tabpages/textattr.hrc49
-rw-r--r--cui/source/tabpages/textattr.src247
-rw-r--r--cui/source/tabpages/tparea.cxx2582
-rw-r--r--cui/source/tabpages/tpbitmap.cxx1170
-rw-r--r--cui/source/tabpages/tpcolor.cxx1280
-rw-r--r--cui/source/tabpages/tpgradnt.cxx943
-rw-r--r--cui/source/tabpages/tphatch.cxx901
-rw-r--r--cui/source/tabpages/tpline.cxx1926
-rw-r--r--cui/source/tabpages/tplnedef.cxx1020
-rw-r--r--cui/source/tabpages/tplneend.cxx753
-rw-r--r--cui/source/tabpages/tpshadow.cxx612
-rw-r--r--cui/source/tabpages/transfrm.cxx1701
-rw-r--r--cui/source/tabpages/transfrm.hrc79
-rw-r--r--cui/source/tabpages/transfrm.src612
384 files changed, 151461 insertions, 0 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
new file mode 100644
index 000000000000..f8a141234e37
--- /dev/null
+++ b/cui/source/customize/acccfg.cxx
@@ -0,0 +1,1700 @@
+/*************************************************************************
+ *
+ * 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: acccfg.cxx,v $
+ * $Revision: 1.40 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+//-----------------------------------------------
+// include own files
+
+#include "acccfg.hxx"
+#include "cfgutil.hxx"
+#include <svx/dialmgr.hxx>
+
+#include <sfx2/msg.hxx>
+#include <sfx2/macrconf.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/minfitem.hxx>
+#include <svl/stritem.hxx>
+
+#include "svx/dialogs.hrc"
+#include "acccfg.hrc"
+
+//-----------------------------------------------
+// include interface declarations
+#include <com/sun/star/frame/XFramesSupplier.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/form/XReset.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+
+#ifndef _COM_SUN_STAR_UI_XUICONFIGURATIONMANAGERSUPLLIER_HPP_
+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#endif
+#include <com/sun/star/ui/XUIConfigurationManager.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+
+//-----------------------------------------------
+// include other projects
+#include <unotools/processfactory.hxx>
+#include <svtools/acceleratorexecute.hxx>
+#include <comphelper/processfactory.hxx>
+#include <svtools/svlbitm.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/help.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+
+//-----------------------------------------------
+// namespaces
+
+#ifdef css
+ #error "ambigous praeprozessor directive for css ..."
+#else
+ namespace css = ::com::sun::star;
+#endif
+
+using namespace com::sun::star;
+
+//-----------------------------------------------
+// definitions
+
+//-----------------------------------------------
+static ::rtl::OUString SERVICE_STORAGEFACTORY = ::rtl::OUString::createFromAscii("com.sun.star.embed.StorageFactory" );
+static ::rtl::OUString SERVICE_UICONFIGMGR = ::rtl::OUString::createFromAscii("com.sun.star.ui.UIConfigurationManager" );
+static ::rtl::OUString SERVICE_DESKTOP = ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop" );
+static ::rtl::OUString SERVICE_MODULEMANAGER = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager" );
+static ::rtl::OUString SERVICE_GLOBALACCCFG = ::rtl::OUString::createFromAscii("com.sun.star.ui.GlobalAcceleratorConfiguration" );
+static ::rtl::OUString SERVICE_MODULEUICONFIGSUPPLIER = ::rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier");
+static ::rtl::OUString SERVICE_UICMDDESCRIPTION = ::rtl::OUString::createFromAscii("com.sun.star.frame.UICommandDescription" );
+
+static ::rtl::OUString MODULEPROP_SHORTNAME = ::rtl::OUString::createFromAscii("ooSetupFactoryShortName" );
+static ::rtl::OUString MODULEPROP_UINAME = ::rtl::OUString::createFromAscii("ooSetupFactoryUIName" );
+static ::rtl::OUString CMDPROP_UINAME = ::rtl::OUString::createFromAscii("Name" );
+
+static ::rtl::OUString FOLDERNAME_UICONFIG = ::rtl::OUString::createFromAscii("Configurations2" );
+
+static ::rtl::OUString MEDIATYPE_PROPNAME = ::rtl::OUString::createFromAscii("MediaType" );
+static ::rtl::OUString MEDIATYPE_UICONFIG = ::rtl::OUString::createFromAscii("application/vnd.sun.xml.ui.configuration" );
+
+//-----------------------------------------------
+static USHORT __FAR_DATA KEYCODE_ARRAY[] =
+{
+ KEY_F1 ,
+ KEY_F2 ,
+ KEY_F3 ,
+ KEY_F4 ,
+ KEY_F5 ,
+ KEY_F6 ,
+ KEY_F7 ,
+ KEY_F8 ,
+ KEY_F9 ,
+ KEY_F10 ,
+ KEY_F11 ,
+ KEY_F12 ,
+
+ KEY_DOWN ,
+ KEY_UP ,
+ KEY_LEFT ,
+ KEY_RIGHT ,
+ KEY_HOME ,
+ KEY_END ,
+ KEY_PAGEUP ,
+ KEY_PAGEDOWN ,
+ KEY_RETURN ,
+ KEY_ESCAPE ,
+ KEY_BACKSPACE,
+ KEY_INSERT ,
+ KEY_DELETE ,
+
+ KEY_OPEN ,
+ KEY_CUT ,
+ KEY_COPY ,
+ KEY_PASTE ,
+ KEY_UNDO ,
+ KEY_REPEAT ,
+ KEY_FIND ,
+ KEY_PROPERTIES ,
+ KEY_FRONT ,
+ KEY_CONTEXTMENU ,
+ KEY_MENU ,
+ KEY_HELP ,
+
+ KEY_F1 | KEY_SHIFT,
+ KEY_F2 | KEY_SHIFT,
+ KEY_F3 | KEY_SHIFT,
+ KEY_F4 | KEY_SHIFT,
+ KEY_F5 | KEY_SHIFT,
+ KEY_F6 | KEY_SHIFT,
+ KEY_F7 | KEY_SHIFT,
+ KEY_F8 | KEY_SHIFT,
+ KEY_F9 | KEY_SHIFT,
+ KEY_F10 | KEY_SHIFT,
+ KEY_F11 | KEY_SHIFT,
+ KEY_F12 | KEY_SHIFT,
+
+ KEY_DOWN | KEY_SHIFT,
+ KEY_UP | KEY_SHIFT,
+ KEY_LEFT | KEY_SHIFT,
+ KEY_RIGHT | KEY_SHIFT,
+ KEY_HOME | KEY_SHIFT,
+ KEY_END | KEY_SHIFT,
+ KEY_PAGEUP | KEY_SHIFT,
+ KEY_PAGEDOWN | KEY_SHIFT,
+ KEY_RETURN | KEY_SHIFT,
+ KEY_SPACE | KEY_SHIFT,
+ KEY_ESCAPE | KEY_SHIFT,
+ KEY_BACKSPACE | KEY_SHIFT,
+ KEY_INSERT | KEY_SHIFT,
+ KEY_DELETE | KEY_SHIFT,
+
+ KEY_0 | KEY_MOD1 ,
+ KEY_1 | KEY_MOD1 ,
+ KEY_2 | KEY_MOD1 ,
+ KEY_3 | KEY_MOD1 ,
+ KEY_4 | KEY_MOD1 ,
+ KEY_5 | KEY_MOD1 ,
+ KEY_6 | KEY_MOD1 ,
+ KEY_7 | KEY_MOD1 ,
+ KEY_8 | KEY_MOD1 ,
+ KEY_9 | KEY_MOD1 ,
+ KEY_A | KEY_MOD1 ,
+ KEY_B | KEY_MOD1 ,
+ KEY_C | KEY_MOD1 ,
+ KEY_D | KEY_MOD1 ,
+ KEY_E | KEY_MOD1 ,
+ KEY_F | KEY_MOD1 ,
+ KEY_G | KEY_MOD1 ,
+ KEY_H | KEY_MOD1 ,
+ KEY_I | KEY_MOD1 ,
+ KEY_J | KEY_MOD1 ,
+ KEY_K | KEY_MOD1 ,
+ KEY_L | KEY_MOD1 ,
+ KEY_M | KEY_MOD1 ,
+ KEY_N | KEY_MOD1 ,
+ KEY_O | KEY_MOD1 ,
+ KEY_P | KEY_MOD1 ,
+ KEY_Q | KEY_MOD1 ,
+ KEY_R | KEY_MOD1 ,
+ KEY_S | KEY_MOD1 ,
+ KEY_T | KEY_MOD1 ,
+ KEY_U | KEY_MOD1 ,
+ KEY_V | KEY_MOD1 ,
+ KEY_W | KEY_MOD1 ,
+ KEY_X | KEY_MOD1 ,
+ KEY_Y | KEY_MOD1 ,
+ KEY_Z | KEY_MOD1 ,
+
+ KEY_F1 | KEY_MOD1 ,
+ KEY_F2 | KEY_MOD1 ,
+ KEY_F3 | KEY_MOD1 ,
+ KEY_F4 | KEY_MOD1 ,
+ KEY_F5 | KEY_MOD1 ,
+ KEY_F6 | KEY_MOD1 ,
+ KEY_F7 | KEY_MOD1 ,
+ KEY_F8 | KEY_MOD1 ,
+ KEY_F9 | KEY_MOD1 ,
+ KEY_F10 | KEY_MOD1 ,
+ KEY_F11 | KEY_MOD1 ,
+ KEY_F12 | KEY_MOD1 ,
+
+ KEY_DOWN | KEY_MOD1 ,
+ KEY_UP | KEY_MOD1 ,
+ KEY_LEFT | KEY_MOD1 ,
+ KEY_RIGHT | KEY_MOD1 ,
+ KEY_HOME | KEY_MOD1 ,
+ KEY_END | KEY_MOD1 ,
+ KEY_PAGEUP | KEY_MOD1 ,
+ KEY_PAGEDOWN | KEY_MOD1 ,
+ KEY_RETURN | KEY_MOD1 ,
+ KEY_SPACE | KEY_MOD1 ,
+ KEY_BACKSPACE | KEY_MOD1 ,
+ KEY_INSERT | KEY_MOD1 ,
+ KEY_DELETE | KEY_MOD1 ,
+
+ KEY_ADD | KEY_MOD1 ,
+ KEY_SUBTRACT | KEY_MOD1 ,
+ KEY_MULTIPLY | KEY_MOD1 ,
+ KEY_DIVIDE | KEY_MOD1 ,
+
+ KEY_0 | KEY_SHIFT | KEY_MOD1,
+ KEY_1 | KEY_SHIFT | KEY_MOD1,
+ KEY_2 | KEY_SHIFT | KEY_MOD1,
+ KEY_3 | KEY_SHIFT | KEY_MOD1,
+ KEY_4 | KEY_SHIFT | KEY_MOD1,
+ KEY_5 | KEY_SHIFT | KEY_MOD1,
+ KEY_6 | KEY_SHIFT | KEY_MOD1,
+ KEY_7 | KEY_SHIFT | KEY_MOD1,
+ KEY_8 | KEY_SHIFT | KEY_MOD1,
+ KEY_9 | KEY_SHIFT | KEY_MOD1,
+ KEY_A | KEY_SHIFT | KEY_MOD1,
+ KEY_B | KEY_SHIFT | KEY_MOD1,
+ KEY_C | KEY_SHIFT | KEY_MOD1,
+ KEY_D | KEY_SHIFT | KEY_MOD1,
+ KEY_E | KEY_SHIFT | KEY_MOD1,
+ KEY_F | KEY_SHIFT | KEY_MOD1,
+ KEY_G | KEY_SHIFT | KEY_MOD1,
+ KEY_H | KEY_SHIFT | KEY_MOD1,
+ KEY_I | KEY_SHIFT | KEY_MOD1,
+ KEY_J | KEY_SHIFT | KEY_MOD1,
+ KEY_K | KEY_SHIFT | KEY_MOD1,
+ KEY_L | KEY_SHIFT | KEY_MOD1,
+ KEY_M | KEY_SHIFT | KEY_MOD1,
+ KEY_N | KEY_SHIFT | KEY_MOD1,
+ KEY_O | KEY_SHIFT | KEY_MOD1,
+ KEY_P | KEY_SHIFT | KEY_MOD1,
+ KEY_Q | KEY_SHIFT | KEY_MOD1,
+ KEY_R | KEY_SHIFT | KEY_MOD1,
+ KEY_S | KEY_SHIFT | KEY_MOD1,
+ KEY_T | KEY_SHIFT | KEY_MOD1,
+ KEY_U | KEY_SHIFT | KEY_MOD1,
+ KEY_V | KEY_SHIFT | KEY_MOD1,
+ KEY_W | KEY_SHIFT | KEY_MOD1,
+ KEY_X | KEY_SHIFT | KEY_MOD1,
+ KEY_Y | KEY_SHIFT | KEY_MOD1,
+ KEY_Z | KEY_SHIFT | KEY_MOD1,
+
+ KEY_F1 | KEY_SHIFT | KEY_MOD1,
+ KEY_F2 | KEY_SHIFT | KEY_MOD1,
+ KEY_F3 | KEY_SHIFT | KEY_MOD1,
+ KEY_F4 | KEY_SHIFT | KEY_MOD1,
+ KEY_F5 | KEY_SHIFT | KEY_MOD1,
+ KEY_F6 | KEY_SHIFT | KEY_MOD1,
+ KEY_F7 | KEY_SHIFT | KEY_MOD1,
+ KEY_F8 | KEY_SHIFT | KEY_MOD1,
+ KEY_F9 | KEY_SHIFT | KEY_MOD1,
+ KEY_F10 | KEY_SHIFT | KEY_MOD1,
+ KEY_F11 | KEY_SHIFT | KEY_MOD1,
+ KEY_F12 | KEY_SHIFT | KEY_MOD1,
+
+ KEY_DOWN | KEY_SHIFT | KEY_MOD1,
+ KEY_UP | KEY_SHIFT | KEY_MOD1,
+ KEY_LEFT | KEY_SHIFT | KEY_MOD1,
+ KEY_RIGHT | KEY_SHIFT | KEY_MOD1,
+ KEY_HOME | KEY_SHIFT | KEY_MOD1,
+ KEY_END | KEY_SHIFT | KEY_MOD1,
+ KEY_PAGEUP | KEY_SHIFT | KEY_MOD1,
+ KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD1,
+ KEY_RETURN | KEY_SHIFT | KEY_MOD1,
+ KEY_SPACE | KEY_SHIFT | KEY_MOD1,
+ KEY_BACKSPACE | KEY_SHIFT | KEY_MOD1,
+ KEY_INSERT | KEY_SHIFT | KEY_MOD1,
+ KEY_DELETE | KEY_SHIFT | KEY_MOD1,
+
+ KEY_0 | KEY_MOD2 ,
+ KEY_1 | KEY_MOD2 ,
+ KEY_2 | KEY_MOD2 ,
+ KEY_3 | KEY_MOD2 ,
+ KEY_4 | KEY_MOD2 ,
+ KEY_5 | KEY_MOD2 ,
+ KEY_6 | KEY_MOD2 ,
+ KEY_7 | KEY_MOD2 ,
+ KEY_8 | KEY_MOD2 ,
+ KEY_9 | KEY_MOD2 ,
+ KEY_A | KEY_MOD2 ,
+ KEY_B | KEY_MOD2 ,
+ KEY_C | KEY_MOD2 ,
+ KEY_D | KEY_MOD2 ,
+ KEY_E | KEY_MOD2 ,
+ KEY_F | KEY_MOD2 ,
+ KEY_G | KEY_MOD2 ,
+ KEY_H | KEY_MOD2 ,
+ KEY_I | KEY_MOD2 ,
+ KEY_J | KEY_MOD2 ,
+ KEY_K | KEY_MOD2 ,
+ KEY_L | KEY_MOD2 ,
+ KEY_M | KEY_MOD2 ,
+ KEY_N | KEY_MOD2 ,
+ KEY_O | KEY_MOD2 ,
+ KEY_P | KEY_MOD2 ,
+ KEY_Q | KEY_MOD2 ,
+ KEY_R | KEY_MOD2 ,
+ KEY_S | KEY_MOD2 ,
+ KEY_T | KEY_MOD2 ,
+ KEY_U | KEY_MOD2 ,
+ KEY_V | KEY_MOD2 ,
+ KEY_W | KEY_MOD2 ,
+ KEY_X | KEY_MOD2 ,
+ KEY_Y | KEY_MOD2 ,
+ KEY_Z | KEY_MOD2 ,
+
+ KEY_F1 | KEY_MOD2 ,
+ KEY_F2 | KEY_MOD2 ,
+ KEY_F3 | KEY_MOD2 ,
+ KEY_F4 | KEY_MOD2 ,
+ KEY_F5 | KEY_MOD2 ,
+ KEY_F6 | KEY_MOD2 ,
+ KEY_F7 | KEY_MOD2 ,
+ KEY_F8 | KEY_MOD2 ,
+ KEY_F9 | KEY_MOD2 ,
+ KEY_F10 | KEY_MOD2 ,
+ KEY_F11 | KEY_MOD2 ,
+ KEY_F12 | KEY_MOD2 ,
+
+ KEY_DOWN | KEY_MOD2 ,
+ KEY_UP | KEY_MOD2 ,
+ KEY_LEFT | KEY_MOD2 ,
+ KEY_RIGHT | KEY_MOD2 ,
+ KEY_HOME | KEY_MOD2 ,
+ KEY_END | KEY_MOD2 ,
+ KEY_PAGEUP | KEY_MOD2 ,
+ KEY_PAGEDOWN | KEY_MOD2 ,
+ KEY_RETURN | KEY_MOD2 ,
+ KEY_SPACE | KEY_MOD2 ,
+ KEY_BACKSPACE | KEY_MOD2 ,
+ KEY_INSERT | KEY_MOD2 ,
+ KEY_DELETE | KEY_MOD2 ,
+
+ KEY_0 | KEY_SHIFT | KEY_MOD2,
+ KEY_1 | KEY_SHIFT | KEY_MOD2,
+ KEY_2 | KEY_SHIFT | KEY_MOD2,
+ KEY_3 | KEY_SHIFT | KEY_MOD2,
+ KEY_4 | KEY_SHIFT | KEY_MOD2,
+ KEY_5 | KEY_SHIFT | KEY_MOD2,
+ KEY_6 | KEY_SHIFT | KEY_MOD2,
+ KEY_7 | KEY_SHIFT | KEY_MOD2,
+ KEY_8 | KEY_SHIFT | KEY_MOD2,
+ KEY_9 | KEY_SHIFT | KEY_MOD2,
+ KEY_A | KEY_SHIFT | KEY_MOD2,
+ KEY_B | KEY_SHIFT | KEY_MOD2,
+ KEY_C | KEY_SHIFT | KEY_MOD2,
+ KEY_D | KEY_SHIFT | KEY_MOD2,
+ KEY_E | KEY_SHIFT | KEY_MOD2,
+ KEY_F | KEY_SHIFT | KEY_MOD2,
+ KEY_G | KEY_SHIFT | KEY_MOD2,
+ KEY_H | KEY_SHIFT | KEY_MOD2,
+ KEY_I | KEY_SHIFT | KEY_MOD2,
+ KEY_J | KEY_SHIFT | KEY_MOD2,
+ KEY_K | KEY_SHIFT | KEY_MOD2,
+ KEY_L | KEY_SHIFT | KEY_MOD2,
+ KEY_M | KEY_SHIFT | KEY_MOD2,
+ KEY_N | KEY_SHIFT | KEY_MOD2,
+ KEY_O | KEY_SHIFT | KEY_MOD2,
+ KEY_P | KEY_SHIFT | KEY_MOD2,
+ KEY_Q | KEY_SHIFT | KEY_MOD2,
+ KEY_R | KEY_SHIFT | KEY_MOD2,
+ KEY_S | KEY_SHIFT | KEY_MOD2,
+ KEY_T | KEY_SHIFT | KEY_MOD2,
+ KEY_U | KEY_SHIFT | KEY_MOD2,
+ KEY_V | KEY_SHIFT | KEY_MOD2,
+ KEY_W | KEY_SHIFT | KEY_MOD2,
+ KEY_X | KEY_SHIFT | KEY_MOD2,
+ KEY_Y | KEY_SHIFT | KEY_MOD2,
+ KEY_Z | KEY_SHIFT | KEY_MOD2,
+
+ KEY_F1 | KEY_SHIFT | KEY_MOD2,
+ KEY_F2 | KEY_SHIFT | KEY_MOD2,
+ KEY_F3 | KEY_SHIFT | KEY_MOD2,
+ KEY_F4 | KEY_SHIFT | KEY_MOD2,
+ KEY_F5 | KEY_SHIFT | KEY_MOD2,
+ KEY_F6 | KEY_SHIFT | KEY_MOD2,
+ KEY_F7 | KEY_SHIFT | KEY_MOD2,
+ KEY_F8 | KEY_SHIFT | KEY_MOD2,
+ KEY_F9 | KEY_SHIFT | KEY_MOD2,
+ KEY_F10 | KEY_SHIFT | KEY_MOD2,
+ KEY_F11 | KEY_SHIFT | KEY_MOD2,
+ KEY_F12 | KEY_SHIFT | KEY_MOD2,
+
+ KEY_DOWN | KEY_SHIFT | KEY_MOD2,
+ KEY_UP | KEY_SHIFT | KEY_MOD2,
+ KEY_LEFT | KEY_SHIFT | KEY_MOD2,
+ KEY_RIGHT | KEY_SHIFT | KEY_MOD2,
+ KEY_HOME | KEY_SHIFT | KEY_MOD2,
+ KEY_END | KEY_SHIFT | KEY_MOD2,
+ KEY_PAGEUP | KEY_SHIFT | KEY_MOD2,
+ KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD2,
+ KEY_RETURN | KEY_SHIFT | KEY_MOD2,
+ KEY_SPACE | KEY_SHIFT | KEY_MOD2,
+ KEY_BACKSPACE | KEY_SHIFT | KEY_MOD2,
+ KEY_INSERT | KEY_SHIFT | KEY_MOD2,
+ KEY_DELETE | KEY_SHIFT | KEY_MOD2,
+
+ KEY_0 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_1 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_2 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_3 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_4 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_5 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_6 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_7 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_8 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_9 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_A | KEY_MOD1 | KEY_MOD2 ,
+ KEY_B | KEY_MOD1 | KEY_MOD2 ,
+ KEY_C | KEY_MOD1 | KEY_MOD2 ,
+ KEY_D | KEY_MOD1 | KEY_MOD2 ,
+ KEY_E | KEY_MOD1 | KEY_MOD2 ,
+ KEY_F | KEY_MOD1 | KEY_MOD2 ,
+ KEY_G | KEY_MOD1 | KEY_MOD2 ,
+ KEY_H | KEY_MOD1 | KEY_MOD2 ,
+ KEY_I | KEY_MOD1 | KEY_MOD2 ,
+ KEY_J | KEY_MOD1 | KEY_MOD2 ,
+ KEY_K | KEY_MOD1 | KEY_MOD2 ,
+ KEY_L | KEY_MOD1 | KEY_MOD2 ,
+ KEY_M | KEY_MOD1 | KEY_MOD2 ,
+ KEY_N | KEY_MOD1 | KEY_MOD2 ,
+ KEY_O | KEY_MOD1 | KEY_MOD2 ,
+ KEY_P | KEY_MOD1 | KEY_MOD2 ,
+ KEY_Q | KEY_MOD1 | KEY_MOD2 ,
+ KEY_R | KEY_MOD1 | KEY_MOD2 ,
+ KEY_S | KEY_MOD1 | KEY_MOD2 ,
+ KEY_T | KEY_MOD1 | KEY_MOD2 ,
+ KEY_U | KEY_MOD1 | KEY_MOD2 ,
+ KEY_V | KEY_MOD1 | KEY_MOD2 ,
+ KEY_W | KEY_MOD1 | KEY_MOD2 ,
+ KEY_X | KEY_MOD1 | KEY_MOD2 ,
+ KEY_Y | KEY_MOD1 | KEY_MOD2 ,
+ KEY_Z | KEY_MOD1 | KEY_MOD2 ,
+
+ KEY_F1 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_F2 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_F3 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_F4 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_F5 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_F6 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_F7 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_F8 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_F9 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_F10 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_F11 | KEY_MOD1 | KEY_MOD2 ,
+ KEY_F12 | KEY_MOD1 | KEY_MOD2 ,
+
+ KEY_DOWN | KEY_MOD1 | KEY_MOD2 ,
+ KEY_UP | KEY_MOD1 | KEY_MOD2 ,
+ KEY_LEFT | KEY_MOD1 | KEY_MOD2 ,
+ KEY_RIGHT | KEY_MOD1 | KEY_MOD2 ,
+ KEY_HOME | KEY_MOD1 | KEY_MOD2 ,
+ KEY_END | KEY_MOD1 | KEY_MOD2 ,
+ KEY_PAGEUP | KEY_MOD1 | KEY_MOD2 ,
+ KEY_PAGEDOWN | KEY_MOD1 | KEY_MOD2 ,
+ KEY_RETURN | KEY_MOD1 | KEY_MOD2 ,
+ KEY_SPACE | KEY_MOD1 | KEY_MOD2 ,
+ KEY_BACKSPACE | KEY_MOD1 | KEY_MOD2 ,
+ KEY_INSERT | KEY_MOD1 | KEY_MOD2 ,
+ KEY_DELETE | KEY_MOD1 | KEY_MOD2 ,
+
+ KEY_0 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_1 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_2 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_3 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_4 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_5 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_6 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_7 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_8 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_9 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_A | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_B | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_C | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_D | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_E | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_F | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_G | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_H | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_I | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_J | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_K | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_L | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_M | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_N | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_O | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_P | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_Q | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_R | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_S | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_T | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_U | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_V | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_W | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_X | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_Y | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_Z | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+
+ KEY_F1 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_F2 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_F3 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_F4 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_F5 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_F6 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_F7 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_F8 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_F9 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_F10 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_F11 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_F12 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+
+ KEY_DOWN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_UP | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_LEFT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_RIGHT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_HOME | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_END | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_PAGEUP | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_RETURN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_SPACE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_BACKSPACE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_INSERT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_DELETE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2
+};
+
+static USHORT KEYCODE_ARRAY_SIZE = (sizeof(KEYCODE_ARRAY) / sizeof(KEYCODE_ARRAY[0]));
+
+//-----------------------------------------------
+// seems to be needed to layout the list box, which shows all
+// assignable shortcuts
+static long AccCfgTabs[] =
+{
+ 2, // Number of Tabs
+ 0,
+ 120 // Function
+};
+
+//-----------------------------------------------
+class SfxAccCfgLBoxString_Impl : public SvLBoxString
+{
+ public:
+ SfxAccCfgLBoxString_Impl( SvLBoxEntry* pEntry,
+ USHORT nFlags,
+ const String& sText );
+
+ virtual ~SfxAccCfgLBoxString_Impl();
+
+ virtual void Paint(const Point& aPos ,
+ SvLBox& rDevice,
+ USHORT nFlags ,
+ SvLBoxEntry* pEntry );
+};
+
+//-----------------------------------------------
+SfxAccCfgLBoxString_Impl::SfxAccCfgLBoxString_Impl( SvLBoxEntry* pEntry,
+ USHORT nFlags,
+ const String& sText )
+ : SvLBoxString(pEntry, nFlags, sText)
+{
+}
+
+//-----------------------------------------------
+SfxAccCfgLBoxString_Impl::~SfxAccCfgLBoxString_Impl()
+{
+}
+
+//-----------------------------------------------
+void SfxAccCfgLBoxString_Impl::Paint(const Point& aPos ,
+ SvLBox& rDevice,
+ USHORT /*nFlags*/,
+ SvLBoxEntry* pEntry )
+{
+ /*/ ??? realy needed !!!
+ Font aOldFont(rDevice.GetFont());
+ Font aNewFont(aOldFont );
+ rDevice.SetFont( aFont );
+ */
+
+ if (!pEntry)
+ return;
+
+ TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData();
+ if (!pUserData)
+ return;
+
+ if (pUserData->m_bIsConfigurable)
+ rDevice.DrawText(aPos, GetText());
+ else
+ rDevice.DrawCtrlText(aPos, GetText(), 0, STRING_LEN, TEXT_DRAW_DISABLE);
+
+ //rDev.SetFont( aOldFont );
+}
+
+//-----------------------------------------------
+void SfxAccCfgTabListBox_Impl::InitEntry( SvLBoxEntry* pEntry ,
+ const XubString& sText ,
+ const Image& aImage1,
+ const Image& aImage2,
+ SvLBoxButtonKind eButtonKind)
+{
+ SvTabListBox::InitEntry(pEntry, sText, aImage1, aImage2, eButtonKind);
+}
+
+//-----------------------------------------------
+/** select the entry, which match the current key input ... excepting
+ keys, which are used for the dialog itself.
+ */
+void SfxAccCfgTabListBox_Impl::KeyInput(const KeyEvent& aKey)
+{
+ KeyCode aCode1 = aKey.GetKeyCode();
+ USHORT nCode1 = aCode1.GetCode();
+ USHORT nMod1 = aCode1.GetModifier();
+
+ // is it related to our list box ?
+ if (
+ (nCode1 != KEY_DOWN ) &&
+ (nCode1 != KEY_UP ) &&
+ (nCode1 != KEY_LEFT ) &&
+ (nCode1 != KEY_RIGHT ) &&
+ (nCode1 != KEY_PAGEUP ) &&
+ (nCode1 != KEY_PAGEDOWN)
+ )
+ {
+ SvLBoxEntry* pEntry = First();
+ while (pEntry)
+ {
+ TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData();
+ if (pUserData)
+ {
+ USHORT nCode2 = pUserData->m_aKey.GetCode();
+ USHORT nMod2 = pUserData->m_aKey.GetModifier();
+ if (
+ (nCode1 == nCode2) &&
+ (nMod1 == nMod2 )
+ )
+ {
+ Select (pEntry);
+ MakeVisible(pEntry);
+ return;
+ }
+ }
+ pEntry = Next(pEntry);
+ }
+ }
+
+ // no - handle it as normal dialog input
+ SvTabListBox::KeyInput(aKey);
+}
+
+//-----------------------------------------------
+SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxItemSet& aSet )
+ : SfxTabPage (pParent, SVX_RES(RID_SVXPAGE_KEYBOARD), aSet)
+ , m_pMacroInfoItem ()
+ , m_pStringItem ()
+ , m_pFontItem ()
+ , m_pFileDlg (NULL)
+ , aEntriesBox (this , this, SVX_RES(BOX_ACC_ENTRIES ))
+ , aKeyboardGroup (this , SVX_RES(GRP_ACC_KEYBOARD ))
+ , aOfficeButton (this , SVX_RES(RB_OFFICE ))
+ , aModuleButton (this , SVX_RES(RB_MODULE ))
+ , aChangeButton (this , SVX_RES(BTN_ACC_CHANGE ))
+ , aRemoveButton (this , SVX_RES(BTN_ACC_REMOVE ))
+ , aGroupText (this , SVX_RES(TXT_ACC_GROUP ))
+ , pGroupLBox(new SfxConfigGroupListBox_Impl( this, SVX_RES(BOX_ACC_GROUP), SFX_SLOT_ACCELCONFIG ))
+ , aFunctionText (this , SVX_RES(TXT_ACC_FUNCTION ))
+ , pFunctionBox(new SfxConfigFunctionListBox_Impl( this, SVX_RES( BOX_ACC_FUNCTION )))
+ , aKeyText (this , SVX_RES(TXT_ACC_KEY ))
+ , aKeyBox (this , SVX_RES(BOX_ACC_KEY ))
+ , aFunctionsGroup (this , SVX_RES(GRP_ACC_FUNCTIONS ))
+ , aLoadButton (this , SVX_RES(BTN_LOAD ))
+ , aSaveButton (this , SVX_RES(BTN_SAVE ))
+ , aResetButton (this , SVX_RES(BTN_RESET ))
+ , aLoadAccelConfigStr ( SVX_RES( STR_LOADACCELCONFIG ) )
+ , aSaveAccelConfigStr ( SVX_RES( STR_SAVEACCELCONFIG ) )
+ , aFilterAllStr ( SVX_RES( STR_SFX_FILTERNAME_ALL ) )
+ , aFilterCfgStr ( SVX_RES( STR_FILTERNAME_CFG ) )
+ , m_bStylesInfoInitialized(sal_False)
+ , m_xGlobal ()
+ , m_xModule ()
+ , m_xAct ()
+{
+ FreeResource();
+
+// install handler functions
+ aChangeButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, ChangeHdl ));
+ aRemoveButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RemoveHdl ));
+ aEntriesBox.SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl ));
+ pGroupLBox->SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl ));
+ pFunctionBox->SetSelectHdl( LINK( this, SfxAcceleratorConfigPage, SelectHdl ));
+ aKeyBox.SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl ));
+ aLoadButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Load ));
+ aSaveButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Save ));
+ aResetButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Default ));
+ aOfficeButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl ));
+ aModuleButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl ));
+
+ // initialize Entriesbox
+ aEntriesBox.SetWindowBits(WB_HSCROLL|WB_CLIPCHILDREN);
+ aEntriesBox.SetSelectionMode(SINGLE_SELECTION);
+ aEntriesBox.SetTabs(&AccCfgTabs[0], MAP_APPFONT);
+ aEntriesBox.Resize(); // OS: Hack for right selection
+ aEntriesBox.SetSpaceBetweenEntries(0);
+ aEntriesBox.SetDragDropMode(0);
+
+ // detect max keyname width
+ long nMaxWidth = 0;
+ for ( USHORT i = 0; i < KEYCODE_ARRAY_SIZE; ++i )
+ {
+ long nTmp = GetTextWidth( KeyCode( KEYCODE_ARRAY[i] ).GetName() );
+ if ( nTmp > nMaxWidth )
+ nMaxWidth = nTmp;
+ }
+ // recalc second tab
+ long nNewTab = PixelToLogic( Size( nMaxWidth, 0 ), MAP_APPFONT ).Width();
+ nNewTab = nNewTab + 5; // additional space
+ aEntriesBox.SetTab( 1, nNewTab );
+
+ // initialize GroupBox
+ pGroupLBox->SetFunctionListBox(pFunctionBox);
+
+ // initialize KeyBox
+ aKeyBox.SetWindowBits(WB_CLIPCHILDREN|WB_HSCROLL|WB_SORT);
+}
+
+//-----------------------------------------------
+SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
+{
+ // free memory - remove all dynamic user data
+ SvLBoxEntry* pEntry = aEntriesBox.First();
+ while (pEntry)
+ {
+ TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData();
+ if (pUserData)
+ delete pUserData;
+ pEntry = aEntriesBox.Next(pEntry);
+ }
+
+ pEntry = aKeyBox.First();
+ while (pEntry)
+ {
+ TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData();
+ if (pUserData)
+ delete pUserData;
+ pEntry = aKeyBox.Next(pEntry);
+ }
+
+ aEntriesBox.Clear();
+ aKeyBox.Clear();
+
+ delete m_pFileDlg;
+ delete pGroupLBox;
+ delete pFunctionBox;
+}
+
+//-----------------------------------------------
+void SfxAcceleratorConfigPage::InitAccCfg()
+{
+ // already initialized ?
+ if (m_xSMGR.is())
+ return; // yes -> do nothing
+
+ try
+ {
+ // no - initialize this instance
+ m_xSMGR = ::utl::getProcessServiceFactory();
+
+ m_xUICmdDescription = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICMDDESCRIPTION), css::uno::UNO_QUERY_THROW);
+
+ // get the current active frame, which should be our "parent"
+ // for this session
+ m_xFrame = GetFrame();
+ if ( !m_xFrame.is() )
+ {
+ css::uno::Reference< css::frame::XFramesSupplier > xDesktop(m_xSMGR->createInstance(SERVICE_DESKTOP), css::uno::UNO_QUERY_THROW);
+ m_xFrame = xDesktop->getActiveFrame();
+ }
+
+ // identify module
+ css::uno::Reference< css::frame::XModuleManager > xModuleManager (m_xSMGR->createInstance(SERVICE_MODULEMANAGER), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::container::XNameAccess > xModuleManagerCont(xModuleManager , css::uno::UNO_QUERY_THROW);
+ m_sModuleLongName = xModuleManager->identify(m_xFrame);
+ ::comphelper::SequenceAsHashMap lModuleProps(xModuleManagerCont->getByName(m_sModuleLongName));
+ m_sModuleShortName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_SHORTNAME, ::rtl::OUString());
+ m_sModuleUIName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_UINAME , ::rtl::OUString());
+
+ // get global accelerator configuration
+ m_xGlobal = css::uno::Reference< css::ui::XAcceleratorConfiguration >(m_xSMGR->createInstance(SERVICE_GLOBALACCCFG), css::uno::UNO_QUERY_THROW);
+
+ // get module accelerator configuration
+ css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(m_xSMGR->createInstance(SERVICE_MODULEUICONFIGSUPPLIER), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::ui::XUIConfigurationManager > xUICfgManager = xModuleCfgSupplier->getUIConfigurationManager(m_sModuleLongName);
+ m_xModule = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUICfgManager->getShortCutManager(), css::uno::UNO_QUERY_THROW);
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ { m_xSMGR.clear(); }
+}
+
+//-----------------------------------------------
+/** Initialize text columns with own class to enable custom painting
+ This is needed as we have to paint disabled entries by ourself. No support for that in the
+ original SvTabListBox!
+ */
+void SfxAcceleratorConfigPage::CreateCustomItems( SvLBoxEntry* pEntry,
+ const String& sCol1 ,
+ const String& sCol2 )
+{
+ SfxAccCfgLBoxString_Impl* pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol1);
+ pEntry->ReplaceItem(pStringItem, 1);
+
+ pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol2);
+ pEntry->ReplaceItem(pStringItem, 2);
+}
+
+//-----------------------------------------------
+void SfxAcceleratorConfigPage::Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xAccMgr)
+{
+ if (!xAccMgr.is())
+ return;
+
+ if (!m_bStylesInfoInitialized)
+ {
+ css::uno::Reference< css::frame::XController > xController;
+ css::uno::Reference< css::frame::XModel > xModel;
+ if (m_xFrame.is())
+ xController = m_xFrame->getController();
+ if (xController.is())
+ xModel = xController->getModel();
+
+ m_aStylesInfo.setModel(xModel);
+ pFunctionBox->SetStylesInfo(&m_aStylesInfo);
+ pGroupLBox->SetStylesInfo(&m_aStylesInfo);
+ m_bStylesInfoInitialized = sal_True;
+ }
+
+ // Insert all editable accelerators into list box. It is possible
+ // that some accelerators are not mapped on the current system/keyboard
+ // but we don't want to lose these mappings.
+ USHORT c1 = KEYCODE_ARRAY_SIZE;
+ USHORT i1 = 0;
+ USHORT nListPos = 0;
+ for (i1=0; i1<c1; ++i1)
+ {
+ KeyCode aKey = KEYCODE_ARRAY[i1];
+ String sKey = aKey.GetName();
+ if (!sKey.Len())
+ continue;
+ TAccInfo* pEntry = new TAccInfo(i1, nListPos, aKey);
+ SvLBoxEntry* pLBEntry = aEntriesBox.InsertEntryToColumn(sKey, 0L, LIST_APPEND, 0xFFFF);
+ pLBEntry->SetUserData(pEntry);
+ }
+
+ // Assign all commands to its shortcuts - reading the accelerator config.
+ css::uno::Sequence< css::awt::KeyEvent > lKeys = xAccMgr->getAllKeyEvents();
+ sal_Int32 c2 = lKeys.getLength();
+ sal_Int32 i2 = 0;
+ USHORT nCol = aEntriesBox.TabCount()-1;
+
+ for (i2=0; i2<c2; ++i2)
+ {
+ const css::awt::KeyEvent& aAWTKey = lKeys[i2];
+ ::rtl::OUString sCommand = xAccMgr->getCommandByKeyEvent(aAWTKey);
+ String sLabel = GetLabel4Command(sCommand);
+ KeyCode aKeyCode = ::svt::AcceleratorExecute::st_AWTKey2VCLKey(aAWTKey);
+ USHORT nPos = MapKeyCodeToPos(aKeyCode);
+
+ if (nPos == LISTBOX_ENTRY_NOTFOUND)
+ continue;
+
+ aEntriesBox.SetEntryText(sLabel, nPos, nCol);
+
+ SvLBoxEntry* pLBEntry = aEntriesBox.GetEntry(0, nPos);
+ TAccInfo* pEntry = (TAccInfo*)pLBEntry->GetUserData();
+
+ pEntry->m_bIsConfigurable = sal_True;
+ pEntry->m_sCommand = sCommand;
+ CreateCustomItems(pLBEntry, aEntriesBox.GetEntryText(pLBEntry, 0), sLabel);
+ }
+
+ // Map the VCL hardcoded key codes and mark them as not changeable
+ ULONG c3 = Application::GetReservedKeyCodeCount();
+ ULONG i3 = 0;
+ for (i3=0; i3<c3; ++i3)
+ {
+ const KeyCode* pKeyCode = Application::GetReservedKeyCode(i3);
+ USHORT nPos = MapKeyCodeToPos(*pKeyCode);
+
+ if (nPos == LISTBOX_ENTRY_NOTFOUND)
+ continue;
+
+ // Hardcoded function mapped so no ID possible and mark entry as not changeable
+ SvLBoxEntry* pLBEntry = aEntriesBox.GetEntry(0, nPos);
+ TAccInfo* pEntry = (TAccInfo*)pLBEntry->GetUserData();
+
+ pEntry->m_bIsConfigurable = sal_False;
+ CreateCustomItems(pLBEntry, aEntriesBox.GetEntryText(pLBEntry, 0), String());
+ }
+}
+
+//-----------------------------------------------
+void SfxAcceleratorConfigPage::Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xAccMgr)
+{
+ if (!xAccMgr.is())
+ return;
+
+ // Go through the list from the bottom to the top ...
+ // because logical accelerator must be preferred instead of
+ // physical ones!
+ SvLBoxEntry* pEntry = aEntriesBox.First();
+ while (pEntry)
+ {
+ TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData();
+ ::rtl::OUString sCommand ;
+ css::awt::KeyEvent aAWTKey ;
+
+ if (pUserData)
+ {
+ sCommand = pUserData->m_sCommand;
+ aAWTKey = ::svt::AcceleratorExecute::st_VCLKey2AWTKey(pUserData->m_aKey);
+ }
+
+ try
+ {
+ if (sCommand.getLength())
+ xAccMgr->setKeyEvent(aAWTKey, sCommand);
+ else
+ xAccMgr->removeKeyEvent(aAWTKey);
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ {}
+
+ pEntry = aEntriesBox.Next(pEntry);
+ }
+}
+
+//-----------------------------------------------
+void SfxAcceleratorConfigPage::ResetConfig()
+{
+ aEntriesBox.Clear();
+}
+
+//-----------------------------------------------
+IMPL_LINK( SfxAcceleratorConfigPage, Load, Button*, EMPTYARG )
+{
+ // ask for filename, where we should load the new config data from
+ StartFileDialog( WB_OPEN | WB_STDMODAL | WB_3DLOOK, aLoadAccelConfigStr );
+ return 0;
+}
+
+//-----------------------------------------------
+IMPL_LINK( SfxAcceleratorConfigPage, Save, Button*, EMPTYARG )
+{
+ StartFileDialog( WB_SAVEAS | WB_STDMODAL | WB_3DLOOK, aLoadAccelConfigStr );
+ return 0;
+}
+
+//-----------------------------------------------
+IMPL_LINK(SfxAcceleratorConfigPage, Default, PushButton*, EMPTYARG)
+{
+ css::uno::Reference< css::form::XReset > xReset(m_xAct, css::uno::UNO_QUERY);
+ if (xReset.is())
+ xReset->reset();
+
+ aEntriesBox.SetUpdateMode(FALSE);
+ ResetConfig();
+ Init(m_xAct);
+ aEntriesBox.SetUpdateMode(TRUE);
+ aEntriesBox.Invalidate();
+ aEntriesBox.Select(aEntriesBox.GetEntry(0, 0));
+
+ return 0;
+}
+
+//-----------------------------------------------
+IMPL_LINK( SfxAcceleratorConfigPage, ChangeHdl, Button*, EMPTYARG )
+{
+ USHORT nPos = (USHORT) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() );
+ TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData();
+ String sNewCommand = pFunctionBox->GetCurCommand();
+ String sLabel = pFunctionBox->GetCurLabel();
+ if (!sLabel.Len())
+ sLabel = GetLabel4Command(sNewCommand);
+
+ pEntry->m_sCommand = sNewCommand;
+ USHORT nCol = aEntriesBox.TabCount() - 1;
+ aEntriesBox.SetEntryText(sLabel, nPos, nCol);
+
+ ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox );
+ return 0;
+}
+
+//-----------------------------------------------
+IMPL_LINK( SfxAcceleratorConfigPage, RemoveHdl, Button *, EMPTYARG )
+{
+ // get selected entry
+ USHORT nPos = (USHORT) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() );
+ TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData();
+
+ // remove function name from selected entry
+ USHORT nCol = aEntriesBox.TabCount() - 1;
+ aEntriesBox.SetEntryText( String(), nPos, nCol );
+ pEntry->m_sCommand = ::rtl::OUString();
+
+ ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox );
+ return 0;
+}
+
+//-----------------------------------------------
+IMPL_LINK( SfxAcceleratorConfigPage, SelectHdl, Control*, pListBox )
+{
+ // disable help
+ Help::ShowBalloon( this, Point(), String() );
+ if ( pListBox == &aEntriesBox )
+ {
+ USHORT nPos = (USHORT) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() );
+ TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData();
+ ::rtl::OUString sPossibleNewCommand = pFunctionBox->GetCurCommand();
+
+ aRemoveButton.Enable( FALSE );
+ aChangeButton.Enable( FALSE );
+
+ if (pEntry->m_bIsConfigurable)
+ {
+ if (pEntry->isConfigured())
+ aRemoveButton.Enable( TRUE );
+ aChangeButton.Enable( pEntry->m_sCommand != sPossibleNewCommand );
+ }
+ }
+ else if ( pListBox == pGroupLBox )
+ {
+ pGroupLBox->GroupSelected();
+ if ( !pFunctionBox->FirstSelected() )
+ aChangeButton.Enable( FALSE );
+ }
+ else if ( pListBox == pFunctionBox )
+ {
+ aRemoveButton.Enable( FALSE );
+ aChangeButton.Enable( FALSE );
+
+ // #i36994 First selected can return zero!
+ SvLBoxEntry* pLBEntry = aEntriesBox.FirstSelected();
+ if ( pLBEntry != 0 )
+ {
+ USHORT nPos = (USHORT) aEntriesBox.GetModel()->GetRelPos( pLBEntry );
+ TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData();
+ ::rtl::OUString sPossibleNewCommand = pFunctionBox->GetCurCommand();
+
+ if (pEntry->m_bIsConfigurable)
+ {
+ if (pEntry->isConfigured())
+ aRemoveButton.Enable( TRUE );
+ aChangeButton.Enable( pEntry->m_sCommand != sPossibleNewCommand );
+ }
+
+ // update key box
+ aKeyBox.Clear();
+ SvLBoxEntry* pIt = aEntriesBox.First();
+ while ( pIt )
+ {
+ TAccInfo* pUserData = (TAccInfo*)pIt->GetUserData();
+ if ( pUserData && pUserData->m_sCommand == sPossibleNewCommand )
+ {
+ TAccInfo* pU1 = new TAccInfo(-1, -1, pUserData->m_aKey);
+ SvLBoxEntry* pE1 = aKeyBox.InsertEntry( pUserData->m_aKey.GetName(), 0L, TRUE, LIST_APPEND );
+ pE1->SetUserData(pU1);
+ pE1->EnableChildsOnDemand( FALSE );
+ }
+ pIt = aEntriesBox.Next(pIt);
+ }
+ }
+ }
+ else
+ {
+ // goto selected "key" entry of the key box
+ SvLBoxEntry* pE2 = 0;
+ TAccInfo* pU2 = 0;
+ USHORT nP2 = LISTBOX_ENTRY_NOTFOUND;
+ SvLBoxEntry* pE3 = 0;
+
+ pE2 = aKeyBox.FirstSelected();
+ if (pE2)
+ pU2 = (TAccInfo*)pE2->GetUserData();
+ if (pU2)
+ nP2 = MapKeyCodeToPos(pU2->m_aKey);
+ if (nP2 != LISTBOX_ENTRY_NOTFOUND)
+ pE3 = aEntriesBox.GetEntry( 0, nP2 );
+ if (pE3)
+ {
+ aEntriesBox.Select( pE3 );
+ aEntriesBox.MakeVisible( pE3 );
+ }
+ }
+
+ return 0;
+}
+
+//-----------------------------------------------
+IMPL_LINK( SfxAcceleratorConfigPage, RadioHdl, RadioButton *, EMPTYARG )
+{
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > xOld = m_xAct;
+
+ if (aOfficeButton.IsChecked())
+ m_xAct = m_xGlobal;
+ else if (aModuleButton.IsChecked())
+ m_xAct = m_xModule;
+
+ // nothing changed? => do nothing!
+ if ( m_xAct.is() && ( xOld == m_xAct ) )
+ return 0;
+
+ aEntriesBox.SetUpdateMode( FALSE );
+ ResetConfig();
+ Init(m_xAct);
+ aEntriesBox.SetUpdateMode( TRUE );
+ aEntriesBox.Invalidate();
+
+ pGroupLBox->Init(m_xSMGR, m_xFrame, m_sModuleLongName);
+
+ // pb: #133213# do not select NULL entries
+ SvLBoxEntry* pEntry = aEntriesBox.GetEntry( 0, 0 );
+ if ( pEntry )
+ aEntriesBox.Select( pEntry );
+ pEntry = pGroupLBox->GetEntry( 0, 0 );
+ if ( pEntry )
+ pGroupLBox->Select( pEntry );
+
+ ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox );
+ return 1L;
+}
+
+//-----------------------------------------------
+IMPL_LINK( SfxAcceleratorConfigPage, LoadHdl, sfx2::FileDialogHelper*, EMPTYARG )
+{
+ DBG_ASSERT( m_pFileDlg, "SfxInternetPage::DialogClosedHdl(): no file dialog" );
+
+ ::rtl::OUString sCfgName;
+ if ( ERRCODE_NONE == m_pFileDlg->GetError() )
+ sCfgName = m_pFileDlg->GetPath();
+
+ if ( !sCfgName.getLength() )
+ return 0;
+
+ GetTabDialog()->EnterWait();
+
+ css::uno::Reference< css::frame::XModel > xDoc ;
+ css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ;
+ css::uno::Reference< css::embed::XStorage > xRootStorage; // we must hold the root storage alive, if xCfgMgr is used!
+
+ try
+ {
+ // first check if URL points to a document already loaded
+ xDoc = SearchForAlreadyLoadedDoc(sCfgName);
+ if (xDoc.is())
+ {
+ // Get ui config manager. There should always be one at the model.
+ css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xCfgSupplier(xDoc, css::uno::UNO_QUERY_THROW);
+ xCfgMgr = xCfgSupplier->getUIConfigurationManager();
+ }
+ else
+ {
+ // URL doesn't point to a loaded document, try to access it as a single storage
+ // dont forget to release the storage afterwards!
+ css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(m_xSMGR->createInstance(SERVICE_STORAGEFACTORY), css::uno::UNO_QUERY_THROW);
+ css::uno::Sequence< css::uno::Any > lArgs(2);
+ lArgs[0] <<= sCfgName;
+ lArgs[1] <<= css::embed::ElementModes::READ;
+
+ xRootStorage = css::uno::Reference< css::embed::XStorage >(xStorageFactory->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::embed::XStorage > xUIConfig = xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, css::embed::ElementModes::READ);
+ if (xUIConfig.is())
+ {
+ xCfgMgr = css::uno::Reference< css::ui::XUIConfigurationManager >(m_xSMGR->createInstance(SERVICE_UICONFIGMGR), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::ui::XUIConfigurationStorage > xCfgMgrStore(xCfgMgr, css::uno::UNO_QUERY_THROW);
+ xCfgMgrStore->setStorage(xUIConfig);
+ }
+ }
+
+ if (xCfgMgr.is())
+ {
+ // open the configuration and update our UI
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > xTempAccMgr(xCfgMgr->getShortCutManager(), css::uno::UNO_QUERY_THROW);
+
+ aEntriesBox.SetUpdateMode(FALSE);
+ ResetConfig();
+ Init(xTempAccMgr);
+ aEntriesBox.SetUpdateMode(TRUE);
+ aEntriesBox.Invalidate();
+ aEntriesBox.Select(aEntriesBox.GetEntry(0, 0));
+
+ }
+
+ // dont forget to close the new opened storage!
+ // We are the owner of it.
+ if (xRootStorage.is())
+ {
+ css::uno::Reference< css::lang::XComponent > xComponent;
+ xComponent = css::uno::Reference< css::lang::XComponent >(xCfgMgr, css::uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+ xComponent = css::uno::Reference< css::lang::XComponent >(xRootStorage, css::uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+ }
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ {}
+
+ GetTabDialog()->LeaveWait();
+
+ return 0;
+}
+
+//-----------------------------------------------
+IMPL_LINK( SfxAcceleratorConfigPage, SaveHdl, sfx2::FileDialogHelper*, EMPTYARG )
+{
+ DBG_ASSERT( m_pFileDlg, "SfxInternetPage::DialogClosedHdl(): no file dialog" );
+
+ ::rtl::OUString sCfgName;
+ if ( ERRCODE_NONE == m_pFileDlg->GetError() )
+ sCfgName = m_pFileDlg->GetPath();
+
+ if ( !sCfgName.getLength() )
+ return 0;
+
+ GetTabDialog()->EnterWait();
+
+ css::uno::Reference< css::frame::XModel > xDoc ;
+ css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ;
+ css::uno::Reference< css::embed::XStorage > xRootStorage;
+
+ try
+ {
+ // first check if URL points to a document already loaded
+ xDoc = SearchForAlreadyLoadedDoc(sCfgName);
+ if (xDoc.is())
+ {
+ // get config manager, force creation if there was none before
+ css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xCfgSupplier(xDoc, css::uno::UNO_QUERY_THROW);
+ xCfgMgr = xCfgSupplier->getUIConfigurationManager();
+ }
+ else
+ {
+ // URL doesn't point to a loaded document, try to access it as a single storage
+ css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(m_xSMGR->createInstance(SERVICE_STORAGEFACTORY), css::uno::UNO_QUERY_THROW);
+ css::uno::Sequence< css::uno::Any > lArgs(2);
+ lArgs[0] <<= sCfgName;
+ lArgs[1] <<= css::embed::ElementModes::WRITE;
+
+ xRootStorage = css::uno::Reference< css::embed::XStorage >(
+ xStorageFactory->createInstanceWithArguments(lArgs),
+ css::uno::UNO_QUERY_THROW);
+
+ css::uno::Reference< css::embed::XStorage > xUIConfig(
+ xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, css::embed::ElementModes::WRITE),
+ css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::beans::XPropertySet > xUIConfigProps(
+ xUIConfig,
+ css::uno::UNO_QUERY_THROW);
+
+ // set the correct media type if the storage was new created
+ ::rtl::OUString sMediaType;
+ xUIConfigProps->getPropertyValue(MEDIATYPE_PROPNAME) >>= sMediaType;
+ if (!sMediaType.getLength())
+ xUIConfigProps->setPropertyValue(MEDIATYPE_PROPNAME, css::uno::makeAny(MEDIATYPE_UICONFIG));
+
+ xCfgMgr = css::uno::Reference< css::ui::XUIConfigurationManager >(m_xSMGR->createInstance(SERVICE_UICONFIGMGR), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::ui::XUIConfigurationStorage > xUICfgStore(xCfgMgr, css::uno::UNO_QUERY_THROW);
+ xUICfgStore->setStorage(xUIConfig);
+ }
+
+ if (xCfgMgr.is())
+ {
+ // get the target configuration access and update with all shortcuts
+ // which are set currently at the UI !
+ // Dont copy the m_xAct content to it ... because m_xAct will be updated
+ // from the UI on pressing the button "OK" only. And inbetween it's not up to date !
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > xTargetAccMgr(xCfgMgr->getShortCutManager(), css::uno::UNO_QUERY_THROW);
+ Apply(xTargetAccMgr);
+
+ // commit (order is important!)
+ css::uno::Reference< css::ui::XUIConfigurationPersistence > xCommit1(xTargetAccMgr, css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::ui::XUIConfigurationPersistence > xCommit2(xCfgMgr , css::uno::UNO_QUERY_THROW);
+ xCommit1->store();
+ xCommit2->store();
+
+ if (xRootStorage.is())
+ {
+ // Commit root storage
+ css::uno::Reference< css::embed::XTransactedObject > xCommit3(xRootStorage, css::uno::UNO_QUERY_THROW);
+ xCommit3->commit();
+ }
+ }
+
+ if (xRootStorage.is())
+ {
+ css::uno::Reference< css::lang::XComponent > xComponent;
+ xComponent = css::uno::Reference< css::lang::XComponent >(xCfgMgr, css::uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+ xComponent = css::uno::Reference< css::lang::XComponent >(xRootStorage, css::uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+ }
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ {}
+
+ GetTabDialog()->LeaveWait();
+
+ return 0;
+}
+
+::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL )
+{
+ ::rtl::OUString aLabel;
+ if ( aCmdURL.getLength() )
+ {
+ try
+ {
+ uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ uno::Reference< container::XNameAccess > xUICommandLabels;
+ const ::rtl::OUString aModule( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) );
+ uno::Any a = xNameAccess->getByName( aModule );
+ uno::Reference< container::XNameAccess > xUICommands;
+ a >>= xUICommandLabels;
+ rtl::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;
+}
+
+
+//-----------------------------------------------
+String SfxAcceleratorConfigPage::GetFunctionName(KeyFuncType eType) const
+{
+ ::rtl::OUStringBuffer sName(256);
+ sName.appendAscii("\"");
+ switch(eType)
+ {
+ case KEYFUNC_NEW :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:NewDoc") ) );
+ break;
+
+ case KEYFUNC_OPEN :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Open") ) );
+ break;
+
+ case KEYFUNC_SAVE :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Save") ) );
+ break;
+
+ case KEYFUNC_SAVEAS :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:SaveAs") ) );
+ break;
+
+ case KEYFUNC_PRINT :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Print") ) );
+ break;
+
+ case KEYFUNC_CLOSE :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Close") ) );
+ break;
+
+ case KEYFUNC_QUIT :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Quit") ) );
+ break;
+
+ case KEYFUNC_CUT :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Cut") ) );
+ break;
+
+ case KEYFUNC_COPY :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Copy") ) );
+ break;
+
+ case KEYFUNC_PASTE :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Paste") ) );
+ break;
+
+ case KEYFUNC_UNDO :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Undo") ) );
+ break;
+
+ case KEYFUNC_REDO :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Redo") ) );
+ break;
+
+ case KEYFUNC_DELETE :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Delete") ) );
+ break;
+
+ case KEYFUNC_REPEAT :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Repeat") ) );
+ break;
+
+ case KEYFUNC_FIND :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Search") ) );
+ break;
+
+ case KEYFUNC_FINDBACKWARD :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:SearchBackwards") ) );
+ break;
+
+ case KEYFUNC_PROPERTIES :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Options") ) );
+ break;
+
+ case KEYFUNC_FRONT :
+ sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:ToFront") ) );
+ break;
+
+ default:
+ break;
+ }
+ sName.appendAscii("\"");
+ return String(sName.makeStringAndClear());
+}
+
+//-----------------------------------------------
+void SfxAcceleratorConfigPage::StartFileDialog( WinBits nBits, const String& rTitle )
+{
+ bool bSave = ( ( nBits & WB_SAVEAS ) == WB_SAVEAS );
+ short nDialogType = bSave ? css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE
+ : css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
+ if ( m_pFileDlg )
+ delete m_pFileDlg;
+ m_pFileDlg = new sfx2::FileDialogHelper( nDialogType, 0 );
+
+ m_pFileDlg->SetTitle( rTitle );
+// m_pFileDlg->SetDialogHelpId( bSave ? HID_CONFIG_SAVE : HID_CONFIG_LOAD );
+ m_pFileDlg->AddFilter( aFilterAllStr, DEFINE_CONST_UNICODE( FILEDIALOG_FILTER_ALL ) );
+ m_pFileDlg->AddFilter( aFilterCfgStr, DEFINE_CONST_UNICODE( "*.cfg" ) );
+
+ Link aDlgClosedLink = bSave ? LINK( this, SfxAcceleratorConfigPage, SaveHdl )
+ : LINK( this, SfxAcceleratorConfigPage, LoadHdl );
+ m_pFileDlg->StartExecuteModal( aDlgClosedLink );
+}
+
+//-----------------------------------------------
+BOOL SfxAcceleratorConfigPage::FillItemSet( SfxItemSet& )
+{
+ Apply(m_xAct);
+ try
+ {
+ m_xAct->store();
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ { return FALSE; }
+
+ return TRUE;
+}
+
+//-----------------------------------------------
+void SfxAcceleratorConfigPage::Reset( const SfxItemSet& rSet )
+{
+ // open accelerator configs
+ // Note: It initialize some other members too, which are needed here ...
+ // e.g. m_sModuleUIName!
+ InitAccCfg();
+
+ // change te description of the radio button, which switch to the module
+ // dependend accelerator configuration
+ String sButtonText = aModuleButton.GetText();
+ sButtonText.SearchAndReplace(String::CreateFromAscii("$(MODULE)"), m_sModuleUIName);
+ aModuleButton.SetText(sButtonText);
+
+ if (m_xModule.is())
+ aModuleButton.Check();
+ else
+ {
+ aModuleButton.Hide();
+ aOfficeButton.Check();
+ }
+
+ RadioHdl(0);
+
+ const SfxPoolItem* pMacroItem=0;
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_MACROINFO, TRUE, &pMacroItem ) )
+ {
+ m_pMacroInfoItem = PTR_CAST( SfxMacroInfoItem, pMacroItem );
+ pGroupLBox->SelectMacro( m_pMacroInfoItem );
+ }
+ else
+ {
+ const SfxPoolItem* pStringItem=0;
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_CHARMAP, TRUE, &pStringItem ) )
+ m_pStringItem = PTR_CAST( SfxStringItem, pStringItem );
+
+ const SfxPoolItem* pFontItem=0;
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_SPECIALCHAR, TRUE, &pFontItem ) )
+ m_pFontItem = PTR_CAST( SfxStringItem, pFontItem );
+
+ if ( m_pStringItem )
+ pGroupLBox->AddAndSelect( m_pStringItem, m_pFontItem );
+ }
+}
+
+//-----------------------------------------------
+void SfxAcceleratorConfigPage::SelectMacro(const SfxMacroInfoItem *pItem)
+{
+ m_pMacroInfoItem = pItem;
+ pGroupLBox->SelectMacro( pItem );
+}
+
+//-----------------------------------------------
+void SfxAcceleratorConfigPage::CopySource2Target(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xSourceAccMgr,
+ const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xTargetAccMgr)
+{
+ const css::uno::Sequence< css::awt::KeyEvent > lKeys = xSourceAccMgr->getAllKeyEvents();
+ sal_Int32 c = lKeys.getLength();
+ sal_Int32 i = 0;
+ for (i=0; i<c; ++i)
+ {
+ const css::awt::KeyEvent& rKey = lKeys[i];
+ ::rtl::OUString sCommand = xSourceAccMgr->getCommandByKeyEvent(rKey);
+ xTargetAccMgr->setKeyEvent(rKey, sCommand);
+ }
+}
+
+//-----------------------------------------------
+KeyCode SfxAcceleratorConfigPage::MapPosToKeyCode(USHORT nPos) const
+{
+ TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData();
+ KeyCode aCode(KEYCODE_ARRAY[pEntry->m_nKeyPos] & 0xFFF ,
+ KEYCODE_ARRAY[pEntry->m_nKeyPos] & (KEY_SHIFT | KEY_MOD2));
+ return aCode;
+}
+
+//-----------------------------------------------
+USHORT SfxAcceleratorConfigPage::MapKeyCodeToPos(const KeyCode& aKey) const
+{
+ USHORT nCode1 = aKey.GetCode()+aKey.GetModifier();
+ SvLBoxEntry* pEntry = aEntriesBox.First();
+ USHORT i = 0;
+
+ while (pEntry)
+ {
+ TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData();
+ if (pUserData)
+ {
+ USHORT nCode2 = pUserData->m_aKey.GetCode()+pUserData->m_aKey.GetModifier();
+ if (nCode1 == nCode2)
+ return i;
+ }
+ pEntry = aEntriesBox.Next(pEntry);
+ ++i;
+ }
+
+ return LISTBOX_ENTRY_NOTFOUND;
+}
+
+//-----------------------------------------------
+String SfxAcceleratorConfigPage::GetLabel4Command(const String& sCommand)
+{
+ try
+ {
+ // check global command configuration first
+ css::uno::Reference< css::container::XNameAccess > xModuleConf;
+ m_xUICmdDescription->getByName(m_sModuleLongName) >>= xModuleConf;
+ if (xModuleConf.is())
+ {
+ ::comphelper::SequenceAsHashMap lProps(xModuleConf->getByName(sCommand));
+ String sLabel = String(lProps.getUnpackedValueOrDefault(CMDPROP_UINAME, ::rtl::OUString()));
+ if (sLabel.Len())
+ return sLabel;
+ }
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ {}
+
+ // may be it's a style URL .. they must be handled special
+ SfxStyleInfo_Impl aStyle;
+ aStyle.sCommand = sCommand;
+ if (m_aStylesInfo.parseStyleCommand(aStyle))
+ {
+ m_aStylesInfo.getLabel4Style(aStyle);
+ return aStyle.sLabel;
+ }
+ else
+ {
+ String aRet( String::CreateFromAscii("Symbols: ") );
+ xub_StrLen nPos = sCommand.SearchAscii(".uno:InsertSymbol?Symbols:string=");
+ if ( nPos == 0 )
+ {
+ aRet += String( sCommand, 34, sCommand.Len()-34 );
+ return aRet;
+ }
+ }
+
+ return sCommand;
+}
+
+SfxTabPage* SfxAcceleratorConfigPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SfxAcceleratorConfigPage( pParent, rAttrSet );
+}
+
+//-----------------------------------------------
+css::uno::Reference< css::frame::XModel > SfxAcceleratorConfigPage::SearchForAlreadyLoadedDoc(const String& /*sName*/)
+{
+ return css::uno::Reference< css::frame::XModel >();
+}
+
+SvxShortcutAssignDlg::SvxShortcutAssignDlg( Window* pParent, const uno::Reference< frame::XFrame >& rxDocumentFrame, const SfxItemSet& rSet )
+ : SfxSingleTabDialog( pParent, rSet, 0 )
+{
+ SfxTabPage* pPage = SfxAcceleratorConfigPage::Create( this, rSet );
+ pPage->SetFrame( rxDocumentFrame );
+ SetTabPage( pPage );
+
+}
+
+SvxShortcutAssignDlg::~SvxShortcutAssignDlg()
+{
+}
+
+
+// .uno:InsertSymbol?Symbols:string=bla
diff --git a/cui/source/customize/acccfg.hrc b/cui/source/customize/acccfg.hrc
new file mode 100644
index 000000000000..2144af68df35
--- /dev/null
+++ b/cui/source/customize/acccfg.hrc
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * 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: cfg.hrc,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 GRP_FUNCTIONS 22
+#define BTN_ACC_OK 1
+#define BTN_ACC_CANCEL 2
+#define BTN_ACC_CHANGE 3
+#define BTN_ACC_REMOVE 4
+#define BOX_ACC_ENTRIES 5
+#define TXT_ACC_DESCRIPTIONTEXT 6
+#define TXT_ACC_DESCRIPTIONINFO 7
+#define GRP_ACC_KEYBOARD 8
+#define TXT_ACC_GROUP 9
+#define BOX_ACC_GROUP 10
+#define TXT_ACC_FUNCTION 11
+#define BOX_ACC_FUNCTION 12
+#define TXT_ACC_KEY 13
+#define BOX_ACC_KEY 14
+#define GRP_ACC_FUNCTIONS 15
+#define BTN_RESET 20
+#define BTN_LOAD 40
+#define BTN_SAVE 41
+#define RB_OFFICE 44
+#define RB_MODULE 45
+#define STR_LOADACCELCONFIG 46
+#define STR_SAVEACCELCONFIG 47
+
+#define IMG_HARDDISK 48
+#define IMG_HARDDISK_HC 49
+#define STR_PRODMACROS 50
+#define STR_MYMACROS 51
+#define IMG_LIB 52
+#define IMG_LIB_HC 53
+#define IMG_MACRO 54
+#define IMG_MACRO_HC 55
+#define IMG_DOC 56
+#define IMG_DOC_HC 57
+#define STR_GROUP_STYLES 58
+#define STR_PDF_EXPORT_SEND 59
+#define STR_RECHECK_DOCUMENT 60
+#define IMG_INFO 61
+#define STR_BASICNAME 62
+#define BMP_COLLAPSED 63
+#define BMP_EXPANDED 64
+#define BMP_COLLAPSED_HC 65
+#define BMP_EXPANDED_HC 66
+#define STR_BASICMACROS 67
+#define STR_DLG_MACROS 68
+#define STR_HUMAN_APPNAME 69
+#define STR_FILTERNAME_CFG 70
+
diff --git a/cui/source/customize/acccfg.src b/cui/source/customize/acccfg.src
new file mode 100644
index 000000000000..df0e0922da12
--- /dev/null
+++ b/cui/source/customize/acccfg.src
@@ -0,0 +1,360 @@
+/*************************************************************************
+ *
+ * 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: cfg.src,v $
+ * $Revision: 1.47 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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.hrc"
+#include "svx/dialogs.hrc"
+#include "acccfg.hrc"
+
+#define MASKCOLOR MaskColor = \
+ Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+#define PUSHBUTTON_TEXT_SAVE \
+ Text [ en-US ] = "~Save..." ; \
+
+#define PUSHBUTTON_TEXT_RESET \
+ Text [ en-US ] = "R~eset" ; \
+
+#define PUSHBUTTON_TEXT_LOAD \
+ Text [ en-US ] = "~Load..." ; \
+
+#define PUSHBUTTON_TEXT_REMOVE \
+ Text [ en-US ] = "~Delete" ; \
+
+#define PUSHBUTTON_TEXT_CHANGE \
+ Text [ en-US ] = "~Modify" ; \
+
+#define PUSHBUTTON_TEXT_NEW \
+ Text [ en-US ] = "~New" ; \
+
+#define FIXEDTEXT_TEXT_GROUP \
+ Text [ en-US ] = "~Category" ; \
+
+#define FIXEDTEXT_TEXT_FUNCTION \
+ Text [ en-US ] = "Function" ; \
+
+#define GROUPBOX_TEXT_FUNCTIONS \
+ Text [ en-US ] = "Functions" ; \
+
+ // TP_CONFIG_ACCEL -------------------------------------------------------
+TabPage RID_SVXPAGE_KEYBOARD
+{
+ HelpId = HID_CONFIG_ACCEL ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 273 , 258 ) ;
+ RadioButton RB_OFFICE
+ {
+ Pos = MAP_APPFONT ( 192 , 6 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ Text = "%PRODUCTNAME" ;
+ };
+ RadioButton RB_MODULE
+ {
+ Pos = MAP_APPFONT ( 192 , 19 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ Text = "$(MODULE)" ;
+ };
+ PushButton BTN_ACC_CHANGE
+ {
+ Pos = MAP_APPFONT ( 192 , 35 ) ;
+ Size = MAP_APPFONT ( 75 , 14 ) ;
+ TabStop = TRUE ;
+ PUSHBUTTON_TEXT_CHANGE
+ };
+ PushButton BTN_ACC_REMOVE
+ {
+ Pos = MAP_APPFONT ( 192 , 52 ) ;
+ Size = MAP_APPFONT ( 75 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ PUSHBUTTON_TEXT_REMOVE
+ };
+ FixedLine GRP_ACC_KEYBOARD
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 180 , 8 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "Shortcut keys";
+ };
+ Control BOX_ACC_ENTRIES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 174 , 120 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ HelpId = HID_ACCELCONFIG_LISTBOX ;
+ };
+ FixedLine GRP_ACC_FUNCTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 140 ) ;
+ Size = MAP_APPFONT ( 258 , 8 ) ;
+ Group = TRUE ;
+ GROUPBOX_TEXT_FUNCTIONS
+ };
+ FixedText TXT_ACC_GROUP
+ {
+ Pos = MAP_APPFONT ( 12 , 151 ) ;
+ Size = MAP_APPFONT ( 78 , 8 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ FIXEDTEXT_TEXT_GROUP
+ };
+ Control BOX_ACC_GROUP
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 161 ) ;
+ Size = MAP_APPFONT ( 78 , 91 ) ;
+ TabStop = TRUE ;
+ HelpId = HID_CONFIGGROUP_ACC_LISTBOX ;
+ };
+ FixedText TXT_ACC_FUNCTION
+ {
+ Pos = MAP_APPFONT ( 93 , 151 ) ;
+ Size = MAP_APPFONT ( 88 , 8 ) ;
+ Left = TRUE ;
+ FIXEDTEXT_TEXT_FUNCTION
+ };
+ Control BOX_ACC_FUNCTION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 93 , 161 ) ;
+ Size = MAP_APPFONT ( 88 , 91 ) ;
+ TabStop = TRUE ;
+ HelpId = HID_CONFIGFUNCTION_ACC_LISTBOX ;
+ };
+ FixedText TXT_ACC_KEY
+ {
+ Pos = MAP_APPFONT ( 184 , 151 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "~Keys" ;
+ Left = TRUE ;
+ };
+ Control BOX_ACC_KEY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 184 , 161 ) ;
+ Size = MAP_APPFONT ( 80 , 91 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_LOAD
+ {
+ Pos = MAP_APPFONT ( 192 , 86 ) ;
+ Size = MAP_APPFONT ( 75 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ PUSHBUTTON_TEXT_LOAD
+ };
+ PushButton BTN_SAVE
+ {
+ Pos = MAP_APPFONT ( 192 , 103 ) ;
+ Size = MAP_APPFONT ( 75 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ PUSHBUTTON_TEXT_SAVE
+ };
+ PushButton BTN_RESET
+ {
+ Pos = MAP_APPFONT ( 192 , 120 ) ;
+ Size = MAP_APPFONT ( 75 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ PUSHBUTTON_TEXT_RESET
+ };
+ String STR_LOADACCELCONFIG
+ {
+ Text [ en-US ] = "Load Keyboard Configuration" ;
+ };
+ String STR_SAVEACCELCONFIG
+ {
+ Text [ en-US ] = "Save Keyboard Configuration" ;
+ };
+ String STR_SFX_FILTERNAME_ALL
+ {
+ Text [ en-US ] = "All files (*.*)" ;
+ };
+ String STR_FILTERNAME_CFG
+ {
+ Text [ en-US ] = "Configuration" ;
+ };
+};
+
+Resource RID_SVXPAGE_CONFIGGROUPBOX
+{
+ String STR_MYMACROS
+ {
+ Text [ en-US ] = "My Macros";
+ };
+ String STR_PRODMACROS
+ {
+ Text [ en-US ] = "%PRODUCTNAME Macros";
+ };
+ String STR_BASICMACROS
+ {
+ Text [ en-US ] = "BASIC Macros" ;
+ };
+ String STR_DLG_MACROS
+ {
+ Text [ en-US ] = "%PRODUCTNAME Macros" ;
+ };
+ String STR_HUMAN_APPNAME
+ {
+ TEXT = "%PRODUCTNAME" ;
+ };
+ String STR_GROUP_STYLES
+ {
+ Text [ en-US ] = "Styles" ;
+ };
+ Image IMG_HARDDISK
+ {
+ ImageBitmap = Bitmap { File = "harddisk_16.bmp" ; };
+ MASKCOLOR
+ };
+ Image IMG_HARDDISK_HC
+ {
+ ImageBitmap = Bitmap { File = "harddisk_16_h.bmp" ; };
+ MASKCOLOR
+ };
+ Image IMG_LIB
+ {
+ ImageBitmap = Bitmap { File = "im30820.png"; };
+ MASKCOLOR
+ };
+ Image IMG_LIB_HC
+ {
+ ImageBitmap = Bitmap { File = "imh30820.png"; };
+ MASKCOLOR
+ };
+ Image IMG_MACRO
+ {
+ ImageBitmap = Bitmap { File = "im30821.png"; };
+ MASKCOLOR
+ };
+ Image IMG_MACRO_HC
+ {
+ ImageBitmap = Bitmap { File = "imh30821.png"; };
+ MASKCOLOR
+ };
+ Image IMG_DOC
+ {
+ ImageBitmap = Bitmap { File = "im30826.png"; };
+ MASKCOLOR
+ };
+ Image IMG_DOC_HC
+ {
+ ImageBitmap = Bitmap { File = "imh30826.png"; };
+ MASKCOLOR
+ };
+ String STR_BASICNAME
+ {
+ Text = "%PRODUCTNAME Basic" ;
+ };
+ Image BMP_COLLAPSED
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "plus.bmp" ;
+ };
+ // MaskColor = Color { Predefine = COL_GREEN ; };
+ };
+ Image BMP_EXPANDED
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "minus.bmp" ;
+ };
+ // MaskColor = Color { Predefine = COL_GREEN ; };
+ };
+ Image BMP_EXPANDED_HC
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "minus_h.bmp" ;
+ };
+ };
+ Image BMP_COLLAPSED_HC
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "plus_h.bmp" ;
+ };
+ };
+};
+
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
new file mode 100644
index 000000000000..5a51d2409e60
--- /dev/null
+++ b/cui/source/customize/cfg.cxx
@@ -0,0 +1,6059 @@
+/*************************************************************************
+ *
+ * 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: cfg.cxx,v $
+ * $Revision: 1.50.84.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <stdlib.h>
+#include <time.h>
+
+#ifndef _HELP_HXX //autogen
+#include <vcl/help.hxx>
+#endif
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <vcl/decoview.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/scrbar.hxx>
+
+//added for issue73355
+//#ifndef _SV_SVDATA_HXX
+//#include <vcl/svdata.hxx>
+//#endif
+//issue73355 ends
+
+#include <sfx2/app.hxx>
+#include <sfx2/sfxdlg.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/msg.hxx>
+#include <sfx2/msgpool.hxx>
+#include <sfx2/mnumgr.hxx>
+#include <sfx2/macrconf.hxx>
+#include <sfx2/minfitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <svl/stritem.hxx>
+#include <svtools/miscopt.hxx>
+#include <tools/diagnose_ex.h>
+#include <toolkit/unohlp.hxx>
+
+#include <algorithm>
+//add
+#include <svx/dialogs.hrc>
+#include "cfg.hrc"
+#include "helpid.hrc"
+
+#include "acccfg.hxx"
+#include "cfg.hxx"
+#include "eventdlg.hxx"
+#include <svx/dialmgr.hxx>
+
+#include <comphelper/documentinfo.hxx>
+#include <comphelper/processfactory.hxx>
+#ifndef _UNOTOOLS_CONFIGMGR_HXX_
+#include <unotools/configmgr.hxx>
+#endif
+#include <com/sun/star/ui/ItemType.hpp>
+#include <com/sun/star/ui/ItemStyle.hpp>
+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/ui/XUIConfiguration.hpp>
+#include <com/sun/star/ui/XUIConfigurationListener.hpp>
+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
+#include <com/sun/star/ui/XUIConfigurationStorage.hpp>
+#include <com/sun/star/ui/XModuleUIConfigurationManager.hpp>
+#include <com/sun/star/ui/XUIElement.hpp>
+#ifndef _COM_SUN_STAR_UI_UIElementType_HPP_
+#include <com/sun/star/ui/UIElementType.hpp>
+#endif
+#include <com/sun/star/ui/ImageType.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+#include <com/sun/star/frame/XFramesSupplier.hpp>
+#include <com/sun/star/frame/XFrames.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+
+#include "dlgname.hxx"
+
+#define PRTSTR(x) rtl::OUStringToOString(x, RTL_TEXTENCODING_ASCII_US).pData->buffer
+
+#define ENTRY_HEIGHT 16
+
+static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL";
+static const char ITEM_DESCRIPTOR_HELPURL[] = "HelpURL";
+static const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer";
+static const char ITEM_DESCRIPTOR_LABEL[] = "Label";
+static const char ITEM_DESCRIPTOR_TYPE[] = "Type";
+static const char ITEM_DESCRIPTOR_STYLE[] = "Style";
+static const char ITEM_DESCRIPTOR_ISVISIBLE[] = "IsVisible";
+static const char ITEM_DESCRIPTOR_RESOURCEURL[] = "ResourceURL";
+static const char ITEM_DESCRIPTOR_UINAME[] = "UIName";
+
+static const char ITEM_MENUBAR_URL[] = "private:resource/menubar/menubar";
+static const char ITEM_TOOLBAR_URL[] = "private:resource/toolbar/";
+
+static const char CUSTOM_TOOLBAR_STR[] = "custom_toolbar_";
+static const char CUSTOM_MENU_STR[] = "vnd.openoffice.org:CustomMenu";
+
+static const char __FAR_DATA pSeparatorStr[] =
+ "----------------------------------";
+static const char __FAR_DATA pMenuSeparatorStr[] = " | ";
+
+#ifdef _MSC_VER
+#pragma warning (disable:4355)
+#endif
+
+using rtl::OUString;
+namespace css = com::sun::star;
+namespace uno = com::sun::star::uno;
+namespace frame = com::sun::star::frame;
+namespace lang = com::sun::star::lang;
+namespace container = com::sun::star::container;
+namespace beans = com::sun::star::beans;
+namespace graphic = com::sun::star::graphic;
+
+void printPropertySet(
+ const OUString& prefix,
+ const uno::Reference< beans::XPropertySet >& xPropSet )
+{
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+
+ uno::Sequence< beans::Property > aPropDetails =
+ xPropSetInfo->getProperties();
+
+ OSL_TRACE("printPropertySet: %d properties", aPropDetails.getLength());
+
+ for ( sal_Int32 i = 0; i < aPropDetails.getLength(); i++ )
+ {
+ OUString tmp;
+ sal_Int32 ival;
+
+ uno::Any a = xPropSet->getPropertyValue( aPropDetails[i].Name );
+
+ if ( ( a >>= tmp ) /* && tmp.getLength() != 0 */ )
+ {
+ OSL_TRACE("%s: Got property: %s = %s",
+ PRTSTR(prefix), PRTSTR(aPropDetails[i].Name), PRTSTR(tmp));
+ }
+ else if ( ( a >>= ival ) )
+ {
+ OSL_TRACE("%s: Got property: %s = %d",
+ PRTSTR(prefix), PRTSTR(aPropDetails[i].Name), PRTSTR(tmp));
+ }
+ else
+ {
+ OSL_TRACE("%s: Got property: %s of type %s",
+ PRTSTR(prefix), PRTSTR(aPropDetails[i].Name), PRTSTR(a.getValueTypeName()));
+ }
+ }
+}
+
+void printProperties(
+ const OUString& prefix,
+ const uno::Sequence< beans::PropertyValue >& aProp )
+{
+ for ( sal_Int32 i = 0; i < aProp.getLength(); i++ )
+ {
+ OUString tmp;
+
+ aProp[i].Value >>= tmp;
+
+ OSL_TRACE("%s: Got property: %s = %s",
+ PRTSTR(prefix), PRTSTR(aProp[i].Name), PRTSTR(tmp));
+ }
+}
+
+void printEntries(SvxEntries* entries)
+{
+ SvxEntries::const_iterator iter = entries->begin();
+
+ for ( ; iter != entries->end(); iter++ )
+ {
+ SvxConfigEntry* entry = *iter;
+
+ OSL_TRACE("printEntries: %s", PRTSTR(entry->GetName()));
+ }
+}
+
+OUString
+stripHotKey( const OUString& str )
+{
+ sal_Int32 index = str.indexOf( '~' );
+ if ( index == -1 )
+ {
+ return str;
+ }
+ else
+ {
+ return str.replaceAt( index, 1, OUString() );
+ }
+}
+
+OUString replaceSaveInName(
+ const OUString& rMessage,
+ const OUString& rSaveInName )
+{
+ OUString name;
+ OUString placeholder = OUString::createFromAscii( "%SAVE IN SELECTION%" );
+
+ sal_Int32 pos = rMessage.indexOf( placeholder );
+
+ if ( pos != -1 )
+ {
+ name = rMessage.replaceAt(
+ pos, placeholder.getLength(), rSaveInName );
+ }
+ else
+ {
+ // don't change the message
+ }
+
+ return name;
+}
+
+OUString
+replaceSixteen( const OUString& str, sal_Int32 nReplacement )
+{
+ OUString result( str );
+ OUString sixteen = OUString::valueOf( (sal_Int32)16 );
+ OUString expected = OUString::valueOf( nReplacement );
+
+ sal_Int32 len = sixteen.getLength();
+ sal_Int32 index = result.indexOf( sixteen );
+
+ while ( index != -1 )
+ {
+ result = result.replaceAt( index, len, expected );
+ index = result.indexOf( sixteen, index );
+ }
+
+ return result;
+}
+
+OUString
+generateCustomName(
+ const OUString& prefix,
+ SvxEntries* entries,
+ sal_Int32 suffix = 1 )
+{
+ // find and replace the %n placeholder in the prefix string
+ OUString name;
+ OUString placeholder = OUString::createFromAscii( "%n" );
+
+ sal_Int32 pos = prefix.indexOf(
+ OUString::createFromAscii( "%n" ) );
+
+ if ( pos != -1 )
+ {
+ name = prefix.replaceAt(
+ pos, placeholder.getLength(), OUString::valueOf( suffix ) );
+ }
+ else
+ {
+ // no placeholder found so just append the suffix
+ name = prefix + OUString::valueOf( suffix );
+ }
+
+ // now check is there is an already existing entry with this name
+ SvxEntries::const_iterator iter = entries->begin();
+
+ SvxConfigEntry* pEntry;
+ while ( iter != entries->end() )
+ {
+ pEntry = *iter;
+
+ if ( name.equals( pEntry->GetName() ) )
+ {
+ break;
+ }
+ iter++;
+ }
+
+ if ( iter != entries->end() )
+ {
+ // name already exists so try the next number up
+ return generateCustomName( prefix, entries, ++suffix );
+ }
+
+ return name;
+}
+
+sal_uInt32 generateRandomValue()
+{
+ srand( unsigned( time( NULL ) ));
+ return sal_uInt32( rand() );
+}
+
+OUString
+generateCustomURL(
+ SvxEntries* entries )
+{
+ OUString url = OUString::createFromAscii( ITEM_TOOLBAR_URL );
+ url += OUString::createFromAscii( CUSTOM_TOOLBAR_STR );
+
+ // use a random number to minimize possible clash with existing custom toolbars
+ url += OUString::valueOf( sal_Int64( generateRandomValue() ), 16 );
+
+ // now check is there is an already existing entry with this url
+ SvxEntries::const_iterator iter = entries->begin();
+
+ SvxConfigEntry* pEntry;
+ while ( iter != entries->end() )
+ {
+ pEntry = *iter;
+
+ if ( url.equals( pEntry->GetCommand() ) )
+ {
+ break;
+ }
+ iter++;
+ }
+
+ if ( iter != entries->end() )
+ {
+ // url already exists so try the next number up
+ return generateCustomURL( entries );
+ }
+
+ return url;
+}
+
+OUString
+generateCustomMenuURL(
+ SvxEntries* entries,
+ sal_Int32 suffix = 1 )
+{
+ OUString url = OUString::createFromAscii( CUSTOM_MENU_STR );
+ url += OUString::valueOf( suffix );
+
+ // now check is there is an already existing entry with this url
+ SvxEntries::const_iterator iter = entries->begin();
+
+ SvxConfigEntry* pEntry;
+ while ( iter != entries->end() )
+ {
+ pEntry = *iter;
+
+ if ( url.equals( pEntry->GetCommand() ) )
+ {
+ break;
+ }
+ iter++;
+ }
+
+ if ( iter != entries->end() )
+ {
+ // url already exists so try the next number up
+ return generateCustomMenuURL( entries, ++suffix );
+ }
+
+ return url;
+}
+
+static sal_Int16 theImageType =
+ css::ui::ImageType::COLOR_NORMAL |
+ css::ui::ImageType::SIZE_DEFAULT;
+
+void InitImageType()
+{
+ theImageType =
+ css::ui::ImageType::COLOR_NORMAL |
+ css::ui::ImageType::SIZE_DEFAULT;
+
+ if ( SvtMiscOptions().AreCurrentSymbolsLarge() )
+ {
+ theImageType |= css::ui::ImageType::SIZE_LARGE;
+ }
+
+ Window* topwin = Application::GetActiveTopWindow();
+ if ( topwin != NULL &&
+ topwin->GetDisplayBackground().GetColor().IsDark() )
+ {
+ theImageType |= css::ui::ImageType::COLOR_HIGHCONTRAST;
+ }
+}
+
+sal_Int16 GetImageType()
+{
+ return theImageType;
+}
+
+void RemoveEntry( SvxEntries* pEntries, SvxConfigEntry* pChildEntry )
+{
+ SvxEntries::iterator iter = pEntries->begin();
+
+ while ( iter != pEntries->end() )
+ {
+ if ( pChildEntry == *iter )
+ {
+ pEntries->erase( iter );
+ break;
+ }
+ iter++;
+ }
+}
+
+bool
+SvxConfigPage::CanConfig( const OUString& aModuleId )
+{
+ OSL_TRACE("SupportsDocumentConfig: %s", PRTSTR(aModuleId));
+
+ if ( aModuleId.equalsAscii( "com.sun.star.script.BasicIDE" )
+ || aModuleId.equalsAscii( "com.sun.star.frame.Bibliography" )
+ )
+ {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+OUString GetModuleName( const OUString& aModuleId )
+{
+ if ( aModuleId.equalsAscii( "com.sun.star.text.TextDocument" ) ||
+ aModuleId.equalsAscii( "com.sun.star.text.GlobalDocument" ) )
+ return OUString::createFromAscii("Writer");
+ else if ( aModuleId.equalsAscii( "com.sun.star.text.WebDocument" ) )
+ return OUString::createFromAscii("Writer/Web");
+ else if ( aModuleId.equalsAscii( "com.sun.star.drawing.DrawingDocument" ) )
+ return OUString::createFromAscii("Draw");
+ else if ( aModuleId.equalsAscii( "com.sun.star.presentation.PresentationDocument" ) )
+ return OUString::createFromAscii("Impress");
+ else if ( aModuleId.equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" ) )
+ return OUString::createFromAscii("Calc");
+ else if ( aModuleId.equalsAscii( "com.sun.star.script.BasicIDE" ) )
+ return OUString::createFromAscii("Basic");
+ else if ( aModuleId.equalsAscii( "com.sun.star.formula.FormulaProperties" ) )
+ return OUString::createFromAscii("Math");
+ else if ( aModuleId.equalsAscii( "com.sun.star.sdb.RelationDesign" ) )
+ return OUString::createFromAscii("Relation Design");
+ else if ( aModuleId.equalsAscii( "com.sun.star.sdb.QueryDesign" ) )
+ return OUString::createFromAscii("Query Design");
+ else if ( aModuleId.equalsAscii( "com.sun.star.sdb.TableDesign" ) )
+ return OUString::createFromAscii("Table Design");
+ else if ( aModuleId.equalsAscii( "com.sun.star.sdb.DataSourceBrowser" ) )
+ return OUString::createFromAscii("Data Source Browser" );
+ else if ( aModuleId.equalsAscii( "com.sun.star.sdb.DatabaseDocument" ) )
+ return OUString::createFromAscii("Database" );
+
+ return ::rtl::OUString();
+}
+
+OUString GetUIModuleName( const OUString& aModuleId, const uno::Reference< css::frame::XModuleManager >& rModuleManager )
+{
+ OUString aModuleUIName;
+
+ if ( rModuleManager.is() )
+ {
+ uno::Reference< css::container::XNameAccess > xNameAccess( rModuleManager, uno::UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ try
+ {
+ uno::Any a = xNameAccess->getByName( aModuleId );
+ uno::Sequence< beans::PropertyValue > aSeq;
+
+ if ( a >>= aSeq )
+ {
+ OUString aUIName;
+ for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ {
+ if ( aSeq[i].Name.equalsAscii( "ooSetupFactoryUIName" ))
+ {
+ aSeq[i].Value >>= aModuleUIName;
+ break;
+ }
+ }
+ }
+ }
+ catch ( uno::RuntimeException& e )
+ {
+ throw e;
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+ }
+
+ if ( aModuleUIName.getLength() == 0 )
+ aModuleUIName = GetModuleName( aModuleId );
+
+ return aModuleUIName;
+}
+
+bool GetMenuItemData(
+ const uno::Reference< container::XIndexAccess >& rItemContainer,
+ sal_Int32 nIndex,
+ OUString& rCommandURL,
+ OUString& rHelpURL,
+ OUString& rLabel,
+ sal_uInt16& rType,
+ uno::Reference< container::XIndexAccess >& rSubMenu )
+{
+ try
+ {
+ uno::Sequence< beans::PropertyValue > aProp;
+ if ( rItemContainer->getByIndex( nIndex ) >>= aProp )
+ {
+ for ( sal_Int32 i = 0; i < aProp.getLength(); i++ )
+ {
+ if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL ))
+ {
+ aProp[i].Value >>= rCommandURL;
+ }
+ else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
+ {
+ aProp[i].Value >>= rHelpURL;
+ }
+ else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_CONTAINER ))
+ {
+ aProp[i].Value >>= rSubMenu;
+ }
+ else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ))
+ {
+ aProp[i].Value >>= rLabel;
+ }
+ else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_TYPE ))
+ {
+ aProp[i].Value >>= rType;
+ }
+ }
+
+ return TRUE;
+ }
+ }
+ catch ( ::com::sun::star::lang::IndexOutOfBoundsException& )
+ {
+ }
+
+ return FALSE;
+}
+
+bool GetToolbarItemData(
+ const uno::Reference< container::XIndexAccess >& rItemContainer,
+ sal_Int32 nIndex,
+ OUString& rCommandURL,
+ OUString& rHelpURL,
+ OUString& rLabel,
+ sal_uInt16& rType,
+ sal_Bool& rIsVisible,
+ sal_Int32& rStyle,
+ uno::Reference< container::XIndexAccess >& rSubMenu )
+{
+ try
+ {
+ uno::Sequence< beans::PropertyValue > aProp;
+ if ( rItemContainer->getByIndex( nIndex ) >>= aProp )
+ {
+ for ( sal_Int32 i = 0; i < aProp.getLength(); i++ )
+ {
+ if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL ))
+ {
+ aProp[i].Value >>= rCommandURL;
+ }
+ if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE ))
+ {
+ aProp[i].Value >>= rStyle;
+ }
+ else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
+ {
+ aProp[i].Value >>= rHelpURL;
+ }
+ else if (aProp[i].Name.equalsAscii(ITEM_DESCRIPTOR_CONTAINER))
+ {
+ aProp[i].Value >>= rSubMenu;
+ }
+ else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ))
+ {
+ aProp[i].Value >>= rLabel;
+ }
+ else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_TYPE ))
+ {
+ aProp[i].Value >>= rType;
+ }
+ else if (aProp[i].Name.equalsAscii(ITEM_DESCRIPTOR_ISVISIBLE))
+ {
+ aProp[i].Value >>= rIsVisible;
+ }
+ }
+
+ return sal_True;
+ }
+ }
+ catch ( ::com::sun::star::lang::IndexOutOfBoundsException& )
+ {
+ }
+
+ return sal_False;
+}
+
+uno::Sequence< beans::PropertyValue >
+ConvertSvxConfigEntry(
+ const uno::Reference< container::XNameAccess >& xCommandToLabelMap,
+ const SvxConfigEntry* pEntry )
+{
+ static const OUString aDescriptorCommandURL (
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ) );
+
+ static const OUString aDescriptorType(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ) );
+
+ static const OUString aDescriptorLabel(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL ) );
+
+ static const OUString aDescriptorHelpURL(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL ) );
+
+ static const OUString aDescriptorContainer(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ) );
+
+ uno::Sequence< beans::PropertyValue > aPropSeq( 4 );
+
+ aPropSeq[0].Name = aDescriptorCommandURL;
+ aPropSeq[0].Value <<= rtl::OUString( pEntry->GetCommand() );
+
+ aPropSeq[1].Name = aDescriptorType;
+ aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
+
+ // If the name has not been changed and the name is the same as
+ // in the default command to label map then the label can be stored
+ // as an empty string.
+ // It will be initialised again later using the command to label map.
+ aPropSeq[2].Name = aDescriptorLabel;
+ if ( pEntry->HasChangedName() == FALSE && pEntry->GetCommand().getLength() )
+ {
+ BOOL isDefaultName = FALSE;
+ try
+ {
+ uno::Any a( xCommandToLabelMap->getByName( pEntry->GetCommand() ) );
+ uno::Sequence< beans::PropertyValue > tmpPropSeq;
+ if ( a >>= tmpPropSeq )
+ {
+ for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); i++ )
+ {
+ if ( tmpPropSeq[i].Name.equals( aDescriptorLabel ) )
+ {
+ OUString tmpLabel;
+ tmpPropSeq[i].Value >>= tmpLabel;
+
+ if ( tmpLabel.equals( pEntry->GetName() ) )
+ {
+ isDefaultName = TRUE;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ // isDefaultName is left as FALSE
+ }
+
+ if ( isDefaultName )
+ {
+ aPropSeq[2].Value <<= rtl::OUString();
+ }
+ else
+ {
+ aPropSeq[2].Value <<= rtl::OUString( pEntry->GetName() );
+ }
+ }
+ else
+ {
+ aPropSeq[2].Value <<= rtl::OUString( pEntry->GetName() );
+ }
+
+ aPropSeq[3].Name = aDescriptorHelpURL;
+ aPropSeq[3].Value <<= rtl::OUString( pEntry->GetHelpURL() );
+
+ return aPropSeq;
+}
+
+uno::Sequence< beans::PropertyValue >
+ConvertToolbarEntry(
+ const uno::Reference< container::XNameAccess >& xCommandToLabelMap,
+ const SvxConfigEntry* pEntry )
+{
+ static const OUString aDescriptorCommandURL (
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ) );
+
+ static const OUString aDescriptorType(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ) );
+
+ static const OUString aDescriptorLabel(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL ) );
+
+ static const OUString aDescriptorHelpURL(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL ) );
+
+ static const OUString aDescriptorContainer(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ) );
+
+ static const OUString aIsVisible(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_ISVISIBLE ) );
+
+ uno::Sequence< beans::PropertyValue > aPropSeq( 5 );
+
+ aPropSeq[0].Name = aDescriptorCommandURL;
+ aPropSeq[0].Value <<= rtl::OUString( pEntry->GetCommand() );
+
+ aPropSeq[1].Name = aDescriptorType;
+ aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
+
+ // If the name has not been changed and the name is the same as
+ // in the default command to label map then the label can be stored
+ // as an empty string.
+ // It will be initialised again later using the command to label map.
+ aPropSeq[2].Name = aDescriptorLabel;
+ if ( pEntry->HasChangedName() == FALSE && pEntry->GetCommand().getLength() )
+ {
+ BOOL isDefaultName = FALSE;
+ try
+ {
+ uno::Any a( xCommandToLabelMap->getByName( pEntry->GetCommand() ) );
+ uno::Sequence< beans::PropertyValue > tmpPropSeq;
+ if ( a >>= tmpPropSeq )
+ {
+ for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); i++ )
+ {
+ if ( tmpPropSeq[i].Name.equals( aDescriptorLabel ) )
+ {
+ OUString tmpLabel;
+ tmpPropSeq[i].Value >>= tmpLabel;
+
+ if ( tmpLabel.equals( pEntry->GetName() ) )
+ {
+ isDefaultName = TRUE;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ // isDefaultName is left as FALSE
+ }
+
+ if ( isDefaultName )
+ {
+ aPropSeq[2].Value <<= rtl::OUString();
+ }
+ else
+ {
+ aPropSeq[2].Value <<= rtl::OUString( pEntry->GetName() );
+ }
+ }
+ else
+ {
+ aPropSeq[2].Value <<= rtl::OUString( pEntry->GetName() );
+ }
+
+ aPropSeq[3].Name = aDescriptorHelpURL;
+ aPropSeq[3].Value <<= rtl::OUString( pEntry->GetHelpURL() );
+
+ aPropSeq[4].Name = aIsVisible;
+ aPropSeq[4].Value <<= pEntry->IsVisible();
+
+ return aPropSeq;
+}
+
+SfxTabPage *CreateSvxMenuConfigPage( Window *pParent, const SfxItemSet& rSet )
+{
+ return new SvxMenuConfigPage( pParent, rSet );
+}
+
+SfxTabPage *CreateKeyboardConfigPage( Window *pParent, const SfxItemSet& rSet )
+{
+ return new SfxAcceleratorConfigPage( pParent, rSet );
+}
+
+SfxTabPage *CreateSvxToolbarConfigPage( Window *pParent, const SfxItemSet& rSet )
+{
+ return new SvxToolbarConfigPage( pParent, rSet );
+}
+
+SfxTabPage *CreateSvxEventConfigPage( Window *pParent, const SfxItemSet& rSet )
+{
+ return new SvxEventConfigPage( pParent, rSet, SvxEventConfigPage::EarlyInit() );
+}
+
+sal_Bool impl_showKeyConfigTabPage( const css::uno::Reference< css::frame::XFrame >& xFrame )
+{
+ static ::rtl::OUString SERVICENAME_MODULEMANAGER = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager");
+ static ::rtl::OUString SERVICENAME_DESKTOP = ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop" );
+ static ::rtl::OUString MODULEID_STARTMODULE = ::rtl::OUString::createFromAscii("com.sun.star.frame.StartModule" );
+
+ try
+ {
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::frame::XModuleManager > xMM (xSMGR->createInstance(SERVICENAME_MODULEMANAGER), css::uno::UNO_QUERY_THROW);
+
+ if (xMM.is() && xFrame.is())
+ {
+ ::rtl::OUString sModuleId = xMM->identify(xFrame);
+ if (
+ ( sModuleId.getLength() ) &&
+ (!sModuleId.equals(MODULEID_STARTMODULE))
+ )
+ return sal_True;
+ }
+ }
+ catch(const css::uno::Exception&)
+ {}
+
+ return sal_False;
+}
+
+/******************************************************************************
+ *
+ * SvxConfigDialog is the configuration dialog which is brought up from the
+ * Tools menu. It includes tabs for customizing menus, toolbars, events and
+ * key bindings.
+ *
+ *****************************************************************************/
+SvxConfigDialog::SvxConfigDialog(
+ Window * pParent, const SfxItemSet* pSet_ )
+ :
+ SfxTabDialog( pParent,
+ SVX_RES( RID_SVXDLG_CUSTOMIZE ), pSet_ )
+{
+ FreeResource();
+
+ InitImageType();
+
+ AddTabPage( RID_SVXPAGE_MENUS, CreateSvxMenuConfigPage, NULL );
+ AddTabPage( RID_SVXPAGE_KEYBOARD, CreateKeyboardConfigPage, NULL );
+ AddTabPage( RID_SVXPAGE_TOOLBARS, CreateSvxToolbarConfigPage, NULL );
+ AddTabPage( RID_SVXPAGE_EVENTS, CreateSvxEventConfigPage, NULL );
+
+ const SfxPoolItem* pItem =
+ pSet_->GetItem( pSet_->GetPool()->GetWhich( SID_CONFIG ) );
+
+ if ( pItem )
+ {
+ OUString text = ((const SfxStringItem*)pItem)->GetValue();
+
+ if (text.indexOf(OUString::createFromAscii(ITEM_TOOLBAR_URL)) == 0)
+ {
+ SetCurPageId( RID_SVXPAGE_TOOLBARS );
+ }
+ }
+}
+
+void SvxConfigDialog::SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame)
+{
+ m_xFrame = xFrame;
+
+ if (!impl_showKeyConfigTabPage( xFrame ))
+ RemoveTabPage( RID_SVXPAGE_KEYBOARD );
+}
+
+SvxConfigDialog::~SvxConfigDialog()
+{
+}
+
+short SvxConfigDialog::Ok()
+{
+ return SfxTabDialog::Ok();
+}
+
+void SvxConfigDialog::PageCreated( USHORT nId, SfxTabPage& rPage )
+{
+ (void)rPage;
+
+ switch ( nId )
+ {
+ case RID_SVXPAGE_MENUS:
+ case RID_SVXPAGE_TOOLBARS:
+ case RID_SVXPAGE_KEYBOARD:
+ {
+ rPage.SetFrame(m_xFrame);
+ }
+ break;
+ case RID_SVXPAGE_EVENTS:
+ {
+ dynamic_cast< SvxEventConfigPage& >( rPage ).LateInit( m_xFrame );
+ };
+ break;
+ default:
+ break;
+ }
+}
+
+void SvxConfigDialog::ActivateTabPage( USHORT nSlotId )
+{
+ (void)nSlotId;
+}
+
+/******************************************************************************
+ *
+ * The SaveInData class is used to hold data for entries in the Save In
+ * ListBox controls in the menu and toolbar tabs
+ *
+ ******************************************************************************/
+
+// Initialize static variable which holds default XImageManager
+uno::Reference< css::ui::XImageManager>* SaveInData::xDefaultImgMgr = NULL;
+
+SaveInData::SaveInData(
+ const uno::Reference< css::ui::XUIConfigurationManager >& xCfgMgr,
+ const uno::Reference< css::ui::XUIConfigurationManager >& xParentCfgMgr,
+ const OUString& aModuleId,
+ bool isDocConfig )
+ :
+ bModified( FALSE ),
+ bDocConfig( isDocConfig ),
+ bReadOnly( FALSE ),
+ m_xCfgMgr( xCfgMgr ),
+ m_xParentCfgMgr( xParentCfgMgr )
+{
+ uno::Reference< beans::XPropertySet > xProps(
+ ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
+
+ xProps->getPropertyValue(
+ OUString::createFromAscii( "DefaultContext" ))
+ >>= m_xComponentContext;
+
+ m_aSeparatorSeq.realloc( 1 );
+ m_aSeparatorSeq[0].Name = OUString(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ) );
+ m_aSeparatorSeq[0].Value <<= css::ui::ItemType::SEPARATOR_LINE;
+
+ if ( bDocConfig )
+ {
+ uno::Reference< css::ui::XUIConfigurationPersistence >
+ xDocPersistence( GetConfigManager(), uno::UNO_QUERY );
+
+ bReadOnly = xDocPersistence->isReadOnly();
+ }
+
+ m_xServiceManager = uno::Reference< lang::XMultiServiceFactory >(
+ ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+
+ uno::Reference< container::XNameAccess > xNameAccess(
+ m_xServiceManager->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.frame.UICommandDescription" ) ) ),
+ uno::UNO_QUERY );
+
+ if ( xNameAccess.is() )
+ xNameAccess->getByName( aModuleId ) >>= m_xCommandToLabelMap;
+
+ if ( !m_xImgMgr.is() )
+ {
+ m_xImgMgr = uno::Reference< css::ui::XImageManager >(
+ GetConfigManager()->getImageManager(), uno::UNO_QUERY );
+ }
+
+ if ( !IsDocConfig() )
+ {
+ // If this is not a document configuration then it is the settings
+ // for the module (writer, calc, impress etc.) Use this as the default
+ // XImageManager instance
+ xDefaultImgMgr = &m_xImgMgr;
+ }
+ else
+ {
+ // If this is a document configuration then use the module image manager
+ // as default.
+ if ( m_xParentCfgMgr.is() )
+ {
+ m_xParentImgMgr = uno::Reference< css::ui::XImageManager >(
+ m_xParentCfgMgr->getImageManager(), uno::UNO_QUERY );
+ xDefaultImgMgr = &m_xParentImgMgr;
+ }
+ }
+}
+
+uno::Reference< graphic::XGraphic > GetGraphic(
+ const uno::Reference< css::ui::XImageManager >& xImageManager,
+ const OUString& rCommandURL )
+{
+ uno::Reference< graphic::XGraphic > result;
+
+ if ( xImageManager.is() )
+ {
+ // TODO handle large and high contrast graphics
+ uno::Sequence< uno::Reference< graphic::XGraphic > > aGraphicSeq;
+
+ uno::Sequence< OUString > aImageCmdSeq( 1 );
+ aImageCmdSeq[0] = rCommandURL;
+
+ try
+ {
+ aGraphicSeq =
+ xImageManager->getImages( GetImageType(), aImageCmdSeq );
+
+ if ( aGraphicSeq.getLength() > 0 )
+ {
+ result = aGraphicSeq[0];
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ // will return empty XGraphic
+ }
+ }
+
+ return result;
+}
+
+Image SaveInData::GetImage( const OUString& rCommandURL )
+{
+ Image aImage;
+
+ uno::Reference< graphic::XGraphic > xGraphic =
+ GetGraphic( m_xImgMgr, rCommandURL );
+
+ if ( xGraphic.is() )
+ {
+ aImage = Image( xGraphic );
+ }
+ else if ( xDefaultImgMgr != NULL && (*xDefaultImgMgr).is() )
+ {
+ xGraphic = GetGraphic( (*xDefaultImgMgr), rCommandURL );
+
+ if ( xGraphic.is() )
+ {
+ aImage = Image( xGraphic );
+ }
+ }
+
+ return aImage;
+}
+
+bool SaveInData::PersistChanges(
+ const uno::Reference< uno::XInterface >& xManager )
+{
+ bool result = TRUE;
+
+ try
+ {
+ if ( xManager.is() && !IsReadOnly() )
+ {
+ uno::Reference< css::ui::XUIConfigurationPersistence >
+ xConfigPersistence( xManager, uno::UNO_QUERY );
+
+ if ( xConfigPersistence->isModified() )
+ {
+ xConfigPersistence->store();
+ }
+ }
+ }
+ catch ( com::sun::star::io::IOException& )
+ {
+ result = FALSE;
+ }
+
+ return result;
+}
+
+/******************************************************************************
+ *
+ * The MenuSaveInData class extends SaveInData and provides menu specific
+ * load and store functionality.
+ *
+ ******************************************************************************/
+
+// Initialize static variable which holds default Menu data
+MenuSaveInData* MenuSaveInData::pDefaultData = NULL;
+
+MenuSaveInData::MenuSaveInData(
+ const uno::Reference< css::ui::XUIConfigurationManager >& cfgmgr,
+ const uno::Reference< css::ui::XUIConfigurationManager >& xParentCfgMgr,
+ const OUString& aModuleId,
+ bool isDocConfig )
+ :
+ SaveInData( cfgmgr, xParentCfgMgr, aModuleId, isDocConfig ),
+ m_aMenuResourceURL(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_MENUBAR_URL ) ),
+ m_aDescriptorContainer(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ) ),
+ pRootEntry( 0 )
+{
+ try
+ {
+ OUString url( RTL_CONSTASCII_USTRINGPARAM( ITEM_MENUBAR_URL ) );
+ m_xMenuSettings = GetConfigManager()->getSettings( url, sal_False );
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ // will use menu settings for the module
+ }
+
+ // If this is not a document configuration then it is the settings
+ // for the module (writer, calc, impress etc.). These settings should
+ // be set as the default to be used for SaveIn locations that do not
+ // have custom settings
+ if ( !IsDocConfig() )
+ {
+ SetDefaultData( this );
+ }
+}
+
+MenuSaveInData::~MenuSaveInData()
+{
+ if ( pRootEntry != NULL )
+ {
+ delete pRootEntry;
+ }
+}
+
+SvxEntries*
+MenuSaveInData::GetEntries()
+{
+ if ( pRootEntry == NULL )
+ {
+ pRootEntry = new SvxConfigEntry(
+ String::CreateFromAscii("MainMenus"), String(), TRUE );
+
+ if ( m_xMenuSettings.is() )
+ {
+ LoadSubMenus( m_xMenuSettings, String(), pRootEntry );
+ }
+ else if ( GetDefaultData() != NULL )
+ {
+ // If the doc has no config settings use module config settings
+ LoadSubMenus( GetDefaultData()->m_xMenuSettings, String(), pRootEntry );
+ }
+ }
+
+ return pRootEntry->GetEntries();
+}
+
+void
+MenuSaveInData::SetEntries( SvxEntries* pNewEntries )
+{
+ // delete old menu hierarchy first
+ if ( pRootEntry != NULL )
+ {
+ delete pRootEntry->GetEntries();
+ }
+
+ // now set new menu hierarchy
+ pRootEntry->SetEntries( pNewEntries );
+}
+
+bool MenuSaveInData::LoadSubMenus(
+ const uno::Reference< container::XIndexAccess >& xMenuSettings,
+ const OUString& rBaseTitle,
+ SvxConfigEntry* pParentData )
+{
+ SvxEntries* pEntries = pParentData->GetEntries();
+
+ for ( sal_Int32 nIndex = 0; nIndex < xMenuSettings->getCount(); nIndex++ )
+ {
+ uno::Reference< container::XIndexAccess > xSubMenu;
+ OUString aCommandURL;
+ OUString aHelpURL;
+ OUString aLabel;
+ bool bIsUserDefined = TRUE;
+
+ sal_uInt16 nType( css::ui::ItemType::DEFAULT );
+
+ bool bItem = GetMenuItemData( xMenuSettings, nIndex,
+ aCommandURL, aHelpURL, aLabel, nType, xSubMenu );
+
+ if ( bItem )
+ {
+ if ( nType == css::ui::ItemType::DEFAULT )
+ {
+ uno::Any a;
+ try
+ {
+ a = m_xCommandToLabelMap->getByName( aCommandURL );
+ bIsUserDefined = FALSE;
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ bIsUserDefined = TRUE;
+ }
+
+ // If custom label not set retrieve it from the command
+ // to info service
+ if ( aLabel.equals( OUString() ) )
+ {
+ uno::Sequence< beans::PropertyValue > aPropSeq;
+ if ( a >>= aPropSeq )
+ {
+ for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
+ {
+ if ( aPropSeq[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ) )
+ {
+ aPropSeq[i].Value >>= aLabel;
+ break;
+ }
+ }
+ }
+ }
+
+ if ( xSubMenu.is() )
+ {
+ // popup menu
+ SvxConfigEntry* pEntry = new SvxConfigEntry(
+ aLabel, aCommandURL, TRUE );
+
+ pEntry->SetUserDefined( bIsUserDefined );
+ pEntry->SetHelpURL( aHelpURL );
+
+ pEntries->push_back( pEntry );
+
+ OUString subMenuTitle( rBaseTitle );
+
+ if ( subMenuTitle.getLength() != 0 )
+ {
+ subMenuTitle +=
+ OUString::createFromAscii(pMenuSeparatorStr);
+ }
+ else
+ {
+ pEntry->SetMain( TRUE );
+ }
+
+ subMenuTitle += stripHotKey( aLabel );
+
+ LoadSubMenus( xSubMenu, subMenuTitle, pEntry );
+ }
+ else
+ {
+ SvxConfigEntry* pEntry = new SvxConfigEntry(
+ aLabel, aCommandURL, FALSE );
+ pEntry->SetUserDefined( bIsUserDefined );
+ pEntry->SetHelpURL( aHelpURL );
+ pEntries->push_back( pEntry );
+ }
+ }
+ else
+ {
+ SvxConfigEntry* pEntry = new SvxConfigEntry;
+ pEntry->SetUserDefined( bIsUserDefined );
+ pEntries->push_back( pEntry );
+ }
+ }
+ }
+ return true;
+}
+
+bool MenuSaveInData::Apply()
+{
+ bool result = FALSE;
+
+ if ( IsModified() )
+ {
+ // Apply new menu bar structure to our settings container
+ m_xMenuSettings = uno::Reference< container::XIndexAccess >(
+ GetConfigManager()->createSettings(), uno::UNO_QUERY );
+
+ uno::Reference< container::XIndexContainer > xIndexContainer (
+ m_xMenuSettings, uno::UNO_QUERY );
+
+ uno::Reference< lang::XSingleComponentFactory > xFactory (
+ m_xMenuSettings, uno::UNO_QUERY );
+
+ Apply( pRootEntry, xIndexContainer, xFactory, NULL );
+
+ try
+ {
+ if ( GetConfigManager()->hasSettings( m_aMenuResourceURL ) )
+ {
+ GetConfigManager()->replaceSettings(
+ m_aMenuResourceURL, m_xMenuSettings );
+ }
+ else
+ {
+ GetConfigManager()->insertSettings(
+ m_aMenuResourceURL, m_xMenuSettings );
+ }
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ OSL_TRACE("caught container::NoSuchElementException saving settings");
+ }
+ catch ( com::sun::star::io::IOException& )
+ {
+ OSL_TRACE("caught IOException saving settings");
+ }
+ catch ( com::sun::star::uno::Exception& )
+ {
+ OSL_TRACE("caught some other exception saving settings");
+ }
+
+ SetModified( FALSE );
+
+ result = PersistChanges( GetConfigManager() );
+ }
+
+ return result;
+}
+
+void MenuSaveInData::Apply(
+ SvxConfigEntry* pRootEntry_,
+ uno::Reference< container::XIndexContainer >& rMenuBar,
+ uno::Reference< lang::XSingleComponentFactory >& rFactory,
+ SvLBoxEntry *pParentEntry )
+{
+ (void)pRootEntry_;
+ (void)pParentEntry;
+
+ SvxEntries::const_iterator iter = GetEntries()->begin();
+ SvxEntries::const_iterator end = GetEntries()->end();
+
+ for ( ; iter != end; iter++ )
+ {
+ SvxConfigEntry* pEntryData = *iter;
+
+ uno::Sequence< beans::PropertyValue > aPropValueSeq =
+ ConvertSvxConfigEntry( m_xCommandToLabelMap, pEntryData );
+
+ uno::Reference< container::XIndexContainer > xSubMenuBar(
+ rFactory->createInstanceWithContext( m_xComponentContext ),
+ uno::UNO_QUERY );
+
+ sal_Int32 nIndex = aPropValueSeq.getLength();
+ aPropValueSeq.realloc( nIndex + 1 );
+ aPropValueSeq[nIndex].Name = m_aDescriptorContainer;
+ aPropValueSeq[nIndex].Value <<= xSubMenuBar;
+ rMenuBar->insertByIndex(
+ rMenuBar->getCount(), uno::makeAny( aPropValueSeq ));
+ ApplyMenu( xSubMenuBar, rFactory, pEntryData );
+ }
+}
+
+void MenuSaveInData::ApplyMenu(
+ uno::Reference< container::XIndexContainer >& rMenuBar,
+ uno::Reference< lang::XSingleComponentFactory >& rFactory,
+ SvxConfigEntry* pMenuData )
+{
+ SvxEntries::const_iterator iter = pMenuData->GetEntries()->begin();
+ SvxEntries::const_iterator end = pMenuData->GetEntries()->end();
+
+ for ( ; iter != end; iter++ )
+ {
+ SvxConfigEntry* pEntry = *iter;
+
+ if ( pEntry->IsPopup() )
+ {
+ uno::Sequence< beans::PropertyValue > aPropValueSeq =
+ ConvertSvxConfigEntry( m_xCommandToLabelMap, pEntry );
+
+ uno::Reference< container::XIndexContainer > xSubMenuBar(
+ rFactory->createInstanceWithContext( m_xComponentContext ),
+ uno::UNO_QUERY );
+
+ sal_Int32 nIndex = aPropValueSeq.getLength();
+ aPropValueSeq.realloc( nIndex + 1 );
+ aPropValueSeq[nIndex].Name = m_aDescriptorContainer;
+ aPropValueSeq[nIndex].Value <<= xSubMenuBar;
+
+ rMenuBar->insertByIndex(
+ rMenuBar->getCount(), uno::makeAny( aPropValueSeq ));
+
+ ApplyMenu( xSubMenuBar, rFactory, pEntry );
+ }
+ else if ( pEntry->IsSeparator() )
+ {
+ rMenuBar->insertByIndex(
+ rMenuBar->getCount(), uno::makeAny( m_aSeparatorSeq ));
+ }
+ else
+ {
+ uno::Sequence< beans::PropertyValue > aPropValueSeq =
+ ConvertSvxConfigEntry( m_xCommandToLabelMap, pEntry );
+ rMenuBar->insertByIndex(
+ rMenuBar->getCount(), uno::makeAny( aPropValueSeq ));
+ }
+ }
+}
+
+void
+MenuSaveInData::Reset()
+{
+ GetConfigManager()->reset();
+
+ delete pRootEntry;
+ pRootEntry = NULL;
+
+ try
+ {
+ m_xMenuSettings = GetConfigManager()->getSettings(
+ m_aMenuResourceURL, sal_False );
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ // will use default settings
+ }
+}
+
+class PopupPainter : public SvLBoxString
+{
+public:
+ PopupPainter( SvLBoxEntry* pEntry, const String& rStr )
+ : SvLBoxString( pEntry, 0, rStr )
+ { }
+
+ ~PopupPainter() { }
+
+ void Paint( const Point& rPos, SvLBox& rOutDev,
+ USHORT nViewDataEntryFlags, SvLBoxEntry* pEntry )
+ {
+ SvLBoxString::Paint( rPos, rOutDev, nViewDataEntryFlags, pEntry );
+
+ Color aOldFillColor = rOutDev.GetFillColor();
+
+ SvTreeListBox* pTreeBox = static_cast< SvTreeListBox* >( &rOutDev );
+ long nX = pTreeBox->GetSizePixel().Width();
+
+ ScrollBar* pVScroll = pTreeBox->GetVScroll();
+ if ( pVScroll->IsVisible() )
+ {
+ nX -= pVScroll->GetSizePixel().Width();
+ }
+
+ SvViewDataItem* pItem = rOutDev.GetViewDataItem( pEntry, this );
+ nX -= pItem->aSize.Height();
+
+ long nSize = pItem->aSize.Height() / 2;
+ long nHalfSize = nSize / 2;
+ long nY = rPos.Y() + nHalfSize;
+
+ if ( aOldFillColor == COL_WHITE )
+ {
+ rOutDev.SetFillColor( Color( COL_BLACK ) );
+ }
+ else
+ {
+ rOutDev.SetFillColor( Color( COL_WHITE ) );
+ }
+
+ long n = 0;
+ while ( n <= nHalfSize )
+ {
+ rOutDev.DrawRect( Rectangle( nX+n, nY+n, nX+n, nY+nSize-n ) );
+ n++;
+ }
+
+ rOutDev.SetFillColor( aOldFillColor );
+ }
+};
+
+/******************************************************************************
+ *
+ * SvxMenuEntriesListBox is the listbox in which the menu items for a
+ * particular menu are shown. We have a custom listbox because we need
+ * to add drag'n'drop support from the Macro Selector and within the
+ * listbox
+ *
+ *****************************************************************************/
+SvxMenuEntriesListBox::SvxMenuEntriesListBox(
+ Window* pParent, const ResId& rResId)
+ : SvTreeListBox( pParent, rResId )
+ , pPage( (SvxMenuConfigPage*) pParent )
+ , m_bIsInternalDrag( FALSE )
+{
+ SetWindowBits(
+ GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HIDESELECTION );
+
+ SetSpaceBetweenEntries( 3 );
+ SetEntryHeight( ENTRY_HEIGHT );
+
+ SetHighlightRange();
+ SetSelectionMode(SINGLE_SELECTION);
+
+ SetDragDropMode( SV_DRAGDROP_CTRL_MOVE |
+ SV_DRAGDROP_APP_COPY |
+ SV_DRAGDROP_ENABLE_TOP |
+ SV_DRAGDROP_APP_DROP);
+}
+
+SvxMenuEntriesListBox::~SvxMenuEntriesListBox()
+{
+ // do nothing
+}
+
+// drag and drop support
+DragDropMode SvxMenuEntriesListBox::NotifyStartDrag(
+ TransferDataContainer& aTransferDataContainer, SvLBoxEntry* pEntry )
+{
+ (void)aTransferDataContainer;
+ (void)pEntry;
+
+ m_bIsInternalDrag = TRUE;
+ return GetDragDropMode();
+}
+
+void SvxMenuEntriesListBox::DragFinished( sal_Int8 nDropAction )
+{
+ (void)nDropAction;
+ m_bIsInternalDrag = FALSE;
+}
+
+sal_Int8 SvxMenuEntriesListBox::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ if ( m_bIsInternalDrag )
+ {
+ // internal copy isn't allowed!
+ if ( rEvt.mnAction == DND_ACTION_COPY )
+ return DND_ACTION_NONE;
+ else
+ return SvTreeListBox::AcceptDrop( rEvt );
+ }
+
+ // Always do COPY instead of MOVE if D&D comes from outside!
+ AcceptDropEvent aNewAcceptDropEvent( rEvt );
+ aNewAcceptDropEvent.mnAction = DND_ACTION_COPY;
+ return SvTreeListBox::AcceptDrop( aNewAcceptDropEvent );
+}
+
+BOOL SvxMenuEntriesListBox::NotifyAcceptDrop( SvLBoxEntry* )
+{
+ return TRUE;
+}
+
+BOOL SvxMenuEntriesListBox::NotifyMoving(
+ SvLBoxEntry* pTarget, SvLBoxEntry* pSource,
+ SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos)
+{
+ // only try to do a move if we are dragging within the list box
+ if ( m_bIsInternalDrag )
+ {
+ if ( pPage->MoveEntryData( pSource, pTarget ) == TRUE )
+ {
+ SvTreeListBox::NotifyMoving(
+ pTarget, pSource, rpNewParent, rNewChildPos );
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ return NotifyCopying( pTarget, pSource, rpNewParent, rNewChildPos );
+ }
+}
+
+BOOL SvxMenuEntriesListBox::NotifyCopying(
+ SvLBoxEntry* pTarget, SvLBoxEntry* pSource,
+ SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos)
+{
+ (void)pSource;
+ (void)rpNewParent;
+ (void)rNewChildPos;
+
+ if ( !m_bIsInternalDrag )
+ {
+ // if the target is NULL then add function to the start of the list
+ pPage->AddFunction( pTarget, pTarget == NULL );
+
+ // AddFunction already adds the listbox entry so return FALSE
+ // to stop another listbox entry being added
+ return FALSE;
+ }
+
+ // Copying is only allowed from external controls, not within the listbox
+ return FALSE;
+}
+
+void SvxMenuEntriesListBox::KeyInput( const KeyEvent& rKeyEvent )
+{
+ KeyCode keycode = rKeyEvent.GetKeyCode();
+
+ // support DELETE for removing the current entry
+ if ( keycode == KEY_DELETE )
+ {
+ pPage->DeleteSelectedContent();
+ }
+ // support CTRL+UP and CTRL+DOWN for moving selected entries
+ else if ( keycode.GetCode() == KEY_UP && keycode.IsMod1() )
+ {
+ pPage->MoveEntry( TRUE );
+ }
+ else if ( keycode.GetCode() == KEY_DOWN && keycode.IsMod1() )
+ {
+ pPage->MoveEntry( FALSE );
+ }
+ else
+ {
+ // pass on to superclass
+ SvTreeListBox::KeyInput( rKeyEvent );
+ }
+}
+
+// class SvxDescriptionEdit ----------------------------------------------
+
+SvxDescriptionEdit::SvxDescriptionEdit( Window* pParent, const ResId& _rId ) :
+
+ ExtMultiLineEdit( pParent, _rId )
+
+{
+ // calculate the available space for help text
+ m_aRealRect = Rectangle( Point(), GetSizePixel() );
+ if ( GetVScrollBar() )
+ m_aRealRect.Right() -= ( GetVScrollBar()->GetSizePixel().Width() + 4 );
+
+ SetLeftMargin(2);
+ SetBorderStyle( WINDOW_BORDER_MONO );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxDescriptionEdit::SetNewText( const String& _rText )
+{
+ String sTemp( _rText );
+ sal_Bool bShow = sal_False;
+ if ( sTemp.Len() > 0 )
+ {
+ // detect if a scrollbar is necessary
+ Rectangle aRect = GetTextRect( m_aRealRect, sTemp, TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE );
+ bShow = ( aRect.Bottom() > m_aRealRect.Bottom() );
+ }
+
+ if ( GetVScrollBar() )
+ GetVScrollBar()->Show( bShow );
+
+ if ( bShow )
+ sTemp += '\n';
+
+ SetText( sTemp );
+}
+
+/******************************************************************************
+ *
+ * SvxConfigPage is the abstract base class on which the Menu and Toolbar
+ * configuration tabpages are based. It includes methods which are common to
+ * both tabpages to add, delete, move and rename items etc.
+ *
+ *****************************************************************************/
+SvxConfigPage::SvxConfigPage(
+ Window *pParent, const SfxItemSet& rSet )
+ :
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_MENUS ), rSet ),
+ bInitialised( FALSE ),
+ pCurrentSaveInData( 0 ),
+ aTopLevelSeparator( this, SVX_RES( GRP_MENUS ) ),
+ aTopLevelLabel( this, SVX_RES( FT_MENUS ) ),
+ aTopLevelListBox( this, SVX_RES( LB_MENUS ) ),
+ aNewTopLevelButton( this, SVX_RES( BTN_NEW ) ),
+ aModifyTopLevelButton( this, SVX_RES( BTN_CHANGE ) ),
+ aContentsSeparator( this, SVX_RES( GRP_MENU_SEPARATOR ) ),
+ aContentsLabel( this, SVX_RES( GRP_MENU_ENTRIES ) ),
+ aContentsListBox( 0 ),
+ aAddCommandsButton( this, SVX_RES( BTN_ADD_COMMANDS ) ),
+ aModifyCommandButton( this, SVX_RES( BTN_CHANGE_ENTRY ) ),
+ aMoveUpButton( this, SVX_RES( BTN_UP ) ),
+ aMoveDownButton( this, SVX_RES( BTN_DOWN ) ),
+ aSaveInText( this, SVX_RES( TXT_SAVEIN ) ),
+ aSaveInListBox( this, SVX_RES( LB_SAVEIN ) ),
+ aDescriptionLabel( this, SVX_RES( FT_DESCRIPTION ) ),
+ aDescriptionField( this, SVX_RES( ED_DESCRIPTION ) ),
+ pSelectorDlg( 0 )
+{
+ aDescriptionField.SetControlBackground( GetSettings().GetStyleSettings().GetDialogColor() );
+ aDescriptionField.SetAutoScroll( TRUE );
+ aDescriptionField.EnableCursor( FALSE );
+}
+
+SvxConfigPage::~SvxConfigPage()
+{
+}
+
+void SvxConfigPage::Reset( const SfxItemSet& )
+{
+ // If we haven't initialised our XMultiServiceFactory reference
+ // then Reset is being called at the opening of the dialog.
+ //
+ // Load menu configuration data for the module of the currently
+ // selected document, for the currently selected document, and for
+ // all other open documents of the same module type
+ if ( !bInitialised )
+ {
+ USHORT nPos = 0;
+ uno::Reference < css::ui::XUIConfigurationManager > xCfgMgr;
+ uno::Reference < css::ui::XUIConfigurationManager > xDocCfgMgr;
+
+ uno::Reference< lang::XMultiServiceFactory > xServiceManager(
+ ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+
+ m_xFrame = GetFrame();
+ OUString aModuleId = GetFrameWithDefaultAndIdentify( m_xFrame );
+
+ // replace %MODULENAME in the label with the correct module name
+ uno::Reference< css::frame::XModuleManager > xModuleManager(
+ xServiceManager->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.frame.ModuleManager" ) ) ),
+ uno::UNO_QUERY_THROW );
+ OUString aModuleName = GetUIModuleName( aModuleId, xModuleManager );
+
+ OUString title = aTopLevelSeparator.GetText();
+ OUString aSearchString = OUString::createFromAscii( "%MODULENAME" );
+ sal_Int32 index = title.indexOf( aSearchString );
+
+ if ( index != -1 )
+ {
+ title = title.replaceAt(
+ index, aSearchString.getLength(), aModuleName );
+ aTopLevelSeparator.SetText( title );
+ }
+
+ uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier >
+ xModuleCfgSupplier( xServiceManager->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ))),
+ uno::UNO_QUERY );
+
+ // Set up data for module specific menus
+ SaveInData* pModuleData = NULL;
+
+ try
+ {
+ xCfgMgr =
+ xModuleCfgSupplier->getUIConfigurationManager( aModuleId );
+
+ pModuleData = CreateSaveInData( xCfgMgr,
+ uno::Reference< css::ui::XUIConfigurationManager >(),
+ aModuleId,
+ FALSE );
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ }
+
+ if ( pModuleData != NULL )
+ {
+ OUString label;
+ utl::ConfigManager::GetDirectConfigProperty(
+ utl::ConfigManager::PRODUCTNAME ) >>= label;
+ label += OUString::createFromAscii( " " );
+ label += aModuleName;
+
+ nPos = aSaveInListBox.InsertEntry( label );
+ aSaveInListBox.SetEntryData( nPos, pModuleData );
+ }
+
+ // try to retrieve the document based ui configuration manager
+ OUString aTitle;
+ uno::Reference< frame::XController > xController =
+ m_xFrame->getController();
+ if ( CanConfig( aModuleId ) && xController.is() )
+ {
+ uno::Reference< frame::XModel > xModel( xController->getModel() );
+ if ( xModel.is() )
+ {
+ uno::Reference< css::ui::XUIConfigurationManagerSupplier >
+ xCfgSupplier( xModel, uno::UNO_QUERY );
+
+ if ( xCfgSupplier.is() )
+ {
+ xDocCfgMgr = xCfgSupplier->getUIConfigurationManager();
+ }
+ aTitle = ::comphelper::DocumentInfo::getDocumentTitle( xModel );
+ }
+ }
+
+ SaveInData* pDocData = NULL;
+ if ( xDocCfgMgr.is() )
+ {
+ pDocData = CreateSaveInData( xDocCfgMgr, xCfgMgr, aModuleId, TRUE );
+
+ if ( !pDocData->IsReadOnly() )
+ {
+ nPos = aSaveInListBox.InsertEntry( aTitle );
+ aSaveInListBox.SetEntryData( nPos, pDocData );
+ }
+ }
+
+ // if an item to select has been passed in (eg. the ResourceURL for a
+ // toolbar) then try to select the SaveInData entry that has that item
+ bool bURLToSelectFound = FALSE;
+ if ( m_aURLToSelect.getLength() != 0 )
+ {
+ if ( pDocData != NULL && pDocData->HasURL( m_aURLToSelect ) )
+ {
+ aSaveInListBox.SelectEntryPos( nPos, TRUE );
+ pCurrentSaveInData = pDocData;
+ bURLToSelectFound = TRUE;
+ }
+ else if ( pModuleData->HasURL( m_aURLToSelect ) )
+ {
+ aSaveInListBox.SelectEntryPos( 0, TRUE );
+ pCurrentSaveInData = pModuleData;
+ bURLToSelectFound = TRUE;
+ }
+ }
+
+ if ( bURLToSelectFound == FALSE )
+ {
+ // if the document has menu configuration settings select it
+ // it the SaveIn listbox, otherwise select the module data
+ if ( pDocData != NULL && pDocData->HasSettings() )
+ {
+ aSaveInListBox.SelectEntryPos( nPos, TRUE );
+ pCurrentSaveInData = pDocData;
+ }
+ else
+ {
+ aSaveInListBox.SelectEntryPos( 0, TRUE );
+ pCurrentSaveInData = pModuleData;
+ }
+ }
+
+#ifdef DBG_UTIL
+ DBG_ASSERT( pCurrentSaveInData, "SvxConfigPage::Reset(): no SaveInData" );
+#endif
+
+ if ( CanConfig( aModuleId ) )
+ {
+ // Load configuration for other open documents which have
+ // same module type
+ uno::Sequence< uno::Reference< frame::XFrame > > aFrameList;
+ try
+ {
+ uno::Reference< frame::XFramesSupplier > xFramesSupplier(
+ xServiceManager->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.frame.Desktop" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ uno::Reference< frame::XFrames > xFrames =
+ xFramesSupplier->getFrames();
+
+ aFrameList = xFrames->queryFrames(
+ frame::FrameSearchFlag::ALL & ~frame::FrameSearchFlag::SELF );
+
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ for ( sal_Int32 i = 0; i < aFrameList.getLength(); i++ )
+ {
+ SaveInData* pData = NULL;
+ uno::Reference < frame::XFrame > xf = aFrameList[i];
+
+ if ( xf.is() && xf != m_xFrame )
+ {
+ OUString aCheckId;
+ try{
+ aCheckId = xModuleManager->identify( xf );
+ } catch(const uno::Exception&)
+ { aCheckId = ::rtl::OUString(); }
+
+ if ( aModuleId.equals( aCheckId ) )
+ {
+ // try to get the document based ui configuration manager
+ OUString aTitle2;
+ uno::Reference< frame::XController > xController_ =
+ xf->getController();
+
+ if ( xController_.is() )
+ {
+ uno::Reference< frame::XModel > xModel(
+ xController_->getModel() );
+
+ if ( xModel.is() )
+ {
+ uno::Reference<
+ css::ui::XUIConfigurationManagerSupplier >
+ xCfgSupplier( xModel, uno::UNO_QUERY );
+
+ if ( xCfgSupplier.is() )
+ {
+ xDocCfgMgr =
+ xCfgSupplier->getUIConfigurationManager();
+ }
+ aTitle2 = ::comphelper::DocumentInfo::getDocumentTitle( xModel );
+ }
+ }
+
+ if ( xDocCfgMgr.is() )
+ {
+ pData = CreateSaveInData( xDocCfgMgr, xCfgMgr, aModuleId, TRUE );
+
+ if ( pData && !pData->IsReadOnly() )
+ {
+ nPos = aSaveInListBox.InsertEntry( aTitle2 );
+ aSaveInListBox.SetEntryData( nPos, pData );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ aSaveInListBox.SetSelectHdl(
+ LINK( this, SvxConfigPage, SelectSaveInLocation ) );
+
+ bInitialised = TRUE;
+
+ Init();
+ }
+ else
+ {
+ if ( QueryReset() == RET_YES )
+ {
+ // Reset menu configuration for currently selected SaveInData
+ GetSaveInData()->Reset();
+
+ Init();
+ }
+ }
+}
+
+::rtl::OUString SvxConfigPage::GetFrameWithDefaultAndIdentify( uno::Reference< frame::XFrame >& _inout_rxFrame )
+{
+ ::rtl::OUString sModuleID;
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xServiceManager(
+ ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+
+ uno::Reference< frame::XFramesSupplier > xFramesSupplier(
+ xServiceManager->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.frame.Desktop" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ if ( !_inout_rxFrame.is() )
+ _inout_rxFrame = xFramesSupplier->getActiveFrame();
+
+ if ( !_inout_rxFrame.is() )
+ {
+ uno::Reference< frame::XDesktop > xDesktop( xFramesSupplier, uno::UNO_QUERY_THROW );
+ _inout_rxFrame = xDesktop->getCurrentFrame();
+ }
+
+ if ( !_inout_rxFrame.is() && SfxViewFrame::Current() )
+ _inout_rxFrame = SfxViewFrame::Current()->GetFrame()->GetFrameInterface();
+
+ if ( !_inout_rxFrame.is() )
+ {
+ DBG_ERRORFILE( "SvxConfigPage::GetFrameWithDefaultAndIdentify(): no frame found!" );
+ return sModuleID;
+ }
+
+ uno::Reference< css::frame::XModuleManager > xModuleManager(
+ xServiceManager->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.frame.ModuleManager" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ try
+ {
+ sModuleID = xModuleManager->identify( _inout_rxFrame );
+ }
+ catch ( const frame::UnknownModuleException& )
+ {
+ }
+
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return sModuleID;
+}
+
+BOOL SvxConfigPage::FillItemSet( SfxItemSet& )
+{
+ bool result = FALSE;
+
+ for ( USHORT i = 0 ; i < aSaveInListBox.GetEntryCount(); i++ )
+ {
+ SaveInData* pData =
+ (SaveInData*) aSaveInListBox.GetEntryData( i );
+
+ result = pData->Apply();
+ }
+ return result;
+}
+
+void SvxConfigPage::PositionContentsListBox()
+{
+ if ( aContentsListBox == NULL )
+ {
+ return;
+ }
+
+ Point p, newp;
+ Size s, news;
+ long x, y, width, height;
+
+ // x and width is same as aTopLevelListBox
+ x = aTopLevelListBox.GetPosPixel().X();
+ width = aTopLevelListBox.GetSizePixel().Width();
+
+ // y is same as aAddCommandsButton
+ y = aAddCommandsButton.GetPosPixel().Y();
+
+ // get gap between aAddCommandsButton and aContentsSeparator
+ p = aContentsSeparator.GetPosPixel();
+ s = aContentsSeparator.GetSizePixel();
+ long gap = y - ( p.Y() + s.Height() );
+
+ height = aSaveInListBox.GetPosPixel().Y() - y - gap;
+
+ aContentsListBox->SetPosPixel( Point( x, y ) );
+ aContentsListBox->SetSizePixel( Size( width, height ) );
+}
+
+IMPL_LINK( SvxConfigPage, SelectSaveInLocation, ListBox *, pBox )
+{
+ (void)pBox;
+
+ pCurrentSaveInData = (SaveInData*) aSaveInListBox.GetEntryData(
+ aSaveInListBox.GetSelectEntryPos());
+
+ Init();
+ return 1;
+}
+
+void SvxConfigPage::ReloadTopLevelListBox( SvxConfigEntry* pToSelect )
+{
+ USHORT nSelectionPos = aTopLevelListBox.GetSelectEntryPos();
+ aTopLevelListBox.Clear();
+
+ if ( GetSaveInData() && GetSaveInData()->GetEntries() )
+ {
+ SvxEntries::const_iterator iter = GetSaveInData()->GetEntries()->begin();
+ SvxEntries::const_iterator end = GetSaveInData()->GetEntries()->end();
+
+ for ( ; iter != end; iter++ )
+ {
+ SvxConfigEntry* pEntryData = *iter;
+ USHORT nPos = aTopLevelListBox.InsertEntry( stripHotKey( pEntryData->GetName() ) );
+ aTopLevelListBox.SetEntryData( nPos, pEntryData );
+
+ if ( pEntryData == pToSelect )
+ nSelectionPos = nPos;
+
+ AddSubMenusToUI( stripHotKey( pEntryData->GetName() ), pEntryData );
+ }
+ }
+#ifdef DBG_UTIL
+ else
+ {
+ DBG_ASSERT( GetSaveInData(), "SvxConfigPage::ReloadTopLevelListBox(): no SaveInData" );
+ DBG_ASSERT( GetSaveInData()->GetEntries() ,
+ "SvxConfigPage::ReloadTopLevelListBox(): no SaveInData entries" );
+ }
+#endif
+
+ nSelectionPos = nSelectionPos < aTopLevelListBox.GetEntryCount() ?
+ nSelectionPos : aTopLevelListBox.GetEntryCount() - 1;
+
+ aTopLevelListBox.SelectEntryPos( nSelectionPos, TRUE );
+ aTopLevelListBox.GetSelectHdl().Call( this );
+}
+
+void SvxConfigPage::AddSubMenusToUI(
+ const String& rBaseTitle, SvxConfigEntry* pParentData )
+{
+ SvxEntries::const_iterator iter = pParentData->GetEntries()->begin();
+ SvxEntries::const_iterator end = pParentData->GetEntries()->end();
+
+ for ( ; iter != end; iter++ )
+ {
+ SvxConfigEntry* pEntryData = *iter;
+
+ if ( pEntryData->IsPopup() )
+ {
+ OUString subMenuTitle( rBaseTitle );
+ subMenuTitle += OUString::createFromAscii( pMenuSeparatorStr );
+ subMenuTitle += stripHotKey( pEntryData->GetName() );
+
+ USHORT nPos = aTopLevelListBox.InsertEntry( subMenuTitle );
+ aTopLevelListBox.SetEntryData( nPos, pEntryData );
+
+ AddSubMenusToUI( subMenuTitle, pEntryData );
+ }
+ }
+}
+
+SvxEntries* SvxConfigPage::FindParentForChild(
+ SvxEntries* pRootEntries, SvxConfigEntry* pChildData )
+{
+ SvxEntries::const_iterator iter = pRootEntries->begin();
+ SvxEntries::const_iterator end = pRootEntries->end();
+
+ for ( ; iter != end; iter++ )
+ {
+ SvxConfigEntry* pEntryData = *iter;
+
+ if ( pEntryData == pChildData )
+ {
+ return pRootEntries;
+ }
+ else if ( pEntryData->IsPopup() )
+ {
+ SvxEntries* result =
+ FindParentForChild( pEntryData->GetEntries(), pChildData );
+
+ if ( result != NULL )
+ {
+ return result;
+ }
+ }
+ }
+ return NULL;
+}
+
+SvLBoxEntry* SvxConfigPage::AddFunction(
+ SvLBoxEntry* pTarget, bool bFront, bool bAllowDuplicates )
+{
+ String aDisplayName = pSelectorDlg->GetSelectedDisplayName();
+ String aHelpText = pSelectorDlg->GetSelectedHelpText();
+ String aURL = pSelectorDlg->GetScriptURL();
+
+ if ( !aURL.Len() )
+ {
+ return NULL;
+ }
+
+ SvxConfigEntry* pNewEntryData =
+ new SvxConfigEntry( aDisplayName, aURL, FALSE );
+ pNewEntryData->SetUserDefined( TRUE );
+ pNewEntryData->SetHelpURL( aURL );
+
+ // check that this function is not already in the menu
+ SvxConfigEntry* pParent = GetTopLevelSelection();
+
+ SvxEntries::const_iterator iter = pParent->GetEntries()->begin();
+ SvxEntries::const_iterator end = pParent->GetEntries()->end();
+
+ if ( !bAllowDuplicates )
+ {
+ while ( iter != end )
+ {
+ SvxConfigEntry *pCurEntry = *iter;
+
+ if ( pCurEntry->GetCommand() == pNewEntryData->GetCommand() )
+ {
+ // asynchronous error message, because of MsgBoxes
+ PostUserEvent(
+ LINK( this, SvxConfigPage, AsyncInfoMsg ) );
+ return NULL;
+ }
+
+ iter++;
+ }
+ }
+
+ return InsertEntry( pNewEntryData, pTarget, bFront );
+}
+
+SvLBoxEntry* SvxConfigPage::InsertEntry(
+ SvxConfigEntry* pNewEntryData,
+ SvLBoxEntry* pTarget,
+ bool bFront )
+{
+ // Grab the entries list for the currently selected menu
+ SvxEntries* pEntries = GetTopLevelSelection()->GetEntries();
+
+ SvLBoxEntry* pNewEntry = NULL;
+ SvLBoxEntry* pCurEntry =
+ pTarget != NULL ? pTarget : aContentsListBox->GetCurEntry();
+
+ if ( bFront )
+ {
+ pEntries->insert( pEntries->begin(), pNewEntryData );
+ pNewEntry = InsertEntryIntoUI( pNewEntryData, 0 );
+ }
+ else if ( pCurEntry == NULL || pCurEntry == aContentsListBox->Last() )
+ {
+ pEntries->push_back( pNewEntryData );
+ pNewEntry = InsertEntryIntoUI( pNewEntryData );
+ }
+ else
+ {
+ SvxConfigEntry* pEntryData =
+ (SvxConfigEntry*) pCurEntry->GetUserData();
+
+ SvxEntries::iterator iter = pEntries->begin();
+ SvxEntries::const_iterator end = pEntries->end();
+
+ // Advance the iterator to the data for currently selected entry
+ USHORT nPos = 0;
+ while (*iter != pEntryData && ++iter != end)
+ {
+ nPos++;
+ }
+
+ // Now step past it to the entry after the currently selected one
+ iter++;
+ nPos++;
+
+ // Now add the new entry to the UI and to the parent's list
+ if ( iter != end )
+ {
+ pEntries->insert( iter, pNewEntryData );
+ pNewEntry = InsertEntryIntoUI( pNewEntryData, nPos );
+ }
+ }
+
+ if ( pNewEntry != NULL )
+ {
+ aContentsListBox->Select( pNewEntry );
+ aContentsListBox->MakeVisible( pNewEntry );
+
+ GetSaveInData()->SetModified( TRUE );
+ }
+
+ return pNewEntry;
+}
+
+SvLBoxEntry* SvxConfigPage::InsertEntryIntoUI(
+ SvxConfigEntry* pNewEntryData, ULONG nPos )
+{
+ SvLBoxEntry* pNewEntry = NULL;
+
+ if (pNewEntryData->IsSeparator())
+ {
+ pNewEntry = aContentsListBox->InsertEntry(
+ String::CreateFromAscii( pSeparatorStr ),
+ 0, FALSE, nPos, pNewEntryData );
+ }
+ else
+ {
+ OUString aName = stripHotKey( pNewEntryData->GetName() );
+
+ Image aImage = GetSaveInData()->GetImage(
+ pNewEntryData->GetCommand());
+
+ if ( !!aImage )
+ {
+ pNewEntry = aContentsListBox->InsertEntry(
+ aName, aImage, aImage, 0, FALSE, nPos, pNewEntryData );
+ }
+ else
+ {
+ pNewEntry = aContentsListBox->InsertEntry(
+ aName, 0, FALSE, nPos, pNewEntryData );
+ }
+
+ if ( pNewEntryData->IsPopup() ||
+ pNewEntryData->GetStyle() & css::ui::ItemStyle::DROP_DOWN )
+ {
+ // add new popup painter, it gets destructed by the entry
+ pNewEntry->ReplaceItem(
+ new PopupPainter( pNewEntry, aName ),
+ pNewEntry->ItemCount() - 1 );
+ }
+ }
+
+ return pNewEntry;
+}
+
+IMPL_LINK( SvxConfigPage, AsyncInfoMsg, String*, pMsg )
+{
+ (void)pMsg;
+
+ // Asynchronous msg because of D&D
+ InfoBox( this, SVX_RES(
+ IBX_MNUCFG_ALREADY_INCLUDED ) ).Execute();
+
+ return 0;
+}
+
+IMPL_LINK( SvxConfigPage, MoveHdl, Button *, pButton )
+{
+ MoveEntry( pButton == &aMoveUpButton );
+ return 0;
+}
+
+void SvxConfigPage::MoveEntry( bool bMoveUp )
+{
+ SvLBoxEntry *pSourceEntry = aContentsListBox->FirstSelected();
+ SvLBoxEntry *pTargetEntry = NULL;
+ SvLBoxEntry *pToSelect = NULL;
+
+ if ( !pSourceEntry )
+ {
+ return;
+ }
+
+ if ( bMoveUp )
+ {
+ // Move Up is just a Move Down with the source and target reversed
+ pTargetEntry = pSourceEntry;
+ pSourceEntry = aContentsListBox->PrevSibling( pTargetEntry );
+ pToSelect = pTargetEntry;
+ }
+ else
+ {
+ pTargetEntry = aContentsListBox->NextSibling( pSourceEntry );
+ pToSelect = pSourceEntry;
+ }
+
+ if ( MoveEntryData( pSourceEntry, pTargetEntry ) )
+ {
+ aContentsListBox->GetModel()->Move( pSourceEntry, pTargetEntry );
+ aContentsListBox->Select( pToSelect );
+ aContentsListBox->MakeVisible( pToSelect );
+
+ UpdateButtonStates();
+ }
+}
+
+bool SvxConfigPage::MoveEntryData(
+ SvLBoxEntry* pSourceEntry, SvLBoxEntry* pTargetEntry )
+{
+ //modified by shizhoubo for issue53677
+ if ( NULL == pSourceEntry || NULL == pTargetEntry )
+ {
+ return FALSE;
+ }
+
+ // Grab the entries list for the currently selected menu
+ SvxEntries* pEntries = GetTopLevelSelection()->GetEntries();
+
+ SvxConfigEntry* pSourceData =
+ (SvxConfigEntry*) pSourceEntry->GetUserData();
+
+ if ( pTargetEntry == NULL )
+ {
+ RemoveEntry( pEntries, pSourceData );
+ pEntries->insert(
+ pEntries->begin(), pSourceData );
+
+ GetSaveInData()->SetModified( TRUE );
+
+ return TRUE;
+ }
+ else
+ {
+ SvxConfigEntry* pTargetData =
+ (SvxConfigEntry*) pTargetEntry->GetUserData();
+
+ if ( pSourceData != NULL && pTargetData != NULL )
+ {
+ // remove the source entry from our list
+ RemoveEntry( pEntries, pSourceData );
+
+ SvxEntries::iterator iter = pEntries->begin();
+ SvxEntries::const_iterator end = pEntries->end();
+
+ // advance the iterator to the position of the target entry
+ while (*iter != pTargetData && ++iter != end) ;
+
+ // insert the source entry at the position after the target
+ pEntries->insert( ++iter, pSourceData );
+
+ GetSaveInData()->SetModified( TRUE );
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+SvxMenuConfigPage::SvxMenuConfigPage(
+ Window *pParent, const SfxItemSet& rSet )
+ :
+ SvxConfigPage( pParent, rSet )
+{
+ aContentsListBox = new SvxMenuEntriesListBox( this, SVX_RES( BOX_ENTRIES ) );
+ FreeResource();
+
+ PositionContentsListBox();
+ aContentsListBox->SetZOrder( &aAddCommandsButton, WINDOW_ZORDER_BEFOR );
+
+ aTopLevelListBox.SetSelectHdl(
+ LINK( this, SvxMenuConfigPage, SelectMenu ) );
+
+ aContentsListBox->SetSelectHdl(
+ LINK( this, SvxMenuConfigPage, SelectMenuEntry ) );
+
+ aMoveUpButton.SetClickHdl ( LINK( this, SvxConfigPage, MoveHdl) );
+ aMoveDownButton.SetClickHdl ( LINK( this, SvxConfigPage, MoveHdl) );
+
+ aNewTopLevelButton.SetClickHdl (
+ LINK( this, SvxMenuConfigPage, NewMenuHdl ) );
+
+ aAddCommandsButton.SetClickHdl (
+ LINK( this, SvxMenuConfigPage, AddCommandsHdl ) );
+
+ PopupMenu* pMenu = new PopupMenu( SVX_RES( MODIFY_MENU ) );
+ pMenu->SetMenuFlags(
+ pMenu->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES );
+
+ aModifyTopLevelButton.SetPopupMenu( pMenu );
+ aModifyTopLevelButton.SetSelectHdl(
+ LINK( this, SvxMenuConfigPage, MenuSelectHdl ) );
+
+ PopupMenu* pEntry = new PopupMenu( SVX_RES( MODIFY_ENTRY ) );
+ pEntry->SetMenuFlags(
+ pEntry->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES );
+
+ aModifyCommandButton.SetPopupMenu( pEntry );
+ aModifyCommandButton.SetSelectHdl(
+ LINK( this, SvxMenuConfigPage, EntrySelectHdl ) );
+}
+
+// Populates the Menu combo box
+void SvxMenuConfigPage::Init()
+{
+ // ensure that the UI is cleared before populating it
+ aTopLevelListBox.Clear();
+ aContentsListBox->Clear();
+
+ ReloadTopLevelListBox();
+
+ aTopLevelListBox.SelectEntryPos(0, TRUE);
+ aTopLevelListBox.GetSelectHdl().Call(this);
+}
+
+SvxMenuConfigPage::~SvxMenuConfigPage()
+{
+ for ( USHORT i = 0 ; i < aSaveInListBox.GetEntryCount(); i++ )
+ {
+ MenuSaveInData* pData =
+ (MenuSaveInData*) aSaveInListBox.GetEntryData( i );
+
+ delete pData;
+ }
+
+ if ( pSelectorDlg != NULL )
+ {
+ delete pSelectorDlg;
+ }
+
+ delete aContentsListBox;
+}
+
+IMPL_LINK( SvxMenuConfigPage, SelectMenuEntry, Control *, pBox )
+{
+ (void)pBox;
+
+ UpdateButtonStates();
+
+ return 1;
+}
+
+void SvxMenuConfigPage::UpdateButtonStates()
+{
+ PopupMenu* pPopup = aModifyCommandButton.GetPopupMenu();
+
+ // Disable Up and Down buttons depending on current selection
+ SvLBoxEntry* selection = aContentsListBox->GetCurEntry();
+
+ if ( aContentsListBox->GetEntryCount() == 0 || selection == NULL )
+ {
+ aMoveUpButton.Enable( FALSE );
+ aMoveDownButton.Enable( FALSE );
+
+ pPopup->EnableItem( ID_BEGIN_GROUP, TRUE );
+ pPopup->EnableItem( ID_RENAME, FALSE );
+ pPopup->EnableItem( ID_DELETE, FALSE );
+
+ aDescriptionField.Clear();
+
+ return;
+ }
+
+ SvLBoxEntry* first = aContentsListBox->First();
+ SvLBoxEntry* last = aContentsListBox->Last();
+
+ aMoveUpButton.Enable( selection != first );
+ aMoveDownButton.Enable( selection != last );
+
+ SvxConfigEntry* pEntryData =
+ (SvxConfigEntry*) selection->GetUserData();
+
+ if ( pEntryData->IsSeparator() )
+ {
+ pPopup->EnableItem( ID_DELETE, TRUE );
+ pPopup->EnableItem( ID_BEGIN_GROUP, FALSE );
+ pPopup->EnableItem( ID_RENAME, FALSE );
+
+ aDescriptionField.Clear();
+ }
+ else
+ {
+ pPopup->EnableItem( ID_BEGIN_GROUP, TRUE );
+ pPopup->EnableItem( ID_DELETE, TRUE );
+ pPopup->EnableItem( ID_RENAME, TRUE );
+
+ aDescriptionField.SetNewText( pEntryData->GetHelpText() );
+ }
+}
+
+void SvxMenuConfigPage::DeleteSelectedTopLevel()
+{
+ SvxConfigEntry* pMenuData = GetTopLevelSelection();
+
+ SvxEntries* pParentEntries =
+ FindParentForChild( GetSaveInData()->GetEntries(), pMenuData );
+
+ RemoveEntry( pParentEntries, pMenuData );
+ delete pMenuData;
+
+ ReloadTopLevelListBox();
+
+ GetSaveInData()->SetModified( TRUE );
+}
+
+bool SvxMenuConfigPage::DeleteSelectedContent()
+{
+ SvLBoxEntry *pActEntry = aContentsListBox->FirstSelected();
+
+ if ( pActEntry != NULL )
+ {
+ // get currently selected menu entry
+ SvxConfigEntry* pMenuEntry =
+ (SvxConfigEntry*) pActEntry->GetUserData();
+
+ // get currently selected menu
+ SvxConfigEntry* pMenu = GetTopLevelSelection();
+
+ // remove menu entry from the list for this menu
+ RemoveEntry( pMenu->GetEntries(), pMenuEntry );
+
+ // remove menu entry from UI
+ aContentsListBox->GetModel()->Remove( pActEntry );
+
+ // if this is a submenu entry, redraw the menus list box
+ if ( pMenuEntry->IsPopup() )
+ {
+ ReloadTopLevelListBox();
+ }
+
+ // delete data for menu entry
+ delete pMenuEntry;
+
+ GetSaveInData()->SetModified( TRUE );
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+short SvxMenuConfigPage::QueryReset()
+{
+ String msg =
+ String( SVX_RES( RID_SVXSTR_CONFIRM_MENU_RESET ) );
+
+ String saveInName = aSaveInListBox.GetEntry(
+ aSaveInListBox.GetSelectEntryPos() );
+
+ OUString label = replaceSaveInName( msg, saveInName );
+
+ QueryBox qbox( this, WB_YES_NO, label );
+
+ return qbox.Execute();
+}
+
+IMPL_LINK( SvxMenuConfigPage, SelectMenu, ListBox *, pBox )
+{
+ (void)pBox;
+
+ aContentsListBox->Clear();
+
+ SvxConfigEntry* pMenuData = GetTopLevelSelection();
+
+ PopupMenu* pPopup = aModifyTopLevelButton.GetPopupMenu();
+ pPopup->EnableItem( ID_DELETE, pMenuData->IsDeletable() );
+ pPopup->EnableItem( ID_RENAME, pMenuData->IsRenamable() );
+ pPopup->EnableItem( ID_MOVE, pMenuData->IsMovable() );
+
+ SvxEntries* pEntries = pMenuData->GetEntries();
+ SvxEntries::const_iterator iter = pEntries->begin();
+
+ for ( ; iter != pEntries->end(); iter++ )
+ {
+ SvxConfigEntry* pEntry = *iter;
+ InsertEntryIntoUI( pEntry );
+ }
+
+ UpdateButtonStates();
+
+ return 0;
+}
+
+IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton )
+{
+ switch( pButton->GetCurItemId() )
+ {
+ case ID_DELETE:
+ {
+ DeleteSelectedTopLevel();
+ break;
+ }
+ case ID_RENAME:
+ {
+ SvxConfigEntry* pMenuData = GetTopLevelSelection();
+
+ String aNewName( stripHotKey( pMenuData->GetName() ) );
+ String aDesc = SVX_RESSSTR( RID_SVXSTR_LABEL_NEW_NAME );
+
+ SvxNameDialog* pNameDialog = new SvxNameDialog( this, aNewName, aDesc );
+ pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_MENU );
+ pNameDialog->SetText( SVX_RESSTR( RID_SVXSTR_RENAME_MENU ) );
+
+ bool ret = pNameDialog->Execute();
+
+ if ( ret == RET_OK ) {
+ pNameDialog->GetName( aNewName );
+ pMenuData->SetName( aNewName );
+
+ ReloadTopLevelListBox();
+
+ GetSaveInData()->SetModified( TRUE );
+ }
+
+ // #i68101# Moemory leak (!)
+ delete pNameDialog;
+
+ break;
+ }
+ case ID_MOVE:
+ {
+ SvxConfigEntry* pMenuData = GetTopLevelSelection();
+
+ SvxMainMenuOrganizerDialog* pDialog =
+ new SvxMainMenuOrganizerDialog( this,
+ GetSaveInData()->GetEntries(), pMenuData );
+
+ bool ret = pDialog->Execute();
+
+ if ( ret == RET_OK )
+ {
+ GetSaveInData()->SetEntries( pDialog->GetEntries() );
+
+ ReloadTopLevelListBox( pDialog->GetSelectedEntry() );
+
+ GetSaveInData()->SetModified( TRUE );
+ }
+
+ delete pDialog;
+
+ break;
+ }
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+
+IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton )
+{
+ switch( pButton->GetCurItemId() )
+ {
+ case ID_ADD_SUBMENU:
+ {
+ String aNewName;
+ String aDesc = SVX_RESSSTR( RID_SVXSTR_SUBMENU_NAME );
+
+ SvxNameDialog* pNameDialog = new SvxNameDialog( this, aNewName, aDesc );
+ pNameDialog->SetHelpId( HID_SVX_CONFIG_NAME_SUBMENU );
+ pNameDialog->SetText( SVX_RESSTR( RID_SVXSTR_ADD_SUBMENU ) );
+
+ bool ret = pNameDialog->Execute();
+
+ if ( ret == RET_OK ) {
+ pNameDialog->GetName(aNewName);
+
+ SvxConfigEntry* pNewEntryData =
+ new SvxConfigEntry( aNewName, aNewName, TRUE );
+ pNewEntryData->SetUserDefined( TRUE );
+
+ InsertEntry( pNewEntryData );
+
+ ReloadTopLevelListBox();
+
+ GetSaveInData()->SetModified( TRUE );
+ }
+
+ delete pNameDialog;
+
+ break;
+ }
+ case ID_BEGIN_GROUP:
+ {
+ SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
+ pNewEntryData->SetUserDefined( TRUE );
+ InsertEntry( pNewEntryData );
+
+ break;
+ }
+ case ID_DELETE:
+ {
+ DeleteSelectedContent();
+ break;
+ }
+ case ID_RENAME:
+ {
+ SvLBoxEntry* pActEntry = aContentsListBox->GetCurEntry();
+ SvxConfigEntry* pEntry =
+ (SvxConfigEntry*) pActEntry->GetUserData();
+
+ String aNewName( stripHotKey( pEntry->GetName() ) );
+ String aDesc = SVX_RESSSTR( RID_SVXSTR_LABEL_NEW_NAME );
+
+ SvxNameDialog* pNameDialog = new SvxNameDialog( this, aNewName, aDesc );
+ pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_MENU_ITEM );
+ pNameDialog->SetText( SVX_RESSTR( RID_SVXSTR_RENAME_MENU ) );
+
+ bool ret = pNameDialog->Execute();
+
+ if ( ret == RET_OK ) {
+ pNameDialog->GetName(aNewName);
+
+ pEntry->SetName( aNewName );
+ aContentsListBox->SetEntryText( pActEntry, aNewName );
+
+ GetSaveInData()->SetModified( TRUE );
+ }
+
+ delete pNameDialog;
+
+ break;
+ }
+ default:
+ {
+ return FALSE;
+ }
+ }
+
+ if ( GetSaveInData()->IsModified() )
+ {
+ UpdateButtonStates();
+ }
+
+ return TRUE;
+}
+
+IMPL_LINK( SvxMenuConfigPage, AddFunctionHdl,
+ SvxScriptSelectorDialog *, pDialog )
+{
+ (void)pDialog;
+
+ AddFunction();
+
+ return 0;
+}
+
+IMPL_LINK( SvxMenuConfigPage, NewMenuHdl, Button *, pButton )
+{
+ (void)pButton;
+
+ SvxMainMenuOrganizerDialog* pDialog =
+ new SvxMainMenuOrganizerDialog( 0,
+ GetSaveInData()->GetEntries(), NULL, TRUE );
+
+ bool ret = pDialog->Execute();
+
+ if ( ret == RET_OK )
+ {
+ GetSaveInData()->SetEntries( pDialog->GetEntries() );
+ ReloadTopLevelListBox( pDialog->GetSelectedEntry() );
+ GetSaveInData()->SetModified( TRUE );
+ }
+
+ delete pDialog;
+
+ return 0;
+}
+
+IMPL_LINK( SvxMenuConfigPage, AddCommandsHdl, Button *, pButton )
+{
+ (void)pButton;
+
+ if ( pSelectorDlg == NULL )
+ {
+ // Create Script Selector which also shows builtin commands
+ pSelectorDlg = new SvxScriptSelectorDialog( this, TRUE, m_xFrame );
+
+ pSelectorDlg->SetAddHdl(
+ LINK( this, SvxMenuConfigPage, AddFunctionHdl ) );
+
+ pSelectorDlg->SetDialogDescription( String(
+ SVX_RES( RID_SVXSTR_MENU_ADDCOMMANDS_DESCRIPTION ) ) );
+ }
+
+ // Position the Script Selector over the Add button so it is
+ // beside the menu contents list and does not obscure it
+ pSelectorDlg->SetPosPixel( aAddCommandsButton.GetPosPixel() );
+
+ pSelectorDlg->SetImageProvider(
+ static_cast< ImageProvider* >( GetSaveInData() ) );
+
+ pSelectorDlg->Show();
+ return 1;
+}
+
+SaveInData* SvxMenuConfigPage::CreateSaveInData(
+ const uno::Reference< css::ui::XUIConfigurationManager >& xCfgMgr,
+ const uno::Reference< css::ui::XUIConfigurationManager >& xParentCfgMgr,
+ const OUString& aModuleId,
+ bool bDocConfig )
+{
+ return static_cast< SaveInData* >(
+ new MenuSaveInData( xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig ));
+}
+
+SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
+ Window* pParent, SvxEntries* entries,
+ SvxConfigEntry* selection, bool bCreateMenu )
+ :
+ ModalDialog( pParent, SVX_RES( MD_MENU_ORGANISER ) ),
+ aMenuNameText( this, SVX_RES( TXT_MENU_NAME ) ),
+ aMenuNameEdit( this, SVX_RES( EDIT_MENU_NAME ) ),
+ aMenuListText( this, SVX_RES( TXT_MENU ) ),
+ aMenuListBox( this, SVX_RES( BOX_MAIN_MENUS ) ),
+ aMoveUpButton( this, SVX_RES( BTN_MENU_UP ) ),
+ aMoveDownButton( this, SVX_RES( BTN_MENU_DOWN ) ),
+ aOKButton( this, SVX_RES( BTN_MENU_ADD ) ),
+ aCloseButton( this, SVX_RES( BTN_MENU_CLOSE ) ),
+ aHelpButton( this, SVX_RES( BTN_MENU_HELP ) ),
+ bModified( FALSE )
+{
+ FreeResource();
+
+ // Copy the entries list passed in
+ if ( entries != NULL )
+ {
+ SvxConfigEntry* pEntry;
+ SvLBoxEntry* pLBEntry;
+
+ pEntries = new SvxEntries();
+ SvxEntries::const_iterator iter = entries->begin();
+
+ while ( iter != entries->end() )
+ {
+ pEntry = *iter;
+ pLBEntry =
+ aMenuListBox.InsertEntry( stripHotKey( pEntry->GetName() ) );
+ pLBEntry->SetUserData( pEntry );
+ pEntries->push_back( pEntry );
+
+ if ( pEntry == selection )
+ {
+ aMenuListBox.Select( pLBEntry );
+ }
+ iter++;
+ }
+ }
+
+ if ( bCreateMenu )
+ {
+ // Generate custom name for new menu
+ String prefix =
+ String( SVX_RES( RID_SVXSTR_NEW_MENU ) );
+
+ OUString newname = generateCustomName( prefix, entries );
+ OUString newurl = generateCustomMenuURL( pEntries );
+
+ SvxConfigEntry* pNewEntryData =
+ new SvxConfigEntry( newname, newurl, TRUE );
+ pNewEntryData->SetUserDefined( TRUE );
+ pNewEntryData->SetMain( TRUE );
+
+ pNewMenuEntry =
+ aMenuListBox.InsertEntry( stripHotKey( pNewEntryData->GetName() ) );
+ aMenuListBox.Select( pNewMenuEntry );
+
+ pNewMenuEntry->SetUserData( pNewEntryData );
+
+ pEntries->push_back( pNewEntryData );
+
+ aMenuNameEdit.SetText( newname );
+ aMenuNameEdit.SetModifyHdl(
+ LINK( this, SvxMainMenuOrganizerDialog, ModifyHdl ) );
+ }
+ else
+ {
+ Point p, newp;
+ Size s, news;
+
+ // get offset to bottom of name textfield from top of dialog
+ p = aMenuNameEdit.GetPosPixel();
+ s = aMenuNameEdit.GetSizePixel();
+ long offset = p.Y() + s.Height();
+
+ // reposition menu list and label
+ aMenuListText.SetPosPixel( aMenuNameText.GetPosPixel() );
+ aMenuListBox.SetPosPixel( aMenuNameEdit.GetPosPixel() );
+
+ // reposition up and down buttons
+ p = aMoveUpButton.GetPosPixel();
+ newp = Point( p.X(), p.Y() - offset );
+ aMoveUpButton.SetPosPixel( newp );
+
+ p = aMoveDownButton.GetPosPixel();
+ newp = Point( p.X(), p.Y() - offset );
+ aMoveDownButton.SetPosPixel( newp );
+
+ // change size of dialog
+ s = GetSizePixel();
+ news = Size( s.Width(), s.Height() - offset );
+ SetSizePixel( news );
+
+ // hide name label and textfield
+ aMenuNameText.Hide();
+ aMenuNameEdit.Hide();
+
+ // change the title
+ SetText( SVX_RES( RID_SVXSTR_MOVE_MENU ) );
+ }
+
+ aMenuListBox.SetSelectHdl(
+ LINK( this, SvxMainMenuOrganizerDialog, SelectHdl ) );
+
+ aMoveUpButton.SetClickHdl (
+ LINK( this, SvxMainMenuOrganizerDialog, MoveHdl) );
+ aMoveDownButton.SetClickHdl (
+ LINK( this, SvxMainMenuOrganizerDialog, MoveHdl) );
+}
+
+IMPL_LINK(SvxMainMenuOrganizerDialog, ModifyHdl, Edit*, pEdit)
+{
+ (void)pEdit;
+
+ // if the Edit control is empty do not change the name
+ if ( aMenuNameEdit.GetText().Equals( String() ) )
+ {
+ return 0;
+ }
+
+ SvxConfigEntry* pNewEntryData =
+ (SvxConfigEntry*) pNewMenuEntry->GetUserData();
+
+ pNewEntryData->SetName( aMenuNameEdit.GetText() );
+
+ aMenuListBox.SetEntryText( pNewMenuEntry, pNewEntryData->GetName() );
+
+ return 0;
+}
+
+SvxMainMenuOrganizerDialog::~SvxMainMenuOrganizerDialog()
+{
+}
+
+IMPL_LINK( SvxMainMenuOrganizerDialog, SelectHdl, Control*, pCtrl )
+{
+ (void)pCtrl;
+ UpdateButtonStates();
+ return 1;
+}
+
+void SvxMainMenuOrganizerDialog::UpdateButtonStates()
+{
+ // Disable Up and Down buttons depending on current selection
+ SvLBoxEntry* selection = aMenuListBox.GetCurEntry();
+ SvLBoxEntry* first = aMenuListBox.First();
+ SvLBoxEntry* last = aMenuListBox.Last();
+
+ aMoveUpButton.Enable( selection != first );
+ aMoveDownButton.Enable( selection != last );
+}
+
+IMPL_LINK( SvxMainMenuOrganizerDialog, MoveHdl, Button *, pButton )
+{
+ SvLBoxEntry *pSourceEntry = aMenuListBox.FirstSelected();
+ SvLBoxEntry *pTargetEntry = NULL;
+
+ if ( !pSourceEntry )
+ {
+ return 0;
+ }
+
+ if ( pButton == &aMoveDownButton )
+ {
+ pTargetEntry = aMenuListBox.NextSibling( pSourceEntry );
+ }
+ else if ( pButton == &aMoveUpButton )
+ {
+ // Move Up is just a Move Down with the source and target reversed
+ pTargetEntry = pSourceEntry;
+ pSourceEntry = aMenuListBox.PrevSibling( pTargetEntry );
+ }
+
+ if ( pSourceEntry != NULL && pTargetEntry != NULL )
+ {
+ SvxConfigEntry* pSourceData =
+ (SvxConfigEntry*) pSourceEntry->GetUserData();
+ SvxConfigEntry* pTargetData =
+ (SvxConfigEntry*) pTargetEntry->GetUserData();
+
+ SvxEntries::iterator iter1 = GetEntries()->begin();
+ SvxEntries::iterator iter2 = GetEntries()->begin();
+ SvxEntries::const_iterator end = GetEntries()->end();
+
+ // Advance the iterators to the positions of the source and target
+ while (*iter1 != pSourceData && ++iter1 != end) ;
+ while (*iter2 != pTargetData && ++iter2 != end) ;
+
+ // Now swap the entries in the menu list and in the UI
+ if ( iter1 != end && iter2 != end )
+ {
+ std::swap( *iter1, *iter2 );
+ aMenuListBox.GetModel()->Move( pSourceEntry, pTargetEntry );
+ aMenuListBox.MakeVisible( pSourceEntry );
+
+ bModified = TRUE;
+ }
+ }
+
+ if ( bModified )
+ {
+ UpdateButtonStates();
+ }
+
+ return 0;
+}
+
+SvxEntries* SvxMainMenuOrganizerDialog::GetEntries()
+{
+ return pEntries;
+}
+
+SvxConfigEntry* SvxMainMenuOrganizerDialog::GetSelectedEntry()
+{
+ return (SvxConfigEntry*)aMenuListBox.FirstSelected()->GetUserData();
+}
+
+SvxConfigEntry::SvxConfigEntry(
+ const uno::Sequence< beans::PropertyValue >& rProperties,
+ const uno::Reference< container::XNameAccess >& rCommandToLabelMap )
+ :
+ nId( 1 ),
+ bPopUp( FALSE ),
+ bStrEdited( FALSE ),
+ bIsUserDefined( FALSE ),
+ bIsMain( FALSE ),
+ bIsParentData( FALSE ),
+ bIsVisible( TRUE ),
+ nStyle( 0 ),
+ pEntries( 0 )
+{
+ sal_uInt16 nType( css::ui::ItemType::DEFAULT );
+ OUString aHelpURL_;
+
+ for ( sal_Int32 i = 0; i < rProperties.getLength(); i++ )
+ {
+ if ( rProperties[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL ))
+ {
+ rProperties[i].Value >>= aCommand;
+ }
+ else if ( rProperties[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
+ {
+ rProperties[i].Value >>= aHelpURL_;
+ }
+ else if ( rProperties[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ))
+ {
+ rProperties[i].Value >>= aLabel;
+ }
+ else if ( rProperties[i].Name.equalsAscii( ITEM_DESCRIPTOR_TYPE ))
+ {
+ rProperties[i].Value >>= nType;
+ }
+ }
+
+ if ( nType == css::ui::ItemType::DEFAULT )
+ {
+ uno::Any a;
+ try
+ {
+ a = rCommandToLabelMap->getByName( aCommand );
+ bIsUserDefined = FALSE;
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ bIsUserDefined = TRUE;
+ }
+
+ // If custom label not set retrieve it from the command to info service
+ if ( aLabel.equals( OUString() ) )
+ {
+ uno::Sequence< beans::PropertyValue > aPropSeq;
+ if ( a >>= aPropSeq )
+ {
+ for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
+ {
+ if ( aPropSeq[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ) )
+ {
+ aPropSeq[i].Value >>= aLabel;
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+const OUString&
+SvxConfigEntry::GetHelpText()
+{
+ if ( aHelpText.getLength() == 0 )
+ {
+ OUString helpid = OUString::createFromAscii( "helpid:" );
+ if ( aHelpURL.indexOf( helpid ) != -1 )
+ {
+ aHelpURL = aHelpURL.copy( helpid.getLength() );
+ }
+
+ Help* pHelp = Application::GetHelp();
+ if ( aHelpURL.toInt32() != 0 )
+ {
+ aHelpText = pHelp->GetHelpText( aHelpURL.toInt32(), NULL );
+ }
+
+ if ( aHelpText.getLength() == 0 && aCommand.getLength() != 0 )
+ {
+ aHelpText = pHelp->GetHelpText( aCommand, NULL );
+ }
+ }
+
+ return aHelpText;
+}
+
+uno::Sequence< beans::PropertyValue >
+SvxConfigEntry::GetProperties(
+ const uno::Reference< container::XNameAccess >& rCommandToLabelMap )
+{
+ if ( IsSeparator() )
+ {
+ uno::Sequence< beans::PropertyValue > aPropSeq( 1 );
+
+ aPropSeq[0].Name = OUString(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ) );
+ aPropSeq[0].Value <<= css::ui::ItemType::SEPARATOR_LINE;
+
+ return aPropSeq;
+ }
+
+ static const OUString aDescriptorCommandURL (
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ) );
+
+ static const OUString aDescriptorType(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ) );
+
+ static const OUString aDescriptorLabel(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL ) );
+
+ static const OUString aDescriptorHelpURL(
+ RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL ) );
+
+ uno::Sequence< beans::PropertyValue > aPropSeq( 4 );
+
+ aPropSeq[0].Name = aDescriptorCommandURL;
+ aPropSeq[0].Value <<= rtl::OUString( GetCommand() );
+
+ aPropSeq[1].Name = aDescriptorType;
+ aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
+
+ // If the name has not been changed and the name is the same as
+ // in the default command to label map then the label can be stored
+ // as an empty string.
+ // It will be initialised again later using the command to label map.
+ aPropSeq[2].Name = aDescriptorLabel;
+ if ( HasChangedName() == FALSE && GetCommand().getLength() )
+ {
+ BOOL isDefaultName = FALSE;
+ try
+ {
+ uno::Any a( rCommandToLabelMap->getByName( GetCommand() ) );
+ uno::Sequence< beans::PropertyValue > tmpPropSeq;
+ if ( a >>= tmpPropSeq )
+ {
+ for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); i++ )
+ {
+ if ( tmpPropSeq[i].Name.equals( aDescriptorLabel ) )
+ {
+ OUString tmpLabel;
+ tmpPropSeq[i].Value >>= tmpLabel;
+
+ if ( tmpLabel.equals( GetName() ) )
+ {
+ isDefaultName = TRUE;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ // isDefaultName is left as FALSE
+ }
+
+ if ( isDefaultName )
+ {
+ aPropSeq[2].Value <<= rtl::OUString();
+ }
+ else
+ {
+ aPropSeq[2].Value <<= rtl::OUString( GetName() );
+ }
+ }
+ else
+ {
+ aPropSeq[2].Value <<= rtl::OUString( GetName() );
+ }
+
+ aPropSeq[3].Name = aDescriptorHelpURL;
+ aPropSeq[3].Value <<= rtl::OUString( GetHelpURL() );
+
+ return aPropSeq;
+}
+
+/*
+SvxMenuConfigEntry::SvxMenuConfigEntry(
+ const uno::Sequence< beans::PropertyValue >& rProperties,
+ const uno::Reference< container::XNameAccess >& rCommandToLabelMap )
+ :
+ SvxConfigEntry( rProperties, rCommandToLabelMap )
+{
+ uno::Reference< container::XIndexAccess > aChildren;
+
+ for ( sal_Int32 i = 0; i < rProperties.getLength(); i++ )
+ {
+ if ( rProperties[i].Name.equalsAscii( ITEM_DESCRIPTOR_CONTAINER ))
+ {
+ rProperties[i].Value >>= aChildren;
+ }
+ }
+
+ if ( aChildren.is() )
+ {
+ SetPopup( TRUE );
+ SetEntries( new SvxEntries() );
+
+ uno::Sequence< beans::PropertyValue > aProps;
+ for ( sal_Int32 i = 0; i < aChildren->getCount(); i++ )
+ {
+ if ( aChildren->getByIndex( i ) >>= aProps )
+ {
+ SvxConfigEntry* pEntry =
+ new SvxMenuConfigEntry( aProps, rCommandToLabelMap );
+ GetEntries()->push_back( pEntry );
+ }
+ }
+ }
+}
+*/
+
+SvxConfigEntry::SvxConfigEntry( const OUString& rDisplayName,
+ const OUString& rCommandURL, bool bPopup, bool bParentData )
+ : nId( 1 )
+ , aLabel(rDisplayName)
+ , aCommand(rCommandURL)
+ , bPopUp(bPopup)
+ , bStrEdited( FALSE )
+ , bIsUserDefined( FALSE )
+ , bIsMain( FALSE )
+ , bIsParentData( bParentData )
+ , bIsVisible( TRUE )
+ , nStyle( 0 )
+ , pEntries( 0 )
+{
+ if (bPopUp)
+ {
+ pEntries = new SvxEntries();
+ }
+}
+
+SvxConfigEntry::~SvxConfigEntry()
+{
+ if ( pEntries != NULL )
+ {
+ SvxEntries::const_iterator iter = pEntries->begin();
+
+ for ( ; iter != pEntries->end(); iter++ )
+ {
+ delete *iter;
+ }
+ delete pEntries;
+ }
+}
+
+bool SvxConfigEntry::IsMovable()
+{
+ if ( IsPopup() && !IsMain() )
+ {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+bool SvxConfigEntry::IsDeletable()
+{
+ if ( IsMain() && !IsUserDefined() )
+ {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+bool SvxConfigEntry::IsRenamable()
+{
+ if ( IsMain() && !IsUserDefined() )
+ {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+SvxToolbarConfigPage::SvxToolbarConfigPage(
+ Window *pParent, const SfxItemSet& rSet )
+ :
+ SvxConfigPage( pParent, rSet )
+{
+ SetHelpId( HID_SVX_CONFIG_TOOLBAR );
+
+ aContentsListBox = new SvxToolbarEntriesListBox(this, SVX_RES(BOX_ENTRIES));
+ FreeResource();
+ PositionContentsListBox();
+ aContentsListBox->SetZOrder( &aAddCommandsButton, WINDOW_ZORDER_BEFOR );
+
+ aContentsListBox->SetHelpId( HID_SVX_CONFIG_TOOLBAR_CONTENTS );
+ aNewTopLevelButton.SetHelpId( HID_SVX_NEW_TOOLBAR );
+ aModifyTopLevelButton.SetHelpId( HID_SVX_MODIFY_TOOLBAR );
+ aAddCommandsButton.SetHelpId( HID_SVX_NEW_TOOLBAR_ITEM );
+ aModifyCommandButton.SetHelpId( HID_SVX_MODIFY_TOOLBAR_ITEM );
+ aSaveInListBox.SetHelpId( HID_SVX_SAVE_IN );
+
+ aTopLevelSeparator.SetText(
+ SVX_RES ( RID_SVXSTR_PRODUCTNAME_TOOLBARS ) );
+
+ aTopLevelLabel.SetText( SVX_RES( RID_SVXSTR_TOOLBAR ) );
+ aModifyTopLevelButton.SetText( SVX_RES( RID_SVXSTR_TOOLBAR ) );
+ aContentsSeparator.SetText( SVX_RES( RID_SVXSTR_TOOLBAR_CONTENT ) );
+ aContentsLabel.SetText( SVX_RES( RID_SVXSTR_COMMANDS ) );
+
+ aTopLevelListBox.SetSelectHdl(
+ LINK( this, SvxToolbarConfigPage, SelectToolbar ) );
+ aContentsListBox->SetSelectHdl(
+ LINK( this, SvxToolbarConfigPage, SelectToolbarEntry ) );
+
+ aNewTopLevelButton.SetClickHdl (
+ LINK( this, SvxToolbarConfigPage, NewToolbarHdl ) );
+
+ aAddCommandsButton.SetClickHdl (
+ LINK( this, SvxToolbarConfigPage, AddCommandsHdl ) );
+
+ aMoveUpButton.SetClickHdl ( LINK( this, SvxToolbarConfigPage, MoveHdl) );
+ aMoveDownButton.SetClickHdl ( LINK( this, SvxToolbarConfigPage, MoveHdl) );
+ // Always enable Up and Down buttons
+ // added for issue i53677 by shizhoubo
+ aMoveDownButton.Enable( TRUE );
+ aMoveUpButton.Enable( TRUE );
+
+ PopupMenu* pMenu = new PopupMenu( SVX_RES( MODIFY_TOOLBAR ) );
+ pMenu->SetMenuFlags(
+ pMenu->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES );
+
+ aModifyTopLevelButton.SetPopupMenu( pMenu );
+ aModifyTopLevelButton.SetSelectHdl(
+ LINK( this, SvxToolbarConfigPage, ToolbarSelectHdl ) );
+
+ PopupMenu* pEntry = new PopupMenu(
+ SVX_RES( MODIFY_TOOLBAR_CONTENT ) );
+ pEntry->SetMenuFlags(
+ pEntry->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES );
+
+ aModifyCommandButton.SetPopupMenu( pEntry );
+ aModifyCommandButton.SetSelectHdl(
+ LINK( this, SvxToolbarConfigPage, EntrySelectHdl ) );
+
+ // default toolbar to select is standardbar unless a different one
+ // has been passed in
+ m_aURLToSelect = OUString::createFromAscii( ITEM_TOOLBAR_URL );
+ m_aURLToSelect += OUString::createFromAscii( "standardbar" );
+
+ const SfxPoolItem* pItem =
+ rSet.GetItem( rSet.GetPool()->GetWhich( SID_CONFIG ) );
+
+ if ( pItem )
+ {
+ OUString text = ((const SfxStringItem*)pItem)->GetValue();
+ if (text.indexOf(OUString::createFromAscii(ITEM_TOOLBAR_URL)) == 0)
+ {
+ m_aURLToSelect = text.copy( 0 );
+ }
+ }
+
+ long nTxtW = aTopLevelLabel.GetCtrlTextWidth( aTopLevelLabel.GetText() );
+ long nCtrlW = aTopLevelLabel.GetSizePixel().Width();
+ if ( nTxtW >= nCtrlW )
+ {
+ long nDelta = Max( (long)10, nTxtW - nCtrlW );
+ Size aNewSz = aTopLevelLabel.GetSizePixel();
+ aNewSz.Width() += nDelta;
+ aTopLevelLabel.SetSizePixel( aNewSz );
+ aNewSz = aTopLevelListBox.GetSizePixel();
+ aNewSz.Width() -= nDelta;
+ Point aNewPt = aTopLevelListBox.GetPosPixel();
+ aNewPt.X() += nDelta;
+ aTopLevelListBox.SetPosSizePixel( aNewPt, aNewSz );
+ }
+}
+
+SvxToolbarConfigPage::~SvxToolbarConfigPage()
+{
+ for ( USHORT i = 0 ; i < aSaveInListBox.GetEntryCount(); i++ )
+ {
+ ToolbarSaveInData* pData =
+ (ToolbarSaveInData*) aSaveInListBox.GetEntryData( i );
+
+ delete pData;
+ }
+
+ if ( pSelectorDlg != NULL )
+ {
+ delete pSelectorDlg;
+ }
+
+
+ delete aContentsListBox;
+}
+
+void SvxToolbarConfigPage::DeleteSelectedTopLevel()
+{
+ USHORT nSelectionPos = aTopLevelListBox.GetSelectEntryPos();
+ ToolbarSaveInData* pSaveInData = (ToolbarSaveInData*) GetSaveInData();
+ pSaveInData->RemoveToolbar( GetTopLevelSelection() );
+
+ if ( aTopLevelListBox.GetEntryCount() > 1 )
+ {
+ // select next entry after the one being deleted
+ // selection position is indexed from 0 so need to
+ // subtract one from the entry count
+ if ( nSelectionPos != aTopLevelListBox.GetEntryCount() - 1 )
+ {
+ aTopLevelListBox.SelectEntryPos( nSelectionPos + 1, TRUE );
+ }
+ else
+ {
+ aTopLevelListBox.SelectEntryPos( nSelectionPos - 1, TRUE );
+ }
+ aTopLevelListBox.GetSelectHdl().Call( this );
+
+ // and now remove the entry
+ aTopLevelListBox.RemoveEntry( nSelectionPos );
+ }
+ else
+ {
+ ReloadTopLevelListBox();
+ }
+}
+
+bool SvxToolbarConfigPage::DeleteSelectedContent()
+{
+ SvLBoxEntry *pActEntry = aContentsListBox->FirstSelected();
+
+ if ( pActEntry != NULL )
+ {
+ // get currently selected entry
+ SvxConfigEntry* pEntry =
+ (SvxConfigEntry*) pActEntry->GetUserData();
+
+ SvxConfigEntry* pToolbar = GetTopLevelSelection();
+
+ // remove entry from the list for this toolbar
+ RemoveEntry( pToolbar->GetEntries(), pEntry );
+
+ // remove toolbar entry from UI
+ aContentsListBox->GetModel()->Remove( pActEntry );
+
+ // delete data for toolbar entry
+ delete pEntry;
+
+ (( ToolbarSaveInData* ) GetSaveInData())->ApplyToolbar( pToolbar );
+ UpdateButtonStates();
+
+ // if this is the last entry in the toolbar and it is a user
+ // defined toolbar pop up a dialog asking the user if they
+ // want to delete the toolbar
+ if ( aContentsListBox->GetEntryCount() == 0 &&
+ GetTopLevelSelection()->IsDeletable() )
+ {
+ QueryBox qbox( this,
+ SVX_RES( QBX_CONFIRM_DELETE_TOOLBAR ) );
+
+ if ( qbox.Execute() == RET_YES )
+ {
+ DeleteSelectedTopLevel();
+ }
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+IMPL_LINK( SvxToolbarConfigPage, MoveHdl, Button *, pButton )
+{
+ MoveEntry( pButton == &aMoveUpButton );
+ return 0;
+}
+
+void SvxToolbarConfigPage::MoveEntry( bool bMoveUp )
+{
+ SvxConfigPage::MoveEntry( bMoveUp );
+
+ // Apply change to currently selected toolbar
+ SvxConfigEntry* pToolbar = GetTopLevelSelection();
+ if ( pToolbar )
+ ((ToolbarSaveInData*)GetSaveInData())->ApplyToolbar( pToolbar );
+ else
+ {
+ DBG_ERRORFILE( "SvxToolbarConfigPage::MoveEntry(): no entry" );
+ UpdateButtonStates();
+ }
+}
+
+IMPL_LINK( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton )
+{
+ USHORT nSelectionPos = aTopLevelListBox.GetSelectEntryPos();
+
+ SvxConfigEntry* pToolbar =
+ (SvxConfigEntry*)aTopLevelListBox.GetEntryData( nSelectionPos );
+
+ ToolbarSaveInData* pSaveInData = (ToolbarSaveInData*) GetSaveInData();
+
+ switch( pButton->GetCurItemId() )
+ {
+ case ID_DELETE:
+ {
+ DeleteSelectedTopLevel();
+ UpdateButtonStates();
+ break;
+ }
+ case ID_RENAME:
+ {
+ String aNewName( stripHotKey( pToolbar->GetName() ) );
+ String aDesc = SVX_RESSSTR( RID_SVXSTR_LABEL_NEW_NAME );
+
+ SvxNameDialog* pNameDialog = new SvxNameDialog( this, aNewName, aDesc );
+ pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_TOOLBAR );
+ pNameDialog->SetText( SVX_RESSTR( RID_SVXSTR_RENAME_TOOLBAR ) );
+
+ bool ret = pNameDialog->Execute();
+
+ if ( ret == RET_OK )
+ {
+ pNameDialog->GetName(aNewName);
+
+ pToolbar->SetName( aNewName );
+ pSaveInData->ApplyToolbar( pToolbar );
+
+ // have to use remove and insert to change the name
+ aTopLevelListBox.RemoveEntry( nSelectionPos );
+ nSelectionPos =
+ aTopLevelListBox.InsertEntry( aNewName, nSelectionPos );
+ aTopLevelListBox.SetEntryData( nSelectionPos, pToolbar );
+ aTopLevelListBox.SelectEntryPos( nSelectionPos );
+ }
+
+ delete pNameDialog;
+
+ break;
+ }
+ case ID_DEFAULT_STYLE:
+ {
+ QueryBox qbox( this,
+ SVX_RES( QBX_CONFIRM_RESTORE_DEFAULT ) );
+
+ if ( qbox.Execute() == RET_YES )
+ {
+ ToolbarSaveInData* pSaveInData_ =
+ (ToolbarSaveInData*) GetSaveInData();
+
+ pSaveInData_->RestoreToolbar( pToolbar );
+
+ aTopLevelListBox.GetSelectHdl().Call( this );
+ }
+
+ break;
+ }
+ case ID_ICONS_ONLY:
+ {
+ pToolbar->SetStyle( 0 );
+ pSaveInData->SetSystemStyle( m_xFrame, pToolbar->GetCommand(), 0 );
+
+ aTopLevelListBox.GetSelectHdl().Call( this );
+
+ break;
+ }
+ case ID_TEXT_ONLY:
+ {
+ pToolbar->SetStyle( 1 );
+ pSaveInData->SetSystemStyle( m_xFrame, pToolbar->GetCommand(), 1 );
+
+ aTopLevelListBox.GetSelectHdl().Call( this );
+
+ break;
+ }
+ case ID_ICONS_AND_TEXT:
+ {
+ pToolbar->SetStyle( 2 );
+ pSaveInData->SetSystemStyle( m_xFrame, pToolbar->GetCommand(), 2 );
+
+ aTopLevelListBox.GetSelectHdl().Call( this );
+
+ break;
+ }
+ }
+ return 1;
+}
+
+IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton )
+{
+ bool bNeedsApply = FALSE;
+
+ // get currently selected toolbar
+ SvxConfigEntry* pToolbar = GetTopLevelSelection();
+
+ switch( pButton->GetCurItemId() )
+ {
+ case ID_RENAME:
+ {
+ SvLBoxEntry* pActEntry = aContentsListBox->GetCurEntry();
+ SvxConfigEntry* pEntry =
+ (SvxConfigEntry*) pActEntry->GetUserData();
+
+ String aNewName( stripHotKey( pEntry->GetName() ) );
+ String aDesc = SVX_RESSSTR( RID_SVXSTR_LABEL_NEW_NAME );
+
+ SvxNameDialog* pNameDialog = new SvxNameDialog( this, aNewName, aDesc );
+ pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM );
+ pNameDialog->SetText( SVX_RESSTR( RID_SVXSTR_RENAME_TOOLBAR ) );
+
+ bool ret = pNameDialog->Execute();
+
+ if ( ret == RET_OK ) {
+ pNameDialog->GetName(aNewName);
+
+ pEntry->SetName( aNewName );
+ aContentsListBox->SetEntryText( pActEntry, aNewName );
+
+ bNeedsApply = TRUE;
+ }
+
+ delete pNameDialog;
+ break;
+ }
+ case ID_DEFAULT_COMMAND:
+ {
+ SvLBoxEntry* pActEntry = aContentsListBox->GetCurEntry();
+ SvxConfigEntry* pEntry =
+ (SvxConfigEntry*) pActEntry->GetUserData();
+
+ USHORT nSelectionPos = 0;
+
+ // find position of entry within the list
+ for ( USHORT i = 0; i < aContentsListBox->GetEntryCount(); i++ )
+ {
+ if ( aContentsListBox->GetEntry( 0, i ) == pActEntry )
+ {
+ nSelectionPos = i;
+ break;
+ }
+ }
+
+ ToolbarSaveInData* pSaveInData =
+ (ToolbarSaveInData*) GetSaveInData();
+
+ OUString aSystemName =
+ pSaveInData->GetSystemUIName( pEntry->GetCommand() );
+
+ if ( !pEntry->GetName().equals( aSystemName ) )
+ {
+ pEntry->SetName( aSystemName );
+ aContentsListBox->SetEntryText(
+ pActEntry, stripHotKey( aSystemName ) );
+ bNeedsApply = TRUE;
+ }
+
+ uno::Sequence< OUString > aURLSeq( 1 );
+ aURLSeq[ 0 ] = pEntry->GetCommand();
+
+ try
+ {
+ GetSaveInData()->GetImageManager()->removeImages(
+ GetImageType(), aURLSeq );
+
+ // reset backup in entry
+ pEntry->SetBackupGraphic(
+ uno::Reference< graphic::XGraphic >() );
+
+ GetSaveInData()->PersistChanges(
+ GetSaveInData()->GetImageManager() );
+
+ aContentsListBox->GetModel()->Remove( pActEntry );
+
+ SvLBoxEntry* pNewLBEntry =
+ InsertEntryIntoUI( pEntry, nSelectionPos );
+
+ aContentsListBox->SetCheckButtonState( pNewLBEntry,
+ pEntry->IsVisible() ?
+ SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED );
+
+ aContentsListBox->Select( pNewLBEntry );
+ aContentsListBox->MakeVisible( pNewLBEntry );
+
+ bNeedsApply = TRUE;
+ }
+ catch ( uno::Exception& )
+ {
+ OSL_TRACE("Error restoring image");
+ }
+ break;
+ }
+ case ID_BEGIN_GROUP:
+ {
+ SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
+ pNewEntryData->SetUserDefined( TRUE );
+
+ SvLBoxEntry* pNewLBEntry = InsertEntry( pNewEntryData );
+
+ aContentsListBox->SetCheckButtonState(
+ pNewLBEntry, SV_BUTTON_TRISTATE );
+
+ bNeedsApply = TRUE;
+ break;
+ }
+ case ID_DELETE:
+ {
+ DeleteSelectedContent();
+ break;
+ }
+ case ID_ICON_ONLY:
+ {
+ break;
+ }
+ case ID_TEXT_ONLY:
+ {
+ break;
+ }
+ case ID_ICON_AND_TEXT:
+ {
+ break;
+ }
+ case ID_CHANGE_SYMBOL:
+ {
+ SvLBoxEntry* pActEntry = aContentsListBox->GetCurEntry();
+ SvxConfigEntry* pEntry =
+ (SvxConfigEntry*) pActEntry->GetUserData();
+
+ USHORT nSelectionPos = 0;
+
+ // find position of entry within the list
+ for ( USHORT i = 0; i < aContentsListBox->GetEntryCount(); i++ )
+ {
+ if ( aContentsListBox->GetEntry( 0, i ) == pActEntry )
+ {
+ nSelectionPos = i;
+ break;
+ }
+ }
+
+ SvxIconSelectorDialog* pIconDialog =
+ new SvxIconSelectorDialog( 0,
+ GetSaveInData()->GetImageManager(),
+ GetSaveInData()->GetParentImageManager() );
+
+ bool ret = pIconDialog->Execute();
+
+ if ( ret == RET_OK )
+ {
+ uno::Reference< graphic::XGraphic > newgraphic =
+ pIconDialog->GetSelectedIcon();
+
+ if ( newgraphic.is() )
+ {
+ uno::Sequence< uno::Reference< graphic::XGraphic > >
+ aGraphicSeq( 1 );
+
+ uno::Sequence< OUString > aURLSeq( 1 );
+ aURLSeq[ 0 ] = pEntry->GetCommand();
+
+ if ( !pEntry->GetBackupGraphic().is() )
+ {
+ uno::Reference< graphic::XGraphic > backup;
+ backup = GetGraphic(
+ GetSaveInData()->GetImageManager(), aURLSeq[ 0 ] );
+
+ if ( backup.is() )
+ {
+ pEntry->SetBackupGraphic( backup );
+ }
+ }
+
+ aGraphicSeq[ 0 ] = newgraphic;
+ try
+ {
+ GetSaveInData()->GetImageManager()->replaceImages(
+ GetImageType(), aURLSeq, aGraphicSeq );
+
+ Image aImage( newgraphic );
+
+ aContentsListBox->GetModel()->Remove( pActEntry );
+ SvLBoxEntry* pNewLBEntry =
+ InsertEntryIntoUI( pEntry, nSelectionPos );
+
+ aContentsListBox->SetCheckButtonState( pNewLBEntry,
+ pEntry->IsVisible() ?
+ SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED );
+
+ aContentsListBox->Select( pNewLBEntry );
+ aContentsListBox->MakeVisible( pNewLBEntry );
+
+ GetSaveInData()->PersistChanges(
+ GetSaveInData()->GetImageManager() );
+ }
+ catch ( uno::Exception& )
+ {
+ OSL_TRACE("Error replacing image");
+ }
+ }
+ }
+
+ delete pIconDialog;
+
+ break;
+ }
+ case ID_RESET_SYMBOL:
+ {
+ SvLBoxEntry* pActEntry = aContentsListBox->GetCurEntry();
+ SvxConfigEntry* pEntry =
+ (SvxConfigEntry*) pActEntry->GetUserData();
+
+ USHORT nSelectionPos = 0;
+
+ // find position of entry within the list
+ for ( USHORT i = 0; i < aContentsListBox->GetEntryCount(); i++ )
+ {
+ if ( aContentsListBox->GetEntry( 0, i ) == pActEntry )
+ {
+ nSelectionPos = i;
+ break;
+ }
+ }
+
+ uno::Reference< graphic::XGraphic > backup =
+ pEntry->GetBackupGraphic();
+
+ uno::Sequence< uno::Reference< graphic::XGraphic > >
+ aGraphicSeq( 1 );
+ aGraphicSeq[ 0 ] = backup;
+
+ uno::Sequence< OUString > aURLSeq( 1 );
+ aURLSeq[ 0 ] = pEntry->GetCommand();
+
+ try
+ {
+ GetSaveInData()->GetImageManager()->replaceImages(
+ GetImageType(), aURLSeq, aGraphicSeq );
+
+ Image aImage( backup );
+ aContentsListBox->GetModel()->Remove( pActEntry );
+
+ SvLBoxEntry* pNewLBEntry =
+ InsertEntryIntoUI( pEntry, nSelectionPos );
+
+ aContentsListBox->SetCheckButtonState( pNewLBEntry,
+ pEntry->IsVisible() ?
+ SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED );
+
+ aContentsListBox->Select( pNewLBEntry );
+ aContentsListBox->MakeVisible( pNewLBEntry );
+
+ // reset backup in entry
+ pEntry->SetBackupGraphic(
+ uno::Reference< graphic::XGraphic >() );
+
+ GetSaveInData()->PersistChanges(
+ GetSaveInData()->GetImageManager() );
+ }
+ catch ( uno::Exception& )
+ {
+ OSL_TRACE("Error resetting image");
+ }
+ break;
+ }
+ }
+
+ if ( bNeedsApply == TRUE )
+ {
+ (( ToolbarSaveInData* ) GetSaveInData())->ApplyToolbar( pToolbar );
+ UpdateButtonStates();
+ }
+
+ return 1;
+}
+
+void SvxToolbarConfigPage::Init()
+{
+ // ensure that the UI is cleared before populating it
+ aTopLevelListBox.Clear();
+ aContentsListBox->Clear();
+
+ ReloadTopLevelListBox();
+
+ USHORT nPos = 0;
+ if ( m_aURLToSelect.getLength() != 0 )
+ {
+ for ( USHORT i = 0 ; i < aTopLevelListBox.GetEntryCount(); i++ )
+ {
+ SvxConfigEntry* pData =
+ (SvxConfigEntry*) aTopLevelListBox.GetEntryData( i );
+
+ if ( pData->GetCommand().equals( m_aURLToSelect ) )
+ {
+ nPos = i;
+ break;
+ }
+ }
+
+ // in future select the default toolbar: Standard
+ m_aURLToSelect = OUString::createFromAscii( ITEM_TOOLBAR_URL );
+ m_aURLToSelect += OUString::createFromAscii( "standardbar" );
+ }
+
+ aTopLevelListBox.SelectEntryPos(nPos, TRUE);
+ aTopLevelListBox.GetSelectHdl().Call(this);
+}
+
+SaveInData* SvxToolbarConfigPage::CreateSaveInData(
+ const uno::Reference< css::ui::XUIConfigurationManager >& xCfgMgr,
+ const uno::Reference< css::ui::XUIConfigurationManager >& xParentCfgMgr,
+ const OUString& aModuleId,
+ bool bDocConfig )
+{
+ return static_cast< SaveInData* >(
+ new ToolbarSaveInData( xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig ));
+}
+
+ToolbarSaveInData::ToolbarSaveInData(
+ const uno::Reference < css::ui::XUIConfigurationManager >& xCfgMgr,
+ const uno::Reference < css::ui::XUIConfigurationManager >& xParentCfgMgr,
+ const OUString& aModuleId,
+ bool docConfig ) :
+
+ SaveInData ( xCfgMgr, xParentCfgMgr, aModuleId, docConfig ),
+ pRootEntry ( NULL ),
+ m_aDescriptorContainer ( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ) )
+
+{
+ // Initialize the m_xPersistentWindowState variable which is used
+ // to get the default properties of system toolbars such as name
+ uno::Reference< container::XNameAccess > xPWSS(
+ m_xServiceManager->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.ui.WindowStateConfiguration" ) ) ),
+ uno::UNO_QUERY );
+
+ if ( xPWSS.is() )
+ xPWSS->getByName( aModuleId ) >>= m_xPersistentWindowState;
+}
+
+ToolbarSaveInData::~ToolbarSaveInData()
+{
+ delete pRootEntry;
+}
+
+void ToolbarSaveInData::SetSystemStyle(
+ uno::Reference< frame::XFrame > xFrame,
+ const OUString& rResourceURL,
+ sal_Int32 nStyle )
+{
+ // change the style using the API
+ SetSystemStyle( rResourceURL, nStyle );
+
+ // this code is a temporary hack as the UI is not updating after
+ // changing the toolbar style via the API
+ uno::Reference< css::frame::XLayoutManager > xLayoutManager;
+ Window *window = NULL;
+
+ uno::Reference< beans::XPropertySet > xPropSet( xFrame, uno::UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ uno::Any a = xPropSet->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) );
+ a >>= xLayoutManager;
+ }
+
+ if ( xLayoutManager.is() )
+ {
+ uno::Reference< css::ui::XUIElement > xUIElement =
+ xLayoutManager->getElement( rResourceURL );
+
+ // check reference before we call getRealInterface. The layout manager
+ // can only provide references for elements that have been created
+ // before. It's possible that the current element is not available.
+ uno::Reference< com::sun::star::awt::XWindow > xWindow;
+ if ( xUIElement.is() )
+ xWindow = uno::Reference< com::sun::star::awt::XWindow >(
+ xUIElement->getRealInterface(), uno::UNO_QUERY );
+
+ window = VCLUnoHelper::GetWindow( xWindow );
+ }
+
+ if ( window != NULL && window->GetType() == WINDOW_TOOLBOX )
+ {
+ ToolBox* toolbox = (ToolBox*)window;
+
+ if ( nStyle == 0 )
+ {
+ toolbox->SetButtonType( BUTTON_SYMBOL );
+ }
+ else if ( nStyle == 1 )
+ {
+ toolbox->SetButtonType( BUTTON_TEXT );
+ }
+ if ( nStyle == 2 )
+ {
+ toolbox->SetButtonType( BUTTON_SYMBOLTEXT );
+ }
+ }
+}
+
+void ToolbarSaveInData::SetSystemStyle(
+ const OUString& rResourceURL,
+ sal_Int32 nStyle )
+{
+ if ( rResourceURL.indexOf( OUString::createFromAscii( "private" ) ) == 0 &&
+ m_xPersistentWindowState.is() &&
+ m_xPersistentWindowState->hasByName( rResourceURL ) )
+ {
+ try
+ {
+ uno::Sequence< beans::PropertyValue > aProps;
+
+ uno::Any a( m_xPersistentWindowState->getByName( rResourceURL ) );
+
+ if ( a >>= aProps )
+ {
+ for ( sal_Int32 i = 0; i < aProps.getLength(); i++ )
+ {
+ if ( aProps[ i ].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE) )
+ {
+ aProps[ i ].Value = uno::makeAny( nStyle );
+ break;
+ }
+ }
+ }
+
+ uno::Reference< container::XNameReplace >
+ xNameReplace( m_xPersistentWindowState, uno::UNO_QUERY );
+
+ xNameReplace->replaceByName( rResourceURL, uno::makeAny( aProps ) );
+ }
+ catch ( uno::Exception& )
+ {
+ // do nothing, a default value is returned
+ OSL_TRACE("Exception setting toolbar style");
+ }
+ }
+}
+
+sal_Int32 ToolbarSaveInData::GetSystemStyle( const OUString& rResourceURL )
+{
+ sal_Int32 result = 0;
+
+ if ( rResourceURL.indexOf( OUString::createFromAscii( "private" ) ) == 0 &&
+ m_xPersistentWindowState.is() &&
+ m_xPersistentWindowState->hasByName( rResourceURL ) )
+ {
+ try
+ {
+ uno::Sequence< beans::PropertyValue > aProps;
+ uno::Any a( m_xPersistentWindowState->getByName( rResourceURL ) );
+
+ if ( a >>= aProps )
+ {
+ for ( sal_Int32 i = 0; i < aProps.getLength(); i++ )
+ {
+ if ( aProps[ i ].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE) )
+ {
+ aProps[i].Value >>= result;
+ break;
+ }
+ }
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ // do nothing, a default value is returned
+ }
+ }
+
+ return result;
+}
+
+OUString ToolbarSaveInData::GetSystemUIName( const OUString& rResourceURL )
+{
+ OUString result;
+
+ if ( rResourceURL.indexOf( OUString::createFromAscii( "private" ) ) == 0 &&
+ m_xPersistentWindowState.is() &&
+ m_xPersistentWindowState->hasByName( rResourceURL ) )
+ {
+ try
+ {
+ uno::Sequence< beans::PropertyValue > aProps;
+ uno::Any a( m_xPersistentWindowState->getByName( rResourceURL ) );
+
+ if ( a >>= aProps )
+ {
+ for ( sal_Int32 i = 0; i < aProps.getLength(); i++ )
+ {
+ if ( aProps[ i ].Name.equalsAscii( ITEM_DESCRIPTOR_UINAME) )
+ {
+ aProps[ i ].Value >>= result;
+ }
+ }
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ // do nothing, an empty UIName will be returned
+ }
+ }
+
+ if ( rResourceURL.indexOf( OUString::createFromAscii( ".uno" ) ) == 0 &&
+ m_xCommandToLabelMap.is() &&
+ m_xCommandToLabelMap->hasByName( rResourceURL ) )
+ {
+ uno::Any a;
+ try
+ {
+ a = m_xCommandToLabelMap->getByName( rResourceURL );
+
+ uno::Sequence< beans::PropertyValue > aPropSeq;
+ if ( a >>= aPropSeq )
+ {
+ for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
+ {
+ if ( aPropSeq[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ) )
+ {
+ aPropSeq[i].Value >>= result;
+ }
+ }
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ // not a system command name
+ }
+ }
+
+ return result;
+}
+
+bool EntrySort( SvxConfigEntry* a, SvxConfigEntry* b )
+{
+ return a->GetName().compareTo( b->GetName() ) < 0;
+}
+
+SvxEntries* ToolbarSaveInData::GetEntries()
+{
+ typedef ::std::hash_map< ::rtl::OUString,
+ bool,
+ ::rtl::OUStringHash,
+ ::std::equal_to< ::rtl::OUString > > ToolbarInfo;
+
+ ToolbarInfo aToolbarInfo;
+
+ if ( pRootEntry == NULL )
+ {
+
+ pRootEntry = new SvxConfigEntry(
+ String::CreateFromAscii("MainToolbars"), String(), TRUE );
+
+ uno::Sequence< uno::Sequence < beans::PropertyValue > > info =
+ GetConfigManager()->getUIElementsInfo(
+ css::ui::UIElementType::TOOLBAR );
+
+ for ( sal_Int32 i = 0; i < info.getLength(); i++ )
+ {
+ uno::Sequence< beans::PropertyValue > props = info[ i ];
+
+ OUString url;
+ OUString systemname;
+ OUString uiname;
+
+ for ( sal_Int32 j = 0; j < props.getLength(); j++ )
+ {
+ if ( props[ j ].Name.equalsAscii( ITEM_DESCRIPTOR_RESOURCEURL) )
+ {
+ props[ j ].Value >>= url;
+ systemname = url.copy( url.lastIndexOf( '/' ) + 1 );
+ }
+ else if ( props[ j ].Name.equalsAscii( ITEM_DESCRIPTOR_UINAME) )
+ {
+ props[ j ].Value >>= uiname;
+ }
+ }
+
+ try
+ {
+ uno::Reference< container::XIndexAccess > xToolbarSettings =
+ GetConfigManager()->getSettings( url, sal_False );
+
+ if ( uiname.getLength() == 0 )
+ {
+ // try to get the name from m_xPersistentWindowState
+ uiname = GetSystemUIName( url );
+
+ if ( uiname.getLength() == 0 )
+ {
+ uiname = systemname;
+ }
+ }
+
+ SvxConfigEntry* pEntry = new SvxConfigEntry(
+ uiname, url, TRUE );
+
+ pEntry->SetMain( TRUE );
+ pEntry->SetStyle( GetSystemStyle( url ) );
+
+
+ // insert into hash_map to filter duplicates from the parent
+ aToolbarInfo.insert( ToolbarInfo::value_type( systemname, true ));
+
+ OUString custom = OUString::createFromAscii(CUSTOM_TOOLBAR_STR);
+ if ( systemname.indexOf( custom ) == 0 )
+ {
+ pEntry->SetUserDefined( TRUE );
+ }
+ else
+ {
+ pEntry->SetUserDefined( FALSE );
+ }
+
+ pRootEntry->GetEntries()->push_back( pEntry );
+
+ LoadToolbar( xToolbarSettings, pEntry );
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ // TODO, handle resourceURL with no settings
+ }
+ }
+
+ uno::Reference< css::ui::XUIConfigurationManager > xParentCfgMgr = GetParentConfigManager();
+ if ( xParentCfgMgr.is() )
+ {
+ // Retrieve also the parent toolbars to make it possible
+ // to configure module toolbars and save them into the document
+ // config manager.
+ uno::Sequence< uno::Sequence < beans::PropertyValue > > info_ =
+ xParentCfgMgr->getUIElementsInfo(
+ css::ui::UIElementType::TOOLBAR );
+
+ for ( sal_Int32 i = 0; i < info_.getLength(); i++ )
+ {
+ uno::Sequence< beans::PropertyValue > props = info_[ i ];
+
+ OUString url;
+ OUString systemname;
+ OUString uiname;
+
+ for ( sal_Int32 j = 0; j < props.getLength(); j++ )
+ {
+ if ( props[ j ].Name.equalsAscii( ITEM_DESCRIPTOR_RESOURCEURL) )
+ {
+ props[ j ].Value >>= url;
+ systemname = url.copy( url.lastIndexOf( '/' ) + 1 );
+ }
+ else if ( props[ j ].Name.equalsAscii( ITEM_DESCRIPTOR_UINAME) )
+ {
+ props[ j ].Value >>= uiname;
+ }
+ }
+
+ // custom toolbars of the parent are not visible in the document layer
+ OUString custom = OUString::createFromAscii(CUSTOM_TOOLBAR_STR);
+ if ( systemname.indexOf( custom ) == 0 )
+ continue;
+
+ // check if toolbar is already in the document layer
+ ToolbarInfo::const_iterator pIter = aToolbarInfo.find( systemname );
+ if ( pIter == aToolbarInfo.end() )
+ {
+ aToolbarInfo.insert( ToolbarInfo::value_type( systemname, true ));
+
+ try
+ {
+ uno::Reference< container::XIndexAccess > xToolbarSettings =
+ xParentCfgMgr->getSettings( url, sal_False );
+
+ if ( uiname.getLength() == 0 )
+ {
+ // try to get the name from m_xPersistentWindowState
+ uiname = GetSystemUIName( url );
+
+ if ( uiname.getLength() == 0 )
+ {
+ uiname = systemname;
+ }
+ }
+
+ SvxConfigEntry* pEntry = new SvxConfigEntry(
+ uiname, url, TRUE, TRUE );
+
+ pEntry->SetMain( TRUE );
+ pEntry->SetStyle( GetSystemStyle( url ) );
+
+ if ( systemname.indexOf( custom ) == 0 )
+ {
+ pEntry->SetUserDefined( TRUE );
+ }
+ else
+ {
+ pEntry->SetUserDefined( FALSE );
+ }
+
+ pRootEntry->GetEntries()->push_back( pEntry );
+
+ LoadToolbar( xToolbarSettings, pEntry );
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ // TODO, handle resourceURL with no settings
+ }
+ }
+ }
+ }
+
+ std::sort( GetEntries()->begin(), GetEntries()->end(), EntrySort );
+ }
+
+ return pRootEntry->GetEntries();
+}
+
+void
+ToolbarSaveInData::SetEntries( SvxEntries* pNewEntries )
+{
+ // delete old menu hierarchy first
+ if ( pRootEntry != NULL && pRootEntry->GetEntries() != NULL )
+ {
+ delete pRootEntry->GetEntries();
+ }
+
+ // now set new menu hierarchy
+ pRootEntry->SetEntries( pNewEntries );
+}
+
+bool
+ToolbarSaveInData::HasURL( const OUString& rURL )
+{
+ SvxEntries::const_iterator iter = GetEntries()->begin();
+ SvxEntries::const_iterator end = GetEntries()->end();
+
+ while ( iter != end )
+ {
+ SvxConfigEntry* pEntry = *iter;
+
+ if ( pEntry->GetCommand().equals( rURL ) )
+ {
+ if ( pEntry->IsParentData() )
+ return FALSE;
+ else
+ return TRUE;
+ }
+
+ iter++;
+ }
+ return FALSE;
+}
+
+bool ToolbarSaveInData::HasSettings()
+{
+ // return true if there is at least one toolbar entry
+ if ( GetEntries()->size() > 0 )
+ {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void ToolbarSaveInData::Reset()
+{
+ SvxEntries::const_iterator toolbars = GetEntries()->begin();
+ SvxEntries::const_iterator end = GetEntries()->end();
+
+ // reset each toolbar by calling removeSettings for it's toolbar URL
+ for ( ; toolbars != end; toolbars++ )
+ {
+ SvxConfigEntry* pToolbar = *toolbars;
+
+ try
+ {
+ OUString url = pToolbar->GetCommand();
+ GetConfigManager()->removeSettings( url );
+ }
+ catch ( uno::Exception& )
+ {
+ // error occured removing the settings
+ // TODO - add error dialog in future?
+ }
+ }
+
+ // persist changes to toolbar storage
+ PersistChanges( GetConfigManager() );
+
+ // now delete the root SvxConfigEntry the next call to GetEntries()
+ // causes it to be reinitialised
+ delete pRootEntry;
+ pRootEntry = NULL;
+
+ // reset all icons to default
+ try
+ {
+ GetImageManager()->reset();
+ PersistChanges( GetImageManager() );
+ }
+ catch ( uno::Exception& )
+ {
+ OSL_TRACE("Error resetting all icons when resetting toolbars");
+ }
+}
+
+bool ToolbarSaveInData::Apply()
+{
+ // toolbar changes are instantly applied
+ return FALSE;
+}
+
+void ToolbarSaveInData::ApplyToolbar(
+ uno::Reference< container::XIndexContainer >& rToolbarBar,
+ uno::Reference< lang::XSingleComponentFactory >& rFactory,
+ SvxConfigEntry* pToolbarData )
+{
+ SvxEntries::const_iterator iter = pToolbarData->GetEntries()->begin();
+ SvxEntries::const_iterator end = pToolbarData->GetEntries()->end();
+
+ for ( ; iter != end; iter++ )
+ {
+ SvxConfigEntry* pEntry = *iter;
+
+ if ( pEntry->IsPopup() )
+ {
+ uno::Sequence< beans::PropertyValue > aPropValueSeq =
+ ConvertToolbarEntry( m_xCommandToLabelMap, pEntry );
+
+ uno::Reference< container::XIndexContainer > xSubMenuBar(
+ rFactory->createInstanceWithContext( m_xComponentContext ),
+ uno::UNO_QUERY );
+
+ sal_Int32 nIndex = aPropValueSeq.getLength();
+ aPropValueSeq.realloc( nIndex + 1 );
+ aPropValueSeq[nIndex].Name = m_aDescriptorContainer;
+ aPropValueSeq[nIndex].Value <<= xSubMenuBar;
+ rToolbarBar->insertByIndex(
+ rToolbarBar->getCount(), uno::makeAny( aPropValueSeq ));
+
+ ApplyToolbar( xSubMenuBar, rFactory, pEntry );
+ }
+ else if ( pEntry->IsSeparator() )
+ {
+ rToolbarBar->insertByIndex(
+ rToolbarBar->getCount(), uno::makeAny( m_aSeparatorSeq ));
+ }
+ else
+ {
+ uno::Sequence< beans::PropertyValue > aPropValueSeq =
+ ConvertToolbarEntry( m_xCommandToLabelMap, pEntry );
+
+ rToolbarBar->insertByIndex(
+ rToolbarBar->getCount(), uno::makeAny( aPropValueSeq ));
+ }
+ }
+}
+
+void ToolbarSaveInData::ApplyToolbar( SvxConfigEntry* pToolbar )
+{
+ // Apply new toolbar structure to our settings container
+ uno::Reference< container::XIndexAccess > xSettings(
+ GetConfigManager()->createSettings(), uno::UNO_QUERY );
+
+ uno::Reference< container::XIndexContainer > xIndexContainer (
+ xSettings, uno::UNO_QUERY );
+
+ uno::Reference< lang::XSingleComponentFactory > xFactory (
+ xSettings, uno::UNO_QUERY );
+
+ ApplyToolbar( xIndexContainer, xFactory, pToolbar );
+
+ uno::Reference< beans::XPropertySet > xProps(
+ xSettings, uno::UNO_QUERY );
+
+ if ( pToolbar->IsUserDefined() )
+ {
+ xProps->setPropertyValue(
+ OUString::createFromAscii( ITEM_DESCRIPTOR_UINAME ),
+ uno::makeAny( OUString( pToolbar->GetName() ) ) );
+ }
+
+ try
+ {
+ if ( GetConfigManager()->hasSettings( pToolbar->GetCommand() ) )
+ {
+ GetConfigManager()->replaceSettings(
+ pToolbar->GetCommand(), xSettings );
+ }
+ else
+ {
+ GetConfigManager()->insertSettings(
+ pToolbar->GetCommand(), xSettings );
+ if ( pToolbar->IsParentData() )
+ pToolbar->SetParentData( false );
+ }
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ OSL_TRACE("caught container::NoSuchElementException saving settings");
+ }
+ catch ( com::sun::star::io::IOException& )
+ {
+ OSL_TRACE("caught IOException saving settings");
+ }
+ catch ( com::sun::star::uno::Exception& )
+ {
+ OSL_TRACE("caught some other exception saving settings");
+ }
+
+ PersistChanges( GetConfigManager() );
+}
+
+void ToolbarSaveInData::CreateToolbar( SvxConfigEntry* pToolbar )
+{
+ // show the new toolbar in the UI also
+ uno::Reference< container::XIndexAccess >
+ xSettings( GetConfigManager()->createSettings(), uno::UNO_QUERY );
+
+ uno::Reference< container::XIndexContainer >
+ xIndexContainer ( xSettings, uno::UNO_QUERY );
+
+ uno::Reference< beans::XPropertySet >
+ xPropertySet( xSettings, uno::UNO_QUERY );
+
+ xPropertySet->setPropertyValue(
+ OUString::createFromAscii( ITEM_DESCRIPTOR_UINAME ),
+ uno::makeAny( pToolbar->GetName() ) );
+
+ try
+ {
+ GetConfigManager()->insertSettings( pToolbar->GetCommand(), xSettings );
+ }
+ catch ( container::ElementExistException& )
+ {
+ OSL_TRACE("caught ElementExistsException saving settings");
+ }
+ catch ( com::sun::star::lang::IllegalArgumentException& )
+ {
+ OSL_TRACE("caught IOException saving settings");
+ }
+ catch ( com::sun::star::lang::IllegalAccessException& )
+ {
+ OSL_TRACE("caught IOException saving settings");
+ }
+ catch ( com::sun::star::uno::Exception& )
+ {
+ OSL_TRACE("caught some other exception saving settings");
+ }
+
+ GetEntries()->push_back( pToolbar );
+
+ PersistChanges( GetConfigManager() );
+}
+
+void ToolbarSaveInData::RemoveToolbar( SvxConfigEntry* pToolbar )
+{
+ try
+ {
+ OUString url = pToolbar->GetCommand();
+ GetConfigManager()->removeSettings( url );
+ RemoveEntry( GetEntries(), pToolbar );
+ delete pToolbar;
+
+ PersistChanges( GetConfigManager() );
+
+ // remove the persistent window state data
+ css::uno::Reference< css::container::XNameContainer > xNameContainer(
+ m_xPersistentWindowState, css::uno::UNO_QUERY_THROW );
+
+ xNameContainer->removeByName( url );
+ }
+ catch ( uno::Exception& )
+ {
+ // error occured removing the settings
+ }
+}
+
+void ToolbarSaveInData::RestoreToolbar( SvxConfigEntry* pToolbar )
+{
+ OUString url = pToolbar->GetCommand();
+
+ // Restore of toolbar is done by removing it from
+ // it's configuration manager and then getting it again
+ bool bParentToolbar = pToolbar->IsParentData();
+
+ // Cannot restore parent toolbar
+ if ( bParentToolbar )
+ return;
+
+ try
+ {
+ GetConfigManager()->removeSettings( url );
+ pToolbar->GetEntries()->clear();
+ PersistChanges( GetConfigManager() );
+ }
+ catch ( uno::Exception& )
+ {
+ // if an error occurs removing the settings then just return
+ return;
+ }
+
+ // Now reload the toolbar settings
+ try
+ {
+ uno::Reference< container::XIndexAccess > xToolbarSettings;
+ if ( IsDocConfig() )
+ {
+ xToolbarSettings = GetParentConfigManager()->getSettings( url, sal_False );
+ pToolbar->SetParentData( true );
+ }
+ else
+ xToolbarSettings = GetConfigManager()->getSettings( url, sal_False );
+
+ LoadToolbar( xToolbarSettings, pToolbar );
+
+ // After reloading, ensure that the icon is reset of each entry
+ // in the toolbar
+ SvxEntries::const_iterator iter = pToolbar->GetEntries()->begin();
+ uno::Sequence< OUString > aURLSeq( 1 );
+ for ( ; iter != pToolbar->GetEntries()->end(); iter++ )
+ {
+ SvxConfigEntry* pEntry = *iter;
+ aURLSeq[ 0 ] = pEntry->GetCommand();
+
+ try
+ {
+ GetImageManager()->removeImages( GetImageType(), aURLSeq );
+ }
+ catch ( uno::Exception& )
+ {
+ OSL_TRACE("Error restoring icon when resetting toolbar");
+ }
+ }
+ PersistChanges( GetImageManager() );
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ // cannot find the resource URL after removing it
+ // so no entry will appear in the toolbar list
+ }
+}
+
+void ToolbarSaveInData::ReloadToolbar( const OUString& rResourceURL )
+{
+ SvxEntries::const_iterator iter = GetEntries()->begin();
+ SvxConfigEntry* pToolbar = NULL;
+
+ for ( ; iter != GetEntries()->end(); iter++ )
+ {
+ SvxConfigEntry* pEntry = *iter;
+
+ if ( pEntry->GetCommand().equals( rResourceURL ) )
+ {
+ pToolbar = pEntry;
+ break;
+ }
+ }
+
+ if ( pToolbar != NULL )
+ {
+ delete pToolbar->GetEntries();
+
+ try
+ {
+ uno::Reference< container::XIndexAccess > xToolbarSettings;
+
+ if ( pToolbar->IsParentData() )
+ {
+ xToolbarSettings = GetParentConfigManager()->getSettings(
+ pToolbar->GetCommand(), sal_False);
+ }
+ else
+ {
+ xToolbarSettings = GetConfigManager()->getSettings(
+ pToolbar->GetCommand(), sal_False);
+ }
+
+ LoadToolbar( xToolbarSettings, pToolbar );
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ // toolbar not found for some reason
+ // it will not appear in the toolbar list
+ }
+ }
+}
+
+bool ToolbarSaveInData::LoadToolbar(
+ const uno::Reference< container::XIndexAccess >& xToolbarSettings,
+ SvxConfigEntry* pParentData )
+{
+ SvxEntries* pEntries = pParentData->GetEntries();
+
+ for ( sal_Int32 nIndex = 0; nIndex < xToolbarSettings->getCount(); nIndex++ )
+ {
+ uno::Reference< container::XIndexAccess > xSubMenu;
+ OUString aCommandURL;
+ OUString aHelpURL;
+ OUString aLabel;
+ bool bIsUserDefined = TRUE;
+ sal_Bool bIsVisible;
+ sal_Int32 nStyle;
+
+ sal_uInt16 nType( css::ui::ItemType::DEFAULT );
+
+ bool bItem = GetToolbarItemData( xToolbarSettings, nIndex, aCommandURL,
+ aHelpURL, aLabel, nType, bIsVisible, nStyle, xSubMenu );
+
+ if ( bItem )
+ {
+ if ( nType == css::ui::ItemType::DEFAULT )
+ {
+ uno::Any a;
+ try
+ {
+ a = m_xCommandToLabelMap->getByName( aCommandURL );
+ bIsUserDefined = FALSE;
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ bIsUserDefined = TRUE;
+ }
+
+ // If custom label not set retrieve it from the command
+ // to info service
+ if ( aLabel.equals( OUString() ) )
+ {
+ uno::Sequence< beans::PropertyValue > aPropSeq;
+ if ( a >>= aPropSeq )
+ {
+ for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
+ {
+ if ( aPropSeq[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ) )
+ {
+ aPropSeq[i].Value >>= aLabel;
+ break;
+ }
+ }
+ }
+ }
+
+ if ( xSubMenu.is() )
+ {
+ SvxConfigEntry* pEntry = new SvxConfigEntry(
+ aLabel, aCommandURL, TRUE );
+
+ pEntry->SetUserDefined( bIsUserDefined );
+ pEntry->SetHelpURL( aHelpURL );
+ pEntry->SetVisible( bIsVisible );
+
+ pEntries->push_back( pEntry );
+
+ LoadToolbar( xSubMenu, pEntry );
+ }
+ else
+ {
+ SvxConfigEntry* pEntry = new SvxConfigEntry(
+ aLabel, aCommandURL, FALSE );
+ pEntry->SetUserDefined( bIsUserDefined );
+ pEntry->SetHelpURL( aHelpURL );
+ pEntry->SetVisible( bIsVisible );
+ pEntry->SetStyle( nStyle );
+ pEntries->push_back( pEntry );
+ }
+ }
+ else
+ {
+ SvxConfigEntry* pEntry = new SvxConfigEntry;
+ pEntry->SetUserDefined( bIsUserDefined );
+ pEntries->push_back( pEntry );
+ }
+ }
+ }
+
+ return true;
+}
+
+IMPL_LINK( SvxToolbarConfigPage, SelectToolbarEntry, Control *, pBox )
+{
+ (void)pBox;
+ UpdateButtonStates();
+ return 1;
+}
+
+void SvxToolbarConfigPage::UpdateButtonStates()
+{
+ PopupMenu* pPopup = aModifyCommandButton.GetPopupMenu();
+ pPopup->EnableItem( ID_RENAME, FALSE );
+ pPopup->EnableItem( ID_DELETE, FALSE );
+ pPopup->EnableItem( ID_BEGIN_GROUP, FALSE );
+ pPopup->EnableItem( ID_DEFAULT_COMMAND, FALSE );
+ pPopup->EnableItem( ID_ICON_ONLY, FALSE );
+ pPopup->EnableItem( ID_ICON_AND_TEXT, FALSE );
+ pPopup->EnableItem( ID_TEXT_ONLY, FALSE );
+ pPopup->EnableItem( ID_CHANGE_SYMBOL, FALSE );
+ pPopup->EnableItem( ID_RESET_SYMBOL, FALSE );
+
+ aDescriptionField.Clear();
+
+ SvLBoxEntry* selection = aContentsListBox->GetCurEntry();
+ if ( aContentsListBox->GetEntryCount() == 0 || selection == NULL )
+ {
+ return;
+ }
+
+ SvxConfigEntry* pEntryData = (SvxConfigEntry*) selection->GetUserData();
+ if ( pEntryData->IsSeparator() )
+ pPopup->EnableItem( ID_DELETE, TRUE );
+ else
+ {
+ pPopup->EnableItem( ID_BEGIN_GROUP, TRUE );
+ pPopup->EnableItem( ID_DELETE, TRUE );
+ pPopup->EnableItem( ID_RENAME, TRUE );
+ pPopup->EnableItem( ID_ICON_ONLY, TRUE );
+ pPopup->EnableItem( ID_ICON_AND_TEXT, TRUE );
+ pPopup->EnableItem( ID_TEXT_ONLY, TRUE );
+ pPopup->EnableItem( ID_CHANGE_SYMBOL, TRUE );
+
+ if ( !pEntryData->IsUserDefined() )
+ pPopup->EnableItem( ID_DEFAULT_COMMAND, TRUE );
+
+ if ( pEntryData->IsIconModified() )
+ pPopup->EnableItem( ID_RESET_SYMBOL, TRUE );
+
+ aDescriptionField.SetNewText( pEntryData->GetHelpText() );
+ }
+}
+
+short SvxToolbarConfigPage::QueryReset()
+{
+ String msg =
+ String( SVX_RES( RID_SVXSTR_CONFIRM_TOOLBAR_RESET ) );
+
+ String saveInName = aSaveInListBox.GetEntry(
+ aSaveInListBox.GetSelectEntryPos() );
+
+ OUString label = replaceSaveInName( msg, saveInName );
+
+ QueryBox qbox( this, WB_YES_NO, label );
+
+ return qbox.Execute();
+}
+
+IMPL_LINK( SvxToolbarConfigPage, SelectToolbar, ListBox *, pBox )
+{
+ (void)pBox;
+
+ aContentsListBox->Clear();
+
+ SvxConfigEntry* pToolbar = GetTopLevelSelection();
+ if ( pToolbar == NULL )
+ {
+ aModifyTopLevelButton.Enable( FALSE );
+ aModifyCommandButton.Enable( FALSE );
+ aAddCommandsButton.Enable( FALSE );
+
+ return 0;
+ }
+
+ aModifyTopLevelButton.Enable( TRUE );
+ aModifyCommandButton.Enable( TRUE );
+ aAddCommandsButton.Enable( TRUE );
+
+ PopupMenu* pPopup = aModifyTopLevelButton.GetPopupMenu();
+
+ pPopup->EnableItem( ID_DELETE, pToolbar->IsDeletable() );
+ pPopup->EnableItem( ID_RENAME, pToolbar->IsRenamable() );
+ pPopup->EnableItem( ID_DEFAULT_STYLE, !pToolbar->IsRenamable() );
+
+ switch( pToolbar->GetStyle() )
+ {
+ case 0:
+ {
+ pPopup->CheckItem( ID_ICONS_ONLY );
+ break;
+ }
+ case 1:
+ {
+ pPopup->CheckItem( ID_TEXT_ONLY );
+ break;
+ }
+ case 2:
+ {
+ pPopup->CheckItem( ID_ICONS_AND_TEXT );
+ break;
+ }
+ }
+
+ SvxEntries* pEntries = pToolbar->GetEntries();
+ SvxEntries::const_iterator iter = pEntries->begin();
+
+ for ( ; iter != pEntries->end(); iter++ )
+ {
+ SvxConfigEntry* pEntry = *iter;
+
+ SvLBoxEntry* pNewLBEntry = InsertEntryIntoUI( pEntry );
+
+ if (pEntry->IsBinding())
+ {
+ aContentsListBox->SetCheckButtonState( pNewLBEntry,
+ pEntry->IsVisible() ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED );
+ }
+ else
+ {
+ aContentsListBox->SetCheckButtonState(
+ pNewLBEntry, SV_BUTTON_TRISTATE );
+ }
+ }
+
+ UpdateButtonStates();
+
+ return 0;
+}
+
+IMPL_LINK( SvxToolbarConfigPage, NewToolbarHdl, Button *, pButton )
+{
+ (void)pButton;
+
+ String prefix =
+ String( SVX_RES( RID_SVXSTR_NEW_TOOLBAR ) );
+
+ OUString aNewName =
+ generateCustomName( prefix, GetSaveInData()->GetEntries() );
+
+ OUString aNewURL =
+ generateCustomURL( GetSaveInData()->GetEntries() );
+
+ SvxNewToolbarDialog* pNameDialog = new SvxNewToolbarDialog( 0, aNewName );
+
+ USHORT nInsertPos;
+ for ( USHORT i = 0 ; i < aSaveInListBox.GetEntryCount(); i++ )
+ {
+ SaveInData* pData =
+ (SaveInData*) aSaveInListBox.GetEntryData( i );
+
+ nInsertPos = pNameDialog->aSaveInListBox.InsertEntry(
+ aSaveInListBox.GetEntry( i ) );
+
+ pNameDialog->aSaveInListBox.SetEntryData( nInsertPos, pData );
+ }
+
+ pNameDialog->aSaveInListBox.SelectEntryPos(
+ aSaveInListBox.GetSelectEntryPos(), TRUE );
+
+ bool ret = pNameDialog->Execute();
+ if ( ret == RET_OK )
+ {
+ pNameDialog->GetName( aNewName );
+
+ nInsertPos = pNameDialog->aSaveInListBox.GetSelectEntryPos();
+
+ ToolbarSaveInData* pData = (ToolbarSaveInData*)
+ pNameDialog->aSaveInListBox.GetEntryData( nInsertPos );
+
+ if ( GetSaveInData() != pData )
+ {
+ aSaveInListBox.SelectEntryPos( nInsertPos, TRUE );
+ aSaveInListBox.GetSelectHdl().Call(this);
+ }
+
+ SvxConfigEntry* pToolbar =
+ new SvxConfigEntry( aNewName, aNewURL, TRUE );
+
+ pToolbar->SetUserDefined( TRUE );
+ pToolbar->SetMain( TRUE );
+
+ pData->CreateToolbar( pToolbar );
+
+ nInsertPos = aTopLevelListBox.InsertEntry( pToolbar->GetName() );
+ aTopLevelListBox.SetEntryData( nInsertPos, pToolbar );
+ aTopLevelListBox.SelectEntryPos( nInsertPos, TRUE );
+ aTopLevelListBox.GetSelectHdl().Call(this);
+
+ pData->SetModified( TRUE );
+ }
+
+ delete pNameDialog;
+
+ return 0;
+}
+
+IMPL_LINK( SvxToolbarConfigPage, AddCommandsHdl, Button *, pButton )
+{
+ (void)pButton;
+
+ if ( pSelectorDlg == NULL )
+ {
+ // Create Script Selector which shows slot commands
+ pSelectorDlg = new SvxScriptSelectorDialog( this, TRUE, m_xFrame );
+
+ // Position the Script Selector over the Add button so it is
+ // beside the menu contents list and does not obscure it
+ pSelectorDlg->SetPosPixel( aAddCommandsButton.GetPosPixel() );
+
+ pSelectorDlg->SetAddHdl(
+ LINK( this, SvxToolbarConfigPage, AddFunctionHdl ) );
+ }
+
+ pSelectorDlg->SetImageProvider(
+ static_cast< ImageProvider* >( GetSaveInData() ) );
+
+ pSelectorDlg->Show();
+ return 1;
+}
+
+IMPL_LINK( SvxToolbarConfigPage, AddFunctionHdl,
+ SvxScriptSelectorDialog *, pDialog )
+{
+ (void)pDialog;
+
+ AddFunction();
+
+ return 0;
+}
+
+SvLBoxEntry* SvxToolbarConfigPage::AddFunction(
+ SvLBoxEntry* pTarget, bool bFront, bool bAllowDuplicates )
+{
+ SvLBoxEntry* pNewLBEntry =
+ SvxConfigPage::AddFunction( pTarget, bFront, bAllowDuplicates );
+
+ SvxConfigEntry* pEntry = (SvxConfigEntry*) pNewLBEntry->GetUserData();
+
+ if ( pEntry->IsBinding() )
+ {
+ pEntry->SetVisible( TRUE );
+ aContentsListBox->SetCheckButtonState(
+ pNewLBEntry, SV_BUTTON_CHECKED );
+ }
+ else
+ {
+ aContentsListBox->SetCheckButtonState(
+ pNewLBEntry, SV_BUTTON_TRISTATE );
+ }
+
+ // get currently selected toolbar and apply change
+ SvxConfigEntry* pToolbar = GetTopLevelSelection();
+
+ if ( pToolbar != NULL )
+ {
+ ( ( ToolbarSaveInData* ) GetSaveInData() )->ApplyToolbar( pToolbar );
+ }
+
+ return pNewLBEntry;
+}
+
+// -----------------------------------------------------------------------
+
+SvxToolbarEntriesListBox::SvxToolbarEntriesListBox(
+ Window* pParent, const ResId& aResId )
+ :
+ SvxMenuEntriesListBox( pParent, aResId ),
+ pPage( ( SvxToolbarConfigPage* ) pParent )
+{
+ m_pButtonData = new SvLBoxButtonData( this );
+ BuildCheckBoxButtonImages( m_pButtonData );
+ EnableCheckButton( m_pButtonData );
+
+ m_bHiContrastMode = GetDisplayBackground().GetColor().IsDark();
+}
+
+// --------------------------------------------------------
+
+SvxToolbarEntriesListBox::~SvxToolbarEntriesListBox()
+{
+ delete m_pButtonData;
+}
+
+// --------------------------------------------------------
+
+void SvxToolbarEntriesListBox::BuildCheckBoxButtonImages( SvLBoxButtonData* pData )
+{
+ // Build checkbox images according to the current application
+ // settings. This is necessary to be able to have correct colors
+ // in all color modes, like high contrast.
+ const AllSettings& rSettings = Application::GetSettings();
+
+ VirtualDevice aDev;
+ Size aSize( 26, 20 );
+
+ aDev.SetOutputSizePixel( aSize );
+
+ Image aImage = GetSizedImage( aDev, aSize,
+ CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT ));
+
+ // Fill button data struct with new images
+ pData->aBmps[SV_BMP_UNCHECKED] = aImage;
+ pData->aBmps[SV_BMP_CHECKED] = GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED ));
+ pData->aBmps[SV_BMP_HICHECKED] = GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED ));
+ pData->aBmps[SV_BMP_HIUNCHECKED] = GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT | BUTTON_DRAW_PRESSED));
+ pData->aBmps[SV_BMP_TRISTATE] = GetSizedImage( aDev, aSize, Image() ); // Use tristate bitmaps to have no checkbox for separator entries
+ pData->aBmps[SV_BMP_HITRISTATE] = GetSizedImage( aDev, aSize, Image() );
+
+ // Get image size
+ m_aCheckBoxImageSizePixel = aImage.GetSizePixel();
+}
+
+Image SvxToolbarEntriesListBox::GetSizedImage(
+ VirtualDevice& aDev, const Size& aNewSize, const Image& aImage )
+{
+ // Create new checkbox images for treelistbox. They must have a
+ // decent width to have a clear column for the visibility checkbox.
+
+ // Standard transparent color is light magenta as is won't be
+ // used for other things
+ Color aFillColor( COL_LIGHTMAGENTA );
+
+ // Position image at the center of (width-2),(height) rectangle.
+ // We need 2 pixels to have a bigger border to the next button image
+ USHORT nPosX = std::max( (USHORT) (((( aNewSize.Width() - 2 ) - aImage.GetSizePixel().Width() ) / 2 ) - 1), (USHORT) 0 );
+ USHORT nPosY = std::max( (USHORT) (((( aNewSize.Height() - 2 ) - aImage.GetSizePixel().Height() ) / 2 ) + 1), (USHORT) 0 );
+ Point aPos( nPosX > 0 ? nPosX : 0, nPosY > 0 ? nPosY : 0 );
+ aDev.SetFillColor( aFillColor );
+ aDev.SetLineColor( aFillColor );
+ aDev.DrawRect( Rectangle( Point(), aNewSize ));
+ aDev.DrawImage( aPos, aImage );
+
+ // Draw separator line 2 pixels left from the right border
+ Color aLineColor = GetDisplayBackground().GetColor().IsDark() ? Color( COL_WHITE ) : Color( COL_BLACK );
+ aDev.SetLineColor( aLineColor );
+ aDev.DrawLine( Point( aNewSize.Width()-3, 0 ), Point( aNewSize.Width()-3, aNewSize.Height()-1 ));
+
+ // Create new image that uses the fillcolor as transparent
+ return Image( aDev.GetBitmap( Point(), aNewSize ), aFillColor );
+}
+
+void SvxToolbarEntriesListBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SvTreeListBox::DataChanged( rDCEvt );
+
+ if (( rDCEvt.GetType() == DATACHANGED_SETTINGS ) &&
+ ( rDCEvt.GetFlags() & SETTINGS_STYLE ))
+ {
+ if ( m_bHiContrastMode != GetDisplayBackground().GetColor().IsDark() )
+ {
+ // We have to reset all images because we change to/from high contrast mode
+ m_bHiContrastMode = GetDisplayBackground().GetColor().IsDark();
+ }
+
+ BuildCheckBoxButtonImages( m_pButtonData );
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------
+
+void SvxToolbarEntriesListBox::ChangeVisibility( SvLBoxEntry* pEntry )
+{
+ if ( pEntry != NULL )
+ {
+ SvxConfigEntry* pEntryData =
+ (SvxConfigEntry*) pEntry->GetUserData();
+
+ if ( pEntryData->IsBinding() )
+ {
+ pEntryData->SetVisible( !pEntryData->IsVisible() );
+
+ SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection();
+
+ ToolbarSaveInData* pToolbarSaveInData = ( ToolbarSaveInData* )
+ pPage->GetSaveInData();
+
+ pToolbarSaveInData->ApplyToolbar( pToolbar );
+
+ SetCheckButtonState( pEntry, pEntryData->IsVisible() ?
+ SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED );
+ }
+ }
+}
+
+void SvxToolbarEntriesListBox::CheckButtonHdl()
+{
+ ChangeVisibility( GetHdlEntry() );
+}
+
+void SvxToolbarEntriesListBox::KeyInput( const KeyEvent& rKeyEvent )
+{
+ // space key will change visibility of toolbar items
+ if ( rKeyEvent.GetKeyCode() == KEY_SPACE )
+ {
+ ChangeVisibility( GetCurEntry() );
+ }
+ else
+ {
+ // pass on to superclass
+ SvxMenuEntriesListBox::KeyInput( rKeyEvent );
+ }
+}
+
+BOOL SvxToolbarEntriesListBox::NotifyMoving(
+ SvLBoxEntry* pTarget, SvLBoxEntry* pSource,
+ SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos)
+{
+ bool result = SvxMenuEntriesListBox::NotifyMoving(
+ pTarget, pSource, rpNewParent, rNewChildPos );
+
+ if ( result == TRUE )
+ {
+ // Instant Apply changes to UI
+ SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection();
+ if ( pToolbar != NULL )
+ {
+ ToolbarSaveInData* pSaveInData =
+ ( ToolbarSaveInData*) pPage->GetSaveInData();
+ pSaveInData->ApplyToolbar( pToolbar );
+ }
+ }
+
+ return result;
+}
+
+BOOL SvxToolbarEntriesListBox::NotifyCopying(
+ SvLBoxEntry* pTarget,
+ SvLBoxEntry* pSource,
+ SvLBoxEntry*& rpNewParent,
+ ULONG& rNewChildPos)
+{
+ (void)pSource;
+ (void)rpNewParent;
+ (void)rNewChildPos;
+
+ if ( !m_bIsInternalDrag )
+ {
+ // if the target is NULL then add function to the start of the list
+ ((SvxToolbarConfigPage*)pPage)->AddFunction( pTarget, pTarget == NULL );
+
+ // Instant Apply changes to UI
+ SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection();
+ if ( pToolbar != NULL )
+ {
+ ToolbarSaveInData* pSaveInData =
+ ( ToolbarSaveInData*) pPage->GetSaveInData();
+ pSaveInData->ApplyToolbar( pToolbar );
+ }
+
+ // AddFunction already adds the listbox entry so return FALSE
+ // to stop another listbox entry being added
+ return FALSE;
+ }
+
+ // Copying is only allowed from external controls, not within the listbox
+ return FALSE;
+}
+
+SvxNewToolbarDialog::SvxNewToolbarDialog(
+ Window* pWindow, const String& rName )
+ :
+ ModalDialog ( pWindow, SVX_RES( MD_NEW_TOOLBAR ) ),
+ aFtDescription ( this, SVX_RES( FT_NAME ) ),
+ aEdtName ( this, SVX_RES( EDT_STRING ) ),
+ aSaveInText ( this, SVX_RES( TXT_SAVEIN ) ),
+ aBtnOK ( this, SVX_RES( BTN_OK ) ),
+ aBtnCancel ( this, SVX_RES( BTN_CANCEL ) ),
+ aBtnHelp ( this, SVX_RES( BTN_HELP ) ),
+ aSaveInListBox ( this, SVX_RES( LB_SAVEIN ) )
+{
+ FreeResource();
+
+ aEdtName.SetText( rName );
+ aEdtName.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
+ ModifyHdl(&aEdtName);
+ aEdtName.SetModifyHdl(LINK(this, SvxNewToolbarDialog, ModifyHdl));
+}
+
+IMPL_LINK(SvxNewToolbarDialog, ModifyHdl, Edit*, pEdit)
+{
+ (void)pEdit;
+
+ if(aCheckNameHdl.IsSet())
+ aBtnOK.Enable(aCheckNameHdl.Call(this) > 0);
+
+ return 0;
+}
+
+/*******************************************************************************
+*
+* The SvxIconSelectorDialog class
+*
+*******************************************************************************/
+SvxIconSelectorDialog::SvxIconSelectorDialog( Window *pWindow,
+ const uno::Reference< css::ui::XImageManager >& rXImageManager,
+ const uno::Reference< css::ui::XImageManager >& rXParentImageManager )
+ :
+ ModalDialog ( pWindow, SVX_RES( MD_ICONSELECTOR ) ),
+ aFtDescription ( this, SVX_RES( FT_SYMBOLS ) ),
+ aTbSymbol ( this, SVX_RES( TB_SYMBOLS ) ),
+ aFtNote ( this, SVX_RES( FT_NOTE ) ),
+ aBtnOK ( this, SVX_RES( BTN_OK ) ),
+ aBtnCancel ( this, SVX_RES( BTN_CANCEL ) ),
+ aBtnHelp ( this, SVX_RES( BTN_HELP ) ),
+ aBtnImport ( this, SVX_RES( BTN_IMPORT ) ),
+ aBtnDelete ( this, SVX_RES( BTN_DELETE ) ),
+ aFlSeparator ( this, SVX_RES( FL_SEPARATOR ) ),
+ m_nNextId ( 0 ),
+ m_xImageManager ( rXImageManager ),
+ m_xParentImageManager( rXParentImageManager )
+{
+ FreeResource();
+
+ typedef ::std::hash_map< ::rtl::OUString,
+ bool,
+ ::rtl::OUStringHash,
+ ::std::equal_to< ::rtl::OUString > > ImageInfo;
+
+ aTbSymbol.SetPageScroll( TRUE );
+
+ bool bLargeIcons = GetImageType() & css::ui::ImageType::SIZE_LARGE;
+ m_nExpectedSize = bLargeIcons ? 26 : 16;
+
+ if ( m_nExpectedSize != 16 )
+ {
+ aFtNote.SetText( replaceSixteen( aFtNote.GetText(), m_nExpectedSize ) );
+ }
+
+ uno::Reference< lang::XMultiServiceFactory > xServiceManager =
+ ::comphelper::getProcessServiceFactory();
+
+ if ( xServiceManager.is() )
+ {
+ m_xGraphProvider = uno::Reference< graphic::XGraphicProvider >(
+ xServiceManager->createInstance(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.graphic.GraphicProvider" ) ),
+ uno::UNO_QUERY );
+ }
+
+ if ( !m_xGraphProvider.is() )
+ {
+ aBtnImport.Enable( FALSE );
+ }
+
+ uno::Reference< beans::XPropertySet > xPropSet(
+ xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.util.PathSettings" ) ),
+ uno::UNO_QUERY );
+
+ uno::Any aAny = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfig" ) ) );
+
+ ::rtl::OUString aDirectory;
+
+ aAny >>= aDirectory;
+
+ sal_Int32 aCount = aDirectory.getLength();
+
+ if ( aCount > 0 )
+ {
+ sal_Unicode aChar = aDirectory[ aCount-1 ];
+ if ( aChar != '/')
+ {
+ aDirectory += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+ }
+ }
+ else
+ {
+ aBtnImport.Enable( FALSE );
+ }
+
+ aDirectory += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "soffice.cfg/import" ) );
+
+ uno::Reference< lang::XSingleServiceFactory > xStorageFactory(
+ xServiceManager->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.embed.FileSystemStorageFactory" )),
+ uno::UNO_QUERY );
+
+ uno::Sequence< uno::Any > aArgs( 2 );
+ aArgs[ 0 ] <<= aDirectory;
+ aArgs[ 1 ] <<= com::sun::star::embed::ElementModes::READWRITE;
+
+ uno::Reference< com::sun::star::embed::XStorage > xStorage(
+ xStorageFactory->createInstanceWithArguments( aArgs ), uno::UNO_QUERY );
+
+ uno::Sequence< uno::Any > aProp( 2 );
+ beans::PropertyValue aPropValue;
+
+ aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfigStorage" ) );
+ aPropValue.Value <<= xStorage;
+ aProp[ 0 ] <<= aPropValue;
+
+ aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" ) );
+ aPropValue.Value <<= com::sun::star::embed::ElementModes::READWRITE;
+ aProp[ 1 ] <<= aPropValue;
+
+ m_xImportedImageManager = uno::Reference< com::sun::star::ui::XImageManager >(
+ xServiceManager->createInstanceWithArguments(
+ ::rtl::OUString::createFromAscii( "com.sun.star.ui.ImageManager" ), aProp ),
+ uno::UNO_QUERY );
+
+ ImageInfo mImageInfo;
+ uno::Sequence< OUString > names;
+ if ( m_xImportedImageManager.is() )
+ {
+ names = m_xImportedImageManager->getAllImageNames( GetImageType() );
+ for ( sal_Int32 n = 0; n < names.getLength(); n++ )
+ mImageInfo.insert( ImageInfo::value_type( names[n], false ));
+ }
+ USHORT nId = 1;
+ ImageInfo::const_iterator pConstIter = mImageInfo.begin();
+ uno::Sequence< OUString > name( 1 );
+ while ( pConstIter != mImageInfo.end() )
+ {
+ name[ 0 ] = pConstIter->first;
+ uno::Sequence< uno::Reference< graphic::XGraphic> > graphics = m_xImportedImageManager->getImages( GetImageType(), name );
+ if ( graphics.getLength() > 0 )
+ {
+ Image img = Image( graphics[ 0 ] );
+ aTbSymbol.InsertItem( nId, img, pConstIter->first );
+
+ graphics[ 0 ]->acquire();
+
+ aTbSymbol.SetItemData(
+ nId, static_cast< void * > ( graphics[ 0 ].get() ) );
+
+ ++nId;
+ }
+ ++pConstIter;
+ }
+
+ ImageInfo aImageInfo;
+
+ if ( m_xParentImageManager.is() )
+ {
+ names = m_xParentImageManager->getAllImageNames( GetImageType() );
+ for ( sal_Int32 n = 0; n < names.getLength(); n++ )
+ aImageInfo.insert( ImageInfo::value_type( names[n], false ));
+ }
+
+ names = m_xImageManager->getAllImageNames( GetImageType() );
+ for ( sal_Int32 n = 0; n < names.getLength(); n++ )
+ {
+ ImageInfo::iterator pIter = aImageInfo.find( names[n] );
+ if ( pIter != aImageInfo.end() )
+ pIter->second = true;
+ else
+ aImageInfo.insert( ImageInfo::value_type( names[n], true ));
+ }
+
+ // large growth factor, expecting many entries
+ pConstIter = aImageInfo.begin();
+ while ( pConstIter != aImageInfo.end() )
+ {
+ name[ 0 ] = pConstIter->first;
+
+ uno::Sequence< uno::Reference< graphic::XGraphic> > graphics;
+ try
+ {
+ if ( pConstIter->second )
+ graphics = m_xImageManager->getImages( GetImageType(), name );
+ else
+ graphics = m_xParentImageManager->getImages( GetImageType(), name );
+ }
+ catch ( uno::Exception& )
+ {
+ // can't get sequence for this name so it will not be
+ // added to the list
+ }
+
+ if ( graphics.getLength() > 0 )
+ {
+ Image img = Image( graphics[ 0 ] );
+ aTbSymbol.InsertItem( nId, img, pConstIter->first );
+
+ uno::Reference< graphic::XGraphic > xGraphic = graphics[ 0 ];
+
+ if ( xGraphic.is() )
+ xGraphic->acquire();
+
+ aTbSymbol.SetItemData(
+ nId, static_cast< void * > ( xGraphic.get() ) );
+
+ ++nId;
+ }
+
+ ++pConstIter;
+ }
+
+ aBtnDelete.Enable( FALSE );
+ aTbSymbol.SetSelectHdl( LINK(this, SvxIconSelectorDialog, SelectHdl) );
+ aBtnImport.SetClickHdl( LINK(this, SvxIconSelectorDialog, ImportHdl) );
+ aBtnDelete.SetClickHdl( LINK(this, SvxIconSelectorDialog, DeleteHdl) );
+
+ m_nNextId = aTbSymbol.GetItemCount()+1;
+}
+
+SvxIconSelectorDialog::~SvxIconSelectorDialog()
+{
+ USHORT nCount = aTbSymbol.GetItemCount();
+
+ for (USHORT n = 0; n < nCount; n++ )
+ {
+ USHORT nId = aTbSymbol.GetItemId(n);
+
+ uno::XInterface* xi = static_cast< uno::XInterface* >(
+ aTbSymbol.GetItemData( nId ) );
+
+ if ( xi != NULL )
+ {
+ xi->release();
+ }
+ }
+}
+
+uno::Reference< graphic::XGraphic> SvxIconSelectorDialog::GetSelectedIcon()
+{
+ uno::Reference< graphic::XGraphic > result;
+
+ USHORT nId;
+ for ( USHORT n = 0; n < aTbSymbol.GetItemCount(); n++ )
+ {
+ nId = aTbSymbol.GetItemId( n );
+ if ( aTbSymbol.IsItemChecked( nId ) )
+ {
+ result = uno::Reference< graphic::XGraphic >(
+ reinterpret_cast< graphic::XGraphic* >(
+ aTbSymbol.GetItemData( nId ) ) );
+ }
+ }
+
+ return result;
+}
+
+IMPL_LINK( SvxIconSelectorDialog, SelectHdl, ToolBox *, pToolBox )
+{
+ (void)pToolBox;
+
+ USHORT nCount = aTbSymbol.GetItemCount();
+
+ for (USHORT n = 0; n < nCount; n++ )
+ {
+ USHORT nId = aTbSymbol.GetItemId( n );
+
+ if ( aTbSymbol.IsItemChecked( nId ) )
+ {
+ aTbSymbol.CheckItem( nId, FALSE );
+ }
+ }
+
+ USHORT nId = aTbSymbol.GetCurItemId();
+ aTbSymbol.CheckItem( nId );
+
+ ::rtl::OUString aSelImageText = aTbSymbol.GetItemText( nId );
+ if ( m_xImportedImageManager->hasImage( GetImageType(), aSelImageText ) )
+ {
+ aBtnDelete.Enable( TRUE );
+ }
+ else
+ {
+ aBtnDelete.Enable( FALSE );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxIconSelectorDialog, ImportHdl, PushButton *, pButton )
+{
+ (void)pButton;
+
+ sfx2::FileDialogHelper aImportDialog(
+ css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW,
+ SFXWB_GRAPHIC | SFXWB_MULTISELECTION );
+
+ // disable the link checkbox in the dialog
+ uno::Reference< css::ui::dialogs::XFilePickerControlAccess >
+ xController( aImportDialog.GetFilePicker(), uno::UNO_QUERY);
+ if ( xController.is() )
+ {
+ xController->enableControl(
+ css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK,
+ sal_False);
+ }
+
+ aImportDialog.SetCurrentFilter(
+ String::CreateFromAscii( "PNG - Portable Network Graphic" ) );
+
+ if ( ERRCODE_NONE == aImportDialog.Execute() )
+ {
+ uno::Sequence< OUString > paths = aImportDialog.GetMPath();
+ ImportGraphics ( paths );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxIconSelectorDialog, DeleteHdl, PushButton *, pButton )
+{
+ (void)pButton;
+
+ OUString message = String( SVX_RES( RID_SVXSTR_DELETE_ICON_CONFIRM ) );
+ bool ret = WarningBox( this, WinBits(WB_OK_CANCEL), message ).Execute();
+
+ if ( ret == RET_OK )
+ {
+ USHORT nCount = aTbSymbol.GetItemCount();
+
+ for (USHORT n = 0; n < nCount; n++ )
+ {
+ USHORT nId = aTbSymbol.GetItemId( n );
+
+ if ( aTbSymbol.IsItemChecked( nId ) )
+ {
+ ::rtl::OUString aSelImageText = aTbSymbol.GetItemText( nId );
+ uno::Sequence< OUString > URLs(1);
+ URLs[0] = aSelImageText;
+ aTbSymbol.RemoveItem( aTbSymbol.GetItemPos( nId ) );
+ m_xImportedImageManager->removeImages( GetImageType(), URLs );
+ uno::Reference< css::ui::XUIConfigurationPersistence >
+ xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY );
+ if ( xConfigPersistence.is() && xConfigPersistence->isModified() )
+ {
+ xConfigPersistence->store();
+ }
+ break;
+ }
+ }
+ }
+ return 0;
+}
+
+bool SvxIconSelectorDialog::ReplaceGraphicItem(
+ const ::rtl::OUString& aURL )
+{
+ uno::Sequence< OUString > URLs(1);
+ uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph( 1 );
+ uno::Reference< css::ui::XUIConfigurationPersistence >
+ xConfigPer( m_xImportedImageManager, uno::UNO_QUERY );
+
+ uno::Reference< graphic::XGraphic > xGraphic;
+ uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
+ aMediaProps[0].Name = ::rtl::OUString::createFromAscii("URL");
+ aMediaProps[0].Value <<= aURL;
+
+ com::sun::star::awt::Size aSize;
+ bool bOK = FALSE;
+ try
+ {
+ xGraphic = m_xGraphProvider->queryGraphic( aMediaProps );
+
+ uno::Reference< beans::XPropertySet > props =
+ m_xGraphProvider->queryGraphicDescriptor( aMediaProps );
+ uno::Any a = props->getPropertyValue(
+ OUString::createFromAscii("SizePixel") );
+ a >>= aSize;
+ if (0 == aSize.Width || 0 == aSize.Height)
+ return FALSE;
+ else
+ bOK = TRUE;
+ }
+ catch ( uno::Exception& )
+ {
+ return false;
+ }
+
+ bool bResult( false );
+ USHORT nCount = aTbSymbol.GetItemCount();
+ for (USHORT n = 0; n < nCount; n++ )
+ {
+ USHORT nId = aTbSymbol.GetItemId( n );
+
+ if ( OUString( aTbSymbol.GetItemText( nId ) ) == aURL )
+ {
+ try
+ {
+ // replace/insert image with provided URL
+ aTbSymbol.RemoveItem( aTbSymbol.GetItemPos( nId ) );
+ aMediaProps[0].Value <<= aURL;
+
+ Image aImage( xGraphic );
+ if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) )
+ {
+ BitmapEx aBitmap = aImage.GetBitmapEx();
+ BitmapEx aBitmapex = AutoScaleBitmap(aBitmap, m_nExpectedSize);
+ aImage = Image( aBitmapex);
+ }
+ aTbSymbol.InsertItem( nId,aImage, aURL, 0, 0 ); //modify
+
+ xGraphic = aImage.GetXGraphic();
+
+ URLs[0] = aURL;
+ aImportGraph[ 0 ] = xGraphic;
+ m_xImportedImageManager->replaceImages( GetImageType(), URLs, aImportGraph );
+ xConfigPer->store();
+
+ bResult = true;
+ break;
+ }
+ catch ( ::com::sun::star::uno::Exception& )
+ {
+ break;
+ }
+ }
+ }
+
+ return bResult;
+}
+
+void SvxIconSelectorDialog::ImportGraphics(
+ const uno::Sequence< OUString >& rPaths )
+{
+ uno::Sequence< OUString > rejected( rPaths.getLength() );
+ sal_Int32 rejectedCount = 0;
+
+ USHORT ret = 0;
+ sal_Int32 aIndex;
+ OUString aIconName;
+ uno::Sequence< OUString > URLs(1);
+ uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph( 1 );
+ uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
+ aMediaProps[0].Name = ::rtl::OUString::createFromAscii("URL");
+ uno::Reference< css::ui::XUIConfigurationPersistence >
+ xConfigPer( m_xImportedImageManager, uno::UNO_QUERY );
+
+ if ( rPaths.getLength() == 1 )
+ {
+ if ( m_xImportedImageManager->hasImage( GetImageType(), rPaths[0] ) )
+ {
+ aIndex = rPaths[0].lastIndexOf( '/' );
+ aIconName = rPaths[0].copy( aIndex+1 );
+ ret = SvxIconReplacementDialog( this, aIconName ).ShowDialog();
+ if ( ret == 2 )
+ {
+ ReplaceGraphicItem( rPaths[0] );
+ }
+ }
+ else
+ {
+ if ( ImportGraphic( rPaths[0] ) == FALSE )
+ {
+ rejected[0] = rPaths[0];
+ rejectedCount = 1;
+ }
+ }
+ }
+ else
+ {
+ ::rtl::OUString aSourcePath( rPaths[0] );
+ if ( rPaths[0].lastIndexOf( '/' ) != rPaths[0].getLength() -1 )
+ aSourcePath = rPaths[0] + ::rtl::OUString::createFromAscii( "/" );
+
+ for ( sal_Int32 i = 1; i < rPaths.getLength(); i++ )
+ {
+ ::rtl::OUString aPath = aSourcePath + rPaths[i];
+ if ( m_xImportedImageManager->hasImage( GetImageType(), aPath ) )
+ {
+ aIndex = rPaths[i].lastIndexOf( '/' );
+ aIconName = rPaths[i].copy( aIndex+1 );
+ ret = SvxIconReplacementDialog( this, aIconName, TRUE ).ShowDialog();
+ if ( ret == 2 )
+ {
+ ReplaceGraphicItem( aPath );
+ }
+ else if ( ret == 5 )
+ {
+ for ( sal_Int32 k = i; k < rPaths.getLength(); k++ )
+ {
+ aPath = aSourcePath + rPaths[k];
+ bool bHasReplaced = ReplaceGraphicItem( aPath );
+
+ if ( !bHasReplaced )
+ {
+ bool result = ImportGraphic( aPath );
+ if ( result == FALSE )
+ {
+ rejected[ rejectedCount ] = rPaths[i];
+ rejectedCount++;
+ }
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ bool result = ImportGraphic( aSourcePath + rPaths[i] );
+ if ( result == FALSE )
+ {
+ rejected[ rejectedCount ] = rPaths[i];
+ rejectedCount++;
+ }
+ }
+ }
+ }
+
+ if ( rejectedCount != 0 )
+ {
+ OUString message =OUString::createFromAscii("");
+ OUString newLine = OUString::createFromAscii("\n");
+ rtl::OUString fPath = OUString::createFromAscii("");
+ if (rejectedCount > 1)
+ fPath = rPaths[0].copy(8) + ::rtl::OUString::createFromAscii( "/" );
+ for ( sal_Int32 i = 0; i < rejectedCount; i++ )
+ {
+ message += fPath + rejected[i];
+ message += newLine;
+ }
+
+ SvxIconChangeDialog aDialog(this, message);
+ aDialog.Execute();
+ }
+}
+
+bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
+{
+ bool result = FALSE;
+
+ USHORT nId = m_nNextId;
+ ++m_nNextId;
+
+ uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
+ aMediaProps[0].Name = ::rtl::OUString::createFromAscii("URL");
+
+ uno::Reference< graphic::XGraphic > xGraphic;
+ com::sun::star::awt::Size aSize;
+ bool bOK = TRUE;
+ aMediaProps[0].Value <<= aURL;
+ try
+ {
+ uno::Reference< beans::XPropertySet > props =
+ m_xGraphProvider->queryGraphicDescriptor( aMediaProps );
+
+ uno::Any a = props->getPropertyValue(
+ OUString::createFromAscii("SizePixel") );
+
+ xGraphic = m_xGraphProvider->queryGraphic( aMediaProps );
+ if ( xGraphic.is() )
+ {
+ a >>= aSize;
+ if ( 0 == aSize.Width || 0 == aSize.Height )
+ bOK = FALSE;
+
+ Image aImage( xGraphic );
+
+ if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) )
+ {
+ BitmapEx aBitmap = aImage.GetBitmapEx();
+ BitmapEx aBitmapex = AutoScaleBitmap(aBitmap, m_nExpectedSize);
+ aImage = Image( aBitmapex);
+ }
+ if ( bOK && !!aImage )
+ {
+ aTbSymbol.InsertItem( nId, aImage, aURL, 0, 0 );
+
+ xGraphic = aImage.GetXGraphic();
+ xGraphic->acquire();
+
+ aTbSymbol.SetItemData(
+ nId, static_cast< void * > ( xGraphic.get() ) );
+ uno::Sequence< OUString > aImportURL( 1 );
+ aImportURL[ 0 ] = aURL;
+ uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph( 1 );
+ aImportGraph[ 0 ] = xGraphic;
+ m_xImportedImageManager->insertImages( GetImageType(), aImportURL, aImportGraph );
+ uno::Reference< css::ui::XUIConfigurationPersistence >
+ xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY );
+
+ if ( xConfigPersistence.is() && xConfigPersistence->isModified() )
+ {
+ xConfigPersistence->store();
+ }
+
+ result = TRUE;
+ }
+ else
+ {
+ OSL_TRACE("could not create Image from XGraphic");
+ }
+ }
+ else
+ {
+ OSL_TRACE("could not get query XGraphic");
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ OSL_TRACE("Caught exception importing XGraphic: %s", PRTSTR(e.Message));
+ }
+ return result;
+}
+
+/*******************************************************************************
+*
+* The SvxIconReplacementDialog class
+*
+*******************************************************************************/
+SvxIconReplacementDialog :: SvxIconReplacementDialog(
+ Window *pWindow, const rtl::OUString& aMessage, bool /*bYestoAll*/ )
+ :
+MessBox( pWindow, WB_DEF_YES, String( SVX_RES( RID_SVXSTR_REPLACE_ICON_CONFIRM ) ), String( SVX_RES( RID_SVXSTR_REPLACE_ICON_WARNING ) ) )
+
+{
+ SetImage( WarningBox::GetStandardImage() );
+ SetMessText( ReplaceIconName( aMessage ) );
+ RemoveButton( 1 );
+ AddButton( BUTTON_YES, 2, 0 );
+ AddButton( String( SVX_RES( RID_SVXSTR_YESTOALL ) ), 5, 0 );
+ AddButton( BUTTON_NO, 3, 0 );
+ AddButton( BUTTON_CANCEL, 4, 0 );
+}
+
+SvxIconReplacementDialog :: SvxIconReplacementDialog(
+ Window *pWindow, const rtl::OUString& aMessage )
+ :
+MessBox( pWindow, WB_YES_NO_CANCEL, String( SVX_RES( RID_SVXSTR_REPLACE_ICON_CONFIRM ) ), String( SVX_RES( RID_SVXSTR_REPLACE_ICON_WARNING ) ) )
+{
+ SetImage( WarningBox::GetStandardImage() );
+ SetMessText( ReplaceIconName( aMessage ));
+}
+
+rtl::OUString SvxIconReplacementDialog :: ReplaceIconName( const OUString& rMessage )
+{
+ rtl::OUString name;
+ rtl::OUString message = String( SVX_RES( RID_SVXSTR_REPLACE_ICON_WARNING ) );
+ rtl::OUString placeholder = OUString::createFromAscii( "%ICONNAME" );
+ sal_Int32 pos = message.indexOf( placeholder );
+ if ( pos != -1 )
+ {
+ name = message.replaceAt(
+ pos, placeholder.getLength(), rMessage );
+ }
+ return name;
+}
+
+USHORT SvxIconReplacementDialog :: ShowDialog()
+{
+ this->Execute();
+ return ( this->GetCurButtonId() );
+}
+/*******************************************************************************
+*
+* The SvxIconChangeDialog class added for issue83555
+*
+*******************************************************************************/
+SvxIconChangeDialog::SvxIconChangeDialog(
+ Window *pWindow, const rtl::OUString& aMessage)
+ :
+ ModalDialog ( pWindow, SVX_RES( MD_ICONCHANGE ) ),
+ aFImageInfo (this, SVX_RES( FI_INFO ) ),
+ aBtnOK (this, SVX_RES(MD_BTN_OK)),
+ aDescriptionLabel (this, SVX_RES(FTCHGE_DESCRIPTION)),
+ aLineEditDescription (this, SVX_RES(EDT_ADDR))
+{
+ FreeResource();
+ aFImageInfo.SetImage(InfoBox::GetStandardImage());
+ aLineEditDescription.SetControlBackground( GetSettings().GetStyleSettings().GetDialogColor() );
+ aLineEditDescription.SetAutoScroll( TRUE );
+ aLineEditDescription.EnableCursor( FALSE );
+ aLineEditDescription.SetText(aMessage);
+}
+
+BitmapEx SvxIconSelectorDialog::AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize)
+{
+ Point aEmptyPoint(0,0);
+ sal_Int32 imgNewWidth = 0;
+ sal_Int32 imgNewHeight = 0;
+ double imgposX = 0;
+ double imgposY = 0;
+ BitmapEx aRet = aBitmap;
+ double imgOldWidth = aRet.GetSizePixel().Width();
+ double imgOldHeight =aRet.GetSizePixel().Height();
+
+ Size aScaledSize;
+ if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize)
+ {
+ if (imgOldWidth >= imgOldHeight)
+ {
+ imgNewWidth = aStandardSize;
+ imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5);
+ imgposX = 0;
+ imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5;
+ }
+ else
+ {
+ imgNewHeight = aStandardSize;
+ imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5);
+ imgposY = 0;
+ imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5;
+ }
+
+ aScaledSize = Size( imgNewWidth, imgNewHeight );
+ aRet.Scale( aScaledSize, BMP_SCALE_INTERPOLATE );
+ }
+ else
+ {
+ imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5;
+ imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5;
+ }
+
+ Size aBmpSize = aRet.GetSizePixel();
+ Size aStdSize( aStandardSize, aStandardSize );
+ Rectangle aRect(aEmptyPoint, aStdSize );
+
+ VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 );
+ aVirDevice.SetOutputSizePixel( aStdSize );
+ aVirDevice.SetFillColor( COL_TRANSPARENT );
+ aVirDevice.SetLineColor( COL_TRANSPARENT );
+
+ //draw a rect into virDevice
+ aVirDevice.DrawRect( aRect );
+ Point aPointPixel( (long)imgposX, (long)imgposY );
+ aVirDevice.DrawBitmapEx( aPointPixel, aRet );
+ aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize );
+
+ return aRet;
+}
diff --git a/cui/source/customize/cfg.hrc b/cui/source/customize/cfg.hrc
new file mode 100644
index 000000000000..49c155ef96bf
--- /dev/null
+++ b/cui/source/customize/cfg.hrc
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * 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: cfg.hrc,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 CFG_OFFSET 300
+
+#define GRP_MENUS (9 + CFG_OFFSET)
+#define FT_MENUS (10 + CFG_OFFSET)
+#define LB_MENUS (11 + CFG_OFFSET)
+#define BTN_NEW (12 + CFG_OFFSET)
+#define BTN_CHANGE (14 + CFG_OFFSET)
+#define GRP_MENU_SEPARATOR (15 + CFG_OFFSET)
+#define GRP_MENU_ENTRIES (16 + CFG_OFFSET)
+#define BOX_ENTRIES (17 + CFG_OFFSET)
+#define BTN_CHANGE_ENTRY (18 + CFG_OFFSET)
+#define BTN_UP (19 + CFG_OFFSET)
+#define BTN_DOWN (20 + CFG_OFFSET)
+#define FT_DESCRIPTION (22 + CFG_OFFSET)
+#define TXT_SAVEIN (23 + CFG_OFFSET)
+#define LB_SAVEIN (24 + CFG_OFFSET)
+#define ED_DESCRIPTION (25 + CFG_OFFSET)
+#define BTN_ADD_COMMANDS (26 + CFG_OFFSET)
+
+#define MODIFY_MENU (40 + CFG_OFFSET)
+#define MODIFY_ENTRY (41 + CFG_OFFSET)
+#define ID_RENAME (42 + CFG_OFFSET)
+#define ID_MOVE (43 + CFG_OFFSET)
+#define ID_DELETE (44 + CFG_OFFSET)
+#define ID_ADD_SUBMENU (45 + CFG_OFFSET)
+#define ID_BEGIN_GROUP (46 + CFG_OFFSET)
+#define ID_DEFAULT_STYLE (47 + CFG_OFFSET)
+#define ID_ICONS_ONLY (48 + CFG_OFFSET)
+#define ID_ICONS_AND_TEXT (49 + CFG_OFFSET)
+#define ID_ICON_ONLY (50 + CFG_OFFSET)
+#define ID_ICON_AND_TEXT (51 + CFG_OFFSET)
+#define ID_TEXT_ONLY (52 + CFG_OFFSET)
+#define ID_CHANGE_SYMBOL (53 + CFG_OFFSET)
+#define ID_RESET_SYMBOL (54 + CFG_OFFSET)
+#define ID_DEFAULT_COMMAND (55 + CFG_OFFSET)
+
+#define MODIFY_TOOLBAR (60 + CFG_OFFSET)
+#define MODIFY_TOOLBAR_CONTENT (61 + CFG_OFFSET)
+
+#define IBX_MNUCFG_ALREADY_INCLUDED (63 + CFG_OFFSET)
+#define QBX_CONFIRM_RESET (64 + CFG_OFFSET)
+#define QBX_CONFIRM_DELETE_MENU (65 + CFG_OFFSET)
+#define QBX_CONFIRM_RESTORE_DEFAULT (66 + CFG_OFFSET)
+#define QBX_CONFIRM_DELETE_TOOLBAR (67 + CFG_OFFSET)
+
+#define MD_MENU_ORGANISER (79 + CFG_OFFSET)
+#define TXT_MENU (80 + CFG_OFFSET)
+#define BOX_MAIN_MENUS (81 + CFG_OFFSET)
+#define BTN_MENU_UP (82 + CFG_OFFSET)
+#define BTN_MENU_DOWN (83 + CFG_OFFSET)
+#define BTN_MENU_ADD (84 + CFG_OFFSET)
+#define BTN_MENU_CLOSE (85 + CFG_OFFSET)
+#define BTN_MENU_HELP (86 + CFG_OFFSET)
+#define TXT_MENU_NAME (87 + CFG_OFFSET)
+#define EDIT_MENU_NAME (88 + CFG_OFFSET)
+
+#define MD_ICONSELECTOR (90 + CFG_OFFSET)
+#define FT_SYMBOLS (91 + CFG_OFFSET)
+#define TB_SYMBOLS (92 + CFG_OFFSET)
+#define FT_NOTE (93 + CFG_OFFSET)
+#define BTN_IMPORT (97 + CFG_OFFSET)
+#define IMAGE_BTN_COLOR (98 + CFG_OFFSET)
+
+#define MD_NEW_TOOLBAR (101 + CFG_OFFSET)
+#define EDT_STRING (102 + CFG_OFFSET)
+#define BTN_OK (103 + CFG_OFFSET)
+#define BTN_CANCEL (104 + CFG_OFFSET)
+#define BTN_HELP (105 + CFG_OFFSET)
+#define FT_NAME (106 + CFG_OFFSET)
+
+#define FL_SEPARATOR (108 + CFG_OFFSET)
+#define BTN_DELETE (109 + CFG_OFFSET)
+//added for issue83555
+#define MD_ICONCHANGE (119 + CFG_OFFSET)
+#define FTCHGE_DESCRIPTION (120 + CFG_OFFSET)
+#define EDT_ADDR (121 + CFG_OFFSET)
+#define MD_BTN_OK (122 + CFG_OFFSET)
+#define FI_INFO (123 + CFG_OFFSET)
diff --git a/cui/source/customize/cfg.src b/cui/source/customize/cfg.src
new file mode 100644
index 000000000000..69f1ccc9c61f
--- /dev/null
+++ b/cui/source/customize/cfg.src
@@ -0,0 +1,875 @@
+/*************************************************************************
+ *
+ * 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: cfg.src,v $
+ * $Revision: 1.21 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "cfg.hrc"
+#include "helpid.hrc"
+
+TabDialog RID_SVXDLG_CUSTOMIZE
+{
+ OutputSize = TRUE ;
+ Text [ de ] = "Anpassen" ;
+ Text [ en-US ] = "Customize" ;
+ Moveable = TRUE ;
+ SvLook = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_MENUS ;
+ Text [ de ] = "Menüs" ;
+ Text [ en-US ] = "Menus" ;
+ PageResID = 300 ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_KEYBOARD ;
+ Text [ de ] = "Tastatur" ;
+ Text [ en-US ] = "Keyboard" ;
+ PageResID = 301 ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_TOOLBARS ;
+ Text [ de ] = "Symbolleisten" ;
+ Text [ en-US ] = "Toolbars" ;
+ PageResID = 302 ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_EVENTS ;
+ Text [ de ] = "Ereignisse" ;
+ Text [ en-US ] = "Events" ;
+ PageResID = 303 ;
+ };
+ };
+ };
+};
+
+#define TEXT_MENU \
+ Text [ de ] = "Menü" ; \
+ Text [ en-US ] = "Menu" ;\
+
+#define TEXT_BEGIN_GROUP \
+ Text [ de ] = "Gruppe beginnen" ; \
+ Text [ en-US ] = "Begin a Group" ;\
+
+#define TEXT_RENAME \
+ Text [ de ] = "Umbenennen..." ; \
+ Text [ en-US ] = "Rename..." ;\
+
+#define TEXT_DELETE \
+ Text [ de ] = "Entfernen..." ; \
+ Text [ en-US ] = "Delete..." ;\
+
+#define TEXT_DELETE_NODOTS \
+ Text [ de ] = "Entfernen" ; \
+ Text [ en-US ] = "Delete" ;\
+
+#define TEXT_MOVE \
+ Text [ de ] = "Verschieben..." ; \
+ Text [ en-US ] = "Move..." ;\
+
+#define TEXT_DEFAULT_STYLE \
+ Text [ de ] = "Standard Einstellungen herstellen" ; \
+ Text [ en-US ] = "Restore Default Settings" ;\
+
+#define TEXT_DEFAULT_COMMAND \
+ Text [ de ] = "Standardbefehl ~wiederherstellen" ; \
+ Text [ en-US ] = "Restore Default Command" ;\
+
+#define TEXT_TEXT_ONLY \
+ Text [ de ] = "Nur Text" ; \
+ Text [ en-US ] = "Text only" ;\
+
+#define TEXT_TOOLBAR_NAME \
+ Text [ de ] = "Name der Symbolleiste" ; \
+ Text [ en-US ] = "Toolbar Name" ;\
+
+#define TEXT_SAVE_IN \
+ Text [ de ] = "Speichern in" ; \
+ Text [ en-US ] = "Save In" ;\
+
+TabPage RID_SVXPAGE_MENUS
+{
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 273 , 258 ) ;
+ HelpId = HID_SVX_CONFIG_MENU ;
+ FixedLine GRP_MENUS
+ {
+ Pos = MAP_APPFONT ( 6 , 11 ) ;
+ Size = MAP_APPFONT ( 261 , 8 ) ;
+ Text [ de ] = "%PRODUCTNAME %MODULENAME Menüs" ;
+ Text [ en-US ] = "%PRODUCTNAME %MODULENAME Menus" ;
+ };
+ FixedText FT_MENUS
+ {
+ Pos = MAP_APPFONT ( 9 , 24 ) ;
+ Size = MAP_APPFONT ( 55 , 8 ) ;
+ TEXT_MENU
+ };
+ ListBox LB_MENUS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 64 , 22 ) ;
+ Size = MAP_APPFONT ( 108 , 108 ) ;
+ DropDown = TRUE ;
+ };
+ PushButton BTN_NEW
+ {
+ Pos = MAP_APPFONT ( 192 , 22 ) ;
+ Size = MAP_APPFONT ( 75 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ de ] = "Neu..." ;
+ Text [ en-US ] = "New..." ;
+ };
+ MenuButton BTN_CHANGE
+ {
+ Pos = MAP_APPFONT ( 192 , 39 ) ;
+ Size = MAP_APPFONT ( 75 , 14 ) ;
+ TabStop = TRUE ;
+ TEXT_MENU
+ };
+ FixedLine GRP_MENU_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 6 , 56 ) ;
+ Size = MAP_APPFONT ( 261 , 8 ) ;
+ Text [ de ] = "Menüinhalt" ;
+ Text [ en-US ] = "Menu Content" ;
+ };
+ FixedText GRP_MENU_ENTRIES
+ {
+ Pos = MAP_APPFONT ( 9 , 67 ) ;
+ Size = MAP_APPFONT ( 55 , 8 ) ;
+ Group = TRUE ;
+ Text [ de ] = "Einträge" ;
+ Text [ en-US ] = "Entries" ;
+ };
+ Control BOX_ENTRIES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 64 , 67 ) ;
+ Size = MAP_APPFONT ( 108 , 115 ) ;
+ TabStop = TRUE ;
+ HelpId = HID_SVX_CONFIG_MENU_CONTENTS ;
+ };
+ PushButton BTN_ADD_COMMANDS
+ {
+ Pos = MAP_APPFONT ( 192 , 67 ) ;
+ Size = MAP_APPFONT ( 75 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ de ] = "Hinzufügen..." ;
+ Text [ en-US ] = "Add..." ;
+ };
+ MenuButton BTN_CHANGE_ENTRY
+ {
+ Pos = MAP_APPFONT ( 192 , 84 ) ;
+ Size = MAP_APPFONT ( 75 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ de ] = "Ändern" ;
+ Text [ en-US ] = "Modify" ;
+ };
+ ImageButton BTN_UP
+ {
+ Pos = MAP_APPFONT ( 175 , 102 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ TabStop = TRUE ;
+ Symbol = IMAGEBUTTON_ARROW_UP ;
+ Disable = TRUE ;
+ };
+ ImageButton BTN_DOWN
+ {
+ Pos = MAP_APPFONT ( 175 , 119 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ TabStop = TRUE ;
+ Symbol = IMAGEBUTTON_ARROW_DOWN ;
+ Disable = TRUE ;
+ };
+ FixedText TXT_SAVEIN
+ {
+ Pos = MAP_APPFONT ( 9 , 190 ) ;
+ Size = MAP_APPFONT ( 55 , 8 ) ;
+ Group = TRUE ;
+ TEXT_SAVE_IN
+ };
+ ListBox LB_SAVEIN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 64 , 188 ) ;
+ Size = MAP_APPFONT ( 108 , 53 ) ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 6 , 205 ) ;
+ Size = MAP_APPFONT ( 261 , 8 ) ;
+ Text [ de ] = "Beschreibung" ;
+ Text [ en-US ] = "Description" ;
+ };
+ MultiLineEdit ED_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 6 , 216 ) ;
+ Size = MAP_APPFONT ( 261 , 36 ) ;
+ Border = TRUE;
+ VScroll = TRUE;
+ IgnoreTab = TRUE;
+ ReadOnly = TRUE;
+ };
+};
+
+Menu MODIFY_MENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = ID_MOVE ;
+ TEXT_MOVE
+ };
+ MenuItem
+ {
+ Identifier = ID_RENAME ;
+ TEXT_RENAME
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = ID_DELETE ;
+ TEXT_DELETE
+ };
+ };
+};
+
+Menu MODIFY_ENTRY
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = ID_ADD_SUBMENU ;
+ Text [ de ] = "Untermenü einfügen..." ;
+ Text [ en-US ] = "Add Submenu..." ;
+ };
+ MenuItem
+ {
+ Identifier = ID_BEGIN_GROUP ;
+ TEXT_BEGIN_GROUP
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = ID_RENAME ;
+ TEXT_RENAME
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = ID_DELETE ;
+ TEXT_DELETE_NODOTS
+ };
+ };
+};
+
+Menu MODIFY_TOOLBAR
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = ID_RENAME ;
+ TEXT_RENAME
+ };
+ MenuItem
+ {
+ Identifier = ID_DELETE ;
+ TEXT_DELETE_NODOTS
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = ID_DEFAULT_STYLE ;
+ TEXT_DEFAULT_STYLE
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = ID_ICONS_ONLY ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ de ] = "Nur Symbole" ;
+ Text [ en-US ] = "Icons Only" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_TEXT_ONLY ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ TEXT_TEXT_ONLY
+ };
+ MenuItem
+ {
+ Identifier = ID_ICONS_AND_TEXT ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ de ] = "Symbole & Text" ;
+ Text [ en-US ] = "Icons & Text" ;
+ };
+ };
+};
+
+Menu MODIFY_TOOLBAR_CONTENT
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = ID_RENAME ;
+ TEXT_RENAME
+ };
+ MenuItem
+ {
+ Identifier = ID_DELETE ;
+ TEXT_DELETE_NODOTS
+ };
+ MenuItem
+ {
+ Identifier = ID_DEFAULT_COMMAND ;
+ TEXT_DEFAULT_COMMAND
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = ID_BEGIN_GROUP ;
+ TEXT_BEGIN_GROUP
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ /*
+ MenuItem
+ {
+ Identifier = ID_ICON_ONLY ;
+ Text [ de ] = "Nur Symbol" ;
+ Text [ en-US ] = "Icon Only" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = ID_TEXT_ONLY ;
+ Text [ de ] = "Nur Text" ;
+ Text [ en-US ] = "Text Only" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = ID_ICON_AND_TEXT ;
+ Text [ de ] = "Symbol & Text" ;
+ Text [ en-US ] = "Icon & Text" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ */
+ MenuItem
+ {
+ Identifier = ID_CHANGE_SYMBOL ;
+ Text [ de ] = "Symbol austauschen..." ;
+ Text [ en-US ] = "Change Icon..." ;
+ };
+ MenuItem
+ {
+ Identifier = ID_RESET_SYMBOL ;
+ Text [ de ] = "Symbol zurücksetzen" ;
+ Text [ en-US ] = "Reset Icon" ;
+ };
+ };
+};
+
+/* %n will be replaced at runtime by a number starting with 1 and increasing as necessary */
+String RID_SVXSTR_NEW_MENU
+{
+ Text [ de ] = "Neues Menü %n";
+ Text [ en-US ] = "New Menu %n";
+};
+
+/* %n will be replaced at runtime by a number starting with 1 and increasing as necessary */
+String RID_SVXSTR_NEW_TOOLBAR
+{
+ Text [ de ] = "Neue Symbolleiste %n";
+ Text [ en-US ] = "New Toolbar %n";
+};
+
+String RID_SVXSTR_MOVE_MENU
+{
+ Text [ de ] = "Menü verschieben";
+ Text [ en-US ] = "Move Menu";
+};
+
+String RID_SVXSTR_ADD_SUBMENU
+{
+ Text [ de ] = "Untermenü hinzufügen";
+ Text [ en-US ] = "Add Submenu";
+};
+
+String RID_SVXSTR_SUBMENU_NAME
+{
+ Text [ de ] = "Name des Untermenüs";
+ Text [ en-US ] = "Submenu name";
+};
+
+String RID_SVXSTR_MENU_ADDCOMMANDS_DESCRIPTION
+{
+ Text [ de ] = "Um Befehle einem menu hinzuzufügen, wählen Sie zuerst eine Kategorie und dann den Befehl. Alternativ ziehen Sie den Befehl in die Befehlsliste auf der Registerseite 'Menüs' im Dialog 'Anpassen'.";
+ Text [ en-US ] = "To add a command to a menu, select the category and then the command. You can also drag the command to the Commands list of the Menus tab page in the Customize dialog.";
+};
+
+ModalDialog MD_MENU_ORGANISER
+{
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 172 , 154 ) ;
+ Text [ de ] = "Neues Menü" ;
+ Text [ en-US ] = "New Menu" ;
+ SvLook = TRUE ;
+ Moveable = TRUE ;
+ HelpId = HID_SVX_CONFIG_MENU_ORGANIZER;
+ FixedText TXT_MENU_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 93 , 8 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Text [ de ] = "Menüname" ;
+ Text [ en-US ] = "Menu name" ;
+ };
+ Edit EDIT_MENU_NAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 19 ) ;
+ Size = MAP_APPFONT ( 93 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText TXT_MENU
+ {
+ Pos = MAP_APPFONT ( 6 , 37 ) ;
+ Size = MAP_APPFONT ( 93 , 8 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Text [ de ] = "Menüposition" ;
+ Text [ en-US ] = "Menu position" ;
+ };
+ Control BOX_MAIN_MENUS
+ {
+ HelpId = HID_SVX_CONFIG_MENU_LISTBOX ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 48 ) ;
+ Size = MAP_APPFONT ( 93 , 100 ) ;
+ TabStop = TRUE ;
+ };
+ ImageButton BTN_MENU_UP
+ {
+ Pos = MAP_APPFONT ( 102 , 80 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ TabStop = TRUE ;
+ Symbol = IMAGEBUTTON_ARROW_UP ;
+ };
+ ImageButton BTN_MENU_DOWN
+ {
+ Pos = MAP_APPFONT ( 102 , 97 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ TabStop = TRUE ;
+ Symbol = IMAGEBUTTON_ARROW_DOWN ;
+ };
+ OKButton BTN_MENU_ADD
+ {
+ DefButton = TRUE;
+ Pos = MAP_APPFONT ( 119 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ CancelButton BTN_MENU_CLOSE
+ {
+ Pos = MAP_APPFONT ( 119 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_MENU_HELP
+ {
+ Pos = MAP_APPFONT ( 119 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+// MD_NEW_TOOLBAR -------------------------------------------------
+ModalDialog MD_NEW_TOOLBAR
+{
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 165 , 63 ) ;
+ Text [ de ] = "Name" ;
+ Text [ en-US ] = "Name" ;
+ Moveable = TRUE ;
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 98 , 8 ) ;
+ TEXT_TOOLBAR_NAME
+ WordBreak = TRUE ;
+ };
+ Edit EDT_STRING
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 97 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText TXT_SAVEIN
+ {
+ Pos = MAP_APPFONT ( 6 , 35 ) ;
+ Size = MAP_APPFONT ( 98 , 8 ) ;
+ Group = TRUE ;
+ TEXT_SAVE_IN
+ };
+ ListBox LB_SAVEIN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 43 ) ;
+ Size = MAP_APPFONT ( 97 , 53 ) ;
+ DropDown = TRUE ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 109 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 109 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 109 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+#ifndef IMAGE_STDBTN_COLOR
+#define IMAGE_STDBTN_COLOR Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }
+#endif
+
+ModalDialog MD_ICONSELECTOR
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 240 , 152 ) ;
+ Text [ de ] = "Symbole Austauschen" ;
+ Text [ en-US ] = "Change Icon" ;
+ Moveable = TRUE ;
+ HelpId = HID_SVX_CONFIG_ICON_SELECTOR;
+ FixedText FT_SYMBOLS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 172 , 8 ) ;
+ Text [ de ] = "Symbole" ;
+ Text [ en-US ] = "Icons" ;
+ };
+ ToolBox TB_SYMBOLS
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 160 , 80 ) ;
+ Scroll = TRUE ;
+ LineSpacing = TRUE ;
+ Customize = FALSE ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 60 , 130 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 120 , 130 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 180 , 130 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_IMPORT
+ {
+ Pos = MAP_APPFONT ( 184 , 7 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ de ] = "Importieren..." ;
+ Text[ en-US ] = "Import...";
+ };
+ PushButton BTN_DELETE
+ {
+ Pos = MAP_APPFONT ( 184 , 24 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Delete...";
+ };
+ FixedText FT_NOTE
+ {
+ Pos = MAP_APPFONT ( 12 , 95 ) ;
+ Size = MAP_APPFONT ( 200 , 24 ) ;
+ Text [ de ] = "Hinweis:\nBitte beachten Sie das für einen erfolgreichen Import die Symbole eine Größe von 16x16 Pixel haben müssen." ;
+ Text [ en-US ] = "Note:\nThe size of an icon should be 16x16 pixel to achieve best quality. Different sized icons will be scaled automatically." ;
+ Left = TRUE ;
+ WordBreak = TRUE;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0, 120 );
+ Size = MAP_APPFONT ( 240, 8 );
+ };
+ Color IMAGE_BTN_COLOR
+ {
+ Red = 0xC000 ;
+ Green = 0xC000 ;
+ Blue = 0xC000 ;
+ };
+};
+//added for issue83555
+ModalDialog MD_ICONCHANGE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 200 , 150 ) ;
+ Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION" ;
+ Moveable = TRUE ;
+ FixedImage FI_INFO
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 24 , 24 ) ;
+ Fixed = Image
+ {
+
+ };
+ };
+ FixedText FTCHGE_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 30 ,15 ) ;
+ Size = MAP_APPFONT ( 200 , 50 ) ;
+ Text [ en-US ] = "The files listed below could not be imported.\nThe file format could not be interpreted." ;
+ };
+
+ MultiLineEdit EDT_ADDR
+ {
+ Pos = MAP_APPFONT ( 30 , 38) ;
+ Size = MAP_APPFONT ( 140 , 83 ) ;
+ Border = TRUE;
+ // VScroll = TRUE;
+ IgnoreTab = TRUE;
+ ReadOnly = TRUE;
+ };
+ OKButton MD_BTN_OK
+ {
+ Pos = MAP_APPFONT ( 68 , 131 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+
+};
+
+// Strings ---------------------------------------------------------------
+String RID_SVXSTR_IMPORT_ICON_ERROR
+{
+ Text [ de ] = "Die aufgelisteten Dateien konnten nicht importiert werden. Die Symbole entsprechen nicht der Größe von 16x16 Pixel." ;
+ Text [ en-US ] = "The files listed below could not be imported. The file format could not be interpreted." ;
+};
+
+String RID_SVXSTR_DELETE_ICON_CONFIRM //added for issue73355
+{
+ Text [ en-US ] = "Are you sure to delete the image?" ;
+};
+
+String RID_SVXSTR_REPLACE_ICON_WARNING //added for issue73355
+{
+ Text [ en-US ] = "The icon %ICONNAME is already contained in the image list.\nWould you like to replace the existing icon?";
+};
+
+String RID_SVXSTR_REPLACE_ICON_CONFIRM //added for issue73355
+{
+ Text [ en-US ] = "Confirm Icon Replacement";
+};
+
+String RID_SVXSTR_YESTOALL //added for issue73355
+{
+ Text [ en-US ] = "Yes to All";
+};
+
+String RID_SVXSTR_PRODUCTNAME_TOOLBARS
+{
+ Text [ de ] = "%PRODUCTNAME %MODULENAME Symbolleisten" ;
+ Text [ en-US ] = "%PRODUCTNAME %MODULENAME Toolbars" ;
+};
+
+String RID_SVXSTR_TOOLBAR
+{
+ Text [ de ] = "Symbolleiste" ;
+ Text [ en-US ] = "Toolbar" ;
+};
+
+String RID_SVXSTR_TOOLBAR_CONTENT
+{
+ Text [ de ] = "Symbolleisteninhalt" ;
+ Text [ en-US ] = "Toolbar Content" ;
+};
+
+String RID_SVXSTR_COMMANDS
+{
+ Text [ de ] = "Befehle" ;
+ Text [ en-US ] = "Commands" ;
+};
+
+String RID_SVXSTR_COMMAND
+{
+ Text [ de ] = "Befehl" ;
+ Text [ en-US ] = "Command" ;
+};
+
+String RID_SVXSTR_TOOLBAR_NAME
+{
+ TEXT_TOOLBAR_NAME
+};
+
+/* %MENUNAME will be replaced at runtime by the name of the selected menu. */
+QueryBox QBX_CONFIRM_DELETE_MENU
+{
+ Message [ de ] = "Sind Sie sicher, dass Sie das Menü '%MENUNAME' löschen möchten?";
+ Message [ en-US ] = "Are you sure you want to delete the '%MENUNAME' menu?";
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+};
+
+QueryBox QBX_CONFIRM_DELETE_TOOLBAR
+{
+ Message [ de ] = "Die Symbolleiste beinhaltet keine Befehle mehr. Soll die Symbolleiste gelöscht werden?";
+ Message [ en-US ] = "There are no more commands on the toolbar. Do you want to delete the toolbar?";
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+};
+
+/* Translators: Do not translate %SAVE IN SELECTION% It is a placeholder and will be
+ replaced at runtime by the name of the selected application or document.
+*/
+QueryBox QBX_CONFIRM_RESET
+{
+ Message [ de ] = "Die Menükonfiguration für %SAVE IN SELECTION% wird auf die Standardeinstellung zurückgesetzt. Möchten Sie fortfahren?";
+ Message [ en-US ] = "The menu configuration for %SAVE IN SELECTION% will be reset to the factory settings. Do you want to continue?";
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+};
+
+/* Translators: Do not translate %SAVE IN SELECTION% It is a placeholder
+ and will be replaced at runtime by the name of the selected application
+ or document.
+*/
+String RID_SVXSTR_CONFIRM_MENU_RESET
+{
+ Text [ de ] = "Die Menükonfiguration für %SAVE IN SELECTION% wird auf die Standardeinstellung zurückgesetzt. Möchten Sie fortfahren?";
+ Text [ en-US ] = "The menu configuration for %SAVE IN SELECTION% will be reset to the factory settings. Do you want to continue?";
+};
+
+String RID_SVXSTR_CONFIRM_TOOLBAR_RESET
+{
+ Text [ de ] = "Die Symbolleistenkonfiguration für %SAVE IN SELECTION% wird auf die Standardeinstellung zurückgesetzt. Möchten Sie fortfahren?";
+ Text [ en-US ] = "The toolbar configuration for %SAVE IN SELECTION% will be reset to the factory settings. Do you want to continue?";
+};
+
+QueryBox QBX_CONFIRM_RESTORE_DEFAULT
+{
+ Message [ de ] = "Alle Anpassungen die an dieser Symbolleiste vorgenommen wurden werden gelöscht. Möchten Sie diese Symbolleiste wirklich zurücksetzen?";
+ Message [ en-US ] = "This will delete all changes previously made to this toolbar. Do you really want to reset the toolbar?";
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+};
+
+InfoBox IBX_MNUCFG_ALREADY_INCLUDED
+{
+ Message [ de ] = "Die Funktion ist bereits in diesem Popup enthalten." ;
+ Message [ en-US ] = "Function is already included in this popup." ;
+};
+
+String RID_SVXSTR_LABEL_NEW_NAME
+{
+ Text [ de ] = "~Neuer Name";
+ Text [ en-US ] = "~New name";
+};
+
+String RID_SVXSTR_RENAME_MENU
+{
+ Text [ de ] = "Menü umbenennen";
+ Text [ en-US ] = "Rename Menu";
+};
+
+String RID_SVXSTR_RENAME_TOOLBAR
+{
+ Text [ de ] = "Symbolleiste umbenennen";
+ Text [ en-US ] = "Rename Toolbar";
+};
+
+
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
new file mode 100644
index 000000000000..dcd348fe4f8b
--- /dev/null
+++ b/cui/source/customize/cfgutil.cxx
@@ -0,0 +1,1801 @@
+/*************************************************************************
+ *
+ * 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: cfg.cxx,v $
+ * $Revision: 1.65 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "cfgutil.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
+#include <com/sun/star/script/provider/XScriptProvider.hpp>
+#include <com/sun/star/script/browse/XBrowseNode.hpp>
+#include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
+
+#include <com/sun/star/script/browse/XBrowseNodeFactory.hpp>
+#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
+#include <com/sun/star/document/XScriptInvocationContext.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+
+#include "acccfg.hrc"
+#include "helpid.hrc"
+#include <basic/sbx.hxx>
+#include <basic/basicmanagerrepository.hxx>
+#include <basic/sbstar.hxx>
+#include <basic/sbxmeth.hxx>
+#include <basic/sbmod.hxx>
+#include <basic/basmgr.hxx>
+#include <tools/urlobj.hxx>
+#include "svx/dialogs.hrc"
+#include <sfx2/app.hxx>
+#include <sfx2/macrconf.hxx>
+#include <sfx2/minfitem.hxx>
+#include <unotools/processfactory.hxx>
+#include <comphelper/documentinfo.hxx>
+#include <svtools/imagemgr.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <unotools/configmgr.hxx>
+#include "svx/dialmgr.hxx"
+#include <svl/stritem.hxx>
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::script;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::document;
+namespace css = ::com::sun::star;
+
+static ::rtl::OUString SERVICE_UICATEGORYDESCRIPTION = ::rtl::OUString::createFromAscii("com.sun.star.ui.UICategoryDescription" );
+static ::rtl::OUString SERVICE_UICMDDESCRIPTION = ::rtl::OUString::createFromAscii("com.sun.star.frame.UICommandDescription");
+
+SfxStylesInfo_Impl::SfxStylesInfo_Impl()
+{}
+
+void SfxStylesInfo_Impl::setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel)
+{
+ m_xDoc = xModel;
+}
+
+static ::rtl::OUString FAMILY_CHARACTERSTYLE = ::rtl::OUString::createFromAscii("CharacterStyles");
+static ::rtl::OUString FAMILY_PARAGRAPHSTYLE = ::rtl::OUString::createFromAscii("ParagraphStyles");
+static ::rtl::OUString FAMILY_FRAMESTYLE = ::rtl::OUString::createFromAscii("FrameStyles" );
+static ::rtl::OUString FAMILY_PAGESTYLE = ::rtl::OUString::createFromAscii("PageStyles" );
+static ::rtl::OUString FAMILY_NUMBERINGSTYLE = ::rtl::OUString::createFromAscii("NumberingStyles");
+
+static ::rtl::OUString CMDURL_SPART = ::rtl::OUString::createFromAscii(".uno:StyleApply?Style:string=");
+static ::rtl::OUString CMDURL_FPART2 = ::rtl::OUString::createFromAscii("&FamilyName:string=");
+
+static ::rtl::OUString CMDURL_STYLEPROT_ONLY = ::rtl::OUString::createFromAscii(".uno:StyleApply?");
+static ::rtl::OUString CMDURL_SPART_ONLY = ::rtl::OUString::createFromAscii("Style:string=");
+static ::rtl::OUString CMDURL_FPART_ONLY = ::rtl::OUString::createFromAscii("FamilyName:string=");
+
+static ::rtl::OUString STYLEPROP_UINAME = ::rtl::OUString::createFromAscii("DisplayName");
+
+::rtl::OUString SfxStylesInfo_Impl::generateCommand(const ::rtl::OUString& sFamily, const ::rtl::OUString& sStyle)
+{
+ ::rtl::OUStringBuffer sCommand(1024);
+ sCommand.append(CMDURL_SPART );
+ sCommand.append(sStyle );
+ sCommand.append(CMDURL_FPART2);
+ sCommand.append(sFamily );
+ return sCommand.makeStringAndClear();
+}
+
+sal_Bool SfxStylesInfo_Impl::parseStyleCommand(SfxStyleInfo_Impl& aStyle)
+{
+ static sal_Int32 LEN_STYLEPROT = CMDURL_STYLEPROT_ONLY.getLength();
+ static sal_Int32 LEN_SPART = CMDURL_SPART_ONLY.getLength();
+ static sal_Int32 LEN_FPART = CMDURL_FPART_ONLY.getLength();
+
+ if (aStyle.sCommand.indexOf(CMDURL_STYLEPROT_ONLY, 0) != 0)
+ return sal_False;
+
+ aStyle.sFamily = ::rtl::OUString();
+ aStyle.sStyle = ::rtl::OUString();
+
+ sal_Int32 nCmdLen = aStyle.sCommand.getLength();
+ ::rtl::OUString sCmdArgs = aStyle.sCommand.copy(LEN_STYLEPROT, nCmdLen-LEN_STYLEPROT);
+ sal_Int32 i = sCmdArgs.indexOf('&');
+ if (i<0)
+ return sal_False;
+
+ ::rtl::OUString sArg = sCmdArgs.copy(0, i);
+ if (sArg.indexOf(CMDURL_SPART_ONLY) == 0)
+ aStyle.sStyle = sArg.copy(LEN_SPART, sArg.getLength()-LEN_SPART);
+ else
+ if (sArg.indexOf(CMDURL_FPART_ONLY) == 0)
+ aStyle.sFamily = sArg.copy(LEN_FPART, sArg.getLength()-LEN_FPART);
+
+ sArg = sCmdArgs.copy(i+1, sCmdArgs.getLength()-i-1);
+ if (sArg.indexOf(CMDURL_SPART_ONLY) == 0)
+ aStyle.sStyle = sArg.copy(LEN_SPART, sArg.getLength()-LEN_SPART);
+ else
+ if (sArg.indexOf(CMDURL_FPART_ONLY) == 0)
+ aStyle.sFamily = sArg.copy(LEN_FPART, sArg.getLength()-LEN_FPART);
+
+ if (aStyle.sFamily.getLength() && aStyle.sStyle.getLength())
+ return sal_True;
+
+ return sal_False;
+}
+
+void SfxStylesInfo_Impl::getLabel4Style(SfxStyleInfo_Impl& aStyle)
+{
+ try
+ {
+ css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(m_xDoc, css::uno::UNO_QUERY);
+
+ css::uno::Reference< css::container::XNameAccess > xFamilies;
+ if (xModel.is())
+ xFamilies = xModel->getStyleFamilies();
+
+ css::uno::Reference< css::container::XNameAccess > xStyleSet;
+ if (xFamilies.is())
+ xFamilies->getByName(aStyle.sFamily) >>= xStyleSet;
+
+ css::uno::Reference< css::beans::XPropertySet > xStyle;
+ if (xStyleSet.is())
+ xStyleSet->getByName(aStyle.sStyle) >>= xStyle;
+
+ aStyle.sLabel = ::rtl::OUString();
+ if (xStyle.is())
+ xStyle->getPropertyValue(STYLEPROP_UINAME) >>= aStyle.sLabel;
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ { aStyle.sLabel = ::rtl::OUString(); }
+
+ if (!aStyle.sLabel.getLength())
+ {
+ aStyle.sLabel = aStyle.sCommand;
+ /*
+ #if OSL_DEBUG_LEVEL > 1
+ ::rtl::OUStringBuffer sMsg(256);
+ sMsg.appendAscii("There is no UIName for the style command \"");
+ sMsg.append (aStyle.sCommand );
+ sMsg.appendAscii("\". The UI will be invalid then ..." );
+ OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr());
+ #endif
+ */
+ }
+}
+
+::std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyleFamilies()
+{
+ // Its an optional interface!
+ css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(m_xDoc, css::uno::UNO_QUERY);
+ if (!xModel.is())
+ return ::std::vector< SfxStyleInfo_Impl >();
+
+ css::uno::Reference< css::container::XNameAccess > xCont = xModel->getStyleFamilies();
+ css::uno::Sequence< ::rtl::OUString > lFamilyNames = xCont->getElementNames();
+ ::std::vector< SfxStyleInfo_Impl > lFamilies;
+ sal_Int32 c = lFamilyNames.getLength();
+ sal_Int32 i = 0;
+ for(i=0; i<c; ++i)
+ {
+ SfxStyleInfo_Impl aFamilyInfo;
+ aFamilyInfo.sFamily = lFamilyNames[i];
+
+ try
+ {
+ css::uno::Reference< css::beans::XPropertySet > xFamilyInfo;
+ xCont->getByName(aFamilyInfo.sFamily) >>= xFamilyInfo;
+ if (!xFamilyInfo.is())
+ {
+ // TODO_AS currently there is no support for an UIName property .. use internal family name instead
+ aFamilyInfo.sLabel = aFamilyInfo.sFamily;
+ }
+ else
+ xFamilyInfo->getPropertyValue(STYLEPROP_UINAME) >>= aFamilyInfo.sLabel;
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ { return ::std::vector< SfxStyleInfo_Impl >(); }
+
+ lFamilies.push_back(aFamilyInfo);
+ }
+
+ return lFamilies;
+}
+
+::std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyles(const ::rtl::OUString& sFamily)
+{
+ static ::rtl::OUString PROP_UINAME = ::rtl::OUString::createFromAscii("DisplayName");
+
+ css::uno::Sequence< ::rtl::OUString > lStyleNames;
+ css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(m_xDoc, css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::container::XNameAccess > xFamilies = xModel->getStyleFamilies();
+ css::uno::Reference< css::container::XNameAccess > xStyleSet;
+ try
+ {
+ xFamilies->getByName(sFamily) >>= xStyleSet;
+ lStyleNames = xStyleSet->getElementNames();
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ { return ::std::vector< SfxStyleInfo_Impl >(); }
+
+ ::std::vector< SfxStyleInfo_Impl > lStyles;
+ sal_Int32 c = lStyleNames.getLength();
+ sal_Int32 i = 0;
+ for (i=0; i<c; ++i)
+ {
+ SfxStyleInfo_Impl aStyleInfo;
+ aStyleInfo.sFamily = sFamily;
+ aStyleInfo.sStyle = lStyleNames[i];
+ aStyleInfo.sCommand = SfxStylesInfo_Impl::generateCommand(aStyleInfo.sFamily, aStyleInfo.sStyle);
+
+ try
+ {
+ css::uno::Reference< css::beans::XPropertySet > xStyle;
+ xStyleSet->getByName(aStyleInfo.sStyle) >>= xStyle;
+ if (!xStyle.is())
+ continue;
+ xStyle->getPropertyValue(PROP_UINAME) >>= aStyleInfo.sLabel;
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ { continue; }
+
+ lStyles.push_back(aStyleInfo);
+ }
+ return lStyles;
+}
+SV_IMPL_PTRARR(SfxGroupInfoArr_Impl, SfxGroupInfoPtr);
+SfxConfigFunctionListBox_Impl::SfxConfigFunctionListBox_Impl( Window* pParent, const ResId& rResId)
+ : SvTreeListBox( pParent, rResId )
+ , pCurEntry( 0 )
+ , pStylesInfo( 0 )
+{
+ SetWindowBits( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT );
+ GetModel()->SetSortMode( SortAscending );
+
+ // Timer f"ur die BallonHelp
+ aTimer.SetTimeout( 200 );
+ aTimer.SetTimeoutHdl(
+ LINK( this, SfxConfigFunctionListBox_Impl, TimerHdl ) );
+}
+
+SfxConfigFunctionListBox_Impl::~SfxConfigFunctionListBox_Impl()
+{
+ ClearAll();
+}
+
+void SfxConfigFunctionListBox_Impl::MouseMove( const MouseEvent& )
+{
+ /* --> PB 2004-12-01 #i37000# - no own help text needed any longer
+ Point aMousePos = rMEvt.GetPosPixel();
+ pCurEntry = GetCurEntry();
+
+ if ( pCurEntry && GetEntry( aMousePos ) == pCurEntry )
+ aTimer.Start();
+ else
+ {
+ Help::ShowBalloon( this, aMousePos, String() );
+ aTimer.Stop();
+ }
+ */
+}
+
+
+IMPL_LINK( SfxConfigFunctionListBox_Impl, TimerHdl, Timer*, pTimer)
+/* Beschreibung
+ Timer-Handler f"ur die Einblendung eines Hilfetextes. Wenn nach Ablauf des Timers
+ der Mauszeiger immer noch auf dem aktuell selektierten Eintrag steht, wird der
+ Helptext des Entries als Balloon-Help eingeblendet.
+*/
+{
+ (void)pTimer; // unused
+ /* --> PB 2004-12-01 #i37000# - no own help text needed any longer
+ aTimer.Stop();
+ Point aMousePos = GetPointerPosPixel();
+ SvLBoxEntry *pEntry = GetCurEntry();
+ if ( pEntry && GetEntry( aMousePos ) == pEntry && pCurEntry == pEntry )
+ {
+ String sHelpText = GetHelpText( pEntry );
+ Help::ShowBalloon( this, OutputToScreenPixel( aMousePos ), sHelpText );
+ }
+ */
+ return 0L;
+}
+
+void SfxConfigFunctionListBox_Impl::ClearAll()
+/* Beschreibung
+ L"oscht alle Eintr"age in der FunctionListBox, alle UserDaten und alle evtl.
+ vorhandenen MacroInfos.
+*/
+{
+ USHORT nCount = aArr.Count();
+ for ( USHORT i=0; i<nCount; i++ )
+ {
+ SfxGroupInfo_Impl *pData = aArr[i];
+
+ if ( pData->nKind == SFX_CFGFUNCTION_MACRO ||
+ pData->nKind == SFX_CFGFUNCTION_SCRIPT )
+ {
+ SfxMacroInfo *pInfo = (SfxMacroInfo*) pData->pObject;
+ SFX_APP()->GetMacroConfig()->ReleaseSlotId( pInfo->GetSlotId() );
+ delete pInfo;
+ }
+
+ if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER
+ || pData->nKind == SFX_CFGGROUP_DOCBASICMGR
+ )
+ {
+ XInterface* xi = static_cast<XInterface *>(pData->pObject);
+ if (xi != NULL)
+ {
+ xi->release();
+ }
+ }
+
+ delete pData;
+ }
+
+ aArr.Remove( 0, nCount );
+ Clear();
+}
+
+SvLBoxEntry* SfxConfigFunctionListBox_Impl::GetEntry_Impl( const String& rName )
+/* Beschreibung
+ Ermittelt den SvLBoxEntry zu einem "ubergebenen String. Das setzt voraus, da\s
+ die Namen eindeutig sind.
+*/
+{
+ SvLBoxEntry *pEntry = First();
+ while ( pEntry )
+ {
+ if ( GetEntryText( pEntry ) == rName )
+ return pEntry;
+ pEntry = Next( pEntry );
+ }
+
+ return NULL;
+}
+
+SvLBoxEntry* SfxConfigFunctionListBox_Impl::GetEntry_Impl( USHORT nId )
+/* Beschreibung
+ Ermittelt den SvLBoxEntry zu einer "ubergebenen Id.
+*/
+{
+ SvLBoxEntry *pEntry = First();
+ while ( pEntry )
+ {
+ SfxGroupInfo_Impl *pData = (SfxGroupInfo_Impl*) pEntry->GetUserData();
+ if ( pData && pData->nOrd == nId )
+ return pEntry;
+ pEntry = Next( pEntry );
+ }
+
+ return NULL;
+}
+
+SfxMacroInfo* SfxConfigFunctionListBox_Impl::GetMacroInfo()
+/* Beschreibung
+ Gibt die MacroInfo des selektierten Entry zur"uck ( sofern vorhanden ).
+*/
+{
+ SvLBoxEntry *pEntry = FirstSelected();
+ if ( pEntry )
+ {
+ SfxGroupInfo_Impl *pData = (SfxGroupInfo_Impl*) pEntry->GetUserData();
+ if ( pData && ( pData->nKind == SFX_CFGFUNCTION_MACRO ||
+ pData->nKind == SFX_CFGFUNCTION_SCRIPT ) )
+ return (SfxMacroInfo*) pData->pObject;
+ }
+
+ return 0;
+}
+
+String SfxConfigFunctionListBox_Impl::GetCurCommand()
+{
+ SvLBoxEntry *pEntry = FirstSelected();
+ if (!pEntry)
+ return String();
+ SfxGroupInfo_Impl *pData = (SfxGroupInfo_Impl*) pEntry->GetUserData();
+ if (!pData)
+ return String();
+ return pData->sCommand;
+}
+
+String SfxConfigFunctionListBox_Impl::GetCurLabel()
+{
+ SvLBoxEntry *pEntry = FirstSelected();
+ if (!pEntry)
+ return String();
+ SfxGroupInfo_Impl *pData = (SfxGroupInfo_Impl*) pEntry->GetUserData();
+ if (!pData)
+ return String();
+ if (pData->sLabel.Len())
+ return pData->sLabel;
+ return pData->sCommand;
+}
+
+USHORT SfxConfigFunctionListBox_Impl::GetId( SvLBoxEntry *pEntry )
+/* Beschreibung
+ Gibt die Ordnungsnummer ( SlotId oder Macro-Nummer ) des Eintrags zur"uck.
+*/
+{
+ SfxGroupInfo_Impl *pData = pEntry ?
+ (SfxGroupInfo_Impl*) pEntry->GetUserData() : 0;
+ if ( pData )
+ return pData->nOrd;
+ return 0;
+}
+
+/*
+String SfxConfigFunctionListBox_Impl::GetHelpText( SvLBoxEntry *pEntry )
+{
+ // Information zum selektierten Entry aus den Userdaten holen
+ SfxGroupInfo_Impl *pInfo = pEntry ? (SfxGroupInfo_Impl*) pEntry->GetUserData(): 0;
+ if ( pInfo )
+ {
+ switch ( pInfo->nKind )
+ {
+ case SFX_CFGGROUP_FUNCTION :
+ case SFX_CFGFUNCTION_SLOT :
+ {
+ // Eintrag ist eine Funktion, Hilfe aus der Office-Hilfe
+ USHORT nId = pInfo->nOrd;
+ String aText = Application::GetHelp()->GetHelpText( nId, this );
+
+ if ( !aText.Len() )
+ aText = SFX_SLOTPOOL().GetSlotHelpText_Impl( nId );
+ return aText;
+ }
+
+ case SFX_CFGGROUP_SCRIPTCONTAINER :
+ case SFX_CFGFUNCTION_SCRIPT :
+ case SFX_CFGGROUP_BASICMGR :
+ case SFX_CFGGROUP_DOCBASICMGR :
+ case SFX_CFGGROUP_BASICLIB :
+ case SFX_CFGGROUP_BASICMOD :
+ case SFX_CFGFUNCTION_MACRO :
+ {
+ // Eintrag ist ein Macro, Hilfe aus der MacroInfo
+ SfxMacroInfo *pMacInfo = (SfxMacroInfo*) pInfo->pObject;
+ return pMacInfo->GetHelpText();
+ }
+
+ case SFX_CFGGROUP_STYLES :
+ return String();
+ }
+ }
+
+ return String();
+}*/
+
+void SfxConfigFunctionListBox_Impl::FunctionSelected()
+/* Beschreibung
+ Setzt die Balloonhelp zur"uck, da diese immer den Helptext des selektierten
+ Entry anzeigen soll.
+*/
+{
+ /* --> PB 2004-12-01 #i37000# - no own help text needed any longer
+ Help::ShowBalloon( this, Point(), String() );
+ */
+}
+
+void SfxConfigFunctionListBox_Impl::SetStylesInfo(SfxStylesInfo_Impl* pStyles)
+{
+ pStylesInfo = pStyles;
+}
+
+struct SvxConfigGroupBoxResource_Impl : public Resource
+{
+ Image m_hdImage;
+ Image m_hdImage_hc;
+ Image m_libImage;
+ Image m_libImage_hc;
+ Image m_macImage;
+ Image m_macImage_hc;
+ Image m_docImage;
+ Image m_docImage_hc;
+ ::rtl::OUString m_sMyMacros;
+ ::rtl::OUString m_sProdMacros;
+ String m_sMacros;
+ String m_sDlgMacros;
+ String m_aHumanAppName;
+ String m_aStrGroupStyles;
+ String m_aScriptType;
+ Image m_collapsedImage;
+ Image m_collapsedImage_hc;
+ Image m_expandedImage;
+ Image m_expandedImage_hc;
+
+ SvxConfigGroupBoxResource_Impl();
+};
+
+SvxConfigGroupBoxResource_Impl::SvxConfigGroupBoxResource_Impl() :
+ Resource(SVX_RES(RID_SVXPAGE_CONFIGGROUPBOX)),
+ m_hdImage(SVX_RES(IMG_HARDDISK)),
+ m_hdImage_hc(SVX_RES(IMG_HARDDISK_HC)),
+ m_libImage(SVX_RES(IMG_LIB)),
+ m_libImage_hc(SVX_RES(IMG_LIB_HC)),
+ m_macImage(SVX_RES(IMG_MACRO)),
+ m_macImage_hc(SVX_RES(IMG_MACRO_HC)),
+ m_docImage(SVX_RES(IMG_DOC)),
+ m_docImage_hc(SVX_RES(IMG_DOC_HC)),
+ m_sMyMacros(String(SVX_RES(STR_MYMACROS))),
+ m_sProdMacros(String(SVX_RES(STR_PRODMACROS))),
+ m_sMacros(String(SVX_RES(STR_BASICMACROS))),
+ m_sDlgMacros(String(SVX_RES(STR_DLG_MACROS))),
+ m_aHumanAppName(String(SVX_RES(STR_HUMAN_APPNAME))),
+ m_aStrGroupStyles(String(SVX_RES(STR_GROUP_STYLES))),
+ m_aScriptType(String(SVX_RES(STR_BASICNAME))),
+ m_collapsedImage(SVX_RES(BMP_COLLAPSED)),
+ m_collapsedImage_hc(SVX_RES(BMP_COLLAPSED_HC)),
+ m_expandedImage(SVX_RES(BMP_EXPANDED)),
+ m_expandedImage_hc(SVX_RES(BMP_EXPANDED_HC))
+{
+ FreeResource();
+}
+
+SfxConfigGroupListBox_Impl::SfxConfigGroupListBox_Impl(
+ Window* pParent, const ResId& rResId, ULONG nConfigMode )
+ : SvTreeListBox( pParent, rResId )
+ , pImp(new SvxConfigGroupBoxResource_Impl()), pFunctionListBox(0), nMode( nConfigMode ), bShowSF( FALSE ), bShowBasic( TRUE ), pStylesInfo(0)
+{
+ SetWindowBits( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT );
+ SetNodeBitmaps( pImp->m_collapsedImage, pImp->m_expandedImage, BMP_COLOR_NORMAL );
+ SetNodeBitmaps( pImp->m_collapsedImage_hc, pImp->m_expandedImage_hc, BMP_COLOR_HIGHCONTRAST );
+
+ // Check configuration to see whether only Basic macros,
+ // only Scripting Framework scripts, or both should be listed
+ Any value;
+ sal_Bool tmp = false;
+
+ value = ::utl::ConfigManager::GetConfigManager()->GetLocalProperty(
+ ::rtl::OUString::createFromAscii(
+ "Office.Scripting/ScriptDisplaySettings/ShowBasic" ) );
+
+ value >>= tmp;
+
+ if (tmp == sal_True) {
+ bShowBasic = TRUE;
+ }
+ else {
+ bShowBasic = FALSE;
+ }
+
+ value = ::utl::ConfigManager::GetConfigManager()->GetLocalProperty(
+ ::rtl::OUString::createFromAscii(
+ "Office.Scripting/ScriptDisplaySettings/ShowSF" ) );
+
+ value >>= tmp;
+
+ if (tmp == sal_True) {
+ bShowSF = TRUE;
+ }
+ else {
+ bShowSF = FALSE;
+ }
+}
+
+
+SfxConfigGroupListBox_Impl::~SfxConfigGroupListBox_Impl()
+{
+ ClearAll();
+}
+
+void SfxConfigGroupListBox_Impl::ClearAll()
+{
+ USHORT nCount = aArr.Count();
+ for ( USHORT i=0; i<nCount; i++ )
+ {
+ SfxGroupInfo_Impl *pData = aArr[i];
+ if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER
+ || pData->nKind == SFX_CFGGROUP_DOCBASICMGR
+ )
+ {
+ XInterface* xi = static_cast<XInterface *>(pData->pObject);
+ if (xi != NULL)
+ {
+ xi->release();
+ }
+ }
+ delete pData;
+ }
+
+ aArr.Remove( 0, nCount );
+ Clear();
+}
+
+void SfxConfigGroupListBox_Impl::SetScriptType( const String& rScriptType )
+{
+ pImp->m_aScriptType = rScriptType;
+ ULONG nPos=0;
+ SvLBoxEntry *pEntry = (SvLBoxEntry*) GetModel()->GetEntryAtAbsPos( nPos++ );
+ while ( pEntry )
+ {
+ SfxGroupInfo_Impl *pInfo = (SfxGroupInfo_Impl*) pEntry->GetUserData();
+ if ( pInfo->nKind == SFX_CFGGROUP_BASICLIB && ( IsExpanded( pEntry ) || pInfo->bWasOpened ) )
+ {
+ Collapse( pEntry );
+ SvLBoxEntry *pChild = FirstChild( pEntry );
+ while (pChild)
+ {
+ GetModel()->Remove( pChild );
+ pChild = FirstChild( pEntry );
+ }
+
+ Expand( pEntry );
+ }
+
+ pEntry = (SvLBoxEntry*) GetModel()->GetEntryAtAbsPos( nPos++ );
+ }
+}
+
+void SfxConfigGroupListBox_Impl::SetStylesInfo(SfxStylesInfo_Impl* pStyles)
+{
+ pStylesInfo = pStyles;
+}
+
+String SfxConfigGroupListBox_Impl::GetGroup()
+/* Beschreibung
+ Gibt den Namen der selektierten Funktionsgruppe bzw. des selektierten
+ Basics zur"uck.
+*/
+{
+ SvLBoxEntry *pEntry = FirstSelected();
+ while ( pEntry )
+ {
+ SfxGroupInfo_Impl *pInfo = (SfxGroupInfo_Impl*) pEntry->GetUserData();
+ if ( pInfo->nKind == SFX_CFGGROUP_FUNCTION )
+ return GetEntryText( pEntry );
+
+ if ( pInfo->nKind == SFX_CFGGROUP_BASICMGR )
+ {
+ BasicManager *pMgr = (BasicManager*) pInfo->pObject;
+ return pMgr->GetName();
+ }
+
+ if ( pInfo->nKind == SFX_CFGGROUP_DOCBASICMGR )
+ {
+ Reference< XModel > xDoc( static_cast< XModel* >( pInfo->pObject ) );
+ return ::comphelper::DocumentInfo::getDocumentTitle( xDoc );
+ }
+
+ pEntry = GetParent( pEntry );
+ }
+
+ return String();
+}
+
+//-----------------------------------------------
+BasicManager* SfxConfigGroupListBox_Impl::GetBasicManager( const SvLBoxEntry& _rEntry )
+{
+ BasicManager* pBasMgr = NULL;
+
+ SfxGroupInfo_Impl* pInfo = (SfxGroupInfo_Impl*) _rEntry.GetUserData();
+ switch ( pInfo->nKind )
+ {
+ case SFX_CFGGROUP_BASICMGR :
+ pBasMgr = (BasicManager*) pInfo->pObject;
+ break;
+ case SFX_CFGGROUP_DOCBASICMGR :
+ {
+ Reference< XModel > xDoc( static_cast< XModel* >( pInfo->pObject ) );
+ pBasMgr = ::basic::BasicManagerRepository::getDocumentBasicManager( xDoc );
+ }
+ break;
+ }
+ return pBasMgr;
+}
+
+//-----------------------------------------------
+void SfxConfigGroupListBox_Impl::InitModule()
+{
+ try
+ {
+ css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider(m_xFrame, css::uno::UNO_QUERY_THROW);
+ css::uno::Sequence< sal_Int16 > lGroups = xProvider->getSupportedCommandGroups();
+ sal_Int32 c1 = lGroups.getLength();
+ sal_Int32 i1 = 0;
+
+ for (i1=0; i1<c1; ++i1)
+ {
+ sal_Int16& rGroupID = lGroups[i1];
+ ::rtl::OUString sGroupID = ::rtl::OUString::valueOf((sal_Int32)rGroupID);
+ ::rtl::OUString sGroupName ;
+
+ try
+ {
+ m_xModuleCategoryInfo->getByName(sGroupID) >>= sGroupName;
+ if (!sGroupName.getLength())
+ continue;
+ }
+ catch(const css::container::NoSuchElementException&)
+ { continue; }
+
+ SvLBoxEntry* pEntry = InsertEntry(sGroupName, NULL);
+ SfxGroupInfo_Impl* pInfo = new SfxGroupInfo_Impl(SFX_CFGGROUP_FUNCTION, rGroupID);
+ pEntry->SetUserData(pInfo);
+ }
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ {}
+}
+
+//-----------------------------------------------
+void SfxConfigGroupListBox_Impl::InitBasic()
+{
+}
+
+//-----------------------------------------------
+void SfxConfigGroupListBox_Impl::InitStyles()
+{
+}
+
+//-----------------------------------------------
+namespace
+{
+ //...........................................
+ /** examines a component whether it supports XEmbeddedScripts, or provides access to such a
+ component by implementing XScriptInvocationContext.
+ @return
+ the model which supports the embedded scripts, or <NULL/> if it cannot find such a
+ model
+ */
+ static Reference< XModel > lcl_getDocumentWithScripts_throw( const Reference< XInterface >& _rxComponent )
+ {
+ Reference< XEmbeddedScripts > xScripts( _rxComponent, UNO_QUERY );
+ if ( !xScripts.is() )
+ {
+ Reference< XScriptInvocationContext > xContext( _rxComponent, UNO_QUERY );
+ if ( xContext.is() )
+ xScripts.set( xContext->getScriptContainer(), UNO_QUERY );
+ }
+
+ return Reference< XModel >( xScripts, UNO_QUERY );
+ }
+
+ //...........................................
+ static Reference< XModel > lcl_getScriptableDocument_nothrow( const Reference< XFrame >& _rxFrame )
+ {
+ Reference< XModel > xDocument;
+
+ // examine our associated frame
+ try
+ {
+ OSL_ENSURE( _rxFrame.is(), "lcl_getScriptableDocument_nothrow: you need to pass a frame to this dialog/tab page!" );
+ if ( _rxFrame.is() )
+ {
+ // first try the model in the frame
+ Reference< XController > xController( _rxFrame->getController(), UNO_SET_THROW );
+ xDocument = lcl_getDocumentWithScripts_throw( xController->getModel() );
+
+ if ( !xDocument.is() )
+ {
+ // if there is no suitable document in the frame, try the controller
+ xDocument = lcl_getDocumentWithScripts_throw( _rxFrame->getController() );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ //DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return xDocument;
+ }
+}
+
+//-----------------------------------------------
+void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ const css::uno::Reference< css::frame::XFrame >& xFrame ,
+ const ::rtl::OUString& sModuleLongName)
+{
+ SetUpdateMode(FALSE);
+ ClearAll(); // Remove all old entries from treelist box
+
+ m_xFrame = xFrame;
+ if ( xSMGR.is())
+ {
+ m_xSMGR = xSMGR;
+ m_sModuleLongName = sModuleLongName;
+
+ m_xGlobalCategoryInfo = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICATEGORYDESCRIPTION), css::uno::UNO_QUERY_THROW);
+ m_xModuleCategoryInfo = css::uno::Reference< css::container::XNameAccess >(m_xGlobalCategoryInfo->getByName(m_sModuleLongName) , css::uno::UNO_QUERY_THROW);
+ m_xUICmdDescription = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICMDDESCRIPTION) , css::uno::UNO_QUERY_THROW);
+
+ InitModule();
+ InitBasic();
+ InitStyles();
+ }
+
+ /*
+
+ // Verwendet wird der aktuelle Slotpool
+ if ( nMode )
+ {
+ pSlotPool = pPool ? pPool : &SFX_SLOTPOOL();
+ for ( USHORT i=1; i<pSlotPool->GetGroupCount(); i++ )
+ {
+ // Gruppe anw"ahlen ( Gruppe 0 ist intern )
+ String aName = pSlotPool->SeekGroup( i );
+ const SfxSlot *pSfxSlot = pSlotPool->FirstSlot();
+ if ( pSfxSlot )
+ {
+ // Check if all entries are not useable. Don't
+ // insert a group without any useable function.
+ sal_Bool bActiveEntries = sal_False;
+ while ( pSfxSlot )
+ {
+ USHORT nId = pSfxSlot->GetSlotId();
+ if ( pSfxSlot->GetMode() & nMode )
+ {
+ bActiveEntries = sal_True;
+ break;
+ }
+
+ pSfxSlot = pSlotPool->NextSlot();
+ }
+
+ if ( bActiveEntries )
+ {
+ // Wenn Gruppe nicht leer
+ SvLBoxEntry *pEntry = InsertEntry( aName, NULL );
+ SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_FUNCTION, i );
+ aArr.Insert( pInfo, aArr.Count() );
+ pEntry->SetUserData( pInfo );
+ }
+ }
+ }
+ }
+*/
+ SfxApplication *pSfxApp = SFX_APP();
+ if ( bShowBasic )
+ {
+ // Basics einsammeln
+ pSfxApp->EnterBasicCall();
+ String aMacroName(' ');
+ aMacroName += pImp->m_sDlgMacros;
+
+ // Zuerst AppBasic
+ BasicManager *pAppBasicMgr = pSfxApp->GetBasicManager();
+ BOOL bInsert = TRUE;
+ /*
+ if ( pArr )
+ {
+ bInsert = FALSE;
+ for ( USHORT n=0; n<pArr->Count(); n++ )
+ {
+ if ( *(*pArr)[n] == pSfxApp->GetName() )
+ {
+ bInsert = TRUE;
+ break;
+ }
+ }
+ }
+ */
+
+ if ( bInsert )
+ {
+ pAppBasicMgr->SetName( pSfxApp->GetName() );
+ if ( pAppBasicMgr->GetLibCount() )
+ {
+ // Nur einf"ugen, wenn Bibliotheken vorhanden
+ String aAppBasTitle( pImp->m_aHumanAppName );
+ aAppBasTitle += aMacroName;
+ SvLBoxEntry *pEntry = InsertEntry( aAppBasTitle, 0 );
+ SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_BASICMGR, 0, pAppBasicMgr );
+ // aArr.Insert( pInfo, aArr.Count() );
+ pEntry->SetUserData( pInfo );
+ pEntry->EnableChildsOnDemand( TRUE );
+ // Expand( pEntry );
+ }
+ }
+
+ Reference< XModel > xDoc( lcl_getScriptableDocument_nothrow( m_xFrame ) );
+ if ( xDoc.is() )
+ {
+ BasicManager* pBasicMgr = ::basic::BasicManagerRepository::getDocumentBasicManager( xDoc );
+ if ( pBasicMgr != pAppBasicMgr && pBasicMgr->GetLibCount() )
+ {
+ String sDocTitle( ::comphelper::DocumentInfo::getDocumentTitle( xDoc ) );
+ pBasicMgr->SetName( sDocTitle );
+
+ // Nur einf"ugen, wenn eigenes Basic mit Bibliotheken
+ SvLBoxEntry *pEntry = InsertEntry( sDocTitle.Append( aMacroName ), NULL );
+ xDoc->acquire();
+ SfxGroupInfo_Impl *pInfo =
+ new SfxGroupInfo_Impl( SFX_CFGGROUP_DOCBASICMGR, 0, xDoc.get() );
+ pEntry->SetUserData( pInfo );
+ pEntry->EnableChildsOnDemand( TRUE );
+ }
+ }
+
+ pSfxApp->LeaveBasicCall();
+ }
+
+ OSL_TRACE("** ** About to initialise SF Scripts");
+ if ( bShowSF )
+ {
+ OSL_TRACE("** ** bShowSF");
+ // Add Scripting Framework entries
+ Reference< browse::XBrowseNode > rootNode;
+ Reference< XComponentContext > xCtx;
+ try
+ {
+ Reference < beans::XPropertySet > xProps(
+ ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
+ xCtx.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW );
+ Reference< browse::XBrowseNodeFactory > xFac( xCtx->getValueByName(
+ ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.script.browse.theBrowseNodeFactory") ), UNO_QUERY_THROW );
+ rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) );
+ //rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROORGANIZER ) );
+ }
+ catch( Exception& e )
+ {
+ OSL_TRACE(" Caught some exception whilst retrieving browse nodes from factory... Exception: %s",
+ ::rtl::OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ // TODO exception handling
+ }
+
+
+ if ( rootNode.is() )
+ {
+ if ( nMode )
+ {
+ //We call acquire on the XBrowseNode so that it does not
+ //get autodestructed and become invalid when accessed later.
+ rootNode->acquire();
+
+ SfxGroupInfo_Impl *pInfo =
+ new SfxGroupInfo_Impl( SFX_CFGGROUP_SCRIPTCONTAINER, 0,
+ static_cast<void *>(rootNode.get()));
+
+ String aTitle(pImp->m_sDlgMacros);
+ SvLBoxEntry *pNewEntry = InsertEntry( aTitle, NULL );
+ pNewEntry->SetUserData( pInfo );
+ pNewEntry->EnableChildsOnDemand( TRUE );
+ aArr.Insert( pInfo, aArr.Count() );
+ }
+ else
+ {
+ //We are only showing scripts not slot APIs so skip
+ //Root node and show location nodes
+ try {
+ if ( rootNode->hasChildNodes() )
+ {
+ Sequence< Reference< browse::XBrowseNode > > children =
+ rootNode->getChildNodes();
+ BOOL bIsRootNode = FALSE;
+
+ ::rtl::OUString user = ::rtl::OUString::createFromAscii("user");
+ ::rtl::OUString share = ::rtl::OUString::createFromAscii("share");
+ if ( rootNode->getName().equals(::rtl::OUString::createFromAscii("Root") ))
+ {
+ bIsRootNode = TRUE;
+ }
+
+ //To mimic current starbasic behaviour we
+ //need to make sure that only the current document
+ //is displayed in the config tree. Tests below
+ //set the bDisplay flag to FALSE if the current
+ //node is a first level child of the Root and is NOT
+ //either the current document, user or share
+ ::rtl::OUString currentDocTitle;
+ Reference< XModel > xDocument( lcl_getScriptableDocument_nothrow( m_xFrame ) );
+ if ( xDocument.is() )
+ {
+ currentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xDocument );
+ }
+
+ for ( sal_Int32 n = 0; n < children.getLength(); n++ )
+ {
+ Reference< browse::XBrowseNode >& theChild = children[n];
+ BOOL bDisplay = TRUE;
+ ::rtl::OUString uiName = theChild->getName();
+ if ( bIsRootNode )
+ {
+ if ( ! ((theChild->getName().equals( user ) || theChild->getName().equals( share ) ||
+ theChild->getName().equals( currentDocTitle ) ) ) )
+ {
+ bDisplay=FALSE;
+ }
+ else
+ {
+ if ( uiName.equals( user ) )
+ {
+ uiName = pImp->m_sMyMacros;
+ }
+ else if ( uiName.equals( share ) )
+ {
+ uiName = pImp->m_sProdMacros;
+ }
+ }
+ }
+ if (children[n]->getType() != browse::BrowseNodeTypes::SCRIPT && bDisplay )
+ {
+
+// We call acquire on the XBrowseNode so that it does not
+// get autodestructed and become invalid when accessed later.
+ theChild->acquire();
+
+ SfxGroupInfo_Impl* pInfo =
+ new SfxGroupInfo_Impl(SFX_CFGGROUP_SCRIPTCONTAINER,
+ 0, static_cast<void *>( theChild.get()));
+
+ Image aImage = GetImage( theChild, xCtx, bIsRootNode,BMP_COLOR_NORMAL );
+ SvLBoxEntry* pNewEntry =
+ InsertEntry( uiName, NULL);
+ SetExpandedEntryBmp(pNewEntry, aImage, BMP_COLOR_NORMAL);
+ SetCollapsedEntryBmp(pNewEntry, aImage, BMP_COLOR_NORMAL);
+ aImage = GetImage( theChild, xCtx, bIsRootNode,BMP_COLOR_HIGHCONTRAST );
+ SetExpandedEntryBmp(pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST);
+ SetCollapsedEntryBmp(pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST);
+
+ pNewEntry->SetUserData( pInfo );
+ aArr.Insert( pInfo, aArr.Count() );
+
+ if ( children[n]->hasChildNodes() )
+ {
+ Sequence< Reference< browse::XBrowseNode > > grandchildren =
+ children[n]->getChildNodes();
+
+ for ( sal_Int32 m = 0; m < grandchildren.getLength(); m++ )
+ {
+ if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER )
+ {
+ pNewEntry->EnableChildsOnDemand( TRUE );
+ m = grandchildren.getLength();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (RuntimeException&) {
+ // do nothing, the entry will not be displayed in the UI
+ }
+ }
+ }
+ }
+
+ // add styles
+ if ( m_xSMGR.is() )
+ {
+ String sStyle( pImp->m_aStrGroupStyles );
+ SvLBoxEntry *pEntry = InsertEntry( sStyle, 0 );
+ SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, 0 ); // TODO last parameter should contain user data
+ aArr.Insert( pInfo, aArr.Count() );
+ pEntry->SetUserData( pInfo );
+ pEntry->EnableChildsOnDemand( TRUE );
+ }
+
+/* {
+ String sSymbols( String::CreateFromAscii("Symbols") );
+ SvLBoxEntry *pEntry = InsertEntry( sSymbols, 0 );
+ SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_SPECIALCHARACTERS, 0, 0 ); // TODO last parameter should contain user data
+ aArr.Insert( pInfo, aArr.Count() );
+ pEntry->SetUserData( pInfo );
+ } */
+
+ MakeVisible( GetEntry( 0,0 ) );
+ SetUpdateMode( TRUE );
+}
+Image SfxConfigGroupListBox_Impl::GetImage( Reference< browse::XBrowseNode > node, Reference< XComponentContext > xCtx, bool bIsRootNode, bool bHighContrast )
+{
+ Image aImage;
+ if ( bIsRootNode )
+ {
+ ::rtl::OUString user = ::rtl::OUString::createFromAscii("user");
+ ::rtl::OUString share = ::rtl::OUString::createFromAscii("share");
+ if (node->getName().equals( user ) || node->getName().equals(share ) )
+ {
+ if( bHighContrast == BMP_COLOR_NORMAL )
+ aImage = pImp->m_hdImage;
+ else
+ aImage = pImp->m_hdImage_hc;
+ }
+ else
+ {
+ ::rtl::OUString factoryURL;
+ ::rtl::OUString nodeName = node->getName();
+ Reference<XInterface> xDocumentModel = getDocumentModel(xCtx, nodeName );
+ if ( xDocumentModel.is() )
+ {
+ Reference< ::com::sun::star::frame::XModuleManager >
+ xModuleManager(
+ xCtx->getServiceManager()
+ ->createInstanceWithContext(
+ ::rtl::OUString::createFromAscii("" // xxx todo
+ "com.sun.star.frame.ModuleManager"),
+ xCtx ),
+ UNO_QUERY_THROW );
+ Reference<container::XNameAccess> xModuleConfig(
+ xModuleManager, UNO_QUERY_THROW );
+ // get the long name of the document:
+ ::rtl::OUString appModule( xModuleManager->identify(
+ xDocumentModel ) );
+ Sequence<beans::PropertyValue> moduleDescr;
+ Any aAny = xModuleConfig->getByName(appModule);
+ if( sal_True != ( aAny >>= moduleDescr ) )
+ {
+ throw RuntimeException(::rtl::OUString::createFromAscii("SFTreeListBox::Init: failed to get PropertyValue"), Reference< XInterface >());
+ }
+ beans::PropertyValue const * pmoduleDescr =
+ moduleDescr.getConstArray();
+ for ( sal_Int32 pos = moduleDescr.getLength(); pos--; )
+ {
+ if (pmoduleDescr[ pos ].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "ooSetupFactoryEmptyDocumentURL") ))
+ {
+ pmoduleDescr[ pos ].Value >>= factoryURL;
+ OSL_TRACE("factory url for doc images is %s",
+ ::rtl::OUStringToOString( factoryURL , RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ break;
+ }
+ }
+ }
+ if( factoryURL.getLength() > 0 )
+ {
+ if( bHighContrast == BMP_COLOR_NORMAL )
+ aImage = SvFileInformationManager::GetFileImage(
+ INetURLObject(factoryURL), false,
+ BMP_COLOR_NORMAL );
+ else
+ aImage = SvFileInformationManager::GetFileImage(
+ INetURLObject(factoryURL), false,
+ BMP_COLOR_HIGHCONTRAST );
+ }
+ else
+ {
+ if( bHighContrast == BMP_COLOR_NORMAL )
+ aImage = pImp->m_docImage;
+ else
+ aImage = pImp->m_docImage_hc;
+ }
+ }
+ }
+ else
+ {
+ if( node->getType() == browse::BrowseNodeTypes::SCRIPT )
+ {
+ if( bHighContrast == BMP_COLOR_NORMAL )
+ aImage = pImp->m_macImage;
+ else
+ aImage = pImp->m_macImage_hc;
+ }
+ else
+ {
+ if( bHighContrast == BMP_COLOR_NORMAL )
+ aImage = pImp->m_libImage;
+ else
+ aImage = pImp->m_libImage_hc;
+ }
+ }
+ return aImage;
+}
+
+Reference< XInterface >
+SfxConfigGroupListBox_Impl::getDocumentModel( Reference< XComponentContext >& xCtx, ::rtl::OUString& docName )
+{
+ Reference< XInterface > xModel;
+ Reference< lang::XMultiComponentFactory > mcf =
+ xCtx->getServiceManager();
+ Reference< frame::XDesktop > desktop (
+ mcf->createInstanceWithContext(
+ ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx ),
+ UNO_QUERY );
+
+ Reference< container::XEnumerationAccess > componentsAccess =
+ desktop->getComponents();
+ Reference< container::XEnumeration > components =
+ componentsAccess->createEnumeration();
+ while (components->hasMoreElements())
+ {
+ Reference< frame::XModel > model(
+ components->nextElement(), UNO_QUERY );
+ if ( model.is() )
+ {
+ ::rtl::OUString sTdocUrl =
+ ::comphelper::DocumentInfo::getDocumentTitle( model );
+ if( sTdocUrl.equals( docName ) )
+ {
+ xModel = model;
+ break;
+ }
+ }
+ }
+ return xModel;
+}
+
+::rtl::OUString SfxConfigGroupListBox_Impl::parseLocationName( const ::rtl::OUString& location )
+{
+ // strip out the last leaf of location name
+ // e.g. file://dir1/dir2/Blah.sxw - > Blah.sxw
+ ::rtl::OUString temp = location;
+ sal_Int32 lastSlashIndex = temp.lastIndexOf( ::rtl::OUString::createFromAscii( "/" ) );
+
+ if ( ( lastSlashIndex + 1 ) < temp.getLength() )
+ {
+ temp = temp.copy( lastSlashIndex + 1 );
+ }
+ // maybe we should throw here!!!
+ else
+ {
+ OSL_TRACE("Something wrong with name, perhaps we should throw an exception");
+ }
+ return temp;
+}
+
+//-----------------------------------------------
+::rtl::OUString SfxConfigGroupListBox_Impl::MapCommand2UIName(const ::rtl::OUString& sCommand)
+{
+ ::rtl::OUString sUIName;
+ try
+ {
+ css::uno::Reference< css::container::XNameAccess > xModuleConf;
+ m_xUICmdDescription->getByName(m_sModuleLongName) >>= xModuleConf;
+ if (xModuleConf.is())
+ {
+ ::comphelper::SequenceAsHashMap lProps(xModuleConf->getByName(sCommand));
+ sUIName = lProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("Name"), ::rtl::OUString());
+ }
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(css::uno::Exception&)
+ { sUIName = ::rtl::OUString(); }
+
+ // fallback for missing UINames !?
+ if (!sUIName.getLength())
+ {
+ sUIName = sCommand;
+ /*
+ #if OSL_DEBUG_LEVEL > 1
+ ::rtl::OUStringBuffer sMsg(256);
+ sMsg.appendAscii("There is no UIName for the internal command \"");
+ sMsg.append (sCommand );
+ sMsg.appendAscii("\". The UI will be invalid then ..." );
+ OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr());
+ #endif
+ */
+ }
+
+ return sUIName;
+}
+
+//-----------------------------------------------
+void SfxConfigGroupListBox_Impl::GroupSelected()
+/* Beschreibung
+ Eine Funktionsgruppe oder eine Basicmodul wurde selektiert. Alle Funktionen bzw.
+ Macros werden in der Functionlistbox anzeigt.
+*/
+{
+ SvLBoxEntry *pEntry = FirstSelected();
+ SfxGroupInfo_Impl *pInfo = (SfxGroupInfo_Impl*) pEntry->GetUserData();
+ pFunctionListBox->SetUpdateMode(FALSE);
+ pFunctionListBox->ClearAll();
+ if ( pInfo->nKind != SFX_CFGGROUP_FUNCTION &&
+ pInfo->nKind != SFX_CFGGROUP_BASICMOD &&
+ pInfo->nKind != SFX_CFGGROUP_SCRIPTCONTAINER &&
+ pInfo->nKind != SFX_CFGGROUP_STYLES )
+ {
+ pFunctionListBox->SetUpdateMode(TRUE);
+ return;
+ }
+
+ switch ( pInfo->nKind )
+ {
+ case SFX_CFGGROUP_FUNCTION :
+ {
+ USHORT nGroup = pInfo->nOrd;
+ css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider (m_xFrame, css::uno::UNO_QUERY_THROW);
+ css::uno::Sequence< css::frame::DispatchInformation > lCommands = xProvider->getConfigurableDispatchInformation(nGroup);
+ sal_Int32 c = lCommands.getLength();
+ sal_Int32 i = 0;
+
+ for (i=0; i<c; ++i)
+ {
+ const css::frame::DispatchInformation& rInfo = lCommands[i];
+ ::rtl::OUString sUIName = MapCommand2UIName(rInfo.Command);
+ SvLBoxEntry* pFuncEntry = pFunctionListBox->InsertEntry(sUIName, NULL);
+ SfxGroupInfo_Impl* pGrpInfo = new SfxGroupInfo_Impl(SFX_CFGFUNCTION_SLOT, 0);
+ pGrpInfo->sCommand = rInfo.Command;
+ pGrpInfo->sLabel = sUIName;
+ pFuncEntry->SetUserData(pGrpInfo);
+ }
+
+ break;
+ }
+
+ case SFX_CFGGROUP_BASICMOD :
+ {
+ SvLBoxEntry *pLibEntry = GetParent( pEntry );
+ SfxGroupInfo_Impl *pLibInfo =
+ (SfxGroupInfo_Impl*) pLibEntry->GetUserData();
+ SvLBoxEntry *pBasEntry = GetParent( pLibEntry );
+ SfxGroupInfo_Impl *pBasInfo =
+ (SfxGroupInfo_Impl*) pBasEntry->GetUserData();
+
+ StarBASIC *pLib = (StarBASIC*) pLibInfo->pObject;
+ Reference< XModel > xDoc;
+ if ( pBasInfo->nKind == SFX_CFGGROUP_DOCBASICMGR )
+ xDoc = static_cast< XModel* >( pBasInfo->pObject );
+
+ SbModule *pMod = (SbModule*) pInfo->pObject;
+ for ( USHORT nMeth=0; nMeth < pMod->GetMethods()->Count(); nMeth++ )
+ {
+ SbxMethod *pMeth = (SbxMethod*)pMod->GetMethods()->Get(nMeth);
+ SfxMacroInfoPtr pInf = new SfxMacroInfo( !xDoc.is(),
+ pLib->GetName(),
+ pMod->GetName(),
+ pMeth->GetName());
+ if ( pMeth->GetInfo() )
+ pInf->SetHelpText( pMeth->GetInfo()->GetComment() );
+ USHORT nId = SFX_APP()->GetMacroConfig()->GetSlotId( pInf );
+ if ( !nId )
+ break; // Kein Slot mehr frei
+
+ SvLBoxEntry* pFuncEntry =
+ pFunctionListBox->InsertEntry( pMeth->GetName(), NULL );
+ SfxGroupInfo_Impl *pGrpInfo =
+ new SfxGroupInfo_Impl( SFX_CFGFUNCTION_MACRO, nId, pInf );
+ pFunctionListBox->aArr.Insert( pGrpInfo, pFunctionListBox->aArr.Count() );
+ pFuncEntry->SetUserData( pGrpInfo );
+ }
+
+ break;
+ }
+
+ case SFX_CFGGROUP_SCRIPTCONTAINER:
+ {
+ if ( !GetChildCount( pEntry ) )
+ {
+ Reference< browse::XBrowseNode > rootNode(
+ reinterpret_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
+
+ try {
+ if ( rootNode->hasChildNodes() )
+ {
+ Sequence< Reference< browse::XBrowseNode > > children =
+ rootNode->getChildNodes();
+
+ for ( sal_Int32 n = 0; n < children.getLength(); n++ )
+ {
+ if (children[n]->getType() == browse::BrowseNodeTypes::SCRIPT)
+ {
+ ::rtl::OUString uri;
+
+ Reference < beans::XPropertySet >xPropSet( children[n], UNO_QUERY );
+ if (!xPropSet.is())
+ {
+ continue;
+ }
+
+ Any value =
+ xPropSet->getPropertyValue( String::CreateFromAscii( "URI" ) );
+ value >>= uri;
+
+ SfxMacroInfo* aInfo = new SfxMacroInfo( (String)uri );
+ aInfo->SetHelpText( uri );
+ SFX_APP()->GetMacroConfig()->GetSlotId( aInfo );
+
+ SfxGroupInfo_Impl* pGrpInfo =
+ new SfxGroupInfo_Impl(SFX_CFGFUNCTION_SCRIPT,
+ aInfo->GetSlotId(), aInfo);
+
+ Image aImage = GetImage( children[n], Reference< XComponentContext >(), sal_False, BMP_COLOR_NORMAL );
+ SvLBoxEntry* pNewEntry =
+ pFunctionListBox->InsertEntry( children[n]->getName(), NULL );
+ pFunctionListBox->SetExpandedEntryBmp(pNewEntry, aImage, BMP_COLOR_NORMAL);
+ pFunctionListBox->SetCollapsedEntryBmp(pNewEntry, aImage, BMP_COLOR_NORMAL);
+ aImage = GetImage( children[n], Reference< XComponentContext >(), sal_False, BMP_COLOR_HIGHCONTRAST );
+ pFunctionListBox->SetExpandedEntryBmp(pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST);
+ pFunctionListBox->SetCollapsedEntryBmp(pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST);
+
+ pGrpInfo->sCommand = uri;
+ pGrpInfo->sLabel = children[n]->getName();
+ pNewEntry->SetUserData( pGrpInfo );
+
+ pFunctionListBox->aArr.Insert(
+ pGrpInfo, pFunctionListBox->aArr.Count() );
+
+ }
+ }
+ }
+ }
+ catch (RuntimeException&) {
+ // do nothing, the entry will not be displayed in the UI
+ }
+ }
+ break;
+ }
+
+ case SFX_CFGGROUP_STYLES :
+ {
+ SfxStyleInfo_Impl* pFamily = (SfxStyleInfo_Impl*)(pInfo->pObject);
+ if (pFamily)
+ {
+ const ::std::vector< SfxStyleInfo_Impl > lStyles = pStylesInfo->getStyles(pFamily->sFamily);
+ ::std::vector< SfxStyleInfo_Impl >::const_iterator pIt;
+ for ( pIt = lStyles.begin();
+ pIt != lStyles.end() ;
+ ++pIt )
+ {
+ SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(*pIt);
+ SvLBoxEntry* pFuncEntry = pFunctionListBox->InsertEntry( pStyle->sLabel, NULL );
+ SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, pStyle );
+ pFunctionListBox->aArr.Insert( pGrpInfo, pFunctionListBox->aArr.Count() );
+ pGrpInfo->sCommand = pStyle->sCommand;
+ pGrpInfo->sLabel = pStyle->sLabel;
+ pFuncEntry->SetUserData( pGrpInfo );
+ }
+ }
+ break;
+ }
+
+ default:
+ return;
+ }
+
+ if ( pFunctionListBox->GetEntryCount() )
+ pFunctionListBox->Select( pFunctionListBox->GetEntry( 0, 0 ) );
+
+ pFunctionListBox->SetUpdateMode(TRUE);
+}
+
+BOOL SfxConfigGroupListBox_Impl::Expand( SvLBoxEntry* pParent )
+{
+ BOOL bRet = SvTreeListBox::Expand( pParent );
+ if ( bRet )
+ {
+ // Wieviele Entries k"onnen angezeigt werden ?
+ ULONG nEntries = GetOutputSizePixel().Height() / GetEntryHeight();
+
+ // Wieviele Kinder sollen angezeigt werden ?
+ ULONG nChildCount = GetVisibleChildCount( pParent );
+
+ // Passen alle Kinder und der parent gleichzeitig in die View ?
+ if ( nChildCount+1 > nEntries )
+ {
+ // Wenn nicht, wenigstens parent ganz nach oben schieben
+ MakeVisible( pParent, TRUE );
+ }
+ else
+ {
+ // An welcher relativen ViewPosition steht der aufzuklappende parent
+ SvLBoxEntry *pEntry = GetFirstEntryInView();
+ ULONG nParentPos = 0;
+ while ( pEntry && pEntry != pParent )
+ {
+ nParentPos++;
+ pEntry = GetNextEntryInView( pEntry );
+ }
+
+ // Ist unter dem parent noch genug Platz f"ur alle Kinder ?
+ if ( nParentPos + nChildCount + 1 > nEntries )
+ ScrollOutputArea( (short)( nEntries - ( nParentPos + nChildCount + 1 ) ) );
+ }
+ }
+
+ return bRet;
+}
+
+void SfxConfigGroupListBox_Impl::RequestingChilds( SvLBoxEntry *pEntry )
+/* Beschreibung
+ Ein Basic oder eine Bibliothek werden ge"offnet
+*/
+{
+ SfxGroupInfo_Impl *pInfo = (SfxGroupInfo_Impl*) pEntry->GetUserData();
+ pInfo->bWasOpened = TRUE;
+ switch ( pInfo->nKind )
+ {
+ case SFX_CFGGROUP_BASICMGR :
+ case SFX_CFGGROUP_DOCBASICMGR :
+ {
+ if ( !GetChildCount( pEntry ) )
+ {
+ // Erstmaliges "Offnen
+ BasicManager* pMgr( GetBasicManager( *pEntry ) );
+
+ SvLBoxEntry *pLibEntry = 0;
+ for ( USHORT nLib=0; nLib<pMgr->GetLibCount(); nLib++)
+ {
+ StarBASIC* pLib = pMgr->GetLib( nLib );
+ pLibEntry = InsertEntry( pMgr->GetLibName( nLib ), pEntry );
+ SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_BASICLIB, nLib, pLib );
+ aArr.Insert( pGrpInfo, aArr.Count() );
+ pLibEntry->SetUserData( pGrpInfo );
+ pLibEntry->EnableChildsOnDemand( TRUE );
+ }
+ }
+
+ break;
+ }
+
+ case SFX_CFGGROUP_BASICLIB :
+ {
+ if ( !GetChildCount( pEntry ) )
+ {
+ // Erstmaliges "Offnen
+ StarBASIC *pLib = (StarBASIC*) pInfo->pObject;
+ if ( !pLib )
+ {
+ // Lib mu\s nachgeladen werden
+ SvLBoxEntry *pParent = GetParent( pEntry );
+ BasicManager *pMgr( GetBasicManager( *pParent ) );
+
+ if ( pMgr->LoadLib( pInfo->nOrd ) )
+ pInfo->pObject = pLib = pMgr->GetLib( pInfo->nOrd );
+ else
+ break;
+ }
+
+ SvLBoxEntry *pModEntry = 0;
+ for ( USHORT nMod=0; nMod<pLib->GetModules()->Count(); nMod++ )
+ {
+ SbModule* pMod = (SbModule*)pLib->GetModules()->Get( nMod );
+
+ BOOL bIsStarScript = FALSE; //pMod->ISA( SbJScriptModule );
+ BOOL bWantsStarScript = pImp->m_aScriptType.EqualsAscii("StarScript");
+ if ( bIsStarScript != bWantsStarScript )
+ continue;
+ pModEntry = InsertEntry( pMod->GetName(), pEntry );
+ SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_BASICMOD, 0, pMod );
+ aArr.Insert( pGrpInfo, aArr.Count() );
+ pModEntry->SetUserData( pGrpInfo );
+ }
+ }
+
+ break;
+ }
+
+ case SFX_CFGGROUP_SCRIPTCONTAINER:
+ {
+ if ( !GetChildCount( pEntry ) )
+ {
+ Reference< browse::XBrowseNode > rootNode(
+ reinterpret_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
+
+ try {
+ if ( rootNode->hasChildNodes() )
+ {
+ Sequence< Reference< browse::XBrowseNode > > children =
+ rootNode->getChildNodes();
+ BOOL bIsRootNode = FALSE;
+
+ ::rtl::OUString user = ::rtl::OUString::createFromAscii("user");
+ ::rtl::OUString share = ::rtl::OUString::createFromAscii("share");
+ if ( rootNode->getName().equals(::rtl::OUString::createFromAscii("Root") ))
+ {
+ bIsRootNode = TRUE;
+ }
+
+ /* To mimic current starbasic behaviour we
+ need to make sure that only the current document
+ is displayed in the config tree. Tests below
+ set the bDisplay flag to FALSE if the current
+ node is a first level child of the Root and is NOT
+ either the current document, user or share */
+ ::rtl::OUString currentDocTitle;
+ Reference< XModel > xDocument( lcl_getScriptableDocument_nothrow( m_xFrame ) );
+ if ( xDocument.is() )
+ {
+ currentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xDocument );
+ }
+
+ sal_Int32 nLen = children.getLength();
+ for ( sal_Int32 n = 0; n < nLen; n++ )
+ {
+ Reference< browse::XBrowseNode >& theChild = children[n];
+ ::rtl::OUString aName( theChild->getName() );
+ BOOL bDisplay = TRUE;
+ if ( bIsRootNode )
+ {
+ if ( !( (aName.equals(user) || aName.equals(share) || aName.equals(currentDocTitle) ) ) )
+ bDisplay=FALSE;
+ }
+ if ( children[n].is() && children[n]->getType() != browse::BrowseNodeTypes::SCRIPT && bDisplay )
+ {
+
+ /*
+ We call acquire on the XBrowseNode so that it does not
+ get autodestructed and become invalid when accessed later.
+ */
+ theChild->acquire();
+
+ SfxGroupInfo_Impl* pGrpInfo =
+ new SfxGroupInfo_Impl(SFX_CFGGROUP_SCRIPTCONTAINER,
+ 0, static_cast<void *>( theChild.get()));
+
+ Image aImage = GetImage( theChild, Reference< XComponentContext >(), sal_False, BMP_COLOR_NORMAL );
+ SvLBoxEntry* pNewEntry =
+ InsertEntry( theChild->getName(), pEntry );
+ SetExpandedEntryBmp(pNewEntry, aImage, BMP_COLOR_NORMAL);
+ SetCollapsedEntryBmp(pNewEntry, aImage, BMP_COLOR_NORMAL);
+ aImage = GetImage( theChild, Reference< XComponentContext >(), sal_False, BMP_COLOR_HIGHCONTRAST );
+ SetExpandedEntryBmp(pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST);
+ SetCollapsedEntryBmp(pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST);
+
+ pNewEntry->SetUserData( pGrpInfo );
+ aArr.Insert( pGrpInfo, aArr.Count() );
+
+ if ( children[n]->hasChildNodes() )
+ {
+ Sequence< Reference< browse::XBrowseNode > > grandchildren =
+ children[n]->getChildNodes();
+
+ for ( sal_Int32 m = 0; m < grandchildren.getLength(); m++ )
+ {
+ if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER )
+ {
+ pNewEntry->EnableChildsOnDemand( TRUE );
+ m = grandchildren.getLength();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (RuntimeException&) {
+ // do nothing, the entry will not be displayed in the UI
+ }
+ }
+ break;
+ }
+
+ case SFX_CFGGROUP_STYLES:
+ {
+ if ( !GetChildCount( pEntry ) )
+ {
+ const ::std::vector< SfxStyleInfo_Impl > lStyleFamilies = pStylesInfo->getStyleFamilies();
+ ::std::vector< SfxStyleInfo_Impl >::const_iterator pIt;
+ for ( pIt = lStyleFamilies.begin();
+ pIt != lStyleFamilies.end() ;
+ ++pIt )
+ {
+ SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(*pIt);
+ SvLBoxEntry* pStyleEntry = InsertEntry( pFamily->sLabel, pEntry );
+ SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, pFamily );
+ aArr.Insert( pGrpInfo, aArr.Count() );
+ pStyleEntry->SetUserData( pGrpInfo );
+ pStyleEntry->EnableChildsOnDemand( FALSE );
+ }
+ }
+ break;
+ }
+
+ default:
+ DBG_ERROR( "Falscher Gruppentyp!" );
+ break;
+ }
+}
+
+void SfxConfigGroupListBox_Impl::AddAndSelect( const SfxStringItem* , const SfxStringItem* )
+{
+ /*
+ if ( pText )
+ {
+ Select( GetEntry( GetEntryCount()-1) );
+ SvLBoxEntry* pFuncEntry = pFunctionListBox->InsertEntry( pText->GetValue(), NULL );
+ SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_SPECIALCHARACTERS, 0, 0 );
+ String aCommand = String::CreateFromAscii(".uno:InsertSymbol?Symbols:string=");
+ aCommand += pText->GetValue();
+ pFunctionListBox->aArr.Insert( pGrpInfo, pFunctionListBox->aArr.Count() );
+ pGrpInfo->sCommand = aCommand;
+ pGrpInfo->sLabel = String::CreateFromAscii("Symbols: ");
+ pGrpInfo->sLabel += pText->GetValue();
+ pFuncEntry->SetUserData( pGrpInfo );
+ }
+ */
+}
+
+void SfxConfigGroupListBox_Impl::SelectMacro( const SfxMacroInfoItem *pItem )
+{
+ SelectMacro( pItem->GetBasicManager()->GetName(),
+ pItem->GetQualifiedName() );
+}
+
+void SfxConfigGroupListBox_Impl::SelectMacro( const String& rBasic,
+ const String& rMacro )
+{
+ String aBasicName( rBasic );
+ aBasicName += ' ';
+ aBasicName += pImp->m_sMacros;
+ String aLib, aModule, aMethod;
+ USHORT nCount = rMacro.GetTokenCount('.');
+ aMethod = rMacro.GetToken( nCount-1, '.' );
+ if ( nCount > 2 )
+ {
+ aLib = rMacro.GetToken( 0, '.' );
+ aModule = rMacro.GetToken( nCount-2, '.' );
+ }
+
+ SvLBoxEntry *pEntry = FirstChild(0);
+ while ( pEntry )
+ {
+ String aEntryBas = GetEntryText( pEntry );
+ if ( aEntryBas == aBasicName )
+ {
+ Expand( pEntry );
+ SvLBoxEntry *pLib = FirstChild( pEntry );
+ while ( pLib )
+ {
+ String aEntryLib = GetEntryText( pLib );
+ if ( aEntryLib == aLib )
+ {
+ Expand( pLib );
+ SvLBoxEntry *pMod = FirstChild( pLib );
+ while ( pMod )
+ {
+ String aEntryMod = GetEntryText( pMod );
+ if ( aEntryMod == aModule )
+ {
+ Expand( pMod );
+ MakeVisible( pMod );
+ Select( pMod );
+ SvLBoxEntry *pMethod = pFunctionListBox->First();
+ while ( pMethod )
+ {
+ String aEntryMethod = GetEntryText( pMethod );
+ if ( aEntryMethod == aMethod )
+ {
+ pFunctionListBox->Select( pMethod );
+ pFunctionListBox->MakeVisible( pMethod );
+ return;
+ }
+ pMethod = pFunctionListBox->Next( pMethod );
+ }
+ }
+ pMod = NextSibling( pMod );
+ }
+ }
+ pLib = NextSibling( pLib );
+ }
+ }
+ pEntry = NextSibling( pEntry );
+ }
+}
diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx
new file mode 100644
index 000000000000..f103bc077d7f
--- /dev/null
+++ b/cui/source/customize/eventdlg.cxx
@@ -0,0 +1,250 @@
+/*************************************************************************
+ *
+ * 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: eventdlg.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ***************************************************************
+#include <svtools/svmedit.hxx>
+#include <tools/diagnose_ex.h>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/documentinfo.hxx>
+#include <unotools/configmgr.hxx>
+#include <rtl/ustring.hxx>
+
+#include "eventdlg.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/evntconf.hxx>
+#include <sfx2/macrconf.hxx>
+#include <sfx2/minfitem.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfac.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <unotools/eventcfg.hxx>
+
+#include "headertablistbox.hxx"
+#include "macropg_impl.hxx"
+
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include "eventdlg.hrc"
+#include "helpid.hrc"
+#include "selector.hxx"
+#include "cfg.hxx"
+
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+// -----------------------------------------------------------------------
+
+SvxEventConfigPage::SvxEventConfigPage( Window *pParent, const SfxItemSet& rSet, SvxEventConfigPage::EarlyInit ) :
+
+ _SvxMacroTabPage( pParent, SVX_RES(RID_SVXPAGE_EVENTS), rSet ),
+ aSaveInText( this, SVX_RES( TXT_SAVEIN ) ),
+ aSaveInListBox( this, SVX_RES( LB_SAVEIN ) ),
+ bAppConfig ( TRUE )
+{
+ mpImpl->pStrEvent = new String( SVX_RES( STR_EVENT ));
+ mpImpl->pAssignedMacro = new String( SVX_RES( STR_ASSMACRO ));
+ mpImpl->pEventLB = new _HeaderTabListBox( this, SVX_RES( LB_EVENT ));
+ mpImpl->pAssignFT = new FixedText( this, SVX_RES( FT_ASSIGN ));
+ mpImpl->pAssignPB = new PushButton( this, SVX_RES( PB_ASSIGN ));
+ mpImpl->pDeletePB = new PushButton( this, SVX_RES( PB_DELETE ));
+ mpImpl->pMacroImg = new Image( SVX_RES( IMG_MACRO) );
+ mpImpl->pComponentImg = new Image( SVX_RES( IMG_COMPONENT) );
+ mpImpl->pMacroImg_h = new Image( SVX_RES( IMG_MACRO_H) );
+ mpImpl->pComponentImg_h = new Image( SVX_RES( IMG_COMPONENT_H) );
+
+ FreeResource();
+
+ // must be done after FreeResource is called
+ InitResources();
+
+ mpImpl->pEventLB->GetListBox().SetHelpId( HID_SVX_MACRO_LB_EVENT );
+
+ aSaveInListBox.SetSelectHdl( LINK( this, SvxEventConfigPage,
+ SelectHdl_Impl ) );
+
+ uno::Reference< document::XEventsSupplier > xSupplier;
+
+// xSupplier = uno::Reference< document::XEventsSupplier >( new GlobalEventConfig());
+ xSupplier = uno::Reference< document::XEventsSupplier > (
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.frame.GlobalEventBroadcaster" ) ),
+ uno::UNO_QUERY );
+
+ USHORT nPos(0);
+ if ( xSupplier.is() )
+ {
+ m_xAppEvents = xSupplier->getEvents();
+ OUString label;
+ utl::ConfigManager::GetDirectConfigProperty(
+ utl::ConfigManager::PRODUCTNAME ) >>= label;
+ nPos = aSaveInListBox.InsertEntry( label );
+ aSaveInListBox.SetEntryData( nPos, new bool(true) );
+ aSaveInListBox.SelectEntryPos( nPos, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+void SvxEventConfigPage::LateInit( const uno::Reference< frame::XFrame >& _rxFrame )
+{
+ SetFrame( _rxFrame );
+ ImplInitDocument();
+
+ InitAndSetHandler( m_xAppEvents, m_xDocumentEvents, m_xDocumentModifiable );
+
+ SelectHdl_Impl( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+SvxEventConfigPage::~SvxEventConfigPage()
+{
+ //DF Do I need to delete bools?
+}
+
+// -----------------------------------------------------------------------
+
+void SvxEventConfigPage::ImplInitDocument()
+{
+ uno::Reference< frame::XFrame > xFrame( GetFrame() );
+ OUString aModuleId = SvxConfigPage::GetFrameWithDefaultAndIdentify( xFrame );
+ if ( !xFrame.is() )
+ return;
+
+ try
+ {
+ uno::Reference< frame::XModel > xModel;
+ if ( !SvxConfigPage::CanConfig( aModuleId ) )
+ return;
+
+ uno::Reference< frame::XController > xController =
+ xFrame->getController();
+
+ if ( xController.is() )
+ {
+ xModel = xController->getModel();
+ }
+
+ if ( !xModel.is() )
+ return;
+
+ uno::Reference< document::XEventsSupplier > xSupplier( xModel, uno::UNO_QUERY );
+
+ if ( xSupplier.is() )
+ {
+ m_xDocumentEvents = xSupplier->getEvents();
+ m_xDocumentModifiable = m_xDocumentModifiable.query( xModel );
+
+ OUString aTitle = ::comphelper::DocumentInfo::getDocumentTitle( xModel );
+ USHORT nPos = aSaveInListBox.InsertEntry( aTitle );
+
+ aSaveInListBox.SetEntryData( nPos, new bool(false) );
+ aSaveInListBox.SelectEntryPos( nPos, TRUE );
+
+ bAppConfig = false;
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxEventConfigPage, SelectHdl_Impl, ListBox *, pBox )
+{
+ (void)pBox;
+
+ bool* bApp = (bool*) aSaveInListBox.GetEntryData(
+ aSaveInListBox.GetSelectEntryPos());
+
+ mpImpl->pEventLB->SetUpdateMode( FALSE );
+ bAppConfig = *bApp;
+ if ( *bApp )
+ {
+ SetReadOnly( FALSE );
+ _SvxMacroTabPage::DisplayAppEvents( true );
+ }
+ else
+ {
+ bool isReadonly = FALSE;
+
+ uno::Reference< frame::XFramesSupplier > xFramesSupplier(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ),
+ uno::UNO_QUERY );
+
+ uno::Reference< frame::XFrame > xFrame =
+ xFramesSupplier->getActiveFrame();
+
+ if ( xFrame.is() )
+ {
+ uno::Reference< frame::XController > xController =
+ xFrame->getController();
+
+ if ( xController.is() )
+ {
+ uno::Reference< frame::XStorable > xStorable(
+ xController->getModel(), uno::UNO_QUERY );
+ isReadonly = xStorable->isReadonly();
+ }
+ }
+
+ SetReadOnly( isReadonly );
+ _SvxMacroTabPage::DisplayAppEvents( false );
+ }
+
+ mpImpl->pEventLB->SetUpdateMode( TRUE );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxEventConfigPage::FillItemSet( SfxItemSet& rSet )
+{
+ return _SvxMacroTabPage::FillItemSet( rSet );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxEventConfigPage::Reset( const SfxItemSet& )
+{
+ _SvxMacroTabPage::Reset();
+}
+
diff --git a/cui/source/customize/eventdlg.hrc b/cui/source/customize/eventdlg.hrc
new file mode 100644
index 000000000000..245ff183313e
--- /dev/null
+++ b/cui/source/customize/eventdlg.hrc
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * 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: eventdlg.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 header file */
+
+ ////DF temp to figure out what's needed from these
+//DF #include "sfx.hrc"
+#include <svx/dialogs.hrc>
+#include "macropg.hrc"
+
+#define TXT_SAVEIN 10
+#define LB_SAVEIN 11
+
+#define MB_CONFIG 17
+#define CB_WARNING 18
+#define CB_WARNING_ALWAYS 19
+#define GB_SAFETY 20
+#define ID_APP 21
+#define ID_DOC 22
diff --git a/cui/source/customize/eventdlg.hxx b/cui/source/customize/eventdlg.hxx
new file mode 100644
index 000000000000..37fc58ea7639
--- /dev/null
+++ b/cui/source/customize/eventdlg.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * 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: eventdlg.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _EVENTDLG_HXX
+#define _EVENTDLG_HXX
+
+#include <vcl/menubtn.hxx>
+
+#include <vcl/fixed.hxx>
+#include <sfx2/evntconf.hxx>
+#include "macropg.hxx"
+
+#include <com/sun/star/frame/XFrame.hpp>
+
+class Menu;
+class SfxMacroInfoItem;
+class SvxMacroItem;
+
+class SvxEventConfigPage : public _SvxMacroTabPage
+{
+ FixedText aSaveInText;
+ ListBox aSaveInListBox;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocumentEvents;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > m_xDocumentModifiable;
+
+ BOOL bAppConfig;
+
+ DECL_LINK( SelectHdl_Impl, ListBox* );
+
+ // Forbidden and not implemented.
+ SvxEventConfigPage (const SvxEventConfigPage &);
+ SvxEventConfigPage & operator= (const SvxEventConfigPage &);
+
+public:
+ /// this is only to let callers know that there is a LateInit which *must* be called
+ struct EarlyInit { };
+ SvxEventConfigPage( Window *pParent, const SfxItemSet& rSet, EarlyInit );
+ ~SvxEventConfigPage();
+
+ void LateInit( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame );
+
+protected:
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+ using _SvxMacroTabPage::Reset;
+
+private:
+ void ImplInitDocument();
+};
+
+
+#endif
+
diff --git a/cui/source/customize/eventdlg.src b/cui/source/customize/eventdlg.src
new file mode 100644
index 000000000000..8c16b8f45d56
--- /dev/null
+++ b/cui/source/customize/eventdlg.src
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * 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: eventdlg.src,v $
+ * $Revision: 1.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 "helpid.hrc"
+#include "eventdlg.hrc"
+
+#define MASKCOLOR MaskColor = \
+ Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+ // TP_CONFIG_EVENT -------------------------------------------------------
+TabPage RID_SVXPAGE_EVENTS
+{
+ HelpId = HID_SVX_CONFIG_EVENT ;
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 272 , 258 ) ;
+ String STR_EVENT
+ {
+ Text [ en-US ] = "Event" ;
+ };
+ String STR_ASSMACRO
+ {
+ Text [ en-US ] = "Assigned Action" ;
+ };
+ Control LB_EVENT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 205 , 229 ) ;
+ TabStop = TRUE ;
+ HelpID = HID_SVX_MACRO_LB_EVENT ;
+ };
+ FixedText TXT_SAVEIN
+ {
+ Pos = MAP_APPFONT ( 6 , 240 ) ;
+ Size = MAP_APPFONT ( 55 , 8 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "Save In" ;
+ };
+ ListBox LB_SAVEIN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 54 , 238 ) ;
+ Size = MAP_APPFONT ( 132 , 53 ) ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_ASSIGN
+ {
+ Pos = MAP_APPFONT ( 217, ROW0 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Assign:" ;
+ };
+ PushButton PB_ASSIGN
+ {
+ Pos = MAP_APPFONT ( 217 , ROW0A ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "M~acro..." ;
+ };
+ PushButton PB_DELETE
+ {
+ Pos = MAP_APPFONT ( 217 , ROW0A+RSC_CD_PUSHBUTTON_HEIGHT+12 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "~Remove" ;
+ };
+ Image IMG_MACRO
+ {
+ ImageBitmap = Bitmap { File = "id018.png"; };
+ MASKCOLOR
+ };
+ Image IMG_COMPONENT
+ {
+ ImageBitmap = Bitmap { File = "component_16.png"; };
+ MASKCOLOR
+ };
+ Image IMG_MACRO_H
+ {
+ ImageBitmap = Bitmap { File = "idh018.png"; };
+ MASKCOLOR
+ };
+ Image IMG_COMPONENT_H
+ {
+ ImageBitmap = Bitmap { File = "component_16_h.png"; };
+ MASKCOLOR
+ };
+};
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
new file mode 100644
index 000000000000..d215de1ee9fb
--- /dev/null
+++ b/cui/source/customize/macropg.cxx
@@ -0,0 +1,1054 @@
+/*************************************************************************
+ *
+ * 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: macropg.cxx,v $
+ * $Revision: 1.22.166.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <basic/basmgr.hxx>
+
+#include "macropg.hxx"
+#include <vcl/msgbox.hxx>
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#include <svtools/svmedit.hxx>
+#include <svl/eitem.hxx>
+#include <tools/diagnose_ex.h>
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/macrconf.hxx>
+#include <sfx2/sfxdefs.hxx>
+#include <com/sun/star/container/NoSuchElementException.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <svx/dialmgr.hxx>
+#include "selector.hxx"
+#include "cfg.hxx"
+#include "macropg.hrc"
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include "headertablistbox.hxx"
+#include "macropg_impl.hxx"
+
+#include <comphelper/namedvaluecollection.hxx>
+
+#include <algorithm>
+#include <set>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+static ::rtl::OUString aVndSunStarUNO =
+ ::rtl::OUString::createFromAscii( "vnd.sun.star.UNO:" );
+static ::rtl::OUString aVndSunStarScript =
+ ::rtl::OUString::createFromAscii( "vnd.sun.star.script:" );
+
+_SvxMacroTabPage_Impl::_SvxMacroTabPage_Impl( const SfxItemSet& rAttrSet ) :
+ pAssignFT( NULL ),
+ pAssignPB( NULL ),
+ pAssignComponentPB( NULL ),
+ pDeletePB( NULL ),
+ pMacroImg( NULL ),
+ pComponentImg( NULL ),
+ pMacroImg_h( NULL ),
+ pComponentImg_h( NULL ),
+ pStrEvent( NULL ),
+ pAssignedMacro( NULL ),
+ pEventLB( NULL ),
+ bReadOnly( FALSE ),
+ bIDEDialogMode( FALSE )
+{
+ const SfxPoolItem* pItem;
+ if ( SFX_ITEM_SET == rAttrSet.GetItemState( SID_ATTR_MACROITEM, FALSE, &pItem ) )
+ bIDEDialogMode = ((const SfxBoolItem*)pItem)->GetValue();
+}
+
+_SvxMacroTabPage_Impl::~_SvxMacroTabPage_Impl()
+{
+ delete pAssignFT;
+ delete pAssignPB;
+ delete pAssignComponentPB;
+ delete pDeletePB;
+ delete pMacroImg;
+ delete pComponentImg;
+ delete pMacroImg_h;
+ delete pComponentImg_h;
+ delete pStrEvent;
+ delete pAssignedMacro;
+ delete pEventLB;
+}
+
+// Achtung im Code wird dieses Array direkt (0, 1, ...) indiziert
+static long nTabs[] =
+ {
+ 2, // Number of Tabs
+ 0, 90
+ };
+
+#define TAB_WIDTH_MIN 10
+
+// IDs for items in HeaderBar of EventLB
+#define ITEMID_EVENT 1
+#define ITMEID_ASSMACRO 2
+
+
+#define LB_EVENTS_ITEMPOS 1
+#define LB_MACROS_ITEMPOS 2
+
+
+IMPL_LINK( _HeaderTabListBox, HeaderEndDrag_Impl, HeaderBar*, pBar )
+{
+ DBG_ASSERT( pBar == &maHeaderBar, "*_HeaderTabListBox::HeaderEndDrag_Impl: something is wrong here..." );
+ (void)pBar;
+
+ if( !maHeaderBar.GetCurItemId() )
+ return 0;
+
+ if( !maHeaderBar.IsItemMode() )
+ {
+ Size aSz;
+ USHORT _nTabs = maHeaderBar.GetItemCount();
+ long nTmpSz = 0;
+ long nWidth = maHeaderBar.GetItemSize( ITEMID_EVENT );
+ long nBarWidth = maHeaderBar.GetSizePixel().Width();
+
+ if( nWidth < TAB_WIDTH_MIN )
+ maHeaderBar.SetItemSize( ITEMID_EVENT, TAB_WIDTH_MIN );
+ else if( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN )
+ maHeaderBar.SetItemSize( ITEMID_EVENT, nBarWidth - TAB_WIDTH_MIN );
+
+ {
+ long _nWidth;
+ for( USHORT i = 1 ; i < _nTabs ; ++i )
+ {
+ _nWidth = maHeaderBar.GetItemSize( i );
+ aSz.Width() = _nWidth + nTmpSz;
+ nTmpSz += _nWidth;
+ maListBox.SetTab( i, PixelToLogic( aSz, MapMode( MAP_APPFONT ) ).Width(), MAP_APPFONT );
+ }
+ }
+ }
+ return 1;
+}
+
+long _HeaderTabListBox::Notify( NotifyEvent& rNEvt )
+{
+ long nRet = Control::Notify( rNEvt );
+
+ if( rNEvt.GetType() == EVENT_GETFOCUS )
+ {
+ if ( rNEvt.GetWindow() != &maListBox )
+ maListBox.GrabFocus();
+ }
+
+ return nRet;
+}
+
+_HeaderTabListBox::_HeaderTabListBox( Window* pParent, const ResId& rId ) :
+ Control( pParent, rId ),
+ maListBox( this, WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ),
+ maHeaderBar( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER )
+{
+// maListBox.SetWindowBits( WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP );
+}
+
+_HeaderTabListBox::~_HeaderTabListBox()
+{
+}
+
+void _HeaderTabListBox::ConnectElements( void )
+{
+ // calc pos and size of header bar
+ Point aPnt( 0, 0 );
+ Size aSize( maHeaderBar.CalcWindowSizePixel() );
+ Size aCtrlSize( GetOutputSizePixel() );
+ aSize.Width() = aCtrlSize.Width();
+ maHeaderBar.SetPosSizePixel( aPnt, aSize );
+
+ // calc pos and size of ListBox
+ aPnt.Y() += aSize.Height();
+ aSize.Height() = aCtrlSize.Height() - aSize.Height();
+ maListBox.SetPosSizePixel( aPnt, aSize );
+
+ // set handler
+ maHeaderBar.SetEndDragHdl( LINK( this, _HeaderTabListBox, HeaderEndDrag_Impl ) );
+
+ maListBox.InitHeaderBar( &maHeaderBar );
+}
+
+void _HeaderTabListBox::Show( BOOL bVisible, USHORT nFlags )
+{
+ maListBox.Show( bVisible, nFlags );
+ maHeaderBar.Show( bVisible, nFlags );
+}
+
+void _HeaderTabListBox::Enable( bool bEnable, bool bChild )
+{
+ maListBox.Enable( bEnable, bChild );
+ maHeaderBar.Enable( bEnable, bChild );
+}
+
+// assign button ("Add Command") is enabled only if it is not read only
+// delete button ("Remove Command") is enabled if a current binding exists
+// and it is not read only
+void _SvxMacroTabPage::EnableButtons( const String& /*rLangName*/ )
+{
+ const SvLBoxEntry* pE = mpImpl->pEventLB->GetListBox().FirstSelected();
+ if ( pE )
+ {
+ SvLBoxString* pEventMacro = (SvLBoxString*)pE->GetItem( LB_MACROS_ITEMPOS );
+ mpImpl->pDeletePB->Enable( 0 != pEventMacro && !mpImpl->bReadOnly );
+
+ mpImpl->pAssignPB->Enable( !mpImpl->bReadOnly );
+ if( mpImpl->pAssignComponentPB )
+ mpImpl->pAssignComponentPB->Enable( !mpImpl->bReadOnly );
+ }
+}
+
+_SvxMacroTabPage::_SvxMacroTabPage( Window* pParent, const ResId& rResId, const SfxItemSet& rAttrSet )
+ : SfxTabPage( pParent, rResId, rAttrSet ),
+ m_xAppEvents(0),
+ m_xDocEvents(0),
+ bReadOnly(false),
+ bDocModified(false),
+ bAppEvents(false),
+ bInitialized(false)
+{
+ mpImpl = new _SvxMacroTabPage_Impl( rAttrSet );
+}
+
+_SvxMacroTabPage::~_SvxMacroTabPage()
+{
+ // need to delete the user data
+ SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox();
+ SvLBoxEntry* pE = rListBox.GetEntry( 0 );
+ while( pE )
+ {
+ ::rtl::OUString* pEventName = (::rtl::OUString*)pE->GetUserData();
+ delete pEventName;
+ pE->SetUserData((void*)0);
+ pE = rListBox.NextSibling( pE );
+ }
+ DELETEZ( mpImpl );
+}
+// -----------------------------------------------------------------------------
+void _SvxMacroTabPage::InitResources()
+{
+ // Note: the order here controls the order in which the events are displayed in the UI!
+
+ // the event name to UI string mappings for App Events
+ aDisplayNames.push_back( EventDisplayName( "OnStartApp", RID_SVXSTR_EVENT_STARTAPP ) );
+ aDisplayNames.push_back( EventDisplayName( "OnCloseApp", RID_SVXSTR_EVENT_CLOSEAPP ) );
+ aDisplayNames.push_back( EventDisplayName( "OnCreate", RID_SVXSTR_EVENT_CREATEDOC ) );
+ aDisplayNames.push_back( EventDisplayName( "OnNew", RID_SVXSTR_EVENT_NEWDOC ) );
+ aDisplayNames.push_back( EventDisplayName( "OnLoadFinished", RID_SVXSTR_EVENT_LOADDOCFINISHED ) );
+ aDisplayNames.push_back( EventDisplayName( "OnLoad", RID_SVXSTR_EVENT_OPENDOC ) );
+ aDisplayNames.push_back( EventDisplayName( "OnPrepareUnload", RID_SVXSTR_EVENT_PREPARECLOSEDOC ) );
+ aDisplayNames.push_back( EventDisplayName( "OnUnload", RID_SVXSTR_EVENT_CLOSEDOC ) ) ;
+ aDisplayNames.push_back( EventDisplayName( "OnViewCreated", RID_SVXSTR_EVENT_VIEWCREATED ) );
+ aDisplayNames.push_back( EventDisplayName( "OnPrepareViewClosing", RID_SVXSTR_EVENT_PREPARECLOSEVIEW ) );
+ aDisplayNames.push_back( EventDisplayName( "OnViewClosed", RID_SVXSTR_EVENT_CLOSEVIEW ) ) ;
+ aDisplayNames.push_back( EventDisplayName( "OnFocus", RID_SVXSTR_EVENT_ACTIVATEDOC ) );
+ aDisplayNames.push_back( EventDisplayName( "OnUnfocus", RID_SVXSTR_EVENT_DEACTIVATEDOC ) );
+ aDisplayNames.push_back( EventDisplayName( "OnSave", RID_SVXSTR_EVENT_SAVEDOC ) );
+ aDisplayNames.push_back( EventDisplayName( "OnSaveDone", RID_SVXSTR_EVENT_SAVEDOCDONE ) );
+ aDisplayNames.push_back( EventDisplayName( "OnSaveFailed", RID_SVXSTR_EVENT_SAVEDOCFAILED ) );
+ aDisplayNames.push_back( EventDisplayName( "OnSaveAs", RID_SVXSTR_EVENT_SAVEASDOC ) );
+ aDisplayNames.push_back( EventDisplayName( "OnSaveAsDone", RID_SVXSTR_EVENT_SAVEASDOCDONE ) );
+ aDisplayNames.push_back( EventDisplayName( "OnSaveAsFailed", RID_SVXSTR_EVENT_SAVEASDOCFAILED ) );
+ aDisplayNames.push_back( EventDisplayName( "OnCopyTo", RID_SVXSTR_EVENT_COPYTODOC ) );
+ aDisplayNames.push_back( EventDisplayName( "OnCopyToDone", RID_SVXSTR_EVENT_COPYTODOCDONE ) );
+ aDisplayNames.push_back( EventDisplayName( "OnCopyToFailed", RID_SVXSTR_EVENT_COPYTODOCFAILED ) );
+ aDisplayNames.push_back( EventDisplayName( "OnPrint", RID_SVXSTR_EVENT_PRINTDOC ) );
+ aDisplayNames.push_back( EventDisplayName( "OnModifyChanged", RID_SVXSTR_EVENT_MODIFYCHANGED ) );
+ aDisplayNames.push_back( EventDisplayName( "OnTitleChanged", RID_SVXSTR_EVENT_TITLECHANGED ) );
+// aDisplayNames.push_back( EventDisplayName( "OnModeChanged", RID_SVXSTR_EVENT_MODECHANGED ) );
+// aDisplayNames.push_back( EventDisplayName( "OnVisAreaChanged", RID_SVXSTR_EVENT_VISAREACHANGED ) );
+// aDisplayNames.push_back( EventDisplayName( "OnStorageChanged", RID_SVXSTR_EVENT_STORAGECHANGED ) );
+
+ // application specific events
+ aDisplayNames.push_back( EventDisplayName( "OnMailMerge", RID_SVXSTR_EVENT_MAILMERGE ) );
+ aDisplayNames.push_back( EventDisplayName( "OnMailMergeFinished", RID_SVXSTR_EVENT_MAILMERGE_END ) );
+ aDisplayNames.push_back( EventDisplayName( "OnFieldMerge", RID_SVXSTR_EVENT_FIELDMERGE ) );
+ aDisplayNames.push_back( EventDisplayName( "OnFieldMergeFinished", RID_SVXSTR_EVENT_FIELDMERGE_FINISHED ) );
+ aDisplayNames.push_back( EventDisplayName( "OnPageCountChange", RID_SVXSTR_EVENT_PAGECOUNTCHANGE ) );
+ aDisplayNames.push_back( EventDisplayName( "OnSubComponentOpened", RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED ) );
+ aDisplayNames.push_back( EventDisplayName( "OnSubComponentClosed", RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED ) );
+// aDisplayNames.push_back( EventDisplayName( "OnLayoutFinished", RID_SVXSTR_EVENT_LAYOUT_FINISHED ) );
+
+ // the event name to UI string mappings for forms & dialogs
+ //
+ aDisplayNames.push_back( EventDisplayName( "approveAction", RID_SVXSTR_EVENT_APPROVEACTIONPERFORMED ) );
+ aDisplayNames.push_back( EventDisplayName( "actionPerformed", RID_SVXSTR_EVENT_ACTIONPERFORMED ) );
+ aDisplayNames.push_back( EventDisplayName( "changed", RID_SVXSTR_EVENT_CHANGED ) );
+ aDisplayNames.push_back( EventDisplayName( "textChanged", RID_SVXSTR_EVENT_TEXTCHANGED ) );
+ aDisplayNames.push_back( EventDisplayName( "itemStateChanged", RID_SVXSTR_EVENT_ITEMSTATECHANGED ) );
+ aDisplayNames.push_back( EventDisplayName( "focusGained", RID_SVXSTR_EVENT_FOCUSGAINED ) );
+ aDisplayNames.push_back( EventDisplayName( "focusLost", RID_SVXSTR_EVENT_FOCUSLOST ) );
+ aDisplayNames.push_back( EventDisplayName( "keyPressed", RID_SVXSTR_EVENT_KEYTYPED ) );
+ aDisplayNames.push_back( EventDisplayName( "keyReleased", RID_SVXSTR_EVENT_KEYUP ) );
+ aDisplayNames.push_back( EventDisplayName( "mouseEntered", RID_SVXSTR_EVENT_MOUSEENTERED ) );
+ aDisplayNames.push_back( EventDisplayName( "mouseDragged", RID_SVXSTR_EVENT_MOUSEDRAGGED ) );
+ aDisplayNames.push_back( EventDisplayName( "mouseMoved", RID_SVXSTR_EVENT_MOUSEMOVED ) );
+ aDisplayNames.push_back( EventDisplayName( "mousePressed", RID_SVXSTR_EVENT_MOUSEPRESSED ) );
+ aDisplayNames.push_back( EventDisplayName( "mouseReleased", RID_SVXSTR_EVENT_MOUSERELEASED ) );
+ aDisplayNames.push_back( EventDisplayName( "mouseExited", RID_SVXSTR_EVENT_MOUSEEXITED ) );
+ aDisplayNames.push_back( EventDisplayName( "approveReset", RID_SVXSTR_EVENT_APPROVERESETTED ) );
+ aDisplayNames.push_back( EventDisplayName( "resetted", RID_SVXSTR_EVENT_RESETTED ) );
+ aDisplayNames.push_back( EventDisplayName( "approveSubmit", RID_SVXSTR_EVENT_SUBMITTED ) );
+ aDisplayNames.push_back( EventDisplayName( "approveUpdate", RID_SVXSTR_EVENT_BEFOREUPDATE ) );
+ aDisplayNames.push_back( EventDisplayName( "updated", RID_SVXSTR_EVENT_AFTERUPDATE ) );
+ aDisplayNames.push_back( EventDisplayName( "loaded", RID_SVXSTR_EVENT_LOADED ) );
+ aDisplayNames.push_back( EventDisplayName( "reloading", RID_SVXSTR_EVENT_RELOADING ) );
+ aDisplayNames.push_back( EventDisplayName( "reloaded", RID_SVXSTR_EVENT_RELOADED ) );
+ aDisplayNames.push_back( EventDisplayName( "unloading", RID_SVXSTR_EVENT_UNLOADING ) );
+ aDisplayNames.push_back( EventDisplayName( "unloaded", RID_SVXSTR_EVENT_UNLOADED ) );
+ aDisplayNames.push_back( EventDisplayName( "confirmDelete", RID_SVXSTR_EVENT_CONFIRMDELETE ) );
+ aDisplayNames.push_back( EventDisplayName( "approveRowChange", RID_SVXSTR_EVENT_APPROVEROWCHANGE ) );
+ aDisplayNames.push_back( EventDisplayName( "rowChanged", RID_SVXSTR_EVENT_ROWCHANGE ) );
+ aDisplayNames.push_back( EventDisplayName( "approveCursorMove", RID_SVXSTR_EVENT_POSITIONING ) );
+ aDisplayNames.push_back( EventDisplayName( "cursorMoved", RID_SVXSTR_EVENT_POSITIONED ) );
+ aDisplayNames.push_back( EventDisplayName( "approveParameter", RID_SVXSTR_EVENT_APPROVEPARAMETER ) );
+ aDisplayNames.push_back( EventDisplayName( "errorOccured", RID_SVXSTR_EVENT_ERROROCCURED ) );
+ aDisplayNames.push_back( EventDisplayName( "adjustmentValueChanged", RID_SVXSTR_EVENT_ADJUSTMENTVALUECHANGED ) );
+}
+
+// the following method is called when the user clicks OK
+// We use the contents of the hashes to replace the settings
+BOOL _SvxMacroTabPage::FillItemSet( SfxItemSet& /*rSet*/ )
+{
+ try
+ {
+ ::rtl::OUString eventName;
+ if( m_xAppEvents.is() )
+ {
+ EventsHash::iterator h_itEnd = m_appEventsHash.end();
+ EventsHash::iterator h_it = m_appEventsHash.begin();
+ for ( ; h_it != h_itEnd; ++h_it )
+ {
+ eventName = h_it->first;
+ try
+ {
+ m_xAppEvents->replaceByName( eventName, GetPropsByName( eventName, m_appEventsHash ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ if( m_xDocEvents.is() && bDocModified )
+ {
+ EventsHash::iterator h_itEnd = m_docEventsHash.end();
+ EventsHash::iterator h_it = m_docEventsHash.begin();
+ for ( ; h_it != h_itEnd; ++h_it )
+ {
+ eventName = h_it->first;
+ try
+ {
+ m_xDocEvents->replaceByName( eventName, GetPropsByName( eventName, m_docEventsHash ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ // if we have a valid XModifiable (in the case of doc events)
+ // call setModified(true)
+ // in principle this should not be necessary (see issue ??)
+ if(m_xModifiable.is())
+ {
+ m_xModifiable->setModified( sal_True );
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ }
+ // what is the return value about??
+ return FALSE;
+}
+
+// the following method clears the bindings in the hashes for both doc & app
+void _SvxMacroTabPage::Reset()
+{
+ // called once in creation - don't reset the data this time
+ if(!bInitialized)
+ {
+ bInitialized = true;
+ return;
+ }
+
+ try
+ {
+ ::rtl::OUString sEmpty;
+ if( m_xAppEvents.is() )
+ {
+ EventsHash::iterator h_itEnd = m_appEventsHash.end();
+ EventsHash::iterator h_it = m_appEventsHash.begin();
+ for ( ; h_it != h_itEnd; ++h_it )
+ {
+ h_it->second.second = sEmpty;
+ }
+ }
+ if( m_xDocEvents.is() && bDocModified )
+ {
+ EventsHash::iterator h_itEnd = m_docEventsHash.end();
+ EventsHash::iterator h_it = m_docEventsHash.begin();
+ for ( ; h_it != h_itEnd; ++h_it )
+ {
+ h_it->second.second = sEmpty;
+ }
+ // if we have a valid XModifiable (in the case of doc events)
+ // call setModified(true)
+ if(m_xModifiable.is())
+ {
+ m_xModifiable->setModified( sal_True );
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ }
+ DisplayAppEvents(bAppEvents);
+}
+
+void _SvxMacroTabPage::SetReadOnly( BOOL bSet )
+{
+ mpImpl->bReadOnly = bSet;
+}
+
+BOOL _SvxMacroTabPage::IsReadOnly() const
+{
+ return mpImpl->bReadOnly;
+}
+
+
+class IconLBoxString : public SvLBoxString
+{
+ Image* m_pMacroImg;
+ Image* m_pComponentImg;
+ Image* m_pMacroImg_h;
+ Image* m_pComponentImg_h;
+ int m_nxImageOffset;
+
+ public:
+ IconLBoxString( SvLBoxEntry* pEntry, USHORT nFlags, const String& sText,
+ Image* pMacroImg, Image* pComponentImg,
+ Image* pMacroImg_h, Image* pComponentImg_h );
+ virtual void Paint(const Point& aPos, SvLBox& aDevice, USHORT nFlags, SvLBoxEntry* pEntry );
+};
+
+
+IconLBoxString::IconLBoxString( SvLBoxEntry* pEntry, USHORT nFlags, const String& sText,
+ Image* pMacroImg, Image* pComponentImg, Image* pMacroImg_h, Image* pComponentImg_h )
+ : SvLBoxString( pEntry, nFlags, sText )
+ , m_pMacroImg( pMacroImg )
+ , m_pComponentImg( pComponentImg )
+ , m_pMacroImg_h( pMacroImg_h )
+ , m_pComponentImg_h( pComponentImg_h )
+{
+ m_nxImageOffset = 20;
+}
+
+//===============================================
+void IconLBoxString::Paint( const Point& aPos, SvLBox& aDevice,
+ USHORT /*nFlags*/, SvLBoxEntry* /*pEntry*/ )
+{
+ String aTxt( GetText() );
+ if( aTxt.Len() )
+ {
+ ::rtl::OUString aURL( aTxt );
+ sal_Int32 nIndex = aURL.indexOf( aVndSunStarUNO );
+ bool bUNO = nIndex == 0;
+
+ Wallpaper aBackground = aDevice.GetBackground();
+ Color aColor = aBackground.GetColor();
+ BOOL bHC = aColor.IsDark();
+ const Image* pImg;
+ if( bHC )
+ pImg = bUNO ? m_pComponentImg_h : m_pMacroImg_h;
+ else
+ pImg = bUNO ? m_pComponentImg : m_pMacroImg;
+ aDevice.DrawImage( aPos, *pImg );
+
+ ::rtl::OUString aPureMethod;
+ if( bUNO )
+ {
+ sal_Int32 nBegin = aVndSunStarUNO.getLength();
+ aPureMethod = aURL.copy( nBegin );
+ }
+ else
+ {
+ sal_Int32 nBegin = aVndSunStarScript.getLength();
+ aPureMethod = aURL.copy( nBegin );
+ aPureMethod = aPureMethod.copy( 0, aPureMethod.indexOf( '?' ) );
+ }
+
+ Point aPnt(aPos);
+ aPnt.X() += m_nxImageOffset;
+ aDevice.DrawText( aPnt, aPureMethod );
+ }
+}
+
+
+// displays the app events if appEvents=true, otherwise displays the doc events
+void _SvxMacroTabPage::DisplayAppEvents( bool appEvents)
+{
+ bAppEvents = appEvents;
+
+ SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox();
+ mpImpl->pEventLB->SetUpdateMode( FALSE );
+ rListBox.Clear();
+ SvLBoxEntry* pE = rListBox.GetEntry( 0 );
+ EventsHash* eventsHash;
+ Reference< container::XNameReplace> nameReplace;
+ if(bAppEvents)
+ {
+ eventsHash = &m_appEventsHash;
+ nameReplace = m_xAppEvents;
+ }
+ else
+ {
+ eventsHash = &m_docEventsHash;
+ nameReplace = m_xDocEvents;
+ }
+ // have to use the original XNameReplace since the hash iterators do
+ // not guarantee the order in which the elements are returned
+ if(!nameReplace.is())
+ {
+ return;
+ }
+
+ Sequence< ::rtl::OUString > eventNames = nameReplace->getElementNames();
+ ::std::set< ::rtl::OUString > aEventNamesCache;
+ ::std::copy(
+ eventNames.getConstArray(),
+ eventNames.getConstArray() + eventNames.getLength(),
+ ::std::insert_iterator< ::std::set< ::rtl::OUString > >( aEventNamesCache, aEventNamesCache.end() )
+ );
+
+ for ( EventDisplayNames::const_iterator displayableEvent = aDisplayNames.begin();
+ displayableEvent != aDisplayNames.end();
+ ++displayableEvent
+ )
+ {
+ ::rtl::OUString sEventName( ::rtl::OUString::createFromAscii( displayableEvent->pAsciiEventName ) );
+ if ( !nameReplace->hasByName( sEventName ) )
+ continue;
+
+ EventsHash::iterator h_it = eventsHash->find( sEventName );
+ if( h_it == eventsHash->end() )
+ {
+ OSL_ENSURE( false, "_SvxMacroTabPage::DisplayAppEvents: something's suspicious here!" );
+ continue;
+ }
+
+ ::rtl::OUString eventURL = h_it->second.second;
+ String displayName( SVX_RES( displayableEvent->nEventResourceID ) );
+
+ displayName += '\t';
+ SvLBoxEntry* _pE = rListBox.InsertEntry( displayName );
+ ::rtl::OUString* pEventName = new ::rtl::OUString( sEventName );
+ _pE->SetUserData( (void*)pEventName );
+ String sNew( eventURL );
+ _pE->ReplaceItem( new IconLBoxString( _pE, 0, sNew,
+ mpImpl->pMacroImg, mpImpl->pComponentImg,
+ mpImpl->pMacroImg_h, mpImpl->pComponentImg_h ), LB_MACROS_ITEMPOS );
+ rListBox.GetModel()->InvalidateEntry( _pE );
+ rListBox.Select( _pE );
+ rListBox.MakeVisible( _pE );
+ }
+
+ pE = rListBox.GetEntry(0);
+ if( pE )
+ {
+ rListBox.Select( pE );
+ rListBox.MakeVisible( pE );
+ }
+
+ rListBox.SetUpdateMode( TRUE );
+ EnableButtons( String() );
+}
+
+// select event handler on the listbox
+IMPL_STATIC_LINK( _SvxMacroTabPage, SelectEvent_Impl, SvTabListBox*, EMPTYARG )
+{
+ _SvxMacroTabPage_Impl* pImpl = pThis->mpImpl;
+ SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox();
+ SvLBoxEntry* pE = rListBox.FirstSelected();
+ ULONG nPos;
+
+ if( !pE || LISTBOX_ENTRY_NOTFOUND ==
+ ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) )
+ {
+ DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" );
+ return 0;
+ }
+
+ pThis->EnableButtons( String() );
+ return 0;
+}
+
+IMPL_STATIC_LINK( _SvxMacroTabPage, AssignDeleteHdl_Impl, PushButton*, pBtn )
+{
+ return GenericHandler_Impl( pThis, pBtn );
+}
+
+IMPL_STATIC_LINK( _SvxMacroTabPage, DoubleClickHdl_Impl, SvTabListBox *, EMPTYARG )
+{
+ return GenericHandler_Impl( pThis, NULL );
+}
+
+// handler for double click on the listbox, and for the assign/delete buttons
+long _SvxMacroTabPage::GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton* pBtn )
+{
+ _SvxMacroTabPage_Impl* pImpl = pThis->mpImpl;
+ SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox();
+ SvLBoxEntry* pE = rListBox.FirstSelected();
+ ULONG nPos;
+ if( !pE || LISTBOX_ENTRY_NOTFOUND ==
+ ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) )
+ {
+ DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" );
+ return 0;
+ }
+
+ const BOOL bAssEnabled = pBtn != pImpl->pDeletePB && pImpl->pAssignPB->IsEnabled();
+
+ ::rtl::OUString* pEventName = (::rtl::OUString*)pE->GetUserData();
+
+ ::rtl::OUString sEventURL;
+ ::rtl::OUString sEventType;
+ if(pThis->bAppEvents)
+ {
+ EventsHash::iterator h_it = pThis->m_appEventsHash.find( *pEventName );
+ if(h_it != pThis->m_appEventsHash.end() )
+ {
+ sEventType = h_it->second.first;
+ sEventURL = h_it->second.second;
+ }
+ }
+ else
+ {
+ EventsHash::iterator h_it = pThis->m_docEventsHash.find( *pEventName );
+ if(h_it != pThis->m_docEventsHash.end() )
+ {
+ sEventType = h_it->second.first;
+ sEventURL = h_it->second.second;
+ }
+ }
+
+ bool bDoubleClick = (pBtn == NULL);
+ bool bUNOAssigned = (sEventURL.indexOf( aVndSunStarUNO ) == 0);
+ if( pBtn == pImpl->pDeletePB )
+ {
+ // delete pressed
+ sEventType = ::rtl::OUString::createFromAscii("Script");
+ sEventURL = ::rtl::OUString();
+ if(!pThis->bAppEvents)
+ pThis->bDocModified = true;
+ }
+ else if ( ( ( pBtn != NULL )
+ && ( pBtn == pImpl->pAssignComponentPB )
+ )
+ || ( bDoubleClick
+ && bUNOAssigned
+ )
+ )
+ {
+ AssignComponentDialog* pAssignDlg = new AssignComponentDialog( pThis, sEventURL );
+
+ short ret = pAssignDlg->Execute();
+ if( ret )
+ {
+ sEventType = ::rtl::OUString::createFromAscii("UNO");
+ sEventURL = pAssignDlg->getURL();
+ if(!pThis->bAppEvents)
+ pThis->bDocModified = true;
+ }
+ delete pAssignDlg;
+ }
+ else if( bAssEnabled )
+ {
+ // assign pressed
+ SvxScriptSelectorDialog* pDlg = new SvxScriptSelectorDialog( pThis, FALSE, pThis->GetFrame() );
+ if( pDlg )
+ {
+ short ret = pDlg->Execute();
+ if ( ret )
+ {
+ sEventType = ::rtl::OUString::createFromAscii("Script");
+ sEventURL = pDlg->GetScriptURL();
+ if(!pThis->bAppEvents)
+ pThis->bDocModified = true;
+ }
+ }
+ }
+
+ // update the hashes
+ if(pThis->bAppEvents)
+ {
+ EventsHash::iterator h_it = pThis->m_appEventsHash.find( *pEventName );
+ h_it->second.first = sEventType;
+ h_it->second.second = sEventURL;
+ }
+ else
+ {
+ EventsHash::iterator h_it = pThis->m_docEventsHash.find( *pEventName );
+ h_it->second.first = sEventType;
+ h_it->second.second = sEventURL;
+ }
+
+ // update the listbox entry
+ pImpl->pEventLB->SetUpdateMode( FALSE );
+ // pE->ReplaceItem( new SvLBoxString( pE, 0, sEventURL ), LB_MACROS_ITEMPOS );
+ pE->ReplaceItem( new IconLBoxString( pE, 0, sEventURL,
+ pImpl->pMacroImg, pImpl->pComponentImg,
+ pImpl->pMacroImg_h, pImpl->pComponentImg_h ), LB_MACROS_ITEMPOS );
+
+ rListBox.GetModel()->InvalidateEntry( pE );
+ rListBox.Select( pE );
+ rListBox.MakeVisible( pE );
+ rListBox.SetUpdateMode( TRUE );
+
+ pThis->EnableButtons( String() );
+ return 0;
+}
+
+// pass in the XNameReplace.
+// can remove the 3rd arg once issue ?? is fixed
+void _SvxMacroTabPage::InitAndSetHandler( Reference< container::XNameReplace> xAppEvents, Reference< container::XNameReplace> xDocEvents, Reference< util::XModifiable > xModifiable )
+{
+ m_xAppEvents = xAppEvents;
+ m_xDocEvents = xDocEvents;
+ m_xModifiable = xModifiable;
+ SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox();
+ HeaderBar& rHeaderBar = mpImpl->pEventLB->GetHeaderBar();
+ Link aLnk(STATIC_LINK(this, _SvxMacroTabPage, AssignDeleteHdl_Impl ));
+ mpImpl->pDeletePB->SetClickHdl( aLnk );
+ mpImpl->pAssignPB->SetClickHdl( aLnk );
+ if( mpImpl->pAssignComponentPB )
+ mpImpl->pAssignComponentPB->SetClickHdl( aLnk );
+ rListBox.SetDoubleClickHdl( STATIC_LINK(this, _SvxMacroTabPage, DoubleClickHdl_Impl ) );
+
+ rListBox.SetSelectHdl( STATIC_LINK( this, _SvxMacroTabPage, SelectEvent_Impl ));
+
+ rListBox.SetSelectionMode( SINGLE_SELECTION );
+ rListBox.SetTabs( &nTabs[0], MAP_APPFONT );
+ Size aSize( nTabs[ 2 ], 0 );
+ rHeaderBar.InsertItem( ITEMID_EVENT, *mpImpl->pStrEvent, LogicToPixel( aSize, MapMode( MAP_APPFONT ) ).Width() );
+ aSize.Width() = 1764; // don't know what, so 42^2 is best to use...
+ rHeaderBar.InsertItem( ITMEID_ASSMACRO, *mpImpl->pAssignedMacro, LogicToPixel( aSize, MapMode( MAP_APPFONT ) ).Width() );
+ rListBox.SetSpaceBetweenEntries( 0 );
+
+ mpImpl->pEventLB->Show();
+ mpImpl->pEventLB->ConnectElements();
+
+ long nMinLineHeight = mpImpl->pMacroImg->GetSizePixel().Height() + 2;
+ if( nMinLineHeight > mpImpl->pEventLB->GetListBox().GetEntryHeight() )
+ mpImpl->pEventLB->GetListBox().SetEntryHeight(
+ sal::static_int_cast< short >(nMinLineHeight) );
+
+ mpImpl->pEventLB->Enable( TRUE );
+
+ if(!m_xAppEvents.is())
+ {
+ return;
+ }
+ Sequence< ::rtl::OUString > eventNames = m_xAppEvents->getElementNames();
+ sal_Int32 nEventCount = eventNames.getLength();
+ for(sal_Int32 nEvent = 0; nEvent < nEventCount; ++nEvent )
+ {
+ //need exception handling here
+ try
+ {
+ m_appEventsHash[ eventNames[nEvent] ] = GetPairFromAny( m_xAppEvents->getByName( eventNames[nEvent] ) );
+ }
+ catch (Exception e)
+ {}
+ }
+ if(m_xDocEvents.is())
+ {
+ eventNames = m_xDocEvents->getElementNames();
+ nEventCount = eventNames.getLength();
+ for(sal_Int32 nEvent = 0; nEvent < nEventCount; ++nEvent )
+ {
+ try
+ {
+ m_docEventsHash[ eventNames[nEvent] ] = GetPairFromAny( m_xDocEvents->getByName( eventNames[nEvent] ) );
+ }
+ catch (Exception e)
+ {}
+ }
+ }
+}
+
+// returns the two props EventType & Script for a given event name
+Any _SvxMacroTabPage::GetPropsByName( const ::rtl::OUString& eventName, EventsHash& eventsHash )
+{
+ const ::std::pair< ::rtl::OUString, ::rtl::OUString >& rAssignedEvent( eventsHash[ eventName ] );
+
+ Any aReturn;
+ ::comphelper::NamedValueCollection aProps;
+ if ( rAssignedEvent.first.getLength() && rAssignedEvent.second.getLength() )
+ {
+ aProps.put( "EventType", rAssignedEvent.first );
+ aProps.put( "Script", rAssignedEvent.second );
+ }
+ aReturn <<= aProps.getPropertyValues();
+
+ return aReturn;
+}
+
+// converts the Any returned by GetByName into a pair which can be stored in
+// the EventHash
+::std::pair< ::rtl::OUString, ::rtl::OUString > _SvxMacroTabPage::GetPairFromAny( Any aAny )
+{
+ Sequence< beans::PropertyValue > props;
+ ::rtl::OUString type, url;
+ if( sal_True == ( aAny >>= props ) )
+ {
+ ::comphelper::NamedValueCollection aProps( props );
+ type = aProps.getOrDefault( "EventType", type );
+ url = aProps.getOrDefault( "Script", url );
+ }
+ return ::std::make_pair( type, url );
+}
+
+SvxMacroTabPage::SvxMacroTabPage( Window* pParent, const Reference< frame::XFrame >& _rxDocumentFrame, const SfxItemSet& rSet, Reference< container::XNameReplace > xNameReplace, sal_uInt16 nSelectedIndex )
+ : _SvxMacroTabPage( pParent, SVX_RES( RID_SVXPAGE_MACROASSIGN ), rSet )
+{
+ mpImpl->pStrEvent = new String( SVX_RES( STR_EVENT ) );
+ mpImpl->pAssignedMacro = new String( SVX_RES( STR_ASSMACRO ) );
+ mpImpl->pEventLB = new _HeaderTabListBox( this, SVX_RES( LB_EVENT ) );
+ mpImpl->pAssignFT = new FixedText( this, SVX_RES( FT_ASSIGN ) );
+ mpImpl->pAssignPB = new PushButton( this, SVX_RES( PB_ASSIGN ) );
+ mpImpl->pDeletePB = new PushButton( this, SVX_RES( PB_DELETE ) );
+ mpImpl->pAssignComponentPB = new PushButton( this, SVX_RES( PB_ASSIGN_COMPONENT ) );
+ mpImpl->pMacroImg = new Image( SVX_RES(IMG_MACRO) );
+ mpImpl->pComponentImg = new Image( SVX_RES(IMG_COMPONENT) );
+ mpImpl->pMacroImg_h = new Image( SVX_RES(IMG_MACRO_H) );
+ mpImpl->pComponentImg_h = new Image( SVX_RES(IMG_COMPONENT_H) );
+
+ FreeResource();
+
+ SetFrame( _rxDocumentFrame );
+
+ if( !mpImpl->bIDEDialogMode )
+ {
+ // Size aSizeAssign;
+ // Point aPosAssign;
+ // mpImpl->pAssignPB->GetPosSizePixel( aPosAssign, aSizeAssign );
+ Point aPosAssign = mpImpl->pAssignPB->GetPosPixel();
+ Point aPosComp = mpImpl->pAssignComponentPB->GetPosPixel();
+
+ Point aPosDelete = mpImpl->pDeletePB->GetPosPixel();
+ long nYDiff = aPosComp.Y() - aPosAssign.Y();
+ aPosDelete.Y() -= nYDiff;
+ mpImpl->pDeletePB->SetPosPixel( aPosDelete );
+
+ mpImpl->pAssignComponentPB->Hide();
+ mpImpl->pAssignComponentPB->Disable();
+ }
+
+ // must be done after FreeResource is called
+ InitResources();
+
+ mpImpl->pEventLB->GetListBox().SetHelpId( HID_SVX_MACRO_LB_EVENT );
+
+ InitAndSetHandler( xNameReplace, Reference< container::XNameReplace>(0), Reference< util::XModifiable >(0));
+ DisplayAppEvents(true);
+ SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox();
+ SvLBoxEntry* pE = rListBox.GetEntry( (ULONG)nSelectedIndex );
+ if( pE )
+ rListBox.Select(pE);
+}
+
+SvxMacroTabPage::~SvxMacroTabPage()
+{
+}
+
+SvxMacroAssignDlg::SvxMacroAssignDlg( Window* pParent, const Reference< frame::XFrame >& _rxDocumentFrame, const SfxItemSet& rSet,
+ const Reference< container::XNameReplace >& xNameReplace, sal_uInt16 nSelectedIndex )
+ : SvxMacroAssignSingleTabDialog( pParent, rSet, 0 )
+{
+ SetTabPage( new SvxMacroTabPage( this, _rxDocumentFrame, rSet, xNameReplace, nSelectedIndex ) );
+}
+
+SvxMacroAssignDlg::~SvxMacroAssignDlg()
+{
+}
+
+
+//===============================================
+
+IMPL_LINK(AssignComponentDialog, ButtonHandler, Button *, EMPTYARG)
+{
+ ::rtl::OUString aMethodName = maMethodEdit.GetText();
+ maURL = ::rtl::OUString();
+ if( aMethodName.getLength() )
+ {
+ maURL = aVndSunStarUNO;
+ maURL += aMethodName;
+ }
+ EndDialog(1);
+ return 0;
+}
+
+AssignComponentDialog::AssignComponentDialog( Window * pParent, const ::rtl::OUString& rURL )
+ : ModalDialog( pParent, SVX_RES( RID_SVXDLG_ASSIGNCOMPONENT ) )
+ , maMethodLabel( this, SVX_RES( FT_METHOD ) )
+ , maMethodEdit( this, SVX_RES( EDIT_METHOD ) )
+ , maOKButton( this, SVX_RES( RID_PB_OK ) )
+ , maCancelButton( this, SVX_RES( RID_PB_CANCEL ) )
+ , maHelpButton( this, SVX_RES( RID_PB_HELP ) )
+ , maURL( rURL )
+{
+ FreeResource();
+ maOKButton.SetClickHdl(LINK(this, AssignComponentDialog, ButtonHandler));
+
+ ::rtl::OUString aMethodName;
+ if( maURL.getLength() )
+ {
+ sal_Int32 nIndex = maURL.indexOf( aVndSunStarUNO );
+ if( nIndex == 0 )
+ {
+ sal_Int32 nBegin = aVndSunStarUNO.getLength();
+ aMethodName = maURL.copy( nBegin );
+ }
+ }
+ maMethodEdit.SetText( aMethodName, Selection( 0, SELECTION_MAX ) );
+}
+
+AssignComponentDialog::~AssignComponentDialog()
+{
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxMacroAssignSingleTabDialog, OKHdl_Impl, Button *, pButton )
+{
+ (void)pButton; //unused
+ pPage->FillItemSet( *pOutSet );
+ EndDialog( RET_CANCEL );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvxMacroAssignSingleTabDialog::SvxMacroAssignSingleTabDialog
+ ( Window *pParent, const SfxItemSet& rSet, sal_uInt16 nUniqueId ) :
+ SfxModalDialog( pParent, nUniqueId, WinBits( WB_STDMODAL | WB_3DLOOK ) ),
+ pFixedLine ( 0 ),
+ pOKBtn ( 0 ),
+ pCancelBtn ( 0 ),
+ pHelpBtn ( 0 ),
+ pPage ( 0 ),
+ pOptions ( &rSet ),
+ pOutSet ( 0 )
+{}
+
+
+// -----------------------------------------------------------------------
+
+SvxMacroAssignSingleTabDialog::~SvxMacroAssignSingleTabDialog()
+{
+ delete pFixedLine;
+ delete pOKBtn;
+ delete pCancelBtn;
+ delete pHelpBtn;
+ delete pPage;
+}
+
+// -----------------------------------------------------------------------
+
+// According to SfxSingleTabDialog
+void SvxMacroAssignSingleTabDialog::SetTabPage( SfxTabPage* pTabPage )
+{
+ pFixedLine = new FixedLine( this );
+
+ pOKBtn = new OKButton( this, WB_DEFBUTTON );
+ pOKBtn->SetClickHdl( LINK( this, SvxMacroAssignSingleTabDialog, OKHdl_Impl ) );
+
+ pCancelBtn = new CancelButton( this );
+ pHelpBtn = new HelpButton( this );
+
+ pPage = pTabPage;
+
+ if ( pPage )
+ {
+ String sUserData;
+ pPage->SetUserData( sUserData );
+ pPage->Reset( *pOptions );
+ pPage->Show();
+
+ // Set dialog's and buttons' size and position according to tabpage size
+ long nSpaceX = LogicToPixel( Size( 6, 0 ), MAP_APPFONT ).Width();
+ long nSpaceY = LogicToPixel( Size( 0, 6 ), MAP_APPFONT ).Height();
+ long nHalfSpaceX = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width();
+ long nHalfSpaceY = LogicToPixel( Size( 0, 3 ), MAP_APPFONT ).Height();
+
+ pPage->SetPosPixel( Point() );
+ Size aTabpageSize( pPage->GetSizePixel() );
+ Size aDialogSize( aTabpageSize );
+ Size aButtonSize = LogicToPixel( Size( 50, 14 ), MAP_APPFONT );
+ long nButtonWidth = aButtonSize.Width();
+ long nButtonHeight = aButtonSize.Height();
+
+ Size aFixedLineSize( aTabpageSize );
+ long nFixedLineHeight = LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height();
+ aFixedLineSize.Height() = nFixedLineHeight;
+
+ aDialogSize.Height() += nFixedLineHeight + nButtonHeight + nSpaceY + nHalfSpaceY;
+ SetOutputSizePixel( aDialogSize );
+
+ long nButtonPosY = aTabpageSize.Height() + nFixedLineHeight + nHalfSpaceY;
+ long nHelpButtonPosX = nSpaceX;
+ pHelpBtn->SetPosSizePixel( Point( nHelpButtonPosX, nButtonPosY), aButtonSize );
+ pHelpBtn->Show();
+
+ long nCancelButtonPosX = aDialogSize.Width() - nButtonWidth - nSpaceX + 1;
+ pCancelBtn->SetPosSizePixel( Point( nCancelButtonPosX, nButtonPosY), aButtonSize );
+ pCancelBtn->Show();
+
+ long nOkButtonPosX = nCancelButtonPosX - nButtonWidth - nHalfSpaceX;
+ pOKBtn->SetPosSizePixel( Point( nOkButtonPosX, nButtonPosY), aButtonSize );
+ pOKBtn->Show();
+
+ long nFixedLinePosY = aTabpageSize.Height();
+ pFixedLine->SetPosSizePixel( Point( 0, nFixedLinePosY), aFixedLineSize );
+ pFixedLine->Show();
+
+ // Get text from TabPage
+ SetText( pPage->GetText() );
+
+ // Get IDs from TabPage
+ SetHelpId( pPage->GetHelpId() );
+ SetUniqueId( pPage->GetUniqueId() );
+ }
+}
diff --git a/cui/source/customize/macropg.hrc b/cui/source/customize/macropg.hrc
new file mode 100644
index 000000000000..ccf348d0cee0
--- /dev/null
+++ b/cui/source/customize/macropg.hrc
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * 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: macropg.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _MACROPG_HRC
+#define _MACROPG_HRC
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define LB_EVENT 1
+#define PB_ASSIGN 2
+#define PB_DELETE 3
+#define STR_EVENT 4
+#define STR_ASSMACRO 5
+#define FT_ASSIGN 6
+#define PB_ASSIGN_COMPONENT 7
+
+// Starting new IDs with 30 as eventdlg.hrc also includes this file
+#define IMG_MACRO 30
+#define IMG_COMPONENT 31
+#define IMG_MACRO_H 32
+#define IMG_COMPONENT_H 33
+
+#define RID_PB_OK 41
+#define RID_PB_CANCEL 42
+#define RID_PB_HELP 43
+#define FT_METHOD 44
+#define EDIT_METHOD 45
+
+
+// COL0<---------------WIDTH_1_2--------------->COL3<->COL4<----WIDTH4---->COL5
+// <--WIDTH1-->COL1<-SPACE1->COL2<--WIDTH2->
+
+#define WIDTH_TP 260 // of whole tabpage
+#define COL5 (WIDTH_TP-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define COL4 (COL5-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL3 (COL4-RSC_SP_CTRL_X)
+#define COL0 (RSC_SP_TBPG_INNERBORDER_LEFT)
+#define WIDTH1_2 (COL3-COL0) // width of upper listbox
+#define SPACE1 4 // space between lower listboxes
+#define WIDTH1 ((WIDTH1_2-SPACE1)/2) // width of lower left listbox
+#define WIDTH2 (WIDTH1_2-WIDTH1-SPACE1) // width of lower right listbox
+#define COL1 (COL0+WIDTH1)
+#define COL2 (COL1+SPACE1)
+
+#define HEIGHT0 158 // of upper listbox
+#define HEIGHT_TP (HEIGHT0+6) // of whole tabpage
+#define ROW0 6 // more than RSC_SP_FLGR_INNERBORDER_TOP cause of bad design
+#define ROW0A (ROW0+RSC_CD_FIXEDTEXT_HEIGHT+SPACE1)
+#define ROW1 (ROW0A+RSC_CD_PUSHBUTTON_HEIGHT) // Assign button
+#define ROW2 (ROW1+RSC_SP_CTRL_GROUP_Y)
+#define ROW3 (ROW2+RSC_CD_PUSHBUTTON_HEIGHT) // Assign component button
+#define ROW4 (ROW3+RSC_SP_CTRL_GROUP_Y)
+#define ROW5_REMOVE (ROW4+RSC_SP_CTRL_GROUP_Y) // Remove button
+#define ROW5 (ROW4+RSC_CD_DROPDOWN_HEIGHT) // script type listbox (hidden)
+#define ROW6 (ROW0+HEIGHT0)
+#define ROW7 (ROW6+RSC_SP_CTRL_Y)
+#define HEIGHT_EXTRA7 (RSC_CD_FIXEDTEXT_HEIGHT) // additional height for FT_LABEL4LB_MACROS
+#define ROW7A (ROW7+HEIGHT_EXTRA7)
+#define ROW8 (ROW7+RSC_CD_FIXEDTEXT_HEIGHT+HEIGHT_EXTRA7)// label for lower listboxes (2 lines!)
+#define ROW9 (HEIGHT_TP-RSC_SP_TBPG_INNERBORDER_BOTTOM)
+#define HEIGHT8 (ROW9-ROW8) // of lower listboxes
+
+#define COMP_EDIT_WIDTH 100
+#define COMP_DIST_Y 6
+#define COMP_WIDTH (COMP_EDIT_WIDTH+RSC_CD_PUSHBUTTON_WIDTH+3*COMP_DIST_Y)
+#define COMP_COL0 COMP_DIST_Y
+#define COMP_COL1 (COMP_COL0+COMP_EDIT_WIDTH+COMP_DIST_Y)
+#define COMP_ROW0 6
+#define COMP_ROW1 (COMP_ROW0+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define COMP_ROW2 (COMP_ROW1+RSC_CD_PUSHBUTTON_HEIGHT+2*RSC_SP_CTRL_GROUP_Y)
+#define COMP_ROWEDIT (COMP_ROW0+RSC_CD_FIXEDTEXT_HEIGHT+2)
+#define COMP_HEIGHT (COMP_ROW2+RSC_CD_PUSHBUTTON_HEIGHT+2*RSC_SP_CTRL_GROUP_Y)
+
+#endif
+
diff --git a/cui/source/customize/macropg.src b/cui/source/customize/macropg.src
new file mode 100644
index 000000000000..92e1e718ba61
--- /dev/null
+++ b/cui/source/customize/macropg.src
@@ -0,0 +1,461 @@
+/*************************************************************************
+ *
+ * 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: macropg.src,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <sfx2/sfx.hrc>
+#include "macropg.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+#define MASKCOLOR MaskColor = \
+ Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+TabPage RID_SVXPAGE_MACROASSIGN
+{
+ // HelpID = HID_MACROASSIGN ;
+ Hide = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( WIDTH_TP , HEIGHT_TP ) ;
+ Text [ en-US ] = "Assign action" ;
+ String STR_EVENT
+ {
+ Text [ en-US ] = "Event" ;
+ };
+ String STR_ASSMACRO
+ {
+ Text [ en-US ] = "Assigned Action" ;
+ };
+ Control LB_EVENT
+ {
+ Border = TRUE ;
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( COL0 , ROW0 ) ;
+ Size = MAP_APPFONT ( WIDTH1_2 , HEIGHT0 ) ;
+ HelpID = HID_SVX_MACRO_LB_EVENT ;
+ };
+ FixedText FT_ASSIGN
+ {
+ Pos = MAP_APPFONT ( COL4 , ROW0 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Assign:" ;
+ };
+ PushButton PB_ASSIGN
+ {
+ Pos = MAP_APPFONT ( COL4 , ROW0A ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "M~acro..." ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_ASSIGN_COMPONENT
+ {
+ Pos = MAP_APPFONT ( COL4 , ROW2 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Com~ponent..." ;
+ };
+ PushButton PB_DELETE
+ {
+ Pos = MAP_APPFONT ( COL4 , ROW5_REMOVE ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "~Remove" ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ };
+ Image IMG_MACRO
+ {
+ ImageBitmap = Bitmap { File = "id018.png"; };
+ MASKCOLOR
+ };
+ Image IMG_COMPONENT
+ {
+ ImageBitmap = Bitmap { File = "component_16.png"; };
+ MASKCOLOR
+ };
+ Image IMG_MACRO_H
+ {
+ ImageBitmap = Bitmap { File = "idh018.png"; };
+ MASKCOLOR
+ };
+ Image IMG_COMPONENT_H
+ {
+ ImageBitmap = Bitmap { File = "component_16_h.png"; };
+ MASKCOLOR
+ };
+};
+
+ModalDialog RID_SVXDLG_ASSIGNCOMPONENT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( COMP_WIDTH , COMP_HEIGHT ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Assign Component";
+ OKButton RID_PB_OK
+ {
+ Pos = MAP_APPFONT ( COMP_COL1 , COMP_ROW0 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton RID_PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( COMP_COL1 , COMP_ROW1 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton RID_PB_HELP
+ {
+ Pos = MAP_APPFONT ( COMP_COL1 , COMP_ROW2 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ };
+ FixedText FT_METHOD
+ {
+ Pos = MAP_APPFONT ( COMP_COL0 , ROW0 ) ;
+ Size = MAP_APPFONT ( COMP_EDIT_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Component method name" ;
+ };
+ Edit EDIT_METHOD
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COMP_COL0 , COMP_ROWEDIT ) ;
+ Size = MAP_APPFONT ( COMP_EDIT_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
+//DF
+String RID_SVXSTR_EVENT_STARTAPP
+{
+ Text [ en-US ] = "Start Application" ;
+};
+
+String RID_SVXSTR_EVENT_CLOSEAPP
+{
+ Text [ en-US ] = "Close Application" ;
+};
+
+String RID_SVXSTR_EVENT_NEWDOC
+{
+ Text [ en-US ] = "New Document" ;
+};
+
+String RID_SVXSTR_EVENT_CLOSEDOC
+{
+ Text [ en-US ] = "Document closed" ;
+};
+
+String RID_SVXSTR_EVENT_PREPARECLOSEDOC
+{
+ Text [ en-US ] = "Document is going to be closed" ;
+};
+
+String RID_SVXSTR_EVENT_OPENDOC
+{
+ Text [ en-US ] = "Open Document" ;
+};
+
+String RID_SVXSTR_EVENT_SAVEDOC
+{
+ Text [ en-US ] = "Save Document" ;
+};
+
+String RID_SVXSTR_EVENT_SAVEASDOC
+{
+ Text [ en-US ] = "Save Document As" ;
+};
+
+String RID_SVXSTR_EVENT_SAVEDOCDONE
+{
+ Text [ en-US ] = "Document has been saved" ;
+};
+
+String RID_SVXSTR_EVENT_SAVEASDOCDONE
+{
+ Text [ en-US ] = "Document has been saved as" ;
+};
+
+String RID_SVXSTR_EVENT_ACTIVATEDOC
+{
+ Text [ en-US ] = "Activate Document" ;
+};
+
+String RID_SVXSTR_EVENT_DEACTIVATEDOC
+{
+ Text [ en-US ] = "Deactivate Document" ;
+};
+
+String RID_SVXSTR_EVENT_PRINTDOC
+{
+ Text [ en-US ] = "Print Document" ;
+};
+
+String RID_SVXSTR_EVENT_MODIFYCHANGED
+{
+ Text [ en-US ] = "'Modified' status was changed" ;
+};
+String RID_SVXSTR_EVENT_MAILMERGE
+{
+ Text [ en-US ] = "Printing of form letters started" ;
+};
+String RID_SVXSTR_EVENT_MAILMERGE_END
+{
+ Text [ en-US ] = "Printing of form letters finished" ;
+};
+String RID_SVXSTR_EVENT_FIELDMERGE
+{
+ Text [ en-US ] = "Merging of form fields started" ;
+};
+String RID_SVXSTR_EVENT_FIELDMERGE_FINISHED
+{
+ Text [ en-US ] = "Merging of form fields finished" ;
+};
+String RID_SVXSTR_EVENT_PAGECOUNTCHANGE
+{
+ Text [ en-US ] = "Changing the page count" ;
+};
+String RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED
+{
+ Text [ en-US ] = "Loaded a sub component" ;
+};
+String RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED
+{
+ Text [ en-US ] = "Closed a sub component" ;
+};
+String RID_SVXSTR_EVENT_APPROVEPARAMETER
+{
+ Text [ en-US ] = "Fill parameters" ;
+};
+String RID_SVXSTR_EVENT_ACTIONPERFORMED
+{
+ Text [ en-US ] = "Execute action" ;
+};
+String RID_SVXSTR_EVENT_AFTERUPDATE
+{
+ Text [ en-US ] = "After updating" ;
+};
+String RID_SVXSTR_EVENT_BEFOREUPDATE
+{
+ Text [ en-US ] = "Before updating" ;
+};
+String RID_SVXSTR_EVENT_APPROVEROWCHANGE
+{
+ Text [ en-US ] = "Before record action" ;
+};
+String RID_SVXSTR_EVENT_ROWCHANGE
+{
+ Text [ en-US ] = "After record action" ;
+};
+String RID_SVXSTR_EVENT_CONFIRMDELETE
+{
+ Text [ en-US ] = "Confirm deletion" ;
+};
+String RID_SVXSTR_EVENT_ERROROCCURED
+{
+ Text [ en-US ] = "Error occurred" ;
+};
+String RID_SVXSTR_EVENT_ADJUSTMENTVALUECHANGED
+{
+ Text [ en-US ] = "While adjusting";
+};
+String RID_SVXSTR_EVENT_FOCUSGAINED
+{
+ Text [ en-US ] = "When receiving focus" ;
+};
+String RID_SVXSTR_EVENT_FOCUSLOST
+{
+ Text [ en-US ] = "When losing focus" ;
+};
+String RID_SVXSTR_EVENT_ITEMSTATECHANGED
+{
+ Text [ en-US ] = "Item status changed" ;
+};
+String RID_SVXSTR_EVENT_KEYTYPED
+{
+ Text [ en-US ] = "Key pressed" ;
+};
+String RID_SVXSTR_EVENT_KEYUP
+{
+ Text [ en-US ] = "Key released" ;
+};
+String RID_SVXSTR_EVENT_LOADED
+{
+ Text [ en-US ] = "When loading" ;
+};
+String RID_SVXSTR_EVENT_RELOADING
+{
+ Text [ en-US ] = "Before reloading" ;
+};
+String RID_SVXSTR_EVENT_RELOADED
+{
+ Text [ en-US ] = "When reloading" ;
+};
+String RID_SVXSTR_EVENT_MOUSEDRAGGED
+{
+ Text [ en-US ] = "Mouse moved while key pressed" ;
+};
+String RID_SVXSTR_EVENT_MOUSEENTERED
+{
+ Text [ en-US ] = "Mouse inside" ;
+};
+String RID_SVXSTR_EVENT_MOUSEEXITED
+{
+ Text [ en-US ] = "Mouse outside" ;
+};
+String RID_SVXSTR_EVENT_MOUSEMOVED
+{
+ Text [ en-US ] = "Mouse moved" ;
+};
+String RID_SVXSTR_EVENT_MOUSEPRESSED
+{
+ Text [ en-US ] = "Mouse button pressed" ;
+};
+String RID_SVXSTR_EVENT_MOUSERELEASED
+{
+ Text [ en-US ] = "Mouse button released" ;
+};
+String RID_SVXSTR_EVENT_POSITIONING
+{
+ Text [ en-US ] = "Before record change" ;
+};
+String RID_SVXSTR_EVENT_POSITIONED
+{
+ Text [ en-US ] = "After record change" ;
+};
+String RID_SVXSTR_EVENT_RESETTED
+{
+ Text [ en-US ] = "After resetting" ;
+};
+String RID_SVXSTR_EVENT_APPROVERESETTED
+{
+ Text [ en-US ] = "Prior to reset" ;
+};
+String RID_SVXSTR_EVENT_APPROVEACTIONPERFORMED
+{
+ Text [ en-US ] = "Approve action" ;
+};
+String RID_SVXSTR_EVENT_SUBMITTED
+{
+ Text [ en-US ] = "Before submitting" ;
+};
+String RID_SVXSTR_EVENT_TEXTCHANGED
+{
+ Text [ en-US ] = "Text modified" ;
+};
+String RID_SVXSTR_EVENT_UNLOADING
+{
+ Text [ en-US ] = "Before unloading" ;
+};
+String RID_SVXSTR_EVENT_UNLOADED
+{
+ Text [ en-US ] = "When unloading" ;
+};
+String RID_SVXSTR_EVENT_CHANGED
+{
+ Text [ en-US ] = "Changed" ;
+};
+
+String RID_SVXSTR_EVENT_CREATEDOC
+{
+ Text [ en-US ] = "Document created" ;
+};
+
+String RID_SVXSTR_EVENT_LOADDOCFINISHED
+{
+ Text [ en-US ] = "Document loading finished" ;
+};
+
+String RID_SVXSTR_EVENT_SAVEDOCFAILED
+{
+ Text [ en-US ] = "Saving of document failed" ;
+};
+
+String RID_SVXSTR_EVENT_SAVEASDOCFAILED
+{
+ Text [ en-US ] = "'Save as' has failed" ;
+};
+
+String RID_SVXSTR_EVENT_COPYTODOC
+{
+ Text [ en-US ] = "Storing or exporting copy of document" ;
+};
+
+String RID_SVXSTR_EVENT_COPYTODOCDONE
+{
+ Text [ en-US ] = "Document copy has been created" ;
+};
+
+String RID_SVXSTR_EVENT_COPYTODOCFAILED
+{
+ Text [ en-US ] = "Creating of document copy failed" ;
+};
+
+String RID_SVXSTR_EVENT_VIEWCREATED
+{
+ Text [ en-US ] = "View created" ;
+};
+
+String RID_SVXSTR_EVENT_PREPARECLOSEVIEW
+{
+ Text [ en-US ] = "View is going to be closed" ;
+};
+
+String RID_SVXSTR_EVENT_CLOSEVIEW
+{
+ Text [ en-US ] = "View closed" ;
+};
+
+String RID_SVXSTR_EVENT_TITLECHANGED
+{
+ Text [ en-US ] = "Document title changed" ;
+};
+
+String RID_SVXSTR_EVENT_MODECHANGED
+{
+ Text [ en-US ] = "Document mode changed" ;
+};
+
+String RID_SVXSTR_EVENT_VISAREACHANGED
+{
+ Text [ en-US ] = "Visible area changed" ;
+};
+
+String RID_SVXSTR_EVENT_STORAGECHANGED
+{
+ Text [ en-US ] = "Document has got a new storage" ;
+};
+
+String RID_SVXSTR_EVENT_LAYOUT_FINISHED
+{
+ Text [ en-US ] = "Document layout finished" ;
+};
diff --git a/cui/source/customize/macropg_impl.hxx b/cui/source/customize/macropg_impl.hxx
new file mode 100644
index 000000000000..0563c2e05151
--- /dev/null
+++ b/cui/source/customize/macropg_impl.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * 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: macropg_impl.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _MACROPG_IMPL_HXX
+#define _MACROPG_IMPL_HXX
+
+class _SvxMacroTabPage_Impl
+{
+public:
+ _SvxMacroTabPage_Impl( const SfxItemSet& rAttrSet );
+ ~_SvxMacroTabPage_Impl();
+
+ FixedText* pAssignFT;
+ PushButton* pAssignPB;
+ PushButton* pAssignComponentPB;
+ PushButton* pDeletePB;
+ Image* pMacroImg;
+ Image* pComponentImg;
+ Image* pMacroImg_h;
+ Image* pComponentImg_h;
+ String* pStrEvent;
+ String* pAssignedMacro;
+ _HeaderTabListBox* pEventLB;
+ BOOL bReadOnly;
+ BOOL bIDEDialogMode;
+};
+
+class AssignComponentDialog : public ModalDialog
+{
+private:
+ FixedText maMethodLabel;
+ Edit maMethodEdit;
+ OKButton maOKButton;
+ CancelButton maCancelButton;
+ HelpButton maHelpButton;
+
+ ::rtl::OUString maURL;
+
+ DECL_LINK(ButtonHandler, Button *);
+
+public:
+ AssignComponentDialog( Window * pParent, const ::rtl::OUString& rURL );
+ ~AssignComponentDialog();
+
+ ::rtl::OUString getURL( void ) const
+ { return maURL; }
+};
+
+#endif
diff --git a/cui/source/customize/makefile.mk b/cui/source/customize/makefile.mk
new file mode 100755
index 000000000000..f4c9303cc6ba
--- /dev/null
+++ b/cui/source/customize/makefile.mk
@@ -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: makefile.mk,v $
+#
+# $Revision: 1.65 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..
+PRJNAME=cui
+TARGET=customize
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc
+.ENDIF # ENABLE_LAYOUT == TRUE
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=customize
+SRC1FILES = \
+ acccfg.src \
+ cfg.src \
+ eventdlg.src \
+ macropg.src \
+ selector.src \
+
+
+SLOFILES+=\
+ $(SLO)$/acccfg.obj \
+ $(SLO)$/cfg.obj \
+ $(SLO)$/cfgutil.obj \
+ $(SLO)$/eventdlg.obj \
+ $(SLO)$/macropg.obj \
+ $(SLO)$/selector.obj \
+
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx
new file mode 100644
index 000000000000..c202d6ad2584
--- /dev/null
+++ b/cui/source/customize/selector.cxx
@@ -0,0 +1,1255 @@
+/*************************************************************************
+ *
+ * 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: selector.cxx,v $
+ * $Revision: 1.28 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <vcl/help.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/metric.hxx>
+#include "selector.hxx"
+#include <svx/dialmgr.hxx>
+#include "selector.hrc"
+#include <svx/fmresids.hrc>
+#include <svx/dialogs.hrc>
+#include <sfx2/app.hxx>
+#include <sfx2/msg.hxx>
+#include <sfx2/msgpool.hxx>
+#include <sfx2/macrconf.hxx>
+#include <sfx2/minfitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <comphelper/documentinfo.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
+#include <com/sun/star/script/provider/XScriptProvider.hpp>
+#include <com/sun/star/script/browse/XBrowseNode.hpp>
+#include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
+#include <com/sun/star/script/browse/XBrowseNodeFactory.hpp>
+#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <com/sun/star/document/XScriptInvocationContext.hpp>
+#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
+#include <com/sun/star/frame/DispatchInformation.hpp>
+#include <com/sun/star/container/XChild.hpp>
+
+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::frame;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::container;
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#include <svtools/imagemgr.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/diagnose_ex.h>
+
+SV_IMPL_PTRARR(SvxGroupInfoArr_Impl, SvxGroupInfoPtr);
+
+/*
+ * The implementations of SvxConfigFunctionListBox_Impl and
+ * SvxConfigGroupListBox_Impl are copied from sfx2/source/dialog/cfg.cxx
+ */
+SvxConfigFunctionListBox_Impl::SvxConfigFunctionListBox_Impl( Window* pParent, const ResId& rResId)
+ : SvTreeListBox( pParent, rResId )
+ , pCurEntry( 0 )
+ , m_pDraggingEntry( 0 )
+{
+ SetWindowBits( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT );
+ GetModel()->SetSortMode( SortAscending );
+
+ // Timer f"ur die BallonHelp
+ aTimer.SetTimeout( 200 );
+ aTimer.SetTimeoutHdl(
+ LINK( this, SvxConfigFunctionListBox_Impl, TimerHdl ) );
+}
+
+SvxConfigFunctionListBox_Impl::~SvxConfigFunctionListBox_Impl()
+{
+ ClearAll();
+}
+
+SvLBoxEntry* SvxConfigFunctionListBox_Impl::GetLastSelectedEntry()
+{
+ if ( m_pDraggingEntry != NULL )
+ {
+ return m_pDraggingEntry;
+ }
+ else
+ {
+ return FirstSelected();
+ }
+}
+
+void SvxConfigFunctionListBox_Impl::MouseMove( const MouseEvent& rMEvt )
+{
+ Point aMousePos = rMEvt.GetPosPixel();
+ pCurEntry = GetCurEntry();
+
+ if ( pCurEntry && GetEntry( aMousePos ) == pCurEntry )
+ aTimer.Start();
+ else
+ {
+ Help::ShowBalloon( this, aMousePos, String() );
+ aTimer.Stop();
+ }
+}
+
+
+IMPL_LINK( SvxConfigFunctionListBox_Impl, TimerHdl, Timer*, EMPTYARG)
+{
+ aTimer.Stop();
+ Point aMousePos = GetPointerPosPixel();
+ SvLBoxEntry *pEntry = GetCurEntry();
+ if ( pEntry && GetEntry( aMousePos ) == pEntry && pCurEntry == pEntry )
+ Help::ShowBalloon( this, OutputToScreenPixel( aMousePos ), GetHelpText( pEntry ) );
+ return 0L;
+}
+
+void SvxConfigFunctionListBox_Impl::ClearAll()
+{
+ USHORT nCount = aArr.Count();
+ for ( USHORT i=0; i<nCount; i++ )
+ {
+ SvxGroupInfo_Impl *pData = aArr[i];
+ delete pData;
+ }
+
+ aArr.Remove( 0, nCount );
+ Clear();
+}
+
+SvLBoxEntry* SvxConfigFunctionListBox_Impl::GetEntry_Impl( const String& rName )
+{
+ SvLBoxEntry *pEntry = First();
+ while ( pEntry )
+ {
+ if ( GetEntryText( pEntry ) == rName )
+ return pEntry;
+ pEntry = Next( pEntry );
+ }
+
+ return NULL;
+}
+
+SvLBoxEntry* SvxConfigFunctionListBox_Impl::GetEntry_Impl( USHORT nId )
+{
+ SvLBoxEntry *pEntry = First();
+ while ( pEntry )
+ {
+ SvxGroupInfo_Impl *pData = (SvxGroupInfo_Impl*) pEntry->GetUserData();
+ if ( pData && pData->nOrd == nId )
+ return pEntry;
+ pEntry = Next( pEntry );
+ }
+
+ return NULL;
+}
+
+USHORT SvxConfigFunctionListBox_Impl::GetId( SvLBoxEntry *pEntry )
+{
+ SvxGroupInfo_Impl *pData = pEntry ?
+ (SvxGroupInfo_Impl*) pEntry->GetUserData() : 0;
+ if ( pData )
+ return pData->nOrd;
+ return 0;
+}
+
+String SvxConfigFunctionListBox_Impl::GetHelpText( SvLBoxEntry *pEntry )
+{
+ // Information zum selektierten Entry aus den Userdaten holen
+ SvxGroupInfo_Impl *pInfo =
+ pEntry ? (SvxGroupInfo_Impl*) pEntry->GetUserData(): 0;
+
+ if ( pInfo )
+ {
+ if ( pInfo->nKind == SVX_CFGFUNCTION_SLOT )
+ {
+ OUString aCmdURL( pInfo->sURL );
+
+ OUString aHelpText = Application::GetHelp()->GetHelpText( aCmdURL, this );
+
+ return aHelpText;
+ }
+ else if ( pInfo->nKind == SVX_CFGFUNCTION_SCRIPT )
+ {
+ return pInfo->sHelpText;
+ }
+ }
+
+ return String();
+}
+
+void SvxConfigFunctionListBox_Impl::FunctionSelected()
+{
+ Help::ShowBalloon( this, Point(), String() );
+}
+
+// drag and drop support
+DragDropMode SvxConfigFunctionListBox_Impl::NotifyStartDrag(
+ TransferDataContainer& /*aTransferDataContainer*/, SvLBoxEntry* pEntry )
+{
+ m_pDraggingEntry = pEntry;
+ return GetDragDropMode();
+}
+
+void SvxConfigFunctionListBox_Impl::DragFinished( sal_Int8 /*nDropAction*/ )
+{
+ m_pDraggingEntry = NULL;
+}
+
+sal_Int8
+SvxConfigFunctionListBox_Impl::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
+{
+ return DND_ACTION_NONE;
+}
+
+SvxConfigGroupListBox_Impl::SvxConfigGroupListBox_Impl(
+ Window* pParent, const ResId& rResId,
+ bool _bShowSlots, const Reference< frame::XFrame >& xFrame )
+ : SvTreeListBox( pParent, rResId )
+ , m_bShowSlots( _bShowSlots ),
+ m_hdImage(ResId(IMG_HARDDISK,*rResId.GetResMgr())),
+ m_hdImage_hc(ResId(IMG_HARDDISK_HC,*rResId.GetResMgr())),
+ m_libImage(ResId(IMG_LIB,*rResId.GetResMgr())),
+ m_libImage_hc(ResId(IMG_LIB_HC,*rResId.GetResMgr())),
+ m_macImage(ResId(IMG_MACRO,*rResId.GetResMgr())),
+ m_macImage_hc(ResId(IMG_MACRO_HC,*rResId.GetResMgr())),
+ m_docImage(ResId(IMG_DOC,*rResId.GetResMgr())),
+ m_docImage_hc(ResId(IMG_DOC_HC,*rResId.GetResMgr())),
+ m_sMyMacros(String(ResId(STR_MYMACROS,*rResId.GetResMgr()))),
+ m_sProdMacros(String(ResId(STR_PRODMACROS,*rResId.GetResMgr())))
+{
+ FreeResource();
+
+ if ( xFrame != NULL )
+ {
+ m_xFrame.set( xFrame );
+ }
+
+ SetWindowBits( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT );
+
+ ImageList aNavigatorImages( SVX_RES( RID_SVXIMGLIST_FMEXPL ) );
+
+ SetNodeBitmaps(
+ aNavigatorImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ),
+ aNavigatorImages.GetImage( RID_SVXIMG_EXPANDEDNODE ),
+ BMP_COLOR_NORMAL );
+
+ SetNodeBitmaps(
+ aNavigatorImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ),
+ aNavigatorImages.GetImage( RID_SVXIMG_EXPANDEDNODE ),
+ BMP_COLOR_HIGHCONTRAST );
+}
+
+
+SvxConfigGroupListBox_Impl::~SvxConfigGroupListBox_Impl()
+{
+ ClearAll();
+}
+
+void SvxConfigGroupListBox_Impl::ClearAll()
+{
+ USHORT nCount = aArr.Count();
+ for ( USHORT i=0; i<nCount; i++ )
+ {
+ SvxGroupInfo_Impl *pData = aArr[i];
+ delete pData;
+ }
+
+ aArr.Remove( 0, nCount );
+ Clear();
+}
+
+//-----------------------------------------------
+namespace
+{
+ //...........................................
+ /** examines a component whether it supports XEmbeddedScripts, or provides access to such a
+ component by implementing XScriptInvocationContext.
+ @return
+ the model which supports the embedded scripts, or <NULL/> if it cannot find such a
+ model
+ */
+ static Reference< XModel > lcl_getDocumentWithScripts_throw( const Reference< XInterface >& _rxComponent )
+ {
+ Reference< XEmbeddedScripts > xScripts( _rxComponent, UNO_QUERY );
+ if ( !xScripts.is() )
+ {
+ Reference< XScriptInvocationContext > xContext( _rxComponent, UNO_QUERY );
+ if ( xContext.is() )
+ xScripts.set( xContext->getScriptContainer(), UNO_QUERY );
+ }
+
+ return Reference< XModel >( xScripts, UNO_QUERY );
+ }
+
+ //...........................................
+ static Reference< XModel > lcl_getScriptableDocument_nothrow( const Reference< XFrame >& _rxFrame )
+ {
+ Reference< XModel > xDocument;
+
+ // examine our associated frame
+ try
+ {
+ OSL_ENSURE( _rxFrame.is(), "lcl_getScriptableDocument_nothrow: you need to pass a frame to this dialog/tab page!" );
+ if ( _rxFrame.is() )
+ {
+ // first try the model in the frame
+ Reference< XController > xController( _rxFrame->getController(), UNO_SET_THROW );
+ xDocument = lcl_getDocumentWithScripts_throw( xController->getModel() );
+
+ if ( !xDocument.is() )
+ {
+ // if there is no suitable document in the frame, try the controller
+ xDocument = lcl_getDocumentWithScripts_throw( _rxFrame->getController() );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return xDocument;
+ }
+}
+
+void SvxConfigGroupListBox_Impl::fillScriptList( const Reference< browse::XBrowseNode >& _rxRootNode, SvLBoxEntry* _pParentEntry, bool _bCheapChildsOnDemand )
+{
+ OSL_PRECOND( _rxRootNode.is(), "SvxConfigGroupListBox_Impl::fillScriptList: invalid root node!" );
+ if ( !_rxRootNode.is() )
+ return;
+
+ try
+ {
+ if ( _rxRootNode->hasChildNodes() )
+ {
+ Sequence< Reference< browse::XBrowseNode > > children =
+ _rxRootNode->getChildNodes();
+
+ BOOL bIsRootNode = _rxRootNode->getName().equalsAscii("Root");
+
+ /* To mimic current starbasic behaviour we
+ need to make sure that only the current document
+ is displayed in the config tree. Tests below
+ set the bDisplay flag to FALSE if the current
+ node is a first level child of the Root and is NOT
+ either the current document, user or share */
+ OUString sCurrentDocTitle;
+ Reference< XModel > xWorkingDocument = lcl_getScriptableDocument_nothrow( m_xFrame );
+ if ( xWorkingDocument.is() )
+ {
+ sCurrentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xWorkingDocument );
+ }
+
+ for ( long n = 0; n < children.getLength(); n++ )
+ {
+ Reference< browse::XBrowseNode >& theChild = children[n];
+ //#139111# some crash reports show that it might be unset
+ if ( !theChild.is() )
+ continue;
+ ::rtl::OUString sUIName = theChild->getName();
+ BOOL bDisplay = TRUE;
+
+ if ( bIsRootNode
+ || ( m_bShowSlots && _pParentEntry && ( GetModel()->GetDepth( _pParentEntry ) == 0 ) )
+ // if we show slots (as in the customize dialog)
+ // then the user & share are added at depth=1
+ )
+ {
+ if ( sUIName.equalsAscii( "user" ) )
+ {
+ sUIName = m_sMyMacros;
+ bIsRootNode = sal_True;
+ }
+ else if ( sUIName.equalsAscii( "share" ) )
+ {
+ sUIName = m_sProdMacros;
+ bIsRootNode = sal_True;
+ }
+ else if ( !sUIName.equals( sCurrentDocTitle ) )
+ {
+ bDisplay = FALSE;
+ }
+ }
+
+ if ( !bDisplay )
+ continue;
+
+ if ( children[n]->getType() == browse::BrowseNodeTypes::SCRIPT )
+ continue;
+
+ SvLBoxEntry* pNewEntry = InsertEntry( sUIName, _pParentEntry );
+
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Image aImage = GetImage( theChild, aContext.getUNOContext(), bIsRootNode, BMP_COLOR_NORMAL );
+ SetExpandedEntryBmp( pNewEntry, aImage, BMP_COLOR_NORMAL );
+ SetCollapsedEntryBmp( pNewEntry, aImage, BMP_COLOR_NORMAL );
+
+ aImage = GetImage( theChild, aContext.getUNOContext(), bIsRootNode, BMP_COLOR_HIGHCONTRAST );
+ SetExpandedEntryBmp( pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST );
+ SetCollapsedEntryBmp( pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST );
+
+ SvxGroupInfo_Impl* pInfo =
+ new SvxGroupInfo_Impl( SVX_CFGGROUP_SCRIPTCONTAINER, 0, theChild );
+ pNewEntry->SetUserData( pInfo );
+ aArr.Insert( pInfo, aArr.Count() );
+
+ if ( _bCheapChildsOnDemand )
+ {
+ /* i30923 - Would be nice if there was a better
+ * way to determine if a basic lib had children
+ * without having to ask for them (which forces
+ * the library to be loaded */
+ pNewEntry->EnableChildsOnDemand( TRUE );
+ }
+ else
+ {
+ // if there are granchildren we're interested in, display the '+' before
+ // the entry, but do not yet expand
+ Sequence< Reference< browse::XBrowseNode > > grandchildren =
+ children[n]->getChildNodes();
+
+ for ( sal_Int32 m = 0; m < grandchildren.getLength(); m++ )
+ {
+ if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER )
+ {
+ pNewEntry->EnableChildsOnDemand( TRUE );
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+void SvxConfigGroupListBox_Impl::Init()
+{
+ SetUpdateMode(FALSE);
+ ClearAll();
+
+ Reference< XComponentContext > xContext;
+ Reference < beans::XPropertySet > xProps(
+ ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
+
+ xContext.set( xProps->getPropertyValue(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
+ UNO_QUERY );
+
+ // are we showing builtin commands?
+ if ( m_bShowSlots && xContext.is() && m_xFrame.is() )
+ {
+ Reference< lang::XMultiComponentFactory > xMCF =
+ xContext->getServiceManager();
+
+ Reference< frame::XDispatchInformationProvider > xDIP(
+ m_xFrame, UNO_QUERY );
+
+ Reference< ::com::sun::star::frame::XModuleManager >
+ xModuleManager( xMCF->createInstanceWithContext(
+ OUString::createFromAscii(
+ "com.sun.star.frame.ModuleManager" ),
+ xContext ),
+ UNO_QUERY );
+
+ OUString aModuleId;
+ try{
+ aModuleId = xModuleManager->identify( m_xFrame );
+ }catch(const uno::Exception&)
+ { aModuleId = ::rtl::OUString(); }
+
+ Reference< container::XNameAccess > xNameAccess(
+ xMCF->createInstanceWithContext(
+ OUString::createFromAscii(
+ "com.sun.star.frame.UICommandDescription" ),
+ xContext ),
+ UNO_QUERY );
+
+ if ( xNameAccess.is() )
+ {
+ xNameAccess->getByName( aModuleId ) >>= m_xModuleCommands;
+ }
+
+ Reference< container::XNameAccess > xAllCategories(
+ xMCF->createInstanceWithContext(
+ OUString::createFromAscii(
+ "com.sun.star.ui.UICategoryDescription" ),
+ xContext ),
+ UNO_QUERY );
+
+ Reference< container::XNameAccess > xModuleCategories;
+ if ( xAllCategories.is() )
+ {
+ if ( aModuleId.getLength() != 0 )
+ {
+ try
+ {
+ xModuleCategories = Reference< container::XNameAccess >(
+ xAllCategories->getByName( aModuleId ), UNO_QUERY );
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ }
+ }
+
+ if ( !xModuleCategories.is() )
+ {
+ xModuleCategories = xAllCategories;
+ }
+ }
+
+ if ( xModuleCategories.is() )
+ {
+ Sequence< sal_Int16 > gids =
+ xDIP->getSupportedCommandGroups();
+
+ for ( sal_Int32 i = 0; i < gids.getLength(); i++ )
+ {
+ Sequence< frame::DispatchInformation > commands;
+ try
+ {
+ commands =
+ xDIP->getConfigurableDispatchInformation( gids[i] );
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ continue;
+ }
+
+ if ( commands.getLength() == 0 )
+ {
+ continue;
+ }
+
+ sal_Int32 gid = gids[i];
+ OUString idx = OUString::valueOf( gid );
+ OUString group = idx;
+ try
+ {
+ xModuleCategories->getByName( idx ) >>= group;
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ }
+
+ SvLBoxEntry *pEntry = InsertEntry( group, NULL );
+
+ SvxGroupInfo_Impl *pInfo =
+ new SvxGroupInfo_Impl( SVX_CFGGROUP_FUNCTION, gids[i] );
+ aArr.Insert( pInfo, aArr.Count() );
+
+ pEntry->SetUserData( pInfo );
+ }
+ }
+ }
+
+ if ( xContext.is() )
+ {
+ // Add Scripting Framework entries
+ Reference< browse::XBrowseNode > rootNode;
+ Reference< XComponentContext> xCtx;
+
+ try
+ {
+ Reference < beans::XPropertySet > _xProps(
+ ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
+ xCtx.set( _xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW );
+ Reference< browse::XBrowseNodeFactory > xFac( xCtx->getValueByName(
+ OUString::createFromAscii( "/singletons/com.sun.star.script.browse.theBrowseNodeFactory") ), UNO_QUERY_THROW );
+ rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if ( rootNode.is() )
+ {
+ if ( m_bShowSlots )
+ {
+ SvxGroupInfo_Impl *pInfo =
+ new SvxGroupInfo_Impl( SVX_CFGGROUP_SCRIPTCONTAINER, 0, rootNode );
+
+ String aTitle =
+ String( SVX_RES( STR_SELECTOR_MACROS ) );
+
+ SvLBoxEntry *pNewEntry = InsertEntry( aTitle, NULL );
+ pNewEntry->SetUserData( pInfo );
+ pNewEntry->EnableChildsOnDemand( TRUE );
+ aArr.Insert( pInfo, aArr.Count() );
+ }
+ else
+ {
+ fillScriptList( rootNode, NULL, false );
+ }
+ }
+ }
+ MakeVisible( GetEntry( 0,0 ) );
+ SetUpdateMode( TRUE );
+}
+
+Image SvxConfigGroupListBox_Impl::GetImage( Reference< browse::XBrowseNode > node, Reference< XComponentContext > xCtx, bool bIsRootNode, bool bHighContrast )
+{
+ Image aImage;
+ if ( bIsRootNode )
+ {
+ if ( node->getName().equalsAscii( "user" ) || node->getName().equalsAscii( "share" ) )
+ {
+ if( bHighContrast == BMP_COLOR_NORMAL )
+ aImage = m_hdImage;
+ else
+ aImage = m_hdImage_hc;
+ }
+ else
+ {
+ OUString factoryURL;
+ OUString nodeName = node->getName();
+ Reference<XInterface> xDocumentModel = getDocumentModel(xCtx, nodeName );
+ if ( xDocumentModel.is() )
+ {
+ Reference< ::com::sun::star::frame::XModuleManager >
+ xModuleManager(
+ xCtx->getServiceManager()
+ ->createInstanceWithContext(
+ OUString::createFromAscii("com.sun.star.frame.ModuleManager"),
+ xCtx ),
+ UNO_QUERY_THROW );
+ Reference<container::XNameAccess> xModuleConfig(
+ xModuleManager, UNO_QUERY_THROW );
+ // get the long name of the document:
+ OUString appModule( xModuleManager->identify(
+ xDocumentModel ) );
+ Sequence<beans::PropertyValue> moduleDescr;
+ Any aAny = xModuleConfig->getByName(appModule);
+ if( sal_True != ( aAny >>= moduleDescr ) )
+ {
+ throw RuntimeException(OUString::createFromAscii("SFTreeListBox::Init: failed to get PropertyValue"), Reference< XInterface >());
+ }
+ beans::PropertyValue const * pmoduleDescr =
+ moduleDescr.getConstArray();
+ for ( sal_Int32 pos = moduleDescr.getLength(); pos--; )
+ {
+ if (pmoduleDescr[ pos ].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "ooSetupFactoryEmptyDocumentURL") ))
+ {
+ pmoduleDescr[ pos ].Value >>= factoryURL;
+ break;
+ }
+ }
+ }
+ if( factoryURL.getLength() > 0 )
+ {
+ if( bHighContrast == BMP_COLOR_NORMAL )
+ aImage = SvFileInformationManager::GetFileImage(
+ INetURLObject(factoryURL), false,
+ BMP_COLOR_NORMAL );
+ else
+ aImage = SvFileInformationManager::GetFileImage(
+ INetURLObject(factoryURL), false,
+ BMP_COLOR_HIGHCONTRAST );
+ }
+ else
+ {
+ if( bHighContrast == BMP_COLOR_NORMAL )
+ aImage = m_docImage;
+ else
+ aImage = m_docImage_hc;
+ }
+ }
+ }
+ else
+ {
+ if( node->getType() == browse::BrowseNodeTypes::SCRIPT )
+ {
+ if( bHighContrast == BMP_COLOR_NORMAL )
+ aImage = m_macImage;
+ else
+ aImage = m_macImage_hc;
+ }
+ else
+ {
+ if( bHighContrast == BMP_COLOR_NORMAL )
+ aImage = m_libImage;
+ else
+ aImage = m_libImage_hc;
+ }
+ }
+ return aImage;
+}
+
+Reference< XInterface >
+SvxConfigGroupListBox_Impl::getDocumentModel(
+ Reference< XComponentContext >& xCtx, OUString& docName )
+{
+ Reference< XInterface > xModel;
+ Reference< lang::XMultiComponentFactory > mcf =
+ xCtx->getServiceManager();
+ Reference< frame::XDesktop > desktop (
+ mcf->createInstanceWithContext(
+ OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx ),
+ UNO_QUERY );
+
+ Reference< container::XEnumerationAccess > componentsAccess =
+ desktop->getComponents();
+ Reference< container::XEnumeration > components =
+ componentsAccess->createEnumeration();
+ while (components->hasMoreElements())
+ {
+ Reference< frame::XModel > model(
+ components->nextElement(), UNO_QUERY );
+ if ( model.is() )
+ {
+ OUString sTdocUrl = ::comphelper::DocumentInfo::getDocumentTitle( model );
+ if( sTdocUrl.equals( docName ) )
+ {
+ xModel = model;
+ break;
+ }
+ }
+ }
+ return xModel;
+}
+
+void SvxConfigGroupListBox_Impl::GroupSelected()
+{
+ SvLBoxEntry *pEntry = FirstSelected();
+ SvxGroupInfo_Impl *pInfo = (SvxGroupInfo_Impl*) pEntry->GetUserData();
+ pFunctionListBox->SetUpdateMode(FALSE);
+ pFunctionListBox->ClearAll();
+ if ( pInfo->nKind != SVX_CFGGROUP_FUNCTION &&
+ pInfo->nKind != SVX_CFGGROUP_SCRIPTCONTAINER )
+ {
+ pFunctionListBox->SetUpdateMode(TRUE);
+ return;
+ }
+
+ switch ( pInfo->nKind )
+ {
+ case SVX_CFGGROUP_FUNCTION :
+ {
+ SvLBoxEntry *_pEntry = FirstSelected();
+ if ( _pEntry != NULL )
+ {
+ SvxGroupInfo_Impl *_pInfo =
+ (SvxGroupInfo_Impl*) _pEntry->GetUserData();
+
+ Reference< frame::XDispatchInformationProvider > xDIP(
+ m_xFrame, UNO_QUERY );
+
+ Sequence< frame::DispatchInformation > commands;
+ try
+ {
+ commands = xDIP->getConfigurableDispatchInformation(
+ _pInfo->nOrd );
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ }
+
+ for ( sal_Int32 i = 0; i < commands.getLength(); i++ )
+ {
+ if ( commands[i].Command.getLength() == 0 )
+ {
+ continue;
+ }
+
+ Image aImage;
+
+ OUString aCmdURL( commands[i].Command );
+
+ if ( m_pImageProvider )
+ {
+ aImage = m_pImageProvider->GetImage( aCmdURL );
+ }
+
+ OUString aLabel;
+ try
+ {
+ Any a = m_xModuleCommands->getByName( aCmdURL );
+ Sequence< beans::PropertyValue > aPropSeq;
+
+ if ( a >>= aPropSeq )
+ {
+ for ( sal_Int32 k = 0; k < aPropSeq.getLength(); k++ )
+ {
+ if ( aPropSeq[k].Name.equalsAscii( "Name" ) )
+ {
+ aPropSeq[k].Value >>= aLabel;
+ break;
+ }
+ }
+ }
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ }
+
+ if ( aLabel.getLength() == 0 )
+ {
+ aLabel = commands[i].Command;
+ }
+
+ SvLBoxEntry* pFuncEntry = NULL;
+ if ( !!aImage )
+ {
+ pFuncEntry = pFunctionListBox->InsertEntry(
+ aLabel, aImage, aImage );
+ }
+ else
+ {
+ pFuncEntry = pFunctionListBox->InsertEntry(
+ aLabel, NULL );
+ }
+
+ SvxGroupInfo_Impl *_pGroupInfo = new SvxGroupInfo_Impl(
+ SVX_CFGFUNCTION_SLOT, 123, aCmdURL, ::rtl::OUString() );
+
+ pFunctionListBox->aArr.Insert(
+ _pGroupInfo, pFunctionListBox->aArr.Count() );
+
+ pFuncEntry->SetUserData( _pGroupInfo );
+ }
+ }
+ break;
+ }
+
+ case SVX_CFGGROUP_SCRIPTCONTAINER:
+ {
+ Reference< browse::XBrowseNode > rootNode( pInfo->xBrowseNode );
+
+ try {
+ if ( rootNode->hasChildNodes() )
+ {
+ Sequence< Reference< browse::XBrowseNode > > children =
+ rootNode->getChildNodes();
+
+ for ( long n = 0; n < children.getLength(); n++ )
+ {
+ if (!children[n].is())
+ continue;
+ if (children[n]->getType() == browse::BrowseNodeTypes::SCRIPT)
+ {
+ OUString uri;
+ OUString description;
+
+ Reference < beans::XPropertySet >xPropSet( children[n], UNO_QUERY );
+ if (!xPropSet.is())
+ {
+ continue;
+ }
+
+ Any value =
+ xPropSet->getPropertyValue( String::CreateFromAscii( "URI" ) );
+ value >>= uri;
+
+ try
+ {
+ value = xPropSet->getPropertyValue(
+ String::CreateFromAscii( "Description" ) );
+ value >>= description;
+ }
+ catch (Exception &) {
+ // do nothing, the description will be empty
+ }
+
+ SvxGroupInfo_Impl* _pGroupInfo =
+ new SvxGroupInfo_Impl(
+ SVX_CFGFUNCTION_SCRIPT, 123, uri, description );
+
+ Image aImage = GetImage( children[n], Reference< XComponentContext >(), sal_False, BMP_COLOR_NORMAL );
+ SvLBoxEntry* pNewEntry =
+ pFunctionListBox->InsertEntry( children[n]->getName(), NULL );
+ pFunctionListBox->SetExpandedEntryBmp(pNewEntry, aImage, BMP_COLOR_NORMAL);
+ pFunctionListBox->SetCollapsedEntryBmp(pNewEntry, aImage, BMP_COLOR_NORMAL);
+ aImage = GetImage( children[n], Reference< XComponentContext >(), sal_False, BMP_COLOR_HIGHCONTRAST );
+ pFunctionListBox->SetExpandedEntryBmp(pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST);
+ pFunctionListBox->SetCollapsedEntryBmp(pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST);
+
+ pNewEntry->SetUserData( _pGroupInfo );
+
+ pFunctionListBox->aArr.Insert(
+ _pGroupInfo, pFunctionListBox->aArr.Count() );
+
+ }
+ }
+ }
+ }
+ catch (const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ break;
+ }
+
+ default:
+ {
+ return;
+ }
+ }
+
+ if ( pFunctionListBox->GetEntryCount() )
+ pFunctionListBox->Select( pFunctionListBox->GetEntry( 0, 0 ) );
+
+ pFunctionListBox->SetUpdateMode(TRUE);
+}
+
+BOOL SvxConfigGroupListBox_Impl::Expand( SvLBoxEntry* pParent )
+{
+ BOOL bRet = SvTreeListBox::Expand( pParent );
+ if ( bRet )
+ {
+ // Wieviele Entries k"onnen angezeigt werden ?
+ ULONG nEntries = GetOutputSizePixel().Height() / GetEntryHeight();
+
+ // Wieviele Kinder sollen angezeigt werden ?
+ ULONG nChildCount = GetVisibleChildCount( pParent );
+
+ // Passen alle Kinder und der parent gleichzeitig in die View ?
+ if ( nChildCount+1 > nEntries )
+ {
+ // Wenn nicht, wenigstens parent ganz nach oben schieben
+ MakeVisible( pParent, TRUE );
+ }
+ else
+ {
+ // An welcher relativen ViewPosition steht der aufzuklappende parent
+ SvLBoxEntry *pEntry = GetFirstEntryInView();
+ ULONG nParentPos = 0;
+ while ( pEntry && pEntry != pParent )
+ {
+ nParentPos++;
+ pEntry = GetNextEntryInView( pEntry );
+ }
+
+ // Ist unter dem parent noch genug Platz f"ur alle Kinder ?
+ if ( nParentPos + nChildCount + 1 > nEntries )
+ ScrollOutputArea( (short)( nEntries - ( nParentPos + nChildCount + 1 ) ) );
+ }
+ }
+
+ return bRet;
+}
+
+void SvxConfigGroupListBox_Impl::RequestingChilds( SvLBoxEntry *pEntry )
+{
+ SvxGroupInfo_Impl *pInfo = (SvxGroupInfo_Impl*) pEntry->GetUserData();
+ pInfo->bWasOpened = TRUE;
+ switch ( pInfo->nKind )
+ {
+ case SVX_CFGGROUP_SCRIPTCONTAINER:
+ {
+ if ( !GetChildCount( pEntry ) )
+ {
+ Reference< browse::XBrowseNode > rootNode( pInfo->xBrowseNode ) ;
+ fillScriptList( rootNode, pEntry, true /* i30923 */ );
+ }
+ break;
+ }
+
+ default:
+ DBG_ERROR( "Falscher Gruppentyp!" );
+ break;
+ }
+}
+
+/*
+ * Implementation of SvxScriptSelectorDialog
+ *
+ * This dialog is used for selecting Slot API commands
+ * and Scripting Framework Scripts.
+ */
+
+SvxScriptSelectorDialog::SvxScriptSelectorDialog(
+ Window* pParent, BOOL bShowSlots, const Reference< frame::XFrame >& xFrame )
+ :
+ ModelessDialog( pParent, SVX_RES( RID_DLG_SCRIPTSELECTOR ) ),
+ aDialogDescription( this, SVX_RES( TXT_SELECTOR_DIALOG_DESCRIPTION ) ),
+ aGroupText( this, SVX_RES( TXT_SELECTOR_CATEGORIES ) ),
+ aCategories( this, SVX_RES( BOX_SELECTOR_CATEGORIES ), bShowSlots, xFrame ),
+ aFunctionText( this, SVX_RES( TXT_SELECTOR_COMMANDS ) ),
+ aCommands( this, SVX_RES( BOX_SELECTOR_COMMANDS ) ),
+ aOKButton( this, SVX_RES( BTN_SELECTOR_OK ) ),
+ aCancelButton( this, SVX_RES( BTN_SELECTOR_CANCEL ) ),
+ aHelpButton( this, SVX_RES( BTN_SELECTOR_HELP ) ),
+ aDescription( this, SVX_RES( GRP_SELECTOR_DESCRIPTION ) ),
+ aDescriptionText( this, SVX_RES( TXT_SELECTOR_DESCRIPTION ) ),
+ m_bShowSlots( bShowSlots )
+{
+
+ ResMgr& rMgr = DIALOG_MGR();
+
+ // If we are showing Slot API commands update labels in the UI, and
+ // enable drag'n'drop
+ if ( m_bShowSlots )
+ {
+ aGroupText.SetText( String( ResId( STR_SELECTOR_CATEGORIES, rMgr ) ) );
+ aOKButton.SetText( String( ResId( STR_SELECTOR_ADD, rMgr ) ) );
+ aCancelButton.SetText( String( ResId( STR_SELECTOR_CLOSE, rMgr ) ) );
+ aFunctionText.SetText( String( ResId( STR_SELECTOR_COMMANDS, rMgr ) ) );
+ SetDialogDescription(
+ String( ResId( STR_SELECTOR_ADD_COMMANDS_DESCRIPTION, rMgr ) ) );
+ SetText( String( ResId( STR_SELECTOR_ADD_COMMANDS, rMgr ) ) );
+
+ aCommands.SetDragDropMode( SV_DRAGDROP_APP_COPY );
+ }
+
+ ResizeControls();
+
+ aCategories.SetFunctionListBox( &aCommands );
+ aCategories.Init();
+ // aCategories.Select( aCategories.GetEntry( 0, 0 ) );
+
+ aCategories.SetSelectHdl(
+ LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
+ aCommands.SetSelectHdl( LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
+ aCommands.SetDoubleClickHdl( LINK( this, SvxScriptSelectorDialog, FunctionDoubleClickHdl ) );
+
+ aOKButton.SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
+ aCancelButton.SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
+
+ UpdateUI();
+ FreeResource();
+}
+
+void SvxScriptSelectorDialog::ResizeControls()
+{
+ Point p, newp;
+ Size s, news;
+ long gap;
+
+ USHORT style = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP |
+ TEXT_DRAW_LEFT | TEXT_DRAW_WORDBREAK;
+
+ // get dimensions of dialog instructions control
+ p = aDialogDescription.GetPosPixel();
+ s = aDialogDescription.GetSizePixel();
+
+ // get dimensions occupied by text in the control
+ Rectangle rect =
+ GetTextRect( Rectangle( p, s ), aDialogDescription.GetText(), style );
+ news = rect.GetSize();
+
+ // the gap is the difference between the control height and its text height
+ gap = s.Height() - news.Height();
+
+ // resize the dialog instructions control
+ news = Size( s.Width(), s.Height() - gap );
+ aDialogDescription.SetSizePixel( news );
+
+ // resize other controls to fill the gap
+ p = aGroupText.GetPosPixel();
+ newp = Point( p.X(), p.Y() - gap );
+ aGroupText.SetPosPixel( newp );
+
+ p = aCategories.GetPosPixel();
+ newp = Point( p.X(), p.Y() - gap );
+ aCategories.SetPosPixel( newp );
+ s = aCategories.GetSizePixel();
+ news = Size( s.Width(), s.Height() + gap );
+ aCategories.SetSizePixel( news );
+
+ p = aFunctionText.GetPosPixel();
+ newp = Point( p.X(), p.Y() - gap );
+ aFunctionText.SetPosPixel( newp );
+
+ p = aCommands.GetPosPixel();
+ newp = Point( p.X(), p.Y() - gap );
+ aCommands.SetPosPixel( newp );
+ s = aCommands.GetSizePixel();
+ news = Size( s.Width(), s.Height() + gap );
+ aCommands.SetSizePixel( news );
+
+ p = aOKButton.GetPosPixel();
+ newp = Point( p.X(), p.Y() - gap );
+ aOKButton.SetPosPixel( newp );
+
+ p = aCancelButton.GetPosPixel();
+ newp = Point( p.X(), p.Y() - gap );
+ aCancelButton.SetPosPixel( newp );
+
+ p = aHelpButton.GetPosPixel();
+ newp = Point( p.X(), p.Y() - gap );
+ aHelpButton.SetPosPixel( newp );
+}
+
+SvxScriptSelectorDialog::~SvxScriptSelectorDialog()
+{
+}
+
+IMPL_LINK( SvxScriptSelectorDialog, SelectHdl, Control*, pCtrl )
+{
+ if ( pCtrl == &aCategories )
+ {
+ aCategories.GroupSelected();
+ }
+ else if ( pCtrl == &aCommands )
+ {
+ aCommands.FunctionSelected();
+ }
+ UpdateUI();
+ return 0;
+}
+
+IMPL_LINK( SvxScriptSelectorDialog, FunctionDoubleClickHdl, Control*, pCtrl )
+{
+ (void)pCtrl;
+ if ( aOKButton.IsEnabled() )
+ return ClickHdl( &aOKButton );
+ return 0;
+}
+
+// Check if command is selected and enable the OK button accordingly
+// Grab the help text for this id if available and update the description field
+void
+SvxScriptSelectorDialog::UpdateUI()
+{
+ OUString url = GetScriptURL();
+ if ( url != NULL && url.getLength() != 0 )
+ {
+ String rMessage =
+ aCommands.GetHelpText( aCommands.FirstSelected() );
+ aDescriptionText.SetText( rMessage );
+
+ aOKButton.Enable( TRUE );
+ }
+ else
+ {
+ aDescriptionText.SetText( String() );
+ aOKButton.Enable( FALSE );
+ }
+}
+
+IMPL_LINK( SvxScriptSelectorDialog, ClickHdl, Button *, pButton )
+{
+ if ( pButton == &aCancelButton )
+ {
+ // If we are displaying Slot API commands then the dialog is being
+ // run from Tools/Configure and we should not close it, just hide it
+ if ( m_bShowSlots == FALSE )
+ {
+ EndDialog( RET_CANCEL );
+ }
+ else
+ {
+ Hide();
+ }
+ }
+ else if ( pButton == &aOKButton )
+ {
+ GetAddHdl().Call( this );
+
+ // If we are displaying Slot API commands then this the dialog is being
+ // run from Tools/Configure and we should not close it
+ if ( m_bShowSlots == FALSE )
+ {
+ EndDialog( RET_OK );
+ }
+ else
+ {
+ // Select the next entry in the list if possible
+ SvLBoxEntry* current = aCommands.FirstSelected();
+ SvLBoxEntry* next = aCommands.NextSibling( current );
+
+ if ( next != NULL )
+ {
+ aCommands.Select( next );
+ }
+ }
+ }
+
+ return 0;
+}
+
+void
+SvxScriptSelectorDialog::SetRunLabel()
+{
+ aOKButton.SetText( String( SVX_RES( STR_SELECTOR_RUN ) ) );
+}
+
+void
+SvxScriptSelectorDialog::SetDialogDescription( const String& rDescription )
+{
+ aDialogDescription.SetText( rDescription );
+}
+
+USHORT
+SvxScriptSelectorDialog::GetSelectedId()
+{
+ return aCommands.GetId( aCommands.GetLastSelectedEntry() );
+}
+
+String
+SvxScriptSelectorDialog::GetScriptURL() const
+{
+ OUString result;
+
+ SvLBoxEntry *pEntry = const_cast< SvxScriptSelectorDialog* >( this )->aCommands.GetLastSelectedEntry();
+ if ( pEntry )
+ {
+ SvxGroupInfo_Impl *pData = (SvxGroupInfo_Impl*) pEntry->GetUserData();
+ if ( ( pData->nKind == SVX_CFGFUNCTION_SLOT )
+ || ( pData->nKind == SVX_CFGFUNCTION_SCRIPT )
+ )
+ {
+ result = pData->sURL;
+ }
+ }
+
+ return result;
+}
+
+String
+SvxScriptSelectorDialog::GetSelectedDisplayName()
+{
+ return aCommands.GetEntryText( aCommands.GetLastSelectedEntry() );
+}
+
+String
+SvxScriptSelectorDialog::GetSelectedHelpText()
+{
+ return aCommands.GetHelpText( aCommands.GetLastSelectedEntry() );
+}
diff --git a/cui/source/customize/selector.hrc b/cui/source/customize/selector.hrc
new file mode 100644
index 000000000000..68c87b493593
--- /dev/null
+++ b/cui/source/customize/selector.hrc
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * 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: selector.hrc,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 TXT_SELECTOR_DIALOG_DESCRIPTION 1
+#define TXT_SELECTOR_CATEGORIES 2
+#define BOX_SELECTOR_CATEGORIES 3
+#define TXT_SELECTOR_COMMANDS 4
+#define BOX_SELECTOR_COMMANDS 5
+#define BTN_SELECTOR_OK 6
+#define BTN_SELECTOR_CANCEL 7
+#define BTN_SELECTOR_HELP 8
+#define GRP_SELECTOR_DESCRIPTION 9
+#define TXT_SELECTOR_DESCRIPTION 10
+#define IMG_HARDDISK 1
+#define IMG_HARDDISK_HC 2
+#define IMG_LIB 3
+#define IMG_LIB_HC 4
+#define IMG_MACRO 5
+#define IMG_MACRO_HC 6
+#define IMG_DOC 7
+#define IMG_DOC_HC 8
+
+#define STR_SELECTOR_ADD 310
+#define STR_SELECTOR_CLOSE 311
+#define STR_SELECTOR_COMMANDS 312
+#define STR_SELECTOR_ADD_COMMANDS 313
+#define STR_SELECTOR_ADD_COMMANDS_DESCRIPTION 314
+#define STR_SELECTOR_MACROS 315
+#define STR_SELECTOR_CATEGORIES 316
+#define STR_BASICMACROS 317
+#define STR_SELECTOR_RUN 318
+#define STR_MYMACROS 319
+#define STR_PRODMACROS 320
diff --git a/cui/source/customize/selector.src b/cui/source/customize/selector.src
new file mode 100644
index 000000000000..de972cdebc01
--- /dev/null
+++ b/cui/source/customize/selector.src
@@ -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: selector.src,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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.hrc"
+#include <svx/dialogs.hrc>
+#include "selector.hrc"
+
+#define MASKCOLOR MaskColor = \
+ Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+#define FIXEDTEXT_DIALOG_DESCRIPTION \
+Text [ en-US ] = "Select the library that contains the macro you want. Then select the macro under 'Macro name'." ;\
+
+String STR_SELECTOR_ADD_COMMANDS
+{
+ TEXT [ en-US ] = "Add Commands" ;
+};
+
+String STR_SELECTOR_MACROS
+{
+ Text [ en-US ] = "%PRODUCTNAME Macros" ;
+};
+
+String STR_SELECTOR_CATEGORIES
+{
+ Text [ en-US ] = "~Category" ;
+};
+
+String STR_SELECTOR_COMMANDS
+{
+ Text [ en-US ] = "Commands" ;
+};
+
+String STR_SELECTOR_ADD
+{
+ TEXT [ en-US ] = "Add" ;
+};
+
+String STR_SELECTOR_RUN
+{
+ TEXT [ en-US ] = "Run" ;
+
+};
+
+String STR_SELECTOR_CLOSE
+{
+ TEXT [ en-US ] = "Close" ;
+
+};
+
+String STR_SELECTOR_ADD_COMMANDS_DESCRIPTION
+{
+ TEXT [ en-US ] = "To add a command to a toolbar, select the category and then the command. Then drag the command to the Commands list of the Toolbars tab page in the Customize dialog.";
+};
+
+String STR_BASICMACROS
+{
+ Text [ en-US ] = "BASIC Macros" ;
+};
+
+
+ModelessDialog RID_DLG_SCRIPTSELECTOR
+{
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 256 , 233 ) ;
+ Text [ en-US ] = "Macro Selector" ;
+ HelpId = HID_SELECTOR_DIALOG;
+ SvLook = TRUE ;
+ Moveable = TRUE ;
+ Hide = TRUE;
+ FixedText TXT_SELECTOR_DIALOG_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 190 , 48 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ WordBreak = TRUE ;
+ FIXEDTEXT_DIALOG_DESCRIPTION
+ };
+ FixedText TXT_SELECTOR_CATEGORIES
+ {
+ Pos = MAP_APPFONT ( 6 , 62 ) ;
+ Size = MAP_APPFONT ( 83 , 8 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Text [ en-US ] = "Library" ;
+ };
+ Control BOX_SELECTOR_CATEGORIES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 73 ) ;
+ Size = MAP_APPFONT ( 83 , 89 ) ;
+ TabStop = TRUE;
+ HelpId = HID_SELECTOR_CATEGORIES;
+ String STR_MYMACROS
+ {
+ Text [ en-US ] = "My Macros";
+ };
+ String STR_PRODMACROS
+ {
+ Text [ en-US ] = "%PRODUCTNAME Macros";
+ };
+ Image IMG_HARDDISK
+ {
+ ImageBitmap = Bitmap { File = "harddisk_16.bmp" ; };
+ MASKCOLOR
+ };
+ Image IMG_HARDDISK_HC
+ {
+ ImageBitmap = Bitmap { File = "harddisk_16_h.bmp" ; };
+ MASKCOLOR
+ };
+ Image IMG_LIB
+ {
+ ImageBitmap = Bitmap { File = "im30820.png"; };
+ MASKCOLOR
+ };
+ Image IMG_LIB_HC
+ {
+ ImageBitmap = Bitmap { File = "imh30820.png"; };
+ MASKCOLOR
+ };
+ Image IMG_MACRO
+ {
+ ImageBitmap = Bitmap { File = "im30821.png"; };
+ MASKCOLOR
+ };
+ Image IMG_MACRO_HC
+ {
+ ImageBitmap = Bitmap { File = "imh30821.png"; };
+ MASKCOLOR
+ };
+ Image IMG_DOC
+ {
+ ImageBitmap = Bitmap { File = "im30826.png"; };
+ MASKCOLOR
+ };
+ Image IMG_DOC_HC
+ {
+ ImageBitmap = Bitmap { File = "imh30826.png"; };
+ MASKCOLOR
+ };
+ };
+ FixedText TXT_SELECTOR_COMMANDS
+ {
+ Pos = MAP_APPFONT ( 101 , 62 ) ;
+ Size = MAP_APPFONT ( 93 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Macro name" ;
+ };
+ Control BOX_SELECTOR_COMMANDS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 101 , 73 ) ;
+ Size = MAP_APPFONT ( 93 , 89 ) ;
+ TabStop = TRUE;
+ HelpId = HID_SELECTOR_COMMANDS;
+ };
+ OKButton BTN_SELECTOR_OK
+ {
+ Pos = MAP_APPFONT ( 200 , 73 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE;
+ };
+ CancelButton BTN_SELECTOR_CANCEL
+ {
+ Pos = MAP_APPFONT ( 200 , 90 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_SELECTOR_HELP
+ {
+ Pos = MAP_APPFONT ( 200 , 107 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ FixedLine GRP_SELECTOR_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 6 , 168 ) ;
+ Size = MAP_APPFONT ( 224 , 8 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "Description" ;
+ };
+ FixedText TXT_SELECTOR_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 12 , 179 ) ;
+ Size = MAP_APPFONT ( 224 , 48 ) ;
+ WordBreak = TRUE ;
+ };
+};
+ // ********************************************************************** EOF
diff --git a/cui/source/dialogs/SpellAttrib.cxx b/cui/source/dialogs/SpellAttrib.cxx
new file mode 100644
index 000000000000..9c26dc321f7b
--- /dev/null
+++ b/cui/source/dialogs/SpellAttrib.cxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * 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: SpellAttrib.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <SpellAttrib.hxx>
+#include <vcl/font.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
+using namespace svx;
+using namespace com::sun::star::linguistic2;
+using namespace com::sun::star::uno;
+
+/*-- 26.06.2008 10:41:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellErrorAttrib::SpellErrorAttrib( const SpellErrorDescription& rDesc ) :
+ TextAttrib(TEXTATTR_SPELL_ERROR),
+ m_aSpellErrorDescription( rDesc )
+{
+}
+
+/*-- 10.09.2003 12:54:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellErrorAttrib::SpellErrorAttrib( const SpellErrorAttrib& rAttr ) :
+ TextAttrib(TEXTATTR_SPELL_ERROR),
+ m_aSpellErrorDescription( rAttr.m_aSpellErrorDescription )
+{
+}
+/*-- 10.09.2003 12:54:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellErrorAttrib::~SpellErrorAttrib()
+{
+}
+/*-- 10.09.2003 12:54:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellErrorAttrib::SetFont( Font& ) const
+{
+ //this attribute doesn't have a visual effect
+}
+/*-- 10.09.2003 12:54:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+TextAttrib* SpellErrorAttrib::Clone() const
+{
+ return new SpellErrorAttrib(*this);
+}
+/*-- 10.09.2003 12:54:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SpellErrorAttrib::operator==( const TextAttrib& rAttr ) const
+{
+ return Which() == rAttr.Which() &&
+ m_aSpellErrorDescription == static_cast<const SpellErrorAttrib&>(rAttr).m_aSpellErrorDescription;
+}
+/*-- 10.09.2003 14:27:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellLanguageAttrib::SpellLanguageAttrib(LanguageType eLang) :
+ TextAttrib(TEXTATTR_SPELL_LANGUAGE),
+ m_eLanguage(eLang)
+{
+}
+/*-- 10.09.2003 14:27:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellLanguageAttrib::SpellLanguageAttrib( const SpellLanguageAttrib& rAttr ) :
+ TextAttrib(TEXTATTR_SPELL_LANGUAGE),
+ m_eLanguage(rAttr.m_eLanguage)
+{
+}
+/*-- 10.09.2003 14:27:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellLanguageAttrib::~SpellLanguageAttrib()
+{
+}
+/*-- 10.09.2003 14:27:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellLanguageAttrib::SetFont( Font& ) const
+{
+ //no visual effect
+}
+/*-- 10.09.2003 14:27:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+TextAttrib* SpellLanguageAttrib::Clone() const
+{
+ return new SpellLanguageAttrib(*this);
+}
+/*-- 10.09.2003 14:27:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SpellLanguageAttrib::operator==( const TextAttrib& rAttr ) const
+{
+ return Which() == rAttr.Which() &&
+ m_eLanguage == static_cast<const SpellLanguageAttrib&>(rAttr).m_eLanguage;
+}
+/*-- 31.10.2003 16:07:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellBackgroundAttrib::SpellBackgroundAttrib(const Color& rCol) :
+ TextAttrib(TEXTATTR_SPELL_BACKGROUND),
+ m_aBackgroundColor(rCol)
+{
+}
+/*-- 31.10.2003 16:07:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellBackgroundAttrib::SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr ) :
+ TextAttrib(TEXTATTR_SPELL_BACKGROUND),
+ m_aBackgroundColor(rAttr.m_aBackgroundColor)
+{
+}
+/*-- 31.10.2003 16:07:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellBackgroundAttrib::~SpellBackgroundAttrib()
+{
+}
+/*-- 31.10.2003 16:07:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellBackgroundAttrib::SetFont( Font& rFont ) const
+{
+ rFont.SetFillColor(m_aBackgroundColor);
+}
+/*-- 31.10.2003 16:07:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+TextAttrib* SpellBackgroundAttrib::Clone() const
+{
+ return new SpellBackgroundAttrib(*this);
+}
+/*-- 31.10.2003 16:07:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SpellBackgroundAttrib::operator==( const TextAttrib& rAttr ) const
+{
+ return Which() == rAttr.Which() &&
+ m_aBackgroundColor == static_cast<const SpellBackgroundAttrib&>(rAttr).m_aBackgroundColor;
+}
+
diff --git a/cui/source/dialogs/SpellAttrib.hxx b/cui/source/dialogs/SpellAttrib.hxx
new file mode 100644
index 000000000000..ac2bb278c594
--- /dev/null
+++ b/cui/source/dialogs/SpellAttrib.hxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * 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: SpellAttrib.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SPELL_ATTRIB
+#define _SVX_SPELL_ATTRIB
+
+#include <svtools/txtattr.hxx>
+#include <i18npool/lang.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/linguistic2/XProofreader.hpp>
+#include <tools/color.hxx>
+//namespace com{ namespace sun{ namespace star{ namespace linguistic2{
+// class XSpellAlternatives;
+//}}}}
+
+#define TEXTATTR_SPELL_ERROR (TEXTATTR_USER_START + 1)
+#define TEXTATTR_SPELL_LANGUAGE (TEXTATTR_USER_START + 2)
+#define TEXTATTR_SPELL_BACKGROUND (TEXTATTR_USER_START + 3)
+
+namespace svx{
+struct SpellErrorDescription
+{
+ bool bIsGrammarError;
+ ::rtl::OUString sErrorText;
+ ::rtl::OUString sDialogTitle;
+ ::rtl::OUString sExplanation;
+ ::com::sun::star::lang::Locale aLocale;
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
+ ::rtl::OUString sServiceName; //service name of GrammarChecker/SpellChecker
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aSuggestions;
+ ::rtl::OUString sRuleId;
+
+ SpellErrorDescription() :
+ bIsGrammarError( false ){}
+
+ SpellErrorDescription( bool bGrammar,
+ const ::rtl::OUString& rText,
+ const ::com::sun::star::lang::Locale& rLocale,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rSuggestions,
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > rxGrammarChecker,
+ const ::rtl::OUString& rServiceName,
+ const ::rtl::OUString* pDialogTitle = 0,
+ const ::rtl::OUString* pExplanation = 0,
+ const ::rtl::OUString* pRuleId = 0 ) :
+ bIsGrammarError( bGrammar ),
+ sErrorText( rText ),
+ aLocale( rLocale ),
+ xGrammarChecker( rxGrammarChecker ),
+ sServiceName( rServiceName ),
+ aSuggestions( rSuggestions )
+ {
+ if( pDialogTitle )
+ sDialogTitle = *pDialogTitle;
+ if( pExplanation )
+ sExplanation = *pExplanation;
+ if( pRuleId )
+ sRuleId = *pRuleId;
+ };
+
+ int operator==( const SpellErrorDescription& rDesc ) const
+ {
+ return bIsGrammarError == rDesc.bIsGrammarError &&
+ sErrorText.equals( rDesc.sErrorText ) &&
+ aLocale.Language.equals( rDesc.aLocale.Language ) &&
+ aLocale.Country.equals( rDesc.aLocale.Country ) &&
+ aLocale.Variant.equals( rDesc.aLocale.Variant ) &&
+ aSuggestions == rDesc.aSuggestions &&
+ xGrammarChecker == rDesc.xGrammarChecker &&
+ sDialogTitle.equals( rDesc.sDialogTitle ) &&
+ sExplanation.equals( rDesc.sExplanation ) &&
+ sRuleId == rDesc.sRuleId;
+ }
+};
+/* -----------------10.09.2003 14:23-----------------
+
+ --------------------------------------------------*/
+class SpellErrorAttrib : public TextAttrib
+{
+public:
+
+private:
+ //com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> m_xAlternatives;
+ SpellErrorDescription m_aSpellErrorDescription;
+
+ //not accessible
+ SpellErrorAttrib();
+public:
+// SpellErrorAttrib(com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> xAlternatives);
+ SpellErrorAttrib( const SpellErrorDescription& );
+ SpellErrorAttrib( const SpellErrorAttrib& rAttr );
+ ~SpellErrorAttrib();
+
+ const SpellErrorDescription& GetErrorDescription() const { return m_aSpellErrorDescription; }
+
+
+ virtual void SetFont( Font& rFont ) const;
+ virtual TextAttrib* Clone() const;
+ virtual int operator==( const TextAttrib& rAttr ) const;
+};
+/* -----------------10.09.2003 14:23-----------------
+
+ --------------------------------------------------*/
+class SpellLanguageAttrib : public TextAttrib
+{
+ LanguageType m_eLanguage;
+
+ //not accessible
+ SpellLanguageAttrib();
+
+public:
+ SpellLanguageAttrib(LanguageType eLanguage);
+ SpellLanguageAttrib( const SpellLanguageAttrib& rAttr );
+ ~SpellLanguageAttrib();
+
+ LanguageType GetLanguage() const {return m_eLanguage;}
+ void SetLanguage(LanguageType eLang)
+ {m_eLanguage = eLang;}
+
+
+ virtual void SetFont( Font& rFont ) const;
+ virtual TextAttrib* Clone() const;
+ virtual int operator==( const TextAttrib& rAttr ) const;
+};
+/* -----------------31.10.2003 16:01-----------------
+
+ --------------------------------------------------*/
+class SpellBackgroundAttrib : public TextAttrib
+{
+ Color m_aBackgroundColor;
+
+ //not accessible
+ SpellBackgroundAttrib();
+
+public:
+ SpellBackgroundAttrib(const Color& rCol);
+ SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr );
+ ~SpellBackgroundAttrib();
+
+ const Color& GetColor() const { return m_aBackgroundColor;}
+ void SetColor( const Color& rNewCol ){m_aBackgroundColor = rNewCol;}
+
+
+ virtual void SetFont( Font& rFont ) const;
+ virtual TextAttrib* Clone() const;
+ virtual int operator==( const TextAttrib& rAttr ) const;
+};
+}//namespace svx
+#endif
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
new file mode 100644
index 000000000000..34f496a18a83
--- /dev/null
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -0,0 +1,2155 @@
+/*************************************************************************
+ *
+ * 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: SpellDialog.cxx,v $
+ * $Revision: 1.24 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <tools/ref.hxx>
+#include <tools/shl.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/scrbar.hxx>
+#include <SpellAttrib.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <svl/undo.hxx>
+#include <unotools/lingucfg.hxx>
+#include <svtools/textdata.hxx>
+#include <svtools/filter.hxx>
+#include <svx/unolingu.hxx>
+#include <svx/splwrap.hxx>
+#include <linguistic/lngprops.hxx>
+#include <linguistic/misc.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XServiceDisplayName.hpp>
+#include <com/sun/star/linguistic2/SpellFailure.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <sfx2/app.hxx>
+#include <vcl/help.hxx>
+#include <vcl/graph.hxx>
+#include <osl/file.hxx>
+#include <svx/impgrf.hxx>
+#include <svx/dialogs.hrc>
+#include <helpid.hrc>
+#include "SpellDialog.hrc"
+#include <svx/optitems.hxx>
+#include <svx/svxenum.hxx>
+#include <svx/SpellDialogChildWindow.hxx>
+#include "SpellDialog.hxx"
+#include <svx/dlgutil.hxx>
+#include "optlingu.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/svxerr.hxx>
+#include "treeopt.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::linguistic2;
+
+#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar)
+// struct SpellDialog_Impl ---------------------------------------------
+
+struct SpellDialog_Impl
+{
+ Sequence< Reference< XDictionary > > aDics;
+};
+// -----------------------------------------------------------------------
+//#define VENDOR_IMAGE_HEIGHT 44 //as specified
+
+#define SPELLUNDO_CHANGE_LANGUAGE (TEXTUNDO_USER + 1)
+#define SPELLUNDO_CHANGE_TEXTENGINE (TEXTUNDO_USER + 2)
+#define SPELLUNDO_CHANGE_NEXTERROR (TEXTUNDO_USER + 3)
+#define SPELLUNDO_CHANGE_ADD_TO_DICTIONARY (TEXTUNDO_USER + 4)
+#define SPELLUNDO_CHANGE_GROUP (TEXTUNDO_USER + 5) //undo list
+#define SPELLUNDO_MOVE_ERROREND (TEXTUNDO_USER + 6)
+#define SPELLUNDO_UNDO_EDIT_MODE (TEXTUNDO_USER + 7)
+#define SPELLUNDO_ADD_IGNORE_RULE (TEXTUNDO_USER + 8)
+
+namespace svx{
+class SpellUndoAction_Impl : public SfxUndoAction
+{
+ USHORT m_nId;
+ const Link& m_rActionLink;
+ //undo of button enabling
+ bool m_bEnableChangePB;
+ bool m_bEnableChangeAllPB;
+ //undo of MarkNextError - used in change and change all, ignore and ignore all
+ long m_nNewErrorStart;
+ long m_nNewErrorEnd;
+ long m_nOldErrorStart;
+ long m_nOldErrorEnd;
+ bool m_bIsErrorLanguageSelected;
+ ::rtl::OUString m_sRuleId;
+ //undo of AddToDictionary
+ Reference<XDictionary> m_xDictionary;
+ ::rtl::OUString m_sAddedWord;
+ //move end of error - ::ChangeMarkedWord()
+ long m_nOffset;
+
+public:
+ SpellUndoAction_Impl(USHORT nId, const Link& rActionLink) :
+ m_nId(nId),
+ m_rActionLink( rActionLink),
+ m_bEnableChangePB(false),
+ m_bEnableChangeAllPB(false),
+ m_nNewErrorStart(-1),
+ m_nNewErrorEnd(-1),
+ m_nOldErrorStart(-1),
+ m_nOldErrorEnd(-1),
+ m_bIsErrorLanguageSelected(false),
+ m_nOffset(0)
+ {}
+
+ ~SpellUndoAction_Impl();
+
+ virtual void Undo();
+ virtual USHORT GetId() const;
+
+ void SetEnableChangePB(){m_bEnableChangePB = true;}
+ bool IsEnableChangePB(){return m_bEnableChangePB;}
+
+ void SetEnableChangeAllPB(){m_bEnableChangeAllPB = true;}
+ bool IsEnableChangeAllPB(){return m_bEnableChangeAllPB;}
+
+ void SetErrorMove(long nNewStart, long nNewEnd, long nOldStart, long nOldEnd)
+ {
+ m_nNewErrorStart = nNewStart;
+ m_nNewErrorEnd = nNewEnd;
+ m_nOldErrorStart = nOldStart;
+ m_nOldErrorEnd = nOldEnd;
+ }
+ long GetNewErrorStart() { return m_nNewErrorStart;}
+ long GetNewErrorEnd() { return m_nNewErrorEnd;}
+ long GetOldErrorStart() { return m_nOldErrorStart;}
+ long GetOldErrorEnd() { return m_nOldErrorEnd;}
+
+ void SetErrorLanguageSelected(bool bSet){ m_bIsErrorLanguageSelected = bSet;}
+ bool IsErrorLanguageSelected() const {return m_bIsErrorLanguageSelected;}
+
+
+ void SetDictionary(Reference<XDictionary> xDict) { m_xDictionary = xDict; }
+ Reference<XDictionary> GetDictionary() const {return m_xDictionary;}
+ void SetAddedWord(const ::rtl::OUString& rWord) {m_sAddedWord = rWord;}
+ const ::rtl::OUString& GetAddedWord() const { return m_sAddedWord;}
+
+ void SetOffset(long nSet) {m_nOffset = nSet;}
+ long GetOffset() const {return m_nOffset;}
+
+ void SetErrorType( const ::rtl::OUString& rId ) { m_sRuleId = rId; }
+ const ::rtl::OUString& GetErrorType() const { return m_sRuleId; }
+
+};
+}//namespace svx
+using namespace ::svx;
+/*-- 06.11.2003 12:16:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellUndoAction_Impl::~SpellUndoAction_Impl()
+{
+}
+/*-- 06.11.2003 12:16:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellUndoAction_Impl::Undo()
+{
+ m_rActionLink.Call(this);
+}
+/*-- 06.11.2003 12:16:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+USHORT SpellUndoAction_Impl::GetId()const
+{
+ return m_nId;
+}
+
+// class SvxSpellCheckDialog ---------------------------------------------
+
+SpellDialog::SpellDialog(
+ SpellDialogChildWindow* pChildWindow,
+ Window * pParent,
+ SfxBindings* _pBindings)
+ : SfxModelessDialog (_pBindings,
+ pChildWindow,
+ pParent,
+ SVX_RES(RID_SVXDLG_SPELLCHECK)),
+
+ aVendorImageFI ( this , SVX_RES( IMG_VENDOR ) ),
+ aLanguageFT ( this, SVX_RES( FT_LANGUAGE ) ),
+ aLanguageLB ( this, SVX_RES( LB_LANGUAGE ) ),
+ aNotInDictFT ( this, SVX_RES( FT_NOTINDICT ) ),
+ aSentenceED ( this, SVX_RES( ED_NEWWORD ) ),
+ aSuggestionFT ( this, SVX_RES( FT_SUGGESTION ) ),
+ aSuggestionLB ( this, SVX_RES( LB_SUGGESTION ) ),
+
+ aIgnorePB ( this, SVX_RES( PB_IGNORE ) ),
+ aIgnoreAllPB ( this, SVX_RES( PB_IGNOREALL ) ),
+ aIgnoreRulePB ( this, SVX_RES( PB_IGNORERULE ) ),
+ aAddToDictMB ( this, SVX_RES( MB_ADDTODICT ) ),
+
+ aChangePB ( this, SVX_RES( PB_CHANGE ) ),
+ aChangeAllPB ( this, SVX_RES( PB_CHANGEALL ) ),
+ aExplainPB ( this, SVX_RES( PB_EXPLAIN) ),
+ aAutoCorrPB ( this, SVX_RES( PB_AUTOCORR ) ),
+
+ aCheckGrammarCB ( this, SVX_RES( CB_CHECK_GRAMMAR ) ),
+
+ aHelpPB ( this, SVX_RES( PB_HELP ) ),
+ aOptionsPB ( this, SVX_RES( PB_OPTIONS ) ),
+ aUndoPB ( this, SVX_RES( PB_UNDO ) ),
+ aClosePB ( this, SVX_RES( PB_CLOSE ) ),
+ aBackgroundGB ( this, SVX_RES( GB_BACKGROUND ) ),
+
+ aVendorImage ( SVX_RES( IMG_DEFAULT_VENDOR ) ),
+ aVendorImageHC ( SVX_RES( IMG_DEFAULT_VENDOR_HC ) ),
+
+ aResumeST ( SVX_RES(ST_RESUME )),
+ aIgnoreOnceST ( aIgnorePB.GetText()),
+ aNoSuggestionsST( SVX_RES(ST_NOSUGGESTIONS)),
+ m_sTitleSpelling ( SVX_RES( ST_SPELLING ) ),
+ m_sTitleSpellingGrammar ( SVX_RES( ST_SPELLING_AND_GRAMMAR ) ),
+ m_sTitleSpellingGrammarVendor ( SVX_RES( ST_SPELLING_AND_GRAMMAR_VENDORNAME ) ),
+ aDialogUndoLink( LINK (this, SpellDialog, DialogUndoHdl)),
+ bModified( false ),
+ bFocusLocked( true ),
+ rParent ( *pChildWindow ),
+ nOldLang ( LANGUAGE_NONE )
+{
+ FreeResource();
+ xSpell = LinguMgr::GetSpellChecker();
+ pImpl = new SpellDialog_Impl;
+
+ //HelpIds
+ aClosePB. SetHelpId(HID_SPLDLG_BUTTON_CLOSE );
+ aIgnorePB. SetHelpId(HID_SPLDLG_BUTTON_IGNORE );
+ aIgnoreAllPB. SetHelpId(HID_SPLDLG_BUTTON_IGNOREALL);
+ aIgnoreRulePB. SetHelpId(HID_SPLDLG_BUTTON_IGNORERULE);
+ aChangePB. SetHelpId(HID_SPLDLG_BUTTON_CHANGE );
+ aChangeAllPB. SetHelpId(HID_SPLDLG_BUTTON_CHANGEALL);
+ aExplainPB. SetHelpId(HID_SPLDLG_BUTTON_EXPLAIN );
+ Init_Impl();
+
+ // disable controls if service is missing
+ if (!xSpell.is())
+ Enable( sal_False );
+
+ Application::PostUserEvent( STATIC_LINK(
+ this, SpellDialog, InitHdl ) );
+}
+
+// -----------------------------------------------------------------------
+
+SpellDialog::~SpellDialog()
+{
+ // save possibly modified user-dictionaries
+ Reference< XDictionaryList > xDicList( SvxGetDictionaryList() );
+ if (xDicList.is())
+ {
+ linguistic::SaveDictionaries( xDicList );
+ }
+
+ delete aAddToDictMB.GetPopupMenu();
+ delete pImpl;
+}
+
+// -----------------------------------------------------------------------
+
+void SpellDialog::Init_Impl()
+{
+ // Handler initialisieren
+ aClosePB.SetClickHdl(LINK( this, SpellDialog, CancelHdl ) );
+ aChangePB.SetClickHdl(LINK( this, SpellDialog, ChangeHdl ) );
+ aChangeAllPB.SetClickHdl(LINK( this, SpellDialog, ChangeAllHdl ) );
+ aIgnorePB.SetClickHdl(LINK( this, SpellDialog, IgnoreHdl ) );
+ aIgnoreAllPB.SetClickHdl(LINK( this, SpellDialog, IgnoreAllHdl ) );
+ aIgnoreRulePB.SetClickHdl(LINK( this, SpellDialog, IgnoreAllHdl ) );
+ aUndoPB.SetClickHdl(LINK( this, SpellDialog, UndoHdl ) );
+
+ aAutoCorrPB.SetClickHdl( LINK( this, SpellDialog, ExtClickHdl ) );
+ aCheckGrammarCB.SetClickHdl( LINK( this, SpellDialog, CheckGrammarHdl ));
+ aOptionsPB .SetClickHdl( LINK( this, SpellDialog, ExtClickHdl ) );
+
+ aSuggestionLB.SetDoubleClickHdl( LINK( this, SpellDialog, ChangeHdl ) );
+
+ aSentenceED.SetModifyHdl(LINK ( this, SpellDialog, ModifyHdl) );
+ aAddToDictMB.SetSelectHdl(LINK ( this, SpellDialog, AddToDictionaryHdl ) );
+ aLanguageLB.SetSelectHdl(LINK( this, SpellDialog, LanguageSelectHdl ) );
+
+ // initialize language ListBox
+ aLanguageLB.SetLanguageList( LANG_LIST_SPELL_USED, FALSE, FALSE, TRUE );
+
+ // get current language
+ UpdateBoxes_Impl();
+
+ // fill dictionary PopupMenu
+ InitUserDicts();
+
+ aSentenceED.ClearModifyFlag();
+ SvxGetChangeAllList()->clear();
+}
+
+// -----------------------------------------------------------------------
+
+void SpellDialog::UpdateBoxes_Impl()
+{
+ sal_Int32 i;
+ aSuggestionLB.Clear();
+
+ const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+
+ LanguageType nAltLanguage = LANGUAGE_NONE;
+ //String aAltWord;
+ Sequence< ::rtl::OUString > aNewWords;
+ bool bIsGrammarError = false;
+ if( pSpellErrorDescription )
+ {
+ nAltLanguage = SvxLocaleToLanguage( pSpellErrorDescription->aLocale );
+ //aAltWord = String( xAlt->getWord() );
+ aNewWords = pSpellErrorDescription->aSuggestions;
+ bIsGrammarError = pSpellErrorDescription->bIsGrammarError;
+ aExplainPB.SetExplanation(pSpellErrorDescription->sExplanation );
+ }
+ if( pSpellErrorDescription && pSpellErrorDescription->sDialogTitle.getLength() )
+ {
+ // use this function to apply the correct image to be used...
+ SetTitle_Impl( nAltLanguage );
+ // then change the title to the one to be actually used
+ SetText( pSpellErrorDescription->sDialogTitle );
+ }
+ else
+ SetTitle_Impl( nAltLanguage );
+ SetSelectedLang_Impl( nAltLanguage );
+
+
+ // Alternativen eintragen
+ const ::rtl::OUString *pNewWords = aNewWords.getConstArray();
+ const sal_Int32 nSize = aNewWords.getLength();
+ for ( i = 0; i < nSize; ++i )
+ {
+ String aTmp( pNewWords[i] );
+ if ( LISTBOX_ENTRY_NOTFOUND == aSuggestionLB.GetEntryPos( aTmp ) )
+ {
+ aSuggestionLB.InsertEntry( aTmp );
+ aSuggestionLB.SetEntryFlags(aSuggestionLB.GetEntryCount() - 1, LISTBOX_ENTRY_FLAG_MULTILINE);
+ }
+ }
+ if(!nSize)
+ aSuggestionLB.InsertEntry( aNoSuggestionsST );
+ aAutoCorrPB.Enable( nSize > 0 );
+ //aSentenceED.GrabFocus();
+
+ aSuggestionFT.Enable(nSize > 0);
+ aSuggestionLB.Enable(nSize > 0);
+ if( nSize )
+ {
+ aSuggestionLB.SelectEntryPos(0);
+ }
+ aChangePB.Enable( nSize > 0);
+ aChangeAllPB.Enable(nSize > 0);
+ bool bShowChangeAll = !bIsGrammarError;
+ aChangeAllPB.Show( bShowChangeAll );
+ aExplainPB.Show( !bShowChangeAll );
+ aLanguageLB.Enable( bShowChangeAll );
+ aIgnoreAllPB.Show( bShowChangeAll );
+ aAddToDictMB.Show( bShowChangeAll );
+ aIgnoreRulePB.Show( !bShowChangeAll );
+ aIgnoreRulePB.Enable(pSpellErrorDescription && pSpellErrorDescription->sRuleId.getLength());
+ aExplainPB.Enable( aExplainPB.HasExplanation() );
+ aAutoCorrPB.Show( bShowChangeAll && rParent.HasAutoCorrection() );
+
+}
+// -----------------------------------------------------------------------
+
+void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence)
+{
+ //initially or after the last error of a sentence MarkNextError will fail
+ //then GetNextSentence() has to be called followed again by MarkNextError()
+ //MarkNextError is not initally called if the UndoEdit mode is active
+ bool bNextSentence = false;
+ if((!aSentenceED.IsUndoEditMode() && aSentenceED.MarkNextError()) ||
+ true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence) && aSentenceED.MarkNextError()))
+ {
+ const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ if( pSpellErrorDescription )
+ {
+ UpdateBoxes_Impl();
+ Control* aControls[] =
+ {
+ &aNotInDictFT,
+ &aSentenceED,
+ &aLanguageFT,
+ 0
+ };
+ sal_Int32 nIdx = 0;
+ do
+ {
+ aControls[nIdx]->Enable(sal_True);
+ }
+ while(aControls[++nIdx]);
+
+
+ }
+ if( bNextSentence )
+ {
+ //remove undo if a new sentence is active
+ aSentenceED.ResetUndo();
+ aUndoPB.Enable(FALSE);
+ }
+ }
+}
+/* -----------------10.09.2003 14:04-----------------
+ Initialize, asynchronous to prevent virtial calls
+ from a constructor
+ --------------------------------------------------*/
+IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG )
+{
+ pThis->SetUpdateMode( sal_False );
+ //show or hide AutoCorrect depending on the modules abilities
+ pThis->aAutoCorrPB.Show(pThis->rParent.HasAutoCorrection());
+ pThis->SpellContinue_Impl();
+ pThis->aSentenceED.ResetUndo();
+ pThis->aUndoPB.Enable(FALSE);
+
+ pThis->LockFocusChanges(true);
+ if( pThis->aChangePB.IsEnabled() )
+ pThis->aChangePB.GrabFocus();
+ else if( pThis->aIgnorePB.IsEnabled() )
+ pThis->aIgnorePB.GrabFocus();
+ else if( pThis->aClosePB.IsEnabled() )
+ pThis->aClosePB.GrabFocus();
+ pThis->LockFocusChanges(false);
+ //show grammar CheckBox depending on the modules abilities
+ bool bHasGrammarChecking = pThis->rParent.HasGrammarChecking();
+ pThis->aCheckGrammarCB.Show( bHasGrammarChecking );
+ if( !bHasGrammarChecking )
+ {
+ //resize the dialog to hide the hidden area of the CheckBox
+ Size aBackSize = pThis->aBackgroundGB.GetSizePixel();
+ sal_Int32 nDiff = pThis->aBackgroundGB.GetPosPixel().Y() + aBackSize.Height()
+ - pThis->aCheckGrammarCB.GetPosPixel().Y();
+ aBackSize.Height() -= nDiff;
+ pThis->aBackgroundGB.SetSizePixel(aBackSize);
+ Button* aButtons[] = { &pThis->aHelpPB, &pThis->aOptionsPB, &pThis->aUndoPB, &pThis->aClosePB, 0 };
+ sal_Int32 nButton = 0;
+ while( aButtons[nButton])
+ {
+ Point aPos = aButtons[nButton]->GetPosPixel();
+ aPos.Y() -= nDiff;
+ aButtons[nButton]->SetPosPixel(aPos);
+ ++nButton;
+ }
+ Size aDlgSize = pThis->GetSizePixel();
+ aDlgSize.Height() -= nDiff;
+ pThis->SetSizePixel( aDlgSize );
+ }
+ else
+ {
+ if( SvtLinguConfig().HasAnyVendorImages() )
+ {
+ pThis->aVendorImageFI.Show();
+ Size aVendorSize = pThis->aVendorImageFI.GetSizePixel();
+ Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel();
+ if( aImageSize.Height() )
+ {
+ aVendorSize.Height() = aImageSize.Height();
+ if(aVendorSize.Width() < aImageSize.Width())
+ aVendorSize.Width() = aImageSize.Width();
+ pThis->aVendorImageFI.SetSizePixel( aVendorSize );
+ }
+ //aVendorSize.Height() = nDiff;
+ sal_Int32 nDiff = aVendorSize.Height();
+ pThis->aVendorImageFI.SetSizePixel(aVendorSize);
+ Control* aControls[] = {
+ &pThis->aLanguageFT,
+ &pThis->aLanguageLB,
+ &pThis->aNotInDictFT,
+ &pThis->aSentenceED,
+ &pThis->aSuggestionFT,
+ &pThis->aSuggestionLB,
+ &pThis->aIgnorePB,
+ &pThis->aIgnoreAllPB,
+ &pThis->aIgnoreRulePB,
+ &pThis->aAddToDictMB,
+ &pThis->aChangePB,
+ &pThis->aChangeAllPB,
+ &pThis->aExplainPB,
+ &pThis->aAutoCorrPB,
+ &pThis->aCheckGrammarCB,
+ &pThis->aHelpPB,
+ &pThis->aOptionsPB,
+ &pThis->aUndoPB,
+ &pThis->aClosePB,
+ &pThis->aBackgroundGB,
+ 0
+ };
+ sal_Int32 nControl = 0;
+ while( aControls[nControl])
+ {
+ Point aPos = aControls[nControl]->GetPosPixel();
+ aPos.Y() += nDiff;
+ aControls[nControl]->SetPosPixel(aPos);
+ ++nControl;
+ }
+ Size aDlgSize = pThis->GetSizePixel();
+ aDlgSize.Height() += nDiff;
+ pThis->SetSizePixel( aDlgSize );
+ pThis->Invalidate();
+ }
+ }
+ pThis->aCheckGrammarCB.Check( pThis->rParent.IsGrammarChecking() );
+ pThis->SetUpdateMode( sal_True );
+ pThis->Show();
+ return 0;
+};
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SpellDialog, ExtClickHdl, Button *, pBtn )
+{
+ if (&aOptionsPB == pBtn)
+ StartSpellOptDlg_Impl();
+ else if(&aAutoCorrPB == pBtn)
+ {
+ //get the currently selected wrong word
+ String sCurrentErrorText = aSentenceED.GetErrorText();
+ //get the wrong word from the XSpellAlternative
+ const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ if( pSpellErrorDescription )
+ {
+ String sWrong(pSpellErrorDescription->sErrorText);
+ //if the word has not been edited in the MultiLineEdit then
+ //the current suggestion should be used
+ //if it's not the 'no suggestions' entry
+ if(sWrong == sCurrentErrorText &&
+ aSuggestionLB.IsEnabled() && aSuggestionLB.GetSelectEntryCount() > 0 &&
+ aNoSuggestionsST != aSuggestionLB.GetSelectEntry())
+ {
+ sCurrentErrorText = aSuggestionLB.GetSelectEntry();
+ }
+ if(sWrong != sCurrentErrorText)
+ {
+ SvxPrepareAutoCorrect( sWrong, sCurrentErrorText );
+ LanguageType eLang = GetSelectedLang_Impl();
+ rParent.AddAutoCorrection( sWrong, sCurrentErrorText, eLang );
+ }
+ }
+ }
+ return 0;
+}
+// -----------------------------------------------------------------------
+IMPL_LINK( SpellDialog, CheckGrammarHdl, CheckBox*, pBox )
+{
+ rParent.SetGrammarChecking( pBox->IsChecked() );
+ Impl_Restore();
+ return 0;
+}
+
+void SpellDialog::StartSpellOptDlg_Impl()
+{
+ sal_uInt16 aSpellInfos[] =
+ {
+ SID_ATTR_SPELL,SID_ATTR_SPELL,
+ SID_SPELL_MODIFIED, SID_SPELL_MODIFIED,
+ SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
+ 0
+ };
+ SfxItemSet aSet( SFX_APP()->GetPool(), aSpellInfos);
+ aSet.Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL ));
+ SfxSingleTabDialog* pDlg =
+ new SfxSingleTabDialog( this, aSet, RID_SFXPAGE_LINGU );
+ SfxTabPage* pPage = SvxLinguTabPage::Create( pDlg, aSet );
+ ( (SvxLinguTabPage*)pPage )->HideGroups( GROUP_MODULES );
+ pDlg->SetTabPage( pPage );
+ if(RET_OK == pDlg->Execute())
+ {
+
+ // Benutzerb"ucher anzeigen
+ InitUserDicts();
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ if(pOutSet)
+ OfaTreeOptionsDialog::ApplyLanguageOptions(*pOutSet);
+ }
+ delete pDlg;
+
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SpellDialog, ChangeHdl, Button *, EMPTYARG )
+{
+ if(aSentenceED.IsUndoEditMode())
+ {
+ SpellContinue_Impl();
+ }
+ else
+ {
+ aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
+ String aString = aSentenceED.GetErrorText();
+ //dots are sometimes part of the spelled word but they are not necessarily part of the replacement
+ bool bDot = aString.Len() && aString.GetChar(aString.Len() - 1 ) == '.';
+ if(aSuggestionLB.IsEnabled() &&
+ aSuggestionLB.GetSelectEntryCount()>0 &&
+ aNoSuggestionsST != aSuggestionLB.GetSelectEntry())
+ aString = aSuggestionLB.GetSelectEntry();
+ if(bDot && (!aString.Len() || aString.GetChar(aString.Len() - 1 ) != '.'))
+ aString += '.';
+
+ aSentenceED.ChangeMarkedWord(aString, GetSelectedLang_Impl());
+ SpellContinue_Impl();
+ bModified = false;
+ aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP );
+ }
+ if(!aChangePB.IsEnabled())
+ aIgnorePB.GrabFocus();
+ return 1;
+}
+
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SpellDialog, ChangeAllHdl, Button *, EMPTYARG )
+{
+ aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
+ // change the current word first
+ String aString = aSentenceED.GetErrorText();
+ if(aSuggestionLB.IsEnabled() &&
+ aSuggestionLB.GetSelectEntryCount()>0 &&
+ aNoSuggestionsST != aSuggestionLB.GetSelectEntry())
+ aString = aSuggestionLB.GetSelectEntry();
+
+ LanguageType eLang = GetSelectedLang_Impl();
+
+ // add new word to ChangeAll list
+ String aOldWord( aSentenceED.GetErrorText() );
+ SvxPrepareAutoCorrect( aOldWord, aString );
+ Reference<XDictionary> aXDictionary( SvxGetChangeAllList(), UNO_QUERY );
+ sal_uInt8 nAdded = linguistic::AddEntryToDic( aXDictionary,
+ aOldWord , sal_True,
+ aString, eLang );
+
+ if(nAdded == DIC_ERR_NONE)
+ {
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink);
+ pAction->SetDictionary(aXDictionary);
+ pAction->SetAddedWord(aOldWord);
+ aSentenceED.AddUndoAction(pAction);
+ }
+
+ aSentenceED.ChangeMarkedWord(aString, eLang);
+ SpellContinue_Impl();
+ bModified = false;
+ aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP );
+ return 1;
+}
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SpellDialog, IgnoreAllHdl, Button *, pButton )
+{
+ aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
+ // add word to IgnoreAll list
+ Reference< XDictionary > aXDictionary( SvxGetIgnoreAllList(), UNO_QUERY );
+ //in case the error has been changed manually it has to be restored
+ aSentenceED.RestoreCurrentError();
+ if( pButton == &aIgnoreRulePB )
+ {
+ const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ try
+ {
+ if( pSpellErrorDescription && pSpellErrorDescription->xGrammarChecker.is() )
+ {
+ pSpellErrorDescription->xGrammarChecker->ignoreRule( pSpellErrorDescription->sRuleId,
+ pSpellErrorDescription->aLocale );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ }
+ }
+ else
+ {
+ String sErrorText(aSentenceED.GetErrorText());
+ sal_uInt8 nAdded = linguistic::AddEntryToDic( aXDictionary,
+ sErrorText, sal_False,
+ ::rtl::OUString(), LANGUAGE_NONE );
+ if(nAdded == DIC_ERR_NONE)
+ {
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink);
+ pAction->SetDictionary(aXDictionary);
+ pAction->SetAddedWord(sErrorText);
+ aSentenceED.AddUndoAction(pAction);
+ }
+ }
+
+ SpellContinue_Impl();
+ bModified = false;
+ aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP );
+ return 1;
+}
+/*-- 06.11.2003 11:24:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SpellDialog, UndoHdl, Button*, EMPTYARG )
+{
+ aSentenceED.Undo();
+ if(!aSentenceED.GetUndoActionCount())
+ aUndoPB.Enable(FALSE);
+ return 0;
+}
+/*-- 06.11.2003 12:19:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SpellDialog, DialogUndoHdl, SpellUndoAction_Impl*, pAction )
+{
+ switch(pAction->GetId())
+ {
+ case SPELLUNDO_CHANGE_TEXTENGINE:
+ {
+ if(pAction->IsEnableChangePB())
+ aChangePB.Enable(FALSE);
+ if(pAction->IsEnableChangeAllPB())
+ aChangeAllPB.Enable(FALSE);
+ }
+ break;
+ case SPELLUNDO_CHANGE_NEXTERROR:
+ {
+ aSentenceED.MoveErrorMarkTo((USHORT)pAction->GetOldErrorStart(), (USHORT)pAction->GetOldErrorEnd(), false);
+ if(pAction->IsErrorLanguageSelected())
+ {
+ UpdateBoxes_Impl();
+ }
+ }
+ break;
+ case SPELLUNDO_CHANGE_ADD_TO_DICTIONARY:
+ {
+ if(pAction->GetDictionary().is())
+ pAction->GetDictionary()->remove(pAction->GetAddedWord());
+ }
+ break;
+ case SPELLUNDO_MOVE_ERROREND :
+ {
+ if(pAction->GetOffset() != 0)
+ aSentenceED.MoveErrorEnd(pAction->GetOffset());
+ }
+ break;
+ case SPELLUNDO_UNDO_EDIT_MODE :
+ {
+ //refill the dialog with the currently spelled sentence - throw away all changes
+ SpellContinue_Impl(true);
+ }
+ break;
+ case SPELLUNDO_ADD_IGNORE_RULE:
+ //undo of ignored rules is not supported
+ break;
+ }
+
+ return 0;
+}
+// -----------------------------------------------------------------------
+void SpellDialog::Impl_Restore()
+{
+ //clear the "ChangeAllList"
+ SvxGetChangeAllList()->clear();
+ //get a new sentence
+ aSentenceED.SetText(rtl::OUString());
+ aSentenceED.ResetModified();
+ SpellContinue_Impl();
+ aIgnorePB.SetText(aIgnoreOnceST);
+}
+
+IMPL_LINK( SpellDialog, IgnoreHdl, Button *, EMPTYARG )
+{
+ if(aIgnorePB.GetText() == aResumeST)
+ {
+ Impl_Restore();
+ }
+ else
+ {
+ //in case the error has been changed manually it has to be restored
+ aSentenceED.RestoreCurrentError();
+ rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true));
+ aSentenceED.ResetModified();
+
+ // the word is being ignored
+ SpellContinue_Impl();
+ bModified = false;
+ }
+ return 1;
+}
+
+
+// -----------------------------------------------------------------------
+
+sal_Bool SpellDialog::Close()
+{
+ GetBindings().GetDispatcher()->
+ Execute(rParent.GetType(),
+ SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
+ return sal_True;
+}
+// -----------------------------------------------------------------------
+
+void SpellDialog::SetSelectedLang_Impl( LanguageType nLang )
+{
+ aLanguageLB.SelectLanguage( nLang );
+}
+
+// -----------------------------------------------------------------------
+
+LanguageType SpellDialog::GetSelectedLang_Impl() const
+{
+ INT16 nLang = aLanguageLB.GetSelectLanguage();
+ return nLang;
+}
+/* -----------------28.10.2003 14:27-----------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SpellDialog, LanguageSelectHdl, SvxLanguageBox*, pBox)
+{
+ //if currently an error is selected then search for alternatives for
+ //this word and fill the alternatives ListBox accordingly
+ String sError = aSentenceED.GetErrorText();
+ aSuggestionLB.Clear();
+ if(sError.Len())
+ {
+ LanguageType eLanguage = pBox->GetSelectLanguage();
+ Reference <XSpellAlternatives> xAlt = xSpell->spell( sError, eLanguage,
+ Sequence< PropertyValue >() );
+ if( xAlt.is() )
+ aSentenceED.SetAlternatives( xAlt );
+ else
+ {
+ aSentenceED.ChangeMarkedWord( sError, eLanguage );
+ SpellContinue_Impl();
+ }
+
+ aSentenceED.AddUndoAction(new SpellUndoAction_Impl(SPELLUNDO_CHANGE_LANGUAGE, aDialogUndoLink));
+ }
+ SpellDialog::UpdateBoxes_Impl();
+ return 0;
+}
+// -----------------------------------------------------------------------
+
+void SpellDialog::SetLanguage( sal_uInt16 nLang )
+
+/* [Beschreibung]
+
+ wenn die Sprache im Thesaurus umgestellt wurde,
+ muss auch hier die Sprache umgestellt werden.
+*/
+
+{
+ SetTitle_Impl( nLang );
+
+ // den richtigen Eintrag finden, da sortiert
+ aLanguageLB.SelectLanguage( nLang );
+}
+/*-- 16.06.2008 11:27:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+static Image lcl_GetImageFromPngUrl( const ::rtl::OUString &rFileUrl )
+{
+ Image aRes;
+ ::rtl::OUString aTmp;
+ osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp );
+ Graphic aGraphic;
+ const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) );
+ if( GRFILTER_OK == LoadGraphic( aTmp, aFilterName, aGraphic ) )
+ {
+ aRes = Image( aGraphic.GetBitmapEx() );
+ }
+ return aRes;
+}
+void SpellDialog::SetTitle_Impl(LanguageType nLang)
+{
+ String sTitle( m_sTitleSpelling );
+ if( rParent.HasGrammarChecking() )
+ {
+ String sVendor;
+ const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ if( pSpellErrorDescription && pSpellErrorDescription->sServiceName.getLength() )
+ {
+ bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
+ ::rtl::OUString sSuggestionImageUrl =
+ SvtLinguConfig().GetSpellAndGrammarDialogImage( pSpellErrorDescription->sServiceName, bHighContrast );
+ aVendorImageFI.SetImage( lcl_GetImageFromPngUrl( sSuggestionImageUrl ) );
+ uno::Reference< lang::XServiceDisplayName > xDisplayName( pSpellErrorDescription->xGrammarChecker, uno::UNO_QUERY );
+ if( xDisplayName.is() )
+ sVendor = xDisplayName->getServiceDisplayName( pSpellErrorDescription->aLocale );
+ }
+ else
+ {
+ bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
+ aVendorImageFI.SetImage( bHighContrast ? aVendorImageHC : aVendorImage );
+ }
+
+ if( sVendor.Len() )
+ {
+ sTitle = m_sTitleSpellingGrammarVendor;
+ sTitle.SearchAndReplaceAscii( "$VendorName", sVendor );
+ }
+ else
+ {
+ //bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
+ sTitle = m_sTitleSpellingGrammar;
+ }
+ }
+ sTitle.SearchAndReplaceAscii( "$LANGUAGE ($LOCATION)", ::GetLanguageString(nLang) );
+ SetText( sTitle );
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellDialog::InitUserDicts()
+{
+ sal_uInt16 nLang = aLanguageLB.GetSelectLanguage();
+
+ const Reference< XDictionary > *pDic = 0;
+
+ // get list of dictionaries
+ Reference< XDictionaryList > xDicList( SvxGetDictionaryList() );
+ if (xDicList.is())
+ {
+ // add active, positive dictionary to dic-list (if not already done).
+ // This is to ensure that there is at least on dictionary to which
+ // words could be added.
+ Reference< XDictionary > xDic( SvxGetOrCreatePosDic( xDicList ) );
+ if (xDic.is())
+ xDic->setActive( sal_True );
+
+ pImpl->aDics = xDicList->getDictionaries();
+ }
+
+ // Benutzerbuecher anzeigen
+ const sal_Int32 nSize = pImpl->aDics.getLength();
+ pDic = pImpl->aDics.getConstArray();
+ sal_Int32 i;
+ delete aAddToDictMB.GetPopupMenu();
+ PopupMenu* pMenu = new PopupMenu;
+ for (i = 0; i < nSize; ++i )
+ {
+ Reference< XDictionary > xDic( pDic[i], UNO_QUERY );
+ if (!xDic.is() || SvxGetIgnoreAllList() == xDic)
+ continue;
+
+ // add only active and not read-only dictionaries to list
+ // from which to choose from
+ Reference< frame::XStorable > xStor( xDic, UNO_QUERY );
+ if ( xDic->isActive() && (!xStor.is() || !xStor->isReadonly()) )
+ {
+ sal_Bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
+ pMenu->InsertItem( (USHORT)i + 1, ::GetDicInfoStr( xDic->getName(),
+ SvxLocaleToLanguage( xDic->getLocale() ), bNegativ ) );
+ }
+ }
+ aAddToDictMB.SetPopupMenu(pMenu);
+
+ aAddToDictMB.Disable();
+
+ sal_uInt16 k;
+ for ( k = 0; k < pMenu->GetItemCount(); ++k )
+ {
+ sal_uInt16 nId = pMenu->GetItemId(k) - 1;
+ sal_Bool bFound = sal_False;
+
+ const sal_uInt16 nDicLang = SvxLocaleToLanguage( pDic[nId]->getLocale() );
+ const sal_Bool bDicNegativ =
+ pDic[nId]->getDictionaryType() == DictionaryType_NEGATIVE;
+ // Stimmt die Sprache "uberein, dann enable
+ if ((nDicLang == nLang || nDicLang == LANGUAGE_NONE) && !bDicNegativ)
+ bFound = sal_True;
+
+ if (bFound)
+ {
+ aAddToDictMB.Enable();
+ break;
+ }
+ }
+}
+/*-- 20.10.2003 15:31:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SpellDialog, AddToDictionaryHdl, MenuButton*, pButton )
+{
+ aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
+ USHORT nItem = pButton->GetCurItemId();
+
+ //GetErrorText() returns the current error even if the text is already
+ //manually changed
+ String sNewWord= aSentenceED.GetErrorText();
+
+ Reference< XDictionary > xDic( pImpl->aDics.getConstArray()[ nItem - 1 ], UNO_QUERY );
+ sal_Int16 nAddRes = DIC_ERR_UNKNOWN;
+ if (xDic.is())
+ {
+ String sTmpTxt( sNewWord );
+ sal_Bool bNegEntry = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
+ nAddRes = linguistic::AddEntryToDic( xDic, sTmpTxt, bNegEntry,
+ ::rtl::OUString(), LANGUAGE_NONE );
+
+ if(nAddRes == DIC_ERR_NONE)
+ {
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink);
+ pAction->SetDictionary(xDic);
+ pAction->SetAddedWord(sTmpTxt);
+ aSentenceED.AddUndoAction(pAction);
+ }
+ // failed because there is already an entry?
+ if (DIC_ERR_NONE != nAddRes && xDic->getEntry( sTmpTxt ).is())
+ nAddRes = DIC_ERR_NONE;
+ }
+ if (DIC_ERR_NONE != nAddRes)
+ {
+ SvxDicError( this, nAddRes );
+ return 0; // Nicht weitermachen
+ }
+ // nach dem Aufnehmen ggf. '='-Zeichen entfernen
+ sNewWord.EraseAllChars( sal_Unicode( '=' ) );
+
+ // go on
+ SpellContinue_Impl();
+ aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP );
+ return 0;
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SpellDialog, ModifyHdl, SentenceEditWindow_Impl*, pEd)
+{
+ if (&aSentenceED == pEd)
+ {
+ bModified = true;
+ aSuggestionLB.SetNoSelection();
+ aSuggestionLB.Disable();
+ String sNewText( aSentenceED.GetText() );
+ aAutoCorrPB.Enable( sNewText != aSentenceED.GetText() );
+ SpellUndoAction_Impl* pSpellAction = new SpellUndoAction_Impl(SPELLUNDO_CHANGE_TEXTENGINE, aDialogUndoLink);
+ if(!aChangeAllPB.IsEnabled())
+ {
+ aChangeAllPB.Enable();
+ pSpellAction->SetEnableChangeAllPB();
+ }
+ if(!aChangePB.IsEnabled())
+ {
+ aChangePB.Enable();
+ pSpellAction->SetEnableChangePB();
+ }
+ aSentenceED.AddUndoAction(pSpellAction);
+ }
+ return 0;
+};
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SpellDialog, CancelHdl, Button *, EMPTYARG )
+{
+ //apply changes first - if there are any
+ if(aSentenceED.IsModified())
+ {
+ rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false));
+ }
+ Close();
+ return 0;
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellDialog::Paint( const Rectangle& rRect )
+{
+ ModelessDialog::Paint(rRect );
+ Rectangle aRect(aBackgroundGB.GetPosPixel(), aBackgroundGB.GetSizePixel());
+ DecorationView aDecoView( this );
+ aDecoView.DrawButton( aRect, BUTTON_DRAW_NOFILL);
+}
+/*-- 28.10.2003 13:26:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+long SpellDialog::Notify( NotifyEvent& rNEvt )
+{
+ /* #i38338#
+ * FIXME: LoseFocus and GetFocus are signals from vcl that
+ * a window actually got/lost the focus, it never should be
+ * forwarded from another window, that is simply wrong.
+ * FIXME: overloading the virtual methods GetFocus and LoseFocus
+ * in SpellDialogChildWindow by making them pure is at least questionable.
+ * The only sensible thing would be to call the new Method differently,
+ * e.g. DialogGot/LostFocus or so.
+ */
+ if( IsVisible() && !bFocusLocked )
+ {
+ if( rNEvt.GetType() == EVENT_GETFOCUS )
+ {
+ //notify the child window of the focus change
+ rParent.GetFocus();
+ }
+ else if( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ //notify the child window of the focus change
+ rParent.LoseFocus();
+ }
+ }
+ return SfxModelessDialog::Notify(rNEvt);
+}
+/* -----------------10.09.2003 08:26-----------------
+
+ --------------------------------------------------*/
+void SpellDialog::InvalidateDialog()
+{
+ if( bFocusLocked )
+ return;
+ aIgnorePB.SetText(aResumeST);
+ Window* aDisableArr[] =
+ {
+ &aNotInDictFT,
+ &aSentenceED,
+ &aSuggestionFT,
+ &aSuggestionLB,
+ &aLanguageFT,
+ &aLanguageLB,
+ &aIgnoreAllPB,
+ &aIgnoreRulePB,
+ &aAddToDictMB,
+ &aChangePB,
+ &aChangeAllPB,
+ &aAutoCorrPB,
+ &aUndoPB,
+ 0
+ };
+ sal_Int16 i = 0;
+ while(aDisableArr[i])
+ {
+ aDisableArr[i]->Enable(FALSE);
+ i++;
+ }
+ SfxModelessDialog::Deactivate();
+}
+
+/*-- 10.09.2003 08:35:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence)
+{
+ bool bRet = false;
+ if(!bUseSavedSentence && aSentenceED.IsModified())
+ {
+ rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false));
+ }
+ aSentenceED.ResetModified();
+ SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence();
+ if(!bUseSavedSentence)
+ m_aSavedSentence = aSentence;
+ bool bHasReplaced = false;
+ while(aSentence.size())
+ {
+ //apply all changes that are already part of the "ChangeAllList"
+ //returns true if the list still contains errors after the changes have been applied
+
+ if(!ApplyChangeAllList_Impl(aSentence, bHasReplaced))
+ {
+ rParent.ApplyChangedSentence(aSentence);
+ aSentence = rParent.GetNextWrongSentence();
+ }
+ else
+ break;
+ }
+
+ if(aSentence.size())
+ {
+ SpellPortions::iterator aStart = aSentence.begin();
+ rtl::OUString sText;
+ while(aStart != aSentence.end())
+ {
+ // hidden text has to be ignored
+ if(!aStart->bIsHidden)
+ sText += aStart->sText;
+ aStart++;
+ }
+ aSentenceED.SetText(sText);
+ aStart = aSentence.begin();
+ sal_Int32 nStartPosition = 0;
+ sal_Int32 nEndPosition = 0;
+
+ while(aStart != aSentence.end())
+ {
+ // hidden text has to be ignored
+ if(!aStart->bIsHidden)
+ {
+ nEndPosition += aStart->sText.getLength();
+ if(aStart->xAlternatives.is())
+ {
+ uno::Reference< container::XNamed > xNamed( aStart->xAlternatives, uno::UNO_QUERY );
+ ::rtl::OUString sServiceName;
+ if( xNamed.is() )
+ sServiceName = xNamed->getName();
+ SpellErrorDescription aDesc( false, aStart->xAlternatives->getWord(),
+ aStart->xAlternatives->getLocale(), aStart->xAlternatives->getAlternatives(), 0, sServiceName);
+ aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (USHORT) nStartPosition, (USHORT) nEndPosition );
+ }
+ else if(aStart->bIsGrammarError )
+ {
+ uno::Reference< lang::XServiceInfo > xInfo( aStart->xGrammarChecker, uno::UNO_QUERY );
+ SpellErrorDescription aDesc( true,
+ aStart->sText,
+ SvxCreateLocale( aStart->eLanguage ),
+ aStart->aGrammarError.aSuggestions,
+ aStart->xGrammarChecker,
+ xInfo->getImplementationName(),
+ &aStart->sDialogTitle,
+ &aStart->aGrammarError.aFullComment,
+ &aStart->aGrammarError.aRuleIdentifier );
+ aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (USHORT) nStartPosition, (USHORT) nEndPosition );
+ }
+ if(aStart->bIsField)
+ aSentenceED.SetAttrib( SpellBackgroundAttrib(COL_LIGHTGRAY), 0, (USHORT) nStartPosition, (USHORT) nEndPosition );
+ aSentenceED.SetAttrib( SpellLanguageAttrib(aStart->eLanguage), 0, (USHORT) nStartPosition, (USHORT) nEndPosition );
+ nStartPosition = nEndPosition;
+ }
+ aStart++;
+ }
+ //the edit field needs to be modified to apply the change from the ApplyChangeAllList
+ if(!bHasReplaced)
+ aSentenceED.ClearModifyFlag();
+ aSentenceED.ResetUndo();
+ aUndoPB.Enable(FALSE);
+ bRet = nStartPosition > 0;
+ }
+ return bRet;
+}
+/*-- 12.11.2003 15:21:25---------------------------------------------------
+ replace errrors that have a replacement in the ChangeAllList
+ returns false if the result doesn't contain errors after the replacement
+ -----------------------------------------------------------------------*/
+bool SpellDialog::ApplyChangeAllList_Impl(SpellPortions& rSentence, bool &bHasReplaced)
+{
+ bHasReplaced = false;
+ bool bRet = true;
+ SpellPortions::iterator aStart = rSentence.begin();
+ Reference<XDictionary> xChangeAll( SvxGetChangeAllList(), UNO_QUERY );
+ if(!xChangeAll->getCount())
+ return bRet;
+ bRet = false;
+ while(aStart != rSentence.end())
+ {
+ if(aStart->xAlternatives.is())
+ {
+ Reference<XDictionaryEntry> xEntry = xChangeAll->getEntry( aStart->sText );
+ if(xEntry.is())
+ {
+ aStart->sText = xEntry->getReplacementText();
+ aStart->xAlternatives = 0;
+ bHasReplaced = true;
+ }
+ else
+ bRet = true;
+ }
+ else if( aStart->bIsGrammarError )
+ bRet = true;
+ aStart++;
+ }
+ return bRet;
+}
+/*-- 10.09.2003 10:40:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SentenceEditWindow_Impl::SentenceEditWindow_Impl( SpellDialog* pParent, const ResId& rResId ) :
+ MultiLineEdit( pParent, rResId ),
+ m_nErrorStart(0),
+ m_nErrorEnd(0),
+ m_bIsUndoEditMode(false)
+{
+ DisableSelectionOnFocus();
+}
+/*-- 10.09.2003 10:40:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SentenceEditWindow_Impl::~SentenceEditWindow_Impl()
+{
+}
+/*-- 20.10.2003 13:42:34---------------------------------------------------
+ The selection before inputting a key may have a range or not
+ and it may be inside or outside of field or error attributes.
+ A range may include the attribute partially, completely or together
+ with surrounding text. It may also contain more than one attribute
+ or no attribute at all.
+ Depending on this starting conditions some actions are necessary:
+ Attempts to delete a field are only allowed if the selection is the same
+ as the field's selection. Otherwise the field has to be selected and the key
+ input action has to be skipped.
+ Input of text at the start of the field requires the field attribute to be
+ corrected - it is not allowed to grow.
+
+ In case of errors the appending of text should grow the error attribute because
+ that is what the user usually wants to do.
+
+ Backspace at the start of the attribute requires to find out if a field ends
+ directly in front of the cursor position. In case of a field this attribute has to be
+ selected otherwise the key input method is allowed.
+
+ All changes outside of the error attributes switch the dialog mode to a "Undo edit" state that
+ removes all visible attributes and switches off further attribute checks.
+ Undo in this restarts the dialog with a current sentence newly presented.
+ All changes to the sentence are undone including the ones before the "Undo edit state" has been reached
+
+ We end up with 9 types of selection
+ 1 (LEFT_NO) - no range, start of attribute - can also be 3 at the same time
+ 2 (INSIDE_NO) - no range, inside of attribute
+ 3 (RIGHT_NO) - no range, end of attribute - can also be 1 at the same time
+ 4 (FULL) - range, same as attribute
+ 5 (INSIDE_YES) - range, inside of the attribute
+ 6 (BRACE)- range, from outside of the attribute to the inside or
+ including the complete attribute and something outside,
+ maybe more than one attribute
+ 7 (OUTSIDE_NO) - no range, not at an attribute
+ 8 (OUTSIDE_YES) - range, completely outside of all attributes
+
+ What has to be done depending on the attribute type involved
+ possible actions: UE - Undo edit mode
+ CO - Continue, no additional action is required
+ FS - Field has to be completely selected
+ EX - The attribute has to be expanded to include the added text
+
+ 1 - backspace delete any other
+ UE on field FS on error CO on field FS on error CO
+
+ 2 - on field FS on error C
+ 3 - backspace delete any other
+ on field FS on error CO UE on field UE on error EX
+
+ if 1 and 3 happen to apply both then backspace and other handling is 1 delete is 3
+
+ 4 - on field UE and on error CO
+ 5 - on field FS and on error CO
+ 6 - on field FS and on error UE
+ 7 - UE
+ 8 - UE
+ -----------------------------------------------------------------------*/
+#define INVALID 0
+#define LEFT_NO 1
+#define INSIDE_NO 2
+#define RIGHT_NO 3
+#define FULL 4
+#define INSIDE_YES 5
+#define BRACE 6
+#define OUTSIDE_NO 7
+#define OUTSIDE_YES 8
+
+#define ACTION_UNDOEDIT 0
+#define ACTION_CONTINUE 1
+#define ACTION_SELECTFIELD 2
+#define ACTION_EXPAND 3
+
+long SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt )
+{
+ bool bChange = false;
+ const TextCharAttrib* pErrorAttrib = 0;
+ if(rNEvt.GetType() == EVENT_KEYINPUT)
+ {
+ const KeyEvent& rKeyEvt = *rNEvt.GetKeyEvent();
+ bChange = TextEngine::DoesKeyChangeText( rKeyEvt );
+ if(bChange && !IsUndoEditMode() &&
+ rKeyEvt.GetKeyCode().GetCode() != KEY_TAB)
+ {
+ TextEngine* pTextEngine = GetTextEngine();
+ TextView* pTextView = pTextEngine->GetActiveView();
+ const TextSelection& rCurrentSelection = pTextView->GetSelection();
+ //determine if the selection contains a field
+ bool bHasField = false;
+ bool bHasError = false;
+ bool bHasFieldLeft = false;
+ bool bHasErrorLeft = false;
+// bool bInsideAttr = false;
+
+ bool bHasRange = rCurrentSelection.HasRange();
+ sal_uInt8 nSelectionType = 0; // invalid type!
+
+ TextPaM aCursor(rCurrentSelection.GetStart());
+ const TextCharAttrib* pBackAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND );
+ const TextCharAttrib* pErrorAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR );
+ const TextCharAttrib* pBackAttrLeft = 0;
+ const TextCharAttrib* pErrorAttrLeft = 0;
+
+ bHasField = pBackAttr != 0 && (bHasRange || pBackAttr->GetEnd() > aCursor.GetIndex());
+ bHasError = pErrorAttr != 0 && (bHasRange || pErrorAttr->GetEnd() > aCursor.GetIndex());
+ if(bHasRange)
+ {
+ if(pBackAttr &&
+ pBackAttr->GetStart() == rCurrentSelection.GetStart().GetIndex() &&
+ pBackAttr->GetEnd() == rCurrentSelection.GetEnd().GetIndex())
+ {
+ nSelectionType = FULL;
+ }
+ else if(pErrorAttr &&
+ pErrorAttr->GetStart() <= rCurrentSelection.GetStart().GetIndex() &&
+ pErrorAttr->GetEnd() >= rCurrentSelection.GetEnd().GetIndex())
+ {
+ nSelectionType = INSIDE_YES;
+ }
+ else
+ {
+ nSelectionType = bHasField||bHasError ? BRACE : OUTSIDE_NO;
+ while(aCursor.GetIndex() < rCurrentSelection.GetEnd().GetIndex())
+ {
+ ++aCursor.GetIndex();
+ const TextCharAttrib* pIntBackAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND );
+ const TextCharAttrib* pIntErrorAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR );
+ //if any attr has been found then BRACE
+ if(pIntBackAttr || pIntErrorAttr)
+ nSelectionType = BRACE;
+ //the field has to be selected
+ if(pIntBackAttr && !pBackAttr)
+ pBackAttr = pIntBackAttr;
+ bHasField |= pIntBackAttr != 0;
+ }
+ }
+ }
+ else
+ {
+ //no range selection: then 1 2 3 and 8 are possible
+ const TextCharAttrib* pCurAttr = pBackAttr ? pBackAttr : pErrorAttr;
+ if(pCurAttr)
+ {
+ nSelectionType = pCurAttr->GetStart() == rCurrentSelection.GetStart().GetIndex() ?
+ LEFT_NO : pCurAttr->GetEnd() == rCurrentSelection.GetEnd().GetIndex() ? RIGHT_NO : INSIDE_NO;
+ }
+ else
+ nSelectionType = OUTSIDE_NO;
+
+ bHasFieldLeft = pBackAttr && pBackAttr->GetEnd() == aCursor.GetIndex();
+ if(bHasFieldLeft)
+ {
+ pBackAttrLeft = pBackAttr;
+ pBackAttr = 0;
+ }
+ bHasErrorLeft = pErrorAttr && pErrorAttr->GetEnd() == aCursor.GetIndex();
+ if(bHasErrorLeft)
+ {
+ pErrorAttrLeft = pErrorAttr;
+ pErrorAttr = 0;
+ }
+
+ //check previous position if this exists
+ //that is a redundant in the case the the attribute found above already is on the left cursor side
+ //but it's o.k. for two errors/fields side by side
+ if(aCursor.GetIndex())
+ {
+ --aCursor.GetIndex();
+ pBackAttrLeft = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND );
+ pErrorAttrLeft = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR );
+ bHasFieldLeft = pBackAttrLeft !=0;
+ bHasErrorLeft = pErrorAttrLeft != 0;
+// bInsideAttr = (bHasField || bHasError) && (bHasFieldLeft || bHasErrorLeft);
+ ++aCursor.GetIndex();
+ }
+ }
+ //Here we have to determine if the error found is the one currently active
+ bool bIsErrorActive = (pErrorAttr && pErrorAttr->GetStart() == m_nErrorStart) ||
+ (pErrorAttrLeft && pErrorAttrLeft->GetStart() == m_nErrorStart);
+
+ DBG_ASSERT(nSelectionType != INVALID, "selection type not set!");
+
+ const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
+ bool bDelete = rKeyCode.GetCode() == KEY_DELETE;
+ bool bBackspace = rKeyCode.GetCode() == KEY_BACKSPACE;
+
+ sal_Int8 nAction = ACTION_CONTINUE;
+// nAction = ACTION_UNDOEDIT
+// nAction = ACTION_SELECTFIELD
+// nAction = ACTION_EXPAND
+ switch(nSelectionType)
+ {
+// 1 - backspace delete any other
+// UE on field FS on error CO on field FS on error CO
+ case LEFT_NO :
+ if(bBackspace)
+ {
+ nAction = bHasFieldLeft ? ACTION_SELECTFIELD : ACTION_UNDOEDIT;
+ //to force the use of pBackAttrLeft
+ pBackAttr = 0;
+ }
+ else if(bDelete)
+ nAction = bHasField ? ACTION_SELECTFIELD : ACTION_CONTINUE;
+ else
+ nAction = bHasError && !aCursor.GetIndex() ? ACTION_CONTINUE :
+ bHasError ? ACTION_EXPAND : bHasErrorLeft ? ACTION_CONTINUE : ACTION_UNDOEDIT;
+ break;
+// 2 - on field FS on error C
+ case INSIDE_NO :
+ nAction = bHasField ? ACTION_SELECTFIELD :
+ bIsErrorActive ? ACTION_CONTINUE : ACTION_UNDOEDIT;
+ break;
+// 3 - backspace delete any other
+// on field FS on error CO UE on field UE on error EX
+ case RIGHT_NO :
+ if(bBackspace)
+ nAction = bHasFieldLeft ? ACTION_SELECTFIELD : ACTION_CONTINUE;
+ else if(bDelete)
+ nAction = bHasFieldLeft && bHasError ? ACTION_CONTINUE : ACTION_UNDOEDIT;
+ else
+ nAction = bHasFieldLeft && bHasError ? ACTION_EXPAND :
+ bHasError ? ACTION_CONTINUE : bHasErrorLeft ? ACTION_EXPAND :ACTION_UNDOEDIT;
+ break;
+// 4 - on field UE and on error CO
+ case FULL :
+ nAction = bHasField ? ACTION_UNDOEDIT : ACTION_CONTINUE;
+ break;
+// 5 - on field FS and on error CO
+ case INSIDE_YES :
+ nAction = bHasField ? ACTION_SELECTFIELD : ACTION_CONTINUE;
+ break;
+// 6 - on field FS and on error UE
+ case BRACE :
+ nAction = bHasField ? ACTION_SELECTFIELD : ACTION_UNDOEDIT;;
+ break;
+// 7 - UE
+// 8 - UE
+ case OUTSIDE_NO :
+ case OUTSIDE_YES:
+ nAction = ACTION_UNDOEDIT;
+ break;
+ }
+ //save the current paragraph
+ USHORT nCurrentLen = GetText().Len();
+ if(nAction != ACTION_SELECTFIELD)
+ pTextView->GetWindow()->KeyInput(rKeyEvt);
+ else
+ {
+ const TextCharAttrib* pCharAttr = pBackAttr ? pBackAttr : pBackAttrLeft;
+ if(pCharAttr)
+ {
+ TextPaM aStart(0, pCharAttr->GetStart());
+ TextPaM aEnd(0, pCharAttr->GetEnd());
+ TextSelection aNewSel(aStart, aEnd);
+ pTextView->SetSelection( aNewSel);
+ }
+ }
+ if(nAction == ACTION_EXPAND)
+ {
+ DBG_ASSERT(pErrorAttrLeft || pErrorAttr, "where is the error");
+ //text has been added on the right and only the 'error attribute has to be corrected
+ if(pErrorAttrLeft)
+ {
+ TextAttrib* pNewError = pErrorAttrLeft->GetAttr().Clone();
+ USHORT nStart = pErrorAttrLeft->GetStart();
+ USHORT nEnd = pErrorAttrLeft->GetEnd();
+ pTextEngine->RemoveAttrib( 0, *pErrorAttrLeft );
+ SetAttrib( *pNewError, 0, nStart, ++nEnd );
+ //only active errors move the mark
+ if(bIsErrorActive)
+ {
+ bool bGrammar = static_cast<const SpellErrorAttrib&>(*pNewError).GetErrorDescription().bIsGrammarError;
+ MoveErrorMarkTo(nStart, nEnd, bGrammar);
+ }
+ delete pNewError;
+ }
+ //text has been added on the left then the error attribute has to be expanded and the
+ //field attribute on the right - if any - has to be contracted
+ else if(pErrorAttr)
+ {
+ //determine the change
+ USHORT nAddedChars = GetText().Len() - nCurrentLen;
+
+ TextAttrib* pNewError = pErrorAttr->GetAttr().Clone();
+ USHORT nStart = pErrorAttr->GetStart();
+ USHORT nEnd = pErrorAttr->GetEnd();
+ pTextEngine->RemoveAttrib( 0, *pErrorAttr );
+ nStart = nStart - (USHORT)nAddedChars;
+ SetAttrib( *pNewError, 0, nStart - nAddedChars, nEnd );
+ //only if the error is active the mark is moved here
+ if(bIsErrorActive)
+ {
+ bool bGrammar = static_cast<const SpellErrorAttrib&>(*pNewError).GetErrorDescription().bIsGrammarError;
+ MoveErrorMarkTo(nStart, nEnd, bGrammar);
+ }
+ delete pNewError;
+
+ if(pBackAttrLeft)
+ {
+ TextAttrib* pNewBack = pBackAttrLeft->GetAttr().Clone();
+ USHORT _nStart = pBackAttrLeft->GetStart();
+ USHORT _nEnd = pBackAttrLeft->GetEnd();
+ pTextEngine->RemoveAttrib( 0, *pBackAttrLeft );
+ SetAttrib( *pNewBack, 0, _nStart, _nEnd - nAddedChars);
+ delete pNewBack;
+ }
+ }
+ }
+ else if(nAction == ACTION_UNDOEDIT)
+ {
+ SetUndoEditMode(true);
+ }
+ //make sure the error positions are correct after text changes
+ //the old attribute may have been deleted
+ //all changes inside of the current error leave the error attribute at the current
+ //start position
+ if(!IsUndoEditMode() && bIsErrorActive)
+ {
+ const TextCharAttrib* pFontColor = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_FONTCOLOR );
+ pErrorAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_ERROR );
+ if(pFontColor && pErrorAttrib )
+ {
+ m_nErrorStart = pFontColor->GetStart();
+ m_nErrorEnd = pFontColor->GetEnd();
+ if(pErrorAttrib->GetStart() != m_nErrorStart || pErrorAttrib->GetEnd() != m_nErrorEnd)
+ {
+ TextAttrib* pNewError = pErrorAttrib->GetAttr().Clone();
+ pTextEngine->RemoveAttrib( 0, *pErrorAttr );
+ SetAttrib( *pNewError, 0, m_nErrorStart, m_nErrorEnd );
+ delete pNewError;
+ }
+ }
+ }
+ //this is not a modification anymore
+ if(nAction != ACTION_SELECTFIELD && !m_bIsUndoEditMode)
+ CallModifyLink();
+ }
+ else
+ bChange = false;
+ }
+ long nRet = bChange ? 1 : MultiLineEdit::PreNotify(rNEvt);
+ return nRet;
+}
+/*-- 10.09.2003 13:38:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SentenceEditWindow_Impl::MarkNextError()
+{
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ USHORT nTextLen = pTextEngine->GetTextLen(0);
+ if(m_nErrorEnd >= nTextLen - 1)
+ return false;
+ //if it's not already modified the modified flag has to be reset at the and of the marking
+ bool bModified = IsModified();
+ bool bRet = false;
+ const USHORT nOldErrorStart = m_nErrorStart;
+ const USHORT nOldErrorEnd = m_nErrorEnd;
+
+ //create a cursor behind the end of the last error
+ //- or at 0 at the start of the sentence
+ TextPaM aCursor(0, m_nErrorEnd ? m_nErrorEnd + 1 : 0);
+ //search for SpellErrorAttrib
+
+ const TextCharAttrib* pNextError = 0;
+ //iterate over the text and search for the next error that maybe has
+ //to be replace by a ChangeAllList replacement
+ bool bGrammarError = false;
+ while(aCursor.GetIndex() < nTextLen)
+ {
+ while(aCursor.GetIndex() < nTextLen &&
+ 0 == (pNextError = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR)))
+ {
+ ++aCursor.GetIndex();
+ }
+ // maybe the error found here is already in the ChangeAllList and has to be replaced
+
+ Reference<XDictionary> xChangeAll( SvxGetChangeAllList(), UNO_QUERY );
+ Reference<XDictionaryEntry> xEntry;
+
+// Reference <XSpellAlternatives> xAlternatives;
+ const SpellErrorDescription* pSpellErrorDescription = 0;
+ if(pNextError)
+ {
+ pSpellErrorDescription = &static_cast<const SpellErrorAttrib&>(pNextError->GetAttr()).GetErrorDescription();
+ bGrammarError = pSpellErrorDescription->bIsGrammarError;
+ }
+ if(xChangeAll->getCount() && pSpellErrorDescription &&
+ (xEntry = xChangeAll->getEntry( pSpellErrorDescription->sErrorText )).is())
+ {
+ m_nErrorStart = pNextError->GetStart();
+ m_nErrorEnd = pNextError->GetEnd();
+ ChangeMarkedWord(xEntry->getReplacementText(),
+ SvxLocaleToLanguage( pSpellErrorDescription->aLocale ));
+ aCursor.GetIndex() = aCursor.GetIndex() + (USHORT)(xEntry->getReplacementText().getLength());
+ }
+ else
+ break;
+ }
+
+ //if an attrib has been found search for the end of the error string
+ if(aCursor.GetIndex() < nTextLen)
+ {
+ m_nErrorStart = aCursor.GetIndex();
+ m_nErrorEnd = pNextError->GetEnd();
+ MoveErrorMarkTo(m_nErrorStart, m_nErrorEnd, bGrammarError);
+ bRet = true;
+ //add an undo action
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_CHANGE_NEXTERROR, GetSpellDialog()->aDialogUndoLink);
+ pAction->SetErrorMove(m_nErrorStart, m_nErrorEnd, nOldErrorStart, nOldErrorEnd);
+ const SpellErrorAttrib* pOldAttrib = static_cast<const SpellErrorAttrib*>(
+ pTextEngine->FindAttrib( TextPaM(0, nOldErrorStart), TEXTATTR_SPELL_ERROR ));
+ pAction->SetErrorLanguageSelected(pOldAttrib && pOldAttrib->GetErrorDescription().aSuggestions.getLength() &&
+ SvxLocaleToLanguage( pOldAttrib->GetErrorDescription().aLocale) ==
+ GetSpellDialog()->aLanguageLB.GetSelectLanguage());
+ AddUndoAction(pAction);
+ }
+ else
+ m_nErrorStart = m_nErrorEnd = nTextLen;
+ if( !bModified )
+ ClearModifyFlag();
+ SpellDialog* pSpellDialog = GetSpellDialog();
+ pSpellDialog->aIgnorePB.Enable(bRet);
+ pSpellDialog->aIgnoreAllPB.Enable(bRet);
+ pSpellDialog->aAutoCorrPB.Enable(bRet);
+ pSpellDialog->aAddToDictMB.Enable(bRet);
+ return bRet;
+}
+
+/*-- 06.11.2003 13:30:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::MoveErrorMarkTo(USHORT nStart, USHORT nEnd, bool bGrammarError)
+{
+ TextEngine* pTextEngine = GetTextEngine();
+ pTextEngine->RemoveAttribs( 0, (USHORT)TEXTATTR_FONTCOLOR, TRUE );
+ pTextEngine->RemoveAttribs( 0, (USHORT)TEXTATTR_FONTWEIGHT, TRUE );
+ pTextEngine->SetAttrib( TextAttribFontWeight(WEIGHT_BOLD), 0, nStart, nEnd );
+ pTextEngine->SetAttrib( TextAttribFontColor(bGrammarError ? COL_LIGHTBLUE : COL_LIGHTRED), 0, nStart, nEnd );
+ m_nErrorStart = nStart;
+ m_nErrorEnd = nEnd;
+}
+
+/*-- 17.09.2003 10:13:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::ChangeMarkedWord(const String& rNewWord, LanguageType eLanguage)
+{
+ //calculate length changes
+ long nDiffLen = rNewWord.Len() - m_nErrorEnd + m_nErrorStart;
+ TextSelection aSel(TextPaM(0, m_nErrorStart), TextPaM(0, m_nErrorEnd));
+ //Remove spell errror attribute
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ pTextEngine->UndoActionStart( TEXTUNDO_INSERT );
+ const TextCharAttrib* pErrorAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_ERROR );
+ DBG_ASSERT(pErrorAttrib, "no error attribute found");
+// Reference <XSpellAlternatives> xAlternatives;
+ const SpellErrorDescription* pSpellErrorDescription = 0;
+ if(pErrorAttrib)
+ {
+ pTextEngine->RemoveAttrib(0, *pErrorAttrib);
+ pSpellErrorDescription = &static_cast<const SpellErrorAttrib&>(pErrorAttrib->GetAttr()).GetErrorDescription();
+ }
+ const TextCharAttrib* pBackAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_BACKGROUND );
+ pTextEngine->ReplaceText( aSel, rNewWord );
+ //
+ if(!m_nErrorStart)
+ {
+ //attributes following an error at the start of the text are not moved but expanded from the
+ //text engine - this is done to keep full-paragraph-attributes
+ //in the current case that handling is not desired
+ const TextCharAttrib* pLangAttrib =
+ pTextEngine->FindCharAttrib(
+ TextPaM(0, m_nErrorEnd), TEXTATTR_SPELL_LANGUAGE );
+ USHORT nTextLen = pTextEngine->GetTextLen( 0 );
+ if(pLangAttrib && !pLangAttrib->GetStart() && pLangAttrib->GetEnd() ==
+ nTextLen)
+ {
+ SpellLanguageAttrib aNewLangAttrib( static_cast<const SpellLanguageAttrib&>(pLangAttrib->GetAttr()).GetLanguage());
+ pTextEngine->RemoveAttrib(0, *pLangAttrib);
+ pTextEngine->SetAttrib( aNewLangAttrib, 0, (USHORT)(m_nErrorEnd + nDiffLen) , nTextLen );
+ }
+ }
+ // undo expanded attributes!
+ if( pBackAttrib && pBackAttrib->GetStart() < m_nErrorStart && pBackAttrib->GetEnd() == m_nErrorEnd + nDiffLen)
+ {
+ TextAttrib* pNewBackground = pBackAttrib->GetAttr().Clone();
+ USHORT nStart = pBackAttrib->GetStart();
+ pTextEngine->RemoveAttrib(0, *pBackAttrib);
+ pTextEngine->SetAttrib(*pNewBackground, 0, nStart, m_nErrorStart);
+ delete pNewBackground;
+ }
+ pTextEngine->SetModified(TRUE);
+
+ //adjust end position
+ long nEndTemp = m_nErrorEnd;
+ nEndTemp += nDiffLen;
+ m_nErrorEnd = (USHORT)nEndTemp;
+
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_MOVE_ERROREND, GetSpellDialog()->aDialogUndoLink);
+ pAction->SetOffset(nDiffLen);
+ AddUndoAction(pAction);
+ if(pSpellErrorDescription)
+ SetAttrib( SpellErrorAttrib(*pSpellErrorDescription), 0, m_nErrorStart, m_nErrorEnd );
+ SetAttrib( SpellLanguageAttrib(eLanguage), 0, m_nErrorStart, m_nErrorEnd );
+ pTextEngine->UndoActionEnd( TEXTUNDO_INSERT );
+}
+/* -----------------08.10.2003 13:18-----------------
+
+ --------------------------------------------------*/
+String SentenceEditWindow_Impl::GetErrorText() const
+{
+ return GetTextEngine()->GetText(TextSelection(TextPaM(0, m_nErrorStart), TextPaM(0, m_nErrorEnd) ));
+}
+/*-- 26.06.2008 10:54:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SpellErrorDescription* SentenceEditWindow_Impl::GetAlternatives()
+{
+ TextPaM aCursor(0, m_nErrorStart);
+ const SpellErrorAttrib* pAttrib = static_cast<const SpellErrorAttrib*>(
+ GetTextEngine()->FindAttrib( aCursor, TEXTATTR_SPELL_ERROR));
+ return pAttrib ? &pAttrib->GetErrorDescription() : 0;
+}
+/*-- 06.09.2004 10:50:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::RestoreCurrentError()
+{
+ TextPaM aCursor(0, m_nErrorStart);
+ const SpellErrorAttrib* pAttrib = static_cast<const SpellErrorAttrib*>(
+ GetTextEngine()->FindAttrib( aCursor, TEXTATTR_SPELL_ERROR));
+ if( pAttrib )
+ {
+ const SpellErrorDescription& rDesc = pAttrib->GetErrorDescription();
+ if( !rDesc.sErrorText.equals( GetErrorText() ) )
+ ChangeMarkedWord(rDesc.sErrorText, SvxLocaleToLanguage( rDesc.aLocale ));
+ }
+}
+/*-- 28.10.2003 14:44:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::SetAlternatives( Reference< XSpellAlternatives> xAlt )
+{
+ TextPaM aCursor(0, m_nErrorStart);
+ DBG_ASSERT(static_cast<const SpellErrorAttrib*>(
+ GetTextEngine()->FindAttrib( aCursor, TEXTATTR_SPELL_ERROR)), "no error set?");
+
+ ::rtl::OUString aWord;
+ lang::Locale aLocale;
+ uno::Sequence< ::rtl::OUString > aAlts;
+ ::rtl::OUString sServiceName;
+ if (xAlt.is())
+ {
+ aWord = xAlt->getWord();
+ aLocale = xAlt->getLocale();
+ aAlts = xAlt->getAlternatives();
+ uno::Reference< container::XNamed > xNamed( xAlt, uno::UNO_QUERY );
+ if (xNamed.is())
+ sServiceName = xNamed->getName();
+ }
+ SpellErrorDescription aDesc( false, aWord, aLocale, aAlts, 0, sServiceName);
+ GetTextEngine()->SetAttrib( SpellErrorAttrib(aDesc), 0, m_nErrorStart, m_nErrorEnd );
+}
+
+/*-- 10.09.2003 14:43:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::SetAttrib( const TextAttrib& rAttr, ULONG nPara, USHORT nStart, USHORT nEnd )
+{
+ GetTextEngine()->SetAttrib(rAttr, nPara, nStart, nEnd);
+}
+/*-- 10.09.2003 14:43:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::SetText( const String& rStr )
+{
+ m_nErrorStart = m_nErrorEnd = 0;
+ GetTextEngine()->SetText(rStr);
+// InitScrollBars();
+}
+/*-- 08.10.2003 14:35:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+struct LanguagePosition_Impl
+{
+ USHORT nPosition;
+ LanguageType eLanguage;
+
+ LanguagePosition_Impl(USHORT nPos, LanguageType eLang) :
+ nPosition(nPos),
+ eLanguage(eLang)
+ {}
+};
+typedef std::vector<LanguagePosition_Impl> LanguagePositions_Impl;
+
+void lcl_InsertBreakPosition_Impl(
+ LanguagePositions_Impl& rBreakPositions, USHORT nInsert, LanguageType eLanguage)
+{
+ LanguagePositions_Impl::iterator aStart = rBreakPositions.begin();
+ while(aStart != rBreakPositions.end())
+ {
+ if(aStart->nPosition == nInsert)
+ {
+ //the language of following starts has to overwrite
+ //the one of previous ends
+ aStart->eLanguage = eLanguage;
+ return;
+ }
+ else if(aStart->nPosition > nInsert)
+ {
+
+ rBreakPositions.insert(aStart, LanguagePosition_Impl(nInsert, eLanguage));
+ return;
+ }
+ else
+ ++aStart;
+ }
+ rBreakPositions.push_back(LanguagePosition_Impl(nInsert, eLanguage));
+}
+/*-- 17.09.2003 14:26:59---------------------------------------------------
+ Returns the text in spell portions. Each portion contains text with an
+ equal language and attribute. The spell alternatives are empty.
+ -----------------------------------------------------------------------*/
+svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions( bool bSetIgnoreFlag ) const
+{
+ svx::SpellPortions aRet;
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ const USHORT nTextLen = pTextEngine->GetTextLen(0);
+ if(nTextLen)
+ {
+ TextPaM aCursor(0, 0);
+ LanguagePositions_Impl aBreakPositions;
+ const TextCharAttrib* pLastLang = 0;
+ const TextCharAttrib* pLastError = 0;
+ LanguageType eLang = LANGUAGE_DONTKNOW;
+ const TextCharAttrib* pError = 0;
+ while(aCursor.GetIndex() < nTextLen)
+ {
+ const TextCharAttrib* pLang = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_LANGUAGE);
+ if(pLang && pLang != pLastLang)
+ {
+ eLang = static_cast<const SpellLanguageAttrib&>(pLang->GetAttr()).GetLanguage();
+ lcl_InsertBreakPosition_Impl(aBreakPositions, pLang->GetStart(), eLang);
+ lcl_InsertBreakPosition_Impl(aBreakPositions, pLang->GetEnd(), eLang);
+ pLastLang = pLang;
+ }
+ pError = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR);
+ if(pError && pLastError != pError)
+ {
+ lcl_InsertBreakPosition_Impl(aBreakPositions, pError->GetStart(), eLang);
+ lcl_InsertBreakPosition_Impl(aBreakPositions, pError->GetEnd(), eLang);
+ pLastError = pError;
+
+ }
+ aCursor.GetIndex()++;
+ }
+ //
+ if(nTextLen && aBreakPositions.empty())
+ {
+ //if all content has been overwritten the attributes may have been removed, too
+ svx::SpellPortion aPortion1;
+ aPortion1.eLanguage = GetSpellDialog()->GetSelectedLang_Impl();
+ aPortion1.sText = pTextEngine->GetText(
+ TextSelection(TextPaM(0, 0), TextPaM(0, nTextLen)));
+
+ aRet.push_back(aPortion1);
+
+ }
+ else if(!aBreakPositions.empty())
+ {
+ LanguagePositions_Impl::iterator aStart = aBreakPositions.begin();
+ //start should always be Null
+ eLang = aStart->eLanguage;
+ USHORT nStart = aStart->nPosition;
+ DBG_ASSERT(!nStart, "invalid start position - language attribute missing?");
+ ++aStart;
+
+ while(aStart != aBreakPositions.end())
+ {
+ svx::SpellPortion aPortion1;
+ aPortion1.eLanguage = eLang;
+ aPortion1.sText = pTextEngine->GetText(
+ TextSelection(TextPaM(0, nStart), TextPaM(0, aStart->nPosition)));
+ if( bSetIgnoreFlag && m_nErrorStart == nStart )
+ {
+ aPortion1.bIgnoreThisError = true;
+ }
+ aRet.push_back(aPortion1);
+ nStart = aStart->nPosition;
+ eLang = aStart->eLanguage;
+ ++aStart;
+ }
+ }
+
+ // quick partly fix of #i71318. Correct fix needs to patch the TextEngine itself...
+ // this one will only prevent text from disappearing. It may to not have the
+ // correct language and will probably not spell checked...
+ ULONG nPara = pTextEngine->GetParagraphCount();
+ if (nPara > 1)
+ {
+ String aLeftOverText;
+ for (ULONG i = 1; i < nPara; ++i)
+ {
+ aLeftOverText.AppendAscii( "\x0a" ); // the manual line break...
+ aLeftOverText += pTextEngine->GetText(i);
+ }
+ if (pError)
+ { // we need to add a new portion containing the left-over text
+ svx::SpellPortion aPortion2;
+ aPortion2.eLanguage = eLang;
+ aPortion2.sText = aLeftOverText;
+ aRet.push_back( aPortion2 );
+ }
+ else
+ { // we just need to append the left-over text to the last portion (which had no errors)
+ aRet[ aRet.size() - 1 ].sText += aLeftOverText;
+ }
+ }
+ }
+ return aRet;
+}
+
+/*-- 06.11.2003 11:30:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::Undo()
+{
+ SfxUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager();
+ DBG_ASSERT(GetUndoActionCount(), "no undo actions available" );
+ if(!GetUndoActionCount())
+ return;
+ bool bSaveUndoEdit = IsUndoEditMode();
+ USHORT nId;
+ //if the undo edit mode is active then undo all changes until the UNDO_EDIT_MODE action has been found
+ do
+ {
+ nId = rUndoMgr.GetUndoActionId();
+ rUndoMgr.Undo();
+ }while(bSaveUndoEdit && SPELLUNDO_UNDO_EDIT_MODE != nId && GetUndoActionCount());
+
+ if(bSaveUndoEdit || SPELLUNDO_CHANGE_GROUP == nId)
+ GetSpellDialog()->UpdateBoxes_Impl();
+}
+/*-- 06.11.2003 11:30:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::ResetUndo()
+{
+ GetTextEngine()->ResetUndo();
+}
+/*-- 06.11.2003 12:30:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg )
+{
+ SfxUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager();
+ rUndoMgr.AddUndoAction(pAction, bTryMerg);
+ GetSpellDialog()->aUndoPB.Enable();
+}
+/*-- 06.11.2003 12:38:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+USHORT SentenceEditWindow_Impl::GetUndoActionCount()
+{
+ return GetTextEngine()->GetUndoManager().GetUndoActionCount();
+}
+
+/*-- 12.11.2003 12:12:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::UndoActionStart( USHORT nId )
+{
+ GetTextEngine()->UndoActionStart(nId);
+}
+/*-- 12.11.2003 12:12:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::UndoActionEnd( USHORT nId )
+{
+ GetTextEngine()->UndoActionEnd(nId);
+}
+/*-- 12.11.2003 12:12:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::MoveErrorEnd(long nOffset)
+{
+ if(nOffset > 0)
+ m_nErrorEnd = m_nErrorEnd - (USHORT)nOffset;
+ else
+ m_nErrorEnd = m_nErrorEnd -(USHORT)- nOffset;
+}
+/*-- 13.11.2003 15:15:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet)
+{
+ DBG_ASSERT(!bSet || m_bIsUndoEditMode != bSet, "SetUndoEditMode with equal values?");
+ m_bIsUndoEditMode = bSet;
+ //disable all buttons except the Change
+ SpellDialog* pSpellDialog = GetSpellDialog();
+ Control* aControls[] =
+ {
+ &pSpellDialog->aChangeAllPB,
+ &pSpellDialog->aExplainPB,
+ &pSpellDialog->aIgnoreAllPB,
+ &pSpellDialog->aIgnoreRulePB,
+ &pSpellDialog->aIgnorePB,
+ &pSpellDialog->aSuggestionLB,
+ &pSpellDialog->aSuggestionFT,
+ &pSpellDialog->aLanguageFT,
+ &pSpellDialog->aLanguageLB,
+ &pSpellDialog->aAddToDictMB,
+ &pSpellDialog->aAutoCorrPB,
+ 0
+ };
+ sal_Int32 nIdx = 0;
+ do
+ {
+ aControls[nIdx]->Enable(sal_False);
+ }
+ while(aControls[++nIdx]);
+
+ //remove error marks
+ TextEngine* pTextEngine = GetTextEngine();
+ pTextEngine->RemoveAttribs( 0, (USHORT)TEXTATTR_FONTCOLOR, TRUE );
+ pTextEngine->RemoveAttribs( 0, (USHORT)TEXTATTR_FONTWEIGHT, TRUE );
+
+ //put the appropriate action on the Undo-stack
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_UNDO_EDIT_MODE, GetSpellDialog()->aDialogUndoLink);
+ AddUndoAction(pAction);
+ pSpellDialog->aChangePB.Enable();
+}
+
+/*-- 30.06.2008 14:15:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ExplainButton::~ExplainButton()
+{
+}
+/*-- 30.06.2008 14:15:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void ExplainButton::RequestHelp( const HelpEvent& )
+{
+ Help::ShowBalloon( this, GetPosPixel(), m_sExplanation );
+}
+
+void ExplainButton::Click()
+{
+ RequestHelp( HelpEvent() );
+}
diff --git a/cui/source/dialogs/SpellDialog.hrc b/cui/source/dialogs/SpellDialog.hrc
new file mode 100644
index 000000000000..f571525a25db
--- /dev/null
+++ b/cui/source/dialogs/SpellDialog.hrc
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * 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: SpellDialog.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_SUGGESTION 31
+#define LB_SUGGESTION 32
+#define FT_NOTINDICT 33
+#define ED_NEWWORD 34
+#define FT_LANGUAGE 35
+#define LB_LANGUAGE 36
+#define PB_IGNORE 37
+#define PB_IGNOREALL 38
+#define MB_ADDTODICT 39
+#define PB_CHANGE 40
+#define PB_CHANGEALL 41
+#define PB_AUTOCORR 42
+#define GB_BACKGROUND 43
+#define PB_OPTIONS 44
+#define PB_HELP 45
+#define PB_UNDO 46
+#define PB_CLOSE 47
+#define ST_NOSUGGESTIONS 48
+#define ST_RESUME 50
+#define ST_SPELLING 51
+#define ST_SPELLING_AND_GRAMMAR 52
+#define ST_SPELLING_AND_GRAMMAR_VENDORNAME 53
+#define CB_CHECK_GRAMMAR 54
+#define PB_EXPLAIN 55
+#define IMG_VENDOR 56
+#define IMG_DEFAULT_VENDOR 57
+#define IMG_DEFAULT_VENDOR_HC 58
+#define PB_IGNORERULE 59
diff --git a/cui/source/dialogs/SpellDialog.src b/cui/source/dialogs/SpellDialog.src
new file mode 100644
index 000000000000..f7cccd5febc2
--- /dev/null
+++ b/cui/source/dialogs/SpellDialog.src
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * 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: SpellDialog.src,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "SpellDialog.hrc"
+ // pragma ----------------------------------------------------------------
+
+// RID_SVXDLG_SPELLCHECK -------------------------------------------------
+
+#define STD_MASKCOLOR Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; }
+
+ModelessDialog RID_SVXDLG_SPELLCHECK
+{
+ HelpId = HID_SPELLCHECK ;
+ Size = MAP_APPFONT( 270, 188 );
+ OutputSize = TRUE;
+ Closeable = TRUE ;
+ SVLook = TRUE;
+ Hide = TRUE;
+ Text [ en-US ] = "Spellcheck: " ;
+
+ Moveable = TRUE ;
+
+ FixedImage IMG_VENDOR
+ {
+ Pos = MAP_APPFONT ( 0, 0 ) ;
+ Size = MAP_APPFONT ( 270, 21 ) ;
+ Hide = TRUE;
+ };
+
+ FixedText FT_LANGUAGE
+ {
+ Pos = MAP_APPFONT( 6, 8 );
+ Size = MAP_APPFONT( 100, 8 );
+ Text [ en-US ] = "Text languag~e" ;
+ };
+ ListBox LB_LANGUAGE
+ {
+ Pos = MAP_APPFONT( 110, 6 );
+ Size = MAP_APPFONT( 93, 55 );
+ Border = TRUE;
+ Sort = TRUE;
+ DropDown = TRUE;
+ };
+ FixedText FT_NOTINDICT
+ {
+ Pos = MAP_APPFONT( 6, 26 );
+ Size = MAP_APPFONT( 120, 8 );
+ Text [ en-US ] = "~Not in dictionary" ;
+ };
+
+ MultiLineEdit ED_NEWWORD
+ {
+ Pos = MAP_APPFONT( 6, 37 );
+ Size = MAP_APPFONT( 197, 48 );
+ Border = TRUE;
+ VScroll = TRUE;
+ IgnoreTab = TRUE;
+ };
+
+ FixedText FT_SUGGESTION
+ {
+ Pos = MAP_APPFONT( 6, 88 );
+ Size = MAP_APPFONT( 120, 8 );
+ Text [ en-US ] = "~Suggestions" ;
+ };
+ ListBox LB_SUGGESTION
+ {
+ Pos = MAP_APPFONT( 6, 99 );
+ Size = MAP_APPFONT( 197, 48 );
+ Border = TRUE;
+ };
+
+ CheckBox CB_CHECK_GRAMMAR
+ {
+ Pos = MAP_APPFONT( 6, 153 );
+ Size = MAP_APPFONT( 100, 10 );
+ Text [ en-US ] = "Check ~grammar" ;
+ Hide = TRUE;
+ };
+
+ PushButton PB_IGNORE
+ {
+ Pos = MAP_APPFONT( 209, 37 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "~Ignore Once" ;
+ };
+
+ PushButton PB_IGNOREALL
+ {
+ Pos = MAP_APPFONT( 209, 54 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "I~gnore All" ;
+ };
+ PushButton PB_IGNORERULE
+ {
+ Pos = MAP_APPFONT( 209, 54 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "I~gnore Rule" ;
+ Hide = TRUE;
+ };
+ MenuButton MB_ADDTODICT
+ {
+ Pos = MAP_APPFONT( 209, 71 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "~Add" ;
+ };
+
+ PushButton PB_CHANGE
+ {
+ Pos = MAP_APPFONT( 209, 99 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "~Change" ;
+ DefButton = TRUE ;
+ };
+
+ PushButton PB_CHANGEALL
+ {
+ Pos = MAP_APPFONT( 209, 117 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "Change A~ll" ;
+ };
+ PushButton PB_EXPLAIN
+ {
+ Pos = MAP_APPFONT( 209, 117 );
+ Size = MAP_APPFONT( 55, 14 );
+ Hide = TRUE;
+ Text [ en-US ] = "~Explain..." ;
+ };
+ PushButton PB_AUTOCORR
+ {
+ Pos = MAP_APPFONT( 209, 134 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "AutoCor~rect" ;
+ };
+ GroupBox GB_BACKGROUND
+ {
+ Pos = MAP_APPFONT( 1, 21 );
+ Size = MAP_APPFONT( 268, 146 );
+ Hide=TRUE;
+ };
+
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT( 6, 170 );
+ Size = MAP_APPFONT( 55, 14 );
+ };
+ PushButton PB_OPTIONS
+ {
+ Pos = MAP_APPFONT( 87, 170 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "O~ptions..." ;
+ };
+ PushButton PB_UNDO
+ {
+ Pos = MAP_APPFONT( 148, 170 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "~Undo" ;
+ };
+
+ PushButton PB_CLOSE
+ {
+ Pos = MAP_APPFONT ( 209 , 170 ) ;
+ Size = MAP_APPFONT ( 55 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Cl~ose" ;
+ };
+ String ST_RESUME
+ {
+ Text[ en-US ] = "Resu~me";
+ };
+ String ST_NOSUGGESTIONS
+ {
+ Text [en-US] = "(no suggestions)";
+ };
+ String ST_SPELLING
+ {
+ Text[ en-US ] = "Spelling: $LANGUAGE ($LOCATION)";
+ };
+ String ST_SPELLING_AND_GRAMMAR
+ {
+ Text[ en-US ] = "Spelling and Grammar: $LANGUAGE ($LOCATION)";
+ };
+ String ST_SPELLING_AND_GRAMMAR_VENDORNAME
+ {
+ Text[ en-US ] = "Spelling and Grammar: $LANGUAGE ($LOCATION) [$VendorName]";
+ };
+ Image IMG_DEFAULT_VENDOR
+ {
+ ImageBitmap = Bitmap { File = "vendor01.png"; };
+ };
+ Image IMG_DEFAULT_VENDOR_HC
+ {
+ ImageBitmap = Bitmap { File = "vendor01h.png"; };
+ };
+
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/charmap.hrc b/cui/source/dialogs/charmap.hrc
new file mode 100644
index 000000000000..49dae5c98f06
--- /dev/null
+++ b/cui/source/dialogs/charmap.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: charmap.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_CHARMAP_HRC
+#define _SVX_CHARMAP_HRC
+
+// defines ------------------------------------------------------------------
+
+#define CT_SHOWSET 10
+#define FT_FONT 11
+#define LB_FONT 12
+#define CT_SHOWTEXT 13
+#define FT_SYMBOLE 14
+#define CT_SHOWCHAR 15
+#define FT_CHARCODE 16
+#define BTN_CHAR_OK 17
+#define BTN_CHAR_CANCEL 18
+#define BTN_CHAR_HELP 19
+#define BTN_DELETE 20
+#define FT_SUBSET 30
+#define LB_SUBSET 31
+#define ED_SHORTCUT 32
+#define BT_ASSIGN 33
+#define FT_ASSIGN 34
+#define CT_ASSIGN 35
+
+#endif
+
diff --git a/cui/source/dialogs/charmap.src b/cui/source/dialogs/charmap.src
new file mode 100644
index 000000000000..8b93fe850887
--- /dev/null
+++ b/cui/source/dialogs/charmap.src
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * 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: charmap.src,v $
+ * $Revision: 1.57 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include "charmap.hrc"
+#include "helpid.hrc"
+
+ // RID_SVXDLG_CHARMAP ----------------------------------------------------
+ModalDialog RID_SVXDLG_CHARMAP
+{
+ HelpId = SID_CHARMAP ;
+ SvLook = TRUE ;
+ Text [ en-US ] = "Special Characters";
+/* Size = MAP_APPFONT ( 297 , 169 ) ; */
+ Size = MAP_APPFONT ( 297 , 153 ) ;
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ Control CT_SHOWSET
+ {
+ HelpId = HID_CHARMAP_CTL_SHOWSET ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 24 ) ;
+ Size = MAP_APPFONT ( 230 , 112 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ FixedText FT_FONT
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 33 , 8 ) ;
+ Text [ en-US ] = "~Font" ;
+ Left = TRUE ;
+ Group = TRUE ;
+ };
+ ListBox LB_FONT
+ {
+ Pos = MAP_APPFONT ( 42 , 6 ) ;
+ Size = MAP_APPFONT ( 70 , 58 ) ;
+ Sort = TRUE ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_SUBSET
+ {
+ Pos = MAP_APPFONT ( 118 , 8 ) ;
+ Size = MAP_APPFONT ( 42 , 8 ) ;
+ Text [ en-US ] = "~Subset";
+ };
+ ListBox LB_SUBSET
+ {
+ Pos = MAP_APPFONT ( 161 , 6 ) ;
+ Size = MAP_APPFONT ( 63 , 68 ) ;
+ Sort = FALSE ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_SYMBOLE
+ {
+ Pos = MAP_APPFONT ( 6 , 140 ) ;
+ Size = MAP_APPFONT ( 38 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Characters:";
+ };
+ Control CT_SHOWTEXT
+ {
+ HelpId = HID_CHARMAP_CTL_SHOWTEXT ;
+ Pos = MAP_APPFONT ( 46 , 137 ) ;
+/* Size = MAP_APPFONT ( 190 , 16 ) ; */
+ Size = MAP_APPFONT ( 244 , 16 ) ;
+ Group = TRUE ;
+ };
+ Control CT_SHOWCHAR
+ {
+ HelpId = HID_CHARMAP_CTL_SHOWCHAR ;
+ Pos = MAP_APPFONT ( 241 , 79 ) ;
+ Size = MAP_APPFONT ( 50 , 44 ) ;
+ Group = TRUE ;
+ };
+ FixedText FT_CHARCODE
+ {
+ Pos = MAP_APPFONT ( 241 , 126 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Center = TRUE ;
+ };
+ OKButton BTN_CHAR_OK
+ {
+ Pos = MAP_APPFONT ( 242 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CHAR_CANCEL
+ {
+ Pos = MAP_APPFONT ( 242 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_CHAR_HELP
+ {
+ Pos = MAP_APPFONT ( 242 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_DELETE
+ {
+ Pos = MAP_APPFONT ( 242 , 63 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete";
+ };
+/*
+ PushButton BT_ASSIGN
+ {
+ Pos = MAP_APPFONT ( 242 , 140 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Assign shortcut...";
+ };
+ FixedText FT_ASSIGN
+ {
+ Pos = MAP_APPFONT ( 6 , 156 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Shortcut key: ";
+ };
+ Control CT_ASSIGN
+ {
+ Pos = MAP_APPFONT ( 60 , 156 ) ;
+ Size = MAP_APPFONT ( 160 , 8 ) ;
+ };
+*/
+};
+
+// ********************************************************************** EOF
diff --git a/cui/source/dialogs/commonlingui.cxx b/cui/source/dialogs/commonlingui.cxx
new file mode 100644
index 000000000000..70ceacd47c47
--- /dev/null
+++ b/cui/source/dialogs/commonlingui.cxx
@@ -0,0 +1,292 @@
+/*************************************************************************
+ *
+ * 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: commonlingui.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include "commonlingui.hxx"
+
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <vcl/decoview.hxx>
+
+#include "hangulhanjadlg.hrc"
+
+//=============================================================================
+// SvxClickInfoCtr
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+SvxClickInfoCtr::SvxClickInfoCtr( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId ),
+ aFixedInfo( this)
+{
+ aFixedInfo.SetSizePixel(GetOutputSizePixel());
+ aFixedInfo.Show();
+}
+
+//-----------------------------------------------------------------------------
+void SvxClickInfoCtr::MouseButtonDown( const MouseEvent& )
+{
+ aActivateLink.Call(this);
+}
+
+//-----------------------------------------------------------------------------
+long SvxClickInfoCtr::PreNotify( NotifyEvent& rNEvt )
+{
+ if(rNEvt.GetType()==EVENT_GETFOCUS || rNEvt.GetType()==EVENT_MOUSEBUTTONDOWN)
+ {
+ aActivateLink.Call(this);
+ }
+
+ return Control::PreNotify(rNEvt);
+}
+
+//-----------------------------------------------------------------------------
+void SvxClickInfoCtr::SetText( const XubString& rStr )
+{
+ aFixedInfo.SetText(rStr );
+}
+
+//-----------------------------------------------------------------------------
+XubString SvxClickInfoCtr::GetText() const
+{
+ return aFixedInfo.GetText();
+}
+
+//-----------------------------------------------------------------------------
+__EXPORT SvxClickInfoCtr::~SvxClickInfoCtr()
+{
+}
+
+//=============================================================================
+// SvxCommonLinguisticControl
+//=============================================================================
+//-----------------------------------------------------------------------------
+SvxCommonLinguisticControl::SvxCommonLinguisticControl( ModalDialog* _pParent )
+ :Window( _pParent, SVX_RES( RID_SVX_WND_COMMON_LINGU ) )
+ ,aWordText ( this, SVX_RES( FT_WORD ) )
+ ,aAktWord ( this, SVX_RES( FT_AKTWORD ) )
+ ,aNewWord ( this, SVX_RES( FT_NEWWORD ) )
+ ,aNewWordED ( this, SVX_RES( ED_NEWWORD ) )
+ ,aSuggestionFT ( this, SVX_RES( FT_SUGGESTION ) )
+ ,aIgnoreBtn ( this, SVX_RES( BTN_IGNORE ) )
+ ,aIgnoreAllBtn ( this, SVX_RES( BTN_IGNOREALL ) )
+ ,aChangeBtn ( this, SVX_RES( BTN_CHANGE ) )
+ ,aChangeAllBtn ( this, SVX_RES( BTN_CHANGEALL ) )
+ ,aOptionsBtn ( this, SVX_RES( BTN_OPTIONS ) )
+ ,aStatusText ( this, SVX_RES( FT_STATUS ) )
+ ,aHelpBtn ( this, SVX_RES( BTN_SPL_HELP ) )
+ ,aCancelBtn ( this, SVX_RES( BTN_SPL_CANCEL ) )
+ ,aAuditBox ( this, SVX_RES( GB_AUDIT ) )
+{
+ FreeResource();
+
+#ifdef FS_PRIV_DEBUG
+ SetType( WINDOW_TABPAGE );
+#endif
+
+ SetPosSizePixel( Point( 0, 0 ), _pParent->GetOutputSizePixel() );
+ Show();
+}
+
+// -----------------------------------------------------------------------
+PushButton* SvxCommonLinguisticControl::implGetButton( ButtonType _eType ) const
+{
+ const PushButton* pButton = NULL;
+ switch ( _eType )
+ {
+ case eClose: pButton = &aCancelBtn; break;
+ case eIgnore: pButton = &aIgnoreBtn; break;
+ case eIgnoreAll: pButton = &aIgnoreAllBtn; break;
+ case eChange: pButton = &aChangeBtn; break;
+ case eChangeAll: pButton = &aChangeAllBtn; break;
+ case eOptions: pButton = &aOptionsBtn; break;
+ }
+ return const_cast< PushButton* >( pButton );
+}
+
+// -----------------------------------------------------------------------
+void SvxCommonLinguisticControl::SetButtonHandler( ButtonType _eType, const Link& _rHandler )
+{
+ Button* pButton = GetButton( _eType );
+ if ( pButton )
+ pButton->SetClickHdl( _rHandler );
+}
+
+// -----------------------------------------------------------------------
+void SvxCommonLinguisticControl::EnableButton( ButtonType _eType, sal_Bool _bEnable )
+{
+ Button* pButton = GetButton( _eType );
+ if ( pButton )
+ pButton->Enable( _bEnable );
+}
+
+// -----------------------------------------------------------------------
+void SvxCommonLinguisticControl::InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter )
+{
+ Window* pInsertAfter = NULL; // will be the last window of our own "undividable" group, after which we insert the foreign group
+ switch ( _eInsertAfter )
+ {
+ case eLeftRightWords : pInsertAfter = &aNewWordED; break;
+ case eSuggestionLabel : pInsertAfter = &aSuggestionFT; break;
+ case eActionButtons : pInsertAfter = &aChangeAllBtn; break;
+ case eDialogButtons : pInsertAfter = &aCancelBtn; break;
+ }
+
+ // now loop through the remaining windows of the foreign group
+ Window* pInsertBehind = pInsertAfter;
+ Window* pInsert = &_rFirstGroupWindow;
+
+ // some strange thing below: asking a window for WINDOW_NEXT or WINDOW_PREV does not take into
+ // account the border window, _but_ SetZOrder _does_!. Thus, when advancing through a chain
+ // of windows, we need to work with the border windows (WINDOW_BORDER), instead of simply
+ // asking for WINDOW_NEXT.
+
+ Window* pLoopEnd = _rLastGroupWindow.GetWindow( WINDOW_BORDER );
+ while ( pInsert && ( pInsertBehind != pLoopEnd ) )
+ {
+ // we'll destroy the NEXT relation immediately, so remember the next window
+ DBG_ASSERT( pInsert->GetWindow( WINDOW_BORDER ), "SvxCommonLinguisticControl::InsertControlGroup: border window is expected to be non NULL!" );
+ Window* pNextInsert = pInsert->GetWindow( WINDOW_BORDER )->GetWindow( WINDOW_NEXT );
+ // knit
+ pInsert->SetZOrder( pInsertBehind, WINDOW_ZORDER_BEHIND );
+ // advance
+ pInsertBehind = pInsert;
+ pInsert = pNextInsert;
+ }
+ DBG_ASSERT( pInsertBehind == pLoopEnd, "SvxCommonLinguisticControl::InsertControlGroup: controls do not form a group!" );
+ // if we did not reach pLoopEnd, then we did not reach _rLastGroupWindow in the loop, then
+ // (FirstWindow, LastWindow) was no valid control group
+}
+
+// -----------------------------------------------------------------------
+String SvxCommonLinguisticControl::GetNewEditWord()
+{
+ return aNewWordED.GetText();
+}
+
+// -----------------------------------------------------------------------
+void SvxCommonLinguisticControl::SetNewEditWord( const String& _rNew )
+{
+ aNewWordED.SetText( _rNew );
+}
+
+//-----------------------------------------------------------------------------
+void SvxCommonLinguisticControl::UpdateIgnoreHelp( )
+{
+
+ String aInfoStr( RTL_CONSTASCII_USTRINGPARAM( ": " ) );
+ aInfoStr.Append( GetCurrentText() );
+
+ String aString = GetNonMnemonicString( aIgnoreAllBtn.GetText() );
+ aString.Append( aInfoStr );
+ aIgnoreAllBtn.SetQuickHelpText( aString );
+
+ aString = GetNonMnemonicString( aIgnoreBtn.GetText() );
+ aString.Append( aInfoStr );
+ aIgnoreBtn.SetQuickHelpText( aString );
+}
+
+//-----------------------------------------------------------------------------
+void SvxCommonLinguisticControl::UpdateChangesHelp( const String& _rNewText )
+{
+ String aInfoStr( RTL_CONSTASCII_USTRINGPARAM( ": " ) );
+ aInfoStr.Append( GetCurrentText() );
+ aInfoStr.Append( String( RTL_CONSTASCII_USTRINGPARAM( " -> " ) ) );
+ aInfoStr.Append( _rNewText );
+ // TODO: shouldn't this be part of the resources, for proper localization?
+
+ String aString = GetNonMnemonicString( aChangeAllBtn.GetText() );
+ aString.Append( aInfoStr );
+ aChangeAllBtn.SetQuickHelpText( aString );
+
+ aString = GetNonMnemonicString( aChangeBtn.GetText() );
+ aString.Append( aInfoStr );
+ aChangeBtn.SetQuickHelpText( aString );
+}
+
+//-----------------------------------------------------------------------------
+void SvxCommonLinguisticControl::Paint( const Rectangle& rRect )
+{
+ Window::Paint(rRect );
+
+ DecorationView aDecoView( this );
+
+ Rectangle aRect( aAuditBox.GetPosPixel(), aAuditBox.GetSizePixel() );
+ aDecoView.DrawButton( aRect, BUTTON_DRAW_NOFILL );
+}
+
+//-----------------------------------------------------------------------------
+void SvxCommonLinguisticControl::Enlarge( sal_Int32 _nX, sal_Int32 _nY )
+{
+ Size aSize;
+ Point aPos;
+
+ // the controls which need to be resized
+ {
+ Window* pResize[] =
+ {
+ this, &aAuditBox, &aStatusText
+ };
+ for ( sal_uInt32 i = 0; i < sizeof( pResize ) / sizeof( pResize[0] ); ++i )
+ {
+ aSize = pResize[i]->GetSizePixel( );
+ pResize[i]->SetSizePixel( Size( aSize.Width() + _nX, aSize.Height() + _nY ) );
+ }
+ }
+
+ // the controls which stick to the bottom of the window
+ {
+ Window* pMoveDown[] =
+ {
+ &aStatusText, &aHelpBtn, &aCancelBtn
+ };
+ for ( sal_uInt32 i = 0; i < sizeof( pMoveDown ) / sizeof( pMoveDown[0] ); ++i )
+ {
+ aPos = pMoveDown[i]->GetPosPixel();
+ aPos.Y() += _nY;
+ pMoveDown[i]->SetPosPixel( aPos );
+ }
+ }
+
+ // the controls which stick to the right
+ {
+ Window* pMoveRight[] =
+ {
+ &aIgnoreBtn, &aIgnoreAllBtn, &aChangeBtn, &aChangeAllBtn, &aOptionsBtn, &aHelpBtn, &aCancelBtn
+ };
+ for ( sal_uInt32 i = 0; i < sizeof( pMoveRight ) / sizeof( pMoveRight[0] ); ++i )
+ {
+ aPos = pMoveRight[i]->GetPosPixel();
+ aPos.X() += _nX;
+ pMoveRight[i]->SetPosPixel( aPos );
+ }
+ }
+}
diff --git a/cui/source/dialogs/commonlingui.hxx b/cui/source/dialogs/commonlingui.hxx
new file mode 100644
index 000000000000..d1781e83348f
--- /dev/null
+++ b/cui/source/dialogs/commonlingui.hxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * 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: commonlingui.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_COMMON_LINGUI_HXX
+#define SVX_COMMON_LINGUI_HXX
+
+#include <vcl/ctrl.hxx>
+#include <svtools/stdctrl.hxx>
+#include <vcl/edit.hxx>
+#include <svx/svxbox.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/group.hxx>
+#include <vcl/dialog.hxx>
+
+//=============================================================================
+// SvxClickInfoCtr
+//=============================================================================
+
+class SvxClickInfoCtr: public Control
+{
+private:
+ FixedInfo aFixedInfo;
+ Link aActivateLink;
+
+public:
+ SvxClickInfoCtr( Window* pParent, const ResId& rResId );
+ ~SvxClickInfoCtr();
+
+ virtual void SetText( const XubString& rStr );
+ virtual XubString GetText() const;
+
+ void SetActivateHdl( const Link& rLink ) { aActivateLink = rLink; }
+ const Link& GetActivateHdl() const { return aActivateLink; }
+
+protected:
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+};
+
+//=============================================================================
+// SvxCommonLinguisticControl
+//=============================================================================
+class SvxCommonLinguisticControl : public Window
+{
+public:
+ enum ButtonType
+ {
+ eClose,
+ eIgnore,
+ eIgnoreAll,
+ eChange,
+ eChangeAll,
+ eOptions
+ };
+
+protected:
+ FixedText aWordText;
+ SvxClickInfoCtr aAktWord;
+
+ FixedText aNewWord;
+ Edit aNewWordED;
+
+ FixedText aSuggestionFT;
+
+ PushButton aIgnoreBtn;
+ PushButton aIgnoreAllBtn;
+ PushButton aChangeBtn;
+ PushButton aChangeAllBtn;
+ PushButton aOptionsBtn;
+
+ FixedInfo aStatusText;
+ HelpButton aHelpBtn;
+ CancelButton aCancelBtn;
+
+ GroupBox aAuditBox;
+
+protected:
+ virtual void Paint( const Rectangle& rRect );
+
+private:
+ PushButton* implGetButton( ButtonType _eType ) const;
+
+public:
+ SvxCommonLinguisticControl( ModalDialog* _pParent );
+
+ // handlers
+ inline void SetResetWordHdl( const Link& _rLink ) { aAktWord.SetActivateHdl( _rLink ); }
+ inline const Link& GetResetWordHdl() const { return aAktWord.GetActivateHdl(); }
+
+ void SetButtonHandler( ButtonType _eType, const Link& _rHandler );
+ void EnableButton( ButtonType _eType, sal_Bool _bEnable );
+
+ inline PushButton* GetButton( ButtonType _eType ) { return implGetButton( _eType ); }
+ inline const PushButton* GetButton( ButtonType _eType ) const { return implGetButton( _eType ); }
+
+ // users of this class may want to insert own controls in some places, where the ordinary
+ // Z-Order determined by construction time is not sufficient
+ // Use the following methods for this
+ enum ControlGroup // control groups in this window which cannot be devided (e.g. are adjacent in the Z order)
+ {
+ eLeftRightWords, // the controls for the two words (original and suggestion), including the labels
+ eSuggestionLabel, // the label for the suggestion
+ eActionButtons, // the group of "ignore(all)" / "change(all)" buttons
+ eDialogButtons // the group of dialog control buttons (help and close)
+ };
+ void InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter );
+
+ /** enlarges the window
+
+ Some controls "stick" to the borders: The group of change/ignore buttons, for instance, sticks
+ to the right, the dictionary list as well as the close/help buttons stick to the bottom of the
+ window.
+ */
+ void Enlarge( sal_Int32 _nX, sal_Int32 _nY );
+
+ // control access methods
+ inline void SetCurrentText( const String& _rText ) { aAktWord.SetText( _rText ); }
+ inline String GetCurrentText( ) const { return aAktWord.GetText(); }
+
+ inline void SetStatusText( const String& _rText ) { aStatusText.SetText( _rText ); }
+ inline String GetStatusText( ) const { return aStatusText.GetText(); }
+
+ inline Edit& GetWordInputControl() { return aNewWordED; }
+ inline const Edit& GetWordInputControl() const { return aNewWordED; }
+
+ // returns the location (upper-left corner) of the group of action buttons
+ inline Point GetActionButtonsLocation( ) const { return aIgnoreBtn.GetPosPixel(); }
+
+ // updates the help texts for the "change" and "change all" buttons according to the currently
+ // entered texts
+ void UpdateChangesHelp( const String& _rNewText );
+ inline void UpdateChangesHelp( ) { UpdateChangesHelp( GetWordInputControl().GetText() ); }
+
+ // updates the help texts for the "ignore" and "always ignore" buttons according to the currently
+ // entered texts
+ void UpdateIgnoreHelp( );
+
+ String GetNewEditWord();
+ void SetNewEditWord( const String& _rNew );
+};
+
+
+
+#endif // SVX_COMMON_LINGUI_HXX
diff --git a/cui/source/dialogs/commonlingui.src b/cui/source/dialogs/commonlingui.src
new file mode 100644
index 000000000000..c229953ad3c8
--- /dev/null
+++ b/cui/source/dialogs/commonlingui.src
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * 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: commonlingui.src,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "hangulhanjadlg.hrc"
+
+Window RID_SVX_WND_COMMON_LINGU
+{
+ DialogControl = TRUE; // we want to tab out of this
+ Hide = TRUE;
+
+ FixedText FT_WORD
+ {
+ Pos = MAP_APPFONT( 6, 9 );
+ Size = MAP_APPFONT( 42, 10 );
+ Text [ en-US ] = "Origi~nal";
+ };
+ Control FT_AKTWORD
+ {
+ HelpId=HID_SPELLDLG_SETWORD;
+ Pos = MAP_APPFONT( 51, 9 );
+ Size = MAP_APPFONT( 164, 10 );
+ Border =FALSE;
+ TabStop = TRUE;
+ };
+
+ FixedText FT_NEWWORD
+ {
+ Pos = MAP_APPFONT( 6, 25 );
+ Size = MAP_APPFONT( 42, 10 );
+ Text [ en-US ] = "~Word" ;
+ };
+
+ Edit ED_NEWWORD
+ {
+ Pos = MAP_APPFONT( 51, 24 );
+ Size = MAP_APPFONT( 137, 12 );
+ Border = TRUE;
+ };
+
+ FixedText FT_SUGGESTION
+ {
+ Pos = MAP_APPFONT( 6, 48 );
+ Size = MAP_APPFONT( 42, 10 );
+ Text [ en-US ] = "~Suggestions" ;
+ };
+
+ PushButton BTN_IGNORE
+ {
+ Pos = MAP_APPFONT( 224, 6 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "~Ignore" ;
+ };
+
+ PushButton BTN_IGNOREALL
+ {
+ Pos = MAP_APPFONT( 224, 22 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "Always I~gnore" ;
+ };
+
+ PushButton BTN_CHANGE
+ {
+ Pos = MAP_APPFONT( 224, 40 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "~Replace" ;
+ DefButton = TRUE ;
+ };
+
+ PushButton BTN_CHANGEALL
+ {
+ Pos = MAP_APPFONT( 224, 56 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "Always R~eplace" ;
+ };
+
+ PushButton BTN_OPTIONS
+ {
+ Pos = MAP_APPFONT( 224, 129 );
+ Size = MAP_APPFONT( 55, 14 );
+ Hide = TRUE ;
+ Text [ en-US ] = "Options..." ;
+ };
+
+ FixedText FT_STATUS
+ {
+ Pos = MAP_APPFONT( 6, 155 );
+ Size = MAP_APPFONT( 130, 10 );
+ };
+
+ GroupBox GB_AUDIT
+ {
+ Pos = MAP_APPFONT( 1, 1 );
+ Size = MAP_APPFONT( 283, 148 );
+ Hide=TRUE;
+ };
+
+ HelpButton BTN_SPL_HELP
+ {
+ Pos = MAP_APPFONT( 160, 153 );
+ Size = MAP_APPFONT( 55, 14 );
+ };
+
+ CancelButton BTN_SPL_CANCEL
+ {
+ Pos = MAP_APPFONT ( 224 , 153 ) ;
+ Size = MAP_APPFONT ( 55 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Close" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
new file mode 100644
index 000000000000..4a5344de54b3
--- /dev/null
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -0,0 +1,589 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <stdio.h>
+
+#define _CUI_CHARMAP_CXX_
+#include <tools/shl.hxx>
+#include <tools/debug.hxx>
+#include <vcl/sound.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/itempool.hxx>
+
+#include <rtl/textenc.h>
+#include <svx/ucsubset.hxx>
+
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include "cuicharmap.hxx"
+#include <sfx2/request.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/app.hxx>
+#include <svx/fontitem.hxx>
+#include "charmap.hrc"
+#include "macroass.hxx"
+
+// class SvxCharacterMap =================================================
+
+SvxCharacterMap::SvxCharacterMap( Window* pParent, BOOL bOne, const SfxItemSet* pSet ) :
+ SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_CHARMAP ) ),
+ mpCharMapData( 0 )
+{
+ SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, FN_PARAM_1, FALSE );
+ if ( pItem )
+ bOne = pItem->GetValue();
+
+ SFX_ITEMSET_ARG( pSet, pCharItem, SfxInt32Item, SID_ATTR_CHAR, FALSE );
+ if ( pCharItem )
+ SetChar( pItem->GetValue() );
+
+ mpCharMapData = new SvxCharMapData( this, bOne, &DIALOG_MGR() );
+
+ SFX_ITEMSET_ARG( pSet, pDisableItem, SfxBoolItem, FN_PARAM_2, FALSE );
+ if ( pDisableItem && pDisableItem->GetValue() )
+ DisableFontSelection();
+
+ SFX_ITEMSET_ARG( pSet, pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE );
+ SFX_ITEMSET_ARG( pSet, pFontNameItem, SfxStringItem, SID_FONT_NAME, FALSE );
+ if ( pFontItem )
+ {
+ Font aFont( pFontItem->GetFamilyName(), pFontItem->GetStyleName(), GetCharFont().GetSize() );
+ aFont.SetCharSet( pFontItem->GetCharSet() );
+ aFont.SetPitch( pFontItem->GetPitch() );
+ SetCharFont( aFont );
+ }
+ else if ( pFontNameItem )
+ {
+ Font aFont( GetCharFont() );
+ aFont.SetName( pFontNameItem->GetValue() );
+ SetCharFont( aFont );
+ }
+
+ FreeResource();
+ CreateOutputItemSet( pSet ? *pSet->GetPool() : SFX_APP()->GetPool() );
+}
+
+// -----------------------------------------------------------------------
+
+SvxCharacterMap::~SvxCharacterMap()
+{
+ delete mpCharMapData;
+}
+
+// -----------------------------------------------------------------------
+
+const Font& SvxCharacterMap::GetCharFont() const
+{
+ return mpCharMapData->aFont;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharacterMap::SetChar( sal_UCS4 c )
+{
+ mpCharMapData->aShowSet.SelectCharacter( c );
+}
+
+// -----------------------------------------------------------------------
+
+sal_UCS4 SvxCharacterMap::GetChar() const
+{
+ return mpCharMapData->aShowSet.GetSelectCharacter();
+}
+
+// -----------------------------------------------------------------------
+
+String SvxCharacterMap::GetCharacters() const
+{
+ return mpCharMapData->aShowText.GetText();
+}
+
+
+// -----------------------------------------------------------------------
+
+void SvxCharacterMap::DisableFontSelection()
+{
+ mpCharMapData->aFontText.Disable();
+ mpCharMapData->aFontLB.Disable();
+}
+
+void SvxCharacterMap::SetCharFont( const Font& rFont )
+{
+ mpCharMapData->SetCharFont( rFont );
+}
+
+short SvxCharacterMap::Execute()
+{
+ short nResult = SfxModalDialog::Execute();
+ if ( nResult == RET_OK )
+ {
+ SfxItemSet* pSet = GetItemSet();
+ if ( pSet )
+ {
+ const SfxItemPool* pPool = pSet->GetPool();
+ const Font& rFont( GetCharFont() );
+ pSet->Put( SfxStringItem( pPool->GetWhich(SID_CHARMAP), GetCharacters() ) );
+ pSet->Put( SvxFontItem( rFont.GetFamily(), rFont.GetName(),
+ rFont.GetStyleName(), rFont.GetPitch(), rFont.GetCharSet(), pPool->GetWhich(SID_ATTR_CHAR_FONT) ) );
+ pSet->Put( SfxStringItem( pPool->GetWhich(SID_FONT_NAME), rFont.GetName() ) );
+ pSet->Put( SfxInt32Item( pPool->GetWhich(SID_ATTR_CHAR), GetChar() ) );
+ }
+ }
+
+ return nResult;
+}
+
+
+// class SvxShowText =====================================================
+
+SvxShowText::SvxShowText( Window* pParent, const ResId& rResId, BOOL bCenter )
+: Control( pParent, rResId ),
+ mbCenter( bCenter)
+{}
+
+// -----------------------------------------------------------------------
+
+void SvxShowText::Paint( const Rectangle& )
+{
+ Color aTextCol = GetTextColor();
+
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ const Color aWindowTextColor( rStyleSettings.GetDialogTextColor() );
+ SetTextColor( aWindowTextColor );
+
+ const String aText = GetText();
+ const Size aSize = GetOutputSizePixel();
+ Point aPoint( 2, mnY );
+
+ // adjust position using ink boundary if possible
+ Rectangle aBoundRect;
+ if( !GetTextBoundRect( aBoundRect, aText ) || aBoundRect.IsEmpty() )
+ aPoint.X() = (aSize.Width() - GetTextWidth( aText )) / 2;
+ else
+ {
+ // adjust position before it gets out of bounds
+ aBoundRect += aPoint;
+
+ // shift back vertically if needed
+ int nYLDelta = aBoundRect.Top();
+ int nYHDelta = aSize.Height() - aBoundRect.Bottom();
+ if( nYLDelta <= 0 )
+ aPoint.Y() -= nYLDelta - 1;
+ else if( nYHDelta <= 0 )
+ aPoint.Y() += nYHDelta - 1;
+
+ if( mbCenter )
+ {
+ // move glyph to middle of cell
+ aPoint.X() = -aBoundRect.Left()
+ + (aSize.Width() - aBoundRect.GetWidth()) / 2;
+ }
+ else
+ {
+ // shift back horizontally if needed
+ int nXLDelta = aBoundRect.Left();
+ int nXHDelta = aSize.Width() - aBoundRect.Right();
+ if( nXLDelta <= 0 )
+ aPoint.X() -= nXLDelta - 1;
+ else if( nXHDelta <= 0 )
+ aPoint.X() += nXHDelta - 1;
+ }
+ }
+
+ DrawText( aPoint, aText );
+ SetTextColor( aTextCol );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowText::SetFont( const Font& rFont )
+{
+ long nWinHeight = GetOutputSizePixel().Height();
+ Font aFont = rFont;
+ aFont.SetWeight( WEIGHT_NORMAL );
+ aFont.SetAlign( ALIGN_TOP );
+ aFont.SetSize( PixelToLogic( Size( 0, nWinHeight/2 ) ) );
+ aFont.SetTransparent( TRUE );
+ Control::SetFont( aFont );
+ mnY = ( nWinHeight - GetTextHeight() ) / 2;
+
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowText::SetText( const String& rText )
+{
+ Control::SetText( rText );
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+SvxShowText::~SvxShowText()
+{}
+
+// class SvxCharacterMap =================================================
+
+SvxCharMapData::SvxCharMapData( SfxModalDialog* pDialog, BOOL bOne_, ResMgr* pResContext )
+: mpDialog( pDialog ),
+ aShowSet ( pDialog, ResId( CT_SHOWSET, *pResContext ) ),
+ aShowText ( pDialog, ResId( CT_SHOWTEXT, *pResContext ) ),
+// aShowShortcut ( pDialog, ResId( CT_ASSIGN, *pResContext ) ),
+ aOKBtn ( pDialog, ResId( BTN_CHAR_OK, *pResContext ) ),
+ aCancelBtn ( pDialog, ResId( BTN_CHAR_CANCEL, *pResContext ) ),
+ aHelpBtn ( pDialog, ResId( BTN_CHAR_HELP, *pResContext ) ),
+ aDeleteBtn ( pDialog, ResId( BTN_DELETE, *pResContext ) ),
+// aAssignBtn ( pDialog, ResId( BT_ASSIGN, *pResContext ) ),
+ aFontText ( pDialog, ResId( FT_FONT, *pResContext ) ),
+ aFontLB ( pDialog, ResId( LB_FONT, *pResContext ) ),
+ aSubsetText ( pDialog, ResId( FT_SUBSET, *pResContext ) ),
+ aSubsetLB ( pDialog, ResId( LB_SUBSET, *pResContext ) ),
+ aSymbolText ( pDialog, ResId( FT_SYMBOLE, *pResContext ) ),
+ aShowChar ( pDialog, ResId( CT_SHOWCHAR, *pResContext ), TRUE ),
+ aCharCodeText ( pDialog, ResId( FT_CHARCODE, *pResContext ) ),
+// aAssignText ( pDialog, ResId( FT_ASSIGN, *pResContext ) ),
+ bOne( bOne_ ),
+ pSubsetMap( NULL )
+{
+ aFont = pDialog->GetFont();
+ aFont.SetTransparent( TRUE );
+ aFont.SetFamily( FAMILY_DONTKNOW );
+ aFont.SetPitch( PITCH_DONTKNOW );
+ aFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW );
+
+ if ( bOne )
+ {
+ Size aDlgSize = pDialog->GetSizePixel();
+ pDialog->SetSizePixel( Size( aDlgSize.Width(),
+ aDlgSize.Height()-aShowText.GetSizePixel().Height() ) );
+ aSymbolText.Hide();
+ aShowText.Hide();
+ aDeleteBtn.Hide();
+ }
+
+ String aDefStr( aFont.GetName() );
+ String aLastName;
+ int nCount = mpDialog->GetDevFontCount();
+ for ( int i = 0; i < nCount; i++ )
+ {
+ String aFontName( mpDialog->GetDevFont( i ).GetName() );
+ if ( aFontName != aLastName )
+ {
+ aLastName = aFontName;
+ USHORT nPos = aFontLB.InsertEntry( aFontName );
+ aFontLB.SetEntryData( nPos, (void*)(ULONG)i );
+ }
+ }
+ // the font may not be in the list =>
+ // try to find a font name token in list and select found font,
+ // else select topmost entry
+ FASTBOOL bFound = (aFontLB.GetEntryPos( aDefStr ) == LISTBOX_ENTRY_NOTFOUND );
+ if( !bFound )
+ {
+ for ( xub_StrLen i = 0; i < aDefStr.GetTokenCount(); ++i )
+ {
+ String aToken = aDefStr.GetToken(i);
+ if ( aFontLB.GetEntryPos( aToken ) != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aDefStr = aToken;
+ bFound = TRUE;
+ break;
+ }
+ }
+ }
+
+ if ( bFound )
+ aFontLB.SelectEntry( aDefStr );
+ else if ( aFontLB.GetEntryCount() )
+ aFontLB.SelectEntryPos(0);
+ FontSelectHdl( &aFontLB );
+
+ aOKBtn.SetClickHdl( LINK( this, SvxCharMapData, OKHdl ) );
+ aFontLB.SetSelectHdl( LINK( this, SvxCharMapData, FontSelectHdl ) );
+ aSubsetLB.SetSelectHdl( LINK( this, SvxCharMapData, SubsetSelectHdl ) );
+ aShowSet.SetDoubleClickHdl( LINK( this, SvxCharMapData, CharDoubleClickHdl ) );
+ aShowSet.SetSelectHdl( LINK( this, SvxCharMapData, CharSelectHdl ) );
+ aShowSet.SetHighlightHdl( LINK( this, SvxCharMapData, CharHighlightHdl ) );
+ aShowSet.SetPreSelectHdl( LINK( this, SvxCharMapData, CharPreSelectHdl ) );
+ aDeleteBtn.SetClickHdl( LINK( this, SvxCharMapData, DeleteHdl ) );
+// aAssignBtn.SetClickHdl( LINK( this, SvxCharMapData, AssignHdl ) );
+
+ if( SvxShowCharSet::getSelectedChar() == ' ')
+ aOKBtn.Disable();
+ else
+ aOKBtn.Enable();
+
+ // left align aShowText field
+ int nLeftEdge = aSymbolText.GetPosPixel().X();
+ nLeftEdge += aSymbolText.GetTextWidth( aSymbolText.GetText() );
+ Size aNewSize = aShowText.GetOutputSizePixel();
+ aShowText.SetPosPixel( Point( nLeftEdge+4, aShowText.GetPosPixel().Y() ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharMapData::SetCharFont( const Font& rFont )
+{
+ // first get the underlying info in order to get font names
+ // like "Times New Roman;Times" resolved
+ Font aTmp( mpDialog->GetFontMetric( rFont ) );
+
+ if ( aFontLB.GetEntryPos( aTmp.GetName() ) == LISTBOX_ENTRY_NOTFOUND )
+ return;
+
+ aFontLB.SelectEntry( aTmp.GetName() );
+ aFont = aTmp;
+ FontSelectHdl( &aFontLB );
+
+ // for compatibility reasons
+ mpDialog->ModalDialog::SetFont( aFont );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharMapData, OKHdl, OKButton *, EMPTYARG )
+{
+ String aStr = aShowText.GetText();
+
+ if ( !aStr.Len() )
+ {
+ sal_UCS4 cChar = aShowSet.GetSelectCharacter();
+ // using the new UCS4 constructor
+ rtl::OUString aOUStr( &cChar, 1 );
+ aShowText.SetText( aOUStr );
+ }
+ mpDialog->EndDialog( TRUE );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharMapData, FontSelectHdl, ListBox *, EMPTYARG )
+{
+ USHORT nPos = aFontLB.GetSelectEntryPos(),
+ nFont = (USHORT)(ULONG)aFontLB.GetEntryData( nPos );
+ aFont = mpDialog->GetDevFont( nFont );
+ aFont.SetWeight( WEIGHT_DONTKNOW );
+ aFont.SetItalic( ITALIC_NONE );
+ aFont.SetWidthType( WIDTH_DONTKNOW );
+ aFont.SetPitch( PITCH_DONTKNOW );
+ aFont.SetFamily( FAMILY_DONTKNOW );
+
+ // notify children using this font
+ aShowSet.SetFont( aFont );
+ aShowChar.SetFont( aFont );
+ aShowText.SetFont( aFont );
+
+ // right align some fields to aShowSet
+ int nRightEdge = aShowSet.GetPosPixel().X() + aShowSet.GetOutputSizePixel().Width();
+ Size aNewSize = aSubsetLB.GetOutputSizePixel();
+ aNewSize.setWidth( nRightEdge - aSubsetLB.GetPosPixel().X() );
+ aSubsetLB.SetOutputSizePixel( aNewSize );
+
+ // setup unicode subset listbar with font specific subsets,
+ // hide unicode subset listbar for symbol fonts
+ // TODO: get info from the Font once it provides it
+ if( pSubsetMap)
+ delete pSubsetMap;
+ pSubsetMap = NULL;
+
+ BOOL bNeedSubset = (aFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL);
+ if( bNeedSubset )
+ {
+ FontCharMap aFontCharMap;
+ aShowSet.GetFontCharMap( aFontCharMap );
+ pSubsetMap = new SubsetMap( &aFontCharMap );
+
+ // update subset listbox for new font's unicode subsets
+ aSubsetLB.Clear();
+ // TODO: is it worth to improve the stupid linear search?
+ bool bFirst = true;
+ const Subset* s;
+ while( NULL != (s = pSubsetMap->GetNextSubset( bFirst )) )
+ {
+ USHORT nPos_ = aSubsetLB.InsertEntry( s->GetName() );
+ aSubsetLB.SetEntryData( nPos_, (void*)s );
+ // NOTE: subset must live at least as long as the selected font
+ if( bFirst )
+ aSubsetLB.SelectEntryPos( nPos_ );
+ bFirst = false;
+ }
+ if( aSubsetLB.GetEntryCount() <= 1 )
+ bNeedSubset = FALSE;
+ }
+
+ aSubsetText.Show( bNeedSubset);
+ aSubsetLB.Show( bNeedSubset);
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharMapData, SubsetSelectHdl, ListBox *, EMPTYARG )
+{
+ USHORT nPos = aSubsetLB.GetSelectEntryPos();
+ const Subset* pSubset = reinterpret_cast<const Subset*> (aSubsetLB.GetEntryData(nPos));
+ if( pSubset )
+ {
+ sal_UCS4 cFirst = pSubset->GetRangeMin();
+ aShowSet.SelectCharacter( cFirst );
+ }
+ aSubsetLB.SelectEntryPos( nPos );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharMapData, CharDoubleClickHdl, Control *, EMPTYARG )
+{
+ mpDialog->EndDialog( TRUE );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharMapData, CharSelectHdl, Control *, EMPTYARG )
+{
+ if ( !bOne )
+ {
+ String aText = aShowText.GetText();
+
+ if ( aText.Len() == CHARMAP_MAXLEN )
+ Sound::Beep( SOUND_WARNING );
+ else
+ {
+ sal_UCS4 cChar = aShowSet.GetSelectCharacter();
+ // using the new UCS4 constructor
+ rtl::OUString aOUStr( &cChar, 1 );
+ aShowText.SetText( aText + aOUStr );
+ }
+
+ }
+ aOKBtn.Enable();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharMapData, CharHighlightHdl, Control *, EMPTYARG )
+{
+ String aText;
+ sal_UCS4 cChar = aShowSet.GetSelectCharacter();
+ sal_Bool bSelect = (cChar > 0);
+
+ // show char sample
+ if ( bSelect )
+ {
+ // using the new UCS4 constructor
+ aText = rtl::OUString( &cChar, 1 );
+
+ const Subset* pSubset = NULL;
+ if( pSubsetMap )
+ pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
+ if( pSubset )
+ aSubsetLB.SelectEntry( pSubset->GetName() );
+ else
+ aSubsetLB.SetNoSelection();
+ }
+ aShowChar.SetText( aText );
+ aShowChar.Update();
+
+ // show char code
+ if ( bSelect )
+ {
+ char aBuf[32];
+ snprintf( aBuf, sizeof(aBuf), "U+%04X", static_cast<unsigned>(cChar) );
+ if( cChar < 0x0100 )
+ snprintf( aBuf+6, sizeof(aBuf)-6, " (%u)", static_cast<unsigned>(cChar) );
+ aText = String::CreateFromAscii( aBuf );
+ }
+ aCharCodeText.SetText( aText );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharMapData, CharPreSelectHdl, Control *, EMPTYARG )
+{
+ // adjust subset selection
+ if( pSubsetMap )
+ {
+ sal_UCS4 cChar = aShowSet.GetSelectCharacter();
+ const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
+ if( pSubset )
+ aSubsetLB.SelectEntry( pSubset->GetName() );
+ }
+
+ aOKBtn.Enable();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharMapData, DeleteHdl, PushButton *, EMPTYARG )
+{
+ aShowText.SetText( String() );
+ aOKBtn.Disable();
+ return 0;
+}
+
+#include <sfx2/objsh.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+
+IMPL_LINK( SvxCharMapData, AssignHdl, PushButton *, EMPTYARG )
+{
+ SfxAllItemSet aSet( SfxObjectShell::Current()->GetPool() );
+ aSet.Put( SfxStringItem( SID_CHARMAP, String::CreateFromAscii("test") ) );
+ SfxModalDialog* pDlg = new SfxMacroAssignDlg( mpDialog, com::sun::star::uno::Reference < com::sun::star::frame::XFrame >(), aSet );
+ if ( pDlg && pDlg->Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pOutSet->GetItemState( SID_CHARMAP, FALSE, &pItem ) )
+ {
+ // show assigned shortcut
+ }
+ }
+
+ delete pDlg;
+
+ return 0;
+}
diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
new file mode 100644
index 000000000000..d7667dff869a
--- /dev/null
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -0,0 +1,969 @@
+/*************************************************************************
+ *
+ * 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: cuifmsearch.cxx,v $
+ * $Revision: 1.14 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <svx/fmresids.hrc>
+#include <tools/debug.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/shl.hxx>
+#include <svx/dialmgr.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <osl/mutex.hxx>
+#include <sfx2/app.hxx>
+#include <svx/dialogs.hrc>
+#include <svl/filerec.hxx>
+#include <svx/fmsrccfg.hxx>
+#include <svx/fmsrcimp.hxx>
+#include "fmsearch.hrc"
+#include "cuifmsearch.hxx"
+#include <svx/srchdlg.hxx>
+#include <svl/cjkoptions.hxx>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <comphelper/processfactory.hxx>
+#include <svx/svxdlg.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::i18n;
+using namespace ::svxform;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::util;
+
+#define MAX_HISTORY_ENTRIES 50
+
+//------------------------------------------------------------------------
+void FmSearchDialog::initCommon( const Reference< XResultSet >& _rxCursor )
+{
+ // init the engine
+ DBG_ASSERT( m_pSearchEngine, "FmSearchDialog::initCommon: have no engine!" );
+ m_pSearchEngine->SetProgressHandler(LINK(this, FmSearchDialog, OnSearchProgress));
+
+ // some layout changes according to available CJK options
+ SvtCJKOptions aCJKOptions;
+ if (!aCJKOptions.IsJapaneseFindEnabled())
+ {
+ sal_Int32 nUpper = m_cbApprox.GetPosPixel().Y();
+ sal_Int32 nDifference = m_aSoundsLikeCJKSettings.GetPosPixel().Y() - nUpper;
+
+ // hide the options for the japanese search
+ Control* pFieldsToMove[] = { &m_flState, &m_ftRecordLabel, &m_ftRecord, &m_ftHint };
+ implMoveControls(pFieldsToMove, sizeof(pFieldsToMove)/sizeof(pFieldsToMove[0]), nDifference, &m_flOptions);
+
+ m_aSoundsLikeCJK.Hide();
+ m_aSoundsLikeCJKSettings.Hide();
+ }
+
+ if (!aCJKOptions.IsCJKFontEnabled())
+ {
+ m_aHalfFullFormsCJK.Hide();
+
+ // never ignore the width (ignoring is expensive) if the option is not available at all
+ // 04.12.2001 - 91973 - fs@openoffice.org
+ m_pSearchEngine->SetIgnoreWidthCJK( sal_False );
+ }
+
+ // some initial record texts
+ m_ftRecord.SetText( String::CreateFromInt32( _rxCursor->getRow() ) );
+ m_pbClose.SetHelpText(String());
+}
+
+//------------------------------------------------------------------------
+FmSearchDialog::FmSearchDialog(Window* pParent, const UniString& sInitialText, const ::std::vector< String >& _rContexts, sal_Int16 nInitialContext,
+ const Link& lnkContextSupplier)
+ :ModalDialog(pParent, SVX_RES(RID_SVXDLG_SEARCHFORM))
+ ,m_flSearchFor (this, SVX_RES(FL_SEARCHFOR))
+ ,m_rbSearchForText (this, SVX_RES(RB_SEARCHFORTEXT))
+ ,m_rbSearchForNull (this, SVX_RES(RB_SEARCHFORNULL))
+ ,m_rbSearchForNotNull (this, SVX_RES(RB_SEARCHFORNOTNULL))
+ ,m_cmbSearchText (this, SVX_RES(CMB_SEARCHTEXT))
+ ,m_flWhere (this, SVX_RES(FL_WHERE))
+ ,m_ftForm (this, SVX_RES(FT_FORM))
+ ,m_lbForm (this, SVX_RES(LB_FORM))
+ ,m_rbAllFields (this, SVX_RES(RB_ALLFIELDS))
+ ,m_rbSingleField (this, SVX_RES(RB_SINGLEFIELD))
+ ,m_lbField (this, SVX_RES(LB_FIELD))
+ ,m_flOptions (this, SVX_RES(FL_OPTIONS))
+ ,m_ftPosition (this, SVX_RES(FT_POSITION))
+ ,m_lbPosition (this, SVX_RES(LB_POSITION))
+ ,m_cbUseFormat (this, SVX_RES(CB_USEFORMATTER))
+ ,m_cbCase (this, SVX_RES(CB_CASE))
+ ,m_cbBackwards (this, SVX_RES(CB_BACKWARD))
+ ,m_cbStartOver (this, SVX_RES(CB_STARTOVER))
+ ,m_cbWildCard (this, SVX_RES(CB_WILDCARD))
+ ,m_cbRegular (this, SVX_RES(CB_REGULAR))
+ ,m_cbApprox (this, SVX_RES(CB_APPROX))
+ ,m_pbApproxSettings (this, SVX_RES(PB_APPROXSETTINGS))
+ ,m_aHalfFullFormsCJK (this, SVX_RES(CB_HALFFULLFORMS))
+ ,m_aSoundsLikeCJK (this, SVX_RES(CB_SOUNDSLIKECJK))
+ ,m_aSoundsLikeCJKSettings (this, SVX_RES(PB_SOUNDSLIKESETTINGS))
+ ,m_flState (this, SVX_RES(FL_STATE))
+ ,m_ftRecordLabel (this, SVX_RES(FT_RECORDLABEL))
+ ,m_ftRecord (this, SVX_RES(FT_RECORD))
+ ,m_ftHint (this, SVX_RES(FT_HINT))
+ ,m_pbSearchAgain (this, SVX_RES(PB_SEARCH))
+ ,m_pbClose (this, SVX_RES(1))
+ ,m_pbHelp (this, SVX_RES(1))
+ ,m_sSearch ( m_pbSearchAgain.GetText() )
+ ,m_sCancel ( Button::GetStandardText( BUTTON_CANCEL ) )
+ ,m_pPreSearchFocus( NULL )
+ ,m_lnkContextSupplier(lnkContextSupplier)
+ ,m_pConfig( NULL )
+{
+ DBG_ASSERT(m_lnkContextSupplier.IsSet(), "FmSearchDialog::FmSearchDialog : have no ContextSupplier !");
+
+ // erst mal die Informationen fuer den initialen Kontext
+ FmSearchContext fmscInitial;
+ fmscInitial.nContext = nInitialContext;
+ m_lnkContextSupplier.Call(&fmscInitial);
+ DBG_ASSERT(fmscInitial.xCursor.is(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplier !");
+ DBG_ASSERT(fmscInitial.strUsedFields.GetTokenCount(';') == (xub_StrLen)fmscInitial.arrFields.size(),
+ "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplied !");
+#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL
+ for (sal_Int32 i=0; i<(sal_Int32)fmscInitial.arrFields.size(); ++i)
+ DBG_ASSERT(fmscInitial.arrFields.at(i).is(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplier !");
+#endif // (OSL_DEBUG_LEVEL > 1) || DBG_UTIL
+
+ for ( ::std::vector< String >::const_iterator context = _rContexts.begin();
+ context != _rContexts.end();
+ ++context
+ )
+ {
+ m_arrContextFields.push_back(String());
+ m_lbForm.InsertEntry(*context);
+ }
+ m_lbForm.SelectEntryPos(nInitialContext);
+
+ m_lbForm.SetSelectHdl(LINK(this, FmSearchDialog, OnContextSelection));
+
+ if (m_arrContextFields.size() == 1)
+ { // remove the context selection listbox and rearrange the controls accordingly
+ sal_Int32 nUpper = m_lbForm.GetPosPixel().Y();
+ sal_Int32 nDifference = m_rbAllFields.GetPosPixel().Y() - nUpper;
+
+ // move all controls below the affected ones up
+ Control* pFieldsToMove[] = { &m_rbAllFields, &m_rbSingleField, &m_lbField, &m_flOptions, &m_ftPosition, &m_lbPosition,
+ &m_cbUseFormat, &m_cbCase, &m_cbBackwards, &m_cbStartOver, &m_cbWildCard, &m_cbRegular, &m_cbApprox,
+ &m_pbApproxSettings, &m_aHalfFullFormsCJK, &m_aSoundsLikeCJK, &m_aSoundsLikeCJKSettings,
+ &m_flState, &m_ftRecordLabel, &m_ftRecord, &m_ftHint };
+
+ implMoveControls(pFieldsToMove, sizeof(pFieldsToMove)/sizeof(pFieldsToMove[0]), nDifference, &m_flWhere);
+
+ Point pt = m_rbAllFields.GetPosPixel();
+ pt.X() = m_ftForm.GetPosPixel().X();
+ m_rbAllFields.SetPosPixel( pt );
+ pt = m_rbSingleField.GetPosPixel();
+ pt.X() = m_ftForm.GetPosPixel().X();
+ m_rbSingleField.SetPosPixel( pt );
+
+ // hide dispensable controls
+ m_ftForm.Hide();
+ m_lbForm.Hide();
+ }
+
+ m_pSearchEngine = new FmSearchEngine(
+ ::comphelper::getProcessServiceFactory(), fmscInitial.xCursor, fmscInitial.strUsedFields, fmscInitial.arrFields, SM_ALLOWSCHEDULE );
+ initCommon( fmscInitial.xCursor );
+
+ if (fmscInitial.sFieldDisplayNames.Len() != 0)
+ { // use the display names if supplied
+ DBG_ASSERT(fmscInitial.sFieldDisplayNames.GetTokenCount() == fmscInitial.strUsedFields.GetTokenCount(),
+ "FmSearchDialog::FmSearchDialog : invalid initial context description !");
+ Init(fmscInitial.sFieldDisplayNames, sInitialText);
+ }
+ else
+ Init(fmscInitial.strUsedFields, sInitialText);
+}
+
+//------------------------------------------------------------------------
+void FmSearchDialog::implMoveControls(
+ Control** _ppControls,
+ sal_Int32 _nControls,
+ sal_Int32 _nUp,
+ Control* /*_pToResize*/)
+{
+ for (sal_Int32 i=0; i<_nControls; ++i)
+ {
+ Point pt = _ppControls[i]->GetPosPixel();
+ pt.Y() -= _nUp;
+ _ppControls[i]->SetPosPixel(pt);
+ }
+
+ // resize myself
+ Size sz = GetSizePixel();
+ sz.Height() -= _nUp;
+ SetSizePixel(sz);
+}
+
+//------------------------------------------------------------------------
+FmSearchDialog::~FmSearchDialog()
+{
+ if (m_aDelayedPaint.IsActive())
+ m_aDelayedPaint.Stop();
+
+ SaveParams();
+
+ if (m_pConfig)
+ {
+ delete m_pConfig;
+ m_pConfig = NULL;
+ }
+
+ delete m_pSearchEngine;
+}
+
+//------------------------------------------------------------------------
+void FmSearchDialog::Init(const UniString& strVisibleFields, const UniString& sInitialText)
+{
+ // die Initialisierung all der Controls
+ m_rbSearchForText.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios));
+ m_rbSearchForNull.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios));
+ m_rbSearchForNotNull.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios));
+
+ m_rbAllFields.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios));
+ m_rbSingleField.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios));
+
+ m_pbSearchAgain.SetClickHdl(LINK(this, FmSearchDialog, OnClickedSearchAgain));
+ m_pbApproxSettings.SetClickHdl(LINK(this, FmSearchDialog, OnClickedSpecialSettings));
+ m_aSoundsLikeCJKSettings.SetClickHdl(LINK(this, FmSearchDialog, OnClickedSpecialSettings));
+
+ m_lbPosition.SetSelectHdl(LINK(this, FmSearchDialog, OnPositionSelected));
+ m_lbField.SetSelectHdl(LINK(this, FmSearchDialog, OnFieldSelected));
+
+ m_cmbSearchText.SetModifyHdl(LINK(this, FmSearchDialog, OnSearchTextModified));
+ m_cmbSearchText.EnableAutocomplete(sal_False);
+
+ m_cbUseFormat.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
+ m_cbBackwards.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
+ m_cbStartOver.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
+ m_cbCase.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
+ m_cbWildCard.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
+ m_cbRegular.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
+ m_cbApprox.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
+ m_aHalfFullFormsCJK.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
+ m_aSoundsLikeCJK.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
+
+ // die Listboxen fuellen
+ // die Methoden des Feldvergleiches
+ USHORT nResIds[] = {
+ RID_STR_SEARCH_ANYWHERE,
+ RID_STR_SEARCH_BEGINNING,
+ RID_STR_SEARCH_END,
+ RID_STR_SEARCH_WHOLE
+ };
+ for ( size_t i=0; i<sizeof(nResIds)/sizeof(nResIds[0]); ++i )
+ m_lbPosition.InsertEntry( String( SVX_RES( nResIds[i] ) ) );
+ m_lbPosition.SelectEntryPos(MATCHING_ANYWHERE);
+
+ // die Feld-Listbox
+ for (USHORT i=0; i<strVisibleFields.GetTokenCount(';'); ++i)
+ m_lbField.InsertEntry(strVisibleFields.GetToken(i, ';'));
+
+
+ m_pConfig = new FmSearchConfigItem;
+ LoadParams();
+
+ m_cmbSearchText.SetText(sInitialText);
+ // wenn die Edit-Zeile den Text veraendert hat (weil er zum Beispiel Steuerzeichen enthielt, wie das bei Memofeldern der Fall
+ // sein kann), nehme ich einen leeren UniString
+ UniString sRealSetText = m_cmbSearchText.GetText();
+ if (!sRealSetText.Equals(sInitialText))
+ m_cmbSearchText.SetText(UniString());
+ LINK(this, FmSearchDialog, OnSearchTextModified).Call(&m_cmbSearchText);
+
+ // initial die ganzen UI-Elemente fuer die Suche an
+ m_aDelayedPaint.SetTimeoutHdl(LINK(this, FmSearchDialog, OnDelayedPaint));
+ m_aDelayedPaint.SetTimeout(500);
+ EnableSearchUI(sal_True);
+
+ if ( m_rbSearchForText.IsChecked() )
+ m_cmbSearchText.GrabFocus();
+
+ FreeResource();
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmSearchDialog::Close()
+{
+ // Wenn der Close-Button disabled ist und man im Dialog ESC drueckt, dann wird irgendwo vom Frame trotzdem Close aufgerufen,
+ // was ich allerdings nicht will, wenn ich gerade mitten in einer (eventuell in einem extra Thread laufenden) Suche bin
+ if (!m_pbClose.IsEnabled())
+ return sal_False;
+ return ModalDialog::Close();
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK(FmSearchDialog, OnClickedFieldRadios, Button*, pButton)
+{
+ if ((pButton == &m_rbSearchForText) || (pButton == &m_rbSearchForNull) || (pButton == &m_rbSearchForNotNull))
+ {
+ EnableSearchForDependees(sal_True);
+ }
+ else
+ // die Feldlistbox entsprechend en- oder disablen
+ if (pButton == &m_rbSingleField)
+ {
+ m_lbField.Enable();
+ m_pSearchEngine->RebuildUsedFields(m_lbField.GetSelectEntryPos());
+ }
+ else
+ {
+ m_lbField.Disable();
+ m_pSearchEngine->RebuildUsedFields(-1);
+ }
+
+ return 0;
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK(FmSearchDialog, OnClickedSearchAgain, Button*, EMPTYARG)
+{
+ if (m_pbClose.IsEnabled())
+ { // der Button hat die Funktion 'Suchen'
+ UniString strThisRoundText = m_cmbSearchText.GetText();
+ // zur History dazu
+ m_cmbSearchText.RemoveEntry(strThisRoundText);
+ m_cmbSearchText.InsertEntry(strThisRoundText, 0);
+ // das Remove/Insert stellt a) sicher, dass der UniString nicht zweimal auftaucht, b), dass die zuletzt gesuchten Strings am
+ // Anfang stehen
+ // und die Listenlaenge beschraenken
+ while (m_cmbSearchText.GetEntryCount() > MAX_HISTORY_ENTRIES)
+ m_cmbSearchText.RemoveEntry(m_cmbSearchText.GetEntryCount()-1);
+
+ // den 'Ueberlauf'-Hint rausnehmen
+ m_ftHint.SetText(UniString());
+ m_ftHint.Invalidate();
+
+ if (m_cbStartOver.IsChecked())
+ {
+ m_cbStartOver.Check(sal_False);
+ EnableSearchUI(sal_False);
+ if (m_rbSearchForText.IsChecked())
+ m_pSearchEngine->StartOver(strThisRoundText);
+ else
+ m_pSearchEngine->StartOverSpecial(m_rbSearchForNull.IsChecked());
+ }
+ else
+ {
+ EnableSearchUI(sal_False);
+ if (m_rbSearchForText.IsChecked())
+ m_pSearchEngine->SearchNext(strThisRoundText);
+ else
+ m_pSearchEngine->SearchNextSpecial(m_rbSearchForNull.IsChecked());
+ }
+ }
+ else
+ { // der Button hat die Fukntion 'Abbrechen'
+ DBG_ASSERT(m_pSearchEngine->GetSearchMode() != SM_BRUTE, "FmSearchDialog, OnClickedSearchAgain : falscher Modus !");
+ // der CancelButton wird normalerweise nur disabled, wenn ich in einem Thread oder mit Reschedule arbeite
+ m_pSearchEngine->CancelSearch();
+ // mein ProgressHandler wird gerufen, wenn es wirklich zu Ende ist, das hier war nur eine Anforderung
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK(FmSearchDialog, OnClickedSpecialSettings, Button*, pButton )
+{
+ if (&m_pbApproxSettings == pButton)
+ {
+ AbstractSvxSearchSimilarityDialog* pDlg = NULL;
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ pDlg = pFact->CreateSvxSearchSimilarityDialog( this, m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(),
+ m_pSearchEngine->GetLevShorter(), m_pSearchEngine->GetLevLonger() );
+ DBG_ASSERT( pDlg, "FmSearchDialog, OnClickedSpecialSettings: could not load the dialog!" );
+
+ if ( pDlg && pDlg->Execute() == RET_OK )
+ {
+ m_pSearchEngine->SetLevRelaxed( pDlg->IsRelaxed() );
+ m_pSearchEngine->SetLevOther( pDlg->GetOther() );
+ m_pSearchEngine->SetLevShorter(pDlg->GetShorter() );
+ m_pSearchEngine->SetLevLonger( pDlg->GetLonger() );
+ }
+ delete pDlg;
+ }
+ else if (&m_aSoundsLikeCJKSettings == pButton)
+ {
+ SfxItemSet aSet( SFX_APP()->GetPool() );
+ //CHINA001 SvxJSearchOptionsDialog aDlg( this, aSet, RID_SVXPAGE_JSEARCH_OPTIONS, m_pSearchEngine->GetTransliterationFlags() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( this, aSet, RID_SVXPAGE_JSEARCH_OPTIONS, m_pSearchEngine->GetTransliterationFlags(), RID_SVXPAGE_JSEARCH_OPTIONS );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ aDlg->Execute(); //CHINA001 aDlg.Execute();
+
+
+ INT32 nFlags = aDlg->GetTransliterationFlags(); //CHINA001 INT32 nFlags = aDlg.GetTransliterationFlags();
+ m_pSearchEngine->SetTransliterationFlags(nFlags);
+
+ m_cbCase.Check(m_pSearchEngine->GetCaseSensitive());
+ OnCheckBoxToggled( &m_cbCase );
+ m_aHalfFullFormsCJK.Check( !m_pSearchEngine->GetIgnoreWidthCJK() );
+ OnCheckBoxToggled( &m_aHalfFullFormsCJK );
+ delete aDlg; //add for CHINA001
+ }
+ }
+
+ return 0;
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK(FmSearchDialog, OnSearchTextModified, ComboBox*, EMPTYARG)
+{
+ if ((m_cmbSearchText.GetText().Len() != 0) || !m_rbSearchForText.IsChecked())
+ m_pbSearchAgain.Enable();
+ else
+ m_pbSearchAgain.Disable();
+
+ m_pSearchEngine->InvalidatePreviousLoc();
+ return 0;
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK(FmSearchDialog, OnPositionSelected, ListBox*, pBox)
+{
+ (void) pBox; // avoid warning
+ DBG_ASSERT(pBox->GetSelectEntryCount() == 1, "FmSearchDialog::OnMethodSelected : unerwartet : nicht genau ein Eintrag selektiert !");
+
+ m_pSearchEngine->SetPosition(m_lbPosition.GetSelectEntryPos());
+ return 0;
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK(FmSearchDialog, OnFieldSelected, ListBox*, pBox)
+{
+ (void) pBox; // avoid warning
+ DBG_ASSERT(pBox->GetSelectEntryCount() == 1, "FmSearchDialog::OnFieldSelected : unerwartet : nicht genau ein Eintrag selektiert !");
+
+ m_pSearchEngine->RebuildUsedFields(m_rbAllFields.IsChecked() ? -1 : (sal_Int16)m_lbField.GetSelectEntryPos());
+ // ruft auch m_pSearchEngine->InvalidatePreviousLoc auf
+
+ sal_Int32 nCurrentContext = m_lbForm.GetSelectEntryPos();
+ if (nCurrentContext != LISTBOX_ENTRY_NOTFOUND)
+ m_arrContextFields[nCurrentContext] = UniString(m_lbField.GetSelectEntry());
+ return 0;
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK(FmSearchDialog, OnCheckBoxToggled, CheckBox*, pBox)
+{
+ sal_Bool bChecked = pBox->IsChecked();
+
+ // Formatter oder case -> an die Engine weiterreichen
+ if (pBox == &m_cbUseFormat)
+ m_pSearchEngine->SetFormatterUsing(bChecked);
+ else if (pBox == &m_cbCase)
+ m_pSearchEngine->SetCaseSensitive(bChecked);
+ // Richtung -> weiterreichen und Checkbox-Text fuer StartOver neu setzen
+ else if (pBox == &m_cbBackwards)
+ {
+ m_cbStartOver.SetText( String( SVX_RES( bChecked ? RID_STR_FROM_BOTTOM : RID_STR_FROM_TOP ) ) );
+ m_pSearchEngine->SetDirection(!bChecked);
+ }
+ // Aehnlichkeitssuche oder regulaerer Ausdruck
+ else if ((pBox == &m_cbApprox) || (pBox == &m_cbRegular) || (pBox == &m_cbWildCard))
+ {
+ // die beiden jeweils anderen Boxes disablen oder enablen
+ CheckBox* pBoxes[] = { &m_cbWildCard, &m_cbRegular, &m_cbApprox };
+ for (sal_uInt32 i=0; i<sizeof(pBoxes)/sizeof(CheckBox*); ++i)
+ {
+ if (pBoxes[i] != pBox)
+ {
+ if (bChecked)
+ pBoxes[i]->Disable();
+ else
+ pBoxes[i]->Enable();
+ }
+ }
+
+ // an die Engine weiterreichen
+ m_pSearchEngine->SetWildcard(m_cbWildCard.IsEnabled() ? m_cbWildCard.IsChecked() : sal_False);
+ m_pSearchEngine->SetRegular(m_cbRegular.IsEnabled() ? m_cbRegular.IsChecked() : sal_False);
+ m_pSearchEngine->SetLevenshtein(m_cbApprox.IsEnabled() ? m_cbApprox.IsChecked() : sal_False);
+ // (Boxes, die disabled sind, muessen als sal_False an die Engine gehen)
+
+ // die Position-Listbox anpassen (ist bei Wildcard-Suche nicht erlaubt)
+ if (pBox == &m_cbWildCard)
+ {
+ if (bChecked)
+ {
+ m_ftPosition.Disable();
+ m_lbPosition.Disable();
+ }
+ else
+ {
+ m_ftPosition.Enable();
+ m_lbPosition.Enable();
+ }
+ }
+
+ // und den Button fuer die Aehnlichkeitssuche
+ if (pBox == &m_cbApprox)
+ {
+ if (bChecked)
+ m_pbApproxSettings.Enable();
+ else
+ m_pbApproxSettings.Disable();
+ }
+ }
+ else if (pBox == &m_aHalfFullFormsCJK)
+ {
+ // forward to the search engine
+ m_pSearchEngine->SetIgnoreWidthCJK( !bChecked );
+ }
+ else if (pBox == &m_aSoundsLikeCJK)
+ {
+ m_aSoundsLikeCJKSettings.Enable(bChecked);
+
+ // two other buttons which depend on this one
+ sal_Bool bEnable = ( m_rbSearchForText.IsChecked()
+ && !m_aSoundsLikeCJK.IsChecked()
+ )
+ || !SvtCJKOptions().IsJapaneseFindEnabled();
+ m_cbCase.Enable(bEnable);
+ m_aHalfFullFormsCJK.Enable(bEnable);
+
+ // forward to the search engine
+ m_pSearchEngine->SetTransliteration( bChecked );
+ }
+
+ return 0;
+}
+
+//------------------------------------------------------------------------
+void FmSearchDialog::InitContext(sal_Int16 nContext)
+{
+ FmSearchContext fmscContext;
+ fmscContext.nContext = nContext;
+
+#ifdef DBG_UTIL
+ sal_uInt32 nResult =
+#endif
+ m_lnkContextSupplier.Call(&fmscContext);
+ DBG_ASSERT(nResult > 0, "FmSearchDialog::InitContext : ContextSupplier didn't give me any controls !");
+
+ // packen wir zuerst die Feld-Namen in die entsprechende Listbox
+ m_lbField.Clear();
+
+ if (fmscContext.sFieldDisplayNames.Len() != 0)
+ {
+ // use the display names if supplied
+ DBG_ASSERT(fmscContext.sFieldDisplayNames.GetTokenCount() == fmscContext.strUsedFields.GetTokenCount(),
+ "FmSearchDialog::InitContext : invalid context description supplied !");
+ for (xub_StrLen i=0; i<fmscContext.sFieldDisplayNames.GetTokenCount(); ++i)
+ m_lbField.InsertEntry(fmscContext.sFieldDisplayNames.GetToken(i));
+ }
+ else
+ // else use the field names
+ for (xub_StrLen i=0; i<fmscContext.strUsedFields.GetTokenCount(); ++i)
+ m_lbField.InsertEntry(fmscContext.strUsedFields.GetToken(i));
+
+ if (nContext < (sal_Int32)m_arrContextFields.size() && m_arrContextFields[nContext].Len())
+ {
+ m_lbField.SelectEntry(m_arrContextFields[nContext]);
+ }
+ else
+ {
+ m_lbField.SelectEntryPos(0);
+ if (m_rbSingleField.IsChecked() && (m_lbField.GetEntryCount() > 1))
+ m_lbField.GrabFocus();
+ }
+
+ // dann geben wir der Engine Bescheid
+ m_pSearchEngine->SwitchToContext(fmscContext.xCursor, fmscContext.strUsedFields, fmscContext.arrFields,
+ m_rbAllFields.IsChecked() ? -1 : 0);
+
+ // und die Position des neuen Cursors anzeigen
+ m_ftRecord.SetText(String::CreateFromInt32(fmscContext.xCursor->getRow()));
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK( FmSearchDialog, OnContextSelection, ListBox*, pBox)
+{
+ InitContext(pBox->GetSelectEntryPos());
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+void FmSearchDialog::EnableSearchUI(sal_Bool bEnable)
+{
+ // wenn die Controls disabled werden sollen, schalte ich mal eben kurz ihr Paint aus und verzoegert wieder an
+ if (!bEnable)
+ EnableControlPaint(sal_False);
+ else
+ { // beim Enablen teste ich, ob der Timer fuer das delayed paint aktiv ist und stoppe ihn wenn noetig
+ if (m_aDelayedPaint.IsActive())
+ m_aDelayedPaint.Stop();
+ }
+ // (das ganze geht unten noch weiter)
+ // diese kleine Verrenkung fuehrt hoffentlich dazu, dass es nicht flackert, wenn man die SearchUI schnell hintereinander
+ // aus- und wieder einschaltet (wie das bei einem kurzen Suchvorgang zwangslaeufig der Fall ist)
+
+ if ( !bEnable )
+ {
+ // if one of my children has the focus, remember it
+ // 104332 - 2002-10-17 - fs@openoffice.org
+ Window* pFocusWindow = Application::GetFocusWindow( );
+ if ( pFocusWindow && IsChild( pFocusWindow ) )
+ m_pPreSearchFocus = pFocusWindow;
+ else
+ m_pPreSearchFocus = NULL;
+ }
+
+ // der Suchen-Button hat einen Doppelfunktion, seinen Text entsprechend anpassen
+ String sButtonText( bEnable ? m_sSearch : m_sCancel );
+ m_pbSearchAgain.SetText( sButtonText );
+
+ // jetzt Controls en- oder disablen
+ if (m_pSearchEngine->GetSearchMode() != SM_BRUTE)
+ {
+ m_flSearchFor.Enable (bEnable);
+ m_rbSearchForText.Enable (bEnable);
+ m_rbSearchForNull.Enable (bEnable);
+ m_rbSearchForNotNull.Enable (bEnable);
+ m_flWhere.Enable (bEnable);
+ m_ftForm.Enable (bEnable);
+ m_lbForm.Enable (bEnable);
+ m_rbAllFields.Enable (bEnable);
+ m_rbSingleField.Enable (bEnable);
+ m_lbField.Enable (bEnable && m_rbSingleField.IsChecked());
+ m_flOptions.Enable (bEnable);
+ m_cbBackwards.Enable (bEnable);
+ m_cbStartOver.Enable (bEnable);
+ m_pbClose.Enable (bEnable);
+ EnableSearchForDependees (bEnable);
+
+ if ( !bEnable )
+ { // this means we're preparing for starting a search
+ // In this case, EnableSearchForDependees disabled the search button
+ // But as we're about to use it for cancelling the search, we really need to enable it, again
+ // 07.12.2001 - 95246 - fs@openoffice.org
+ m_pbSearchAgain.Enable( sal_True );
+ }
+ }
+
+ // und den Rest fuer das delayed paint
+ if (!bEnable)
+ m_aDelayedPaint.Start();
+ else
+ EnableControlPaint(sal_True);
+
+ if ( bEnable )
+ { // restore focus
+ // 104332 - 2002-10-17 - fs@openoffice.org
+ if ( m_pPreSearchFocus )
+ {
+ m_pPreSearchFocus->GrabFocus();
+ if ( WINDOW_EDIT == m_pPreSearchFocus->GetType() )
+ {
+ Edit* pEdit = static_cast< Edit* >( m_pPreSearchFocus );
+ pEdit->SetSelection( Selection( 0, pEdit->GetText().Len() ) );
+ }
+ }
+ m_pPreSearchFocus = NULL;
+ }
+
+}
+
+//------------------------------------------------------------------------
+void FmSearchDialog::EnableSearchForDependees(sal_Bool bEnable)
+{
+ sal_Bool bSearchingForText = m_rbSearchForText.IsChecked();
+ m_pbSearchAgain.Enable(bEnable && (!bSearchingForText || (m_cmbSearchText.GetText().Len() != 0)));
+
+ bEnable = bEnable && bSearchingForText;
+
+ sal_Bool bEnableRedundants = !m_aSoundsLikeCJK.IsChecked() || !SvtCJKOptions().IsJapaneseFindEnabled();
+
+ m_cmbSearchText.Enable (bEnable);
+ m_ftPosition.Enable (bEnable && !m_cbWildCard.IsChecked());
+ m_cbWildCard.Enable (bEnable && !m_cbRegular.IsChecked() && !m_cbApprox.IsChecked());
+ m_cbRegular.Enable (bEnable && !m_cbWildCard.IsChecked() && !m_cbApprox.IsChecked());
+ m_cbApprox.Enable (bEnable && !m_cbWildCard.IsChecked() && !m_cbRegular.IsChecked());
+ m_pbApproxSettings.Enable (bEnable && m_cbApprox.IsChecked());
+ m_aHalfFullFormsCJK.Enable (bEnable && bEnableRedundants);
+ m_aSoundsLikeCJK.Enable (bEnable);
+ m_aSoundsLikeCJKSettings.Enable (bEnable && m_aSoundsLikeCJK.IsChecked());
+ m_lbPosition.Enable (bEnable && !m_cbWildCard.IsChecked());
+ m_cbUseFormat.Enable (bEnable);
+ m_cbCase.Enable (bEnable && bEnableRedundants);
+}
+
+//------------------------------------------------------------------------
+void FmSearchDialog::EnableControlPaint(sal_Bool bEnable)
+{
+ Control* pAffectedControls[] = { &m_flSearchFor, &m_rbSearchForText, &m_cmbSearchText, &m_rbSearchForNull, &m_rbSearchForNotNull,
+ &m_rbSearchForText, &m_flWhere, &m_rbAllFields, &m_rbSingleField, &m_lbField, &m_flOptions, &m_ftPosition, &m_lbPosition,
+ &m_cbUseFormat, &m_cbCase, &m_cbBackwards, &m_cbStartOver, &m_cbWildCard, &m_cbRegular, &m_cbApprox, &m_pbApproxSettings,
+ &m_pbSearchAgain, &m_pbClose };
+
+ if (!bEnable)
+ for (sal_uInt32 i=0; i<sizeof(pAffectedControls)/sizeof(pAffectedControls[0]); ++i)
+ {
+ pAffectedControls[i]->SetUpdateMode(bEnable);
+ pAffectedControls[i]->EnablePaint(bEnable);
+ }
+ else
+ for (sal_uInt32 i=0; i<sizeof(pAffectedControls)/sizeof(pAffectedControls[0]); ++i)
+ {
+ pAffectedControls[i]->EnablePaint(bEnable);
+ pAffectedControls[i]->SetUpdateMode(bEnable);
+ }
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK(FmSearchDialog, OnDelayedPaint, void*, EMPTYARG)
+{
+ EnableControlPaint(sal_True);
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+void FmSearchDialog::OnFound(const ::com::sun::star::uno::Any& aCursorPos, sal_Int16 nFieldPos)
+{
+ FmFoundRecordInformation friInfo;
+ friInfo.nContext = m_lbForm.GetSelectEntryPos();
+ // wenn ich keine Suche in Kontexten mache, steht hier was ungueltiges drin, aber dann ist es auch egal
+ friInfo.aPosition = aCursorPos;
+ if (m_rbAllFields.IsChecked())
+ friInfo.nFieldPos = nFieldPos;
+ else
+ friInfo.nFieldPos = m_lbField.GetSelectEntryPos();
+ // das setzt natuerlich voraus, dass ich wirklich in dem Feld gesucht habe, dass in der Listbox ausgewaehlt ist,
+ // genau das wird auch in RebuildUsedFields sichergestellt
+
+ // dem Handler Bescheid sagen
+ m_lnkFoundHandler.Call(&friInfo);
+
+ // und wieder Focus auf mich
+ m_cmbSearchText.GrabFocus();
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK(FmSearchDialog, OnSearchProgress, FmSearchProgress*, pProgress)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ // diese eine Methode Thread-sicher machen (das ist ein Overkill, die ganze restliche Applikation dafuer zu blockieren,
+ // aber im Augenblick haben wir kein anderes Sicherheitskonpzept)
+
+ switch (pProgress->aSearchState)
+ {
+ case FmSearchProgress::STATE_PROGRESS:
+ if (pProgress->bOverflow)
+ {
+ String sHint( SVX_RES( m_cbBackwards.IsChecked() ? RID_STR_OVERFLOW_BACKWARD : RID_STR_OVERFLOW_FORWARD ) );
+ m_ftHint.SetText( sHint );
+ m_ftHint.Invalidate();
+ }
+
+ m_ftRecord.SetText(String::CreateFromInt32(1 + pProgress->nCurrentRecord));
+ m_ftRecord.Invalidate();
+ break;
+
+ case FmSearchProgress::STATE_PROGRESS_COUNTING:
+ m_ftHint.SetText(SVX_RESSTR(RID_STR_SEARCH_COUNTING));
+ m_ftHint.Invalidate();
+
+ m_ftRecord.SetText(String::CreateFromInt32(pProgress->nCurrentRecord));
+ m_ftRecord.Invalidate();
+ break;
+
+ case FmSearchProgress::STATE_SUCCESSFULL:
+ OnFound(pProgress->aBookmark, (sal_Int16)pProgress->nFieldIndex);
+ EnableSearchUI(sal_True);
+ break;
+
+ case FmSearchProgress::STATE_ERROR:
+ case FmSearchProgress::STATE_NOTHINGFOUND:
+ {
+ sal_uInt16 nErrorId = (FmSearchProgress::STATE_ERROR == pProgress->aSearchState)
+ ? RID_SVXERR_SEARCH_GENERAL_ERROR
+ : RID_SVXERR_SEARCH_NORECORD;
+ ErrorBox(this, SVX_RES(nErrorId)).Execute();
+ }
+ // KEIN break !
+ case FmSearchProgress::STATE_CANCELED:
+ EnableSearchUI(sal_True);
+ if (m_lnkCanceledNotFoundHdl.IsSet())
+ {
+ FmFoundRecordInformation friInfo;
+ friInfo.nContext = m_lbForm.GetSelectEntryPos();
+ // wenn ich keine Suche in Kontexten mache, steht hier was ungueltiges drin, aber dann ist es auch egal
+ friInfo.aPosition = pProgress->aBookmark;
+ m_lnkCanceledNotFoundHdl.Call(&friInfo);
+ }
+ break;
+ }
+
+ m_ftRecord.SetText(String::CreateFromInt32(1 + pProgress->nCurrentRecord));
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+void FmSearchDialog::LoadParams()
+{
+ FmSearchParams aParams(m_pConfig->getParams());
+
+ const ::rtl::OUString* pHistory = aParams.aHistory.getConstArray();
+ const ::rtl::OUString* pHistoryEnd = pHistory + aParams.aHistory.getLength();
+ for (; pHistory != pHistoryEnd; ++pHistory)
+ m_cmbSearchText.InsertEntry( *pHistory );
+
+ // die Einstellungen nehme ich an meinen UI-Elementen vor und rufe dann einfach den entsprechenden Change-Handler auf,
+ // dadurch werden die Daten an die SearchEngine weitergereicht und alle abhaengigen Enstellungen vorgenommen
+
+ // aktuelles Feld
+ sal_uInt16 nInitialField = m_lbField.GetEntryPos( String( aParams.sSingleSearchField ) );
+ if (nInitialField == COMBOBOX_ENTRY_NOTFOUND)
+ nInitialField = 0;
+ m_lbField.SelectEntryPos(nInitialField);
+ LINK(this, FmSearchDialog, OnFieldSelected).Call(&m_lbField);
+ // alle/einzelnes Feld (NACH dem Selektieren des Feldes, da OnClickedFieldRadios dort einen gueltigen Eintrag erwartet)
+ if (aParams.bAllFields)
+ {
+ m_rbSingleField.Check(sal_False);
+ m_rbAllFields.Check(sal_True);
+ LINK(this, FmSearchDialog, OnClickedFieldRadios).Call(&m_rbAllFields);
+ // OnClickedFieldRadios ruft auch um RebuildUsedFields
+ }
+ else
+ {
+ m_rbAllFields.Check(sal_False);
+ m_rbSingleField.Check(sal_True);
+ LINK(this, FmSearchDialog, OnClickedFieldRadios).Call(&m_rbSingleField);
+ }
+
+ // Position im Feld
+ m_lbPosition.SelectEntryPos(aParams.nPosition);
+ LINK(this, FmSearchDialog, OnPositionSelected).Call(&m_lbPosition);
+
+ // Feld-Formatierung/Case-Sensitivitaet/Richtung
+ m_cbUseFormat.Check(aParams.bUseFormatter);
+ m_cbCase.Check( aParams.isCaseSensitive() );
+ m_cbBackwards.Check(aParams.bBackwards);
+ LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbUseFormat);
+ LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbCase);
+ LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbBackwards);
+
+ m_aHalfFullFormsCJK.Check( !aParams.isIgnoreWidthCJK( ) ); // BEWARE: this checkbox has a inverse semantics!
+ m_aSoundsLikeCJK.Check( aParams.bSoundsLikeCJK );
+ LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_aHalfFullFormsCJK);
+ LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_aSoundsLikeCJK);
+
+ // die drei Checkboxen fuer spezielle Sucharten
+ // erst mal alle ruecksetzen
+ m_cbWildCard.Check(sal_False);
+ m_cbRegular.Check(sal_False);
+ m_cbApprox.Check(sal_False);
+ LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbWildCard);
+ LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbRegular);
+ LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbApprox);
+
+ // dann die richtige setzen
+ CheckBox* pToCheck = NULL;
+ if (aParams.bWildcard)
+ pToCheck = &m_cbWildCard;
+ if (aParams.bRegular)
+ pToCheck = &m_cbRegular;
+ if (aParams.bApproxSearch)
+ pToCheck = &m_cbApprox;
+ if (aParams.bSoundsLikeCJK)
+ pToCheck = &m_aSoundsLikeCJK;
+ if (pToCheck)
+ {
+ pToCheck->Check(sal_True);
+ LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(pToCheck);
+ }
+
+ // die Levenshtein-Parameter direkt an der SearchEngine setzen
+ m_pSearchEngine->SetLevRelaxed(aParams.bLevRelaxed);
+ m_pSearchEngine->SetLevOther(aParams.nLevOther);
+ m_pSearchEngine->SetLevShorter(aParams.nLevShorter);
+ m_pSearchEngine->SetLevLonger(aParams.nLevLonger);
+
+ m_pSearchEngine->SetTransliterationFlags( aParams.getTransliterationFlags( ) );
+
+ m_rbSearchForText.Check(sal_False);
+ m_rbSearchForNull.Check(sal_False);
+ m_rbSearchForNotNull.Check(sal_False);
+ switch (aParams.nSearchForType)
+ {
+ case 1: m_rbSearchForNull.Check(sal_True); break;
+ case 2: m_rbSearchForNotNull.Check(sal_True); break;
+ default: m_rbSearchForText.Check(sal_True); break;
+ }
+ LINK(this, FmSearchDialog, OnClickedFieldRadios).Call(&m_rbSearchForText);
+}
+
+//------------------------------------------------------------------------
+void FmSearchDialog::SaveParams() const
+{
+ if (!m_pConfig)
+ return;
+
+ FmSearchParams aCurrentSettings;
+
+ aCurrentSettings.aHistory.realloc( m_cmbSearchText.GetEntryCount() );
+ ::rtl::OUString* pHistory = aCurrentSettings.aHistory.getArray();
+ for (sal_uInt16 i=0; i<m_cmbSearchText.GetEntryCount(); ++i, ++pHistory)
+ *pHistory = m_cmbSearchText.GetEntry(i);
+
+ aCurrentSettings.sSingleSearchField = m_lbField.GetSelectEntry();
+ aCurrentSettings.bAllFields = m_rbAllFields.IsChecked();
+ aCurrentSettings.nPosition = m_pSearchEngine->GetPosition();
+ aCurrentSettings.bUseFormatter = m_pSearchEngine->GetFormatterUsing();
+ aCurrentSettings.setCaseSensitive ( m_pSearchEngine->GetCaseSensitive() );
+ aCurrentSettings.bBackwards = !m_pSearchEngine->GetDirection();
+ aCurrentSettings.bWildcard = m_pSearchEngine->GetWildcard();
+ aCurrentSettings.bRegular = m_pSearchEngine->GetRegular();
+ aCurrentSettings.bApproxSearch = m_pSearchEngine->GetLevenshtein();
+ aCurrentSettings.bLevRelaxed = m_pSearchEngine->GetLevRelaxed();
+ aCurrentSettings.nLevOther = m_pSearchEngine->GetLevOther();
+ aCurrentSettings.nLevShorter = m_pSearchEngine->GetLevShorter();
+ aCurrentSettings.nLevLonger = m_pSearchEngine->GetLevLonger();
+
+ aCurrentSettings.bSoundsLikeCJK = m_pSearchEngine->GetTransliteration();
+ aCurrentSettings.setTransliterationFlags ( m_pSearchEngine->GetTransliterationFlags() );
+
+ if (m_rbSearchForNull.IsChecked())
+ aCurrentSettings.nSearchForType = 1;
+ else if (m_rbSearchForNotNull.IsChecked())
+ aCurrentSettings.nSearchForType = 2;
+ else
+ aCurrentSettings.nSearchForType = 0;
+
+ m_pConfig->setParams( aCurrentSettings );
+}
+
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
new file mode 100644
index 000000000000..9ba33f3f2c93
--- /dev/null
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -0,0 +1,1271 @@
+/*************************************************************************
+ *
+ * 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: cuigaldlg.cxx,v $
+ * $Revision: 1.15 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <algorithm>
+#include <ucbhelper/content.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <avmedia/mediawindow.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svx/opengrf.hxx>
+#include <svx/impgrf.hxx>
+#include <svx/gallery1.hxx>
+#include <svx/galtheme.hxx>
+#include "cuigaldlg.hxx"
+#include <svl/pickerhelper.hxx>
+#include "helpid.hrc"
+#include <unotools/syslocale.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
+
+#include "gallery.hrc"
+
+// --------------
+// - Namespaces -
+// --------------
+
+using namespace ::ucbhelper;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::uno;
+
+
+// -----------
+// - Defines -
+// -----------
+
+#define MAXPATH 1024
+
+// ----------------
+// - SearchThread -
+// ----------------
+
+SearchThread::SearchThread( SearchProgress* pProgess,
+ TPGalleryThemeProperties* pBrowser,
+ const INetURLObject& rStartURL ) :
+ mpProgress ( pProgess ),
+ mpBrowser ( pBrowser ),
+ maStartURL ( rStartURL )
+{
+}
+
+// ------------------------------------------------------------------------
+
+SearchThread::~SearchThread()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void SAL_CALL SearchThread::run()
+{
+ const String aFileType( mpBrowser->aCbbFileType.GetText() );
+
+ if( aFileType.Len() )
+ {
+ const sal_uInt16 nFileNumber = mpBrowser->aCbbFileType.GetEntryPos( aFileType );
+ sal_uInt16 nBeginFormat, nEndFormat;
+ ::std::vector< String > aFormats;
+
+ if( !nFileNumber || ( nFileNumber >= mpBrowser->aCbbFileType.GetEntryCount() ) )
+ {
+ nBeginFormat = 1;
+ nEndFormat = mpBrowser->aCbbFileType.GetEntryCount() - 1;
+ }
+ else
+ nBeginFormat = nEndFormat = nFileNumber;
+
+ for( sal_uInt16 i = nBeginFormat; i <= nEndFormat; ++i )
+ aFormats.push_back( ( (FilterEntry*) mpBrowser->aFilterEntryList.GetObject( i ) )->aFilterName.ToLowerAscii() );
+
+ ImplSearch( maStartURL, aFormats, mpBrowser->bSearchRecursive );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void SAL_CALL SearchThread::onTerminated()
+{
+ Application::PostUserEvent( LINK( mpProgress, SearchProgress, CleanUpHdl ) );
+}
+
+// ------------------------------------------------------------------------
+
+void SearchThread::ImplSearch( const INetURLObject& rStartURL,
+ const ::std::vector< String >& rFormats,
+ BOOL bRecursive )
+{
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ mpProgress->SetDirectory( rStartURL );
+ mpProgress->Sync();
+ }
+
+ try
+ {
+ ::com::sun::star::uno::Reference< XCommandEnvironment > xEnv;
+ Content aCnt( rStartURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv );
+ Sequence< OUString > aProps( 2 );
+
+ aProps.getArray()[ 0 ] = OUString::createFromAscii( "IsFolder" );
+ aProps.getArray()[ 1 ] = OUString::createFromAscii( "IsDocument" );
+ ::com::sun::star::uno::Reference< XResultSet > xResultSet(
+ aCnt.createCursor( aProps, INCLUDE_FOLDERS_AND_DOCUMENTS ) );
+
+ if( xResultSet.is() )
+ {
+ ::com::sun::star::uno::Reference< XContentAccess > xContentAccess( xResultSet, UNO_QUERY_THROW );
+ ::com::sun::star::uno::Reference< XRow > xRow( xResultSet, UNO_QUERY_THROW );
+
+ while( xResultSet->next() && schedule() )
+ {
+ INetURLObject aFoundURL( xContentAccess->queryContentIdentifierString() );
+ DBG_ASSERT( aFoundURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ sal_Bool bFolder = xRow->getBoolean( 1 ); // property "IsFolder"
+ if ( xRow->wasNull() )
+ bFolder = sal_False;
+
+ if( bRecursive && bFolder )
+ ImplSearch( aFoundURL, rFormats, TRUE );
+ else
+ {
+ sal_Bool bDocument = xRow->getBoolean( 2 ); // property "IsDocument"
+ if ( xRow->wasNull() )
+ bDocument = sal_False;
+
+ if( bDocument )
+ {
+ GraphicDescriptor aDesc( aFoundURL );
+ String aFileName;
+
+ if( ( aDesc.Detect() &&
+ ::std::find( rFormats.begin(),
+ rFormats.end(),
+ aDesc.GetImportFormatShortName(
+ aDesc.GetFileFormat() ).ToLowerAscii() )
+ != rFormats.end() ) ||
+ ::std::find( rFormats.begin(),
+ rFormats.end(),
+ String(aFoundURL.GetExtension().toAsciiLowerCase()) )
+ != rFormats.end() )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ mpBrowser->aFoundList.Insert(
+ new String( aFoundURL.GetMainURL( INetURLObject::NO_DECODE ) ),
+ LIST_APPEND );
+ mpBrowser->aLbxFound.InsertEntry(
+ GetReducedString( aFoundURL, 50 ),
+ (USHORT) mpBrowser->aFoundList.Count() - 1 );
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( const ContentCreationException& )
+ {
+ }
+ catch( const ::com::sun::star::uno::RuntimeException& )
+ {
+ }
+ catch( const ::com::sun::star::uno::Exception& )
+ {
+ }
+}
+
+// ------------------
+// - SearchProgress -
+// ------------------
+
+SearchProgress::SearchProgress( Window* pParent, const INetURLObject& rStartURL ) :
+ ModalDialog ( pParent, GAL_RESID(RID_SVXDLG_GALLERY_SEARCH_PROGRESS ) ),
+ aFtSearchDir ( this, GAL_RESID( FT_SEARCH_DIR ) ),
+ aFLSearchDir ( this, GAL_RESID( FL_SEARCH_DIR ) ),
+ aFtSearchType ( this, GAL_RESID( FT_SEARCH_TYPE ) ),
+ aFLSearchType ( this, GAL_RESID( FL_SEARCH_TYPE ) ),
+ aBtnCancel ( this, GAL_RESID( BTN_CANCEL ) ),
+ maSearchThread ( this, (TPGalleryThemeProperties*) pParent, rStartURL )
+{
+ FreeResource();
+ aBtnCancel.SetClickHdl( LINK( this, SearchProgress, ClickCancelBtn ) );
+}
+
+// ------------------------------------------------------------------------
+
+void SearchProgress::Terminate()
+{
+ maSearchThread.terminate();
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( SearchProgress, ClickCancelBtn, void*, EMPTYARG )
+{
+ Terminate();
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( SearchProgress, CleanUpHdl, void*, EMPTYARG )
+{
+ EndDialog( RET_OK );
+ delete this;
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+short SearchProgress::Execute()
+{
+ DBG_ERROR( "SearchProgress cannot be executed via Dialog::Execute!\n"
+ "It creates a thread that will call back to VCL apartment => deadlock!\n"
+ "Use Dialog::StartExecuteModal to execute the dialog!" );
+ return RET_CANCEL;
+}
+
+// ------------------------------------------------------------------------
+
+void SearchProgress::StartExecuteModal( const Link& rEndDialogHdl )
+{
+ maSearchThread.create();
+ ModalDialog::StartExecuteModal( rEndDialogHdl );
+}
+
+// --------------
+// - TakeThread -
+// --------------
+
+TakeThread::TakeThread( TakeProgress* pProgess, TPGalleryThemeProperties* pBrowser, List& rTakenList ) :
+ mpProgress ( pProgess ),
+ mpBrowser ( pBrowser ),
+ mrTakenList ( rTakenList )
+{
+}
+
+// ------------------------------------------------------------------------
+
+TakeThread::~TakeThread()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void SAL_CALL TakeThread::run()
+{
+ String aName;
+ INetURLObject aURL;
+ USHORT nEntries;
+ GalleryTheme* pThm = mpBrowser->GetXChgData()->pTheme;
+ USHORT nPos;
+ GalleryProgress* pStatusProgress;
+
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ pStatusProgress = new GalleryProgress;
+ nEntries = mpBrowser->bTakeAll ? mpBrowser->aLbxFound.GetEntryCount() : mpBrowser->aLbxFound.GetSelectEntryCount();
+ pThm->LockBroadcaster();
+ }
+
+ for( USHORT i = 0; i < nEntries && schedule(); i++ )
+ {
+ // kompletten Filenamen aus FoundList holen
+ if( mpBrowser->bTakeAll )
+ aURL = INetURLObject(*mpBrowser->aFoundList.GetObject( nPos = i ));
+ else
+ aURL = INetURLObject(*mpBrowser->aFoundList.GetObject( nPos = mpBrowser->aLbxFound.GetSelectEntryPos( i ) ));
+
+ // Position in Taken-Liste uebernehmen
+ mrTakenList.Insert( (void*) (ULONG)nPos, LIST_APPEND );
+
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ mpProgress->SetFile( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) );
+ pStatusProgress->Update( i, nEntries - 1 );
+ mpProgress->Sync();
+ pThm->InsertURL( aURL );
+ }
+ }
+
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ pThm->UnlockBroadcaster();
+ delete pStatusProgress;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void SAL_CALL TakeThread::onTerminated()
+{
+ Application::PostUserEvent( LINK( mpProgress, TakeProgress, CleanUpHdl ) );
+}
+
+// ----------------
+// - TakeProgress -
+// ----------------
+
+TakeProgress::TakeProgress( Window* pWindow ) :
+ ModalDialog ( pWindow, GAL_RESID( RID_SVXDLG_GALLERY_TAKE_PROGRESS ) ),
+ aFtTakeFile ( this, GAL_RESID( FT_TAKE_FILE ) ),
+ aFLTakeProgress( this, GAL_RESID( FL_TAKE_PROGRESS ) ),
+ aBtnCancel ( this, GAL_RESID( BTN_CANCEL ) ),
+ maTakeThread ( this, (TPGalleryThemeProperties*) pWindow, maTakenList )
+
+{
+ FreeResource();
+ aBtnCancel.SetClickHdl( LINK( this, TakeProgress, ClickCancelBtn ) );
+}
+
+// ------------------------------------------------------------------------
+
+
+void TakeProgress::Terminate()
+{
+ maTakeThread.terminate();
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TakeProgress, ClickCancelBtn, void*, EMPTYARG )
+{
+ Terminate();
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TakeProgress, CleanUpHdl, void*, EMPTYARG )
+{
+ TPGalleryThemeProperties* mpBrowser = (TPGalleryThemeProperties*) GetParent();
+ ::std::bit_vector aRemoveEntries( mpBrowser->aFoundList.Count(), false );
+ ::std::vector< String > aRemainingVector;
+ sal_uInt32 i, nCount;
+
+ GetParent()->EnterWait();
+ mpBrowser->aLbxFound.SetUpdateMode( FALSE );
+ mpBrowser->aLbxFound.SetNoSelection();
+
+ // mark all taken positions in aRemoveEntries
+ for( i = 0UL, nCount = maTakenList.Count(); i < nCount; ++i )
+ aRemoveEntries[ (ULONG) maTakenList.GetObject( i ) ] = true;
+
+ maTakenList.Clear();
+
+ // refill found list
+ for( i = 0, nCount = aRemoveEntries.size(); i < nCount; ++i )
+ if( !aRemoveEntries[ i ] )
+ aRemainingVector.push_back( *mpBrowser->aFoundList.GetObject( i ) );
+
+ for( String* pStr = mpBrowser->aFoundList.First(); pStr; pStr = mpBrowser->aFoundList.Next() )
+ delete pStr;
+
+ mpBrowser->aFoundList.Clear();
+
+ for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i )
+ mpBrowser->aFoundList.Insert( new String( aRemainingVector[ i ] ), LIST_APPEND );
+
+ aRemainingVector.clear();
+
+ // refill list box
+ for( i = 0, nCount = aRemoveEntries.size(); i < nCount; ++i )
+ if( !aRemoveEntries[ i ] )
+ aRemainingVector.push_back( mpBrowser->aLbxFound.GetEntry( (sal_uInt16) i ) );
+
+ mpBrowser->aLbxFound.Clear();
+
+ for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i )
+ mpBrowser->aLbxFound.InsertEntry( aRemainingVector[ i ] );
+
+ aRemainingVector.clear();
+
+ mpBrowser->aLbxFound.SetUpdateMode( TRUE );
+ mpBrowser->SelectFoundHdl( NULL );
+ GetParent()->LeaveWait();
+
+ EndDialog( RET_OK );
+ delete this;
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+short TakeProgress::Execute()
+{
+ DBG_ERROR( "TakeProgress cannot be executed via Dialog::Execute!\n"
+ "It creates a thread that will call back to VCL apartment => deadlock!\n"
+ "Use Dialog::StartExecuteModal to execute the dialog!" );
+ return RET_CANCEL;
+}
+
+// ------------------------------------------------------------------------
+
+void TakeProgress::StartExecuteModal( const Link& rEndDialogHdl )
+{
+ maTakeThread.create();
+ ModalDialog::StartExecuteModal( rEndDialogHdl );
+}
+
+// ---------------------
+// - ActualizeProgress -
+// ---------------------
+
+ActualizeProgress::ActualizeProgress( Window* pWindow, GalleryTheme* pThm ) :
+ ModalDialog ( pWindow, GAL_RESID( RID_SVXDLG_GALLERY_ACTUALIZE_PROGRESS ) ),
+ aFtActualizeFile ( this, GAL_RESID( FT_ACTUALIZE_FILE ) ),
+ aFLActualizeProgress ( this, GAL_RESID( FL_ACTUALIZE_PROGRESS ) ),
+ aBtnCancel ( this, GAL_RESID( BTN_CANCEL ) ),
+ pTheme ( pThm )
+{
+ FreeResource();
+ aBtnCancel.SetClickHdl( LINK( this, ActualizeProgress, ClickCancelBtn ) );
+}
+
+// ------------------------------------------------------------------------
+
+short ActualizeProgress::Execute()
+{
+ short nRet;
+
+ pTimer = new Timer;
+
+ if ( pTimer )
+ {
+ pTimer->SetTimeoutHdl( LINK( this, ActualizeProgress, TimeoutHdl ) );
+ pTimer->SetTimeout( 500 );
+ pTimer->Start();
+ }
+
+ nRet = ModalDialog::Execute();
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( ActualizeProgress, ClickCancelBtn, void*, EMPTYARG )
+{
+ pTheme->AbortActualize();
+ EndDialog( RET_OK );
+
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( ActualizeProgress, TimeoutHdl, Timer*, _pTimer )
+{
+ if ( _pTimer )
+ {
+ _pTimer->Stop();
+ delete _pTimer;
+ }
+
+ pTheme->Actualize( LINK( this, ActualizeProgress, ActualizeHdl ), &aStatusProgress );
+ ClickCancelBtn( NULL );
+
+ return 0;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( ActualizeProgress, ActualizeHdl, INetURLObject*, pURL )
+{
+ for( long i = 0; i < 128; i++ )
+ Application::Reschedule();
+
+ Flush();
+ Sync();
+
+ if( pURL )
+ {
+ aFtActualizeFile.SetText( GetReducedString( *pURL, 30 ) );
+ aFtActualizeFile.Flush();
+ aFtActualizeFile.Sync();
+ }
+
+ return 0;
+}
+
+// ---------------
+// - TitleDialog -
+// ---------------
+
+TitleDialog::TitleDialog( Window* pParent, const String& rOldTitle ) :
+ ModalDialog ( pParent, GAL_RESID( RID_SVXDLG_GALLERY_TITLE ) ),
+ maOk ( this, GAL_RESID( BTN_OK ) ),
+ maCancel ( this, GAL_RESID( BTN_CANCEL ) ),
+ maHelp ( this, GAL_RESID( BTN_HELP ) ),
+ maFL ( this, GAL_RESID( FL_TITLE ) ),
+ maEdit ( this, GAL_RESID( EDT_TITLE ) )
+{
+ FreeResource();
+ maEdit.SetText( rOldTitle );
+ maEdit.GrabFocus();
+}
+
+// -------------------
+// - GalleryIdDialog -
+// -------------------
+
+GalleryIdDialog::GalleryIdDialog( Window* pParent, GalleryTheme* _pThm ) :
+ ModalDialog ( pParent, GAL_RESID( RID_SVXDLG_GALLERY_THEMEID ) ),
+ aBtnOk ( this, GAL_RESID( BTN_OK ) ),
+ aBtnCancel ( this, GAL_RESID( BTN_CANCEL ) ),
+ aFLId ( this, GAL_RESID( FL_ID ) ),
+ aLbResName ( this, GAL_RESID( LB_RESNAME ) ),
+ pThm ( _pThm )
+{
+ FreeResource();
+
+ aLbResName.InsertEntry( String( RTL_CONSTASCII_USTRINGPARAM( "!!! No Id !!!" ) ) );
+
+ GalleryTheme::InsertAllThemes( aLbResName );
+
+ aLbResName.SelectEntryPos( (USHORT) pThm->GetId() );
+ aLbResName.GrabFocus();
+
+ aBtnOk.SetClickHdl( LINK( this, GalleryIdDialog, ClickOkHdl ) );
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryIdDialog, ClickOkHdl, void*, EMPTYARG )
+{
+ Gallery* pGal = pThm->GetParent();
+ const ULONG nId = GetId();
+ BOOL bDifferentThemeExists = FALSE;
+
+ for( ULONG i = 0, nCount = pGal->GetThemeCount(); i < nCount && !bDifferentThemeExists; i++ )
+ {
+ const GalleryThemeEntry* pInfo = pGal->GetThemeInfo( i );
+
+ if( ( pInfo->GetId() == nId ) && ( pInfo->GetThemeName() != pThm->GetName() ) )
+ {
+ String aStr( GAL_RESID( RID_SVXSTR_GALLERY_ID_EXISTS ) );
+
+ aStr += String( RTL_CONSTASCII_USTRINGPARAM( " (" ) );
+ aStr += pInfo->GetThemeName();
+ aStr += ')';
+
+ InfoBox aBox( this, aStr );
+ aBox.Execute();
+ aLbResName.GrabFocus();
+ bDifferentThemeExists = TRUE;
+ }
+ }
+
+ if( !bDifferentThemeExists )
+ EndDialog( RET_OK );
+
+ return 0L;
+}
+
+
+// --------------------------
+// - GalleryThemeProperties -
+// --------------------------
+
+GalleryThemeProperties::GalleryThemeProperties( Window* pParent, ExchangeData* _pData, SfxItemSet* pItemSet ) :
+ SfxTabDialog ( pParent, GAL_RESID( RID_SVXTABDLG_GALLERYTHEME ), pItemSet ),
+ pData ( _pData )
+{
+ FreeResource();
+
+ AddTabPage( RID_SVXTABPAGE_GALLERY_GENERAL, TPGalleryThemeGeneral::Create, 0 );
+ AddTabPage( RID_SVXTABPAGE_GALLERYTHEME_FILES, TPGalleryThemeProperties::Create, 0 );
+
+ if( pData->pTheme->IsReadOnly() )
+ RemoveTabPage( RID_SVXTABPAGE_GALLERYTHEME_FILES );
+
+ String aText( GetText() );
+
+ aText += pData->pTheme->GetName();
+
+ if( pData->pTheme->IsReadOnly() )
+ aText += String( GAL_RESID( RID_SVXSTR_GALLERY_READONLY ) );
+
+ SetText( aText );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryThemeProperties::PageCreated( USHORT nId, SfxTabPage &rPage )
+{
+ if( RID_SVXTABPAGE_GALLERY_GENERAL == nId )
+ ( (TPGalleryThemeGeneral&) rPage ).SetXChgData( pData );
+ else
+ ( (TPGalleryThemeProperties&) rPage ).SetXChgData( pData );
+}
+
+// -------------------------
+// - TPGalleryThemeGeneral -
+// -------------------------
+
+TPGalleryThemeGeneral::TPGalleryThemeGeneral( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage ( pParent, GAL_RESID( RID_SVXTABPAGE_GALLERY_GENERAL ), rSet ),
+ aFiMSImage ( this, GAL_RESID( FI_MS_IMAGE ) ),
+ aEdtMSName ( this, GAL_RESID( EDT_MS_NAME ) ),
+ aFlMSGeneralFirst ( this, GAL_RESID( FL_MS_GENERAL_FIRST ) ),
+ aFtMSType ( this, GAL_RESID( FT_MS_TYPE ) ),
+ aFtMSShowType ( this, GAL_RESID( FT_MS_SHOW_TYPE ) ),
+ aFtMSPath ( this, GAL_RESID( FT_MS_PATH ) ),
+ aFtMSShowPath ( this, GAL_RESID( FT_MS_SHOW_PATH ) ),
+ aFtMSContent ( this, GAL_RESID( FT_MS_CONTENT ) ),
+ aFtMSShowContent ( this, GAL_RESID( FT_MS_SHOW_CONTENT ) ),
+ aFlMSGeneralSecond ( this, GAL_RESID( FL_MS_GENERAL_SECOND ) ),
+ aFtMSChangeDate ( this, GAL_RESID( FT_MS_CHANGEDATE ) ),
+ aFtMSShowChangeDate ( this, GAL_RESID( FT_MS_SHOW_CHANGEDATE ) )
+{
+ FreeResource();
+}
+
+// ------------------------------------------------------------------------
+
+void TPGalleryThemeGeneral::SetXChgData( ExchangeData* _pData )
+{
+ pData = _pData;
+
+ GalleryTheme* pThm = pData->pTheme;
+ String aOutStr( String::CreateFromInt32( pThm->GetObjectCount() ) );
+ String aObjStr( GAL_RESID( RID_SVXSTR_GALLERYPROPS_OBJECT ) );
+ String aAccess;
+ String aType( GAL_RESID( RID_SVXSTR_GALLERYPROPS_GALTHEME ) );
+ BOOL bReadOnly = pThm->IsReadOnly() && !pThm->IsImported();
+
+ aEdtMSName.SetHelpId( HID_GALLERY_EDIT_MSNAME );
+ aEdtMSName.SetText( pThm->GetName() );
+ aEdtMSName.SetReadOnly( bReadOnly );
+
+ if( bReadOnly )
+ aEdtMSName.Disable();
+ else
+ aEdtMSName.Enable();
+
+ if( pThm->IsReadOnly() )
+ aType += String( GAL_RESID( RID_SVXSTR_GALLERY_READONLY ) );
+
+ aFtMSShowType.SetText( aType );
+ aFtMSShowPath.SetText( pThm->GetSdgURL().GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) );
+
+ // Ein- oder Mehrzahl?
+ if ( 1 == pThm->GetObjectCount() )
+ aObjStr = aObjStr.GetToken( 0 );
+ else
+ aObjStr = aObjStr.GetToken( 1 );
+
+ aOutStr += ' ';
+ aOutStr += aObjStr;
+
+ aFtMSShowContent.SetText( aOutStr );
+
+ // get locale wrapper (singleton)
+ const LocaleDataWrapper& aLocaleData = SvtSysLocale().GetLocaleData();
+
+ // ChangeDate/Time
+ aAccess = aLocaleData.getDate( pData->aThemeChangeDate );
+ aAccess += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
+ aAccess += aLocaleData.getTime( pData->aThemeChangeTime );
+ aFtMSShowChangeDate.SetText( aAccess );
+
+ // Image setzen
+ USHORT nId;
+
+ if( pThm->IsImported() )
+ nId = RID_SVXBMP_THEME_IMPORTED_BIG;
+ else if( pThm->IsReadOnly() )
+ nId = RID_SVXBMP_THEME_READONLY_BIG;
+ else if( pThm->IsDefault() )
+ nId = RID_SVXBMP_THEME_DEFAULT_BIG;
+ else
+ nId = RID_SVXBMP_THEME_NORMAL_BIG;
+
+ aFiMSImage.SetImage( Image( Bitmap( GAL_RESID( nId ) ), COL_LIGHTMAGENTA ) );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL TPGalleryThemeGeneral::FillItemSet( SfxItemSet& /*rSet*/ )
+{
+ pData->aEditedTitle = aEdtMSName.GetText();
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+SfxTabPage* TPGalleryThemeGeneral::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new TPGalleryThemeGeneral( pParent, rSet );
+}
+
+// ----------------------------
+// - TPGalleryThemeProperties -
+// ----------------------------
+
+TPGalleryThemeProperties::TPGalleryThemeProperties( Window* pWindow, const SfxItemSet& rSet ) :
+ SfxTabPage ( pWindow, GAL_RESID( RID_SVXTABPAGE_GALLERYTHEME_FILES ), rSet ),
+ aBtnSearch ( this, GAL_RESID(BTN_SEARCH ) ),
+ aBtnTake ( this, GAL_RESID(BTN_TAKE ) ),
+ aBtnTakeAll ( this, GAL_RESID(BTN_TAKEALL ) ),
+ aCbxPreview ( this, GAL_RESID(CBX_PREVIEW ) ),
+ aCbbFileType ( this, GAL_RESID(CBB_FILETYPE ) ),
+ aLbxFound ( this, GAL_RESID(LBX_FOUND ) ),
+ aFtFileType ( this, GAL_RESID(FT_FILETYPE ) ),
+ aWndPreview ( this, GAL_RESID( WND_BRSPRV ) ),
+ nCurFilterPos (0),
+ nFirstExtFilterPos (0),
+ bEntriesFound (FALSE),
+ bInputAllowed (TRUE),
+ bSearchRecursive (FALSE),
+ xDialogListener ( new ::svt::DialogClosedListener() )
+{
+ FreeResource();
+
+ xDialogListener->SetDialogClosedLink( LINK( this, TPGalleryThemeProperties, DialogClosedHdl ) );
+}
+
+// ------------------------------------------------------------------------
+
+void TPGalleryThemeProperties::SetXChgData( ExchangeData* _pData )
+{
+ pData = _pData;
+
+ aPreviewTimer.SetTimeoutHdl( LINK( this, TPGalleryThemeProperties, PreviewTimerHdl ) );
+ aPreviewTimer.SetTimeout( 500 );
+ aBtnSearch.SetClickHdl(LINK(this, TPGalleryThemeProperties, ClickSearchHdl));
+ aBtnTake.SetClickHdl(LINK(this, TPGalleryThemeProperties, ClickTakeHdl));
+ aBtnTakeAll.SetClickHdl(LINK(this, TPGalleryThemeProperties, ClickTakeAllHdl));
+ aCbxPreview.SetClickHdl(LINK(this, TPGalleryThemeProperties, ClickPreviewHdl));
+ aCbbFileType.SetSelectHdl(LINK(this, TPGalleryThemeProperties, SelectFileTypeHdl));
+ aCbbFileType.EnableDDAutoWidth( sal_False );
+ aLbxFound.SetDoubleClickHdl(LINK(this, TPGalleryThemeProperties, DClickFoundHdl));
+ aLbxFound.SetSelectHdl(LINK(this, TPGalleryThemeProperties, SelectFoundHdl));
+ aLbxFound.InsertEntry(String(GAL_RESID(RID_SVXSTR_GALLERY_NOFILES)));
+ aLbxFound.Show();
+
+ FillFilterList();
+
+ aBtnTake.Enable();
+ aBtnTakeAll.Disable();
+ aCbxPreview.Disable();
+}
+
+// ------------------------------------------------------------------------
+
+void TPGalleryThemeProperties::StartSearchFiles( const String& _rFolderURL, short _nDlgResult )
+{
+ if ( RET_OK == _nDlgResult )
+ {
+ aURL = INetURLObject( _rFolderURL );
+ bSearchRecursive = sal_True; // UI choice no longer possible, windows file picker allows no user controls
+ SearchFiles();
+ }
+
+ nCurFilterPos = aCbbFileType.GetEntryPos( aCbbFileType.GetText() );
+}
+
+// ------------------------------------------------------------------------
+
+TPGalleryThemeProperties::~TPGalleryThemeProperties()
+{
+ xMediaPlayer.clear();
+ xDialogListener.clear();
+
+ for( String* pStr = aFoundList.First(); pStr; pStr = aFoundList.Next() )
+ delete pStr;
+
+ for( void* pEntry = aFilterEntryList.First(); pEntry; pEntry = aFilterEntryList.Next() )
+ delete (FilterEntry*) pEntry;
+}
+
+// ------------------------------------------------------------------------
+
+SfxTabPage* TPGalleryThemeProperties::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new TPGalleryThemeProperties( pParent, rSet );
+}
+
+// ------------------------------------------------------------------------
+
+::rtl::OUString TPGalleryThemeProperties::addExtension( const ::rtl::OUString& _rDisplayText, const ::rtl::OUString& _rExtension )
+{
+ ::rtl::OUString sAllFilter( RTL_CONSTASCII_USTRINGPARAM( "(*.*)" ) );
+ ::rtl::OUString sOpenBracket( RTL_CONSTASCII_USTRINGPARAM( " (" ) );
+ ::rtl::OUString sCloseBracket( RTL_CONSTASCII_USTRINGPARAM( ")" ) );
+ ::rtl::OUString sRet = _rDisplayText;
+
+ if ( sRet.indexOf( sAllFilter ) == -1 )
+ {
+ String sExt = _rExtension;
+ sRet += sOpenBracket;
+ sRet += sExt;
+ sRet += sCloseBracket;
+ }
+ return sRet;
+}
+
+// ------------------------------------------------------------------------
+
+void TPGalleryThemeProperties::FillFilterList()
+{
+ GraphicFilter* pFilter = GetGrfFilter();
+ String aExt;
+ String aName;
+ FilterEntry* pFilterEntry;
+ FilterEntry* pTestEntry;
+ sal_uInt16 i, nKeyCount;
+ BOOL bInList;
+
+ // graphic filters
+ for( i = 0, nKeyCount = pFilter->GetImportFormatCount(); i < nKeyCount; i++ )
+ {
+ aExt = pFilter->GetImportFormatShortName( i );
+ aName = pFilter->GetImportFormatName( i );
+ pTestEntry = (FilterEntry*) aFilterEntryList.First();
+ bInList = FALSE;
+
+ String aExtensions;
+ int j = 0;
+ String sWildcard;
+ while( TRUE )
+ {
+ sWildcard = pFilter->GetImportWildcard( i, j++ );
+ if ( !sWildcard.Len() )
+ break;
+ if ( aExtensions.Search( sWildcard ) == STRING_NOTFOUND )
+ {
+ if ( aExtensions.Len() )
+ aExtensions += sal_Unicode(';');
+ aExtensions += sWildcard;
+ }
+ }
+ aName = addExtension( aName, aExtensions );
+
+ while( pTestEntry )
+ {
+ if ( pTestEntry->aFilterName == aExt )
+ {
+ bInList = TRUE;
+ break;
+ }
+ pTestEntry = (FilterEntry*) aFilterEntryList.Next();
+ }
+ if ( !bInList )
+ {
+ pFilterEntry = new FilterEntry;
+ pFilterEntry->aFilterName = aExt;
+ aFilterEntryList.Insert( pFilterEntry, aCbbFileType.InsertEntry( aName ) );
+ }
+ }
+
+ // media filters
+ static const ::rtl::OUString aWildcard( RTL_CONSTASCII_USTRINGPARAM( "*." ) );
+ ::avmedia::FilterNameVector aFilters;
+ const ::rtl::OUString aSeparator( RTL_CONSTASCII_USTRINGPARAM( ";" ) );
+ ::rtl::OUString aAllTypes;
+
+ ::avmedia::MediaWindow::getMediaFilters( aFilters );
+
+ for( unsigned long l = 0; l < aFilters.size(); ++l )
+ {
+ for( sal_Int32 nIndex = 0; nIndex >= 0; )
+ {
+ ::rtl::OUString aFilterWildcard( aWildcard );
+
+ pFilterEntry = new FilterEntry;
+ pFilterEntry->aFilterName = aFilters[ l ].second.getToken( 0, ';', nIndex );
+ nFirstExtFilterPos = aCbbFileType.InsertEntry( addExtension( aFilters[ l ].first,
+ aFilterWildcard += pFilterEntry->aFilterName ) );
+ aFilterEntryList.Insert( pFilterEntry, nFirstExtFilterPos );
+ }
+ }
+
+ // 'All' filters
+ String aExtensions;
+
+ // graphic filters
+ for ( i = 0; i < nKeyCount; ++i )
+ {
+ int j = 0;
+ String sWildcard;
+ while( TRUE )
+ {
+ sWildcard = pFilter->GetImportWildcard( i, j++ );
+ if ( !sWildcard.Len() )
+ break;
+ if ( aExtensions.Search( sWildcard ) == STRING_NOTFOUND )
+ {
+ if ( aExtensions.Len() )
+ aExtensions += sal_Unicode( ';' );
+
+ aExtensions += sWildcard;
+ }
+ }
+ }
+
+ // media filters
+ for( unsigned long k = 0; k < aFilters.size(); ++k )
+ {
+ for( sal_Int32 nIndex = 0; nIndex >= 0; )
+ {
+ if ( aExtensions.Len() )
+ aExtensions += sal_Unicode( ';' );
+ ( aExtensions += String( aWildcard ) ) += String( aFilters[ k ].second.getToken( 0, ';', nIndex ) );
+ }
+ }
+
+#if defined(WIN) || defined(WNT)
+ if ( aExtensions.Len() > 240 )
+ aExtensions = DEFINE_CONST_UNICODE( "*.*" );
+#endif
+
+ pFilterEntry = new FilterEntry;
+ pFilterEntry->aFilterName = String( GAL_RESID( RID_SVXSTR_GALLERY_ALLFILES ) );
+ pFilterEntry->aFilterName = addExtension( pFilterEntry->aFilterName, aExtensions );
+ aFilterEntryList.Insert(pFilterEntry, aCbbFileType. InsertEntry( pFilterEntry->aFilterName, 0 ) );
+
+ aCbbFileType.SetText( pFilterEntry->aFilterName );
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, SelectFileTypeHdl, void *, EMPTYARG )
+{
+ String aText( aCbbFileType.GetText() );
+
+ if( bInputAllowed && ( aLastFilterName != aText ) )
+ {
+ aLastFilterName = aText;
+
+ if( QueryBox( this, WB_YES_NO, String( GAL_RESID( RID_SVXSTR_GALLERY_SEARCH ) ) ).Execute() == RET_YES )
+ SearchFiles();
+ }
+
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+void TPGalleryThemeProperties::SearchFiles()
+{
+ SearchProgress* pProgress = new SearchProgress( this, aURL );
+
+ for( String* pStr = aFoundList.First(); pStr; pStr = aFoundList.Next() )
+ delete pStr;
+
+ aFoundList.Clear();
+ aLbxFound.Clear();
+
+ pProgress->SetFileType( aCbbFileType.GetText() );
+ pProgress->SetDirectory( rtl::OUString() );
+ pProgress->Update();
+
+ pProgress->StartExecuteModal( LINK( this, TPGalleryThemeProperties, EndSearchProgressHdl ) );
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, ClickCloseBrowserHdl, void *, EMPTYARG )
+{
+ if( bInputAllowed )
+ aPreviewTimer.Stop();
+
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, ClickSearchHdl, void *, EMPTYARG )
+{
+ if( bInputAllowed )
+ {
+ try
+ {
+ // setup folder picker
+ ::com::sun::star::uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if( xMgr.is() )
+ {
+ xFolderPicker = ::com::sun::star::uno::Reference< XFolderPicker >(
+ xMgr->createInstance( OUString::createFromAscii( "com.sun.star.ui.dialogs.FolderPicker" )), UNO_QUERY );
+
+ if ( xFolderPicker.is() )
+ {
+// svt::SetDialogHelpId( xFolderPicker, HID_GALLERY_NEWTHEME_FINDFILES );
+ String aDlgPathName( SvtPathOptions().GetGraphicPath() );
+ xFolderPicker->setDisplayDirectory(aDlgPathName);
+
+ aPreviewTimer.Stop();
+
+ ::com::sun::star::uno::Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
+ if ( xAsyncDlg.is() )
+ xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ else
+ {
+ if( xFolderPicker->execute() == RET_OK )
+ {
+ aURL = INetURLObject( xFolderPicker->getDirectory() );
+ bSearchRecursive = sal_True; // UI choice no longer possible, windows file picker allows no user controls
+ SearchFiles();
+ }
+
+ nCurFilterPos = aCbbFileType.GetEntryPos( aCbbFileType.GetText() );
+ }
+ }
+ }
+ }
+ catch(IllegalArgumentException)
+ {
+#ifdef DBG_UTIL
+ DBG_ERROR( "Folder picker failed with illegal arguments" );
+#endif
+ }
+ }
+
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+void TPGalleryThemeProperties::TakeFiles()
+{
+ if( aLbxFound.GetSelectEntryCount() || ( bTakeAll && bEntriesFound ) )
+ {
+ TakeProgress* pTakeProgress = new TakeProgress( this );
+ pTakeProgress->Update();
+
+ pTakeProgress->StartExecuteModal(
+ Link() /* no postprocessing needed, pTakeProgress
+ will be deleted in TakeProgress::CleanupHdl */ );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, ClickPreviewHdl, void *, EMPTYARG )
+{
+ if ( bInputAllowed )
+ {
+ aPreviewTimer.Stop();
+ aPreviewString.Erase();
+
+ if( !aCbxPreview.IsChecked() )
+ {
+ xMediaPlayer.clear();
+ aWndPreview.SetGraphic( Graphic() );
+ aWndPreview.Invalidate();
+ }
+ else
+ DoPreview();
+ }
+
+ return 0;
+}
+
+// ------------------------------------------------------------------------
+
+void TPGalleryThemeProperties::DoPreview()
+{
+ String aString( aLbxFound.GetSelectEntry() );
+
+ if( aString != aPreviewString )
+ {
+ INetURLObject _aURL( *aFoundList.GetObject( aLbxFound.GetEntryPos( aString ) ) );
+ bInputAllowed = FALSE;
+
+ if ( !aWndPreview.SetGraphic( _aURL ) )
+ {
+ GetParent()->LeaveWait();
+ ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTSPATH );
+ GetParent()->EnterWait();
+ }
+ else if( ::avmedia::MediaWindow::isMediaURL( _aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) )
+ {
+ xMediaPlayer = ::avmedia::MediaWindow::createPlayer( _aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ if( xMediaPlayer.is() )
+ xMediaPlayer->start();
+ }
+
+ bInputAllowed = TRUE;
+ aPreviewString = aString;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, ClickTakeHdl, void*, EMPTYARG )
+{
+ if( bInputAllowed )
+ {
+ aPreviewTimer.Stop();
+
+ if( !aLbxFound.GetSelectEntryCount() || !bEntriesFound )
+ {
+ SvxOpenGraphicDialog aDlg(String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) ) );
+// aDlg.SetDialogHelpId( HID_GALLERY_NEWTHEME_ADDFILES );
+ aDlg.EnableLink(sal_False);
+ aDlg.AsLink(sal_False);
+
+ if( !aDlg.Execute() )
+ pData->pTheme->InsertURL( INetURLObject( aDlg.GetPath() ) );
+ }
+ else
+ {
+ bTakeAll = FALSE;
+ TakeFiles();
+ }
+ }
+
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, ClickTakeAllHdl, void *, EMPTYARG )
+{
+ if( bInputAllowed )
+ {
+ aPreviewTimer.Stop();
+ bTakeAll = TRUE;
+ TakeFiles();
+ }
+
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, SelectFoundHdl, void *, EMPTYARG )
+{
+ if( bInputAllowed )
+ {
+ BOOL bPreviewPossible = FALSE;
+
+ aPreviewTimer.Stop();
+
+ if( bEntriesFound )
+ {
+ if( aLbxFound.GetSelectEntryCount() == 1 )
+ {
+ aCbxPreview.Enable();
+ bPreviewPossible = TRUE;
+ }
+ else
+ aCbxPreview.Disable();
+
+ if( aFoundList.Count() )
+ aBtnTakeAll.Enable();
+ else
+ aBtnTakeAll.Disable();
+ }
+
+ if( bPreviewPossible && aCbxPreview.IsChecked() )
+ aPreviewTimer.Start();
+ }
+
+ return 0;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, DClickFoundHdl, void *, EMPTYARG )
+{
+ if( bInputAllowed )
+ {
+ aPreviewTimer.Stop();
+
+ return (aLbxFound.GetSelectEntryCount() == 1 && bEntriesFound) ?
+ ClickTakeHdl(NULL) : 0;
+ }
+ else
+ return 0;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, PreviewTimerHdl, void *, EMPTYARG )
+{
+ aPreviewTimer.Stop();
+ DoPreview();
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, EndSearchProgressHdl, SearchProgress *, EMPTYARG )
+{
+ if( aFoundList.Count() )
+ {
+ aLbxFound.SelectEntryPos( 0 );
+ aBtnTakeAll.Enable();
+ aCbxPreview.Enable();
+ bEntriesFound = TRUE;
+ }
+ else
+ {
+ aLbxFound.InsertEntry( String( GAL_RESID( RID_SVXSTR_GALLERY_NOFILES ) ) );
+ aBtnTakeAll.Disable();
+ aCbxPreview.Disable();
+ bEntriesFound = FALSE;
+ }
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent*, pEvt )
+{
+ DBG_ASSERT( xFolderPicker.is() == sal_True, "TPGalleryThemeProperties::DialogClosedHdl(): no folder picker" );
+
+ String sURL = String( xFolderPicker->getDirectory() );
+ StartSearchFiles( sURL, pEvt->DialogResult );
+
+ return 0L;
+}
+
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx
new file mode 100644
index 000000000000..60e4d4af86b5
--- /dev/null
+++ b/cui/source/dialogs/cuigrfflt.cxx
@@ -0,0 +1,758 @@
+/*************************************************************************
+ *
+ * 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: cuigrfflt.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <tools/shl.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/request.hxx>
+#include <svx/dialmgr.hxx>
+#include "cuigrfflt.hxx"
+#include "grfflt.hrc"
+#include <svx/dialogs.hrc>
+
+// --------------------
+// - SvxGraphicFilter -
+// --------------------
+/*
+ULONG SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObject& rFilterObject )
+{
+ const Graphic& rGraphic = rFilterObject.GetGraphic();
+ ULONG nRet;
+
+ if( rGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ SfxObjectShell* pShell = pViewFrame ? pViewFrame->GetObjectShell() : NULL;
+ Window* pWindow = ( pViewFrame && pViewFrame->GetViewShell() ) ? pViewFrame->GetViewShell()->GetWindow() : NULL;
+ Graphic aGraphic;
+
+ switch( rReq.GetSlot() )
+ {
+ case( SID_GRFFILTER_INVERT ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( TRUE );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Invert() )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Invert() )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( FALSE );
+ }
+ break;
+
+ case( SID_GRFFILTER_SMOOTH ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( TRUE );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_SMOOTH ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SMOOTH ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( FALSE );
+ }
+ break;
+
+ case( SID_GRFFILTER_SHARPEN ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( TRUE );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_SHARPEN ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SHARPEN ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( FALSE );
+ }
+ break;
+
+ case( SID_GRFFILTER_REMOVENOISE ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( TRUE );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_REMOVENOISE ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_REMOVENOISE ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( FALSE );
+ }
+ break;
+
+ case( SID_GRFFILTER_SOBEL ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( TRUE );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_SOBEL_GREY ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SOBEL_GREY ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( FALSE );
+ }
+ break;
+
+ case( SID_GRFFILTER_MOSAIC ):
+ {
+ GraphicFilterMosaic aDlg( pWindow, rGraphic, 4, 4, FALSE );
+
+ if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ }
+ break;
+
+ case( SID_GRFFILTER_EMBOSS ):
+ {
+ GraphicFilterEmboss aDlg( pWindow, rGraphic, RP_MM );
+
+ if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ }
+ break;
+
+ case( SID_GRFFILTER_POSTER ):
+ {
+ GraphicFilterPoster aDlg( pWindow, rGraphic, 16 );
+
+ if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ }
+ break;
+
+ case( SID_GRFFILTER_POPART ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( TRUE );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_POPART ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_POPART ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( FALSE );
+ }
+ break;
+
+ case( SID_GRFFILTER_SEPIA ):
+ {
+ GraphicFilterSepia aDlg( pWindow, rGraphic, 10 );
+
+ if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ }
+ break;
+
+ case( SID_GRFFILTER_SOLARIZE ):
+ {
+ GraphicFilterSolarize aDlg( pWindow, rGraphic, 128, FALSE );
+
+ if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ }
+ break;
+
+ default:
+ {
+ DBG_ERROR( "SvxGraphicFilter: selected filter slot not yet implemented" );
+ nRet = SVX_GRAPHICFILTER_UNSUPPORTED_SLOT;
+ }
+ break;
+ }
+
+ if( aGraphic.GetType() != GRAPHIC_NONE )
+ {
+ rFilterObject.SetGraphic( aGraphic );
+ nRet = SVX_GRAPHICFILTER_ERRCODE_NONE;
+ }
+ }
+ else
+ nRet = SVX_GRAPHICFILTER_UNSUPPORTED_GRAPHICTYPE;
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SvxGraphicFilter::DisableGraphicFilterSlots( SfxItemSet& rSet )
+{
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER ) )
+ rSet.DisableItem( SID_GRFFILTER );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_INVERT ) )
+ rSet.DisableItem( SID_GRFFILTER_INVERT );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SMOOTH ) )
+ rSet.DisableItem( SID_GRFFILTER_SMOOTH );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SHARPEN ) )
+ rSet.DisableItem( SID_GRFFILTER_SHARPEN );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_REMOVENOISE ) )
+ rSet.DisableItem( SID_GRFFILTER_REMOVENOISE );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SOBEL ) )
+ rSet.DisableItem( SID_GRFFILTER_SOBEL );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_MOSAIC ) )
+ rSet.DisableItem( SID_GRFFILTER_MOSAIC );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_EMBOSS ) )
+ rSet.DisableItem( SID_GRFFILTER_EMBOSS );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_POSTER ) )
+ rSet.DisableItem( SID_GRFFILTER_POSTER );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_POPART ) )
+ rSet.DisableItem( SID_GRFFILTER_POPART );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SEPIA ) )
+ rSet.DisableItem( SID_GRFFILTER_SEPIA );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SOLARIZE ) )
+ rSet.DisableItem( SID_GRFFILTER_SOLARIZE );
+};
+*/
+// --------------------------------------
+// - GraphicFilterDialog::PreviewWindow -
+// --------------------------------------
+
+GraphicFilterDialog::PreviewWindow::PreviewWindow( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterDialog::PreviewWindow::~PreviewWindow()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void GraphicFilterDialog::PreviewWindow::Paint( const Rectangle& rRect )
+{
+ Control::Paint( rRect );
+
+ const Size aGrfSize( LogicToPixel( maGraphic.GetPrefSize(), maGraphic.GetPrefMapMode() ) );
+ const Size aOutSize( GetOutputSizePixel() );
+ const Point aGrfPos( ( aOutSize.Width() - aGrfSize.Width() ) >> 1,
+ ( aOutSize.Height() - aGrfSize.Height() ) >> 1 );
+
+ if( maGraphic.IsAnimated() )
+ maGraphic.StartAnimation( this , aGrfPos, aGrfSize );
+ else
+ maGraphic.Draw( this, aGrfPos, aGrfSize );
+}
+
+// -----------------------------------------------------------------------------
+
+void GraphicFilterDialog::PreviewWindow::SetGraphic( const Graphic& rGraphic )
+{
+ maGraphic = rGraphic;
+
+ if( maGraphic.IsAnimated() || maGraphic.IsTransparent() )
+ Invalidate();
+ else
+ Paint( Rectangle( Point(), GetOutputSizePixel() ) );
+}
+
+// -----------------------
+// - GraphicFilterDialog -
+// -----------------------
+
+GraphicFilterDialog::GraphicFilterDialog( Window* pParent, const ResId& rResId, const Graphic& rGraphic ) :
+ ModalDialog ( pParent, rResId ),
+ maModifyHdl ( LINK( this, GraphicFilterDialog, ImplModifyHdl ) ),
+ mfScaleX ( 0.0 ),
+ mfScaleY ( 0.0 ),
+ maSizePixel ( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) ),
+ maPreview ( this, SVX_RES( CTL_PREVIEW ) ),
+ maFlParameter ( this, SVX_RES( FL_PARAMETER ) ),
+ maBtnOK ( this, SVX_RES( BTN_OK ) ),
+ maBtnCancel ( this, SVX_RES( BTN_CANCEL ) ),
+ maBtnHelp ( this, SVX_RES( BTN_HELP ) )
+{
+ const Size aPreviewSize( maPreview.GetOutputSizePixel() );
+ Size aGrfSize( maSizePixel );
+
+ if( rGraphic.GetType() == GRAPHIC_BITMAP &&
+ aPreviewSize.Width() && aPreviewSize.Height() &&
+ aGrfSize.Width() && aGrfSize.Height() )
+ {
+ const double fGrfWH = (double) aGrfSize.Width() / aGrfSize.Height();
+ const double fPreWH = (double) aPreviewSize.Width() / aPreviewSize.Height();
+
+ if( fGrfWH < fPreWH )
+ {
+ aGrfSize.Width() = (long) ( aPreviewSize.Height() * fGrfWH );
+ aGrfSize.Height()= aPreviewSize.Height();
+ }
+ else
+ {
+ aGrfSize.Width() = aPreviewSize.Width();
+ aGrfSize.Height()= (long) ( aPreviewSize.Width() / fGrfWH);
+ }
+
+ mfScaleX = (double) aGrfSize.Width() / maSizePixel.Width();
+ mfScaleY = (double) aGrfSize.Height() / maSizePixel.Height();
+
+ if( !rGraphic.IsAnimated() )
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Scale( aGrfSize, BMP_SCALE_INTERPOLATE ) )
+ maGraphic = aBmpEx;
+ }
+ }
+
+ maTimer.SetTimeoutHdl( LINK( this, GraphicFilterDialog, ImplPreviewTimeoutHdl ) );
+ maTimer.SetTimeout( 100 );
+ ImplModifyHdl( NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterDialog::~GraphicFilterDialog()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GraphicFilterDialog, ImplPreviewTimeoutHdl, Timer*, EMPTYARG )
+{
+ maTimer.Stop();
+ maPreview.SetGraphic( GetFilteredGraphic( maGraphic, mfScaleX, mfScaleY ) );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GraphicFilterDialog, ImplModifyHdl, void*, EMPTYARG )
+{
+ if( maGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ maTimer.Stop();
+ maTimer.Start();
+ }
+
+ return 0;
+}
+
+// ----------------
+// - FilterMosaic -
+// ----------------
+
+GraphicFilterMosaic::GraphicFilterMosaic( Window* pParent, const Graphic& rGraphic,
+ USHORT nTileWidth, USHORT nTileHeight, BOOL bEnhanceEdges ) :
+ GraphicFilterDialog( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_MOSAIC ), rGraphic ),
+ maFtWidth ( this, SVX_RES( DLG_FILTERMOSAIC_FT_WIDTH ) ),
+ maMtrWidth ( this, SVX_RES( DLG_FILTERMOSAIC_MTR_WIDTH ) ),
+ maFtHeight ( this, SVX_RES( DLG_FILTERMOSAIC_FT_HEIGHT ) ),
+ maMtrHeight ( this, SVX_RES( DLG_FILTERMOSAIC_MTR_HEIGHT ) ),
+ maCbxEdges ( this, SVX_RES( DLG_FILTERMOSAIC_CBX_EDGES ) )
+{
+ FreeResource();
+
+ maMtrWidth.SetValue( nTileWidth );
+ maMtrWidth.SetLast( GetGraphicSizePixel().Width() );
+ maMtrWidth.SetModifyHdl( GetModifyHdl() );
+
+ maMtrHeight.SetValue( nTileHeight );
+ maMtrHeight.SetLast( GetGraphicSizePixel().Height() );
+ maMtrHeight.SetModifyHdl( GetModifyHdl() );
+
+ maCbxEdges.Check( bEnhanceEdges );
+ maCbxEdges.SetToggleHdl( GetModifyHdl() );
+
+ maMtrWidth.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterMosaic::~GraphicFilterMosaic()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic,
+ double fScaleX, double fScaleY )
+{
+ Graphic aRet;
+ const Size aSize( Max( FRound( GetTileWidth() * fScaleX ), 1L ),
+ Max( FRound( GetTileHeight() * fScaleY ), 1L ) );
+ BmpFilterParam aParam( aSize );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.Filter( BMP_FILTER_MOSAIC, &aParam ) )
+ {
+ if( IsEnhanceEdges() )
+ aAnim.Filter( BMP_FILTER_SHARPEN );
+
+ aRet = aAnim;
+ }
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_MOSAIC, &aParam ) )
+ {
+ if( IsEnhanceEdges() )
+ aBmpEx.Filter( BMP_FILTER_SHARPEN );
+
+ aRet = aBmpEx;
+ }
+ }
+
+ return aRet;
+}
+
+// ------------------
+// - GraphicFilterSolarize -
+// ------------------
+
+GraphicFilterSolarize::GraphicFilterSolarize( Window* pParent, const Graphic& rGraphic,
+ BYTE cGreyThreshold, BOOL bInvert ) :
+ GraphicFilterDialog ( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_SOLARIZE ), rGraphic ),
+ maFtThreshold ( this, SVX_RES( DLG_FILTERSOLARIZE_FT_THRESHOLD ) ),
+ maMtrThreshold ( this, SVX_RES( DLG_FILTERSOLARIZE_MTR_THRESHOLD ) ),
+ maCbxInvert ( this, SVX_RES( DLG_FILTERSOLARIZE_CBX_INVERT ) )
+{
+ FreeResource();
+
+ maMtrThreshold.SetValue( FRound( cGreyThreshold / 2.55 ) );
+ maMtrThreshold.SetModifyHdl( GetModifyHdl() );
+
+ maCbxInvert.Check( bInvert );
+ maCbxInvert.SetToggleHdl( GetModifyHdl() );
+
+ maMtrThreshold.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterSolarize::~GraphicFilterSolarize()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterSolarize::GetFilteredGraphic( const Graphic& rGraphic,
+ double /*fScaleX*/, double /*fScaleY*/ )
+{
+ Graphic aRet;
+ BmpFilterParam aParam( GetGreyThreshold() );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.Filter( BMP_FILTER_SOLARIZE, &aParam ) )
+ {
+ if( IsInvert() )
+ aAnim.Invert();
+
+ aRet = aAnim;
+ }
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SOLARIZE, &aParam ) )
+ {
+ if( IsInvert() )
+ aBmpEx.Invert();
+
+ aRet = aBmpEx;
+ }
+ }
+
+ return aRet;
+}
+
+// ----------------------
+// - GraphicFilterSepia -
+// ----------------------
+
+GraphicFilterSepia::GraphicFilterSepia( Window* pParent, const Graphic& rGraphic,
+ USHORT nSepiaPercent ) :
+ GraphicFilterDialog ( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_SEPIA ), rGraphic ),
+ maFtSepia ( this, SVX_RES( DLG_FILTERSEPIA_FT_SEPIA ) ),
+ maMtrSepia ( this, SVX_RES( DLG_FILTERSEPIA_MTR_SEPIA ) )
+{
+ FreeResource();
+
+ maMtrSepia.SetValue( nSepiaPercent );
+ maMtrSepia.SetModifyHdl( GetModifyHdl() );
+
+ maMtrSepia.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterSepia::~GraphicFilterSepia()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterSepia::GetFilteredGraphic( const Graphic& rGraphic,
+ double /*fScaleX*/, double /*fScaleY*/ )
+{
+ Graphic aRet;
+ BmpFilterParam aParam( GetSepiaPercent() );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.Filter( BMP_FILTER_SEPIA, &aParam ) )
+ aRet = aAnim;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SEPIA, &aParam ) )
+ aRet = aBmpEx;
+ }
+
+ return aRet;
+}
+
+// -----------------------
+// - GraphicFilterPoster -
+// -----------------------
+
+GraphicFilterPoster::GraphicFilterPoster( Window* pParent, const Graphic& rGraphic,
+ USHORT nPosterCount ) :
+ GraphicFilterDialog ( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_POSTER ), rGraphic ),
+ maFtPoster ( this, SVX_RES( DLG_FILTERPOSTER_FT_POSTER ) ),
+ maNumPoster ( this, SVX_RES( DLG_FILTERPOSTER_NUM_POSTER ) )
+{
+ FreeResource();
+
+ maNumPoster.SetFirst( 2 );
+ maNumPoster.SetLast( rGraphic.GetBitmapEx().GetBitCount() );
+ maNumPoster.SetValue( nPosterCount );
+ maNumPoster.SetModifyHdl( GetModifyHdl() );
+ maNumPoster.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterPoster::~GraphicFilterPoster()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterPoster::GetFilteredGraphic( const Graphic& rGraphic,
+ double /*fScaleX*/, double /*fScaleY*/ )
+{
+ Graphic aRet;
+ const USHORT nPosterCount = GetPosterColorCount();
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.ReduceColors( nPosterCount, BMP_REDUCE_POPULAR ) )
+ aRet = aAnim;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.ReduceColors( nPosterCount, BMP_REDUCE_POPULAR ) )
+ aRet = aBmpEx;
+ }
+
+ return aRet;
+}
+
+// -----------------------
+// - GraphicFilterEmboss -
+// -----------------------
+
+void GraphicFilterEmboss::EmbossControl::MouseButtonDown( const MouseEvent& rEvt )
+{
+ const RECT_POINT eOldRP = GetActualRP();
+
+ SvxRectCtl::MouseButtonDown( rEvt );
+
+ if( GetActualRP() != eOldRP )
+ maModifyHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterEmboss::GraphicFilterEmboss( Window* pParent, const Graphic& rGraphic,
+ RECT_POINT eLightSource ) :
+ GraphicFilterDialog ( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_EMBOSS ), rGraphic ),
+ maFtLight ( this, SVX_RES( DLG_FILTEREMBOSS_FT_LIGHT ) ),
+ maCtlLight ( this, SVX_RES( DLG_FILTEREMBOSS_CTL_LIGHT ), eLightSource )
+{
+ FreeResource();
+
+ maCtlLight.SetModifyHdl( GetModifyHdl() );
+ maCtlLight.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterEmboss::~GraphicFilterEmboss()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterEmboss::GetFilteredGraphic( const Graphic& rGraphic,
+ double /*fScaleX*/, double /*fScaleY*/ )
+{
+ Graphic aRet;
+ USHORT nAzim, nElev;
+
+ switch( maCtlLight.GetActualRP() )
+ {
+ default: DBG_ERROR("svx::GraphicFilterEmboss::GetFilteredGraphic(), unknown Reference Point!" );
+ case( RP_LT ): nAzim = 4500, nElev = 4500; break;
+ case( RP_MT ): nAzim = 9000, nElev = 4500; break;
+ case( RP_RT ): nAzim = 13500, nElev = 4500; break;
+ case( RP_LM ): nAzim = 0, nElev = 4500; break;
+ case( RP_MM ): nAzim = 0, nElev = 9000; break;
+ case( RP_RM ): nAzim = 18000, nElev = 4500; break;
+ case( RP_LB ): nAzim = 31500, nElev = 4500; break;
+ case( RP_MB ): nAzim = 27000, nElev = 4500; break;
+ case( RP_RB ): nAzim = 22500, nElev = 4500; break;
+ }
+
+ BmpFilterParam aParam( nAzim, nElev );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.Filter( BMP_FILTER_EMBOSS_GREY, &aParam ) )
+ aRet = aAnim;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_EMBOSS_GREY, &aParam ) )
+ aRet = aBmpEx;
+ }
+
+ return aRet;
+}
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
new file mode 100644
index 000000000000..b3ed7397799a
--- /dev/null
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -0,0 +1,416 @@
+/*************************************************************************
+ *
+ * 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: cuihyperdlg.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <vcl/settings.hxx>
+#include <unotools/viewoptions.hxx>
+#include "cuihyperdlg.hxx"
+#include "hlinettp.hxx"
+#include "hlmailtp.hxx"
+#include "hldoctp.hxx"
+#include "hldocntp.hxx"
+#include "hyperdlg.hrc"
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::frame::XFrame;
+
+//########################################################################
+//# #
+//# Childwindow-Wrapper-Class #
+//# #
+//########################################################################
+
+SvxHlinkCtrl::SvxHlinkCtrl( USHORT _nId, SfxBindings & rBindings, SvxHpLinkDlg* pDlg )
+: SfxControllerItem ( _nId, rBindings )
+ ,aOnlineForwarder ( SID_INTERNET_ONLINE , *this )
+ ,aRdOnlyForwarder ( SID_READONLY_MODE, *this )
+{
+ pParent = pDlg;
+}
+
+void SvxHlinkCtrl::StateChanged( USHORT nSID, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ if ( eState == SFX_ITEM_AVAILABLE )
+ {
+ switch ( nSID )
+ {
+ case SID_INTERNET_ONLINE :
+ {
+ pParent->EnableInetBrowse( !( (SfxBoolItem*)pState)->GetValue() );
+ }
+ break;
+ case SID_HYPERLINK_GETLINK :
+ {
+ pParent->SetPage ( (SvxHyperlinkItem*)pState);
+ }
+ break;
+ case SID_READONLY_MODE :
+ {
+ pParent->SetReadOnlyMode( ( (SfxBoolItem*)pState)->GetValue() == TRUE );
+ }
+ break;
+ }
+ }
+}
+
+
+
+// -----------------------------------------------------------------------
+
+
+
+//########################################################################
+//# #
+//# Hyperlink - Dialog #
+//# #
+//########################################################################
+
+/*************************************************************************
+|*
+|* Contructor / Destructor
+|*
+|************************************************************************/
+
+SvxHpLinkDlg::SvxHpLinkDlg (Window* pParent, SfxBindings* pBindings)
+: IconChoiceDialog( pParent, SVX_RES ( RID_SVXDLG_NEWHYPERLINK ) ),
+ maCtrl ( SID_HYPERLINK_GETLINK, *pBindings, this ),
+ mpBindings ( pBindings ),
+ mbReadOnly ( sal_False ),
+ mbIsHTMLDoc ( sal_False )
+{
+ mbGrabFocus = sal_True;
+ // insert pages
+ Image aImage;
+ Image aImageHC;
+ String aStrTitle;
+ SvxIconChoiceCtrlEntry* pEntry = NULL;
+
+ aStrTitle = SVX_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP );
+ aImage = Image( SVX_RES ( RID_SVXBMP_HLINETTP ) );
+ aImageHC = Image( SVX_RES ( RID_SVXBMP_HLINETTP_H ) );
+ pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_INTERNET, aStrTitle, aImage, aImageHC, SvxHyperlinkInternetTp::Create );
+ pEntry->SetQuickHelpText( SVX_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP_HELP ) );
+ aStrTitle = SVX_RESSTR( RID_SVXSTR_HYPERDLG_HLMAILTP );
+ aImage = Image( SVX_RES ( RID_SVXBMP_HLMAILTP ) );
+ aImageHC = Image( SVX_RES ( RID_SVXBMP_HLMAILTP_H ) );
+ pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_MAIL, aStrTitle, aImage, aImageHC, SvxHyperlinkMailTp::Create );
+ pEntry->SetQuickHelpText( SVX_RESSTR( RID_SVXSTR_HYPERDLG_HLMAILTP_HELP ) );
+ aStrTitle = SVX_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCTP );
+ aImage = Image( SVX_RES ( RID_SVXBMP_HLDOCTP ) );
+ aImageHC = Image( SVX_RES ( RID_SVXBMP_HLDOCTP_H ) );
+ pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_DOCUMENT, aStrTitle, aImage, aImageHC, SvxHyperlinkDocTp::Create );
+ pEntry->SetQuickHelpText( SVX_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCTP_HELP ) );
+ aStrTitle = SVX_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCNTP );
+ aImage = Image( SVX_RES ( RID_SVXBMP_HLDOCNTP ) );
+ aImageHC = Image( SVX_RES ( RID_SVXBMP_HLDOCNTP_H ) );
+ pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_NEWDOCUMENT, aStrTitle, aImage, aImageHC, SvxHyperlinkNewDocTp::Create );
+ pEntry->SetQuickHelpText( SVX_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP ) );
+
+ // all tab pages set -> create mnemonics
+ // CreateIconTextAutoMnemonics(); #99671# not useful, because this is not what user expects when using mnemonics on the pages
+
+ // create itemset for tabpages
+ mpItemSet = new SfxItemSet( SFX_APP()->GetPool(), SID_HYPERLINK_GETLINK,
+ SID_HYPERLINK_SETLINK );
+
+ SvxHyperlinkItem aItem;
+ mpItemSet->Put (aItem, SID_HYPERLINK_GETLINK);
+
+ SetInputSet (mpItemSet);
+
+ // Init Dialog
+ Start (FALSE);
+
+ pBindings->Update( SID_READONLY_MODE );
+
+ // set OK/Cancel - button
+ GetOKButton().SetText ( SVX_RESSTR(RID_SVXSTR_HYPDLG_APPLYBUT) );
+ GetCancelButton().SetText ( SVX_RESSTR(RID_SVXSTR_HYPDLG_CLOSEBUT) );
+
+ GetOKButton().SetClickHdl ( LINK ( this, SvxHpLinkDlg, ClickApplyHdl_Impl ) );
+ GetCancelButton().SetClickHdl( LINK ( this, SvxHpLinkDlg, ClickCloseHdl_Impl ) );
+}
+
+SvxHpLinkDlg::~SvxHpLinkDlg ()
+{
+ // delete config item, so the base class (IconChoiceDialog) can not load it on the next start
+ SvtViewOptions aViewOpt( E_TABDIALOG, String::CreateFromInt32( SID_HYPERLINK_DIALOG ) );
+ aViewOpt.Delete();
+
+ delete mpItemSet;
+}
+
+/*************************************************************************
+|*
+|* Close Dialog-Window
+|*
+|************************************************************************/
+
+BOOL SvxHpLinkDlg::Close()
+{
+ GetDispatcher()->Execute( SID_HYPERLINK_DIALOG,
+ SFX_CALLMODE_ASYNCHRON |
+ SFX_CALLMODE_RECORD);
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* When extrawindow is visible and its never moved by user, then move that
+|* window, too.
+|*
+|************************************************************************/
+
+void SvxHpLinkDlg::Move()
+{
+ SvxHyperlinkTabPageBase* pCurrentPage = ( SvxHyperlinkTabPageBase* )
+ GetTabPage ( GetCurPageId() );
+
+ if( pCurrentPage->IsMarkWndVisible () )
+ {
+ // Pos&Size of this dialog-window
+ Point aDlgPos ( GetPosPixel () );
+ Size aDlgSize ( GetSizePixel () );
+
+ // Size of Office-Main-Window
+ Size aWindowSize( SFX_APP()->GetTopWindow()->GetSizePixel() );
+
+ // Size of Extrawindow
+ Size aExtraWndSize( pCurrentPage->GetSizeExtraWnd() );
+
+ BOOL bDoInvalid ;
+ if( aDlgPos.X()+(1.02*aDlgSize.Width())+aExtraWndSize.Width() > aWindowSize.Width() )
+ {
+ if( aDlgPos.X() - ( 0.02*aDlgSize.Width() ) - aExtraWndSize.Width() < 0 )
+ {
+ // Pos Extrawindow anywhere
+ bDoInvalid = pCurrentPage->MoveToExtraWnd( Point( 1, long(1.1*aDlgPos.Y()) ), TRUE );
+ }
+ else
+ {
+ // Pos Extrawindow on the left side of Dialog
+ bDoInvalid = pCurrentPage->MoveToExtraWnd( aDlgPos -
+ Point( long(0.02*aDlgSize.Width()), 0 ) -
+ Point( aExtraWndSize.Width(), 0 ) );
+ }
+ }
+ else
+ {
+ // Pos Extrawindow on the right side of Dialog
+ bDoInvalid = pCurrentPage->MoveToExtraWnd ( aDlgPos + Point( long(1.02*aDlgSize.Width()), 0 ) );
+ }
+
+ if ( bDoInvalid )
+ Invalidate(INVALIDATE_BACKGROUND);
+ }
+
+ Window::Move();
+}
+
+/*long SvxHpLinkDlg::PreNotify( NotifyEvent& rNEvt )
+{
+ long nRet = 0;
+
+ if( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ DBG_ASSERT( rNEvt.GetKeyEvent(), "-SvxHpLinkDlg::PreNotify(): no KeyEvent for key event?!" );
+
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+
+ if( KEY_MOD2 == pKEvt->GetKeyCode().GetModifier() && pKEvt->GetCharCode() && HandleShortCutKey( *pKEvt ) )
+ nRet = 1;
+ }
+
+ if( !nRet )
+ nRet = IconChoiceDialog::PreNotify( rNEvt );
+
+ return nRet;
+}*/
+
+/*************************************************************************
+|*
+|* Click on Apply-button
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHpLinkDlg, ClickApplyHdl_Impl, void *, EMPTYARG )
+{
+ SfxItemSet aItemSet( SFX_APP()->GetPool(), SID_HYPERLINK_GETLINK,
+ SID_HYPERLINK_SETLINK );
+
+ SvxHyperlinkTabPageBase* pCurrentPage = (SvxHyperlinkTabPageBase*)
+ GetTabPage ( GetCurPageId() );
+
+ if ( pCurrentPage->AskApply() )
+ {
+ pCurrentPage->FillItemSet( aItemSet );
+
+ SvxHyperlinkItem *aItem = (SvxHyperlinkItem *)
+ aItemSet.GetItem (SID_HYPERLINK_SETLINK);
+
+ String aStrEmpty;
+ if ( aItem->GetURL() != aStrEmpty )
+ GetDispatcher()->Execute( SID_HYPERLINK_SETLINK, SFX_CALLMODE_ASYNCHRON |
+ SFX_CALLMODE_RECORD, aItem, 0L);
+
+ ( (SvxHyperlinkTabPageBase*)GetTabPage ( GetCurPageId() ) )->DoApply();
+ }
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Click on Close-button
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHpLinkDlg, ClickCloseHdl_Impl, void *, EMPTYARG )
+{
+ Close();
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Set Page
+|*
+|************************************************************************/
+
+USHORT SvxHpLinkDlg::SetPage ( SvxHyperlinkItem* pItem )
+{
+ USHORT nPageId = RID_SVXPAGE_HYPERLINK_INTERNET;
+
+ String aStrURL ( pItem->GetURL() );
+ INetURLObject aURL ( aStrURL );
+ INetProtocol eProtocolTyp = aURL.GetProtocol();
+
+ switch ( eProtocolTyp )
+ {
+ case INET_PROT_HTTP :
+ case INET_PROT_FTP :
+ case INET_PROT_TELNET :
+ nPageId = RID_SVXPAGE_HYPERLINK_INTERNET;
+ break;
+ case INET_PROT_FILE :
+ case INET_PROT_POP3 :
+ case INET_PROT_IMAP :
+ nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT;
+ break;
+ case INET_PROT_MAILTO :
+ case INET_PROT_NEWS :
+ nPageId = RID_SVXPAGE_HYPERLINK_MAIL;
+ break;
+ default :
+ sal_Char const sNewsSrvScheme[] = "news://";
+ // TODO news:// is nonsense
+
+ if ( aStrURL.SearchAscii( sNewsSrvScheme ) == 0 )
+ nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT;
+ else
+ {
+ sal_Char const sHash[] = "#";
+ if( aStrURL.SearchAscii( sHash ) == 0 )
+ nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT;
+ else
+ {
+ eProtocolTyp = INET_PROT_NOT_VALID;
+ nPageId = GetCurPageId();
+ }
+ }
+ break;
+ }
+
+ ShowPage (nPageId);
+
+ SvxHyperlinkTabPageBase* pCurrentPage = (SvxHyperlinkTabPageBase*)GetTabPage( nPageId );
+
+ mbIsHTMLDoc = (pItem->GetInsertMode() & HLINK_HTMLMODE) ? true : false;
+
+ SfxItemSet& aPageSet = (SfxItemSet&)GetTabPage (nPageId)->GetItemSet ();
+ aPageSet.Put ( *pItem );
+
+ pCurrentPage->Reset( aPageSet );
+ if ( mbGrabFocus )
+ {
+ pCurrentPage->SetInitFocus(); // #92535# grab the focus only once at initialization
+ mbGrabFocus = sal_False;
+ }
+ return nPageId;
+}
+
+/*************************************************************************
+|*
+|* Enable/Disable to browse targets in a html-doc
+|*
+|************************************************************************/
+
+void SvxHpLinkDlg::EnableInetBrowse( sal_Bool bEnable )
+{
+ SvxHyperlinkTabPageBase* pCurrentPage = ( SvxHyperlinkTabPageBase* )
+ GetTabPage ( GetCurPageId() );
+ pCurrentPage->SetOnlineMode( bEnable );
+}
+
+/*************************************************************************
+|*
+|* Enable/Disable ReadOnly mode
+|*
+|************************************************************************/
+
+void SvxHpLinkDlg::SetReadOnlyMode( sal_Bool bRdOnly )
+{
+ mbReadOnly = bRdOnly;
+ if ( bRdOnly )
+ GetOKButton().Disable();
+ else
+ GetOKButton().Enable();
+}
+
+/*************************************************************************
+|*
+|* late-initialization of newly created pages
+|*
+|************************************************************************/
+
+void SvxHpLinkDlg::PageCreated( USHORT /*nId*/, IconChoicePage& rPage )
+{
+ SvxHyperlinkTabPageBase& rHyperlinkPage = dynamic_cast< SvxHyperlinkTabPageBase& >( rPage );
+ Reference< XFrame > xDocumentFrame;
+ if ( mpBindings )
+ xDocumentFrame = mpBindings->GetActiveFrame();
+ OSL_ENSURE( xDocumentFrame.is(), "SvxHpLinkDlg::PageCreated: macro assignment functionality won't work with a proper frame!" );
+ rHyperlinkPage.SetDocumentFrame( xDocumentFrame );
+}
diff --git a/cui/source/dialogs/cuiimapdlg.hrc b/cui/source/dialogs/cuiimapdlg.hrc
new file mode 100755
index 000000000000..00df9f23ee7a
--- /dev/null
+++ b/cui/source/dialogs/cuiimapdlg.hrc
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * 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: imapdlg.hrc,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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>
+
+// ImapDlg-Dialoge
+#define RID_SVX_IMAPDLG_START RID_SVX_IMAP_START
+
+#define RID_SVXDLG_IMAPURL (RID_SVX_IMAPDLG_START + 2)
+
+#define FT_URLDESCRIPTION 1
+#define FT_URL1 2
+#define FT_TARGET 3
+#define FT_NAME 4
+#define FT_DESCRIPTION 5
+#define EDT_URLDESCRIPTION 1
+#define EDT_URL 2
+#define EDT_NAME 3
+#define EDT_DESCRIPTION 4
+#define BTN_HELP1 1
+#define BTN_OK1 2
+#define BTN_CANCEL1 3
+#define FL_URL 1
+#define CBB_TARGETS 1
diff --git a/cui/source/dialogs/cuiimapdlg.src b/cui/source/dialogs/cuiimapdlg.src
new file mode 100755
index 000000000000..de41ca0d1d55
--- /dev/null
+++ b/cui/source/dialogs/cuiimapdlg.src
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * 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: imapdlg.src,v $
+ * $Revision: 1.53 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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.hrc"
+#include "cuiimapdlg.hrc"
+ // pragma ----------------------------------------------------------------
+
+ModalDialog RID_SVXDLG_IMAPURL
+{
+ SVLook = TRUE ;
+ OutputSize = TRUE ;
+ Closeable = TRUE ;
+ Moveable = TRUE ;
+ Size = MAP_APPFONT ( 214 , 188 ) ;
+ Text [ en-US ] = "Properties" ;
+
+ FixedText FT_URL1
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ Text [ en-US ] = "~URL" ;
+ };
+ Edit EDT_URL
+ {
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 202 , 12 ) ;
+ };
+
+ FixedText FT_TARGET
+ {
+ Pos = MAP_APPFONT ( 6 , 32 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ Text [ en-US ] = "F~rame" ;
+ };
+ ComboBox CBB_TARGETS
+ {
+ Border = TRUE ;
+ Sort = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 43 ) ;
+ Size = MAP_APPFONT ( 101 , 50 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ HScroll = TRUE ;
+ };
+
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 59 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit EDT_NAME
+ {
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 70 ) ;
+ Size = MAP_APPFONT ( 202 , 12 ) ;
+ };
+
+ FixedText FT_URLDESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 6 , 85 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ Text [ en-US ] = "Alternative ~text" ;
+ };
+
+ Edit EDT_URLDESCRIPTION
+ {
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 96 ) ;
+ Size = MAP_APPFONT ( 202 , 12 ) ;
+ };
+ FixedText FT_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 6 , 111 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ Text [ en-US ] = "~Description" ;
+ };
+
+ MultiLineEdit EDT_DESCRIPTION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 122 ) ;
+ Size = MAP_APPFONT ( 202 , 34 ) ;
+ TabStop = TRUE ;
+ IgnoreTab = TRUE;
+ VScroll = TRUE;
+ };
+
+ FixedLine FL_URL
+ {
+ Pos = MAP_APPFONT ( 0 , 160 ) ;
+ Size = MAP_APPFONT ( 214 , 4 ) ;
+ };
+
+ // Buttons
+ HelpButton BTN_HELP1
+ {
+ Pos = MAP_APPFONT ( 6, 168 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+
+ OKButton BTN_OK1
+ {
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ Pos = MAP_APPFONT ( 107 , 168 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+
+ CancelButton BTN_CANCEL1
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 160 , 168 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
diff --git a/cui/source/dialogs/cuiimapwnd.cxx b/cui/source/dialogs/cuiimapwnd.cxx
new file mode 100644
index 000000000000..09fe5168556d
--- /dev/null
+++ b/cui/source/dialogs/cuiimapwnd.cxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * 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: cuiimapwnd.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/help.hxx>
+#include <sfx2/sfxsids.hrc>
+#define _ANIMATION
+#include "macroass.hxx"
+#include <svtools/imaprect.hxx>
+#include <svtools/imapcirc.hxx>
+#include <svtools/imappoly.hxx>
+#include <svl/urlbmk.hxx>
+#include <svx/xoutbmp.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+#include <cuiimapdlg.hrc>
+#include <cuiimapwnd.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/svdpagv.hxx>
+#include <svl/urihelper.hxx>
+#include <svx/xfillit.hxx>
+#include <svx/xlineit.hxx>
+
+#include <sot/formats.hxx>
+
+#define TRANSCOL Color( COL_WHITE )
+
+/*************************************************************************
+|*
+|* URLDlg
+|*
+\************************************************************************/
+
+URLDlg::URLDlg( Window* pWindow, const String& rURL, const String& rAlternativeText, const String& rDescription, const String& rTarget, const String& rName, TargetList& rTargetList )
+: ModalDialog( pWindow, SVX_RES( RID_SVXDLG_IMAPURL ) )
+, maFtURL( this, SVX_RES( FT_URL1 ) )
+, maEdtURL( this, SVX_RES( EDT_URL ) )
+, maFtTarget( this, SVX_RES( FT_TARGET ) )
+, maCbbTargets( this, SVX_RES( CBB_TARGETS ) )
+, maFtName( this, SVX_RES( FT_NAME ) )
+, maEdtName( this, SVX_RES( EDT_NAME ) )
+, maFtAlternativeText( this, SVX_RES( FT_URLDESCRIPTION ) )
+, maEdtAlternativeText( this, SVX_RES( EDT_URLDESCRIPTION ) )
+, maFtDescription( this, SVX_RES( FT_DESCRIPTION ) )
+, maEdtDescription( this, SVX_RES( EDT_DESCRIPTION ) )
+, maFlURL( this, SVX_RES( FL_URL ) )
+, maBtnHelp( this, SVX_RES( BTN_HELP1 ) )
+, maBtnOk( this, SVX_RES( BTN_OK1 ) )
+, maBtnCancel( this, SVX_RES( BTN_CANCEL1 ) )
+{
+ FreeResource();
+
+ maEdtURL.SetText( rURL );
+ maEdtAlternativeText.SetText( rAlternativeText );
+ maEdtDescription.SetText( rDescription );
+ maEdtName.SetText( rName );
+
+ for( String* pStr = rTargetList.First(); pStr; pStr = rTargetList.Next() )
+ maCbbTargets.InsertEntry( *pStr );
+
+ if( !rTarget.Len() )
+ maCbbTargets.SetText( String::CreateFromAscii( "_self" ) );
+ else
+ maCbbTargets.SetText( rTarget );
+}
diff --git a/cui/source/dialogs/cuitbxform.cxx b/cui/source/dialogs/cuitbxform.cxx
new file mode 100644
index 000000000000..2a5da5084c5c
--- /dev/null
+++ b/cui/source/dialogs/cuitbxform.cxx
@@ -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: cuitbxform.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+#include <tools/ref.hxx>
+#include <tools/shl.hxx>
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/sound.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include "cuitbxform.hxx"
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/viewsh.hxx>
+#include "fmsearch.hrc"
+
+//========================================================================
+// class FmInputRecordNoDialog
+//========================================================================
+
+FmInputRecordNoDialog::FmInputRecordNoDialog(Window * pParent)
+ :ModalDialog( pParent, SVX_RES(RID_SVX_DLG_INPUTRECORDNO))
+ ,m_aLabel(this, SVX_RES(1))
+ ,m_aRecordNo(this, SVX_RES(1))
+ ,m_aOk(this, SVX_RES(1))
+ ,m_aCancel(this, SVX_RES(1))
+{
+ m_aRecordNo.SetMin(1);
+ m_aRecordNo.SetMax(0x7FFFFFFF);
+ m_aRecordNo.SetStrictFormat(TRUE);
+ m_aRecordNo.SetDecimalDigits(0);
+
+ FreeResource();
+}
diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
new file mode 100644
index 000000000000..12b58542f605
--- /dev/null
+++ b/cui/source/dialogs/dlgname.cxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * 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: dlgname.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <tools/ref.hxx>
+#include <tools/list.hxx>
+#include <tools/shl.hxx>
+#include <tools/debug.hxx>
+#include <vcl/msgbox.hxx>
+
+#include <svx/dialogs.hrc>
+
+#include "dlgname.hxx"
+#include "defdlgname.hxx" //CHINA001
+#include "dlgname.hrc"
+#include <svx/dialmgr.hxx>
+
+#define MAX_DESCRIPTION_LINES ((long)5)
+
+/*************************************************************************
+|*
+|* Dialog zum Editieren eines Namens
+|*
+\************************************************************************/
+
+SvxNameDialog::SvxNameDialog( Window* pWindow, const String& rName, const String& rDesc ) :
+ ModalDialog ( pWindow, SVX_RES( RID_SVXDLG_NAME ) ),
+ aFtDescription ( this, SVX_RES( FT_DESCRIPTION ) ),
+ aEdtName ( this, SVX_RES( EDT_STRING ) ),
+ aBtnOK ( this, SVX_RES( BTN_OK ) ),
+ aBtnCancel ( this, SVX_RES( BTN_CANCEL ) ),
+ aBtnHelp ( this, SVX_RES( BTN_HELP ) )
+{
+ FreeResource();
+
+ aFtDescription.SetText( rDesc );
+ aEdtName.SetText( rName );
+ aEdtName.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
+ ModifyHdl(&aEdtName);
+ aEdtName.SetModifyHdl(LINK(this, SvxNameDialog, ModifyHdl));
+
+ // dynamic height of the description field
+ Size aSize = aFtDescription.GetSizePixel();
+ long nTxtWidth = aFtDescription.GetCtrlTextWidth( rDesc );
+ if ( nTxtWidth > aSize.Width() )
+ {
+ long nLines = Min( ( nTxtWidth / aSize.Width() + 1 ), MAX_DESCRIPTION_LINES );
+ long nHeight = aSize.Height();
+ aSize.Height() = nHeight * nLines;
+ aFtDescription.SetSizePixel( aSize );
+ Point aPnt = aEdtName.GetPosPixel();
+ aPnt.Y() += ( aSize.Height() - nHeight );
+ aEdtName.SetPosPixel( aPnt );
+ }
+}
+
+/* -----------------------------27.02.2002 15:22------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxNameDialog, ModifyHdl, Edit*, EMPTYARG)
+{
+ if(aCheckNameHdl.IsSet())
+ aBtnOK.Enable(aCheckNameHdl.Call(this) > 0);
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+// #i68101#
+// Dialog for editing Object Name
+// plus uniqueness-callback-linkHandler
+
+SvxObjectNameDialog::SvxObjectNameDialog(
+ Window* pWindow,
+ const String& rName)
+: ModalDialog(pWindow, SVX_RES(RID_SVXDLG_OBJECT_NAME)),
+ aFtName(this, SVX_RES(NTD_FT_NAME)),
+ aEdtName(this, SVX_RES(NTD_EDT_NAME)),
+ aFlSeparator(this, SVX_RES(FL_SEPARATOR_A)),
+ aBtnHelp(this, SVX_RES(BTN_HELP)),
+ aBtnOK(this, SVX_RES(BTN_OK)),
+ aBtnCancel(this, SVX_RES(BTN_CANCEL))
+{
+ FreeResource();
+
+ // set name
+ aEdtName.SetText(rName);
+
+ // activate name
+ aEdtName.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
+ ModifyHdl(&aEdtName);
+ aEdtName.SetModifyHdl(LINK(this, SvxObjectNameDialog, ModifyHdl));
+}
+
+IMPL_LINK(SvxObjectNameDialog, ModifyHdl, Edit*, EMPTYARG)
+{
+ if(aCheckNameHdl.IsSet())
+ {
+ aBtnOK.Enable(aCheckNameHdl.Call(this) > 0);
+ }
+
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+// #i68101#
+// Dialog for editing Object Title and Description
+
+SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(
+ Window* pWindow,
+ const String& rTitle,
+ const String& rDescription)
+: ModalDialog(pWindow, SVX_RES(RID_SVXDLG_OBJECT_TITLE_DESC)),
+ aFtTitle(this, SVX_RES(NTD_FT_TITLE)),
+ aEdtTitle(this, SVX_RES(NTD_EDT_TITLE)),
+ aFtDescription(this, SVX_RES(NTD_FT_DESC)),
+ aEdtDescription(this, SVX_RES(NTD_EDT_DESC)),
+ aFlSeparator(this, SVX_RES(FL_SEPARATOR_B)),
+ aBtnHelp(this, SVX_RES(BTN_HELP)),
+ aBtnOK(this, SVX_RES(BTN_OK)),
+ aBtnCancel(this, SVX_RES(BTN_CANCEL))
+{
+ FreeResource();
+
+ // set title & desc
+ aEdtTitle.SetText(rTitle);
+ aEdtDescription.SetText(rDescription);
+
+ // activate title
+ aEdtTitle.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+/*************************************************************************
+|*
+|* Dialog zum Abbrechen, Speichern oder Hinzufuegen
+|*
+\************************************************************************/
+
+SvxMessDialog::SvxMessDialog( Window* pWindow, const String& rText, const String& rDesc, Image* pImg ) :
+ ModalDialog ( pWindow, SVX_RES( RID_SVXDLG_MESSBOX ) ),
+ aFtDescription ( this, SVX_RES( FT_DESCRIPTION ) ),
+ aBtn1 ( this, SVX_RES( BTN_1 ) ),
+ aBtn2 ( this, SVX_RES( BTN_2 ) ),
+ aBtnCancel ( this, SVX_RES( BTN_CANCEL ) ),
+ aFtImage ( this )
+{
+ FreeResource();
+
+ if( pImg )
+ {
+ pImage = new Image( *pImg );
+ aFtImage.SetImage( *pImage );
+ aFtImage.SetStyle( ( aFtImage.GetStyle()/* | WB_NOTABSTOP */) & ~WB_3DLOOK );
+ aFtImage.SetPosSizePixel( LogicToPixel( Point( 3, 6 ), MAP_APPFONT ),
+ aFtImage.GetImage().GetSizePixel() );
+ aFtImage.Show();
+ }
+
+ SetText( rText );
+ aFtDescription.SetText( rDesc );
+
+ aBtn1.SetClickHdl( LINK( this, SvxMessDialog, Button1Hdl ) );
+ aBtn2.SetClickHdl( LINK( this, SvxMessDialog, Button2Hdl ) );
+}
+
+SvxMessDialog::~SvxMessDialog()
+{
+ if( pImage )
+ delete pImage;
+}
+
+/*************************************************************************/
+
+IMPL_LINK_INLINE_START( SvxMessDialog, Button1Hdl, Button *, EMPTYARG )
+{
+ EndDialog( RET_BTN_1 );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxMessDialog, Button1Hdl, Button *, EMPTYARG )
+
+/*************************************************************************/
+
+IMPL_LINK_INLINE_START( SvxMessDialog, Button2Hdl, Button *, EMPTYARG )
+{
+ EndDialog( RET_BTN_2 );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxMessDialog, Button2Hdl, Button *, EMPTYARG )
+
+/*************************************************************************/
+
+void SvxMessDialog::SetButtonText( USHORT nBtnId, const String& rNewTxt )
+{
+ switch ( nBtnId )
+ {
+ case MESS_BTN_1:
+ aBtn1.SetText( rNewTxt );
+ break;
+
+ case MESS_BTN_2:
+ aBtn2.SetText( rNewTxt );
+ break;
+
+ default:
+ DBG_ERROR( "Falsche Button-Nummer!!!" );
+ }
+}
+
+
diff --git a/cui/source/dialogs/dlgname.hrc b/cui/source/dialogs/dlgname.hrc
new file mode 100644
index 000000000000..787a5b9bd6df
--- /dev/null
+++ b/cui/source/dialogs/dlgname.hrc
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * 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: dlgname.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define EDT_STRING 1
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define FT_DESCRIPTION 1
+#define BTN_1 1
+#define BTN_2 2
+
+// #i68101#
+#define NTD_FT_NAME 2
+#define NTD_EDT_NAME 2
+#define NTD_FT_TITLE 3
+#define NTD_EDT_TITLE 3
+#define NTD_FT_DESC 4
+#define NTD_EDT_DESC 4
+#define FL_SEPARATOR_A 1
+#define FL_SEPARATOR_B 2
+
+// eof
diff --git a/cui/source/dialogs/dlgname.src b/cui/source/dialogs/dlgname.src
new file mode 100644
index 000000000000..5647bb347e69
--- /dev/null
+++ b/cui/source/dialogs/dlgname.src
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * 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: dlgname.src,v $
+ * $Revision: 1.14 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "dlgname.hrc"
+
+// RID_SVXDLG_NAME ----------------------------------------------------------
+
+ModalDialog RID_SVXDLG_NAME
+{
+ HelpId = HID_DLG_NAME ;
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 180 , 63 ) ;
+ Text [ en-US ] = "Name" ;
+ Moveable = TRUE ;
+ FixedText FT_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
+ WordBreak = TRUE ;
+ };
+ Edit EDT_STRING
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 112 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 124 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 124 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 124 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+// #i68101#
+// RID_SVXDLG_OBJECT_NAME ----------------------------------------------------------
+
+ModalDialog RID_SVXDLG_OBJECT_NAME
+{
+ HelpId = HID_DLG_OBJECT_NAME;
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 180 , 54 + 2) ;
+ Text [ en-US ] = "Name" ;
+ Moveable = TRUE ;
+
+ // name
+ FixedText NTD_FT_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 168 , 8 ) ;
+ Text [ en-US ] = "~Name";
+ };
+ Edit NTD_EDT_NAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 168 , 12 ) ;
+ TabStop = TRUE ;
+ };
+
+ // divider
+ FixedLine FL_SEPARATOR_A
+ {
+ Pos = MAP_APPFONT ( 0 , 39 - 6 - 2 ) ;
+ Size = MAP_APPFONT ( 180 , 8 ) ;
+ };
+
+ // Buttons
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 6, 39 - 3 + 3) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 174 - (50 + 50 + 6), 39 - 3 + 3) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 174 - (50), 39 - 3 + 3) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+// #i68101#
+// RID_SVXDLG_OBJECTTITLE_DESC ----------------------------------------------------------
+
+ModalDialog RID_SVXDLG_OBJECT_TITLE_DESC
+{
+ HelpId = HID_DLG_OBJECT_TITLE_DESC;
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 180 , 78 + 27 ) ;
+ Text [ en-US ] = "Description" ;
+ Moveable = TRUE ;
+
+ // title
+ FixedText NTD_FT_TITLE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 168 , 8 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "~Title";
+ };
+ Edit NTD_EDT_TITLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 168 , 12 ) ;
+ TabStop = TRUE ;
+ };
+
+ // description
+ FixedText NTD_FT_DESC
+ {
+ Pos = MAP_APPFONT ( 6 , 30 ) ;
+ Size = MAP_APPFONT ( 168 , 8 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "~Description";
+ };
+ MultiLineEdit NTD_EDT_DESC
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 41 ) ;
+ Size = MAP_APPFONT ( 168 , (12 * 3) - 2 ) ;
+ TabStop = TRUE ;
+ IgnoreTab = TRUE;
+ VScroll = TRUE;
+ };
+
+ // divider
+ FixedLine FL_SEPARATOR_B
+ {
+ Pos = MAP_APPFONT ( 0 , 41 + 39 ) ;
+ Size = MAP_APPFONT ( 180 , 8 ) ;
+ };
+
+ // Buttons
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 6, 41 + 39 + 3 + 5) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 174 - (50 + 50 + 6), 41 + 39 + 3 + 5) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 174 - (50), 41 + 39 + 3 + 5) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+// RID_SVXDLG_MESSBOX -------------------------------------------------------
+
+ModalDialog RID_SVXDLG_MESSBOX
+{
+ HelpId = HID_DLG_MESSBOX ;
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 212 , 64 ) ;
+ Text = "" ;
+ Moveable = TRUE ;
+ PushButton BTN_1
+ {
+ Pos = MAP_APPFONT ( 25 , 44 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_2
+ {
+ Pos = MAP_APPFONT ( 78 , 44 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 131 , 44 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 28 , 6 ) ;
+ Size = MAP_APPFONT ( 200 , 35 ) ;
+ WordBreak = TRUE ;
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/fmsearch.hrc b/cui/source/dialogs/fmsearch.hrc
new file mode 100644
index 000000000000..579602ec2b5f
--- /dev/null
+++ b/cui/source/dialogs/fmsearch.hrc
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * 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: fmsearch.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FMSEARCH_HRC
+#define _FMSEARCH_HRC
+
+#include "svl/solar.hrc"
+
+#define RID_SVX_DLG_INPUTRECORDNO (RID_FORMS_START + 10)
+#define RID_SVX_DLG_SHOWGRIDCOLUMNS (RID_FORMS_START + 11)
+#define RID_SVXDLG_SEARCHFORM (RID_FORMS_START + 7)
+#define RID_STR_SEARCH_ANYWHERE (RID_FORMS_START + 85)
+#define RID_STR_SEARCH_BEGINNING (RID_FORMS_START + 86)
+#define RID_STR_SEARCH_END (RID_FORMS_START + 87)
+#define RID_STR_SEARCH_WHOLE (RID_FORMS_START + 88)
+#define RID_STR_FROM_TOP (RID_FORMS_START + 74)
+#define RID_STR_FROM_BOTTOM (RID_FORMS_START + 75)
+#define RID_SVXERR_SEARCH_NORECORD (RID_FORMS_START + 8)
+#define RID_SVXERR_SEARCH_GENERAL_ERROR (RID_FORMS_START + 9)
+#define RID_STR_OVERFLOW_FORWARD (RID_FORMS_START + 34)
+#define RID_STR_OVERFLOW_BACKWARD (RID_FORMS_START + 35)
+#define RID_STR_SEARCH_COUNTING (RID_FORMS_START + 76)
+
+#define FT_SEARCHTEXT 1
+#define FT_FORM 2
+#define FT_POSITION 3
+#define FT_RECORDLABEL 4
+#define FT_RECORD 5
+#define FT_HINT 6
+
+
+#define CMB_SEARCHTEXT 1
+
+#define RB_ALLFIELDS 1
+#define RB_SINGLEFIELD 2
+#define RB_SEARCHFORTEXT 3
+#define RB_SEARCHFORNULL 4
+#define RB_SEARCHFORNOTNULL 5
+
+#define LB_FORM 1
+#define LB_FIELD 2
+#define LB_POSITION 3
+
+#define PB_APPROXSETTINGS 1
+#define PB_SEARCH 2
+#define PB_SOUNDSLIKESETTINGS 3
+
+#define FL_SEARCHFOR 1
+#define FL_WHERE 2
+#define FL_OPTIONS 3
+#define FL_STATE 4
+
+#define CB_USEFORMATTER 1
+#define CB_BACKWARD 2
+#define CB_STARTOVER 3
+#define CB_CASE 4
+#define CB_WILDCARD 5
+#define CB_REGULAR 6
+#define CB_APPROX 7
+#define CB_HALFFULLFORMS 8
+#define CB_SOUNDSLIKECJK 9
+
+#endif // _FMSEARCH_HRC
diff --git a/cui/source/dialogs/fmsearch.src b/cui/source/dialogs/fmsearch.src
new file mode 100644
index 000000000000..83b04a138b0d
--- /dev/null
+++ b/cui/source/dialogs/fmsearch.src
@@ -0,0 +1,332 @@
+/*************************************************************************
+ *
+ * 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: fmsearch.src,v $
+ * $Revision: 1.59 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "fmsearch.hrc"
+#include "helpid.hrc"
+
+ModalDialog RID_SVXDLG_SEARCHFORM
+{
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Size = MAP_APPFONT( 300, 253 );
+ Text [ en-US ] = "Record Search";
+ Moveable = TRUE;
+ HelpId = HID_FM_DLG_SEARCH;
+
+ FixedLine FL_SEARCHFOR
+ {
+ Pos = MAP_APPFONT( 6, 8 );
+ Size = MAP_APPFONT( 232, 8 );
+ Text [ en-US ] = "Search for";
+ };
+ RadioButton RB_SEARCHFORTEXT
+ {
+ Pos = MAP_APPFONT( 12, 23 );
+ Size = MAP_APPFONT( 50, 10 );
+ Group = TRUE;
+ Text [ en-US ] = "~Text";
+ };
+ RadioButton RB_SEARCHFORNULL
+ {
+ Pos = MAP_APPFONT( 12, 36 );
+ Size = MAP_APPFONT( 207, 10 );
+ Text [ en-US ] = "Field content is ~NULL";
+ };
+ RadioButton RB_SEARCHFORNOTNULL
+ {
+ Pos = MAP_APPFONT( 12, 49 );
+ Size = MAP_APPFONT( 207, 10 );
+ Text [ en-US ] = "Field content is not NU~LL";
+ };
+ ComboBox CMB_SEARCHTEXT
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 65, 20 );
+ Size = MAP_APPFONT( 154, 80 );
+ DropDown = TRUE;
+ TabStop = TRUE;
+ HelpId = HID_SEARCH_TEXT;
+ };
+
+ FixedLine FL_WHERE
+ {
+ Pos = MAP_APPFONT( 6, 65 );
+ Size = MAP_APPFONT( 232, 8 );
+ Text [ en-US ] = "Where to search";
+ };
+ FixedText FT_FORM
+ {
+ Pos = MAP_APPFONT( 12, 77 );
+ Size = MAP_APPFONT( 87, 10 );
+ Text [ en-US ] = "Form";
+ };
+ ListBox LB_FORM
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 110, 76 );
+ Size = MAP_APPFONT( 109, 60 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+ RadioButton RB_ALLFIELDS
+ {
+ Pos = MAP_APPFONT( 24, 91 );
+ Size = MAP_APPFONT( 75, 10 );
+ TabStop = TRUE;
+ HelpId = HID_SEARCH_ALLFIELDS;
+ Text [ en-US ] = "All Fields";
+ };
+ RadioButton RB_SINGLEFIELD
+ {
+ Pos = MAP_APPFONT( 24, 106 );
+ Size = MAP_APPFONT( 75, 10 );
+ Text [ en-US ] = "Single field";
+ };
+ ListBox LB_FIELD
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 110, 105 );
+ Size = MAP_APPFONT( 109, 60 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ HelpId = HID_SEARCH_FIELDSELECTION;
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT( 6, 126 );
+ Size = MAP_APPFONT( 288, 8 );
+ Text [ en-US ] = "Settings";
+ };
+ FixedText FT_POSITION
+ {
+ Pos = MAP_APPFONT( 12, 138 );
+ Size = MAP_APPFONT( 87, 8 );
+ Text [ en-US ] = "Position";
+ };
+ ListBox LB_POSITION
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 110, 136 );
+ Size = MAP_APPFONT( 109, 60 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ HelpId = HID_SEARCH_POSITION;
+ };
+ CheckBox CB_USEFORMATTER
+ {
+ Pos = MAP_APPFONT( 12, 158 );
+ Size = MAP_APPFONT( 90, 10 );
+ TabStop = TRUE;
+ HelpId = HID_SEARCH_FORMATTER;
+ Text [ en-US ] = "Apply field format";
+ };
+ CheckBox CB_CASE
+ {
+ Pos = MAP_APPFONT( 12, 171 );
+ Size = MAP_APPFONT( 90, 20 );
+ TabStop = TRUE;
+ WordBreak = TRUE;
+ HelpId = HID_SEARCH_CASE;
+ Text [ en-US ] = "Match case";
+ };
+ CheckBox CB_BACKWARD
+ {
+ Pos = MAP_APPFONT( 105, 158 );
+ Size = MAP_APPFONT( 85, 10 );
+ TabStop = TRUE;
+ HelpId = HID_SEARCH_BACKWARD;
+ Text [ en-US ] = "Search backwards";
+ };
+ CheckBox CB_STARTOVER
+ {
+ Pos = MAP_APPFONT( 105, 171 );
+ Size = MAP_APPFONT( 85, 10 );
+ TabStop = TRUE;
+ HelpId = HID_SEARCH_STARTOVER;
+ Text [ en-US ] = "From Beginning";
+ };
+ CheckBox CB_WILDCARD
+ {
+ Pos = MAP_APPFONT( 190, 158 );
+ Size = MAP_APPFONT( 100, 10 );
+ TabStop = TRUE;
+ HelpId = HID_SEARCH_WILDCARD;
+ Text [ en-US ] = "Wildcard expression";
+ };
+ CheckBox CB_REGULAR
+ {
+ Pos = MAP_APPFONT( 190, 171 );
+ Size = MAP_APPFONT( 100, 10 );
+ TabStop = TRUE;
+ HelpId = HID_SEARCH_REGULAR;
+ Text [ en-US ] = "Regular expression";
+ };
+ CheckBox CB_APPROX
+ {
+ Pos = MAP_APPFONT( 190, 184 );
+ Size = MAP_APPFONT( 84, 20 );
+ TabStop = TRUE;
+ WordBreak = TRUE;
+ HelpId = HID_SEARCH_APPROX;
+ Text [ en-US ] = "Similarity Search";
+ };
+ PushButton PB_APPROXSETTINGS
+ {
+ Pos = MAP_APPFONT( 275, 182 );
+ Size = MAP_APPFONT( 14, 14 );
+ TabStop = TRUE ;
+ HelpId = HID_SEARCH_APPROXSETTINGS;
+ Text [ en-US ] = "...";
+ };
+ CheckBox CB_HALFFULLFORMS
+ {
+ Pos = MAP_APPFONT( 105, 209 );
+ Size = MAP_APPFONT( 85, 10 );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Match character width" ;
+ };
+ CheckBox CB_SOUNDSLIKECJK
+ {
+ Pos = MAP_APPFONT( 190, 209 );
+ Size = MAP_APPFONT( 84, 10 );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Sounds like (Japanese)";
+ };
+ PushButton PB_SOUNDSLIKESETTINGS
+ {
+ Pos = MAP_APPFONT( 275, 207 );
+ Size = MAP_APPFONT( 14, 14 );
+ TabStop = TRUE ;
+ Text [ en-US ] = "..." ;
+ };
+ FixedLine FL_STATE
+ {
+ Pos = MAP_APPFONT( 6, 222 );
+ Size = MAP_APPFONT( 288, 8 );
+ Text [ en-US ] = "State";
+ };
+ FixedText FT_RECORDLABEL
+ {
+ Pos = MAP_APPFONT( 12, 232 );
+ Size = MAP_APPFONT( 45, 10 );
+ Text [ en-US ] = "Record :";
+ };
+ FixedText FT_RECORD
+ {
+ Pos = MAP_APPFONT( 60, 232 );
+ Size = MAP_APPFONT( 30, 10 );
+ UniqueId = UID_SEARCH_RECORDSTATUS;
+ };
+ FixedText FT_HINT
+ {
+ Pos = MAP_APPFONT( 99, 232 );
+ Size = MAP_APPFONT( 190, 10 );
+ };
+ PushButton PB_SEARCH
+ {
+ Pos = MAP_APPFONT( 244, 6 );
+ Size = MAP_APPFONT( 50, 14 );
+ TabStop = TRUE;
+ DefButton = TRUE;
+ HelpId = HID_SEARCH_BTN_SEARCH;
+ Text [ en-US ] = "Search";
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT( 244, 26 );
+ Size = MAP_APPFONT( 50, 14 );
+ HelpId = HID_SEARCH_BTN_CLOSE;
+ TabStop = TRUE;
+ Text [ en-US ] = "~Close";
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT( 244, 46 );
+ Size = MAP_APPFONT( 50, 14 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~Help";
+ };
+};
+
+String RID_STR_SEARCH_ANYWHERE
+{
+ Text [ en-US ] = "anywhere in the field";
+};
+
+String RID_STR_SEARCH_BEGINNING
+{
+ Text [ en-US ] = "beginning of field";
+};
+
+String RID_STR_SEARCH_END
+{
+ Text [ en-US ] = "end of field";
+};
+
+String RID_STR_SEARCH_WHOLE
+{
+ Text [ en-US ] = "entire field";
+};
+
+String RID_STR_FROM_TOP
+{
+ Text [ en-US ] = "From top";
+};
+String RID_STR_FROM_BOTTOM
+{
+ Text [ en-US ] = "From bottom";
+};
+
+ErrorBox RID_SVXERR_SEARCH_NORECORD
+{
+ Buttons = WB_OK;
+ Message [ en-US ] = "No records corresponding to your data found.";
+};
+
+ErrorBox RID_SVXERR_SEARCH_GENERAL_ERROR
+{
+ Buttons = WB_OK;
+ Message [ en-US ] = "An unknown error occurred. The search could not be finished.";
+};
+
+String RID_STR_OVERFLOW_FORWARD
+{
+ Text [ en-US ] = "Overflow, search continued at the beginning";
+};
+
+String RID_STR_OVERFLOW_BACKWARD
+{
+ Text [ en-US ] = "Overflow, search continued at the end";
+};
+
+String RID_STR_SEARCH_COUNTING
+{
+ Text [ en-US ] = "counting records";
+};
diff --git a/cui/source/dialogs/gallery.src b/cui/source/dialogs/gallery.src
new file mode 100644
index 000000000000..50ea2074bf6d
--- /dev/null
+++ b/cui/source/dialogs/gallery.src
@@ -0,0 +1,407 @@
+/*************************************************************************
+ *
+ * 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: gallery.src,v $
+ * $Revision: 1.79 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <sfx2/sfxsids.hrc>
+#include "helpid.hrc"
+#include "gallery.hrc"
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+TabDialog RID_SVXTABDLG_GALLERY
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Properties of " ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXTABPAGE_GALLERY_GENERAL ;
+ Text [ en-US ] = "General" ;
+ };
+ };
+ };
+};
+
+/******************************************************************************/
+
+TabPage RID_SVXTABPAGE_GALLERY_GENERAL
+{
+ HelpId = HID_GALLERY_PROPERTIES_GENERAL;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedImage FI_MS_IMAGE
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 20 , 20 ) ;
+ };
+ Edit EDT_MS_NAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 10 ) ;
+ Size = MAP_APPFONT ( 194 , 12 ) ;
+ };
+ FixedLine FL_MS_GENERAL_FIRST
+ {
+ Pos = MAP_APPFONT ( 6 , 36 ) ;
+ Size = MAP_APPFONT ( 248 , 1 ) ;
+ };
+ FixedText FT_MS_TYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 43 ) ;
+ Size = MAP_APPFONT ( 51 , 10 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "Type:" ;
+ };
+ FixedText FT_MS_SHOW_TYPE
+ {
+ Pos = MAP_APPFONT ( 60 , 43 ) ;
+ Size = MAP_APPFONT ( 194 , 10 ) ;
+ };
+ FixedText FT_MS_PATH
+ {
+ Pos = MAP_APPFONT ( 6 , 57 ) ;
+ Size = MAP_APPFONT ( 51 , 10 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "Location:" ;
+ };
+ FixedText FT_MS_SHOW_PATH
+ {
+ Pos = MAP_APPFONT ( 60 , 57 ) ;
+ Size = MAP_APPFONT ( 194 , 10 ) ;
+ };
+ FixedText FT_MS_CONTENT
+ {
+ Pos = MAP_APPFONT ( 6 , 71 ) ;
+ Size = MAP_APPFONT ( 51 , 10 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "Contents:" ;
+ };
+ FixedText FT_MS_SHOW_CONTENT
+ {
+ Pos = MAP_APPFONT ( 60 , 71 ) ;
+ Size = MAP_APPFONT ( 194 , 10 ) ;
+ };
+ FixedLine FL_MS_GENERAL_SECOND
+ {
+ Pos = MAP_APPFONT ( 6 , 91 ) ;
+ Size = MAP_APPFONT ( 248 , 1 ) ;
+ };
+ FixedText FT_MS_CHANGEDATE
+ {
+ Pos = MAP_APPFONT ( 6 , 98 ) ;
+ Size = MAP_APPFONT ( 51 , 10 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "Modified:" ;
+ };
+ FixedText FT_MS_SHOW_CHANGEDATE
+ {
+ Pos = MAP_APPFONT ( 60 , 98 ) ;
+ Size = MAP_APPFONT ( 194 , 10 ) ;
+ };
+};
+
+/******************************************************************************/
+
+TabPage RID_SVXTABPAGE_GALLERYTHEME_FILES
+{
+ HelpId = HID_GALLERY_BROWSER ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_FILETYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 48 , 10 ) ;
+ Text [ en-US ] = "~File type" ;
+ };
+ ComboBox CBB_FILETYPE
+ {
+ Pos = MAP_APPFONT ( 57 , 6 ) ;
+ Size = MAP_APPFONT ( 121 , 69 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoSize = TRUE;
+ AutoHScroll = TRUE ;
+ };
+ MultiListBox LBX_FOUND
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 23 ) ;
+ Size = MAP_APPFONT ( 172 , 156 ) ;
+ TabStop = TRUE ;
+ SimpleMode = TRUE ;
+ };
+ PushButton BTN_SEARCH
+ {
+ Pos = MAP_APPFONT ( 184 , 6 ) ;
+ Size = MAP_APPFONT ( 70 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Find Files..." ;
+ };
+ PushButton BTN_TAKE
+ {
+ Pos = MAP_APPFONT ( 184 , 24 ) ;
+ Size = MAP_APPFONT ( 70 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Add" ;
+ };
+ PushButton BTN_TAKEALL
+ {
+ Pos = MAP_APPFONT ( 184 , 42 ) ;
+ Size = MAP_APPFONT ( 70 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "A~dd All" ;
+ };
+ CheckBox CBX_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 184 , 76 ) ;
+ Size = MAP_APPFONT ( 70 , 12 ) ;
+ Text [ en-US ] = "Pr~eview" ;
+ };
+ Window WND_BRSPRV
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 184 , 91 ) ;
+ Size = MAP_APPFONT ( 70 , 88 ) ;
+ };
+ PushButton BTN_MADDIN1
+ {
+ Pos = MAP_APPFONT ( 220 , 63 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Maddin1" ;
+ };
+ PushButton BTN_MADDIN2
+ {
+ Pos = MAP_APPFONT ( 220 , 80 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Maddin2" ;
+ };
+};
+
+/******************************************************************************/
+
+ModalDialog RID_SVXDLG_GALLERY_SEARCH_PROGRESS
+{
+ HelpId = HID_GALLERY_SEARCH ;
+ OutputSize = TRUE ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 124 , 86 ) ;
+ Text [ en-US ] = "Find" ;
+ Moveable = TRUE ;
+ FixedLine FL_SEARCH_DIR
+ {
+ Pos = MAP_APPFONT ( 6 , 33 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
+ Text [ en-US ] = "Directory" ;
+ };
+ FixedText FT_SEARCH_DIR
+ {
+ Pos = MAP_APPFONT ( 12 , 44 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 37 , 66 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SEARCH_TYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
+ Text [ en-US ] = "File type" ;
+ };
+ FixedText FT_SEARCH_TYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ };
+};
+
+/******************************************************************************/
+
+ModalDialog RID_SVXDLG_GALLERY_TAKE_PROGRESS
+{
+ HelpId = HID_GALLERY_APPLY ;
+ OutputSize = TRUE ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 124 , 56 ) ;
+ Text [ en-US ] = "Apply" ;
+ Moveable = TRUE ;
+ FixedLine FL_TAKE_PROGRESS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
+ Text [ en-US ] = "File" ;
+ };
+ FixedText FT_TAKE_FILE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 37 , 36 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+/******************************************************************************/
+
+ModalDialog RID_SVXDLG_GALLERY_ACTUALIZE_PROGRESS
+{
+ HelpId = HID_GALLERY_ACTUALIZE_PROGRESS;
+ OutputSize = TRUE ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 124 , 56 ) ;
+ Text [ en-US ] = "Update" ;
+ Moveable = TRUE ;
+ FixedLine FL_ACTUALIZE_PROGRESS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
+ Text [ en-US ] = "File" ;
+ };
+ FixedText FT_ACTUALIZE_FILE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 37 , 36 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+ModalDialog RID_SVXDLG_GALLERY_THEMEID
+{
+ OutputSize = TRUE ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 180 , 63 ) ;
+ Text [ en-US ] = "Theme ID" ;
+ Moveable = TRUE ;
+ OkButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 124 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 124 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_ID
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
+ Text [ en-US ] = "ID";
+ };
+ ListBox LB_RESNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 100 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ HScroll = TRUE ;
+ VScroll = TRUE ;
+ };
+};
+
+String RID_SVXSTR_GALLERY_NOFILES
+{
+ Text [ en-US ] = "<No Files>" ;
+};
+String RID_SVXSTR_GALLERY_SEARCH
+{
+ Text [ en-US ] = "Do you want to update the file list?" ;
+};
+String RID_SVXSTR_GALLERYPROPS_OBJECT
+{
+ Text [ en-US ] = "Object;Objects" ;
+};
+String RID_SVXSTR_GALLERYPROPS_GALTHEME
+{
+ Text [ en-US ] = "Gallery Theme" ;
+};
+String RID_SVXSTR_GALLERY_READONLY
+{
+ Text [ en-US ] = " (read-only)" ;
+};
+String RID_SVXSTR_GALLERY_ALLFILES
+{
+ Text [ en-US ] = "<All Files>" ;
+};
+String RID_SVXSTR_GALLERY_ID_EXISTS
+{
+ Text [ en-US ] = "This ID already exists..." ;
+};
+
+/******************************************************************************/
+
+Bitmap RID_SVXBMP_THEME_NORMAL_BIG
+{
+ File = "galnorl.bmp" ;
+};
+
+Bitmap RID_SVXBMP_THEME_IMPORTED_BIG
+{
+ File = "galimpl.bmp" ;
+};
+
+Bitmap RID_SVXBMP_THEME_READONLY_BIG
+{
+ File = "galrdol.bmp" ;
+};
+
+Bitmap RID_SVXBMP_THEME_DEFAULT_BIG
+{
+ File = "galdefl.bmp" ;
+};
+
+
diff --git a/cui/source/dialogs/grfflt.hrc b/cui/source/dialogs/grfflt.hrc
new file mode 100644
index 000000000000..b04d025d4d13
--- /dev/null
+++ b/cui/source/dialogs/grfflt.hrc
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: grfflt.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DLGFLT_HRC
+#define _SVX_DLGFLT_HRC
+
+// ----------
+// - Common -
+// ----------
+
+#define BTN_OK 101
+#define BTN_CANCEL 102
+#define BTN_HELP 103
+#define CTL_PREVIEW 105
+#define FL_PARAMETER 106
+
+// --------------------
+// - DLG_FILTERMOSAIC -
+// --------------------
+
+#define DLG_FILTERMOSAIC_FT_WIDTH 1
+#define DLG_FILTERMOSAIC_MTR_WIDTH 2
+#define DLG_FILTERMOSAIC_FT_HEIGHT 3
+#define DLG_FILTERMOSAIC_MTR_HEIGHT 4
+#define DLG_FILTERMOSAIC_CBX_EDGES 5
+
+// ----------------------
+// - DLG_FILTERSOLARIZE -
+// ----------------------
+
+#define DLG_FILTERSOLARIZE_FT_THRESHOLD 1
+#define DLG_FILTERSOLARIZE_MTR_THRESHOLD 2
+#define DLG_FILTERSOLARIZE_CBX_INVERT 3
+
+// -------------------
+// - DLG_FILTERSEPIA -
+// -------------------
+
+#define DLG_FILTERSEPIA_FT_SEPIA 1
+#define DLG_FILTERSEPIA_MTR_SEPIA 2
+
+// --------------------
+// - DLG_FILTERPOSTER -
+// --------------------
+
+#define DLG_FILTERPOSTER_FT_POSTER 1
+#define DLG_FILTERPOSTER_NUM_POSTER 2
+
+// --------------------
+// - DLG_FILTEREMBOSS -
+// --------------------
+
+#define DLG_FILTEREMBOSS_FT_LIGHT 1
+#define DLG_FILTEREMBOSS_CTL_LIGHT 2
+
+#endif
diff --git a/cui/source/dialogs/grfflt.src b/cui/source/dialogs/grfflt.src
new file mode 100644
index 000000000000..ba1398d98b59
--- /dev/null
+++ b/cui/source/dialogs/grfflt.src
@@ -0,0 +1,456 @@
+/*************************************************************************
+ *
+ * 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: grfflt.src,v $
+ * $Revision: 1.45 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "grfflt.hrc"
+
+// --------------------
+// - DLG_FILTERMOSAIC -
+// --------------------
+
+ModalDialog RID_SVX_GRFFILTER_DLG_MOSAIC
+{
+ HelpID = SID_GRFFILTER_MOSAIC;
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 250, 100 ) ;
+
+ Text [ en-US ] = "Mosaic" ;
+
+ FixedLine FL_PARAMETER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Parameters";
+ };
+ Control CTL_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ;
+ Size = MAP_APPFONT ( 81, 73 ) ;
+ };
+#define MA_Y0 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP
+ FixedText DLG_FILTERMOSAIC_FT_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12, MA_Y0 ) ;
+ Size = MAP_APPFONT ( 77, 10 ) ;
+ Text [ en-US ] = "~Width" ;
+ };
+#define MA_Y1 MA_Y0 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y
+ MetricField DLG_FILTERMOSAIC_MTR_WIDTH
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , MA_Y1 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 999 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " Pixel" ;
+ First = 1 ;
+ Last = 999 ;
+ SpinSize = 1 ;
+ };
+#define MA_Y2 MA_Y1 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y
+ FixedText DLG_FILTERMOSAIC_FT_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12, MA_Y2 ) ;
+ Size = MAP_APPFONT ( 77, 10 ) ;
+ Text [ en-US ] = "H~eight" ;
+ };
+#define MA_Y3 MA_Y2 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y
+ MetricField DLG_FILTERMOSAIC_MTR_HEIGHT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12, MA_Y3 ) ;
+ Size = MAP_APPFONT ( 35, 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 999 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " Pixel" ;
+ First = 1 ;
+ Last = 999 ;
+ SpinSize = 1 ;
+ };
+#define MA_Y4 MA_Y3 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_Y
+ CheckBox DLG_FILTERMOSAIC_CBX_EDGES
+ {
+ Pos = MAP_APPFONT ( 12, MA_Y4 ) ;
+ Size = MAP_APPFONT ( 91, 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "E~nhance edges" ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 194, 6 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ TabStop = TRUE ;
+ DefButton = 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 ;
+ };
+};
+
+// ----------------------
+// - DLG_FILTERSOLARIZE -
+// ----------------------
+
+ModalDialog RID_SVX_GRFFILTER_DLG_SOLARIZE
+{
+ HelpID = SID_GRFFILTER_SOLARIZE;
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 250, 100 ) ;
+
+ Text [ en-US ] = "Solarization" ;
+
+ FixedLine FL_PARAMETER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Parameters";
+ };
+ Control CTL_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ;
+ Size = MAP_APPFONT ( 81, 73 ) ;
+ };
+#define MA_Y5 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP
+ FixedText DLG_FILTERSOLARIZE_FT_THRESHOLD
+ {
+ Pos = MAP_APPFONT ( 12, MA_Y5 ) ;
+ Size = MAP_APPFONT ( 77 , 10 ) ;
+ Text [ en-US ] = "Threshold ~value" ;
+ };
+#define MA_Y6 MA_Y5 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y
+ MetricField DLG_FILTERSOLARIZE_MTR_THRESHOLD
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , MA_Y6 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ };
+#define MA_Y7 MA_Y6 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y
+ CheckBox DLG_FILTERSOLARIZE_CBX_INVERT
+ {
+ Pos = MAP_APPFONT ( 12, 46 ) ;
+ Size = MAP_APPFONT ( 77, 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Invert" ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 194, 6 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ TabStop = TRUE ;
+ DefButton = 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 ;
+ };
+};
+
+// ----------------------
+// - DLG_FILTERSOLARIZE -
+// ----------------------
+
+ModalDialog RID_SVX_GRFFILTER_DLG_SEPIA
+{
+ HelpID = SID_GRFFILTER_SEPIA;
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 250, 100 ) ;
+
+ Text [ en-US ] = "Aging" ;
+
+ FixedLine FL_PARAMETER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Parameters";
+ };
+ Control CTL_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ;
+ Size = MAP_APPFONT ( 81, 73 ) ;
+ };
+#define MA_Y8 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP
+ FixedText DLG_FILTERSEPIA_FT_SEPIA
+ {
+ Pos = MAP_APPFONT ( 12 , MA_Y8 ) ;
+ Size = MAP_APPFONT ( 77 , 10 ) ;
+ Text [ en-US ] = "Aging degree" ;
+ };
+#define MA_Y9 MA_Y8 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y
+ MetricField DLG_FILTERSEPIA_MTR_SEPIA
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , MA_Y9 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ TabStop = TRUE ;
+ Right = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 194, 6 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ TabStop = TRUE ;
+ DefButton = 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 ;
+ };
+};
+
+// --------------------
+// - DLG_FILTERPOSTER -
+// --------------------
+
+ModalDialog RID_SVX_GRFFILTER_DLG_POSTER
+{
+ HelpID = SID_GRFFILTER_POSTER;
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 250, 100 ) ;
+
+ Text [ en-US ] = "Posterize" ;
+
+ FixedLine FL_PARAMETER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Parameters";
+ };
+ Control CTL_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ;
+ Size = MAP_APPFONT ( 81, 73 ) ;
+ };
+#define MA_Y10 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP
+ FixedText DLG_FILTERPOSTER_FT_POSTER
+ {
+ Pos = MAP_APPFONT ( 12 , MA_Y10 ) ;
+ Size = MAP_APPFONT ( 77 , 10 ) ;
+ Text [ en-US ] = "Poster colors" ;
+ };
+#define MA_Y11 MA_Y10 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y
+ NumericField DLG_FILTERPOSTER_NUM_POSTER
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , MA_Y11 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 2 ;
+ Maximum = 64 ;
+ StrictFormat = TRUE ;
+ First = 2 ;
+ Last = 64 ;
+ SpinSize = 1 ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 194, 6 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ TabStop = TRUE ;
+ DefButton = 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 ;
+ };
+};
+
+// --------------------
+// - DLG_FILTEREMBOSS -
+// --------------------
+
+TabPage RID_SVX_GRFFILTER_DLG_EMBOSS_TAB
+{
+ Pos = MAP_APPFONT ( 0, 0 ) ;
+ Size = MAP_APPFONT ( 0, 0 ) ;
+};
+
+ModalDialog RID_SVX_GRFFILTER_DLG_EMBOSS
+{
+ HelpID = SID_GRFFILTER_EMBOSS;
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 250, 100 ) ;
+
+ Text [ en-US ] = "Relief" ;
+
+ FixedLine FL_PARAMETER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Parameters";
+ };
+ Control CTL_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ;
+ Size = MAP_APPFONT ( 81, 73 ) ;
+ };
+#define MA_Y12 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP
+ FixedText DLG_FILTEREMBOSS_FT_LIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , MA_Y12 ) ;
+ Size = MAP_APPFONT ( 77 , 10 ) ;
+ Text [ en-US ] = "Light source" ;
+ };
+#define MA_Y13 MA_Y12 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y
+ Control DLG_FILTEREMBOSS_CTL_LIGHT
+ {
+ HelpID = HID_GRFFILTER_EMBOSS_LIGHT ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , MA_Y13 ) ;
+ Size = MAP_APPFONT ( 77 , 60 ) ;
+ TabStop = TRUE ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 194, 6 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ TabStop = TRUE ;
+ DefButton = 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 ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
new file mode 100644
index 000000000000..5f062c643443
--- /dev/null
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -0,0 +1,1913 @@
+/*************************************************************************
+ *
+ * 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: hangulhanjadlg.cxx,v $
+ * $Revision: 1.19 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "hangulhanjadlg.hxx"
+#include "hangulhanjadlg.hrc"
+#include "commonlingui.hxx"
+#include <svx/dialmgr.hxx>
+
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+#include <algorithm>
+#include <tools/urlobj.hxx>
+#include <vcl/controllayout.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/lingucfg.hxx>
+#include <unotools/linguprops.hxx>
+#include <com/sun/star/linguistic2/ConversionDictionaryType.hpp>
+#include <com/sun/star/linguistic2/ConversionDirection.hdl>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/TextConversionOption.hdl>
+#include <com/sun/star/util/XFlushable.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+#define HHC HangulHanjaConversion
+#define LINE_CNT static_cast< USHORT >(2)
+
+//.............................................................................
+namespace svx
+{
+//.............................................................................
+/*
+ using HangulHanjaConversion::eSimpleConversion;
+ using HangulHanjaConversion::eHangulBracketed;
+ using HangulHanjaConversion::eHanjaBracketed;
+ using HangulHanjaConversion::eRubyHanjaAbove;
+ using HangulHanjaConversion::eRubyHanjaBelow;
+ using HangulHanjaConversion::eRubyHangulAbove;
+ using HangulHanjaConversion::eRubyHangulBelow;
+*/
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::linguistic2;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::container;
+ using ::rtl::OUString;
+
+ //-------------------------------------------------------------------------
+ namespace
+ {
+ class FontSwitch
+ {
+ private:
+ OutputDevice& m_rDev;
+
+ public:
+ inline FontSwitch( OutputDevice& _rDev, const Font& _rTemporaryFont )
+ :m_rDev( _rDev )
+ {
+ m_rDev.Push( PUSH_FONT );
+ m_rDev.SetFont( _rTemporaryFont );
+ }
+ inline ~FontSwitch( )
+ {
+ m_rDev.Pop( );
+ }
+ };
+ }
+
+ //=========================================================================
+ //= PseudoRubyText
+ //=========================================================================
+ /** a class which allows to draw two texts in a pseudo-ruby way (which basically
+ means one text above or below the other, and a little bit smaller)
+ */
+ class PseudoRubyText
+ {
+ public:
+ enum RubyPosition
+ {
+ eAbove, eBelow
+ };
+
+ protected:
+ const String m_sPrimaryText;
+ const String m_sSecondaryText;
+ const RubyPosition m_ePosition;
+
+ public:
+ PseudoRubyText( const String& _rPrimary, const String& _rSecondary, const RubyPosition _ePosition );
+
+ public:
+ void Paint( OutputDevice& _rDevice, const Rectangle& _rRect, USHORT _nTextStyle,
+ Rectangle* _pPrimaryLocation = NULL, Rectangle* _pSecondaryLocation = NULL,
+ ::vcl::ControlLayoutData* _pLayoutData = NULL );
+ };
+
+ //-------------------------------------------------------------------------
+ PseudoRubyText::PseudoRubyText( const String& _rPrimary, const String& _rSecondary, const RubyPosition _ePosition )
+ :m_sPrimaryText( _rPrimary )
+ ,m_sSecondaryText( _rSecondary )
+ ,m_ePosition( _ePosition )
+ {
+ }
+
+ //-------------------------------------------------------------------------
+ void PseudoRubyText::Paint( OutputDevice& _rDevice, const Rectangle& _rRect, USHORT _nTextStyle,
+ Rectangle* _pPrimaryLocation, Rectangle* _pSecondaryLocation, ::vcl::ControlLayoutData* _pLayoutData )
+ {
+ bool bLayoutOnly = NULL != _pLayoutData;
+ MetricVector* pTextMetrics = bLayoutOnly ? &_pLayoutData->m_aUnicodeBoundRects : NULL;
+ String* pDisplayText = bLayoutOnly ? &_pLayoutData->m_aDisplayText : NULL;
+
+ Size aPlaygroundSize( _rRect.GetSize() );
+
+ // the font for the secondary text:
+ Font aSmallerFont( _rDevice.GetFont() );
+ // heuristic: 80% of the original size
+ aSmallerFont.SetHeight( (long)( 0.8 * aSmallerFont.GetHeight() ) );
+
+ // let's calculate the size of our two texts
+ Rectangle aPrimaryRect = _rDevice.GetTextRect( _rRect, m_sPrimaryText, _nTextStyle );
+ Rectangle aSecondaryRect;
+ {
+ FontSwitch aFontRestore( _rDevice, aSmallerFont );
+ aSecondaryRect = _rDevice.GetTextRect( _rRect, m_sSecondaryText, _nTextStyle );
+ }
+
+ // position these rectangles properly
+ // x-axis:
+ sal_Int32 nCombinedWidth = ::std::max( aSecondaryRect.GetWidth(), aPrimaryRect.GetWidth() );
+ // the rectangle where both texts will reside is as high as possible, and as wide as the
+ // widest of both text rects
+ aPrimaryRect.Left() = aSecondaryRect.Left() = _rRect.Left();
+ aPrimaryRect.Right() = aSecondaryRect.Right() = _rRect.Left() + nCombinedWidth;
+ if ( TEXT_DRAW_RIGHT & _nTextStyle )
+ {
+ // move the rectangles to the right
+ aPrimaryRect.Move( aPlaygroundSize.Width() - nCombinedWidth, 0 );
+ aSecondaryRect.Move( aPlaygroundSize.Width() - nCombinedWidth, 0 );
+ }
+ else if ( TEXT_DRAW_CENTER & _nTextStyle )
+ {
+ // center the rectangles
+ aPrimaryRect.Move( ( aPlaygroundSize.Width() - nCombinedWidth ) / 2, 0 );
+ aSecondaryRect.Move( ( aPlaygroundSize.Width() - nCombinedWidth ) / 2, 0 );
+ }
+
+ // y-axis:
+ sal_Int32 nCombinedHeight = aPrimaryRect.GetHeight() + aSecondaryRect.GetHeight();
+ // align to the top, for the moment
+ aPrimaryRect.Move( 0, _rRect.Top() - aPrimaryRect.Top() );
+ aSecondaryRect.Move( 0, aPrimaryRect.Top() + aPrimaryRect.GetHeight() - aSecondaryRect.Top() );
+ if ( TEXT_DRAW_BOTTOM & _nTextStyle )
+ {
+ // move the rects to the bottom
+ aPrimaryRect.Move( 0, aPlaygroundSize.Height() - nCombinedHeight );
+ aSecondaryRect.Move( 0, aPlaygroundSize.Height() - nCombinedHeight );
+ }
+ else if ( TEXT_DRAW_VCENTER & _nTextStyle )
+ {
+ // move the rects to the bottom
+ aPrimaryRect.Move( 0, ( aPlaygroundSize.Height() - nCombinedHeight ) / 2 );
+ aSecondaryRect.Move( 0, ( aPlaygroundSize.Height() - nCombinedHeight ) / 2 );
+ }
+
+ // 'til here, everything we did assumes that the secondary text is painted _below_ the primary
+ // text. If this isn't the case, we need to correct the rectangles
+ if ( eAbove == m_ePosition )
+ {
+ sal_Int32 nVertDistance = aSecondaryRect.Top() - aPrimaryRect.Top();
+ aSecondaryRect.Move( 0, -nVertDistance );
+ aPrimaryRect.Move( 0, nCombinedHeight - nVertDistance );
+ }
+
+ // now draw the texts
+ // as we already calculated the precise rectangles for the texts, we don't want to
+ // use the alignment flags given - within it's rect, every text is centered
+ USHORT nDrawTextStyle( _nTextStyle );
+ nDrawTextStyle &= ~( TEXT_DRAW_RIGHT | TEXT_DRAW_LEFT | TEXT_DRAW_BOTTOM | TEXT_DRAW_TOP );
+ nDrawTextStyle |= TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER;
+
+ _rDevice.DrawText( aPrimaryRect, m_sPrimaryText, nDrawTextStyle, pTextMetrics, pDisplayText );
+ {
+ FontSwitch aFontRestore( _rDevice, aSmallerFont );
+ _rDevice.DrawText( aSecondaryRect, m_sSecondaryText, nDrawTextStyle, pTextMetrics, pDisplayText );
+ }
+
+ // outta here
+ if ( _pPrimaryLocation )
+ *_pPrimaryLocation = aPrimaryRect;
+ if ( _pSecondaryLocation )
+ *_pSecondaryLocation = aSecondaryRect;
+ }
+
+ //=========================================================================
+ //= RubyRadioButton
+ //=========================================================================
+ class RubyRadioButton :public RadioButton
+ ,protected PseudoRubyText
+ {
+ using svx::PseudoRubyText::Paint;
+
+ public:
+ RubyRadioButton(
+ Window* _pParent,
+ const ResId& _rId, // the text in the resource will be taken as primary text
+ const String& _rSecondary, // this will be the secondary text which will be printed somewhat smaller
+ const PseudoRubyText::RubyPosition _ePosition );
+
+ protected:
+ virtual void Paint( const Rectangle& _rRect );
+ };
+
+ //-------------------------------------------------------------------------
+ RubyRadioButton::RubyRadioButton( Window* _pParent, const ResId& _rId,
+ const String& _rSecondary, const PseudoRubyText::RubyPosition _ePosition )
+ :RadioButton( _pParent, _rId )
+ ,PseudoRubyText( RadioButton::GetText(), _rSecondary, _ePosition )
+ {
+ }
+
+ //-------------------------------------------------------------------------
+ void RubyRadioButton::Paint( const Rectangle& )
+ {
+ HideFocus();
+
+ // calculate the size of the radio image - we're to paint our text _after_ this image
+ DBG_ASSERT( !GetModeRadioImage(), "RubyRadioButton::Paint: images not supported!" );
+ Size aImageSize = GetRadioImage( GetSettings(), 0 ).GetSizePixel();
+ aImageSize.Width() = CalcZoom( aImageSize.Width() );
+ aImageSize.Height() = CalcZoom( aImageSize.Height() );
+
+ Rectangle aOverallRect( Point( 0, 0 ), GetOutputSizePixel() );
+ aOverallRect.Left() += aImageSize.Width() + 4; // 4 is the separator between the image and the text
+ // inflate the rect a little bit (because the VCL radio button does the same)
+ Rectangle aTextRect( aOverallRect );
+ ++aTextRect.Left(); --aTextRect.Right();
+ ++aTextRect.Top(); --aTextRect.Bottom();
+
+ // calculate the text flags for the painting
+ USHORT nTextStyle = TEXT_DRAW_MNEMONIC;
+ WinBits nStyle = GetStyle( );
+
+ // the horizontal alignment
+ if ( nStyle & WB_RIGHT )
+ nTextStyle |= TEXT_DRAW_RIGHT;
+ else if ( nStyle & WB_CENTER )
+ nTextStyle |= TEXT_DRAW_CENTER;
+ else
+ nTextStyle |= TEXT_DRAW_LEFT;
+ // the vertical alignment
+ if ( nStyle & WB_BOTTOM )
+ nTextStyle |= TEXT_DRAW_BOTTOM;
+ else if ( nStyle & WB_VCENTER )
+ nTextStyle |= TEXT_DRAW_VCENTER;
+ else
+ nTextStyle |= TEXT_DRAW_TOP;
+ // mnemonics
+ if ( 0 == ( nStyle & WB_NOLABEL ) )
+ nTextStyle |= TEXT_DRAW_MNEMONIC;
+
+ // paint the ruby text
+ Rectangle aPrimaryTextLocation, aSecondaryTextLocation;
+ PseudoRubyText::Paint( *this, aTextRect, nTextStyle, &aPrimaryTextLocation, &aSecondaryTextLocation );
+
+ // the focus rectangle is to be painted around both texts
+ Rectangle aCombinedRect( aPrimaryTextLocation );
+ aCombinedRect.Union( aSecondaryTextLocation );
+ SetFocusRect( aCombinedRect );
+
+ // let the base class paint the radio button
+ // for this, give it the proper location to paint the image (vertically centered, relative to our text)
+ Rectangle aImageLocation( Point( 0, 0 ), aImageSize );
+ sal_Int32 nTextHeight = aSecondaryTextLocation.Bottom() - aPrimaryTextLocation.Top();
+ aImageLocation.Top() = aPrimaryTextLocation.Top() + ( nTextHeight - aImageSize.Height() ) / 2;
+ aImageLocation.Bottom() = aImageLocation.Top() + aImageSize.Height();
+ SetStateRect( aImageLocation );
+ DrawRadioButtonState( );
+
+ // mouse clicks should be recognized in a rect which is one pixel larger in each direction, plus
+ // includes the image
+ aCombinedRect.Left() = aImageLocation.Left(); ++aCombinedRect.Right();
+ --aCombinedRect.Top(); ++aCombinedRect.Bottom();
+ SetMouseRect( aCombinedRect );
+
+ // paint the focus rect, if necessary
+ if ( HasFocus() )
+ ShowFocus( aTextRect );
+ }
+
+ //=========================================================================
+ //= SuggestionSet
+ //=========================================================================
+ //-------------------------------------------------------------------------
+
+ SuggestionSet::SuggestionSet( Window* pParent )
+ : ValueSet( pParent, pParent->GetStyle() | WB_BORDER )
+
+ {
+ }
+
+ SuggestionSet::~SuggestionSet()
+ {
+ ClearSet();
+ }
+
+ void SuggestionSet::UserDraw( const UserDrawEvent& rUDEvt )
+ {
+ OutputDevice* pDev = rUDEvt.GetDevice();
+ Rectangle aRect = rUDEvt.GetRect();
+ USHORT nItemId = rUDEvt.GetItemId();
+
+ String sText = *static_cast< String* >( GetItemData( nItemId ) );
+ pDev->DrawText( aRect, sText, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER );
+ }
+
+ void SuggestionSet::ClearSet()
+ {
+ USHORT i, nCount = GetItemCount();
+ for ( i = 0; i < nCount; ++i )
+ delete static_cast< String* >( GetItemData(i) );
+ Clear();
+ }
+
+ //=========================================================================
+ //= SuggestionDisplay
+ //=========================================================================
+ //-------------------------------------------------------------------------
+
+ SuggestionDisplay::SuggestionDisplay( Window* pParent, const ResId& rResId )
+ : Control( pParent, rResId )
+ , m_bDisplayListBox(true)
+ , m_aValueSet(this)
+ , m_aListBox(this,GetStyle() | WB_BORDER )
+ , m_bInSelectionUpdate(false)
+ {
+ m_aValueSet.SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) );
+ m_aListBox.SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) );
+
+ m_aValueSet.SetLineCount( LINE_CNT );
+ m_aValueSet.SetStyle( m_aValueSet.GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_VSCROLL );
+ m_aValueSet.SetBorderStyle( WINDOW_BORDER_MONO );
+ String aOneCharacter(RTL_CONSTASCII_STRINGPARAM("AU"));
+ long nItemWidth = 2*GetTextWidth( aOneCharacter );
+ m_aValueSet.SetItemWidth( nItemWidth );
+
+ Point aPos(0,0);
+ Size aSize(GetSizePixel());
+ m_aValueSet.SetSizePixel(aSize);
+ m_aListBox.SetSizePixel(aSize);
+
+ implUpdateDisplay();
+ }
+
+ SuggestionDisplay::~SuggestionDisplay()
+ {
+ }
+
+ void SuggestionDisplay::implUpdateDisplay()
+ {
+ bool bShowBox = IsVisible() && m_bDisplayListBox;
+ bool bShowSet = IsVisible() && !m_bDisplayListBox;
+
+ m_aListBox.Show(bShowBox);
+ m_aValueSet.Show(bShowSet);
+ }
+
+ void SuggestionDisplay::StateChanged( StateChangedType nStateChange )
+ {
+ if( STATE_CHANGE_VISIBLE == nStateChange )
+ implUpdateDisplay();
+ }
+
+ Control& SuggestionDisplay::implGetCurrentControl()
+ {
+ if( m_bDisplayListBox )
+ return m_aListBox;
+ return m_aValueSet;
+ }
+
+ void SuggestionDisplay::KeyInput( const KeyEvent& rKEvt )
+ {
+ implGetCurrentControl().KeyInput( rKEvt );
+ }
+ void SuggestionDisplay::KeyUp( const KeyEvent& rKEvt )
+ {
+ implGetCurrentControl().KeyUp( rKEvt );
+ }
+ void SuggestionDisplay::Activate()
+ {
+ implGetCurrentControl().Activate();
+ }
+ void SuggestionDisplay::Deactivate()
+ {
+ implGetCurrentControl().Deactivate();
+ }
+ void SuggestionDisplay::GetFocus()
+ {
+ implGetCurrentControl().GetFocus();
+ }
+ void SuggestionDisplay::LoseFocus()
+ {
+ implGetCurrentControl().LoseFocus();
+ }
+ void SuggestionDisplay::Command( const CommandEvent& rCEvt )
+ {
+ implGetCurrentControl().Command( rCEvt );
+ }
+
+ void SuggestionDisplay::DisplayListBox( bool bDisplayListBox )
+ {
+ if( m_bDisplayListBox != bDisplayListBox )
+ {
+ Control& rOldControl = implGetCurrentControl();
+ BOOL bHasFocus = rOldControl.HasFocus();
+
+ m_bDisplayListBox = bDisplayListBox;
+
+ if( bHasFocus )
+ {
+ Control& rNewControl = implGetCurrentControl();
+ rNewControl.GrabFocus();
+ }
+
+ implUpdateDisplay();
+ }
+ }
+
+ IMPL_LINK( SuggestionDisplay, SelectSuggestionHdl, Control*, pControl )
+ {
+ if( m_bInSelectionUpdate )
+ return 0L;
+
+ m_bInSelectionUpdate = true;
+ if(pControl==&m_aListBox)
+ {
+ USHORT nPos = m_aListBox.GetSelectEntryPos();
+ m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning)
+ }
+ else
+ {
+ USHORT nPos = m_aValueSet.GetSelectItemId()-1; //itemid == pos+1 (id 0 has special meaning)
+ m_aListBox.SelectEntryPos( nPos );
+ }
+ m_bInSelectionUpdate = false;
+ m_aSelectLink.Call(this);
+ return 0L;
+ }
+
+ void SuggestionDisplay::SetSelectHdl( const Link& rLink )
+ {
+ m_aSelectLink = rLink;
+ }
+ void SuggestionDisplay::Clear()
+ {
+ m_aListBox.Clear();
+ m_aValueSet.Clear();
+ }
+ void SuggestionDisplay::InsertEntry( const XubString& rStr )
+ {
+ USHORT nItemId = m_aListBox.InsertEntry( rStr ) + 1; //itemid == pos+1 (id 0 has special meaning)
+ m_aValueSet.InsertItem( nItemId );
+ String* pItemData = new String(rStr);
+ m_aValueSet.SetItemData( nItemId, pItemData );
+ }
+ void SuggestionDisplay::SelectEntryPos( USHORT nPos )
+ {
+ m_aListBox.SelectEntryPos( nPos );
+ m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning)
+ }
+ USHORT SuggestionDisplay::GetEntryCount() const
+ {
+ return m_aListBox.GetEntryCount();
+ }
+ XubString SuggestionDisplay::GetEntry( USHORT nPos ) const
+ {
+ return m_aListBox.GetEntry( nPos );
+ }
+ XubString SuggestionDisplay::GetSelectEntry() const
+ {
+ return m_aListBox.GetSelectEntry();
+ }
+ void SuggestionDisplay::SetHelpIds()
+ {
+ this->SetHelpId( HID_HANGULDLG_SUGGESTIONS );
+ m_aValueSet.SetHelpId( HID_HANGULDLG_SUGGESTIONS_GRID );
+ m_aListBox.SetHelpId( HID_HANGULDLG_SUGGESTIONS_LIST );
+ }
+
+ //=========================================================================
+ //= HangulHanjaConversionDialog
+ //=========================================================================
+ //-------------------------------------------------------------------------
+ HangulHanjaConversionDialog::HangulHanjaConversionDialog( Window* _pParent, HHC::ConversionDirection _ePrimaryDirection )
+ :ModalDialog( _pParent, SVX_RES( RID_SVX_MDLG_HANGULHANJA ) )
+ ,m_pPlayground( new SvxCommonLinguisticControl( this ) )
+ ,m_aFind ( m_pPlayground.get(), SVX_RES( PB_FIND ) )
+ ,m_aSuggestions ( m_pPlayground.get(), SVX_RES( CTL_SUGGESTIONS ) )
+ ,m_aFormat ( m_pPlayground.get(), SVX_RES( FT_FORMAT ) )
+ ,m_aSimpleConversion( m_pPlayground.get(), SVX_RES( RB_SIMPLE_CONVERSION ) )
+ ,m_aHangulBracketed ( m_pPlayground.get(), SVX_RES( RB_HANJA_HANGUL_BRACKETED ) )
+ ,m_aHanjaBracketed ( m_pPlayground.get(), SVX_RES( RB_HANGUL_HANJA_BRACKETED ) )
+ ,m_aConversion ( m_pPlayground.get(), SVX_RES( FT_CONVERSION ) )
+ ,m_aHangulOnly ( m_pPlayground.get(), SVX_RES( CB_HANGUL_ONLY ) )
+ ,m_aHanjaOnly ( m_pPlayground.get(), SVX_RES( CB_HANJA_ONLY ) )
+ ,m_aReplaceByChar ( m_pPlayground.get(), SVX_RES( CB_REPLACE_BY_CHARACTER ) )
+ ,m_pIgnoreNonPrimary( NULL )
+ ,m_bDocumentMode( true )
+ {
+ // special creation of the 4 pseudo-ruby radio buttons
+ String sSecondaryHangul( SVX_RES( STR_HANGUL ) );
+ String sSecondaryHanja( SVX_RES( STR_HANJA ) );
+ m_pHanjaAbove.reset( new RubyRadioButton( m_pPlayground.get(), SVX_RES( RB_HANGUL_HANJA_ABOVE ), sSecondaryHanja, PseudoRubyText::eAbove ) );
+ m_pHanjaBelow.reset( new RubyRadioButton( m_pPlayground.get(), SVX_RES( RB_HANGUL_HANJA_BELOW ), sSecondaryHanja, PseudoRubyText::eBelow ) );
+ m_pHangulAbove.reset( new RubyRadioButton( m_pPlayground.get(), SVX_RES( RB_HANJA_HANGUL_ABOVE ), sSecondaryHangul, PseudoRubyText::eAbove ) );
+ m_pHangulBelow.reset( new RubyRadioButton( m_pPlayground.get(), SVX_RES( RB_HANJA_HANGUL_BELOW ), sSecondaryHangul, PseudoRubyText::eBelow ) );
+
+ // since these 4 buttons are not created within the other members, they have a wrong initial Z-Order
+ // correct this
+ m_pHanjaAbove->SetZOrder( &m_aHanjaBracketed, WINDOW_ZORDER_BEHIND );
+ m_pHanjaBelow->SetZOrder( m_pHanjaAbove.get(), WINDOW_ZORDER_BEHIND );
+ m_pHangulAbove->SetZOrder( m_pHanjaBelow.get(), WINDOW_ZORDER_BEHIND );
+ m_pHangulBelow->SetZOrder( m_pHangulAbove.get(), WINDOW_ZORDER_BEHIND );
+
+ // VCL automatically sets the WB_GROUP bit, if the previous sibling (at the moment of creation)
+ // is no radion button
+ m_pHanjaAbove->SetStyle( m_pHanjaAbove->GetStyle() & ~WB_GROUP );
+
+ // the "Find" button and the word input control may not have the proper distance/extensions
+ // -> correct this
+ Point aDistance = LogicToPixel( Point( 3, 0 ), MAP_APPFONT );
+ sal_Int32 nTooLargeByPixels =
+ // right margin of the word input control
+ ( m_pPlayground->GetWordInputControl().GetPosPixel().X()
+ + m_pPlayground->GetWordInputControl().GetSizePixel().Width()
+ )
+ // minus left margin of the find button
+ - m_aFind.GetPosPixel().X()
+ // plus desired distance between the both
+ + aDistance.X();
+ // make the word input control smaller
+ Size aSize = m_pPlayground->GetWordInputControl().GetSizePixel();
+ aSize.Width() -= nTooLargeByPixels;
+ m_pPlayground->GetWordInputControl().SetSizePixel( aSize );
+
+ // additionall, the playground is not wide enough (in it's default size)
+ sal_Int32 nEnlargeWidth = 0;
+ {
+ FixedText aBottomAnchor( m_pPlayground.get(), SVX_RES( FT_RESIZE_ANCHOR ) );
+ Point aAnchorPos = aBottomAnchor.GetPosPixel();
+
+ nEnlargeWidth = aAnchorPos.X() - m_pPlayground->GetActionButtonsLocation().X();
+ }
+ m_pPlayground->Enlarge( nEnlargeWidth, 0 );
+
+ // insert our controls into the z-order of the playground
+ m_pPlayground->InsertControlGroup( m_aFind, m_aFind, SvxCommonLinguisticControl::eLeftRightWords );
+ m_pPlayground->InsertControlGroup( m_aSuggestions, m_aHanjaOnly, SvxCommonLinguisticControl::eSuggestionLabel );
+ m_pPlayground->InsertControlGroup( m_aReplaceByChar, m_aReplaceByChar, SvxCommonLinguisticControl::eActionButtons );
+
+ m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eClose, LINK( this, HangulHanjaConversionDialog, OnClose ) );
+ m_pPlayground->GetWordInputControl().SetModifyHdl( LINK( this, HangulHanjaConversionDialog, OnSuggestionModified ) );
+ m_aSuggestions.SetSelectHdl( LINK( this, HangulHanjaConversionDialog, OnSuggestionSelected ) );
+
+ m_aReplaceByChar.SetClickHdl( LINK( this, HangulHanjaConversionDialog, ClickByCharacterHdl ) );
+
+ m_aHangulOnly.SetClickHdl( LINK( this, HangulHanjaConversionDialog, OnConversionDirectionClicked ) );
+ m_aHanjaOnly.SetClickHdl( LINK( this, HangulHanjaConversionDialog, OnConversionDirectionClicked ) );
+
+ m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eOptions,
+ LINK( this, HangulHanjaConversionDialog, OnOption ) );
+ m_pPlayground->GetButton( SvxCommonLinguisticControl::eOptions )->Show();
+// m_pPlayground->EnableButton( SvxCommonLinguisticControl::eOptions, true );
+
+ if ( HangulHanjaConversion::eHangulToHanja == _ePrimaryDirection )
+ {
+// m_aHanjaOnly.Enable( sal_False );
+ m_pIgnoreNonPrimary = &m_aHangulOnly;
+ }
+ else
+ {
+// m_aHangulOnly.Enable( sal_False );
+ m_pIgnoreNonPrimary = &m_aHanjaOnly;
+ }
+// m_pIgnoreNonPrimary->Check();
+
+ // initial focus
+ FocusSuggestion( );
+
+ // initial control values
+ m_aSimpleConversion.Check();
+
+ m_pPlayground->GetButton(SvxCommonLinguisticControl::eClose )->SetHelpId(HID_HANGULDLG_BUTTON_CLOSE );
+ m_pPlayground->GetButton(SvxCommonLinguisticControl::eIgnore )->SetHelpId(HID_HANGULDLG_BUTTON_IGNORE );
+ m_pPlayground->GetButton(SvxCommonLinguisticControl::eIgnoreAll )->SetHelpId(HID_HANGULDLG_BUTTON_IGNOREALL);
+ m_pPlayground->GetButton(SvxCommonLinguisticControl::eChange )->SetHelpId(HID_HANGULDLG_BUTTON_CHANGE );
+ m_pPlayground->GetButton(SvxCommonLinguisticControl::eChangeAll )->SetHelpId(HID_HANGULDLG_BUTTON_CHANGEALL);
+ m_pPlayground->GetButton(SvxCommonLinguisticControl::eOptions )->SetHelpId(HID_HANGULDLG_BUTTON_OPTIONS );
+ m_pPlayground->GetWordInputControl().SetHelpId(HID_HANGULDLG_EDIT_NEWWORD);
+
+ FreeResource();
+
+ m_aSuggestions.SetHelpIds();
+ }
+
+ //-------------------------------------------------------------------------
+ HangulHanjaConversionDialog::~HangulHanjaConversionDialog( )
+ {
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::FillSuggestions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rSuggestions )
+ {
+ m_aSuggestions.Clear();
+
+ const ::rtl::OUString* pSuggestions = _rSuggestions.getConstArray();
+ const ::rtl::OUString* pSuggestionsEnd = _rSuggestions.getConstArray() + _rSuggestions.getLength();
+ while ( pSuggestions != pSuggestionsEnd )
+ m_aSuggestions.InsertEntry( *pSuggestions++ );
+
+ // select the first suggestion, and fill in the suggestion edit field
+ String sFirstSuggestion;
+ if ( m_aSuggestions.GetEntryCount() )
+ {
+ sFirstSuggestion = m_aSuggestions.GetEntry( 0 );
+ m_aSuggestions.SelectEntryPos( 0 );
+ }
+ m_pPlayground->GetWordInputControl().SetText( sFirstSuggestion );
+ m_pPlayground->GetWordInputControl().SaveValue();
+ OnSuggestionModified( &m_pPlayground->GetWordInputControl() );
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetOptionsChangedHdl( const Link& _rHdl )
+ {
+ m_aOptionsChangedLink = _rHdl;
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetIgnoreHdl( const Link& _rHdl )
+ {
+ m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eIgnore, _rHdl );
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetIgnoreAllHdl( const Link& _rHdl )
+ {
+ m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eIgnoreAll, _rHdl );
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetChangeHdl( const Link& _rHdl )
+ {
+ m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eChange, _rHdl );
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetChangeAllHdl( const Link& _rHdl )
+ {
+ m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eChangeAll, _rHdl );
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetOptionsHdl( const Link& _rHdl )
+ {
+ m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eOptions, _rHdl );
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetFindHdl( const Link& _rHdl )
+ {
+ m_aFind.SetClickHdl( _rHdl );
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetConversionFormatChangedHdl( const Link& _rHdl )
+ {
+ m_aSimpleConversion.SetClickHdl( _rHdl );
+ m_aHangulBracketed.SetClickHdl( _rHdl );
+ m_aHanjaBracketed.SetClickHdl( _rHdl );
+ m_pHanjaAbove->SetClickHdl( _rHdl );
+ m_pHanjaBelow->SetClickHdl( _rHdl );
+ m_pHangulAbove->SetClickHdl( _rHdl );
+ m_pHangulBelow->SetClickHdl( _rHdl );
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetClickByCharacterHdl( const Link& _rHdl )
+ {
+ m_aClickByCharacterLink = _rHdl;
+ }
+
+ //-------------------------------------------------------------------------
+ IMPL_LINK( HangulHanjaConversionDialog, OnSuggestionSelected, void*, EMPTYARG )
+ {
+ m_pPlayground->GetWordInputControl().SetText( m_aSuggestions.GetSelectEntry() );
+ OnSuggestionModified( NULL );
+ return 0L;
+ }
+
+ //-------------------------------------------------------------------------
+ IMPL_LINK( HangulHanjaConversionDialog, OnSuggestionModified, void*, EMPTYARG )
+ {
+ m_aFind.Enable( m_pPlayground->GetWordInputControl().GetSavedValue() != m_pPlayground->GetWordInputControl().GetText() );
+
+ bool bSameLen = m_pPlayground->GetWordInputControl().GetText().Len() == m_pPlayground->GetCurrentText().Len();
+ m_pPlayground->EnableButton( SvxCommonLinguisticControl::eChange, m_bDocumentMode && bSameLen );
+ m_pPlayground->EnableButton( SvxCommonLinguisticControl::eChangeAll, m_bDocumentMode && bSameLen );
+
+ return 0L;
+ }
+
+ //-------------------------------------------------------------------------
+ IMPL_LINK( HangulHanjaConversionDialog, ClickByCharacterHdl, CheckBox *, pBox )
+ {
+ m_aClickByCharacterLink.Call(pBox);
+
+ bool bByCharacter = pBox->IsChecked();
+ m_aSuggestions.DisplayListBox( !bByCharacter );
+
+ return 0L;
+ }
+
+ //-------------------------------------------------------------------------
+ IMPL_LINK( HangulHanjaConversionDialog, OnConversionDirectionClicked, CheckBox *, pBox )
+ {
+ CheckBox *pOtherBox = 0;
+ if (pBox == &m_aHangulOnly)
+ pOtherBox = &m_aHanjaOnly;
+ else if (pBox == &m_aHanjaOnly)
+ pOtherBox = &m_aHangulOnly;
+ if (pBox && pOtherBox)
+ {
+ BOOL bBoxChecked = pBox->IsChecked();
+ if (bBoxChecked)
+ pOtherBox->Check( FALSE );
+ pOtherBox->Enable( !bBoxChecked );
+ }
+
+ return 0L;
+ }
+
+ //-------------------------------------------------------------------------
+ IMPL_LINK( HangulHanjaConversionDialog, OnClose, void*, EMPTYARG )
+ {
+ Close();
+ return 0L;
+ }
+
+ IMPL_LINK( HangulHanjaConversionDialog, OnOption, void*, EMPTYARG )
+ {
+ HangulHanjaOptionsDialog aOptDlg( this );
+ aOptDlg.Execute();
+ m_aOptionsChangedLink.Call(this);
+ return 0L;
+ }
+
+ //-------------------------------------------------------------------------
+ String HangulHanjaConversionDialog::GetCurrentString( ) const
+ {
+ return m_pPlayground->GetCurrentText( );
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::FocusSuggestion( )
+ {
+ m_pPlayground->GetWordInputControl().GrabFocus();
+ }
+
+ //-------------------------------------------------------------------------
+ namespace
+ {
+ void lcl_modifyWindowStyle( Window* _pWin, WinBits _nSet, WinBits _nReset )
+ {
+ DBG_ASSERT( 0 == ( _nSet & _nReset ), "lcl_modifyWindowStyle: set _and_ reset the same bit?" );
+ if ( _pWin )
+ _pWin->SetStyle( ( _pWin->GetStyle() | _nSet ) & ~_nReset );
+ }
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetCurrentString( const String& _rNewString,
+ const Sequence< ::rtl::OUString >& _rSuggestions, bool _bOriginatesFromDocument )
+ {
+ m_pPlayground->SetCurrentText( _rNewString );
+
+ bool bOldDocumentMode = m_bDocumentMode;
+ m_bDocumentMode = _bOriginatesFromDocument; // before FillSuggestions!
+ FillSuggestions( _rSuggestions );
+
+ m_pPlayground->EnableButton( SvxCommonLinguisticControl::eIgnoreAll, m_bDocumentMode );
+ // all other buttons have been implicitly enabled or disabled during filling in the suggestions
+
+ // switch the def button depending if we're working for document text
+ if ( bOldDocumentMode != m_bDocumentMode )
+ {
+ Window* pOldDefButton = NULL;
+ Window* pNewDefButton = NULL;
+ if ( m_bDocumentMode )
+ {
+ pOldDefButton = &m_aFind;
+ pNewDefButton = m_pPlayground->GetButton( SvxCommonLinguisticControl::eChange );
+ }
+ else
+ {
+ pOldDefButton = m_pPlayground->GetButton( SvxCommonLinguisticControl::eChange );
+ pNewDefButton = &m_aFind;
+ }
+
+ DBG_ASSERT( WB_DEFBUTTON == ( pOldDefButton->GetStyle( ) & WB_DEFBUTTON ),
+ "HangulHanjaConversionDialog::SetCurrentString: wrong previous default button (1)!" );
+ DBG_ASSERT( 0 == ( pNewDefButton->GetStyle( ) & WB_DEFBUTTON ),
+ "HangulHanjaConversionDialog::SetCurrentString: wrong previous default button (2)!" );
+
+ lcl_modifyWindowStyle( pOldDefButton, 0, WB_DEFBUTTON );
+ lcl_modifyWindowStyle( pNewDefButton, WB_DEFBUTTON, 0 );
+
+ // give the focus to the new def button temporarily - VCL is somewhat peculiar
+ // in recognizing a new default button
+ sal_uInt32 nSaveFocusId = Window::SaveFocus();
+ pNewDefButton->GrabFocus();
+ Window::EndSaveFocus( nSaveFocusId );
+ }
+ }
+
+ //-------------------------------------------------------------------------
+ String HangulHanjaConversionDialog::GetCurrentSuggestion( ) const
+ {
+ return m_pPlayground->GetWordInputControl().GetText();
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetByCharacter( sal_Bool _bByCharacter )
+ {
+ m_aReplaceByChar.Check( _bByCharacter );
+ m_aSuggestions.DisplayListBox( !_bByCharacter );
+ }
+
+ //-------------------------------------------------------------------------
+ sal_Bool HangulHanjaConversionDialog::GetByCharacter( ) const
+ {
+ return m_aReplaceByChar.IsChecked();
+ }
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetConversionDirectionState(
+ sal_Bool _bTryBothDirections,
+ HHC::ConversionDirection _ePrimaryConversionDirection )
+ {
+ // default state: try both direction
+ m_aHangulOnly.Check( FALSE );
+ m_aHangulOnly.Enable( TRUE );
+ m_aHanjaOnly.Check( FALSE );
+ m_aHanjaOnly.Enable( TRUE );
+
+ if (!_bTryBothDirections)
+ {
+ CheckBox *pBox = _ePrimaryConversionDirection == HHC::eHangulToHanja?
+ &m_aHangulOnly : &m_aHanjaOnly;
+ pBox->Check( sal_True );
+ OnConversionDirectionClicked( pBox );
+ }
+ }
+
+ //-------------------------------------------------------------------------
+ sal_Bool HangulHanjaConversionDialog::GetUseBothDirections( ) const
+ {
+// DBG_ASSERT( m_pIgnoreNonPrimary, "HangulHanjaConversionDialog::GetUseBothDirections: where's the check box pointer?" );
+// return m_pIgnoreNonPrimary ? !m_pIgnoreNonPrimary->IsChecked( ) : sal_True;
+ return !m_aHangulOnly.IsChecked() && !m_aHanjaOnly.IsChecked();
+ }
+
+ //-------------------------------------------------------------------------
+ HHC::ConversionDirection HangulHanjaConversionDialog::GetDirection(
+ HHC::ConversionDirection eDefaultDirection ) const
+ {
+ HHC::ConversionDirection eDirection = eDefaultDirection;
+ if (m_aHangulOnly.IsChecked() && !m_aHanjaOnly.IsChecked())
+ eDirection = HHC::eHangulToHanja;
+ else if (!m_aHangulOnly.IsChecked() && m_aHanjaOnly.IsChecked())
+ eDirection = HHC::eHanjaToHangul;
+ return eDirection;
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetConversionFormat( HHC::ConversionFormat _eType )
+ {
+ switch ( _eType )
+ {
+ case HHC::eSimpleConversion: m_aSimpleConversion.Check(); break;
+ case HHC::eHangulBracketed: m_aHangulBracketed.Check(); break;
+ case HHC::eHanjaBracketed: m_aHanjaBracketed.Check(); break;
+ case HHC::eRubyHanjaAbove: m_pHanjaAbove->Check(); break;
+ case HHC::eRubyHanjaBelow: m_pHanjaBelow->Check(); break;
+ case HHC::eRubyHangulAbove: m_pHangulAbove->Check(); break;
+ case HHC::eRubyHangulBelow: m_pHangulBelow->Check(); break;
+ default:
+ DBG_ERROR( "HangulHanjaConversionDialog::SetConversionFormat: unknown type!" );
+ }
+ }
+
+ //-------------------------------------------------------------------------
+ HHC::ConversionFormat HangulHanjaConversionDialog::GetConversionFormat( ) const
+ {
+ if ( m_aSimpleConversion.IsChecked() )
+ return HHC::eSimpleConversion;
+ if ( m_aHangulBracketed.IsChecked() )
+ return HHC::eHangulBracketed;
+ if ( m_aHanjaBracketed.IsChecked() )
+ return HHC::eHanjaBracketed;
+ if ( m_pHanjaAbove->IsChecked() )
+ return HHC::eRubyHanjaAbove;
+ if ( m_pHanjaBelow->IsChecked() )
+ return HHC::eRubyHanjaBelow;
+ if ( m_pHangulAbove->IsChecked() )
+ return HHC::eRubyHangulAbove;
+ if ( m_pHangulBelow->IsChecked() )
+ return HHC::eRubyHangulBelow;
+
+ DBG_ERROR( "HangulHanjaConversionDialog::GetConversionFormat: no radio checked?" );
+ return HHC::eSimpleConversion;
+ }
+
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::EnableRubySupport( sal_Bool bVal )
+ {
+ m_pHanjaAbove->Enable( bVal );
+ m_pHanjaBelow->Enable( bVal );
+ m_pHangulAbove->Enable( bVal );
+ m_pHangulBelow->Enable( bVal );
+ }
+
+
+ //=========================================================================
+ //= HangulHanjaOptionsDialog
+ //=========================================================================
+ //-------------------------------------------------------------------------
+
+ void HangulHanjaOptionsDialog::Init( void )
+ {
+ if( !m_xConversionDictionaryList.is() )
+ {
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if( xMgr.is() )
+ {
+ m_xConversionDictionaryList = Reference< XConversionDictionaryList >( xMgr->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.linguistic2.ConversionDictionaryList")) ),
+ UNO_QUERY );
+ }
+ }
+
+ m_aDictList.clear();
+ m_aDictsLB.Clear();
+
+ if( m_xConversionDictionaryList.is() )
+ {
+ Reference< XNameContainer > xNameCont = m_xConversionDictionaryList->getDictionaryContainer();
+ Reference< XNameAccess > xNameAccess = Reference< XNameAccess >( xNameCont, UNO_QUERY );
+ if( xNameAccess.is() )
+ {
+ Sequence< ::rtl::OUString > aDictNames( xNameAccess->getElementNames() );
+
+ const ::rtl::OUString* pDic = aDictNames.getConstArray();
+ sal_Int32 nCount = aDictNames.getLength();
+
+ sal_Int32 i;
+ for( i = 0 ; i < nCount ; ++i )
+ {
+ Any aAny( xNameAccess->getByName( pDic[ i ] ) );
+ Reference< XConversionDictionary > xDic;
+ if( ( aAny >>= xDic ) && xDic.is() )
+ {
+ if( LANGUAGE_KOREAN == SvxLocaleToLanguage( xDic->getLocale() ) )
+ {
+ m_aDictList.push_back( xDic );
+ AddDict( xDic->getName(), xDic->isActive() );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ IMPL_LINK( HangulHanjaOptionsDialog, OkHdl, void*, EMPTYARG )
+ {
+ sal_uInt32 nCnt = m_aDictList.size();
+ sal_uInt32 n = 0;
+ sal_uInt32 nActiveDics = 0;
+ Sequence< OUString > aActiveDics;
+
+ aActiveDics.realloc( nCnt );
+ OUString* pActActiveDic = aActiveDics.getArray();
+
+ while( nCnt )
+ {
+ Reference< XConversionDictionary > xDict = m_aDictList[ n ];
+ SvLBoxEntry* pEntry = m_aDictsLB.SvTreeListBox::GetEntry( n );
+
+ DBG_ASSERT( xDict.is(), "-HangulHanjaOptionsDialog::OkHdl(): someone is evaporated..." );
+ DBG_ASSERT( pEntry, "-HangulHanjaOptionsDialog::OkHdl(): no one there in list?" );
+
+ bool bActive = m_aDictsLB.GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED;
+ xDict->setActive( bActive );
+ Reference< util::XFlushable > xFlush( xDict, uno::UNO_QUERY );
+ if( xFlush.is() )
+ xFlush->flush();
+
+ if( bActive )
+ {
+ pActActiveDic[ nActiveDics ] = xDict->getName();
+ ++nActiveDics;
+ }
+
+ ++n;
+ --nCnt;
+ }
+
+ // save configuration
+ aActiveDics.realloc( nActiveDics );
+ Any aTmp;
+ SvtLinguConfig aLngCfg;
+ aTmp <<= aActiveDics;
+ aLngCfg.SetProperty( UPH_ACTIVE_CONVERSION_DICTIONARIES, aTmp );
+
+ aTmp <<= bool( m_aIgnorepostCB.IsChecked() );
+ aLngCfg.SetProperty( UPH_IS_IGNORE_POST_POSITIONAL_WORD, aTmp );
+
+ aTmp <<= bool( m_aShowrecentlyfirstCB.IsChecked() );
+ aLngCfg.SetProperty( UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST, aTmp );
+
+ aTmp <<= bool( m_aAutoreplaceuniqueCB.IsChecked() );
+ aLngCfg.SetProperty( UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES, aTmp );
+
+ EndDialog( RET_OK );
+ return 0;
+ }
+
+ IMPL_LINK( HangulHanjaOptionsDialog, DictsLB_SelectHdl, void*, EMPTYARG )
+ {
+ bool bSel = m_aDictsLB.FirstSelected() != NULL;
+
+ m_aEditPB.Enable( bSel );
+ m_aDeletePB.Enable( bSel );
+
+ return 0;
+ }
+
+ IMPL_LINK( HangulHanjaOptionsDialog, NewDictHdl, void*, EMPTYARG )
+ {
+ String aName;
+ HangulHanjaNewDictDialog aNewDlg( this );
+ aNewDlg.Execute();
+ if( aNewDlg.GetName( aName ) )
+ {
+ if( m_xConversionDictionaryList.is() )
+ {
+ try
+ {
+ Reference< XConversionDictionary > xDic =
+ m_xConversionDictionaryList->addNewDictionary( aName, SvxCreateLocale( LANGUAGE_KOREAN ), ConversionDictionaryType::HANGUL_HANJA );
+
+ if( xDic.is() )
+ {
+ //adapt local caches:
+ m_aDictList.push_back( xDic );
+ AddDict( xDic->getName(), xDic->isActive() );
+ }
+ }
+ catch( const ElementExistException& )
+ {
+ }
+ catch( const NoSupportException& )
+ {
+ }
+ }
+ }
+
+ return 0L;
+ }
+
+ IMPL_LINK( HangulHanjaOptionsDialog, EditDictHdl, void*, EMPTYARG )
+ {
+ SvLBoxEntry* pEntry = m_aDictsLB.FirstSelected();
+ DBG_ASSERT( pEntry, "+HangulHanjaEditDictDialog::EditDictHdl(): call of edit should not be possible with no selection!" );
+ if( pEntry )
+ {
+ HangulHanjaEditDictDialog aEdDlg( this, m_aDictList, m_aDictsLB.GetSelectEntryPos() );
+ aEdDlg.Execute();
+ }
+ return 0L;
+ }
+
+ IMPL_LINK( HangulHanjaOptionsDialog, DeleteDictHdl, void*, EMPTYARG )
+ {
+ USHORT nSelPos = m_aDictsLB.GetSelectEntryPos();
+ if( nSelPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ Reference< XConversionDictionary > xDic( m_aDictList[ nSelPos ] );
+ if( m_xConversionDictionaryList.is() && xDic.is() )
+ {
+ Reference< XNameContainer > xNameCont = m_xConversionDictionaryList->getDictionaryContainer();
+ if( xNameCont.is() )
+ {
+ try
+ {
+ xNameCont->removeByName( xDic->getName() );
+
+ //adapt local caches:
+ HHDictList::iterator aIter(m_aDictList.begin());
+ m_aDictList.erase(aIter+nSelPos );
+ m_aDictsLB.RemoveEntry( nSelPos );
+ }
+ catch( const ElementExistException& )
+ {
+ }
+ catch( const NoSupportException& )
+ {
+ }
+ }
+ }
+ }
+
+ return 0L;
+ }
+
+ HangulHanjaOptionsDialog::HangulHanjaOptionsDialog( Window* _pParent )
+ :ModalDialog ( _pParent, SVX_RES( RID_SVX_MDLG_HANGULHANJA_OPT ) )
+ ,m_aUserdefdictFT ( this, SVX_RES( FT_USERDEFDICT ) )
+ ,m_aDictsLB ( this, SVX_RES( LB_DICTS ) )
+ ,m_aOptionsFL ( this, SVX_RES( FL_OPTIONS ) )
+ ,m_aIgnorepostCB ( this, SVX_RES( CB_IGNOREPOST ) )
+ ,m_aShowrecentlyfirstCB ( this, SVX_RES( CB_SHOWRECENTLYFIRST ) )
+ ,m_aAutoreplaceuniqueCB ( this, SVX_RES( CB_AUTOREPLACEUNIQUE ) )
+ ,m_aNewPB ( this, SVX_RES( PB_HHO_NEW ) )
+ ,m_aEditPB ( this, SVX_RES( PB_HHO_EDIT ) )
+ ,m_aDeletePB ( this, SVX_RES( PB_HHO_DELETE ) )
+ ,m_aOkPB ( this, SVX_RES( PB_HHO_OK ) )
+ ,m_aCancelPB ( this, SVX_RES( PB_HHO_CANCEL ) )
+ ,m_aHelpPB ( this, SVX_RES( PB_HHO_HELP ) )
+
+ ,m_pCheckButtonData ( NULL )
+ ,m_xConversionDictionaryList( NULL )
+ {
+ m_aDictsLB.SetWindowBits( WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE );
+ m_aDictsLB.SetSelectionMode( SINGLE_SELECTION );
+ m_aDictsLB.SetHighlightRange();
+// m_aDictsLB.SetHelpId( xxx );
+ m_aDictsLB.SetSelectHdl( LINK( this, HangulHanjaOptionsDialog, DictsLB_SelectHdl ) );
+ m_aDictsLB.SetDeselectHdl( LINK( this, HangulHanjaOptionsDialog, DictsLB_SelectHdl ) );
+
+ m_aOkPB.SetClickHdl( LINK( this, HangulHanjaOptionsDialog, OkHdl ) );
+ m_aNewPB.SetClickHdl( LINK( this, HangulHanjaOptionsDialog, NewDictHdl ) );
+ m_aEditPB.SetClickHdl( LINK( this, HangulHanjaOptionsDialog, EditDictHdl ) );
+ m_aDeletePB.SetClickHdl( LINK( this, HangulHanjaOptionsDialog, DeleteDictHdl ) );
+
+ FreeResource();
+
+ SvtLinguConfig aLngCfg;
+ Any aTmp;
+ bool bVal = bool();
+ aTmp = aLngCfg.GetProperty( UPH_IS_IGNORE_POST_POSITIONAL_WORD );
+ if( aTmp >>= bVal )
+ m_aIgnorepostCB.Check( bVal );
+
+ aTmp = aLngCfg.GetProperty( UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST );
+ if( aTmp >>= bVal )
+ m_aShowrecentlyfirstCB.Check( bVal );
+
+ aTmp = aLngCfg.GetProperty( UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES );
+ if( aTmp >>= bVal )
+ m_aAutoreplaceuniqueCB.Check( bVal );
+
+ Init();
+ }
+
+ HangulHanjaOptionsDialog::~HangulHanjaOptionsDialog()
+ {
+ SvLBoxEntry* pEntry = m_aDictsLB.First();
+ String* pDel;
+ while( pEntry )
+ {
+ pDel = ( String* ) pEntry->GetUserData();
+ if( pDel )
+ delete pDel;
+ pEntry = m_aDictsLB.Next( pEntry );
+ }
+
+ if( m_pCheckButtonData )
+ delete m_pCheckButtonData;
+ }
+
+ void HangulHanjaOptionsDialog::AddDict( const String& _rName, bool _bChecked )
+ {
+ SvLBoxEntry* pEntry = m_aDictsLB.SvTreeListBox::InsertEntry( _rName );
+ m_aDictsLB.SetCheckButtonState( pEntry, _bChecked? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED );
+ pEntry->SetUserData( new String( _rName ) );
+ }
+
+ //=========================================================================
+ //= HangulHanjaNewDictDialog
+ //=========================================================================
+ //-------------------------------------------------------------------------
+
+ IMPL_LINK( HangulHanjaNewDictDialog, OKHdl, void*, EMPTYARG )
+ {
+ String aName( m_aDictNameED.GetText() );
+
+ aName.EraseTrailingChars();
+ m_bEntered = aName.Len() > 0;
+ if( m_bEntered )
+ m_aDictNameED.SetText( aName ); // do this in case of trailing chars have been deleted
+
+ EndDialog( RET_OK );
+ return 0;
+ }
+
+ IMPL_LINK( HangulHanjaNewDictDialog, ModifyHdl, void*, EMPTYARG )
+ {
+ String aName( m_aDictNameED.GetText() );
+
+ aName.EraseTrailingChars();
+ m_aOkBtn.Enable( aName.Len() > 0 );
+
+ return 0;
+ }
+
+ HangulHanjaNewDictDialog::HangulHanjaNewDictDialog( Window* _pParent )
+ :ModalDialog ( _pParent, SVX_RES( RID_SVX_MDLG_HANGULHANJA_NEWDICT ) )
+ ,m_aNewDictFL ( this, SVX_RES( FL_NEWDICT ) )
+ ,m_aDictNameFT ( this, SVX_RES( FT_DICTNAME ) )
+ ,m_aDictNameED ( this, SVX_RES( ED_DICTNAME ) )
+ ,m_aOkBtn ( this, SVX_RES( PB_NEWDICT_OK ) )
+ ,m_aCancelBtn ( this, SVX_RES( PB_NEWDICT_ESC ) )
+ ,m_aHelpBtn ( this, SVX_RES( PB_NEWDICT_HLP ) )
+
+ ,m_bEntered ( false )
+ {
+ m_aOkBtn.SetClickHdl( LINK( this, HangulHanjaNewDictDialog, OKHdl ) );
+
+ m_aDictNameED.SetModifyHdl( LINK( this, HangulHanjaNewDictDialog, ModifyHdl ) );
+
+ FreeResource();
+ }
+
+ HangulHanjaNewDictDialog::~HangulHanjaNewDictDialog()
+ {
+ }
+
+ bool HangulHanjaNewDictDialog::GetName( String& _rRetName ) const
+ {
+ if( m_bEntered )
+ {
+ _rRetName = m_aDictNameED.GetText();
+ _rRetName.EraseTrailingChars();
+ }
+
+ return m_bEntered;
+ }
+
+ //=========================================================================
+ //= HangulHanjaEditDictDialog
+ //=========================================================================
+ //-------------------------------------------------------------------------
+
+ class SuggestionList
+ {
+ private:
+ protected:
+ sal_uInt16 m_nSize;
+ String** m_ppElements;
+ sal_uInt16 m_nNumOfEntries;
+ sal_uInt16 m_nAct;
+
+ const String* _Next( void );
+ public:
+ SuggestionList( sal_uInt16 _nNumOfElements );
+ virtual ~SuggestionList();
+
+ bool Set( const String& _rElement, sal_uInt16 _nNumOfElement );
+ bool Reset( sal_uInt16 _nNumOfElement );
+ const String* Get( sal_uInt16 _nNumOfElement ) const;
+ void Clear( void );
+
+ const String* First( void );
+ const String* Next( void );
+
+ inline sal_uInt16 GetCount( void ) const;
+ };
+
+ inline sal_uInt16 SuggestionList::GetCount( void ) const
+ {
+ return m_nNumOfEntries;
+ }
+
+ SuggestionList::SuggestionList( sal_uInt16 _nNumOfElements )
+ {
+ if( !_nNumOfElements )
+ _nNumOfElements = 1;
+
+ m_nSize = _nNumOfElements;
+
+ m_ppElements = new String*[ m_nSize ];
+ m_nAct = m_nNumOfEntries = 0;
+
+ String** ppNull = m_ppElements;
+ sal_uInt16 n = _nNumOfElements;
+ while( n )
+ {
+ *ppNull = NULL;
+ ++ppNull;
+ --n;
+ }
+ }
+
+ SuggestionList::~SuggestionList()
+ {
+ Clear();
+ }
+
+ bool SuggestionList::Set( const String& _rElement, sal_uInt16 _nNumOfElement )
+ {
+ bool bRet = _nNumOfElement < m_nSize;
+ if( bRet )
+ {
+ String** ppElem = m_ppElements + _nNumOfElement;
+ if( *ppElem )
+ **ppElem = _rElement;
+ else
+ {
+ *ppElem = new String( _rElement );
+ ++m_nNumOfEntries;
+ }
+ }
+
+ return bRet;
+ }
+
+ bool SuggestionList::Reset( sal_uInt16 _nNumOfElement )
+ {
+ bool bRet = _nNumOfElement < m_nSize;
+ if( bRet )
+ {
+ String** ppElem = m_ppElements + _nNumOfElement;
+ if( *ppElem )
+ {
+ delete *ppElem;
+ *ppElem = NULL;
+ --m_nNumOfEntries;
+ }
+ }
+
+ return bRet;
+ }
+
+ const String* SuggestionList::Get( sal_uInt16 _nNumOfElement ) const
+ {
+ const String* pRet;
+
+ if( _nNumOfElement < m_nSize )
+ pRet = m_ppElements[ _nNumOfElement ];
+ else
+ pRet = NULL;
+
+ return pRet;
+ }
+
+ void SuggestionList::Clear( void )
+ {
+ if( m_nNumOfEntries )
+ {
+ String** ppDel = m_ppElements;
+ sal_uInt16 nCnt = m_nSize;
+ while( nCnt )
+ {
+ if( *ppDel )
+ {
+ delete *ppDel;
+ *ppDel = NULL;
+ }
+
+ ++ppDel;
+ --nCnt;
+ }
+
+ m_nNumOfEntries = m_nAct = 0;
+ }
+ }
+
+ const String* SuggestionList::_Next( void )
+ {
+ const String* pRet = NULL;
+ while( m_nAct < m_nSize && !pRet )
+ {
+ pRet = m_ppElements[ m_nAct ];
+ if( !pRet )
+ ++m_nAct;
+ }
+
+ return pRet;
+ }
+
+ const String* SuggestionList::First( void )
+ {
+ m_nAct = 0;
+ return _Next();
+ }
+
+ const String* SuggestionList::Next( void )
+ {
+ const String* pRet;
+
+ if( m_nAct < m_nNumOfEntries )
+ {
+ ++m_nAct;
+ pRet = _Next();
+ }
+ else
+ pRet = NULL;
+
+ return pRet;
+ }
+
+
+ bool SuggestionEdit::ShouldScroll( bool _bUp ) const
+ {
+ bool bRet = false;
+
+ if( _bUp )
+ {
+ if( !m_pPrev )
+ bRet = m_rScrollBar.GetThumbPos() > m_rScrollBar.GetRangeMin();
+ }
+ else
+ {
+ if( !m_pNext )
+ bRet = m_rScrollBar.GetThumbPos() < ( m_rScrollBar.GetRangeMax() - 4 );
+ }
+
+ return bRet;
+ }
+
+ void SuggestionEdit::DoJump( bool _bUp )
+ {
+ const Link& rLoseFocusHdl = GetLoseFocusHdl();
+ if( rLoseFocusHdl.IsSet() )
+ rLoseFocusHdl.Call( this );
+ m_rScrollBar.SetThumbPos( m_rScrollBar.GetThumbPos() + ( _bUp? -1 : 1 ) );
+
+ ( static_cast< HangulHanjaEditDictDialog* >( GetParent() ) )->UpdateScrollbar();
+ }
+
+ SuggestionEdit::SuggestionEdit( Window* pParent, const ResId& rResId,
+ ScrollBar& _rScrollBar, SuggestionEdit* _pPrev, SuggestionEdit* _pNext )
+ :Edit( pParent, rResId )
+ ,m_pPrev( _pPrev )
+ ,m_pNext( _pNext )
+ ,m_rScrollBar( _rScrollBar )
+ {
+ }
+
+ SuggestionEdit::~SuggestionEdit()
+ {
+ }
+
+ long SuggestionEdit::PreNotify( NotifyEvent& rNEvt )
+ {
+ long nHandled = 0;
+ if( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ const KeyCode& rKeyCode = pKEvt->GetKeyCode();
+ USHORT nMod = rKeyCode.GetModifier();
+ USHORT nCode = rKeyCode.GetCode();
+ if( nCode == KEY_TAB && ( !nMod || KEY_SHIFT == nMod ) )
+ {
+ bool bUp = KEY_SHIFT == nMod;
+ if( ShouldScroll( bUp ) )
+ {
+ DoJump( bUp );
+ SetSelection( Selection( 0, SELECTION_MAX ) );
+ // Tab-travel doesn't really happen, so emulate it by setting a selection manually
+ nHandled = 1;
+ }
+ }
+ else if( KEY_UP == nCode || KEY_DOWN == nCode )
+ {
+ bool bUp = KEY_UP == nCode;
+ if( ShouldScroll( bUp ) )
+ {
+ DoJump( bUp );
+ nHandled = 1;
+ }
+ else if( bUp )
+ {
+ if( m_pPrev )
+ {
+ m_pPrev->GrabFocus();
+ nHandled = 1;
+ }
+ }
+ else if( m_pNext )
+ {
+ m_pNext->GrabFocus();
+ nHandled = 1;
+ }
+ }
+ }
+
+ if( !nHandled )
+ nHandled = Edit::PreNotify( rNEvt );
+ return nHandled;
+ }
+
+
+ namespace
+ {
+ bool GetConversions( Reference< XConversionDictionary > _xDict,
+ const OUString& _rOrg,
+ Sequence< OUString >& _rEntries )
+ {
+ bool bRet = false;
+ if( _xDict.is() && _rOrg.getLength() )
+ {
+ try
+ {
+ _rEntries = _xDict->getConversions( _rOrg,
+ 0,
+ _rOrg.getLength(),
+ ConversionDirection_FROM_LEFT,
+ ::com::sun::star::i18n::TextConversionOption::NONE );
+ bRet = _rEntries.getLength() > 0;
+ }
+ catch( const IllegalArgumentException& )
+ {
+ }
+ }
+
+ return bRet;
+ }
+ }
+
+
+ IMPL_LINK( HangulHanjaEditDictDialog, ScrollHdl, void*, EMPTYARG )
+ {
+ UpdateScrollbar();
+
+ return 0;
+ }
+
+ IMPL_LINK( HangulHanjaEditDictDialog, OriginalModifyHdl, void*, EMPTYARG )
+ {
+ m_bModifiedOriginal = true;
+ m_aOriginal = m_aOriginalLB.GetText();
+ m_aOriginal.EraseTrailingChars();
+
+ UpdateSuggestions();
+ UpdateButtonStates();
+
+ return 0;
+ }
+
+ IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl1, Edit*, pEdit )
+ {
+ EditModify( pEdit, 0 );
+ return 0;
+ }
+
+ IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl2, Edit*, pEdit )
+ {
+ EditModify( pEdit, 1 );
+ return 0;
+ }
+
+ IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl3, Edit*, pEdit )
+ {
+ EditModify( pEdit, 2 );
+ return 0;
+ }
+
+ IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl4, Edit*, pEdit )
+ {
+ EditModify( pEdit, 3 );
+ return 0;
+ }
+
+ IMPL_LINK( HangulHanjaEditDictDialog, BookLBSelectHdl, void*, EMPTYARG )
+ {
+ InitEditDictDialog( m_aBookLB.GetSelectEntryPos() );
+ return 0;
+ }
+
+ IMPL_LINK( HangulHanjaEditDictDialog, NewPBPushHdl, void*, EMPTYARG )
+ {
+ DBG_ASSERT( m_pSuggestions, "-HangulHanjaEditDictDialog::NewPBPushHdl(): no suggestions... search in hell..." );
+ Reference< XConversionDictionary > xDict = m_rDictList[ m_nCurrentDict ];
+ if( xDict.is() && m_pSuggestions )
+ {
+ //delete old entry
+ bool bRemovedSomething = DeleteEntryFromDictionary( m_aOriginal, xDict );
+
+ OUString aLeft( m_aOriginal );
+ const String* pRight = m_pSuggestions->First();
+ bool bAddedSomething = false;
+ while( pRight )
+ {
+ try
+ {
+ //add new entry
+ xDict->addEntry( aLeft, *pRight );
+ bAddedSomething = true;
+ }
+ catch( const IllegalArgumentException& )
+ {
+ }
+ catch( const ElementExistException& )
+ {
+ }
+
+ pRight = m_pSuggestions->Next();
+ }
+
+ if(bAddedSomething||bRemovedSomething)
+ InitEditDictDialog( m_nCurrentDict );
+ }
+ else
+ {
+ DBG_WARNING( "+HangulHanjaEditDictDialog::NewPBPushHdl(): dictionary faded away..." );
+ }
+ return 0;
+ }
+
+ bool HangulHanjaEditDictDialog::DeleteEntryFromDictionary( const OUString&, const Reference< XConversionDictionary >& xDict )
+ {
+ bool bRemovedSomething = false;
+ if( xDict.is() )
+ {
+ OUString aOrg( m_aOriginal );
+ Sequence< OUString > aEntries;
+ GetConversions( xDict, m_aOriginal, aEntries );
+
+ sal_uInt32 n = aEntries.getLength();
+ OUString* pEntry = aEntries.getArray();
+ while( n )
+ {
+ try
+ {
+ xDict->removeEntry( aOrg, *pEntry );
+ bRemovedSomething = true;
+ }
+ catch( const NoSuchElementException& )
+ { // can not be...
+ }
+
+ ++pEntry;
+ --n;
+ }
+ }
+ return bRemovedSomething;
+ }
+
+ IMPL_LINK( HangulHanjaEditDictDialog, DeletePBPushHdl, void*, EMPTYARG )
+ {
+ if( DeleteEntryFromDictionary( m_aOriginal, m_rDictList[ m_nCurrentDict ] ) )
+ {
+ m_aOriginal.Erase();
+ m_bModifiedOriginal = true;
+ InitEditDictDialog( m_nCurrentDict );
+ }
+ return 0;
+ }
+
+ void HangulHanjaEditDictDialog::InitEditDictDialog( sal_uInt32 _nSelDict )
+ {
+ if( m_pSuggestions )
+ m_pSuggestions->Clear();
+
+ if( m_nCurrentDict != _nSelDict )
+ {
+ m_nCurrentDict = _nSelDict;
+ m_aOriginal.Erase();
+ m_bModifiedOriginal = true;
+ }
+
+ UpdateOriginalLB();
+
+ m_aOriginalLB.SetText( m_aOriginal.Len()? m_aOriginal : m_aEditHintText, Selection( 0, SELECTION_MAX ) );
+ m_aOriginalLB.GrabFocus();
+
+ UpdateSuggestions();
+ UpdateButtonStates();
+ }
+
+ void HangulHanjaEditDictDialog::UpdateOriginalLB( void )
+ {
+ m_aOriginalLB.Clear();
+ Reference< XConversionDictionary > xDict = m_rDictList[ m_nCurrentDict ];
+ if( xDict.is() )
+ {
+ Sequence< OUString > aEntries = xDict->getConversionEntries( ConversionDirection_FROM_LEFT );
+ sal_uInt32 n = aEntries.getLength();
+ OUString* pEntry = aEntries.getArray();
+ while( n )
+ {
+ m_aOriginalLB.InsertEntry( *pEntry );
+
+ ++pEntry;
+ --n;
+ }
+ }
+ else
+ {
+ DBG_WARNING( "+HangulHanjaEditDictDialog::UpdateOriginalLB(): dictionary faded away..." );
+ }
+ }
+
+ void HangulHanjaEditDictDialog::UpdateButtonStates()
+ {
+ bool bHaveValidOriginalString = m_aOriginal.Len() && m_aOriginal != m_aEditHintText;
+ bool bNew = bHaveValidOriginalString && m_pSuggestions && m_pSuggestions->GetCount() > 0;
+ bNew = bNew && (m_bModifiedSuggestions || m_bModifiedOriginal);
+
+ m_aNewPB.Enable( bNew );
+ m_aDeletePB.Enable( !m_bModifiedOriginal && bHaveValidOriginalString );
+ }
+
+ void HangulHanjaEditDictDialog::UpdateSuggestions( void )
+ {
+ Sequence< OUString > aEntries;
+ bool bFound = GetConversions( m_rDictList[ m_nCurrentDict ], m_aOriginal, aEntries );
+ if( bFound )
+ {
+ m_bModifiedOriginal = false;
+
+ if( m_pSuggestions )
+ m_pSuggestions->Clear();
+
+ //fill found entries into boxes
+ sal_uInt32 nCnt = aEntries.getLength();
+ sal_uInt32 n = 0;
+ if( nCnt )
+ {
+ if( !m_pSuggestions )
+ m_pSuggestions = new SuggestionList( MAXNUM_SUGGESTIONS );
+
+ const OUString* pSugg = aEntries.getConstArray();
+ while( nCnt )
+ {
+ m_pSuggestions->Set( pSugg[ n ], sal_uInt16( n ) );
+ ++n;
+ --nCnt;
+ }
+ }
+ m_bModifiedSuggestions=false;
+ }
+
+ m_aScrollSB.SetThumbPos( 0 );
+ UpdateScrollbar(); // will force edits to be filled new
+ }
+
+ void HangulHanjaEditDictDialog::SetEditText( Edit& _rEdit, sal_uInt16 _nEntryNum )
+ {
+ String aStr;
+ if( m_pSuggestions )
+ {
+ const String* p = m_pSuggestions->Get( _nEntryNum );
+ if( p )
+ aStr = *p;
+ }
+
+ _rEdit.SetText( aStr );
+ }
+
+ void HangulHanjaEditDictDialog::EditModify( Edit* _pEdit, sal_uInt8 _nEntryOffset )
+ {
+ m_bModifiedSuggestions = true;
+
+ String aTxt( _pEdit->GetText() );
+ sal_uInt16 nEntryNum = m_nTopPos + _nEntryOffset;
+ if( aTxt.Len() == 0 )
+ {
+ //reset suggestion
+ if( m_pSuggestions )
+ m_pSuggestions->Reset( nEntryNum );
+ }
+ else
+ {
+ //set suggestion
+ if( !m_pSuggestions )
+ m_pSuggestions = new SuggestionList( MAXNUM_SUGGESTIONS );
+ m_pSuggestions->Set( aTxt, nEntryNum );
+ }
+
+ UpdateButtonStates();
+ }
+
+ HangulHanjaEditDictDialog::HangulHanjaEditDictDialog( Window* _pParent, HHDictList& _rDictList, sal_uInt32 _nSelDict )
+ :ModalDialog ( _pParent, SVX_RES( RID_SVX_MDLG_HANGULHANJA_EDIT ) )
+ ,m_aEditHintText ( SVX_RES( STR_EDITHINT ) )
+ ,m_rDictList ( _rDictList )
+ ,m_nCurrentDict ( 0xFFFFFFFF )
+ ,m_pSuggestions ( NULL )
+ ,m_aBookFT ( this, SVX_RES( FT_BOOK ) )
+ ,m_aBookLB ( this, SVX_RES( LB_BOOK ) )
+ ,m_aOriginalFT ( this, SVX_RES( FT_ORIGINAL ) )
+ ,m_aOriginalLB ( this, SVX_RES( LB_ORIGINAL ) )
+ ,m_aSuggestionsFT ( this, SVX_RES( FT_SUGGESTIONS ) )
+ ,m_aEdit1 ( this, SVX_RES( ED_1 ), m_aScrollSB, NULL, &m_aEdit2 )
+ ,m_aEdit2 ( this, SVX_RES( ED_2 ), m_aScrollSB, &m_aEdit1, &m_aEdit3 )
+ ,m_aEdit3 ( this, SVX_RES( ED_3 ), m_aScrollSB, &m_aEdit2, &m_aEdit4 )
+ ,m_aEdit4 ( this, SVX_RES( ED_4 ), m_aScrollSB, &m_aEdit3, NULL )
+ ,m_aScrollSB ( this, SVX_RES( SB_SCROLL ) )
+ ,m_aNewPB ( this, SVX_RES( PB_HHE_NEW ) )
+ ,m_aDeletePB ( this, SVX_RES( PB_HHE_DELETE ) )
+ ,m_aHelpPB ( this, SVX_RES( PB_HHE_HELP ) )
+ ,m_aClosePB ( this, SVX_RES( PB_HHE_CLOSE ) )
+ ,m_nTopPos ( 0 )
+ ,m_bModifiedSuggestions ( false )
+ ,m_bModifiedOriginal ( false )
+ {
+ m_aOriginalLB.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, OriginalModifyHdl ) );
+
+ m_aNewPB.SetClickHdl( LINK( this, HangulHanjaEditDictDialog, NewPBPushHdl ) );
+ m_aNewPB.Enable( false );
+
+ m_aDeletePB.SetClickHdl( LINK( this, HangulHanjaEditDictDialog, DeletePBPushHdl ) );
+
+ m_aDeletePB.Enable( false );
+
+ #if( MAXNUM_SUGGESTIONS <= 4 )
+ #error number of suggestions should not under-run the value of 5
+ #endif
+
+ Link aScrLk( LINK( this, HangulHanjaEditDictDialog, ScrollHdl ) );
+ m_aScrollSB.SetScrollHdl( aScrLk );
+ m_aScrollSB.SetEndScrollHdl( aScrLk );
+ m_aScrollSB.SetRangeMin( 0 );
+ m_aScrollSB.SetRangeMax( MAXNUM_SUGGESTIONS );
+ m_aScrollSB.SetPageSize( 4 ); // because we have 4 edits / page
+ m_aScrollSB.SetVisibleSize( 4 );
+
+ m_aEdit1.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl1 ) );
+ m_aEdit2.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl2 ) );
+ m_aEdit3.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl3 ) );
+ m_aEdit4.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl4 ) );
+
+ m_aBookLB.SetSelectHdl( LINK( this, HangulHanjaEditDictDialog, BookLBSelectHdl ) );
+ sal_uInt32 nDictCnt = m_rDictList.size();
+ for( sal_uInt32 n = 0 ; n < nDictCnt ; ++n )
+ {
+ Reference< XConversionDictionary > xDic( m_rDictList[n] );
+ String aName;
+ if(xDic.is())
+ aName = xDic->getName();
+ m_aBookLB.InsertEntry( aName );
+ }
+ m_aBookLB.SelectEntryPos( USHORT( _nSelDict ) );
+
+ FreeResource();
+
+ InitEditDictDialog( _nSelDict );
+ }
+
+ HangulHanjaEditDictDialog::~HangulHanjaEditDictDialog()
+ {
+ if( m_pSuggestions )
+ delete m_pSuggestions;
+ }
+
+ void HangulHanjaEditDictDialog::UpdateScrollbar( void )
+ {
+ sal_uInt16 nPos = sal_uInt16( m_aScrollSB.GetThumbPos() );
+ m_nTopPos = nPos;
+
+ SetEditText( m_aEdit1, nPos++ );
+ SetEditText( m_aEdit2, nPos++ );
+ SetEditText( m_aEdit3, nPos++ );
+ SetEditText( m_aEdit4, nPos );
+ }
+
+//.............................................................................
+} // namespace svx
+//.............................................................................
diff --git a/cui/source/dialogs/hangulhanjadlg.hrc b/cui/source/dialogs/hangulhanjadlg.hrc
new file mode 100644
index 000000000000..882d12a4c997
--- /dev/null
+++ b/cui/source/dialogs/hangulhanjadlg.hrc
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * 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: hangulhanjadlg.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SVX_HANGUL_HANJA_DLG_HRC
+#define SVX_HANGUL_HANJA_DLG_HRC
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+// PushButton
+#define PB_FIND 1
+
+// Control
+#define CTL_SUGGESTIONS 1
+
+// FixedText
+#define FT_FORMAT 1
+#define FT_RESIZE_ANCHOR 2
+#define FT_CONVERSION 3
+
+// RadioButton
+#define RB_SIMPLE_CONVERSION 1
+#define RB_HANJA_HANGUL_BRACKETED 2
+#define RB_HANGUL_HANJA_BRACKETED 3
+#define RB_HANGUL_HANJA_ABOVE 4
+#define RB_HANGUL_HANJA_BELOW 5
+#define RB_HANJA_HANGUL_ABOVE 6
+#define RB_HANJA_HANGUL_BELOW 7
+
+// CheckBox
+#define CB_REPLACE_BY_CHARACTER 1
+#define CB_HANGUL_ONLY 2
+#define CB_HANJA_ONLY 3
+
+// String
+#define STR_HANGUL 1
+#define STR_HANJA 2
+
+#define FT_WORD 10
+#define FT_AKTWORD 11
+#define FT_NEWWORD 12
+#define GB_AUDIT 13
+#define BTN_IGNORE 14
+#define BTN_IGNOREALL 15
+#define BTN_CHANGE 16
+#define BTN_CHANGEALL 17
+#define FT_STATUS 18
+#define BTN_SPL_CANCEL 19
+#define BTN_SPL_HELP 20
+#define ED_NEWWORD 21
+#define FT_SUGGESTION 22
+
+
+
+// Hangul / Hanja Options Dialog
+
+#define FT_USERDEFDICT 1
+#define FL_OPTIONS 2
+#define BTN_OPTIONS 10
+
+#define LB_DICTS 1
+
+#define CB_IGNOREPOST 1
+#define CB_SHOWRECENTLYFIRST 3
+#define CB_AUTOREPLACEUNIQUE 4
+
+#define PB_HHO_NEW 1
+#define PB_HHO_EDIT 2
+#define PB_HHO_DELETE 3
+#define PB_HHO_OK 4
+#define PB_HHO_CANCEL 5
+#define PB_HHO_HELP 6
+
+// metrics
+
+#define HHO_DLGWIDTH 287
+#define HHx_DLGHIGHT 175
+#define HHO_COL_1 RSC_SP_DLG_INNERBORDER_LEFT
+#define HHO_COL_1a (HHO_COL_1+3)
+#define HHO_COL_6 (HHO_DLGWIDTH-6)
+#define HHO_COL_5 (HHO_COL_6-50)
+#define HHO_COL_4 (HHO_COL_5-12)
+#define HHO_COL_3 (HHO_COL_4-50)
+#define HHO_COL_2 (HHO_COL_3-6)
+
+#define HHO_ROW_1 RSC_SP_DLG_INNERBORDER_TOP
+#define HHO_ROW_2 (HHO_ROW_1+8+2)
+#define HHO_ROW_3 (HHO_ROW_2+14)
+#define HHO_ROW_4 (HHO_ROW_3+2)
+#define HHO_ROW_5 (HHO_ROW_4+14)
+#define HHO_ROW_6 (HHO_ROW_5+2)
+#define HHO_ROW_7 (HHO_ROW_6+14)
+#define HHO_ROW_8 (HHO_ROW_7+4)
+#define HHO_ROW_9 (HHO_ROW_8+8+4)
+#define HHO_ROW_11 (HHO_ROW_9+8+4)
+#define HHO_ROW_12 (HHO_ROW_11+8+4)
+
+#define HHO_ROW_a1 HHO_ROW_1
+#define HHO_ROW_a2 (HHO_ROW_a1+14)
+#define HHO_ROW_a3 (HHO_ROW_a2+2)
+#define HHO_ROW_a4 (HHO_ROW_a3+14)
+#define HHO_ROW_a5 (HHO_ROW_a4+4)
+#define HHO_ROW_a6 (HHO_ROW_a5+14)
+
+
+// Hangul / Hanja New Dictonary Dialog
+#define FL_NEWDICT 1
+
+#define FT_DICTNAME 1
+
+#define ED_DICTNAME 1
+
+#define PB_NEWDICT_OK 1
+#define PB_NEWDICT_ESC 2
+#define PB_NEWDICT_HLP 3
+
+
+// Hangul Hanja Edit Custom Dictionary Dialog
+#define MAXNUM_SUGGESTIONS 50
+
+#define STR_EDITHINT 1
+
+#define FT_BOOK 1
+#define FT_ORIGINAL 2
+#define FT_SUGGESTIONS 3
+
+#define LB_BOOK 1
+#define LB_ORIGINAL 2
+
+#define PB_HHE_NEW 1
+#define PB_HHE_DELETE 2
+#define PB_HHE_HELP 3
+#define PB_HHE_CLOSE 4
+
+#define SB_SCROLL 1
+
+#define ED_1 1
+#define ED_2 2
+#define ED_3 3
+#define ED_4 4
+
+// metrics
+
+#define RSC_CD_VSCRLWIDTH 8 // vertical scroll bar width
+#define HHE_DLGWIDTH HHO_DLGWIDTH
+#define HHE_COL_1 RSC_SP_DLG_INNERBORDER_LEFT
+#define HHE_COL_6 (HHE_DLGWIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define HHE_COL_5 (HHE_COL_6-RSC_CD_PUSHBUTTON_WIDTH)
+#define HHE_COL_4 (HHE_COL_5-6)
+#define HHE_COL_3_2 (HHE_COL_4-RSC_CD_VSCRLWIDTH)
+#define HHE_COL_3_1 (HHE_COL_3_2-RSC_SP_CTRL_GROUP_X)
+#define HHE_COL_3_0 (HHE_COL_3_2-RSC_CD_PUSHBUTTON_WIDTH)
+#define HHE_COL_2 (HHE_COL_1+50)
+#define HHE_COL_3 (HHE_COL_2+1)
+
+#define HHE_ROW_1 RSC_SP_DLG_INNERBORDER_TOP
+#define HHE_ROW_2 (HHE_ROW_1+2)
+#define HHE_ROW_3 (HHE_ROW_2+12)
+#define HHE_ROW_4 (HHE_ROW_3+12)
+#define HHE_ROW_5 (HHE_ROW_4+8+2)
+#define HHE_ROW_6 (HHE_ROW_5+12)
+#define HHE_ROW_7 (HHE_ROW_6+2)
+#define HHE_ROW_8 (HHE_ROW_7+2)
+#define HHE_ROW_9 (HHE_ROW_6+12)
+#define HHE_ROW_10 (HHE_ROW_8+RSC_SP_CTRL_GROUP_Y)
+#define HHE_ROW_11 (HHE_ROW_10+8+2)
+#define HHE_ROW_12 (HHE_ROW_11+4*12)
+#define HHE_ROW_14 (HHx_DLGHIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM)
+#define HHE_ROW_13 (HHE_ROW_14-RSC_CD_PUSHBUTTON_HEIGHT)
+#define HHE_ROW_a1 (HHE_ROW_5)
+#define HHE_ROW_a3 (HHE_ROW_a1+RSC_CD_PUSHBUTTON_HEIGHT+2)
+
+#endif // SVX_HANGUL_HANJA_DLG_HRC
diff --git a/cui/source/dialogs/hangulhanjadlg.src b/cui/source/dialogs/hangulhanjadlg.src
new file mode 100644
index 000000000000..920f99e03aec
--- /dev/null
+++ b/cui/source/dialogs/hangulhanjadlg.src
@@ -0,0 +1,431 @@
+/*************************************************************************
+ *
+ * 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: hangulhanjadlg.src,v $
+ * $Revision: 1.17 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "helpid.hrc"
+
+#ifndef SVX_HANGUL_HANJA_DLG_HRC
+#include "hangulhanjadlg.hrc"
+#endif
+
+ModalDialog RID_SVX_MDLG_HANGULHANJA
+{
+ HelpId = HID_DIALOG_HANGULHANJA;
+ Size = MAP_APPFONT( 302, 175 );
+ OutputSize = TRUE;
+ Closeable = TRUE ;
+ Moveable = TRUE ;
+ SVLook = TRUE;
+
+ Text [ en-US ] = "Hangul/Hanja Conversion";
+
+ PushButton PB_FIND
+ {
+ Pos = MAP_APPFONT( 207, 23 );
+ Size = MAP_APPFONT( 30, 14 );
+
+ Text [ en-US ] = "~Find";
+ };
+
+ Control CTL_SUGGESTIONS
+ {
+ Pos = MAP_APPFONT( 51, 46 );
+ Size = MAP_APPFONT( 186, 30 );
+ TabStop = TRUE ;
+ };
+
+ FixedText FT_FORMAT
+ {
+ Pos = MAP_APPFONT( 6, 81 );
+ Size = MAP_APPFONT( 42, 8 );
+
+ Text [ en-US ] = "Format";
+ };
+
+ RadioButton RB_SIMPLE_CONVERSION
+ {
+ Pos = MAP_APPFONT( 51, 81 );
+ Size = MAP_APPFONT( 60, 8 );
+
+ Group = TRUE;
+
+ Text [ en-US ] = "~Hangul/Hanja";
+ };
+
+ RadioButton RB_HANJA_HANGUL_BRACKETED
+ {
+ Pos = MAP_APPFONT( 114, 81 );
+ Size = MAP_APPFONT( 60, 8 );
+
+ Text [ en-US ] = "Hanja (Han~gul)";
+ };
+
+ RadioButton RB_HANGUL_HANJA_BRACKETED
+ {
+ Pos = MAP_APPFONT( 177, 81 );
+ Size = MAP_APPFONT( 60, 8 );
+
+ Text [ en-US ] = "Hang~ul (Hanja)";
+ };
+
+ RadioButton RB_HANGUL_HANJA_ABOVE
+ {
+ Pos = MAP_APPFONT( 51, 95 );
+ Size = MAP_APPFONT( 60, 16 );
+
+ // this is the _primary_ text
+ Text [ en-US ] = "Hangu~l";
+ };
+
+ RadioButton RB_HANGUL_HANJA_BELOW
+ {
+ Pos = MAP_APPFONT( 114, 95 );
+ Size = MAP_APPFONT( 60, 16 );
+
+ // this is the _primary_ text
+ Text [ en-US ] = "Hang~ul";
+ };
+
+ RadioButton RB_HANJA_HANGUL_ABOVE
+ {
+ Pos = MAP_APPFONT( 56, 114 );
+ Size = MAP_APPFONT( 60, 16 );
+
+ // this is the _primary_ text
+ Text [ en-US ] = "Han~ja";
+ };
+
+ RadioButton RB_HANJA_HANGUL_BELOW
+ {
+ Pos = MAP_APPFONT( 114, 114 );
+ Size = MAP_APPFONT( 60, 16 );
+
+ // this is the _primary_ text
+ Text [ en-US ] = "Ha~nja";
+ };
+
+ FixedText FT_CONVERSION
+ {
+ Pos = MAP_APPFONT( 6, 134 );
+ Size = MAP_APPFONT( 42, 8 );
+
+ Text [ en-US ] = "Conversion";
+ };
+
+ CheckBox CB_HANGUL_ONLY
+ {
+ Pos = MAP_APPFONT( 51, 134 );
+ Size = MAP_APPFONT( 60, 8 );
+
+ Text [ en-US ] = "Hangul ~only";
+ };
+
+ CheckBox CB_HANJA_ONLY
+ {
+ Pos = MAP_APPFONT( 114, 134 );
+ Size = MAP_APPFONT( 55, 8 );
+
+ Text [ en-US ] = "Hanja onl~y";
+ };
+
+ // this element is only for determining where our radio button group ends (in both directions)
+ FixedText FT_RESIZE_ANCHOR
+ {
+ Pos = MAP_APPFONT( 241, 133 );
+ };
+
+ CheckBox CB_REPLACE_BY_CHARACTER
+ {
+ Pos = MAP_APPFONT( 241, 81 );
+ Size = MAP_APPFONT( 55, 24 );
+
+ WordBreak = TRUE;
+
+ Text [ en-US ] = "Replace b~y character";
+ };
+
+ String STR_HANGUL
+ {
+ Text [ en-US ] = "Hangul";
+ };
+
+ String STR_HANJA
+ {
+ Text [ en-US ] = "Hanja";
+ };
+};
+
+ModalDialog RID_SVX_MDLG_HANGULHANJA_OPT
+{
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ HelpId = HID_HANGULHANJA_OPT_DLG;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( HHO_DLGWIDTH , HHx_DLGHIGHT ) ;
+ Text [ en-US ] = "Hangul/Hanja Options" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ FixedText FT_USERDEFDICT
+ {
+ Pos = MAP_APPFONT ( HHO_COL_1 , HHO_ROW_1 ) ;
+ Size = MAP_APPFONT ( HHO_COL_2 - HHO_COL_1, 8 ) ;
+ Text[ en-US ] = "User-defined dictionaries";
+ };
+ Control LB_DICTS
+ {
+ Pos = MAP_APPFONT ( HHO_COL_1 , HHO_ROW_2 ) ;
+ Size = MAP_APPFONT ( HHO_COL_2 - HHO_COL_1 , HHO_ROW_7 - HHO_ROW_2 ) ;
+ HelpId = HID_HANGULHANJA_OPT_DICTS_LB;
+ TabStop = TRUE;
+ Border = TRUE;
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( HHO_COL_1 , HHO_ROW_8 ) ;
+ Size = MAP_APPFONT ( HHO_COL_4 - HHO_COL_1, 8 ) ;
+ Text[ en-US ] = "Options";
+ };
+ CheckBox CB_IGNOREPOST
+ {
+ Pos = MAP_APPFONT ( HHO_COL_1a, HHO_ROW_9 ) ;
+ Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_1a , 12 ) ;
+ Text[ en-US ] = "Ignore post-positional word";
+ };
+ CheckBox CB_SHOWRECENTLYFIRST
+ {
+ Pos = MAP_APPFONT ( HHO_COL_1a, HHO_ROW_11 ) ;
+ Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_1a , 12 ) ;
+ Text [ en-US ] = "Show recently used entries first";
+ };
+ CheckBox CB_AUTOREPLACEUNIQUE
+ {
+ Pos = MAP_APPFONT ( HHO_COL_1a, HHO_ROW_12 ) ;
+ Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_1a , 12 ) ;
+ Text [ en-US ] = "Replace all unique entries automatically";
+ };
+ PushButton PB_HHO_NEW
+ {
+ Pos = MAP_APPFONT ( HHO_COL_3 , HHO_ROW_2 ) ;
+ Size = MAP_APPFONT ( HHO_COL_4 - HHO_COL_3 , 14 ) ;
+ Text [ en-US ] = "New...";
+ };
+ PushButton PB_HHO_EDIT
+ {
+ Pos = MAP_APPFONT ( HHO_COL_3 , HHO_ROW_4 ) ;
+ Size = MAP_APPFONT ( HHO_COL_4 - HHO_COL_3 , 14 ) ;
+ Text [ en-US ] = "Edit...";
+ };
+ PushButton PB_HHO_DELETE
+ {
+ Pos = MAP_APPFONT ( HHO_COL_3 , HHO_ROW_6 ) ;
+ Size = MAP_APPFONT ( HHO_COL_4 - HHO_COL_3 , 14 ) ;
+ Text [ en-US ] = "Delete";
+ };
+ OKButton PB_HHO_OK
+ {
+ DefButton = TRUE;
+ Pos = MAP_APPFONT ( HHO_COL_5 , HHO_ROW_a1 ) ;
+ Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_5 , 14 ) ;
+ };
+ CancelButton PB_HHO_CANCEL
+ {
+ Pos = MAP_APPFONT ( HHO_COL_5 , HHO_ROW_a3 ) ;
+ Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_5 , 14 ) ;
+ };
+ HelpButton PB_HHO_HELP
+ {
+ Pos = MAP_APPFONT ( HHO_COL_5 , HHO_ROW_a5 ) ;
+ Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_5 , 14 ) ;
+ };
+
+};
+
+
+ModalDialog RID_SVX_MDLG_HANGULHANJA_NEWDICT
+{
+ HelpId = HID_HANGULHANJA_NEWDICT_DLG;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 213 , 66 ) ;
+ Moveable = TRUE ;
+
+ Text [ en-US ] = "New Dictionary" ;
+
+ FixedLine FL_NEWDICT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 145 , 8 ) ;
+ Text [ en-US ] = "Dictionary" ;
+ };
+ FixedText FT_DICTNAME
+ {
+ Pos = MAP_APPFONT ( 11 , 15 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_DICTNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 55 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 12 ) ;
+ MaxTextLength = 32 ;
+ };
+ OKButton PB_NEWDICT_OK
+ {
+ Pos = MAP_APPFONT ( 157 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Disable = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_NEWDICT_ESC
+ {
+ Pos = MAP_APPFONT ( 157 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_NEWDICT_HLP
+ {
+ Pos = MAP_APPFONT ( 157 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+
+ModalDialog RID_SVX_MDLG_HANGULHANJA_EDIT
+{
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ HelpId = HID_HANGULHANJA_EDIT_DLG;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( HHE_DLGWIDTH , HHx_DLGHIGHT ) ;
+ Text [ en-US ] = "Edit Custom Dictionary" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ String STR_EDITHINT
+ {
+ Text [ en-US ] = "[Enter text here]";
+ };
+ FixedText FT_BOOK
+ {
+ Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_2 ) ;
+ Size = MAP_APPFONT ( HHE_COL_2 - HHE_COL_1, 8 ) ;
+ Text [ en-US ] = "Book";
+ };
+ ListBox LB_BOOK
+ {
+ Pos = MAP_APPFONT ( HHE_COL_3 , HHE_ROW_1 ) ;
+ Size = MAP_APPFONT ( HHE_COL_4 - HHE_COL_3 , 60 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ };
+ FixedText FT_ORIGINAL
+ {
+ Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_4 ) ;
+ Size = MAP_APPFONT ( HHE_COL_4 - HHE_COL_1, 8 ) ;
+ Text [ en-US ] = "Original";
+ };
+ ComboBox LB_ORIGINAL
+ {
+ Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_5 ) ;
+ Size = MAP_APPFONT ( HHE_COL_4 - HHE_COL_1 , 60 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ };
+ FixedText FT_SUGGESTIONS
+ {
+ Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_10 ) ;
+ Size = MAP_APPFONT ( HHE_COL_4 - HHE_COL_1, 8 ) ;
+ Text [ en-US ] = "Suggestions (max. 8)";
+ };
+ Edit ED_1
+ {
+ Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_11 ) ;
+ Size = MAP_APPFONT ( HHE_COL_3_1 - HHE_COL_1 , 12 ) ;
+ Hide = False;
+ Border = TRUE;
+ };
+ Edit ED_2
+ {
+ Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_11 + 12 ) ;
+ Size = MAP_APPFONT ( HHE_COL_3_1 - HHE_COL_1 , 12 ) ;
+ Hide = False;
+ Border = TRUE;
+ };
+ Edit ED_3
+ {
+ Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_11 + 24 ) ;
+ Size = MAP_APPFONT ( HHE_COL_3_1 - HHE_COL_1 , 12 ) ;
+ Hide = False;
+ Border = TRUE;
+ };
+ Edit ED_4
+ {
+ Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_11 + 36 ) ;
+ Size = MAP_APPFONT ( HHE_COL_3_1 - HHE_COL_1 , 12 ) ;
+ Hide = False;
+ Border = TRUE;
+ };
+ ScrollBar SB_SCROLL
+ {
+ Pos = MAP_APPFONT ( HHE_COL_3_2 , HHE_ROW_11 ) ;
+ Size = MAP_APPFONT ( RSC_CD_VSCRLWIDTH , HHE_ROW_12 - HHE_ROW_11 ) ; // height = 48
+ VScroll = TRUE ;
+ Drag = TRUE ;
+ };
+ PushButton PB_HHE_NEW
+ {
+ Pos = MAP_APPFONT ( HHE_COL_5 , HHE_ROW_a1 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "New";
+ };
+ PushButton PB_HHE_DELETE
+ {
+ Pos = MAP_APPFONT ( HHE_COL_5 , HHE_ROW_a3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "Delete";
+ };
+ HelpButton PB_HHE_HELP
+ {
+ Pos = MAP_APPFONT ( HHE_COL_3_0 , HHE_ROW_13 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ };
+ CancelButton PB_HHE_CLOSE
+ {
+ Pos = MAP_APPFONT ( HHE_COL_5 , HHE_ROW_13 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "Close";
+ };
+};
+
+
+
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
new file mode 100644
index 000000000000..3c7b14d476ed
--- /dev/null
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -0,0 +1,521 @@
+/*************************************************************************
+ *
+ * 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: hldocntp.cxx,v $
+ * $Revision: 1.40 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "hldocntp.hxx"
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/docfac.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Exception.hpp>
+#include <unotools/localfilehelper.hxx>
+#include <tools/config.hxx>
+#include <vcl/image.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/dynamicmenuoptions.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/ucbhelper.hxx>
+
+#include "hyperdlg.hrc"
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::uno;
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+/*************************************************************************
+|*
+|* Data-struct for documenttypes in listbox
+|*
+|************************************************************************/
+
+struct DocumentTypeData
+{
+ String aStrURL;
+ String aStrExt;
+ DocumentTypeData (String aURL, String aExt) : aStrURL(aURL), aStrExt(aExt)
+ {}
+};
+
+sal_Bool SvxHyperlinkNewDocTp::ImplGetURLObject( const String& rPath, const String& rBase, INetURLObject& aURLObject ) const
+{
+ sal_Bool bIsValidURL = rPath.Len() != 0;
+ if ( bIsValidURL )
+ {
+ aURLObject.SetURL( rPath );
+ if ( aURLObject.GetProtocol() == INET_PROT_NOT_VALID ) // test if the source is already a valid url
+ { // if not we have to create a url from a physical file name
+ bool wasAbs;
+ INetURLObject base(rBase);
+ base.setFinalSlash();
+ aURLObject = base.smartRel2Abs(
+ rPath, wasAbs, true, INetURLObject::ENCODE_ALL,
+ RTL_TEXTENCODING_UTF8, true);
+ }
+ bIsValidURL = aURLObject.GetProtocol() != INET_PROT_NOT_VALID;
+ if ( bIsValidURL )
+ {
+ String aBase( aURLObject.getName( INetURLObject::LAST_SEGMENT, sal_False ) );
+ if ( ( aBase.Len() == 0 ) || ( aBase.GetChar( 0 ) == '.' ) )
+ bIsValidURL = sal_False;
+ }
+ if ( bIsValidURL )
+ {
+ USHORT nPos = maLbDocTypes.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ aURLObject.SetExtension( ((DocumentTypeData*)maLbDocTypes.GetEntryData( nPos ))->aStrExt );
+ }
+
+ }
+ return bIsValidURL;
+}
+
+/*************************************************************************
+|*
+|* Contructor / Destructor
+|*
+|************************************************************************/
+
+SvxHyperlinkNewDocTp::SvxHyperlinkNewDocTp ( Window *pParent, const SfxItemSet& rItemSet)
+: SvxHyperlinkTabPageBase ( pParent, SVX_RES( RID_SVXPAGE_HYPERLINK_NEWDOCUMENT ), rItemSet ),
+ maGrpNewDoc ( this, SVX_RES (GRP_NEWDOCUMENT) ),
+ maRbtEditNow ( this, SVX_RES (RB_EDITNOW) ),
+ maRbtEditLater ( this, SVX_RES (RB_EDITLATER) ),
+ maFtPath ( this, SVX_RES (FT_PATH_NEWDOC) ),
+ maCbbPath ( this, INET_PROT_FILE ),
+ maBtCreate ( this, SVX_RES (BTN_CREATE) ),
+ maFtDocTypes ( this, SVX_RES (FT_DOCUMENT_TYPES) ),
+ maLbDocTypes ( this, SVX_RES (LB_DOCUMENT_TYPES) )
+{
+ // Set HC bitmaps and disable display of bitmap names.
+ maBtCreate.SetModeImage( Image( SVX_RES( IMG_CREATE_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ maBtCreate.EnableTextDisplay (FALSE);
+
+ InitStdControls();
+ FreeResource();
+
+ SetExchangeSupport ();
+
+ maCbbPath.SetPosSizePixel ( LogicToPixel( Point( COL_2 , 25 ), MAP_APPFONT ),
+ LogicToPixel( Size ( 176 - COL_DIFF, 60), MAP_APPFONT ) );
+ maCbbPath.Show();
+ maCbbPath.SetBaseURL(SvtPathOptions().GetWorkPath());
+// maCbbPath.SetHelpId( HID_HYPERDLG_DOC_PATH );
+
+ // set defaults
+ maRbtEditNow.Check();
+
+ maBtCreate.SetClickHdl ( LINK ( this, SvxHyperlinkNewDocTp, ClickNewHdl_Impl ) );
+
+ FillDocumentList ();
+}
+
+SvxHyperlinkNewDocTp::~SvxHyperlinkNewDocTp ()
+{
+ for ( USHORT n=0; n<maLbDocTypes.GetEntryCount(); n++ )
+ {
+ DocumentTypeData* pTypeData = (DocumentTypeData*)
+ maLbDocTypes.GetEntryData ( n );
+ delete pTypeData;
+ }
+}
+
+/*************************************************************************
+|*
+|* Fill the all dialog-controls except controls in groupbox "more..."
+|*
+|************************************************************************/
+
+
+void SvxHyperlinkNewDocTp::FillDlgFields ( String& /*aStrURL*/ )
+{
+}
+
+#define INTERNETSHORTCUT_ID_TAG "InternetShortcut"
+#define INTERNETSHORTCUT_TITLE_TAG "Title"
+#define INTERNETSHORTCUT_TARGET_TAG "Target"
+#define INTERNETSHORTCUT_FOLDER_TAG "Folder"
+#define INTERNETSHORTCUT_URL_TAG "URL"
+#define INTERNETSHORTCUT_ICONID_TAG "IconIndex"
+
+void SvxHyperlinkNewDocTp::ReadURLFile( const String& rFile, String& rTitle, String& rURL, sal_Int32& rIconId, BOOL* pShowAsFolder )
+{
+ // Open file
+ Config aCfg( rFile );
+ aCfg.SetGroup( INTERNETSHORTCUT_ID_TAG );
+
+ // read URL
+ rURL = aCfg.ReadKey( ByteString( RTL_CONSTASCII_STRINGPARAM( INTERNETSHORTCUT_URL_TAG) ), RTL_TEXTENCODING_ASCII_US );
+ SvtPathOptions aPathOpt;
+ rURL = aPathOpt.SubstituteVariable( rURL );
+
+ // read target
+ if ( pShowAsFolder )
+ {
+ String aTemp( aCfg.ReadKey( ByteString( RTL_CONSTASCII_STRINGPARAM( INTERNETSHORTCUT_TARGET_TAG ) ), RTL_TEXTENCODING_ASCII_US ) );
+ *pShowAsFolder = aTemp == String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( INTERNETSHORTCUT_FOLDER_TAG ) );
+ }
+
+ // read image-ID
+ String aStrIconId( aCfg.ReadKey( ByteString( RTL_CONSTASCII_STRINGPARAM( INTERNETSHORTCUT_ICONID_TAG ) ), RTL_TEXTENCODING_ASCII_US ) );
+ rIconId = aStrIconId.ToInt32();
+
+ // read title
+ String aLangStr = aPathOpt.SubstituteVariable( DEFINE_CONST_UNICODE("$(vlang)") );
+ ByteString aLang( aLangStr, RTL_TEXTENCODING_UTF8 );
+ ByteString aGroup = INTERNETSHORTCUT_ID_TAG;
+ ( ( aGroup += '-' ) += aLang ) += ".W";
+ aCfg.SetGroup( aGroup );
+ rTitle = String( aCfg.ReadKey( INTERNETSHORTCUT_TITLE_TAG ), RTL_TEXTENCODING_UTF7 );
+}
+
+void SvxHyperlinkNewDocTp::FillDocumentList ()
+{
+ EnterWait();
+
+ uno::Sequence< uno::Sequence< beans::PropertyValue > >
+ aDynamicMenuEntries( SvtDynamicMenuOptions().GetMenu( E_NEWMENU ) );
+
+ sal_uInt32 i, nCount = aDynamicMenuEntries.getLength();
+ for ( i = 0; i < nCount; i++ )
+ {
+ uno::Sequence< beans::PropertyValue >& rDynamicMenuEntry = aDynamicMenuEntries[ i ];
+
+ rtl::OUString aDocumentUrl, aTitle, aImageId, aTargetName;
+
+ for ( int e = 0; e < rDynamicMenuEntry.getLength(); e++ )
+ {
+ if ( rDynamicMenuEntry[ e ].Name == DYNAMICMENU_PROPERTYNAME_URL )
+ rDynamicMenuEntry[ e ].Value >>= aDocumentUrl;
+ else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_TITLE )
+ rDynamicMenuEntry[e].Value >>= aTitle;
+ else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER )
+ rDynamicMenuEntry[e].Value >>= aImageId;
+ else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_TARGETNAME )
+ rDynamicMenuEntry[e].Value >>= aTargetName;
+ }
+ //#i96822# business cards, labels and database should not be inserted here
+ if( aDocumentUrl.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "private:factory/swriter?slot=21051" ) ) ||
+ aDocumentUrl.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "private:factory/swriter?slot=21052" )) ||
+ aDocumentUrl.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "private:factory/sdatabase?Interactive" )))
+ continue;
+
+ // Insert into listbox
+ if ( aDocumentUrl.getLength() )
+ {
+ if ( aDocumentUrl.equalsAscii( "private:factory/simpress?slot=6686" ) ) // SJ: #106216# do not start
+ aDocumentUrl = String( RTL_CONSTASCII_USTRINGPARAM( "private:factory/simpress" ) ); // the AutoPilot for impress
+
+ // insert private-url and default-extension as user-data
+ const SfxFilter* pFilter = SfxFilter::GetDefaultFilterFromFactory( aDocumentUrl );
+ if ( pFilter )
+ {
+ // insert doc-name and image
+ String aTitleName( aTitle );
+ aTitleName.Erase( aTitleName.Search( (sal_Unicode)'~' ), 1 );
+
+ sal_Int16 nPos = maLbDocTypes.InsertEntry ( aTitleName );
+ String aStrDefExt( pFilter->GetDefaultExtension () );
+ DocumentTypeData *pTypeData = new DocumentTypeData ( aDocumentUrl, aStrDefExt.Copy( 2, aStrDefExt.Len() ) );
+ maLbDocTypes.SetEntryData ( nPos, pTypeData );
+ }
+ }
+ }
+ maLbDocTypes.SelectEntryPos ( 0 );
+
+ LeaveWait();
+}
+
+/*************************************************************************
+|*
+|* retrieve and prepare data from dialog-fields
+|*
+|************************************************************************/
+
+void SvxHyperlinkNewDocTp::GetCurentItemData ( String& aStrURL, String& aStrName,
+ String& aStrIntName, String& aStrFrame,
+ SvxLinkInsertMode& eMode )
+{
+ // get data from dialog-controls
+ aStrURL = maCbbPath.GetText();
+ INetURLObject aURL;
+ if ( ImplGetURLObject( aStrURL, maCbbPath.GetBaseURL(), aURL ) )
+ {
+ aStrURL = aURL.GetMainURL( INetURLObject::NO_DECODE );
+ }
+
+ GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode );
+}
+
+/*************************************************************************
+|*
+|* static method to create Tabpage
+|*
+|************************************************************************/
+
+IconChoicePage* SvxHyperlinkNewDocTp::Create( Window* pWindow, const SfxItemSet& rItemSet )
+{
+ return( new SvxHyperlinkNewDocTp( pWindow, rItemSet ) );
+}
+
+/*************************************************************************
+|*
+|* Set initial focus
+|*
+|************************************************************************/
+
+void SvxHyperlinkNewDocTp::SetInitFocus()
+{
+ maCbbPath.GrabFocus();
+}
+
+/*************************************************************************
+|*
+|* Ask page whether an insert is possible
+|*
+\************************************************************************/
+
+BOOL SvxHyperlinkNewDocTp::AskApply()
+{
+ INetURLObject aINetURLObject;
+ sal_Bool bRet = ImplGetURLObject( maCbbPath.GetText(), maCbbPath.GetBaseURL(), aINetURLObject );
+ if ( !bRet )
+ {
+ WarningBox aWarning( this, WB_OK, SVX_RESSTR(RID_SVXSTR_HYPDLG_NOVALIDFILENAME) );
+ aWarning.Execute();
+ }
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* Any action to do after apply-button is pressed
+|*
+\************************************************************************/
+
+void SvxHyperlinkNewDocTp::DoApply ()
+{
+ EnterWait();
+
+ // get data from dialog-controls
+ String aStrNewName = maCbbPath.GetText();
+
+ if ( aStrNewName == aEmptyStr )
+ aStrNewName = maStrInitURL;
+
+ ///////////////////////////////////////////////////////
+ // create a real URL-String
+
+ INetURLObject aURL;
+ if ( ImplGetURLObject( aStrNewName, maCbbPath.GetBaseURL(), aURL ) )
+ {
+
+ ///////////////////////////////////////////////////////
+ // create Document
+
+ aStrNewName = aURL.GetURLPath( INetURLObject::NO_DECODE );
+ SfxViewFrame *pViewFrame = NULL;
+ try
+ {
+ bool bCreate = true;
+
+ // check if file exists, warn before we overwrite it
+ {
+ com::sun::star::uno::Reference < com::sun::star::task::XInteractionHandler > xHandler;
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ, xHandler );
+
+ sal_Bool bOk = pIStm && ( pIStm->GetError() == 0);
+
+ if( pIStm )
+ delete pIStm;
+
+ if( bOk )
+ {
+ WarningBox aWarning( this, WB_YES_NO, SVX_RESSTR(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE) );
+ bCreate = aWarning.Execute() == BUTTON_YES;
+ }
+ }
+
+ if( bCreate )
+ {
+ // current document
+ SfxViewFrame* pCurrentDocFrame = SfxViewFrame::Current();
+
+ if ( aStrNewName != aEmptyStr )
+ {
+ // get private-url
+ USHORT nPos = maLbDocTypes.GetSelectEntryPos();
+ if( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos=0;
+ String aStrDocName ( ( ( DocumentTypeData* )
+ maLbDocTypes.GetEntryData( nPos ) )->aStrURL );
+
+ // create items
+ SfxStringItem aName( SID_FILE_NAME, aStrDocName );
+ SfxStringItem aReferer( SID_REFERER, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "private:user" ) ) );
+ SfxStringItem aFrame( SID_TARGETNAME, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_blank" ) ) );
+ //SfxBoolItem aFrame( SID_OPEN_NEW_VIEW, TRUE );
+
+ String aStrFlags ( sal_Unicode('S') );
+ if ( maRbtEditLater.IsChecked() )
+ {
+ aStrFlags += sal_Unicode('H');
+ }
+ SfxStringItem aFlags (SID_OPTIONS, aStrFlags);
+
+ // open url
+ const SfxPoolItem* pReturn = GetDispatcher()->Execute( SID_OPENDOC,
+ SFX_CALLMODE_SYNCHRON,
+ &aName, &aFlags,
+ &aFrame, &aReferer, 0L );
+
+ // save new doc
+ const SfxViewFrameItem *pItem = PTR_CAST( SfxViewFrameItem, pReturn ); // SJ: pReturn is NULL if the Hyperlink
+ if ( pItem ) // creation is cancelled #106216#
+ {
+ pViewFrame = pItem->GetFrame();
+ if (pViewFrame)
+ {
+ //SfxViewFrame *pViewFrame = pFrame->GetCurrentViewFrame();
+ SfxStringItem aNewName( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ pViewFrame->GetDispatcher()->Execute( SID_SAVEASDOC,
+ SFX_CALLMODE_SYNCHRON,
+ &aNewName, 0L );
+
+ }
+ }
+ }
+
+ if ( maRbtEditNow.IsChecked() && pCurrentDocFrame )
+ {
+ pCurrentDocFrame->ToTop();
+ }
+ }
+ }
+ catch( uno::Exception )
+ {
+ }
+
+ if ( pViewFrame && maRbtEditLater.IsChecked() )
+ {
+ SfxObjectShell* pObjShell = pViewFrame->GetObjectShell();
+ pObjShell->DoClose();
+ }
+ }
+
+ LeaveWait();
+}
+
+/*************************************************************************
+|*
+|* Click on imagebutton : new
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkNewDocTp, ClickNewHdl_Impl, void *, EMPTYARG )
+{
+ rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) );
+ uno::Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ uno::Reference < XFolderPicker > xFolderPicker( xFactory->createInstance( aService ), UNO_QUERY );
+
+ String aStrURL;
+ String aTempStrURL( maCbbPath.GetText() );
+ utl::LocalFileHelper::ConvertSystemPathToURL( aTempStrURL, maCbbPath.GetBaseURL(), aStrURL );
+
+ String aStrPath = aStrURL;
+ BOOL bZeroPath = ( aStrPath.Len() == 0 );
+ BOOL bHandleFileName = bZeroPath; // when path has length of 0, then the rest should always be handled
+ // as file name, otherwise we do not yet know
+
+ if( bZeroPath )
+ aStrPath = SvtPathOptions().GetWorkPath();
+ else if( !::utl::UCBContentHelper::IsFolder( aStrURL ) )
+ bHandleFileName = TRUE;
+
+ xFolderPicker->setDisplayDirectory( aStrPath );
+ DisableClose( sal_True );
+ sal_Int16 nResult = xFolderPicker->execute();
+ DisableClose( sal_False );
+ if( ExecutableDialogResults::OK == nResult )
+ {
+ sal_Char const sSlash[] = "/";
+
+ INetURLObject aURL( aStrURL, INET_PROT_FILE );
+ String aStrName;
+ if( bHandleFileName )
+ aStrName = bZeroPath? aTempStrURL : String(aURL.getName());
+
+ maCbbPath.SetBaseURL( xFolderPicker->getDirectory() );
+ String aStrTmp( xFolderPicker->getDirectory() );
+
+ if( aStrTmp.GetChar( aStrTmp.Len() - 1 ) != sSlash[0] )
+ aStrTmp.AppendAscii( sSlash );
+
+ // append old file name
+ if( bHandleFileName )
+ aStrTmp += aStrName;
+
+ INetURLObject aNewURL( aStrTmp );
+
+ if( aStrName.Len() > 0 && aNewURL.getExtension().getLength() > 0 &&
+ maLbDocTypes.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ {
+ // get private-url
+ USHORT nPos = maLbDocTypes.GetSelectEntryPos();
+ aNewURL.setExtension( ( ( DocumentTypeData* ) maLbDocTypes.GetEntryData( nPos ) )->aStrExt );
+ }
+
+ if( aNewURL.GetProtocol() == INET_PROT_FILE )
+ {
+ utl::LocalFileHelper::ConvertURLToSystemPath( aNewURL.GetMainURL( INetURLObject::NO_DECODE ), aStrTmp );
+ }
+ else
+ {
+ aStrTmp = aNewURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
+ }
+
+ maCbbPath.SetText ( aStrTmp );
+ }
+ return( 0L );
+}
+
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
new file mode 100644
index 000000000000..229b30818184
--- /dev/null
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -0,0 +1,383 @@
+/*************************************************************************
+ *
+ * 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: hldoctp.cxx,v $
+ * $Revision: 1.28 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "cuihyperdlg.hxx"
+#include <unotools/localfilehelper.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+
+#include "hldoctp.hxx"
+#include "hyperdlg.hrc"
+#include "hlmarkwn_def.hxx" //ADD CHINA001
+
+sal_Char __READONLY_DATA sHash[] = "#";
+sal_Char __READONLY_DATA sFileScheme[] = INET_FILE_SCHEME;
+sal_Char __READONLY_DATA sPortalFileScheme[] = "vnd.sun.star.wfs://";
+sal_Char __READONLY_DATA sNewsSRVScheme[] = "news://";
+ // TODO news:// is nonsense
+sal_Char __READONLY_DATA sHTTPScheme[] = INET_HTTP_SCHEME;
+
+/*************************************************************************
+|*
+|* Contructor / Destructor
+|*
+|************************************************************************/
+
+SvxHyperlinkDocTp::SvxHyperlinkDocTp ( Window *pParent, const SfxItemSet& rItemSet)
+ : SvxHyperlinkTabPageBase ( pParent, SVX_RES( RID_SVXPAGE_HYPERLINK_DOCUMENT ), rItemSet ),
+ maGrpDocument ( this, SVX_RES (GRP_DOCUMENT) ),
+ maFtPath ( this, SVX_RES (FT_PATH_DOC) ),
+ maCbbPath ( this, INET_PROT_FILE ),
+ maBtFileopen ( this, SVX_RES (BTN_FILEOPEN) ),
+ maGrpTarget ( this, SVX_RES (GRP_TARGET) ),
+ maFtTarget ( this, SVX_RES (FT_TARGET_DOC) ),
+ maEdTarget ( this, SVX_RES (ED_TARGET_DOC) ),
+ maFtURL ( this, SVX_RES (FT_URL) ),
+ maFtFullURL ( this, SVX_RES (FT_FULL_URL) ),
+ maBtBrowse ( this, SVX_RES (BTN_BROWSE) ),
+ mbMarkWndOpen ( FALSE )
+{
+ // Set HC bitmaps and disable display of bitmap names.
+ maBtBrowse.SetModeImage( Image( SVX_RES( IMG_BROWSE_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ maBtBrowse.EnableTextDisplay (FALSE);
+ maBtFileopen.SetModeImage( Image( SVX_RES( IMG_FILEOPEN_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ maBtFileopen.EnableTextDisplay (FALSE);
+
+ InitStdControls();
+ FreeResource();
+
+ // Init URL-Box (pos&size, Open-Handler)
+ maCbbPath.SetPosSizePixel ( LogicToPixel( Point( COL_2, 15 ), MAP_APPFONT ),
+ LogicToPixel( Size ( 176 - COL_DIFF, 60), MAP_APPFONT ) );
+ maCbbPath.Show();
+ String aFileScheme( INET_FILE_SCHEME, RTL_TEXTENCODING_ASCII_US );
+ maCbbPath.SetBaseURL(aFileScheme);
+ maCbbPath.SetHelpId( HID_HYPERDLG_DOC_PATH );
+
+ SetExchangeSupport ();
+
+ // overload handlers
+ maBtFileopen.SetClickHdl ( LINK ( this, SvxHyperlinkDocTp, ClickFileopenHdl_Impl ) );
+ maBtBrowse.SetClickHdl ( LINK ( this, SvxHyperlinkDocTp, ClickTargetHdl_Impl ) );
+ maCbbPath.SetModifyHdl ( LINK ( this, SvxHyperlinkDocTp, ModifiedPathHdl_Impl ) );
+ maEdTarget.SetModifyHdl ( LINK ( this, SvxHyperlinkDocTp, ModifiedTargetHdl_Impl ) );
+
+ maCbbPath.SetLoseFocusHdl( LINK ( this, SvxHyperlinkDocTp, LostFocusPathHdl_Impl ) );
+
+ maTimer.SetTimeoutHdl ( LINK ( this, SvxHyperlinkDocTp, TimeoutHdl_Impl ) );
+}
+
+SvxHyperlinkDocTp::~SvxHyperlinkDocTp ()
+{
+}
+
+/*************************************************************************
+|*
+|* Fill all dialog-controls except controls in groupbox "more..."
+|*
+|************************************************************************/
+
+void SvxHyperlinkDocTp::FillDlgFields ( String& aStrURL )
+{
+ INetURLObject aURL ( aStrURL );
+
+ String aStrMark;
+ xub_StrLen nPos = aStrURL.SearchAscii( sHash );
+ // path
+ maCbbPath.SetText ( aStrURL.Copy( 0, ( nPos == STRING_NOTFOUND ? aStrURL.Len() : nPos ) ) );
+
+ // set target in document at editfield
+ if ( nPos != STRING_NOTFOUND && nPos<aStrURL.Len()-1 )
+ aStrMark = aStrURL.Copy( nPos+1, aStrURL.Len() );
+ maEdTarget.SetText ( aStrMark );
+
+ ModifiedPathHdl_Impl ( NULL );
+}
+
+/*************************************************************************
+|*
+|* retrieve current url-string
+|*
+|************************************************************************/
+
+String SvxHyperlinkDocTp::GetCurrentURL ()
+{
+ // get data from dialog-controls
+ String aStrURL;
+ String aStrPath ( maCbbPath.GetText() );
+ const String aBaseURL ( maCbbPath.GetBaseURL() );
+ String aStrMark( maEdTarget.GetText() );
+
+ if ( aStrPath != aEmptyStr )
+ {
+ INetURLObject aURL( aStrPath );
+ if ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) // maybe the path is already a valid
+ aStrURL = aStrPath; // hyperlink, then we can use this path directly
+ else
+ utl::LocalFileHelper::ConvertSystemPathToURL( aStrPath, aBaseURL, aStrURL );
+
+ //#105788# always create a URL even if it is not valid
+ if( aStrURL == aEmptyStr )
+ aStrURL = aStrPath;
+ }
+
+ if( aStrMark != aEmptyStr )
+ {
+ aStrURL.AppendAscii( sHash );
+ aStrURL += aStrMark;
+ }
+
+ return aStrURL;
+}
+
+/*************************************************************************
+|*
+|* retrieve and prepare data from dialog-fields
+|*
+|************************************************************************/
+
+void SvxHyperlinkDocTp::GetCurentItemData ( String& aStrURL, String& aStrName,
+ String& aStrIntName, String& aStrFrame,
+ SvxLinkInsertMode& eMode )
+{
+ // get data from standard-fields
+ aStrURL = GetCurrentURL();
+
+ if( aStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ||
+ aStrURL.EqualsIgnoreCaseAscii( sPortalFileScheme ) )
+ aStrURL=aEmptyStr;
+
+ GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode );
+}
+
+/*************************************************************************
+|*
+|* static method to create Tabpage
+|*
+|************************************************************************/
+
+IconChoicePage* SvxHyperlinkDocTp::Create( Window* pWindow, const SfxItemSet& rItemSet )
+{
+ return( new SvxHyperlinkDocTp( pWindow, rItemSet ) );
+}
+
+/*************************************************************************
+|*
+|* Set initial focus
+|*
+|************************************************************************/
+
+void SvxHyperlinkDocTp::SetInitFocus()
+{
+ maCbbPath.GrabFocus();
+}
+
+/*************************************************************************
+|*
+|* Click on imagebutton : fileopen
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkDocTp, ClickFileopenHdl_Impl, void *, EMPTYARG )
+{
+ // Open Fileopen-Dialog
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0,
+ GetParent() );
+ String aOldURL( GetCurrentURL() );
+ if( aOldURL.EqualsIgnoreCaseAscii( sFileScheme, 0, sizeof( sFileScheme ) - 1 ) ||
+ aOldURL.EqualsIgnoreCaseAscii( sPortalFileScheme, 0, sizeof( sFileScheme ) - 1 ) )
+ {
+ aDlg.SetDisplayDirectory( aOldURL );
+ }
+
+ DisableClose( sal_True );
+ ErrCode nError = aDlg.Execute();
+ DisableClose( sal_False );
+
+ if ( ERRCODE_NONE == nError )
+ {
+ String aURL( aDlg.GetPath() );
+ String aPath;
+
+ utl::LocalFileHelper::ConvertURLToSystemPath( aURL, aPath );
+
+ maCbbPath.SetBaseURL( aURL );
+ maCbbPath.SetText( aPath );
+
+ if ( aOldURL != GetCurrentURL() )
+ ModifiedPathHdl_Impl (NULL);
+ }
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Click on imagebutton : target
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkDocTp, ClickTargetHdl_Impl, void *, EMPTYARG )
+{
+ if ( GetPathType ( maStrURL ) == Type_ExistsFile ||
+ maStrURL == aEmptyStr ||
+ maStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ||
+ maStrURL.EqualsIgnoreCaseAscii( sPortalFileScheme ) ||
+ maStrURL.SearchAscii( sHash ) == 0 )
+ {
+ mpMarkWnd->SetError( LERR_NOERROR );
+
+ EnterWait();
+
+ if ( maStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ||
+ maStrURL.EqualsIgnoreCaseAscii( sPortalFileScheme ) )
+ mpMarkWnd->RefreshTree ( aEmptyStr );
+ else
+ mpMarkWnd->RefreshTree ( maStrURL );
+
+ LeaveWait();
+ }
+ else
+ mpMarkWnd->SetError( LERR_DOCNOTOPEN );
+
+ ShowMarkWnd ();
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Contens of combobox "Path" modified
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkDocTp, ModifiedPathHdl_Impl, void *, EMPTYARG )
+{
+ maStrURL = GetCurrentURL();
+
+ maTimer.SetTimeout( 2500 );
+ maTimer.Start();
+
+ maFtFullURL.SetText( maStrURL );
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* If path-field was modify, to browse the new doc after timeout
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkDocTp, TimeoutHdl_Impl, Timer *, EMPTYARG )
+{
+ if ( IsMarkWndVisible() && ( GetPathType( maStrURL )==Type_ExistsFile ||
+ maStrURL == aEmptyStr ||
+ maStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ) )
+ {
+ EnterWait();
+
+ if ( maStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ||
+ maStrURL.EqualsIgnoreCaseAscii( sPortalFileScheme ) )
+ mpMarkWnd->RefreshTree ( aEmptyStr );
+ else
+ mpMarkWnd->RefreshTree ( maStrURL );
+
+ LeaveWait();
+ }
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Contens of editfield "Target" modified
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkDocTp, ModifiedTargetHdl_Impl, void *, EMPTYARG )
+{
+ maStrURL = GetCurrentURL();
+
+ if ( IsMarkWndVisible() )
+ mpMarkWnd->SelectEntry ( maEdTarget.GetText() );
+
+ maFtFullURL.SetText( maStrURL );
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* editfield "Target" lost focus
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkDocTp, LostFocusPathHdl_Impl, void *, EMPTYARG )
+{
+ maStrURL = GetCurrentURL();
+
+ maFtFullURL.SetText( maStrURL );
+
+ return (0L);
+}
+
+/*************************************************************************
+|*
+|* Get String from Bookmark-Wnd
+|*
+|************************************************************************/
+
+void SvxHyperlinkDocTp::SetMarkStr ( String& aStrMark )
+{
+ maEdTarget.SetText ( aStrMark );
+
+ ModifiedTargetHdl_Impl ( NULL );
+}
+
+/*************************************************************************
+|*
+|* retrieve kind of pathstr
+|*
+|************************************************************************/
+
+SvxHyperlinkDocTp::EPathType SvxHyperlinkDocTp::GetPathType ( String& aStrPath )
+{
+ INetURLObject aURL( aStrPath, INET_PROT_FILE );
+
+ if( aURL.HasError() )
+ return Type_Invalid;
+ else
+ return Type_ExistsFile;
+}
diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
new file mode 100644
index 000000000000..8b967298eb8e
--- /dev/null
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -0,0 +1,547 @@
+/*************************************************************************
+ *
+ * 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: hlinettp.cxx,v $
+ * $Revision: 1.30 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <unotools/pathoptions.hxx>
+#include <unotools/useroptions.hxx>
+#include <svl/adrparse.hxx>
+
+#include "hlinettp.hxx"
+#include "hyperdlg.hrc"
+#include "hlmarkwn_def.hxx" //ADD CHINA001
+
+#define STD_DOC_SUBPATH "internal"
+#define STD_DOC_NAME "url_transfer.htm"
+
+sal_Char __READONLY_DATA sAnonymous[] = "anonymous";
+sal_Char __READONLY_DATA sHTTPScheme[] = INET_HTTP_SCHEME;
+sal_Char __READONLY_DATA sHTTPSScheme[] = INET_HTTPS_SCHEME;
+sal_Char __READONLY_DATA sFTPScheme[] = INET_FTP_SCHEME;
+sal_Char __READONLY_DATA sTelnetScheme[] = INET_TELNET_SCHEME;
+
+/*************************************************************************
+|*
+|* Contructor / Destructor
+|*
+|************************************************************************/
+
+SvxHyperlinkInternetTp::SvxHyperlinkInternetTp ( Window *pParent,
+ const SfxItemSet& rItemSet)
+: SvxHyperlinkTabPageBase ( pParent, SVX_RES( RID_SVXPAGE_HYPERLINK_INTERNET ),
+ rItemSet ) ,
+ maGrpLinkTyp ( this, SVX_RES (GRP_LINKTYPE) ),
+ maRbtLinktypInternet ( this, SVX_RES (RB_LINKTYP_INTERNET) ),
+ maRbtLinktypFTP ( this, SVX_RES (RB_LINKTYP_FTP) ),
+ maRbtLinktypTelnet ( this, SVX_RES (RB_LINKTYP_TELNET) ),
+ maFtTarget ( this, SVX_RES (FT_TARGET_HTML) ),
+ maCbbTarget ( this, INET_PROT_HTTP ),
+ maFtLogin ( this, SVX_RES (FT_LOGIN) ),
+ maEdLogin ( this, SVX_RES (ED_LOGIN) ),
+ maFtPassword ( this, SVX_RES (FT_PASSWD) ),
+ maEdPassword ( this, SVX_RES (ED_PASSWD) ),
+ maCbAnonymous ( this, SVX_RES (CBX_ANONYMOUS) ),
+ maBtBrowse ( this, SVX_RES (BTN_BROWSE) ),
+ maBtTarget ( this, SVX_RES (BTN_TARGET) ),
+ mbMarkWndOpen ( FALSE )
+{
+ // Set HC bitmaps and display display of bitmap names.
+ maBtBrowse.SetModeImage( Image( SVX_RES( IMG_BROWSE_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ maBtBrowse.EnableTextDisplay (FALSE);
+ maBtTarget.SetModeImage( Image( SVX_RES( IMG_TARGET_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ maBtTarget.EnableTextDisplay (FALSE);
+
+ InitStdControls();
+ FreeResource();
+
+ // Init URL-Box (pos&size, Open-Handler)
+ maCbbTarget.SetPosSizePixel ( LogicToPixel( Point( COL_2, 25 ), MAP_APPFONT ),
+ LogicToPixel( Size ( 176 - COL_DIFF, 60), MAP_APPFONT ) );
+ maCbbTarget.Show();
+ maCbbTarget.SetHelpId( HID_HYPERDLG_INET_PATH );
+
+ // Find Path to Std-Doc
+ String aStrBasePaths( SvtPathOptions().GetTemplatePath() );
+ for( xub_StrLen n = 0; n < aStrBasePaths.GetTokenCount(); n++ )
+ {
+ INetURLObject aURL( aStrBasePaths.GetToken( n ) );
+ aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( STD_DOC_SUBPATH ) ) );
+ aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( STD_DOC_NAME ) ) );
+ if ( FileExists( aURL ) )
+ {
+ maStrStdDocURL = aURL.GetMainURL( INetURLObject::NO_DECODE );
+ break;
+ }
+ }
+ SetExchangeSupport ();
+
+ ///////////////////////////////////////
+ // set defaults
+ maRbtLinktypInternet.Check ();
+ maFtLogin.Show( FALSE );
+ maFtPassword.Show( FALSE );
+ maEdLogin.Show( FALSE );
+ maEdPassword.Show( FALSE );
+ maCbAnonymous.Show( FALSE );
+ maBtTarget.Enable( FALSE );
+ maBtBrowse.Enable( maStrStdDocURL != aEmptyStr );
+
+ ///////////////////////////////////////
+ // overload handlers
+ Link aLink( LINK ( this, SvxHyperlinkInternetTp, Click_SmartProtocol_Impl ) );
+ maRbtLinktypInternet.SetClickHdl( aLink );
+ maRbtLinktypFTP.SetClickHdl ( aLink );
+ maRbtLinktypTelnet.SetClickHdl ( aLink );
+ maCbAnonymous.SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl ) );
+ maBtBrowse.SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickBrowseHdl_Impl ) );
+ maBtTarget.SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickTargetHdl_Impl ) );
+ maEdLogin.SetModifyHdl ( LINK ( this, SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl ) );
+ maCbbTarget.SetLoseFocusHdl ( LINK ( this, SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl ) );
+ maCbbTarget.SetModifyHdl ( LINK ( this, SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl ) );
+ maTimer.SetTimeoutHdl ( LINK ( this, SvxHyperlinkInternetTp, TimeoutHdl_Impl ) );
+}
+
+SvxHyperlinkInternetTp::~SvxHyperlinkInternetTp ()
+{
+}
+
+/*************************************************************************
+|*
+|* Fill the all dialog-controls except controls in groupbox "more..."
+|*
+|************************************************************************/
+
+void SvxHyperlinkInternetTp::FillDlgFields ( String& aStrURL )
+{
+ INetURLObject aURL( aStrURL );
+ String aStrScheme = GetSchemeFromURL( aStrURL );
+
+ // set additional controls for FTP: Username / Password
+ if ( aStrScheme.SearchAscii( sFTPScheme ) == 0 )
+ {
+ if ( String(aURL.GetUser()).ToLowerAscii().SearchAscii ( sAnonymous ) == 0 )
+ setAnonymousFTPUser();
+ else
+ setFTPUser(aURL.GetUser(), aURL.GetPass());
+
+ //do not show password and user in url
+ if(aURL.GetUser().getLength()!=0 || aURL.GetPass().getLength()!=0 )
+ aURL.SetUserAndPass(aEmptyStr,aEmptyStr);
+ }
+
+ // set URL-field
+ // Show the scheme, #72740
+ if ( aURL.GetProtocol() != INET_PROT_NOT_VALID )
+ maCbbTarget.SetText( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) );
+ else
+ maCbbTarget.SetText( aStrURL ); // #77696#
+
+ SetScheme( aStrScheme );
+}
+
+void SvxHyperlinkInternetTp::setAnonymousFTPUser()
+{
+ maEdLogin.SetText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM ( sAnonymous ) ) );
+ SvAddressParser aAddress( SvtUserOptions().GetEmail() );
+ maEdPassword.SetText( aAddress.Count() ? aAddress.GetEmailAddress(0) : String() );
+
+ maFtLogin.Disable ();
+ maFtPassword.Disable ();
+ maEdLogin.Disable ();
+ maEdPassword.Disable ();
+ maCbAnonymous.Check();
+}
+
+void SvxHyperlinkInternetTp::setFTPUser(const String& rUser, const String& rPassword)
+{
+ maEdLogin.SetText ( rUser );
+ maEdPassword.SetText ( rPassword );
+
+ maFtLogin.Enable ();
+ maFtPassword.Enable ();
+ maEdLogin.Enable ();
+ maEdPassword.Enable ();
+ maCbAnonymous.Check(FALSE);
+}
+
+/*************************************************************************
+|*
+|* retrieve and prepare data from dialog-fields
+|*
+|************************************************************************/
+
+void SvxHyperlinkInternetTp::GetCurentItemData ( String& aStrURL, String& aStrName,
+ String& aStrIntName, String& aStrFrame,
+ SvxLinkInsertMode& eMode )
+{
+ aStrURL = CreateAbsoluteURL();
+ GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode );
+}
+
+String SvxHyperlinkInternetTp::CreateAbsoluteURL() const
+{
+ String aStrURL = maCbbTarget.GetText();
+ String aScheme = GetSchemeFromURL(aStrURL);
+
+ INetURLObject aURL(aStrURL);
+
+ if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
+ {
+ aURL.SetSmartProtocol( GetSmartProtocolFromButtons() );
+ aURL.SetSmartURL(aStrURL);
+ }
+
+ // username and password for ftp-url
+ if( aURL.GetProtocol() == INET_PROT_FTP && maEdLogin.GetText().Len()!=0 )
+ aURL.SetUserAndPass ( maEdLogin.GetText(), maEdPassword.GetText() );
+
+ if ( aURL.GetProtocol() != INET_PROT_NOT_VALID )
+ return aURL.GetMainURL( INetURLObject::DECODE_WITH_CHARSET );
+ else //#105788# always create a URL even if it is not valid
+ return aStrURL;
+}
+
+/*************************************************************************
+|*
+|* static method to create Tabpage
+|*
+|************************************************************************/
+
+IconChoicePage* SvxHyperlinkInternetTp::Create( Window* pWindow, const SfxItemSet& rItemSet )
+{
+ return( new SvxHyperlinkInternetTp( pWindow, rItemSet ) );
+}
+
+/*************************************************************************
+|*
+|* Set initial focus
+|*
+|************************************************************************/
+
+void SvxHyperlinkInternetTp::SetInitFocus()
+{
+ maCbbTarget.GrabFocus();
+}
+
+/*************************************************************************
+|*
+|* Contens of editfield "Taregt" modified
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl, void *, EMPTYARG )
+{
+ String aScheme = GetSchemeFromURL( maCbbTarget.GetText() );
+ if(aScheme.Len()!=0)
+ SetScheme( aScheme );
+
+ // start timer
+ maTimer.SetTimeout( 2500 );
+ maTimer.Start();
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* If target-field was modify, to browse the new doc afeter timeout
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkInternetTp, TimeoutHdl_Impl, Timer *, EMPTYARG )
+{
+ RefreshMarkWindow();
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Contens of editfield "Login" modified
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl, void *, EMPTYARG )
+{
+ String aStrLogin ( maEdLogin.GetText() );
+ if ( aStrLogin.EqualsIgnoreCaseAscii( sAnonymous ) )
+ {
+ maCbAnonymous.Check();
+ ClickAnonymousHdl_Impl(NULL);
+ }
+
+ return( 0L );
+}
+
+/*************************************************************************
+|************************************************************************/
+
+void SvxHyperlinkInternetTp::SetScheme( const String& aScheme )
+{
+ //if aScheme is empty or unknown the default beaviour is like it where HTTP
+
+ BOOL bFTP = aScheme.SearchAscii( sFTPScheme ) == 0;
+ BOOL bTelnet = FALSE;
+ if( !bFTP )
+ bTelnet = aScheme.SearchAscii( sTelnetScheme ) == 0;
+ BOOL bInternet = !(bFTP || bTelnet);
+
+ //update protocol button selection:
+ maRbtLinktypFTP.Check(bFTP);
+ maRbtLinktypTelnet.Check(bTelnet);
+ maRbtLinktypInternet.Check(bInternet);
+
+ //update target:
+ RemoveImproperProtocol(aScheme);
+ maCbbTarget.SetSmartProtocol( GetSmartProtocolFromButtons() );
+
+ //show/hide special fields for FTP:
+ maFtLogin.Show( bFTP );
+ maFtPassword.Show( bFTP );
+ maEdLogin.Show( bFTP );
+ maEdPassword.Show( bFTP );
+ maCbAnonymous.Show( bFTP );
+
+ //update 'link target in document'-window and opening-button
+ if( aScheme.SearchAscii( sHTTPScheme ) == 0 || aScheme.Len() == 0 )
+ {
+ maBtTarget.Enable();
+ if ( mbMarkWndOpen )
+ ShowMarkWnd ();
+ }
+ else
+ {
+ //disable for https, ftp and telnet
+ maBtTarget.Disable();
+ if ( mbMarkWndOpen )
+ HideMarkWnd ();
+ }
+}
+
+/*************************************************************************
+|*
+|* Remove protocol if it does not fit to the current button selection
+|*
+|************************************************************************/
+
+void SvxHyperlinkInternetTp::RemoveImproperProtocol(const String& aProperScheme)
+{
+ String aStrURL ( maCbbTarget.GetText() );
+ if ( aStrURL != aEmptyStr )
+ {
+ String aStrScheme = GetSchemeFromURL( aStrURL );
+ if ( aStrScheme != aEmptyStr && aStrScheme != aProperScheme )
+ {
+ aStrURL.Erase ( 0, aStrScheme.Len() );
+ maCbbTarget.SetText ( aStrURL );
+ }
+ }
+}
+
+String SvxHyperlinkInternetTp::GetSchemeFromButtons() const
+{
+ if( maRbtLinktypFTP.IsChecked() )
+ {
+ return String::CreateFromAscii( INET_FTP_SCHEME );
+ }
+ else if( maRbtLinktypTelnet.IsChecked() )
+ {
+ return String::CreateFromAscii( INET_TELNET_SCHEME );
+ }
+ return String::CreateFromAscii( INET_HTTP_SCHEME );
+}
+
+INetProtocol SvxHyperlinkInternetTp::GetSmartProtocolFromButtons() const
+{
+ if( maRbtLinktypFTP.IsChecked() )
+ {
+ return INET_PROT_FTP;
+ }
+ else if( maRbtLinktypTelnet.IsChecked() )
+ {
+ return INET_PROT_TELNET;
+ }
+ return INET_PROT_HTTP;
+}
+
+/*************************************************************************
+|*
+|* Click on Radiobutton : Internet, FTP or Telnet
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkInternetTp, Click_SmartProtocol_Impl, void*, EMPTYARG )
+{
+ String aScheme = GetSchemeFromButtons();
+ SetScheme( aScheme );
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Click on Checkbox : Anonymous user
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl, void *, EMPTYARG )
+{
+ // disable login-editfields if checked
+ if ( maCbAnonymous.IsChecked() )
+ {
+ if ( maEdLogin.GetText().ToLowerAscii().SearchAscii ( sAnonymous ) == 0 )
+ {
+ maStrOldUser = aEmptyStr;
+ maStrOldPassword = aEmptyStr;
+ }
+ else
+ {
+ maStrOldUser = maEdLogin.GetText();
+ maStrOldPassword = maEdPassword.GetText();
+ }
+
+ setAnonymousFTPUser();
+ }
+ else
+ setFTPUser(maStrOldUser, maStrOldPassword);
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Combobox Target lost the focus
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl, void *, EMPTYARG )
+{
+ RefreshMarkWindow();
+ return (0L);
+}
+
+/*************************************************************************
+|*
+|* Click on imagebutton : Browse
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkInternetTp, ClickBrowseHdl_Impl, void *, EMPTYARG )
+{
+ /////////////////////////////////////////////////
+ // Open URL if available
+
+ SfxStringItem aName( SID_FILE_NAME, maStrStdDocURL );
+ SfxStringItem aRefererItem( SID_REFERER, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "private:user" ) ) );
+ SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, TRUE );
+ SfxBoolItem aSilent( SID_SILENT, TRUE );
+ SfxBoolItem aReadOnly( SID_DOC_READONLY, TRUE );
+
+ SfxBoolItem aBrowse( SID_BROWSE, TRUE );
+
+ const SfxPoolItem *ppItems[] = { &aName, &aNewView, &aSilent, &aReadOnly, &aRefererItem, &aBrowse, NULL };
+ (((SvxHpLinkDlg*)mpDialog)->GetBindings())->Execute( SID_OPENDOC, ppItems, 0, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Click on imagebutton : Target
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkInternetTp, ClickTargetHdl_Impl, void *, EMPTYARG )
+{
+ RefreshMarkWindow();
+ ShowMarkWnd ();
+ mbMarkWndOpen = IsMarkWndVisible ();
+
+ return( 0L );
+}
+
+void SvxHyperlinkInternetTp::RefreshMarkWindow()
+{
+ if ( maRbtLinktypInternet.IsChecked() && IsMarkWndVisible() )
+ {
+ EnterWait();
+ String aStrURL( CreateAbsoluteURL() );
+ if ( aStrURL != aEmptyStr )
+ mpMarkWnd->RefreshTree ( aStrURL );
+ else
+ mpMarkWnd->SetError( LERR_DOCNOTOPEN );
+ LeaveWait();
+ }
+
+}
+
+/*************************************************************************
+|*
+|* Get String from Bookmark-Wnd
+|*
+|************************************************************************/
+
+void SvxHyperlinkInternetTp::SetMarkStr ( String& aStrMark )
+{
+ String aStrURL ( maCbbTarget.GetText() );
+
+ const sal_Unicode sUHash = '#';
+ xub_StrLen nPos = aStrURL.SearchBackward( sUHash );
+
+ if( nPos != STRING_NOTFOUND )
+ aStrURL.Erase ( nPos );
+
+ aStrURL += sUHash;
+ aStrURL += aStrMark;
+
+ maCbbTarget.SetText ( aStrURL );
+}
+
+/*************************************************************************
+|*
+|* Enable Browse-Button in subject to the office is in onlinemode
+|*
+|************************************************************************/
+
+void SvxHyperlinkInternetTp::SetOnlineMode( BOOL /*bEnable*/ )
+{
+ // State of target-button in subject to the current url-string
+ // ( Can't display any targets in an document, if there is no
+ // valid url to a document )
+ String aStrCurrentTarget( maCbbTarget.GetText() );
+ aStrCurrentTarget.EraseTrailingChars();
+
+ if( aStrCurrentTarget == aEmptyStr ||
+ aStrCurrentTarget.EqualsIgnoreCaseAscii( sHTTPScheme ) ||
+ aStrCurrentTarget.EqualsIgnoreCaseAscii( sHTTPSScheme ) )
+ maBtTarget.Enable( FALSE );
+ else
+ maBtTarget.Enable( TRUE );
+}
diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx
new file mode 100644
index 000000000000..78ed448e3884
--- /dev/null
+++ b/cui/source/dialogs/hlmailtp.cxx
@@ -0,0 +1,364 @@
+/*************************************************************************
+ *
+ * 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: hlmailtp.cxx,v $
+ * $Revision: 1.23 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <sfx2/request.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/moduleoptions.hxx>
+
+#include "hlmailtp.hxx"
+#include "hyperdlg.hrc"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+/*************************************************************************
+|*
+|* Contructor / Destructor
+|*
+|************************************************************************/
+
+SvxHyperlinkMailTp::SvxHyperlinkMailTp ( Window *pParent, const SfxItemSet& rItemSet)
+: SvxHyperlinkTabPageBase ( pParent, SVX_RES( RID_SVXPAGE_HYPERLINK_MAIL ),
+ rItemSet ),
+ maGrpMailNews ( this, SVX_RES (GRP_MAILNEWS) ),
+ maRbtMail ( this, SVX_RES (RB_LINKTYP_MAIL) ),
+ maRbtNews ( this, SVX_RES (RB_LINKTYP_NEWS) ),
+ maFtReceiver ( this, SVX_RES (FT_RECEIVER) ),
+ maCbbReceiver ( this, INET_PROT_MAILTO ),
+ maBtAdrBook ( this, SVX_RES (BTN_ADRESSBOOK) ),
+ maFtSubject ( this, SVX_RES (FT_SUBJECT) ),
+ maEdSubject ( this, SVX_RES (ED_SUBJECT) )
+{
+ // Set HC bitmaps and disable display of bitmap names.
+ maBtAdrBook.SetModeImage( Image( SVX_RES( IMG_ADRESSBOOK_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ maBtAdrBook.EnableTextDisplay (FALSE);
+
+ InitStdControls();
+ FreeResource();
+
+ // Init URL-Box (pos&size, Open-Handler)
+ maCbbReceiver.SetPosSizePixel ( LogicToPixel( Point( COL_2, 25 ), MAP_APPFONT ),
+ LogicToPixel( Size ( 176 - COL_DIFF, 60), MAP_APPFONT ) );
+
+ maCbbReceiver.Show();
+ maCbbReceiver.SetHelpId( HID_HYPERDLG_MAIL_PATH );
+
+ SetExchangeSupport ();
+
+ // set defaults
+ maRbtMail.Check ();
+
+ // overload handlers
+ maRbtMail.SetClickHdl ( LINK ( this, SvxHyperlinkMailTp, Click_SmartProtocol_Impl ) );
+ maRbtNews.SetClickHdl ( LINK ( this, SvxHyperlinkMailTp, Click_SmartProtocol_Impl ) );
+ maBtAdrBook.SetClickHdl ( LINK ( this, SvxHyperlinkMailTp, ClickAdrBookHdl_Impl ) );
+ maCbbReceiver.SetModifyHdl ( LINK ( this, SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl) );
+
+ if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
+ maBtAdrBook.Hide();
+}
+
+SvxHyperlinkMailTp::~SvxHyperlinkMailTp ()
+{
+}
+
+/*************************************************************************
+|*
+|* Fill the all dialog-controls except controls in groupbox "more..."
+|*
+|************************************************************************/
+
+void SvxHyperlinkMailTp::FillDlgFields ( String& aStrURL )
+{
+ const sal_Char sMailtoScheme[] = INET_MAILTO_SCHEME;
+
+ INetURLObject aURL( aStrURL );
+ String aStrScheme = GetSchemeFromURL( aStrURL );
+
+ // set URL-field and additional controls
+ String aStrURLc ( aStrURL );
+ // set additional controls for EMail:
+ if ( aStrScheme.SearchAscii( sMailtoScheme ) == 0 )
+ {
+ // Find mail-subject
+ String aStrSubject, aStrTmp ( aStrURLc );
+
+ const sal_Char sSubject[] = "subject";
+ xub_StrLen nPos = aStrTmp.ToLowerAscii().SearchAscii( sSubject, 0 );
+ nPos = aStrTmp.Search( sal_Unicode( '=' ), nPos );
+
+ if ( nPos != STRING_NOTFOUND )
+ aStrSubject = aStrURLc.Copy( nPos+1, aStrURLc.Len() );
+
+ nPos = aStrURLc.Search ( sal_Unicode( '?' ), 0);
+
+ aStrURLc = aStrURLc.Copy( 0, ( nPos == STRING_NOTFOUND ?
+ aStrURLc.Len() : nPos ) );
+
+ maEdSubject.SetText ( aStrSubject );
+ }
+ else
+ {
+ maEdSubject.SetText (aEmptyStr);
+ }
+
+ maCbbReceiver.SetText ( aStrURLc );
+
+ SetScheme( aStrScheme );
+}
+
+/*************************************************************************
+|*
+|* retrieve and prepare data from dialog-fields
+|*
+|************************************************************************/
+
+void SvxHyperlinkMailTp::GetCurentItemData ( String& aStrURL, String& aStrName,
+ String& aStrIntName, String& aStrFrame,
+ SvxLinkInsertMode& eMode )
+{
+ aStrURL = CreateAbsoluteURL();
+ GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode );
+}
+
+String SvxHyperlinkMailTp::CreateAbsoluteURL() const
+{
+ String aStrURL = maCbbReceiver.GetText();
+ INetURLObject aURL(aStrURL);
+
+ if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
+ {
+ aURL.SetSmartProtocol( GetSmartProtocolFromButtons() );
+ aURL.SetSmartURL(aStrURL);
+ }
+
+ // subject for EMail-url
+ if( aURL.GetProtocol() == INET_PROT_MAILTO )
+ {
+ if ( maEdSubject.GetText() != aEmptyStr )
+ {
+ String aQuery = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "subject=" ) );
+ aQuery.Append( maEdSubject.GetText() );
+ aURL.SetParam(aQuery);
+ }
+ }
+
+ if ( aURL.GetProtocol() != INET_PROT_NOT_VALID )
+ return aURL.GetMainURL( INetURLObject::DECODE_WITH_CHARSET );
+ else //#105788# always create a URL even if it is not valid
+ return aStrURL;
+}
+
+/*************************************************************************
+|*
+|* static method to create Tabpage
+|*
+|************************************************************************/
+
+IconChoicePage* SvxHyperlinkMailTp::Create( Window* pWindow, const SfxItemSet& rItemSet )
+{
+ return( new SvxHyperlinkMailTp( pWindow, rItemSet ) );
+}
+
+/*************************************************************************
+|*
+|* Set initial focus
+|*
+|************************************************************************/
+
+void SvxHyperlinkMailTp::SetInitFocus()
+{
+ maCbbReceiver.GrabFocus();
+}
+
+/*************************************************************************
+|************************************************************************/
+
+void SvxHyperlinkMailTp::SetScheme( const String& aScheme )
+{
+ //if aScheme is empty or unknown the default beaviour is like it where MAIL
+ const sal_Char sNewsScheme[] = INET_NEWS_SCHEME;
+
+ BOOL bMail = aScheme.SearchAscii( sNewsScheme ) != 0;
+
+ //update protocol button selection:
+ maRbtMail.Check(bMail);
+ maRbtNews.Check(!bMail);
+
+ //update target:
+ RemoveImproperProtocol(aScheme);
+ maCbbReceiver.SetSmartProtocol( GetSmartProtocolFromButtons() );
+
+ //show/hide special fields for MAIL:
+ maFtSubject.Enable(bMail);
+ maEdSubject.Enable(bMail);
+}
+
+/*************************************************************************
+|*
+|* Remove protocol if it does not fit to the current button selection
+|*
+|************************************************************************/
+
+void SvxHyperlinkMailTp::RemoveImproperProtocol(const String& aProperScheme)
+{
+ String aStrURL ( maCbbReceiver.GetText() );
+ if ( aStrURL != aEmptyStr )
+ {
+ String aStrScheme = GetSchemeFromURL( aStrURL );
+ if ( aStrScheme != aEmptyStr && aStrScheme != aProperScheme )
+ {
+ aStrURL.Erase ( 0, aStrScheme.Len() );
+ maCbbReceiver.SetText ( aStrURL );
+ }
+ }
+}
+
+String SvxHyperlinkMailTp::GetSchemeFromButtons() const
+{
+ if( maRbtNews.IsChecked() )
+ {
+ return String::CreateFromAscii( INET_NEWS_SCHEME );
+ }
+ return String::CreateFromAscii( INET_MAILTO_SCHEME );
+}
+
+INetProtocol SvxHyperlinkMailTp::GetSmartProtocolFromButtons() const
+{
+ if( maRbtNews.IsChecked() )
+ {
+ return INET_PROT_NEWS;
+ }
+ return INET_PROT_MAILTO;
+}
+
+/*************************************************************************
+|*
+|* Click on radiobutton : Type EMail
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkMailTp, Click_SmartProtocol_Impl, void *, EMPTYARG )
+{
+ String aScheme = GetSchemeFromButtons();
+ SetScheme( aScheme );
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Contens of editfield "receiver" modified
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl, void *, EMPTYARG )
+{
+ String aScheme = GetSchemeFromURL( maCbbReceiver.GetText() );
+ if(aScheme.Len()!=0)
+ SetScheme( aScheme );
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Click on imagebutton : addressbook
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkMailTp, ClickAdrBookHdl_Impl, void *, EMPTYARG )
+{
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if( pViewFrame )
+ {
+ SfxItemPool &rPool = pViewFrame->GetPool();
+ SfxRequest aReq(SID_VIEW_DATA_SOURCE_BROWSER, 0, rPool);
+ pViewFrame->ExecuteSlot( aReq, sal_True );
+ }
+
+
+/* uno::Reference< frame::XDispatchProvider > xProv( pViewFrame->GetFrame()->GetFrameInterface(), uno::UNO_QUERY );
+ if ( xProv.is() )
+ {
+!!! (pb) we need a new config item here
+ SfxAppIniManagerProperty aProp;
+ GetpApp()->Property( aProp );
+ if( !aProp.GetIniManager() )
+ return ( 0L );
+
+ String aAddressBook = aProp.GetIniManager()->Get( SFX_KEY_ADDRESSBOOK );
+ INetURLObject aObj;
+ aObj.SetSmartProtocol( INET_PROT_FILE );
+ aObj.SetURL( aAddressBook.GetToken( 0, sal_Unicode( ';' ) ) );
+
+ String aMark( RTL_CONSTASCII_USTRINGPARAM( "db:Table;" ) );
+ aMark += aAddressBook.GetToken( 1, sal_Unicode( ';' ) );
+ aObj.SetMark( aMark );
+
+ util::URL aURL;
+ aURL.Complete = ::rtl::OUString( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ if( xFactory.is() )
+ {
+ uno::Reference< util::XURLTransformer > xTrans( xFactory->createInstance
+ ( OUString::createFromAscii( "com.sun.star.util.URLTransformer" ) ),
+ uno::UNO_QUERY);
+ xTrans->parseStrict( aURL );
+
+ uno::Reference< frame::XDispatch > aDisp = xProv->queryDispatch( aURL,
+ OUString::createFromAscii( "_beamer" ),
+ frame::FrameSearchFlag::GLOBAL |
+ frame::FrameSearchFlag::CREATE );
+ if ( aDisp.is() )
+ {
+ uno::Sequence< beans::PropertyValue > aArgs(1);
+ beans::PropertyValue* pArg = aArgs.getArray();
+ pArg[0].Name = DEFINE_CONST_UNICODE("Referer");
+ pArg[0].Value = uno::makeAny( OUString( DEFINE_CONST_UNICODE("private:user") ) );
+ aDisp->dispatch( aURL, aArgs );
+ }
+ }
+ }
+*/
+
+ return( 0L );
+}
+
+
diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx
new file mode 100644
index 000000000000..608dc613eea7
--- /dev/null
+++ b/cui/source/dialogs/hlmarkwn.cxx
@@ -0,0 +1,546 @@
+/*************************************************************************
+ *
+ * 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: hlmarkwn.cxx,v $
+ * $Revision: 1.19.216.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <vcl/wrkwin.hxx>
+#include <svx/dialmgr.hxx>
+#include <sfx2/docfile.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/settings.hxx>
+
+// UNO-Stuff
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/document/XLinkTargetSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <toolkit/unohlp.hxx>
+
+#include <svx/dialogs.hrc>
+#include "hlmarkwn.hrc"
+#include "hlmarkwn.hxx"
+#include "hltpbase.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+/*************************************************************************
+|*
+|* Userdata-struct for tree-entries
+|*
+|************************************************************************/
+
+struct TargetData
+{
+ OUString aUStrLinkname;
+ BOOL bIsTarget;
+
+ TargetData ( OUString aUStrLName, BOOL bTarget )
+ : bIsTarget ( bTarget )
+ {
+ if ( bIsTarget )
+ aUStrLinkname = aUStrLName;
+ }
+};
+
+
+//########################################################################
+//# #
+//# Tree-Window #
+//# #
+//########################################################################
+
+SvxHlmarkTreeLBox::SvxHlmarkTreeLBox( Window* pParent, const ResId& rResId )
+: SvTreeListBox ( pParent, rResId ),
+ mpParentWnd ( (SvxHlinkDlgMarkWnd*) pParent )
+{
+ SetNodeDefaultImages();
+}
+
+void SvxHlmarkTreeLBox::Paint( const Rectangle& rRect )
+{
+ if( mpParentWnd->mnError == LERR_NOERROR )
+ {
+ SvTreeListBox::Paint(rRect);
+ }
+ else
+ {
+ Erase();
+
+ Rectangle aDrawRect( Point( 0, 0 ), GetSizePixel() );
+
+ String aStrMessage;
+
+ switch( mpParentWnd->mnError )
+ {
+ case LERR_NOENTRIES :
+ aStrMessage = SVX_RESSTR( RID_SVXSTR_HYPDLG_ERR_LERR_NOENTRIES );
+ break;
+ case LERR_DOCNOTOPEN :
+ aStrMessage = SVX_RESSTR( RID_SVXSTR_HYPDLG_ERR_LERR_DOCNOTOPEN );
+ break;
+ }
+
+ DrawText( aDrawRect, aStrMessage, TEXT_DRAW_LEFT | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ }
+
+}
+
+//########################################################################
+//# #
+//# Window-Class #
+//# #
+//########################################################################
+
+/*************************************************************************
+|*
+|* Contructor / Destructor
+|*
+|************************************************************************/
+
+SvxHlinkDlgMarkWnd::SvxHlinkDlgMarkWnd( SvxHyperlinkTabPageBase *pParent )
+: ModalDialog( (Window*)pParent, SVX_RES ( RID_SVXFLOAT_HYPERLINK_MARKWND ) ),
+ maBtApply( this, SVX_RES (BT_APPLY) ),
+ maBtClose( this, SVX_RES (BT_CLOSE) ),
+ maLbTree ( this, SVX_RES (TLB_MARK) ),
+ mbUserMoved ( FALSE ),
+ mbFirst ( TRUE ),
+ mpParent ( pParent ),
+ mnError ( LERR_NOERROR )
+{
+ FreeResource();
+
+ maBtApply.SetClickHdl ( LINK ( this, SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl ) );
+ maBtClose.SetClickHdl ( LINK ( this, SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl ) );
+ maLbTree.SetDoubleClickHdl ( LINK ( this, SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl ) );
+
+ // Tree-ListBox mit Linien versehen
+ maLbTree.SetWindowBits( WinBits( WB_TABSTOP | WB_BORDER | WB_HASLINES |
+ WB_HASBUTTONS | //WB_HASLINESATROOT |
+ WB_HSCROLL | WB_HASBUTTONSATROOT ) );
+}
+
+SvxHlinkDlgMarkWnd::~SvxHlinkDlgMarkWnd()
+{
+ ClearTree();
+}
+
+/*************************************************************************
+|*
+|* Set an errorstatus
+|*
+|************************************************************************/
+
+USHORT SvxHlinkDlgMarkWnd::SetError( USHORT nError)
+{
+ USHORT nOldError = mnError;
+ mnError = nError;
+
+ if( mnError != LERR_NOERROR )
+ ClearTree();
+
+ maLbTree.Invalidate();
+
+ return nOldError;
+}
+
+/*************************************************************************
+|*
+|* Move window
+|*
+|************************************************************************/
+
+BOOL SvxHlinkDlgMarkWnd::MoveTo ( Point aNewPos )
+{
+ if ( !mbUserMoved )
+ {
+ BOOL bOldStatus = mbUserMoved;
+ SetPosPixel ( aNewPos );
+ mbUserMoved = bOldStatus;
+ }
+
+ return mbUserMoved;
+}
+
+void SvxHlinkDlgMarkWnd::Move ()
+{
+ Window::Move();
+
+ if ( IsReallyVisible() )
+ mbUserMoved = TRUE;
+}
+
+BOOL SvxHlinkDlgMarkWnd::ConnectToDialog( BOOL bDoit )
+{
+ BOOL bOldStatus = mbUserMoved;
+
+ mbUserMoved = !bDoit;
+
+ return bOldStatus;
+}
+
+/*************************************************************************
+|*
+|* Interface to refresh tree
+|*
+|************************************************************************/
+
+void SvxHlinkDlgMarkWnd::RefreshTree ( String aStrURL )
+{
+ String aEmptyStr;
+ OUString aUStrURL;
+
+ EnterWait();
+
+ ClearTree();
+
+ xub_StrLen nPos = aStrURL.Search ( sal_Unicode('#') );
+
+ if( nPos != 0 )
+ aUStrURL = ::rtl::OUString( aStrURL );
+
+ if( !RefreshFromDoc ( aUStrURL ) )
+ maLbTree.Invalidate();
+
+ if ( nPos != STRING_NOTFOUND )
+ {
+ String aStrMark = aStrURL.Copy ( nPos+1 );
+ SelectEntry ( aStrMark );
+ }
+
+ LeaveWait();
+
+ maStrLastURL = aStrURL;
+}
+
+/*************************************************************************
+|*
+|* get links from document
+|*
+|************************************************************************/
+
+BOOL SvxHlinkDlgMarkWnd::RefreshFromDoc( OUString aURL )
+{
+ mnError = LERR_NOERROR;
+
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ if( xFactory.is() )
+ {
+ uno::Reference< frame::XDesktop > xDesktop( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ),
+ uno::UNO_QUERY );
+ if( xDesktop.is() )
+ {
+ uno::Reference< lang::XComponent > xComp;
+
+ if( aURL.getLength() )
+ {
+ // load from url
+ uno::Reference< frame::XComponentLoader > xLoader( xDesktop, uno::UNO_QUERY );
+ if( xLoader.is() )
+ {
+ try
+ {
+ uno::Sequence< beans::PropertyValue > aArg(1);
+ aArg.getArray()[0].Name = OUString::createFromAscii( "Hidden" );
+ aArg.getArray()[0].Value <<= (sal_Bool) TRUE;
+ xComp = xLoader->loadComponentFromURL( aURL, OUString::createFromAscii( "_blank" ), 0, aArg );
+ }
+ catch( const io::IOException& )
+ {
+
+ }
+ catch( const lang::IllegalArgumentException& )
+ {
+
+ }
+ }
+ }
+ else
+ {
+ // the component with user focus ( current document )
+ xComp = xDesktop->getCurrentComponent();
+ }
+
+ if( xComp.is() )
+ {
+ uno::Reference< document::XLinkTargetSupplier > xLTS( xComp, uno::UNO_QUERY );
+
+ if( xLTS.is() )
+ {
+ if( FillTree( xLTS->getLinks() ) == 0 )
+ mnError = LERR_NOENTRIES;
+ }
+ else
+ mnError = LERR_DOCNOTOPEN;
+
+ if ( aURL.getLength() )
+ xComp->dispose();
+ }
+ else
+ {
+ if( aURL.getLength() )
+ mnError=LERR_DOCNOTOPEN;
+ }
+ }
+ }
+ return (mnError==0);
+}
+/*
+void SvxHlinkDlgMarkWnd::Error(int nNr)
+{
+ switch(nNr)
+ {
+ case 0:
+ {
+ Rectangle aDrawRect( Point( 0, 0 ), maLbTree.GetSizePixel() );
+ //maLbTree.SetTextColor( Color(COL_BLACK) );
+ //maLbTree.DrawText( aDrawRect, "Keine Ziele im Dokument vorhanden.", TEXT_DRAW_LEFT);// | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ maLbTree.DrawText( Point(0,0), "Keine Ziele im Dokument vorhanden.");
+ maLbTree.DrawLine(aDrawRect.TopLeft(), aDrawRect.BottomRight() );
+ }
+ break;
+ case 1:
+ Rectangle aDrawRect( Point( 0, 0 ), maLbTree.GetSizePixel() );
+ maLbTree.DrawText( aDrawRect, "Das Dokument konnte nicht ge�ffnet werden.", TEXT_DRAW_LEFT | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ break;
+ }
+}
+*/
+/*************************************************************************
+|*
+|* Fill Tree-Control
+|*
+|************************************************************************/
+
+int SvxHlinkDlgMarkWnd::FillTree( uno::Reference< container::XNameAccess > xLinks, SvLBoxEntry* pParentEntry )
+{
+ int nEntries=0;
+ const uno::Sequence< OUString > aNames( xLinks->getElementNames() );
+ const ULONG nLinks = aNames.getLength();
+ const OUString* pNames = aNames.getConstArray();
+
+ Color aMaskColor( COL_LIGHTMAGENTA );
+ const OUString aProp_LinkDisplayName( RTL_CONSTASCII_USTRINGPARAM( "LinkDisplayName" ) );
+ const OUString aProp_LinkTarget( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.LinkTarget" ) );
+ const OUString aProp_LinkDisplayBitmap( RTL_CONSTASCII_USTRINGPARAM( "LinkDisplayBitmap" ) );
+ for( ULONG i = 0; i < nLinks; i++ )
+ {
+ uno::Any aAny;
+ OUString aLink( *pNames++ );
+
+ BOOL bError = FALSE;
+ try
+ {
+ aAny = xLinks->getByName( aLink );
+ }
+ catch(const uno::Exception&)
+ {
+ // if the name of the target was invalid (like empty headings)
+ // no object can be provided
+ bError = TRUE;
+ }
+ if(bError)
+ continue;
+
+ uno::Reference< beans::XPropertySet > xTarget;
+
+ if( aAny >>= xTarget )
+ {
+ try
+ {
+ // get name to display
+ aAny = xTarget->getPropertyValue( aProp_LinkDisplayName );
+ OUString aDisplayName;
+ aAny >>= aDisplayName;
+ String aStrDisplayname ( aDisplayName );
+
+ // is it a target ?
+ uno::Reference< lang::XServiceInfo > xSI( xTarget, uno::UNO_QUERY );
+ BOOL bIsTarget = xSI->supportsService( aProp_LinkTarget );
+
+ // create userdata
+ TargetData *pData = new TargetData ( aLink, bIsTarget );
+
+ SvLBoxEntry* pEntry;
+
+ try
+ {
+ // get bitmap for the tree-entry
+ uno::Reference< awt::XBitmap > aXBitmap( xTarget->getPropertyValue( aProp_LinkDisplayBitmap ), uno::UNO_QUERY );
+ if( aXBitmap.is() )
+ {
+ Image aBmp( VCLUnoHelper::GetBitmap( aXBitmap ).GetBitmap(), aMaskColor );
+ // insert Displayname into treelist with bitmaps
+ pEntry = maLbTree.InsertEntry ( aStrDisplayname,
+ aBmp, aBmp,
+ pParentEntry,
+ FALSE, LIST_APPEND,
+ (void*)pData );
+ maLbTree.SetExpandedEntryBmp( pEntry, aBmp, BMP_COLOR_HIGHCONTRAST );
+ maLbTree.SetCollapsedEntryBmp( pEntry, aBmp, BMP_COLOR_HIGHCONTRAST );
+ nEntries++;
+ }
+ else
+ {
+ // insert Displayname into treelist without bitmaps
+ pEntry = maLbTree.InsertEntry ( aStrDisplayname,
+ pParentEntry,
+ FALSE, LIST_APPEND,
+ (void*)pData );
+ nEntries++;
+ }
+ }
+ catch(const com::sun::star::uno::Exception&)
+ {
+ // insert Displayname into treelist without bitmaps
+ pEntry = maLbTree.InsertEntry ( aStrDisplayname,
+ pParentEntry,
+ FALSE, LIST_APPEND,
+ (void*)pData );
+ nEntries++;
+ }
+
+ uno::Reference< document::XLinkTargetSupplier > xLTS( xTarget, uno::UNO_QUERY );
+ if( xLTS.is() )
+ nEntries += FillTree( xLTS->getLinks(), pEntry );
+ }
+ catch(const com::sun::star::uno::Exception&)
+ {
+ }
+ }
+ }
+
+ return nEntries;
+}
+
+/*************************************************************************
+|*
+|* Clear Tree
+|*
+|************************************************************************/
+
+void SvxHlinkDlgMarkWnd::ClearTree()
+{
+ SvLBoxEntry* pEntry = maLbTree.First();
+
+ while ( pEntry )
+ {
+ TargetData* pUserData = ( TargetData * ) pEntry->GetUserData();
+ delete pUserData;
+
+ pEntry = maLbTree.Next( pEntry );
+ }
+
+ maLbTree.Clear();
+}
+
+/*************************************************************************
+|*
+|* Find Entry for Strng
+|*
+|************************************************************************/
+
+SvLBoxEntry* SvxHlinkDlgMarkWnd::FindEntry ( String aStrName )
+{
+ BOOL bFound=FALSE;
+ SvLBoxEntry* pEntry = maLbTree.First();
+
+ while ( pEntry && !bFound )
+ {
+ TargetData* pUserData = ( TargetData * ) pEntry->GetUserData ();
+ if ( aStrName == String( pUserData->aUStrLinkname ) )
+ bFound = TRUE;
+ else
+ pEntry = maLbTree.Next( pEntry );
+ }
+
+ return pEntry;
+}
+
+/*************************************************************************
+|*
+|* Select Entry
+|*
+|************************************************************************/
+
+void SvxHlinkDlgMarkWnd::SelectEntry ( String aStrMark )
+{
+ SvLBoxEntry* pEntry = FindEntry ( aStrMark );
+ if ( pEntry )
+ {
+ maLbTree.Select ( pEntry );
+ maLbTree.MakeVisible ( pEntry );
+ }
+}
+
+/*************************************************************************
+|*
+|* Click on Apply-Button / Doubleclick on item in tree
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl, void *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = maLbTree.GetCurEntry();
+
+ if ( pEntry )
+ {
+ TargetData *pData = ( TargetData * )pEntry->GetUserData();
+
+ if ( pData->bIsTarget )
+ {
+ String aStrMark ( pData->aUStrLinkname );
+ mpParent->SetMarkStr ( aStrMark );
+ }
+ }
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Click on Close-Button
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl, void *, EMPTYARG )
+{
+ Close();
+
+ return( 0L );
+}
+
+
diff --git a/cui/source/dialogs/hlmarkwn.hrc b/cui/source/dialogs/hlmarkwn.hrc
new file mode 100644
index 000000000000..d79da8b38dd6
--- /dev/null
+++ b/cui/source/dialogs/hlmarkwn.hrc
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * 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: hlmarkwn.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_APPLY 1
+#define BT_CLOSE 2
+#define TLB_MARK 3
+
+//#define HYPERLINK_BMP_EXPAND 301
+//#define HYPERLINK_BMP_COLLAPSE 302
+
diff --git a/cui/source/dialogs/hlmarkwn.src b/cui/source/dialogs/hlmarkwn.src
new file mode 100644
index 000000000000..4618ee6c9549
--- /dev/null
+++ b/cui/source/dialogs/hlmarkwn.src
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * 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: hlmarkwn.src,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "helpid.hrc"
+#include "hlmarkwn.hrc"
+
+ModalDialog RID_SVXFLOAT_HYPERLINK_MARKWND
+{
+ HelpID = HID_HYPERLINK_MARKWND;
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;//?????
+ Sizeable = FALSE ;
+ Border = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 109 , 185 ) ;
+ Text [ en-US ] = "Target in Document" ;
+ PushButton BT_APPLY
+ {
+ HelpId = HID_HYPERLINK_MARKWND_APPLY;
+ Pos = MAP_APPFONT ( 3 , 168 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ Text [ en-US ] = "Apply" ;
+ };
+ PushButton BT_CLOSE
+ {
+ HelpId = HID_HYPERLINK_MARKWND_CLOSE;
+ Pos = MAP_APPFONT ( 56 , 168 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Close" ;
+ };
+ Control TLB_MARK
+ {
+ HelpId = HID_HYPERLINK_MARKWND_TREE;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 103 , 162 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+String RID_SVXSTR_HYPDLG_ERR_LERR_NOENTRIES
+{
+ Text [ en-US ] = "Targets do not exist in the document." ;
+};
+
+String RID_SVXSTR_HYPDLG_ERR_LERR_DOCNOTOPEN
+{
+ Text [ en-US ] = "Couldn't open the document." ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
new file mode 100644
index 000000000000..77a98602c408
--- /dev/null
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -0,0 +1,873 @@
+/*************************************************************************
+ *
+ * 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: hltpbase.cxx,v $
+ * $Revision: 1.37.216.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <sfx2/frame.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sot/formats.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <svl/macitem.hxx>
+#include <ucbhelper/content.hxx>
+#include <unotools/localfilehelper.hxx>
+#include "hyperdlg.hrc"
+#include "cuihyperdlg.hxx" //CHINA001
+#include "hltpbase.hxx"
+#include "macroass.hxx"
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialogs.hrc> //CHINA001
+
+using namespace ::ucbhelper;
+
+//########################################################################
+//# #
+//# ComboBox-Control, wich is filled with all current framenames #
+//# #
+//########################################################################
+
+/*************************************************************************
+|*
+|* Contructor / Destructor
+|*
+|************************************************************************/
+
+SvxFramesComboBox::SvxFramesComboBox ( Window* pParent, const ResId& rResId,
+ SfxDispatcher* pDispatch )
+: ComboBox (pParent, rResId)
+{
+ TargetList* pList = new TargetList;
+ SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : 0;
+ SfxFrame* pFrame = pViewFrame ? pViewFrame->GetTopFrame() : 0;
+ if ( pFrame )
+ {
+ pFrame->GetTargetList(*pList);
+ USHORT nCount = (USHORT)pList->Count();
+ if( nCount )
+ {
+ USHORT i;
+ for ( i = 0; i < nCount; i++ )
+ {
+ InsertEntry(*pList->GetObject(i));
+ }
+ for ( i = nCount; i; i-- )
+ {
+ delete pList->GetObject( i - 1 );
+ }
+ }
+ delete pList;
+ }
+}
+
+SvxFramesComboBox::~SvxFramesComboBox ()
+{
+}
+//########################################################################
+//# #
+//# ComboBox-Control for URL's with History and Autocompletion #
+//# #
+//########################################################################
+
+/*************************************************************************
+|*
+|* Contructor / Destructor
+|*
+|************************************************************************/
+
+SvxHyperURLBox::SvxHyperURLBox( Window* pParent, INetProtocol eSmart, BOOL bAddresses )
+: SvtURLBox ( pParent, eSmart ),
+ DropTargetHelper ( this ),
+ mbAccessAddress (bAddresses)
+{
+}
+
+sal_Int8 SvxHyperURLBox::AcceptDrop( const AcceptDropEvent& /* rEvt */ )
+{
+ return( IsDropFormatSupported( FORMAT_STRING ) ? DND_ACTION_COPY : DND_ACTION_NONE );
+}
+
+sal_Int8 SvxHyperURLBox::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
+ String aString;
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( aDataHelper.GetString( FORMAT_STRING, aString ) )
+ {
+ SetText( aString );
+ nRet = DND_ACTION_COPY;
+ }
+
+ return nRet;
+}
+
+/*
+Diese Methode parsed eine EMailadresse aus einem D&D-DataObjekt aus der Adre�datenbank heraus
+
+#ifndef _OFF_OFADBMGR_HXX
+#include <offmgr/ofadbmgr.hxx>
+#endif
+#ifndef _SFX_APP_HXX
+#include <offmgr/app.hxx>
+#endif
+#ifndef _SDB_SDBCURS_HXX
+#include <sdb/sdbcurs.hxx>
+#endif
+
+#define DB_DD_DELIM ((char)11)
+
+String SvxHyperURLBox::GetAllEmailNamesFromDragItem( USHORT nItem )
+{
+#if !defined( ICC ) && !defined( SOLARIS )
+ String aAddress;
+
+ if ( DragServer::HasFormat( nItem, SOT_FORMATSTR_ID_SBA_DATAEXCHANGE ) )
+ {
+ ULONG nLen = DragServer::GetDataLen( nItem, SOT_FORMATSTR_ID_SBA_DATAEXCHANGE ) - 1;
+ USHORT i = 0;
+ String aTxt;
+ char *pTxt = aTxt.AllocStrBuf( (USHORT)nLen );
+ DragServer::PasteData( nItem, pTxt, nLen, SOT_FORMATSTR_ID_SBA_DATAEXCHANGE );
+ String aDBName = aTxt.GetToken( i++, DB_DD_DELIM );
+ String aTableName = aTxt.GetToken( i++, DB_DD_DELIM );
+ i++; // Format"anderung
+ String aStatement = aTxt.GetToken( i++, DB_DD_DELIM );
+ if ( !aStatement )
+ {
+ aDBName += DB_DELIM;
+ aDBName += aTableName;
+ }
+ else
+ {
+ // use here another delimiter, because the OfaDBMgr uses two
+ // delimiters ( (char)11 and ; )
+ aDBName += ';';
+ aDBName += aStatement;
+ }
+ SbaSelectionListRef pSelectionList;
+ pSelectionList.Clear();
+ pSelectionList = new SbaSelectionList;
+ USHORT nTokCnt = aTxt.GetTokenCount( DB_DD_DELIM );
+
+ for ( ; i < nTokCnt; ++i )
+ pSelectionList->Insert(
+ (void*)(USHORT)aTxt.GetToken( i, DB_DD_DELIM ), LIST_APPEND );
+
+ OfaDBMgr* pDBMgr = SFX_APP()->GetOfaDBMgr();
+ BOOL bBasic = DBMGR_STD;
+
+ if ( !pDBMgr->OpenDB( bBasic, aDBName ) )
+ return aAddress;
+
+ OfaDBParam& rParam = pDBMgr->GetDBData( bBasic );
+ pDBMgr->ChangeStatement( bBasic, aStatement );
+ rParam.pSelectionList->Clear();
+
+ if ( pSelectionList.Is() &&
+ (long)pSelectionList->GetObject(0) != -1L )
+ *rParam.pSelectionList = *pSelectionList;
+
+ if ( !pDBMgr->ToFirstSelectedRecord( bBasic ) )
+ {
+ pDBMgr->CloseAll();
+ return aAddress;
+ }
+
+ if ( pDBMgr->IsSuccessful( bBasic ) )
+ {
+ // Spaltenk"opfe
+ SbaDBDataDefRef aDBDef = pDBMgr->OpenColumnNames( bBasic );
+
+ if ( aDBDef.Is() )
+ {
+ SbaColumn* pCol = aDBDef->GetColumn("EMAIL");
+ ULONG nPos = 0;
+
+ if ( pCol )
+ nPos = aDBDef->GetOriginalColumns().GetPos( pCol ) + 1;
+ for ( i = 0 ; nPos && i < pSelectionList->Count(); ++i )
+ {
+ ULONG nIndex = (ULONG)pSelectionList->GetObject(i);
+
+ // N"achsten zu lesenden Datensatz ansteuern
+
+ BOOL bEnd = rParam.GetCursor()->IsOffRange();
+
+ if ( !bEnd )
+ {
+ const ODbRowRef aRow =
+ pDBMgr->GetSelectedRecord( bBasic, i );
+
+ if ( aRow.Is() )
+ {
+ aAddress += pDBMgr->
+ ImportDBField( (USHORT)nPos, &aDBDef, aRow.getBodyPtr() );
+ aAddress += ',';
+ }
+ else
+ {
+ aAddress.Erase();
+ break;
+ }
+ }
+ else
+ break;
+ }
+ }
+ }
+ pDBMgr->CloseAll();
+ }
+ aAddress.EraseTrailingChars( ',' );
+ return aAddress;
+#else
+ return String();
+#endif
+}
+*/
+
+void SvxHyperURLBox::Select()
+{
+ SvtURLBox::Select();
+}
+void SvxHyperURLBox::Modify()
+{
+ SvtURLBox::Modify();
+}
+long SvxHyperURLBox::Notify( NotifyEvent& rNEvt )
+{
+ return SvtURLBox::Notify( rNEvt );
+}
+long SvxHyperURLBox::PreNotify( NotifyEvent& rNEvt )
+{
+ return SvtURLBox::PreNotify( rNEvt );
+}
+
+//########################################################################
+//# #
+//# Hyperlink-Dialog: Tabpages-Baseclass #
+//# #
+//########################################################################
+
+/*************************************************************************
+|*
+|* Con/Destructor, Initialize
+|*
+\************************************************************************/
+
+SvxHyperlinkTabPageBase::SvxHyperlinkTabPageBase ( Window *pParent,
+ const ResId &rResId,
+ const SfxItemSet& rItemSet )
+: IconChoicePage ( pParent, rResId, rItemSet ),
+ mpGrpMore ( NULL ),
+ mpFtFrame ( NULL ),
+ mpCbbFrame ( NULL ),
+ mpFtForm ( NULL ),
+ mpLbForm ( NULL ),
+ mpFtIndication ( NULL ),
+ mpEdIndication ( NULL ),
+ mpFtText ( NULL ),
+ mpEdText ( NULL ),
+ mpBtScript ( NULL ),
+ mbIsCloseDisabled ( sal_False ),
+ mpDialog ( pParent ),
+ mbStdControlsInit ( FALSE ),
+ aEmptyStr()
+{
+ // create bookmark-window
+ mpMarkWnd = new SvxHlinkDlgMarkWnd ( this );
+}
+
+SvxHyperlinkTabPageBase::~SvxHyperlinkTabPageBase ()
+{
+ maTimer.Stop();
+
+ if ( mbStdControlsInit )
+ {
+ delete mpGrpMore;
+ delete mpFtFrame;
+ delete mpCbbFrame;
+ delete mpFtForm;
+ delete mpLbForm;
+ delete mpFtIndication;
+ delete mpEdIndication;
+ delete mpFtText;
+ delete mpEdText ;
+ delete mpBtScript;
+ }
+
+ delete mpMarkWnd;
+}
+
+void SvxHyperlinkTabPageBase::ActivatePage()
+{
+ TabPage::ActivatePage();
+}
+
+void SvxHyperlinkTabPageBase::DeactivatePage()
+{
+ TabPage::DeactivatePage();
+}
+
+sal_Bool SvxHyperlinkTabPageBase::QueryClose()
+{
+ return !mbIsCloseDisabled;
+}
+
+void SvxHyperlinkTabPageBase::InitStdControls ()
+{
+ if ( !mbStdControlsInit )
+ {
+ mpGrpMore = new FixedLine ( this, ResId (GRP_MORE, *m_pResMgr) );
+ mpFtFrame = new FixedText ( this, ResId (FT_FRAME, *m_pResMgr) );
+ mpCbbFrame = new SvxFramesComboBox ( this, ResId (CB_FRAME, *m_pResMgr), GetDispatcher() );
+ mpFtForm = new FixedText ( this, ResId (FT_FORM, *m_pResMgr) );
+ mpLbForm = new ListBox ( this, ResId (LB_FORM, *m_pResMgr) );
+ mpFtIndication= new FixedText ( this, ResId (FT_INDICATION, *m_pResMgr) );
+ mpEdIndication= new Edit ( this, ResId (ED_INDICATION, *m_pResMgr) );
+ mpFtText = new FixedText ( this, ResId (FT_TEXT, *m_pResMgr) );
+ mpEdText = new Edit ( this, ResId (ED_TEXT, *m_pResMgr) );
+ mpBtScript = new ImageButton ( this, ResId (BTN_SCRIPT, *m_pResMgr) );
+
+ mpBtScript->SetClickHdl ( LINK ( this, SvxHyperlinkTabPageBase, ClickScriptHdl_Impl ) );
+
+ mpBtScript->SetModeImage( Image( ResId( IMG_SCRIPT_HC, *m_pResMgr ) ), BMP_COLOR_HIGHCONTRAST );
+ mpBtScript->EnableTextDisplay (FALSE);
+ }
+
+ mbStdControlsInit = TRUE;
+}
+
+/*************************************************************************
+|*
+|* Move Extra-Window
+|*
+\************************************************************************/
+
+BOOL SvxHyperlinkTabPageBase::MoveToExtraWnd( Point aNewPos, BOOL bDisConnectDlg )
+{
+ BOOL bReturn = mpMarkWnd->MoveTo ( aNewPos );
+
+ if( bDisConnectDlg )
+ mpMarkWnd->ConnectToDialog( FALSE );
+
+ return ( !bReturn && IsMarkWndVisible() );
+}
+
+/*************************************************************************
+|*
+|* Show Extra-Window
+|*
+\************************************************************************/
+
+void SvxHyperlinkTabPageBase::ShowMarkWnd ()
+{
+ ( ( Window* ) mpMarkWnd )->Show();
+
+ // Size of dialog-window in screen pixels
+ Rectangle aDlgRect( mpDialog->GetWindowExtentsRelative( NULL ) );
+ Point aDlgPos ( aDlgRect.TopLeft() );
+ Size aDlgSize ( mpDialog->GetSizePixel () );
+
+ // Absolute size of the screen
+ Rectangle aScreen( mpDialog->GetDesktopRectPixel() );
+
+ // Size of Extrawindow
+ Size aExtraWndSize( mpMarkWnd->GetSizePixel () );
+
+ // mpMarkWnd is a child of mpDialog, so coordinates for positioning must be relative to mpDialog
+ if( aDlgPos.X()+(1.05*aDlgSize.Width())+aExtraWndSize.Width() > aScreen.Right() )
+ {
+ if( aDlgPos.X() - ( 0.05*aDlgSize.Width() ) - aExtraWndSize.Width() < 0 )
+ {
+ // Pos Extrawindow anywhere
+ MoveToExtraWnd( Point(10,10) ); // very unlikely
+ mpMarkWnd->ConnectToDialog( FALSE );
+ }
+ else
+ {
+ // Pos Extrawindow on the left side of Dialog
+ MoveToExtraWnd( Point(0,0) - Point( long(0.05*aDlgSize.Width()), 0 ) - Point( aExtraWndSize.Width(), 0 ) );
+ }
+ }
+ else
+ {
+ // Pos Extrawindow on the right side of Dialog
+ MoveToExtraWnd ( Point( long(1.05*aDlgSize.getWidth()), 0 ) );
+ }
+
+ // Set size of Extra-Window
+ mpMarkWnd->SetSizePixel( Size( aExtraWndSize.Width(), aDlgSize.Height() ) );
+}
+
+/*************************************************************************
+|*
+|* Fill Dialogfields
+|*
+\************************************************************************/
+
+void SvxHyperlinkTabPageBase::FillStandardDlgFields ( SvxHyperlinkItem* pHyperlinkItem )
+{
+ // Frame
+ USHORT nPos = mpCbbFrame->GetEntryPos ( pHyperlinkItem->GetTargetFrame() );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND)
+ mpCbbFrame->SetText ( pHyperlinkItem->GetTargetFrame() );
+
+ // Form
+ String aStrFormText = SVX_RESSTR( RID_SVXSTR_HYPERDLG_FROM_TEXT );
+ String aStrFormButton = SVX_RESSTR( RID_SVXSTR_HYPERDLG_FORM_BUTTON );
+
+ if( pHyperlinkItem->GetInsertMode() & HLINK_HTMLMODE )
+ {
+ mpLbForm->Clear();
+ mpLbForm->InsertEntry( aStrFormText );
+ mpLbForm->SelectEntryPos ( 0 );
+ }
+ else
+ {
+ mpLbForm->Clear();
+ mpLbForm->InsertEntry( aStrFormText );
+ mpLbForm->InsertEntry( aStrFormButton );
+ mpLbForm->SelectEntryPos ( pHyperlinkItem->GetInsertMode() == HLINK_BUTTON ? 1 : 0 );
+ }
+
+ // URL
+ mpEdIndication->SetText ( pHyperlinkItem->GetName() );
+
+ // Name
+ mpEdText->SetText ( pHyperlinkItem->GetIntName() );
+
+ // Script-button
+ if ( !pHyperlinkItem->GetMacroEvents() )
+ mpBtScript->Disable();
+ else
+ mpBtScript->Enable();
+}
+
+/*************************************************************************
+|*
+|* Any action to do after apply-button is pressed
+|*
+\************************************************************************/
+
+void SvxHyperlinkTabPageBase::DoApply ()
+{
+ // default-implemtation : do nothing
+}
+
+/*************************************************************************
+|*
+|* Ask page whether an insert is possible
+|*
+\************************************************************************/
+
+BOOL SvxHyperlinkTabPageBase::AskApply ()
+{
+ // default-implementation
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* This method would be called from bookmark-window to set new mark-string
+|*
+\************************************************************************/
+
+void SvxHyperlinkTabPageBase::SetMarkStr ( String& /*aStrMark*/ )
+{
+ // default-implemtation : do nothing
+}
+
+/*************************************************************************
+|*
+|* This method will be called from the dialog-class if the state off
+|* the online-mode has changed.
+|*
+\************************************************************************/
+
+void SvxHyperlinkTabPageBase::SetOnlineMode( BOOL /*bEnable*/ )
+{
+ // default-implemtation : do nothing
+}
+
+/*************************************************************************
+|*
+|* Set initial focus
+|*
+|************************************************************************/
+
+void SvxHyperlinkTabPageBase::SetInitFocus()
+{
+ GrabFocus();
+}
+
+/*************************************************************************
+|*
+|* Ask dialog whether the curretn doc is a HTML-doc
+|*
+|************************************************************************/
+
+BOOL SvxHyperlinkTabPageBase::IsHTMLDoc() const
+{
+ return ((SvxHpLinkDlg*)mpDialog)->IsHTMLDoc();
+}
+
+/*************************************************************************
+|*
+|* retrieve dispatcher
+|*
+|************************************************************************/
+
+SfxDispatcher* SvxHyperlinkTabPageBase::GetDispatcher() const
+{
+ return ((SvxHpLinkDlg*)mpDialog)->GetDispatcher();
+}
+
+/*************************************************************************
+|*
+|* Click on imagebutton : Script
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, void *, EMPTYARG )
+{
+ SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *)
+ GetItemSet().GetItem (SID_HYPERLINK_GETLINK);
+
+ if ( pHyperlinkItem->GetMacroEvents() )
+ {
+ // get macros from itemset
+ const SvxMacroTableDtor* pMacroTbl = pHyperlinkItem->GetMacroTbl();
+ SvxMacroItem aItem ( GetWhich(SID_ATTR_MACROITEM) );
+ if( pMacroTbl )
+ aItem.SetMacroTable( *pMacroTbl );
+
+ // create empty itemset for macro-dlg
+ SfxItemSet* pItemSet = new SfxItemSet(SFX_APP()->GetPool(),
+ SID_ATTR_MACROITEM,
+ SID_ATTR_MACROITEM );
+ pItemSet->Put ( aItem, SID_ATTR_MACROITEM );
+
+ // --> PB 2006-01-13 #123474#
+ /* disable HyperLinkDlg for input while the MacroAssignDlg is working
+ because if no JAVA is installed an error box occurs and then it is possible
+ to close the HyperLinkDlg before its child (MacroAssignDlg) -> GPF
+ */
+ BOOL bIsInputEnabled = GetParent()->IsInputEnabled();
+ if ( bIsInputEnabled )
+ GetParent()->EnableInput( FALSE );
+ // <--
+ SfxMacroAssignDlg aDlg( this, mxDocumentFrame, *pItemSet );
+
+ // add events
+ SfxMacroTabPage *pMacroPage = (SfxMacroTabPage*) aDlg.GetTabPage();
+
+ if ( pHyperlinkItem->GetMacroEvents() & HYPERDLG_EVENT_MOUSEOVER_OBJECT )
+ pMacroPage->AddEvent( String( SVX_RESSTR(RID_SVXSTR_HYPDLG_MACROACT1) ),
+ SFX_EVENT_MOUSEOVER_OBJECT );
+ if ( pHyperlinkItem->GetMacroEvents() & HYPERDLG_EVENT_MOUSECLICK_OBJECT )
+ pMacroPage->AddEvent( String( SVX_RESSTR(RID_SVXSTR_HYPDLG_MACROACT2) ),
+ SFX_EVENT_MOUSECLICK_OBJECT);
+ if ( pHyperlinkItem->GetMacroEvents() & HYPERDLG_EVENT_MOUSEOUT_OBJECT )
+ pMacroPage->AddEvent( String( SVX_RESSTR(RID_SVXSTR_HYPDLG_MACROACT3) ),
+ SFX_EVENT_MOUSEOUT_OBJECT);
+
+ // --> PB 2006-01-13 #123474#
+ if ( bIsInputEnabled )
+ GetParent()->EnableInput( TRUE );
+ // <--
+ // execute dlg
+ DisableClose( sal_True );
+ short nRet = aDlg.Execute();
+ DisableClose( sal_False );
+ if ( RET_OK == nRet )
+ {
+ const SfxItemSet* pOutSet = aDlg.GetOutputItemSet();
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, FALSE, &pItem ))
+ {
+ pHyperlinkItem->SetMacroTable( ((SvxMacroItem*)pItem)->GetMacroTable() );
+ }
+ }
+ delete pItemSet;
+ }
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Get Macro-Infos
+|*
+|************************************************************************/
+
+USHORT SvxHyperlinkTabPageBase::GetMacroEvents()
+{
+ SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *)
+ GetItemSet().GetItem (SID_HYPERLINK_GETLINK);
+
+ return pHyperlinkItem->GetMacroEvents();
+}
+
+SvxMacroTableDtor* SvxHyperlinkTabPageBase::GetMacroTable()
+{
+ SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *)
+ GetItemSet().GetItem (SID_HYPERLINK_GETLINK);
+
+ return ( (SvxMacroTableDtor*)pHyperlinkItem->GetMacroTbl() );
+}
+
+/*************************************************************************
+|*
+|* Does the given file exists ?
+|*
+|************************************************************************/
+
+BOOL SvxHyperlinkTabPageBase::FileExists( const INetURLObject& rURL )
+{
+ BOOL bRet = FALSE;
+
+ if( rURL.GetFull().getLength() > 0 )
+ {
+ try
+ {
+ Content aCnt( rURL.GetMainURL( INetURLObject::NO_DECODE ), ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::rtl::OUString aTitle;
+
+ aCnt.getPropertyValue( ::rtl::OUString::createFromAscii( "Title" ) ) >>= aTitle;
+ bRet = ( aTitle.getLength() > 0 );
+ }
+ catch( ... )
+ {
+ DBG_ERROR( "FileExists: ucb error" );
+ }
+ }
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* try to detect the current protocol that is used in aStrURL
+|*
+|************************************************************************/
+
+String SvxHyperlinkTabPageBase::GetSchemeFromURL( String aStrURL )
+{
+ String aStrScheme;
+
+ INetURLObject aURL( aStrURL );
+ INetProtocol aProtocol = aURL.GetProtocol();
+
+ // #77696#
+ // our new INetUrlObject now has the ability
+ // to detect if an Url is valid or not :-(
+ if ( aProtocol == INET_PROT_NOT_VALID )
+ {
+ if ( aStrURL.EqualsIgnoreCaseAscii( INET_HTTP_SCHEME, 0, 7 ) )
+ {
+ aStrScheme = String::CreateFromAscii( INET_HTTP_SCHEME );
+ }
+ else if ( aStrURL.EqualsIgnoreCaseAscii( INET_HTTPS_SCHEME, 0, 8 ) )
+ {
+ aStrScheme = String::CreateFromAscii( INET_HTTPS_SCHEME );
+ }
+ else if ( aStrURL.EqualsIgnoreCaseAscii( INET_FTP_SCHEME, 0, 6 ) )
+ {
+ aStrScheme = String::CreateFromAscii( INET_FTP_SCHEME );
+ }
+ else if ( aStrURL.EqualsIgnoreCaseAscii( INET_MAILTO_SCHEME, 0, 7 ) )
+ {
+ aStrScheme = String::CreateFromAscii( INET_MAILTO_SCHEME );
+ }
+ else if ( aStrURL.EqualsIgnoreCaseAscii( INET_NEWS_SCHEME, 0, 5 ) )
+ {
+ aStrScheme = String::CreateFromAscii( INET_NEWS_SCHEME );
+ }
+ else if ( aStrURL.EqualsIgnoreCaseAscii( INET_TELNET_SCHEME, 0, 9 ) )
+ {
+ aStrScheme = String::CreateFromAscii( INET_TELNET_SCHEME );
+ }
+ }
+ else
+ aStrScheme = INetURLObject::GetScheme( aProtocol );
+ return aStrScheme;
+}
+
+
+void SvxHyperlinkTabPageBase::GetDataFromCommonFields( String& aStrName,
+ String& aStrIntName, String& aStrFrame,
+ SvxLinkInsertMode& eMode )
+{
+ aStrIntName = mpEdText->GetText();
+ aStrName = mpEdIndication->GetText();
+ aStrFrame = mpCbbFrame->GetText();
+ eMode = (SvxLinkInsertMode) (mpLbForm->GetSelectEntryPos()+1);
+ if( IsHTMLDoc() )
+ eMode = (SvxLinkInsertMode) ( UINT16(eMode) | HLINK_HTMLMODE );
+}
+
+/*************************************************************************
+|*
+|* reset dialog-fields
+|*
+|************************************************************************/
+
+void SvxHyperlinkTabPageBase::Reset( const SfxItemSet& rItemSet)
+{
+ ///////////////////////////////////////
+ // Set dialog-fields from create-itemset
+ maStrInitURL = aEmptyStr;
+
+ SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *)
+ rItemSet.GetItem (SID_HYPERLINK_GETLINK);
+
+ if ( pHyperlinkItem )
+ {
+ // set dialog-fields
+ FillStandardDlgFields (pHyperlinkItem);
+
+ // set all other fields
+ FillDlgFields ( (String&)pHyperlinkItem->GetURL() );
+
+ // Store initial URL
+ maStrInitURL = pHyperlinkItem->GetURL();
+ }
+}
+
+/*************************************************************************
+|*
+|* Fill output-ItemSet
+|*
+|************************************************************************/
+
+BOOL SvxHyperlinkTabPageBase::FillItemSet( SfxItemSet& rOut)
+{
+ String aStrURL, aStrName, aStrIntName, aStrFrame;
+ SvxLinkInsertMode eMode;
+
+ GetCurentItemData ( aStrURL, aStrName, aStrIntName, aStrFrame, eMode);
+ if ( !aStrName.Len() ) //automatically create a visible name if the link is created without name
+ aStrName = CreateUiNameFromURL(aStrURL);
+
+ USHORT nEvents = GetMacroEvents();
+ SvxMacroTableDtor* pTable = GetMacroTable();
+
+ SvxHyperlinkItem aItem( SID_HYPERLINK_SETLINK, aStrName, aStrURL, aStrFrame,
+ aStrIntName, eMode, nEvents, pTable );
+ rOut.Put (aItem);
+
+ return TRUE;
+}
+
+String SvxHyperlinkTabPageBase::CreateUiNameFromURL( const String& aStrURL )
+{
+ String aStrUiURL;
+ INetURLObject aURLObj( aStrURL );
+
+ switch(aURLObj.GetProtocol())
+ {
+ case INET_PROT_FILE:
+ utl::LocalFileHelper::ConvertURLToSystemPath( aURLObj.GetMainURL(INetURLObject::NO_DECODE), aStrUiURL );
+ break;
+ case INET_PROT_FTP :
+ {
+ //remove password from name
+ INetURLObject aTmpURL(aURLObj);
+ aTmpURL.SetPass(aEmptyStr);
+ aStrUiURL = aTmpURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
+ }
+ break;
+ default :
+ {
+ aStrUiURL = aURLObj.GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS);
+ }
+ }
+ if(!aStrUiURL.Len())
+ return aStrURL;
+ return aStrUiURL;
+}
+
+/*************************************************************************
+|*
+|* Activate / Deactivate Tabpage
+|*
+|************************************************************************/
+
+void SvxHyperlinkTabPageBase::ActivatePage( const SfxItemSet& rItemSet )
+{
+ ///////////////////////////////////////
+ // Set dialog-fields from input-itemset
+ SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *)
+ rItemSet.GetItem (SID_HYPERLINK_GETLINK);
+
+ if ( pHyperlinkItem )
+ {
+ // standard-fields
+ FillStandardDlgFields (pHyperlinkItem);
+ }
+
+ // show mark-window if it was open before
+ if ( ShouldOpenMarkWnd () )
+ ShowMarkWnd ();
+}
+
+int SvxHyperlinkTabPageBase::DeactivatePage( SfxItemSet* _pSet)
+{
+ // hide mark-wnd
+ SetMarkWndShouldOpen( IsMarkWndVisible () );
+ HideMarkWnd ();
+
+ // retrieve data of dialog
+ String aStrURL, aStrName, aStrIntName, aStrFrame;
+ SvxLinkInsertMode eMode;
+
+ GetCurentItemData ( aStrURL, aStrName, aStrIntName, aStrFrame, eMode);
+
+ USHORT nEvents = GetMacroEvents();
+ SvxMacroTableDtor* pTable = GetMacroTable();
+
+ if( _pSet )
+ {
+ SvxHyperlinkItem aItem( SID_HYPERLINK_GETLINK, aStrName, aStrURL, aStrFrame,
+ aStrIntName, eMode, nEvents, pTable );
+ _pSet->Put( aItem );
+ }
+
+ return( LEAVE_PAGE );
+}
+
+BOOL SvxHyperlinkTabPageBase::ShouldOpenMarkWnd()
+{
+ return FALSE;
+}
+
+void SvxHyperlinkTabPageBase::SetMarkWndShouldOpen(BOOL)
+{
+}
diff --git a/cui/source/dialogs/hyperdlg.hrc b/cui/source/dialogs/hyperdlg.hrc
new file mode 100644
index 000000000000..69dae5d1ce57
--- /dev/null
+++ b/cui/source/dialogs/hyperdlg.hrc
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hyperdlg.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 : Hyperlink - Internet */
+
+#define GRP_LINKTYPE 1
+#define RB_LINKTYP_INTERNET 2
+#define RB_LINKTYP_FTP 3
+#define RB_LINKTYP_TELNET 4
+#define FT_TARGET_HTML 5
+#define CB_TARGET_HTML 6
+#define FT_LOGIN 7
+#define ED_LOGIN 8
+#define FT_PASSWD 9
+#define ED_PASSWD 10
+#define CBX_ANONYMOUS 11
+#define BTN_BROWSE 12
+#define BTN_TARGET 13
+#define IMG_BROWSE_HC 14
+#define IMG_TARGET_HC 15
+
+/* Tabpage : Hyperlink - Mail & News */
+
+#define GRP_MAILNEWS 1
+#define RB_LINKTYP_MAIL 2
+#define RB_LINKTYP_NEWS 3
+#define FT_RECEIVER 4
+#define CB_RECEIVER 5
+#define FT_SUBJECT 6
+#define ED_SUBJECT 7
+#define BTN_ADRESSBOOK 8
+#define IMG_ADRESSBOOK_HC 9
+
+/* Tabpage : Hyperlink - Document */
+
+#define GRP_DOCUMENT 1
+#define FT_PATH_DOC 2
+#define CB_PATH_DOC 3
+#define BTN_FILEOPEN 4
+#define GRP_TARGET 5
+#define FT_TARGET_DOC 6
+#define ED_TARGET_DOC 7
+#define FT_URL 8
+#define FT_FULL_URL 9
+#define IMG_FILEOPEN_HC 10
+
+/* Tabpage : Hyperlink - New document */
+
+#define GRP_NEWDOCUMENT 1
+#define RB_EDITNOW 2
+#define RB_EDITLATER 3
+#define FT_PATH_NEWDOC 4
+#define ED_PATH_NEWDOC 5
+#define FT_DOCUMENT_TYPES 6
+#define LB_DOCUMENT_TYPES 7
+#define BTN_CREATE 8
+#define IMG_CREATE_HC 9
+
+/* Tabpage-section : Hyperlink - more justifications */
+
+#define GRP_MORE 30
+#define FT_FRAME 31
+#define CB_FRAME 32
+#define FT_FORM 33
+#define LB_FORM 34
+#define FT_INDICATION 35
+#define ED_INDICATION 36
+#define FT_TEXT 37
+#define ED_TEXT 38
+#define BTN_SCRIPT 39
+#define IMG_SCRIPT_HC 40
+
+#define COL_OLD 54
+#define COL_2 63
+#define COL_DIFF (COL_2 - COL_OLD)
+
diff --git a/cui/source/dialogs/hyperdlg.src b/cui/source/dialogs/hyperdlg.src
new file mode 100644
index 000000000000..9375ac96ba09
--- /dev/null
+++ b/cui/source/dialogs/hyperdlg.src
@@ -0,0 +1,971 @@
+/*************************************************************************
+ *
+ * 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: hyperdlg.src,v $
+ * $Revision: 1.78 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "hyperdlg.hrc"
+
+#define MASKCOLOR MaskColor = Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; };
+#define HYPERDLG_IMGBUTTON_HEIGHT RSC_CD_PUSHBUTTON_HEIGHT+2
+
+/*************************************************************************
+|
+| Tabpage : Internet
+|
+*************************************************************************/
+
+TabPage RID_SVXPAGE_HYPERLINK_INTERNET
+{
+ Hide = TRUE ;
+ HelpID = HID_HYPERLINK_INTERNET;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 162 ) ;
+ Text [ en-US ] = "Hyperlink" ;
+
+ FixedLine GRP_LINKTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Hyperlink type" ;
+ };
+ RadioButton RB_LINKTYP_INTERNET
+ {
+ Pos = MAP_APPFONT( COL_2, 13 );
+ Size = MAP_APPFONT( 57, 10 );
+ Text [ en-US ] = "~Web";
+ };
+ RadioButton RB_LINKTYP_FTP
+ {
+ Pos = MAP_APPFONT( 114 + COL_DIFF, 13 );
+ Size = MAP_APPFONT( 56 - COL_DIFF, 10 );
+ Text [ en-US ] = "~FTP";
+ };
+ RadioButton RB_LINKTYP_TELNET
+ {
+ Pos = MAP_APPFONT( 173, 13 );
+ Size = MAP_APPFONT( 56, 10 );
+ Text [ en-US ] = "~Telnet";
+ };
+ FixedText FT_TARGET_HTML
+ {
+ Pos = MAP_APPFONT ( 12 , 26 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF, 8 ) ;
+ Text [ en-US ] = "Tar~get" ;
+ };
+ FixedText FT_LOGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 43 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "~Login name" ;
+ };
+ Edit ED_LOGIN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 42 ) ;
+ Size = MAP_APPFONT ( 80 - COL_DIFF , 12 ) ;
+ };
+ FixedText FT_PASSWD
+ {
+ Pos = MAP_APPFONT ( 12 , 60 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "~Password" ;
+ };
+ Edit ED_PASSWD
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 59 ) ;
+ Size = MAP_APPFONT ( 80 - COL_DIFF , 12 ) ;
+ PassWord = TRUE ;
+ };
+ CheckBox CBX_ANONYMOUS
+ {
+ Pos = MAP_APPFONT ( COL_2 , 75 ) ;
+ Size = MAP_APPFONT ( 89 - COL_DIFF , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Anonymous ~user" ;
+ };
+ ImageButton BTN_BROWSE
+ {
+ Pos = MAP_APPFONT ( 235, 24 ) ;
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "WWW Browser";
+
+ QuickHelpText [ en-US ] = "WWW Browser" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "browse.bmp" ; };
+ MASKCOLOR
+ };
+ };
+ Image IMG_BROWSE_HC
+ {
+ ImageBitmap = Bitmap { File = "browse_hc.bmp" ; };
+ MASKCOLOR
+ };
+ ImageButton BTN_TARGET
+ {
+ Pos = MAP_APPFONT ( 235, 40+2 ) ;
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Target in Document";
+
+ QuickHelpText [ en-US ] = "Target in Document" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "target.bmp" ; };
+ MASKCOLOR
+ };
+ };
+ Image IMG_TARGET_HC
+ {
+ ImageBitmap = Bitmap { File = "target_hc.bmp" ; };
+ MASKCOLOR
+ };
+ FixedLine GRP_MORE
+ {
+ Pos = MAP_APPFONT ( 6 , 92 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Further settings" ;
+ };
+ FixedText FT_FRAME
+ {
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "F~rame" ;
+ };
+ ComboBox CB_FRAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 104 ) ;
+ Size = MAP_APPFONT ( 66 - COL_DIFF , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_FORM
+ {
+ Pos = MAP_APPFONT ( 126 , 105 ) ;
+ Size = MAP_APPFONT ( 33 , 8 ) ;
+ Text [ en-US ] = "F~orm" ;
+ };
+ ListBox LB_FORM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 160 , 104 ) ;
+ Size = MAP_APPFONT ( 70 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Text" ; Default ; > ;
+ < "Button" ; Default ; > ;
+ };
+ };
+ FixedText FT_INDICATION
+ {
+ Pos = MAP_APPFONT ( 12 , 123 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "Te~xt" ;
+ };
+ Edit ED_INDICATION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 122 ) ;
+ Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ;
+ };
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 12 , 140 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "N~ame" ;
+ };
+ Edit ED_TEXT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 139 ) ;
+ Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ;
+ };
+ ImageButton BTN_SCRIPT
+ {
+ Pos = MAP_APPFONT ( 235, 103-1 ) ;
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT );
+ TabStop = TRUE ;
+
+ QuickHelpText [ en-US ] = "Events" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "script.bmp" ; };
+ MASKCOLOR
+ };
+ Text [ en-US ] = "Events";
+ };
+ Image IMG_SCRIPT_HC
+ {
+ ImageBitmap = Bitmap { File = "script_hc.bmp" ; };
+ MASKCOLOR
+ };
+};
+
+/*************************************************************************
+|
+| Tabpage : Mail & News
+|
+*************************************************************************/
+
+TabPage RID_SVXPAGE_HYPERLINK_MAIL
+{
+ Hide = TRUE ;
+ HelpID = HID_HYPERLINK_MAIL;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 162 ) ;
+ Text [ en-US ] = "Hyperlink" ;
+
+ FixedLine GRP_MAILNEWS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Mail & news" ;
+ };
+ RadioButton RB_LINKTYP_MAIL
+ {
+ Pos = MAP_APPFONT( COL_2, 13 );
+ Size = MAP_APPFONT( 56 - COL_DIFF, 10 );
+ Text [ en-US ] = "~E-mail";
+ };
+ RadioButton RB_LINKTYP_NEWS
+ {
+ Pos = MAP_APPFONT( 113, 13 );
+ Size = MAP_APPFONT( 56, 10 );
+ Text [ en-US ] = "~News";
+ };
+ FixedText FT_RECEIVER
+ {
+ Pos = MAP_APPFONT ( 12 , 26 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "Re~ceiver" ;
+ };
+ FixedText FT_SUBJECT
+ {
+ Pos = MAP_APPFONT ( 12 , 43 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "~Subject" ;
+ };
+ Edit ED_SUBJECT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 42 ) ;
+ Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ;
+ };
+ ImageButton BTN_ADRESSBOOK
+ {
+ Pos = MAP_APPFONT ( 235, 24 ) ;
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT );
+ TabStop = TRUE ;
+
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "adrbook.bmp" ; };
+ MASKCOLOR
+ };
+
+ Text [ en-US ] = "Data Sources...";
+ QuickHelpText [ en-US ] = "Data Sources..." ;
+ };
+ Image IMG_ADRESSBOOK_HC
+ {
+ ImageBitmap = Bitmap { File = "adrbook_hc.bmp" ; };
+ MASKCOLOR
+ };
+
+ FixedLine GRP_MORE
+ {
+ Pos = MAP_APPFONT ( 6 , 92 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Further settings" ;
+ };
+ FixedText FT_FRAME
+ {
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "F~rame" ;
+ };
+ ComboBox CB_FRAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 104 ) ;
+ Size = MAP_APPFONT ( 66 - COL_DIFF , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_FORM
+ {
+ Pos = MAP_APPFONT ( 126 , 105 ) ;
+ Size = MAP_APPFONT ( 33 , 10 ) ;
+ Text [ en-US ] = "F~orm" ;
+ };
+ ListBox LB_FORM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 160 , 104 ) ;
+ Size = MAP_APPFONT ( 70 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Text" ; Default ; > ;
+ < "Button" ; Default ; > ;
+ };
+ };
+ FixedText FT_INDICATION
+ {
+ Pos = MAP_APPFONT ( 12 , 123 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "Te~xt" ;
+ };
+ Edit ED_INDICATION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 122 ) ;
+ Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ;
+ };
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 12 , 140 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "N~ame" ;
+ };
+ Edit ED_TEXT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 139 ) ;
+ Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ;
+ };
+ ImageButton BTN_SCRIPT
+ {
+ Pos = MAP_APPFONT ( 235, 103-1 ) ;
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Events" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "script.bmp" ; };
+ MASKCOLOR
+ };
+ Text [ en-US ] = "Events";
+ };
+ Image IMG_SCRIPT_HC
+ {
+ ImageBitmap = Bitmap { File = "script_hc.bmp" ; };
+ MASKCOLOR
+ };
+};
+
+/*************************************************************************
+|
+| Tabpage : Documents
+|
+*************************************************************************/
+
+TabPage RID_SVXPAGE_HYPERLINK_DOCUMENT
+{
+ Hide = TRUE ;
+ HelpID = HID_HYPERLINK_DOCUMENT;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 162 ) ;
+ Text [ en-US ] = "Hyperlink" ;
+
+ FixedLine GRP_DOCUMENT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Document" ;
+ };
+ FixedText FT_PATH_DOC
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "~Path" ;
+ };
+ ImageButton BTN_FILEOPEN
+ {
+ Pos = MAP_APPFONT ( 235, 14 ) ;
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Open File" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "fileopen.bmp" ; };
+ MASKCOLOR
+ };
+ Text [ en-US ] = "Open File";
+ };
+ Image IMG_FILEOPEN_HC
+ {
+ ImageBitmap = Bitmap { File = "fileopen_hc.bmp" ; };
+ MASKCOLOR
+ };
+
+ FixedLine GRP_TARGET
+ {
+ Pos = MAP_APPFONT ( 6 , 38 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Target in document" ;
+ };
+ FixedText FT_TARGET_DOC
+ {
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "Targ~et" ;
+ };
+ Edit ED_TARGET_DOC
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 52 ) ;
+ Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ;
+ };
+ FixedText FT_URL
+ {
+ Pos = MAP_APPFONT ( 12 , 70 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "URL" ;
+ };
+ FixedText FT_FULL_URL
+ {
+ Pos = MAP_APPFONT ( COL_2 , 70 ) ;
+ Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ;
+ Text [ en-US ] = "Test text" ;
+ };
+ ImageButton BTN_BROWSE
+ {
+ Pos = MAP_APPFONT ( 235, 51 ) ;
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Target in Document" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "target.bmp" ; };
+ MASKCOLOR
+ };
+ Text [ en-US ] = "Target in Document";
+ };
+ Image IMG_BROWSE_HC
+ {
+ ImageBitmap = Bitmap { File = "target_hc.bmp" ; };
+ MASKCOLOR
+ };
+
+ FixedLine GRP_MORE
+ {
+ Pos = MAP_APPFONT ( 6 , 92 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Further settings" ;
+ };
+ FixedText FT_FRAME
+ {
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "F~rame" ;
+ };
+ ComboBox CB_FRAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 104 ) ;
+ Size = MAP_APPFONT ( 66 - COL_DIFF , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_FORM
+ {
+ Pos = MAP_APPFONT ( 126 , 105 ) ;
+ Size = MAP_APPFONT ( 33 , 10 ) ;
+ Text [ en-US ] = "F~orm" ;
+ };
+ ListBox LB_FORM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 160 , 104 ) ;
+ Size = MAP_APPFONT ( 70 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Text" ; Default ; > ;
+ < "Button" ; Default ; > ;
+ };
+ };
+ FixedText FT_INDICATION
+ {
+ Pos = MAP_APPFONT ( 12 , 123 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "Te~xt" ;
+ };
+ Edit ED_INDICATION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 122 ) ;
+ Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ;
+ };
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 12 , 140 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "N~ame" ;
+ };
+ Edit ED_TEXT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 139 ) ;
+ Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ;
+ };
+ ImageButton BTN_SCRIPT
+ {
+ Pos = MAP_APPFONT ( 235, 103-1 ) ;
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Events" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "script.bmp" ; };
+ MASKCOLOR
+ };
+ Text [ en-US ] = "Events";
+ };
+ Image IMG_SCRIPT_HC
+ {
+ ImageBitmap = Bitmap { File = "script_hc.bmp" ; };
+ MASKCOLOR
+ };
+};
+
+/*************************************************************************
+|
+| Tabpage : New Documents
+|
+*************************************************************************/
+
+TabPage RID_SVXPAGE_HYPERLINK_NEWDOCUMENT
+{
+ Hide = TRUE ;
+ HelpID = HID_HYPERLINK_NEWDOCUMENT;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 162 ) ;
+ Text [ en-US ] = "Hyperlink" ;
+
+ FixedLine GRP_NEWDOCUMENT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "New document" ;
+ };
+ RadioButton RB_EDITNOW
+ {
+ Pos = MAP_APPFONT( COL_2, 13 );
+ Size = MAP_APPFONT( 85 - COL_DIFF, 10 );
+ Text [ en-US ] = "Edit ~now";
+ };
+ RadioButton RB_EDITLATER
+ {
+ Pos = MAP_APPFONT( 142, 13 );
+ Size = MAP_APPFONT( 84, 10 );
+ Text [ en-US ] = "Edit ~later";
+ };
+ FixedText FT_PATH_NEWDOC
+ {
+ Pos = MAP_APPFONT ( 12 , 26 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "~File" ;
+ };
+ Edit ED_PATH_NEWDOC
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 25 ) ;
+ Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ;
+ };
+ FixedText FT_DOCUMENT_TYPES
+ {
+ Pos = MAP_APPFONT ( 12 , 43 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "File ~type" ;
+ };
+ ListBox LB_DOCUMENT_TYPES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 42 ) ;
+ Size = MAP_APPFONT ( 176 - COL_DIFF , 40 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ };
+ ImageButton BTN_CREATE
+ {
+ Pos = MAP_APPFONT ( 235, 24 ) ;
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT );
+ TabStop = TRUE ;
+
+ QuickHelpText [ en-US ] = "Select Path" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "newdoc.bmp" ; };
+ MASKCOLOR
+ };
+ Text [ en-US ] = "Select Path";
+ };
+ Image IMG_CREATE_HC
+ {
+ ImageBitmap = Bitmap { File = "newdoc_hc.bmp" ; };
+ MASKCOLOR
+ };
+
+ FixedLine GRP_MORE
+ {
+ Pos = MAP_APPFONT ( 6 , 92 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Further settings" ;
+ };
+ FixedText FT_FRAME
+ {
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "F~rame" ;
+ };
+ ComboBox CB_FRAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 104 ) ;
+ Size = MAP_APPFONT ( 66 - COL_DIFF , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_FORM
+ {
+ Pos = MAP_APPFONT ( 126 , 105 ) ;
+ Size = MAP_APPFONT ( 33 , 10 ) ;
+ Text [ en-US ] = "F~orm" ;
+ };
+ ListBox LB_FORM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 160 , 104 ) ;
+ Size = MAP_APPFONT ( 70 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Text" ; Default ; > ;
+ < "Button" ; Default ; > ;
+ };
+ };
+ FixedText FT_INDICATION
+ {
+ Pos = MAP_APPFONT ( 12 , 123 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "Te~xt" ;
+ };
+ Edit ED_INDICATION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 122 ) ;
+ Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ;
+ };
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 12 , 140 ) ;
+ Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ;
+ Text [ en-US ] = "N~ame" ;
+ };
+ Edit ED_TEXT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 139 ) ;
+ Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ;
+ };
+ ImageButton BTN_SCRIPT
+ {
+ Pos = MAP_APPFONT ( 235, 103-1 ) ;
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Events" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "script.bmp" ; };
+ MASKCOLOR
+ };
+ Text [ en-US ] = "Events";
+ };
+ Image IMG_SCRIPT_HC
+ {
+ ImageBitmap = Bitmap { File = "script_hc.bmp" ; };
+ MASKCOLOR
+ };
+};
+
+/*************************************************************************
+|
+| Tabpage-Dialog : Hyperlinks
+|
+*************************************************************************/
+ModalDialog RID_SVXDLG_NEWHYPERLINK
+{
+ HelpID = SID_HYPERLINK_DIALOG;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 325 , 185 ) ;
+ Text [ en-US ] = "Hyperlink" ;
+ Moveable = TRUE ;
+};
+
+/*************************************************************************
+|
+| Tabpage-Dialog : Hyperlinks
+|
+*************************************************************************/
+
+String RID_SVXSTR_HYPDLG_APPLYBUT
+{
+ Text [ en-US ] = "Apply" ;
+};
+String RID_SVXSTR_HYPDLG_CLOSEBUT
+{
+ Text [ en-US ] = "Close" ;
+};
+String RID_SVXSTR_HYPDLG_MACROACT1
+{
+ Text [ en-US ] = "Mouse over object" ;
+};
+String RID_SVXSTR_HYPDLG_MACROACT2
+{
+ Text [ en-US ] = "Trigger hyperlink" ;
+};
+String RID_SVXSTR_HYPDLG_MACROACT3
+{
+ Text [ en-US ] = "Mouse leaves object" ;
+};
+
+String RID_SVXSTR_HYPDLG_NOVALIDFILENAME
+{
+ Text [ en-US ] = "Please type in a valid file name." ;
+};
+
+String RID_SVXSTR_HYPERDLG_HLINETTP
+{
+ Text [ en-US ] = "Internet" ;
+};
+String RID_SVXSTR_HYPERDLG_HLINETTP_HELP
+{
+ Text [ en-US ] = "This is where you create a hyperlink to a Web page, FTP server or Telnet connection." ;
+};
+
+String RID_SVXSTR_HYPERDLG_HLMAILTP
+{
+ Text [ en-US ] = "Mail & News" ;
+};
+String RID_SVXSTR_HYPERDLG_HLMAILTP_HELP
+{
+ Text [ en-US ] = "This is where you create a hyperlink to an e-mail address or newsgroup." ;
+};
+
+String RID_SVXSTR_HYPERDLG_HLDOCTP
+{
+ Text [ en-US ] = "Document" ;
+};
+String RID_SVXSTR_HYPERDLG_HLDOCTP_HELP
+{
+ Text [ en-US ] = "This is where you create a hyperlink to an existing document or a target within a document." ;
+};
+
+String RID_SVXSTR_HYPERDLG_HLDOCNTP
+{
+ Text [ en-US ] = "New Document" ;
+};
+String RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP
+{
+ Text [ en-US ] = "This is where you create a new document to which the new link points." ;
+};
+
+String RID_SVXSTR_HYPERDLG_FORM_BUTTON
+{
+ Text [ en-US ] = "Button" ;
+};
+
+String RID_SVXSTR_HYPERDLG_FROM_TEXT
+{
+ Text [ en-US ] = "Text" ;
+};
+
+String RID_SVXSTR_HYPERDLG_QUERYOVERWRITE
+{
+ Text [ en-US ] = "The file already exists. Overwrite?" ;
+};
+
+Image RID_SVXBMP_HLINETTP
+{
+ ImageBitmap = Bitmap { File = "hlinettp.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXBMP_HLMAILTP
+{
+ ImageBitmap = Bitmap { File = "hlmailtp.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXBMP_HLDOCTP
+{
+ ImageBitmap = Bitmap { File = "hldoctp.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXBMP_HLDOCNTP
+{
+ ImageBitmap = Bitmap { File = "hldocntp.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXBMP_HLINETTP_H
+{
+ ImageBitmap = Bitmap { File = "hlinettp_h.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXBMP_HLMAILTP_H
+{
+ ImageBitmap = Bitmap { File = "hlmailtp_h.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXBMP_HLDOCTP_H
+{
+ ImageBitmap = Bitmap { File = "hldoctp_h.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXBMP_HLDOCNTP_H
+{
+ ImageBitmap = Bitmap { File = "hldocntp_h.bmp" ; };
+ MASKCOLOR
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
new file mode 100644
index 000000000000..fdba34fec1df
--- /dev/null
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -0,0 +1,1438 @@
+/*************************************************************************
+ *
+ * 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: iconcdlg.cxx,v $
+ * $Revision: 1.24 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <sfx2/app.hxx>
+#include <tools/rc.h>
+#include <tools/shl.hxx>
+
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#include <svx/dialmgr.hxx>
+
+#include "iconcdlg.hxx"
+
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include <unotools/viewoptions.hxx>
+#include <svtools/apearcfg.hxx>
+#include <vcl/mnemonic.hxx>
+#include <vcl/i18nhelp.hxx>
+
+#ifdef WNT
+int __cdecl IconcDlgCmpUS_Impl( const void* p1, const void* p2 )
+#else
+#if defined(OS2) && defined(ICC)
+int _Optlink IconcDlgCmpUS_Impl( const void* p1, const void* p2 )
+#else
+int IconcDlgCmpUS_Impl( const void* p1, const void* p2 )
+#endif
+#endif
+{
+ return *(USHORT*)p1 - *(USHORT*)p2;
+}
+
+// some stuff for easier changes for SvtViewOptions
+static const sal_Char* pViewOptDataName = "dialog data";
+#define VIEWOPT_DATANAME ::rtl::OUString::createFromAscii( pViewOptDataName )
+
+static inline void SetViewOptUserItem( SvtViewOptions& rOpt, const String& rData )
+{
+ rOpt.SetUserItem( VIEWOPT_DATANAME, ::com::sun::star::uno::makeAny( ::rtl::OUString( rData ) ) );
+}
+
+static inline String GetViewOptUserItem( const SvtViewOptions& rOpt )
+{
+ ::com::sun::star::uno::Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) );
+ ::rtl::OUString aUserData;
+ aAny >>= aUserData;
+
+ return String( aUserData );
+}
+
+
+//#####################################################################
+//
+// Class IconChoicePage
+//
+//#####################################################################
+
+/**********************************************************************
+|
+| Ctor / Dtor
+|
+\**********************************************************************/
+
+IconChoicePage::IconChoicePage( Window *pParent, const ResId &rResId,
+ const SfxItemSet &rAttrSet )
+: TabPage ( pParent, rResId ),
+ pSet ( &rAttrSet ),
+ bHasExchangeSupport ( FALSE ),
+ pDialog ( NULL ),
+ bStandard ( FALSE )
+{
+ SetStyle ( GetStyle() | WB_DIALOGCONTROL | WB_HIDE );
+}
+
+// -----------------------------------------------------------------------
+
+IconChoicePage::~IconChoicePage()
+{
+}
+
+/**********************************************************************
+|
+| Activate / Deaktivate
+|
+\**********************************************************************/
+
+void IconChoicePage::ActivatePage( const SfxItemSet& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+int IconChoicePage::DeactivatePage( SfxItemSet* )
+{
+ return LEAVE_PAGE;
+}
+
+/**********************************************************************
+|
+| ...
+|
+\**********************************************************************/
+
+void IconChoicePage::FillUserData()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL IconChoicePage::IsReadOnly() const
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool IconChoicePage::QueryClose()
+{
+ return sal_True;
+}
+
+/**********************************************************************
+|
+| handling itemsets
+|
+\**********************************************************************/
+
+const SfxPoolItem* IconChoicePage::GetItem( const SfxItemSet& rSet,
+ USHORT nSlot )
+{
+ const SfxItemPool* pPool = rSet.GetPool();
+ USHORT nWh = pPool->GetWhich( nSlot );
+ const SfxPoolItem* pItem = 0;
+ rSet.GetItemState( nWh, TRUE, &pItem );
+
+ if ( !pItem && nWh != nSlot )
+ pItem = &pPool->GetDefaultItem( nWh );
+
+ return pItem;
+}
+
+// -----------------------------------------------------------------------
+
+const SfxPoolItem* IconChoicePage::GetOldItem( const SfxItemSet& rSet,
+ USHORT nSlot )
+{
+ const SfxItemSet& rOldSet = GetItemSet();
+ USHORT nWh = GetWhich( nSlot );
+ const SfxPoolItem* pItem = 0;
+
+ if ( bStandard && rOldSet.GetParent() )
+ pItem = GetItem( *rOldSet.GetParent(), nSlot );
+ else if ( rSet.GetParent() && SFX_ITEM_DONTCARE == rSet.GetItemState( nWh ) )
+ pItem = GetItem( *rSet.GetParent(), nSlot );
+ else
+ pItem = GetItem( rOldSet, nSlot );
+
+ return pItem;
+}
+
+// -----------------------------------------------------------------------
+
+const SfxPoolItem* IconChoicePage::GetExchangeItem( const SfxItemSet& rSet,
+ USHORT nSlot )
+{
+ if ( pDialog && !pDialog->IsInOK() && pDialog->GetExampleSet() )
+ return GetItem( *pDialog->GetExampleSet(), nSlot );
+ else
+ return GetOldItem( rSet, nSlot );
+}
+
+/**********************************************************************
+|
+| window-methods
+|
+\**********************************************************************/
+
+void IconChoicePage::ImplInitSettings()
+{
+ Window* pParent = GetParent();
+ if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
+ {
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( FALSE );
+
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( pParent->GetBackground() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoicePage::StateChanged( StateChangedType nType )
+{
+ Window::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoicePage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+//#####################################################################
+//
+// Class IconChoiceDialog
+//
+//#####################################################################
+
+/**********************************************************************
+|
+| Ctor / Dtor
+|
+\**********************************************************************/
+
+IconChoiceDialog::IconChoiceDialog ( Window* pParent, const ResId &rResId,
+ const EIconChoicePos ePos,
+ const SfxItemSet *pItemSet )//, BOOL bEditFmt, const String *pUserButtonText = 0 )
+: ModalDialog ( pParent, rResId ),
+ meChoicePos ( ePos ),
+ maIconCtrl ( this, WB_3DLOOK | WB_ICON | WB_BORDER |
+ WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME |
+ /* WB_NOSELECTION | */ WB_NODRAGSELECTION | WB_TABSTOP ),
+ mnCurrentPageId ( USHRT_MAX ),
+
+ aOKBtn ( this, WB_DEFBUTTON ),
+ aCancelBtn ( this, WB_DEFBUTTON ),
+ aHelpBtn ( this ),
+ aResetBtn ( this ),
+ pSet ( pItemSet ),
+ pOutSet ( NULL ),
+ pExampleSet ( NULL ),
+ pRanges ( NULL ),
+ nResId ( rResId.GetId() ),
+
+ bHideResetBtn ( FALSE ),
+ bModal ( FALSE ),
+ bInOK ( FALSE ),
+ bModified ( FALSE ),
+ bItemsReset ( FALSE )
+{
+ // IconChoiceCtrl-Settings
+ //maIconCtrl.SetBackground ( Wallpaper( Color (146, 146, 186) ) );
+
+ maIconCtrl.SetStyle (WB_3DLOOK | WB_ICON | WB_BORDER | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | /* WB_NOSELECTION | */ WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN );
+ SetCtrlPos ( meChoicePos );
+ maIconCtrl.SetClickHdl ( LINK ( this, IconChoiceDialog , ChosePageHdl_Impl ) );
+ maIconCtrl.Show();
+ maIconCtrl.SetChoiceWithCursor ( TRUE );
+ maIconCtrl.SetSelectionMode( SINGLE_SELECTION );
+ maIconCtrl.SetHelpId( HID_ICCDIALOG_CHOICECTRL );
+
+ // ItemSet
+ if ( pSet )
+ {
+ pExampleSet = new SfxItemSet( *pSet );
+ pOutSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() );
+ }
+
+ // Buttons
+ aOKBtn.SetClickHdl ( LINK( this, IconChoiceDialog, OkHdl ) );
+ aOKBtn.SetHelpId( HID_ICCDIALOG_OK_BTN );
+ aCancelBtn.SetHelpId( HID_ICCDIALOG_CANCEL_BTN );
+ aResetBtn.SetClickHdl( LINK( this, IconChoiceDialog, ResetHdl ) );
+ aResetBtn.SetText( SVX_RESSTR(RID_SVXSTR_ICONCHOICEDLG_RESETBUT) );
+ aResetBtn.SetHelpId( HID_ICCDIALOG_RESET_BTN );
+ aOKBtn.Show();
+ aCancelBtn.Show();
+ aHelpBtn.Show();
+ aResetBtn.Show();
+
+ SetPosSizeCtrls ( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+/*
+IconChoiceDialog ::IconChoiceDialog ( SfxViewFrame *pViewFrame, Window* pParent, const ResId &rResId,
+ const SfxItemSet * = 0, BOOL bEditFmt = FALSE,
+ const String *pUserButtonText = 0 )
+: meChoicePos ( PosLeft ), // Default erst ma Links
+ maIconCtrl ( this, Die_Winbits ),
+ aOKBtn ( this ),
+ pUserBtn ( pUserButtonText? new PushButton(this): 0 ),
+ aCancelBtn ( this ),
+ aHelpBtn ( this ),
+ aResetBtn ( this ),
+ aBaseFmtBtn ( this ),
+ mnCurrentPageId ( 0 )
+{
+ FreeResource();
+}
+*/
+
+// -----------------------------------------------------------------------
+
+IconChoiceDialog ::~IconChoiceDialog ()
+{
+ ULONG i;
+
+ // save configuration at INI-Manager
+ // and remove pages
+ SvtViewOptions aTabDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) );
+ aTabDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)).GetBuffer() ) );
+ aTabDlgOpt.SetPageID( mnCurrentPageId );
+
+ const ULONG nCount = maPageList.Count();
+
+ for ( i = 0; i < nCount; ++i )
+ {
+ IconChoicePageData* pData = maPageList.GetObject(i);
+
+ if ( pData->pPage )
+ {
+ pData->pPage->FillUserData();
+ String aPageData(pData->pPage->GetUserData());
+ if ( aPageData.Len() )
+ {
+ SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pData->nId ) );
+
+ SetViewOptUserItem( aTabPageOpt, aPageData );
+ }
+
+ if ( pData->bOnDemand )
+ delete (SfxItemSet*)&pData->pPage->GetItemSet();
+ delete pData->pPage;
+ }
+ delete pData;
+ }
+
+ // remove Pagelist
+/* for ( i=0; i<maPageList.Count(); i++ )
+ {
+ IconChoicePageData* pData = (IconChoicePageData*)maPageList.GetObject ( i );
+
+ if ( pData->bOnDemand )
+ delete ( SfxItemSet * )&( pData->pPage->GetItemSet() );
+
+ delete pData->pPage;
+ delete pData;
+ }*/
+
+ // remove Userdata from Icons
+ for ( i=0; i<maIconCtrl.GetEntryCount(); i++)
+ {
+ SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i );
+ USHORT* pUserData = (USHORT*) pEntry->GetUserData();
+ delete pUserData;
+ }
+
+ //
+ if ( pRanges )
+ delete pRanges;
+ if ( pOutSet )
+ delete pOutSet;
+}
+
+/**********************************************************************
+|
+| add new page
+|
+\**********************************************************************/
+
+SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( USHORT nId, const String& rIconText,
+ const Image& rChoiceIcon,
+ CreatePage pCreateFunc /* != 0 */,
+ GetPageRanges pRangesFunc /* darf 0 sein */,
+ BOOL bItemsOnDemand, ULONG /*nPos*/ )
+{
+ IconChoicePageData* pData = new IconChoicePageData ( nId, pCreateFunc,
+ pRangesFunc,
+ bItemsOnDemand );
+ maPageList.Insert ( pData, LIST_APPEND );
+
+ pData->fnGetRanges = pRangesFunc;
+ pData->bOnDemand = bItemsOnDemand;
+
+ USHORT *pId = new USHORT ( nId );
+ SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.InsertEntry( rIconText, rChoiceIcon );
+ pEntry->SetUserData ( (void*) pId );
+ return pEntry;
+}
+
+SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( USHORT nId, const String& rIconText,
+ const Image& rChoiceIcon,
+ const Image& rChoiceIconHC,
+ CreatePage pCreateFunc /* != 0 */,
+ GetPageRanges pRangesFunc /* darf 0 sein */,
+ BOOL bItemsOnDemand, ULONG /*nPos*/ )
+{
+ IconChoicePageData* pData = new IconChoicePageData ( nId, pCreateFunc,
+ pRangesFunc,
+ bItemsOnDemand );
+ maPageList.Insert ( pData, LIST_APPEND );
+
+ pData->fnGetRanges = pRangesFunc;
+ pData->bOnDemand = bItemsOnDemand;
+
+ USHORT *pId = new USHORT ( nId );
+ SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.InsertEntry( rIconText, rChoiceIcon, rChoiceIconHC );
+ pEntry->SetUserData ( (void*) pId );
+ return pEntry;
+}
+
+/**********************************************************************
+|
+| remove page
+|
+\**********************************************************************/
+
+void IconChoiceDialog::RemoveTabPage( USHORT nId )
+{
+ IconChoicePageData* pData = GetPageData ( nId );
+
+ // remove page from list
+ if ( pData )
+ {
+ maPageList.Remove ( pData );
+
+ // save settings
+ if ( pData->pPage )
+ {
+ pData->pPage->FillUserData();
+ String aPageData(pData->pPage->GetUserData());
+ if ( aPageData.Len() )
+ {
+ SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pData->nId ) );
+
+ SetViewOptUserItem( aTabPageOpt, aPageData );
+ }
+ }
+
+ if ( pData->bOnDemand )
+ delete ( SfxItemSet * )&( pData->pPage->GetItemSet() );
+
+ delete pData->pPage;
+ delete pData;
+ }
+
+ // remove Icon
+ BOOL bFound=FALSE;
+ for ( ULONG i=0; i<maIconCtrl.GetEntryCount() && !bFound; i++)
+ {
+ SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i );
+ USHORT* pUserData = (USHORT*) pEntry->GetUserData();
+
+ if ( *pUserData == nId )
+ {
+ delete pUserData;
+ maIconCtrl.RemoveEntry ( pEntry );
+ bFound = TRUE;
+ }
+ }
+
+ // was it the current page ?
+ if ( nId == mnCurrentPageId )
+ {
+ mnCurrentPageId = maPageList.First()->nId;
+ }
+
+ Invalidate ();
+}
+
+/**********************************************************************
+|
+| Paint-method
+|
+\**********************************************************************/
+
+void IconChoiceDialog::Paint( const Rectangle& rRect )
+{
+ Dialog::Paint ( rRect );
+
+ for ( ULONG i=0; i<maPageList.Count(); i++ )
+ {
+ IconChoicePageData* pData = (IconChoicePageData*)maPageList.GetObject ( i );
+
+ if ( pData->nId == mnCurrentPageId )
+ {
+ ShowPageImpl ( pData );
+ }
+ else
+ {
+ HidePageImpl ( pData );
+ }
+ }
+}
+
+EIconChoicePos IconChoiceDialog::SetCtrlPos( const EIconChoicePos& rPos )
+{
+ WinBits aWinBits = maIconCtrl.GetStyle ();
+
+ switch ( meChoicePos )
+ {
+ case PosLeft :
+ aWinBits &= ~WB_ALIGN_TOP & ~WB_NOVSCROLL;
+ aWinBits |= WB_ALIGN_LEFT | WB_NOHSCROLL;
+ break;
+ case PosRight :
+ aWinBits &= ~WB_ALIGN_TOP & ~WB_NOVSCROLL;
+ aWinBits |= WB_ALIGN_LEFT | WB_NOHSCROLL;
+ break;
+ case PosTop :
+ aWinBits &= ~WB_ALIGN_LEFT & ~WB_NOHSCROLL;
+ aWinBits |= WB_ALIGN_TOP | WB_NOVSCROLL;
+ break;
+ case PosBottom :
+ aWinBits &= ~WB_ALIGN_LEFT & ~WB_NOHSCROLL;
+ aWinBits |= WB_ALIGN_TOP | WB_NOVSCROLL;
+ break;
+ };
+ maIconCtrl.SetStyle ( aWinBits );
+
+ SetPosSizeCtrls();
+
+
+ EIconChoicePos eOldPos = meChoicePos;
+ meChoicePos = rPos;
+
+ return eOldPos;
+}
+
+void IconChoiceDialog::SetCtrlColor ( const Color& rColor )
+{
+ Wallpaper aWallpaper ( rColor );
+ maIconCtrl.SetBackground( aWallpaper );
+ maIconCtrl.SetFontColorToBackground ();
+}
+
+/**********************************************************************
+|
+| Show / Hide page or button
+|
+\**********************************************************************/
+
+void IconChoiceDialog::ShowPageImpl ( IconChoicePageData* pData )
+{
+ if ( pData->pPage )
+ pData->pPage->Show();
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::HidePageImpl ( IconChoicePageData* pData )
+{
+ if ( pData->pPage )
+ pData->pPage->Hide();
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::RemoveResetButton()
+{
+ aResetBtn.Hide();
+ bHideResetBtn = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::ShowPage( USHORT nId )
+{
+ bool bInvalidate = GetCurPageId() != nId;
+ SetCurPageId( nId );
+ ActivatePageImpl( );
+ if(bInvalidate)
+ Invalidate();
+}
+
+/**********************************************************************
+|
+| Resize Dialog
+|
+\**********************************************************************/
+
+#define ICONCTRL_WIDTH_PIXEL 110
+#define ICONCTRL_HEIGHT_PIXEL 75
+#define MINSIZE_BUTTON_WIDTH 70
+#define MINSIZE_BUTTON_HEIGHT 22
+
+void IconChoiceDialog::Resize()
+{
+ Dialog::Resize ();
+
+ if ( IsReallyVisible() )
+ {
+ SetPosSizeCtrls ();
+ }
+}
+
+void IconChoiceDialog::SetPosSizeCtrls ( BOOL bInit )
+{
+ const Point aCtrlOffset ( LogicToPixel( Point( CTRLS_OFFSET, CTRLS_OFFSET ), MAP_APPFONT ) );
+ Size aOutSize ( GetOutputSizePixel() );
+
+ ////////////////////////////////////////
+ // Button-Defaults
+ //
+ Size aDefaultButtonSize = LogicToPixel( Size( 50, 14 ), MAP_APPFONT );
+
+ // Reset-Button
+ Size aResetButtonSize ( bInit ? aDefaultButtonSize :
+ aResetBtn.GetSizePixel () );
+
+ ////////////////////////////////////////
+ // IconChoiceCtrl resizen & positionieren
+ //
+ SvtTabAppearanceCfg aCfg;
+ const long nDefaultWidth = (aCfg.GetScaleFactor() * ICONCTRL_WIDTH_PIXEL) / 100;
+ const long nDefaultHeight = (aCfg.GetScaleFactor() * ICONCTRL_HEIGHT_PIXEL) / 100;
+
+ Size aNewIconCtrlSize ( nDefaultWidth,
+ aOutSize.Height()-(2*aCtrlOffset.X()) );
+ Point aIconCtrlPos;
+ switch ( meChoicePos )
+ {
+ case PosLeft :
+ aIconCtrlPos = aCtrlOffset;
+ aNewIconCtrlSize = Size ( nDefaultWidth,
+ aOutSize.Height()-(2*aCtrlOffset.X()) );
+ break;
+ case PosRight :
+ aIconCtrlPos = Point ( aOutSize.Width() - nDefaultWidth -
+ aCtrlOffset.X(), aCtrlOffset.X() );
+ aNewIconCtrlSize = Size ( nDefaultWidth,
+ aOutSize.Height()-(2*aCtrlOffset.X()) );
+ break;
+ case PosTop :
+ aIconCtrlPos = aCtrlOffset;
+ aNewIconCtrlSize = Size ( aOutSize.Width()-(2*aCtrlOffset.X()),
+ nDefaultHeight );
+ break;
+ case PosBottom :
+ aIconCtrlPos = Point ( aCtrlOffset.X(), aOutSize.Height() -
+ aResetButtonSize.Height() - (2*aCtrlOffset.X()) -
+ nDefaultHeight );
+ aNewIconCtrlSize = Size ( aOutSize.Width()-(2*aCtrlOffset.X()),
+ nDefaultHeight );
+ break;
+ };
+ maIconCtrl.SetPosSizePixel ( aIconCtrlPos, aNewIconCtrlSize );
+ maIconCtrl.ArrangeIcons();
+
+ ////////////////////////////////////////
+ // Pages resizen & positionieren
+ //
+ for ( ULONG i=0; i<maPageList.Count(); i++ )
+ {
+ IconChoicePageData* pData = (IconChoicePageData*)maPageList.GetObject ( i );
+
+ Point aNewPagePos;
+ Size aNewPageSize;
+ switch ( meChoicePos )
+ {
+ case PosLeft :
+ aNewPagePos = Point ( aNewIconCtrlSize.Width() + (2*CTRLS_OFFSET),
+ CTRLS_OFFSET );
+ aNewPageSize = Size ( aOutSize.Width() - aNewIconCtrlSize.Width() -
+ (3*CTRLS_OFFSET),
+ aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
+ (3*CTRLS_OFFSET) );
+ break;
+ case PosRight :
+ aNewPagePos = aCtrlOffset;
+ aNewPageSize = Size ( aOutSize.Width() - aNewIconCtrlSize.Width() -
+ (3*aCtrlOffset.X()),
+ aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
+ (3*aCtrlOffset.X()) );
+ break;
+ case PosTop :
+ aNewPagePos = Point ( aCtrlOffset.X(), aNewIconCtrlSize.Height() +
+ (2*aCtrlOffset.X()) );
+ aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()),
+ aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
+ aNewIconCtrlSize.Height() - (4*aCtrlOffset.X()) );
+ break;
+ case PosBottom :
+ aNewPagePos = aCtrlOffset;
+ aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()),
+ aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
+ aNewIconCtrlSize.Height() - (4*aCtrlOffset.X()) );
+ break;
+ };
+
+ if ( pData->pPage )
+ pData->pPage->SetPosSizePixel ( aNewPagePos, aNewPageSize );
+ }
+
+ ////////////////////////////////////////
+ // Buttons positionieren
+ //
+ ULONG nXOffset=0;
+ if ( meChoicePos == PosRight )
+ nXOffset = aNewIconCtrlSize.Width()+(2*aCtrlOffset.X());
+
+ aResetBtn.SetPosSizePixel ( Point( aOutSize.Width() - nXOffset -
+ aResetButtonSize.Width()-aCtrlOffset.X(),
+ aOutSize.Height()-aResetButtonSize.Height()-
+ aCtrlOffset.X() ),
+ aResetButtonSize );
+ // Help-Button
+ Size aHelpButtonSize ( bInit ? aDefaultButtonSize :
+ aHelpBtn.GetSizePixel () );
+ aHelpBtn.SetPosSizePixel ( Point( aOutSize.Width()-aResetButtonSize.Width()-
+ aHelpButtonSize.Width()- nXOffset -
+ (2*aCtrlOffset.X()),
+ aOutSize.Height()-aHelpButtonSize.Height()-
+ aCtrlOffset.X() ),
+ aHelpButtonSize );
+ // Cancel-Button
+ Size aCancelButtonSize ( bInit ? aDefaultButtonSize :
+ aCancelBtn.GetSizePixel () );
+ aCancelBtn.SetPosSizePixel ( Point( aOutSize.Width()-aCancelButtonSize.Width()-
+ aResetButtonSize.Width()-aHelpButtonSize.Width()-
+ (3*aCtrlOffset.X()) - nXOffset,
+ aOutSize.Height()-aCancelButtonSize.Height()-
+ aCtrlOffset.X() ),
+ aCancelButtonSize );
+ // OK-Button
+ Size aOKButtonSize ( bInit ? aDefaultButtonSize : aOKBtn.GetSizePixel () );
+ aOKBtn.SetPosSizePixel ( Point( aOutSize.Width()-aOKButtonSize.Width()-
+ aCancelButtonSize.Width()-aResetButtonSize.Width()-
+ aHelpButtonSize.Width()-(4*aCtrlOffset.X())- nXOffset,
+ aOutSize.Height()-aOKButtonSize.Height()-aCtrlOffset.X() ),
+ aOKButtonSize );
+
+ Invalidate();
+}
+
+void IconChoiceDialog::SetPosSizePages ( USHORT nId )
+{
+ const Point aCtrlOffset ( LogicToPixel( Point( CTRLS_OFFSET, CTRLS_OFFSET ), MAP_APPFONT ) );
+ IconChoicePageData* pData = GetPageData ( nId );
+
+ if ( pData->pPage )
+ {
+ Size aOutSize ( GetOutputSizePixel() );
+ Size aIconCtrlSize ( maIconCtrl.GetSizePixel() );
+
+ Point aNewPagePos;
+ Size aNewPageSize;
+ switch ( meChoicePos )
+ {
+ case PosLeft :
+ aNewPagePos = Point ( aIconCtrlSize.Width() + (2*aCtrlOffset.X()),
+ aCtrlOffset.X() );
+ aNewPageSize = Size ( aOutSize.Width() - maIconCtrl.GetSizePixel().Width() -
+ (3*aCtrlOffset.X()),
+ aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
+ (3*aCtrlOffset.X()) );
+ break;
+ case PosRight :
+ aNewPagePos = aCtrlOffset;
+ aNewPageSize = Size ( aOutSize.Width() - maIconCtrl.GetSizePixel().Width() -
+ (3*aCtrlOffset.X()),
+ aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
+ (3*aCtrlOffset.X()) );
+ break;
+ case PosTop :
+ aNewPagePos = Point ( aCtrlOffset.X(), aIconCtrlSize.Height() +
+ (2*aCtrlOffset.X()) );
+ aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()),
+ aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
+ maIconCtrl.GetSizePixel().Height() - (4*aCtrlOffset.X()) );
+ break;
+ case PosBottom :
+ aNewPagePos = aCtrlOffset;
+ aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()),
+ aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
+ maIconCtrl.GetSizePixel().Height() - (4*aCtrlOffset.X()) );
+ break;
+ };
+
+ pData->pPage->SetPosSizePixel ( aNewPagePos, aNewPageSize );
+ }
+}
+
+/**********************************************************************
+|
+| select a page
+|
+\**********************************************************************/
+
+IMPL_LINK ( IconChoiceDialog , ChosePageHdl_Impl, void *, EMPTYARG )
+{
+ ULONG nPos;
+
+ SvxIconChoiceCtrlEntry *pEntry = maIconCtrl.GetSelectedEntry ( nPos );
+ if ( !pEntry )
+ pEntry = maIconCtrl.GetCursor( );
+
+ USHORT *pId = (USHORT*)pEntry->GetUserData ();
+
+ if( *pId != mnCurrentPageId )
+ {
+ IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
+ if ( pData->pPage )
+ DeActivatePageImpl();
+
+ SetCurPageId ( *pId );
+
+ ActivatePageImpl();
+ Invalidate();
+ }
+
+ return 0L;
+}
+
+/**********************************************************************
+|
+| Button-handler
+|
+\**********************************************************************/
+
+IMPL_LINK( IconChoiceDialog, OkHdl, Button *, EMPTYARG )
+{
+ bInOK = TRUE;
+
+ if ( OK_Impl() )
+ {
+ if ( bModal )
+ EndDialog( Ok() );
+ else
+ {
+ Ok();
+ Close();
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( IconChoiceDialog, ResetHdl, Button *, EMPTYARG )
+{
+ ResetPageImpl ();
+
+ IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
+ DBG_ASSERT( pData, "Id nicht bekannt" );
+
+ if ( pData->bOnDemand )
+ {
+ // CSet auf AIS hat hier Probleme, daher getrennt
+ const SfxItemSet* _pSet = &( pData->pPage->GetItemSet() );
+ pData->pPage->Reset( *(SfxItemSet*)_pSet );
+ }
+ else
+ pData->pPage->Reset( *pSet );
+
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( IconChoiceDialog, CancelHdl, Button*, EMPTYARG )
+{
+ Close();
+
+ return 0;
+}
+
+/**********************************************************************
+|
+| call page
+|
+\**********************************************************************/
+
+void IconChoiceDialog::ActivatePageImpl ()
+{
+ DBG_ASSERT( maPageList.Count(), "keine Pages angemeldet" );
+ IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
+ DBG_ASSERT( pData, "Id nicht bekannt" );
+ if ( pData )
+ {
+ if ( !pData->pPage )
+ {
+ const SfxItemSet* pTmpSet = 0;
+
+ if ( pSet )
+ {
+ if ( bItemsReset && pSet->GetParent() )
+ pTmpSet = pSet->GetParent();
+ else
+ pTmpSet = pSet;
+ }
+
+ if ( pTmpSet && !pData->bOnDemand )
+ pData->pPage = (pData->fnCreatePage)( this, *pTmpSet );
+ else
+ pData->pPage = (pData->fnCreatePage)( this, *CreateInputItemSet( mnCurrentPageId ) );
+
+ SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pData->nId ) );
+ pData->pPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) );
+ SetPosSizePages ( pData->nId );
+
+ if ( pData->bOnDemand )
+ pData->pPage->Reset( (SfxItemSet &)pData->pPage->GetItemSet() );
+ else
+ pData->pPage->Reset( *pSet );
+
+ PageCreated( mnCurrentPageId, *pData->pPage );
+ }
+ else if ( pData->bRefresh )
+ {
+ pData->pPage->Reset( *pSet );
+ }
+
+ pData->bRefresh = FALSE;
+
+ if ( pExampleSet )
+ pData->pPage->ActivatePage( *pExampleSet );
+ }
+
+ SetHelpId( pData->pPage->GetHelpId() );
+
+ BOOL bReadOnly = pData->pPage->IsReadOnly();
+ if ( bReadOnly || bHideResetBtn )
+ aResetBtn.Hide();
+ else
+ aResetBtn.Show();
+
+}
+
+// -----------------------------------------------------------------------
+
+BOOL IconChoiceDialog::DeActivatePageImpl ()
+{
+ IconChoicePageData *pData = GetPageData ( mnCurrentPageId );
+
+ int nRet = IconChoicePage::LEAVE_PAGE;
+
+ if ( pData )
+ {
+ IconChoicePage * pPage = pData->pPage;
+
+ if ( !pExampleSet && pPage->HasExchangeSupport() && pSet )
+ pExampleSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() );
+
+ if ( pSet )
+ {
+ SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() );
+
+ if ( pPage->HasExchangeSupport() )
+ nRet = pPage->DeactivatePage( &aTmp );
+
+ if ( ( IconChoicePage::LEAVE_PAGE & nRet ) == IconChoicePage::LEAVE_PAGE &&
+ aTmp.Count() )
+ {
+ pExampleSet->Put( aTmp );
+ pOutSet->Put( aTmp );
+ }
+ }
+ else
+ {
+ if ( pPage->HasExchangeSupport() ) //!!!
+ {
+ if ( !pExampleSet )
+ {
+ SfxItemPool* pPool = pPage->GetItemSet().GetPool();
+ pExampleSet =
+ new SfxItemSet( *pPool, GetInputRanges( *pPool ) );
+ }
+ nRet = pPage->DeactivatePage( pExampleSet );
+ }
+ else
+ nRet = pPage->DeactivatePage( NULL );
+ }
+
+ if ( nRet & IconChoicePage::REFRESH_SET )
+ {
+ pSet = GetRefreshedSet();
+ DBG_ASSERT( pSet, "GetRefreshedSet() liefert NULL" );
+ // alle Pages als neu zu initialsieren flaggen
+ const ULONG nCount = maPageList.Count();
+
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ IconChoicePageData* pObj = (IconChoicePageData*)maPageList.GetObject(i);
+
+ if ( pObj->pPage != pPage ) // eigene Page nicht mehr refreshen
+ pObj->bRefresh = TRUE;
+ else
+ pObj->bRefresh = FALSE;
+ }
+ }
+ }
+
+ if ( nRet & IconChoicePage::LEAVE_PAGE )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::ResetPageImpl ()
+{
+ IconChoicePageData *pData = GetPageData ( mnCurrentPageId );
+
+ DBG_ASSERT( pData, "Id nicht bekannt" );
+
+ if ( pData->bOnDemand )
+ {
+ // CSet auf AIS hat hier Probleme, daher getrennt
+ const SfxItemSet* _pSet = &pData->pPage->GetItemSet();
+ pData->pPage->Reset( *(SfxItemSet*)_pSet );
+ }
+ else
+ pData->pPage->Reset( *pSet );
+}
+
+/**********************************************************************
+|
+| handling itemsets
+|
+\**********************************************************************/
+
+const USHORT* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool )
+{
+ if ( pSet )
+ {
+ DBG_ERRORFILE( "Set bereits vorhanden!" );
+ return pSet->GetRanges();
+ }
+
+ if ( pRanges )
+ return pRanges;
+ SvUShorts aUS( 16, 16 );
+ ULONG nCount = maPageList.Count();
+
+ USHORT i;
+ for ( i = 0; i < nCount; ++i )
+ {
+ IconChoicePageData* pData = maPageList.GetObject (i);
+
+ if ( pData->fnGetRanges )
+ {
+ const USHORT* pTmpRanges = (pData->fnGetRanges)();
+ const USHORT* pIter = pTmpRanges;
+
+ USHORT nLen;
+ for( nLen = 0; *pIter; ++nLen, ++pIter )
+ ;
+ aUS.Insert( pTmpRanges, nLen, aUS.Count() );
+ }
+ }
+
+ // remove double Id's
+#ifndef TF_POOLABLE
+ if ( rPool.HasMap() )
+#endif
+ {
+ nCount = aUS.Count();
+
+ for ( i = 0; i < nCount; ++i )
+ aUS[i] = rPool.GetWhich( aUS[i] );
+ }
+
+ // sortieren
+ if ( aUS.Count() > 1 )
+ {
+#if defined __SUNPRO_CC
+#pragma disable_warn
+#endif
+ qsort( (void*)aUS.GetData(), aUS.Count(), sizeof(USHORT), IconcDlgCmpUS_Impl );
+#if defined __SUNPRO_CC
+#pragma enable_warn
+#endif
+ }
+
+ pRanges = new USHORT[aUS.Count() + 1];
+ memcpy(pRanges, aUS.GetData(), sizeof(USHORT) * aUS.Count());
+ pRanges[aUS.Count()] = 0;
+
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::SetInputSet( const SfxItemSet* pInSet )
+{
+ FASTBOOL bSet = ( pSet != NULL );
+
+ pSet = pInSet;
+
+ if ( !bSet && !pExampleSet && !pOutSet )
+ {
+ pExampleSet = new SfxItemSet( *pSet );
+ pOutSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+// Liefert die Pages, die ihre Sets onDemand liefern, das OutputItemSet.
+const SfxItemSet* IconChoiceDialog::GetOutputItemSet ( USHORT nId )
+{
+ IconChoicePageData * pData = GetPageData ( nId );
+ DBG_ASSERT( pData, "TabPage nicht gefunden" );
+
+ if ( pData )
+ {
+ if ( !pData->pPage )
+ return NULL;
+
+ if ( pData->bOnDemand )
+ return &pData->pPage->GetItemSet();
+
+ return pOutSet;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+int IconChoiceDialog::FillOutputItemSet()
+{
+ int nRet = IconChoicePage::LEAVE_PAGE;
+ if ( OK_Impl() )
+ Ok();
+ else
+ nRet = IconChoicePage::KEEP_PAGE;
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::PageCreated( USHORT /*nId*/, IconChoicePage& /*rPage*/ )
+{
+ // not interested in
+}
+
+// -----------------------------------------------------------------------
+
+SfxItemSet* IconChoiceDialog::CreateInputItemSet( USHORT )
+{
+ DBG_WARNINGFILE( "CreateInputItemSet nicht implementiert" );
+
+ return 0;
+}
+
+/**********************************************************************
+|
+| start dialog
+|
+\**********************************************************************/
+
+short IconChoiceDialog::Execute()
+{
+ if ( !maPageList.Count() )
+ return RET_CANCEL;
+
+ Start_Impl();
+
+ return Dialog::Execute();
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::Start( BOOL bShow )
+{
+
+ aCancelBtn.SetClickHdl( LINK( this, IconChoiceDialog, CancelHdl ) );
+ bModal = FALSE;
+
+ Start_Impl();
+
+ if ( bShow )
+ Window::Show();
+
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool IconChoiceDialog::QueryClose()
+{
+ sal_Bool bRet = sal_True;
+ const ULONG nCount = maPageList.Count();
+ for ( ULONG i = 0; i < nCount; ++i )
+ {
+ IconChoicePageData* pData = maPageList.GetObject(i);
+ if ( pData->pPage && !pData->pPage->QueryClose() )
+ {
+ bRet = sal_False;
+ break;
+ }
+ }
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::Start_Impl()
+{
+ Point aPos;
+ USHORT nActPage;
+
+ if ( mnCurrentPageId == 0 || mnCurrentPageId == USHRT_MAX )
+ nActPage = maPageList.GetObject(0)->nId;//First()->nId;
+ else
+ nActPage = mnCurrentPageId;
+
+ // Konfiguration vorhanden?
+ SvtViewOptions aTabDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) );
+
+ if ( aTabDlgOpt.Exists() )
+ {
+ // ggf. Position aus Konfig
+ SetWindowState( ByteString( aTabDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
+
+ // initiale TabPage aus Programm/Hilfe/Konfig
+ nActPage = (USHORT)aTabDlgOpt.GetPageID();
+
+ if ( USHRT_MAX != mnCurrentPageId )
+ nActPage = mnCurrentPageId;
+
+ if ( GetPageData ( nActPage ) == NULL )
+ nActPage = ( (IconChoicePageData*)maPageList.GetObject(0) )->nId;
+ }
+ else if ( USHRT_MAX != mnCurrentPageId && GetPageData ( mnCurrentPageId ) != NULL )
+ nActPage = mnCurrentPageId;
+
+ mnCurrentPageId = nActPage;
+
+ FocusOnIcon( mnCurrentPageId );
+
+ ActivatePageImpl();
+}
+
+// -----------------------------------------------------------------------
+
+const SfxItemSet* IconChoiceDialog::GetRefreshedSet()
+{
+ DBG_ERRORFILE( "GetRefreshedSet nicht implementiert" );
+ return 0;
+}
+
+/**********************************************************************
+|
+| tool-methods
+|
+\**********************************************************************/
+
+IconChoicePageData* IconChoiceDialog::GetPageData ( USHORT nId )
+{
+ IconChoicePageData *pRet = NULL;
+ BOOL bFound = FALSE;
+
+ for ( ULONG i=0; i<maPageList.Count() && !bFound; i++ )
+ {
+ IconChoicePageData* pData = (IconChoicePageData*)maPageList.GetObject ( i );
+
+ if ( pData->nId == nId )
+ {
+ pRet = pData;
+ }
+ }
+
+ return pRet;
+}
+
+/**********************************************************************
+|
+| OK-Status
+|
+\**********************************************************************/
+
+BOOL IconChoiceDialog::OK_Impl()
+{
+ IconChoicePage* pPage = GetPageData ( mnCurrentPageId )->pPage;
+
+ bool bEnd = !pPage;
+ if ( pPage )
+ {
+ int nRet = IconChoicePage::LEAVE_PAGE;
+ if ( pSet )
+ {
+ SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() );
+ BOOL bRet = FALSE;
+
+ if ( pPage->HasExchangeSupport() )
+ nRet = pPage->DeactivatePage( &aTmp );
+
+ if ( ( IconChoicePage::LEAVE_PAGE & nRet ) == IconChoicePage::LEAVE_PAGE
+ && aTmp.Count() )
+ {
+ pExampleSet->Put( aTmp );
+ pOutSet->Put( aTmp );
+ }
+ else if ( bRet )
+ bModified |= TRUE;
+ }
+ else
+ nRet = pPage->DeactivatePage( NULL );
+ bEnd = nRet;
+ }
+
+ return bEnd;
+}
+
+// -----------------------------------------------------------------------
+
+short IconChoiceDialog::Ok()
+{
+ bInOK = TRUE;
+
+ if ( !pOutSet )
+ {
+ if ( !pExampleSet && pSet )
+ pOutSet = pSet->Clone( FALSE ); // ohne Items
+ else if ( pExampleSet )
+ pOutSet = new SfxItemSet( *pExampleSet );
+ }
+ BOOL _bModified = FALSE;
+
+ const ULONG nCount = maPageList.Count();
+
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ IconChoicePageData* pData = GetPageData ( i );
+
+ IconChoicePage* pPage = pData->pPage;
+
+ if ( pPage )
+ {
+ if ( pData->bOnDemand )
+ {
+ SfxItemSet& rSet = (SfxItemSet&)pPage->GetItemSet();
+ rSet.ClearItem();
+ _bModified |= pPage->FillItemSet( rSet );
+ }
+ else if ( pSet && !pPage->HasExchangeSupport() )
+ {
+ SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() );
+
+ if ( pPage->FillItemSet( aTmp ) )
+ {
+ _bModified |= TRUE;
+ pExampleSet->Put( aTmp );
+ pOutSet->Put( aTmp );
+ }
+ }
+ }
+ }
+
+ if ( _bModified || ( pOutSet && pOutSet->Count() > 0 ) )
+ _bModified |= TRUE;
+
+ return _bModified ? RET_OK : RET_CANCEL;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL IconChoiceDialog::IsInOK() const
+{
+ return bInOK;
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::FocusOnIcon( USHORT nId )
+{
+ // set focus to icon for the current visible page
+ for ( USHORT i=0; i<maIconCtrl.GetEntryCount(); i++)
+ {
+ SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i );
+ USHORT* pUserData = (USHORT*) pEntry->GetUserData();
+
+ if ( pUserData && *pUserData == nId )
+ {
+ maIconCtrl.SetCursor( pEntry );
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::CreateIconTextAutoMnemonics( void )
+{
+ maIconCtrl.CreateAutoMnemonics();
+}
diff --git a/cui/source/dialogs/iconcdlg.src b/cui/source/dialogs/iconcdlg.src
new file mode 100644
index 000000000000..1594eb43a8c7
--- /dev/null
+++ b/cui/source/dialogs/iconcdlg.src
@@ -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: iconcdlg.src,v $
+ * $Revision: 1.19 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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>
+
+String RID_SVXSTR_ICONCHOICEDLG_RESETBUT
+{
+ Text [ en-US ] = "~Back" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
new file mode 100644
index 000000000000..ae16447904d6
--- /dev/null
+++ b/cui/source/dialogs/insdlg.cxx
@@ -0,0 +1,1060 @@
+/*************************************************************************
+ *
+ * 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: insdlg.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/embed/XInsertObjectDialog.hpp>
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+
+#include "insdlg.hxx"
+#include <svx/dialmgr.hxx>
+#include <svtools/sores.hxx>
+
+#include <stdio.h>
+#include <tools/urlobj.hxx>
+#include <tools/debug.hxx>
+#include <svl/urihelper.hxx>
+#include <svtools/svmedit.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <sot/clsids.hxx>
+#include <sfx2/frmdescr.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <svl/ownlist.hxx>
+#include <comphelper/seqstream.hxx>
+
+#include "svuidlg.hrc"
+
+#include <osl/file.hxx>
+
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <unotools/processfactory.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::ui::dialogs;
+using ::rtl::OUString;
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+
+
+static String impl_getSvtResString( sal_uInt32 nId )
+{
+ String aRet;
+ com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
+ ResMgr* pMgr = ResMgr::CreateResMgr( "svt", aLocale );
+ if( pMgr )
+ {
+ aRet = String( ResId( nId, *pMgr ) );
+ delete pMgr;
+ }
+ return aRet;
+}
+
+BOOL InsertObjectDialog_Impl::IsCreateNew() const
+{
+ return FALSE;
+}
+
+uno::Reference< io::XInputStream > InsertObjectDialog_Impl::GetIconIfIconified( ::rtl::OUString* /*pGraphicMediaType*/ )
+{
+ return uno::Reference< io::XInputStream >();
+}
+
+InsertObjectDialog_Impl::InsertObjectDialog_Impl( Window * pParent, const ResId & rResId, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage )
+ : ModalDialog( pParent, rResId )
+ , m_xStorage( xStorage )
+ , aCnt( m_xStorage )
+{
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvInsertOleDlg, DoubleClickHdl, ListBox *, EMPTYARG )
+{
+ EndDialog( RET_OK );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvInsertOleDlg, DoubleClickHdl, ListBox *, pListBox )
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvInsertOleDlg, BrowseHdl, PushButton *, EMPTYARG )
+{
+ Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ if( xFactory.is() )
+ {
+ Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY );
+ DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" );
+
+ Reference< XInitialization > xInit( xFilePicker, UNO_QUERY );
+ Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY );
+ if( xInit.is() && xFilePicker.is() && xFilterMgr.is() )
+ {
+ Sequence< Any > aServiceType( 1 );
+ aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE;
+ xInit->initialize( aServiceType );
+
+ // add filter
+ try
+ {
+ xFilterMgr->appendFilter(
+ OUString(),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "*.*" ) )
+ );
+ }
+ catch( IllegalArgumentException& )
+ {
+ DBG_ASSERT( 0, "caught IllegalArgumentException when registering filter\n" );
+ }
+
+ if( xFilePicker->execute() == ExecutableDialogResults::OK )
+ {
+ Sequence< OUString > aPathSeq( xFilePicker->getFiles() );
+ INetURLObject aObj( aPathSeq[0] );
+ aEdFilepath.SetText( aObj.PathToFileName() );
+ }
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvInsertOleDlg, RadioHdl, RadioButton *, EMPTYARG )
+{
+ if ( aRbNewObject.IsChecked() )
+ {
+ aLbObjecttype.Show();
+ aEdFilepath.Hide();
+ aBtnFilepath.Hide();
+ aCbFilelink.Hide();
+ aGbObject.SetText( _aOldStr );
+ }
+ else
+ {
+ aCbFilelink.Show();
+ aLbObjecttype.Hide();
+ aEdFilepath.Show();
+ aBtnFilepath.Show();
+ aCbFilelink.Show();
+ aGbObject.SetText( aStrFile );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvInsertOleDlg::SelectDefault()
+{
+ aLbObjecttype.SelectEntryPos( 0 );
+}
+
+void SvInsertOleDlg::FillObjectServerList( SvObjectServerList* pList )
+{
+ pList->FillInsertObjects();
+}
+
+// -----------------------------------------------------------------------
+SvInsertOleDlg::SvInsertOleDlg
+(
+ Window* pParent,
+ const Reference < embed::XStorage >& xStorage,
+ const SvObjectServerList* pServers
+)
+ : InsertObjectDialog_Impl( pParent, SVX_RES( MD_INSERT_OLEOBJECT ), xStorage ),
+ aRbNewObject( this, SVX_RES( RB_NEW_OBJECT ) ),
+ aRbObjectFromfile( this, SVX_RES( RB_OBJECT_FROMFILE ) ),
+ aLbObjecttype( this, SVX_RES( LB_OBJECTTYPE ) ),
+ aEdFilepath( this, SVX_RES( ED_FILEPATH ) ),
+ aBtnFilepath( this, SVX_RES( BTN_FILEPATH ) ),
+ aCbFilelink( this, SVX_RES( CB_FILELINK ) ),
+ aGbObject( this, SVX_RES( GB_OBJECT ) ),
+ aOKButton1( this, SVX_RES( 1 ) ),
+ aCancelButton1( this, SVX_RES( 1 ) ),
+ aHelpButton1( this, SVX_RES( 1 ) ),
+ aStrFile( SVX_RES( STR_FILE ) ),
+ m_pServers( pServers )
+{
+ FreeResource();
+ _aOldStr = aGbObject.GetText();
+ aLbObjecttype.SetDoubleClickHdl( LINK( this, SvInsertOleDlg, DoubleClickHdl ) );
+ aBtnFilepath.SetClickHdl( LINK( this, SvInsertOleDlg, BrowseHdl ) );
+ Link aLink( LINK( this, SvInsertOleDlg, RadioHdl ) );
+ aRbNewObject.SetClickHdl( aLink );
+ aRbObjectFromfile.SetClickHdl( aLink );
+ aRbNewObject.Check( TRUE );
+ RadioHdl( NULL );
+}
+
+short SvInsertOleDlg::Execute()
+{
+ short nRet = RET_OK;
+ SvObjectServerList aObjS;
+ if ( !m_pServers )
+ {
+ // if no list was provided, take the complete one
+ aObjS.FillInsertObjects();
+ m_pServers = &aObjS;
+ }
+
+ // fill listbox and select default
+ ListBox& rBox = GetObjectTypes();
+ rBox.SetUpdateMode( FALSE );
+ for ( ULONG i = 0; i < m_pServers->Count(); i++ )
+ rBox.InsertEntry( (*m_pServers)[i].GetHumanName() );
+ rBox.SetUpdateMode( TRUE );
+ SelectDefault();
+ ::rtl::OUString aName;
+
+ DBG_ASSERT( m_xStorage.is(), "No storage!");
+ if ( m_xStorage.is() && ( nRet = Dialog::Execute() ) == RET_OK )
+ {
+ String aFileName;
+ BOOL bLink = FALSE;
+ BOOL bCreateNew = IsCreateNew();
+ if ( bCreateNew )
+ {
+ // create and insert new embedded object
+ String aServerName = rBox.GetSelectEntry();
+ const SvObjectServer* pS = m_pServers->Get( aServerName );
+ if ( pS )
+ {
+ if( pS->GetClassName() == SvGlobalName( SO3_OUT_CLASSID ) )
+ {
+ try
+ {
+ uno::Reference < embed::XInsertObjectDialog > xDialogCreator(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.MSOLEObjectSystemCreator")) ),
+ uno::UNO_QUERY );
+
+ if ( xDialogCreator.is() )
+ {
+ aName = aCnt.CreateUniqueObjectName();
+ embed::InsertedObjectInfo aNewInf = xDialogCreator->createInstanceByDialog(
+ m_xStorage,
+ aName,
+ uno::Sequence < beans::PropertyValue >() );
+
+ OSL_ENSURE( aNewInf.Object.is(), "The object must be created or an exception must be thrown!" );
+ m_xObj = aNewInf.Object;
+ for ( sal_Int32 nInd = 0; nInd < aNewInf.Options.getLength(); nInd++ )
+ if ( aNewInf.Options[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Icon" ) ) ) )
+ {
+ aNewInf.Options[nInd].Value >>= m_aIconMetaFile;
+ }
+ else if ( aNewInf.Options[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconFormat" ) ) ) )
+ {
+ datatransfer::DataFlavor aFlavor;
+ if ( aNewInf.Options[nInd].Value >>= aFlavor )
+ m_aIconMediaType = aFlavor.MimeType;
+ }
+
+ }
+ }
+ catch( ucb::CommandAbortedException& )
+ {
+ // the user has pressed cancel
+ }
+ catch( uno::Exception& )
+ {
+ // TODO: Error handling
+ }
+ }
+ else
+ {
+ // create object with desired ClassId
+ m_xObj = aCnt.CreateEmbeddedObject( pS->GetClassName().GetByteSequence(), aName );
+ }
+
+ if ( !m_xObj.is() )
+ {
+ if( aFileName.Len() ) // from OLE Dialog
+ {
+ // Objekt konnte nicht aus Datei erzeugt werden
+ // global Resource from svtools (former so3 resource)
+ String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_FROM_FILE ) );
+ aErr.SearchAndReplace( String( '%' ), aFileName );
+ ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute();
+ }
+ else
+ {
+ // Objekt konnte nicht erzeugt werden
+ // global Resource from svtools (former so3 resource)
+ String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE ) );
+ aErr.SearchAndReplace( String( '%' ), aServerName );
+ ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute();
+ }
+ }
+ }
+ }
+ else
+ {
+ aFileName = GetFilePath();
+ INetURLObject aURL;
+ aURL.SetSmartProtocol( INET_PROT_FILE );
+ aURL.SetSmartURL( aFileName );
+ aFileName = aURL.GetMainURL( INetURLObject::NO_DECODE );
+ bLink = IsLinked();
+
+ if ( aFileName.Len() )
+ {
+ // create MediaDescriptor for file to create object from
+ uno::Sequence < beans::PropertyValue > aMedium( 2 );
+ aMedium[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+ aMedium[0].Value <<= ::rtl::OUString( aFileName );
+
+ uno::Reference< task::XInteractionHandler > xInteraction;
+ uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+ if ( xFactory.is() )
+ xInteraction = uno::Reference< task::XInteractionHandler >(
+ xFactory->createInstance(
+ DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ),
+ uno::UNO_QUERY_THROW );
+
+ if ( xInteraction.is() )
+ {
+ aMedium[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) );
+ aMedium[1].Value <<= xInteraction;
+ }
+ else
+ {
+ OSL_ASSERT( "Can not get InteractionHandler!\n" );
+ aMedium.realloc( 1 );
+ }
+
+ // create object from media descriptor
+ if ( bLink )
+ m_xObj = aCnt.InsertEmbeddedLink( aMedium, aName );
+ else
+ m_xObj = aCnt.InsertEmbeddedObject( aMedium, aName );
+ }
+
+ if ( !m_xObj.is() )
+ {
+ // Objekt konnte nicht aus Datei erzeugt werden
+ // global Resource from svtools (former so3 resource)
+ String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_FROM_FILE ) );
+ aErr.SearchAndReplace( String( '%' ), aFileName );
+ ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute();
+ }
+ }
+ }
+
+ m_pServers = 0;
+ return nRet;
+}
+
+uno::Reference< io::XInputStream > SvInsertOleDlg::GetIconIfIconified( ::rtl::OUString* pGraphicMediaType )
+{
+ if ( m_aIconMetaFile.getLength() )
+ {
+ if ( pGraphicMediaType )
+ *pGraphicMediaType = m_aIconMediaType;
+
+ return uno::Reference< io::XInputStream >( new ::comphelper::SequenceInputStream( m_aIconMetaFile ) );
+ }
+
+ return uno::Reference< io::XInputStream >();
+}
+
+IMPL_LINK( SvInsertPlugInDialog, BrowseHdl, PushButton *, EMPTYARG )
+{
+ Sequence< OUString > aFilterNames, aFilterTypes;
+ void fillNetscapePluginFilters( Sequence< OUString >& rNames, Sequence< OUString >& rTypes );
+ fillNetscapePluginFilters( aFilterNames, aFilterTypes );
+
+ Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ if( xFactory.is() )
+ {
+ Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY );
+ DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" );
+
+ Reference< XInitialization > xInit( xFilePicker, UNO_QUERY );
+ Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY );
+ if( xInit.is() && xFilePicker.is() && xFilterMgr.is() )
+ {
+ Sequence< Any > aServiceType( 1 );
+ aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE;
+ xInit->initialize( aServiceType );
+
+ // add the filters
+ try
+ {
+ const OUString* pNames = aFilterNames.getConstArray();
+ const OUString* pTypes = aFilterTypes.getConstArray();
+ for( int i = 0; i < aFilterNames.getLength(); i++ )
+ xFilterMgr->appendFilter( pNames[i], pTypes[i] );
+ }
+ catch( IllegalArgumentException& )
+ {
+ DBG_ASSERT( 0, "caught IllegalArgumentException when registering filter\n" );
+ }
+
+ if( xFilePicker->execute() == ExecutableDialogResults::OK )
+ {
+ Sequence< OUString > aPathSeq( xFilePicker->getFiles() );
+ INetURLObject aObj( aPathSeq[0] );
+ aEdFileurl.SetText( aObj.PathToFileName() );
+ }
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvInsertPlugInDialog::SvInsertPlugInDialog( Window* pParent, const uno::Reference < embed::XStorage >& xStorage )
+ : InsertObjectDialog_Impl( pParent, SVX_RES( MD_INSERT_OBJECT_PLUGIN ), xStorage ),
+ aEdFileurl( this, SVX_RES( ED_FILEURL ) ),
+ aBtnFileurl( this, SVX_RES( BTN_FILEURL ) ),
+ aGbFileurl( this, SVX_RES( GB_FILEURL ) ),
+ aEdPluginsOptions( this, SVX_RES( ED_PLUGINS_OPTIONS ) ),
+ aGbPluginsOptions( this, SVX_RES( GB_PLUGINS_OPTIONS ) ),
+ aOKButton1( this, SVX_RES( 1 ) ),
+ aCancelButton1( this, SVX_RES( 1 ) ),
+ aHelpButton1( this, SVX_RES( 1 ) ),
+ m_pURL(0)
+{
+ FreeResource();
+ aBtnFileurl.SetClickHdl( LINK( this, SvInsertPlugInDialog, BrowseHdl ) );
+}
+
+SvInsertPlugInDialog::~SvInsertPlugInDialog()
+{
+ delete m_pURL;
+}
+
+// -----------------------------------------------------------------------
+
+static void Plugin_ImplFillCommandSequence( const String& aCommands, uno::Sequence< beans::PropertyValue >& aCommandSequence )
+{
+ USHORT nEaten;
+ SvCommandList aLst;
+ aLst.AppendCommands( aCommands, &nEaten );
+
+ const sal_Int32 nCount = aLst.Count();
+ aCommandSequence.realloc( nCount );
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ const SvCommand& rCommand = aLst[ nIndex ];
+
+ aCommandSequence[nIndex].Name = rCommand.GetCommand();
+ aCommandSequence[nIndex].Handle = -1;
+ aCommandSequence[nIndex].Value = makeAny( OUString( rCommand.GetArgument() ) );
+ aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
+ }
+}
+
+short SvInsertPlugInDialog::Execute()
+{
+ short nRet = RET_OK;
+ m_aCommands.Erase();
+ DBG_ASSERT( m_xStorage.is(), "No storage!");
+ if ( m_xStorage.is() && ( nRet = Dialog::Execute() ) == RET_OK )
+ {
+ if ( !m_pURL )
+ m_pURL = new INetURLObject();
+ else
+ *m_pURL = INetURLObject();
+
+ m_aCommands = GetPlugInOptions();
+ String aURL = GetPlugInFile();
+
+ // URL can be a valid and absolute URL or a system file name
+ m_pURL->SetSmartProtocol( INET_PROT_FILE );
+ if ( !aURL.Len() || m_pURL->SetSmartURL( aURL ) )
+ {
+ // create a plugin object
+ ::rtl::OUString aName;
+ SvGlobalName aClassId( SO3_PLUGIN_CLASSID );
+ m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName );
+ }
+
+ if ( m_xObj.is() )
+ {
+ // set properties from dialog
+ if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED )
+ m_xObj->changeState( embed::EmbedStates::RUNNING );
+
+ uno::Reference < beans::XPropertySet > xSet( m_xObj->getComponent(), uno::UNO_QUERY );
+ if ( xSet.is() )
+ {
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("PluginURL"),
+ makeAny( ::rtl::OUString( m_pURL->GetMainURL( INetURLObject::NO_DECODE ) ) ) );
+ uno::Sequence< beans::PropertyValue > aCommandSequence;
+ Plugin_ImplFillCommandSequence( m_aCommands, aCommandSequence );
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("PluginCommands"), makeAny( aCommandSequence ) );
+ }
+ }
+ else
+ {
+ // PlugIn konnte nicht erzeugt werden
+ // global Resource from svtools (former so3 resource)
+ String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_PLUGIN ) );
+ aErr.SearchAndReplace( String( '%' ), aURL );
+ ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute();
+ }
+ }
+
+ return nRet;
+}
+
+// class SvInsertAppletDlg -----------------------------------------------
+
+IMPL_LINK( SvInsertAppletDialog, BrowseHdl, PushButton *, EMPTYARG )
+{
+ Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ if( xFactory.is() )
+ {
+ Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY );
+ DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" );
+
+ Reference< XInitialization > xInit( xFilePicker, UNO_QUERY );
+ Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY );
+ if( xInit.is() && xFilePicker.is() && xFilterMgr.is() )
+ {
+ Sequence< Any > aServiceType( 1 );
+ aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE;
+ xInit->initialize( aServiceType );
+
+ // add filter
+ try
+ {
+ xFilterMgr->appendFilter(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Applet" ) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "*.class" ) )
+ );
+ }
+ catch( IllegalArgumentException& )
+ {
+ DBG_ASSERT( 0, "caught IllegalArgumentException when registering filter\n" );
+ }
+
+ if( xFilePicker->execute() == ExecutableDialogResults::OK )
+ {
+ Sequence< OUString > aPathSeq( xFilePicker->getFiles() );
+
+ INetURLObject aObj( aPathSeq[0] );
+ aEdClassfile.SetText( aObj.getName() );
+ aObj.removeSegment();
+ aEdClasslocation.SetText( aObj.PathToFileName() );
+ }
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvInsertAppletDialog::SvInsertAppletDialog( Window* pParent, const uno::Reference < embed::XStorage >& xStorage )
+ : InsertObjectDialog_Impl( pParent, SVX_RES( MD_INSERT_OBJECT_APPLET ), xStorage ),
+ aFtClassfile( this, SVX_RES( FT_CLASSFILE ) ),
+ aEdClassfile( this, SVX_RES( ED_CLASSFILE ) ),
+ aFtClasslocation( this, SVX_RES( FT_CLASSLOCATION ) ),
+ aEdClasslocation( this, SVX_RES( ED_CLASSLOCATION ) ),
+ aBtnClass( this, SVX_RES( BTN_CLASS ) ),
+ aGbClass( this, SVX_RES( GB_CLASS ) ),
+ aEdAppletOptions( this, SVX_RES( ED_APPLET_OPTIONS ) ),
+ aGbAppletOptions( this, SVX_RES( GB_APPLET_OPTIONS ) ),
+ aOKButton1( this, SVX_RES( 1 ) ),
+ aCancelButton1( this, SVX_RES( 1 ) ),
+ aHelpButton1( this, SVX_RES( 1 ) ),
+ m_pURL(0)
+{
+ FreeResource();
+ aBtnClass.SetClickHdl( LINK( this, SvInsertAppletDialog, BrowseHdl ) );
+}
+
+SvInsertAppletDialog::SvInsertAppletDialog( Window* pParent, const uno::Reference < embed::XEmbeddedObject >& xObj )
+ : InsertObjectDialog_Impl( pParent, SVX_RES( MD_INSERT_OBJECT_APPLET ), uno::Reference < embed::XStorage >() ),
+ aFtClassfile( this, SVX_RES( FT_CLASSFILE ) ),
+ aEdClassfile( this, SVX_RES( ED_CLASSFILE ) ),
+ aFtClasslocation( this, SVX_RES( FT_CLASSLOCATION ) ),
+ aEdClasslocation( this, SVX_RES( ED_CLASSLOCATION ) ),
+ aBtnClass( this, SVX_RES( BTN_CLASS ) ),
+ aGbClass( this, SVX_RES( GB_CLASS ) ),
+ aEdAppletOptions( this, SVX_RES( ED_APPLET_OPTIONS ) ),
+ aGbAppletOptions( this, SVX_RES( GB_APPLET_OPTIONS ) ),
+ aOKButton1( this, SVX_RES( 1 ) ),
+ aCancelButton1( this, SVX_RES( 1 ) ),
+ aHelpButton1( this, SVX_RES( 1 ) ),
+ m_pURL(0)
+{
+ m_xObj = xObj;
+ FreeResource();
+ aBtnClass.SetClickHdl( LINK( this, SvInsertAppletDialog, BrowseHdl ) );
+}
+
+
+SvInsertAppletDialog::~SvInsertAppletDialog()
+{
+ delete m_pURL;
+}
+
+short SvInsertAppletDialog::Execute()
+{
+ short nRet = RET_OK;
+ m_aClass.Erase();
+ m_aCommands.Erase();
+
+ BOOL bOK = FALSE;
+ uno::Reference < beans::XPropertySet > xSet;
+ if ( m_xObj.is() )
+ {
+ try
+ {
+ if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED )
+ m_xObj->changeState( embed::EmbedStates::RUNNING );
+ xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY );
+ ::rtl::OUString aStr;
+ uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCode") );
+ if ( aAny >>= aStr )
+ SetClass( aStr );
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCodeBase") );
+ if ( aAny >>= aStr )
+ SetClassLocation( aStr );
+ uno::Sequence< beans::PropertyValue > aCommands;
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCommands") );
+ if ( aAny >>= aCommands )
+ {
+ SvCommandList aList;
+ aList.FillFromSequence( aCommands );
+ SetAppletOptions( aList.GetCommands() );
+ }
+
+ String aText( SVX_RES( STR_EDIT_APPLET ) );
+ SetText( aText );
+ bOK = TRUE;
+ }
+ catch ( uno::Exception& )
+ {
+ DBG_ERROR( "No Applet!" );
+ }
+ }
+ else
+ {
+ DBG_ASSERT( m_xStorage.is(), "No storage!");
+ bOK = m_xStorage.is();
+ }
+
+ if ( bOK && ( nRet = Dialog::Execute() ) == RET_OK )
+ {
+ if ( !m_xObj.is() )
+ {
+ ::rtl::OUString aName;
+ SvGlobalName aClassId( SO3_APPLET_CLASSID );
+ m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName );
+ if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED )
+ m_xObj->changeState( embed::EmbedStates::RUNNING );
+ xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY );
+ }
+
+ if ( m_xObj.is() )
+ {
+ try
+ {
+ BOOL bIPActive = m_xObj->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE;
+ if ( bIPActive )
+ m_xObj->changeState( embed::EmbedStates::RUNNING );
+
+ String aClassLocation = GetClassLocation();
+
+ // Hack, aFileName wird auch fuer Class benutzt
+ m_aClass = GetClass();
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("AppletCode"), makeAny( ::rtl::OUString( m_aClass ) ) );
+
+ ::rtl::OUString tmp = aClassLocation;
+ ::osl::File::getFileURLFromSystemPath(tmp, tmp);
+ aClassLocation = tmp;
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("AppletCodeBase"), makeAny( tmp ) );
+ m_aCommands = GetAppletOptions();
+
+ uno::Sequence< beans::PropertyValue > aCommandSequence;
+ Plugin_ImplFillCommandSequence( m_aCommands, aCommandSequence );
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("AppletCommands"), makeAny( aCommandSequence ) );
+
+ if ( bIPActive )
+ m_xObj->changeState( embed::EmbedStates::INPLACE_ACTIVE );
+ }
+ catch ( uno::Exception& )
+ {
+ DBG_ERROR( "No Applet!" );
+ }
+ }
+ }
+
+ return nRet;
+}
+
+SfxInsertFloatingFrameDialog::SfxInsertFloatingFrameDialog( Window *pParent,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage )
+ : InsertObjectDialog_Impl( pParent, SVX_RES( MD_INSERT_OBJECT_IFRAME ), xStorage )
+ , aFTName ( this, SVX_RES( FT_FRAMENAME ) )
+ , aEDName ( this, SVX_RES( ED_FRAMENAME ) )
+ , aFTURL ( this, SVX_RES( FT_URL ) )
+ , aEDURL ( this, SVX_RES( ED_URL ) )
+ , aBTOpen ( this, SVX_RES(BT_FILEOPEN ) )
+ , aRBScrollingOn ( this, SVX_RES( RB_SCROLLINGON ) )
+ , aRBScrollingOff ( this, SVX_RES( RB_SCROLLINGOFF ) )
+ , aRBScrollingAuto ( this, SVX_RES( RB_SCROLLINGAUTO ) )
+ , aFLScrolling ( this, SVX_RES( GB_SCROLLING ) )
+ , aFLSepLeft( this, SVX_RES( FL_SEP_LEFT ) )
+ , aRBFrameBorderOn ( this, SVX_RES( RB_FRMBORDER_ON ) )
+ , aRBFrameBorderOff ( this, SVX_RES( RB_FRMBORDER_OFF ) )
+ , aFLFrameBorder( this, SVX_RES( GB_BORDER ) )
+ , aFLSepRight( this, SVX_RES( FL_SEP_RIGHT ) )
+ , aFTMarginWidth ( this, SVX_RES( FT_MARGINWIDTH ) )
+ , aNMMarginWidth ( this, SVX_RES( NM_MARGINWIDTH ) )
+ , aCBMarginWidthDefault( this, SVX_RES( CB_MARGINHEIGHTDEFAULT ) )
+ , aFTMarginHeight ( this, SVX_RES( FT_MARGINHEIGHT ) )
+ , aNMMarginHeight ( this, SVX_RES( NM_MARGINHEIGHT ) )
+ , aCBMarginHeightDefault( this, SVX_RES( CB_MARGINHEIGHTDEFAULT ) )
+ , aFLMargin( this, SVX_RES( GB_MARGIN ) )
+ , aOKButton1( this, SVX_RES( 1 ) )
+ , aCancelButton1( this, SVX_RES( 1 ) )
+ , aHelpButton1( this, SVX_RES( 1 ) )
+{
+ FreeResource();
+
+ aFLSepLeft.SetStyle(aFLSepLeft.GetStyle()|WB_VERT);
+ aFLSepRight.SetStyle(aFLSepRight.GetStyle()|WB_VERT);
+
+ Link aLink( STATIC_LINK( this, SfxInsertFloatingFrameDialog, CheckHdl ) );
+ aCBMarginWidthDefault.SetClickHdl( aLink );
+ aCBMarginHeightDefault.SetClickHdl( aLink );
+
+ aCBMarginWidthDefault.Check();
+ aCBMarginHeightDefault.Check();
+ aRBScrollingAuto.Check();
+ aRBFrameBorderOn.Check();
+
+ aBTOpen.SetClickHdl( STATIC_LINK( this, SfxInsertFloatingFrameDialog, OpenHdl ) );
+}
+
+SfxInsertFloatingFrameDialog::SfxInsertFloatingFrameDialog( Window *pParent, const uno::Reference < embed::XEmbeddedObject >& xObj )
+ : InsertObjectDialog_Impl( pParent, SVX_RES( MD_INSERT_OBJECT_IFRAME ), uno::Reference < embed::XStorage >() )
+ , aFTName ( this, SVX_RES( FT_FRAMENAME ) )
+ , aEDName ( this, SVX_RES( ED_FRAMENAME ) )
+ , aFTURL ( this, SVX_RES( FT_URL ) )
+ , aEDURL ( this, SVX_RES( ED_URL ) )
+ , aBTOpen ( this, SVX_RES(BT_FILEOPEN ) )
+ , aRBScrollingOn ( this, SVX_RES( RB_SCROLLINGON ) )
+ , aRBScrollingOff ( this, SVX_RES( RB_SCROLLINGOFF ) )
+ , aRBScrollingAuto ( this, SVX_RES( RB_SCROLLINGAUTO ) )
+ , aFLScrolling ( this, SVX_RES( GB_SCROLLING ) )
+ , aFLSepLeft( this, SVX_RES( FL_SEP_LEFT ) )
+ , aRBFrameBorderOn ( this, SVX_RES( RB_FRMBORDER_ON ) )
+ , aRBFrameBorderOff ( this, SVX_RES( RB_FRMBORDER_OFF ) )
+ , aFLFrameBorder( this, SVX_RES( GB_BORDER ) )
+ , aFLSepRight( this, SVX_RES( FL_SEP_RIGHT ) )
+ , aFTMarginWidth ( this, SVX_RES( FT_MARGINWIDTH ) )
+ , aNMMarginWidth ( this, SVX_RES( NM_MARGINWIDTH ) )
+ , aCBMarginWidthDefault( this, SVX_RES( CB_MARGINHEIGHTDEFAULT ) )
+ , aFTMarginHeight ( this, SVX_RES( FT_MARGINHEIGHT ) )
+ , aNMMarginHeight ( this, SVX_RES( NM_MARGINHEIGHT ) )
+ , aCBMarginHeightDefault( this, SVX_RES( CB_MARGINHEIGHTDEFAULT ) )
+ , aFLMargin( this, SVX_RES( GB_MARGIN ) )
+ , aOKButton1( this, SVX_RES( 1 ) )
+ , aCancelButton1( this, SVX_RES( 1 ) )
+ , aHelpButton1( this, SVX_RES( 1 ) )
+{
+ FreeResource();
+
+ m_xObj = xObj;
+
+ aFLSepLeft.SetStyle(aFLSepLeft.GetStyle()|WB_VERT);
+ aFLSepRight.SetStyle(aFLSepRight.GetStyle()|WB_VERT);
+
+ Link aLink( STATIC_LINK( this, SfxInsertFloatingFrameDialog, CheckHdl ) );
+ aCBMarginWidthDefault.SetClickHdl( aLink );
+ aCBMarginHeightDefault.SetClickHdl( aLink );
+
+ aCBMarginWidthDefault.Check();
+ aCBMarginHeightDefault.Check();
+ aRBScrollingAuto.Check();
+ aRBFrameBorderOn.Check();
+
+ aBTOpen.SetClickHdl( STATIC_LINK( this, SfxInsertFloatingFrameDialog, OpenHdl ) );
+}
+
+short SfxInsertFloatingFrameDialog::Execute()
+{
+ short nRet = RET_OK;
+ BOOL bOK = FALSE;
+ uno::Reference < beans::XPropertySet > xSet;
+ if ( m_xObj.is() )
+ {
+ try
+ {
+ if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED )
+ m_xObj->changeState( embed::EmbedStates::RUNNING );
+ xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY );
+ ::rtl::OUString aStr;
+ uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameURL") );
+ if ( aAny >>= aStr )
+ aEDURL.SetText( aStr );
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameName") );
+ if ( aAny >>= aStr )
+ aEDName.SetText( aStr );
+
+ sal_Int32 nSize = SIZE_NOT_SET;
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginWidth") );
+ aAny >>= nSize;
+
+ if ( nSize == SIZE_NOT_SET )
+ {
+ aCBMarginWidthDefault.Check( TRUE );
+ aNMMarginWidth.SetText( String::CreateFromInt32( DEFAULT_MARGIN_WIDTH ) );
+ aFTMarginWidth.Enable( FALSE );
+ aNMMarginWidth.Enable( FALSE );
+ }
+ else
+ aNMMarginWidth.SetText( String::CreateFromInt32( nSize ) );
+
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginHeight") );
+ aAny >>= nSize;
+
+ if ( nSize == SIZE_NOT_SET )
+ {
+ aCBMarginHeightDefault.Check( TRUE );
+ aNMMarginHeight.SetText( String::CreateFromInt32( DEFAULT_MARGIN_HEIGHT ) );
+ aFTMarginHeight.Enable( FALSE );
+ aNMMarginHeight.Enable( FALSE );
+ }
+ else
+ aNMMarginHeight.SetText( String::CreateFromInt32( nSize ) );
+
+ BOOL bScrollOn = FALSE;
+ BOOL bScrollOff = FALSE;
+ BOOL bScrollAuto = FALSE;
+
+ sal_Bool bSet = sal_False;
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoScroll") );
+ aAny >>= bSet;
+ if ( !bSet )
+ {
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsScrollingMode") );
+ aAny >>= bSet;
+ bScrollOn = bSet;
+ bScrollOff = !bSet;
+ }
+ else
+ bScrollAuto = TRUE;
+
+ aRBScrollingOn.Check( bScrollOn );
+ aRBScrollingOff.Check( bScrollOff );
+ aRBScrollingAuto.Check( bScrollAuto );
+
+ bSet = sal_False;
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoBorder") );
+ aAny >>= bSet;
+ if ( !bSet )
+ {
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsBorder") );
+ aAny >>= bSet;
+ aRBFrameBorderOn.Check( bSet );
+ aRBFrameBorderOff.Check( !bSet );
+ }
+
+ SetUpdateMode( TRUE );
+ bOK = TRUE;
+ }
+ catch ( uno::Exception& )
+ {
+ DBG_ERROR( "No IFrame!" );
+ }
+ }
+ else
+ {
+ DBG_ASSERT( m_xStorage.is(), "No storage!");
+ bOK = m_xStorage.is();
+ }
+
+ if ( bOK && ( nRet = Dialog::Execute() ) == RET_OK )
+ {
+ ::rtl::OUString aURL;
+ if ( aEDURL.GetText().Len() )
+ {
+ // URL can be a valid and absolute URL or a system file name
+ INetURLObject aObj;
+ aObj.SetSmartProtocol( INET_PROT_FILE );
+ if ( aObj.SetSmartURL( aEDURL.GetText() ) )
+ aURL = aObj.GetMainURL( INetURLObject::NO_DECODE );
+ }
+
+ if ( !m_xObj.is() && aURL.getLength() )
+ {
+ // create the object
+ ::rtl::OUString aName;
+ SvGlobalName aClassId( SO3_IFRAME_CLASSID );
+ m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName );
+ if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED )
+ m_xObj->changeState( embed::EmbedStates::RUNNING );
+ xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY );
+ }
+
+ if ( m_xObj.is() )
+ {
+ try
+ {
+ BOOL bIPActive = m_xObj->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE;
+ if ( bIPActive )
+ m_xObj->changeState( embed::EmbedStates::RUNNING );
+
+ ::rtl::OUString aName = aEDName.GetText();
+ ScrollingMode eScroll = ScrollingNo;
+ if ( aRBScrollingOn.IsChecked() )
+ eScroll = ScrollingYes;
+ if ( aRBScrollingOff.IsChecked() )
+ eScroll = ScrollingNo;
+ if ( aRBScrollingAuto.IsChecked() )
+ eScroll = ScrollingAuto;
+
+ sal_Bool bHasBorder = aRBFrameBorderOn.IsChecked();
+
+ long lMarginWidth;
+ if ( !aCBMarginWidthDefault.IsChecked() )
+ lMarginWidth = (long) aNMMarginWidth.GetText().ToInt32();
+ else
+ lMarginWidth = SIZE_NOT_SET;
+
+ long lMarginHeight;
+ if ( !aCBMarginHeightDefault.IsChecked() )
+ lMarginHeight = (long) aNMMarginHeight.GetText().ToInt32();
+ else
+ lMarginHeight = SIZE_NOT_SET;
+
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameURL"), makeAny( aURL ) );
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameName"), makeAny( aName ) );
+
+ if ( eScroll == ScrollingAuto )
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoScroll"),
+ makeAny( sal_True ) );
+ else
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsScrollingMode"),
+ makeAny( (sal_Bool) ( eScroll == ScrollingYes) ) );
+
+ //if ( aFrmDescr.IsFrameBorderSet() )
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsBorder"),
+ makeAny( bHasBorder ) );
+ /*else
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoBorder"),
+ makeAny( sal_True ) );*/
+
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginWidth"),
+ makeAny( sal_Int32( lMarginWidth ) ) );
+
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginHeight"),
+ makeAny( sal_Int32( lMarginHeight ) ) );
+
+ if ( bIPActive )
+ m_xObj->changeState( embed::EmbedStates::INPLACE_ACTIVE );
+ }
+ catch ( uno::Exception& )
+ {
+ DBG_ERROR( "No IFrame!" );
+ }
+ }
+ }
+
+ return nRet;
+}
+
+//------------------------------------------------------------------------------
+
+IMPL_STATIC_LINK( SfxInsertFloatingFrameDialog, CheckHdl, CheckBox*, pCB )
+{
+ if ( pCB == &pThis->aCBMarginWidthDefault )
+ {
+ if ( pCB->IsChecked() )
+ pThis->aNMMarginWidth.SetText( String::CreateFromInt32( DEFAULT_MARGIN_WIDTH ) );
+ pThis->aFTMarginWidth.Enable( !pCB->IsChecked() );
+ pThis->aNMMarginWidth.Enable( !pCB->IsChecked() );
+ }
+
+ if ( pCB == &pThis->aCBMarginHeightDefault )
+ {
+ if ( pCB->IsChecked() )
+ pThis->aNMMarginHeight.SetText( String::CreateFromInt32( DEFAULT_MARGIN_HEIGHT ) );
+ pThis->aFTMarginHeight.Enable( !pCB->IsChecked() );
+ pThis->aNMMarginHeight.Enable( !pCB->IsChecked() );
+ }
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
+
+IMPL_STATIC_LINK( SfxInsertFloatingFrameDialog, OpenHdl, PushButton*, EMPTYARG )
+{
+ Window* pOldParent = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( pThis );
+
+ // create the file dialog
+ sfx2::FileDialogHelper aFileDlg( WB_OPEN | SFXWB_PASSWORD, String() );
+
+ // set the title
+ aFileDlg.SetTitle( OUString( String( SVX_RES( MD_INSERT_OBJECT_IFRAME ) ) ) );
+
+ // show the dialog
+ if ( aFileDlg.Execute() == ERRCODE_NONE )
+ pThis->aEDURL.SetText(
+ INetURLObject( aFileDlg.GetPath() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ) );
+
+ Application::SetDefDialogParent( pOldParent );
+ return 0L;
+}
+
diff --git a/cui/source/dialogs/insrc.cxx b/cui/source/dialogs/insrc.cxx
new file mode 100644
index 000000000000..b28f005d56f7
--- /dev/null
+++ b/cui/source/dialogs/insrc.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: insrc.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <svx/dialmgr.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include "insrc.hxx"
+#include "insrc.hrc"
+
+bool SvxInsRowColDlg::isInsertBefore() const
+{
+ return !aAfterBtn.IsChecked();
+}
+
+sal_uInt16 SvxInsRowColDlg::getInsertCount() const
+{
+ return static_cast< sal_uInt16 >( aCountEdit.GetValue() );
+}
+
+SvxInsRowColDlg::SvxInsRowColDlg(Window* pParent, bool bCol, ULONG nHelpId )
+ : ModalDialog( pParent, SVX_RES(DLG_INS_ROW_COL) ),
+ aCount( this, SVX_RES( FT_COUNT ) ),
+ aCountEdit( this, SVX_RES( ED_COUNT ) ),
+ aInsFL( this, SVX_RES( FL_INS ) ),
+ aBeforeBtn( this, SVX_RES( CB_POS_BEFORE ) ),
+ aAfterBtn( this, SVX_RES( CB_POS_AFTER ) ),
+ aPosFL( this, SVX_RES( FL_POS ) ),
+ aRow(SVX_RES(STR_ROW)),
+ aCol(SVX_RES(STR_COL)),
+ aOKBtn( this, SVX_RES( BT_OK ) ),
+ aCancelBtn( this, SVX_RES( BT_CANCEL ) ),
+ aHelpBtn( this, SVX_RES( BT_HELP ) ),
+ bColumn( bCol )
+{
+ FreeResource();
+ String aTmp( GetText() );
+ if( bColumn )
+ {
+ aTmp += aCol;
+ }
+ else
+ {
+ aTmp += aRow;
+ }
+ SetText( aTmp );
+ SetHelpId( nHelpId );
+}
+
+short SvxInsRowColDlg::Execute(void)
+{
+ return ModalDialog::Execute();
+}
+
+
+
diff --git a/cui/source/dialogs/insrc.hrc b/cui/source/dialogs/insrc.hrc
new file mode 100644
index 000000000000..e07c7cb2f1d5
--- /dev/null
+++ b/cui/source/dialogs/insrc.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: insrc.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define FT_COUNT 1
+#define ED_COUNT 2
+#define FL_INS 3
+
+#define CB_POS_BEFORE 10
+#define CB_POS_AFTER 11
+#define FL_POS 12
+
+#define STR_ROW 20
+#define STR_COL 21
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_HELP 102
diff --git a/cui/source/dialogs/insrc.src b/cui/source/dialogs/insrc.src
new file mode 100644
index 000000000000..6023e94604ef
--- /dev/null
+++ b/cui/source/dialogs/insrc.src
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: insrc.src,v $
+ * $Revision: 1.32 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include <svx/dialogs.hrc>
+#include "insrc.hrc"
+
+ModalDialog DLG_INS_ROW_COL
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 136 , 84 ) ;
+ Text [ en-US ] = "Insert" ;
+ Moveable = TRUE ;
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 80 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 80 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 80 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ RadioButton CB_POS_BEFORE
+ {
+ Pos = MAP_APPFONT ( 12 , 49 ) ;
+ Size = MAP_APPFONT ( 56 , 10 ) ;
+ Text [ en-US ] = "~Before" ;
+ TabStop = TRUE ;
+ };
+ RadioButton CB_POS_AFTER
+ {
+ Pos = MAP_APPFONT ( 12 , 62 ) ;
+ Size = MAP_APPFONT ( 56 , 10 ) ;
+ Text [ en-US ] = "A~fter" ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ };
+ NumericField ED_COUNT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 44 , 14 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 5 ;
+ };
+ FixedLine FL_INS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 68 , 8 ) ;
+ Text [ en-US ] = "Insert" ;
+ };
+ FixedLine FL_POS
+ {
+ Pos = MAP_APPFONT ( 6 , 38 ) ;
+ Size = MAP_APPFONT ( 68 , 8 ) ;
+ Text [ en-US ] = "Position";
+ };
+ FixedText FT_COUNT
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "~Number" ;
+ Left = TRUE ;
+ };
+ String STR_ROW
+ {
+ Text [ en-US ] = " Rows" ;
+ };
+ String STR_COL
+ {
+ Text [ en-US ] = " Columns" ;
+ };
+};
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
new file mode 100644
index 000000000000..4ecf63e302eb
--- /dev/null
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -0,0 +1,718 @@
+/*************************************************************************
+ *
+ * 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: linkdlg.cxx,v $
+ * $Revision: 1.14 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <linkdlg.hxx>
+#include <vcl/svapp.hxx>
+#include "helpid.hrc"
+
+#include <tools/urlobj.hxx>
+#include <svtools/svmedit.hxx>
+#include <svtools/filedlg.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/timer.hxx>
+#include <svtools/svtabbx.hxx>
+
+#include <svuidlg.hrc>
+#include <sfx2/linkmgr.hxx>
+#include <sfx2/linksrc.hxx>
+#include <svtools/soerr.hxx>
+#include <sfx2/lnkbase.hxx>
+#include <sfx2/objsh.hxx>
+
+#include <svx/dialmgr.hxx>
+
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+
+#define MAX_FILENAME 18
+#define MAX_LINKNAME 18
+#define MAX_TYPENAME 15
+#define MAX_UPDATENAME 10
+
+#define FILEOBJECT ( OBJECT_CLIENT_FILE & ~OBJECT_CLIENT_SO )
+
+using namespace sfx2;
+
+SV_DECL_IMPL_REF_LIST(SvBaseLink,SvBaseLink*)
+
+// Achtung im Code wird dieses Array direkt (0, 1, ...) indiziert
+static long nTabs[] =
+ { 4, // Number of Tabs
+ 0, 77, 144, 209
+ };
+
+
+SvBaseLinksDlg::SvBaseLinksDlg( Window * pParent, SvLinkManager* pMgr, BOOL bHtml )
+ : ModalDialog( pParent, SVX_RES( MD_UPDATE_BASELINKS ) ),
+ aFtFiles( this, SVX_RES( FT_FILES ) ),
+ aFtLinks( this, SVX_RES( FT_LINKS ) ),
+ aFtType( this, SVX_RES( FT_TYPE ) ),
+ aFtStatus( this, SVX_RES( FT_STATUS ) ),
+ aCancelButton1( this, SVX_RES( 1 ) ),
+ aHelpButton1( this, SVX_RES( 1 ) ),
+ aPbUpdateNow( this, SVX_RES( PB_UPDATE_NOW ) ),
+ aPbOpenSource( this, SVX_RES( PB_OPEN_SOURCE ) ),
+ aPbChangeSource( this, SVX_RES( PB_CHANGE_SOURCE ) ),
+ aPbBreakLink( this, SVX_RES( PB_BREAK_LINK ) ),
+ aFtFiles2( this, SVX_RES( FT_FILES2 ) ),
+ aFtSource2( this, SVX_RES( FT_SOURCE2 ) ),
+ aFtType2( this, SVX_RES( FT_TYPE2 ) ),
+ aFtUpdate( this, SVX_RES( FT_UPDATE ) ),
+ aRbAutomatic( this, SVX_RES( RB_AUTOMATIC ) ),
+ aRbManual( this, SVX_RES( RB_MANUAL ) ),
+ aFtFullFileName( this, SVX_RES( FT_FULL_FILE_NAME ) ),
+ aFtFullSourceName( this, SVX_RES( FT_FULL_SOURCE_NAME ) ),
+ aFtFullTypeName( this, SVX_RES( FT_FULL_TYPE_NAME ) ),
+ aStrAutolink( SVX_RES( STR_AUTOLINK ) ),
+ aStrManuallink( SVX_RES( STR_MANUALLINK ) ),
+ aStrBrokenlink( SVX_RES( STR_BROKENLINK ) ),
+ aStrGraphiclink( SVX_RES( STR_GRAPHICLINK ) ),
+ aStrButtonclose( SVX_RES( STR_BUTTONCLOSE ) ),
+ aStrCloselinkmsg( SVX_RES( STR_CLOSELINKMSG ) ),
+ aStrCloselinkmsgMulti( SVX_RES( STR_CLOSELINKMSG_MULTI ) ),
+ aStrWaitinglink( SVX_RES( STR_WAITINGLINK ) ),
+ pLinkMgr( NULL ),
+ bHtmlMode(bHtml),
+ aTbLinks( this, SVX_RES(TB_LINKS ) )
+{
+ FreeResource();
+
+ aTbLinks.SetHelpId(HID_LINKDLG_TABLB);
+ aTbLinks.SetSelectionMode( MULTIPLE_SELECTION );
+ aTbLinks.SetTabs( &nTabs[0], MAP_APPFONT );
+ aTbLinks.Resize(); // OS: Hack fuer richtige Selektion
+
+ //JP 24.02.99: UpdateTimer fuer DDE-/Grf-Links, auf die gewarted wird
+ aUpdateTimer.SetTimeoutHdl( LINK( this, SvBaseLinksDlg, UpdateWaitingHdl ) );
+ aUpdateTimer.SetTimeout( 1000 );
+
+ OpenSource().Hide();
+
+ Links().SetSelectHdl( LINK( this, SvBaseLinksDlg, LinksSelectHdl ) );
+ Links().SetDoubleClickHdl( LINK( this, SvBaseLinksDlg, LinksDoubleClickHdl ) );
+ Automatic().SetClickHdl( LINK( this, SvBaseLinksDlg, AutomaticClickHdl ) );
+ Manual().SetClickHdl( LINK( this, SvBaseLinksDlg, ManualClickHdl ) );
+ UpdateNow().SetClickHdl( LINK( this, SvBaseLinksDlg, UpdateNowClickHdl ) );
+// OpenSource().SetClickHdl( LINK( this, SvBaseLinksDlg, OpenSourceClickHdl ) );
+ ChangeSource().SetClickHdl( LINK( this, SvBaseLinksDlg, ChangeSourceClickHdl ) );
+ if(!bHtmlMode)
+ BreakLink().SetClickHdl( LINK( this, SvBaseLinksDlg, BreakLinkClickHdl ) );
+ else
+ BreakLink().Hide();
+
+ SetManager( pMgr );
+}
+
+SvBaseLinksDlg::~SvBaseLinksDlg()
+{
+}
+
+/*************************************************************************
+|* SvBaseLinksDlg::Handler()
+|*
+|* Beschreibung
+|* Ersterstellung MM 14.06.94
+|* Letzte Aenderung JP 30.05.95
+*************************************************************************/
+IMPL_LINK( SvBaseLinksDlg, LinksSelectHdl, SvTabListBox *, pSvTabListBox )
+{
+ USHORT nSelectionCount = pSvTabListBox ?
+ (USHORT)pSvTabListBox->GetSelectionCount() : 0;
+ if(nSelectionCount > 1)
+ {
+ //bei Mehrfachselektion ggf. alte Eintraege deselektieren
+ SvLBoxEntry* pEntry = 0;
+ SvBaseLink* pLink = 0;
+ pEntry = pSvTabListBox->GetHdlEntry();
+ pLink = (SvBaseLink*)pEntry->GetUserData();
+ USHORT nObjectType = pLink->GetObjType();
+ if((OBJECT_CLIENT_FILE & nObjectType) != OBJECT_CLIENT_FILE)
+ {
+ pSvTabListBox->SelectAll(FALSE);
+ pSvTabListBox->Select(pEntry);
+ nSelectionCount = 1;
+ }
+ else
+ {
+ for( USHORT i = 0; i < nSelectionCount; i++)
+ {
+ pEntry = i == 0 ? pSvTabListBox->FirstSelected() :
+ pSvTabListBox->NextSelected(pEntry);
+ DBG_ASSERT(pEntry, "Wo ist der Entry?");
+ pLink = (SvBaseLink*)pEntry->GetUserData();
+ DBG_ASSERT(pLink, "Wo ist der Link?");
+ if( (OBJECT_CLIENT_FILE & pLink->GetObjType()) != OBJECT_CLIENT_FILE )
+ pSvTabListBox->Select( pEntry, FALSE );
+
+ }
+ }
+
+ UpdateNow().Enable();
+
+ Automatic().Disable();
+ Manual().Check();
+ Manual().Disable();
+ }
+ else
+ {
+ USHORT nPos;
+ SvBaseLink* pLink = GetSelEntry( &nPos );
+ if( !pLink )
+ return 0;
+
+ UpdateNow().Enable();
+
+ String sType, sLink;
+ String *pLinkNm = &sLink, *pFilter = 0;
+
+ if( FILEOBJECT & pLink->GetObjType() )
+ {
+ Automatic().Disable();
+ Manual().Check();
+ Manual().Disable();
+ if( OBJECT_CLIENT_GRF == pLink->GetObjType() )
+ pLinkNm = 0, pFilter = &sLink;
+ }
+ else
+ {
+ Automatic().Enable();
+ Manual().Enable();
+
+ if( LINKUPDATE_ALWAYS == pLink->GetUpdateMode() )
+ Automatic().Check();
+ else
+ Manual().Check();
+ }
+
+ String aFileName;
+ pLinkMgr->GetDisplayNames( pLink, &sType, &aFileName, pLinkNm, pFilter );
+
+ FileName().SetText( aFileName );
+ SourceName().SetText( sLink );
+ TypeName().SetText( sType );
+ }
+ return 0;
+}
+
+IMPL_LINK_INLINE_START( SvBaseLinksDlg, LinksDoubleClickHdl, SvTabListBox *, pSvTabListBox )
+{
+ (void)pSvTabListBox;
+
+ ChangeSourceClickHdl( 0 );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvBaseLinksDlg, LinksDoubleClickHdl, SvTabListBox *, pSvTabListBox )
+
+IMPL_LINK_INLINE_START( SvBaseLinksDlg, AutomaticClickHdl, RadioButton *, pRadioButton )
+{
+ (void)pRadioButton;
+
+ USHORT nPos;
+ SvBaseLink* pLink = GetSelEntry( &nPos );
+ if( pLink && !( FILEOBJECT & pLink->GetObjType() ) &&
+ LINKUPDATE_ALWAYS != pLink->GetUpdateMode() )
+ SetType( *pLink, nPos, LINKUPDATE_ALWAYS );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvBaseLinksDlg, AutomaticClickHdl, RadioButton *, pRadioButton )
+
+IMPL_LINK_INLINE_START( SvBaseLinksDlg, ManualClickHdl, RadioButton *, pRadioButton )
+{
+ (void)pRadioButton;
+
+ USHORT nPos;
+ SvBaseLink* pLink = GetSelEntry( &nPos );
+ if( pLink && !( FILEOBJECT & pLink->GetObjType() ) &&
+ LINKUPDATE_ONCALL != pLink->GetUpdateMode())
+ SetType( *pLink, nPos, LINKUPDATE_ONCALL );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvBaseLinksDlg, ManualClickHdl, RadioButton *, pRadioButton )
+
+IMPL_LINK( SvBaseLinksDlg, UpdateNowClickHdl, PushButton *, EMPTYARG )
+{
+ SvTabListBox& rListBox = Links();
+ USHORT nSelCnt = (USHORT)rListBox.GetSelectionCount();
+ if( 255 < nSelCnt )
+ nSelCnt = 255;
+
+ std::vector< SvBaseLink* > aLnkArr;
+ std::vector< USHORT > aPosArr;
+
+ SvLBoxEntry* pE = rListBox.FirstSelected();
+ while( pE )
+ {
+ USHORT nFndPos = (USHORT)rListBox.GetModel()->GetAbsPos( pE );
+ if( LISTBOX_ENTRY_NOTFOUND != nFndPos )
+ {
+ aLnkArr.push_back( static_cast< SvBaseLink* >( pE->GetUserData() ) );
+ aPosArr.push_back( nFndPos );
+ }
+ pE = rListBox.NextSelected( pE );
+ }
+
+ if( !aLnkArr.empty() )
+ {
+ for( USHORT n = 0; n < aLnkArr.size(); ++n )
+ {
+ SvBaseLinkRef xLink = aLnkArr[ n ];
+
+ // suche erstmal im Array nach dem Eintrag
+ for( USHORT i = 0; i < pLinkMgr->GetLinks().Count(); ++i )
+ if( &xLink == *pLinkMgr->GetLinks()[ i ] )
+ {
+ xLink->SetUseCache( FALSE );
+ SetType( *xLink, aPosArr[ n ], xLink->GetUpdateMode() );
+ xLink->SetUseCache( TRUE );
+ break;
+ }
+ }
+
+ // falls jemand der Meinung ist, seine Links auszutauschen (SD)
+ SvLinkManager* pNewMgr = pLinkMgr;
+ pLinkMgr = 0;
+ SetManager( pNewMgr );
+
+
+ if( 0 == (pE = rListBox.GetEntry( aPosArr[ 0 ] )) ||
+ pE->GetUserData() != aLnkArr[ 0 ] )
+ {
+ // suche mal den Link
+ pE = rListBox.First();
+ while( pE )
+ {
+ if( pE->GetUserData() == aLnkArr[ 0 ] )
+ break;
+ pE = rListBox.Next( pE );
+ }
+
+ if( !pE )
+ pE = rListBox.FirstSelected();
+ }
+
+ if( pE )
+ {
+ SvLBoxEntry* pSelEntry = rListBox.FirstSelected();
+ if( pE != pSelEntry )
+ rListBox.Select( pSelEntry, FALSE );
+ rListBox.Select( pE );
+ rListBox.MakeVisible( pE );
+ }
+ }
+ return 0;
+}
+
+/*
+IMPL_LINK_INLINE_START( SvBaseLinksDlg, OpenSourceClickHdl, PushButton *, pPushButton )
+{
+ DBG_ASSERT( !this, "Open noch nicht impl." );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvBaseLinksDlg, OpenSourceClickHdl, PushButton *, pPushButton )
+*/
+
+IMPL_LINK( SvBaseLinksDlg, ChangeSourceClickHdl, PushButton *, pPushButton )
+{
+ (void)pPushButton;
+
+ USHORT nSelectionCount = (USHORT)Links().GetSelectionCount();
+ if(nSelectionCount > 1)
+ {
+ PathDialog aPathDlg( this );
+ String sType, sFile, sLinkName;
+ String sFilter;
+ SvLBoxEntry* pEntry = Links().FirstSelected();
+ SvBaseLink* pLink = (SvBaseLink*)pEntry->GetUserData();
+ pLinkMgr->GetDisplayNames( pLink, &sType, &sFile, 0, 0 );
+ INetURLObject aUrl(sFile);
+ if(aUrl.GetProtocol() == INET_PROT_FILE)
+ {
+ rtl::OUString sOldPath(aUrl.PathToFileName());
+ sal_Int32 nLen = aUrl.GetName().getLength();
+ sOldPath = sOldPath.copy(0, sOldPath.getLength() - nLen);
+ aPathDlg.SetPath(sOldPath);
+ }
+ if(aPathDlg.Execute() == RET_OK)
+ {
+ String aPath = aPathDlg.GetPath();
+
+ for( USHORT i = 0; i < nSelectionCount; i++)
+ {
+ pEntry = i==0 ?
+ Links().FirstSelected() :
+ Links().NextSelected( pEntry );
+ DBG_ASSERT(pEntry,"Wo ist der Entry");
+ pLink = (SvBaseLink*)pEntry->GetUserData();
+ DBG_ASSERT(pLink,"Wo ist der Link");
+ pLinkMgr->GetDisplayNames( pLink, &sType, &sFile, &sLinkName, &sFilter );
+ INetURLObject aUrl_(sFile);
+ INetURLObject aUrl2(aPath, INET_PROT_FILE);
+ aUrl2.insertName( aUrl_.getName() );
+ String sNewLinkName;
+ MakeLnkName( sNewLinkName, 0 ,
+ aUrl2.GetMainURL(INetURLObject::DECODE_TO_IURI), sLinkName, &sFilter);
+ pLink->SetLinkSourceName( sNewLinkName );
+ pLink->Update();
+ }
+ if( pLinkMgr->GetPersist() )
+ pLinkMgr->GetPersist()->SetModified();
+ SvLinkManager* pNewMgr = pLinkMgr;
+ pLinkMgr = 0;
+ SetManager( pNewMgr );
+ }
+ }
+ else
+ {
+ USHORT nPos;
+ SvBaseLink* pLink = GetSelEntry( &nPos );
+ if ( pLink && (pLink->GetLinkSourceName().Len() != 0) )
+ pLink->Edit( this, LINK( this, SvBaseLinksDlg, EndEditHdl ) );
+ }
+ return 0;
+}
+
+IMPL_LINK( SvBaseLinksDlg, BreakLinkClickHdl, PushButton *, pPushButton )
+{
+ (void)pPushButton;
+
+ BOOL bModified = FALSE;
+ if(Links().GetSelectionCount() <= 1)
+ {
+ USHORT nPos;
+ SvBaseLinkRef xLink = GetSelEntry( &nPos );
+ if( !xLink.Is() )
+ return 0;
+
+ QueryBox aBox( this, WB_YES_NO | WB_DEF_YES, Closelinkmsg() );
+
+ if( RET_YES == aBox.Execute() )
+ {
+ Links().GetModel()->Remove( Links().GetEntry( nPos ) );
+
+ // falls Object noch vorhanden, dann das schliessen
+ BOOL bNewLnkMgr = OBJECT_CLIENT_FILE == xLink->GetObjType();
+
+ // dem Link sagen, das er aufgeloest wird!
+ xLink->Closed();
+
+ // falls einer vergessen hat sich auszutragen
+ if( xLink.Is() )
+ pLinkMgr->Remove( &xLink );
+
+ if( bNewLnkMgr )
+ {
+ SvLinkManager* pNewMgr = pLinkMgr;
+ pLinkMgr = 0;
+ SetManager( pNewMgr );
+
+ SvLBoxEntry* pEntry = Links().GetEntry( nPos ? --nPos : 0 );
+ if( pEntry )
+ Links().SetCurEntry( pEntry );
+ }
+ bModified = TRUE;
+ }
+ }
+ else
+ {
+ QueryBox aBox( this, WB_YES_NO | WB_DEF_YES, CloselinkmsgMulti() );
+
+ if( RET_YES == aBox.Execute() )
+ {
+
+ SvBaseLinkMemberList aLinkList;
+ SvLBoxEntry* pEntry = Links().FirstSelected();
+ while ( pEntry )
+ {
+ void * pUD = pEntry->GetUserData();
+ if( pUD )
+ aLinkList.Append( (SvBaseLink*)pUD );
+ pEntry = Links().NextSelected(pEntry);
+ }
+ Links().RemoveSelection();
+ for( ULONG i = 0; i < aLinkList.Count(); i++ )
+ {
+ SvBaseLinkRef xLink = aLinkList.GetObject( i );
+ // dem Link sagen, das er aufgeloest wird!
+ xLink->Closed();
+
+ // falls einer vergessen hat sich auszutragen
+ pLinkMgr->Remove( &xLink );
+ bModified = TRUE;
+ }
+ //Danach alle selektierten Eintraege entfernen
+ }
+ }
+ if(bModified)
+ {
+ if( !Links().GetEntryCount() )
+ {
+ // Der letzte macht das Licht aus
+ Automatic().Disable();
+ Manual().Disable();
+ UpdateNow().Disable();
+// OpenSource().Disable();
+ ChangeSource().Disable();
+ BreakLink().Disable();
+
+ String aEmpty;
+ SourceName().SetText( aEmpty );
+ TypeName().SetText( aEmpty );
+ }
+ if( pLinkMgr->GetPersist() )
+ pLinkMgr->GetPersist()->SetModified();
+ }
+ return 0;
+}
+
+IMPL_LINK( SvBaseLinksDlg, UpdateWaitingHdl, Timer*, pTimer )
+{
+ (void)pTimer;
+// for( SvLBoxEntry* pBox = Links().First(); pBox;
+// pBox = Links().Next( pBox ))
+
+ Links().SetUpdateMode(FALSE);
+ for( ULONG nPos = Links().GetEntryCount(); nPos; )
+ {
+ SvLBoxEntry* pBox = Links().GetEntry( --nPos );
+ SvBaseLinkRef xLink( (SvBaseLink*)pBox->GetUserData() );
+ if( xLink.Is() )
+ {
+ String sCur( ImplGetStateStr( *xLink ) ),
+ sOld( Links().GetEntryText( pBox, 3 ) );
+ if( sCur != sOld )
+ Links().SetEntryText( sCur, pBox, 3 );
+ }
+ }
+ Links().SetUpdateMode(TRUE);
+ return 0;
+}
+
+IMPL_LINK( SvBaseLinksDlg, EndEditHdl, sfx2::SvBaseLink*, _pLink )
+{
+ USHORT nPos;
+ SvBaseLink* pLink = GetSelEntry( &nPos );
+
+ if ( pLink != _pLink && _pLink && _pLink->WasLastEditOK() )
+ {
+ // JP 09.01.98:
+ // StarImpress/Draw tauschen die LinkObjecte selbst aus!
+ // also suche den Link im Manager, wenn der nicht mehr existiert,
+ // dann setze fuelle die Liste komplett neu. Ansonsten braucht
+ // nur der editierte Linkt aktualisiert werden.
+ BOOL bLinkFnd = FALSE;
+ for( USHORT n = pLinkMgr->GetLinks().Count(); n; )
+ if( _pLink == &(*pLinkMgr->GetLinks()[ --n ]) )
+ {
+ bLinkFnd = TRUE;
+ break;
+ }
+
+ if( bLinkFnd )
+ {
+ Links().SetUpdateMode(FALSE);
+ Links().GetModel()->Remove( Links().GetEntry( nPos ) );
+ SvLBoxEntry* pToUnselect = Links().FirstSelected();
+ InsertEntry( *_pLink, nPos, sal_True );
+ if(pToUnselect)
+ Links().Select(pToUnselect, FALSE);
+ Links().SetUpdateMode(TRUE);
+ }
+ else
+ {
+ SvLinkManager* pNewMgr = pLinkMgr;
+ pLinkMgr = 0;
+ SetManager( pNewMgr );
+ }
+ if( pLinkMgr->GetPersist() )
+ pLinkMgr->GetPersist()->SetModified();
+ }
+ else if ( pLink == _pLink )
+ {
+ DBG_ERRORFILE( "SvBaseLinksDlg::EndEditHdl(): wrong link" );
+ }
+ return 0;
+}
+
+String SvBaseLinksDlg::ImplGetStateStr( const SvBaseLink& rLnk )
+{
+ String sRet;
+ if( !rLnk.GetObj() )
+ sRet = Brokenlink();
+ else if( rLnk.GetObj()->IsPending() )
+ {
+ sRet = Waitinglink();
+ StartUpdateTimer();
+ }
+ else if( LINKUPDATE_ALWAYS == rLnk.GetUpdateMode() )
+ sRet = Autolink();
+ else
+ sRet = Manuallink();
+
+ return sRet;
+}
+
+void SvBaseLinksDlg::SetManager( SvLinkManager* pNewMgr )
+{
+ if( pLinkMgr == pNewMgr )
+ return;
+
+ if( pNewMgr )
+ // Update muss vor Clear gestoppt werden
+ Links().SetUpdateMode( FALSE );
+
+ Links().Clear();
+ pLinkMgr = pNewMgr;
+
+ if( pLinkMgr )
+ {
+ SvBaseLinks& rLnks = (SvBaseLinks&)pLinkMgr->GetLinks();
+ for( USHORT n = 0; n < rLnks.Count(); ++n )
+ {
+ SvBaseLinkRef* pLinkRef = rLnks[ n ];
+ if( !pLinkRef->Is() )
+ {
+ rLnks.Remove( n, 1 );
+ --n;
+ continue;
+ }
+ if( (*pLinkRef)->IsVisible() )
+ InsertEntry( **pLinkRef );
+ }
+
+ if( rLnks.Count() )
+ {
+ SvLBoxEntry* pEntry = Links().GetEntry( 0 );
+ Links().SetCurEntry( pEntry );
+ Links().Select( pEntry );
+ LinksSelectHdl( 0 );
+ }
+ Links().SetUpdateMode( TRUE );
+ Links().Invalidate();
+ }
+}
+
+
+void SvBaseLinksDlg::InsertEntry( const SvBaseLink& rLink, USHORT nPos, sal_Bool bSelect )
+{
+ String aEntry, sFileNm, sLinkNm, sTypeNm, sFilter;
+
+ pLinkMgr->GetDisplayNames( (SvBaseLink*)&rLink, &sTypeNm, &sFileNm, &sLinkNm, &sFilter );
+
+ // GetTab(0) gibt die Position der von der TabListBox automatisch eingefuegten
+ // Bitmap. Die Breite der ersten Textspalte ergibt sich deshalb aus Tab(2)-Tab(1)
+ long nWidthPixel = Links().GetLogicTab( 2 ) - Links().GetLogicTab( 1 );
+ nWidthPixel -= SV_TAB_BORDER;
+ XubString aTxt = Links().GetEllipsisString( sFileNm, nWidthPixel, TEXT_DRAW_PATHELLIPSIS );
+ INetURLObject aPath( sFileNm, INET_PROT_FILE );
+ String aFileName = aPath.getName();
+ if( aFileName.Len() > aTxt.Len() )
+ aTxt = aFileName;
+ else if( aTxt.Search( aFileName, aTxt.Len() - aFileName.Len() ) == STRING_NOTFOUND )
+ // filename not in string
+ aTxt = aFileName;
+
+ aEntry = aTxt;
+ aEntry += '\t';
+ if( OBJECT_CLIENT_GRF == rLink.GetObjType() )
+ aEntry += sFilter;
+ else
+ aEntry += sLinkNm;
+ aEntry += '\t';
+ aEntry += sTypeNm;
+ aEntry += '\t';
+ aEntry += ImplGetStateStr( rLink );
+
+ SvLBoxEntry * pE = Links().InsertEntryToColumn( aEntry, nPos );
+ pE->SetUserData( (void*)&rLink );
+ if(bSelect)
+ Links().Select(pE);
+}
+
+SvBaseLink* SvBaseLinksDlg::GetSelEntry( USHORT* pPos )
+{
+ SvLBoxEntry* pE = Links().FirstSelected();
+ USHORT nPos;
+ if( pE && LISTBOX_ENTRY_NOTFOUND !=
+ ( nPos = (USHORT)Links().GetModel()->GetAbsPos( pE ) ) )
+ {
+ DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" );
+
+ if( pPos )
+ *pPos = nPos;
+ return (SvBaseLink*)pE->GetUserData();
+ }
+ return 0;
+}
+
+void SvBaseLinksDlg::SetType( SvBaseLink& rLink,
+ USHORT nSelPos,
+ USHORT nType )
+{
+ rLink.SetUpdateMode( nType );
+ rLink.Update();
+ SvLBoxEntry* pBox = Links().GetEntry( nSelPos );
+ Links().SetEntryText( ImplGetStateStr( rLink ), pBox, 3 );
+ if( pLinkMgr->GetPersist() )
+ pLinkMgr->GetPersist()->SetModified();
+}
+
+void SvBaseLinksDlg::SetActLink( SvBaseLink * pLink )
+{
+ if( pLinkMgr )
+ {
+ const SvBaseLinks& rLnks = pLinkMgr->GetLinks();
+ USHORT nSelect = 0;
+ for( USHORT n = 0; n < rLnks.Count(); ++n )
+ {
+ SvBaseLinkRef* pLinkRef = rLnks[ n ];
+ // #109573# only visible links have been inserted into the TreeListBox,
+ // invisible ones have to be skipped here
+ if( (*pLinkRef)->IsVisible() )
+ {
+ if( pLink == *pLinkRef )
+ {
+ Links().Select( Links().GetEntry( nSelect ) );
+ LinksSelectHdl( 0 );
+ return ;
+ }
+ nSelect++;
+ }
+ }
+ }
+}
+
diff --git a/cui/source/dialogs/makefile.mk b/cui/source/dialogs/makefile.mk
new file mode 100755
index 000000000000..f7d597a219a1
--- /dev/null
+++ b/cui/source/dialogs/makefile.mk
@@ -0,0 +1,118 @@
+#*************************************************************************
+#
+# 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: makefile.mk,v $
+#
+# $Revision: 1.65 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..
+PRJNAME=cui
+TARGET=dialogs
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc
+.ENDIF # ENABLE_LAYOUT == TRUE
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=dialogs
+SRC1FILES = \
+ charmap.src \
+ commonlingui.src \
+ cuiimapdlg.src \
+ dlgname.src \
+ fmsearch.src \
+ gallery.src \
+ grfflt.src \
+ hangulhanjadlg.src \
+ hlmarkwn.src \
+ hyperdlg.src \
+ iconcdlg.src \
+ insrc.src \
+ multipat.src \
+ newtabledlg.src \
+ postdlg.src \
+ scriptdlg.src \
+ sdrcelldlg.src \
+ showcols.src \
+ SpellDialog.src \
+ splitcelldlg.src \
+ srchxtra.src \
+ svuidlg.src \
+ tbxform.src \
+ zoom.src \
+
+
+SLOFILES+=\
+ $(SLO)$/commonlingui.obj \
+ $(SLO)$/cuicharmap.obj \
+ $(SLO)$/cuifmsearch.obj \
+ $(SLO)$/cuigaldlg.obj \
+ $(SLO)$/cuigrfflt.obj \
+ $(SLO)$/cuihyperdlg.obj \
+ $(SLO)$/cuiimapwnd.obj \
+ $(SLO)$/cuitbxform.obj \
+ $(SLO)$/dlgname.obj \
+ $(SLO)$/hangulhanjadlg.obj \
+ $(SLO)$/hldocntp.obj \
+ $(SLO)$/hldoctp.obj \
+ $(SLO)$/hlinettp.obj \
+ $(SLO)$/hlmailtp.obj \
+ $(SLO)$/hlmarkwn.obj \
+ $(SLO)$/hltpbase.obj \
+ $(SLO)$/iconcdlg.obj \
+ $(SLO)$/insdlg.obj \
+ $(SLO)$/insrc.obj \
+ $(SLO)$/linkdlg.obj \
+ $(SLO)$/multifil.obj \
+ $(SLO)$/multipat.obj \
+ $(SLO)$/newtabledlg.obj \
+ $(SLO)$/pastedlg.obj \
+ $(SLO)$/plfilter.obj \
+ $(SLO)$/postdlg.obj \
+ $(SLO)$/scriptdlg.obj \
+ $(SLO)$/sdrcelldlg.obj \
+ $(SLO)$/showcols.obj \
+ $(SLO)$/SpellAttrib.obj \
+ $(SLO)$/SpellDialog.obj \
+ $(SLO)$/splitcelldlg.obj \
+ $(SLO)$/srchxtra.obj \
+ $(SLO)$/zoom.obj \
+
+
+.IF "$(GUI)"=="WNT"
+SLOFILES+=$(SLO)$/winpluginlib.obj
+.ENDIF
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/cui/source/dialogs/multifil.cxx b/cui/source/dialogs/multifil.cxx
new file mode 100644
index 000000000000..a3c78f2d4738
--- /dev/null
+++ b/cui/source/dialogs/multifil.cxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * 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: multifil.cxx,v $
+ * $Revision: 1.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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/filedlghelper.hxx>
+
+#include <tools/urlobj.hxx>
+
+#include "multipat.hxx"
+#include "multifil.hxx"
+#include <svx/dialmgr.hxx>
+
+#include "multipat.hrc"
+#include <svx/dialogs.hrc>
+
+// #97807# -------------
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <ucbhelper/contentbroker.hxx>
+
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+
+// class SvxMultiFileDialog ----------------------------------------------
+
+IMPL_LINK( SvxMultiFileDialog, AddHdl_Impl, PushButton *, pBtn )
+{
+ sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
+
+ if ( IsClassPathMode() )
+ {
+ aDlg.SetTitle( SVX_RES( RID_SVXSTR_ARCHIVE_TITLE ) );
+ aDlg.AddFilter( SVX_RES( RID_SVXSTR_ARCHIVE_HEADLINE ), String::CreateFromAscii("*.jar;*.zip") );
+ }
+
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ // #97807# URL content comparison of entries -----------
+ INetURLObject aFile( aDlg.GetPath() );
+ String sInsFile = aFile.getFSysPath( INetURLObject::FSYS_DETECT );
+ ::ucbhelper::Content aContent( aFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() );
+ Reference< XContent > xContent = aContent.get();
+ OSL_ENSURE( xContent.is(), "AddHdl_Impl: invalid content interface!" );
+ Reference< XContentIdentifier > xID = xContent->getIdentifier();
+ OSL_ENSURE( xID.is(), "AddHdl_Impl: invalid ID interface!" );
+ // ensure the content of files are valid
+
+ USHORT nCount = aPathLB.GetEntryCount();
+ BOOL bDuplicated = FALSE;
+ try
+ {
+ if( nCount > 0 ) // start comparison
+ {
+ USHORT i;
+ ::ucbhelper::Content & VContent = aContent; // temporary Content reference
+ Reference< XContent > xVContent;
+ Reference< XContentIdentifier > xVID;
+ for( i = 0; i < nCount; i++ )
+ {
+ String sVFile = aPathLB.GetEntry( i );
+ std::map< String, ::ucbhelper::Content >::iterator aCur = aFileContentMap.find( sVFile );
+ if( aCur == aFileContentMap.end() ) // look for File Content in aFileContentMap, but not find it.
+ {
+ INetURLObject aVFile( sVFile, INetURLObject::FSYS_DETECT );
+ aFileContentMap[sVFile] = ::ucbhelper::Content( aVFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() );
+ VContent = aFileContentMap.find( sVFile )->second;
+ }
+ else
+ VContent = aCur->second;
+ xVContent = VContent.get();
+ OSL_ENSURE( xVContent.is(), "AddHdl_Impl: invalid content interface!" );
+ xVID = xVContent->getIdentifier();
+ OSL_ENSURE( xVID.is(), "AddHdl_Impl: invalid ID interface!" );
+ if ( xID.is() && xVID.is() )
+ {
+ // get a generic content provider
+ ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
+ Reference< XContentProvider > xProvider;
+ if ( pBroker )
+ xProvider = pBroker->getContentProviderInterface();
+ if ( xProvider.is() )
+ {
+ if ( 0 == xProvider->compareContentIds( xID, xVID ) )
+ {
+ bDuplicated = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ } // end of if the entries are more than zero.
+ } // end of try(}
+ catch( const Exception& ) // catch every exception of comparison
+ {
+ OSL_ENSURE( sal_False, "AddHdl_Impl: caught an unexpected exception!" );
+ }
+
+ if ( bDuplicated ) // #97807# --------------------
+ {
+ String sMsg( SVX_RES( RID_SVXSTR_MULTIFILE_DBL_ERR ) );
+ sMsg.SearchAndReplaceAscii( "%1", sInsFile );
+ InfoBox( pBtn, sMsg ).Execute();
+ }
+ else
+ {
+ USHORT nPos = aPathLB.InsertEntry( sInsFile, LISTBOX_APPEND );
+ aPathLB.SetEntryData( nPos, (void*) new String( sInsFile ) );
+ }
+
+ } // end of if ( aDlg.Execute() == ERRCODE_NONE )
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxMultiFileDialog, DelHdl_Impl, PushButton *, EMPTYARG )
+{
+ USHORT nPos = aPathLB.GetSelectEntryPos();
+ aPathLB.RemoveEntry( nPos );
+ USHORT nCnt = aPathLB.GetEntryCount();
+
+ if ( nCnt )
+ {
+ nCnt--;
+
+ if ( nPos > nCnt )
+ nPos = nCnt;
+ aPathLB.SelectEntryPos( nPos );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvxMultiFileDialog::SvxMultiFileDialog( Window* pParent, BOOL bEmptyAllowed ) :
+
+ SvxMultiPathDialog( pParent, bEmptyAllowed )
+
+{
+ aAddBtn.SetClickHdl( LINK( this, SvxMultiFileDialog, AddHdl_Impl ) );
+ aDelBtn.SetClickHdl( LINK( this, SvxMultiFileDialog, DelHdl_Impl ) );
+ SetText( SVX_RES( RID_SVXSTR_FILE_TITLE ) );
+ aPathFL.SetText( SVX_RES( RID_SVXSTR_FILE_HEADLINE ) );
+ aDelBtn.Enable();
+}
+
+// -----------------------------------------------------------------------
+
+SvxMultiFileDialog::~SvxMultiFileDialog()
+{
+}
+
+
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
new file mode 100644
index 000000000000..a28f256040d6
--- /dev/null
+++ b/cui/source/dialogs/multipat.cxx
@@ -0,0 +1,363 @@
+/*************************************************************************
+ *
+ * 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: multipat.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/filedlghelper.hxx>
+
+#include "multipat.hxx"
+#include <svx/dialmgr.hxx>
+
+#include "multipat.hrc"
+#include <svx/dialogs.hrc>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+
+#include <unotools/localfilehelper.hxx>
+#include <unotools/pathoptions.hxx>
+
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::uno;
+
+// struct MultiPath_Impl -------------------------------------------------
+
+struct MultiPath_Impl
+{
+ BOOL bEmptyAllowed;
+ BOOL bIsClassPathMode;
+ bool bIsRadioButtonMode;
+
+ MultiPath_Impl( BOOL bAllowed ) :
+ bEmptyAllowed( bAllowed ), bIsClassPathMode( FALSE ), bIsRadioButtonMode( false ) {}
+};
+
+// class SvxMultiPathDialog ----------------------------------------------
+
+IMPL_LINK( SvxMultiPathDialog, SelectHdl_Impl, void *, EMPTYARG )
+{
+ ULONG nCount = pImpl->bIsRadioButtonMode ? aRadioLB.GetEntryCount() : aPathLB.GetEntryCount();
+ bool bIsSelected = pImpl->bIsRadioButtonMode
+ ? aRadioLB.FirstSelected() != NULL
+ : aPathLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND;
+ BOOL bEnable = ( pImpl->bEmptyAllowed || nCount > 1 );
+ aDelBtn.Enable( bEnable && bIsSelected );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxMultiPathDialog, CheckHdl_Impl, svx::SvxRadioButtonListBox *, pBox )
+{
+ SvLBoxEntry* pEntry =
+ pBox ? pBox->GetEntry( pBox->GetCurMousePoint() ) : aRadioLB.FirstSelected();
+ if ( pEntry )
+ aRadioLB.HandleEntryChecked( pEntry );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxMultiPathDialog, AddHdl_Impl, PushButton *, EMPTYARG )
+{
+ rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) );
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ Reference < XFolderPicker > xFolderPicker( xFactory->createInstance( aService ), UNO_QUERY );
+
+ if ( xFolderPicker->execute() == ExecutableDialogResults::OK )
+ {
+ INetURLObject aPath( xFolderPicker->getDirectory() );
+ aPath.removeFinalSlash();
+ String aURL = aPath.GetMainURL( INetURLObject::NO_DECODE );
+ String sInsPath;
+ ::utl::LocalFileHelper::ConvertURLToSystemPath( aURL, sInsPath );
+
+ if ( pImpl->bIsRadioButtonMode )
+ {
+ ULONG nPos = aRadioLB.GetEntryPos( sInsPath, 1 );
+ if ( 0xffffffff == nPos ) //See svtools/source/contnr/svtabbx.cxx SvTabListBox::GetEntryPos
+ {
+ String sNewEntry( '\t' );
+ sNewEntry += sInsPath;
+ SvLBoxEntry* pEntry = aRadioLB.InsertEntry( sNewEntry );
+ String* pData = new String( aURL );
+ pEntry->SetUserData( pData );
+ }
+ else
+ {
+ String sMsg( SVX_RES( RID_MULTIPATH_DBL_ERR ) );
+ sMsg.SearchAndReplaceAscii( "%1", sInsPath );
+ InfoBox( this, sMsg ).Execute();
+ }
+ }
+ else
+ {
+ if ( LISTBOX_ENTRY_NOTFOUND != aPathLB.GetEntryPos( sInsPath ) )
+ {
+ String sMsg( SVX_RES( RID_MULTIPATH_DBL_ERR ) );
+ sMsg.SearchAndReplaceAscii( "%1", sInsPath );
+ InfoBox( this, sMsg ).Execute();
+ }
+ else
+ {
+ USHORT nPos = aPathLB.InsertEntry( sInsPath, LISTBOX_APPEND );
+ aPathLB.SetEntryData( nPos, (void*)new String( aURL ) );
+ }
+ }
+ SelectHdl_Impl( NULL );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxMultiPathDialog, DelHdl_Impl, PushButton *, EMPTYARG )
+{
+ if ( pImpl->bIsRadioButtonMode )
+ {
+ SvLBoxEntry* pEntry = aRadioLB.FirstSelected();
+ delete (String*)pEntry->GetUserData();
+ bool bChecked = aRadioLB.GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED;
+ ULONG nPos = aRadioLB.GetEntryPos( pEntry );
+ aRadioLB.RemoveEntry( pEntry );
+ ULONG nCnt = aRadioLB.GetEntryCount();
+ if ( nCnt )
+ {
+ nCnt--;
+ if ( nPos > nCnt )
+ nPos = nCnt;
+ pEntry = aRadioLB.GetEntry( nPos );
+ if ( bChecked )
+ {
+ aRadioLB.SetCheckButtonState( pEntry, SV_BUTTON_CHECKED );
+ aRadioLB.HandleEntryChecked( pEntry );
+ }
+ else
+ aRadioLB.Select( pEntry );
+ }
+ }
+ else
+ {
+ USHORT nPos = aPathLB.GetSelectEntryPos();
+ aPathLB.RemoveEntry( nPos );
+ USHORT nCnt = aPathLB.GetEntryCount();
+
+ if ( nCnt )
+ {
+ nCnt--;
+
+ if ( nPos > nCnt )
+ nPos = nCnt;
+ aPathLB.SelectEntryPos( nPos );
+ }
+ }
+ SelectHdl_Impl( NULL );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvxMultiPathDialog::SvxMultiPathDialog( Window* pParent, BOOL bEmptyAllowed ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_MULTIPATH ) ),
+
+ aPathFL ( this, SVX_RES( FL_MULTIPATH) ),
+ aPathLB ( this, SVX_RES( LB_MULTIPATH ) ),
+ aRadioLB ( this, SVX_RES( LB_RADIOBUTTON ) ),
+ aRadioFT ( this, SVX_RES( FT_RADIOBUTTON ) ),
+ aAddBtn ( this, SVX_RES( BTN_ADD_MULTIPATH ) ),
+ aDelBtn ( this, SVX_RES( BTN_DEL_MULTIPATH ) ),
+ aOKBtn ( this, SVX_RES( BTN_MULTIPATH_OK ) ),
+ aCancelBtn ( this, SVX_RES( BTN_MULTIPATH_CANCEL ) ),
+ aHelpButton ( this, SVX_RES( BTN_MULTIPATH_HELP ) ),
+ pImpl ( new MultiPath_Impl( bEmptyAllowed ) )
+
+{
+ static long aStaticTabs[]= { 2, 0, 12 };
+ aRadioLB.SvxSimpleTable::SetTabs( aStaticTabs );
+ String sHeader( SVX_RES( STR_HEADER_PATHS ) );
+ aRadioLB.SetQuickHelpText( sHeader );
+ sHeader.Insert( '\t', 0 );
+ aRadioLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, HIB_LEFT );
+
+ FreeResource();
+
+ aPathLB.SetSelectHdl( LINK( this, SvxMultiPathDialog, SelectHdl_Impl ) );
+ aRadioLB.SetSelectHdl( LINK( this, SvxMultiPathDialog, SelectHdl_Impl ) );
+ aRadioLB.SetCheckButtonHdl( LINK( this, SvxMultiPathDialog, CheckHdl_Impl ) );
+ aAddBtn.SetClickHdl( LINK( this, SvxMultiPathDialog, AddHdl_Impl ) );
+ aDelBtn.SetClickHdl( LINK( this, SvxMultiPathDialog, DelHdl_Impl ) );
+
+ SelectHdl_Impl( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+SvxMultiPathDialog::~SvxMultiPathDialog()
+{
+ USHORT nPos = aPathLB.GetEntryCount();
+ while ( nPos-- )
+ delete (String*)aPathLB.GetEntryData(nPos);
+ nPos = (USHORT)aRadioLB.GetEntryCount();
+ while ( nPos-- )
+ {
+ SvLBoxEntry* pEntry = aRadioLB.GetEntry( nPos );
+ delete (String*)pEntry->GetUserData();
+ }
+ delete pImpl;
+}
+
+// -----------------------------------------------------------------------
+
+String SvxMultiPathDialog::GetPath() const
+{
+ String sNewPath;
+ sal_Unicode cDelim = pImpl->bIsClassPathMode ? CLASSPATH_DELIMITER : SVT_SEARCHPATH_DELIMITER;
+
+ if ( pImpl->bIsRadioButtonMode )
+ {
+ String sWritable;
+ for ( USHORT i = 0; i < aRadioLB.GetEntryCount(); ++i )
+ {
+ SvLBoxEntry* pEntry = aRadioLB.GetEntry(i);
+ if ( aRadioLB.GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED )
+ sWritable = *(String*)pEntry->GetUserData();
+ else
+ {
+ if ( sNewPath.Len() > 0 )
+ sNewPath += cDelim;
+ sNewPath += *(String*)pEntry->GetUserData();
+ }
+ }
+ if ( sNewPath.Len() > 0 )
+ sNewPath += cDelim;
+ sNewPath += sWritable;
+ }
+ else
+ {
+ for ( USHORT i = 0; i < aPathLB.GetEntryCount(); ++i )
+ {
+ if ( sNewPath.Len() > 0 )
+ sNewPath += cDelim;
+ sNewPath += *(String*)aPathLB.GetEntryData(i);
+ }
+ }
+ return sNewPath;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxMultiPathDialog::SetPath( const String& rPath )
+{
+ sal_Unicode cDelim = pImpl->bIsClassPathMode ? CLASSPATH_DELIMITER : SVT_SEARCHPATH_DELIMITER;
+ USHORT nPos, nCount = rPath.GetTokenCount( cDelim );
+
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ String sPath = rPath.GetToken( i, cDelim );
+ String sSystemPath;
+ sal_Bool bIsSystemPath =
+ ::utl::LocalFileHelper::ConvertURLToSystemPath( sPath, sSystemPath );
+
+ if ( pImpl->bIsRadioButtonMode )
+ {
+ String sEntry( '\t' );
+ sEntry += bIsSystemPath ? sSystemPath : sPath;
+ SvLBoxEntry* pEntry = aRadioLB.InsertEntry( sEntry );
+ String* pURL = new String( sPath );
+ pEntry->SetUserData( pURL );
+ }
+ else
+ {
+ if ( bIsSystemPath )
+ nPos = aPathLB.InsertEntry( sSystemPath, LISTBOX_APPEND );
+ else
+ nPos = aPathLB.InsertEntry( sPath, LISTBOX_APPEND );
+ aPathLB.SetEntryData( nPos, (void*)new String( sPath ) );
+ }
+ }
+
+ if ( pImpl->bIsRadioButtonMode && nCount > 0 )
+ {
+ SvLBoxEntry* pEntry = aRadioLB.GetEntry( nCount - 1 );
+ if ( pEntry )
+ {
+ aRadioLB.SetCheckButtonState( pEntry, SV_BUTTON_CHECKED );
+ aRadioLB.HandleEntryChecked( pEntry );
+ }
+ }
+
+ SelectHdl_Impl( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxMultiPathDialog::SetClassPathMode()
+{
+ pImpl->bIsClassPathMode = TRUE;
+ SetText( SVX_RES( RID_SVXSTR_ARCHIVE_TITLE ));
+ aPathFL.SetText( SVX_RES( RID_SVXSTR_ARCHIVE_HEADLINE ) );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxMultiPathDialog::IsClassPathMode() const
+{
+ return pImpl->bIsClassPathMode;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxMultiPathDialog::EnableRadioButtonMode()
+{
+ pImpl->bIsRadioButtonMode = true;
+
+ aPathFL.Hide();
+ aPathLB.Hide();
+
+ aRadioLB.ShowTable();
+ aRadioFT.Show();
+
+ Point aNewPos = aAddBtn.GetPosPixel();
+ long nDelta = aNewPos.Y() - aRadioLB.GetPosPixel().Y();
+ aNewPos.Y() -= nDelta;
+ aAddBtn.SetPosPixel( aNewPos );
+ aNewPos = aDelBtn.GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ aDelBtn.SetPosPixel( aNewPos );
+}
+
diff --git a/cui/source/dialogs/multipat.hrc b/cui/source/dialogs/multipat.hrc
new file mode 100644
index 000000000000..6ef22855ff8b
--- /dev/null
+++ b/cui/source/dialogs/multipat.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * 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: multipat.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_MULTIPAT_HRC
+#define _SVX_MULTIPAT_HRC
+
+// defines ---------------------------------------------------------------
+
+#define FL_MULTIPATH 10
+#define LB_MULTIPATH 11
+#define LB_RADIOBUTTON 12
+#define FT_RADIOBUTTON 13
+#define BTN_ADD_MULTIPATH 14
+#define BTN_DEL_MULTIPATH 15
+#define BTN_MULTIPATH_OK 16
+#define BTN_MULTIPATH_CANCEL 17
+#define BTN_MULTIPATH_HELP 18
+#define STR_HEADER_PATHS 19
+
+#endif
+
diff --git a/cui/source/dialogs/multipat.src b/cui/source/dialogs/multipat.src
new file mode 100644
index 000000000000..ff7e5d027202
--- /dev/null
+++ b/cui/source/dialogs/multipat.src
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * 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: multipat.src,v $
+ * $Revision: 1.42 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "multipat.hrc"
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+
+// RID_SVXDLG_MULTIPATH --------------------------------------------------
+
+ModalDialog RID_SVXDLG_MULTIPATH
+{
+ HelpId = HID_MULTIPATH ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 120 ) ;
+ Text [ en-US ] = "Select Paths" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ FixedLine FL_MULTIPATH
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Paths" ;
+ };
+ ListBox LB_MULTIPATH
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 189 , 80 ) ;
+ AutoHScroll = TRUE ;
+ };
+ Control LB_RADIOBUTTON
+ {
+ HelpId = HID_OPTIONS_MULTIPATH_LIST ;
+ Hide = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 195 , 77 ) ;
+ };
+ FixedText FT_RADIOBUTTON
+ {
+ Hide = TRUE ;
+ NoLabel = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 86 );
+ Size = MAP_APPFONT ( 195 , 8 );
+ Text [ en-US ] = "Mark the default path for new files.";
+ };
+ PushButton BTN_ADD_MULTIPATH
+ {
+ Pos = MAP_APPFONT ( 204 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add..." ;
+ };
+ PushButton BTN_DEL_MULTIPATH
+ {
+ Pos = MAP_APPFONT ( 204 , 31 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ OKButton BTN_MULTIPATH_OK
+ {
+ Pos = MAP_APPFONT ( 95 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE;
+ };
+ CancelButton BTN_MULTIPATH_CANCEL
+ {
+ Pos = MAP_APPFONT ( 148 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_MULTIPATH_HELP
+ {
+ Pos = MAP_APPFONT ( 204 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ String STR_HEADER_PATHS
+ {
+ Text [ en-US ] = "Path list" ;
+ };
+};
+String RID_MULTIPATH_DBL_ERR
+{
+ Text [ en-US ] = "The path %1 already exists." ;
+};
+String RID_SVXSTR_FILE_TITLE
+{
+ Text [ en-US ] = "Select files" ;
+};
+String RID_SVXSTR_FILE_HEADLINE
+{
+ Text [ en-US ] = "Files" ;
+};
+String RID_SVXSTR_ARCHIVE_TITLE
+{
+ Text [ en-US ] = "Select Archives" ;
+};
+String RID_SVXSTR_ARCHIVE_HEADLINE
+{
+ Text [ en-US ] = "Archives" ;
+};
+String RID_SVXSTR_MULTIFILE_DBL_ERR
+{
+ Text [ en-US ] = "The file %1 already exists." ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/newtabledlg.cxx b/cui/source/dialogs/newtabledlg.cxx
new file mode 100644
index 000000000000..aa111191e6fc
--- /dev/null
+++ b/cui/source/dialogs/newtabledlg.cxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * 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: newtabledlg.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include "svx/dialogs.hrc"
+#include "svx/dialmgr.hxx"
+#include "newtabledlg.hxx"
+#include "newtabledlg.hrc"
+
+SvxNewTableDialog::SvxNewTableDialog( Window* pParent )
+: ModalDialog( pParent, SVX_RES( RID_SVX_NEWTABLE_DLG ) )
+, maFtColumns( this, SVX_RES( FT_COLUMNS ) )
+, maNumColumns( this, SVX_RES( NF_COLUMNS ) )
+, maFtRows( this, SVX_RES( FT_ROWS ) )
+, maNumRows( this, SVX_RES( NF_ROWS ) )
+, maFlSep( this, SVX_RES( FL_SEP ) )
+, maHelpButton( this, SVX_RES( BTN_HELP ) )
+, maOkButton( this, SVX_RES( BTN_OK ) )
+, maCancelButton( this, SVX_RES( BTN_CANCEL ) )
+{
+ maNumRows.SetValue(2);
+ maNumColumns.SetValue(5);
+ FreeResource();
+}
+
+short SvxNewTableDialog::Execute(void)
+{
+ return ModalDialog::Execute();
+}
+
+void SvxNewTableDialog::Apply(void)
+{
+}
+
+sal_Int32 SvxNewTableDialog::getRows() const
+{
+ return sal::static_int_cast< sal_Int32 >( maNumRows.GetValue() );
+}
+
+sal_Int32 SvxNewTableDialog::getColumns() const
+{
+ return sal::static_int_cast< sal_Int32 >( maNumColumns.GetValue() );
+}
diff --git a/cui/source/dialogs/newtabledlg.hrc b/cui/source/dialogs/newtabledlg.hrc
new file mode 100644
index 000000000000..b17631658341
--- /dev/null
+++ b/cui/source/dialogs/newtabledlg.hrc
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * 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: newtabledlg.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_COLUMNS 1
+#define NF_COLUMNS 2
+#define FT_ROWS 3
+#define NF_ROWS 4
+#define FL_SEP 5
+#define BTN_HELP 6
+#define BTN_OK 7
+#define BTN_CANCEL 8
diff --git a/cui/source/dialogs/newtabledlg.src b/cui/source/dialogs/newtabledlg.src
new file mode 100644
index 000000000000..e72756da03db
--- /dev/null
+++ b/cui/source/dialogs/newtabledlg.src
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * 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: newtabledlg.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "newtabledlg.hrc"
+#include "svx/dialogs.hrc"
+
+ModalDialog RID_SVX_NEWTABLE_DLG
+{
+ OutputSize = TRUE;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Size = MAP_APPFONT ( 181 , 6+15+15+15+14+6 ) ;
+ Text [ en-US ] = "Insert Table" ;
+
+ FixedText FT_COLUMNS
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Number of columns:" ;
+ };
+ NumericField NF_COLUMNS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 80 , 6 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 75 ;
+ SpinSize = 1 ;
+ StrictFormat = TRUE ;
+ };
+ FixedText FT_ROWS
+ {
+ Pos = MAP_APPFONT ( 6 , 8+15 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Number of rows:" ;
+ };
+ NumericField NF_ROWS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 80 , 6+15 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 75 ;
+ SpinSize = 1 ;
+ StrictFormat = TRUE ;
+ };
+ FixedLine FL_SEP
+ {
+ Pos = MAP_APPFONT ( 0 , 6+15+15 ) ;
+ Size = MAP_APPFONT ( 181 , 12 ) ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 6 , 6+15+15+15 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 69 , 6+15+15+15 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 125 , 6+15+15+15 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx
new file mode 100644
index 000000000000..939606f8981f
--- /dev/null
+++ b/cui/source/dialogs/pastedlg.cxx
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * 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: pastedlg.cxx,v $
+ * $Revision: 1.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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <com/sun/star/embed/Aspects.hpp>
+
+#include <pastedlg.hxx>
+#include <svtools/svmedit.hxx>
+#include <svtools/insdlg.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/msgbox.hxx>
+#include "svuidlg.hrc"
+#include <sot/formats.hxx>
+#include <sot/stg.hxx>
+#include <svtools/sores.hxx>
+#include <vcl/svapp.hxx>
+
+#include <svx/dialmgr.hxx>
+
+SvPasteObjectDialog::SvPasteObjectDialog( Window* pParent )
+
+ : ModalDialog( pParent, SVX_RES( MD_PASTE_OBJECT ) ),
+ aFtSource( this, SVX_RES( FT_SOURCE ) ),
+ aFtObjectSource( this, SVX_RES( FT_OBJECT_SOURCE ) ),
+ aRbPaste( this, SVX_RES( RB_PASTE ) ),
+ aRbPasteLink( this, SVX_RES( RB_PASTE_LINK ) ),
+ aLbInsertList( this, SVX_RES( LB_INSERT_LIST ) ),
+ aCbDisplayAsIcon( this, SVX_RES( CB_DISPLAY_AS_ICON ) ),
+ aPbChangeIcon( this, SVX_RES( PB_CHANGE_ICON ) ),
+ aFlChoice( this, SVX_RES( FL_CHOICE ) ),
+ aOKButton1( this, SVX_RES( 1 ) ),
+ aCancelButton1( this, SVX_RES( 1 ) ),
+ aHelpButton1( this, SVX_RES( 1 ) ),
+ aSObject( SVX_RES( S_OBJECT ) )
+{
+ FreeResource();
+ SetHelpId( HID_PASTE_DLG );
+ SetUniqueId( HID_PASTE_DLG );
+
+ Font aFont = aFtObjectSource.GetFont();
+ aFont.SetWeight( WEIGHT_LIGHT );
+ aFtObjectSource.SetFont( aFont );
+ aOKButton1.Disable();
+
+ ObjectLB().SetSelectHdl( LINK( this, SvPasteObjectDialog, SelectHdl ) );
+ ObjectLB().SetDoubleClickHdl( LINK( this, SvPasteObjectDialog, DoubleClickHdl ) );
+ SetDefault();
+}
+
+void SvPasteObjectDialog::SelectObject()
+{
+ if ( aLbInsertList.GetEntryCount() &&
+ !aRbPaste.IsVisible() && !aRbPasteLink.IsVisible() )
+ {
+ aLbInsertList.SelectEntryPos(0);
+ SelectHdl( &aLbInsertList );
+ }
+}
+
+IMPL_LINK( SvPasteObjectDialog, SelectHdl, ListBox *, pListBox )
+{
+ (void)pListBox;
+
+ if ( !aOKButton1.IsEnabled() )
+ aOKButton1.Enable();
+ return 0;
+}
+
+IMPL_LINK_INLINE_START( SvPasteObjectDialog, DoubleClickHdl, ListBox *, pListBox )
+{
+ (void)pListBox;
+
+ EndDialog( RET_OK );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvPasteObjectDialog, DoubleClickHdl, ListBox *, pListBox )
+
+void SvPasteObjectDialog::SetDefault()
+{
+ bLink = FALSE;
+ nAspect = (USHORT)::com::sun::star::embed::Aspects::MSOLE_CONTENT;
+}
+
+SvPasteObjectDialog::~SvPasteObjectDialog()
+{
+ void * pStr = aSupplementTable.First();
+ while( pStr )
+ {
+ delete (String *)pStr;
+ pStr = aSupplementTable.Next();
+ }
+}
+
+/*************************************************************************
+|* SvPasteObjectDialog::Insert()
+|*
+|* Beschreibung
+|* Ersterstellung MM 14.06.94
+|* Letzte Aenderung KA 16.03.2001
+*************************************************************************/
+void SvPasteObjectDialog::Insert( SotFormatStringId nFormat, const String& rFormatName )
+{
+ String * pStr = new String( rFormatName );
+ if( !aSupplementTable.Insert( nFormat, pStr ) )
+ delete pStr;
+}
+
+ULONG SvPasteObjectDialog::GetFormat( const TransferableDataHelper& rHelper,
+ const DataFlavorExVector* pFormats,
+ const TransferableObjectDescriptor* )
+{
+ //TODO/LATER: why is the Descriptor never used?!
+ TransferableObjectDescriptor aDesc;
+ if( rHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) )
+ ((TransferableDataHelper&)rHelper).GetTransferableObjectDescriptor(
+ SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDesc );
+ if ( !pFormats )
+ pFormats = &rHelper.GetDataFlavorExVector();
+
+ //Dialogbox erzeugen und fuellen
+ String aSourceName, aTypeName;
+ ULONG nSelFormat = 0;
+ SvGlobalName aEmptyNm;
+
+ ObjectLB().SetUpdateMode( FALSE );
+
+ DataFlavorExVector::iterator aIter( ((DataFlavorExVector&)*pFormats).begin() ),
+ aEnd( ((DataFlavorExVector&)*pFormats).end() );
+ while( aIter != aEnd )
+ {
+ ::com::sun::star::datatransfer::DataFlavor aFlavor( *aIter );
+ SotFormatStringId nFormat = (*aIter++).mnSotId;
+
+ String* pName = (String*) aSupplementTable.Get( nFormat );
+ String aName;
+
+#ifdef WNT
+/*
+ if( !pName &&
+ ( nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE_OLE || nFormat == SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE ) )
+ {
+ BOOL IsClipboardObject_Impl( SotDataObject * );
+ if( IsClipboardObject_Impl( pDataObj ) )
+ {
+ IDataObject * pDO = NULL;
+ OleGetClipboard( &pDO );
+ if( pDO )
+ {
+ FORMATETC fe;
+ STGMEDIUM stm;
+ (fe).cfFormat=RegisterClipboardFormat( "Object Descriptor" );
+ (fe).dwAspect=DVASPECT_CONTENT;
+ (fe).ptd=NULL;
+ (fe).tymed=TYMED_HGLOBAL;
+ (fe).lindex=-1;
+
+ if (SUCCEEDED(pDO->GetData(&fe, &stm)))
+ {
+ LPOBJECTDESCRIPTOR pOD=(LPOBJECTDESCRIPTOR)GlobalLock(stm.hGlobal);
+ if( pOD->dwFullUserTypeName )
+ {
+ OLECHAR * pN = (OLECHAR *)(((BYTE *)pOD) + pOD->dwFullUserTypeName);
+ aName.Append( pN );
+ pName = &aName;
+ // set format to ole object
+ nFormat = SOT_FORMATSTR_ID_EMBED_SOURCE_OLE;
+ }
+ if( pOD->dwSrcOfCopy )
+ {
+ OLECHAR * pN = (OLECHAR *)(((BYTE *)pOD) + pOD->dwSrcOfCopy);
+ aSourceName.Append( *pN++ );
+ }
+ else
+ aSourceName = String( ResId( STR_UNKNOWN_SOURCE, SOAPP->GetResMgr() ) );
+ GlobalUnlock(stm.hGlobal);
+ ReleaseStgMedium(&stm);
+ }
+ }
+ }
+ }
+*/
+#endif
+
+ // if there is an "Embed Source" or and "Embedded Object" on the
+ // Clipboard we read the Description and the Source of this object
+ // from an accompanied "Object Descriptor" format on the clipboard
+ // Remember: these formats mostly appear together on the clipboard
+ if ( !pName )
+ {
+ SvPasteObjectHelper::GetEmbeddedName(rHelper,aName,aSourceName,nFormat);
+ if ( aName.Len() )
+ pName = &aName;
+ }
+
+
+ if( pName )
+ {
+ aName = *pName;
+
+ if( SOT_FORMATSTR_ID_EMBED_SOURCE == nFormat )
+ {
+ if( aDesc.maClassName != aEmptyNm ) {
+ aSourceName = aDesc.maDisplayName;
+
+ if( aDesc.maClassName == aObjClassName )
+ aName = aObjName;
+ else
+ aName = aTypeName = aDesc.maTypeName;
+ }
+ }
+ else if( SOT_FORMATSTR_ID_LINK_SOURCE == nFormat )
+ {
+ PasteLink().Enable();
+ continue;
+ }
+ else if( !aName.Len() )
+ aName = SvPasteObjectHelper::GetSotFormatUIName( nFormat );
+
+ if( LISTBOX_ENTRY_NOTFOUND == ObjectLB().GetEntryPos( aName ) )
+ ObjectLB().SetEntryData(
+ ObjectLB().InsertEntry( aName ), (void*) nFormat );
+ }
+ }
+
+ if( !aTypeName.Len() && !aSourceName.Len() )
+ {
+ if( aDesc.maClassName != aEmptyNm )
+ {
+ aSourceName = aDesc.maDisplayName;
+ aTypeName = aDesc.maTypeName;
+ }
+
+ if( !aTypeName.Len() && !aSourceName.Len() )
+ {
+ com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
+ ResMgr* pMgr = ResMgr::CreateResMgr( "svt", aLocale );
+ // global resource from svtools (former so3 resource)
+ if( pMgr )
+ aSourceName = String( ResId( STR_UNKNOWN_SOURCE, *pMgr ) );
+ delete pMgr;
+ }
+ }
+
+ ObjectLB().SetUpdateMode( TRUE );
+ SelectObject();
+
+ if( aSourceName.Len() )
+ {
+ if( aTypeName.Len() )
+ aTypeName += '\n';
+
+ aTypeName += aSourceName;
+ aTypeName.ConvertLineEnd();
+ }
+
+ ObjectSource().SetText( aTypeName );
+
+ SetDefault();
+
+ if( Dialog::Execute() == RET_OK )
+ {
+ bLink = PasteLink().IsChecked();
+
+ if( AsIconBox().IsChecked() )
+ nAspect = (USHORT)com::sun::star::embed::Aspects::MSOLE_ICON;
+
+ nSelFormat = (ULONG)ObjectLB().GetEntryData( ObjectLB().GetSelectEntryPos() );
+ }
+
+ return nSelFormat;
+}
+
+void SvPasteObjectDialog::SetObjName( const SvGlobalName & rClass, const String & rObjName )
+{
+ aObjClassName = rClass;
+ aObjName = rObjName;
+}
+
diff --git a/cui/source/dialogs/plfilter.cxx b/cui/source/dialogs/plfilter.cxx
new file mode 100644
index 000000000000..d09cc00d2a34
--- /dev/null
+++ b/cui/source/dialogs/plfilter.cxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * 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: plfilter.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <set>
+#include <map>
+#include <unotools/processfactory.hxx>
+
+#include <tools/debug.hxx>
+#include <vcl/stdtext.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/plugin/PluginDescription.hpp>
+#include <com/sun/star/plugin/XPluginManager.hpp>
+
+using namespace std;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::plugin;
+
+struct ltstr
+{
+ bool operator()( const String& s1, const String& s2 ) const
+ {
+ return ( s1.CompareTo( s2 ) == COMPARE_LESS );
+ }
+};
+
+typedef set< String, ltstr > StrSet;
+typedef map< String, StrSet, ltstr > FilterMap;
+
+
+//==================================================================================================
+void fillNetscapePluginFilters( Sequence< rtl::OUString >& rPluginNames, Sequence< rtl::OUString >& rPluginTypes )
+{
+ Reference< XMultiServiceFactory > xMan( ::utl::getProcessServiceFactory() );
+ Reference< XPluginManager > xPMgr( xMan->createInstance(
+ rtl::OUString::createFromAscii("com.sun.star.plugin.PluginManager") ), UNO_QUERY );
+
+ if ( xPMgr.is() )
+ {
+ FilterMap aMap;
+
+ // mimetypes zusammenfassen: eine description, mehrere extensions
+
+ Sequence<PluginDescription > aDescriptions( xPMgr->getPluginDescriptions() );
+ const PluginDescription * pDescriptions = aDescriptions.getConstArray();
+ for ( UINT32 nPos = aDescriptions.getLength(); nPos--; )
+ {
+ const PluginDescription & rDescr = pDescriptions[nPos];
+
+ StrSet& rTypes = aMap[ rDescr.Description ];
+ String aExtension( rDescr.Extension );
+
+ for ( USHORT nCnt = aExtension.GetTokenCount( ';' ); nCnt--; )
+ {
+ // no default plugins anymore
+ String aExt( aExtension.GetToken( nCnt, ';' ) );
+ if ( aExt.CompareToAscii( "*.*" ) != COMPARE_EQUAL )
+ rTypes.insert( aExt );
+ }
+ }
+
+ rPluginNames = Sequence< rtl::OUString >( aMap.size() );
+ rPluginTypes = Sequence< rtl::OUString >( aMap.size() );
+ rtl::OUString* pPluginNames = rPluginNames.getArray();
+ rtl::OUString* pPluginTypes = rPluginTypes.getArray();
+ int nIndex = 0;
+ for ( FilterMap::iterator iPos = aMap.begin(); iPos != aMap.end(); ++iPos )
+ {
+ String aText( (*iPos).first );
+ String aType;
+ StrSet& rTypes = (*iPos).second;
+ StrSet::iterator i = rTypes.begin();
+ while ( i != rTypes.end() )
+ {
+ aType += (*i);
+ ++i;
+ if ( i != rTypes.end() )
+ aType += ';';
+ }
+
+ if ( aType.Len() )
+ {
+ aText += String::CreateFromAscii( " (" );
+ aText += aType;
+ aText += ')';
+ pPluginNames[nIndex] = aText;
+ pPluginTypes[nIndex] = aType;
+ nIndex++;
+ }
+ }
+ rPluginNames.realloc( nIndex );
+ rPluginTypes.realloc( nIndex );
+ }
+ else
+ ShowServiceNotAvailableError( NULL,
+ String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.plugin.PluginManager" ) ), TRUE );
+}
+
diff --git a/cui/source/dialogs/postdlg.cxx b/cui/source/dialogs/postdlg.cxx
new file mode 100644
index 000000000000..2ccf2d1c664b
--- /dev/null
+++ b/cui/source/dialogs/postdlg.cxx
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * 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: postdlg.cxx,v $
+ * $Revision: 1.14 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <unotools/useroptions.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <comphelper/processfactory.hxx>
+
+#define _SVX_POSTDLG_CXX
+
+#include <svx/dialogs.hrc>
+#include "postdlg.hrc"
+#include <svx/postattr.hxx>
+#include "postdlg.hxx"
+#include <svx/dialmgr.hxx>
+
+#include "helpid.hrc"
+
+// static ----------------------------------------------------------------
+
+static USHORT pRanges[] =
+{
+ SID_ATTR_POSTIT_AUTHOR,
+ SID_ATTR_POSTIT_TEXT,
+ 0
+};
+
+// class SvxPostItDialog -------------------------------------------------
+
+SvxPostItDialog::SvxPostItDialog( Window* pParent,
+ const SfxItemSet& rCoreSet,
+ BOOL bPrevNext,
+ BOOL bRedline ) :
+
+ SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_POSTIT ) ),
+
+ aPostItFL ( this, SVX_RES( FL_POSTIT ) ),
+ aLastEditLabelFT( this, SVX_RES( FT_LASTEDITLABEL ) ),
+ aLastEditFT ( this, SVX_RES( FT_LASTEDIT ) ),
+ aEditFT ( this, SVX_RES( FT_EDIT ) ),
+ aEditED ( this, SVX_RES( ED_EDIT ) ),
+ aAuthorFT ( this, SVX_RES( FT_AUTHOR) ),
+ aAuthorBtn ( this, SVX_RES( BTN_AUTHOR ) ),
+ aOKBtn ( this, SVX_RES( BTN_POST_OK ) ),
+ aCancelBtn ( this, SVX_RES( BTN_POST_CANCEL ) ),
+ aHelpBtn ( this, SVX_RES( BTN_POST_HELP ) ),
+ aPrevBtn ( this, SVX_RES( BTN_PREV ) ),
+ aNextBtn ( this, SVX_RES( BTN_NEXT ) ),
+
+ rSet ( rCoreSet ),
+ pOutSet ( 0 )
+
+{
+ if (bRedline) // HelpIDs fuer Redlining
+ {
+ SetHelpId(HID_REDLINING_DLG);
+ aEditED.SetHelpId(HID_REDLINING_EDIT);
+ aPrevBtn.SetHelpId(HID_REDLINING_PREV);
+ aNextBtn.SetHelpId(HID_REDLINING_NEXT);
+ }
+
+ aPrevBtn.SetClickHdl( LINK( this, SvxPostItDialog, PrevHdl ) );
+ aNextBtn.SetClickHdl( LINK( this, SvxPostItDialog, NextHdl ) );
+ aAuthorBtn.SetClickHdl( LINK( this, SvxPostItDialog, Stamp ) );
+ aOKBtn.SetClickHdl( LINK( this, SvxPostItDialog, OKHdl ) );
+
+ Font aFont( aEditED.GetFont() );
+ aFont.SetWeight( WEIGHT_LIGHT );
+ aEditED.SetFont( aFont );
+
+ BOOL bNew = TRUE;
+ USHORT nWhich = 0;
+
+ if ( !bPrevNext )
+ {
+ aPrevBtn.Hide();
+ aNextBtn.Hide();
+ }
+
+ nWhich = rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_AUTHOR );
+ String aAuthorStr, aDateStr, aTextStr;
+
+ if ( rSet.GetItemState( nWhich, TRUE ) >= SFX_ITEM_AVAILABLE )
+ {
+ bNew = FALSE;
+ const SvxPostItAuthorItem& rAuthor =
+ (const SvxPostItAuthorItem&)rSet.Get( nWhich );
+ aAuthorStr = rAuthor.GetValue();
+ }
+ else
+ aAuthorStr = SvtUserOptions().GetID();
+
+ nWhich = rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_DATE );
+
+ if ( rSet.GetItemState( nWhich, TRUE ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxPostItDateItem& rDate =
+ (const SvxPostItDateItem&)rSet.Get( nWhich );
+ aDateStr = rDate.GetValue();
+ }
+ else
+ {
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ aDateStr = aLocaleWrapper.getDate( Date() );
+ }
+
+ nWhich = rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_TEXT );
+
+ if ( rSet.GetItemState( nWhich, TRUE ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxPostItTextItem& rText =
+ (const SvxPostItTextItem&)rSet.Get( nWhich );
+ aTextStr = rText.GetValue();
+ }
+
+ ShowLastAuthor(aAuthorStr, aDateStr);
+ aEditED.SetText( aTextStr.ConvertLineEnd() );
+
+ if ( !bNew )
+ SetText( SVX_RESSTR( STR_NOTIZ_EDIT ) );
+ else
+ // neu anlegen
+ SetText( SVX_RESSTR( STR_NOTIZ_INSERT ) );
+
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SvxPostItDialog::~SvxPostItDialog()
+{
+ delete pOutSet;
+ pOutSet = 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPostItDialog::ShowLastAuthor(const String& rAuthor, const String& rDate)
+{
+ String sTxt( rAuthor );
+ sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
+ sTxt += rDate;
+ aLastEditFT.SetText( sTxt );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxPostItDialog::GetRanges()
+{
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPostItDialog::EnableTravel(BOOL bNext, BOOL bPrev)
+{
+ aPrevBtn.Enable(bPrev);
+ aNextBtn.Enable(bNext);
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxPostItDialog, PrevHdl, Button *, EMPTYARG )
+{
+ aPrevHdlLink.Call( this );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxPostItDialog, PrevHdl, Button *, EMPTYARG )
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxPostItDialog, NextHdl, Button *, EMPTYARG )
+{
+ aNextHdlLink.Call( this );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxPostItDialog, NextHdl, Button *, EMPTYARG )
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPostItDialog, Stamp, Button *, EMPTYARG )
+{
+ Date aDate;
+ Time aTime;
+ String aTmp( SvtUserOptions().GetID() );
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ String aStr( aEditED.GetText() );
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\n---- " ) );
+
+ if ( aTmp.Len() > 0 )
+ {
+ aStr += aTmp;
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
+ }
+ aStr += aLocaleWrapper.getDate(aDate);
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
+ aStr += aLocaleWrapper.getTime(aTime, FALSE, FALSE);
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " ----\n" ) );
+
+
+ aEditED.SetText( aStr.ConvertLineEnd() );
+ xub_StrLen nLen = aStr.Len();
+ aEditED.GrabFocus();
+ aEditED.SetSelection( Selection( nLen, nLen ) );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPostItDialog, OKHdl, Button *, EMPTYARG )
+{
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ pOutSet = new SfxItemSet( rSet );
+ pOutSet->Put( SvxPostItAuthorItem( SvtUserOptions().GetID(),
+ rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_AUTHOR ) ) );
+ pOutSet->Put( SvxPostItDateItem( aLocaleWrapper.getDate( Date() ),
+ rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_DATE ) ) );
+ pOutSet->Put( SvxPostItTextItem( aEditED.GetText(),
+ rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_TEXT ) ) );
+ EndDialog( RET_OK );
+ return 0;
+}
+
diff --git a/cui/source/dialogs/postdlg.hrc b/cui/source/dialogs/postdlg.hrc
new file mode 100644
index 000000000000..b2b615647438
--- /dev/null
+++ b/cui/source/dialogs/postdlg.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: postdlg.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_POSTDLG_HRC
+#define _SVX_POSTDLG_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FT_LASTEDITLABEL 10
+#define FT_LASTEDIT 11
+#define FT_EDIT 12
+#define ED_EDIT 13
+#define FL_POSTIT 14
+#define BTN_PREV 15
+#define BTN_NEXT 16
+#define BTN_AUTHOR 17
+#define FT_AUTHOR 18
+
+#define STR_NOTIZ_EDIT 20
+#define STR_NOTIZ_INSERT 21
+
+#define BTN_POST_OK 30
+#define BTN_POST_CANCEL 31
+#define BTN_POST_HELP 32
+
+
+#endif
+
diff --git a/cui/source/dialogs/postdlg.src b/cui/source/dialogs/postdlg.src
new file mode 100644
index 000000000000..23dbef26e0a8
--- /dev/null
+++ b/cui/source/dialogs/postdlg.src
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * 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: postdlg.src,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include "postdlg.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXDLG_POSTIT -----------------------------------------------------
+ModalDialog RID_SVXDLG_POSTIT
+{
+ HelpId = SID_POSTIT ;
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 198 , 134 ) ;
+ Text [ en-US ] = "Note" ;
+ Moveable = TRUE ;
+ FixedText FT_LASTEDITLABEL
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 34 , 8 ) ;
+ Text [ en-US ] = "Author" ;
+ Left = TRUE ;
+ };
+ FixedText FT_LASTEDIT
+ {
+ Pos = MAP_APPFONT ( 48 , 14 ) ;
+ Size = MAP_APPFONT ( 83 , 8 ) ;
+ Left = TRUE ;
+ };
+ FixedText FT_EDIT
+ {
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "~Text" ;
+ Left = TRUE ;
+ };
+ MultiLineEdit ED_EDIT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 38 ) ;
+ Size = MAP_APPFONT ( 123 , 72 ) ;
+ Left = TRUE ;
+ VScroll = TRUE ;
+ HScroll = TRUE ;
+ IgnoreTab = TRUE ;
+ };
+ FixedLine FL_POSTIT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 129 , 8 ) ;
+ Text [ en-US ] = "Contents" ;
+ };
+ OKButton BTN_POST_OK
+ {
+ Pos = MAP_APPFONT ( 141 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_POST_CANCEL
+ {
+ Pos = MAP_APPFONT ( 141 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ };
+ HelpButton BTN_POST_HELP
+ {
+ Pos = MAP_APPFONT ( 141 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ };
+ ImageButton BTN_PREV
+ {
+ Pos = MAP_APPFONT ( 141 , 60 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_LEFT ;
+ };
+ ImageButton BTN_NEXT
+ {
+ Pos = MAP_APPFONT ( 167 , 60 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_RIGHT ;
+ };
+ FixedText FT_AUTHOR
+ {
+ Pos = MAP_APPFONT ( 12 , 116 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Insert";
+ };
+ PushButton BTN_AUTHOR
+ {
+ Pos = MAP_APPFONT ( 75 , 114 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "Author" ;
+ };
+ // lokale Strings
+ String STR_NOTIZ_EDIT
+ {
+ Text [ en-US ] = "Edit Note" ;
+ };
+ String STR_NOTIZ_INSERT
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Notiz einfügen : Notiz einf³gen */
+ /* ### ACHTUNG: Neuer Text in Resource? Notiz einfügen : Notiz einf³gen */
+ Text [ en-US ] = "Insert note" ;
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
new file mode 100644
index 000000000000..08c6674ee881
--- /dev/null
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -0,0 +1,1694 @@
+/**********************************************************************
+ *
+ * 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: scriptdlg.cxx,v $
+ * $Revision: 1.26 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <memory>
+
+#include <sfx2/objsh.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <vos/mutex.hxx>
+
+#include <svx/dialogs.hrc>
+#include "scriptdlg.hrc"
+#include "scriptdlg.hxx"
+#include <svx/dialmgr.hxx>
+#include "selector.hxx"
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
+#include <com/sun/star/script/provider/XScriptProvider.hpp>
+#include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
+#include <com/sun/star/script/browse/XBrowseNodeFactory.hpp>
+#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
+#include <com/sun/star/script/provider/ScriptErrorRaisedException.hpp>
+#include <com/sun/star/script/provider/ScriptExceptionRaisedException.hpp>
+#include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/documentinfo.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <comphelper/proparrhlp.hxx>
+
+#include <basic/sbx.hxx>
+#include <svtools/imagemgr.hxx>
+#include <tools/urlobj.hxx>
+#include <vector>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::script;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::document;
+
+void ShowErrorDialog( const Any& aException )
+{
+ SvxScriptErrorDialog* pDlg = new SvxScriptErrorDialog( NULL, aException );
+ pDlg->Execute();
+ delete pDlg;
+}
+
+SFTreeListBox::SFTreeListBox( Window* pParent, const ResId& rResId ) :
+ SvTreeListBox( pParent, ResId( rResId.GetId(),*rResId.GetResMgr() ) ),
+ m_hdImage(ResId(IMG_HARDDISK,*rResId.GetResMgr())),
+ m_hdImage_hc(ResId(IMG_HARDDISK_HC,*rResId.GetResMgr())),
+ m_libImage(ResId(IMG_LIB,*rResId.GetResMgr())),
+ m_libImage_hc(ResId(IMG_LIB_HC,*rResId.GetResMgr())),
+ m_macImage(ResId(IMG_MACRO,*rResId.GetResMgr())),
+ m_macImage_hc(ResId(IMG_MACRO_HC,*rResId.GetResMgr())),
+ m_docImage(ResId(IMG_DOCUMENT,*rResId.GetResMgr())),
+ m_docImage_hc(ResId(IMG_DOCUMENT_HC,*rResId.GetResMgr())),
+ m_sMyMacros(String(ResId(STR_MYMACROS,*rResId.GetResMgr()))),
+ m_sProdMacros(String(ResId(STR_PRODMACROS,*rResId.GetResMgr())))
+{
+ FreeResource();
+ SetSelectionMode( SINGLE_SELECTION );
+
+ SetWindowBits( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL |
+ WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HIDESELECTION |
+ WB_HASLINES | WB_HASLINESATROOT );
+ SetNodeDefaultImages();
+
+ nMode = 0xFF; // Alles
+}
+
+SFTreeListBox::~SFTreeListBox()
+{
+ deleteAllTree();
+}
+
+void SFTreeListBox::delUserData( SvLBoxEntry* pEntry )
+{
+ if ( pEntry )
+ {
+
+ String text = GetEntryText( pEntry );
+ SFEntry* pUserData = (SFEntry*)pEntry->GetUserData();
+ if ( pUserData )
+ {
+ delete pUserData;
+ // TBD seem to get a Select event on node that is remove ( below )
+ // so need to be able to detect that this node is not to be
+ // processed in order to do this, setting userData to NULL ( must
+ // be a better way to do this )
+ pUserData = 0;
+ pEntry->SetUserData( pUserData );
+ }
+ }
+}
+
+void SFTreeListBox::deleteTree( SvLBoxEntry* pEntry )
+{
+
+ delUserData( pEntry );
+ pEntry = FirstChild( pEntry );
+ while ( pEntry )
+ {
+ SvLBoxEntry* pNextEntry = NextSibling( pEntry );
+ deleteTree( pEntry );
+ GetModel()->Remove( pEntry );
+ pEntry = pNextEntry;
+ }
+}
+
+void SFTreeListBox::deleteAllTree()
+{
+ SvLBoxEntry* pEntry = GetEntry( 0 );
+
+ // TBD - below is a candidate for a destroyAllTrees method
+ if ( pEntry )
+ {
+ while ( pEntry )
+ {
+ String text = GetEntryText( pEntry );
+ SvLBoxEntry* pNextEntry = NextSibling( pEntry ) ;
+ deleteTree( pEntry );
+ GetModel()->Remove( pEntry );
+ pEntry = pNextEntry;
+ }
+ }
+}
+
+void SFTreeListBox::Init( const ::rtl::OUString& language )
+{
+ SetUpdateMode( FALSE );
+
+ deleteAllTree();
+
+ Reference< browse::XBrowseNode > rootNode;
+ Reference< XComponentContext > xCtx;
+
+ Sequence< Reference< browse::XBrowseNode > > children;
+
+ ::rtl::OUString userStr = ::rtl::OUString::createFromAscii("user");
+ ::rtl::OUString shareStr = ::rtl::OUString::createFromAscii("share");
+
+ ::rtl::OUString singleton = ::rtl::OUString::createFromAscii(
+ "/singletons/com.sun.star.script.browse.theBrowseNodeFactory" );
+
+ try
+ {
+ Reference < beans::XPropertySet > xProps(
+ ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
+
+ xCtx.set( xProps->getPropertyValue( rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("DefaultContext" ))), UNO_QUERY_THROW );
+
+ Reference< browse::XBrowseNodeFactory > xFac(
+ xCtx->getValueByName( singleton ), UNO_QUERY_THROW );
+
+ rootNode.set( xFac->createView(
+ browse::BrowseNodeFactoryViewTypes::MACROORGANIZER ) );
+
+ if ( rootNode.is() && rootNode->hasChildNodes() == sal_True )
+ {
+ children = rootNode->getChildNodes();
+ }
+ }
+ catch( Exception& e )
+ {
+ OSL_TRACE("Exception getting root browse node from factory: %s",
+ ::rtl::OUStringToOString(
+ e.Message , RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ // TODO exception handling
+ }
+
+ Reference<XModel> xDocumentModel;
+ for ( sal_Int32 n = 0; n < children.getLength(); n++ )
+ {
+ bool app = false;
+ ::rtl::OUString uiName = children[ n ]->getName();
+ ::rtl::OUString factoryURL;
+ if ( uiName.equals( userStr ) || uiName.equals( shareStr ) )
+ {
+ app = true;
+ if ( uiName.equals( userStr ) )
+ {
+ uiName = m_sMyMacros;
+ }
+ else
+ {
+ uiName = m_sProdMacros;
+ }
+ }
+ else
+ {
+ xDocumentModel.set(getDocumentModel(xCtx, uiName ), UNO_QUERY);
+
+ if ( xDocumentModel.is() )
+ {
+ Reference< ::com::sun::star::frame::XModuleManager >
+ xModuleManager( xCtx->getServiceManager()->createInstanceWithContext(
+ ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager"), xCtx ),
+ UNO_QUERY_THROW );
+
+ Reference<container::XNameAccess> xModuleConfig(
+ xModuleManager, UNO_QUERY_THROW );
+ // get the long name of the document:
+ Sequence<beans::PropertyValue> moduleDescr;
+ try{
+ ::rtl::OUString appModule = xModuleManager->identify( xDocumentModel );
+ xModuleConfig->getByName(appModule) >>= moduleDescr;
+ } catch(const uno::Exception&)
+ {}
+
+ beans::PropertyValue const * pmoduleDescr =
+ moduleDescr.getConstArray();
+ for ( sal_Int32 pos = moduleDescr.getLength(); pos--; )
+ {
+ if (pmoduleDescr[ pos ].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "ooSetupFactoryEmptyDocumentURL") ))
+ {
+ pmoduleDescr[ pos ].Value >>= factoryURL;
+ break;
+ }
+ }
+ }
+ }
+
+ ::rtl::OUString lang( language );
+ Reference< browse::XBrowseNode > langEntries =
+ getLangNodeFromRootNode( children[ n ], lang );
+
+ /*SvLBoxEntry* pBasicManagerRootEntry =*/
+ insertEntry( uiName, app ? IMG_HARDDISK : IMG_DOCUMENT,
+ 0, true, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SFROOT, langEntries, xDocumentModel )), factoryURL );
+ }
+
+ SetUpdateMode( TRUE );
+}
+
+Reference< XInterface >
+SFTreeListBox::getDocumentModel( Reference< XComponentContext >& xCtx, ::rtl::OUString& docName )
+{
+ Reference< XInterface > xModel;
+ Reference< lang::XMultiComponentFactory > mcf =
+ xCtx->getServiceManager();
+ Reference< frame::XDesktop > desktop (
+ mcf->createInstanceWithContext(
+ ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx ),
+ UNO_QUERY );
+
+ Reference< container::XEnumerationAccess > componentsAccess =
+ desktop->getComponents();
+ Reference< container::XEnumeration > components =
+ componentsAccess->createEnumeration();
+ while (components->hasMoreElements())
+ {
+ Reference< frame::XModel > model(
+ components->nextElement(), UNO_QUERY );
+ if ( model.is() )
+ {
+ ::rtl::OUString sTdocUrl = ::comphelper::DocumentInfo::getDocumentTitle( model );
+ if( sTdocUrl.equals( docName ) )
+ {
+ xModel = model;
+ break;
+ }
+ }
+ }
+ return xModel;
+}
+
+Reference< browse::XBrowseNode >
+SFTreeListBox::getLangNodeFromRootNode( Reference< browse::XBrowseNode >& rootNode, ::rtl::OUString& language )
+{
+ Reference< browse::XBrowseNode > langNode;
+
+ try
+ {
+ Sequence < Reference< browse::XBrowseNode > > children = rootNode->getChildNodes();
+ for ( sal_Int32 n = 0; n < children.getLength(); n++ )
+ {
+ if ( children[ n ]->getName().equals( language ) )
+ {
+ langNode = children[ n ];
+ break;
+ }
+ }
+ }
+ catch ( Exception& )
+ {
+ // if getChildNodes() throws an exception we just return
+ // the empty Reference
+ }
+ return langNode;
+}
+
+void SFTreeListBox:: RequestSubEntries( SvLBoxEntry* pRootEntry, Reference< ::com::sun::star::script::browse::XBrowseNode >& node,
+ Reference< XModel >& model )
+{
+ if (! node.is() )
+ {
+ return;
+ }
+
+ Sequence< Reference< browse::XBrowseNode > > children;
+ try
+ {
+ children = node->getChildNodes();
+ }
+ catch ( Exception& )
+ {
+ // if we catch an exception in getChildNodes then no entries are added
+ }
+
+ for ( sal_Int32 n = 0; n < children.getLength(); n++ )
+ {
+ ::rtl::OUString name( children[ n ]->getName() );
+ if ( children[ n ]->getType() != browse::BrowseNodeTypes::SCRIPT)
+ {
+ insertEntry( name, IMG_LIB, pRootEntry, true, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SCRIPTCONTAINER, children[ n ],model )));
+ }
+ else
+ {
+ if ( children[ n ]->getType() == browse::BrowseNodeTypes::SCRIPT )
+ {
+ insertEntry( name, IMG_MACRO, pRootEntry, false, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_METHOD, children[ n ],model )));
+
+ }
+ }
+ }
+}
+
+void SFTreeListBox::UpdateEntries()
+{
+}
+
+SvLBoxEntry* SFTreeListBox::FindEntry( SvLBoxEntry* , const String& , BYTE )
+{
+ return 0;
+}
+
+long SFTreeListBox::ExpandingHdl()
+{
+ return TRUE;
+}
+
+void SFTreeListBox::ExpandAllTrees()
+{
+}
+
+SvLBoxEntry * SFTreeListBox::insertEntry(
+ String const & rText, USHORT nBitmap, SvLBoxEntry * pParent,
+ bool bChildrenOnDemand, std::auto_ptr< SFEntry > aUserData, ::rtl::OUString factoryURL )
+{
+ SvLBoxEntry * p;
+ if( nBitmap == IMG_DOCUMENT && factoryURL.getLength() > 0 )
+ {
+ Image aImage = SvFileInformationManager::GetFileImage(
+ INetURLObject(factoryURL), false,
+ BMP_COLOR_NORMAL );
+ Image aHCImage = SvFileInformationManager::GetFileImage(
+ INetURLObject(factoryURL), false,
+ BMP_COLOR_HIGHCONTRAST );
+ p = InsertEntry(
+ rText, aImage, aImage, pParent, bChildrenOnDemand, LIST_APPEND,
+ aUserData.release()); // XXX possible leak
+ SetExpandedEntryBmp(p, aHCImage, BMP_COLOR_HIGHCONTRAST);
+ SetCollapsedEntryBmp(p, aHCImage, BMP_COLOR_HIGHCONTRAST);
+ }
+ else
+ {
+ p = insertEntry( rText, nBitmap, pParent, bChildrenOnDemand, aUserData );
+ }
+ return p;
+}
+
+SvLBoxEntry * SFTreeListBox::insertEntry(
+ String const & rText, USHORT nBitmap, SvLBoxEntry * pParent,
+ bool bChildrenOnDemand, std::auto_ptr< SFEntry > aUserData )
+{
+ Image aHCImage, aImage;
+ if( nBitmap == IMG_HARDDISK )
+ {
+ aImage = m_hdImage;
+ aHCImage = m_hdImage_hc;
+ }
+ else if( nBitmap == IMG_LIB )
+ {
+ aImage = m_libImage;
+ aHCImage = m_libImage_hc;
+ }
+ else if( nBitmap == IMG_MACRO )
+ {
+ aImage = m_macImage;
+ aHCImage = m_macImage_hc;
+ }
+ else if( nBitmap == IMG_DOCUMENT )
+ {
+ aImage = m_docImage;
+ aHCImage = m_docImage_hc;
+ }
+ SvLBoxEntry * p = InsertEntry(
+ rText, aImage, aImage, pParent, bChildrenOnDemand, LIST_APPEND,
+ aUserData.release()); // XXX possible leak
+ SetExpandedEntryBmp(p, aHCImage, BMP_COLOR_HIGHCONTRAST);
+ SetCollapsedEntryBmp(p, aHCImage, BMP_COLOR_HIGHCONTRAST);
+ return p;
+}
+
+void __EXPORT SFTreeListBox::RequestingChilds( SvLBoxEntry* pEntry )
+{
+ SFEntry* userData = 0;
+ if ( !pEntry )
+ {
+ return;
+ }
+ userData = (SFEntry*)pEntry->GetUserData();
+
+ Reference< browse::XBrowseNode > node;
+ Reference< XModel > model;
+ if ( userData && !userData->isLoaded() )
+ {
+ node = userData->GetNode();
+ model = userData->GetModel();
+ RequestSubEntries( pEntry, node, model );
+ userData->setLoaded();
+ }
+}
+
+void __EXPORT SFTreeListBox::ExpandedHdl()
+{
+/* SvLBoxEntry* pEntry = GetHdlEntry();
+ DBG_ASSERT( pEntry, "Was wurde zugeklappt?" );
+
+ if ( !IsExpanded( pEntry ) && pEntry->HasChildsOnDemand() )
+ {
+ SvLBoxEntry* pChild = FirstChild( pEntry );
+ while ( pChild )
+ {
+ GetModel()->Remove( pChild ); // Ruft auch den DTOR
+ pChild = FirstChild( pEntry );
+ }
+ }*/
+}
+
+// ----------------------------------------------------------------------------
+// InputDialog ------------------------------------------------------------
+// ----------------------------------------------------------------------------
+InputDialog::InputDialog(Window * pParent, USHORT nMode )
+ : ModalDialog( pParent, SVX_RES( RID_DLG_NEWLIB ) ),
+ aText( this, SVX_RES( FT_NEWLIB ) ),
+ aEdit( this, SVX_RES( ED_LIBNAME ) ),
+ aOKButton( this, SVX_RES( PB_OK ) ),
+ aCancelButton( this, SVX_RES( PB_CANCEL ) )
+{
+ aEdit.GrabFocus();
+ if ( nMode == INPUTMODE_NEWLIB )
+ {
+ SetText( String( SVX_RES( STR_NEWLIB ) ) );
+ }
+ else if ( nMode == INPUTMODE_NEWMACRO )
+ {
+ SetText( String( SVX_RES( STR_NEWMACRO ) ) );
+ aText.SetText( String( SVX_RES( STR_FT_NEWMACRO ) ) );
+ }
+ else if ( nMode == INPUTMODE_RENAME )
+ {
+ SetText( String( SVX_RES( STR_RENAME ) ) );
+ aText.SetText( String( SVX_RES( STR_FT_RENAME ) ) );
+ }
+ FreeResource();
+
+ // some resizing so that the text fits
+ Point point, newPoint;
+ Size siz, newSiz;
+ long gap;
+
+ USHORT style = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP |
+ TEXT_DRAW_LEFT | TEXT_DRAW_WORDBREAK;
+
+ // get dimensions of dialog instructions control
+ point = aText.GetPosPixel();
+ siz = aText.GetSizePixel();
+
+ // get dimensions occupied by text in the control
+ Rectangle rect =
+ GetTextRect( Rectangle( point, siz ), aText.GetText(), style );
+ newSiz = rect.GetSize();
+
+ // the gap is the difference between the text width and its control width
+ gap = siz.Height() - newSiz.Height();
+
+ //resize the text field
+ newSiz = Size( siz.Width(), siz.Height() - gap );
+ aText.SetSizePixel( newSiz );
+
+ //move the OK & cancel buttons
+ point = aEdit.GetPosPixel();
+ newPoint = Point( point.X(), point.Y() - gap );
+ aEdit.SetPosPixel( newPoint );
+
+}
+
+InputDialog::~InputDialog()
+{
+}
+// ----------------------------------------------------------------------------
+// ScriptOrgDialog ------------------------------------------------------------
+// ----------------------------------------------------------------------------
+SvxScriptOrgDialog::SvxScriptOrgDialog( Window* pParent, ::rtl::OUString language )
+ : SfxModalDialog( pParent, SVX_RES( RID_DLG_SCRIPTORGANIZER ) ),
+ aScriptsTxt( this, SVX_RES( SF_TXT_SCRIPTS ) ),
+ aScriptsBox( this, SVX_RES( SF_CTRL_SCRIPTSBOX ) ),
+ aRunButton( this, SVX_RES( SF_PB_RUN ) ),
+ aCloseButton( this, SVX_RES( SF_PB_CLOSE ) ),
+ aCreateButton( this, SVX_RES( SF_PB_CREATE ) ),
+ aEditButton( this, SVX_RES( SF_PB_EDIT ) ),
+ aRenameButton(this, SVX_RES( SF_PB_RENAME ) ),
+ aDelButton( this, SVX_RES( SF_PB_DEL ) ),
+ aHelpButton( this, SVX_RES( SF_PB_HELP ) ),
+ m_sLanguage( language ),
+ m_delErrStr( SVX_RES( RID_SVXSTR_DELFAILED ) ),
+ m_delErrTitleStr( SVX_RES( RID_SVXSTR_DELFAILED_TITLE ) ),
+ m_delQueryStr( SVX_RES( RID_SVXSTR_DELQUERY ) ),
+ m_delQueryTitleStr( SVX_RES( RID_SVXSTR_DELQUERY_TITLE ) ) ,
+ m_createErrStr( SVX_RES ( RID_SVXSTR_CREATEFAILED ) ),
+ m_createDupStr( SVX_RES ( RID_SVXSTR_CREATEFAILEDDUP ) ),
+ m_createErrTitleStr( SVX_RES( RID_SVXSTR_CREATEFAILED_TITLE ) ),
+ m_renameErrStr( SVX_RES ( RID_SVXSTR_RENAMEFAILED ) ),
+ m_renameErrTitleStr( SVX_RES( RID_SVXSTR_RENAMEFAILED_TITLE ) )
+{
+
+ // must be a neater way to deal with the strings than as above
+ // append the language to the dialog title
+ String winTitle( GetText() );
+ winTitle.SearchAndReplace( String::CreateFromAscii( "%MACROLANG" ), language.pData->buffer );
+ SetText( winTitle );
+
+ aScriptsBox.SetSelectHdl( LINK( this, SvxScriptOrgDialog, ScriptSelectHdl ) );
+ aRunButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) );
+ aCloseButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) );
+ aRenameButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) );
+ aEditButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) );
+ aDelButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) );
+ aCreateButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) );
+
+ aRunButton.Disable();
+ aRenameButton.Disable();
+ aEditButton.Disable();
+ aDelButton.Disable();
+ aCreateButton.Disable();
+
+ aScriptsBox.Init( m_sLanguage );
+ RestorePreviousSelection();
+ FreeResource();
+}
+
+__EXPORT SvxScriptOrgDialog::~SvxScriptOrgDialog()
+{
+ // clear the SelectHdl so that it isn't called during the dtor
+ aScriptsBox.SetSelectHdl( Link() );
+};
+
+short SvxScriptOrgDialog::Execute()
+{
+
+ SfxObjectShell *pDoc = SfxObjectShell::GetFirst();
+
+ // force load of MSPs for all documents
+ while ( pDoc )
+ {
+ Reference< provider::XScriptProviderSupplier > xSPS =
+ Reference< provider::XScriptProviderSupplier >
+ ( pDoc->GetModel(), UNO_QUERY );
+ if ( xSPS.is() )
+ {
+ Reference< provider::XScriptProvider > ScriptProvider =
+ xSPS->getScriptProvider();
+ }
+
+ pDoc = SfxObjectShell::GetNext(*pDoc);
+ }
+ aScriptsBox.ExpandAllTrees();
+
+ Window* pPrevDlgParent = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( this );
+ short nRet = ModalDialog::Execute();
+ Application::SetDefDialogParent( pPrevDlgParent );
+ return nRet;
+}
+
+void SvxScriptOrgDialog::EnableButton( Button& , BOOL )
+{
+}
+
+void SvxScriptOrgDialog::CheckButtons( Reference< browse::XBrowseNode >& node )
+{
+ if ( node.is() )
+ {
+ if ( node->getType() == browse::BrowseNodeTypes::SCRIPT)
+ {
+ aRunButton.Enable();
+ }
+ else
+ {
+ aRunButton.Disable();
+ }
+ Reference< beans::XPropertySet > xProps( node, UNO_QUERY );
+
+ if ( !xProps.is() )
+ {
+ aEditButton.Disable();
+ aDelButton.Disable();
+ aCreateButton.Disable();
+ aRunButton.Disable();
+ return;
+ }
+
+ ::rtl::OUString sName;
+ sName = String::CreateFromAscii("Editable") ;
+
+ if ( getBoolProperty( xProps, sName ) )
+ {
+ aEditButton.Enable();
+ }
+ else
+ {
+ aEditButton.Disable();
+ }
+
+ sName = String::CreateFromAscii("Deletable") ;
+
+ if ( getBoolProperty( xProps, sName ) )
+ {
+ aDelButton.Enable();
+ }
+ else
+ {
+ aDelButton.Disable();
+ }
+
+ sName = String::CreateFromAscii("Creatable") ;
+
+ if ( getBoolProperty( xProps, sName ) )
+ {
+ aCreateButton.Enable();
+ }
+ else
+ {
+ aCreateButton.Disable();
+ }
+
+ sName = String::CreateFromAscii("Renamable") ;
+
+ if ( getBoolProperty( xProps, sName ) )
+ {
+ aRenameButton.Enable();
+ }
+ else
+ {
+ aRenameButton.Disable();
+ }
+ }
+ else
+ {
+ // no node info available, disable all configurable actions
+ aDelButton.Disable();
+ aCreateButton.Disable();
+ aEditButton.Disable();
+ aRunButton.Disable();
+ aRenameButton.Disable();
+ }
+}
+
+IMPL_LINK_INLINE_START( SvxScriptOrgDialog, MacroDoubleClickHdl, SvTreeListBox *, EMPTYARG )
+{
+ return 0;
+}
+
+IMPL_LINK_INLINE_END( SvxScriptOrgDialog, MacroDoubleClickHdl, SvTreeListBox *, EMPTYARG )
+
+IMPL_LINK( SvxScriptOrgDialog, ScriptSelectHdl, SvTreeListBox *, pBox )
+{
+ if ( !pBox->IsSelected( pBox->GetHdlEntry() ) )
+ {
+ return 0;
+ }
+
+ SvLBoxEntry* pEntry = pBox->GetHdlEntry();
+
+ SFEntry* userData = 0;
+ if ( !pEntry )
+ {
+ return 0;
+ }
+ userData = (SFEntry*)pEntry->GetUserData();
+
+ Reference< browse::XBrowseNode > node;
+ if ( userData )
+ {
+ node = userData->GetNode();
+ CheckButtons( node );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxScriptOrgDialog, ButtonHdl, Button *, pButton )
+{
+ if ( pButton == &aCloseButton )
+ {
+ StoreCurrentSelection();
+ EndDialog( 0 );
+ }
+ if ( pButton == &aEditButton ||
+ pButton == &aCreateButton ||
+ pButton == &aDelButton ||
+ pButton == &aRunButton ||
+ pButton == &aRenameButton )
+
+ {
+ if ( aScriptsBox.IsSelected( aScriptsBox.GetHdlEntry() ) )
+ {
+ SvLBoxEntry* pEntry = aScriptsBox.GetHdlEntry();
+ SFEntry* userData = 0;
+ if ( !pEntry )
+ {
+ return 0;
+ }
+ userData = (SFEntry*)pEntry->GetUserData();
+ if ( userData )
+ {
+ Reference< browse::XBrowseNode > node;
+ Reference< XModel > xModel;
+
+ node = userData->GetNode();
+ xModel = userData->GetModel();
+
+ if ( !node.is() )
+ {
+ return 0;
+ }
+
+ if ( pButton == &aRunButton )
+ {
+ ::rtl::OUString tmpString;
+ Reference< beans::XPropertySet > xProp( node, UNO_QUERY );
+ Reference< provider::XScriptProvider > mspNode;
+ if( !xProp.is() )
+ {
+ return 0;
+ }
+
+ if ( xModel.is() )
+ {
+ Reference< XEmbeddedScripts > xEmbeddedScripts( xModel, UNO_QUERY);
+ if( !xEmbeddedScripts.is() )
+ {
+ return 0;
+ }
+
+ if (!xEmbeddedScripts->getAllowMacroExecution())
+ {
+ // Please FIXME: Show a message box if AllowMacroExecution is false
+ return 0;
+ }
+ }
+
+
+ SvLBoxEntry* pParent = aScriptsBox.GetParent( pEntry );
+ while ( pParent && !mspNode.is() )
+ {
+ SFEntry* mspUserData = (SFEntry*)pParent->GetUserData();
+ mspNode.set( mspUserData->GetNode() , UNO_QUERY );
+ pParent = aScriptsBox.GetParent( pParent );
+ }
+ xProp->getPropertyValue( String::CreateFromAscii("URI" ) ) >>= tmpString;
+ const String scriptURL( tmpString );
+
+ if ( mspNode.is() )
+ {
+ try
+ {
+ Reference< provider::XScript > xScript(
+ mspNode->getScript( scriptURL ), UNO_QUERY_THROW );
+
+ const Sequence< Any > args(0);
+ Any aRet;
+ Sequence< sal_Int16 > outIndex;
+ Sequence< Any > outArgs( 0 );
+ aRet = xScript->invoke( args, outIndex, outArgs );
+ }
+ catch ( reflection::InvocationTargetException& ite )
+ {
+ ::com::sun::star::uno::Any a = makeAny(ite);
+ ShowErrorDialog(a);
+ }
+ catch ( provider::ScriptFrameworkErrorException& ite )
+ {
+ ::com::sun::star::uno::Any a = makeAny(ite);
+ ShowErrorDialog(a);
+ }
+ catch ( RuntimeException& re )
+ {
+ ::com::sun::star::uno::Any a = makeAny(re);
+ ShowErrorDialog(a);
+ }
+ catch ( Exception& e )
+ {
+ ::com::sun::star::uno::Any a = makeAny(e);
+ ShowErrorDialog(a);
+ }
+ }
+ StoreCurrentSelection();
+ EndDialog( 0 );
+ }
+ else if ( pButton == &aEditButton )
+ {
+ Reference< script::XInvocation > xInv( node, UNO_QUERY );
+ if ( xInv.is() )
+ {
+ StoreCurrentSelection();
+ EndDialog( 0 );
+ Sequence< Any > args(0);
+ Sequence< Any > outArgs( 0 );
+ Sequence< sal_Int16 > outIndex;
+ try
+ {
+ // ISSUE need code to run script here
+ xInv->invoke( ::rtl::OUString::createFromAscii( "Editable" ), args, outIndex, outArgs );
+ }
+ catch( Exception& e )
+ {
+ OSL_TRACE("Caught exception trying to invoke %s", ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+
+ }
+ }
+ }
+ else if ( pButton == &aCreateButton )
+ {
+ createEntry( pEntry );
+ }
+ else if ( pButton == &aDelButton )
+ {
+ deleteEntry( pEntry );
+ }
+ else if ( pButton == &aRenameButton )
+ {
+ renameEntry( pEntry );
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+Reference< browse::XBrowseNode > SvxScriptOrgDialog::getBrowseNode( SvLBoxEntry* pEntry )
+{
+ Reference< browse::XBrowseNode > node;
+ if ( pEntry )
+ {
+ SFEntry* userData = (SFEntry*)pEntry->GetUserData();
+ if ( userData )
+ {
+ node = userData->GetNode();
+ }
+ }
+
+ return node;
+}
+
+Reference< XModel > SvxScriptOrgDialog::getModel( SvLBoxEntry* pEntry )
+{
+ Reference< XModel > model;
+ if ( pEntry )
+ {
+ SFEntry* userData = (SFEntry*)pEntry->GetUserData();
+ if ( userData )
+ {
+ model = userData->GetModel();
+ }
+ }
+
+ return model;
+}
+
+Reference< XInterface >
+SvxScriptOrgDialog::getDocumentModel( Reference< XComponentContext >& xCtx, ::rtl::OUString& docName )
+{
+ Reference< XInterface > xModel;
+ Reference< lang::XMultiComponentFactory > mcf =
+ xCtx->getServiceManager();
+ Reference< frame::XDesktop > desktop (
+ mcf->createInstanceWithContext(
+ ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx ),
+ UNO_QUERY );
+
+ Reference< container::XEnumerationAccess > componentsAccess =
+ desktop->getComponents();
+ Reference< container::XEnumeration > components =
+ componentsAccess->createEnumeration();
+ while (components->hasMoreElements())
+ {
+ Reference< frame::XModel > model(
+ components->nextElement(), UNO_QUERY );
+ if ( model.is() )
+ {
+ ::rtl::OUString sTdocUrl = ::comphelper::DocumentInfo::getDocumentTitle( model );
+ if( sTdocUrl.equals( docName ) )
+ {
+ xModel = model;
+ break;
+ }
+ }
+ }
+ return xModel;
+}
+
+void SvxScriptOrgDialog::createEntry( SvLBoxEntry* pEntry )
+{
+
+ Reference< browse::XBrowseNode > aChildNode;
+ Reference< browse::XBrowseNode > node = getBrowseNode( pEntry );
+ Reference< script::XInvocation > xInv( node, UNO_QUERY );
+
+ if ( xInv.is() )
+ {
+ ::rtl::OUString aNewName;
+ ::rtl::OUString aNewStdName;
+ USHORT nMode = INPUTMODE_NEWLIB;
+ if( aScriptsBox.GetModel()->GetDepth( pEntry ) == 0 )
+ {
+ aNewStdName = ::rtl::OUString::createFromAscii( "Library" ) ;
+ }
+ else
+ {
+ aNewStdName = ::rtl::OUString::createFromAscii( "Macro" ) ;
+ nMode = INPUTMODE_NEWMACRO;
+ }
+ //do we need L10N for this? ie somethng like:
+ //String aNewStdName( ResId( STR_STDMODULENAME ) );
+ BOOL bValid = FALSE;
+ USHORT i = 1;
+
+ Sequence< Reference< browse::XBrowseNode > > childNodes;
+ // no children => ok to create Parcel1 or Script1 without checking
+ try
+ {
+ if( node->hasChildNodes() == sal_False )
+ {
+ aNewName = aNewStdName;
+ aNewName += String::CreateFromInt32( i );
+ bValid = TRUE;
+ }
+ else
+ {
+ childNodes = node->getChildNodes();
+ }
+ }
+ catch ( Exception& )
+ {
+ // ignore, will continue on with empty sequence
+ }
+
+ ::rtl::OUString extn;
+ while ( !bValid )
+ {
+ aNewName = aNewStdName;
+ aNewName += String::CreateFromInt32( i );
+ BOOL bFound = FALSE;
+ if(childNodes.getLength() > 0 )
+ {
+ ::rtl::OUString nodeName = childNodes[0]->getName();
+ sal_Int32 extnPos = nodeName.lastIndexOf( '.' );
+ if(extnPos>0)
+ extn = nodeName.copy(extnPos);
+ }
+ for( sal_Int32 index = 0; index < childNodes.getLength(); index++ )
+ {
+ if ( (aNewName+extn).equals( childNodes[index]->getName() ) )
+ {
+ bFound = TRUE;
+ break;
+ }
+ }
+ if( bFound )
+ {
+ i++;
+ }
+ else
+ {
+ bValid = TRUE;
+ }
+ }
+
+ std::auto_ptr< InputDialog > xNewDlg( new InputDialog( static_cast<Window*>(this), nMode ) );
+ xNewDlg->SetObjectName( aNewName );
+
+ do
+ {
+ if ( xNewDlg->Execute() && xNewDlg->GetObjectName().Len() )
+ {
+ ::rtl::OUString aUserSuppliedName = xNewDlg->GetObjectName();
+ bValid = TRUE;
+ for( sal_Int32 index = 0; index < childNodes.getLength(); index++ )
+ {
+ if ( (aUserSuppliedName+extn).equals( childNodes[index]->getName() ) )
+ {
+ bValid = FALSE;
+ String aError( m_createErrStr );
+ aError.Append( m_createDupStr );
+ ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, aError );
+ aErrorBox.SetText( m_createErrTitleStr );
+ aErrorBox.Execute();
+ xNewDlg->SetObjectName( aNewName );
+ break;
+ }
+ }
+ if( bValid )
+ aNewName = aUserSuppliedName;
+ }
+ else
+ {
+ // user hit cancel or hit OK with nothing in the editbox
+
+ return;
+ }
+ }
+ while ( !bValid );
+
+ // open up parent node (which ensures it's loaded)
+ aScriptsBox.RequestingChilds( pEntry );
+
+ Sequence< Any > args( 1 );
+ args[ 0 ] <<= aNewName;
+ Sequence< Any > outArgs( 0 );
+ Sequence< sal_Int16 > outIndex;
+ try
+ {
+ Any aResult;
+ aResult = xInv->invoke( ::rtl::OUString::createFromAscii( "Creatable" ), args, outIndex, outArgs );
+ Reference< browse::XBrowseNode > newNode( aResult, UNO_QUERY );
+ aChildNode = newNode;
+
+ }
+ catch( Exception& e )
+ {
+ OSL_TRACE("Caught exception trying to Create %s",
+ ::rtl::OUStringToOString(
+ e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ }
+ }
+ if ( aChildNode.is() )
+ {
+ String aChildName = aChildNode->getName();
+ SvLBoxEntry* pNewEntry = NULL;
+
+
+ ::rtl::OUString name( aChildName );
+ Reference<XModel> xDocumentModel = getModel( pEntry );
+
+ // ISSUE do we need to remove all entries for parent
+ // to achieve sort? Just need to determine position
+ // SvTreeListBox::InsertEntry can take position arg
+ // -- Basic doesn't do this on create.
+ // Suppose we could avoid this too. -> created nodes are
+ // not in alphabetical order
+ if ( aChildNode->getType() == browse::BrowseNodeTypes::SCRIPT )
+ {
+ pNewEntry = aScriptsBox.insertEntry( aChildName,
+ IMG_MACRO, pEntry, false, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_METHOD, aChildNode,xDocumentModel ) ) );
+
+ }
+ else
+ {
+ pNewEntry = aScriptsBox.insertEntry( aChildName,
+ IMG_LIB, pEntry, false, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SCRIPTCONTAINER, aChildNode,xDocumentModel ) ) );
+ // If the Parent is not loaded then set to
+ // loaded, this will prevent RequestingChilds ( called
+ // from vcl via RequestingChilds ) from
+ // creating new ( duplicate ) children
+ SFEntry* userData = (SFEntry*)pEntry->GetUserData();
+ if ( userData && !userData->isLoaded() )
+ {
+ userData->setLoaded();
+ }
+ }
+ aScriptsBox.SetCurEntry( pNewEntry );
+ aScriptsBox.Select( aScriptsBox.GetCurEntry() );
+
+ }
+ else
+ {
+ //ISSUE L10N & message from exception?
+ String aError( m_createErrStr );
+ ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, aError );
+ aErrorBox.SetText( m_createErrTitleStr );
+ aErrorBox.Execute();
+ }
+}
+
+void SvxScriptOrgDialog::renameEntry( SvLBoxEntry* pEntry )
+{
+
+ Reference< browse::XBrowseNode > aChildNode;
+ Reference< browse::XBrowseNode > node = getBrowseNode( pEntry );
+ Reference< script::XInvocation > xInv( node, UNO_QUERY );
+
+ if ( xInv.is() )
+ {
+ ::rtl::OUString aNewName = node->getName();
+ sal_Int32 extnPos = aNewName.lastIndexOf( '.' );
+ ::rtl::OUString extn;
+ if(extnPos>0)
+ {
+ extn = aNewName.copy(extnPos);
+ aNewName = aNewName.copy(0,extnPos);
+ }
+ USHORT nMode = INPUTMODE_RENAME;
+
+ std::auto_ptr< InputDialog > xNewDlg( new InputDialog( static_cast<Window*>(this), nMode ) );
+ xNewDlg->SetObjectName( aNewName );
+
+ BOOL bValid;
+ do
+ {
+ if ( xNewDlg->Execute() && xNewDlg->GetObjectName().Len() )
+ {
+ ::rtl::OUString aUserSuppliedName = xNewDlg->GetObjectName();
+ bValid = TRUE;
+ /*
+ for( sal_Int32 index = 0; index < childNodes.getLength(); index++ )
+ {
+ if ( (aUserSuppliedName+extn).equals( childNodes[index]->getName() ) )
+ {
+ bValid = FALSE;
+ String aError( m_createErrStr );
+ aError.Append( m_createDupStr );
+ ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, aError );
+ aErrorBox.SetText( m_createErrTitleStr );
+ aErrorBox.Execute();
+ xNewDlg->SetObjectName( aNewName );
+ break;
+ }
+ } */
+ if( bValid )
+ aNewName = aUserSuppliedName;
+ }
+ else
+ {
+ // user hit cancel or hit OK with nothing in the editbox
+ return;
+ }
+ }
+ while ( !bValid );
+
+ Sequence< Any > args( 1 );
+ args[ 0 ] <<= aNewName;
+ Sequence< Any > outArgs( 0 );
+ Sequence< sal_Int16 > outIndex;
+ try
+ {
+ Any aResult;
+ aResult = xInv->invoke( ::rtl::OUString::createFromAscii( "Renamable" ), args, outIndex, outArgs );
+ Reference< browse::XBrowseNode > newNode( aResult, UNO_QUERY );
+ aChildNode = newNode;
+
+ }
+ catch( Exception& e )
+ {
+ OSL_TRACE("Caught exception trying to Rename %s",
+ ::rtl::OUStringToOString(
+ e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ }
+ }
+ if ( aChildNode.is() )
+ {
+ aScriptsBox.SetEntryText( pEntry, aChildNode->getName() );
+ aScriptsBox.SetCurEntry( pEntry );
+ aScriptsBox.Select( aScriptsBox.GetCurEntry() );
+
+ }
+ else
+ {
+ //ISSUE L10N & message from exception?
+ String aError( m_renameErrStr );
+ ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, aError );
+ aErrorBox.SetText( m_renameErrTitleStr );
+ aErrorBox.Execute();
+ }
+}
+void SvxScriptOrgDialog::deleteEntry( SvLBoxEntry* pEntry )
+{
+ sal_Bool result = sal_False;
+ Reference< browse::XBrowseNode > node = getBrowseNode( pEntry );
+ // ISSUE L10N string & can we centre list?
+ String aQuery( m_delQueryStr );
+ aQuery.Append( getListOfChildren( node, 0 ) );
+ QueryBox aQueryBox( static_cast<Window*>(this), WB_YES_NO | WB_DEF_YES, aQuery );
+ aQueryBox.SetText( m_delQueryTitleStr );
+ if ( aQueryBox.Execute() == RET_NO )
+ {
+ return;
+ }
+
+ Reference< script::XInvocation > xInv( node, UNO_QUERY );
+ if ( xInv.is() )
+ {
+ Sequence< Any > args( 0 );
+ Sequence< Any > outArgs( 0 );
+ Sequence< sal_Int16 > outIndex;
+ try
+ {
+ Any aResult;
+ aResult = xInv->invoke( ::rtl::OUString::createFromAscii( "Deletable" ), args, outIndex, outArgs );
+ aResult >>= result; // or do we just assume true if no exception ?
+ }
+ catch( Exception& e )
+ {
+ OSL_TRACE("Caught exception trying to delete %s",
+ ::rtl::OUStringToOString(
+ e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ }
+ }
+
+ if ( result == sal_True )
+ {
+ aScriptsBox.deleteTree( pEntry );
+ aScriptsBox.GetModel()->Remove( pEntry );
+ }
+ else
+ {
+ //ISSUE L10N & message from exception?
+ ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, m_delErrStr );
+ aErrorBox.SetText( m_delErrTitleStr );
+ aErrorBox.Execute();
+ }
+
+}
+
+BOOL SvxScriptOrgDialog::getBoolProperty( Reference< beans::XPropertySet >& xProps,
+ ::rtl::OUString& propName )
+{
+ BOOL result = false;
+ try
+ {
+ sal_Bool bTemp = sal_False;
+ xProps->getPropertyValue( propName ) >>= bTemp;
+ result = ( bTemp == sal_True );
+ }
+ catch ( Exception& )
+ {
+ return result;
+ }
+ return result;
+}
+
+String SvxScriptOrgDialog::getListOfChildren( Reference< browse::XBrowseNode > node, int depth )
+{
+ String result;
+ result.Append( String::CreateFromAscii( "\n" ) );
+ for( int i=0;i<=depth;i++ )
+ {
+ result.Append( String::CreateFromAscii( "\t" ) );
+ }
+ result.Append( String( node->getName() ) );
+
+ try
+ {
+ if ( node->hasChildNodes() == sal_True )
+ {
+ Sequence< Reference< browse::XBrowseNode > > children
+ = node->getChildNodes();
+ for ( sal_Int32 n = 0; n < children.getLength(); n++ )
+ {
+ result.Append( getListOfChildren( children[ n ] , depth+1 ) );
+ }
+ }
+ }
+ catch ( Exception& )
+ {
+ // ignore, will return an empty string
+ }
+
+ return result;
+}
+
+Selection_hash SvxScriptOrgDialog::m_lastSelection;
+
+void SvxScriptOrgDialog::StoreCurrentSelection()
+{
+ String aDescription;
+ if ( aScriptsBox.IsSelected( aScriptsBox.GetHdlEntry() ) )
+ {
+ SvLBoxEntry* pEntry = aScriptsBox.GetHdlEntry();
+ while( pEntry )
+ {
+ aDescription.Insert( aScriptsBox.GetEntryText( pEntry ), 0 );
+ pEntry = aScriptsBox.GetParent( pEntry );
+ if ( pEntry )
+ aDescription.Insert( ';', 0 );
+ }
+ ::rtl::OUString sDesc( aDescription );
+ m_lastSelection[ m_sLanguage ] = sDesc;
+ }
+}
+
+void SvxScriptOrgDialog::RestorePreviousSelection()
+{
+ String aStoredEntry = String( m_lastSelection[ m_sLanguage ] );
+ if( aStoredEntry.Len() <= 0 )
+ return;
+ SvLBoxEntry* pEntry = 0;
+ USHORT nIndex = 0;
+ while ( nIndex != STRING_NOTFOUND )
+ {
+ String aTmp( aStoredEntry.GetToken( 0, ';', nIndex ) );
+ SvLBoxEntry* pTmpEntry = aScriptsBox.FirstChild( pEntry );
+ ::rtl::OUString debugStr(aTmp);
+ while ( pTmpEntry )
+ {
+ debugStr = ::rtl::OUString(aScriptsBox.GetEntryText( pTmpEntry ));
+ if ( aScriptsBox.GetEntryText( pTmpEntry ) == aTmp )
+ {
+ pEntry = pTmpEntry;
+ break;
+ }
+ pTmpEntry = aScriptsBox.NextSibling( pTmpEntry );
+ }
+ if ( !pTmpEntry )
+ break;
+ aScriptsBox.RequestingChilds( pEntry );
+ }
+ aScriptsBox.SetCurEntry( pEntry );
+}
+
+BOOL SFTreeListBox::dialogSort1( Reference< browse::XBrowseNode > node1,
+ Reference< browse::XBrowseNode > node2 )
+{
+ ::rtl::OUString userStr = ::rtl::OUString::createFromAscii("user");
+ ::rtl::OUString shareStr = ::rtl::OUString::createFromAscii("share");
+ if( node1->getName().equals( userStr ) )
+ return true;
+ if( node2->getName().equals( userStr ) )
+ return false;
+ if( node1->getName().equals( shareStr ) )
+ return true;
+ if( node2->getName().equals( shareStr ) )
+ return false;
+ return dialogSort2( node1, node2 );
+}
+
+BOOL SFTreeListBox::dialogSort2( Reference< browse::XBrowseNode > node1,
+ Reference< browse::XBrowseNode > node2 )
+{
+ return ( node1->getName().compareTo( node2->getName() ) < 0 );
+}
+
+::rtl::OUString ReplaceString(
+ const ::rtl::OUString& source,
+ const ::rtl::OUString& token,
+ const ::rtl::OUString& value )
+{
+ sal_Int32 pos = source.indexOf( token );
+
+ if ( pos != -1 && value.getLength() != 0 )
+ {
+ return source.replaceAt( pos, token.getLength(), value );
+ }
+ else
+ {
+ return source;
+ }
+}
+
+::rtl::OUString FormatErrorString(
+ const ::rtl::OUString& unformatted,
+ const ::rtl::OUString& language,
+ const ::rtl::OUString& script,
+ const ::rtl::OUString& line,
+ const ::rtl::OUString& type,
+ const ::rtl::OUString& message )
+{
+ ::rtl::OUString result = unformatted.copy( 0 );
+
+ result = ReplaceString(
+ result, ::rtl::OUString::createFromAscii( "%LANGUAGENAME" ), language );
+ result = ReplaceString(
+ result, ::rtl::OUString::createFromAscii( "%SCRIPTNAME" ), script );
+ result = ReplaceString(
+ result, ::rtl::OUString::createFromAscii( "%LINENUMBER" ), line );
+
+ if ( type.getLength() != 0 )
+ {
+ result += ::rtl::OUString::createFromAscii( "\n\n" );
+ result += ::rtl::OUString(String(SVX_RES(RID_SVXSTR_ERROR_TYPE_LABEL)));
+ result += ::rtl::OUString::createFromAscii( " " );
+ result += type;
+ }
+
+ if ( message.getLength() != 0 )
+ {
+ result += ::rtl::OUString::createFromAscii( "\n\n" );
+ result += ::rtl::OUString(String(SVX_RES(RID_SVXSTR_ERROR_MESSAGE_LABEL)));
+ result += ::rtl::OUString::createFromAscii( " " );
+ result += message;
+ }
+
+ return result;
+}
+
+::rtl::OUString GetErrorMessage(
+ const provider::ScriptErrorRaisedException& eScriptError )
+{
+ ::rtl::OUString unformatted = String( SVX_RES( RID_SVXSTR_ERROR_AT_LINE ) );
+
+ ::rtl::OUString unknown = ::rtl::OUString::createFromAscii( "UNKNOWN" );
+ ::rtl::OUString language = unknown;
+ ::rtl::OUString script = unknown;
+ ::rtl::OUString line = unknown;
+ ::rtl::OUString type = ::rtl::OUString();
+ ::rtl::OUString message = eScriptError.Message;
+
+ if ( eScriptError.language.getLength() != 0 )
+ {
+ language = eScriptError.language;
+ }
+
+ if ( eScriptError.scriptName.getLength() != 0 )
+ {
+ script = eScriptError.scriptName;
+ }
+
+ if ( eScriptError.Message.getLength() != 0 )
+ {
+ message = eScriptError.Message;
+ }
+ if ( eScriptError.lineNum != -1 )
+ {
+ line = ::rtl::OUString::valueOf( eScriptError.lineNum );
+ unformatted = String(
+ SVX_RES( RID_SVXSTR_ERROR_AT_LINE ) );
+ }
+ else
+ {
+ unformatted = String(
+ SVX_RES( RID_SVXSTR_ERROR_RUNNING ) );
+ }
+
+ return FormatErrorString(
+ unformatted, language, script, line, type, message );
+}
+
+::rtl::OUString GetErrorMessage(
+ const provider::ScriptExceptionRaisedException& eScriptException )
+{
+ ::rtl::OUString unformatted =
+ String( SVX_RES( RID_SVXSTR_EXCEPTION_AT_LINE ) );
+
+ ::rtl::OUString unknown = ::rtl::OUString::createFromAscii( "UNKNOWN" );
+ ::rtl::OUString language = unknown;
+ ::rtl::OUString script = unknown;
+ ::rtl::OUString line = unknown;
+ ::rtl::OUString type = unknown;
+ ::rtl::OUString message = eScriptException.Message;
+
+ if ( eScriptException.language.getLength() != 0 )
+ {
+ language = eScriptException.language;
+ }
+ if ( eScriptException.scriptName.getLength() != 0 )
+ {
+ script = eScriptException.scriptName;
+ }
+
+ if ( eScriptException.Message.getLength() != 0 )
+ {
+ message = eScriptException.Message;
+ }
+
+ if ( eScriptException.lineNum != -1 )
+ {
+ line = ::rtl::OUString::valueOf( eScriptException.lineNum );
+ unformatted = String(
+ SVX_RES( RID_SVXSTR_EXCEPTION_AT_LINE ) );
+ }
+ else
+ {
+ unformatted = String(
+ SVX_RES( RID_SVXSTR_EXCEPTION_RUNNING ) );
+ }
+
+ if ( eScriptException.exceptionType.getLength() != 0 )
+ {
+ type = eScriptException.exceptionType;
+ }
+
+ return FormatErrorString(
+ unformatted, language, script, line, type, message );
+
+}
+::rtl::OUString GetErrorMessage(
+ const provider::ScriptFrameworkErrorException& sError )
+{
+ ::rtl::OUString unformatted = String(
+ SVX_RES( RID_SVXSTR_FRAMEWORK_ERROR_RUNNING ) );
+
+ ::rtl::OUString language =
+ ::rtl::OUString::createFromAscii( "UNKNOWN" );
+
+ ::rtl::OUString script =
+ ::rtl::OUString::createFromAscii( "UNKNOWN" );
+
+ ::rtl::OUString message;
+
+ if ( sError.scriptName.getLength() > 0 )
+ {
+ script = sError.scriptName;
+ }
+ if ( sError.language.getLength() > 0 )
+ {
+ language = sError.language;
+ }
+ if ( sError.errorType == provider::ScriptFrameworkErrorType::NOTSUPPORTED )
+ {
+ message = String(
+ SVX_RES( RID_SVXSTR_ERROR_LANG_NOT_SUPPORTED ) );
+ message = ReplaceString(
+ message, ::rtl::OUString::createFromAscii( "%LANGUAGENAME" ), language );
+
+ }
+ else
+ {
+ message = sError.Message;
+ }
+ return FormatErrorString(
+ unformatted, language, script, ::rtl::OUString(), ::rtl::OUString(), message );
+}
+
+::rtl::OUString GetErrorMessage( const RuntimeException& re )
+{
+ Type t = ::getCppuType( &re );
+ ::rtl::OUString message = t.getTypeName();
+ message += re.Message;
+
+ return message;
+}
+
+::rtl::OUString GetErrorMessage( const Exception& e )
+{
+ Type t = ::getCppuType( &e );
+ ::rtl::OUString message = t.getTypeName();
+ message += e.Message;
+
+ return message;
+}
+
+::rtl::OUString GetErrorMessage( const com::sun::star::uno::Any& aException )
+{
+ ::rtl::OUString exType;
+ if ( aException.getValueType() ==
+ ::getCppuType( (const reflection::InvocationTargetException* ) NULL ) )
+ {
+ reflection::InvocationTargetException ite;
+ aException >>= ite;
+ if ( ite.TargetException.getValueType() == ::getCppuType( ( const provider::ScriptErrorRaisedException* ) NULL ) )
+ {
+ // Error raised by script
+ provider::ScriptErrorRaisedException scriptError;
+ ite.TargetException >>= scriptError;
+ return GetErrorMessage( scriptError );
+ }
+ else if ( ite.TargetException.getValueType() == ::getCppuType( ( const provider::ScriptExceptionRaisedException* ) NULL ) )
+ {
+ // Exception raised by script
+ provider::ScriptExceptionRaisedException scriptException;
+ ite.TargetException >>= scriptException;
+ return GetErrorMessage( scriptException );
+ }
+ else
+ {
+ // Unknown error, shouldn't happen
+ // OSL_ASSERT(...)
+ }
+
+ }
+ else if ( aException.getValueType() == ::getCppuType( ( const provider::ScriptFrameworkErrorException* ) NULL ) )
+ {
+ // A Script Framework error has occured
+ provider::ScriptFrameworkErrorException sfe;
+ aException >>= sfe;
+ return GetErrorMessage( sfe );
+
+ }
+ // unknown exception
+ Exception e;
+ RuntimeException rte;
+ if ( aException >>= rte )
+ {
+ return GetErrorMessage( rte );
+ }
+
+ aException >>= e;
+ return GetErrorMessage( e );
+
+}
+
+SvxScriptErrorDialog::SvxScriptErrorDialog(
+ Window* , ::com::sun::star::uno::Any aException )
+ : m_sMessage()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ m_sMessage = GetErrorMessage( aException );
+}
+
+SvxScriptErrorDialog::~SvxScriptErrorDialog()
+{
+}
+
+short SvxScriptErrorDialog::Execute()
+{
+ // Show Error dialog asynchronously
+ //
+ // Pass a copy of the message to the ShowDialog method as the
+ // SvxScriptErrorDialog may be deleted before ShowDialog is called
+ Application::PostUserEvent(
+ LINK( this, SvxScriptErrorDialog, ShowDialog ),
+ new rtl::OUString( m_sMessage ) );
+
+ return 0;
+}
+
+IMPL_LINK( SvxScriptErrorDialog, ShowDialog, ::rtl::OUString*, pMessage )
+{
+ ::rtl::OUString message;
+
+ if ( pMessage && pMessage->getLength() != 0 )
+ {
+ message = *pMessage;
+ }
+ else
+ {
+ message = String( SVX_RES( RID_SVXSTR_ERROR_TITLE ) );
+ }
+
+ MessBox* pBox = new WarningBox( NULL, WB_OK, message );
+ pBox->SetText( SVX_RES( RID_SVXSTR_ERROR_TITLE ) );
+ pBox->Execute();
+
+ if ( pBox ) delete pBox;
+ if ( pMessage ) delete pMessage;
+
+ return 0;
+}
diff --git a/cui/source/dialogs/scriptdlg.hrc b/cui/source/dialogs/scriptdlg.hrc
new file mode 100644
index 000000000000..0079037c7680
--- /dev/null
+++ b/cui/source/dialogs/scriptdlg.hrc
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: scriptdlg.hrc,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SCRIPTDLG_HRC
+#define _SCRIPTDLG_HRC
+
+#include <svl/solar.hrc>
+
+#define SCRIPTDLG_OFFSET 400
+
+// ScriptOrgDialog
+#define SF_TXT_SCRIPTS 1
+#define SF_CTRL_SCRIPTSBOX 2
+#define SF_PB_RUN 3
+#define SF_PB_CLOSE 4
+#define SF_PB_CREATE 5
+#define SF_PB_EDIT 6
+#define SF_PB_RENAME 7
+#define SF_PB_DEL 8
+#define SF_PB_HELP 9
+
+#define IMG_HARDDISK 1
+#define IMG_HARDDISK_HC 2
+#define IMG_LIB 3
+#define IMG_LIB_HC 4
+#define IMG_MACRO 5
+#define IMG_MACRO_HC 6
+#define IMG_DOCUMENT 7
+#define IMG_DOCUMENT_HC 8
+
+#define RID_IMGLST_OBJECTS ( RID_BASICIDE_START + 7 )
+#define RID_IMGLST_OBJECTS_HC (RID_BASICIDE_START + 13)
+
+// NewObjectDialog
+#define FT_NEWLIB 10
+#define STR_FT_NEWMACRO 11
+#define STR_NEWLIB 12
+#define STR_NEWMACRO 13
+#define ED_LIBNAME 14
+#define PB_OK 15
+#define PB_CANCEL 16
+#define DLG_NEWLIB 17
+#define STR_FT_RENAME 18
+#define STR_RENAME 19
+
+// Others
+/*
+Please be aware that these strings are global resources, don't use self-defined values!
+You have to use the RID_SVXSTART macro do avoid ID clashes with other resource files. Sfx2 delivers
+some of its own resource files to svx - where they are added to svx resource file!!
+*/
+
+#define STR_MYMACROS 32
+#define STR_PRODMACROS 33
+
+
+#endif // _SCRIPTDLG_HRC
diff --git a/cui/source/dialogs/scriptdlg.src b/cui/source/dialogs/scriptdlg.src
new file mode 100644
index 000000000000..3c5b2739abfa
--- /dev/null
+++ b/cui/source/dialogs/scriptdlg.src
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * 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: scriptdlg.src,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "scriptdlg.hrc"
+#include "helpid.hrc"
+
+#define MASKCOLOR MaskColor = \
+ Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+ModalDialog RID_DLG_SCRIPTORGANIZER
+{
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 210 , 165 ) ;
+ Moveable = TRUE ;
+ Text [ en-US ] = "%MACROLANG Macros";
+ Closeable = TRUE ;
+ HelpId = HID_SCRIPTORG_DIALOG;
+ FixedText SF_TXT_SCRIPTS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "~Macros" ;
+ };
+
+ Control SF_CTRL_SCRIPTSBOX
+ {
+ HelpId = HID_SCRIPTSBOX ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 16 ) ;
+ Size = MAP_APPFONT ( 130 , 144 ) ;
+ TabStop = TRUE ;
+ Image IMG_HARDDISK
+ {
+ ImageBitmap = Bitmap { File = "harddisk_16.bmp" ; };
+ MASKCOLOR
+ };
+ Image IMG_HARDDISK_HC
+ {
+ ImageBitmap = Bitmap { File = "harddisk_16_h.bmp" ; };
+ MASKCOLOR
+ };
+ Image IMG_LIB
+ {
+ ImageBitmap = Bitmap { File = "im30820.png"; };
+ MASKCOLOR
+ };
+ Image IMG_LIB_HC
+ {
+ ImageBitmap = Bitmap { File = "imh30820.png"; };
+ MASKCOLOR
+ };
+ Image IMG_MACRO
+ {
+ ImageBitmap = Bitmap { File = "im30821.png"; };
+ MASKCOLOR
+ };
+ Image IMG_MACRO_HC
+ {
+ ImageBitmap = Bitmap { File = "imh30821.png"; };
+ MASKCOLOR
+ };
+ Image IMG_DOCUMENT
+ {
+ ImageBitmap = Bitmap { File = "im30826.png"; };
+ MASKCOLOR
+ };
+ Image IMG_DOCUMENT_HC
+ {
+ ImageBitmap = Bitmap { File = "imh30826.png"; };
+ MASKCOLOR
+ };
+ String STR_MYMACROS
+ {
+ Text [ en-US ] = "My Macros";
+ };
+ String STR_PRODMACROS
+ {
+ Text [ en-US ] = "%PRODUCTNAME Macros";
+ };
+ };
+
+ PushButton SF_PB_RUN
+ {
+ Pos = MAP_APPFONT ( 144 , 6 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ DefButton = TRUE;
+ Text [ en-US ] = "R~un" ;
+ };
+ CancelButton SF_PB_CLOSE
+ {
+ Pos = MAP_APPFONT ( 144 , 23 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Close" ;
+ };
+
+ PushButton SF_PB_CREATE
+ {
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Pos = MAP_APPFONT ( 144 , 60 ) ;
+ Text [ en-US ] = "~Create..." ;
+ TabStop = TRUE ;
+ };
+ PushButton SF_PB_EDIT
+ {
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Pos = MAP_APPFONT ( 144 , 77 ) ;
+ Text [ en-US ] = "~Edit" ;
+ TabStop = TRUE ;
+ };
+ PushButton SF_PB_RENAME
+ {
+ Pos = MAP_APPFONT ( 144 , 94 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "Rename..." ;
+ };
+ PushButton SF_PB_DEL
+ {
+ Pos = MAP_APPFONT ( 144 , 114 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Delete..." ;
+ TabStop = TRUE ;
+ };
+ HelpButton SF_PB_HELP
+ {
+ Pos = MAP_APPFONT ( 144 , 131 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ TabStop = TRUE ;
+ };
+
+};
+ModalDialog RID_DLG_NEWLIB
+{
+ Text [ en-US ] = "Create Library" ;
+ Size = MAP_APPFONT ( 160 , 50 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 104 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 104 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_NEWLIB
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 100 , 50 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "Enter the name for the new library." ;
+ };
+ Edit ED_LIBNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 59 ) ;
+ Size = MAP_APPFONT ( 92 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_NEWLIB
+ {
+ Text [ en-US ] = "Create Library" ;
+ };
+ String STR_NEWMACRO
+ {
+ Text [ en-US ] = "Create Macro" ;
+ };
+ String STR_FT_NEWMACRO
+ {
+ Text [ en-US ] = "Enter the name for the new macro." ;
+ };
+ String STR_RENAME
+ {
+ Text [ en-US ] = "Rename" ;
+ };
+ String STR_FT_RENAME
+ {
+ Text [ en-US ] = "Enter the new name for the selected object." ;
+ };
+};
+String RID_SVXSTR_DELQUERY
+{
+ Text [ en-US ] = "Do you want to delete the following object?";
+};
+String RID_SVXSTR_DELQUERY_TITLE
+{
+ Text [ en-US ] = "Confirm Deletion";
+};
+String RID_SVXSTR_DELFAILED
+{
+ Text [ en-US ] = "The selected object could not be deleted.";
+};
+String RID_SVXSTR_DELFAILEDPERM
+{
+ Text [ en-US ] = " You do not have permission to delete this object.";
+};
+String RID_SVXSTR_DELFAILED_TITLE
+{
+ Text [ en-US ] = "Error Deleting Object";
+};
+String RID_SVXSTR_CREATEFAILED
+{
+ Text [ en-US ] = "The object could not be created.";
+};
+String RID_SVXSTR_CREATEFAILEDDUP
+{
+ Text [ en-US ] = " Object with the same name already exists.";
+};
+String RID_SVXSTR_CREATEFAILEDPERM
+{
+ Text [ en-US ] = " You do not have permission to create this object.";
+};
+String RID_SVXSTR_CREATEFAILED_TITLE
+{
+ Text [ en-US ] = "Error Creating Object";
+};
+String RID_SVXSTR_RENAMEFAILED
+{
+ Text [ en-US ] = "The object could not be renamed.";
+};
+String RID_SVXSTR_RENAMEFAILEDPERM
+{
+ Text [ en-US ] = " You do not have permission to rename this object.";
+};
+String RID_SVXSTR_RENAMEFAILED_TITLE
+{
+ Text [ en-US ] = "Error Renaming Object";
+};
+
+String RID_SVXSTR_ERROR_TITLE
+{
+ Text [ en-US ] = "%PRODUCTNAME Error";
+};
+
+String RID_SVXSTR_ERROR_LANG_NOT_SUPPORTED
+{
+ Text [ en-US ] = "The scripting language %LANGUAGENAME is not supported.";
+};
+String RID_SVXSTR_ERROR_RUNNING
+{
+ Text [ en-US ] = "An error occurred while running the %LANGUAGENAME script %SCRIPTNAME.";
+};
+
+String RID_SVXSTR_EXCEPTION_RUNNING
+{
+ Text [ en-US ] = "An exception occurred while running the %LANGUAGENAME script %SCRIPTNAME.";
+};
+
+String RID_SVXSTR_ERROR_AT_LINE
+{
+ Text [ en-US ] = "An error occurred while running the %LANGUAGENAME script %SCRIPTNAME at line: %LINENUMBER.";
+};
+
+String RID_SVXSTR_EXCEPTION_AT_LINE
+{
+ Text [ en-US ] = "An exception occurred while running the %LANGUAGENAME script %SCRIPTNAME at line: %LINENUMBER.";
+};
+
+String RID_SVXSTR_FRAMEWORK_ERROR_RUNNING
+{
+ Text [ en-US ] = "A Scripting Framework error occurred while running the %LANGUAGENAME script %SCRIPTNAME.";
+};
+
+String RID_SVXSTR_FRAMEWORK_ERROR_AT_LINE
+{
+ Text [ en-US ] = "A Scripting Framework error occurred while running the %LANGUAGENAME script %SCRIPTNAME at line: %LINENUMBER.";
+};
+
+String RID_SVXSTR_ERROR_TYPE_LABEL
+{
+ Text [ en-US ] = "Type:";
+};
+
+String RID_SVXSTR_ERROR_MESSAGE_LABEL
+{
+ Text [ en-US ] = "Message:";
+};
diff --git a/cui/source/dialogs/sdrcelldlg.cxx b/cui/source/dialogs/sdrcelldlg.cxx
new file mode 100644
index 000000000000..29fe21131b02
--- /dev/null
+++ b/cui/source/dialogs/sdrcelldlg.cxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrcelldlg.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <svl/cjkoptions.hxx>
+#include <svx/flagsdef.hxx>
+#include "svx/dialogs.hrc"
+#include "sdrcelldlg.hxx"
+#include "svx/dialmgr.hxx"
+#include "cuitabarea.hxx"
+#include "svx/svdmodel.hxx"
+#include "border.hxx"
+
+SvxFormatCellsDialog::SvxFormatCellsDialog( Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel )
+: SfxTabDialog ( pParent, SVX_RES( RID_SVX_FORMAT_CELLS_DLG ), pAttr )
+, mrOutAttrs ( *pAttr )
+, mpColorTab ( pModel->GetColorTable() )
+, mpGradientList ( pModel->GetGradientList() )
+, mpHatchingList ( pModel->GetHatchList() )
+, mpBitmapList ( pModel->GetBitmapList() )
+
+{
+ FreeResource();
+
+ AddTabPage( RID_SVXPAGE_CHAR_NAME );
+ AddTabPage( RID_SVXPAGE_CHAR_EFFECTS );
+ AddTabPage( RID_SVXPAGE_BORDER );
+ AddTabPage( RID_SVXPAGE_AREA );
+
+/*
+ SvtCJKOptions aCJKOptions;
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage( RID_SVXPAGE_PARA_ASIAN);
+ else
+ RemoveTabPage( RID_SVXPAGE_PARA_ASIAN );
+*/
+}
+
+SvxFormatCellsDialog::~SvxFormatCellsDialog()
+{
+}
+
+void SvxFormatCellsDialog::PageCreated( USHORT nId, SfxTabPage &rPage )
+{
+ switch( nId )
+ {
+ case RID_SVXPAGE_AREA:
+ ( (SvxAreaTabPage&) rPage ).SetColorTable( mpColorTab );
+ ( (SvxAreaTabPage&) rPage ).SetGradientList( mpGradientList );
+ ( (SvxAreaTabPage&) rPage ).SetHatchingList( mpHatchingList );
+ ( (SvxAreaTabPage&) rPage ).SetBitmapList( mpBitmapList );
+ ( (SvxAreaTabPage&) rPage ).SetPageType( PT_AREA );
+ ( (SvxAreaTabPage&) rPage ).SetDlgType( 1 );
+ ( (SvxAreaTabPage&) rPage ).SetPos( 0 );
+// ( (SvxAreaTabPage&) rPage ).SetAreaTP( &mbAreaTP );
+// ( (SvxAreaTabPage&) rPage ).SetGrdChgd( &mnGradientListState );
+// ( (SvxAreaTabPage&) rPage ).SetHtchChgd( &mnHatchingListState );
+// ( (SvxAreaTabPage&) rPage ).SetBmpChgd( &mnBitmapListState );
+// ( (SvxAreaTabPage&) rPage ).SetColorChgd( &mnColorTableState );
+ ( (SvxAreaTabPage&) rPage ).Construct();
+ // ActivatePage() wird das erste mal nicht gerufen
+ ( (SvxAreaTabPage&) rPage ).ActivatePage( mrOutAttrs );
+
+ break;
+
+ default:
+ SfxTabDialog::PageCreated( nId, rPage );
+ break;
+ }
+}
+
+void SvxFormatCellsDialog::Apply()
+{
+}
diff --git a/cui/source/dialogs/sdrcelldlg.src b/cui/source/dialogs/sdrcelldlg.src
new file mode 100644
index 000000000000..71374302a276
--- /dev/null
+++ b/cui/source/dialogs/sdrcelldlg.src
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * 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: sdrcelldlg.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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>
+TabDialog RID_SVX_FORMAT_CELLS_DLG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ de ] = "Zellen formatieren" ;
+ Text [ en-US ] = "Format Cells" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_NAME ;
+ PageResID = RID_SVXPAGE_CHAR_NAME ;
+ Text [ de ] = "Schrift" ;
+ Text [ en-US ] = "Font" ;
+ Text [ x-comment ] = " ";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_EFFECTS ;
+ PageResID = RID_SVXPAGE_CHAR_EFFECTS ;
+ Text [ de ] = "Schrifteffekt" ;
+ Text [ en-US ] = "Font Effects" ;
+ Text [ x-comment ] = " ";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_BORDER;
+ PageResID = RID_SVXPAGE_BORDER;
+ Text [ de ] = "Umrandung" ;
+ Text [ en-US ] = "Borders" ;
+ Text [ x-comment ] = " ";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_AREA;
+ PageResID = RID_SVXPAGE_AREA;
+ Text [ de ] = "Hintergrund";
+ Text [ en-US ] = "Background";
+ Text [ x-comment ] = " ";
+ };
+ };
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 60 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 114 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton 1
+ {
+ Pos = MAP_APPFONT ( 169 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Zurück : Zur³ck */
+ Text [ de ] = "Zurück" ;
+ Text [ en-US ] = "Return" ;
+ TabStop = TRUE ;
+ Text [ x-comment ] = " ";
+ };
+ Text [ x-comment ] = " ";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/showcols.cxx b/cui/source/dialogs/showcols.cxx
new file mode 100644
index 000000000000..563110004258
--- /dev/null
+++ b/cui/source/dialogs/showcols.cxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * 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: showcols.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "showcols.hxx"
+#include "fmsearch.hrc"
+
+#include <tools/shl.hxx>
+#include <svx/dialmgr.hxx>
+#include <vcl/msgbox.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <comphelper/extract.hxx>
+#include <comphelper/types.hxx>
+
+#define CUIFM_PROP_HIDDEN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Hidden" ) )
+#define CUIFM_PROP_LABEL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" ) )
+
+//==========================================================================
+// FmShowColsDialog
+//==========================================================================
+DBG_NAME(FmShowColsDialog)
+//--------------------------------------------------------------------------
+FmShowColsDialog::FmShowColsDialog(Window* pParent)
+ :ModalDialog(pParent, SVX_RES(RID_SVX_DLG_SHOWGRIDCOLUMNS))
+ ,m_aList(this, SVX_RES(1))
+ ,m_aLabel(this, SVX_RES(1))
+ ,m_aOK(this, SVX_RES(1))
+ ,m_aCancel(this, SVX_RES(1))
+{
+ DBG_CTOR(FmShowColsDialog,NULL);
+ m_aList.EnableMultiSelection(sal_True);
+ m_aOK.SetClickHdl( LINK( this, FmShowColsDialog, OnClickedOk ) );
+
+ FreeResource();
+}
+
+//--------------------------------------------------------------------------
+FmShowColsDialog::~FmShowColsDialog()
+{
+ DBG_DTOR(FmShowColsDialog,NULL);
+}
+
+//--------------------------------------------------------------------------
+IMPL_LINK( FmShowColsDialog, OnClickedOk, Button*, EMPTYARG )
+{
+ DBG_ASSERT(m_xColumns.is(), "FmShowColsDialog::OnClickedOk : you should call SetColumns before executing the dialog !");
+ if (m_xColumns.is())
+ {
+ ::com::sun::star::uno::Any aCol;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCol;
+ for (sal_uInt16 i=0; i<m_aList.GetSelectEntryCount(); ++i)
+ {
+ m_xColumns->getByIndex(sal::static_int_cast<sal_Int32>(reinterpret_cast<sal_uIntPtr>(m_aList.GetEntryData(m_aList.GetSelectEntryPos(i))))) >>= xCol;
+ if (xCol.is())
+ {
+ try
+ {
+ //CHINA001 xCol->setPropertyValue(::svxform::FM_PROP_HIDDEN, ::cppu::bool2any(sal_False));
+ xCol->setPropertyValue(CUIFM_PROP_HIDDEN, ::cppu::bool2any(sal_False));
+ }
+ catch(...)
+ {
+ DBG_ERROR("FmShowColsDialog::OnClickedOk Exception occured!");
+ }
+ }
+ }
+ }
+
+ EndDialog(RET_OK);
+ return 0L;
+}
+
+//--------------------------------------------------------------------------
+void FmShowColsDialog::SetColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xCols)
+{
+ DBG_ASSERT(xCols.is(), "FmShowColsDialog::SetColumns : invalid columns !");
+ if (!xCols.is())
+ return;
+ m_xColumns = xCols.get();
+
+ m_aList.Clear();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCurCol;
+ String sCurName;
+ for (sal_uInt16 i=0; i<xCols->getCount(); ++i)
+ {
+ sCurName.Erase();
+ ::cppu::extractInterface(xCurCol, xCols->getByIndex(i));
+ sal_Bool bIsHidden = sal_False;
+ try
+ {
+ //CHINA001 ::com::sun::star::uno::Any aHidden = xCurCol->getPropertyValue(::svxform::FM_PROP_HIDDEN);
+ ::com::sun::star::uno::Any aHidden = xCurCol->getPropertyValue(CUIFM_PROP_HIDDEN);
+ bIsHidden = ::comphelper::getBOOL(aHidden);
+
+ ::rtl::OUString sName;
+ //CHINA001 xCurCol->getPropertyValue(::svxform::FM_PROP_LABEL) >>= sName;
+
+ xCurCol->getPropertyValue(CUIFM_PROP_LABEL) >>= sName;
+ sCurName = (const sal_Unicode*)sName;
+ }
+ catch(...)
+ {
+ DBG_ERROR("FmShowColsDialog::SetColumns Exception occured!");
+ }
+
+ // if the col is hidden, put it into the list
+ if (bIsHidden)
+ m_aList.SetEntryData( m_aList.InsertEntry(sCurName), reinterpret_cast<void*>((sal_Int64)i) );
+ }
+}
+
diff --git a/cui/source/dialogs/showcols.src b/cui/source/dialogs/showcols.src
new file mode 100644
index 000000000000..2568ee25b96f
--- /dev/null
+++ b/cui/source/dialogs/showcols.src
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * 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: showcols.src,v $
+ * $Revision: 1.28 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "fmsearch.hrc"
+
+ModalDialog RID_SVX_DLG_SHOWGRIDCOLUMNS
+{
+ OutputSize = TRUE;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT( 200, 117 );
+ Moveable = TRUE;
+ Closeable = TRUE;
+
+ FixedText 1
+ {
+ Pos = MAP_APPFONT( 6, 6 );
+ Size = MAP_APPFONT( 188, 30 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "The following columns are currently hidden. Please mark the fields you want to show and choose OK.";
+ };
+
+ ListBox 1
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 6, 39 );
+ Size = MAP_APPFONT( 188, 55 );
+ TabStop = TRUE;
+ DropDown = FALSE;
+ AutoHScroll = TRUE;
+ VScroll = TRUE;
+ };
+
+ OKButton 1
+ {
+ Pos = MAP_APPFONT( 6, 97 );
+ Size = MAP_APPFONT( 50, 14 );
+ TabStop = TRUE;
+ DefButton = TRUE ;
+ };
+
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT( 144, 97 );
+ Size = MAP_APPFONT( 50, 14 );
+ TabStop = TRUE;
+ };
+ Text [ en-US ] = "Show columns";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/splitcelldlg.cxx b/cui/source/dialogs/splitcelldlg.cxx
new file mode 100644
index 000000000000..68d04bbbc57c
--- /dev/null
+++ b/cui/source/dialogs/splitcelldlg.cxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * 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: splitcelldlg.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <sfx2/dispatch.hxx>
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
+#include "svx/dialmgr.hxx"
+#include "splitcelldlg.hxx"
+#include "svx/dialogs.hrc"
+#include "splitcelldlg.hrc"
+
+SvxSplitTableDlg::SvxSplitTableDlg( Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal )
+: SvxStandardDialog(pParent, SVX_RES(RID_SVX_SPLITCELLDLG))
+, maCountLbl(this, SVX_RES(FT_COUNT))
+, maCountEdit(this, SVX_RES(ED_COUNT))
+, maCountFL(this, SVX_RES(FL_COUNT))
+, maHorzBox(this, SVX_RES(RB_HORZ))
+, maVertBox(this, SVX_RES(RB_VERT))
+, maPropCB(this, SVX_RES(CB_PROP))
+, maDirFL(this, SVX_RES(FL_DIR))
+, maOKBtn(this, SVX_RES(BT_OK))
+, maCancelBtn(this, SVX_RES(BT_CANCEL))
+, maHelpBtn( this, SVX_RES( BT_HELP ) )
+, mnMaxVertical( nMaxVertical )
+, mnMaxHorizontal( nMaxHorizontal )
+{
+ maVertBox.SetModeRadioImage(Image(SVX_RES(BMP_SPLIT_VERT)), BMP_COLOR_HIGHCONTRAST);
+ maHorzBox.SetModeRadioImage(Image(SVX_RES(BMP_SPLIT_HORZ)), BMP_COLOR_HIGHCONTRAST);
+ FreeResource();
+ maHorzBox.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
+ maPropCB.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
+ maVertBox.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
+
+ if( mnMaxVertical < 2 )
+ maVertBox.Enable(FALSE);
+
+ //exchange the meaning of horizontal and vertical for vertical text
+ if(bIsTableVertical)
+ {
+ Image aTmpImg(maHorzBox.GetModeRadioImage());
+ String sTmp(maHorzBox.GetText());
+ maHorzBox.SetText(maVertBox.GetText());
+ maHorzBox.SetModeRadioImage(maVertBox.GetModeRadioImage());
+ maVertBox.SetText(sTmp);
+ maVertBox.SetModeRadioImage(aTmpImg);
+ }
+}
+
+SvxSplitTableDlg::~SvxSplitTableDlg()
+{
+}
+
+IMPL_LINK( SvxSplitTableDlg, ClickHdl, Button *, pButton )
+{
+ const bool bIsVert = pButton == &maVertBox ;
+ long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal;
+ maPropCB.Enable(!bIsVert);
+ maCountEdit.SetMax( nMax );
+ return 0;
+}
+
+bool SvxSplitTableDlg::IsHorizontal() const
+{
+ return maHorzBox.IsChecked();
+}
+
+bool SvxSplitTableDlg::IsProportional() const
+{
+ return maPropCB.IsChecked() && maHorzBox.IsChecked();
+}
+
+long SvxSplitTableDlg::GetCount() const
+{
+ return sal::static_int_cast<long>( maCountEdit.GetValue() );
+}
+
+short SvxSplitTableDlg::Execute()
+{
+ return SvxStandardDialog::Execute();
+}
+
+void SvxSplitTableDlg::Apply()
+{
+}
diff --git a/cui/source/dialogs/splitcelldlg.hrc b/cui/source/dialogs/splitcelldlg.hrc
new file mode 100644
index 000000000000..cab8b4ed02ad
--- /dev/null
+++ b/cui/source/dialogs/splitcelldlg.hrc
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * 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: splitcelldlg.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define FT_COUNT 1
+#define ED_COUNT 2
+#define FL_COUNT 3
+
+#define RB_HORZ 10
+#define CB_PROP 11
+#define RB_VERT 12
+#define FL_DIR 12
+
+#define BMP_SPLIT_VERT 13
+#define BMP_SPLIT_HORZ 14
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_HELP 102
+
diff --git a/cui/source/dialogs/splitcelldlg.src b/cui/source/dialogs/splitcelldlg.src
new file mode 100644
index 000000000000..17285cecd05f
--- /dev/null
+++ b/cui/source/dialogs/splitcelldlg.src
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * 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: splitcelldlg.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "splitcelldlg.hrc"
+
+ModalDialog RID_SVX_SPLITCELLDLG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 169 , 108 ) ;
+ Text [ en-US ] = "Split Cells" ;
+ Moveable = TRUE ;
+
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 115 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 115 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 115 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_COUNT
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 67 , 8 ) ;
+ Text [ en-US ] = "~Split cell into" ;
+ Left = TRUE ;
+ };
+ NumericField ED_COUNT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 82 , 14 ) ;
+ Size = MAP_APPFONT ( 21 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Right = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 2 ;
+ Maximum = 20 ;
+ First = 2 ;
+ Last = 5 ;
+ };
+ FixedLine FL_COUNT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 103 , 8 ) ;
+ Text [ en-US ] = "Split" ;
+ };
+ ImageRadioButton RB_HORZ
+ {
+ Pos = MAP_APPFONT ( 12 , 47 ) ;
+ Size = MAP_APPFONT ( 90 , 18 ) ;
+ Group = TRUE;
+ Text [ en-US ] = "H~orizontally" ;
+ RadioButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "zetlhor2.bmp" ; };
+ };
+ TabStop = TRUE ;
+ Check = TRUE ;
+ };
+ CheckBox CB_PROP
+ {
+ Pos = MAP_APPFONT ( 18 , 68 ) ;
+ Size = MAP_APPFONT ( 91 , 12 ) ;
+ Text [ en-US ] = "~Into equal proportions";
+ };
+ Image BMP_SPLIT_VERT
+ {
+ ImageBitmap = Bitmap { File = "zetlver2_h.bmp" ; };
+ };
+ Image BMP_SPLIT_HORZ
+ {
+ ImageBitmap = Bitmap { File = "zetlhor2_h.bmp" ; };
+ };
+ ImageRadioButton RB_VERT
+ {
+ Pos = MAP_APPFONT ( 12 , 84 ) ;
+ Size = MAP_APPFONT ( 90 , 18 ) ;
+ Text [ en-US ] = "~Vertically" ;
+ RadioButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "zetlver2.bmp" ; };
+ };
+ TabStop = TRUE ;
+ };
+ FixedLine FL_DIR
+ {
+ Pos = MAP_APPFONT ( 6 , 36 ) ;
+ Size = MAP_APPFONT ( 103 , 8 ) ;
+ Text [ en-US ] = "Direction" ;
+ };
+};
+
+
diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx
new file mode 100644
index 000000000000..c33eaf532d24
--- /dev/null
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -0,0 +1,291 @@
+/*************************************************************************
+ *
+ * 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: srchxtra.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include "srchxtra.hxx"
+#include <tools/rcid.h>
+#include <vcl/msgbox.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svl/whiter.hxx>
+#include <sfx2/objsh.hxx>
+#include <svx/dialogs.hrc>
+#include "srchxtra.hrc"
+#include <svx/svxitems.hrc>
+#include <svx/flstitem.hxx>
+#include "chardlg.hxx"
+#include "paragrph.hxx"
+#include <svx/dialmgr.hxx>
+#include "backgrnd.hxx"
+
+// class SvxSearchFormatDialog -------------------------------------------
+
+SvxSearchFormatDialog::SvxSearchFormatDialog( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabDialog( pParent, SVX_RES( RID_SVXDLG_SEARCHFORMAT ), &rSet ),
+
+ pFontList( NULL )
+
+{
+ FreeResource();
+
+ AddTabPage( RID_SVXPAGE_CHAR_NAME, SvxCharNamePage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_CHAR_EFFECTS, SvxCharEffectsPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_CHAR_POSITION, SvxCharPositionPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_CHAR_TWOLINES, SvxCharTwoLinesPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_STD_PARAGRAPH, SvxStdParagraphTabPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH, SvxParaAlignTabPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_EXT_PARAGRAPH, SvxExtParagraphTabPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_PARA_ASIAN, SvxAsianTabPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_BACKGROUND, SvxBackgroundTabPage::Create, 0 );
+
+ // remove asian tabpages if necessary
+ SvtCJKOptions aCJKOptions;
+ if ( !aCJKOptions.IsDoubleLinesEnabled() )
+ RemoveTabPage( RID_SVXPAGE_CHAR_TWOLINES );
+ if ( !aCJKOptions.IsAsianTypographyEnabled() )
+ RemoveTabPage( RID_SVXPAGE_PARA_ASIAN );
+}
+
+// -----------------------------------------------------------------------
+
+SvxSearchFormatDialog::~SvxSearchFormatDialog()
+{
+ delete pFontList;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchFormatDialog::PageCreated( USHORT nId, SfxTabPage& rPage )
+{
+ switch ( nId )
+ {
+ case RID_SVXPAGE_CHAR_NAME:
+ {
+ const FontList* pAppFontList = 0;
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ if ( pSh )
+ {
+ const SvxFontListItem* pFLItem = (const SvxFontListItem*)
+ pSh->GetItem( SID_ATTR_CHAR_FONTLIST );
+ if ( pFLItem )
+ pAppFontList = pFLItem->GetFontList();
+ }
+
+ const FontList* pList = pAppFontList;
+
+ if ( !pList )
+ {
+ if ( !pFontList )
+ pFontList = new FontList( this );
+ pList = pFontList;
+ }
+
+ if ( pList )
+ ( (SvxCharNamePage&)rPage ).
+ SetFontList( SvxFontListItem( pList, SID_ATTR_CHAR_FONTLIST ) );
+ ( (SvxCharNamePage&)rPage ).EnableSearchMode();
+ break;
+ }
+
+ case RID_SVXPAGE_STD_PARAGRAPH:
+ ( (SvxStdParagraphTabPage&)rPage ).EnableAutoFirstLine();
+ break;
+
+ case RID_SVXPAGE_ALIGN_PARAGRAPH:
+ ( (SvxParaAlignTabPage&)rPage ).EnableJustifyExt();
+ break;
+ case RID_SVXPAGE_BACKGROUND :
+ ( (SvxBackgroundTabPage&)rPage ).ShowParaControl(TRUE);
+ break;
+ }
+}
+
+// class SvxSearchFormatDialog -------------------------------------------
+
+SvxSearchAttributeDialog::SvxSearchAttributeDialog( Window* pParent,
+ SearchAttrItemList& rLst,
+ const USHORT* pWhRanges ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_SEARCHATTR ) ),
+
+ aAttrFL ( this, SVX_RES( FL_ATTR ) ),
+ aAttrLB ( this, SVX_RES( LB_ATTR ) ),
+ aOKBtn ( this, SVX_RES( BTN_ATTR_OK ) ),
+ aEscBtn ( this, SVX_RES( BTN_ATTR_CANCEL ) ),
+ aHelpBtn( this, SVX_RES( BTN_ATTR_HELP ) ),
+
+ rList( rLst )
+
+{
+ FreeResource();
+
+ aAttrLB.SetWindowBits( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT );
+ aAttrLB.GetModel()->SetSortMode( SortAscending );
+
+ aOKBtn.SetClickHdl( LINK( this, SvxSearchAttributeDialog, OKHdl ) );
+
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+ DBG_ASSERT( pSh, "No DocShell" );
+
+ SfxItemPool& rPool = pSh->GetPool();
+ SfxItemSet aSet( rPool, pWhRanges );
+ SfxWhichIter aIter( aSet );
+ USHORT nWhich = aIter.FirstWhich();
+
+ while ( nWhich )
+ {
+ USHORT nSlot = rPool.GetSlotId( nWhich );
+ if ( nSlot >= SID_SVX_START )
+ {
+ BOOL bChecked = FALSE, bFound = FALSE;
+ for ( USHORT i = 0; !bFound && i < rList.Count(); ++i )
+ {
+ if ( nSlot == rList[i].nSlot )
+ {
+ bFound = TRUE;
+ if ( IsInvalidItem( rList[i].pItem ) )
+ bChecked = TRUE;
+ }
+ }
+
+ USHORT nResId = nSlot - SID_SVX_START + RID_ATTR_BEGIN;
+ SvLBoxEntry* pEntry = NULL;
+ ResId aId( nResId, DIALOG_MGR() );
+ aId.SetRT( RSC_STRING );
+ if ( DIALOG_MGR().IsAvailable( aId ) )
+ pEntry = aAttrLB.SvTreeListBox::InsertEntry( SVX_RESSTR( nResId ) );
+ else
+ {
+ ByteString sError( "no resource for slot id\nslot = " );
+ sError += ByteString::CreateFromInt32( nSlot );
+ sError += ByteString( "\nresid = " );
+ sError += ByteString::CreateFromInt32( nResId );
+ DBG_ERRORFILE( sError.GetBuffer() );
+ }
+
+ if ( pEntry )
+ {
+ aAttrLB.SetCheckButtonState( pEntry, bChecked ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED );
+ pEntry->SetUserData( (void*)(ULONG)nSlot );
+ }
+ }
+ nWhich = aIter.NextWhich();
+ }
+
+ aAttrLB.SetHighlightRange();
+ aAttrLB.SelectEntryPos( 0 );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchAttributeDialog, OKHdl, Button *, EMPTYARG )
+{
+ SearchAttrItem aInvalidItem;
+ aInvalidItem.pItem = (SfxPoolItem*)-1;
+
+ for ( USHORT i = 0; i < aAttrLB.GetEntryCount(); ++i )
+ {
+ USHORT nSlot = (USHORT)(ULONG)aAttrLB.GetEntryData(i);
+ BOOL bChecked = aAttrLB.IsChecked(i);
+
+ USHORT j;
+ for ( j = rList.Count(); j; )
+ {
+ SearchAttrItem& rItem = rList[ --j ];
+ if( rItem.nSlot == nSlot )
+ {
+ if( bChecked )
+ {
+ if( !IsInvalidItem( rItem.pItem ) )
+ delete rItem.pItem;
+ rItem.pItem = (SfxPoolItem*)-1;
+ }
+ else if( IsInvalidItem( rItem.pItem ) )
+ rItem.pItem = 0;
+ j = 1;
+ break;
+ }
+ }
+
+ if ( !j && bChecked )
+ {
+ aInvalidItem.nSlot = nSlot;
+ rList.Insert( aInvalidItem );
+ }
+ }
+
+ // remove invalid items (pItem == NULL)
+ for ( USHORT n = rList.Count(); n; )
+ if ( !rList[ --n ].pItem )
+ rList.Remove( n );
+
+ EndDialog( RET_OK );
+ return 0;
+}
+
+// class SvxSearchSimilarityDialog ---------------------------------------
+
+SvxSearchSimilarityDialog::SvxSearchSimilarityDialog
+(
+ Window* pParent,
+ BOOL bRelax,
+ USHORT nOther,
+ USHORT nShorter,
+ USHORT nLonger
+) :
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_SEARCHSIMILARITY ) ),
+
+ aFixedLine ( this, SVX_RES( FL_SIMILARITY ) ),
+ aOtherTxt ( this, SVX_RES( FT_OTHER ) ),
+ aOtherFld ( this, SVX_RES( NF_OTHER ) ),
+ aLongerTxt ( this, SVX_RES( FT_LONGER ) ),
+ aLongerFld ( this, SVX_RES( NF_LONGER ) ),
+ aShorterTxt ( this, SVX_RES( FT_SHORTER ) ),
+ aShorterFld ( this, SVX_RES( NF_SHORTER ) ),
+ aRelaxBox ( this, SVX_RES( CB_RELAX ) ),
+
+ aOKBtn ( this, SVX_RES( BTN_ATTR_OK ) ),
+ aEscBtn ( this, SVX_RES( BTN_ATTR_CANCEL ) ),
+ aHelpBtn ( this, SVX_RES( BTN_ATTR_HELP ) )
+
+{
+ FreeResource();
+
+ aOtherFld.SetValue( nOther );
+ aShorterFld.SetValue( nShorter );
+ aLongerFld.SetValue( nLonger );
+ aRelaxBox.Check( bRelax );
+}
+
diff --git a/cui/source/dialogs/srchxtra.hrc b/cui/source/dialogs/srchxtra.hrc
new file mode 100644
index 000000000000..870303efd72c
--- /dev/null
+++ b/cui/source/dialogs/srchxtra.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: srchxtra.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SRCHXTRA_HRC
+#define _SVX_SRCHXTRA_HRC
+
+// defines ------------------------------------------------------------------
+
+#define BTN_ATTR_OK 10
+#define BTN_ATTR_CANCEL 11
+#define BTN_ATTR_HELP 12
+#define LB_ATTR 13
+#define FL_ATTR 14
+
+#define CB_RELAX 15
+#define FT_OTHER 16
+#define NF_OTHER 17
+#define FT_SHORTER 18
+#define NF_SHORTER 19
+#define FT_LONGER 20
+#define NF_LONGER 21
+#define FL_SIMILARITY 22
+
+
+
+
+#endif
+
diff --git a/cui/source/dialogs/srchxtra.src b/cui/source/dialogs/srchxtra.src
new file mode 100644
index 000000000000..980b952adc76
--- /dev/null
+++ b/cui/source/dialogs/srchxtra.src
@@ -0,0 +1,281 @@
+/*************************************************************************
+ *
+ * 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: srchxtra.src,v $
+ * $Revision: 1.52 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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.hrc"
+#include <svx/dialogs.hrc>
+#include "srchxtra.hrc"
+
+ // RID_SVXDLG_SEARCHFORMAT -----------------------------------------------
+TabDialog RID_SVXDLG_SEARCHFORMAT
+{
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Text [ en-US ] = "Text Format" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_NAME ;
+ Text [ en-US ] = "Font" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_EFFECTS ;
+ Text [ en-US ] = "Font Effects" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_POSITION ;
+ Text [ en-US ] = "Position" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_TWOLINES ;
+ Text [ en-US ] = "Asian Layout" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_STD_PARAGRAPH ;
+ Text [ en-US ] = "Indents & Spacing" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH ;
+ Text [ en-US ] = "Alignment" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_EXT_PARAGRAPH ;
+ Text [ en-US ] = "Text Flow" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PARA_ASIAN;
+ Text [ en-US ] = "Asian Typography";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_BACKGROUND;
+ Text [ en-US ] = "Background" ;
+ };
+ };
+ };
+};
+ // RID_SVXDLG_SEARCHATTRIBUTE --------------------------------------------
+ModalDialog RID_SVXDLG_SEARCHATTR
+{
+ HelpId = HID_SEARCHATTR ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 194 , 128 ) ;
+ Text [ en-US ] = "Attributes" ;
+ Moveable = TRUE ;
+ Control LB_ATTR
+ {
+ HelpId = HID_SEARCHATTR_CTL_ATTR ;
+ ClipChildren = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 120 , 108 ) ;
+ };
+ FixedText FL_ATTR
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Text [ en-US ] = "~Options" ;
+ };
+ OKButton BTN_ATTR_OK
+ {
+ Pos = MAP_APPFONT ( 136 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_ATTR_CANCEL
+ {
+ Pos = MAP_APPFONT ( 136 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_ATTR_HELP
+ {
+ Pos = MAP_APPFONT ( 136 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+ // RID_SVXDLG_SEARCHSIMILARITY -------------------------------------------
+ModalDialog RID_SVXDLG_SEARCHSIMILARITY
+{
+ HelpId = HID_SEARCHSIMILARITY ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 178 , 76 ) ;
+ Text [ en-US ] = "Similarity Search" ;
+ Moveable = TRUE ;
+ FixedText FT_OTHER
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "~Exchange characters" ;
+ };
+ NumericField NF_OTHER
+ {
+ Pos = MAP_APPFONT ( 86 , 14 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Border = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ First = 1 ;
+ Maximum = 30 ;
+ Last = 30 ;
+ Value = 1 ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_LONGER
+ {
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "~Add characters" ;
+ };
+ NumericField NF_LONGER
+ {
+ Pos = MAP_APPFONT ( 86 , 28 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Border = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ First = 1 ;
+ Maximum = 30 ;
+ Last = 30 ;
+ Value = 1 ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_SHORTER
+ {
+ Pos = MAP_APPFONT ( 12 , 46 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "~Remove characters" ;
+ };
+ NumericField NF_SHORTER
+ {
+ Pos = MAP_APPFONT ( 86 , 44 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Border = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ First = 1 ;
+ Maximum = 30 ;
+ Last = 30 ;
+ Value = 1 ;
+ TabStop = TRUE ;
+ };
+ CheckBox CB_RELAX
+ {
+ Pos = MAP_APPFONT ( 12 , 60 ) ;
+ Size = MAP_APPFONT ( 98 , 10 ) ;
+ Text [ en-US ] = "~Combine" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SIMILARITY
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 110 , 8 ) ;
+ Text [ en-US ] = "Settings" ;
+ };
+ OKButton BTN_ATTR_OK
+ {
+ Pos = MAP_APPFONT ( 122 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_ATTR_CANCEL
+ {
+ Pos = MAP_APPFONT ( 122 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_ATTR_HELP
+ {
+ Pos = MAP_APPFONT ( 122 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/svuidlg.hrc b/cui/source/dialogs/svuidlg.hrc
new file mode 100644
index 000000000000..ba3602fb18bd
--- /dev/null
+++ b/cui/source/dialogs/svuidlg.hrc
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * 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: svuidlg.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svl/solar.hrc>
+#include <helpid.hrc>
+
+#define TB_LINKS 32014
+
+// gemeinsame Id's
+#define CB_DISPLAY_AS_ICON 12
+#define FI_DISPLAY 13
+#define PB_CHANGE_ICON 14
+
+#define STR_AUTOLINK 32006
+#define STR_MANUALLINK 32007
+#define STR_BROKENLINK 32008
+#define STR_GRAPHICLINK 32009
+#define STR_BUTTONCLOSE 32010
+#define STR_CLOSELINKMSG 32011
+#define STR_CLOSELINKMSG_MULTI 32024
+#define STR_WAITINGLINK 32028
+#define STR_EDIT_APPLET 32029
+
+
+#define FL_CHOICE 15
+#define LB_INSERT_LIST 7
+
+#define MD_PASTE_OBJECT 32001
+#define S_OBJECT 1
+#define RB_PASTE 20
+#define RB_PASTE_LINK 21
+#define FT_OBJECT_SOURCE 22
+#define FT_SOURCE 23
+
+#define MD_UPDATE_BASELINKS 32002
+#define LB_LINKS 30
+#define FT_FILES 31
+#define FT_LINKS 32
+#define FT_TYPE 33
+#define FT_STATUS 34
+#define PB_UPDATE_NOW 35
+#define PB_OPEN_SOURCE 36
+#define PB_CHANGE_SOURCE 37
+#define PB_BREAK_LINK 38
+#define FT_SOURCE2 39
+#define FT_TYPE2 40
+#define FT_UPDATE 41
+#define RB_AUTOMATIC 42
+#define RB_MANUAL 43
+#define FT_FULL_SOURCE_NAME 44
+#define FT_FULL_TYPE_NAME 45
+#define GB_LINK 46
+#define FT_FILES2 47
+#define FT_FULL_FILE_NAME 48
+
+#define MD_LINKEDIT 32004
+#define ED_FULL_SOURCE_NAME 1
+
+#define ED_FILEPATH 10
+#define BTN_FILEPATH 11
+#define CB_FILELINK 12
+
+#define MD_INSERT_OBJECT_PLUGIN 32008
+#define ED_FILEURL 10
+#define BTN_FILEURL 11
+#define GB_FILEURL 12
+#define ED_PLUGINS_OPTIONS 20
+#define GB_PLUGINS_OPTIONS 21
+
+#define MD_INSERT_OBJECT_APPLET 32009
+#define FT_CLASSFILE 10
+#define ED_CLASSFILE 11
+#define FT_CLASSLOCATION 12
+#define ED_CLASSLOCATION 12
+#define BTN_CLASS 13
+#define GB_CLASS 14
+#define ED_APPLET_OPTIONS 20
+#define GB_APPLET_OPTIONS 21
+
+#define MD_INSERT_OLEOBJECT 32010
+#define RB_NEW_OBJECT 10
+#define RB_OBJECT_FROMFILE 11
+#define LB_OBJECTTYPE 12
+#define GB_OBJECT 13
+#define STR_FILE 14
+
+#define MD_INSERT_OBJECT_IFRAME 32011
+#define FT_FRAMENAME 3
+#define ED_FRAMENAME 4
+#define FT_URL 5
+#define ED_URL 6
+#define BT_FILEOPEN 7
+#define NM_MARGINHEIGHT 8
+#define FT_MARGINHEIGHT 9
+#define NM_MARGINWIDTH 10
+#define FT_MARGINWIDTH 11
+#define GB_MARGIN 12
+#define RB_SCROLLINGON 13
+#define RB_SCROLLINGOFF 14
+#define RB_SCROLLINGAUTO 15
+#define GB_SCROLLING 16
+#define GB_BORDER 17
+#define RB_FRMBORDER_ON 18
+#define RB_FRMBORDER_INHERIT 19
+#define RB_FRMBORDER_OFF 20
+#define CB_MARGINWIDTHDEFAULT 21
+#define CB_MARGINHEIGHTDEFAULT 22
+#define FL_SEP_LEFT 46
+#define FL_SEP_RIGHT 47
+
diff --git a/cui/source/dialogs/svuidlg.src b/cui/source/dialogs/svuidlg.src
new file mode 100644
index 000000000000..cc8f2db676ae
--- /dev/null
+++ b/cui/source/dialogs/svuidlg.src
@@ -0,0 +1,711 @@
+/*************************************************************************
+ *
+ * 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: svuidlg.src,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "svuidlg.hrc"
+
+ModalDialog MD_PASTE_OBJECT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Size = MAP_APPFONT ( 282 , 135 ) ; // 12 under listbox
+ Text [ en-US ] = "Paste Special" ;
+ FixedText FT_SOURCE
+ {
+ Pos = MAP_APPFONT ( 6 , 11 ) ;
+ Size = MAP_APPFONT ( 30 , 10 ) ;
+ Text [ en-US ] = "Source:" ;
+ };
+ FixedText FT_OBJECT_SOURCE
+ {
+ Pos = MAP_APPFONT ( 42 , 11 ) ;
+ Size = MAP_APPFONT ( 166 , 20 ) ;
+ WordBreak = TRUE ;
+ };
+ RadioButton RB_PASTE
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 63 , 10 ) ;
+ Text [ en-US ] = "~Insert as" ;
+ Check = TRUE ;
+ };
+ RadioButton RB_PASTE_LINK
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 78 , 48 ) ;
+ Size = MAP_APPFONT ( 63 , 10 ) ;
+ Text [ en-US ] = "Link to" ;
+ };
+ ListBox LB_INSERT_LIST
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 49 ) ;
+ Size = MAP_APPFONT ( 202 , 74 ) ;
+ };
+ CheckBox CB_DISPLAY_AS_ICON
+ {
+ Hide = TRUE ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 150 , 62 ) ;
+ Size = MAP_APPFONT ( 64 , 10 ) ;
+ Text [ en-US ] = "~As icon" ;
+ };
+ /*
+ FixedIcon FI_DISPLAY
+ {
+ Border = TRUE ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 167 , 75 ) ;
+ Size = MAP_APPFONT ( 30 , 30 ) ;
+ };
+*/
+ PushButton PB_CHANGE_ICON
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 150 , 111 ) ;
+ Size = MAP_APPFONT ( 64 , 14 ) ;
+ Text [ en-US ] = "~Other Icon..." ;
+ };
+ FixedLine FL_CHOICE
+ {
+ Pos = MAP_APPFONT ( 6 , 38 ) ;
+ Size = MAP_APPFONT ( 214 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Selection" ;
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 226 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 226 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 226 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ String S_OBJECT
+ {
+ Text [ en-US ] = "Object" ;
+ };
+};
+ModalDialog MD_UPDATE_BASELINKS
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 337 , 166 ) ;
+ Text [ en-US ] = "Edit Links" ;
+ Moveable = TRUE ;
+ FixedText FT_FILES
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 74 , 10 ) ;
+ Text [ en-US ] = "Source file" ;
+ };
+ FixedText FT_LINKS
+ {
+ Pos = MAP_APPFONT ( 83 , 6 ) ;
+ Size = MAP_APPFONT ( 63 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Element: : Verknüpfungen */
+ Text [ en-US ] = "Element:" ;
+ };
+ FixedText FT_TYPE
+ {
+ Pos = MAP_APPFONT ( 150 , 6 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "Type" ;
+ };
+ FixedText FT_STATUS
+ {
+ Pos = MAP_APPFONT ( 215 , 6 ) ;
+ Size = MAP_APPFONT ( 55 , 10 ) ;
+ Text [ en-US ] = "Status" ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 270 , 6 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Close" ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 270 , 26 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ };
+ PushButton PB_UPDATE_NOW
+ {
+ Pos = MAP_APPFONT ( 270 , 43 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Update" ;
+ };
+ PushButton PB_OPEN_SOURCE
+ {
+ Pos = MAP_APPFONT ( 270 , 60 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Open" ;
+ };
+ PushButton PB_CHANGE_SOURCE
+ {
+ Pos = MAP_APPFONT ( 270 , 77 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Modify..." ;
+ };
+ PushButton PB_BREAK_LINK
+ {
+ Pos = MAP_APPFONT ( 270 , 94 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Break Link" ;
+ };
+ FixedText FT_FILES2
+ {
+ Pos = MAP_APPFONT ( 6 , 111 ) ;
+ Size = MAP_APPFONT ( 61 , 10 ) ;
+ Text [ en-US ] = "Source file" ;
+ };
+ FixedText FT_SOURCE2
+ {
+ Pos = MAP_APPFONT ( 6 , 124 ) ;
+ Size = MAP_APPFONT ( 61 , 10 ) ;
+ Text [ en-US ] = "Element:" ;
+ };
+ FixedText FT_TYPE2
+ {
+ Pos = MAP_APPFONT ( 6 , 137 ) ;
+ Size = MAP_APPFONT ( 61 , 10 ) ;
+ Text [ en-US ] = "Type:" ;
+ };
+ FixedText FT_UPDATE
+ {
+ Pos = MAP_APPFONT ( 6 , 150 ) ;
+ Size = MAP_APPFONT ( 61 , 10 ) ;
+ Text [ en-US ] = "Update:" ;
+ };
+ RadioButton RB_AUTOMATIC
+ {
+ Pos = MAP_APPFONT ( 70 , 150 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Automatic" ;
+ };
+ RadioButton RB_MANUAL
+ {
+ Pos = MAP_APPFONT ( 133 , 150 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Manuell : Ma~nuell */
+ Text [ en-US ] = "Ma~nual" ;
+ };
+ FixedText FT_FULL_FILE_NAME
+ {
+ Pos = MAP_APPFONT ( 70 , 111 ) ;
+ Size = MAP_APPFONT ( 225 , 10 ) ;
+ };
+ FixedText FT_FULL_SOURCE_NAME
+ {
+ Pos = MAP_APPFONT ( 70 , 124 ) ;
+ Size = MAP_APPFONT ( 225 , 10 ) ;
+ };
+ FixedText FT_FULL_TYPE_NAME
+ {
+ Pos = MAP_APPFONT ( 70 , 137 ) ;
+ Size = MAP_APPFONT ( 225 , 10 ) ;
+ };
+ String STR_AUTOLINK
+ {
+ Text [ en-US ] = "Automatic" ;
+ };
+ String STR_MANUALLINK
+ {
+ Text [ en-US ] = "Manual" ;
+ };
+ String STR_BROKENLINK
+ {
+ Text [ en-US ] = "Not available" ;
+ };
+ String STR_GRAPHICLINK
+ {
+ Text [ en-US ] = "Graphic" ;
+ };
+ String STR_BUTTONCLOSE
+ {
+ Text [ en-US ] = "~Close" ;
+ };
+ String STR_CLOSELINKMSG
+ {
+ Text [ en-US ] = "Are you sure you want to remove the selected link?" ;
+ };
+ String STR_CLOSELINKMSG_MULTI
+ {
+ Text [ en-US ] = "Are you sure you want to remove the selected link?" ;
+ };
+ String STR_WAITINGLINK
+ {
+ Text [ en-US ] = "Waiting";
+ };
+};
+ModalDialog MD_LINKEDIT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 222 , 58 ) ;
+ Text [ en-US ] = "Modify Link" ;
+ Moveable = TRUE ;
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 165 , 5 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 165 , 25 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ FixedText FT_FULL_TYPE_NAME
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 5 , 5 ) ;
+ Size = MAP_APPFONT ( 155 , 10 ) ;
+ };
+ FixedText 2
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 5 , 20 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ Text [ en-US ] = "Exchange source:" ;
+ };
+ Edit ED_FULL_SOURCE_NAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 5 , 35 ) ;
+ Size = MAP_APPFONT ( 155 , 12 ) ;
+ Text [ en-US ] = "Edit" ;
+ };
+};
+ModalDialog MD_INSERT_OLEOBJECT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 284 , 105 ) ;
+ Moveable = TRUE ;
+ RadioButton RB_NEW_OBJECT
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 81 , 10 ) ;
+ Text [ en-US ] = "~Create new" ;
+ };
+ RadioButton RB_OBJECT_FROMFILE
+ {
+ Pos = MAP_APPFONT ( 90 , 6 ) ;
+ Size = MAP_APPFONT ( 81 , 10 ) ;
+ Text [ en-US ] = "Create from ~file" ;
+ };
+ ListBox LB_OBJECTTYPE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 33 ) ;
+ Size = MAP_APPFONT ( 204 , 60 ) ;
+ };
+ Edit ED_FILEPATH
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 33 ) ;
+ Size = MAP_APPFONT ( 204 , 12 ) ;
+ };
+ PushButton BTN_FILEPATH
+ {
+ Pos = MAP_APPFONT ( 166 , 48 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Search..." ;
+ };
+ CheckBox CB_FILELINK
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 138 , 10 ) ;
+ Text [ en-US ] = "~Link to file" ;
+ };
+ FixedLine GB_OBJECT
+ {
+ Pos = MAP_APPFONT ( 6 , 22 ) ;
+ Size = MAP_APPFONT ( 216 , 8 ) ;
+ Text [ en-US ] = "Object type" ;
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 228 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 228 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 228 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_FILE
+ {
+ Text [ en-US ] = "File" ;
+ };
+ Text [ en-US ] = "Insert OLE Object" ;
+};
+ModalDialog MD_INSERT_OBJECT_PLUGIN
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 284 , 123 ) ;
+ Moveable = TRUE ;
+ Edit ED_FILEURL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 204 , 12 ) ;
+ };
+ PushButton BTN_FILEURL
+ {
+ Pos = MAP_APPFONT ( 166 , 29 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Browse..." ;
+ };
+ FixedLine GB_FILEURL
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 216 , 8 ) ;
+ Text [ en-US ] = "File / URL" ;
+ };
+ MultiLineEdit ED_PLUGINS_OPTIONS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 66 ) ;
+ Size = MAP_APPFONT ( 204 , 45 ) ;
+ VScroll = TRUE ;
+ IgnoreTab = TRUE;
+ };
+ FixedLine GB_PLUGINS_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 55 ) ;
+ Size = MAP_APPFONT ( 216 , 8 ) ;
+ Text [ en-US ] = "Options" ;
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 228 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 228 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 228 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ Text [ en-US ] = "Insert Plug-in" ;
+};
+ModalDialog MD_INSERT_OBJECT_APPLET
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 284 , 164 ) ;
+ Moveable = TRUE ;
+ FixedText FT_CLASSFILE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 204 , 10 ) ;
+ Text [ en-US ] = "~Class" ;
+ };
+ Edit ED_CLASSFILE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 204 , 12 ) ;
+ };
+ FixedText FT_CLASSLOCATION
+ {
+ Pos = MAP_APPFONT ( 12 , 42 ) ;
+ Size = MAP_APPFONT ( 204 , 10 ) ;
+ Text [ en-US ] = "Class ~Location" ;
+ };
+ Edit ED_CLASSLOCATION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 55 ) ;
+ Size = MAP_APPFONT ( 204 , 12 ) ;
+ };
+ PushButton BTN_CLASS
+ {
+ Pos = MAP_APPFONT ( 166 , 70 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Search..." ;
+ };
+ FixedLine GB_CLASS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 216 , 8 ) ;
+ Text [ en-US ] = "File" ;
+ };
+ MultiLineEdit ED_APPLET_OPTIONS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 107 ) ;
+ Size = MAP_APPFONT ( 204 , 45 ) ;
+ VScroll = TRUE ;
+ IgnoreTab = TRUE;
+ };
+ FixedLine GB_APPLET_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 96 ) ;
+ Size = MAP_APPFONT ( 216 , 8 ) ;
+ Text [ en-US ] = "Options" ;
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 228 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 228 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 228 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ Text [ en-US ] = "Insert Applet" ;
+};
+Control TB_LINKS
+{
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 21 ) ;
+ Size = MAP_APPFONT ( 257 , 87 ) ;
+ TabStop = TRUE ;
+ ClipChildren = TRUE ;
+};
+
+ModalDialog MD_INSERT_OBJECT_IFRAME
+{
+ Size = MAP_APPFONT ( 302 , 98 ) ;
+ Hide = TRUE ;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Floating Frame Properties" ;
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 246 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 246 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 246 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ FixedText FT_FRAMENAME
+ {
+ Pos = MAP_APPFONT ( 6 , 7 ) ;
+ Size = MAP_APPFONT ( 36 , 10 ) ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_FRAMENAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 45 , 6 ) ;
+ Size = MAP_APPFONT ( 178 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_URL
+ {
+ Pos = MAP_APPFONT ( 6 , 25 ) ;
+ Size = MAP_APPFONT ( 36 , 10 ) ;
+ Text [ en-US ] = "~Contents" ;
+ };
+ Edit ED_URL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 45 , 24 ) ;
+ Size = MAP_APPFONT ( 178 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton BT_FILEOPEN
+ {
+ Pos = MAP_APPFONT ( 226 , 24 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "~..." ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_SCROLLINGON
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Size = MAP_APPFONT ( 54 , 10 ) ;
+ Text [ en-US ] = "~On" ;
+ };
+ RadioButton RB_SCROLLINGOFF
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 66 ) ;
+ Size = MAP_APPFONT ( 54 , 10 ) ;
+ Text [ en-US ] = "O~ff" ;
+ };
+ RadioButton RB_SCROLLINGAUTO
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 79 ) ;
+ Size = MAP_APPFONT ( 54 , 10 ) ;
+ Text [ en-US ] = "Au~tomatic" ;
+ };
+ FixedLine GB_SCROLLING
+ {
+ Pos = MAP_APPFONT ( 6 , 42 ) ;
+ Size = MAP_APPFONT ( 63 , 8 ) ;
+ Text [ en-US ] = "Scroll bar" ;
+ };
+ RadioButton RB_FRMBORDER_ON
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 81 , 53 ) ;
+ Size = MAP_APPFONT ( 42 , 10 ) ;
+ Text [ en-US ] = "On" ;
+ };
+ RadioButton RB_FRMBORDER_OFF
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 81 , 66 ) ;
+ Size = MAP_APPFONT ( 42 , 10 ) ;
+ Text [ en-US ] = "Off" ;
+ };
+ FixedLine FL_SEP_LEFT
+ {
+ Pos = MAP_APPFONT ( 70 , 51 ) ;
+ Size = MAP_APPFONT ( 4 , 38 ) ;
+ };
+ FixedLine GB_BORDER
+ {
+ Pos = MAP_APPFONT ( 75 , 42 ) ;
+ Size = MAP_APPFONT ( 49 , 8 ) ;
+ Text [ en-US ] = "Border" ;
+ };
+ FixedText FT_MARGINWIDTH
+ {
+ Pos = MAP_APPFONT ( 136 , 56 ) ;
+ Size = MAP_APPFONT ( 28 , 10 ) ;
+ Text [ en-US ] = "~Width" ;
+ };
+ NumericField NM_MARGINWIDTH
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 167 , 54 ) ;
+ Size = MAP_APPFONT ( 20 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 99 ;
+ Last = 10 ;
+ SpinSize = 1 ;
+ };
+ CheckBox CB_MARGINWIDTHDEFAULT
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 190 , 56 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "~Default" ;
+ };
+ FixedText FT_MARGINHEIGHT
+ {
+ Pos = MAP_APPFONT ( 136 , 74 ) ;
+ Size = MAP_APPFONT ( 28 , 10 ) ;
+ Text [ en-US ] = "H~eight" ;
+ };
+ NumericField NM_MARGINHEIGHT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 167 , 72 ) ;
+ Size = MAP_APPFONT ( 20 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 99 ;
+ Last = 10 ;
+ SpinSize = 1 ;
+ };
+ CheckBox CB_MARGINHEIGHTDEFAULT
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 190 , 74 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "Defa~ult" ;
+ };
+ FixedLine FL_SEP_RIGHT
+ {
+ Pos = MAP_APPFONT ( 125 , 51 ) ;
+ Size = MAP_APPFONT ( 4 , 38 ) ;
+ };
+ FixedLine GB_MARGIN
+ {
+ Pos = MAP_APPFONT ( 130 , 42 ) ;
+ Size = MAP_APPFONT ( 110 , 8 ) ;
+ Text [ en-US ] = "Spacing to contents" ;
+ };
+};
+
+String MD_INSERT_OBJECT_IFRAME
+{
+ Text [ en-US ] = "Select File for Floating Frame" ;
+};
+
+String STR_EDIT_APPLET
+{
+ Text [ en-US ] = "Edit Applet" ;
+};
+
diff --git a/cui/source/dialogs/tbxform.src b/cui/source/dialogs/tbxform.src
new file mode 100644
index 000000000000..4d66b4541704
--- /dev/null
+++ b/cui/source/dialogs/tbxform.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: tbxform.src,v $
+ * $Revision: 1.31 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "fmsearch.hrc"
+
+ModalDialog RID_SVX_DLG_INPUTRECORDNO
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 130 , 45 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Record Number";
+
+ FixedText 1
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 70 , 12 ) ;
+ Text [ en-US ] = "go to record";
+ };
+ NumericField 1
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 79 , 6 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 6 , 25 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 74 , 25 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
diff --git a/cui/source/dialogs/winpluginlib.cpp b/cui/source/dialogs/winpluginlib.cpp
new file mode 100644
index 000000000000..0b1fced85b40
--- /dev/null
+++ b/cui/source/dialogs/winpluginlib.cpp
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * 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: winpluginlib.cpp,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#include <windows.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+#include <Winreg.h>
+#include <Shlwapi.h>
+#include <stdio.h>
+
+
+#define SO_PATH_SIZE 4096
+#define MOZ_PLUGIN_DLL_NAME "npsopluginmi.dll"
+extern "C" {
+int lc_isInstalled(const char* realFilePath)
+{
+ HKEY hKeySoftware;
+ HKEY hMozillaPlugins;
+ HKEY hStarOffice;
+ char sSoPath[SO_PATH_SIZE];
+ char sPluginPath[SO_PATH_SIZE];
+
+ LONG ret;
+ ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ, &hKeySoftware);
+ if(ret != ERROR_SUCCESS){
+ ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE", 0, KEY_READ, &hKeySoftware);
+ if(ret != ERROR_SUCCESS){
+ return -1;
+ }
+ }
+ ret = RegOpenKeyEx(hKeySoftware, "MozillaPlugins", 0, KEY_READ, &hMozillaPlugins);
+ if(ret != ERROR_SUCCESS){
+ RegCloseKey(hKeySoftware);
+ if( ret == ERROR_FILE_NOT_FOUND)
+ return 1;
+ else
+ return -1;
+ }
+ ret = RegOpenKeyEx(hMozillaPlugins, "@sun.com/npsopluginmi;version=1.0", 0, KEY_READ, &hStarOffice);
+ if(ret != ERROR_SUCCESS){
+ RegCloseKey(hKeySoftware);
+ RegCloseKey(hMozillaPlugins);
+ if( ret == ERROR_FILE_NOT_FOUND)
+ return 1;
+ else
+ return -1;
+ }
+
+ if((realFilePath == NULL) || (strlen(realFilePath) == 0) || (strlen(realFilePath) >= SO_PATH_SIZE))
+ ret = -1;
+ else{
+ sprintf(sSoPath,"%s", realFilePath);
+ ret = 0;
+ }
+ //ret = GetCurrentDirectory( SO_PATH_SIZE, sSoPath);
+ //ret = GetEnvironmentVariable("prog", sSoPath, SO_PATH_SIZE);
+ // GetCurrentDirectory return the char number of the string
+ if(ret == 0){
+ DWORD dType = REG_SZ;
+ DWORD dSize = SO_PATH_SIZE;
+ ret = RegQueryValueEx (hStarOffice, "Path", NULL, &dType , (LPBYTE) sPluginPath, &dSize);
+ if(ret == ERROR_SUCCESS){
+ if(strcmp(sPluginPath, sSoPath) == 0)
+ ret = 0;
+ else
+ ret = 1;
+ }
+ else
+ ret = -1;
+ }
+ else
+ ret = -1;
+ RegCloseKey(hStarOffice);
+ RegCloseKey(hMozillaPlugins);
+ RegCloseKey(hKeySoftware);
+ return ret;
+}
+
+int lc_uninstallPlugin(const char*)
+{
+ HKEY hKeySoftware;
+ HKEY hMozillaPlugins;
+ HKEY hStarOffice;
+
+ LONG ret;
+ ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware);
+ if(ret != ERROR_SUCCESS){
+ ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware);
+ if(ret != ERROR_SUCCESS){
+ return -1;
+ }
+ }
+ ret = RegOpenKeyEx(hKeySoftware, "MozillaPlugins", 0, KEY_READ|KEY_WRITE, &hMozillaPlugins);
+ if(ret != ERROR_SUCCESS){
+ RegCloseKey(hKeySoftware);
+ if( ret == ERROR_FILE_NOT_FOUND)
+ return 0;
+ else
+ return -1;
+ }
+
+ ret = RegOpenKeyEx(hMozillaPlugins, "@sun.com/npsopluginmi;version=1.0", 0, KEY_READ|KEY_WRITE, &hStarOffice);
+ if(ret != ERROR_SUCCESS){
+ RegCloseKey(hKeySoftware);
+ RegCloseKey(hMozillaPlugins);
+ if( ret == ERROR_FILE_NOT_FOUND)
+ return 0;
+ else
+ return -1;
+ }
+ RegCloseKey(hStarOffice);
+ ret = SHDeleteKey(hMozillaPlugins, "@sun.com/npsopluginmi;version=1.0");
+ if(ret != ERROR_SUCCESS){
+ ret = -1;
+ }
+ RegFlushKey(hMozillaPlugins);
+ RegCloseKey(hMozillaPlugins);
+ RegCloseKey(hKeySoftware);
+ return ret;
+}
+
+int lc_installPlugin(const char* realFilePath)
+{
+ HKEY hKeySoftware;
+ HKEY hMozillaPlugins;
+ HKEY hStarOffice;
+ char sSoPath[SO_PATH_SIZE];
+ DWORD sState;
+
+
+ LONG ret;
+ ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware);
+ if(ret != ERROR_SUCCESS){
+ ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware);
+ if(ret != ERROR_SUCCESS){
+ return -1;
+ }
+ }
+ ret = RegOpenKeyEx(hKeySoftware, "MozillaPlugins", 0, KEY_READ|KEY_WRITE, &hMozillaPlugins);
+ if(ret != ERROR_SUCCESS){
+ RegCreateKeyEx(hKeySoftware,
+ "MozillaPlugins",
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ|KEY_WRITE,
+ NULL,
+ &hMozillaPlugins,
+ &sState);
+ }
+
+ ret = RegCreateKeyEx(hMozillaPlugins,
+ "@sun.com/npsopluginmi;version=1.0",
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ|KEY_WRITE,
+ NULL,
+ &hStarOffice,
+ &sState);
+ if(ret != ERROR_SUCCESS){
+ RegCloseKey(hKeySoftware);
+ RegCloseKey(hMozillaPlugins);
+ return -1;
+ }
+
+ RegFlushKey(hStarOffice);
+ RegFlushKey(hMozillaPlugins);
+
+
+ if((realFilePath == NULL) || (strlen(realFilePath) == 0) || (strlen(realFilePath) >= SO_PATH_SIZE))
+ ret = -1;
+ else{
+ sprintf(sSoPath,"%s", realFilePath);
+ ret = 0;
+ }
+
+ //ret = GetCurrentDirectory( SO_PATH_SIZE, sSoPath);
+ // GetCurrentDirectory return the char number of the string
+ if(ret == 0){
+ ret = RegSetValueEx( hStarOffice, "Path", 0, REG_SZ, (LPBYTE) sSoPath, strlen(sSoPath) + 1);
+ if(ret == ERROR_SUCCESS)
+ ret = 0;
+ else
+ ret = -1;
+ }
+ else
+ ret = -1;
+ RegFlushKey(hStarOffice);
+ RegFlushKey(hMozillaPlugins);
+ RegCloseKey(hStarOffice);
+ RegCloseKey(hMozillaPlugins);
+ RegCloseKey(hKeySoftware);
+ RegFlushKey(HKEY_LOCAL_MACHINE);
+
+ return ret;
+}
+}
diff --git a/cui/source/dialogs/zoom.cxx b/cui/source/dialogs/zoom.cxx
new file mode 100644
index 000000000000..3afc3ee4c332
--- /dev/null
+++ b/cui/source/dialogs/zoom.cxx
@@ -0,0 +1,537 @@
+/*************************************************************************
+ *
+ * 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: zoom.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <tools/shl.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/msgbox.hxx>
+
+#define _SVX_ZOOM_CXX
+
+#include <svx/dialogs.hrc>
+#include "zoom.hrc"
+
+#include "zoom.hxx"
+#include <svx/zoomitem.hxx>
+#include <svx/viewlayoutitem.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/zoom_def.hxx>
+
+#include <layout/layout-pre.hxx>
+
+#if ENABLE_LAYOUT
+#undef SVX_RES
+#define SVX_RES(x) #x
+#undef SfxModalDialog
+#define SfxModalDialog( parent, id ) Dialog( parent, "zoom.xml", id )
+#endif /* ENABLE_LAYOUT */
+
+// static ----------------------------------------------------------------
+
+static USHORT pRanges[] =
+{
+ SID_ATTR_ZOOM,
+ SID_ATTR_ZOOM,
+ 0
+};
+
+#define SPECIAL_FACTOR ((USHORT)0xFFFF)
+
+// class SvxZoomDialog ---------------------------------------------------
+
+USHORT SvxZoomDialog::GetFactor() const
+{
+ if ( a100Btn.IsChecked() )
+ return 100;
+ if ( aUserBtn.IsChecked() )
+ return (USHORT)aUserEdit.GetValue();
+ else
+ return SPECIAL_FACTOR;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetFactor( USHORT nNewFactor, USHORT nBtnId )
+{
+ aUserEdit.Disable();
+
+ if ( !nBtnId )
+ {
+ if ( nNewFactor == 100 )
+ {
+ a100Btn.Check();
+ a100Btn.GrabFocus();
+ }
+ else
+ {
+ aUserBtn.Check();
+ aUserEdit.Enable();
+ aUserEdit.SetValue( (long)nNewFactor );
+ aUserEdit.GrabFocus();
+ }
+ }
+ else
+ {
+ aUserEdit.SetValue( (long)nNewFactor );
+
+ if ( ZOOMBTN_OPTIMAL == nBtnId )
+ {
+ aOptimalBtn.Check();
+ aOptimalBtn.GrabFocus();
+ }
+ else if ( ZOOMBTN_PAGEWIDTH == nBtnId )
+ {
+ aPageWidthBtn.Check();
+ aPageWidthBtn.GrabFocus();
+ }
+ else if ( ZOOMBTN_WHOLEPAGE == nBtnId )
+ {
+ aWholePageBtn.Check();
+ aWholePageBtn.GrabFocus();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetButtonText( USHORT nBtnId, const String& rNewTxt )
+{
+ switch ( nBtnId )
+ {
+ case ZOOMBTN_OPTIMAL: // Optimal-Button
+ aOptimalBtn.SetText( rNewTxt );
+ break;
+
+ case ZOOMBTN_PAGEWIDTH: // Seitenbreite-Button
+ aPageWidthBtn.SetText( rNewTxt );
+ break;
+
+ case ZOOMBTN_WHOLEPAGE: // Ganze Seite-Button
+ aWholePageBtn.SetText( rNewTxt );
+ break;
+
+ default:
+ DBG_ERROR( "wrong button number" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::HideButton( USHORT nBtnId )
+{
+ switch ( nBtnId )
+ {
+ case ZOOMBTN_OPTIMAL: // Optimal-Button
+ aOptimalBtn.Hide();
+ break;
+
+ case ZOOMBTN_PAGEWIDTH: // Seitenbreite-Button
+ aPageWidthBtn.Hide();
+ break;
+
+ case ZOOMBTN_WHOLEPAGE: // Ganze Seite-Button
+ aWholePageBtn.Hide();
+ break;
+
+ default:
+ DBG_ERROR( "Falsche Button-Nummer!!!" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetLimits( USHORT nMin, USHORT nMax )
+{
+ DBG_ASSERT( nMin < nMax, "invalid limits" );
+ aUserEdit.SetMin( nMin );
+ aUserEdit.SetFirst( nMin );
+ aUserEdit.SetMax( nMax );
+ aUserEdit.SetLast( nMax );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetSpinSize( USHORT nNewSpin )
+{
+ aUserEdit.SetSpinSize( nNewSpin );
+}
+
+// -----------------------------------------------------------------------
+
+SvxZoomDialog::SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet ) :
+
+ SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_ZOOM ) ),
+
+ aZoomFl ( this, SVX_RES( FL_ZOOM ) ),
+ aOptimalBtn ( this, SVX_RES( BTN_OPTIMAL ) ),
+ aWholePageBtn ( this, SVX_RES( BTN_WHOLE_PAGE ) ),
+ aPageWidthBtn ( this, SVX_RES( BTN_PAGE_WIDTH ) ),
+ a100Btn ( this, SVX_RES( BTN_100 ) ),
+ aUserBtn ( this, SVX_RES( BTN_USER ) ),
+ aUserEdit ( this, SVX_RES( ED_USER ) ),
+
+ aViewLayoutFl ( this, SVX_RES( FL_VIEWLAYOUT ) ),
+ aAutomaticBtn ( this, SVX_RES( BTN_AUTOMATIC ) ),
+ aSingleBtn ( this, SVX_RES( BTN_SINGLE ) ),
+ aColumnsBtn ( this, SVX_RES( BTN_COLUMNS ) ),
+ aColumnsEdit ( this, SVX_RES( ED_COLUMNS ) ),
+ aBookModeChk ( this, SVX_RES( CHK_BOOK ) ),
+
+ aBottomFl ( this, SVX_RES( FL_BOTTOM ) ),
+ aOKBtn ( this, SVX_RES( BTN_ZOOM_OK ) ),
+ aCancelBtn ( this, SVX_RES( BTN_ZOOM_CANCEL ) ),
+ aHelpBtn ( this, SVX_RES( BTN_ZOOM_HELP ) ),
+
+ rSet ( rCoreSet ),
+ pOutSet ( NULL ),
+ bModified ( FALSE )
+
+{
+#if ENABLE_LAYOUT
+ SetHelpId (SID_ATTR_ZOOM);
+#endif /* ENABLE_LAYOUT */
+ Link aLink = LINK( this, SvxZoomDialog, UserHdl );
+ a100Btn.SetClickHdl( aLink );
+ aOptimalBtn.SetClickHdl( aLink );
+ aPageWidthBtn.SetClickHdl( aLink );
+ aWholePageBtn.SetClickHdl( aLink );
+ aUserBtn.SetClickHdl( aLink );
+
+ Link aViewLayoutLink = LINK( this, SvxZoomDialog, ViewLayoutUserHdl );
+ aAutomaticBtn.SetClickHdl( aViewLayoutLink );
+ aSingleBtn.SetClickHdl( aViewLayoutLink );
+ aColumnsBtn.SetClickHdl( aViewLayoutLink );
+
+ Link aViewLayoutSpinLink = LINK( this, SvxZoomDialog, ViewLayoutSpinHdl );
+ aColumnsEdit.SetModifyHdl( aViewLayoutSpinLink );
+
+ Link aViewLayoutCheckLink = LINK( this, SvxZoomDialog, ViewLayoutCheckHdl );
+ aBookModeChk.SetClickHdl( aViewLayoutCheckLink );
+
+ aOKBtn.SetClickHdl( LINK( this, SvxZoomDialog, OKHdl ) );
+ aUserEdit.SetModifyHdl( LINK( this, SvxZoomDialog, SpinHdl ) );
+
+ // Default-Werte
+ USHORT nValue = 100;
+ USHORT nMin = 10;
+ USHORT nMax = 1000;
+
+ // ggf. erst den alten Wert besorgen
+ const SfxUInt16Item* pOldUserItem = 0;
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ if ( pSh )
+ pOldUserItem = (const SfxUInt16Item*)pSh->GetItem( SID_ATTR_ZOOM_USER );
+
+ if ( pOldUserItem )
+ nValue = pOldUserItem->GetValue();
+
+ // UserEdit initialisieren
+ if ( nMin > nValue )
+ nMin = nValue;
+ if ( nMax < nValue )
+ nMax = nValue;
+ aUserEdit.SetMin( nMin );
+ aUserEdit.SetFirst( nMin );
+ aUserEdit.SetMax( nMax );
+ aUserEdit.SetLast( nMax );
+ aUserEdit.SetValue( nValue );
+
+ const SfxPoolItem& rItem = rSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) );
+
+ if ( rItem.ISA(SvxZoomItem) )
+ {
+ const SvxZoomItem& rZoomItem = (const SvxZoomItem&)rItem;
+ const USHORT nZoom = rZoomItem.GetValue();
+ const SvxZoomType eType = rZoomItem.GetType();
+ const USHORT nValSet = rZoomItem.GetValueSet();
+ USHORT nBtnId = 0;
+
+ switch ( eType )
+ {
+ case SVX_ZOOM_OPTIMAL:
+ nBtnId = ZOOMBTN_OPTIMAL;
+ break;
+ case SVX_ZOOM_PAGEWIDTH:
+ nBtnId = ZOOMBTN_PAGEWIDTH;
+ break;
+ case SVX_ZOOM_WHOLEPAGE:
+ nBtnId = ZOOMBTN_WHOLEPAGE;
+ break;
+ case SVX_ZOOM_PERCENT:
+ break;
+ case SVX_ZOOM_PAGEWIDTH_NOBORDER:
+ break;
+ }
+
+ if ( !(SVX_ZOOM_ENABLE_100 & nValSet) )
+ a100Btn.Disable();
+ if ( !(SVX_ZOOM_ENABLE_OPTIMAL & nValSet) )
+ aOptimalBtn.Disable();
+ if ( !(SVX_ZOOM_ENABLE_PAGEWIDTH & nValSet) )
+ aPageWidthBtn.Disable();
+ if ( !(SVX_ZOOM_ENABLE_WHOLEPAGE & nValSet) )
+ aWholePageBtn.Disable();
+ SetFactor( nZoom, nBtnId );
+ }
+ else
+ {
+ const USHORT nZoom = ( (const SfxUInt16Item&)rItem ).GetValue();
+ SetFactor( nZoom );
+ }
+
+ const SfxPoolItem* pViewLayoutItem = 0;
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_VIEWLAYOUT, FALSE, &pViewLayoutItem ) )
+ {
+ const USHORT nColumns = static_cast<const SvxViewLayoutItem*>(pViewLayoutItem)->GetValue();
+ const bool bBookMode = static_cast<const SvxViewLayoutItem*>(pViewLayoutItem)->IsBookMode();
+
+ if ( 0 == nColumns )
+ {
+ aAutomaticBtn.Check();
+ aColumnsEdit.SetValue( 2 );
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+ else if ( 1 == nColumns)
+ {
+ aSingleBtn.Check();
+ aColumnsEdit.SetValue( 2 );
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+ else
+ {
+ aColumnsBtn.Check();
+ if ( !bBookMode )
+ {
+ aColumnsEdit.SetValue( nColumns );
+ if ( 0 != nColumns % 2 )
+ aBookModeChk.Disable();
+ }
+ else
+ {
+ aColumnsEdit.SetValue( nColumns );
+ aBookModeChk.Check();
+ }
+ }
+ }
+ else
+ {
+ // hide view layout related controls:
+ aViewLayoutFl.Disable();
+ aAutomaticBtn.Disable();
+ aSingleBtn.Disable();
+ aColumnsBtn.Disable();
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SvxZoomDialog::~SvxZoomDialog()
+{
+ delete pOutSet;
+ pOutSet = 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxZoomDialog::GetRanges()
+{
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, UserHdl, RadioButton *, pBtn )
+{
+ bModified |= TRUE;
+
+ if ( pBtn == &aUserBtn )
+ {
+ aUserEdit.Enable();
+ aUserEdit.GrabFocus();
+ }
+ else
+ aUserEdit.Disable();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, SpinHdl, MetricField *, EMPTYARG )
+{
+ if ( !aUserBtn.IsChecked() )
+ return 0;
+ bModified |= TRUE;
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, ViewLayoutUserHdl, RadioButton *, pBtn )
+{
+ bModified |= TRUE;
+
+ if ( pBtn == &aAutomaticBtn )
+ {
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+ else if ( pBtn == &aSingleBtn )
+ {
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+ else if ( pBtn == &aColumnsBtn )
+ {
+ aColumnsEdit.Enable();
+ aColumnsEdit.GrabFocus();
+ if ( 0 == aColumnsEdit.GetValue() % 2 )
+ aBookModeChk.Enable();
+ }
+ else
+ {
+ DBG_ERROR( "Wrong Button" );
+ return 0;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, ViewLayoutSpinHdl, MetricField *, pEdt )
+{
+ if ( pEdt == &aColumnsEdit && !aColumnsBtn.IsChecked() )
+ return 0;
+
+ if ( 0 == aColumnsEdit.GetValue() % 2 )
+ aBookModeChk.Enable();
+ else
+ {
+ aBookModeChk.Check( sal_False );
+ aBookModeChk.Disable();
+ }
+
+ bModified |= TRUE;
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, ViewLayoutCheckHdl, CheckBox *, pChk )
+{
+ if ( pChk == &aBookModeChk && !aColumnsBtn.IsChecked() )
+ return 0;
+
+ bModified |= TRUE;
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, OKHdl, Button *, pBtn )
+{
+ if ( bModified || &aOKBtn != pBtn )
+ {
+ SvxZoomItem aZoomItem( SVX_ZOOM_PERCENT, 0, rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) );
+ SvxViewLayoutItem aViewLayoutItem( 0, false, rSet.GetPool()->GetWhich( SID_ATTR_VIEWLAYOUT ) );
+
+ if ( &aOKBtn == pBtn )
+ {
+ USHORT nFactor = GetFactor();
+
+ if ( SPECIAL_FACTOR == nFactor )
+ {
+ if ( aOptimalBtn.IsChecked() )
+ aZoomItem.SetType( SVX_ZOOM_OPTIMAL );
+ else if ( aPageWidthBtn.IsChecked() )
+ aZoomItem.SetType( SVX_ZOOM_PAGEWIDTH );
+ else if ( aWholePageBtn.IsChecked() )
+ aZoomItem.SetType( SVX_ZOOM_WHOLEPAGE );
+ }
+ else
+ aZoomItem.SetValue( nFactor );
+
+ if ( aAutomaticBtn.IsChecked() )
+ {
+ aViewLayoutItem.SetValue( 0 );
+ aViewLayoutItem.SetBookMode( false );
+ }
+ if ( aSingleBtn.IsChecked() )
+ {
+ aViewLayoutItem.SetValue( 1 );
+ aViewLayoutItem.SetBookMode( false );
+ }
+ else if ( aColumnsBtn.IsChecked() )
+ {
+ aViewLayoutItem.SetValue( static_cast<USHORT>(aColumnsEdit.GetValue()) );
+ aViewLayoutItem.SetBookMode( aBookModeChk.IsChecked() );
+ }
+ }
+ else
+ {
+ DBG_ERROR( "Wrong Button" );
+ return 0;
+ }
+ pOutSet = new SfxItemSet( rSet );
+ pOutSet->Put( aZoomItem );
+
+ // don't set attribute in case the whole viewlayout stuff is disabled:
+ if ( aViewLayoutFl.IsEnabled() )
+ pOutSet->Put( aViewLayoutItem );
+
+ // Wert aus dem UserEdit "uber den Dialog hinaus merken
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ if ( pSh )
+ pSh->PutItem( SfxUInt16Item( SID_ATTR_ZOOM_USER,
+ (UINT16)aUserEdit.GetValue() ) );
+ EndDialog( RET_OK );
+ }
+ else
+ EndDialog( RET_CANCEL );
+ return 0;
+}
+
+
diff --git a/cui/source/dialogs/zoom.hrc b/cui/source/dialogs/zoom.hrc
new file mode 100644
index 000000000000..70e488c2893e
--- /dev/null
+++ b/cui/source/dialogs/zoom.hrc
@@ -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: zoom.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_ZOOM_HRC
+#define _SVX_ZOOM_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FL_ZOOM 14
+#define BTN_OPTIMAL 15
+#define BTN_WHOLE_PAGE 16
+#define BTN_PAGE_WIDTH 17
+#define BTN_100 18
+#define BTN_USER 19
+#define ED_USER 20
+
+#define FL_VIEWLAYOUT 21
+#define BTN_AUTOMATIC 22
+#define BTN_SINGLE 23
+#define BTN_COLUMNS 24
+#define ED_COLUMNS 25
+#define CHK_BOOK 26
+
+#define FL_BOTTOM 27
+#define BTN_ZOOM_OK 28
+#define BTN_ZOOM_CANCEL 29
+#define BTN_ZOOM_HELP 30
+
+#endif
+
diff --git a/cui/source/dialogs/zoom.src b/cui/source/dialogs/zoom.src
new file mode 100644
index 000000000000..197d1e2f2959
--- /dev/null
+++ b/cui/source/dialogs/zoom.src
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * 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: zoom.src,v $
+ * $Revision: 1.31 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include "zoom.hrc"
+ // RID_SVXDLG_ZOOM -------------------------------------------------------
+ModalDialog RID_SVXDLG_ZOOM
+{
+ HelpId = SID_ATTR_ZOOM ;
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 242 , 112 ) ;
+ Moveable = TRUE ;
+ Text [ en-US ] = "Zoom & View Layout";
+ FixedLine FL_ZOOM
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
+ Text [ en-US ] = "Zoom factor";
+ };
+ RadioButton BTN_OPTIMAL
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 105 , 10 ) ;
+ Text [ en-US ] = "~Optimal" ;
+ };
+ RadioButton BTN_WHOLE_PAGE
+ {
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 105 , 10 ) ;
+ Text [ en-US ] = "~Fit width and height" ;
+ };
+ RadioButton BTN_PAGE_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 105, 10 ) ;
+ Text [ en-US ] = "Fit ~width" ;
+ };
+ RadioButton BTN_100
+ {
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Size = MAP_APPFONT ( 105, 10 ) ;
+ Text = "~100 %" ;
+ };
+ RadioButton BTN_USER
+ {
+ Pos = MAP_APPFONT ( 12 , 67 ) ;
+ Size = MAP_APPFONT ( 72 , 10 ) ;
+ Text [ en-US ] = "~Variable" ;
+ };
+ MetricField ED_USER
+ {
+ Pos = MAP_APPFONT ( 86 , 66 ) ;
+ Size = MAP_APPFONT ( 32 , 12 ) ;
+ Border = TRUE ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ SpinSize = 1 ;
+ };
+ FixedLine FL_VIEWLAYOUT
+ {
+ Pos = MAP_APPFONT ( 124 , 3 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
+ Text [ en-US ] = "View layout";
+ };
+ RadioButton BTN_AUTOMATIC
+ {
+ Pos = MAP_APPFONT ( 130 , 14 ) ;
+ Size = MAP_APPFONT ( 106 , 10 ) ;
+ Text [ en-US ] = "~Automatic" ;
+ };
+ RadioButton BTN_SINGLE
+ {
+ Pos = MAP_APPFONT ( 130, 27 ) ;
+ Size = MAP_APPFONT ( 106, 10 ) ;
+ Text [ en-US ] = "~Single page" ;
+ };
+ RadioButton BTN_COLUMNS
+ {
+ Pos = MAP_APPFONT ( 130, 41 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ Text [ en-US ] = "~Columns" ;
+ };
+ MetricField ED_COLUMNS
+ {
+ Pos = MAP_APPFONT ( 209 , 40 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Border = TRUE ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ SpinSize = 1 ;
+ Minimum = 1;
+ Maximum = 999;
+ };
+ CheckBox CHK_BOOK
+ {
+ Pos = MAP_APPFONT ( 136 , 55 ) ;
+ Size = MAP_APPFONT ( 85 , 10 ) ;
+ Text [ en-US ] = "~Book mode" ;
+ };
+ FixedLine FL_BOTTOM
+ {
+ Pos = MAP_APPFONT ( 6 , 81 ) ;
+ Size = MAP_APPFONT ( 230 , 8 ) ;
+ };
+ OKButton BTN_ZOOM_OK
+ {
+ Pos = MAP_APPFONT ( 77 , 92 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_ZOOM_CANCEL
+ {
+ Pos = MAP_APPFONT ( 130 , 92 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_ZOOM_HELP
+ {
+ Pos = MAP_APPFONT ( 186 , 92 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+// ********************************************************************** EOF
+
diff --git a/cui/source/factory/cuiexp.cxx b/cui/source/factory/cuiexp.cxx
new file mode 100644
index 000000000000..b294c3a6ea7d
--- /dev/null
+++ b/cui/source/factory/cuiexp.cxx
@@ -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: cuiexp.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "dlgfact.hxx"
+#include "sal/types.h"
+
+namespace cui
+{
+ static AbstractDialogFactory_Impl* pFactory=NULL;
+ AbstractDialogFactory_Impl* GetFactory()
+ {
+ if ( !pFactory )
+ pFactory = new AbstractDialogFactory_Impl;
+ return pFactory;
+ }
+}
+
+extern "C"
+{
+ SAL_DLLPUBLIC_EXPORT VclAbstractDialogFactory* CreateDialogFactory()
+ {
+ return ::cui::GetFactory();
+ }
+}
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
new file mode 100644
index 000000000000..14b15e50192a
--- /dev/null
+++ b/cui/source/factory/dlgfact.cxx
@@ -0,0 +1,2286 @@
+/*************************************************************************
+ *
+ * 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: dlgfact.cxx,v $
+ * $Revision: 1.48 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "dlgfact.hxx"
+
+#include <tools/rc.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/request.hxx>
+#include <svx/dialogs.hrc>
+
+#include "numfmt.hxx"
+#include "optimprove.hxx"
+#include "splitcelldlg.hxx"
+#include "gallery.hrc"
+#include "dstribut.hxx"
+#include "cuigaldlg.hxx"
+#include "cuiimapwnd.hxx"
+#include "hlmarkwn.hxx"
+#include "cuicharmap.hxx"
+#include "srchxtra.hxx"
+#include "textanim.hxx"
+#include "autocdlg.hxx"
+#include "treeopt.hxx"
+#include "internationaloptions.hxx"
+#include "labdlg.hxx"
+#include "hangulhanjadlg.hxx" //add for HangulHanjaConversionDialog
+#include "showcols.hxx" //add for FmShowColsDialog
+#include "zoom.hxx" //add for SvxZoomDialog
+#include "cuigaldlg.hxx" //add for Gallery 6 Dialogs and 1 TabPage
+#include "cuiimapwnd.hxx" //add for URLDlg
+#include "hlmarkwn.hxx" //add for SvxHlinkDlgMarkWnd
+#include "srchxtra.hxx" //add for SvxSearchFormatDialog
+#include "transfrm.hxx" //add for SvxTransformTabDialog
+#include "bbdlg.hxx" //add for SvxBorderBackgroundDlg
+#include "cuisrchdlg.hxx" //add for SvxJSearchOptionsDialog
+#include "cuitbxform.hxx" //add for FmInputRecordNoDialog
+#include "optdict.hxx" //add for SvxNewDictionaryDialog
+#include "dlgname.hxx" //add for SvxNameDialog & SvxMessDialog
+#include "multipat.hxx" //add for SvxMultiPathDialog
+#include "multifil.hxx" //add for SvxMultiFileDialog
+#include "cuihyperdlg.hxx" //add for SvxHpLinkDlg
+#include "cuifmsearch.hxx" //add for FmSearchDialog
+#include "cuigrfflt.hxx" //add for GraphicFilterDialog
+#include "cuitabarea.hxx" //add for SvxAreaTabDialog
+#include "cuitabline.hxx" //add for SvxLineTabDialog
+#include "measure.hxx" //add for SvxMeasureDialog
+#include "connect.hxx" //add for SvxConnectionDialog
+#include "dbregister.hxx" // add for DatabaseRegistrationDialog
+#include "cuioptgenrl.hxx" //add for SvxGeneralTabPage
+#include "optasian.hxx"
+#include "insdlg.hxx"
+#include "pastedlg.hxx"
+#include "linkdlg.hxx"
+#include "SpellDialog.hxx"
+#include "cfg.hxx" //add for SvxConfigDialog
+#include "numpages.hxx" // add for
+#include "paragrph.hxx" //add for
+#include "tabstpge.hxx" // add for
+#include "textattr.hxx" // add for SvxTextAttrPage
+#include "align.hxx" //add for SvxAlignmentTabPage
+#include "backgrnd.hxx" //add for SvxBackgroundTabPage
+#include "border.hxx" //add for SvxBorderTabPage
+#include "chardlg.hxx" //add for SvxCharNamePage,SvxCharEffectsPage,SvxCharPositionPage,SvxCharTwoLinesPage
+#include "page.hxx" //add for SvxPageDescPage
+#include "postdlg.hxx" //add for SvxPostItDialog
+#include "grfpage.hxx" //add for SvxGrfCropPage
+#include "scriptdlg.hxx" // for ScriptOrgDialog
+#include "selector.hxx" // for SvxScriptSelectorDialog
+#include "macropg.hxx" // for SvxMacroAssignDlg
+#include "sdrcelldlg.hxx"
+#include "newtabledlg.hxx"
+#include "macroass.hxx"
+#include "acccfg.hxx"
+#include "insrc.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::container;
+
+using ::com::sun::star::uno::Reference;
+
+using namespace svx;
+// AbstractTabDialog implementations just forwards everything to the dialog
+IMPL_ABSTDLG_BASE(AbstractSfxDialog_Impl)
+IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl)
+IMPL_ABSTDLG_BASE(VclAbstractRefreshableDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxDistributeDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractHangulHanjaConversionDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractFmShowColsDialog_Impl);
+
+AbstractSvxZoomDialog_Impl::~AbstractSvxZoomDialog_Impl() \
+{
+ delete pDlg;
+}
+short AbstractSvxZoomDialog_Impl::Execute()
+{
+ return pDlg->Execute();
+}
+
+//IMPL_ABSTDLG_BASE(AbstractSvxZoomDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSearchProgress_Impl);
+IMPL_ABSTDLG_BASE(AbstractTakeProgress_Impl);
+IMPL_ABSTDLG_BASE(AbstractTitleDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractScriptSelectorDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractGalleryIdDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractURLDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxHlinkDlgMarkWnd_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxSearchSimilarityDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxTransformTabDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxCaptionDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxJSearchOptionsDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractFmInputRecordNoDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxNewDictionaryDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxNameDialog_Impl);
+
+// #i68101#
+IMPL_ABSTDLG_BASE(AbstractSvxObjectNameDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxObjectTitleDescDialog_Impl);
+
+IMPL_ABSTDLG_BASE(AbstractSvxMessDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxMultiPathDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxMultiFileDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxHpLinkDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractFmSearchDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractGraphicFilterDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxAreaTabDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractPasteDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractInsertObjectDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractLinksDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSpellDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSvxPostItDialog_Impl);
+
+//////////////////////////////////////////////////////////////////////////
+// VclAbstractDialog2_Impl
+//////////////////////////////////////////////////////////////////////////
+
+// virtual
+VclAbstractDialog2_Impl::~VclAbstractDialog2_Impl()
+{
+ delete m_pDlg;
+}
+
+// virtual
+void VclAbstractDialog2_Impl::StartExecuteModal( const Link& rEndDialogHdl )
+{
+ m_aEndDlgHdl = rEndDialogHdl;
+ m_pDlg->StartExecuteModal(
+ LINK( this, VclAbstractDialog2_Impl, EndDialogHdl ) );
+}
+
+// virtual
+long VclAbstractDialog2_Impl::GetResult()
+{
+ return m_pDlg->GetResult();
+}
+
+IMPL_LINK( VclAbstractDialog2_Impl, EndDialogHdl, Dialog*, pDlg )
+{
+ if ( pDlg != m_pDlg )
+ {
+ DBG_ERRORFILE( "VclAbstractDialog2_Impl::EndDialogHdl(): wrong dialog" );
+ }
+
+ m_aEndDlgHdl.Call( this );
+ m_aEndDlgHdl = Link();
+
+ return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+void AbstractTabDialog_Impl::SetCurPageId( USHORT nId )
+{
+ pDlg->SetCurPageId( nId );
+}
+
+const SfxItemSet* AbstractTabDialog_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+//add by CHINA001
+const USHORT* AbstractTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+ return pDlg->GetInputRanges( pItem );
+}
+//add by CHINA001
+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();
+}
+
+// AbstractTabDialog_Impl end
+
+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();
+}
+
+//for SvxDistributeDialog begin
+SvxDistributeHorizontal AbstractSvxDistributeDialog_Impl::GetDistributeHor()const
+{
+ return pDlg->GetDistributeHor();
+}
+SvxDistributeVertical AbstractSvxDistributeDialog_Impl::GetDistributeVer()const
+{
+ return pDlg->GetDistributeVer();
+}
+//for SvxDistributeDialog end
+
+// for HangulHanjaConversionDialog begin
+void AbstractHangulHanjaConversionDialog_Impl::EndDialog(long nResult)
+{
+ pDlg->EndDialog(nResult);
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::EnableRubySupport( sal_Bool _bVal )
+{
+ pDlg->EnableRubySupport(_bVal);
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::SetByCharacter( sal_Bool _bByCharacter )
+{
+ pDlg->SetByCharacter(_bByCharacter);
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::SetConversionDirectionState( sal_Bool _bTryBothDirections, HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection )
+{
+ pDlg->SetConversionDirectionState(_bTryBothDirections, _ePrimaryConversionDirection);
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::SetConversionFormat( HangulHanjaConversion::ConversionFormat _eType )
+{
+ pDlg->SetConversionFormat(_eType);
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::SetOptionsChangedHdl( const Link& _rHdl )
+{
+ pDlg->SetOptionsChangedHdl(_rHdl );
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::SetIgnoreHdl( const Link& _rHdl )
+{
+ pDlg->SetIgnoreHdl(_rHdl );
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::SetIgnoreAllHdl( const Link& _rHdl )
+{
+ pDlg->SetIgnoreAllHdl(_rHdl );
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::SetChangeHdl( const Link& _rHdl )
+{
+ pDlg->SetChangeHdl(_rHdl );
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::SetChangeAllHdl( const Link& _rHdl )
+{
+ pDlg->SetChangeAllHdl(_rHdl );
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::SetClickByCharacterHdl( const Link& _rHdl )
+{
+ pDlg->SetClickByCharacterHdl(_rHdl );
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::SetConversionFormatChangedHdl( const Link& _rHdl )
+{
+ pDlg->SetConversionFormatChangedHdl(_rHdl );
+}
+void AbstractHangulHanjaConversionDialog_Impl::SetFindHdl( const Link& _rHdl )
+{
+ pDlg->SetFindHdl(_rHdl );
+}
+
+sal_Bool AbstractHangulHanjaConversionDialog_Impl::GetUseBothDirections( ) const
+{
+ return pDlg->GetUseBothDirections();
+}
+
+HangulHanjaConversion::ConversionDirection AbstractHangulHanjaConversionDialog_Impl::GetDirection( HangulHanjaConversion::ConversionDirection _eDefaultDirection ) const
+{
+ return pDlg->GetDirection( _eDefaultDirection );
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::SetCurrentString(
+ const String& _rNewString,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rSuggestions,
+ bool _bOriginatesFromDocument
+ )
+{
+ pDlg->SetCurrentString(_rNewString,_rSuggestions,_bOriginatesFromDocument);
+}
+String AbstractHangulHanjaConversionDialog_Impl::GetCurrentString( ) const
+{
+ return pDlg->GetCurrentString();
+}
+HangulHanjaConversion::ConversionFormat AbstractHangulHanjaConversionDialog_Impl::GetConversionFormat( ) const
+{
+ return pDlg->GetConversionFormat();
+}
+
+void AbstractHangulHanjaConversionDialog_Impl::FocusSuggestion( )
+{
+ pDlg->FocusSuggestion();
+}
+
+String AbstractHangulHanjaConversionDialog_Impl::GetCurrentSuggestion( ) const
+{
+ return pDlg->GetCurrentSuggestion();
+}
+
+Reference < com::sun::star::embed::XEmbeddedObject > AbstractInsertObjectDialog_Impl::GetObject()
+{
+ return pDlg->GetObject();
+}
+
+BOOL AbstractInsertObjectDialog_Impl::IsCreateNew()
+{
+ return pDlg->IsCreateNew();
+}
+
+::Reference< ::com::sun::star::io::XInputStream > AbstractInsertObjectDialog_Impl::GetIconIfIconified( ::rtl::OUString* pGraphicMediaType )
+{
+ return pDlg->GetIconIfIconified( pGraphicMediaType );
+}
+
+void AbstractPasteDialog_Impl::Insert( SotFormatStringId nFormat, const String & rFormatName )
+{
+ pDlg->Insert( nFormat, rFormatName );
+}
+
+void AbstractPasteDialog_Impl::SetObjName( const SvGlobalName & rClass, const String & rObjName )
+{
+ pDlg->SetObjName( rClass, rObjName );
+}
+
+ULONG AbstractPasteDialog_Impl::GetFormat( const TransferableDataHelper& aHelper,
+ const DataFlavorExVector* pFormats,
+ const TransferableObjectDescriptor* pDesc )
+{
+ return pDlg->GetFormat( aHelper, pFormats, pDesc );
+}
+
+// for HangulHanjaConversionDialog end
+// for FmShowColsDialog begin
+void AbstractFmShowColsDialog_Impl::SetColumns(const ::Reference< ::com::sun::star::container::XIndexContainer>& xCols)
+{
+ pDlg->SetColumns(xCols);
+}
+
+//for FmShowColsDialog end
+
+//for SvxZoomDialog begin
+void AbstractSvxZoomDialog_Impl::SetLimits( USHORT nMin, USHORT nMax )
+{
+ pDlg->SetLimits( nMin, nMax );
+}
+
+void AbstractSvxZoomDialog_Impl::HideButton( USHORT nBtnId )
+{
+ pDlg->HideButton( nBtnId );
+}
+
+const SfxItemSet* AbstractSvxZoomDialog_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+
+//for SvxZoomDialog end
+// svx::SvxSpellDialog
+/*-- 04.05.2004 08:26:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void AbstractSpellDialog_Impl::SetLanguage( sal_uInt16 nLang )
+{
+ pDlg->SetLanguage(nLang);
+}
+/*-- 04.05.2004 08:26:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool AbstractSpellDialog_Impl::Close()
+{
+ return pDlg->Close();
+}
+/*-- 04.05.2004 08:26:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void AbstractSpellDialog_Impl::Invalidate()
+{
+ pDlg->InvalidateDialog();
+}
+/*-- 04.05.2004 08:26:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Window* AbstractSpellDialog_Impl::GetWindow()
+{
+ return pDlg;
+}
+/*-- 04.05.2004 08:26:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxBindings& AbstractSpellDialog_Impl::GetBindings()
+{
+ return pDlg->GetBindings();
+}
+// end svx::SvxSpellDialog
+
+//for SvxSpellCheckDialog begin
+//STRIP001 void AbstractSvxSpellCheckDialog_Impl::SetNewEditWord( const String& _rNew )
+//STRIP001 {
+//STRIP001 return pDlg->SetNewEditWord(_rNew );
+//STRIP001 }
+//STRIP001
+//STRIP001 void AbstractSvxSpellCheckDialog_Impl::SetLanguage( sal_uInt16 nLang )
+//STRIP001 {
+//STRIP001 return pDlg->SetLanguage( nLang );
+//STRIP001 }
+//STRIP001
+//STRIP001 void AbstractSvxSpellCheckDialog_Impl::HideAutoCorrect()
+//STRIP001 {
+//STRIP001 return pDlg->HideAutoCorrect();
+//STRIP001 }
+//STRIP001
+//STRIP001 String AbstractSvxSpellCheckDialog_Impl::GetNewEditWord()
+//STRIP001 {
+//STRIP001 return pDlg->GetNewEditWord();
+//STRIP001 }
+//STRIP001
+//STRIP001 void AbstractSvxSpellCheckDialog_Impl::SetNewEditWord( const String& _rNew )
+//STRIP001 {
+//STRIP001 return pDlg->SetNewEditWord( _rNew );
+//STRIP001 }
+//STRIP001
+//for SvxSpellCheckDialog end
+
+//for SearchProgress begin
+void AbstractSearchProgress_Impl::Update()
+{
+ pDlg->Update();
+}
+
+void AbstractSearchProgress_Impl::Sync()
+{
+ pDlg-> Sync();
+}
+
+void AbstractSearchProgress_Impl::SetFileType( const String& rType )
+{
+ pDlg->SetFileType( rType );
+}
+
+void AbstractSearchProgress_Impl::SetDirectory( const INetURLObject& rURL )
+{
+ pDlg->SetDirectory( rURL );
+}
+PLinkStub AbstractSearchProgress_Impl::GetLinkStubCleanUpHdl()
+{
+ return SearchProgress::LinkStubCleanUpHdl;
+}
+//for SearchProgress end
+
+//for TakeProgress begin
+void AbstractTakeProgress_Impl::Update()
+{
+ pDlg->Update();
+}
+
+void AbstractTakeProgress_Impl::Sync()
+{
+ pDlg-> Sync();
+}
+
+void AbstractTakeProgress_Impl::SetFile( const INetURLObject& rURL )
+{
+ pDlg->SetFile( rURL );
+}
+
+PLinkStub AbstractTakeProgress_Impl::GetLinkStubCleanUpHdl()
+{
+ return TakeProgress::LinkStubCleanUpHdl;
+}
+//for TakeProgress end
+
+//for TitleDialog begin
+String AbstractTitleDialog_Impl::GetTitle() const
+{
+ return pDlg->GetTitle();
+}
+//for TitleDialog end
+
+//for GalleryIdDialog begin
+ULONG AbstractGalleryIdDialog_Impl::GetId() const
+{
+ return pDlg->GetId();
+}
+//for GalleryIdDialog end
+
+//for VclAbstracRefreshableDialog begin
+void VclAbstractRefreshableDialog_Impl::Update()
+{
+ pDlg->Update();
+}
+
+void VclAbstractRefreshableDialog_Impl::Sync()
+{
+ pDlg-> Sync();
+}
+//for VclAbstracRefreshableDialog end
+
+//for URLDlg begin
+String AbstractURLDlg_Impl::GetURL() const
+{
+ return pDlg->GetURL();
+}
+
+String AbstractURLDlg_Impl::GetAltText() const
+{
+ return pDlg->GetAltText();
+}
+
+String AbstractURLDlg_Impl::GetDesc() const
+{
+ return pDlg->GetDesc();
+}
+
+String AbstractURLDlg_Impl::GetTarget() const
+{
+ return pDlg->GetTarget();
+}
+
+String AbstractURLDlg_Impl::GetName() const
+{
+ return pDlg->GetName();
+}
+//for URLDlg end
+
+// AbstractSvxHlinkDlgMarkWnd_Impl begin
+
+void AbstractSvxHlinkDlgMarkWnd_Impl::Hide( USHORT nFlags )
+{
+ ((Window*)pDlg)->Hide( nFlags );
+}
+
+void AbstractSvxHlinkDlgMarkWnd_Impl::SetSizePixel( const Size& rNewSize )
+{
+ pDlg->SetSizePixel( rNewSize );
+}
+
+Size AbstractSvxHlinkDlgMarkWnd_Impl::GetSizePixel() const
+{
+ return pDlg->GetSizePixel();
+}
+
+BOOL AbstractSvxHlinkDlgMarkWnd_Impl::IsVisible( ) const
+{
+ return (( Window* )pDlg)->IsVisible();
+}
+
+void AbstractSvxHlinkDlgMarkWnd_Impl::Invalidate( USHORT nFlags )
+{
+ (( Window* )pDlg)->Invalidate(nFlags);
+}
+
+BOOL AbstractSvxHlinkDlgMarkWnd_Impl::MoveTo( Point aNewPos )const
+{
+ return pDlg->MoveTo(aNewPos);
+}
+
+BOOL AbstractSvxHlinkDlgMarkWnd_Impl::ConnectToDialog( BOOL bDoit )const
+{
+ return pDlg->ConnectToDialog(bDoit);
+}
+
+void AbstractSvxHlinkDlgMarkWnd_Impl::RefreshTree ( String aStrURL )
+{
+ pDlg->RefreshTree(aStrURL);
+}
+
+void AbstractSvxHlinkDlgMarkWnd_Impl::SelectEntry ( String aStrMark )
+{
+ pDlg->SelectEntry(aStrMark);
+}
+
+USHORT AbstractSvxHlinkDlgMarkWnd_Impl::SetError( USHORT nError)
+{
+ return pDlg->SetError(nError);
+}
+
+// AbstractSvxHlinkDlgMarkWnd_Impl end
+
+//for SvxSearchSimilarityDialog begin
+USHORT AbstractSvxSearchSimilarityDialog_Impl::GetOther()
+{
+ return pDlg->GetOther();
+}
+
+USHORT AbstractSvxSearchSimilarityDialog_Impl::GetShorter()
+{
+ return pDlg->GetShorter();
+}
+
+USHORT AbstractSvxSearchSimilarityDialog_Impl::GetLonger()
+{
+ return pDlg-> GetLonger();
+}
+
+BOOL AbstractSvxSearchSimilarityDialog_Impl::IsRelaxed()
+{
+ return pDlg-> IsRelaxed();
+}
+//for SvxSearchSimilarityDialog end
+
+// AbstractSvxTransformTabDialog implementations just forwards everything to the dialog
+void AbstractSvxTransformTabDialog_Impl::SetCurPageId( USHORT nId )
+{
+ pDlg->SetCurPageId( nId );
+}
+const SfxItemSet* AbstractSvxTransformTabDialog_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+//
+const USHORT* AbstractSvxTransformTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+ return pDlg->GetInputRanges( pItem );
+}
+//
+void AbstractSvxTransformTabDialog_Impl::SetInputSet( const SfxItemSet* pInSet )
+{
+ pDlg->SetInputSet( pInSet );
+}
+//From class Window.
+void AbstractSvxTransformTabDialog_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+String AbstractSvxTransformTabDialog_Impl::GetText() const
+{
+ return pDlg->GetText();
+}
+void AbstractSvxTransformTabDialog_Impl::SetValidateFramePosLink( const Link& rLink )
+{
+ pDlg->SetValidateFramePosLink( rLink );
+}
+// AbstractSvxTransformTabDialog end
+
+// AbstractSvxCaptionDialog implementations just forwards everything to the dialog
+void AbstractSvxCaptionDialog_Impl::SetCurPageId( USHORT nId )
+{
+ pDlg->SetCurPageId( nId );
+}
+const SfxItemSet* AbstractSvxCaptionDialog_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+//
+const USHORT* AbstractSvxCaptionDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+ return pDlg->GetInputRanges( pItem );
+}
+//
+void AbstractSvxCaptionDialog_Impl::SetInputSet( const SfxItemSet* pInSet )
+{
+ pDlg->SetInputSet( pInSet );
+}
+//From class Window.
+void AbstractSvxCaptionDialog_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+String AbstractSvxCaptionDialog_Impl::GetText() const
+{
+ return pDlg->GetText();
+}
+void AbstractSvxCaptionDialog_Impl::SetValidateFramePosLink( const Link& rLink )
+{
+ pDlg->SetValidateFramePosLink( rLink );
+}
+// SvxAbstractCaptionDialog end
+
+//for SvxJSearchOptionsDialog begin
+INT32 AbstractSvxJSearchOptionsDialog_Impl::GetTransliterationFlags() const
+{
+ return pDlg->GetTransliterationFlags();
+}
+//for SvxJSearchOptionsDialog end
+
+//for FmInputRecordNoDialog begin
+void AbstractFmInputRecordNoDialog_Impl::SetValue(long nNew)
+{
+ pDlg->SetValue(nNew);
+}
+
+long AbstractFmInputRecordNoDialog_Impl::GetValue() const
+{
+ return pDlg->GetValue();
+}
+//for FmInputRecordNoDialog end
+
+//for SvxNewDictionaryDialog begin
+::Reference<
+ ::com::sun::star::linguistic2::XDictionary > AbstractSvxNewDictionaryDialog_Impl::GetNewDictionary()
+{
+ return pDlg->GetNewDictionary();
+}
+//for SvxNewDictionaryDialog end
+
+//for SvxNameDialog begin
+void AbstractSvxNameDialog_Impl::GetName( String& rName )
+{
+ pDlg->GetName( rName );
+}
+void AbstractSvxNameDialog_Impl::SetCheckNameHdl( const Link& rLink, bool bCheckImmediately )
+{
+ aCheckNameHdl = rLink;
+ if( rLink.IsSet() )
+ pDlg->SetCheckNameHdl( LINK(this, AbstractSvxNameDialog_Impl, CheckNameHdl), bCheckImmediately );
+ else
+ pDlg->SetCheckNameHdl( Link(), bCheckImmediately );
+}
+void AbstractSvxNameDialog_Impl::SetEditHelpId(ULONG nHelpId)
+{
+ pDlg->SetEditHelpId( nHelpId );
+}
+void AbstractSvxNameDialog_Impl::SetHelpId( ULONG nHelpId )
+{
+ pDlg->SetHelpId( nHelpId );
+}
+void AbstractSvxNameDialog_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+IMPL_LINK( AbstractSvxNameDialog_Impl, CheckNameHdl, Window*, EMPTYARG )
+{
+ if( aCheckNameHdl.IsSet() )
+ return aCheckNameHdl.Call(this);
+ return 0;
+}
+//for SvxNameDialog end
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+// #i68101#
+
+void AbstractSvxObjectNameDialog_Impl::GetName(String& rName)
+{
+ pDlg->GetName(rName);
+}
+
+void AbstractSvxObjectNameDialog_Impl::SetCheckNameHdl(const Link& rLink, bool bCheckImmediately)
+{
+ aCheckNameHdl = rLink;
+
+ if(rLink.IsSet())
+ {
+ pDlg->SetCheckNameHdl(LINK(this, AbstractSvxObjectNameDialog_Impl, CheckNameHdl), bCheckImmediately);
+ }
+ else
+ {
+ pDlg->SetCheckNameHdl(Link(), bCheckImmediately);
+ }
+}
+
+IMPL_LINK(AbstractSvxObjectNameDialog_Impl, CheckNameHdl, Window*, EMPTYARG)
+{
+ if(aCheckNameHdl.IsSet())
+ {
+ return aCheckNameHdl.Call(this);
+ }
+
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+// #i68101#
+
+void AbstractSvxObjectTitleDescDialog_Impl::GetTitle(String& rTitle)
+{
+ pDlg->GetTitle(rTitle);
+}
+
+void AbstractSvxObjectTitleDescDialog_Impl::GetDescription(String& rDescription)
+{
+ pDlg->GetDescription(rDescription);
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+//for SvxMessDialog begin
+void AbstractSvxMessDialog_Impl::SetButtonText( USHORT nBtnId, const String& rNewTxt )
+{
+ pDlg->SetButtonText( nBtnId, rNewTxt );
+}
+//for SvxMessDialog end
+
+//for SvxMultiPathDialog begin
+String AbstractSvxMultiPathDialog_Impl::GetPath() const
+{
+ return pDlg->GetPath();
+}
+
+void AbstractSvxMultiPathDialog_Impl::SetPath( const String& rPath )
+{
+ pDlg->SetPath( rPath );
+}
+
+void AbstractSvxMultiPathDialog_Impl::EnableRadioButtonMode()
+{
+ pDlg->EnableRadioButtonMode();
+}
+
+void AbstractSvxMultiPathDialog_Impl::SetTitle( const String& rNewTitle )
+{
+ pDlg->SetText( rNewTitle );
+}
+//for SvxMultiPathDialog end
+
+//for SvxMultiFileDialog begin
+String AbstractSvxMultiFileDialog_Impl::GetPath() const
+{
+ return pDlg->GetPath();
+}
+
+void AbstractSvxMultiFileDialog_Impl::SetPath( const String& rPath )
+{
+ pDlg->SetPath( rPath );
+}
+
+String AbstractSvxMultiFileDialog_Impl::GetFiles() const
+{
+ return pDlg->GetFiles();
+}
+
+void AbstractSvxMultiFileDialog_Impl::SetFiles( const String& rPath )
+{
+ pDlg->SetFiles( rPath );
+}
+
+void AbstractSvxMultiFileDialog_Impl::SetClassPathMode()
+{
+ pDlg->SetClassPathMode();
+}
+
+void AbstractSvxMultiFileDialog_Impl::EnableRadioButtonMode()
+{
+ pDlg->EnableRadioButtonMode();
+}
+
+void AbstractSvxMultiFileDialog_Impl::SetTitle( const String& rNewTitle )
+{
+ pDlg->SetText( rNewTitle );
+}
+
+void AbstractSvxMultiFileDialog_Impl::SetHelpId( ULONG nHelpId )
+{
+ pDlg->SetHelpId( nHelpId );
+}
+//for SvxMultiFileDialog end
+
+//for SvxHpLinkDlg begin
+Window * AbstractSvxHpLinkDlg_Impl::GetWindow()
+{
+ return (Window *)pDlg;
+}
+
+sal_Bool AbstractSvxHpLinkDlg_Impl::QueryClose()
+{
+ return pDlg->QueryClose();
+}
+//for SvxHpLinkDlg end
+
+
+//for FmSearchDialog begin
+void AbstractFmSearchDialog_Impl::SetFoundHandler(const Link& lnk)
+{
+ pDlg->SetFoundHandler(lnk);
+}
+void AbstractFmSearchDialog_Impl::SetCanceledNotFoundHdl(const Link& lnk)
+{
+ pDlg->SetCanceledNotFoundHdl(lnk);
+}
+void AbstractFmSearchDialog_Impl::SetActiveField(const String& strField)
+{
+ pDlg->SetActiveField(strField);
+}
+//for FmSearchDialog end
+
+//for GraphicFilterDialog begin
+Graphic AbstractGraphicFilterDialog_Impl::GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY )
+{
+ return pDlg->GetFilteredGraphic( rGraphic, fScaleX, fScaleY );
+}
+//for GraphicFilterDialog end
+
+// AbstractSvxAreaTabDialog implementations just forwards everything to the dialog
+void AbstractSvxAreaTabDialog_Impl::SetCurPageId( USHORT nId )
+{
+ pDlg->SetCurPageId( nId );
+}
+
+const SfxItemSet* AbstractSvxAreaTabDialog_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+//add by CHINA001
+const USHORT* AbstractSvxAreaTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+ return pDlg->GetInputRanges( pItem );
+}
+//add by CHINA001
+void AbstractSvxAreaTabDialog_Impl::SetInputSet( const SfxItemSet* pInSet )
+{
+ pDlg->SetInputSet( pInSet );
+}
+//From class Window.
+void AbstractSvxAreaTabDialog_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+String AbstractSvxAreaTabDialog_Impl::GetText() const
+{
+ return pDlg->GetText();
+}
+
+void AbstractSvxAreaTabDialog_Impl::DontDeleteColorTable()
+{
+ return pDlg->DontDeleteColorTable();
+}
+// AbstractSvxAreaTabDialog_Impl end
+
+// add SvxPostItDialog begin
+void AbstractSvxPostItDialog_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+const SfxItemSet* AbstractSvxPostItDialog_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+void AbstractSvxPostItDialog_Impl::EnableTravel(BOOL bNext, BOOL bPrev)
+{
+ pDlg->EnableTravel( bNext, bPrev );
+}
+String AbstractSvxPostItDialog_Impl::GetNote()
+{
+ return pDlg->GetNote();
+}
+void AbstractSvxPostItDialog_Impl::SetNote(const String& rTxt)
+{
+ pDlg->SetNote( rTxt );
+}
+void AbstractSvxPostItDialog_Impl::ShowLastAuthor(const String& rAuthor, const String& rDate)
+{
+ pDlg->ShowLastAuthor( rAuthor, rDate );
+}
+void AbstractSvxPostItDialog_Impl::DontChangeAuthor()
+{
+ pDlg->DontChangeAuthor();
+}
+void AbstractSvxPostItDialog_Impl::HideAuthor()
+{
+ pDlg->HideAuthor();
+}
+void AbstractSvxPostItDialog_Impl::SetReadonlyPostIt(BOOL bDisable)
+{
+ pDlg->SetReadonlyPostIt( bDisable );
+}
+BOOL AbstractSvxPostItDialog_Impl::IsOkEnabled() const
+{
+ return pDlg->IsOkEnabled();
+}
+void AbstractSvxPostItDialog_Impl::SetNextHdl( const Link& rLink )
+{
+ aNextHdl = rLink;
+ if( rLink.IsSet() )
+ pDlg->SetNextHdl( LINK(this, AbstractSvxPostItDialog_Impl, NextHdl ) );
+ else
+ pDlg->SetNextHdl( Link() );
+}
+void AbstractSvxPostItDialog_Impl::SetPrevHdl( const Link& rLink )
+{
+ aPrevHdl = rLink;
+ if( rLink.IsSet() )
+ pDlg->SetPrevHdl( LINK(this, AbstractSvxPostItDialog_Impl, PrevHdl ) );
+ else
+ pDlg->SetPrevHdl( Link() );
+}
+IMPL_LINK( AbstractSvxPostItDialog_Impl, NextHdl, Window*, EMPTYARG )
+{
+ if( aNextHdl.IsSet() )
+ aNextHdl.Call(this);
+ return 0;
+}
+IMPL_LINK( AbstractSvxPostItDialog_Impl, PrevHdl, Window*, EMPTYARG )
+{
+ if( aPrevHdl.IsSet() )
+ aPrevHdl.Call(this);
+ return 0;
+}
+Window * AbstractSvxPostItDialog_Impl::GetWindow()
+{
+ return (Window *)pDlg;
+}
+
+// SvxPostItDialog end
+
+//--------------------------------------------------------------
+// Create dialogs with simplest interface
+VclAbstractDialog* AbstractDialogFactory_Impl::CreateVclDialog( Window* pParent, sal_uInt32 nResId )
+{
+ Dialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case SID_OPTIONS_TREEDIALOG :
+ case SID_OPTIONS_DATABASES :
+ case SID_LANGUAGE_OPTIONS :
+ {
+ bool bActivateLastSelection = false;
+ if (nResId == SID_OPTIONS_TREEDIALOG)
+ bActivateLastSelection = true;
+ Reference< frame::XFrame > xFrame;
+ OfaTreeOptionsDialog* pOptDlg = new OfaTreeOptionsDialog( pParent, xFrame, bActivateLastSelection );
+ if (nResId == SID_OPTIONS_DATABASES)
+ {
+ pOptDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
+ }
+ else if (nResId == SID_LANGUAGE_OPTIONS)
+ {
+ //open the tab page "tools/options/languages"
+ pOptDlg->ActivatePage(OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE);
+ }
+ pDlg = pOptDlg;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+
+// dialogs that use SfxBindings
+VclAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( Window* /*pParent*/, const SfxBindings&, sal_uInt32 )
+{
+ return 0;
+}
+
+VclAbstractDialog* AbstractDialogFactory_Impl::CreateFrameDialog(
+ Window* pParent, const Reference< frame::XFrame >& rxFrame,
+ sal_uInt32 nResId, const String& rParameter )
+{
+ Dialog* pDlg = NULL;
+ if ( SID_OPTIONS_TREEDIALOG == nResId || SID_OPTIONS_DATABASES == nResId )
+ {
+ // only activate last page if we dont want to activate a special page
+ bool bActivateLastSelection = ( nResId != SID_OPTIONS_DATABASES && rParameter.Len() == 0 );
+ OfaTreeOptionsDialog* pOptDlg = new OfaTreeOptionsDialog( pParent, rxFrame, bActivateLastSelection );
+ if ( nResId == SID_OPTIONS_DATABASES )
+ pOptDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
+ else if ( rParameter.Len() > 0 )
+ pOptDlg->ActivatePage( rParameter );
+ pDlg = pOptDlg;
+ }
+
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ else
+ return NULL;
+}
+
+// TabDialog outside the drawing layer
+SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabDialog( sal_uInt32 nResId,
+ Window* pParent,
+ const SfxItemSet* pAttrSet,
+ SfxViewFrame* ,
+ bool /*bEditFmt*/,
+ const String * )
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_OFA_AUTOCORR_DLG :
+ pDlg = new OfaAutoCorrDlg( pParent, pAttrSet );
+ break;
+ case RID_SVXDLG_CUSTOMIZE :
+ pDlg = new SvxConfigDialog( pParent, pAttrSet );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+
+SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabDialog( sal_uInt32 nResId,
+ Window* pParent,
+ const SfxItemSet* pAttrSet,
+ const Reference< frame::XFrame >& xViewFrame,
+ bool /*bEditFmt*/,
+ const String * )
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_OFA_AUTOCORR_DLG :
+ pDlg = new OfaAutoCorrDlg( pParent, pAttrSet );
+ break;
+ case RID_SVXDLG_CUSTOMIZE :
+ {
+ SvxConfigDialog* pDlg1 = new SvxConfigDialog( pParent, pAttrSet );
+ pDlg1->SetFrame(xViewFrame);
+ pDlg = (SfxTabDialog*)pDlg1;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+
+// TabDialog that use functionality of the drawing layer
+SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTextTabDialog( Window* pParent,
+ const SfxItemSet* pAttrSet,
+ sal_uInt32 nResId,
+ SdrView* pView,
+ SdrModel* )
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_TEXT :
+ pDlg = new SvxTextTabDialog( pParent, pAttrSet, pView );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+
+//TabDialog that use functionality of the drawing layer and add AnchorTypes -- for SvxCaptionTabDialog CHINA001
+AbstractSvxCaptionDialog* AbstractDialogFactory_Impl::CreateCaptionDialog( Window* pParent,
+ const SdrView* pView,
+ sal_uInt32 nResId,
+ USHORT nAnchorTypes )
+{
+ SvxCaptionTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_CAPTION :
+ pDlg = new SvxCaptionTabDialog( pParent, pView, nAnchorTypes );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxCaptionDialog_Impl( pDlg );
+ return 0;
+}
+
+AbstractSvxDistributeDialog* AbstractDialogFactory_Impl::CreateSvxDistributeDialog(Window* pParent,
+ const SfxItemSet& rAttr,
+ sal_uInt32 nResId,
+ SvxDistributeHorizontal eHor ,
+ SvxDistributeVertical eVer)
+{
+ SvxDistributeDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXPAGE_DISTRIBUTE :
+ pDlg = new SvxDistributeDialog( pParent, rAttr, eHor, eVer);
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxDistributeDialog_Impl( pDlg );
+ return 0;
+}
+
+AbstractHangulHanjaConversionDialog* AbstractDialogFactory_Impl::CreateHangulHanjaConversionDialog(Window* pParent,
+ HangulHanjaConversion::ConversionDirection _ePrimaryDirection,
+ sal_uInt32 nResId)
+{
+ HangulHanjaConversionDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVX_MDLG_HANGULHANJA :
+ pDlg = new HangulHanjaConversionDialog( pParent, _ePrimaryDirection);
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractHangulHanjaConversionDialog_Impl( pDlg );
+ return 0;
+}
+
+AbstractFmShowColsDialog * AbstractDialogFactory_Impl::CreateFmShowColsDialog( Window* pParent )
+{
+ FmShowColsDialog* pDlg = new FmShowColsDialog( pParent);
+ return new AbstractFmShowColsDialog_Impl( pDlg );
+}
+AbstractSvxZoomDialog * AbstractDialogFactory_Impl::CreateSvxZoomDialog( Window* pParent, //add for SvxZoomDialog
+ const SfxItemSet& rCoreSet,
+ sal_uInt32 nResId)
+{
+ SvxZoomDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_ZOOM :
+ pDlg = new SvxZoomDialog( pParent, rCoreSet);
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxZoomDialog_Impl( pDlg );
+ return 0;
+}
+
+/*-- 04.05.2004 08:18:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+AbstractSpellDialog * AbstractDialogFactory_Impl::CreateSvxSpellDialog(
+ Window* pParent,
+ SfxBindings* pBindings,
+ svx::SpellDialogChildWindow* pSpellChildWindow )
+{
+ svx::SpellDialog* pDlg = new svx::SpellDialog(pSpellChildWindow, pParent, pBindings);
+ return new AbstractSpellDialog_Impl(pDlg);
+}
+
+//CHINA001 GalleryDialog start
+VclAbstractRefreshableDialog * AbstractDialogFactory_Impl::CreateActualizeProgressDialog( Window* pParent, GalleryTheme* pThm )
+{
+ Dialog* pDlg = new ActualizeProgress( pParent, pThm);
+ return new VclAbstractRefreshableDialog_Impl( pDlg );
+}
+
+AbstractSearchProgress * AbstractDialogFactory_Impl::CreateSearchProgressDialog( Window* pParent, //add for SearchProgress
+ const INetURLObject& rStartURL )
+{
+ SearchProgress* pDlg = new SearchProgress( pParent, rStartURL);
+ return new AbstractSearchProgress_Impl( pDlg );
+}
+
+AbstractTakeProgress * AbstractDialogFactory_Impl::CreateTakeProgressDialog( Window* pParent )
+{
+ TakeProgress* pDlg = new TakeProgress( pParent );
+ return new AbstractTakeProgress_Impl( pDlg );
+}
+
+VclAbstractDialog*
+AbstractDialogFactory_Impl::CreateScriptErrorDialog(
+ Window* pParent, ::com::sun::star::uno::Any aException )
+{
+ return new SvxScriptErrorDialog( pParent, aException );
+}
+
+AbstractScriptSelectorDialog*
+AbstractDialogFactory_Impl::CreateScriptSelectorDialog(
+ Window* pParent, BOOL bShowSlots, const Reference< frame::XFrame >& _rxFrame )
+{
+ SvxScriptSelectorDialog* pDlg = NULL;
+
+ pDlg = new SvxScriptSelectorDialog( pParent, bShowSlots, _rxFrame );
+
+ if (pDlg)
+ {
+ return new AbstractScriptSelectorDialog_Impl( pDlg );
+ }
+ return 0;
+}
+
+String AbstractScriptSelectorDialog_Impl::GetScriptURL() const
+{
+ if (pDlg)
+ return pDlg->GetScriptURL();
+ return String();
+}
+
+void AbstractScriptSelectorDialog_Impl::SetRunLabel()
+{
+ if (pDlg)
+ pDlg->SetRunLabel();
+ return;
+}
+
+VclAbstractDialog * AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog( Window* pParent, //add for SvxScriptOrgDialog
+ const String& rLanguage)
+{
+ Dialog* pDlg=NULL;
+
+ pDlg = new SvxScriptOrgDialog( pParent, rLanguage);
+
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+
+AbstractTitleDialog * AbstractDialogFactory_Impl::CreateTitleDialog( Window* pParent, //add for TitleDialog
+ const String& rOldText)
+{
+ TitleDialog* pDlg = new TitleDialog( pParent, rOldText);
+ return new AbstractTitleDialog_Impl( pDlg );
+}
+
+AbstractGalleryIdDialog * AbstractDialogFactory_Impl::CreateGalleryIdDialog( Window* pParent, //add for SvxZoomDialog
+ GalleryTheme* pThm )
+{
+ GalleryIdDialog* pDlg = new GalleryIdDialog( pParent, pThm);
+ return new AbstractGalleryIdDialog_Impl( pDlg );
+}
+
+VclAbstractDialog2 * AbstractDialogFactory_Impl::CreateGalleryThemePropertiesDialog( Window* pParent, //add for GalleryThemeProperties
+ ExchangeData* pData,
+ SfxItemSet* pItemSet)
+{
+ Dialog* pDlg = new GalleryThemeProperties( pParent, pData, pItemSet);
+ return new VclAbstractDialog2_Impl( pDlg );
+}
+
+AbstractURLDlg * AbstractDialogFactory_Impl::CreateURLDialog( Window* pParent, //add for URLDlg
+ const String& rURL, const String& rAltText, const String& rDescription,
+ const String& rTarget, const String& rName,
+ TargetList& rTargetList )
+{
+ URLDlg* pDlg = new URLDlg( pParent, rURL, rAltText, rDescription, rTarget, rName, rTargetList);
+ return new AbstractURLDlg_Impl( pDlg );
+}
+//CHINA001 URLDlg end
+
+//CHINA001 SvxHlinkDlgMarkWnd begin
+AbstractSvxHlinkDlgMarkWnd* AbstractDialogFactory_Impl::CreateSvxHlinkDlgMarkWndDialog( SvxHyperlinkTabPageBase* pParent, sal_uInt32 nResId )
+{
+ SvxHlinkDlgMarkWnd* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXFLOAT_HYPERLINK_MARKWND :
+ pDlg = new SvxHlinkDlgMarkWnd( pParent );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxHlinkDlgMarkWnd_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxHlinkDlgMarkWnd end
+
+SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( sal_uInt32 nResId,
+ Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& ,
+ const SfxItemSet* pAttrSet )
+{
+ SfxModalDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_CHARMAP :
+ pDlg = new SvxCharacterMap( pParent, TRUE, pAttrSet );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSfxDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxCharacterMap end
+
+//CHINA001 SvxSearchFormatDialog begin
+SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabItemDialog( Window* pParent,
+ const SfxItemSet& rSet,
+ sal_uInt32 nResId)
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_SEARCHFORMAT :
+ pDlg = new SvxSearchFormatDialog( pParent, rSet );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxSearchFormatDialog end
+
+//CHINA001 SvxSearchAttributeDialog begin
+VclAbstractDialog* AbstractDialogFactory_Impl::CreateSvxSearchAttributeDialog( Window* pParent,
+ SearchAttrItemList& rLst,
+ const USHORT* pWhRanges,
+ sal_uInt32 nResId ) //add for SvxSearchAttributeDialog
+{
+ Dialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_SEARCHATTR :
+ pDlg = new SvxSearchAttributeDialog( pParent, rLst, pWhRanges);
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxSearchAttributeDialog end
+
+//CHINA001 SvxSearchSimilarityDialog begin
+AbstractSvxSearchSimilarityDialog * AbstractDialogFactory_Impl::CreateSvxSearchSimilarityDialog( Window* pParent,
+ BOOL bRelax,
+ USHORT nOther,
+ USHORT nShorter,
+ USHORT nLonger)
+{
+ SvxSearchSimilarityDialog* pDlg = new SvxSearchSimilarityDialog( pParent, bRelax, nOther, nShorter, nLonger );
+ if ( pDlg )
+ return new AbstractSvxSearchSimilarityDialog_Impl( pDlg );
+ return NULL;
+}
+//CHINA001 SvxSearchSimilarityDialog end
+
+//CHINA001 SvxBorderBackgroundDlg begin
+SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxBorderBackgroundDlg( Window* pParent,
+ const SfxItemSet& rCoreSet,
+ sal_uInt32 nResId,
+ BOOL bEnableSelector)
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_BBDLG :
+ pDlg = new SvxBorderBackgroundDlg( pParent, rCoreSet, bEnableSelector);
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxBorderBackgroundDlg end
+
+//CHINA001 SvxTransformTabDialog begin
+AbstractSvxTransformTabDialog* AbstractDialogFactory_Impl::CreateSvxTransformTabDialog( Window* pParent,
+ const SfxItemSet* pAttr,
+ const SdrView* pView,
+ sal_uInt32 nResId,
+ USHORT nAnchorTypes )
+{
+ SvxTransformTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_TRANSFORM :
+ pDlg = new SvxTransformTabDialog( pParent, pAttr,pView, nAnchorTypes);
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxTransformTabDialog_Impl( pDlg );
+ return 0;
+}
+
+//CHINA001 SvxTransformTabDialog end
+
+//CHINA001 SchTransformTabDialog begin
+SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSchTransformTabDialog( Window* pParent,
+ const SfxItemSet* pAttr,
+ const SdrView* pSdrView,
+ sal_uInt32 nResId,
+ bool bSizeTabPage
+ )
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SCH_TransformTabDLG_SVXPAGE_ANGLE :
+ {
+ pDlg = new SvxTransformTabDialog( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT : SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE);
+ pDlg->RemoveTabPage( RID_SVXPAGE_ANGLE );
+ pDlg->RemoveTabPage( RID_SVXPAGE_SLANT );
+ }
+ break;
+ case RID_SCH_TransformTabDLG_SVXPAGE_SLANT:
+ {
+ pDlg = new SvxTransformTabDialog( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT : SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE);
+ pDlg->RemoveTabPage( RID_SVXPAGE_SLANT );
+ }
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SchTransformTabDialog end
+
+//CHINA001 SvxJSearchOptionsDialog begin
+AbstractSvxJSearchOptionsDialog * AbstractDialogFactory_Impl::CreateSvxJSearchOptionsDialog( Window* pParent,
+ const SfxItemSet& rOptionsSet, USHORT nUniqueId,
+ INT32 nInitialFlags,
+ sal_uInt32 nResId)
+{
+ SvxJSearchOptionsDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXPAGE_JSEARCH_OPTIONS :
+ pDlg = new SvxJSearchOptionsDialog( pParent, rOptionsSet, nUniqueId, nInitialFlags );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxJSearchOptionsDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxJSearchOptionsDialog end
+
+//CHINA001 FmInputRecordNoDialog begin
+AbstractFmInputRecordNoDialog * AbstractDialogFactory_Impl::CreateFmInputRecordNoDialog( Window* pParent )
+{
+ FmInputRecordNoDialog* pDlg = new FmInputRecordNoDialog( pParent );
+ return new AbstractFmInputRecordNoDialog_Impl( pDlg );
+}
+//CHINA001 FmInputRecordNoDialog end
+
+//CHINA001 SvxNewDictionaryDialog begin
+AbstractSvxNewDictionaryDialog * AbstractDialogFactory_Impl::CreateSvxNewDictionaryDialog( Window* pParent,
+ ::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl,
+ sal_uInt32 nResId )
+{
+ SvxNewDictionaryDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SFXDLG_NEWDICT :
+ pDlg = new SvxNewDictionaryDialog( pParent, xSpl );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxNewDictionaryDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxNewDictionaryDialog end
+
+//CHINA001 SvxEditDictionaryDialog begin
+VclAbstractDialog* AbstractDialogFactory_Impl::CreateSvxEditDictionaryDialog( Window* pParent,
+ const String& rName,
+ ::Reference< ::com::sun::star::linguistic2::XSpellChecker1> &xSpl,
+ sal_uInt32 nResId )
+{
+ Dialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SFXDLG_EDITDICT :
+ pDlg = new SvxEditDictionaryDialog( pParent, rName, xSpl );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxEditDictionaryDialog end
+
+//CHINA001 SvxNameDialog begin
+AbstractSvxNameDialog * AbstractDialogFactory_Impl::CreateSvxNameDialog( Window* pParent,
+ const String& rName, const String& rDesc,
+ sal_uInt32 nResId )
+{
+ SvxNameDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_NAME :
+ pDlg = new SvxNameDialog( pParent, rName, rDesc );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxNameDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxNameDialog end
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+// #i68101#
+
+AbstractSvxObjectNameDialog* AbstractDialogFactory_Impl::CreateSvxObjectNameDialog(Window* pParent, const String& rName, sal_uInt32 nResId)
+{
+ return ((RID_SVXDLG_OBJECT_NAME == nResId)
+ ? new AbstractSvxObjectNameDialog_Impl(new SvxObjectNameDialog(pParent, rName))
+ : NULL);
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+// #i68101#
+
+AbstractSvxObjectTitleDescDialog* AbstractDialogFactory_Impl::CreateSvxObjectTitleDescDialog(Window* pParent, const String& rTitle, const String& rDescription, sal_uInt32 nResId)
+{
+ return ((RID_SVXDLG_OBJECT_TITLE_DESC == nResId)
+ ? new AbstractSvxObjectTitleDescDialog_Impl(new SvxObjectTitleDescDialog(pParent, rTitle, rDescription))
+ : NULL);
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+//CHINA001 SvxMessDialog begin
+AbstractSvxMessDialog * AbstractDialogFactory_Impl::CreateSvxMessDialog( Window* pParent, sal_uInt32 nResId,
+ const String& rText, const String& rDesc, Image* pImg )
+{
+ SvxMessDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_MESSBOX :
+ pDlg = new SvxMessDialog( pParent, rText, rDesc, pImg );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxMessDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxMessDialog end
+
+//CHINA001 SvxMultiPathDialog begin
+AbstractSvxMultiPathDialog * AbstractDialogFactory_Impl::CreateSvxMultiPathDialog( Window* pParent, sal_uInt32 nResId,
+ BOOL bEmptyAllowed )
+{
+ SvxMultiPathDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_MULTIPATH :
+ pDlg = new SvxMultiPathDialog( pParent, bEmptyAllowed );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxMultiPathDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxMultiPathDialog end
+
+//CHINA001 SvxMultiFileDialog begin
+AbstractSvxMultiFileDialog * AbstractDialogFactory_Impl::CreateSvxMultiFileDialog( Window* pParent, sal_uInt32 nResId,
+ BOOL bEmptyAllowed )
+{
+ SvxMultiFileDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_MULTIPATH :
+ pDlg = new SvxMultiFileDialog( pParent, bEmptyAllowed );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxMultiFileDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxMultiFileDialog end
+
+//CHINA001 SvxHpLinkDlg begin
+AbstractSvxHpLinkDlg * AbstractDialogFactory_Impl::CreateSvxHpLinkDlg (Window* pParent, //add for SvxMultiFileDialog
+ SfxBindings* pBindings,
+ sal_uInt32 nResId)
+{
+ SvxHpLinkDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case SID_HYPERLINK_DIALOG :
+ pDlg = new SvxHpLinkDlg( pParent, pBindings );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxHpLinkDlg_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxHpLinkDlg end
+
+//CHINA001 FmSearchDialog begin
+AbstractFmSearchDialog* AbstractDialogFactory_Impl::CreateFmSearchDialog(Window* pParent, //add for FmSearchDialog
+ const String& strInitialText,
+ const ::std::vector< String >& _rContexts,
+ sal_Int16 nInitialContext,
+ const Link& lnkContextSupplier)
+{
+ FmSearchDialog* pDlg = new FmSearchDialog( pParent, strInitialText, _rContexts, nInitialContext, lnkContextSupplier );
+ if ( pDlg )
+ return new AbstractFmSearchDialog_Impl( pDlg );
+ return 0;
+}
+
+//CHINA001 FmSearchDialog end
+
+//CHINA001 GraphicFilterEmboss begin
+AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterEmboss (Window* pParent, //add for GraphicFilterEmboss
+ const Graphic& rGraphic,
+ RECT_POINT eLightSource,
+ sal_uInt32 nResId)
+{
+ GraphicFilterDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVX_GRFFILTER_DLG_EMBOSS :
+ pDlg = new GraphicFilterEmboss( pParent, rGraphic, eLightSource );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractGraphicFilterDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 GraphicFilterEmboss end
+
+//CHINA001 GraphicFilterPoster & GraphicFilterSepia begin
+AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterPosterSepia (Window* pParent, //add for GraphicFilterPoster & GraphicFilterSepia
+ const Graphic& rGraphic,
+ USHORT nCount,
+ sal_uInt32 nResId)
+{
+ GraphicFilterDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVX_GRFFILTER_DLG_POSTER :
+ pDlg = new GraphicFilterPoster( pParent, rGraphic, nCount );
+ break;
+ case RID_SVX_GRFFILTER_DLG_SEPIA :
+ pDlg = new GraphicFilterSepia( pParent, rGraphic, nCount );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractGraphicFilterDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 GraphicFilterPoster & GraphicFilterSepia end
+
+//CHINA001 GraphicFilterSolarize begin
+AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterSolarize (Window* pParent, //add for GraphicFilterSolarize
+ const Graphic& rGraphic,
+ BYTE nGreyThreshold, BOOL bInvert,
+ sal_uInt32 nResId)
+{
+ GraphicFilterDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVX_GRFFILTER_DLG_SOLARIZE :
+ pDlg = new GraphicFilterSolarize( pParent, rGraphic, nGreyThreshold, bInvert );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractGraphicFilterDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 GraphicFilterSolarize end
+
+//CHINA001 GraphicFilterMosaic begin
+AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterMosaic (Window* pParent, //add for GraphicFilterMosaic
+ const Graphic& rGraphic,
+ USHORT nTileWidth, USHORT nTileHeight, BOOL bEnhanceEdges,
+ sal_uInt32 nResId)
+{
+ GraphicFilterDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVX_GRFFILTER_DLG_MOSAIC :
+ pDlg = new GraphicFilterMosaic( pParent, rGraphic, nTileWidth, nTileHeight, bEnhanceEdges );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractGraphicFilterDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 GraphicFilterMosaic end
+//CHINA001 SvxAreaTabDialog begin
+AbstractSvxAreaTabDialog* AbstractDialogFactory_Impl::CreateSvxAreaTabDialog( Window* pParent,
+ const SfxItemSet* pAttr,
+ SdrModel* pModel,
+ sal_uInt32 nResId,
+ const SdrView* pSdrView )
+{
+ SvxAreaTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_AREA :
+ pDlg = new SvxAreaTabDialog( pParent, pAttr, pModel,pSdrView );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxAreaTabDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxAreaTabDialog end
+//CHINA001 SvxLineTabDialog begin
+SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxLineTabDialog( Window* pParent, const SfxItemSet* pAttr, //add forSvxLineTabDialog
+ SdrModel* pModel,
+ sal_uInt32 nResId,
+ const SdrObject* pObj ,
+ BOOL bHasObj)
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_LINE :
+ pDlg = new SvxLineTabDialog( pParent, pAttr, pModel,pObj,bHasObj );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxLineTabDialog end
+
+SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( Window* pParent,
+ const SfxItemSet& rAttr,
+ const Reference< XFrame >& _rxDocumentFrame,
+ sal_uInt32 nResId
+ )
+{
+ SfxModalDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case SID_EVENTCONFIG :
+ pDlg = new SfxMacroAssignDlg( pParent, _rxDocumentFrame, rAttr );
+ break;
+ case RID_SVXPAGE_MACROASSIGN :
+ pDlg = new SvxShortcutAssignDlg( pParent, _rxDocumentFrame, rAttr );
+ break;
+ case RID_SVXDLG_CHARMAP :
+ pDlg = new SvxCharacterMap( pParent, TRUE, &rAttr );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSfxDialog_Impl( pDlg );
+ return 0;
+}
+
+//CHINA001 SvxMeasureDialog & SvxConnectionDialog begin
+SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( Window* pParent,
+ const SfxItemSet& rAttr,
+ const SdrView* pView,
+ sal_uInt32 nResId
+ )
+{
+ SfxSingleTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXPAGE_MEASURE :
+ pDlg = new SvxMeasureDialog( pParent, rAttr, pView );
+ break;
+ case RID_SVXPAGE_CONNECTION :
+ pDlg = new SvxConnectionDialog( pParent, rAttr, pView );
+ break;
+ case RID_SFXPAGE_DBREGISTER :
+ pDlg = new DatabaseRegistrationDialog( pParent, rAttr );
+ break;
+ case RID_SVXPAGE_IMPROVEMENT :
+ {
+ String help_url;
+ SFX_ITEMSET_ARG( &rAttr, pItem, SfxStringItem, SID_CURRENT_URL, sal_False );
+ if ( pItem )
+ help_url = pItem->GetValue();
+ pDlg = new SvxImprovementDialog( pParent, help_url);
+ }
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSfxDialog_Impl( pDlg );
+ return 0;
+}
+
+//CHINA001 SvxPostItDialog begin
+AbstractSvxPostItDialog* AbstractDialogFactory_Impl::CreateSvxPostItDialog( Window* pParent,
+ const SfxItemSet& rCoreSet,
+ sal_uInt32 nResId,
+ BOOL bPrevNext, BOOL bRedline )
+{
+ SvxPostItDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RID_SVXDLG_POSTIT :
+ pDlg = new SvxPostItDialog( pParent, rCoreSet, bPrevNext, bRedline );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSvxPostItDialog_Impl( pDlg );
+ return 0;
+}
+//CHINA001 SvxPostItDialog end
+
+class SvxMacroAssignDialog : public VclAbstractDialog
+{
+public:
+ SvxMacroAssignDialog( Window* _pParent, const Reference< XFrame >& _rxDocumentFrame, const bool _bUnoDialogMode,
+ const Reference< XNameReplace >& _rxEvents, const sal_uInt16 _nInitiallySelectedEvent )
+ :m_aItems( SFX_APP()->GetPool(), SID_ATTR_MACROITEM, SID_ATTR_MACROITEM )
+ {
+ m_aItems.Put( SfxBoolItem( SID_ATTR_MACROITEM, _bUnoDialogMode ) );
+ m_pDialog.reset( new SvxMacroAssignDlg( _pParent, _rxDocumentFrame, m_aItems, _rxEvents, _nInitiallySelectedEvent ) );
+ }
+
+ virtual short Execute();
+ virtual ~SvxMacroAssignDialog();
+
+private:
+ SfxItemSet m_aItems;
+ ::std::auto_ptr< SvxMacroAssignDlg > m_pDialog;
+};
+
+short SvxMacroAssignDialog::Execute()
+{
+ return m_pDialog->Execute();
+}
+
+SvxMacroAssignDialog::~SvxMacroAssignDialog()
+{
+}
+
+VclAbstractDialog * AbstractDialogFactory_Impl::CreateSvxMacroAssignDlg(
+ Window* _pParent, const Reference< XFrame >& _rxDocumentFrame, const bool _bUnoDialogMode,
+ const Reference< XNameReplace >& _rxEvents, const sal_uInt16 _nInitiallySelectedEvent )
+{
+ return new SvxMacroAssignDialog( _pParent, _rxDocumentFrame, _bUnoDialogMode, _rxEvents, _nInitiallySelectedEvent );
+}
+
+// Factories for TabPages
+CreateTabPage AbstractDialogFactory_Impl::GetTabPageCreatorFunc( USHORT nId )
+{
+ switch ( nId )
+ {
+ case RID_OFA_TP_INTERNATIONAL:
+ return ::offapp::InternationalOptionsPage::CreateSc;
+ case RID_OFA_TP_INTERNATIONAL_SD:
+ case RID_OFA_TP_INTERNATIONAL_IMPR:
+ return offapp::InternationalOptionsPage::CreateSd;
+ case RID_SVXPAGE_TEXTANIMATION :
+ return SvxTextAnimationPage::Create;
+ case RID_SVXTABPAGE_GALLERY_GENERAL :
+ return TPGalleryThemeGeneral::Create;
+ case RID_SVXPAGE_TRANSPARENCE :
+ return SvxTransparenceTabPage::Create;
+ case RID_SVXPAGE_AREA :
+ return SvxAreaTabPage::Create;
+ case RID_SVXPAGE_SHADOW :
+ return SvxShadowTabPage::Create;
+ case RID_SVXPAGE_LINE :
+ return SvxLineTabPage::Create;
+ case RID_SVXPAGE_CONNECTION :
+ return SvxConnectionPage::Create;
+ case RID_SVXPAGE_MEASURE :
+ return SvxMeasurePage::Create;
+ case RID_SFXPAGE_GENERAL :
+ return SvxGeneralTabPage::Create;
+ case RID_SVXPAGE_PICK_SINGLE_NUM :
+ return SvxSingleNumPickTabPage::Create;
+ case RID_SVXPAGE_PICK_BMP :
+ return SvxBitmapPickTabPage::Create;
+ case RID_SVXPAGE_PICK_BULLET :
+ return SvxBulletPickTabPage::Create;
+ case RID_SVXPAGE_NUM_OPTIONS :
+ return SvxNumOptionsTabPage::Create;
+ case RID_SVXPAGE_PICK_NUM :
+ return SvxNumPickTabPage::Create;
+ case RID_SVXPAGE_NUM_POSITION :
+ return SvxNumPositionTabPage::Create;
+ case RID_SVXPAGE_PARA_ASIAN :
+ return SvxAsianTabPage::Create;
+ case RID_SVXPAGE_EXT_PARAGRAPH :
+ return SvxExtParagraphTabPage::Create;
+ case RID_SVXPAGE_ALIGN_PARAGRAPH :
+ return SvxParaAlignTabPage::Create;
+ case RID_SVXPAGE_STD_PARAGRAPH :
+ return SvxStdParagraphTabPage::Create;
+ case RID_SVXPAGE_TABULATOR :
+ return SvxTabulatorTabPage::Create;
+ case RID_SVXPAGE_TEXTATTR :
+ return SvxTextAttrPage::Create;
+ case RID_SVXPAGE_ALIGNMENT :
+ return svx::AlignmentTabPage::Create;
+ case RID_SW_TP_BACKGROUND :
+ case RID_SVXPAGE_BACKGROUND :
+ return SvxBackgroundTabPage::Create;
+ case RID_SVXPAGE_BORDER :
+ return SvxBorderTabPage::Create;
+ case RID_SVXPAGE_CHAR_NAME :
+ return SvxCharNamePage::Create;
+ case RID_SVXPAGE_CHAR_EFFECTS :
+ return SvxCharEffectsPage::Create;
+ case RID_SVXPAGE_CHAR_POSITION :
+ return SvxCharPositionPage::Create;
+ case RID_SVXPAGE_CHAR_TWOLINES :
+ return SvxCharTwoLinesPage::Create;
+ case RID_SVXPAGE_NUMBERFORMAT :
+ return SvxNumberFormatTabPage::Create;
+ case RID_SVXPAGE_PAGE :
+ return SvxPageDescPage::Create;
+ case RID_SVXPAGE_GRFCROP :
+ return SvxGrfCropPage::Create;
+ case RID_SVXPAGE_MACROASSIGN :
+ return SfxMacroTabPage::Create;
+ default:
+ break;
+ }
+
+ return 0;
+}
+CreateSvxDistributePage AbstractDialogFactory_Impl::GetSvxDistributePageCreatorFunc(USHORT nId )
+{
+ switch ( nId )
+ {
+ case RID_SVXPAGE_DISTRIBUTE:
+ return SvxDistributePage::Create;
+ default:
+ break;
+ }
+
+ return 0;
+}
+DialogGetRanges AbstractDialogFactory_Impl::GetDialogGetRangesFunc( USHORT nId )
+{
+ switch ( nId )
+ {
+ case RID_SVXDLG_POSTIT:
+ return SvxPostItDialog::GetRanges; //add for SvxPostItDialog
+ default:
+ break;
+ }
+
+ return 0;
+}
+GetTabPageRanges AbstractDialogFactory_Impl::GetTabPageRangesFunc( USHORT nId )
+{
+ switch ( nId )
+ {
+ case RID_SVXPAGE_TEXTANIMATION :
+ return SvxTextAnimationPage::GetRanges;
+ case RID_SVXPAGE_DISTRIBUTE:
+ return SvxDistributePage::GetRanges;
+ case RID_SVXPAGE_TRANSPARENCE :
+ return SvxTransparenceTabPage::GetRanges;
+ case RID_SVXPAGE_AREA :
+ return SvxAreaTabPage::GetRanges;
+ case RID_SVXPAGE_SHADOW :
+ return SvxShadowTabPage::GetRanges;
+ case RID_SVXPAGE_LINE :
+ return SvxLineTabPage::GetRanges;
+ case RID_SVXPAGE_CONNECTION :
+ return SvxConnectionPage::GetRanges;
+ case RID_SVXPAGE_MEASURE :
+ return SvxMeasurePage::GetRanges;
+ case RID_SVXPAGE_PARA_ASIAN :
+ return SvxAsianTabPage::GetRanges;
+ case RID_SVXPAGE_EXT_PARAGRAPH :
+ return SvxExtParagraphTabPage::GetRanges;
+ case RID_SVXPAGE_ALIGN_PARAGRAPH :
+ return SvxParaAlignTabPage::GetRanges;
+ case RID_SVXPAGE_STD_PARAGRAPH :
+ return SvxStdParagraphTabPage::GetRanges;
+ case RID_SVXPAGE_TABULATOR :
+ return SvxTabulatorTabPage::GetRanges;
+ case RID_SVXPAGE_TEXTATTR :
+ return SvxTextAttrPage::GetRanges;
+ case RID_SVXPAGE_ALIGNMENT :
+ return svx::AlignmentTabPage::GetRanges;
+ case RID_SW_TP_BACKGROUND :
+ case RID_SVXPAGE_BACKGROUND :
+ return SvxBackgroundTabPage::GetRanges;
+ case RID_SVXPAGE_BORDER :
+ return SvxBorderTabPage::GetRanges;
+ case RID_SVXPAGE_CHAR_NAME :
+ return SvxCharNamePage::GetRanges;
+ case RID_SVXPAGE_CHAR_EFFECTS :
+ return SvxCharEffectsPage::GetRanges;
+ case RID_SVXPAGE_CHAR_POSITION :
+ return SvxCharPositionPage::GetRanges;
+ case RID_SVXPAGE_CHAR_TWOLINES :
+ return SvxCharTwoLinesPage::GetRanges;
+ case RID_SVXPAGE_NUMBERFORMAT :
+ return SvxNumberFormatTabPage::GetRanges;
+ case RID_SVXPAGE_PAGE :
+ return SvxPageDescPage::GetRanges;
+ case RID_SVXPAGE_ASIAN_LAYOUT:
+ return SvxAsianLayoutPage::GetRanges;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+SfxAbstractInsertObjectDialog* AbstractDialogFactory_Impl::CreateInsertObjectDialog( Window* pParent, USHORT nSlotId,
+ const Reference < com::sun::star::embed::XStorage >& xStor,
+ const SvObjectServerList* pList )
+{
+ InsertObjectDialog_Impl* pDlg=0;
+ switch ( nSlotId )
+ {
+ case SID_INSERT_OBJECT : pDlg = new SvInsertOleDlg( pParent, xStor, pList ); break;
+ case SID_INSERT_PLUGIN : pDlg = new SvInsertPlugInDialog( pParent, xStor ); break;
+ case SID_INSERT_APPLET : pDlg = new SvInsertAppletDialog( pParent, xStor ); break;
+ case SID_INSERT_FLOATINGFRAME : pDlg = new SfxInsertFloatingFrameDialog( pParent, xStor ); break;
+ default: break;
+ }
+
+ if ( pDlg )
+ {
+ pDlg->SetHelpId( nSlotId );
+ return new AbstractInsertObjectDialog_Impl( pDlg );
+ }
+ return 0;
+}
+
+VclAbstractDialog* AbstractDialogFactory_Impl::CreateEditObjectDialog( Window* pParent, USHORT nSlotId,
+ const Reference < com::sun::star::embed::XEmbeddedObject >& xObj )
+{
+ InsertObjectDialog_Impl* pDlg=0;
+ switch ( nSlotId )
+ {
+ case SID_INSERT_APPLET : pDlg = new SvInsertAppletDialog( pParent, xObj ); break;
+ case SID_INSERT_FLOATINGFRAME : pDlg = new SfxInsertFloatingFrameDialog( pParent, xObj ); break;
+ default: break;
+ }
+
+ if ( pDlg )
+ {
+ pDlg->SetHelpId( nSlotId );
+ return new VclAbstractDialog_Impl( pDlg );
+ }
+ return 0;
+}
+
+SfxAbstractPasteDialog* AbstractDialogFactory_Impl::CreatePasteDialog( Window* pParent )
+{
+ return new AbstractPasteDialog_Impl( new SvPasteObjectDialog( pParent ) );
+}
+
+SfxAbstractLinksDialog* AbstractDialogFactory_Impl::CreateLinksDialog( Window* pParent, sfx2::SvLinkManager* pMgr, BOOL bHTML, sfx2::SvBaseLink* p)
+{
+ SvBaseLinksDlg* pLinkDlg = new SvBaseLinksDlg( pParent, pMgr, bHTML );
+ if ( p )
+ pLinkDlg->SetActLink(p);
+ return new AbstractLinksDialog_Impl( pLinkDlg );
+}
+
+SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog( Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* /*pObj*/ )
+{
+ return new AbstractTabDialog_Impl( new SvxFormatCellsDialog( pParent, pAttr, pModel ) );
+}
+
+SvxAbstractSplittTableDialog* AbstractDialogFactory_Impl::CreateSvxSplittTableDialog( Window* pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal )
+{
+ return new SvxSplitTableDlg( pParent, bIsTableVertical, nMaxVertical, nMaxHorizontal );
+}
+
+SvxAbstractNewTableDialog* AbstractDialogFactory_Impl::CreateSvxNewTableDialog( Window* pParent )
+{
+ return new SvxNewTableDialog( pParent );
+}
+
+VclAbstractDialog* AbstractDialogFactory_Impl::CreateOptionsDialog(
+ Window* pParent, const rtl::OUString& rExtensionId, const rtl::OUString& /*rApplicationContext*/ )
+{
+ return new VclAbstractDialog_Impl( new OfaTreeOptionsDialog( pParent, rExtensionId ) );
+}
+
+SvxAbstractInsRowColDlg* AbstractDialogFactory_Impl::CreateSvxInsRowColDlg( Window* pParent, bool bCol, ULONG nHelpId )
+{
+ return new SvxInsRowColDlg( pParent, bCol, nHelpId );
+}
+
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
new file mode 100644
index 000000000000..e6b956d580af
--- /dev/null
+++ b/cui/source/factory/dlgfact.hxx
@@ -0,0 +1,802 @@
+/*************************************************************************
+ *
+ * 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: dlgfact.hxx,v $
+ * $Revision: 1.35 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CUI_DLGFACT_HXX
+#define _CUI_DLGFACT_HXX
+
+// include ---------------------------------------------------------------
+#include <svx/svxdlg.hxx>
+#include <com/sun/star/container/XNameReplace.hpp>
+
+#include "tools/link.hxx"
+#include <com/sun/star/frame/XFrame.hpp>
+
+class SfxTabDialog;
+class SfxModalDialog;
+class Dialog;
+class SfxItemPool;
+class FmShowColsDialog;
+class SvxZoomDialog;
+class FmInputRecordNoDialog;
+class SvxJSearchOptionsDialog;
+class FmFormShell;
+class SvxNewDictionaryDialog;
+class SvxNameDialog;
+
+// #i68101#
+class SvxObjectNameDialog;
+class SvxObjectTitleDescDialog;
+
+class SvxMessDialog;
+class SvxMultiPathDialog;
+class SvxMultiFileDialog;
+class SvxHpLinkDlg;
+class FmSearchDialog;
+class Graphic;
+class GraphicFilterDialog;
+class SvxAreaTabDialog;
+class InsertObjectDialog_Impl;
+class SvPasteObjectDialog;
+class SvBaseLinksDlg;
+class SvxTransformTabDialog;
+class SvxCaptionTabDialog;
+
+namespace svx{
+class HangulHanjaConversionDialog;
+}
+using namespace svx;
+
+#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(); \
+}
+
+//for GalleryThemeProperties begin
+class VclAbstractDialog2_Impl : public VclAbstractDialog2
+{
+ Dialog* m_pDlg;
+ Link m_aEndDlgHdl;
+public:
+ VclAbstractDialog2_Impl( Dialog* p ) : m_pDlg( p ) {} \
+ virtual ~VclAbstractDialog2_Impl();
+ virtual void StartExecuteModal( const Link& rEndDialogHdl );
+ virtual long GetResult();
+private:
+ DECL_LINK( EndDialogHdl, Dialog* );
+};
+//for GalleryThemeProperties end
+
+class VclAbstractDialog_Impl : public VclAbstractDialog
+{
+ DECL_ABSTDLG_BASE(VclAbstractDialog_Impl,Dialog)
+};
+
+//for ActualizeProgress begin
+class VclAbstractRefreshableDialog_Impl : public VclAbstractRefreshableDialog
+{
+ DECL_ABSTDLG_BASE(VclAbstractRefreshableDialog_Impl,Dialog)
+ virtual void Update() ;
+ virtual void Sync() ;
+};
+//for ActualizeProgress end
+
+class AbstractSfxDialog_Impl : public SfxAbstractDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSfxDialog_Impl,SfxModalDialog)
+ virtual const SfxItemSet* GetOutputItemSet() const;
+
+ //From class Window.
+ virtual void SetText( const XubString& rStr );
+ virtual String GetText() const ;
+};
+
+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 ); //add by CHINA001
+ virtual void SetInputSet( const SfxItemSet* pInSet ); //add by CHINA001
+ //From class Window.
+ virtual void SetText( const XubString& rStr ); //add by CHINA001
+ virtual String GetText() const; //add by CHINA001
+};
+
+//for SvxDistributeDialog begin
+class SvxDistributeDialog;
+class AbstractSvxDistributeDialog_Impl: public AbstractSvxDistributeDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxDistributeDialog_Impl,SvxDistributeDialog)
+public:
+ virtual SvxDistributeHorizontal GetDistributeHor() const;
+ virtual SvxDistributeVertical GetDistributeVer() const;
+};
+//for SvxDistributeDialog end
+
+// for HangulHanjaConversionDialog begin
+class AbstractHangulHanjaConversionDialog_Impl: public AbstractHangulHanjaConversionDialog
+{
+ DECL_ABSTDLG_BASE(AbstractHangulHanjaConversionDialog_Impl,HangulHanjaConversionDialog)
+ virtual void EndDialog(long nResult = 0);
+ virtual void EnableRubySupport( sal_Bool _bVal );
+ virtual void SetByCharacter( sal_Bool _bByCharacter ) ;
+ virtual void SetConversionDirectionState( sal_Bool _bTryBothDirections, HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection );
+ virtual void SetConversionFormat( HangulHanjaConversion::ConversionFormat _eType );
+ virtual void SetOptionsChangedHdl( const Link& _rHdl );
+ virtual void SetIgnoreHdl( const Link& _rHdl );
+ virtual void SetIgnoreAllHdl( const Link& _rHdl ) ;
+ virtual void SetChangeHdl( const Link& _rHdl ) ;
+ virtual void SetChangeAllHdl( const Link& _rHdl ) ;
+ virtual void SetClickByCharacterHdl( const Link& _rHdl ) ;
+ virtual void SetConversionFormatChangedHdl( const Link& _rHdl ) ;
+ virtual void SetFindHdl( const Link& _rHdl );
+ virtual sal_Bool GetUseBothDirections( ) const;
+ virtual HangulHanjaConversion::ConversionDirection GetDirection( HangulHanjaConversion::ConversionDirection _eDefaultDirection ) const;
+ virtual void SetCurrentString(
+ const String& _rNewString,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rSuggestions,
+ bool _bOriginatesFromDocument = true
+ );
+ virtual String GetCurrentString( ) const ;
+ virtual HangulHanjaConversion::ConversionFormat GetConversionFormat( ) const ;
+ virtual void FocusSuggestion( );
+ virtual String GetCurrentSuggestion( ) const;
+};
+
+// for HangulHanjaConversionDialog end
+
+// for FmShowColsDialog begin
+class FmShowColsDialog;
+class AbstractFmShowColsDialog_Impl : public AbstractFmShowColsDialog
+{
+ DECL_ABSTDLG_BASE(AbstractFmShowColsDialog_Impl,FmShowColsDialog)
+ virtual void SetColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xCols);
+};
+//for FmShowColsDialog end
+
+
+//for SvxZoomDialog begin
+class SvxZoomDialog;
+class AbstractSvxZoomDialog_Impl : public AbstractSvxZoomDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxZoomDialog_Impl,SvxZoomDialog)
+ virtual void SetLimits( USHORT nMin, USHORT nMax );
+ virtual void HideButton( USHORT nBtnId );
+ virtual const SfxItemSet* GetOutputItemSet() const ;
+
+};
+//for SvxZoomDialog end
+
+//for SvxSpellDialog begin
+namespace svx{ class SpellDialog;}
+class AbstractSpellDialog_Impl : public AbstractSpellDialog
+{
+ public:
+ DECL_ABSTDLG_BASE(AbstractSpellDialog_Impl, svx::SpellDialog)
+ virtual void SetLanguage( sal_uInt16 nLang );
+ virtual sal_Bool Close();
+ virtual void Invalidate();
+ virtual Window* GetWindow();
+ virtual SfxBindings& GetBindings();
+};
+
+//for SvxSpellCheckDialog begin
+//STRIP001 class AbstractSvxSpellCheckDialog_Impl : public AbstractSvxSpellCheckDialog //add for FmShowColsDialog
+//STRIP001 {
+//STRIP001 SvxSpellCheckDialog * pDlg;
+//STRIP001 public
+//STRIP001 AbstractSvxSpellCheckDialog_Impl ( SvxSpellCheckDialog* p)
+//STRIP001 : pDlg(p)
+//STRIP001 {}
+//STRIP001 virtual USHORT Execute() ;
+//STRIP001 virtual void SetNewEditWord( const String& _rNew ) ;
+//STRIP001 virtual void SetLanguage( sal_uInt16 nLang ) ;
+//STRIP001 virtual void HideAutoCorrect() ;
+//STRIP001 virtual String GetNewEditWord();
+//STRIP001 virtual void SetNewEditWord( const String& _rNew );
+//STRIP001 }
+//for SvxSpellCheckDialog end
+
+
+//for SearchProgress begin
+class SearchProgress;
+class AbstractSearchProgress_Impl : public AbstractSearchProgress
+{
+ DECL_ABSTDLG_BASE(AbstractSearchProgress_Impl,SearchProgress)
+ virtual void Update() ;
+ virtual void Sync() ;
+ virtual void SetFileType( const String& rType ) ;
+ virtual void SetDirectory( const INetURLObject& rURL ) ;
+ virtual PLinkStub GetLinkStubCleanUpHdl() ;
+
+};
+//for SearchProgress end
+
+//for TakeProgress begin
+class TakeProgress;
+class AbstractTakeProgress_Impl : public AbstractTakeProgress
+{
+ DECL_ABSTDLG_BASE(AbstractTakeProgress_Impl,TakeProgress)
+ virtual void Update() ;
+ virtual void Sync() ;
+ virtual void SetFile( const INetURLObject& rURL ) ;
+ virtual PLinkStub GetLinkStubCleanUpHdl() ;
+
+};
+//for TakeProgress end
+
+//for TitleDialog begin
+class TitleDialog;
+class AbstractTitleDialog_Impl : public AbstractTitleDialog
+{
+ DECL_ABSTDLG_BASE(AbstractTitleDialog_Impl,TitleDialog)
+ virtual String GetTitle() const ;
+
+};
+//for TitleDialog end
+
+//for SvxScriptSelectorDialog begin
+class SvxScriptSelectorDialog;
+class AbstractScriptSelectorDialog_Impl : public AbstractScriptSelectorDialog
+{
+ DECL_ABSTDLG_BASE(
+ AbstractScriptSelectorDialog_Impl, SvxScriptSelectorDialog)
+
+ virtual String GetScriptURL() const;
+
+ virtual void SetRunLabel();
+};
+
+//for GalleryIdDialog begin
+class GalleryIdDialog;
+class AbstractGalleryIdDialog_Impl : public AbstractGalleryIdDialog
+{
+ DECL_ABSTDLG_BASE(AbstractGalleryIdDialog_Impl,GalleryIdDialog)
+ virtual ULONG GetId() const ;
+
+};
+//for GalleryIdDialog end
+
+//for URLDlg start
+class URLDlg;
+class AbstractURLDlg_Impl :public AbstractURLDlg
+{
+ DECL_ABSTDLG_BASE(AbstractURLDlg_Impl,URLDlg)
+ virtual String GetURL() const;
+ virtual String GetAltText() const;
+ virtual String GetDesc() const;
+ virtual String GetTarget() const;
+ virtual String GetName() const;
+};
+//for URLDlg end
+
+//for SvxHlinkDlgMarkWnd begin
+class SvxHlinkDlgMarkWnd;
+class AbstractSvxHlinkDlgMarkWnd_Impl : public AbstractSvxHlinkDlgMarkWnd
+{
+ DECL_ABSTDLG_BASE(AbstractSvxHlinkDlgMarkWnd_Impl,SvxHlinkDlgMarkWnd)
+ virtual void Hide( USHORT nFlags = 0 );
+ virtual BOOL IsVisible() const ;
+ virtual void Invalidate( USHORT nFlags = 0 );
+ virtual void SetSizePixel( const Size& rNewSize );
+ virtual Size GetSizePixel() const;
+ virtual BOOL MoveTo ( Point aNewPos )const;
+ virtual BOOL ConnectToDialog( BOOL bDoit = TRUE )const;
+ virtual void RefreshTree ( String aStrURL ) ;
+ virtual void SelectEntry ( String aStrMark );
+ virtual USHORT SetError( USHORT nError) ;
+
+};
+//for SvxHlinkDlgMarkWnd end
+
+//for SvxSearchSimilarityDialog begin
+class SvxSearchSimilarityDialog;
+class AbstractSvxSearchSimilarityDialog_Impl :public AbstractSvxSearchSimilarityDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxSearchSimilarityDialog_Impl,SvxSearchSimilarityDialog)
+ virtual USHORT GetOther();
+ virtual USHORT GetShorter();
+ virtual USHORT GetLonger();
+ virtual BOOL IsRelaxed();
+};
+//for SvxSearchSimilarityDialog end
+
+//for SvxJSearchOptionsDialog end
+class SvxJSearchOptionsDialog;
+class AbstractSvxJSearchOptionsDialog_Impl :public AbstractSvxJSearchOptionsDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxJSearchOptionsDialog_Impl,SvxJSearchOptionsDialog)
+ virtual INT32 GetTransliterationFlags() const;
+};
+//for SvxJSearchOptionsDialog end
+
+class AbstractSvxTransformTabDialog_Impl : public AbstractSvxTransformTabDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxTransformTabDialog_Impl,SvxTransformTabDialog)
+ virtual void SetValidateFramePosLink( const Link& rLink );
+ virtual void SetCurPageId( USHORT nId );
+ virtual const SfxItemSet* GetOutputItemSet() const;
+ virtual const USHORT* GetInputRanges( const SfxItemPool& pItem );
+ virtual void SetInputSet( const SfxItemSet* pInSet );
+ virtual void SetText( const XubString& rStr );
+ virtual String GetText() const;
+};
+class AbstractSvxCaptionDialog_Impl : public AbstractSvxCaptionDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxCaptionDialog_Impl,SvxCaptionTabDialog)
+ virtual void SetValidateFramePosLink( const Link& rLink );
+ virtual void SetCurPageId( USHORT nId );
+ virtual const SfxItemSet* GetOutputItemSet() const;
+ virtual const USHORT* GetInputRanges( const SfxItemPool& pItem );
+ virtual void SetInputSet( const SfxItemSet* pInSet );
+ virtual void SetText( const XubString& rStr );
+ virtual String GetText() const;
+};
+
+//for FmInputRecordNoDialog end
+class FmInputRecordNoDialog;
+class AbstractFmInputRecordNoDialog_Impl :public AbstractFmInputRecordNoDialog
+{
+ DECL_ABSTDLG_BASE(AbstractFmInputRecordNoDialog_Impl,FmInputRecordNoDialog)
+ virtual void SetValue(long nNew) ;
+ virtual long GetValue() const ;
+};
+//for FmInputRecordNoDialog end
+
+//for SvxNewDictionaryDialog end
+class SvxNewDictionaryDialog;
+class AbstractSvxNewDictionaryDialog_Impl :public AbstractSvxNewDictionaryDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxNewDictionaryDialog_Impl,SvxNewDictionaryDialog)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetNewDictionary();
+};
+//for SvxNewDictionaryDialog end
+
+//for SvxNameDialog end
+class SvxNameDialog;
+class AbstractSvxNameDialog_Impl :public AbstractSvxNameDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxNameDialog_Impl,SvxNameDialog)
+ virtual void GetName( String& rName ) ;
+ virtual void SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false ) ;
+ virtual void SetEditHelpId(ULONG nHelpId) ;
+ //from class Window
+ virtual void SetHelpId( ULONG nHelpId ) ;
+ virtual void SetText( const XubString& rStr ) ;
+private:
+ Link aCheckNameHdl;
+ DECL_LINK( CheckNameHdl, Window*);
+};
+//for SvxNameDialog end
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+// #i68101#
+
+// predefines
+class SvxObjectNameDialog;
+class SvxObjectTitleDescDialog;
+
+class AbstractSvxObjectNameDialog_Impl :public AbstractSvxObjectNameDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxObjectNameDialog_Impl, SvxObjectNameDialog)
+ virtual void GetName(String& rName) ;
+ virtual void SetCheckNameHdl(const Link& rLink, bool bCheckImmediately = false);
+
+private:
+ Link aCheckNameHdl;
+ DECL_LINK(CheckNameHdl, Window*);
+};
+
+class AbstractSvxObjectTitleDescDialog_Impl :public AbstractSvxObjectTitleDescDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxObjectTitleDescDialog_Impl, SvxObjectTitleDescDialog)
+ virtual void GetTitle(String& rName);
+ virtual void GetDescription(String& rName);
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+//for SvxMessDialog end
+class SvxMessDialog;
+class AbstractSvxMessDialog_Impl :public AbstractSvxMessDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxMessDialog_Impl,SvxMessDialog)
+ virtual void SetButtonText( USHORT nBtnId, const String& rNewTxt );
+};
+//for SvxMessDialog end
+
+//for SvxMultiPathDialog end
+class SvxMultiPathDialog;
+class AbstractSvxMultiPathDialog_Impl :public AbstractSvxMultiPathDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxMultiPathDialog_Impl,SvxMultiPathDialog)
+ virtual String GetPath() const;
+ virtual void SetPath( const String& rPath );
+ virtual void EnableRadioButtonMode();
+ virtual void SetTitle( const String& rNewTitle );
+};
+//for SvxMultiPathDialog end
+
+//for SvxMultiFileDialog begin
+class SvxMultiFileDialog;
+class AbstractSvxMultiFileDialog_Impl :public AbstractSvxMultiFileDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxMultiFileDialog_Impl,SvxMultiFileDialog)
+ virtual String GetFiles() const ;
+ virtual void SetFiles( const String& rPath ) ;
+ //from SvxMultiPathDialog
+ virtual String GetPath() const;
+ virtual void SetPath( const String& rPath );
+ virtual void SetClassPathMode();
+ virtual void EnableRadioButtonMode();
+ virtual void SetTitle( const String& rNewTitle );
+ //From Class Window
+ virtual void SetHelpId( ULONG nHelpId ) ;
+
+};
+//for SvxMultiFileDialog end
+
+//for SvxHpLinkDlg begin
+class SvxHpLinkDlg;
+class AbstractSvxHpLinkDlg_Impl :public AbstractSvxHpLinkDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSvxHpLinkDlg_Impl,SvxHpLinkDlg)
+ virtual Window* GetWindow();
+ virtual sal_Bool QueryClose();
+};
+//for SvxHpLinkDlg end
+
+//for FmSearchDialog begin
+class FmSearchDialog;
+class AbstractFmSearchDialog_Impl :public AbstractFmSearchDialog
+{
+ DECL_ABSTDLG_BASE(AbstractFmSearchDialog_Impl,FmSearchDialog)
+ virtual void SetFoundHandler(const Link& lnk) ;
+ virtual void SetCanceledNotFoundHdl(const Link& lnk);
+ virtual void SetActiveField(const String& strField);
+};
+//for FmSearchDialog end
+
+//for GraphicFilterDialog begin
+class GraphicFilterDialog;
+class AbstractGraphicFilterDialog_Impl :public AbstractGraphicFilterDialog
+{
+ DECL_ABSTDLG_BASE(AbstractGraphicFilterDialog_Impl,GraphicFilterDialog)
+ virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY );
+};
+//for GraphicFilterDialog end
+
+//add for SvxAreaTabDialog begin
+class SvxAreaTabDialog;
+class AbstractSvxAreaTabDialog_Impl :public AbstractSvxAreaTabDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSvxAreaTabDialog_Impl,SvxAreaTabDialog)
+ 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 DontDeleteColorTable() ;
+};
+//add for SvxAreaTabDialog end
+
+class AbstractInsertObjectDialog_Impl : public SfxAbstractInsertObjectDialog
+{
+ DECL_ABSTDLG_BASE(AbstractInsertObjectDialog_Impl, InsertObjectDialog_Impl)
+ virtual com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObject();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetIconIfIconified( ::rtl::OUString* pGraphicMediaType );
+ virtual BOOL IsCreateNew();
+};
+
+class AbstractPasteDialog_Impl : public SfxAbstractPasteDialog
+{
+public:
+ DECL_ABSTDLG_BASE(AbstractPasteDialog_Impl, SvPasteObjectDialog )
+ virtual void Insert( SotFormatStringId nFormat, const String & rFormatName );
+ virtual void SetObjName( const SvGlobalName & rClass, const String & rObjName );
+ virtual ULONG GetFormat( const TransferableDataHelper& aHelper,
+ const DataFlavorExVector* pFormats=0,
+ const TransferableObjectDescriptor* pDesc=0 );
+};
+
+class AbstractLinksDialog_Impl : public SfxAbstractLinksDialog
+{
+public:
+ DECL_ABSTDLG_BASE(AbstractLinksDialog_Impl, SvBaseLinksDlg )
+};
+
+
+//add for SvxPostItDialog begin
+class SvxPostItDialog;
+class AbstractSvxPostItDialog_Impl :public AbstractSvxPostItDialog
+{
+ DECL_ABSTDLG_BASE( AbstractSvxPostItDialog_Impl, SvxPostItDialog )
+ virtual void SetText( const XubString& rStr ); //From class Window
+ virtual const SfxItemSet* GetOutputItemSet() const;
+ virtual void SetPrevHdl( const Link& rLink ) ;
+ virtual void SetNextHdl( const Link& rLink ) ;
+ virtual void EnableTravel(BOOL bNext, BOOL bPrev) ;
+ virtual String GetNote() ;
+ virtual void SetNote(const String& rTxt) ;
+ virtual void ShowLastAuthor(const String& rAuthor, const String& rDate) ;
+ virtual void DontChangeAuthor() ;
+ virtual void HideAuthor() ;
+ virtual void SetReadonlyPostIt(BOOL bDisable) ;
+ virtual BOOL IsOkEnabled() const ;
+ virtual Window * GetWindow();
+private:
+ Link aNextHdl;
+ Link aPrevHdl;
+ DECL_LINK( NextHdl, Window*);
+ DECL_LINK( PrevHdl, Window*);
+};
+//add for SvxPostItDialog end
+
+//------------------------------------------------------------------------
+//AbstractDialogFactory_Impl implementations
+class AbstractDialogFactory_Impl : public SvxAbstractDialogFactory
+{
+
+public:
+ virtual VclAbstractDialog* CreateVclDialog( Window* pParent, sal_uInt32 nResId );
+ virtual VclAbstractDialog* CreateSfxDialog( Window* pParent, const SfxBindings& rBindings, sal_uInt32 nResId );
+ virtual SfxAbstractDialog* CreateSfxDialog( sal_uInt32 nResId,
+ Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xViewFrame,
+ const SfxItemSet* pAttrSet=0 );
+ virtual SfxAbstractDialog* CreateSfxDialog( Window* pParent,
+ const SfxItemSet& rAttr,
+ const SdrView* pView,
+ sal_uInt32 nResId );
+ 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 VclAbstractDialog* CreateFrameDialog( Window* pParent, const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rxFrame, sal_uInt32 nResId, const String& rParameter );
+ virtual SfxAbstractTabDialog* CreateTabDialog( sal_uInt32 nResId,
+ Window* pParent,
+ const SfxItemSet* pAttrSet,
+ SfxViewFrame* pViewFrame,
+ bool bEditFmt=false,
+ const String *pUserButtonText=0 );
+ virtual SfxAbstractTabDialog* CreateTabDialog( sal_uInt32 nResId,
+ Window* pParent,
+ const SfxItemSet* pAttrSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xViewFrame,
+ bool bEditFmt=false,
+ const String *pUserButtonText=0 );
+ virtual SfxAbstractTabDialog* CreateTextTabDialog( Window* pParent,
+ const SfxItemSet* pAttrSet,
+ sal_uInt32 nResId,
+ SdrView* pView,
+ SdrModel* pModel=0 ); //add for SvxTextTabDialog
+ virtual SfxAbstractTabDialog* CreateTabItemDialog( Window* pParent,
+ const SfxItemSet& rSet,
+ sal_uInt32 nResId); //add by CHINA001
+ virtual AbstractSvxCaptionDialog* CreateCaptionDialog( Window* pParent,
+ const SdrView* pView,
+ sal_uInt32 nResId,
+ USHORT nAnchorTypes = 0 ); //add for SvxCaptionTabDialog CHINA001
+ virtual AbstractSvxDistributeDialog* CreateSvxDistributeDialog(Window* pParent,
+ const SfxItemSet& rAttr,
+ sal_uInt32 nResId,
+ SvxDistributeHorizontal eHor = SvxDistributeHorizontalNone,
+ SvxDistributeVertical eVer = SvxDistributeVerticalNone);
+ virtual SfxAbstractInsertObjectDialog* CreateInsertObjectDialog( Window* pParent, USHORT nSlotId,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStor,
+ const SvObjectServerList* pList = 0 );
+ virtual VclAbstractDialog* CreateEditObjectDialog( Window* pParent, USHORT nSlotId,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObj );
+ virtual SfxAbstractPasteDialog* CreatePasteDialog( Window* pParent );
+ virtual SfxAbstractLinksDialog* CreateLinksDialog( Window* pParent, sfx2::SvLinkManager* pMgr, BOOL bHTML, sfx2::SvBaseLink* p=0 );
+
+ virtual AbstractHangulHanjaConversionDialog * CreateHangulHanjaConversionDialog( Window* _pParent, //add for HangulHanjaConversionDialog CHINA001
+ HangulHanjaConversion::ConversionDirection _ePrimaryDirection,
+ sal_uInt32 nResId);
+
+ virtual AbstractFmShowColsDialog * CreateFmShowColsDialog( Window* pParent ); //add for FmShowColsDialog
+ virtual AbstractSvxZoomDialog * CreateSvxZoomDialog( Window* pParent, //add for SvxZoomDialog
+ const SfxItemSet& rCoreSet,
+ sal_uInt32 nResId);
+ virtual SfxAbstractTabDialog* CreateSvxBorderBackgroundDlg( Window* pParent, //add for SvxBorderBackgroundDlg
+ const SfxItemSet& rCoreSet,
+ sal_uInt32 nResId,
+ BOOL bEnableSelector = FALSE) ;
+ virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( Window* pParent, //add for SvxTransformTabDialog
+ const SfxItemSet* pAttr,
+ const SdrView* pView,
+ sal_uInt32 nResId,
+ USHORT nAnchorTypes = 0) ;
+ virtual SfxAbstractTabDialog* CreateSchTransformTabDialog( Window* pParent, //add for SchTransformTabDialog
+ const SfxItemSet* pAttr,
+ const SdrView* pSdrView,
+ sal_uInt32 nResId,
+ bool bSizeTabPage = false
+ );
+ virtual AbstractSpellDialog * CreateSvxSpellDialog(
+ Window* pParent,
+ SfxBindings* pBindings,
+ svx::SpellDialogChildWindow* pSpellChildWindow );
+
+//STRIP001 virtual AbstractSvxSpellCheckDialog * CreateSvxSpellCheckDialog( Window* pParent, //add for SvxSpellCheckDialog
+//STRIP001 ::com::sun::star::uno::Reference<
+//STRIP001 ::com::sun::star::linguistic2::XSpellChecker1 > &xChecker,
+//STRIP001 SvxSpellWrapper* pWrapper,
+//STRIP001 sal_uInt32 nResId);
+ virtual VclAbstractRefreshableDialog * CreateActualizeProgressDialog( Window* pParent, GalleryTheme* pThm );
+ virtual AbstractSearchProgress * CreateSearchProgressDialog( Window* pParent,
+ const INetURLObject& rStartURL);
+ virtual AbstractTakeProgress * CreateTakeProgressDialog( Window* pParent );
+ virtual AbstractTitleDialog * CreateTitleDialog( Window* pParent, //add for TitleDialog
+ const String& rOldText);
+ virtual AbstractGalleryIdDialog * CreateGalleryIdDialog( Window* pParent, //add for SvxZoomDialog
+ GalleryTheme* pThm);
+ virtual VclAbstractDialog2 * CreateGalleryThemePropertiesDialog( Window* pParent, //add for GalleryThemeProperties
+ ExchangeData* pData,
+ SfxItemSet* pItemSet);
+ virtual AbstractURLDlg * CreateURLDialog( Window* pParent, //add for URLDlg
+ const String& rURL, const String& rAltText, const String& rDescription,
+ const String& rTarget, const String& rName,
+ TargetList& rTargetList );
+ virtual AbstractSvxHlinkDlgMarkWnd* CreateSvxHlinkDlgMarkWndDialog( SvxHyperlinkTabPageBase* pParent, sal_uInt32 nResId ); //add for SvxHlinkDlgMarkWnd
+
+ virtual VclAbstractDialog* CreateSvxSearchAttributeDialog( Window* pParent,
+ SearchAttrItemList& rLst,
+ const USHORT* pWhRanges,
+ sal_uInt32 nResId ); //add for SvxSearchAttributeDialog
+ virtual AbstractSvxSearchSimilarityDialog * CreateSvxSearchSimilarityDialog( Window* pParent,
+ BOOL bRelax,
+ USHORT nOther,
+ USHORT nShorter,
+ USHORT nLonger); //add for SvxSearchSimilarityDialog
+ virtual AbstractSvxJSearchOptionsDialog * CreateSvxJSearchOptionsDialog( Window* pParent,
+ const SfxItemSet& rOptionsSet, USHORT nUniqueId,
+ INT32 nInitialFlags,
+ sal_uInt32 nResId); //add for SvxJSearchOptionsDialog
+ virtual AbstractFmInputRecordNoDialog * CreateFmInputRecordNoDialog( Window* pParent );
+ virtual AbstractSvxNewDictionaryDialog* CreateSvxNewDictionaryDialog( Window* pParent,
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl,
+ sal_uInt32 nResId ); //add for SvxNewDictionaryDialog
+ virtual VclAbstractDialog * CreateSvxEditDictionaryDialog( Window* pParent,
+ const String& rName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1> &xSpl,
+ sal_uInt32 nResId);//add for SvxEditDictionaryDialog
+ virtual AbstractSvxNameDialog * CreateSvxNameDialog( Window* pParent,
+ const String& rName, const String& rDesc,
+ sal_uInt32 nResId ); //add for SvxNameDialog
+
+ // #i68101#
+ virtual AbstractSvxObjectNameDialog* CreateSvxObjectNameDialog(Window* pParent, const String& rName, sal_uInt32 nResId);
+ virtual AbstractSvxObjectTitleDescDialog* CreateSvxObjectTitleDescDialog(Window* pParent, const String& rTitle, const String& rDescription, sal_uInt32 nResId);
+
+ virtual AbstractSvxMessDialog * CreateSvxMessDialog( Window* pParent, sal_uInt32 nResId,
+ const String& rText, const String& rDesc,
+ Image* pImg = NULL ); //add for SvxMessDialog
+ virtual AbstractSvxMultiPathDialog * CreateSvxMultiPathDialog( Window* pParent, sal_uInt32 nResId,
+ BOOL bEmptyAllowed = FALSE ); //add for SvxMultiPathDialog
+ virtual AbstractSvxMultiFileDialog * CreateSvxMultiFileDialog( Window* pParent, sal_uInt32 nResId,
+ BOOL bEmptyAllowed = FALSE ); //add for SvxMultiFileDialog
+ virtual AbstractSvxHpLinkDlg * CreateSvxHpLinkDlg (Window* pParent, //add for SvxHpLink
+ SfxBindings* pBindings,
+ sal_uInt32 nResId);
+ virtual AbstractFmSearchDialog* CreateFmSearchDialog(Window* pParent, //add for FmSearchDialog
+ const String& strInitialText,
+ const ::std::vector< String >& _rContexts,
+ sal_Int16 nInitialContext,
+ const Link& lnkContextSupplier);
+ virtual AbstractGraphicFilterDialog * CreateGraphicFilterEmboss (Window* pParent, //add for GraphicFilterEmboss
+ const Graphic& rGraphic,
+ RECT_POINT eLightSource,
+ sal_uInt32 nResId);
+ virtual AbstractGraphicFilterDialog * CreateGraphicFilterPosterSepia (Window* pParent, //add for GraphicFilterPoster & GraphicFilterSepia
+ const Graphic& rGraphic,
+ USHORT nCount,
+ sal_uInt32 nResId);
+ virtual AbstractGraphicFilterDialog * CreateGraphicFilterSolarize (Window* pParent, //add for GraphicFilterSolarize
+ const Graphic& rGraphic,
+ BYTE nGreyThreshold, BOOL bInvert,
+ sal_uInt32 nResId);
+ virtual AbstractGraphicFilterDialog * CreateGraphicFilterMosaic (Window* pParent, //add for GraphicFilterMosaic
+ const Graphic& rGraphic,
+ USHORT nTileWidth, USHORT nTileHeight, BOOL bEnhanceEdges,
+ sal_uInt32 nResId);
+ virtual AbstractSvxAreaTabDialog* CreateSvxAreaTabDialog( Window* pParent,//add for SvxAreaTabDialog
+ const SfxItemSet* pAttr,
+ SdrModel* pModel,
+ sal_uInt32 nResId,
+ const SdrView* pSdrView = NULL ); //add for SvxAreaTabDialog
+ virtual SfxAbstractTabDialog* CreateSvxLineTabDialog( Window* pParent, const SfxItemSet* pAttr, //add for SvxLineTabDialog
+ SdrModel* pModel,
+ sal_uInt32 nResId,
+ const SdrObject* pObj = NULL,
+ BOOL bHasObj = TRUE );
+ virtual AbstractSvxPostItDialog* CreateSvxPostItDialog( Window* pParent, //add for SvxPostItDialog
+ const SfxItemSet& rCoreSet,
+ sal_uInt32 nResId,
+ BOOL bPrevNext = FALSE, BOOL bRedline = FALSE );
+
+ // For TabPage
+ virtual CreateTabPage GetTabPageCreatorFunc( USHORT nId );
+ virtual CreateSvxDistributePage GetSvxDistributePageCreatorFunc(USHORT nId );
+
+
+ virtual GetTabPageRanges GetTabPageRangesFunc( USHORT nId );
+ virtual DialogGetRanges GetDialogGetRangesFunc( USHORT nId ); //add for SvxPostItDialog
+ virtual VclAbstractDialog* CreateSvxScriptOrgDialog( Window* pParent, const String& rLanguage );
+
+ virtual AbstractScriptSelectorDialog*
+ CreateScriptSelectorDialog(
+ Window* pParent,
+ BOOL bShowSlots,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame
+ );
+
+ virtual VclAbstractDialog* CreateScriptErrorDialog(
+ Window* pParent, ::com::sun::star::uno::Any aException);
+
+ virtual VclAbstractDialog* CreateSvxMacroAssignDlg(
+ Window* _pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame,
+ const bool _bUnoDialogMode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace >& _rxEvents,
+ const sal_uInt16 _nInitiallySelectedEvent
+ );
+
+ virtual SfxAbstractTabDialog* CreateSvxFormatCellsDialog( Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* pObj = NULL );
+
+ virtual SvxAbstractSplittTableDialog* CreateSvxSplittTableDialog( Window* pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal );
+
+ virtual SvxAbstractNewTableDialog* CreateSvxNewTableDialog( Window* pParent ) ;
+
+ virtual VclAbstractDialog* CreateOptionsDialog(
+ Window* pParent, const rtl::OUString& rExtensionId, const rtl::OUString& rApplicationContext );
+
+ virtual SvxAbstractInsRowColDlg* CreateSvxInsRowColDlg( Window* pParent, bool bCol, ULONG nHelpId );
+};
+
+#endif
+
diff --git a/cui/source/factory/init.cxx b/cui/source/factory/init.cxx
new file mode 100644
index 000000000000..de01a2deb1b3
--- /dev/null
+++ b/cui/source/factory/init.cxx
@@ -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: init.cxx,v $
+ * $Revision: 1.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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <vcl/msgbox.hxx>
+#include "cuicharmap.hxx"
+
+// ------------------------------------------------------------------------
+// hook to call special character dialog for edits
+// caution: needs C-Linkage since dynamically loaded via symbol name
+extern "C"
+{
+bool GetSpecialCharsForEdit(Window* i_pParent, const Font& i_rFont, String& o_rResult)
+{
+ bool bRet = false;
+ SvxCharacterMap* aDlg = new SvxCharacterMap( i_pParent );
+ aDlg->DisableFontSelection();
+ aDlg->SetCharFont(i_rFont);
+ if ( aDlg->Execute() == RET_OK )
+ {
+ o_rResult = aDlg->GetCharacters();
+ bRet = true;
+ }
+ delete aDlg;
+ return bRet;
+}
+}
diff --git a/cui/source/factory/makefile.mk b/cui/source/factory/makefile.mk
new file mode 100755
index 000000000000..81d1562ec835
--- /dev/null
+++ b/cui/source/factory/makefile.mk
@@ -0,0 +1,55 @@
+#*************************************************************************
+#
+# 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: makefile.mk,v $
+#
+# $Revision: 1.65 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..
+PRJNAME=cui
+TARGET=factory
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc
+.ENDIF # ENABLE_LAYOUT == TRUE
+
+# --- Files --------------------------------------------------------
+
+SLOFILES+=\
+ $(SLO)$/dlgfact.obj \
+ $(SLO)$/cuiexp.obj \
+ $(SLO)$/init.obj \
+
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/cui/source/inc/ControlFocusHelper.hxx b/cui/source/inc/ControlFocusHelper.hxx
new file mode 100644
index 000000000000..828341da0e71
--- /dev/null
+++ b/cui/source/inc/ControlFocusHelper.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * 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: ControlFocusHelper.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SVX_CONTROLL_FUCUS_HELPER_HXX
+#define SVX_CONTROLL_FUCUS_HELPER_HXX
+
+#include <vcl/ctrl.hxx>
+
+// class SvxControlFocusHelper ---------------------------------------------
+
+class SvxControlFocusHelper : public Control
+{
+private:
+ Control* m_pFocusCtrl;
+
+public:
+ SvxControlFocusHelper( Window* pParent, const ResId& rId ) :
+ Control( pParent, rId ), m_pFocusCtrl( NULL ) {}
+
+ void SetFocusControl( Control* pCtrl ) { m_pFocusCtrl = pCtrl; }
+
+ virtual long Notify( NotifyEvent& rNEvt );
+};
+
+#endif // SVX_CONTROLL_FUCUS_HELPER_HXX
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
new file mode 100644
index 000000000000..86c41d17452e
--- /dev/null
+++ b/cui/source/inc/SpellDialog.hxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * 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: SpellDialog.hxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SPELLDDIALOG_HXX
+#define _SVX_SPELLDDIALOG_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/basedlgs.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/lstbox.hxx>
+#include <svtools/stdctrl.hxx>
+#include <vcl/button.hxx>
+#include <vcl/menubtn.hxx>
+#include <vcl/group.hxx>
+#include <vcl/decoview.hxx>
+#include <vcl/image.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+
+#include <svx/svxbox.hxx>
+#include <svx/langbox.hxx>
+#include <memory>
+#include <svtools/svmedit.hxx>
+#include <svl/lstner.hxx>
+#include <svtools/xtextedt.hxx>
+#include <svx/SpellPortions.hxx>
+
+class ScrollBar;
+class TextEngine;
+class ExtTextView;
+namespace svx{ class SpellUndoAction_Impl;}
+
+// forward ---------------------------------------------------------------
+
+struct SpellDialog_Impl;
+
+namespace com{namespace sun{namespace star{
+namespace linguistic2{
+ class XSpellChecker1;
+}}}}
+namespace svx{
+class SpellDialog;
+struct SpellErrorDescription;
+// ------------------------------------------------------------------
+class SentenceEditWindow_Impl : public MultiLineEdit/*, public SfxListener*/
+{
+ using MultiLineEdit::SetText;
+
+private:
+ USHORT m_nErrorStart;
+ USHORT m_nErrorEnd;
+ bool m_bIsUndoEditMode;
+
+ Link m_aModifyLink;
+
+ void CallModifyLink() {m_aModifyLink.Call(this);}
+
+ SpellDialog* GetSpellDialog() const {return (SpellDialog*)GetParent();}
+protected:
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+public:
+ SentenceEditWindow_Impl( SpellDialog* pParent, const ResId& rResId );
+ ~SentenceEditWindow_Impl();
+
+ void SetModifyHdl(const Link& rLink) { m_aModifyLink = rLink;}
+
+ void SetAttrib( const TextAttrib& rAttr, ULONG nPara, USHORT nStart, USHORT nEnd );
+ void SetText( const String& rStr );
+
+ bool MarkNextError();
+ void ChangeMarkedWord(const String& rNewWord, LanguageType eLanguage);
+ void MoveErrorMarkTo(USHORT nErrorStart, USHORT nErrorEnd, bool bGrammar);
+ String GetErrorText() const;
+ void RestoreCurrentError();
+
+ void SetAlternatives(
+ com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> );
+
+ const SpellErrorDescription* GetAlternatives();
+
+
+ void ResetModified() { GetTextEngine()->SetModified(FALSE); m_bIsUndoEditMode = false;}
+ BOOL IsModified() const { return GetTextEngine()->IsModified(); }
+
+ bool IsUndoEditMode() const { return m_bIsUndoEditMode;}
+ void SetUndoEditMode(bool bSet);
+
+ svx::SpellPortions CreateSpellPortions( bool bSetIgnoreFlag ) const;
+
+ void ResetUndo();
+ void Undo();
+ void AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg=FALSE );
+ USHORT GetUndoActionCount();
+ void UndoActionStart( USHORT nId );
+ void UndoActionEnd( USHORT nId );
+
+ void MoveErrorEnd(long nOffset);
+};
+
+
+// class SvxSpellDialog ---------------------------------------------
+class SpellDialogChildWindow;
+class ExplainButton : public PushButton
+{
+ String m_sExplanation;
+
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void Click();
+public:
+ ExplainButton( Window* pParent, const ResId& rResId ) : PushButton( pParent, rResId ){}
+ ~ExplainButton();
+ void SetExplanation( const String& rText ) {m_sExplanation = rText;}
+ bool HasExplanation() { return m_sExplanation.Len() > 0;}
+
+};
+
+class SpellDialog : public SfxModelessDialog
+{
+ using Window::Invalidate;
+
+ friend class SentenceEditWindow_Impl;
+private:
+
+ FixedImage aVendorImageFI;
+
+ FixedText aLanguageFT;
+ SvxLanguageBox aLanguageLB;
+
+ FixedText aNotInDictFT;
+ SentenceEditWindow_Impl aSentenceED;
+
+ FixedText aSuggestionFT;
+ ListBox aSuggestionLB;
+
+ PushButton aIgnorePB;
+ PushButton aIgnoreAllPB;
+ PushButton aIgnoreRulePB;
+ MenuButton aAddToDictMB;
+
+ PushButton aChangePB;
+ PushButton aChangeAllPB;
+ ExplainButton aExplainPB;
+ PushButton aAutoCorrPB;
+
+ CheckBox aCheckGrammarCB;
+
+ HelpButton aHelpPB;
+ PushButton aOptionsPB;
+ PushButton aUndoPB;
+ PushButton aClosePB;
+
+ GroupBox aBackgroundGB;
+
+ Image aVendorImage;
+ Image aVendorImageHC;
+
+ String aResumeST;
+ String aIgnoreOnceST;
+ String aNoSuggestionsST;
+
+ const String m_sTitleSpelling;
+ const String m_sTitleSpellingGrammar;
+ const String m_sTitleSpellingGrammarVendor;
+
+ Size aOldWordEDSize;
+ Link aDialogUndoLink;
+
+ bool bModified;
+ bool bFocusLocked;
+
+ svx::SpellDialogChildWindow& rParent;
+ svx::SpellPortions m_aSavedSentence;
+
+ SpellDialog_Impl* pImpl;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
+ LanguageType nOldLang;
+
+ DECL_LINK( ChangeHdl, Button * );
+ DECL_LINK( ChangeAllHdl, Button * );
+ DECL_LINK( IgnoreAllHdl, Button * );
+ DECL_LINK( IgnoreHdl, Button * );
+ DECL_LINK( CheckGrammarHdl, CheckBox* );
+ DECL_LINK( ExtClickHdl, Button * );
+ DECL_LINK( CancelHdl, Button * );
+ DECL_LINK( ModifyHdl, SentenceEditWindow_Impl *);
+ DECL_LINK( UndoHdl, Button * );
+ DECL_LINK( AddToDictionaryHdl, MenuButton* );
+ DECL_LINK( LanguageSelectHdl, SvxLanguageBox* );
+ DECL_LINK( DialogUndoHdl, SpellUndoAction_Impl* );
+
+ DECL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog * );
+
+ void StartSpellOptDlg_Impl();
+ void InitUserDicts();
+ void UpdateBoxes_Impl();
+ void Init_Impl();
+ void SpellContinue_Impl(bool UseSavedSentence = false);
+ void LockFocusChanges( bool bLock ) {bFocusLocked = bLock;}
+ void Impl_Restore();
+
+ void SetSelectedLang_Impl( LanguageType nLang );
+ LanguageType GetSelectedLang_Impl() const;
+
+ /** Retrieves the next sentence.
+ */
+ bool GetNextSentence_Impl(bool bUseSavedSentence);
+ /** Corrects all errors that have been selected to be changed always
+ */
+ bool ApplyChangeAllList_Impl(SpellPortions& rSentence, bool& bHasReplaced);
+ void SetTitle_Impl(LanguageType nLang);
+
+protected:
+ virtual void Paint( const Rectangle& rRect );
+ virtual long Notify( NotifyEvent& rNEvt );
+
+public:
+ SpellDialog(
+ svx::SpellDialogChildWindow* pChildWindow,
+ Window * pParent,
+ SfxBindings* pBindings);
+ ~SpellDialog();
+
+ void SetLanguage( sal_uInt16 nLang );
+ virtual sal_Bool Close();
+
+ void InvalidateDialog();
+};
+} //namespace svx
+
+#endif
+
diff --git a/cui/source/inc/acccfg.hxx b/cui/source/inc/acccfg.hxx
new file mode 100644
index 000000000000..40ce17a36b8c
--- /dev/null
+++ b/cui/source/inc/acccfg.hxx
@@ -0,0 +1,288 @@
+/*************************************************************************
+ *
+ * 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: acccfg.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ACCCFG_HXX
+#define _ACCCFG_HXX
+
+// #include *****************************************************************
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/ui/XUIConfigurationManager.hpp>
+#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
+#include <com/sun/star/script/browse/XBrowseNode.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <algorithm>
+
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+#include <svtools/svtabbx.hxx>
+#include <svtools/svtreebx.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <sfx2/basedlgs.hxx>
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+
+#include <sfx2/minarray.hxx>
+
+#include "cfgutil.hxx"
+
+// class SfxAcceleratorConfigListBox *************************************************
+
+#define css ::com::sun::star
+
+class SfxMacroInfoItem;
+class SfxConfigGroupListBox_Impl;
+class SfxConfigFunctionListBox_Impl;
+class SfxAcceleratorConfigPage;
+
+class SfxAccCfgTabListBox_Impl : public SvTabListBox
+{
+ SfxAcceleratorConfigPage* m_pAccelConfigPage;
+
+ void KeyInput( const KeyEvent &rKEvt );
+
+protected:
+ virtual void InitEntry( SvLBoxEntry*, const XubString&, const Image&, const Image&, SvLBoxButtonKind eButtonKind );
+
+public:
+ SfxAccCfgTabListBox_Impl(
+ SfxAcceleratorConfigPage* pAccelConfigPage,
+ Window *pParent,
+ const ResId &rResId ) :
+ SvTabListBox( pParent, rResId ),
+ m_pAccelConfigPage( pAccelConfigPage )
+ {}
+
+ void ReplaceEntry( USHORT nPos, const String &rStr );
+};
+
+// class SfxAcceleratorConfigPage ----------------------------------------
+
+struct TAccInfo
+{
+ public:
+
+ TAccInfo( sal_Int32 nKeyPos ,
+ sal_Int32 nListPos,
+ const KeyCode& aKey )
+ : m_nKeyPos (nKeyPos )
+ , m_nListPos (nListPos )
+ , m_bIsConfigurable(sal_True )
+ , m_sCommand ( )
+ , m_aKey (aKey )
+ // its important to set TRUE as default -
+ // because only fix entries will be disabled later ...
+ {}
+
+ sal_Bool isConfigured() const
+ {
+ return (m_nKeyPos>-1 && m_nListPos>-1 && m_sCommand.getLength());
+ }
+
+ sal_Int32 m_nKeyPos;
+ sal_Int32 m_nListPos;
+ sal_Bool m_bIsConfigurable;
+ ::rtl::OUString m_sCommand;
+ KeyCode m_aKey;
+};
+
+namespace sfx2
+{
+ class FileDialogHelper;
+}
+
+class SfxAcceleratorConfigPage : public SfxTabPage
+{
+ friend class SfxAccCfgTabListBox_Impl;
+private:
+ const SfxMacroInfoItem* m_pMacroInfoItem;
+ const SfxStringItem* m_pStringItem;
+ const SfxStringItem* m_pFontItem;
+ sfx2::FileDialogHelper* m_pFileDlg;
+
+ SfxAccCfgTabListBox_Impl aEntriesBox;
+ FixedLine aKeyboardGroup;
+ RadioButton aOfficeButton;
+ RadioButton aModuleButton;
+ PushButton aChangeButton;
+ PushButton aRemoveButton;
+ FixedText aGroupText;
+ SfxConfigGroupListBox_Impl* pGroupLBox;
+ FixedText aFunctionText;
+ SfxConfigFunctionListBox_Impl* pFunctionBox;
+ FixedText aKeyText;
+ SvTreeListBox aKeyBox;
+ FixedLine aFunctionsGroup;
+ PushButton aLoadButton;
+ PushButton aSaveButton;
+ PushButton aResetButton;
+ String aLoadAccelConfigStr;
+ String aSaveAccelConfigStr;
+ String aFilterAllStr;
+ String aFilterCfgStr;
+ SfxStylesInfo_Impl m_aStylesInfo;
+ sal_Bool m_bStylesInfoInitialized;
+
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobal;
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModule;
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAct;
+ css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription;
+ css::uno::Reference< css::frame::XFrame > m_xFrame;
+
+ ::rtl::OUString m_sModuleLongName;
+ ::rtl::OUString m_sModuleShortName;
+ ::rtl::OUString m_sModuleUIName;
+
+ DECL_LINK( ChangeHdl, Button * );
+ DECL_LINK( RemoveHdl, Button * );
+ DECL_LINK( SelectHdl, Control * );
+ DECL_LINK( Save, Button * );
+ DECL_LINK( Load, Button * );
+ DECL_LINK( Default, PushButton * );
+ DECL_LINK( RadioHdl, RadioButton* );
+
+ DECL_LINK( LoadHdl, sfx2::FileDialogHelper* );
+ DECL_LINK( SaveHdl, sfx2::FileDialogHelper* );
+
+ String GetLabel4Command(const String& sCommand);
+ void InitAccCfg();
+ KeyCode MapPosToKeyCode( USHORT nPos ) const;
+ USHORT MapKeyCodeToPos( const KeyCode &rCode ) const;
+ String GetFunctionName( KeyFuncType eType ) const;
+ css::uno::Reference< css::frame::XModel > SearchForAlreadyLoadedDoc(const String& sName);
+ void StartFileDialog( WinBits nBits, const String& rTitle );
+
+ void Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr);
+ void ResetConfig();
+
+ void CreateCustomItems( SvLBoxEntry* pEntry, const String& aCol1, const String& aCol2 );
+
+public:
+ SfxAcceleratorConfigPage( Window *pParent, const SfxItemSet& rItemSet );
+ virtual ~SfxAcceleratorConfigPage();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+
+ void SelectMacro(const SfxMacroInfoItem*);
+ void Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr);
+ void CopySource2Target(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xSourceAccMgr,
+ const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xTargetAccMgr);
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+};
+
+
+class SfxAcceleratorConfigListBox : public ListBox
+{
+ void KeyInput( const KeyEvent &rKEvt );
+
+public:
+
+ SfxAcceleratorConfigListBox( Window *pParent, ResId &rResId ) :
+ ListBox( pParent, rResId ) {}
+
+ void ReplaceEntry( USHORT nPos, const String &rStr );
+ void ExpandEntry ( USHORT nPos, const String &rStr );
+};
+
+/*
+// class USHORTArr **********************************************************
+
+DECL_2BYTEARRAY(USHORTArr, USHORT, 10, 10)
+
+// class SfxAcceleratorConfigDialog **************************************************
+
+class SfxAcceleratorConfigDialog : public ModalDialog
+{
+ OKButton aOKButton;
+ CancelButton aCancelButton;
+ PushButton aChangeButton;
+ PushButton aRemoveButton;
+ SfxAcceleratorConfigListBox aEntriesBox;
+ FixedText aDescriptionTextText;
+ FixedText aDescriptionInfoText;
+ FixedLine aKeyboardGroup;
+ FixedText aGroupText;
+ ListBox aGroupLBox;
+ FixedText aFunctionText;
+ ListBox aFunctionBox;
+ FixedText aKeyText;
+ ListBox aKeyBox;
+ FixedLine aFunctionsGroup;
+
+ USHORTArr aAccelArr;
+ USHORTArr aFunctionArr;
+ USHORTArr aKeyArr;
+
+ void OKHdl ( Button * );
+ void ChangeHdl( Button * );
+ void RemoveHdl( Button * );
+ void SelectHdl( ListBox *pListBox );
+
+ KeyCode PosToKeyCode ( USHORT nPos ) const;
+ USHORT KeyCodeToPos ( const KeyCode &rCode ) const;
+ String GetFunctionName( KeyFuncType eType ) const;
+
+public:
+
+ SfxAcceleratorConfigDialog( Window *pParent );
+};
+*/
+
+class SvxShortcutAssignDlg : public SfxSingleTabDialog
+{
+public:
+ SvxShortcutAssignDlg(
+ Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame,
+ const SfxItemSet& rSet );
+ virtual ~SvxShortcutAssignDlg();
+};
+
+
+
+#undef css
+
+#endif
+
diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx
new file mode 100644
index 000000000000..a7299c1b4915
--- /dev/null
+++ b/cui/source/inc/align.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * 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: align.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_ALIGN_HXX
+#define _SVX_ALIGN_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/field.hxx>
+#include <vcl/imagebtn.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svtools/valueset.hxx>
+#include <svx/dialcontrol.hxx>
+#include <svx/wrapfield.hxx>
+#include <svx/orienthelper.hxx>
+#include <svx/frmdirlbox.hxx>
+
+namespace svx {
+
+// ============================================================================
+
+class AlignmentTabPage : public SfxTabPage
+{
+ using TabPage::DeactivatePage;
+
+public:
+ virtual ~AlignmentTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ static USHORT* GetRanges();
+
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ explicit AlignmentTabPage( Window* pParent, const SfxItemSet& rCoreSet );
+
+ void InitVsRefEgde();
+ void UpdateEnableControls();
+
+ DECL_LINK( UpdateEnableHdl, void* );
+
+private:
+ FixedLine maFlAlignment;
+ FixedText maFtHorAlign;
+ ListBox maLbHorAlign;
+ FixedText maFtIndent;
+ MetricField maEdIndent;
+ FixedText maFtVerAlign;
+ ListBox maLbVerAlign;
+
+ FixedLine maFlOrient;
+ DialControl maCtrlDial;
+ FixedText maFtRotate;
+ WrapField maNfRotate;
+ FixedText maFtRefEdge;
+ ValueSet maVsRefEdge;
+ TriStateBox maCbStacked;
+ TriStateBox maCbAsianMode;
+ OrientationHelper maOrientHlp;
+
+ FixedLine maFlProperties;
+ TriStateBox maBtnWrap;
+ TriStateBox maBtnHyphen;
+ TriStateBox maBtnShrink;
+ FixedText maFtFrameDir;
+ FrameDirListBox maLbFrameDir;
+};
+
+// ============================================================================
+
+} // namespace svx
+
+#endif
+
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
new file mode 100644
index 000000000000..dba6ce826cc3
--- /dev/null
+++ b/cui/source/inc/autocdlg.hxx
@@ -0,0 +1,508 @@
+/*************************************************************************
+ *
+ * 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: autocdlg.hxx,v $
+ * $Revision: 1.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.
+ *
+ ************************************************************************/
+#ifndef _OFA_AUTOCDLG_HXX
+#define _OFA_AUTOCDLG_HXX
+
+#include <svtools/langtab.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <tools/table.hxx>
+#include <svx/checklbx.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/metric.hxx>
+#include <svx/langbox.hxx>
+
+class SvxAutoCorrect;
+class CharClass;
+class CollatorWrapper;
+class SmartTagMgr;
+
+// class OfaAutoCorrDlg --------------------------------------------------
+
+class OfaAutoCorrDlg : public SfxTabDialog
+{
+ FixedText aLanguageFT;
+ SvxLanguageBox aLanguageLB;
+
+ DECL_LINK(SelectLanguageHdl, ListBox*);
+public:
+
+ OfaAutoCorrDlg(Window* pParent, const SfxItemSet *pSet );
+
+ void EnableLanguage(BOOL bEnable)
+ { aLanguageFT.Enable(bEnable);
+ aLanguageLB.Enable(bEnable);}
+
+};
+
+#ifdef _OFA_AUTOCDLG_CXX
+#include <vcl/group.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#include <svtools/svtabbx.hxx>
+#include <svx/simptabl.hxx>
+
+class SvStringsISortDtor;
+
+// class OfaACorrCheckListBox ------------------------------------------
+
+class OfaACorrCheckListBox : public SvxSimpleTable
+{
+ using SvxSimpleTable::SetTabs;
+ using SvTreeListBox::GetCheckButtonState;
+ using SvTreeListBox::SetCheckButtonState;
+
+ protected:
+ virtual void SetTabs();
+ virtual void HBarClick();
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ public:
+ OfaACorrCheckListBox(Window* pParent, const ResId& rResId ) :
+ SvxSimpleTable( pParent, rResId ){}
+
+ inline void *GetUserData(ULONG nPos) { return GetEntry(nPos)->GetUserData(); }
+ inline void SetUserData(ULONG nPos, void *pData ) { GetEntry(nPos)->SetUserData(pData); }
+ inline ULONG GetSelectEntryPos() { return GetModel()->GetAbsPos(FirstSelected()); }
+
+ BOOL IsChecked(ULONG nPos, USHORT nCol = 0);
+ void CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked);
+ SvButtonState GetCheckButtonState( SvLBoxEntry*, USHORT nCol ) const;
+ void SetCheckButtonState( SvLBoxEntry*, USHORT nCol, SvButtonState );
+};
+
+// class OfaAutocorrOptionsPage ------------------------------------------
+
+
+class OfaAutocorrOptionsPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+
+private:
+ SvxCheckListBox aCheckLB;
+
+ String sInput;
+ String sDoubleCaps;
+ String sStartCap;
+ String sBoldUnderline;
+ String sURL;
+ String sNoDblSpaces;
+ String sHalf;
+ String sDash;
+ String sFirst;
+
+public:
+ OfaAutocorrOptionsPage( Window* pParent, const SfxItemSet& rSet );
+ ~OfaAutocorrOptionsPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void ActivatePage( const SfxItemSet& );
+
+};
+
+// class OfaSwAutoFmtOptionsPage ----------------------------------------------------
+
+class OfaSwAutoFmtOptionsPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+
+ OfaACorrCheckListBox aCheckLB;
+ PushButton aEditPB;
+ FixedText aHeader1Expl;
+ FixedText aHeader2Expl;
+
+ String sHeader1;
+ String sHeader2;
+
+ String sDeleteEmptyPara;
+ String sUseReplaceTbl;
+ String sCptlSttWord;
+ String sCptlSttSent;
+ String sTypo;
+ String sUserStyle;
+ String sBullet;
+ String sByInputBullet;
+ String sBoldUnder;
+ String sNoDblSpaces;
+ String sFraction;
+ String sDetectURL;
+ String sDash;
+ String sOrdinal;
+ String sRightMargin;
+ String sNum;
+ String sBorder;
+ String sTable;
+ String sReplaceTemplates;
+ String sDelSpaceAtSttEnd;
+ String sDelSpaceBetweenLines;
+
+ String sMargin;
+ String sBulletChar;
+ String sByInputBulletChar;
+
+ Font aBulletFont;
+ Font aByInputBulletFont;
+ USHORT nPercent;
+
+ SvLBoxButtonData* pCheckButtonData;
+
+ DECL_LINK(SelectHdl, OfaACorrCheckListBox*);
+ DECL_LINK(EditHdl, PushButton*);
+ SvLBoxEntry* CreateEntry(String& rTxt, USHORT nCol);
+
+
+ OfaSwAutoFmtOptionsPage( Window* pParent,
+ const SfxItemSet& rSet );
+ ~OfaSwAutoFmtOptionsPage();
+
+ public:
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void ActivatePage( const SfxItemSet& );
+};
+
+// class AutoCorrEdit ----------------------------------------------------
+
+class AutoCorrEdit : public Edit
+{
+ Link aActionLink;
+ BOOL bSpaces;
+
+ public:
+ AutoCorrEdit(Window* pParent, const ResId& rResId) :
+ Edit(pParent, rResId), bSpaces(FALSE){}
+
+ void SetActionHdl( const Link& rLink )
+ { aActionLink = rLink;}
+
+ void SetSpaces(BOOL bSet)
+ {bSpaces = bSet;}
+
+ virtual void KeyInput( const KeyEvent& rKEvent );
+};
+
+// class OfaAutocorrReplacePage ------------------------------------------
+
+class DoubleStringArray;
+typedef DoubleStringArray* DoubleStringArrayPtr;
+DECLARE_TABLE(DoubleStringTable, DoubleStringArrayPtr)
+
+class OfaAutocorrReplacePage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ CheckBox aTextOnlyCB;
+ FixedText aShortFT;
+ AutoCorrEdit aShortED;
+ FixedText aReplaceFT;
+ AutoCorrEdit aReplaceED;
+ SvTabListBox aReplaceTLB;
+ PushButton aNewReplacePB;
+ PushButton aDeleteReplacePB;
+
+ String sModify;
+ String sNew;
+
+ SvStringsISortDtor* pFormatText;
+ DoubleStringTable aDoubleStringTable;
+ CollatorWrapper* pCompareClass;
+ CollatorWrapper* pCompareCaseClass;
+ CharClass* pCharClass;
+ LanguageType eLang;
+
+ BOOL bHasSelectionText;
+ BOOL bFirstSelect:1;
+ BOOL bReplaceEditChanged:1;
+ BOOL bSWriter:1;
+
+ DECL_LINK(SelectHdl, SvTabListBox*);
+ DECL_LINK(NewDelHdl, PushButton*);
+ DECL_LINK(ModifyHdl, Edit*);
+
+ void RefillReplaceBox(BOOL bFromReset, //Box mit neuer Sprache fuellen
+ LanguageType eOldLanguage,
+ LanguageType eNewLanguage);
+
+public:
+ OfaAutocorrReplacePage( Window* pParent, const SfxItemSet& rSet );
+ ~OfaAutocorrReplacePage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void ActivatePage( const SfxItemSet& );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+ void SetLanguage(LanguageType eSet);
+};
+
+// class OfaAutocorrExceptPage ---------------------------------------------
+
+struct StringsArrays;
+typedef StringsArrays* StringsArraysPtr;
+DECLARE_TABLE(StringsTable, StringsArraysPtr)
+
+class OfaAutocorrExceptPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ FixedLine aAbbrevFL;
+ AutoCorrEdit aAbbrevED;
+ ListBox aAbbrevLB;
+ PushButton aNewAbbrevPB;
+ PushButton aDelAbbrevPB;
+ CheckBox aAutoAbbrevCB;
+
+ FixedLine aDoubleCapsFL;
+ AutoCorrEdit aDoubleCapsED;
+ ListBox aDoubleCapsLB;
+ PushButton aNewDoublePB;
+ PushButton aDelDoublePB;
+ CheckBox aAutoCapsCB;
+
+ StringsTable aStringsTable;
+ CollatorWrapper* pCompareClass;
+ LanguageType eLang;
+
+ DECL_LINK(NewDelHdl, PushButton*);
+ DECL_LINK(SelectHdl, ListBox*);
+ DECL_LINK(ModifyHdl, Edit*);
+
+ void RefillReplaceBoxes(BOOL bFromReset, //Box mit neuer Sprache fuellen
+ LanguageType eOldLanguage,
+ LanguageType eNewLanguage);
+public:
+ OfaAutocorrExceptPage( Window* pParent, const SfxItemSet& rSet );
+ ~OfaAutocorrExceptPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void ActivatePage( const SfxItemSet& );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+ void SetLanguage(LanguageType eSet);
+
+};
+
+// class OfaQuoteTabPage -------------------------------------------------
+
+class OfaQuoteTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+
+private:
+
+ FixedLine aSingleFL;
+ CheckBox aSingleTypoCB;
+ FixedText aSglStartQuoteFT;
+ PushButton aSglStartQuotePB;
+ FixedText aSglStartExFT;
+ FixedText aSglEndQuoteFT;
+ PushButton aSglEndQuotePB;
+ FixedText aSglEndExFT;
+ PushButton aSglStandardPB;
+
+ FixedLine aDoubleFL;
+ CheckBox aTypoCB;
+ FixedText aStartQuoteFT;
+ PushButton aStartQuotePB;
+ FixedText aDblStartExFT;
+ FixedText aEndQuoteFT;
+ PushButton aEndQuotePB;
+ FixedText aDblEndExFT;
+ PushButton aDblStandardPB;
+
+ String sStartQuoteDlg;
+ String sEndQuoteDlg;
+
+ String sStandard;
+
+
+ sal_UCS4 cSglStartQuote;
+ sal_UCS4 cSglEndQuote;
+
+ sal_UCS4 cStartQuote;
+ sal_UCS4 cEndQuote;
+
+ DECL_LINK( QuoteHdl, PushButton* );
+ DECL_LINK( StdQuoteHdl, PushButton* );
+
+ String ChangeStringExt_Impl( sal_UCS4 );
+
+ OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet );
+public:
+ ~OfaQuoteTabPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void ActivatePage( const SfxItemSet& );
+};
+
+// class OfaAutoCompleteTabPage ---------------------------------------------
+
+class OfaAutoCompleteTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+
+ class AutoCompleteMultiListBox : public MultiListBox
+ {
+ OfaAutoCompleteTabPage& rPage;
+ public:
+ AutoCompleteMultiListBox( OfaAutoCompleteTabPage& rPg,
+ const ResId& rResId )
+ : MultiListBox( &rPg, rResId ), rPage( rPg ) {}
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ };
+
+ CheckBox aCBActiv; //Enable word completion
+ CheckBox aCBAppendSpace;//Append space
+ CheckBox aCBAsTip; //Show as tip
+
+ CheckBox aCBCollect;//Collect words
+ CheckBox aCBRemoveList;//...save the list for later use...
+ //--removed--CheckBox aCBEndless;//
+
+ FixedText aFTExpandKey;
+ ListBox aDCBExpandKey;
+ FixedText aFTMinWordlen;
+ NumericField aNFMinWordlen;
+ FixedText aFTMaxEntries;
+ NumericField aNFMaxEntries;
+ AutoCompleteMultiListBox aLBEntries;
+ PushButton aPBEntries;
+ SvStringsISortDtor* pAutoCmpltList;
+ USHORT nAutoCmpltListCnt;
+
+ DECL_LINK( CheckHdl, CheckBox* );
+
+ OfaAutoCompleteTabPage( Window* pParent,
+ const SfxItemSet& rSet );
+public:
+ virtual ~OfaAutoCompleteTabPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void ActivatePage( const SfxItemSet& );
+
+ void CopyToClipboard() const;
+ DECL_LINK( DeleteHdl, PushButton* );
+};
+
+// class OfaSmartTagOptionsTabPage ---------------------------------------------
+
+/** Smart tag options tab page
+
+ This tab page is used to enable/disable smart tag types
+*/
+class OfaSmartTagOptionsTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+
+private:
+
+ // controls
+ CheckBox m_aMainCB;
+ SvxCheckListBox m_aSmartTagTypesLB;
+ PushButton m_aPropertiesPB;
+ FixedText m_aTitleFT;
+
+ // construction via Create()
+ OfaSmartTagOptionsTabPage( Window* pParent, const SfxItemSet& rSet );
+
+ /** Inserts items into m_aSmartTagTypesLB
+
+ Reads out the smart tag types supported by the SmartTagMgr and
+ inserts the associated strings into the list box.
+ */
+ void FillListBox( const SmartTagMgr& rSmartTagMgr );
+
+ /** Clears the m_aSmartTagTypesLB
+ */
+ void ClearListBox();
+
+ /** Handler for the check box
+
+ Enables/disables all controls in the tab page (except from the
+ check box.
+ */
+ DECL_LINK( CheckHdl, CheckBox* );
+
+ /** Handler for the push button
+
+ Calls the displayPropertyPage function of the smart tag recognizer
+ associated with the currently selected smart tag type.
+ */
+ DECL_LINK( ClickHdl, PushButton* );
+
+ /** Handler for the list box
+
+ Enables/disables the properties push button if selection in the
+ smart tag types list box changes.
+ */
+ DECL_LINK( SelectHdl, SvxCheckListBox* );
+
+public:
+
+ virtual ~OfaSmartTagOptionsTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void ActivatePage( const SfxItemSet& );
+};
+
+#endif // _OFA_AUTOCDLG_CXX
+
+#endif //
+
diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx
new file mode 100644
index 000000000000..e658c2ce0eb0
--- /dev/null
+++ b/cui/source/inc/backgrnd.hxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * 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: backgrnd.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_BACKGRND_HXX
+#define _SVX_BACKGRND_HXX
+
+// include ---------------------------------------------------------------
+
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+#ifndef _GRAPH_HXX //autogen
+#include <vcl/graph.hxx>
+#endif
+#include <svtools/valueset.hxx>
+#include <svx/dlgctrl.hxx>
+
+// class SvxBackgroundTabPage --------------------------------------------
+/*
+{k:\svx\prototyp\dialog\backgrnd.bmp}
+ [Beschreibung]
+ Mit dieser TabPage kann eine Brush (z.B. fuer die Hintergrundfarbe eines
+ Rahmens) eingestellt werden.
+ [Items]
+ <SvxBrushItem>: <SID_ATTR_BRUSH>;
+*/
+
+//------------------------------------------------------------------------
+// forwards:
+
+class BackgroundPreviewImpl;
+class SvxOpenGraphicDialog;
+struct SvxBackgroundTable_Impl;
+struct SvxBackgroundPara_Impl;
+struct SvxBackgroundPage_Impl;
+class SvxBrushItem;
+//------------------------------------------------------------------------
+
+class SvxBackgroundTabPage : public SvxTabPage
+{
+ using TabPage::DeactivatePage;
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void FillUserData();
+ virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
+
+ void ShowSelector(); // Umschalt-ListBox aktivieren
+ void ShowTblControl(); // fuer den Writer (Zellen/Zeilen/Tabelle)
+ void ShowParaControl(BOOL bCharOnly = FALSE); // fuer den Writer (Absatz/Zeichen)
+ void EnableTransparency(BOOL bColor, BOOL bGraphic);
+ virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001
+protected:
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+private:
+ SvxBackgroundTabPage( Window* pParent, const SfxItemSet& rCoreSet );
+ ~SvxBackgroundTabPage();
+
+ // Hintergrundfarbe ------------------------------------
+ Control aBorderWin;
+ ValueSet aBackgroundColorSet;
+ FixedLine aBackgroundColorBox;
+ BackgroundPreviewImpl* pPreviewWin1;
+ //color transparency
+ FixedText aColTransFT;
+ MetricField aColTransMF;
+ // Hintergrund-Bitmap ----------------------------------
+ PushButton aBtnBrowse;
+ CheckBox aBtnLink;
+ CheckBox aBtnPreview;
+ FixedInfo aFtFile;
+ FixedLine aGbFile;
+ RadioButton aBtnPosition;
+ RadioButton aBtnArea;
+ RadioButton aBtnTile;
+ SvxRectCtl aWndPosition;
+ FixedLine aGbPosition;
+ //transparency of graphics
+ FixedLine aGraphTransFL;
+ MetricField aGraphTransMF;
+
+ BackgroundPreviewImpl* pPreviewWin2;
+ // Selektor --------------------------------------------
+ FixedText aSelectTxt;
+ ListBox aLbSelect;
+ const String aStrBrowse;
+ const String aStrUnlinked;
+
+ // DDListBox fuer Writer -------------------------------
+
+ FixedText aTblDesc;
+ ListBox aTblLBox;
+ ListBox aParaLBox;
+
+ //------------------------------------------------------
+ Color aBgdColor;
+ USHORT nHtmlMode;
+ BOOL bAllowShowSelector : 1;
+ BOOL bIsGraphicValid : 1;
+ BOOL bLinkOnly : 1;
+ BOOL bResized : 1;
+ BOOL bColTransparency : 1;
+ BOOL bGraphTransparency : 1;
+ Graphic aBgdGraphic;
+ String aBgdGraphicPath;
+ String aBgdGraphicFilter;
+
+ SvxBackgroundPage_Impl* pPageImpl;
+ SvxOpenGraphicDialog* pImportDlg;
+
+ // Items fuer Sw-Tabelle muessen gesammelt werden
+ SvxBackgroundTable_Impl* pTableBck_Impl;
+ // auch fuer die Absatzvorlage
+ SvxBackgroundPara_Impl* pParaBck_Impl;
+
+#ifdef _SVX_BACKGRND_CXX
+ void FillColorValueSets_Impl();
+ void ShowColorUI_Impl();
+ void ShowBitmapUI_Impl();
+ BOOL LoadLinkedGraphic_Impl();
+ void RaiseLoadError_Impl();
+ void SetGraphicPosition_Impl( SvxGraphicPosition ePos );
+ SvxGraphicPosition GetGraphicPosition_Impl();
+ void FillControls_Impl(const SvxBrushItem& rBgdAttr,
+ const String& rUserData);
+ BOOL FillItemSetWithWallpaperItem( SfxItemSet& rCoreSet, USHORT nSlot);
+ void ResetFromWallpaperItem( const SfxItemSet& rSet );
+
+ DECL_LINK( LoadTimerHdl_Impl, Timer* );
+ DECL_LINK( SelectHdl_Impl, ListBox* );
+ DECL_LINK( BrowseHdl_Impl, PushButton* );
+ DECL_LINK( RadioClickHdl_Impl, RadioButton* );
+ DECL_LINK( FileClickHdl_Impl, CheckBox* );
+ DECL_LINK( BackgroundColorHdl_Impl, ValueSet* );
+ DECL_LINK( TblDestinationHdl_Impl, ListBox* );
+ DECL_LINK( ParaDestinationHdl_Impl, ListBox* );
+#endif
+};
+
+#endif // #ifndef _SVX_BACKGRND_HXX
+
+
diff --git a/cui/source/inc/bbdlg.hxx b/cui/source/inc/bbdlg.hxx
new file mode 100644
index 000000000000..f2d7e25e9bf9
--- /dev/null
+++ b/cui/source/inc/bbdlg.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: bbdlg.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_BBDLG_HXX
+#define _SVX_BBDLG_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/tabdlg.hxx>
+
+/*--------------------------------------------------------------------
+ Beschreibung: Border Background Pages buendeln
+ --------------------------------------------------------------------*/
+
+class SvxBorderBackgroundDlg: public SfxTabDialog
+{
+public:
+ SvxBorderBackgroundDlg( Window *pParent,
+ const SfxItemSet& rCoreSet,
+ BOOL bEnableSelector = FALSE );
+
+ ~SvxBorderBackgroundDlg();
+
+protected:
+ virtual void PageCreated( USHORT nPageId, SfxTabPage& rTabPage );
+
+private:
+ BOOL bEnableBackgroundSelector; // fuer Border/Background-Dlg
+};
+
+
+#endif
+
diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
new file mode 100644
index 000000000000..ac7f9245fd49
--- /dev/null
+++ b/cui/source/inc/border.hxx
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * 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: border.hxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_BORDER_HXX
+#define _SVX_BORDER_HXX
+
+// include ---------------------------------------------------------------
+
+
+#include <svtools/ctrlbox.hxx>
+#include <vcl/group.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <svtools/valueset.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/frmsel.hxx>
+
+// forward ---------------------------------------------------------------
+
+class SvxBorderLine;
+class XColorTable;
+
+#include <svx/flagsdef.hxx>
+
+class SvxBorderTabPage : public SfxTabPage
+{
+ using TabPage::DeactivatePage;
+
+public:
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& rCoreAttrs );
+ virtual void Reset( const SfxItemSet& );
+
+ void HideShadowControls();
+ virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001
+protected:
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ SvxBorderTabPage( Window* pParent, const SfxItemSet& rCoreAttrs );
+ ~SvxBorderTabPage();
+
+ // Controls
+ FixedLine aFlBorder;
+ FixedText aDefaultFT;
+ ValueSet aWndPresets;
+ FixedText aUserDefFT;
+ svx::FrameSelector aFrameSel;
+
+ FixedLine aFlSep1;
+ FixedLine aFlLine;
+ FixedText aStyleFT;
+ LineListBox aLbLineStyle;
+ FixedText aColorFT;
+ ColorListBox aLbLineColor;
+
+ FixedLine aFlSep2;
+ FixedLine aDistanceFL;
+ FixedText aLeftFT;
+ MetricField aLeftMF;
+ FixedText aRightFT;
+ MetricField aRightMF;
+ FixedText aTopFT;
+ MetricField aTopMF;
+ FixedText aBottomFT;
+ MetricField aBottomMF;
+ CheckBox aSynchronizeCB;
+
+ FixedLine aFlShadow;
+ FixedText aFtShadowPos;
+ ValueSet aWndShadows;
+ FixedText aFtShadowSize;
+ MetricField aEdShadowSize;
+ FixedText aFtShadowColor;
+ ColorListBox aLbShadowColor;
+
+ //properties - "Merge with next paragraph" in Writer
+ FixedLine aPropertiesFL;
+ CheckBox aMergeWithNextCB;
+ // --> collapsing table borders FME 2005-05-27 #i29550#
+ CheckBox aMergeAdjacentBordersCB;
+ // <--
+
+ ImageList aShadowImgLstH;
+ ImageList aShadowImgLst;
+ ImageList aBorderImgLstH;
+ ImageList aBorderImgLst;
+
+ long nMinValue; // minimum distance
+ int nSWMode; // table, textframe, paragraph
+
+ bool mbHorEnabled; /// true = Inner horizontal border enabled.
+ bool mbVerEnabled; /// true = Inner vertical border enabled.
+ bool mbTLBREnabled; /// true = Top-left to bottom-right border enabled.
+ bool mbBLTREnabled; /// true = Bottom-left to top-right border enabled.
+ bool mbUseMarginItem;
+
+ static BOOL bSync;
+
+#ifdef _SVX_BORDER_CXX
+ // Handler
+ DECL_LINK( SelStyleHdl_Impl, ListBox* pLb );
+ DECL_LINK( SelColHdl_Impl, ListBox* pLb );
+ DECL_LINK( SelPreHdl_Impl, void* );
+ DECL_LINK( SelSdwHdl_Impl, void* );
+ DECL_LINK( LinesChanged_Impl, void* );
+ DECL_LINK( ModifyDistanceHdl_Impl, MetricField*);
+ DECL_LINK( SyncHdl_Impl, CheckBox*);
+
+ USHORT GetPresetImageId( USHORT nValueSetIdx ) const;
+ USHORT GetPresetStringId( USHORT nValueSetIdx ) const;
+
+ void FillPresetVS();
+ void FillShadowVS();
+ void FillValueSets();
+
+ // Filler
+ void FillLineListBox_Impl();
+
+ // Setzen von einzelnen Frame-/Core-Linien
+ void ResetFrameLine_Impl( svx::FrameBorderType eBorder,
+ const SvxBorderLine* pCurLine,
+ bool bValid );
+#endif
+};
+
+
+#endif
+
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
new file mode 100644
index 000000000000..57dc9692f87c
--- /dev/null
+++ b/cui/source/inc/cfg.hxx
@@ -0,0 +1,836 @@
+/*************************************************************************
+ *
+ * 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: cfg.hxx,v $
+ * $Revision: 1.17 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVXCFG_HXX
+#define _SVXCFG_HXX
+
+#include <vcl/lstbox.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/menubtn.hxx>
+#include <vcl/toolbox.hxx>
+#include <svtools/svtreebx.hxx>
+#include <svtools/svmedit2.hxx>
+#include <svtools/svmedit.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/ui/XUIConfigurationListener.hpp>
+#include <com/sun/star/ui/XUIConfigurationManager.hpp>
+#include <com/sun/star/ui/XImageManager.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
+
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx> // SvUShorts
+#include <sfx2/minarray.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <vector>
+#include <vcl/msgbox.hxx>
+
+#include "selector.hxx"
+
+class SvxConfigEntry;
+class SvxConfigPage;
+class SvxMenuConfigPage;
+class SvxToolbarConfigPage;
+
+typedef std::vector< SvxConfigEntry* > SvxEntries;
+
+class SvxConfigDialog : public SfxTabDialog
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+
+public:
+ SvxConfigDialog( Window*, const SfxItemSet* );
+ ~SvxConfigDialog();
+
+ void ActivateTabPage( USHORT );
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+ virtual short Ok();
+
+ void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
+};
+
+class SaveInData : public ImageProvider
+{
+private:
+
+ bool bModified;
+
+ bool bDocConfig;
+ bool bReadOnly;
+
+ ::com::sun::star::uno::Reference
+ < com::sun::star::ui::XUIConfigurationManager > m_xCfgMgr;
+
+ ::com::sun::star::uno::Reference
+ < com::sun::star::ui::XUIConfigurationManager > m_xParentCfgMgr;
+
+ ::com::sun::star::uno::Reference
+ < com::sun::star::ui::XImageManager > m_xImgMgr;
+
+ ::com::sun::star::uno::Reference
+ < com::sun::star::ui::XImageManager > m_xParentImgMgr;
+
+ static ::com::sun::star::uno::Reference
+ < com::sun::star::ui::XImageManager >* xDefaultImgMgr;
+
+public:
+
+ SaveInData(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::ui::XUIConfigurationManager >& xCfgMgr,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::ui::XUIConfigurationManager >& xParentCfgMgr,
+ const rtl::OUString& aModuleId,
+ bool docConfig );
+
+ ~SaveInData() {}
+
+ bool PersistChanges(
+ const com::sun::star::uno::Reference
+ < com::sun::star::uno::XInterface >& xManager );
+
+ void SetModified( bool bValue = TRUE ) { bModified = bValue; }
+ bool IsModified( ) { return bModified; }
+
+ bool IsReadOnly( ) { return bReadOnly; }
+ bool IsDocConfig( ) { return bDocConfig; }
+
+ ::com::sun::star::uno::Reference
+ < ::com::sun::star::ui::XUIConfigurationManager >
+ GetConfigManager() { return m_xCfgMgr; };
+
+ ::com::sun::star::uno::Reference
+ < ::com::sun::star::ui::XUIConfigurationManager >
+ GetParentConfigManager() { return m_xParentCfgMgr; };
+
+ ::com::sun::star::uno::Reference
+ < ::com::sun::star::ui::XImageManager >
+ GetImageManager() { return m_xImgMgr; };
+
+ ::com::sun::star::uno::Reference
+ < ::com::sun::star::ui::XImageManager >
+ GetParentImageManager() { return m_xParentImgMgr; };
+
+ ::com::sun::star::uno::Reference
+ < com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+
+ ::com::sun::star::uno::Reference
+ < com::sun::star::container::XNameAccess > m_xCommandToLabelMap;
+
+ com::sun::star::uno::Reference
+ < com::sun::star::uno::XComponentContext > m_xComponentContext;
+
+ com::sun::star::uno::Sequence
+ < com::sun::star::beans::PropertyValue > m_aSeparatorSeq;
+
+ Image GetImage( const rtl::OUString& rCommandURL );
+
+ virtual bool HasURL( const rtl::OUString& aURL ) = 0;
+ virtual bool HasSettings() = 0;
+ virtual SvxEntries* GetEntries() = 0;
+ virtual void SetEntries( SvxEntries* ) = 0;
+ virtual void Reset() = 0;
+ virtual bool Apply() = 0;
+};
+
+class MenuSaveInData : public SaveInData
+{
+private:
+
+ rtl::OUString m_aMenuResourceURL;
+ rtl::OUString m_aDescriptorContainer;
+
+ ::com::sun::star::uno::Reference
+ < com::sun::star::container::XIndexAccess > m_xMenuSettings;
+
+ SvxConfigEntry* pRootEntry;
+
+ // static holder of the default menu data
+ static MenuSaveInData* pDefaultData;
+
+ static void SetDefaultData( MenuSaveInData* pData ) {pDefaultData = pData;}
+ static MenuSaveInData* GetDefaultData() { return pDefaultData; }
+
+ void Apply( bool bDefault );
+
+ void Apply(
+ SvxConfigEntry* pRootEntry,
+ com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexContainer >& rNewMenuBar,
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XSingleComponentFactory >& rFactory,
+ SvLBoxEntry *pParent = NULL );
+
+ void ApplyMenu(
+ com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexContainer >& rNewMenuBar,
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XSingleComponentFactory >& rFactory,
+ SvxConfigEntry *pMenuData = NULL );
+
+ bool LoadSubMenus(
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexAccess >& xMenuBarSettings,
+ const rtl::OUString& rBaseTitle, SvxConfigEntry* pParentData );
+
+public:
+
+ MenuSaveInData(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::ui::XUIConfigurationManager >&,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::ui::XUIConfigurationManager >&,
+ const rtl::OUString& aModuleId,
+ bool docConfig );
+
+ ~MenuSaveInData();
+
+ // methods inherited from SaveInData
+ SvxEntries* GetEntries();
+ void SetEntries( SvxEntries* );
+ bool HasURL( const rtl::OUString& URL ) { (void)URL; return FALSE; }
+ bool HasSettings() { return m_xMenuSettings.is(); }
+ void Reset();
+ bool Apply();
+};
+
+class SvxConfigEntry
+{
+private:
+
+ // common properties
+ USHORT nId;
+ ::rtl::OUString aHelpText;
+ ::rtl::OUString aLabel;
+ ::rtl::OUString aCommand;
+ ::rtl::OUString aHelpURL;
+
+ bool bPopUp;
+ bool bStrEdited;
+ bool bIsUserDefined;
+ bool bIsMain;
+ bool bIsDeletable;
+ bool bIsMovable;
+ bool bIsParentData;
+
+ // toolbar specific properties
+ bool bIsVisible;
+ sal_Int32 nStyle;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::graphic::XGraphic > xBackupGraphic;
+
+ SvxEntries *pEntries;
+
+public:
+
+ SvxConfigEntry(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameAccess >& rCommandToLabelMap );
+
+ SvxConfigEntry( const ::rtl::OUString& rDisplayName,
+ const ::rtl::OUString& rCommandURL,
+ bool bPopup = FALSE,
+ bool bParentData = FALSE );
+
+ SvxConfigEntry()
+ :
+ nId( 0 ),
+ bPopUp( FALSE ),
+ bStrEdited( FALSE ),
+ bIsUserDefined( FALSE ),
+ bIsMain( FALSE ),
+ bIsParentData( FALSE ),
+ bIsVisible( TRUE ),
+ nStyle( 0 ),
+ pEntries( 0 )
+ {}
+
+ ~SvxConfigEntry();
+
+ const ::rtl::OUString& GetCommand() const { return aCommand; }
+ void SetCommand( const String& rCmd ) { aCommand = rCmd; }
+
+ const ::rtl::OUString& GetName() const { return aLabel; }
+ void SetName( const String& rStr ) { aLabel = rStr; bStrEdited = TRUE; }
+ bool HasChangedName() const { return bStrEdited; }
+
+ const ::rtl::OUString& GetHelpText() ;
+ void SetHelpText( const String& rStr ) { aHelpText = rStr; }
+
+ const ::rtl::OUString& GetHelpURL() const { return aHelpURL; }
+ void SetHelpURL( const String& rStr ) { aHelpURL = rStr; }
+
+ void SetPopup( bool bOn = TRUE ) { bPopUp = bOn; }
+ bool IsPopup() const { return bPopUp; }
+
+ void SetUserDefined( bool bOn = TRUE ) { bIsUserDefined = bOn; }
+ bool IsUserDefined() const { return bIsUserDefined; }
+
+ bool IsBinding() const { return !bPopUp; }
+ bool IsSeparator() const { return nId == 0; }
+
+ SvxEntries* GetEntries() const { return pEntries; }
+ void SetEntries( SvxEntries* entries ) { pEntries = entries; }
+ bool HasEntries() const { return pEntries != NULL; }
+
+ void SetMain( bool bValue = TRUE ) { bIsMain = bValue; }
+ bool IsMain() { return bIsMain; }
+
+ void SetParentData( bool bValue = TRUE ) { bIsParentData = bValue; }
+ bool IsParentData() { return bIsParentData; }
+
+ bool IsMovable();
+ bool IsDeletable();
+ bool IsRenamable();
+
+ void SetVisible( bool b ) { bIsVisible = b; }
+ bool IsVisible() const { return bIsVisible; }
+
+ void SetBackupGraphic(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::graphic::XGraphic > graphic )
+ { xBackupGraphic = graphic; }
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::graphic::XGraphic >
+ GetBackupGraphic()
+ { return xBackupGraphic; }
+
+ bool IsIconModified() { return xBackupGraphic.is(); }
+
+ sal_Int32 GetStyle() { return nStyle; }
+ void SetStyle( sal_Int32 style ) { nStyle = style; }
+
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
+ GetProperties(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameAccess >& rCommandToLabelMap );
+};
+
+class SvxMenuEntriesListBox : public SvTreeListBox
+{
+private:
+ SvxConfigPage* pPage;
+
+protected:
+ bool m_bIsInternalDrag;
+
+public:
+ SvxMenuEntriesListBox( Window*, const ResId& );
+ ~SvxMenuEntriesListBox();
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+
+ virtual BOOL NotifyAcceptDrop( SvLBoxEntry* pEntry );
+
+ virtual BOOL NotifyMoving( SvLBoxEntry*, SvLBoxEntry*,
+ SvLBoxEntry*&, ULONG& );
+
+ virtual BOOL NotifyCopying( SvLBoxEntry*, SvLBoxEntry*,
+ SvLBoxEntry*&, ULONG&);
+
+ virtual DragDropMode NotifyStartDrag(
+ TransferDataContainer&, SvLBoxEntry* );
+
+ virtual void DragFinished( sal_Int8 );
+
+ void KeyInput( const KeyEvent& rKeyEvent );
+};
+
+class SvxDescriptionEdit : public ExtMultiLineEdit
+{
+private:
+ Rectangle m_aRealRect;
+
+public:
+ SvxDescriptionEdit( Window* pParent, const ResId& _rId );
+ inline ~SvxDescriptionEdit() {}
+
+ void SetNewText( const String& _rText );
+ inline void Clear() { SetNewText( String() ); }
+};
+
+class SvxConfigPage : public SfxTabPage
+{
+private:
+
+ bool bInitialised;
+ SaveInData* pCurrentSaveInData;
+
+ DECL_LINK( SelectSaveInLocation, ListBox * );
+ DECL_LINK( AsyncInfoMsg, String* );
+
+ bool SwapEntryData( SvLBoxEntry* pSourceEntry, SvLBoxEntry* pTargetEntry );
+ void AlignControls();
+
+protected:
+
+ // the top section of the tab page where top level menus and toolbars
+ // are displayed in a listbox
+ FixedLine aTopLevelSeparator;
+ FixedText aTopLevelLabel;
+ ListBox aTopLevelListBox;
+ PushButton aNewTopLevelButton;
+ MenuButton aModifyTopLevelButton;
+
+ // the contents section where the contents of the selected
+ // menu or toolbar are displayed
+ FixedLine aContentsSeparator;
+ FixedText aContentsLabel;
+ SvTreeListBox* aContentsListBox;
+
+ PushButton aAddCommandsButton;
+ MenuButton aModifyCommandButton;
+
+ ImageButton aMoveUpButton;
+ ImageButton aMoveDownButton;
+
+ FixedText aSaveInText;
+ ListBox aSaveInListBox;
+
+ FixedText aDescriptionLabel;
+ SvxDescriptionEdit aDescriptionField;
+
+ SvxScriptSelectorDialog* pSelectorDlg;
+
+ // the ResourceURL to select when opening the dialog
+ rtl::OUString m_aURLToSelect;
+
+ ::com::sun::star::uno::Reference
+ < ::com::sun::star::frame::XFrame > m_xFrame;
+
+ SvxConfigPage( Window*, /* const ResId&, */ const SfxItemSet& );
+ virtual ~SvxConfigPage();
+
+ DECL_LINK( MoveHdl, Button * );
+
+ virtual SaveInData* CreateSaveInData(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::ui::XUIConfigurationManager >&,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::ui::XUIConfigurationManager >&,
+ const rtl::OUString& aModuleId,
+ bool docConfig ) = 0;
+
+ virtual void Init() = 0;
+ virtual void UpdateButtonStates() = 0;
+ virtual short QueryReset() = 0;
+
+ void PositionContentsListBox();
+
+ SvLBoxEntry* InsertEntry( SvxConfigEntry* pNewEntryData,
+ SvLBoxEntry* pTarget = NULL,
+ bool bFront = FALSE );
+
+ void AddSubMenusToUI( const String& rBaseTitle,
+ SvxConfigEntry* pParentData );
+
+ SvLBoxEntry* InsertEntryIntoUI ( SvxConfigEntry* pNewEntryData,
+ ULONG nPos = LIST_APPEND );
+
+ SvxEntries* FindParentForChild( SvxEntries* pParentEntries,
+ SvxConfigEntry* pChildData );
+
+ void ReloadTopLevelListBox( SvxConfigEntry* pSelection = NULL );
+
+public:
+
+ static bool CanConfig( const ::rtl::OUString& rModuleId );
+
+ SaveInData* GetSaveInData() { return pCurrentSaveInData; }
+
+ SvLBoxEntry* AddFunction( SvLBoxEntry* pTarget = NULL,
+ bool bFront = FALSE,
+ bool bAllowDuplicates = FALSE );
+
+ virtual void MoveEntry( bool bMoveUp );
+
+ bool MoveEntryData( SvLBoxEntry* pSourceEntry,
+ SvLBoxEntry* pTargetEntry );
+
+ BOOL FillItemSet( SfxItemSet& );
+ void Reset( const SfxItemSet& );
+
+ virtual bool DeleteSelectedContent() = 0;
+ virtual void DeleteSelectedTopLevel() = 0;
+
+ SvxConfigEntry* GetTopLevelSelection()
+ {
+ return (SvxConfigEntry*) aTopLevelListBox.GetEntryData(
+ aTopLevelListBox.GetSelectEntryPos() );
+ }
+
+ /** identifies the module in the given frame. If the frame is <NULL/>, a default
+ frame will be determined beforehand.
+
+ If the given frame is <NULL/>, a default frame will be used: The method the active
+ frame of the desktop, then the current frame. If both are <NULL/>,
+ the SfxViewFrame::Current's XFrame is used. If this is <NULL/>, too, an empty string is returned.
+
+ If the given frame is not <NULL/>, or an default frame could be successfully determined, then
+ the ModuleManager is asked for the module ID of the component in the frame.
+ */
+ static ::rtl::OUString
+ GetFrameWithDefaultAndIdentify( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _inout_rxFrame );
+};
+
+class SvxMenuConfigPage : public SvxConfigPage
+{
+private:
+
+ DECL_LINK( SelectMenu, ListBox * );
+ DECL_LINK( SelectMenuEntry, Control * );
+ DECL_LINK( NewMenuHdl, Button * );
+ DECL_LINK( MenuSelectHdl, MenuButton * );
+ DECL_LINK( EntrySelectHdl, MenuButton * );
+ DECL_LINK( AddCommandsHdl, Button * );
+ DECL_LINK( AddFunctionHdl, SvxScriptSelectorDialog * );
+
+ void Init();
+ void UpdateButtonStates();
+ short QueryReset();
+ bool DeleteSelectedContent();
+ void DeleteSelectedTopLevel();
+
+public:
+ SvxMenuConfigPage( Window *pParent, const SfxItemSet& rItemSet );
+ ~SvxMenuConfigPage();
+
+ SaveInData* CreateSaveInData(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::ui::XUIConfigurationManager >&,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::ui::XUIConfigurationManager >&,
+ const rtl::OUString& aModuleId,
+ bool docConfig );
+};
+
+class SvxMainMenuOrganizerDialog : public ModalDialog
+{
+ FixedText aMenuNameText;
+ Edit aMenuNameEdit;
+ FixedText aMenuListText;
+ SvTreeListBox aMenuListBox;
+ ImageButton aMoveUpButton;
+ ImageButton aMoveDownButton;
+ OKButton aOKButton;
+ CancelButton aCloseButton;
+ HelpButton aHelpButton;
+
+ SvxEntries* pEntries;
+ SvLBoxEntry* pNewMenuEntry;
+ bool bModified;
+
+ void UpdateButtonStates();
+
+ DECL_LINK( MoveHdl, Button * );
+ DECL_LINK( ModifyHdl, Edit * );
+ DECL_LINK( SelectHdl, Control* );
+
+public:
+ SvxMainMenuOrganizerDialog (
+ Window*, SvxEntries*,
+ SvxConfigEntry*, bool bCreateMenu = FALSE );
+
+ ~SvxMainMenuOrganizerDialog ();
+
+ SvxEntries* GetEntries();
+ void SetEntries( SvxEntries* );
+ SvxConfigEntry* GetSelectedEntry();
+};
+
+class SvxToolbarEntriesListBox : public SvxMenuEntriesListBox
+{
+ Size m_aCheckBoxImageSizePixel;
+ Link m_aChangedListener;
+ SvLBoxButtonData* m_pButtonData;
+ BOOL m_bHiContrastMode;
+ SvxConfigPage* pPage;
+
+ void ChangeVisibility( SvLBoxEntry* pEntry );
+
+protected:
+
+ virtual void CheckButtonHdl();
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ void BuildCheckBoxButtonImages( SvLBoxButtonData* );
+ Image GetSizedImage(
+ VirtualDevice& aDev, const Size& aNewSize, const Image& aImage );
+
+public:
+
+ SvxToolbarEntriesListBox(
+ Window* pParent, const ResId& );
+
+ ~SvxToolbarEntriesListBox();
+
+ void SetChangedListener( const Link& aChangedListener )
+ { m_aChangedListener = aChangedListener; }
+
+ const Link& GetChangedListener() const { return m_aChangedListener; }
+
+ Size GetCheckBoxPixelSize() const
+ { return m_aCheckBoxImageSizePixel; }
+
+ virtual BOOL NotifyMoving(
+ SvLBoxEntry*, SvLBoxEntry*, SvLBoxEntry*&, ULONG& );
+
+ virtual BOOL NotifyCopying(
+ SvLBoxEntry*, SvLBoxEntry*, SvLBoxEntry*&, ULONG&);
+
+ void KeyInput( const KeyEvent& rKeyEvent );
+};
+
+class SvxToolbarConfigPage : public SvxConfigPage
+{
+private:
+
+ DECL_LINK( SelectToolbar, ListBox * );
+ DECL_LINK( SelectToolbarEntry, Control * );
+ DECL_LINK( ToolbarSelectHdl, MenuButton * );
+ DECL_LINK( EntrySelectHdl, MenuButton * );
+ DECL_LINK( NewToolbarHdl, Button * );
+ DECL_LINK( AddCommandsHdl, Button * );
+ DECL_LINK( AddFunctionHdl, SvxScriptSelectorDialog * );
+ DECL_LINK( MoveHdl, Button * );
+
+ void UpdateButtonStates();
+ short QueryReset();
+ void Init();
+ bool DeleteSelectedContent();
+ void DeleteSelectedTopLevel();
+
+public:
+ SvxToolbarConfigPage( Window *pParent, const SfxItemSet& rItemSet );
+ ~SvxToolbarConfigPage();
+
+ SvLBoxEntry* AddFunction( SvLBoxEntry* pTarget = NULL,
+ bool bFront = FALSE,
+ bool bAllowDuplicates = TRUE );
+
+ void MoveEntry( bool bMoveUp );
+
+ SaveInData* CreateSaveInData(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::ui::XUIConfigurationManager >&,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::ui::XUIConfigurationManager >&,
+ const rtl::OUString& aModuleId,
+ bool docConfig );
+};
+
+class ToolbarSaveInData : public SaveInData
+{
+private:
+
+ SvxConfigEntry* pRootEntry;
+ rtl::OUString m_aDescriptorContainer;
+
+ ::com::sun::star::uno::Reference
+ < com::sun::star::container::XNameAccess > m_xPersistentWindowState;
+
+ bool LoadToolbar(
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexAccess >& xToolBarSettings,
+ SvxConfigEntry* pParentData );
+
+ void ApplyToolbar(
+ com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexContainer >& rNewToolbarBar,
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XSingleComponentFactory >& rFactory,
+ SvxConfigEntry *pToolbar = NULL );
+
+public:
+
+ ToolbarSaveInData(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::ui::XUIConfigurationManager >&,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::ui::XUIConfigurationManager >&,
+ const rtl::OUString& aModuleId,
+ bool docConfig );
+
+ ~ToolbarSaveInData();
+
+ void CreateToolbar( SvxConfigEntry* pToolbar );
+ void RestoreToolbar( SvxConfigEntry* pToolbar );
+ void RemoveToolbar( SvxConfigEntry* pToolbar );
+ void ApplyToolbar( SvxConfigEntry* pToolbar );
+ void ReloadToolbar( const rtl::OUString& rURL );
+
+ rtl::OUString GetSystemUIName( const rtl::OUString& rResourceURL );
+
+ sal_Int32 GetSystemStyle( const rtl::OUString& rResourceURL );
+
+ void SetSystemStyle(
+ const rtl::OUString& rResourceURL, sal_Int32 nStyle );
+
+ void SetSystemStyle(
+ ::com::sun::star::uno::Reference
+ < ::com::sun::star::frame::XFrame > xFrame,
+ const rtl::OUString& rResourceURL, sal_Int32 nStyle );
+
+ SvxEntries* GetEntries();
+ void SetEntries( SvxEntries* );
+ bool HasSettings();
+ bool HasURL( const rtl::OUString& rURL );
+ void Reset();
+ bool Apply();
+};
+
+class SvxNewToolbarDialog : public ModalDialog
+{
+private:
+ FixedText aFtDescription;
+ Edit aEdtName;
+ FixedText aSaveInText;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ Link aCheckNameHdl;
+
+ DECL_LINK(ModifyHdl, Edit*);
+
+public:
+ SvxNewToolbarDialog( Window* pWindow, const String& rName );
+
+ ListBox aSaveInListBox;
+
+ void GetName( rtl::OUString& rName ){rName = aEdtName.GetText();}
+
+ void SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false )
+ {
+ aCheckNameHdl = rLink;
+ if ( bCheckImmediately )
+ aBtnOK.Enable( rLink.Call( this ) > 0 );
+ }
+
+ void SetEditHelpId(ULONG nHelpId) {aEdtName.SetHelpId(nHelpId);}
+};
+
+class SvxIconSelectorDialog : public ModalDialog
+{
+private:
+ FixedText aFtDescription;
+ ToolBox aTbSymbol;
+ FixedText aFtNote;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+ PushButton aBtnImport;
+ PushButton aBtnDelete;
+ FixedLine aFlSeparator;
+ sal_uInt16 m_nNextId;
+
+ sal_Int32 m_nExpectedSize;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ui::XImageManager > m_xImageManager;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ui::XImageManager > m_xParentImageManager;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ui::XImageManager > m_xImportedImageManager;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::graphic::XGraphicProvider > m_xGraphProvider;
+
+ bool ReplaceGraphicItem( const ::rtl::OUString& aURL );
+
+ bool ImportGraphic( const ::rtl::OUString& aURL );
+
+ void ImportGraphics(
+ const com::sun::star::uno::Sequence< rtl::OUString >& aURLs );
+
+ BitmapEx AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize);// Added by shizhoubo
+
+public:
+
+ SvxIconSelectorDialog(
+ Window *pWindow,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ui::XImageManager >& rXImageManager,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ui::XImageManager >& rXParentImageManager
+ );
+
+ ~SvxIconSelectorDialog();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
+ GetSelectedIcon();
+
+ DECL_LINK( SelectHdl, ToolBox * );
+ DECL_LINK( ImportHdl, PushButton * );
+ DECL_LINK( DeleteHdl, PushButton * );
+};
+
+class SvxIconReplacementDialog : public MessBox
+{
+public:
+ SvxIconReplacementDialog(
+ Window *pWindow,
+ const rtl::OUString& aMessage,
+ bool aYestoAll);
+
+ SvxIconReplacementDialog(
+ Window *pWindow,
+ const rtl::OUString& aMessage );
+
+ rtl::OUString ReplaceIconName( const rtl::OUString& );
+ USHORT ShowDialog();
+};
+//added for issue83555
+class SvxIconChangeDialog : public ModalDialog
+{
+private:
+ FixedImage aFImageInfo;
+ OKButton aBtnOK;
+ FixedText aDescriptionLabel;
+ SvxDescriptionEdit aLineEditDescription;
+public:
+ SvxIconChangeDialog(Window *pWindow, const rtl::OUString& aMessage);
+};
+#endif // _SVXCFG_HXX
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
new file mode 100644
index 000000000000..87b6bc8a1820
--- /dev/null
+++ b/cui/source/inc/cfgutil.hxx
@@ -0,0 +1,220 @@
+/*************************************************************************
+ *
+ * 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: cfg.hxx,v $
+ * $Revision: 1.41 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CFGUTIL_HXX
+#define _CFGUTIL_HXX
+
+#include <vector>
+#include <rtl/ustring.hxx>
+#include <tools/string.hxx>
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/script/browse/XBrowseNode.hpp>
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+
+#include <vcl/timer.hxx>
+#include <svtools/svtabbx.hxx>
+#include <svtools/svtreebx.hxx>
+#include <vcl/image.hxx>
+
+class BasicManager;
+class SfxSlotPool;
+class SfxStringItem;
+class SfxFontItem;
+class SfxMacroInfoItem;
+class SfxMacroInfo;
+struct SfxStyleInfo_Impl;
+struct SfxStylesInfo_Impl;
+
+#define css ::com::sun::star
+
+struct SfxStyleInfo_Impl
+{
+ ::rtl::OUString sFamily;
+ ::rtl::OUString sStyle;
+ ::rtl::OUString sCommand;
+ ::rtl::OUString sLabel;
+
+ SfxStyleInfo_Impl()
+ {}
+
+ SfxStyleInfo_Impl(const SfxStyleInfo_Impl& rCopy)
+ {
+ sFamily = rCopy.sFamily;
+ sStyle = rCopy.sStyle;
+ sCommand = rCopy.sCommand;
+ sLabel = rCopy.sLabel;
+ }
+};
+
+struct SfxStylesInfo_Impl
+{
+ private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDoc;
+
+ public:
+
+ SfxStylesInfo_Impl();
+ void setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel);
+
+ sal_Bool parseStyleCommand(SfxStyleInfo_Impl& aStyle);
+ void getLabel4Style(SfxStyleInfo_Impl& aStyle);
+
+ ::std::vector< SfxStyleInfo_Impl > getStyleFamilies();
+ ::std::vector< SfxStyleInfo_Impl > getStyles(const ::rtl::OUString& sFamily);
+
+ static ::rtl::OUString generateCommand(const ::rtl::OUString& sFamily, const ::rtl::OUString& sStyle);
+};
+
+#define SFX_CFGGROUP_FUNCTION 1
+#define SFX_CFGGROUP_BASICMGR 2
+#define SFX_CFGGROUP_DOCBASICMGR 3
+#define SFX_CFGGROUP_BASICLIB 4
+#define SFX_CFGGROUP_BASICMOD 5
+#define SFX_CFGFUNCTION_MACRO 6
+#define SFX_CFGFUNCTION_SLOT 7
+#define SFX_CFGGROUP_SCRIPTCONTAINER 8
+#define SFX_CFGFUNCTION_SCRIPT 9
+#define SFX_CFGGROUP_STYLES 10
+#define SFX_CFGGROUP_SPECIALCHARACTERS 11
+
+struct SfxGroupInfo_Impl
+{
+ USHORT nKind;
+ USHORT nOrd;
+ void* pObject;
+ BOOL bWasOpened;
+ String sCommand;
+ String sLabel;
+
+ SfxGroupInfo_Impl( USHORT n, USHORT nr, void* pObj = 0 ) :
+ nKind( n ), nOrd( nr ), pObject( pObj ), bWasOpened(FALSE) {}
+};
+
+typedef SfxGroupInfo_Impl* SfxGroupInfoPtr;
+SV_DECL_PTRARR_DEL(SfxGroupInfoArr_Impl, SfxGroupInfoPtr, 5, 5)
+
+class SfxConfigFunctionListBox_Impl : public SvTreeListBox
+{
+ friend class SfxConfigGroupListBox_Impl;
+ Timer aTimer;
+ SvLBoxEntry* pCurEntry;
+ SfxGroupInfoArr_Impl aArr;
+ SfxStylesInfo_Impl* pStylesInfo;
+
+ DECL_LINK( TimerHdl, Timer* );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+
+public:
+ SfxConfigFunctionListBox_Impl( Window*, const ResId& );
+ ~SfxConfigFunctionListBox_Impl();
+
+ void ClearAll();
+ SvLBoxEntry* GetEntry_Impl( USHORT nId );
+ SvLBoxEntry* GetEntry_Impl( const String& );
+ USHORT GetId( SvLBoxEntry *pEntry );
+ using Window::GetHelpText;
+ String GetHelpText( SvLBoxEntry *pEntry );
+ USHORT GetCurId() { return GetId( FirstSelected() ); }
+ String GetCurCommand();
+ String GetCurLabel();
+ SfxMacroInfo* GetMacroInfo();
+ void FunctionSelected();
+ void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
+};
+
+struct SvxConfigGroupBoxResource_Impl;
+class SfxConfigGroupListBox_Impl : public SvTreeListBox
+{
+ SvxConfigGroupBoxResource_Impl* pImp;
+ //SfxSlotPool* pSlotPool;
+ SfxConfigFunctionListBox_Impl* pFunctionListBox;
+ SfxGroupInfoArr_Impl aArr;
+ ULONG nMode;
+ BOOL bShowSF; // show Scripting Framework scripts
+ BOOL bShowBasic; // show Basic scripts
+
+ ::rtl::OUString m_sModuleLongName;
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+ css::uno::Reference< css::frame::XFrame > m_xFrame;
+ css::uno::Reference< css::container::XNameAccess > m_xGlobalCategoryInfo;
+ css::uno::Reference< css::container::XNameAccess > m_xModuleCategoryInfo;
+ css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription;
+
+ Image GetImage( ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > node, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xCtx, bool bIsRootNode, bool bHighContrast );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getDocumentModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xCtx, ::rtl::OUString& docName );
+ ::rtl::OUString parseLocationName( const ::rtl::OUString& location );
+
+ void InitModule();
+ void InitBasic();
+ void InitStyles();
+
+ ::rtl::OUString MapCommand2UIName(const ::rtl::OUString& sCommand);
+
+ SfxStylesInfo_Impl* pStylesInfo;
+
+protected:
+ virtual void RequestingChilds( SvLBoxEntry *pEntry);
+ using SvListView::Expand;
+ virtual BOOL Expand( SvLBoxEntry* pParent );
+
+public:
+ SfxConfigGroupListBox_Impl ( Window* pParent,
+ const ResId&,
+ ULONG nConfigMode = 0 );
+ ~SfxConfigGroupListBox_Impl();
+ void ClearAll();
+
+ void Init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ const css::uno::Reference< css::frame::XFrame >& xFrame ,
+ const ::rtl::OUString& sModuleLongName);
+ void SetFunctionListBox( SfxConfigFunctionListBox_Impl *pBox )
+ { pFunctionListBox = pBox; }
+ void Open( SvLBoxEntry*, BOOL );
+ void GroupSelected();
+ void SelectMacro( const SfxMacroInfoItem* );
+ void AddAndSelect( const SfxStringItem*, const SfxStringItem* );
+ void SelectMacro( const String&, const String& );
+ String GetGroup();
+ BasicManager* GetBasicManager( const SvLBoxEntry& _rEntry );
+ void SetScriptType( const String& rScriptType );
+ void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
+};
+
+#undef css
+
+#endif
+
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
new file mode 100644
index 000000000000..d767d8ddd8f3
--- /dev/null
+++ b/cui/source/inc/chardlg.hxx
@@ -0,0 +1,400 @@
+/*************************************************************************
+ *
+ * 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: chardlg.hxx,v $
+ * $Revision: 1.8.184.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_CHARDLG_HXX
+#define _SVX_CHARDLG_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svtools/ctrlbox.hxx>
+#include <svtools/stdctrl.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/fntctrl.hxx>
+#include <svx/checklbx.hxx>
+#include <svx/langbox.hxx>
+
+// forward ---------------------------------------------------------------
+
+class SvxFontListItem;
+class FontList;
+
+// -----------------------------------------------------------------------
+
+#define DISABLE_CASEMAP ((USHORT)0x0001)
+#define DISABLE_WORDLINE ((USHORT)0x0002)
+#define DISABLE_BLINK ((USHORT)0x0004)
+#define DISABLE_UNDERLINE_COLOR ((USHORT)0x0008)
+
+#define DISABLE_LANGUAGE ((USHORT)0x0010)
+#define DISABLE_HIDE_LANGUAGE ((USHORT)0x0020)
+
+// class SvxCharBasePage -------------------------------------------------
+
+class SvxCharBasePage : public SfxTabPage
+{
+protected:
+ SvxFontPrevWindow m_aPreviewWin;
+ FixedInfo m_aFontTypeFT;
+
+ BOOL m_bPreviewBackgroundToCharacter;
+
+ SvxCharBasePage( Window* pParent, const ResId& rResIdTabPage, const SfxItemSet&,
+ USHORT nResIdPrewievWin, USHORT nResIdFontTypeFT );
+ virtual ~SvxCharBasePage();
+
+ void SetPrevFontSize( const SfxItemSet& rSet, USHORT nSlot, SvxFont& rFont );
+ void SetPrevFont( const SfxItemSet& rSet, USHORT nSlot, SvxFont& rFont );
+ void SetPrevFontStyle( const SfxItemSet& rSet, USHORT nSlotPosture, USHORT nSlotWeight, SvxFont& rFont ); // posture/weight
+ void SetPrevFontWidthScale( const SfxItemSet& rSet );
+
+ void SetPrevFontEscapement( BYTE nProp, BYTE nEscProp, short nEsc );
+
+ inline SvxFont& GetPreviewFont();
+ inline SvxFont& GetPreviewCJKFont();
+ inline SvxFont& GetPreviewCTLFont();
+
+public:
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+// virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+};
+
+// class SvxCharNamePage -------------------------------------------------
+
+struct SvxCharNamePage_Impl;
+
+class SvxCharNamePage : public SvxCharBasePage
+{
+
+private:
+ FixedLine* m_pWestLine;
+ FixedText* m_pWestFontNameFT;
+ FontNameBox* m_pWestFontNameLB;
+ FixedText* m_pWestFontStyleFT;
+ FontStyleBox* m_pWestFontStyleLB;
+ FixedText* m_pWestFontSizeFT;
+ FontSizeBox* m_pWestFontSizeLB;
+ FixedText* m_pWestFontLanguageFT;
+ SvxLanguageBox* m_pWestFontLanguageLB;
+
+ FixedLine* m_pEastLine;
+ FixedText* m_pEastFontNameFT;
+ FontNameBox* m_pEastFontNameLB;
+ FixedText* m_pEastFontStyleFT;
+ FontStyleBox* m_pEastFontStyleLB;
+ FixedText* m_pEastFontSizeFT;
+ FontSizeBox* m_pEastFontSizeLB;
+ FixedText* m_pEastFontLanguageFT;
+ SvxLanguageBox* m_pEastFontLanguageLB;
+
+ FixedLine* m_pCTLLine;
+ FixedText* m_pCTLFontNameFT;
+ FontNameBox* m_pCTLFontNameLB;
+ FixedText* m_pCTLFontStyleFT;
+ FontStyleBox* m_pCTLFontStyleLB;
+ FixedText* m_pCTLFontSizeFT;
+ FontSizeBox* m_pCTLFontSizeLB;
+ FixedText* m_pCTLFontLanguageFT;
+ SvxLanguageBox* m_pCTLFontLanguageLB;
+
+ FixedLine* m_pColorFL;
+ FixedText* m_pColorFT;
+ ColorListBox* m_pColorLB;
+
+ SvxCharNamePage_Impl* m_pImpl;
+
+ SvxCharNamePage( Window* pParent, const SfxItemSet& rSet );
+
+ void Initialize();
+ const FontList* GetFontList() const;
+ void UpdatePreview_Impl();
+ void FillStyleBox_Impl( const FontNameBox* rBox );
+ void FillSizeBox_Impl( const FontNameBox* rBox );
+
+ enum LanguageGroup
+ {
+ /** Language for western text.
+ */
+ Western = 0,
+
+ /** Language for asian text.
+ */
+ Asian,
+
+ /** Language for ctl text.
+ */
+ Ctl
+ };
+
+ void Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp );
+ BOOL FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp );
+ void ResetColor_Impl( const SfxItemSet& rSet );
+ BOOL FillItemSetColor_Impl( SfxItemSet& rSet );
+
+ DECL_LINK( UpdateHdl_Impl, Timer* );
+ DECL_LINK( FontModifyHdl_Impl, void* );
+ DECL_LINK( ColorBoxSelectHdl_Impl, ColorListBox* );
+
+public:
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+public:
+ ~SvxCharNamePage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+
+ void SetFontList( const SvxFontListItem& rItem );
+ void EnableRelativeMode();
+ void EnableSearchMode();
+ // the writer uses SID_ATTR_BRUSH as font background
+ void SetPreviewBackgroundToCharacter();
+
+ void DisableControls( USHORT nDisable );
+ virtual void PageCreated (SfxAllItemSet aSet);
+};
+
+// class SvxCharEffectsPage ----------------------------------------------
+
+class SvxCharEffectsPage : public SvxCharBasePage
+{
+
+private:
+ FixedText m_aFontColorFT;
+ ColorListBox m_aFontColorLB;
+
+ FixedText m_aEffectsFT;
+ SvxCheckListBox m_aEffectsLB;
+
+ ListBox m_aEffects2LB;
+
+ FixedText m_aReliefFT;
+ ListBox m_aReliefLB;
+
+ TriStateBox m_aOutlineBtn;
+ TriStateBox m_aShadowBtn;
+ TriStateBox m_aBlinkingBtn;
+ TriStateBox m_aHiddenBtn;
+
+ FixedLine m_aVerticalLine;
+
+ FixedText m_aOverlineFT;
+ ListBox m_aOverlineLB;
+ FixedText m_aOverlineColorFT;
+ ColorListBox m_aOverlineColorLB;
+
+ FixedText m_aStrikeoutFT;
+ ListBox m_aStrikeoutLB;
+
+ FixedText m_aUnderlineFT;
+ ListBox m_aUnderlineLB;
+ FixedText m_aUnderlineColorFT;
+ ColorListBox m_aUnderlineColorLB;
+
+ CheckBox m_aIndividualWordsBtn;
+
+ FixedLine m_aAsianLine;
+
+ FixedText m_aEmphasisFT;
+ ListBox m_aEmphasisLB;
+
+ FixedText m_aPositionFT;
+ ListBox m_aPositionLB;
+
+ USHORT m_nHtmlMode;
+
+ String m_aTransparentColorName;
+
+ SvxCharEffectsPage( Window* pParent, const SfxItemSet& rSet );
+
+ void Initialize();
+ void UpdatePreview_Impl();
+ void SetCaseMap_Impl( SvxCaseMap eCaseMap );
+ void ResetColor_Impl( const SfxItemSet& rSet );
+ BOOL FillItemSetColor_Impl( SfxItemSet& rSet );
+
+ DECL_LINK( SelectHdl_Impl, ListBox* );
+ DECL_LINK( CbClickHdl_Impl, CheckBox* );
+ DECL_LINK( TristClickHdl_Impl, TriStateBox* );
+ DECL_LINK( UpdatePreview_Impl, ListBox* );
+ DECL_LINK( ColorBoxSelectHdl_Impl, ColorListBox* );
+
+public:
+// using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+// virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+
+ void DisableControls( USHORT nDisable );
+ void EnableFlash();
+ // the writer uses SID_ATTR_BRUSH as font background
+ void SetPreviewBackgroundToCharacter();
+ virtual void PageCreated (SfxAllItemSet aSet);
+};
+
+// class SvxCharPositionPage ---------------------------------------------
+
+class SvxCharPositionPage : public SvxCharBasePage
+{
+
+private:
+ FixedLine m_aPositionLine;
+ RadioButton m_aHighPosBtn;
+ RadioButton m_aNormalPosBtn;
+ RadioButton m_aLowPosBtn;
+ FixedText m_aHighLowFT;
+ MetricField m_aHighLowEdit;
+ CheckBox m_aHighLowRB;
+ FixedText m_aFontSizeFT;
+ MetricField m_aFontSizeEdit;
+ FixedLine m_aRotationScalingFL;
+ FixedLine m_aScalingFL;
+ RadioButton m_a0degRB;
+ RadioButton m_a90degRB;
+ RadioButton m_a270degRB;
+ CheckBox m_aFitToLineCB;
+ FixedText m_aScaleWidthFT;
+ MetricField m_aScaleWidthMF;
+
+ FixedLine m_aKerningLine;
+ ListBox m_aKerningLB;
+ FixedText m_aKerningFT;
+ MetricField m_aKerningEdit;
+ CheckBox m_aPairKerningBtn;
+
+ short m_nSuperEsc;
+ short m_nSubEsc;
+
+ UINT16 m_nScaleWidthItemSetVal;
+ UINT16 m_nScaleWidthInitialVal;
+
+ BYTE m_nSuperProp;
+ BYTE m_nSubProp;
+
+ SvxCharPositionPage( Window* pParent, const SfxItemSet& rSet );
+
+ void Initialize();
+ void UpdatePreview_Impl( BYTE nProp, BYTE nEscProp, short nEsc );
+ void SetEscapement_Impl( USHORT nEsc );
+
+ DECL_LINK( PositionHdl_Impl, RadioButton* );
+ DECL_LINK( RotationHdl_Impl, RadioButton* );
+ DECL_LINK( FontModifyHdl_Impl, MetricField* );
+ DECL_LINK( AutoPositionHdl_Impl, CheckBox* );
+ DECL_LINK( FitToLineHdl_Impl, CheckBox* );
+ DECL_LINK( KerningSelectHdl_Impl, ListBox* );
+ DECL_LINK( KerningModifyHdl_Impl, MetricField* );
+ DECL_LINK( PairKerningHdl_Impl, CheckBox* );
+ DECL_LINK( LoseFocusHdl_Impl, MetricField* );
+ DECL_LINK( ScaleWidthModifyHdl_Impl, MetricField* );
+
+public:
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+ virtual void ActivatePage( const SfxItemSet& rSet );
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void FillUserData();
+ // the writer uses SID_ATTR_BRUSH as font background
+ void SetPreviewBackgroundToCharacter();
+ virtual void PageCreated (SfxAllItemSet aSet);
+};
+
+// class SvxCharTwoLinesPage ---------------------------------------------
+
+class SvxCharTwoLinesPage : public SvxCharBasePage
+{
+private:
+ FixedLine m_aSwitchOnLine;
+ CheckBox m_aTwoLinesBtn;
+
+ FixedLine m_aEncloseLine;
+ FixedText m_aStartBracketFT;
+ ListBox m_aStartBracketLB;
+ FixedText m_aEndBracketFT;
+ ListBox m_aEndBracketLB;
+
+ USHORT m_nStartBracketPosition;
+ USHORT m_nEndBracketPosition;
+
+ SvxCharTwoLinesPage( Window* pParent, const SfxItemSet& rSet );
+
+ void UpdatePreview_Impl();
+ void Initialize();
+ void SelectCharacter( ListBox* pBox );
+ void SetBracket( sal_Unicode cBracket, BOOL bStart );
+
+ DECL_LINK( TwoLinesHdl_Impl, CheckBox* );
+ DECL_LINK( CharacterMapHdl_Impl, ListBox* );
+
+public:
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ // the writer uses SID_ATTR_BRUSH as font background
+ void SetPreviewBackgroundToCharacter();
+ virtual void PageCreated (SfxAllItemSet aSet);
+};
+
+#endif // #ifndef _SVX_CHARDLG_HXX
+
diff --git a/cui/source/inc/connect.hxx b/cui/source/inc/connect.hxx
new file mode 100644
index 000000000000..db344c959e6e
--- /dev/null
+++ b/cui/source/inc/connect.hxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * 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: connect.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_CONNECT_HXX
+#define _SVX_CONNECT_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svx/connctrl.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+#include <sfx2/basedlgs.hxx>
+
+class SdrView;
+
+/*************************************************************************
+|*
+|* Dialog zum Aendern von Konnektoren (Connectors)
+|*
+\************************************************************************/
+
+class SvxConnectionPage : public SfxTabPage
+{
+private:
+ FixedText aFtType;
+ ListBox aLbType;
+
+ FixedLine aFlDelta;
+ FixedText aFtLine1;
+ MetricField aMtrFldLine1;
+ FixedText aFtLine2;
+ MetricField aMtrFldLine2;
+ FixedText aFtLine3;
+ MetricField aMtrFldLine3;
+
+ FixedLine aFlDistance;
+ FixedText aFtHorz1;
+ MetricField aMtrFldHorz1;
+ FixedText aFtVert1;
+ MetricField aMtrFldVert1;
+ FixedText aFtHorz2;
+ MetricField aMtrFldHorz2;
+ FixedText aFtVert2;
+ MetricField aMtrFldVert2;
+
+ SvxXConnectionPreview aCtlPreview;
+
+ const SfxItemSet& rOutAttrs;
+ SfxItemSet aAttrSet;
+ const SdrView* pView;
+ SfxMapUnit eUnit;
+
+#ifdef _SVX_CONNECT_CXX
+ void FillTypeLB();
+
+ DECL_LINK( ChangeAttrHdl_Impl, void * );
+#endif
+
+public:
+
+ SvxConnectionPage( Window* pWindow, const SfxItemSet& rInAttrs );
+ ~SvxConnectionPage();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ void Construct();
+ void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
+ virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001
+};
+
+/*************************************************************************
+|*
+|* Von SfxSingleTabDialog abgeleitet, um vom Control "uber virtuelle Methode
+|* benachrichtigt werden zu k"onnen.
+|*
+\************************************************************************/
+
+class SvxConnectionDialog : public SfxSingleTabDialog
+{
+public:
+ SvxConnectionDialog( Window* pParent, const SfxItemSet& rAttr,
+ const SdrView* pView );
+ ~SvxConnectionDialog();
+};
+
+
+#endif // _SVX_CONNECT_HXX
+
diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx
new file mode 100644
index 000000000000..b8544bd98dea
--- /dev/null
+++ b/cui/source/inc/cuicharmap.hxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * 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: cuicharmap.hxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CUI_CHARMAP_HXX
+#define _CUI_CHARMAP_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/ctrl.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svx/charmap.hxx>
+
+class SubsetMap;
+class SvxCharMapData;
+
+// define ----------------------------------------------------------------
+
+#define CHARMAP_MAXLEN 32
+
+namespace svx
+{
+ struct SvxShowCharSetItem;
+ class SvxShowCharSetVirtualAcc;
+}
+// class SvxCharacterMap -------------------------------------------------
+// the main purpose of this dialog is to enable the use of characters
+// that are not easily accesible from the keyboard
+
+// class SvxShowText =====================================================
+
+class SvxShowText : public Control
+{
+public:
+ SvxShowText( Window* pParent,
+ const ResId& rResId,
+ BOOL bCenter = FALSE );
+ ~SvxShowText();
+
+ void SetFont( const Font& rFont );
+ void SetText( const String& rText );
+
+protected:
+ virtual void Paint( const Rectangle& );
+
+private:
+ long mnY;
+ BOOL mbCenter;
+
+};
+
+class SvxCharMapData
+{
+public:
+ SvxCharMapData( class SfxModalDialog* pDialog, BOOL bOne_, ResMgr* pResContext );
+
+ void SetCharFont( const Font& rFont );
+
+private:
+friend class SvxCharacterMap;
+ SfxModalDialog* mpDialog;
+
+ SvxShowCharSet aShowSet;
+ SvxShowText aShowText;
+// SvxShowText aShowShortcut;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+ PushButton aDeleteBtn;
+// PushButton aAssignBtn;
+ FixedText aFontText;
+ ListBox aFontLB;
+ FixedText aSubsetText;
+ ListBox aSubsetLB;
+ FixedText aSymbolText;
+ SvxShowText aShowChar;
+ FixedText aCharCodeText;
+// FixedText aAssignText;
+ Font aFont;
+ BOOL bOne;
+ const SubsetMap* pSubsetMap;
+
+ DECL_LINK( OKHdl, OKButton* );
+ DECL_LINK( FontSelectHdl, ListBox* );
+ DECL_LINK( SubsetSelectHdl, ListBox* );
+ DECL_LINK( CharDoubleClickHdl, Control* pControl );
+ DECL_LINK( CharSelectHdl, Control* pControl );
+ DECL_LINK( CharHighlightHdl, Control* pControl );
+ DECL_LINK( CharPreSelectHdl, Control* pControl );
+ DECL_LINK( DeleteHdl, PushButton* pBtn );
+ DECL_LINK( AssignHdl, PushButton* pBtn );
+};
+
+class SvxCharacterMap : public SfxModalDialog
+{
+private:
+ SvxCharMapData* mpCharMapData;
+
+public:
+ SvxCharacterMap( Window* pParent, BOOL bOne=TRUE, const SfxItemSet* pSet=0 );
+ ~SvxCharacterMap();
+
+ void DisableFontSelection();
+
+ const Font& GetCharFont() const;
+ void SetCharFont( const Font& rFont );
+
+ void SetChar( sal_UCS4 );
+ sal_UCS4 GetChar() const;
+
+ String GetCharacters() const;
+
+ virtual short Execute();
+};
+
+#endif
+
diff --git a/cui/source/inc/cuifmsearch.hxx b/cui/source/inc/cuifmsearch.hxx
new file mode 100644
index 000000000000..2659054c2100
--- /dev/null
+++ b/cui/source/inc/cuifmsearch.hxx
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * 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: cuifmsearch.hxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CUI_FMSEARCH_HXX
+#define _CUI_FMSEARCH_HXX
+
+#include <com/sun/star/sdbc/XResultSet.hpp>
+
+#include <svx/fmsearch.hxx> //CHINA001
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+
+#ifndef _DIALOG_HXX //autogen
+#include <vcl/dialog.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 <vcl/combobox.hxx>
+#include <vcl/lstbox.hxx>
+#include <tools/link.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/stl_types.hxx>
+#include <tools/string.hxx>
+
+namespace svxform {
+ class FmSearchConfigItem;
+}
+
+// ===================================================================================================
+// = class FmSearchDialog - Dialog fuer Suchen in Formularen/Tabellen
+// ===================================================================================================
+
+struct FmSearchProgress;
+
+class FmSearchEngine;
+
+class FmSearchDialog : public ModalDialog
+{
+ friend class FmSearchEngine;
+
+ // meine ganzen Controls
+ FixedLine m_flSearchFor;
+ RadioButton m_rbSearchForText;
+ RadioButton m_rbSearchForNull;
+ RadioButton m_rbSearchForNotNull;
+ ComboBox m_cmbSearchText;
+ FixedLine m_flWhere;
+ FixedText m_ftForm;
+ ListBox m_lbForm;
+ RadioButton m_rbAllFields;
+ RadioButton m_rbSingleField;
+ ListBox m_lbField;
+ FixedLine m_flOptions;
+ FixedText m_ftPosition;
+ ListBox m_lbPosition;
+ CheckBox m_cbUseFormat;
+ CheckBox m_cbCase;
+ CheckBox m_cbBackwards;
+ CheckBox m_cbStartOver;
+ CheckBox m_cbWildCard;
+ CheckBox m_cbRegular;
+ CheckBox m_cbApprox;
+ PushButton m_pbApproxSettings;
+ CheckBox m_aHalfFullFormsCJK;
+ CheckBox m_aSoundsLikeCJK;
+ PushButton m_aSoundsLikeCJKSettings;
+ FixedLine m_flState;
+ FixedText m_ftRecordLabel;
+ FixedText m_ftRecord;
+ FixedText m_ftHint;
+ PushButton m_pbSearchAgain;
+ CancelButton m_pbClose;
+ HelpButton m_pbHelp;
+ String m_sSearch;
+ String m_sCancel;
+
+ Window* m_pPreSearchFocus;
+
+ Link m_lnkFoundHandler; // Handler fuer "gefunden"
+ Link m_lnkCanceledNotFoundHdl; // Handler fuer Positionierung des Cursors
+
+ Link m_lnkContextSupplier; // fuer Suche in verschiedenen Kontexten
+
+ // ein Array, in dem ich mir fuer jeden Kontext das aktuell selektierte Feld merke
+ ::std::vector<String> m_arrContextFields;
+
+ // fuer die eigentliche Arbeit ...
+ FmSearchEngine* m_pSearchEngine;
+
+ Timer m_aDelayedPaint;
+ // siehe EnableSearchUI
+
+ ::svxform::FmSearchConfigItem* m_pConfig;
+public:
+ /** hiermit kann in verschiedenen Saetzen von Feldern gesucht werden. Es gibt eine Reihe von Kontexten, deren Namen in
+ strContexts stehen (getrennt durch ';'), der Benutzer kann einen davon auswaehlen.
+ Wenn der Benutzer einen Kontext auswaehlt, wird lnkContextSupplier aufgerufen, er bekommt einen Zeiger auf eine
+ FmSearchContext-Struktur, die gefuellt werden muss.
+ Fuer die Suche gilt dann :
+ a) bei formatierter Suche wird der Iterator selber verwendet (wie beim ersten Constructor auch)
+ b) bei formatierter Suche wird NICHT der FormatKey an den Fields des Iterators verwendet, sondern die entsprechende
+ TextComponent wird gefragt (deshalb auch die Verwendung des originalen Iterator, durch dessen Move werden hoffentlich
+ die hinter den TextComponent-Interfaces stehenden Controls geupdatet)
+ c) bei nicht formatierter Suche wird ein Clone des Iterators verwendet (da ich hier die TextComponent-Interfaces nicht
+ fragen muss)
+ (natuerlich zwingend erforderlich : der String Nummer i in strUsedFields eines Kontexts muss mit dem Interface Nummer i
+ in arrFields des Kontexts korrespondieren)
+ */
+ FmSearchDialog(Window* pParent, const String& strInitialText, const ::std::vector< String >& _rContexts, sal_Int16 nInitialContext,
+ const Link& lnkContextSupplier);
+
+ virtual ~FmSearchDialog();
+
+ /** der Found-Handler bekommt im "gefunden"-Fall einen Zeiger auf eine FmFoundRecordInformation-Struktur
+ (dieser ist nur im Handler gueltig, wenn man sich also die Daten merken muss, nicht den Zeiger, sondern die
+ Struktur kopieren)
+ Dieser Handler MUSS gesetzt werden.
+ Ausserdem sollte beachtet werden, dass waehrend des Handlers der Suchdialog immer noch modal ist
+ */
+ void SetFoundHandler(const Link& lnk) { m_lnkFoundHandler = lnk; }
+ /**
+ Wenn die Suche abgebrochen oder erfolglos beendet wurde, wird im Suchdialog immer der aktuelle Datensatz angezeigt
+ Damit das mit der eventuellen Anzeige des Aufrufers synchron geht, existiert dieser Handler (der nicht undbedingt gesetzt
+ werden muss).
+ Der dem Handler uebergebene Zeiger zeigt auf eine FmFoundRecordInformation-Struktur, bei der aPosition und eventuell
+ (bei Suche mit Kontexten) nContext gueltig sind.
+ */
+ void SetCanceledNotFoundHdl(const Link& lnk) { m_lnkCanceledNotFoundHdl = lnk; }
+
+ inline void SetActiveField(const String& strField);
+
+protected:
+ virtual sal_Bool Close();
+
+ void Init(const String& strVisibleFields, const String& strInitialText);
+ // nur von den Constructoren aus zu verwenden
+
+ void OnFound(const ::com::sun::star::uno::Any& aCursorPos, sal_Int16 nFieldPos);
+
+ void EnableSearchUI(sal_Bool bEnable);
+ // beim Suchen in einem eigenen Thread moechte ich natuerlich die UI zum Starten/Parameter-Setzen der Suche disablen
+ // Bei bEnable == sal_False wird fuer alle betroffenen Controls das Painten kurz aus- und mittels m_aDelayedPaint nach
+ // einer kurzen Weile wieder angeschaltet. Wenn inzwischen eine Anforderung mit bEnable==sal_True kommt, wird der Timer gestoppt
+ // und das Painten gleich wieder angeschaltet. Als Konsequenz dieses umstaendlichen Vorgehens ist kein Flackern zu sehen,
+ // wenn man schnell hintereinander aus- und wieder einschaltet.
+
+ void EnableSearchForDependees(sal_Bool bEnable);
+
+ void EnableControlPaint(sal_Bool bEnable);
+ // enabled (disabled) fuer alle wichtigen Controls ihr Paint
+
+ void InitContext(sal_Int16 nContext);
+
+ void LoadParams();
+ void SaveParams() const;
+
+private:
+ // Handler fuer die Controls
+ DECL_LINK( OnClickedFieldRadios, Button* );
+ DECL_LINK( OnClickedSearchAgain, Button* );
+ DECL_LINK( OnClickedSpecialSettings, Button* );
+
+ DECL_LINK( OnSearchTextModified, ComboBox* );
+
+ DECL_LINK( OnPositionSelected, ListBox* );
+ DECL_LINK( OnFieldSelected, ListBox* );
+
+ DECL_LINK( OnCheckBoxToggled, CheckBox* );
+
+ DECL_LINK( OnContextSelection, ListBox* );
+
+ // Such-Fortschritt
+ DECL_LINK( OnSearchProgress, FmSearchProgress* );
+
+ DECL_LINK( OnDelayedPaint, void* );
+ // siehe EnableSearchUI
+
+ void implMoveControls(Control** _ppControls, sal_Int32 _nControls, sal_Int32 _nUp, Control* _pToResize);
+
+ void initCommon( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _rxCursor );
+};
+
+inline void FmSearchDialog::SetActiveField(const String& strField)
+{
+ sal_uInt16 nInitialField = m_lbField.GetEntryPos(strField);
+ if (nInitialField == COMBOBOX_ENTRY_NOTFOUND)
+ nInitialField = 0;
+ m_lbField.SelectEntryPos(nInitialField);
+ LINK(this, FmSearchDialog, OnFieldSelected).Call(&m_lbField);
+}
+
+#endif // _CUI_FMSEARCH_HXX
diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx
new file mode 100644
index 000000000000..ef285bb85448
--- /dev/null
+++ b/cui/source/inc/cuigaldlg.hxx
@@ -0,0 +1,375 @@
+/*************************************************************************
+ *
+ * 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: cuigaldlg.hxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CUI_GALDLG_HXX_
+#define _CUI_GALDLG_HXX_
+
+#include <vos/thread.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/combobox.hxx>
+#include <svl/slstitm.hxx>
+#include <svtools/transfer.hxx>
+#include <goodies/grfmgr.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/galctrl.hxx>
+#include <svx/galmisc.hxx>
+#include <com/sun/star/media/XPlayer.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <svtools/dialogclosedlistener.hxx>
+#include <bootstrp/sstring.hxx>
+
+// ------------
+// - Forwards -
+// ------------
+
+class Gallery;
+class GalleryTheme;
+class SearchProgress;
+class TakeProgress;
+class TPGalleryThemeProperties;
+
+// ---------------
+// - FilterEntry -
+// ---------------
+
+struct FilterEntry
+{
+ String aFilterName;
+};
+
+// ----------------
+// - SearchThread -
+// ----------------
+
+class SearchThread : public ::vos::OThread
+{
+private:
+
+ SearchProgress* mpProgress;
+ TPGalleryThemeProperties* mpBrowser;
+ INetURLObject maStartURL;
+
+ void ImplSearch( const INetURLObject& rStartURL,
+ const ::std::vector< String >& rFormats,
+ BOOL bRecursive );
+
+ virtual void SAL_CALL run();
+ virtual void SAL_CALL onTerminated();
+
+public:
+
+ SearchThread( SearchProgress* pProgess,
+ TPGalleryThemeProperties* pBrowser,
+ const INetURLObject& rStartURL );
+ virtual ~SearchThread();
+};
+
+// ------------------
+// - SearchProgress -
+// ------------------
+
+class SearchProgress : public ModalDialog
+{
+private:
+
+ FixedText aFtSearchDir;
+ FixedLine aFLSearchDir;
+ FixedText aFtSearchType;
+ FixedLine aFLSearchType;
+ CancelButton aBtnCancel;
+ SearchThread maSearchThread;
+
+ DECL_LINK( ClickCancelBtn, void* );
+ void Terminate();
+
+public:
+ SearchProgress( Window* pParent, const INetURLObject& rStartURL );
+ ~SearchProgress() {};
+
+ DECL_LINK( CleanUpHdl, void* );
+
+ virtual short Execute();
+ virtual void StartExecuteModal( const Link& rEndDialogHdl );
+ void SetFileType( const String& rType ) { aFtSearchType.SetText( rType ); }
+ void SetDirectory( const INetURLObject& rURL ) { aFtSearchDir.SetText( GetReducedString( rURL, 30 ) ); }
+};
+
+// --------------
+// - TakeThread -
+// --------------
+
+class TakeThread : public ::vos::OThread
+{
+private:
+
+ TakeProgress* mpProgress;
+ TPGalleryThemeProperties* mpBrowser;
+ List& mrTakenList;
+
+ virtual void SAL_CALL run();
+ virtual void SAL_CALL onTerminated();
+
+public:
+
+ TakeThread( TakeProgress* pProgess, TPGalleryThemeProperties* pBrowser, List& rTakenList );
+ virtual ~TakeThread();
+};
+
+// ----------------
+// - TakeProgress -
+// ----------------
+
+class TakeProgress : public ModalDialog
+{
+private:
+
+ FixedText aFtTakeFile;
+ FixedLine aFLTakeProgress;
+ CancelButton aBtnCancel;
+ TakeThread maTakeThread;
+ List maTakenList;
+
+ DECL_LINK( ClickCancelBtn, void* );
+ void Terminate();
+
+public:
+
+ TakeProgress( Window* pWindow );
+ ~TakeProgress() {};
+
+ DECL_LINK( CleanUpHdl, void* );
+
+ void SetFile( const INetURLObject& rURL ) { aFtTakeFile.SetText( GetReducedString( rURL, 30 ) ); }
+ virtual short Execute();
+ virtual void StartExecuteModal( const Link& rEndDialogHdl );
+};
+
+// ---------------------
+// - ActualizeProgress -
+// ---------------------
+
+class ActualizeProgress : public ModalDialog
+{
+private:
+
+ FixedText aFtActualizeFile;
+ FixedLine aFLActualizeProgress;
+ CancelButton aBtnCancel;
+ Timer* pTimer;
+ GalleryTheme* pTheme;
+ GalleryProgress aStatusProgress;
+
+ DECL_LINK( ClickCancelBtn, void* );
+ DECL_LINK( TimeoutHdl, Timer* );
+ DECL_LINK( ActualizeHdl, INetURLObject* pURL );
+
+public:
+ ActualizeProgress( Window* pWindow, GalleryTheme* pThm );
+ ~ActualizeProgress() {};
+
+ virtual short Execute();
+};
+
+// ---------------
+// - TitleDialog -
+// ---------------
+
+class TitleDialog : public ModalDialog
+{
+private:
+
+ OKButton maOk;
+ CancelButton maCancel;
+ HelpButton maHelp;
+ FixedLine maFL;
+ Edit maEdit;
+
+public:
+
+ TitleDialog( Window* pParent, const String& rOldText );
+ String GetTitle() const { return maEdit.GetText(); }
+};
+
+// -------------------
+// - GalleryIdDialog -
+// -------------------
+
+class GalleryIdDialog : public ModalDialog
+{
+private:
+
+ OKButton aBtnOk;
+ CancelButton aBtnCancel;
+ FixedLine aFLId;
+ ListBox aLbResName;
+ GalleryTheme* pThm;
+
+ DECL_LINK( ClickOkHdl, void* );
+ DECL_LINK( ClickResNameHdl, void* );
+
+public:
+
+ GalleryIdDialog( Window* pParent, GalleryTheme* pThm );
+ ~GalleryIdDialog() {}
+
+ ULONG GetId() const { return aLbResName.GetSelectEntryPos(); }
+};
+
+// --------------------------
+// - GalleryThemeProperties -
+// --------------------------
+
+class GalleryThemeProperties : public SfxTabDialog
+{
+ ExchangeData* pData;
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+
+public:
+
+ GalleryThemeProperties( Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet );
+ ~GalleryThemeProperties() {}
+};
+
+// -------------------------
+// - TPGalleryThemeGeneral -
+// -------------------------
+
+class TPGalleryThemeGeneral : public SfxTabPage
+{
+private:
+
+ FixedImage aFiMSImage;
+ Edit aEdtMSName;
+ FixedLine aFlMSGeneralFirst;
+ FixedText aFtMSType;
+ FixedText aFtMSShowType;
+ FixedText aFtMSPath;
+ FixedText aFtMSShowPath;
+ FixedText aFtMSContent;
+ FixedText aFtMSShowContent;
+ FixedLine aFlMSGeneralSecond;
+ FixedText aFtMSChangeDate;
+ FixedText aFtMSShowChangeDate;
+ ExchangeData* pData;
+
+ virtual void Reset( const SfxItemSet& ) {}
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+
+
+public:
+
+ TPGalleryThemeGeneral( Window* pParent, const SfxItemSet& rSet );
+ ~TPGalleryThemeGeneral() {}
+
+ void SetXChgData( ExchangeData* pData );
+ const ExchangeData* GetXChgData() const { return pData; }
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+};
+
+// ----------------------------
+// - TPGalleryThemeProperties -
+// ----------------------------
+
+class TPGalleryThemeProperties : public SfxTabPage
+{
+ friend class SearchThread;
+ friend class TakeProgress;
+ friend class TakeThread;
+
+ PushButton aBtnSearch;
+ PushButton aBtnTake;
+ PushButton aBtnTakeAll;
+ CheckBox aCbxPreview;
+ ComboBox aCbbFileType;
+ MultiListBox aLbxFound;
+ FixedText aFtFileType;
+ GalleryPreview aWndPreview;
+
+ ExchangeData* pData;
+ StringList aFoundList;
+ List aFilterEntryList;
+ Timer aPreviewTimer;
+ String aLastFilterName;
+ String aPreviewString;
+ INetURLObject aURL;
+ USHORT nCurFilterPos;
+ USHORT nFirstExtFilterPos;
+ BOOL bEntriesFound;
+ BOOL bInputAllowed;
+ BOOL bTakeAll;
+ BOOL bSearchRecursive;
+
+ ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > xMediaPlayer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker;
+
+ virtual void Reset( const SfxItemSet& /*rSet*/ ) {}
+ virtual BOOL FillItemSet( SfxItemSet& /*rSet*/ ) { return TRUE; }
+ ::rtl::OUString addExtension( const ::rtl::OUString&, const ::rtl::OUString& );
+ void FillFilterList();
+
+ void SearchFiles();
+ void TakeFiles();
+ void DoPreview();
+
+ DECL_LINK( ClickPreviewHdl, void* );
+ DECL_LINK( ClickCloseBrowserHdl, void* );
+ DECL_LINK( ClickSearchHdl, void* );
+ DECL_LINK( ClickTakeHdl, void* );
+ DECL_LINK( ClickTakeAllHdl, void* );
+ DECL_LINK( SelectFoundHdl, void* );
+ DECL_LINK( SelectThemeHdl, void* );
+ DECL_LINK( SelectFileTypeHdl, void* );
+ DECL_LINK( DClickFoundHdl, void* );
+ DECL_LINK( PreviewTimerHdl, void* );
+ DECL_LINK( EndSearchProgressHdl, SearchProgress* );
+ DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
+
+public:
+ TPGalleryThemeProperties( Window* pWindow, const SfxItemSet& rSet );
+ ~TPGalleryThemeProperties();
+
+ void SetXChgData( ExchangeData* pData );
+ const ExchangeData* GetXChgData() const { return pData; }
+
+ void StartSearchFiles( const String& _rFolderURL, short _nDlgResult );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+};
+
+#endif // _CUI_GALDLG_HXX_
diff --git a/cui/source/inc/cuigrfflt.hxx b/cui/source/inc/cuigrfflt.hxx
new file mode 100644
index 000000000000..061ada2568d1
--- /dev/null
+++ b/cui/source/inc/cuigrfflt.hxx
@@ -0,0 +1,256 @@
+/*************************************************************************
+ *
+ * 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: cuigrfflt.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CUI_GRFFLT_HXX
+#define _CUI_GRFFLT_HXX
+
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/timer.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/group.hxx>
+#include <vcl/salbtype.hxx>
+#include <goodies/grfmgr.hxx>
+#include <svx/graphctl.hxx>
+#include <svx/dlgctrl.hxx>
+#include <svx/rectenum.hxx>
+/*
+// ---------------
+// - Error codes -
+// ---------------
+
+#define SVX_GRAPHICFILTER_ERRCODE_NONE 0x00000000
+#define SVX_GRAPHICFILTER_UNSUPPORTED_GRAPHICTYPE 0x00000001
+#define SVX_GRAPHICFILTER_UNSUPPORTED_SLOT 0x00000002
+
+// --------------------
+// - SvxGraphicFilter -
+// --------------------
+
+class SfxRequest;
+class SfxItemSet;
+
+class SvxGraphicFilter
+{
+public:
+
+ static ULONG ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObject& rFilterObject );
+ static void DisableGraphicFilterSlots( SfxItemSet& rSet );
+};
+*/
+// -----------------------
+// - GraphicFilterDialog -
+// -----------------------
+
+class GraphicFilterDialog : public ModalDialog
+{
+private:
+
+ class PreviewWindow : public Control
+ {
+ private:
+
+ GraphicObject maGraphic;
+
+ virtual void Paint( const Rectangle& rRect );
+
+ public:
+
+ PreviewWindow( Window* pParent, const ResId& rResId );
+ ~PreviewWindow();
+
+ void SetGraphic( const Graphic& rGraphic );
+ };
+
+private:
+
+ Timer maTimer;
+ Link maModifyHdl;
+ Graphic maGraphic;
+ double mfScaleX;
+ double mfScaleY;
+ Size maSizePixel;
+ PreviewWindow maPreview;
+ FixedLine maFlParameter;
+ OKButton maBtnOK;
+ CancelButton maBtnCancel;
+ HelpButton maBtnHelp;
+
+ DECL_LINK( ImplPreviewTimeoutHdl, Timer* pTimer );
+ DECL_LINK( ImplModifyHdl, void* p );
+
+protected:
+
+ const Link& GetModifyHdl() const { return maModifyHdl; }
+ const Size& GetGraphicSizePixel() const { return maSizePixel; }
+
+public:
+
+ GraphicFilterDialog( Window* pParent, const ResId& rResId, const Graphic& rGraphic );
+ ~GraphicFilterDialog();
+
+ virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) = 0;
+};
+
+// -----------------------
+// - GraphicFilterMosaic -
+// -----------------------
+
+class GraphicFilterMosaic : public GraphicFilterDialog
+{
+private:
+
+ FixedText maFtWidth;
+ MetricField maMtrWidth;
+ FixedText maFtHeight;
+ MetricField maMtrHeight;
+ CheckBox maCbxEdges;
+
+public:
+
+ GraphicFilterMosaic( Window* pParent, const Graphic& rGraphic,
+ USHORT nTileWidth, USHORT nTileHeight, BOOL bEnhanceEdges );
+ ~GraphicFilterMosaic();
+
+ virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY );
+ long GetTileWidth() const { return static_cast<long>(maMtrWidth.GetValue()); }
+ long GetTileHeight() const { return static_cast<long>(maMtrHeight.GetValue()); }
+ BOOL IsEnhanceEdges() const { return maCbxEdges.IsChecked(); }
+};
+
+// -------------------------
+// - GraphicFilterSolarize -
+// -------------------------
+
+class GraphicFilterSolarize : public GraphicFilterDialog
+{
+private:
+
+ FixedText maFtThreshold;
+ MetricField maMtrThreshold;
+ CheckBox maCbxInvert;
+
+public:
+
+ GraphicFilterSolarize( Window* pParent, const Graphic& rGraphic,
+ BYTE nGreyThreshold, BOOL bInvert );
+ ~GraphicFilterSolarize();
+
+ virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY );
+ BYTE GetGreyThreshold() const { return( (BYTE) FRound( maMtrThreshold.GetValue() * 2.55 ) ); }
+ BOOL IsInvert() const { return maCbxInvert.IsChecked(); }
+};
+
+// ----------------------
+// - GraphicFilterSepia -
+// ----------------------
+
+class GraphicFilterSepia : public GraphicFilterDialog
+{
+private:
+
+ FixedText maFtSepia;
+ MetricField maMtrSepia;
+
+public:
+
+ GraphicFilterSepia( Window* pParent, const Graphic& rGraphic,
+ USHORT nSepiaPercent );
+ ~GraphicFilterSepia();
+
+ virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY );
+ USHORT GetSepiaPercent() const
+ { return sal::static_int_cast< USHORT >(maMtrSepia.GetValue()); }
+};
+
+// -----------------------
+// - GraphicFilterPoster -
+// -----------------------
+
+class GraphicFilterPoster : public GraphicFilterDialog
+{
+private:
+
+ FixedText maFtPoster;
+ NumericField maNumPoster;
+
+public:
+
+ GraphicFilterPoster( Window* pParent, const Graphic& rGraphic,
+ USHORT nPosterColorCount );
+ ~GraphicFilterPoster();
+
+ virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY );
+ USHORT GetPosterColorCount() const { return( (USHORT) maNumPoster.GetValue() ); }
+};
+
+// -----------------------
+// - GraphicFilterEmboss -
+// -----------------------
+
+class GraphicFilterEmboss : public GraphicFilterDialog
+{
+private:
+
+ class EmbossControl : public SvxRectCtl
+ {
+ private:
+
+ Link maModifyHdl;
+
+ virtual void MouseButtonDown( const MouseEvent& rEvt );
+
+ public:
+
+ EmbossControl( Window* pParent, const ResId& rResId, RECT_POINT eRectPoint ) :
+ SvxRectCtl( pParent, rResId ) { SetActualRP( eRectPoint ); }
+
+ void SetModifyHdl( const Link& rHdl ) { maModifyHdl = rHdl; }
+ };
+
+private:
+
+ FixedText maFtLight;
+ EmbossControl maCtlLight;
+
+public:
+
+ GraphicFilterEmboss( Window* pParent, const Graphic& rGraphic,
+ RECT_POINT eLightSource );
+ ~GraphicFilterEmboss();
+
+ virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY );
+ RECT_POINT GetLightSource() const { return maCtlLight.GetActualRP(); }
+};
+
+#endif
diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx
new file mode 100644
index 000000000000..59b39f55a7fc
--- /dev/null
+++ b/cui/source/inc/cuihyperdlg.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * 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: cuihyperdlg.hxx,v $
+ * $Revision: 1.4.216.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CUI_TAB_HYPERLINK_HXX
+#define _CUI_TAB_HYPERLINK_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svx/hlnkitem.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <vcl/image.hxx>
+
+#include "iconcdlg.hxx"
+
+/*************************************************************************
+|*
+|* Hyperlink-Dialog
+|*
+\************************************************************************/
+
+class SvxHpLinkDlg;
+class SvxHlinkCtrl : public SfxControllerItem
+{
+private :
+ SvxHpLinkDlg *pParent;
+
+ SfxStatusForwarder aOnlineForwarder;
+ SfxStatusForwarder aRdOnlyForwarder;
+
+public :
+ SvxHlinkCtrl( USHORT nId, SfxBindings & rBindings, SvxHpLinkDlg* pDlg);
+
+ virtual void StateChanged( USHORT nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+};
+
+
+
+/*************************************************************************
+|*
+|* Hyperlink-Dialog
+|*
+\************************************************************************/
+
+class SvxHpLinkDlg : public IconChoiceDialog
+{
+private:
+ SvxHlinkCtrl maCtrl; // Controler
+ SfxBindings* mpBindings;
+ SfxItemSet* mpItemSet;
+
+ sal_Bool mbDummy1 : 1;
+ sal_Bool mbDummy2 : 1;
+ sal_Bool mbDummy3 : 1;
+ sal_Bool mbDummy4 : 1;
+ sal_Bool mbDummy5 : 1;
+ sal_Bool mbGrabFocus : 1;
+ sal_Bool mbReadOnly : 1;
+ sal_Bool mbIsHTMLDoc : 1;
+
+ void* mpDummy1;
+ void* mpDummy2;
+
+ DECL_LINK (ClickApplyHdl_Impl, void * );
+ DECL_LINK (ClickCloseHdl_Impl, void * );
+
+protected:
+ virtual BOOL Close();
+ virtual void Move();
+
+// virtual long PreNotify( NotifyEvent& rNEvt );
+public:
+ SvxHpLinkDlg (Window* pParent, SfxBindings* pBindings );
+ ~SvxHpLinkDlg ();
+
+ virtual void PageCreated( USHORT nId, IconChoicePage& rPage );
+
+ USHORT SetPage( SvxHyperlinkItem* pItem );
+ void EnableInetBrowse( sal_Bool bEnable = sal_True );
+ void SetReadOnlyMode( sal_Bool bReadOnly = sal_False );
+ inline BOOL IsHTMLDoc() const { return mbIsHTMLDoc; }
+
+ inline SfxBindings* GetBindings() const { return mpBindings; };
+ inline SfxDispatcher* GetDispatcher() const { return mpBindings->GetDispatcher(); }
+};
+
+
+#endif // _CUI_TAB_HYPERLINK_HXX
diff --git a/cui/source/inc/cuiimapwnd.hxx b/cui/source/inc/cuiimapwnd.hxx
new file mode 100644
index 000000000000..0e62fab44318
--- /dev/null
+++ b/cui/source/inc/cuiimapwnd.hxx
@@ -0,0 +1,54 @@
+#ifndef _CUI_IMAPWND_HXX
+#define _CUI_IMAPWND_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/button.hxx>
+#include <vcl/menu.hxx>
+#include <svl/itempool.hxx>
+#include <svtools/imapobj.hxx>
+#include <svtools/transfer.hxx>
+#include <svtools/imap.hxx>
+#include <sfx2/frame.hxx>
+#include <svtools/svmedit.hxx>
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class URLDlg : public ModalDialog
+{
+ FixedText maFtURL;
+ Edit maEdtURL;
+ FixedText maFtTarget;
+ ComboBox maCbbTargets;
+ FixedText maFtName;
+ Edit maEdtName;
+ FixedText maFtAlternativeText;
+ Edit maEdtAlternativeText;
+ FixedText maFtDescription;
+ MultiLineEdit maEdtDescription;
+ FixedLine maFlURL;
+ HelpButton maBtnHelp;
+ OKButton maBtnOk;
+ CancelButton maBtnCancel;
+
+public:
+
+ URLDlg( Window* pWindow,
+ const String& rURL, const String& rAlternativeText, const String& rDescription,
+ const String& rTarget, const String& rName,
+ TargetList& rTargetList );
+
+ String GetURL() const { return maEdtURL.GetText(); }
+ String GetAltText() const { return maEdtAlternativeText.GetText(); }
+ String GetDesc() const { return maEdtDescription.GetText(); }
+ String GetTarget() const { return maCbbTargets.GetText(); }
+ String GetName() const { return maEdtName.GetText(); }
+};
+
+#endif
diff --git a/cui/source/inc/cuioptgenrl.hxx b/cui/source/inc/cuioptgenrl.hxx
new file mode 100644
index 000000000000..19d21ba5c255
--- /dev/null
+++ b/cui/source/inc/cuioptgenrl.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * 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: cuioptgenrl.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_CUIOPTGENRL_HXX
+#define _SVX_CUIOPTGENRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svx/optgenrl.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/group.hxx>
+
+// forward ---------------------------------------------------------------
+
+struct GeneralTabPage_Impl;
+
+#define SfxGeneralTabPage SvxGeneralTabPage
+#define INDEX_NOTSET ((sal_Int16)-1)
+
+// class SvxUserEdit -----------------------------------------------------
+
+class SvxUserEdit : public Edit
+{
+private:
+ sal_Int16 m_nIndex;
+ FixedText* m_pLabel;
+
+public:
+ SvxUserEdit( Window* pParent, const ResId& rResId,
+ sal_Int16 nIndex = INDEX_NOTSET, FixedText* pLabel = NULL ) :
+ Edit( pParent, rResId, true ), m_nIndex( nIndex ), m_pLabel( pLabel ) {}
+
+ inline void SetIndex( sal_Int16 nIndex ) { m_nIndex = nIndex; }
+ inline sal_Int16 GetIndex() const { return m_nIndex; }
+ inline void SetLabel( FixedText* pLabel ) { m_pLabel = pLabel; }
+ inline FixedText* GetLabel() const { return m_pLabel; }
+};
+
+// class SvxGeneralTabPage -----------------------------------------------
+
+class SvxGeneralTabPage : public SfxTabPage
+{
+ using TabPage::DeactivatePage;
+private:
+ FixedText aCompanyLbl;
+ SvxUserEdit aCompanyEdit;
+ FixedText aNameLbl;
+ FixedText aNameLblRuss;
+ FixedText aNameLblEastern;
+ SvxUserEdit aFirstName;
+ SvxUserEdit aFatherName;
+ SvxUserEdit aName;
+ SvxUserEdit aShortName;
+ FixedText aStreetLbl;
+ FixedText aStreetLblRuss;
+ SvxUserEdit aStreetEdit;
+ SvxUserEdit aApartmentNrEdit;
+ FixedText aCityLbl;
+ SvxUserEdit aPLZEdit;
+ SvxUserEdit aCityEdit;
+ SvxUserEdit aUsCityEdit;
+ SvxUserEdit aUsStateEdit;
+ SvxUserEdit aUsZipEdit;
+ FixedText aCountryLbl;
+ SvxUserEdit aCountryEdit;
+ FixedText aTitlePosLbl;
+ SvxUserEdit aTitleEdit;
+ SvxUserEdit aPositionEdit;
+ FixedText aPhoneLbl;
+ SvxUserEdit aTelPrivEdit;
+ SvxUserEdit aTelCompanyEdit;
+ FixedText aFaxMailLbl;
+ SvxUserEdit aFaxEdit;
+ SvxUserEdit aEmailEdit;
+ FixedLine aAddrFrm;
+ CheckBox aUseDataCB;
+
+ GeneralTabPage_Impl* pImpl;
+
+
+#ifdef _SVX_OPTGENRL_CXX
+ DECL_LINK( ModifyHdl_Impl, Edit * );
+
+ sal_Bool GetAddress_Impl();
+ void SetAddress_Impl();
+#endif
+
+protected:
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+public:
+ SvxGeneralTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxGeneralTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif // #ifndef _SVX_CUIOPTGENRL_HXX
+
+
diff --git a/cui/source/inc/cuisrchdlg.hxx b/cui/source/inc/cuisrchdlg.hxx
new file mode 100644
index 000000000000..c26cf91688cf
--- /dev/null
+++ b/cui/source/inc/cuisrchdlg.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * 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: cuisrchdlg.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CUI_SRCHDLG_HXX
+#define _CUI_SRCHDLG_HXX
+
+// include ---------------------------------------------------------------
+
+
+#include <svtools/stdctrl.hxx>
+#ifndef _COMBOBOX_HXX //autogen
+#include <vcl/combobox.hxx>
+#endif
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#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 _DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+#include <sfx2/childwin.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svl/svarray.hxx>
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#include <svtools/svmedit.hxx>
+#include <sfx2/srchdefs.hxx>
+
+class SvxJSearchOptionsPage;
+
+class SvxJSearchOptionsDialog : public SfxSingleTabDialog
+{
+ INT32 nInitialTlFlags;
+ SvxJSearchOptionsPage *pPage;
+
+ // disallow copy-constructor and assignment-operator for now
+ SvxJSearchOptionsDialog( const SvxJSearchOptionsDialog & );
+ SvxJSearchOptionsDialog & operator == ( const SvxJSearchOptionsDialog & );
+
+public:
+ SvxJSearchOptionsDialog( Window *pParent,
+ const SfxItemSet& rOptionsSet, USHORT nUniqueId,
+ INT32 nInitialFlags );
+ virtual ~SvxJSearchOptionsDialog();
+
+ // Window
+ virtual void Activate();
+
+ INT32 GetTransliterationFlags() const;
+ void SetTransliterationFlags( INT32 nSettings );
+};
+
+#endif
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
new file mode 100644
index 000000000000..cba81c8c096f
--- /dev/null
+++ b/cui/source/inc/cuitabarea.hxx
@@ -0,0 +1,805 @@
+/*************************************************************************
+ *
+ * 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: cuitabarea.hxx,v $
+ * $Revision: 1.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.
+ *
+ ************************************************************************/
+#ifndef _CUI_TAB_AREA_HXX
+#define _CUI_TAB_AREA_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svx/tabarea.hxx>
+
+/*************************************************************************
+|*
+|* Fl"achen-Tab-Dialog
+|*
+\************************************************************************/
+
+class SvxAreaTabDialog : public SfxTabDialog
+{
+private:
+ SdrModel* mpDrawModel;
+// const SdrView* mpView;
+
+ XColorTable* mpColorTab;
+ XColorTable* mpNewColorTab;
+ XGradientList* mpGradientList;
+ XGradientList* mpNewGradientList;
+ XHatchList* mpHatchingList;
+ XHatchList* mpNewHatchingList;
+ XBitmapList* mpBitmapList;
+ XBitmapList* mpNewBitmapList;
+
+ const SfxItemSet& mrOutAttrs;
+
+ ChangeType mnColorTableState;
+ ChangeType mnBitmapListState;
+ ChangeType mnGradientListState;
+ ChangeType mnHatchingListState;
+
+ USHORT mnPageType;
+ USHORT mnDlgType;
+ USHORT mnPos;
+ BOOL mbAreaTP;
+ BOOL mbDeleteColorTable;
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+
+protected:
+ virtual short Ok();
+#ifdef _SVX_TABAREA_CXX
+ DECL_LINK( CancelHdlImpl, void * );
+ void SavePalettes();
+#endif
+
+public:
+ SvxAreaTabDialog( Window* pParent,
+ const SfxItemSet* pAttr, SdrModel* pModel,
+ const SdrView* pSdrView = NULL );
+ ~SvxAreaTabDialog();
+
+ void SetNewColorTable( XColorTable* pColTab )
+ { mpNewColorTab = pColTab; }
+ XColorTable* GetNewColorTable() const { return mpNewColorTab; }
+ const XColorTable* GetColorTable() const { return mpColorTab; }
+
+ void SetNewGradientList( XGradientList* pGrdLst)
+ { mpNewGradientList = pGrdLst; }
+ XGradientList* GetNewGradientList() const
+ { return mpNewGradientList; }
+ const XGradientList* GetGradientList() const { return mpGradientList; }
+
+ void SetNewHatchingList( XHatchList* pHtchLst)
+ { mpNewHatchingList = pHtchLst; }
+ XHatchList* GetNewHatchingList() const
+ { return mpNewHatchingList; }
+ const XHatchList* GetHatchingList() const { return mpHatchingList; }
+
+ void SetNewBitmapList( XBitmapList* pBmpLst)
+ { mpNewBitmapList = pBmpLst; }
+ XBitmapList* GetNewBitmapList() const { return mpNewBitmapList; }
+ const XBitmapList* GetBitmapList() const { return mpBitmapList; }
+
+ void DontDeleteColorTable() { mbDeleteColorTable = FALSE; }
+};
+
+/*************************************************************************
+|*
+|* Transparence-Tab-Page
+|*
+\************************************************************************/
+
+class SvxTransparenceTabPage : public SvxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+ const SfxItemSet& rOutAttrs;
+ RECT_POINT eRP;
+
+ //CHINA001 UINT16* pPageType;
+ //CHINA001 UINT16* pDlgType;
+ UINT16 nPageType; //add CHINA001
+ UINT16 nDlgType; //add CHINA001
+
+ // main selection
+ FixedLine aFlProp;
+ RadioButton aRbtTransOff;
+ RadioButton aRbtTransLinear;
+ RadioButton aRbtTransGradient;
+
+ // linear transparency
+ MetricField aMtrTransparent;
+
+ // gradient transparency
+ FixedText aFtTrgrType;
+ ListBox aLbTrgrGradientType;
+ FixedText aFtTrgrCenterX;
+ MetricField aMtrTrgrCenterX;
+ FixedText aFtTrgrCenterY;
+ MetricField aMtrTrgrCenterY;
+ FixedText aFtTrgrAngle;
+ MetricField aMtrTrgrAngle;
+ FixedText aFtTrgrBorder;
+ MetricField aMtrTrgrBorder;
+ FixedText aFtTrgrStartValue;
+ MetricField aMtrTrgrStartValue;
+ FixedText aFtTrgrEndValue;
+ MetricField aMtrTrgrEndValue;
+
+ // preview
+ SvxXRectPreview aCtlBitmapPreview;
+ SvxXRectPreview aCtlXRectPreview;
+ BOOL bBitmap;
+
+ XOutdevItemPool* pXPool;
+ XFillAttrSetItem aXFillAttr;
+ SfxItemSet& rXFSet;
+
+#ifdef _SVX_TPAREA_CXX
+ DECL_LINK(ClickTransOffHdl_Impl, void * );
+ DECL_LINK(ClickTransLinearHdl_Impl, void * );
+ DECL_LINK(ClickTransGradientHdl_Impl, void * );
+ DECL_LINK(ModifyTransparentHdl_Impl, void*);
+ DECL_LINK(ChangeTrgrTypeHdl_Impl, void*);
+ DECL_LINK(ModifiedTrgrHdl_Impl, void*);
+#endif
+
+ void ActivateLinear(BOOL bActivate);
+ void ActivateGradient(BOOL bActivate);
+ void SetControlState_Impl(XGradientStyle eXGS);
+
+ BOOL InitPreview ( const SfxItemSet& rSet );
+ void InvalidatePreview (BOOL bEnable = TRUE );
+
+public:
+ SvxTransparenceTabPage(Window* pParent, const SfxItemSet& rInAttrs);
+ void Construct();
+
+ static SfxTabPage* Create(Window*, const SfxItemSet&);
+ static UINT16* GetRanges();
+
+ virtual BOOL FillItemSet(SfxItemSet&);
+ virtual void Reset(const SfxItemSet&);
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet* pSet);
+ virtual void PointChanged(Window* pWindow, RECT_POINT eRP);
+
+ //CHINA001 void SetPageType(UINT16 *pInType) { pPageType = pInType; }
+ //CHINA001 void SetDlgType(UINT16* pInType) { pDlgType = pInType; }
+ void SetPageType(UINT16 nInType) { nPageType = nInType; } //add CHINA001
+ void SetDlgType(UINT16 nInType) { nDlgType = nInType; }//add CHINA001
+ virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001
+};
+
+/*************************************************************************
+|*
+|* Fl"achen-Tab-Page
+|*
+\************************************************************************/
+
+class SvxAreaTabPage : public SvxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ FixedLine aFlProp;
+ ListBox aTypeLB;
+
+ ColorLB aLbColor;
+ GradientLB aLbGradient;
+ HatchingLB aLbHatching;
+ BitmapLB aLbBitmap;
+ SvxXRectPreview aCtlBitmapPreview;
+
+ TriStateBox aTsbStepCount;
+ FixedLine aFlStepCount;
+ NumericField aNumFldStepCount;
+
+ CheckBox aCbxHatchBckgrd;
+ ColorLB aLbHatchBckgrdColor;
+
+ FixedLine aFlSize;
+ TriStateBox aTsbOriginal;
+ TriStateBox aTsbScale;
+ FixedText aFtXSize;
+ MetricField aMtrFldXSize;
+ FixedText aFtYSize;
+ MetricField aMtrFldYSize;
+ FixedLine aFlPosition;
+ SvxRectCtl aCtlPosition;
+ FixedText aFtXOffset;
+ MetricField aMtrFldXOffset;
+ FixedText aFtYOffset;
+ MetricField aMtrFldYOffset;
+ TriStateBox aTsbTile;
+ TriStateBox aTsbStretch;
+ FixedLine aFlOffset;
+ RadioButton aRbtRow;
+ RadioButton aRbtColumn;
+ MetricField aMtrFldOffset;
+
+ SvxXRectPreview aCtlXRectPreview;
+
+ const SfxItemSet& rOutAttrs;
+ RECT_POINT eRP;
+
+ XColorTable* pColorTab;
+ XGradientList* pGradientList;
+ XHatchList* pHatchingList;
+ XBitmapList* pBitmapList;
+
+ ChangeType* pnColorTableState;
+ ChangeType* pnBitmapListState;
+ ChangeType* pnGradientListState;
+ ChangeType* pnHatchingListState;
+
+ //CHINA001 USHORT* pPageType;
+ //CHINA001 USHORT* pDlgType;
+ //CHINA001 USHORT* pPos;
+ UINT16 nPageType; //add CHINA001
+ UINT16 nDlgType;//add CHINA001
+ UINT16 nPos; //add CHINA001
+
+ BOOL* pbAreaTP;
+
+ XOutdevItemPool* pXPool;
+ XFillAttrSetItem aXFillAttr;
+ SfxItemSet& rXFSet;
+
+ SfxMapUnit ePoolUnit;
+ FieldUnit eFUnit;
+
+#ifdef _SVX_TPAREA_CXX
+ DECL_LINK( SelectDialogTypeHdl_Impl, ListBox * );
+ DECL_LINK( ClickInvisibleHdl_Impl, void * );
+ DECL_LINK( ClickColorHdl_Impl, void * );
+ DECL_LINK( ModifyColorHdl_Impl, void * );
+ DECL_LINK( ModifyHatchBckgrdColorHdl_Impl, void * );
+ DECL_LINK( ClickGradientHdl_Impl, void * );
+ DECL_LINK( ModifyGradientHdl_Impl, void * );
+ DECL_LINK( ClickHatchingHdl_Impl, void * );
+ DECL_LINK( ModifyHatchingHdl_Impl, void * );
+ DECL_LINK( ToggleHatchBckgrdColorHdl_Impl, void * );
+ DECL_LINK( ClickBitmapHdl_Impl, void * );
+ DECL_LINK( ModifyBitmapHdl_Impl, void * );
+// DECL_LINK( ModifyTransparentHdl_Impl, void * );
+ DECL_LINK( ModifyStepCountHdl_Impl, void * );
+ DECL_LINK( ModifyTileHdl_Impl, void * );
+ DECL_LINK( ClickScaleHdl_Impl, void * );
+#endif
+
+public:
+ SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ void Construct();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+ virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
+
+ void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+ void SetGradientList( XGradientList* pGrdLst)
+ { pGradientList = pGrdLst; }
+ void SetHatchingList( XHatchList* pHtchLst)
+ { pHatchingList = pHtchLst; }
+ void SetBitmapList( XBitmapList* pBmpLst) { pBitmapList = pBmpLst; }
+
+ //CHINA001 void SetPageType( USHORT* pInType ) { pPageType = pInType; }
+ void SetPageType( UINT16 nInType ) { nPageType = nInType; } //add CHINA001
+ //CHINA001 void SetDlgType( USHORT* pInType ) { pDlgType = pInType; }
+ void SetDlgType( UINT16 nInType ) { nDlgType = nInType; }//add CHINA001
+ //CHINA001 void SetPos( USHORT* pInPos ) { pPos = pInPos; }
+ void SetPos( UINT16 nInPos ) { nPos = nInPos; }//add CHINA001
+ void SetAreaTP( BOOL* pIn ) { pbAreaTP = pIn; }
+ virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001
+ void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; }
+ void SetGrdChgd( ChangeType* pIn ) { pnGradientListState = pIn; }
+ void SetHtchChgd( ChangeType* pIn ) { pnHatchingListState = pIn; }
+ void SetBmpChgd( ChangeType* pIn ) { pnBitmapListState = pIn; }
+};
+
+/*************************************************************************
+|*
+|* Schatten-Tab-Page
+|*
+\************************************************************************/
+
+class SvxShadowTabPage : public SvxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ FixedLine aFlProp;
+ TriStateBox aTsbShowShadow;
+ FixedText aFtPosition;
+ SvxRectCtl aCtlPosition;
+ FixedText aFtDistance;
+ MetricField aMtrDistance;
+ FixedText aFtShadowColor;
+ ColorLB aLbShadowColor;
+ FixedText aFtTransparent;
+ MetricField aMtrTransparent;
+ SvxXShadowPreview aCtlXRectPreview;
+
+ const SfxItemSet& rOutAttrs;
+ RECT_POINT eRP;
+
+ XColorTable* pColorTab;
+ ChangeType* pnColorTableState;
+ UINT16 nPageType; //add CHINA001
+ UINT16 nDlgType; //add CHINA001
+ USHORT* pPos;
+ BOOL* pbAreaTP;
+
+ BOOL bDisable;
+
+ XOutdevItemPool* pXPool;
+ XFillAttrSetItem aXFillAttr;
+ SfxItemSet& rXFSet;
+ SfxMapUnit ePoolUnit;
+
+#ifdef _SVX_TPSHADOW_CXX
+ DECL_LINK( ClickShadowHdl_Impl, void * );
+ DECL_LINK( ModifyShadowHdl_Impl, void * );
+#endif
+
+public:
+ SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ void Construct();
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+ virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
+
+ void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+//CHINA001 void SetPageType( USHORT* pInType ) { pPageType = pInType; }
+//CHINA001 void SetDlgType( USHORT* pInType ) { pDlgType = pInType; }
+ void SetPageType( UINT16 nInType ) { nPageType = nInType; } //add CHINA001
+ void SetDlgType( UINT16 nInType ) { nDlgType = nInType; } //add CHINA001
+ void SetAreaTP( BOOL* pIn ) { pbAreaTP = pIn; }
+ void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; }
+ virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001
+ void DisablePage( BOOL bIn ) { bDisable = bIn; }
+};
+
+/*************************************************************************
+|*
+|* Farbverlauf-Tab-Page
+|*
+\************************************************************************/
+
+class SvxGradientTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ FixedLine aFlProp;
+ FixedText aFtType;
+ ListBox aLbGradientType;
+ FixedText aFtCenterX;
+ MetricField aMtrCenterX;
+ FixedText aFtCenterY;
+ MetricField aMtrCenterY;
+ FixedText aFtAngle;
+ MetricField aMtrAngle;
+ FixedText aFtBorder;
+ MetricField aMtrBorder;
+ FixedText aFtColorFrom;
+ ColorLB aLbColorFrom;
+ MetricField aMtrColorFrom;
+ FixedText aFtColorTo;
+ ColorLB aLbColorTo;
+ MetricField aMtrColorTo;
+ GradientLB aLbGradients;
+ SvxXRectPreview aCtlPreview;
+ PushButton aBtnAdd;
+ PushButton aBtnModify;
+ PushButton aBtnDelete;
+ ImageButton aBtnLoad;
+ ImageButton aBtnSave;
+
+ const SfxItemSet& rOutAttrs;
+
+ XColorTable* pColorTab;
+ XGradientList* pGradientList;
+
+ ChangeType* pnGradientListState;
+ ChangeType* pnColorTableState;
+ USHORT* pPageType;
+ USHORT* pDlgType;
+ USHORT* pPos;
+ BOOL* pbAreaTP;
+
+ XOutdevItemPool* pXPool;
+ XFillStyleItem aXFStyleItem;
+ XFillGradientItem aXGradientItem;
+ XFillAttrSetItem aXFillAttr;
+ SfxItemSet& rXFSet;
+
+#ifdef _SVX_TPGRADNT_CXX
+ DECL_LINK( ClickAddHdl_Impl, void * );
+ DECL_LINK( ClickModifyHdl_Impl, void * );
+ DECL_LINK( ClickDeleteHdl_Impl, void * );
+ DECL_LINK( ChangeGradientHdl_Impl, void * );
+ DECL_LINK( ModifiedHdl_Impl, void * );
+ DECL_LINK( ClickLoadHdl_Impl, void * );
+ DECL_LINK( ClickSaveHdl_Impl, void * );
+
+ long CheckChanges_Impl();
+ void SetControlState_Impl( XGradientStyle eXGS );
+#endif
+
+public:
+ SvxGradientTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ void Construct();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+ void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+ void SetGradientList( XGradientList* pGrdLst)
+ { pGradientList = pGrdLst; }
+
+ void SetPageType( USHORT* pInType ) { pPageType = pInType; }
+ void SetDlgType( USHORT* pInType ) { pDlgType = pInType; }
+ void SetPos( USHORT* pInPos ) { pPos = pInPos; }
+ void SetAreaTP( BOOL* pIn ) { pbAreaTP = pIn; }
+
+ void SetGrdChgd( ChangeType* pIn ) { pnGradientListState = pIn; }
+ void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; }
+};
+
+/*************************************************************************
+|*
+|* Schraffuren-Tab-Page
+|*
+\************************************************************************/
+
+class SvxHatchTabPage : public SvxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ FixedText aFtDistance;
+ MetricField aMtrDistance;
+ FixedText aFtAngle;
+ MetricField aMtrAngle;
+ SvxRectCtl aCtlAngle;
+ FixedLine aFlProp;
+ FixedText aFtLineType;
+ ListBox aLbLineType;
+ FixedText aFtLineColor;
+ ColorLB aLbLineColor;
+ HatchingLB aLbHatchings;
+ SvxXRectPreview aCtlPreview;
+ PushButton aBtnAdd;
+ PushButton aBtnModify;
+ PushButton aBtnDelete;
+ ImageButton aBtnLoad;
+ ImageButton aBtnSave;
+
+ const SfxItemSet& rOutAttrs;
+ RECT_POINT eRP;
+
+ XColorTable* pColorTab;
+ XHatchList* pHatchingList;
+
+ ChangeType* pnHatchingListState;
+ ChangeType* pnColorTableState;
+ USHORT* pPageType;
+ USHORT* pDlgType;
+ USHORT* pPos;
+ BOOL* pbAreaTP;
+
+ XOutdevItemPool* pXPool;
+ XFillStyleItem aXFStyleItem;
+ XFillHatchItem aXHatchItem;
+ XFillAttrSetItem aXFillAttr;
+ SfxItemSet& rXFSet;
+
+ SfxMapUnit ePoolUnit;
+
+#ifdef _SVX_TPHATCH_CXX
+ DECL_LINK( ChangeHatchHdl_Impl, void * );
+ DECL_LINK( ModifiedHdl_Impl, void * );
+ DECL_LINK( ClickAddHdl_Impl, void * );
+ DECL_LINK( ClickModifyHdl_Impl, void * );
+ DECL_LINK( ClickDeleteHdl_Impl, void * );
+ DECL_LINK( ClickLoadHdl_Impl, void * );
+ DECL_LINK( ClickSaveHdl_Impl, void * );
+
+ long CheckChanges_Impl();
+#endif
+
+public:
+ SvxHatchTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ void Construct();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+ virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
+
+ void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+ void SetHatchingList( XHatchList* pHtchLst)
+ { pHatchingList = pHtchLst; }
+
+ void SetPageType( USHORT* pInType ) { pPageType = pInType; }
+ void SetDlgType( USHORT* pInType ) { pDlgType = pInType; }
+ void SetPos( USHORT* pInPos ) { pPos = pInPos; }
+ void SetAreaTP( BOOL* pIn ) { pbAreaTP = pIn; }
+
+ void SetHtchChgd( ChangeType* pIn ) { pnHatchingListState = pIn; }
+ void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; }
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+/*************************************************************************
+|*
+|* Bitmap-Tab-Page
+|*
+\************************************************************************/
+
+class SvxBitmapTabPage : public SvxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ SvxPixelCtl aCtlPixel;
+ FixedText aFtPixelEdit;
+ FixedText aFtColor;
+ ColorLB aLbColor;
+ FixedText aFtBackgroundColor;
+ ColorLB aLbBackgroundColor;
+ FixedText aLbBitmapsHidden;
+ BitmapLB aLbBitmaps;
+ FixedLine aFlProp;
+ SvxXRectPreview aCtlPreview;
+ PushButton aBtnAdd;
+ PushButton aBtnModify;
+ PushButton aBtnImport;
+ PushButton aBtnDelete;
+ ImageButton aBtnLoad;
+ ImageButton aBtnSave;
+
+ SvxBitmapCtl aBitmapCtl;
+
+ const SfxItemSet& rOutAttrs;
+
+ XColorTable* pColorTab;
+ XBitmapList* pBitmapList;
+
+ ChangeType* pnBitmapListState;
+ ChangeType* pnColorTableState;
+ USHORT* pPageType;
+ USHORT* pDlgType;
+ USHORT* pPos;
+ BOOL* pbAreaTP;
+
+ BOOL bBmpChanged;
+
+ XOutdevItemPool* pXPool;
+ XFillStyleItem aXFStyleItem;
+ XFillBitmapItem aXBitmapItem;
+ XFillAttrSetItem aXFillAttr;
+ SfxItemSet& rXFSet;
+
+#ifdef _SVX_TPBITMAP_CXX
+ DECL_LINK( ClickAddHdl_Impl, void * );
+ DECL_LINK( ClickImportHdl_Impl, void * );
+ DECL_LINK( ClickModifyHdl_Impl, void * );
+ DECL_LINK( ClickDeleteHdl_Impl, void * );
+ DECL_LINK( ChangeBitmapHdl_Impl, void * );
+ DECL_LINK( ChangePixelColorHdl_Impl, void * );
+ DECL_LINK( ChangeBackgrndColorHdl_Impl, void * );
+ DECL_LINK( ClickLoadHdl_Impl, void * );
+ DECL_LINK( ClickSaveHdl_Impl, void * );
+
+ long CheckChanges_Impl();
+#endif
+
+public:
+ SvxBitmapTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ void Construct();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+ virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
+
+ void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+ void SetBitmapList( XBitmapList* pBmpLst) { pBitmapList = pBmpLst; }
+
+ void SetPageType( USHORT* pInType ) { pPageType = pInType; }
+ void SetDlgType( USHORT* pInType ) { pDlgType = pInType; }
+ void SetPos( USHORT* pInPos ) { pPos = pInPos; }
+ void SetAreaTP( BOOL* pIn ) { pbAreaTP = pIn; }
+
+ void SetBmpChgd( ChangeType* pIn ) { pnBitmapListState = pIn; }
+ void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; }
+
+ /** Return a label that is associated with the given control. This
+ label is used to the determine the name for the control.
+ @param pLabeled
+ The control for which to return a label.
+ @return
+ Return a label control that provides a name for the specified
+ control.
+ */
+ virtual Window* GetParentLabeledBy( const Window* pLabeled ) const;
+};
+
+/*************************************************************************
+|*
+|* Farben-Tab-Page
+|*
+\************************************************************************/
+
+class SvxColorTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ FixedLine aFlProp;
+ FixedText aFtName;
+ Edit aEdtName;
+ FixedText aFtColor;
+ ColorLB aLbColor;
+
+ FixedText aTableNameFT;
+ ValueSet aValSetColorTable;
+
+ SvxXRectPreview aCtlPreviewOld;
+ SvxXRectPreview aCtlPreviewNew;
+
+ ListBox aLbColorModel;
+ FixedText aFtColorModel1;
+ MetricField aMtrFldColorModel1;
+ FixedText aFtColorModel2;
+ MetricField aMtrFldColorModel2;
+ FixedText aFtColorModel3;
+ MetricField aMtrFldColorModel3;
+
+ FixedText aFtColorModel4;
+ MetricField aMtrFldColorModel4;
+
+ PushButton aBtnAdd;
+ PushButton aBtnModify;
+ PushButton aBtnWorkOn;
+ PushButton aBtnDelete;
+ ImageButton aBtnLoad;
+ ImageButton aBtnSave;
+
+ const SfxItemSet& rOutAttrs;
+
+ XColorTable* pColorTab;
+
+ ChangeType* pnColorTableState;
+ USHORT* pPageType;
+ USHORT* pDlgType;
+ USHORT* pPos;
+ BOOL* pbAreaTP;
+ BOOL bDeleteColorTable;
+
+ XOutdevItemPool* pXPool;
+ XFillStyleItem aXFStyleItem;
+ XFillColorItem aXFillColorItem;
+ XFillAttrSetItem aXFillAttr;
+ SfxItemSet& rXFSet;
+
+ ColorModel eCM;
+
+ Color aAktuellColor;
+
+#ifdef _SVX_TPCOLOR_CXX
+ void ConvertColorValues (Color& rColor, ColorModel eModell);
+ void RgbToCmyk_Impl( Color& rColor, USHORT& rK );
+ void CmykToRgb_Impl( Color& rColor, const USHORT nKey );
+ USHORT ColorToPercent_Impl( USHORT nColor );
+ USHORT PercentToColor_Impl( USHORT nPercent );
+
+ void FillValueSet_Impl( ValueSet& rVs );
+ //-----------------------------------------------------------------------------------------------------
+ DECL_LINK( ClickAddHdl_Impl, void * ); // Button 'Hinzufuegen'
+ DECL_LINK( ClickModifyHdl_Impl, void * ); // Button 'Aendern'
+ DECL_LINK( ClickDeleteHdl_Impl, void * ); // Button 'loeschen'
+ DECL_LINK( ClickWorkOnHdl_Impl, void * ); // Button 'Bearbeiten'
+
+ DECL_LINK( SelectColorLBHdl_Impl, void * ); // Farbe aus Listbox auswählen
+ DECL_LINK( SelectValSetHdl_Impl, void * ); // Farbe aus Farbpalette (links) auswählen
+ DECL_LINK( SelectColorModelHdl_Impl, void * ); // Auswahl Listbox 'Farbmodell'
+ long ChangeColorHdl_Impl( void* p );
+ DECL_LINK( ModifiedHdl_Impl, void * ); // Inhalt der Farbwerte-Felder wurde verändert
+ DECL_LINK( ClickLoadHdl_Impl, void * ); // Button 'Farbtabelle laden'
+ DECL_LINK( ClickSaveHdl_Impl, void * ); // Button 'Farbtabelle sichern'
+
+ long CheckChanges_Impl();
+#endif
+
+public:
+ SvxColorTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ void Construct();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+ void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+
+ void SetPageType( USHORT* pInType ) { pPageType = pInType; }
+ void SetDlgType( USHORT* pInType ) { pDlgType = pInType; }
+ void SetPos( USHORT* pInPos ) { pPos = pInPos; }
+ void SetAreaTP( BOOL* pIn ) { pbAreaTP = pIn; }
+
+ void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; }
+
+ void SetDeleteColorTable( BOOL bIn ) { bDeleteColorTable = bIn; }
+
+ virtual void FillUserData();
+};
+
+
+#endif // _CUI_TAB_AREA_HXX
+
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
new file mode 100644
index 000000000000..d82ad9e3d95e
--- /dev/null
+++ b/cui/source/inc/cuitabline.hxx
@@ -0,0 +1,433 @@
+/*************************************************************************
+ *
+ * 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: cuitabline.hxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CUI_TAB_LINE_HXX
+#define _CUI_TAB_LINE_HXX
+
+// include ---------------------------------------------------------------
+#include <svx/tabline.hxx>
+/*************************************************************************
+|*
+|* Transform-Tab-Dialog
+|*
+\************************************************************************/
+
+class SvxLineTabDialog : public SfxTabDialog
+{
+private:
+ SdrModel* pDrawModel;
+ const SdrObject* pObj;
+
+ const SfxItemSet& rOutAttrs;
+
+ XColorTable* pColorTab;
+ XColorTable* mpNewColorTab;
+ XDashList* pDashList;
+ XDashList* pNewDashList;
+ XLineEndList* pLineEndList;
+ XLineEndList* pNewLineEndList;
+ BOOL bObjSelected;
+
+ ChangeType nLineEndListState;
+ ChangeType nDashListState;
+ ChangeType mnColorTableState;
+
+ USHORT nPageType;
+ USHORT nDlgType;
+ USHORT nPosDashLb;
+ USHORT nPosLineEndLb;
+ USHORT mnPos;
+ BOOL mbAreaTP;
+ BOOL mbDeleteColorTable;
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+
+protected:
+ virtual short Ok();
+#ifdef _SVX_TABLINE_CXX
+ DECL_LINK( CancelHdlImpl, void * );
+ void SavePalettes();
+#endif
+
+public:
+ SvxLineTabDialog( Window* pParent, const SfxItemSet* pAttr,
+ SdrModel* pModel, const SdrObject* pObj = NULL,
+ BOOL bHasObj = TRUE );
+ ~SvxLineTabDialog();
+
+ void SetNewDashList( XDashList* pInLst)
+ { pNewDashList = pInLst; }
+ XDashList* GetNewDashList() const { return pNewDashList; }
+ const XDashList* GetDashList() const { return pDashList; }
+
+ void SetNewLineEndList( XLineEndList* pInLst)
+ { pNewLineEndList = pInLst; }
+ XLineEndList* GetNewLineEndList() const { return pNewLineEndList; }
+ const XLineEndList* GetLineEndList() const { return pLineEndList; }
+
+ void SetNewColorTable( XColorTable* pColTab ) { mpNewColorTab = pColTab; }
+ XColorTable* GetNewColorTable() const { return mpNewColorTab; }
+ const XColorTable* GetColorTable() const { return pColorTab; }
+};
+
+/*************************************************************************
+|*
+|* Linien-Tab-Page
+|*
+\************************************************************************/
+
+class SvxLineTabPage : public SvxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+private:
+ FixedText aFtLineStyle;
+ LineLB aLbLineStyle;
+ FixedText aFtColor;
+ ColorLB aLbColor;
+ FixedText aFtLineWidth;
+ MetricField aMtrLineWidth;
+ FixedText aFtTransparent;
+ MetricField aMtrTransparent;
+ FixedLine aFlLine;
+ FixedText aFtLineEndsStyle;
+ LineEndLB aLbStartStyle;
+ FixedText aFtLineEndsWidth;
+ MetricField aMtrStartWidth;
+ TriStateBox aTsbCenterStart;
+ LineEndLB aLbEndStyle;
+ MetricField aMtrEndWidth;
+ TriStateBox aTsbCenterEnd;
+ CheckBox aCbxSynchronize;
+ FixedLine aFlLineEnds;
+ SvxXLinePreview aCtlPreview;
+ FixedLine aFLSeparator;
+
+ // #116827#
+ FixedLine maFLEdgeStyle;
+ FixedText maFTEdgeStyle;
+ LineEndLB maLBEdgeStyle;
+
+ //#58425# Symbole auf einer Linie (z.B. StarChart) ->
+ SdrObjList* pSymbolList; //a list of symbols to be shown in menu. Symbol at position SID_ATTR_SYMBOLTYPE is to be shown in preview. The list position is to be used cyclic.
+ bool bNewSize;
+ Graphic aAutoSymbolGraphic; //a graphic to be displayed in the preview in case that an automatic symbol is choosen
+ long nNumMenuGalleryItems;
+ long nSymbolType;
+ SfxItemSet* pSymbolAttr; //attributes for the shown symbols; only necessary if not equal to line properties
+ FixedLine aFlSymbol;
+ MenuButton aSymbolMB;
+ FixedText aSymbolWidthFT;
+ MetricField aSymbolWidthMF;
+ FixedText aSymbolHeightFT;
+ MetricField aSymbolHeightMF;
+ CheckBox aSymbolRatioCB;
+ List aGrfNames;
+ List aGrfBrushItems;
+ String sNumCharFmtName;
+ BOOL bLastWidthModified;
+ Size aSymbolLastSize;
+ Graphic aSymbolGraphic;
+ Size aSymbolSize;
+ BOOL bSymbols;
+
+ const SfxItemSet& rOutAttrs;
+ RECT_POINT eRP;
+ BOOL bObjSelected;
+
+ XOutdevItemPool* pXPool;
+ XLineStyleItem aXLStyle;
+ XLineWidthItem aXWidth;
+ XLineDashItem aXDash;
+ XLineColorItem aXColor;
+ XLineAttrSetItem aXLineAttr;
+ SfxItemSet& rXLSet;
+
+ XColorTable* pColorTab;
+ XDashList* pDashList;
+ XLineEndList* pLineEndList;
+
+ ChangeType* pnLineEndListState;
+ ChangeType* pnDashListState;
+ ChangeType* pnColorTableState;
+ UINT16 nPageType; //add CHINA001
+ UINT16 nDlgType; //add CHINA001
+ USHORT* pPosDashLb;
+ USHORT* pPosLineEndLb;
+
+ SfxMapUnit ePoolUnit;
+
+ // #63083#
+ INT32 nActLineWidth;
+
+ //Handler für Gallery-Popup-Menue-Button + Size
+ DECL_LINK( GraphicHdl_Impl, MenuButton * );
+ DECL_LINK( MenuCreateHdl_Impl, MenuButton * );
+ DECL_STATIC_LINK( SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem* );
+ DECL_LINK( SizeHdl_Impl, MetricField * );
+ DECL_LINK( RatioHdl_Impl, CheckBox * );
+ // <- Symbole
+
+#ifdef _SVX_TPLINE_CXX
+ DECL_LINK( ClickInvisibleHdl_Impl, void * );
+ DECL_LINK( ChangeStartHdl_Impl, void * );
+ DECL_LINK( ChangeEndHdl_Impl, void * );
+ DECL_LINK( ChangePreviewHdl_Impl, void * );
+ DECL_LINK( ChangeTransparentHdl_Impl, void * );
+
+ // #116827#
+ DECL_LINK( ChangeEdgeStyleHdl_Impl, void * );
+
+ BOOL FillXLSet_Impl();
+#endif
+
+ void FillListboxes();
+public:
+
+ void ShowSymbolControls(BOOL bOn);
+
+ SvxLineTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxLineTabPage();
+
+ void Construct();
+
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+ virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
+
+ virtual void FillUserData();
+
+ void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+ void SetDashList( XDashList* pDshLst ) { pDashList = pDshLst; }
+ void SetLineEndList( XLineEndList* pLneEndLst) { pLineEndList = pLneEndLst; }
+ void SetObjSelected( BOOL bHasObj ) { bObjSelected = bHasObj; }
+
+ void SetPageType( UINT16 nInType ) { nPageType = nInType; }//CHINA001 void SetPageType( USHORT* pInType ) { pPageType = pInType; }
+ void SetDlgType( UINT16 nInType ) { nDlgType = nInType; } //CHINA001 void SetDlgType( USHORT* pInType ) { pDlgType = pInType; }
+ void SetPosDashLb( USHORT* pInPos ) { pPosDashLb = pInPos; }
+ void SetPosLineEndLb( USHORT* pInPos ) { pPosLineEndLb = pInPos; }
+
+ void SetLineEndChgd( ChangeType* pIn ) { pnLineEndListState = pIn; }
+ void SetDashChgd( ChangeType* pIn ) { pnDashListState = pIn; }
+ void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; }
+
+ virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+/*************************************************************************
+|*
+|* Linien-Definitions-Tab-Page
+|*
+\************************************************************************/
+
+class SvxLineDefTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+private:
+ FixedLine aFlDefinition;
+ FixedText aFTLinestyle;
+ LineLB aLbLineStyles;
+ FixedText aFtType;
+ ListBox aLbType1;
+ ListBox aLbType2;
+ FixedText aFtNumber;
+ NumericField aNumFldNumber1;
+ NumericField aNumFldNumber2;
+ FixedText aFtLength;
+ MetricField aMtrLength1;
+ MetricField aMtrLength2;
+ FixedText aFtDistance;
+ MetricField aMtrDistance;
+ CheckBox aCbxSynchronize;
+ PushButton aBtnAdd;
+ PushButton aBtnModify;
+ PushButton aBtnDelete;
+ ImageButton aBtnLoad;
+ ImageButton aBtnSave;
+ SvxXLinePreview aCtlPreview;
+
+ const SfxItemSet& rOutAttrs;
+ XDash aDash;
+ BOOL bObjSelected;
+
+ XOutdevItemPool* pXPool;
+ XLineStyleItem aXLStyle;
+ XLineWidthItem aXWidth;
+ XLineDashItem aXDash;
+ XLineColorItem aXColor;
+ XLineAttrSetItem aXLineAttr;
+ SfxItemSet& rXLSet;
+
+ XDashList* pDashList;
+
+ ChangeType* pnDashListState;
+ USHORT* pPageType;
+ USHORT* pDlgType;
+ USHORT* pPosDashLb;
+
+ SfxMapUnit ePoolUnit;
+ FieldUnit eFUnit;
+
+#ifdef _SVX_TPLNEDEF_CXX
+ void FillDash_Impl();
+ void FillDialog_Impl();
+
+ DECL_LINK( ClickAddHdl_Impl, void * );
+ DECL_LINK( ClickModifyHdl_Impl, void * );
+ DECL_LINK( ClickDeleteHdl_Impl, void * );
+ DECL_LINK( SelectLinestyleHdl_Impl, void * );
+ DECL_LINK( ChangePreviewHdl_Impl, void * );
+ DECL_LINK( ChangeNumber1Hdl_Impl, void * );
+ DECL_LINK( ChangeNumber2Hdl_Impl, void * );
+ DECL_LINK( ClickLoadHdl_Impl, void * );
+ DECL_LINK( ClickSaveHdl_Impl, void * );
+ DECL_LINK( ChangeMetricHdl_Impl, void * );
+ DECL_LINK( SelectTypeHdl_Impl, void * );
+
+ void CheckChanges_Impl();
+#endif
+
+public:
+ SvxLineDefTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ void Construct();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+ void SetDashList( XDashList* pDshLst ) { pDashList = pDshLst; }
+ void SetObjSelected( BOOL bHasObj ) { bObjSelected = bHasObj; }
+
+ void SetPageType( USHORT* pInType ) { pPageType = pInType; }
+ void SetDlgType( USHORT* pInType ) { pDlgType = pInType; }
+ void SetPosDashLb( USHORT* pInPos ) { pPosDashLb = pInPos; }
+
+ void SetDashChgd( ChangeType* pIn ) { pnDashListState = pIn; }
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+/*************************************************************************
+|*
+|* Linienenden-Definitions-Tab-Page
+|*
+\************************************************************************/
+
+class SvxLineEndDefTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ FixedLine aFlTip;
+ FixedText aFTTitle;
+ Edit aEdtName;
+ FixedText aFTLineEndStyle;
+ LineEndLB aLbLineEnds;
+ PushButton aBtnAdd;
+ PushButton aBtnModify;
+ PushButton aBtnDelete;
+ ImageButton aBtnLoad;
+ ImageButton aBtnSave;
+ FixedInfo aFiTip;
+ SvxXLinePreview aCtlPreview;
+
+ const SfxItemSet& rOutAttrs;
+ const SdrObject* pPolyObj;
+ BOOL bObjSelected;
+
+ XOutdevItemPool* pXPool;
+ XLineStyleItem aXLStyle;
+ XLineWidthItem aXWidth;
+ XLineColorItem aXColor;
+ XLineAttrSetItem aXLineAttr;
+ SfxItemSet& rXLSet;
+
+ XLineEndList* pLineEndList;
+
+ ChangeType* pnLineEndListState;
+ USHORT* pPageType;
+ USHORT* pDlgType;
+ USHORT* pPosLineEndLb;
+
+#ifdef _SVX_TPLNEEND_CXX
+ DECL_LINK( ClickAddHdl_Impl, void * );
+ DECL_LINK( ClickModifyHdl_Impl, void * );
+ DECL_LINK( ClickDeleteHdl_Impl, void * );
+ DECL_LINK( ClickLoadHdl_Impl, void * );
+ DECL_LINK( ClickSaveHdl_Impl, void * );
+ DECL_LINK( SelectLineEndHdl_Impl, void * );
+ long ChangePreviewHdl_Impl( void* p );
+
+ void CheckChanges_Impl();
+#endif
+
+public:
+ SvxLineEndDefTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+ ~SvxLineEndDefTabPage();
+
+ void Construct();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+ void SetLineEndList( XLineEndList* pInList ) { pLineEndList = pInList; }
+ void SetPolyObj( const SdrObject* pObj ) { pPolyObj = pObj; }
+ void SetObjSelected( BOOL bHasObj ) { bObjSelected = bHasObj; }
+
+ void SetPageType( USHORT* pInType ) { pPageType = pInType; }
+ void SetDlgType( USHORT* pInType ) { pDlgType = pInType; }
+ void SetPosLineEndLb( USHORT* pInPos ) { pPosLineEndLb = pInPos; }
+
+ void SetLineEndChgd( ChangeType* pIn ) { pnLineEndListState = pIn; }
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+
+#endif // _CUI_TAB_LINE_HXX
+
diff --git a/cui/source/inc/cuitbxform.hxx b/cui/source/inc/cuitbxform.hxx
new file mode 100644
index 000000000000..1587dd7baaf5
--- /dev/null
+++ b/cui/source/inc/cuitbxform.hxx
@@ -0,0 +1,29 @@
+#ifndef _CUI_TBXFORM_HXX
+#define _CUI_TBXFORM_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include <vcl/field.hxx>
+#include <vcl/dialog.hxx>
+
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+//========================================================================
+
+class FmInputRecordNoDialog : public ModalDialog
+{
+public:
+ FixedText m_aLabel;
+ NumericField m_aRecordNo;
+ OKButton m_aOk;
+ CancelButton m_aCancel;
+
+public:
+ FmInputRecordNoDialog(Window * pParent);
+
+ void SetValue(long dNew) { m_aRecordNo.SetValue(dNew); }
+ long GetValue() const { return static_cast<long>(m_aRecordNo.GetValue()); }
+};
+
+#endif
diff --git a/cui/source/inc/dbregister.hxx b/cui/source/inc/dbregister.hxx
new file mode 100644
index 000000000000..00cf4cc911c2
--- /dev/null
+++ b/cui/source/inc/dbregister.hxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * 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: dbregister.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_DBREGISTER_HXX
+#define SVX_DBREGISTER_HXX
+
+#include "optpath.hxx"
+#include <tools/string.hxx>
+#include <comphelper/stl_types.hxx>
+#include <svl/poolitem.hxx>
+#include "ControlFocusHelper.hxx"
+#include <sfx2/basedlgs.hxx>
+
+class SvLBoxEntry;
+namespace svx
+{
+ class OptHeaderTabListBox;
+}
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= DbRegistrationOptionsPage
+ //====================================================================
+ class DbRegistrationOptionsPage : public SfxTabPage
+ {
+ private:
+ FixedText aTypeText;
+ FixedText aPathText;
+ SvxControlFocusHelper aPathCtrl;
+ PushButton m_aNew;
+ PushButton m_aEdit;
+ PushButton m_aDelete;
+ FixedLine aStdBox;
+
+ HeaderBar* pHeaderBar;
+ ::svx::OptHeaderTabListBox* pPathBox;
+ SvLBoxEntry* m_pCurEntry;
+ ULONG m_nOldCount;
+ BOOL m_bModified;
+
+
+#ifdef SVX_DBREGISTER_HXX
+ DECL_LINK( NewHdl, void * );
+ DECL_LINK( EditHdl, void * );
+ DECL_LINK( DeleteHdl, void * );
+
+ DECL_LINK( PathSelect_Impl, SvTabListBox* );
+
+ DECL_LINK( HeaderSelect_Impl, HeaderBar * );
+ DECL_LINK( HeaderEndDrag_Impl, HeaderBar * );
+ DECL_LINK( NameValidator, String*);
+
+
+ /** inserts a new entry in the tablistbox
+ @param _sName
+ The name of the entry.
+ @param _sLocation
+ The location of the file.
+ */
+ void insertNewEntry(const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation);
+
+ /** opens the LinkDialog to create a register pair
+ @param _sOldName
+ The old name of the entry may be empty.
+ @param _sOldLocation
+ The old location of the entry may be empty.
+ @param _pEntry
+ The entry to remove if the entry will be changed
+ */
+ void openLinkDialog(const String& _sOldName,const String& _sOldLocation,SvLBoxEntry* _pEntry = NULL);
+
+ /** opens a file pciker to select a database file
+ @param _sLocation
+ If set, the file picker use it as default directory
+ @return
+ the location of the database file
+ */
+ String getFileLocation(const String& _sLocation);
+#endif
+
+ public:
+ DbRegistrationOptionsPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~DbRegistrationOptionsPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void FillUserData();
+ };
+
+ //====================================================================
+ //= RegistrationItemSetHolder
+ //====================================================================
+ /** helper for DatabaseRegistrationDialog
+
+ Necessary so that DatabaseRegistrationDialog is self-contained, i.e. always reflects
+ the current registration state.
+ */
+ class RegistrationItemSetHolder
+ {
+ private:
+ SfxItemSet m_aRegistrationItems;
+
+ protected:
+ RegistrationItemSetHolder( const SfxItemSet& _rMasterSet );
+ ~RegistrationItemSetHolder();
+
+ protected:
+ const SfxItemSet& getRegistrationItems() const { return m_aRegistrationItems; }
+ };
+
+ //====================================================================
+ //= DatabaseRegistrationDialog
+ //====================================================================
+ class DatabaseRegistrationDialog :public RegistrationItemSetHolder
+ ,public SfxSingleTabDialog
+ {
+ public:
+ DatabaseRegistrationDialog( Window* pParent, const SfxItemSet& rAttr );
+ ~DatabaseRegistrationDialog();
+
+ virtual short Execute();
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_DBREGISTER_HXX
+
+
diff --git a/cui/source/inc/defdlgname.hxx b/cui/source/inc/defdlgname.hxx
new file mode 100644
index 000000000000..1fcc17b1f41a
--- /dev/null
+++ b/cui/source/inc/defdlgname.hxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * 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: defdlgname.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DEF_DLG_NAME_HXX
+#define _SVX_DEF_DLG_NAME_HXX
+
+// define ----------------------------------------------------------------
+
+#define MESS_BTN_1 ((USHORT)0)
+#define MESS_BTN_2 ((USHORT)1)
+
+// const -----------------------------------------------------------------
+
+const short RET_BTN_1 = 100;
+const short RET_BTN_2 = 101;
+
+#endif
diff --git a/cui/source/inc/dlgname.hxx b/cui/source/inc/dlgname.hxx
new file mode 100644
index 000000000000..ee78927e8931
--- /dev/null
+++ b/cui/source/inc/dlgname.hxx
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * 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: dlgname.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DLG_NAME_HXX
+#define _SVX_DLG_NAME_HXX
+
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+#include <vcl/fixed.hxx>
+
+// #i68101#
+#include <svtools/svmedit.hxx>
+
+/*************************************************************************
+|*
+|* Dialog zum Editieren eines Namens
+|*
+\************************************************************************/
+class SvxNameDialog : public ModalDialog
+{
+private:
+ FixedText aFtDescription;
+ Edit aEdtName;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ Link aCheckNameHdl;
+#if _SOLAR__PRIVATE
+ DECL_LINK(ModifyHdl, Edit*);
+#endif
+
+public:
+ SvxNameDialog( Window* pWindow, const String& rName, const String& rDesc );
+
+ void GetName( String& rName ){rName = aEdtName.GetText();}
+
+ /** add a callback Link that is called whenever the content of the edit
+ field is changed. The Link result determines wether the OK
+ Button is enabled (> 0) or disabled (== 0).
+
+ @param rLink a Callback declared with DECL_LINK and implemented with
+ IMPL_LINK, that is executed on modification.
+
+ @param bCheckImmediately If true, the Link is called directly after
+ setting it. It is recommended to set this flag to true to avoid
+ an inconsistent state if the initial String (given in the CTOR)
+ does not satisfy the check condition.
+
+ @todo Remove the parameter bCheckImmediately and incorporate the 'true'
+ behaviour as default.
+ */
+ void SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false )
+ {
+ aCheckNameHdl = rLink;
+ if ( bCheckImmediately )
+ aBtnOK.Enable( rLink.Call( this ) > 0 );
+ }
+
+ void SetEditHelpId(ULONG nHelpId) {aEdtName.SetHelpId(nHelpId);}
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+// #i68101#
+// Dialog for editing Object Title and Description
+// plus uniqueness-callback-linkHandler
+
+class SvxObjectNameDialog : public ModalDialog
+{
+private:
+ // name
+ FixedText aFtName;
+ Edit aEdtName;
+
+ // separator
+ FixedLine aFlSeparator;
+
+ // buttons
+ HelpButton aBtnHelp;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+
+ // callback link for name uniqueness
+ Link aCheckNameHdl;
+#if _SOLAR__PRIVATE
+ DECL_LINK(ModifyHdl, Edit*);
+#endif
+
+public:
+ // constructor
+ SvxObjectNameDialog(Window* pWindow, const String& rName);
+
+ // data access
+ void GetName(String& rName) {rName = aEdtName.GetText(); }
+
+ // set handler
+ void SetCheckNameHdl(const Link& rLink, bool bCheckImmediately = false)
+ {
+ aCheckNameHdl = rLink;
+
+ if(bCheckImmediately)
+ {
+ aBtnOK.Enable(rLink.Call(this) > 0);
+ }
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+// #i68101#
+// Dialog for editing Object Title and Description
+
+class SvxObjectTitleDescDialog : public ModalDialog
+{
+private:
+ // title
+ FixedText aFtTitle;
+ Edit aEdtTitle;
+
+ // description
+ FixedText aFtDescription;
+ MultiLineEdit aEdtDescription;
+
+ // separator
+ FixedLine aFlSeparator;
+
+ // buttons
+ HelpButton aBtnHelp;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+
+public:
+ // constructor
+ SvxObjectTitleDescDialog(Window* pWindow, const String& rTitle, const String& rDesc);
+
+ // data access
+ void GetTitle(String& rTitle) {rTitle = aEdtTitle.GetText(); }
+ void GetDescription(String& rDescription) {rDescription = aEdtDescription.GetText(); }
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+/*************************************************************************
+|*
+|* Dialog zum Abbrechen, Speichern oder Hinzufuegen
+|*
+\************************************************************************/
+class SvxMessDialog : public ModalDialog
+{
+private:
+ FixedText aFtDescription;
+ PushButton aBtn1;
+ PushButton aBtn2;
+ CancelButton aBtnCancel;
+ FixedImage aFtImage;
+ Image* pImage;
+#if _SOLAR__PRIVATE
+ DECL_LINK( Button1Hdl, Button * );
+ DECL_LINK( Button2Hdl, Button * );
+#endif
+public:
+ SvxMessDialog( Window* pWindow, const String& rText, const String& rDesc, Image* pImg = NULL );
+ ~SvxMessDialog();
+
+ void SetButtonText( USHORT nBtnId, const String& rNewTxt );
+};
+
+
+
+#endif // _SVX_DLG_NAME_HXX
+
diff --git a/cui/source/inc/dstribut.hxx b/cui/source/inc/dstribut.hxx
new file mode 100644
index 000000000000..46d6a78115c1
--- /dev/null
+++ b/cui/source/inc/dstribut.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * 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: dstribut.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DSTRIBUT_HXX
+#define _SVX_DSTRIBUT_HXX
+
+#include <svx/dlgctrl.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <svx/dstribut_enum.hxx> //CHINA001
+/*************************************************************************
+|*
+\************************************************************************/
+
+/*
+enum SvxDistributeHorizontal
+{
+ SvxDistributeHorizontalNone = 0,
+ SvxDistributeHorizontalLeft,
+ SvxDistributeHorizontalCenter,
+ SvxDistributeHorizontalDistance,
+ SvxDistributeHorizontalRight
+};
+
+enum SvxDistributeVertical
+{
+ SvxDistributeVerticalNone = 0,
+ SvxDistributeVerticalTop,
+ SvxDistributeVerticalCenter,
+ SvxDistributeVerticalDistance,
+ SvxDistributeVerticalBottom
+};
+*/
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+class SvxDistributePage : public SvxTabPage
+{
+ SvxDistributeHorizontal meDistributeHor;
+ SvxDistributeVertical meDistributeVer;
+
+ FixedLine maFlHorizontal ;
+ RadioButton maBtnHorNone ;
+ RadioButton maBtnHorLeft ;
+ RadioButton maBtnHorCenter ;
+ RadioButton maBtnHorDistance ;
+ RadioButton maBtnHorRight ;
+ FixedImage maHorLow ;
+ FixedImage maHorCenter ;
+ FixedImage maHorDistance ;
+ FixedImage maHorHigh ;
+ FixedLine maFlVertical ;
+ RadioButton maBtnVerNone ;
+ RadioButton maBtnVerTop ;
+ RadioButton maBtnVerCenter ;
+ RadioButton maBtnVerDistance ;
+ RadioButton maBtnVerBottom ;
+ FixedImage maVerLow ;
+ FixedImage maVerCenter ;
+ FixedImage maVerDistance ;
+ FixedImage maVerHigh ;
+
+public:
+ SvxDistributePage(Window* pWindow, const SfxItemSet& rInAttrs,
+ SvxDistributeHorizontal eHor = SvxDistributeHorizontalNone,
+ SvxDistributeVertical eVer = SvxDistributeVerticalNone);
+ ~SvxDistributePage();
+
+ static SfxTabPage* Create(Window*, const SfxItemSet&,
+ SvxDistributeHorizontal eHor, SvxDistributeVertical eVer);
+ static UINT16* GetRanges();
+ virtual BOOL FillItemSet(SfxItemSet&);
+ virtual void Reset(const SfxItemSet&);
+ virtual void PointChanged(Window* pWindow, RECT_POINT eRP);
+
+ SvxDistributeHorizontal GetDistributeHor() const { return meDistributeHor; }
+ SvxDistributeVertical GetDistributeVer() const { return meDistributeVer; }
+};
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+class SvxDistributeDialog : public SfxSingleTabDialog
+{
+ SvxDistributePage* mpPage;
+
+public:
+ SvxDistributeDialog(Window* pParent, const SfxItemSet& rAttr,
+ SvxDistributeHorizontal eHor = SvxDistributeHorizontalNone,
+ SvxDistributeVertical eVer = SvxDistributeVerticalNone);
+ ~SvxDistributeDialog();
+
+ SvxDistributeHorizontal GetDistributeHor() const { return mpPage->GetDistributeHor(); }
+ SvxDistributeVertical GetDistributeVer() const { return mpPage->GetDistributeVer(); }
+};
+
+
+#endif // _SVX_DSTRIBUT_HXX
+
diff --git a/cui/source/inc/gallery.hrc b/cui/source/inc/gallery.hrc
new file mode 100644
index 000000000000..9a0daf6a8c2f
--- /dev/null
+++ b/cui/source/inc/gallery.hrc
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * 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: gallery.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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>
+
+// Gallery-TabDialoge/-TabPages
+#define RID_SVXTABDLG_GALLERY (RID_SVX_GALLERY_START )
+#define RID_SVXTABDLG_GALLERYTHEME (RID_SVX_GALLERY_START + 2)
+#define RID_SVXDLG_GALLERY_TITLE (RID_SVX_GALLERY_START + 82)
+
+#define RID_SVXTABPAGE_GALLERY_GENERAL (RID_SVX_GALLERY_START + 1)
+#define RID_SVXTABPAGE_GALLERYTHEME_FILES (RID_SVX_GALLERY_START + 4)
+
+// Dialoge
+#define RID_SVXDLG_GALLERY_SEARCH_PROGRESS (RID_SVX_GALLERY_START + 6)
+#define RID_SVXDLG_GALLERY_TAKE_PROGRESS (RID_SVX_GALLERY_START + 7)
+#define RID_SVXDLG_GALLERY_ACTUALIZE_PROGRESS (RID_SVX_GALLERY_START + 8)
+#define RID_SVXDLG_GALLERY_THEMEID (RID_SVX_GALLERY_START + 9)
+
+// Gallery-Strings
+#define RID_SVXSTR_GALLERY_NOFILES (RID_SVX_GALLERY_START + 12)
+#define RID_SVXSTR_GALLERY_SEARCH (RID_SVX_GALLERY_START + 30)
+#define RID_SVXSTR_GALLERYPROPS_OBJECT (RID_SVX_GALLERY_START + 39)
+#define RID_SVXSTR_GALLERYPROPS_GALTHEME (RID_SVX_GALLERY_START + 40)
+#define RID_SVXSTR_GALLERY_READONLY (RID_SVX_GALLERY_START + 43)
+#define RID_SVXSTR_GALLERY_ALLFILES (RID_SVX_GALLERY_START + 44)
+#define RID_SVXSTR_GALLERY_ID_EXISTS (RID_SVX_GALLERY_START + 81)
+
+// Images
+#define RID_SVXBMP_THEME_NORMAL_BIG (RID_SVX_GALLERY_START + 49)
+#define RID_SVXBMP_THEME_IMPORTED_BIG (RID_SVX_GALLERY_START + 51)
+#define RID_SVXBMP_THEME_READONLY_BIG (RID_SVX_GALLERY_START + 53)
+#define RID_SVXBMP_THEME_DEFAULT_BIG (RID_SVX_GALLERY_START + 55)
+
+// lokale Defines
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+
+#define LBX_FOUND 1
+#define BTN_TAKE 5
+#define BTN_SEARCH 4
+#define CBX_PREVIEW 3
+#define FT_FILETYPE 2
+#define CBB_FILETYPE 1
+#define FL_SEARCH_DIR 1
+#define FL_SEARCH_TYPE 2
+#define FT_SEARCH_DIR 1
+#define FT_SEARCH_TYPE 2
+#define FL_TAKE_PROGRESS 1
+#define FT_TAKE_FILE 1
+#define BTN_TAKEALL 1
+#define WND_BRSPRV 1
+#define BTN_MADDIN1 8
+#define BTN_MADDIN2 9
+
+#define FL_ACTUALIZE_PROGRESS 1
+#define FT_ACTUALIZE_FILE 1
+#define FL_ID 1
+#define LB_RESNAME 1
+#define EDT_TITLE 20
+#define FL_TITLE 21
+
+// Gallery-TabDialog
+#define FI_MS_IMAGE 1
+#define EDT_MS_NAME 1
+#define FL_MS_GENERAL_FIRST 1
+#define FT_MS_TYPE 2
+#define FT_MS_SHOW_TYPE 3
+#define FT_MS_PATH 4
+#define FT_MS_SHOW_PATH 5
+#define FT_MS_CONTENT 6
+#define FT_MS_SHOW_CONTENT 7
+#define FL_MS_GENERAL_SECOND 2
+#define FT_MS_CHANGEDATE 10
+#define FT_MS_SHOW_CHANGEDATE 11
+
+
diff --git a/cui/source/inc/grfpage.hxx b/cui/source/inc/grfpage.hxx
new file mode 100644
index 000000000000..58ce4e5a5e63
--- /dev/null
+++ b/cui/source/inc/grfpage.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: grfpage.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_GRFPAGE_HXX
+#define _SVX_GRFPAGE_HXX
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#include <vcl/graph.hxx>
+#include <sfx2/tabdlg.hxx>
+
+
+class SvxGrfCropPage : public SfxTabPage
+{
+ using Window::CalcZoom;
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+ class SvxCropExample : public Window
+ {
+ Size aFrameSize;
+ Point aTopLeft, aBottomRight;
+ Graphic aGrf;
+
+ public:
+ SvxCropExample( Window* pPar, const ResId& rResId );
+
+ virtual void Paint( const Rectangle& rRect );
+
+ void SetTopLeft( const Point& rNew ) { aTopLeft = rNew; }
+ void SetTop( long nVal ) { aTopLeft.X() = nVal; }
+ void SetBottom( long nVal ) { aBottomRight.X() = nVal; }
+ void SetLeft( long nVal ) { aTopLeft.Y() = nVal; }
+ void SetRight( long nVal) { aBottomRight.Y() = nVal; }
+ void SetBottomRight(const Point& rNew ) { aBottomRight = rNew; }
+ void SetFrameSize( const Size& rSz );
+ void SetGraphic( const Graphic& rGrf ) { aGrf = rGrf; }
+ const Graphic& GetGraphic() const { return aGrf; }
+ };
+
+ FixedLine aCropFL;
+ RadioButton aZoomConstRB;
+ RadioButton aSizeConstRB;
+ FixedText aLeftFT;
+ MetricField aLeftMF;
+ FixedText aRightFT;
+ MetricField aRightMF;
+ FixedText aTopFT;
+ MetricField aTopMF;
+ FixedText aBottomFT;
+ MetricField aBottomMF;
+
+ FixedLine aZoomFL;
+ FixedText aWidthZoomFT;
+ MetricField aWidthZoomMF;
+ FixedText aHeightZoomFT;
+ MetricField aHeightZoomMF;
+
+ FixedLine aSizeFL;
+ FixedText aWidthFT;
+ MetricField aWidthMF;
+ FixedText aHeightFT;
+ MetricField aHeightMF;
+ FixedText aOrigSizeFT;
+ PushButton aOrigSizePB;
+
+ // Example
+ SvxCropExample aExampleWN;
+
+
+ Timer aTimer;
+ String aGraphicName;
+ Size aOrigSize;
+ Size aPageSize;
+ const MetricField* pLastCropField;
+ long nOldWidth;
+ long nOldHeight;
+ BOOL bReset;
+ BOOL bInitialized;
+ BOOL bSetOrigSize;
+
+
+ SvxGrfCropPage( Window *pParent, const SfxItemSet &rSet );
+ virtual ~SvxGrfCropPage();
+
+ DECL_LINK( ZoomHdl, MetricField * );
+ DECL_LINK( SizeHdl, MetricField * );
+ DECL_LINK( CropHdl, const MetricField * );
+ DECL_LINK( CropLoseFocusHdl, MetricField * );
+ DECL_LINK( CropModifyHdl, MetricField * );
+ DECL_LINK( OrigSizeHdl, PushButton * );
+ DECL_LINK( Timeout, Timer * );
+
+ void CalcZoom();
+ void CalcMinMaxBorder();
+ void GraphicHasChanged(BOOL bFound);
+ virtual void ActivatePage(const SfxItemSet& rSet);
+
+ Size GetGrfOrigSize( const Graphic& ) const;
+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 );
+};
+
+
+#endif
diff --git a/cui/source/inc/hangulhanjadlg.hxx b/cui/source/inc/hangulhanjadlg.hxx
new file mode 100644
index 000000000000..6c87b8003479
--- /dev/null
+++ b/cui/source/inc/hangulhanjadlg.hxx
@@ -0,0 +1,353 @@
+/*************************************************************************
+ *
+ * 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: hangulhanjadlg.hxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SVX_HANGUL_HANJA_DLG_HXX
+#define SVX_HANGUL_HANJA_DLG_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/scrbar.hxx>
+#include <svx/checklbx.hxx>
+#include <svx/hangulhanja.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <svx/unolingu.hxx>
+#include <com/sun/star/linguistic2/XConversionDictionaryList.hpp>
+#include <svtools/valueset.hxx>
+
+#include <vector>
+#include <memory> // for auto_ptr
+
+class SvxCommonLinguisticControl;
+//.............................................................................
+namespace svx
+{
+//.............................................................................
+
+ //=========================================================================
+ //= HangulHanjaConversionDialog
+ //=========================================================================
+
+ class SuggestionSet : public ValueSet
+ {
+ public:
+ SuggestionSet( Window* pParent );
+ virtual ~SuggestionSet();
+
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+ void ClearSet();
+ };
+
+ class SuggestionDisplay : public Control
+ {
+ public:
+ SuggestionDisplay( Window* pParent, const ResId& rResId );
+ virtual ~SuggestionDisplay();
+
+ void DisplayListBox( bool bDisplayListBox );
+
+ void SetSelectHdl( const Link& rLink );
+
+ void Clear();
+ void InsertEntry( const XubString& rStr );
+ void SelectEntryPos( USHORT nPos );
+
+ USHORT GetEntryCount() const;
+
+ XubString GetEntry( USHORT nPos ) const;
+ XubString GetSelectEntry() const;
+
+ virtual void StateChanged( StateChangedType nStateChange );
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void KeyUp( const KeyEvent& rKEvt );
+ virtual void Activate();
+ virtual void Deactivate();
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void Command( const CommandEvent& rCEvt );
+
+ DECL_LINK( SelectSuggestionHdl, Control* );
+
+ void SetHelpIds();
+
+ private:
+ void implUpdateDisplay();
+ Control& implGetCurrentControl();
+
+ private:
+ bool m_bDisplayListBox;//otherwise ValueSet
+ SuggestionSet m_aValueSet;
+ ListBox m_aListBox;
+
+ Link m_aSelectLink;
+ bool m_bInSelectionUpdate;
+ };
+
+ class HangulHanjaConversionDialog : public ModalDialog
+ {
+ private:
+ ::std::auto_ptr< SvxCommonLinguisticControl >
+ m_pPlayground; // order matters: before all other controls!
+
+ PushButton m_aFind;
+ SuggestionDisplay m_aSuggestions;
+ FixedText m_aFormat;
+ RadioButton m_aSimpleConversion;
+ RadioButton m_aHangulBracketed;
+ RadioButton m_aHanjaBracketed;
+ ::std::auto_ptr< RadioButton > m_pHanjaAbove;
+ ::std::auto_ptr< RadioButton > m_pHanjaBelow;
+ ::std::auto_ptr< RadioButton > m_pHangulAbove;
+ ::std::auto_ptr< RadioButton > m_pHangulBelow;
+ FixedText m_aConversion;
+ CheckBox m_aHangulOnly;
+ CheckBox m_aHanjaOnly;
+ CheckBox m_aReplaceByChar;
+
+ CheckBox* m_pIgnoreNonPrimary;
+ bool m_bDocumentMode;
+ // are we working for a document? This is normally true, but in case
+ // the user uses the "find" functionality, we switch to working
+ // with what the user entered, which then does not have any relation to
+ // the document anymore. Some functionality must be disabled then
+
+ Link m_aOptionsChangedLink;
+ Link m_aClickByCharacterLink;
+
+ public:
+ HangulHanjaConversionDialog(
+ Window* _pParent,
+ HangulHanjaConversion::ConversionDirection _ePrimaryDirection );
+ ~HangulHanjaConversionDialog( );
+
+ public:
+ void SetOptionsChangedHdl( const Link& _rHdl );
+ void SetIgnoreHdl( const Link& _rHdl );
+ void SetIgnoreAllHdl( const Link& _rHdl );
+ void SetChangeHdl( const Link& _rHdl );
+ void SetChangeAllHdl( const Link& _rHdl );
+ void SetOptionsHdl( const Link& _rHdl );
+
+ void SetClickByCharacterHdl( const Link& _rHdl );
+ void SetConversionFormatChangedHdl( const Link& _rHdl );
+ void SetFindHdl( const Link& _rHdl );
+
+ String GetCurrentString( ) const;
+ void SetCurrentString(
+ const String& _rNewString,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rSuggestions,
+ bool _bOriginatesFromDocument = true
+ );
+
+ void FocusSuggestion( );
+
+ // retrieves the current suggestion
+ String GetCurrentSuggestion( ) const;
+
+ void SetConversionFormat( HangulHanjaConversion::ConversionFormat _eType );
+ HangulHanjaConversion::ConversionFormat GetConversionFormat( ) const;
+
+ void SetByCharacter( sal_Bool _bByCharacter );
+ sal_Bool GetByCharacter( ) const;
+
+ void SetConversionDirectionState( sal_Bool _bTryBothDirections, HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection );
+
+ // should text which does not match the primary conversion direction be ignored?
+ sal_Bool GetUseBothDirections( ) const;
+
+ // get current conversion direction to use
+ // (return argument if GetUseBothDirections is true)
+ HangulHanjaConversion::ConversionDirection GetDirection( HangulHanjaConversion::ConversionDirection eDefaultDirection ) const;
+
+ // enables or disbales the checkboxes for ruby formatted replacements
+ void EnableRubySupport( sal_Bool bVal );
+
+ private:
+ DECL_LINK( OnClose, void* );
+ DECL_LINK( OnOption, void* );
+ DECL_LINK( OnSuggestionModified, void* );
+ DECL_LINK( OnSuggestionSelected, void* );
+ DECL_LINK( OnConversionDirectionClicked, CheckBox* );
+ DECL_LINK( ClickByCharacterHdl, CheckBox* );
+
+ // fill the suggestion list box with suggestions for the actual input
+ void FillSuggestions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rSuggestions );
+ };
+
+
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionary > > HHDictList;
+
+ class HangulHanjaOptionsDialog : public ModalDialog
+ {
+ private:
+ FixedText m_aUserdefdictFT;
+ SvxCheckListBox m_aDictsLB;
+ FixedLine m_aOptionsFL;
+ CheckBox m_aIgnorepostCB;
+ CheckBox m_aShowrecentlyfirstCB;
+ CheckBox m_aAutoreplaceuniqueCB;
+ PushButton m_aNewPB;
+ PushButton m_aEditPB;
+ PushButton m_aDeletePB;
+ OKButton m_aOkPB;
+ CancelButton m_aCancelPB;
+ HelpButton m_aHelpPB;
+
+ SvLBoxButtonData* m_pCheckButtonData;
+
+ HHDictList m_aDictList;
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionaryList > m_xConversionDictionaryList;
+
+ DECL_LINK( OkHdl, void* );
+ DECL_LINK( OnNew, void* );
+ DECL_LINK( OnEdit, void* );
+ DECL_LINK( OnDelete, void* );
+ DECL_LINK( DictsLB_SelectHdl, void* );
+ DECL_LINK( NewDictHdl, void* );
+ DECL_LINK( EditDictHdl, void* );
+ DECL_LINK( DeleteDictHdl, void* );
+
+ void Init( void ); // reads settings from core and init controls
+ public:
+ HangulHanjaOptionsDialog( Window* _pParent );
+ virtual ~HangulHanjaOptionsDialog();
+
+ void AddDict( const String& _rName, bool _bChecked );
+ };
+
+
+ class HangulHanjaNewDictDialog : public ModalDialog
+ {
+ private:
+ FixedLine m_aNewDictFL;
+ FixedText m_aDictNameFT;
+ Edit m_aDictNameED;
+ OKButton m_aOkBtn;
+ CancelButton m_aCancelBtn;
+ HelpButton m_aHelpBtn;
+
+ bool m_bEntered;
+
+ DECL_LINK( OKHdl, void* );
+ DECL_LINK( ModifyHdl, void* );
+ protected:
+ public:
+ HangulHanjaNewDictDialog( Window* _pParent );
+ virtual ~HangulHanjaNewDictDialog();
+
+ bool GetName( String& _rRetName ) const;
+ };
+
+
+ class SuggestionList;
+
+ class SuggestionEdit : public Edit
+ {
+ private:
+ SuggestionEdit* m_pPrev;
+ SuggestionEdit* m_pNext;
+ ScrollBar& m_rScrollBar;
+
+ bool ShouldScroll( bool _bUp ) const;
+ void DoJump( bool _bUp );
+ public:
+ SuggestionEdit( Window* pParent, const ResId& rResId,
+ ScrollBar& _rScrollBar,
+ SuggestionEdit* _pPrev, SuggestionEdit* _pNext );
+ virtual ~SuggestionEdit();
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ };
+
+
+ class HangulHanjaEditDictDialog : public ModalDialog
+ {
+ private:
+ const String m_aEditHintText;
+ HHDictList& m_rDictList;
+ sal_uInt32 m_nCurrentDict;
+
+ String m_aOriginal;
+ SuggestionList* m_pSuggestions;
+
+ FixedText m_aBookFT;
+ ListBox m_aBookLB;
+ FixedText m_aOriginalFT;
+ ComboBox m_aOriginalLB;
+ FixedText m_aSuggestionsFT;
+ SuggestionEdit m_aEdit1;
+ SuggestionEdit m_aEdit2;
+ SuggestionEdit m_aEdit3;
+ SuggestionEdit m_aEdit4;
+ ScrollBar m_aScrollSB;
+ PushButton m_aNewPB;
+ PushButton m_aDeletePB;
+ HelpButton m_aHelpPB;
+ CancelButton m_aClosePB;
+
+ sal_uInt16 m_nTopPos;
+ bool m_bModifiedSuggestions;
+ bool m_bModifiedOriginal;
+
+ DECL_LINK( OriginalModifyHdl, void* );
+ DECL_LINK( ScrollHdl, void* );
+ DECL_LINK( EditModifyHdl1, Edit* );
+ DECL_LINK( EditModifyHdl2, Edit* );
+ DECL_LINK( EditModifyHdl3, Edit* );
+ DECL_LINK( EditModifyHdl4, Edit* );
+
+ DECL_LINK( BookLBSelectHdl, void* );
+ DECL_LINK( NewPBPushHdl, void* );
+ DECL_LINK( DeletePBPushHdl, void* );
+
+ void InitEditDictDialog( sal_uInt32 _nSelDict );
+ void UpdateOriginalLB( void );
+ void UpdateSuggestions( void );
+ void UpdateButtonStates();
+
+ void SetEditText( Edit& _rEdit, sal_uInt16 _nEntryNum );
+ void EditModify( Edit* _pEdit, sal_uInt8 _nEntryOffset );
+ void EditFocusLost( Edit* _pEdit, sal_uInt8 _nEntryOffset );
+
+ bool DeleteEntryFromDictionary( const ::rtl::OUString& rEntry, const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionary >& xDict );
+
+ public:
+ HangulHanjaEditDictDialog( Window* _pParent, HHDictList& _rDictList, sal_uInt32 _nSelDict );
+ ~HangulHanjaEditDictDialog();
+
+ void UpdateScrollbar( void );
+ };
+
+//.............................................................................
+} // namespace svx
+//.............................................................................
+
+#endif // SVX_HANGUL_HANJA_HXX
diff --git a/cui/source/inc/headertablistbox.hxx b/cui/source/inc/headertablistbox.hxx
new file mode 100755
index 000000000000..8738327b70bc
--- /dev/null
+++ b/cui/source/inc/headertablistbox.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * 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: headertablistbox.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _HEADERTABLISTBOX_HXX
+#define _HEADERTABLISTBOX_HXX
+
+#include <svtools/headbar.hxx>
+#include <svtools/svtabbx.hxx>
+
+
+class _HeaderTabListBox : public Control
+{
+private:
+ SvHeaderTabListBox maListBox;
+ HeaderBar maHeaderBar;
+protected:
+ DECL_LINK( HeaderEndDrag_Impl, HeaderBar* );
+ virtual long Notify( NotifyEvent& rNEvt );
+public:
+ _HeaderTabListBox( Window* pParent, const ResId& rId );
+ virtual ~_HeaderTabListBox();
+
+ inline SvHeaderTabListBox& GetListBox( void );
+ inline HeaderBar& GetHeaderBar( void );
+
+ void ConnectElements( void );
+ // should be called after all manipulations on elements are done
+ // calcs real sizes depending on sizes of this
+ void Show( BOOL bVisible = TRUE, USHORT nFlags = 0 ); // same meaning as Windows::Show()
+ void Enable( bool bEnable = true, bool bChild = true ); // same meaning as Windows::Enable()
+};
+
+inline SvHeaderTabListBox& _HeaderTabListBox::GetListBox( void )
+{
+ return maListBox;
+}
+
+inline HeaderBar& _HeaderTabListBox::GetHeaderBar( void )
+{
+ return maHeaderBar;
+}
+
+
+#endif
diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc
new file mode 100644
index 000000000000..899808ac0cb5
--- /dev/null
+++ b/cui/source/inc/helpid.hrc
@@ -0,0 +1,387 @@
+/*************************************************************************
+ *
+ * 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: helpid.hrc,v $
+ * $Revision: 1.78 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CUI_HELPID_HRC
+#define _CUI_HELPID_HRC
+// include ---------------------------------------------------------------
+
+#include <svl/solar.hrc>
+
+// Help-Ids --------------------------------------------------------------
+
+#define HID_OPTIONS_COLOR (HID_CUI_START + 1)
+#define HID_OPTIONS_SAVE (HID_CUI_START + 2)
+#define HID_OPTIONS_PATH (HID_CUI_START + 3)
+#define HID_OPTIONS_GENERAL (HID_CUI_START + 4)
+#define HID_OPTIONS_LINGU (HID_CUI_START + 5)
+#define HID_OPTIONS_SPELL (HID_CUI_START + 6)
+#define HID_OPTIONS_DICT_NEW (HID_CUI_START + 7)
+#define HID_OPTIONS_DICT_EDIT (HID_CUI_START + 8)
+#define HID_OPTIONS_INET (HID_CUI_START + 9)
+#define HID_OPTIONS_CHART_DEFCOLORS (HID_CUI_START + 10)
+#define HID_OPTIONS_CTL (HID_CUI_START + 11)
+#define HID_OPTIONS_PROXY (HID_CUI_START + 12)
+#define HID_OPTIONS_SEARCH (HID_CUI_START + 13)
+#define HID_OPTIONS_MAIL (HID_CUI_START + 14)
+#define HID_OPTIONS_ASIAN_LAYOUT (HID_CUI_START + 15)
+#define HID_CLB_EDIT_MODULES_DICS (HID_CUI_START + 16)
+#define HID_CLB_EDIT_MODULES_MODULES (HID_CUI_START + 17)
+#define HID_CLB_LINGU_MODULES (HID_CUI_START + 18)
+#define HID_CLB_LINGU_OPTIONS (HID_CUI_START + 19)
+#define HID_EDIT_MODULES (HID_CUI_START + 20)
+#define HID_LNGDLG_NUM_PREBREAK (HID_CUI_START + 21)
+#define HID_OPTIONS_COLORCONFIG (HID_CUI_START + 22)
+#define HID_OPTIONS_COLORCONFIG_SAVE_SCHEME (HID_CUI_START + 23)
+#define HID_OPTIONS_ACCESSIBILITYCONFIG (HID_CUI_START + 24)
+#define HID_OPTIONS_COLORCONFIG_COLORLIST_WIN (HID_CUI_START + 25)
+#define HID_OPTIONS_COLORCONFIG_NAME_SCHEME (HID_CUI_START + 26)
+#define HID_OPTIONS_PATHS_SELECTFOLDER (HID_CUI_START + 27)
+#define HID_OPTIONS_JAVA (HID_CUI_START + 28)
+#define HID_OPTIONS_JAVA_LIST (HID_CUI_START + 29)
+#define HID_OPTIONS_JAVA_PARAMETER (HID_CUI_START + 30)
+#define HID_OPTIONS_JAVA_CLASSPATH (HID_CUI_START + 31)
+#define HID_SVXPAGE_JSEARCH_OPTIONS (HID_CUI_START + 32)
+#define HID_SVXDLG_FILTER_WARNING (HID_CUI_START + 33)
+#define HID_SVX_OPTIONS_ONLINEUPDATE (HID_CUI_START + 45)
+#define HID_DLG_SECURITY_OPTIONS (HID_CUI_START + 35)
+#define HID_OFADLG_OPTIONS_TREE (HID_CUI_START + 36)
+#define HID_OFA_CONNPOOL_DRIVERLIST (HID_CUI_START + 37)
+#define UID_OFA_CONNPOOL_DRIVERLIST_BACK (HID_CUI_START + 38)
+#define HID_OFA_FONT_SUBST_CLB (HID_CUI_START + 39)
+#define HID_OFA_TP_MISC (HID_CUI_START + 40)
+#define HID_OFA_TP_VIEW (HID_CUI_START + 41)
+#define HID_OFA_TP_LANGUAGES (HID_CUI_START + 42)
+#define HID_OFA_TP_MEMORY (HID_CUI_START + 43)
+#define HID_DBPATH_CTL_PATH (HID_CUI_START + 44)
+#define HID_DBPATH_HEADERBAR (HID_CUI_START + 45)
+#define HID_OFAPAGE_SMARTTAG_OPTIONS (HID_CUI_START + 46)
+#define HID_OFAPAGE_MSFLTR2_CLB (HID_CUI_START + 47)
+#define HID_OPTPATH_CTL_PATH (HID_CUI_START + 48)
+#define HID_OFADLG_TREELISTBOX (HID_CUI_START + 49)
+#define HID_DLG_WEBCONNECTION_INFO (HID_CUI_START + 50)
+#define HID_OPTIONS_DICT_EDIT_ENTRIES_LIST (HID_CUI_START + 51)
+#define HID_OPTPATH_HEADERBAR (HID_CUI_START + 52)
+#define HID_COLORPAGE_LISTBOX_START (HID_CUI_START + 53)
+#define HID_COLORPAGE_DOCCOLOR_LB (HID_CUI_START + 54)
+#define HID_COLORPAGE_DOCBOUNDARIES_LB (HID_CUI_START + 55)
+#define HID_COLORPAGE_APPBACKGROUND_LB (HID_CUI_START + 56)
+#define HID_COLORPAGE_OBJECTBOUNDARIES_LB (HID_CUI_START + 57)
+#define HID_COLORPAGE_TABLEBOUNDARIES_LB (HID_CUI_START + 58)
+#define HID_COLORPAGE_FONTCOLOR_LB (HID_CUI_START + 59)
+#define HID_COLORPAGE_LINKS_LB (HID_CUI_START + 60)
+#define HID_COLORPAGE_LINKSVISITED_LB (HID_CUI_START + 61)
+#define HID_COLORPAGE_ANCHOR_LB (HID_CUI_START + 62)
+#define HID_COLORPAGE_SPELL_LB (HID_CUI_START + 63)
+#define HID_COLORPAGE_WRITERTEXTGRID_LB (HID_CUI_START + 64)
+#define HID_COLORPAGE_WRITERFIELDSHADINGS_LB (HID_CUI_START + 65)
+#define HID_COLORPAGE_WRITERIDXSHADINGS_LB (HID_CUI_START + 66)
+#define HID_COLORPAGE_WRITERDIRECTCURSOR_LB (HID_CUI_START + 67)
+#define HID_COLORPAGE_WRITERNOTESINDICATOR_LB (HID_CUI_START + 68)
+#define HID_COLORPAGE_DOCCOLOR_CB (HID_CUI_START + 69)
+#define HID_COLORPAGE_DOCBOUNDARIES_CB (HID_CUI_START + 70)
+#define HID_COLORPAGE_APPBACKGROUND_CB (HID_CUI_START + 71)
+#define HID_COLORPAGE_OBJECTBOUNDARIES_CB (HID_CUI_START + 72)
+#define HID_COLORPAGE_TABLEBOUNDARIES_CB (HID_CUI_START + 73)
+#define HID_COLORPAGE_FONTCOLOR_CB (HID_CUI_START + 74)
+#define HID_COLORPAGE_LINKS_CB (HID_CUI_START + 75)
+#define HID_COLORPAGE_LINKSVISITED_CB (HID_CUI_START + 76)
+#define HID_COLORPAGE_ANCHOR_CB (HID_CUI_START + 77)
+#define HID_COLORPAGE_SPELL_CB (HID_CUI_START + 78)
+#define HID_COLORPAGE_WRITERTEXTGRID_CB (HID_CUI_START + 79)
+#define HID_COLORPAGE_WRITERFIELDSHADINGS_CB (HID_CUI_START + 80)
+#define HID_COLORPAGE_WRITERIDXSHADINGS_CB (HID_CUI_START + 81)
+#define HID_COLORPAGE_WRITERDIRECTCURSOR_CB (HID_CUI_START + 82)
+#define HID_COLORPAGE_WRITERNOTESINDICATOR_CB (HID_CUI_START + 83)
+#define HID_COLORPAGE_WRITERSCRIPTINDICATOR_CB (HID_CUI_START + 84)
+#define HID_COLORPAGE_WRITERSECTIONBOUNDARIES_CB (HID_CUI_START + 85)
+#define HID_COLORPAGE_WRITERPAGEBREAKS_CB (HID_CUI_START + 86)
+#define HID_COLORPAGE_HTMLSGML_CB (HID_CUI_START + 87)
+#define HID_COLORPAGE_HTMLCOMMENT_CB (HID_CUI_START + 88)
+#define HID_COLORPAGE_HTMLKEYWORD_CB (HID_CUI_START + 89)
+#define HID_COLORPAGE_HTMLUNKNOWN_CB (HID_CUI_START + 90)
+#define HID_COLORPAGE_CALCGRID_CB (HID_CUI_START + 91)
+#define HID_COLORPAGE_CALCPAGEBREAK_CB (HID_CUI_START + 92)
+#define HID_COLORPAGE_CALCPAGEBREAKMANUAL_CB (HID_CUI_START + 93)
+#define HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_CB (HID_CUI_START + 94)
+#define HID_COLORPAGE_CALCDETECTIVE_CB (HID_CUI_START + 95)
+#define HID_COLORPAGE_CALCDETECTIVEERROR_CB (HID_CUI_START + 96)
+#define HID_COLORPAGE_CALCREFERENCE_CB (HID_CUI_START + 97)
+#define HID_COLORPAGE_CALCNOTESBACKGROUND_CB (HID_CUI_START + 98)
+#define HID_COLORPAGE_DRAWGRID_CB (HID_CUI_START + 99)
+#define HID_COLORPAGE_DRAWDRAWING_CB (HID_CUI_START + 100)
+#define HID_COLORPAGE_DRAWFILL_CB (HID_CUI_START + 101)
+#define HID_COLORPAGE_BASICIDENTIFIER_CB (HID_CUI_START + 102)
+#define HID_COLORPAGE_BASICCOMMENT_CB (HID_CUI_START + 103)
+#define HID_COLORPAGE_BASICNUMBER_CB (HID_CUI_START + 104)
+#define HID_COLORPAGE_BASICSTRING_CB (HID_CUI_START + 105)
+#define HID_COLORPAGE_BASICOPERATOR_CB (HID_CUI_START + 106)
+#define HID_COLORPAGE_BASICKEYWORD_CB (HID_CUI_START + 107)
+#define HID_COLORPAGE_BASICERROR_CB (HID_CUI_START + 108)
+#define HID_COLORPAGE_WRITERSCRIPTINDICATOR_LB (HID_CUI_START + 109)
+#define HID_COLORPAGE_WRITERSECTIONBOUNDARIES_LB (HID_CUI_START + 110)
+#define HID_COLORPAGE_WRITERPAGEBREAKS_LB (HID_CUI_START + 111)
+#define HID_COLORPAGE_HTMLSGML_LB (HID_CUI_START + 112)
+#define HID_COLORPAGE_HTMLCOMMENT_LB (HID_CUI_START + 113)
+#define HID_COLORPAGE_HTMLKEYWORD_LB (HID_CUI_START + 114)
+#define HID_COLORPAGE_HTMLUNKNOWN_LB (HID_CUI_START + 115)
+#define HID_COLORPAGE_CALCGRID_LB (HID_CUI_START + 116)
+#define HID_COLORPAGE_CALCPAGEBREAK_LB (HID_CUI_START + 117)
+#define HID_COLORPAGE_CALCPAGEBREAKMANUAL_LB (HID_CUI_START + 118)
+#define HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_LB (HID_CUI_START + 119)
+#define HID_COLORPAGE_CALCDETECTIVE_LB (HID_CUI_START + 120)
+#define HID_COLORPAGE_CALCDETECTIVEERROR_LB (HID_CUI_START + 121)
+#define HID_COLORPAGE_CALCREFERENCE_LB (HID_CUI_START + 122)
+#define HID_COLORPAGE_CALCNOTESBACKGROUND_LB (HID_CUI_START + 123)
+#define HID_COLORPAGE_DRAWGRID_LB (HID_CUI_START + 124)
+#define HID_COLORPAGE_DRAWDRAWING_LB (HID_CUI_START + 125)
+#define HID_COLORPAGE_DRAWFILL_LB (HID_CUI_START + 126)
+#define HID_COLORPAGE_BASICIDENTIFIER_LB (HID_CUI_START + 127)
+#define HID_COLORPAGE_BASICCOMMENT_LB (HID_CUI_START + 128)
+#define HID_COLORPAGE_BASICNUMBER_LB (HID_CUI_START + 129)
+#define HID_COLORPAGE_BASICSTRING_LB (HID_CUI_START + 130)
+#define HID_COLORPAGE_BASICOPERATOR_LB (HID_CUI_START + 131)
+#define HID_COLORPAGE_BASICKEYWORD_LB (HID_CUI_START + 132)
+#define HID_COLORPAGE_BASICERROR_LB (HID_CUI_START + 133)
+#define HID_COLORPAGE_CHECKBOX_START (HID_CUI_START + 134)
+#define HID_SVX_MACRO_LB_EVENT (HID_CUI_START + 135)
+#define HID_SVX_CONFIG_EVENT (HID_CUI_START + 136)
+#define HID_CONFIG_EVENT_OFFICE_BASED (HID_CUI_START + 137)
+#define HID_CONFIG_EVENT_DOCUMENT_BASED (HID_CUI_START + 138)
+#define HID_SELECTOR_DIALOG (HID_CUI_START + 139)
+#define HID_SELECTOR_CATEGORIES (HID_CUI_START + 140)
+#define HID_SVX_CONFIG_TOOLBAR (HID_CUI_START + 141)
+#define HID_SVX_CONFIG_TOOLBAR_CONTENTS (HID_CUI_START + 142)
+#define HID_SELECTOR_COMMANDS (HID_CUI_START + 143)
+#define HID_GALLERY_EDIT_MSNAME (HID_CUI_START + 144)
+#define HID_SVX_CONFIG_MENU (HID_CUI_START + 145)
+#define HID_SVX_CONFIG_MENU_CONTENTS (HID_CUI_START + 146)
+#define HID_GALLERY_NEWTHEME_FINDFILES (HID_CUI_START + 147)
+#define HID_GALLERY_NEWTHEME_ADDFILES (HID_CUI_START + 148)
+#define HID_HANGULDLG_BUTTON_OPTIONS (HID_CUI_START + 149)
+#define HID_HANGULDLG_BUTTON_CLOSE (HID_CUI_START + 150)
+#define HID_HANGULDLG_BUTTON_IGNORE (HID_CUI_START + 151)
+#define HID_HANGULDLG_BUTTON_IGNOREALL (HID_CUI_START + 152)
+#define HID_HANGULDLG_BUTTON_CHANGE (HID_CUI_START + 153)
+#define HID_HANGULDLG_BUTTON_CHANGEALL (HID_CUI_START + 154)
+#define HID_OFA_FONT_SUBSTITUTION (HID_CUI_START + 155)
+#define HID_HANGULDLG_EDIT_NEWWORD (HID_CUI_START + 156)
+#define HID_OFA_SUBST_APPLY (HID_CUI_START + 157)
+#define HID_OFA_SUBST_DELETE (HID_CUI_START + 158)
+#define HID_SPLDLG_BUTTON_CLOSE (HID_CUI_START + 159)
+#define HID_SPLDLG_BUTTON_IGNORE (HID_CUI_START + 160)
+#define HID_SPLDLG_BUTTON_IGNOREALL (HID_CUI_START + 161)
+#define HID_SPLDLG_BUTTON_CHANGE (HID_CUI_START + 161)
+#define HID_SPLDLG_BUTTON_CHANGEALL (HID_CUI_START + 163)
+#define HID_SPLDLG_BUTTON_EXPLAIN (HID_CUI_START + 164)
+#define HID_CHARMAP_CTL_SHOWSET (HID_CUI_START + 165)
+#define HID_CHARMAP_CTL_SHOWTEXT (HID_CUI_START + 166)
+#define HID_CHARMAP_CTL_SHOWCHAR (HID_CUI_START + 167)
+#define HID_DLG_NAME (HID_CUI_START + 168)
+#define HID_DLG_MESSBOX (HID_CUI_START + 169)
+#define HID_HANGULDLG_SUGGESTIONS (HID_CUI_START + 170)
+#define HID_HANGULDLG_SUGGESTIONS_GRID (HID_CUI_START + 171)
+#define HID_HANGULDLG_SUGGESTIONS_LIST (HID_CUI_START + 172)
+#define HID_DLG_OBJECT_NAME (HID_CUI_START + 173)
+#define HID_DLG_OBJECT_TITLE_DESC (HID_CUI_START + 174)
+#define HID_SVX_CONFIG_MENU_ORGANIZER (HID_CUI_START + 175)
+#define HID_SVX_CONFIG_ICON_SELECTOR (HID_CUI_START + 176)
+#define HID_SVX_CONFIG_NAME_SUBMENU (HID_CUI_START + 177)
+#define HID_SVX_CONFIG_RENAME_MENU (HID_CUI_START + 178)
+#define HID_SVX_CONFIG_RENAME_MENU_ITEM (HID_CUI_START + 179)
+#define HID_SVX_CONFIG_RENAME_TOOLBAR (HID_CUI_START + 180)
+#define HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM (HID_CUI_START + 181)
+#define HID_SVX_NEW_TOOLBAR (HID_CUI_START + 182)
+#define HID_SVX_MODIFY_TOOLBAR (HID_CUI_START + 183)
+#define HID_SVX_NEW_TOOLBAR_ITEM (HID_CUI_START + 184)
+#define HID_SVX_CONFIG_MENU_LISTBOX (HID_CUI_START + 185)
+#define HID_SVX_MODIFY_TOOLBAR_ITEM (HID_CUI_START + 186)
+#define HID_SVX_SAVE_IN (HID_CUI_START + 187)
+#define HID_OPTIONS_MULTIPATH_LIST (HID_CUI_START + 188)
+#define HID_FM_DLG_SEARCH (HID_CUI_START + 189)
+#define HID_SEARCH_TEXT (HID_CUI_START + 190)
+#define HID_SEARCH_ALLFIELDS (HID_CUI_START + 191)
+#define HID_GALLERY_PROPERTIES_GENERAL (HID_CUI_START + 192)
+#define HID_SEARCH_FIELDSELECTION (HID_CUI_START + 193)
+#define HID_SEARCH_POSITION (HID_CUI_START + 194)
+#define HID_SEARCH_FORMATTER (HID_CUI_START + 195)
+#define HID_SEARCH_CASE (HID_CUI_START + 196)
+#define HID_SEARCH_BACKWARD (HID_CUI_START + 197)
+#define HID_SEARCH_STARTOVER (HID_CUI_START + 198)
+#define HID_SEARCH_WILDCARD (HID_CUI_START + 199)
+#define HID_SEARCH_REGULAR (HID_CUI_START + 200)
+#define HID_SEARCH_APPROX (HID_CUI_START + 201)
+#define HID_SEARCH_APPROXSETTINGS (HID_CUI_START + 202)
+#define HID_SEARCH_BTN_SEARCH (HID_CUI_START + 203)
+#define HID_SEARCH_BTN_CLOSE (HID_CUI_START + 204)
+#define HID_GALLERY_BROWSER (HID_CUI_START + 205)
+#define HID_GALLERY_SEARCH (HID_CUI_START + 206)
+#define HID_GALLERY_APPLY (HID_CUI_START + 207
+#define HID_SPLDLG_BUTTON_IGNORERULE (HID_CUI_START + 208)
+#define HID_CONFIG_ACCEL (HID_CUI_START + 209)
+#define HID_ACCELCONFIG_LISTBOX (HID_CUI_START + 210)
+#define HID_CONFIGGROUP_ACC_LISTBOX (HID_CUI_START + 211)
+#define HID_CONFIGFUNCTION_ACC_LISTBOX (HID_CUI_START + 212)
+#define HID_MACRO_LB_EVENT (HID_CUI_START + 213)
+#define HID_MACRO_GROUP (HID_CUI_START + 214)
+#define HID_MACRO_MACROS (HID_CUI_START + 215)
+#define HID_DIALOG_HANGULHANJA (HID_CUI_START + 216)
+#define HID_HANGULHANJA_OPT_DLG (HID_CUI_START + 217)
+#define HID_HANGULHANJA_NEWDICT_DLG (HID_CUI_START + 218)
+#define HID_HANGULHANJA_EDIT_DLG (HID_CUI_START + 219)
+#define HID_HANGULHANJA_OPT_DICTS_LB (HID_CUI_START + 220)
+#define HID_MULTIPATH (HID_CUI_START + 221)
+#define HID_SCRIPTORG_DIALOG (HID_CUI_START + 222)
+#define HID_SCRIPTSBOX (HID_CUI_START + 223)
+#define HID_SPELLCHECK (HID_CUI_START + 224)
+#define HID_TPSIZE_CTRL (HID_CUI_START + 225)
+#define HID_TPROTATION_CTRL1 (HID_CUI_START + 226)
+#define HID_TPROTATION_CTRL2 (HID_CUI_START + 227)
+#define HID_TRANS_ANGLE (HID_CUI_START + 228)
+#define HID_TPPOSITION_CTRL (HID_CUI_START + 229)
+#define HID_NUMBERFORMAT_LB_FORMAT (HID_CUI_START + 230)
+#define HID_NUMBERFORMAT_WND_NUMBER_PREVIEW (HID_CUI_START + 231)
+#define HID_TRANS_SLANT (HID_CUI_START + 232)
+#define HID_TPHATCH_CTRL (HID_CUI_START + 233)
+#define HID_SEARCHATTR_CTL_ATTR (HID_CUI_START + 234)
+#define HID_NUMBERFORMAT_TBI_INFO (HID_CUI_START + 235)
+#define HID_SEARCHATTR (HID_CUI_START + 236)
+#define HID_ALIGNMENT_CTR_DIAL (HID_CUI_START + 237)
+#define HID_ALIGNMENT_CTR_BORDER_LOCK (HID_CUI_START + 238)
+#define HID_SEARCHSIMILARITY (HID_CUI_START + 239)
+#define UID_SEARCH_RECORDSTATUS (HID_CUI_START + 240)
+#define HID_OFAPAGE_AUTOCORR_CLB (HID_CUI_START + 241)
+#define HID_AUTOCORR_LANGUAGE (HID_CUI_START + 242)
+#define HID_OFAPAGE_AUTOFORMAT_CLB (HID_CUI_START + 243)
+#define HID_TPCOLOR_RGB_1 (HID_CUI_START + 244)
+#define HID_TPCOLOR_RGB_2 (HID_CUI_START + 245)
+#define HID_TPCOLOR_RGB_3 (HID_CUI_START + 246)
+#define HID_TPCOLOR_CMYK_1 (HID_CUI_START + 247)
+#define HID_TPCOLOR_CMYK_2 (HID_CUI_START + 248)
+#define HID_TPCOLOR_CMYK_3 (HID_CUI_START + 249)
+#define HID_ALIGNMENT (HID_CUI_START + 250)
+#define HID_OFAPAGE_AUTOCORR_OPTIONS (HID_CUI_START + 251)
+#define HID_OFAPAGE_AUTOFMT_OPTIONS (HID_CUI_START + 252)
+#define HID_OFAPAGE_AUTOCORR_REPLACE (HID_CUI_START + 253)
+#define HID_OFACTL_AUTOCORR_REPLACE (HID_CUI_START + 254)
+#define HID_OFAPAGE_AUTOCORR_EXCEPT (HID_CUI_START + 255)
+#define HID_OFAPAGE_AUTOCORR_QUOTE (HID_CUI_START + 256)
+#define HID_OFAPAGE_AUTOCOMPLETE_OPTIONS (HID_CUI_START + 257)
+#define HID_BACKGROUND (HID_CUI_START + 258)
+#define HID_BACKGROUND_CTL_BGDCOLORSET (HID_CUI_START + 259)
+#define HID_BACKGROUND_CTL_POSITION (HID_CUI_START + 260)
+#define HID_BORDER (HID_CUI_START + 261)
+#define HID_BORDER_CTL_PRESETS (HID_CUI_START + 262)
+#define HID_BORDER_CTL_SHADOWS (HID_CUI_START + 263)
+#define HID_PAGE_CONNECTION (HID_CUI_START + 264)
+#define HID_PAGE_CONNECTION_CTL_PREVIEW (HID_CUI_START + 265)
+#define HID_PAGE_DISTRIBUTE (HID_CUI_START + 266)
+#define HID_SVXPAGE_GRFCROP (HID_CUI_START + 267)
+#define HID_CAPTION (HID_CUI_START + 268)
+#define HID_CAPTION_CTL_TYPE (HID_CUI_START + 269)
+#define HID_PAGE_MEASURE (HID_CUI_START + 270)
+#define HID_MEASURE_CTL_POSITION (HID_CUI_START + 271)
+#define HID_NUMBERFORMAT (HID_CUI_START + 272)
+#define HID_NUMBERFORMAT_TBI_ADD (HID_CUI_START + 273)
+#define HID_NUMBERFORMAT_TBI_REMOVE (HID_CUI_START + 274)
+#define HID_FORMAT_PAGE (HID_CUI_START + 275)
+#define HID_REDLINING_DLG (HID_CUI_START + 276)
+#define HID_REDLINING_EDIT (HID_CUI_START + 277)
+#define HID_REDLINING_PREV (HID_CUI_START + 278)
+#define HID_REDLINING_NEXT (HID_CUI_START + 279)
+#define HID_FORMAT_PARAGRAPH_STD (HID_CUI_START + 280)
+#define HID_VALUESET_SINGLENUM (HID_CUI_START + 281)
+#define HID_VALUESET_BULLET (HID_CUI_START + 282)
+#define HID_VALUESET_NUM (HID_CUI_START + 283)
+#define HID_VALUESET_NUMBMP (HID_CUI_START + 284)
+#define HID_SVXPAGE_PICK_NUM (HID_CUI_START + 285)
+#define HID_SVXPAGE_PICK_SINGLE_NUM (HID_CUI_START + 286)
+#define HID_SVXPAGE_PICK_BMP (HID_CUI_START + 287)
+#define HID_SVXPAGE_PICK_BULLET (HID_CUI_START + 288)
+#define HID_SVXPAGE_NUM_OPTIONS (HID_CUI_START + 289)
+#define HID_SVXPAGE_NUM_POSITION (HID_CUI_START + 290)
+#define HID_MEASURE_CTL_PREVIEW (HID_CUI_START + 291)
+#define HID_FORMAT_PARAGRAPH_EXT (HID_CUI_START + 292)
+#define HID_FORMAT_PARAGRAPH_ALIGN (HID_CUI_START + 293)
+#define HID_SVXPAGE_PARA_ASIAN (HID_CUI_START + 294)
+#define HID_SVXPAGE_SWPOSSIZE (HID_CUI_START + 295)
+#define HID_AREA_TRANSPARENCE (HID_CUI_START + 296)
+#define HID_AREA_AREA (HID_CUI_START + 297)
+#define HID_AREA_SHADOW (HID_CUI_START + 298)
+#define HID_AREA_HATCH (HID_CUI_START + 299)
+#define HID_AREA_BITMAP (HID_CUI_START + 300)
+#define HID_TPSHADOW_CTRL (HID_CUI_START + 301)
+#define HID_AREA_GRADIENT (HID_CUI_START + 302)
+#define HID_LINE_ENDDEF (HID_CUI_START + 303)
+#define HID_LINE_LINE (HID_CUI_START + 304)
+#define HID_LINE_DEF (HID_CUI_START + 305)
+#define HID_SPELLDLG_SETWORD (HID_CUI_START + 306)
+#define HID_TABULATOR (HID_CUI_START + 307)
+#define HID_PAGE_TEXTATTR (HID_CUI_START + 308)
+#define HID_TEXTATTR_CTL_POSITION (HID_CUI_START + 309)
+#define HID_TRANS_POSITION_SIZE (HID_CUI_START + 310)
+#define HID_GALLERY_ACTUALIZE_PROGRESS (HID_CUI_START + 311)
+#define HID_SVXPAGE_CHAR_NAME (HID_CUI_START + 312)
+#define HID_SVXPAGE_CHAR_EFFECTS (HID_CUI_START + 313)
+#define HID_SVXPAGE_CHAR_POSITION (HID_CUI_START + 314)
+#define HID_HYPERLINK_INTERNET (HID_CUI_START + 315)
+#define HID_HYPERLINK_MAIL (HID_CUI_START + 316)
+#define HID_HYPERLINK_DOCUMENT (HID_CUI_START + 317)
+#define HID_HYPERLINK_NEWDOCUMENT (HID_CUI_START + 318)
+#define HID_HYPERLINK_MARKWND (HID_CUI_START + 319)
+#define HID_ICCDIALOG_RESET_BTN (HID_CUI_START + 320)
+#define HID_ICCDIALOG_CHOICECTRL (HID_CUI_START + 321)
+#define HID_HYPERDLG_INET_PATH (HID_CUI_START + 322)
+#define HID_HYPERDLG_MAIL_PATH (HID_CUI_START + 323)
+#define HID_HYPERDLG_DOC_PATH (HID_CUI_START + 324)
+#define HID_ICCDIALOG_OK_BTN (HID_CUI_START + 325)
+#define HID_ICCDIALOG_CANCEL_BTN (HID_CUI_START + 326)
+#define HID_HYPERLINK_MARKWND_APPLY (HID_CUI_START + 327)
+#define HID_HYPERLINK_MARKWND_CLOSE (HID_CUI_START + 328)
+#define HID_HYPERLINK_MARKWND_TREE (HID_CUI_START + 329)
+#define HID_SVXPAGE_CHAR_TWOLINES (HID_CUI_START + 330)
+#define HID_GRFFILTER_EMBOSS_LIGHT (HID_CUI_START + 331)
+#define HID_WARN_NAME_DUPLICATE (HID_CUI_START + 332)
+#define HID_PASTE_DLG (HID_CUI_START + 333)
+#define HID_LINKDLG_TABLB (HID_CUI_START + 334)
+
+
+// please adjust ACT_SVX_HID_END2 below if you add entries here!
+
+// -----------------------------------------------------------------------
+// Overrun check ---------------------------------------------------------
+// -----------------------------------------------------------------------
+
+#define ACT_CUI_HID_END HID_LINKDLG_TABLB
+
+#if ACT_CUI_HID_END > HID_CUI_END
+#error Resource-Ueberlauf in #line, #file
+#endif
+
+#endif
+
diff --git a/cui/source/inc/hldocntp.hxx b/cui/source/inc/hldocntp.hxx
new file mode 100644
index 000000000000..c9f220c0df6f
--- /dev/null
+++ b/cui/source/inc/hldocntp.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * 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: hldocntp.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TABPAGE_DOCNEW_HYPERLINK_HXX
+#define _SVX_TABPAGE_DOCNEW_HYPERLINK_HXX
+
+#include "hltpbase.hxx"
+
+/*************************************************************************
+|*
+|* Tabpage : Hyperlink - New Document
+|*
+\************************************************************************/
+
+class SvxHyperlinkNewDocTp : public SvxHyperlinkTabPageBase
+{
+private:
+ FixedLine maGrpNewDoc;
+ RadioButton maRbtEditNow;
+ RadioButton maRbtEditLater;
+ FixedText maFtPath;
+ SvxHyperURLBox maCbbPath;
+ ImageButton maBtCreate;
+ FixedText maFtDocTypes;
+ ListBox maLbDocTypes;
+
+ sal_Bool ImplGetURLObject( const String& rPath, const String& rBase, INetURLObject& aURLObject ) const;
+ void FillDocumentList ();
+
+ DECL_LINK (ClickNewHdl_Impl , void * ); // Button : New
+
+ Image GetImage( USHORT nId );
+ void ReadURLFile( const String& rFile, String& rTitle, String& rURL, sal_Int32& rIconId, BOOL* pShowAsFolder);//, String* pFrame, String* pOpenAs, String* pDefTempl, String* pDefURL );
+ //String ReadURL_Impl( Config& rURLFile, const DirEntry& rFile );
+
+protected:
+ void FillDlgFields ( String& aStrURL );
+ void GetCurentItemData ( String& aStrURL, String& aStrName,
+ String& aStrIntName, String& aStrFrame,
+ SvxLinkInsertMode& eMode );
+
+public:
+ SvxHyperlinkNewDocTp ( Window *pParent, const SfxItemSet& rItemSet);
+ ~SvxHyperlinkNewDocTp ();
+
+ static IconChoicePage* Create( Window* pWindow, const SfxItemSet& rItemSet );
+
+ virtual BOOL AskApply ();
+ virtual void DoApply ();
+
+ virtual void SetInitFocus();
+};
+
+
+#endif // _SVX_TABPAGE_DOCNEW_HYPERLINK_HXX
diff --git a/cui/source/inc/hldoctp.hxx b/cui/source/inc/hldoctp.hxx
new file mode 100644
index 000000000000..1e3dae701e7b
--- /dev/null
+++ b/cui/source/inc/hldoctp.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * 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: hldoctp.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TABPAGE_DOC_HYPERLINK_HXX
+#define _SVX_TABPAGE_DOC_HYPERLINK_HXX
+
+#include "hltpbase.hxx"
+
+/*************************************************************************
+|*
+|* Tabpage : Hyperlink - Document
+|*
+\************************************************************************/
+
+class SvxHyperlinkDocTp : public SvxHyperlinkTabPageBase
+{
+private:
+ FixedLine maGrpDocument;
+ FixedText maFtPath;
+ SvxHyperURLBox maCbbPath;
+ ImageButton maBtFileopen;
+
+ FixedLine maGrpTarget;
+ FixedText maFtTarget;
+ Edit maEdTarget;
+ FixedText maFtURL;
+ FixedText maFtFullURL;
+ ImageButton maBtBrowse;
+
+ String maStrURL;
+
+ BOOL mbMarkWndOpen;
+
+ DECL_LINK (ClickFileopenHdl_Impl , void * ); // Button : Fileopen
+ DECL_LINK (ClickTargetHdl_Impl , void * ); // Button : Target
+
+ DECL_LINK (ModifiedPathHdl_Impl , void * ); // Contens of combobox "Path" modified
+ DECL_LINK (ModifiedTargetHdl_Impl, void * ); // Contens of editfield "Target" modified
+
+ DECL_LINK (LostFocusPathHdl_Impl, void * ); // Combobox "path" lost its focus
+
+ DECL_LINK (TimeoutHdl_Impl , Timer * ); // Handler for timer -timeout
+
+ enum EPathType { Type_Unknown, Type_Invalid,
+ Type_ExistsFile, Type_File,
+ Type_ExistsDir, Type_Dir };
+ EPathType GetPathType ( String& aStrPath );
+
+protected:
+ void FillDlgFields ( String& aStrURL );
+ void GetCurentItemData ( String& aStrURL, String& aStrName,
+ String& aStrIntName, String& aStrFrame,
+ SvxLinkInsertMode& eMode );
+ virtual BOOL ShouldOpenMarkWnd () {return mbMarkWndOpen;}
+ virtual void SetMarkWndShouldOpen (BOOL bOpen) {mbMarkWndOpen=bOpen;}
+ String GetCurrentURL ();
+
+public:
+ SvxHyperlinkDocTp ( Window *pParent, const SfxItemSet& rItemSet);
+ ~SvxHyperlinkDocTp ();
+
+ static IconChoicePage* Create( Window* pWindow, const SfxItemSet& rItemSet );
+
+ virtual void SetMarkStr ( String& aStrMark );
+
+ virtual void SetInitFocus();
+};
+
+
+#endif // _SVX_TABPAGE_DOC_HYPERLINK_HXX
diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx
new file mode 100644
index 000000000000..19ddae5f6e0b
--- /dev/null
+++ b/cui/source/inc/hlinettp.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * 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: hlinettp.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TABPAGE_INET_HYPERLINK_HXX
+#define _SVX_TABPAGE_INET_HYPERLINK_HXX
+
+#include <svx/hyperdlg.hxx>
+#include "cuihyperdlg.hxx"
+#include "hltpbase.hxx"
+
+/*************************************************************************
+|*
+|* Tabpage : Hyperlink - Internet
+|*
+\************************************************************************/
+
+class SvxHyperlinkInternetTp : public SvxHyperlinkTabPageBase
+{
+private:
+ FixedLine maGrpLinkTyp;
+ RadioButton maRbtLinktypInternet;
+ RadioButton maRbtLinktypFTP;
+ RadioButton maRbtLinktypTelnet;
+ FixedText maFtTarget;
+ SvxHyperURLBox maCbbTarget;
+ FixedText maFtLogin;
+ Edit maEdLogin;
+ FixedText maFtPassword;
+ Edit maEdPassword;
+ CheckBox maCbAnonymous;
+ ImageButton maBtBrowse;
+ ImageButton maBtTarget;
+
+ String maStrOldUser;
+ String maStrOldPassword;
+
+ BOOL mbMarkWndOpen;
+
+ String maStrStdDocURL;
+
+ DECL_LINK (Click_SmartProtocol_Impl , void * ); // Radiobutton clicked: Type Internet, FTP or Telnet
+ DECL_LINK (ClickAnonymousHdl_Impl , void * ); // Checkbox : Anonymer Benutzer
+ DECL_LINK (ClickBrowseHdl_Impl , void * ); // Button : Browse
+ DECL_LINK (ClickTargetHdl_Impl , void * ); // Button : Ziel
+ DECL_LINK (ModifiedLoginHdl_Impl , void * ); // Contens of editfield "Login" modified
+ DECL_LINK (LostFocusTargetHdl_Impl , void * ); // Combobox "Target" lost its focus
+ DECL_LINK (ModifiedTargetHdl_Impl , void * ); // Contens of editfield "Target" modified
+
+ DECL_LINK (TimeoutHdl_Impl , Timer * ); // Handler for timer -timeout
+
+
+ void SetScheme( const String& aScheme );
+ void RemoveImproperProtocol(const String& aProperScheme);
+ String GetSchemeFromButtons() const;
+ INetProtocol GetSmartProtocolFromButtons() const;
+
+ String CreateAbsoluteURL() const;
+
+ void setAnonymousFTPUser();
+ void setFTPUser(const String& rUser, const String& rPassword);
+ void RefreshMarkWindow();
+
+protected:
+ virtual void FillDlgFields ( String& aStrURL );
+ virtual void GetCurentItemData ( String& aStrURL, String& aStrName,
+ String& aStrIntName, String& aStrFrame,
+ SvxLinkInsertMode& eMode );
+ virtual BOOL ShouldOpenMarkWnd () {return ( mbMarkWndOpen && maRbtLinktypInternet.IsChecked() );}
+ virtual void SetMarkWndShouldOpen (BOOL bOpen) {mbMarkWndOpen=bOpen;}
+
+public:
+ SvxHyperlinkInternetTp ( Window *pParent, const SfxItemSet& rItemSet);
+ ~SvxHyperlinkInternetTp ();
+
+ static IconChoicePage* Create( Window* pWindow, const SfxItemSet& rItemSet );
+
+ virtual void SetMarkStr ( String& aStrMark );
+ virtual void SetOnlineMode( BOOL bEnable );
+
+ virtual void SetInitFocus();
+};
+
+
+#endif // _SVX_TABPAGE_INET_HYPERLINK_HXX
diff --git a/cui/source/inc/hlmailtp.hxx b/cui/source/inc/hlmailtp.hxx
new file mode 100644
index 000000000000..797695b09e00
--- /dev/null
+++ b/cui/source/inc/hlmailtp.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: hlmailtp.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TABPAGE_MAIL_HYPERLINK_HXX
+#define _SVX_TABPAGE_MAIL_HYPERLINK_HXX
+
+#include "hltpbase.hxx"
+
+/*************************************************************************
+|*
+|* Tabpage : Hyperlink - Mail & News
+|*
+\************************************************************************/
+
+class SvxHyperlinkMailTp : public SvxHyperlinkTabPageBase
+{
+private:
+ FixedLine maGrpMailNews;
+ RadioButton maRbtMail;
+ RadioButton maRbtNews;
+ FixedText maFtReceiver;
+ SvxHyperURLBox maCbbReceiver;
+ ImageButton maBtAdrBook;
+ FixedText maFtSubject;
+ Edit maEdSubject;
+
+ DECL_LINK (Click_SmartProtocol_Impl, void * ); // Radiobutton clicked: Type EMAIl or News
+ DECL_LINK (ClickAdrBookHdl_Impl , void * ); // Button : Address book
+ DECL_LINK (ModifiedReceiverHdl_Impl, void * ); // Combobox "receiver" modified
+
+ void SetScheme( const String& aScheme );
+ void RemoveImproperProtocol(const String& aProperScheme);
+ String GetSchemeFromButtons() const;
+ INetProtocol GetSmartProtocolFromButtons() const;
+
+ String CreateAbsoluteURL() const;
+
+protected:
+ virtual void FillDlgFields ( String& aStrURL );
+ virtual void GetCurentItemData ( String& aStrURL, String& aStrName,
+ String& aStrIntName, String& aStrFrame,
+ SvxLinkInsertMode& eMode );
+
+public:
+ SvxHyperlinkMailTp ( Window *pParent, const SfxItemSet& rItemSet);
+ ~SvxHyperlinkMailTp ();
+
+ static IconChoicePage* Create( Window* pWindow, const SfxItemSet& rItemSet );
+
+ virtual void SetInitFocus();
+};
+
+
+#endif // _SVX_TABPAGE_MAIL_HYPERLINK_HXX
diff --git a/cui/source/inc/hlmarkwn.hxx b/cui/source/inc/hlmarkwn.hxx
new file mode 100644
index 000000000000..6853eac1ccb6
--- /dev/null
+++ b/cui/source/inc/hlmarkwn.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * 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: hlmarkwn.hxx,v $
+ * $Revision: 1.7.216.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_BKWND_HYPERLINK_HXX
+#define _SVX_BKWND_HYPERLINK_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <vcl/dialog.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <svtools/svtreebx.hxx>
+
+#include "hlmarkwn_def.hxx" //ADD CHINA001
+class SvxHyperlinkTabPageBase;
+
+//########################################################################
+//# #
+//# Tree-Window #
+//# #
+//########################################################################
+
+class SvxHlinkDlgMarkWnd;
+
+class SvxHlmarkTreeLBox : public SvTreeListBox
+{
+private:
+ SvxHlinkDlgMarkWnd* mpParentWnd;
+
+public:
+ SvxHlmarkTreeLBox( Window* pParent, const ResId& rResId );
+
+ virtual void Paint( const Rectangle& rRect );
+};
+
+//########################################################################
+//# #
+//# Window-Class #
+//# #
+//########################################################################
+
+class SvxHlinkDlgMarkWnd : public ModalDialog //FloatingWindow
+{
+private:
+ friend class SvxHlmarkTreeLBox;
+
+ PushButton maBtApply;
+ PushButton maBtClose;
+ //SvTreeListBox maLbTree;
+ SvxHlmarkTreeLBox maLbTree;
+
+ BOOL mbUserMoved;
+ BOOL mbFirst;
+
+ SvxHyperlinkTabPageBase* mpParent;
+
+ String maStrLastURL;
+
+ USHORT mnError;
+
+protected:
+ BOOL RefreshFromDoc( ::rtl::OUString aURL );
+
+ SvLBoxEntry* FindEntry ( String aStrName );
+ void ClearTree();
+ int FillTree( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xLinks, SvLBoxEntry* pParentEntry =NULL );
+
+ virtual void Move ();
+
+ DECL_LINK (ClickApplyHdl_Impl, void * );
+ DECL_LINK (ClickCloseHdl_Impl, void * );
+
+public:
+ SvxHlinkDlgMarkWnd (SvxHyperlinkTabPageBase *pParent);
+ ~SvxHlinkDlgMarkWnd();
+
+ BOOL MoveTo ( Point aNewPos );
+ void RefreshTree ( String aStrURL );
+ void SelectEntry ( String aStrMark );
+
+ BOOL ConnectToDialog( BOOL bDoit = TRUE );
+
+ USHORT SetError( USHORT nError);
+};
+
+
+#endif // _SVX_BKWND_HYPERLINK_HXX
diff --git a/cui/source/inc/hlmarkwn_def.hxx b/cui/source/inc/hlmarkwn_def.hxx
new file mode 100644
index 000000000000..a668737411a6
--- /dev/null
+++ b/cui/source/inc/hlmarkwn_def.hxx
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * 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: hlmarkwn_def.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_BKWND_HYPERLINK_DEF_HXX
+#define _SVX_BKWND_HYPERLINK_DEF_HXX
+
+#define LERR_NOERROR 0
+#define LERR_NOENTRIES 1
+#define LERR_DOCNOTOPEN 2
+
+#endif
+
diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx
new file mode 100644
index 000000000000..821742d34946
--- /dev/null
+++ b/cui/source/inc/hltpbase.hxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * 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: hltpbase.hxx,v $
+ * $Revision: 1.8.216.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TABBASE_HYPERLINK_HXX
+#define _SVX_TABBASE_HYPERLINK_HXX
+
+#define INET_TELNET_SCHEME "telnet://"
+
+#include <sfx2/app.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <vcl/group.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/lstbox.hxx>
+#include <tools/urlobj.hxx>
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <svtools/transfer.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <svtools/inettbc.hxx>
+#include <vcl/timer.hxx>
+
+#include <svx/dialmgr.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/dialogs.hrc>
+#include <com/sun/star/frame/XFrame.hpp>
+#include "helpid.hrc"
+#include <svx/hlnkitem.hxx>
+
+#include "hlmarkwn.hxx"
+#include "iconcdlg.hxx"
+
+
+/*************************************************************************
+|*
+|* ComboBox-Control, wich is filled with all current framenames
+|*
+\************************************************************************/
+
+class SvxFramesComboBox : public ComboBox
+{
+public:
+ SvxFramesComboBox (Window* pParent, const ResId& rResId, SfxDispatcher* pDispatch);
+ ~SvxFramesComboBox ();
+};
+
+/*************************************************************************
+|*
+|* ComboBox-Control for URL's with History and Autocompletion
+|*
+\************************************************************************/
+
+class SvxHyperURLBox : public SvtURLBox, public DropTargetHelper
+{
+private:
+ BOOL mbAccessAddress;
+
+// String GetAllEmailNamesFromDragItem( USHORT nItem );
+
+protected:
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual void Select();
+ virtual void Modify();
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+public:
+ SvxHyperURLBox( Window* pParent, INetProtocol eSmart = INET_PROT_FILE, BOOL bAddresses = FALSE );
+
+};
+
+/*************************************************************************
+|*
+|* Tabpage : Basisclass
+|*
+\************************************************************************/
+
+class SvxHyperlinkTabPageBase : public IconChoicePage
+{
+private:
+ FixedLine *mpGrpMore;
+ FixedText *mpFtFrame;
+ SvxFramesComboBox *mpCbbFrame;
+ FixedText *mpFtForm;
+ ListBox *mpLbForm;
+ FixedText *mpFtIndication;
+ Edit *mpEdIndication;
+ FixedText *mpFtText;
+ Edit *mpEdText;
+ ImageButton *mpBtScript;
+
+ sal_Bool mbIsCloseDisabled;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
+ mxDocumentFrame;
+
+protected:
+ Window* mpDialog;
+
+ BOOL mbStdControlsInit;
+
+ String maStrInitURL;
+
+ Timer maTimer;
+
+ SvxHlinkDlgMarkWnd* mpMarkWnd;
+
+ void InitStdControls ();
+ virtual void FillStandardDlgFields ( SvxHyperlinkItem* pHyperlinkItem );
+ virtual void FillDlgFields ( String& aStrURL ) = 0;
+ virtual void GetCurentItemData ( String& aStrURL, String& aStrName,
+ String& aStrIntName, String& aStrFrame,
+ SvxLinkInsertMode& eMode ) = 0;
+ virtual String CreateUiNameFromURL( const String& aStrURL );
+
+ void GetDataFromCommonFields( String& aStrName,
+ String& aStrIntName, String& aStrFrame,
+ SvxLinkInsertMode& eMode );
+
+ DECL_LINK (ClickScriptHdl_Impl, void * ); // Button : Script
+
+ String aEmptyStr;
+
+ BOOL FileExists( const INetURLObject& rURL );
+ static String GetSchemeFromURL( String aStrURL );
+
+ inline void DisableClose( sal_Bool _bDisable ) { mbIsCloseDisabled = _bDisable; }
+
+public:
+ SvxHyperlinkTabPageBase (
+ Window *pParent,
+ const ResId &rResId,
+ const SfxItemSet& rItemSet
+ );
+ virtual ~SvxHyperlinkTabPageBase ();
+
+ void SetDocumentFrame(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame )
+ {
+ mxDocumentFrame = rxDocumentFrame;
+ }
+
+ virtual BOOL AskApply ();
+ virtual void DoApply ();
+ virtual void SetOnlineMode( BOOL bEnable );
+ virtual void SetInitFocus();
+ virtual void SetMarkStr ( String& aStrMark );
+ virtual void Reset( const SfxItemSet& );
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void ActivatePage( const SfxItemSet& rItemSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+ BOOL IsMarkWndVisible () { return ((Window*)mpMarkWnd)->IsVisible(); }
+ Size GetSizeExtraWnd () { return ( mpMarkWnd->GetSizePixel() ); }
+ BOOL MoveToExtraWnd ( Point aNewPos, BOOL bDisConnectDlg = FALSE );
+
+ virtual void ActivatePage();
+ virtual void DeactivatePage();
+ virtual sal_Bool QueryClose();
+
+protected:
+ virtual BOOL ShouldOpenMarkWnd();
+ virtual void SetMarkWndShouldOpen(BOOL bOpen);
+
+ void ShowMarkWnd ();
+ void HideMarkWnd () { ( ( Window* ) mpMarkWnd )->Hide(); }
+ void InvalidateMarkWnd () { ( ( Window* ) mpMarkWnd )->Invalidate(); }
+
+ SfxDispatcher* GetDispatcher() const;
+
+ USHORT GetMacroEvents();
+ SvxMacroTableDtor* GetMacroTable();
+
+ BOOL IsHTMLDoc() const;
+};
+
+#endif // _SVX_TABBASE_HYPERLINK_HXX
+
diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx
new file mode 100644
index 000000000000..ea74b4a66075
--- /dev/null
+++ b/cui/source/inc/iconcdlg.hxx
@@ -0,0 +1,292 @@
+/*************************************************************************
+ *
+ * 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: iconcdlg.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ICCDLG_HXX
+#define _ICCDLG_HXX
+
+#include <vcl/tabpage.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/dialog.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/image.hxx>
+#include <svtools/ivctrl.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <tools/list.hxx>
+#include <tools/string.hxx>
+
+#define CTRLS_OFFSET 3
+#define BUTTON_DISTANCE 8
+#define RET_USER 100
+#define RET_USER_CANCEL 101
+
+// forward-declarations
+struct IconChoicePageData;
+class IconChoiceDialog;
+class IconChoicePage;
+
+// Create-Function
+typedef IconChoicePage* (*CreatePage)(Window *pParent, const SfxItemSet &rAttrSet);
+typedef USHORT* (*GetPageRanges)(); // liefert internationale Which-Wert
+
+// page-list
+DECLARE_LIST( IconChoicePageList, IconChoicePageData * )
+
+// position of iconchoicectrl
+enum EIconChoicePos { PosLeft, PosRight, PosTop, PosBottom };
+
+/**********************************************************************
+|
+| Data-structure for pages in dialog
+|
+\**********************************************************************/
+
+struct IconChoicePageData
+{
+ USHORT nId; // Die ID
+ CreatePage fnCreatePage; // Pointer auf die Factory
+ GetPageRanges fnGetRanges;// Pointer auf die Ranges-Funktion
+ IconChoicePage* pPage; // die TabPage selber
+ BOOL bOnDemand; // Flag: ItemSet onDemand
+ BOOL bRefresh; // Flag: Seite mu\s neu initialisiert werden
+
+ // Konstruktor
+ IconChoicePageData( USHORT Id, CreatePage fnPage, GetPageRanges fnRanges, BOOL bDemand )
+ : nId ( Id ),
+ fnCreatePage ( fnPage ),
+ fnGetRanges ( fnRanges ),
+ pPage ( NULL ),
+ bOnDemand ( bDemand ),
+ bRefresh ( FALSE )
+ {}
+};
+
+/**********************************************************************
+|
+| IconChoicePage
+|
+\**********************************************************************/
+
+class IconChoicePage : public TabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private :
+ const SfxItemSet* pSet;
+ String aUserString;
+ BOOL bHasExchangeSupport;
+ IconChoiceDialog* pDialog;
+ BOOL bStandard;
+
+ void SetDialog( IconChoiceDialog* pNew ) { pDialog = pNew; }
+ IconChoiceDialog* GetDialog() const { return pDialog; }
+
+ void SetInputSet( const SfxItemSet* pNew ) { pSet = pNew; }
+
+ void ImplInitSettings();
+
+protected :
+ IconChoicePage( Window *pParent, const ResId &, const SfxItemSet &rAttrSet );
+
+ USHORT GetSlot( USHORT nWhich ) const { return pSet->GetPool()->GetSlotId( nWhich ); }
+ USHORT GetWhich( USHORT nSlot ) const { return pSet->GetPool()->GetWhich( nSlot ); }
+ const SfxPoolItem* GetOldItem( const SfxItemSet& rSet, USHORT nSlot );
+ const SfxPoolItem* GetExchangeItem( const SfxItemSet& rSet, USHORT nSlot );
+
+public :
+ virtual ~IconChoicePage();
+
+ const SfxItemSet& GetItemSet() const { return *pSet; }
+
+ virtual BOOL FillItemSet( SfxItemSet& ) = 0;
+ virtual void Reset( const SfxItemSet& ) = 0;
+
+ BOOL HasExchangeSupport() const { return bHasExchangeSupport; }
+ void SetExchangeSupport( BOOL bNew = TRUE ) { bHasExchangeSupport = bNew; }
+
+ enum {
+ KEEP_PAGE = 0x0000, // Fehlerbehandlung; Seite nicht wechseln
+ // 2. F"ullen eines ItemSets f"ur die Aktualilsierung
+ // "ubergeordneter Beispiele; dieser Pointer kann immer
+ // NULL sein!!
+ LEAVE_PAGE = 0x0001,
+ // Set aktualisieren und andere Page aktualisieren
+ REFRESH_SET = 0x0002
+ };
+
+ virtual void ActivatePage( const SfxItemSet& );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+ void SetUserData(const String& rString) { aUserString = rString; }
+ String GetUserData() { return aUserString; }
+ virtual void FillUserData();
+ virtual BOOL IsReadOnly() const;
+ virtual sal_Bool QueryClose();
+
+ static const SfxPoolItem* GetItem( const SfxItemSet& rSet, USHORT nSlot );
+
+ void StateChanged( StateChangedType nType );
+ void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+/**********************************************************************
+|
+| IconChoiceDialog
+|
+\**********************************************************************/
+
+class IconChoiceDialog : public ModalDialog
+{
+private :
+ friend class IconChoicePage;
+
+ EIconChoicePos meChoicePos; // Position des IconChoiceCtrl's
+ IconChoicePageList maPageList; // Liste von PageData-Pointer
+
+ SvtIconChoiceCtrl maIconCtrl; // DAS IconChoice-Control
+
+ USHORT mnCurrentPageId; // Id der aktuell sichtbaren Page
+
+ // Buttons
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+ PushButton aResetBtn;
+
+ const SfxItemSet* pSet;
+ SfxItemSet* pOutSet;
+ SfxItemSet* pExampleSet;
+ USHORT* pRanges;
+
+ sal_uInt32 nResId;
+
+ BOOL bHideResetBtn;
+ BOOL bModal;
+ BOOL bInOK;
+ BOOL bModified;
+ BOOL bItemsReset;
+
+ DECL_LINK ( ChosePageHdl_Impl, void * );
+ DECL_LINK ( OkHdl, Button * );
+ DECL_LINK ( ResetHdl, Button * );
+ DECL_LINK ( CancelHdl, Button * );
+
+ IconChoicePageData* GetPageData ( USHORT nId );
+ void Start_Impl();
+ BOOL OK_Impl();
+
+ void SetPosSizeCtrls ( BOOL bInit = FALSE );
+ void SetPosSizePages ( USHORT nId );
+
+ void FocusOnIcon ( USHORT nId );
+
+protected :
+ void ShowPageImpl ( IconChoicePageData* pData );
+ void HidePageImpl ( IconChoicePageData* pData );
+
+ virtual void PageCreated( USHORT nId, IconChoicePage& rPage );
+ virtual SfxItemSet* CreateInputItemSet( USHORT nId );
+ inline SfxItemSet* GetInputSetImpl() { return (SfxItemSet*)pSet; }
+ inline IconChoicePage* GetTabPage( USHORT nPageId )
+ { return ( GetPageData (nPageId)->pPage?GetPageData (nPageId)->pPage:NULL); }
+ const SfxItemSet* GetRefreshedSet();
+
+ void ActivatePageImpl ();
+ BOOL DeActivatePageImpl ();
+ void ResetPageImpl ();
+
+ short Ok();
+ BOOL IsInOK() const;
+
+public :
+
+ // im Ctor könnte auch die Position des IconChoiceCtrl's gesetzt werden.
+
+ IconChoiceDialog ( Window* pParent, const ResId &rResId,
+ const EIconChoicePos ePos = PosLeft, const SfxItemSet * pItemSet = 0 );
+ ~IconChoiceDialog ();
+
+ ///////////////////////////////////////////////////////////////////////////////////
+ // virtuelle Methoden
+ //
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+
+ ///////////////////////////////////////////////////////////////////////////////////
+ // Schnittstelle
+ //
+
+ SvxIconChoiceCtrlEntry* AddTabPage(
+ USHORT nId, const String& rIconText, const Image& rChoiceIcon,
+ CreatePage pCreateFunc /* != NULL */, GetPageRanges pRangesFunc = NULL /* NULL allowed*/,
+ BOOL bItemsOnDemand = FALSE, ULONG nPos = LIST_APPEND );
+
+ SvxIconChoiceCtrlEntry* AddTabPage(
+ USHORT nId, const String& rIconText, const Image& rChoiceIcon, const Image& rChoiceIconHC,
+ CreatePage pCreateFunc /* != NULL */, GetPageRanges pRangesFunc = NULL /* NULL allowed*/,
+ BOOL bItemsOnDemand = FALSE, ULONG nPos = LIST_APPEND );
+
+ void RemoveTabPage( USHORT nId );
+
+ void SetCurPageId( USHORT nId ) { mnCurrentPageId = nId; FocusOnIcon( nId ); }
+ USHORT GetCurPageId() const { return mnCurrentPageId; }
+ void ShowPage( USHORT nId );
+
+ // liefert ggf. per Map konvertierte lokale Slots
+ const USHORT* GetInputRanges( const SfxItemPool& );
+ void SetInputSet( const SfxItemSet* pInSet );
+ const SfxItemSet* GetOutputItemSet() const { return pOutSet; }
+ const SfxItemSet* GetOutputItemSet( USHORT nId );
+ int FillOutputItemSet();
+
+ const OKButton& GetOKButton() const { return aOKBtn; }
+ OKButton& GetOKButton() { return aOKBtn; }
+ const CancelButton& GetCancelButton() const { return aCancelBtn; }
+ CancelButton& GetCancelButton() { return aCancelBtn; }
+ const HelpButton& GetHelpButton() const { return aHelpBtn; }
+ HelpButton& GetHelpButton() { return aHelpBtn; }
+
+ void RemoveResetButton();
+
+ short Execute();
+ void Start( BOOL bShow = TRUE );
+ sal_Bool QueryClose();
+
+ const SfxItemSet* GetExampleSet() const { return pExampleSet; }
+
+ void SetCtrlColor ( const Color& rColor );
+ EIconChoicePos SetCtrlPos ( const EIconChoicePos& rPos );
+
+ void CreateIconTextAutoMnemonics( void );
+};
+
+#endif //_ICCDLG_HXX
+
diff --git a/cui/source/inc/insdlg.hxx b/cui/source/inc/insdlg.hxx
new file mode 100644
index 000000000000..1924b5ca8c7a
--- /dev/null
+++ b/cui/source/inc/insdlg.hxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * 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: insdlg.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_INSDLG_HXX
+#define _SVX_INSDLG_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+
+#include <svtools/insdlg.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/lstbox.hxx>
+#include <svtools/svmedit.hxx> // MultiLineEdit
+#include <comphelper/embeddedobjectcontainer.hxx>
+
+class INetURLObject;
+
+class InsertObjectDialog_Impl : public ModalDialog
+{
+protected:
+ com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > m_xObj;
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& m_xStorage;
+ comphelper::EmbeddedObjectContainer aCnt;
+
+ InsertObjectDialog_Impl( Window * pParent, const ResId & rResId, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage );
+public:
+ com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObject()
+ { return m_xObj; }
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetIconIfIconified( ::rtl::OUString* pGraphicMediaType );
+ virtual BOOL IsCreateNew() const;
+};
+
+class SvInsertOleDlg : public InsertObjectDialog_Impl
+{
+ RadioButton aRbNewObject;
+ RadioButton aRbObjectFromfile;
+ ListBox aLbObjecttype;
+ Edit aEdFilepath;
+ PushButton aBtnFilepath;
+ CheckBox aCbFilelink;
+ FixedLine aGbObject;
+ OKButton aOKButton1;
+ CancelButton aCancelButton1;
+ HelpButton aHelpButton1;
+ String aStrFile;
+ String _aOldStr;
+ const SvObjectServerList* m_pServers;
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aIconMetaFile;
+ ::rtl::OUString m_aIconMediaType;
+
+ DECL_LINK( DoubleClickHdl, ListBox* );
+ DECL_LINK( BrowseHdl, PushButton* );
+ DECL_LINK( RadioHdl, RadioButton* );
+ void SelectDefault();
+ ListBox& GetObjectTypes()
+ { return aLbObjecttype; }
+ String GetFilePath() const { return aEdFilepath.GetText(); }
+ BOOL IsLinked() const { return aCbFilelink.IsChecked(); }
+ BOOL IsCreateNew() const { return aRbNewObject.IsChecked(); }
+
+public:
+ static void FillObjectServerList( SvObjectServerList* );
+
+ SvInsertOleDlg( Window* pParent,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage,
+ const SvObjectServerList* pServers = NULL );
+ virtual short Execute();
+
+ // get replacement for the iconified embedded object and the mediatype of the replacement
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetIconIfIconified( ::rtl::OUString* pGraphicMediaType );
+};
+
+// class SvInsertPlugInDialog --------------------------------------------
+
+class SvInsertPlugInDialog : public InsertObjectDialog_Impl
+{
+private:
+ Edit aEdFileurl;
+ PushButton aBtnFileurl;
+ FixedLine aGbFileurl;
+ MultiLineEdit aEdPluginsOptions;
+ FixedLine aGbPluginsOptions;
+ OKButton aOKButton1;
+ CancelButton aCancelButton1;
+ HelpButton aHelpButton1;
+ INetURLObject* m_pURL;
+ String m_aCommands;
+
+ DECL_LINK( BrowseHdl, PushButton * );
+ String GetPlugInFile() const { return aEdFileurl.GetText(); }
+ String GetPlugInOptions() const { return aEdPluginsOptions.GetText(); }
+
+public:
+ SvInsertPlugInDialog( Window* pParent,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage );
+
+ ~SvInsertPlugInDialog();
+
+ virtual short Execute();
+};
+
+// class SvInsertAppletDialog --------------------------------------------
+
+class SvInsertAppletDialog : public InsertObjectDialog_Impl
+{
+private:
+ FixedText aFtClassfile;
+ Edit aEdClassfile;
+ FixedText aFtClasslocation;
+ Edit aEdClasslocation;
+ PushButton aBtnClass;
+ FixedLine aGbClass;
+ MultiLineEdit aEdAppletOptions;
+ FixedLine aGbAppletOptions;
+ OKButton aOKButton1;
+ CancelButton aCancelButton1;
+ HelpButton aHelpButton1;
+ INetURLObject* m_pURL;
+ String m_aClass;
+ String m_aCommands;
+ String GetClass() const { return aEdClassfile.GetText(); }
+ String GetClassLocation() const { return aEdClasslocation.GetText(); }
+ String GetAppletOptions() const { return aEdAppletOptions.GetText(); }
+
+ void SetClass( const String &rClass ) { aEdClassfile.SetText(rClass); }
+ void SetClassLocation( const String &rLocation ) { aEdClasslocation.SetText(rLocation); }
+ void SetAppletOptions( const String &rOptions ) { aEdAppletOptions.SetText(rOptions); }
+ DECL_LINK( BrowseHdl, PushButton * );
+
+public:
+ SvInsertAppletDialog( Window* pParent,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage );
+ SvInsertAppletDialog( Window* pParent,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObj );
+ ~SvInsertAppletDialog();
+
+ virtual short Execute();
+};
+
+class SfxInsertFloatingFrameDialog : public InsertObjectDialog_Impl
+{
+private:
+ FixedText aFTName;
+ Edit aEDName;
+ FixedText aFTURL;
+ Edit aEDURL;
+ PushButton aBTOpen;
+
+ RadioButton aRBScrollingOn;
+ RadioButton aRBScrollingOff;
+ RadioButton aRBScrollingAuto;
+ FixedLine aFLScrolling;
+
+ FixedLine aFLSepLeft;
+ RadioButton aRBFrameBorderOn;
+ RadioButton aRBFrameBorderOff;
+ FixedLine aFLFrameBorder;
+
+ FixedLine aFLSepRight;
+ FixedText aFTMarginWidth;
+ NumericField aNMMarginWidth;
+ CheckBox aCBMarginWidthDefault;
+ FixedText aFTMarginHeight;
+ NumericField aNMMarginHeight;
+ CheckBox aCBMarginHeightDefault;
+ FixedLine aFLMargin;
+
+ OKButton aOKButton1;
+ CancelButton aCancelButton1;
+ HelpButton aHelpButton1;
+
+ DECL_STATIC_LINK( SfxInsertFloatingFrameDialog, OpenHdl, PushButton* );
+ DECL_STATIC_LINK( SfxInsertFloatingFrameDialog, CheckHdl, CheckBox* );
+
+public:
+ SfxInsertFloatingFrameDialog( Window *pParent,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage );
+ SfxInsertFloatingFrameDialog( Window* pParent,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObj );
+ virtual short Execute();
+};
+
+#endif // _SVX_INSDLG_HXX
+
diff --git a/cui/source/inc/insrc.hxx b/cui/source/inc/insrc.hxx
new file mode 100644
index 000000000000..e187313bdd03
--- /dev/null
+++ b/cui/source/inc/insrc.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: insrc.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_INSRC_HXX
+#define _SVX_INSRC_HXX
+
+#include <svx/stddlg.hxx>
+
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/button.hxx>
+#include <vcl/group.hxx>
+#include <vcl/button.hxx>
+
+#include <tools/string.hxx>
+
+class SvxInsRowColDlg : public SvxAbstractInsRowColDlg, public ModalDialog
+{
+ FixedText aCount;
+ NumericField aCountEdit;
+ FixedLine aInsFL;
+
+ RadioButton aBeforeBtn;
+ RadioButton aAfterBtn;
+ FixedLine aPosFL;
+
+ String aRow;
+ String aCol;
+
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ bool bColumn;
+
+public:
+ SvxInsRowColDlg( Window* pParent, bool bCol, ULONG nHelpId );
+
+ virtual short Execute(void);
+
+ virtual bool isInsertBefore() const;
+ virtual sal_uInt16 getInsertCount() const;
+};
+
+#endif
+
diff --git a/cui/source/inc/internationaloptions.hxx b/cui/source/inc/internationaloptions.hxx
new file mode 100644
index 000000000000..d17625ee380e
--- /dev/null
+++ b/cui/source/inc/internationaloptions.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * 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: internationaloptions.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFAPP_INTERNATIONALOPTIONS_HXX_
+#define _OFFAPP_INTERNATIONALOPTIONS_HXX_
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+
+namespace offapp
+{
+ class InternationalOptionsPage : public SfxTabPage
+ {
+ private:
+ struct IMPL;
+ IMPL* m_pImpl;
+
+ protected:
+ InternationalOptionsPage( Window* _pParent, const SfxItemSet& _rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& _rSet );
+ virtual void Reset( const SfxItemSet& _rSet );
+
+ public:
+ virtual ~InternationalOptionsPage();
+
+ static SfxTabPage* CreateSd( Window* _pParent, const SfxItemSet& _rAttrSet );
+ static SfxTabPage* CreateSc( Window* _pParent, const SfxItemSet& _rAttrSet );
+ };
+
+} // /namespace offapp
+
+#endif
+
diff --git a/cui/source/inc/labdlg.hxx b/cui/source/inc/labdlg.hxx
new file mode 100644
index 000000000000..9581fbf9ba78
--- /dev/null
+++ b/cui/source/inc/labdlg.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * 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: labdlg.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_LABDLG_HXX
+#define _SVX_LABDLG_HXX
+
+// include ---------------------------------------------------------------
+
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <svtools/valueset.hxx>
+#include <sfx2/tabdlg.hxx>
+class SdrView;
+
+// class SvxCaptionTabPage -----------------------------------------------
+
+const sal_uInt16 CAPTYPE_BITMAPS_COUNT = 3;
+
+class SvxCaptionTabPage : public SfxTabPage
+{
+private:
+ ValueSet aCT_CAPTTYPE;
+ FixedText aFT_ABSTAND;
+ MetricField aMF_ABSTAND;
+ FixedText aFT_WINKEL;
+ ListBox aLB_WINKEL;
+ FixedText aFT_ANSATZ;
+ ListBox aLB_ANSATZ;
+ FixedText aFT_UM;
+ MetricField aMF_ANSATZ;
+ FixedText aFT_ANSATZ_REL;
+ ListBox aLB_ANSATZ_REL;
+ FixedText aFT_LAENGE;
+ MetricField aMF_LAENGE;
+ CheckBox aCB_LAENGE;
+
+ Image* mpBmpCapTypes[CAPTYPE_BITMAPS_COUNT];
+ Image* mpBmpCapTypesH[CAPTYPE_BITMAPS_COUNT];
+
+ String aStrHorzList;
+ String aStrVertList;
+
+ short nCaptionType;
+ BOOL bFixedAngle;
+ INT32 nFixedAngle;
+ INT32 nGap;
+ short nEscDir;
+ BOOL bEscRel;
+ INT32 nEscAbs;
+ INT32 nEscRel;
+ INT32 nLineLen;
+ BOOL bFitLineLen;
+
+ USHORT nAnsatzRelPos;
+ USHORT nAnsatzTypePos;
+ USHORT nWinkelTypePos;
+
+#ifdef _SVX_LABDLG_CXX
+ void SetupAnsatz_Impl( USHORT nType );
+ void SetupType_Impl( USHORT nType );
+ DECL_LINK( AnsatzSelectHdl_Impl, ListBox * );
+ DECL_LINK( AnsatzRelSelectHdl_Impl, ListBox * );
+ DECL_LINK( LineOptHdl_Impl, Button * );
+ DECL_LINK( SelectCaptTypeHdl_Impl, void * );
+#endif
+
+ const SfxItemSet& rOutAttrs;
+ const SdrView* pView;
+
+public:
+ SvxCaptionTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxCaptionTabPage();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+ void Construct();
+ void SetView( const SdrView* pSdrView )
+ { pView = pSdrView; }
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ void FillValueSet();
+};
+
+// class SvxCaptionTabDialog ---------------------------------------------
+
+class SvxCaptionTabDialog : public SfxTabDialog
+{
+private:
+// const SfxItemSet& rOutAttrs;
+ const SdrView* pView;
+ USHORT nAnchorCtrls;
+
+ Link aValidateLink;
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+
+public:
+
+ SvxCaptionTabDialog(Window* pParent, const SdrView* pView,
+ USHORT nAnchorTypes = 0 );
+
+ ~SvxCaptionTabDialog();
+
+ //link for the Writer to validate positions
+ void SetValidateFramePosLink( const Link& rLink );
+};
+
+
+#endif //_SVX_LABDLG_HXX
+
diff --git a/cui/source/inc/linkdlg.hxx b/cui/source/inc/linkdlg.hxx
new file mode 100644
index 000000000000..4703079c9420
--- /dev/null
+++ b/cui/source/inc/linkdlg.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * 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: linkdlg.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _LINKDLG_HXX
+#define _LINKDLG_HXX
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/lstbox.hxx>
+
+#include <svtools/svmedit.hxx> // MultiLineEdit
+#include <svtools/svtabbx.hxx> // MultiLineEdit
+
+/********************** SvUpdateLinksDialog ******************************
+*************************************************************************/
+namespace sfx2
+{
+ class SvLinkManager;
+ class SvBaseLink;
+}
+
+class SvBaseLinksDlg : public ModalDialog
+{
+ using Window::SetType;
+
+ FixedText aFtFiles;
+ FixedText aFtLinks;
+ FixedText aFtType;
+ FixedText aFtStatus;
+ CancelButton aCancelButton1;
+ HelpButton aHelpButton1;
+ PushButton aPbUpdateNow;
+ PushButton aPbOpenSource;
+ PushButton aPbChangeSource;
+ PushButton aPbBreakLink;
+ FixedText aFtFiles2;
+ FixedText aFtSource2;
+ FixedText aFtType2;
+ FixedText aFtUpdate;
+ RadioButton aRbAutomatic;
+ RadioButton aRbManual;
+ FixedText aFtFullFileName;
+ FixedText aFtFullSourceName;
+ FixedText aFtFullTypeName;
+ String aStrAutolink;
+ String aStrManuallink;
+ String aStrBrokenlink;
+ String aStrGraphiclink;
+ String aStrButtonclose;
+ String aStrCloselinkmsg;
+ String aStrCloselinkmsgMulti;
+ String aStrWaitinglink;
+ sfx2::SvLinkManager* pLinkMgr;
+ BOOL bHtmlMode;
+ SvTabListBox aTbLinks;
+ Timer aUpdateTimer;
+
+#if _SOLAR__PRIVATE
+ DECL_LINK( LinksSelectHdl, SvTabListBox * );
+ DECL_LINK( LinksDoubleClickHdl, SvTabListBox * );
+ DECL_LINK( AutomaticClickHdl, RadioButton * );
+ DECL_LINK( ManualClickHdl, RadioButton * );
+ DECL_LINK( UpdateNowClickHdl, PushButton * );
+ DECL_LINK( OpenSourceClickHdl, PushButton * );
+ DECL_LINK( ChangeSourceClickHdl, PushButton * );
+ DECL_LINK( BreakLinkClickHdl, PushButton * );
+ DECL_LINK( UpdateWaitingHdl, Timer * );
+ DECL_LINK( EndEditHdl, sfx2::SvBaseLink* );
+ sfx2::SvBaseLink* GetSelEntry( USHORT* pPos );
+ String ImplGetStateStr( const sfx2::SvBaseLink& );
+ void SetType( sfx2::SvBaseLink& rLink, USHORT nPos, USHORT nType );
+ void InsertEntry( const sfx2::SvBaseLink& rLink, USHORT nPos = LISTBOX_APPEND, sal_Bool bSelect = sal_False);
+#endif
+
+ void StartUpdateTimer() { aUpdateTimer.Start(); }
+
+ SvTabListBox& Links() { return aTbLinks; }
+ FixedText& FileName() { return aFtFullFileName; }
+ FixedText& SourceName() { return aFtFullSourceName; }
+ FixedText& TypeName() { return aFtFullTypeName; }
+ RadioButton& Automatic() { return aRbAutomatic; }
+ RadioButton& Manual() { return aRbManual; }
+ PushButton& UpdateNow() { return aPbUpdateNow; }
+ PushButton& OpenSource() { return aPbOpenSource; }
+ PushButton& ChangeSource() { return aPbChangeSource; }
+ PushButton& BreakLink() { return aPbBreakLink; }
+
+ String& Autolink() { return aStrAutolink; }
+ String& Manuallink() { return aStrManuallink; }
+ String& Brokenlink() { return aStrBrokenlink; }
+ String& Graphiclink() { return aStrGraphiclink; }
+ String& Buttonclose() { return aStrButtonclose; }
+ String& Closelinkmsg() { return aStrCloselinkmsg; }
+ String& CloselinkmsgMulti() { return aStrCloselinkmsgMulti; }
+ String& Waitinglink() { return aStrWaitinglink; }
+ void SetManager( sfx2::SvLinkManager* );
+
+public:
+ SvBaseLinksDlg( Window * pParent, sfx2::SvLinkManager*, BOOL bHtml = FALSE );
+ ~SvBaseLinksDlg();
+ void SetActLink( sfx2::SvBaseLink * pLink );
+};
+
+#endif // _LINKDLG_HXX
diff --git a/cui/source/inc/macroass.hxx b/cui/source/inc/macroass.hxx
new file mode 100755
index 000000000000..a41bd0d8da98
--- /dev/null
+++ b/cui/source/inc/macroass.hxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * 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: macropg.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MACROASS_HXX
+#define _MACROASS_HXX
+
+#include "sal/config.h"
+
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svl/macitem.hxx>
+#include <vcl/lstbox.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+
+class _SfxMacroTabPage;
+class SvStringsDtor;
+class SvTabListBox;
+class Edit;
+class String;
+
+typedef SvStringsDtor* (*FNGetRangeHdl)( _SfxMacroTabPage*, const String& rLanguage );
+typedef SvStringsDtor* (*FNGetMacrosOfRangeHdl)( _SfxMacroTabPage*, const String& rLanguage, const String& rRange );
+
+class SfxConfigGroupListBox_Impl;
+class SfxConfigFunctionListBox_Impl;
+class _HeaderTabListBox;
+class _SfxMacroTabPage_Impl;
+
+class _SfxMacroTabPage : public SfxTabPage
+{
+ SvxMacroTableDtor aTbl;
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, SelectEvent_Impl, SvTabListBox * );
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, SelectGroup_Impl, ListBox * );
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, SelectMacro_Impl, ListBox * );
+
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, DoubleClickHdl_Impl, Control* );
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton * );
+
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, ChangeScriptHdl_Impl, RadioButton * );
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, GetFocus_Impl, Edit* );
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, TimeOut_Impl, Timer* );
+
+protected:
+ _SfxMacroTabPage_Impl* mpImpl;
+
+ _SfxMacroTabPage( Window* pParent, const ResId& rId, const SfxItemSet& rItemSet );
+
+ void InitAndSetHandler();
+ void FillEvents();
+ void FillMacroList();
+ void EnableButtons( const String& rLanguage );
+
+public:
+
+ virtual ~_SfxMacroTabPage();
+
+ void AddEvent( const String & rEventName, USHORT nEventId );
+
+ const SvxMacroTableDtor& GetMacroTbl() const;
+ void SetMacroTbl( const SvxMacroTableDtor& rTbl );
+ void ClearMacroTbl();
+
+ virtual void ScriptChanged( const String& rLanguage );
+ virtual void PageCreated (SfxAllItemSet aSet);
+
+ // zum setzen / abfragen der Links
+ void SetGetRangeLink( FNGetRangeHdl pFn );
+ FNGetRangeHdl GetGetRangeLink() const;
+ void SetGetMacrosOfRangeLink( FNGetMacrosOfRangeHdl pFn );
+ FNGetMacrosOfRangeHdl GetGetMacrosOfRangeLink() const;
+
+ // --------- Erben aus der Basis -------------
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void SetReadOnly( BOOL bSet );
+ BOOL IsReadOnly() const;
+ void SelectEvent( const String& rEventName, USHORT nEventId );
+};
+
+inline const SvxMacroTableDtor& _SfxMacroTabPage::GetMacroTbl() const
+{
+ return aTbl;
+}
+
+inline void _SfxMacroTabPage::SetMacroTbl( const SvxMacroTableDtor& rTbl )
+{
+ aTbl = rTbl;
+}
+
+inline void _SfxMacroTabPage::ClearMacroTbl()
+{
+ aTbl.DelDtor();
+}
+
+class SfxMacroTabPage : public _SfxMacroTabPage
+{
+public:
+ SfxMacroTabPage(
+ Window* pParent,
+ const ResId& rId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame,
+ const SfxItemSet& rSet
+ );
+
+ // --------- Erben aus der Basis -------------
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+};
+
+class SfxMacroAssignDlg : public SfxSingleTabDialog
+{
+public:
+ SfxMacroAssignDlg(
+ Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame,
+ const SfxItemSet& rSet );
+ virtual ~SfxMacroAssignDlg();
+};
+
+#endif
diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx
new file mode 100644
index 000000000000..0ed414e92751
--- /dev/null
+++ b/cui/source/inc/macropg.hxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * 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: macropg.hxx,v $
+ * $Revision: 1.11.166.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MACROPG_HXX
+#define _MACROPG_HXX
+
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/tabdlg.hxx>
+
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <svl/macitem.hxx>
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include <rtl/ustring.hxx>
+
+#include <hash_map>
+#include <vector>
+
+typedef ::std::hash_map< ::rtl::OUString, ::std::pair< ::rtl::OUString, ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventsHash;
+
+struct EventDisplayName
+{
+ const sal_Char* pAsciiEventName;
+ USHORT nEventResourceID;
+ EventDisplayName() : pAsciiEventName( NULL ), nEventResourceID(0) { }
+ EventDisplayName( const sal_Char* _pAsciiName, const USHORT _nResId )
+ : pAsciiEventName( _pAsciiName )
+ , nEventResourceID( _nResId )
+ {
+ }
+};
+typedef ::std::vector< EventDisplayName > EventDisplayNames;
+
+class _SvxMacroTabPage;
+class SvStringsDtor;
+class SvTabListBox;
+class Edit;
+class String;
+
+class _HeaderTabListBox;
+class _SvxMacroTabPage_Impl;
+
+
+class _SvxMacroTabPage : public SfxTabPage
+{
+#if _SOLAR__PRIVATE
+ DECL_STATIC_LINK( _SvxMacroTabPage, SelectEvent_Impl, SvTabListBox * );
+ DECL_STATIC_LINK( _SvxMacroTabPage, AssignDeleteHdl_Impl, PushButton * );
+ DECL_STATIC_LINK( _SvxMacroTabPage, DoubleClickHdl_Impl, SvTabListBox * );
+
+ static long GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton* pBtn );
+
+#endif
+protected:
+ _SvxMacroTabPage_Impl* mpImpl;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocEvents;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > m_xModifiable;
+ EventsHash m_appEventsHash;
+ EventsHash m_docEventsHash;
+ bool bReadOnly, bDocModified, bAppEvents, bInitialized;
+ EventDisplayNames aDisplayNames;
+
+ _SvxMacroTabPage( Window* pParent, const ResId& rId, const SfxItemSet& rItemSet );
+
+ void EnableButtons( const String& rLanguage );
+ ::com::sun::star::uno::Any GetPropsByName( const ::rtl::OUString& eventName, EventsHash& eventsHash );
+ ::std::pair< ::rtl::OUString, ::rtl::OUString > GetPairFromAny( ::com::sun::star::uno::Any aAny );
+
+public:
+
+ virtual ~_SvxMacroTabPage();
+ void InitResources();
+
+ void InitAndSetHandler( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xAppEvents, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xDocEvents, ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > xModifiable );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+
+ using SfxTabPage::Reset;
+ virtual void Reset();
+
+ void DisplayAppEvents( bool appEvents);
+ void SetReadOnly( BOOL bSet );
+ BOOL IsReadOnly() const;
+};
+
+class SvxMacroTabPage : public _SvxMacroTabPage
+{
+public:
+ SvxMacroTabPage(
+ Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame,
+ const SfxItemSet& rSet,
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xNameReplace,
+ sal_uInt16 nSelectedIndex
+ );
+ virtual ~SvxMacroTabPage();
+};
+
+// class SvxMacroAssignDlg --------------------------------------------------
+
+typedef USHORT* (*GetTabPageRanges)(); // liefert internationale Which-Werte
+
+class SvxMacroAssignSingleTabDialog : public SfxModalDialog
+{
+public:
+ SvxMacroAssignSingleTabDialog( Window* pParent, const SfxItemSet& rOptionsSet, USHORT nUniqueId );
+
+ virtual ~SvxMacroAssignSingleTabDialog();
+
+ void SetTabPage( SfxTabPage* pTabPage );
+ // SfxTabPage* GetTabPage() const { return pPage; }
+
+ // OKButton* GetOKButton() const { return pOKBtn; }
+ // CancelButton* GetCancelButton() const { return pCancelBtn; }
+
+private:
+ SfxViewFrame* pFrame;
+
+ FixedLine* pFixedLine;
+
+ OKButton* pOKBtn;
+ CancelButton* pCancelBtn;
+ HelpButton* pHelpBtn;
+
+ SfxTabPage* pPage;
+ const SfxItemSet* pOptions;
+ SfxItemSet* pOutSet;
+
+#if _SOLAR__PRIVATE
+ DECL_DLLPRIVATE_LINK( OKHdl_Impl, Button * );
+#endif
+};
+
+
+class SvxMacroAssignDlg : public SvxMacroAssignSingleTabDialog
+{
+public:
+ SvxMacroAssignDlg(
+ Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame,
+ const SfxItemSet& rSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace >& xNameReplace,
+ sal_uInt16 nSelectedIndex
+ );
+ virtual ~SvxMacroAssignDlg();
+};
+
+#endif
diff --git a/cui/source/inc/measure.hxx b/cui/source/inc/measure.hxx
new file mode 100644
index 000000000000..71f665bea750
--- /dev/null
+++ b/cui/source/inc/measure.hxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * 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: measure.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_MEASURE_HXX
+#define _SVX_MEASURE_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svx/dlgctrl.hxx>
+#include <svx/measctrl.hxx>
+
+class SdrView;
+
+/*************************************************************************
+|*
+|* Dialog zum "Andern von TextAttributen
+|*
+\************************************************************************/
+
+class SvxMeasurePage : public SvxTabPage
+{
+private:
+
+ FixedLine aFlLine;
+ FixedText aFtLineDist;
+ MetricField aMtrFldLineDist;
+ FixedText aFtHelplineOverhang;
+ MetricField aMtrFldHelplineOverhang;
+ FixedText aFtHelplineDist;
+ MetricField aMtrFldHelplineDist;
+ FixedText aFtHelpline1Len;
+ MetricField aMtrFldHelpline1Len;
+ FixedText aFtHelpline2Len;
+ MetricField aMtrFldHelpline2Len;
+ TriStateBox aTsbBelowRefEdge;
+ FixedText aFtDecimalPlaces;
+ MetricField aMtrFldDecimalPlaces;
+
+ FixedLine aFlLabel;
+ FixedText aFtPosition;
+ SvxRectCtl aCtlPosition;
+ TriStateBox aTsbAutoPosV;
+ TriStateBox aTsbAutoPosH;
+ TriStateBox aTsbShowUnit;
+ ListBox aLbUnit;
+ TriStateBox aTsbParallel;
+
+ SvxXMeasurePreview aCtlPreview;
+
+ FixedLine aFlVert;
+
+ const SfxItemSet& rOutAttrs;
+ SfxItemSet aAttrSet;
+ const SdrView* pView;
+ SfxMapUnit eUnit;
+
+ BOOL bPositionModified;
+
+#ifdef _SVX_MEASURE_CXX
+ void FillUnitLB();
+
+ DECL_LINK( ClickAutoPosHdl_Impl, void * );
+ DECL_LINK( ChangeAttrHdl_Impl, void * );
+#endif
+
+public:
+
+ SvxMeasurePage( Window* pWindow, const SfxItemSet& rInAttrs );
+ ~SvxMeasurePage();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
+
+ void Construct();
+ void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
+ virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001
+};
+
+/*************************************************************************
+|*
+|* Von SfxSingleTabDialog abgeleitet, um vom Control "uber virtuelle Methode
+|* benachrichtigt werden zu k"onnen.
+|*
+\************************************************************************/
+
+class SvxMeasureDialog : public SfxSingleTabDialog
+{
+public:
+ SvxMeasureDialog( Window* pParent, const SfxItemSet& rAttr,
+ const SdrView* pView );
+ ~SvxMeasureDialog();
+};
+
+
+#endif // _SVX_MEASURE_HXX
+
diff --git a/cui/source/inc/multifil.hxx b/cui/source/inc/multifil.hxx
new file mode 100644
index 000000000000..242e28c17707
--- /dev/null
+++ b/cui/source/inc/multifil.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * 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: multifil.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_MULTIFIL_HXX
+#define _SVX_MULTIFIL_HXX
+
+// include ---------------------------------------------------------------
+
+#include "multipat.hxx"
+
+// #97807# ----------------------------------------------------
+#include <ucbhelper/content.hxx>
+#include <map>
+
+// class SvxMultiFileDialog ----------------------------------------------
+
+class SvxMultiFileDialog : public SvxMultiPathDialog
+{
+private:
+ // #97807# -------------------------------------
+ std::map< String, ::ucbhelper::Content > aFileContentMap;
+
+ DECL_LINK( AddHdl_Impl, PushButton * );
+ DECL_LINK( DelHdl_Impl, PushButton * );
+
+public:
+ SvxMultiFileDialog( Window* pParent, BOOL bEmptyAllowed = FALSE );
+ ~SvxMultiFileDialog();
+
+ String GetFiles() const { return SvxMultiPathDialog::GetPath(); }
+ void SetFiles( const String& rPath ) { SvxMultiPathDialog::SetPath(rPath); aDelBtn.Enable(); }
+};
+
+
+#endif
+
diff --git a/cui/source/inc/multipat.hxx b/cui/source/inc/multipat.hxx
new file mode 100644
index 000000000000..e7fd86799955
--- /dev/null
+++ b/cui/source/inc/multipat.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * 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: multipat.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_MULTIPAT_HXX
+#define _SVX_MULTIPAT_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/dialog.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+
+#include "radiobtnbox.hxx"
+
+// define ----------------------------------------------------------------
+
+// different delimiter for Unix (:) and Windows (;)
+
+#ifdef UNX
+#define CLASSPATH_DELIMITER ':'
+#else
+#define CLASSPATH_DELIMITER ';'
+#endif
+
+// forward ---------------------------------------------------------------
+
+struct MultiPath_Impl;
+
+// class SvxMultiPathDialog ----------------------------------------------
+
+class SvxMultiPathDialog : public ModalDialog
+{
+protected:
+ FixedLine aPathFL;
+ ListBox aPathLB;
+ svx::SvxRadioButtonListBox aRadioLB;
+ FixedText aRadioFT;
+ PushButton aAddBtn;
+ PushButton aDelBtn;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpButton;
+
+ MultiPath_Impl* pImpl;
+
+ DECL_LINK( AddHdl_Impl, PushButton * );
+ DECL_LINK( DelHdl_Impl, PushButton * );
+ DECL_LINK( SelectHdl_Impl, void * );
+ DECL_LINK( CheckHdl_Impl, svx::SvxRadioButtonListBox * );
+
+public:
+ SvxMultiPathDialog( Window* pParent, BOOL bEmptyAllowed = FALSE );
+ ~SvxMultiPathDialog();
+
+ String GetPath() const;
+ void SetPath( const String& rPath );
+ void SetClassPathMode();
+ sal_Bool IsClassPathMode() const;
+ void EnableRadioButtonMode();
+};
+
+#endif // #ifndef _SVX_MULTIPAT_HXX
+
diff --git a/cui/source/inc/newtabledlg.hxx b/cui/source/inc/newtabledlg.hxx
new file mode 100644
index 000000000000..9d29152a656f
--- /dev/null
+++ b/cui/source/inc/newtabledlg.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: newtabledlg.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_NEWTABLEDLG_HXX
+#define _SVX_NEWTABLEDLG_HXX
+
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/button.hxx>
+
+#include <svx/stddlg.hxx>
+#include <svx/svxdlg.hxx>
+
+class SvxNewTableDialog : public SvxAbstractNewTableDialog, public ModalDialog
+{
+private:
+ FixedText maFtColumns;
+ NumericField maNumColumns;
+ FixedText maFtRows;
+ NumericField maNumRows;
+
+ FixedLine maFlSep;
+ HelpButton maHelpButton;
+ OKButton maOkButton;
+ CancelButton maCancelButton;
+
+public:
+ SvxNewTableDialog( Window* pWindow );
+
+ virtual short Execute(void);
+ virtual void Apply(void);
+
+ virtual sal_Int32 getRows() const;
+ virtual sal_Int32 getColumns() const;
+};
+
+#endif // _SVX_NEWTABLEDLG_HXX
+
+
diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx
new file mode 100644
index 000000000000..0c2b42d64150
--- /dev/null
+++ b/cui/source/inc/numfmt.hxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * 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: numfmt.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_NUMFMT_HXX
+#define _SVX_NUMFMT_HXX
+
+//------------------------------------------------------------------------
+
+#include <vcl/window.hxx>
+#include <tools/color.hxx>
+#include <tools/string.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/field.hxx>
+#include <svx/langbox.hxx>
+#include <svx/fontlb.hxx>
+
+//CHINA001 #define SVX_NUMVAL_STANDARD -1234.12345678901234
+//CHINA001 #define SVX_NUMVAL_CURRENCY -1234
+//CHINA001 #define SVX_NUMVAL_PERCENT -0.1295
+//CHINA001 #define SVX_NUMVAL_TIME 36525.5678935185
+//CHINA001 #define SVX_NUMVAL_DATE 36525.5678935185
+//CHINA001 #define SVX_NUMVAL_BOOLEAN 1
+
+//------------------------------------------------------------------------
+
+class SvxNumberFormatShell;
+class SvxNumberInfoItem;
+
+//------------------------------------------------------------------------
+
+class SvxNumberPreviewImpl : public Window
+{
+private:
+ String aPrevStr;
+ Color aPrevCol;
+
+ void InitSettings( BOOL bForeground, BOOL bBackground );
+
+protected:
+ virtual void Paint( const Rectangle& rRect );
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+public:
+ SvxNumberPreviewImpl( Window* pParent, const ResId& rResId );
+ ~SvxNumberPreviewImpl();
+
+ void NotifyChange( const String& rPrevStr, const Color* pColor = NULL );
+};
+
+// -----------------------------------------------------------------------
+
+#include <sfx2/layout.hxx>
+#include <layout/layout-pre.hxx>
+
+class SvxNumberFormatTabPage : public SfxTabPage
+{
+ using SfxTabPage::DeactivatePage;
+
+public:
+ ~SvxNumberFormatTabPage();
+
+#undef SfxTabPage
+#define SfxTabPage ::SfxTabPage
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual int DeactivatePage ( SfxItemSet* pSet = NULL );
+
+ void SetInfoItem( const SvxNumberInfoItem& rItem );
+ void SetNumberFormatList( const SvxNumberInfoItem& rItem )
+ { SetInfoItem( rItem ); }
+
+ void SetOkHdl( const Link& rOkHandler );
+ void HideLanguage(BOOL nFlag=TRUE);
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001
+private:
+ SvxNumberFormatTabPage( Window* pParent,
+ const SfxItemSet& rCoreAttrs );
+ FixedText aFtCategory;
+ ListBox aLbCategory;
+ FixedText aFtFormat;
+ ListBox aLbCurrency;
+ SvxFontListBox aLbFormat;
+ FixedText aFtLanguage;
+ SvxLanguageBox aLbLanguage;
+ CheckBox aCbSourceFormat;
+
+ FixedText aFtDecimals;
+ NumericField aEdDecimals;
+ FixedText aFtLeadZeroes;
+ NumericField aEdLeadZeroes;
+ CheckBox aBtnNegRed;
+ CheckBox aBtnThousand;
+ FixedLine aFlOptions;
+
+ FixedText aFtEdFormat;
+ Edit aEdFormat;
+ ImageButton aIbAdd;
+ ImageButton aIbInfo;
+ ImageButton aIbRemove;
+
+ FixedText aFtComment;
+ Edit aEdComment;
+ Timer aResetWinTimer;
+
+ SvxNumberPreviewImpl aWndPreview;
+
+ SvxNumberInfoItem* pNumItem;
+ SvxNumberFormatShell* pNumFmtShell;
+ ULONG nInitFormat;
+ Link fnOkHdl;
+
+ BOOL bNumItemFlag; //Fuer Handling mit DocShell
+ BOOL bOneAreaFlag;
+ short nFixedCategory;
+
+ long nCatHeight;
+
+ long nCurFormatY;
+ long nCurFormatHeight;
+ long nStdFormatY;
+ long nStdFormatHeight;
+ LocalizedString sAutomaticEntry;
+
+ Window* pLastActivWindow;
+
+#ifdef _SVX_NUMFMT_CXX
+ void Init_Impl();
+ void FillCurrencyBox();
+ void FillFormatListBox_Impl( SvxDelStrgs& rEntries );
+ void UpdateOptions_Impl( BOOL bCheckCatChange );
+ void UpdateFormatListBox_Impl( USHORT bCat, BOOL bUpdateEdit );
+ void DeleteEntryList_Impl( SvxDelStrgs& rEntries );
+ void Obstructing();
+ void EnableBySourceFormat_Impl();
+ void SetCategory( USHORT nPos );
+ String GetExpColorString( Color*& rpPreviewColor, const String& aFormatStr, short nTmpCatPos );
+ void MakePreviewText( const String& rFormat );
+ void ChangePreviewText( USHORT nPos );
+ void AddAutomaticLanguage_Impl(LanguageType eAutoLang, BOOL bSelect);
+ // Handler
+ DECL_LINK( LostFocusHdl_Impl, Edit* pEd );
+ DECL_LINK( DoubleClickHdl_Impl, SvxFontListBox* pLb );
+ DECL_LINK( SelFormatHdl_Impl, void * );
+ DECL_LINK( ClickHdl_Impl, ImageButton* pIB );
+ DECL_LINK( EditHdl_Impl, Edit* pEdFormat );
+ DECL_LINK( OptHdl_Impl, void * );
+ DECL_LINK( TimeHdl_Impl, Timer * );
+
+#endif
+};
+
+#include <layout/layout-post.hxx>
+
+#endif
+
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
new file mode 100644
index 000000000000..a5d8a212d48e
--- /dev/null
+++ b/cui/source/inc/numpages.hxx
@@ -0,0 +1,472 @@
+/*************************************************************************
+ *
+ * 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: numpages.hxx,v $
+ * $Revision: 1.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.
+ *
+ ************************************************************************/
+#ifndef _SVX_NUMPAGES_HXX
+#define _SVX_NUMPAGES_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/menubtn.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+#ifndef _SVX_NUMDEF_HXX
+#include <svx/numdef.hxx>
+#endif
+#include <svtools/ctrlbox.hxx>
+#include <svl/svarray.hxx>
+
+// -----------------------------------------------------------------------
+class SvxNumRule;
+class SvxBmpNumValueSet;
+class SvxNumValueSet;
+class ValueSet;
+class SvxNumberingPreview;
+class SvxBrushItem;
+
+/*-----------------13.02.97 14.02-------------------
+
+--------------------------------------------------*/
+
+struct SvxNumSettings_Impl
+{
+ short nNumberType;
+ short nParentNumbering;
+ rtl::OUString sPrefix;
+ rtl::OUString sSuffix;
+ rtl::OUString sBulletChar;
+ rtl::OUString sBulletFont;
+ SvxNumSettings_Impl() :
+ nNumberType(0),
+ nParentNumbering(0)
+ {}
+};
+
+typedef SvxNumSettings_Impl* SvxNumSettings_ImplPtr;
+SV_DECL_PTRARR_DEL(SvxNumSettingsArr_Impl,SvxNumSettings_ImplPtr,8,4)
+
+/*-----------------07.02.97 11.36-------------------
+
+--------------------------------------------------*/
+class SvxSingleNumPickTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+ FixedLine aValuesFL;
+ SvxNumValueSet* pExamplesVS;
+ SvxNumSettingsArr_Impl aNumSettingsArr;
+ SvxNumRule* pActNum;
+ SvxNumRule* pSaveNum;
+ USHORT nActNumLvl;
+ BOOL bModified : 1;
+ BOOL bPreset : 1;
+
+ String sNumCharFmtName;
+ USHORT nNumItemId;
+
+ protected:
+ DECL_LINK( NumSelectHdl_Impl, ValueSet*);
+ DECL_LINK( DoubleClickHdl_Impl, ValueSet* );
+
+ public:
+ SvxSingleNumPickTabPage(Window* pParent,
+ const SfxItemSet& rSet);
+ ~SvxSingleNumPickTabPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet *pSet);
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void SetNumCharFmtName(const String& rName){sNumCharFmtName = rName;}
+};
+
+/*-----------------07.02.97 11.36-------------------
+
+--------------------------------------------------*/
+
+class SvxBulletPickTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+ FixedLine aValuesFL;
+ SvxNumValueSet* pExamplesVS;
+ SvxNumRule* pActNum;
+ SvxNumRule* pSaveNum;
+ USHORT nActNumLvl;
+ BOOL bModified : 1;
+ BOOL bPreset : 1;
+ USHORT nNumItemId;
+
+ String sBulletCharFmtName;
+ protected:
+ DECL_LINK(NumSelectHdl_Impl, ValueSet*);
+ DECL_LINK( DoubleClickHdl_Impl, ValueSet* );
+ public:
+ SvxBulletPickTabPage(Window* pParent,
+ const SfxItemSet& rSet);
+ ~SvxBulletPickTabPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet *pSet);
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void SetCharFmtName(const String& rName){sBulletCharFmtName = rName;}
+ virtual void PageCreated(SfxAllItemSet aSet); // add CHINA001
+};
+
+/*-----------------07.02.97 11.36-------------------
+ TabPage fuer vollstaendig Numerierung
+--------------------------------------------------*/
+#define NUMTYPE_MEMBER 4 // Anzahl der Elemente des FormatStrings je Ebene
+#define NUM_VALUSET_COUNT 16
+class SvxNumPickTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+ FixedLine aValuesFL;
+ SvxNumValueSet* pExamplesVS;
+ String sNumCharFmtName;
+ String sBulletCharFmtName;
+
+ SvxNumSettingsArr_Impl aNumSettingsArrays[NUM_VALUSET_COUNT]; // wird mit den fuenf Formaten initialisiert
+
+ SvxNumRule* pActNum;
+ SvxNumRule* pSaveNum;
+ USHORT nActNumLvl;
+ USHORT nNumItemId;
+ BOOL bModified : 1;
+ BOOL bPreset : 1;
+
+
+ protected:
+ DECL_LINK(NumSelectHdl_Impl, ValueSet*);
+ DECL_LINK( DoubleClickHdl_Impl, ValueSet* );
+
+ public:
+ SvxNumPickTabPage(Window* pParent,
+ const SfxItemSet& rSet);
+ ~SvxNumPickTabPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet *pSet);
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void SetCharFmtNames(const String& rCharName, const String& rBulName)
+ { sNumCharFmtName = rCharName;
+ sBulletCharFmtName = rBulName;}
+ virtual void PageCreated(SfxAllItemSet aSet); // add CHINA001
+};
+
+/*-----------------12.02.97 07.42-------------------
+
+--------------------------------------------------*/
+class SvxBitmapPickTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+ FixedLine aValuesFL;
+ SvxBmpNumValueSet* pExamplesVS;
+ FixedText aErrorText;
+ CheckBox aLinkedCB;
+
+ List aGrfNames;
+ String sNumCharFmtName;
+
+ SvxNumRule* pActNum;
+ SvxNumRule* pSaveNum;
+ USHORT nActNumLvl;
+ USHORT nNumItemId;
+ SfxMapUnit eCoreUnit;
+ BOOL bModified : 1;
+ BOOL bPreset : 1;
+
+ protected:
+ DECL_LINK( NumSelectHdl_Impl, ValueSet*);
+ DECL_LINK( DoubleClickHdl_Impl, ValueSet* );
+ DECL_LINK( LinkBmpHdl_Impl, CheckBox* );
+
+ public:
+ SvxBitmapPickTabPage(Window* pParent,
+ const SfxItemSet& rSet);
+ ~SvxBitmapPickTabPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet *pSet);
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void SetNumCharFmtName(const String& rName){sNumCharFmtName = rName;}
+};
+
+/*-----------------01.12.97 16:13-------------------
+
+--------------------------------------------------*/
+class SvxNumOptionsTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+ FixedLine aFormatFL;
+ FixedText aLevelFT;
+ MultiListBox aLevelLB;
+
+ FixedText aFmtFT;
+ ListBox aFmtLB;
+ FixedText aPrefixFT;
+ Edit aPrefixED;
+ FixedText aSuffixFT;
+ Edit aSuffixED;
+ FixedText aCharFmtFT;
+ ListBox aCharFmtLB;
+ FixedText aBulColorFT;
+ ColorListBox aBulColLB;
+ FixedText aBulRelSizeFT;
+ MetricField aBulRelSizeMF;
+ FixedText aAllLevelFT;
+ NumericField aAllLevelNF;
+ FixedText aStartFT;
+ NumericField aStartED;
+ PushButton aBulletPB;
+ FixedText aAlignFT;
+ ListBox aAlignLB;
+ FixedText aBitmapFT;
+ MenuButton aBitmapMB;
+ FixedText aSizeFT;
+ MetricField aWidthMF;
+ FixedText aMultFT;
+ MetricField aHeightMF;
+ CheckBox aRatioCB;
+ FixedText aOrientFT;
+ ListBox aOrientLB;
+
+ FixedLine aSameLevelFL;
+ CheckBox aSameLevelCB;
+
+ String sNumCharFmtName;
+ String sBulletCharFmtName;
+
+ Timer aInvalidateTimer;
+
+ SvxNumberingPreview* pPreviewWIN;
+
+ SvxNumRule* pActNum;
+ SvxNumRule* pSaveNum;
+
+ Size aInitSize[SVX_MAX_NUM];
+
+ BOOL bLastWidthModified : 1;
+ BOOL bModified : 1;
+ BOOL bPreset : 1;
+ BOOL bAutomaticCharStyles: 1;
+ BOOL bHTMLMode : 1;
+ BOOL bMenuButtonInitialized : 1;
+
+ List aGrfNames;
+ Font aActBulletFont;
+ String sBullet;
+ String sStartWith;
+
+ BYTE nBullet;
+ USHORT nActNumLvl;
+ USHORT nNumItemId;
+ SfxMapUnit eCoreUnit;
+
+ void InitControls();
+ void SwitchNumberType( BYTE nType, BOOL bBmp = FALSE );
+ void CheckForStartValue_Impl(sal_uInt16 nNumberingType);
+
+ DECL_LINK( NumberTypeSelectHdl_Impl, ListBox * );
+ DECL_LINK( LevelHdl_Impl, ListBox * );
+ DECL_LINK( PopupActivateHdl_Impl, Menu * );
+ DECL_LINK( GraphicHdl_Impl, MenuButton * );
+ DECL_LINK( BulletHdl_Impl, Button * );
+ DECL_LINK( SizeHdl_Impl, MetricField * );
+ DECL_LINK( RatioHdl_Impl, CheckBox * );
+ DECL_LINK( CharFmtHdl_Impl, ListBox * );
+ DECL_LINK( EditModifyHdl_Impl, Edit * );
+ DECL_LINK( AllLevelHdl_Impl, NumericField * );
+ DECL_LINK( OrientHdl_Impl, ListBox * );
+ DECL_LINK( SameLevelHdl_Impl, CheckBox * );
+ DECL_LINK( BulColorHdl_Impl, ColorListBox* );
+ DECL_LINK( BulRelSizeHdl_Impl, MetricField *);
+ DECL_LINK( PreviewInvalidateHdl_Impl, Timer* );
+
+ DECL_STATIC_LINK( SvxNumOptionsTabPage, GraphicArrivedHdl_Impl, SvxBrushItem* );
+
+ public:
+ SvxNumOptionsTabPage(Window* pParent,
+ const SfxItemSet& rSet);
+ ~SvxNumOptionsTabPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet *pSet);
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+//??? void SetWrtShell(SwWrtShell* pSh);
+ void SetCharFmts(const String& rNumName, const String& rBulletName )
+ {
+ sNumCharFmtName = rNumName;
+ sBulletCharFmtName = rBulletName;
+ }
+ void SetMetric(FieldUnit eSet);
+
+ ListBox& GetCharFmtListBox() {return aCharFmtLB;}
+ void SetModified(BOOL bRepaint = TRUE);
+ virtual void PageCreated(SfxAllItemSet aSet); // add CHINA001
+};
+
+/*-----------------03.12.97 10:18-------------------
+
+--------------------------------------------------*/
+class SvxNumPositionTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+ FixedLine aPositionFL;
+ FixedText aLevelFT;
+ MultiListBox aLevelLB;
+
+ // --> OD 2008-01-11 #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-01-10 #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;
+
+#if OSL_DEBUG_LEVEL > 1
+ FixedText* pDebugFixedText;
+#endif
+ SvxNumberingPreview* pPreviewWIN;
+
+ SvxNumRule* pActNum;
+ SvxNumRule* pSaveNum;
+
+ USHORT nActNumLvl;
+ USHORT nNumItemId;
+ SfxMapUnit eCoreUnit;
+
+ BOOL bModified : 1;
+ BOOL bPreset : 1;
+ BOOL bInInintControl : 1; //Modify-Fehler umgehen, soll ab 391 behoben sein
+ // --> OD 2008-01-11 #newlistlevelattrs#
+ bool bLabelAlignmentPosAndSpaceModeActive;
+ // <--
+
+ void InitControls();
+
+ DECL_LINK( LevelHdl_Impl, ListBox * );
+ DECL_LINK( EditModifyHdl_Impl, Edit*);
+ DECL_LINK( DistanceHdl_Impl, MetricField * );
+ DECL_LINK( RelativeHdl_Impl, CheckBox * );
+ DECL_LINK( StandardHdl_Impl, PushButton * );
+
+ // --> OD 2008-01-11 #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* );
+ // <--
+
+public:
+ SvxNumPositionTabPage(Window* pParent,
+ const SfxItemSet& rSet);
+ ~SvxNumPositionTabPage();
+
+ 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 SetMetric(FieldUnit eSet);
+ void SetModified(BOOL bRepaint = TRUE);
+ virtual void PageCreated(SfxAllItemSet aSet); // add CHINA001
+};
+
+#endif
+
+
+
+
diff --git a/cui/source/inc/optasian.hxx b/cui/source/inc/optasian.hxx
new file mode 100644
index 000000000000..98c142031cd2
--- /dev/null
+++ b/cui/source/inc/optasian.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * 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: optasian.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTASIAN_HXX
+#define _SVX_OPTASIAN_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/group.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/edit.hxx>
+#include <svx/langbox.hxx>
+struct SvxAsianLayoutPage_Impl;
+class SvxAsianLayoutPage : public SfxTabPage
+{
+ FixedLine aKerningGB;
+ RadioButton aCharKerningRB;
+ RadioButton aCharPunctKerningRB;
+
+ FixedLine aCharDistGB;
+ RadioButton aNoCompressionRB;
+ RadioButton aPunctCompressionRB;
+ RadioButton aPunctKanaCompressionRB;
+
+ FixedLine aStartEndGB;
+
+ FixedText aLanguageFT;
+ SvxLanguageBox aLanguageLB;
+ CheckBox aStandardCB;
+
+ FixedText aStartFT;
+ Edit aStartED;
+ FixedText aEndFT;
+ Edit aEndED;
+ FixedText aHintFT;
+
+ SvxAsianLayoutPage_Impl* pImpl;
+
+ DECL_LINK(LanguageHdl, SvxLanguageBox*);
+ DECL_LINK(ChangeStandardHdl, CheckBox*);
+ DECL_LINK(ModifyHdl, Edit*);
+
+ SvxAsianLayoutPage( Window* pParent, const SfxItemSet& rSet );
+public:
+
+ virtual ~SvxAsianLayoutPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ static UINT16* GetRanges();
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif
+
diff --git a/cui/source/inc/optdict.hxx b/cui/source/inc/optdict.hxx
new file mode 100644
index 000000000000..b09c1d1e773e
--- /dev/null
+++ b/cui/source/inc/optdict.hxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * 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: optdict.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTDICT_HXX
+#define _SVX_OPTDICT_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/dialog.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/combobox.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/decoview.hxx>
+#include <com/sun/star/util/Language.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+
+#include <svx/simptabl.hxx>
+#include <svx/langbox.hxx>
+
+namespace com{namespace sun{namespace star{
+namespace linguistic2{
+ class XDictionary;
+ class XSpellChecker1;
+ class XSpellChecker;
+}}}}
+
+// forward ---------------------------------------------------------------
+
+
+// class SvxNewDictionaryDialog ------------------------------------------
+
+class SvxNewDictionaryDialog : public ModalDialog
+{
+private:
+ FixedText aNameText;
+ Edit aNameEdit;
+ FixedText aLanguageText;
+ SvxLanguageBox aLanguageLB;
+ CheckBox aExceptBtn;
+ FixedLine aNewDictBox;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > xNewDic;
+
+#ifdef _SVX_OPTDICT_CXX
+ DECL_LINK( OKHdl_Impl, Button * );
+ DECL_LINK( ModifyHdl_Impl, Edit * );
+#endif
+
+public:
+ SvxNewDictionaryDialog( Window* pParent,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary >
+ GetNewDictionary() { return xNewDic; }
+};
+
+// class SvxDictEdit ----------------------------------------------------
+
+class SvxDictEdit : public Edit
+{
+ Link aActionLink;
+ sal_Bool bSpaces;
+
+ public:
+ SvxDictEdit(Window* pParent, const ResId& rResId) :
+ Edit(pParent, rResId), bSpaces(sal_False){}
+
+ void SetActionHdl( const Link& rLink )
+ { aActionLink = rLink;}
+
+ void SetSpaces(sal_Bool bSet)
+ {bSpaces = bSet;}
+
+ virtual void KeyInput( const KeyEvent& rKEvent );
+};
+
+// class SvxEditDictionaryDialog -----------------------------------------
+
+class SvxEditDictionaryDialog : public ModalDialog
+{
+private:
+
+ FixedText aBookFT;
+ ListBox aAllDictsLB;
+ FixedText aLangFT;
+ SvxLanguageBox aLangLB;
+
+ FixedText aWordFT;
+ SvxDictEdit aWordED;
+ FixedText aReplaceFT;
+ SvxDictEdit aReplaceED;
+ SvTabListBox aWordsLB;
+ PushButton aNewReplacePB;
+ PushButton aDeletePB;
+ FixedLine aEditDictsBox;
+
+ CancelButton aCloseBtn;
+ HelpButton aHelpBtn;
+ String sModify;
+ String sNew;
+ DecorationView aDecoView;
+
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > > aDics; //! snapshot copy to work on
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
+
+ short nOld;
+ long nWidth;
+ sal_Bool bFirstSelect;
+ sal_Bool bDoNothing;
+ BOOL bDicIsReadonly;
+
+#ifdef _SVX_OPTDICT_CXX
+ DECL_LINK( SelectBookHdl_Impl, ListBox * );
+ DECL_LINK( SelectLangHdl_Impl, ListBox * );
+ DECL_LINK(SelectHdl, SvTabListBox*);
+ DECL_LINK(NewDelHdl, PushButton*);
+ DECL_LINK(ModifyHdl, Edit*);
+
+
+ void ShowWords_Impl( sal_uInt16 nId );
+ void SetLanguage_Impl( ::com::sun::star::util::Language nLanguage );
+ sal_Bool IsDicReadonly_Impl() const { return bDicIsReadonly; }
+ void SetDicReadonly_Impl( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > &xDic );
+
+ void RemoveDictEntry(SvLBoxEntry* pEntry);
+ USHORT GetLBInsertPos(const String &rDicWord);
+
+#endif
+
+protected:
+
+ virtual void Paint( const Rectangle& rRect );
+
+public:
+ SvxEditDictionaryDialog( Window* pParent,
+ const String& rName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1> &xSpl );
+ ~SvxEditDictionaryDialog();
+
+ sal_uInt16 GetSelectedDict() {return aAllDictsLB.GetSelectEntryPos();}
+};
+
+
+#endif
+
diff --git a/cui/source/inc/optimprove.hxx b/cui/source/inc/optimprove.hxx
new file mode 100644
index 000000000000..61f184239e88
--- /dev/null
+++ b/cui/source/inc/optimprove.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: optimprove.hxx,v $
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTIMPROVE_HXX
+#define _SVX_OPTIMPROVE_HXX
+
+// include ---------------------------------------------------------------
+
+#include "svx/svxdllapi.h"
+
+#include <vcl/tabpage.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <svtools/fixedhyper.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/tabdlg.hxx>
+
+// class SvxEmptyPage ----------------------------------------------------
+
+class SvxEmptyPage : public TabPage
+{
+public:
+ SvxEmptyPage( Window* pParent );
+};
+
+// class SvxImprovementPage ----------------------------------------------
+
+class SvxImprovementPage : public TabPage
+{
+private:
+ FixedLine m_aImproveFL;
+ FixedText m_aInvitationFT;
+ RadioButton m_aYesRB;
+ RadioButton m_aNoRB;
+ FixedLine m_aDataFL;
+ FixedText m_aNumberOfReportsFT;
+ FixedText m_aNumberOfReportsValueFT;
+ FixedText m_aNumberOfActionsFT;
+ FixedText m_aNumberOfActionsValueFT;
+ PushButton m_aShowDataPB;
+
+ String m_sInfo;
+ String m_sMoreInfo;
+
+public:
+ SvxImprovementPage( Window* pParent );
+ ~SvxImprovementPage();
+
+ inline bool IsYesChecked() const { return m_aYesRB.IsChecked() != FALSE; }
+
+ inline String GetPageText() const { return GetText(); }
+ inline String GetInvitationText() const { return m_aInvitationFT.GetText(); }
+ inline String GetYesButtonText() const { return m_aYesRB.GetText(); }
+ inline String GetNoButtonText() const { return m_aNoRB.GetText(); }
+ inline String GetInfoText() const { return m_sInfo; }
+ inline String GetTitleText() const { return m_aImproveFL.GetText(); }
+};
+
+class SvxImprovementOptionsPage : public SfxTabPage
+{
+private:
+ FixedLine m_aImproveFL;
+ FixedText m_aInvitationFT;
+ RadioButton m_aYesRB;
+ RadioButton m_aNoRB;
+ svt::FixedHyperlinkImage m_aInfoFI;
+ FixedLine m_aDataFL;
+ FixedText m_aNumberOfReportsFT;
+ FixedText m_aNumberOfReportsValueFT;
+ FixedText m_aNumberOfActionsFT;
+ FixedText m_aNumberOfActionsValueFT;
+ PushButton m_aShowDataPB;
+
+ String m_sInfo;
+ String m_sMoreInfo;
+ ::rtl::OUString m_sLogPath;
+
+ SvxImprovementOptionsPage( Window* pParent, const SfxItemSet& rSet );
+
+ DECL_LINK( HandleHyperlink, svt::FixedHyperlinkImage * );
+ DECL_LINK( HandleShowData, PushButton * );
+
+public:
+ virtual ~SvxImprovementOptionsPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static sal_uInt16* GetRanges();
+
+ virtual sal_Bool FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+class SvxImprovementDialog : public SfxSingleTabDialog
+{
+private:
+ SvxImprovementPage* m_pPage;
+
+ DECL_LINK( HandleOK, OKButton * );
+ DECL_LINK( HandleHyperlink, svt::FixedHyperlinkImage * );
+
+public:
+ SvxImprovementDialog( Window* pParent, const String& rInfoURL );
+};
+
+class SvxInfoWindow : public Window
+{
+private:
+ FixedText m_aInfoText;
+
+public:
+ SvxInfoWindow( Window* pParent, const ResId& rResId );
+
+ void SetInfoText( const String& rText );
+};
+
+#endif
+
diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx
new file mode 100644
index 000000000000..6c2a0a7ac528
--- /dev/null
+++ b/cui/source/inc/optlingu.hxx
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * 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: optlingu.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTLINGU_HXX
+#define _SVX_OPTLINGU_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/field.hxx>
+#include <svtools/fixedhyper.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/checklbx.hxx>
+#include <svx/langbox.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "svx/svxdllapi.h"
+
+namespace com{namespace sun{namespace star{
+namespace beans{
+ class XPropertySet;
+}
+namespace linguistic2{
+ class XDictionary;
+ class XDictionaryList;
+ class XSpellChecker;
+}}}}
+
+class SvLBoxEntry;
+class SvxLinguData_Impl;
+
+// define ----------------------------------------------------------------
+
+#define GROUP_MODULES ((sal_uInt16)0x0008)
+
+// forward ---------------------------------------------------------------
+
+class SvxEditModulesDlg : public ModalDialog
+{
+ FixedLine aModulesFL;
+ FixedText aLanguageFT;
+ SvxLanguageBox aLanguageLB;
+
+ SvxCheckListBox aModulesCLB;
+ PushButton aPrioUpPB;
+ PushButton aPrioDownPB;
+ PushButton aBackPB;
+ svt::FixedHyperlink aMoreDictsLink;
+
+ FixedLine aButtonsFL;
+ HelpButton aHelpPB;
+ OKButton aClosePB;
+
+ String sSpell;
+ String sHyph;
+ String sThes;
+ String sGrammar;
+
+ SvxLinguData_Impl* pDefaultLinguData;
+ SvxLinguData_Impl& rLinguData;
+
+ SvLBoxButtonData* pCheckButtonData;
+
+ SvLBoxEntry* CreateEntry(String& rTxt, USHORT nCol);
+
+#ifdef _SVX_OPTLINGU_CXX
+ DECL_LINK( SelectHdl_Impl, SvxCheckListBox * );
+ DECL_LINK( UpDownHdl_Impl, PushButton * );
+ DECL_LINK( ClickHdl_Impl, PushButton * );
+ DECL_LINK( BackHdl_Impl, PushButton * );
+ DECL_LINK( SelectHdlLB_Impl, ListBox * );
+ DECL_LINK( LangSelectHdl_Impl, ListBox* );
+ DECL_LINK( BoxCheckButtonHdl_Impl, SvTreeListBox * );
+ DECL_LINK( OpenURLHdl_Impl, svt::FixedHyperlink* );
+#endif
+
+public:
+ SvxEditModulesDlg(Window* pParent, SvxLinguData_Impl& rData);
+ virtual ~SvxEditModulesDlg();
+};
+
+// class SvxLinguTabPage -------------------------------------------------
+
+class SVX_DLLPUBLIC SvxLinguTabPage : public SfxTabPage
+{
+private:
+ FixedLine aLinguisticFL;
+ FixedText aLinguModulesFT;
+ SvxCheckListBox aLinguModulesCLB;
+ PushButton aLinguModulesEditPB;
+ FixedText aLinguDicsFT;
+ SvxCheckListBox aLinguDicsCLB;
+ PushButton aLinguDicsNewPB;
+ PushButton aLinguDicsEditPB;
+ PushButton aLinguDicsDelPB;
+ FixedText aLinguOptionsFT;
+ SvxCheckListBox aLinguOptionsCLB;
+ PushButton aLinguOptionsEditPB;
+ svt::FixedHyperlink aMoreDictsLink;
+
+ String sCapitalWords;
+ String sWordsWithDigits;
+ String sCapitalization;
+ String sSpellSpecial;
+ String sSpellAuto;
+ String sGrammarAuto;
+ String sNumMinWordlen;
+ String sNumPreBreak;
+ String sNumPostBreak;
+ String sHyphAuto;
+ String sHyphSpecial;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet > xProp;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::linguistic2::XDictionaryList > xDicList;
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::linguistic2::XDictionary > > aDics;
+
+ SvLBoxButtonData* pCheckButtonData;
+
+ SvxLinguData_Impl* pLinguData;
+
+ SVX_DLLPRIVATE SvxLinguTabPage( Window* pParent, const SfxItemSet& rCoreSet );
+ SVX_DLLPRIVATE SvLBoxEntry* CreateEntry(String& rTxt, USHORT nCol);
+
+ SVX_DLLPRIVATE void AddDicBoxEntry( const com::sun::star::uno::Reference< com::sun::star::linguistic2::XDictionary > &rxDic, USHORT nIdx );
+ SVX_DLLPRIVATE ULONG GetDicUserData( const com::sun::star::uno::Reference< com::sun::star::linguistic2::XDictionary > &rxDic, USHORT nIdx );
+
+#ifdef _SVX_OPTLINGU_CXX
+ DECL_LINK( SelectHdl_Impl, SvxCheckListBox * );
+ DECL_LINK( ClickHdl_Impl, PushButton * );
+ DECL_LINK( BoxDoubleClickHdl_Impl, SvTreeListBox * );
+ DECL_LINK( BoxCheckButtonHdl_Impl, SvTreeListBox * );
+ DECL_LINK( PostDblClickHdl_Impl, SvTreeListBox * );
+ DECL_LINK( OpenURLHdl_Impl, svt::FixedHyperlink* );
+
+ SVX_DLLPRIVATE void UpdateModulesBox_Impl();
+ SVX_DLLPRIVATE void UpdateDicBox_Impl();
+#endif
+
+public:
+ virtual ~SvxLinguTabPage();
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static sal_uInt16* GetRanges();
+
+ virtual sal_Bool FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void HideGroups( sal_uInt16 nGrp );
+};
+
+#endif
+
diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx
new file mode 100644
index 000000000000..c05b0b778c58
--- /dev/null
+++ b/cui/source/inc/optpath.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * 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: optpath.hxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTPATH_HXX
+#define _SVX_OPTPATH_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/tabdlg.hxx>
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+
+#ifdef _SVX_OPTPATH_CXX
+#include <svtools/headbar.hxx>
+#else
+class HeaderBar;
+#endif
+#include "ControlFocusHelper.hxx"
+
+#ifndef _COM_SUN_STAR_UI_XFOLDERPICKER_HPP_
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#endif
+#include <svtools/dialogclosedlistener.hxx>
+
+// forward ---------------------------------------------------------------
+
+class SvTabListBox;
+namespace svx
+{
+ class OptHeaderTabListBox;
+}
+struct OptPath_Impl;
+class SvxPathTabPage;
+
+// define ----------------------------------------------------------------
+
+#define SfxPathTabPage SvxPathTabPage
+
+// class SvxPathTabPage --------------------------------------------------
+
+class SvxPathTabPage : public SfxTabPage
+{
+private:
+ FixedText aTypeText;
+ FixedText aPathText;
+ SvxControlFocusHelper aPathCtrl;
+ PushButton aStandardBtn;
+ PushButton aPathBtn;
+ FixedLine aStdBox;
+
+ HeaderBar* pHeaderBar;
+ ::svx::OptHeaderTabListBox* pPathBox;
+ OptPath_Impl* pImpl;
+
+ ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker;
+
+#ifdef _SVX_OPTPATH_CXX
+ void ChangeCurrentEntry( const String& _rFolder );
+
+ DECL_LINK( PathHdl_Impl, PushButton * );
+ DECL_LINK( StandardHdl_Impl, PushButton * );
+
+ DECL_LINK( PathSelect_Impl, OptHeaderTabListBox * );
+ DECL_LINK( HeaderSelect_Impl, HeaderBar * );
+ DECL_LINK( HeaderEndDrag_Impl, HeaderBar * );
+
+ DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
+
+ void GetPathList( USHORT _nPathHandle, String& _rInternalPath,
+ String& _rUserPath, String& _rWritablePath, sal_Bool& _rReadOnly );
+ void SetPathList( USHORT _nPathHandle,
+ const String& _rUserPath, const String& _rWritablePath );
+#endif
+
+public:
+ SvxPathTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxPathTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void FillUserData();
+};
+
+#endif
+
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
new file mode 100644
index 000000000000..1b716aedfd46
--- /dev/null
+++ b/cui/source/inc/page.hxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * 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: page.hxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PAGE_HXX
+#define _SVX_PAGE_HXX
+
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/lstbox.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svx/pagectrl.hxx>
+#include <svx/frmdirlbox.hxx>
+#include <svx/svxenum.hxx>
+#include <i18npool/paper.hxx>
+#include <svx/flagsdef.hxx>
+
+// enum ------------------------------------------------------------------
+
+//CHINA001 enum SvxModeType
+//CHINA001 {
+//CHINA001 SVX_PAGE_MODE_STANDARD,
+//CHINA001 SVX_PAGE_MODE_CENTER,
+//CHINA001 SVX_PAGE_MODE_PRESENTATION
+//CHINA001 };
+
+// class SvxPageDescPage -------------------------------------------------
+
+/* {k:\svx\prototyp\dialog\page.bmp}
+
+ [Beschreibung]
+ TabPage zur Einstellung einer Seite (Groesse, Raender, ...)
+
+ [Items]
+ <SvxPageItem>: <SID_ATTR_PAGE>
+ <SvxSizeItem>: <SID_ATTR_SIZE>
+ <SvxSizeItem>: <SID_ATTR_MAXSIZE>
+ <SvxULSpaceItem>: <SID_ATTR_LRSPACE>
+ <SvxLRSpaceItem>: <SID_ATTR_ULSPACE>
+ <SfxAllEnumItem>: <SID_ATTR_PAPERTRAY>
+ <SvxPaperBinItem>: <SID_ATTR_PAPERBIN>
+ <SvxBoolItem>: <SID_ATTR_EXT1>
+ <SvxBoolItem>: <SID_ATTR_EXT2>
+
+ <SfxSetItem>: <SID_ATTR_HEADERSET>
+ <SfxBoolItem>: <SID_ATTR_ON>
+ <SfxBoolItem>: <SID_ATTR_DYNAMIC>
+ <SfxBoolItem>: <SID_ATTR_SHARED>
+ <SvxSizeItem>: <SID_ATTR_SIZE>
+ <SvxULSpaceItem>: <SID_ATTR_ULSPACE>
+ <SvxLRSpaceItem>: <SID_ATTR_LRSPACE>
+
+ <SfxSetItem>: <SID_ATTR_FOOTERSET>
+ <SfxBoolItem>: <SID_ATTR_ON>
+ <SfxBoolItem>: <SID_ATTR_DYNAMIC>
+ <SfxBoolItem>: <SID_ATTR_SHARED>
+ <SvxSizeItem>: <SID_ATTR_SIZE>
+ <SvxULSpaceItem>: <SID_ATTR_ULSPACE>
+ <SvxLRSpaceItem>: <SID_ATTR_LRSPACE>
+*/
+
+struct SvxPage_Impl;
+typedef USHORT MarginPosition;
+
+class SvxPageDescPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+ // paper format
+ FixedLine aPaperSizeFl;
+ FixedText aPaperFormatText;
+ ListBox aPaperSizeBox;
+
+ FixedText aPaperWidthText;
+ MetricField aPaperWidthEdit;
+ FixedText aPaperHeightText;
+ MetricField aPaperHeightEdit;
+
+ FixedText aOrientationFT;
+ RadioButton aPortraitBtn;
+ RadioButton aLandscapeBtn;
+
+ SvxPageWindow aBspWin;
+
+ FixedText aTextFlowLbl;
+ svx::FrameDirectionListBox aTextFlowBox;
+
+ FixedText aPaperTrayLbl;
+ ListBox aPaperTrayBox;
+
+ // Margins
+ FixedLine aMarginFl;
+ FixedText aLeftMarginLbl;
+ MetricField aLeftMarginEdit;
+ FixedText aRightMarginLbl;
+ MetricField aRightMarginEdit;
+ FixedText aTopMarginLbl;
+ MetricField aTopMarginEdit;
+ FixedText aBottomMarginLbl;
+ MetricField aBottomMarginEdit;
+
+ // layout settings
+ FixedLine aLayoutFL;
+ FixedText aPageText;
+ ListBox aLayoutBox;
+ FixedText aNumberFormatText;
+ ListBox aNumberFormatBox;
+
+ FixedLine aBottomSeparatorFl;
+
+ //Extras Calc
+ FixedText aTblAlignFT;
+ CheckBox aHorzBox;
+ CheckBox aVertBox;
+
+ // Impress and Draw
+ CheckBox aAdaptBox;
+
+ //Register Writer
+ CheckBox aRegisterCB;
+ FixedText aRegisterFT;
+ ListBox aRegisterLB;
+
+ String sStandardRegister;
+
+ String aInsideText;
+ String aOutsideText;
+ String aLeftText;
+ String aRightText;
+ String aPrintRangeQueryText;
+
+ long nFirstLeftMargin;
+ long nFirstRightMargin;
+ long nFirstTopMargin;
+ long nFirstBottomMargin;
+ long nLastLeftMargin;
+ long nLastRightMargin;
+ long nLastTopMargin;
+ long nLastBottomMargin;
+
+ Size aMaxSize;
+ BOOL bLandscape;
+ FASTBOOL bBorderModified;
+ SvxModeType eMode;
+ Paper ePaperStart;
+ Paper ePaperEnd;
+
+ SvxPage_Impl* pImpl;
+
+#ifdef _SVX_PAGE_CXX
+ void Init_Impl();
+ DECL_LINK( LayoutHdl_Impl, ListBox* );
+ DECL_LINK( PaperBinHdl_Impl, ListBox* );
+ DECL_LINK( SwapOrientation_Impl, RadioButton* );
+ void SwapFirstValues_Impl( FASTBOOL bSet );
+ DECL_LINK( BorderModify_Impl, MetricField* );
+ void InitHeadFoot_Impl( const SfxItemSet& rSet );
+ DECL_LINK( CenterHdl_Impl, CheckBox* );
+ void UpdateExample_Impl( bool bResetbackground = false );
+
+ // Papiergroesse
+ DECL_LINK( PaperSizeSelect_Impl, ListBox* );
+ DECL_LINK( PaperSizeModify_Impl, Edit* );
+
+ DECL_LINK( FrameDirectionModify_Impl, ListBox* );
+
+ // Hintergrund
+ void ResetBackground_Impl( const SfxItemSet& rSet );
+
+ // Grenzwerte
+ DECL_LINK( RangeHdl_Impl, Edit* );
+ void CalcMargin_Impl();
+
+ // Registerhaltigkeit
+ DECL_LINK( RegisterModify, CheckBox * );
+
+ // page direction
+ /** Disables vertical page direction entries in the text flow listbox. */
+ void DisableVerticalPageDir();
+
+ bool IsPrinterRangeOverflow( MetricField& rField, long nFirstMargin,
+ long nLastMargin, MarginPosition nPos );
+ void CheckMarginEdits( bool _bClear );
+ bool IsMarginOutOfRange();
+#endif
+
+ SvxPageDescPage( Window* pParent, const SfxItemSet& rSet );
+
+protected:
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& rOutSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void FillUserData();
+
+ virtual ~SvxPageDescPage();
+
+ void SetMode( SvxModeType eMType ) { eMode = eMType; }
+ void SetPaperFormatRanges( Paper eStart, Paper eEnd )
+ { ePaperStart = eStart, ePaperEnd = eEnd; }
+
+ void SetCollectionList(const List* pList);
+ virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001
+};
+
+#endif // #ifndef _SVX_PAGE_HXX
+
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
new file mode 100644
index 000000000000..baadcaecb0ea
--- /dev/null
+++ b/cui/source/inc/paragrph.hxx
@@ -0,0 +1,330 @@
+/*************************************************************************
+ *
+ * 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: paragrph.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PARAGRPH_HXX
+#define _SVX_PARAGRPH_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/relfld.hxx> // SvxRelativeField
+#include <svx/paraprev.hxx> // Preview
+#include <svx/frmdirlbox.hxx>
+#include <vcl/lstbox.hxx>
+#include <svx/flagsdef.hxx>
+
+// define ----------------------------------------------------------------
+
+// 1/2 cm in TWIPS
+// wird auch fuer Minimalgrosse der LayFrms aller Arten benutzt
+//CHINA001 #define MM50 283
+
+// forward ---------------------------------------------------------------
+
+class SvxLineSpacingItem;
+class SvxParagraphControllerItem;
+
+// class SvxStdParagraphTabPage ------------------------------------------
+
+/* {k:\svx\prototyp\dialog\parastd.bmp}
+
+ [Beschreibung]
+ Mit dieser TabPage koennen Standard-Attribute eines Absatzes eingestellt
+ werden (Einzug, Abstand, Ausrichtung, Zeilenabstand).
+
+ [Items]
+ <SvxAdjustItem><SID_ATTR_PARA_ADJUST>
+ <SvxLineSpacingItem><SID_ATTR_PARA_LINESPACE>
+ <SvxULSpaceItem><SID_ATTR_ULSPACE>
+ <SvxLRSpaceItem><SID_ATTR_LRSPACE>
+*/
+
+class SvxStdParagraphTabPage: public SfxTabPage
+{
+ using TabPage::DeactivatePage;
+
+private:
+ SvxStdParagraphTabPage( Window* pParent, const SfxItemSet& rSet );
+
+ // Einzug
+ FixedText aLeftLabel;
+ SvxRelativeField aLeftIndent;
+
+ FixedText aRightLabel;
+ SvxRelativeField aRightIndent;
+
+ FixedText aFLineLabel;
+ SvxRelativeField aFLineIndent;
+ CheckBox aAutoCB;
+
+ FixedLine aIndentFrm;
+
+ // Abstaende
+ FixedText aTopLabel;
+ SvxRelativeField aTopDist;
+ FixedText aBottomLabel;
+ SvxRelativeField aBottomDist;
+ FixedLine aDistFrm;
+
+ // Zeilenabstand
+ ListBox aLineDist;
+ FixedText aLineDistAtLabel;
+ MetricField aLineDistAtPercentBox;
+ MetricField aLineDistAtMetricBox;
+ FixedLine aLineDistFrm;
+ String sAbsDist;
+ SvxParaPrevWindow aExampleWin;
+
+ //Registerhaltigkeit - nur Writer
+ CheckBox aRegisterCB;
+ FixedLine aRegisterFL;
+
+ Edit* pActLineDistFld;
+ long nAbst;
+ long nWidth;
+ long nMinFixDist;
+ BOOL bRelativeMode;
+ BOOL bNegativeIndents;
+
+#ifdef _SVX_PARAGRPH_CXX
+ void SetLineSpacing_Impl( const SvxLineSpacingItem& rAttr );
+ void Init_Impl();
+ void UpdateExample_Impl( BOOL bAll = FALSE );
+
+ DECL_LINK( LineDistHdl_Impl, ListBox* );
+ DECL_LINK( ModifyHdl_Impl, SvxRelativeField* );
+ DECL_LINK( AutoHdl_Impl, CheckBox* );
+#endif
+
+protected:
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+public:
+ DECL_LINK( ELRLoseFocusHdl, Edit* );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+
+ void SetPageWidth( USHORT nPageWidth );
+ void SetMaxDistance( USHORT nMaxDist );
+ void EnableRelativeMode();
+ void EnableRegisterMode();
+ void EnableAutoFirstLine();
+ void EnableAbsLineDist(long nMinTwip);
+ void EnableNegativeMode();
+ virtual void PageCreated(SfxAllItemSet aSet); // add CHINA001
+};
+
+// class SvxParaAlignTabPage ------------------------------------------------
+
+class SvxParaAlignTabPage : public SfxTabPage
+{
+ using TabPage::DeactivatePage;
+
+ // Ausrichtung
+ FixedLine aAlignFrm;
+ RadioButton aLeft;
+ RadioButton aRight;
+ RadioButton aCenter;
+ RadioButton aJustify;
+ FixedText aLastLineFT;
+ ListBox aLastLineLB;
+ CheckBox aExpandCB;
+
+ CheckBox aSnapToGridCB;
+
+ //preview
+ SvxParaPrevWindow aExampleWin;
+ //vertical alignment
+ FixedLine aVertAlignFL;
+
+ FixedText aVertAlignFT;
+ ListBox aVertAlignLB;
+
+ FixedLine aPropertiesFL;
+ FixedText aTextDirectionFT;
+ svx::FrameDirectionListBox aTextDirectionLB;
+
+#ifdef _SVX_PARAGRPH_CXX
+ DECL_LINK( AlignHdl_Impl, RadioButton* );
+ DECL_LINK( LastLineHdl_Impl, ListBox* );
+ DECL_LINK( TextDirectionHdl_Impl, ListBox* );
+
+ void UpdateExample_Impl( BOOL bAll = FALSE );
+#endif
+
+ SvxParaAlignTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~SvxParaAlignTabPage();
+
+protected:
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void EnableJustifyExt();
+ virtual void PageCreated(SfxAllItemSet aSet); // add CHINA001
+};
+
+// class SvxExtParagraphTabPage ------------------------------------------
+
+/* {k:\svx\prototyp\dialog\paraext.bmp}
+
+ [Beschreibung]
+ Mit dieser TabPage koennen Spezial-Attribute eines Absatzes eingestellt
+ werden (Silbentrennung, Seitenumbruch, Schusterjungen, Hurenkinder, ...).
+
+ [Items]
+ <SvxHyphenZoneItem><SID_ATTR_PARA_HYPHENZONE>
+ <SvxFmtBreakItem><SID_ATTR_PARA_PAGEBREAK>
+ <SvxFmtSplitItem><SID_ATTR_PARA_SPLIT>
+ <SvxWidowsItem><SID_ATTR_PARA_WIDOWS>
+ <SvxOrphansItem><SID_ATTR_PARA_ORPHANS>
+*/
+
+class SvxExtParagraphTabPage: public SfxTabPage
+{
+ using TabPage::DeactivatePage;
+
+public:
+ virtual ~SvxExtParagraphTabPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void DisablePageBreak();
+
+protected:
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+private:
+ SvxExtParagraphTabPage( Window* pParent, const SfxItemSet& rSet );
+
+ // Silbentrennung
+ TriStateBox aHyphenBox;
+ FixedText aBeforeText;
+ NumericField aExtHyphenBeforeBox;
+// FixedText aHyphenBeforeLabel;
+ FixedText aAfterText;
+ NumericField aExtHyphenAfterBox;
+// FixedText aHyphenAfterLabel;
+ FixedText aMaxHyphenLabel;
+ NumericField aMaxHyphenEdit;
+ FixedLine aExtFL;
+
+ // Seitenumbruch
+ FixedLine aBreaksFL;
+ TriStateBox aPageBreakBox;
+ FixedText aBreakTypeFT;
+ ListBox aBreakTypeLB;
+ FixedText aBreakPositionFT;
+ ListBox aBreakPositionLB;
+ TriStateBox aApplyCollBtn;
+ ListBox aApplyCollBox;
+ FixedText aPagenumText;
+ NumericField aPagenumEdit;
+
+ FixedLine aExtendFL;
+
+ // Absatzteilung
+ TriStateBox aKeepTogetherBox;
+ TriStateBox aKeepParaBox;
+
+ // Witwen/Waisen
+ TriStateBox aOrphanBox;
+ NumericField aOrphanRowNo;
+ FixedText aOrphanRowLabel;
+
+ TriStateBox aWidowBox;
+ NumericField aWidowRowNo;
+ FixedText aWidowRowLabel;
+
+ BOOL bPageBreak;
+ BOOL bHtmlMode;
+ USHORT nStdPos;
+
+#ifdef _SVX_PARAGRPH_CXX
+ DECL_LINK( PageBreakHdl_Impl, TriStateBox* );
+ DECL_LINK( KeepTogetherHdl_Impl, TriStateBox* );
+ DECL_LINK( WidowHdl_Impl, TriStateBox* );
+ DECL_LINK( OrphanHdl_Impl, TriStateBox* );
+ DECL_LINK( HyphenClickHdl_Impl, TriStateBox* );
+ DECL_LINK( ApplyCollClickHdl_Impl, TriStateBox* );
+ DECL_LINK( PageBreakPosHdl_Impl, ListBox* );
+ DECL_LINK( PageBreakTypeHdl_Impl, ListBox* );
+#endif
+ virtual void PageCreated(SfxAllItemSet aSet); // add CHINA001
+};
+/* -----------------------------29.11.00 11:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SvxAsianTabPage : public SfxTabPage
+{
+ FixedLine aOptionsFL;
+
+ TriStateBox aForbiddenRulesCB;
+ TriStateBox aHangingPunctCB;
+
+ TriStateBox aScriptSpaceCB;
+
+ SvxAsianTabPage( Window* pParent, const SfxItemSet& rSet );
+
+#ifdef _SVX_PARAGRPH_CXX
+ DECL_LINK( ClickHdl_Impl, TriStateBox* );
+#endif
+public:
+ ~SvxAsianTabPage();
+
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+};
+
+#endif // #ifndef _SVX_PARAGRPH_HXX
+
+
diff --git a/cui/source/inc/pastedlg.hxx b/cui/source/inc/pastedlg.hxx
new file mode 100644
index 000000000000..edbbaf53e6ee
--- /dev/null
+++ b/cui/source/inc/pastedlg.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * 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: pastedlg.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PASTEDLG_HXX
+#define _PASTEDLG_HXX
+
+#ifndef _TABLE_HXX //autogen
+#include <tools/table.hxx>
+#endif
+#include <sot/formats.hxx>
+#include <tools/globname.hxx>
+#include <svtools/transfer.hxx>
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/lstbox.hxx>
+
+/********************** SvPasteObjectDialog ******************************
+*************************************************************************/
+
+struct TransferableObjectDescriptor;
+class DataFlavorExVecor;
+class TransferableDataHelper;
+
+class SvPasteObjectDialog : public ModalDialog
+{
+ FixedText aFtSource;
+ FixedText aFtObjectSource;
+ RadioButton aRbPaste;
+ RadioButton aRbPasteLink;
+ ListBox aLbInsertList;
+ CheckBox aCbDisplayAsIcon;
+ PushButton aPbChangeIcon;
+ FixedLine aFlChoice;
+ OKButton aOKButton1;
+ CancelButton aCancelButton1;
+ HelpButton aHelpButton1;
+ String aSObject;
+ Table aSupplementTable;
+ SvGlobalName aObjClassName;
+ String aObjName;
+ USHORT nAspect;
+ BOOL bLink;
+
+ ListBox& ObjectLB() { return aLbInsertList; }
+ FixedText& ObjectSource() { return aFtObjectSource; }
+ RadioButton& PasteLink() { return aRbPasteLink; }
+ CheckBox& AsIconBox() { return aCbDisplayAsIcon; }
+
+ const String& GetObjString() { return aSObject; }
+ void SelectObject();
+ DECL_LINK( SelectHdl, ListBox * );
+ DECL_LINK( DoubleClickHdl, ListBox * );
+ void SetDefault();
+ USHORT GetAspect() const { return nAspect; }
+ BOOL ShouldLink() const { return bLink; }
+
+public:
+ SvPasteObjectDialog( Window* pParent );
+ ~SvPasteObjectDialog();
+
+ void Insert( SotFormatStringId nFormat, const String & rFormatName );
+ void SetObjName( const SvGlobalName & rClass, const String & rObjName );
+ ULONG GetFormat( const TransferableDataHelper& aHelper,
+ const DataFlavorExVector* pFormats=0,
+ const TransferableObjectDescriptor* pDesc=0 );
+};
+
+#endif // _PASTEDLG_HXX
diff --git a/cui/source/inc/postdlg.hxx b/cui/source/inc/postdlg.hxx
new file mode 100644
index 000000000000..9c4f2551c09b
--- /dev/null
+++ b/cui/source/inc/postdlg.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * 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: postdlg.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_POSTDLG_HXX
+#define _SVX_POSTDLG_HXX
+
+// include ---------------------------------------------------------------
+
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/imagebtn.hxx>
+#endif
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svtools/svmedit.hxx>
+
+// class SvxPostItDialog -------------------------------------------------
+/*
+ {k:\svx\prototyp\dialog\memo.bmp}
+
+ [Beschreibung]
+ In diesem Dialog kann eine Notiz erstellt oder bearbeitet werden. Wenn die
+ Applikation eine Liste von Notizen haelt, kann mit Hilfe von Links, ueber
+ diese Liste iteriert werden.
+
+ [Items]
+ <SvxPostitAuthorItem><SID_ATTR_POSTIT_AUTHOR>
+ <SvxPostitDateItem><SID_ATTR_POSTIT_DATE>
+ <SvxPostitTextItem><SID_ATTR_POSTIT_TEXT>
+*/
+
+class SvxPostItDialog : public SfxModalDialog
+{
+public:
+ SvxPostItDialog( Window* pParent, const SfxItemSet& rCoreSet,
+ BOOL bPrevNext = FALSE, BOOL bRedline = FALSE );
+ ~SvxPostItDialog();
+
+ static USHORT* GetRanges();
+ const SfxItemSet* GetOutputItemSet() const { return pOutSet; }
+
+ Link GetPrevHdl() const { return aPrevHdlLink; }
+ void SetPrevHdl( const Link& rLink )
+ { aPrevHdlLink = rLink; }
+ Link GetNextHdl() const { return aNextHdlLink; }
+ void SetNextHdl( const Link& rLink )
+ { aNextHdlLink = rLink; }
+
+ void EnableTravel(BOOL bNext, BOOL bPrev);
+ inline String GetNote() { return aEditED.GetText(); }
+ inline void SetNote(const String& rTxt) { aEditED.SetText(rTxt); }
+
+ void ShowLastAuthor(const String& rAuthor, const String& rDate);
+ inline void DontChangeAuthor() { aAuthorBtn.Enable(FALSE); }
+ inline void HideAuthor() { aAuthorBtn.Hide(); }
+ inline void SetReadonlyPostIt(BOOL bDisable)
+ {
+ aOKBtn.Enable( !bDisable );
+ aEditED.SetReadOnly( bDisable );
+ aAuthorBtn.Enable( !bDisable );
+ }
+ inline BOOL IsOkEnabled() const { return aOKBtn.IsEnabled(); }
+
+private:
+ FixedLine aPostItFL;
+ FixedText aLastEditLabelFT;
+ FixedInfo aLastEditFT;
+
+ FixedText aEditFT;
+ MultiLineEdit aEditED;
+
+ FixedText aAuthorFT;
+ PushButton aAuthorBtn;
+
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ ImageButton aPrevBtn;
+ ImageButton aNextBtn;
+
+ const SfxItemSet& rSet;
+ SfxItemSet* pOutSet;
+
+ Link aPrevHdlLink;
+ Link aNextHdlLink;
+
+#ifdef _SVX_POSTDLG_CXX
+ DECL_LINK( Stamp, Button* );
+ DECL_LINK( OKHdl, Button* );
+ DECL_LINK( PrevHdl, Button* );
+ DECL_LINK( NextHdl, Button* );
+#endif
+};
+
+
+#endif
+
diff --git a/cui/source/inc/radiobtnbox.hxx b/cui/source/inc/radiobtnbox.hxx
new file mode 100644
index 000000000000..a0477d25b262
--- /dev/null
+++ b/cui/source/inc/radiobtnbox.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * 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: radiobtnbox.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_RADIOBTNBOX_HXX
+#define _SVX_RADIOBTNBOX_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svx/simptabl.hxx>
+#include "svx/svxdllapi.h"
+
+namespace svx {
+
+// class SvxRadioButtonListBox -------------------------------------------
+
+class SVX_DLLPUBLIC SvxRadioButtonListBox : public SvxSimpleTable
+{
+ using SvxSimpleTable::SetTabs;
+
+private:
+ Point m_aCurMousePoint;
+
+protected:
+ virtual void SetTabs();
+ virtual void MouseButtonUp( const MouseEvent& _rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+public:
+ SvxRadioButtonListBox( Window* _pParent, const ResId& _rId );
+ ~SvxRadioButtonListBox();
+
+ void HandleEntryChecked( SvLBoxEntry* _pEntry );
+
+ const Point& GetCurMousePoint() const;
+};
+
+} // end of namespace ::svx
+
+#endif // #ifndef _SVX_RADIOBTNBOX_HXX
+
diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx
new file mode 100644
index 000000000000..0cb2a6d4fb5d
--- /dev/null
+++ b/cui/source/inc/scriptdlg.hxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * 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: scriptdlg.hxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SCRIPTDLG_HXX
+#define _SCRIPTDLG_HXX
+
+#include <memory>
+
+#include "tools/solar.h"
+
+#include <svtools/svtreebx.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/abstdlg.hxx>
+#include <sfx2/basedlgs.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/script/browse/XBrowseNode.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+#include <hash_map>
+
+#define OBJTYPE_BASICMANAGER 1L
+//#define OBJTYPE_LIB 2L
+//#define OBJTYPE_MODULE 3L
+#define OBJTYPE_METHOD 2L
+//#define OBJTYPE_METHODINOBJ 5L
+//#define OBJTYPE_OBJECT 6L
+//#define OBJTYPE_SUBOBJ 7L
+//#define OBJTYPE_PROPERTY 8L
+#define OBJTYPE_SCRIPTCONTAINER 3L
+#define OBJTYPE_SFROOT 4L
+
+#define BROWSEMODE_MODULES 0x01
+#define BROWSEMODE_SUBS 0x02
+#define BROWSEMODE_OBJS 0x04
+#define BROWSEMODE_PROPS 0x08
+#define BROWSEMODE_SUBOBJS 0x10
+
+#define INPUTMODE_NEWLIB 1
+#define INPUTMODE_NEWMACRO 2
+#define INPUTMODE_RENAME 3
+
+typedef ::std::hash_map < ::rtl::OUString, ::rtl::OUString ,
+ ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > Selection_hash;
+
+class SFEntry;
+
+class SFTreeListBox : public SvTreeListBox
+{
+ friend class SvxScriptOrgDialog;
+private:
+ USHORT nMode;
+ Image m_hdImage;
+ Image m_hdImage_hc;
+ Image m_libImage;
+ Image m_libImage_hc;
+ Image m_macImage;
+ Image m_macImage_hc;
+ Image m_docImage;
+ Image m_docImage_hc;
+ ::rtl::OUString m_sMyMacros;
+ ::rtl::OUString m_sProdMacros;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >
+ getLangNodeFromRootNode( ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& root, ::rtl::OUString& language );
+ void delUserData( SvLBoxEntry* pEntry );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getDocumentModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xCtx, ::rtl::OUString& docName );
+
+protected:
+ void ExpandTree( SvLBoxEntry* pRootEntry );
+ virtual void RequestingChilds( SvLBoxEntry* pParent );
+ virtual void ExpandedHdl();
+ SvLBoxEntry* FindEntry( SvLBoxEntry* pParent, const String& rText, BYTE nType );
+ virtual long ExpandingHdl();
+ static BOOL dialogSort1( com::sun::star::uno::Reference< com::sun::star::script::browse::XBrowseNode > node1,
+ com::sun::star::uno::Reference< com::sun::star::script::browse::XBrowseNode > node2 );
+ static BOOL dialogSort2( com::sun::star::uno::Reference< com::sun::star::script::browse::XBrowseNode > node1,
+ com::sun::star::uno::Reference< com::sun::star::script::browse::XBrowseNode > node2 );
+
+public:
+ void Init( const ::rtl::OUString& language );
+ void RequestSubEntries( SvLBoxEntry* pRootEntry, ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& node,
+ ::com::sun::star::uno::Reference< com::sun::star::frame::XModel>& model );
+ SFTreeListBox( Window* pParent, const ResId& rRes );
+ ~SFTreeListBox();
+
+ void UpdateEntries();
+
+ void ExpandAllTrees();
+
+
+
+ SvLBoxEntry * insertEntry(String const & rText, USHORT nBitmap,
+ SvLBoxEntry * pParent,
+ bool bChildrenOnDemand,
+ std::auto_ptr< SFEntry > aUserData,
+ ::rtl::OUString factoryURL );
+ SvLBoxEntry * insertEntry(String const & rText, USHORT nBitmap,
+ SvLBoxEntry * pParent,
+ bool bChildrenOnDemand,
+ std::auto_ptr< SFEntry > aUserData );
+ void deleteTree( SvLBoxEntry * pEntry );
+ void deleteAllTree( );
+};
+
+class InputDialog : public ModalDialog
+{
+private:
+ FixedText aText;
+ Edit aEdit;
+ OKButton aOKButton;
+ CancelButton aCancelButton;
+
+public:
+ InputDialog( Window * pParent, USHORT nMode );
+ ~InputDialog();
+
+ String GetObjectName() const { return aEdit.GetText(); }
+ void SetObjectName( const String& rName ) { aEdit.SetText( rName ); aEdit.SetSelection( Selection( 0, rName.Len() ) );}
+};
+
+class SFEntry
+{
+private:
+ BYTE nType;
+ bool loaded;
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > nodes;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > model;
+ SFEntry(){}
+public:
+ SFEntry( BYTE nT ) { nType = nT; loaded=false; }
+ SFEntry( BYTE nT,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& entryNodes ,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& entryModel) { nType = nT; nodes = entryNodes; loaded=false; model = entryModel; }
+ SFEntry( const SFEntry& r ) { nType = r.nType; nodes = r.nodes; loaded = r.loaded; }
+ virtual ~SFEntry() {}
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > GetNode() { return nodes ;}
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetModel() { return model ;};
+ BYTE GetType() const { return nType; }
+ bool isLoaded() const { return loaded; }
+ void setLoaded() { loaded=true; }
+};
+
+class SvxScriptOrgDialog : public SfxModalDialog
+{
+protected:
+ FixedText aScriptsTxt;
+ SFTreeListBox aScriptsBox;
+
+ PushButton aRunButton;
+ CancelButton aCloseButton;
+ PushButton aCreateButton;
+ PushButton aEditButton;
+ PushButton aRenameButton;
+ PushButton aDelButton;
+ HelpButton aHelpButton;
+
+ ::rtl::OUString m_sLanguage;
+ static Selection_hash m_lastSelection;
+ const String m_delErrStr;
+ const String m_delErrTitleStr;
+ const String m_delQueryStr;
+ const String m_delQueryTitleStr;
+ const String m_createErrStr;
+ const String m_createDupStr;
+ const String m_createErrTitleStr;
+ const String m_renameErrStr;
+ const String m_renameDupStr;
+ const String m_renameErrTitleStr;
+
+ DECL_LINK( MacroSelectHdl, SvTreeListBox * );
+ DECL_LINK( MacroDoubleClickHdl, SvTreeListBox * );
+ DECL_LINK( ScriptSelectHdl, SvTreeListBox * );
+ DECL_LINK( ButtonHdl, Button * );
+ BOOL getBoolProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xProps, ::rtl::OUString& propName );
+ void CheckButtons( ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& node );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getDocumentModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xCtx, ::rtl::OUString& docName );
+
+ void createEntry( SvLBoxEntry* pEntry );
+ void renameEntry( SvLBoxEntry* pEntry );
+ void deleteEntry( SvLBoxEntry* pEntry );
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >
+ getBrowseNode( SvLBoxEntry* pEntry );
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel( SvLBoxEntry* pEntry );
+ void EnableButton( Button& rButton, BOOL bEnable );
+ String getListOfChildren( ::com::sun::star::uno::Reference< com::sun::star::script::browse::XBrowseNode > node, int depth );
+ void StoreCurrentSelection();
+ void RestorePreviousSelection();
+ //String GetInfo( SbxVariable* pVar );
+
+public:
+ // prob need another arg in the ctor
+ // to specify the language or provider
+ SvxScriptOrgDialog( Window* pParent, ::rtl::OUString language );
+ ~SvxScriptOrgDialog();
+
+ virtual short Execute();
+
+ //DECL_LINK( ActivatePageHdl, TabControl * );
+};
+
+class SvxScriptErrorDialog : public VclAbstractDialog
+{
+private:
+
+ ::rtl::OUString m_sMessage;
+
+ DECL_LINK( ShowDialog, ::rtl::OUString* );
+
+public:
+
+ SvxScriptErrorDialog(
+ Window* parent, ::com::sun::star::uno::Any aException );
+
+ ~SvxScriptErrorDialog();
+
+ short Execute();
+};
+
+#endif // _SCRIPTDLG_HXX
diff --git a/cui/source/inc/sdrcelldlg.hxx b/cui/source/inc/sdrcelldlg.hxx
new file mode 100644
index 000000000000..b89c9ef21e8a
--- /dev/null
+++ b/cui/source/inc/sdrcelldlg.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * 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: sdrcelldlg.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FORMAT_CELLS_DLG_HXX
+#define _SVX_FORMAT_CELLS_DLG_HXX
+
+
+#include <sfx2/tabdlg.hxx>
+
+class XColorTable;
+class XGradientList;
+class XHatchList;
+class XBitmapList;
+class SdrModel;
+
+class SvxFormatCellsDialog : public SfxTabDialog
+{
+private:
+ const SfxItemSet& mrOutAttrs;
+
+ XColorTable* mpColorTab;
+ XGradientList* mpGradientList;
+ XHatchList* mpHatchingList;
+ XBitmapList* mpBitmapList;
+
+protected:
+ virtual void Apply();
+
+public:
+ SvxFormatCellsDialog( Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel );
+ ~SvxFormatCellsDialog();
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+
+};
+
+#endif // _SVX_FORMAT_CELLS_DLG_HXX
+
+
diff --git a/cui/source/inc/selector.hxx b/cui/source/inc/selector.hxx
new file mode 100644
index 000000000000..3e21a3812835
--- /dev/null
+++ b/cui/source/inc/selector.hxx
@@ -0,0 +1,249 @@
+/*************************************************************************
+ *
+ * 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: selector.hxx,v $
+ * $Revision: 1.15 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVXSELECTOR_HXX
+#define _SVXSELECTOR_HXX
+
+#include <vcl/lstbox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/menubtn.hxx>
+#include <svtools/svtreebx.hxx>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/script/browse/XBrowseNode.hpp>
+
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx> // SvUShorts
+#include <sfx2/minarray.hxx>
+
+#define SVX_CFGGROUP_FUNCTION 1
+#define SVX_CFGFUNCTION_SLOT 2
+#define SVX_CFGGROUP_SCRIPTCONTAINER 3
+#define SVX_CFGFUNCTION_SCRIPT 4
+
+struct SvxGroupInfo_Impl
+{
+ USHORT nKind;
+ USHORT nOrd;
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >
+ xBrowseNode;
+ ::rtl::OUString sURL;
+ ::rtl::OUString sHelpText;
+ BOOL bWasOpened;
+
+ SvxGroupInfo_Impl( USHORT n, USHORT nr )
+ :nKind( n )
+ ,nOrd( nr )
+ ,xBrowseNode()
+ ,sURL()
+ ,sHelpText()
+ ,bWasOpened(FALSE)
+ {
+ }
+
+ SvxGroupInfo_Impl( USHORT n, USHORT nr, const ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& _rxNode )
+ :nKind( n )
+ ,nOrd( nr )
+ ,xBrowseNode( _rxNode )
+ ,sURL()
+ ,sHelpText()
+ ,bWasOpened(FALSE)
+ {
+ }
+
+ SvxGroupInfo_Impl( USHORT n, USHORT nr, const ::rtl::OUString& _rURL, const ::rtl::OUString& _rHelpText )
+ :nKind( n )
+ ,nOrd( nr )
+ ,xBrowseNode()
+ ,sURL( _rURL )
+ ,sHelpText( _rHelpText )
+ ,bWasOpened(FALSE)
+ {
+ }
+};
+
+typedef SvxGroupInfo_Impl* SvxGroupInfoPtr;
+SV_DECL_PTRARR_DEL(SvxGroupInfoArr_Impl, SvxGroupInfoPtr, 5, 5)
+
+class ImageProvider
+{
+public:
+ virtual ~ImageProvider() {}
+
+ virtual Image GetImage( const rtl::OUString& rCommandURL ) = 0;
+};
+
+class SvxConfigFunctionListBox_Impl : public SvTreeListBox
+{
+friend class SvxConfigGroupListBox_Impl;
+ Timer aTimer;
+ SvLBoxEntry* pCurEntry;
+ SvxGroupInfoArr_Impl aArr;
+ SvLBoxEntry* m_pDraggingEntry;
+
+ DECL_LINK( TimerHdl, Timer* );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+
+public:
+ SvxConfigFunctionListBox_Impl( Window*, const ResId& );
+ ~SvxConfigFunctionListBox_Impl();
+ void ClearAll();
+ SvLBoxEntry* GetEntry_Impl( USHORT nId );
+ SvLBoxEntry* GetEntry_Impl( const String& );
+ USHORT GetId( SvLBoxEntry *pEntry );
+ String GetHelpText( SvLBoxEntry *pEntry );
+ using Window::GetHelpText;
+ USHORT GetCurId()
+ { return GetId( FirstSelected() ); }
+ SvLBoxEntry* GetLastSelectedEntry();
+ void FunctionSelected();
+
+ // drag n drop methods
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+
+ virtual DragDropMode NotifyStartDrag(
+ TransferDataContainer&, SvLBoxEntry* );
+
+ virtual void DragFinished( sal_Int8 );
+};
+
+class SvxConfigGroupListBox_Impl : public SvTreeListBox
+{
+ SvxGroupInfoArr_Impl aArr;
+ bool m_bShowSlots;
+
+ SvxConfigFunctionListBox_Impl* pFunctionListBox;
+ ImageProvider* m_pImageProvider;
+
+ ::com::sun::star::uno::Reference
+ < ::com::sun::star::frame::XFrame > m_xFrame;
+
+ ::com::sun::star::uno::Reference
+ < ::com::sun::star::container::XNameAccess > m_xModuleCommands;
+
+ Image m_hdImage;
+ Image m_hdImage_hc;
+ Image m_libImage;
+ Image m_libImage_hc;
+ Image m_macImage;
+ Image m_macImage_hc;
+ Image m_docImage;
+ Image m_docImage_hc;
+ ::rtl::OUString m_sMyMacros;
+ ::rtl::OUString m_sProdMacros;
+ Image GetImage( ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > node, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xCtx, bool bIsRootNode, bool bHighContrast );
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getDocumentModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xCtx, ::rtl::OUString& docName );
+
+private:
+ void fillScriptList(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& _rxRootNode,
+ SvLBoxEntry* _pParentEntry,
+ bool _bCheapChildsOnDemand
+ );
+
+protected:
+ virtual void RequestingChilds( SvLBoxEntry *pEntry);
+ virtual BOOL Expand( SvLBoxEntry* pParent );
+ using SvListView::Expand;
+
+public:
+ SvxConfigGroupListBox_Impl (
+ Window* pParent, const ResId&,
+ bool _bShowSlots,
+ const ::com::sun::star::uno::Reference
+ < ::com::sun::star::frame::XFrame >& xFrame
+ );
+
+ ~SvxConfigGroupListBox_Impl();
+
+ void Init();
+ void Open( SvLBoxEntry*, BOOL );
+ void ClearAll();
+ void GroupSelected();
+
+ void SetFunctionListBox( SvxConfigFunctionListBox_Impl *pBox )
+ { pFunctionListBox = pBox; }
+
+ void SetImageProvider( ImageProvider* provider )
+ { m_pImageProvider = provider; }
+};
+
+class SvxScriptSelectorDialog : public ModelessDialog
+{
+ FixedText aDialogDescription;
+ FixedText aGroupText;
+ SvxConfigGroupListBox_Impl aCategories;
+ FixedText aFunctionText;
+ SvxConfigFunctionListBox_Impl aCommands;
+ OKButton aOKButton;
+ CancelButton aCancelButton;
+ HelpButton aHelpButton;
+ FixedLine aDescription;
+ FixedText aDescriptionText;
+
+ BOOL m_bShowSlots;
+ Link m_aAddHdl;
+
+ DECL_LINK( ClickHdl, Button * );
+ DECL_LINK( SelectHdl, Control* );
+ DECL_LINK( FunctionDoubleClickHdl, Control* );
+
+ void UpdateUI();
+ void ResizeControls();
+
+public:
+
+ SvxScriptSelectorDialog (
+ Window* pParent = NULL,
+ BOOL bShowSlots = FALSE,
+ const ::com::sun::star::uno::Reference
+ < ::com::sun::star::frame::XFrame >& xFrame = 0
+ );
+
+ ~SvxScriptSelectorDialog ( );
+
+ void SetAddHdl( const Link& rLink ) { m_aAddHdl = rLink; }
+ const Link& GetAddHdl() const { return m_aAddHdl; }
+
+ void SetImageProvider( ImageProvider* provider )
+ { aCategories.SetImageProvider( provider ); }
+
+ USHORT GetSelectedId();
+ String GetScriptURL() const;
+ String GetSelectedDisplayName();
+ String GetSelectedHelpText();
+ void SetRunLabel();
+ void SetDialogDescription(const String& rDescription);
+};
+
+#endif
diff --git a/cui/source/inc/showcols.hxx b/cui/source/inc/showcols.hxx
new file mode 100644
index 000000000000..fd64abf36e2c
--- /dev/null
+++ b/cui/source/inc/showcols.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * 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: showcols.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_SHOWCOLS_HXX
+#define _SVX_SHOWCOLS_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/fixed.hxx>
+
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+
+//==========================================================================
+// FmShowColsDialog
+//==========================================================================
+
+class FmShowColsDialog : public ModalDialog
+{
+ ListBox m_aList;
+ FixedText m_aLabel;
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xColumns;
+
+public:
+ FmShowColsDialog( Window* pParent );
+ virtual ~FmShowColsDialog();
+
+ void SetColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xCols);
+
+protected:
+ DECL_LINK( OnClickedOk, Button* );
+};
+
+#endif // _SVX_SHOWCOLS_HXX
+
diff --git a/cui/source/inc/splitcelldlg.hxx b/cui/source/inc/splitcelldlg.hxx
new file mode 100644
index 000000000000..e325e25a8284
--- /dev/null
+++ b/cui/source/inc/splitcelldlg.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * 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: splitcelldlg.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SPLITCELLDLG_HXX
+#define _SVX_SPLITCELLDLG_HXX
+
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/imagebtn.hxx>
+#include <vcl/button.hxx>
+
+#include <svx/stddlg.hxx>
+#include <svx/svxdlg.hxx>
+
+class SvxSplitTableDlg : public SvxAbstractSplittTableDialog, public SvxStandardDialog
+{
+ FixedText maCountLbl;
+ NumericField maCountEdit;
+ FixedLine maCountFL;
+ ImageRadioButton maHorzBox;
+ ImageRadioButton maVertBox;
+ CheckBox maPropCB;
+ FixedLine maDirFL;
+ OKButton maOKBtn;
+ CancelButton maCancelBtn;
+ HelpButton maHelpBtn;
+
+ long mnMaxVertical;
+ long mnMaxHorizontal;
+protected:
+ virtual void Apply();
+
+public:
+ SvxSplitTableDlg(Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal );
+ virtual ~SvxSplitTableDlg();
+
+ DECL_LINK( ClickHdl, Button * );
+
+ virtual bool IsHorizontal() const;
+ virtual bool IsProportional() const;
+ virtual long GetCount() const;
+
+ virtual short Execute();
+};
+
+#endif
diff --git a/cui/source/inc/srchxtra.hxx b/cui/source/inc/srchxtra.hxx
new file mode 100644
index 000000000000..6d2e9a1195aa
--- /dev/null
+++ b/cui/source/inc/srchxtra.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * 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: srchxtra.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SRCHXTRA_HXX
+#define _SVX_SRCHXTRA_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/field.hxx>
+#include <svtools/ctrltool.hxx>
+#include <sfx2/tabdlg.hxx>
+
+#include <svx/checklbx.hxx>
+#include <svx/srchdlg.hxx>
+
+// class SvxSearchFormatDialog -------------------------------------------
+
+class SvxSearchFormatDialog : public SfxTabDialog
+{
+public:
+ SvxSearchFormatDialog( Window* pParent, const SfxItemSet& rSet );
+ ~SvxSearchFormatDialog();
+
+protected:
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+
+private:
+ FontList* pFontList;
+};
+
+// class SvxSearchFormatDialog -------------------------------------------
+
+class SvxSearchAttributeDialog : public ModalDialog
+{
+public:
+ SvxSearchAttributeDialog( Window* pParent, SearchAttrItemList& rLst,
+ const USHORT* pWhRanges );
+
+private:
+ FixedText aAttrFL;
+ SvxCheckListBox aAttrLB;
+
+ OKButton aOKBtn;
+ CancelButton aEscBtn;
+ HelpButton aHelpBtn;
+
+ SearchAttrItemList& rList;
+
+ DECL_LINK( OKHdl, Button * );
+};
+
+// class SvxSearchSimilarityDialog ---------------------------------------
+
+class SvxSearchSimilarityDialog : public ModalDialog
+{
+private:
+ FixedLine aFixedLine;
+ FixedText aOtherTxt;
+ NumericField aOtherFld;
+ FixedText aLongerTxt;
+ NumericField aLongerFld;
+ FixedText aShorterTxt;
+ NumericField aShorterFld;
+ CheckBox aRelaxBox;
+
+ OKButton aOKBtn;
+ CancelButton aEscBtn;
+ HelpButton aHelpBtn;
+
+public:
+ SvxSearchSimilarityDialog( Window* pParent,
+ BOOL bRelax,
+ USHORT nOther,
+ USHORT nShorter,
+ USHORT nLonger );
+
+ USHORT GetOther() { return (USHORT)aOtherFld.GetValue(); }
+ USHORT GetShorter() { return (USHORT)aShorterFld.GetValue(); }
+ USHORT GetLonger() { return (USHORT)aLongerFld.GetValue(); }
+ BOOL IsRelaxed() { return aRelaxBox.IsChecked(); }
+};
+
+
+#endif
+
diff --git a/cui/source/inc/tabstpge.hxx b/cui/source/inc/tabstpge.hxx
new file mode 100644
index 000000000000..66d432ea37b4
--- /dev/null
+++ b/cui/source/inc/tabstpge.hxx
@@ -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: tabstpge.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TABSTPGE_HXX
+#define _SVX_TABSTPGE_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/group.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <sfx2/tabdlg.hxx>
+
+#include <svx/tstpitem.hxx>
+#include <svx/flagsdef.hxx>
+
+// forward ---------------------------------------------------------------
+
+class TabWin_Impl;
+
+// define ----------------------------------------------------------------
+
+// Bitfelder f"ur DisableControls()
+//CHINA001 #define TABTYPE_LEFT 0x0001
+//CHINA001 #define TABTYPE_RIGHT 0x0002
+//CHINA001 #define TABTYPE_CENTER 0x0004
+//CHINA001 #define TABTYPE_DEZIMAL 0x0008
+//CHINA001 #define TABTYPE_ALL 0x000F
+//CHINA001
+//CHINA001 #define TABFILL_NONE 0x0010
+//CHINA001 #define TABFILL_POINT 0x0020
+//CHINA001 #define TABFILL_DASHLINE 0x0040
+//CHINA001 #define TABFILL_SOLIDLINE 0x0080
+//CHINA001 #define TABFILL_SPECIAL 0x0100
+//CHINA001 #define TABFILL_ALL 0x01F0
+
+// class SvxTabulatorTabPage ---------------------------------------------
+/*
+ {k:\svx\prototyp\dialog\tabstop.bmp}
+
+ [Beschreibung]
+ In dieser TabPage werden Tabulatoren verwaltet.
+
+ [Items]
+ <SvxTabStopItem><SID_ATTR_TABSTOP>
+ <SfxUInt16Item><SID_ATTR_TABSTOP_DEFAULTS>
+ <SfxUInt16Item><SID_ATTR_TABSTOP_POS>
+ <SfxInt32Item><SID_ATTR_TABSTOP_OFFSET>
+*/
+
+class SvxTabulatorTabPage : public SfxTabPage
+{
+ using TabPage::DeactivatePage;
+
+public:
+ ~SvxTabulatorTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void DisableControls( const USHORT nFlag );
+
+protected:
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+private:
+ SvxTabulatorTabPage( Window* pParent, const SfxItemSet& rSet );
+
+ // Tabulatoren und Positionen
+ MetricBox aTabBox;
+ FixedLine aTabLabel;
+ FixedLine aTabLabelVert;
+
+ // TabType
+ RadioButton aLeftTab;
+ RadioButton aRightTab;
+ RadioButton aCenterTab;
+ RadioButton aDezTab;
+
+ TabWin_Impl* pLeftWin;
+ TabWin_Impl* pRightWin;
+ TabWin_Impl* pCenterWin;
+ TabWin_Impl* pDezWin;
+
+ FixedText aDezCharLabel;
+ Edit aDezChar;
+ FixedLine aTabTypeLabel;
+
+ // Fuellzeichen
+ RadioButton aNoFillChar;
+ RadioButton aFillPoints;
+ RadioButton aFillDashLine ;
+ RadioButton aFillSolidLine;
+ RadioButton aFillSpecial;
+ Edit aFillChar;
+ FixedLine aFillLabel;
+
+ // Buttons
+ PushButton aNewBtn;
+ PushButton aDelAllBtn;
+ PushButton aDelBtn;
+
+ // lokale Variablen, interne Funktionen
+ SvxTabStop aAktTab;
+ SvxTabStopItem aNewTabs;
+ long nDefDist;
+ FieldUnit eDefUnit;
+ BOOL bCheck;
+
+#ifdef _SVX_TABSTPGE_CXX
+ void InitTabPos_Impl( USHORT nPos = 0 );
+ void SetFillAndTabType_Impl();
+
+ // Handler
+ DECL_LINK( NewHdl_Impl, Button* );
+ DECL_LINK( DelHdl_Impl, Button* );
+ DECL_LINK( DelAllHdl_Impl, Button* );
+
+ DECL_LINK( FillTypeCheckHdl_Impl, RadioButton* );
+ DECL_LINK( TabTypeCheckHdl_Impl, RadioButton* );
+
+ DECL_LINK( SelectHdl_Impl, MetricBox* );
+ DECL_LINK( ModifyHdl_Impl, MetricBox* );
+ DECL_LINK( GetFillCharHdl_Impl, Edit* );
+ DECL_LINK( GetDezCharHdl_Impl, Edit* );
+#endif
+ virtual void PageCreated(SfxAllItemSet aSet); // add CHINA001
+};
+
+#endif // #ifndef _SVX_TABSTPGE_HXX
+
+
diff --git a/cui/source/inc/textanim.hxx b/cui/source/inc/textanim.hxx
new file mode 100644
index 000000000000..576bda45450a
--- /dev/null
+++ b/cui/source/inc/textanim.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * 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: textanim.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TEXTANIM_HXX
+#define _SVX_TEXTANIM_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/field.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/svdattr.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+
+class SdrView;
+
+/*************************************************************************
+|*
+|* Page zum "Andern von TextAnimationen (Lauftext etc.)
+|*
+\************************************************************************/
+
+class SvxTextAnimationPage : public SfxTabPage
+{
+private:
+ FixedLine aFlEffect;
+ FixedText aFtEffects;
+ ListBox aLbEffect;
+ //ValueSet aCtlEffect;
+ FixedText aFtDirection;
+ ImageButton aBtnUp;
+ ImageButton aBtnLeft;
+ ImageButton aBtnRight;
+ ImageButton aBtnDown;
+
+ FixedLine aFlProperties;
+ TriStateBox aTsbStartInside;
+ TriStateBox aTsbStopInside;
+
+ FixedText aFtCount;
+ TriStateBox aTsbEndless;
+ NumericField aNumFldCount;
+
+ FixedText aFtAmount;
+ TriStateBox aTsbPixel;
+ MetricField aMtrFldAmount;
+
+ FixedText aFtDelay;
+ TriStateBox aTsbAuto;
+ MetricField aMtrFldDelay;
+
+ const SfxItemSet& rOutAttrs;
+ SdrTextAniKind eAniKind;
+ FieldUnit eFUnit;
+ SfxMapUnit eUnit;
+
+#ifdef _SVX_TEXTANIM_CXX
+ DECL_LINK( SelectEffectHdl_Impl, void * );
+ DECL_LINK( ClickEndlessHdl_Impl, void * );
+ DECL_LINK( ClickAutoHdl_Impl, void * );
+ DECL_LINK( ClickPixelHdl_Impl, void * );
+ DECL_LINK( ClickDirectionHdl_Impl, ImageButton * );
+
+ void SelectDirection( SdrTextAniDirection nValue );
+ USHORT GetSelectedDirection();
+#endif
+
+public:
+
+ SvxTextAnimationPage( Window* pWindow, const SfxItemSet& rInAttrs );
+ ~SvxTextAnimationPage();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ void Construct();
+};
+
+/*************************************************************************
+|*
+|* Text-Tab-Dialog
+|*
+\************************************************************************/
+class SvxTextTabDialog : public SfxTabDialog
+{
+private:
+ const SfxItemSet& rOutAttrs;
+ const SdrView* pView;
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+
+public:
+
+ SvxTextTabDialog( Window* pParent, const SfxItemSet* pAttr,
+ const SdrView* pView );
+ ~SvxTextTabDialog() {};
+};
+
+
+#endif // _SVX_TEXTANIM_HXX
+
diff --git a/cui/source/inc/textattr.hxx b/cui/source/inc/textattr.hxx
new file mode 100644
index 000000000000..d2e8d795653f
--- /dev/null
+++ b/cui/source/inc/textattr.hxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * 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: textattr.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TEXTATTR_HXX
+#define _SVX_TEXTATTR_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svx/dlgctrl.hxx>
+
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <sfx2/basedlgs.hxx>
+
+class SdrView;
+
+/*************************************************************************
+|*
+|* Dialog zum "Andern von TextAttributen
+|*
+\************************************************************************/
+
+class SvxTextAttrPage : public SvxTabPage
+{
+private:
+ FixedLine aFlText;
+ TriStateBox aTsbAutoGrowWidth;
+ TriStateBox aTsbAutoGrowHeight;
+ TriStateBox aTsbFitToSize;
+ TriStateBox aTsbContour;
+ TriStateBox aTsbWordWrapText;
+ TriStateBox aTsbAutoGrowSize;
+
+
+ FixedLine aFlDistance;
+ FixedText aFtLeft;
+ MetricField aMtrFldLeft;
+ FixedText aFtRight;
+ MetricField aMtrFldRight;
+ FixedText aFtTop;
+ MetricField aMtrFldTop;
+ FixedText aFtBottom;
+ MetricField aMtrFldBottom;
+
+ FixedLine aFlSeparator;
+
+ FixedLine aFlPosition;
+ SvxRectCtl aCtlPosition;
+ TriStateBox aTsbFullWidth;
+
+ const SfxItemSet& rOutAttrs;
+ const SdrView* pView;
+
+ BOOL bAutoGrowSizeEnabled;
+ BOOL bContourEnabled;
+ BOOL bAutoGrowWidthEnabled;
+ BOOL bAutoGrowHeightEnabled;
+ BOOL bWordWrapTextEnabled;
+ BOOL bFitToSizeEnabled;
+
+
+#ifdef _SVX_TEXTATTR_CXX
+ DECL_LINK( ClickFullWidthHdl_Impl, void * );
+ DECL_LINK( ClickHdl_Impl, void * );
+#endif
+
+ /** Return whether the text direction is from left to right (</TRUE>) or
+ top to bottom (</FALSE>).
+ */
+ bool IsTextDirectionLeftToRight (void) const;
+
+public:
+
+ SvxTextAttrPage( Window* pWindow, const SfxItemSet& rInAttrs );
+ ~SvxTextAttrPage();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
+
+ void Construct();
+ void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
+ virtual void PageCreated(SfxAllItemSet aSet); // add CHINA001
+};
+
+/*************************************************************************
+|*
+|* Von SfxSingleTabDialog abgeleitet, um vom Control "uber virtuelle Methode
+|* benachrichtigt werden zu k"onnen.
+|*
+\************************************************************************/
+
+//CHINA001 class SvxTextAttrDialog : public SfxSingleTabDialog
+//CHINA001 {
+//CHINA001 public:
+//CHINA001 SvxTextAttrDialog( Window* pParent, const SfxItemSet& rAttr,
+//CHINA001 const SdrView* pView );
+//CHINA001 ~SvxTextAttrDialog();
+//CHINA001 };
+
+
+#endif // _SVX_TEXTATTR_HXX
+
diff --git a/cui/source/inc/transfrm.hxx b/cui/source/inc/transfrm.hxx
new file mode 100644
index 000000000000..3a5abeedf4a1
--- /dev/null
+++ b/cui/source/inc/transfrm.hxx
@@ -0,0 +1,308 @@
+/*************************************************************************
+ *
+ * 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: transfrm.hxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TRANSFRM_HXX
+#define _SVX_TRANSFRM_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svx/dlgctrl.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+// #i75273#
+#include <basegfx/range/b2drange.hxx>
+
+// predefines
+class SdrView;
+
+/*************************************************************************
+|*
+|* Transform-Tab-Dialog
+|*
+\************************************************************************/
+
+/** put this into the nAnchorTypes parameter of the SvxTransformTabDialog c'tor
+ to disable the size controls */
+const USHORT SVX_OBJ_NORESIZE = 0x0100;
+
+/** put this into the nAnchorTypes parameter of the SvxTransformTabDialog c'tor
+ to disable the protect controls */
+const USHORT SVX_OBJ_NOPROTECT = 0x0200;
+
+class SvxTransformTabDialog : public SfxTabDialog
+{
+private:
+ const SdrView* pView;
+
+ USHORT nAnchorCtrls;
+ Link aValidateLink;
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+
+public:
+
+ SvxTransformTabDialog( Window* pParent, const SfxItemSet* pAttr,
+ const SdrView* pView,
+ USHORT nAnchorTypes = 0);
+ ~SvxTransformTabDialog();
+
+ //link for the Writer to validate positions
+ void SetValidateFramePosLink( const Link& rLink );
+};
+
+/*************************************************************************
+|*
+|* position and size tab page
+|*
+\************************************************************************/
+
+class SvxPositionSizeTabPage : public SvxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ // position
+ FixedLine maFlPosition;
+ FixedText maFtPosX;
+ MetricField maMtrPosX;
+ FixedText maFtPosY;
+ MetricField maMtrPosY;
+ FixedText maFtPosReference;
+ SvxRectCtl maCtlPos;
+
+ // size
+ FixedLine maFlSize;
+ FixedText maFtWidth;
+ MetricField maMtrWidth;
+ FixedText maFtHeight;
+ MetricField maMtrHeight;
+ CheckBox maCbxScale;
+ FixedText maFtSizeReference;
+ SvxRectCtl maCtlSize;
+
+ // protect
+ FixedLine maFlProtect;
+ TriStateBox maTsbPosProtect;
+ TriStateBox maTsbSizeProtect;
+
+ // adjust
+ FixedLine maFlAdjust;
+ TriStateBox maTsbAutoGrowWidth;
+ TriStateBox maTsbAutoGrowHeight;
+
+ FixedLine maFlDivider;
+
+private:
+ const SfxItemSet& mrOutAttrs;
+
+ const SdrView* mpView;
+
+ // #i75273#
+ basegfx::B2DRange maRange;
+ basegfx::B2DRange maWorkRange;
+ basegfx::B2DPoint maAnchor;
+
+ SfxMapUnit mePoolUnit;
+ FieldUnit meDlgUnit;
+ MapUnit meMapUnit;
+ TriState mnProtectSizeState;
+ bool mbPageDisabled;
+ bool mbProtectDisabled;
+ bool mbSizeDisabled;
+ bool mbAdjustDisabled;
+
+ // frome size
+ // #i75273#
+ double mfOldWidth;
+ double mfOldHeight;
+ RECT_POINT meRP;
+
+ //------------------------------------
+#if _SOLAR__PRIVATE
+ DECL_LINK( ChangePosProtectHdl, void * );
+ DECL_LINK( ChangeSizeProtectHdl, void * );
+ DECL_LINK( ChangePosXHdl, void * );
+ DECL_LINK( ChangePosYHdl, void * );
+// DECL_LINK( SetAnchorHdl, ListBox * );
+// DECL_LINK( SetOrientHdl, ListBox * );
+
+ void SetMinMaxPosition();
+ void GetTopLeftPosition(double& rfX, double& rfY, const basegfx::B2DRange& rRange);
+#endif
+
+#if _SOLAR__PRIVATE
+ DECL_LINK( ChangeWidthHdl, void * );
+ DECL_LINK( ChangeHeightHdl, void * );
+ DECL_LINK( ClickSizeProtectHdl, void * );
+ DECL_LINK( ClickAutoHdl, void * );
+
+ void SetMaxSize( Rectangle aRect );
+ Rectangle GetRect();
+#endif
+
+public:
+ SvxPositionSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+ virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
+
+ void Construct();
+ void SetView( const SdrView* pSdrView ) { mpView = pSdrView; }
+
+// void ShowAnchorCtrls(USHORT nAnchorCtrls); // Writer-spezifische Controls anzeigen
+ virtual void FillUserData();
+
+ void DisableResize();
+ void DisableProtect();
+
+ void UpdateControlStates();
+};
+
+/*************************************************************************
+|*
+|* Drehwinkel-Tab-Page
+|*
+\************************************************************************/
+class SvxAngleTabPage : public SvxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ FixedLine aFlPosition;
+ FixedText aFtPosX;
+ MetricField aMtrPosX;
+ FixedText aFtPosY;
+ MetricField aMtrPosY;
+ FixedText aFtPosPresets;
+ SvxRectCtl aCtlRect;
+
+ FixedLine aFlAngle;
+ FixedText aFtAngle;
+ MetricField aMtrAngle;
+ FixedText aFtAnglePresets;
+ SvxRectCtl aCtlAngle;
+
+ const SfxItemSet& rOutAttrs;
+ const SdrView* pView;
+
+ // #i75273#
+ basegfx::B2DRange maRange;
+ basegfx::B2DPoint maAnchor;
+
+ SfxMapUnit ePoolUnit;
+ FieldUnit eDlgUnit;
+ MapUnit eMapUnit;
+ //------------------------------------
+#if _SOLAR__PRIVATE
+ DECL_LINK( ModifiedHdl, void * );
+#endif
+public:
+ SvxAngleTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+ virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
+
+ void Construct();
+ void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
+};
+
+/*************************************************************************
+|*
+|* Schraegstellen/Eckenradius-Tab-Page
+|*
+\************************************************************************/
+class SvxSlantTabPage : public SvxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ FixedLine aFlRadius;
+ FixedText aFtRadius;
+ MetricField aMtrRadius;
+ //TriStateBox aTsbVertical;
+ FixedLine aFlAngle;
+ FixedText aFtAngle;
+ MetricField aMtrAngle;
+ //SvxRectCtl aCtlAngle;
+
+ const SfxItemSet& rOutAttrs;
+
+ const SdrView* pView;
+
+ // #i75273#
+ basegfx::B2DRange maRange;
+
+ SfxMapUnit ePoolUnit;
+ FieldUnit eDlgUnit;
+ MapUnit eMapUnit;
+ //------------------------------------
+public:
+ SvxSlantTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+ virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
+
+ void Construct();
+ void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
+};
+
+
+
+#endif // _SVX_TRANSFRM_HXX
+
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
new file mode 100644
index 000000000000..cce278686b27
--- /dev/null
+++ b/cui/source/inc/treeopt.hxx
@@ -0,0 +1,362 @@
+/*************************************************************************
+ *
+ * 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: treeopt.hxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <com/sun/star/uno/Reference.h>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svtools/svtreebx.hxx>
+#include <tools/resary.hxx>
+#include <vcl/image.hxx>
+#include <vcl/fixbrd.hxx>
+#include <vcl/fixed.hxx>
+
+#include <vector>
+
+// static ----------------------------------------------------------------
+
+BOOL EnableSSO();
+CreateTabPage GetSSOCreator( void );
+
+// class OfaOptionsTreeListBox -------------------------------------------
+
+//!#define NUMBER_OF_OPTION_PAGES 12
+class SfxModule;
+class SfxShell;
+class SfxItemSet;
+class XColorTable;
+class OfaOptionsTreeListBox : public SvTreeListBox
+{
+ using SvListView::Collapse;
+
+private:
+ BOOL bInCollapse;
+
+public:
+ OfaOptionsTreeListBox(Window* pParent, const ResId& rResId) :
+ SvTreeListBox( pParent, rResId ), bInCollapse(FALSE) {}
+
+ virtual BOOL Collapse( SvLBoxEntry* pParent );
+ BOOL IsInCollapse()const {return bInCollapse;}
+};
+
+// struct OrderedEntry ---------------------------------------------------
+
+struct OrderedEntry
+{
+ sal_Int32 m_nIndex;
+ rtl::OUString m_sId;
+
+ OrderedEntry( sal_Int32 nIndex, const rtl::OUString& rId ) :
+ m_nIndex( nIndex ), m_sId( rId ) {}
+};
+
+typedef std::vector< OrderedEntry* > VectorOfOrderedEntries;
+
+// struct Module ---------------------------------------------------------
+
+struct Module
+{
+ rtl::OUString m_sName;
+ bool m_bActive;
+ VectorOfOrderedEntries m_aNodeList;
+
+ Module( const rtl::OUString& rName ) : m_sName( rName ), m_bActive( false ) {}
+};
+
+// struct OptionsLeaf ----------------------------------------------------
+
+struct OptionsLeaf
+{
+ rtl::OUString m_sId;
+ rtl::OUString m_sLabel;
+ rtl::OUString m_sPageURL;
+ rtl::OUString m_sEventHdl;
+ rtl::OUString m_sGroupId;
+ sal_Int32 m_nGroupIndex;
+
+ OptionsLeaf( const rtl::OUString& rId,
+ const rtl::OUString& rLabel,
+ const rtl::OUString& rPageURL,
+ const rtl::OUString& rEventHdl,
+ const rtl::OUString& rGroupId,
+ sal_Int32 nGroupIndex ) :
+ m_sId( rId ),
+ m_sLabel( rLabel ),
+ m_sPageURL( rPageURL ),
+ m_sEventHdl( rEventHdl ),
+ m_sGroupId( rGroupId ),
+ m_nGroupIndex( nGroupIndex ) {}
+};
+
+typedef ::std::vector< OptionsLeaf* > VectorOfLeaves;
+typedef ::std::vector< VectorOfLeaves > VectorOfGroupedLeaves;
+
+// struct OptionsNode ----------------------------------------------------
+
+struct OptionsNode
+{
+ rtl::OUString m_sId;
+ rtl::OUString m_sLabel;
+ rtl::OUString m_sPageURL;
+ bool m_bAllModules;
+ rtl::OUString m_sGroupId;
+ sal_Int32 m_nGroupIndex;
+ VectorOfLeaves m_aLeaves;
+ VectorOfGroupedLeaves m_aGroupedLeaves;
+
+ OptionsNode( const rtl::OUString& rId,
+ const rtl::OUString& rLabel,
+ const rtl::OUString& rPageURL,
+ bool bAllModules,
+ const rtl::OUString& rGroupId,
+ sal_Int32 nGroupIndex ) :
+ m_sId( rId ),
+ m_sLabel( rLabel ),
+ m_sPageURL( rPageURL ),
+ m_bAllModules( bAllModules ),
+ m_sGroupId( rGroupId ),
+ m_nGroupIndex( nGroupIndex ) {}
+
+ ~OptionsNode()
+ {
+ for ( sal_uInt32 i = 0; i < m_aLeaves.size(); ++i )
+ delete m_aLeaves[i];
+ m_aLeaves.clear();
+ m_aGroupedLeaves.clear();
+ }
+};
+
+typedef ::std::vector< OptionsNode* > VectorOfNodes;
+
+struct LastPageSaver
+{
+ USHORT m_nLastPageId;
+ rtl::OUString m_sLastPageURL_Tools;
+ rtl::OUString m_sLastPageURL_ExtMgr;
+
+ LastPageSaver() : m_nLastPageId( USHRT_MAX ) {}
+};
+
+// class OfaTreeOptionsDialog --------------------------------------------
+
+namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } }
+namespace com { namespace sun { namespace star { namespace container { class XNameAccess; } } } }
+namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } }
+namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowProvider; } } } }
+
+struct OptionsPageInfo;
+struct Module;
+class ExtensionsTabPage;
+typedef std::vector< ExtensionsTabPage* > VectorOfPages;
+
+class OfaTreeOptionsDialog : public SfxModalDialog
+{
+private:
+ OKButton aOkPB;
+ CancelButton aCancelPB;
+ HelpButton aHelpPB;
+ PushButton aBackPB;
+
+ FixedBorder aHiddenGB;
+ FixedText aPageTitleFT;
+ FixedLine aLine1FL;
+ FixedText aHelpFT;
+ FixedImage aHelpImg;
+
+ ImageList aPageImages;
+ ImageList aPageImagesHC;
+
+ ResStringArray aHelpTextsArr;
+
+ OfaOptionsTreeListBox aTreeLB;
+
+ String sTitle;
+ String sNotLoadedError;
+
+ SvLBoxEntry* pCurrentPageEntry;
+
+ // for the ColorTabPage
+ SfxItemSet* pColorPageItemSet;
+ XColorTable* pColorTab;
+ USHORT nChangeType;
+ USHORT nUnknownType;
+ USHORT nUnknownPos;
+ BOOL bIsAreaTP;
+
+ BOOL bForgetSelection;
+ BOOL bExternBrowserActive;
+ BOOL bImageResized;
+ bool bInSelectHdl_Impl;
+ bool bIsFromExtensionManager;
+
+ // check "for the current document only" and set focus to "Western" languages box
+ bool bIsForSetDocumentLanguage;
+
+ Timer aSelectTimer;
+
+ com::sun::star::uno::Reference < com::sun::star::awt::XContainerWindowProvider >
+ m_xContainerWinProvider;
+
+ static LastPageSaver* pLastPageSaver;
+
+ SfxItemSet* CreateItemSet( USHORT nId );
+ void ApplyItemSet( USHORT nId, const SfxItemSet& rSet );
+ void InitTreeAndHandler();
+ void Initialize( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& _xFrame );
+ void ResizeTreeLB( void ); // resizes dialog so that treelistbox has no horizontal scroll bar
+
+ void LoadExtensionOptions( const rtl::OUString& rExtensionId );
+ rtl::OUString GetModuleIdentifier( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& xMFac,
+ const com::sun::star::uno::Reference<
+ com::sun::star::frame::XFrame >& xFrame );
+ Module* LoadModule( const rtl::OUString& rModuleIdentifier,
+ const com::sun::star::uno::Reference<
+ com::sun::star::container::XNameAccess >& xRoot );
+ void LoadNodes( const com::sun::star::uno::Reference<
+ com::sun::star::container::XNameAccess >& xRoot,
+ Module* pModule,
+ const rtl::OUString& rExtensionId,
+ VectorOfNodes& rOutNodeList );
+ void InsertNodes( const VectorOfNodes& rNodeList );
+
+protected:
+ DECL_LINK(ExpandedHdl_Impl, SvTreeListBox* );
+ DECL_LINK(ShowPageHdl_Impl, SvTreeListBox* );
+ DECL_LINK(BackHdl_Impl, PushButton* );
+ DECL_LINK( OKHdl_Impl, Button * );
+ DECL_LINK( HintHdl_Impl, Timer * );
+ DECL_LINK( SelectHdl_Impl, Timer * );
+
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual short Execute();
+
+public:
+ OfaTreeOptionsDialog( Window* pParent,
+ const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& _xFrame,
+ bool bActivateLastSelection = true );
+ OfaTreeOptionsDialog( Window* pParent, const rtl::OUString& rExtensionId );
+ ~OfaTreeOptionsDialog();
+
+ OptionsPageInfo* AddTabPage( USHORT nId, const String& rPageName, USHORT nGroup );
+ USHORT AddGroup( const String& rGroupName, SfxShell* pCreateShell,
+ SfxModule* pCreateModule, USHORT nDialogId );
+
+ void ActivateLastSelection();
+ void ActivatePage( USHORT nResId );
+ void ActivatePage( const String& rPageURL );
+ void ApplyItemSets();
+
+ USHORT GetColorChanged() const { return nChangeType; }
+ XColorTable* GetColorTable() { return pColorTab; }
+
+ // helper functions to call the language settings TabPage from the SpellDialog
+ static void ApplyLanguageOptions(const SfxItemSet& rSet);
+};
+
+// class OfaPageResource -------------------------------------------------
+
+class OfaPageResource : public Resource
+{
+ ResStringArray aGeneralDlgAry;
+ ResStringArray aInetDlgAry;
+ ResStringArray aLangDlgAry;
+ ResStringArray aTextDlgAry;
+ ResStringArray aHTMLDlgAry;
+ ResStringArray aCalcDlgAry;
+ ResStringArray aStarMathDlgAry;
+ ResStringArray aImpressDlgAry;
+ ResStringArray aDrawDlgAry;
+ ResStringArray aChartDlgAry;
+ ResStringArray aFilterDlgAry;
+ ResStringArray aDatasourcesDlgAry;
+
+public:
+ OfaPageResource();
+
+ ResStringArray& GetGeneralArray() {return aGeneralDlgAry;}
+ ResStringArray& GetInetArray() {return aInetDlgAry;}
+ ResStringArray& GetLangArray() {return aLangDlgAry;}
+ ResStringArray& GetTextArray() {return aTextDlgAry;}
+ ResStringArray& GetHTMLArray() {return aHTMLDlgAry;}
+ ResStringArray& GetCalcArray() {return aCalcDlgAry;}
+ ResStringArray& GetStarMathArray() {return aStarMathDlgAry;}
+ ResStringArray& GetImpressArray() {return aImpressDlgAry;}
+ ResStringArray& GetDrawArray() {return aDrawDlgAry;}
+ ResStringArray& GetChartArray() {return aChartDlgAry;}
+ ResStringArray& GetFilterArray() {return aFilterDlgAry;}
+ ResStringArray& GetDatasourcesArray() {return aDatasourcesDlgAry;}
+};
+
+// class ExtensionsTabPage -----------------------------------------------
+
+namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } }
+namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowEventHandler; } } } }
+
+class ExtensionsTabPage : public TabPage
+{
+private:
+ rtl::OUString m_sPageURL;
+ com::sun::star::uno::Reference< com::sun::star::awt::XWindow >
+ m_xPage;
+ rtl::OUString m_sEventHdl;
+ com::sun::star::uno::Reference< com::sun::star::awt::XContainerWindowEventHandler >
+ m_xEventHdl;
+ com::sun::star::uno::Reference< com::sun::star::awt::XContainerWindowProvider >
+ m_xWinProvider;
+ bool m_bIsWindowHidden;
+
+ void CreateDialogWithHandler();
+ sal_Bool DispatchAction( const rtl::OUString& rAction );
+
+public:
+ ExtensionsTabPage(
+ Window* pParent, const ResId&,
+ const rtl::OUString& rPageURL, const rtl::OUString& rEvtHdl,
+ const com::sun::star::uno::Reference<
+ com::sun::star::awt::XContainerWindowProvider >& rProvider );
+
+ ExtensionsTabPage(
+ Window* pParent, WinBits nStyle,
+ const rtl::OUString& rPageURL, const rtl::OUString& rEvtHdl,
+ const com::sun::star::uno::Reference<
+ com::sun::star::awt::XContainerWindowProvider >& rProvider );
+
+ virtual ~ExtensionsTabPage();
+
+ virtual void ActivatePage();
+ virtual void DeactivatePage();
+
+ void ResetPage();
+ void SavePage();
+ void HideWindow();
+};
+
diff --git a/cui/source/inc/zoom.hxx b/cui/source/inc/zoom.hxx
new file mode 100644
index 000000000000..d031da97bc55
--- /dev/null
+++ b/cui/source/inc/zoom.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * 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: zoom.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_ZOOM_HXX
+#define _SVX_ZOOM_HXX
+
+// include ---------------------------------------------------------------
+
+#include <layout/layout.hxx>
+#include <sfx2/basedlgs.hxx>
+#ifndef _SV_BUTTON_HXX //autogen wg. Radio-/OK-/Cancel-/HelpButton
+#include <vcl/button.hxx>
+#endif
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+
+// define ----------------------------------------------------------------
+/* CHINA001
+#define ZOOMBTN_OPTIMAL ((USHORT)0x0001)
+#define ZOOMBTN_PAGEWIDTH ((USHORT)0x0002)
+#define ZOOMBTN_WHOLEPAGE ((USHORT)0x0004)
+*/
+#ifndef _SVX_ZOOM_HXX
+#include "zoom_def.hxx"
+#endif
+// class SvxZoomDialog ---------------------------------------------------
+/*
+ {k:\svx\prototyp\dialog\zoom.bmp}
+
+ [Beschreibung]
+ Mit diesem Dialog wird ein Zoom-Faktor eingestellt.
+
+ [Items]
+ SvxZoomItem <SID_ATTR_ZOOM>
+*/
+
+#include <layout/layout-pre.hxx>
+
+class SvxZoomDialog : public SfxModalDialog
+{
+private:
+ FixedLine aZoomFl;
+ RadioButton aOptimalBtn;
+ RadioButton aWholePageBtn;
+ RadioButton aPageWidthBtn;
+ RadioButton a100Btn;
+ RadioButton aUserBtn;
+ MetricField aUserEdit;
+
+ FixedLine aViewLayoutFl;
+ RadioButton aAutomaticBtn;
+ RadioButton aSingleBtn;
+ RadioButton aColumnsBtn;
+ MetricField aColumnsEdit;
+ CheckBox aBookModeChk;
+
+ FixedLine aBottomFl;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ const SfxItemSet& rSet;
+ SfxItemSet* pOutSet;
+ BOOL bModified;
+
+#ifdef _SVX_ZOOM_CXX
+ DECL_LINK( UserHdl, RadioButton* );
+ DECL_LINK( SpinHdl, MetricField* );
+ DECL_LINK( ViewLayoutUserHdl, RadioButton* );
+ DECL_LINK( ViewLayoutSpinHdl, MetricField* );
+ DECL_LINK( ViewLayoutCheckHdl, CheckBox* );
+ DECL_LINK( OKHdl, Button* );
+#endif
+
+public:
+ SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet );
+ ~SvxZoomDialog();
+
+ static USHORT* GetRanges();
+ const SfxItemSet* GetOutputItemSet() const { return pOutSet; }
+
+ USHORT GetFactor() const;
+ void SetFactor( USHORT nNewFactor, USHORT nBtnId = 0 );
+
+ void SetButtonText( USHORT nBtnId, const String& aNewTxt );
+ void HideButton( USHORT nBtnId );
+ void SetLimits( USHORT nMin, USHORT nMax );
+ void SetSpinSize( USHORT nNewSpin );
+};
+
+#include <layout/layout-post.hxx>
+
+#endif
+
diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx
new file mode 100644
index 000000000000..31915733c660
--- /dev/null
+++ b/cui/source/options/cfgchart.cxx
@@ -0,0 +1,327 @@
+/*************************************************************************
+ *
+ * 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: cfgchart.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <com/sun/star/uno/Sequence.hxx>
+// header for SvStream
+#include <tools/stream.hxx>
+// header for SAL_STATIC_CAST
+#include <sal/types.h>
+#include "cfgchart.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+
+#define ROW_COLOR_COUNT 12
+
+using namespace com::sun::star;
+
+TYPEINIT1( SvxChartColorTableItem, SfxPoolItem );
+
+SvxChartColorTable::SvxChartColorTable()
+{}
+
+SvxChartColorTable::SvxChartColorTable( const SvxChartColorTable & _rSource ) :
+ m_aColorEntries( _rSource.m_aColorEntries )
+{}
+
+// accessors
+size_t SvxChartColorTable::size() const
+{
+ return m_aColorEntries.size();
+}
+
+const XColorEntry & SvxChartColorTable::operator[]( size_t _nIndex ) const
+{
+ if ( _nIndex >= m_aColorEntries.size() )
+ {
+ DBG_ERRORFILE( "SvxChartColorTable::[] invalid index" );
+ return m_aColorEntries[ 0 ];
+ }
+
+ return m_aColorEntries[ _nIndex ];
+}
+
+ColorData SvxChartColorTable::getColorData( size_t _nIndex ) const
+{
+ if ( _nIndex >= m_aColorEntries.size() )
+ {
+ DBG_ERRORFILE( "SvxChartColorTable::getColorData invalid index" );
+ return COL_BLACK;
+ }
+
+ // GetColor should be const but unfortunately isn't
+ return const_cast< XColorEntry & >( m_aColorEntries[ _nIndex ] ).GetColor().GetRGBColor();
+}
+
+// mutators
+void SvxChartColorTable::clear()
+{
+ m_aColorEntries.clear();
+}
+
+void SvxChartColorTable::append( const XColorEntry & _rEntry )
+{
+ m_aColorEntries.push_back( _rEntry );
+}
+
+void SvxChartColorTable::replace( size_t _nIndex, const XColorEntry & _rEntry )
+{
+ DBG_ASSERT( _nIndex <= m_aColorEntries.size(),
+ "SvxChartColorTable::replace invalid index" );
+
+ Color aCol1 = m_aColorEntries[ _nIndex ].GetColor(), aCol2;
+ m_aColorEntries[ _nIndex ] = _rEntry;
+ aCol2 = m_aColorEntries[ _nIndex ].GetColor();
+ if ( aCol2 != const_cast< XColorEntry& >( _rEntry ).GetColor() )
+ {
+ DBG_ERRORFILE( "wrong color" );
+ }
+}
+
+void SvxChartColorTable::useDefault()
+{
+ ColorData aColors[] = {
+ RGB_COLORDATA( 0x00, 0x45, 0x86 ),
+ RGB_COLORDATA( 0xff, 0x42, 0x0e ),
+ RGB_COLORDATA( 0xff, 0xd3, 0x20 ),
+ RGB_COLORDATA( 0x57, 0x9d, 0x1c ),
+ RGB_COLORDATA( 0x7e, 0x00, 0x21 ),
+ RGB_COLORDATA( 0x83, 0xca, 0xff ),
+ RGB_COLORDATA( 0x31, 0x40, 0x04 ),
+ RGB_COLORDATA( 0xae, 0xcf, 0x00 ),
+ RGB_COLORDATA( 0x4b, 0x1f, 0x6f ),
+ RGB_COLORDATA( 0xff, 0x95, 0x0e ),
+ RGB_COLORDATA( 0xc5, 0x00, 0x0b ),
+ RGB_COLORDATA( 0x00, 0x84, 0xd1 )
+ };
+
+ clear();
+
+ String aResName( SVX_RES( RID_SVXSTR_DIAGRAM_ROW ) );
+ String aPrefix, aPostfix, aName;
+ xub_StrLen nPos = aResName.SearchAscii( "$(ROW)" );
+ if( nPos != STRING_NOTFOUND )
+ {
+ aPrefix = String( aResName, 0, nPos );
+ aPostfix = String( aResName, nPos + sizeof( "$(ROW)" ) - 1, STRING_LEN );
+ }
+ else
+ aPrefix = aResName;
+
+ for( sal_Int32 i=0; i<ROW_COLOR_COUNT; i++ )
+ {
+ aName = aPrefix;
+ aName.Append( String::CreateFromInt32( i + 1 ));
+ aName.Append( aPostfix );
+
+ append( XColorEntry( aColors[ i % sizeof( aColors ) ], aName ));
+ }
+}
+
+// comparison
+bool SvxChartColorTable::operator==( const SvxChartColorTable & _rOther ) const
+{
+ // note: XColorEntry has no operator ==
+ bool bEqual = ( this->m_aColorEntries.size() == _rOther.m_aColorEntries.size() );
+
+ if( bEqual )
+ {
+ for( size_t i = 0; i < m_aColorEntries.size(); ++i )
+ {
+ if( getColorData( i ) != _rOther.getColorData( i ))
+ {
+ bEqual = false;
+ break;
+ }
+ }
+ }
+
+ return bEqual;
+}
+
+// ====================
+// class SvxChartOptions
+// ====================
+
+SvxChartOptions::SvxChartOptions() :
+ ::utl::ConfigItem( rtl::OUString::createFromAscii( "Office.Chart" )),
+ mbIsInitialized( FALSE )
+{
+ maPropertyNames.realloc( 1 );
+ maPropertyNames[ 0 ] = ::rtl::OUString::createFromAscii( "DefaultColor/Series" );
+}
+
+SvxChartOptions::~SvxChartOptions()
+{
+}
+
+const SvxChartColorTable& SvxChartOptions::GetDefaultColors()
+{
+ if ( !mbIsInitialized )
+ mbIsInitialized = RetrieveOptions();
+ return maDefColors;
+}
+
+void SvxChartOptions::SetDefaultColors( const SvxChartColorTable& aCol )
+{
+ maDefColors = aCol;
+ SetModified();
+}
+
+BOOL SvxChartOptions::RetrieveOptions()
+{
+ // get sequence containing all properties
+
+ uno::Sequence< ::rtl::OUString > aNames = GetPropertyNames();
+ uno::Sequence< uno::Any > aProperties( aNames.getLength());
+ aProperties = GetProperties( aNames );
+
+ if( aProperties.getLength() == aNames.getLength())
+ {
+ // 1. default colors for series
+ maDefColors.clear();
+ uno::Sequence< sal_Int64 > aColorSeq;
+ aProperties[ 0 ] >>= aColorSeq;
+
+ sal_Int32 nCount = aColorSeq.getLength();
+ Color aCol;
+
+ // create strings for entry names
+ String aResName( SVX_RES( RID_SVXSTR_DIAGRAM_ROW ) );
+ String aPrefix, aPostfix, aName;
+ xub_StrLen nPos = aResName.SearchAscii( "$(ROW)" );
+ if( nPos != STRING_NOTFOUND )
+ {
+ aPrefix = String( aResName, 0, nPos );
+ aPostfix = String( aResName, nPos + sizeof( "$(ROW)" ) - 1, STRING_LEN );
+ }
+ else
+ aPrefix = aResName;
+
+ // set color values
+ for( sal_Int32 i=0; i < nCount; i++ )
+ {
+ aCol.SetColor( SAL_STATIC_CAST( ColorData, aColorSeq[ i ] ));
+
+ aName = aPrefix;
+ aName.Append( String::CreateFromInt32( i + 1 ));
+ aName.Append( aPostfix );
+
+ maDefColors.append( XColorEntry( aCol, aName ));
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void SvxChartOptions::Commit()
+{
+ uno::Sequence< ::rtl::OUString > aNames = GetPropertyNames();
+ uno::Sequence< uno::Any > aValues( aNames.getLength());
+
+ if( aValues.getLength() >= 1 )
+ {
+ // 1. default colors for series
+ // convert list to sequence
+ const size_t nCount = maDefColors.size();
+ uno::Sequence< sal_Int64 > aColors( nCount );
+ for( size_t i=0; i < nCount; i++ )
+ {
+ ColorData aData = maDefColors.getColorData( i );
+ aColors[ i ] = aData;
+ }
+
+ aValues[ 0 ] <<= aColors;
+ }
+
+ PutProperties( aNames, aValues );
+}
+
+void SvxChartOptions::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{
+}
+
+// --------------------
+// class SvxChartColorTableItem
+// --------------------
+
+SvxChartColorTableItem::SvxChartColorTableItem( USHORT nWhich_, const SvxChartColorTable& aTable ) :
+ SfxPoolItem( nWhich_ ),
+ m_aColorTable( aTable )
+{
+}
+
+SvxChartColorTableItem::SvxChartColorTableItem( const SvxChartColorTableItem& rOther ) :
+ SfxPoolItem( rOther ),
+ m_aColorTable( rOther.m_aColorTable )
+{
+}
+
+SfxPoolItem* __EXPORT SvxChartColorTableItem::Clone( SfxItemPool * ) const
+{
+ return new SvxChartColorTableItem( *this );
+}
+
+int __EXPORT SvxChartColorTableItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "SvxChartColorTableItem::operator== : types differ" );
+
+ const SvxChartColorTableItem * rCTItem( dynamic_cast< const SvxChartColorTableItem * >( & rAttr ));
+ if( rCTItem )
+ {
+ return (this->m_aColorTable == rCTItem->GetColorTable());
+ }
+
+ return 0;
+}
+
+void __EXPORT SvxChartColorTableItem::SetOptions( SvxChartOptions* pOpts ) const
+{
+ if ( pOpts )
+ pOpts->SetDefaultColors( m_aColorTable );
+}
+
+
+SvxChartColorTable & SvxChartColorTableItem::GetColorTable()
+{
+ return m_aColorTable;
+}
+
+const SvxChartColorTable & SvxChartColorTableItem::GetColorTable() const
+{
+ return m_aColorTable;
+}
+
+void SvxChartColorTableItem::ReplaceColorByIndex( size_t _nIndex, const XColorEntry & _rEntry )
+{
+ m_aColorTable.replace( _nIndex, _rEntry );
+}
diff --git a/cui/source/options/cfgchart.hxx b/cui/source/options/cfgchart.hxx
new file mode 100644
index 000000000000..89f18e621cff
--- /dev/null
+++ b/cui/source/options/cfgchart.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * 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: cfgchart.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_CFGCHART_HXX
+#define _SVX_CFGCHART_HXX
+
+// header for TYPEINFO
+#include <tools/rtti.hxx>
+// header for ConfigItem
+#include <unotools/configitem.hxx>
+// header for SfxPoolItem
+#include <svl/poolitem.hxx>
+// header for XColorEntry
+#include <svx/xtable.hxx>
+
+#include <vector>
+
+class SvxChartColorTable
+{
+private:
+ ::std::vector< XColorEntry > m_aColorEntries;
+
+public:
+ SvxChartColorTable();
+ explicit SvxChartColorTable( const SvxChartColorTable & _rSource );
+
+ // accessors
+ size_t size() const;
+ const XColorEntry & operator[]( size_t _nIndex ) const;
+ ColorData getColorData( size_t _nIndex ) const;
+
+ // mutators
+ void clear();
+ void append( const XColorEntry & _rEntry );
+ void replace( size_t _nIndex, const XColorEntry & _rEntry );
+ void useDefault();
+
+ // comparison
+ bool operator==( const SvxChartColorTable & _rOther ) const;
+};
+
+// ====================
+// all options
+// ====================
+class SvxChartOptions : public ::utl::ConfigItem
+{
+private:
+ SvxChartColorTable maDefColors;
+ BOOL mbIsInitialized;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ maPropertyNames;
+
+ inline ::com::sun::star::uno::Sequence< ::rtl::OUString > GetPropertyNames() const
+ { return maPropertyNames; }
+ BOOL RetrieveOptions();
+
+public:
+ SvxChartOptions();
+ virtual ~SvxChartOptions();
+
+ const SvxChartColorTable& GetDefaultColors();
+ void SetDefaultColors( const SvxChartColorTable& aCol );
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames);
+};
+
+// ====================
+// items
+// ====================
+class SvxChartColorTableItem : public SfxPoolItem
+{
+public:
+ TYPEINFO();
+ SvxChartColorTableItem( USHORT nWhich, const SvxChartColorTable& );
+ SvxChartColorTableItem( const SvxChartColorTableItem& );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ void SetOptions( SvxChartOptions* pOpts ) const;
+
+ const SvxChartColorTable & GetColorTable() const ;
+ SvxChartColorTable & GetColorTable();
+ void ReplaceColorByIndex( size_t _nIndex, const XColorEntry & _rEntry );
+
+private:
+ SvxChartColorTable m_aColorTable;
+};
+
+#endif // _SVX_CFGCHART_HXX
+
diff --git a/cui/source/options/connpoolconfig.cxx b/cui/source/options/connpoolconfig.cxx
new file mode 100644
index 000000000000..79de982272f1
--- /dev/null
+++ b/cui/source/options/connpoolconfig.cxx
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: connpoolconfig.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "connpoolconfig.hxx"
+#include "connpoolsettings.hxx"
+
+#include "connpooloptions.hxx"
+#include <svl/itemset.hxx>
+#include <unotools/confignode.hxx>
+#include <comphelper/extract.hxx>
+#include <svl/eitem.hxx>
+#include <comphelper/processfactory.hxx>
+#include "sdbcdriverenum.hxx"
+
+#include <svx/svxids.hrc>
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ using namespace ::utl;
+ using namespace ::com::sun::star::uno;
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getConnectionPoolNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("org.openoffice.Office.DataAccess/ConnectionPool");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getEnablePoolingNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("EnablePooling");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getDriverSettingsNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("DriverSettings");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getDriverNameNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("DriverName");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getEnableNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Enable");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getTimeoutNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Timeout");
+ return s_sNodeName;
+ }
+
+ //====================================================================
+ //= ConnectionPoolConfig
+ //====================================================================
+ //--------------------------------------------------------------------
+ void ConnectionPoolConfig::GetOptions(SfxItemSet& _rFillItems)
+ {
+ // the config node where all pooling relevant info are stored under
+ OConfigurationTreeRoot aConnectionPoolRoot = OConfigurationTreeRoot::createWithServiceFactory(
+ ::comphelper::getProcessServiceFactory(), getConnectionPoolNodeName(), -1, OConfigurationTreeRoot::CM_READONLY);
+
+ // the global "enabled" flag
+ Any aEnabled = aConnectionPoolRoot.getNodeValue(getEnablePoolingNodeName());
+ sal_Bool bEnabled = sal_True;
+ aEnabled >>= bEnabled;
+ _rFillItems.Put(SfxBoolItem(SID_SB_POOLING_ENABLED, bEnabled));
+
+ // the settings for the single drivers
+ DriverPoolingSettings aSettings;
+ // first get all the drivers register at the driver manager
+ ODriverEnumeration aEnumDrivers;
+ for ( ODriverEnumeration::const_iterator aLoopDrivers = aEnumDrivers.begin();
+ aLoopDrivers != aEnumDrivers.end();
+ ++aLoopDrivers
+ )
+ {
+ aSettings.push_back(DriverPooling(*aLoopDrivers, sal_False, 120));
+ }
+
+ // then look for which of them settings are stored in the configuration
+ OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(getDriverSettingsNodeName());
+
+ Sequence< ::rtl::OUString > aDriverKeys = aDriverSettings.getNodeNames();
+ const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray();
+ const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
+ for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
+ {
+ // the name of the driver in this round
+ OConfigurationNode aThisDriverSettings = aDriverSettings.openNode(*pDriverKeys);
+ ::rtl::OUString sThisDriverName;
+ aThisDriverSettings.getNodeValue(getDriverNameNodeName()) >>= sThisDriverName;
+
+ // look if we (resp. the driver manager) know this driver
+ // doing O(n) search here, which is expensive, but this doesn't matter in this small case ...
+ DriverPoolingSettings::iterator aLookup;
+ for ( aLookup = aSettings.begin();
+ aLookup != aSettings.end();
+ ++aLookup
+ )
+ if (sThisDriverName.equals(aLookup->sName))
+ break;
+
+ if (aLookup == aSettings.end())
+ { // do not know the driver - add it
+ aSettings.push_back(DriverPooling(sThisDriverName, sal_False, 120));
+
+ // and the position of the new entry
+ aLookup = aSettings.end();
+ --aLookup;
+ }
+
+ // now fill this entry with the settings from the configuration
+ aThisDriverSettings.getNodeValue(getEnableNodeName()) >>= aLookup->bEnabled;
+ aThisDriverSettings.getNodeValue(getTimeoutNodeName()) >>= aLookup->nTimeoutSeconds;
+ }
+
+ _rFillItems.Put(DriverPoolingSettingsItem(SID_SB_DRIVER_TIMEOUTS, aSettings));
+ }
+
+ //--------------------------------------------------------------------
+ void ConnectionPoolConfig::SetOptions(const SfxItemSet& _rSourceItems)
+ {
+ // the config node where all pooling relevant info are stored under
+ OConfigurationTreeRoot aConnectionPoolRoot = OConfigurationTreeRoot::createWithServiceFactory(
+ ::comphelper::getProcessServiceFactory(), getConnectionPoolNodeName(), -1, OConfigurationTreeRoot::CM_UPDATABLE);
+
+ if (!aConnectionPoolRoot.isValid())
+ // already asserted by the OConfigurationTreeRoot
+ return;
+
+ sal_Bool bNeedCommit = sal_False;
+
+ // the global "enabled" flag
+ SFX_ITEMSET_GET( _rSourceItems, pEnabled, SfxBoolItem, SID_SB_POOLING_ENABLED, sal_True );
+ if (pEnabled)
+ {
+ sal_Bool bEnabled = pEnabled->GetValue();
+ aConnectionPoolRoot.setNodeValue(getEnablePoolingNodeName(), Any(&bEnabled, ::getBooleanCppuType()));
+ bNeedCommit = sal_True;
+ }
+
+ // the settings for the single drivers
+ SFX_ITEMSET_GET( _rSourceItems, pDriverSettings, DriverPoolingSettingsItem, SID_SB_DRIVER_TIMEOUTS, sal_True );
+ if (pDriverSettings)
+ {
+ OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(getDriverSettingsNodeName());
+ if (!aDriverSettings.isValid())
+ return;
+
+ ::rtl::OUString sThisDriverName;
+ OConfigurationNode aThisDriverSettings;
+
+ const DriverPoolingSettings& rNewSettings = pDriverSettings->getSettings();
+ for ( DriverPoolingSettings::const_iterator aLoop = rNewSettings.begin();
+ aLoop != rNewSettings.end();
+ ++aLoop
+ )
+ {
+ // need the name as ::rtl::OUString
+ sThisDriverName = aLoop->sName;
+
+ // the sub-node for this driver
+ if (aDriverSettings.hasByName(aLoop->sName))
+ aThisDriverSettings = aDriverSettings.openNode(aLoop->sName);
+ else
+ aThisDriverSettings = aDriverSettings.createNode(aLoop->sName);
+
+ // set the values
+ aThisDriverSettings.setNodeValue(getDriverNameNodeName(), makeAny(sThisDriverName));
+ aThisDriverSettings.setNodeValue(getEnableNodeName(), Any(&aLoop->bEnabled, ::getBooleanCppuType()));
+ aThisDriverSettings.setNodeValue(getTimeoutNodeName(), makeAny(aLoop->nTimeoutSeconds));
+ }
+ bNeedCommit = sal_True;
+ }
+ if (bNeedCommit)
+ aConnectionPoolRoot.commit();
+ }
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+
diff --git a/cui/source/options/connpoolconfig.hxx b/cui/source/options/connpoolconfig.hxx
new file mode 100644
index 000000000000..248dd16146f0
--- /dev/null
+++ b/cui/source/options/connpoolconfig.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * 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: connpoolconfig.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFAPP_CONNPOOLCONFIG_HXX_
+#define _OFFAPP_CONNPOOLCONFIG_HXX_
+
+class SfxItemSet;
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ //====================================================================
+ //= ConnectionPoolConfig
+ //====================================================================
+ class ConnectionPoolConfig
+ {
+
+ public:
+ static void GetOptions(SfxItemSet& _rFillItems);
+ static void SetOptions(const SfxItemSet& _rSourceItems);
+ };
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+#endif // _OFFAPP_CONNPOOLCONFIG_HXX_
+
+
diff --git a/cui/source/options/connpooloptions.cxx b/cui/source/options/connpooloptions.cxx
new file mode 100644
index 000000000000..de86053a1376
--- /dev/null
+++ b/cui/source/options/connpooloptions.cxx
@@ -0,0 +1,516 @@
+/*************************************************************************
+ *
+ * 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: connpooloptions.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+#include "connpooloptions.hxx"
+#ifndef _OFFAPP_CONNPOOLOPTIONS_HRC_
+#include "connpooloptions.hrc"
+#endif
+#include <svtools/editbrowsebox.hxx>
+#include <vcl/field.hxx>
+#include "connpoolsettings.hxx"
+#include <svl/eitem.hxx>
+
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include <svx/dialmgr.hxx>
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ //====================================================================
+ //= DriverListControl
+ //====================================================================
+ typedef ::svt::EditBrowseBox DriverListControl_Base;
+ class DriverListControl : public DriverListControl_Base
+ {
+ using Window::Update;
+ protected:
+ DriverPoolingSettings m_aSavedSettings;
+ DriverPoolingSettings m_aSettings;
+ DriverPoolingSettings::const_iterator m_aSeekRow;
+
+ String m_sYes;
+ String m_sNo;
+
+ Link m_aRowChangeHandler;
+
+ public:
+ DriverListControl( Window* _pParent, const ResId& _rId);
+
+ virtual void Init();
+ void Update(const DriverPoolingSettings& _rSettings);
+ virtual String GetCellText( long nRow, USHORT nColId ) const;
+
+ // the handler will be called with a DriverPoolingSettings::const_iterator as parameter,
+ // or NULL if no valid current row exists
+ void SetRowChangeHandler(const Link& _rHdl) { m_aRowChangeHandler = _rHdl; }
+ Link GetRowChangeHandler() const { return m_aRowChangeHandler; }
+
+ const DriverPooling* getCurrentRow() const;
+ DriverPooling* getCurrentRow();
+ void updateCurrentRow();
+
+ const DriverPoolingSettings& getSettings() const { return m_aSettings; }
+
+ void saveValue() { m_aSavedSettings = m_aSettings; }
+ sal_Bool isModified() const;
+
+ protected:
+ virtual void InitController( ::svt::CellControllerRef& rController, long nRow, USHORT nCol );
+ virtual ::svt::CellController* GetController( long nRow, USHORT nCol );
+
+ virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, USHORT nColId ) const;
+
+ virtual BOOL SeekRow( long nRow );
+ virtual BOOL SaveModified();
+
+ virtual sal_Bool IsTabAllowed(sal_Bool _bForward) const;
+
+ virtual void StateChanged( StateChangedType nStateChange );
+
+ virtual void CursorMoved();
+
+ protected:
+ virtual sal_uInt32 GetTotalCellWidth(long nRow, USHORT nColId);
+
+
+ private:
+ String implGetCellText(DriverPoolingSettings::const_iterator _rPos, sal_uInt16 _nColId) const;
+ };
+
+ //--------------------------------------------------------------------
+ DriverListControl::DriverListControl( Window* _pParent, const ResId& _rId)
+// :DriverListControl_Base(_pParent, _rId, DBBF_NOROWPICTURE, BROWSER_AUTO_VSCROLL | BROWSER_AUTO_HSCROLL | BROWSER_COLUMNSELECTION | BROWSER_HLINESFULL | BROWSER_VLINESFULL | BROWSER_HIDESELECT | BROWSER_CURSOR_WO_FOCUS)
+ :DriverListControl_Base(_pParent, _rId, EBBF_NOROWPICTURE, BROWSER_AUTO_VSCROLL | BROWSER_AUTO_HSCROLL | BROWSER_HIDECURSOR | BROWSER_AUTOSIZE_LASTCOL)
+ ,m_aSeekRow(m_aSettings.end())
+ ,m_sYes(ResId(STR_YES,*_rId.GetResMgr()))
+ ,m_sNo(ResId(STR_NO,*_rId.GetResMgr()))
+ {
+ SetStyle((GetStyle() & ~WB_HSCROLL) | WB_AUTOHSCROLL);
+
+ SetUniqueId(UID_OFA_CONNPOOL_DRIVERLIST_BACK);
+ GetDataWindow().SetHelpId(HID_OFA_CONNPOOL_DRIVERLIST);
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool DriverListControl::IsTabAllowed(sal_Bool /*_bForward*/) const
+ {
+ // no travinling within the fields via RETURN and TAB
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool DriverListControl::isModified() const
+ {
+ if (m_aSettings.size() != m_aSavedSettings.size())
+ return sal_True;
+
+ DriverPoolingSettings::const_iterator aCurrent = m_aSettings.begin();
+ DriverPoolingSettings::const_iterator aCurrentEnd = m_aSettings.end();
+ DriverPoolingSettings::const_iterator aSaved = m_aSavedSettings.begin();
+ for (;aCurrent != aCurrentEnd; ++aCurrent, ++aSaved)
+ {
+ if (*aCurrent != *aSaved)
+ return sal_True;
+ }
+
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::Init()
+ {
+ DriverListControl_Base::Init();
+
+ Size aColWidth = LogicToPixel(Size(160, 0), MAP_APPFONT);
+ InsertDataColumn(1, String(SVX_RES(STR_DRIVER_NAME)), aColWidth.Width());
+ aColWidth = LogicToPixel(Size(30, 0), MAP_APPFONT);
+ InsertDataColumn(2, String(SVX_RES(STR_POOLED_FLAG)), aColWidth.Width());
+ aColWidth = LogicToPixel(Size(60, 0), MAP_APPFONT);
+ InsertDataColumn(3, String(SVX_RES(STR_POOL_TIMEOUT)), aColWidth.Width());
+ // Attention: the resource of the string is local to the resource of the enclosing dialog!
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::CursorMoved()
+ {
+ DriverListControl_Base::CursorMoved();
+
+ // call the row change handler
+ if ( m_aRowChangeHandler.IsSet() )
+ {
+ if ( GetCurRow() >= 0 )
+ { // == -1 may happen in case the browse box has just been cleared
+ m_aRowChangeHandler.Call( getCurrentRow() );
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ const DriverPooling* DriverListControl::getCurrentRow() const
+ {
+ OSL_ENSURE( ( GetCurRow() < m_aSettings.size() ) && ( GetCurRow() >= 0 ),
+ "DriverListControl::getCurrentRow: invalid current row!");
+
+ if ( ( GetCurRow() >= 0 ) && ( GetCurRow() < m_aSettings.size() ) )
+ return &(*(m_aSettings.begin() + GetCurRow()));
+
+ return NULL;
+ }
+
+ //--------------------------------------------------------------------
+ DriverPooling* DriverListControl::getCurrentRow()
+ {
+ OSL_ENSURE( ( GetCurRow() < m_aSettings.size() ) && ( GetCurRow() >= 0 ),
+ "DriverListControl::getCurrentRow: invalid current row!");
+
+ if ( ( GetCurRow() >= 0 ) && ( GetCurRow() < m_aSettings.size() ) )
+ return &(*(m_aSettings.begin() + GetCurRow()));
+
+ return NULL;
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::updateCurrentRow()
+ {
+ Window::Invalidate( GetRowRectPixel( GetCurRow() ), INVALIDATE_UPDATE );
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::Update(const DriverPoolingSettings& _rSettings)
+ {
+ m_aSettings = _rSettings;
+
+ SetUpdateMode(sal_False);
+ RowRemoved(0, GetRowCount());
+ RowInserted(0, m_aSettings.size());
+ SetUpdateMode(sal_True);
+
+ ActivateCell(1, 0);
+ }
+
+ //--------------------------------------------------------------------
+ sal_uInt32 DriverListControl::GetTotalCellWidth(long nRow, USHORT nColId)
+ {
+ return GetDataWindow().GetTextWidth(GetCellText(nRow, nColId));
+ }
+
+ //--------------------------------------------------------------------
+ String DriverListControl::implGetCellText(DriverPoolingSettings::const_iterator _rPos, sal_uInt16 _nColId) const
+ {
+ OSL_ENSURE(_rPos < m_aSettings.end(), "DriverListControl::implGetCellText: invalid position!");
+
+ String sReturn;
+ switch (_nColId)
+ {
+ case 1:
+ sReturn = _rPos->sName;
+ break;
+ case 2:
+ sReturn = _rPos->bEnabled ? m_sYes : m_sNo;
+ break;
+ case 3:
+ if (_rPos->bEnabled)
+ sReturn = String::CreateFromInt32(_rPos->nTimeoutSeconds);
+ break;
+ default:
+ OSL_ENSURE(sal_False, "DriverListControl::implGetCellText: invalid column id!");
+ }
+ return sReturn;
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::StateChanged( StateChangedType nStateChange )
+ {
+ if (STATE_CHANGE_ENABLE == nStateChange)
+ Window::Invalidate(INVALIDATE_UPDATE);
+ DriverListControl_Base::StateChanged( nStateChange );
+ }
+
+ //--------------------------------------------------------------------
+ String DriverListControl::GetCellText( long nRow, USHORT nColId ) const
+ {
+ String sReturn;
+ if (nRow > m_aSettings.size())
+ {
+ OSL_ENSURE(sal_False, "DriverListControl::GetCellText: don't ask me for such rows!");
+ }
+ else
+ {
+ sReturn = implGetCellText(m_aSettings.begin() + nRow, nColId);
+ }
+ return sReturn;
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::InitController( ::svt::CellControllerRef& rController, long nRow, USHORT nCol )
+ {
+ rController->GetWindow().SetText(GetCellText(nRow, nCol));
+ }
+
+ //--------------------------------------------------------------------
+ ::svt::CellController* DriverListControl::GetController( long /*nRow*/, USHORT /*nCol*/ )
+ {
+ return NULL;
+ }
+
+ //--------------------------------------------------------------------
+ BOOL DriverListControl::SaveModified()
+ {
+ return TRUE;
+ }
+
+ //--------------------------------------------------------------------
+ BOOL DriverListControl::SeekRow( long _nRow )
+ {
+ DriverListControl_Base::SeekRow(_nRow);
+
+ if (_nRow < m_aSettings.size())
+ m_aSeekRow = m_aSettings.begin() + _nRow;
+ else
+ m_aSeekRow = m_aSettings.end();
+
+ return m_aSeekRow != m_aSettings.end();
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::PaintCell( OutputDevice& rDev, const Rectangle& rRect, USHORT nColId ) const
+ {
+ OSL_ENSURE(m_aSeekRow != m_aSettings.end(), "DriverListControl::PaintCell: invalid row!");
+
+ if (m_aSeekRow != m_aSettings.end())
+ {
+ rDev.SetClipRegion(rRect);
+
+ sal_uInt16 nStyle = TEXT_DRAW_CLIP;
+ if (!IsEnabled())
+ nStyle |= TEXT_DRAW_DISABLE;
+ switch (nColId)
+ {
+ case 1: nStyle |= TEXT_DRAW_LEFT; break;
+ case 2:
+ case 3: nStyle |= TEXT_DRAW_CENTER; break;
+ }
+
+ rDev.DrawText(rRect, implGetCellText(m_aSeekRow, nColId), nStyle);
+
+ rDev.SetClipRegion();
+ }
+ }
+
+ //====================================================================
+ //= ConnectionPoolOptionsPage
+ //====================================================================
+ //--------------------------------------------------------------------
+ ConnectionPoolOptionsPage::ConnectionPoolOptionsPage(Window* _pParent, const SfxItemSet& _rAttrSet)
+ :SfxTabPage(_pParent, SVX_RES(RID_OFAPAGE_CONNPOOLOPTIONS ), _rAttrSet)
+ ,m_aFrame (this, SVX_RES(FL_POOLING))
+ ,m_aEnablePooling (this, SVX_RES(CB_POOL_CONNS))
+ ,m_aDriversLabel (this, SVX_RES(FT_DRIVERS))
+ ,m_pDriverList(new DriverListControl(this, SVX_RES(CTRL_DRIVER_LIST)))
+ ,m_aDriverLabel (this, SVX_RES(FT_DRIVERLABEL))
+ ,m_aDriver (this, SVX_RES(FT_DRIVER))
+ ,m_aDriverPoolingEnabled(this, SVX_RES(CB_DRIVERPOOLING))
+ ,m_aTimeoutLabel (this, SVX_RES(FT_TIMEOUT))
+ ,m_aTimeout (this, SVX_RES(NF_TIMEOUT))
+ {
+ m_pDriverList->Init();
+ m_pDriverList->Show();
+
+ FreeResource();
+
+ m_aEnablePooling.SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
+ m_aDriverPoolingEnabled.SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
+
+ m_pDriverList->SetRowChangeHandler( LINK(this, ConnectionPoolOptionsPage, OnDriverRowChanged) );
+ }
+
+ //--------------------------------------------------------------------
+ SfxTabPage* ConnectionPoolOptionsPage::Create(Window* _pParent, const SfxItemSet& _rAttrSet)
+ {
+ return new ConnectionPoolOptionsPage(_pParent, _rAttrSet);
+ }
+
+ //--------------------------------------------------------------------
+ ConnectionPoolOptionsPage::~ConnectionPoolOptionsPage()
+ {
+ delete m_pDriverList;
+ }
+
+ //--------------------------------------------------------------------
+ void ConnectionPoolOptionsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bFromReset*/)
+ {
+ // the enabled flag
+ SFX_ITEMSET_GET( _rSet, pEnabled, SfxBoolItem, SID_SB_POOLING_ENABLED, sal_True );
+ OSL_ENSURE(pEnabled, "ConnectionPoolOptionsPage::implInitControls: missing the Enabled item!");
+ m_aEnablePooling.Check(pEnabled ? pEnabled->GetValue() : sal_True);
+
+ m_aEnablePooling.SaveValue();
+
+ // the settings for the single drivers
+ SFX_ITEMSET_GET( _rSet, pDriverSettings, DriverPoolingSettingsItem, SID_SB_DRIVER_TIMEOUTS, sal_True );
+ if (pDriverSettings)
+ m_pDriverList->Update(pDriverSettings->getSettings());
+ else
+ {
+ OSL_ENSURE(sal_False, "ConnectionPoolOptionsPage::implInitControls: missing the DriverTimeouts item!");
+ m_pDriverList->Update(DriverPoolingSettings());
+ }
+ m_pDriverList->saveValue();
+
+ // reflect the new settings
+ OnEnabledDisabled(&m_aEnablePooling);
+ }
+
+ //--------------------------------------------------------------------
+ long ConnectionPoolOptionsPage::Notify( NotifyEvent& _rNEvt )
+ {
+ if (EVENT_LOSEFOCUS == _rNEvt.GetType())
+ if (m_aTimeout.IsWindowOrChild(_rNEvt.GetWindow()))
+ commitTimeoutField();
+
+ return SfxTabPage::Notify(_rNEvt);
+ }
+
+ //--------------------------------------------------------------------
+ BOOL ConnectionPoolOptionsPage::FillItemSet(SfxItemSet& _rSet)
+ {
+ commitTimeoutField();
+
+ sal_Bool bModified = sal_False;
+ // the enabled flag
+ if (m_aEnablePooling.GetSavedValue() != m_aEnablePooling.IsChecked())
+ {
+ _rSet.Put(SfxBoolItem(SID_SB_POOLING_ENABLED, m_aEnablePooling.IsChecked()), SID_SB_POOLING_ENABLED);
+ bModified = sal_True;
+ }
+
+ // the settings for the single drivers
+ if (m_pDriverList->isModified())
+ {
+ _rSet.Put(DriverPoolingSettingsItem(SID_SB_DRIVER_TIMEOUTS, m_pDriverList->getSettings()), SID_SB_DRIVER_TIMEOUTS);
+ bModified = sal_True;
+ }
+
+ return bModified;
+ }
+
+ //--------------------------------------------------------------------
+ void ConnectionPoolOptionsPage::ActivatePage( const SfxItemSet& _rSet)
+ {
+ SfxTabPage::ActivatePage(_rSet);
+ implInitControls(_rSet, sal_False);
+ }
+
+ //--------------------------------------------------------------------
+ void ConnectionPoolOptionsPage::Reset(const SfxItemSet& _rSet)
+ {
+ implInitControls(_rSet, sal_True);
+ }
+
+ //--------------------------------------------------------------------
+ IMPL_LINK( ConnectionPoolOptionsPage, OnDriverRowChanged, const void*, _pRowIterator )
+ {
+ sal_Bool bValidRow = (NULL != _pRowIterator);
+ m_aDriverPoolingEnabled.Enable(bValidRow && m_aEnablePooling.IsChecked());
+ m_aTimeoutLabel.Enable(bValidRow);
+ m_aTimeout.Enable(bValidRow);
+
+ if (!bValidRow)
+ { // positioned on an invalid row
+ m_aDriver.SetText(String());
+ }
+ else
+ {
+ const DriverPooling *pDriverPos = static_cast<const DriverPooling*>(_pRowIterator);
+
+ m_aDriver.SetText(pDriverPos->sName);
+ m_aDriverPoolingEnabled.Check(pDriverPos->bEnabled);
+ m_aTimeout.SetText(String::CreateFromInt32(pDriverPos->nTimeoutSeconds));
+
+ OnEnabledDisabled(&m_aDriverPoolingEnabled);
+ }
+
+ return 0L;
+ }
+
+ //--------------------------------------------------------------------
+ void ConnectionPoolOptionsPage::commitTimeoutField()
+ {
+ if (DriverPooling* pCurrentDriver = m_pDriverList->getCurrentRow())
+ {
+ pCurrentDriver->nTimeoutSeconds = static_cast<long>(m_aTimeout.GetValue());
+ m_pDriverList->updateCurrentRow();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ IMPL_LINK( ConnectionPoolOptionsPage, OnEnabledDisabled, const CheckBox*, _pCheckBox )
+ {
+ sal_Bool bGloballyEnabled = m_aEnablePooling.IsChecked();
+ sal_Bool bLocalDriverChanged = &m_aDriverPoolingEnabled == _pCheckBox;
+
+ if (&m_aEnablePooling == _pCheckBox)
+ {
+ m_aDriversLabel.Enable(bGloballyEnabled);
+ m_pDriverList->Enable(bGloballyEnabled);
+ m_aDriverLabel.Enable(bGloballyEnabled);
+ m_aDriver.Enable(bGloballyEnabled);
+ m_aDriverPoolingEnabled.Enable(bGloballyEnabled);
+ }
+ else
+ OSL_ENSURE(bLocalDriverChanged, "ConnectionPoolOptionsPage::OnEnabledDisabled: where did this come from?");
+
+ m_aTimeoutLabel.Enable(bGloballyEnabled && m_aDriverPoolingEnabled.IsChecked());
+ m_aTimeout.Enable(bGloballyEnabled && m_aDriverPoolingEnabled.IsChecked());
+
+ if (bLocalDriverChanged)
+ {
+ // update the list
+ m_pDriverList->getCurrentRow()->bEnabled = m_aDriverPoolingEnabled.IsChecked();
+ m_pDriverList->updateCurrentRow();
+ }
+
+ return 0L;
+ }
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+
diff --git a/cui/source/options/connpooloptions.hrc b/cui/source/options/connpooloptions.hrc
new file mode 100644
index 000000000000..89f3ae64e1f8
--- /dev/null
+++ b/cui/source/options/connpooloptions.hrc
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * 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: connpooloptions.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFAPP_CONNPOOLOPTIONS_HRC_
+#define _OFFAPP_CONNPOOLOPTIONS_HRC_
+
+#define FL_POOLING 1
+#define CB_POOL_CONNS 2
+#define FT_DRIVERS 3
+#define CTRL_DRIVER_LIST 4
+#define FT_DRIVERLABEL 5
+#define FT_DRIVER 6
+#define CB_DRIVERPOOLING 7
+#define FT_TIMEOUT 8
+#define NF_TIMEOUT 9
+
+#define STR_DRIVER_NAME 1
+#define STR_POOLED_FLAG 2
+#define STR_POOL_TIMEOUT 3
+#define STR_YES 4
+#define STR_NO 5
+
+#endif // _OFFAPP_CONNPOOLOPTIONS_HRC_
+
+
diff --git a/cui/source/options/connpooloptions.hxx b/cui/source/options/connpooloptions.hxx
new file mode 100644
index 000000000000..b2b40354f433
--- /dev/null
+++ b/cui/source/options/connpooloptions.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * 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: connpooloptions.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFAPP_CONNPOOLOPTIONS_HXX_
+#define _OFFAPP_CONNPOOLOPTIONS_HXX_
+
+#include <svl/solar.hrc>
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <svx/databaseregistrationui.hxx>
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ //====================================================================
+ //= ConnectionPoolOptionsPage
+ //====================================================================
+ class DriverListControl;
+ class ConnectionPoolOptionsPage : public SfxTabPage
+ {
+ using TabPage::ActivatePage;
+
+ protected:
+ FixedLine m_aFrame;
+ CheckBox m_aEnablePooling;
+ FixedText m_aDriversLabel;
+ DriverListControl* m_pDriverList;
+ FixedText m_aDriverLabel;
+ FixedText m_aDriver;
+ CheckBox m_aDriverPoolingEnabled;
+ FixedText m_aTimeoutLabel;
+ NumericField m_aTimeout;
+
+ protected:
+ ConnectionPoolOptionsPage(Window* _pParent, const SfxItemSet& _rAttrSet);
+
+ public:
+ static SfxTabPage* Create(Window* _pParent, const SfxItemSet& _rAttrSet);
+
+ ~ConnectionPoolOptionsPage();
+
+ protected:
+ virtual long Notify( NotifyEvent& _rNEvt );
+
+ virtual BOOL FillItemSet(SfxItemSet& _rSet);
+ virtual void Reset(const SfxItemSet& _rSet);
+ virtual void ActivatePage( const SfxItemSet& _rSet);
+
+ protected:
+ DECL_LINK( OnEnabledDisabled, const CheckBox* );
+ DECL_LINK( OnDriverRowChanged, const void* );
+
+ void implInitControls(const SfxItemSet& _rSet, sal_Bool _bFromReset);
+
+ void commitTimeoutField();
+ };
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+#endif // _OFFAPP_CONNPOOLOPTIONS_HXX_
+
+
diff --git a/cui/source/options/connpooloptions.src b/cui/source/options/connpooloptions.src
new file mode 100644
index 000000000000..9218efda609a
--- /dev/null
+++ b/cui/source/options/connpooloptions.src
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * 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: connpooloptions.src,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "connpooloptions.hrc"
+#include <svx/dialogs.hrc>
+
+#define PAGE_SIZE_X 260
+#define PAGE_SIZE_Y 185
+
+#define LIST_SIZE_Y 100
+
+TabPage RID_OFAPAGE_CONNPOOLOPTIONS
+{
+ // HelpId = ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( PAGE_SIZE_X, PAGE_SIZE_Y ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+
+ FixedLine FL_POOLING
+ {
+ Pos = MAP_APPFONT( 4, 3 );
+ Size = MAP_APPFONT( PAGE_SIZE_X - 8, 8 );
+ Text [ en-US ] = "Connection pool";
+ };
+ CheckBox CB_POOL_CONNS
+ {
+ Pos = MAP_APPFONT( 7, 15 );
+ Size = MAP_APPFONT( PAGE_SIZE_X - 14, 10 );
+ Text [ en-US ] = "Connection pooling enabled";
+ };
+ FixedText FT_DRIVERS
+ {
+ Pos = MAP_APPFONT( 17, 28 );
+ Size = MAP_APPFONT( PAGE_SIZE_X - 14 - 8, 8 );
+ Text [ en-US ] = "Drivers known in %PRODUCTNAME";
+ };
+ Control CTRL_DRIVER_LIST
+ {
+ Pos = MAP_APPFONT( 17, 39 );
+ Size = MAP_APPFONT( PAGE_SIZE_X - 14 - 8, LIST_SIZE_Y );
+ TabStop = TRUE;
+ Border = TRUE;
+ SVLook = TRUE;
+ };
+ FixedText FT_DRIVERLABEL
+ {
+ Pos = MAP_APPFONT( 17, 39 + LIST_SIZE_Y + 4 );
+ Size = MAP_APPFONT( 70, 8 );
+ Text [ en-US ] = "Current driver:";
+ };
+ FixedText FT_DRIVER
+ {
+ Pos = MAP_APPFONT( 17 + 70 + 3, 39 + LIST_SIZE_Y + 4 );
+ Size = MAP_APPFONT( PAGE_SIZE_X - ( 15 + 70 + 3 ) - 7, 8 );
+ };
+ CheckBox CB_DRIVERPOOLING
+ {
+ Pos = MAP_APPFONT( 17, 39 + LIST_SIZE_Y + 4 + 8 + 3 );
+ Size = MAP_APPFONT( PAGE_SIZE_X - 23, 10 );
+ Text [ en-US ] = "Enable pooling for this driver";
+ };
+ FixedText FT_TIMEOUT
+ {
+ Pos = MAP_APPFONT( 27, 39 + LIST_SIZE_Y + 4 + 8 + 3 + 10 + 3 + 2 );
+ Size = MAP_APPFONT( 100, 8 );
+ Text [ en-US ] = "Timeout (seconds)";
+ };
+ NumericField NF_TIMEOUT
+ {
+ Pos = MAP_APPFONT( 27 + 100 + 3, 39 + LIST_SIZE_Y + 4 + 8 + 3 + 10 + 3 );
+ Size = MAP_APPFONT( 40, 12 );
+ SvLook = TRUE;
+ Border = TRUE;
+ Right = TRUE;
+ Spin = TRUE;
+ Repeat = TRUE;
+ Minimum = 30;
+ Maximum = 600;
+ StrictFormat = TRUE;
+ DecimalDigits = 0;
+ SpinSize = 1;
+ };
+
+ String STR_DRIVER_NAME
+ {
+ Text [ en-US ] = "Driver name";
+ };
+ String STR_POOLED_FLAG
+ {
+ Text [ en-US ] = "Pool";
+ };
+ String STR_POOL_TIMEOUT
+ {
+ Text [ en-US ] = "Timeout";
+ };
+ String STR_YES
+ {
+ Text [ en-US ] = "Yes";
+ };
+ String STR_NO
+ {
+ Text [ en-US ] = "No";
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/connpoolsettings.cxx b/cui/source/options/connpoolsettings.cxx
new file mode 100644
index 000000000000..03951a4ee271
--- /dev/null
+++ b/cui/source/options/connpoolsettings.cxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * 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: connpoolsettings.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+#include "connpoolsettings.hxx"
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ //====================================================================
+ //= DriverPooling
+ //====================================================================
+ //--------------------------------------------------------------------
+ DriverPooling::DriverPooling()
+ :bEnabled(sal_False)
+ ,nTimeoutSeconds(0)
+ {
+ }
+
+ //--------------------------------------------------------------------
+ DriverPooling::DriverPooling( const String& _rName, sal_Bool _bEnabled, const sal_Int32 _nTimeout )
+ :sName(_rName)
+ ,bEnabled(_bEnabled)
+ ,nTimeoutSeconds(_nTimeout)
+ {
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool DriverPooling::operator == (const DriverPooling& _rR) const
+ {
+ return (sName == _rR.sName)
+ && (bEnabled == _rR.bEnabled)
+ && (nTimeoutSeconds == _rR.nTimeoutSeconds);
+ }
+
+ //====================================================================
+ //= DriverPoolingSettings
+ //====================================================================
+ //--------------------------------------------------------------------
+ DriverPoolingSettings::DriverPoolingSettings()
+ {
+ }
+
+ //====================================================================
+ //= DriverPoolingSettingsItem
+ //====================================================================
+ TYPEINIT1( DriverPoolingSettingsItem, SfxPoolItem )
+ //--------------------------------------------------------------------
+ DriverPoolingSettingsItem::DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings _rSettings )
+ :SfxPoolItem(_nId)
+ ,m_aSettings(_rSettings)
+ {
+ }
+
+ //--------------------------------------------------------------------
+ int DriverPoolingSettingsItem::operator==( const SfxPoolItem& _rCompare ) const
+ {
+ const DriverPoolingSettingsItem* pItem = PTR_CAST(DriverPoolingSettingsItem, &_rCompare);
+ if (!pItem)
+ return sal_False;
+
+ if (m_aSettings.size() != pItem->m_aSettings.size())
+ return sal_False;
+
+ DriverPoolingSettings::const_iterator aOwn = m_aSettings.begin();
+ DriverPoolingSettings::const_iterator aOwnEnd = m_aSettings.end();
+ DriverPoolingSettings::const_iterator aForeign = pItem->m_aSettings.begin();
+ while (aOwn < aOwnEnd)
+ {
+ if (*aOwn != *aForeign)
+ return sal_False;
+
+ ++aForeign;
+ ++aOwn;
+ }
+
+ return sal_True;
+ }
+
+ //--------------------------------------------------------------------
+ SfxPoolItem* DriverPoolingSettingsItem::Clone( SfxItemPool * ) const
+ {
+ return new DriverPoolingSettingsItem(Which(), m_aSettings);
+ }
+
+ //--------------------------------------------------------------------
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+
diff --git a/cui/source/options/connpoolsettings.hxx b/cui/source/options/connpoolsettings.hxx
new file mode 100644
index 000000000000..085732a6db74
--- /dev/null
+++ b/cui/source/options/connpoolsettings.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * 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: connpoolsettings.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFAPP_CONNPOOLSETTINGS_HXX_
+#define _OFFAPP_CONNPOOLSETTINGS_HXX_
+
+#include <tools/string.hxx>
+#include <comphelper/stl_types.hxx>
+#include <svl/poolitem.hxx>
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ //====================================================================
+ //= DriverPooling
+ //====================================================================
+ struct DriverPooling
+ {
+ String sName;
+ sal_Bool bEnabled;
+ sal_Int32 nTimeoutSeconds;
+
+ DriverPooling();
+ DriverPooling( const String& _rName, sal_Bool _bEnabled, const sal_Int32 _nTimeout );
+
+ sal_Bool operator == (const DriverPooling& _rR) const;
+ sal_Bool operator != (const DriverPooling& _rR) const { return !operator ==(_rR); }
+ };
+
+ //====================================================================
+ //= DriverPoolingSettings
+ //====================================================================
+ class DriverPoolingSettings
+ {
+ protected:
+ DECLARE_STL_VECTOR( DriverPooling, DriverSettings );
+ DriverSettings m_aDrivers;
+
+ public:
+ typedef ConstDriverSettingsIterator const_iterator;
+ typedef DriverSettingsIterator iterator;
+
+ public:
+ DriverPoolingSettings();
+
+ sal_Int32 size() const { return m_aDrivers.size(); }
+
+ const_iterator begin() const { return m_aDrivers.begin(); }
+ const_iterator end() const { return m_aDrivers.end(); }
+
+ iterator begin() { return m_aDrivers.begin(); }
+ iterator end() { return m_aDrivers.end(); }
+
+ void push_back(const DriverPooling& _rElement) { m_aDrivers.push_back(_rElement); }
+ };
+
+ //====================================================================
+ //= DriverPoolingSettingsItem
+ //====================================================================
+ class DriverPoolingSettingsItem : public SfxPoolItem
+ {
+ protected:
+ DriverPoolingSettings m_aSettings;
+
+ public:
+ TYPEINFO();
+
+ DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings _rSettings );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ const DriverPoolingSettings& getSettings() const { return m_aSettings; }
+ };
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+#endif // _OFFAPP_CONNPOOLSETTINGS_HXX_
+
+
diff --git a/cui/source/options/cuisrchdlg.cxx b/cui/source/options/cuisrchdlg.cxx
new file mode 100644
index 000000000000..cc9d4ab740dc
--- /dev/null
+++ b/cui/source/options/cuisrchdlg.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * 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: cuisrchdlg.cxx,v $
+ * $Revision: 1.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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <vcl/wrkwin.hxx>
+#include <vcl/morebtn.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/slstitm.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/style.hxx>
+#include <unotools/searchopt.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svl/cjkoptions.hxx>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+
+#define _CUI_SRCHDLG_CXX
+#include "cuisrchdlg.hxx"
+
+#include <svx/dialogs.hrc>
+#include <svx/svxitems.hrc>
+
+#define ITEMID_SETITEM 0
+
+#include <sfx2/srchitem.hxx>
+#include <svx/pageitem.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dlgutil.hxx>
+#include <optjsearch.hxx>
+#include <svx/brshitem.hxx>
+#include "backgrnd.hxx"
+
+
+// class SvxJSearchOptionsDialog -----------------------------------------
+
+SvxJSearchOptionsDialog::SvxJSearchOptionsDialog(
+ Window *pParent,
+ const SfxItemSet& rOptionsSet, USHORT /*nUniqueId*/, INT32 nInitialFlags ) :
+ SfxSingleTabDialog ( pParent, rOptionsSet, RID_SVXPAGE_JSEARCH_OPTIONS ),
+ nInitialTlFlags( nInitialFlags )
+{
+ pPage = (SvxJSearchOptionsPage *)
+ SvxJSearchOptionsPage::Create( this, rOptionsSet );
+ SetTabPage( pPage ); //! implicitly calls pPage->Reset(...)!
+ pPage->EnableSaveOptions( FALSE );
+}
+
+
+SvxJSearchOptionsDialog::~SvxJSearchOptionsDialog()
+{
+ // pPage will be implicitly destroyed by the
+ // SfxSingleTabDialog destructor
+}
+
+
+void SvxJSearchOptionsDialog::Activate()
+{
+ pPage->SetTransliterationFlags( nInitialTlFlags );
+}
+
+
+INT32 SvxJSearchOptionsDialog::GetTransliterationFlags() const
+{
+ return pPage->GetTransliterationFlags();
+}
+
+
+void SvxJSearchOptionsDialog::SetTransliterationFlags( INT32 nSettings )
+{
+ pPage->SetTransliterationFlags( nSettings );
+}
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
new file mode 100644
index 000000000000..5ab8a0e2a0d1
--- /dev/null
+++ b/cui/source/options/dbregister.cxx
@@ -0,0 +1,512 @@
+/*************************************************************************
+ *
+ * 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: dbregister.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "dbregister.hxx"
+#include "dbregister.hrc"
+#include "dbregistersettings.hxx"
+#include "connpooloptions.hxx"
+#include <svl/filenotation.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+#include "helpid.hrc"
+#include <svtools/editbrowsebox.hxx>
+#include <svx/dialogs.hrc>
+#include <vcl/field.hxx>
+#include <svl/eitem.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <vcl/msgbox.hxx>
+#include <svtools/svtabbx.hxx>
+#include <svl/itemset.hxx>
+#include "doclinkdialog.hxx"
+#include <tools/urlobj.hxx>
+#include <unotools/localfilehelper.hxx>
+#include "optHeaderTabListbox.hxx"
+#include <sfx2/docfilt.hxx>
+#include <svx/dialmgr.hxx>
+#include "dbregisterednamesconfig.hxx"
+
+#define TAB_WIDTH1 80
+#define TAB_WIDTH_MIN 10
+#define TAB_WIDTH2 1000
+#define ITEMID_TYPE 1
+#define ITEMID_PATH 2
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::uno;
+using namespace ::svt;
+
+// class RegistrationItemSetHolder -------------------------------------------------
+
+RegistrationItemSetHolder::RegistrationItemSetHolder( const SfxItemSet& _rMasterSet )
+ :m_aRegistrationItems( _rMasterSet )
+{
+ DbRegisteredNamesConfig::GetOptions( m_aRegistrationItems );
+}
+
+RegistrationItemSetHolder::~RegistrationItemSetHolder()
+{
+}
+
+// class DatabaseRegistrationDialog ------------------------------------------------
+
+DatabaseRegistrationDialog::DatabaseRegistrationDialog( Window* pParent, const SfxItemSet& rInAttrs )
+ :RegistrationItemSetHolder( rInAttrs )
+ ,SfxSingleTabDialog( pParent, getRegistrationItems(), RID_SFXPAGE_DBREGISTER )
+{
+ SfxTabPage* page = DbRegistrationOptionsPage::Create( this, getRegistrationItems() );
+
+ SetTabPage( page );
+ SetText( page->GetText() );
+}
+
+DatabaseRegistrationDialog::~DatabaseRegistrationDialog()
+{
+}
+
+short DatabaseRegistrationDialog::Execute()
+{
+ short result = SfxSingleTabDialog::Execute();
+ if ( result == RET_OK )
+ {
+ DBG_ASSERT( GetOutputItemSet(), "DatabaseRegistrationDialog::Execute: no output items!" );
+ if ( GetOutputItemSet() )
+ DbRegisteredNamesConfig::SetOptions( *GetOutputItemSet() );
+ }
+ return result;
+}
+
+// class DbRegistrationOptionsPage --------------------------------------------------
+
+DbRegistrationOptionsPage::DbRegistrationOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SFXPAGE_DBREGISTER), rSet ),
+
+ aTypeText ( this, SVX_RES( FT_TYPE ) ),
+ aPathText ( this, SVX_RES( FT_PATH ) ),
+ aPathCtrl ( this, SVX_RES( LB_PATH ) ),
+ m_aNew ( this, SVX_RES( BTN_NEW ) ),
+ m_aEdit ( this, SVX_RES( BTN_EDIT ) ),
+ m_aDelete ( this, SVX_RES( BTN_DELETE ) ),
+ aStdBox ( this, SVX_RES( GB_STD ) ),
+ pHeaderBar ( NULL ),
+ pPathBox ( NULL ),
+ m_pCurEntry ( NULL ),
+ m_nOldCount ( 0 ),
+ m_bModified ( FALSE )
+{
+ m_aNew.SetClickHdl( LINK( this, DbRegistrationOptionsPage, NewHdl ) );
+ m_aEdit.SetClickHdl( LINK( this, DbRegistrationOptionsPage, EditHdl ) );
+ m_aDelete.SetClickHdl( LINK( this, DbRegistrationOptionsPage, DeleteHdl ) );
+
+ Size aBoxSize = aPathCtrl.GetOutputSizePixel();
+
+
+ WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP;
+ pPathBox = new ::svx::OptHeaderTabListBox( &aPathCtrl, nBits );
+
+ pHeaderBar = new HeaderBar( &aPathCtrl, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
+ pHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( aBoxSize.Width(), 16 ) );
+ pHeaderBar->SetSelectHdl( LINK( this, DbRegistrationOptionsPage, HeaderSelect_Impl ) );
+ pHeaderBar->SetEndDragHdl( LINK( this, DbRegistrationOptionsPage, HeaderEndDrag_Impl ) );
+ Size aSz;
+ aSz.Width() = TAB_WIDTH1;
+ pHeaderBar->InsertItem( ITEMID_TYPE, aTypeText.GetText(),
+ LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(),
+ HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_UPARROW );
+ aSz.Width() = TAB_WIDTH2;
+ pHeaderBar->InsertItem( ITEMID_PATH, aPathText.GetText(),
+ LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(),
+ HIB_LEFT | HIB_VCENTER );
+
+ static long nTabs[] = {3, 0, TAB_WIDTH1, TAB_WIDTH1 + TAB_WIDTH2 };
+ Size aHeadSize = pHeaderBar->GetSizePixel();
+
+ aPathCtrl.SetFocusControl( pPathBox );
+ pPathBox->SetWindowBits( nBits );
+ pPathBox->SetDoubleClickHdl( LINK( this, DbRegistrationOptionsPage, EditHdl ) );
+ pPathBox->SetSelectHdl( LINK( this, DbRegistrationOptionsPage, PathSelect_Impl ) );
+ pPathBox->SetSelectionMode( SINGLE_SELECTION );
+ pPathBox->SetPosSizePixel( Point( 0, aHeadSize.Height() ),
+ Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
+ pPathBox->SetTabs( &nTabs[0], MAP_APPFONT );
+ pPathBox->InitHeaderBar( pHeaderBar );
+ pPathBox->SetHighlightRange();
+
+ pPathBox->SetHelpId( HID_DBPATH_CTL_PATH );
+ pHeaderBar->SetHelpId( HID_DBPATH_HEADERBAR );
+
+ pPathBox->Show();
+ pHeaderBar->Show();
+
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+DbRegistrationOptionsPage::~DbRegistrationOptionsPage()
+{
+ // #110603# do not grab focus to a destroyed window !!!
+ aPathCtrl.SetFocusControl( NULL );
+
+ pHeaderBar->Hide();
+ for ( USHORT i = 0; i < pPathBox->GetEntryCount(); ++i )
+ delete static_cast<String*>(pPathBox->GetEntry(i)->GetUserData());
+ delete pPathBox;
+ delete pHeaderBar;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* DbRegistrationOptionsPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new DbRegistrationOptionsPage( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL DbRegistrationOptionsPage::FillItemSet( SfxItemSet& rCoreSet )
+{
+ // the settings for the single drivers
+ sal_Bool bModified = sal_False;
+ TNameLocationMap aMap;
+ ULONG nCount = pPathBox->GetEntryCount();
+ for ( ULONG i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = pPathBox->GetEntry(i);
+ String* pPath = static_cast<String*>(pEntry->GetUserData());
+ if ( pPath && pPath->Len() )
+ {
+ OFileNotation aTransformer(*pPath);
+ aMap.insert(TNameLocationMap::value_type(::rtl::OUString(pPathBox->GetEntryText(pEntry,0)),aTransformer.get(OFileNotation::N_URL)));
+ }
+ }
+ if ( m_nOldCount != aMap.size() || m_bModified )
+ {
+ rCoreSet.Put(DatabaseMapItem(SID_SB_DB_REGISTER, aMap), SID_SB_DB_REGISTER);
+ bModified = sal_True;
+ }
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void DbRegistrationOptionsPage::Reset( const SfxItemSet& rSet )
+{
+ // the settings for the single drivers
+ SFX_ITEMSET_GET( rSet, pSettings, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True );
+
+ if ( pSettings )
+ {
+ // TabListBox f"ullen
+ pPathBox->Clear();
+
+ const TNameLocationMap& rMap = pSettings->getSettings();
+ m_nOldCount = rMap.size();
+ TNameLocationMap::const_iterator aIter = rMap.begin();
+ TNameLocationMap::const_iterator aEnd = rMap.end();
+ for (; aIter != aEnd; ++aIter)
+ {
+ OFileNotation aTransformer(aIter->second);
+ insertNewEntry(aIter->first,aTransformer.get(OFileNotation::N_SYSTEM));
+ }
+
+ String aUserData = GetUserData();
+
+ if ( aUserData.Len() )
+ {
+ // Spaltenbreite restaurieren
+ pHeaderBar->SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() );
+ HeaderEndDrag_Impl( NULL );
+ // Sortierrichtung restaurieren
+ BOOL bUp = (BOOL)(USHORT)aUserData.GetToken(1).ToInt32();
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
+
+ if ( bUp )
+ {
+ nBits &= ~HIB_UPARROW;
+ nBits |= HIB_DOWNARROW;
+ }
+ else
+ {
+ nBits &= ~HIB_DOWNARROW;
+ nBits |= HIB_UPARROW;
+ }
+ pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
+ HeaderSelect_Impl( NULL );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DbRegistrationOptionsPage::FillUserData()
+{
+ String aUserData = String::CreateFromInt32( pHeaderBar->GetItemSize( ITEMID_TYPE ) );
+ aUserData += ';';
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits( ITEMID_TYPE );
+ BOOL bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
+ aUserData += bUp ? '1' : '0';
+ SetUserData( aUserData );
+}
+// -----------------------------------------------------------------------
+
+IMPL_LINK( DbRegistrationOptionsPage, DeleteHdl, void *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = pPathBox->FirstSelected();
+ if ( pEntry )
+ {
+ QueryBox aQuery(this,SVX_RES(QUERY_DELETE_CONFIRM));
+ if ( aQuery.Execute() == RET_YES )
+ pPathBox->GetModel()->Remove(pEntry);
+ }
+ return 0;
+}
+// -----------------------------------------------------------------------
+IMPL_LINK( DbRegistrationOptionsPage, NewHdl, void *, EMPTYARG )
+{
+ String sNewName,sNewLocation;
+ openLinkDialog(sNewName,sNewLocation);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( DbRegistrationOptionsPage, EditHdl, void *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = pPathBox->GetCurEntry();
+ if ( pEntry )
+ {
+ String* pOldLocation = static_cast<String*>(pEntry->GetUserData());
+ String sOldName = pPathBox->GetEntryText(pEntry,0);
+ m_pCurEntry = pEntry;
+ openLinkDialog(sOldName,*pOldLocation,pEntry);
+ m_pCurEntry = NULL;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( DbRegistrationOptionsPage, HeaderSelect_Impl, HeaderBar*, pBar )
+{
+ if ( pBar && pBar->GetCurItemId() != ITEMID_TYPE )
+ return 0;
+
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
+ BOOL bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
+ SvSortMode eMode = SortAscending;
+
+ if ( bUp )
+ {
+ nBits &= ~HIB_UPARROW;
+ nBits |= HIB_DOWNARROW;
+ eMode = SortDescending;
+ }
+ else
+ {
+ nBits &= ~HIB_DOWNARROW;
+ nBits |= HIB_UPARROW;
+ }
+ pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
+ SvTreeList* pModel = pPathBox->GetModel();
+ pModel->SetSortMode( eMode );
+ pModel->Resort();
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( DbRegistrationOptionsPage, HeaderEndDrag_Impl, HeaderBar*, pBar )
+{
+ if ( pBar && !pBar->GetCurItemId() )
+ return 0;
+
+ if ( !pHeaderBar->IsItemMode() )
+ {
+ Size aSz;
+ USHORT nTabs = pHeaderBar->GetItemCount();
+ long nTmpSz = 0;
+ long nWidth = pHeaderBar->GetItemSize(ITEMID_TYPE);
+ long nBarWidth = pHeaderBar->GetSizePixel().Width();
+
+ if(nWidth < TAB_WIDTH_MIN)
+ pHeaderBar->SetItemSize( ITEMID_TYPE, TAB_WIDTH_MIN);
+ else if ( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN )
+ pHeaderBar->SetItemSize( ITEMID_TYPE, nBarWidth - TAB_WIDTH_MIN );
+
+ for ( USHORT i = 1; i <= nTabs; ++i )
+ {
+ long _nWidth = pHeaderBar->GetItemSize(i);
+ aSz.Width() = _nWidth + nTmpSz;
+ nTmpSz += _nWidth;
+ pPathBox->SetTab( i, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
+ }
+ }
+ return 1;
+}
+// -----------------------------------------------------------------------
+
+IMPL_LINK( DbRegistrationOptionsPage, PathSelect_Impl, SvTabListBox *, EMPTYARG )
+
+/* [Beschreibung]
+
+*/
+
+{
+ SvLBoxEntry* pEntry = pPathBox->FirstSelected();
+
+ m_aEdit.Enable( pEntry != NULL);
+ m_aDelete.Enable( pEntry != NULL);
+ return 0;
+}
+// -----------------------------------------------------------------------------
+void DbRegistrationOptionsPage::insertNewEntry(const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation)
+{
+ String aStr( _sName );
+ aStr += '\t';
+ aStr += String(_sLocation);
+ SvLBoxEntry* pEntry = pPathBox->InsertEntry( aStr );
+ String* pLocation = new String( _sLocation );
+ pEntry->SetUserData( pLocation );
+}
+// -----------------------------------------------------------------------------
+String DbRegistrationOptionsPage::getFileLocation(const String& _sLocation)
+{
+ try
+ {
+ rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) );
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ Reference < XFilePicker > xFilePicker( xFactory->createInstance( aService ), UNO_QUERY );
+ OSL_ENSURE(xFilePicker.is() ,"Could create file picker service!");
+ Reference < XFilterManager> xFilterManager(xFilePicker,UNO_QUERY);
+ static const String s_sDatabaseType = String::CreateFromAscii("StarOffice XML (Base)");
+ const SfxFilter* pFilter = SfxFilter::GetFilterByName( s_sDatabaseType);
+ if ( pFilter )
+ {
+ xFilterManager->appendFilter( pFilter->GetUIName(),pFilter->GetDefaultExtension());
+ xFilterManager->setCurrentFilter(pFilter->GetUIName());
+ }
+
+ INetURLObject aURL( _sLocation, INET_PROT_FILE );
+ xFilePicker->setMultiSelectionMode(sal_False);
+ xFilePicker->setDisplayDirectory( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ short nRet = xFilePicker->execute();
+
+ if ( ExecutableDialogResults::OK == nRet )
+ {
+
+ // old path is an URL?
+ INetURLObject aObj( _sLocation );
+ FASTBOOL bURL = ( aObj.GetProtocol() != INET_PROT_NOT_VALID );
+ Sequence< ::rtl::OUString > aFiles = xFilePicker->getFiles();
+ INetURLObject aNewObj( aFiles[0] );
+ aNewObj.removeFinalSlash();
+
+ // then the new path also an URL else system path
+ String sNewLocation = bURL ? rtl::OUString(aFiles[0]) : aNewObj.getFSysPath( INetURLObject::FSYS_DETECT );
+
+ if (
+#ifdef UNX
+ // Unix is case sensitive
+ ( sNewLocation != _sLocation )
+#else
+ ( sNewLocation.CompareIgnoreCaseToAscii( _sLocation ) != COMPARE_EQUAL )
+#endif
+ )
+ return sNewLocation;
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERRORFILE( "DbRegistrationOptionsPage::EditLocationHdl: exception from folder picker" );
+ }
+
+ return String();
+}
+// -----------------------------------------------------------------------------
+void DbRegistrationOptionsPage::openLinkDialog(const String& _sOldName,const String& _sOldLocation,SvLBoxEntry* _pEntry)
+{
+ ODocumentLinkDialog aDlg(this,_pEntry == NULL);
+
+ aDlg.set(_sOldName,_sOldLocation);
+ aDlg.setNameValidator(LINK( this, DbRegistrationOptionsPage, NameValidator ) );
+
+ if ( aDlg.Execute() == RET_OK )
+ {
+ String sNewName,sNewLocation;
+ aDlg.get(sNewName,sNewLocation);
+ if ( _pEntry == NULL || sNewName != _sOldName || sNewLocation != _sOldLocation )
+ {
+ if ( _pEntry )
+ {
+ delete static_cast<String*>(_pEntry->GetUserData());
+ pPathBox->GetModel()->Remove(_pEntry);
+ }
+ insertNewEntry(sNewName,sNewLocation);
+ m_bModified = sal_True;
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( DbRegistrationOptionsPage, NameValidator, String*, _pName )
+{
+ if ( _pName )
+ {
+ ULONG nCount = pPathBox->GetEntryCount();
+ for ( ULONG i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = pPathBox->GetEntry(i);
+ if ( (!m_pCurEntry || m_pCurEntry != pEntry) && pPathBox->GetEntryText(pEntry,0) == *_pName )
+ return 0L;
+ }
+ }
+ return 1L;
+}
+//........................................................................
+} // namespace svx
+//........................................................................
+
+
diff --git a/cui/source/options/dbregister.hrc b/cui/source/options/dbregister.hrc
new file mode 100644
index 000000000000..f2324aac186c
--- /dev/null
+++ b/cui/source/options/dbregister.hrc
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * 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: dbregister.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SVX_DBREGISTER_HRC
+#define SVX_DBREGISTER_HRC
+// defines ---------------------------------------------------------------
+
+#define FT_TYPE 10
+#define FT_PATH 11
+#define LB_PATH 12
+#define BTN_NEW 13
+#define BTN_EDIT 14
+#define GB_STD 15
+#define IMG_LOCK 16
+#define IMG_LOCK_HC 17
+#define BTN_DELETE 18
+
+#endif // SVX_DBREGISTER_HRC
+
diff --git a/cui/source/options/dbregister.src b/cui/source/options/dbregister.src
new file mode 100644
index 000000000000..bead1ae683cf
--- /dev/null
+++ b/cui/source/options/dbregister.src
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * 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: dbregister.src,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "dbregister.hrc"
+#include <svx/dialogs.hrc>
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+#ifndef _SVX_DIALOGS_HRC //autogen
+#include <svx/dialogs.hrc>
+#endif
+
+// RID_SFXPAGE_PATH -----------------------------------------------------
+#define STD_MASKCOLOR Color { Red=0xffff; Green=0x0000; Blue=0xffff; }
+TabPage RID_SFXPAGE_DBREGISTER
+{
+ // HelpId = HID_OPTIONS_DBREGISTER ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Registered databases" ;
+
+ FixedText FT_TYPE
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Registered name" ;
+ };
+ FixedText FT_PATH
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 110 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Database file" ;
+ };
+ Control LB_PATH
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 236 , 147 ) ;
+ Border = TRUE ;
+ TabStop = TRUE;
+ };
+ PushButton BTN_NEW
+ {
+ Pos = MAP_APPFONT ( 47 , 165 ) ;
+ Size = MAP_APPFONT ( 65 , 14 ) ;
+ Text [ en-US ] = "~New..." ;
+ };
+ PushButton BTN_EDIT
+ {
+ Pos = MAP_APPFONT ( 183 , 165 ) ;
+ Size = MAP_APPFONT ( 65 , 14 ) ;
+ Text [ en-US ] = "~Edit..." ;
+ };
+ PushButton BTN_DELETE
+ {
+ Pos = MAP_APPFONT ( 115 , 165 ) ;
+ Size = MAP_APPFONT ( 65 , 14 ) ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ FixedLine GB_STD
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Registered databases" ;
+ };
+};
+
diff --git a/cui/source/options/dbregisterednamesconfig.cxx b/cui/source/options/dbregisterednamesconfig.cxx
new file mode 100644
index 000000000000..535f90cda4e4
--- /dev/null
+++ b/cui/source/options/dbregisterednamesconfig.cxx
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * 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: dbregisterednamesconfig.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include "dbregisterednamesconfig.hxx"
+#include <svl/itemset.hxx>
+#include <tools/diagnose_ex.h>
+#include <svx/svxids.hrc>
+#include <unotools/confignode.hxx>
+#include <comphelper/extract.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/uno/XNamingService.hpp>
+#include <svl/eitem.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/pathoptions.hxx>
+#include "dbregistersettings.hxx"
+#include "connpooloptions.hxx"
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ using namespace ::utl;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::container;
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getDbRegisteredNamesNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("org.openoffice.Office.DataAccess/RegisteredNames");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getDbNameNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Name");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getDbLocationNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Location");
+ return s_sNodeName;
+ }
+
+ //====================================================================
+ //= DbRegisteredNamesConfig
+ //====================================================================
+ //--------------------------------------------------------------------
+ void DbRegisteredNamesConfig::GetOptions(SfxItemSet& _rFillItems)
+ {
+ // the config node where all pooling relevant info are stored under
+ OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory(
+ ::comphelper::getProcessServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_READONLY);
+
+ TNameLocationMap aSettings;
+
+ // then look for which of them settings are stored in the configuration
+ Sequence< ::rtl::OUString > aDriverKeys = aDbRegisteredNamesRoot.getNodeNames();
+ const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray();
+ const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
+ for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
+ {
+ // the name of the driver in this round
+ OConfigurationNode aThisDriverSettings = aDbRegisteredNamesRoot.openNode(*pDriverKeys);
+ ::rtl::OUString sName, sLocation;
+ aThisDriverSettings.getNodeValue(getDbNameNodeName()) >>= sName;
+ aThisDriverSettings.getNodeValue(getDbLocationNodeName()) >>= sLocation;
+ sLocation = SvtPathOptions().SubstituteVariable(sLocation);
+
+ aSettings.insert(TNameLocationMap::value_type(sName,sLocation));
+ }
+
+ _rFillItems.Put(DatabaseMapItem(SID_SB_DB_REGISTER, aSettings));
+ }
+
+ //--------------------------------------------------------------------
+ void DbRegisteredNamesConfig::SetOptions(const SfxItemSet& _rSourceItems)
+ {
+ // the config node where all pooling relevant info are stored under
+ OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory(
+ ::comphelper::getProcessServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_UPDATABLE);
+
+ if (!aDbRegisteredNamesRoot.isValid())
+ // already asserted by the OConfigurationTreeRoot
+ return;
+
+ sal_Bool bNeedCommit = sal_False;
+
+
+ // the settings for the single drivers
+ SFX_ITEMSET_GET( _rSourceItems, pDriverSettings, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True );
+ if (pDriverSettings)
+ {
+ Reference< XNameAccess > xDatabaseContext = Reference< XNameAccess >(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatabaseContext"))), UNO_QUERY);
+ Reference< XNamingService> xNamingService(xDatabaseContext,UNO_QUERY);
+ ::rtl::OUString sName, sLocation;
+ OConfigurationNode aThisDriverSettings;
+
+ const TNameLocationMap& rNewSettings = pDriverSettings->getSettings();
+ TNameLocationMap::const_iterator aEnd = rNewSettings.end();
+ for ( TNameLocationMap::const_iterator aLoop = rNewSettings.begin();
+ aLoop != aEnd;
+ ++aLoop
+ )
+ {
+ // need the name as ::rtl::OUString
+ sName = aLoop->first;
+
+ // the sub-node for this driver
+ if (aDbRegisteredNamesRoot.hasByName(sName))
+ {
+ aThisDriverSettings = aDbRegisteredNamesRoot.openNode(sName);
+ // set the values
+ aThisDriverSettings.setNodeValue(getDbNameNodeName(), makeAny(sName));
+ aThisDriverSettings.setNodeValue(getDbLocationNodeName(), makeAny(aLoop->second));
+ bNeedCommit = sal_True;
+ }
+ else
+ {
+ try
+ {
+ xNamingService->registerObject(sName,Reference< ::com::sun::star::uno::XInterface >(xDatabaseContext->getByName(aLoop->second),UNO_QUERY));
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ if (bNeedCommit)
+ aDbRegisteredNamesRoot.commit();
+
+ // delete unused entry
+ Sequence< ::rtl::OUString > aDriverKeys = xDatabaseContext->getElementNames();
+ const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray();
+ const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
+ for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
+ {
+ if ( rNewSettings.find(*pDriverKeys) == rNewSettings.end() )
+ {
+ try
+ {
+ xNamingService->revokeObject(*pDriverKeys);
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ }
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
diff --git a/cui/source/options/dbregisterednamesconfig.hxx b/cui/source/options/dbregisterednamesconfig.hxx
new file mode 100644
index 000000000000..366910c0f193
--- /dev/null
+++ b/cui/source/options/dbregisterednamesconfig.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * 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: dbregisterednamesconfig.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_DBREGISTEREDNAMESCONFIG_HXX
+#define SVX_DBREGISTEREDNAMESCONFIG_HXX
+
+class SfxItemSet;
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= DbRegisteredNamesConfig
+ //====================================================================
+ class DbRegisteredNamesConfig
+ {
+
+ public:
+ static void GetOptions(SfxItemSet& _rFillItems);
+ static void SetOptions(const SfxItemSet& _rSourceItems);
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_DBREGISTEREDNAMESCONFIG_HXX
+
+
diff --git a/cui/source/options/dbregistersettings.cxx b/cui/source/options/dbregistersettings.cxx
new file mode 100644
index 000000000000..c3d3b7e8c244
--- /dev/null
+++ b/cui/source/options/dbregistersettings.cxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * 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: dbregistersettings.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "dbregistersettings.hxx"
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= DatabaseMapItem
+ //====================================================================
+ TYPEINIT1( DatabaseMapItem, SfxPoolItem )
+ //--------------------------------------------------------------------
+ DatabaseMapItem::DatabaseMapItem( sal_uInt16 _nId, const TNameLocationMap& _rSettings )
+ :SfxPoolItem(_nId)
+ ,m_aSettings(_rSettings)
+ {
+ }
+
+ //--------------------------------------------------------------------
+ int DatabaseMapItem::operator==( const SfxPoolItem& _rCompare ) const
+ {
+ const DatabaseMapItem* pItem = PTR_CAST(DatabaseMapItem, &_rCompare);
+ if (!pItem)
+ return sal_False;
+
+ if (m_aSettings.size() != pItem->m_aSettings.size())
+ return sal_False;
+
+ return m_aSettings != pItem->m_aSettings;
+ }
+
+ //--------------------------------------------------------------------
+ SfxPoolItem* DatabaseMapItem::Clone( SfxItemPool * ) const
+ {
+ return new DatabaseMapItem(Which(), m_aSettings);
+ }
+
+ //--------------------------------------------------------------------
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+
diff --git a/cui/source/options/dbregistersettings.hxx b/cui/source/options/dbregistersettings.hxx
new file mode 100644
index 000000000000..672d4bf63bcd
--- /dev/null
+++ b/cui/source/options/dbregistersettings.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * 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: dbregistersettings.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_DBREGISTERSETTING_HXX
+#define SVX_DBREGISTERSETTING_HXX
+
+#include <comphelper/stl_types.hxx>
+#include <svl/poolitem.hxx>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= DatabaseMapItem
+ //====================================================================
+ DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUString,TNameLocationMap);
+ class DatabaseMapItem : public SfxPoolItem
+ {
+ protected:
+ TNameLocationMap m_aSettings;
+
+ public:
+ TYPEINFO();
+
+ DatabaseMapItem( sal_uInt16 _nId, const TNameLocationMap& _rSettings );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ const TNameLocationMap& getSettings() const { return m_aSettings; }
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+#endif // SVX_DBREGISTERSETTING_HXX
+
diff --git a/cui/source/options/doclinkdialog.cxx b/cui/source/options/doclinkdialog.cxx
new file mode 100644
index 000000000000..22969dffc212
--- /dev/null
+++ b/cui/source/options/doclinkdialog.cxx
@@ -0,0 +1,235 @@
+/*************************************************************************
+ *
+ * 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: doclinkdialog.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+#include "doclinkdialog.hxx"
+#ifndef _SVX_DOCLINKDIALOG_HRC_
+#include "doclinkdialog.hrc"
+#endif
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+#include <tools/debug.hxx>
+#ifndef SVTOOLS_FILENOTATION_HXX_
+#include <svl/filenotation.hxx>
+#endif
+#include <vcl/msgbox.hxx>
+#include <ucbhelper/content.hxx>
+#include <svx/dialmgr.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/docfilt.hxx>
+//......................................................................
+namespace svx
+{
+//......................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::ucb;
+ using namespace ::svt;
+
+ //==================================================================
+ //= ODocumentLinkDialog
+ //==================================================================
+ //------------------------------------------------------------------
+ ODocumentLinkDialog::ODocumentLinkDialog( Window* _pParent, sal_Bool _bCreateNew )
+ :ModalDialog( _pParent, SVX_RES(DLG_DOCUMENTLINK) )
+ ,m_aURLLabel (this, SVX_RES(FT_URL))
+ ,m_aURL (this, SVX_RES(CMB_URL))
+ ,m_aBrowseFile (this, SVX_RES(PB_BROWSEFILE))
+ ,m_aNameLabel (this, SVX_RES(FT_NAME))
+ ,m_aName (this, SVX_RES(ET_NAME))
+ ,m_aBottomLine (this, SVX_RES(FL_BOTTOM))
+ ,m_aOK (this, SVX_RES(BTN_OK))
+ ,m_aCancel (this, SVX_RES(BTN_CANCEL))
+ ,m_aHelp (this, SVX_RES(BTN_HELP))
+ ,m_bCreatingNew(_bCreateNew)
+ {
+ String sText = String( SVX_RES( m_bCreatingNew ? STR_NEW_LINK : STR_EDIT_LINK ) );
+ SetText(sText);
+
+ FreeResource();
+
+ String sTemp = String::CreateFromAscii("*.odb");
+ m_aURL.SetFilter(sTemp);
+
+ m_aName.SetModifyHdl( LINK(this, ODocumentLinkDialog, OnTextModified) );
+ m_aURL.SetModifyHdl( LINK(this, ODocumentLinkDialog, OnTextModified) );
+ m_aBrowseFile.SetClickHdl( LINK(this, ODocumentLinkDialog, OnBrowseFile) );
+ m_aOK.SetClickHdl( LINK(this, ODocumentLinkDialog, OnOk) );
+
+ m_aURL.SetDropDownLineCount(10);
+
+ validate();
+
+ // m_aURL.SetHelpId( HID_DOCLINKEDIT_URL );
+ m_aURL.SetDropDownLineCount( 5 );
+ }
+
+ //------------------------------------------------------------------
+ void ODocumentLinkDialog::set( const String& _rName, const String& _rURL )
+ {
+ m_aName.SetText(_rName);
+ m_aURL.SetText(_rURL);
+ validate();
+ }
+
+ //------------------------------------------------------------------
+ void ODocumentLinkDialog::get( String& _rName, String& _rURL ) const
+ {
+ _rName = m_aName.GetText();
+ _rURL = m_aURL.GetText();
+ }
+
+ //------------------------------------------------------------------
+ void ODocumentLinkDialog::validate( )
+ {
+
+ m_aOK.Enable( (0 != m_aName.GetText().Len()) && ( 0 != m_aURL.GetText().Len() ) );
+ }
+
+ //------------------------------------------------------------------
+ IMPL_LINK( ODocumentLinkDialog, OnOk, void*, EMPTYARG )
+ {
+ // get the current URL
+ ::rtl::OUString sURL = m_aURL.GetText();
+ OFileNotation aTransformer(sURL);
+ sURL = aTransformer.get(OFileNotation::N_URL);
+
+ // check for the existence of the selected file
+ sal_Bool bFileExists = sal_False;
+ try
+ {
+ ::ucbhelper::Content aFile(sURL, Reference< XCommandEnvironment >());
+ if (aFile.isDocument())
+ bFileExists = sal_True;
+ }
+ catch(Exception&)
+ {
+ }
+
+ if (!bFileExists)
+ {
+ String sMsg = String(SVX_RES(STR_LINKEDDOC_DOESNOTEXIST));
+ sMsg.SearchAndReplaceAscii("$file$", m_aURL.GetText());
+ ErrorBox aError(this, WB_OK , sMsg);
+ aError.Execute();
+ return 0L;
+ } // if (!bFileExists)
+ INetURLObject aURL( sURL );
+ if ( aURL.GetProtocol() != INET_PROT_FILE )
+ {
+ String sMsg = String(SVX_RES(STR_LINKEDDOC_NO_SYSTEM_FILE));
+ sMsg.SearchAndReplaceAscii("$file$", m_aURL.GetText());
+ ErrorBox aError(this, WB_OK , sMsg);
+ aError.Execute();
+ return 0L;
+ }
+
+ String sCurrentText = m_aName.GetText();
+ if ( m_aNameValidator.IsSet() )
+ {
+ if ( !m_aNameValidator.Call( &sCurrentText ) )
+ {
+ String sMsg = String(SVX_RES(STR_NAME_CONFLICT));
+ sMsg.SearchAndReplaceAscii("$file$", sCurrentText);
+ InfoBox aError(this, sMsg);
+ aError.Execute();
+
+ m_aName.SetSelection(Selection(0,sCurrentText.Len()));
+ m_aName.GrabFocus();
+ return 0L;
+ }
+ }
+
+ EndDialog(RET_OK);
+ return 0L;
+ }
+
+ //------------------------------------------------------------------
+ IMPL_LINK( ODocumentLinkDialog, OnBrowseFile, void*, EMPTYARG )
+ {
+ ::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | WB_STDMODAL | WB_OPEN);
+ static const String s_sDatabaseType = String::CreateFromAscii("StarOffice XML (Base)");
+ const SfxFilter* pFilter = SfxFilter::GetFilterByName( s_sDatabaseType);
+ if ( pFilter )
+ {
+ aFileDlg.AddFilter(pFilter->GetUIName(),pFilter->GetDefaultExtension());
+ aFileDlg.SetCurrentFilter(pFilter->GetUIName());
+ }
+
+ String sPath = m_aURL.GetText();
+ if (sPath.Len())
+ {
+ OFileNotation aTransformer( sPath, OFileNotation::N_SYSTEM );
+ aFileDlg.SetDisplayDirectory( aTransformer.get( OFileNotation::N_URL ) );
+ }
+
+ if (0 != aFileDlg.Execute())
+ return 0L;
+
+ if (0 == m_aName.GetText().Len())
+ { // default the name to the base of the chosen URL
+ INetURLObject aParser;
+
+ aParser.SetSmartProtocol(INET_PROT_FILE);
+ aParser.SetSmartURL(aFileDlg.GetPath());
+
+ m_aName.SetText(aParser.getBase(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET));
+
+ m_aName.SetSelection(Selection(0,m_aName.GetText().Len()));
+ m_aName.GrabFocus();
+ }
+ else
+ m_aURL.GrabFocus();
+
+ // get the path in system notation
+ OFileNotation aTransformer(aFileDlg.GetPath(), OFileNotation::N_URL);
+ m_aURL.SetText(aTransformer.get(OFileNotation::N_SYSTEM));
+
+ validate();
+ return 0L;
+ }
+
+ //------------------------------------------------------------------
+ IMPL_LINK( ODocumentLinkDialog, OnTextModified, Control*, EMPTYARG )
+ {
+ validate( );
+ return 0L;
+ }
+
+//......................................................................
+} // namespace svx
+//......................................................................
+
diff --git a/cui/source/options/doclinkdialog.hrc b/cui/source/options/doclinkdialog.hrc
new file mode 100644
index 000000000000..022c43b6d620
--- /dev/null
+++ b/cui/source/options/doclinkdialog.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: doclinkdialog.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DOCLINKDIALOG_HRC_
+#define _SVX_DOCLINKDIALOG_HRC_
+
+#define FT_NAME 1
+#define FT_URL 2
+
+#define ET_NAME 1
+
+#define CMB_URL 1
+
+#define PB_BROWSEFILE 1
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+
+#define FL_BOTTOM 1
+
+#define STR_EDIT_LINK 1
+#define STR_NEW_LINK 2
+
+#endif // _SVX_DOCLINKDIALOG_HRC_
+
diff --git a/cui/source/options/doclinkdialog.hxx b/cui/source/options/doclinkdialog.hxx
new file mode 100644
index 000000000000..81ec0c34d0c5
--- /dev/null
+++ b/cui/source/options/doclinkdialog.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * 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: doclinkdialog.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DOCLINKDIALOG_HXX_
+#define _SVX_DOCLINKDIALOG_HXX_
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <svtools/inettbc.hxx>
+#include <svtools/urlcontrol.hxx>
+
+//......................................................................
+namespace svx
+{
+//......................................................................
+
+ //==================================================================
+ //= ODocumentLinkDialog
+ //==================================================================
+ /** dialog for editing document links associated with data sources
+ */
+ class ODocumentLinkDialog : public ModalDialog
+ {
+ protected:
+ FixedText m_aURLLabel;
+ ::svt::OFileURLControl m_aURL;
+ PushButton m_aBrowseFile;
+ FixedText m_aNameLabel;
+ Edit m_aName;
+
+ FixedLine m_aBottomLine;
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+ sal_Bool m_bCreatingNew;
+
+ Link m_aNameValidator;
+
+ public:
+ ODocumentLinkDialog( Window* _pParent, sal_Bool _bCreateNew );
+
+ // name validation has to be done by an external instance
+ // the validator link gets a pointer to a String, and should return 0 if the string is not
+ // acceptable
+ void setNameValidator( const Link& _rValidator ) { m_aNameValidator = _rValidator; }
+ Link getNameValidator( ) const { return m_aNameValidator; }
+
+ void set( const String& _rName, const String& _rURL );
+ void get( String& _rName, String& _rURL ) const;
+
+ protected:
+ DECL_LINK( OnTextModified, Control* );
+ DECL_LINK( OnBrowseFile, void* );
+ DECL_LINK( OnOk, void* );
+
+ void validate( );
+ };
+
+//......................................................................
+} // namespace svx
+//......................................................................
+
+#endif // _SVX_DOCLINKDIALOG_HXX_
+
diff --git a/cui/source/options/doclinkdialog.src b/cui/source/options/doclinkdialog.src
new file mode 100644
index 000000000000..e4c8ceb3de87
--- /dev/null
+++ b/cui/source/options/doclinkdialog.src
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * 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: doclinkdialog.src,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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>
+#ifndef _SVX_DOCLINKDIALOG_HRC_
+#include "doclinkdialog.hrc"
+#endif
+
+#define DIALOG_SIZE_X 200
+#define DIALOG_SIZE_Y 94
+#define BUTTON_SIZE_X 50
+#define BUTTON_SIZE_Y 14
+
+#define LABEL_WIDTH 50
+
+#define HEIGHT_LABEL 8
+#define HEIGHT_EDIT 12
+
+#define LINE_1_Y 6
+#define LINE_2_Y LINE_1_Y + HEIGHT_EDIT + 4
+#define OFFSET_Y 6
+
+ModalDialog DLG_DOCUMENTLINK
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( DIALOG_SIZE_X , DIALOG_SIZE_Y ) ;
+
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ FixedText FT_URL
+ {
+
+ Pos = MAP_APPFONT ( 6, LINE_1_Y ) ;
+ Size = MAP_APPFONT ( DIALOG_SIZE_X - 6, HEIGHT_LABEL ) ;
+ Group = TRUE;
+
+ Text [ en-US ] = "~Database file";
+ };
+ ComboBox CMB_URL
+ {
+ Pos = MAP_APPFONT ( 6 , LINE_1_Y + OFFSET_Y + HEIGHT_LABEL - 3) ;
+ Size = MAP_APPFONT ( DIALOG_SIZE_X - 3*LINE_1_Y - BUTTON_SIZE_X , HEIGHT_EDIT ) ;
+
+ SVLook = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ AutoHScroll = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_BROWSEFILE
+ {
+ Pos = MAP_APPFONT ( DIALOG_SIZE_X - BUTTON_SIZE_X - 6 , LINE_1_Y + OFFSET_Y + HEIGHT_LABEL - 4) ;
+ Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y );
+ Text [ en-US ] = "~Browse...";
+ };
+
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 6, LINE_1_Y + 2*OFFSET_Y + HEIGHT_LABEL + BUTTON_SIZE_Y - 3) ;
+ Size = MAP_APPFONT ( DIALOG_SIZE_X - 6, HEIGHT_LABEL ) ;
+ Group = TRUE;
+
+ Text [ en-US ] = "Registered ~name";
+ };
+ Edit ET_NAME
+ {
+ Pos = MAP_APPFONT ( 6, LINE_1_Y + 3*OFFSET_Y + 2*HEIGHT_LABEL + BUTTON_SIZE_Y - 6) ;
+ Size = MAP_APPFONT ( DIALOG_SIZE_X - 3*LINE_1_Y - BUTTON_SIZE_X , HEIGHT_EDIT ) ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+
+ FixedLine FL_BOTTOM
+ {
+ Pos = MAP_APPFONT ( 4, LINE_1_Y + 4*OFFSET_Y + 2*HEIGHT_LABEL + BUTTON_SIZE_Y + HEIGHT_EDIT - 6);
+ Size = MAP_APPFONT ( DIALOG_SIZE_X - 8, 8 );
+ };
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( DIALOG_SIZE_X - 3 * ( BUTTON_SIZE_X + 3 ) - 6, DIALOG_SIZE_Y - 6 - BUTTON_SIZE_Y );
+ Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y );
+ DefButton = TRUE;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( DIALOG_SIZE_X - 2 * ( BUTTON_SIZE_X + 3 ) - 6, DIALOG_SIZE_Y - 6 - BUTTON_SIZE_Y );
+ Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y );
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( DIALOG_SIZE_X - 1 * ( BUTTON_SIZE_X + 3 ) - 3, DIALOG_SIZE_Y - 6 - BUTTON_SIZE_Y );
+ Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y );
+ };
+
+ String STR_EDIT_LINK
+ {
+ Text [ en-US ] = "Edit Database Link";
+ };
+ String STR_NEW_LINK
+ {
+ Text [ en-US ] = "Create Database Link";
+ };
+};
+
+String STR_LINKEDDOC_DOESNOTEXIST
+{
+ Text [ en-US ] = "The file\n$file$\ndoes not exist.";
+};
+
+String STR_LINKEDDOC_NO_SYSTEM_FILE
+{
+ Text [ en-US ] = "The file\n$file$\ndoes not exist in the local file system.";
+};
+
+String STR_NAME_CONFLICT
+{
+ Text [ en-US ] = "The name '$file$' is already used for another database.\nPlease choose a different name.";
+};
+
+QueryBox QUERY_DELETE_CONFIRM
+{
+ Buttons = WB_YES_NO ;
+ Message [ en-US ] = "Do you want to delete the entry?" ;
+};
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
new file mode 100644
index 000000000000..9ea708dc0d65
--- /dev/null
+++ b/cui/source/options/fontsubs.cxx
@@ -0,0 +1,614 @@
+/*************************************************************************
+ *
+ * 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: fontsubs.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <tools/shl.hxx>
+#include <svtools/ctrltool.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <svtools/fontsubstconfig.hxx>
+#include <unotools/sourceviewconfig.hxx>
+#include "fontsubs.hrc"
+#include "fontsubs.hxx"
+#include <svx/dialmgr.hxx>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+
+/*********************************************************************/
+/* */
+/* TabPage Fontersetzung */
+/* */
+/*********************************************************************/
+
+#define CBCOL_FIRST 0
+#define CBCOL_SECOND 1
+#define CBCOL_BOTH 2
+
+SvxFontSubstTabPage::SvxFontSubstTabPage( Window* pParent,
+ const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SVX_RES(RID_SVX_FONT_SUBSTITUTION), rSet),
+ aUseTableCB (this, SVX_RES(CB_USETABLE)),
+ aFont1FT (this, SVX_RES(FT_FONT1)),
+ aFont1CB (this, SVX_RES(CB_FONT1)),
+ aFont2FT (this, SVX_RES(FT_FONT2)),
+ aFont2CB (this, SVX_RES(CB_FONT2)),
+ aNewDelTBX (this, SVX_RES(TBX_SUBSTNEWDEL)),
+ aCheckLB (this, SVX_RES(CLB_SUBSTITUTES)),
+
+ aSourceViewFontsFL (this, SVX_RES(FL_SOURCEVIEW )),
+ aFontNameFT (this, SVX_RES(FT_FONTNAME )),
+ aFontNameLB (this, SVX_RES(LB_FONTNAME )),
+ aNonPropFontsOnlyCB(this, SVX_RES(CB_NONPROP )),
+ aFontHeightFT (this, SVX_RES(FT_FONTHEIGHT )),
+ aFontHeightLB (this, SVX_RES(LB_FONTHEIGHT )),
+
+ aImageList (SVX_RES(IL_ICON)),
+
+ sAutomatic (SVX_RES( STR_AUTOMATIC )),
+ pConfig(new SvtFontSubstConfig),
+ pSourceViewConfig(new utl::SourceViewConfig),
+
+ sHeader1 (SVX_RES( STR_HEADER1 )),
+ sHeader2 (SVX_RES( STR_HEADER2 )),
+ sHeader3 (SVX_RES( STR_HEADER3 )),
+ sHeader4 (SVX_RES( STR_HEADER4 )),
+
+ sFontGroup ("FontSubstitution"),
+ pCheckButtonData(0)
+{
+ FreeResource();
+
+ aTextColor = aCheckLB.GetTextColor();
+
+ for(USHORT k = 0; k < aNewDelTBX.GetItemCount(); k++)
+ aNewDelTBX.SetItemImage(aNewDelTBX.GetItemId(k),
+ aImageList.GetImage(aNewDelTBX.GetItemId(k)));
+
+ aNewDelTBX.SetSizePixel( aNewDelTBX.CalcWindowSizePixel() );
+
+ long nDelta = ( aFont1CB.GetSizePixel().Height() -
+ aNewDelTBX.GetSizePixel().Height() ) / 2;
+ Point aNewPnt = aNewDelTBX.GetPosPixel();
+ aNewPnt.Y() += nDelta;
+ aNewDelTBX.SetPosPixel( aNewPnt );
+
+ aCheckLB.SetHelpId(HID_OFA_FONT_SUBST_CLB);
+ aCheckLB.SetWindowBits(aCheckLB.GetStyle()|WB_HSCROLL|WB_VSCROLL);
+ aCheckLB.SetSelectionMode(MULTIPLE_SELECTION);
+ aCheckLB.SortByCol(2);
+
+ Link aLink(LINK(this, SvxFontSubstTabPage, SelectHdl));
+
+ aCheckLB.SetSelectHdl(aLink);
+ aUseTableCB.SetClickHdl(aLink);
+ aFont1CB.SetSelectHdl(aLink);
+ aFont1CB.SetModifyHdl(aLink);
+ aFont2CB.SetSelectHdl(aLink);
+ aFont2CB.SetModifyHdl(aLink);
+ aNewDelTBX.SetClickHdl(aLink);
+
+ aNonPropFontsOnlyCB.SetClickHdl(LINK(this, SvxFontSubstTabPage, NonPropFontsHdl));
+
+ static long aStaticTabs[] = { 4, 0, 0, 0, 0 };
+ long nW1 = GetTextWidth( sHeader1 );
+ long nW2 = GetTextWidth( sHeader2 );
+ long nMax = Max( nW1, nW2 ) + 6; // width of the longest header + a little offset
+ long nMin = aFontNameFT.LogicToPixel( Size( 30, 0 ), MAP_APPFONT ).Width();
+ nMax = Max( nMax, nMin );
+ const long nDoubleMax = 2*nMax;
+ const long nRest = aCheckLB.GetSizePixel().Width() - nDoubleMax;
+ aStaticTabs[2] = nMax;
+ aStaticTabs[3] = nDoubleMax;
+ aStaticTabs[4] = nDoubleMax + nRest/2;
+ aCheckLB.SvxSimpleTable::SetTabs( aStaticTabs, MAP_PIXEL );
+
+ String sHeader(sHeader1);
+ String sTab(String::CreateFromAscii("\t"));
+ String sTabSpace(String::CreateFromAscii("\t "));
+ sHeader += sTab;
+ sHeader += sHeader2;
+ sHeader += sTabSpace;
+ sHeader += sHeader3;
+ sHeader += sTabSpace;
+ sHeader += sHeader4;
+// sHeader += sTabSpace;
+ aCheckLB.InsertHeaderEntry(sHeader);
+
+ HeaderBar* pBar = aCheckLB.GetTheHeaderBar();
+
+ HeaderBarItemBits nBits = pBar->GetItemBits(1) | HIB_FIXEDPOS | HIB_FIXED;
+ nBits &= ~HIB_CLICKABLE;
+ pBar->SetItemBits(1, nBits);
+ pBar->SetItemBits(2, nBits);
+
+ USHORT nHeight;
+ for(nHeight = 6; nHeight <= 16; nHeight++)
+ aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight));
+ for(nHeight = 18; nHeight <= 28; nHeight+= 2)
+ aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight));
+ for(nHeight = 32; nHeight <= 48; nHeight+= 4)
+ aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight));
+ for(nHeight = 54; nHeight <= 72; nHeight+= 6)
+ aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight));
+ for(nHeight = 80; nHeight <= 96; nHeight+= 8)
+ aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight));
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+SvLBoxEntry* SvxFontSubstTabPage::CreateEntry(String& rFont1, String& rFont2)
+{
+ SvLBoxEntry* pEntry = new SvLBoxEntry;
+
+ if( !pCheckButtonData )
+ pCheckButtonData = new SvLBoxButtonData( &aCheckLB );
+
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff!
+
+ pEntry->AddItem( new SvLBoxButton( pEntry,
+ SvLBoxButtonKind_enabledCheckbox, 0,
+ pCheckButtonData ) );
+ pEntry->AddItem( new SvLBoxButton( pEntry,
+ SvLBoxButtonKind_enabledCheckbox, 0,
+ pCheckButtonData ) );
+
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, rFont1 ) );
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, rFont2 ) );
+
+ return pEntry;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+
+ SvxFontSubstTabPage::~SvxFontSubstTabPage()
+{
+ delete pCheckButtonData;
+ delete pConfig;
+ delete pSourceViewConfig;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+SfxTabPage* SvxFontSubstTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SvxFontSubstTabPage(pParent, rAttrSet);
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+BOOL SvxFontSubstTabPage::FillItemSet( SfxItemSet& )
+{
+ pConfig->ClearSubstitutions();// remove all entries
+
+ pConfig->Enable(aUseTableCB.IsChecked());
+
+ SvLBoxEntry* pEntry = aCheckLB.First();
+
+ while (pEntry)
+ {
+ SubstitutionStruct aAdd;
+ aAdd.sFont = aCheckLB.GetEntryText(pEntry, 0);
+ aAdd.sReplaceBy = aCheckLB.GetEntryText(pEntry, 1);
+ aAdd.bReplaceAlways = aCheckLB.IsChecked(pEntry, 0);
+ aAdd.bReplaceOnScreenOnly = aCheckLB.IsChecked(pEntry, 1);
+ pConfig->AddSubstitution(aAdd);
+ pEntry = aCheckLB.Next(pEntry);
+ }
+ if(pConfig->IsModified())
+ pConfig->Commit();
+ pConfig->Apply();
+ if(aFontHeightLB.GetSavedValue() != aFontHeightLB.GetSelectEntryPos())
+ pSourceViewConfig->SetFontHeight((sal_Int16)aFontHeightLB.GetSelectEntry().ToInt32());
+ if(aNonPropFontsOnlyCB.GetSavedValue() != aNonPropFontsOnlyCB.IsChecked())
+ pSourceViewConfig->SetShowProportionalFontsOnly(aNonPropFontsOnlyCB.IsChecked());
+ //font name changes cannot be detected by saved values
+ String sFontName;
+ if(aFontNameLB.GetSelectEntryPos())
+ sFontName = aFontNameLB.GetSelectEntry();
+ pSourceViewConfig->SetFontName(sFontName);
+
+ return FALSE;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+
+void SvxFontSubstTabPage::Reset( const SfxItemSet& )
+{
+ aCheckLB.SetUpdateMode(FALSE);
+ aCheckLB.Clear();
+
+ FontList aFntLst( Application::GetDefaultDevice() );
+ aFont1CB.Fill( &aFntLst );
+ aFont2CB.Fill( &aFntLst );
+
+ sal_Int32 nCount = pConfig->SubstitutionCount();
+ if (nCount)
+ aUseTableCB.Check(pConfig->IsEnabled());
+
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ const SubstitutionStruct* pSubs = pConfig->GetSubstitution(i);
+ String aTmpStr1(pSubs->sFont);
+ String aTmpStr2(pSubs->sReplaceBy);
+ SvLBoxEntry* pEntry = CreateEntry(aTmpStr1, aTmpStr2);
+ aCheckLB.Insert(pEntry);
+ aCheckLB.CheckEntry(pEntry, 0, pSubs->bReplaceAlways);
+ aCheckLB.CheckEntry(pEntry, 1, pSubs->bReplaceOnScreenOnly);
+ }
+
+ CheckEnable();
+ aCheckLB.SetUpdateMode(TRUE);
+
+ //fill font name box first
+ aNonPropFontsOnlyCB.Check(pSourceViewConfig->IsShowProportionalFontsOnly());
+ NonPropFontsHdl(&aNonPropFontsOnlyCB);
+ String sFontName(pSourceViewConfig->GetFontName());
+ if(sFontName.Len())
+ aFontNameLB.SelectEntry(sFontName);
+ else
+ aFontNameLB.SelectEntryPos(0);
+ short nFontHeight = pSourceViewConfig->GetFontHeight();
+ aFontHeightLB.SelectEntry(String::CreateFromInt32(nFontHeight));
+ aNonPropFontsOnlyCB.SaveValue();
+ aFontHeightLB.SaveValue();
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+IMPL_LINK(SvxFontSubstTabPage, SelectHdl, Window*, pWin)
+{
+ if (pWin == &aNewDelTBX)
+ {
+ SvLBoxEntry* pEntry;
+ // nCol ist behaemmerterweise die nCol'te Textspalte, werden nicht gezaehlt!
+ // Daher als Spalte "0".
+ ULONG nPos = aCheckLB.GetEntryPos(aFont1CB.GetText(), 0);
+
+ switch (aNewDelTBX.GetCurItemId())
+ {
+ case BT_SUBSTAPPLY:
+ {
+ if (nPos != 0xffffffff)
+ {
+ // Eintrag aendern
+ aCheckLB.SetEntryText(aFont2CB.GetText(), nPos, 1);
+ pEntry = aCheckLB.GetEntry(nPos);
+ }
+ else
+ {
+ // Neuer Eintrag
+ String sFont1 = aFont1CB.GetText();
+ String sFont2 = aFont2CB.GetText();
+
+ pEntry = CreateEntry(sFont1, sFont2);
+ aCheckLB.Insert(pEntry);
+ }
+ aCheckLB.SelectAll(FALSE);
+ aCheckLB.Select(pEntry);
+ }
+ break;
+
+ case BT_SUBSTDELETE:
+ {
+ if (nPos != 0xffffffff)
+ {
+ pEntry = aCheckLB.FirstSelected();
+ while (pEntry)
+ {
+ SvLBoxEntry* pDelEntry = pEntry;
+ pEntry = aCheckLB.NextSelected(pEntry);
+ aCheckLB.RemoveEntry(pDelEntry);
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ if (pWin == &aCheckLB)
+ {
+ SvLBoxEntry* pEntry = aCheckLB.FirstSelected();
+
+ if (aCheckLB.NextSelected(pEntry) == 0)
+ {
+ aFont1CB.SetText(aCheckLB.GetEntryText(pEntry, 0));
+ aFont2CB.SetText(aCheckLB.GetEntryText(pEntry, 1));
+ }
+ }
+
+ if (pWin == &aFont1CB)
+ {
+ ULONG nPos = aCheckLB.GetEntryPos(aFont1CB.GetText(), 0);
+
+ if (nPos != 0xffffffff)
+ {
+ SvLBoxEntry* pEntry = aCheckLB.GetEntry(nPos);
+
+ if (pEntry != aCheckLB.FirstSelected())
+ {
+ aCheckLB.SelectAll(FALSE);
+ aCheckLB.Select(pEntry);
+ }
+ }
+ }
+
+ CheckEnable();
+
+ return 0;
+}
+/* -----------------------------29.08.2002 11:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxFontSubstTabPage, NonPropFontsHdl, CheckBox*, pBox)
+{
+ String sFontName = aFontNameLB.GetSelectEntry();
+ BOOL bNonPropOnly = pBox->IsChecked();
+ aFontNameLB.Clear();
+ FontList aFntLst( Application::GetDefaultDevice() );
+ aFontNameLB.InsertEntry(sAutomatic);
+ USHORT nFontCount = aFntLst.GetFontNameCount();
+ for(USHORT nFont = 0; nFont < nFontCount; nFont++)
+ {
+ const FontInfo& rInfo = aFntLst.GetFontName( nFont );
+ if(!bNonPropOnly || rInfo.GetPitch() == PITCH_FIXED)
+ aFontNameLB.InsertEntry(rInfo.GetName());
+ }
+ aFontNameLB.SelectEntry(sFontName);
+ return 0;
+}
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void SvxFontSubstTabPage::CheckEnable()
+{
+ BOOL bEnableAll = aUseTableCB.IsChecked();
+
+ if (bEnableAll)
+ {
+ BOOL bApply, bDelete;
+
+ SvLBoxEntry* pEntry = aCheckLB.FirstSelected();
+
+ String sEntry = aFont1CB.GetText();
+ sEntry += '\t';
+ sEntry += aFont2CB.GetText();
+
+/* if (!aFont1CB.GetText().Len() || !aFont2CB.GetText().Len() ||
+ aFont1CB.GetText() == aFont2CB.GetText() ||
+ aCheckLB.GetEntryPos(sEntry) != 0xffffffff ||
+ (pEntry != 0 && aCheckLB.NextSelected(pEntry) != 0))
+ bApply = FALSE;
+ else
+ bApply = TRUE;*/
+
+ // Wegen OS/2-Optimierungsfehler (Bug #56267) etwas umstaendlicher:
+ if (!aFont1CB.GetText().Len() || !aFont2CB.GetText().Len())
+ bApply = FALSE;
+ else if(aFont1CB.GetText() == aFont2CB.GetText())
+ bApply = FALSE;
+ else if(aCheckLB.GetEntryPos(sEntry) != 0xffffffff)
+ bApply = FALSE;
+ else if(pEntry != 0 && aCheckLB.NextSelected(pEntry) != 0)
+ bApply = FALSE;
+ else
+ bApply = TRUE;
+
+ bDelete = pEntry != 0;
+
+ aNewDelTBX.EnableItem(BT_SUBSTAPPLY, bApply);
+ aNewDelTBX.EnableItem(BT_SUBSTDELETE, bDelete);
+ }
+
+ if (bEnableAll)
+ {
+ if (!aCheckLB.IsEnabled())
+ {
+ aCheckLB.EnableTable();
+ aCheckLB.SetTextColor(aTextColor);
+ aCheckLB.Invalidate();
+ SelectHdl(&aFont1CB);
+ }
+ }
+ else
+ {
+ if (aCheckLB.IsEnabled())
+ {
+ aCheckLB.DisableTable();
+ aCheckLB.SetTextColor(Color(COL_GRAY));
+ aCheckLB.Invalidate();
+ aCheckLB.SelectAll(FALSE);
+ }
+ }
+ aNewDelTBX.Enable(bEnableAll);
+ aFont1FT.Enable(bEnableAll);
+ aFont1CB.Enable(bEnableAll);
+ aFont2FT.Enable(bEnableAll);
+ aFont2CB.Enable(bEnableAll);
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void SvxFontSubstCheckListBox::SetTabs()
+{
+ SvxSimpleTable::SetTabs();
+ USHORT nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE;
+
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
+
+ pTab = (SvLBoxTab*)aTabs.GetObject(2);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
+}
+/* -----------------------------22.05.2002 11:06------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxFontSubstCheckListBox::KeyInput( const KeyEvent& rKEvt )
+{
+ if(!rKEvt.GetKeyCode().GetModifier() &&
+ KEY_SPACE == rKEvt.GetKeyCode().GetCode())
+ {
+ ULONG nSelPos = GetModel()->GetAbsPos(GetCurEntry());
+ USHORT nCol = GetCurrentTabPos() - 1;
+ if ( nCol < 2 )
+ {
+ CheckEntryPos( nSelPos, nCol, !IsChecked( nSelPos, nCol ) );
+ CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)GetEntry( nSelPos ) );
+ }
+ else
+ {
+ USHORT nCheck = IsChecked(nSelPos, 1) ? 1 : 0;
+ if(IsChecked(nSelPos, 0))
+ nCheck += 2;
+ nCheck--;
+ nCheck &= 3;
+ CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1));
+ CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2));
+ }
+ }
+ else
+ SvxSimpleTable::KeyInput(rKEvt);
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void SvxFontSubstCheckListBox::CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked)
+{
+ if ( nPos < GetEntryCount() )
+ SetCheckButtonState(
+ GetEntry(nPos),
+ nCol,
+ bChecked ? SvButtonState( SV_BUTTON_CHECKED ) :
+ SvButtonState( SV_BUTTON_UNCHECKED ) );
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void SvxFontSubstCheckListBox::CheckEntry(SvLBoxEntry* pEntry, USHORT nCol, BOOL bChecked)
+{
+ if ( pEntry )
+ SetCheckButtonState(
+ pEntry,
+ nCol,
+ bChecked ? SvButtonState( SV_BUTTON_CHECKED ) :
+ SvButtonState( SV_BUTTON_UNCHECKED ) );
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+BOOL SvxFontSubstCheckListBox::IsChecked(ULONG nPos, USHORT nCol)
+{
+ return GetCheckButtonState( GetEntry(nPos), nCol ) == SV_BUTTON_CHECKED;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+BOOL SvxFontSubstCheckListBox::IsChecked(SvLBoxEntry* pEntry, USHORT nCol)
+{
+ return GetCheckButtonState( pEntry, nCol ) == SV_BUTTON_CHECKED;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void SvxFontSubstCheckListBox::SetCheckButtonState( SvLBoxEntry* pEntry, USHORT nCol, SvButtonState eState)
+{
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1));
+
+ DBG_ASSERT(pItem,"SetCheckButton:Item not found");
+ if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
+ {
+ switch( eState )
+ {
+ case SV_BUTTON_CHECKED:
+ pItem->SetStateChecked();
+ break;
+
+ case SV_BUTTON_UNCHECKED:
+ pItem->SetStateUnchecked();
+ break;
+
+ case SV_BUTTON_TRISTATE:
+ pItem->SetStateTristate();
+ break;
+ }
+ InvalidateEntry( pEntry );
+ }
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+SvButtonState SvxFontSubstCheckListBox::GetCheckButtonState( SvLBoxEntry* pEntry, USHORT nCol ) const
+{
+ SvButtonState eState = SV_BUTTON_UNCHECKED;
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1));
+ DBG_ASSERT(pItem,"GetChButnState:Item not found");
+
+ if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
+ {
+ USHORT nButtonFlags = pItem->GetButtonFlags();
+ eState = pCheckButtonData->ConvertToButtonState( nButtonFlags );
+ }
+
+ return eState;
+}
+
+
diff --git a/cui/source/options/fontsubs.hrc b/cui/source/options/fontsubs.hrc
new file mode 100644
index 000000000000..9344d41c0fc7
--- /dev/null
+++ b/cui/source/options/fontsubs.hrc
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fontsubs.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FONT_SUBSTITUTION
+#define _SVX_FONT_SUBSTITUTION
+
+#include <svx/dialogs.hrc>
+
+// defines ------------------------------------------------------------------
+
+#define CLB_SUBSTITUTES 1
+#define FT_FONT1 2
+#define CB_FONT1 3
+#define FT_FONT2 4
+#define CB_FONT2 5
+#define TBX_SUBSTNEWDEL 6
+#define BT_SUBSTAPPLY 7
+#define BT_SUBSTDELETE 8
+//#define BT_SUBSTINFO 9
+
+#define STR_HEADER1 10
+#define STR_HEADER2 11
+#define STR_HEADER3 12
+#define STR_HEADER4 13
+
+#define IL_ICON 20
+#define CB_USETABLE 21
+
+#define FL_SOURCEVIEW 22
+#define FT_FONTNAME 23
+#define LB_FONTNAME 24
+#define CB_NONPROP 25
+#define FT_FONTHEIGHT 26
+#define LB_FONTHEIGHT 27
+#define STR_AUTOMATIC 28
+
+#endif
+
+
diff --git a/cui/source/options/fontsubs.hxx b/cui/source/options/fontsubs.hxx
new file mode 100644
index 000000000000..be174768bea4
--- /dev/null
+++ b/cui/source/options/fontsubs.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * 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: fontsubs.hxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FONT_SUBSTITUTION_HXX
+#define _SVX_FONT_SUBSTITUTION_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <svx/simptabl.hxx>
+#include <vcl/toolbox.hxx>
+#include <svtools/ctrlbox.hxx>
+
+namespace utl
+{
+ class SourceViewConfig;
+};
+
+// class SvxFontSubstCheckListBox ------------------------------------------
+
+class SvxFontSubstCheckListBox : public SvxSimpleTable
+{
+ friend class SvxFontSubstTabPage;
+ using SvxSimpleTable::SetTabs;
+ using SvTreeListBox::GetCheckButtonState;
+ using SvTreeListBox::SetCheckButtonState;
+
+ protected:
+ virtual void SetTabs();
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ public:
+ SvxFontSubstCheckListBox(Window* pParent, const ResId& rResId ) :
+ SvxSimpleTable( pParent, rResId ){}
+
+ inline void *GetUserData(ULONG nPos) { return GetEntry(nPos)->GetUserData(); }
+ inline void SetUserData(ULONG nPos, void *pData ) { GetEntry(nPos)->SetUserData(pData); }
+
+ BOOL IsChecked(ULONG nPos, USHORT nCol = 0);
+ BOOL IsChecked(SvLBoxEntry* pEntry, USHORT nCol = 0);
+ void CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked);
+ void CheckEntry(SvLBoxEntry* pEntry, USHORT nCol, BOOL bChecked);
+ SvButtonState GetCheckButtonState( SvLBoxEntry*, USHORT nCol ) const;
+ void SetCheckButtonState( SvLBoxEntry*, USHORT nCol, SvButtonState );
+};
+
+// class SvxFontSubstTabPage ----------------------------------------------------
+class SvtFontSubstConfig;
+namespace svt {class SourceViewConfig;}
+class SvxFontSubstTabPage : public SfxTabPage
+{
+ CheckBox aUseTableCB;
+ FixedText aFont1FT;
+ FontNameBox aFont1CB;
+ FixedText aFont2FT;
+ FontNameBox aFont2CB;
+ ToolBox aNewDelTBX;
+ SvxFontSubstCheckListBox aCheckLB;
+
+ FixedLine aSourceViewFontsFL;
+ FixedText aFontNameFT;
+ ListBox aFontNameLB;
+ CheckBox aNonPropFontsOnlyCB;
+ FixedText aFontHeightFT;
+ ListBox aFontHeightLB;
+
+ ImageList aImageList;
+ String sAutomatic;
+
+ SvtFontSubstConfig* pConfig;
+ utl::SourceViewConfig* pSourceViewConfig;
+
+ String sHeader1;
+ String sHeader2;
+ String sHeader3;
+ String sHeader4;
+
+ Color aTextColor;
+ ByteString sFontGroup;
+
+ SvLBoxButtonData* pCheckButtonData;
+
+ DECL_LINK(SelectHdl, Window *pWin = 0);
+ DECL_LINK(NonPropFontsHdl, CheckBox* pBox);
+
+ SvLBoxEntry* CreateEntry(String& rFont1, String& rFont2);
+ void CheckEnable();
+
+
+ SvxFontSubstTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxFontSubstTabPage();
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+
+#endif // _SVX_FONT_SUBSTITUTION_HXX
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/fontsubs.src b/cui/source/options/fontsubs.src
new file mode 100644
index 000000000000..f3160d2f4808
--- /dev/null
+++ b/cui/source/options/fontsubs.src
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * 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: fontsubs.src,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ------------------------------------------------------------------
+
+#include <svx/svxids.hrc>
+#include "fontsubs.hrc"
+#include "helpid.hrc"
+
+ // pragma -------------------------------------------------------------------
+
+
+
+
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+
+TabPage RID_SVX_FONT_SUBSTITUTION
+{
+ HelpID = HID_OFA_FONT_SUBSTITUTION ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ CheckBox CB_USETABLE
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 248 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Apply replacement table";
+ };
+ FixedText FT_FONT1
+ {
+ Pos = MAP_APPFONT ( 6 , 20 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Font";
+ };
+ ComboBox CB_FONT1
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 33 ) ;
+ Size = MAP_APPFONT ( 100 , 100 ) ;
+ TabStop = TRUE ;
+ AutoSize = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ DropDown = TRUE;
+ Sort = TRUE;
+ };
+ FixedText FT_FONT2
+ {
+ Pos = MAP_APPFONT ( 110 , 20 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Re~place with";
+ };
+ ComboBox CB_FONT2
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 110 , 33 ) ;
+ Size = MAP_APPFONT ( 100 , 100 ) ;
+ TabStop = TRUE ;
+ AutoSize = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ DropDown = TRUE;
+ Sort = TRUE;
+ };
+ ImageList IL_ICON
+ {
+ Prefix = "nu";
+ MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+ IdList =
+ {
+ BT_SUBSTAPPLY ;
+ BT_SUBSTDELETE ;
+ };
+ IdCount = { 2 ; };
+ };
+ ToolBox TBX_SUBSTNEWDEL
+ {
+ Pos = MAP_APPFONT ( 214 , 33 ) ;
+ SVLook = TRUE ;
+ Border = FALSE ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = BT_SUBSTAPPLY ;
+ HelpID = HID_OFA_SUBST_APPLY ;
+ Text [ en-US ] = "Apply" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = BT_SUBSTDELETE ;
+ HelpID = HID_OFA_SUBST_DELETE ;
+ Text [ en-US ] = "Delete" ;
+ };
+ };
+ };
+ Control CLB_SUBSTITUTES
+ {
+ Pos = MAP_APPFONT ( 6 , 48 ) ;
+ Size = MAP_APPFONT ( 248 , 75 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SOURCEVIEW
+ {
+ Pos = MAP_APPFONT ( 6 , 129 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Font settings for HTML, Basic and SQL sources" ;
+ };
+ FixedText FT_FONTNAME
+ {
+ Pos = MAP_APPFONT ( 6 , 142 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] = "Fonts" ;
+ };
+ ListBox LB_FONTNAME
+ {
+ Pos = MAP_APPFONT ( 65 , 140 ) ;
+ Size = MAP_APPFONT ( 100 , 68 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ DropDown = TRUE;
+ };
+ CheckBox CB_NONPROP
+ {
+ Pos = MAP_APPFONT ( 65 , 155 ) ;
+ Size = MAP_APPFONT ( 180 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Non-proportional fonts only" ;
+ };
+ FixedText FT_FONTHEIGHT
+ {
+ Pos = MAP_APPFONT ( 6 , 171 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] ="~Size";
+ };
+ ListBox LB_FONTHEIGHT
+ {
+ Pos = MAP_APPFONT ( 65 , 169 ) ;
+ Size = MAP_APPFONT ( 30 , 68 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ DropDown = TRUE;
+ };
+ String STR_HEADER1
+ {
+ Text [ en-US ] = "Always";
+ };
+ String STR_HEADER2
+ {
+ Text [ en-US ] = "Screen only";
+ };
+ String STR_HEADER3
+ {
+ Text [ en-US ] = "Font";
+ };
+ String STR_HEADER4
+ {
+ Text [ en-US ] = "Replace with";
+ };
+ String STR_AUTOMATIC
+ {
+ Text [ en-US ] = "Automatic";
+ };
+};
+
diff --git a/cui/source/options/internationaloptions.cxx b/cui/source/options/internationaloptions.cxx
new file mode 100644
index 000000000000..7bcb021f9cbf
--- /dev/null
+++ b/cui/source/options/internationaloptions.cxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * 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: internationaloptions.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "internationaloptions.hxx"
+#include "internationaloptions.hrc"
+#include <svl/eitem.hxx>
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include <svx/dialmgr.hxx>
+
+namespace offapp
+{
+
+ struct InternationalOptionsPage::IMPL
+ {
+ FixedLine m_aFL_DefaultTextDirection;
+ RadioButton m_aRB_TxtDirLeft2Right;
+ RadioButton m_aRB_TxtDirRight2Left;
+ FixedLine m_aFL_SheetView;
+ CheckBox m_aCB_ShtVwRight2Left;
+ CheckBox m_aCB_ShtVwCurrentDocOnly;
+
+ BOOL m_bEnable_SheetView_Opt : 1;
+
+ inline IMPL( Window* _pParent );
+
+ inline void EnableOption_SheetView( BOOL _bEnable = TRUE );
+ void ShowOption_SheetView( BOOL _bShow = TRUE );
+
+ BOOL FillItemSet( SfxItemSet& _rSet );
+ void Reset( const SfxItemSet& _rSet );
+ };
+
+ inline InternationalOptionsPage::IMPL::IMPL( Window* _pParent ) :
+ m_aFL_DefaultTextDirection ( _pParent, SVX_RES( FL_DEFTXTDIRECTION ) )
+ ,m_aRB_TxtDirLeft2Right ( _pParent, SVX_RES( RB_TXTDIR_LEFT2RIGHT ) )
+ ,m_aRB_TxtDirRight2Left ( _pParent, SVX_RES( RB_TXTDIR_RIGHT2LEFT ) )
+ ,m_aFL_SheetView ( _pParent, SVX_RES( FL_SHEETVIEW ) )
+ ,m_aCB_ShtVwRight2Left ( _pParent, SVX_RES( CB_SHTVW_RIGHT2LEFT ) )
+ ,m_aCB_ShtVwCurrentDocOnly ( _pParent, SVX_RES( CB_SHTVW_CURRENTDOCONLY ) )
+
+ ,m_bEnable_SheetView_Opt ( FALSE )
+ {
+ ShowOption_SheetView( m_bEnable_SheetView_Opt );
+ }
+
+ inline void InternationalOptionsPage::IMPL::EnableOption_SheetView( BOOL _bEnable )
+ {
+ if( m_bEnable_SheetView_Opt != _bEnable )
+ {
+ ShowOption_SheetView( _bEnable );
+
+ m_bEnable_SheetView_Opt = _bEnable;
+ }
+ }
+
+ void InternationalOptionsPage::IMPL::ShowOption_SheetView( BOOL _bShow )
+ {
+ m_aFL_SheetView.Show( _bShow );
+ m_aCB_ShtVwRight2Left.Show( _bShow );
+ m_aCB_ShtVwCurrentDocOnly.Show( _bShow );
+ }
+
+ BOOL InternationalOptionsPage::IMPL::FillItemSet( SfxItemSet& _rSet )
+ {
+ DBG_ASSERT( _rSet.GetPool(), "-InternationalOptionsPage::FillItemSet(): no pool gives rums!" );
+
+ // handling of DefaultTextDirection stuff
+ _rSet.Put( SfxBoolItem( _rSet.GetPool()->GetWhich( SID_ATTR_PARA_LEFT_TO_RIGHT ),
+ m_aRB_TxtDirLeft2Right.IsChecked() ),
+ SID_ATTR_PARA_LEFT_TO_RIGHT );
+
+ // handling of SheetView stuff
+// if( m_bEnable_SheetView_Opt )
+// {
+// }
+
+ return TRUE;
+ }
+
+ void InternationalOptionsPage::IMPL::Reset( const SfxItemSet& _rSet )
+ {
+ // handling of DefaultTextDirection stuff
+ const SfxBoolItem* pLeft2RightItem = static_cast< const SfxBoolItem* >( GetItem( _rSet, SID_ATTR_PARA_LEFT_TO_RIGHT ) );
+
+ DBG_ASSERT( pLeft2RightItem, "+InternationalOptionsPage::Reset(): SID_ATTR_PARA_LEFT_TO_RIGHT not set!" );
+
+ BOOL bLeft2Right = pLeft2RightItem? pLeft2RightItem->GetValue() : TRUE;
+ m_aRB_TxtDirLeft2Right.Check( bLeft2Right );
+
+ // handling of SheetView stuff
+// if( m_bEnable_SheetView_Opt )
+// {
+// m_aCB_ShtVwRight2Left.Check( FALSE );
+//
+// m_aCB_ShtVwCurrentDocOnly.Check( FALSE );
+// }
+ }
+
+ InternationalOptionsPage::InternationalOptionsPage( Window* _pParent, const SfxItemSet& _rAttrSet ) :
+ SfxTabPage ( _pParent, SVX_RES( RID_OFA_TP_INTERNATIONAL ), _rAttrSet )
+
+ ,m_pImpl ( new IMPL( this ) )
+ {
+ FreeResource();
+ }
+
+ SfxTabPage* InternationalOptionsPage::CreateSd( Window* _pParent, const SfxItemSet& _rAttrSet )
+ {
+ return new InternationalOptionsPage( _pParent, _rAttrSet );
+ }
+
+ SfxTabPage* InternationalOptionsPage::CreateSc( Window* _pParent, const SfxItemSet& _rAttrSet )
+ {
+ InternationalOptionsPage* p = new InternationalOptionsPage( _pParent, _rAttrSet );
+// p->m_pImpl->EnableOption_SheetView();
+ return p;
+ }
+
+ InternationalOptionsPage::~InternationalOptionsPage()
+ {
+ DELETEZ( m_pImpl );
+ }
+
+ BOOL InternationalOptionsPage::FillItemSet( SfxItemSet& _rSet )
+ {
+ return m_pImpl->FillItemSet( _rSet );
+ }
+
+ void InternationalOptionsPage::Reset( const SfxItemSet& _rSet )
+ {
+ m_pImpl->Reset( _rSet );
+ }
+
+} // /namespace offapp
+
diff --git a/cui/source/options/internationaloptions.hrc b/cui/source/options/internationaloptions.hrc
new file mode 100644
index 000000000000..b367340ba2fe
--- /dev/null
+++ b/cui/source/options/internationaloptions.hrc
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * 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: internationaloptions.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFAPP_INTERNATIONALOPTIONS_HRC_
+#define _OFFAPP_INTERNATIONALOPTIONS_HRC_
+
+#include <svtools/controldims.hrc>
+
+// general sizes
+#define PAGE_SIZE_X 260
+#define PAGE_SIZE_Y 185
+
+// x-positions
+#define COL_0 RSC_SP_TBPG_INNERBORDER_LEFT
+#define COL_1 (COL_0 + RSC_SP_FLGR_SPACE_X)
+#define COL_2 (COL_1 + RSC_SP_CHK_TEXTINDENT)
+#define COL_LAST (PAGE_SIZE_X - RSC_SP_TBPG_INNERBORDER_RIGHT)
+
+// heights
+#define HEIGHT_FL RSC_CD_FIXEDLINE_HEIGHT
+#define HEIGHT_RB RSC_CD_RADIOBUTTON_HEIGHT
+#define HEIGHT_CB RSC_CD_CHECKBOX_HEIGHT
+
+// vertical spacing
+#define SPACE_FL_NEXTCTRL_Y RSC_SP_CTRL_DESC_Y
+
+// y-positions
+#define ROW_0 RSC_SP_TBPG_INNERBORDER_TOP
+#define ROW_1 (ROW_0 + HEIGHT_FL + SPACE_FL_NEXTCTRL_Y)
+#define ROW_2 (ROW_1 + HEIGHT_RB + RSC_SP_CTRL_GROUP_Y)
+#define ROW_3 (ROW_2 + HEIGHT_RB + RSC_SP_FLGR_SPACE_Y)
+#define ROW_4 (ROW_3 + HEIGHT_FL + SPACE_FL_NEXTCTRL_Y)
+#define ROW_5 (ROW_4 + HEIGHT_CB + RSC_SP_CTRL_GROUP_Y)
+
+// misc calculation makros
+#define WIDTH2END( startcol ) (COL_LAST - startcol)
+
+
+// resource IDs
+#define FL_DEFTXTDIRECTION 1
+#define RB_TXTDIR_LEFT2RIGHT 2
+#define RB_TXTDIR_RIGHT2LEFT 3
+#define FL_SHEETVIEW 4
+#define CB_SHTVW_RIGHT2LEFT 5
+#define CB_SHTVW_CURRENTDOCONLY 6
+
+#endif
+
diff --git a/cui/source/options/internationaloptions.src b/cui/source/options/internationaloptions.src
new file mode 100644
index 000000000000..ab725d9c4f0b
--- /dev/null
+++ b/cui/source/options/internationaloptions.src
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * 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: internationaloptions.src,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "internationaloptions.hrc"
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+
+TabPage RID_OFA_TP_INTERNATIONAL
+{
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( PAGE_SIZE_X, PAGE_SIZE_Y ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+
+ FixedLine FL_DEFTXTDIRECTION
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_0 );
+ Size = MAP_APPFONT( WIDTH2END( COL_0 ), HEIGHT_FL );
+ Text [ en-US ] = "Default text direction";
+ };
+
+ RadioButton RB_TXTDIR_LEFT2RIGHT
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_1 );
+ Size = MAP_APPFONT( WIDTH2END( COL_1 ), HEIGHT_RB );
+ Group = TRUE;
+ Text [ en-US ] = "~Left-to-right";
+ };
+
+ RadioButton RB_TXTDIR_RIGHT2LEFT
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_2 );
+ Size = MAP_APPFONT( WIDTH2END( COL_1 ), HEIGHT_RB );
+ Text [ en-US ] = "~Right-to-left";
+ };
+
+ FixedLine FL_SHEETVIEW
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_3 );
+ Size = MAP_APPFONT( WIDTH2END( COL_0 ), HEIGHT_FL );
+ Text [ en-US ] = "Sheet view";
+ };
+
+ CheckBox CB_SHTVW_RIGHT2LEFT
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_4 );
+ Size = MAP_APPFONT( WIDTH2END( COL_1 ), HEIGHT_CB );
+ Text [ en-US ] = "Right-~to-left";
+ };
+
+ CheckBox CB_SHTVW_CURRENTDOCONLY
+ {
+ Pos = MAP_APPFONT( COL_2, ROW_5 );
+ Size = MAP_APPFONT( WIDTH2END( COL_2 ), HEIGHT_CB );
+ Text [ en-US ] = "~Current document only";
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/makefile.mk b/cui/source/options/makefile.mk
new file mode 100755
index 000000000000..b31d70f3e773
--- /dev/null
+++ b/cui/source/options/makefile.mk
@@ -0,0 +1,122 @@
+#*************************************************************************
+#
+# 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: makefile.mk,v $
+#
+# $Revision: 1.65 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..
+PRJNAME=cui
+TARGET=options
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc
+.ENDIF # ENABLE_LAYOUT == TRUE
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=options
+SRC1FILES = \
+ connpooloptions.src \
+ dbregister.src \
+ doclinkdialog.src \
+ fontsubs.src \
+ internationaloptions.src \
+ optaccessibility.src \
+ optasian.src \
+ optchart.src \
+ optcolor.src \
+ optctl.src \
+ optdict.src \
+ optfltr.src \
+ optgdlg.src \
+ optgenrl.src \
+ opthtml.src \
+ optimprove.src \
+ optinet2.src \
+ optjava.src \
+ optjsearch.src \
+ optlingu.src \
+ optmemory.src \
+ optpath.src \
+ optsave.src \
+ optupdt.src \
+ readonlyimage.src \
+ securityoptions.src \
+ treeopt.src \
+ webconninfo.src \
+
+
+SLOFILES+=\
+ $(SLO)$/cfgchart.obj \
+ $(SLO)$/connpoolconfig.obj \
+ $(SLO)$/connpooloptions.obj \
+ $(SLO)$/connpoolsettings.obj \
+ $(SLO)$/cuisrchdlg.obj \
+ $(SLO)$/dbregister.obj \
+ $(SLO)$/dbregisterednamesconfig.obj \
+ $(SLO)$/dbregistersettings.obj \
+ $(SLO)$/doclinkdialog.obj \
+ $(SLO)$/fontsubs.obj \
+ $(SLO)$/internationaloptions.obj \
+ $(SLO)$/optaccessibility.obj \
+ $(SLO)$/optasian.obj \
+ $(SLO)$/optchart.obj \
+ $(SLO)$/optcolor.obj \
+ $(SLO)$/optctl.obj \
+ $(SLO)$/optdict.obj \
+ $(SLO)$/optfltr.obj \
+ $(SLO)$/optgdlg.obj \
+ $(SLO)$/optgenrl.obj \
+ $(SLO)$/optHeaderTabListbox.obj \
+ $(SLO)$/opthtml.obj \
+ $(SLO)$/optimprove.obj \
+ $(SLO)$/optimprove2.obj \
+ $(SLO)$/optinet2.obj \
+ $(SLO)$/optjava.obj \
+ $(SLO)$/optjsearch.obj \
+ $(SLO)$/optlingu.obj \
+ $(SLO)$/optmemory.obj \
+ $(SLO)$/optpath.obj \
+ $(SLO)$/optsave.obj \
+ $(SLO)$/optupdt.obj \
+ $(SLO)$/radiobtnbox.obj \
+ $(SLO)$/readonlyimage.obj \
+ $(SLO)$/sdbcdriverenum.obj \
+ $(SLO)$/securityoptions.obj \
+ $(SLO)$/treeopt.obj \
+ $(SLO)$/webconninfo.obj \
+
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/cui/source/options/optHeaderTabListbox.cxx b/cui/source/options/optHeaderTabListbox.cxx
new file mode 100644
index 000000000000..a3107df7069b
--- /dev/null
+++ b/cui/source/options/optHeaderTabListbox.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * 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: optHeaderTabListbox.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "optHeaderTabListbox.hxx"
+#include <vcl/svapp.hxx>
+#include <svtools/headbar.hxx>
+
+
+namespace svx
+{
+// class OptLBoxString_Impl ----------------------------------------------
+
+class OptLBoxString_Impl : public SvLBoxString
+{
+public:
+ OptLBoxString_Impl( SvLBoxEntry* pEntry, USHORT nFlags, const String& rTxt ) :
+ SvLBoxString( pEntry, nFlags, rTxt ) {}
+
+ virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, SvLBoxEntry* pEntry );
+};
+
+// -----------------------------------------------------------------------
+
+void OptLBoxString_Impl::Paint( const Point& rPos, SvLBox& rDev, USHORT, SvLBoxEntry* pEntry )
+{
+ Font aOldFont( rDev.GetFont() );
+ Font aFont( aOldFont );
+ //detect readonly state by asking for a valid Image
+ if(pEntry && !(!((OptHeaderTabListBox&)rDev).GetCollapsedEntryBmp(pEntry)))
+ aFont.SetColor( Application::GetSettings().GetStyleSettings().GetDeactiveTextColor() );
+ rDev.SetFont( aFont );
+ rDev.DrawText( rPos, GetText() );
+ rDev.SetFont( aOldFont );
+}
+// -----------------------------------------------------------------------------
+
+OptHeaderTabListBox::OptHeaderTabListBox( Window* pParent, WinBits nWinStyle ) :
+
+ SvHeaderTabListBox( pParent, nWinStyle )
+{
+}
+
+// -----------------------------------------------------------------------
+void OptHeaderTabListBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt,
+ const Image& rImg1, const Image& rImg2,
+ SvLBoxButtonKind eButtonKind )
+{
+ SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind );
+ USHORT _nTabCount = TabCount();
+
+ for ( USHORT nCol = 1; nCol < _nTabCount; ++nCol )
+ {
+ // alle Spalten mit eigener Klasse initialisieren (Spalte 0 == Bitmap)
+ SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nCol );
+ OptLBoxString_Impl* pStr = new OptLBoxString_Impl( pEntry, 0, pCol->GetText() );
+ pEntry->ReplaceItem( pStr, nCol );
+ }
+}
+
+} // namespace svx
diff --git a/cui/source/options/optHeaderTabListbox.hxx b/cui/source/options/optHeaderTabListbox.hxx
new file mode 100644
index 000000000000..26608d9791b8
--- /dev/null
+++ b/cui/source/options/optHeaderTabListbox.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * 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: optHeaderTabListbox.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SVX_OPTHEADERTABLISTBOX_HXX
+#define SVX_OPTHEADERTABLISTBOX_HXX
+
+#include <svtools/svtabbx.hxx>
+
+namespace svx
+{
+ // class OptHeaderTabListBox ---------------------------------------------
+
+ class OptHeaderTabListBox : public SvHeaderTabListBox
+ {
+ public:
+ OptHeaderTabListBox( Window* pParent, WinBits nBits );
+
+ virtual void InitEntry( SvLBoxEntry*, const XubString&, const Image&, const Image&, SvLBoxButtonKind );
+ };
+} // svx
+#endif // SVX_OPTHEADERTABLISTBOX_HXX
+
diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx
new file mode 100644
index 000000000000..7cdc58198f9a
--- /dev/null
+++ b/cui/source/options/optaccessibility.cxx
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * 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: optaccessibility.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <optaccessibility.hxx>
+#include <optaccessibility.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <svtools/accessibilityoptions.hxx>
+#include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
+
+static void MovePosY( Window& _rWin, long _nDelta )
+{
+ Point aPoint = _rWin.GetPosPixel();
+ aPoint.Y() += _nDelta;
+
+ _rWin.SetPosPixel( aPoint );
+}
+
+struct SvxAccessibilityOptionsTabPage_Impl
+{
+ SvtAccessibilityOptions m_aConfig;
+ SvxAccessibilityOptionsTabPage_Impl()
+ : m_aConfig(){}
+};
+
+SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage( Window* pParent, const SfxItemSet& rSet )
+ :SfxTabPage(pParent, SVX_RES( RID_SVXPAGE_ACCESSIBILITYCONFIG ), rSet)
+ ,m_aMiscellaneousLabel (this, SVX_RES(FL_MISCELLANEOUS ))
+ ,m_aAccessibilityTool (this, SVX_RES(CB_ACCESSIBILITY_TOOL ))
+ ,m_aTextSelectionInReadonly (this, SVX_RES(CB_TEXTSELECTION ))
+ ,m_aAnimatedGraphics (this, SVX_RES(CB_ANIMATED_GRAPHICS ))
+ ,m_aAnimatedTexts (this, SVX_RES(CB_ANIMATED_TEXTS ))
+ ,m_aTipHelpCB (this, SVX_RES(CB_TIPHELP ))
+ ,m_aTipHelpNF (this, SVX_RES(NF_TIPHELP ))
+ ,m_aTipHelpFT (this, SVX_RES(FT_TIPHELP ))
+ ,m_aHCOptionsLabel (this, SVX_RES(FL_HC_OPTIONS ))
+ ,m_aAutoDetectHC (this, SVX_RES(CB_AUTO_DETECT_HC ))
+ ,m_aAutomaticFontColor (this, SVX_RES(CB_AUTOMATIC_FONT_COLOR))
+ ,m_aPagePreviews (this, SVX_RES(CB_PAGE_PREVIEWS ))
+ ,m_pImpl(new SvxAccessibilityOptionsTabPage_Impl)
+{
+ FreeResource();
+ m_aTipHelpCB.SetClickHdl(LINK(this, SvxAccessibilityOptionsTabPage, TipHelpHdl));
+
+ long nHeightDelta = 0; // to correct positions _under_ m_aAccessibilityTool
+
+#ifdef UNX
+ {
+ // UNIX: read the gconf2 setting instead to use the checkbox
+ m_aAccessibilityTool.Hide();
+ nHeightDelta = -( ROWA_2 - ROWA_1 );
+ }
+#else
+ // calculate the height of the checkbox. Do we need two (default in resource) or only one line
+ String aText = m_aAccessibilityTool.GetText();
+ long nWidth = m_aAccessibilityTool.GetTextWidth( aText );
+ long nCtrlWidth = m_aAccessibilityTool.GetSizePixel().Width() - ( COL2 - COL1 );
+ if ( nWidth > nCtrlWidth )
+ {
+ long nDelta = 2 * RSC_CD_FIXEDLINE_HEIGHT + LINESPACE - RSC_CD_CHECKBOX_HEIGHT;
+ nHeightDelta = nDelta;
+ Size aSize = m_aAccessibilityTool.LogicToPixel( Size( 0, nDelta ), MAP_APPFONT );
+ nDelta = aSize.Height();
+ aSize = m_aAccessibilityTool.GetSizePixel();
+ aSize.Height() += nDelta;
+ m_aAccessibilityTool.SetSizePixel( aSize );
+ }
+#endif
+
+ if( nHeightDelta )
+ { //adjust positions of controls under m_aAccessibilityTool
+ Size aSize = m_aAccessibilityTool.LogicToPixel( Size( 0, nHeightDelta ), MAP_APPFONT );
+ nHeightDelta = aSize.Height();
+
+ MovePosY( m_aTextSelectionInReadonly, nHeightDelta );
+ MovePosY( m_aAnimatedGraphics, nHeightDelta );
+ MovePosY( m_aAnimatedTexts, nHeightDelta );
+ MovePosY( m_aTipHelpCB, nHeightDelta );
+ MovePosY( m_aTipHelpNF, nHeightDelta );
+ MovePosY( m_aTipHelpFT, nHeightDelta );
+ MovePosY( m_aHCOptionsLabel, nHeightDelta );
+ MovePosY( m_aAutoDetectHC, nHeightDelta );
+ MovePosY( m_aAutomaticFontColor, nHeightDelta );
+ MovePosY( m_aPagePreviews, nHeightDelta );
+ }
+}
+
+SvxAccessibilityOptionsTabPage::~SvxAccessibilityOptionsTabPage()
+{
+ delete m_pImpl;
+}
+
+SfxTabPage* SvxAccessibilityOptionsTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxAccessibilityOptionsTabPage(pParent, rAttrSet);
+}
+
+BOOL SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet& )
+{
+ //aConfig.Set... from controls
+
+ m_pImpl->m_aConfig.SetIsForPagePreviews( m_aPagePreviews.IsChecked() );
+ m_pImpl->m_aConfig.SetIsHelpTipsDisappear( m_aTipHelpCB.IsChecked() );
+ m_pImpl->m_aConfig.SetHelpTipSeconds( (short)m_aTipHelpNF.GetValue() );
+ m_pImpl->m_aConfig.SetIsAllowAnimatedGraphics( m_aAnimatedGraphics.IsChecked() );
+ m_pImpl->m_aConfig.SetIsAllowAnimatedText( m_aAnimatedTexts.IsChecked() );
+ m_pImpl->m_aConfig.SetIsAutomaticFontColor( m_aAutomaticFontColor.IsChecked() );
+ m_pImpl->m_aConfig.SetSelectionInReadonly( m_aTextSelectionInReadonly.IsChecked());
+ m_pImpl->m_aConfig.SetAutoDetectSystemHC( m_aAutoDetectHC.IsChecked());
+
+ if(m_pImpl->m_aConfig.IsModified())
+ m_pImpl->m_aConfig.Commit();
+
+ AllSettings aAllSettings = Application::GetSettings();
+ MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
+#ifndef UNX
+ aMiscSettings.SetEnableATToolSupport( m_aAccessibilityTool.IsChecked() );
+#endif
+ aAllSettings.SetMiscSettings(aMiscSettings);
+ Application::SetSettings(aAllSettings);
+ Application::MergeSystemSettings( aAllSettings );
+
+ return FALSE;
+}
+
+void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet& )
+{
+ //set controls from aConfig.Get...
+
+ m_aPagePreviews.Check( m_pImpl->m_aConfig.GetIsForPagePreviews() );
+ EnableTipHelp( m_pImpl->m_aConfig.GetIsHelpTipsDisappear() );
+ m_aTipHelpNF.SetValue( m_pImpl->m_aConfig.GetHelpTipSeconds() );
+ m_aAnimatedGraphics.Check( m_pImpl->m_aConfig.GetIsAllowAnimatedGraphics() );
+ m_aAnimatedTexts.Check( m_pImpl->m_aConfig.GetIsAllowAnimatedText() );
+ m_aAutomaticFontColor.Check( m_pImpl->m_aConfig.GetIsAutomaticFontColor() );
+// m_aSystemFont.Check( m_pImpl->m_aConfig.GetIsSystemFont() );
+ m_aTextSelectionInReadonly.Check( m_pImpl->m_aConfig.IsSelectionInReadonly() );
+ m_aAutoDetectHC.Check( m_pImpl->m_aConfig.GetAutoDetectSystemHC() );
+
+
+ AllSettings aAllSettings = Application::GetSettings();
+ MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
+ m_aAccessibilityTool.Check( aMiscSettings.GetEnableATToolSupport() );
+}
+
+IMPL_LINK(SvxAccessibilityOptionsTabPage, TipHelpHdl, CheckBox*, pBox)
+{
+ sal_Bool bChecked = pBox->IsChecked();
+ m_aTipHelpNF.Enable(bChecked);
+ return 0;
+}
+
+void SvxAccessibilityOptionsTabPage::EnableTipHelp(sal_Bool bCheck)
+{
+ m_aTipHelpCB.Check(bCheck);
+ m_aTipHelpNF.Enable(bCheck);
+}
diff --git a/cui/source/options/optaccessibility.hrc b/cui/source/options/optaccessibility.hrc
new file mode 100644
index 000000000000..248cf16bc96e
--- /dev/null
+++ b/cui/source/options/optaccessibility.hrc
@@ -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: optaccessibility.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTACCESSIBILITY_HRC
+#define _SVX_OPTACCESSIBILITY_HRC
+
+#include <svtools/controldims.hrc>
+
+// defines for positions and sizes
+
+#define GB_WIDTH 248
+#define CB_WIDTH 240
+#define EDIT_WIDTH 25
+
+#define COL0 6
+#define COL1 (COL0+6)
+#define COL2 (COL1+10)
+#define COL3 (COL1+(CB_WIDTH * 2/3))
+#define COL4 (COL3+EDIT_WIDTH+RSC_SP_CTRL_DESC_X)
+
+#define UNIT_WIDTH (COL1+CB_WIDTH-COL4)
+
+#define ROWSPACE RSC_SP_CTRL_DESC_Y
+#define LINESPACE 1
+#define GROUPSPACE RSC_SP_CTRL_DESC_Y + 2
+#define ROWA_0 3
+#define ROWA_1 ( ROWA_0 + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE )
+#define ROWA_2 ( ROWA_1 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE )
+#define ROWA_3 ( ROWA_2 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE )
+#define ROWA_4 ( ROWA_3 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE )
+#define ROWA_5 ( ROWA_4 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE )
+
+#define ROWB_0 ( ROWA_5 + RSC_CD_TEXTBOX_HEIGHT + ROWSPACE + GROUPSPACE )
+#define ROWB_1 ( ROWB_0 + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE )
+#define ROWB_2 ( ROWB_1 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE )
+#define ROWB_3 ( ROWB_2 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE )
+
+#define WHOLE_HEIGHT 185
+#define LASTTEXT_HEIGHT (WHOLE_HEIGHT-ROWB_8)
+#define OFFS_TEXTBOX_FIXEDTEXT(base) (base+(RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+#define DIFF(v1,v2) (v2-v1)
+#define SUM(v1,v2) (v2+v1)
+
+//
+
+#define FL_MISCELLANEOUS 1
+#define CB_PAGE_PREVIEWS 2
+#define FL_HC_OPTIONS 3
+#define CB_TIPHELP 4
+#define NF_TIPHELP 5
+#define FT_TIPHELP 6
+#define CB_ANIMATED_GRAPHICS 7
+#define CB_ANIMATED_TEXTS 8
+#define CB_AUTOMATIC_FONT_COLOR 9
+#define CB_SYSTEM_FONT 10
+#define CB_ACCESSIBILITY_TOOL 11
+#define CB_TEXTSELECTION 12
+#define CB_AUTO_DETECT_HC 13
+
+#endif
+
diff --git a/cui/source/options/optaccessibility.hxx b/cui/source/options/optaccessibility.hxx
new file mode 100644
index 000000000000..ff0eee457c1a
--- /dev/null
+++ b/cui/source/options/optaccessibility.hxx
@@ -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: optaccessibility.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTACCESSIBILITY_HXX
+#define _SVX_OPTACCESSIBILITY_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+struct SvxAccessibilityOptionsTabPage_Impl;
+class SvxAccessibilityOptionsTabPage : public SfxTabPage
+{
+ FixedLine m_aMiscellaneousLabel; // FL_MISCELLANEOUS
+ CheckBox m_aAccessibilityTool; // CB_ACCESSIBILITY_TOOL
+ CheckBox m_aTextSelectionInReadonly; // CB_TEXTSELECTION
+ CheckBox m_aAnimatedGraphics; // CB_ANIMATED_GRAPHICS
+ CheckBox m_aAnimatedTexts; // CB_ANIMATED_TEXTS
+ CheckBox m_aTipHelpCB; // CB_TIPHELP
+ NumericField m_aTipHelpNF; // NF_TIPHELP
+ FixedText m_aTipHelpFT; // FT_TIPHELP
+ FixedLine m_aHCOptionsLabel; // FL_HC_OPTIONS
+ CheckBox m_aAutoDetectHC; // CB_AUTO_DETECT_HC
+ CheckBox m_aAutomaticFontColor; // CB_AUTOMATIC_FONT_COLOR
+ CheckBox m_aPagePreviews; // CB_PAGEPREVIEWS
+
+ DECL_LINK(TipHelpHdl, CheckBox*);
+ void EnableTipHelp(sal_Bool bCheck);
+
+ SvxAccessibilityOptionsTabPage_Impl* m_pImpl;
+
+ SvxAccessibilityOptionsTabPage( Window* pParent, const SfxItemSet& rSet );
+public:
+
+ virtual ~SvxAccessibilityOptionsTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif
+
diff --git a/cui/source/options/optaccessibility.src b/cui/source/options/optaccessibility.src
new file mode 100644
index 000000000000..676c54f6ee61
--- /dev/null
+++ b/cui/source/options/optaccessibility.src
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * 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: optaccessibility.src,v $
+ * $Revision: 1.36 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <optaccessibility.hrc>
+#include <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+
+TabPage RID_SVXPAGE_ACCESSIBILITYCONFIG
+{
+ HelpId = HID_OPTIONS_ACCESSIBILITYCONFIG ;
+ Size = MAP_APPFONT ( 260 , WHOLE_HEIGHT ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ FixedLine FL_MISCELLANEOUS
+ {
+ Pos = MAP_APPFONT ( COL0, ROWA_0 ) ;
+ Size = MAP_APPFONT ( GB_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Miscellaneous options";
+ };
+ CheckBox CB_ACCESSIBILITY_TOOL
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWA_1 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ WordBreak = TRUE;
+ Text [ en-US ] = "Support ~assistive technology tools (program restart required)";
+ };
+ CheckBox CB_TEXTSELECTION
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWA_2 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Use te~xt selection cursor in read-only text documents";
+ };
+ CheckBox CB_ANIMATED_GRAPHICS
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWA_3 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Allow animated ~graphics";
+ };
+ CheckBox CB_ANIMATED_TEXTS
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWA_4 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Allow animated ~text";
+ };
+ CheckBox CB_TIPHELP
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROWA_5 ) );
+ Size = MAP_APPFONT( DIFF(COL2,COL3), RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Help tips disappear after ";
+ };
+ NumericField NF_TIPHELP
+ {
+ TabStop = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL3, ROWA_5 );
+ Size = MAP_APPFONT( EDIT_WIDTH, RSC_CD_TEXTBOX_HEIGHT );
+ Minimum = 1;
+ Maximum = 99;
+ First = 1 ;
+ Last = 99 ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
+ FixedText FT_TIPHELP
+ {
+ Pos = MAP_APPFONT( COL4, OFFS_TEXTBOX_FIXEDTEXT( ROWA_5 ) );
+ Size = MAP_APPFONT( UNIT_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "seconds";
+ };
+ FixedLine FL_HC_OPTIONS
+ {
+ Pos = MAP_APPFONT ( COL0, ROWB_0 ) ;
+ Size = MAP_APPFONT ( GB_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Options for high contrast appearance";
+ };
+ CheckBox CB_AUTO_DETECT_HC
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWB_1 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Automatically ~detect high contrast mode of operating system";
+ };
+ CheckBox CB_AUTOMATIC_FONT_COLOR
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWB_2 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Use automatic font ~color for screen display";
+ };
+ CheckBox CB_PAGE_PREVIEWS
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWB_3 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Use system colors for page previews";
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx
new file mode 100644
index 000000000000..cb247edd3f87
--- /dev/null
+++ b/cui/source/options/optasian.cxx
@@ -0,0 +1,470 @@
+/*************************************************************************
+ *
+ * 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: optasian.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <optasian.hxx>
+#include <svx/langitem.hxx>
+#include <svx/unolingu.hxx>
+#include <optasian.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <tools/table.hxx>
+#include <tools/shl.hxx>
+#include <svx/asiancfg.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/svapp.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/localedatawrapper.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::i18n;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::beans;
+using rtl::OUString;
+
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+
+const sal_Char cIsKernAsianPunctuation[] = "IsKernAsianPunctuation";
+const sal_Char cCharacterCompressionType[] = "CharacterCompressionType";
+
+struct SvxForbiddenChars_Impl
+{
+ sal_Bool bRemoved;
+ ForbiddenCharacters* pCharacters;
+};
+
+DECLARE_TABLE( _SvxForbiddenCharacterTable_Impl, SvxForbiddenChars_Impl* )
+
+class SvxForbiddenCharacterTable_Impl : public _SvxForbiddenCharacterTable_Impl
+{
+public:
+ SvxForbiddenCharacterTable_Impl()
+ : _SvxForbiddenCharacterTable_Impl( 4, 4 )
+ {}
+ ~SvxForbiddenCharacterTable_Impl();
+};
+
+struct SvxAsianLayoutPage_Impl
+{
+ SvxAsianConfig aConfig;
+ SvxAsianLayoutPage_Impl() :
+ aConfig(sal_False){}
+
+ Reference< XForbiddenCharacters > xForbidden;
+ Reference< XPropertySet > xPrSet;
+ Reference< XPropertySetInfo > xPrSetInfo;
+ SvxForbiddenCharacterTable_Impl aChangedLanguagesTbl;
+
+ sal_Bool hasForbiddenCharacters(LanguageType eLang);
+ SvxForbiddenChars_Impl* getForbiddenCharacters(LanguageType eLang);
+ void addForbiddenCharacters(LanguageType eLang, ForbiddenCharacters* pForbidden);
+};
+/* -----------------------------24.01.01 14:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxForbiddenCharacterTable_Impl::~SvxForbiddenCharacterTable_Impl()
+{
+ for( SvxForbiddenChars_Impl* pDel = First(); pDel; pDel = Next() )
+ {
+ delete pDel->pCharacters;
+ delete pDel;
+ }
+}
+/* -----------------------------24.01.01 14:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SvxAsianLayoutPage_Impl::hasForbiddenCharacters(LanguageType eLang)
+{
+ return 0 != aChangedLanguagesTbl.Get(eLang);
+}
+/* -----------------------------24.01.01 14:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxForbiddenChars_Impl* SvxAsianLayoutPage_Impl::getForbiddenCharacters(LanguageType eLang)
+{
+ SvxForbiddenChars_Impl* pImp = aChangedLanguagesTbl.Get(eLang);
+ DBG_ASSERT(pImp, "language not available");
+ if(pImp)
+ return pImp;
+ return 0;
+}
+/* -----------------------------24.01.01 14:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxAsianLayoutPage_Impl::addForbiddenCharacters(
+ LanguageType eLang, ForbiddenCharacters* pForbidden)
+{
+ SvxForbiddenChars_Impl* pOld = aChangedLanguagesTbl.Get(eLang);
+ if( !pOld )
+ {
+ pOld = new SvxForbiddenChars_Impl;
+ pOld->bRemoved = 0 == pForbidden;
+ pOld->pCharacters = pForbidden ? new ForbiddenCharacters(*pForbidden) : 0;
+ aChangedLanguagesTbl.Insert( eLang, pOld );
+ }
+ else
+ {
+ pOld->bRemoved = 0 == pForbidden;
+ delete pOld->pCharacters;
+ pOld->pCharacters = pForbidden ? new ForbiddenCharacters(*pForbidden) : 0;
+ }
+
+}
+/*-- 09.01.01 13:29:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+static LanguageType eLastUsedLanguageTypeForForbiddenCharacters = USHRT_MAX;
+
+SvxAsianLayoutPage::SvxAsianLayoutPage( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SVX_RES( RID_SVXPAGE_ASIAN_LAYOUT ), rSet),
+ aKerningGB( this, SVX_RES(GB_KERNING )),
+ aCharKerningRB( this, SVX_RES(RB_CHAR_KERNING )),
+ aCharPunctKerningRB( this, SVX_RES(RB_CHAR_PUNCT )),
+ aCharDistGB( this, SVX_RES(GB_CHAR_DIST )),
+ aNoCompressionRB( this, SVX_RES(RB_NO_COMP )),
+ aPunctCompressionRB( this, SVX_RES(RB_PUNCT_COMP )),
+ aPunctKanaCompressionRB(this, SVX_RES(RB_PUNCT_KANA_COMP )),
+ aStartEndGB( this, SVX_RES(GB_START_END )),
+ aLanguageFT( this, SVX_RES(FT_LANGUAGE )),
+ aLanguageLB( this, SVX_RES(LB_LANGUAGE )),
+ aStandardCB( this, SVX_RES(CB_STANDARD )),
+ aStartFT( this, SVX_RES(FT_START )),
+ aStartED( this, SVX_RES(ED_START )),
+ aEndFT( this, SVX_RES(FT_END )),
+ aEndED( this, SVX_RES(ED_END )),
+ aHintFT( this, SVX_RES(FT_HINT )),
+ pImpl(new SvxAsianLayoutPage_Impl)
+{
+ FreeResource();
+ LanguageHdl(&aLanguageLB);
+ aLanguageLB.SetSelectHdl(LINK(this, SvxAsianLayoutPage, LanguageHdl));
+ aStandardCB.SetClickHdl(LINK(this, SvxAsianLayoutPage, ChangeStandardHdl));
+ Link aLk(LINK(this, SvxAsianLayoutPage, ModifyHdl));
+ aStartED.SetModifyHdl(aLk);
+ aEndED.SetModifyHdl(aLk);
+
+ aLanguageLB.SetLanguageList( LANG_LIST_FBD_CHARS, FALSE, FALSE );
+}
+/*-- 09.01.01 13:29:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SvxAsianLayoutPage::~SvxAsianLayoutPage()
+{
+ delete pImpl;
+}
+/*-- 09.01.01 13:29:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage* SvxAsianLayoutPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxAsianLayoutPage(pParent, rAttrSet);
+}
+/*-- 09.01.01 13:29:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SvxAsianLayoutPage::FillItemSet( SfxItemSet& )
+{
+ if(aCharKerningRB.IsChecked() != aCharKerningRB.GetSavedValue())
+ {
+ pImpl->aConfig.SetKerningWesternTextOnly(aCharKerningRB.IsChecked());
+ OUString sPunct(C2U(cIsKernAsianPunctuation));
+ if(pImpl->xPrSetInfo.is() && pImpl->xPrSetInfo->hasPropertyByName(sPunct))
+ {
+ Any aVal;
+ BOOL bVal = !aCharKerningRB.IsChecked();
+ aVal.setValue(&bVal, ::getBooleanCppuType());
+ pImpl->xPrSet->setPropertyValue(sPunct, aVal);
+ }
+ }
+
+ if(aNoCompressionRB.IsChecked() != aNoCompressionRB.GetSavedValue() ||
+ aPunctCompressionRB.IsChecked() != aPunctCompressionRB.GetSavedValue())
+ {
+ sal_Int16 nSet = aNoCompressionRB.IsChecked() ? 0 :
+ aPunctCompressionRB.IsChecked() ? 1 : 2;
+ pImpl->aConfig.SetCharDistanceCompression(nSet);
+ OUString sCompress(C2U(cCharacterCompressionType));
+ if(pImpl->xPrSetInfo.is() && pImpl->xPrSetInfo->hasPropertyByName(sCompress))
+ {
+ Any aVal;
+ aVal <<= nSet;
+ pImpl->xPrSet->setPropertyValue(sCompress, aVal);
+ }
+ }
+ if(pImpl->aConfig.IsModified())
+ pImpl->aConfig.Commit();
+ if(pImpl->xForbidden.is())
+ {
+ try
+ {
+ for( SvxForbiddenChars_Impl* pElem = pImpl->aChangedLanguagesTbl.First();
+ pElem; pElem = pImpl->aChangedLanguagesTbl.Next() )
+ {
+ ULONG nLang = pImpl->aChangedLanguagesTbl.GetKey( pElem );
+ Locale aLocale;
+ SvxLanguageToLocale(aLocale, (USHORT)nLang );
+ if(pElem->bRemoved)
+ pImpl->xForbidden->removeForbiddenCharacters( aLocale );
+ else if(pElem->pCharacters)
+ pImpl->xForbidden->setForbiddenCharacters( aLocale, *pElem->pCharacters );
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("exception in XForbiddenCharacters");
+ }
+ }
+ eLastUsedLanguageTypeForForbiddenCharacters = aLanguageLB.GetSelectLanguage();
+
+ return FALSE;
+}
+/*-- 09.01.01 13:29:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SvxAsianLayoutPage::Reset( const SfxItemSet& )
+{
+ SfxViewFrame* pCurFrm = SfxViewFrame::Current();
+ SfxObjectShell* pDocSh = pCurFrm ? pCurFrm->GetObjectShell() : 0;
+ Reference< XModel > xModel;
+ if(pDocSh)
+ xModel = pDocSh->GetModel();
+ Reference<XMultiServiceFactory> xFact(xModel, UNO_QUERY);
+ if(xFact.is())
+ {
+ pImpl->xPrSet = Reference<XPropertySet>(
+ xFact->createInstance(C2U("com.sun.star.document.Settings")), UNO_QUERY);
+ }
+ if( pImpl->xPrSet.is() )
+ pImpl->xPrSetInfo = pImpl->xPrSet->getPropertySetInfo();
+ OUString sForbidden(C2U("ForbiddenCharacters"));
+ sal_Bool bKernWesternText = pImpl->aConfig.IsKerningWesternTextOnly();
+ sal_Int16 nCompress = pImpl->aConfig.GetCharDistanceCompression();
+ if(pImpl->xPrSetInfo.is())
+ {
+ if(pImpl->xPrSetInfo->hasPropertyByName(sForbidden))
+ {
+ Any aForbidden = pImpl->xPrSet->getPropertyValue(sForbidden);
+ aForbidden >>= pImpl->xForbidden;
+ }
+ OUString sCompress(C2U(cCharacterCompressionType));
+ if(pImpl->xPrSetInfo->hasPropertyByName(sCompress))
+ {
+ Any aVal = pImpl->xPrSet->getPropertyValue(sCompress);
+ aVal >>= nCompress;
+ }
+ OUString sPunct(C2U(cIsKernAsianPunctuation));
+ if(pImpl->xPrSetInfo->hasPropertyByName(sPunct))
+ {
+ Any aVal = pImpl->xPrSet->getPropertyValue(sPunct);
+ bKernWesternText = !*(sal_Bool*)aVal.getValue();
+ }
+ }
+ else
+ {
+ aStartEndGB.Enable(FALSE);
+ aLanguageFT.Enable(FALSE);
+ aLanguageLB.Enable(FALSE);
+ aStandardCB.Enable(FALSE);
+ aStartFT.Enable(FALSE);
+ aStartED.Enable(FALSE);
+ aEndFT.Enable(FALSE);
+ aEndED.Enable(FALSE);
+ aHintFT.Enable(FALSE);
+ }
+ if(bKernWesternText)
+ aCharKerningRB.Check(TRUE);
+ else
+ aCharPunctKerningRB.Check(TRUE);
+ switch(nCompress)
+ {
+ case 0 : aNoCompressionRB.Check(); break;
+ case 1 : aPunctCompressionRB.Check(); break;
+ default: aPunctKanaCompressionRB.Check();
+ }
+ aCharKerningRB.SaveValue();
+ aNoCompressionRB.SaveValue();
+ aPunctCompressionRB.SaveValue();
+ aPunctKanaCompressionRB.SaveValue();
+
+ aLanguageLB.SelectEntryPos(0);
+ //preselect the system language in the box - if available
+ if(USHRT_MAX == eLastUsedLanguageTypeForForbiddenCharacters)
+ {
+ eLastUsedLanguageTypeForForbiddenCharacters = SvxLocaleToLanguage(
+ Application::GetSettings().GetLocale() );
+ switch(eLastUsedLanguageTypeForForbiddenCharacters)
+ {
+ case LANGUAGE_CHINESE :
+ case LANGUAGE_CHINESE_SINGAPORE :
+ eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_SIMPLIFIED;
+ break;
+ case LANGUAGE_CHINESE_HONGKONG :
+ case LANGUAGE_CHINESE_MACAU :
+ eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_TRADITIONAL;
+ break;
+ }
+ }
+ aLanguageLB.SelectLanguage( eLastUsedLanguageTypeForForbiddenCharacters );
+ LanguageHdl(&aLanguageLB);
+}
+/* -----------------------------17.01.01 11:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxAsianLayoutPage, LanguageHdl, SvxLanguageBox*, EMPTYARG )
+{
+ //set current value
+ Locale aLocale;
+ LanguageType eSelectLanguage = aLanguageLB.GetSelectLanguage();
+ SvxLanguageToLocale(aLocale, eSelectLanguage );
+
+ OUString sStart, sEnd;
+ sal_Bool bAvail;
+ if(pImpl->xForbidden.is())
+ {
+ bAvail = pImpl->hasForbiddenCharacters(eSelectLanguage);
+ if(bAvail)
+ {
+ SvxForbiddenChars_Impl* pElement = pImpl->getForbiddenCharacters(eSelectLanguage);
+ if(pElement->bRemoved || !pElement->pCharacters)
+ {
+ bAvail = FALSE;
+ }
+ else
+ {
+ sStart = pElement->pCharacters->beginLine;
+ sEnd = pElement->pCharacters->endLine;
+ }
+ }
+ else
+ {
+ try
+ {
+ bAvail = pImpl->xForbidden->hasForbiddenCharacters(aLocale);
+ if(bAvail)
+ {
+ ForbiddenCharacters aForbidden = pImpl->xForbidden->getForbiddenCharacters( aLocale );
+ sStart = aForbidden.beginLine;
+ sEnd = aForbidden.endLine;
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("exception in XForbiddenCharacters");
+ }
+ }
+ }
+ else
+ {
+ bAvail = pImpl->aConfig.GetStartEndChars( aLocale, sStart, sEnd );
+ }
+ if(!bAvail)
+ {
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ LocaleDataWrapper aWrap( xMSF, aLocale );
+ ForbiddenCharacters aForbidden = aWrap.getForbiddenCharacters();
+ sStart = aForbidden.beginLine;
+ sEnd = aForbidden.endLine;
+ }
+ aStandardCB.Check(!bAvail);
+ aStartED.Enable(bAvail);
+ aEndED.Enable(bAvail);
+ aStartFT.Enable(bAvail);
+ aEndFT.Enable(bAvail);
+ aStartED.SetText(sStart);
+ aEndED.SetText(sEnd);
+
+ return 0;
+}
+/* -----------------------------17.01.01 11:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxAsianLayoutPage, ChangeStandardHdl, CheckBox*, pBox)
+{
+ sal_Bool bCheck = pBox->IsChecked();
+ aStartED.Enable(!bCheck);
+ aEndED.Enable(!bCheck);
+ aStartFT.Enable(!bCheck);
+ aEndFT.Enable(!bCheck);
+
+ ModifyHdl(&aStartED);
+ return 0;
+}
+/* -----------------------------17.01.01 12:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxAsianLayoutPage, ModifyHdl, Edit*, pEdit)
+{
+ Locale aLocale;
+ LanguageType eSelectLanguage = aLanguageLB.GetSelectLanguage();
+ SvxLanguageToLocale(aLocale, eSelectLanguage );
+ OUString sStart = aStartED.GetText();
+ OUString sEnd = aEndED.GetText();
+ sal_Bool bEnable = pEdit->IsEnabled();
+ if(pImpl->xForbidden.is())
+ {
+ try
+ {
+ if(bEnable)
+ {
+ ForbiddenCharacters aSet;
+ aSet.beginLine = sStart;
+ aSet.endLine = sEnd;
+// pImpl->xForbidden->setForbiddenCharacters( aLocale, aSet );
+ pImpl->addForbiddenCharacters(eSelectLanguage, &aSet);
+ }
+ else
+ pImpl->addForbiddenCharacters(eSelectLanguage, 0);
+// pImpl->xForbidden->removeForbiddenCharacters( aLocale );
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("exception in XForbiddenCharacters");
+ }
+ }
+ pImpl->aConfig.SetStartEndChars( aLocale, bEnable ? &sStart : 0, bEnable ? &sEnd : 0);
+ return 0;
+}
+/*-- 07.09.2007 12:05:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+USHORT* SvxAsianLayoutPage::GetRanges()
+{
+ //no items are used
+ static USHORT pAsianLayoutRanges[] = { 0 };
+ return pAsianLayoutRanges;
+}
diff --git a/cui/source/options/optasian.hrc b/cui/source/options/optasian.hrc
new file mode 100644
index 000000000000..2d9c8a282352
--- /dev/null
+++ b/cui/source/options/optasian.hrc
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * 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: optasian.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTASIAN_HRC
+#define _SVX_OPTASIAN_HRC
+
+#define GB_KERNING 1
+#define RB_CHAR_KERNING 2
+#define RB_CHAR_PUNCT 3
+#define GB_CHAR_DIST 4
+#define RB_NO_COMP 5
+#define RB_PUNCT_COMP 6
+#define RB_PUNCT_KANA_COMP 7
+#define GB_START_END 8
+#define CB_STANDARD 9
+
+#define FT_LANGUAGE 11
+#define LB_LANGUAGE 12
+#define FT_START 13
+#define ED_START 14
+#define FT_END 15
+#define ED_END 16
+#define FT_HINT 17
+
+#endif
+
diff --git a/cui/source/options/optasian.src b/cui/source/options/optasian.src
new file mode 100644
index 000000000000..6a09421fcf2c
--- /dev/null
+++ b/cui/source/options/optasian.src
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * 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: optasian.src,v $
+ * $Revision: 1.48 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <optasian.hrc>
+#include <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+
+TabPage RID_SVXPAGE_ASIAN_LAYOUT
+{
+ HelpId = HID_OPTIONS_ASIAN_LAYOUT ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ FixedLine GB_KERNING
+ {
+ Pos = MAP_APPFONT ( 6, 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Kerning";
+ };
+ RadioButton RB_CHAR_KERNING
+ {
+ Pos = MAP_APPFONT ( 12, 14 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ Text [ en-US ] = "~Western characters only";
+ };
+ RadioButton RB_CHAR_PUNCT
+ {
+ Pos = MAP_APPFONT ( 12, 27 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ Text [ en-US ] = "Western ~text and Asian punctuation";
+ };
+ FixedLine GB_CHAR_DIST
+ {
+ Pos = MAP_APPFONT ( 6, 43 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Character spacing";
+ };
+ RadioButton RB_NO_COMP
+ {
+ Pos = MAP_APPFONT ( 12, 54 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ Text [ en-US ] = "~No compression";
+ };
+ RadioButton RB_PUNCT_COMP
+ {
+ Pos = MAP_APPFONT ( 12, 67) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ Text [ en-US ] = "~Compress punctuation only";
+ };
+ RadioButton RB_PUNCT_KANA_COMP
+ {
+ Pos = MAP_APPFONT ( 12, 80 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ Text [ en-US ] = "Compress ~punctuation and Japanese Kana";
+ };
+ FixedLine GB_START_END
+ {
+ Pos = MAP_APPFONT ( 6, 96 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "First and last characters";
+ };
+ FixedText FT_LANGUAGE
+ {
+ Pos = MAP_APPFONT ( 12 , 109 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "~Language";
+ };
+ ListBox LB_LANGUAGE
+ {
+ Pos = MAP_APPFONT ( 95 , 107 ) ;
+ Size = MAP_APPFONT ( 80 , 48 ) ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ };
+ CheckBox CB_STANDARD
+ {
+ Pos = MAP_APPFONT ( 180, 109 ) ;
+ Size = MAP_APPFONT ( 74 , 10 ) ;
+ Text [ en-US ] = "~Default";
+ };
+ FixedText FT_START
+ {
+ Pos = MAP_APPFONT ( 12 , 125 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Not at start of line:";
+ };
+ Edit ED_START
+ {
+ Pos = MAP_APPFONT ( 95 , 123 ) ;
+ Size = MAP_APPFONT ( 159 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_END
+ {
+ Pos = MAP_APPFONT ( 12 , 141 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Not at end of line:";
+ };
+ Edit ED_END
+ {
+ Pos = MAP_APPFONT ( 95 , 139 ) ;
+ Size = MAP_APPFONT ( 159 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_HINT
+ {
+ Pos = MAP_APPFONT ( 12 , 155 ) ;
+ Size = MAP_APPFONT ( 242 , 8 ) ;
+ Text [ en-US ] = "Without user-defined line break symbols";
+ };
+ Text [ en-US ] = "Proxy";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
new file mode 100644
index 000000000000..6d953edcc80e
--- /dev/null
+++ b/cui/source/options/optchart.cxx
@@ -0,0 +1,238 @@
+/*************************************************************************
+ *
+ * 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: optchart.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <unotools/pathoptions.hxx>
+#include <svx/dialogs.hrc>
+#include "optchart.hxx"
+#include "optchart.hrc"
+#include <svx/dialmgr.hxx>
+
+// ====================
+// class ChartColorLB
+// ====================
+void ChartColorLB::FillBox( const SvxChartColorTable & rTab )
+{
+ long nCount = rTab.size();
+ SetUpdateMode( FALSE );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ Append( const_cast< XColorEntry * >( & rTab[ i ] ));
+ }
+ SetUpdateMode( TRUE );
+}
+
+
+// ====================
+// class SvxDefaultColorOptPage
+// ====================
+SvxDefaultColorOptPage::SvxDefaultColorOptPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_OPTPAGE_CHART_DEFCOLORS ), rInAttrs ),
+
+ aGbChartColors ( this, SVX_RES( FL_CHART_COLOR_LIST ) ),
+ aLbChartColors ( this, SVX_RES( LB_CHART_COLOR_LIST ) ),
+ aGbColorBox ( this, SVX_RES( FL_COLOR_BOX ) ),
+ aValSetColorBox ( this, SVX_RES( CT_COLOR_BOX ) ),
+ aPBDefault ( this, SVX_RES( PB_RESET_TO_DEFAULT ) )
+{
+ FreeResource();
+
+ aPBDefault.SetClickHdl( LINK( this, SvxDefaultColorOptPage, ResetToDefaults ) );
+ aLbChartColors.SetSelectHdl( LINK( this, SvxDefaultColorOptPage, ListClickedHdl ) );
+ aValSetColorBox.SetSelectHdl( LINK( this, SvxDefaultColorOptPage, BoxClickedHdl ) );
+
+ aValSetColorBox.SetStyle( aValSetColorBox.GetStyle()
+ | WB_VSCROLL | WB_ITEMBORDER | WB_NAMEFIELD );
+ aValSetColorBox.SetColCount( 8 );
+ aValSetColorBox.SetLineCount( 12 );
+ aValSetColorBox.SetExtraSpacing( 0 );
+ aValSetColorBox.Show();
+
+ pChartOptions = new SvxChartOptions;
+ pColorTab = new XColorTable( SvtPathOptions().GetPalettePath() );
+
+ const SfxPoolItem* pItem = NULL;
+ if ( rInAttrs.GetItemState( SID_SCH_EDITOPTIONS, FALSE, &pItem ) == SFX_ITEM_SET )
+ {
+ pColorConfig = SAL_STATIC_CAST( SvxChartColorTableItem*, pItem->Clone() );
+ }
+ else
+ {
+ SvxChartColorTable aTable;
+ aTable.useDefault();
+ pColorConfig = new SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aTable );
+ pColorConfig->SetOptions( pChartOptions );
+ }
+
+ Construct();
+}
+
+SvxDefaultColorOptPage::~SvxDefaultColorOptPage()
+{
+ // save changes
+ pChartOptions->SetDefaultColors( pColorConfig->GetColorTable() );
+ pChartOptions->Commit();
+
+ delete pColorConfig;
+ delete pColorTab;
+ delete pChartOptions;
+}
+
+void SvxDefaultColorOptPage::Construct()
+{
+ if( pColorConfig )
+ aLbChartColors.FillBox( pColorConfig->GetColorTable() );
+
+ FillColorBox();
+
+ aLbChartColors.SelectEntryPos( 0 );
+ ListClickedHdl( &aLbChartColors );
+}
+
+
+SfxTabPage* __EXPORT SvxDefaultColorOptPage::Create( Window* pParent, const SfxItemSet& rAttrs )
+{
+ return new SvxDefaultColorOptPage( pParent, rAttrs );
+}
+
+BOOL __EXPORT SvxDefaultColorOptPage::FillItemSet( SfxItemSet& rOutAttrs )
+{
+ if( pColorConfig )
+ rOutAttrs.Put( *SAL_STATIC_CAST( SfxPoolItem*, pColorConfig ));
+
+ return TRUE;
+}
+
+void __EXPORT SvxDefaultColorOptPage::Reset( const SfxItemSet& )
+{
+ aLbChartColors.SelectEntryPos( 0 );
+ ListClickedHdl( &aLbChartColors );
+}
+
+void SvxDefaultColorOptPage::FillColorBox()
+{
+ if( !pColorTab ) return;
+
+ long nCount = pColorTab->Count();
+ XColorEntry* pColorEntry;
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pColorEntry = pColorTab->GetColor( i );
+ aValSetColorBox.InsertItem( (USHORT) i + 1, pColorEntry->GetColor(), pColorEntry->GetName() );
+ }
+}
+
+
+long SvxDefaultColorOptPage::GetColorIndex( const Color& rCol )
+{
+ if( pColorTab )
+ {
+ long nCount = pColorTab->Count();
+ XColorEntry* pColorEntry;
+
+ for( long i = nCount - 1; i >= 0; i-- ) // default chart colors are at the end of the table
+ {
+ pColorEntry = pColorTab->GetColor( i );
+ if( pColorEntry && pColorEntry->GetColor() == rCol )
+ return SAL_STATIC_CAST( XPropertyTable*, pColorTab )->Get( pColorEntry->GetName() );
+ }
+ }
+ return -1L;
+}
+
+
+
+// --------------------
+// event handlers
+// --------------------
+
+// ResetToDefaults
+// ---------------
+
+IMPL_LINK( SvxDefaultColorOptPage, ResetToDefaults, void *, EMPTYARG )
+{
+ if( pColorConfig )
+ {
+ pColorConfig->GetColorTable().useDefault();
+
+ aLbChartColors.Clear();
+ aLbChartColors.FillBox( pColorConfig->GetColorTable() );
+
+ aLbChartColors.GetFocus();
+ }
+
+ return 0L;
+}
+
+// ListClickedHdl
+// --------------
+
+IMPL_LINK( SvxDefaultColorOptPage, ListClickedHdl, ChartColorLB*, pColorList )
+{
+ Color aCol = pColorList->GetSelectEntryColor();
+
+ long nIndex = GetColorIndex( aCol );
+
+ if( nIndex == -1 ) // not found
+ {
+ aValSetColorBox.SetNoSelection();
+ }
+ else
+ {
+ aValSetColorBox.SelectItem( (USHORT)nIndex + 1 ); // ValueSet is 1-based
+ }
+
+ return 0L;
+}
+
+// BoxClickedHdl
+// -------------
+
+IMPL_LINK( SvxDefaultColorOptPage, BoxClickedHdl, ValueSet*, EMPTYARG )
+{
+ USHORT nIdx = aLbChartColors.GetSelectEntryPos();
+ if( nIdx != LISTBOX_ENTRY_NOTFOUND )
+ {
+ XColorEntry aEntry( aValSetColorBox.GetItemColor( aValSetColorBox.GetSelectItemId() ),
+ aLbChartColors.GetSelectEntry() );
+
+ aLbChartColors.Modify( & aEntry, nIdx );
+ pColorConfig->ReplaceColorByIndex( nIdx, aEntry );
+
+ aLbChartColors.SelectEntryPos( nIdx ); // reselect entry
+ }
+
+ return 0L;
+}
+
diff --git a/cui/source/options/optchart.hrc b/cui/source/options/optchart.hrc
new file mode 100644
index 000000000000..ac42f857f8ea
--- /dev/null
+++ b/cui/source/options/optchart.hrc
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * 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: optchart.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// tab page for setting the default colors used for new charts
+
+#define FL_CHART_COLOR_LIST 1
+#define LB_CHART_COLOR_LIST 2
+
+#define FL_COLOR_BOX 3
+#define CT_COLOR_BOX 4
+
+#define PB_RESET_TO_DEFAULT 5
+
diff --git a/cui/source/options/optchart.hxx b/cui/source/options/optchart.hxx
new file mode 100644
index 000000000000..9316d2a8ea85
--- /dev/null
+++ b/cui/source/options/optchart.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * 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: optchart.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_OPTCHART_HXX
+#define _SVX_OPTCHART_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+// header for ValueSet
+#include <svtools/valueset.hxx>
+// header for ColorLB
+#include <svx/dlgctrl.hxx>
+// header for PushButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for XColorTable
+#include <svx/xtable.hxx>
+
+#include "cfgchart.hxx"
+
+class ChartColorLB : public ColorLB
+{
+public:
+ ChartColorLB( Window* pParent, ResId Id ) : ColorLB( pParent, Id ) {}
+ ChartColorLB( Window* pParent, WinBits aWB ) : ColorLB( pParent, aWB ) {}
+
+ void FillBox( const SvxChartColorTable & rTab );
+};
+
+
+class SvxDefaultColorOptPage : public SfxTabPage
+{
+private:
+ FixedLine aGbChartColors;
+ ChartColorLB aLbChartColors;
+ FixedLine aGbColorBox;
+ ValueSet aValSetColorBox;
+ PushButton aPBDefault;
+
+ SvxChartOptions* pChartOptions;
+ SvxChartColorTableItem* pColorConfig;
+ XColorTable* pColorTab;
+
+ DECL_LINK( ResetToDefaults, void * );
+ DECL_LINK( ListClickedHdl, ChartColorLB * );
+ DECL_LINK( BoxClickedHdl, ValueSet * );
+
+ void FillColorBox();
+ long GetColorIndex( const Color& rCol );
+
+public:
+ SvxDefaultColorOptPage( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxDefaultColorOptPage();
+
+ void Construct();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void Reset( const SfxItemSet& rInAttrs );
+};
+
+#endif // _SVX_OPTCHART_HXX
+
diff --git a/cui/source/options/optchart.src b/cui/source/options/optchart.src
new file mode 100644
index 000000000000..bab97295d291
--- /dev/null
+++ b/cui/source/options/optchart.src
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * 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: optchart.src,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "optchart.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+// tab page for setting the default colors used for new charts
+
+TabPage RID_OPTPAGE_CHART_DEFCOLORS
+{
+ HelpID = HID_OPTIONS_CHART_DEFCOLORS;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Default Colors";
+ FixedLine FL_CHART_COLOR_LIST
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Chart colors";
+ Text [ x-comment ] = " ";
+ };
+ ListBox LB_CHART_COLOR_LIST
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 12 , 15 );
+ Size = MAP_APPFONT ( 68 , 152 );
+ DropDown = FALSE;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_COLOR_BOX
+ {
+ Pos = MAP_APPFONT ( 92 , 3 ) ;
+ Size = MAP_APPFONT ( 106 , 8 ) ;
+ Text [ en-US ] = "Color table" ;
+ Text [ x-comment ] = " ";
+ };
+ Control CT_COLOR_BOX
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 98 , 15 );
+ Size = MAP_APPFONT ( 94 , 152 );
+ TabStop = TRUE ;
+ };
+ PushButton PB_RESET_TO_DEFAULT
+ {
+ Pos = MAP_APPFONT ( 204 , 165 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Default";
+ Text [ x-comment ] = " ";
+ };
+};
+
+String RID_SVXSTR_DIAGRAM_ROW
+{
+ // $(ROW) can be a number or the caption of the row in quotes
+
+ Text [ en-US ] = "Data Series $(ROW)" ;
+};
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
new file mode 100644
index 000000000000..c0a703f2a5b1
--- /dev/null
+++ b/cui/source/options/optcolor.cxx
@@ -0,0 +1,1634 @@
+/*************************************************************************
+ *
+ * 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: optcolor.cxx,v $
+ * $Revision: 1.18.256.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <svtools/colorcfg.hxx>
+#include <svtools/extcolorcfg.hxx>
+#include <svtools/headbar.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <vcl/scrbar.hxx>
+#include <svx/xtable.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <unotools/pathoptions.hxx>
+#include <vcl/msgbox.hxx>
+#include <boost/shared_ptr.hpp>
+#include <svx/svxdlg.hxx>
+#include <helpid.hrc>
+#include <svx/svxids.hrc>
+#include <svx/dialmgr.hxx>
+#include "optcolor.hxx"
+#include <svx/dialogs.hrc>
+#include "optcolor.hrc"
+#include <svx/dlgutil.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::svtools;
+
+#define GROUP_COUNT 7
+#define GROUP_UNKNOWN -1
+#define GROUP_GENERAL 0
+#define GROUP_WRITER 1
+#define GROUP_HTML 2
+#define GROUP_CALC 3
+#define GROUP_DRAW 4
+#define GROUP_BASIC 5
+#define GROUP_SQL 6
+
+/* -----------------------------2002/06/26 10:48------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+class SvxExtFixedText_Impl : public FixedText
+{
+private:
+ long m_nGroupHeight;
+
+protected:
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+public:
+ SvxExtFixedText_Impl(Window* pParent, const ResId& rResId) :
+ FixedText(pParent, rResId), m_nGroupHeight(0) {}
+
+ inline long GetGroupHeight() { return m_nGroupHeight; }
+ inline void SetGroupHeight( long _nHeight ) { m_nGroupHeight = _nHeight; }
+};
+
+/* -----------------------------25.03.2002 15:48------------------------------
+
+ ---------------------------------------------------------------------------*/
+class ColorConfigCtrl_Impl;
+class ColorConfigWindow_Impl : public Window
+{
+ friend class ColorConfigCtrl_Impl;
+ Window aGeneralBackWN;
+ SvxExtFixedText_Impl aGeneralFT;
+ FixedText aDocColorFT;
+ ColorListBox aDocColorLB;
+ Window aDocColorWN;
+ CheckBox aDocBoundCB;
+ ColorListBox aDocBoundLB;
+ Window aDocBoundWN;
+ FixedText aAppBackFT;
+ ColorListBox aAppBackLB;
+ Window aAppBackWN;
+ CheckBox aObjBoundCB;
+ ColorListBox aObjBoundLB;
+ Window aObjBoundWN;
+ CheckBox aTableBoundCB;
+ ColorListBox aTableBoundLB;
+ Window aTableBoundWN;
+ FixedText aFontColorFT;
+ ColorListBox aFontColorLB;
+ Window aFontColorWN;
+ CheckBox aLinksCB;
+ ColorListBox aLinksLB;
+ Window aLinksWN;
+ CheckBox aLinksVisitedCB;
+ ColorListBox aLinksVisitedLB;
+ Window aLinksVisitedWN;
+ FixedText aSpellFT;
+ ColorListBox aSpellLB;
+ Window aSpellWN;
+ FixedText aSmarttagsFT;
+ ColorListBox aSmarttagsLB;
+ Window aSmarttagsWN;
+ Window aWriterBackWN;
+ SvxExtFixedText_Impl aWriterFT;
+ FixedText aWrtTextGridFT;
+ ColorListBox aWrtTextGridLB;
+ Window aWrtTextGridWN;
+ CheckBox aWrtFieldCB;
+ ColorListBox aWrtFieldLB;
+ Window aWrtFieldWN;
+ CheckBox aWrtIdxShadingBackCB;
+ ColorListBox aWrtIdxShadingBackLB;
+ Window aWrtIdxShadingBackWN;
+ FixedText aWrtScriptIndicatorFT;
+ ColorListBox aWrtScriptIndicatorLB;
+ Window aWrtScriptIndicatorWN;
+ CheckBox aWrtSectionBoundCB;
+ ColorListBox aWrtSectionBoundLB;
+ Window aWrtSectionBoundWN;
+ FixedText aWrtPageBreaksFT;
+ ColorListBox aWrtPageBreaksLB;
+ Window aWrtPageBreaksWN;
+ FixedText aWrtDirectCrsrFT;
+ ColorListBox aWrtDirectCrsrLB;
+ Window aWrtDirectCrsrWN;
+ Window aHTMLBackWN;
+ SvxExtFixedText_Impl aHTMLFT;
+ FixedText aHTMLSGMLFT;
+ ColorListBox aHTMLSGMLLB;
+ Window aHTMLSGMLWN;
+ FixedText aHTMLCommentFT;
+ ColorListBox aHTMLCommentLB;
+ Window aHTMLCommentWN;
+ FixedText aHTMLKeywdFT;
+ ColorListBox aHTMLKeywdLB;
+ Window aHTMLKeywdWN;
+ FixedText aHTMLUnknownFT;
+ ColorListBox aHTMLUnknownLB;
+ Window aHTMLUnknownWN;
+ Window aCalcBackWN;
+ SvxExtFixedText_Impl aCalcFT;
+ FixedText aCalcGridFT;
+ ColorListBox aCalcGridLB;
+ Window aCalcGridWN;
+ FixedText aCalcPageBreakFT;
+ ColorListBox aCalcPageBreakLB;
+ Window aCalcPageBreakWN;
+ FixedText aCalcPageBreakManualFT;
+ ColorListBox aCalcPageBreakManualLB;
+ Window aCalcPageBreakManualWN;
+ FixedText aCalcPageBreakAutoFT;
+ ColorListBox aCalcPageBreakAutoLB;
+ Window aCalcPageBreakAutoWN;
+ FixedText aCalcDetectiveFT;
+ ColorListBox aCalcDetectiveLB;
+ Window aCalcDetectiveWN;
+ FixedText aCalcDetectiveErrorFT;
+ ColorListBox aCalcDetectiveErrorLB;
+ Window aCalcDetectiveErrorWN;
+ FixedText aCalcReferenceFT;
+ ColorListBox aCalcReferenceLB;
+ Window aCalcReferenceWN;
+ FixedText aCalcNotesBackFT;
+ ColorListBox aCalcNotesBackLB;
+ Window aCalcNotesBackWN;
+ Window aDrawBackWN;
+ SvxExtFixedText_Impl aDrawFT;
+ FixedText aDrawGridFT;
+ ColorListBox aDrawGridLB;
+ Window aDrawGridWN;
+ Window aBasicBackWN;
+ SvxExtFixedText_Impl aBasicFT;
+ FixedText aBasicIdentifierFT;
+ ColorListBox aBasicIdentifierLB;
+ Window aBasicIdentifierWN;
+ FixedText aBasicCommentFT;
+ ColorListBox aBasicCommentLB;
+ Window aBasicCommentWN;
+ FixedText aBasicNumberFT;
+ ColorListBox aBasicNumberLB;
+ Window aBasicNumberWN;
+ FixedText aBasicStringFT;
+ ColorListBox aBasicStringLB;
+ Window aBasicStringWN;
+ FixedText aBasicOperatorFT;
+ ColorListBox aBasicOperatorLB;
+ Window aBasicOperatorWN;
+ FixedText aBasicKeywordFT;
+ ColorListBox aBasicKeywordLB;
+ Window aBasicKeywordWN;
+ FixedText aBasicErrorFT;
+ ColorListBox aBasicErrorLB;
+ Window aBasicErrorWN;
+ Window aSQLBackWN;
+ SvxExtFixedText_Impl aSQLFT;
+ FixedText aSQLIdentifierFT;
+ ColorListBox aSQLIdentifierLB;
+ Window aSQLIdentifierWN;
+ FixedText aSQLNumberFT;
+ ColorListBox aSQLNumberLB;
+ Window aSQLNumberWN;
+ FixedText aSQLStringFT;
+ ColorListBox aSQLStringLB;
+ Window aSQLStringWN;
+ FixedText aSQLOperatorFT;
+ ColorListBox aSQLOperatorLB;
+ Window aSQLOperatorWN;
+ FixedText aSQLKeywordFT;
+ ColorListBox aSQLKeywordLB;
+ Window aSQLKeywordWN;
+ FixedText aSQLParameterFT;
+ ColorListBox aSQLParameterLB;
+ Window aSQLParameterWN;
+ FixedText aSQLCommentFT;
+ ColorListBox aSQLCommentLB;
+ Window aSQLCommentWN;
+
+ ::std::vector< SvxExtFixedText_Impl*> aChapters;
+ ::std::vector< Window* > aChapterWins;
+ ::std::vector< FixedText* > aFixedTexts;
+ ::std::vector< CheckBox* > aCheckBoxes;
+ ::std::vector< ColorListBox* > aColorBoxes;
+ ::std::vector< Window* > aWindows; // [ColorConfigEntryCount]
+ ::std::vector< ::boost::shared_ptr<SvxExtFixedText_Impl> > m_aExtensionTitles;
+
+ SvtModuleOptions m_aModuleOptions;
+
+ void SetNewPosition( sal_Int32 _nFeature, Window* _pWin );
+
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+public:
+ ColorConfigWindow_Impl(Window* pParent, const ResId& rResId);
+ ~ColorConfigWindow_Impl();
+
+ inline const SvtModuleOptions& GetModuleOptions() const { return m_aModuleOptions; }
+};
+
+sal_Bool lcl_isGroupVisible( sal_Int32 _nGroup, const SvtModuleOptions& _rModOptions )
+{
+ sal_Bool bRet = sal_True;
+
+ switch ( _nGroup )
+ {
+ case GROUP_WRITER :
+ case GROUP_HTML :
+ {
+ bRet = _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SWRITER );
+ break;
+ }
+
+ case GROUP_CALC :
+ {
+ bRet = _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SCALC );
+ break;
+ }
+
+ case GROUP_DRAW :
+ {
+ bRet = ( _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) ||
+ _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) );
+ break;
+ }
+ case GROUP_SQL :
+ {
+ bRet = _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SDATABASE );
+ break;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Int16 lcl_getGroup( sal_Int32 _nFeature )
+{
+ if ( _nFeature >= ColorConfigEntryCount )
+ return GROUP_COUNT; // feature of an extension
+
+ sal_Int16 nRet = GROUP_UNKNOWN;
+
+ switch ( _nFeature )
+ {
+ case DOCCOLOR :
+ case DOCBOUNDARIES :
+ case APPBACKGROUND :
+ case OBJECTBOUNDARIES :
+ case TABLEBOUNDARIES :
+ case FONTCOLOR :
+ case LINKS :
+ case LINKSVISITED :
+ case ANCHOR :
+ case SPELL :
+ case SMARTTAGS :
+ {
+ nRet = GROUP_GENERAL;
+ break;
+ }
+
+ case WRITERTEXTGRID :
+ case WRITERFIELDSHADINGS :
+ case WRITERIDXSHADINGS :
+ case WRITERDIRECTCURSOR :
+ case WRITERSCRIPTINDICATOR :
+ case WRITERSECTIONBOUNDARIES :
+ case WRITERPAGEBREAKS :
+ {
+ nRet = GROUP_WRITER;
+ break;
+ }
+
+ case HTMLSGML :
+ case HTMLCOMMENT :
+ case HTMLKEYWORD :
+ case HTMLUNKNOWN :
+ {
+ nRet = GROUP_HTML;
+ break;
+ }
+
+ case CALCGRID :
+ case CALCPAGEBREAK :
+ case CALCPAGEBREAKMANUAL :
+ case CALCPAGEBREAKAUTOMATIC :
+ case CALCDETECTIVE :
+ case CALCDETECTIVEERROR :
+ case CALCREFERENCE :
+ case CALCNOTESBACKGROUND :
+ {
+ nRet = GROUP_CALC;
+ break;
+ }
+
+ case DRAWGRID :
+ case DRAWDRAWING :
+ case DRAWFILL :
+ {
+ nRet = GROUP_DRAW;
+ break;
+ }
+
+ case BASICIDENTIFIER :
+ case BASICCOMMENT :
+ case BASICNUMBER :
+ case BASICSTRING :
+ case BASICOPERATOR :
+ case BASICKEYWORD :
+ case BASICERROR :
+ {
+ nRet = GROUP_BASIC;
+ break;
+ }
+ case SQLIDENTIFIER :
+ case SQLNUMBER:
+ case SQLSTRING:
+ case SQLOPERATOR:
+ case SQLKEYWORD:
+ case SQLPARAMETER:
+ case SQLCOMMENT:
+ {
+ nRet = GROUP_SQL;
+ break;
+ }
+ }
+ return nRet;
+}
+
+/* -----------------------------25.03.2002 17:05------------------------------
+
+ ---------------------------------------------------------------------------*/
+ColorConfigWindow_Impl::ColorConfigWindow_Impl(Window* pParent, const ResId& rResId) :
+ Window(pParent, rResId),
+ aGeneralBackWN(this),
+ aGeneralFT(&aGeneralBackWN, ResId( FT_GENERAL, *rResId.GetResMgr() )),
+ aDocColorFT(this, ResId( FT_DOCCOLOR, *rResId.GetResMgr())),
+ aDocColorLB(this, ResId( LB_DOCCOLOR, *rResId.GetResMgr())),
+ aDocColorWN(this, ResId( WN_DOCCOLOR, *rResId.GetResMgr())),
+ aDocBoundCB(this, ResId( CB_DOCBOUND, *rResId.GetResMgr())),
+ aDocBoundLB(this, ResId( LB_DOCBOUND, *rResId.GetResMgr())),
+ aDocBoundWN(this, ResId( WN_DOCBOUND, *rResId.GetResMgr())),
+ aAppBackFT(this, ResId( FT_APPBACKGROUND, *rResId.GetResMgr())),
+ aAppBackLB(this, ResId( LB_APPBACKGROUND, *rResId.GetResMgr())),
+ aAppBackWN(this, ResId( WN_APPBACKGROUND, *rResId.GetResMgr())),
+ aObjBoundCB(this, ResId( CB_OBJECTBOUNDARIES, *rResId.GetResMgr())),
+ aObjBoundLB(this, ResId( LB_OBJECTBOUNDARIES, *rResId.GetResMgr())),
+ aObjBoundWN(this, ResId( WN_OBJECTBOUNDARIES, *rResId.GetResMgr())),
+ aTableBoundCB(this, ResId( CB_TABLEBOUNDARIES, *rResId.GetResMgr())),
+ aTableBoundLB(this, ResId( LB_TABLEBOUNDARIES, *rResId.GetResMgr())),
+ aTableBoundWN(this, ResId( WN_TABLEBOUNDARIES, *rResId.GetResMgr())),
+ aFontColorFT(this, ResId( FT_FONTCOLOR, *rResId.GetResMgr())),
+ aFontColorLB(this, ResId( LB_FONTCOLOR, *rResId.GetResMgr())),
+ aFontColorWN(this, ResId( WN_FONTCOLOR, *rResId.GetResMgr())),
+ aLinksCB(this, ResId( CB_LINKS, *rResId.GetResMgr())),
+ aLinksLB(this, ResId( LB_LINKS, *rResId.GetResMgr())),
+ aLinksWN(this, ResId( WN_LINKS, *rResId.GetResMgr())),
+ aLinksVisitedCB(this, ResId( CB_LINKSVISITED, *rResId.GetResMgr())),
+ aLinksVisitedLB(this, ResId( LB_LINKSVISITED, *rResId.GetResMgr())),
+ aLinksVisitedWN(this, ResId( WN_LINKSVISITED, *rResId.GetResMgr())),
+ aSpellFT(this, ResId( FT_SPELL, *rResId.GetResMgr())),
+ aSpellLB(this, ResId( LB_SPELL, *rResId.GetResMgr())),
+ aSpellWN(this, ResId( WN_SPELL, *rResId.GetResMgr())),
+ aSmarttagsFT(this, ResId( FT_SMARTTAGS, *rResId.GetResMgr() )),
+ aSmarttagsLB(this, ResId( LB_SMARTTAGS, *rResId.GetResMgr() )),
+ aSmarttagsWN(this, ResId( WN_SMARTTAGS, *rResId.GetResMgr() )),
+ aWriterBackWN(this),
+ aWriterFT(this, ResId(FT_WRITER, *rResId.GetResMgr())),
+ aWrtTextGridFT(this, ResId( FT_WRITERTEXTGRID, *rResId.GetResMgr())),
+ aWrtTextGridLB(this, ResId( LB_WRITERTEXTGRID, *rResId.GetResMgr())),
+ aWrtTextGridWN(this, ResId( WN_WRITERTEXTGRID, *rResId.GetResMgr())),
+ aWrtFieldCB(this, ResId( CB_WRITERFIELDSHADINGS, *rResId.GetResMgr())),
+ aWrtFieldLB(this, ResId( LB_WRITERFIELDSHADINGS, *rResId.GetResMgr())),
+ aWrtFieldWN(this, ResId( WN_WRITERFIELDSHADINGS, *rResId.GetResMgr())),
+ aWrtIdxShadingBackCB(this, ResId( CB_WRITERIDXSHADINGS, *rResId.GetResMgr())),
+ aWrtIdxShadingBackLB(this, ResId( LB_WRITERIDXSHADINGS, *rResId.GetResMgr())),
+ aWrtIdxShadingBackWN(this, ResId( WN_WRITERIDXSHADINGS, *rResId.GetResMgr())),
+ aWrtScriptIndicatorFT(this, ResId( FT_WRITERSCRIPTINDICATOR, *rResId.GetResMgr())),
+ aWrtScriptIndicatorLB(this, ResId( LB_WRITERSCRIPTINDICATOR, *rResId.GetResMgr())),
+ aWrtScriptIndicatorWN(this, ResId( WN_WRITERSCRIPTINDICATOR, *rResId.GetResMgr())),
+ aWrtSectionBoundCB(this, ResId( CB_WRITERSECTIONBOUNDARIES, *rResId.GetResMgr())),
+ aWrtSectionBoundLB(this, ResId( LB_WRITERSECTIONBOUNDARIES, *rResId.GetResMgr())),
+ aWrtSectionBoundWN(this, ResId( WN_WRITERSECTIONBOUNDARIES, *rResId.GetResMgr())),
+ aWrtPageBreaksFT(this, ResId( FT_WRITERPAGEBREAKS, *rResId.GetResMgr())),
+ aWrtPageBreaksLB(this, ResId( LB_WRITERPAGEBREAKS, *rResId.GetResMgr())),
+ aWrtPageBreaksWN(this, ResId( WN_WRITERPAGEBREAKS, *rResId.GetResMgr())),
+ aWrtDirectCrsrFT(this, ResId( FT_WRITERDIRECTCURSOR, *rResId.GetResMgr())),
+ aWrtDirectCrsrLB(this, ResId( LB_WRITERDIRECTCURSOR, *rResId.GetResMgr())),
+ aWrtDirectCrsrWN(this, ResId( WN_WRITERDIRECTCURSOR, *rResId.GetResMgr())),
+ aHTMLBackWN(this),
+ aHTMLFT(this, ResId( FT_HTML, *rResId.GetResMgr())),
+ aHTMLSGMLFT(this, ResId( FT_HTMLSGML, *rResId.GetResMgr())),
+ aHTMLSGMLLB(this, ResId( LB_HTMLSGML, *rResId.GetResMgr())),
+ aHTMLSGMLWN(this, ResId( WN_HTMLSGML, *rResId.GetResMgr())),
+ aHTMLCommentFT(this, ResId( FT_HTMLCOMMENT, *rResId.GetResMgr())),
+ aHTMLCommentLB(this, ResId( LB_HTMLCOMMENT, *rResId.GetResMgr())),
+ aHTMLCommentWN(this, ResId( WN_HTMLCOMMENT, *rResId.GetResMgr())),
+ aHTMLKeywdFT(this, ResId( FT_HTMLKEYWORD, *rResId.GetResMgr())),
+ aHTMLKeywdLB(this, ResId( LB_HTMLKEYWORD, *rResId.GetResMgr())),
+ aHTMLKeywdWN(this, ResId( WN_HTMLKEYWORD, *rResId.GetResMgr())),
+ aHTMLUnknownFT(this, ResId( FT_HTMLUNKNOWN, *rResId.GetResMgr())),
+ aHTMLUnknownLB(this, ResId( LB_HTMLUNKNOWN, *rResId.GetResMgr())),
+ aHTMLUnknownWN(this, ResId( WN_HTMLUNKNOWN, *rResId.GetResMgr())),
+ aCalcBackWN(this),
+ aCalcFT(this, ResId( FT_CALC, *rResId.GetResMgr())),
+ aCalcGridFT(this, ResId( FT_CALCGRID, *rResId.GetResMgr())),
+ aCalcGridLB(this, ResId( LB_CALCGRID, *rResId.GetResMgr())),
+ aCalcGridWN(this, ResId( WN_CALCGRID, *rResId.GetResMgr())),
+ aCalcPageBreakFT(this, ResId( FT_CALCPAGEBREAK, *rResId.GetResMgr())),
+ aCalcPageBreakLB(this, ResId( LB_CALCPAGEBREAK, *rResId.GetResMgr())),
+ aCalcPageBreakWN(this, ResId( WN_CALCPAGEBREAK, *rResId.GetResMgr())),
+ aCalcPageBreakManualFT(this, ResId( FT_CALCPAGEBREAKMANUAL, *rResId.GetResMgr())),
+ aCalcPageBreakManualLB(this, ResId( LB_CALCPAGEBREAKMANUAL, *rResId.GetResMgr())),
+ aCalcPageBreakManualWN(this, ResId( WN_CALCPAGEBREAKMANUAL, *rResId.GetResMgr())),
+ aCalcPageBreakAutoFT(this, ResId( FT_CALCPAGEBREAKAUTO, *rResId.GetResMgr())),
+ aCalcPageBreakAutoLB(this, ResId( LB_CALCPAGEBREAKAUTO, *rResId.GetResMgr())),
+ aCalcPageBreakAutoWN(this, ResId( WN_CALCPAGEBREAKAUTO, *rResId.GetResMgr())),
+ aCalcDetectiveFT(this, ResId( FT_CALCDETECTIVE, *rResId.GetResMgr())),
+ aCalcDetectiveLB(this, ResId( LB_CALCDETECTIVE, *rResId.GetResMgr())),
+ aCalcDetectiveWN(this, ResId( WN_CALCDETECTIVE, *rResId.GetResMgr())),
+ aCalcDetectiveErrorFT(this, ResId( FT_CALCDETECTIVEERROR, *rResId.GetResMgr())),
+ aCalcDetectiveErrorLB(this, ResId( LB_CALCDETECTIVEERROR, *rResId.GetResMgr())),
+ aCalcDetectiveErrorWN(this, ResId( WN_CALCDETECTIVEERROR, *rResId.GetResMgr())),
+ aCalcReferenceFT(this, ResId( FT_CALCREFERENCE, *rResId.GetResMgr())),
+ aCalcReferenceLB(this, ResId( LB_CALCREFERENCE, *rResId.GetResMgr())),
+ aCalcReferenceWN(this, ResId( WN_CALCREFERENCE, *rResId.GetResMgr())),
+ aCalcNotesBackFT(this, ResId( FT_CALCNOTESBACKGROUND, *rResId.GetResMgr())),
+ aCalcNotesBackLB(this, ResId( LB_CALCNOTESBACKGROUND, *rResId.GetResMgr())),
+ aCalcNotesBackWN(this, ResId( WN_CALCNOTESBACKGROUND, *rResId.GetResMgr())),
+ aDrawBackWN(this),
+ aDrawFT(this, ResId( FT_DRAW, *rResId.GetResMgr())),
+ aDrawGridFT(this, ResId( FT_DRAWGRID, *rResId.GetResMgr())),
+ aDrawGridLB(this, ResId( LB_DRAWGRID, *rResId.GetResMgr())),
+ aDrawGridWN(this, ResId( WN_DRAWGRID, *rResId.GetResMgr())),
+ aBasicBackWN(this),
+ aBasicFT(this, ResId( FT_BASIC, *rResId.GetResMgr())),
+ aBasicIdentifierFT(this, ResId( FT_BASICIDENTIFIER, *rResId.GetResMgr())),
+ aBasicIdentifierLB(this, ResId( LB_BASICIDENTIFIER, *rResId.GetResMgr())),
+ aBasicIdentifierWN(this, ResId( WN_BASICIDENTIFIER, *rResId.GetResMgr())),
+ aBasicCommentFT(this, ResId( FT_BASICCOMMENT, *rResId.GetResMgr())),
+ aBasicCommentLB(this, ResId( LB_BASICCOMMENT, *rResId.GetResMgr())),
+ aBasicCommentWN(this, ResId( WN_BASICCOMMENT, *rResId.GetResMgr())),
+ aBasicNumberFT(this, ResId( FT_BASICNUMBER, *rResId.GetResMgr())),
+ aBasicNumberLB(this, ResId( LB_BASICNUMBER, *rResId.GetResMgr())),
+ aBasicNumberWN(this, ResId( WN_BASICNUMBER, *rResId.GetResMgr())),
+ aBasicStringFT(this, ResId( FT_BASICSTRING, *rResId.GetResMgr())),
+ aBasicStringLB(this, ResId( LB_BASICSTRING, *rResId.GetResMgr())),
+ aBasicStringWN(this, ResId( WN_BASICSTRING, *rResId.GetResMgr())),
+ aBasicOperatorFT(this, ResId( FT_BASICOPERATOR, *rResId.GetResMgr())),
+ aBasicOperatorLB(this, ResId( LB_BASICOPERATOR, *rResId.GetResMgr())),
+ aBasicOperatorWN(this, ResId( WN_BASICOPERATOR, *rResId.GetResMgr())),
+ aBasicKeywordFT(this, ResId( FT_BASICKEYWORD, *rResId.GetResMgr())),
+ aBasicKeywordLB(this, ResId( LB_BASICKEYWORD, *rResId.GetResMgr())),
+ aBasicKeywordWN(this, ResId( WN_BASICKEYWORD, *rResId.GetResMgr())),
+ aBasicErrorFT(this, ResId( FT_BASICERROR, *rResId.GetResMgr())),
+ aBasicErrorLB(this, ResId( LB_BASICERROR, *rResId.GetResMgr())),
+ aBasicErrorWN(this, ResId( WN_BASICERROR, *rResId.GetResMgr())),
+
+ aSQLBackWN(this),
+ aSQLFT(this, ResId( FT_SQL_COMMAND, *rResId.GetResMgr())),
+ aSQLIdentifierFT(this, ResId( FT_SQLIDENTIFIER, *rResId.GetResMgr())),
+ aSQLIdentifierLB(this, ResId( LB_SQLIDENTIFIER, *rResId.GetResMgr())),
+ aSQLIdentifierWN(this, ResId( WN_SQLIDENTIFIER, *rResId.GetResMgr())),
+
+ aSQLNumberFT(this, ResId( FT_SQLNUMBER, *rResId.GetResMgr())),
+ aSQLNumberLB(this, ResId( LB_SQLNUMBER, *rResId.GetResMgr())),
+ aSQLNumberWN(this, ResId( WN_SQLNUMBER, *rResId.GetResMgr())),
+
+ aSQLStringFT(this, ResId( FT_SQLSTRING, *rResId.GetResMgr())),
+ aSQLStringLB(this, ResId( LB_SQLSTRING, *rResId.GetResMgr())),
+ aSQLStringWN(this, ResId( WN_SQLSTRING, *rResId.GetResMgr())),
+
+ aSQLOperatorFT(this, ResId( FT_SQLOPERATOR, *rResId.GetResMgr())),
+ aSQLOperatorLB(this, ResId( LB_SQLOPERATOR, *rResId.GetResMgr())),
+ aSQLOperatorWN(this, ResId( WN_SQLOPERATOR, *rResId.GetResMgr())),
+
+ aSQLKeywordFT(this, ResId( FT_SQLKEYWORD, *rResId.GetResMgr())),
+ aSQLKeywordLB(this, ResId( LB_SQLKEYWORD, *rResId.GetResMgr())),
+ aSQLKeywordWN(this, ResId( WN_SQLKEYWORD, *rResId.GetResMgr())),
+
+ aSQLParameterFT(this, ResId( FT_SQLPARAMETER, *rResId.GetResMgr())),
+ aSQLParameterLB(this, ResId( LB_SQLPARAMETER, *rResId.GetResMgr())),
+ aSQLParameterWN(this, ResId( WN_SQLPARAMETER, *rResId.GetResMgr())),
+
+ aSQLCommentFT(this, ResId( FT_SQLCOMMENT, *rResId.GetResMgr())),
+ aSQLCommentLB(this, ResId( LB_SQLCOMMENT, *rResId.GetResMgr())),
+ aSQLCommentWN(this, ResId( WN_SQLCOMMENT, *rResId.GetResMgr()))
+{
+ aFixedTexts.resize(ColorConfigEntryCount);
+ aCheckBoxes.resize(ColorConfigEntryCount);
+ aColorBoxes.resize(ColorConfigEntryCount);
+ aWindows.resize(ColorConfigEntryCount);
+
+ aFixedTexts[DOCCOLOR ] = &aDocColorFT;
+ aCheckBoxes[DOCBOUNDARIES ] = &aDocBoundCB ;
+ aFixedTexts[APPBACKGROUND ] = &aAppBackFT;
+ aCheckBoxes[OBJECTBOUNDARIES ] = &aObjBoundCB ;
+ aCheckBoxes[TABLEBOUNDARIES ] = &aTableBoundCB ;
+ aFixedTexts[FONTCOLOR ] = &aFontColorFT ;
+ aCheckBoxes[LINKS ] = &aLinksCB ;
+ aCheckBoxes[LINKSVISITED ] = &aLinksVisitedCB ;
+ aFixedTexts[SPELL ]=& aSpellFT;
+ aFixedTexts[SMARTTAGS ]=& aSmarttagsFT;
+ aFixedTexts[WRITERTEXTGRID ]=& aWrtTextGridFT;
+ aCheckBoxes[WRITERFIELDSHADINGS ] = &aWrtFieldCB ;
+ aCheckBoxes[WRITERIDXSHADINGS ] = &aWrtIdxShadingBackCB ;
+ aFixedTexts[WRITERDIRECTCURSOR ]=& aWrtDirectCrsrFT;
+ aFixedTexts[WRITERSCRIPTINDICATOR ]=& aWrtScriptIndicatorFT;
+ aCheckBoxes[WRITERSECTIONBOUNDARIES ]=& aWrtSectionBoundCB;
+ aFixedTexts[HTMLSGML ]=& aHTMLSGMLFT;
+ aFixedTexts[HTMLCOMMENT ]=& aHTMLCommentFT;
+ aFixedTexts[HTMLKEYWORD ]=& aHTMLKeywdFT;
+ aFixedTexts[HTMLUNKNOWN ]=& aHTMLUnknownFT;
+ aFixedTexts[CALCGRID ] = &aCalcGridFT ;
+ aFixedTexts[CALCPAGEBREAK ] = &aCalcPageBreakFT;
+ aFixedTexts[CALCPAGEBREAKMANUAL ] = &aCalcPageBreakManualFT;
+ aFixedTexts[CALCPAGEBREAKAUTOMATIC ] = &aCalcPageBreakAutoFT;
+ aFixedTexts[CALCDETECTIVE ]=& aCalcDetectiveFT;
+ aFixedTexts[CALCDETECTIVEERROR ]=& aCalcDetectiveErrorFT;
+ aFixedTexts[CALCREFERENCE ]=& aCalcReferenceFT;
+ aFixedTexts[CALCNOTESBACKGROUND ]=& aCalcNotesBackFT;
+ aFixedTexts[WRITERPAGEBREAKS] = &aWrtPageBreaksFT;
+ aFixedTexts[DRAWGRID ] = &aDrawGridFT ;
+ aFixedTexts[BASICIDENTIFIER ] = &aBasicIdentifierFT;
+ aFixedTexts[BASICCOMMENT ] = &aBasicCommentFT;
+ aFixedTexts[BASICNUMBER ] = &aBasicNumberFT;
+ aFixedTexts[BASICSTRING ] = &aBasicStringFT;
+ aFixedTexts[BASICOPERATOR ] = &aBasicOperatorFT;
+ aFixedTexts[BASICKEYWORD ] = &aBasicKeywordFT;
+ aFixedTexts[BASICERROR ] = &aBasicErrorFT;
+ aFixedTexts[SQLIDENTIFIER ] = &aSQLIdentifierFT;
+ aFixedTexts[SQLNUMBER ] = &aSQLNumberFT;
+ aFixedTexts[SQLSTRING ] = &aSQLStringFT;
+ aFixedTexts[SQLOPERATOR ] = &aSQLOperatorFT;
+ aFixedTexts[SQLKEYWORD ] = &aSQLKeywordFT;
+ aFixedTexts[SQLPARAMETER ] = &aSQLParameterFT;
+ aFixedTexts[SQLCOMMENT ] = &aSQLCommentFT;
+
+ aColorBoxes[DOCCOLOR ] = &aDocColorLB ;
+ aColorBoxes[DOCBOUNDARIES ] = &aDocBoundLB ;
+ aColorBoxes[APPBACKGROUND ] = &aAppBackLB ;
+ aColorBoxes[OBJECTBOUNDARIES ] = &aObjBoundLB ;
+ aColorBoxes[TABLEBOUNDARIES ] = &aTableBoundLB ;
+ aColorBoxes[FONTCOLOR ] = &aFontColorLB ;
+ aColorBoxes[LINKS ] = &aLinksLB ;
+ aColorBoxes[LINKSVISITED ] = &aLinksVisitedLB ;
+ aColorBoxes[SPELL ] = &aSpellLB ;
+ aColorBoxes[SMARTTAGS ] = &aSmarttagsLB ;
+ aColorBoxes[WRITERTEXTGRID ] = &aWrtTextGridLB ;
+ aColorBoxes[WRITERFIELDSHADINGS ] = &aWrtFieldLB ;
+ aColorBoxes[WRITERIDXSHADINGS ] = &aWrtIdxShadingBackLB ;
+ aColorBoxes[WRITERDIRECTCURSOR ] = &aWrtDirectCrsrLB ;
+ aColorBoxes[WRITERSCRIPTINDICATOR ] = &aWrtScriptIndicatorLB ;
+ aColorBoxes[WRITERSECTIONBOUNDARIES ] = &aWrtSectionBoundLB ;
+ aColorBoxes[WRITERPAGEBREAKS] = &aWrtPageBreaksLB;
+ aColorBoxes[HTMLSGML ] = &aHTMLSGMLLB ;
+ aColorBoxes[HTMLCOMMENT ] = &aHTMLCommentLB ;
+ aColorBoxes[HTMLKEYWORD ] = &aHTMLKeywdLB ;
+ aColorBoxes[HTMLUNKNOWN ] = &aHTMLUnknownLB ;
+ aColorBoxes[CALCGRID ] = &aCalcGridLB ;
+ aColorBoxes[CALCPAGEBREAK ] = &aCalcPageBreakLB ;
+ aColorBoxes[CALCPAGEBREAKMANUAL ] = &aCalcPageBreakManualLB ;
+ aColorBoxes[CALCPAGEBREAKAUTOMATIC]= &aCalcPageBreakAutoLB ;
+ aColorBoxes[CALCDETECTIVE ] = &aCalcDetectiveLB ;
+ aColorBoxes[CALCDETECTIVEERROR ] = &aCalcDetectiveErrorLB ;
+ aColorBoxes[CALCREFERENCE ] = &aCalcReferenceLB ;
+ aColorBoxes[CALCNOTESBACKGROUND ] = &aCalcNotesBackLB ;
+ aColorBoxes[DRAWGRID ] = &aDrawGridLB ;
+ aColorBoxes[BASICIDENTIFIER ] = &aBasicIdentifierLB;
+ aColorBoxes[BASICCOMMENT ] = &aBasicCommentLB;
+ aColorBoxes[BASICNUMBER ] = &aBasicNumberLB;
+ aColorBoxes[BASICSTRING ] = &aBasicStringLB;
+ aColorBoxes[BASICOPERATOR ] = &aBasicOperatorLB;
+ aColorBoxes[BASICKEYWORD ] = &aBasicKeywordLB;
+ aColorBoxes[BASICERROR ] = &aBasicErrorLB;
+ aColorBoxes[SQLIDENTIFIER ] = &aSQLIdentifierLB;
+ aColorBoxes[SQLNUMBER ] = &aSQLNumberLB;
+ aColorBoxes[SQLSTRING ] = &aSQLStringLB;
+ aColorBoxes[SQLOPERATOR ] = &aSQLOperatorLB;
+ aColorBoxes[SQLKEYWORD ] = &aSQLKeywordLB;
+ aColorBoxes[SQLPARAMETER ] = &aSQLParameterLB;
+ aColorBoxes[SQLCOMMENT ] = &aSQLCommentLB;
+
+ aWindows[DOCCOLOR ] = &aDocColorWN ;
+ aWindows[DOCBOUNDARIES ] = &aDocBoundWN ;
+ aWindows[APPBACKGROUND ] = &aAppBackWN ;
+ aWindows[OBJECTBOUNDARIES ] = &aObjBoundWN ;
+ aWindows[TABLEBOUNDARIES ] = &aTableBoundWN ;
+ aWindows[FONTCOLOR ] = &aFontColorWN ;
+ aWindows[LINKS ] = &aLinksWN ;
+ aWindows[LINKSVISITED ] = &aLinksVisitedWN ;
+ aWindows[SPELL ] = &aSpellWN ;
+ aWindows[SMARTTAGS ] = &aSmarttagsWN ;
+ aWindows[WRITERTEXTGRID ] = &aWrtTextGridWN ;
+ aWindows[WRITERFIELDSHADINGS ] = &aWrtFieldWN ;
+ aWindows[WRITERIDXSHADINGS ] = &aWrtIdxShadingBackWN ;
+ aWindows[WRITERDIRECTCURSOR ] = &aWrtDirectCrsrWN ;
+ aWindows[WRITERSCRIPTINDICATOR ] = &aWrtScriptIndicatorWN ;
+ aWindows[WRITERSECTIONBOUNDARIES ] = &aWrtSectionBoundWN ;
+ aWindows[WRITERPAGEBREAKS] = &aWrtPageBreaksWN;
+ aWindows[HTMLSGML ] = &aHTMLSGMLWN ;
+ aWindows[HTMLCOMMENT ] = &aHTMLCommentWN ;
+ aWindows[HTMLKEYWORD ] = &aHTMLKeywdWN ;
+ aWindows[HTMLUNKNOWN ] = &aHTMLUnknownWN ;
+ aWindows[CALCGRID ] = &aCalcGridWN ;
+ aWindows[CALCPAGEBREAK ] = &aCalcPageBreakWN ;
+ aWindows[CALCPAGEBREAKMANUAL ] = &aCalcPageBreakManualWN ;
+ aWindows[CALCPAGEBREAKAUTOMATIC] = &aCalcPageBreakAutoWN ;
+ aWindows[CALCDETECTIVE ] = &aCalcDetectiveWN ;
+ aWindows[CALCDETECTIVEERROR ] = &aCalcDetectiveErrorWN ;
+ aWindows[CALCREFERENCE ] = &aCalcReferenceWN ;
+ aWindows[CALCNOTESBACKGROUND ] = &aCalcNotesBackWN ;
+ aWindows[DRAWGRID ] = &aDrawGridWN ;
+ aWindows[BASICIDENTIFIER ] = &aBasicIdentifierWN;
+ aWindows[BASICCOMMENT ] = &aBasicCommentWN;
+ aWindows[BASICNUMBER ] = &aBasicNumberWN;
+ aWindows[BASICSTRING ] = &aBasicStringWN;
+ aWindows[BASICOPERATOR ] = &aBasicOperatorWN;
+ aWindows[BASICKEYWORD ] = &aBasicKeywordWN;
+ aWindows[BASICERROR ] = &aBasicErrorWN;
+ aWindows[SQLIDENTIFIER ] = &aSQLIdentifierWN;
+ aWindows[SQLNUMBER ] = &aSQLNumberWN;
+ aWindows[SQLSTRING ] = &aSQLStringWN;
+ aWindows[SQLOPERATOR ] = &aSQLOperatorWN;
+ aWindows[SQLKEYWORD ] = &aSQLKeywordWN;
+ aWindows[SQLPARAMETER ] = &aSQLParameterWN;
+ aWindows[SQLCOMMENT ] = &aSQLCommentWN;
+
+ aChapters.push_back(&aGeneralFT); aChapterWins.push_back(&aGeneralBackWN);
+ aChapters.push_back(&aWriterFT); aChapterWins.push_back(&aWriterBackWN);
+ aChapters.push_back(&aHTMLFT); aChapterWins.push_back(&aHTMLBackWN);
+ aChapters.push_back(&aCalcFT); aChapterWins.push_back(&aCalcBackWN);
+ aChapters.push_back(&aDrawFT); aChapterWins.push_back(&aDrawBackWN);
+ aChapters.push_back(&aBasicFT); aChapterWins.push_back(&aBasicBackWN);
+ aChapters.push_back(&aSQLFT); aChapterWins.push_back(&aSQLBackWN);
+
+ // calculate heights of groups which can be hidden
+ aChapters[GROUP_WRITER ]->SetGroupHeight( aChapters[GROUP_HTML]->GetPosPixel().Y() - aChapters[GROUP_WRITER]->GetPosPixel().Y() );
+ aChapters[GROUP_HTML ]->SetGroupHeight( aChapters[GROUP_CALC]->GetPosPixel().Y() - aChapters[GROUP_HTML]->GetPosPixel().Y() );
+ aChapters[GROUP_CALC ]->SetGroupHeight( aChapters[GROUP_DRAW]->GetPosPixel().Y() - aChapters[GROUP_CALC]->GetPosPixel().Y() );
+ aChapters[GROUP_DRAW ]->SetGroupHeight( aChapters[GROUP_BASIC]->GetPosPixel().Y() - aChapters[GROUP_DRAW]->GetPosPixel().Y() );
+ aChapters[GROUP_BASIC ]->SetGroupHeight( aChapters[GROUP_SQL]->GetPosPixel().Y() - aChapters[GROUP_BASIC]->GetPosPixel().Y() );
+
+ ExtendedColorConfig aExtConfig;
+ sal_Int32 nExtCount = aExtConfig.GetComponentCount();
+ if ( nExtCount )
+ {
+ // calculate position behind last chapter
+ sal_Int32 nLastY = aSQLCommentWN.GetPosPixel().Y() + aSQLCommentWN.GetSizePixel().Height();
+ nLastY = nLastY + LogicToPixel( Size( 0, 3 ), MAP_APPFONT ).Height();
+ // to calculate the number of lines
+ sal_Int32 nHeight = LogicToPixel( Size( 0, _LINE_HEIGHT ), MAP_APPFONT ).Height();
+ sal_Int32 nLineNum = nLastY / nHeight;
+
+ Point aFixedPos = LogicToPixel( Point( _FT_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT );
+ Point aLBPos = LogicToPixel( Point( _LB_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT );
+ Size aFixedSize = LogicToPixel( Size( _FT_WIDTH , _FT_HEIGHT ), MAP_APPFONT );
+ Size aLBSize = LogicToPixel( Size( _LB_WIDTH , _LB_HEIGHT ), MAP_APPFONT );
+ Size aWinSize = LogicToPixel( Size( _WN_WIDTH , _WN_HEIGHT ), MAP_APPFONT );
+
+ for (sal_Int32 j = 0; j < nExtCount; ++j)
+ {
+ ::rtl::OUString sComponentName = aExtConfig.GetComponentName(j);
+ aChapterWins.push_back(new Window(this));
+ ::boost::shared_ptr<SvxExtFixedText_Impl> pTitle(new SvxExtFixedText_Impl(this,ResId(FT_SQL_COMMAND, *rResId.GetResMgr())));
+ m_aExtensionTitles.push_back(pTitle);
+ pTitle->SetPosSizePixel(LogicToPixel( Point( _FT_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aFixedSize);
+ pTitle->SetText(aExtConfig.GetComponentDisplayName(sComponentName));
+ aChapters.push_back(pTitle.get());
+ ++nLineNum;
+ sal_Int32 nColorCount = aExtConfig.GetComponentColorCount(sComponentName);
+ for (sal_Int32 i = 0; i < nColorCount; ++i,++nLineNum)
+ {
+ ExtendedColorConfigValue aColorEntry = aExtConfig.GetComponentColorConfigValue(sComponentName,i);
+ FixedText* pFixedText = new FixedText(this,ResId(FT_BASICERROR, *rResId.GetResMgr()));
+ pFixedText->SetPosSizePixel(LogicToPixel( Point( _FT_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aFixedSize);
+ pFixedText->SetText(aColorEntry.getDisplayName());
+ aFixedTexts.push_back(pFixedText);
+ aCheckBoxes.push_back(NULL); // no checkboxes
+ ColorListBox* pColorBox = new ColorListBox(this,ResId(LB_BASICERROR, *rResId.GetResMgr()));
+ pColorBox->SetPosSizePixel(LogicToPixel( Point( _LB_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aLBSize);
+ aColorBoxes.push_back(pColorBox);
+ Window* pWin = new Window(this,ResId(WN_BASICERROR, *rResId.GetResMgr()));
+ pWin->SetPosSizePixel(LogicToPixel( Point( _WN_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aWinSize);
+ aWindows.push_back(pWin);
+ } // for (sal_Int32 i = 0; i < nExtCount; ++i,++nLineNum)
+ }
+ }
+
+ FreeResource();
+
+ Color TempColor(COL_TRANSPARENT);
+ Wallpaper aTransparentWall(TempColor);
+ sal_Int32 nWinWidth = GetSizePixel().Width();
+ sal_Int32 nFTHeight = aChapters[0]->GetSizePixel().Height();
+ sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark();
+ Color aBackColor;
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if ( bHighContrast )
+ aBackColor = rStyleSettings.GetShadowColor();
+ else
+ aBackColor = Color( COL_LIGHTGRAY);
+ sal_Int32 nCount = aChapterWins.size();
+ for(sal_Int32 i = 0; i < nCount; ++i)
+ {
+ if ( lcl_isGroupVisible( i, m_aModuleOptions ) )
+ {
+ Font aFont = aChapters[i]->GetFont();
+ aFont.SetWeight(WEIGHT_BOLD);
+ aChapters[i]->SetFont(aFont);
+ aChapters[i]->SetBackground(aTransparentWall);
+ aChapterWins[i]->SetPosSizePixel( Point(0, aChapters[i]->GetPosPixel().Y()),
+ Size(nWinWidth, nFTHeight));
+ aChapterWins[i]->SetBackground(Wallpaper(aBackColor));
+ aChapterWins[i]->Show();
+ }
+ else
+ {
+ aChapters[i]->Hide();
+ aChapterWins[i]->Hide();
+ }
+ }
+ Color aTextColor;
+ BOOL bSetTextColor = FALSE;
+ //#104195# when the window color is the same as the text color it has to be changed
+ Color aWinCol = rStyleSettings.GetWindowColor();
+ Color aRCheckCol = rStyleSettings.GetRadioCheckTextColor();
+ if(aWinCol == aRCheckCol )
+ {
+ bSetTextColor = TRUE;
+ aRCheckCol.Invert();
+ //if inversion didn't work (gray) then it's set to black
+ if(aRCheckCol == aWinCol)
+ aRCheckCol = Color(COL_BLACK);
+ } // if(aWinCol == aRCheckCol )
+ nCount = aFixedTexts.size();
+ sal_Int16 nGroup = GROUP_UNKNOWN;
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ if(ANCHOR == i)
+ continue;
+ sal_Int16 nNewGroup = lcl_getGroup(i);
+ sal_Bool bShow = lcl_isGroupVisible( nNewGroup, m_aModuleOptions );
+
+ if ( nNewGroup > nGroup )
+ {
+ nGroup = nNewGroup;
+ if ( bShow && nGroup >= GROUP_CALC )
+ {
+ SetNewPosition( i, aChapters[nGroup] );
+ SetNewPosition( i, aChapterWins[nGroup] );
+ }
+ }
+ if(aCheckBoxes[i])
+ {
+ if ( bShow )
+ SetNewPosition( i, aCheckBoxes[i] );
+ else
+ aCheckBoxes[i]->Hide();
+ aCheckBoxes[i]->SetBackground(aTransparentWall);
+ aCheckBoxes[i]->SetHelpId(HID_COLORPAGE_CHECKBOX_START + i);
+ if(bSetTextColor)
+ aCheckBoxes[i]->SetTextColor(aRCheckCol);
+ }
+ if(aFixedTexts[i])
+ {
+ if ( bShow )
+ SetNewPosition( i, aFixedTexts[i] );
+ else
+ aFixedTexts[i]->Hide();
+ aFixedTexts[i]->SetBackground(aTransparentWall);
+ if(bSetTextColor)
+ aFixedTexts[i]->SetTextColor(aRCheckCol);
+ }
+ if(aWindows[i])
+ {
+ if ( bShow )
+ SetNewPosition( i, aWindows[i] );
+ else
+ aWindows[i]->Hide();
+ aWindows[i]->SetBorderStyle(WINDOW_BORDER_MONO);
+ }
+
+ if ( aColorBoxes[i] )
+ {
+ if ( bShow )
+ SetNewPosition( i, aColorBoxes[i] );
+ else
+ aColorBoxes[i]->Hide();
+ }
+ }
+
+ XColorTable aColorTable( SvtPathOptions().GetPalettePath() );
+ aColorBoxes[0]->InsertAutomaticEntry();
+ for( sal_Int32 i = 0; i < aColorTable.Count(); i++ )
+ {
+ XColorEntry* pEntry = aColorTable.GetColor(i);
+ aColorBoxes[0]->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ }
+ aColorBoxes[0]->SetHelpId(HID_COLORPAGE_LISTBOX_START);
+ for( sal_Int32 i = 1; i < nCount; i++ )
+ {
+ if(aColorBoxes[i])
+ {
+ aColorBoxes[i]->CopyEntries( *aColorBoxes[0] );
+ aColorBoxes[i]->SetHelpId(HID_COLORPAGE_LISTBOX_START + i);
+ }
+ }
+}
+/* -----------------------------27.03.2002 11:04------------------------------
+
+ ---------------------------------------------------------------------------*/
+ColorConfigWindow_Impl::~ColorConfigWindow_Impl()
+{
+ aChapters.clear();
+ ::std::vector< SvxExtFixedText_Impl*>().swap(aChapters);
+
+
+ sal_Int32 nCount = aFixedTexts.size();
+ for (sal_Int32 i = ColorConfigEntryCount; i < nCount; ++i)
+ {
+ delete aFixedTexts[i];
+ delete aCheckBoxes[i];
+ delete aColorBoxes[i];
+ delete aWindows[i];
+ }
+ for (sal_uInt32 i = GROUP_COUNT; i < aChapterWins.size(); ++i)
+ delete aChapterWins[i];
+ aChapterWins.clear();
+ ::std::vector< Window*>().swap(aChapterWins);
+}
+/* -----------------------------2002/06/20 12:48------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColorConfigWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ sal_Bool bHighContrast = rStyleSettings.GetHighContrastMode();
+ Color aBackColor( bHighContrast ? COL_TRANSPARENT : COL_LIGHTGRAY);
+ ::std::vector< Window* >::iterator aIter = aChapterWins.begin();
+ ::std::vector< Window* >::iterator aEnd = aChapterWins.end();
+ for(;aIter != aEnd; ++aIter )
+ (*aIter)->SetBackground(Wallpaper(aBackColor));
+ SetBackground(Wallpaper(rStyleSettings.GetWindowColor()));
+ }
+}
+/* -----------------------------2002/06/26 10:49------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxExtFixedText_Impl::DataChanged(const DataChangedEvent& rDCEvt)
+{
+ FixedText::DataChanged(rDCEvt);
+ Color TempColor(COL_TRANSPARENT);
+ Wallpaper aTransparentWall(TempColor);
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ Font aFont = GetFont();
+ aFont.SetWeight(WEIGHT_BOLD);
+ SetFont(aFont);
+ SetBackground(aTransparentWall);
+ }
+}
+
+void ColorConfigWindow_Impl::SetNewPosition( sal_Int32 _nFeature, Window* _pWin )
+{
+ DBG_ASSERT( _pWin, "ColorConfigWindow_Impl::SetNewPosition(): no window" );
+
+ // calculate the overall height of the invisible groups
+ long nDelta = 0;
+ sal_Int16 nGroup = lcl_getGroup( _nFeature ) - 1;
+ while ( nGroup > 0 ) // GROUP_GENERAL (0) is always visible
+ {
+ if ( !lcl_isGroupVisible( nGroup, m_aModuleOptions ) )
+ nDelta += aChapters[nGroup]->GetGroupHeight();
+ nGroup--;
+ }
+
+ // move this window to its new position
+ if ( nDelta > 0 )
+ {
+ Point aPos = _pWin->GetPosPixel();
+ aPos.Y() -= nDelta;
+ _pWin->SetPosPixel( aPos );
+ }
+}
+
+/* -----------------------------08.04.2002 17:10------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColorConfigWindow_Impl::Command( const CommandEvent& rCEvt )
+{
+ GetParent()->Command(rCEvt);
+}
+/* -----------------------------25.03.2002 10:44------------------------------
+
+ ---------------------------------------------------------------------------*/
+class ColorConfigCtrl_Impl : public Control
+{
+ HeaderBar aHeaderHB;
+ ScrollBar aVScroll;
+
+ String sOn;
+ String sUIElem;
+ String sColSetting;
+ String sPreview;
+ ColorConfigWindow_Impl aScrollWindow;
+
+ EditableColorConfig* pColorConfig;
+ EditableExtendedColorConfig* pExtColorConfig;
+
+ long nScrollPos;
+
+ DECL_LINK(ScrollHdl, ScrollBar*);
+ DECL_LINK(ClickHdl, CheckBox*);
+ DECL_LINK(ColorHdl, ColorListBox*);
+ DECL_LINK(ControlFocusHdl, Control*);
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+public:
+ ColorConfigCtrl_Impl(Window* pParent, const ResId& rResId );
+ ~ColorConfigCtrl_Impl();
+
+ void SetConfig(EditableColorConfig& rConfig) {pColorConfig = &rConfig;}
+ void SetExtendedConfig(EditableExtendedColorConfig& rConfig) {pExtColorConfig = &rConfig;}
+ void Update();
+ sal_Int32 GetScrollPosition() {return aVScroll.GetThumbPos();}
+ void SetScrollPosition(sal_Int32 nSet)
+ {
+ aVScroll.SetThumbPos(nSet);
+ ScrollHdl(&aVScroll);
+ }
+};
+/* -----------------------------25.03.2002 17:09------------------------------
+
+ ---------------------------------------------------------------------------*/
+ColorConfigCtrl_Impl::ColorConfigCtrl_Impl(
+ Window* pParent, const ResId& rResId) :
+ Control(pParent, rResId),
+
+
+ aHeaderHB(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER),
+ aVScroll(this, ResId(VB_VSCROLL, *rResId.GetResMgr())),
+ sOn( ResId(ST_ON, *rResId.GetResMgr())),
+ sUIElem( ResId(ST_UIELEM, *rResId.GetResMgr())),
+ sColSetting( ResId(ST_COLSET, *rResId.GetResMgr())),
+ sPreview( ResId(ST_PREVIEW, *rResId.GetResMgr())),
+ aScrollWindow(this, ResId(WN_SCROLL, *rResId.GetResMgr())),
+
+ pColorConfig(0),
+ pExtColorConfig(0),
+ nScrollPos(0)
+{
+ FreeResource();
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ aScrollWindow.SetBackground(Wallpaper(rStyleSettings.GetFieldColor()));
+ aScrollWindow.SetHelpId( HID_OPTIONS_COLORCONFIG_COLORLIST_WIN );
+ aVScroll.EnableDrag();
+ aVScroll.Show();
+ aHeaderHB.SetPosSizePixel(
+ Point(0,0),
+ Size(GetOutputSizePixel().Width(), aVScroll.GetPosPixel().Y()));
+ sal_Int32 nFirstWidth = aScrollWindow.aGeneralFT.GetPosPixel().X();
+ sal_Int32 nSecondWidth = aScrollWindow.aColorBoxes[0]->GetPosPixel().X() - nFirstWidth;
+ sal_Int32 nThirdWidth = aScrollWindow.aWindows[0]->GetPosPixel().X() - nFirstWidth - nSecondWidth;
+
+ const WinBits nHeadBits = HIB_VCENTER | HIB_FIXED| HIB_FIXEDPOS;
+ aHeaderHB.InsertItem( 1, sOn, nFirstWidth, (USHORT)nHeadBits|HIB_CENTER);
+ aHeaderHB.InsertItem( 2, sUIElem, nSecondWidth, (USHORT)nHeadBits|HIB_LEFT);
+ aHeaderHB.InsertItem( 3, sColSetting, nThirdWidth, (USHORT)nHeadBits|HIB_LEFT);
+ aHeaderHB.InsertItem( 4, sPreview,
+ aHeaderHB.GetSizePixel().Width() - nFirstWidth - nSecondWidth - nThirdWidth, (USHORT)nHeadBits|HIB_LEFT);
+ aHeaderHB.Show();
+
+ aVScroll.SetRangeMin(0);
+ sal_Int32 nScrollOffset = aScrollWindow.aColorBoxes[1]->GetPosPixel().Y() - aScrollWindow.aColorBoxes[0]->GetPosPixel().Y();
+ sal_Int32 nVisibleEntries = aScrollWindow.GetSizePixel().Height() / nScrollOffset;
+
+ aVScroll.SetRangeMax(aScrollWindow.aCheckBoxes.size() + aScrollWindow.aChapters.size() );
+ // static: minus three for ANCHOR, DRAWFILL and DRAWDRAWING
+ aVScroll.SetRangeMax( aVScroll.GetRangeMax() - 3 );
+ // dynamic: calculate the hidden lines
+ long nInvisibleLines = 0;
+ sal_Int16 nGroup = GROUP_UNKNOWN;
+ sal_Int32 nCount = aScrollWindow.aCheckBoxes.size();
+ for ( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ if ( ANCHOR == i || DRAWFILL == i || DRAWDRAWING == i ) // not used at the moment
+ continue;
+ sal_Int16 nNewGroup = lcl_getGroup(i);
+ sal_Bool bVisible = lcl_isGroupVisible( nNewGroup, aScrollWindow.GetModuleOptions() );
+ if ( !bVisible )
+ nInvisibleLines++;
+ if ( nNewGroup > nGroup )
+ {
+ nGroup = nNewGroup;
+ if ( !bVisible )
+ nInvisibleLines++;
+ }
+ }
+ aVScroll.SetRangeMax( aVScroll.GetRangeMax() - nInvisibleLines );
+
+ aVScroll.SetPageSize( nVisibleEntries - 1 );
+ aVScroll.SetVisibleSize(nVisibleEntries);
+ Link aScrollLink = LINK(this, ColorConfigCtrl_Impl, ScrollHdl);
+ aVScroll.SetScrollHdl(aScrollLink);
+ aVScroll.SetEndScrollHdl(aScrollLink);
+
+ Link aCheckLink = LINK(this, ColorConfigCtrl_Impl, ClickHdl);
+ Link aColorLink = LINK(this, ColorConfigCtrl_Impl, ColorHdl);
+ Link aGetFocusLink = LINK(this, ColorConfigCtrl_Impl, ControlFocusHdl);
+ for( sal_Int16 i = 0; i < nCount; i++ )
+ {
+ if(aScrollWindow.aColorBoxes[i])
+ {
+ aScrollWindow.aColorBoxes[i]->SetSelectHdl(aColorLink);
+ aScrollWindow.aColorBoxes[i]->SetGetFocusHdl(aGetFocusLink);
+ }
+ if(aScrollWindow.aCheckBoxes[i])
+ {
+ aScrollWindow.aCheckBoxes[i]->SetClickHdl(aCheckLink);
+ aScrollWindow.aCheckBoxes[i]->SetGetFocusHdl(aGetFocusLink);
+ }
+ }
+}
+/* -----------------------------27.03.2002 10:46------------------------------
+
+ ---------------------------------------------------------------------------*/
+ColorConfigCtrl_Impl::~ColorConfigCtrl_Impl()
+{
+}
+/* -----------------------------25.03.2002 17:19------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColorConfigCtrl_Impl::Update()
+{
+ DBG_ASSERT(pColorConfig, "Configuration not set" );
+ sal_Int32 i;
+ for( i = 0; i < ColorConfigEntryCount; i++ )
+ {
+ if(ANCHOR == i)
+ continue;
+ const ColorConfigValue& rColorEntry = pColorConfig->GetColorValue(ColorConfigEntry(i));
+ if(COL_AUTO == (UINT32)rColorEntry.nColor)
+ {
+ if(aScrollWindow.aColorBoxes[i])
+ aScrollWindow.aColorBoxes[i]->SelectEntryPos(0);
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->SetBackground(
+ Wallpaper(ColorConfig::GetDefaultColor((ColorConfigEntry) i)));
+ }
+ else
+ {
+ Color aColor(rColorEntry.nColor);
+ if(aScrollWindow.aColorBoxes[i])
+ aScrollWindow.aColorBoxes[i]->SelectEntry( aColor );
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor));
+ }
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->Invalidate();
+ if(aScrollWindow.aCheckBoxes[i])
+ aScrollWindow.aCheckBoxes[i]->Check(rColorEntry.bIsVisible);
+ } // for( i = 0; i < ColorConfigEntryCount; i++ )
+
+
+ sal_Int32 nExtCount = pExtColorConfig->GetComponentCount();
+ sal_Int32 nCount = aScrollWindow.aCheckBoxes.size();
+ sal_Int32 nPos = 0;
+ i = ColorConfigEntryCount;
+ for (sal_Int32 j = 0; j < nExtCount; ++j)
+ {
+ ::rtl::OUString sComponentName = pExtColorConfig->GetComponentName(j);
+ sal_Int32 nColorCount = pExtColorConfig->GetComponentColorCount(sComponentName);
+
+ for( sal_Int32 k = 0; i < nCount && k < nColorCount; ++i ,++nPos,++k)
+ {
+ if(aScrollWindow.aColorBoxes[i])
+ {
+ ExtendedColorConfigValue aColorEntry = pExtColorConfig->GetComponentColorConfigValue(sComponentName,k);
+ Color aColor(aColorEntry.getColor());
+ if(aColorEntry.getDefaultColor() == aColorEntry.getColor() )
+ {
+ aScrollWindow.aColorBoxes[i]->SelectEntryPos(0);
+ }
+ else
+ {
+ aScrollWindow.aColorBoxes[i]->SelectEntry( aColor );
+ }
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor));
+
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->Invalidate();
+ }
+ }
+ }
+}
+/* -----------------------------26.03.2002 12:55------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool lcl_MoveAndShow(Window* pWindow, long nOffset, long nMaxVisible, bool _bShow)
+{
+ BOOL bHide = TRUE;
+ if(pWindow)
+ {
+ Point aPos = pWindow->GetPosPixel();
+ aPos.Y() += nOffset;
+ pWindow->SetPosPixel(aPos);
+ if ( _bShow )
+ bHide = aPos.Y() > nMaxVisible || (aPos.Y() + pWindow->GetSizePixel().Height()) < 0;
+ pWindow->Show(!bHide);
+ }
+ return !bHide;
+}
+IMPL_LINK(ColorConfigCtrl_Impl, ScrollHdl, ScrollBar*, pScrollBar)
+{
+ aScrollWindow.SetUpdateMode(TRUE);
+ sal_Int16 i;
+ long nOffset = aScrollWindow.aColorBoxes[1]->GetPosPixel().Y() - aScrollWindow.aColorBoxes[0]->GetPosPixel().Y();
+ nOffset *= (nScrollPos - pScrollBar->GetThumbPos());
+ nScrollPos = pScrollBar->GetThumbPos();
+ const long nWindowHeight = aScrollWindow.GetSizePixel().Height();
+ sal_Int16 nFirstVisible = -1;
+ sal_Int16 nLastVisible = -1;
+ sal_Int32 nCount = aScrollWindow.aFixedTexts.size();
+ for( i = 0; i < nCount; i++ )
+ {
+ if(ANCHOR == i)
+ continue;
+ Point aPos;
+ //controls outside of the view need to be hidden to speed up accessibility tools
+ bool bShowCtrl = ( lcl_isGroupVisible(
+ lcl_getGroup(i), aScrollWindow.GetModuleOptions() ) != sal_False );
+ lcl_MoveAndShow(aScrollWindow.aCheckBoxes[i], nOffset, nWindowHeight, bShowCtrl);
+ lcl_MoveAndShow(aScrollWindow.aFixedTexts[i], nOffset, nWindowHeight, bShowCtrl);
+ lcl_MoveAndShow(aScrollWindow.aWindows[i] , nOffset, nWindowHeight, bShowCtrl);
+ BOOL bShow = lcl_MoveAndShow(aScrollWindow.aColorBoxes[i], nOffset, nWindowHeight, bShowCtrl);
+ if(bShow)
+ {
+ if(nFirstVisible == -1)
+ nFirstVisible = i;
+ else
+ nLastVisible = i;
+ }
+ }
+ //show the one prior to the first visible and the first after the last visble control
+ //to enable KEY_TAB travelling
+
+ if(nFirstVisible)
+ {
+ //skip gaps where no controls exist for the related ColorConfigEntry
+ do
+ --nFirstVisible;
+ while(!aScrollWindow.aCheckBoxes[nFirstVisible] && !aScrollWindow.aColorBoxes[nFirstVisible] && nFirstVisible >= 0);
+
+ if ( lcl_isGroupVisible(
+ lcl_getGroup( nFirstVisible ), aScrollWindow.GetModuleOptions() ) != sal_False )
+ {
+ if(aScrollWindow.aCheckBoxes[nFirstVisible])
+ aScrollWindow.aCheckBoxes[nFirstVisible]->Show();
+ if(aScrollWindow.aColorBoxes[nFirstVisible])
+ aScrollWindow.aColorBoxes[nFirstVisible]->Show();
+ }
+ }
+
+ if(nLastVisible < nCount - 1)
+ {
+ nLastVisible++;
+ //skip gaps where no controls exist for the related ColorConfigEntry
+ while(!aScrollWindow.aCheckBoxes[nLastVisible] && !aScrollWindow.aColorBoxes[nLastVisible] &&
+ nLastVisible < nCount - 1 )
+ nLastVisible++;
+ if ( nLastVisible < nCount )
+ {
+ if ( lcl_isGroupVisible(
+ lcl_getGroup( nLastVisible ), aScrollWindow.GetModuleOptions() ) != sal_False )
+ {
+ if(aScrollWindow.aCheckBoxes[nLastVisible])
+ aScrollWindow.aCheckBoxes[nLastVisible]->Show();
+ if(aScrollWindow.aColorBoxes[nLastVisible])
+ aScrollWindow.aColorBoxes[nLastVisible]->Show();
+ }
+ }
+ } // if(nLastVisible < nCount - 1)
+ sal_Int32 nChapterCount = aScrollWindow.aChapters.size();
+ for( i = 0; i < nChapterCount; i++ )
+ {
+ Point aPos = aScrollWindow.aChapters[i]->GetPosPixel(); aPos.Y() += nOffset; aScrollWindow.aChapters[i]->SetPosPixel(aPos);
+ aPos = aScrollWindow.aChapterWins[i]->GetPosPixel(); aPos.Y() += nOffset; aScrollWindow.aChapterWins[i]->SetPosPixel(aPos);
+ }
+ aScrollWindow.SetUpdateMode(TRUE);
+ return 0;
+}
+/* -----------------------------29.04.2002 17:02------------------------------
+
+ ---------------------------------------------------------------------------*/
+long ColorConfigCtrl_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);
+}
+/* -----------------------------08.04.2002 16:37------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColorConfigCtrl_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, &aVScroll );
+ }
+ }
+ break;
+ default:
+ Control::Command(rCEvt);
+ }
+}
+
+/* -----------------------------14.12.2005 12:37------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColorConfigCtrl_Impl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SetBackground(Wallpaper(rStyleSettings.GetFieldColor()));
+ }
+}
+
+
+/* -----------------------------27.03.2002 11:43------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, CheckBox*, pBox)
+{
+ DBG_ASSERT(pColorConfig, "Configuration not set" );
+
+ for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ )
+ {
+ if(ANCHOR == i)
+ continue;
+ if(aScrollWindow.aCheckBoxes[i] == pBox )
+ {
+ ColorConfigValue aBoundCol = pColorConfig->GetColorValue(ColorConfigEntry(i));
+ aBoundCol.bIsVisible = pBox->IsChecked();
+ pColorConfig->SetColorValue(ColorConfigEntry(i), aBoundCol);
+ break;
+ }
+ } // for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ )
+ return 0;
+}
+/* -----------------------------27.03.2002 11:43------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(ColorConfigCtrl_Impl, ColorHdl, ColorListBox*, pBox)
+{
+ DBG_ASSERT(pColorConfig, "Configuration not set" );
+ sal_Int32 i = 0;
+ for( ; i < ColorConfigEntryCount; i++ )
+ {
+ if(pBox && aScrollWindow.aColorBoxes[i] == pBox)
+ {
+ ColorConfigValue aColorEntry = pColorConfig->GetColorValue(ColorConfigEntry(i));
+ if(!pBox->GetSelectEntryPos())
+ {
+ aColorEntry.nColor = COL_AUTO;
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->SetBackground(
+ Wallpaper(ColorConfig::GetDefaultColor((ColorConfigEntry) i)));
+ }
+ else
+ {
+ Color aColor = pBox->GetSelectEntryColor(); // #i14869# no Color&, 'cause it's a ref to a temp object on the stack!
+ aColorEntry.nColor = aColor.GetColor();
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor));
+ }
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->Invalidate();
+ pColorConfig->SetColorValue(ColorConfigEntry(i), aColorEntry);
+ break;
+ }
+ } // for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ )
+ sal_Int32 nExtCount = pExtColorConfig->GetComponentCount();
+ sal_Int32 nCount = aScrollWindow.aCheckBoxes.size();
+ sal_Int32 nPos = 0;
+ i = ColorConfigEntryCount;
+ for (sal_Int32 j = 0; j < nExtCount; ++j)
+ {
+ ::rtl::OUString sComponentName = pExtColorConfig->GetComponentName(j);
+ sal_Int32 nColorCount = pExtColorConfig->GetComponentColorCount(sComponentName);
+
+ for( sal_Int32 k = 0; i < nCount && k < nColorCount; ++i ,++nPos,++k)
+ {
+ if(pBox && aScrollWindow.aColorBoxes[i] == pBox)
+ {
+ ExtendedColorConfigValue aColorEntry = pExtColorConfig->GetComponentColorConfigValue(sComponentName,k);
+ Color aColor = pBox->GetSelectEntryColor(); // #i14869# no Color&, 'cause it's a ref to a temp object on the stack!
+ aColorEntry.setColor(aColor.GetColor());
+ if( !pBox->GetSelectEntryPos() ) // auto color
+ {
+ aColorEntry.setColor(aColorEntry.getDefaultColor());
+ aColor.SetColor(aColorEntry.getColor());
+ }
+ if ( aScrollWindow.aWindows[i] )
+ {
+ aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor));
+ aScrollWindow.aWindows[i]->Invalidate();
+ }
+ pExtColorConfig->SetColorValue(sComponentName,aColorEntry);
+ break;
+ }
+ }
+ }
+ return 0;
+}
+IMPL_LINK(ColorConfigCtrl_Impl, ControlFocusHdl, Control*, pCtrl)
+{
+ //determine whether a control is completely visible
+ //and make it visible
+ Point aCtrlPos(pCtrl->GetPosPixel());
+ sal_Int32 nWinHeight = aScrollWindow.GetSizePixel().Height();
+ if(0 != (GETFOCUS_TAB & pCtrl->GetGetFocusFlags() &&
+ (aCtrlPos.Y() < 0 ||
+ nWinHeight < aCtrlPos.Y() + aScrollWindow.aColorBoxes[0]->GetSizePixel().Height())))
+ {
+ long nThumbPos = aVScroll.GetThumbPos();
+ if(nWinHeight < aCtrlPos.Y() + aScrollWindow.aColorBoxes[0]->GetSizePixel().Height())
+ {
+ //scroll down
+ nThumbPos +=2;
+ }
+ else
+ {
+ //scroll up
+ nThumbPos -= 2;
+ if(nThumbPos < 0)
+ nThumbPos = 0;
+ }
+ aVScroll.SetThumbPos(nThumbPos);
+ ScrollHdl(&aVScroll);
+ }
+ return 0;
+};
+/* -----------------------------25.03.2002 10:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxColorOptionsTabPage::SvxColorOptionsTabPage(
+ Window* pParent, const SfxItemSet& rCoreSet) :
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_COLORCONFIG ), rCoreSet ),
+ aColorSchemeFL( this, SVX_RES( FL_COLORSCHEME ) ),
+ aColorSchemeFT( this, SVX_RES( FT_COLORSCHEME ) ),
+ aColorSchemeLB( this, SVX_RES( LB_COLORSCHEME ) ),
+ aSaveSchemePB( this, SVX_RES( PB_SAVESCHEME) ),
+ aDeleteSchemePB( this, SVX_RES( PB_DELETESCHEME ) ),
+ aCustomColorsFL( this, SVX_RES( FL_CUSTOMCOLORS ) ),
+ bFillItemSetCalled(FALSE),
+ pColorConfig(0),
+ pExtColorConfig(0),
+ pColorConfigCT( new ColorConfigCtrl_Impl(this, SVX_RES( CT_COLORCONFIG ) ))
+{
+ FreeResource();
+ aColorSchemeLB.SetSelectHdl(LINK(this, SvxColorOptionsTabPage, SchemeChangedHdl_Impl));
+ Link aLk = LINK(this, SvxColorOptionsTabPage, SaveDeleteHdl_Impl );
+ aSaveSchemePB.SetClickHdl(aLk);
+ aDeleteSchemePB.SetClickHdl(aLk);
+}
+/* -----------------------------25.03.2002 10:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxColorOptionsTabPage::~SvxColorOptionsTabPage()
+{
+ //when the dialog is cancelled but the color scheme ListBox has been changed these
+ //changes need to be undone
+ if(!bFillItemSetCalled && aColorSchemeLB.GetSavedValue() != aColorSchemeLB.GetSelectEntryPos())
+ {
+ rtl::OUString sOldScheme = aColorSchemeLB.GetEntry(aColorSchemeLB.GetSavedValue());
+ if(sOldScheme.getLength())
+ {
+ pColorConfig->SetCurrentSchemeName(sOldScheme);
+ pExtColorConfig->SetCurrentSchemeName(sOldScheme);
+ }
+ }
+ delete pColorConfigCT;
+ pColorConfig->ClearModified();
+ pColorConfig->EnableBroadcast();
+ delete pColorConfig;
+ pExtColorConfig->ClearModified();
+ pExtColorConfig->EnableBroadcast();
+ delete pExtColorConfig;
+}
+/* -----------------------------25.03.2002 10:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+SfxTabPage* SvxColorOptionsTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return ( new SvxColorOptionsTabPage( pParent, rAttrSet ) );
+}
+/* -----------------------------25.03.2002 10:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SvxColorOptionsTabPage::FillItemSet( SfxItemSet& )
+{
+ bFillItemSetCalled = TRUE;
+ if(aColorSchemeLB.GetSavedValue() != aColorSchemeLB.GetSelectEntryPos())
+ {
+ pColorConfig->SetModified();
+ pExtColorConfig->SetModified();
+ }
+ if(pColorConfig->IsModified())
+ pColorConfig->Commit();
+ if(pExtColorConfig->IsModified())
+ pExtColorConfig->Commit();
+ return TRUE;
+}
+/* -----------------------------25.03.2002 10:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxColorOptionsTabPage::Reset( const SfxItemSet& )
+{
+ if(pColorConfig)
+ {
+ pColorConfig->ClearModified();
+ pColorConfig->DisableBroadcast();
+ delete pColorConfig;
+ }
+ pColorConfig = new EditableColorConfig;
+ pColorConfigCT->SetConfig(*pColorConfig);
+
+ if(pExtColorConfig)
+ {
+ pExtColorConfig->ClearModified();
+ pExtColorConfig->DisableBroadcast();
+ delete pExtColorConfig;
+ }
+ pExtColorConfig = new EditableExtendedColorConfig;
+ pColorConfigCT->SetExtendedConfig(*pExtColorConfig);
+
+ String sUser = GetUserData();
+ //has to be called always to speed up accessibility tools
+ pColorConfigCT->SetScrollPosition(sUser.ToInt32());
+ aColorSchemeLB.Clear();
+ uno::Sequence< ::rtl::OUString > aSchemes = pColorConfig->GetSchemeNames();
+ const rtl::OUString* pSchemes = aSchemes.getConstArray();
+ for(sal_Int32 i = 0; i < aSchemes.getLength(); i++)
+ aColorSchemeLB.InsertEntry(pSchemes[i]);
+ aColorSchemeLB.SelectEntry(pColorConfig->GetCurrentSchemeName());
+ aColorSchemeLB.SaveValue();
+ aDeleteSchemePB.Enable( aSchemes.getLength() > 1 );
+ UpdateColorConfig();
+}
+/* -----------------------------25.03.2002 10:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+int SvxColorOptionsTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return( LEAVE_PAGE );
+}
+/* -----------------------------25.03.2002 15:32------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxColorOptionsTabPage::UpdateColorConfig()
+{
+ //update the color config control
+ pColorConfigCT->Update();
+}
+/* -----------------------------25.03.2002 15:30------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxColorOptionsTabPage, SchemeChangedHdl_Impl, ListBox*, pBox)
+{
+ pColorConfig->LoadScheme(pBox->GetSelectEntry());
+ pExtColorConfig->LoadScheme(pBox->GetSelectEntry());
+ UpdateColorConfig();
+ return 0;
+}
+/* -----------------------------09.04.2002 15:21------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, PushButton*, pButton )
+{
+ if(&aSaveSchemePB == pButton)
+ {
+ String sName;
+ //CHINA001 SvxNameDialog aNameDlg(pButton,
+ //CHINA001 sName,
+ //CHINA001 String(SVX_RES(RID_SVXSTR_COLOR_CONFIG_SAVE2)));
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( pButton,
+ sName, String(SVX_RES(RID_SVXSTR_COLOR_CONFIG_SAVE2)), RID_SVXDLG_NAME );
+ DBG_ASSERT(aNameDlg, "Dialogdiet fail!");//CHINA001
+ aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl));
+ aNameDlg->SetText(String(SVX_RES(RID_SVXSTR_COLOR_CONFIG_SAVE1)));
+ aNameDlg->SetHelpId(HID_OPTIONS_COLORCONFIG_SAVE_SCHEME);
+ aNameDlg->SetEditHelpId(HID_OPTIONS_COLORCONFIG_NAME_SCHEME);
+ aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl));
+ if(RET_OK == aNameDlg->Execute()) //CHINA001 if(RET_OK == aNameDlg.Execute())
+ {
+ aNameDlg->GetName(sName); //CHINA001 aNameDlg.GetName(sName);
+ pColorConfig->AddScheme(sName);
+ pExtColorConfig->AddScheme(sName);
+ aColorSchemeLB.InsertEntry(sName);
+ aColorSchemeLB.SelectEntry(sName);
+ aColorSchemeLB.GetSelectHdl().Call(&aColorSchemeLB);
+ }
+ delete aNameDlg; //add by CHINA001
+ }
+ else
+ {
+ DBG_ASSERT(aColorSchemeLB.GetEntryCount() > 1, "don't delete the last scheme");
+ QueryBox aQuery(pButton, SVX_RES(RID_SVXQB_DELETE_COLOR_CONFIG));
+ aQuery.SetText(String(SVX_RES(RID_SVXSTR_COLOR_CONFIG_DELETE)));
+ if(RET_YES == aQuery.Execute())
+ {
+ rtl::OUString sDeleteScheme(aColorSchemeLB.GetSelectEntry());
+ aColorSchemeLB.RemoveEntry(aColorSchemeLB.GetSelectEntryPos());
+ aColorSchemeLB.SelectEntryPos(0);
+ aColorSchemeLB.GetSelectHdl().Call(&aColorSchemeLB);
+ //first select the new scheme and then delete the old one
+ pColorConfig->DeleteScheme(sDeleteScheme);
+ pExtColorConfig->DeleteScheme(sDeleteScheme);
+ }
+ }
+ aDeleteSchemePB.Enable( aColorSchemeLB.GetEntryCount() > 1 );
+ return 0;
+}
+/* -----------------------------09.04.2002 15:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxColorOptionsTabPage, CheckNameHdl_Impl, AbstractSvxNameDialog*, pDialog )
+{
+ String sName;
+ pDialog->GetName(sName);
+ return sName.Len() && LISTBOX_ENTRY_NOTFOUND == aColorSchemeLB.GetEntryPos( sName );
+}
+/* -----------------------------25.04.2002 15:12------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxColorOptionsTabPage::FillUserData()
+{
+ SetUserData(String::CreateFromInt32(pColorConfigCT->GetScrollPosition()));
+}
+
diff --git a/cui/source/options/optcolor.hrc b/cui/source/options/optcolor.hrc
new file mode 100644
index 000000000000..06730cf196c0
--- /dev/null
+++ b/cui/source/options/optcolor.hrc
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * 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: optcolor.hrc,v $
+ * $Revision: 1.8.196.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTCOLOR_HRC
+#define _SVX_OPTCOLOR_HRC
+
+//Color config page
+#define FL_COLORSCHEME 1
+#define FT_COLORSCHEME 2
+#define LB_COLORSCHEME 3
+#define PB_SAVESCHEME 4
+#define PB_DELETESCHEME 5
+#define FL_CUSTOMCOLORS 6
+#define CT_COLORCONFIG 7
+
+#define HB_HEADER 10
+#define VB_VSCROLL 11
+#define WN_SCROLL 12
+#define ST_ON 17
+#define ST_UIELEM 18
+#define ST_COLSET 19
+#define ST_PREVIEW 20
+
+#define FT_GENERAL 30
+#define FT_DOCCOLOR 31
+#define LB_DOCCOLOR 32
+#define WN_DOCCOLOR 33
+#define CB_DOCBOUND 34
+#define LB_DOCBOUND 35
+#define WN_DOCBOUND 36
+#define FT_APPBACKGROUND 37
+#define LB_APPBACKGROUND 38
+#define WN_APPBACKGROUND 39
+#define CB_OBJECTBOUNDARIES 40
+#define LB_OBJECTBOUNDARIES 41
+#define WN_OBJECTBOUNDARIES 42
+#define CB_TABLEBOUNDARIES 43
+#define LB_TABLEBOUNDARIES 44
+#define WN_TABLEBOUNDARIES 45
+#define FT_FONTCOLOR 46
+#define LB_FONTCOLOR 47
+#define WN_FONTCOLOR 48
+#define CB_LINKS 49
+#define LB_LINKS 50
+#define WN_LINKS 51
+#define CB_LINKSVISITED 52
+#define LB_LINKSVISITED 53
+#define WN_LINKSVISITED 54
+
+#define FT_SPELL 58
+#define LB_SPELL 59
+#define WN_SPELL 60
+
+#define FT_WRITER 61
+#define FT_WRITERTEXTGRID 62
+#define LB_WRITERTEXTGRID 63
+#define WN_WRITERTEXTGRID 64
+#define CB_WRITERFIELDSHADINGS 65
+#define LB_WRITERFIELDSHADINGS 66
+#define WN_WRITERFIELDSHADINGS 67
+#define CB_WRITERIDXSHADINGS 68
+#define LB_WRITERIDXSHADINGS 69
+#define WN_WRITERIDXSHADINGS 70
+#define LB_WRITERDIRECTCURSOR 71
+#define FT_WRITERDIRECTCURSOR 72
+#define WN_WRITERDIRECTCURSOR 73
+#define LB_WRITERSCRIPTINDICATOR 77
+#define FT_WRITERSCRIPTINDICATOR 78
+#define WN_WRITERSCRIPTINDICATOR 79
+#define LB_WRITERSECTIONBOUNDARIES 80
+#define CB_WRITERSECTIONBOUNDARIES 81
+#define WN_WRITERSECTIONBOUNDARIES 82
+#define LB_WRITERPAGEBREAKS 83
+#define FT_WRITERPAGEBREAKS 84
+#define WN_WRITERPAGEBREAKS 85
+
+#define FT_HTML 88
+#define FT_HTMLSGML 89
+#define LB_HTMLSGML 90
+#define WN_HTMLSGML 91
+#define FT_HTMLCOMMENT 92
+#define LB_HTMLCOMMENT 93
+#define WN_HTMLCOMMENT 94
+#define FT_HTMLKEYWORD 95
+#define LB_HTMLKEYWORD 96
+#define WN_HTMLKEYWORD 97
+#define FT_HTMLUNKNOWN 98
+#define LB_HTMLUNKNOWN 99
+#define WN_HTMLUNKNOWN 100
+
+#define FT_CALC 103
+#define FT_CALCGRID 104
+#define LB_CALCGRID 105
+#define WN_CALCGRID 106
+#define FT_CALCPAGEBREAK 107
+#define LB_CALCPAGEBREAK 108
+#define WN_CALCPAGEBREAK 109
+#define FT_CALCPAGEBREAKMANUAL 100
+#define LB_CALCPAGEBREAKMANUAL 101
+#define WN_CALCPAGEBREAKMANUAL 112
+#define FT_CALCPAGEBREAKAUTO 113
+#define LB_CALCPAGEBREAKAUTO 114
+#define WN_CALCPAGEBREAKAUTO 115
+#define FT_CALCDETECTIVE 116
+#define LB_CALCDETECTIVE 117
+#define WN_CALCDETECTIVE 118
+#define FT_CALCDETECTIVEERROR 119
+#define LB_CALCDETECTIVEERROR 120
+#define WN_CALCDETECTIVEERROR 121
+#define FT_CALCREFERENCE 122
+#define LB_CALCREFERENCE 123
+#define WN_CALCREFERENCE 124
+#define FT_CALCNOTESBACKGROUND 125
+#define LB_CALCNOTESBACKGROUND 126
+#define WN_CALCNOTESBACKGROUND 127
+#define FT_DRAW 128
+#define FT_DRAWGRID 132
+#define LB_DRAWGRID 133
+#define WN_DRAWGRID 134
+#define FT_BASICIDENTIFIER 141
+#define LB_BASICIDENTIFIER 142
+#define WN_BASICIDENTIFIER 143
+#define FT_BASICCOMMENT 144
+#define LB_BASICCOMMENT 145
+#define WN_BASICCOMMENT 146
+#define FT_BASICNUMBER 147
+#define LB_BASICNUMBER 148
+#define WN_BASICNUMBER 142
+#define FT_BASICSTRING 153
+#define LB_BASICSTRING 154
+#define WN_BASICSTRING 155
+#define FT_BASICOPERATOR 156
+#define LB_BASICOPERATOR 157
+#define WN_BASICOPERATOR 158
+#define FT_BASICKEYWORD 159
+#define LB_BASICKEYWORD 160
+#define WN_BASICKEYWORD 161
+#define FT_BASIC 162
+#define FT_BASICERROR 163
+#define LB_BASICERROR 164
+#define WN_BASICERROR 165
+
+#define FT_SQL_COMMAND 173
+#define FT_SQLIDENTIFIER 174
+#define LB_SQLIDENTIFIER 175
+#define WN_SQLIDENTIFIER 176
+#define FT_SQLNUMBER 177
+#define LB_SQLNUMBER 178
+#define WN_SQLNUMBER 179
+#define FT_SQLSTRING 180
+#define LB_SQLSTRING 181
+#define WN_SQLSTRING 182
+#define FT_SQLOPERATOR 183
+#define LB_SQLOPERATOR 184
+#define WN_SQLOPERATOR 185
+#define FT_SQLKEYWORD 186
+#define LB_SQLKEYWORD 187
+#define WN_SQLKEYWORD 188
+#define FT_SQLPARAMETER 189
+#define LB_SQLPARAMETER 190
+#define WN_SQLPARAMETER 191
+#define FT_SQLCOMMENT 192
+#define LB_SQLCOMMENT 193
+#define WN_SQLCOMMENT 194
+
+#define ST_EXTENSION 166
+
+
+
+#define _FT_WIDTH 120
+#define _LINE_HEIGHT 15
+#define _FT_HEIGHT 10
+#define _CB_WIDTH 130
+#define _FT_XPOS 14
+#define _CB_XPOS 6
+#define _LB_XPOS 139
+#define _LB_WIDTH 50
+#define _LB_HEIGHT 50
+#define _WN_WIDTH 30
+#define _WN_HEIGHT 12
+#define _WN_XPOS 195
+
+#define FT_SMARTTAGS 168
+#define LB_SMARTTAGS 169
+#define WN_SMARTTAGS 170
+
+#define ST_SPELL_CHECK_HIGHLIGHTING 171
+#define ST_GRAMMAR_CHECK_HIGHLIGHTING 172
+
+
+#endif
+
+
+
+
+
diff --git a/cui/source/options/optcolor.hxx b/cui/source/options/optcolor.hxx
new file mode 100644
index 000000000000..c50062f15366
--- /dev/null
+++ b/cui/source/options/optcolor.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * 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: optcolor.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTCOLOR_HXX
+#define _SVX_OPTCOLOR_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+
+/* -----------------------------25.03.2002 10:40------------------------------
+
+ ---------------------------------------------------------------------------*/
+namespace svtools {class EditableColorConfig;class EditableExtendedColorConfig;}
+class ColorConfigCtrl_Impl;
+class AbstractSvxNameDialog; //CHINA001 class SvxNameDialog;
+class SvxColorOptionsTabPage : public SfxTabPage
+{
+ using SfxTabPage::DeactivatePage;
+
+ FixedLine aColorSchemeFL;
+ FixedText aColorSchemeFT;
+ ListBox aColorSchemeLB;
+ PushButton aSaveSchemePB;
+ PushButton aDeleteSchemePB;
+
+ FixedLine aCustomColorsFL;
+
+ BOOL bFillItemSetCalled;
+
+ svtools::EditableColorConfig* pColorConfig;
+ svtools::EditableExtendedColorConfig* pExtColorConfig;
+ ColorConfigCtrl_Impl* pColorConfigCT;
+
+ DECL_LINK(SchemeChangedHdl_Impl, ListBox*);
+ DECL_LINK(SaveDeleteHdl_Impl, PushButton*);
+ DECL_LINK(CheckNameHdl_Impl, AbstractSvxNameDialog*);
+ void UpdateColorConfig();
+
+public:
+ SvxColorOptionsTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxColorOptionsTabPage( );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual int DeactivatePage( SfxItemSet* pSet );
+ virtual void FillUserData();
+
+};
+
+#endif
+
diff --git a/cui/source/options/optcolor.src b/cui/source/options/optcolor.src
new file mode 100644
index 000000000000..593439807c14
--- /dev/null
+++ b/cui/source/options/optcolor.src
@@ -0,0 +1,552 @@
+/*************************************************************************
+ *
+ * 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: optcolor.src,v $
+ * $Revision: 1.47.196.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include "optcolor.hrc"
+ // pragma ----------------------------------------------------------------
+
+TabPage RID_SVXPAGE_COLORCONFIG
+{
+ HelpId = HID_OPTIONS_COLORCONFIG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_COLORSCHEME
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Color scheme";
+ };
+ FixedText FT_COLORSCHEME
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Scheme";
+ };
+ ListBox LB_COLORSCHEME
+ {
+ Pos = MAP_APPFONT ( 65 , 14 ) ;
+ Size = MAP_APPFONT ( 77 , 58 ) ;
+ Border = TRUE;
+ Sort = TRUE;
+ DropDown = TRUE;
+ };
+ PushButton PB_SAVESCHEME
+ {
+ Pos = MAP_APPFONT ( 145, 13 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Save...";
+ };
+ PushButton PB_DELETESCHEME
+ {
+ Pos = MAP_APPFONT ( 198 , 13 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Delete";
+ };
+ FixedLine FL_CUSTOMCOLORS
+ {
+ Pos = MAP_APPFONT ( 6 , 34 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+
+ Text [ en-US ] = "Custom colors";
+ };
+ Control CT_COLORCONFIG
+ {
+ Pos = MAP_APPFONT ( 12 , 45 ) ;
+ Size = MAP_APPFONT ( 236 , 134 ) ;
+ Border = TRUE;
+ DialogControl = TRUE;
+ OutputSize = TRUE ;
+ ScrollBar VB_VSCROLL
+ {
+ Pos = MAP_APPFONT ( 228 , 10 ) ;
+ Size = MAP_APPFONT ( 8 , 124 ) ;
+ VScroll = TRUE;
+ };
+ String ST_ON
+ {
+ Text [ en-US ] = "On";
+ };
+ String ST_UIELEM
+ {
+ Text [ en-US ] = "User interface elements";
+ };
+ String ST_COLSET
+ {
+ Text [ en-US ] = "Color setting";
+ };
+ String ST_PREVIEW
+ {
+ Text [ en-US ] = "Preview";
+ };
+ Window WN_SCROLL
+ {
+
+// misc defines to shorten defining of standard elements
+// standard sizes
+#define FT_SEP_SIZE Size = MAP_APPFONT ( _FT_WIDTH , 8 )
+#define FT_SIZE Size = MAP_APPFONT ( _FT_WIDTH , _FT_HEIGHT )
+#define LB_SIZE Size = MAP_APPFONT ( _LB_WIDTH , _LB_HEIGHT )
+#define WN_SIZE Size = MAP_APPFONT ( _WN_WIDTH , _WN_HEIGHT )
+#define CB_SIZE Size = MAP_APPFONT ( _CB_WIDTH , _FT_HEIGHT )
+
+// combination of position and size
+#define POS_SIZE( POSX, LINENUM, CONTRL_SIZE ) Pos = MAP_APPFONT ( POSX , LINENUM * _LINE_HEIGHT ) ; CONTRL_SIZE
+
+// ... for special types
+#define FT_SEP_POS_SIZE( LINENUM ) POS_SIZE( 14, LINENUM, FT_SEP_SIZE )
+#define FT_POS_SIZE( LINENUM ) POS_SIZE( _FT_XPOS, LINENUM, FT_SIZE )
+#define LB_POS_SIZE( LINENUM ) POS_SIZE( _LB_XPOS, LINENUM, LB_SIZE )
+#define WN_POS_SIZE( LINENUM ) POS_SIZE( _WN_XPOS, LINENUM, WN_SIZE )
+#define CB_POS_SIZE( LINENUM ) POS_SIZE( _CB_XPOS, LINENUM, CB_SIZE )
+
+// combination of a listbox (color chooser) and window (color preview)
+#define LB_WN( ID_POST, LINENUM ) ListBox LB_#ID_POST{LB_POS_SIZE(LINENUM);DropDown=TRUE;};Window WN_#ID_POST{WN_POS_SIZE(LINENUM);Border=TRUE;};
+
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 10 ) ;
+ Size = MAP_APPFONT ( 228 , 124 ) ;
+ DialogControl = TRUE;
+
+ FixedText FT_GENERAL
+ {
+ FT_SEP_POS_SIZE( 0 );
+ Text [ en-US ] = "General";
+ };
+
+ FixedText FT_DOCCOLOR
+ {
+ FT_POS_SIZE( 1 );
+ Text [ en-US ] = "Document background";
+ };
+ LB_WN( DOCCOLOR, 1 )
+
+ CheckBox CB_DOCBOUND
+ {
+ CB_POS_SIZE( 2 );
+ Text [ en-US ] = "Text boundaries";
+ };
+ LB_WN( DOCBOUND, 2 )
+
+ FixedText FT_APPBACKGROUND
+ {
+ FT_POS_SIZE( 3 );
+ Text [ en-US ] = "Application background";
+ };
+ LB_WN( APPBACKGROUND, 3 )
+
+ CheckBox CB_OBJECTBOUNDARIES
+ {
+ CB_POS_SIZE( 4 );
+ Text [ en-US ] = "Object boundaries";
+ };
+ LB_WN( OBJECTBOUNDARIES, 4 )
+
+ CheckBox CB_TABLEBOUNDARIES
+ {
+ CB_POS_SIZE( 5 );
+ Text [ en-US ] = "Table boundaries";
+ };
+ LB_WN( TABLEBOUNDARIES, 5 )
+
+ FixedText FT_FONTCOLOR
+ {
+ FT_POS_SIZE( 6 );
+ Text [ en-US ] = "Font color";
+ };
+ LB_WN( FONTCOLOR, 6 )
+
+ CheckBox CB_LINKS
+ {
+ CB_POS_SIZE( 7 );
+ Text [ en-US ] = "Unvisited links";
+ };
+ LB_WN( LINKS, 7 )
+
+ CheckBox CB_LINKSVISITED
+ {
+ CB_POS_SIZE( 8 );
+ Text [ en-US ] = "Visited links";
+ };
+ LB_WN( LINKSVISITED, 8 )
+
+ FixedText FT_SPELL
+ {
+ FT_POS_SIZE( 9 );
+ Text [ en-US ] = "AutoSpellcheck";
+ };
+ LB_WN( SPELL, 9 )
+
+ FixedText FT_SMARTTAGS
+ {
+ FT_POS_SIZE( 10 );
+ Text [ en-US ] = "Smart Tags";
+ };
+ LB_WN( SMARTTAGS, 10 )
+
+ FixedText FT_WRITER
+ {
+ FT_SEP_POS_SIZE( 11 );
+ Text [ en-US ] = "Text Document";
+ };
+
+ FixedText FT_WRITERTEXTGRID
+ {
+ FT_POS_SIZE( 12 );
+ Text [ en-US ] = "Grid";
+ };
+ LB_WN( WRITERTEXTGRID, 12 )
+
+ CheckBox CB_WRITERFIELDSHADINGS
+ {
+ CB_POS_SIZE( 13 );
+ Text [ en-US ] = "Field shadings";
+ };
+ LB_WN( WRITERFIELDSHADINGS, 13 )
+
+ CheckBox CB_WRITERIDXSHADINGS
+ {
+ CB_POS_SIZE( 14 );
+ Text [ en-US ] = "Index and table shadings";
+ };
+ LB_WN( WRITERIDXSHADINGS, 14 )
+
+
+ FixedText FT_WRITERSCRIPTINDICATOR
+ {
+ FT_POS_SIZE( 15 );
+ Text [ en-US ] = "Script indicator";
+ };
+ LB_WN( WRITERSCRIPTINDICATOR, 15 )
+
+ CheckBox CB_WRITERSECTIONBOUNDARIES
+ {
+ CB_POS_SIZE( 16 );
+ Text [ en-US ] = "Section boundaries";
+ };
+ LB_WN( WRITERSECTIONBOUNDARIES, 16 )
+
+ FixedText FT_WRITERPAGEBREAKS
+ {
+ FT_POS_SIZE( 17 );
+ Text [ en-US ] = "Page and column breaks";
+ };
+ LB_WN( WRITERPAGEBREAKS, 17 )
+
+ FixedText FT_WRITERDIRECTCURSOR
+ {
+ FT_POS_SIZE( 18 );
+ Text [ en-US ] = "Direct cursor";
+ };
+ LB_WN( WRITERDIRECTCURSOR, 18 )
+
+ FixedText FT_HTML
+ {
+ FT_SEP_POS_SIZE( 19 );
+ Text [ en-US ] = "HTML Document";
+ };
+
+ FixedText FT_HTMLSGML
+ {
+ FT_POS_SIZE( 20 );
+ Text [ en-US ] = "SGML syntax highlighting";
+ };
+ LB_WN( HTMLSGML, 20 )
+
+ FixedText FT_HTMLCOMMENT
+ {
+ FT_POS_SIZE( 21 );
+ Text [ en-US ] = "Comment highlighting";
+ };
+ LB_WN( HTMLCOMMENT, 21 )
+
+ FixedText FT_HTMLKEYWORD
+ {
+ FT_POS_SIZE( 22 );
+ Text [ en-US ] = "Keyword highlighting";
+ };
+ LB_WN( HTMLKEYWORD, 22 )
+
+ FixedText FT_HTMLUNKNOWN
+ {
+ FT_POS_SIZE( 23 );
+ Text [ en-US ] = "Text";
+ };
+ LB_WN( HTMLUNKNOWN, 23 )
+
+ FixedText FT_CALC
+ {
+ FT_SEP_POS_SIZE( 24 );
+ Text [ en-US ] = "Spreadsheet";
+ };
+
+ FixedText FT_CALCGRID
+ {
+ FT_POS_SIZE( 25 );
+ Text [ en-US ] = "Grid lines";
+ };
+ LB_WN( CALCGRID, 25 )
+
+ FixedText FT_CALCPAGEBREAK
+ {
+ FT_POS_SIZE( 26 );
+ Text [ en-US ] = "Page breaks";
+ };
+ LB_WN( CALCPAGEBREAK, 26 )
+
+ FixedText FT_CALCPAGEBREAKMANUAL
+ {
+ FT_POS_SIZE( 27 );
+ Text [ en-US ] = "Manual page breaks";
+ };
+ LB_WN( CALCPAGEBREAKMANUAL, 27 )
+
+ FixedText FT_CALCPAGEBREAKAUTO
+ {
+ FT_POS_SIZE( 28 );
+ Text [ en-US ] = "Automatic page breaks";
+ };
+ LB_WN( CALCPAGEBREAKAUTO, 28)
+
+ FixedText FT_CALCDETECTIVE
+ {
+ FT_POS_SIZE( 29 );
+ Text [ en-US ] = "Detective";
+ };
+ LB_WN( CALCDETECTIVE, 29 )
+
+ FixedText FT_CALCDETECTIVEERROR
+ {
+ FT_POS_SIZE( 30 );
+ Text [ en-US ] = "Detective error";
+ };
+ LB_WN( CALCDETECTIVEERROR, 30 )
+
+ FixedText FT_CALCREFERENCE
+ {
+ FT_POS_SIZE( 31 );
+ Text [ en-US ] = "References";
+ };
+ LB_WN( CALCREFERENCE, 31 )
+
+ FixedText FT_CALCNOTESBACKGROUND
+ {
+ FT_POS_SIZE( 32 );
+ Text [ en-US ] = "Notes background";
+ };
+ LB_WN( CALCNOTESBACKGROUND, 32 )
+
+ FixedText FT_DRAW
+ {
+ FT_SEP_POS_SIZE( 33 );
+ Text [ en-US ] = "Drawing / Presentation";
+ };
+
+ FixedText FT_DRAWGRID
+ {
+ FT_POS_SIZE( 34 );
+ Text [ en-US ] = "Grid";
+ };
+ LB_WN( DRAWGRID, 34 )
+
+ FixedText FT_BASIC
+ {
+ FT_SEP_POS_SIZE( 35 );
+ Text [ en-US ] = "Basic Syntax Highlighting";
+ };
+
+ FixedText FT_BASICIDENTIFIER
+ {
+ FT_POS_SIZE( 36 );
+ Text [ en-US ] = "Identifier";
+ };
+ LB_WN( BASICIDENTIFIER, 36 )
+
+ FixedText FT_BASICCOMMENT
+ {
+ FT_POS_SIZE( 37 );
+ Text [ en-US ] = "Comment";
+ };
+ LB_WN( BASICCOMMENT, 37 )
+
+ FixedText FT_BASICNUMBER
+ {
+ FT_POS_SIZE( 38 );
+ Text [ en-US ] = "Number";
+ };
+ LB_WN( BASICNUMBER, 38)
+
+ FixedText FT_BASICSTRING
+ {
+ FT_POS_SIZE( 39 );
+ Text [ en-US ] = "String";
+ };
+ LB_WN( BASICSTRING, 39 )
+
+ FixedText FT_BASICOPERATOR
+ {
+ FT_POS_SIZE( 40 );
+ Text [ en-US ] = "Operator";
+ };
+ LB_WN( BASICOPERATOR, 40 )
+
+ FixedText FT_BASICKEYWORD
+ {
+ FT_POS_SIZE( 41 );
+ Text [ en-US ] = "Reserved expression";
+ };
+ LB_WN( BASICKEYWORD, 41 )
+
+ FixedText FT_BASICERROR
+ {
+ FT_POS_SIZE( 42 );
+ Text [ en-US ] = "Error";
+ };
+ LB_WN( BASICERROR, 42 )
+
+ FixedText FT_SQL_COMMAND
+ {
+ FT_SEP_POS_SIZE( 43 );
+ Text [ en-US ] = "SQL Syntax Highlighting";
+ };
+
+ FixedText FT_SQLIDENTIFIER
+ {
+ FT_POS_SIZE( 44 );
+ Text [ en-US ] = "Identifier";
+ };
+ LB_WN( SQLIDENTIFIER, 44 )
+
+ FixedText FT_SQLNUMBER
+ {
+ FT_POS_SIZE( 45 );
+ Text [ en-US ] = "Number";
+ };
+ LB_WN( SQLNUMBER, 45 )
+
+ FixedText FT_SQLSTRING
+ {
+ FT_POS_SIZE( 46 );
+ Text [ en-US ] = "String";
+ };
+ LB_WN( SQLSTRING, 46 )
+
+ FixedText FT_SQLOPERATOR
+ {
+ FT_POS_SIZE( 47 );
+ Text [ en-US ] = "Operator";
+ };
+ LB_WN( SQLOPERATOR, 47 )
+
+ FixedText FT_SQLKEYWORD
+ {
+ FT_POS_SIZE( 48 );
+ Text [ en-US ] = "Keyword";
+ };
+ LB_WN( SQLKEYWORD, 48 )
+
+ FixedText FT_SQLPARAMETER
+ {
+ FT_POS_SIZE( 49 );
+ Text [ en-US ] = "Parameter";
+ };
+ LB_WN( SQLPARAMETER, 49 )
+
+ FixedText FT_SQLCOMMENT
+ {
+ FT_POS_SIZE( 50 );
+ Text [ en-US ] = "Comment";
+ };
+ LB_WN( SQLCOMMENT, 50 )
+
+ String ST_EXTENSION
+ {
+ Text [ en-US ] = "Colorsettings of the Extensions";
+ };
+ String ST_SPELL_CHECK_HIGHLIGHTING
+ {
+ Text [ en-US ] = "Spell check highlighting";
+ };
+ String ST_GRAMMAR_CHECK_HIGHLIGHTING
+ {
+ Text [ en-US ] = "Grammar check highlighting";
+ };
+ };
+ };
+};
+QueryBox RID_SVXQB_DELETE_COLOR_CONFIG
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Do you really want to delete the color scheme?" ;
+};
+String RID_SVXSTR_COLOR_CONFIG_DELETE
+{
+ Text [ en-US ] = "Color Scheme Deletion" ;
+};
+String RID_SVXSTR_COLOR_CONFIG_SAVE1
+{
+ Text [ en-US ] = "Save scheme" ;
+};
+String RID_SVXSTR_COLOR_CONFIG_SAVE2
+{
+ Text [ en-US ] = "Name of color scheme" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optctl.cxx b/cui/source/options/optctl.cxx
new file mode 100644
index 000000000000..053bd1f4462b
--- /dev/null
+++ b/cui/source/options/optctl.cxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * 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: optctl.cxx,v $
+ * $Revision: 1.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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include "optctl.hxx"
+#include <svx/dialmgr.hxx>
+#include "optctl.hrc"
+#include <svx/dialogs.hrc>
+#include <svl/ctloptions.hxx>
+
+// class SvxCTLOptionsPage -----------------------------------------------------
+
+IMPL_LINK( SvxCTLOptionsPage, SequenceCheckingCB_Hdl, void*, EMPTYARG )
+{
+ sal_Bool bIsSequenceChecking = m_aSequenceCheckingCB.IsChecked();
+ m_aRestrictedCB.Enable( bIsSequenceChecking );
+ m_aTypeReplaceCB.Enable( bIsSequenceChecking );
+ // #i48117#: by default restricted and type&replace have to be switched on
+ if(bIsSequenceChecking)
+ {
+ m_aTypeReplaceCB.Check( sal_True );
+ m_aRestrictedCB.Check( sal_True );
+ }
+ return 0;
+}
+
+SvxCTLOptionsPage::SvxCTLOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_OPTIONS_CTL ), rSet ),
+
+ m_aSequenceCheckingFL ( this, SVX_RES( FL_SEQUENCECHECKING ) ),
+ m_aSequenceCheckingCB ( this, SVX_RES( CB_SEQUENCECHECKING ) ),
+ m_aRestrictedCB ( this, SVX_RES( CB_RESTRICTED ) ),
+ m_aTypeReplaceCB ( this, SVX_RES( CB_TYPE_REPLACE ) ),
+ m_aCursorControlFL ( this, SVX_RES( FL_CURSORCONTROL ) ),
+ m_aMovementFT ( this, SVX_RES( FT_MOVEMENT ) ),
+ m_aMovementLogicalRB ( this, SVX_RES( RB_MOVEMENT_LOGICAL ) ),
+ m_aMovementVisualRB ( this, SVX_RES( RB_MOVEMENT_VISUAL ) ),
+ m_aGeneralFL ( this, SVX_RES( FL_GENERAL ) ),
+ m_aNumeralsFT ( this, SVX_RES( FT_NUMERALS ) ),
+ m_aNumeralsLB ( this, SVX_RES( LB_NUMERALS ) )
+
+{
+ FreeResource();
+
+ m_aSequenceCheckingCB.SetClickHdl( LINK( this, SvxCTLOptionsPage, SequenceCheckingCB_Hdl ) );
+
+ m_aNumeralsLB.SetDropDownLineCount( m_aNumeralsLB.GetEntryCount() );
+}
+// -----------------------------------------------------------------------------
+SvxCTLOptionsPage::~SvxCTLOptionsPage()
+{
+}
+// -----------------------------------------------------------------------------
+SfxTabPage* SvxCTLOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxCTLOptionsPage( pParent, rAttrSet );
+}
+// -----------------------------------------------------------------------------
+BOOL SvxCTLOptionsPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bModified = FALSE;
+ SvtCTLOptions aCTLOptions;
+
+ // Sequence checking
+ BOOL bChecked = m_aSequenceCheckingCB.IsChecked();
+ if ( bChecked != m_aSequenceCheckingCB.GetSavedValue() )
+ {
+ aCTLOptions.SetCTLSequenceChecking( bChecked );
+ bModified = TRUE;
+ }
+
+ bChecked = m_aRestrictedCB.IsChecked();
+ if( bChecked != m_aRestrictedCB.GetSavedValue() )
+ {
+ aCTLOptions.SetCTLSequenceCheckingRestricted( bChecked );
+ bModified = TRUE;
+ }
+ bChecked = m_aTypeReplaceCB.IsChecked();
+ if( bChecked != m_aTypeReplaceCB.GetSavedValue())
+ {
+ aCTLOptions.SetCTLSequenceCheckingTypeAndReplace(bChecked);
+ bModified = TRUE;
+ }
+
+ BOOL bLogicalChecked = m_aMovementLogicalRB.IsChecked();
+ BOOL bVisualChecked = m_aMovementVisualRB.IsChecked();
+ if ( bLogicalChecked != m_aMovementLogicalRB.GetSavedValue() ||
+ bVisualChecked != m_aMovementVisualRB.GetSavedValue() )
+ {
+ SvtCTLOptions::CursorMovement eMovement =
+ bLogicalChecked ? SvtCTLOptions::MOVEMENT_LOGICAL : SvtCTLOptions::MOVEMENT_VISUAL;
+ aCTLOptions.SetCTLCursorMovement( eMovement );
+ bModified = TRUE;
+ }
+
+ USHORT nPos = m_aNumeralsLB.GetSelectEntryPos();
+ if ( nPos != m_aNumeralsLB.GetSavedValue() )
+ {
+ aCTLOptions.SetCTLTextNumerals( (SvtCTLOptions::TextNumerals)nPos );
+ bModified = TRUE;
+ }
+
+ return bModified;
+}
+// -----------------------------------------------------------------------------
+void SvxCTLOptionsPage::Reset( const SfxItemSet& )
+{
+ SvtCTLOptions aCTLOptions;
+
+ m_aSequenceCheckingCB.Check( aCTLOptions.IsCTLSequenceChecking() );
+ m_aRestrictedCB.Check( aCTLOptions.IsCTLSequenceCheckingRestricted() );
+ m_aTypeReplaceCB.Check( aCTLOptions.IsCTLSequenceCheckingTypeAndReplace() );
+
+ SvtCTLOptions::CursorMovement eMovement = aCTLOptions.GetCTLCursorMovement();
+ switch ( eMovement )
+ {
+ case SvtCTLOptions::MOVEMENT_LOGICAL :
+ m_aMovementLogicalRB.Check();
+ break;
+
+ case SvtCTLOptions::MOVEMENT_VISUAL :
+ m_aMovementVisualRB.Check();
+ break;
+
+ default:
+ DBG_ERRORFILE( "SvxCTLOptionsPage::Reset(): invalid movement enum" );
+ }
+
+ USHORT nPos = (USHORT)aCTLOptions.GetCTLTextNumerals();
+ DBG_ASSERT( nPos < m_aNumeralsLB.GetEntryCount(), "SvxCTLOptionsPage::Reset(): invalid numerals enum" );
+ m_aNumeralsLB.SelectEntryPos( nPos );
+
+ m_aSequenceCheckingCB.SaveValue();
+ m_aRestrictedCB.SaveValue();
+ m_aTypeReplaceCB.SaveValue();
+ m_aMovementLogicalRB.SaveValue();
+ m_aMovementVisualRB.SaveValue();
+ m_aNumeralsLB.SaveValue();
+
+ sal_Bool bIsSequenceChecking = m_aSequenceCheckingCB.IsChecked();
+ m_aRestrictedCB.Enable( bIsSequenceChecking );
+ m_aTypeReplaceCB.Enable( bIsSequenceChecking );
+}
+
diff --git a/cui/source/options/optctl.hrc b/cui/source/options/optctl.hrc
new file mode 100644
index 000000000000..4897926f610c
--- /dev/null
+++ b/cui/source/options/optctl.hrc
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * 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: optctl.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTCTL_HRC
+#define _SVX_OPTCTL_HRC
+
+#include <svtools/controldims.hrc>
+
+#define FL_SEQUENCECHECKING 10
+#define CB_SEQUENCECHECKING 11
+#define CB_RESTRICTED 12
+#define CB_TYPE_REPLACE 13
+
+#define FL_CURSORCONTROL 20
+#define FT_MOVEMENT 21
+#define RB_MOVEMENT_LOGICAL 22
+#define RB_MOVEMENT_VISUAL 23
+
+#define FL_GENERAL 30
+#define FT_NUMERALS 31
+#define LB_NUMERALS 32
+
+#define EXTRA_SPACE_Y 16
+#define ROW_0 (RSC_SP_TBPG_INNERBORDER_TOP)
+#define ROW_1 (ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_2 (ROW_1+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_3 (ROW_2+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y+EXTRA_SPACE_Y)
+#define ROW_4 (ROW_3+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_5 (ROW_4+(RSC_CD_RADIOBUTTON_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+#define ROW_6 (ROW_5+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_Y+EXTRA_SPACE_Y)
+#define ROW_7 (ROW_6+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_8 (ROW_7+(RSC_CD_DROPDOWN_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+
+#endif // #ifndef _SVX_OPTCTL_HRC
+
diff --git a/cui/source/options/optctl.hxx b/cui/source/options/optctl.hxx
new file mode 100644
index 000000000000..0dae0e24f180
--- /dev/null
+++ b/cui/source/options/optctl.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: optctl.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTCTL_HXX
+#define _SVX_OPTCTL_HXX
+
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <sfx2/tabdlg.hxx>
+
+// class SvxCTLOptionsPage -----------------------------------------------------
+
+class SvxCTLOptionsPage : public SfxTabPage
+{
+private:
+ FixedLine m_aSequenceCheckingFL;
+ CheckBox m_aSequenceCheckingCB;
+ CheckBox m_aRestrictedCB;
+ CheckBox m_aTypeReplaceCB;
+
+ FixedLine m_aCursorControlFL;
+ FixedText m_aMovementFT;
+ RadioButton m_aMovementLogicalRB;
+ RadioButton m_aMovementVisualRB;
+
+ FixedLine m_aGeneralFL;
+ FixedText m_aNumeralsFT;
+ ListBox m_aNumeralsLB;
+
+ DECL_LINK( SequenceCheckingCB_Hdl, void* );
+
+ SvxCTLOptionsPage( Window* pParent, const SfxItemSet& rSet );
+
+public:
+
+ virtual ~SvxCTLOptionsPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif // #ifndef _SVX_OPTCTL_HXX
+
diff --git a/cui/source/options/optctl.src b/cui/source/options/optctl.src
new file mode 100644
index 000000000000..2cf9ad051f67
--- /dev/null
+++ b/cui/source/options/optctl.src
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * 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: optctl.src,v $
+ * $Revision: 1.20.254.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "optctl.hrc"
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+
+#include <sfx2/sfx.hrc>
+
+TabPage RID_SVXPAGE_OPTIONS_CTL
+{
+ HelpId = HID_OPTIONS_CTL ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Complex Text Layout" ;
+ FixedLine FL_SEQUENCECHECKING
+ {
+ Pos = MAP_APPFONT ( 6, ROW_0 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Sequence checking";
+ };
+ CheckBox CB_SEQUENCECHECKING
+ {
+ Pos = MAP_APPFONT ( 12, ROW_1 ) ;
+ Size = MAP_APPFONT ( 236 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Use se~quence checking";
+ };
+ CheckBox CB_RESTRICTED
+ {
+ Pos = MAP_APPFONT ( 18, ROW_2 );
+ Size = MAP_APPFONT ( 236, RSC_CD_CHECKBOX_HEIGHT );
+ Text[ en-US ] = "Restricted";
+ };
+ CheckBox CB_TYPE_REPLACE
+ {
+ Pos = MAP_APPFONT ( 18, ROW_2+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y );
+ Size = MAP_APPFONT ( 236, RSC_CD_CHECKBOX_HEIGHT );
+ Text[ en-US ] = "~Type and replace";
+ };
+ FixedLine FL_CURSORCONTROL
+ {
+ Pos = MAP_APPFONT ( 6, ROW_3 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Cursor control";
+ };
+ FixedText FT_MOVEMENT
+ {
+ Pos = MAP_APPFONT ( 12, ROW_5 ) ;
+ Size = MAP_APPFONT ( 90 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Movement";
+ };
+ RadioButton RB_MOVEMENT_LOGICAL
+ {
+ Pos = MAP_APPFONT ( 105, ROW_4 ) ;
+ Size = MAP_APPFONT ( 69 , RSC_CD_RADIOBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "Lo~gical";
+ };
+ RadioButton RB_MOVEMENT_VISUAL
+ {
+ Pos = MAP_APPFONT ( 177, ROW_4 ) ;
+ Size = MAP_APPFONT ( 69 , RSC_CD_RADIOBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "~Visual";
+ };
+ FixedLine FL_GENERAL
+ {
+ Pos = MAP_APPFONT ( 6, ROW_6 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "General options";
+ };
+ FixedText FT_NUMERALS
+ {
+ Pos = MAP_APPFONT ( 12, ROW_8 ) ;
+ Size = MAP_APPFONT ( 90 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "~Numerals";
+ };
+ ListBox LB_NUMERALS
+ {
+ Pos = MAP_APPFONT ( 105, ROW_7 ) ;
+ Size = MAP_APPFONT ( 69 , 3*RSC_CD_DROPDOWN_HEIGHT ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ StringList [ en-US ]=
+ {
+ < "Arabic" ; > ;
+ < "Hindi" ; > ;
+ < "System" ; > ;
+ < "Context" ; > ;
+ };
+ };
+};
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
new file mode 100644
index 000000000000..5111c72088fa
--- /dev/null
+++ b/cui/source/options/optdict.cxx
@@ -0,0 +1,804 @@
+/*************************************************************************
+ *
+ * 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: optdict.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <svx/unolingu.hxx>
+#include <svx/dlgutil.hxx>
+#include <sfx2/sfxuno.hxx>
+#include <svl/eitem.hxx>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <comphelper/processfactory.hxx>
+#include <unotools/intlwrapper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+
+#define _SVX_OPTDICT_CXX
+
+#include <linguistic/misc.hxx>
+#include <svx/dialogs.hrc>
+#include "optdict.hrc"
+#include "optdict.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/svxerr.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::linguistic2;
+
+// static ----------------------------------------------------------------
+
+static const sal_uInt16 nNameLen = 8;
+static const short NOACTDICT = -1;
+
+static long nStaticTabs[]=
+{
+ 2,10,71,120
+};
+
+// static function -------------------------------------------------------
+
+static String getNormDicEntry_Impl( const String &rText )
+{
+ String aTmp( rText );
+ aTmp.EraseTrailingChars( '.' );
+ aTmp.EraseAllChars( '=' );
+ return aTmp;
+}
+
+
+// Compare Dictionary Entry result
+enum CDE_RESULT { CDE_EQUAL, CDE_SIMILAR, CDE_DIFFERENT };
+
+static CDE_RESULT cmpDicEntry_Impl( const String &rText1, const String &rText2 )
+{
+ CDE_RESULT eRes = CDE_DIFFERENT;
+
+ if (rText1 == rText2)
+ eRes = CDE_EQUAL;
+ else
+ { // similar = equal up to trailing '.' and hyphenation positions
+ // marked with '='
+ if (getNormDicEntry_Impl( rText1 ) == getNormDicEntry_Impl( rText2 ))
+ eRes = CDE_SIMILAR;
+ }
+
+ return eRes;
+}
+
+// class SvxNewDictionaryDialog -------------------------------------------
+
+SvxNewDictionaryDialog::SvxNewDictionaryDialog( Window* pParent,
+ Reference< XSpellChecker1 > &xSpl ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SFXDLG_NEWDICT ) ),
+
+ aNameText ( this, SVX_RES( FT_DICTNAME ) ),
+ aNameEdit ( this, SVX_RES( ED_DICTNAME ) ),
+ aLanguageText ( this, SVX_RES( FT_DICTLANG ) ),
+ aLanguageLB ( this, SVX_RES( LB_DICTLANG ) ),
+ aExceptBtn ( this, SVX_RES( BTN_EXCEPT ) ),
+ aNewDictBox ( this, SVX_RES( GB_NEWDICT ) ),
+ aOKBtn ( this, SVX_RES( BTN_NEWDICT_OK ) ),
+ aCancelBtn ( this, SVX_RES( BTN_NEWDICT_ESC ) ),
+ aHelpBtn ( this, SVX_RES( BTN_NEWDICT_HLP ) ),
+ xSpell( xSpl )
+{
+ // Handler installieren
+ aNameEdit.SetModifyHdl(
+ LINK( this, SvxNewDictionaryDialog, ModifyHdl_Impl ) );
+ aOKBtn.SetClickHdl( LINK( this, SvxNewDictionaryDialog, OKHdl_Impl ) );
+
+ // Sprachen anzeigen
+ aLanguageLB.SetLanguageList( LANG_LIST_ALL, TRUE, TRUE );
+ aLanguageLB.SelectEntryPos(0);
+
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxNewDictionaryDialog, OKHdl_Impl, Button *, EMPTYARG )
+{
+ String sDict = aNameEdit.GetText();
+ sDict.EraseTrailingChars();
+ // add extension for personal dictionaries
+ sDict.AppendAscii(".dic");
+
+ Reference< XDictionaryList > xDicList( SvxGetDictionaryList() );
+
+ Sequence< Reference< XDictionary > > aDics;
+ if (xDicList.is())
+ aDics = xDicList->getDictionaries();
+ const Reference< XDictionary > *pDic = aDics.getConstArray();
+ sal_Int32 nCount = (sal_uInt16) aDics.getLength();
+
+ sal_Bool bFound = sal_False;
+ sal_uInt16 i;
+ for (i = 0; !bFound && i < nCount; ++i )
+ if ( sDict.EqualsIgnoreCaseAscii( String(pDic[i]->getName()) ))
+ bFound = sal_True;
+
+ if ( bFound )
+ {
+ // Doppelte Namen?
+ InfoBox( this, SVX_RESSTR( RID_SVXSTR_OPT_DOUBLE_DICTS ) ).Execute();
+ aNameEdit.GrabFocus();
+ return 0;
+ }
+
+ // Erzeugen und hinzufuegen
+ sal_uInt16 nLang = aLanguageLB.GetSelectLanguage();
+ try
+ {
+ // create new dictionary
+ DictionaryType eType = aExceptBtn.IsChecked() ?
+ DictionaryType_NEGATIVE : DictionaryType_POSITIVE;
+ if (xDicList.is())
+ {
+ lang::Locale aLocale( SvxCreateLocale(nLang) );
+ String aURL( linguistic::GetWritableDictionaryURL( sDict ) );
+ xNewDic = Reference< XDictionary > (
+ xDicList->createDictionary( sDict, aLocale, eType, aURL ) , UNO_QUERY );
+ }
+ DBG_ASSERT(xNewDic.is(), "NULL pointer");
+ }
+ catch(...)
+ {
+ xNewDic = NULL;
+
+ // Fehler: konnte neues W"orterbuch nicht anlegen
+ SfxErrorContext aContext( ERRCTX_SVX_LINGU_DICTIONARY, String(),
+ this, RID_SVXERRCTX, &DIALOG_MGR() );
+ ErrorHandler::HandleError( *new StringErrorInfo(
+ ERRCODE_SVX_LINGU_DICT_NOTWRITEABLE, sDict ) );
+
+ EndDialog( RET_CANCEL );
+ }
+
+ if (xDicList.is() && xNewDic.is())
+ {
+ xDicList->addDictionary( Reference< XDictionary > ( xNewDic, UNO_QUERY ) );
+
+ // refresh list of dictionaries
+ //! dictionaries may have been added/removed elsewhere too.
+ aDics = xDicList->getDictionaries();
+ }
+ pDic = aDics.getConstArray();
+ nCount = (sal_uInt16) aDics.getLength();
+
+
+ EndDialog( RET_OK );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxNewDictionaryDialog, ModifyHdl_Impl, Edit *, EMPTYARG )
+{
+ if ( aNameEdit.GetText().Len() )
+ aOKBtn.Enable();
+ else
+ aOKBtn.Disable();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxNewDictionaryDialog, ModifyHdl_Impl, Edit *, EMPTYARG )
+
+//==========================================================================
+//
+// class SvxEditDictionaryDialog -------------------------------------------
+//
+//==========================================================================
+
+SvxEditDictionaryDialog::SvxEditDictionaryDialog(
+ Window* pParent,
+ const String& rName,
+ Reference< XSpellChecker1 > &xSpl ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SFXDLG_EDITDICT ) ),
+
+ aBookFT ( this, SVX_RES( FT_BOOK ) ),
+ aAllDictsLB ( this, SVX_RES( LB_ALLDICTS ) ),
+ aLangFT ( this, SVX_RES( FT_DICTLANG ) ),
+ aLangLB ( this, SVX_RES( LB_DICTLANG ) ),
+ aWordFT ( this, SVX_RES( FT_WORD ) ),
+ aWordED ( this, SVX_RES( ED_WORD ) ),
+ aReplaceFT ( this, SVX_RES( FT_REPLACE ) ),
+ aReplaceED ( this, SVX_RES( ED_REPLACE ) ),
+ aWordsLB ( this, SVX_RES( TLB_REPLACE ) ),
+ aNewReplacePB ( this, SVX_RES( PB_NEW_REPLACE ) ),
+ aDeletePB ( this, SVX_RES( PB_DELETE_REPLACE ) ),
+ aEditDictsBox ( this, SVX_RES( GB_EDITDICTS ) ),
+ aCloseBtn ( this, SVX_RES( BTN_EDITCLOSE ) ),
+ aHelpBtn ( this, SVX_RES( BTN_EDITHELP ) ),
+ sModify (SVX_RES(STR_MODIFY)),
+ sNew (aNewReplacePB.GetText()),
+ aDecoView ( this),
+ xSpell ( xSpl ),
+ nOld ( NOACTDICT ),
+ bFirstSelect (sal_True),
+ bDoNothing (sal_False)
+
+{
+ if (SvxGetDictionaryList().is())
+ aDics = SvxGetDictionaryList()->getDictionaries();
+
+ aWordsLB.SetSelectHdl(LINK(this, SvxEditDictionaryDialog, SelectHdl));
+ aWordsLB.SetTabs(nStaticTabs);
+
+ //! we use an algorithm of our own to insert elements sorted
+ aWordsLB.SetWindowBits(/*WB_SORT|*/WB_HSCROLL|WB_CLIPCHILDREN);
+
+
+ nWidth=aWordED.GetSizePixel().Width();
+ // Handler installieren
+ aNewReplacePB.SetClickHdl(
+ LINK( this, SvxEditDictionaryDialog, NewDelHdl));
+ aDeletePB.SetClickHdl(
+ LINK( this, SvxEditDictionaryDialog, NewDelHdl));
+
+ aLangLB.SetSelectHdl(
+ LINK( this, SvxEditDictionaryDialog, SelectLangHdl_Impl ) );
+ aAllDictsLB.SetSelectHdl(
+ LINK( this, SvxEditDictionaryDialog, SelectBookHdl_Impl ) );
+
+ aWordED.SetModifyHdl(LINK(this, SvxEditDictionaryDialog, ModifyHdl));
+ aReplaceED.SetModifyHdl(LINK(this, SvxEditDictionaryDialog, ModifyHdl));
+ aWordED.SetActionHdl(LINK(this, SvxEditDictionaryDialog, NewDelHdl));
+ aReplaceED.SetActionHdl(LINK(this, SvxEditDictionaryDialog, NewDelHdl));
+
+ // Listbox mit allen verfuegbaren WB's fuellen
+ const Reference< XDictionary > *pDic = aDics.getConstArray();
+ sal_Int32 nCount = aDics.getLength();
+
+ String aLookUpEntry;
+ for ( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ Reference< XDictionary > xDic( pDic[i], UNO_QUERY );
+ if (xDic.is())
+ {
+ sal_Bool bNegative = xDic->getDictionaryType() == DictionaryType_NEGATIVE ?
+ sal_True : sal_False;
+ String aDicName( xDic->getName() );
+ const String aTxt( ::GetDicInfoStr( aDicName, SvxLocaleToLanguage( xDic->getLocale() ),
+ bNegative ) );
+ aAllDictsLB.InsertEntry( aTxt );
+
+ if (rName == aDicName)
+ aLookUpEntry = aTxt;
+ }
+ }
+
+ aLangLB.SetLanguageList( LANG_LIST_ALL, TRUE, TRUE );
+
+ aReplaceED.SetSpaces(sal_True);
+ aWordED.SetSpaces(sal_True);
+
+ if ( nCount > 0 )
+ {
+ aAllDictsLB.SelectEntry( aLookUpEntry );
+ sal_uInt16 nPos = aAllDictsLB.GetSelectEntryPos();
+
+ if ( nPos == LISTBOX_ENTRY_NOTFOUND )
+ {
+ nPos = 0;
+ aAllDictsLB.SelectEntryPos( nPos );
+ }
+ Reference< XDictionary > xDic;
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ xDic = Reference< XDictionary > ( aDics.getConstArray()[ nPos ], UNO_QUERY );
+ if (xDic.is())
+ SetLanguage_Impl( SvxLocaleToLanguage( xDic->getLocale() ) );
+
+ // check if dictionary is read-only
+ SetDicReadonly_Impl(xDic);
+ sal_Bool bEnable = !IsDicReadonly_Impl();
+ aNewReplacePB .Enable( sal_False );
+ aDeletePB .Enable( sal_False );
+ aLangFT.Enable( bEnable );
+ aLangLB.Enable( bEnable );
+ ShowWords_Impl( nPos );
+
+ }
+ else
+ {
+ aNewReplacePB.Disable();
+ aDeletePB .Disable();
+ }
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SvxEditDictionaryDialog::~SvxEditDictionaryDialog()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxEditDictionaryDialog::Paint( const Rectangle& rRect )
+{
+ ModalDialog::Paint(rRect );
+
+ Rectangle aRect(aEditDictsBox.GetPosPixel(),aEditDictsBox.GetSizePixel());
+
+ sal_uInt16 nStyle=BUTTON_DRAW_NOFILL;
+ aDecoView.DrawButton( aRect, nStyle);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxEditDictionaryDialog::SetDicReadonly_Impl(
+ Reference< XDictionary > &xDic )
+{
+ // enable or disable new and delete button according to file attributes
+ bDicIsReadonly = sal_True;
+ if (xDic.is())
+ {
+ Reference< frame::XStorable > xStor( xDic, UNO_QUERY );
+ if ( !xStor.is() // non persistent dictionary
+ || !xStor->hasLocation() // not yet persistent
+ || !xStor->isReadonly() )
+ {
+ bDicIsReadonly = sal_False;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxEditDictionaryDialog::SetLanguage_Impl( util::Language nLanguage )
+{
+ // select language
+ aLangLB.SelectLanguage( nLanguage );
+}
+
+USHORT SvxEditDictionaryDialog::GetLBInsertPos(const String &rDicWord)
+{
+ USHORT nPos = USHRT_MAX;
+
+ IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const CollatorWrapper* pCollator = aIntlWrapper.getCollator();
+ USHORT j;
+ for( j = 0; j < aWordsLB.GetEntryCount(); j++ )
+ {
+ SvLBoxEntry* pEntry = aWordsLB.GetEntry(j);
+ DBG_ASSERT( pEntry, "NULL pointer");
+ String aNormEntry( getNormDicEntry_Impl( rDicWord ) );
+ StringCompare eCmpRes = (StringCompare)pCollator->
+ compareString( aNormEntry, getNormDicEntry_Impl( aWordsLB.GetEntryText(pEntry, 0) ) );
+ if( COMPARE_LESS == eCmpRes )
+ break;
+ }
+ if (j < aWordsLB.GetEntryCount()) // entry found?
+ nPos = j;
+
+ return nPos;
+}
+
+void SvxEditDictionaryDialog::RemoveDictEntry(SvLBoxEntry* pEntry)
+{
+ sal_uInt16 nLBPos = aAllDictsLB.GetSelectEntryPos();
+
+ if ( pEntry != NULL && nLBPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ String sTmpShort(aWordsLB.GetEntryText(pEntry, 0));
+
+ Reference< XDictionary > xDic = aDics.getConstArray()[ nLBPos ];
+ if (xDic->remove( sTmpShort )) // sal_True on success
+ {
+ aWordsLB.GetModel()->Remove(pEntry);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxEditDictionaryDialog, SelectBookHdl_Impl, ListBox *, EMPTYARG )
+{
+ sal_uInt16 nPos = aAllDictsLB.GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aNewReplacePB.Enable( sal_False );
+ aDeletePB .Enable( sal_False );
+ // Dictionary anzeigen
+ ShowWords_Impl( nPos );
+ // enable or disable new and delete button according to file attributes
+ Reference< XDictionary > xDic( aDics.getConstArray()[ nPos ], UNO_QUERY );
+ if (xDic.is())
+ SetLanguage_Impl( SvxLocaleToLanguage( xDic->getLocale() ) );
+
+ SetDicReadonly_Impl(xDic);
+ sal_Bool bEnable = !IsDicReadonly_Impl();
+ aLangFT.Enable( bEnable );
+ aLangLB.Enable( bEnable );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxEditDictionaryDialog, SelectLangHdl_Impl, ListBox *, EMPTYARG )
+{
+ sal_uInt16 nDicPos = aAllDictsLB.GetSelectEntryPos();
+ sal_uInt16 nLang = aLangLB.GetSelectLanguage();
+ Reference< XDictionary > xDic( aDics.getConstArray()[ nDicPos ], UNO_QUERY );
+ INT16 nOldLang = SvxLocaleToLanguage( xDic->getLocale() );
+
+ if ( nLang != nOldLang )
+ {
+ QueryBox aBox( this, SVX_RES( RID_SFXQB_SET_LANGUAGE ) );
+ String sTxt( aBox.GetMessText() );
+ sTxt.SearchAndReplaceAscii( "%1", aAllDictsLB.GetSelectEntry() );
+ aBox.SetMessText( sTxt );
+
+ if ( aBox.Execute() == RET_YES )
+ {
+ xDic->setLocale( SvxCreateLocale( nLang ) );
+ sal_Bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
+
+ const String sName(
+ ::GetDicInfoStr( xDic->getName(),
+ SvxLocaleToLanguage( xDic->getLocale() ),
+ bNegativ ) );
+ aAllDictsLB.RemoveEntry( nDicPos );
+ aAllDictsLB.InsertEntry( sName, nDicPos );
+ aAllDictsLB.SelectEntryPos( nDicPos );
+ }
+ else
+ SetLanguage_Impl( nOldLang );
+ }
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId )
+{
+ Reference< XDictionary > xDic = aDics.getConstArray()[ nId ];
+
+ nOld = nId;
+ EnterWait();
+
+ String aStr;
+
+ aWordED.SetText(aStr);
+ aReplaceED.SetText(aStr);
+
+ if(xDic->getDictionaryType() != DictionaryType_POSITIVE)
+ {
+ nStaticTabs[0]=2;
+
+ // make controls for replacement text active
+ if(!aReplaceFT.IsVisible())
+ {
+ Size aSize=aWordED.GetSizePixel();
+ aSize.Width()=nWidth;
+ aWordED.SetSizePixel(aSize);
+ aReplaceFT.Show();
+ aReplaceED.Show();
+ }
+ }
+ else
+ {
+ nStaticTabs[0]=1;
+
+ // deactivate controls for replacement text
+ if(aReplaceFT.IsVisible())
+ {
+ Size aSize=aWordED.GetSizePixel();
+ aSize.Width()=aWordsLB.GetSizePixel().Width();
+ aWordED.SetSizePixel(aSize);
+ aReplaceFT.Hide();
+ aReplaceED.Hide();
+ }
+
+ }
+
+ aWordsLB.SetTabs(nStaticTabs);
+ aWordsLB.Clear();
+
+ Sequence< Reference< XDictionaryEntry > > aEntries( xDic->getEntries() );
+ const Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray();
+ sal_Int32 nCount = aEntries.getLength();
+
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ aStr = String(pEntry[i]->getDictionaryWord());
+ USHORT nPos = GetLBInsertPos( aStr );
+ if(pEntry[i]->isNegative())
+ {
+ aStr += '\t';
+ aStr += String(pEntry[i]->getReplacementText());
+ }
+ aWordsLB.InsertEntry(aStr, 0, sal_False, nPos == USHRT_MAX ? LIST_APPEND : nPos);
+ }
+
+ if (aWordsLB.GetEntryCount())
+ {
+ aWordED .SetText( aWordsLB.GetEntryText(0LU, 0) );
+ aReplaceED.SetText( aWordsLB.GetEntryText(0LU, 1) );
+ }
+
+ LeaveWait();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK(SvxEditDictionaryDialog, SelectHdl, SvTabListBox*, pBox)
+{
+ if(!bDoNothing)
+ {
+ if(!bFirstSelect)
+ {
+ SvLBoxEntry* pEntry = pBox->FirstSelected();
+ String sTmpShort(pBox->GetEntryText(pEntry, 0));
+ // wird der Text ueber den ModifyHdl gesetzt, dann steht der Cursor
+ //sonst immer am Wortanfang, obwohl man gerade hier editiert
+ if(aWordED.GetText() != sTmpShort)
+ aWordED.SetText(sTmpShort);
+ aReplaceED.SetText(pBox->GetEntryText(pEntry, 1));
+ }
+ else
+ bFirstSelect = sal_False;
+
+ // entries in the list box should exactly correspond to those from the
+ // dictionary. Thus:
+ aNewReplacePB.Enable(sal_False);
+ aDeletePB .Enable( sal_True && !IsDicReadonly_Impl() );
+ }
+ return 0;
+};
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK(SvxEditDictionaryDialog, NewDelHdl, PushButton*, pBtn)
+{
+ SvLBoxEntry* pEntry = aWordsLB.FirstSelected();
+
+ if(pBtn == &aDeletePB)
+ {
+ DBG_ASSERT(pEntry, "keine Eintrag selektiert");
+ String aStr;
+
+ aWordED.SetText(aStr);
+ aReplaceED.SetText(aStr);
+ aDeletePB.Disable();
+
+ RemoveDictEntry(pEntry); // remove entry from dic and list-box
+ }
+ if(pBtn == &aNewReplacePB || aNewReplacePB.IsEnabled())
+ {
+ SvLBoxEntry* _pEntry = aWordsLB.FirstSelected();
+ XubString aNewWord(aWordED.GetText());
+ String sEntry(aNewWord);
+ XubString aReplaceStr(aReplaceED.GetText());
+
+ sal_Int16 nAddRes = DIC_ERR_UNKNOWN;
+ sal_uInt16 nPos = aAllDictsLB.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND && aNewWord.Len() > 0)
+ {
+ DBG_ASSERT(nPos < aDics.getLength(), "invalid dictionary index");
+ Reference< XDictionary > xDic( aDics.getConstArray()[ nPos ], UNO_QUERY );
+ if (xDic.is())
+ {
+ // make changes in dic
+
+ //! ...IsVisible should reflect wether the dictionary is a negativ
+ //! or not (hopefully...)
+ sal_Bool bIsNegEntry = aReplaceFT.IsVisible();
+ ::rtl::OUString aRplcText;
+ if(bIsNegEntry)
+ aRplcText = aReplaceStr;
+
+ if (_pEntry) // entry selected in aWordsLB ie action = modify entry
+ xDic->remove( aWordsLB.GetEntryText( _pEntry, 0 ) );
+ // if remove has failed the following add should fail too
+ // and thus a warning message should be triggered...
+
+ Reference<XDictionary> aXDictionary(xDic, UNO_QUERY);
+ nAddRes = linguistic::AddEntryToDic( aXDictionary,
+ aNewWord, bIsNegEntry,
+ aRplcText, SvxLocaleToLanguage( xDic->getLocale() ), sal_False );
+ }
+ }
+ if (DIC_ERR_NONE != nAddRes)
+ SvxDicError( this, nAddRes );
+
+ if(DIC_ERR_NONE == nAddRes && sEntry.Len())
+ {
+ // insert new entry in list-box etc...
+
+ aWordsLB.SetUpdateMode(sal_False);
+ sal_uInt16 _nPos = USHRT_MAX;
+
+ if(aReplaceFT.IsVisible())
+ {
+ sEntry += '\t';
+ sEntry += aReplaceStr;
+ }
+
+ SvLBoxEntry* pNewEntry = NULL;
+ if(_pEntry) // entry selected in aWordsLB ie action = modify entry
+ {
+ aWordsLB.SetEntryText( sEntry, _pEntry );
+ pNewEntry = _pEntry;
+ }
+ else
+ {
+ _nPos = GetLBInsertPos( aNewWord );
+ SvLBoxEntry* pInsEntry = aWordsLB.InsertEntry(sEntry, 0, sal_False,
+ _nPos == USHRT_MAX ? LIST_APPEND : (sal_uInt32)_nPos);
+ pNewEntry = pInsEntry;
+ }
+
+ aWordsLB.MakeVisible( pNewEntry );
+ aWordsLB.SetUpdateMode(sal_True);
+ // falls der Request aus dem ReplaceEdit kam, dann Focus in das ShortEdit setzen
+ if(aReplaceED.HasFocus())
+ aWordED.GrabFocus();
+ }
+ }
+ else
+ {
+ // das kann nur ein Enter in einem der beiden Edit-Felder sein und das
+ // bedeutet EndDialog() - muss im KeyInput ausgewertet werden
+ return 0;
+ }
+ ModifyHdl(&aWordED);
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK(SvxEditDictionaryDialog, ModifyHdl, Edit*, pEdt)
+{
+ SvLBoxEntry* pFirstSel = aWordsLB.FirstSelected();
+ String rEntry = pEdt->GetText();
+
+ xub_StrLen nWordLen=rEntry.Len();
+ const String& rRepString = aReplaceED.GetText();
+
+ BOOL bEnableNewReplace = FALSE;
+ BOOL bEnableDelete = FALSE;
+ String aNewReplaceText = sNew;
+
+ if(pEdt == &aWordED)
+ {
+ if(nWordLen>0)
+ {
+ sal_Bool bFound = sal_False;
+ sal_Bool bTmpSelEntry=sal_False;
+ CDE_RESULT eCmpRes = CDE_DIFFERENT;
+
+ for(sal_uInt16 i = 0; i < aWordsLB.GetEntryCount(); i++)
+ {
+ SvLBoxEntry* pEntry = aWordsLB.GetEntry( i );
+ String aTestStr( aWordsLB.GetEntryText(pEntry, 0) );
+ eCmpRes = cmpDicEntry_Impl( rEntry, aTestStr );
+ if(CDE_DIFFERENT != eCmpRes)
+ {
+ if(rRepString.Len())
+ bFirstSelect = sal_True;
+ bDoNothing=sal_True;
+ aWordsLB.SetCurEntry(pEntry);
+ bDoNothing=sal_False;
+ pFirstSel = pEntry;
+ aReplaceED.SetText(aWordsLB.GetEntryText(pEntry, 1));
+
+ if (CDE_SIMILAR == eCmpRes)
+ {
+ aNewReplaceText = sModify;
+ bEnableNewReplace = TRUE;
+ }
+ bFound= sal_True;
+ break;
+ }
+ else if(getNormDicEntry_Impl(aTestStr).Search(
+ getNormDicEntry_Impl( rEntry ) ) == 0
+ && !bTmpSelEntry)
+ {
+ bDoNothing=sal_True;
+ aWordsLB.MakeVisible(pEntry);
+ bDoNothing=sal_False;
+ bTmpSelEntry=sal_True;
+
+ aNewReplaceText = sNew;
+ bEnableNewReplace = TRUE;
+ }
+ }
+
+ if(!bFound)
+ {
+ aWordsLB.SelectAll(sal_False);
+ pFirstSel = 0;
+
+ aNewReplaceText = sNew;
+ bEnableNewReplace = TRUE;
+ }
+ bEnableDelete = CDE_DIFFERENT != eCmpRes;
+ }
+ else if(aWordsLB.GetEntryCount()>0)
+ {
+ SvLBoxEntry* pEntry = aWordsLB.GetEntry( 0 );
+ bDoNothing=sal_True;
+ aWordsLB.MakeVisible(pEntry);
+ bDoNothing=sal_False;
+ }
+ }
+ else if(pEdt == &aReplaceED)
+ {
+ String aReplaceText;
+ String aWordText;
+ if (pFirstSel) // a aWordsLB entry is selected
+ {
+ aWordText = aWordsLB.GetEntryText( pFirstSel, 0 );
+ aReplaceText = aWordsLB.GetEntryText( pFirstSel, 1 );
+
+ aNewReplaceText = sModify;
+ bEnableDelete = TRUE;
+ }
+ BOOL bIsChange =
+ CDE_EQUAL != cmpDicEntry_Impl(aWordED.GetText(), aWordText)
+ || CDE_EQUAL != cmpDicEntry_Impl(aReplaceED.GetText(), aReplaceText);
+ if (aWordED.GetText().Len() && bIsChange)
+ bEnableNewReplace = TRUE;
+ }
+
+ aNewReplacePB.SetText( aNewReplaceText );
+ aNewReplacePB.Enable( bEnableNewReplace && !IsDicReadonly_Impl() );
+ aDeletePB .Enable( bEnableDelete && !IsDicReadonly_Impl() );
+
+ return 0;
+}
+
+//=========================================================
+//SvxDictEdit
+//=========================================================
+void SvxDictEdit::KeyInput( const KeyEvent& rKEvt )
+{
+ const KeyCode aKeyCode = rKEvt.GetKeyCode();
+ const sal_uInt16 nModifier = aKeyCode.GetModifier();
+ if( aKeyCode.GetCode() == KEY_RETURN )
+ {
+ //wird bei Enter nichts getan, dann doch die Basisklasse rufen
+ // um den Dialog zu schliessen
+ if(!nModifier && !aActionLink.Call(this))
+ Edit::KeyInput(rKEvt);
+ }
+ else if(bSpaces || aKeyCode.GetCode() != KEY_SPACE)
+ Edit::KeyInput(rKEvt);
+}
+
+
diff --git a/cui/source/options/optdict.hrc b/cui/source/options/optdict.hrc
new file mode 100644
index 000000000000..af9e9302d7d5
--- /dev/null
+++ b/cui/source/options/optdict.hrc
@@ -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: optdict.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTDICT_HRC
+#define _SVX_OPTDICT_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FT_DICTNAME 10
+#define ED_DICTNAME 11
+#define FT_DICTLANG 12
+#define LB_DICTLANG 13
+#define BTN_EXCEPT 14
+#define GB_NEWDICT 15
+
+#define BTN_NEWDICT_OK 20
+#define BTN_NEWDICT_ESC 21
+#define BTN_NEWDICT_HLP 22
+
+#define FT_BOOK 30
+#define FT_CONTENT 31
+#define LB_ALLDICTS 32
+#define GB_EDITDICTS 34
+#define FT_WORD 35
+#define ED_WORD 36
+#define FT_REPLACE 37
+#define ED_REPLACE 38
+#define PB_NEW_REPLACE 39
+#define PB_DELETE_REPLACE 40
+#define TLB_REPLACE 41
+#define STR_MODIFY 42
+
+#define BTN_EDITCLOSE 50
+#define BTN_EDITNEW 51
+#define BTN_EDITCHANGE 52
+#define BTN_EDITREMOVE 53
+#define BTN_EDITHELP 54
+
+
+
+#endif
+
diff --git a/cui/source/options/optdict.src b/cui/source/options/optdict.src
new file mode 100644
index 000000000000..740853410a61
--- /dev/null
+++ b/cui/source/options/optdict.src
@@ -0,0 +1,282 @@
+/*************************************************************************
+ *
+ * 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: optdict.src,v $
+ * $Revision: 1.31 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include "optdict.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SFXDLG_NEWDICT ----------------------------------------------------
+ModalDialog RID_SFXDLG_NEWDICT
+{
+ HelpId = HID_OPTIONS_DICT_NEW ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 213 , 66 ) ;
+ Moveable = TRUE ;
+ /* ### ACHTUNG: Neuer Text in Resource? Benutzerwörterbuch anlegen : Benutzerw÷rterbuch anlegen */
+ /* ### ACHTUNG: Neuer Text in Resource? Benutzerwörterbuch anlegen : Benutzerw÷rterbuch anlegen */
+ Text [ en-US ] = "New Dictionary" ;
+ FixedText FT_DICTNAME
+ {
+ Pos = MAP_APPFONT ( 11 , 15 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "~Name" ;
+ LeftLabel = TRUE ;
+ };
+ Edit ED_DICTNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 55 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 12 ) ;
+ MaxTextLength = 32 ;
+ };
+ FixedText FT_DICTLANG
+ {
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "~Language" ;
+ LeftLabel = TRUE ;
+ };
+ ListBox LB_DICTLANG
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 55 , 30 ) ;
+ Size = MAP_APPFONT ( 90 , 66 ) ;
+ DropDown = TRUE ;
+ };
+ CheckBox BTN_EXCEPT
+ {
+ Pos = MAP_APPFONT ( 12 , 44 ) ;
+ Size = MAP_APPFONT ( 57 , 10 ) ;
+ Text [ en-US ] = "~Exception (-)" ;
+ };
+ FixedLine GB_NEWDICT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 145 , 8 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Wörterbuch : W÷rterbuch */
+ /* ### ACHTUNG: Neuer Text in Resource? Wörterbuch : W÷rterbuch */
+ Text [ en-US ] = "Dictionary" ;
+ };
+ OKButton BTN_NEWDICT_OK
+ {
+ Pos = MAP_APPFONT ( 157 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Disable = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_NEWDICT_ESC
+ {
+ Pos = MAP_APPFONT ( 157 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_NEWDICT_HLP
+ {
+ Pos = MAP_APPFONT ( 157 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+ // RID_SFXDLG_EDITDICT ---------------------------------------------------
+ModalDialog RID_SFXDLG_EDITDICT
+{
+ HelpId = HID_OPTIONS_DICT_EDIT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT( 270, 161 );
+
+ /* ### ACHTUNG: Neuer Text in Resource? Benutzerwörterbuch bearbeiten : Benutzerw÷rterbuch bearbeiten */
+ /* ### ACHTUNG: Neuer Text in Resource? Benutzerwörterbuch bearbeiten : Benutzerw÷rterbuch bearbeiten */
+ Text [ en-US ] = "Edit Custom Dictionary" ;
+
+ Moveable = TRUE ;
+ FixedText FT_BOOK
+ {
+ Pos = MAP_APPFONT ( 12 , 10 ) ;
+ Size = MAP_APPFONT ( 86 , 10 ) ;
+ Text [ en-US ] = "~Book" ;
+ };
+ ListBox LB_ALLDICTS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 82 , 9 ) ;
+ Size = MAP_APPFONT ( 121 , 62 ) ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_DICTLANG
+ {
+ Pos = MAP_APPFONT ( 12 , 26 ) ;
+ Size = MAP_APPFONT ( 86 , 10 ) ;
+ Text [ en-US ] = "~Language" ;
+ };
+ ListBox LB_DICTLANG
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 82 , 25 ) ;
+ Size = MAP_APPFONT ( 121 , 66 ) ;
+ DropDown = TRUE ;
+ };
+
+ FixedLine GB_EDITDICTS
+ {
+ Pos = MAP_APPFONT( 1, 1 );
+ Size = MAP_APPFONT( 268, 138 );
+ Hide=TRUE;
+ };
+
+ FixedText FT_WORD
+ {
+ Pos = MAP_APPFONT ( 13 , 46 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "~Word";
+ };
+ Edit ED_WORD
+ {
+ Pos = MAP_APPFONT ( 12 , 56 ) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_REPLACE
+ {
+ Pos = MAP_APPFONT ( 84 , 46 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Replace ~By:";
+ };
+
+ Edit ED_REPLACE
+ {
+ Pos = MAP_APPFONT ( 83 , 56 ) ;
+ Size = MAP_APPFONT ( 120 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+
+ PushButton PB_NEW_REPLACE
+ {
+ Pos = MAP_APPFONT ( 209 , 56 ) ;
+ Size = MAP_APPFONT ( 55 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~New" ;
+ };
+ PushButton PB_DELETE_REPLACE
+ {
+ Pos = MAP_APPFONT ( 209 , 71 ) ;
+ Size = MAP_APPFONT ( 55 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ Control TLB_REPLACE
+ {
+ HelpId = HID_OPTIONS_DICT_EDIT_ENTRIES_LIST;
+ Pos = MAP_APPFONT ( 12 , 71 ) ;
+ Size = MAP_APPFONT ( 191 , 58 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ String STR_MODIFY
+ {
+ Text [ en-US ] = "~Replace" ;
+ };
+
+
+
+ HelpButton BTN_EDITHELP
+ {
+ Pos = MAP_APPFONT( 145, 143 );
+ Size = MAP_APPFONT( 55, 14 );
+ };
+
+ CancelButton BTN_EDITCLOSE
+ {
+ Pos = MAP_APPFONT ( 209 , 143 ) ;
+ Size = MAP_APPFONT ( 55 , 14 ) ;
+
+ /* ### ACHTUNG: Neuer Text in Resource? ~Schließen : ~Schlie˜en */
+ /* ### ACHTUNG: Neuer Text in Resource? ~Schließen : ~Schlie˜en */
+ Text [ en-US ] = "~Close" ;
+ };
+};
+
+ // Strings ---------------------------------------------------------------
+String RID_SVXSTR_OPT_DOUBLE_DICTS
+{
+ Text [ en-US ] = "The specified name already exists.\nPlease enter a new name." ;
+};
+ // RID_SFXQB_SET_LANGUAGE ------------------------------------------------
+QueryBox RID_SFXQB_SET_LANGUAGE
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ /* ### ACHTUNG: Neuer Text in Resource? Möchten Sie die Sprache des Wörterbuches '%1' ändern? : Möchten Sie die Sprache des Wörterbuches ''%1'' ändern? */
+ /* ### ACHTUNG: Neuer Text in Resource? Möchten Sie die Sprache des Wörterbuches '%1' ändern? : Möchten Sie die Sprache des Wörterbuches ''%1'' ändern? */
+ /* ### ACHTUNG: Neuer Text in Resource? Möchten Sie die Sprache des Wörterbuches '%1' ändern? : M÷chten Sie die Sprache des W÷rterbuches '%1' õndern? */
+ /* ### ACHTUNG: Neuer Text in Resource? Möchten Sie die Sprache des Wörterbuches '%1' ändern? : M÷chten Sie die Sprache des W÷rterbuches '%1' õndern? */
+ Message [ en-US ] = "Do you want to change the '%1' dictionary language?" ;
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx
new file mode 100644
index 000000000000..998d4cccbcc8
--- /dev/null
+++ b/cui/source/options/optfltr.cxx
@@ -0,0 +1,439 @@
+/*************************************************************************
+ *
+ * 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: optfltr.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <unotools/moduleoptions.hxx>
+#include <unotools/fltrcfg.hxx>
+#include "optfltr.hxx"
+#include "optfltr.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include <svx/dialmgr.hxx>
+
+enum MSFltrPg2_CheckBoxEntries {
+ Math,
+ Writer,
+ Calc,
+ Impress,
+ InvalidCBEntry
+};
+
+#define CBCOL_FIRST 0
+#define CBCOL_SECOND 1
+
+// -----------------------------------------------------------------------
+
+OfaMSFilterTabPage::OfaMSFilterTabPage(Window* pParent, const SfxItemSet& rSet)
+ : SfxTabPage( pParent, SVX_RES( RID_OFAPAGE_MSFILTEROPT ), rSet ),
+ aMSWordGB ( this, SVX_RES( GB_WORD ) ),
+ aWBasicCodeCB ( this, SVX_RES( CB_WBAS_CODE ) ),
+ aWBasicStgCB ( this, SVX_RES( CB_WBAS_STG ) ),
+ aMSExcelGB ( this, SVX_RES( GB_EXCEL ) ),
+ aEBasicCodeCB ( this, SVX_RES( CB_EBAS_CODE ) ),
+ aEBasicExectblCB( this, SVX_RES( CB_EBAS_EXECTBL ) ),
+ aEBasicStgCB ( this, SVX_RES( CB_EBAS_STG ) ),
+ aMSPPointGB ( this, SVX_RES( GB_PPOINT ) ),
+ aPBasicCodeCB ( this, SVX_RES( CB_PBAS_CODE ) ),
+ aPBasicStgCB ( this, SVX_RES( CB_PBAS_STG ) )
+{
+ FreeResource();
+
+ aEBasicCodeCB.SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl ) );
+}
+
+OfaMSFilterTabPage::~OfaMSFilterTabPage()
+{
+}
+
+IMPL_LINK( OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl, CheckBox*, EMPTYARG )
+{
+ aEBasicExectblCB.Enable( aEBasicCodeCB.IsChecked() );
+ return 0;
+}
+
+SfxTabPage* OfaMSFilterTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return new OfaMSFilterTabPage( pParent, rAttrSet );
+}
+
+BOOL OfaMSFilterTabPage::FillItemSet( SfxItemSet& )
+{
+ SvtFilterOptions* pOpt = SvtFilterOptions::Get();
+
+ BOOL bFlag;
+ if( aWBasicCodeCB.GetSavedValue() != (bFlag = aWBasicCodeCB.IsChecked()))
+ pOpt->SetLoadWordBasicCode( bFlag );
+ if( aWBasicStgCB.GetSavedValue() != (bFlag = aWBasicStgCB.IsChecked()))
+ pOpt->SetLoadWordBasicStorage( bFlag );
+
+ if( aEBasicCodeCB.GetSavedValue() != (bFlag = aEBasicCodeCB.IsChecked()))
+ pOpt->SetLoadExcelBasicCode( bFlag );
+ if( aEBasicExectblCB.GetSavedValue() != (bFlag = aEBasicExectblCB.IsChecked()))
+ pOpt->SetLoadExcelBasicExecutable( bFlag );
+ if( aEBasicStgCB.GetSavedValue() != (bFlag = aEBasicStgCB.IsChecked()))
+ pOpt->SetLoadExcelBasicStorage( bFlag );
+
+ if( aPBasicCodeCB.GetSavedValue() != (bFlag = aPBasicCodeCB.IsChecked()))
+ pOpt->SetLoadPPointBasicCode( bFlag );
+ if( aPBasicStgCB.GetSavedValue() != (bFlag = aPBasicStgCB.IsChecked()))
+ pOpt->SetLoadPPointBasicStorage( bFlag );
+
+ return FALSE;
+}
+
+/*-----------------02.09.96 13.47-------------------
+
+--------------------------------------------------*/
+
+void OfaMSFilterTabPage::Reset( const SfxItemSet& )
+{
+ SvtFilterOptions* pOpt = SvtFilterOptions::Get();
+
+ aWBasicCodeCB.Check( pOpt->IsLoadWordBasicCode() );
+ aWBasicCodeCB.SaveValue();
+ aWBasicStgCB.Check( pOpt->IsLoadWordBasicStorage() );
+ aWBasicStgCB.SaveValue();
+
+ aEBasicCodeCB.Check( pOpt->IsLoadExcelBasicCode() );
+ aEBasicCodeCB.SaveValue();
+ aEBasicExectblCB.Check( pOpt->IsLoadExcelBasicExecutable() );
+ aEBasicExectblCB.SaveValue();
+ aEBasicStgCB.Check( pOpt->IsLoadExcelBasicStorage() );
+ aEBasicStgCB.SaveValue();
+ LoadExcelBasicCheckHdl_Impl( &aEBasicCodeCB );
+
+ aPBasicCodeCB.Check( pOpt->IsLoadPPointBasicCode() );
+ aPBasicCodeCB.SaveValue();
+ aPBasicStgCB.Check( pOpt->IsLoadPPointBasicStorage() );
+ aPBasicStgCB.SaveValue();
+
+}
+
+/*-----------------29.06.00 13:22-------------------
+ *
+ * --------------------------------------------------*/
+OfaMSFilterTabPage2::OfaMSFilterTabPage2( Window* pParent,
+ const SfxItemSet& rSet )
+ : SfxTabPage( pParent, SVX_RES( RID_OFAPAGE_MSFILTEROPT2 ), rSet ),
+ aCheckLB ( this, SVX_RES( CLB_SETTINGS )),
+ aHeader1FT ( this, SVX_RES( FT_HEADER1_EXPLANATION )),
+ aHeader2FT ( this, SVX_RES( FT_HEADER2_EXPLANATION )),
+ sHeader1 ( SVX_RES( ST_HEADER1 )),
+ sHeader2 ( SVX_RES( ST_HEADER2 )),
+ sChgToFromMath ( SVX_RES( ST_CHG_MATH )),
+ sChgToFromWriter ( SVX_RES( ST_CHG_WRITER )),
+ sChgToFromCalc ( SVX_RES( ST_CHG_CALC )),
+ sChgToFromImpress ( SVX_RES( ST_CHG_IMPRESS )),
+ pCheckButtonData(0)
+{
+ FreeResource();
+
+ static long aStaticTabs[] = { 3, 0, 20, 40 };
+ aCheckLB.SvxSimpleTable::SetTabs( aStaticTabs );
+
+ String sHeader( sHeader1 );
+ (( sHeader += '\t' ) += sHeader2 ) += '\t';
+ aCheckLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND,
+ HIB_CENTER | HIB_VCENTER | HIB_FIXEDPOS | HIB_FIXED );
+
+ aCheckLB.SetHelpId( HID_OFAPAGE_MSFLTR2_CLB );
+ aCheckLB.SetWindowBits( WB_HSCROLL| WB_VSCROLL );
+}
+
+OfaMSFilterTabPage2::~OfaMSFilterTabPage2()
+{
+ delete pCheckButtonData;
+}
+
+SfxTabPage* OfaMSFilterTabPage2::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return new OfaMSFilterTabPage2( pParent, rAttrSet );
+}
+
+BOOL OfaMSFilterTabPage2::FillItemSet( SfxItemSet& )
+{
+ BOOL bModified = FALSE;
+ SvtFilterOptions* pOpt = SvtFilterOptions::Get();
+
+ static struct ChkCBoxEntries{
+ MSFltrPg2_CheckBoxEntries eType;
+ BOOL (SvtFilterOptions:: *FnIs)() const;
+ void (SvtFilterOptions:: *FnSet)( BOOL bFlag );
+ } aChkArr[] = {
+ { Math, &SvtFilterOptions::IsMathType2Math,
+ &SvtFilterOptions::SetMathType2Math },
+ { Math, &SvtFilterOptions::IsMath2MathType,
+ &SvtFilterOptions::SetMath2MathType },
+ { Writer, &SvtFilterOptions::IsWinWord2Writer,
+ &SvtFilterOptions::SetWinWord2Writer },
+ { Writer, &SvtFilterOptions::IsWriter2WinWord,
+ &SvtFilterOptions::SetWriter2WinWord },
+ { Calc, &SvtFilterOptions::IsExcel2Calc,
+ &SvtFilterOptions::SetExcel2Calc },
+ { Calc, &SvtFilterOptions::IsCalc2Excel,
+ &SvtFilterOptions::SetCalc2Excel },
+ { Impress, &SvtFilterOptions::IsPowerPoint2Impress,
+ &SvtFilterOptions::SetPowerPoint2Impress },
+ { Impress, &SvtFilterOptions::IsImpress2PowerPoint,
+ &SvtFilterOptions::SetImpress2PowerPoint },
+ { InvalidCBEntry, 0, 0 }
+ };
+
+ BOOL bCheck, bFirst = TRUE;
+ for( const ChkCBoxEntries* pArr = aChkArr;
+ InvalidCBEntry != pArr->eType; ++pArr, bFirst = !bFirst )
+ {
+ USHORT nCol = bFirst ? 1 : 2;
+ SvLBoxEntry* pEntry = GetEntry4Type( pArr->eType );
+ if( pEntry )
+ {
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem( nCol ));
+ if( pItem && ((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON )
+ {
+ USHORT nButtonFlags = pItem->GetButtonFlags();
+ bCheck = SV_BUTTON_CHECKED ==
+ pCheckButtonData->ConvertToButtonState( nButtonFlags );
+
+ if( bCheck != (pOpt->*pArr->FnIs)() )
+ {
+ bModified = TRUE;
+ (pOpt->*pArr->FnSet)( bCheck );
+ }
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+void OfaMSFilterTabPage2::Reset( const SfxItemSet& )
+{
+ SvtFilterOptions* pOpt = SvtFilterOptions::Get();
+
+ aCheckLB.SetUpdateMode(FALSE);
+ aCheckLB.Clear();
+
+ SvtModuleOptions aModuleOpt;
+
+ // int the same sequence as the enums of MSFltrPg2_CheckBoxEntries
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) )
+ InsertEntry( sChgToFromMath, static_cast< sal_IntPtr >( Math ) );
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
+ InsertEntry( sChgToFromWriter, static_cast< sal_IntPtr >( Writer ) );
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
+ InsertEntry( sChgToFromCalc, static_cast< sal_IntPtr >( Calc ) );
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
+ InsertEntry( sChgToFromImpress, static_cast< sal_IntPtr >( Impress ) );
+
+ static struct ChkCBoxEntries{
+ MSFltrPg2_CheckBoxEntries eType;
+ BOOL (SvtFilterOptions:: *FnIs)() const;
+ } aChkArr[] = {
+ { Math, &SvtFilterOptions::IsMathType2Math },
+ { Math, &SvtFilterOptions::IsMath2MathType },
+ { Writer, &SvtFilterOptions::IsWinWord2Writer },
+ { Writer, &SvtFilterOptions::IsWriter2WinWord },
+ { Calc, &SvtFilterOptions::IsExcel2Calc },
+ { Calc, &SvtFilterOptions::IsCalc2Excel },
+ { Impress, &SvtFilterOptions::IsPowerPoint2Impress },
+ { Impress, &SvtFilterOptions::IsImpress2PowerPoint },
+ { InvalidCBEntry, NULL }
+ };
+
+ BOOL bFirst = TRUE;
+ for( const ChkCBoxEntries* pArr = aChkArr;
+ InvalidCBEntry != pArr->eType; ++pArr, bFirst = !bFirst )
+ {
+ USHORT nCol = bFirst ? 1 : 2;
+ SvLBoxEntry* pEntry = GetEntry4Type( static_cast< sal_IntPtr >( pArr->eType ) );
+ if( pEntry )
+ {
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem( nCol ));
+ if( pItem && ((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON )
+ {
+ if( (pOpt->*pArr->FnIs)() )
+ pItem->SetStateChecked();
+ else
+ pItem->SetStateUnchecked();
+ aCheckLB.InvalidateEntry( pEntry );
+ }
+ }
+ }
+ aCheckLB.SetUpdateMode( TRUE );
+}
+
+void OfaMSFilterTabPage2::InsertEntry( const String& _rTxt, sal_IntPtr _nType )
+{
+ SvLBoxEntry* pEntry = new SvLBoxEntry;
+
+ if( !pCheckButtonData )
+ pCheckButtonData = new SvLBoxButtonData( &aCheckLB );
+
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0));
+ pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox,
+ 0, pCheckButtonData ) );
+ pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox,
+ 0, pCheckButtonData ) );
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, _rTxt ) );
+
+ pEntry->SetUserData( (void*)_nType );
+ aCheckLB.Insert( pEntry );
+}
+
+SvLBoxEntry* OfaMSFilterTabPage2::GetEntry4Type( sal_IntPtr _nType ) const
+{
+ SvLBoxEntry* pEntry = aCheckLB.First();
+ while ( pEntry )
+ {
+ if ( _nType == sal_IntPtr( pEntry->GetUserData() ) )
+ return pEntry;
+ pEntry = aCheckLB.Next( pEntry );
+ }
+ return NULL;
+}
+
+void OfaMSFilterTabPage2::MSFltrSimpleTable::SetTabs()
+{
+ SvxSimpleTable::SetTabs();
+ USHORT nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE;
+
+ if( aTabs.Count() > 1 )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
+ }
+ if( aTabs.Count() > 2 )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(2);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
+ }
+}
+
+void OfaMSFilterTabPage2::MSFltrSimpleTable::HBarClick()
+{
+ // Sortierung durch diese Ueberladung abgeklemmt
+}
+/* -----------------------------2002/06/20 11:51------------------------------
+
+ ---------------------------------------------------------------------------*/
+void OfaMSFilterTabPage2::MSFltrSimpleTable::SetCheckButtonState(
+ SvLBoxEntry* pEntry, USHORT nCol, SvButtonState eState)
+{
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1));
+
+ DBG_ASSERT(pItem,"SetCheckButton:Item not found");
+ if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
+ {
+ switch( eState )
+ {
+ case SV_BUTTON_CHECKED:
+ pItem->SetStateChecked();
+ break;
+
+ case SV_BUTTON_UNCHECKED:
+ pItem->SetStateUnchecked();
+ break;
+
+ case SV_BUTTON_TRISTATE:
+ pItem->SetStateTristate();
+ break;
+ }
+ InvalidateEntry( pEntry );
+ }
+}
+/* -----------------------------2002/06/20 11:56------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvButtonState OfaMSFilterTabPage2::MSFltrSimpleTable::GetCheckButtonState(
+ SvLBoxEntry* pEntry, USHORT nCol ) const
+{
+ SvButtonState eState = SV_BUTTON_UNCHECKED;
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1));
+ DBG_ASSERT(pItem,"GetChButnState:Item not found");
+
+ if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
+ {
+ USHORT nButtonFlags = pItem->GetButtonFlags();
+ eState = pCheckButtonData->ConvertToButtonState( nButtonFlags );
+ }
+
+ return eState;
+}
+/* -----------------------------2002/06/20 11:57------------------------------
+
+ ---------------------------------------------------------------------------*/
+void OfaMSFilterTabPage2::MSFltrSimpleTable::CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked)
+{
+ if ( nPos < GetEntryCount() )
+ SetCheckButtonState(
+ GetEntry(nPos),
+ nCol,
+ bChecked ? SvButtonState( SV_BUTTON_CHECKED ) :
+ SvButtonState( SV_BUTTON_UNCHECKED ) );
+}
+/* -----------------------------2002/06/20 11:51------------------------------
+
+ ---------------------------------------------------------------------------*/
+void OfaMSFilterTabPage2::MSFltrSimpleTable::KeyInput( const KeyEvent& rKEvt )
+{
+ if(!rKEvt.GetKeyCode().GetModifier() &&
+ KEY_SPACE == rKEvt.GetKeyCode().GetCode())
+ {
+ ULONG nSelPos = GetModel()->GetAbsPos(GetCurEntry());
+ USHORT nCol = GetCurrentTabPos() - 1;
+ if ( nCol < 2 )
+ {
+ SvLBoxEntry* pEntry = GetEntry( nSelPos );
+ sal_Bool bIsChecked = ( GetCheckButtonState( pEntry, nCol ) == SV_BUTTON_CHECKED );
+ CheckEntryPos( nSelPos, nCol, !bIsChecked );
+ CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)pEntry );
+ }
+ else
+ {
+ USHORT nCheck = GetCheckButtonState( GetEntry(nSelPos), 1 ) == SV_BUTTON_CHECKED ? 1 : 0;
+ if(GetCheckButtonState( GetEntry(nSelPos), 0 ))
+ nCheck += 2;
+ nCheck--;
+ nCheck &= 3;
+ CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1));
+ CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2));
+ }
+ }
+ else
+ SvxSimpleTable::KeyInput(rKEvt);
+}
+
diff --git a/cui/source/options/optfltr.hrc b/cui/source/options/optfltr.hrc
new file mode 100644
index 000000000000..dad722916860
--- /dev/null
+++ b/cui/source/options/optfltr.hrc
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * 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: optfltr.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTFLTR_HRC
+#define _SVX_OPTFLTR_HRC
+
+// defines ------------------------------------------------------------------
+
+#define GB_WORD 1
+#define GB_EXCEL 2
+#define GB_PPOINT 3
+
+#define CB_WBAS_CODE 1
+#define CB_WBAS_STG 2
+#define CB_EBAS_CODE 3
+#define CB_EBAS_EXECTBL 4
+#define CB_EBAS_STG 5
+#define CB_PBAS_CODE 6
+#define CB_PBAS_STG 7
+
+#define CLB_SETTINGS 1
+#define ST_CHG_MATH 1
+#define ST_CHG_WRITER 2
+#define ST_CHG_CALC 3
+#define ST_CHG_IMPRESS 4
+#define ST_HEADER1 5
+#define ST_HEADER2 6
+#define FT_HEADER1_EXPLANATION 1
+#define FT_HEADER2_EXPLANATION 2
+
+#endif
+
diff --git a/cui/source/options/optfltr.hxx b/cui/source/options/optfltr.hxx
new file mode 100644
index 000000000000..6f8c975098db
--- /dev/null
+++ b/cui/source/options/optfltr.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * 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: optfltr.hxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OFA_OPTFLTR_HXX
+#define _OFA_OPTFLTR_HXX
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/simptabl.hxx>
+
+
+
+class OfaMSFilterTabPage : public SfxTabPage
+{
+ FixedLine aMSWordGB;
+ CheckBox aWBasicCodeCB;
+ CheckBox aWBasicStgCB;
+ FixedLine aMSExcelGB;
+ CheckBox aEBasicCodeCB;
+ CheckBox aEBasicExectblCB;
+ CheckBox aEBasicStgCB;
+ FixedLine aMSPPointGB;
+ CheckBox aPBasicCodeCB;
+ CheckBox aPBasicStgCB;
+
+ OfaMSFilterTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~OfaMSFilterTabPage();
+
+ DECL_LINK( LoadExcelBasicCheckHdl_Impl, CheckBox* );
+public:
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+class OfaMSFilterTabPage2 : public SfxTabPage
+{
+ class MSFltrSimpleTable : public SvxSimpleTable
+ {
+ using SvTreeListBox::GetCheckButtonState;
+ using SvTreeListBox::SetCheckButtonState;
+ using SvxSimpleTable::SetTabs;
+
+ void CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked);
+ SvButtonState GetCheckButtonState( SvLBoxEntry*, USHORT nCol ) const;
+ void SetCheckButtonState( SvLBoxEntry*, USHORT nCol, SvButtonState );
+ protected:
+ virtual void SetTabs();
+ virtual void HBarClick();
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ public:
+ MSFltrSimpleTable(Window* pParent, const ResId& rResId ) :
+ SvxSimpleTable( pParent, rResId ){}
+ };
+
+ MSFltrSimpleTable aCheckLB;
+ FixedText aHeader1FT, aHeader2FT;
+ String sHeader1, sHeader2;
+ String sChgToFromMath,
+ sChgToFromWriter,
+ sChgToFromCalc,
+ sChgToFromImpress;
+ SvLBoxButtonData* pCheckButtonData;
+
+ OfaMSFilterTabPage2( Window* pParent, const SfxItemSet& rSet );
+ virtual ~OfaMSFilterTabPage2();
+
+ void InsertEntry( const String& _rTxt, sal_IntPtr _nType );
+ SvLBoxEntry* GetEntry4Type( sal_IntPtr _nType ) const;
+
+public:
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+
+#endif //
+
+
diff --git a/cui/source/options/optfltr.src b/cui/source/options/optfltr.src
new file mode 100644
index 000000000000..9e932406b265
--- /dev/null
+++ b/cui/source/options/optfltr.src
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * 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: optfltr.src,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "optfltr.hrc"
+#include <svx/dialogs.hrc>
+ // pragma ------------------------------------------------------------------
+
+// RID_OFAPAGE_MSFILTEROPT -----------------------------------------------------
+TabPage RID_OFAPAGE_MSFILTEROPT
+{
+ // HelpId = ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+
+ FixedLine GB_WORD
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Microsoft Word 97/2000/XP";
+ };
+ CheckBox CB_WBAS_CODE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Load Basic ~code";
+ };
+ CheckBox CB_WBAS_STG
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Save ~original Basic code";
+ };
+
+ FixedLine GB_EXCEL
+ {
+ Pos = MAP_APPFONT ( 6 , 44 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Microsoft Excel 97/2000/XP";
+ };
+ CheckBox CB_EBAS_CODE
+ {
+ Pos = MAP_APPFONT ( 12 , 55 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Lo~ad Basic code";
+ };
+ CheckBox CB_EBAS_EXECTBL
+ {
+ Pos = MAP_APPFONT ( 22 , 69 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "E~xecutable code";
+ };
+ CheckBox CB_EBAS_STG
+ {
+ Pos = MAP_APPFONT ( 12 , 83 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Sa~ve original Basic code";
+ };
+
+ FixedLine GB_PPOINT
+ {
+ Pos = MAP_APPFONT ( 6 , 99 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Microsoft PowerPoint 97/2000/XP";
+ };
+ CheckBox CB_PBAS_CODE
+ {
+ Pos = MAP_APPFONT ( 12 , 110 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Load Ba~sic code";
+ };
+ CheckBox CB_PBAS_STG
+ {
+ Pos = MAP_APPFONT ( 12 , 124 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Sav~e original Basic code";
+ };
+};
+
+// RID_OFAPAGE_MSFILTEROPT2 -----------------------------------------------------
+TabPage RID_OFAPAGE_MSFILTEROPT2
+{
+ // HelpId = ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+
+ Control CLB_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 248 , 147 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ String ST_HEADER1
+ {
+ Text [ en-US ] = "[L]";
+ };
+ String ST_HEADER2
+ {
+ Text [ en-US ] = "[S]";
+ };
+ FixedText FT_HEADER1_EXPLANATION
+ {
+ Pos = MAP_APPFONT ( 6 , 160 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "[L]: Load and convert the object";
+ };
+ FixedText FT_HEADER2_EXPLANATION
+ {
+ Pos = MAP_APPFONT ( 6 , 171 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "[S]: Convert and save the object";
+ };
+ String ST_CHG_MATH
+ {
+ Text [ en-US ] = "MathType to %PRODUCTNAME Math / %PRODUCTNAME Math to MathType";
+ };
+ String ST_CHG_WRITER
+ {
+ Text [ en-US ] = "WinWord to %PRODUCTNAME Writer / %PRODUCTNAME Writer to WinWord";
+ };
+ String ST_CHG_CALC
+ {
+ Text [ en-US ] = "Excel to %PRODUCTNAME Calc / %PRODUCTNAME Calc to Excel";
+ };
+ String ST_CHG_IMPRESS
+ {
+ Text [ en-US ] = "PowerPoint to %PRODUCTNAME Impress / %PRODUCTNAME Impress to PowerPoint";
+ };
+};
+
+ // ******************************************************************* EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
new file mode 100644
index 000000000000..ca2a6f32fd23
--- /dev/null
+++ b/cui/source/options/optgdlg.cxx
@@ -0,0 +1,1918 @@
+/*************************************************************************
+ *
+ * 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: optgdlg.cxx,v $
+ * $Revision: 1.53.20.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <svl/zforlist.hxx>
+#include <goodies/grfmgr.hxx>
+#include <svl/flagitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <unotools/lingucfg.hxx>
+#include <svl/szitem.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/imgmgr.hxx>
+#include <vcl/configsettings.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/mnemonic.hxx>
+#include <i18npool/mslangid.hxx>
+#include <unotools/useroptions.hxx>
+#include <unotools/cacheoptions.hxx>
+#include <unotools/fontoptions.hxx>
+#include <svtools/menuoptions.hxx>
+#include <unotools/startoptions.hxx>
+#include <svl/languageoptions.hxx>
+#include <svtools/miscopt.hxx>
+#include <unotools/printwarningoptions.hxx>
+#include <unotools/syslocaleoptions.hxx>
+#include <svtools/helpopt.hxx>
+#include <svtools/accessibilityoptions.hxx>
+#include <unotools/configitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <comphelper/types.hxx>
+#include <svl/ctloptions.hxx>
+#include <svtools/langtab.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <unotools/configmgr.hxx>
+#include "cuioptgenrl.hxx"
+#include "optpath.hxx"
+#include "optsave.hxx"
+#include "optlingu.hxx"
+#include <svx/xpool.hxx>
+#include <svx/dlgutil.hxx>
+#include "cuitabarea.hxx"
+#include <svx/dialogs.hrc>
+#include <svx/unolingu.hxx>
+#include <svx/svxids.hrc>
+#include <svx/langitem.hxx>
+#include <comphelper/processfactory.hxx>
+#include <rtl/ustrbuf.hxx>
+
+
+#include <svx/dialmgr.hxx>
+#include <svtools/helpopt.hxx>
+#include <unotools/saveopt.hxx>
+
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/container/XSet.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+
+#include <vcl/svapp.hxx>
+
+#include "optgdlg.hrc"
+#include "optgdlg.hxx"
+#include <svx/ofaitem.hxx>
+#include <svtools/apearcfg.hxx>
+#include <svtools/optionsdrawinglayer.hxx>
+
+#define CONFIG_LANGUAGES "OfficeLanguages"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::util;
+using namespace ::utl;
+using ::rtl::OString;
+using ::rtl::OUString;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+
+#define MAX_PROGRAM_ENTRIES 3
+
+// class OfaMiscTabPage --------------------------------------------------
+
+int OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ )
+{
+ if ( pSet_ )
+ FillItemSet( *pSet_ );
+ return LEAVE_PAGE;
+}
+
+namespace
+{
+ ::rtl::OUString impl_SystemFileOpenServiceName()
+ {
+ const ::rtl::OUString &rDesktopEnvironment =
+ Application::GetDesktopEnvironment();
+
+ if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) )
+ {
+ #ifdef ENABLE_GTK
+ return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.GtkFilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
+ }
+ else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) )
+ {
+ #ifdef ENABLE_KDE4
+ return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.KDE4FilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
+ }
+ else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) )
+ {
+ #ifdef ENABLE_KDE
+ return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.KDEFilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
+ }
+ #if defined WNT
+ return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFilePicker" );
+ #elif (defined MACOSX && defined QUARTZ)
+ return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.AquaFilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
+ }
+
+ sal_Bool lcl_HasSystemFilePicker()
+ {
+ Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
+ sal_Bool bRet = sal_False;
+
+ Reference< XContentEnumerationAccess > xEnumAccess( xFactory, UNO_QUERY );
+ Reference< XSet > xSet( xFactory, UNO_QUERY );
+
+ if ( ! xEnumAccess.is() || ! xSet.is() )
+ return bRet;
+
+ try
+ {
+ ::rtl::OUString aFileService = impl_SystemFileOpenServiceName();
+ Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService );
+ if ( xEnum.is() && xEnum->hasMoreElements() )
+ bRet = sal_True;
+ }
+
+ catch( IllegalArgumentException ) {}
+ catch( ElementExistException ) {}
+ return bRet;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, SVX_RES( OFA_TP_MISC ), rSet ),
+
+ aHelpFL ( this, SVX_RES( FL_HELP ) ),
+ aToolTipsCB ( this, SVX_RES( CB_TOOLTIP ) ),
+ aExtHelpCB ( this, SVX_RES( CB_EXTHELP ) ),
+ aHelpAgentCB ( this, SVX_RES( CB_HELPAGENT ) ),
+ aHelpAgentResetBtn ( this, SVX_RES( PB_HELPAGENT_RESET ) ),
+ aHelpFormatFT ( this, SVX_RES( FT_HELPFORMAT ) ),
+ aHelpFormatLB ( this, SVX_RES( LB_HELPFORMAT ) ),
+ aFileDlgFL ( this, SVX_RES( FL_FILEDLG ) ),
+ aFileDlgROImage ( this, SVX_RES( FI_FILEDLG_RO ) ),
+ aFileDlgCB ( this, SVX_RES( CB_FILEDLG ) ),
+ aPrintDlgFL ( this, SVX_RES( FL_PRINTDLG ) ),
+ aPrintDlgCB ( this, SVX_RES( CB_PRINTDLG ) ),
+ aDocStatusFL ( this, SVX_RES( FL_DOCSTATUS ) ),
+ aDocStatusCB ( this, SVX_RES( CB_DOCSTATUS ) ),
+ aTwoFigureFL ( this, SVX_RES( FL_TWOFIGURE ) ),
+ aInterpretFT ( this, SVX_RES( FT_INTERPRET ) ),
+ aYearValueField ( this, SVX_RES( NF_YEARVALUE ) ),
+ aToYearFT ( this, SVX_RES( FT_TOYEAR ) )
+
+{
+ FreeResource();
+
+ if (!lcl_HasSystemFilePicker())
+ {
+ aFileDlgFL.Hide();
+ aFileDlgCB.Hide();
+ }
+
+ #if ! defined(QUARTZ)
+ aPrintDlgFL.Hide();
+ aPrintDlgCB.Hide();
+ #endif
+
+ if ( !aFileDlgCB.IsVisible() )
+ {
+ // rearrange the following controls
+ Point aNewPos = aDocStatusFL.GetPosPixel();
+ long nDelta = aNewPos.Y() - aFileDlgFL.GetPosPixel().Y();
+
+ Window* pWins[] =
+ {
+ &aPrintDlgFL, &aPrintDlgCB, &aDocStatusFL, &aDocStatusCB, &aTwoFigureFL,
+ &aInterpretFT, &aYearValueField, &aToYearFT
+ };
+ Window** pCurrent = pWins;
+ const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[ 0 ] );
+ for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent )
+ {
+ aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+ }
+ else if ( SvtMiscOptions().IsUseSystemFileDialogReadOnly() )
+ {
+ aFileDlgROImage.Show();
+ aFileDlgCB.Disable();
+ }
+
+ if ( aPrintDlgCB.IsVisible() )
+ {
+ // rearrange the following controls
+ Point aNewPos = aDocStatusFL.GetPosPixel();
+ long nDelta = aNewPos.Y() - aFileDlgFL.GetPosPixel().Y();
+
+ Window* pWins[] =
+ {
+ &aDocStatusFL, &aDocStatusCB, &aTwoFigureFL,
+ &aInterpretFT, &aYearValueField, &aToYearFT
+ };
+ Window** pCurrent = pWins;
+ const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[ 0 ] );
+ for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent )
+ {
+ aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() += nDelta;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+ }
+
+ // at least the button is as wide as its text
+ long nTxtWidth = aHelpAgentResetBtn.GetTextWidth( aHelpAgentResetBtn.GetText() );
+ Size aBtnSz = aHelpAgentResetBtn.GetSizePixel();
+ if ( aBtnSz.Width() < nTxtWidth )
+ {
+ aBtnSz.Width() = nTxtWidth;
+ aHelpAgentResetBtn.SetSizePixel( aBtnSz );
+ }
+
+ aStrDateInfo = aToYearFT.GetText();
+ aYearValueField.SetModifyHdl( LINK( this, OfaMiscTabPage, TwoFigureHdl ) );
+ Link aLink = LINK( this, OfaMiscTabPage, TwoFigureConfigHdl );
+ aYearValueField.SetDownHdl( aLink );
+ aYearValueField.SetUpHdl( aLink );
+ aYearValueField.SetLoseFocusHdl( aLink );
+ aYearValueField.SetFirstHdl( aLink );
+ TwoFigureConfigHdl( &aYearValueField );
+
+ SetExchangeSupport();
+
+ aLink = LINK( this, OfaMiscTabPage, HelpCheckHdl_Impl );
+ aToolTipsCB.SetClickHdl( aLink );
+ aHelpAgentCB.SetClickHdl( aLink );
+ aHelpAgentResetBtn.SetClickHdl( LINK( this, OfaMiscTabPage, HelpAgentResetHdl_Impl ) );
+
+ //fill default names as user data
+ static const char* aHelpFormatNames[] =
+ {
+ "Default",
+ "HighContrast1",
+ "HighContrast2",
+ "HighContrastBlack",
+ "HighContrastWhite"
+ };
+
+ for ( USHORT i = 0; i < aHelpFormatLB.GetEntryCount(); i++ )
+ {
+ String* pData = new String( String::CreateFromAscii( aHelpFormatNames[i] ) );
+ aHelpFormatLB.SetEntryData( i, pData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+OfaMiscTabPage::~OfaMiscTabPage()
+{
+ for(USHORT i = 0; i < aHelpFormatLB.GetEntryCount(); i++)
+ {
+ delete static_cast< String* >( aHelpFormatLB.GetEntryData(i) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* OfaMiscTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new OfaMiscTabPage( pParent, rAttrSet );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL OfaMiscTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ BOOL bModified = FALSE;
+
+ SvtHelpOptions aHelpOptions;
+ BOOL bChecked = aToolTipsCB.IsChecked();
+ if ( bChecked != aToolTipsCB.GetSavedValue() )
+ aHelpOptions.SetHelpTips( bChecked );
+ bChecked = ( aExtHelpCB.IsChecked() && aToolTipsCB.IsChecked() );
+ if ( bChecked != aExtHelpCB.GetSavedValue() )
+ aHelpOptions.SetExtendedHelp( bChecked );
+ bChecked = aHelpAgentCB.IsChecked();
+ if ( bChecked != aHelpAgentCB.GetSavedValue() )
+ aHelpOptions.SetHelpAgentAutoStartMode( bChecked );
+ USHORT nHelpFormatPos = aHelpFormatLB.GetSelectEntryPos();
+ if ( nHelpFormatPos != LISTBOX_ENTRY_NOTFOUND &&
+ nHelpFormatPos != aHelpFormatLB.GetSavedValue() )
+ {
+ aHelpOptions.SetHelpStyleSheet( *static_cast< String* >( aHelpFormatLB.GetEntryData( nHelpFormatPos ) ) );
+ }
+
+ if ( aFileDlgCB.IsChecked() != aFileDlgCB.GetSavedValue() )
+ {
+ SvtMiscOptions aMiscOpt;
+ aMiscOpt.SetUseSystemFileDialog( !aFileDlgCB.IsChecked() );
+ bModified = TRUE;
+ }
+
+ if ( aPrintDlgCB.IsChecked() != aPrintDlgCB.GetSavedValue() )
+ {
+ SvtMiscOptions aMiscOpt;
+ aMiscOpt.SetUseSystemPrintDialog( !aPrintDlgCB.IsChecked() );
+ bModified = TRUE;
+ }
+
+ if ( aDocStatusCB.IsChecked() != aDocStatusCB.GetSavedValue() )
+ {
+ SvtPrintWarningOptions aPrintOptions;
+ aPrintOptions.SetModifyDocumentOnPrintingAllowed( aDocStatusCB.IsChecked() );
+ bModified = TRUE;
+ }
+
+ const SfxUInt16Item* pUInt16Item =
+ PTR_CAST( SfxUInt16Item, GetOldItem( rSet, SID_ATTR_YEAR2000 ) );
+ USHORT nNum = (USHORT)aYearValueField.GetText().ToInt32();
+ if ( pUInt16Item && pUInt16Item->GetValue() != nNum )
+ {
+ bModified = TRUE;
+ rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nNum ) );
+ }
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void OfaMiscTabPage::Reset( const SfxItemSet& rSet )
+{
+ SvtHelpOptions aHelpOptions;
+ aToolTipsCB.Check( aHelpOptions.IsHelpTips() );
+ aExtHelpCB.Check( aHelpOptions.IsHelpTips() && aHelpOptions.IsExtendedHelp() );
+ aHelpAgentCB.Check( aHelpOptions.IsHelpAgentAutoStartMode() );
+ String sStyleSheet = aHelpOptions.GetHelpStyleSheet();
+ for ( USHORT i = 0; i < aHelpFormatLB.GetEntryCount(); ++i )
+ {
+ if ( *static_cast< String* >( aHelpFormatLB.GetEntryData(i) ) == sStyleSheet )
+ {
+ aHelpFormatLB.SelectEntryPos(i);
+ break;
+ }
+ }
+
+ aToolTipsCB.SaveValue();
+ aExtHelpCB.SaveValue();
+ aHelpAgentCB.SaveValue();
+ aHelpFormatLB.SaveValue();
+ HelpCheckHdl_Impl( &aHelpAgentCB );
+
+ SvtMiscOptions aMiscOpt;
+ aFileDlgCB.Check( !aMiscOpt.UseSystemFileDialog() );
+ aFileDlgCB.SaveValue();
+ aPrintDlgCB.Check( !aMiscOpt.UseSystemPrintDialog() );
+ aPrintDlgCB.SaveValue();
+
+ SvtPrintWarningOptions aPrintOptions;
+ aDocStatusCB.Check(aPrintOptions.IsModifyDocumentOnPrintingAllowed());
+ aDocStatusCB.SaveValue();
+
+ const SfxPoolItem* pItem = NULL;
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_YEAR2000, FALSE, &pItem ) )
+ {
+ aYearValueField.SetValue( ((SfxUInt16Item*)pItem)->GetValue() );
+ TwoFigureConfigHdl( &aYearValueField );
+ }
+ else
+ {
+ aYearValueField.Enable(FALSE);
+ aTwoFigureFL.Enable(FALSE);
+ aInterpretFT.Enable(FALSE);
+ aToYearFT.Enable(FALSE);
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( OfaMiscTabPage, TwoFigureHdl, NumericField*, pEd )
+{
+ (void)pEd;
+
+ String aOutput( aStrDateInfo );
+ String aStr( aYearValueField.GetText() );
+ String sSep( SvtSysLocale().GetLocaleData().getNumThousandSep() );
+ xub_StrLen nIndex = 0;
+ while ((nIndex = aStr.Search( sSep, nIndex)) != STRING_NOTFOUND)
+ aStr.Erase( nIndex, sSep.Len());
+ long nNum = aStr.ToInt32();
+ if ( aStr.Len() != 4 || nNum < aYearValueField.GetMin() || nNum > aYearValueField.GetMax() )
+ aOutput.AppendAscii("????");
+ else
+ {
+ nNum += 99;
+ aOutput += String::CreateFromInt32( nNum );
+ }
+ aToYearFT.SetText( aOutput );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( OfaMiscTabPage, TwoFigureConfigHdl, NumericField*, pEd )
+{
+ sal_Int64 nNum = aYearValueField.GetValue();
+ String aOutput( String::CreateFromInt64( nNum ) );
+ aYearValueField.SetText( aOutput );
+ aYearValueField.SetSelection( Selection( 0, aOutput.Len() ) );
+ TwoFigureHdl( pEd );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( OfaMiscTabPage, HelpCheckHdl_Impl, CheckBox*, EMPTYARG )
+{
+ aExtHelpCB.Enable( aToolTipsCB.IsChecked() );
+ aHelpAgentResetBtn.Enable( aHelpAgentCB.IsChecked() );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( OfaMiscTabPage, HelpAgentResetHdl_Impl, PushButton*, EMPTYARG )
+{
+ SvtHelpOptions().resetAgentIgnoreURLCounter();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+class CanvasSettings
+{
+public:
+ CanvasSettings();
+
+ BOOL IsHardwareAccelerationEnabled() const;
+ BOOL IsHardwareAccelerationAvailable() const;
+ void EnabledHardwareAcceleration( BOOL _bEnabled ) const;
+
+private:
+ typedef std::vector< std::pair<OUString,Sequence<OUString> > > ServiceVector;
+
+ Reference<XNameAccess> mxForceFlagNameAccess;
+ ServiceVector maAvailableImplementations;
+ mutable BOOL mbHWAccelAvailable;
+ mutable BOOL mbHWAccelChecked;
+};
+
+// -------------------------------------------------------------------
+CanvasSettings::CanvasSettings() :
+ mxForceFlagNameAccess(),
+ mbHWAccelAvailable(FALSE),
+ mbHWAccelChecked(FALSE)
+{
+ try
+ {
+ Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
+ Reference<XMultiServiceFactory> xConfigProvider(
+ xFactory->createInstance(
+ OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")),
+ UNO_QUERY_THROW );
+
+ Any propValue(
+ makeAny( PropertyValue(
+ OUString::createFromAscii("nodepath"), -1,
+ makeAny( OUString::createFromAscii("/org.openoffice.Office.Canvas") ),
+ PropertyState_DIRECT_VALUE ) ) );
+
+ mxForceFlagNameAccess.set(
+ xConfigProvider->createInstanceWithArguments(
+ OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess"),
+ Sequence<Any>( &propValue, 1 ) ),
+ UNO_QUERY_THROW );
+
+ propValue = makeAny(
+ PropertyValue(
+ OUString::createFromAscii("nodepath"), -1,
+ makeAny( OUString::createFromAscii("/org.openoffice.Office.Canvas/CanvasServiceList") ),
+ PropertyState_DIRECT_VALUE ) );
+
+ Reference<XNameAccess> xNameAccess(
+ xConfigProvider->createInstanceWithArguments(
+ OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"),
+ Sequence<Any>( &propValue, 1 ) ), UNO_QUERY_THROW );
+ Reference<XHierarchicalNameAccess> xHierarchicalNameAccess(
+ xNameAccess, UNO_QUERY_THROW);
+
+ Sequence<OUString> serviceNames = xNameAccess->getElementNames();
+ const OUString* pCurr = serviceNames.getConstArray();
+ const OUString* const pEnd = pCurr + serviceNames.getLength();
+ while( pCurr != pEnd )
+ {
+ Reference<XNameAccess> xEntryNameAccess(
+ xHierarchicalNameAccess->getByHierarchicalName(*pCurr),
+ UNO_QUERY );
+
+ if( xEntryNameAccess.is() )
+ {
+ Sequence<OUString> preferredImplementations;
+ if( (xEntryNameAccess->getByName( OUString::createFromAscii("PreferredImplementations") ) >>= preferredImplementations) )
+ maAvailableImplementations.push_back( std::make_pair(*pCurr,preferredImplementations) );
+ }
+
+ ++pCurr;
+ }
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// -------------------------------------------------------------------
+BOOL CanvasSettings::IsHardwareAccelerationAvailable() const
+{
+ if( !mbHWAccelChecked )
+ {
+ mbHWAccelChecked = true;
+
+ Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
+
+ // check whether any of the service lists has an
+ // implementation that presents the "HardwareAcceleration" property
+ ServiceVector::const_iterator aCurr=maAvailableImplementations.begin();
+ const ServiceVector::const_iterator aEnd=maAvailableImplementations.end();
+ while( aCurr != aEnd )
+ {
+ const OUString* pCurrImpl = aCurr->second.getConstArray();
+ const OUString* const pEndImpl = pCurrImpl + aCurr->second.getLength();
+
+ while( pCurrImpl != pEndImpl )
+ {
+ try
+ {
+ Reference<XPropertySet> xPropSet( xFactory->createInstance(
+ pCurrImpl->trim() ),
+ UNO_QUERY_THROW );
+ bool bHasAccel(false);
+ if( (xPropSet->getPropertyValue(OUString::createFromAscii("HardwareAcceleration")) >>= bHasAccel) )
+ if( bHasAccel )
+ {
+ mbHWAccelAvailable = true;
+ return mbHWAccelAvailable;
+ }
+ }
+ catch (Exception &)
+ {}
+
+ ++pCurrImpl;
+ }
+
+ ++aCurr;
+ }
+ }
+
+ return mbHWAccelAvailable;
+}
+
+// -------------------------------------------------------------------
+BOOL CanvasSettings::IsHardwareAccelerationEnabled() const
+{
+ bool bForceLastEntry(false);
+ if( !mxForceFlagNameAccess.is() )
+ return true;
+
+ if( !(mxForceFlagNameAccess->getByName( OUString::createFromAscii("ForceSafeServiceImpl") ) >>= bForceLastEntry) )
+ return true;
+
+ return !bForceLastEntry;
+}
+
+// -------------------------------------------------------------------
+void CanvasSettings::EnabledHardwareAcceleration( BOOL _bEnabled ) const
+{
+ Reference< XNameReplace > xNameReplace(
+ mxForceFlagNameAccess, UNO_QUERY );
+
+ if( !xNameReplace.is() )
+ return;
+
+ xNameReplace->replaceByName( OUString::createFromAscii("ForceSafeServiceImpl"),
+ makeAny(!_bEnabled) );
+
+ Reference< XChangesBatch > xChangesBatch(
+ mxForceFlagNameAccess, UNO_QUERY );
+
+ if( !xChangesBatch.is() )
+ return;
+
+ xChangesBatch->commitChanges();
+}
+
+// class OfaViewTabPage --------------------------------------------------
+
+OfaViewTabPage::OfaViewTabPage(Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, SVX_RES( OFA_TP_VIEW ), rSet ),
+
+ aUserInterfaceFL ( this, SVX_RES( FL_USERINTERFACE ) ),
+ aWindowSizeFT ( this, SVX_RES( FT_WINDOWSIZE ) ),
+ aWindowSizeMF ( this, SVX_RES( MF_WINDOWSIZE ) ),
+ aIconSizeStyleFT ( this, SVX_RES( FT_ICONSIZESTYLE ) ),
+ aIconSizeLB ( this, SVX_RES( LB_ICONSIZE ) ),
+ aIconStyleLB ( this, SVX_RES( LB_ICONSTYLE ) ),
+ m_aSystemFont (this, SVX_RES( CB_SYSTEM_FONT ) ),
+#if defined( UNX )
+ aFontAntiAliasing ( this, SVX_RES( CB_FONTANTIALIASING )),
+ aAAPointLimitLabel ( this, SVX_RES( FT_POINTLIMIT_LABEL )),
+ aAAPointLimit ( this, SVX_RES( NF_AA_POINTLIMIT )),
+ aAAPointLimitUnits ( this, SVX_RES( FT_POINTLIMIT_UNIT )),
+#endif
+ aMenuFL ( this, SVX_RES( FL_MENU ) ),
+ aMenuIconsFT ( this, SVX_RES( FT_MENU_ICONS )),
+ aMenuIconsLB ( this, SVX_RES( LB_MENU_ICONS )),
+ aFontListsFL ( this, SVX_RES( FL_FONTLISTS) ),
+ aFontShowCB ( this, SVX_RES( CB_FONT_SHOW ) ),
+ aFontHistoryCB ( this, SVX_RES( CB_FONT_HISTORY ) ),
+ aRenderingFL ( this, SVX_RES( FL_RENDERING ) ),
+ aUseHardwareAccell ( this, SVX_RES( CB_USE_HARDACCELL ) ),
+ aUseAntiAliase ( this, SVX_RES( CB_USE_ANTIALIASE ) ),
+ aMouseFL ( this, SVX_RES( FL_MOUSE ) ),
+ aMousePosFT ( this, SVX_RES( FT_MOUSEPOS ) ),
+ aMousePosLB ( this, SVX_RES( LB_MOUSEPOS ) ),
+ aMouseMiddleFT ( this, SVX_RES( FT_MOUSEMIDDLE ) ),
+ aMouseMiddleLB ( this, SVX_RES( LB_MOUSEMIDDLE ) ),
+
+ // #i97672#
+ maSelectionFL(this, SVX_RES(FL_SELECTION)),
+ maSelectionCB(this, SVX_RES(CB_SELECTION)),
+ maSelectionMF(this, SVX_RES(MF_SELECTION)),
+
+ nSizeLB_InitialSelection(0),
+ nStyleLB_InitialSelection(0),
+ pAppearanceCfg(new SvtTabAppearanceCfg),
+ pCanvasSettings(new CanvasSettings),
+ mpDrawinglayerOpt(new SvtOptionsDrawinglayer)
+{
+#if defined( UNX )
+ aFontAntiAliasing.SetToggleHdl( LINK( this, OfaViewTabPage, OnAntialiasingToggled ) );
+
+ // depending on the size of the text in aAAPointLimitLabel, we slightly re-arrange aAAPointLimit and aAAPointLimitUnits
+ //#110391# if the label has no mnemonic and we are in a CJK version the mnemonic "(X)" will be added which
+ // influences the width calculation
+ MnemonicGenerator aMnemonicGenerator;
+ String sLabel(aAAPointLimitLabel.GetText());
+ aMnemonicGenerator.RegisterMnemonic( sLabel );
+ aMnemonicGenerator.CreateMnemonic( sLabel );
+ sLabel.EraseAllChars('~');
+
+ sal_Int32 nLabelWidth = aAAPointLimitLabel.GetTextWidth( sLabel );
+ nLabelWidth += 3; // small gap
+ // pixels to move both controls to the left
+ Size aSize = aAAPointLimitLabel.GetSizePixel();
+ sal_Int32 nMoveLeft = aSize.Width() - nLabelWidth;
+ // resize the first label
+ aSize.Width() = nLabelWidth;
+ aAAPointLimitLabel.SetSizePixel( aSize );
+
+ // move the numeric field
+ Point aPos( aAAPointLimit.GetPosPixel() );
+ aPos.X() -= nMoveLeft;
+ aAAPointLimit.SetPosPixel( aPos );
+
+ // move (and resize) the units FixedText
+ aPos = ( aAAPointLimitUnits.GetPosPixel() );
+ aPos.X() -= nMoveLeft;
+ aSize = aAAPointLimitUnits.GetSizePixel();
+ aSize.Width() += nMoveLeft;
+ aAAPointLimitUnits.SetPosSizePixel( aPos, aSize );
+#else
+ // on this platform, we do not have the anti aliasing options - move the other checkboxes accordingly
+ // (in the resource, the coordinates are calculated for the AA options beeing present)
+ Control* pMiscOptions[] =
+ {
+ &aMenuFL, &aMenuIconsFT, &aMenuIconsLB,
+ &aFontListsFL, &aFontShowCB, &aFontHistoryCB
+ };
+
+ // temporaryly create the checkbox for the anti aliasing (we need to to determine it's pos)
+ CheckBox* pFontAntiAliasing = new CheckBox( this, SVX_RES( CB_FONTANTIALIASING ) );
+ sal_Int32 nMoveUp = aMenuFL.GetPosPixel().Y() - pFontAntiAliasing->GetPosPixel().Y();
+ DELETEZ( pFontAntiAliasing );
+
+ Point aPos;
+ for ( sal_Int32 i = 0; i < sizeof( pMiscOptions ) / sizeof( pMiscOptions[0] ); ++i )
+ {
+ aPos = pMiscOptions[i]->GetPosPixel( );
+ aPos.Y() -= nMoveUp;
+ pMiscOptions[i]->SetPosPixel( aPos );
+ }
+
+#endif
+
+ // #i97672#
+ maSelectionCB.SetToggleHdl( LINK( this, OfaViewTabPage, OnSelectionToggled ) );
+
+ FreeResource();
+
+ if( ! Application::ValidateSystemFont() )
+ {
+ m_aSystemFont.Check( FALSE );
+ m_aSystemFont.Enable( FALSE );
+ }
+
+ // add real theme name to 'auto' theme, e.g. 'auto' => 'auto (classic)'
+ if( aIconStyleLB.GetEntryCount() > 1 )
+ {
+ ::rtl::OUString aAutoStr( aIconStyleLB.GetEntry( 0 ) );
+
+ aAutoStr += ::rtl::OUString::createFromAscii( " (" );
+
+ switch( Application::GetSettings().GetStyleSettings().GetAutoSymbolsStyle() )
+ {
+ case STYLE_SYMBOLS_DEFAULT: aAutoStr += aIconStyleLB.GetEntry( 1 ); break;
+ case STYLE_SYMBOLS_INDUSTRIAL: aAutoStr += aIconStyleLB.GetEntry( 2 ); break;
+ case STYLE_SYMBOLS_CRYSTAL: aAutoStr += aIconStyleLB.GetEntry( 3 ); break;
+ case STYLE_SYMBOLS_TANGO: aAutoStr += aIconStyleLB.GetEntry( 4 ); break;
+ case STYLE_SYMBOLS_CLASSIC: aAutoStr += aIconStyleLB.GetEntry( 5 ); break;
+ case STYLE_SYMBOLS_HICONTRAST: aAutoStr += aIconStyleLB.GetEntry( 6 ); break;
+ }
+
+ aIconStyleLB.RemoveEntry( 0 );
+ aIconStyleLB.InsertEntry( aAutoStr += ::rtl::OUString::createFromAscii( ")" ), 0 );
+ aIconStyleLB.SetSeparatorPos( aIconStyleLB.GetEntryCount() - 2 );
+ }
+}
+
+OfaViewTabPage::~OfaViewTabPage()
+{
+ delete mpDrawinglayerOpt;
+ delete pCanvasSettings;
+ delete pAppearanceCfg;
+}
+
+#if defined( UNX )
+//--- 20.08.01 10:16:12 ---------------------------------------------------
+IMPL_LINK( OfaViewTabPage, OnAntialiasingToggled, void*, NOTINTERESTEDIN )
+{
+ (void)NOTINTERESTEDIN;
+
+ sal_Bool bAAEnabled = aFontAntiAliasing.IsChecked();
+
+ aAAPointLimitLabel.Enable( bAAEnabled );
+ aAAPointLimit.Enable( bAAEnabled );
+ aAAPointLimitUnits.Enable( bAAEnabled );
+
+ return 0L;
+}
+#endif
+
+// #i97672#
+IMPL_LINK( OfaViewTabPage, OnSelectionToggled, void*, NOTINTERESTEDIN )
+{
+ (void)NOTINTERESTEDIN;
+ const bool bSelectionEnabled(maSelectionCB.IsChecked());
+ maSelectionMF.Enable(bSelectionEnabled);
+ return 0;
+}
+
+/*-----------------06.12.96 11.50-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* OfaViewTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new OfaViewTabPage(pParent, rAttrSet);
+}
+
+/*-----------------06.12.96 11.50-------------------
+
+--------------------------------------------------*/
+
+BOOL OfaViewTabPage::FillItemSet( SfxItemSet& )
+{
+ SvtFontOptions aFontOpt;
+ SvtMenuOptions aMenuOpt;
+ SvtStartOptions aStartOpt;
+
+ BOOL bModified = FALSE;
+ BOOL bMenuOptModified = FALSE;
+ bool bRepaintWindows(false);
+
+ SvtMiscOptions aMiscOptions;
+ UINT16 nSizeLB_NewSelection = aIconSizeLB.GetSelectEntryPos();
+ if( nSizeLB_InitialSelection != nSizeLB_NewSelection )
+ {
+ // from now on it's modified, even if via auto setting the same size was set as now selected in the LB
+ sal_Int16 eSet = SFX_SYMBOLS_SIZE_AUTO;
+ switch( nSizeLB_NewSelection )
+ {
+ case 0: eSet = SFX_SYMBOLS_SIZE_AUTO; break;
+ case 1: eSet = SFX_SYMBOLS_SIZE_SMALL; break;
+ case 2: eSet = SFX_SYMBOLS_SIZE_LARGE; break;
+ default:
+ DBG_ERROR( "OfaViewTabPage::FillItemSet(): This state of aIconSizeLB should not be possible!" );
+ }
+ aMiscOptions.SetSymbolsSize( eSet );
+ }
+
+ UINT16 nStyleLB_NewSelection = aIconStyleLB.GetSelectEntryPos();
+ if( nStyleLB_InitialSelection != nStyleLB_NewSelection )
+ {
+ sal_Int16 eSet = SFX_SYMBOLS_STYLE_AUTO;
+ switch( nStyleLB_NewSelection )
+ {
+ case 0: eSet = SFX_SYMBOLS_STYLE_AUTO; break;
+ case 1: eSet = SFX_SYMBOLS_STYLE_DEFAULT; break;
+ case 2: eSet = SFX_SYMBOLS_STYLE_HICONTRAST; break;
+ case 3: eSet = SFX_SYMBOLS_STYLE_INDUSTRIAL; break;
+ case 4: eSet = SFX_SYMBOLS_STYLE_CRYSTAL; break;
+ case 5: eSet = SFX_SYMBOLS_STYLE_TANGO; break;
+ case 6: eSet = SFX_SYMBOLS_STYLE_CLASSIC; break;
+ default:
+ DBG_ERROR( "OfaViewTabPage::FillItemSet(): This state of aIconStyleLB should not be possible!" );
+ }
+ aMiscOptions.SetSymbolsStyle( eSet );
+ }
+
+ BOOL bAppearanceChanged = FALSE;
+
+
+ // Screen Scaling
+ UINT16 nOldScale = pAppearanceCfg->GetScaleFactor();
+ UINT16 nNewScale = (UINT16)aWindowSizeMF.GetValue();
+
+ if ( nNewScale != nOldScale )
+ {
+ pAppearanceCfg->SetScaleFactor(nNewScale);
+ bAppearanceChanged = TRUE;
+ }
+
+ // Mouse Snap Mode
+ short eOldSnap = pAppearanceCfg->GetSnapMode();
+ short eNewSnap = aMousePosLB.GetSelectEntryPos();
+ if(eNewSnap > 2)
+ eNewSnap = 2;
+
+ if ( eNewSnap != eOldSnap )
+ {
+ pAppearanceCfg->SetSnapMode(eNewSnap );
+ bAppearanceChanged = TRUE;
+ }
+
+ // Middle Mouse Button
+ short eOldMiddleMouse = pAppearanceCfg->GetMiddleMouseButton();
+ short eNewMiddleMouse = aMouseMiddleLB.GetSelectEntryPos();
+ if(eNewMiddleMouse > 2)
+ eNewMiddleMouse = 2;
+
+ if ( eNewMiddleMouse != eOldMiddleMouse )
+ {
+ pAppearanceCfg->SetMiddleMouseButton( eNewMiddleMouse );
+ bAppearanceChanged = TRUE;
+ }
+
+#if defined( UNX )
+ if ( aFontAntiAliasing.IsChecked() != aFontAntiAliasing.GetSavedValue() )
+ {
+ pAppearanceCfg->SetFontAntiAliasing( aFontAntiAliasing.IsChecked() );
+ bAppearanceChanged = TRUE;
+ }
+
+ if ( aAAPointLimit.GetValue() != aAAPointLimit.GetSavedValue().ToInt32() )
+ {
+ pAppearanceCfg->SetFontAntialiasingMinPixelHeight( aAAPointLimit.GetValue() );
+ bAppearanceChanged = TRUE;
+ }
+#endif
+
+ if ( aFontShowCB.IsChecked() != aFontShowCB.GetSavedValue() )
+ {
+ aFontOpt.EnableFontWYSIWYG( aFontShowCB.IsChecked() );
+ bModified = TRUE;
+ }
+
+ if(aMenuIconsLB.GetSelectEntryPos() != aMenuIconsLB.GetSavedValue())
+ {
+ aMenuOpt.SetMenuIconsState( aMenuIconsLB.GetSelectEntryPos() == 0 ? 2 : aMenuIconsLB.GetSelectEntryPos() - 1);
+ bModified = TRUE;
+ bMenuOptModified = TRUE;
+ bAppearanceChanged = TRUE;
+ }
+
+ if ( aFontHistoryCB.IsChecked() != aFontHistoryCB.GetSavedValue() )
+ {
+ aFontOpt.EnableFontHistory( aFontHistoryCB.IsChecked() );
+ bModified = TRUE;
+ }
+
+ // #i95644# if disabled, do not use value, see in ::Reset()
+ if(aUseHardwareAccell.IsEnabled())
+ {
+ if(aUseHardwareAccell.IsChecked() != aUseHardwareAccell.GetSavedValue())
+ {
+ pCanvasSettings->EnabledHardwareAcceleration(aUseHardwareAccell.IsChecked());
+ bModified = TRUE;
+ }
+ }
+
+ // #i95644# if disabled, do not use value, see in ::Reset()
+ if(aUseAntiAliase.IsEnabled())
+ {
+ if(aUseAntiAliase.IsChecked() != mpDrawinglayerOpt->IsAntiAliasing())
+ {
+ mpDrawinglayerOpt->SetAntiAliasing(aUseAntiAliase.IsChecked());
+ bModified = TRUE;
+ bRepaintWindows = true;
+ }
+ }
+
+ // #i97672#
+ if(maSelectionCB.IsEnabled())
+ {
+ const bool bNewSelection(maSelectionCB.IsChecked());
+ const sal_uInt16 nNewTransparence((sal_uInt16)maSelectionMF.GetValue());
+
+ if(bNewSelection != (bool)mpDrawinglayerOpt->IsTransparentSelection())
+ {
+ mpDrawinglayerOpt->SetTransparentSelection(maSelectionCB.IsChecked());
+ bModified = TRUE;
+ bRepaintWindows = true;
+ }
+
+ // #i104150# even read the value when maSelectionMF is disabled; it may have been
+ // modified by enabling-modify-disabling by the user
+ if(nNewTransparence != mpDrawinglayerOpt->GetTransparentSelectionPercent())
+ {
+ mpDrawinglayerOpt->SetTransparentSelectionPercent(nNewTransparence);
+ bModified = TRUE;
+ bRepaintWindows = true;
+ }
+ }
+
+ SvtAccessibilityOptions aAccessibilityOptions;
+ if( aAccessibilityOptions.GetIsSystemFont() != m_aSystemFont.IsChecked() &&
+ m_aSystemFont.IsEnabled() )
+ {
+ aAccessibilityOptions.SetIsSystemFont( m_aSystemFont.IsChecked() );
+ bModified = TRUE;
+ bMenuOptModified = TRUE;
+ }
+
+ if( bMenuOptModified )
+ {
+ // Set changed settings to the application instance
+ AllSettings aAllSettings = Application::GetSettings();
+ StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ if( m_aSystemFont.IsEnabled() )
+ aStyleSettings.SetUseSystemUIFonts( m_aSystemFont.IsChecked() );
+ aAllSettings.SetStyleSettings(aStyleSettings);
+ Application::MergeSystemSettings( aAllSettings );
+ Application::SetSettings(aAllSettings);
+ }
+
+ if ( bAppearanceChanged )
+ {
+ pAppearanceCfg->Commit();
+ pAppearanceCfg->SetApplicationDefaults ( GetpApp() );
+ }
+
+ if(bRepaintWindows)
+ {
+ Window* pAppWindow = Application::GetFirstTopLevelWindow();
+
+ while(pAppWindow)
+ {
+ pAppWindow->Invalidate();
+ pAppWindow = Application::GetNextTopLevelWindow(pAppWindow);
+ }
+ }
+
+ return bModified;
+}
+
+/*-----------------06.12.96 11.50-------------------
+
+--------------------------------------------------*/
+void OfaViewTabPage::Reset( const SfxItemSet& )
+{
+ SvtMiscOptions aMiscOptions;
+
+ if( aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO )
+ nSizeLB_InitialSelection = ( aMiscOptions.AreCurrentSymbolsLarge() )? 2 : 1;
+ aIconSizeLB.SelectEntryPos( nSizeLB_InitialSelection );
+ aIconSizeLB.SaveValue();
+
+ if( aMiscOptions.GetSymbolsStyle() != SFX_SYMBOLS_STYLE_AUTO )
+ {
+ switch ( aMiscOptions.GetCurrentSymbolsStyle() )
+ {
+ case SFX_SYMBOLS_STYLE_DEFAULT: nStyleLB_InitialSelection = 1; break;
+ case SFX_SYMBOLS_STYLE_HICONTRAST: nStyleLB_InitialSelection = 2; break;
+ case SFX_SYMBOLS_STYLE_INDUSTRIAL: nStyleLB_InitialSelection = 3; break;
+ case SFX_SYMBOLS_STYLE_CRYSTAL: nStyleLB_InitialSelection = 4; break;
+ case SFX_SYMBOLS_STYLE_TANGO: nStyleLB_InitialSelection = 5; break;
+ case SFX_SYMBOLS_STYLE_CLASSIC: nStyleLB_InitialSelection = 6; break;
+ default: nStyleLB_InitialSelection = 0; break;
+ }
+ }
+
+ aIconStyleLB.SelectEntryPos( nStyleLB_InitialSelection );
+ aIconStyleLB.SaveValue();
+
+ if( m_aSystemFont.IsEnabled() )
+ {
+ SvtAccessibilityOptions aAccessibilityOptions;
+ m_aSystemFont.Check( aAccessibilityOptions.GetIsSystemFont() );
+ }
+
+ // Screen Scaling
+ aWindowSizeMF.SetValue ( pAppearanceCfg->GetScaleFactor() );
+ // Mouse Snap
+ aMousePosLB.SelectEntryPos(pAppearanceCfg->GetSnapMode());
+ aMousePosLB.SaveValue();
+
+ // Mouse Snap
+ aMouseMiddleLB.SelectEntryPos(pAppearanceCfg->GetMiddleMouseButton());
+ aMouseMiddleLB.SaveValue();
+
+#if defined( UNX )
+ aFontAntiAliasing.Check( pAppearanceCfg->IsFontAntiAliasing() );
+ aAAPointLimit.SetValue( pAppearanceCfg->GetFontAntialiasingMinPixelHeight() );
+#endif
+
+ // WorkingSet
+ SvtFontOptions aFontOpt;
+ aFontShowCB.Check( aFontOpt.IsFontWYSIWYGEnabled() );
+ SvtMenuOptions aMenuOpt;
+ aMenuIconsLB.SelectEntryPos(aMenuOpt.GetMenuIconsState() == 2 ? 0 : aMenuOpt.GetMenuIconsState() + 1);
+ aMenuIconsLB.SaveValue();
+ aFontHistoryCB.Check( aFontOpt.IsFontHistoryEnabled() );
+
+ { // #i95644# HW accel (unified to disable mechanism)
+ if(pCanvasSettings->IsHardwareAccelerationAvailable())
+ {
+ aUseHardwareAccell.Check(pCanvasSettings->IsHardwareAccelerationEnabled());
+ }
+ else
+ {
+ aUseHardwareAccell.Check(false);
+ aUseHardwareAccell.Disable();
+ }
+
+ aUseHardwareAccell.SaveValue();
+ }
+
+ { // #i95644# AntiAliasing
+ if(mpDrawinglayerOpt->IsAAPossibleOnThisSystem())
+ {
+ aUseAntiAliase.Check(mpDrawinglayerOpt->IsAntiAliasing());
+ }
+ else
+ {
+ aUseAntiAliase.Check(false);
+ aUseAntiAliase.Disable();
+ }
+
+ aUseAntiAliase.SaveValue();
+ }
+
+ {
+ // #i97672# Selection
+ // check if transparent selection is possible on this system
+ const bool bTransparentSelectionPossible(
+ !GetSettings().GetStyleSettings().GetHighContrastMode()
+ && supportsOperation(OutDevSupport_TransparentRect));
+
+ // enter values
+ if(bTransparentSelectionPossible)
+ {
+ maSelectionCB.Check(mpDrawinglayerOpt->IsTransparentSelection());
+ }
+ else
+ {
+ maSelectionCB.Enable(false);
+ }
+
+ maSelectionMF.SetValue(mpDrawinglayerOpt->GetTransparentSelectionPercent());
+ maSelectionMF.Enable(mpDrawinglayerOpt->IsTransparentSelection() && bTransparentSelectionPossible);
+ }
+
+#if defined( UNX )
+ aFontAntiAliasing.SaveValue();
+ aAAPointLimit.SaveValue();
+#endif
+ aFontShowCB.SaveValue();
+ aFontHistoryCB.SaveValue();
+
+#if defined( UNX )
+ LINK( this, OfaViewTabPage, OnAntialiasingToggled ).Call( NULL );
+#endif
+}
+/* -----------------------------23.11.00 14:55--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class LangConfigItem_Impl : public ConfigItem
+{
+ Any aValue;
+ OUString aPropertyName;
+public:
+ LangConfigItem_Impl(const OUString& rTree, const OUString& rProperty);
+ ~LangConfigItem_Impl();
+
+ virtual void Commit();
+
+ const Any& GetValue() const {return aValue;}
+ void SetValue(Any& rValue) {aValue = rValue; SetModified();}
+};
+/* -----------------------------23.11.00 15:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+LangConfigItem_Impl::LangConfigItem_Impl(
+ const OUString& rTree, const OUString& rProperty) :
+ ConfigItem(rTree),
+ aPropertyName(rProperty)
+{
+ Sequence<OUString> aNames(1);
+ aNames.getArray()[0] = aPropertyName;
+ Sequence<Any> aValues = GetProperties(aNames);
+ aValue = aValues.getConstArray()[0];
+}
+/* -----------------------------23.11.00 15:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+LangConfigItem_Impl::~LangConfigItem_Impl()
+{}
+/* -----------------------------23.11.00 15:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void LangConfigItem_Impl::Commit()
+{
+ Sequence<OUString> aNames(1);
+ aNames.getArray()[0] = aPropertyName;
+ Sequence<Any> aValues(1);
+ aValues.getArray()[0] = aValue;
+ PutProperties(aNames, aValues);
+}
+/* -----------------22.07.2003 10:33-----------------
+
+ --------------------------------------------------*/
+struct LanguageConfig_Impl
+{
+ SvtLanguageOptions aLanguageOptions;
+ SvtSysLocaleOptions aSysLocaleOptions;
+ SvtLinguConfig aLinguConfig;
+};
+/* -----------------------------23.11.00 13:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static sal_Bool bLanguageCurrentDoc_Impl = sal_False;
+
+// some things we'll need...
+static const OUString sConfigSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider");
+static const OUString sAccessSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess");
+static const OUString sAccessUpdSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess");
+static const OUString sInstalledLocalesPath = OUString::createFromAscii("org.openoffice.Setup/Office/InstalledLocales");
+static OUString sUserLocalePath = OUString::createFromAscii("org.openoffice.Office.Linguistic/General");
+//static const OUString sUserLocalePath = OUString::createFromAscii("org.openoffice.Office/Linguistic");
+static const OUString sUserLocaleKey = OUString::createFromAscii("UILocale");
+static const OUString sSystemLocalePath = OUString::createFromAscii("org.openoffice.System/L10N");
+static const OUString sSystemLocaleKey = OUString::createFromAscii("UILocale");
+static const OUString sOfficeLocalePath = OUString::createFromAscii("org.openoffice.Office/L10N");
+static const OUString sOfficeLocaleKey = OUString::createFromAscii("ooLocale");
+static Sequence< OUString > seqInstalledLanguages;
+
+OfaLanguagesTabPage::OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage( pParent, SVX_RES( OFA_TP_LANGUAGES ), rSet ),
+ aUILanguageGB(this, SVX_RES(FL_UI_LANG )),
+ aLocaleSettingFI(this, SVX_RES(FI_LOCALESETTING)),
+ aUserInterfaceFT(this, SVX_RES(FT_USERINTERFACE)),
+ aUserInterfaceLB(this, SVX_RES(LB_USERINTERFACE)),
+ aLocaleSettingFT(this, SVX_RES(FT_LOCALESETTING)),
+ aLocaleSettingLB(this, SVX_RES(LB_LOCALESETTING)),
+ aCurrencyFI( this, SVX_RES(FI_CURRENCY )),
+ aDecimalSeparatorFT(this, SVX_RES(FT_DECIMALSEPARATOR)),
+ aDecimalSeparatorCB(this, SVX_RES(CB_DECIMALSEPARATOR)),
+ aCurrencyFT( this, SVX_RES(FT_CURRENCY )),
+ aCurrencyLB( this, SVX_RES(LB_CURRENCY )),
+ aLinguLanguageGB(this, SVX_RES(FL_LINGU_LANG )),
+ aWesternLanguageFI(this, SVX_RES(FI_WEST_LANG )),
+ aWesternLanguageFT(this, SVX_RES(FT_WEST_LANG )),
+ aWesternLanguageLB(this, SVX_RES(LB_WEST_LANG )),
+ aAsianLanguageFI(this, SVX_RES(FI_ASIAN_LANG )),
+ aAsianLanguageFT(this, SVX_RES(FT_ASIAN_LANG )),
+ aAsianLanguageLB(this, SVX_RES(LB_ASIAN_LANG )),
+ aComplexLanguageFI(this, SVX_RES(FI_COMPLEX_LANG )),
+ aComplexLanguageFT(this, SVX_RES(FT_COMPLEX_LANG )),
+ aComplexLanguageLB(this, SVX_RES(LB_COMPLEX_LANG )),
+ aCurrentDocCB(this, SVX_RES(CB_CURRENT_DOC )),
+ aEnhancedFL(this, SVX_RES(FL_ENHANCED )),
+ aAsianSupportFI(this, SVX_RES(FI_ASIANSUPPORT )),
+ aAsianSupportCB(this, SVX_RES(CB_ASIANSUPPORT )),
+ aCTLSupportFI(this, SVX_RES(FI_CTLSUPPORT )),
+ aCTLSupportCB(this, SVX_RES(CB_CTLSUPPORT )),
+ sDecimalSeparatorLabel(aDecimalSeparatorCB.GetText()),
+ pLangConfig(new LanguageConfig_Impl)
+{
+ FreeResource();
+
+ // initialize user interface language selection
+ SvtLanguageTable* pLanguageTable = new SvtLanguageTable;
+ const String aStr( pLanguageTable->GetString( LANGUAGE_SYSTEM ) );
+
+ String aUILang(aStr);
+ aUILang += String::CreateFromAscii(" - ");
+ aUILang += pLanguageTable->GetString( Application::GetSettings().GetUILanguage() );
+
+ aUserInterfaceLB.InsertEntry(aUILang);
+ aUserInterfaceLB.SetEntryData(0, 0);
+ aUserInterfaceLB.SelectEntryPos(0);
+ try
+ {
+ OUString sOfficeLocaleValue;
+ OUString sSystemLocaleValue;
+
+ Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory();
+ Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory > (
+ theMSF->createInstance( sConfigSrvc ),UNO_QUERY_THROW);
+ Sequence< Any > theArgs(2);
+ Reference< XNameAccess > theNameAccess;
+
+ // find out which locales are currently installed and add them to the listbox
+ theArgs[0] = makeAny(NamedValue(OUString::createFromAscii("NodePath"), makeAny(sInstalledLocalesPath)));
+ theArgs[1] = makeAny(NamedValue(OUString::createFromAscii("reload"), makeAny(sal_True)));
+ theNameAccess = Reference< XNameAccess > (
+ theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs ), UNO_QUERY_THROW );
+ seqInstalledLanguages = theNameAccess->getElementNames();
+ LanguageType aLang = LANGUAGE_DONTKNOW;
+ for (sal_Int32 i=0; i<seqInstalledLanguages.getLength(); i++)
+ {
+ aLang = MsLangId::convertIsoStringToLanguage(seqInstalledLanguages[i]);
+ if (aLang != LANGUAGE_DONTKNOW)
+ {
+ //USHORT p = aUserInterfaceLB.InsertLanguage(aLang);
+ String aLangStr( pLanguageTable->GetString( aLang ) );
+ USHORT p = aUserInterfaceLB.InsertEntry(aLangStr);
+ aUserInterfaceLB.SetEntryData(p, (void*)(i+1));
+ }
+ }
+
+ // find out whether the user has a specific locale specified
+ Sequence< Any > theArgs2(1);
+ theArgs2[0] = makeAny(NamedValue(OUString::createFromAscii("NodePath"), makeAny(sUserLocalePath)));
+ theNameAccess = Reference< XNameAccess > (
+ theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs2 ), UNO_QUERY_THROW );
+ if (theNameAccess->hasByName(sUserLocaleKey))
+ theNameAccess->getByName(sUserLocaleKey) >>= m_sUserLocaleValue;
+ // select the user specified locale in the listbox
+ if (m_sUserLocaleValue.getLength() > 0)
+ {
+ sal_Int32 d = 0;
+ for (USHORT i=0; i < aUserInterfaceLB.GetEntryCount(); i++)
+ {
+ d = (sal_Int32)(sal_IntPtr)aUserInterfaceLB.GetEntryData(i);
+ if ( d > 0 && seqInstalledLanguages.getLength() > d-1 && seqInstalledLanguages[d-1].equals(m_sUserLocaleValue))
+ aUserInterfaceLB.SelectEntryPos(i);
+ }
+ }
+
+ }
+ catch (Exception &e)
+ {
+ // we'll just leave the box in it's default setting and won't
+ // even give it event handler...
+ OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
+ OSL_ENSURE(sal_False, aMsg.getStr());
+ }
+
+ aWesternLanguageLB.SetLanguageList( LANG_LIST_WESTERN | LANG_LIST_ONLY_KNOWN, TRUE, FALSE, TRUE );
+ aWesternLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::LATIN );
+ aAsianLanguageLB.SetLanguageList( LANG_LIST_CJK | LANG_LIST_ONLY_KNOWN, TRUE, FALSE, TRUE );
+ aAsianLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::ASIAN );
+ aComplexLanguageLB.SetLanguageList( LANG_LIST_CTL | LANG_LIST_ONLY_KNOWN, TRUE, FALSE, TRUE );
+ aComplexLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::COMPLEX );
+
+ aLocaleSettingLB.SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, FALSE, FALSE, FALSE);
+ aLocaleSettingLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::WEAK );
+
+ const NfCurrencyTable& rCurrTab = SvNumberFormatter::GetTheCurrencyTable();
+ const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry( LANGUAGE_SYSTEM );
+ // insert SYSTEM entry
+ String aDefaultCurr(aStr);
+ aDefaultCurr += String::CreateFromAscii(" - ");
+ aDefaultCurr += rCurr.GetBankSymbol();
+ aCurrencyLB.InsertEntry( aDefaultCurr );
+ // all currencies
+ String aTwoSpace( RTL_CONSTASCII_USTRINGPARAM( " " ) );
+ USHORT nCurrCount = rCurrTab.Count();
+ // first entry is SYSTEM, skip it
+ for ( USHORT j=1; j < nCurrCount; ++j )
+ {
+ const NfCurrencyEntry* pCurr = rCurrTab[j];
+ String aStr_( pCurr->GetBankSymbol() );
+ aStr_ += aTwoSpace;
+ aStr_ += pCurr->GetSymbol();
+ aStr_ = ApplyLreOrRleEmbedding( aStr_ );
+ aStr_ += aTwoSpace;
+ aStr_ += ApplyLreOrRleEmbedding( pLanguageTable->GetString( pCurr->GetLanguage() ) );
+ USHORT nPos = aCurrencyLB.InsertEntry( aStr_ );
+ aCurrencyLB.SetEntryData( nPos, (void*) pCurr );
+ }
+ delete pLanguageTable;
+
+ aLocaleSettingLB.SetSelectHdl( LINK( this, OfaLanguagesTabPage, LocaleSettingHdl ) );
+ Link aLink( LINK( this, OfaLanguagesTabPage, SupportHdl ) );
+ aAsianSupportCB.SetClickHdl( aLink );
+ aCTLSupportCB.SetClickHdl( aLink );
+
+ aAsianSupportCB.Check( m_bOldAsian = pLangConfig->aLanguageOptions.IsAnyEnabled() );
+ aAsianSupportCB.SaveValue();
+ sal_Bool bReadonly = pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_ALLCJK);
+ aAsianSupportCB.Enable(!bReadonly);
+ aAsianSupportFI.Show(bReadonly);
+ SupportHdl( &aAsianSupportCB );
+
+ aCTLSupportCB.Check( m_bOldCtl = pLangConfig->aLanguageOptions.IsCTLFontEnabled() );
+ aCTLSupportCB.SaveValue();
+ bReadonly = pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_CTLFONT);
+ aCTLSupportCB.Enable(!bReadonly);
+ aCTLSupportFI.Show(bReadonly);
+ SupportHdl( &aCTLSupportCB );
+}
+/*-- 23.11.00 13:06:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OfaLanguagesTabPage::~OfaLanguagesTabPage()
+{
+ delete pLangConfig;
+}
+/*-- 23.11.00 13:06:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage* OfaLanguagesTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new OfaLanguagesTabPage(pParent, rAttrSet);
+}
+/*-- 23.11.00 13:06:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+LanguageType lcl_LangStringToLangType(const OUString& rLang)
+{
+ Locale aLocale;
+ sal_Int32 nSep = rLang.indexOf('-');
+ if (nSep < 0)
+ aLocale.Language = rLang;
+ else
+ {
+ aLocale.Language = rLang.copy(0, nSep);
+ if (nSep < rLang.getLength())
+ aLocale.Country = rLang.copy(nSep+1, rLang.getLength() - (nSep+1));
+ }
+ LanguageType eLangType = SvxLocaleToLanguage( aLocale );
+ return eLangType;
+}
+
+/*-- 23.11.00 13:06:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_UpdateAndDelete(SfxVoidItem* pInvalidItems[], SfxBoolItem* pBoolItems[], sal_uInt16 nCount)
+{
+ SfxViewFrame* pCurrentFrm = SfxViewFrame::Current();
+ SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst();
+ while(pViewFrm)
+ {
+ SfxBindings& rBind = pViewFrm->GetBindings();
+ for(sal_Int16 i = 0; i < nCount; i++)
+ {
+ if(pCurrentFrm == pViewFrm)
+ rBind.InvalidateAll(sal_False);
+ rBind.SetState( *pInvalidItems[i] );
+ rBind.SetState( *pBoolItems[i] );
+ }
+ pViewFrm = SfxViewFrame::GetNext(*pViewFrm);
+ }
+ for(sal_Int16 i = 0; i < nCount; i++)
+ {
+ delete pInvalidItems[i];
+ delete pBoolItems[i] ;
+ }
+}
+
+BOOL OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ // lock configuration broadcasters so that we can coordinate the notifications
+ pLangConfig->aSysLocaleOptions.BlockBroadcasts( TRUE );
+ pLangConfig->aLanguageOptions.BlockBroadcasts( TRUE );
+ pLangConfig->aLinguConfig.BlockBroadcasts( TRUE );
+
+ if(aCTLSupportCB.IsChecked() &&
+ (aCTLSupportCB.GetSavedValue() != aCTLSupportCB.IsChecked()) ||
+ (aComplexLanguageLB.GetSavedValue() != aComplexLanguageLB.GetSelectEntryPos()))
+ {
+ //sequence checking has to be switched on depending on the selected CTL language
+ LanguageType eCTLLang = aComplexLanguageLB.GetSelectLanguage();
+ sal_Bool bOn = MsLangId::needsSequenceChecking( eCTLLang);
+ pLangConfig->aLanguageOptions.SetCTLSequenceCheckingRestricted(bOn);
+ pLangConfig->aLanguageOptions.SetCTLSequenceChecking(bOn);
+ pLangConfig->aLanguageOptions.SetCTLSequenceCheckingTypeAndReplace(bOn);
+ }
+ try
+ {
+ // handle settings for UI Language
+ // a change of setting needs to bring up a warning message
+ OUString aLangString;
+ sal_Int32 d = (sal_Int32)(sal_IntPtr)aUserInterfaceLB.GetEntryData(aUserInterfaceLB.GetSelectEntryPos());
+ if( d > 0 && seqInstalledLanguages.getLength() > d-1)
+ aLangString = seqInstalledLanguages[d-1];
+
+ /*
+ if( aUserInterfaceLB.GetSelectEntryPos() > 0)
+ aLangString = ConvertLanguageToIsoString(aUserInterfaceLB.GetSelectLanguage());
+ */
+ Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory();
+ Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory > (
+ theMSF->createInstance( sConfigSrvc ),UNO_QUERY_THROW);
+ Sequence< Any > theArgs(1);
+ theArgs[0] = makeAny(sUserLocalePath);
+ Reference< XPropertySet >xProp(
+ theConfigProvider->createInstanceWithArguments(sAccessUpdSrvc, theArgs ), UNO_QUERY_THROW );
+ if ( !m_sUserLocaleValue.equals(aLangString))
+ {
+ // OSL_ENSURE(sal_False, "UserInterface language was changed, restart.");
+ // write new value
+ xProp->setPropertyValue(sUserLocaleKey, makeAny(aLangString));
+ Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges();
+ // display info
+ InfoBox aBox(this, SVX_RES(RID_SVX_MSGBOX_LANGUAGE_RESTART));
+ aBox.Execute();
+
+ // tell quickstarter to stop being a veto listener
+
+ Reference< XInitialization > xInit(theMSF->createInstance(
+ OUString::createFromAscii("com.sun.star.office.Quickstart")), UNO_QUERY);
+ if (xInit.is())
+ {
+ Sequence< Any > args(3);
+ args[0] = makeAny(sal_False); // will be ignored
+ args[1] = makeAny(sal_False); // will be ignored
+ args[2] = makeAny(sal_False); // disable veto
+ xInit->initialize(args);
+ }
+ }
+ }
+ catch (Exception& e)
+ {
+ // we'll just leave the box in it's default setting and won't
+ // even give it event handler...
+ OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
+ OSL_ENSURE(sal_False, aMsg.getStr());
+ }
+
+ OUString sLang = pLangConfig->aSysLocaleOptions.GetLocaleConfigString();
+ LanguageType eOldLocale = (sLang.getLength() ?
+ lcl_LangStringToLangType( sLang ) : LANGUAGE_SYSTEM);
+ LanguageType eNewLocale = aLocaleSettingLB.GetSelectLanguage();
+ if ( eOldLocale != eNewLocale )
+ {
+ // an empty string denotes SYSTEM locale
+ OUString sNewLang;
+ if ( eNewLocale != LANGUAGE_SYSTEM )
+ {
+ Locale aLocale;
+ SvxLanguageToLocale( aLocale, eNewLocale );
+ sNewLang = aLocale.Language;
+ if ( aLocale.Country.getLength() > 0 )
+ {
+ sNewLang += C2U("-");
+ sNewLang += aLocale.Country;
+ }
+ }
+
+ // locale nowadays get to AppSettings via notification
+ // this will happen after releasing the lock on the ConfigurationBroadcaster at
+ // the end of this method
+ pLangConfig->aSysLocaleOptions.SetLocaleConfigString( sNewLang );
+ rSet.Put( SfxBoolItem( SID_OPT_LOCALE_CHANGED, TRUE ) );
+ }
+
+ if(aDecimalSeparatorCB.GetSavedValue() != aDecimalSeparatorCB.IsChecked())
+ pLangConfig->aSysLocaleOptions.SetDecimalSeparatorAsLocale(aDecimalSeparatorCB.IsChecked());
+
+ // Configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default.
+ OUString sOldCurr = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
+ USHORT nCurrPos = aCurrencyLB.GetSelectEntryPos();
+ const NfCurrencyEntry* pCurr = (const NfCurrencyEntry*)
+ aCurrencyLB.GetEntryData( nCurrPos );
+ OUString sNewCurr;
+ if ( pCurr )
+ sNewCurr = SvtSysLocaleOptions::CreateCurrencyConfigString(
+ pCurr->GetBankSymbol(), pCurr->GetLanguage() );
+ if ( sOldCurr != sNewCurr )
+ pLangConfig->aSysLocaleOptions.SetCurrencyConfigString( sNewCurr );
+
+ BOOL bRet = FALSE;
+ SfxObjectShell* pCurrentDocShell = SfxObjectShell::Current();
+ Reference< XPropertySet > xLinguProp( LinguMgr::GetLinguPropertySet(), UNO_QUERY );
+ BOOL bCurrentDocCBChecked = aCurrentDocCB.IsChecked();
+ if(aCurrentDocCB.IsEnabled())
+ bLanguageCurrentDoc_Impl = bCurrentDocCBChecked;
+ BOOL bCurrentDocCBChanged = bCurrentDocCBChecked != aCurrentDocCB.GetSavedValue();
+
+ BOOL bValChanged = aWesternLanguageLB.GetSavedValue() != aWesternLanguageLB.GetSelectEntryPos();
+ if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged)
+ {
+ LanguageType eSelectLang = aWesternLanguageLB.GetSelectLanguage();
+ if(!bCurrentDocCBChecked)
+ {
+ Any aValue;
+ Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false );
+ aValue <<= aLocale;
+ OUString aPropName( C2U("DefaultLocale") );
+ pLangConfig->aLinguConfig.SetProperty( aPropName, aValue );
+ if (xLinguProp.is())
+ xLinguProp->setPropertyValue( aPropName, aValue );
+ }
+ if(pCurrentDocShell)
+ {
+ rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::LATIN),
+ SID_ATTR_LANGUAGE));
+ bRet = TRUE;
+ }
+ }
+ bValChanged = aAsianLanguageLB.GetSavedValue() != aAsianLanguageLB.GetSelectEntryPos();
+ if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged)
+ {
+ LanguageType eSelectLang = aAsianLanguageLB.GetSelectLanguage();
+ if(!bCurrentDocCBChecked)
+ {
+ Any aValue;
+ Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false );
+ aValue <<= aLocale;
+ OUString aPropName( C2U("DefaultLocale_CJK") );
+ pLangConfig->aLinguConfig.SetProperty( aPropName, aValue );
+ if (xLinguProp.is())
+ xLinguProp->setPropertyValue( aPropName, aValue );
+ }
+ if(pCurrentDocShell)
+ {
+ rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::ASIAN),
+ SID_ATTR_CHAR_CJK_LANGUAGE));
+ bRet = TRUE;
+ }
+ }
+ bValChanged = aComplexLanguageLB.GetSavedValue() != aComplexLanguageLB.GetSelectEntryPos();
+ if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged)
+ {
+ LanguageType eSelectLang = aComplexLanguageLB.GetSelectLanguage();
+ if(!bCurrentDocCBChecked)
+ {
+ Any aValue;
+ Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false );
+ aValue <<= aLocale;
+ OUString aPropName( C2U("DefaultLocale_CTL") );
+ pLangConfig->aLinguConfig.SetProperty( aPropName, aValue );
+ if (xLinguProp.is())
+ xLinguProp->setPropertyValue( aPropName, aValue );
+ }
+ if(pCurrentDocShell)
+ {
+ rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::COMPLEX),
+ SID_ATTR_CHAR_CTL_LANGUAGE));
+ bRet = TRUE;
+ }
+ }
+
+ if(aAsianSupportCB.GetSavedValue() != aAsianSupportCB.IsChecked() )
+ {
+ sal_Bool bChecked = aAsianSupportCB.IsChecked();
+ pLangConfig->aLanguageOptions.SetAll(bChecked);
+
+ //iterate over all bindings to invalidate vertical text direction
+ const sal_uInt16 STATE_COUNT = 2;
+
+ SfxBoolItem* pBoolItems[STATE_COUNT];
+ pBoolItems[0] = new SfxBoolItem(SID_VERTICALTEXT_STATE, FALSE);
+ pBoolItems[1] = new SfxBoolItem(SID_TEXT_FITTOSIZE_VERTICAL, FALSE);
+
+ SfxVoidItem* pInvalidItems[STATE_COUNT];
+ pInvalidItems[0] = new SfxVoidItem(SID_VERTICALTEXT_STATE);
+ pInvalidItems[1] = new SfxVoidItem(SID_TEXT_FITTOSIZE_VERTICAL);
+
+ lcl_UpdateAndDelete(pInvalidItems, pBoolItems, STATE_COUNT);
+ }
+
+ if ( aCTLSupportCB.GetSavedValue() != aCTLSupportCB.IsChecked() )
+ {
+ pLangConfig->aLanguageOptions.SetCTLFontEnabled( aCTLSupportCB.IsChecked() );
+
+ const sal_uInt16 STATE_COUNT = 1;
+ SfxBoolItem* pBoolItems[STATE_COUNT];
+ pBoolItems[0] = new SfxBoolItem(SID_CTLFONT_STATE, FALSE);
+ SfxVoidItem* pInvalidItems[STATE_COUNT];
+ pInvalidItems[0] = new SfxVoidItem(SID_CTLFONT_STATE);
+ lcl_UpdateAndDelete(pInvalidItems, pBoolItems, STATE_COUNT);
+ }
+
+ if ( pLangConfig->aSysLocaleOptions.IsModified() )
+ pLangConfig->aSysLocaleOptions.Commit();
+
+ // first release the lock on the ConfigurationBroadcaster for Locale changes
+ // it seems that our code relies on the fact that before other changes like e.g. currency
+ // are broadcasted locale changes have been done
+ pLangConfig->aSysLocaleOptions.BlockBroadcasts( FALSE );
+ pLangConfig->aLanguageOptions.BlockBroadcasts( FALSE );
+ pLangConfig->aLinguConfig.BlockBroadcasts( FALSE );
+
+ return FALSE;
+}
+//-----------------------------------------------------------------------------
+void OfaLanguagesTabPage::Reset( const SfxItemSet& rSet )
+{
+ OUString sLang = pLangConfig->aSysLocaleOptions.GetLocaleConfigString();
+ if ( sLang.getLength() )
+ aLocaleSettingLB.SelectLanguage(lcl_LangStringToLangType(sLang));
+ else
+ aLocaleSettingLB.SelectLanguage( LANGUAGE_SYSTEM );
+ sal_Bool bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::E_LOCALE);
+ aLocaleSettingLB.Enable(!bReadonly);
+ aLocaleSettingFT.Enable(!bReadonly);
+ aLocaleSettingFI.Show(bReadonly);
+
+ //
+ aDecimalSeparatorCB.Check( pLangConfig->aSysLocaleOptions.IsDecimalSeparatorAsLocale());
+ aDecimalSeparatorCB.SaveValue();
+
+ // let LocaleSettingHdl enable/disable checkboxes for CJK/CTL support
+ // #i15812# must be done *before* the configured currency is set
+ // and update the decimal separator used for the given locale
+ LocaleSettingHdl(&aLocaleSettingLB);
+
+ // configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default
+ String aAbbrev;
+ LanguageType eLang;
+ const NfCurrencyEntry* pCurr = NULL;
+ sLang = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
+ if ( sLang.getLength() )
+ {
+ SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( aAbbrev, eLang, sLang );
+ pCurr = SvNumberFormatter::GetCurrencyEntry( aAbbrev, eLang );
+ }
+ // if pCurr==NULL the SYSTEM entry is selected
+ USHORT nPos = aCurrencyLB.GetEntryPos( (void*) pCurr );
+ aCurrencyLB.SelectEntryPos( nPos );
+ bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::E_CURRENCY);
+ aCurrencyLB.Enable(!bReadonly);
+ aCurrencyFT.Enable(!bReadonly);
+ aCurrencyFI.Show(bReadonly);
+
+ //western/CJK/CLK language
+ LanguageType eCurLang = LANGUAGE_NONE;
+ LanguageType eCurLangCJK = LANGUAGE_NONE;
+ LanguageType eCurLangCTL = LANGUAGE_NONE;
+ SfxObjectShell* pCurrentDocShell = SfxObjectShell::Current();
+ //collect the configuration values first
+ aCurrentDocCB.Enable(FALSE);
+ //
+ Any aWestLang;
+ Any aCJKLang;
+ Any aCTLLang;
+ try
+ {
+ aWestLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale"));
+ Locale aLocale;
+ aWestLang >>= aLocale;
+
+ eCurLang = MsLangId::convertLocaleToLanguage( aLocale );
+
+ aCJKLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale_CJK"));
+ aLocale = Locale();
+ aCJKLang >>= aLocale;
+ eCurLangCJK = MsLangId::convertLocaleToLanguage( aLocale );
+
+ aCTLLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale_CTL"));
+ aLocale = Locale();
+ aCTLLang >>= aLocale;
+ eCurLangCTL = MsLangId::convertLocaleToLanguage( aLocale );
+ }
+ catch(Exception&)
+ {
+ }
+ //overwrite them by the values provided by the DocShell
+ if(pCurrentDocShell)
+ {
+ aCurrentDocCB.Enable(TRUE);
+ aCurrentDocCB.Check(bLanguageCurrentDoc_Impl);
+ const SfxPoolItem* pLang;
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_LANGUAGE, FALSE, &pLang))
+ {
+ LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue();
+ if (MsLangId::resolveSystemLanguageByScriptType(eCurLang, ::com::sun::star::i18n::ScriptType::LATIN) != eTempCurLang)
+ eCurLang = eTempCurLang;
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, FALSE, &pLang))
+ {
+ LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue();
+ if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCJK, ::com::sun::star::i18n::ScriptType::ASIAN) != eTempCurLang)
+ eCurLangCJK = eTempCurLang;
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, FALSE, &pLang))
+ {
+ LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue();
+ if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCTL, ::com::sun::star::i18n::ScriptType::COMPLEX) != eTempCurLang)
+ eCurLangCTL = eTempCurLang;
+ }
+ }
+ if(LANGUAGE_NONE == eCurLang || LANGUAGE_DONTKNOW == eCurLang)
+ aWesternLanguageLB.SelectLanguage(LANGUAGE_NONE);
+ else
+ aWesternLanguageLB.SelectLanguage(eCurLang);
+
+ if(LANGUAGE_NONE == eCurLangCJK || LANGUAGE_DONTKNOW == eCurLangCJK)
+ aAsianLanguageLB.SelectLanguage(LANGUAGE_NONE);
+ else
+ aAsianLanguageLB.SelectLanguage(eCurLangCJK);
+
+ if(LANGUAGE_NONE == eCurLangCTL || LANGUAGE_DONTKNOW == eCurLangCTL)
+ aComplexLanguageLB.SelectLanguage(LANGUAGE_NONE);
+ else
+ aComplexLanguageLB.SelectLanguage(eCurLangCTL);
+
+ aWesternLanguageLB.SaveValue();
+ aAsianLanguageLB.SaveValue();
+ aComplexLanguageLB.SaveValue();
+ aCurrentDocCB.SaveValue();
+
+ sal_Bool bEnable = !pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale") );
+ aWesternLanguageFT.Enable( bEnable );
+ aWesternLanguageLB.Enable( bEnable );
+
+
+ aWesternLanguageFI.Show(!bEnable);
+
+ // #i15812# controls for CJK/CTL already enabled/disabled from LocaleSettingHdl
+#if 0
+ bEnable = ( !pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CJK") ) && aAsianSupportCB.IsChecked() );
+ aAsianLanguageFT.Enable( bEnable );
+ aAsianLanguageLB.Enable( bEnable );
+
+ bEnable = ( !pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CTL") ) && aCTLSupportCB.IsChecked() );
+ aComplexLanguageFT.Enable( bEnable );
+ aComplexLanguageLB.Enable( bEnable );
+#endif
+ /*---------------------07-05-07--------------------------
+ check the box "For the current document only"
+ set the focus to the Western Language box
+ --------------------------------------------------------*/
+ const SfxPoolItem* pLang = 0;
+ if ( SFX_ITEM_SET == rSet.GetItemState(SID_SET_DOCUMENT_LANGUAGE, FALSE, &pLang ) &&( (const SfxBoolItem*)pLang)->GetValue() == TRUE )
+ {
+ aWesternLanguageLB.GrabFocus();
+ aCurrentDocCB.Enable(TRUE);
+ aCurrentDocCB.Check(TRUE);
+ }
+}
+/* -----------------------------20.04.01 15:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( OfaLanguagesTabPage, SupportHdl, CheckBox*, pBox )
+{
+ DBG_ASSERT( pBox, "OfaLanguagesTabPage::SupportHdl(): pBox invalid" );
+
+ sal_Bool bCheck = pBox->IsChecked();
+ if ( &aAsianSupportCB == pBox )
+ {
+ sal_Bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CJK"));
+ bCheck = ( bCheck && !bReadonly );
+ aAsianLanguageFT.Enable( bCheck );
+ aAsianLanguageLB.Enable( bCheck );
+ aAsianLanguageFI.Show(bReadonly);
+ if( pBox->IsEnabled() )
+ m_bOldAsian = bCheck;
+ }
+ else if ( &aCTLSupportCB == pBox )
+ {
+ sal_Bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CTL"));
+ bCheck = ( bCheck && !bReadonly );
+ aComplexLanguageFT.Enable( bCheck );
+ aComplexLanguageLB.Enable( bCheck );
+ aComplexLanguageFI.Show(bReadonly);
+ if( pBox->IsEnabled() )
+ m_bOldCtl = bCheck;
+ }
+ else
+ {
+ DBG_ERRORFILE( "OfaLanguagesTabPage::SupportHdl(): wrong pBox" );
+ }
+
+ return 0;
+}
+
+namespace
+{
+ void lcl_checkLanguageCheckBox(CheckBox& _rCB,sal_Bool _bNewValue,sal_Bool _bOldValue)
+ {
+ if ( _bNewValue )
+ _rCB.Check(TRUE);
+ else
+ _rCB.Check( _bOldValue );
+// #i15082# do not call SaveValue() in running dialog...
+// _rCB.SaveValue();
+ _rCB.Enable( !_bNewValue );
+ }
+}
+/* -----------------08.06.01 17:56-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK( OfaLanguagesTabPage, LocaleSettingHdl, SvxLanguageBox*, pBox )
+{
+ LanguageType eLang = pBox->GetSelectLanguage();
+ sal_uInt16 nType = SvtLanguageOptions::GetScriptTypeOfLanguage(eLang);
+ // first check if CTL must be enabled
+ // #103299# - if CTL font setting is not readonly
+ if(!pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_CTLFONT))
+ {
+ bool bIsCTLFixed = (nType & SCRIPTTYPE_COMPLEX) != 0;
+ lcl_checkLanguageCheckBox(aCTLSupportCB, bIsCTLFixed, m_bOldCtl);
+ SupportHdl( &aCTLSupportCB );
+ }
+ // second check if CJK must be enabled
+ // #103299# - if CJK support is not readonly
+ if(!pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_ALLCJK))
+ {
+ bool bIsCJKFixed = (nType & SCRIPTTYPE_ASIAN) != 0;
+ lcl_checkLanguageCheckBox(aAsianSupportCB, bIsCJKFixed, m_bOldAsian);
+ SupportHdl( &aAsianSupportCB );
+ }
+
+ USHORT nPos;
+ if ( eLang == LANGUAGE_SYSTEM )
+ nPos = aCurrencyLB.GetEntryPos( (void*) NULL );
+ else
+ {
+ const NfCurrencyEntry* pCurr = &SvNumberFormatter::GetCurrencyEntry( eLang );
+ nPos = aCurrencyLB.GetEntryPos( (void*) pCurr );
+ }
+ aCurrencyLB.SelectEntryPos( nPos );
+
+ //update the decimal separator key of the related CheckBox
+ Locale aTempLocale;
+ SvxLanguageToLocale( aTempLocale, eLang );
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), aTempLocale );
+ String sTempLabel(sDecimalSeparatorLabel);
+ sTempLabel.SearchAndReplaceAscii("%1", aLocaleWrapper.getNumDecimalSep() );
+ aDecimalSeparatorCB.SetText(sTempLabel);
+
+ return 0;
+}
+
diff --git a/cui/source/options/optgdlg.hrc b/cui/source/options/optgdlg.hrc
new file mode 100644
index 000000000000..3ad985caa706
--- /dev/null
+++ b/cui/source/options/optgdlg.hrc
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * 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: optgdlg.hrc,v $
+ * $Revision: 1.22 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTGDLG_HRC
+#define _SVX_OPTGDLG_HRC
+#include <svtools/controldims.hrc>
+
+// defines for positions and sizes ---------------------------------------
+
+#define WHOLE_WIDTH 248
+#define EDIT_WIDTH 30
+#define UNIT_WIDTH 40
+
+#define COLSPACE RSC_SP_CTRL_DESC_X
+#define COL0 6
+#define COL1 (COL0+6)
+#define COL2 (COL1+10)
+#define COL3 (COL2+100)
+#define COL4 (COL3+COLSPACE)
+#define COL5 (COL4+EDIT_WIDTH)
+#define COL6 (COL5+COLSPACE)
+
+#define ROWSPACE RSC_SP_CTRL_DESC_Y
+#define ROW0 3
+#define ROW1 (ROW0+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE)
+#define ROW2 (ROW1+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE)
+#define ROW3 (ROW2+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE)
+#define ROW4 (ROW3+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE)
+#define ROW5 (ROW4+RSC_CD_PUSHBUTTON_HEIGHT+ROWSPACE)
+#define ROW6 (ROW5+RSC_CD_DROPDOWN_HEIGHT+ROWSPACE)
+#define ROW7 (ROW6+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE)
+#define ROW8 (ROW7+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE)
+#define ROW9 (ROW8+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE)
+#define ROW10 (ROW9+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE)
+#define ROW11 (ROW10+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE)
+
+#define DIFF(v1,v2) (v2-v1)
+#define OFFS_TEXTBOX_FIXEDTEXT(base) (base+(RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+//#define OFFS_PUSHBUTTON_FIXEDTEXT(base) (base+(RSC_CD_PUSHBUTTON_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+
+#define ROW_MF_SCALING (13)
+#define ROW_FT_ICONSIZESTYLE (ROW_MF_SCALING+RSC_CD_DROPDOWN_HEIGHT+ROWSPACE)
+#define ROW_LB_ICONSIZESTYLE (ROW_FT_ICONSIZESTYLE+RSC_CD_FIXEDTEXT_HEIGHT+ROWSPACE)
+#define ROW_CB_SYSTEM_FONT (ROW_LB_ICONSIZESTYLE+RSC_CD_DROPDOWN_HEIGHT+ROWSPACE)
+#define ROW_CB_FONTANTIALIASING (ROW_CB_SYSTEM_FONT+ (2 * RSC_CD_FIXEDLINE_HEIGHT) +ROWSPACE)
+#define ROW_NF_AA_POINTLIMIT (ROW_CB_FONTANTIALIASING+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE)
+
+#define ROW_FL_MENU (ROW_NF_AA_POINTLIMIT+RSC_CD_DROPDOWN_HEIGHT+RSC_SP_FLGR_SPACE_X)
+#define ROW_FT_MENU_ICONS (ROW_FL_MENU + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE)
+#define ROW_LB_MENU_ICONS (ROW_FT_MENU_ICONS + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE)
+
+#define ROW_FL_FONTLISTS (ROW_LB_MENU_ICONS + RSC_CD_CHECKBOX_HEIGHT + RSC_SP_FLGR_SPACE_X)
+#define ROW_CB_FONT_SHOW (ROW_FL_FONTLISTS + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE)
+#define ROW_CB_FONT_HISTORY (ROW_CB_FONT_SHOW + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE)
+
+// #i95644# start on top with rendering section
+#define ROW_FL_RENDERING (3)
+#define ROW_CB_USE_HARDACCELL (ROW_FL_RENDERING + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE)
+#define ROW_CB_USE_ANTIALIASE (ROW_CB_USE_HARDACCELL + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE)
+
+// #i95644# set Menu to follow vertically (was (ROW_FL_MENU)) previously)
+#define ROW_FL_MOUSE (ROW_CB_USE_ANTIALIASE + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_SPACE_X)
+#define ROW_FT_MOUSEPOS (ROW_FL_MOUSE + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE)
+#define ROW_LB_MOUSEPOS (ROW_FT_MOUSEPOS + RSC_CD_FIXEDTEXT_HEIGHT + ROWSPACE)
+#define ROW_FT_MOUSEMIDDLE (ROW_LB_MOUSEPOS + RSC_CD_DROPDOWN_HEIGHT + ROWSPACE)
+#define ROW_LB_MOUSEMIDDLE (ROW_FT_MOUSEMIDDLE + RSC_CD_FIXEDTEXT_HEIGHT + ROWSPACE)
+
+// #i97672#
+#define ROW_FL_SELECTION (ROW_LB_MOUSEMIDDLE + RSC_CD_DROPDOWN_HEIGHT + RSC_SP_FLGR_SPACE_X)
+#define ROW_CB_SELECTION (ROW_FL_SELECTION + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE)
+
+// tabpage general -------------------------------------------------------
+
+#define FL_HELP 10
+#define CB_TOOLTIP 11
+#define CB_EXTHELP 12
+#define CB_HELPAGENT 13
+#define PB_HELPAGENT_RESET 14
+#define FT_HELPFORMAT 15
+#define LB_HELPFORMAT 16
+
+//#define FL_FILEDLG 20
+//#define CB_FILEDLG 21
+
+//#define FL_DOCSTATUS 30
+//#define CB_DOCSTATUS 31
+
+#define FL_TWOFIGURE 40
+#define FT_INTERPRET 41
+#define NF_YEARVALUE 42
+#define FT_TOYEAR 43
+#define FL_PRINTDLG 44
+#define CB_PRINTDLG 45
+
+// tabpage view ----------------------------------------------------------
+// #i95644# 10 .. 14 freed, may be reused
+
+#define FL_USERINTERFACE 20
+#define FT_WINDOWSIZE 21
+#define MF_WINDOWSIZE 22
+
+#define FL_MOUSE 30
+#define LB_MOUSEPOS 31
+#define FT_MOUSEPOS 32
+#define FT_MOUSEMIDDLE 33
+#define LB_MOUSEMIDDLE 34
+
+#define FT_MENU_ICONS 40
+#define LB_MENU_ICONS 41
+#define FL_MENU 42
+#define FL_FONTLISTS 43
+
+#define LB_ICONSIZE 54
+#define FT_ICONSIZESTYLE 55
+#define LB_ICONSTYLE 56
+#define CB_SYSTEM_FONT 57
+#define STR_ICONSIZE 58
+
+#define CB_FONT_SHOW 60
+#define CB_FONT_HISTORY 62
+
+#define CB_FONTANTIALIASING 63
+#define NF_AA_POINTLIMIT 64
+#define FT_POINTLIMIT_LABEL 65
+#define FT_POINTLIMIT_UNIT 66
+
+#define FL_RENDERING 67
+#define CB_USE_HARDACCELL 68
+#define CB_USE_ANTIALIASE 69
+
+// #i97672#
+#define FL_SELECTION 70
+#define CB_SELECTION 71
+#define MF_SELECTION 72
+
+// tabpage languages -----------------------------------------------------
+
+#define FL_UI_LANG 1
+#define FT_UI_LANG 2
+#define LB_UI_LANG 3
+#define FL_LINGU_LANG 4
+#define FT_WEST_LANG 5
+#define LB_WEST_LANG 6
+#define FT_ASIAN_LANG 7
+#define LB_ASIAN_LANG 8
+#define FT_COMPLEX_LANG 9
+#define LB_COMPLEX_LANG 10
+#define CB_CURRENT_DOC 11
+#define FL_ENHANCED 12
+#define CB_ASIANSUPPORT 13
+#define CB_CTLSUPPORT 15
+#define FT_LOCALESETTING 16
+#define LB_LOCALESETTING 17
+#define FT_CURRENCY 18
+#define LB_CURRENCY 19
+#define FI_WEST_LANG 20
+#define FI_ASIAN_LANG 21
+#define FI_COMPLEX_LANG 22
+#define FI_ASIANSUPPORT 23
+#define FI_CTLSUPPORT 24
+#define FI_LOCALESETTING 25
+#define FI_CURRENCY 26
+#define FT_DECIMALSEPARATOR 27
+#define CB_DECIMALSEPARATOR 28
+#define FI_USERINTERFACE 29
+#define FT_USERINTERFACE 30
+#define LB_USERINTERFACE 31
+#define STR_IB_LANGCHANGE_TITLE 32
+
+#define FL_FILEDLG 53
+#define FI_FILEDLG_RO 54
+#define CB_FILEDLG 55
+#define FT_GRAPHICCACHE_UNIT 56
+#define FT_GRAPHICOBJECTCACHE_UNIT 57
+#define FT_GRAPHICOBJECTTIME_UNIT 58
+#define FT_HELPAGENT_TIME_UNIT 59
+#define FL_DOCSTATUS 60
+#define CB_DOCSTATUS 61
+#endif // #ifndef _SVX_OPTGDLG_HRC
+
+// ******************************************************************* EOF
+
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
new file mode 100644
index 000000000000..4b86896fa58f
--- /dev/null
+++ b/cui/source/options/optgdlg.hxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * 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: optgdlg.hxx,v $
+ * $Revision: 1.23 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OFA_OPTGDLG_HXX
+#define _OFA_OPTGDLG_HXX
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/langbox.hxx>
+#include <readonlyimage.hxx>
+#define FOLDERWEBVIEW_DEFAULTFILE "folder.so"
+
+// predeclarations
+class CanvasSettings;
+class SvtOptionsDrawinglayer;
+
+// class OfaMiscTabPage --------------------------------------------------
+
+class OfaMiscTabPage : public SfxTabPage
+{
+ using TabPage::DeactivatePage;
+private:
+ FixedLine aHelpFL;
+ CheckBox aToolTipsCB;
+ CheckBox aExtHelpCB;
+ CheckBox aHelpAgentCB;
+ PushButton aHelpAgentResetBtn;
+ FixedText aHelpFormatFT;
+ ListBox aHelpFormatLB;
+
+ FixedLine aFileDlgFL;
+ ReadOnlyImage aFileDlgROImage;
+ CheckBox aFileDlgCB;
+
+ FixedLine aPrintDlgFL;
+ CheckBox aPrintDlgCB;
+
+ FixedLine aDocStatusFL;
+ CheckBox aDocStatusCB;
+
+ FixedLine aTwoFigureFL;
+ FixedText aInterpretFT;
+ NumericField aYearValueField;
+ FixedText aToYearFT;
+
+ String aStrDateInfo;
+
+ DECL_LINK( TwoFigureHdl, NumericField* );
+ DECL_LINK( TwoFigureConfigHdl, NumericField* );
+ DECL_LINK( HelpCheckHdl_Impl, CheckBox* );
+ DECL_LINK( HelpAgentResetHdl_Impl, PushButton* );
+protected:
+ virtual int DeactivatePage( SfxItemSet* pSet = NULL );
+
+public:
+ OfaMiscTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~OfaMiscTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+// class OfaViewTabPage --------------------------------------------------
+class SvtTabAppearanceCfg;
+
+class OfaViewTabPage : public SfxTabPage
+{
+private:
+ FixedLine aUserInterfaceFL;
+ FixedText aWindowSizeFT;
+ MetricField aWindowSizeMF;
+ FixedText aIconSizeStyleFT;
+ ListBox aIconSizeLB;
+ ListBox aIconStyleLB;
+ CheckBox m_aSystemFont;
+
+#if defined( UNX )
+ CheckBox aFontAntiAliasing;
+ FixedText aAAPointLimitLabel;
+ NumericField aAAPointLimit;
+ FixedText aAAPointLimitUnits;
+#endif
+
+ FixedLine aMenuFL;
+ FixedText aMenuIconsFT;
+ ListBox aMenuIconsLB;
+
+ FixedLine aFontListsFL;
+ CheckBox aFontShowCB;
+ CheckBox aFontHistoryCB;
+
+ FixedLine aRenderingFL;
+ CheckBox aUseHardwareAccell;
+ CheckBox aUseAntiAliase;
+
+ FixedLine aMouseFL;
+ FixedText aMousePosFT;
+ ListBox aMousePosLB;
+ FixedText aMouseMiddleFT;
+ ListBox aMouseMiddleLB;
+
+ // #i97672#
+ FixedLine maSelectionFL;
+ CheckBox maSelectionCB;
+ MetricField maSelectionMF;
+
+ UINT16 nSizeLB_InitialSelection;
+ UINT16 nStyleLB_InitialSelection;
+ BOOL bSfxSymbolsAuto;
+
+ SvtTabAppearanceCfg* pAppearanceCfg;
+ CanvasSettings* pCanvasSettings;
+ SvtOptionsDrawinglayer* mpDrawinglayerOpt;
+
+#if defined( UNX )
+ DECL_LINK( OnAntialiasingToggled, void* );
+#endif
+ // #i97672#
+ DECL_LINK( OnSelectionToggled, void* );
+
+public:
+ OfaViewTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~OfaViewTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+/* -----------------------------23.11.00 13:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+struct LanguageConfig_Impl;
+class OfaLanguagesTabPage : public SfxTabPage
+{
+ FixedLine aUILanguageGB;
+ ReadOnlyImage aLocaleSettingFI;
+ FixedText aUserInterfaceFT;
+ ListBox aUserInterfaceLB;
+ FixedText aLocaleSettingFT;
+ SvxLanguageBox aLocaleSettingLB;
+ ReadOnlyImage aCurrencyFI;
+ FixedText aDecimalSeparatorFT;
+ CheckBox aDecimalSeparatorCB;
+ FixedText aCurrencyFT;
+ ListBox aCurrencyLB;
+
+ FixedLine aLinguLanguageGB;
+ ReadOnlyImage aWesternLanguageFI;
+ FixedText aWesternLanguageFT;
+ SvxLanguageBox aWesternLanguageLB;
+ ReadOnlyImage aAsianLanguageFI;
+ FixedText aAsianLanguageFT;
+ SvxLanguageBox aAsianLanguageLB;
+ ReadOnlyImage aComplexLanguageFI;
+ FixedText aComplexLanguageFT;
+ SvxLanguageBox aComplexLanguageLB;
+ CheckBox aCurrentDocCB;
+ FixedLine aEnhancedFL;
+ ReadOnlyImage aAsianSupportFI;
+ CheckBox aAsianSupportCB;
+ ReadOnlyImage aCTLSupportFI;
+ CheckBox aCTLSupportCB;
+
+ const String sDecimalSeparatorLabel;
+
+ sal_Bool m_bOldAsian;
+ sal_Bool m_bOldCtl;
+ LanguageConfig_Impl* pLangConfig;
+
+ rtl::OUString m_sUserLocaleValue;
+
+ DECL_LINK( SupportHdl, CheckBox* ) ;
+ DECL_LINK( LocaleSettingHdl, SvxLanguageBox* ) ;
+
+public:
+ OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~OfaLanguagesTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+#endif // #ifndef _OFA_OPTGDLG_HXX
+
+
diff --git a/cui/source/options/optgdlg.src b/cui/source/options/optgdlg.src
new file mode 100644
index 000000000000..f663a7ed44ef
--- /dev/null
+++ b/cui/source/options/optgdlg.src
@@ -0,0 +1,642 @@
+/*************************************************************************
+ *
+ * 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: optgdlg.src,v $
+ * $Revision: 1.32 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+
+#include <svx/dialogs.hrc>
+#include "optgdlg.hrc"
+#include "helpid.hrc"
+
+ //****************************************************************************
+ //
+ // TabPage Sonstiges
+ //
+ //****************************************************************************
+
+TabPage OFA_TP_MISC
+{
+ HelpID = HID_OFA_TP_MISC ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_HELP
+ {
+ Pos = MAP_APPFONT( COL0, ROW0 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Help";
+ };
+ CheckBox CB_TOOLTIP
+ {
+ Pos = MAP_APPFONT( COL1, ROW1 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Tips";
+ };
+ CheckBox CB_EXTHELP
+ {
+ Pos = MAP_APPFONT( COL2, ROW2 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL2, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Extended tips";
+ };
+ CheckBox CB_HELPAGENT
+ {
+ Pos = MAP_APPFONT( COL1, ROW3 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Help Agent";
+ };
+ PushButton PB_HELPAGENT_RESET
+ {
+ Pos = MAP_APPFONT( COL2, ROW4 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "~Reset Help Agent";
+ };
+ FixedText FT_HELPFORMAT
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT(ROW5) );
+ Size = MAP_APPFONT( DIFF( COL1, COL3 ), RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Help ~formatting";
+ };
+ ListBox LB_HELPFORMAT
+ {
+ Pos = MAP_APPFONT( COL4, ROW5 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL4, 50 );
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Default" ; > ;
+ < "High Contrast #1" ; > ;
+ < "High Contrast #2" ; > ;
+ < "High Contrast Black" ; > ;
+ < "High Contrast White" ; > ;
+ };
+ };
+ FixedLine FL_FILEDLG
+ {
+ Pos = MAP_APPFONT( COL0, ROW6 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Open/Save dialogs";
+ };
+ FixedImage FI_FILEDLG_RO
+ {
+ Pos = MAP_APPFONT( COL1 - 7, ROW7 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ Hide = TRUE;
+ };
+ CheckBox CB_FILEDLG
+ {
+ Pos = MAP_APPFONT( COL1, ROW7 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Use %PRODUCTNAME dialogs";
+ };
+ FixedLine FL_DOCSTATUS
+ {
+ Pos = MAP_APPFONT( COL0, ROW8 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Document status";
+ };
+ CheckBox CB_DOCSTATUS
+ {
+ Pos = MAP_APPFONT( COL1, ROW9 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Printing sets \"document modified\" status";
+ };
+ FixedLine FL_TWOFIGURE
+ {
+ Pos = MAP_APPFONT( COL0, ROW10 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Year (two digits)" ;
+ };
+ FixedText FT_INTERPRET
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT(ROW11) );
+ Size = MAP_APPFONT( DIFF( COL1, COL3), RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Interpret as years between";
+ };
+ NumericField NF_YEARVALUE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL4, ROW11 );
+ Size = MAP_APPFONT( EDIT_WIDTH, RSC_CD_TEXTBOX_HEIGHT );
+ Minimum = 1583 ;
+ Maximum = 9857 ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
+ FixedText FT_TOYEAR
+ {
+ Pos = MAP_APPFONT( COL6, OFFS_TEXTBOX_FIXEDTEXT(ROW11) );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL6, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "and " ;
+ };
+ FixedLine FL_PRINTDLG
+ {
+ Pos = MAP_APPFONT( COL0, ROW8 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Print dialogs";
+ };
+ CheckBox CB_PRINTDLG
+ {
+ Pos = MAP_APPFONT( COL1, ROW9 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Use %PRODUCTNAME ~dialogs";
+ };
+};
+
+ //****************************************************************************
+ //
+ // TabPage Ansicht
+ //
+ //****************************************************************************
+
+TabPage OFA_TP_VIEW
+{
+ HelpID = HID_OFA_TP_VIEW ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_USERINTERFACE
+ {
+ Pos = MAP_APPFONT ( 6 , ROW0 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "User Interface" ;
+ };
+ FixedText FT_WINDOWSIZE
+ {
+ Pos = MAP_APPFONT ( 12 , OFFS_TEXTBOX_FIXEDTEXT( ROW_MF_SCALING ) ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Sc~aling" ;
+ };
+ MetricField MF_WINDOWSIZE
+ {
+ Pos = MAP_APPFONT ( 95 , ROW_MF_SCALING ) ;
+ Size = MAP_APPFONT ( 31 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 80 ;
+ Maximum = 130 ;
+ DecimalDigits = 0 ;
+ First = 80 ;
+ Last = 130 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ };
+ FixedText FT_ICONSIZESTYLE
+ {
+ Pos = MAP_APPFONT ( 12 , ROW_FT_ICONSIZESTYLE ) ;
+ Size = MAP_APPFONT ( 114 , 8 ) ;
+ Text [ en-US ] = "Icon size and style" ;
+ };
+ String STR_ICONSIZE
+ {
+ Text [ en-US ] = "Icon size" ;
+ };
+ ListBox LB_ICONSIZE
+ {
+ Pos = MAP_APPFONT ( 12 , ROW_LB_ICONSIZESTYLE ) ;
+ Size = MAP_APPFONT ( 45 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Automatic" ; > ;
+ < "Small" ; > ;
+ < "Large" ; > ;
+ };
+ };
+ ListBox LB_ICONSTYLE
+ {
+ Pos = MAP_APPFONT ( 61 , ROW_LB_ICONSIZESTYLE ) ;
+ Size = MAP_APPFONT ( 65 , 70 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Automatic" ; > ;
+ < "Galaxy (default)" ; > ;
+ < "High Contrast" ; > ;
+ < "Industrial" ; > ;
+ < "Crystal" ; > ;
+ < "Tango" ; > ;
+ < "Classic" ; > ;
+ };
+ };
+ CheckBox CB_SYSTEM_FONT
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( 12, ROW_CB_SYSTEM_FONT );
+ Size = MAP_APPFONT( 114, 16 );
+ WordBreak = TRUE;
+ Text[ en-US ] = "Use system ~font for user interface";
+ };
+
+ CheckBox CB_FONTANTIALIASING
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , ROW_CB_FONTANTIALIASING ) ;
+ Size = MAP_APPFONT ( 110 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Screen font antialiasing" ;
+ };
+ FixedText FT_POINTLIMIT_LABEL
+ {
+ Pos = MAP_APPFONT ( 23 , OFFS_TEXTBOX_FIXEDTEXT( ROW_NF_AA_POINTLIMIT ) ) ;
+ Size = MAP_APPFONT ( 20 , 8 ) ;
+ Text [ en-US ] = "from";
+ };
+ NumericField NF_AA_POINTLIMIT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 46, ROW_NF_AA_POINTLIMIT ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Minimum = 1;
+ Maximum = 10000;
+ SpinSize = 1;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
+ FixedText FT_POINTLIMIT_UNIT
+ {
+ Pos = MAP_APPFONT ( 79 , OFFS_TEXTBOX_FIXEDTEXT( ROW_NF_AA_POINTLIMIT ) ) ;
+ Size = MAP_APPFONT ( 47 , 8 ) ;
+ Text [ en-US ] = "Pixels";
+ };
+ FixedLine FL_MENU
+ {
+ Pos = MAP_APPFONT ( 6, ROW_FL_MENU ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Menu" ;
+ };
+ FixedText FT_MENU_ICONS
+ {
+ Pos = MAP_APPFONT ( 12 , ROW_FT_MENU_ICONS ) ;
+ Size = MAP_APPFONT ( 114 , 8 ) ;
+ Text [ en-US ] = "Icons in menus" ;
+ };
+ ListBox LB_MENU_ICONS
+ {
+ Pos = MAP_APPFONT ( 12 , ROW_LB_MENU_ICONS ) ;
+ Size = MAP_APPFONT ( 114 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Automatic" ; > ;
+ < "Hide" ; > ;
+ < "Show" ; > ;
+ };
+ };
+ FixedLine FL_FONTLISTS
+ {
+ Pos = MAP_APPFONT ( 6, ROW_FL_FONTLISTS ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Font Lists" ;
+ };
+ CheckBox CB_FONT_SHOW
+ {
+ Pos = MAP_APPFONT ( 12, ROW_CB_FONT_SHOW ) ;
+ Size = MAP_APPFONT ( 118 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Show p~review of fonts" ;
+ };
+ CheckBox CB_FONT_HISTORY
+ {
+ Pos = MAP_APPFONT ( 12, ROW_CB_FONT_HISTORY ) ;
+ Size = MAP_APPFONT ( 118 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Show font h~istory" ;
+ };
+ FixedLine FL_RENDERING
+ {
+ Pos = MAP_APPFONT ( 133 , ROW_FL_RENDERING ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Graphics output";
+ };
+
+ CheckBox CB_USE_HARDACCELL
+ {
+ Pos = MAP_APPFONT ( 139, ROW_CB_USE_HARDACCELL ) ;
+ Size = MAP_APPFONT ( 118 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Use hardware acceleration" ;
+ };
+
+ CheckBox CB_USE_ANTIALIASE
+ {
+ Pos = MAP_APPFONT ( 139, ROW_CB_USE_ANTIALIASE ) ;
+ Size = MAP_APPFONT ( 118 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Use Anti-Aliasing" ;
+ };
+
+ FixedLine FL_MOUSE
+ {
+ Pos = MAP_APPFONT ( 133 , ROW_FL_MOUSE ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Mouse";
+ };
+ FixedText FT_MOUSEPOS
+ {
+ Pos = MAP_APPFONT ( 139, ROW_FT_MOUSEPOS ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Mouse positioning" ;
+ };
+ ListBox LB_MOUSEPOS
+ {
+ Pos = MAP_APPFONT ( 139, ROW_LB_MOUSEPOS ) ;
+ Size = MAP_APPFONT ( 114 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Default button" ; > ;
+ < "Dialog center" ; > ;
+ < "No automatic positioning" ; > ;
+ };
+ };
+ FixedText FT_MOUSEMIDDLE
+ {
+ Pos = MAP_APPFONT ( 139, ROW_FT_MOUSEMIDDLE ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Middle mouse button";
+ };
+ ListBox LB_MOUSEMIDDLE
+ {
+ Pos = MAP_APPFONT ( 139, ROW_LB_MOUSEMIDDLE ) ;
+ Size = MAP_APPFONT ( 114 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "No function" ; > ;
+ < "Automatic scrolling" ; > ;
+ < "Paste clipboard" ; > ;
+ };
+ };
+
+ // #i97672#
+ FixedLine FL_SELECTION
+ {
+ Pos = MAP_APPFONT ( 133 , ROW_FL_SELECTION ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Selection";
+ };
+
+ CheckBox CB_SELECTION
+ {
+ Pos = MAP_APPFONT ( 139, ROW_CB_SELECTION + (((12 - RSC_CD_CHECKBOX_HEIGHT) / 2) + 1)) ;
+ Size = MAP_APPFONT ( 118 - 34 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Transparency" ;
+ };
+
+ MetricField MF_SELECTION
+ {
+ Pos = MAP_APPFONT ( 139 + (95 - 12), ROW_CB_SELECTION ) ;
+ Size = MAP_APPFONT ( 31 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 10 ;
+ Maximum = 90 ;
+ DecimalDigits = 0 ;
+ First = 10 ;
+ Last = 90 ;
+ SpinSize = 5 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = "%" ;
+ };
+};
+// *******************************************************************
+
+TabPage OFA_TP_LANGUAGES
+{
+ HelpID = HID_OFA_TP_LANGUAGES ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_UI_LANG
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Language of";
+ };
+ FixedImage FI_USERINTERFACE
+ {
+ Pos = MAP_APPFONT ( 5 , 17 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_USERINTERFACE
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "~User interface";
+ };
+ ListBox LB_USERINTERFACE
+ {
+ Pos = MAP_APPFONT ( 123 , 14 ) ;
+ Size = MAP_APPFONT ( 125 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE;
+ };
+ FixedImage FI_LOCALESETTING
+ {
+ Pos = MAP_APPFONT ( 5 , 32 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_LOCALESETTING
+ {
+ Pos = MAP_APPFONT ( 12 , 31 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "Locale setting";
+ };
+ ListBox LB_LOCALESETTING
+ {
+ Pos = MAP_APPFONT ( 123 , 30 ) ;
+ Size = MAP_APPFONT ( 125 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE;
+ };
+ FixedText FT_DECIMALSEPARATOR
+ {
+ Pos = MAP_APPFONT ( 12 , 46 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "Decimal separator key";
+ };
+ CheckBox CB_DECIMALSEPARATOR
+ {
+ Pos = MAP_APPFONT ( 123 , 46) ;
+ Size = MAP_APPFONT ( 125 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "~Same as locale setting ( %1 )";
+ };
+ FixedImage FI_CURRENCY
+ {
+ Pos = MAP_APPFONT ( 5 , 63 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_CURRENCY
+ {
+ Pos = MAP_APPFONT ( 12 , 61 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "~Default currency";
+ };
+ ListBox LB_CURRENCY
+ {
+ Pos = MAP_APPFONT ( 123 , 59 ) ;
+ Size = MAP_APPFONT ( 125 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE;
+ };
+ FixedLine FL_LINGU_LANG
+ {
+ Pos = MAP_APPFONT ( 6 , 77 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Default languages for documents";
+ };
+ FixedImage FI_WEST_LANG
+ {
+ Pos = MAP_APPFONT ( 5 , 92 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_WEST_LANG
+ {
+ Pos = MAP_APPFONT ( 12 , 90 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "Western";
+ };
+
+ ListBox LB_WEST_LANG
+ {
+ Pos = MAP_APPFONT ( 123 , 88 ) ;
+ Size = MAP_APPFONT ( 125 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE;
+ };
+ FixedImage FI_ASIAN_LANG
+ {
+ Pos = MAP_APPFONT ( 5 , 108 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_ASIAN_LANG
+ {
+ Pos = MAP_APPFONT ( 12 , 106 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "Asian";
+ };
+ ListBox LB_ASIAN_LANG
+ {
+ Pos = MAP_APPFONT ( 123 , 104 ) ;
+ Size = MAP_APPFONT ( 125 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE;
+ };
+ FixedImage FI_COMPLEX_LANG
+ {
+ Pos = MAP_APPFONT ( 5 , 124 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_COMPLEX_LANG
+ {
+ Pos = MAP_APPFONT ( 12 , 122 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "C~TL";
+ };
+ ListBox LB_COMPLEX_LANG
+ {
+ Pos = MAP_APPFONT ( 123 , 120 ) ;
+ Size = MAP_APPFONT ( 125 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE;
+ };
+ CheckBox CB_CURRENT_DOC
+ {
+ Pos = MAP_APPFONT ( 123 , 135 ) ;
+ Size = MAP_APPFONT ( 125 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "For the current document only";
+ };
+ FixedLine FL_ENHANCED
+ {
+ Pos = MAP_APPFONT ( 6 , 145 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Enhanced language support";
+ };
+ FixedImage FI_ASIANSUPPORT
+ {
+ Pos = MAP_APPFONT ( 5 , 160 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ CheckBox CB_ASIANSUPPORT
+ {
+ Pos = MAP_APPFONT ( 12 , 158 ) ;
+ Size = MAP_APPFONT ( 236 ,RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "E~nabled for Asian languages";
+ };
+ FixedImage FI_CTLSUPPORT
+ {
+ Pos = MAP_APPFONT ( 5 , 175 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ CheckBox CB_CTLSUPPORT
+ {
+ Pos = MAP_APPFONT ( 12 , 173 ) ;
+ Size = MAP_APPFONT ( 236 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Ena~bled for complex text layout (CTL)";
+ };
+};
+
+InfoBox RID_SVX_MSGBOX_LANGUAGE_RESTART
+{
+ Message [ en-US ] = "The language setting of the user interface has been updated and will take effect the next time you start %PRODUCTNAME %PRODUCTVERSION";
+};
+
+
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
new file mode 100644
index 000000000000..8812ed0efc2e
--- /dev/null
+++ b/cui/source/options/optgenrl.cxx
@@ -0,0 +1,583 @@
+/*************************************************************************
+ *
+ * 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: optgenrl.cxx,v $
+ * $Revision: 1.14 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/saveopt.hxx>
+
+#define _SVX_OPTGENRL_CXX
+
+#include <svx/dialogs.hrc>
+#include "optgenrl.hrc"
+#include <unotools/useroptions.hxx>
+#include "cuioptgenrl.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/strarray.hxx>
+
+#define TRIM(s) s.EraseLeadingChars().EraseTrailingChars()
+
+// struct GeneralTabPage_Impl --------------------------------------------
+
+struct GeneralTabPage_Impl
+{
+ BOOL mbStreetEnabled;
+ BOOL mbPLZEnabled;
+ BOOL mbCityEnabled;
+ BOOL mbUsCityEnabled;
+ BOOL mbUsZipEnabled;
+
+ String maQueryStr;
+
+ GeneralTabPage_Impl() :
+ mbStreetEnabled ( FALSE ),
+ mbPLZEnabled ( FALSE ),
+ mbCityEnabled ( FALSE ),
+ mbUsCityEnabled ( FALSE ),
+ mbUsZipEnabled ( FALSE ) {}
+};
+
+// -----------------------------------------------------------------------
+
+// kommt aus adritem.cxx
+//CHINA001 extern String ConvertToStore_Impl( const String& );
+//copy from adritem.cxx, since it will leave in svx.
+String ConvertToStore_Impl( const String& rText )
+{
+ String sRet;
+ USHORT i = 0;
+
+ while ( i < rText.Len() )
+ {
+ if ( rText.GetChar(i) == '\\' || rText.GetChar(i) == '#' )
+ sRet += '\\';
+ sRet += rText.GetChar(i++);
+ }
+ return sRet;
+}
+
+
+// -----------------------------------------------------------------------
+
+SvxGeneralTabPage::SvxGeneralTabPage( Window* pParent, const SfxItemSet& rCoreSet ) :
+
+ SfxTabPage( pParent, SVX_RES(RID_SFXPAGE_GENERAL), rCoreSet ),
+
+ aCompanyLbl ( this, SVX_RES( FT_COMPANY ), true ),
+ aCompanyEdit ( this, SVX_RES( ED_COMPANY ), INDEX_NOTSET, &aCompanyLbl ),
+ aNameLbl ( this, SVX_RES( FT_NAME ), true ),
+ aNameLblRuss ( this, SVX_RES( FT_NAME_RUSS ), true ),
+ aNameLblEastern ( this, SVX_RES( FT_NAME_EASTERN ), true ),
+ aFirstName ( this, SVX_RES( ED_FIRSTNAME ), 0, &aNameLbl ),
+ aFatherName ( this, SVX_RES( ED_FATHERNAME ) ),
+ aName ( this, SVX_RES( ED_NAME ), 1, &aNameLbl ),
+ aShortName ( this, SVX_RES( ED_SHORTNAME ), 2, &aNameLbl ),
+ aStreetLbl ( this, SVX_RES( FT_STREET ), true ),
+ aStreetLblRuss ( this, SVX_RES( FT_STREET_RUSS ), true ),
+ aStreetEdit ( this, SVX_RES( ED_STREET ), 0, &aStreetLbl ),
+ aApartmentNrEdit( this, SVX_RES( ED_APARTMENTNR ), 1, &aStreetLblRuss ),
+ aCityLbl ( this, SVX_RES( FT_CITY ), true ),
+ aPLZEdit ( this, SVX_RES( ED_PLZ ), 0, &aCityLbl ),
+ aCityEdit ( this, SVX_RES( ED_CITY ), 1, &aCityLbl ),
+ aUsCityEdit ( this, SVX_RES( ED_US_CITY ), 0, &aCityLbl ),
+ aUsStateEdit ( this, SVX_RES( ED_US_STATE ), 1, &aCityLbl ),
+ aUsZipEdit ( this, SVX_RES( ED_US_ZIPCODE ), 2, &aCityLbl ),
+ aCountryLbl ( this, SVX_RES( FT_COUNTRY ), true ),
+ aCountryEdit ( this, SVX_RES( ED_COUNTRY ), INDEX_NOTSET, &aCountryLbl ),
+ aTitlePosLbl ( this, SVX_RES( FT_TITLEPOS ), true ),
+ aTitleEdit ( this, SVX_RES( ED_TITLE ), 0, &aTitlePosLbl ),
+ aPositionEdit ( this, SVX_RES( ED_POSITION ), 1, &aTitlePosLbl ),
+ aPhoneLbl ( this, SVX_RES( FT_PHONE ), true ),
+ aTelPrivEdit ( this, SVX_RES( ED_TELPRIVAT ), 0, &aPhoneLbl ),
+ aTelCompanyEdit ( this, SVX_RES( ED_TELCOMPANY ), 1, &aPhoneLbl ),
+ aFaxMailLbl ( this, SVX_RES( FT_FAXMAIL ), true ),
+ aFaxEdit ( this, SVX_RES( ED_FAX ), 0, &aFaxMailLbl ),
+ aEmailEdit ( this, SVX_RES( ED_EMAIL ), 1, &aFaxMailLbl ),
+ aAddrFrm ( this, SVX_RES( GB_ADDRESS ) ),
+ aUseDataCB ( this, SVX_RES( CB_USEDATA ) ),
+
+ pImpl ( new GeneralTabPage_Impl )
+
+{
+ LanguageType eLang = Application::GetSettings().GetUILanguage();
+ pImpl->maQueryStr = String( SVX_RES( STR_QUERY_REG ) );
+
+ if ( LANGUAGE_ENGLISH_US == eLang )
+ {
+ // amerikanische Postadresse aufbauen
+ aPLZEdit.Hide();
+ aCityEdit.Hide();
+ aCityLbl.SetText( SVX_RES( STR_US_STATE ) );
+ }
+ else if ( LANGUAGE_RUSSIAN == eLang )
+ {
+ aUsCityEdit.Hide();
+ aUsStateEdit.Hide();
+ aUsZipEdit.Hide();
+ aNameLbl.Hide();
+ aNameLblRuss.Show();
+ aStreetLbl.Hide();
+ aStreetLblRuss.Show();
+ aFatherName.Show();
+ aName.SetIndex( 0 );
+ aName.SetLabel( &aNameLblRuss );
+ aFirstName.SetIndex( 1 );
+ aFirstName.SetLabel( &aNameLblRuss );
+ aFatherName.SetIndex( 2 );
+ aFatherName.SetLabel( &aNameLblRuss );
+ aShortName.SetIndex( 3 );
+ aShortName.SetLabel( &aNameLblRuss );
+
+ Point aEditPoint = LogicToPixel( Point( MID, LINE(1) ), MAP_APPFONT );
+ Point aRightPoint = LogicToPixel( Point( RIGHT, LINE(1) ), MAP_APPFONT );
+ Size aEditSize = LogicToPixel( Size( 42, 12 ), MAP_APPFONT );
+ Size a2Size = LogicToPixel( Size( 2, 2 ), MAP_APPFONT );
+ long nDelta = aEditSize.Width() + a2Size.Width();
+ aName.SetPosSizePixel( aEditPoint, aEditSize );
+ aEditPoint.X() = aEditPoint.X() + nDelta;
+ aFirstName.SetPosSizePixel( aEditPoint, aEditSize );
+ aEditPoint.X() = aEditPoint.X() + nDelta;
+ aFatherName.SetPosSizePixel( aEditPoint, aEditSize );
+ aEditPoint.X() = aEditPoint.X() + nDelta;
+ aEditSize.Width() = aRightPoint.X() - aEditPoint.X();
+ aShortName.SetPosSizePixel( aEditPoint, aEditSize );
+
+ Size aStreetSize = aStreetEdit.GetSizePixel();
+ aStreetSize.Width() = aStreetSize.Width() - aEditSize.Width() - a2Size.Width();
+ aStreetEdit.SetSizePixel( aStreetSize );
+ aApartmentNrEdit.Show();
+ Point aApartmentPoint = LogicToPixel( Point( MID, LINE(2) ), MAP_APPFONT );
+ aApartmentPoint.X() = aEditPoint.X();
+ aApartmentNrEdit.SetPosSizePixel( aApartmentPoint, aEditSize );
+
+ aName.SetZOrder( &aNameLblRuss, WINDOW_ZORDER_BEHIND );
+ aFirstName.SetZOrder( &aName, WINDOW_ZORDER_BEHIND );
+ aFatherName.SetZOrder( &aFirstName, WINDOW_ZORDER_BEHIND );
+ }
+ else if ( LANGUAGE_JAPANESE == eLang ||
+ LANGUAGE_KOREAN == eLang ||
+ LANGUAGE_CHINESE_TRADITIONAL == eLang ||
+ LANGUAGE_CHINESE_SIMPLIFIED == eLang)
+ {
+ aUsCityEdit.Hide();
+ aUsStateEdit.Hide();
+ aUsZipEdit.Hide();
+ aNameLbl.Hide();
+ aNameLblEastern.Show();
+
+ // swap "first name" field and "last name" field
+ Point aPosTmp = aFirstName.GetPosPixel();
+ aFirstName.SetPosPixel( aName.GetPosPixel() );
+ aName.SetPosPixel( aPosTmp );
+ aFirstName.SetZOrder( &aName, WINDOW_ZORDER_BEHIND );
+ }
+ else
+ {
+ aUsCityEdit.Hide();
+ aUsStateEdit.Hide();
+ aUsZipEdit.Hide();
+ }
+
+ FreeResource();
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ Link aLink = LINK( this, SvxGeneralTabPage, ModifyHdl_Impl );
+ aFirstName.SetModifyHdl( aLink );
+ aName.SetModifyHdl( aLink );
+
+ // because some labels have text for more than one edit field we have to split these texts
+ // and set these texts as accessible name of the corresponding edit fields
+ SvxUserEdit* pEdits[] =
+ {
+ &aCompanyEdit, &aFirstName, &aFatherName, &aName, &aShortName, &aStreetEdit,
+ &aApartmentNrEdit, &aPLZEdit, &aCityEdit, &aUsCityEdit, &aUsStateEdit, &aUsZipEdit,
+ &aCountryEdit, &aTitleEdit, &aPositionEdit, &aTelPrivEdit, &aTelCompanyEdit,
+ &aFaxEdit, &aEmailEdit, NULL
+ };
+ SvxUserEdit** pCurrent = pEdits;
+ while ( *pCurrent )
+ {
+ Window* pLabel = (*pCurrent)->GetLabel();
+ if ( pLabel )
+ {
+ String sName, sText = pLabel->GetDisplayText();
+ sal_Int16 nIndex = (*pCurrent)->GetIndex();
+ if ( INDEX_NOTSET == nIndex )
+ sName = sText;
+ else
+ sName = sText.GetToken( nIndex, '/' );
+ sName.EraseAllChars( '(' );
+ sName.EraseAllChars( ')' );
+ if ( sName.Len() > 0 )
+ (*pCurrent)->SetAccessibleName( sName );
+ }
+ pCurrent++;
+ }
+}
+
+//------------------------------------------------------------------------
+
+SvxGeneralTabPage::~SvxGeneralTabPage()
+{
+ delete pImpl;
+}
+
+//------------------------------------------------------------------------
+
+SfxTabPage* SvxGeneralTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return ( new SvxGeneralTabPage( pParent, rAttrSet ) );
+}
+
+//------------------------------------------------------------------------
+
+BOOL SvxGeneralTabPage::FillItemSet( SfxItemSet& )
+{
+ // Eingaben trimmen (f"uhrende und nachfolgende Leerzeichen entfernen)
+ aCompanyEdit.SetText( TRIM(aCompanyEdit.GetText()) );
+ aFirstName.SetText( TRIM(aFirstName.GetText()) );
+ aName.SetText( TRIM(aName.GetText()) );
+ aShortName.SetText( TRIM(aShortName.GetText()) );
+ aStreetEdit.SetText( TRIM(aStreetEdit.GetText()) );
+ aCountryEdit.SetText( TRIM(aCountryEdit.GetText()) );
+ aPLZEdit.SetText( TRIM(aPLZEdit.GetText()) );
+ aCityEdit.SetText( TRIM(aCityEdit.GetText()) );
+ aUsCityEdit.SetText( TRIM(aUsCityEdit.GetText()) );
+ aUsStateEdit.SetText( TRIM(aUsStateEdit.GetText()) );
+ aUsZipEdit.SetText( TRIM(aUsZipEdit.GetText()) );
+ aTitleEdit.SetText( TRIM(aTitleEdit.GetText()) );
+ aPositionEdit.SetText( TRIM(aPositionEdit.GetText()) );
+ aTelPrivEdit.SetText( TRIM(aTelPrivEdit.GetText()) );
+ aTelCompanyEdit.SetText( TRIM(aTelCompanyEdit.GetText()) );
+ aFaxEdit.SetText( TRIM(aFaxEdit.GetText()) );
+ aEmailEdit.SetText( TRIM(aEmailEdit.GetText()) );
+
+ BOOL bModified = FALSE;
+ bModified |= GetAddress_Impl();
+ SvtSaveOptions aSaveOpt;
+ if ( aUseDataCB.IsChecked() != aSaveOpt.IsUseUserData() )
+ {
+ aSaveOpt.SetUseUserData( aUseDataCB.IsChecked() );
+ bModified |= TRUE;
+ }
+ return bModified;
+}
+
+//------------------------------------------------------------------------
+
+void SvxGeneralTabPage::Reset( const SfxItemSet& rSet )
+{
+ SetAddress_Impl();
+
+ USHORT nWhich = GetWhich( SID_FIELD_GRABFOCUS );
+ if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ USHORT nField = ( (SfxUInt16Item&)rSet.Get( nWhich ) ).GetValue();
+
+ switch ( nField )
+ {
+ case COMPANY_EDIT: aCompanyEdit.GrabFocus(); break;
+ case FIRSTNAME_EDIT: aFirstName.GrabFocus(); break;
+ case LASTNAME_EDIT: aName.GrabFocus(); break;
+ case STREET_EDIT: aStreetEdit.GrabFocus(); break;
+ case COUNTRY_EDIT: aCountryEdit.GrabFocus(); break;
+ case PLZ_EDIT:
+ if ( aPLZEdit.IsVisible() )
+ aPLZEdit.GrabFocus();
+ else
+ aUsZipEdit.GrabFocus();
+ break;
+ case CITY_EDIT:
+ if ( aCityEdit.IsVisible() )
+ aCityEdit.GrabFocus();
+ else
+ aUsCityEdit.GrabFocus();
+ break;
+ case STATE_EDIT:
+ if ( aUsStateEdit.IsVisible() )
+ aUsStateEdit.GrabFocus();
+ else
+ aCityEdit.GrabFocus();
+ break;
+ case TITLE_EDIT: aTitleEdit.GrabFocus(); break;
+ case POSITION_EDIT: aPositionEdit.GrabFocus(); break;
+ case SHORTNAME_EDIT: aShortName.GrabFocus(); break;
+ case TELPRIV_EDIT: aTelPrivEdit.GrabFocus(); break;
+ case TELCOMPANY_EDIT: aTelCompanyEdit.GrabFocus(); break;
+ case FAX_EDIT: aFaxEdit.GrabFocus(); break;
+ case EMAIL_EDIT: aEmailEdit.GrabFocus(); break;
+ default: aCompanyEdit.GrabFocus();
+ }
+ }
+
+ aUseDataCB.Check( SvtSaveOptions().IsUseUserData() );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGeneralTabPage, ModifyHdl_Impl, Edit *, pEdit )
+{
+ if ( aShortName.IsEnabled() )
+ {
+ String aShortStr( aShortName.GetText() );
+ switch ( aShortStr.Len() )
+ {
+ case 0:
+ aShortStr = String( RTL_CONSTASCII_STRINGPARAM(" ") );
+ break;
+
+ case 1:
+ aShortStr += ' ';
+ break;
+ }
+
+ USHORT nPos = ( pEdit == &aFirstName ) ? 0 : 1;
+ String aTxt = pEdit->GetText();
+ sal_Unicode cChar = ( aTxt.Len() > 0 ) ? aTxt.GetChar(0) : ' ';
+ aShortStr.SetChar( nPos, cChar );
+ aShortStr.EraseTrailingChars();
+ aShortName.SetText( aShortStr );
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxGeneralTabPage::GetAddress_Impl()
+{
+ BOOL bRet =
+ ( aCompanyEdit.GetSavedValue() != aCompanyEdit.GetText() ||
+ aFirstName.GetSavedValue() != aFirstName.GetText() ||
+ aFatherName.GetSavedValue() != aFatherName.GetText() ||
+ aName.GetSavedValue() != aName.GetText() ||
+ aShortName.GetSavedValue() != aShortName.GetText() ||
+ aStreetEdit.GetSavedValue() != aStreetEdit.GetText() ||
+ aApartmentNrEdit.GetSavedValue() != aApartmentNrEdit.GetText() ||
+ aPLZEdit.GetSavedValue() != aPLZEdit.GetText() ||
+ aCityEdit.GetSavedValue() != aCityEdit.GetText() ||
+ aUsCityEdit.GetSavedValue() != aUsCityEdit.GetText() ||
+ aUsStateEdit.GetSavedValue() != aUsStateEdit.GetText() ||
+ aUsZipEdit.GetSavedValue() != aUsZipEdit.GetText() ||
+ aCountryEdit.GetSavedValue() != aCountryEdit.GetText() ||
+ aTitleEdit.GetSavedValue() != aTitleEdit.GetText() ||
+ aPositionEdit.GetSavedValue() != aPositionEdit.GetText() ||
+ aTelPrivEdit.GetSavedValue() != aTelPrivEdit.GetText() ||
+ aTelCompanyEdit.GetSavedValue() != aTelCompanyEdit.GetText() ||
+ aFaxEdit.GetSavedValue() != aFaxEdit.GetText() ||
+ aEmailEdit.GetSavedValue() != aEmailEdit.GetText() );
+
+ LanguageType eLang = Application::GetSettings().GetUILanguage();
+ BOOL bUS = ( LANGUAGE_ENGLISH_US == eLang );
+
+ SvtUserOptions aUserOpt;
+ aUserOpt.SetCompany(aCompanyEdit.GetText());
+ aUserOpt.SetFirstName(aFirstName.GetText());
+ aUserOpt.SetLastName(aName.GetText());
+ aUserOpt.SetID( aShortName.GetText());
+
+ aUserOpt.SetStreet(aStreetEdit.GetText() );
+
+ aUserOpt.SetCountry(aCountryEdit.GetText() );
+
+ aUserOpt.SetZip(bUS ? aUsZipEdit.GetText() : aPLZEdit.GetText() );
+ aUserOpt.SetCity(bUS ? aUsCityEdit.GetText() : aCityEdit.GetText() );
+
+ aUserOpt.SetTitle( aTitleEdit.GetText() );
+ aUserOpt.SetPosition(aPositionEdit.GetText() );
+ aUserOpt.SetTelephoneHome( aTelPrivEdit.GetText() );
+ aUserOpt.SetTelephoneWork( aTelCompanyEdit.GetText() );
+ aUserOpt.SetFax( aFaxEdit.GetText() );
+ aUserOpt.SetEmail( aEmailEdit.GetText() );
+ aUserOpt.SetState( bUS ? aUsStateEdit.GetText() : String() );
+
+ if ( LANGUAGE_RUSSIAN == eLang )
+ {
+ aUserOpt.SetFathersName( aFatherName.GetText() );
+ aUserOpt.SetApartment( aApartmentNrEdit.GetText() );
+ }
+ return bRet;
+}
+
+//------------------------------------------------------------------------
+
+void SvxGeneralTabPage::SetAddress_Impl()
+{
+ LanguageType eLang = Application::GetSettings().GetUILanguage();
+ BOOL bUS = ( LANGUAGE_ENGLISH_US == eLang );
+ SvtUserOptions aUserOpt;
+ aCompanyEdit.SetText( aUserOpt.GetCompany() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_COMPANY ) )
+ {
+ aCompanyLbl.Disable();
+ aCompanyEdit.Disable();
+ }
+ sal_Int16 nEditCount = 0;
+ aFirstName.SetText( aUserOpt.GetFirstName() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_FIRSTNAME ) )
+ {
+ aFirstName.Disable();
+ nEditCount++;
+ }
+ aName.SetText( aUserOpt.GetLastName() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_LASTNAME ) )
+ {
+ aName.Disable();
+ nEditCount++;
+ }
+ aShortName.SetText( aUserOpt.GetID() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_ID ) )
+ {
+ aShortName.Disable();
+ nEditCount++;
+ }
+ aNameLbl.Enable( ( nEditCount != 3 ) );
+ aStreetEdit.SetText( aUserOpt.GetStreet() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_STREET ) )
+ {
+ aStreetLbl.Disable();
+ aStreetEdit.Disable();
+ }
+ Edit* pPLZEdit = bUS ? &aUsZipEdit : &aPLZEdit;
+ Edit* pCityEdit = bUS ? &aUsCityEdit : &aCityEdit;
+ pPLZEdit->SetText( aUserOpt.GetZip() );
+ pCityEdit->SetText( aUserOpt.GetCity() );
+ nEditCount = 0;
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_ZIP ) )
+ {
+ pPLZEdit->Disable();
+ nEditCount++;
+ }
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_CITY ) )
+ {
+ pCityEdit->Disable();
+ nEditCount++;
+ }
+ if ( bUS )
+ {
+ aUsStateEdit.SetText( aUserOpt.GetState() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_STATE ) )
+ {
+ aUsStateEdit.Disable();
+ nEditCount++;
+ }
+ }
+ aCityLbl.Enable( ( nEditCount != ( bUS ? 3 : 2 ) ) );
+ aCountryEdit.SetText( aUserOpt.GetCountry() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_COUNTRY ) )
+ {
+ aCountryLbl.Disable();
+ aCountryEdit.Disable();
+ }
+ aTitleEdit.SetText( aUserOpt.GetTitle() );
+ aPositionEdit.SetText( aUserOpt.GetPosition() );
+ nEditCount = 0;
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_TITLE ) )
+ {
+ aTitleEdit.Disable();
+ nEditCount++;
+ }
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_POSITION ) )
+ {
+ aPositionEdit.Disable();
+ nEditCount++;
+ }
+ aTitlePosLbl.Enable( ( nEditCount != 2 ) );
+ aTelPrivEdit.SetText( aUserOpt.GetTelephoneHome() );
+ aTelCompanyEdit.SetText( aUserOpt.GetTelephoneWork() );
+ nEditCount = 0;
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_TELEPHONEHOME ) )
+ {
+ aTelPrivEdit.Disable();
+ nEditCount++;
+ }
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_TELEPHONEWORK ) )
+ {
+ aTelCompanyEdit.Disable();
+ nEditCount++;
+ }
+ aPhoneLbl.Enable( ( nEditCount != 2 ) );
+ aFaxEdit.SetText( aUserOpt.GetFax() );
+ aEmailEdit.SetText( aUserOpt.GetEmail() );
+ nEditCount = 0;
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_FAX ) )
+ {
+ aFaxEdit.Disable();
+ nEditCount++;
+ }
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_EMAIL ) )
+ {
+ aEmailEdit.Disable();
+ nEditCount++;
+ }
+ aFaxMailLbl.Enable( ( nEditCount != 2 ) );
+
+ if ( LANGUAGE_RUSSIAN == eLang )
+ {
+ aFatherName.SetText( aUserOpt.GetFathersName() );
+ aApartmentNrEdit.SetText( aUserOpt.GetApartment() );
+ }
+
+ aCompanyEdit.SaveValue();
+ aFirstName.SaveValue();
+ aFatherName.SaveValue();
+ aName.SaveValue();
+ aShortName.SaveValue();
+ aStreetEdit.SaveValue();
+ aApartmentNrEdit.SaveValue();
+ aPLZEdit.SaveValue();
+ aCityEdit.SaveValue();
+ aUsCityEdit.SaveValue();
+ aUsStateEdit.SaveValue();
+ aUsZipEdit.SaveValue();
+ aCountryEdit.SaveValue();
+ aTitleEdit.SaveValue();
+ aPositionEdit.SaveValue();
+ aTelPrivEdit.SaveValue();
+ aTelCompanyEdit.SaveValue();
+ aFaxEdit.SaveValue();
+ aEmailEdit.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+int SvxGeneralTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
diff --git a/cui/source/options/optgenrl.hrc b/cui/source/options/optgenrl.hrc
new file mode 100644
index 000000000000..4c519d5ebb70
--- /dev/null
+++ b/cui/source/options/optgenrl.hrc
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * 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: optgenrl.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTGENRL_HRC
+#define _SVX_OPTGENRL_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FT_COMPANY 10
+#define ED_COMPANY 11
+#define FT_NAME 12
+#define FT_NAME_RUSS 13
+#define ED_FATHERNAME 14
+#define ED_FIRSTNAME 15
+#define ED_NAME 16
+#define ED_SHORTNAME 17
+#define FT_STREET 18
+#define FT_STREET_RUSS 19
+#define ED_STREET 20
+#define ED_APARTMENTNR 21
+#define FT_CITY 22
+#define ED_PLZ 23
+#define ED_CITY 24
+#define ED_US_CITY 25
+#define ED_US_STATE 26
+#define ED_US_ZIPCODE 27
+#define FT_COUNTRY 28
+#define ED_COUNTRY 29
+#define FT_TITLEPOS 30
+#define ED_TITLE 31
+#define ED_POSITION 32
+#define FT_PHONE 33
+#define ED_TELPRIVAT 34
+#define ED_TELCOMPANY 35
+#define FT_FAXMAIL 36
+#define ED_FAX 37
+#define ED_EMAIL 38
+#define GB_ADDRESS 39
+#define CB_USEDATA 40
+#define FT_NAME_EASTERN 41
+
+#define STR_US_STATE 10
+#define STR_QUERY_REG 11
+
+// Positionierungshilfen f"ur den Dialog
+
+#define HSPACE 2
+#define VSPACE 3
+#define LINEH 12
+#define FLINEH 8
+#define LEFT 12
+#define MID 100
+#define RIGHT 248
+#define TOP 10
+#define LINE(y) (14+y*15)
+#define FLINE(y) (16+y*15)
+#define NAMELEN 74
+
+#endif // #ifndef _SVX_OPTGENRL_HRC
+
+// ******************************************************************* EOF
+
diff --git a/cui/source/options/optgenrl.src b/cui/source/options/optgenrl.src
new file mode 100644
index 000000000000..cff6f8d4216c
--- /dev/null
+++ b/cui/source/options/optgenrl.src
@@ -0,0 +1,333 @@
+/*************************************************************************
+ *
+ * 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: optgenrl.src,v $
+ * $Revision: 1.57 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <sfx2/sfx.hrc>
+
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include "optgenrl.hrc"
+
+// RID_SFXPAGE_GENERAL ------------------------------------------------------
+
+TabPage RID_SFXPAGE_GENERAL
+{
+ HelpId = HID_OPTIONS_GENERAL ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "User Data" ;
+ FixedText FT_COMPANY
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 0 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Company" ;
+ };
+ Edit ED_COMPANY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 0 ) ) ;
+ Size = MAP_APPFONT ( RIGHT-MID , LINEH ) ;
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "First/Last ~name/Initials" ;
+ };
+ FixedText FT_NAME_RUSS
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Hide = TRUE;
+ Text [ en-US ] = "Last Name/First name/Father's name/Initials";
+ };
+ FixedText FT_NAME_EASTERN
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Hide = TRUE;
+ Text [ en-US ] = "Last/First ~name/Initials" ;
+ };
+ Edit ED_FATHERNAME
+ {
+ Border = TRUE ;
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( MID , LINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( NAMELEN-8 , LINEH ) ;
+ };
+ Edit ED_FIRSTNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( NAMELEN-8 , LINEH ) ;
+ };
+ Edit ED_NAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID+NAMELEN-8+HSPACE , LINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( NAMELEN-8 , LINEH ) ;
+ };
+ Edit ED_SHORTNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID+2* ( NAMELEN-8+HSPACE ) , LINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( RIGHT- ( MID+2* ( NAMELEN-8+HSPACE ) ) , LINEH ) ;
+ };
+ FixedText FT_STREET
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 2 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Street" ;
+ };
+ FixedText FT_STREET_RUSS
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 2 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Hide = TRUE;
+ Text [ en-US ] = "Street/Apartment number";
+ };
+ Edit ED_STREET
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 2 ) ) ;
+ Size = MAP_APPFONT ( RIGHT-MID , LINEH ) ;
+ };
+ Edit ED_APARTMENTNR
+ {
+ Border = TRUE ;
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( MID , LINE ( 2 ) ) ;
+ Size = MAP_APPFONT ( RIGHT-MID , LINEH ) ;
+ };
+ FixedText FT_CITY
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 3 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "Zip/City";
+ };
+ Edit ED_PLZ
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 3 ) ) ;
+ Size = MAP_APPFONT ( 24 , LINEH ) ;
+ };
+ Edit ED_CITY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID + 24 + HSPACE , LINE ( 3 ) ) ;
+ Size = MAP_APPFONT ( RIGHT - ( MID + 24 + HSPACE ) , LINEH ) ;
+ };
+ Edit ED_US_CITY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 3 ) ) ;
+ Size = MAP_APPFONT ( 90 , LINEH ) ;
+ };
+ Edit ED_US_STATE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID + 90 + HSPACE, LINE ( 3 ) ) ;
+ Size = MAP_APPFONT ( 30 , LINEH ) ;
+ };
+ Edit ED_US_ZIPCODE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID + 90 + HSPACE + 30 + HSPACE, LINE ( 3 ) ) ;
+ Size = MAP_APPFONT ( RIGHT - ( MID + 90 + HSPACE + 30 + HSPACE ) , LINEH ) ;
+ };
+ FixedText FT_COUNTRY
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 4 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "Country/Region";
+ };
+ Edit ED_COUNTRY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 4 ) ) ;
+ Size = MAP_APPFONT ( RIGHT - MID , LINEH ) ;
+ };
+ FixedText FT_TITLEPOS
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 5 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Title/Position" ;
+ };
+ Edit ED_TITLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 5 ) ) ;
+ Size = MAP_APPFONT ( NAMELEN-1 , LINEH ) ;
+ };
+ Edit ED_POSITION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID+NAMELEN-1+HSPACE , LINE ( 5 ) ) ;
+ Size = MAP_APPFONT ( RIGHT- ( MID+NAMELEN-1+HSPACE ) , LINEH ) ;
+ };
+ FixedText FT_PHONE
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 6 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ Text [ en-US ] = "Tel. (Home/Work)" ;
+ LeftLabel = TRUE ;
+ };
+ Edit ED_TELPRIVAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 6 ) ) ;
+ Size = MAP_APPFONT ( NAMELEN-1 , LINEH ) ;
+ };
+ Edit ED_TELCOMPANY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID+NAMELEN-1+HSPACE , LINE ( 6 ) ) ;
+ Size = MAP_APPFONT ( RIGHT- ( MID+NAMELEN-1+HSPACE ) , LINEH ) ;
+ };
+ FixedText FT_FAXMAIL
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 7 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "Fa~x / E-mail" ;
+ };
+ Edit ED_FAX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 7 ) ) ;
+ Size = MAP_APPFONT ( NAMELEN-1 , LINEH ) ;
+ };
+ Edit ED_EMAIL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID+NAMELEN-1+HSPACE , LINE ( 7 ) ) ;
+ Size = MAP_APPFONT ( RIGHT- ( MID+NAMELEN-1+HSPACE ) , LINEH ) ;
+ };
+ FixedLine GB_ADDRESS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Address " ;
+ };
+ CheckBox CB_USEDATA
+ {
+ Pos = MAP_APPFONT ( 6 , 122 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Use data for document properties";
+ };
+
+ // extra Resourcen f"ur die amerikanische Postadresse
+ String STR_US_STATE
+ {
+ Text [ en-US ] = "City/State/Zip";
+ };
+ String STR_QUERY_REG
+ {
+ Text [ en-US ] = "Note that street, Zip code and city are used to generate the registration key. You will not be able to change the user data again until the registration has been carried out. Do you want to modify the user data now?";
+ };
+};
+
+// RID_SVXQB_CHANGEDATA ---------------------------------------------------
+
+QueryBox RID_SVXQB_CHANGEDATA
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+ Message [ en-US ] = "The User Data have been changed.\nNote that, if you continue, the registration key will become invalid.\nTherefore, a new registration key is needed within 30 days.\nYou can find the registration form in the menu Help - Registration...\nDo you really want to change your User Data?";
+};
+
+ // RID_SVXSTR_FIELDUNIT_TABLE --------------------------------------------
+
+StringArray RID_SVXSTR_FIELDUNIT_TABLE
+{
+ 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 ; > ;
+ };
+ };
+
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/opthtml.cxx b/cui/source/options/opthtml.cxx
new file mode 100644
index 000000000000..2737dc33051f
--- /dev/null
+++ b/cui/source/options/opthtml.cxx
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * 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: opthtml.cxx,v $
+ * $Revision: 1.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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svtools/langtab.hxx>
+
+#include <svx/htmlcfg.hxx>
+#include "opthtml.hxx"
+#include "opthtml.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include <svx/dialmgr.hxx>
+
+// Umwandlung der Modi zu den Positionen in der Listbox
+const USHORT aPosToExportArr[] =
+{
+ HTML_CFG_HTML32,
+ HTML_CFG_MSIE_40,
+ HTML_CFG_NS40,
+ HTML_CFG_WRITER
+};
+
+//#define DEPRECATED_ENTRY 0xFFFF
+
+const USHORT aExportToPosArr[] =
+{
+ 0, //HTML 3.2
+ 1, //MS Internet Explorer 4.0
+ 3, //StarWriter
+ 2 //Netscape Navigator 4.0
+};
+// -----------------------------------------------------------------------
+
+OfaHtmlTabPage::OfaHtmlTabPage(Window* pParent, const SfxItemSet& rSet) :
+ SfxTabPage( pParent, SVX_RES( RID_OFAPAGE_HTMLOPT ), rSet ),
+ aFontSizeGB ( this, SVX_RES( GB_FONTSIZE ) ),
+ aSize1FT ( this, SVX_RES( FT_SIZE1 ) ),
+ aSize1NF ( this, SVX_RES( NF_SIZE1 ) ),
+ aSize2FT ( this, SVX_RES( FT_SIZE2 ) ),
+ aSize2NF ( this, SVX_RES( NF_SIZE2 ) ),
+ aSize3FT ( this, SVX_RES( FT_SIZE3 ) ),
+ aSize3NF ( this, SVX_RES( NF_SIZE3 ) ),
+ aSize4FT ( this, SVX_RES( FT_SIZE4 ) ),
+ aSize4NF ( this, SVX_RES( NF_SIZE4 ) ),
+ aSize5FT ( this, SVX_RES( FT_SIZE5 ) ),
+ aSize5NF ( this, SVX_RES( NF_SIZE5 ) ),
+ aSize6FT ( this, SVX_RES( FT_SIZE6 ) ),
+ aSize6NF ( this, SVX_RES( NF_SIZE6 ) ),
+ aSize7FT ( this, SVX_RES( FT_SIZE7 ) ),
+ aSize7NF ( this, SVX_RES( NF_SIZE7 ) ),
+ aImportGB ( this, SVX_RES( GB_IMPORT ) ),
+ aNumbersEnglishUSCB ( this, SVX_RES( CB_NUMBERS_ENGLISH_US ) ),
+ aUnknownTagCB ( this, SVX_RES( CB_UNKNOWN_TAGS ) ),
+ aIgnoreFontNamesCB( this, SVX_RES( CB_IGNORE_FONTNAMES ) ),
+ aExportGB ( this, SVX_RES( GB_EXPORT ) ),
+ aExportLB ( this, SVX_RES( LB_EXPORT ) ),
+ aStarBasicCB ( this, SVX_RES( CB_STARBASIC ) ),
+ aStarBasicWarningCB(this, SVX_RES( CB_STARBASIC_WARNING ) ),
+ aPrintExtensionCB( this,SVX_RES(CB_PRINT_EXTENSION )),
+ aSaveGrfLocalCB ( this, SVX_RES( CB_LOCAL_GRF ) ),
+ aCharSetFT ( this, SVX_RES( FT_CHARSET ) ),
+ aCharSetLB ( this, SVX_RES( LB_CHARSET ) )
+
+{
+ FreeResource();
+
+ // replace placeholder with UI string from language list
+ String aText( aNumbersEnglishUSCB.GetText());
+ String aPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%ENGLISHUSLOCALE"));
+ xub_StrLen nPos;
+ if ((nPos = aText.Search( aPlaceholder)) != STRING_NOTFOUND)
+ {
+ SvtLanguageTable aLangTab;
+ const String& rStr = aLangTab.GetString( LANGUAGE_ENGLISH_US);
+ if (rStr.Len())
+ {
+ aText.Replace( nPos, aPlaceholder.Len(), rStr);
+ aNumbersEnglishUSCB.SetText( aText);
+ }
+ }
+
+ aExportLB.SetSelectHdl(LINK(this, OfaHtmlTabPage, ExportHdl_Impl));
+ aStarBasicCB.SetClickHdl(LINK(this, OfaHtmlTabPage, CheckBoxHdl_Impl));
+
+ // initialize the characterset listbox
+ aCharSetLB.FillWithMimeAndSelectBest();
+}
+
+/*-----------------02.09.96 13.47-------------------
+
+--------------------------------------------------*/
+
+OfaHtmlTabPage::~OfaHtmlTabPage()
+{
+}
+
+/*-----------------02.09.96 13.47-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* OfaHtmlTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return new OfaHtmlTabPage(pParent, rAttrSet);
+}
+
+/*-----------------02.09.96 13.47-------------------
+
+--------------------------------------------------*/
+
+BOOL OfaHtmlTabPage::FillItemSet( SfxItemSet& )
+{
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ if(aSize1NF.GetSavedValue() != aSize1NF.GetText())
+ pHtmlOpt->SetFontSize(0, (USHORT)aSize1NF.GetValue());
+ if(aSize2NF.GetSavedValue() != aSize2NF.GetText())
+ pHtmlOpt->SetFontSize(1, (USHORT)aSize2NF.GetValue());
+ if(aSize3NF.GetSavedValue() != aSize3NF.GetText())
+ pHtmlOpt->SetFontSize(2, (USHORT)aSize3NF.GetValue());
+ if(aSize4NF.GetSavedValue() != aSize4NF.GetText())
+ pHtmlOpt->SetFontSize(3, (USHORT)aSize4NF.GetValue());
+ if(aSize5NF.GetSavedValue() != aSize5NF.GetText())
+ pHtmlOpt->SetFontSize(4, (USHORT)aSize5NF.GetValue());
+ if(aSize6NF.GetSavedValue() != aSize6NF.GetText())
+ pHtmlOpt->SetFontSize(5, (USHORT)aSize6NF.GetValue());
+ if(aSize7NF.GetSavedValue() != aSize7NF.GetText())
+ pHtmlOpt->SetFontSize(6, (USHORT)aSize7NF.GetValue());
+
+ if(aNumbersEnglishUSCB.IsChecked() != aNumbersEnglishUSCB.GetSavedValue())
+ pHtmlOpt->SetNumbersEnglishUS(aNumbersEnglishUSCB.IsChecked());
+
+ if(aUnknownTagCB.IsChecked() != aUnknownTagCB.GetSavedValue())
+ pHtmlOpt->SetImportUnknown(aUnknownTagCB.IsChecked());
+
+ if(aIgnoreFontNamesCB.IsChecked() != aIgnoreFontNamesCB.GetSavedValue())
+ pHtmlOpt->SetIgnoreFontFamily(aIgnoreFontNamesCB.IsChecked());
+
+ if(aExportLB.GetSelectEntryPos() != aExportLB.GetSavedValue())
+ pHtmlOpt->SetExportMode(aPosToExportArr[aExportLB.GetSelectEntryPos()]);
+
+ if(aStarBasicCB.IsChecked() != aStarBasicCB.GetSavedValue())
+ pHtmlOpt->SetStarBasic(aStarBasicCB.IsChecked());
+
+ if(aStarBasicWarningCB.IsChecked() != aStarBasicWarningCB.GetSavedValue())
+ pHtmlOpt->SetStarBasicWarning(aStarBasicWarningCB.IsChecked());
+
+ if(aSaveGrfLocalCB.IsChecked() != aSaveGrfLocalCB.GetSavedValue())
+ pHtmlOpt->SetSaveGraphicsLocal(aSaveGrfLocalCB.IsChecked());
+
+ if(aPrintExtensionCB.IsChecked() != aPrintExtensionCB.GetSavedValue())
+ pHtmlOpt->SetPrintLayoutExtension(aPrintExtensionCB.IsChecked());
+
+ if( aCharSetLB.GetSelectTextEncoding() != pHtmlOpt->GetTextEncoding() )
+ pHtmlOpt->SetTextEncoding( aCharSetLB.GetSelectTextEncoding() );
+
+ return FALSE;
+}
+
+/*-----------------02.09.96 13.47-------------------
+
+--------------------------------------------------*/
+
+void OfaHtmlTabPage::Reset( const SfxItemSet& )
+{
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ aSize1NF.SetValue(pHtmlOpt->GetFontSize(0));
+ aSize2NF.SetValue(pHtmlOpt->GetFontSize(1));
+ aSize3NF.SetValue(pHtmlOpt->GetFontSize(2));
+ aSize4NF.SetValue(pHtmlOpt->GetFontSize(3));
+ aSize5NF.SetValue(pHtmlOpt->GetFontSize(4));
+ aSize6NF.SetValue(pHtmlOpt->GetFontSize(5));
+ aSize7NF.SetValue(pHtmlOpt->GetFontSize(6));
+ aNumbersEnglishUSCB.Check(pHtmlOpt->IsNumbersEnglishUS());
+ aUnknownTagCB.Check(pHtmlOpt->IsImportUnknown());
+ aIgnoreFontNamesCB.Check(pHtmlOpt->IsIgnoreFontFamily());
+ USHORT nExport = pHtmlOpt->GetExportMode();
+ if( nExport >= ( sizeof( aExportToPosArr ) / sizeof( USHORT ) ) )
+ nExport = 4; // default for bad config entry is NS 4.0
+ USHORT nPosArr = aExportToPosArr[ nExport ];
+// if( nPosArr == DEPRECATED_ENTRY )
+// nPosArr = aExportToPosArr[ 4 ]; // again: NS 4.0 is default
+ aExportLB.SelectEntryPos( nPosArr );
+ aExportLB.SaveValue();
+
+ ExportHdl_Impl(&aExportLB);
+
+ aStarBasicCB .Check(pHtmlOpt->IsStarBasic());
+ aStarBasicWarningCB .Check(pHtmlOpt->IsStarBasicWarning());
+ aStarBasicWarningCB.Enable(!aStarBasicCB.IsChecked());
+ aSaveGrfLocalCB.Check(pHtmlOpt->IsSaveGraphicsLocal());
+ aPrintExtensionCB.Check(pHtmlOpt->IsPrintLayoutExtension());
+
+ aPrintExtensionCB.SaveValue();
+ aStarBasicCB .SaveValue();
+ aStarBasicWarningCB .SaveValue();
+ aSaveGrfLocalCB.SaveValue();
+ aSize1NF.SaveValue();
+ aSize2NF.SaveValue();
+ aSize3NF.SaveValue();
+ aSize4NF.SaveValue();
+ aSize5NF.SaveValue();
+ aSize6NF.SaveValue();
+ aSize7NF.SaveValue();
+ aNumbersEnglishUSCB.SaveValue();
+ aUnknownTagCB.SaveValue();
+ aIgnoreFontNamesCB.SaveValue();
+
+ if( !pHtmlOpt->IsDefaultTextEncoding() &&
+ aCharSetLB.GetSelectTextEncoding() != pHtmlOpt->GetTextEncoding() )
+ aCharSetLB.SelectTextEncoding( pHtmlOpt->GetTextEncoding() );
+}
+
+/*-----------------16.04.98 16:03-------------------
+
+--------------------------------------------------*/
+IMPL_LINK(OfaHtmlTabPage, ExportHdl_Impl, ListBox*, pBox)
+{
+ USHORT nExport = aPosToExportArr[ pBox->GetSelectEntryPos() ];
+ switch( nExport )
+ {
+ case HTML_CFG_MSIE_40:
+ case HTML_CFG_NS40 :
+ case HTML_CFG_WRITER :
+ aPrintExtensionCB.Enable(TRUE);
+ break;
+ default: aPrintExtensionCB.Enable(FALSE);
+ }
+
+ return 0;
+}
+/* -----------------05.02.99 09:17-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, CheckBox*, pBox)
+{
+ aStarBasicWarningCB.Enable(!pBox->IsChecked());
+ return 0;
+}
+
+
diff --git a/cui/source/options/opthtml.hrc b/cui/source/options/opthtml.hrc
new file mode 100644
index 000000000000..6525a31fc877
--- /dev/null
+++ b/cui/source/options/opthtml.hrc
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * 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: opthtml.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTHTML_HRC
+#define _SVX_OPTHTML_HRC
+
+// defines ------------------------------------------------------------------
+
+#define GB_FONTSIZE 1
+#define FT_SIZE1 2
+#define NF_SIZE1 3
+#define FT_SIZE2 4
+#define NF_SIZE2 5
+#define FT_SIZE3 6
+#define NF_SIZE3 7
+#define FT_SIZE4 8
+#define NF_SIZE4 9
+#define FT_SIZE5 10
+#define NF_SIZE5 11
+#define FT_SIZE6 12
+#define NF_SIZE6 13
+#define FT_SIZE7 14
+#define NF_SIZE7 15
+#define GB_IMPORT 20
+#define CB_UNKNOWN_TAGS 21
+#define CB_IGNORE_FONTNAMES 22
+#define CB_NUMBERS_ENGLISH_US 23
+
+#define GB_EXPORT 30
+#define CB_STARBASIC 31
+#define CB_STARBASIC_WARNING 32
+
+#define CB_LOCAL_GRF 37
+#define CB_PRINT_EXTENSION 38
+#define LB_EXPORT 39
+#define FT_CHARSET 40
+#define LB_CHARSET 41
+
+#endif
+
diff --git a/cui/source/options/opthtml.hxx b/cui/source/options/opthtml.hxx
new file mode 100644
index 000000000000..3d630ea692ff
--- /dev/null
+++ b/cui/source/options/opthtml.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * 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: opthtml.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OFA_OPTHTML_HXX
+#define _OFA_OPTHTML_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/txencbox.hxx>
+
+class OfaHtmlTabPage : public SfxTabPage
+{
+ FixedLine aFontSizeGB;
+ FixedText aSize1FT;
+ NumericField aSize1NF;
+ FixedText aSize2FT;
+ NumericField aSize2NF;
+ FixedText aSize3FT;
+ NumericField aSize3NF;
+ FixedText aSize4FT;
+ NumericField aSize4NF;
+ FixedText aSize5FT;
+ NumericField aSize5NF;
+ FixedText aSize6FT;
+ NumericField aSize6NF;
+ FixedText aSize7FT;
+ NumericField aSize7NF;
+
+ FixedLine aImportGB;
+ CheckBox aNumbersEnglishUSCB;
+ CheckBox aUnknownTagCB;
+ CheckBox aIgnoreFontNamesCB;
+
+ FixedLine aExportGB;
+ ListBox aExportLB;
+ CheckBox aStarBasicCB;
+ CheckBox aStarBasicWarningCB;
+ CheckBox aPrintExtensionCB;
+ CheckBox aSaveGrfLocalCB;
+ FixedText aCharSetFT;
+ SvxTextEncodingBox aCharSetLB;
+
+ DECL_LINK(ExportHdl_Impl, ListBox*);
+ DECL_LINK(CheckBoxHdl_Impl, CheckBox*);
+
+ OfaHtmlTabPage(Window* pParent, const SfxItemSet& rSet);
+ virtual ~OfaHtmlTabPage();
+public:
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+};
+
+
+#endif //
+
+
+
diff --git a/cui/source/options/opthtml.src b/cui/source/options/opthtml.src
new file mode 100644
index 000000000000..dc5b5f9431c7
--- /dev/null
+++ b/cui/source/options/opthtml.src
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * 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: opthtml.src,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "opthtml.hrc"
+#include <svx/dialogs.hrc>
+
+ // RID_OFAPAGE_HTMLOPT -----------------------------------------------------
+TabPage RID_OFAPAGE_HTMLOPT
+{
+ // HelpId = ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ FixedText FT_SIZE1
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~1" ;
+ };
+ NumericField NF_SIZE1
+ {
+ Pos = MAP_APPFONT ( 45 , 14 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_SIZE2
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~2" ;
+ };
+ NumericField NF_SIZE2
+ {
+ Pos = MAP_APPFONT ( 45 , 30 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_SIZE3
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~3" ;
+ };
+ NumericField NF_SIZE3
+ {
+ Pos = MAP_APPFONT ( 45 , 46 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_SIZE4
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~4" ;
+ };
+ NumericField NF_SIZE4
+ {
+ Pos = MAP_APPFONT ( 45 , 62 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_SIZE5
+ {
+ Pos = MAP_APPFONT ( 12 , 80 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~5" ;
+ };
+ NumericField NF_SIZE5
+ {
+ Pos = MAP_APPFONT ( 45 , 78 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_SIZE6
+ {
+ Pos = MAP_APPFONT ( 12 , 96 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~6" ;
+ };
+ NumericField NF_SIZE6
+ {
+ Pos = MAP_APPFONT ( 45 , 94 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_SIZE7
+ {
+ Pos = MAP_APPFONT ( 12 , 112 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~7" ;
+ };
+ NumericField NF_SIZE7
+ {
+ Pos = MAP_APPFONT ( 45 , 110 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedLine GB_FONTSIZE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 75 , 8 ) ;
+ Text [ en-US ] = "Font sizes" ;
+ };
+ FixedLine GB_IMPORT
+ {
+ Pos = MAP_APPFONT ( 87 , 3 ) ;
+ Size = MAP_APPFONT ( 167 , 8 ) ;
+ Text [ en-US ] = "Import" ;
+ };
+ CheckBox CB_NUMBERS_ENGLISH_US
+ {
+ Pos = MAP_APPFONT ( 93 , 14 ) ;
+ Size = MAP_APPFONT ( 161 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Use '%ENGLISHUSLOCALE' locale for numbers" ;
+ };
+ CheckBox CB_UNKNOWN_TAGS
+ {
+ Pos = MAP_APPFONT ( 93 , 28 ) ;
+ Size = MAP_APPFONT ( 155 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Import unknown HTML tags as fields" ;
+ };
+ CheckBox CB_IGNORE_FONTNAMES
+ {
+ Pos = MAP_APPFONT ( 93 , 42 ) ;
+ Size = MAP_APPFONT ( 155 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ignore ~font settings" ;
+ };
+ FixedLine GB_EXPORT
+ {
+ Pos = MAP_APPFONT ( 87 , 58 ) ;
+ Size = MAP_APPFONT ( 167 , 8 ) ;
+ Text [ en-US ] = "Export" ;
+ };
+ ListBox LB_EXPORT
+ {
+ Pos = MAP_APPFONT ( 93 , 69 ) ;
+ Size = MAP_APPFONT ( 155 , 50 ) ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ StringList =
+ {
+ < "HTML 3.2" ; > ;
+ < "Microsoft Internet Explorer" ; > ;
+ < "Netscape Navigator"; > ;
+ < "%PRODUCTNAME Writer" ; > ;
+ };
+ };
+ CheckBox CB_STARBASIC
+ {
+ Pos = MAP_APPFONT ( 93 , 88 ) ;
+ Size = MAP_APPFONT ( 155 , 10 ) ;
+ Text = "%PRODUCTNAME ~Basic" ;
+ };
+ CheckBox CB_STARBASIC_WARNING
+ {
+ Pos = MAP_APPFONT ( 99 , 102 ) ;
+ Size = MAP_APPFONT ( 149 , 10 ) ;
+ Text [ en-US ] = "Display ~warning";
+ };
+ CheckBox CB_PRINT_EXTENSION
+ {
+ Pos = MAP_APPFONT ( 93 , 116 ) ;
+ Size = MAP_APPFONT ( 155 , 10 ) ;
+ Text [ en-US ] = "~Print layout" ;
+ };
+ CheckBox CB_LOCAL_GRF
+ {
+ Pos = MAP_APPFONT ( 93 , 130 ) ;
+ Size = MAP_APPFONT ( 155 , 10 ) ;
+ Text [ en-US ] = "~Copy local graphics to Internet" ;
+ };
+
+ FixedText FT_CHARSET
+ {
+ Pos = MAP_APPFONT ( 93 , 144 ) ;
+ Size = MAP_APPFONT ( 65 , 8 ) ;
+ Text [ en-US ] = "Character set";
+ };
+ ListBox LB_CHARSET
+ {
+ Pos = MAP_APPFONT ( 162 , 143 ) ;
+ Size = MAP_APPFONT ( 86 , 61 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+};
+ // ******************************************************************* EOF
diff --git a/cui/source/options/optimprove.cxx b/cui/source/options/optimprove.cxx
new file mode 100644
index 000000000000..e6240aa7a797
--- /dev/null
+++ b/cui/source/options/optimprove.cxx
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * 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: optimprove.cxx,v $
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#define _SVX_OPTIMPROVE_CXX
+
+#include <optimprove.hxx>
+#include <svx/dialmgr.hxx>
+#include <vcl/msgbox.hxx>
+
+#include "optimprove.hrc"
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/oooimprovement/XCoreController.hpp>
+#include <comphelper/configurationhelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/uieventslogger.hxx>
+#include <tools/testtoolloader.hxx>
+
+namespace lang = ::com::sun::star::lang;
+namespace uno = ::com::sun::star::uno;
+using namespace com::sun::star::system;
+
+// class SvxImprovementPage ----------------------------------------------
+
+SvxImprovementPage::SvxImprovementPage( Window* pParent ) :
+
+ TabPage( pParent, SVX_RES( RID_SVXPAGE_IMPROVEMENT ) ),
+
+ m_aImproveFL ( this, SVX_RES( FL_IMPROVE ) ),
+ m_aInvitationFT ( this, SVX_RES( FT_INVITATION ) ),
+ m_aYesRB ( this, SVX_RES( RB_YES ) ),
+ m_aNoRB ( this, SVX_RES( RB_NO ) ),
+ m_aDataFL ( this, SVX_RES( FL_DATA ) ),
+ m_aNumberOfReportsFT ( this, SVX_RES( FT_NR_REPORTS ) ),
+ m_aNumberOfReportsValueFT ( this, SVX_RES( FT_NR_REPORTS_VALUE ) ),
+ m_aNumberOfActionsFT ( this, SVX_RES( FT_NR_ACTIONS ) ),
+ m_aNumberOfActionsValueFT ( this, SVX_RES( FT_NR_ACTIONS_VALUE ) ),
+ m_aShowDataPB ( this, SVX_RES( PB_SHOWDATA ) ),
+
+ m_sInfo ( SVX_RES( STR_INFO ) ),
+ m_sMoreInfo ( SVX_RES( STR_MOREINFO ) )
+
+{
+ FreeResource();
+
+ m_aInvitationFT.Show();
+ m_aDataFL.Hide();
+ m_aNumberOfReportsFT.Hide();
+ m_aNumberOfReportsValueFT.Hide();
+ m_aNumberOfActionsFT.Hide();
+ m_aNumberOfActionsValueFT.Hide();
+ m_aShowDataPB.Hide();
+
+ Size aNewSize = m_aInvitationFT.GetSizePixel();
+ const long nMinWidth = m_aYesRB.CalcMinimumSize().Width();
+ const long nNewWidth = std::max( aNewSize.Width() * 4 / 5, nMinWidth );
+ const long nWDelta = aNewSize.Width() - nNewWidth;
+ aNewSize.Width() = nNewWidth;
+ const Size aCalcSize = m_aInvitationFT.CalcMinimumSize( nNewWidth );
+ const long nHDelta = aCalcSize.Height() - aNewSize.Height();
+ aNewSize.Height() = aCalcSize.Height();
+ m_aInvitationFT.SetSizePixel( aNewSize );
+
+ aNewSize = m_aYesRB.GetSizePixel();
+ aNewSize.Width() = nNewWidth;
+ Point aNewPos = m_aYesRB.GetPosPixel();
+ aNewPos.Y() += nHDelta;
+ m_aYesRB.SetPosSizePixel( aNewPos, aNewSize );
+ aNewSize = m_aNoRB.GetSizePixel();
+ aNewSize.Width() = nNewWidth;
+ aNewPos = m_aNoRB.GetPosPixel();
+ aNewPos.Y() += nHDelta;
+ m_aNoRB.SetPosSizePixel( aNewPos, aNewSize );
+ aNewSize = m_aImproveFL.GetSizePixel();
+ aNewSize.Width() -= nWDelta;
+ m_aImproveFL.SetSizePixel( aNewSize );
+
+ Size aSize = GetOutputSizePixel();
+ aSize.Width() -= nWDelta;
+ aSize.Height() = m_aDataFL.GetPosPixel().Y();
+ aSize.Height() += nHDelta;
+ SetSizePixel( aSize );
+}
+
+// -----------------------------------------------------------------------
+
+SvxImprovementPage::~SvxImprovementPage()
+{
+}
+
+// class SvxImprovementDialog --------------------------------------------
+
+SvxImprovementDialog::SvxImprovementDialog( Window* pParent, const String& rInfoURL ) :
+
+ SfxSingleTabDialog( pParent, RID_SVXPAGE_IMPROVEMENT, rInfoURL ),
+
+ m_pPage( NULL )
+
+{
+ m_pPage = new SvxImprovementPage( this );
+ SetInfoLink( LINK( this, SvxImprovementDialog, HandleHyperlink ) );
+ SetPage( m_pPage );
+ if ( GetOKButton() )
+ GetOKButton()->SetClickHdl( LINK( this, SvxImprovementDialog, HandleOK ) );
+}
+
+IMPL_LINK( SvxImprovementDialog, HandleHyperlink, svt::FixedHyperlinkImage*, pHyperlinkImage )
+{
+ ::rtl::OUString sURL( pHyperlinkImage->GetURL() );
+
+ if ( sURL.getLength() > 0 )
+ {
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xSMGR =
+ ::comphelper::getProcessServiceFactory();
+ uno::Reference< XSystemShellExecute > xSystemShell(
+ xSMGR->createInstance( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ),
+ uno::UNO_QUERY_THROW );
+ if ( xSystemShell.is() )
+ {
+ xSystemShell->execute(
+ sURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS );
+ }
+ }
+ catch( const uno::Exception& e )
+ {
+ OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxImprovementDialog, HandleOK, OKButton*, EMPTYARG )
+{
+ uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ uno::Reference< com::sun::star::oooimprovement::XCoreController > core_c(
+ xSMGR->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.oooimprovement.CoreController")),
+ uno::UNO_QUERY);
+ if(core_c.is())
+ {
+ ::comphelper::ConfigurationHelper::writeDirectKey(
+ xSMGR,
+ ::rtl::OUString::createFromAscii("/org.openoffice.Office.OOoImprovement.Settings"),
+ ::rtl::OUString::createFromAscii("Participation"),
+ ::rtl::OUString::createFromAscii("ShowedInvitation"),
+ uno::makeAny( true ),
+ ::comphelper::ConfigurationHelper::E_STANDARD );
+ ::comphelper::ConfigurationHelper::writeDirectKey(
+ xSMGR,
+ ::rtl::OUString::createFromAscii("/org.openoffice.Office.OOoImprovement.Settings"),
+ ::rtl::OUString::createFromAscii("Participation"),
+ ::rtl::OUString::createFromAscii("InvitationAccepted"),
+ uno::makeAny( m_pPage->IsYesChecked() ),
+ ::comphelper::ConfigurationHelper::E_STANDARD );
+ // TODO: refactor
+ ::comphelper::UiEventsLogger::reinit();
+ ::tools::InitTestToolLib();
+ }
+ EndDialog( RET_OK );
+ return 0;
+}
+
+// class SvxInfoWindow ---------------------------------------------------
+
+SvxInfoWindow::SvxInfoWindow( Window* pParent, const ResId& rResId ) :
+ Window( pParent, rResId ),
+ m_aInfoText( this )
+{
+ m_aInfoText.SetPosSizePixel( Point( 10, 10 ), Size( 150, 10 ) );
+
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ Wallpaper aWall( rSettings.GetWindowColor() );
+ SetBackground( aWall );
+ Font aNewFont( m_aInfoText.GetFont() );
+ aNewFont.SetTransparent( TRUE );
+ m_aInfoText.SetFont( aNewFont );
+ m_aInfoText.SetBackground( aWall );
+ m_aInfoText.SetControlForeground( rSettings.GetWindowTextColor() );
+}
+
+void SvxInfoWindow::SetInfoText( const String& rText )
+{
+ m_aInfoText.SetText( rText );
+ Size aSize = m_aInfoText.CalcMinimumSize();
+ Size aWinSize = GetSizePixel();
+ Point aPos( ( aWinSize.Width() - aSize.Width() ) / 2, ( aWinSize.Height() - aSize.Height() ) / 2 );
+ m_aInfoText.SetPosSizePixel( aPos, aSize );
+}
+
diff --git a/cui/source/options/optimprove.hrc b/cui/source/options/optimprove.hrc
new file mode 100644
index 000000000000..919b01c6fb6a
--- /dev/null
+++ b/cui/source/options/optimprove.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optimprove.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTIMPROVE_HRC
+#define _SVX_OPTIMPROVE_HRC
+
+// defines ---------------------------------------------------------------
+
+#define FL_IMPROVE 10
+#define FT_INVITATION 11
+#define RB_YES 12
+#define RB_NO 13
+#define FL_DATA 14
+#define FT_NR_REPORTS 15
+#define FT_NR_REPORTS_VALUE 16
+#define FT_NR_ACTIONS 17
+#define FT_NR_ACTIONS_VALUE 18
+#define PB_SHOWDATA 19
+#define FI_INFO 20
+#define WIN_INFO 21
+#define BTN_OK 22
+
+#define STR_INFO 10
+#define STR_MOREINFO 11
+
+#endif
+
diff --git a/cui/source/options/optimprove.src b/cui/source/options/optimprove.src
new file mode 100644
index 000000000000..86fc6d1c1a5d
--- /dev/null
+++ b/cui/source/options/optimprove.src
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * 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: optimprove.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "optimprove.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+TabPage RID_SVXPAGE_IMPROVEMENT
+{
+ //!HelpId = HID_OPTIONS_IMPROVEMENT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "%PRODUCTNAME Improvement Program" ;
+ FixedLine FL_IMPROVE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Improvement Program" ;
+ };
+ FixedText FT_INVITATION
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 242 , 72 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "We invite you to join our %PRODUCTNAME Improvement Program to help optimize the quality of %PRODUCTNAME.\n\nIf you are willing to participate, we will collect anonymous statistics about how you use %PRODUCTNAME. The data is used to identify usage patterns.\n\nThe %PRODUCTNAME Improvement Program will not collect any personal data, or document content." ;
+ };
+ RadioButton RB_YES
+ {
+ Pos = MAP_APPFONT ( 12 , 92 ) ;
+ Size = MAP_APPFONT ( 215 , 10 ) ;
+ Check = TRUE ;
+ Text [ en-US ] = "~Yes, I am willing to participate in the %PRODUCTNAME Improvement Program" ;
+ };
+ RadioButton RB_NO
+ {
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 215 , 10 ) ;
+ Text [ en-US ] = "~No, I do not wish to participate" ;
+ };
+ FixedImage FI_INFO
+ {
+ Pos = MAP_APPFONT ( 230 , 91 ) ;
+ Size = MAP_APPFONT ( 24 , 24 ) ;
+ Fixed = Image
+ {
+ ImageBitmap = Bitmap { File = "info.png"; };
+ };
+ };
+ FixedLine FL_DATA
+ {
+ Pos = MAP_APPFONT ( 6 , 121 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Tracked Data" ;
+ };
+ FixedText FT_NR_REPORTS
+ {
+ Pos = MAP_APPFONT ( 12 , 132 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Number of reports sent:" ;
+ };
+ FixedText FT_NR_REPORTS_VALUE
+ {
+ Pos = MAP_APPFONT ( 95 , 132 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ };
+ FixedText FT_NR_ACTIONS
+ {
+ Pos = MAP_APPFONT ( 12 , 145 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Number of tracked actions:" ;
+ };
+ FixedText FT_NR_ACTIONS_VALUE
+ {
+ Pos = MAP_APPFONT ( 95 , 145 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ };
+ PushButton PB_SHOWDATA
+ {
+ Pos = MAP_APPFONT ( 12 , 161 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Show Data" ;
+ };
+ String STR_INFO
+ {
+ Text [ en-US ] = "Help Optimize the Quality of %PRODUCTNAME" ;
+ };
+ String STR_MOREINFO
+ {
+ Text [ en-US ] = "More Information" ;
+ };
+};
+
diff --git a/cui/source/options/optimprove2.cxx b/cui/source/options/optimprove2.cxx
new file mode 100644
index 000000000000..de44e7979471
--- /dev/null
+++ b/cui/source/options/optimprove2.cxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * 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: optimprove2.cxx,v $
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#define _SVX_OPTIMPROVE_CXX
+
+#include <optimprove.hxx>
+#include <svx/dialmgr.hxx>
+#include <vcl/msgbox.hxx>
+
+#include "optimprove.hrc"
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/oooimprovement/XCore.hpp>
+#include <com/sun/star/oooimprovement/XCoreController.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/util/XStringSubstitution.hpp>
+#include <comphelper/configurationhelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/synchronousdispatch.hxx>
+#include <comphelper/uieventslogger.hxx>
+#include <tools/testtoolloader.hxx>
+
+#define C2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+namespace beans = ::com::sun::star::beans;
+namespace lang = ::com::sun::star::lang;
+namespace uno = ::com::sun::star::uno;
+namespace util = ::com::sun::star::util;
+using namespace com::sun::star::system;
+
+// class SvxEmptyPage ----------------------------------------------------
+
+SvxEmptyPage::SvxEmptyPage( Window* pParent ) :
+
+ TabPage( pParent, SVX_RES( RID_SVXPAGE_IMPROVEMENT ) )
+
+{
+ FreeResource();
+}
+
+// class SvxImprovementOptionsPage ---------------------------------------
+
+SvxImprovementOptionsPage::SvxImprovementOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_IMPROVEMENT ), rSet ),
+
+ m_aImproveFL ( this, SVX_RES( FL_IMPROVE ) ),
+ m_aInvitationFT ( this, SVX_RES( FT_INVITATION ) ),
+ m_aYesRB ( this, SVX_RES( RB_YES ) ),
+ m_aNoRB ( this, SVX_RES( RB_NO ) ),
+ m_aInfoFI ( this, SVX_RES( FI_INFO ) ),
+ m_aDataFL ( this, SVX_RES( FL_DATA ) ),
+ m_aNumberOfReportsFT ( this, SVX_RES( FT_NR_REPORTS ) ),
+ m_aNumberOfReportsValueFT ( this, SVX_RES( FT_NR_REPORTS_VALUE ) ),
+ m_aNumberOfActionsFT ( this, SVX_RES( FT_NR_ACTIONS ) ),
+ m_aNumberOfActionsValueFT ( this, SVX_RES( FT_NR_ACTIONS_VALUE ) ),
+ m_aShowDataPB ( this, SVX_RES( PB_SHOWDATA ) ),
+
+ m_sInfo ( SVX_RES( STR_INFO ) ),
+ m_sMoreInfo ( SVX_RES( STR_MOREINFO ) )
+
+{
+ FreeResource();
+
+ m_aInfoFI.SetURL( C2S( "www.sun.com/privacy/" ) );
+ m_aInfoFI.SetClickHdl( LINK( this, SvxImprovementOptionsPage, HandleHyperlink ) );
+ m_aShowDataPB.SetClickHdl( LINK( this, SvxImprovementOptionsPage, HandleShowData ) );
+}
+
+SvxImprovementOptionsPage::~SvxImprovementOptionsPage()
+{
+}
+
+IMPL_LINK( SvxImprovementOptionsPage, HandleHyperlink, svt::FixedHyperlinkImage*, EMPTYARG )
+{
+ ::rtl::OUString sURL( m_aInfoFI.GetURL() );
+
+ if ( sURL.getLength() > 0 )
+ {
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xSMGR =
+ ::comphelper::getProcessServiceFactory();
+ uno::Reference< XSystemShellExecute > xSystemShell(
+ xSMGR->createInstance( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ),
+ uno::UNO_QUERY_THROW );
+ if ( xSystemShell.is() )
+ {
+ xSystemShell->execute(
+ sURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS );
+ }
+ }
+ catch( const uno::Exception& e )
+ {
+ OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxImprovementOptionsPage, HandleShowData, PushButton*, EMPTYARG )
+{
+ uno::Reference < uno::XInterface > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
+ C2S("com.sun.star.frame.Desktop") ), uno::UNO_QUERY );
+ if ( xDesktop.is() )
+ {
+ ::rtl::OUString sLogFile( m_sLogPath );
+ sLogFile += C2S("/Current.csv");
+ uno::Sequence< beans::PropertyValue > aArgs;
+
+ uno::Reference< lang::XComponent > xDoc = ::comphelper::SynchronousDispatch::dispatch(
+ xDesktop, sLogFile, C2S("_default"), 0, aArgs );
+ if ( xDoc.is() )
+ return 1;
+ }
+
+ return 0;
+}
+
+SfxTabPage* SvxImprovementOptionsPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxImprovementOptionsPage( pParent, rSet );
+}
+
+sal_uInt16* SvxImprovementOptionsPage::GetRanges()
+{
+ return NULL;
+}
+
+sal_Bool SvxImprovementOptionsPage::FillItemSet( SfxItemSet& /*rSet*/ )
+{
+ uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ uno::Reference< uno::XInterface > xConfig;
+
+ try
+ {
+ xConfig = ::comphelper::ConfigurationHelper::openConfig(
+ xSMGR, C2S("/org.openoffice.Office.OOoImprovement.Settings"),
+ ::comphelper::ConfigurationHelper::E_STANDARD );
+ ::comphelper::ConfigurationHelper::writeRelativeKey(
+ xConfig, C2S("Participation"), C2S("ShowedInvitation"), uno::makeAny( true ) );
+ ::comphelper::ConfigurationHelper::writeRelativeKey(
+ xConfig, C2S("Participation"), C2S("InvitationAccepted"), uno::makeAny( m_aYesRB.IsChecked() != FALSE ) );
+ ::comphelper::ConfigurationHelper::flush( xConfig );
+ // TODO: refactor
+ ::comphelper::UiEventsLogger::reinit();
+ ::tools::InitTestToolLib();
+ }
+ catch( uno::Exception& )
+ {
+ }
+
+ return sal_False;
+}
+
+void SvxImprovementOptionsPage::Reset( const SfxItemSet& /*rSet*/ )
+{
+ uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ uno::Reference< com::sun::star::oooimprovement::XCore > xCore(
+ xSMGR->createInstance( C2S("com.sun.star.oooimprovement.Core") ),
+ uno::UNO_QUERY );
+ uno::Reference< uno::XInterface > xConfig;
+
+ try
+ {
+ m_aNoRB.Check();
+ xConfig = ::comphelper::ConfigurationHelper::openConfig(
+ xSMGR, C2S("/org.openoffice.Office.OOoImprovement.Settings"),
+ ::comphelper::ConfigurationHelper::E_READONLY );
+ if ( xConfig.is() )
+ {
+ bool bYesChecked = false;
+ uno::Any aAny = ::comphelper::ConfigurationHelper::
+ readRelativeKey( xConfig, C2S("Participation"), C2S("ShowedInvitation") );
+ if ( ( aAny >>= bYesChecked ) && bYesChecked )
+ {
+ bool bTemp = false;
+ aAny = ::comphelper::ConfigurationHelper::
+ readRelativeKey( xConfig, C2S("Participation"), C2S("InvitationAccepted") );
+ if ( aAny >>= bTemp )
+ {
+ bYesChecked &= bTemp;
+ if ( bYesChecked )
+ m_aYesRB.Check();
+ }
+ }
+
+ ::rtl::OUString sURL;
+ aAny = ::comphelper::ConfigurationHelper::
+ readRelativeKey( xConfig, C2S("Participation"), C2S("HelpUrl") );
+ if ( aAny >>= sURL )
+ m_aInfoFI.SetURL( sURL );
+
+ sal_Int32 nCount = 0;
+ aAny = ::comphelper::ConfigurationHelper::
+ readRelativeKey( xConfig, C2S("Counters"), C2S("UploadedReports") );
+ if ( aAny >>= nCount )
+ m_aNumberOfReportsValueFT.SetText( String::CreateFromInt32( nCount ) );
+ aAny = ::comphelper::ConfigurationHelper::
+ readRelativeKey( xConfig, C2S("Counters"), C2S("LoggedEvents") );
+ if ( aAny >>= nCount )
+ {
+ if ( xCore.is() )
+ nCount += xCore->getSessionLogEventCount();
+ m_aNumberOfActionsValueFT.SetText( String::CreateFromInt32( nCount ) );
+ }
+
+ ::rtl::OUString sPath;
+ aAny = ::comphelper::ConfigurationHelper::readDirectKey(
+ xSMGR, C2S("/org.openoffice.Office.Logging"), C2S("OOoImprovement"),
+ C2S("LogPath"), ::comphelper::ConfigurationHelper::E_READONLY );
+ if ( aAny >>= sPath )
+ {
+ uno::Reference< util::XStringSubstitution > xSubst(
+ xSMGR->createInstance( C2S("com.sun.star.util.PathSubstitution") ),
+ uno::UNO_QUERY );
+ if ( xSubst.is() )
+ sPath = xSubst->substituteVariables( sPath, sal_False );
+ m_sLogPath = sPath;
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
new file mode 100644
index 000000000000..94f850eb1d32
--- /dev/null
+++ b/cui/source/options/optinet2.cxx
@@ -0,0 +1,2338 @@
+/*************************************************************************
+ *
+ * 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: optinet2.cxx,v $
+ * $Revision: 1.31 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <tools/config.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/slstitm.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/filedlghelper.hxx>
+#include <tools/inetdef.hxx>
+#include <svl/urihelper.hxx>
+#include <svl/cntwids.hrc>
+#include <unotools/inetoptions.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <unotools/bootstrap.hxx>
+#include <vcl/help.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/securityoptions.hxx>
+#include <unotools/javaoptions.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <unotools/extendedsecurityoptions.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#define _SVX_OPTINET2_CXX
+#include <svx/dialmgr.hxx>
+#include "optinet2.hxx"
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialogs.hrc>
+#include "optinet2.hrc"
+#include "helpid.hrc"
+#include <svx/ofaitem.hxx>
+#include <svx/htmlmode.hxx>
+
+// for security TP
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+
+#ifdef UNX
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <sys/types.h>
+#include <string.h>
+#include <rtl/textenc.h>
+#include <rtl/locale.h>
+#include <osl/nlsupport.h>
+#endif
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <osl/file.hxx>
+#include <osl/process.h>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <comphelper/processfactory.hxx>
+
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include "com/sun/star/task/XMasterPasswordHandling2.hpp"
+#include "com/sun/star/task/XPasswordContainer.hpp"
+#include "securityoptions.hxx"
+#include "webconninfo.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::sfx2;
+using ::rtl::OUString;
+
+//CHINA001 copy from multipat.hxx begin
+// define ----------------------------------------------------------------
+
+// different delimiter for Unix (:) and Windows (;)
+
+#ifdef UNX
+#define CLASSPATH_DELIMITER ':'
+#else
+#define CLASSPATH_DELIMITER ';'
+#endif
+//CHINA001 copy from multipat.hxx end
+// static ----------------------------------------------------------------
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+
+#define INET_SEARCH_TOKEN '"'
+#define RET_ALL ((short)200)
+#define CFG_READONLY_DEFAULT FALSE
+
+#include <sal/config.h>
+
+SV_IMPL_PTRARR( SfxFilterPtrArr, SfxFilterPtr )
+
+const char* SEARCHENGINE_INI = "srcheng.ini";
+const char* SEARCHENGINE_GROUP = "SearchEngines-$(vlang)";
+
+// -----------------------------------------------------------------------
+
+String lcl_MakeTabEntry(const SfxFilter* pFilter)
+{
+ String sEntry(pFilter->GetMimeType());
+ sEntry += '\t';
+ sEntry += pFilter->GetWildcard().GetWildCard();
+ sEntry += '\t';
+ sEntry += pFilter->GetName();
+#if defined(OS2)
+ sEntry += '\t';
+ sEntry += pFilter->GetTypeName();
+#endif
+ return sEntry;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL IsJavaInstalled_Impl( /*!!!SfxIniManager* pIniMgr*/ )
+{
+ BOOL bRet = FALSE;
+/*!!! (pb) needs new implementation
+ String aIniEntry;
+ String aFullName = Config::GetConfigName( pIniMgr->Get( SFX_KEY_USERCONFIG_PATH ),
+ String::CreateFromAscii("java") );
+ INetURLObject aIniFileObj( aFullName, INET_PROT_FILE );
+ String aIniPath = aIniFileObj.getName();
+ if ( pIniMgr->SearchFile( aIniPath ) )
+ {
+ Config aJavaCfg( aIniPath );
+ aJavaCfg.SetGroup( "Java" );
+ ByteString sTemp = aJavaCfg.ReadKey( ByteString(::rtl::OUStringToOString(pIniMgr->GetKeyName( SFX_KEY_JAVA_SYSTEMCLASSPATH ),RTL_TEXTENCODING_UTF8)) );
+ String aJavaSystemClassPath = ::rtl::OStringToOUString(sTemp,RTL_TEXTENCODING_UTF8);
+ String aJavaRuntimeLib = ::rtl::OStringToOUString(aJavaCfg.ReadKey( "RuntimeLib" ),RTL_TEXTENCODING_UTF8);
+ if ( aJavaSystemClassPath.Len() && aJavaRuntimeLib.Len() )
+ bRet = TRUE;
+ }
+*/
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNoSpaceEdit::KeyInput( const KeyEvent& rKEvent )
+{
+ if ( bOnlyNumeric )
+ {
+ const KeyCode& rKeyCode = rKEvent.GetKeyCode();
+ USHORT nGroup = rKeyCode.GetGroup();
+ USHORT nKey = rKeyCode.GetCode();
+ BOOL bValid = ( KEYGROUP_NUM == nGroup || KEYGROUP_CURSOR == nGroup ||
+ ( KEYGROUP_MISC == nGroup && ( nKey < KEY_ADD || nKey > KEY_EQUAL ) ) );
+ if ( !bValid && ( rKeyCode.IsMod1() && (
+ KEY_A == nKey || KEY_C == nKey || KEY_V == nKey || KEY_X == nKey || KEY_Z == nKey ) ) )
+ // Erase, Copy, Paste, Select All und Undo soll funktionieren
+ bValid = TRUE;
+
+ if ( bValid )
+ Edit::KeyInput(rKEvent);
+ }
+ else if( rKEvent.GetKeyCode().GetCode() != KEY_SPACE )
+ Edit::KeyInput(rKEvent);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNoSpaceEdit::Modify()
+{
+ Edit::Modify();
+
+ if ( bOnlyNumeric )
+ {
+ XubString aValue = GetText();
+
+ if ( !ByteString(::rtl::OUStringToOString(aValue,RTL_TEXTENCODING_UTF8)).IsNumericAscii() || (long)aValue.ToInt32() > USHRT_MAX )
+ // der H�chstwert einer Portnummer ist USHRT_MAX
+ ErrorBox( this, SVX_RES( RID_SVXERR_OPT_PROXYPORTS ) ).Execute();
+ }
+}
+
+/********************************************************************/
+/********************************************************************/
+/* */
+/* SvxProxyTabPage */
+/* */
+/* */
+/********************************************************************/
+/********************************************************************/
+
+SvxProxyTabPage::SvxProxyTabPage(Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_INET_PROXY ), rSet ),
+ aOptionGB (this, SVX_RES(GB_SETTINGS)),
+
+ aProxyModeFT (this, SVX_RES(FT_PROXYMODE)),
+ aProxyModeLB (this, SVX_RES(LB_PROXYMODE)),
+
+ aHttpProxyFT (this, SVX_RES( FT_HTTP_PROXY )),
+ aHttpProxyED (this, SVX_RES( ED_HTTP_PROXY )),
+ aHttpPortFT (this, SVX_RES( FT_HTTP_PORT )),
+ aHttpPortED (this, SVX_RES( ED_HTTP_PORT ), TRUE),
+
+ aHttpsProxyFT (this, SVX_RES( FT_HTTPS_PROXY )),
+ aHttpsProxyED (this, SVX_RES( ED_HTTPS_PROXY )),
+ aHttpsPortFT (this, SVX_RES( FT_HTTPS_PORT )),
+ aHttpsPortED (this, SVX_RES( ED_HTTPS_PORT ), TRUE),
+
+ aFtpProxyFT (this, SVX_RES( FT_FTP_PROXY )),
+ aFtpProxyED (this, SVX_RES( ED_FTP_PROXY )),
+ aFtpPortFT (this, SVX_RES( FT_FTP_PORT )),
+ aFtpPortED (this, SVX_RES( ED_FTP_PORT ), TRUE),
+
+ aNoProxyForFT (this, SVX_RES( FT_NOPROXYFOR )),
+ aNoProxyForED (this, SVX_RES( ED_NOPROXYFOR )),
+ aNoProxyDescFT (this, SVX_RES( ED_NOPROXYDESC )),
+ sFromBrowser ( SVX_RES( ST_PROXY_FROM_BROWSER ) ),
+ aProxyModePN(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType")),
+ aHttpProxyPN(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName")),
+ aHttpPortPN(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort")),
+ aHttpsProxyPN(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyName")),
+ aHttpsPortPN(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyPort")),
+ aFtpProxyPN(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName")),
+ aFtpPortPN(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort")),
+ aNoProxyDescPN(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy"))
+{
+ FreeResource();
+
+ aHttpPortED.SetMaxTextLen(5);
+ aHttpsPortED.SetMaxTextLen(5);
+ aFtpPortED.SetMaxTextLen(5);
+ Link aLink = LINK( this, SvxProxyTabPage, LoseFocusHdl_Impl );
+ aHttpPortED.SetLoseFocusHdl( aLink );
+ aHttpsPortED.SetLoseFocusHdl( aLink );
+ aFtpPortED.SetLoseFocusHdl( aLink );
+
+ aProxyModeLB.SetSelectHdl(LINK( this, SvxProxyTabPage, ProxyHdl_Impl ));
+
+ Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager(
+ ::comphelper::getProcessServiceFactory());
+
+ if( xServiceManager.is() )
+ {
+ try
+ {
+ Reference< com::sun::star::lang::XMultiServiceFactory > xConfigurationProvider =
+ Reference< com::sun::star::lang::XMultiServiceFactory > ( xServiceManager->createInstance( rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ) ),
+ UNO_QUERY_THROW);
+
+ OUString aConfigRoot(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings" ) );
+
+ beans::PropertyValue aProperty;
+ aProperty.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
+ aProperty.Value = makeAny( aConfigRoot );
+
+ Sequence< Any > aArgumentList( 1 );
+ aArgumentList[0] = makeAny( aProperty );
+
+ m_xConfigurationUpdateAccess = xConfigurationProvider->createInstanceWithArguments( rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ),
+ aArgumentList );
+ }
+ catch ( RuntimeException& )
+ {
+ }
+ }
+
+ ArrangeControls_Impl();
+}
+
+/*-----------------12.08.96 14.55-------------------
+
+--------------------------------------------------*/
+
+SvxProxyTabPage::~SvxProxyTabPage()
+{
+}
+
+/*-----------------12.08.96 14.55-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* SvxProxyTabPage::Create(Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxProxyTabPage(pParent, rAttrSet);
+}
+
+/*-----------------02.09.04 14.55-------------------
+
+--------------------------------------------------*/
+
+void SvxProxyTabPage::ReadConfigData_Impl()
+{
+ try {
+ Reference< container::XNameAccess > xNameAccess(m_xConfigurationUpdateAccess, UNO_QUERY_THROW);
+
+ sal_Int32 nIntValue = 0;
+ OUString aStringValue;
+
+ if( xNameAccess->getByName(aProxyModePN) >>= nIntValue )
+ {
+ aProxyModeLB.SelectEntryPos( (USHORT) nIntValue );
+ }
+
+ if( xNameAccess->getByName(aHttpProxyPN) >>= aStringValue )
+ {
+ aHttpProxyED.SetText( aStringValue );
+ }
+
+ if( xNameAccess->getByName(aHttpPortPN) >>= nIntValue )
+ {
+ aHttpPortED.SetText( String::CreateFromInt32( nIntValue ));
+ }
+
+ if( xNameAccess->getByName(aHttpsProxyPN) >>= aStringValue )
+ {
+ aHttpsProxyED.SetText( aStringValue );
+ }
+
+ if( xNameAccess->getByName(aHttpsPortPN) >>= nIntValue )
+ {
+ aHttpsPortED.SetText( String::CreateFromInt32( nIntValue ));
+ }
+
+ if( xNameAccess->getByName(aFtpProxyPN) >>= aStringValue )
+ {
+ aFtpProxyED.SetText( aStringValue );
+ }
+
+ if( xNameAccess->getByName(aFtpPortPN) >>= nIntValue )
+ {
+ aFtpPortED.SetText( String::CreateFromInt32( nIntValue ));
+ }
+
+ if( xNameAccess->getByName(aNoProxyDescPN) >>= aStringValue )
+ {
+ aNoProxyForED.SetText( aStringValue );
+ }
+ }
+
+ catch(container::NoSuchElementException e) {
+ OSL_TRACE( "SvxProxyTabPage::ReadConfigData_Impl: NoSuchElementException caught" );
+ }
+
+ catch(com::sun::star::lang::WrappedTargetException e) {
+ OSL_TRACE( "SvxProxyTabPage::ReadConfigData_Impl: WrappedTargetException caught" );
+ }
+
+ catch(RuntimeException e) {
+ OSL_TRACE( "SvxProxyTabPage::ReadConfigData_Impl: RuntimeException caught" );
+ }
+
+}
+
+/*-----------------02.09.04 14.55-------------------
+
+--------------------------------------------------*/
+
+void SvxProxyTabPage::ReadConfigDefaults_Impl()
+{
+ try
+ {
+ Reference< beans::XPropertyState > xPropertyState(m_xConfigurationUpdateAccess, UNO_QUERY_THROW);
+
+ sal_Int32 nIntValue = 0;
+ OUString aStringValue;
+
+ if( xPropertyState->getPropertyDefault(aHttpProxyPN) >>= aStringValue )
+ {
+ aHttpProxyED.SetText( aStringValue );
+ }
+
+ if( xPropertyState->getPropertyDefault(aHttpPortPN) >>= nIntValue )
+ {
+ aHttpPortED.SetText( String::CreateFromInt32( nIntValue ));
+ }
+
+ if( xPropertyState->getPropertyDefault(aHttpsProxyPN) >>= aStringValue )
+ {
+ aHttpsProxyED.SetText( aStringValue );
+ }
+
+ if( xPropertyState->getPropertyDefault(aHttpsPortPN) >>= nIntValue )
+ {
+ aHttpsPortED.SetText( String::CreateFromInt32( nIntValue ));
+ }
+
+ if( xPropertyState->getPropertyDefault(aFtpProxyPN) >>= aStringValue )
+ {
+ aFtpProxyED.SetText( aStringValue );
+ }
+
+ if( xPropertyState->getPropertyDefault(aFtpPortPN) >>= nIntValue )
+ {
+ aFtpPortED.SetText( String::CreateFromInt32( nIntValue ));
+ }
+
+ if( xPropertyState->getPropertyDefault(aNoProxyDescPN) >>= aStringValue )
+ {
+ aNoProxyForED.SetText( aStringValue );
+ }
+ }
+ catch(beans::UnknownPropertyException e)
+ {
+ OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: UnknownPropertyException caught" );
+ }
+
+ catch(com::sun::star::lang::WrappedTargetException e) {
+ OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: WrappedTargetException caught" );
+ }
+
+ catch(RuntimeException e)
+ {
+ OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: RuntimeException caught" );
+ }
+}
+
+/*-----------------02.09.04 14.55-------------------
+
+--------------------------------------------------*/
+
+void SvxProxyTabPage::RestoreConfigDefaults_Impl()
+{
+ try
+ {
+ Reference< beans::XPropertyState > xPropertyState(m_xConfigurationUpdateAccess, UNO_QUERY_THROW);
+
+ xPropertyState->setPropertyToDefault(aProxyModePN);
+ xPropertyState->setPropertyToDefault(aHttpProxyPN);
+ xPropertyState->setPropertyToDefault(aHttpPortPN);
+ xPropertyState->setPropertyToDefault(aHttpsProxyPN);
+ xPropertyState->setPropertyToDefault(aHttpsPortPN);
+ xPropertyState->setPropertyToDefault(aFtpProxyPN);
+ xPropertyState->setPropertyToDefault(aFtpPortPN);
+ xPropertyState->setPropertyToDefault(aNoProxyDescPN);
+
+ Reference< util::XChangesBatch > xChangesBatch(m_xConfigurationUpdateAccess, UNO_QUERY_THROW);
+ xChangesBatch->commitChanges();
+ }
+
+ catch(beans::UnknownPropertyException e)
+ {
+ OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: UnknownPropertyException caught" );
+ }
+
+ catch(com::sun::star::lang::WrappedTargetException e) {
+ OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: WrappedTargetException caught" );
+ }
+
+ catch(RuntimeException e)
+ {
+ OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: RuntimeException caught" );
+ }
+}
+
+/*-----------------12.08.96 14.55-------------------
+
+--------------------------------------------------*/
+
+void SvxProxyTabPage::Reset(const SfxItemSet&)
+{
+ ReadConfigData_Impl();
+
+ aProxyModeLB.SaveValue();
+ aHttpProxyED.SaveValue();
+ aHttpPortED.SaveValue();
+ aHttpsProxyED.SaveValue();
+ aHttpsPortED.SaveValue();
+ aFtpProxyED.SaveValue();
+ aFtpPortED.SaveValue();
+ aNoProxyForED.SaveValue();
+
+ EnableControls_Impl( aProxyModeLB.GetSelectEntryPos() == 2 );
+}
+
+/*-----------------12.08.96 16.34-------------------
+
+--------------------------------------------------*/
+
+BOOL SvxProxyTabPage::FillItemSet(SfxItemSet& )
+{
+ BOOL bModified=FALSE;
+
+ try {
+ Reference< beans::XPropertySet > xPropertySet(m_xConfigurationUpdateAccess, UNO_QUERY_THROW );
+
+ USHORT nSelPos = aProxyModeLB.GetSelectEntryPos();
+ if(aProxyModeLB.GetSavedValue() != nSelPos)
+ {
+ if( nSelPos == 1 )
+ {
+ RestoreConfigDefaults_Impl();
+ return TRUE;
+ }
+
+ xPropertySet->setPropertyValue(aProxyModePN,
+ makeAny((sal_Int32) nSelPos));
+ bModified = TRUE;
+ }
+
+ if(aHttpProxyED.GetSavedValue() != aHttpProxyED.GetText())
+ {
+ xPropertySet->setPropertyValue( aHttpProxyPN,
+ makeAny(rtl::OUString(aHttpProxyED.GetText())));
+ bModified = TRUE;
+ }
+
+ if ( aHttpPortED.GetSavedValue() != aHttpPortED.GetText() )
+ {
+ xPropertySet->setPropertyValue( aHttpPortPN,
+ makeAny(aHttpPortED.GetText().ToInt32()));
+ bModified = TRUE;
+ }
+
+ if(aHttpsProxyED.GetSavedValue() != aHttpsProxyED.GetText())
+ {
+ xPropertySet->setPropertyValue( aHttpsProxyPN,
+ makeAny(rtl::OUString(aHttpsProxyED.GetText())));
+ bModified = TRUE;
+ }
+
+ if ( aHttpsPortED.GetSavedValue() != aHttpsPortED.GetText() )
+ {
+ xPropertySet->setPropertyValue( aHttpsPortPN,
+ makeAny(aHttpsPortED.GetText().ToInt32()));
+ bModified = TRUE;
+ }
+
+ if(aFtpProxyED.GetSavedValue() != aFtpProxyED.GetText())
+ {
+ xPropertySet->setPropertyValue( aFtpProxyPN,
+ makeAny( rtl::OUString(aFtpProxyED.GetText())));
+ bModified = TRUE;
+ }
+
+ if ( aFtpPortED.GetSavedValue() != aFtpPortED.GetText() )
+ {
+ xPropertySet->setPropertyValue( aFtpPortPN,
+ makeAny(aFtpPortED.GetText().ToInt32()));
+ bModified = TRUE;
+ }
+
+ if ( aNoProxyForED.GetSavedValue() != aNoProxyForED.GetText() )
+ {
+ xPropertySet->setPropertyValue( aNoProxyDescPN,
+ makeAny( rtl::OUString(aNoProxyForED.GetText())));
+ bModified = TRUE;
+ }
+
+ Reference< util::XChangesBatch > xChangesBatch(m_xConfigurationUpdateAccess, UNO_QUERY_THROW);
+ xChangesBatch->commitChanges();
+ }
+
+ catch(com::sun::star::lang::IllegalArgumentException e) {
+ OSL_TRACE( "SvxProxyTabPage::FillItemSet: IllegalArgumentException caught" );
+ }
+
+ catch(beans::UnknownPropertyException e) {
+ OSL_TRACE( "SvxProxyTabPage::FillItemSet: UnknownPropertyException caught" );
+ }
+
+ catch(beans::PropertyVetoException e) {
+ OSL_TRACE( "SvxProxyTabPage::FillItemSet: PropertyVetoException caught" );
+ }
+
+ catch(com::sun::star::lang::WrappedTargetException e) {
+ OSL_TRACE( "SvxProxyTabPage::FillItemSet: WrappedTargetException caught" );
+ }
+
+ catch(RuntimeException e) {
+ OSL_TRACE( "SvxProxyTabPage::FillItemSet: RuntimeException caught" );
+ }
+
+ return bModified;
+}
+
+void SvxProxyTabPage::ArrangeControls_Impl()
+{
+ //-->Calculate dynamical width of controls, add buy wuy for i71445 Time: 2007.02.27
+ long nWidth = aProxyModeFT.GetCtrlTextWidth( aProxyModeFT.GetText() );
+ long nTemp = aHttpProxyFT.GetCtrlTextWidth( aHttpProxyFT.GetText() );
+ if ( nTemp > nWidth )
+ nWidth = nTemp;
+ nTemp = aHttpsProxyFT.GetCtrlTextWidth( aHttpsProxyFT.GetText() );
+ if ( nTemp > nWidth )
+ nWidth = nTemp;
+ nTemp = aFtpProxyFT.GetCtrlTextWidth( aFtpProxyFT.GetText() );
+ if ( nTemp > nWidth )
+ nWidth = nTemp;
+ nTemp = aNoProxyForFT.GetCtrlTextWidth( aNoProxyForFT.GetText() );
+ if ( nTemp > nWidth )
+ nWidth = nTemp;
+
+ nWidth += 10; // To be sure the length of the FixedText is enough on all platforms
+ const long nFTWidth = aProxyModeFT.GetSizePixel().Width();
+ if ( nWidth > nFTWidth )
+ {
+ Size aNewSize = aProxyModeFT.GetSizePixel();
+ aNewSize.Width() = nWidth;
+
+ aProxyModeFT.SetSizePixel( aNewSize );
+ aHttpProxyFT.SetSizePixel( aNewSize );
+ aHttpsProxyFT.SetSizePixel( aNewSize );
+ aFtpProxyFT.SetSizePixel( aNewSize );
+ aNoProxyForFT.SetSizePixel( aNewSize );
+
+ const long nDelta = nWidth - nFTWidth;
+ Point aNewPos = aProxyModeLB.GetPosPixel();
+ aNewPos.X() += nDelta;
+
+ aProxyModeLB.SetPosPixel( aNewPos );
+
+ aNewSize = aHttpProxyED.GetSizePixel();
+ aNewSize.Width() -= nDelta;
+
+ aNewPos.Y() = aHttpProxyED.GetPosPixel().Y();
+ aHttpProxyED.SetPosSizePixel( aNewPos, aNewSize );
+ aNewPos.Y() = aHttpsProxyED.GetPosPixel().Y();
+ aHttpsProxyED.SetPosSizePixel( aNewPos, aNewSize );
+ aNewPos.Y() = aFtpProxyED.GetPosPixel().Y();
+ aFtpProxyED.SetPosSizePixel( aNewPos, aNewSize );
+ aNewPos.Y() = aNoProxyForED.GetPosPixel().Y();
+ aNoProxyForED.SetPosSizePixel( aNewPos, aNewSize );
+ }
+ //<--End buy wuy for i71445 Time: 2007.02.27
+}
+
+/*-----------------12.08.96 13.38-------------------
+
+--------------------------------------------------*/
+void SvxProxyTabPage::EnableControls_Impl(BOOL bEnable)
+{
+ aHttpProxyFT.Enable(bEnable);
+ aHttpProxyED.Enable(bEnable);
+ aHttpPortFT.Enable(bEnable);
+ aHttpPortED.Enable(bEnable);
+
+ aHttpsProxyFT.Enable(bEnable);
+ aHttpsProxyED.Enable(bEnable);
+ aHttpsPortFT.Enable(bEnable);
+ aHttpsPortED.Enable(bEnable);
+
+ aFtpProxyFT.Enable(bEnable);
+ aFtpProxyED.Enable(bEnable);
+ aFtpPortFT.Enable(bEnable);
+ aFtpPortED.Enable(bEnable);
+
+ aNoProxyForFT.Enable(bEnable);
+ aNoProxyForED.Enable(bEnable);
+ aNoProxyDescFT.Enable(bEnable);
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxProxyTabPage, ProxyHdl_Impl, ListBox *, pBox )
+{
+ USHORT nPos = pBox->GetSelectEntryPos();
+
+ // Restore original system values
+ if( nPos == 1 )
+ {
+ ReadConfigDefaults_Impl();
+ }
+
+ EnableControls_Impl(nPos == 2);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxProxyTabPage, LoseFocusHdl_Impl, Edit *, pEdit )
+{
+ XubString aValue = pEdit->GetText();
+
+ if ( !ByteString(::rtl::OUStringToOString(aValue,RTL_TEXTENCODING_UTF8)).IsNumericAscii() || (long)aValue.ToInt32() > USHRT_MAX )
+ pEdit->SetText( '0' );
+ return 0;
+}
+
+
+/********************************************************************/
+/********************************************************************/
+/* */
+/* SvxSearchTabPage */
+/* */
+/* */
+/********************************************************************/
+/********************************************************************/
+
+SvxSearchTabPage::SvxSearchTabPage(Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_INET_SEARCH ), rSet ),
+
+ aSearchGB ( this, SVX_RES( GB_SEARCH ) ),
+ aSearchLB ( this, SVX_RES( LB_SEARCH ) ),
+ aSearchNameFT ( this, SVX_RES( FT_SEARCH_NAME ) ),
+ aSearchNameED ( this, SVX_RES( ED_SEARCH_NAME ) ),
+ aSearchFT ( this, SVX_RES( FT_SEARCH ) ),
+ aAndRB ( this, SVX_RES( RB_AND ) ),
+ aOrRB ( this, SVX_RES( RB_OR ) ),
+ aExactRB ( this, SVX_RES( RB_EXACT ) ),
+
+ aURLFT ( this, SVX_RES( FT_URL ) ),
+ aURLED ( this, SVX_RES( ED_URL ) ),
+
+ aPostFixFT ( this, SVX_RES( FT_POSTFIX ) ),
+ aPostFixED ( this, SVX_RES( ED_POSTFIX ) ),
+ aSeparatorFT ( this, SVX_RES( FT_SEPARATOR ) ),
+ aSeparatorED ( this, SVX_RES( ED_SEPARATOR ) ),
+ aCaseFT ( this, SVX_RES( FT_CASE ) ),
+ aCaseED ( this, SVX_RES( ED_CASE ) ),
+
+ aNewPB ( this, SVX_RES( PB_NEW ) ),
+ aAddPB ( this, SVX_RES( PB_ADD ) ),
+ aChangePB ( this, SVX_RES( PB_CHANGE ) ),
+ aDeletePB ( this, SVX_RES( PB_DELETE ) ),
+
+ sModifyMsg(SVX_RES(MSG_MODIFY))
+{
+ FreeResource();
+
+ SetExchangeSupport();
+ aCaseED.SelectEntryPos(0); // falls kein Eintrag vorhanden ist, kann es sonst "Arger geben
+
+ aNewPB.SetClickHdl(LINK( this, SvxSearchTabPage, NewSearchHdl_Impl ) );
+ aAddPB.SetClickHdl(LINK( this, SvxSearchTabPage, AddSearchHdl_Impl ) );
+ aChangePB.SetClickHdl(LINK( this, SvxSearchTabPage, ChangeSearchHdl_Impl ) );
+ aDeletePB.SetClickHdl(LINK( this, SvxSearchTabPage, DeleteSearchHdl_Impl ) );
+ aSearchLB.SetSelectHdl(LINK( this, SvxSearchTabPage, SearchEntryHdl_Impl ) );
+
+ Link aLink = LINK( this, SvxSearchTabPage, SearchModifyHdl_Impl );
+ aSearchNameED.SetModifyHdl( aLink );
+ aURLED.SetModifyHdl( aLink );
+ aSeparatorED.SetModifyHdl( aLink );
+ aPostFixED.SetModifyHdl( aLink );
+ aCaseED.SetSelectHdl( aLink );
+
+ aLink = LINK( this, SvxSearchTabPage, SearchPartHdl_Impl );
+ aAndRB.SetClickHdl( aLink );
+ aOrRB.SetClickHdl( aLink );
+ aExactRB.SetClickHdl( aLink );
+
+ InitControls_Impl();
+}
+
+// -----------------------------------------------------------------------
+SvxSearchTabPage::~SvxSearchTabPage()
+{
+}
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxSearchTabPage::Create(Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxSearchTabPage(pParent, rAttrSet);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchTabPage::Reset( const SfxItemSet& )
+{
+ //The two lines below are moved here from the last part of this method by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ aChangePB.Disable();
+ aAddPB.Disable();
+
+ sal_uInt16 nCount = aSearchConfig.Count();
+ aSearchLB.Clear(); //add by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ const SvxSearchEngineData& rData = aSearchConfig.GetData(i);
+ aSearchLB.InsertEntry(rData.sEngineName);
+ }
+
+ if ( nCount )
+ {
+ aSearchLB.SelectEntryPos(0);
+ SearchEntryHdl_Impl( &aSearchLB );
+ }
+ else
+ aDeletePB.Disable();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxSearchTabPage::FillItemSet( SfxItemSet& )
+{
+ if(aSearchConfig.IsModified())
+ aSearchConfig.Commit();
+ return TRUE;
+}
+/*--------------------------------------------------------------------*/
+
+void SvxSearchTabPage::ActivatePage( const SfxItemSet& )
+{
+}
+
+/*--------------------------------------------------------------------*/
+
+int SvxSearchTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ //Modified by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ if(!ConfirmLeave(String()))
+ return KEEP_PAGE;
+
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+//add by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+BOOL SvxSearchTabPage::ConfirmLeave( const String& rStringSelection)
+{
+ if(aChangePB.IsEnabled())
+ {
+ QueryBox aQuery(this, WB_YES_NO_CANCEL|WB_DEF_YES, sModifyMsg);
+ USHORT nRet = aQuery.Execute();
+ if(RET_CANCEL == nRet)
+ {
+ if(rStringSelection.Len())
+ aSearchLB.SelectEntry(sLastSelectedEntry);
+ return FALSE;
+ }
+ else if(RET_YES == nRet)
+ {
+ USHORT nEntryPos = aSearchLB.GetEntryPos( aSearchNameED.GetText() );
+ if ( nEntryPos != LISTBOX_ENTRY_NOTFOUND )
+ aSearchLB.SelectEntryPos(nEntryPos);
+ else
+ aSearchLB.SetNoSelection();
+ ChangeSearchHdl_Impl(0);
+ if(rStringSelection.Len())
+ aSearchLB.SelectEntry(rStringSelection);
+ }
+ else if(RET_NO == nRet)
+ {
+ aChangePB.Enable(FALSE);
+ aAddPB.Enable(FALSE);
+ SearchEntryHdl_Impl(&aSearchLB);
+ }
+ }
+ if(aAddPB.IsEnabled())
+ {
+ QueryBox aQuery(this, WB_YES_NO_CANCEL|WB_DEF_YES, sModifyMsg);
+ USHORT nRet = aQuery.Execute();
+ if(RET_CANCEL == nRet)
+ {
+ aSearchLB.SetNoSelection();
+ return FALSE;
+ }
+ else if(RET_YES == nRet)
+ {
+ aSearchLB.SetNoSelection();
+ AddSearchHdl_Impl(0);
+ if(rStringSelection.Len())
+ aSearchLB.SelectEntry(rStringSelection);
+ }
+ else if(RET_NO == nRet)
+ {
+ aAddPB.Enable(FALSE);
+ aChangePB.Enable(FALSE);
+ NewSearchHdl_Impl(0);
+ }
+
+ }
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchTabPage::InitControls_Impl()
+{
+ // detect longest label text
+ sal_Int32 i = 0;
+ long nLabelTextWidth = 0;
+ Window* pLabels[] = { &aSearchNameFT, &aSearchFT, &aURLFT, &aPostFixFT, &aSeparatorFT, &aCaseFT };
+ Window** pLabel = pLabels;
+ const sal_Int32 nLabelCount = sizeof( pLabels ) / sizeof( pLabels[0] );
+ for ( ; i < nLabelCount; ++i, ++pLabel )
+ {
+ long nTemp = (*pLabel)->GetCtrlTextWidth( (*pLabel)->GetText() );
+ if ( nTemp > nLabelTextWidth )
+ nLabelTextWidth = nTemp;
+ }
+
+ // resize all labels
+ nLabelTextWidth = nLabelTextWidth * 120 / 100; // additional space looks better
+ const long nLabelWidth = aSearchNameFT.GetSizePixel().Width();
+ const long nDelta = nLabelWidth - nLabelTextWidth;
+ pLabel = pLabels;
+ for ( i = 0; i < nLabelCount; ++i, ++pLabel )
+ {
+ Size aNewSize = (*pLabel)->GetSizePixel();
+ aNewSize.Width() += nDelta;
+ (*pLabel)->SetSizePixel( aNewSize );
+ }
+
+ // resize and move the edits
+ Window* pEdits[] = { &aSearchNameED, &aAndRB, &aOrRB,
+ &aExactRB, &aURLED, &aPostFixED, &aSeparatorED, &aCaseED };
+ Window** pEdit = pEdits;
+ const sal_Int32 nCCount = sizeof( pEdits ) / sizeof( pEdits[ 0 ] );
+ for ( i = 0; i < nCCount; ++i, ++pEdit )
+ {
+ Point aNewPos = (*pEdit)->GetPosPixel();
+ aNewPos.X() -= nDelta;
+ Size aNewSize = (*pEdit)->GetSizePixel();
+ if ( (*pEdit) != &aSeparatorED && (*pEdit) != &aCaseED )
+ aNewSize.Width() += nDelta;
+ (*pEdit)->SetPosSizePixel( aNewPos, aNewSize );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, NewSearchHdl_Impl, PushButton *, EMPTYARG )
+{
+ //The 3 lines below is modified by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ SearchEntryHdl_Impl(&aSearchLB);
+ if(aChangePB.IsEnabled() || aAddPB.IsEnabled())
+ return 0;
+ aSearchNameED.SetText( String() );
+ aSearchLB.SetNoSelection();
+ aCurrentSrchData = SvxSearchEngineData();
+ aAndRB.Check( TRUE );
+ SearchEntryHdl_Impl( &aSearchLB );
+ SearchPartHdl_Impl( &aAndRB );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, AddSearchHdl_Impl, PushButton *, EMPTYARG )
+{
+ //The following two lines is added by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ aAddPB.Enable(FALSE);
+ aChangePB.Enable(FALSE);
+ aCurrentSrchData.sEngineName = aSearchNameED.GetText();
+ aSearchConfig.SetData(aCurrentSrchData);
+ aSearchLB.InsertEntry( aCurrentSrchData.sEngineName );
+ aSearchLB.SelectEntry( aCurrentSrchData.sEngineName );
+ SearchEntryHdl_Impl( &aSearchLB );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, ChangeSearchHdl_Impl, PushButton *, EMPTYARG )
+{
+ //The following two lines is added by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ aChangePB.Enable(FALSE);
+ aAddPB.Enable(FALSE);
+ USHORT nPos = aSearchLB.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ String sEngine = aSearchLB.GetSelectEntry();
+ aCurrentSrchData.sEngineName = sEngine;
+ aSearchConfig.SetData(aCurrentSrchData);
+ aSearchLB.SelectEntry(sEngine);
+ SearchEntryHdl_Impl(&aSearchLB);
+ }
+ else
+ {
+ SetUpdateMode(FALSE);
+ String sEntry = aSearchNameED.GetText();
+ // im AddHdl wird sLastSelectedEntry umgesetzt
+ String sTemp(sLastSelectedEntry);
+ AddSearchHdl_Impl(0);
+ aSearchLB.SelectEntry(sTemp);
+ DeleteSearchHdl_Impl(0);
+ aSearchLB.SelectEntry(sEntry);
+ SearchEntryHdl_Impl(&aSearchLB);
+ SetUpdateMode(TRUE);
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, DeleteSearchHdl_Impl, PushButton *, EMPTYARG)
+{
+ aChangePB.Enable(FALSE); //add by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ USHORT nPos = aSearchLB.GetSelectEntryPos();
+ DBG_ASSERT(nPos != LISTBOX_ENTRY_NOTFOUND, "kein Eintrag selektiert!");
+ aSearchConfig.RemoveData(aSearchLB.GetSelectEntry());
+ aSearchLB.RemoveEntry(nPos);
+ aSearchLB.SelectEntryPos(0);
+ SearchEntryHdl_Impl(&aSearchLB);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, SearchEntryHdl_Impl, ListBox*, pBox )
+{
+ USHORT nEntryPos = pBox->GetSelectEntryPos();
+ if ( nEntryPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ String sSelection(pBox->GetSelectEntry());
+ //Modified by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ if(!ConfirmLeave(sSelection))
+ return 0;
+
+ const SvxSearchEngineData* pData = aSearchConfig.GetData(sSelection);
+ DBG_ASSERT(pData, "SearchEngine not available");
+ if(pData)
+ {
+ aSearchNameED.SetText(sSelection);
+ sLastSelectedEntry = sSelection;
+ sal_Bool bAnd = aAndRB.IsChecked();
+ sal_Bool bOr = aOrRB.IsChecked();
+
+ aURLED.SetText(bAnd ? pData->sAndPrefix : bOr ? pData->sOrPrefix : pData->sExactPrefix);
+ aSeparatorED.SetText( bAnd ? pData->sAndSeparator : bOr ? pData->sOrSeparator : pData->sExactSeparator);
+ aPostFixED.SetText(bAnd ? pData->sAndSuffix : bOr ? pData->sOrSuffix : pData->sExactSuffix );
+ sal_Int32 nCase = bAnd ? pData->nAndCaseMatch : bOr ? pData->nOrCaseMatch : pData->nExactCaseMatch;
+ aCaseED.SelectEntryPos( (USHORT)nCase );
+ aCurrentSrchData = *pData;
+ }
+ aDeletePB.Enable();
+ }
+ else
+ {
+ aDeletePB.Enable(FALSE);
+ sLastSelectedEntry.Erase();
+ }
+ aChangePB.Enable(FALSE);
+ aAddPB.Enable(FALSE);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, SearchModifyHdl_Impl, SvxNoSpaceEdit*, pEdit )
+{
+ if ( pEdit == &aSearchNameED )
+ {
+ BOOL bTextLen = ( 0 != pEdit->GetText().Len() );
+ BOOL bFound = FALSE;
+ if ( bTextLen )
+ {
+ USHORT nEntryPos = aSearchLB.GetEntryPos( pEdit->GetText() );
+ bFound = ( nEntryPos != LISTBOX_ENTRY_NOTFOUND );
+ if ( bFound )
+ aSearchLB.SelectEntryPos(nEntryPos);
+ else
+ aSearchLB.SetNoSelection();
+ }
+ aChangePB.Enable( sLastSelectedEntry.Len() > 0 );
+ aDeletePB.Enable(bFound);
+ aAddPB.Enable(bTextLen && !bFound);
+ }
+ else
+ {
+ if ( aSearchLB.GetSelectEntryCount() && sLastSelectedEntry.Len() > 0 )
+ aChangePB.Enable();
+
+ if(aAndRB.IsChecked())
+ {
+ aCurrentSrchData.sAndPrefix = aURLED.GetText();
+ aCurrentSrchData.sAndSeparator = aSeparatorED.GetText();
+ aCurrentSrchData.sAndSuffix = aPostFixED.GetText();
+ aCurrentSrchData.nAndCaseMatch = aCaseED.GetSelectEntryPos();
+ }
+ else if(aOrRB.IsChecked())
+ {
+ aCurrentSrchData.sOrPrefix = aURLED.GetText();
+ aCurrentSrchData.sOrSeparator = aSeparatorED.GetText();
+ aCurrentSrchData.sOrSuffix = aPostFixED.GetText();
+ aCurrentSrchData.nOrCaseMatch = aCaseED.GetSelectEntryPos();
+ }
+ else
+ {
+ aCurrentSrchData.sExactPrefix = aURLED.GetText();
+ aCurrentSrchData.sExactSeparator = aSeparatorED.GetText();
+ aCurrentSrchData.sExactSuffix = aPostFixED.GetText();
+ aCurrentSrchData.nExactCaseMatch = aCaseED.GetSelectEntryPos();
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, SearchPartHdl_Impl, RadioButton *, EMPTYARG )
+{
+ sal_Bool bAnd = aAndRB.IsChecked();
+ sal_Bool bOr = aOrRB.IsChecked();
+
+ aURLED.SetText(bAnd ? aCurrentSrchData.sAndPrefix : bOr ? aCurrentSrchData.sOrPrefix : aCurrentSrchData.sExactPrefix);
+ aSeparatorED.SetText( bAnd ? aCurrentSrchData.sAndSeparator : bOr ? aCurrentSrchData.sOrSeparator : aCurrentSrchData.sExactSeparator);
+ aPostFixED.SetText(bAnd ? aCurrentSrchData.sAndSuffix : bOr ? aCurrentSrchData.sOrSuffix : aCurrentSrchData.sExactSuffix );
+ sal_Int32 nCase = bAnd ? aCurrentSrchData.nAndCaseMatch : bOr ? aCurrentSrchData.nOrCaseMatch : aCurrentSrchData.nExactCaseMatch;
+ aCaseED.SelectEntryPos( (USHORT)nCase );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+/********************************************************************/
+/********************************************************************/
+/* */
+/* SvxOtherTabPage */
+/* */
+/********************************************************************/
+/********************************************************************/
+
+/*-----------------15.05.97 09:51-------------------
+
+--------------------------------------------------*/
+/*
+SvxPatternField::SvxPatternField( Window* pParent, const ResId& rResId ) :
+
+ PatternField( pParent, rResId ),
+
+ sMsg233 ( ResId( ST_MSG_233 ) ),
+ sMsg255 ( ResId( ST_MSG_255 ) )
+
+{
+ FreeResource();
+ SelectFixedFont();
+} */
+
+/*-----------------15.05.97 09:51-------------------
+
+--------------------------------------------------*/
+
+/*void SvxPatternField::KeyInput( const KeyEvent& rKEvt )
+{
+ PatternField::KeyInput( rKEvt );
+ BOOL bDelete = ( rKEvt.GetKeyCode().GetCode() == KEY_DELETE );
+ String sEntry( GetText() );
+ sEntry[(USHORT)3] = '.';
+ sEntry[(USHORT)7] = '.';
+ sEntry[(USHORT)11] = '.';
+ Selection aSelection( GetSelection() );
+ String sPart( sEntry.GetToken( 0, '.' ) );
+ USHORT i, nPart( sPart.EraseLeadingChars() );
+ BOOL bSet = FALSE;
+
+ if ( sPart.Len() && ( !nPart || nPart > 255 ) )
+ {
+ // der erste Part darf nicht 0 und nicht gr"osser 255 sein
+ String sMsg( sPart );
+ sMsg += ' ';
+ sMsg += sMsg233;
+ InfoBox( this, sMsg ).Execute();
+
+ if ( nPart == 0 )
+ sPart = " 1";
+ else
+ sPart = "255";
+ sEntry.SetToken( 0, '.', sPart );
+ bSet = TRUE;
+ };
+
+ for ( i = 1; i < 4; i++ )
+ {
+ // die anderen Parts d"urfen nicht gr"osser 255 sein
+ sPart = sEntry.GetToken( i, '.' );
+ nPart = sPart.EraseLeadingChars();
+
+ if ( nPart > 255 )
+ {
+ String sMsg( sPart );
+ sMsg += ' ';
+ sMsg += sMsg255;
+ InfoBox( this, sMsg ).Execute();
+
+ if ( nPart == 0 )
+ sPart = " 1";
+ else
+ sPart = "255";
+ sEntry.SetToken( i, '.', sPart );
+ bSet = TRUE;
+ };
+ }
+
+ if ( bSet )
+ {
+ SetText( sEntry );
+ SetSelection( aSelection );
+ }
+}
+*/
+// -----------------------------------------------------------------------
+#if 0
+long SvxPatternField::Notify( NotifyEvent& rNEvt )
+{
+ return PatternField::Notify( rNEvt );
+/*! long nHandled = 0;
+
+ if ( rNEvt.GetType() == EVENT_KEYUP )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ KeyInput( *pKEvt );
+ nHandled = 1;
+ }
+ return nHandled;*/
+}
+#endif
+
+// class JavaScriptDisableQueryBox_Impl --------------------------------------
+
+class JavaScriptDisableQueryBox_Impl : public ModalDialog
+{
+private:
+ FixedImage aImage;
+ FixedText aWarningFT;
+ CheckBox aDisableCB;
+ OKButton aYesBtn;
+ CancelButton aNoBtn;
+
+public:
+ JavaScriptDisableQueryBox_Impl( Window* pParent );
+
+ BOOL IsWarningDisabled() const { return aDisableCB.IsChecked(); }
+};
+
+JavaScriptDisableQueryBox_Impl::JavaScriptDisableQueryBox_Impl( Window* pParent ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_OPT_JAVASCRIPT_DISABLE ) ),
+
+ aImage ( this, SVX_RES( IMG_JSCPT_WARNING ) ),
+ aWarningFT ( this, SVX_RES( FT_JSCPT_WARNING ) ),
+ aDisableCB ( this, SVX_RES( CB_JSCPT_DISABLE ) ),
+ aYesBtn ( this, SVX_RES( BTN_JSCPT_YES ) ),
+ aNoBtn ( this, SVX_RES( BTN_JSCPT_NO ) )
+
+{
+ FreeResource();
+
+ aYesBtn.SetText( Button::GetStandardText( BUTTON_YES ) );
+ aNoBtn.SetText( Button::GetStandardText( BUTTON_NO ) );
+ aImage.SetImage( WarningBox::GetStandardImage() );
+}
+
+//#98647#----------------------------------------------
+void SvxScriptExecListBox::RequestHelp( const HelpEvent& rHEvt )
+{ // try to show tips just like as on toolbars
+ USHORT nPos=LISTBOX_ENTRY_NOTFOUND;
+ USHORT nTop = GetTopEntry();
+ USHORT nCount = GetDisplayLineCount(); // Attention: Not GetLineCount()
+ Point aPt = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
+ Rectangle aItemRect;
+ if( nCount > 0 ) // if there're some entries, find it.
+ for( nPos = nTop ; nPos <= nTop+nCount-1 ; nPos++ ) {
+ aItemRect = GetBoundingRectangle(nPos);
+ if( aPt.Y() < aItemRect.Top() || aPt.Y() > aItemRect.Bottom() )
+ continue;
+ else
+ break;
+ }
+ else // if not, nothing happens.
+ return;
+ String aHelpText;
+ if( nPos <= nTop+nCount-1 ) // if find the matching entry, get its content.
+ aHelpText = GetEntry(nPos);
+ if( aHelpText.Len() && GetTextWidth(aHelpText)<GetOutputSizePixel().Width() )
+ aHelpText.Erase(); // if the entry is quite short, clear the helping tip content.
+ aItemRect = Rectangle(Point(0,0),GetSizePixel());
+ aPt = Point(OutputToScreenPixel( aItemRect.TopLeft() ));
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ if( rHEvt.GetMode() == HELPMODE_BALLOON )
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aHelpText);
+ else
+ Help::ShowQuickHelp( this, aItemRect, aHelpText );
+}
+
+/********************************************************************/
+/* */
+/* SvxSecurityTabPage */
+/* */
+/********************************************************************/
+
+SvxSecurityTabPage::SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet )
+ :SfxTabPage ( pParent, SVX_RES( RID_SVXPAGE_INET_SECURITY ), rSet )
+
+ ,maSecurityOptionsFL( this, SVX_RES( FL_SEC_SECURITYOPTIONS ) )
+ ,maSecurityOptionsFI( this, SVX_RES( FI_SEC_SECURITYOPTIONS ) )
+ ,maSecurityOptionsPB( this, SVX_RES( PB_SEC_SECURITYOPTIONS ) )
+
+ ,maPasswordsFL ( this, SVX_RES( FL_SEC_PASSWORDS ) )
+ ,maSavePasswordsCB ( this, SVX_RES( CB_SEC_SAVEPASSWORDS ) )
+ ,maShowConnectionsPB( this, SVX_RES( PB_SEC_CONNECTIONS ) )
+ ,maMasterPasswordCB ( this, SVX_RES( CB_SEC_MASTERPASSWORD ) )
+ ,maMasterPasswordFI ( this, SVX_RES( FI_SEC_MASTERPASSWORD ) )
+ ,maMasterPasswordPB ( this, SVX_RES( PB_SEC_MASTERPASSWORD ) )
+
+ ,maMacroSecFL ( this, SVX_RES( FL_SEC_MACROSEC ) )
+ ,maMacroSecFI ( this, SVX_RES( FI_SEC_MACROSEC ) )
+ ,maMacroSecPB ( this, SVX_RES( PB_SEC_MACROSEC ) )
+ ,maFilesharingFL ( this, SVX_RES( FL_SEC_FILESHARING ) )
+ ,maRecommReadOnlyCB ( this, SVX_RES( CB_SEC_RECOMMREADONLY ) )
+ ,maRecordChangesCB ( this, SVX_RES( CB_SEC_RECORDCHANGES ) )
+ ,maProtectRecordsPB ( this, SVX_RES( PB_SEC_PROTRECORDS ) )
+
+ ,mpSecOptions ( new SvtSecurityOptions )
+ ,mpSecOptDlg ( NULL )
+ ,meRedlingMode ( RL_NONE )
+
+ ,msProtectRecordsStr( SVX_RES( STR_SEC_PROTRECORDS ) )
+ ,msUnprotectRecordsStr( SVX_RES( STR_SEC_UNPROTRECORDS ) )
+ ,msPasswordStoringDeactivateStr( SVX_RES( STR_SEC_NOPASSWDSAVE ) )
+
+{
+ FreeResource();
+
+ InitControls();
+
+ maSecurityOptionsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, SecurityOptionsHdl ) );
+ maSavePasswordsCB.SetClickHdl( LINK( this, SvxSecurityTabPage, SavePasswordHdl ) );
+ maMasterPasswordPB.SetClickHdl( LINK( this, SvxSecurityTabPage, MasterPasswordHdl ) );
+ maMasterPasswordCB.SetClickHdl( LINK( this, SvxSecurityTabPage, MasterPasswordCBHdl ) );
+ maShowConnectionsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, ShowPasswordsHdl ) );
+ maMacroSecPB.SetClickHdl( LINK( this, SvxSecurityTabPage, MacroSecPBHdl ) );
+ maProtectRecordsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, ProtectRecordsPBHdl ) );
+ maRecordChangesCB.SetClickHdl( LINK( this, SvxSecurityTabPage, RecordChangesCBHdl ) );
+
+ ActivatePage( rSet );
+}
+
+SvxSecurityTabPage::~SvxSecurityTabPage()
+{
+ delete mpSecOptions;
+ delete mpSecOptDlg;
+}
+
+IMPL_LINK( SvxSecurityTabPage, SecurityOptionsHdl, PushButton*, EMPTYARG )
+{
+ if ( !mpSecOptDlg )
+ mpSecOptDlg = new svx::SecurityOptionsDialog( this, mpSecOptions );
+ mpSecOptDlg->Execute();
+ return 0;
+}
+
+IMPL_LINK( SvxSecurityTabPage, SavePasswordHdl, void*, EMPTYARG )
+{
+ try
+ {
+ Reference< task::XMasterPasswordHandling > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ UNO_QUERY_THROW );
+
+ if ( maSavePasswordsCB.IsChecked() )
+ {
+ sal_Bool bOldValue = xMasterPasswd->allowPersistentStoring( sal_True );
+ xMasterPasswd->removeMasterPassword();
+ if ( xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() ) )
+ {
+ maMasterPasswordPB.Enable( TRUE );
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordCB.Enable( TRUE );
+ maMasterPasswordFI.Enable( TRUE );
+ maShowConnectionsPB.Enable( TRUE );
+ }
+ else
+ {
+ xMasterPasswd->allowPersistentStoring( bOldValue );
+ maSavePasswordsCB.Check( FALSE );
+ }
+ }
+ else
+ {
+ QueryBox aQuery( this, WB_YES_NO|WB_DEF_NO, msPasswordStoringDeactivateStr );
+ USHORT nRet = aQuery.Execute();
+
+ if( RET_YES == nRet )
+ {
+ xMasterPasswd->allowPersistentStoring( sal_False );
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordPB.Enable( FALSE );
+ maMasterPasswordCB.Enable( FALSE );
+ maMasterPasswordFI.Enable( FALSE );
+ maShowConnectionsPB.Enable( FALSE );
+ }
+ else
+ {
+ maSavePasswordsCB.Check( TRUE );
+ maMasterPasswordPB.Enable( TRUE );
+ maShowConnectionsPB.Enable( TRUE );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ maSavePasswordsCB.Check( !maSavePasswordsCB.IsChecked() );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxSecurityTabPage, MasterPasswordHdl, PushButton*, EMPTYARG )
+{
+ try
+ {
+ Reference< task::XMasterPasswordHandling > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ UNO_QUERY );
+
+ if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() )
+ xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() );
+ }
+ catch( Exception& )
+ {}
+
+ return 0;
+}
+
+IMPL_LINK( SvxSecurityTabPage, MasterPasswordCBHdl, void*, EMPTYARG )
+{
+ try
+ {
+ Reference< task::XMasterPasswordHandling2 > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ UNO_QUERY_THROW );
+
+ if ( maMasterPasswordCB.IsChecked() )
+ {
+ if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() ) )
+ {
+ maMasterPasswordPB.Enable( TRUE );
+ maMasterPasswordFI.Enable( TRUE );
+ }
+ else
+ {
+ maMasterPasswordCB.Check( FALSE );
+ maMasterPasswordPB.Enable( TRUE );
+ maMasterPasswordFI.Enable( TRUE );
+ }
+ }
+ else
+ {
+ if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->useDefaultMasterPassword( Reference< task::XInteractionHandler >() ) )
+ {
+ maMasterPasswordPB.Enable( FALSE );
+ maMasterPasswordFI.Enable( FALSE );
+ }
+ else
+ {
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordPB.Enable( TRUE );
+ maShowConnectionsPB.Enable( TRUE );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ maSavePasswordsCB.Check( !maSavePasswordsCB.IsChecked() );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxSecurityTabPage, ShowPasswordsHdl, PushButton*, EMPTYARG )
+{
+ try
+ {
+ Reference< task::XMasterPasswordHandling > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ UNO_QUERY );
+
+ if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->authorizateWithMasterPassword( Reference< task::XInteractionHandler>() ) )
+ {
+ svx::WebConnectionInfoDialog aDlg( this );
+ aDlg.Execute();
+ }
+ }
+ catch( Exception& )
+ {}
+ return 0;
+}
+
+IMPL_LINK( SvxSecurityTabPage, MacroSecPBHdl, void*, EMPTYARG )
+{
+ Reference< security::XDocumentDigitalSignatures > xD(
+ comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ), UNO_QUERY );
+ if ( xD.is() )
+ xD->manageTrustedSources();
+
+ return 0;
+}
+
+namespace
+{
+ enum RedlineFunc { RF_ON, RF_PROTECT };
+
+ const SfxBoolItem* ExecuteRecordChangesFunc( SvxSecurityTabPage::RedliningMode _eMode, RedlineFunc _eFunc, BOOL _bVal, Window* _pParent = NULL )
+ {
+ const SfxBoolItem* pRet = NULL;
+
+ if( _eMode != SvxSecurityTabPage::RL_NONE )
+ {
+ USHORT nSlot;
+ if ( _eMode == SvxSecurityTabPage::RL_WRITER )
+ nSlot = ( _eFunc == RF_ON )? FN_REDLINE_ON : FN_REDLINE_PROTECT;
+ else
+ nSlot = ( _eFunc == RF_ON )? FID_CHG_RECORD : SID_CHG_PROTECT;
+
+ // execute
+ SfxViewShell* pViewSh = SfxViewShell::Current();
+ if( pViewSh )
+ {
+ bool bNeedItem = ( _eMode == SvxSecurityTabPage::RL_WRITER || _eFunc != RF_ON );
+ SfxBoolItem* pItem = bNeedItem ? new SfxBoolItem( nSlot, _bVal ) : NULL;
+ SfxDispatcher* pDisp = pViewSh->GetDispatcher();
+ if ( _pParent )
+ {
+ OfaPtrItem aParentItem( SID_ATTR_PARENTWINDOW, _pParent );
+ pRet = static_cast< const SfxBoolItem* >(
+ pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, &aParentItem, pItem, 0L ) );
+ }
+ else
+ pRet = static_cast< const SfxBoolItem* >(
+ pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, pItem, 0L ) );
+ delete pItem;
+ }
+ }
+
+ return pRet;
+ }
+
+ bool QueryState( USHORT _nSlot, bool& _rValue )
+ {
+ bool bRet = false;
+
+ SfxViewShell* pViewSh = SfxViewShell::Current();
+ if( pViewSh )
+ {
+ const SfxPoolItem* pItem;
+ SfxDispatcher* pDisp = pViewSh->GetDispatcher();
+ bRet = SFX_ITEM_AVAILABLE <= pDisp->QueryState( _nSlot, pItem );
+ if( bRet )
+ _rValue = ( static_cast< const SfxBoolItem* >( pItem ) )->GetValue();
+ }
+
+ return bRet;
+ }
+
+ bool QueryRecordChangesProtectionState( SvxSecurityTabPage::RedliningMode _eMode, bool& _rValue )
+ {
+ bool bRet = false;
+
+ if( _eMode != SvxSecurityTabPage::RL_NONE )
+ {
+ USHORT nSlot = ( _eMode == SvxSecurityTabPage::RL_WRITER )? FN_REDLINE_PROTECT : SID_CHG_PROTECT;
+ bRet = QueryState( nSlot, _rValue );
+ }
+
+ return bRet;
+ }
+
+ bool QueryRecordChangesState( SvxSecurityTabPage::RedliningMode _eMode, bool& _rValue )
+ {
+ bool bRet = false;
+
+ if( _eMode != SvxSecurityTabPage::RL_NONE )
+ {
+ USHORT nSlot = ( _eMode == SvxSecurityTabPage::RL_WRITER )? FN_REDLINE_ON : FID_CHG_RECORD;
+ bRet = QueryState( nSlot, _rValue );
+ }
+
+ return bRet;
+ }
+}
+
+IMPL_LINK( SvxSecurityTabPage, RecordChangesCBHdl, void*, EMPTYARG )
+{
+ ExecuteRecordChangesFunc( meRedlingMode, RF_ON, maRecordChangesCB.IsChecked(), this );
+ CheckRecordChangesState();
+ return 0;
+}
+
+IMPL_LINK( SvxSecurityTabPage, ProtectRecordsPBHdl, void*, EMPTYARG )
+{
+ bool bProt;
+ QueryRecordChangesProtectionState( meRedlingMode, bProt );
+ ExecuteRecordChangesFunc( meRedlingMode, RF_PROTECT, !bProt, this );
+ CheckRecordChangesState();
+
+ if ( QueryRecordChangesProtectionState( meRedlingMode, bProt ) )
+ {
+ // RecordChangesCB is enabled if protection is off
+ maRecordChangesCB.Enable( !bProt );
+ // toggle text of button "Protect" <-> "Unprotect"
+ String sNewText = bProt ? msUnprotectRecordsStr : msProtectRecordsStr;
+ maProtectRecordsPB.SetText( sNewText );
+ }
+ return 0;
+}
+
+void SvxSecurityTabPage::CheckRecordChangesState( void )
+{
+ bool bVal;
+ if( QueryRecordChangesState( meRedlingMode, bVal ) )
+ {
+ maRecordChangesCB.Enable();
+ maRecordChangesCB.Check( bVal );
+ }
+ else
+ maRecordChangesCB.Disable(); // because now we don't know the state!
+
+ maProtectRecordsPB.Enable( QueryRecordChangesProtectionState( meRedlingMode, bVal ) );
+}
+
+void SvxSecurityTabPage::InitControls()
+{
+ // Hide all controls which belong to the macro security button in case the macro
+ // security settings managed by the macro security dialog opened via the button
+ // are all readonly or if the macros are disabled in general.
+ // @@@ Better would be to query the dialog whether it is 'useful' or not. Exposing
+ // macro security dialog implementations here, which is bad.
+ if ( mpSecOptions->IsMacroDisabled()
+ || ( mpSecOptions->IsReadOnly( SvtSecurityOptions::E_MACRO_SECLEVEL )
+ && mpSecOptions->IsReadOnly( SvtSecurityOptions::E_MACRO_TRUSTEDAUTHORS )
+ && mpSecOptions->IsReadOnly( SvtSecurityOptions::E_SECUREURLS ) ) )
+ {
+ maMacroSecFL.Hide();
+ maMacroSecFI.Hide();
+ maMacroSecPB.Hide();
+
+ // rearrange the following controls
+ Point aNewPos = maFilesharingFL.GetPosPixel();
+ long nDelta = aNewPos.Y() - maMacroSecFL.GetPosPixel().Y();
+
+ Window* pWins[] =
+ {
+ &maFilesharingFL, &maRecommReadOnlyCB, &maRecordChangesCB, &maProtectRecordsPB
+ };
+ Window** pCurrent = pWins;
+ const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[ 0 ] );
+ for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent )
+ {
+ aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+ }
+
+ // one button too small for its text?
+ sal_Int32 i = 0;
+ long nBtnTextWidth = 0;
+ Window* pButtons[] = { &maSecurityOptionsPB, &maMasterPasswordPB,
+ &maShowConnectionsPB, &maMacroSecPB, &maProtectRecordsPB };
+ Window** pButton = pButtons;
+ const sal_Int32 nBCount = sizeof( pButtons ) / sizeof( pButtons[ 0 ] );
+ for ( ; i < nBCount; ++i, ++pButton )
+ {
+ long nTemp = (*pButton)->GetCtrlTextWidth( (*pButton)->GetText() );
+ if ( nTemp > nBtnTextWidth )
+ nBtnTextWidth = nTemp;
+ }
+
+ nBtnTextWidth = nBtnTextWidth * 115 / 100; // a little offset
+ const long nButtonWidth = maSecurityOptionsPB.GetSizePixel().Width();
+ const long nMaxWidth = nButtonWidth * 140 / 100;
+ long nExtra = ( nBtnTextWidth > nMaxWidth ) ? nBtnTextWidth - nMaxWidth : 0;
+ nBtnTextWidth = std::min( nBtnTextWidth, nMaxWidth );
+
+ if ( nBtnTextWidth > nButtonWidth )
+ {
+ // so make the buttons broader and its control in front of it smaller
+ long nDelta = nBtnTextWidth - nButtonWidth;
+ pButton = pButtons;
+
+ if ( nExtra > 0 )
+ {
+ long nPos = (*pButton)->GetPosPixel().X() - nDelta;
+ long nWidth = (*pButton)->GetSizePixel().Width() + nDelta;
+ long nMaxExtra = GetOutputSizePixel().Width() - ( nPos + nWidth ) - 2;
+ nExtra = ( nExtra < nMaxExtra ) ? nExtra : nMaxExtra;
+ }
+
+ for ( i = 0; i < nBCount; ++i, ++pButton )
+ {
+ Point aNewPos = (*pButton)->GetPosPixel();
+ aNewPos.X() -= nDelta;
+ Size aNewSize = (*pButton)->GetSizePixel();
+ aNewSize.Width() += ( nDelta + nExtra );
+ (*pButton)->SetPosSizePixel( aNewPos, aNewSize );
+ }
+
+ Window* pControls[] = { &maSecurityOptionsFI, &maSavePasswordsCB,
+ &maMasterPasswordFI, &maMacroSecFI,
+ &maRecommReadOnlyCB, &maRecordChangesCB };
+ Window** pControl = pControls;
+ const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[ 0 ] );
+ for ( i = 0; i < nCCount; ++i, ++pControl )
+ {
+ Size aNewSize = (*pControl)->GetSizePixel();
+ aNewSize.Width() -= nDelta;
+ (*pControl)->SetSizePixel( aNewSize );
+ }
+ }
+
+ maMasterPasswordPB.Enable( FALSE );
+ maMasterPasswordCB.Enable( FALSE );
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordFI.Enable( FALSE );
+ maShowConnectionsPB.Enable( FALSE );
+
+ // initialize the password saving checkbox
+ try
+ {
+ Reference< task::XMasterPasswordHandling > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ UNO_QUERY_THROW );
+
+ if ( xMasterPasswd->isPersistentStoringAllowed() )
+ {
+ maMasterPasswordCB.Enable( TRUE );
+ maShowConnectionsPB.Enable( TRUE );
+ maSavePasswordsCB.Check( TRUE );
+
+ Reference< task::XMasterPasswordHandling2 > xMasterPasswd2( xMasterPasswd, UNO_QUERY );
+ if ( xMasterPasswd2.is() && xMasterPasswd2->isDefaultMasterPasswordUsed() )
+ maMasterPasswordCB.Check( FALSE );
+ else
+ {
+ maMasterPasswordPB.Enable( TRUE );
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordFI.Enable( TRUE );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ maSavePasswordsCB.Enable( FALSE );
+ }
+
+
+}
+
+SfxTabPage* SvxSecurityTabPage::Create(Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxSecurityTabPage(pParent, rAttrSet);
+}
+
+void SvxSecurityTabPage::ActivatePage( const SfxItemSet& )
+{
+}
+
+int SvxSecurityTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+namespace
+{
+/* bool Enable( const SvtSecurityOptions& _rOpt, SvtSecurityOptions::EOption _eOpt, Control& _rCtrl, FixedImage& _rImg )
+ {
+ bool b = _rOpt.IsOptionEnabled( _eOpt );
+ _rCtrl.Enable( b );
+ _Img.Show( !b );
+ return b;
+ }
+*/
+ bool EnableAndSet( const SvtSecurityOptions& _rOpt, SvtSecurityOptions::EOption _eOpt,
+ CheckBox& _rCtrl, FixedImage& _rImg )
+ {
+// bool b = Enable( _rOpt, _eOpt, _rCtrl, _rImg );
+ bool b = _rOpt.IsOptionEnabled( _eOpt );
+ _rCtrl.Enable( b );
+ _rImg.Show( !b );
+ _rCtrl.Check( _rOpt.IsOptionSet( _eOpt ) );
+ return b;
+ }
+
+ bool CheckAndSave( SvtSecurityOptions& _rOpt, SvtSecurityOptions::EOption _eOpt, const bool _bIsChecked, bool& _rModfied )
+ {
+ bool bModified = false;
+ if ( _rOpt.IsOptionEnabled( _eOpt ) )
+ {
+ bModified = _rOpt.IsOptionSet( _eOpt ) != _bIsChecked;
+ if ( bModified )
+ {
+ _rOpt.SetOption( _eOpt, _bIsChecked );
+ _rModfied = true;
+ }
+ }
+
+ return bModified;
+ }
+}
+
+BOOL SvxSecurityTabPage::FillItemSet( SfxItemSet& )
+{
+ bool bModified = false;
+
+ if ( mpSecOptDlg )
+ {
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_SAVEORSEND, mpSecOptDlg->IsSaveOrSendDocsChecked(), bModified );
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_SIGNING, mpSecOptDlg->IsSignDocsChecked(), bModified );
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_PRINT, mpSecOptDlg->IsPrintDocsChecked(), bModified );
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_CREATEPDF, mpSecOptDlg->IsCreatePdfChecked(), bModified );
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO, mpSecOptDlg->IsRemovePersInfoChecked(), bModified );
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD, mpSecOptDlg->IsRecommPasswdChecked(), bModified );
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_CTRLCLICK_HYPERLINK, mpSecOptDlg->IsCtrlHyperlinkChecked(), bModified );
+ }
+
+ // document options
+ SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
+ if( pCurDocShell )
+ {
+ if( pCurDocShell->HasSecurityOptOpenReadOnly() )
+ pCurDocShell->SetSecurityOptOpenReadOnly( maRecommReadOnlyCB.IsChecked() );
+
+ }
+
+ return bModified;
+}
+
+/*--------------------------------------------------------------------*/
+
+void SvxSecurityTabPage::Reset( const SfxItemSet& )
+{
+ String sNewText = msProtectRecordsStr;
+ SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
+ if( pCurDocShell )
+ {
+ bool bIsHTMLDoc = false;
+ SfxViewShell* pViewSh = SfxViewShell::Current();
+ if( pViewSh )
+ {
+ const SfxPoolItem* pItem;
+ SfxDispatcher* pDisp = pViewSh->GetDispatcher();
+ if ( SFX_ITEM_AVAILABLE <= pDisp->QueryState( SID_HTML_MODE, pItem ) )
+ {
+ USHORT nMode = static_cast< const SfxUInt16Item* >( pItem )->GetValue();
+ bIsHTMLDoc = ( ( nMode & HTMLMODE_ON ) != 0 );
+ }
+ }
+
+ sal_Bool bIsReadonly = pCurDocShell->IsReadOnly();
+ if( pCurDocShell->HasSecurityOptOpenReadOnly() && !bIsHTMLDoc )
+ {
+ maRecommReadOnlyCB.Check( pCurDocShell->IsSecurityOptOpenReadOnly() );
+ maRecommReadOnlyCB.Enable( !bIsReadonly );
+ }
+ else
+ maRecommReadOnlyCB.Disable();
+
+ bool bVal;
+ if ( QueryRecordChangesState( RL_WRITER, bVal ) && !bIsHTMLDoc )
+ meRedlingMode = RL_WRITER;
+ else if( QueryRecordChangesState( RL_CALC, bVal ) )
+ meRedlingMode = RL_CALC;
+ else
+ meRedlingMode = RL_NONE;
+
+ if ( meRedlingMode != RL_NONE )
+ {
+ maRecordChangesCB.Check( bVal );
+ maRecordChangesCB.Enable( !bVal && !bIsReadonly );
+ maProtectRecordsPB.Enable(
+ QueryRecordChangesProtectionState( meRedlingMode, bVal ) && !bIsReadonly );
+ // set the right text
+ if ( bVal )
+ sNewText = msUnprotectRecordsStr;
+ }
+ else
+ {
+ // only Writer and Calc support redlining
+ maRecordChangesCB.Disable();
+ maProtectRecordsPB.Disable();
+ }
+ }
+ else
+ { // no doc -> hide document settings
+ maRecommReadOnlyCB.Disable();
+ maRecordChangesCB.Disable();
+ maProtectRecordsPB.Disable();
+ }
+
+ maProtectRecordsPB.SetText( sNewText );
+}
+
+//added by jmeng begin
+MozPluginTabPage::MozPluginTabPage(Window* pParent, const SfxItemSet& rSet)
+ : SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_INET_MOZPLUGIN ), rSet ),
+ aMSWordGB ( this, SVX_RES( GB_MOZPLUGIN ) ),
+ aWBasicCodeCB ( this, SVX_RES( CB_MOZPLUGIN_CODE ) )
+{
+ FreeResource();
+}
+
+MozPluginTabPage::~MozPluginTabPage()
+{
+}
+
+SfxTabPage* MozPluginTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return new MozPluginTabPage( pParent, rAttrSet );
+}
+BOOL MozPluginTabPage::FillItemSet( SfxItemSet& )
+{
+ BOOL hasInstall = isInstalled();
+ BOOL hasChecked = aWBasicCodeCB.IsChecked();
+ if(hasInstall && (!hasChecked)){
+ //try to uninstall
+ uninstallPlugin();
+ }
+ else if((!hasInstall) && hasChecked){
+ //try to install
+ installPlugin();
+ }
+ else{
+ // do nothing
+ }
+ return TRUE;
+}
+void MozPluginTabPage::Reset( const SfxItemSet& )
+{
+ aWBasicCodeCB.Check( isInstalled());
+ aWBasicCodeCB.SaveValue();
+}
+
+#ifdef WNT
+extern "C" {
+ int lc_isInstalled(const char* realFilePath);
+ int lc_installPlugin(const char* realFilePath);
+ int lc_uninstallPlugin(const char* realFilePath);
+}
+#endif
+
+#define NPP_PATH_MAX 2048
+inline bool getDllURL(rtl::OString * path)
+{
+ OSL_ASSERT(path != NULL);
+ ::rtl::OUString dirPath/*dllPath, */;
+ if (osl_getExecutableFile(&dirPath.pData) != osl_Process_E_None) {
+ return false;
+ }
+ dirPath = dirPath.copy(0, dirPath.lastIndexOf('/'));
+// osl::FileBase::getAbsoluteFileURL(dirPath, libPath, dllPath);
+ ::rtl::OUString sysDirPath;
+ osl::FileBase::getSystemPathFromFileURL(dirPath, sysDirPath);
+ *path = OUStringToOString(sysDirPath, RTL_TEXTENCODING_ASCII_US);
+ return true;
+}
+
+BOOL MozPluginTabPage::isInstalled()
+{
+#ifdef UNIX
+ // get the real file referred by .so lnk file
+ char lnkFilePath[NPP_PATH_MAX] = {0};
+ char lnkReferFilePath[NPP_PATH_MAX] = {0};
+ char* pHome = getpwuid(getuid())->pw_dir;
+ strcat(lnkFilePath, pHome);
+ strcat(lnkFilePath, "/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION);
+
+ struct stat sBuf;
+ if (0 > lstat(lnkFilePath, &sBuf))
+ return false;
+ if (!S_ISLNK(sBuf.st_mode))
+ return false;
+ if (0 >= readlink(lnkFilePath, lnkReferFilePath, NPP_PATH_MAX))
+ return false;
+ // If the link is relative, then we regard it as non-standard
+ if (lnkReferFilePath[0] != '/')
+ return false;
+
+ // get the real file path
+ char realFilePath[NPP_PATH_MAX] = {0};
+ ::rtl::OString tempString;
+ if (!getDllURL(&tempString)) {
+ return false;
+ }
+ strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX);
+ strcat(realFilePath, "/libnpsoplugin" SAL_DLLEXTENSION);
+
+ if (0 != strcmp(lnkReferFilePath, realFilePath))
+ return false;
+ return true;
+#endif
+#ifdef WNT
+ // get the value from registry
+ BOOL ret = true;
+ ::rtl::OString tempString;
+ char realFilePath[NPP_PATH_MAX] = {0};
+ if (!getDllURL(&tempString)){
+ return false;
+ }
+ strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX);
+ if(! lc_isInstalled(realFilePath))
+ ret =true;
+ else
+ ret = false;
+ return ret;
+#endif
+}
+
+BOOL MozPluginTabPage::installPlugin()
+{
+#ifdef UNIX
+ // get the real file referred by .so lnk file
+ char lnkFilePath[NPP_PATH_MAX] = {0};
+ char* pHome = getpwuid(getuid())->pw_dir;
+ strcat(lnkFilePath, pHome);
+ strcat(lnkFilePath, "/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION);
+ remove(lnkFilePath);
+
+ // create the dirs if necessary
+ struct stat buf;
+ char tmpDir[NPP_PATH_MAX] = {0};
+ sprintf(tmpDir, "%s/.mozilla", pHome);
+ if (0 > stat(lnkFilePath, &buf))
+ {
+ mkdir(tmpDir, 0755);
+ strcat(tmpDir, "/plugins");
+ mkdir(tmpDir, 0755);
+ }
+
+ // get the real file path
+ char realFilePath[NPP_PATH_MAX] = {0};
+ ::rtl::OString tempString;
+ if (!getDllURL(&tempString)) {
+ return false;
+ }
+ strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX);
+ strcat(realFilePath, "/libnpsoplugin" SAL_DLLEXTENSION);
+
+ // create the link
+ if (0 != symlink(realFilePath, lnkFilePath))
+ return false;
+ return true;
+#endif
+#ifdef WNT
+ ::rtl::OString tempString;
+ char realFilePath[NPP_PATH_MAX] = {0};
+ if (!getDllURL(&tempString)) {
+ return false;
+ }
+ strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX);
+ if( !lc_installPlugin(realFilePath))
+ return true;
+ else
+ return false;
+#endif
+}
+
+BOOL MozPluginTabPage::uninstallPlugin()
+{
+#ifdef UNIX
+ // get the real file referred by .so lnk file
+ char lnkFilePath[NPP_PATH_MAX] = {0};
+ char* pHome = getpwuid(getuid())->pw_dir;
+ strcat(lnkFilePath, pHome);
+ strcat(lnkFilePath, "/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION);
+
+ if(0 > remove(lnkFilePath))
+ return false;
+ return true;
+#endif
+#ifdef WNT
+ ::rtl::OString tempString;
+ char realFilePath[NPP_PATH_MAX] = {0};
+ if (!getDllURL(&tempString)) {
+ return false;
+ }
+ strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX);
+ if(!lc_uninstallPlugin(realFilePath))
+ return true;
+ else
+ return false;
+#endif
+}
+//added by jmeng end
+
+/* -------------------------------------------------------------------------*/
+
+class MailerProgramCfg_Impl : public utl::ConfigItem
+{
+ friend class SvxEMailTabPage;
+ // variables
+ OUString sProgram;
+ // readonly states
+ sal_Bool bROProgram;
+
+ const Sequence<OUString> GetPropertyNames();
+public:
+ MailerProgramCfg_Impl();
+ virtual ~MailerProgramCfg_Impl();
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames);
+};
+
+/* -------------------------------------------------------------------------*/
+
+MailerProgramCfg_Impl::MailerProgramCfg_Impl() :
+ utl::ConfigItem(C2U("Office.Common/ExternalMailer")),
+ bROProgram(sal_False)
+{
+ const Sequence< OUString > aNames = GetPropertyNames();
+ const Sequence< Any > aValues = GetProperties(aNames);
+ const Sequence< sal_Bool > aROStates = GetReadOnlyStates(aNames);
+ const Any* pValues = aValues.getConstArray();
+ const sal_Bool* pROStates = aROStates.getConstArray();
+ for(sal_Int32 nProp = 0; nProp < aValues.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ switch(nProp)
+ {
+ case 0 :
+ {
+ pValues[nProp] >>= sProgram;
+ bROProgram = pROStates[nProp];
+ }
+ break;
+ }
+ }
+ }
+}
+
+/* -------------------------------------------------------------------------*/
+
+MailerProgramCfg_Impl::~MailerProgramCfg_Impl()
+{
+}
+
+/* -------------------------------------------------------------------------*/
+
+const Sequence<OUString> MailerProgramCfg_Impl::GetPropertyNames()
+{
+ Sequence<OUString> aRet(1);
+ OUString* pRet = aRet.getArray();
+ pRet[0] = C2U("Program");
+ return aRet;
+}
+
+/* -------------------------------------------------------------------------*/
+
+void MailerProgramCfg_Impl::Commit()
+{
+ const Sequence< OUString > aOrgNames = GetPropertyNames();
+ sal_Int32 nOrgCount = aOrgNames.getLength();
+
+ Sequence< OUString > aNames(nOrgCount);
+ Sequence< Any > aValues(nOrgCount);
+ sal_Int32 nRealCount = 0;
+
+ for(int nProp = 0; nProp < nOrgCount; nProp++)
+ {
+ switch(nProp)
+ {
+ case 0:
+ {
+ if (!bROProgram)
+ {
+ aNames[nRealCount] = aOrgNames[nProp];
+ aValues[nRealCount] <<= sProgram;
+ ++nRealCount;
+ }
+ }
+ break;
+ }
+ }
+
+ aNames.realloc(nRealCount);
+ aValues.realloc(nRealCount);
+ PutProperties(aNames, aValues);
+}
+
+void MailerProgramCfg_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{
+}
+
+/* -------------------------------------------------------------------------*/
+
+struct SvxEMailTabPage_Impl
+{
+ MailerProgramCfg_Impl aMailConfig;
+};
+
+SvxEMailTabPage::SvxEMailTabPage(Window* pParent, const SfxItemSet& rSet) :
+ SfxTabPage(pParent, SVX_RES( RID_SVXPAGE_INET_MAIL ), rSet),
+ aMailFL(this, SVX_RES(FL_MAIL )),
+ aMailerURLFI(this, SVX_RES(FI_MAILERURL )),
+ aMailerURLFT(this, SVX_RES(FT_MAILERURL )),
+ aMailerURLED(this, SVX_RES(ED_MAILERURL )),
+ aMailerURLPB(this, SVX_RES(PB_MAILERURL )),
+ m_sDefaultFilterName( SVX_RES(STR_DEFAULT_FILENAME )),
+ pImpl(new SvxEMailTabPage_Impl)
+{
+ FreeResource();
+
+ aMailerURLPB.SetClickHdl( LINK( this, SvxEMailTabPage, FileDialogHdl_Impl ) );
+
+ // FixedText not wide enough?
+ long nTxtW = aMailerURLFT.GetCtrlTextWidth( aMailerURLFT.GetText() );
+ long nCtrlW = aMailerURLFT.GetSizePixel().Width();
+ if ( nTxtW >= nCtrlW )
+ {
+ long nDelta = Max( (long)10, nTxtW - nCtrlW );
+ // so FixedText wider
+ Size aNewSz = aMailerURLFT.GetSizePixel();
+ aNewSz.Width() += nDelta;
+ aMailerURLFT.SetSizePixel( aNewSz );
+ // and Edit smaller
+ aNewSz = aMailerURLED.GetSizePixel();
+ aNewSz.Width() -= nDelta;
+ Point aNewPt = aMailerURLED.GetPosPixel();
+ aNewPt.X() += nDelta;
+ aMailerURLED.SetPosSizePixel( aNewPt, aNewSz );
+ }
+}
+
+/* -------------------------------------------------------------------------*/
+
+SvxEMailTabPage::~SvxEMailTabPage()
+{
+ delete pImpl;
+}
+
+/* -------------------------------------------------------------------------*/
+
+SfxTabPage* SvxEMailTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxEMailTabPage(pParent, rAttrSet);
+}
+
+/* -------------------------------------------------------------------------*/
+
+BOOL SvxEMailTabPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bMailModified = FALSE;
+ if(!pImpl->aMailConfig.bROProgram && aMailerURLED.GetSavedValue() != aMailerURLED.GetText())
+ {
+ pImpl->aMailConfig.sProgram = aMailerURLED.GetText();
+ bMailModified = TRUE;
+ }
+ if ( bMailModified )
+ pImpl->aMailConfig.Commit();
+
+ return FALSE;
+}
+
+/* -------------------------------------------------------------------------*/
+
+void SvxEMailTabPage::Reset( const SfxItemSet& )
+{
+ aMailerURLED.Enable(TRUE );
+ aMailerURLPB.Enable(TRUE );
+
+ if(pImpl->aMailConfig.bROProgram)
+ aMailerURLFI.Show();
+
+ aMailerURLED.SetText(pImpl->aMailConfig.sProgram);
+ aMailerURLED.SaveValue();
+ aMailerURLED.Enable(!pImpl->aMailConfig.bROProgram);
+ aMailerURLPB.Enable(!pImpl->aMailConfig.bROProgram);
+ aMailerURLFT.Enable(!pImpl->aMailConfig.bROProgram);
+
+ aMailFL.Enable(aMailerURLFT.IsEnabled() ||
+ aMailerURLED.IsEnabled() ||
+ aMailerURLPB.IsEnabled());
+}
+
+/* -------------------------------------------------------------------------*/
+
+IMPL_LINK( SvxEMailTabPage, FileDialogHdl_Impl, PushButton*, pButton )
+{
+ if ( &aMailerURLPB == pButton && !pImpl->aMailConfig.bROProgram )
+ {
+ FileDialogHelper aHelper(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ WB_OPEN );
+ String sPath = aMailerURLED.GetText();
+ if ( !sPath.Len() )
+ sPath.AppendAscii("/usr/bin");
+
+ String sUrl;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL(sPath,sUrl);
+ aHelper.SetDisplayDirectory(sUrl);
+ aHelper.AddFilter( m_sDefaultFilterName, String::CreateFromAscii("*"));
+
+ if ( ERRCODE_NONE == aHelper.Execute() )
+ {
+ sUrl = aHelper.GetPath();
+ ::utl::LocalFileHelper::ConvertURLToPhysicalName(sUrl,sPath);
+ aMailerURLED.SetText(sPath);
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/cui/source/options/optinet2.hrc b/cui/source/options/optinet2.hrc
new file mode 100644
index 000000000000..da394d6d249f
--- /dev/null
+++ b/cui/source/options/optinet2.hrc
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * 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: optinet2.hrc,v $
+ * $Revision: 1.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.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTINET_HRC
+#define _SVX_OPTINET_HRC
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+// Proxy ------------------------------------------------------------------
+#define GB_SETTINGS 1
+#define FT_PROXYMODE 2
+#define LB_PROXYMODE 2
+#define FT_HTTP_PROXY 3
+#define ED_HTTP_PROXY 3
+#define FT_HTTP_PORT 4
+#define ED_HTTP_PORT 4
+#define FT_FTP_PROXY 5
+#define ED_FTP_PROXY 5
+#define FT_FTP_PORT 6
+#define ED_FTP_PORT 6
+#define FT_SOCKS_PROXY 7
+#define ED_SOCKS_PROXY 7
+#define FT_SOCKS_PORT 8
+#define ED_SOCKS_PORT 8
+#define FT_NOPROXYFOR 11
+#define ED_NOPROXYFOR 11
+#define ED_NOPROXYDESC 12
+#define ST_PROXY_FROM_BROWSER 13
+#define FT_HTTPS_PROXY 14
+#define ED_HTTPS_PROXY 14
+#define FT_HTTPS_PORT 15
+#define ED_HTTPS_PORT 15
+
+// Search ------------------------------------------------------------------
+#define GB_SEARCH 40
+#define LB_SEARCH 40
+#define FT_SEARCH_NAME 41
+#define ED_SEARCH_NAME 41
+#define FT_SEARCH 42
+#define RB_AND 43
+#define RB_OR 44
+#define RB_EXACT 45
+#define FT_URL 46
+#define ED_URL 46
+#define FT_POSTFIX 47
+#define ED_POSTFIX 47
+#define FT_SEPARATOR 48
+#define ED_SEPARATOR 48
+#define FT_CASE 49
+#define ED_CASE 49
+#define PB_CHANGE 53
+#define PB_DELETE 54
+#define PB_ADD 55
+#define PB_NEW 56
+#define MSG_MODIFY 57
+
+// Protocols --------------------------------------------------------------
+#define GB_DNS 105
+#define RB_DNS_AUTO 106
+#define RB_DNS_MANUAL 107
+#define ED_DNS 107
+
+#define ST_MSG_255_0 111
+#define ST_MSG_255_1 112
+
+// Site Certificate --------------------------------------------------------
+#define GB_SITECERT 120
+#define LB_SITECERT 121
+#define LB_FILTERCERT 122
+#define PB_EDIT_CERT 123
+#define PB_DELETE_CERT 124
+
+// personal Certificate ----------------------------------------------------
+#define GB_PERSCERT 130
+#define LB_PERSCERT 131
+#define PB_NEW_PERSCERT 132
+#define PB_INFO_PERSCERT 133
+#define PB_DELETE_PERSCERT 134
+
+// Security -------------------------------------------------------------
+
+#define FL_SEC_SECURITYOPTIONS 10
+#define FI_SEC_SECURITYOPTIONS 11
+#define PB_SEC_SECURITYOPTIONS 12
+#define FL_SEC_PASSWORDS 13
+#define CB_SEC_SAVEPASSWORDS 14
+#define PB_SEC_CONNECTIONS 15
+#define CB_SEC_MASTERPASSWORD 16
+#define FI_SEC_MASTERPASSWORD 17
+#define PB_SEC_MASTERPASSWORD 18
+#define FL_SEC_MACROSEC 19
+#define FI_SEC_MACROSEC 20
+#define PB_SEC_MACROSEC 21
+#define FL_SEC_FILESHARING 22
+#define CB_SEC_RECOMMREADONLY 23
+#define CB_SEC_RECORDCHANGES 24
+#define PB_SEC_PROTRECORDS 25
+
+#define STR_SEC_PROTRECORDS 10
+#define STR_SEC_UNPROTRECORDS 11
+#define STR_SEC_NOPASSWDSAVE 12
+
+#define TP_WIDTH 260
+#define TP_HEIGHT 185
+#define OFFS_BUTTON_Y (-6)
+#define BORDER_OFFSET 8
+#define COL_0 (RSC_SP_TBPG_INNERBORDER_LEFT)
+#define COL_1 (COL_0+RSC_SP_FLGR_SPACE_X)
+#define COL_1a (COL_1+RSC_SP_CHK_TEXTINDENT)
+#define COL_4 (TP_WIDTH-RSC_SP_TBPG_INNERBORDER_RIGHT)
+#define COL_3 (COL_4-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_2 (COL_3-RSC_SP_CTRL_DESC_X)
+
+#define ROW_0 (RSC_SP_FLGR_INNERBORDER_TOP)
+#define ROW_1 (ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_2 (ROW_1+3*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_2a (ROW_2-RSC_SP_FLGR_SPACE_Y-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_3 (ROW_2+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_4 (ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_DESC_Y-1)
+#define ROW_4a (ROW_4+RSC_CD_CHECKBOX_HEIGHT+1)
+#define ROW_5 (ROW_4a+4*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_6 (ROW_5+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_7 (ROW_6+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_8 (ROW_7+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_9 (ROW_8+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_DESC_Y)
+
+// Defines - JavaScriptDisableQueryBox_Impl -------------------------------
+
+#define IMG_JSCPT_WARNING 220
+#define FT_JSCPT_WARNING 221
+#define CB_JSCPT_DISABLE 222
+#define GB_JSCPT_WARNING 223
+#define BTN_JSCPT_YES 224
+#define BTN_JSCPT_NO 225
+
+// Defines - SvxEMailTabPage_Impl
+#define FL_MAIL 1
+#define FT_MAILERURL 2
+#define FI_MAILERURL 3
+#define ED_MAILERURL 4
+#define PB_MAILERURL 5
+#define STR_DEFAULT_FILENAME 6
+
+#endif // #ifndef _SVX_OPTINET_HRC
+
+// ******************************************************************* EOF
+
diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx
new file mode 100644
index 000000000000..00d1aaadc4fc
--- /dev/null
+++ b/cui/source/options/optinet2.hxx
@@ -0,0 +1,355 @@
+/*************************************************************************
+ *
+ * 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: optinet2.hxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTINET_HXX
+#define _SVX_OPTINET_HXX
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+#include <vcl/field.hxx>
+#include <svl/svarray.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svtools/svtabbx.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/srchcfg.hxx>
+
+#ifdef _SVX_OPTINET2_CXX
+#include <svtools/headbar.hxx>
+#else
+class HeaderBar;
+#endif
+#include <readonlyimage.hxx>
+
+class SfxFilter;
+class SvtInetOptions;
+
+#ifndef SV_NODIALOG
+#define PROXY_CONTROLS 23
+#define CACHE_CONTROLS 20
+#define INET_SEARCH 19
+
+#if defined(OS2)
+#define TYPE_CONTROLS 20
+#else
+#define TYPE_CONTROLS 18
+#endif
+
+namespace svx {
+ class SecurityOptionsDialog;
+}
+
+namespace lang = ::com::sun::star::lang;
+namespace uno = ::com::sun::star::uno;
+
+// class SvxNoSpaceEdit --------------------------------------------------
+
+class SvxNoSpaceEdit : public Edit
+{
+private:
+ BOOL bOnlyNumeric;
+
+public:
+ SvxNoSpaceEdit(Window* pParent, ResId rResId, BOOL bNum = FALSE ) :
+ Edit( pParent, rResId ), bOnlyNumeric( bNum ) {}
+
+ virtual void KeyInput( const KeyEvent& rKEvent );
+ virtual void Modify();
+};
+
+typedef SfxFilter* SfxFilterPtr;
+SV_DECL_PTRARR( SfxFilterPtrArr, SfxFilterPtr, 0, 4 )
+
+// class SvxProxyTabPage -------------------------------------------------
+
+class SvxProxyTabPage : public SfxTabPage
+{
+private:
+ FixedLine aOptionGB;
+
+ FixedText aProxyModeFT;
+ ListBox aProxyModeLB;
+
+ FixedText aHttpProxyFT;
+ SvxNoSpaceEdit aHttpProxyED;
+ FixedText aHttpPortFT;
+ SvxNoSpaceEdit aHttpPortED;
+
+ FixedText aHttpsProxyFT;
+ SvxNoSpaceEdit aHttpsProxyED;
+ FixedText aHttpsPortFT;
+ SvxNoSpaceEdit aHttpsPortED;
+
+
+ FixedText aFtpProxyFT;
+ SvxNoSpaceEdit aFtpProxyED;
+ FixedText aFtpPortFT;
+ SvxNoSpaceEdit aFtpPortED;
+
+ FixedText aNoProxyForFT;
+ Edit aNoProxyForED;
+ FixedText aNoProxyDescFT;
+
+ String sFromBrowser;
+
+ const rtl::OUString aProxyModePN;
+ const rtl::OUString aHttpProxyPN;
+ const rtl::OUString aHttpPortPN;
+ const rtl::OUString aHttpsProxyPN;
+ const rtl::OUString aHttpsPortPN;
+ const rtl::OUString aFtpProxyPN;
+ const rtl::OUString aFtpPortPN;
+ const rtl::OUString aNoProxyDescPN;
+
+ uno::Reference< uno::XInterface > m_xConfigurationUpdateAccess;
+
+#ifdef _SVX_OPTINET2_CXX
+ void ArrangeControls_Impl();
+ void EnableControls_Impl(BOOL bEnable);
+ void ReadConfigData_Impl();
+ void ReadConfigDefaults_Impl();
+ void RestoreConfigDefaults_Impl();
+
+ DECL_LINK( ProxyHdl_Impl, ListBox * );
+ DECL_LINK( LoseFocusHdl_Impl, Edit * );
+#endif
+
+ SvxProxyTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~SvxProxyTabPage();
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+// class SvxSearchTabPage ------------------------------------------------
+class SvxSearchConfig;
+class SvxSearchTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ FixedLine aSearchGB;
+ ListBox aSearchLB;
+ FixedText aSearchNameFT;
+ SvxNoSpaceEdit aSearchNameED;
+
+ FixedText aSearchFT;
+ RadioButton aAndRB;
+ RadioButton aOrRB;
+ RadioButton aExactRB;
+
+ FixedText aURLFT;
+ SvxNoSpaceEdit aURLED;
+
+ FixedText aPostFixFT;
+ SvxNoSpaceEdit aPostFixED;
+ FixedText aSeparatorFT;
+ SvxNoSpaceEdit aSeparatorED;
+ FixedText aCaseFT;
+ ListBox aCaseED;
+
+ PushButton aNewPB;
+ PushButton aAddPB;
+ PushButton aChangePB;
+ PushButton aDeletePB;
+
+ String sLastSelectedEntry;
+ String sModifyMsg;
+
+ SvxSearchConfig aSearchConfig;
+ SvxSearchEngineData aCurrentSrchData;
+
+#ifdef _SVX_OPTINET2_CXX
+ void InitControls_Impl();
+
+ DECL_LINK( NewSearchHdl_Impl, PushButton * );
+ DECL_LINK( AddSearchHdl_Impl, PushButton * );
+ DECL_LINK( ChangeSearchHdl_Impl, PushButton * );
+ DECL_LINK( DeleteSearchHdl_Impl, PushButton * );
+ DECL_LINK( SearchEntryHdl_Impl, ListBox * );
+ DECL_LINK( SearchModifyHdl_Impl, SvxNoSpaceEdit * );
+ DECL_LINK( SearchPartHdl_Impl, RadioButton * );
+#endif
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+ BOOL ConfirmLeave( const String& rStringSelection ); //add by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+
+ SvxSearchTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~SvxSearchTabPage();
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+// #98647# class SvxScriptExecListBox ------------------------------------
+class SvxScriptExecListBox : public ListBox
+{ // for adding tooltips to ListBox
+public:
+ SvxScriptExecListBox( Window* pParent, WinBits nStyle = WB_BORDER )
+ :ListBox(pParent, nStyle) {}
+ SvxScriptExecListBox( Window* pParent, const ResId& rResId )
+ :ListBox(pParent, rResId) {}
+
+protected:
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+};
+
+// class SvxSecurityTabPage ---------------------------------------------
+
+class SvtJavaOptions;
+class SvtSecurityOptions;
+
+class SvxSecurityTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+public:
+ enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC };
+
+private:
+ FixedLine maSecurityOptionsFL;
+ FixedInfo maSecurityOptionsFI;
+ PushButton maSecurityOptionsPB;
+
+ FixedLine maPasswordsFL;
+ CheckBox maSavePasswordsCB;
+ PushButton maShowConnectionsPB;
+ CheckBox maMasterPasswordCB;
+ FixedInfo maMasterPasswordFI;
+ PushButton maMasterPasswordPB;
+
+ FixedLine maMacroSecFL;
+ FixedInfo maMacroSecFI;
+ PushButton maMacroSecPB;
+
+ FixedLine maFilesharingFL;
+ CheckBox maRecommReadOnlyCB;
+ CheckBox maRecordChangesCB;
+ PushButton maProtectRecordsPB;
+
+ SvtSecurityOptions* mpSecOptions;
+ svx::SecurityOptionsDialog* mpSecOptDlg;
+
+ RedliningMode meRedlingMode;
+ String msProtectRecordsStr;
+ String msUnprotectRecordsStr;
+ String msPasswordStoringDeactivateStr;
+
+ DECL_LINK( SecurityOptionsHdl, PushButton* );
+ DECL_LINK( SavePasswordHdl, void* );
+ DECL_LINK( MasterPasswordHdl, PushButton* );
+ DECL_LINK( MasterPasswordCBHdl, void* );
+ DECL_LINK( ShowPasswordsHdl, PushButton* );
+ DECL_LINK( MacroSecPBHdl, void* );
+ DECL_LINK( RecordChangesCBHdl, void* );
+ DECL_LINK( ProtectRecordsPBHdl, void* );
+
+ void CheckRecordChangesState( void );
+ void InitControls();
+
+ SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~SvxSecurityTabPage();
+
+protected:
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+//added by jmeng begin
+class MozPluginTabPage : public SfxTabPage
+{
+ FixedLine aMSWordGB;
+ CheckBox aWBasicCodeCB;
+
+ BOOL isInstalled(void);
+ BOOL installPlugin(void);
+ BOOL uninstallPlugin(void);
+
+ MozPluginTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~MozPluginTabPage();
+
+public:
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+};
+//added by jmeng end
+#endif
+
+/* -----------------------------20.06.01 16:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+#ifdef WNT
+#else
+#define HELPER_PAGE_COMPLETE
+#endif
+
+struct SvxEMailTabPage_Impl;
+class SvxEMailTabPage : public SfxTabPage
+{
+ FixedLine aMailFL;
+ ReadOnlyImage aMailerURLFI;
+ FixedText aMailerURLFT;
+ Edit aMailerURLED;
+ PushButton aMailerURLPB;
+
+ String m_sDefaultFilterName;
+
+ SvxEMailTabPage_Impl* pImpl;
+
+ DECL_LINK( FileDialogHdl_Impl, PushButton* ) ;
+
+public:
+ SvxEMailTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxEMailTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif // #ifndef _SVX_OPTINET_HXX
+
+
diff --git a/cui/source/options/optinet2.src b/cui/source/options/optinet2.src
new file mode 100644
index 000000000000..2ef6dc59c2e4
--- /dev/null
+++ b/cui/source/options/optinet2.src
@@ -0,0 +1,647 @@
+/*************************************************************************
+ *
+ * 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: optinet2.src,v $
+ * $Revision: 1.97 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include "optinet2.hrc"
+ // pragma -------------------------------------------------------------------
+
+/************************************************************************/
+/* */
+/* Proxy server */
+/* */
+/************************************************************************/
+
+// added by jmeng begin
+
+TabPage RID_SVXPAGE_INET_MOZPLUGIN
+{
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+
+ FixedLine GB_MOZPLUGIN
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Browser Plug-in";
+ };
+ CheckBox CB_MOZPLUGIN_CODE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Display documents in browser" ;
+ };
+};
+
+//added by jmeng end
+
+TabPage RID_SVXPAGE_INET_PROXY
+{
+ HelpId = HID_OPTIONS_PROXY ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Proxy" ;
+ #define GB_TYPES_TOP 3
+ #define GB_TYPES_LEFT 6
+ FixedLine GB_SETTINGS
+ {
+ Pos = MAP_APPFONT ( GB_TYPES_LEFT , GB_TYPES_TOP ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Settings" ;
+ };
+ FixedText FT_PROXYMODE
+ {
+ Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 13 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Proxy s~erver" ;
+ };
+ ListBox LB_PROXYMODE
+ {
+ Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 11 ) ;
+ Size = MAP_APPFONT ( 49 , 48 ) ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "None" ; > ;
+ < "System" ; > ;
+ < "Manual" ; > ;
+ };
+ };
+ String ST_PROXY_FROM_BROWSER
+ {
+ Text [ en-US ] = "Use browser settings";
+ };
+ FixedText FT_HTTP_PROXY
+ {
+ Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 29 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "HT~TP proxy" ;
+ };
+ Edit ED_HTTP_PROXY
+ {
+ Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 27 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ Border = TRUE ;
+ };
+
+ #define FT_PORT_WIDTH 37
+ #define ED_PORT_WIDTH 20
+ #define ED_PORT_COL 229
+
+ FixedText FT_HTTP_PORT
+ {
+ Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 29 ) ;
+ Size = MAP_APPFONT ( FT_PORT_WIDTH , 8 ) ;
+ Right = TRUE;
+ Text [ en-US ] = "~Port" ;
+ };
+ Edit ED_HTTP_PORT
+ {
+ Pos = MAP_APPFONT ( ED_PORT_COL , GB_TYPES_TOP + 27 ) ;
+ Size = MAP_APPFONT ( ED_PORT_WIDTH , 12 ) ;
+ Border = TRUE ;
+ };
+
+ FixedText FT_HTTPS_PROXY
+ {
+ Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 45 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "HTTP~S proxy" ;
+ };
+ Edit ED_HTTPS_PROXY
+ {
+ Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 43 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_HTTPS_PORT
+ {
+ Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 45 ) ;
+ Size = MAP_APPFONT ( FT_PORT_WIDTH , 8 ) ;
+ Right = TRUE;
+ Text [ en-US ] = "P~ort" ;
+ };
+ Edit ED_HTTPS_PORT
+ {
+ Pos = MAP_APPFONT ( ED_PORT_COL , GB_TYPES_TOP + 43 ) ;
+ Size = MAP_APPFONT ( ED_PORT_WIDTH , 12 ) ;
+ Border = TRUE ;
+ };
+
+ FixedText FT_FTP_PROXY
+ {
+ Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 61 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~FTP proxy" ;
+ };
+ Edit ED_FTP_PROXY
+ {
+ Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 59 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_FTP_PORT
+ {
+ Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 61 ) ;
+ Size = MAP_APPFONT ( FT_PORT_WIDTH , 8 ) ;
+ Right = TRUE;
+ Text [ en-US ] = "P~ort" ;
+ };
+ Edit ED_FTP_PORT
+ {
+ Pos = MAP_APPFONT ( ED_PORT_COL , GB_TYPES_TOP + 59 ) ;
+ Size = MAP_APPFONT ( ED_PORT_WIDTH , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_SOCKS_PROXY
+ {
+ Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 77 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "~SOCKS proxy" ;
+ };
+ Edit ED_SOCKS_PROXY
+ {
+ Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 75 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_SOCKS_PORT
+ {
+ Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 77 ) ;
+ Size = MAP_APPFONT ( FT_PORT_WIDTH , 8 ) ;
+ Right = TRUE;
+ Text [ en-US ] = "Po~rt" ;
+ };
+ Edit ED_SOCKS_PORT
+ {
+ Pos = MAP_APPFONT ( ED_PORT_COL , GB_TYPES_TOP + 75 ) ;
+ Size = MAP_APPFONT ( ED_PORT_WIDTH , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_NOPROXYFOR
+ {
+ Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 93 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~No proxy for:" ;
+ };
+ Edit ED_NOPROXYFOR
+ {
+ Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 91 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText ED_NOPROXYDESC
+ {
+ Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 93 ) ;
+ Size = MAP_APPFONT ( 56 , 8 ) ;
+ Text [ en-US ] = "Separator ;" ;
+ };
+ FixedLine GB_DNS
+ {
+ Pos = MAP_APPFONT( 6, 100 );
+ Size = MAP_APPFONT( 248, 8 );
+ Text [ en-US ] = "DNS server" ;
+ };
+ RadioButton RB_DNS_AUTO
+ {
+ Pos = MAP_APPFONT( 12, 111 );
+ Size = MAP_APPFONT( 236, 10 );
+ Text [ en-US ] = "~Automatic" ;
+ };
+ RadioButton RB_DNS_MANUAL
+ {
+ Pos = MAP_APPFONT( 12, 124 );
+ Size = MAP_APPFONT( 75, 10 );
+ Text [ en-US ] = "~Manual" ;
+ };
+ PatternField ED_DNS
+ {
+ Pos = MAP_APPFONT( 90, 126 );
+ Size = MAP_APPFONT( 66, 12 );
+ Border = TRUE ;
+ LiteralMask = " . . . " ;
+ EditMask = "nnnLnnnLnnnLnnn" ;
+ StrictFormat = TRUE ;
+ };
+ String ST_MSG_255_0
+ {
+ Text [ en-US ] = "is not a valid entry for this field. Please specify a value between 0 and 255." ;
+ };
+ String ST_MSG_255_1
+ {
+ Text [ en-US ] = "is not a valid entry for this field. Please specify a value between 1 and 255." ;
+ };
+};
+/************************************************************************/
+/* */
+/* Suche */
+/* */
+/************************************************************************/
+TabPage RID_SVXPAGE_INET_SEARCH
+{
+ HelpId = HID_OPTIONS_SEARCH ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Search" ;
+
+ #define GB_SEARCH_LEFT 6
+ #define GB_SEARCH_TOP 3
+ FixedLine GB_SEARCH
+ {
+ Pos = MAP_APPFONT ( GB_SEARCH_LEFT , GB_SEARCH_TOP ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Search in" ;
+ };
+ ListBox LB_SEARCH
+ {
+ Pos = MAP_APPFONT ( 12 , GB_SEARCH_TOP + 11 ) ;
+ Size = MAP_APPFONT ( 39 , 120 ) ;
+ Border = TRUE ;
+ AutoHScroll = TRUE;
+ };
+ #define LABEL_START_XPOS (GB_SEARCH_LEFT + 6 + 39 + 5 )
+ #define LABEL_LEN 64
+ #define EDIT_START_XPOS (LABEL_START_XPOS + LABEL_LEN + 3)
+ FixedText FT_SEARCH_NAME
+ {
+ Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 13 ) ;
+ Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_SEARCH_NAME
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 11 ) ;
+ Size = MAP_APPFONT ( 125 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_SEARCH
+ {
+ Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 27 ) ;
+ Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
+ Text [ en-US ] = "Type" ;
+ };
+ RadioButton RB_AND
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 26 ) ;
+ Size = MAP_APPFONT ( 125 , 10 ) ;
+ Check = TRUE ;
+ Text [ en-US ] = "And" ;
+ };
+ RadioButton RB_OR
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 39 ) ;
+ Size = MAP_APPFONT ( 125 , 10 ) ;
+ Text [ en-US ] = "~Or" ;
+ };
+ RadioButton RB_EXACT
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 52 ) ;
+ Size = MAP_APPFONT ( 125 , 10 ) ;
+ Text [ en-US ] = "E~xact" ;
+ };
+ FixedText FT_URL
+ {
+ Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 67 ) ;
+ Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
+ Text [ en-US ] = "~Prefix" ;
+ };
+ Edit ED_URL
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 65 ) ;
+ Size = MAP_APPFONT ( 125 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_POSTFIX
+ {
+ Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 82 ) ;
+ Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
+ Text [ en-US ] = "Su~ffix" ;
+ };
+ Edit ED_POSTFIX
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 80 ) ;
+ Size = MAP_APPFONT ( 125 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 97 ) ;
+ Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
+ Text [ en-US ] = "~Separator" ;
+ };
+ Edit ED_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 95 ) ;
+ Size = MAP_APPFONT ( 42 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_CASE
+ {
+ Pos = MAP_APPFONT ( LABEL_START_XPOS, GB_SEARCH_TOP + 112 ) ;
+ Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
+ Text [ en-US ] = "~Case match" ;
+ };
+ ListBox ED_CASE
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS, GB_SEARCH_TOP + 110 ) ;
+ Size = MAP_APPFONT ( 42 , 48 ) ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "None" ; > ;
+ < "Upper" ; > ;
+ < "Lower" ; > ;
+ };
+ };
+ PushButton PB_NEW
+ {
+ Pos = MAP_APPFONT ( 39 , GB_SEARCH_TOP + 131 + 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "N~ew";
+ };
+ PushButton PB_ADD
+ {
+ Pos = MAP_APPFONT ( 92 , GB_SEARCH_TOP + 131 + 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add" ;
+ };
+ PushButton PB_CHANGE
+ {
+ Pos = MAP_APPFONT ( 145 , GB_SEARCH_TOP + 131 + 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Modify" ;
+ };
+ PushButton PB_DELETE
+ {
+ Pos = MAP_APPFONT ( 198 , GB_SEARCH_TOP + 131 + 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ String MSG_MODIFY
+ {
+ Text [ en-US ] = "Do you want to accept the current modification?";
+ };
+};
+
+
+/************************************************************************/
+/* */
+/* Scripting */
+/* */
+/************************************************************************/
+
+TabPage RID_SVXPAGE_INET_SECURITY
+{
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT( TP_WIDTH , TP_HEIGHT );
+ SVLook = TRUE;
+ Hide = TRUE;
+ Text [ en-US ] = "Security";
+ FixedLine FL_SEC_SECURITYOPTIONS
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_0 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Security options and warnings";
+ };
+ FixedText FI_SEC_SECURITYOPTIONS
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_1 );
+ Size = MAP_APPFONT( COL_2-COL_1, 3*RSC_CD_FIXEDLINE_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Adjust security related options and define warnings for hidden information in documents.";
+ };
+ PushButton PB_SEC_SECURITYOPTIONS
+ {
+ Pos = MAP_APPFONT( COL_3, ROW_2a );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "Options...";
+ };
+ FixedLine FL_SEC_PASSWORDS
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_2 - 2 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Passwords for web connections";
+ };
+ CheckBox CB_SEC_SAVEPASSWORDS
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_3 - 4 );
+ Size = MAP_APPFONT( COL_2-COL_1, 16 );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Persistently save passwords for web connections";
+ };
+ PushButton PB_SEC_CONNECTIONS
+ {
+ Pos = MAP_APPFONT( COL_3, ROW_3-1 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "Connections...";
+ };
+ CheckBox CB_SEC_MASTERPASSWORD
+ {
+ Pos = MAP_APPFONT( COL_1a, ROW_4 );
+ Size = MAP_APPFONT( COL_2-COL_1a, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Protected by a master password (recommended)";
+ };
+ FixedText FI_SEC_MASTERPASSWORD
+ {
+ Pos = MAP_APPFONT( COL_1a, ROW_4a );
+ Size = MAP_APPFONT( COL_2-COL_1a, 4*RSC_CD_FIXEDLINE_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Passwords are protected by a master password. You will be asked to enter it once per session, if %PRODUCTNAME retrieves a password from the protected password list.";
+ };
+ PushButton PB_SEC_MASTERPASSWORD
+ {
+ Pos = MAP_APPFONT( COL_3, ROW_4a );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "Master Password...";
+ };
+ FixedLine FL_SEC_MACROSEC
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_5 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Macro security";
+ };
+ FixedText FI_SEC_MACROSEC
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_6 );
+ Size = MAP_APPFONT( COL_2-COL_1, 3*RSC_CD_FIXEDLINE_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Adjust the security level for executing macros and specify trusted macro developers.";
+ };
+ PushButton PB_SEC_MACROSEC
+ {
+ Pos = MAP_APPFONT( COL_3, ROW_6-2 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "Macro Security...";
+ };
+ FixedLine FL_SEC_FILESHARING
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_7 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "File sharing options for this document";
+ };
+ CheckBox CB_SEC_RECOMMREADONLY
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_8 );
+ Size = MAP_APPFONT( COL_2-COL_1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Open this document in read-only mode";
+ };
+ CheckBox CB_SEC_RECORDCHANGES
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_9 );
+ Size = MAP_APPFONT( COL_2-COL_1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Record changes";
+ };
+ PushButton PB_SEC_PROTRECORDS
+ {
+ Pos = MAP_APPFONT( COL_3, ROW_9-2 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+ String STR_SEC_PROTRECORDS
+ {
+ Text [ en-US ] = "Protect...";
+ };
+ String STR_SEC_UNPROTRECORDS
+ {
+ Text [ en-US ] = "Unprotect...";
+ };
+ String STR_SEC_NOPASSWDSAVE
+ {
+ Text [ en-US ] = "Disabling the function to persistently store passwords deletes the list of passwords stored and resets the master password.\n\nDo you want to delete password list and reset master password?";
+ };
+};
+
+ErrorBox RID_SVXERR_OPT_PROXYPORTS
+{
+ BUTTONS = WB_OK ;
+ Message [ en-US ] = "Invalid value!\n\nThe maximum value for a port number is 65535.";
+};
+
+// RID_SVXDLG_OPT_JAVASCRIPT_DISABLE -----------------------------------------
+
+ModalDialog RID_SVXDLG_OPT_JAVASCRIPT_DISABLE
+{
+ OutputSize = TRUE;
+ Size = MAP_APPFONT( 150, 81 );
+ Moveable = TRUE;
+ Closeable = TRUE;
+ FixedImage IMG_JSCPT_WARNING
+ {
+ Pos = MAP_APPFONT( 6, 6 );
+ Size = MAP_APPFONT( 30, 30 );
+ };
+ FixedText FT_JSCPT_WARNING
+ {
+ Pos = MAP_APPFONT( 39, 6 );
+ Size = MAP_APPFONT( 195, 36 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "Please note that with Java\nyou disable Javascript as well.\n\nDo you still want to disable Java?";
+ };
+ CheckBox CB_JSCPT_DISABLE
+ {
+ Pos = MAP_APPFONT( 39, 45 );
+ Size = MAP_APPFONT( 195, 12 );
+ Hide = TRUE;
+ Text [ en-US ] = "~Don't show warning again";
+ };
+ OKButton BTN_JSCPT_YES
+ {
+ Pos = MAP_APPFONT( 41, 61 );
+ Size = MAP_APPFONT( 50, 14 );
+ };
+ CancelButton BTN_JSCPT_NO
+ {
+ Pos = MAP_APPFONT( 94, 61 );
+ Size = MAP_APPFONT( 50, 14 );
+ DefButton = TRUE;
+ };
+};
+
+// *******************************************************************
+
+TabPage RID_SVXPAGE_INET_MAIL
+{
+ HelpID = HID_OPTIONS_MAIL ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+
+ FixedLine FL_MAIL
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Sending documents as e-mail attachments";
+ };
+
+ FixedImage FI_MAILERURL
+ {
+ Pos = MAP_APPFONT ( 5 , 21 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+
+ FixedText FT_MAILERURL
+ {
+ Pos = MAP_APPFONT ( 14 , 20 ) ;
+ Size = MAP_APPFONT ( 43 , 8 ) ;
+ Text [ en-US ] = "~E-mail program";
+ };
+
+ Edit ED_MAILERURL
+ {
+ Pos = MAP_APPFONT ( 60 , 18 ) ;
+ Size = MAP_APPFONT ( 171 , 12 ) ;
+ Border = TRUE;
+ };
+
+ PushButton PB_MAILERURL
+ {
+ Pos = MAP_APPFONT ( 234 , 17 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "..." ;
+ };
+
+ String STR_DEFAULT_FILENAME
+ {
+ Text [ en-US ] = "All files (*.*)" ;
+ };
+};
+
+ // ******************************************************************* EOF
+
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
new file mode 100644
index 000000000000..ec145ddacb3a
--- /dev/null
+++ b/cui/source/options/optjava.cxx
@@ -0,0 +1,1138 @@
+/*************************************************************************
+ *
+ * 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: optjava.cxx,v $
+ * $Revision: 1.21 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include "optjava.hxx"
+#include <svx/dialmgr.hxx>
+
+#include "optjava.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include <vcl/svapp.hxx>
+#include <vcl/help.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/waitobj.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/imagemgr.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <jvmfwk/framework.h>
+
+// define ----------------------------------------------------------------
+
+#define CLASSPATH_DELIMITER SAL_PATHSEPARATOR
+#define STRIM( s ) s.EraseLeadingChars().EraseTrailingChars()
+#define BUTTON_BORDER 2
+#define RESET_TIMEOUT 300
+
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::uno;
+
+// class SvxJavaTable ----------------------------------------------------
+
+SvxJavaTable::SvxJavaTable( Window* _pParent, const ResId& _rId ) :
+
+ SvxSimpleTable( _pParent, _rId )
+
+{
+}
+
+SvxJavaTable::~SvxJavaTable()
+{
+}
+
+void SvxJavaTable::SetTabs()
+{
+ SvxSimpleTable::SetTabs();
+/*
+ USHORT nAdjust = SV_LBOXTAB_ADJUST_RIGHT | SV_LBOXTAB_ADJUST_LEFT |
+ SV_LBOXTAB_ADJUST_CENTER | SV_LBOXTAB_ADJUST_NUMERIC | SV_LBOXTAB_FORCE;
+ if ( aTabs.Count() > 0 )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(0);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE | SV_LBOXTAB_ADJUST_CENTER | SV_LBOXTAB_FORCE;
+ }
+*/
+}
+
+void SvxJavaTable::MouseButtonUp( const MouseEvent& _rMEvt )
+{
+ m_aCurMousePoint = _rMEvt.GetPosPixel();
+ SvxSimpleTable::MouseButtonUp( _rMEvt );
+}
+
+void SvxJavaTable::KeyInput( const KeyEvent& rKEvt )
+{
+ if ( !rKEvt.GetKeyCode().GetModifier() && KEY_SPACE == rKEvt.GetKeyCode().GetCode() )
+ {
+ SvLBoxEntry* pEntry = FirstSelected();
+ if ( GetCheckButtonState( pEntry ) == SV_BUTTON_UNCHECKED )
+ {
+ SetCheckButtonState( pEntry, SV_BUTTON_CHECKED );
+ GetCheckButtonHdl().Call( NULL );
+ return ;
+ }
+ }
+
+ SvxSimpleTable::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+bool areListsEqual( const Sequence< ::rtl::OUString >& rListA, const Sequence< ::rtl::OUString >& rListB )
+{
+ bool bRet = true;
+ const sal_Int32 nLen = rListA.getLength();
+
+ if ( rListB.getLength() != nLen )
+ bRet = false;
+ else
+ {
+ const ::rtl::OUString* pStringA = rListA.getConstArray();
+ const ::rtl::OUString* pStringB = rListB.getConstArray();
+
+ for ( sal_Int32 i = 0; i < nLen; ++i )
+ {
+ if ( *pStringA++ != *pStringB++ )
+ {
+ bRet = false;
+ break;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// class SvxJavaOptionsPage ----------------------------------------------
+
+SvxJavaOptionsPage::SvxJavaOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_OPTIONS_JAVA ), rSet ),
+
+ m_aJavaLine ( this, SVX_RES( FL_JAVA ) ),
+ m_aJavaEnableCB ( this, SVX_RES( CB_JAVA_ENABLE ) ),
+ m_aJavaFoundLabel ( this, SVX_RES( FT_JAVA_FOUND ) ),
+ m_aJavaList ( this, SVX_RES( LB_JAVA ) ),
+ m_aJavaPathText ( this, SVX_RES( FT_JAVA_PATH ) ),
+ m_aAddBtn ( this, SVX_RES( PB_ADD ) ),
+ m_aParameterBtn ( this, SVX_RES( PB_PARAMETER ) ),
+ m_aClassPathBtn ( this, SVX_RES( PB_CLASSPATH ) ),
+
+ m_pParamDlg ( NULL ),
+ m_pPathDlg ( NULL ),
+ m_parJavaInfo ( NULL ),
+ m_parParameters ( NULL ),
+ m_pClassPath ( NULL ),
+ m_nInfoSize ( 0 ),
+ m_nParamSize ( 0 ),
+ m_sInstallText ( SVX_RES( STR_INSTALLED_IN ) ),
+ m_sAccessibilityText( SVX_RES( STR_ACCESSIBILITY ) ),
+ m_sAddDialogText ( SVX_RES( STR_ADDDLGTEXT ) ),
+
+ xDialogListener ( new ::svt::DialogClosedListener() )
+
+{
+ m_aJavaEnableCB.SetClickHdl( LINK( this, SvxJavaOptionsPage, EnableHdl_Impl ) );
+ m_aJavaList.SetCheckButtonHdl( LINK( this, SvxJavaOptionsPage, CheckHdl_Impl ) );
+ m_aJavaList.SetSelectHdl( LINK( this, SvxJavaOptionsPage, SelectHdl_Impl ) );
+ m_aAddBtn.SetClickHdl( LINK( this, SvxJavaOptionsPage, AddHdl_Impl ) );
+ m_aParameterBtn.SetClickHdl( LINK( this, SvxJavaOptionsPage, ParameterHdl_Impl ) );
+ m_aClassPathBtn.SetClickHdl( LINK( this, SvxJavaOptionsPage, ClassPathHdl_Impl ) );
+ m_aResetTimer.SetTimeoutHdl( LINK( this, SvxJavaOptionsPage, ResetHdl_Impl ) );
+ m_aResetTimer.SetTimeout( RESET_TIMEOUT );
+
+//! m_aJavaList.EnableCheckButton( new SvLBoxButtonData( &m_aJavaList, true ) );
+
+ static long aStaticTabs[]=
+ {
+ 5, 0, 15, 90, 130, 300
+ };
+
+ m_aJavaList.SvxSimpleTable::SetTabs( aStaticTabs );
+ String sHeader( '\t' );
+ sHeader += String( SVX_RES( STR_HEADER_VENDOR ) );
+ sHeader += '\t';
+ sHeader += String( SVX_RES( STR_HEADER_VERSION ) );
+ sHeader += '\t';
+ sHeader += String( SVX_RES( STR_HEADER_FEATURES ) );
+ sHeader += '\t';
+ m_aJavaList.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, HIB_LEFT );
+
+ m_aJavaList.SetHelpId( HID_OPTIONS_JAVA_LIST );
+
+ FreeResource();
+
+ xDialogListener->SetDialogClosedLink( LINK( this, SvxJavaOptionsPage, DialogClosedHdl ) );
+
+ EnableHdl_Impl( &m_aJavaEnableCB );
+ jfw_lock();
+
+ //check if the text fits into the class path button
+ Size aButtonSize = m_aClassPathBtn.GetOutputSizePixel();
+ sal_Int32 nTextWidth = m_aClassPathBtn.GetTextWidth(m_aClassPathBtn.GetText());
+ //add some additional space
+ sal_Int32 nDiff = nTextWidth + 4 - aButtonSize.Width();
+ if( nDiff > 0)
+ {
+ Point aPos(m_aClassPathBtn.GetPosPixel());
+ aPos.X() -= nDiff;
+ aButtonSize.Width() += nDiff;
+ m_aClassPathBtn.SetPosSizePixel(aPos, aButtonSize);
+ aPos = m_aAddBtn.GetPosPixel();
+ aPos.X() -= nDiff;
+ m_aAddBtn.SetPosSizePixel(aPos, aButtonSize);
+ aPos = m_aParameterBtn.GetPosPixel();
+ aPos.X() -= nDiff;
+ m_aParameterBtn.SetPosSizePixel(aPos, aButtonSize);
+ Size aSize = m_aJavaList.GetSizePixel();
+ aSize.Width() -= nDiff;
+ m_aJavaList.SetSizePixel(aSize);
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SvxJavaOptionsPage::~SvxJavaOptionsPage()
+{
+ delete m_pParamDlg;
+ delete m_pPathDlg;
+ ClearJavaInfo();
+ std::vector< JavaInfo* >::iterator pIter;
+ for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter )
+ {
+ JavaInfo* pInfo = *pIter;
+ jfw_freeJavaInfo( pInfo );
+ }
+/*
+ rtl_uString** pParamArr = m_parParameters;
+ for ( sal_Int32 i = 0; i < m_nParamSize; ++i )
+ rtl_uString_release( *pParamArr++ );
+ rtl_freeMemory( m_parParameters );
+ rtl_uString_release( m_pClassPath );
+*/
+ jfw_unlock();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, EnableHdl_Impl, CheckBox *, EMPTYARG )
+{
+ BOOL bEnable = m_aJavaEnableCB.IsChecked();
+ m_aJavaFoundLabel.Enable( bEnable );
+ m_aJavaPathText.Enable( bEnable );
+ m_aAddBtn.Enable( bEnable );
+ m_aParameterBtn.Enable( bEnable );
+ m_aClassPathBtn.Enable( bEnable );
+
+ bEnable ? m_aJavaList.EnableTable() : m_aJavaList.DisableTable();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, CheckHdl_Impl, SvxSimpleTable *, pList )
+{
+ SvLBoxEntry* pEntry = pList ? m_aJavaList.GetEntry( m_aJavaList.GetCurMousePoint() )
+ : m_aJavaList.FirstSelected();
+ if ( pEntry )
+ m_aJavaList.HandleEntryChecked( pEntry );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, SelectHdl_Impl, SvxSimpleTable *, EMPTYARG )
+{
+ // set installation directory info
+ SvLBoxEntry* pEntry = m_aJavaList.FirstSelected();
+ DBG_ASSERT( pEntry, "SvxJavaOptionsPage::SelectHdl_Impl(): no entry" );
+ String* pLocation = static_cast< String* >( pEntry->GetUserData() );
+ DBG_ASSERT( pLocation, "invalid location string" );
+ String sInfo = m_sInstallText;
+ if ( pLocation )
+ sInfo += *pLocation;
+ m_aJavaPathText.SetText( sInfo );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, AddHdl_Impl, PushButton *, EMPTYARG )
+{
+ try
+ {
+ Reference < XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ xFolderPicker = Reference< XFolderPicker >(
+ xMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.FolderPicker" ) ), UNO_QUERY );
+
+ String sWorkFolder = SvtPathOptions().GetWorkPath();
+ xFolderPicker->setDisplayDirectory( sWorkFolder );
+ xFolderPicker->setDescription( m_sAddDialogText );
+
+ Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
+ if ( xAsyncDlg.is() )
+ xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ else if ( xFolderPicker.is() && xFolderPicker->execute() == ExecutableDialogResults::OK )
+ AddFolder( xFolderPicker->getDirectory() );
+ }
+ catch ( Exception& )
+ {
+#ifdef DBG_UTIL
+ DBG_ERRORFILE( "SvxJavaOptionsPage::AddHdl_Impl(): caught exception" );
+#endif
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, ParameterHdl_Impl, PushButton *, EMPTYARG )
+{
+ Sequence< ::rtl::OUString > aParameterList;
+ if ( !m_pParamDlg )
+ {
+ m_pParamDlg = new SvxJavaParameterDlg( this );
+ javaFrameworkError eErr = jfw_getVMParameters( &m_parParameters, &m_nParamSize );
+ if ( JFW_E_NONE == eErr && m_parParameters && m_nParamSize > 0 )
+ {
+ rtl_uString** pParamArr = m_parParameters;
+ aParameterList.realloc( m_nParamSize );
+ ::rtl::OUString* pParams = aParameterList.getArray();
+ for ( sal_Int32 i = 0; i < m_nParamSize; ++i )
+ {
+ rtl_uString* pParam = *pParamArr++;
+ pParams[i] = ::rtl::OUString( pParam );
+ }
+ m_pParamDlg->SetParameters( aParameterList );
+ }
+ }
+ else
+ aParameterList = m_pParamDlg->GetParameters();
+
+ if ( m_pParamDlg->Execute() == RET_OK )
+ {
+ if ( !areListsEqual( aParameterList, m_pParamDlg->GetParameters() ) )
+ {
+ aParameterList = m_pParamDlg->GetParameters();
+ sal_Bool bRunning = sal_False;
+ javaFrameworkError eErr = jfw_isVMRunning( &bRunning );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::ParameterHdl_Impl(): error in jfw_isVMRunning" );
+ (void)eErr;
+ if ( bRunning )
+ {
+ WarningBox aWarnBox( this, SVX_RES( RID_SVX_MSGBOX_JAVA_RESTART2 ) );
+ aWarnBox.Execute();
+ }
+ }
+ }
+ else
+ m_pParamDlg->SetParameters( aParameterList );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, ClassPathHdl_Impl, PushButton *, EMPTYARG )
+{
+ String sClassPath;
+
+ if ( !m_pPathDlg )
+ {
+ m_pPathDlg = new SvxJavaClassPathDlg( this );
+ javaFrameworkError eErr = jfw_getUserClassPath( &m_pClassPath );
+ if ( JFW_E_NONE == eErr && m_pClassPath )
+ {
+ sClassPath = String( ::rtl::OUString( m_pClassPath ) );
+ m_pPathDlg->SetClassPath( sClassPath );
+ }
+ }
+ else
+ sClassPath = m_pPathDlg->GetClassPath();
+
+ m_pPathDlg->SetFocus();
+ if ( m_pPathDlg->Execute() == RET_OK )
+ {
+
+ if ( m_pPathDlg->GetClassPath() != sClassPath )
+ {
+ sClassPath = m_pPathDlg->GetClassPath();
+ sal_Bool bRunning = sal_False;
+ javaFrameworkError eErr = jfw_isVMRunning( &bRunning );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::ParameterHdl_Impl(): error in jfw_isVMRunning" );
+ (void)eErr;
+ if ( bRunning )
+ {
+ WarningBox aWarnBox( this, SVX_RES( RID_SVX_MSGBOX_JAVA_RESTART2 ) );
+ aWarnBox.Execute();
+ }
+ }
+ }
+ else
+ m_pPathDlg->SetClassPath( sClassPath );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, ResetHdl_Impl, Timer *, EMPTYARG )
+{
+ LoadJREs();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, StartFolderPickerHdl, void*, EMPTYARG )
+{
+ try
+ {
+ Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
+ if ( xAsyncDlg.is() )
+ xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ else if ( xFolderPicker.is() && xFolderPicker->execute() == ExecutableDialogResults::OK )
+ AddFolder( xFolderPicker->getDirectory() );
+ }
+ catch ( Exception& )
+ {
+#ifdef DBG_UTIL
+ DBG_ERRORFILE( "SvxJavaOptionsPage::StartFolderPickerHdl(): caught exception" );
+#endif
+ }
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, DialogClosedHdl, DialogClosedEvent*, pEvt )
+{
+ if ( RET_OK == pEvt->DialogResult )
+ {
+ DBG_ASSERT( xFolderPicker.is() == sal_True, "SvxJavaOptionsPage::DialogClosedHdl(): no folder picker" );
+
+ AddFolder( xFolderPicker->getDirectory() );
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::ClearJavaInfo()
+{
+ if ( m_parJavaInfo )
+ {
+ JavaInfo** parInfo = m_parJavaInfo;
+ for ( sal_Int32 i = 0; i < m_nInfoSize; ++i )
+ {
+ JavaInfo* pInfo = *parInfo++;
+ jfw_freeJavaInfo( pInfo );
+ }
+
+ rtl_freeMemory( m_parJavaInfo );
+ m_parJavaInfo = NULL;
+ m_nInfoSize = 0;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::ClearJavaList()
+{
+ SvLBoxEntry* pEntry = m_aJavaList.First();
+ while ( pEntry )
+ {
+ String* pLocation = static_cast< String* >( pEntry->GetUserData() );
+ delete pLocation;
+ pEntry = m_aJavaList.Next( pEntry );
+ }
+ m_aJavaList.Clear();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::LoadJREs()
+{
+ WaitObject aWaitObj( &m_aJavaList );
+ javaFrameworkError eErr = jfw_findAllJREs( &m_parJavaInfo, &m_nInfoSize );
+ if ( JFW_E_NONE == eErr && m_parJavaInfo )
+ {
+ JavaInfo** parInfo = m_parJavaInfo;
+ for ( sal_Int32 i = 0; i < m_nInfoSize; ++i )
+ {
+ JavaInfo* pInfo = *parInfo++;
+ AddJRE( pInfo );
+ }
+ }
+
+ std::vector< JavaInfo* >::iterator pIter;
+ for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter )
+ {
+ JavaInfo* pInfo = *pIter;
+ AddJRE( pInfo );
+ }
+
+ JavaInfo* pSelectedJava = NULL;
+ eErr = jfw_getSelectedJRE( &pSelectedJava );
+ if ( JFW_E_NONE == eErr && pSelectedJava )
+ {
+ JavaInfo** parInfo = m_parJavaInfo;
+ for ( sal_Int32 i = 0; i < m_nInfoSize; ++i )
+ {
+ JavaInfo* pCmpInfo = *parInfo++;
+ if ( jfw_areEqualJavaInfo( pCmpInfo, pSelectedJava ) )
+ {
+ SvLBoxEntry* pEntry = m_aJavaList.GetEntry(i);
+ if ( pEntry )
+ m_aJavaList.HandleEntryChecked( pEntry );
+ break;
+ }
+ }
+ }
+
+ jfw_freeJavaInfo( pSelectedJava );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::AddJRE( JavaInfo* _pInfo )
+{
+ String sEntry( '\t' );
+ sEntry += String( ::rtl::OUString( _pInfo->sVendor ) );
+ sEntry += '\t';
+ sEntry += String( ::rtl::OUString( _pInfo->sVersion ) );
+ sEntry += '\t';
+ if ( ( _pInfo->nFeatures & JFW_FEATURE_ACCESSBRIDGE ) == JFW_FEATURE_ACCESSBRIDGE )
+ sEntry += m_sAccessibilityText;
+ SvLBoxEntry* pEntry = m_aJavaList.InsertEntry( sEntry );
+ INetURLObject aLocObj( ::rtl::OUString( _pInfo->sLocation ) );
+ String* pLocation = new String( aLocObj.getFSysPath( INetURLObject::FSYS_DETECT ) );
+ pEntry->SetUserData( pLocation );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::HandleCheckEntry( SvLBoxEntry* _pEntry )
+{
+ m_aJavaList.Select( _pEntry, TRUE );
+ SvButtonState eState = m_aJavaList.GetCheckButtonState( _pEntry );
+
+ if ( SV_BUTTON_CHECKED == eState )
+ {
+ // we have radio button behavior -> so uncheck the other entries
+ SvLBoxEntry* pEntry = m_aJavaList.First();
+ while ( pEntry )
+ {
+ if ( pEntry != _pEntry )
+ m_aJavaList.SetCheckButtonState( pEntry, SV_BUTTON_UNCHECKED );
+ pEntry = m_aJavaList.Next( pEntry );
+ }
+ }
+ else
+ m_aJavaList.SetCheckButtonState( _pEntry, SV_BUTTON_CHECKED );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::AddFolder( const ::rtl::OUString& _rFolder )
+{
+ bool bStartAgain = true;
+ sal_Int32 nPos = 0;
+ JavaInfo* pInfo = NULL;
+ javaFrameworkError eErr = jfw_getJavaInfoByPath( _rFolder.pData, &pInfo );
+ if ( JFW_E_NONE == eErr && pInfo )
+ {
+ bool bFound = false;
+ JavaInfo** parInfo = m_parJavaInfo;
+ for ( sal_Int32 i = 0; i < m_nInfoSize; ++i )
+ {
+ JavaInfo* pCmpInfo = *parInfo++;
+ if ( jfw_areEqualJavaInfo( pCmpInfo, pInfo ) )
+ {
+ bFound = true;
+ nPos = i;
+ break;
+ }
+ }
+
+ if ( !bFound )
+ {
+ std::vector< JavaInfo* >::iterator pIter;
+ for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter )
+ {
+ JavaInfo* pCmpInfo = *pIter;
+ if ( jfw_areEqualJavaInfo( pCmpInfo, pInfo ) )
+ {
+ bFound = true;
+ break;
+ }
+ }
+ }
+
+ if ( !bFound )
+ {
+ jfw_addJRELocation( pInfo->sLocation );
+ AddJRE( pInfo );
+ m_aAddedInfos.push_back( pInfo );
+ nPos = m_aJavaList.GetEntryCount() - 1;
+ }
+ else
+ jfw_freeJavaInfo( pInfo );
+
+ SvLBoxEntry* pEntry = m_aJavaList.GetEntry( nPos );
+ m_aJavaList.Select( pEntry );
+ m_aJavaList.SetCheckButtonState( pEntry, SV_BUTTON_CHECKED );
+ HandleCheckEntry( pEntry );
+ bStartAgain = false;
+ }
+ else if ( JFW_E_NOT_RECOGNIZED == eErr )
+ {
+ ErrorBox aErrBox( this, SVX_RES( RID_SVXERR_JRE_NOT_RECOGNIZED ) );
+ aErrBox.Execute();
+ }
+ else if ( JFW_E_FAILED_VERSION == eErr )
+ {
+ ErrorBox aErrBox( this, SVX_RES( RID_SVXERR_JRE_FAILED_VERSION ) );
+ aErrBox.Execute();
+ }
+
+ if ( bStartAgain )
+ {
+ xFolderPicker->setDisplayDirectory( _rFolder );
+ Application::PostUserEvent( LINK( this, SvxJavaOptionsPage, StartFolderPickerHdl ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxJavaOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return ( new SvxJavaOptionsPage( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxJavaOptionsPage::FillItemSet( SfxItemSet& /*rCoreSet*/ )
+{
+ BOOL bModified = FALSE;
+ javaFrameworkError eErr = JFW_E_NONE;
+ if ( m_pParamDlg )
+ {
+ Sequence< ::rtl::OUString > aParamList = m_pParamDlg->GetParameters();
+ sal_Int32 i, nSize = aParamList.getLength();
+ rtl_uString** pParamArr = (rtl_uString**)rtl_allocateMemory( sizeof(rtl_uString*) * nSize );
+ rtl_uString** pParamArrIter = pParamArr;
+ const ::rtl::OUString* pList = aParamList.getConstArray();
+ for ( i = 0; i < nSize; ++i )
+ pParamArr[i] = pList[i].pData;
+ eErr = jfw_setVMParameters( pParamArrIter, nSize );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::FillItemSet(): error in jfw_setVMParameters" );
+ pParamArrIter = pParamArr;
+ rtl_freeMemory( pParamArr );
+ bModified = TRUE;
+ }
+
+ if ( m_pPathDlg )
+ {
+ ::rtl::OUString sPath( m_pPathDlg->GetClassPath() );
+ if ( m_pPathDlg->GetOldPath() != String( sPath ) )
+ {
+ eErr = jfw_setUserClassPath( sPath.pData );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::FillItemSet(): error in jfw_setUserClassPath" );
+ bModified = TRUE;
+ }
+ }
+
+ ULONG nCount = m_aJavaList.GetEntryCount();
+ for ( ULONG i = 0; i < nCount; ++i )
+ {
+ if ( m_aJavaList.GetCheckButtonState( m_aJavaList.GetEntry(i) ) == SV_BUTTON_CHECKED )
+ {
+ JavaInfo* pInfo = NULL;
+ if ( i < static_cast< ULONG >( m_nInfoSize ) )
+ pInfo = m_parJavaInfo[i];
+ else
+ pInfo = m_aAddedInfos[ i - m_nInfoSize ];
+
+ JavaInfo* pSelectedJava = NULL;
+ eErr = jfw_getSelectedJRE( &pSelectedJava );
+ if ( JFW_E_NONE == eErr || JFW_E_INVALID_SETTINGS == eErr )
+ {
+ if (pSelectedJava == NULL || !jfw_areEqualJavaInfo( pInfo, pSelectedJava ) )
+ {
+ sal_Bool bRunning = sal_False;
+ eErr = jfw_isVMRunning( &bRunning );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::FillItemSet(): error in jfw_isVMRunning" );
+ if ( bRunning ||
+ ( ( pInfo->nRequirements & JFW_REQUIRE_NEEDRESTART ) == JFW_REQUIRE_NEEDRESTART ) )
+ {
+ WarningBox aWarnBox( this, SVX_RES( RID_SVX_MSGBOX_JAVA_RESTART ) );
+ aWarnBox.Execute();
+ }
+
+ eErr = jfw_setSelectedJRE( pInfo );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::FillItemSet(): error in jfw_setSelectedJRE" );
+ bModified = TRUE;
+ }
+ }
+ jfw_freeJavaInfo( pSelectedJava );
+ break;
+ }
+ }
+
+ sal_Bool bEnabled = sal_False;
+ eErr = jfw_getEnabled( &bEnabled );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::FillItemSet(): error in jfw_getEnabled" );
+ if ( bEnabled != m_aJavaEnableCB.IsChecked() )
+ {
+ eErr = jfw_setEnabled( m_aJavaEnableCB.IsChecked() );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::FillItemSet(): error in jfw_setEnabled" );
+ bModified = TRUE;
+ }
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::Reset( const SfxItemSet& /*rSet*/ )
+{
+ ClearJavaInfo();
+ ClearJavaList();
+
+ sal_Bool bEnabled = sal_False;
+ javaFrameworkError eErr = jfw_getEnabled( &bEnabled );
+ if ( eErr != JFW_E_NONE )
+ bEnabled = sal_False;
+ m_aJavaEnableCB.Check( bEnabled );
+ EnableHdl_Impl( &m_aJavaEnableCB );
+
+ m_aResetTimer.Start();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::FillUserData()
+{
+ String aUserData;
+ SetUserData( aUserData );
+}
+
+// class SvxJavaParameterDlg ---------------------------------------------
+
+SvxJavaParameterDlg::SvxJavaParameterDlg( Window* pParent ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_JAVA_PARAMETER ) ),
+
+ m_aParameterLabel ( this, SVX_RES( FT_PARAMETER ) ),
+ m_aParameterEdit ( this, SVX_RES( ED_PARAMETER ) ),
+ m_aAssignBtn ( this, SVX_RES( PB_ASSIGN ) ),
+ m_aAssignedLabel ( this, SVX_RES( FT_ASSIGNED ) ),
+ m_aAssignedList ( this, SVX_RES( LB_ASSIGNED ) ),
+ m_aExampleText ( this, SVX_RES( FT_EXAMPLE ) ),
+ m_aRemoveBtn ( this, SVX_RES( PB_REMOVE ) ),
+ m_aButtonsLine ( this, SVX_RES( FL_BUTTONS ) ),
+ m_aOKBtn ( this, SVX_RES( PB_PARAMETER_OK ) ),
+ m_aCancelBtn ( this, SVX_RES( PB_PARAMETER_ESC ) ),
+ m_aHelpBtn ( this, SVX_RES( PB_PARAMETER_HLP ) )
+
+{
+ FreeResource();
+
+ m_aParameterEdit.SetModifyHdl( LINK( this, SvxJavaParameterDlg, ModifyHdl_Impl ) );
+ m_aAssignBtn.SetClickHdl( LINK( this, SvxJavaParameterDlg, AssignHdl_Impl ) );
+ m_aRemoveBtn.SetClickHdl( LINK( this, SvxJavaParameterDlg, RemoveHdl_Impl ) );
+ m_aAssignedList.SetSelectHdl( LINK( this, SvxJavaParameterDlg, SelectHdl_Impl ) );
+ m_aAssignedList.SetDoubleClickHdl( LINK( this, SvxJavaParameterDlg, DblClickHdl_Impl ) );
+
+ ModifyHdl_Impl( &m_aParameterEdit );
+ EnableRemoveButton();
+}
+
+// -----------------------------------------------------------------------
+
+SvxJavaParameterDlg::~SvxJavaParameterDlg()
+{
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaParameterDlg, ModifyHdl_Impl, Edit *, EMPTYARG )
+{
+ String sParam = STRIM( m_aParameterEdit.GetText() );
+ m_aAssignBtn.Enable( sParam.Len() > 0 );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaParameterDlg, AssignHdl_Impl, PushButton *, EMPTYARG )
+{
+ String sParam = STRIM( m_aParameterEdit.GetText() );
+ if ( sParam.Len() > 0 )
+ {
+ USHORT nPos = m_aAssignedList.GetEntryPos( sParam );
+ if ( LISTBOX_ENTRY_NOTFOUND == nPos )
+ nPos = m_aAssignedList.InsertEntry( sParam );
+ m_aAssignedList.SelectEntryPos( nPos );
+ m_aParameterEdit.SetText( String() );
+ ModifyHdl_Impl( &m_aParameterEdit );
+ EnableRemoveButton();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaParameterDlg, SelectHdl_Impl, ListBox *, EMPTYARG )
+{
+ EnableRemoveButton();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaParameterDlg, DblClickHdl_Impl, ListBox *, EMPTYARG )
+{
+ USHORT nPos = m_aAssignedList.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ m_aParameterEdit.SetText( m_aAssignedList.GetEntry( nPos ) );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaParameterDlg, RemoveHdl_Impl, PushButton *, EMPTYARG )
+{
+ USHORT nPos = m_aAssignedList.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ m_aAssignedList.RemoveEntry( nPos );
+ USHORT nCount = m_aAssignedList.GetEntryCount();
+ if ( nCount )
+ {
+ if ( nPos >= nCount )
+ nPos = ( nCount - 1 );
+ m_aAssignedList.SelectEntryPos( nPos );
+ }
+ }
+ EnableRemoveButton();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+short SvxJavaParameterDlg::Execute()
+{
+ m_aParameterEdit.GrabFocus();
+ m_aAssignedList.SetNoSelection();
+ return ModalDialog::Execute();
+}
+
+// -----------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > SvxJavaParameterDlg::GetParameters() const
+{
+ USHORT nCount = m_aAssignedList.GetEntryCount();
+ Sequence< ::rtl::OUString > aParamList( nCount );
+ ::rtl::OUString* pArray = aParamList.getArray();
+ for ( USHORT i = 0; i < nCount; ++i )
+ pArray[i] = ::rtl::OUString( m_aAssignedList.GetEntry(i) );
+ return aParamList;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaParameterDlg::SetParameters( Sequence< ::rtl::OUString >& rParams )
+{
+ m_aAssignedList.Clear();
+ ULONG i, nCount = rParams.getLength();
+ const ::rtl::OUString* pArray = rParams.getConstArray();
+ for ( i = 0; i < nCount; ++i )
+ {
+ String sParam = String( *pArray++ );
+ m_aAssignedList.InsertEntry( sParam );
+ }
+}
+
+// class SvxJavaClassPathDlg ---------------------------------------------
+
+SvxJavaClassPathDlg::SvxJavaClassPathDlg( Window* pParent ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_JAVA_CLASSPATH ) ),
+
+ m_aPathLabel ( this, SVX_RES( FT_PATH ) ),
+ m_aPathList ( this, SVX_RES( LB_PATH ) ),
+ m_aAddArchiveBtn ( this, SVX_RES( PB_ADDARCHIVE ) ),
+ m_aAddPathBtn ( this, SVX_RES( PB_ADDPATH ) ),
+ m_aRemoveBtn ( this, SVX_RES( PB_REMOVE_PATH ) ),
+ m_aButtonsLine ( this, SVX_RES( FL_PATH_BUTTONS ) ),
+ m_aOKBtn ( this, SVX_RES( PB_PATH_OK ) ),
+ m_aCancelBtn ( this, SVX_RES( PB_PATH_ESC ) ),
+ m_aHelpBtn ( this, SVX_RES( PB_PATH_HLP ) )
+
+{
+ FreeResource();
+
+ m_aAddArchiveBtn.SetClickHdl( LINK( this, SvxJavaClassPathDlg, AddArchiveHdl_Impl ) );
+ m_aAddPathBtn.SetClickHdl( LINK( this, SvxJavaClassPathDlg, AddPathHdl_Impl ) );
+ m_aRemoveBtn.SetClickHdl( LINK( this, SvxJavaClassPathDlg, RemoveHdl_Impl ) );
+ m_aPathList.SetSelectHdl( LINK( this, SvxJavaClassPathDlg, SelectHdl_Impl ) );
+
+ // check if the buttons text are not too wide otherwise we have to stretch the buttons
+ // and shrink the listbox
+ long nTxtWidth1 = m_aAddArchiveBtn.GetTextWidth( m_aAddArchiveBtn.GetText() );
+ long nTxtWidth2 = m_aAddPathBtn.GetTextWidth( m_aAddPathBtn.GetText() );
+ Size aBtnSz = m_aAddArchiveBtn.GetSizePixel();
+ if ( nTxtWidth1 > aBtnSz.Width() || nTxtWidth2 > aBtnSz.Width() )
+ {
+ long nW = ( nTxtWidth1 > aBtnSz.Width() ) ? nTxtWidth1 : nTxtWidth2;
+ long nDelta = nW - aBtnSz.Width() + 2 * BUTTON_BORDER;
+ aBtnSz.Width() += nDelta;
+ Point aBtnPnt = m_aAddArchiveBtn.GetPosPixel();
+ aBtnPnt.X() -= nDelta;
+ m_aAddArchiveBtn.SetPosSizePixel( aBtnPnt, aBtnSz );
+ aBtnPnt = m_aAddPathBtn.GetPosPixel();
+ aBtnPnt.X() -= nDelta;
+ m_aAddPathBtn.SetPosSizePixel( aBtnPnt, aBtnSz );
+ aBtnPnt = m_aRemoveBtn.GetPosPixel();
+ aBtnPnt.X() -= nDelta;
+ m_aRemoveBtn.SetPosSizePixel( aBtnPnt, aBtnSz );
+ Size aBoxSz = m_aPathList.GetSizePixel();
+ aBoxSz.Width() -= nDelta;
+ m_aPathList.SetSizePixel( aBoxSz );
+ }
+
+ // set initial focus to path list
+ m_aPathList.GrabFocus();
+}
+
+// -----------------------------------------------------------------------
+
+SvxJavaClassPathDlg::~SvxJavaClassPathDlg()
+{
+ USHORT i, nCount = m_aPathList.GetEntryCount();
+ for ( i = 0; i < nCount; ++i )
+ delete static_cast< String* >( m_aPathList.GetEntryData(i) );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaClassPathDlg, AddArchiveHdl_Impl, PushButton *, EMPTYARG )
+{
+ sfx2::FileDialogHelper aDlg( TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ aDlg.SetTitle( SVX_RES( RID_SVXSTR_ARCHIVE_TITLE ) );
+ aDlg.AddFilter( SVX_RES( RID_SVXSTR_ARCHIVE_HEADLINE ), String::CreateFromAscii("*.jar;*.zip") );
+ String sFolder;
+ if ( m_aPathList.GetSelectEntryCount() > 0 )
+ {
+ INetURLObject aObj( m_aPathList.GetSelectEntry(), INetURLObject::FSYS_DETECT );
+ sFolder = aObj.GetMainURL( INetURLObject::NO_DECODE );
+ }
+ else
+ sFolder = SvtPathOptions().GetWorkPath();
+ aDlg.SetDisplayDirectory( sFolder );
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ String sURL = aDlg.GetPath();
+ INetURLObject aURL( sURL );
+ String sFile = aURL.getFSysPath( INetURLObject::FSYS_DETECT );
+ if ( !IsPathDuplicate( sURL ) )
+ {
+ USHORT nPos = m_aPathList.InsertEntry( sFile, SvFileInformationManager::GetImage( aURL ) );
+ m_aPathList.SelectEntryPos( nPos );
+ }
+ else
+ {
+ String sMsg( SVX_RES( RID_SVXSTR_MULTIFILE_DBL_ERR ) );
+ sMsg.SearchAndReplaceAscii( "%1", sFile );
+ ErrorBox( this, WB_OK, sMsg ).Execute();
+ }
+ }
+ EnableRemoveButton();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaClassPathDlg, AddPathHdl_Impl, PushButton *, EMPTYARG )
+{
+ rtl::OUString sService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) );
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ Reference < XFolderPicker > xFolderPicker( xFactory->createInstance( sService ), UNO_QUERY );
+
+ String sOldFolder;
+ if ( m_aPathList.GetSelectEntryCount() > 0 )
+ {
+ INetURLObject aObj( m_aPathList.GetSelectEntry(), INetURLObject::FSYS_DETECT );
+ sOldFolder = aObj.GetMainURL( INetURLObject::NO_DECODE );
+ }
+ else
+ sOldFolder = SvtPathOptions().GetWorkPath();
+ xFolderPicker->setDisplayDirectory( sOldFolder );
+ if ( xFolderPicker->execute() == ExecutableDialogResults::OK )
+ {
+ String sFolderURL( xFolderPicker->getDirectory() );
+ INetURLObject aURL( sFolderURL );
+ String sNewFolder = aURL.getFSysPath( INetURLObject::FSYS_DETECT );
+ if ( !IsPathDuplicate( sFolderURL ) )
+ {
+ USHORT nPos = m_aPathList.InsertEntry( sNewFolder, SvFileInformationManager::GetImage( aURL ) );
+ m_aPathList.SelectEntryPos( nPos );
+ }
+ else
+ {
+ String sMsg( SVX_RES( RID_SVXSTR_MULTIFILE_DBL_ERR ) );
+ sMsg.SearchAndReplaceAscii( "%1", sNewFolder );
+ ErrorBox( this, WB_OK, sMsg ).Execute();
+ }
+ }
+ EnableRemoveButton();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaClassPathDlg, RemoveHdl_Impl, PushButton *, EMPTYARG )
+{
+ USHORT nPos = m_aPathList.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ m_aPathList.RemoveEntry( nPos );
+ USHORT nCount = m_aPathList.GetEntryCount();
+ if ( nCount )
+ {
+ if ( nPos >= nCount )
+ nPos = ( nCount - 1 );
+ m_aPathList.SelectEntryPos( nPos );
+ }
+ }
+
+ EnableRemoveButton();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaClassPathDlg, SelectHdl_Impl, ListBox *, EMPTYARG )
+{
+ EnableRemoveButton();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+bool SvxJavaClassPathDlg::IsPathDuplicate( const String& _rPath )
+{
+ bool bRet = false;
+ INetURLObject aFileObj( _rPath );
+ USHORT nCount = m_aPathList.GetEntryCount();
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ INetURLObject aOtherObj( m_aPathList.GetEntry(i), INetURLObject::FSYS_DETECT );
+ if ( aOtherObj == aFileObj )
+ {
+ bRet = true;
+ break;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+String SvxJavaClassPathDlg::GetClassPath() const
+{
+ String sPath;
+ USHORT nCount = m_aPathList.GetEntryCount();
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ if ( sPath.Len() > 0 )
+ sPath += CLASSPATH_DELIMITER;
+ String* pFullPath = static_cast< String* >( m_aPathList.GetEntryData(i) );
+ if ( pFullPath )
+ sPath += *pFullPath;
+ else
+ sPath += m_aPathList.GetEntry(i);
+ }
+ return sPath;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaClassPathDlg::SetClassPath( const String& _rPath )
+{
+ if ( m_sOldPath.Len() == 0 )
+ m_sOldPath = _rPath;
+ m_aPathList.Clear();
+ xub_StrLen i, nIdx = 0;
+ xub_StrLen nCount = _rPath.GetTokenCount( CLASSPATH_DELIMITER );
+ for ( i = 0; i < nCount; ++i )
+ {
+ String sToken = _rPath.GetToken( 0, CLASSPATH_DELIMITER, nIdx );
+ INetURLObject aURL( sToken, INetURLObject::FSYS_DETECT );
+ String sPath = aURL.getFSysPath( INetURLObject::FSYS_DETECT );
+ m_aPathList.InsertEntry( sPath, SvFileInformationManager::GetImage( aURL ) );
+ }
+ // select first entry
+ m_aPathList.SelectEntryPos(0);
+ SelectHdl_Impl( NULL );
+}
+
diff --git a/cui/source/options/optjava.hrc b/cui/source/options/optjava.hrc
new file mode 100644
index 000000000000..ac4b0108cc47
--- /dev/null
+++ b/cui/source/options/optjava.hrc
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * 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: optjava.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTJAVA_HRC
+#define _SVX_OPTJAVA_HRC
+
+// defines ---------------------------------------------------------------
+
+// class SvxJavaOptionsPage ----------------------------------------------
+
+#define FL_JAVA 10
+#define CB_JAVA_ENABLE 11
+#define FT_JAVA_FOUND 12
+#define LB_JAVA 13
+#define FT_JAVA_PATH 14
+
+#define PB_ADD 20
+#define PB_PARAMETER 21
+#define PB_CLASSPATH 22
+
+#define STR_INSTALLED_IN 30
+#define STR_ACCESSIBILITY 31
+#define STR_ADDDLGTEXT 32
+
+#define STR_HEADER_VENDOR 40
+#define STR_HEADER_VERSION 41
+#define STR_HEADER_FEATURES 42
+
+// class SvxJavaParameterDlg ---------------------------------------------
+
+#define FT_PARAMETER 10
+#define ED_PARAMETER 11
+#define PB_ASSIGN 12
+
+#define FT_ASSIGNED 20
+#define LB_ASSIGNED 21
+#define FT_EXAMPLE 22
+#define PB_REMOVE 23
+
+#define FL_BUTTONS 30
+#define PB_PARAMETER_OK 31
+#define PB_PARAMETER_ESC 32
+#define PB_PARAMETER_HLP 33
+
+// class SvxJavaClassPathDlg ---------------------------------------------
+
+#define FT_PATH 10
+#define LB_PATH 11
+
+#define PB_ADDARCHIVE 20
+#define PB_ADDPATH 21
+#define PB_REMOVE_PATH 22
+
+#define FL_PATH_BUTTONS 30
+#define PB_PATH_OK 31
+#define PB_PATH_ESC 32
+#define PB_PATH_HLP 33
+
+#endif // #ifndef _SVX_OPTJAVA_HRC
+
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
new file mode 100644
index 000000000000..2b2ac090ca07
--- /dev/null
+++ b/cui/source/options/optjava.hxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * 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: optjava.hxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTJAVA_HXX
+#define _SVX_OPTJAVA_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vector>
+#include <ucbhelper/content.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/timer.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/simptabl.hxx>
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <svtools/dialogclosedlistener.hxx>
+#include "radiobtnbox.hxx"
+
+// forward ---------------------------------------------------------------
+
+typedef struct _JavaInfo JavaInfo;
+
+class SvxJavaParameterDlg;
+class SvxJavaClassPathDlg;
+
+// class SvxJavaTable ----------------------------------------------------
+
+class SvxJavaTable : public SvxSimpleTable
+{
+ using SvxSimpleTable::SetTabs;
+private:
+ Point m_aCurMousePoint;
+
+protected:
+ virtual void SetTabs();
+ virtual void MouseButtonUp( const MouseEvent& _rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+public:
+ SvxJavaTable( Window* _pParent, const ResId& _rId );
+ ~SvxJavaTable();
+
+
+ inline Point GetCurMousePoint() { return m_aCurMousePoint; }
+};
+
+// class SvxJavaOptionsPage ----------------------------------------------
+
+class SvxJavaOptionsPage : public SfxTabPage
+{
+private:
+ FixedLine m_aJavaLine;
+ CheckBox m_aJavaEnableCB;
+ FixedText m_aJavaFoundLabel;
+ svx::SvxRadioButtonListBox m_aJavaList;
+ FixedText m_aJavaPathText;
+ PushButton m_aAddBtn;
+ PushButton m_aParameterBtn;
+ PushButton m_aClassPathBtn;
+
+ SvxJavaParameterDlg* m_pParamDlg;
+ SvxJavaClassPathDlg* m_pPathDlg;
+
+ JavaInfo** m_parJavaInfo;
+ rtl_uString** m_parParameters;
+ rtl_uString* m_pClassPath;
+ sal_Int32 m_nInfoSize;
+ sal_Int32 m_nParamSize;
+ String m_sInstallText;
+ String m_sAccessibilityText;
+ String m_sAddDialogText;
+ Timer m_aResetTimer;
+
+ ::std::vector< JavaInfo* >
+ m_aAddedInfos;
+
+ ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker;
+
+ DECL_LINK( EnableHdl_Impl, CheckBox * );
+ DECL_LINK( CheckHdl_Impl, SvxSimpleTable * );
+ DECL_LINK( SelectHdl_Impl, SvxSimpleTable * );
+ DECL_LINK( AddHdl_Impl, PushButton * );
+ DECL_LINK( ParameterHdl_Impl, PushButton * );
+ DECL_LINK( ClassPathHdl_Impl, PushButton * );
+ DECL_LINK( ResetHdl_Impl, Timer * );
+
+ DECL_LINK( StartFolderPickerHdl, void * );
+ DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
+
+ void ClearJavaInfo();
+ void ClearJavaList();
+ void LoadJREs();
+ void AddJRE( JavaInfo* _pInfo );
+ void HandleCheckEntry( SvLBoxEntry* _pEntry );
+ void AddFolder( const ::rtl::OUString& _rFolder );
+
+public:
+ SvxJavaOptionsPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxJavaOptionsPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void FillUserData();
+};
+
+// class SvxJavaParameterDlg ---------------------------------------------
+
+class SvxJavaParameterDlg : public ModalDialog
+{
+private:
+ FixedText m_aParameterLabel;
+ Edit m_aParameterEdit;
+ PushButton m_aAssignBtn;
+
+ FixedText m_aAssignedLabel;
+ ListBox m_aAssignedList;
+ FixedText m_aExampleText;
+ PushButton m_aRemoveBtn;
+
+ FixedLine m_aButtonsLine;
+ OKButton m_aOKBtn;
+ CancelButton m_aCancelBtn;
+ HelpButton m_aHelpBtn;
+
+ DECL_LINK( ModifyHdl_Impl, Edit * );
+ DECL_LINK( AssignHdl_Impl, PushButton * );
+ DECL_LINK( SelectHdl_Impl, ListBox * );
+ DECL_LINK( DblClickHdl_Impl, ListBox * );
+ DECL_LINK( RemoveHdl_Impl, PushButton * );
+
+ inline void EnableRemoveButton()
+ { m_aRemoveBtn.Enable(
+ m_aAssignedList.GetSelectEntryPos()
+ != LISTBOX_ENTRY_NOTFOUND ); }
+
+
+public:
+ SvxJavaParameterDlg( Window* pParent );
+ ~SvxJavaParameterDlg();
+
+ virtual short Execute();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > GetParameters() const;
+ void SetParameters( ::com::sun::star::uno::Sequence< ::rtl::OUString >& rParams );
+};
+
+// class SvxJavaClassPathDlg ---------------------------------------------
+
+class SvxJavaClassPathDlg : public ModalDialog
+{
+private:
+ FixedText m_aPathLabel;
+ ListBox m_aPathList;
+ PushButton m_aAddArchiveBtn;
+ PushButton m_aAddPathBtn;
+ PushButton m_aRemoveBtn;
+
+ FixedLine m_aButtonsLine;
+ OKButton m_aOKBtn;
+ CancelButton m_aCancelBtn;
+ HelpButton m_aHelpBtn;
+
+ String m_sOldPath;
+
+ DECL_LINK( AddArchiveHdl_Impl, PushButton * );
+ DECL_LINK( AddPathHdl_Impl, PushButton * );
+ DECL_LINK( RemoveHdl_Impl, PushButton * );
+ DECL_LINK( SelectHdl_Impl, ListBox * );
+
+ bool IsPathDuplicate( const String& _rPath );
+ inline void EnableRemoveButton()
+ { m_aRemoveBtn.Enable(
+ m_aPathList.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ); }
+
+public:
+ SvxJavaClassPathDlg( Window* pParent );
+ ~SvxJavaClassPathDlg();
+
+ inline const String& GetOldPath() const { return m_sOldPath; }
+ inline void SetFocus() { m_aPathList.GrabFocus(); }
+
+ String GetClassPath() const;
+ void SetClassPath( const String& _rPath );
+};
+
+#endif // #ifndef _SVX_OPTJAVA_HXX
+
diff --git a/cui/source/options/optjava.src b/cui/source/options/optjava.src
new file mode 100644
index 000000000000..56ea49e1b3fd
--- /dev/null
+++ b/cui/source/options/optjava.src
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * 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: optjava.src,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include --------------------------------------------------------------
+
+#include "optjava.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+// RID_SVXPAGE_OPTIONS_JAVA ----------------------------------------------
+
+TabPage RID_SVXPAGE_OPTIONS_JAVA
+{
+ HelpId = HID_OPTIONS_JAVA ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Java" ;
+
+ FixedLine FL_JAVA
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Java options" ;
+ };
+ CheckBox CB_JAVA_ENABLE
+ {
+ Pos = MAP_APPFONT ( 12, 14 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "~Use a Java runtime environment" ;
+ };
+ FixedText FT_JAVA_FOUND
+ {
+ Pos = MAP_APPFONT ( 21 , 27 ) ;
+ Size = MAP_APPFONT ( 233 , 8 ) ;
+ Text [ en-US ] = "~Java runtime environments (JRE) already installed:" ;
+ };
+ Control LB_JAVA
+ {
+ Pos = MAP_APPFONT ( 21 , 38 ) ;
+ Size = MAP_APPFONT ( 177 , 130 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_JAVA_PATH
+ {
+ Pos = MAP_APPFONT ( 21 , 171 ) ;
+ Size = MAP_APPFONT ( 233 , 8 ) ;
+ NoLabel = TRUE ;
+ };
+ PushButton PB_ADD
+ {
+ Pos = MAP_APPFONT ( 204 , 38 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add..." ;
+ };
+ PushButton PB_PARAMETER
+ {
+ Pos = MAP_APPFONT ( 204 , 55 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Parameters..." ;
+ };
+ PushButton PB_CLASSPATH
+ {
+ Pos = MAP_APPFONT ( 204 , 72 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Class Path..." ;
+ };
+ String STR_INSTALLED_IN
+ {
+ Text [ en-US ] = "Location: " ;
+ };
+ String STR_ACCESSIBILITY
+ {
+ Text [ en-US ] = "with accessibility support" ;
+ };
+ String STR_ADDDLGTEXT
+ {
+ Text [ en-US ] = "Select a Java Runtime Environment" ;
+ };
+ String STR_HEADER_VENDOR
+ {
+ Text [ en-US ] = "Vendor" ;
+ };
+ String STR_HEADER_VERSION
+ {
+ Text [ en-US ] = "Version" ;
+ };
+ String STR_HEADER_FEATURES
+ {
+ Text [ en-US ] = "Features" ;
+ };
+};
+
+// RID_SVXDLG_JAVA_PARAMETER ---------------------------------------------
+
+ModalDialog RID_SVXDLG_JAVA_PARAMETER
+{
+ HelpId = HID_OPTIONS_JAVA_PARAMETER ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 270 , 140 ) ;
+ Text [ en-US ] = "Java Start Parameters" ;
+ Moveable = TRUE ;
+ FixedText FT_PARAMETER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ Text [ en-US ] = "Java start ~parameter" ;
+ };
+ Edit ED_PARAMETER
+ {
+ Pos = MAP_APPFONT ( 6 , 15 ) ;
+ Size = MAP_APPFONT ( 202 , 12 ) ;
+ Border = TRUE ;
+ };
+ PushButton PB_ASSIGN
+ {
+ Pos = MAP_APPFONT ( 214 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Assign" ;
+ };
+ FixedText FT_ASSIGNED
+ {
+ Pos = MAP_APPFONT ( 6 , 31 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ Text [ en-US ] = "Assig~ned start parameters" ;
+ };
+ ListBox LB_ASSIGNED
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 42 ) ;
+ Size = MAP_APPFONT ( 202 , 53 ) ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_EXAMPLE
+ {
+ Pos = MAP_APPFONT ( 6 , 98 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ Text [ en-US ] = "For example: -Dmyprop=c:\\program files\\java" ;
+ };
+ PushButton PB_REMOVE
+ {
+ Pos = MAP_APPFONT ( 214 , 42 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Remove" ;
+ };
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT ( 3 , 109 ) ;
+ Size = MAP_APPFONT ( 264 , 8 ) ;
+ };
+ OKButton PB_PARAMETER_OK
+ {
+ Pos = MAP_APPFONT ( 105 , 120 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_PARAMETER_ESC
+ {
+ Pos = MAP_APPFONT ( 158 , 120 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_PARAMETER_HLP
+ {
+ Pos = MAP_APPFONT ( 214 , 120 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+// RID_SVXDLG_JAVA_CLASSPATH ---------------------------------------------
+
+ModalDialog RID_SVXDLG_JAVA_CLASSPATH
+{
+ HelpId = HID_OPTIONS_JAVA_CLASSPATH ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 240 , 120 ) ;
+ Text [ en-US ] = "Class Path" ;
+ Moveable = TRUE ;
+ FixedText FT_PATH
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 172 , 8 ) ;
+ Text [ en-US ] = "A~ssigned folders and archives" ;
+ };
+ ListBox LB_PATH
+ {
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 172 , 72 ) ;
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ PushButton PB_ADDARCHIVE
+ {
+ Pos = MAP_APPFONT ( 184 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add Archive..." ;
+ };
+ PushButton PB_ADDPATH
+ {
+ Pos = MAP_APPFONT ( 184 , 31 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Add ~Folder" ;
+ };
+ PushButton PB_REMOVE_PATH
+ {
+ Pos = MAP_APPFONT ( 184 , 48 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Remove" ;
+ };
+ FixedLine FL_PATH_BUTTONS
+ {
+ Pos = MAP_APPFONT ( 3 , 89 ) ;
+ Size = MAP_APPFONT ( 236 , 8 ) ;
+ };
+ OKButton PB_PATH_OK
+ {
+ Pos = MAP_APPFONT ( 75 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_PATH_ESC
+ {
+ Pos = MAP_APPFONT ( 128 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_PATH_HLP
+ {
+ Pos = MAP_APPFONT ( 186 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+ErrorBox RID_SVXERR_JRE_NOT_RECOGNIZED
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "The folder you selected does not contain a Java runtime environment.\nPlease select a different folder." ;
+};
+
+ErrorBox RID_SVXERR_JRE_FAILED_VERSION
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "The Java runtime environment you selected is not the required version.\nPlease select a different folder." ;
+};
+
+WarningBox RID_SVX_MSGBOX_JAVA_RESTART
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "For the selected Java runtime environment to work properly, %PRODUCTNAME must be restarted.\nPlease restart %PRODUCTNAME now." ;
+};
+
+WarningBox RID_SVX_MSGBOX_JAVA_RESTART2
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "You have to restart %PRODUCTNAME so the new or modified values can take effect.\nPlease restart %PRODUCTNAME now." ;
+};
+
diff --git a/cui/source/options/optjsearch.cxx b/cui/source/options/optjsearch.cxx
new file mode 100644
index 000000000000..8e1c8e39af0f
--- /dev/null
+++ b/cui/source/options/optjsearch.cxx
@@ -0,0 +1,385 @@
+/*************************************************************************
+ *
+ * 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: optjsearch.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <tools/shl.hxx>
+#include <unotools/searchopt.hxx>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <optjsearch.hxx>
+#include "optjsearch.hrc"
+
+using namespace com::sun::star::i18n;
+
+//////////////////////////////////////////////////////////////////////
+
+SvxJSearchOptionsPage::SvxJSearchOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_JSEARCH_OPTIONS ), rSet ),
+
+ aTreatAsEqual ( this, SVX_RES( FL_TREAT_AS_EQUAL ) ),
+ aMatchCase ( this, SVX_RES( CB_MATCH_CASE ) ),
+ aMatchFullHalfWidth ( this, SVX_RES( CB_MATCH_FULL_HALF_WIDTH ) ),
+ aMatchHiraganaKatakana ( this, SVX_RES( CB_MATCH_HIRAGANA_KATAKANA ) ),
+ aMatchContractions ( this, SVX_RES( CB_MATCH_CONTRACTIONS ) ),
+ aMatchMinusDashChoon ( this, SVX_RES( CB_MATCH_MINUS_DASH_CHOON ) ),
+ aMatchRepeatCharMarks ( this, SVX_RES( CB_MATCH_REPEAT_CHAR_MARKS ) ),
+ aMatchVariantFormKanji ( this, SVX_RES( CB_MATCH_VARIANT_FORM_KANJI ) ),
+ aMatchOldKanaForms ( this, SVX_RES( CB_MATCH_OLD_KANA_FORMS ) ),
+ aMatchDiziDuzu ( this, SVX_RES( CB_MATCH_DIZI_DUZU ) ),
+ aMatchBavaHafa ( this, SVX_RES( CB_MATCH_BAVA_HAFA ) ),
+ aMatchTsithichiDhizi ( this, SVX_RES( CB_MATCH_TSITHICHI_DHIZI ) ),
+ aMatchHyuiyuByuvyu ( this, SVX_RES( CB_MATCH_HYUFYU_BYUVYU ) ),
+ aMatchSesheZeje ( this, SVX_RES( CB_MATCH_SESHE_ZEJE ) ),
+ aMatchIaiya ( this, SVX_RES( CB_MATCH_IAIYA ) ),
+ aMatchKiku ( this, SVX_RES( CB_MATCH_KIKU ) ),
+ aMatchProlongedSoundMark ( this, SVX_RES( CB_MATCH_PROLONGED_SOUNDMARK ) ),
+ aIgnore ( this, SVX_RES( FL_IGNORE ) ),
+ aIgnorePunctuation ( this, SVX_RES( CB_IGNORE_PUNCTUATION ) ),
+ aIgnoreWhitespace ( this, SVX_RES( CB_IGNORE_WHITESPACES ) ),
+ aIgnoreMiddleDot ( this, SVX_RES( CB_IGNORE_MIDDLE_DOT ) )
+{
+ FreeResource();
+ bSaveOptions = TRUE;
+ nTransliterationFlags = 0x00000000;
+}
+
+
+SvxJSearchOptionsPage::~SvxJSearchOptionsPage()
+{
+}
+
+
+SfxTabPage* SvxJSearchOptionsPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxJSearchOptionsPage( pParent, rSet );
+}
+
+
+void SvxJSearchOptionsPage::SetTransliterationFlags( INT32 nSettings )
+{
+ BOOL bVal = 0 != (nSettings & TransliterationModules_IGNORE_CASE);
+ aMatchCase .Check( bVal ); //! treat as equal uppercase/lowercase
+ bVal = 0 != (nSettings & TransliterationModules_IGNORE_WIDTH);
+ aMatchFullHalfWidth .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_IGNORE_KANA);
+ aMatchHiraganaKatakana .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreSize_ja_JP);
+ aMatchContractions .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreMinusSign_ja_JP);
+ aMatchMinusDashChoon .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreIterationMark_ja_JP);
+ aMatchRepeatCharMarks .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreTraditionalKanji_ja_JP);
+ aMatchVariantFormKanji .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreTraditionalKana_ja_JP);
+ aMatchOldKanaForms .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreZiZu_ja_JP);
+ aMatchDiziDuzu .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreBaFa_ja_JP);
+ aMatchBavaHafa .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreTiJi_ja_JP);
+ aMatchTsithichiDhizi .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreHyuByu_ja_JP);
+ aMatchHyuiyuByuvyu .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreSeZe_ja_JP);
+ aMatchSesheZeje .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreIandEfollowedByYa_ja_JP);
+ aMatchIaiya .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreKiKuFollowedBySa_ja_JP);
+ aMatchKiku .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreSeparator_ja_JP);
+ aIgnorePunctuation .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreSpace_ja_JP);
+ aIgnoreWhitespace .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreProlongedSoundMark_ja_JP);
+ aMatchProlongedSoundMark.Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreMiddleDot_ja_JP);
+ aIgnoreMiddleDot .Check( bVal );
+
+ nTransliterationFlags = nSettings;
+}
+
+
+INT32 SvxJSearchOptionsPage::GetTransliterationFlags_Impl()
+{
+ INT32 nTmp = 0;
+ if (aMatchCase.IsChecked()) //! treat as equal uppercase/lowercase
+ nTmp |= TransliterationModules_IGNORE_CASE;
+ if (aMatchFullHalfWidth.IsChecked())
+ nTmp |= TransliterationModules_IGNORE_WIDTH;
+ if (aMatchHiraganaKatakana.IsChecked())
+ nTmp |= TransliterationModules_IGNORE_KANA;
+ if (aMatchContractions.IsChecked())
+ nTmp |= TransliterationModules_ignoreSize_ja_JP;
+ if (aMatchMinusDashChoon.IsChecked())
+ nTmp |= TransliterationModules_ignoreMinusSign_ja_JP;
+ if (aMatchRepeatCharMarks.IsChecked())
+ nTmp |= TransliterationModules_ignoreIterationMark_ja_JP;
+ if (aMatchVariantFormKanji.IsChecked())
+ nTmp |= TransliterationModules_ignoreTraditionalKanji_ja_JP;
+ if (aMatchOldKanaForms.IsChecked())
+ nTmp |= TransliterationModules_ignoreTraditionalKana_ja_JP;
+ if (aMatchDiziDuzu.IsChecked())
+ nTmp |= TransliterationModules_ignoreZiZu_ja_JP;
+ if (aMatchBavaHafa.IsChecked())
+ nTmp |= TransliterationModules_ignoreBaFa_ja_JP;
+ if (aMatchTsithichiDhizi.IsChecked())
+ nTmp |= TransliterationModules_ignoreTiJi_ja_JP;
+ if (aMatchHyuiyuByuvyu.IsChecked())
+ nTmp |= TransliterationModules_ignoreHyuByu_ja_JP;
+ if (aMatchSesheZeje.IsChecked())
+ nTmp |= TransliterationModules_ignoreSeZe_ja_JP;
+ if (aMatchIaiya.IsChecked())
+ nTmp |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP;
+ if (aMatchKiku.IsChecked())
+ nTmp |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP;
+ if (aIgnorePunctuation.IsChecked())
+ nTmp |= TransliterationModules_ignoreSeparator_ja_JP;
+ if (aIgnoreWhitespace.IsChecked())
+ nTmp |= TransliterationModules_ignoreSpace_ja_JP;
+ if (aMatchProlongedSoundMark.IsChecked())
+ nTmp |= TransliterationModules_ignoreProlongedSoundMark_ja_JP;
+ if (aIgnoreMiddleDot.IsChecked())
+ nTmp |= TransliterationModules_ignoreMiddleDot_ja_JP;
+
+ nTransliterationFlags = nTmp;
+ return nTransliterationFlags;
+}
+
+
+void SvxJSearchOptionsPage::Reset( const SfxItemSet& )
+{
+ SvtSearchOptions aOpt;
+
+ // read settings from configuration
+ aMatchCase .Check(!aOpt.IsMatchCase() ); //! treat as equal uppercase/lowercase
+ aMatchFullHalfWidth .Check( aOpt.IsMatchFullHalfWidthForms() );
+ aMatchHiraganaKatakana .Check( aOpt.IsMatchHiraganaKatakana() );
+ aMatchContractions .Check( aOpt.IsMatchContractions() );
+ aMatchMinusDashChoon .Check( aOpt.IsMatchMinusDashChoon() );
+ aMatchRepeatCharMarks .Check( aOpt.IsMatchRepeatCharMarks() );
+ aMatchVariantFormKanji .Check( aOpt.IsMatchVariantFormKanji() );
+ aMatchOldKanaForms .Check( aOpt.IsMatchOldKanaForms() );
+ aMatchDiziDuzu .Check( aOpt.IsMatchDiziDuzu() );
+ aMatchBavaHafa .Check( aOpt.IsMatchBavaHafa() );
+ aMatchTsithichiDhizi .Check( aOpt.IsMatchTsithichiDhizi() );
+ aMatchHyuiyuByuvyu .Check( aOpt.IsMatchHyuiyuByuvyu() );
+ aMatchSesheZeje .Check( aOpt.IsMatchSesheZeje() );
+ aMatchIaiya .Check( aOpt.IsMatchIaiya() );
+ aMatchKiku .Check( aOpt.IsMatchKiku() );
+ aIgnorePunctuation .Check( aOpt.IsIgnorePunctuation() );
+ aIgnoreWhitespace .Check( aOpt.IsIgnoreWhitespace() );
+ aMatchProlongedSoundMark .Check( aOpt.IsIgnoreProlongedSoundMark() );
+ aIgnoreMiddleDot .Check( aOpt.IsIgnoreMiddleDot() );
+
+ nTransliterationFlags = GetTransliterationFlags_Impl();
+ DBG_ASSERT( nTransliterationFlags == aOpt.GetTransliterationFlags(),
+ "Transliteration settings different" );
+
+ aMatchCase .SaveValue();
+ aMatchFullHalfWidth .SaveValue();
+ aMatchHiraganaKatakana .SaveValue();
+ aMatchContractions .SaveValue();
+ aMatchMinusDashChoon .SaveValue();
+ aMatchRepeatCharMarks .SaveValue();
+ aMatchVariantFormKanji .SaveValue();
+ aMatchOldKanaForms .SaveValue();
+ aMatchDiziDuzu .SaveValue();
+ aMatchBavaHafa .SaveValue();
+ aMatchTsithichiDhizi .SaveValue();
+ aMatchHyuiyuByuvyu .SaveValue();
+ aMatchSesheZeje .SaveValue();
+ aMatchIaiya .SaveValue();
+ aMatchKiku .SaveValue();
+ aIgnorePunctuation .SaveValue();
+ aIgnoreWhitespace .SaveValue();
+ aMatchProlongedSoundMark .SaveValue();
+ aIgnoreMiddleDot .SaveValue();
+}
+
+
+BOOL SvxJSearchOptionsPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bModified = FALSE;
+
+ INT32 nOldVal = nTransliterationFlags;
+ nTransliterationFlags = GetTransliterationFlags_Impl();
+ bModified = nOldVal != nTransliterationFlags;
+
+ if (!IsSaveOptions())
+ return bModified;
+
+ bModified = FALSE;
+ SvtSearchOptions aOpt;
+ BOOL bNewVal, bChanged;
+
+ bNewVal = aMatchCase.IsChecked(); //! treat as equal uppercase/lowercase
+ bChanged = bNewVal != aMatchCase.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchCase(!bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchFullHalfWidth.IsChecked();
+ bChanged = bNewVal != aMatchFullHalfWidth.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchFullHalfWidthForms( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchHiraganaKatakana.IsChecked();
+ bChanged = bNewVal != aMatchHiraganaKatakana.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchHiraganaKatakana( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchContractions.IsChecked();
+ bChanged = bNewVal != aMatchContractions.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchContractions( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchMinusDashChoon.IsChecked();
+ bChanged = bNewVal != aMatchMinusDashChoon.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchMinusDashChoon( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchRepeatCharMarks.IsChecked();
+ bChanged = bNewVal != aMatchRepeatCharMarks.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchRepeatCharMarks( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchVariantFormKanji.IsChecked();
+ bChanged = bNewVal != aMatchVariantFormKanji.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchVariantFormKanji( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchOldKanaForms.IsChecked();
+ bChanged = bNewVal != aMatchOldKanaForms.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchOldKanaForms( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchDiziDuzu.IsChecked();
+ bChanged = bNewVal != aMatchDiziDuzu.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchDiziDuzu( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchBavaHafa.IsChecked();
+ bChanged = bNewVal != aMatchBavaHafa.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchBavaHafa( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchTsithichiDhizi.IsChecked();
+ bChanged = bNewVal != aMatchTsithichiDhizi.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchTsithichiDhizi( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchHyuiyuByuvyu.IsChecked();
+ bChanged = bNewVal != aMatchHyuiyuByuvyu.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchHyuiyuByuvyu( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchSesheZeje.IsChecked();
+ bChanged = bNewVal != aMatchSesheZeje.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchSesheZeje( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchIaiya.IsChecked();
+ bChanged = bNewVal != aMatchIaiya.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchIaiya( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchKiku.IsChecked();
+ bChanged = bNewVal != aMatchKiku.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchKiku( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aIgnorePunctuation.IsChecked();
+ bChanged = bNewVal != aIgnorePunctuation.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetIgnorePunctuation( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aIgnoreWhitespace.IsChecked();
+ bChanged = bNewVal != aIgnoreWhitespace.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetIgnoreWhitespace( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchProlongedSoundMark.IsChecked();
+ bChanged = bNewVal != aMatchProlongedSoundMark.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetIgnoreProlongedSoundMark( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aIgnoreMiddleDot.IsChecked();
+ bChanged = bNewVal != aIgnoreMiddleDot.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetIgnoreMiddleDot( bNewVal );
+ bModified = TRUE;
+ }
+
+ return bModified;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
diff --git a/cui/source/options/optjsearch.hrc b/cui/source/options/optjsearch.hrc
new file mode 100644
index 000000000000..dfe6b7bdb07a
--- /dev/null
+++ b/cui/source/options/optjsearch.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optjsearch.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FL_TREAT_AS_EQUAL 100
+#define CB_MATCH_CASE 101
+#define CB_MATCH_FULL_HALF_WIDTH 102
+#define CB_MATCH_HIRAGANA_KATAKANA 103
+#define CB_MATCH_CONTRACTIONS 104
+#define CB_MATCH_MINUS_DASH_CHOON 105
+#define CB_MATCH_REPEAT_CHAR_MARKS 106
+#define CB_MATCH_VARIANT_FORM_KANJI 107
+#define CB_MATCH_OLD_KANA_FORMS 108
+#define CB_MATCH_DIZI_DUZU 109
+#define CB_MATCH_BAVA_HAFA 110
+#define CB_MATCH_TSITHICHI_DHIZI 111
+#define CB_MATCH_HYUFYU_BYUVYU 112
+#define CB_MATCH_SESHE_ZEJE 113
+#define CB_MATCH_IAIYA 114
+#define CB_MATCH_KIKU 115
+
+#define FL_IGNORE 200
+#define CB_IGNORE_PUNCTUATION 201
+#define CB_IGNORE_WHITESPACES 202
+#define CB_MATCH_PROLONGED_SOUNDMARK 203
+#define CB_IGNORE_MIDDLE_DOT 204
+
diff --git a/cui/source/options/optjsearch.hxx b/cui/source/options/optjsearch.hxx
new file mode 100644
index 000000000000..e1d1de79ae2e
--- /dev/null
+++ b/cui/source/options/optjsearch.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * 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: optjsearch.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_OPTJSEARCH_HXX_
+#define _SVX_OPTJSEARCH_HXX_
+
+#include <vcl/fixed.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <sfx2/tabdlg.hxx>
+
+class Window;
+class SfxItemSet;
+
+//////////////////////////////////////////////////////////////////////
+
+class SvxJSearchOptionsPage : public SfxTabPage
+{
+private:
+ FixedLine aTreatAsEqual;
+ CheckBox aMatchCase;
+ CheckBox aMatchFullHalfWidth;
+ CheckBox aMatchHiraganaKatakana;
+ CheckBox aMatchContractions;
+ CheckBox aMatchMinusDashChoon;
+ CheckBox aMatchRepeatCharMarks;
+ CheckBox aMatchVariantFormKanji;
+ CheckBox aMatchOldKanaForms;
+ CheckBox aMatchDiziDuzu;
+ CheckBox aMatchBavaHafa;
+ CheckBox aMatchTsithichiDhizi;
+ CheckBox aMatchHyuiyuByuvyu;
+ CheckBox aMatchSesheZeje;
+ CheckBox aMatchIaiya;
+ CheckBox aMatchKiku;
+ CheckBox aMatchProlongedSoundMark;
+ FixedLine aIgnore;
+ CheckBox aIgnorePunctuation;
+ CheckBox aIgnoreWhitespace;
+ CheckBox aIgnoreMiddleDot;
+
+ INT32 nTransliterationFlags;
+ BOOL bSaveOptions;
+
+ INT32 GetTransliterationFlags_Impl();
+
+protected:
+ SvxJSearchOptionsPage( Window* pParent, const SfxItemSet& rSet );
+
+public:
+ ~SvxJSearchOptionsPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+
+ BOOL IsSaveOptions() const { return bSaveOptions; }
+ void EnableSaveOptions( BOOL bVal ) { bSaveOptions = bVal; }
+
+ INT32 GetTransliterationFlags() const { return nTransliterationFlags; }
+ void SetTransliterationFlags( INT32 nSettings );
+};
+
+//////////////////////////////////////////////////////////////////////
+
+#endif
+
diff --git a/cui/source/options/optjsearch.src b/cui/source/options/optjsearch.src
new file mode 100644
index 000000000000..a0480b7492df
--- /dev/null
+++ b/cui/source/options/optjsearch.src
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * 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: optjsearch.src,v $
+ * $Revision: 1.40 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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.hrc>
+#include <svx/dialogs.hrc>
+
+#include "optjsearch.hrc"
+
+
+TabPage RID_SVXPAGE_JSEARCH_OPTIONS
+{
+ HelpId = HID_SVXPAGE_JSEARCH_OPTIONS ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_TREAT_AS_EQUAL
+ {
+ Pos = MAP_APPFONT( 6, 3 );
+ Size = MAP_APPFONT( 248, 8 );
+ Text [ en-US ] = "Treat as equal";
+ };
+ CheckBox CB_MATCH_CASE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~uppercase/lowercase";
+ };
+ CheckBox CB_MATCH_FULL_HALF_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~full-width/half-width forms";
+ };
+ CheckBox CB_MATCH_HIRAGANA_KATAKANA
+ {
+ Pos = MAP_APPFONT ( 12 , 42 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~hiragana/katakana";
+ };
+ CheckBox CB_MATCH_CONTRACTIONS
+ {
+ Pos = MAP_APPFONT ( 12 , 56 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~contractions (yo-on, sokuon)";
+ };
+ CheckBox CB_MATCH_MINUS_DASH_CHOON
+ {
+ Pos = MAP_APPFONT ( 12 , 70 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~minus/dash/cho-on";
+ };
+ CheckBox CB_MATCH_REPEAT_CHAR_MARKS
+ {
+ Pos = MAP_APPFONT ( 12 , 84 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "'re~peat character' marks";
+ };
+ CheckBox CB_MATCH_VARIANT_FORM_KANJI
+ {
+ Pos = MAP_APPFONT ( 12 , 98 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~variant-form kanji (itaiji)";
+ };
+ CheckBox CB_MATCH_OLD_KANA_FORMS
+ {
+ Pos = MAP_APPFONT ( 12 , 112) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~old Kana forms";
+ };
+ CheckBox CB_MATCH_DIZI_DUZU
+ {
+ Pos = MAP_APPFONT ( 136 , 14 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~di/zi, du/zu";
+ };
+ CheckBox CB_MATCH_BAVA_HAFA
+ {
+ Pos = MAP_APPFONT ( 136 , 28 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~ba/va, ha/fa";
+ };
+ CheckBox CB_MATCH_TSITHICHI_DHIZI
+ {
+ Pos = MAP_APPFONT ( 136 , 42 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~tsi/thi/chi, dhi/zi";
+ };
+ CheckBox CB_MATCH_HYUFYU_BYUVYU
+ {
+ Pos = MAP_APPFONT ( 136 , 56 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "h~yu/fyu, byu/vyu";
+ };
+ CheckBox CB_MATCH_SESHE_ZEJE
+ {
+ Pos = MAP_APPFONT ( 136 , 70 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~se/she, ze/je";
+ };
+ CheckBox CB_MATCH_IAIYA
+ {
+ Pos = MAP_APPFONT ( 136 , 84 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~ia/iya (piano/piyano)";
+ };
+ CheckBox CB_MATCH_KIKU
+ {
+ Pos = MAP_APPFONT ( 136 , 98 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~ki/ku (tekisuto/tekusuto)";
+ };
+ CheckBox CB_MATCH_PROLONGED_SOUNDMARK
+ {
+ Pos = MAP_APPFONT ( 136 , 112 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "Prolon~ged vowels (ka-/kaa)";
+ };
+ FixedLine FL_IGNORE
+ {
+ Pos = MAP_APPFONT( 6, 128 );
+ Size = MAP_APPFONT( 248, 8 );
+ Text [ en-US ] = "Ignore";
+ };
+ CheckBox CB_IGNORE_PUNCTUATION
+ {
+ Pos = MAP_APPFONT ( 12 , 139 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "Pu~nctuation characters";
+ };
+ CheckBox CB_IGNORE_WHITESPACES
+ {
+ Pos = MAP_APPFONT ( 12 , 153 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~Whitespace characters";
+ };
+ CheckBox CB_IGNORE_MIDDLE_DOT
+ {
+ Pos = MAP_APPFONT ( 136 , 139 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "Midd~le dots";
+ };
+ Text [ en-US ] = "Searching in Japanese";
+};
+// end TabPage
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
new file mode 100644
index 000000000000..a7184823eca7
--- /dev/null
+++ b/cui/source/options/optlingu.cxx
@@ -0,0 +1,2555 @@
+/*************************************************************************
+ *
+ * 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: optlingu.cxx,v $
+ * $Revision: 1.68 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <vcl/msgbox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <tools/shl.hxx>
+#include <tools/dynary.hxx>
+#include <i18npool/mslangid.hxx>
+#include <unotools/lingucfg.hxx>
+#include <svx/unolingu.hxx>
+#include <svx/dlgutil.hxx>
+#include <linguistic/lngprops.hxx>
+#include <linguistic/misc.hxx>
+#include <sfx2/sfxuno.hxx>
+#include <sfx2/dispatch.hxx>
+#include <tools/urlobj.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/linguistic2/XSpellChecker.hpp>
+#include <com/sun/star/linguistic2/XProofreader.hpp>
+#include <com/sun/star/linguistic2/XHyphenator.hpp>
+#include <com/sun/star/linguistic2/XThesaurus.hpp>
+#include <com/sun/star/linguistic2/XAvailableLocales.hpp>
+#include <com/sun/star/lang/XServiceDisplayName.hpp>
+#include <com/sun/star/linguistic2/DictionaryListEventFlags.hpp>
+#include <com/sun/star/linguistic2/DictionaryListEvent.hpp>
+#include <com/sun/star/linguistic2/XDictionaryListEventListener.hpp>
+#include <com/sun/star/linguistic2/XDictionaryList.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <unotools/extendedsecurityoptions.hxx>
+#include <svtools/svlbox.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <vcl/svapp.hxx>
+#define _SVX_OPTLINGU_CXX
+#include "optlingu.hrc"
+
+#include <svx/svxdlg.hxx>
+#include <svx/optitems.hxx>
+#include "optlingu.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+#include <ucbhelper/content.hxx>
+
+#include <vector>
+#include <map>
+
+
+using namespace ::ucbhelper;
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::beans;
+namespace css = com::sun::star;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+#define SVX_MAX_USERDICTS 20
+#define CBCOL_FIRST 0
+#define CBCOL_SECOND 1
+#define CBCOL_BOTH 2
+
+static const sal_Char cSpell[] = SN_SPELLCHECKER;
+static const sal_Char cGrammar[] = SN_GRAMMARCHECKER;
+static const sal_Char cHyph[] = SN_HYPHENATOR;
+static const sal_Char cThes[] = SN_THESAURUS;
+
+// static ----------------------------------------------------------------
+
+static Sequence< INT16 > lcl_LocaleSeqToLangSeq( const Sequence< Locale > &rSeq )
+{
+ INT32 nLen = rSeq.getLength();
+ Sequence< INT16 > aRes( nLen );
+ INT16 *pRes = aRes.getArray();
+ const Locale *pSeq = rSeq.getConstArray();
+ for (INT32 i = 0; i < nLen; ++i)
+ {
+ pRes[i] = SvxLocaleToLanguage( pSeq[i] );
+ }
+ return aRes;
+}
+
+
+static BOOL lcl_SeqHasLang( const Sequence< INT16 > &rSeq, INT16 nLang )
+{
+ INT32 nLen = rSeq.getLength();
+ const INT16 *pLang = rSeq.getConstArray();
+ INT32 nPos = -1;
+ for (INT32 i = 0; i < nLen && nPos < 0; ++i)
+ {
+ if (nLang == pLang[i])
+ nPos = i;
+ }
+ return nPos < 0 ? FALSE : TRUE;
+}
+
+
+static INT32 lcl_SeqGetEntryPos(
+ const Sequence< OUString > &rSeq, const OUString &rEntry )
+{
+ INT32 i;
+ INT32 nLen = rSeq.getLength();
+ const OUString *pItem = rSeq.getConstArray();
+ for (i = 0; i < nLen; ++i)
+ {
+ if (rEntry == pItem[i])
+ break;
+ }
+ return i < nLen ? i : -1;
+}
+
+static void lcl_OpenURL( const ::rtl::OUString& rURL )
+{
+ if ( rURL.getLength() > 0 )
+ {
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xSMGR =
+ ::comphelper::getProcessServiceFactory();
+ uno::Reference< css::system::XSystemShellExecute > xSystemShell(
+ xSMGR->createInstance( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ),
+ uno::UNO_QUERY_THROW );
+ if ( xSystemShell.is() )
+ xSystemShell->execute( rURL, ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS );
+ }
+ catch( const uno::Exception& e )
+ {
+ OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
+ rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+ }
+}
+
+/*--------------------------------------------------
+--------------------------------------------------*/
+
+static const sal_uInt16 nNameLen = 8;
+
+static sal_uInt16 pRanges[] =
+{
+ SID_ATTR_SPELL,
+ SID_ATTR_SPELL,
+ 0
+};
+
+sal_Bool KillFile_Impl( const String& rURL )
+{
+ sal_Bool bRet = sal_True;
+ try
+ {
+ Content aCnt( rURL, uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ aCnt.executeCommand( OUString::createFromAscii( "delete" ), makeAny( sal_Bool( sal_True ) ) );
+ }
+ catch( ::com::sun::star::ucb::CommandAbortedException& )
+ {
+ DBG_ERRORFILE( "KillFile: CommandAbortedException" );
+ bRet = sal_False;
+ }
+ catch( ... )
+ {
+ DBG_ERRORFILE( "KillFile: Any other exception" );
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+/* -----------------------------27.11.00 14:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+// 0x 0p 0t 0c nn
+// p: 1 -> parent
+// t: 1 -> spell, 2 -> hyph, 3 -> thes, 4 -> grammar
+// c: 1 -> checked 0 -> unchecked
+// n: index
+
+#define TYPE_SPELL (BYTE)1
+#define TYPE_GRAMMAR (BYTE)2
+#define TYPE_HYPH (BYTE)3
+#define TYPE_THES (BYTE)4
+
+class ModuleUserData_Impl
+{
+ BOOL bParent;
+ BOOL bIsChecked;
+ BYTE nType;
+ BYTE nIndex;
+ String sImplName;
+
+public:
+ ModuleUserData_Impl( String sImpName, BOOL bIsParent, BOOL bChecked, BYTE nSetType, BYTE nSetIndex ) :
+ bParent(bIsParent),
+ bIsChecked(bChecked),
+ nType(nSetType),
+ nIndex(nSetIndex),
+ sImplName(sImpName)
+ {
+ }
+ BOOL IsParent() const {return bParent;}
+ BYTE GetType() const {return nType;}
+ BOOL IsChecked() const {return bIsChecked;}
+ BYTE GetIndex() const {return nIndex;}
+ void SetIndex(BYTE nSet) {nIndex = nSet;}
+ const String& GetImplName() const {return sImplName;}
+
+};
+
+/*--------------------------------------------------
+--------------------------------------------------*/
+//
+// User for user-dictionaries (XDictionary interface)
+//
+class DicUserData
+{
+ ULONG nVal;
+
+public:
+ DicUserData( ULONG nUserData ) : nVal( nUserData ) {}
+ DicUserData( USHORT nEID,
+ BOOL bChecked, BOOL bEditable, BOOL bDeletable );
+
+ ULONG GetUserData() const { return nVal; }
+ USHORT GetEntryId() const { return (USHORT)(nVal >> 16); }
+ BOOL IsChecked() const { return (BOOL)(nVal >> 8) & 0x01; }
+ BOOL IsEditable() const { return (BOOL)(nVal >> 9) & 0x01; }
+ BOOL IsDeletable() const { return (BOOL)(nVal >> 10) & 0x01; }
+
+ void SetChecked( BOOL bVal );
+};
+
+
+DicUserData::DicUserData(
+ USHORT nEID,
+ BOOL bChecked, BOOL bEditable, BOOL bDeletable )
+{
+ DBG_ASSERT( nEID < 65000, "Entry Id out of range" );
+ nVal = ((ULONG)(0xFFFF & nEID) << 16) |
+ ((ULONG)(bChecked ? 1 : 0) << 8) |
+ ((ULONG)(bEditable ? 1 : 0) << 9) |
+ ((ULONG)(bDeletable ? 1 : 0) << 10);
+}
+
+
+void DicUserData::SetChecked( BOOL bVal )
+{
+ nVal &= ~(1UL << 8);
+ nVal |= (ULONG)(bVal ? 1 : 0) << 8;
+}
+
+
+// class BrwString_Impl -------------------------------------------------
+
+void lcl_SetCheckButton( SvLBoxEntry* pEntry, BOOL bCheck )
+{
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXBUTTON));
+
+ DBG_ASSERT(pItem,"SetCheckButton:Item not found");
+ if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
+ {
+ if (bCheck)
+ pItem->SetStateChecked();
+ else
+ pItem->SetStateUnchecked();
+ //InvalidateEntry( pEntry );
+ }
+}
+
+
+class BrwStringDic_Impl : public SvLBoxString
+{
+public:
+
+ BrwStringDic_Impl( SvLBoxEntry* pEntry, USHORT nFlags,
+ const String& rStr ) : SvLBoxString( pEntry, nFlags, rStr ) {}
+
+ virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags,
+ SvLBoxEntry* pEntry);
+};
+
+void BrwStringDic_Impl::Paint( const Point& rPos, SvLBox& rDev, USHORT,
+ SvLBoxEntry* pEntry )
+{
+ ModuleUserData_Impl* pData = (ModuleUserData_Impl*)pEntry->GetUserData();
+ Point aPos(rPos);
+ Font aOldFont( rDev.GetFont());
+ if(pData->IsParent())
+ {
+ Font aFont( aOldFont );
+ aFont.SetWeight( WEIGHT_BOLD );
+ rDev.SetFont( aFont );
+ aPos.X() = 0;
+ }
+ else
+ aPos.X() += 5;
+ rDev.DrawText( aPos, GetText() );
+ rDev.SetFont( aOldFont );
+}
+
+
+/*--------------------------------------------------
+--------------------------------------------------*/
+
+class OptionsBreakSet : public ModalDialog
+{
+ OKButton aOKPB;
+ CancelButton aCancelPB;
+ FixedLine aValFL;
+ NumericField aValNF;
+
+public:
+ OptionsBreakSet(Window* pParent, int nRID) :
+ ModalDialog(pParent, SVX_RES(RID_SVXDLG_LNG_ED_NUM_PREBREAK )),
+ aOKPB (this, SVX_RES(BT_OK_PREBREAK)),
+ aCancelPB (this, SVX_RES(BT_CANCEL_PREBREAK)),
+ aValFL (this, SVX_RES(FL_NUMVAL_PREBREAK)),
+ aValNF (this, SVX_RES(ED_PREBREAK))
+ {
+ DBG_ASSERT( STR_NUM_PRE_BREAK_DLG == nRID ||
+ STR_NUM_POST_BREAK_DLG == nRID ||
+ STR_NUM_MIN_WORDLEN_DLG == nRID, "unexpected RID" );
+
+ if (nRID != -1)
+ aValFL.SetText( String( SVX_RES(nRID) ) );
+ FreeResource();
+ }
+
+ NumericField& GetNumericFld() { return aValNF; }
+};
+
+
+/*--------------------------------------------------
+ Entry IDs for options listbox of dialog
+--------------------------------------------------*/
+
+enum EID_OPTIONS
+{
+ EID_SPELL_AUTO,
+ EID_GRAMMAR_AUTO,
+ EID_CAPITAL_WORDS,
+ EID_WORDS_WITH_DIGITS,
+ EID_CAPITALIZATION,
+ EID_SPELL_SPECIAL,
+ EID_NUM_MIN_WORDLEN,
+ EID_NUM_PRE_BREAK,
+ EID_NUM_POST_BREAK,
+ EID_HYPH_AUTO,
+ EID_HYPH_SPECIAL
+};
+
+//! this array must have an entry for every value of EID_OPTIONS.
+// It is used to get the respective property name.
+static const char * aEidToPropName[] =
+{
+ UPN_IS_SPELL_AUTO, // EID_SPELL_AUTO
+ UPN_IS_GRAMMAR_AUTO, // EID_GRAMMAR_AUTO
+ UPN_IS_SPELL_UPPER_CASE, // EID_CAPITAL_WORDS
+ UPN_IS_SPELL_WITH_DIGITS, // EID_WORDS_WITH_DIGITS
+ UPN_IS_SPELL_CAPITALIZATION, // EID_CAPITALIZATION
+ UPN_IS_SPELL_SPECIAL, // EID_SPELL_SPECIAL
+ UPN_HYPH_MIN_WORD_LENGTH, // EID_NUM_MIN_WORDLEN,
+ UPN_HYPH_MIN_LEADING, // EID_NUM_PRE_BREAK
+ UPN_HYPH_MIN_TRAILING, // EID_NUM_POST_BREAK
+ UPN_IS_HYPH_AUTO, // EID_HYPH_AUTO
+ UPN_IS_HYPH_SPECIAL // EID_HYPH_SPECIAL
+};
+
+
+static inline String lcl_GetPropertyName( EID_OPTIONS eEntryId )
+{
+ DBG_ASSERT( (unsigned int) eEntryId < sizeof(aEidToPropName) / sizeof(aEidToPropName[0]), "index out of range" );
+ return String::CreateFromAscii( aEidToPropName[ (int) eEntryId ] );
+}
+
+// class OptionsUserData -------------------------------------------------
+
+class OptionsUserData
+{
+ ULONG nVal;
+
+ void SetModified();
+
+public:
+ OptionsUserData( ULONG nUserData ) : nVal( nUserData ) {}
+ OptionsUserData( USHORT nEID,
+ BOOL bHasNV, USHORT nNumVal,
+ BOOL bCheckable, BOOL bChecked );
+
+ ULONG GetUserData() const { return nVal; }
+ USHORT GetEntryId() const { return (USHORT)(nVal >> 16); }
+ BOOL HasNumericValue() const { return (BOOL)(nVal >> 10) & 0x01; }
+ USHORT GetNumericValue() const { return (USHORT)(nVal & 0xFF); }
+ BOOL IsChecked() const { return (BOOL)(nVal >> 8) & 0x01; }
+ BOOL IsCheckable() const { return (BOOL)(nVal >> 9) & 0x01; }
+ BOOL IsModified() const { return (BOOL)(nVal >> 11) & 0x01; }
+
+ void SetChecked( BOOL bVal );
+ void SetNumericValue( BYTE nNumVal );
+};
+
+OptionsUserData::OptionsUserData( USHORT nEID,
+ BOOL bHasNV, USHORT nNumVal,
+ BOOL bCheckable, BOOL bChecked )
+{
+ DBG_ASSERT( nEID < 65000, "Entry Id out of range" );
+ DBG_ASSERT( nNumVal < 256, "value out of range" );
+ nVal = ((ULONG)(0xFFFF & nEID) << 16) |
+ ((ULONG)(bHasNV ? 1 : 0) << 10) |
+ ((ULONG)(bCheckable ? 1 : 0) << 9) |
+ ((ULONG)(bChecked ? 1 : 0) << 8) |
+ ((ULONG)(0xFF & nNumVal));
+}
+
+void OptionsUserData::SetChecked( BOOL bVal )
+{
+ if (IsCheckable() && (IsChecked() != bVal))
+ {
+ nVal &= ~(1UL << 8);
+ nVal |= (ULONG)(bVal ? 1 : 0) << 8;
+ SetModified();
+ }
+}
+
+void OptionsUserData::SetNumericValue( BYTE nNumVal )
+{
+// DBG_ASSERT( nNumVal < 256, "value out of range" );
+ if (HasNumericValue() && (GetNumericValue() != nNumVal))
+ {
+ nVal &= 0xffffff00;
+ nVal |= (nNumVal);
+ SetModified();
+ }
+}
+
+void OptionsUserData::SetModified()
+{
+ nVal |= (ULONG)1 << 11;
+}
+
+// class BrwString_Impl -------------------------------------------------
+
+class BrwString_Impl : public SvLBoxString
+{
+public:
+
+ BrwString_Impl( SvLBoxEntry* pEntry, USHORT nFlags,
+ const String& rStr ) : SvLBoxString( pEntry, nFlags, rStr ) {}
+
+ virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags,
+ SvLBoxEntry* pEntry);
+};
+
+void BrwString_Impl::Paint( const Point& rPos, SvLBox& rDev, USHORT,
+ SvLBoxEntry* pEntry )
+{
+ Point aPos(rPos);
+ aPos.X() += 20;
+ rDev.DrawText( aPos, GetText() );
+ if(pEntry->GetUserData())
+ {
+ Point aNewPos(aPos);
+ aNewPos.X() += rDev.GetTextWidth(GetText());
+ Font aOldFont( rDev.GetFont());
+ Font aFont( aOldFont );
+ aFont.SetWeight( WEIGHT_BOLD );
+
+// BOOL bFett = TRUE;
+// USHORT nPos = 0;
+ //??? das untere byte aus dem user data in string wandeln
+ OptionsUserData aData( (ULONG) pEntry->GetUserData() );
+ if(aData.HasNumericValue())
+ {
+ String sTxt( ' ' );
+ sTxt += String::CreateFromInt32( aData.GetNumericValue() );
+ rDev.SetFont( aFont );
+ rDev.DrawText( aNewPos, sTxt );
+ }
+
+// if( STRING_NOTFOUND != nPos )
+// aNewPos.X() += rDev.GetTextWidth( sTxt );
+
+ rDev.SetFont( aOldFont );
+ }
+}
+
+// ServiceInfo_Impl ----------------------------------------------------
+
+struct ServiceInfo_Impl
+{
+ OUString sDisplayName;
+ OUString sSpellImplName;
+ OUString sHyphImplName;
+ OUString sThesImplName;
+ OUString sGrammarImplName;
+ uno::Reference< XSpellChecker > xSpell;
+ uno::Reference< XHyphenator > xHyph;
+ uno::Reference< XThesaurus > xThes;
+ uno::Reference< XProofreader > xGrammar;
+ BOOL bConfigured;
+
+ ServiceInfo_Impl() : bConfigured(sal_False) {}
+};
+
+typedef std::vector< ServiceInfo_Impl > ServiceInfoArr;
+typedef std::map< INT16 /*LanguageType*/, Sequence< OUString > > LangImplNameTable;
+
+
+// SvxLinguData_Impl ----------------------------------------------------
+
+class SvxLinguData_Impl
+{
+ //contains services and implementation names sorted by implementation names
+ ServiceInfoArr aDisplayServiceArr;
+ ULONG nDisplayServices;
+
+ Sequence< Locale > aAllServiceLocales;
+ LangImplNameTable aCfgSpellTable;
+ LangImplNameTable aCfgHyphTable;
+ LangImplNameTable aCfgThesTable;
+ LangImplNameTable aCfgGrammarTable;
+ uno::Reference< XMultiServiceFactory > xMSF;
+ uno::Reference< XLinguServiceManager > xLinguSrvcMgr;
+
+
+ sal_Bool AddRemove( Sequence< OUString > &rConfigured,
+ const OUString &rImplName, BOOL bAdd );
+
+public:
+ SvxLinguData_Impl();
+ SvxLinguData_Impl( const SvxLinguData_Impl &rData );
+ ~SvxLinguData_Impl();
+
+ SvxLinguData_Impl & operator = (const SvxLinguData_Impl &rData);
+
+ uno::Reference<XLinguServiceManager> & GetManager() { return xLinguSrvcMgr; }
+
+ void SetChecked( const Sequence< OUString > &rConfiguredServices );
+ void Reconfigure( const OUString &rDisplayName, BOOL bEnable );
+
+ const Sequence<Locale> & GetAllSupportedLocales() { return aAllServiceLocales; }
+
+ const LangImplNameTable & GetSpellTable() const { return aCfgSpellTable; }
+ LangImplNameTable & GetSpellTable() { return aCfgSpellTable; }
+ const LangImplNameTable & GetHyphTable() const { return aCfgHyphTable; }
+ LangImplNameTable & GetHyphTable() { return aCfgHyphTable; }
+ const LangImplNameTable & GetThesTable() const { return aCfgThesTable; }
+ LangImplNameTable & GetThesTable() { return aCfgThesTable; }
+ const LangImplNameTable & GetGrammarTable() const { return aCfgGrammarTable; }
+ LangImplNameTable & GetGrammarTable() { return aCfgGrammarTable; }
+
+ const ServiceInfoArr & GetDisplayServiceArray() const { return aDisplayServiceArr; }
+ ServiceInfoArr & GetDisplayServiceArray() { return aDisplayServiceArr; }
+
+ const ULONG & GetDisplayServiceCount() const { return nDisplayServices; }
+ void SetDisplayServiceCount( ULONG nVal ) { nDisplayServices = nVal; }
+
+ // returns the list of service implementation names for the specified
+ // language and service (TYPE_SPELL, TYPE_HYPH, TYPE_THES) sorted in
+ // the proper order for the SvxEditModulesDlg (the ones from the
+ // configuration (keeping that order!) first and then the other ones.
+ // I.e. the ones available but not configured in arbitrary order).
+ // They available ones may contain names that do not(!) support that
+ // language.
+ Sequence< OUString > GetSortedImplNames( INT16 nLang, BYTE nType );
+
+ ServiceInfo_Impl * GetInfoByImplName( const OUString &rSvcImplName );
+};
+
+
+INT32 lcl_SeqGetIndex( const Sequence< OUString > &rSeq, const OUString &rTxt )
+{
+ INT32 nRes = -1;
+ INT32 nLen = rSeq.getLength();
+ const OUString *pString = rSeq.getConstArray();
+ for (INT32 i = 0; i < nLen && nRes == -1; ++i)
+ {
+ if (pString[i] == rTxt)
+ nRes = i;
+ }
+ return nRes;
+}
+
+
+Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( INT16 nLang, BYTE nType )
+{
+ LangImplNameTable *pTable = 0;
+ switch (nType)
+ {
+ case TYPE_SPELL : pTable = &aCfgSpellTable; break;
+ case TYPE_HYPH : pTable = &aCfgHyphTable; break;
+ case TYPE_THES : pTable = &aCfgThesTable; break;
+ case TYPE_GRAMMAR : pTable = &aCfgGrammarTable; break;
+ }
+ Sequence< OUString > aRes;
+ if (pTable->count( nLang ))
+ aRes = (*pTable)[ nLang ]; // add configured services
+ INT32 nIdx = aRes.getLength();
+ DBG_ASSERT( (INT32) nDisplayServices >= nIdx, "size mismatch" );
+ aRes.realloc( nDisplayServices );
+ OUString *pRes = aRes.getArray();
+
+ // add not configured services
+ for (INT32 i = 0; i < (INT32) nDisplayServices; ++i)
+ {
+ const ServiceInfo_Impl &rInfo = aDisplayServiceArr[ i ];
+ OUString aImplName;
+ switch (nType)
+ {
+ case TYPE_SPELL : aImplName = rInfo.sSpellImplName; break;
+ case TYPE_HYPH : aImplName = rInfo.sHyphImplName; break;
+ case TYPE_THES : aImplName = rInfo.sThesImplName; break;
+ case TYPE_GRAMMAR : aImplName = rInfo.sGrammarImplName; break;
+ }
+
+ if (aImplName.getLength() && (lcl_SeqGetIndex( aRes, aImplName) == -1)) // name not yet added
+ {
+ DBG_ASSERT( nIdx < aRes.getLength(), "index out of range" );
+ if (nIdx < aRes.getLength())
+ pRes[ nIdx++ ] = aImplName;
+ }
+ }
+ // don't forget to put aRes back to its actual size just in case you allocated too much
+ // since all of the names may have already been added
+ // otherwise you get duplicate entries in the edit dialog
+ aRes.realloc( nIdx );
+ return aRes;
+}
+
+
+ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( const OUString &rSvcImplName )
+{
+ ServiceInfo_Impl* pInfo = 0;
+ for (ULONG i = 0; i < nDisplayServices && !pInfo; ++i)
+ {
+ ServiceInfo_Impl &rTmp = aDisplayServiceArr[ i ];
+ if (rTmp.sSpellImplName == rSvcImplName ||
+ rTmp.sHyphImplName == rSvcImplName ||
+ rTmp.sThesImplName == rSvcImplName ||
+ rTmp.sGrammarImplName == rSvcImplName)
+ pInfo = &rTmp;
+ }
+ return pInfo;
+}
+
+
+//-----------------------------------------------------------------------------
+
+void lcl_MergeLocales(Sequence< Locale >& aAllLocales, const Sequence< Locale >& rAdd)
+{
+ const Locale* pAdd = rAdd.getConstArray();
+ Sequence<Locale> aLocToAdd(rAdd.getLength());
+ const Locale* pAllLocales = aAllLocales.getConstArray();
+ Locale* pLocToAdd = aLocToAdd.getArray();
+ sal_Int32 nFound = 0;
+ sal_Int32 i;
+ for(i = 0; i < rAdd.getLength(); i++)
+ {
+ sal_Bool bFound = sal_False;
+ for(sal_Int32 j = 0; j < aAllLocales.getLength() && !bFound; j++)
+ {
+ bFound = pAdd[i].Language == pAllLocales[j].Language &&
+ pAdd[i].Country == pAllLocales[j].Country;
+ }
+ if(!bFound)
+ {
+ pLocToAdd[nFound++] = pAdd[i];
+ }
+ }
+ sal_Int32 nLength = aAllLocales.getLength();
+ aAllLocales.realloc( nLength + nFound);
+ Locale* pAllLocales2 = aAllLocales.getArray();
+ for(i = 0; i < nFound; i++)
+ pAllLocales2[nLength++] = pLocToAdd[i];
+}
+/* -----------------------------27.11.00 16:48--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_MergeDisplayArray(
+ SvxLinguData_Impl &rData,
+ const ServiceInfo_Impl &rToAdd )
+{
+ ULONG nCnt = 0;
+
+ ServiceInfoArr &rSvcInfoArr = rData.GetDisplayServiceArray();
+ ULONG nEntries = rData.GetDisplayServiceCount();
+
+ ServiceInfo_Impl* pEntry;
+ for (ULONG i = 0; i < nEntries; ++i)
+ {
+ pEntry = &rSvcInfoArr[i];
+ if (pEntry && pEntry->sDisplayName == rToAdd.sDisplayName)
+ {
+ if(rToAdd.xSpell.is())
+ {
+ DBG_ASSERT( !pEntry->xSpell.is() &&
+ pEntry->sSpellImplName.getLength() == 0,
+ "merge conflict" );
+ pEntry->sSpellImplName = rToAdd.sSpellImplName;
+ pEntry->xSpell = rToAdd.xSpell;
+ }
+ if(rToAdd.xGrammar.is())
+ {
+ DBG_ASSERT( !pEntry->xGrammar.is() &&
+ pEntry->sGrammarImplName.getLength() == 0,
+ "merge conflict" );
+ pEntry->sGrammarImplName = rToAdd.sGrammarImplName;
+ pEntry->xGrammar = rToAdd.xGrammar;
+ }
+ if(rToAdd.xHyph.is())
+ {
+ DBG_ASSERT( !pEntry->xHyph.is() &&
+ pEntry->sHyphImplName.getLength() == 0,
+ "merge conflict" );
+ pEntry->sHyphImplName = rToAdd.sHyphImplName;
+ pEntry->xHyph = rToAdd.xHyph;
+ }
+ if(rToAdd.xThes.is())
+ {
+ DBG_ASSERT( !pEntry->xThes.is() &&
+ pEntry->sThesImplName.getLength() == 0,
+ "merge conflict" );
+ pEntry->sThesImplName = rToAdd.sThesImplName;
+ pEntry->xThes = rToAdd.xThes;
+ }
+ return ;
+ }
+ ++nCnt;
+ }
+ rData.GetDisplayServiceArray().push_back( rToAdd );
+ rData.SetDisplayServiceCount( nCnt + 1 );
+}
+/* -----------------------------26.11.00 18:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxLinguData_Impl::SvxLinguData_Impl() :
+ nDisplayServices (0)
+{
+ xMSF = ::comphelper::getProcessServiceFactory();
+ uno::Reference < XInterface > xI = xMSF->createInstance(
+ C2U( "com.sun.star.linguistic2.LinguServiceManager" ) );
+ xLinguSrvcMgr = uno::Reference<XLinguServiceManager>(xI, UNO_QUERY);
+ DBG_ASSERT(xLinguSrvcMgr.is(), "No linguistic service available!");
+ if(xLinguSrvcMgr.is())
+ {
+ Locale aCurrentLocale;
+ LanguageType eLang = Application::GetSettings().GetLanguage();
+ SvxLanguageToLocale(aCurrentLocale, eLang);
+ Sequence<Any> aArgs(2);//second arguments has to be empty!
+ aArgs.getArray()[0] <<= SvxGetLinguPropertySet();
+
+ //read spell checker
+ Sequence< OUString > aSpellNames = xLinguSrvcMgr->getAvailableServices(
+ C2U(cSpell), Locale() );
+ const OUString* pSpellNames = aSpellNames.getConstArray();
+
+ sal_Int32 nIdx;
+ for(nIdx = 0; nIdx < aSpellNames.getLength(); nIdx++)
+ {
+ ServiceInfo_Impl aInfo;
+ aInfo.sSpellImplName = pSpellNames[nIdx];
+ aInfo.xSpell = uno::Reference<XSpellChecker>(
+ xMSF->createInstanceWithArguments(aInfo.sSpellImplName, aArgs), UNO_QUERY);
+
+ uno::Reference<XServiceDisplayName> xDispName(aInfo.xSpell, UNO_QUERY);
+ if(xDispName.is())
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+
+ const Sequence< Locale > aLocales( aInfo.xSpell->getLocales() );
+ //! suppress display of entries with no supported languages (see feature 110994)
+ if (aLocales.getLength())
+ {
+ lcl_MergeLocales( aAllServiceLocales, aLocales );
+ lcl_MergeDisplayArray( *this, aInfo );
+ }
+ }
+
+ //read grammar checker
+ Sequence< OUString > aGrammarNames = xLinguSrvcMgr->getAvailableServices(
+ C2U(cGrammar), Locale() );
+ const OUString* pGrammarNames = aGrammarNames.getConstArray();
+ for(nIdx = 0; nIdx < aGrammarNames.getLength(); nIdx++)
+ {
+ ServiceInfo_Impl aInfo;
+ aInfo.sGrammarImplName = pGrammarNames[nIdx];
+ aInfo.xGrammar = uno::Reference<XProofreader>(
+ xMSF->createInstanceWithArguments(aInfo.sGrammarImplName, aArgs), UNO_QUERY);
+
+ uno::Reference<XServiceDisplayName> xDispName(aInfo.xGrammar, UNO_QUERY);
+ if(xDispName.is())
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+
+ const Sequence< Locale > aLocales( aInfo.xGrammar->getLocales() );
+ //! suppress display of entries with no supported languages (see feature 110994)
+ if (aLocales.getLength())
+ {
+ lcl_MergeLocales( aAllServiceLocales, aLocales );
+ lcl_MergeDisplayArray( *this, aInfo );
+ }
+ }
+
+ //read hyphenator
+ Sequence< OUString > aHyphNames = xLinguSrvcMgr->getAvailableServices(
+ C2U(cHyph), Locale() );
+ const OUString* pHyphNames = aHyphNames.getConstArray();
+ for(nIdx = 0; nIdx < aHyphNames.getLength(); nIdx++)
+ {
+ ServiceInfo_Impl aInfo;
+ aInfo.sHyphImplName = pHyphNames[nIdx];
+ aInfo.xHyph = uno::Reference<XHyphenator>(
+ xMSF->createInstanceWithArguments(aInfo.sHyphImplName, aArgs), UNO_QUERY);
+
+ uno::Reference<XServiceDisplayName> xDispName(aInfo.xHyph, UNO_QUERY);
+ if(xDispName.is())
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+
+ const Sequence< Locale > aLocales( aInfo.xHyph->getLocales() );
+ //! suppress display of entries with no supported languages (see feature 110994)
+ if (aLocales.getLength())
+ {
+ lcl_MergeLocales( aAllServiceLocales, aLocales );
+ lcl_MergeDisplayArray( *this, aInfo );
+ }
+ }
+
+ //read thesauri
+ Sequence< OUString > aThesNames = xLinguSrvcMgr->getAvailableServices(
+ C2U(cThes), Locale() );
+ const OUString* pThesNames = aThesNames.getConstArray();
+ for(nIdx = 0; nIdx < aThesNames.getLength(); nIdx++)
+ {
+ ServiceInfo_Impl aInfo;
+ aInfo.sThesImplName = pThesNames[nIdx];
+ aInfo.xThes = uno::Reference<XThesaurus>(
+ xMSF->createInstanceWithArguments(aInfo.sThesImplName, aArgs), UNO_QUERY);
+
+ uno::Reference<XServiceDisplayName> xDispName(aInfo.xThes, UNO_QUERY);
+ if(xDispName.is())
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+
+ const Sequence< Locale > aLocales( aInfo.xThes->getLocales() );
+ //! suppress display of entries with no supported languages (see feature 110994)
+ if (aLocales.getLength())
+ {
+ lcl_MergeLocales( aAllServiceLocales, aLocales );
+ lcl_MergeDisplayArray( *this, aInfo );
+ }
+ }
+
+ Sequence< OUString > aCfgSvcs;
+ const Locale* pAllLocales = aAllServiceLocales.getConstArray();
+ for(sal_Int32 nLocale = 0; nLocale < aAllServiceLocales.getLength(); nLocale++)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pAllLocales[nLocale] );
+
+ aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cSpell), pAllLocales[nLocale]);
+ SetChecked( aCfgSvcs );
+ if (aCfgSvcs.getLength())
+ aCfgSpellTable[ nLang ] = aCfgSvcs;
+
+ aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cGrammar), pAllLocales[nLocale]);
+ SetChecked( aCfgSvcs );
+ if (aCfgSvcs.getLength())
+ aCfgGrammarTable[ nLang ] = aCfgSvcs;
+
+ aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cHyph), pAllLocales[nLocale]);
+ SetChecked( aCfgSvcs );
+ if (aCfgSvcs.getLength())
+ aCfgHyphTable[ nLang ] = aCfgSvcs;
+
+ aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cThes), pAllLocales[nLocale]);
+ SetChecked( aCfgSvcs );
+ if (aCfgSvcs.getLength())
+ aCfgThesTable[ nLang ] = aCfgSvcs;
+ }
+ }
+}
+/* -----------------------------22.05.01 10:43--------------------------------
+
+---------------------------------------------------------------------------*/
+SvxLinguData_Impl::SvxLinguData_Impl( const SvxLinguData_Impl &rData ) :
+ aDisplayServiceArr (rData.aDisplayServiceArr),
+ nDisplayServices (rData.nDisplayServices),
+ aAllServiceLocales (rData.aAllServiceLocales),
+ aCfgSpellTable (rData.aCfgSpellTable),
+ aCfgHyphTable (rData.aCfgHyphTable),
+ aCfgThesTable (rData.aCfgThesTable),
+ aCfgGrammarTable (rData.aCfgGrammarTable),
+ xMSF (rData.xMSF),
+ xLinguSrvcMgr (rData.xLinguSrvcMgr)
+{
+}
+/* -----------------------------22.05.01 10:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxLinguData_Impl & SvxLinguData_Impl::operator = (const SvxLinguData_Impl &rData)
+{
+ xMSF = rData.xMSF;
+ xLinguSrvcMgr = rData.xLinguSrvcMgr;
+ aAllServiceLocales = rData.aAllServiceLocales;
+ aCfgSpellTable = rData.aCfgSpellTable;
+ aCfgHyphTable = rData.aCfgHyphTable;
+ aCfgThesTable = rData.aCfgThesTable;
+ aCfgGrammarTable = rData.aCfgGrammarTable;
+ aDisplayServiceArr = rData.aDisplayServiceArr;
+ nDisplayServices = rData.nDisplayServices;
+ return *this;
+}
+/* -----------------------------26.11.00 18:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxLinguData_Impl::~SvxLinguData_Impl()
+{
+}
+/* -----------------------------26.11.00 19:42--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxLinguData_Impl::SetChecked(const Sequence<OUString>& rConfiguredServices)
+{
+ const OUString* pConfiguredServices = rConfiguredServices.getConstArray();
+ for(sal_Int32 n = 0; n < rConfiguredServices.getLength(); n++)
+ {
+ ServiceInfo_Impl* pEntry;
+ for (ULONG i = 0; i < nDisplayServices; ++i)
+ {
+ pEntry = &aDisplayServiceArr[i];
+ if (pEntry && !pEntry->bConfigured)
+ {
+ const OUString &rSrvcImplName = pConfiguredServices[n];
+ if (rSrvcImplName.getLength() &&
+ (pEntry->sSpellImplName == rSrvcImplName ||
+ pEntry->sGrammarImplName == rSrvcImplName ||
+ pEntry->sHyphImplName == rSrvcImplName ||
+ pEntry->sThesImplName == rSrvcImplName))
+ {
+ pEntry->bConfigured = sal_True;
+ break;
+ }
+ }
+ }
+ }
+}
+/* -----------------------------26.11.00 20:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+sal_Bool SvxLinguData_Impl::AddRemove(
+ Sequence< OUString > &rConfigured,
+ const OUString &rImplName, BOOL bAdd )
+{
+ sal_Bool bRet = sal_False; // modified?
+
+ INT32 nEntries = rConfigured.getLength();
+ INT32 nPos = lcl_SeqGetEntryPos(rConfigured, rImplName);
+ if (bAdd && nPos < 0) // add new entry
+ {
+ rConfigured.realloc( ++nEntries );
+ OUString *pConfigured = rConfigured.getArray();
+ pConfigured = rConfigured.getArray();
+ pConfigured[nEntries - 1] = rImplName;
+ bRet = sal_True;
+ }
+ else if (!bAdd && nPos >= 0) // remove existing entry
+ {
+ OUString *pConfigured = rConfigured.getArray();
+ for (INT32 i = nPos; i < nEntries - 1; ++i)
+ pConfigured[i] = pConfigured[i + 1];
+ rConfigured.realloc(--nEntries);
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+
+void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, BOOL bEnable )
+{
+ DBG_ASSERT( rDisplayName.getLength(), "empty DisplayName" );
+
+ ServiceInfo_Impl *pInfo = 0;
+ ServiceInfo_Impl *pTmp = 0;
+ for (ULONG i = 0; i < nDisplayServices; ++i)
+ {
+ pTmp = &aDisplayServiceArr[i];
+ if (pTmp && pTmp->sDisplayName == rDisplayName)
+ {
+ pInfo = pTmp;
+ break;
+ }
+ }
+ DBG_ASSERT( pInfo, "DisplayName entry not found" );
+ if (pInfo)
+ {
+ pInfo->bConfigured = bEnable;
+
+ Sequence< Locale > aLocales;
+ const Locale *pLocale = 0;
+ INT32 nLocales = 0;
+ INT32 i;
+
+ // update configured spellchecker entries
+ if (pInfo->xSpell.is())
+ {
+ aLocales = pInfo->xSpell->getLocales();
+ pLocale = aLocales.getConstArray();
+ nLocales = aLocales.getLength();
+ for (i = 0; i < nLocales; ++i)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ if (!aCfgSpellTable.count( nLang ) && bEnable)
+ aCfgSpellTable[ nLang ] = Sequence< OUString >();
+ if (aCfgSpellTable.count( nLang ))
+ AddRemove( aCfgSpellTable[ nLang ], pInfo->sSpellImplName, bEnable );
+ }
+ }
+
+ // update configured grammar checker entries
+ if (pInfo->xGrammar.is())
+ {
+ aLocales = pInfo->xGrammar->getLocales();
+ pLocale = aLocales.getConstArray();
+ nLocales = aLocales.getLength();
+ for (i = 0; i < nLocales; ++i)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ if (!aCfgGrammarTable.count( nLang ) && bEnable)
+ aCfgGrammarTable[ nLang ] = Sequence< OUString >();
+ if (aCfgGrammarTable.count( nLang ))
+ AddRemove( aCfgGrammarTable[ nLang ], pInfo->sGrammarImplName, bEnable );
+ }
+ }
+
+ // update configured hyphenator entries
+ if (pInfo->xHyph.is())
+ {
+ aLocales = pInfo->xHyph->getLocales();
+ pLocale = aLocales.getConstArray();
+ nLocales = aLocales.getLength();
+ for (i = 0; i < nLocales; ++i)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ if (!aCfgHyphTable.count( nLang ) && bEnable)
+ aCfgHyphTable[ nLang ] = Sequence< OUString >();
+ if (aCfgHyphTable.count( nLang ))
+ AddRemove( aCfgHyphTable[ nLang ], pInfo->sHyphImplName, bEnable );
+ }
+ }
+
+ // update configured spellchecker entries
+ if (pInfo->xThes.is())
+ {
+ aLocales = pInfo->xThes->getLocales();
+ pLocale = aLocales.getConstArray();
+ nLocales = aLocales.getLength();
+ for (i = 0; i < nLocales; ++i)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ if (!aCfgThesTable.count( nLang ) && bEnable)
+ aCfgThesTable[ nLang ] = Sequence< OUString >();
+ if (aCfgThesTable.count( nLang ))
+ AddRemove( aCfgThesTable[ nLang ], pInfo->sThesImplName, bEnable );
+ }
+ }
+ }
+}
+
+
+// class SvxLinguTabPage -------------------------------------------------
+
+#define CBCOL_FIRST 0
+#define CBCOL_SECOND 1
+#define CBCOL_BOTH 2
+
+SvxLinguTabPage::SvxLinguTabPage( Window* pParent,
+ const SfxItemSet& rSet ):
+
+ SfxTabPage( pParent, SVX_RES( RID_SFXPAGE_LINGU ), rSet ),
+
+ aLinguisticFL ( this, SVX_RES( FL_LINGUISTIC ) ),
+ aLinguModulesFT ( this, SVX_RES( FT_LINGU_MODULES ) ),
+ aLinguModulesCLB ( this, SVX_RES( CLB_LINGU_MODULES ) ),
+ aLinguModulesEditPB ( this, SVX_RES( PB_LINGU_MODULES_EDIT ) ),
+ aLinguDicsFT ( this, SVX_RES( FT_LINGU_DICS ) ),
+ aLinguDicsCLB ( this, SVX_RES( CLB_LINGU_DICS ) ),
+ aLinguDicsNewPB ( this, SVX_RES( PB_LINGU_DICS_NEW_DIC ) ),
+ aLinguDicsEditPB ( this, SVX_RES( PB_LINGU_DICS_EDIT_DIC ) ),
+ aLinguDicsDelPB ( this, SVX_RES( PB_LINGU_DICS_DEL_DIC ) ),
+ aLinguOptionsFT ( this, SVX_RES( FT_LINGU_OPTIONS ) ),
+ aLinguOptionsCLB ( this, SVX_RES( CLB_LINGU_OPTIONS ) ),
+ aLinguOptionsEditPB ( this, SVX_RES( PB_LINGU_OPTIONS_EDIT ) ),
+ aMoreDictsLink ( this, SVX_RES( FT_LINGU_OPTIONS_MOREDICTS ) ),
+ sCapitalWords ( SVX_RES( STR_CAPITAL_WORDS ) ),
+ sWordsWithDigits ( SVX_RES( STR_WORDS_WITH_DIGITS ) ),
+ sCapitalization ( SVX_RES( STR_CAPITALIZATION ) ),
+ sSpellSpecial ( SVX_RES( STR_SPELL_SPECIAL ) ),
+ sSpellAuto ( SVX_RES( STR_SPELL_AUTO ) ),
+ sGrammarAuto ( SVX_RES( STR_GRAMMAR_AUTO ) ),
+ sNumMinWordlen ( SVX_RES( STR_NUM_MIN_WORDLEN ) ),
+ sNumPreBreak ( SVX_RES( STR_NUM_PRE_BREAK ) ),
+ sNumPostBreak ( SVX_RES( STR_NUM_POST_BREAK ) ),
+ sHyphAuto ( SVX_RES( STR_HYPH_AUTO ) ),
+ sHyphSpecial ( SVX_RES( STR_HYPH_SPECIAL ) ),
+
+ pLinguData ( NULL )
+{
+ pCheckButtonData = NULL;
+
+ aLinguModulesCLB.SetWindowBits( WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
+ aLinguModulesCLB.SetHelpId(HID_CLB_LINGU_MODULES );
+ aLinguModulesCLB.SetHighlightRange();
+ aLinguModulesCLB.SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
+ aLinguModulesCLB.SetDoubleClickHdl(LINK(this, SvxLinguTabPage, BoxDoubleClickHdl_Impl));
+ aLinguModulesCLB.SetCheckButtonHdl(LINK(this, SvxLinguTabPage, BoxCheckButtonHdl_Impl));
+
+ aLinguModulesEditPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
+ aLinguOptionsEditPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
+
+ aLinguDicsCLB.SetWindowBits( WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
+ aLinguDicsCLB.SetHelpId(HID_CLB_EDIT_MODULES_DICS );
+ aLinguDicsCLB.SetHighlightRange();
+ aLinguDicsCLB.SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
+ aLinguDicsCLB.SetCheckButtonHdl(LINK(this, SvxLinguTabPage, BoxCheckButtonHdl_Impl));
+
+ aLinguDicsNewPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
+ aLinguDicsEditPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
+ aLinguDicsDelPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
+
+ aLinguOptionsCLB.SetWindowBits( WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
+ aLinguOptionsCLB.SetHelpId(HID_CLB_LINGU_OPTIONS );
+ aLinguOptionsCLB.SetHighlightRange();
+ aLinguOptionsCLB.SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
+ aLinguOptionsCLB.SetDoubleClickHdl(LINK(this, SvxLinguTabPage, BoxDoubleClickHdl_Impl));
+
+ if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
+ != SvtExtendedSecurityOptions::OPEN_NEVER )
+ {
+ aMoreDictsLink.SetURL( String(
+ RTL_CONSTASCII_STRINGPARAM( "http://extensions.services.openoffice.org/dictionary?cid=926386" ) ) );
+ aMoreDictsLink.SetClickHdl( LINK( this, SvxLinguTabPage, OpenURLHdl_Impl ) );
+ }
+ else
+ aMoreDictsLink.Hide();
+
+
+ // force recalculation of hash value used for checking the need of updating
+ // because new dictionaries might be installed / downloaded.
+ //! Thus it needs to be called now since it may infuence the supported languages
+ //! to be reported AND the found user-dictionaries(!) as well.
+ SvxLinguConfigUpdate::UpdateAll( sal_True );
+
+ xProp = uno::Reference< XPropertySet >( SvxGetLinguPropertySet(), UNO_QUERY );
+ xDicList = uno::Reference< XDictionaryList >( SvxGetDictionaryList(), UNO_QUERY );
+ if (xDicList.is())
+ {
+ // keep references to all **currently** available dictionaries,
+ // since the diclist may get changed meanwhile (e.g. through the API).
+ // We want the dialog to operate on the same set of dictionaries it
+ // was started with.
+ // Also we have to take care to not loose the last reference when
+ // someone else removes a dictionary from the list.
+ // removed dics will be replaced by NULL new entries be added to the end
+ // Thus we may use indizes as consistent references.
+ aDics = xDicList->getDictionaries();
+
+ UpdateDicBox_Impl();
+ }
+ else
+ {
+ aLinguDicsFT.Disable();
+ aLinguDicsCLB.Disable();
+ aLinguDicsNewPB.Disable();
+ aLinguDicsEditPB.Disable();
+ aLinguDicsDelPB.Disable();
+ }
+
+ const SfxSpellCheckItem* pItem = 0;
+ SfxItemState eItemState = SFX_ITEM_UNKNOWN;
+
+ eItemState = rSet.GetItemState( GetWhich( SID_ATTR_SPELL ),
+ sal_False, (const SfxPoolItem**)&pItem );
+
+ // handelt es sich um ein Default-Item?
+ if ( eItemState == SFX_ITEM_DEFAULT )
+ pItem = (const SfxSpellCheckItem*)&(rSet.Get( GetWhich( SID_ATTR_SPELL ) ) );
+ else if ( eItemState == SFX_ITEM_DONTCARE )
+ pItem = NULL;
+
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SvxLinguTabPage::~SvxLinguTabPage()
+{
+ if (pLinguData)
+ delete pLinguData;
+}
+
+//------------------------------------------------------------------------
+
+//nicht �berladen wegschmeissen
+sal_uInt16* SvxLinguTabPage::GetRanges()
+{
+ //TL???
+ return pRanges;
+}
+
+//------------------------------------------------------------------------
+
+SfxTabPage* SvxLinguTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SvxLinguTabPage( pParent, rAttrSet ) );
+}
+
+//------------------------------------------------------------------------
+
+Any lcl_Bool2Any(BOOL bVal)
+{
+ Any aRet(&bVal, ::getBooleanCppuType());
+ return aRet;
+}
+
+
+sal_Bool lcl_Bool2Any(Any& rVal)
+{
+ return *(sal_Bool*)rVal.getValue();
+}
+
+
+sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
+{
+ sal_Bool bModified = sal_True; // !!!!
+
+ // if not HideGroups was called with GROUP_MODULES...
+ if (aLinguModulesCLB.IsVisible())
+ {
+ DBG_ASSERT( pLinguData, "pLinguData not yet initialized" );
+ if (!pLinguData)
+ pLinguData = new SvxLinguData_Impl;
+
+ LangImplNameTable::const_iterator aIt;
+
+ // update spellchecker configuration entries
+ const LangImplNameTable *pTable = &pLinguData->GetSpellTable();
+ for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
+ {
+ INT16 nLang = aIt->first;
+ const Sequence< OUString > aImplNames( aIt->second );
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTmpStr;
+ pTmpStr = aImplNames.getConstArray();
+#endif
+ uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() );
+ Locale aLocale( SvxCreateLocale(nLang) );
+ if (xMgr.is())
+ xMgr->setConfiguredServices( C2U(cSpell), aLocale, aImplNames );
+ }
+
+ // update grammar checker configuration entries
+ pTable = &pLinguData->GetGrammarTable();
+ for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
+ {
+ INT16 nLang = aIt->first;
+ const Sequence< OUString > aImplNames( aIt->second );
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTmpStr;
+ pTmpStr = aImplNames.getConstArray();
+#endif
+ uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() );
+ Locale aLocale( SvxCreateLocale(nLang) );
+ if (xMgr.is())
+ xMgr->setConfiguredServices( C2U(cGrammar), aLocale, aImplNames );
+ }
+
+ // update hyphenator configuration entries
+ pTable = &pLinguData->GetHyphTable();
+ for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
+ {
+ INT16 nLang = aIt->first;
+ const Sequence< OUString > aImplNames( aIt->second );
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTmpStr;
+ pTmpStr = aImplNames.getConstArray();
+#endif
+ uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() );
+ Locale aLocale( SvxCreateLocale(nLang) );
+ if (xMgr.is())
+ xMgr->setConfiguredServices( C2U(cHyph), aLocale, aImplNames );
+ }
+
+ // update thesaurus configuration entries
+ pTable = &pLinguData->GetThesTable();
+ for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
+ {
+ INT16 nLang = aIt->first;
+ const Sequence< OUString > aImplNames( aIt->second );
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTmpStr;
+ pTmpStr = aImplNames.getConstArray();
+#endif
+ uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() );
+ Locale aLocale( SvxCreateLocale(nLang) );
+ if (xMgr.is())
+ xMgr->setConfiguredServices( C2U(cThes), aLocale, aImplNames );
+ }
+ }
+
+
+ //
+ // activate dictionaries according to checkbox state
+ //
+ Sequence< OUString > aActiveDics;
+ INT32 nActiveDics = 0;
+ ULONG nEntries = aLinguDicsCLB.GetEntryCount();
+ for (ULONG i = 0; i < nEntries; ++i)
+ {
+ INT32 nDics = aDics.getLength();
+// const uno::Reference< XDictionary > *pDic = aDics.getConstArray();
+
+ aActiveDics.realloc( nDics );
+ OUString *pActiveDic = aActiveDics.getArray();
+
+ SvLBoxEntry *pEntry = aLinguDicsCLB.GetEntry( i );
+ if (pEntry)
+ {
+ DicUserData aData( (ULONG)pEntry->GetUserData() );
+ if (aData.GetEntryId() < nDics)
+ {
+ BOOL bChecked = aLinguDicsCLB.IsChecked( (USHORT) i );
+ uno::Reference< XDictionary > xDic( aDics.getConstArray()[ i ] );
+ if (xDic.is())
+ {
+ if (SvxGetIgnoreAllList() == xDic)
+ bChecked = TRUE;
+ xDic->setActive( bChecked );
+
+ if (bChecked)
+ {
+ String aDicName( xDic->getName() );
+ pActiveDic[ nActiveDics++ ] = aDicName;
+ }
+ }
+ }
+ }
+ }
+ //
+ aActiveDics.realloc( nActiveDics );
+ Any aTmp;
+ aTmp <<= aActiveDics;
+ SvtLinguConfig aLngCfg;
+ aLngCfg.SetProperty( UPH_ACTIVE_DICTIONARIES, aTmp );
+
+
+ nEntries = aLinguOptionsCLB.GetEntryCount();
+ for (USHORT j = 0; j < nEntries; ++j)
+ {
+ SvLBoxEntry *pEntry = aLinguOptionsCLB.GetEntry( j );
+
+ OptionsUserData aData( (ULONG)pEntry->GetUserData() );
+ String aPropName( lcl_GetPropertyName( (EID_OPTIONS) aData.GetEntryId() ) );
+
+ Any aAny;
+ if (aData.IsCheckable())
+ {
+ BOOL bChecked = aLinguOptionsCLB.IsChecked( j );
+ aAny <<= bChecked;
+ }
+ else if (aData.HasNumericValue())
+ {
+ INT16 nVal = aData.GetNumericValue();
+ aAny <<= nVal;
+ }
+
+ if (xProp.is())
+ xProp->setPropertyValue( aPropName, aAny );
+ aLngCfg.SetProperty( aPropName, aAny );
+ }
+
+ SvLBoxEntry *pPreBreakEntry = aLinguOptionsCLB.GetEntry( (USHORT) EID_NUM_PRE_BREAK );
+ SvLBoxEntry *pPostBreakEntry = aLinguOptionsCLB.GetEntry( (USHORT) EID_NUM_POST_BREAK );
+ DBG_ASSERT( pPreBreakEntry, "NULL Pointer" );
+ DBG_ASSERT( pPostBreakEntry, "NULL Pointer" );
+ if (pPreBreakEntry && pPostBreakEntry)
+ {
+ OptionsUserData aPreBreakData( (ULONG)pPreBreakEntry->GetUserData() );
+ OptionsUserData aPostBreakData( (ULONG)pPostBreakEntry->GetUserData() );
+ if ( aPreBreakData.IsModified() || aPostBreakData.IsModified() )
+ {
+ SfxHyphenRegionItem aHyp( GetWhich( SID_ATTR_HYPHENREGION ) );
+ aHyp.GetMinLead() = (UINT8) aPreBreakData.GetNumericValue();
+ aHyp.GetMinTrail() = (UINT8) aPostBreakData.GetNumericValue();
+ rCoreSet.Put( aHyp );
+ }
+ }
+
+
+ // automatic spell checking
+ BOOL bNewAutoCheck = aLinguOptionsCLB.IsChecked( (USHORT) EID_SPELL_AUTO );
+ const SfxPoolItem* pOld = GetOldItem( rCoreSet, SID_AUTOSPELL_CHECK );
+ if ( !pOld || ( (SfxBoolItem*)pOld )->GetValue() != bNewAutoCheck )
+ {
+ rCoreSet.Put( SfxBoolItem( GetWhich( SID_AUTOSPELL_CHECK ),
+ bNewAutoCheck ) );
+ bModified |= sal_True;
+ }
+
+ return bModified;
+}
+
+// ----------------------------------------------------------------------
+
+ULONG SvxLinguTabPage::GetDicUserData( const uno::Reference< XDictionary > &rxDic, USHORT nIdx )
+{
+ ULONG nRes = 0;
+ DBG_ASSERT( rxDic.is(), "dictionary not supplied" );
+ if (rxDic.is())
+ {
+ uno::Reference< frame::XStorable > xStor( rxDic, UNO_QUERY );
+
+// ULONG nUserData = 0;
+ BOOL bChecked = rxDic->isActive();
+ BOOL bEditable = !xStor.is() || !xStor->isReadonly();
+ BOOL bDeletable = bEditable;
+// BOOL bNegativ = rxDic->getDictionaryType() == DictionaryType_NEGATIVE;
+
+ nRes = DicUserData( nIdx,
+ bChecked, bEditable, bDeletable ).GetUserData();
+ }
+ return nRes;
+}
+
+
+void SvxLinguTabPage::AddDicBoxEntry(
+ const uno::Reference< XDictionary > &rxDic,
+ USHORT nIdx )
+{
+ aLinguDicsCLB.SetUpdateMode(FALSE);
+
+ String aTxt( ::GetDicInfoStr( rxDic->getName(),
+ SvxLocaleToLanguage( rxDic->getLocale() ),
+ DictionaryType_NEGATIVE == rxDic->getDictionaryType() ) );
+ aLinguDicsCLB.InsertEntry( aTxt, (USHORT)LISTBOX_APPEND ); // append at end
+ SvLBoxEntry* pEntry = aLinguDicsCLB.GetEntry( aLinguDicsCLB.GetEntryCount() - 1 );
+ DBG_ASSERT( pEntry, "failed to add entry" );
+ if (pEntry)
+ {
+ DicUserData aData( GetDicUserData( rxDic, nIdx ) );
+ pEntry->SetUserData( (void *) aData.GetUserData() );
+ lcl_SetCheckButton( pEntry, aData.IsChecked() );
+ }
+
+ aLinguDicsCLB.SetUpdateMode(TRUE);
+}
+
+// ----------------------------------------------------------------------
+
+void SvxLinguTabPage::UpdateDicBox_Impl()
+{
+ aLinguDicsCLB.SetUpdateMode(FALSE);
+ aLinguDicsCLB.Clear();
+
+ INT32 nDics = aDics.getLength();
+ const uno::Reference< XDictionary > *pDic = aDics.getConstArray();
+ for (INT32 i = 0; i < nDics; ++i)
+ {
+ const uno::Reference< XDictionary > &rDic = pDic[i];
+ if (rDic.is())
+ AddDicBoxEntry( rDic, (USHORT)i );
+ }
+
+ aLinguDicsCLB.SetUpdateMode(TRUE);
+}
+
+// ----------------------------------------------------------------------
+
+void SvxLinguTabPage::UpdateModulesBox_Impl()
+{
+ if (pLinguData)
+ {
+ const ServiceInfoArr &rAllDispSrvcArr = pLinguData->GetDisplayServiceArray();
+ const ULONG nDispSrvcCount = pLinguData->GetDisplayServiceCount();
+
+ aLinguModulesCLB.Clear();
+
+ for (USHORT i = 0; i < nDispSrvcCount; ++i)
+ {
+ const ServiceInfo_Impl &rInfo = rAllDispSrvcArr[i];
+ aLinguModulesCLB.InsertEntry( rInfo.sDisplayName, (USHORT)LISTBOX_APPEND );
+ SvLBoxEntry* pEntry = aLinguModulesCLB.GetEntry(i);
+ pEntry->SetUserData( (void *) &rInfo );
+ aLinguModulesCLB.CheckEntryPos( i, rInfo.bConfigured );
+ }
+ aLinguModulesEditPB.Enable( nDispSrvcCount > 0 );
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxLinguTabPage::Reset( const SfxItemSet& rSet )
+{
+ // if not HideGroups was called with GROUP_MODULES...
+ if (aLinguModulesCLB.IsVisible())
+ {
+ if (!pLinguData)
+ pLinguData = new SvxLinguData_Impl;
+ UpdateModulesBox_Impl();
+ }
+
+
+ //
+ // get data from configuration
+ //
+
+ SvtLinguConfig aLngCfg;
+
+ aLinguOptionsCLB.SetUpdateMode(FALSE);
+ aLinguOptionsCLB.Clear();
+
+ SvLBoxTreeList *pModel = aLinguOptionsCLB.GetModel();
+ SvLBoxEntry* pEntry = NULL;
+
+ INT16 nVal = 0;
+ BOOL bVal = FALSE;
+ ULONG nUserData = 0;
+
+ pEntry = CreateEntry( sSpellAuto, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_SPELL_AUTO) ) >>= bVal;
+ const SfxPoolItem* pItem = GetItem( rSet, SID_AUTOSPELL_CHECK );
+ if (pItem)
+ bVal = ((SfxBoolItem *) pItem)->GetValue();
+ nUserData = OptionsUserData( EID_SPELL_AUTO, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sGrammarAuto, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_GRAMMAR_AUTO) ) >>= bVal;
+// const SfxPoolItem* pItem = GetItem( rSet, SID_AUTOSPELL_CHECK );
+// if (pItem)
+// bVal = ((SfxBoolItem *) pItem)->GetValue();
+ nUserData = OptionsUserData( EID_GRAMMAR_AUTO, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sCapitalWords, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_SPELL_UPPER_CASE) ) >>= bVal;
+ nUserData = OptionsUserData( EID_CAPITAL_WORDS, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sWordsWithDigits, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_SPELL_WITH_DIGITS) ) >>= bVal;
+ nUserData = OptionsUserData( EID_WORDS_WITH_DIGITS, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sCapitalization, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_SPELL_CAPITALIZATION) ) >>= bVal;
+ nUserData = OptionsUserData( EID_CAPITALIZATION, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sSpellSpecial, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_SPELL_SPECIAL) ) >>= bVal;
+ nUserData = OptionsUserData( EID_SPELL_SPECIAL, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sNumMinWordlen, CBCOL_SECOND );
+ aLngCfg.GetProperty( C2U(UPN_HYPH_MIN_WORD_LENGTH) ) >>= nVal;
+ nUserData = OptionsUserData( EID_NUM_MIN_WORDLEN, TRUE, (USHORT)nVal, FALSE, FALSE).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+
+ const SfxHyphenRegionItem *pHyp = NULL;
+ USHORT nWhich = GetWhich( SID_ATTR_HYPHENREGION );
+ if ( rSet.GetItemState( nWhich, FALSE ) == SFX_ITEM_SET )
+ pHyp = &( (const SfxHyphenRegionItem &) rSet.Get( nWhich ) );
+
+ pEntry = CreateEntry( sNumPreBreak, CBCOL_SECOND );
+ aLngCfg.GetProperty( C2U(UPN_HYPH_MIN_LEADING) ) >>= nVal;
+ if (pHyp)
+ nVal = (INT16) pHyp->GetMinLead();
+ nUserData = OptionsUserData( EID_NUM_PRE_BREAK, TRUE, (USHORT)nVal, FALSE, FALSE).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+
+ pEntry = CreateEntry( sNumPostBreak, CBCOL_SECOND );
+ aLngCfg.GetProperty( C2U(UPN_HYPH_MIN_TRAILING) ) >>= nVal;
+ if (pHyp)
+ nVal = (INT16) pHyp->GetMinTrail();
+ nUserData = OptionsUserData( EID_NUM_POST_BREAK, TRUE, (USHORT)nVal, FALSE, FALSE).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+
+ pEntry = CreateEntry( sHyphAuto, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_HYPH_AUTO) ) >>= bVal;
+ nUserData = OptionsUserData( EID_HYPH_AUTO, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sHyphSpecial, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_HYPH_SPECIAL) ) >>= bVal;
+ nUserData = OptionsUserData( EID_HYPH_SPECIAL, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ aLinguOptionsCLB.SetUpdateMode(TRUE);
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLinguTabPage, BoxDoubleClickHdl_Impl, SvTreeListBox *, pBox )
+{
+ if (pBox == &aLinguModulesCLB)
+ {
+ //! in order to avoid a bug causing a GPF when double clicking
+ //! on a module entry and exiting the "Edit Modules" dialog
+ //! after that.
+ Application::PostUserEvent( LINK(
+ this, SvxLinguTabPage, PostDblClickHdl_Impl ) );
+ }
+ else if (pBox == &aLinguOptionsCLB)
+ {
+ ClickHdl_Impl(&aLinguOptionsEditPB);
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLinguTabPage, PostDblClickHdl_Impl, SvTreeListBox *, EMPTYARG )
+{
+ ClickHdl_Impl(&aLinguModulesEditPB);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLinguTabPage, OpenURLHdl_Impl, svt::FixedHyperlink *, EMPTYARG )
+{
+ ::rtl::OUString sURL( aMoreDictsLink.GetURL() );
+ lcl_OpenURL( sURL );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLinguTabPage, BoxCheckButtonHdl_Impl, SvTreeListBox *, pBox )
+{
+ if (pBox == &aLinguModulesCLB)
+ {
+ DBG_ASSERT( pLinguData, "NULL pointer, LinguData missing" );
+ USHORT nPos = aLinguModulesCLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND && pLinguData)
+ {
+ pLinguData->Reconfigure( aLinguModulesCLB.GetText( nPos ),
+ aLinguModulesCLB.IsChecked( nPos ) );
+ }
+ }
+ else if (pBox == &aLinguDicsCLB)
+ {
+ USHORT nPos = aLinguDicsCLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ const uno::Reference< XDictionary > &rDic = aDics.getConstArray()[ nPos ];
+ if (SvxGetIgnoreAllList() == rDic)
+ {
+ SvLBoxEntry* pEntry = aLinguDicsCLB.GetEntry( nPos );
+ if (pEntry)
+ lcl_SetCheckButton( pEntry, TRUE );
+ }
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
+{
+ if (&aLinguModulesEditPB == pBtn)
+ {
+ if (!pLinguData)
+ pLinguData = new SvxLinguData_Impl;
+
+ SvxLinguData_Impl aOldLinguData( *pLinguData );
+ SvxEditModulesDlg aDlg( this, *pLinguData );
+ if (aDlg.Execute() != RET_OK)
+ *pLinguData = aOldLinguData;
+
+ // evaluate new status of 'bConfigured' flag
+ ULONG nLen = pLinguData->GetDisplayServiceCount();
+ for (ULONG i = 0; i < nLen; ++i)
+ pLinguData->GetDisplayServiceArray()[i].bConfigured = FALSE;
+ const Locale* pAllLocales = pLinguData->GetAllSupportedLocales().getConstArray();
+ INT32 nLocales = pLinguData->GetAllSupportedLocales().getLength();
+ for (INT32 k = 0; k < nLocales; ++k)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pAllLocales[k] );
+ if (pLinguData->GetSpellTable().count( nLang ))
+ pLinguData->SetChecked( pLinguData->GetSpellTable()[ nLang ] );
+ if (pLinguData->GetGrammarTable().count( nLang ))
+ pLinguData->SetChecked( pLinguData->GetGrammarTable()[ nLang ] );
+ if (pLinguData->GetHyphTable().count( nLang ))
+ pLinguData->SetChecked( pLinguData->GetHyphTable()[ nLang ] );
+ if (pLinguData->GetThesTable().count( nLang ))
+ pLinguData->SetChecked( pLinguData->GetThesTable()[ nLang ] );
+ }
+
+ // show new status of modules
+ UpdateModulesBox_Impl();
+ }
+ else if (&aLinguDicsNewPB == pBtn)
+ {
+ uno::Reference< XSpellChecker1 > xSpellChecker1;
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractSvxNewDictionaryDialog* aDlg = pFact->CreateSvxNewDictionaryDialog( this, xSpellChecker1, RID_SFXDLG_NEWDICT );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");
+ uno::Reference< XDictionary > xNewDic;
+ if ( aDlg->Execute() == RET_OK )
+ xNewDic = uno::Reference< XDictionary >( aDlg->GetNewDictionary(), UNO_QUERY );
+ if ( xNewDic.is() )
+ {
+ // add new dics to the end
+ INT32 nLen = aDics.getLength();
+ aDics.realloc( nLen + 1 );
+
+ aDics.getArray()[ nLen ] = xNewDic;
+
+ AddDicBoxEntry( xNewDic, (USHORT) nLen );
+ }
+ delete aDlg; //add by CHINA001
+ }
+ }
+ else if (&aLinguDicsEditPB == pBtn)
+ {
+ SvLBoxEntry *pEntry = aLinguDicsCLB.GetCurEntry();
+ if (pEntry)
+ {
+ DicUserData aData( (ULONG) pEntry->GetUserData() );
+ USHORT nDicPos = aData.GetEntryId();
+ INT32 nDics = aDics.getLength();
+ if (nDicPos < nDics)
+ {
+ uno::Reference< XDictionary > xDic;
+ xDic = aDics.getConstArray()[ nDicPos ];
+ if (xDic.is())
+ {
+ uno::Reference< XSpellChecker1 > xSpellChecker1;
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ VclAbstractDialog* aDlg = pFact->CreateSvxEditDictionaryDialog( this, xDic->getName(), xSpellChecker1, RID_SFXDLG_EDITDICT );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");
+ aDlg->Execute();
+ delete aDlg;
+ }
+ }
+ }
+ }
+ }
+ else if (&aLinguDicsDelPB == pBtn)
+ {
+ if ( RET_NO ==
+ QueryBox( this, SVX_RES( RID_SFXQB_DELDICT ) ).Execute() )
+ return 0;
+
+ SvLBoxEntry *pEntry = aLinguDicsCLB.GetCurEntry();
+ if (pEntry)
+ {
+ DicUserData aData( (ULONG) pEntry->GetUserData() );
+ USHORT nDicPos = aData.GetEntryId();
+ INT32 nDics = aDics.getLength();
+ if (nDicPos < nDics)
+ {
+ uno::Reference< XDictionary > xDic;
+ xDic = aDics.getConstArray()[ nDicPos ];
+ if (xDic.is())
+ {
+ if (SvxGetIgnoreAllList() == xDic)
+ xDic->clear();
+ else
+ {
+ if (xDicList.is())
+ xDicList->removeDictionary( xDic );
+
+ uno::Reference< frame::XStorable > xStor( xDic, UNO_QUERY );
+ if ( xStor->hasLocation() && !xStor->isReadonly() )
+ {
+ String sURL = xStor->getLocation();
+ INetURLObject aObj(sURL);
+ DBG_ASSERT( aObj.GetProtocol() == INET_PROT_FILE,
+ "non-file URLs cannot be deleted" );
+ if ( aObj.GetProtocol() == INET_PROT_FILE )
+ {
+ KillFile_Impl( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ }
+ }
+
+ aDics.getArray()[ nDicPos ] = 0;
+
+ // remove entry from checklistbox
+ ULONG nCnt = aLinguDicsCLB.GetEntryCount();
+ for (ULONG i = 0; i < nCnt; ++i)
+ {
+ SvLBoxEntry *pDicEntry = aLinguDicsCLB.GetEntry( i );
+ DBG_ASSERT( pDicEntry, "missing entry" );
+ if (pDicEntry)
+ {
+ DicUserData aDicData( (ULONG) pDicEntry->GetUserData() );
+ if (aDicData.GetEntryId() == nDicPos )
+ {
+ aLinguDicsCLB.RemoveEntry( (USHORT) i );
+ break;
+ }
+ }
+ }
+ DBG_ASSERT( nCnt > aLinguDicsCLB.GetEntryCount(),
+ "remove failed ?");
+ }
+ }
+ }
+ }
+ }
+ else if (&aLinguOptionsEditPB == pBtn)
+ {
+ SvLBoxEntry *pEntry = aLinguOptionsCLB.GetCurEntry();
+ DBG_ASSERT( pEntry, "no entry selected" );
+ if (pEntry)
+ {
+ long nVal = -1;
+ OptionsUserData aData( (ULONG)pEntry->GetUserData() );
+ if(aData.HasNumericValue())
+ {
+ int nRID = -1;
+ switch (aData.GetEntryId())
+ {
+ case EID_NUM_PRE_BREAK : nRID = STR_NUM_PRE_BREAK_DLG; break;
+ case EID_NUM_POST_BREAK : nRID = STR_NUM_POST_BREAK_DLG; break;
+ case EID_NUM_MIN_WORDLEN: nRID = STR_NUM_MIN_WORDLEN_DLG; break;
+ default:
+ DBG_ERROR( "unexpected case" );
+ }
+
+ OptionsBreakSet aDlg( this, nRID );
+ aDlg.GetNumericFld().SetValue( aData.GetNumericValue() );
+ if (RET_OK == aDlg.Execute() )
+ {
+ nVal = static_cast<long>(aDlg.GetNumericFld().GetValue());
+ if (-1 != nVal && aData.GetNumericValue() != nVal)
+ {
+ aData.SetNumericValue( (BYTE)nVal ); //! sets IsModified !
+ pEntry->SetUserData( (void *) aData.GetUserData() );
+ aLinguOptionsCLB.Invalidate();
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ DBG_ERROR( "pBtn unexpected value" );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLinguTabPage, SelectHdl_Impl, SvxCheckListBox *, pBox )
+{
+ if (&aLinguModulesCLB == pBox)
+ {
+ }
+ else if (&aLinguDicsCLB == pBox)
+ {
+ SvLBoxEntry *pEntry = pBox->GetCurEntry();
+ if (pEntry)
+ {
+ DicUserData aData( (ULONG) pEntry->GetUserData() );
+
+ // always allow to edit (i.e. at least view the content of the dictionary)
+ aLinguDicsEditPB.Enable( true/*aData.IsEditable()*/ );
+ aLinguDicsDelPB .Enable( aData.IsDeletable() );
+ }
+ }
+ else if (&aLinguOptionsCLB == pBox)
+ {
+ SvLBoxEntry *pEntry = pBox->GetCurEntry();
+ if (pEntry)
+ {
+ OptionsUserData aData( (ULONG) pEntry->GetUserData() );
+ aLinguOptionsEditPB.Enable( aData.HasNumericValue() );
+ }
+ }
+ else
+ {
+ DBG_ERROR( "pBox unexpected value" );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvLBoxEntry* SvxLinguTabPage::CreateEntry( String& rTxt, USHORT nCol )
+{
+ SvLBoxEntry* pEntry = new SvLBoxEntry;
+
+ if( !pCheckButtonData )
+ pCheckButtonData = new SvLBoxButtonData( &aLinguOptionsCLB );
+
+ String sEmpty;
+ if (CBCOL_FIRST == nCol)
+ pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+ if (CBCOL_SECOND == nCol)
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff!
+ pEntry->AddItem( new BrwString_Impl( pEntry, 0, rTxt ) );
+
+ return pEntry;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLinguTabPage::HideGroups( sal_uInt16 nGrp )
+{
+ if ( 0 != ( GROUP_MODULES & nGrp ) )
+ {
+ aLinguModulesFT.Hide();
+ aLinguModulesCLB.Hide();
+ aLinguModulesEditPB.Hide();
+
+ // reposition / resize remaining controls
+ long nDeltaY = aLinguDicsFT.GetPosPixel().Y() -
+ aLinguModulesFT.GetPosPixel().Y();
+ DBG_ASSERT( nDeltaY >= 0, "move/resize value is negative" );
+ Point aPos;
+ //
+ aPos = aLinguDicsFT.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguDicsFT.SetPosPixel( aPos );
+ aPos = aLinguDicsCLB.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguDicsCLB.SetPosPixel( aPos );
+ aPos = aLinguDicsNewPB.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguDicsNewPB.SetPosPixel( aPos );
+ aPos = aLinguDicsEditPB.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguDicsEditPB.SetPosPixel( aPos );
+ aPos = aLinguDicsDelPB.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguDicsDelPB.SetPosPixel( aPos );
+ //
+ aPos = aLinguOptionsFT.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguOptionsFT.SetPosPixel( aPos );
+ aPos = aLinguOptionsCLB.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguOptionsCLB.SetPosPixel( aPos );
+ aPos = aLinguOptionsEditPB.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguOptionsEditPB.SetPosPixel( aPos );
+ //
+ Size aSize( aLinguOptionsCLB.GetSizePixel() );
+ aSize.Height() += nDeltaY;
+ aLinguOptionsCLB.SetSizePixel( aSize );
+
+ if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
+ != SvtExtendedSecurityOptions::OPEN_NEVER )
+ {
+ aSize = GetOutputSizePixel();
+ aSize.Height() += ( aMoreDictsLink.GetSizePixel().Height() * 11 / 8 );
+ SetSizePixel( aSize );
+ aMoreDictsLink.Show();
+ }
+ }
+}
+/*--------------------------------------------------
+--------------------------------------------------*/
+
+SvxEditModulesDlg::SvxEditModulesDlg(Window* pParent, SvxLinguData_Impl& rData) :
+ ModalDialog( pParent, SVX_RES(RID_SVXDLG_EDIT_MODULES ) ),
+ aModulesFL ( this, SVX_RES( FL_EDIT_MODULES_OPTIONS ) ),
+ aLanguageFT ( this, SVX_RES( FT_EDIT_MODULES_LANGUAGE ) ),
+ aLanguageLB ( this, SVX_RES( LB_EDIT_MODULES_LANGUAGE ), FALSE ),
+ aModulesCLB ( this, SVX_RES( CLB_EDIT_MODULES_MODULES ) ),
+ aPrioUpPB ( this, SVX_RES( PB_EDIT_MODULES_PRIO_UP ) ),
+ aPrioDownPB ( this, SVX_RES( PB_EDIT_MODULES_PRIO_DOWN ) ),
+ aBackPB ( this, SVX_RES( PB_EDIT_MODULES_PRIO_BACK ) ),
+ aMoreDictsLink ( this, SVX_RES( FT_EDIT_MODULES_NEWDICTSLINK ) ),
+ aButtonsFL ( this, SVX_RES( FL_EDIT_MODULES_BUTTONS ) ),
+ aHelpPB ( this, SVX_RES( PB_HELP ) ),
+ aClosePB ( this, SVX_RES( PB_OK ) ),
+ sSpell ( SVX_RES( ST_SPELL ) ),
+ sHyph ( SVX_RES( ST_HYPH ) ),
+ sThes ( SVX_RES( ST_THES ) ),
+ sGrammar ( SVX_RES( ST_GRAMMAR ) ),
+ rLinguData ( rData )
+{
+ pCheckButtonData = NULL;
+ FreeResource();
+
+ pDefaultLinguData = new SvxLinguData_Impl( rLinguData );
+
+ aModulesCLB.SetWindowBits( WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
+ aModulesCLB.SetHighlightRange();
+ aModulesCLB.SetHelpId(HID_CLB_EDIT_MODULES_MODULES );
+ aModulesCLB.SetSelectHdl( LINK( this, SvxEditModulesDlg, SelectHdl_Impl ));
+ aModulesCLB.SetCheckButtonHdl( LINK( this, SvxEditModulesDlg, BoxCheckButtonHdl_Impl) );
+
+ aClosePB .SetClickHdl( LINK( this, SvxEditModulesDlg, ClickHdl_Impl ));
+ aPrioUpPB .SetClickHdl( LINK( this, SvxEditModulesDlg, UpDownHdl_Impl ));
+ aPrioDownPB.SetClickHdl( LINK( this, SvxEditModulesDlg, UpDownHdl_Impl ));
+ aBackPB .SetClickHdl( LINK( this, SvxEditModulesDlg, BackHdl_Impl ));
+ // in case of not installed language modules
+ aPrioUpPB .Enable( FALSE );
+ aPrioDownPB.Enable( FALSE );
+
+ if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
+ != SvtExtendedSecurityOptions::OPEN_NEVER )
+ {
+ aMoreDictsLink.SetURL( String(
+ RTL_CONSTASCII_STRINGPARAM( "http://extensions.services.openoffice.org/dictionary?cid=926386" ) ) );
+ aMoreDictsLink.SetClickHdl( LINK( this, SvxEditModulesDlg, OpenURLHdl_Impl ) );
+ }
+ else
+ {
+ aMoreDictsLink.Hide();
+ long nPos = aMoreDictsLink.GetPosPixel().Y() + aMoreDictsLink.GetSizePixel().Height();
+ Size aSize = aModulesCLB.GetSizePixel();
+ aSize.Height() += ( nPos - ( aModulesCLB.GetPosPixel().Y() + aSize.Height() ) );
+ aModulesCLB.SetSizePixel( aSize );
+ }
+
+ //
+ //fill language box
+ //
+ Sequence< INT16 > aAvailLang;
+ uno::Reference< XAvailableLocales > xAvail( rLinguData.GetManager(), UNO_QUERY );
+ if (xAvail.is())
+ {
+ aAvailLang = lcl_LocaleSeqToLangSeq(
+ xAvail->getAvailableLocales( C2U(cSpell) ) );
+ }
+ const Sequence< Locale >& rLoc = rLinguData.GetAllSupportedLocales();
+ const Locale* pLocales = rLoc.getConstArray();
+ aLanguageLB.Clear();
+ for(long i = 0; i < rLoc.getLength(); i++)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pLocales[i] );
+ aLanguageLB.InsertLanguage( nLang, lcl_SeqHasLang( aAvailLang, nLang ) );
+ }
+ LanguageType eSysLang = MsLangId::getSystemLanguage();
+ aLanguageLB.SelectLanguage( eSysLang );
+ if(!aLanguageLB.IsLanguageSelected( eSysLang ) )
+ aLanguageLB.SelectEntryPos(0);
+
+ aLanguageLB.SetSelectHdl( LINK( this, SvxEditModulesDlg, LangSelectHdl_Impl ));
+ LangSelectHdl_Impl(&aLanguageLB);
+}
+
+
+SvxEditModulesDlg::~SvxEditModulesDlg()
+{
+ delete pDefaultLinguData;
+}
+
+
+SvLBoxEntry* SvxEditModulesDlg::CreateEntry( String& rTxt, USHORT nCol )
+{
+ SvLBoxEntry* pEntry = new SvLBoxEntry;
+ if( !pCheckButtonData )
+ {
+ pCheckButtonData = new SvLBoxButtonData( &aModulesCLB );
+ pCheckButtonData->SetLink( aModulesCLB.GetCheckButtonHdl() );
+ }
+
+ String sEmpty;
+ if (CBCOL_FIRST == nCol)
+ pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+ if (CBCOL_SECOND == nCol)
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff!
+ pEntry->AddItem( new BrwStringDic_Impl( pEntry, 0, rTxt ) );
+
+ return pEntry;
+}
+
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, SvxCheckListBox *, pBox )
+{
+ if (&aModulesCLB == pBox)
+ {
+ sal_Bool bDisableUp = sal_True;
+ sal_Bool bDisableDown = sal_True;
+ SvLBoxEntry *pEntry = pBox->GetCurEntry();
+ if (pEntry)
+ {
+ ModuleUserData_Impl* pData = (ModuleUserData_Impl*)pEntry->GetUserData();
+ if(!pData->IsParent() && pData->GetType() != TYPE_HYPH)
+ {
+ USHORT nCurPos = pBox->GetSelectEntryPos();
+ if(nCurPos < pBox->GetEntryCount() - 1)
+ {
+ bDisableDown = ((ModuleUserData_Impl*)pBox->
+ GetEntry(nCurPos + 1)->GetUserData())->IsParent();
+ }
+ if(nCurPos > 1)
+ {
+ bDisableUp = ((ModuleUserData_Impl*)pBox->
+ GetEntry(nCurPos - 1)->GetUserData())->IsParent();
+ }
+ }
+ aPrioUpPB.Enable(!bDisableUp);
+ aPrioDownPB.Enable(!bDisableDown);
+ }
+ }
+ else
+ {
+ DBG_ERROR( "pBox unexpected value" );
+ }
+
+ return 0;
+}
+/* -----------------------------28.05.01 11:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, SvTreeListBox *, pBox )
+{
+// if (pBox == (SvTreeListBox *) &aModulesCLB)
+// {
+ pBox = &aModulesCLB;
+ SvLBoxEntry *pCurEntry = pBox->GetCurEntry();
+ if (pCurEntry)
+ {
+ ModuleUserData_Impl* pData = (ModuleUserData_Impl *)
+ pCurEntry->GetUserData();
+ if (!pData->IsParent() && pData->GetType() == TYPE_HYPH)
+ {
+ // make hyphenator checkboxes function as radio-buttons
+ // (at most one box may be checked)
+ SvLBoxEntry *pEntry = pBox->First();
+ while (pEntry)
+ {
+ pData = (ModuleUserData_Impl *) pEntry->GetUserData();
+ if (!pData->IsParent() &&
+ pData->GetType() == TYPE_HYPH &&
+ pEntry != pCurEntry)
+ {
+ lcl_SetCheckButton( pEntry, FALSE );
+ pBox->InvalidateEntry( pEntry );
+ }
+ pEntry = pBox->Next( pEntry );
+ }
+ }
+ }
+// }
+ return 0;
+}
+/* -----------------------------27.11.00 14:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString lcl_GetServiceName(BYTE nType)
+{
+ switch(nType)
+ {
+ case TYPE_SPELL : return C2U(cSpell);
+ case TYPE_GRAMMAR : return C2U(cGrammar);
+ case TYPE_HYPH : return C2U(cHyph);
+ case TYPE_THES : return C2U(cThes);
+ }
+ return OUString();
+}
+
+
+IMPL_LINK( SvxEditModulesDlg, LangSelectHdl_Impl, ListBox *, pBox )
+{
+ LanguageType eCurLanguage = aLanguageLB.GetSelectLanguage();
+ static Locale aLastLocale;
+ Locale aCurLocale;
+ SvxLanguageToLocale(aCurLocale, eCurLanguage);
+ SvLBoxTreeList *pModel = aModulesCLB.GetModel();
+// uno::Reference<XLinguServiceManager>& xMgr = rLinguData.GetManager();
+
+ if (pBox)
+ {
+ // save old probably changed settings
+ // before switching to new language entries
+
+ INT16 nLang = SvxLocaleToLanguage( aLastLocale );
+
+ sal_Int32 nStart = 0, nLocalIndex = 0;
+ Sequence< OUString > aChange;
+ sal_Bool bChanged = FALSE;
+ for(USHORT i = 0; i < aModulesCLB.GetEntryCount(); i++)
+ {
+ SvLBoxEntry *pEntry = aModulesCLB.GetEntry(i);
+ ModuleUserData_Impl* pData = (ModuleUserData_Impl*)pEntry->GetUserData();
+ if(pData->IsParent())
+ {
+ if(bChanged)
+ {
+ LangImplNameTable *pTable = 0;
+ BYTE nType = pData->GetType();
+ switch (nType - 1)
+ {
+ case TYPE_SPELL : pTable = &rLinguData.GetSpellTable(); break;
+ case TYPE_GRAMMAR : pTable = &rLinguData.GetGrammarTable(); break;
+ case TYPE_HYPH : pTable = &rLinguData.GetHyphTable(); break;
+ case TYPE_THES : pTable = &rLinguData.GetThesTable(); break;
+ }
+ if (pTable)
+ {
+ aChange.realloc(nStart);
+ (*pTable)[ nLang ] = aChange;
+ }
+ }
+ nLocalIndex = nStart = 0;
+ aChange.realloc(aModulesCLB.GetEntryCount());
+ bChanged = FALSE;
+ }
+ else
+ {
+ OUString* pChange = aChange.getArray();
+ pChange[nStart] = pData->GetImplName();
+ bChanged |= pData->GetIndex() != nLocalIndex ||
+ pData->IsChecked() != aModulesCLB.IsChecked(i);
+ if(aModulesCLB.IsChecked(i))
+ nStart++;
+ ++nLocalIndex;
+ }
+ }
+ if(bChanged)
+ {
+ aChange.realloc(nStart);
+ rLinguData.GetThesTable()[ nLang ] = aChange;
+ }
+ }
+
+ for(ULONG i = 0; i < aModulesCLB.GetEntryCount(); i++)
+ delete (ModuleUserData_Impl*)aModulesCLB.GetEntry(i)->GetUserData();
+
+ //
+ // display entries for new selected language
+ //
+ aModulesCLB.Clear();
+ if(LANGUAGE_DONTKNOW != eCurLanguage)
+ {
+// sal_Int32 nEntryPos = 1;
+
+ ULONG n;
+ ServiceInfo_Impl* pInfo;
+
+ //
+ // spellchecker entries
+ //
+ SvLBoxEntry* pEntry = CreateEntry( sSpell, CBCOL_SECOND );
+ ModuleUserData_Impl* pUserData = new ModuleUserData_Impl(
+ String(), TRUE, FALSE, TYPE_SPELL, 0 );
+ pEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pEntry );
+ //
+ Sequence< OUString > aNames( rLinguData.GetSortedImplNames( eCurLanguage, TYPE_SPELL ) );
+ const OUString *pName = aNames.getConstArray();
+ ULONG nNames = (ULONG) aNames.getLength();
+ sal_Int32 nLocalIndex = 0; // index relative to parent
+ for (n = 0; n < nNames; ++n)
+ {
+ OUString aImplName;
+ BOOL bIsSuppLang = FALSE;
+
+ pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ if (pInfo)
+ {
+ bIsSuppLang = pInfo->xSpell.is() &&
+ pInfo->xSpell->hasLocale( aCurLocale );
+ aImplName = pInfo->sSpellImplName;
+ }
+ if (aImplName.getLength() && bIsSuppLang)
+ {
+ String aTxt( pInfo->sDisplayName );
+ SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST );
+
+ LangImplNameTable &rTable = rLinguData.GetSpellTable();
+ const bool bHasLang = rTable.count( eCurLanguage );
+ if (!bHasLang)
+ {
+ DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported
+ }
+ const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
+ lcl_SetCheckButton( pNewEntry, bCheck );
+ pUserData = new ModuleUserData_Impl( aImplName, FALSE,
+ bCheck, TYPE_SPELL, (BYTE)nLocalIndex++ );
+ pNewEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pNewEntry );
+ }
+ }
+
+ //
+ // grammar checker entries
+ //
+ pEntry = CreateEntry( sGrammar, CBCOL_SECOND );
+ pUserData = new ModuleUserData_Impl( String(), TRUE, FALSE, TYPE_GRAMMAR, 0 );
+ pEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pEntry );
+ //
+ aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_GRAMMAR );
+ pName = aNames.getConstArray();
+ nNames = (ULONG) aNames.getLength();
+ nLocalIndex = 0;
+ for (n = 0; n < nNames; ++n)
+ {
+ OUString aImplName;
+ BOOL bIsSuppLang = FALSE;
+
+ pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ if (pInfo)
+ {
+ bIsSuppLang = pInfo->xGrammar.is() &&
+ pInfo->xGrammar->hasLocale( aCurLocale );
+ aImplName = pInfo->sGrammarImplName;
+ }
+ if (aImplName.getLength() && bIsSuppLang)
+ {
+ String aTxt( pInfo->sDisplayName );
+ SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST );
+
+ LangImplNameTable &rTable = rLinguData.GetGrammarTable();
+ const bool bHasLang = rTable.count( eCurLanguage );
+ if (!bHasLang)
+ {
+ DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported
+ }
+ const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
+ lcl_SetCheckButton( pNewEntry, bCheck );
+ pUserData = new ModuleUserData_Impl( aImplName, FALSE,
+ bCheck, TYPE_GRAMMAR, (BYTE)nLocalIndex++ );
+ pNewEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pNewEntry );
+ }
+ }
+
+ //
+ // hyphenator entries
+ //
+ pEntry = CreateEntry( sHyph, CBCOL_SECOND );
+ pUserData = new ModuleUserData_Impl( String(), TRUE, FALSE, TYPE_HYPH, 0 );
+ pEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pEntry );
+ //
+ aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_HYPH );
+ pName = aNames.getConstArray();
+ nNames = (ULONG) aNames.getLength();
+ nLocalIndex = 0;
+ for (n = 0; n < nNames; ++n)
+ {
+ OUString aImplName;
+ BOOL bIsSuppLang = FALSE;
+
+ pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ if (pInfo)
+ {
+ bIsSuppLang = pInfo->xHyph.is() &&
+ pInfo->xHyph->hasLocale( aCurLocale );
+ aImplName = pInfo->sHyphImplName;
+ }
+ if (aImplName.getLength() && bIsSuppLang)
+ {
+ String aTxt( pInfo->sDisplayName );
+ SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST );
+
+ LangImplNameTable &rTable = rLinguData.GetHyphTable();
+ const bool bHasLang = rTable.count( eCurLanguage );
+ if (!bHasLang)
+ {
+ DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported
+ }
+ const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
+ lcl_SetCheckButton( pNewEntry, bCheck );
+ pUserData = new ModuleUserData_Impl( aImplName, FALSE,
+ bCheck, TYPE_HYPH, (BYTE)nLocalIndex++ );
+ pNewEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pNewEntry );
+ }
+ }
+
+ //
+ // thesaurus entries
+ //
+ pEntry = CreateEntry( sThes, CBCOL_SECOND );
+ pUserData = new ModuleUserData_Impl( String(), TRUE, FALSE, TYPE_THES, 0 );
+ pEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pEntry );
+ //
+ aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_THES );
+ pName = aNames.getConstArray();
+ nNames = (ULONG) aNames.getLength();
+ nLocalIndex = 0;
+ for (n = 0; n < nNames; ++n)
+ {
+ OUString aImplName;
+ BOOL bIsSuppLang = FALSE;
+
+ pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ if (pInfo)
+ {
+ bIsSuppLang = pInfo->xThes.is() &&
+ pInfo->xThes->hasLocale( aCurLocale );
+ aImplName = pInfo->sThesImplName;
+ }
+ if (aImplName.getLength() && bIsSuppLang)
+ {
+ String aTxt( pInfo->sDisplayName );
+ SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST );
+
+ LangImplNameTable &rTable = rLinguData.GetThesTable();
+ const bool bHasLang = rTable.count( eCurLanguage );
+ if (!bHasLang)
+ {
+ DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported
+ }
+ const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
+ lcl_SetCheckButton( pNewEntry, bCheck );
+ pUserData = new ModuleUserData_Impl( aImplName, FALSE,
+ bCheck, TYPE_THES, (BYTE)nLocalIndex++ );
+ pNewEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pNewEntry );
+ }
+ }
+ }
+ aLastLocale.Language = aCurLocale.Language;
+ aLastLocale.Country = aCurLocale.Country;
+ return 0;
+}
+/* -----------------------------27.11.00 19:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SvxEditModulesDlg, UpDownHdl_Impl, PushButton *, pBtn )
+{
+ sal_Bool bUp = &aPrioUpPB == pBtn;
+ USHORT nCurPos = aModulesCLB.GetSelectEntryPos();
+ SvLBoxEntry* pEntry;
+ if (nCurPos != LISTBOX_ENTRY_NOTFOUND &&
+ 0 != (pEntry = aModulesCLB.GetEntry(nCurPos)))
+ {
+ aModulesCLB.SetUpdateMode(FALSE);
+ SvLBoxTreeList *pModel = aModulesCLB.GetModel();
+
+ ModuleUserData_Impl* pData = (ModuleUserData_Impl*)pEntry->GetUserData();
+ String aStr(aModulesCLB.GetEntryText(pEntry));
+ SvLBoxEntry* pToInsert = CreateEntry( aStr, CBCOL_FIRST );
+ pToInsert->SetUserData( (void *)pData);
+ BOOL bIsChecked = aModulesCLB.IsChecked(nCurPos);
+
+ pModel->Remove(pEntry);
+
+ USHORT nDestPos = bUp ? nCurPos - 1 : nCurPos + 1;
+ pModel->Insert(pToInsert, nDestPos);
+ aModulesCLB.CheckEntryPos(nDestPos, bIsChecked );
+ aModulesCLB.SelectEntryPos(nDestPos );
+ SelectHdl_Impl(&aModulesCLB);
+ aModulesCLB.SetUpdateMode(TRUE);
+ }
+ return 0;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SvxEditModulesDlg, ClickHdl_Impl, PushButton *, pBtn )
+{
+ if (&aClosePB == pBtn)
+ {
+ // store language config
+ LangSelectHdl_Impl(&aLanguageLB);
+ EndDialog( RET_OK );
+ }
+ else
+ {
+ DBG_ERROR( "pBtn unexpected value" );
+ }
+
+ return 0;
+}
+/* -----------------------------27.11.00 20:31--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SvxEditModulesDlg, BackHdl_Impl, PushButton *, EMPTYARG )
+{
+ rLinguData = *pDefaultLinguData;
+ LangSelectHdl_Impl(0);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxEditModulesDlg, OpenURLHdl_Impl, svt::FixedHyperlink *, EMPTYARG )
+{
+ ::rtl::OUString sURL( aMoreDictsLink.GetURL() );
+ lcl_OpenURL( sURL );
+ return 0;
+}
+
diff --git a/cui/source/options/optlingu.hrc b/cui/source/options/optlingu.hrc
new file mode 100644
index 000000000000..73b481cbb6a3
--- /dev/null
+++ b/cui/source/options/optlingu.hrc
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * 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: optlingu.hrc,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// defines ---------------------------------------------------------------
+
+#define FL_LINGUISTIC 101
+
+#define FT_LINGU_MODULES 111
+#define CLB_LINGU_MODULES 112
+#define PB_LINGU_MODULES_EDIT 113
+
+#define FT_LINGU_OPTIONS 121
+#define CLB_LINGU_OPTIONS 122
+#define PB_LINGU_OPTIONS_EDIT 123
+#define FT_LINGU_OPTIONS_MOREDICTS 124
+
+#define STR_CAPITAL_WORDS 201
+#define STR_WORDS_WITH_DIGITS 202
+#define STR_CAPITALIZATION 203
+#define STR_SPELL_SPECIAL 204
+#define STR_SPELL_AUTO 206
+#define STR_NUM_PRE_BREAK 209
+#define STR_NUM_POST_BREAK 210
+#define STR_HYPH_AUTO 211
+#define STR_HYPH_SPECIAL 212
+#define STR_NUM_MIN_WORDLEN 213
+
+#define STR_NUM_PRE_BREAK_DLG 214
+#define STR_NUM_POST_BREAK_DLG 215
+#define STR_NUM_MIN_WORDLEN_DLG 216
+
+#define STR_GRAMMAR_AUTO 217
+
+#define STR_WARNING 63
+
+#define PB_OK 70
+#define PB_HELP 72
+
+#define ST_SPELL 82
+#define ST_HYPH 83
+#define ST_THES 84
+#define ST_GRAMMAR 85
+
+#define FL_NUMVAL_PREBREAK 305
+#define BT_OK_PREBREAK 306
+#define BT_CANCEL_PREBREAK 307
+#define ED_PREBREAK 308
+#define PB_EDIT_MODULES_PRIO_UP 309
+#define PB_EDIT_MODULES_PRIO_DOWN 310
+#define PB_EDIT_MODULES_PRIO_BACK 311
+
+#define FT_LINGU_DICS 312
+#define CLB_LINGU_DICS 313
+#define PB_LINGU_DICS_NEW_DIC 314
+#define PB_LINGU_DICS_EDIT_DIC 315
+#define PB_LINGU_DICS_DEL_DIC 316
+
+#define FL_EDIT_MODULES_OPTIONS 317
+#define FT_EDIT_MODULES_LANGUAGE 318
+#define LB_EDIT_MODULES_LANGUAGE 319
+#define CLB_EDIT_MODULES_MODULES 320
+#define FT_EDIT_MODULES_NEWDICTSLINK 321
+#define FL_EDIT_MODULES_BUTTONS 322
+
diff --git a/cui/source/options/optlingu.src b/cui/source/options/optlingu.src
new file mode 100644
index 000000000000..a550451193f2
--- /dev/null
+++ b/cui/source/options/optlingu.src
@@ -0,0 +1,357 @@
+/*************************************************************************
+ *
+ * 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: optlingu.src,v $
+ * $Revision: 1.51 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "optlingu.hrc"
+#include "helpid.hrc"
+
+#include <svtools/controldims.hrc>
+#include <sfx2/sfx.hrc>
+#include <svx/dialogs.hrc>
+
+// RID_SVXDLG_EDIT_MODULES ---------------------------------------------------
+
+ModalDialog RID_SVXDLG_EDIT_MODULES
+{
+ HelpID = HID_EDIT_MODULES ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Size = MAP_APPFONT ( 240 , 197 ) ;
+ Text [ en-US ] = "Edit Modules";
+
+ FixedLine FL_EDIT_MODULES_OPTIONS
+ {
+ Pos = MAP_APPFONT ( RSC_SP_FLGR_INNERBORDER_LEFT , RSC_SP_FLGR_INNERBORDER_TOP ) ;
+ Size = MAP_APPFONT ( 240 - 2*RSC_SP_FLGR_INNERBORDER_LEFT , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Options";
+ };
+ FixedText FT_EDIT_MODULES_LANGUAGE
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 68 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Language";
+ };
+ ListBox LB_EDIT_MODULES_LANGUAGE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 83 , 14 ) ;
+ Size = MAP_APPFONT ( 95 , 80 ) ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ Control CLB_EDIT_MODULES_MODULES
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 166 , 120 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_EDIT_MODULES_PRIO_UP
+ {
+ Pos = MAP_APPFONT ( 184 , 32 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Move Up";
+ };
+ PushButton PB_EDIT_MODULES_PRIO_DOWN
+ {
+ Pos = MAP_APPFONT ( 184 , 49 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Move Down";
+ };
+ PushButton PB_EDIT_MODULES_PRIO_BACK
+ {
+ Pos = MAP_APPFONT ( 184 , 66 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Back";
+ };
+ FixedText FT_EDIT_MODULES_NEWDICTSLINK
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 155 ) ;
+ Size = MAP_APPFONT ( 169 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "~Get more dictionaries online...";
+ };
+ FixedLine FL_EDIT_MODULES_BUTTONS
+ {
+ Pos = MAP_APPFONT ( 0 , 166 ) ;
+ Size = MAP_APPFONT ( 240 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 12, 177 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 184 , 177 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "Close";
+ };
+
+ String ST_SPELL
+ {
+ Text [ en-US ] = "Spelling";
+ };
+ String ST_HYPH
+ {
+ Text [ en-US ] = "Hyphenation";
+ };
+ String ST_THES
+ {
+ Text [ en-US ] = "Thesaurus";
+ };
+ String ST_GRAMMAR
+ {
+ Text [ en-US ] = "Grammar";
+ };
+};
+
+// RID_SVXDLG_LNG_ED_NUM_PREBREAK -------------------------------------------
+
+ModalDialog RID_SVXDLG_LNG_ED_NUM_PREBREAK
+{
+ HelpID = HID_LNGDLG_NUM_PREBREAK ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Size = MAP_APPFONT ( 155 , 43 ) ;
+ Text [ en-US ] = "Hyphenation";
+ FixedLine FL_NUMVAL_PREBREAK
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 87 , 8 ) ;
+ };
+ OKButton BT_OK_PREBREAK
+ {
+ Pos = MAP_APPFONT ( 99 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL_PREBREAK
+ {
+ Pos = MAP_APPFONT ( 99 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ NumericField ED_PREBREAK
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 14 ) ;
+ Size = MAP_APPFONT ( 31 , 12 ) ;
+ Left = TRUE ;
+ Minimum = 2 ;
+ Maximum = 9 ;
+ Last = 9 ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ SpinSize = 1;
+ };
+ String STR_NUM_PRE_BREAK_DLG
+ {
+ Text [ en-US ] = "Characters before break";
+ };
+ String STR_NUM_POST_BREAK_DLG
+ {
+ Text [ en-US ] = "Characters after break";
+ };
+ String STR_NUM_MIN_WORDLEN_DLG
+ {
+ Text [ en-US ] = "Minimal word length";
+ };
+};
+
+// RID_SFXPAGE_LINGU --------------------------------------------------------
+
+TabPage RID_SFXPAGE_LINGU
+{
+ HelpId = HID_OPTIONS_LINGU ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Options";
+ FixedLine FL_LINGUISTIC
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Writing aids";
+ };
+ FixedText FT_LINGU_MODULES
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 175 , 8 ) ;
+ Text [ en-US ] = "Available language modules";
+ };
+ Control CLB_LINGU_MODULES
+ {
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 182 , 30 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_LINGU_MODULES_EDIT
+ {
+ Pos = MAP_APPFONT ( 198 , 25 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Edit...";
+ };
+ FixedText FT_LINGU_DICS
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 59 ) ;
+ Size = MAP_APPFONT ( 175 , 8 ) ;
+ Text [ en-US ] = "User-defined dictionaries";
+ };
+ Control CLB_LINGU_DICS
+ {
+ Pos = MAP_APPFONT ( 12 , 70 ) ;
+ Size = MAP_APPFONT ( 182 , 48 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_LINGU_DICS_NEW_DIC
+ {
+ Pos = MAP_APPFONT ( 198 , 70 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~New...";
+ };
+ PushButton PB_LINGU_DICS_EDIT_DIC
+ {
+ Pos = MAP_APPFONT ( 198 , 87 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ed~it...";
+ };
+ PushButton PB_LINGU_DICS_DEL_DIC
+ {
+ Pos = MAP_APPFONT ( 198 , 104 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Delete";
+ };
+ FixedText FT_LINGU_OPTIONS
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 122 ) ;
+ Size = MAP_APPFONT ( 175 , 8 ) ;
+ Text [ en-US ] = "~Options";
+ };
+ Control CLB_LINGU_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 12 , 133 ) ;
+ Size = MAP_APPFONT ( 182 , 46 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_LINGU_OPTIONS_EDIT
+ {
+ Pos = MAP_APPFONT ( 198 , 133 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Edi~t...";
+ };
+ FixedText FT_LINGU_OPTIONS_MOREDICTS
+ {
+ Left = TRUE ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 182 ) ;
+ Size = MAP_APPFONT ( 182 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "~Get more dictionaries online...";
+ };
+
+ String STR_CAPITAL_WORDS
+ {
+ Text [ en-US ] = "Check uppercase words";
+ };
+ String STR_WORDS_WITH_DIGITS
+ {
+ Text [ en-US ] = "Check words with numbers ";
+ };
+ String STR_CAPITALIZATION
+ {
+ Text [ en-US ] = "Check capitalization";
+ };
+ String STR_SPELL_SPECIAL
+ {
+ Text [ en-US ] = "Check special regions";
+ };
+ String STR_SPELL_AUTO
+ {
+ Text [ en-US ] = "Check spelling as you type";
+ };
+ String STR_GRAMMAR_AUTO
+ {
+ Text [ en-US ] = "Check grammar as you type";
+ };
+ String STR_NUM_MIN_WORDLEN
+ {
+ Text [ en-US ] = "Minimal number of characters for hyphenation: ";
+ };
+ String STR_NUM_PRE_BREAK
+ {
+ Text [ en-US ] = "Characters before line break: ";
+ };
+ String STR_NUM_POST_BREAK
+ {
+ Text [ en-US ] = "Characters after line break: ";
+ };
+ String STR_HYPH_AUTO
+ {
+ Text [ en-US ] = "Hyphenate without inquiry";
+ };
+ String STR_HYPH_SPECIAL
+ {
+ Text [ en-US ] = "Hyphenate special regions";
+ };
+};
+// end: TabPage RID_SFXPAGE_LINGU
+
+ // RID_SFXQB_DELDICT --------------------------------------------------------
+QueryBox RID_SFXQB_DELDICT
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Do you want to delete the dictionary?" ;
+};
+ // RID_SFXQB_DEL_IGNORELIST ----------------------------------------------
+QueryBox RID_SFXQB_DEL_IGNORELIST
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Do you want to delete the ignore list?" ;
+};
+ // ******************************************************************* EOF
diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx
new file mode 100644
index 000000000000..3ba69fa6e42c
--- /dev/null
+++ b/cui/source/options/optmemory.cxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * 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: optmemory.cxx,v $
+ * $Revision: 1.21 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <svtools/langtab.hxx>
+#include <svl/zforlist.hxx>
+#include <goodies/grfmgr.hxx>
+#include <svl/flagitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <unotools/lingucfg.hxx>
+#include <svl/szitem.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <vcl/msgbox.hxx>
+#include <rtl/math.hxx>
+#include <unotools/undoopt.hxx>
+#include <unotools/useroptions.hxx>
+#include <unotools/cacheoptions.hxx>
+#include <unotools/fontoptions.hxx>
+#include <svtools/menuoptions.hxx>
+#include <unotools/startoptions.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svtools/miscopt.hxx>
+#include <unotools/syslocaleoptions.hxx>
+#include <svtools/helpopt.hxx>
+#include <unotools/configitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <comphelper/types.hxx>
+#include <svx/unolingu.hxx>
+#include <svx/langitem.hxx>
+#include "cuioptgenrl.hxx"
+#include "optpath.hxx"
+#include "optsave.hxx"
+#include "optlingu.hxx"
+#include <svx/xpool.hxx>
+#include <svx/dlgutil.hxx>
+#include "cuitabarea.hxx"
+#include <svx/dialogs.hrc>
+#include "optmemory.hrc"
+#include "optmemory.hxx"
+#include <svx/ofaitem.hxx>
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include <svx/dialmgr.hxx>
+
+#define CONFIG_LANGUAGES "OfficeLanguages"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::utl;
+using namespace ::rtl;
+using namespace ::sfx2;
+
+
+#define NF2BYTES 104857.6 // 2^20/10, used for aNfGraphicObjectCache-unit -> Byte
+#define BYTES2NF (1.0/NF2BYTES) // 10/2^20
+
+
+inline long OfaMemoryOptionsPage::GetNfGraphicCacheVal( void ) const
+{
+ return static_cast<long>(aNfGraphicCache.GetValue() << 20);
+}
+
+inline void OfaMemoryOptionsPage::SetNfGraphicCacheVal( long nSizeInBytes )
+{
+ aNfGraphicCache.SetValue( nSizeInBytes >> 20 );
+}
+
+long OfaMemoryOptionsPage::GetNfGraphicObjectCacheVal( void ) const
+{
+ return long( ::rtl::math::round( double( aNfGraphicObjectCache.GetValue() ) * NF2BYTES ) );
+}
+
+void OfaMemoryOptionsPage::SetNfGraphicObjectCacheVal( long nSizeInBytes )
+{
+ aNfGraphicObjectCache.SetValue( long( ::rtl::math::round( double( nSizeInBytes ) * BYTES2NF ) ) );
+}
+
+inline void OfaMemoryOptionsPage::SetNfGraphicObjectCacheMax( long nSizeInBytes )
+{
+ aNfGraphicObjectCache.SetMax( long( double( nSizeInBytes ) * BYTES2NF ) );
+}
+
+inline void OfaMemoryOptionsPage::SetNfGraphicObjectCacheLast( long nSizeInBytes )
+{
+ aNfGraphicObjectCache.SetLast( long( double( nSizeInBytes ) * BYTES2NF ) );
+}
+
+int OfaMemoryOptionsPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+OfaMemoryOptionsPage::OfaMemoryOptionsPage(Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, SVX_RES( OFA_TP_MEMORY ), rSet ),
+
+ aUndoBox ( this, SVX_RES( GB_UNDO ) ),
+ aUndoText ( this, SVX_RES( FT_UNDO ) ),
+ aUndoEdit ( this, SVX_RES( ED_UNDO ) ),
+ aGbGraphicCache ( this, SVX_RES( GB_GRAPHICCACHE ) ),
+ aFtGraphicCache ( this, SVX_RES( FT_GRAPHICCACHE ) ),
+ aNfGraphicCache ( this, SVX_RES( NF_GRAPHICCACHE ) ),
+ aFtGraphicCacheUnit ( this, SVX_RES( FT_GRAPHICCACHE_UNIT ) ),
+ aFtGraphicObjectCache ( this, SVX_RES( FT_GRAPHICOBJECTCACHE ) ),
+ aNfGraphicObjectCache ( this, SVX_RES( NF_GRAPHICOBJECTCACHE ) ),
+ aFtGraphicObjectCacheUnit(this, SVX_RES( FT_GRAPHICOBJECTCACHE_UNIT ) ),
+ aFtGraphicObjectTime ( this, SVX_RES( FT_GRAPHICOBJECTTIME ) ),
+ aTfGraphicObjectTime ( this, SVX_RES( TF_GRAPHICOBJECTTIME ) ),
+ aFtGraphicObjectTimeUnit( this, SVX_RES( FT_GRAPHICOBJECTTIME_UNIT ) ),
+
+ aGbOLECache ( this, SVX_RES( GB_OLECACHE ) ),
+ aFtOLECache ( this, SVX_RES( FT_OLECACHE ) ),
+ aNfOLECache ( this, SVX_RES( NF_OLECACHE ) ),
+ aQuickLaunchFL ( this, SVX_RES( FL_QUICKLAUNCH ) ),
+ aQuickLaunchCB ( this, SVX_RES( CB_QUICKLAUNCH ) )//,
+{
+#if defined(UNX)
+ aQuickLaunchCB.SetText( SVX_RES( STR_QUICKLAUNCH_UNX ) );
+#endif
+ FreeResource();
+
+ //quick launch only available in Win and OS/2
+#if !defined(WNT) && !defined(OS2) && !defined(ENABLE_GTK)
+ aQuickLaunchFL.Hide();
+ aQuickLaunchCB.Hide();
+#endif
+
+ aTfGraphicObjectTime.SetExtFormat( EXTTIMEF_24H_SHORT );
+
+ SetExchangeSupport();
+
+ aNfGraphicCache.SetModifyHdl( LINK( this, OfaMemoryOptionsPage, GraphicCacheConfigHdl ) );
+}
+
+// -----------------------------------------------------------------------
+
+OfaMemoryOptionsPage::~OfaMemoryOptionsPage()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* OfaMemoryOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new OfaMemoryOptionsPage( pParent, rAttrSet );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL OfaMemoryOptionsPage::FillItemSet( SfxItemSet& rSet )
+{
+ BOOL bModified = FALSE;
+
+ SvtCacheOptions aCacheOptions;
+
+ // Undo-Schritte
+ if ( aUndoEdit.GetText() != aUndoEdit.GetSavedValue() )
+ SvtUndoOptions().SetUndoCount((UINT16)aUndoEdit.GetValue());
+
+ // GraphicCache
+ aCacheOptions.SetGraphicManagerTotalCacheSize( GetNfGraphicCacheVal() );
+ aCacheOptions.SetGraphicManagerObjectCacheSize( GetNfGraphicObjectCacheVal() );
+
+ const Time aTime( aTfGraphicObjectTime.GetTime() );
+ aCacheOptions.SetGraphicManagerObjectReleaseTime( aTime.GetSec() + aTime.GetMin() * 60 + aTime.GetHour() * 3600 );
+
+ // create a dummy graphic object to get access to the common GraphicManager
+ GraphicObject aDummyObject;
+ GraphicManager& rGrfMgr = aDummyObject.GetGraphicManager();
+
+ rGrfMgr.SetMaxCacheSize( aCacheOptions.GetGraphicManagerTotalCacheSize() );
+ rGrfMgr.SetMaxObjCacheSize( aCacheOptions.GetGraphicManagerObjectCacheSize(), TRUE );
+ rGrfMgr.SetCacheTimeout( aCacheOptions.GetGraphicManagerObjectReleaseTime() );
+
+ // OLECache
+ aCacheOptions.SetWriterOLE_Objects( static_cast<long>(aNfOLECache.GetValue()) );
+ aCacheOptions.SetDrawingEngineOLE_Objects( static_cast<long>(aNfOLECache.GetValue()) );
+
+ if( aQuickLaunchCB.IsChecked() != aQuickLaunchCB.GetSavedValue())
+ {
+ rSet.Put(SfxBoolItem(SID_ATTR_QUICKLAUNCHER, aQuickLaunchCB.IsChecked()));
+ bModified = TRUE;
+ }
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void OfaMemoryOptionsPage::Reset( const SfxItemSet& rSet )
+{
+ SvtCacheOptions aCacheOptions;
+ const SfxPoolItem* pItem;
+
+ // Undo-Schritte
+ aUndoEdit.SetValue( SvtUndoOptions().GetUndoCount() );
+ aUndoEdit.SaveValue();
+
+ // GraphicCache
+ long n = aCacheOptions.GetGraphicManagerTotalCacheSize();
+ SetNfGraphicCacheVal( n );
+ SetNfGraphicObjectCacheVal( Min( static_cast<sal_Int32>(GetNfGraphicCacheVal()), aCacheOptions.GetGraphicManagerObjectCacheSize() ) );
+
+ sal_Int32 nTime = aCacheOptions.GetGraphicManagerObjectReleaseTime();
+ Time aTime( (USHORT)( nTime / 3600 ), (USHORT)( ( nTime % 3600 ) / 60 ), (USHORT)( ( nTime % 3600 ) % 60 ) );
+ aTfGraphicObjectTime.SetTime( aTime );
+
+ GraphicCacheConfigHdl( &aNfGraphicCache );
+
+ // OLECache
+ aNfOLECache.SetValue( Max( aCacheOptions.GetWriterOLE_Objects(), aCacheOptions.GetDrawingEngineOLE_Objects() ) );
+
+ SfxItemState eState = rSet.GetItemState( SID_ATTR_QUICKLAUNCHER, FALSE, &pItem );
+ if ( SFX_ITEM_SET == eState )
+ aQuickLaunchCB.Check( ( (SfxBoolItem*)pItem )->GetValue() );
+ else if ( SFX_ITEM_DISABLED == eState )
+ {
+ // quickstart not installed
+ aQuickLaunchFL.Hide();
+ aQuickLaunchCB.Hide();
+ }
+
+ aQuickLaunchCB.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( OfaMemoryOptionsPage, GraphicCacheConfigHdl, NumericField*, EMPTYARG )
+{
+ long n = GetNfGraphicCacheVal();
+ SetNfGraphicObjectCacheMax( n );
+ SetNfGraphicObjectCacheLast( n );
+
+ if( GetNfGraphicObjectCacheVal() > n )
+ SetNfGraphicObjectCacheVal( n );
+
+ return 0;
+}
+
diff --git a/cui/source/options/optmemory.hrc b/cui/source/options/optmemory.hrc
new file mode 100644
index 000000000000..0ba3f833d2e7
--- /dev/null
+++ b/cui/source/options/optmemory.hrc
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * 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: optmemory.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OFA_OPTMEMORY_HRC
+#define _OFA_OPTMEMORY_HRC
+
+#include <svtools/controldims.hrc>
+
+// defines for positions and sizes ---------------------------------------
+
+#define WHOLE_WIDTH 248
+
+#define COLSPACE RSC_SP_CTRL_DESC_X
+#define COL0 6
+#define COL1 (COL0+6)
+#define COL2 (COL1+140) // width text before control
+#define COL3 (COL2+COLSPACE)
+#define COL4 (COL3+30) // width control
+#define COL5 (COL4+COLSPACE)
+#define COL6 (WHOLE_WIDTH) // width text after control (unit)
+
+#define ROWSPACE RSC_SP_CTRL_DESC_Y
+#define ROW0 3
+#define ROW1 ( ROW0+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE )
+#define ROW2 ( ROW1+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE )
+#define ROW3 ( ROW2+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE )
+#define ROW4 ( ROW3+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE )
+#define ROW5 ( ROW4+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE )
+#define ROW6 ( ROW5+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE )
+#define ROW7 ( ROW6+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE )
+#define ROW8 ( ROW7+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE )
+#define ROW9 ( ROW8+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE )
+
+#define DIFF(v1,v2) (v2-v1)
+#define OFFS_TEXTBOX_FIXEDTEXT(base) (base+(RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+
+#define WIDTH1 DIFF( COL1, COL2 )
+#define WIDTH2 DIFF( COL3, COL4 )
+#define WIDTH3 DIFF( COL5, COL6 )
+// tabpage memory --------------------------------------------------------
+
+#define GB_UNDO 10
+#define FT_UNDO 11
+#define ED_UNDO 12
+#define GB_GRAPHICCACHE 13
+#define FT_GRAPHICCACHE 14
+#define FT_GRAPHICCACHE_UNIT 15
+#define FT_GRAPHICOBJECTCACHE_UNIT 16
+#define FT_GRAPHICOBJECTTIME_UNIT 17
+#define NF_GRAPHICCACHE 18
+#define FT_GRAPHICOBJECTCACHE 19
+#define NF_GRAPHICOBJECTCACHE 20
+#define FT_GRAPHICOBJECTTIME 21
+#define TF_GRAPHICOBJECTTIME 22
+#define GB_OLECACHE 23
+#define FT_OLECACHE 24
+#define NF_OLECACHE 25
+#define FL_QUICKLAUNCH 26
+#define CB_QUICKLAUNCH 27
+#define STR_QUICKLAUNCH_UNX 28
+
+#endif // #ifndef _OFA_OPTMEMORY_HRC
+
diff --git a/cui/source/options/optmemory.hxx b/cui/source/options/optmemory.hxx
new file mode 100644
index 000000000000..f385dd60875f
--- /dev/null
+++ b/cui/source/options/optmemory.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * 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: optmemory.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OFA_OPTMEMORY_HXX
+#define _OFA_OPTMEMORY_HXX
+
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/langbox.hxx>
+#define FOLDERWEBVIEW_DEFAULTFILE "folder.so"
+
+// class OfaMiscTabPage --------------------------------------------------
+
+class OfaMemoryOptionsPage : public SfxTabPage
+{
+ using SfxTabPage::DeactivatePage;
+private:
+ FixedLine aUndoBox;
+ FixedText aUndoText;
+ NumericField aUndoEdit;
+
+ FixedLine aGbGraphicCache;
+ FixedText aFtGraphicCache;
+ NumericField aNfGraphicCache;
+ FixedText aFtGraphicCacheUnit;
+ FixedText aFtGraphicObjectCache;
+ NumericField aNfGraphicObjectCache;
+ FixedText aFtGraphicObjectCacheUnit;
+ FixedText aFtGraphicObjectTime;
+ TimeField aTfGraphicObjectTime;
+ FixedText aFtGraphicObjectTimeUnit;
+
+ FixedLine aGbOLECache;
+ FixedText aFtOLECache;
+ NumericField aNfOLECache;
+
+ FixedLine aQuickLaunchFL;
+ CheckBox aQuickLaunchCB;
+
+ DECL_LINK( GraphicCacheConfigHdl, NumericField* );
+
+ inline long GetNfGraphicCacheVal( void ) const; // returns # of Bytes
+ inline void SetNfGraphicCacheVal( long nSizeInBytes );
+
+ long GetNfGraphicObjectCacheVal( void ) const; // returns # of Bytes
+ void SetNfGraphicObjectCacheVal( long nSizeInBytes );
+ inline void SetNfGraphicObjectCacheMax( long nSizeInBytes );
+ inline void SetNfGraphicObjectCacheLast( long nSizeInBytes );
+protected:
+ virtual int DeactivatePage( SfxItemSet* pSet = NULL );
+
+public:
+ OfaMemoryOptionsPage( Window* pParent, const SfxItemSet& rSet );
+ ~OfaMemoryOptionsPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+
+#endif
diff --git a/cui/source/options/optmemory.src b/cui/source/options/optmemory.src
new file mode 100644
index 000000000000..fce14b15551d
--- /dev/null
+++ b/cui/source/options/optmemory.src
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * 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: optmemory.src,v $
+ * $Revision: 1.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 ---------------------------------------------------------------
+
+#include <svx/dialogs.hrc>
+#include "optmemory.hrc"
+#include "helpid.hrc"
+
+TabPage OFA_TP_MEMORY
+{
+ HelpID = HID_OFA_TP_MEMORY ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine GB_UNDO
+ {
+ Pos = MAP_APPFONT( COL0, ROW0 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Undo" ;
+ };
+ FixedText FT_UNDO
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW1 ) );
+ Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Number of steps";
+ };
+ NumericField ED_UNDO
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL3, ROW1 );
+ Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT );
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ Maximum = 1000 ;
+ Value = 100 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ MaxTextLength = 4;
+ };
+ FixedLine GB_GRAPHICCACHE
+ {
+ Pos = MAP_APPFONT( COL0, ROW2 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Graphics cache";
+ };
+ FixedText FT_GRAPHICCACHE
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW3 ) );
+ Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Use for %PRODUCTNAME";
+ };
+ NumericField NF_GRAPHICCACHE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL3, ROW3 );
+ Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT );
+ Minimum = 1;
+ Maximum = 256;
+ SpinSize = 1;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
+ FixedText FT_GRAPHICCACHE_UNIT
+ {
+ Pos = MAP_APPFONT( COL5, OFFS_TEXTBOX_FIXEDTEXT( ROW3 ) );
+ Size = MAP_APPFONT( WIDTH3, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "MB";
+ };
+ FixedText FT_GRAPHICOBJECTCACHE
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW4 ) );
+ Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Memory per object" ;
+ };
+ NumericField NF_GRAPHICOBJECTCACHE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL3, ROW4 );
+ Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT );
+ Minimum = 10;
+ Maximum = 2560;
+ SpinSize = 1;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ DecimalDigits = 1;
+ };
+ FixedText FT_GRAPHICOBJECTCACHE_UNIT
+ {
+ Pos = MAP_APPFONT( COL5, OFFS_TEXTBOX_FIXEDTEXT( ROW4 ) );
+ Size = MAP_APPFONT( WIDTH3, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "MB";
+ };
+ FixedText FT_GRAPHICOBJECTTIME
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW5 ) );
+ Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Remove from memory after";
+ };
+ TimeField TF_GRAPHICOBJECTTIME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL3, ROW5 );
+ Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT );
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Value = Time
+ {
+ Minute = 10;
+ };
+ Minimum = Time
+ {
+ Minute = 1;
+ };
+ Maximum = Time
+ {
+ Hour = 23 ;
+ Minute = 59 ;
+ };
+ First = Time
+ {
+ Minute = 10;
+ };
+ Last = Time
+ {
+ Hour = 23 ;
+ Minute = 59 ;
+ };
+ Format = TIMEF_NONE ;
+ Duration = TRUE ;
+ StrictFormat = TRUE ;
+ };
+ FixedText FT_GRAPHICOBJECTTIME_UNIT
+ {
+ Pos = MAP_APPFONT( COL5, OFFS_TEXTBOX_FIXEDTEXT( ROW5 ) );
+ Size = MAP_APPFONT( WIDTH3, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "hh:mm";
+ };
+ FixedLine GB_OLECACHE
+ {
+ Pos = MAP_APPFONT( COL0, ROW6 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Cache for inserted objects";
+ };
+ FixedText FT_OLECACHE
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW7 ) );
+ Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Number of objects";
+ };
+ NumericField NF_OLECACHE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL3, ROW7 );
+ Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT );
+ Minimum = 1;
+ Maximum = 1024;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
+ FixedLine FL_QUICKLAUNCH
+ {
+ Pos = MAP_APPFONT( COL0, ROW8 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "%PRODUCTNAME Quickstarter";
+ };
+ CheckBox CB_QUICKLAUNCH
+ {
+ Pos = MAP_APPFONT( COL1, ROW9 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Load %PRODUCTNAME during system start-up";
+ };
+ String STR_QUICKLAUNCH_UNX
+ {
+ Text[ en-US ] = "Enable systray Quickstarter";
+ };
+};
+
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
new file mode 100644
index 000000000000..dad30f0d853a
--- /dev/null
+++ b/cui/source/options/optpath.cxx
@@ -0,0 +1,866 @@
+/*************************************************************************
+ *
+ * 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: optpath.cxx,v $
+ * $Revision: 1.25 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svx/svxdlg.hxx>
+#include <tools/shl.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/app.hxx>
+#include <svl/pickerhelper.hxx>
+#include <svl/aeitem.hxx>
+#include <svtools/svtabbx.hxx>
+#include <svtools/filedlg.hxx>
+#include <tools/config.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/defaultoptions.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <unotools/viewoptions.hxx>
+
+#define _SVX_OPTPATH_CXX
+
+#include "optpath.hxx"
+#include <svx/dialmgr.hxx>
+#include "optpath.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include <comphelper/processfactory.hxx>
+#include <comphelper/configurationhelper.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
+#include "optHeaderTabListbox.hxx"
+#include <readonlyimage.hxx>
+#include <vcl/help.hxx>
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::uno;
+using namespace svx;
+
+// define ----------------------------------------------------------------
+
+#define TAB_WIDTH1 80
+#define TAB_WIDTH_MIN 10
+#define TAB_WIDTH2 1000
+#define ITEMID_TYPE 1
+#define ITEMID_PATH 2
+
+#define POSTFIX_INTERNAL String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_internal" ) )
+#define POSTFIX_USER String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_user" ) )
+#define POSTFIX_WRITABLE String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_writable" ) )
+#define POSTFIX_READONLY String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_readonly" ) )
+#define VAR_ONE String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "%1" ) )
+#define IODLG_CONFIGNAME String(DEFINE_CONST_UNICODE("FilePicker_Save"))
+
+// struct OptPath_Impl ---------------------------------------------------
+
+struct OptPath_Impl
+{
+ SvtDefaultOptions m_aDefOpt;
+ Image m_aLockImage;
+ Image m_aLockImageHC;
+ String m_sMultiPathDlg;
+ Reference< XPropertySet > m_xPathSettings;
+
+ OptPath_Impl(const ResId& rLockRes, const ResId& rLockResHC) :
+ m_aLockImage(rLockRes),
+ m_aLockImageHC(rLockResHC){}
+};
+
+// struct PathUserData_Impl ----------------------------------------------
+
+struct PathUserData_Impl
+{
+ USHORT nRealId;
+ SfxItemState eState;
+ String sUserPath;
+ String sWritablePath;
+
+ PathUserData_Impl( USHORT nId ) :
+ nRealId( nId ), eState( SFX_ITEM_UNKNOWN ) {}
+};
+
+struct Handle2CfgNameMapping_Impl
+{
+ USHORT m_nHandle;
+ const char* m_pCfgName;
+};
+
+static Handle2CfgNameMapping_Impl __READONLY_DATA Hdl2CfgMap_Impl[] =
+{
+ { SvtPathOptions::PATH_AUTOCORRECT, "AutoCorrect" },
+ { SvtPathOptions::PATH_AUTOTEXT, "AutoText" },
+ { SvtPathOptions::PATH_BACKUP, "Backup" },
+ { SvtPathOptions::PATH_GALLERY, "Gallery" },
+ { SvtPathOptions::PATH_GRAPHIC, "Graphic" },
+ { SvtPathOptions::PATH_TEMP, "Temp" },
+ { SvtPathOptions::PATH_TEMPLATE, "Template" },
+ { SvtPathOptions::PATH_WORK, "Work" },
+#if OSL_DEBUG_LEVEL > 1
+ { SvtPathOptions::PATH_LINGUISTIC, "Linguistic" },
+ { SvtPathOptions::PATH_DICTIONARY, "Dictionary" },
+#endif
+ { USHRT_MAX, NULL }
+};
+
+static String getCfgName_Impl( USHORT _nHandle )
+{
+ String sCfgName;
+ USHORT nIndex = 0;
+ while ( Hdl2CfgMap_Impl[ nIndex ].m_nHandle != USHRT_MAX )
+ {
+ if ( Hdl2CfgMap_Impl[ nIndex ].m_nHandle == _nHandle )
+ {
+ // config name found
+ sCfgName = String::CreateFromAscii( Hdl2CfgMap_Impl[ nIndex ].m_pCfgName );
+ break;
+ }
+ ++nIndex;
+ }
+
+ return sCfgName;
+}
+
+#define MULTIPATH_DELIMITER ';'
+
+String Convert_Impl( const String& rValue )
+{
+ char cDelim = MULTIPATH_DELIMITER;
+ USHORT nCount = rValue.GetTokenCount( cDelim );
+ String aReturn;
+ for ( USHORT i=0; i<nCount ; ++i )
+ {
+ String aValue = rValue.GetToken( i, cDelim );
+ INetURLObject aObj( aValue );
+ if ( aObj.GetProtocol() == INET_PROT_FILE )
+ aReturn += String(aObj.PathToFileName());
+ else if ( ::utl::LocalFileHelper::IsFileContent( aValue ) )
+ aReturn += String(aObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ));
+ if ( i+1 < nCount)
+ aReturn += MULTIPATH_DELIMITER;
+ }
+
+ return aReturn;
+}
+
+// class SvxControlFocusHelper ---------------------------------------------
+
+long SvxControlFocusHelper::Notify( NotifyEvent& rNEvt )
+{
+ long nRet = Control::Notify( rNEvt );
+
+ if ( m_pFocusCtrl && rNEvt.GetWindow() != m_pFocusCtrl && rNEvt.GetType() == EVENT_GETFOCUS )
+ m_pFocusCtrl->GrabFocus();
+ return nRet;
+}
+
+// functions -------------------------------------------------------------
+
+BOOL IsMultiPath_Impl( const USHORT nIndex )
+{
+#if OSL_DEBUG_LEVEL > 1
+ return ( SvtPathOptions::PATH_AUTOCORRECT == nIndex ||
+ SvtPathOptions::PATH_AUTOTEXT == nIndex ||
+ SvtPathOptions::PATH_BASIC == nIndex ||
+ SvtPathOptions::PATH_GALLERY == nIndex ||
+ SvtPathOptions::PATH_TEMPLATE == nIndex );
+#else
+ return ( SvtPathOptions::PATH_AUTOCORRECT == nIndex ||
+ SvtPathOptions::PATH_AUTOTEXT == nIndex ||
+ SvtPathOptions::PATH_BASIC == nIndex ||
+ SvtPathOptions::PATH_GALLERY == nIndex ||
+ SvtPathOptions::PATH_TEMPLATE == nIndex ||
+ SvtPathOptions::PATH_LINGUISTIC == nIndex ||
+ SvtPathOptions::PATH_DICTIONARY == nIndex );
+#endif
+}
+
+// class SvxPathTabPage --------------------------------------------------
+
+SvxPathTabPage::SvxPathTabPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SFXPAGE_PATH ), rSet ),
+
+ aTypeText ( this, SVX_RES( FT_TYPE ) ),
+ aPathText ( this, SVX_RES( FT_PATH ) ),
+ aPathCtrl ( this, SVX_RES( LB_PATH ) ),
+ aStandardBtn ( this, SVX_RES( BTN_STANDARD ) ),
+ aPathBtn ( this, SVX_RES( BTN_PATH ) ),
+ aStdBox ( this, SVX_RES( GB_STD ) ),
+
+ pHeaderBar ( NULL ),
+ pPathBox ( NULL ),
+ pImpl ( new OptPath_Impl( SVX_RES(IMG_LOCK), SVX_RES(IMG_LOCK_HC) ) ),
+ xDialogListener ( new ::svt::DialogClosedListener() )
+
+{
+ pImpl->m_sMultiPathDlg = String( SVX_RES( STR_MULTIPATHDLG ) );
+ aStandardBtn.SetClickHdl( LINK( this, SvxPathTabPage, StandardHdl_Impl ) );
+ Link aLink = LINK( this, SvxPathTabPage, PathHdl_Impl );
+ aPathBtn.SetClickHdl( aLink );
+ Size aBoxSize = aPathCtrl.GetOutputSizePixel();
+ pHeaderBar = new HeaderBar( &aPathCtrl, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
+ pHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( aBoxSize.Width(), 16 ) );
+ pHeaderBar->SetSelectHdl( LINK( this, SvxPathTabPage, HeaderSelect_Impl ) );
+ pHeaderBar->SetEndDragHdl( LINK( this, SvxPathTabPage, HeaderEndDrag_Impl ) );
+ Size aSz;
+ aSz.Width() = TAB_WIDTH1;
+ pHeaderBar->InsertItem( ITEMID_TYPE, aTypeText.GetText(),
+ LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(),
+ HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_UPARROW );
+ aSz.Width() = TAB_WIDTH2;
+ pHeaderBar->InsertItem( ITEMID_PATH, aPathText.GetText(),
+ LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(),
+ HIB_LEFT | HIB_VCENTER );
+
+ static long nTabs[] = {3, 0, TAB_WIDTH1, TAB_WIDTH1 + TAB_WIDTH2 };
+ Size aHeadSize = pHeaderBar->GetSizePixel();
+
+ WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP;
+ pPathBox = new OptHeaderTabListBox( &aPathCtrl, nBits );
+ aPathCtrl.SetFocusControl( pPathBox );
+ pPathBox->SetWindowBits( nBits );
+ pPathBox->SetDoubleClickHdl( aLink );
+ pPathBox->SetSelectHdl( LINK( this, SvxPathTabPage, PathSelect_Impl ) );
+ pPathBox->SetSelectionMode( MULTIPLE_SELECTION );
+ pPathBox->SetPosSizePixel( Point( 0, aHeadSize.Height() ),
+ Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
+ pPathBox->SetTabs( &nTabs[0], MAP_APPFONT );
+ pPathBox->InitHeaderBar( pHeaderBar );
+ pPathBox->SetHighlightRange();
+ pPathBox->SetHelpId( HID_OPTPATH_CTL_PATH );
+ pHeaderBar->SetHelpId( HID_OPTPATH_HEADERBAR );
+ pPathBox->Show();
+ pHeaderBar->Show();
+
+ FreeResource();
+
+ xDialogListener->SetDialogClosedLink( LINK( this, SvxPathTabPage, DialogClosedHdl ) );
+}
+
+// -----------------------------------------------------------------------
+
+SvxPathTabPage::~SvxPathTabPage()
+{
+ // #110603# do not grab focus to a destroyed window !!!
+ aPathCtrl.SetFocusControl( NULL );
+
+ pHeaderBar->Hide();
+ for ( USHORT i = 0; i < pPathBox->GetEntryCount(); ++i )
+ delete (PathUserData_Impl*)pPathBox->GetEntry(i)->GetUserData();
+ delete pPathBox;
+ delete pHeaderBar;
+ delete pImpl;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxPathTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SvxPathTabPage( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxPathTabPage::FillItemSet( SfxItemSet& )
+{
+ SvtPathOptions aPathOpt;
+ for ( USHORT i = 0; i < pPathBox->GetEntryCount(); ++i )
+ {
+ PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pPathBox->GetEntry(i)->GetUserData();
+ USHORT nRealId = pPathImpl->nRealId;
+ if ( pPathImpl->eState == SFX_ITEM_SET )
+ SetPathList( nRealId, pPathImpl->sUserPath, pPathImpl->sWritablePath );
+ }
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPathTabPage::Reset( const SfxItemSet& )
+{
+ pPathBox->Clear();
+ SvtPathOptions aPathOpt; //! deprecated
+
+ for( USHORT i = 0; i <= (USHORT)SvtPathOptions::PATH_WORK; ++i )
+ {
+ // only writer uses autotext
+ if ( i == SvtPathOptions::PATH_AUTOTEXT
+ && !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
+ continue;
+
+ switch (i)
+ {
+ case SvtPathOptions::PATH_AUTOCORRECT:
+ case SvtPathOptions::PATH_AUTOTEXT:
+ case SvtPathOptions::PATH_BACKUP:
+ case SvtPathOptions::PATH_GALLERY:
+ case SvtPathOptions::PATH_GRAPHIC:
+ case SvtPathOptions::PATH_TEMP:
+ case SvtPathOptions::PATH_TEMPLATE:
+#if OSL_DEBUG_LEVEL > 1
+ case SvtPathOptions::PATH_LINGUISTIC:
+ case SvtPathOptions::PATH_DICTIONARY:
+#endif
+ case SvtPathOptions::PATH_WORK:
+ {
+ String aStr( SVX_RES( RID_SVXSTR_PATH_NAME_START + i ) );
+ String sInternal, sUser, sWritable;
+ sal_Bool bReadOnly = sal_False;
+ GetPathList( i, sInternal, sUser, sWritable, bReadOnly );
+ String sTmpPath = sUser;
+ if ( sTmpPath.Len() > 0 && sWritable.Len() > 0 )
+ sTmpPath += MULTIPATH_DELIMITER;
+ sTmpPath += sWritable;
+ String aValue( sTmpPath );
+ aStr += '\t';
+ aStr += Convert_Impl( aValue );
+ SvLBoxEntry* pEntry = pPathBox->InsertEntry( aStr );
+ if ( bReadOnly )
+ {
+ pPathBox->SetCollapsedEntryBmp( pEntry, pImpl->m_aLockImage, BMP_COLOR_NORMAL );
+ pPathBox->SetCollapsedEntryBmp( pEntry, pImpl->m_aLockImageHC, BMP_COLOR_HIGHCONTRAST );
+ }
+ PathUserData_Impl* pPathImpl = new PathUserData_Impl(i);
+ pPathImpl->sUserPath = sUser;
+ pPathImpl->sWritablePath = sWritable;
+ pEntry->SetUserData( pPathImpl );
+ }
+ }
+ }
+
+ String aUserData = GetUserData();
+ if ( aUserData.Len() )
+ {
+ // Spaltenbreite restaurieren
+ pHeaderBar->SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() );
+ HeaderEndDrag_Impl( NULL );
+ // Sortierrichtung restaurieren
+ BOOL bUp = (BOOL)(USHORT)aUserData.GetToken(1).ToInt32();
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
+
+ if ( bUp )
+ {
+ nBits &= ~HIB_UPARROW;
+ nBits |= HIB_DOWNARROW;
+ }
+ else
+ {
+ nBits &= ~HIB_DOWNARROW;
+ nBits |= HIB_UPARROW;
+ }
+ pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
+ HeaderSelect_Impl( NULL );
+ }
+ PathSelect_Impl( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPathTabPage::FillUserData()
+{
+ String aUserData = String::CreateFromInt32( pHeaderBar->GetItemSize( ITEMID_TYPE ) );
+ aUserData += ';';
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits( ITEMID_TYPE );
+ BOOL bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
+ aUserData += bUp ? '1' : '0';
+ SetUserData( aUserData );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPathTabPage, PathSelect_Impl, OptHeaderTabListBox *, EMPTYARG )
+
+/* [Beschreibung]
+
+*/
+
+{
+ USHORT nSelCount = 0;
+ SvLBoxEntry* pEntry = pPathBox->FirstSelected();
+
+ //the entry image indicates whether the path is write protected
+ Image aEntryImage;
+ if(pEntry)
+ aEntryImage = pPathBox->GetCollapsedEntryBmp( pEntry );
+ BOOL bEnable = !aEntryImage;
+ while ( pEntry && ( nSelCount < 2 ) )
+ {
+ nSelCount++;
+ pEntry = pPathBox->NextSelected( pEntry );
+ }
+
+ aPathBtn.Enable( 1 == nSelCount && bEnable);
+ aStandardBtn.Enable( nSelCount > 0 && bEnable);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPathTabPage, StandardHdl_Impl, PushButton *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = pPathBox->FirstSelected();
+ while ( pEntry )
+ {
+ PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pEntry->GetUserData();
+ String aOldPath = pImpl->m_aDefOpt.GetDefaultPath( pPathImpl->nRealId );
+
+ if ( aOldPath.Len() )
+ {
+ String sInternal, sUser, sWritable, sTemp;
+ sal_Bool bReadOnly = sal_False;
+ GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly );
+
+ USHORT i;
+ USHORT nOldCount = aOldPath.GetTokenCount( MULTIPATH_DELIMITER );
+ USHORT nIntCount = sInternal.GetTokenCount( MULTIPATH_DELIMITER );
+ for ( i = 0; i < nOldCount; ++i )
+ {
+ bool bFound = false;
+ String sOnePath = aOldPath.GetToken( i, MULTIPATH_DELIMITER );
+ for ( USHORT j = 0; !bFound && j < nIntCount; ++j )
+ {
+ if ( sInternal.GetToken( i, MULTIPATH_DELIMITER ) == sOnePath )
+ bFound = true;
+ }
+ if ( !bFound )
+ {
+ if ( sTemp.Len() > 0 )
+ sTemp += MULTIPATH_DELIMITER;
+ sTemp += sOnePath;
+ }
+ }
+
+ String sUserPath, sWritablePath;
+ nOldCount = sTemp.GetTokenCount( MULTIPATH_DELIMITER );
+ for ( i = 0; nOldCount > 0 && i < nOldCount - 1; ++i )
+ {
+ if ( sUserPath.Len() > 0 )
+ sUserPath += MULTIPATH_DELIMITER;
+ sUserPath += sTemp.GetToken( i, MULTIPATH_DELIMITER );
+ }
+ sWritablePath = sTemp.GetToken( nOldCount - 1, MULTIPATH_DELIMITER );
+
+ pPathBox->SetEntryText( Convert_Impl( sTemp ), pEntry, 1 );
+ pPathImpl->eState = SFX_ITEM_SET;
+ pPathImpl->sUserPath = sUserPath;
+ pPathImpl->sWritablePath = sWritablePath;
+ }
+ pEntry = pPathBox->NextSelected( pEntry );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPathTabPage::ChangeCurrentEntry( const String& _rFolder )
+{
+ SvLBoxEntry* pEntry = pPathBox->GetCurEntry();
+ if ( !pEntry )
+ {
+ DBG_ERRORFILE( "SvxPathTabPage::ChangeCurrentEntry(): no entry" );
+ return;
+ }
+
+ String sInternal, sUser, sWritable;
+ PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pEntry->GetUserData();
+ sal_Bool bReadOnly = sal_False;
+ GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly );
+ sUser = pPathImpl->sUserPath;
+ sWritable = pPathImpl->sWritablePath;
+ USHORT nPos = pPathImpl->nRealId;
+
+ // old path is an URL?
+ INetURLObject aObj( sWritable );
+ FASTBOOL bURL = ( aObj.GetProtocol() != INET_PROT_NOT_VALID );
+ rtl::OUString aPathStr( _rFolder );
+ INetURLObject aNewObj( aPathStr );
+ aNewObj.removeFinalSlash();
+
+ // then the new path also an URL else system path
+ String sNewPathStr = bURL ? aPathStr : aNewObj.getFSysPath( INetURLObject::FSYS_DETECT );
+
+ FASTBOOL bChanged =
+#ifdef UNX
+// Unix is case sensitive
+ ( sNewPathStr != sWritable );
+#else
+ ( sNewPathStr.CompareIgnoreCaseToAscii( sWritable ) != COMPARE_EQUAL );
+#endif
+
+ if ( bChanged )
+ {
+ pPathBox->SetEntryText( Convert_Impl( sNewPathStr ), pEntry, 1 );
+ nPos = (USHORT)pPathBox->GetModel()->GetAbsPos( pEntry );
+ pPathImpl = (PathUserData_Impl*)pPathBox->GetEntry(nPos)->GetUserData();
+ pPathImpl->eState = SFX_ITEM_SET;
+ pPathImpl->sWritablePath = sNewPathStr;
+ if ( SvtPathOptions::PATH_WORK == pPathImpl->nRealId )
+ {
+ // Remove view options entry so the new work path
+ // will be used for the next open dialog.
+ SvtViewOptions aDlgOpt( E_DIALOG, IODLG_CONFIGNAME );
+ aDlgOpt.Delete();
+ // Reset also last used dir in the sfx application instance
+ SfxApplication *pSfxApp = SFX_APP();
+ pSfxApp->ResetLastDir();
+
+ // Set configuration flag to notify file picker that it's necessary
+ // to take over the path provided.
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ ::comphelper::ConfigurationHelper::writeDirectKey(xFactory,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/")),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Path/Info")),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged")),
+ ::com::sun::star::uno::makeAny(true),
+ ::comphelper::ConfigurationHelper::E_STANDARD);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPathTabPage, PathHdl_Impl, PushButton *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = pPathBox->GetCurEntry();
+ USHORT nPos = ( pEntry != NULL ) ? ( (PathUserData_Impl*)pEntry->GetUserData() )->nRealId : 0;
+ String sInternal, sUser, sWritable;
+ if ( pEntry )
+ {
+ PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pEntry->GetUserData();
+ sal_Bool bReadOnly = sal_False;
+ GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly );
+ sUser = pPathImpl->sUserPath;
+ sWritable = pPathImpl->sWritablePath;
+ }
+
+ if(pEntry && !(!((OptHeaderTabListBox*)pPathBox)->GetCollapsedEntryBmp(pEntry)))
+ return 0;
+
+ if ( IsMultiPath_Impl( nPos ) )
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ AbstractSvxMultiPathDialog* pMultiDlg =
+ pFact->CreateSvxMultiPathDialog( this, RID_SVXDLG_MULTIPATH );
+ DBG_ASSERT( pMultiDlg, "Dialogdiet fail!" );
+ pMultiDlg->EnableRadioButtonMode();
+
+ String sPath( sUser );
+ if ( sPath.Len() > 0 )
+ sPath += MULTIPATH_DELIMITER;
+ sPath += sWritable;
+ pMultiDlg->SetPath( sPath );
+
+ String sPathName = pPathBox->GetEntryText( pEntry, 0 );
+ String sNewTitle( pImpl->m_sMultiPathDlg );
+ sNewTitle.SearchAndReplace( VAR_ONE, sPathName );
+ pMultiDlg->SetTitle( sNewTitle );
+
+ if ( pMultiDlg->Execute() == RET_OK && pEntry )
+ {
+ sUser.Erase();
+ sWritable.Erase();
+ String sFullPath;
+ String sNewPath = pMultiDlg->GetPath();
+ char cDelim = MULTIPATH_DELIMITER;
+ USHORT nCount = sNewPath.GetTokenCount( cDelim );
+ if ( nCount > 0 )
+ {
+ USHORT i = 0;
+ for ( ; i < nCount - 1; ++i )
+ {
+ if ( sUser.Len() > 0 )
+ sUser += cDelim;
+ sUser += sNewPath.GetToken( i, cDelim );
+ }
+ if ( sFullPath.Len() > 0 )
+ sFullPath += cDelim;
+ sFullPath += sUser;
+ sWritable += sNewPath.GetToken( i, cDelim );
+ if ( sFullPath.Len() > 0 )
+ sFullPath += cDelim;
+ sFullPath += sWritable;
+ }
+
+ pPathBox->SetEntryText( Convert_Impl( sFullPath ), pEntry, 1 );
+ // save modified flag
+ PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pEntry->GetUserData();
+ pPathImpl->eState = SFX_ITEM_SET;
+ pPathImpl->sUserPath = sUser;
+ pPathImpl->sWritablePath = sWritable;
+ }
+ delete pMultiDlg;
+ }
+ }
+ else if ( pEntry )
+ {
+ try
+ {
+ rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) );
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ xFolderPicker = ::com::sun::star::uno::Reference< XFolderPicker >(
+ xFactory->createInstance( aService ), UNO_QUERY );
+
+// svt::SetDialogHelpId( xFolderPicker, HID_OPTIONS_PATHS_SELECTFOLDER );
+
+ INetURLObject aURL( sWritable, INET_PROT_FILE );
+ xFolderPicker->setDisplayDirectory( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
+ if ( xAsyncDlg.is() )
+ xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ else
+ {
+ short nRet = xFolderPicker->execute();
+ if ( ExecutableDialogResults::OK != nRet )
+ return 0;
+
+ String sFolder( xFolderPicker->getDirectory() );
+ ChangeCurrentEntry( sFolder );
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERRORFILE( "SvxPathTabPage::PathHdl_Impl: exception from folder picker" );
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPathTabPage, HeaderSelect_Impl, HeaderBar*, pBar )
+{
+ if ( pBar && pBar->GetCurItemId() != ITEMID_TYPE )
+ return 0;
+
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
+ BOOL bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
+ SvSortMode eMode = SortAscending;
+
+ if ( bUp )
+ {
+ nBits &= ~HIB_UPARROW;
+ nBits |= HIB_DOWNARROW;
+ eMode = SortDescending;
+ }
+ else
+ {
+ nBits &= ~HIB_DOWNARROW;
+ nBits |= HIB_UPARROW;
+ }
+ pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
+ SvTreeList* pModel = pPathBox->GetModel();
+ pModel->SetSortMode( eMode );
+ pModel->Resort();
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPathTabPage, HeaderEndDrag_Impl, HeaderBar*, pBar )
+{
+ if ( pBar && !pBar->GetCurItemId() )
+ return 0;
+
+ if ( !pHeaderBar->IsItemMode() )
+ {
+ Size aSz;
+ USHORT nTabs = pHeaderBar->GetItemCount();
+ long nTmpSz = 0;
+ long nWidth = pHeaderBar->GetItemSize(ITEMID_TYPE);
+ long nBarWidth = pHeaderBar->GetSizePixel().Width();
+
+ if(nWidth < TAB_WIDTH_MIN)
+ pHeaderBar->SetItemSize( ITEMID_TYPE, TAB_WIDTH_MIN);
+ else if ( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN )
+ pHeaderBar->SetItemSize( ITEMID_TYPE, nBarWidth - TAB_WIDTH_MIN );
+
+ for ( USHORT i = 1; i <= nTabs; ++i )
+ {
+ long _nWidth = pHeaderBar->GetItemSize(i);
+ aSz.Width() = _nWidth + nTmpSz;
+ nTmpSz += _nWidth;
+ pPathBox->SetTab( i, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
+ }
+ }
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPathTabPage, DialogClosedHdl, DialogClosedEvent*, pEvt )
+{
+ if ( RET_OK == pEvt->DialogResult )
+ {
+ DBG_ASSERT( xFolderPicker.is() == sal_True, "SvxPathTabPage::DialogClosedHdl(): no folder picker" );
+
+ String sURL = String( xFolderPicker->getDirectory() );
+ ChangeCurrentEntry( sURL );
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPathTabPage::GetPathList(
+ USHORT _nPathHandle, String& _rInternalPath,
+ String& _rUserPath, String& _rWritablePath, sal_Bool& _rReadOnly )
+{
+ String sCfgName = getCfgName_Impl( _nPathHandle );
+
+ // load PathSettings service if necessary
+ if ( !pImpl->m_xPathSettings.is() )
+ {
+ Reference< XMultiServiceFactory > xSMgr = comphelper::getProcessServiceFactory();
+ pImpl->m_xPathSettings = Reference< XPropertySet >( xSMgr->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.util.PathSettings") ) ), UNO_QUERY );
+ }
+
+ try
+ {
+ if ( pImpl->m_xPathSettings.is() )
+ {
+ // load internal paths
+ String sProp( sCfgName );
+ sProp = sCfgName;
+ sProp += POSTFIX_INTERNAL;
+ Any aAny = pImpl->m_xPathSettings->getPropertyValue( sProp );
+ Sequence< ::rtl::OUString > aPathSeq;
+ if ( aAny >>= aPathSeq )
+ {
+ long i, nCount = aPathSeq.getLength();
+ const ::rtl::OUString* pPaths = aPathSeq.getConstArray();
+
+ for ( i = 0; i < nCount; ++i )
+ {
+ if ( _rInternalPath.Len() > 0 )
+ _rInternalPath += ';';
+ _rInternalPath += String( pPaths[i] );
+ }
+ }
+ // load user paths
+ sProp = sCfgName;
+ sProp += POSTFIX_USER;
+ aAny = pImpl->m_xPathSettings->getPropertyValue( sProp );
+ if ( aAny >>= aPathSeq )
+ {
+ long i, nCount = aPathSeq.getLength();
+ const ::rtl::OUString* pPaths = aPathSeq.getConstArray();
+
+ for ( i = 0; i < nCount; ++i )
+ {
+ if ( _rUserPath.Len() > 0 )
+ _rUserPath += ';';
+ _rUserPath += String( pPaths[i] );
+ }
+ }
+ // then the writable path
+ sProp = sCfgName;
+ sProp += POSTFIX_WRITABLE;
+ aAny = pImpl->m_xPathSettings->getPropertyValue( sProp );
+ ::rtl::OUString sWritablePath;
+ if ( aAny >>= sWritablePath )
+ _rWritablePath = String( sWritablePath );
+
+ // and the readonly flag
+ sProp = sCfgName;
+ Reference< XPropertySetInfo > xInfo = pImpl->m_xPathSettings->getPropertySetInfo();
+ Property aProp = xInfo->getPropertyByName( sProp );
+ _rReadOnly = ( ( aProp.Attributes & PropertyAttribute::READONLY ) == PropertyAttribute::READONLY );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "SvxPathTabPage::GetPathList(): caught an exception!" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPathTabPage::SetPathList(
+ USHORT _nPathHandle, const String& _rUserPath, const String& _rWritablePath )
+{
+ String sCfgName = getCfgName_Impl( _nPathHandle );
+
+ // load PathSettings service if necessary
+ if ( !pImpl->m_xPathSettings.is() )
+ {
+ Reference< XMultiServiceFactory > xSMgr = comphelper::getProcessServiceFactory();
+ pImpl->m_xPathSettings = Reference< XPropertySet >( xSMgr->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.util.PathSettings") ) ), UNO_QUERY );
+ }
+
+ try
+ {
+ if ( pImpl->m_xPathSettings.is() )
+ {
+ // save user paths
+ char cDelim = MULTIPATH_DELIMITER;
+ USHORT nCount = _rUserPath.GetTokenCount( cDelim );
+ Sequence< ::rtl::OUString > aPathSeq( nCount );
+ ::rtl::OUString* pArray = aPathSeq.getArray();
+ for ( USHORT i = 0; i < nCount; ++i )
+ pArray[i] = ::rtl::OUString( _rUserPath.GetToken( i, cDelim ) );
+ String sProp( sCfgName );
+ sProp += POSTFIX_USER;
+ Any aValue = makeAny( aPathSeq );
+ pImpl->m_xPathSettings->setPropertyValue( sProp, aValue );
+
+ // then the writable path
+ aValue = makeAny( ::rtl::OUString( _rWritablePath ) );
+ sProp = sCfgName;
+ sProp += POSTFIX_WRITABLE;
+ pImpl->m_xPathSettings->setPropertyValue( sProp, aValue );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "SvxPathTabPage::SetPathList(): caught an exception!" );
+ }
+}
+
diff --git a/cui/source/options/optpath.hrc b/cui/source/options/optpath.hrc
new file mode 100644
index 000000000000..0fcef57dcf4c
--- /dev/null
+++ b/cui/source/options/optpath.hrc
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * 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: optpath.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTPATH_HRC
+#define _SVX_OPTPATH_HRC
+
+// defines ---------------------------------------------------------------
+
+#define FT_TYPE 10
+#define FT_PATH 11
+#define LB_PATH 12
+#define BTN_PATH 13
+#define BTN_STANDARD 14
+#define GB_STD 15
+#define IMG_LOCK 16
+#define IMG_LOCK_HC 17
+#define STR_MULTIPATHDLG 18
+
+#endif
+
diff --git a/cui/source/options/optpath.src b/cui/source/options/optpath.src
new file mode 100644
index 000000000000..65280895a506
--- /dev/null
+++ b/cui/source/options/optpath.src
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * 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: optpath.src,v $
+ * $Revision: 1.35 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "optpath.hrc"
+#include <svx/dialogs.hrc>
+#ifndef _SFX_HRC
+#include <sfx2/sfx.hrc>
+#endif
+#include "helpid.hrc"
+
+ // RID_SFXPAGE_PATH -----------------------------------------------------
+#define STD_MASKCOLOR Color { Red=0xffff; Green=0x0000; Blue=0xffff; }
+TabPage RID_SFXPAGE_PATH
+{
+ HelpId = HID_OPTIONS_PATH ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Paths" ;
+ FixedText FT_TYPE
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Type" ;
+ };
+ FixedText FT_PATH
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 110 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Path" ;
+ };
+ Control LB_PATH
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 236 , 147 ) ;
+ Border = TRUE ;
+ TabStop = TRUE;
+ };
+ PushButton BTN_PATH
+ {
+ Pos = MAP_APPFONT ( 183 , 165 ) ;
+ Size = MAP_APPFONT ( 65 , 14 ) ;
+ Text [ en-US ] = "~Edit..." ;
+ };
+ PushButton BTN_STANDARD
+ {
+ Pos = MAP_APPFONT ( 115 , 165 ) ;
+ Size = MAP_APPFONT ( 65 , 14 ) ;
+ Text [ en-US ] = "~Default" ;
+ };
+ FixedLine GB_STD
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Paths used by %PRODUCTNAME" ;
+ };
+ Image IMG_LOCK
+ {
+ ImageBitmap = Bitmap { File = "lock.bmp"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ Image IMG_LOCK_HC
+ {
+ ImageBitmap = Bitmap { File = "lock_hc.bmp"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ String STR_MULTIPATHDLG
+ {
+ Text [ en-US ] = "Edit Paths: %1" ;
+ };
+};
+ErrorBox RID_SVXERR_OPT_DOUBLEPATHS
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "The configuration and mail directories must be specified as separate directories.\nPlease choose a new path." ;
+};
+ // ******************************************************************* EOF
+String RID_SVXSTR_KEY_CONFIG_DIR
+{
+ Text [ en-US ] = "Configuration" ;
+};
+String RID_SVXSTR_KEY_WORK_PATH
+{
+ Text [ en-US ] = "My Documents" ;
+};
+String RID_SVXSTR_KEY_GRAPHICS_PATH
+{
+ Text [ en-US ] = "Graphics" ;
+};
+String RID_SVXSTR_KEY_BITMAP_PATH
+{
+ Text [ en-US ] = "Icons" ;
+};
+String RID_SVXSTR_KEY_BASIC_PATH
+{
+ Text = "BASIC" ;
+};
+
+String RID_SVXSTR_KEY_PALETTE_PATH
+{
+ Text [ en-US ] = "Palettes" ;
+};
+String RID_SVXSTR_KEY_BACKUP_PATH
+{
+ Text [ en-US ] = "Backups" ;
+};
+String RID_SVXSTR_KEY_MODULES_PATH
+{
+ Text [ en-US ] = "Modules" ;
+};
+String RID_SVXSTR_KEY_TEMPLATE_PATH
+{
+ Text [ en-US ] = "Templates" ;
+};
+String RID_SVXSTR_KEY_GLOSSARY_PATH
+{
+ Text [ en-US ] = "AutoText";
+};
+String RID_SVXSTR_KEY_DICTIONARY_PATH
+{
+ Text [ en-US ] = "Dictionaries" ;
+};
+String RID_SVXSTR_KEY_HELP_DIR
+{
+ Text [ en-US ] = "Help" ;
+};
+String RID_SVXSTR_KEY_GALLERY_DIR
+{
+ Text [ en-US ] = "Gallery" ;
+};
+
+String RID_SVXSTR_KEY_STORAGE_DIR
+{
+ Text [ en-US ] = "Message Storage" ;
+};
+String RID_SVXSTR_KEY_TEMP_PATH
+{
+ Text [ en-US ] = "Temporary files";
+};
+String RID_SVXSTR_KEY_PLUGINS_PATH
+{
+ Text [ en-US ] = "Plug-ins";
+};
+String RID_SVXSTR_KEY_FAVORITES_DIR
+{
+ Text [ en-US ] = "Folder Bookmarks";
+};
+String RID_SVXSTR_KEY_FILTER_PATH
+{
+ Text [ en-US ] = "Filters";
+};
+String RID_SVXSTR_KEY_ADDINS_PATH
+{
+ Text [ en-US ] = "Add-ins";
+};
+String RID_SVXSTR_KEY_USERCONFIG_PATH
+{
+ Text [ en-US ] = "User Configuration";
+};
+String RID_SVXSTR_KEY_USERDICTIONARY_DIR
+{
+ Text [ en-US ] = "User-defined dictionaries";
+};
+String RID_SVXSTR_KEY_AUTOCORRECT_DIR
+{
+ Text [ en-US ] = "AutoCorrect";
+};
+String RID_SVXSTR_KEY_LINGUISTIC_DIR
+{
+ Text [ en-US ] = "Writing aids";
+};
+
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
new file mode 100644
index 000000000000..a486efdc224d
--- /dev/null
+++ b/cui/source/options/optsave.cxx
@@ -0,0 +1,822 @@
+/*************************************************************************
+ *
+ * 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: optsave.cxx,v $
+ * $Revision: 1.21 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#define _SVX_OPTSAVE_CXX
+
+#include "optsave.hrc"
+#include <svx/dialogs.hrc>
+
+#include "optsave.hxx"
+#include <svx/dialmgr.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequenceasvector.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <unotools/saveopt.hxx>
+#include <comphelper/sequenceasvector.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <com/sun/star/container/XContainerQuery.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XContainerQuery.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/util/XFlushable.hpp>
+#include <sfx2/docfilt.hxx>
+#include <svtools/stdctrl.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/configitem.hxx>
+#include <unotools/optionsdlg.hxx>
+
+#include <vcl/msgbox.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace comphelper;
+using rtl::OUString;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+#define C2S(cChar) String( RTL_CONSTASCII_STRINGPARAM(cChar) )
+#define CFG_PAGE_AND_GROUP C2S("General"), C2S("LoadSave")
+// !! you have to update these index, if you changed the list of the child windows !!
+#define WININDEX_AUTOSAVE ((USHORT)6)
+#define WININDEX_SAVEURL_RELFSYS ((USHORT)9)
+
+// -------------------- --------------------------------------------------
+class FilterWarningDialog_Impl : public ModalDialog
+{
+ OKButton aOk;
+ CancelButton aCancel;
+ FixedImage aImage;
+ FixedInfo aFilterWarningFT;
+
+ public:
+ FilterWarningDialog_Impl(Window* pParent);
+
+ void SetFilterName(const String& rFilterUIName);
+};
+// ----------------------------------------------------------------------
+FilterWarningDialog_Impl::FilterWarningDialog_Impl(Window* pParent) :
+ ModalDialog(pParent, SVX_RES( RID_SVXDLG_FILTER_WARNING ) ),
+ aOk( this, SVX_RES(PB_OK )),
+ aCancel( this, SVX_RES(PB_CANCEL )),
+ aImage( this, SVX_RES(IMG_WARNING )),
+ aFilterWarningFT( this, SVX_RES(FT_FILTER_WARNING ))
+{
+ FreeResource();
+ aImage.SetImage(WarningBox::GetStandardImage());
+}
+// ----------------------------------------------------------------------
+void FilterWarningDialog_Impl::SetFilterName(const String& rFilterUIName)
+{
+ String sTmp(aFilterWarningFT.GetText());
+ sTmp.SearchAndReplaceAscii("%1", rFilterUIName);
+ aFilterWarningFT.SetText(sTmp);
+}
+// ----------------------------------------------------------------------
+#ifdef FILTER_WARNING_ENABLED
+class SvxAlienFilterWarningConfig_Impl : public utl::ConfigItem
+{
+ sal_Bool bWarning;
+ com::sun::star::uno::Sequence< OUString > aPropNames;
+
+ public:
+ SvxAlienFilterWarningConfig_Impl();
+ ~SvxAlienFilterWarningConfig_Impl();
+
+ virtual void Commit();
+
+ void ResetWarning()
+ {
+ if(bWarning)
+ {
+ bWarning = sal_False;
+ ConfigItem::SetModified();
+ }
+
+ }
+ sal_Bool IsWarning()const{return bWarning;}
+};
+// ----------------------------------------------------------------------
+SvxAlienFilterWarningConfig_Impl::SvxAlienFilterWarningConfig_Impl() :
+ ConfigItem(C2U("TypeDetection.Misc/Defaults"),
+ CONFIG_MODE_IMMEDIATE_UPDATE),
+ aPropNames(1),
+ bWarning(sal_True)
+{
+ aPropNames.getArray()[0] = C2U("ShowAlienFilterWarning");
+ Sequence<Any> aValues = GetProperties(aPropNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aPropNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aPropNames.getLength() &&
+ pValues[0].hasValue() &&
+ pValues[0].getValueType() == ::getBooleanCppuType())
+ bWarning = *(sal_Bool*)pValues[0].getValue();
+}
+// ----------------------------------------------------------------------
+SvxAlienFilterWarningConfig_Impl::~SvxAlienFilterWarningConfig_Impl()
+{
+ if(IsModified())
+ Commit();
+}
+// ----------------------------------------------------------------------
+void SvxAlienFilterWarningConfig_Impl::Commit()
+{
+ Sequence<Any> aValues(aPropNames.getLength());
+ Any* pValues = aValues.getArray();
+ pValues[0].setValue(&bWarning, ::getBooleanCppuType());
+ PutProperties(aPropNames, aValues);
+}
+#endif // FILTER_WARNING_ENABLED
+// ----------------------------------------------------------------------
+// ----------------------------------------------------------------------
+
+struct SvxSaveTabPage_Impl
+{
+ Reference< XNameContainer > xFact;
+ Sequence< OUString > aFilterArr[APP_COUNT];
+ Sequence< sal_Bool > aAlienArr[APP_COUNT];
+ Sequence< sal_Bool > aODFArr[APP_COUNT];
+ Sequence< OUString > aUIFilterArr[APP_COUNT];
+ OUString aDefaultArr[APP_COUNT];
+ sal_Bool aDefaultReadonlyArr[APP_COUNT];
+ sal_Bool bInitialized;
+
+ SvxSaveTabPage_Impl();
+ ~SvxSaveTabPage_Impl();
+};
+
+SvxSaveTabPage_Impl::SvxSaveTabPage_Impl() : bInitialized( sal_False )
+{
+}
+
+SvxSaveTabPage_Impl::~SvxSaveTabPage_Impl()
+{
+}
+
+// class SvxSaveTabPage --------------------------------------------------
+
+SfxSaveTabPage::SfxSaveTabPage( Window* pParent, const SfxItemSet& rCoreSet ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SFXPAGE_SAVE ), rCoreSet ),
+
+ aLoadFL ( this, SVX_RES( LB_LOAD ) ),
+ aLoadUserSettingsCB ( this, SVX_RES( CB_LOAD_SETTINGS ) ),
+ aLoadDocPrinterCB ( this, SVX_RES( CB_LOAD_DOCPRINTER ) ),
+
+ aSaveFL ( this, SVX_RES( GB_SAVE ) ),
+ aDocInfoCB ( this, SVX_RES( BTN_DOCINFO ) ),
+ aBackupFI ( this, SVX_RES( FI_BACKUP ) ),
+ aBackupCB ( this, SVX_RES( BTN_BACKUP ) ),
+ aAutoSaveCB ( this, SVX_RES( BTN_AUTOSAVE ) ),
+ aAutoSaveEdit ( this, SVX_RES( ED_AUTOSAVE ) ),
+ aMinuteFT ( this, SVX_RES( FT_MINUTE ) ),
+ aRelativeFsysCB ( this, SVX_RES( BTN_RELATIVE_FSYS ) ),
+ aRelativeInetCB ( this, SVX_RES( BTN_RELATIVE_INET ) ),
+
+ aDefaultFormatFL ( this, SVX_RES( FL_FILTER ) ),
+ aODFVersionFT ( this, SVX_RES( FT_ODF_VERSION ) ),
+ aODFVersionLB ( this, SVX_RES( LB_ODF_VERSION ) ),
+ aSizeOptimizationCB ( this, SVX_RES( BTN_NOPRETTYPRINTING ) ),
+ aWarnAlienFormatCB ( this, SVX_RES( BTN_WARNALIENFORMAT ) ),
+ aDocTypeFT ( this, SVX_RES( FT_APP ) ),
+ aDocTypeLB ( this, SVX_RES( LB_APP ) ),
+ aSaveAsFT ( this, SVX_RES( FT_FILTER ) ),
+ aSaveAsFI ( this, SVX_RES( FI_FILTER ) ),
+ aSaveAsLB ( this, SVX_RES( LB_FILTER ) ),
+ aODFWarningFI ( this, SVX_RES( FI_ODF_WARNING ) ),
+ aODFWarningFT ( this, SVX_RES( FT_WARN ) ),
+
+ pImpl ( new SvxSaveTabPage_Impl )
+
+{
+ sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark();
+ aODFWarningFI.SetImage(
+ Image( SVX_RES( bHighContrast ? IMG_ODF_WARNING_HC : IMG_ODF_WARNING ) ) );
+
+ FreeResource();
+
+ Link aLink = LINK( this, SfxSaveTabPage, AutoClickHdl_Impl );
+ aAutoSaveCB.SetClickHdl( aLink );
+ aAutoSaveEdit.SetMaxTextLen( 2 );
+
+ SvtModuleOptions aModuleOpt;
+ if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) )
+ {
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_MATH ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_MATH ));
+ }
+ else
+ {
+ pImpl->aDefaultArr[APP_MATH] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_MATH);
+ pImpl->aDefaultReadonlyArr[APP_MATH] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_MATH);
+ }
+
+ if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) )
+ {
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_DRAW ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_DRAW ));
+ }
+ else
+ {
+ pImpl->aDefaultArr[APP_DRAW] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_DRAW);
+ pImpl->aDefaultReadonlyArr[APP_DRAW] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_DRAW);
+ }
+
+ if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
+ {
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_IMPRESS ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_IMPRESS ));
+ }
+ else
+ {
+ pImpl->aDefaultArr[APP_IMPRESS] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS);
+ pImpl->aDefaultReadonlyArr[APP_IMPRESS] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_IMPRESS);
+ }
+
+ if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
+ {
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_CALC ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_CALC ));
+ }
+ else
+ {
+ pImpl->aDefaultArr[APP_CALC] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_CALC);
+ pImpl->aDefaultReadonlyArr[APP_CALC] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_CALC);
+ }
+
+ if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
+ {
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_WRITER ));
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_WRITER_WEB ));
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_WRITER_GLOBAL ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_WRITER ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_WRITER_WEB ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_WRITER_GLOBAL ));
+ }
+ else
+ {
+ pImpl->aDefaultArr[APP_WRITER] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITER);
+ pImpl->aDefaultArr[APP_WRITER_WEB] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB);
+ pImpl->aDefaultArr[APP_WRITER_GLOBAL] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL);
+ pImpl->aDefaultReadonlyArr[APP_WRITER] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITER);
+ pImpl->aDefaultReadonlyArr[APP_WRITER_WEB] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITERWEB);
+ pImpl->aDefaultReadonlyArr[APP_WRITER_GLOBAL] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITERGLOBAL);
+ }
+
+ aLink = LINK( this, SfxSaveTabPage, ODFVersionHdl_Impl );
+ aODFVersionLB.SetSelectHdl( aLink );
+ aLink = LINK( this, SfxSaveTabPage, FilterHdl_Impl );
+ aDocTypeLB.SetSelectHdl( aLink );
+ aSaveAsLB.SetSelectHdl( aLink );
+
+ DetectHiddenControls();
+}
+
+// -----------------------------------------------------------------------
+
+SfxSaveTabPage::~SfxSaveTabPage()
+{
+ delete pImpl;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SfxSaveTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SfxSaveTabPage( pParent, rAttrSet ) );
+}
+
+/* -----------------------------05.04.01 13:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString lcl_ExtractUIName(const Sequence<PropertyValue> rProperties)
+{
+ OUString sRet;
+ const PropertyValue* pProperties = rProperties.getConstArray();
+ for(int nProp = 0; nProp < rProperties.getLength(); nProp++)
+ {
+ if(!pProperties[nProp].Name.compareToAscii("UIName"))
+ {
+ pProperties[nProp].Value >>= sRet;
+ break;
+ }
+ }
+ return sRet;
+}
+// -----------------------------------------------------------------------
+bool SfxSaveTabPage::AcceptFilter( USHORT nPos )
+{
+ const OUString* pFilters = pImpl->aFilterArr[nPos].getConstArray();
+ sal_Bool bAlien = sal_False, bODF = sal_False;
+ OUString* pUIFilters = pImpl->aUIFilterArr[nPos].getArray();
+ OUString sUIName;
+ for(int nFilter = 0; nFilter < pImpl->aFilterArr[nPos].getLength(); nFilter++)
+ {
+ if( pImpl->aDefaultArr[nPos] == pFilters[nFilter] )
+ {
+ bAlien = pImpl->aAlienArr[nPos][nFilter];
+ bODF = pImpl->aODFArr[nPos][nFilter];
+ sUIName = pUIFilters[nFilter];;
+ break;
+ }
+ }
+ bool bSet = true;
+ return bSet;
+}
+// -----------------------------------------------------------------------
+void SfxSaveTabPage::DetectHiddenControls()
+{
+ long nDelta = 0;
+ // the index of the first child window which perhaps have to move upwards
+ USHORT nWinIndex = WININDEX_SAVEURL_RELFSYS;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+
+ if ( aOptionsDlgOpt.IsOptionHidden( C2S("Backup"), CFG_PAGE_AND_GROUP ) )
+ {
+ // hide controls of "Backup"
+ aBackupFI.Hide();
+ aBackupCB.Hide();
+ // the other controls have to move upwards the height of checkbox + space
+ nDelta = aAutoSaveCB.GetPosPixel().Y() - aBackupCB.GetPosPixel().Y();
+ }
+
+ if ( aOptionsDlgOpt.IsOptionHidden( C2S("AutoSave"), CFG_PAGE_AND_GROUP ) )
+ {
+ // hide controls of "AutoSave"
+ aAutoSaveCB.Hide();
+ aAutoSaveEdit.Hide();
+ aMinuteFT.Hide();
+ // the other controls have to move upwards the height of checkbox + space
+ nDelta += aRelativeFsysCB.GetPosPixel().Y() - aAutoSaveCB.GetPosPixel().Y();
+ }
+ else if ( nDelta > 0 )
+ // the "AutoSave" controls have to move upwards too
+ nWinIndex = WININDEX_AUTOSAVE;
+
+ if ( nDelta > 0 )
+ {
+ USHORT i, nChildCount = GetChildCount();
+ for ( i = nWinIndex; i < nChildCount; ++i )
+ {
+ Window* pWin = GetChild(i);
+ Point aPos = pWin->GetPosPixel();
+ aPos.Y() -= nDelta;
+ pWin->SetPosPixel( aPos );
+ }
+ }
+}
+// -----------------------------------------------------------------------
+BOOL SfxSaveTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ BOOL bModified = FALSE;
+ SvtSaveOptions aSaveOpt;
+ if(aLoadUserSettingsCB.IsChecked() != aLoadUserSettingsCB.GetSavedValue())
+ {
+ aSaveOpt.SetLoadUserSettings(aLoadUserSettingsCB.IsChecked());
+ }
+
+ if ( aLoadDocPrinterCB.IsChecked() != aLoadDocPrinterCB.GetSavedValue() )
+ aSaveOpt.SetLoadDocumentPrinter( aLoadDocPrinterCB.IsChecked() );
+
+ if ( aODFVersionLB.GetSelectEntryPos() != aODFVersionLB.GetSavedValue() )
+ {
+ long nVersion = long( aODFVersionLB.GetEntryData( aODFVersionLB.GetSelectEntryPos() ) );
+ aSaveOpt.SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion( nVersion ) );
+ }
+
+ if ( aDocInfoCB.IsChecked() != aDocInfoCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_DOCINFO ),
+ aDocInfoCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+
+ if ( aBackupCB.IsEnabled() && aBackupCB.IsChecked() != aBackupCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_BACKUP ),
+ aBackupCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+
+ if ( aSizeOptimizationCB.IsChecked() != aSizeOptimizationCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_PRETTYPRINTING ), !aSizeOptimizationCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+
+ if ( aAutoSaveCB.IsChecked() != aAutoSaveCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_AUTOSAVE ),
+ aAutoSaveCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+ if ( aWarnAlienFormatCB.IsChecked() != aWarnAlienFormatCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_WARNALIENFORMAT ),
+ aWarnAlienFormatCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+
+ if ( aAutoSaveEdit.GetText() != aAutoSaveEdit.GetSavedValue() )
+ {
+ rSet.Put( SfxUInt16Item( GetWhich( SID_ATTR_AUTOSAVEMINUTE ),
+ (UINT16)aAutoSaveEdit.GetValue() ) );
+ bModified |= TRUE;
+ }
+ // relativ speichern
+ if ( aRelativeFsysCB.IsChecked() != aRelativeFsysCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_SAVEREL_FSYS ),
+ aRelativeFsysCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+
+ if ( aRelativeInetCB.IsChecked() != aRelativeInetCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_SAVEREL_INET ),
+ aRelativeInetCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+
+ SvtModuleOptions aModuleOpt;
+ if(pImpl->aDefaultArr[APP_MATH].getLength() &&
+ pImpl->aDefaultArr[APP_MATH] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_MATH) &&
+ AcceptFilter( APP_MATH ))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_MATH, pImpl->aDefaultArr[APP_MATH]);
+
+ if( pImpl->aDefaultArr[APP_DRAW].getLength() &&
+ pImpl->aDefaultArr[APP_DRAW] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_DRAW) &&
+ AcceptFilter( APP_DRAW ))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_DRAW, pImpl->aDefaultArr[APP_DRAW]);
+
+ if(pImpl->aDefaultArr[APP_IMPRESS].getLength() &&
+ pImpl->aDefaultArr[APP_IMPRESS] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS)&&
+ AcceptFilter( APP_IMPRESS ))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS, pImpl->aDefaultArr[APP_IMPRESS]);
+
+ if(pImpl->aDefaultArr[APP_CALC].getLength() &&
+ pImpl->aDefaultArr[APP_CALC] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_CALC)&&
+ AcceptFilter( APP_CALC ))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_CALC, pImpl->aDefaultArr[APP_CALC]);
+
+ if(pImpl->aDefaultArr[APP_WRITER].getLength() &&
+ pImpl->aDefaultArr[APP_WRITER] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITER)&&
+ AcceptFilter( APP_WRITER))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITER, pImpl->aDefaultArr[APP_WRITER]);
+
+ if(pImpl->aDefaultArr[APP_WRITER_WEB].getLength() &&
+ pImpl->aDefaultArr[APP_WRITER_WEB] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB)&&
+ AcceptFilter( APP_WRITER_WEB ))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB, pImpl->aDefaultArr[APP_WRITER_WEB]);
+
+ if(pImpl->aDefaultArr[APP_WRITER_GLOBAL].getLength() &&
+ pImpl->aDefaultArr[APP_WRITER_GLOBAL] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL)&&
+ AcceptFilter( APP_WRITER_GLOBAL ))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL, pImpl->aDefaultArr[APP_WRITER_GLOBAL]);
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool isODFFormat( OUString sFilter )
+{
+ static const char* aODFFormats[] =
+ {
+ "writer8",
+ "writer8_template",
+ "writerglobal8",
+ "writerglobal8_writer",
+ "calc8",
+ "calc8_template",
+ "draw8",
+ "draw8_template",
+ "impress8",
+ "impress8_template",
+ "impress8_draw",
+ "chart8",
+ "math8",
+ NULL
+ };
+
+ sal_Bool bRet = sal_False;
+ int i = 0;
+ while ( aODFFormats[i] != NULL )
+ {
+ if ( sFilter.equalsAscii( aODFFormats[i++] ) )
+ {
+ bRet = sal_True;
+ break;
+ }
+ }
+
+ return bRet;
+}
+
+void SfxSaveTabPage::Reset( const SfxItemSet& )
+{
+ SvtSaveOptions aSaveOpt;
+ aLoadUserSettingsCB.Check(aSaveOpt.IsLoadUserSettings());
+ aLoadUserSettingsCB.SaveValue();
+ aLoadDocPrinterCB.Check( aSaveOpt.IsLoadDocumentPrinter() );
+ aLoadDocPrinterCB.SaveValue();
+
+ if ( !pImpl->bInitialized )
+ {
+ try
+ {
+ Reference< XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory();
+ pImpl->xFact = Reference<XNameContainer>(
+ xMSF->createInstance(C2U("com.sun.star.document.FilterFactory")), UNO_QUERY);
+
+ DBG_ASSERT(pImpl->xFact.is(), "service com.sun.star.document.FilterFactory unavailable");
+ Reference< XContainerQuery > xQuery(pImpl->xFact, UNO_QUERY);
+ if(xQuery.is())
+ {
+ for(USHORT n = 0; n < aDocTypeLB.GetEntryCount(); n++)
+ {
+ long nData = (long) aDocTypeLB.GetEntryData(n);
+ OUString sCommand;
+ sCommand = C2U("matchByDocumentService=%1:iflags=");
+ sCommand += String::CreateFromInt32(SFX_FILTER_IMPORT|SFX_FILTER_EXPORT);
+ sCommand += C2U(":eflags=");
+ sCommand += String::CreateFromInt32(SFX_FILTER_NOTINFILEDLG);
+ sCommand += C2U(":default_first");
+ String sReplace;
+ switch(nData)
+ {
+ case APP_WRITER : sReplace = C2U("com.sun.star.text.TextDocument"); break;
+ case APP_WRITER_WEB : sReplace = C2U("com.sun.star.text.WebDocument"); break;
+ case APP_WRITER_GLOBAL : sReplace = C2U("com.sun.star.text.GlobalDocument"); break;
+ case APP_CALC : sReplace = C2U("com.sun.star.sheet.SpreadsheetDocument");break;
+ case APP_IMPRESS : sReplace = C2U("com.sun.star.presentation.PresentationDocument");break;
+ case APP_DRAW : sReplace = C2U("com.sun.star.drawing.DrawingDocument");break;
+ case APP_MATH : sReplace = C2U("com.sun.star.formula.FormulaProperties");break;
+ default: DBG_ERROR("illegal user data");
+ }
+ String sTmp(sCommand);
+ sTmp.SearchAndReplaceAscii("%1", sReplace);
+ sCommand = sTmp;
+ Reference< XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand);
+ SequenceAsVector< OUString > lList;
+ SequenceAsVector< sal_Bool > lAlienList;
+ SequenceAsVector< sal_Bool > lODFList;
+ while(xList->hasMoreElements())
+ {
+ SequenceAsHashMap aFilter(xList->nextElement());
+ OUString sFilter = aFilter.getUnpackedValueOrDefault(OUString::createFromAscii("Name"),OUString());
+ if (sFilter.getLength())
+ {
+ sal_Int32 nFlags = aFilter.getUnpackedValueOrDefault(OUString::createFromAscii("Flags"),sal_Int32());
+ lList.push_back(sFilter);
+ lAlienList.push_back(0 != (nFlags & SFX_FILTER_ALIEN));
+ lODFList.push_back( isODFFormat( sFilter ) );
+ }
+ }
+ pImpl->aFilterArr[nData] = lList.getAsConstList();
+ pImpl->aAlienArr[nData] = lAlienList.getAsConstList();
+ pImpl->aODFArr[nData] = lODFList.getAsConstList();
+ }
+ }
+ aDocTypeLB.SelectEntryPos(0);
+ FilterHdl_Impl(&aDocTypeLB);
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("exception in FilterFactory access");
+ }
+
+ pImpl->bInitialized = sal_True;
+ }
+
+ aDocInfoCB.Check(aSaveOpt.IsDocInfoSave());
+// aDocInfoCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_DOCINFSAVE));
+
+ aBackupCB.Check(aSaveOpt.IsBackup());
+ BOOL bBackupRO = aSaveOpt.IsReadOnly(SvtSaveOptions::E_BACKUP);
+ aBackupCB.Enable(!bBackupRO);
+ aBackupFI.Show(bBackupRO);
+
+ aAutoSaveCB.Check(aSaveOpt.IsAutoSave());
+ aWarnAlienFormatCB.Check(aSaveOpt.IsWarnAlienFormat());
+ aWarnAlienFormatCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_WARNALIENFORMAT));
+// aAutoSaveCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_AUTOSAVE));
+
+ // the pretty printing
+ aSizeOptimizationCB.Check( !aSaveOpt.IsPrettyPrinting());
+// aSizeOptimizationCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_DOPRETTYPRINTING ));
+
+
+ aAutoSaveEdit.SetValue( aSaveOpt.GetAutoSaveTime() );
+// aAutoSaveEdit.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_AUTOSAVETIME));
+
+ // relativ speichern
+ aRelativeFsysCB.Check( aSaveOpt.IsSaveRelFSys() );
+// aRelativeFsysCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_SAVERELFSYS));
+
+ aRelativeInetCB.Check( aSaveOpt.IsSaveRelINet() );
+// aRelativeInetCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_SAVERELINET));
+
+ void* pDefaultVersion = (void*)long( aSaveOpt.GetODFDefaultVersion() );
+ aODFVersionLB.SelectEntryPos( aODFVersionLB.GetEntryPos( pDefaultVersion ) );
+
+ AutoClickHdl_Impl( &aAutoSaveCB );
+ ODFVersionHdl_Impl( &aODFVersionLB );
+
+ aDocInfoCB.SaveValue();
+ aBackupCB.SaveValue();
+ aWarnAlienFormatCB.SaveValue();
+ aSizeOptimizationCB.SaveValue();
+ aAutoSaveCB.SaveValue();
+ aAutoSaveEdit.SaveValue();
+// aAutoSavePromptBtn.SaveValue();
+
+ aRelativeFsysCB.SaveValue();
+ aRelativeInetCB.SaveValue();
+ aODFVersionLB.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SfxSaveTabPage, AutoClickHdl_Impl, CheckBox *, pBox )
+{
+ if ( pBox == &aAutoSaveCB )
+ {
+ if ( aAutoSaveCB.IsChecked() )
+ {
+ aAutoSaveEdit.Enable();
+ aMinuteFT.Enable();
+// aAutoSavePromptBtn.Enable();
+ aAutoSaveEdit.GrabFocus();
+ }
+ else
+ {
+ aAutoSaveEdit.Disable();
+ aMinuteFT.Disable();
+// aAutoSavePromptBtn.Disable();
+ }
+ }
+ return 0;
+}
+/* -----------------------------05.04.01 13:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString lcl_ExtracUIName(const Sequence<PropertyValue> rProperties)
+{
+ OUString sRet;
+ sal_Int32 nFlags;
+ const PropertyValue* pProperties = rProperties.getConstArray();
+ for(int nProp = 0; nProp < rProperties.getLength(); nProp++)
+ {
+ if(!pProperties[nProp].Name.compareToAscii("UIName"))
+ {
+ pProperties[nProp].Value >>= sRet;
+//! break;
+ }
+ else if(!pProperties[nProp].Name.compareToAscii("Flags"))
+ {
+ if ( pProperties[nProp].Value >>= nFlags )
+ {
+ nFlags &= 0x100;
+ }
+ }
+ else if(!pProperties[nProp].Name.compareToAscii("Name"))
+ {
+ pProperties[nProp].Value >>= sRet;
+ }
+ }
+ return sRet;
+}
+/* -----------------------------05.04.01 13:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SfxSaveTabPage, FilterHdl_Impl, ListBox *, pBox )
+{
+ USHORT nCurPos = aDocTypeLB.GetSelectEntryPos();
+
+ long nData = -1;
+ if(nCurPos < APP_COUNT)
+ nData = (long) aDocTypeLB.GetEntryData(nCurPos);
+
+ if ( nData >= 0 && nData < APP_COUNT )
+ {
+ if(&aDocTypeLB == pBox)
+ {
+ aSaveAsLB.Clear();
+ const OUString* pFilters = pImpl->aFilterArr[nData].getConstArray();
+ if(!pImpl->aUIFilterArr[nData].getLength())
+ {
+ pImpl->aUIFilterArr[nData].realloc(pImpl->aFilterArr[nData].getLength());
+ OUString* pUIFilters = pImpl->aUIFilterArr[nData].getArray();
+ for(int nFilter = 0; nFilter < pImpl->aFilterArr[nData].getLength(); nFilter++)
+ {
+ Any aProps = pImpl->xFact->getByName(pFilters[nFilter]);
+ Sequence<PropertyValue> aProperties;
+ aProps >>= aProperties;
+ pUIFilters[nFilter] = lcl_ExtracUIName(aProperties);
+ }
+ }
+ const OUString* pUIFilters = pImpl->aUIFilterArr[nData].getConstArray();
+ OUString sSelect;
+ for(int i = 0; i < pImpl->aUIFilterArr[nData].getLength(); i++)
+ {
+ USHORT nEntryPos = aSaveAsLB.InsertEntry(pUIFilters[i]);
+ if ( pImpl->aODFArr[nData][i] )
+ aSaveAsLB.SetEntryData( nEntryPos, (void*)pImpl );
+ if(pFilters[i] == pImpl->aDefaultArr[nData])
+ sSelect = pUIFilters[i];
+ }
+ if(sSelect.getLength())
+ aSaveAsLB.SelectEntry(sSelect);
+ aSaveAsFI.Show(pImpl->aDefaultReadonlyArr[nData]);
+ aSaveAsFT.Enable(!pImpl->aDefaultReadonlyArr[nData]);
+ aSaveAsLB.Enable(!pImpl->aDefaultReadonlyArr[nData]);
+ }
+ else
+ {
+ OUString sSelect = pBox->GetSelectEntry();
+ const OUString* pFilters = pImpl->aFilterArr[nData].getConstArray();
+ OUString* pUIFilters = pImpl->aUIFilterArr[nData].getArray();
+ for(int i = 0; i < pImpl->aUIFilterArr[nData].getLength(); i++)
+ if(pUIFilters[i] == sSelect)
+ {
+ sSelect = pFilters[i];
+ break;
+ }
+
+ pImpl->aDefaultArr[nData] = sSelect;
+ }
+ }
+
+ ODFVersionHdl_Impl( &aSaveAsLB );
+ return 0;
+};
+
+IMPL_LINK( SfxSaveTabPage, ODFVersionHdl_Impl, ListBox *, EMPTYARG )
+{
+ long nVersion = long( aODFVersionLB.GetEntryData( aODFVersionLB.GetSelectEntryPos() ) );
+ bool bShown = SvtSaveOptions::ODFDefaultVersion( nVersion ) != SvtSaveOptions::ODFVER_LATEST;
+ if ( bShown )
+ {
+ bool bHasODFFormat = false;
+ USHORT i = 0, nCount = aSaveAsLB.GetEntryCount();
+ for ( ; i < nCount; ++ i )
+ {
+ if ( aSaveAsLB.GetEntryData(i) != NULL )
+ {
+ bHasODFFormat = true;
+ break;
+ }
+ }
+
+ bShown = !bHasODFFormat
+ || ( aSaveAsLB.GetEntryData( aSaveAsLB.GetSelectEntryPos() ) != NULL );
+ }
+
+ aODFWarningFI.Show( bShown );
+ aODFWarningFT.Show( bShown );
+
+ return 0;
+}
+
diff --git a/cui/source/options/optsave.hrc b/cui/source/options/optsave.hrc
new file mode 100644
index 000000000000..c5b2ab5e765a
--- /dev/null
+++ b/cui/source/options/optsave.hrc
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * 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: optsave.hrc,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTSAVE_HRC
+#define _SVX_OPTSAVE_HRC
+
+// defines ------------------------------------------------------------------
+
+#define LB_LOAD 10
+#define CB_LOAD_SETTINGS 11
+#define CB_LOAD_DOCPRINTER 12
+#define GB_SAVE 13
+#define BTN_DOCINFO 14
+#define BTN_BACKUP 15
+#define BTN_AUTOSAVE 16
+#define ED_AUTOSAVE 17
+#define FT_MINUTE 18
+#define BTN_AUTOSAVEPROMPT 19
+#define BTN_NOPRETTYPRINTING 20
+#define FI_BACKUP 21
+#define BTN_WARNALIENFORMAT 22
+#define FT_ODF_VERSION 23
+#define LB_ODF_VERSION 24
+
+#define GB_RELATIVE 40
+#define BTN_RELATIVE_FSYS 41
+#define BTN_RELATIVE_INET 42
+
+#define FL_FILTER 43
+#define FT_APP 44
+#define LB_APP 45
+#define FT_FILTER 46
+#define LB_FILTER 47
+#define FI_FILTER 48
+#define FT_WARN 49
+#define FI_ODF_WARNING 50
+
+#define IMG_ODF_WARNING 1
+#define IMG_ODF_WARNING_HC 2
+
+#define APP_WRITER 0
+#define APP_WRITER_WEB 1
+#define APP_WRITER_GLOBAL 2
+#define APP_CALC 3
+#define APP_IMPRESS 4
+#define APP_DRAW 5
+#define APP_MATH 6
+#define APP_COUNT 7
+
+//Filter warning
+#define PB_OK 1
+#define FT_FILTER_WARNING 2
+#define CB_DONT_SHOW_AGAIN 3
+#define IMG_WARNING 4
+#define PB_CANCEL 5
+
+#endif // #ifndef _SVX_OPTSAVE_HRC
+
diff --git a/cui/source/options/optsave.hxx b/cui/source/options/optsave.hxx
new file mode 100644
index 000000000000..8c9fcbc75ac8
--- /dev/null
+++ b/cui/source/options/optsave.hxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * 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: optsave.hxx,v $
+ * $Revision: 1.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.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTSAVE_HXX
+#define _SVX_OPTSAVE_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/group.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <readonlyimage.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace beans {
+ struct PropertyValue;
+}}}}
+
+// define ----------------------------------------------------------------
+
+#define SfxSaveTabPage SvxSaveTabPage
+
+// class SvxSaveTabPage --------------------------------------------------
+
+struct SvxSaveTabPage_Impl;
+
+class SvxSaveTabPage : public SfxTabPage
+{
+private:
+ FixedLine aLoadFL;
+ CheckBox aLoadUserSettingsCB;
+ CheckBox aLoadDocPrinterCB;
+
+ FixedLine aSaveFL;
+ CheckBox aDocInfoCB;
+ ReadOnlyImage aBackupFI;
+ CheckBox aBackupCB;
+ CheckBox aAutoSaveCB;
+ NumericField aAutoSaveEdit;
+ FixedText aMinuteFT;
+ CheckBox aRelativeFsysCB;
+ CheckBox aRelativeInetCB;
+
+ FixedLine aDefaultFormatFL;
+ FixedText aODFVersionFT;
+ ListBox aODFVersionLB;
+ CheckBox aSizeOptimizationCB;
+ CheckBox aWarnAlienFormatCB;
+ FixedText aDocTypeFT;
+ ListBox aDocTypeLB;
+ FixedText aSaveAsFT;
+ ReadOnlyImage aSaveAsFI;
+ ListBox aSaveAsLB;
+ FixedImage aODFWarningFI;
+ FixedText aODFWarningFT;
+
+ SvxSaveTabPage_Impl* pImpl;
+
+#ifdef _SVX_OPTSAVE_CXX
+ DECL_LINK( AutoClickHdl_Impl, CheckBox * );
+ DECL_LINK( FilterHdl_Impl, ListBox * );
+ DECL_LINK( ODFVersionHdl_Impl, ListBox * );
+
+ bool AcceptFilter( USHORT nPos );
+ void DetectHiddenControls();
+#endif
+
+public:
+ SvxSaveTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~SvxSaveTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif // #ifndef _SVX_OPTSAVE_HXX
+
diff --git a/cui/source/options/optsave.src b/cui/source/options/optsave.src
new file mode 100644
index 000000000000..374f53ef618f
--- /dev/null
+++ b/cui/source/options/optsave.src
@@ -0,0 +1,325 @@
+/*************************************************************************
+ *
+ * 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: optsave.src,v $
+ * $Revision: 1.82 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <sfx2/sfx.hrc>
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "optsave.hrc"
+
+ // SID_SFXPAGE_SAVE ------------------------------------------------------
+#define TEXT_SAVEPAGE \
+ Text [ en-US ] = "Save" ;\
+
+TabPage RID_SFXPAGE_SAVE
+{
+ HelpId = HID_OPTIONS_SAVE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ TEXT_SAVEPAGE
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine LB_LOAD
+ {
+ Pos = MAP_APPFONT ( 6 , 2 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Load";
+ };
+ CheckBox CB_LOAD_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 12 , 11 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "Load user-specific settings with the document";
+ };
+ CheckBox CB_LOAD_DOCPRINTER
+ {
+ Pos = MAP_APPFONT ( 12 , 22 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "Load printer settings with the document";
+ };
+ FixedLine GB_SAVE
+ {
+ Pos = MAP_APPFONT ( 6 , 32 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Save" ;
+ };
+ CheckBox BTN_DOCINFO
+ {
+ Pos = MAP_APPFONT ( 12 , 41 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "~Edit document properties before saving" ;
+ TabStop = TRUE ;
+ };
+ FixedImage FI_BACKUP
+ {
+ Pos = MAP_APPFONT ( 5, 53 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ CheckBox BTN_BACKUP
+ {
+ Pos = MAP_APPFONT ( 12 , 52 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "Al~ways create backup copy" ;
+ };
+ CheckBox BTN_AUTOSAVE
+ {
+ Pos = MAP_APPFONT ( 12 , 63 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text [ en-US ] = "Save ~AutoRecovery information every" ;
+ };
+ NumericField ED_AUTOSAVE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 180 , 62 ) ;
+ Size = MAP_APPFONT ( 21 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 60 ;
+ StrictFormat = TRUE ;
+ First = 1 ;
+ Last = 60 ;
+ SpinSize = 1 ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_MINUTE
+ {
+ Pos = MAP_APPFONT ( 204 , 63 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "Minutes" ;
+ };
+ CheckBox BTN_RELATIVE_FSYS
+ {
+ Pos = MAP_APPFONT ( 12 , 74 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "Save URLs relative to file system" ;
+ };
+ CheckBox BTN_RELATIVE_INET
+ {
+ Pos = MAP_APPFONT ( 12 , 85 ) ;
+ Size = MAP_APPFONT ( 248 , 10 ) ;
+ Text [ en-US ] = "Save URLs relative to internet" ;
+ };
+ FixedLine FL_FILTER
+ {
+ Pos = MAP_APPFONT ( 6 , 97 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Default file format and ODF settings" ;
+ };
+ FixedText FT_ODF_VERSION
+ {
+ Pos = MAP_APPFONT ( 12 , 107 ) ;
+ Size = MAP_APPFONT ( 121 , 8 ) ;
+ Text [ en-US ] = "ODF format version" ;
+ };
+ ListBox LB_ODF_VERSION
+ {
+ Pos = MAP_APPFONT ( 136 , 105 ) ;
+ Size = MAP_APPFONT ( 108 , 58 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "1.0/1.1" ; 2 ; > ;
+ < "1.2" ; 4 ; > ;
+ < "1.2 Extended (recommended)"; 0x7fffffff ; > ;
+ };
+ };
+ CheckBox BTN_NOPRETTYPRINTING
+ {
+ Pos = MAP_APPFONT ( 12 , 120 ) ;
+ Size = MAP_APPFONT ( 248 , 10 ) ;
+ Text [ en-US ] = "Size optimization for ODF format" ;
+ };
+ CheckBox BTN_WARNALIENFORMAT
+ {
+ Pos = MAP_APPFONT ( 12 , 131 ) ;
+ Size = MAP_APPFONT ( 248 , 10 ) ;
+ Text [ en-US ] = "Warn when not saving in ODF or default format" ;
+ };
+ FixedText FT_APP
+ {
+ Pos = MAP_APPFONT ( 12 , 142 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "D~ocument type";
+ };
+ FixedText FT_FILTER
+ {
+ Pos = MAP_APPFONT ( 136 , 142 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Always sa~ve as";
+ };
+ ListBox LB_APP
+ {
+ Pos = MAP_APPFONT ( 12 , 153 ) ;
+ Size = MAP_APPFONT ( 108 , 58 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "Text document" ; APP_WRITER ; > ;
+ < "HTML document" ; APP_WRITER_WEB; > ;
+ < "Master document" ; APP_WRITER_GLOBAL; > ;
+ < "Spreadsheet" ; APP_CALC ; > ;
+ < "Presentation" ; APP_IMPRESS ; > ;
+ < "Drawing" ; APP_DRAW ; > ;
+ < "Formula" ; APP_MATH ; > ;
+ };
+ };
+ FixedImage FI_FILTER
+ {
+ Pos = MAP_APPFONT ( 129, 154 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ ListBox LB_FILTER
+ {
+ Pos = MAP_APPFONT ( 136 , 153 ) ;
+ Size = MAP_APPFONT ( 108 , 58 ) ;
+ Border = TRUE;
+ Sort = TRUE;
+ DropDown = TRUE;
+ };
+ FixedImage FI_ODF_WARNING
+ {
+ Pos = MAP_APPFONT ( 12, 169 ) ;
+ Size = MAP_APPFONT ( 8 , 8 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_WARN
+ {
+ Pos = MAP_APPFONT ( 23 , 169 ) ;
+ Size = MAP_APPFONT ( 239 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Not using ODF 1.2 Extended may cause infomation to be lost.";
+ Text [ x-comment ] = "EN-US, the term 'extended' must not be translated.";
+ };
+ Image IMG_ODF_WARNING
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "odfwarning.png";
+ };
+ MaskColor = Color { Red=0xffff; Green=0x0000; Blue=0xffff; };
+ };
+ Image IMG_ODF_WARNING_HC
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "odfwarning_h.png";
+ };
+ MaskColor = Color { Red=0xffff; Green=0x0000; Blue=0xffff; };
+ };
+};
+
+ModalDialog RID_SVXDLG_FILTER_WARNING
+{
+ HelpID = HID_SVXDLG_FILTER_WARNING;
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Sizeable = FALSE ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT( 175 + 39 + (3 * 6), (4 * 9)+ 12 + (3 * 12) + 6 - 21 );
+ Text = "%PRODUCTNAME %PRODUCTVERSION" ;
+ FixedImage IMG_WARNING
+ {
+ Pos = MAP_APPFONT( 6, 6 );
+ Size = MAP_APPFONT( 30, 30 );
+ };
+ FixedText FT_FILTER_WARNING
+ {
+ Pos = MAP_APPFONT( 39, 6 );
+ Size = MAP_APPFONT( 175, 4 * 9 );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Using \"%1\" as default file format may cause information loss.\n";
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT( 60, (4 * 9)/*+ 12*/ + 13 );
+ Size = MAP_APPFONT( 50, 14 );
+ DefButton = TRUE;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT( 120, (4 * 9)/*+ 12*/ + 13 );
+ Size = MAP_APPFONT( 50, 14 );
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optspell.hrc b/cui/source/options/optspell.hrc
new file mode 100644
index 000000000000..e13ba3ea09a2
--- /dev/null
+++ b/cui/source/options/optspell.hrc
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * 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: optspell.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// defines ---------------------------------------------------------------
+
+#define BTN_OK 10
+#define BTN_CANCEL 11
+#define BTN_BOOK 12
+
+#define LB_BOOK 20
+#define GB_BOOK 21
+
+#define BTN_CAPS 30
+#define BTN_NUMS 31
+#define BTN_UPLOW 32
+#define GB_AUDIT 33
+
+
diff --git a/cui/source/options/optspell.src b/cui/source/options/optspell.src
new file mode 100644
index 000000000000..bc6f3ad37fce
--- /dev/null
+++ b/cui/source/options/optspell.src
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * 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: optspell.src,v $
+ * $Revision: 1.34 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include "optspell.hrc"
+ // pragma -------------------------------------------------------------------
+
+ // RID_SFXPAGE_SPELL --------------------------------------------------------
+TabPage RID_SFXPAGE_SPELL
+{
+ HelpId = HID_OPTIONS_SPELL ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 221 , 185 ) ;
+ Text [ en-US ] = "Spellcheck" ;
+ PushButton BTN_BOOK
+ {
+ Pos = MAP_APPFONT ( 128 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Edit..." ;
+ TabStop = TRUE ;
+ };
+ MultiListBox LB_BOOK
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 103 , 47 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedLine GB_BOOK
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 115 , 66 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Wörterbücher : W÷rterb³cher */
+ /* ### ACHTUNG: Neuer Text in Resource? Wörterbücher : W÷rterb³cher */
+ Text [ en-US ] = "Dictionaries" ;
+ };
+ CheckBox BTN_CAPS
+ {
+ Pos = MAP_APPFONT ( 12 , 82 ) ;
+ Size = MAP_APPFONT ( 103 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Großgeschriebene Wörter : ~Gro˜geschriebene W÷rter */
+ /* ### ACHTUNG: Neuer Text in Resource? ~Großgeschriebene Wörter : ~Gro˜geschriebene W÷rter */
+ Text [ en-US ] = "~Capital words" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_NUMS
+ {
+ Pos = MAP_APPFONT ( 12 , 95 ) ;
+ Size = MAP_APPFONT ( 103 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Wörter mit Ziffern : ~W÷rter mit Ziffern */
+ /* ### ACHTUNG: Neuer Text in Resource? ~Wörter mit Ziffern : ~W÷rter mit Ziffern */
+ Text [ en-US ] = "~Words with numbers " ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_UPLOW
+ {
+ Pos = MAP_APPFONT ( 12 , 108 ) ;
+ Size = MAP_APPFONT ( 103 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Groß- u. ~Kleinschreibung : Gro˜- u. ~Kleinschreibung */
+ /* ### ACHTUNG: Neuer Text in Resource? Groß- u. ~Kleinschreibung : Gro˜- u. ~Kleinschreibung */
+ Text [ en-US ] = "~Case sensitive " ;
+ TabStop = TRUE ;
+ };
+ FixedLine GB_AUDIT
+ {
+ Pos = MAP_APPFONT ( 6 , 71 ) ;
+ Size = MAP_APPFONT ( 115 , 53 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Prüfen : Pr³fen */
+ /* ### ACHTUNG: Neuer Text in Resource? Prüfen : Pr³fen */
+ Text [ en-US ] = "Check" ;
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx
new file mode 100644
index 000000000000..c0a58604d1ff
--- /dev/null
+++ b/cui/source/options/optupdt.cxx
@@ -0,0 +1,415 @@
+/*************************************************************************
+ *
+ * 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: optupdt.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <vcl/svapp.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <svl/zforlist.hxx>
+#include "optupdt.hxx"
+#include "optupdt.hrc"
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <osl/file.hxx>
+#include <osl/security.hxx>
+
+namespace beans = ::com::sun::star::beans;
+namespace container = ::com::sun::star::container;
+namespace dialogs = ::com::sun::star::ui::dialogs;
+namespace frame = ::com::sun::star::frame;
+namespace lang = ::com::sun::star::lang;
+namespace uno = ::com::sun::star::uno;
+namespace util = ::com::sun::star::util;
+
+// define ----------------------------------------------------------------
+
+#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+// class SvxOnlineUpdateTabPage --------------------------------------------------
+
+SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_ONLINEUPDATE ), rSet ),
+ m_aOptionsLine( this, SVX_RES( FL_OPTIONS ) ),
+ m_aAutoCheckCheckBox( this, SVX_RES( CB_AUTOCHECK ) ),
+ m_aEveryDayButton( this, SVX_RES( RB_EVERYDAY ) ),
+ m_aEveryWeekButton( this, SVX_RES( RB_EVERYWEEK ) ),
+ m_aEveryMonthButton( this, SVX_RES( RB_EVERYMONTH ) ),
+ m_aCheckNowButton( this, SVX_RES( PB_CHECKNOW ) ),
+ m_aAutoDownloadCheckBox( this, SVX_RES( CB_AUTODOWNLOAD ) ),
+ m_aDestPathLabel( this, SVX_RES( FT_DESTPATHLABEL ) ),
+ m_aDestPath( this, SVX_RES( FT_DESTPATH ) ),
+ m_aChangePathButton( this, SVX_RES( PB_CHANGEPATH ) ),
+ m_aLastChecked( this, SVX_RES( FT_LASTCHECKED ) )
+{
+ m_aNeverChecked = String( SVX_RES( STR_NEVERCHECKED ) );
+ FreeResource();
+
+ m_aAutoCheckCheckBox.SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, AutoCheckHdl_Impl ) );
+ m_aCheckNowButton.SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, CheckNowHdl_Impl ) );
+ m_aChangePathButton.SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, FileDialogHdl_Impl ) );
+
+ uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+
+ m_xUpdateAccess = uno::Reference < container::XNameReplace >(
+ xFactory->createInstance( UNISTRING( "com.sun.star.setup.UpdateCheckConfig" ) ),
+ uno::UNO_QUERY_THROW );
+
+ sal_Bool bDownloadSupported = sal_False;
+ m_xUpdateAccess->getByName( UNISTRING( "DownloadSupported") ) >>= bDownloadSupported;
+
+ WinBits nStyle = m_aDestPath.GetStyle();
+ nStyle |= WB_PATHELLIPSIS;
+ m_aDestPath.SetStyle(nStyle);
+
+ m_aAutoDownloadCheckBox.Show(bDownloadSupported);
+ m_aDestPathLabel.Show(bDownloadSupported);
+ m_aDestPath.Show(bDownloadSupported);
+ m_aChangePathButton.Show(bDownloadSupported);
+
+ // dynamical length of the PushButtons
+ CalcButtonWidth();
+
+ m_aLastCheckedTemplate = m_aLastChecked.GetText();
+
+ UpdateLastCheckedText();
+}
+
+// -----------------------------------------------------------------------
+
+SvxOnlineUpdateTabPage::~SvxOnlineUpdateTabPage()
+{
+}
+
+// -----------------------------------------------------------------------
+void SvxOnlineUpdateTabPage::UpdateLastCheckedText()
+{
+ rtl::OUString aDateStr;
+ rtl::OUString aTimeStr;
+ rtl::OUString aText;
+ sal_Int64 lastChecked = 0;
+
+ m_xUpdateAccess->getByName( UNISTRING( "LastCheck") ) >>= lastChecked;
+
+ if( lastChecked == 0 ) // never checked
+ {
+ aText = m_aNeverChecked;
+ }
+ else
+ {
+ TimeValue lastCheckedTV;
+ oslDateTime lastCheckedDT;
+
+ Date aDate;
+ Time aTime;
+
+ lastCheckedTV.Seconds = (sal_uInt32) lastChecked;
+ osl_getLocalTimeFromSystemTime( &lastCheckedTV, &lastCheckedTV );
+
+ if ( osl_getDateTimeFromTimeValue( &lastCheckedTV, &lastCheckedDT ) )
+ {
+ aDate = Date( lastCheckedDT.Day, lastCheckedDT.Month, lastCheckedDT.Year );
+ aTime = Time( lastCheckedDT.Hours, lastCheckedDT.Minutes );
+ }
+
+ LanguageType eUILang = Application::GetSettings().GetUILanguage();
+ SvNumberFormatter *pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessServiceFactory(), eUILang );
+ String aTmpStr;
+ Color* pColor = NULL;
+ Date* pNullDate = pNumberFormatter->GetNullDate();
+ sal_uInt32 nFormat = pNumberFormatter->GetStandardFormat( NUMBERFORMAT_DATE, eUILang );
+
+ pNumberFormatter->GetOutputString( aDate - *pNullDate, nFormat, aTmpStr, &pColor );
+ aDateStr = aTmpStr;
+
+ nFormat = pNumberFormatter->GetStandardFormat( NUMBERFORMAT_TIME, eUILang );
+ pNumberFormatter->GetOutputString( aTime.GetTimeInDays(), nFormat, aTmpStr, &pColor );
+ aTimeStr = aTmpStr;
+
+ delete pColor;
+ delete pNumberFormatter;
+
+ aText = m_aLastCheckedTemplate;
+ sal_Int32 nIndex = aText.indexOf( UNISTRING( "%DATE%" ) );
+ if ( nIndex != -1 )
+ aText = aText.replaceAt( nIndex, 6, aDateStr );
+
+ nIndex = aText.indexOf( UNISTRING( "%TIME%" ) );
+ if ( nIndex != -1 )
+ aText = aText.replaceAt( nIndex, 6, aTimeStr );
+ }
+
+ m_aLastChecked.SetText( aText );
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage*
+SvxOnlineUpdateTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxOnlineUpdateTabPage( pParent, rAttrSet );
+}
+
+// -----------------------------------------------------------------------
+
+
+BOOL SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bModified = FALSE;
+
+ sal_Bool bValue;
+ sal_Int64 nValue;
+
+ if( m_aAutoCheckCheckBox.GetSavedValue() != m_aAutoCheckCheckBox.IsChecked() )
+ {
+ bValue = (TRUE == m_aAutoCheckCheckBox.IsChecked());
+ m_xUpdateAccess->replaceByName( UNISTRING("AutoCheckEnabled"), uno::makeAny( bValue ) );
+ bModified = TRUE;
+ }
+
+ nValue = 0;
+ if( TRUE == m_aEveryDayButton.IsChecked() )
+ {
+ if( FALSE == m_aEveryDayButton.GetSavedValue() )
+ nValue = 86400;
+ }
+ else if( TRUE == m_aEveryWeekButton.IsChecked() )
+ {
+ if( FALSE == m_aEveryWeekButton.GetSavedValue() )
+ nValue = 604800;
+ }
+ else if( TRUE == m_aEveryMonthButton.IsChecked() )
+ {
+ if( FALSE == m_aEveryMonthButton.GetSavedValue() )
+ nValue = 2592000;
+ }
+
+ if( nValue > 0 )
+ {
+ m_xUpdateAccess->replaceByName( UNISTRING("CheckInterval"), uno::makeAny( nValue ) );
+ bModified = TRUE;
+ }
+
+ if( m_aAutoDownloadCheckBox.GetSavedValue() != m_aAutoDownloadCheckBox.IsChecked() )
+ {
+ bValue = (TRUE == m_aAutoDownloadCheckBox.IsChecked());
+ m_xUpdateAccess->replaceByName( UNISTRING("AutoDownloadEnabled"), uno::makeAny( bValue ) );
+ bModified = TRUE;
+ }
+
+ rtl::OUString sValue, aURL;
+ m_xUpdateAccess->getByName( UNISTRING("DownloadDestination") ) >>= sValue;
+
+ if( ( osl::FileBase::E_None == osl::FileBase::getFileURLFromSystemPath(m_aDestPath.GetText(), aURL) ) &&
+ ( ! aURL.equals( sValue ) ) )
+ {
+ m_xUpdateAccess->replaceByName( UNISTRING("DownloadDestination"), uno::makeAny( aURL ) );
+ bModified = TRUE;
+ }
+
+ uno::Reference< util::XChangesBatch > xChangesBatch(m_xUpdateAccess, uno::UNO_QUERY);
+ if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() )
+ xChangesBatch->commitChanges();
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxOnlineUpdateTabPage::Reset( const SfxItemSet& )
+{
+ sal_Bool bValue = sal_Bool();
+ m_xUpdateAccess->getByName( UNISTRING("AutoCheckEnabled") ) >>= bValue;
+
+ m_aAutoCheckCheckBox.Check(bValue);
+ m_aEveryDayButton.Enable(bValue);
+ m_aEveryWeekButton.Enable(bValue);
+ m_aEveryMonthButton.Enable(bValue);
+
+ sal_Int64 nValue = 0;
+ m_xUpdateAccess->getByName( UNISTRING("CheckInterval") ) >>= nValue;
+
+ if( nValue == 86400 )
+ m_aEveryDayButton.Check();
+ else if( nValue == 604800 )
+ m_aEveryWeekButton.Check();
+ else
+ m_aEveryMonthButton.Check();
+
+ m_aAutoCheckCheckBox.SaveValue();
+ m_aEveryDayButton.SaveValue();
+ m_aEveryWeekButton.SaveValue();
+ m_aEveryMonthButton.SaveValue();
+
+ m_xUpdateAccess->getByName( UNISTRING("AutoDownloadEnabled") ) >>= bValue;
+ m_aAutoDownloadCheckBox.Check(bValue);
+ m_aDestPathLabel.Enable(TRUE);
+ m_aDestPath.Enable(TRUE);
+ m_aChangePathButton.Enable(TRUE);
+
+ rtl::OUString sValue, aPath;
+ m_xUpdateAccess->getByName( UNISTRING("DownloadDestination") ) >>= sValue;
+
+ if( osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(sValue, aPath) )
+ m_aDestPath.SetText(aPath);
+
+ m_aAutoDownloadCheckBox.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxOnlineUpdateTabPage::FillUserData()
+{
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, CheckBox *, pBox )
+{
+ BOOL bEnabled = pBox->IsChecked();
+
+ m_aEveryDayButton.Enable(bEnabled);
+ m_aEveryWeekButton.Enable(bEnabled);
+ m_aEveryMonthButton.Enable(bEnabled);
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxOnlineUpdateTabPage, FileDialogHdl_Impl, PushButton *, EMPTYARG )
+{
+ uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ uno::Reference < dialogs::XFolderPicker > xFolderPicker(
+ xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ) ),
+ uno::UNO_QUERY );
+
+ rtl::OUString aURL;
+ if( osl::FileBase::E_None != osl::FileBase::getFileURLFromSystemPath(m_aDestPath.GetText(), aURL) )
+ osl::Security().getHomeDir(aURL);
+
+ xFolderPicker->setDisplayDirectory( aURL );
+ sal_Int16 nRet = xFolderPicker->execute();
+
+ if ( dialogs::ExecutableDialogResults::OK == nRet )
+ {
+ rtl::OUString aFolder;
+ if( osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(xFolderPicker->getDirectory(), aFolder))
+ m_aDestPath.SetText( aFolder );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxOnlineUpdateTabPage, CheckNowHdl_Impl, PushButton *, EMPTYARG )
+{
+ uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xConfigProvider(
+ xFactory->createInstance( UNISTRING( "com.sun.star.configuration.ConfigurationProvider" )),
+ uno::UNO_QUERY_THROW);
+
+ beans::PropertyValue aProperty;
+ aProperty.Name = UNISTRING( "nodepath" );
+ aProperty.Value = uno::makeAny( UNISTRING("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob") );
+
+ uno::Sequence< uno::Any > aArgumentList( 1 );
+ aArgumentList[0] = uno::makeAny( aProperty );
+
+ uno::Reference< container::XNameAccess > xNameAccess(
+ xConfigProvider->createInstanceWithArguments(
+ UNISTRING("com.sun.star.configuration.ConfigurationAccess"), aArgumentList ),
+ uno::UNO_QUERY_THROW );
+
+ util::URL aURL;
+ xNameAccess->getByName(UNISTRING("URL")) >>= aURL.Complete;
+
+ uno::Reference < util::XURLTransformer > xTransformer(
+ xFactory->createInstance( UNISTRING( "com.sun.star.util.URLTransformer" ) ),
+ uno::UNO_QUERY_THROW );
+
+ xTransformer->parseStrict(aURL);
+
+ uno::Reference < frame::XDesktop > xDesktop(
+ xFactory->createInstance( UNISTRING( "com.sun.star.frame.Desktop" ) ),
+ uno::UNO_QUERY_THROW );
+
+ uno::Reference< frame::XDispatchProvider > xDispatchProvider(
+ xDesktop->getCurrentFrame(), uno::UNO_QUERY );
+
+ uno::Reference< frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0);
+
+ if( xDispatch.is() )
+ {
+ xDispatch->dispatch(aURL, uno::Sequence< beans::PropertyValue > ());
+ UpdateLastCheckedText();
+ }
+ }
+ catch( const uno::Exception& e )
+ {
+ OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
+ rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+
+ return 0;
+}
+
+void SvxOnlineUpdateTabPage::CalcButtonWidth()
+{
+ // detect the longest button text
+ long nTxtWidth = ::std::max( m_aCheckNowButton.GetCtrlTextWidth( m_aCheckNowButton.GetText() ),
+ m_aCheckNowButton.GetCtrlTextWidth( m_aChangePathButton.GetText() ) );
+ // add a little offset
+ nTxtWidth = nTxtWidth + 12;
+ // compare with the button width
+ Size aSize = m_aCheckNowButton.GetSizePixel();
+ // and change it if it's necessary
+ if ( nTxtWidth > aSize.Width() )
+ {
+ aSize.Width() = nTxtWidth;
+ m_aCheckNowButton.SetSizePixel( aSize );
+ m_aChangePathButton.SetSizePixel( aSize );
+ }
+}
+
diff --git a/cui/source/options/optupdt.hrc b/cui/source/options/optupdt.hrc
new file mode 100644
index 000000000000..d9e77f7f1403
--- /dev/null
+++ b/cui/source/options/optupdt.hrc
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * 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: optupdt.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTUPDT_HRC
+#define _SVX_OPTUPDT_HRC
+
+// defines ---------------------------------------------------------------
+
+// class SvxOnlineUpdateTabPage ----------------------------------------------
+
+#define FL_OPTIONS 10
+#define CB_AUTOCHECK 11
+#define RB_EVERYDAY 12
+#define RB_EVERYWEEK 13
+#define RB_EVERYMONTH 14
+#define PB_CHECKNOW 15
+#define CB_AUTODOWNLOAD 16
+#define FT_DESTPATHLABEL 17
+#define FT_DESTPATH 18
+#define PB_CHANGEPATH 19
+#define FT_LASTCHECKED 20
+#define STR_NEVERCHECKED 21
+
+
+#endif // #ifndef _SVX_OPTUPDT_HRC
+
diff --git a/cui/source/options/optupdt.hxx b/cui/source/options/optupdt.hxx
new file mode 100644
index 000000000000..4aa380844602
--- /dev/null
+++ b/cui/source/options/optupdt.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * 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: optupdt.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_OPTUPDT_HXX
+#define _SVX_OPTUPDT_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/tabdlg.hxx>
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <com/sun/star/container/XNameReplace.hpp>
+
+// class SvxPathTabPage --------------------------------------------------
+
+class SvxOnlineUpdateTabPage : public SfxTabPage
+{
+private:
+ FixedLine m_aOptionsLine;
+ CheckBox m_aAutoCheckCheckBox;
+ RadioButton m_aEveryDayButton;
+ RadioButton m_aEveryWeekButton;
+ RadioButton m_aEveryMonthButton;
+ PushButton m_aCheckNowButton;
+ CheckBox m_aAutoDownloadCheckBox;
+ FixedText m_aDestPathLabel;
+ FixedText m_aDestPath;
+ PushButton m_aChangePathButton;
+ FixedText m_aLastChecked;
+ rtl::OUString m_aNeverChecked;
+ rtl::OUString m_aLastCheckedTemplate;
+
+ DECL_LINK( FileDialogHdl_Impl, PushButton* ) ;
+ DECL_LINK( CheckNowHdl_Impl, PushButton* ) ;
+ DECL_LINK( AutoCheckHdl_Impl, CheckBox* ) ;
+
+ void CalcButtonWidth();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xUpdateAccess;
+
+ void UpdateLastCheckedText();
+
+public:
+ SvxOnlineUpdateTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxOnlineUpdateTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void FillUserData();
+};
+
+
+#endif
+
diff --git a/cui/source/options/optupdt.src b/cui/source/options/optupdt.src
new file mode 100644
index 000000000000..043abb8b6a95
--- /dev/null
+++ b/cui/source/options/optupdt.src
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * 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: optupdt.src,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "optupdt.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+ // RID_SVXPAGE_ONLINEUPDATE --------------------------------------------
+TabPage RID_SVXPAGE_ONLINEUPDATE
+{
+ HelpId = HID_SVX_OPTIONS_ONLINEUPDATE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "OnlineUpdate" ;
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Online Update Options" ;
+ };
+ CheckBox CB_AUTOCHECK
+ {
+ Pos = MAP_APPFONT ( 12, 14 ) ;
+ Size = MAP_APPFONT ( 210, 10 ) ;
+ Text [ en-US ] = "~Check for updates automatically" ;
+ };
+ RadioButton RB_EVERYDAY
+ {
+ Pos = MAP_APPFONT ( 18, 27 ) ;
+ Size = MAP_APPFONT ( 160, 10 ) ;
+ Text [ en-US ] = "Every Da~y" ;
+ };
+ RadioButton RB_EVERYWEEK
+ {
+ Pos = MAP_APPFONT ( 18, 40 ) ;
+ Size = MAP_APPFONT ( 160, 10 ) ;
+ Text [ en-US ] = "Every ~Week" ;
+ };
+ RadioButton RB_EVERYMONTH
+ {
+ Pos = MAP_APPFONT ( 18, 53 ) ;
+ Size = MAP_APPFONT ( 160, 10 ) ;
+ Text [ en-US ] = "Every ~Month" ;
+ };
+ FixedText FT_LASTCHECKED
+ {
+ Pos = MAP_APPFONT ( 12, 69 ) ;
+ Size = MAP_APPFONT ( 160, 10 ) ;
+ Text [ en-US ] = "Last checked: %DATE%, %TIME%" ;
+ };
+ PushButton PB_CHECKNOW
+ {
+ Pos = MAP_APPFONT ( 12, 82 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ Text [ en-US ] = "Check ~now" ;
+ };
+ CheckBox CB_AUTODOWNLOAD
+ {
+ Pos = MAP_APPFONT ( 12, 130 ) ;
+ Size = MAP_APPFONT ( 160, 10 ) ;
+ Text [ en-US ] = "~Download updates automatically" ;
+ };
+ FixedText FT_DESTPATHLABEL
+ {
+ Pos = MAP_APPFONT ( 22, 143 ) ;
+ Size = MAP_APPFONT ( 150, 8 ) ;
+ Text [ en-US ] = "Download destination:" ;
+ };
+ FixedText FT_DESTPATH
+ {
+ Pos = MAP_APPFONT ( 22, 154 ) ;
+ Size = MAP_APPFONT ( 138, 8 ) ;
+ };
+ PushButton PB_CHANGEPATH
+ {
+ Pos = MAP_APPFONT ( 162, 151 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ Text [ en-US ] = "Ch~ange..." ;
+ };
+ String STR_NEVERCHECKED
+ {
+ Text [ en-US ] = "Last checked: Not yet" ;
+ };
+};
diff --git a/cui/source/options/radiobtnbox.cxx b/cui/source/options/radiobtnbox.cxx
new file mode 100644
index 000000000000..1d98966525b9
--- /dev/null
+++ b/cui/source/options/radiobtnbox.cxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * 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: radiobtnbox.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include "radiobtnbox.hxx"
+#include <svx/dialmgr.hxx>
+
+namespace svx {
+
+// class SvxRadioButtonListBox ----------------------------------------------------
+
+SvxRadioButtonListBox::SvxRadioButtonListBox( Window* _pParent, const ResId& _rId ) :
+
+ SvxSimpleTable( _pParent, _rId )
+
+{
+ EnableCheckButton( new SvLBoxButtonData( this, true ) );
+}
+
+SvxRadioButtonListBox::~SvxRadioButtonListBox()
+{
+}
+
+void SvxRadioButtonListBox::SetTabs()
+{
+ SvxSimpleTable::SetTabs();
+/*
+ USHORT nAdjust = SV_LBOXTAB_ADJUST_RIGHT | SV_LBOXTAB_ADJUST_LEFT |
+ SV_LBOXTAB_ADJUST_CENTER | SV_LBOXTAB_ADJUST_NUMERIC | SV_LBOXTAB_FORCE;
+ if ( aTabs.Count() > 0 )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(0);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE | SV_LBOXTAB_ADJUST_CENTER | SV_LBOXTAB_FORCE;
+ }
+*/
+}
+
+void SvxRadioButtonListBox::MouseButtonUp( const MouseEvent& _rMEvt )
+{
+ m_aCurMousePoint = _rMEvt.GetPosPixel();
+ SvxSimpleTable::MouseButtonUp( _rMEvt );
+}
+
+void SvxRadioButtonListBox::KeyInput( const KeyEvent& rKEvt )
+{
+ if ( !rKEvt.GetKeyCode().GetModifier() && KEY_SPACE == rKEvt.GetKeyCode().GetCode() )
+ {
+ SvLBoxEntry* pEntry = FirstSelected();
+ if ( GetCheckButtonState( pEntry ) == SV_BUTTON_UNCHECKED )
+ {
+ SetCheckButtonState( pEntry, SV_BUTTON_CHECKED );
+ GetCheckButtonHdl().Call( NULL );
+ return ;
+ }
+ }
+
+ SvxSimpleTable::KeyInput( rKEvt );
+}
+
+void SvxRadioButtonListBox::HandleEntryChecked( SvLBoxEntry* _pEntry )
+{
+ Select( _pEntry, TRUE );
+ SvButtonState eState = GetCheckButtonState( _pEntry );
+
+ if ( SV_BUTTON_CHECKED == eState )
+ {
+ // we have radio button behavior -> so uncheck the other entries
+ SvLBoxEntry* pEntry = First();
+ while ( pEntry )
+ {
+ if ( pEntry != _pEntry )
+ SetCheckButtonState( pEntry, SV_BUTTON_UNCHECKED );
+ pEntry = Next( pEntry );
+ }
+ }
+ else
+ SetCheckButtonState( _pEntry, SV_BUTTON_CHECKED );
+}
+
+const Point& SvxRadioButtonListBox::GetCurMousePoint() const
+{
+ return m_aCurMousePoint;
+}
+
+} // end of namespace ::svx
+
diff --git a/cui/source/options/readonlyimage.cxx b/cui/source/options/readonlyimage.cxx
new file mode 100644
index 000000000000..ea5d5e368972
--- /dev/null
+++ b/cui/source/options/readonlyimage.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * 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: readonlyimage.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <readonlyimage.hxx>
+#include <vcl/help.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+
+/*-- 26.02.2004 13:31:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ReadOnlyImage::ReadOnlyImage(Window* pParent, const ResId rResId) :
+ FixedImage(pParent, rResId)
+{
+ sal_Bool bHighContrast = pParent->GetDisplayBackground().GetColor().IsDark();
+ SetImage( Image(SVX_RES(bHighContrast ? RID_SVXBMP_LOCK_HC : RID_SVXBMP_LOCK )));
+}
+
+/*-- 26.02.2004 13:31:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ReadOnlyImage::~ReadOnlyImage()
+{
+}
+/*-- 26.02.2004 13:31:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void ReadOnlyImage::RequestHelp( const HelpEvent& rHEvt )
+{
+ if( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() )
+ {
+ Rectangle aLogicPix( LogicToPixel( Rectangle( Point(), GetOutputSize() ) ) );
+ Rectangle aScreenRect( OutputToScreenPixel( aLogicPix.TopLeft() ),
+ OutputToScreenPixel( aLogicPix.BottomRight() ) );
+
+ String aStr(ReadOnlyImage::GetHelpTip());
+ if ( Help::IsBalloonHelpEnabled() )
+ Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aScreenRect,
+ aStr );
+ else if ( Help::IsQuickHelpEnabled() )
+ Help::ShowQuickHelp( this, aScreenRect, aStr );
+ }
+ else
+ Window::RequestHelp( rHEvt );
+}
+
+/*-- 26.02.2004 14:20:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const String& ReadOnlyImage::GetHelpTip()
+{
+ static String aStr(SVX_RES(RID_SVXSTR_READONLY_CONFIG_TIP));
+ return aStr;
+}
diff --git a/cui/source/options/readonlyimage.hxx b/cui/source/options/readonlyimage.hxx
new file mode 100644
index 000000000000..10e44989e9e9
--- /dev/null
+++ b/cui/source/options/readonlyimage.hxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * 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: readonlyimage.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_READONLYIMAGE_HXX
+#define _SVX_READONLYIMAGE_HXX
+
+#include <vcl/fixed.hxx>
+
+class ReadOnlyImage : public FixedImage
+{
+public:
+ ReadOnlyImage(Window* pParent, const ResId rResId);
+ ~ReadOnlyImage();
+
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ static const String& GetHelpTip();
+
+};
+#endif //
+
diff --git a/cui/source/options/readonlyimage.src b/cui/source/options/readonlyimage.src
new file mode 100644
index 000000000000..0f698a833c46
--- /dev/null
+++ b/cui/source/options/readonlyimage.src
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * 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: readonlyimage.src,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+
+String RID_SVXSTR_READONLY_CONFIG_TIP
+{
+ Text [ en-US ] = "This setting is protected by the Administrator";
+};
+Image RID_SVXBMP_LOCK
+{
+ ImageBitmap = Bitmap
+ {
+ File = "lock.bmp";
+ };
+ MaskColor = Color { Red=0xffff; Green=0x0000; Blue=0xffff; };
+};
+Image RID_SVXBMP_LOCK_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "lock_hc.bmp";
+ };
+ MaskColor = Color { Red=0xffff; Green=0x0000; Blue=0xffff; };
+};
+
diff --git a/cui/source/options/sdbcdriverenum.cxx b/cui/source/options/sdbcdriverenum.cxx
new file mode 100644
index 000000000000..5da5d649a969
--- /dev/null
+++ b/cui/source/options/sdbcdriverenum.cxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * 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: sdbcdriverenum.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include "sdbcdriverenum.hxx"
+#include <comphelper/stl_types.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::container;
+
+ //====================================================================
+ //= ODriverEnumerationImpl
+ //====================================================================
+ class ODriverEnumerationImpl
+ {
+ protected:
+ ::std::vector< ::rtl::OUString > m_aImplNames;
+
+ public:
+ ODriverEnumerationImpl();
+
+ const ::std::vector< ::rtl::OUString >& getDriverImplNames() const { return m_aImplNames; }
+ };
+
+ //--------------------------------------------------------------------
+ ODriverEnumerationImpl::ODriverEnumerationImpl()
+ {
+ try
+ {
+ Reference< XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
+ Reference< XInterface > xDM = xORB->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdbc.DriverManager"));
+ OSL_ENSURE(xDM.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: no access to the SDBC driver manager!");
+
+ Reference< XEnumerationAccess > xEnumAccess(xDM, UNO_QUERY);
+ OSL_ENSURE(xEnumAccess.is() || !xDM.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: can't enumerate SDBC drivers (missing the interface)!");
+ if (xEnumAccess.is())
+ {
+ Reference< XEnumeration > xEnumDrivers = xEnumAccess->createEnumeration();
+ OSL_ENSURE(xEnumDrivers.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: invalid enumeration object!");
+
+ Reference< XServiceInfo > xDriverSI;
+ while (xEnumDrivers->hasMoreElements())
+ {
+ xEnumDrivers->nextElement() >>= xDriverSI;
+ OSL_ENSURE(xDriverSI.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: driver without service info!");
+ if (xDriverSI.is())
+ m_aImplNames.push_back(xDriverSI->getImplementationName());
+ }
+ }
+ }
+ catch(const Exception&)
+ {
+ OSL_ENSURE(sal_False, "ODriverEnumerationImpl::ODriverEnumerationImpl: caught an exception while enumerating the drivers!");
+ }
+ }
+
+ //====================================================================
+ //= ODriverEnumeration
+ //====================================================================
+ //--------------------------------------------------------------------
+ ODriverEnumeration::ODriverEnumeration() throw()
+ :m_pImpl(new ODriverEnumerationImpl)
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ODriverEnumeration::~ODriverEnumeration() throw()
+ {
+ delete m_pImpl;
+ }
+
+ //--------------------------------------------------------------------
+ ODriverEnumeration::const_iterator ODriverEnumeration::begin() const throw()
+ {
+ return m_pImpl->getDriverImplNames().begin();
+ }
+
+ //--------------------------------------------------------------------
+ ODriverEnumeration::const_iterator ODriverEnumeration::end() const throw()
+ {
+ return m_pImpl->getDriverImplNames().end();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 ODriverEnumeration::size() const throw()
+ {
+ return m_pImpl->getDriverImplNames().size();
+ }
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+
diff --git a/cui/source/options/sdbcdriverenum.hxx b/cui/source/options/sdbcdriverenum.hxx
new file mode 100644
index 000000000000..eaee591b22f3
--- /dev/null
+++ b/cui/source/options/sdbcdriverenum.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * 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: sdbcdriverenum.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFMGR_SDBCDRIVERENUMERATION_HXX_
+#define _OFFMGR_SDBCDRIVERENUMERATION_HXX_
+
+
+#include <sal/types.h>
+
+#include <vector>
+
+namespace rtl
+{
+ class OUString;
+}
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ //====================================================================
+ //= ODriverEnumeration
+ //====================================================================
+ class ODriverEnumerationImpl;
+ /** simple class for accessing SDBC drivers registered within the office
+ <p>Rather small, introduced to not contaminate other instances with the
+ exception handling (code-size-bloating) implementations here.
+ </p>
+ */
+ class ODriverEnumeration
+ {
+ private:
+ ODriverEnumerationImpl* m_pImpl;
+
+ public:
+ ODriverEnumeration() throw();
+ ~ODriverEnumeration() throw();
+ typedef ::std::vector< ::rtl::OUString >::const_iterator const_iterator;
+
+ const_iterator begin() const throw();
+ const_iterator end() const throw();
+ sal_Int32 size() const throw();
+ };
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+#endif // _OFFMGR_SDBCDRIVERENUMERATION_HXX_
+
+
diff --git a/cui/source/options/securityoptions.cxx b/cui/source/options/securityoptions.cxx
new file mode 100644
index 000000000000..489016970bdb
--- /dev/null
+++ b/cui/source/options/securityoptions.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: securityoptions.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <unotools/securityoptions.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include "securityoptions.hxx"
+#include "securityoptions.hrc"
+
+namespace
+{
+ bool enableAndSet( const SvtSecurityOptions& rOptions,
+ SvtSecurityOptions::EOption eOption,
+ CheckBox& rCheckBox, FixedImage& rFixedImage )
+ {
+ bool bEnable = rOptions.IsOptionEnabled( eOption );
+ rCheckBox.Enable( bEnable );
+ rFixedImage.Show( !bEnable );
+ rCheckBox.Check( rOptions.IsOptionSet( eOption ) );
+ return bEnable;
+ }
+}
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+SecurityOptionsDialog::SecurityOptionsDialog( Window* pParent, SvtSecurityOptions* pOptions ) :
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_SECURITY_OPTIONS ) )
+ ,m_aWarningsFL ( this, SVX_RES( FL_WARNINGS ) )
+ ,m_aWarningsFI ( this, SVX_RES( FI_WARNINGS ) )
+ ,m_aSaveOrSendDocsFI( this, SVX_RES( FI_SAVESENDDOCS ) )
+ ,m_aSaveOrSendDocsCB( this, SVX_RES( CB_SAVESENDDOCS ) )
+ ,m_aSignDocsFI ( this, SVX_RES( FI_SIGNDOCS ) )
+ ,m_aSignDocsCB ( this, SVX_RES( CB_SIGNDOCS ) )
+ ,m_aPrintDocsFI ( this, SVX_RES( FI_PRINTDOCS ) )
+ ,m_aPrintDocsCB ( this, SVX_RES( CB_PRINTDOCS ) )
+ ,m_aCreatePdfFI ( this, SVX_RES( FI_CREATEPDF ) )
+ ,m_aCreatePdfCB ( this, SVX_RES( CB_CREATEPDF ) )
+ ,m_aOptionsFL ( this, SVX_RES( FL_OPTIONS ) )
+ ,m_aRemovePersInfoFI( this, SVX_RES( FI_REMOVEINFO ) )
+ ,m_aRemovePersInfoCB( this, SVX_RES( CB_REMOVEINFO ) )
+ ,m_aRecommPasswdFI ( this, SVX_RES( FI_RECOMMENDPWD ) )
+ ,m_aRecommPasswdCB ( this, SVX_RES( CB_RECOMMENDPWD ) )
+ ,m_aCtrlHyperlinkFI ( this, SVX_RES( FI_CTRLHYPERLINK ) )
+ ,m_aCtrlHyperlinkCB ( this, SVX_RES( CB_CTRLHYPERLINK ) )
+
+ ,m_aButtonsFL ( this, SVX_RES( FL_BUTTONS ) )
+ ,m_aOKBtn ( this, SVX_RES( PB_OK ) )
+ ,m_aCancelBtn ( this, SVX_RES( PB_CANCEL ) )
+ ,m_aHelpBtn ( this, SVX_RES( PB_HELP ) )
+
+{
+ FreeResource();
+
+ DBG_ASSERT( pOptions, "SecurityOptionsDialog::SecurityOptionsDialog(): invalid SvtSecurityOptions" );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_SAVEORSEND, m_aSaveOrSendDocsCB, m_aSaveOrSendDocsFI );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_SIGNING, m_aSignDocsCB, m_aSignDocsFI );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_PRINT, m_aPrintDocsCB, m_aPrintDocsFI );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_CREATEPDF, m_aCreatePdfCB, m_aCreatePdfFI );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO, m_aRemovePersInfoCB, m_aRemovePersInfoFI );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD, m_aRecommPasswdCB, m_aRecommPasswdFI );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_CTRLCLICK_HYPERLINK, m_aCtrlHyperlinkCB, m_aCtrlHyperlinkFI );
+}
+
+SecurityOptionsDialog::~SecurityOptionsDialog()
+{
+}
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
diff --git a/cui/source/options/securityoptions.hrc b/cui/source/options/securityoptions.hrc
new file mode 100644
index 000000000000..c0358d5f151b
--- /dev/null
+++ b/cui/source/options/securityoptions.hrc
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: securityoptions.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_SECURITYOPTIONS_HRC
+#define _SVX_SECURITYOPTIONS_HRC
+
+#define FL_WARNINGS 10
+#define FI_WARNINGS 11
+#define FI_SAVESENDDOCS 12
+#define CB_SAVESENDDOCS 13
+#define FI_SIGNDOCS 14
+#define CB_SIGNDOCS 15
+#define FI_PRINTDOCS 16
+#define CB_PRINTDOCS 17
+#define FI_CREATEPDF 18
+#define CB_CREATEPDF 19
+#define FL_OPTIONS 20
+#define FI_REMOVEINFO 21
+#define CB_REMOVEINFO 22
+#define FI_RECOMMENDPWD 23
+#define CB_RECOMMENDPWD 24
+#define FI_CTRLHYPERLINK 25
+#define CB_CTRLHYPERLINK 26
+#define FL_BUTTONS 27
+#define PB_OK 28
+#define PB_CANCEL 29
+#define PB_HELP 30
+
+#define DLG_WIDTH 260
+
+#define COL_0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define COL_1 (COL_0+RSC_SP_FLGR_SPACE_X)
+#define COL_2 (COL_1+RSC_SP_CHK_TEXTINDENT)
+#define COL_4 (DLG_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define COL_3 (COL_4-RSC_SP_FLGR_SPACE_X)
+
+#define COL_C (COL_4-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_B (COL_C-RSC_SP_CTRL_X-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_A (COL_B-RSC_SP_CTRL_GROUP_X-RSC_CD_PUSHBUTTON_WIDTH)
+
+#define CHECKBOX_WIDTH ((COL_3-COL_2-RSC_SP_CTRL_X)/2)
+
+#define ROW_0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ROW_1 (ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_2 (ROW_1+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_3 (ROW_2+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_4 (ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_5 (ROW_4+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_6 (ROW_5+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_7 (ROW_6+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_8 (ROW_7+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_9 (ROW_8+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_10 (ROW_9+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_DLG_INNERBORDER_BOTTOM)
+
+#endif // #ifndef _SVX_SECURITYOPTIONS_HRC
+
diff --git a/cui/source/options/securityoptions.hxx b/cui/source/options/securityoptions.hxx
new file mode 100644
index 000000000000..0e78e328edd8
--- /dev/null
+++ b/cui/source/options/securityoptions.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * 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: securityoptions.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SECURITYOPTIONS_HXX
+#define _SVX_SECURITYOPTIONS_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+
+#include "readonlyimage.hxx"
+
+class SvtSecurityOptions;
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= class SecurityOptionsDialog
+ //====================================================================
+ class SecurityOptionsDialog : public ModalDialog
+ {
+ private:
+ FixedLine m_aWarningsFL;
+ FixedInfo m_aWarningsFI;
+ ReadOnlyImage m_aSaveOrSendDocsFI;
+ CheckBox m_aSaveOrSendDocsCB;
+ ReadOnlyImage m_aSignDocsFI;
+ CheckBox m_aSignDocsCB;
+ ReadOnlyImage m_aPrintDocsFI;
+ CheckBox m_aPrintDocsCB;
+ ReadOnlyImage m_aCreatePdfFI;
+ CheckBox m_aCreatePdfCB;
+
+ FixedLine m_aOptionsFL;
+ ReadOnlyImage m_aRemovePersInfoFI;
+ CheckBox m_aRemovePersInfoCB;
+ ReadOnlyImage m_aRecommPasswdFI;
+ CheckBox m_aRecommPasswdCB;
+ ReadOnlyImage m_aCtrlHyperlinkFI;
+ CheckBox m_aCtrlHyperlinkCB;
+
+ FixedLine m_aButtonsFL;
+ OKButton m_aOKBtn;
+ CancelButton m_aCancelBtn;
+ HelpButton m_aHelpBtn;
+
+ public:
+ SecurityOptionsDialog( Window* pParent, SvtSecurityOptions* pOptions );
+ ~SecurityOptionsDialog();
+
+ inline bool IsSaveOrSendDocsChecked() const { return m_aSaveOrSendDocsCB.IsChecked() != FALSE; }
+ inline bool IsSignDocsChecked() const { return m_aSignDocsCB.IsChecked() != FALSE; }
+ inline bool IsPrintDocsChecked() const { return m_aPrintDocsCB.IsChecked() != FALSE; }
+ inline bool IsCreatePdfChecked() const { return m_aCreatePdfCB.IsChecked() != FALSE; }
+ inline bool IsRemovePersInfoChecked() const { return m_aRemovePersInfoCB.IsChecked() != FALSE; }
+ inline bool IsRecommPasswdChecked() const { return m_aRecommPasswdCB.IsChecked() != FALSE; }
+ inline bool IsCtrlHyperlinkChecked() const { return m_aCtrlHyperlinkCB.IsChecked() != FALSE; }
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // #ifndef _SVX_SECURITYOPTIONS_HXX
+
diff --git a/cui/source/options/securityoptions.src b/cui/source/options/securityoptions.src
new file mode 100644
index 000000000000..7f921bea1dd2
--- /dev/null
+++ b/cui/source/options/securityoptions.src
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * 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: securityoptions.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svtools/controldims.hrc>
+#include "securityoptions.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+ModalDialog RID_SVXDLG_SECURITY_OPTIONS
+{
+ HelpID = HID_DLG_SECURITY_OPTIONS ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( DLG_WIDTH , ROW_10 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Security options and warnings" ;
+ FixedLine FL_WARNINGS
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_0 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Security warnings";
+ };
+ FixedText FI_WARNINGS
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_1 );
+ Size = MAP_APPFONT( COL_3-COL_1, 2*RSC_CD_FIXEDLINE_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Warn if document contains recorded changes, versions, hidden information or notes:";
+ };
+ FixedImage FI_SAVESENDDOCS
+ {
+ Pos = MAP_APPFONT( COL_2 - 7, ROW_2 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_SAVESENDDOCS
+ {
+ Pos = MAP_APPFONT( COL_2, ROW_2 );
+ Size = MAP_APPFONT( CHECKBOX_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "When saving or sending";
+ };
+ FixedImage FI_SIGNDOCS
+ {
+ Pos = MAP_APPFONT( COL_2 + CHECKBOX_WIDTH + RSC_SP_CTRL_X - 7, ROW_2 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_SIGNDOCS
+ {
+ Pos = MAP_APPFONT( COL_2 + CHECKBOX_WIDTH + RSC_SP_CTRL_X, ROW_2 );
+ Size = MAP_APPFONT( CHECKBOX_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "When signing";
+ };
+ FixedImage FI_PRINTDOCS
+ {
+ Pos = MAP_APPFONT( COL_2 - 7, ROW_3 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_PRINTDOCS
+ {
+ Pos = MAP_APPFONT( COL_2, ROW_3 );
+ Size = MAP_APPFONT( CHECKBOX_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "When printing";
+ };
+ FixedImage FI_CREATEPDF
+ {
+ Pos = MAP_APPFONT( COL_2 + CHECKBOX_WIDTH + RSC_SP_CTRL_X - 7, ROW_3 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_CREATEPDF
+ {
+ Pos = MAP_APPFONT( COL_2 + CHECKBOX_WIDTH + RSC_SP_CTRL_X, ROW_3 );
+ Size = MAP_APPFONT( CHECKBOX_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "When creating PDF files";
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_4 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Security options";
+ };
+ FixedImage FI_REMOVEINFO
+ {
+ Pos = MAP_APPFONT( COL_1 - 7, ROW_5 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_REMOVEINFO
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_5 );
+ Size = MAP_APPFONT( COL_3-COL_1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Remove personal information on saving";
+ };
+ FixedImage FI_RECOMMENDPWD
+ {
+ Pos = MAP_APPFONT( COL_1 - 7, ROW_6 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_RECOMMENDPWD
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_6 );
+ Size = MAP_APPFONT( COL_3-COL_1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Recommend password protection on saving";
+ };
+ FixedImage FI_CTRLHYPERLINK
+ {
+ Pos = MAP_APPFONT( COL_1 - 7, ROW_6 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_CTRLHYPERLINK
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_7 );
+ Size = MAP_APPFONT( COL_3-COL_1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Ctrl-click required to follow hyperlinks";
+ };
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT( 0, ROW_8 );
+ Size = MAP_APPFONT( DLG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( COL_A , ROW_9 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( COL_B , ROW_9 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( COL_C , ROW_9 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+};
+
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
new file mode 100644
index 000000000000..045bac7b9126
--- /dev/null
+++ b/cui/source/options/treeopt.cxx
@@ -0,0 +1,2849 @@
+/*************************************************************************
+ *
+ * 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: treeopt.cxx,v $
+ * $Revision: 1.58 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
+#include <com/sun/star/linguistic2/XDictionaryList.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
+#include <osl/module.hxx>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/frame/XLoadable.hpp>
+#include <tools/rcid.h>
+#include <tools/shl.hxx>
+#include <comphelper/processfactory.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/oooimprovement/XCoreController.hpp>
+#include <comphelper/configurationhelper.hxx>
+#include <com/sun/star/awt/XDialogProvider.hpp>
+#include <com/sun/star/awt/XDialogProvider2.hpp>
+#include <com/sun/star/awt/XContainerWindowProvider.hpp>
+#include <com/sun/star/awt/XDialogEventHandler.hpp>
+#include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XTabController.hpp>
+#include <vcl/help.hxx>
+#include <linguistic/misc.hxx>
+#include <svtools/helpopt.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <svl/languageoptions.hxx>
+#include <unotools/optionsdlg.hxx>
+#include <sfx2/module.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/waitobj.hxx>
+#include <svl/slstitm.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <unotools/viewoptions.hxx>
+#include <sfx2/printopt.hxx>
+#include <osl/module.h>
+#include <osl/process.h>
+#include <rtl/bootstrap.hxx>
+#include <unotools/misccfg.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/tplpitem.hxx>
+#include <svtools/apearcfg.hxx>
+#include <unotools/linguprops.hxx>
+#include <sfx2/app.hxx>
+#include <svx/xdef.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xpool.hxx>
+#include "cuitabarea.hxx"
+#include <svx/ofaitem.hxx>
+#include "opthtml.hxx"
+#include "optcolor.hxx"
+#include "optctl.hxx"
+#include "optjava.hxx"
+#include "optsave.hxx"
+#include "optpath.hxx"
+#include "cuioptgenrl.hxx"
+#include "optlingu.hxx"
+#include "optinet2.hxx"
+#include "optasian.hxx"
+#include "optaccessibility.hxx"
+#include "optjsearch.hxx"
+#include "connpooloptions.hxx"
+#include "optupdt.hxx"
+#include <optimprove.hxx>
+#include "optchart.hxx"
+#include "optgdlg.hxx"
+#include "optmemory.hxx"
+#include "optfltr.hxx"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include <svx/dialmgr.hxx>
+#include "treeopt.hxx"
+#include "treeopt.hrc"
+#include "fontsubs.hxx"
+#include <svx/unolingu.hxx>
+#include <svx/xtable.hxx>
+#include "connpoolconfig.hxx"
+#include "dbregister.hxx"
+#include "dbregisterednamesconfig.hxx"
+#include "cfgchart.hxx"
+
+#ifndef _SVX_LANGITEM_HXX
+#define ITEMID_LANGUAGE SID_ATTR_CHAR_LANGUAGE
+#include <svx/langitem.hxx>
+#endif
+
+
+#include <svx/optitems.hxx>
+
+#include <svx/drawitem.hxx>
+#include <rtl/uri.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+#ifdef C2U
+ #error "Who define C2U before! I use it to create const ascii strings ..."
+#else
+ #define C2U(cChar) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( cChar ) )
+#endif
+
+#define HINT_TIMEOUT 200
+#define SELECT_FIRST_TIMEOUT 0
+#define SELECT_TIMEOUT 300
+#define COLORPAGE_UNKNOWN ((sal_uInt16)0xFFFF)
+#define EXPAND_PROTOCOL "vnd.sun.star.expand:"
+
+LastPageSaver* OfaTreeOptionsDialog::pLastPageSaver = NULL;
+
+// some stuff for easier changes for SvtViewOptions
+static const sal_Char* pViewOptDataName = "page data";
+#define VIEWOPT_DATANAME rtl::OUString::createFromAscii( pViewOptDataName )
+
+static XOutdevItemPool* mpStaticXOutdevItemPool = 0L;
+
+static inline void SetViewOptUserItem( SvtViewOptions& rOpt, const String& rData )
+{
+ rOpt.SetUserItem( VIEWOPT_DATANAME, makeAny( rtl::OUString( rData ) ) );
+}
+
+static inline String GetViewOptUserItem( const SvtViewOptions& rOpt )
+{
+ Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) );
+ rtl::OUString aUserData;
+ aAny >>= aUserData;
+
+ return String( aUserData );
+}
+
+struct ModuleToGroupNameMap_Impl
+{
+ const char* m_pModule;
+ String m_sGroupName;
+ USHORT m_nNodeId;
+};
+
+static OfaPageResource* pPageRes = NULL;
+
+static ModuleToGroupNameMap_Impl ModuleMap[] =
+{
+ { "ProductName", String::EmptyString(), SID_GENERAL_OPTIONS },
+ { "LanguageSettings", String::EmptyString(), SID_LANGUAGE_OPTIONS },
+ { "Internet", String::EmptyString(), SID_INET_DLG },
+ { "LoadSave", String::EmptyString(), SID_FILTER_DLG },
+ { "Writer", String::EmptyString(), SID_SW_EDITOPTIONS },
+ { "WriterWeb", String::EmptyString(), SID_SW_ONLINEOPTIONS },
+ { "Math", String::EmptyString(), SID_SM_EDITOPTIONS },
+ { "Calc", String::EmptyString(), SID_SC_EDITOPTIONS },
+ { "Impress", String::EmptyString(), SID_SD_EDITOPTIONS },
+ { "Draw", String::EmptyString(), SID_SD_GRAPHIC_OPTIONS },
+ { "Charts", String::EmptyString(), SID_SCH_EDITOPTIONS },
+ { "Base", String::EmptyString(), SID_SB_STARBASEOPTIONS },
+
+ { NULL, String::EmptyString(), 0xFFFF }
+};
+
+static void setGroupName( const rtl::OUString& rModule, const String& rGroupName )
+{
+ USHORT nIndex = 0;
+ while ( ModuleMap[ nIndex ].m_pModule )
+ {
+ rtl::OUString sTemp =
+ rtl::OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule );
+ if ( sTemp == rModule )
+ {
+ ModuleMap[ nIndex ].m_sGroupName = rGroupName;
+ break;
+ }
+ ++nIndex;
+ }
+}
+
+static String getGroupName( const rtl::OUString& rModule, bool bForced )
+{
+ String sGroupName;
+ USHORT nIndex = 0;
+ while ( ModuleMap[ nIndex ].m_pModule )
+ {
+ rtl::OUString sTemp =
+ rtl::OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule );
+ if ( sTemp == rModule )
+ {
+ sGroupName = ModuleMap[ nIndex ].m_sGroupName;
+ break;
+ }
+ ++nIndex;
+ }
+
+ if ( sGroupName.Len() == 0 && bForced )
+ {
+ if ( !pPageRes )
+ pPageRes = new OfaPageResource;
+
+ if ( rModule == C2U("Writer") )
+ sGroupName = pPageRes->GetTextArray().GetString(0);
+ else if ( rModule == C2U("WriterWeb") )
+ sGroupName = pPageRes->GetHTMLArray().GetString(0);
+ else if ( rModule == C2U("Calc") )
+ sGroupName = pPageRes->GetCalcArray().GetString(0);
+ else if ( rModule == C2U("Impress") )
+ sGroupName = pPageRes->GetImpressArray().GetString(0);
+ else if ( rModule == C2U("Draw") )
+ sGroupName = pPageRes->GetDrawArray().GetString(0);
+ else if ( rModule == C2U("Math") )
+ sGroupName = pPageRes->GetStarMathArray().GetString(0);
+ else if ( rModule == C2U("Base") )
+ sGroupName = pPageRes->GetDatasourcesArray().GetString(0);
+ }
+ return sGroupName;
+}
+
+static void deleteGroupNames()
+{
+ USHORT nIndex = 0;
+ while ( ModuleMap[ nIndex ].m_pModule )
+ ModuleMap[ nIndex++ ].m_sGroupName = String::EmptyString();
+}
+
+static USHORT getGroupNodeId( const rtl::OUString& rModule )
+{
+ USHORT nNodeId = 0xFFFF, nIndex = 0;
+ while ( ModuleMap[ nIndex ].m_pModule )
+ {
+ rtl::OUString sTemp =
+ rtl::OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule );
+ if ( sTemp == rModule )
+ {
+ nNodeId = ModuleMap[ nIndex ].m_nNodeId;
+ break;
+ }
+ ++nIndex;
+ }
+
+ return nNodeId;
+}
+
+/*-- 29.10.2004 13:57:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class MailMergeCfg_Impl : public utl::ConfigItem
+{
+ friend class SvxEMailTabPage;
+ // variables
+ sal_Bool bIsEmailSupported;
+
+public:
+ MailMergeCfg_Impl();
+ virtual ~MailMergeCfg_Impl();
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames);
+
+ sal_Bool IsEmailSupported() const {return bIsEmailSupported;}
+
+};
+/*-- 29.10.2004 13:57:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+MailMergeCfg_Impl::MailMergeCfg_Impl() :
+ utl::ConfigItem(C2U("Office.Writer/MailMergeWizard")),
+ bIsEmailSupported(sal_False)
+{
+ Sequence<rtl::OUString> aNames(1);
+ aNames.getArray()[0] = C2U("EMailSupported");
+ const Sequence< Any > aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ if(aValues.getLength() && pValues[0].hasValue())
+ pValues[0] >>= bIsEmailSupported;
+}
+/*-- 29.10.2004 13:57:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+MailMergeCfg_Impl::~MailMergeCfg_Impl()
+{
+}
+/* -------------------------------------------------------------------------*/
+void MailMergeCfg_Impl::Commit()
+{
+}
+
+void MailMergeCfg_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{
+}
+
+//typedef SfxTabPage* (*FNCreateTabPage)( Window *pParent, const SfxItemSet &rAttrSet );
+SfxTabPage* CreateGeneralTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet )
+{
+ CreateTabPage fnCreate = 0;
+ switch(nId)
+ {
+ case RID_SFXPAGE_SAVE: fnCreate = &SvxSaveTabPage::Create; break;
+ case RID_SFXPAGE_PATH: fnCreate = &SvxPathTabPage::Create; break;
+ case RID_SFXPAGE_GENERAL: fnCreate = &SvxGeneralTabPage::Create; break;
+ case RID_SFXPAGE_PRINTOPTIONS: fnCreate = &SfxCommonPrintOptionsTabPage::Create; break;
+ case OFA_TP_LANGUAGES: fnCreate = &OfaLanguagesTabPage::Create; break;
+ case RID_SFXPAGE_LINGU: fnCreate = &SvxLinguTabPage::Create; break;
+ case RID_SVXPAGE_COLOR: fnCreate = &SvxColorTabPage::Create; break;
+ case OFA_TP_VIEW: fnCreate = &OfaViewTabPage::Create; break;
+ case OFA_TP_MISC: fnCreate = &OfaMiscTabPage::Create; break;
+ case OFA_TP_MEMORY: fnCreate = &OfaMemoryOptionsPage::Create; break;
+ case RID_SVXPAGE_ASIAN_LAYOUT: fnCreate = &SvxAsianLayoutPage::Create; break;
+ case RID_SVX_FONT_SUBSTITUTION: fnCreate = &SvxFontSubstTabPage::Create; break;
+ case RID_SVXPAGE_INET_PROXY: fnCreate = &SvxProxyTabPage::Create; break;
+ case RID_SVXPAGE_INET_SEARCH: fnCreate = &SvxSearchTabPage::Create; break;
+ case RID_SVXPAGE_INET_SECURITY: fnCreate = &SvxSecurityTabPage::Create; break;
+ case RID_SVXPAGE_INET_MAIL: fnCreate = &SvxEMailTabPage::Create; break;
+ case RID_SVXPAGE_COLORCONFIG: fnCreate = &SvxColorOptionsTabPage::Create; break;
+ case RID_OFAPAGE_HTMLOPT: fnCreate = &OfaHtmlTabPage::Create; break;
+ case SID_OPTFILTER_MSOFFICE: fnCreate = &OfaMSFilterTabPage::Create; break;
+ case RID_OFAPAGE_MSFILTEROPT2: fnCreate = &OfaMSFilterTabPage2::Create; break;
+ case RID_SVXPAGE_JSEARCH_OPTIONS: fnCreate = &SvxJSearchOptionsPage::Create ; break;
+ case SID_SB_CONNECTIONPOOLING: fnCreate = &::offapp::ConnectionPoolOptionsPage::Create; break;
+ case SID_SB_DBREGISTEROPTIONS: fnCreate = &::svx::DbRegistrationOptionsPage::Create; break;
+ case RID_SVXPAGE_ACCESSIBILITYCONFIG: fnCreate = &SvxAccessibilityOptionsTabPage::Create; break;
+ case RID_SVXPAGE_SSO: fnCreate = GetSSOCreator(); break;
+ case RID_SVXPAGE_OPTIONS_CTL: fnCreate = &SvxCTLOptionsPage::Create ; break;
+ //added by jmeng begin
+ case RID_SVXPAGE_INET_MOZPLUGIN: fnCreate = &MozPluginTabPage::Create; break;
+ //added by jmeng end
+ case RID_SVXPAGE_OPTIONS_JAVA: fnCreate = &SvxJavaOptionsPage::Create ; break;
+ case RID_SVXPAGE_ONLINEUPDATE: fnCreate = &SvxOnlineUpdateTabPage::Create; break;
+ case RID_OPTPAGE_CHART_DEFCOLORS: fnCreate = &SvxDefaultColorOptPage::Create; break;
+ case RID_SVXPAGE_IMPROVEMENT: fnCreate = &SvxImprovementOptionsPage::Create; break;
+ }
+
+ SfxTabPage* pRet = fnCreate ? (*fnCreate)( pParent, rSet ) : NULL;
+ return pRet;
+}
+
+
+struct OptionsMapping_Impl
+{
+ const char* m_pGroupName;
+ const char* m_pPageName;
+ USHORT m_nPageId;
+};
+
+static OptionsMapping_Impl __READONLY_DATA OptionsMap_Impl[] =
+{
+// GROUP PAGE PAGE-ID
+ { "ProductName", NULL, SID_GENERAL_OPTIONS },
+ { "ProductName", "UserData", RID_SFXPAGE_GENERAL },
+ { "ProductName", "General", OFA_TP_MISC },
+ { "ProductName", "Memory", OFA_TP_MEMORY },
+ { "ProductName", "View", OFA_TP_VIEW },
+ { "ProductName", "Print", RID_SFXPAGE_PRINTOPTIONS },
+ { "ProductName", "Paths", RID_SFXPAGE_PATH },
+ { "ProductName", "Colors", RID_SVXPAGE_COLOR },
+ { "ProductName", "Fonts", RID_SVX_FONT_SUBSTITUTION },
+ { "ProductName", "Security", RID_SVXPAGE_INET_SECURITY },
+ { "ProductName", "Appearance", RID_SVXPAGE_COLORCONFIG },
+ { "ProductName", "Accessibility", RID_SVXPAGE_ACCESSIBILITYCONFIG },
+ { "ProductName", "Java", RID_SVXPAGE_OPTIONS_JAVA },
+ { "ProductName", "NetworkIdentity", RID_SVXPAGE_SSO },
+ { "ProductName", "OnlineUpdate", RID_SVXPAGE_ONLINEUPDATE },
+ { "ProductName", "ImprovementProgram", RID_SVXPAGE_IMPROVEMENT },
+ { "LanguageSettings", NULL, SID_LANGUAGE_OPTIONS },
+ { "LanguageSettings", "Languages", OFA_TP_LANGUAGES },
+ { "LanguageSettings", "WritingAids", RID_SFXPAGE_LINGU },
+ { "LanguageSettings", "SearchingInJapanese", RID_SVXPAGE_JSEARCH_OPTIONS },
+ { "LanguageSettings", "AsianLayout", RID_SVXPAGE_ASIAN_LAYOUT },
+ { "LanguageSettings", "ComplexTextLayout", RID_SVXPAGE_OPTIONS_CTL },
+ { "Internet", NULL, SID_INET_DLG },
+ { "Internet", "Proxy", RID_SVXPAGE_INET_PROXY },
+ { "Internet", "Search", RID_SVXPAGE_INET_SEARCH },
+ { "Internet", "Email", RID_SVXPAGE_INET_MAIL },
+ { "Internet", "MozillaPlugin", RID_SVXPAGE_INET_MOZPLUGIN },
+ { "LoadSave", NULL, SID_FILTER_DLG },
+ { "LoadSave", "General", RID_SFXPAGE_SAVE },
+ { "LoadSave", "VBAProperties", SID_OPTFILTER_MSOFFICE },
+ { "LoadSave", "MicrosoftOffice", RID_OFAPAGE_MSFILTEROPT2 },
+ { "LoadSave", "HTMLCompatibility", RID_OFAPAGE_HTMLOPT },
+ { "Writer", NULL, SID_SW_EDITOPTIONS },
+ { "Writer", "General", RID_SW_TP_OPTLOAD_PAGE },
+ { "Writer", "View", RID_SW_TP_CONTENT_OPT },
+ { "Writer", "FormattingAids", RID_SW_TP_OPTSHDWCRSR },
+ { "Writer", "Grid", RID_SVXPAGE_GRID },
+ { "Writer", "BasicFontsWestern", RID_SW_TP_STD_FONT },
+ { "Writer", "BasicFontsAsian", RID_SW_TP_STD_FONT_CJK },
+ { "Writer", "BasicFontsCTL", RID_SW_TP_STD_FONT_CTL },
+ { "Writer", "Print", RID_SW_TP_OPTPRINT_PAGE },
+ { "Writer", "Table", RID_SW_TP_OPTTABLE_PAGE },
+ { "Writer", "Changes", RID_SW_TP_REDLINE_OPT },
+ { "Writer", "Compatibility", RID_SW_TP_OPTCOMPATIBILITY_PAGE },
+ { "Writer", "AutoCaption", RID_SW_TP_OPTCAPTION_PAGE },
+ { "Writer", "MailMerge", RID_SW_TP_MAILCONFIG },
+ { "WriterWeb", NULL, SID_SW_ONLINEOPTIONS },
+ { "WriterWeb", "View", RID_SW_TP_HTML_CONTENT_OPT },
+ { "WriterWeb", "FormattingAids", RID_SW_TP_HTML_OPTSHDWCRSR },
+ { "WriterWeb", "Grid", RID_SW_TP_HTML_OPTGRID_PAGE },
+ { "WriterWeb", "Print", RID_SW_TP_HTML_OPTPRINT_PAGE },
+ { "WriterWeb", "Table", RID_SW_TP_HTML_OPTTABLE_PAGE },
+ { "WriterWeb", "Background", RID_SW_TP_BACKGROUND },
+ { "Math", NULL, SID_SM_EDITOPTIONS },
+ { "Math", "Settings", SID_SM_TP_PRINTOPTIONS },
+ { "Calc", NULL, SID_SC_EDITOPTIONS },
+ { "Calc", "General", SID_SC_TP_LAYOUT },
+ { "Calc", "View", SID_SC_TP_CONTENT },
+ { "Calc", "International", RID_OFA_TP_INTERNATIONAL },
+ { "Calc", "Calculate", SID_SC_TP_CALC },
+ { "Calc", "SortLists", SID_SC_TP_USERLISTS },
+ { "Calc", "Changes", SID_SC_TP_CHANGES },
+ { "Calc", "Grid", SID_SC_TP_GRID },
+ { "Calc", "Print", RID_SC_TP_PRINT },
+ { "Impress", NULL, SID_SD_EDITOPTIONS },
+ { "Impress", "General", SID_SI_TP_MISC },
+ { "Impress", "View", SID_SI_TP_CONTENTS },
+ { "Impress", "Grid", SID_SI_TP_SNAP },
+ { "Impress", "Print", SID_SI_TP_PRINT },
+ { "Draw", NULL, SID_SD_GRAPHIC_OPTIONS },
+ { "Draw", "General", SID_SD_TP_MISC },
+ { "Draw", "View", SID_SD_TP_CONTENTS },
+ { "Draw", "Grid", SID_SD_TP_SNAP },
+ { "Draw", "Print", SID_SD_TP_PRINT },
+ { "Charts", NULL, SID_SCH_EDITOPTIONS },
+ { "Charts", "DefaultColors", RID_OPTPAGE_CHART_DEFCOLORS },
+ { "Base", NULL, SID_SB_STARBASEOPTIONS },
+ { "Base", "Connections", SID_SB_CONNECTIONPOOLING },
+ { "Base", "Databases", SID_SB_DBREGISTEROPTIONS },
+ { NULL, NULL, 0 }
+};
+
+static sal_Bool lcl_getStringFromID( USHORT _nPageId, String& _rGroupName, String& _rPageName )
+{
+ sal_Bool bRet = sal_False;
+
+ USHORT nIdx = 0;
+ while ( OptionsMap_Impl[nIdx].m_pGroupName != NULL )
+ {
+ if ( _nPageId == OptionsMap_Impl[nIdx].m_nPageId )
+ {
+ bRet = sal_True;
+ _rGroupName = String( OptionsMap_Impl[nIdx].m_pGroupName, RTL_TEXTENCODING_ASCII_US );
+ if ( OptionsMap_Impl[nIdx].m_pPageName != NULL )
+ _rPageName = String( OptionsMap_Impl[nIdx].m_pPageName, RTL_TEXTENCODING_ASCII_US );
+ break;
+ }
+ ++nIdx;
+ }
+
+ return bRet;
+}
+
+static sal_Bool lcl_isOptionHidden( USHORT _nPageId, const SvtOptionsDialogOptions& _rOptOptions )
+{
+ sal_Bool bIsHidden = sal_False;
+ String sGroupName, sPageName;
+ if ( lcl_getStringFromID( _nPageId, sGroupName, sPageName ) )
+ {
+ if ( sPageName.Len() == 0 )
+ bIsHidden = _rOptOptions.IsGroupHidden( sGroupName );
+ else
+ bIsHidden = _rOptOptions.IsPageHidden( sPageName, sGroupName );
+ }
+ return bIsHidden;
+}
+
+/* -----------------11.02.99 09:56-------------------
+ *
+ * --------------------------------------------------*/
+struct OptionsPageInfo
+{
+ SfxTabPage* m_pPage;
+ sal_uInt16 m_nPageId;
+ rtl::OUString m_sPageURL;
+ rtl::OUString m_sEventHdl;
+ ExtensionsTabPage* m_pExtPage;
+
+ OptionsPageInfo( sal_uInt16 nId ) : m_pPage( NULL ), m_nPageId( nId ), m_pExtPage( NULL ) {}
+};
+
+struct OptionsGroupInfo
+{
+ SfxItemSet* m_pInItemSet;
+ SfxItemSet* m_pOutItemSet;
+ SfxShell* m_pShell; // used to create the page
+ SfxModule* m_pModule; // used to create the ItemSet
+ sal_uInt16 m_nDialogId; // Id of the former dialog
+ sal_Bool m_bLoadError; // load fails?
+ rtl::OUString m_sPageURL;
+ ExtensionsTabPage* m_pExtPage;
+
+ OptionsGroupInfo( SfxShell* pSh, SfxModule* pMod, sal_uInt16 nId ) :
+ m_pInItemSet( NULL ), m_pOutItemSet( NULL ), m_pShell( pSh ),
+ m_pModule( pMod ), m_nDialogId( nId ), m_bLoadError( sal_False ),
+ m_sPageURL( rtl::OUString() ), m_pExtPage( NULL ) {}
+ ~OptionsGroupInfo() { delete m_pInItemSet; delete m_pOutItemSet; }
+};
+
+/* -----------------04.05.99 15:51-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool OfaOptionsTreeListBox::Collapse( SvLBoxEntry* pParent )
+{
+ bInCollapse = sal_True;
+ sal_Bool bRet = SvTreeListBox::Collapse(pParent);
+ bInCollapse = sal_False;
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+#define INI_LIST() \
+ aOkPB ( this, SVX_RES( PB_OK ) ),\
+ aCancelPB ( this, SVX_RES( PB_CANCEL ) ),\
+ aHelpPB ( this, SVX_RES( PB_HELP ) ),\
+ aBackPB ( this, SVX_RES( PB_BACK ) ),\
+ aHiddenGB ( this, SVX_RES( FB_BORDER ) ),\
+ aPageTitleFT ( this, SVX_RES( FT_PAGE_TITLE ) ),\
+ aLine1FL ( this, SVX_RES( FL_LINE_1 ) ),\
+ aHelpFT ( this, SVX_RES( FT_HELPTEXT ) ),\
+ aHelpImg ( this, SVX_RES( IMG_HELP ) ),\
+ aHelpTextsArr ( SVX_RES( STR_HELPTEXTS ) ),\
+ aTreeLB ( this, SVX_RES( TLB_PAGES ) ),\
+ sTitle ( GetText() ),\
+ sNotLoadedError ( SVX_RES( ST_LOAD_ERROR ) ),\
+ pCurrentPageEntry ( NULL ),\
+ pColorPageItemSet ( NULL ),\
+ pColorTab ( NULL ),\
+ nChangeType ( CT_NONE ),\
+ nUnknownType ( COLORPAGE_UNKNOWN ),\
+ nUnknownPos ( COLORPAGE_UNKNOWN ),\
+ bIsAreaTP ( sal_False ),\
+ bForgetSelection ( sal_False ),\
+ bImageResized ( sal_False ),\
+ bInSelectHdl_Impl ( false ),\
+ bIsFromExtensionManager( false ), \
+ bIsForSetDocumentLanguage( false )
+
+// Ctor() with Frame -----------------------------------------------------
+using namespace ::com::sun::star;
+OfaTreeOptionsDialog::OfaTreeOptionsDialog(
+ Window* pParent,
+ const Reference< XFrame >& _xFrame,
+ bool bActivateLastSelection ) :
+
+ SfxModalDialog( pParent, SVX_RES( RID_OFADLG_OPTIONS_TREE ) ),
+ INI_LIST()
+{
+ FreeResource();
+
+ InitTreeAndHandler();
+ Initialize( _xFrame );
+ LoadExtensionOptions( rtl::OUString() );
+ ResizeTreeLB();
+ if (bActivateLastSelection)
+ ActivateLastSelection();
+}
+
+// Ctor() with ExtensionId -----------------------------------------------
+
+OfaTreeOptionsDialog::OfaTreeOptionsDialog( Window* pParent, const rtl::OUString& rExtensionId ) :
+
+ SfxModalDialog( pParent, SVX_RES( RID_OFADLG_OPTIONS_TREE ) ),
+
+ INI_LIST()
+
+{
+ FreeResource();
+
+ bIsFromExtensionManager = ( rExtensionId.getLength() > 0 );
+ InitTreeAndHandler();
+ LoadExtensionOptions( rExtensionId );
+ ResizeTreeLB();
+ ActivateLastSelection();
+}
+
+/* -----------------11.02.99 07:58-------------------
+ *
+ * --------------------------------------------------*/
+
+OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
+{
+ SvLBoxEntry* pEntry = aTreeLB.First();
+ // first children
+ while(pEntry)
+ {
+ // if Child (has parent), then OptionsPageInfo
+ if(aTreeLB.GetParent(pEntry))
+ {
+ OptionsPageInfo *pPageInfo = (OptionsPageInfo *)pEntry->GetUserData();
+ if(pPageInfo->m_pPage)
+ {
+ pPageInfo->m_pPage->FillUserData();
+ String aPageData(pPageInfo->m_pPage->GetUserData());
+ if ( aPageData.Len() )
+ {
+ SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pPageInfo->m_nPageId ) );
+ SetViewOptUserItem( aTabPageOpt, aPageData );
+ }
+ delete pPageInfo->m_pPage;
+ }
+
+ if (pPageInfo->m_nPageId == RID_SFXPAGE_LINGU)
+ {
+ // write personal dictionaries
+ Reference< XDictionaryList > xDicList( SvxGetDictionaryList() );
+ if (xDicList.is())
+ {
+ linguistic::SaveDictionaries( xDicList );
+ }
+ }
+
+ if( pPageInfo->m_pExtPage )
+ delete pPageInfo->m_pExtPage;
+
+ delete pPageInfo;
+ }
+ pEntry = aTreeLB.Next(pEntry);
+ }
+
+ // and parents
+ pEntry = aTreeLB.First();
+ while(pEntry)
+ {
+ if(!aTreeLB.GetParent(pEntry))
+ {
+ OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo*)pEntry->GetUserData();
+ if ( pGroupInfo && pGroupInfo->m_pExtPage )
+ delete pGroupInfo->m_pExtPage;
+ delete pGroupInfo;
+ }
+ pEntry = aTreeLB.Next(pEntry);
+ }
+ delete pColorPageItemSet;
+ deleteGroupNames();
+}
+
+/* -----------------11.02.99 08:21-------------------
+ *
+ * --------------------------------------------------*/
+OptionsPageInfo* OfaTreeOptionsDialog::AddTabPage(
+ sal_uInt16 nId, const String& rPageName, sal_uInt16 nGroup )
+{
+ OptionsPageInfo* pPageInfo = new OptionsPageInfo( nId );
+ SvLBoxEntry* pParent = aTreeLB.GetEntry( 0, nGroup );
+ DBG_ASSERT( pParent, "OfaTreeOptionsDialog::AddTabPage(): no group found" );
+ SvLBoxEntry* pEntry = aTreeLB.InsertEntry( rPageName, pParent );
+ pEntry->SetUserData( pPageInfo );
+ return pPageInfo;
+}
+
+/* -----------------11.02.99 10:02-------------------
+ * der ItemSet* geht in den Besitz des Dialogs
+ * --------------------------------------------------*/
+sal_uInt16 OfaTreeOptionsDialog::AddGroup(const String& rGroupName,
+ SfxShell* pCreateShell,
+ SfxModule* pCreateModule,
+ sal_uInt16 nDialogId )
+{
+ SvLBoxEntry* pEntry = aTreeLB.InsertEntry(rGroupName);
+ OptionsGroupInfo* pInfo =
+ new OptionsGroupInfo( pCreateShell, pCreateModule, nDialogId );
+ pEntry->SetUserData(pInfo);
+ sal_uInt16 nRet = 0;
+ pEntry = aTreeLB.First();
+ while(pEntry)
+ {
+ if(!aTreeLB.GetParent(pEntry))
+ nRet++;
+ pEntry = aTreeLB.Next(pEntry);
+ }
+ return nRet - 1;
+}
+
+/* -----------------11.02.99 10:31-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK(OfaTreeOptionsDialog, ShowPageHdl_Impl, SvTreeListBox*, EMPTYARG)
+{
+ if ( aSelectTimer.GetTimeout() == SELECT_FIRST_TIMEOUT )
+ {
+ aSelectTimer.SetTimeout( SELECT_TIMEOUT );
+ SelectHdl_Impl( NULL );
+ }
+ else if ( aSelectTimer.GetTimeout() == SELECT_TIMEOUT )
+ aSelectTimer.Start();
+
+ return 0;
+}
+/* -----------------11.02.99 10:49-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( OfaTreeOptionsDialog, BackHdl_Impl, PushButton*, EMPTYARG )
+{
+ if ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) )
+ {
+ OptionsPageInfo* pPageInfo = (OptionsPageInfo*)pCurrentPageEntry->GetUserData();
+ if ( pPageInfo->m_pPage )
+ {
+ OptionsGroupInfo* pGroupInfo =
+ (OptionsGroupInfo*)aTreeLB.GetParent( pCurrentPageEntry )->GetUserData();
+ if ( RID_SVXPAGE_COLOR == pPageInfo->m_nPageId )
+ pPageInfo->m_pPage->Reset( *pColorPageItemSet );
+ else
+ pPageInfo->m_pPage->Reset( *pGroupInfo->m_pInItemSet );
+ }
+ else if ( pPageInfo->m_pExtPage )
+ pPageInfo->m_pExtPage->ResetPage();
+ }
+ return 0;
+}
+/* -----------------11.02.99 16:45-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( OfaTreeOptionsDialog, OKHdl_Impl, Button *, EMPTYARG )
+{
+ aTreeLB.EndSelection();
+ if ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) )
+ {
+ OptionsPageInfo* pPageInfo = (OptionsPageInfo *)pCurrentPageEntry->GetUserData();
+ if ( pPageInfo->m_pPage )
+ {
+ OptionsGroupInfo* pGroupInfo =
+ (OptionsGroupInfo *)aTreeLB.GetParent(pCurrentPageEntry)->GetUserData();
+ if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId
+ && pPageInfo->m_pPage->HasExchangeSupport() )
+ {
+ int nLeave = pPageInfo->m_pPage->DeactivatePage(pGroupInfo->m_pOutItemSet);
+ if ( nLeave == SfxTabPage::KEEP_PAGE )
+ {
+ //die Seite darf nicht verlassen werden!
+ aTreeLB.Select(pCurrentPageEntry);
+ return 0;
+ }
+ }
+ pPageInfo->m_pPage->Hide();
+ }
+ }
+
+ SvLBoxEntry* pEntry = aTreeLB.First();
+ while ( pEntry )
+ {
+ if ( aTreeLB.GetParent( pEntry ) )
+ {
+ OptionsPageInfo* pPageInfo = (OptionsPageInfo *)pEntry->GetUserData();
+ if ( pPageInfo->m_pPage && !pPageInfo->m_pPage->HasExchangeSupport() )
+ {
+ OptionsGroupInfo* pGroupInfo =
+ (OptionsGroupInfo*)aTreeLB.GetParent(pEntry)->GetUserData();
+ pPageInfo->m_pPage->FillItemSet(*pGroupInfo->m_pOutItemSet);
+ }
+
+ if ( pPageInfo->m_pExtPage )
+ {
+ pPageInfo->m_pExtPage->DeactivatePage();
+ pPageInfo->m_pExtPage->SavePage();
+ }
+ }
+ pEntry = aTreeLB.Next(pEntry);
+ }
+ EndDialog(RET_OK);
+ return 0;
+}
+
+/* -----------------17.02.99 09:15-------------------
+ * Eine aufgeklappte Gruppe soll vollstaendig sichtbar sein
+ * --------------------------------------------------*/
+IMPL_LINK(OfaTreeOptionsDialog, ExpandedHdl_Impl, SvTreeListBox*, pBox )
+{
+ pBox->Update();
+ pBox->InitStartEntry();
+ SvLBoxEntry* pEntry = pBox->GetHdlEntry();
+ if(pEntry && pBox->IsExpanded(pEntry))
+ {
+ sal_uInt32 nChildCount = pBox->GetChildCount( pEntry );
+
+ SvLBoxEntry* pNext = pEntry;
+ for(sal_uInt32 i = 0; i < nChildCount;i++)
+ {
+ pNext = pBox->GetNextEntryInView(pNext);
+ if(!pNext)
+ {
+ pBox->ScrollOutputArea( -(short)(nChildCount - i + 1) );
+ break;
+ }
+ else
+ {
+ Size aSz(pBox->GetOutputSizePixel());
+ int nHeight = pBox->GetEntryHeight();
+ Point aPos(pBox->GetEntryPosition(pNext));
+ if(aPos.Y()+nHeight > aSz.Height())
+ {
+ pBox->ScrollOutputArea( -(short)(nChildCount - i + 1) );
+ break;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+/* -----------------11.02.99 10:49-------------------
+ *
+ * --------------------------------------------------*/
+void OfaTreeOptionsDialog::ApplyItemSets()
+{
+ SvLBoxEntry* pEntry = aTreeLB.First();
+ while(pEntry)
+ {
+ if(!aTreeLB.GetParent(pEntry))
+ {
+ OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo *)pEntry->GetUserData();
+ if(pGroupInfo->m_pOutItemSet)
+ {
+ if(pGroupInfo->m_pShell)
+ pGroupInfo->m_pShell->ApplyItemSet( pGroupInfo->m_nDialogId, *pGroupInfo->m_pOutItemSet);
+ else
+ ApplyItemSet( pGroupInfo->m_nDialogId, *pGroupInfo->m_pOutItemSet);
+ }
+ }
+ pEntry = aTreeLB.Next(pEntry);
+ }
+}
+
+void OfaTreeOptionsDialog::InitTreeAndHandler()
+{
+ aTreeLB.SetNodeDefaultImages();
+
+ String sResName = String::CreateFromAscii( "iso" );
+ ResMgr* pIsoRes = ResMgr::CreateResMgr( ::rtl::OUStringToOString( sResName, RTL_TEXTENCODING_UTF8 ) );
+ if ( !pIsoRes )
+ {
+ // Fallback: Use ooo resource file
+ String sOOoName = String::CreateFromAscii( "ooo" );
+ pIsoRes = ResMgr::CreateResMgr( ::rtl::OUStringToOString( sOOoName, RTL_TEXTENCODING_UTF8 ) );
+ }
+
+ //! ResMgr* pIsoRes = SFX_APP()->GetLabelResManager();
+ ResId aImgLstRes( RID_IMGLIST_TREEOPT, *pIsoRes );
+ aImgLstRes.SetRT( RSC_IMAGELIST );
+ if ( pIsoRes->IsAvailable( aImgLstRes ) )
+ aPageImages = ImageList( ResId( RID_IMGLIST_TREEOPT, *pIsoRes ) );
+ ResId aImgLstHCRes( RID_IMGLIST_TREEOPT_HC, *pIsoRes );
+ aImgLstHCRes.SetRT( RSC_IMAGELIST );
+ if ( pIsoRes->IsAvailable( aImgLstHCRes ) )
+ aPageImagesHC = ImageList( ResId( RID_IMGLIST_TREEOPT_HC, *pIsoRes ) );
+ delete pIsoRes;
+
+ aTreeLB.SetHelpId( HID_OFADLG_TREELISTBOX );
+ aTreeLB.SetWindowBits( WB_HASBUTTONS | WB_HASBUTTONSATROOT |
+ WB_HASLINES | WB_HASLINESATROOT |
+ WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE );
+ aTreeLB.SetSpaceBetweenEntries( 0 );
+ aTreeLB.SetSelectionMode( SINGLE_SELECTION );
+ aTreeLB.SetSublistOpenWithLeftRight( TRUE );
+ aTreeLB.SetExpandedHdl( LINK( this, OfaTreeOptionsDialog, ExpandedHdl_Impl ) );
+ aTreeLB.SetSelectHdl( LINK( this, OfaTreeOptionsDialog, ShowPageHdl_Impl ) );
+ aBackPB.SetClickHdl( LINK( this, OfaTreeOptionsDialog, BackHdl_Impl ) );
+ aOkPB.SetClickHdl( LINK( this, OfaTreeOptionsDialog, OKHdl_Impl ) );
+
+ aHiddenGB.Show();
+ aSelectTimer.SetTimeout( SELECT_FIRST_TIMEOUT );
+ aSelectTimer.SetTimeoutHdl( LINK( this, OfaTreeOptionsDialog, SelectHdl_Impl ) );
+}
+
+/* -----------------17.02.99 09:51-------------------
+ *
+ * --------------------------------------------------*/
+void OfaTreeOptionsDialog::ActivatePage( sal_uInt16 nResId )
+{
+ bIsForSetDocumentLanguage = false;
+ if ( nResId == OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE )
+ {
+ bIsForSetDocumentLanguage = true;
+ nResId = OFA_TP_LANGUAGES;
+ }
+
+ DBG_ASSERT( !bIsFromExtensionManager, "OfaTreeOptionsDialog::ActivatePage(): call from extension manager" );
+ if ( !pLastPageSaver )
+ pLastPageSaver = new LastPageSaver;
+ bForgetSelection = sal_True;
+ sal_uInt16 nTemp = pLastPageSaver->m_nLastPageId;
+ pLastPageSaver->m_nLastPageId = nResId;
+ ActivateLastSelection();
+ pLastPageSaver->m_nLastPageId = nTemp;
+}
+
+void OfaTreeOptionsDialog::ActivatePage( const String& rPageURL )
+{
+ DBG_ASSERT( !bIsFromExtensionManager, "OfaTreeOptionsDialog::ActivatePage(): call from extension manager" );
+ if ( !pLastPageSaver )
+ pLastPageSaver = new LastPageSaver;
+ bForgetSelection = sal_True;
+ pLastPageSaver->m_nLastPageId = 0;
+ pLastPageSaver->m_sLastPageURL_Tools = rPageURL;
+ ActivateLastSelection();
+}
+
+/* -----------------16.02.99 13:17-------------------
+ *
+ * --------------------------------------------------*/
+void OfaTreeOptionsDialog::ActivateLastSelection()
+{
+ SvLBoxEntry* pEntry = NULL;
+ if ( pLastPageSaver )
+ {
+ String sExpand( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL ) );
+ String sLastURL = bIsFromExtensionManager ? pLastPageSaver->m_sLastPageURL_ExtMgr
+ : pLastPageSaver->m_sLastPageURL_Tools;
+ if ( sLastURL.Len() == 0 )
+ {
+ sLastURL = !bIsFromExtensionManager ? pLastPageSaver->m_sLastPageURL_ExtMgr
+ : pLastPageSaver->m_sLastPageURL_Tools;
+ }
+
+ // MacroExpander to convert "expand"-URL to "file"-URL
+ Reference< XMacroExpander > m_xMacroExpander;
+ bool bMustExpand = ( INetURLObject( sLastURL ).GetProtocol() == INET_PROT_FILE );
+
+ if ( bMustExpand )
+ {
+ Reference< XComponentContext > xContext;
+ Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
+ xProps->getPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ) >>= xContext;
+ if ( xContext.is() )
+ m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >(
+ xContext->getValueByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "/singletons/com.sun.star.util.theMacroExpander" ) ) ), UNO_QUERY );
+ }
+
+ SvLBoxEntry* pTemp = aTreeLB.First();
+ while( !pEntry && pTemp )
+ {
+ // restore only selection of a leaf
+ if ( aTreeLB.GetParent( pTemp ) && pTemp->GetUserData() )
+ {
+ OptionsPageInfo* pPageInfo = (OptionsPageInfo*)pTemp->GetUserData();
+ String sPageURL = pPageInfo->m_sPageURL;
+ if ( bMustExpand
+ && sPageURL.Len() > 0
+ && sExpand.Match( sPageURL ) == STRING_MATCH )
+ {
+ // cut protocol
+ ::rtl::OUString sTemp( sPageURL.Copy( sizeof( EXPAND_PROTOCOL ) -1 ) );
+ // decode uri class chars
+ sTemp = ::rtl::Uri::decode(
+ sTemp, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
+ // expand string
+ sPageURL = m_xMacroExpander->expandMacros( sTemp );
+ }
+
+ if ( ( !bIsFromExtensionManager
+ && pPageInfo->m_nPageId && pPageInfo->m_nPageId == pLastPageSaver->m_nLastPageId )
+ || ( !pPageInfo->m_nPageId && sLastURL == sPageURL ) )
+ pEntry = pTemp;
+ }
+ pTemp = aTreeLB.Next(pTemp);
+ }
+ }
+
+ if ( !pEntry )
+ {
+ pEntry = aTreeLB.First();
+ pEntry = aTreeLB.Next(pEntry);
+ }
+
+ SvLBoxEntry* pParent = aTreeLB.GetParent(pEntry);
+ aTreeLB.Expand(pParent);
+ aTreeLB.MakeVisible(pParent);
+ aTreeLB.MakeVisible(pEntry);
+ aTreeLB.Select(pEntry);
+ aTreeLB.GrabFocus();
+}
+
+/* -----------------22.02.99 08:52-------------------
+ *
+ * --------------------------------------------------*/
+long OfaTreeOptionsDialog::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ const KeyCode aKeyCode = pKEvt->GetKeyCode();
+
+ if( aKeyCode.GetCode() == KEY_PAGEUP ||
+ aKeyCode.GetCode() == KEY_PAGEDOWN)
+ {
+ SvLBoxEntry* pCurEntry = aTreeLB.FirstSelected();
+ SvLBoxEntry* pTemp = 0;
+ if(aKeyCode.GetCode() == KEY_PAGEDOWN)
+ {
+ pTemp = aTreeLB.Next( pCurEntry ) ;
+ if(pTemp && !aTreeLB.GetParent(pTemp))
+ {
+ pTemp = aTreeLB.Next( pTemp ) ;
+ aTreeLB.Select(pTemp);
+ }
+ }
+ else
+ {
+ pTemp = aTreeLB.Prev( pCurEntry ) ;
+ if(pTemp && !aTreeLB.GetParent(pTemp))
+ {
+ pTemp = aTreeLB.Prev( pTemp ) ;
+ }
+ }
+ if(pTemp)
+ {
+ if(!aTreeLB.IsExpanded(aTreeLB.GetParent(pTemp)))
+ aTreeLB.Expand(aTreeLB.GetParent(pTemp));
+ aTreeLB.MakeVisible(pTemp);
+ aTreeLB.Select(pTemp);
+ }
+ }
+ }
+ return SfxModalDialog::Notify(rNEvt);
+}
+
+// --------------------------------------------------------------------
+
+void OfaTreeOptionsDialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxModalDialog::DataChanged( rDCEvt );
+
+ SvLBoxEntry* pEntry = aTreeLB.GetCurEntry();
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) &&
+ !aTreeLB.GetParent(pEntry))
+ {
+ OptionsGroupInfo* pInfo = static_cast<OptionsGroupInfo*>(pEntry->GetUserData());
+ bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
+ ImageList* pImgLst = bHighContrast ? &aPageImagesHC : &aPageImages;
+ for ( sal_uInt16 i = 0; i < aHelpTextsArr.Count(); ++i )
+ {
+ if ( aHelpTextsArr.GetValue(i) == pInfo->m_nDialogId )
+ {
+ aHelpImg.SetImage( pImgLst->GetImage( pInfo->m_nDialogId ) );
+ break;
+ }
+ }
+ }
+}
+class FlagSet_Impl
+{
+ bool & rFlag;
+ public:
+ FlagSet_Impl(bool& bFlag) : rFlag(bFlag){rFlag = true;}
+ ~FlagSet_Impl(){rFlag = false;}
+};
+
+IMPL_LINK( OfaTreeOptionsDialog, SelectHdl_Impl, Timer*, EMPTYARG )
+{
+ SvTreeListBox* pBox = &aTreeLB;
+ SvLBoxEntry* pEntry = pBox->GetCurEntry();
+ SvLBoxEntry* pParent = pBox->GetParent(pEntry);
+ pBox->EndSelection();
+
+ DBG_ASSERT(!bInSelectHdl_Impl, "Timeout handler called twice");
+ if(bInSelectHdl_Impl || pCurrentPageEntry == pEntry)
+ return 0;
+ //#111938# lock the SelectHdl_Impl to prevent multiple executes
+ FlagSet_Impl aFlag(bInSelectHdl_Impl);
+ TabPage* pOldPage = NULL;
+ TabPage* pNewPage = NULL;
+ OptionsPageInfo* pOptPageInfo = ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) )
+ ? (OptionsPageInfo*)pCurrentPageEntry->GetUserData() : NULL;
+
+ if ( pOptPageInfo && pOptPageInfo->m_pPage && pOptPageInfo->m_pPage->IsVisible() )
+ {
+ pOldPage = pOptPageInfo->m_pPage;
+ OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo*)aTreeLB.GetParent(pCurrentPageEntry)->GetUserData();
+ int nLeave = SfxTabPage::LEAVE_PAGE;
+ if ( RID_SVXPAGE_COLOR != pOptPageInfo->m_nPageId && pOptPageInfo->m_pPage->HasExchangeSupport() )
+ nLeave = pOptPageInfo->m_pPage->DeactivatePage( pGroupInfo->m_pOutItemSet );
+
+ if ( nLeave == SfxTabPage::KEEP_PAGE )
+ {
+ // we cannot leave this page
+ pBox->Select( pCurrentPageEntry );
+ return 0;
+ }
+ else
+ pOptPageInfo->m_pPage->Hide();
+ }
+ else if ( pOptPageInfo && pOptPageInfo->m_pExtPage )
+ {
+ pOptPageInfo->m_pExtPage->Hide();
+ pOptPageInfo->m_pExtPage->DeactivatePage();
+ }
+ else if ( pCurrentPageEntry && !aTreeLB.GetParent( pCurrentPageEntry ) )
+ {
+ OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo*)pCurrentPageEntry->GetUserData();
+ if ( pGroupInfo && pGroupInfo->m_pExtPage )
+ {
+ pGroupInfo->m_pExtPage->Hide();
+ pGroupInfo->m_pExtPage->DeactivatePage();
+ }
+ }
+ if ( pParent )
+ {
+ aPageTitleFT.Hide();
+ aLine1FL.Hide();
+ aHelpFT.Hide();
+ aHelpImg.Hide();
+ OptionsPageInfo *pPageInfo = (OptionsPageInfo *)pEntry->GetUserData();
+ OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo *)pParent->GetUserData();
+ if(!pPageInfo->m_pPage && pPageInfo->m_nPageId > 0)
+ {
+ if(pGroupInfo->m_bLoadError)
+ return 0;
+ if ( RID_SVXPAGE_COLOR == pPageInfo->m_nPageId )
+ {
+ if(!pColorPageItemSet)
+ {
+ // Move usage of a static XOutdevItemPool instance here
+ if(!mpStaticXOutdevItemPool)
+ {
+ mpStaticXOutdevItemPool = new XOutdevItemPool();
+ }
+ pColorPageItemSet = new SfxItemSet( *mpStaticXOutdevItemPool, XATTR_FILLSTYLE, XATTR_FILLCOLOR);
+ pColorPageItemSet->Put( XFillColorItem() );
+ }
+ }
+ else
+ {
+ if(pGroupInfo->m_pModule /*&& !pGroupInfo->pModule->IsLoaded()*/)
+ {
+ SfxModule* pOldModule = pGroupInfo->m_pModule;
+ sal_Bool bIdentical = pGroupInfo->m_pModule == pGroupInfo->m_pShell;
+
+ WaitObject aWait(this);
+ //pGroupInfo->pModule = pGroupInfo->pModule->Load();
+ if(!pGroupInfo->m_pModule)
+ {
+ pGroupInfo->m_bLoadError = sal_True;
+ InfoBox(pBox, sNotLoadedError).Execute();
+ return 0;
+ }
+ if(bIdentical)
+ pGroupInfo->m_pShell = pGroupInfo->m_pModule;
+ //jetzt noch testen, ob es auch in anderen Gruppen das gleiche Module gab (z.B. Text+HTML)
+ SvLBoxEntry* pTemp = aTreeLB.First();
+ while(pTemp)
+ {
+ if(!aTreeLB.GetParent(pTemp) && pTemp != pEntry)
+ {
+ OptionsGroupInfo* pTGInfo = (OptionsGroupInfo *)pTemp->GetUserData();
+ if(pTGInfo->m_pModule == pOldModule)
+ {
+ pTGInfo->m_pModule = pGroupInfo->m_pModule;
+ if(bIdentical)
+ pTGInfo->m_pShell = pGroupInfo->m_pModule;
+ }
+ }
+ pTemp = aTreeLB.Next(pTemp);
+ }
+ }
+
+// if ( pPageInfo->nPageId != RID_OPTPAGE_CHART_DEFCOLORS )
+ {
+ if(!pGroupInfo->m_pInItemSet)
+ pGroupInfo->m_pInItemSet = pGroupInfo->m_pShell
+ ? pGroupInfo->m_pShell->CreateItemSet( pGroupInfo->m_nDialogId )
+ : CreateItemSet( pGroupInfo->m_nDialogId );
+ if(!pGroupInfo->m_pOutItemSet)
+ pGroupInfo->m_pOutItemSet = new SfxItemSet(
+ *pGroupInfo->m_pInItemSet->GetPool(),
+ pGroupInfo->m_pInItemSet->GetRanges());
+ }
+ }
+
+ if(pGroupInfo->m_pModule)
+ {
+ pPageInfo->m_pPage = pGroupInfo->m_pModule->CreateTabPage(
+ pPageInfo->m_nPageId, this, *pGroupInfo->m_pInItemSet );
+ }
+ else if(RID_SVXPAGE_COLOR != pPageInfo->m_nPageId)
+ pPageInfo->m_pPage = ::CreateGeneralTabPage( pPageInfo->m_nPageId, this, *pGroupInfo->m_pInItemSet );
+ else
+ {
+ pPageInfo->m_pPage = ::CreateGeneralTabPage(
+ pPageInfo->m_nPageId, this, *pColorPageItemSet );
+ SvxColorTabPage& rColPage = *(SvxColorTabPage*)pPageInfo->m_pPage;
+ const OfaPtrItem* pPtr = NULL;
+ if ( SfxViewFrame::Current() && SfxViewFrame::Current()->GetDispatcher() )
+ pPtr = (const OfaPtrItem*)SfxViewFrame::Current()->
+ GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON );
+ pColorTab = pPtr ? (XColorTable*)pPtr->GetValue() : XColorTable::GetStdColorTable();
+
+ rColPage.SetColorTable( pColorTab );
+ rColPage.SetPageType( &nUnknownType );
+ rColPage.SetDlgType( &nUnknownType );
+ rColPage.SetPos( &nUnknownPos );
+ rColPage.SetAreaTP( &bIsAreaTP );
+ rColPage.SetColorChgd( (ChangeType*)&nChangeType );
+ rColPage.Construct();
+ }
+
+ DBG_ASSERT( pPageInfo->m_pPage, "tabpage could not created");
+ if ( pPageInfo->m_pPage )
+ {
+ SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pPageInfo->m_nPageId ) );
+ pPageInfo->m_pPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) );
+
+ Point aTreePos(aTreeLB.GetPosPixel());
+ Size aTreeSize(aTreeLB.GetSizePixel());
+ Point aGBPos(aHiddenGB.GetPosPixel());
+ Size aPageSize(pPageInfo->m_pPage->GetSizePixel());
+ Size aGBSize(aHiddenGB.GetSizePixel());
+ Point aPagePos( aGBPos.X() + ( aGBSize.Width() - aPageSize.Width() ) / 2,
+ aGBPos.Y() + ( aGBSize.Height() - aPageSize.Height() ) / 2 );
+ pPageInfo->m_pPage->SetPosPixel( aPagePos );
+ if ( RID_SVXPAGE_COLOR == pPageInfo->m_nPageId )
+ {
+ pPageInfo->m_pPage->Reset( *pColorPageItemSet );
+ pPageInfo->m_pPage->ActivatePage( *pColorPageItemSet );
+ }
+ else
+ {
+ pPageInfo->m_pPage->Reset( *pGroupInfo->m_pInItemSet );
+ }
+ }
+ }
+ else if ( 0 == pPageInfo->m_nPageId && !pPageInfo->m_pExtPage )
+ {
+ if ( !m_xContainerWinProvider.is() )
+ {
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ m_xContainerWinProvider = Reference < awt::XContainerWindowProvider >(
+ xFactory->createInstance(
+ C2U("com.sun.star.awt.ContainerWindowProvider") ), UNO_QUERY );
+ DBG_ASSERT( m_xContainerWinProvider.is(), "service com.sun.star.awt.ContainerWindowProvider could not be loaded" );
+ }
+
+ pPageInfo->m_pExtPage = new ExtensionsTabPage(
+ this, 0, pPageInfo->m_sPageURL, pPageInfo->m_sEventHdl, m_xContainerWinProvider );
+ Size aSize = aHiddenGB.GetSizePixel();
+ aSize.Width() = aSize.Width() - 4;
+ aSize.Height() = aSize.Height() - 4;
+ Point aPos = aHiddenGB.GetPosPixel();
+ aPos.X() = aPos.X() + 2;
+ aPos.Y() = aPos.Y() + 2;
+ pPageInfo->m_pExtPage->SetPosSizePixel( aPos, aSize );
+ }
+
+ if ( pPageInfo->m_pPage )
+ {
+ if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId &&
+ pPageInfo->m_pPage->HasExchangeSupport())
+ {
+ pPageInfo->m_pPage->ActivatePage(*pGroupInfo->m_pOutItemSet);
+ }
+ pPageInfo->m_pPage->Show();
+ }
+ else if ( pPageInfo->m_pExtPage )
+ {
+ pPageInfo->m_pExtPage->Show();
+ pPageInfo->m_pExtPage->ActivatePage();
+ }
+
+ String sTmpTitle = sTitle;
+ sTmpTitle += String::CreateFromAscii(" - ");
+ sTmpTitle += aTreeLB.GetEntryText(pParent);
+ sTmpTitle += String::CreateFromAscii(" - ");
+ sTmpTitle += aTreeLB.GetEntryText(pEntry);
+ SetText(sTmpTitle);
+ pCurrentPageEntry = pEntry;
+ if ( !bForgetSelection )
+ {
+ if ( !pLastPageSaver )
+ pLastPageSaver = new LastPageSaver;
+ if ( !bIsFromExtensionManager )
+ pLastPageSaver->m_nLastPageId = pPageInfo->m_nPageId;
+ if ( pPageInfo->m_pExtPage )
+ {
+ if ( bIsFromExtensionManager )
+ pLastPageSaver->m_sLastPageURL_ExtMgr = pPageInfo->m_sPageURL;
+ else
+ pLastPageSaver->m_sLastPageURL_Tools = pPageInfo->m_sPageURL;
+ }
+ }
+ pNewPage = pPageInfo->m_pPage;
+ }
+ else
+ {
+ OptionsGroupInfo* pTGInfo = (OptionsGroupInfo *)pEntry->GetUserData();
+ if ( pTGInfo->m_sPageURL.getLength() == 0 )
+ {
+ bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
+ ImageList* pImgLst = bHighContrast ? &aPageImagesHC : &aPageImages;
+ //hier den Hilfetext anzeigen
+ for ( sal_uInt16 i = 0; i < aHelpTextsArr.Count(); ++i )
+ {
+ if ( aHelpTextsArr.GetValue(i) == pTGInfo->m_nDialogId )
+ {
+ aHelpFT.SetText(aHelpTextsArr.GetString(i));
+ aHelpImg.SetImage(pImgLst->GetImage(pTGInfo->m_nDialogId));
+ break;
+ }
+ }
+
+ aPageTitleFT.Show();
+ aLine1FL.Show();
+ aHelpFT.Show();
+ aHelpImg.Show();
+
+ //auf die Groesse der Bitmap anpassen
+ if(!bImageResized)
+ {
+ const long nCtrlDist = 2;
+ bImageResized = sal_True;
+ Point aImgPos(aHelpImg.GetPosPixel());
+ Size aImgSize(aHelpImg.GetSizePixel());
+ Point aTitlePos(aPageTitleFT.GetPosPixel());
+ Point aLinePos(aLine1FL.GetPosPixel());
+ Point aHelpPos(aHelpFT.GetPosPixel());
+ Size aHelpSize(aHelpFT.GetSizePixel());
+ long nXDiff = 0;
+ long nYDiff = 0;
+ if(aTitlePos.X() <= (aImgPos.X() + aImgSize.Width() + nCtrlDist))
+ {
+ nXDiff = aImgPos.X() + aImgSize.Width() + nCtrlDist - aTitlePos.X();
+ }
+ if(aLinePos.Y() <= (aImgPos.Y() + aImgSize.Height() + nCtrlDist))
+ {
+ nYDiff = aImgPos.Y() + aImgSize.Height() + nCtrlDist - aLinePos.Y();
+ }
+ aLinePos.Y() += nYDiff;
+ aLine1FL.SetPosPixel(aLinePos);
+
+ aTitlePos.X() += nXDiff;
+ aPageTitleFT.SetPosPixel(aTitlePos);
+
+ aHelpPos.X() += nXDiff;
+ aHelpPos.Y() += nYDiff;
+ aHelpSize.Width() -= nXDiff;
+ aHelpSize.Height() -= nYDiff;
+ aHelpFT.SetPosSizePixel(aHelpPos, aHelpSize);
+
+ Font aFont = aHelpFT.GetFont();
+ Size aSz = aFont.GetSize();
+ aSz.Height() = (aSz.Height() * 14 ) / 10;
+ aFont.SetSize(aSz);
+ aPageTitleFT.SetFont(aFont);
+ }
+
+ String sTmpTitle = sTitle;
+ sTmpTitle += String::CreateFromAscii(" - ");
+ aPageTitleFT.SetText(aTreeLB.GetEntryText(pEntry));
+ sTmpTitle += aPageTitleFT.GetText();
+ SetText(sTmpTitle);
+ pCurrentPageEntry = NULL;
+ }
+ else
+ {
+ if ( !pTGInfo->m_pExtPage )
+ {
+ if ( !m_xContainerWinProvider.is() )
+ {
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ m_xContainerWinProvider = Reference < awt::XContainerWindowProvider >(
+ xFactory->createInstance(
+ C2U("com.sun.star.awt.ContainerWindowProvider") ), UNO_QUERY );
+ DBG_ASSERT( m_xContainerWinProvider.is(), "service com.sun.star.awt.ContainerWindowProvider could not be loaded" );
+ }
+
+ pTGInfo->m_pExtPage =
+ new ExtensionsTabPage( this, 0, pTGInfo->m_sPageURL, rtl::OUString(), m_xContainerWinProvider );
+ Size aSize = aHiddenGB.GetSizePixel();
+ aSize.Width() = aSize.Width() - 4;
+ aSize.Height() = aSize.Height() - 4;
+ Point aPos = aHiddenGB.GetPosPixel();
+ aPos.X() = aPos.X() + 2;
+ aPos.Y() = aPos.Y() + 2;
+ pTGInfo->m_pExtPage->SetPosSizePixel( aPos, aSize );
+ }
+
+ if ( pTGInfo->m_pExtPage )
+ {
+ pTGInfo->m_pExtPage->Show();
+ pTGInfo->m_pExtPage->ActivatePage();
+ }
+
+ pCurrentPageEntry = pEntry;
+ }
+ }
+
+ // restore lost focus, if necessary
+ Window* pFocusWin = Application::GetFocusWindow();
+ // if the focused window is not the options treebox and the old page has the focus
+ if ( pFocusWin && pFocusWin != pBox && pOldPage && pOldPage->HasChildPathFocus() )
+ // then set the focus to the new page or if we are on a group set the focus to the options treebox
+ pNewPage ? pNewPage->GrabFocus() : pBox->GrabFocus();
+
+ return 0;
+}
+
+/* -----------------11.02.99 15:51-------------------
+ *
+ * --------------------------------------------------*/
+
+OfaPageResource::OfaPageResource() :
+ Resource(SVX_RES(RID_OFADLG_OPTIONS_TREE_PAGES)),
+ aGeneralDlgAry(SVX_RES(SID_GENERAL_OPTIONS)),
+ aInetDlgAry(SVX_RES(SID_INET_DLG)),
+ aLangDlgAry(SVX_RES(SID_LANGUAGE_OPTIONS)),
+ aTextDlgAry(SVX_RES(SID_SW_EDITOPTIONS)),
+ aHTMLDlgAry(SVX_RES(SID_SW_ONLINEOPTIONS)),
+ aCalcDlgAry(SVX_RES(SID_SC_EDITOPTIONS)),
+ aStarMathDlgAry(SVX_RES(SID_SM_EDITOPTIONS)),
+ aImpressDlgAry(SVX_RES(SID_SD_EDITOPTIONS)),
+ aDrawDlgAry(SVX_RES(SID_SD_GRAPHIC_OPTIONS)),
+ aChartDlgAry(SVX_RES(SID_SCH_EDITOPTIONS)),
+ aFilterDlgAry(SVX_RES(SID_FILTER_DLG)),
+ aDatasourcesDlgAry(SVX_RES(SID_SB_STARBASEOPTIONS))
+{
+ FreeResource();
+}
+
+BOOL EnableSSO( void )
+{
+ // SSO must be enabled if the configuration manager bootstrap settings
+ // are configured as follows ...
+ // CFG_Offline=false
+ // CFG_ServerType=uno ( or unspecified )
+ // CFG_BackendService=
+ // com.sun.star.comp.configuration.backend.LdapSingleBackend
+
+ rtl::OUString theIniFile;
+ osl_getExecutableFile( &theIniFile.pData );
+ theIniFile = theIniFile.copy( 0, theIniFile.lastIndexOf( '/' ) + 1 ) +
+ rtl::OUString::createFromAscii( SAL_CONFIGFILE( "configmgr" ) );
+ ::rtl::Bootstrap theBootstrap( theIniFile );
+
+ rtl::OUString theOfflineValue;
+ rtl::OUString theDefaultOfflineValue = rtl::OUString::createFromAscii( "false" );
+ theBootstrap.getFrom( rtl::OUString::createFromAscii( "CFG_Offline" ),
+ theOfflineValue,
+ theDefaultOfflineValue );
+
+ rtl::OUString theServerTypeValue;
+ theBootstrap.getFrom( rtl::OUString::createFromAscii( "CFG_ServerType" ),
+ theServerTypeValue );
+
+ rtl::OUString theBackendServiceTypeValue;
+ theBootstrap.getFrom( rtl::OUString::createFromAscii( "CFG_BackendService" ),
+ theBackendServiceTypeValue );
+
+ BOOL bSSOEnabled =
+ ( theOfflineValue == theDefaultOfflineValue &&
+ ( theServerTypeValue.getLength() == 0 ||
+ theServerTypeValue == rtl::OUString::createFromAscii( "uno" ) ) &&
+ theBackendServiceTypeValue ==
+ rtl::OUString::createFromAscii(
+ "com.sun.star.comp.configuration.backend.LdapSingleBackend" ) );
+ if ( bSSOEnabled && GetSSOCreator() == 0 )
+ {
+ bSSOEnabled = FALSE;
+ }
+ return bSSOEnabled;
+}
+
+extern "C" { static void SAL_CALL thisModule() {} }
+
+CreateTabPage GetSSOCreator( void )
+{
+ static CreateTabPage theSymbol = 0;
+ if ( theSymbol == 0 )
+ {
+ osl::Module aModule;
+ rtl::OUString theModuleName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "ssoopt" ) ) );
+ if( aModule.loadRelative(
+ &thisModule, theModuleName, SAL_LOADMODULE_DEFAULT ) )
+ {
+ rtl::OUString theSymbolName( rtl::OUString::createFromAscii( "CreateSSOTabPage" ) );
+ theSymbol = reinterpret_cast<CreateTabPage>(aModule.getFunctionSymbol( theSymbolName ));
+ }
+ }
+
+ return theSymbol;
+}
+
+SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
+{
+ Reference< XPropertySet > xProp( SvxGetLinguPropertySet() );
+ SfxItemSet* pRet = 0;
+ switch(nId)
+ {
+ case SID_GENERAL_OPTIONS:
+ {
+ pRet = new SfxItemSet(
+ SFX_APP()->GetPool(),
+ SID_ATTR_METRIC, SID_ATTR_SPELL,
+ SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
+ SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER,
+ SID_ATTR_YEAR2000, SID_ATTR_YEAR2000,
+ SID_HTML_MODE, SID_HTML_MODE,
+ 0 );
+
+ SfxItemSet aOptSet( SFX_APP()->GetPool(), SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER );
+ SFX_APP()->GetOptions(aOptSet);
+ pRet->Put(aOptSet);
+
+ utl::MiscCfg aMisc;
+ const SfxPoolItem* pItem;
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if ( pViewFrame )
+ {
+ SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
+
+ // Sonstiges - Year2000
+ if( SFX_ITEM_AVAILABLE <= pDispatch->QueryState( SID_ATTR_YEAR2000, pItem ) )
+ pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, ((const SfxUInt16Item*)pItem)->GetValue() ) );
+ else
+ pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, (USHORT)aMisc.GetYear2000() ) );
+ }
+ else
+ pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, (USHORT)aMisc.GetYear2000() ) );
+
+
+ // Sonstiges - Tabulator
+ pRet->Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, aMisc.IsNotFoundWarning()));
+
+ sal_uInt16 nFlag = aMisc.IsPaperSizeWarning() ? SFX_PRINTER_CHG_SIZE : 0;
+ nFlag |= aMisc.IsPaperOrientationWarning() ? SFX_PRINTER_CHG_ORIENTATION : 0;
+ pRet->Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, nFlag ));
+
+ }
+ break;
+ case SID_LANGUAGE_OPTIONS :
+ {
+ pRet = new SfxItemSet(SFX_APP()->GetPool(),
+ SID_ATTR_LANGUAGE, SID_AUTOSPELL_CHECK,
+ SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
+ SID_OPT_LOCALE_CHANGED, SID_OPT_LOCALE_CHANGED,
+ SID_SET_DOCUMENT_LANGUAGE, SID_SET_DOCUMENT_LANGUAGE,
+ 0 );
+
+ // fuer die Linguistik
+
+ Reference< XSpellChecker1 > xSpell = SvxGetSpellChecker();
+ pRet->Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL ));
+ SfxHyphenRegionItem aHyphen( SID_ATTR_HYPHENREGION );
+
+ sal_Int16 nMinLead = 2,
+ nMinTrail = 2;
+ if (xProp.is())
+ {
+ xProp->getPropertyValue( String::CreateFromAscii(
+ UPN_HYPH_MIN_LEADING) ) >>= nMinLead;
+ xProp->getPropertyValue( String::CreateFromAscii(
+ UPN_HYPH_MIN_TRAILING) ) >>= nMinTrail;
+ }
+ aHyphen.GetMinLead() = (sal_uInt8)nMinLead;
+ aHyphen.GetMinTrail() = (sal_uInt8)nMinTrail;
+
+ const SfxPoolItem* pItem;
+ SfxPoolItem* pClone;
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if ( pViewFrame )
+ {
+ SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
+ if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_ATTR_LANGUAGE, pItem))
+ pRet->Put(SfxUInt16Item(SID_ATTR_LANGUAGE, ((const SvxLanguageItem*)pItem)->GetLanguage()));
+ if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_ATTR_CHAR_CJK_LANGUAGE, pItem))
+ pRet->Put(SfxUInt16Item(SID_ATTR_CHAR_CJK_LANGUAGE, ((const SvxLanguageItem*)pItem)->GetLanguage()));
+ if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_ATTR_CHAR_CTL_LANGUAGE, pItem))
+ pRet->Put(SfxUInt16Item(SID_ATTR_CHAR_CTL_LANGUAGE, ((const SvxLanguageItem*)pItem)->GetLanguage()));
+
+ pRet->Put(aHyphen);
+ if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_AUTOSPELL_CHECK, pItem))
+ {
+ pClone = pItem->Clone();
+ pRet->Put(*pClone);
+ delete pClone;
+ }
+ else
+ {
+ sal_Bool bVal = sal_False;
+ if (xProp.is())
+ {
+ xProp->getPropertyValue( String::CreateFromAscii( UPN_IS_SPELL_AUTO) ) >>= bVal;
+ }
+
+ pRet->Put(SfxBoolItem(SID_AUTOSPELL_CHECK, bVal));
+ }
+ }
+ pRet->Put( SfxBoolItem( SID_SET_DOCUMENT_LANGUAGE, bIsForSetDocumentLanguage ) );
+ }
+ break;
+ case SID_INET_DLG :
+ pRet = new SfxItemSet( SFX_APP()->GetPool(),
+ SID_BASIC_ENABLED, SID_BASIC_ENABLED,
+ //SID_OPTIONS_START - ..END
+ SID_OPTIONS_START, SID_INET_PROXY_PORT,
+ SID_SAVEREL_INET, SID_SAVEREL_FSYS,
+ SID_INET_SMTPSERVER, SID_INET_SMTPSERVER,
+ SID_INET_NOPROXY, SID_INET_SOCKS_PROXY_PORT,
+ SID_INET_DNS_AUTO, SID_INET_DNS_SERVER,
+ SID_SECURE_URL, SID_SECURE_URL,
+ 0L );
+ SFX_APP()->GetOptions(*pRet);
+ break;
+ case SID_FILTER_DLG:
+ pRet = new SfxItemSet( SFX_APP()->GetPool(),
+ SID_ATTR_DOCINFO, SID_ATTR_AUTOSAVEMINUTE,
+ SID_SAVEREL_INET, SID_SAVEREL_FSYS,
+ SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING,
+ SID_ATTR_WARNALIENFORMAT, SID_ATTR_WARNALIENFORMAT,
+ 0 );
+ SFX_APP()->GetOptions(*pRet);
+ break;
+
+ case SID_SB_STARBASEOPTIONS:
+ pRet = new SfxItemSet( SFX_APP()->GetPool(),
+ SID_SB_POOLING_ENABLED, SID_SB_DB_REGISTER,
+ 0 );
+ ::offapp::ConnectionPoolConfig::GetOptions(*pRet);
+ ::svx::DbRegisteredNamesConfig::GetOptions(*pRet);
+ break;
+
+ case SID_SCH_EDITOPTIONS:
+ {
+ SvxChartOptions aChartOpt;
+ pRet = new SfxItemSet( SFX_APP()->GetPool(), SID_SCH_EDITOPTIONS, SID_SCH_EDITOPTIONS );
+ pRet->Put( SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aChartOpt.GetDefaultColors() ) );
+ break;
+ }
+ }
+ return pRet;
+}
+
+void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
+{
+ switch(nId)
+ {
+ case SID_GENERAL_OPTIONS:
+ {
+ utl::MiscCfg aMisc;
+ const SfxPoolItem* pItem;
+ SfxItemSet aOptSet(SFX_APP()->GetPool(), SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER );
+ aOptSet.Put(rSet);
+ if(aOptSet.Count())
+ SFX_APP()->SetOptions( aOptSet );
+ // Dispatcher neu holen, weil SetOptions() ggf. den Dispatcher zerst"ort hat
+ SfxViewFrame *pViewFrame = SfxViewFrame::Current();
+// -------------------------------------------------------------------------
+// Year2000 auswerten
+// -------------------------------------------------------------------------
+ USHORT nY2K = USHRT_MAX;
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_YEAR2000, sal_False, &pItem ) )
+ nY2K = ((const SfxUInt16Item*)pItem)->GetValue();
+ if( USHRT_MAX != nY2K )
+ {
+ if ( pViewFrame )
+ {
+ SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
+ pDispatch->Execute( SID_ATTR_YEAR2000, SFX_CALLMODE_ASYNCHRON, pItem, 0L);
+ }
+ aMisc.SetYear2000(nY2K);
+ }
+
+// -------------------------------------------------------------------------
+// Drucken auswerten
+// -------------------------------------------------------------------------
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_PRINTER_NOTFOUND_WARN, sal_False, &pItem))
+ aMisc.SetNotFoundWarning(((const SfxBoolItem*)pItem)->GetValue());
+
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_PRINTER_CHANGESTODOC, sal_False, &pItem))
+ {
+ const SfxFlagItem* pFlag = (const SfxFlagItem*)pItem;
+ aMisc.SetPaperSizeWarning(0 != (pFlag->GetValue() & SFX_PRINTER_CHG_SIZE ));
+ aMisc.SetPaperOrientationWarning(0 != (pFlag->GetValue() & SFX_PRINTER_CHG_ORIENTATION ));
+ }
+// -------------------------------------------------------------------------
+// evaluate help options
+// -------------------------------------------------------------------------
+ if ( SvtHelpOptions().IsHelpTips() != Help::IsQuickHelpEnabled() )
+ SvtHelpOptions().IsHelpTips() ? Help::EnableQuickHelp() : Help::DisableQuickHelp();
+ if ( SvtHelpOptions().IsExtendedHelp() != Help::IsBalloonHelpEnabled() )
+ SvtHelpOptions().IsExtendedHelp() ? Help::EnableBalloonHelp() : Help::DisableBalloonHelp();
+ }
+ break;
+ case SID_LANGUAGE_OPTIONS :
+ {
+ OfaTreeOptionsDialog::ApplyLanguageOptions(rSet);
+ }
+ break;
+ case SID_INET_DLG :
+ case SID_FILTER_DLG:
+ SFX_APP()->SetOptions( rSet );
+ break;
+
+ case SID_SB_STARBASEOPTIONS:
+ ::offapp::ConnectionPoolConfig::SetOptions( rSet );
+ ::svx::DbRegisteredNamesConfig::SetOptions(rSet);
+ break;
+
+ case SID_SCH_EDITOPTIONS:
+ // nothing to do. Chart options only apply to newly created charts
+ break;
+
+ default:
+ {
+ DBG_ERROR( "Unhandled option in ApplyItemSet" );
+ }
+ break;
+ }
+
+}
+void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet)
+{
+ sal_Bool bSaveSpellCheck = sal_False;
+ const SfxPoolItem* pItem;
+
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_SPELL_MODIFIED, sal_False, &pItem ) )
+ {
+ bSaveSpellCheck = ( (const SfxBoolItem*)pItem )->GetValue();
+ }
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ Reference< XPropertySet > xProp(
+ xMgr->createInstance( ::rtl::OUString::createFromAscii(
+ "com.sun.star.linguistic2.LinguProperties") ),
+ UNO_QUERY );
+ if ( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_HYPHENREGION, sal_False, &pItem ) )
+ {
+ const SfxHyphenRegionItem* pHyphenItem = (const SfxHyphenRegionItem*)pItem;
+
+ if (xProp.is())
+ {
+ xProp->setPropertyValue(
+ String::CreateFromAscii(UPN_HYPH_MIN_LEADING),
+ makeAny((sal_Int16) pHyphenItem->GetMinLead()) );
+ xProp->setPropertyValue(
+ String::CreateFromAscii(UPN_HYPH_MIN_TRAILING),
+ makeAny((sal_Int16) pHyphenItem->GetMinTrail()) );
+ }
+ bSaveSpellCheck = sal_True;
+ }
+
+ SfxViewFrame *pViewFrame = SfxViewFrame::Current();
+ if ( pViewFrame )
+ {
+ SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
+ pItem = 0;
+ if(SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_LANGUAGE, sal_False, &pItem ))
+ {
+ pDispatch->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L);
+ bSaveSpellCheck = sal_True;
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE, sal_False, &pItem ))
+ {
+ pDispatch->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L);
+ bSaveSpellCheck = sal_True;
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE, sal_False, &pItem ))
+ {
+ pDispatch->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L);
+ bSaveSpellCheck = sal_True;
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_AUTOSPELL_CHECK, sal_False, &pItem ))
+ {
+ sal_Bool bOnlineSpelling = ((const SfxBoolItem*)pItem)->GetValue();
+ pDispatch->Execute(SID_AUTOSPELL_CHECK,
+ SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD, pItem, 0L);
+
+ if (xProp.is())
+ {
+ xProp->setPropertyValue(
+ String::CreateFromAscii(UPN_IS_SPELL_AUTO),
+ makeAny(bOnlineSpelling) );
+ }
+ }
+
+ if( bSaveSpellCheck )
+ {
+ //! the config item has changed since we modified the
+ //! property set it uses
+ pDispatch->Execute(SID_SPELLCHECKER_CHANGED, SFX_CALLMODE_ASYNCHRON);
+ }
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_OPT_LOCALE_CHANGED, sal_False, &pItem ))
+ {
+ SfxViewFrame* _pViewFrame = SfxViewFrame::GetFirst();
+ while ( _pViewFrame )
+ {
+ _pViewFrame->GetDispatcher()->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L);
+ _pViewFrame = SfxViewFrame::GetNext( *pViewFrame );
+ }
+ }
+}
+
+rtl::OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame )
+{
+ rtl::OUString sIdentifier;
+ Reference < XFrame > xCurrentFrame( _xFrame );
+ Reference < XModuleManager > xModuleManager( ::comphelper::getProcessServiceFactory()->createInstance(
+ DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), UNO_QUERY );
+ if ( !xCurrentFrame.is() )
+ {
+ Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
+ DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
+ if ( xDesktop.is() )
+ xCurrentFrame = xDesktop->getCurrentFrame();
+ }
+
+ if ( xCurrentFrame.is() && xModuleManager.is() )
+ {
+ try
+ {
+ sIdentifier = xModuleManager->identify( xCurrentFrame );
+ }
+ catch ( ::com::sun::star::frame::UnknownModuleException& )
+ {
+ DBG_WARNING( "getActiveModule_Impl(): unknown module" );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getActiveModule_Impl(): exception of XModuleManager::identify()" );
+ }
+ }
+
+ return sIdentifier;
+}
+
+void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
+{
+ OfaPageResource aDlgResource;
+ sal_uInt16 nGroup = 0;
+
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 i, nPageId;
+
+ // %PRODUCTNAME options
+ BOOL isSSOEnabled = EnableSSO();
+ if ( !lcl_isOptionHidden( SID_GENERAL_OPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rGeneralArray = aDlgResource.GetGeneralArray();
+ setGroupName( C2U("ProductName"), rGeneralArray.GetString(0) );
+ nGroup = AddGroup( rGeneralArray.GetString(0), 0, 0, SID_GENERAL_OPTIONS );
+ sal_uInt16 nEnd = static_cast< sal_uInt16 >( rGeneralArray.Count() );
+ String sPageTitle;
+
+ for ( i = 1; i < nEnd; ++i )
+ {
+ String sNewTitle = rGeneralArray.GetString(i);
+ nPageId = (sal_uInt16)rGeneralArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+
+ // Disable Online Update page if service not installed
+ if( RID_SVXPAGE_ONLINEUPDATE == nPageId )
+ {
+ const ::rtl::OUString sService = C2U("com.sun.star.setup.UpdateCheck");
+
+ try
+ {
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ Reference < XInterface > xService( xFactory->createInstance( sService ) );
+
+ if( ! xService.is() )
+ continue;
+ }
+ catch ( ::com::sun::star::loader::CannotActivateFactoryException& )
+ {
+ continue;
+ }
+ }
+ // Disable OOoImprovement page if not enabled
+ if( RID_SVXPAGE_IMPROVEMENT == nPageId )
+ {
+ continue;
+ }
+ if ( nPageId != RID_SVXPAGE_SSO || isSSOEnabled )
+ {
+ AddTabPage( nPageId, sNewTitle, nGroup );
+ }
+ }
+ // private iteration hack for Improvement Program
+ // hack for OOo 3.1
+ // should not be in found in any later release
+ for(bool bOnce = false; bOnce==false; bOnce=true)
+ {
+ String sNewTitle = C2U("Improvement Program");
+ {
+ SvxImprovementPage aTempTabPage(this);
+ sNewTitle = aTempTabPage.GetTitleText();
+ }
+ nPageId = RID_SVXPAGE_IMPROVEMENT;
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+ // Disable OOoImprovement page if not enabled
+ {
+ const ::rtl::OUString sService = C2U("com.sun.star.oooimprovement.CoreController");
+ try
+ {
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ Reference < ::com::sun::star::oooimprovement::XCoreController > xService( xFactory->createInstance( sService ), UNO_QUERY );
+
+ if( ! xService.is() )
+ continue;
+ if( ! xService->showBuiltinOptionsPage(1))
+ continue;
+ }
+ catch ( ::com::sun::star::loader::CannotActivateFactoryException& )
+ {
+ continue;
+ }
+ }
+ if ( nPageId != RID_SVXPAGE_SSO || isSSOEnabled )
+ {
+ AddTabPage( nPageId, sNewTitle, nGroup );
+ }
+ }
+ }
+
+ // Load and Save options
+ if ( !lcl_isOptionHidden( SID_FILTER_DLG, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rFilterArray = aDlgResource.GetFilterArray();
+ setGroupName( C2U("LoadSave"), rFilterArray.GetString(0) );
+ nGroup = AddGroup( rFilterArray.GetString(0), 0, 0, SID_FILTER_DLG );
+ for ( i = 1; i < rFilterArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rFilterArray.GetValue(i);
+ if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ AddTabPage( nPageId, rFilterArray.GetString(i), nGroup );
+ }
+ }
+
+ // Language options
+ SvtLanguageOptions aLanguageOptions;
+ if ( !lcl_isOptionHidden( SID_LANGUAGE_OPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rLangArray = aDlgResource.GetLangArray();
+ setGroupName( C2U("LanguageSettings"), rLangArray.GetString(0) );
+ nGroup = AddGroup( rLangArray.GetString(0), 0, 0, SID_LANGUAGE_OPTIONS );
+ for ( i = 1; i < rLangArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rLangArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+ if ( ( RID_SVXPAGE_JSEARCH_OPTIONS != nPageId || aLanguageOptions.IsJapaneseFindEnabled() ) &&
+ ( RID_SVXPAGE_ASIAN_LAYOUT != nPageId || aLanguageOptions.IsAsianTypographyEnabled() ) &&
+ ( RID_SVXPAGE_OPTIONS_CTL != nPageId || aLanguageOptions.IsCTLFontEnabled() ) )
+ AddTabPage( nPageId, rLangArray.GetString(i), nGroup );
+ }
+ }
+
+
+ rtl::OUString aFactory = getCurrentFactory_Impl( _xFrame );
+ rtl::OUString sTemp = GetModuleIdentifier( comphelper::getProcessServiceFactory(), _xFrame );
+ DBG_ASSERT( sTemp == aFactory, "S H I T!!!" );
+
+ // Writer and Writer/Web options
+ sal_Bool bHasAnyFilter = sal_False;
+ SvtModuleOptions aModuleOpt;
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
+ {
+ // Textdokument
+ bHasAnyFilter = sal_True;
+ ResStringArray& rTextArray = aDlgResource.GetTextArray();
+ if ( aFactory.equalsAscii( "com.sun.star.text.TextDocument" )
+ || aFactory.equalsAscii( "com.sun.star.text.WebDocument" )
+ || aFactory.equalsAscii( "com.sun.star.text.GlobalDocument" ) )
+ {
+ SfxModule* pSwMod = (*(SfxModule**) GetAppData(SHL_WRITER));
+ if ( !lcl_isOptionHidden( SID_SW_EDITOPTIONS, aOptionsDlgOpt ) )
+ {
+ if ( aFactory.equalsAscii( "com.sun.star.text.WebDocument" ) )
+ setGroupName( C2U("WriterWeb"), rTextArray.GetString(0) );
+ else
+ setGroupName( C2U("Writer"), rTextArray.GetString(0) );
+ nGroup = AddGroup(rTextArray.GetString(0), pSwMod, pSwMod, SID_SW_EDITOPTIONS );
+ for ( i = 1; i < rTextArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rTextArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+ if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || aLanguageOptions.IsCJKFontEnabled() ) &&
+ ( RID_SW_TP_STD_FONT_CTL != nPageId || aLanguageOptions.IsCTLFontEnabled() ) &&
+ ( RID_SW_TP_MAILCONFIG != nPageId || MailMergeCfg_Impl().IsEmailSupported() ) )
+ AddTabPage( nPageId, rTextArray.GetString(i), nGroup );
+ }
+#ifdef DBG_UTIL
+ AddTabPage( RID_SW_TP_OPTTEST_PAGE, String::CreateFromAscii("Interner Test"), nGroup );
+#endif
+ }
+
+ // HTML-Dokument
+ if ( !lcl_isOptionHidden( SID_SW_ONLINEOPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rHTMLArray = aDlgResource.GetHTMLArray();
+ nGroup = AddGroup(rHTMLArray.GetString(0), pSwMod, pSwMod, SID_SW_ONLINEOPTIONS );
+ for( i = 1; i < rHTMLArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rHTMLArray.GetValue(i);
+ if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ AddTabPage( nPageId, rHTMLArray.GetString(i), nGroup );
+ }
+#ifdef DBG_UTIL
+ AddTabPage( RID_SW_TP_OPTTEST_PAGE, String::CreateFromAscii("Interner Test"), nGroup );
+#endif
+ }
+ }
+ }
+
+ // Calc options
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
+ {
+ bHasAnyFilter = sal_True;
+ if ( aFactory.equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" ))
+ {
+ if ( !lcl_isOptionHidden( SID_SC_EDITOPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rCalcArray = aDlgResource.GetCalcArray();
+ SfxModule* pScMod = ( *( SfxModule** ) GetAppData( SHL_CALC ) );
+ setGroupName( C2U("Calc"), rCalcArray.GetString(0) );
+ nGroup = AddGroup( rCalcArray.GetString( 0 ), pScMod, pScMod, SID_SC_EDITOPTIONS );
+ const USHORT nCount = static_cast< const USHORT >( rCalcArray.Count() );
+ for ( i = 1; i < nCount; ++i )
+ {
+ nPageId = (sal_uInt16)rCalcArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+// if( bCTL || nId != RID_OFA_TP_INTERNATIONAL )
+// #103755# if an international tabpage is need one day, this should be used again... ;-)
+ if ( nPageId != RID_OFA_TP_INTERNATIONAL )
+ AddTabPage( nPageId, rCalcArray.GetString( i ), nGroup );
+ }
+ }
+ }
+ }
+
+ // Impress options
+ SfxModule* pSdMod = ( *( SfxModule** ) GetAppData( SHL_DRAW ) );
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
+ {
+ bHasAnyFilter = sal_True;
+ if ( aFactory.equalsAscii( "com.sun.star.presentation.PresentationDocument" ))
+ {
+ if ( !lcl_isOptionHidden( SID_SD_EDITOPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rImpressArray = aDlgResource.GetImpressArray();
+ setGroupName( C2U("Impress"), rImpressArray.GetString(0) );
+ nGroup = AddGroup( rImpressArray.GetString( 0 ), pSdMod, pSdMod, SID_SD_EDITOPTIONS );
+ const sal_Bool bCTL = aLanguageOptions.IsCTLFontEnabled();
+ const USHORT nCount = static_cast< const USHORT >( rImpressArray.Count() );
+ for ( i = 1; i < nCount; ++i )
+ {
+ nPageId = (sal_uInt16)rImpressArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+ if ( bCTL || nPageId != RID_OFA_TP_INTERNATIONAL_IMPR )
+ AddTabPage( nPageId, rImpressArray.GetString(i), nGroup );
+ }
+ }
+ }
+ }
+
+ // Draw options
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) )
+ {
+ if ( aFactory.equalsAscii( "com.sun.star.drawing.DrawingDocument" ))
+ {
+ if ( !lcl_isOptionHidden( SID_SD_GRAPHIC_OPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rDrawArray = aDlgResource.GetDrawArray();
+ setGroupName( C2U("Draw"), rDrawArray.GetString(0) );
+ nGroup = AddGroup( rDrawArray.GetString( 0 ), pSdMod, pSdMod, SID_SD_GRAPHIC_OPTIONS );
+ const sal_Bool bCTL = aLanguageOptions.IsCTLFontEnabled();
+ const USHORT nCount = static_cast< const USHORT >( rDrawArray.Count() );
+ for ( i = 1; i < nCount; ++i )
+ {
+ nPageId = (sal_uInt16)rDrawArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+ if ( bCTL || nPageId != RID_OFA_TP_INTERNATIONAL_SD )
+ AddTabPage( nPageId, rDrawArray.GetString(i), nGroup );
+ }
+ }
+ }
+ }
+
+ // Math options
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) )
+ {
+ if ( aFactory.equalsAscii( "com.sun.star.formula.FormulaProperties" ))
+ {
+ if ( !lcl_isOptionHidden( SID_SM_EDITOPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rStarMathArray = aDlgResource.GetStarMathArray();
+ SfxModule* pSmMod = (*(SfxModule**) GetAppData(SHL_SM));
+ setGroupName( C2U("Math"), rStarMathArray.GetString(0) );
+ nGroup = AddGroup(rStarMathArray.GetString(0), pSmMod, pSmMod, SID_SM_EDITOPTIONS );
+ for ( i = 1; i < rStarMathArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rStarMathArray.GetValue(i);
+ if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ AddTabPage( nPageId, rStarMathArray.GetString(i), nGroup );
+ }
+ }
+ }
+ }
+
+ // Database - needed only if there is an application which integrates with databases
+ if ( !lcl_isOptionHidden( SID_SB_STARBASEOPTIONS, aOptionsDlgOpt ) &&
+ ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDATABASE )
+ || aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER )
+ || aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC )
+ ) )
+ {
+ ResStringArray& rDSArray = aDlgResource.GetDatasourcesArray();
+ setGroupName( C2U("Base"), rDSArray.GetString(0) );
+ nGroup = AddGroup( rDSArray.GetString(0), 0, NULL, SID_SB_STARBASEOPTIONS );
+ for ( i = 1; i < rDSArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rDSArray.GetValue(i);
+ if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ AddTabPage( nPageId, rDSArray.GetString(i), nGroup );
+ }
+ }
+
+ // Chart options (always installed and active)
+ if ( !lcl_isOptionHidden( SID_SCH_EDITOPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rChartArray = aDlgResource.GetChartArray();
+ setGroupName( C2U("Charts"), rChartArray.GetString(0) );
+ nGroup = AddGroup( rChartArray.GetString(0), 0, 0, SID_SCH_EDITOPTIONS );
+ for ( i = 1; i < rChartArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rChartArray.GetValue(i);
+ if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ AddTabPage( nPageId, rChartArray.GetString(i), nGroup );
+ }
+ }
+
+ // Internet options
+ if ( !lcl_isOptionHidden( SID_INET_DLG, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rInetArray = aDlgResource.GetInetArray();
+ setGroupName( C2U("Internet"), rInetArray.GetString(0) );
+ nGroup = AddGroup(rInetArray.GetString(0), 0, 0, SID_INET_DLG );
+
+ for ( i = 1; i < rInetArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rInetArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+#if defined WNT
+ // Disable E-mail tab-page on Windows
+ if ( nPageId == RID_SVXPAGE_INET_MAIL )
+ continue;
+#endif
+#if defined MACOSX
+ // Disable Mozilla Plug-in tab-page on Mac
+ if ( nPageId == RID_SVXPAGE_INET_MOZPLUGIN )
+ continue;
+#endif
+ AddTabPage( nPageId, rInetArray.GetString(i), nGroup );
+ }
+ }
+
+/*!!!
+ ResizeTreeLB();
+ ActivateLastSelection();
+ */
+}
+
+namespace
+{
+ void MoveControl( Control& _rCtrl, long _nDeltaPixel )
+ {
+ Point aPt( _rCtrl.GetPosPixel() );
+ aPt.X() += _nDeltaPixel;
+ _rCtrl.SetPosPixel( aPt );
+ }
+}
+
+void OfaTreeOptionsDialog::ResizeTreeLB( void )
+{
+ const long nMax = aHiddenGB.GetSizePixel().Width() * 42 / 100;
+ // don't ask where 42 comes from... but it looks / feels ok ;-)
+ long nDelta = 50; // min.
+ USHORT nDepth = 0;
+ const long nIndent0 = PixelToLogic( Size( 28, 0 ) ).Width();
+ const long nIndent1 = PixelToLogic( Size( 52, 0 ) ).Width();
+
+ SvTreeList* pTreeList = aTreeLB.GetModel();
+ DBG_ASSERT( pTreeList, "-OfaTreeOptionsDialog::ResizeTreeLB(): no model, no cookies!" );
+
+ SvListEntry* pEntry = pTreeList->First();
+ while( pEntry )
+ {
+ long n = aTreeLB.GetTextWidth( aTreeLB.GetEntryText( static_cast< SvLBoxEntry* >( pEntry ) ) );
+ n += ( nDepth == 0 )? nIndent0 : nIndent1;
+
+ if( n > nDelta )
+ nDelta = n;
+
+ pEntry = pTreeList->Next( pEntry, &nDepth );
+ }
+
+ nDelta = LogicToPixel( Size( nDelta + 3, 0 ) ).Width(); // + extra space [logic]
+ nDelta += GetSettings().GetStyleSettings().GetScrollBarSize(); // + scroll bar, in case it's needed
+
+ if( nDelta > nMax )
+ nDelta = nMax;
+
+ // starting resizing with this
+ Size aSize( GetSizePixel() );
+ aSize.Width() += nDelta;
+ SetSizePixel( aSize );
+
+ // resize treelistbox
+ aSize = aTreeLB.GetSizePixel();
+ aSize.Width() += nDelta;
+ aTreeLB.SetSizePixel( aSize );
+
+ // ... and move depending controls
+ MoveControl( aOkPB, nDelta );
+ MoveControl( aCancelPB, nDelta );
+ MoveControl( aHelpPB, nDelta );
+ MoveControl( aBackPB, nDelta );
+ MoveControl( aHiddenGB, nDelta );
+ MoveControl( aPageTitleFT, nDelta );
+ MoveControl( aLine1FL, nDelta );
+ MoveControl( aHelpFT, nDelta );
+ MoveControl( aHelpImg, nDelta );
+}
+
+bool isNodeActive( OptionsNode* pNode, Module* pModule )
+{
+ if ( pNode )
+ {
+ // Node for all modules actine?
+ if ( pNode->m_bAllModules )
+ return true;
+
+ // OOo-Nodes (Writer, Calc, Impress...) are active if node is already inserted
+ if ( getGroupName( pNode->m_sId, false ).Len() > 0 )
+ return true;
+
+ // no module -> not active
+ if ( !pModule )
+ return false;
+
+ // search node in active module
+ if ( pModule->m_bActive )
+ {
+ for ( sal_uInt32 j = 0; j < pModule->m_aNodeList.size(); ++j )
+ if ( pModule->m_aNodeList[j]->m_sId == pNode->m_sId )
+ return true;
+ }
+ }
+ return false;
+}
+
+void OfaTreeOptionsDialog::LoadExtensionOptions( const rtl::OUString& rExtensionId )
+{
+ Module* pModule = NULL;
+ Reference< XMultiServiceFactory > xMSFac = comphelper::getProcessServiceFactory();
+ // open optionsdialog.xcu
+ Reference< XNameAccess > xRoot(
+ ::comphelper::ConfigurationHelper::openConfig(
+ xMSFac, C2U("org.openoffice.Office.OptionsDialog"),
+ ::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY );
+ DBG_ASSERT( xRoot.is(), "OfaTreeOptionsDialog::LoadExtensionOptions(): no config" );
+ // when called by Tools - Options then load nodes of active module
+ if ( rExtensionId.getLength() == 0 )
+ pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ), xRoot );
+
+ VectorOfNodes aNodeList;
+ LoadNodes( xRoot, pModule, rExtensionId, aNodeList );
+ InsertNodes( aNodeList );
+}
+
+rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier(
+ const Reference< XMultiServiceFactory >& xMFac, const Reference< XFrame >& rFrame )
+{
+ rtl::OUString sModule;
+ Reference < XFrame > xCurrentFrame( rFrame );
+ Reference < XModuleManager > xModuleManager( xMFac->createInstance(
+ C2U("com.sun.star.frame.ModuleManager") ), UNO_QUERY );
+
+ if ( !xCurrentFrame.is() )
+ {
+ Reference < XDesktop > xDesktop( xMFac->createInstance(
+ C2U("com.sun.star.frame.Desktop") ), UNO_QUERY );
+ if ( xDesktop.is() )
+ xCurrentFrame = xDesktop->getCurrentFrame();
+ }
+
+ if ( xCurrentFrame.is() && xModuleManager.is() )
+ {
+ try
+ {
+ sModule = xModuleManager->identify( xCurrentFrame );
+ }
+ catch ( ::com::sun::star::frame::UnknownModuleException& )
+ {
+ DBG_WARNING( "OfaTreeOptionsDialog::GetModuleIdentifier(): unknown module" );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "OfaTreeOptionsDialog::GetModuleIdentifier(): exception of XModuleManager::identify()" );
+ }
+ }
+ return sModule;
+}
+
+Module* OfaTreeOptionsDialog::LoadModule(
+ const rtl::OUString& rModuleIdentifier, const Reference< XNameAccess >& xRoot )
+{
+ Module* pModule = NULL;
+ Reference< XNameAccess > xSet;
+
+ if ( xRoot->hasByName( C2U("Modules") ) )
+ {
+ xRoot->getByName( C2U("Modules") ) >>= xSet;
+ if ( xSet.is() )
+ {
+ Sequence< rtl::OUString > seqNames = xSet->getElementNames();
+ for ( int i = 0; i < seqNames.getLength(); ++i )
+ {
+ rtl::OUString sModule( seqNames[i] );
+ if ( rModuleIdentifier == sModule )
+ {
+ // current active module found
+ pModule = new Module( sModule );
+ pModule->m_bActive = true;
+
+ Reference< XNameAccess > xModAccess;
+ xSet->getByName( seqNames[i] ) >>= xModAccess;
+ if ( xModAccess.is() )
+ {
+ // load the nodes of this module
+ Reference< XNameAccess > xNodeAccess;
+ xModAccess->getByName( C2U("Nodes") ) >>= xNodeAccess;
+ if ( xNodeAccess.is() )
+ {
+ Sequence< rtl::OUString > xTemp = xNodeAccess->getElementNames();
+ Reference< XNameAccess > xAccess;
+ sal_Int32 nIndex = -1;
+ for ( int x = 0; x < xTemp.getLength(); ++x )
+ {
+ xNodeAccess->getByName( xTemp[x] ) >>= xAccess;
+ if ( xAccess.is() )
+ {
+ xAccess->getByName( C2U("Index") ) >>= nIndex;
+ if ( nIndex < 0 )
+ // append nodes with index < 0
+ pModule->m_aNodeList.push_back(
+ new OrderedEntry( nIndex, xTemp[x] ) );
+ else
+ {
+ // search position of the node
+ sal_uInt32 y = 0;
+ for ( ; y < pModule->m_aNodeList.size(); ++y )
+ {
+ sal_Int32 nNodeIdx = pModule->m_aNodeList[y]->m_nIndex;
+ if ( nNodeIdx < 0 || nNodeIdx > nIndex )
+ break;
+ }
+ // and insert the node on this position
+ pModule->m_aNodeList.insert(
+ pModule->m_aNodeList.begin() + y,
+ new OrderedEntry( nIndex, xTemp[x] ) );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return pModule;
+}
+
+void OfaTreeOptionsDialog::LoadNodes(
+ const Reference< XNameAccess >& xRoot, Module* pModule,
+ const rtl::OUString& rExtensionId, VectorOfNodes& rOutNodeList )
+{
+ Reference< XNameAccess > xSet;
+ if ( xRoot->hasByName( C2U("Nodes") ) )
+ {
+ xRoot->getByName( C2U("Nodes") ) >>= xSet;
+ if ( xSet.is() )
+ {
+ VectorOfNodes aNodeList;
+ Sequence< rtl::OUString > seqNames = xSet->getElementNames();
+
+ for ( int i = 0; i < seqNames.getLength(); ++i )
+ {
+ String sGroupName( seqNames[i] );
+ Reference< XNameAccess > xNodeAccess;
+ xSet->getByName( seqNames[i] ) >>= xNodeAccess;
+
+ if ( xNodeAccess.is() )
+ {
+ rtl::OUString sNodeId, sLabel, sPageURL, sGroupId;
+ bool bAllModules = false;
+ sal_Int32 nGroupIndex = 0;
+
+ sNodeId = seqNames[i];
+ xNodeAccess->getByName( C2U("Label") ) >>= sLabel;
+ xNodeAccess->getByName( C2U("OptionsPage") ) >>= sPageURL;
+ xNodeAccess->getByName( C2U("AllModules") ) >>= bAllModules;
+ xNodeAccess->getByName( C2U("GroupId") ) >>= sGroupId;
+ xNodeAccess->getByName( C2U("GroupIndex") ) >>= nGroupIndex;
+
+ if ( sLabel.getLength() == 0 )
+ sLabel = sGroupName;
+ String sTemp = getGroupName( sLabel, rExtensionId.getLength() > 0 );
+ if ( sTemp.Len() > 0 )
+ sLabel = sTemp;
+ OptionsNode* pNode =
+ new OptionsNode( sNodeId, sLabel, sPageURL, bAllModules, sGroupId, nGroupIndex );
+
+ if ( !rExtensionId.getLength() && !isNodeActive( pNode, pModule ) )
+ {
+ delete pNode;
+ continue;
+ }
+
+ Reference< XNameAccess > xLeavesSet;
+ xNodeAccess->getByName( C2U( "Leaves" ) ) >>= xLeavesSet;
+ if ( xLeavesSet.is() )
+ {
+ Sequence< rtl::OUString > seqLeaves = xLeavesSet->getElementNames();
+ for ( int j = 0; j < seqLeaves.getLength(); ++j )
+ {
+ Reference< XNameAccess > xLeaveAccess;
+ xLeavesSet->getByName( seqLeaves[j] ) >>= xLeaveAccess;
+
+ if ( xLeaveAccess.is() )
+ {
+ rtl::OUString sId, sLeafLabel, sEventHdl, sLeafURL, sLeafGrpId;
+ sal_Int32 nLeafGrpIdx = 0;
+
+ xLeaveAccess->getByName( C2U("Id") ) >>= sId;
+ xLeaveAccess->getByName( C2U("Label") ) >>= sLeafLabel;
+ xLeaveAccess->getByName( C2U("OptionsPage") ) >>= sLeafURL;
+ xLeaveAccess->getByName( C2U("EventHandlerService") ) >>= sEventHdl;
+ xLeaveAccess->getByName( C2U("GroupId") ) >>= sLeafGrpId;
+ xLeaveAccess->getByName( C2U("GroupIndex") ) >>= nLeafGrpIdx;
+
+ if ( !rExtensionId.getLength() || sId == rExtensionId )
+ {
+ OptionsLeaf* pLeaf = new OptionsLeaf(
+ sId, sLeafLabel, sLeafURL, sEventHdl, sLeafGrpId, nLeafGrpIdx );
+
+ if ( sLeafGrpId.getLength() > 0 )
+ {
+ bool bAlreadyOpened = false;
+ if ( pNode->m_aGroupedLeaves.size() > 0 )
+ {
+ for ( sal_uInt32 k = 0;
+ k < pNode->m_aGroupedLeaves.size(); ++k )
+ {
+ if ( pNode->m_aGroupedLeaves[k].size() > 0 &&
+ pNode->m_aGroupedLeaves[k][0]->m_sGroupId
+ == sLeafGrpId )
+ {
+ sal_uInt32 l = 0;
+ for ( ; l < pNode->m_aGroupedLeaves[k].size(); ++l )
+ {
+ if ( pNode->m_aGroupedLeaves[k][l]->
+ m_nGroupIndex >= nLeafGrpIdx )
+ break;
+ }
+ pNode->m_aGroupedLeaves[k].insert(
+ pNode->m_aGroupedLeaves[k].begin() + l, pLeaf );
+ bAlreadyOpened = true;
+ break;
+ }
+ }
+ }
+ if ( !bAlreadyOpened )
+ {
+ VectorOfLeaves aGroupedLeaves;
+ aGroupedLeaves.push_back( pLeaf );
+ pNode->m_aGroupedLeaves.push_back( aGroupedLeaves );
+ }
+ }
+ else
+ pNode->m_aLeaves.push_back(
+ new OptionsLeaf(
+ sId, sLeafLabel, sLeafURL,
+ sEventHdl, sLeafGrpId, nLeafGrpIdx ) );
+ }
+ }
+ }
+ }
+
+ // do not insert nodes without leaves
+ if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 )
+ {
+ pModule ? aNodeList.push_back( pNode ) : rOutNodeList.push_back( pNode );
+ }
+ }
+ }
+
+ if ( pModule && aNodeList.size() > 0 )
+ {
+ sal_uInt32 i = 0, j = 0;
+ for ( ; i < pModule->m_aNodeList.size(); ++i )
+ {
+ rtl::OUString sNodeId = pModule->m_aNodeList[i]->m_sId;
+ for ( j = 0; j < aNodeList.size(); ++j )
+ {
+ OptionsNode* pNode = aNodeList[j];
+ if ( pNode->m_sId == sNodeId )
+ {
+ rOutNodeList.push_back( pNode );
+ aNodeList.erase( aNodeList.begin() + j );
+ break;
+ }
+ }
+ }
+
+ for ( i = 0; i < aNodeList.size(); ++i )
+ rOutNodeList.push_back( aNodeList[i] );
+ }
+ }
+ }
+}
+
+USHORT lcl_getGroupId( const rtl::OUString& rGroupName, const SvTreeListBox& rTreeLB )
+{
+ String sGroupName( rGroupName );
+ USHORT nRet = 0;
+ SvLBoxEntry* pEntry = rTreeLB.First();
+ while( pEntry )
+ {
+ if ( !rTreeLB.GetParent( pEntry ) )
+ {
+ String sTemp( rTreeLB.GetEntryText( pEntry ) );
+ if ( sTemp == sGroupName )
+ return nRet;
+ nRet++;
+ }
+ pEntry = rTreeLB.Next( pEntry );
+ }
+
+ return USHRT_MAX;
+}
+
+void lcl_insertLeaf(
+ OfaTreeOptionsDialog* pDlg, OptionsNode* pNode, OptionsLeaf* pLeaf, const SvTreeListBox& rTreeLB )
+{
+ USHORT nGrpId = lcl_getGroupId( pNode->m_sLabel, rTreeLB );
+ if ( USHRT_MAX == nGrpId )
+ {
+ USHORT nNodeGrpId = getGroupNodeId( pNode->m_sId );
+ nGrpId = pDlg->AddGroup( pNode->m_sLabel, NULL, NULL, nNodeGrpId );
+ if ( pNode->m_sPageURL.getLength() > 0 )
+ {
+ SvLBoxEntry* pGrpEntry = rTreeLB.GetEntry( 0, nGrpId );
+ DBG_ASSERT( pGrpEntry, "OfaTreeOptionsDialog::InsertNodes(): no group" );
+ if ( pGrpEntry )
+ {
+ OptionsGroupInfo* pGrpInfo =
+ static_cast<OptionsGroupInfo*>(pGrpEntry->GetUserData());
+ pGrpInfo->m_sPageURL = pNode->m_sPageURL;
+ }
+ }
+ }
+ OptionsPageInfo* pInfo = pDlg->AddTabPage( 0, pLeaf->m_sLabel, nGrpId );
+ pInfo->m_sPageURL = pLeaf->m_sPageURL;
+ pInfo->m_sEventHdl = pLeaf->m_sEventHdl;
+}
+
+void OfaTreeOptionsDialog::InsertNodes( const VectorOfNodes& rNodeList )
+{
+ for ( sal_uInt32 i = 0; i < rNodeList.size(); ++i )
+ {
+ OptionsNode* pNode = rNodeList[i];
+
+ if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 )
+ {
+ sal_uInt32 j = 0;
+ for ( ; j < pNode->m_aGroupedLeaves.size(); ++j )
+ {
+ for ( sal_uInt32 k = 0; k < pNode->m_aGroupedLeaves[j].size(); ++k )
+ {
+ OptionsLeaf* pLeaf = pNode->m_aGroupedLeaves[j][k];
+ lcl_insertLeaf( this, pNode, pLeaf, aTreeLB );
+ }
+ }
+
+ for ( j = 0; j < pNode->m_aLeaves.size(); ++j )
+ {
+ OptionsLeaf* pLeaf = pNode->m_aLeaves[j];
+ lcl_insertLeaf( this, pNode, pLeaf, aTreeLB );
+ }
+ }
+ }
+}
+
+short OfaTreeOptionsDialog::Execute()
+{
+ ::std::auto_ptr< SvxDicListChgClamp > pClamp;
+ if ( !bIsFromExtensionManager )
+ {
+ // collect all DictionaryList Events while the dialog is executed
+ Reference<com::sun::star::linguistic2::XDictionaryList> xDictionaryList(SvxGetDictionaryList());
+ pClamp = ::std::auto_ptr< SvxDicListChgClamp >( new SvxDicListChgClamp( xDictionaryList ) );
+ }
+ short nRet = SfxModalDialog::Execute();
+
+ if( RET_OK == nRet )
+ {
+ ApplyItemSets();
+ if( GetColorTable() )
+ {
+ GetColorTable()->Save();
+
+ // notify current viewframe it it uses the same color table
+ if ( SfxViewFrame::Current() && SfxViewFrame::Current()->GetDispatcher() )
+ {
+ const OfaPtrItem* pPtr = (const OfaPtrItem*)SfxViewFrame::Current()->GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON );
+ if( pPtr )
+ {
+ XColorTable* _pColorTab = (XColorTable*)pPtr->GetValue();
+
+ if( _pColorTab &&
+ _pColorTab->GetPath() == GetColorTable()->GetPath() &&
+ _pColorTab->GetName() == GetColorTable()->GetName() )
+ SfxObjectShell::Current()->PutItem( SvxColorTableItem( GetColorTable(), SID_COLOR_TABLE ) );
+ }
+ }
+ }
+
+ utl::ConfigManager::GetConfigManager()->StoreConfigItems();
+ }
+
+ return nRet;
+}
+
+// class ExtensionsTabPage -----------------------------------------------
+
+ExtensionsTabPage::ExtensionsTabPage(
+ Window* pParent, const ResId& rResId, const rtl::OUString& rPageURL,
+ const rtl::OUString& rEvtHdl, const Reference< awt::XContainerWindowProvider >& rProvider ) :
+
+ TabPage( pParent, rResId ),
+
+ m_sPageURL ( rPageURL ),
+ m_sEventHdl ( rEvtHdl ),
+ m_xWinProvider ( rProvider ),
+ m_bIsWindowHidden ( false )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+ExtensionsTabPage::ExtensionsTabPage(
+ Window* pParent, WinBits nStyle, const rtl::OUString& rPageURL,
+ const rtl::OUString& rEvtHdl, const Reference< awt::XContainerWindowProvider >& rProvider ) :
+
+ TabPage( pParent, nStyle ),
+
+ m_sPageURL ( rPageURL ),
+ m_sEventHdl ( rEvtHdl ),
+ m_xWinProvider ( rProvider ),
+ m_bIsWindowHidden ( false )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+ExtensionsTabPage::~ExtensionsTabPage()
+{
+ Hide();
+ DeactivatePage();
+}
+
+// -----------------------------------------------------------------------
+
+void ExtensionsTabPage::CreateDialogWithHandler()
+{
+ try
+ {
+ bool bWithHandler = ( m_sEventHdl.getLength() > 0 );
+ if ( bWithHandler )
+ {
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ m_xEventHdl = Reference< awt::XContainerWindowEventHandler >(
+ xFactory->createInstance( m_sEventHdl ), UNO_QUERY );
+ }
+
+ if ( !bWithHandler || m_xEventHdl.is() )
+ {
+ SetStyle( GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
+ Reference< awt::XWindowPeer > xParent( VCLUnoHelper::GetInterface( this ), UNO_QUERY );
+ m_xPage = Reference < awt::XWindow >(
+ m_xWinProvider->createContainerWindow(
+ m_sPageURL, rtl::OUString(), xParent, m_xEventHdl ), UNO_QUERY );
+
+ Reference< awt::XControl > xPageControl( m_xPage, UNO_QUERY );
+ if ( xPageControl.is() )
+ {
+ Reference< awt::XWindowPeer > xWinPeer( xPageControl->getPeer() );
+ if ( xWinPeer.is() )
+ {
+ Window* pWindow = VCLUnoHelper::GetWindow( xWinPeer );
+ if ( pWindow )
+ pWindow->SetStyle( pWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
+ }
+ }
+ }
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ DBG_ERRORFILE( "ExtensionsTabPage::CreateDialogWithHandler(): illegal argument" );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "ExtensionsTabPage::CreateDialogWithHandler(): exception of XDialogProvider2::createDialogWithHandler()" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool ExtensionsTabPage::DispatchAction( const rtl::OUString& rAction )
+{
+ sal_Bool bRet = sal_False;
+ if ( m_xEventHdl.is() )
+ {
+ try
+ {
+ bRet = m_xEventHdl->callHandlerMethod( m_xPage, makeAny( rAction ), C2U("external_event") );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "ExtensionsTabPage::DispatchAction(): exception of XDialogEventHandler::callHandlerMethod()" );
+ }
+ }
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+void ExtensionsTabPage::ActivatePage()
+{
+ TabPage::ActivatePage();
+
+ if ( !m_xPage.is() )
+ {
+ CreateDialogWithHandler();
+
+ if ( m_xPage.is() )
+ {
+ Point aPos = Point();
+ Size aSize = GetSizePixel();
+ m_xPage->setPosSize( aPos.X() + 1, aPos.Y() + 1,
+ aSize.Width() - 2, aSize.Height() - 2, awt::PosSize::POSSIZE );
+ if ( m_sEventHdl.getLength() > 0 )
+ DispatchAction( C2U("initialize") );
+ }
+ }
+
+ if ( m_xPage.is() )
+ {
+ m_xPage->setVisible( sal_True );
+ m_bIsWindowHidden = false;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ExtensionsTabPage::DeactivatePage()
+{
+ TabPage::DeactivatePage();
+
+ if ( m_xPage.is() )
+ m_xPage->setVisible( sal_False );
+}
+
+// -----------------------------------------------------------------------
+
+void ExtensionsTabPage::ResetPage()
+{
+ DispatchAction( C2U("back") );
+ ActivatePage();
+}
+
+// -----------------------------------------------------------------------
+
+void ExtensionsTabPage::SavePage()
+{
+ DispatchAction( C2U("ok") );
+}
+
+// -----------------------------------------------------------------------
+
+void ExtensionsTabPage::HideWindow()
+{
+ if ( !m_bIsWindowHidden && m_xPage.is() )
+ {
+ m_xPage->setVisible( sal_False );
+ m_bIsWindowHidden = true;
+ }
+}
+
diff --git a/cui/source/options/treeopt.hrc b/cui/source/options/treeopt.hrc
new file mode 100644
index 000000000000..7f8fab812dc2
--- /dev/null
+++ b/cui/source/options/treeopt.hrc
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: treeopt.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 PB_OK 1
+#define PB_CANCEL 2
+#define PB_HELP 3
+#define PB_BACK 4
+#define TLB_PAGES 5
+#define FT_HELPTEXT 6
+#define STR_HELPTEXTS 7
+#define IMG_LIST 8
+#define IMG_HELP 9
+#define FT_PAGE_TITLE 10
+#define FL_LINE_1 11
+
+#define BMP_ROOT_CLOSED 17
+#define BMP_ROOT_OPENED 18
+#define FB_BORDER 19
+
+#define IMG_HINT 20
+#define FT_HINT 21
+#define CB_DISABLE 22
+#define BTN_HINT 23
+#define ST_LOAD_ERROR 24
+
+#define STR_GENERAL_PAGES_START 1
+#define STR_GENERAL (STR_GENERAL_PAGES_START)
+#define STR_MISC_PAGE (STR_GENERAL_PAGES_START + 1)
+#define STR_DESKTOP_PAGE (STR_GENERAL_PAGES_START + 2)
+#define STR_VIEW_PAGE (STR_GENERAL_PAGES_START + 3)
+#define STR_FONT_PAGE (STR_GENERAL_PAGES_START + 4)
+#define STR_PRINT_PAGE (STR_GENERAL_PAGES_START + 5)
+#define STR_COLOR_PAGE (STR_GENERAL_PAGES_START + 6)
+#define STR_LING_PAGE (STR_GENERAL_PAGES_START + 7)
+#define STR_PATH_PAGE (STR_GENERAL_PAGES_START + 8)
+#define STR_SAVE_PAGE (STR_GENERAL_PAGES_START + 9)
+#define STR_USERDATA_PAGE (STR_GENERAL_PAGES_START + 10)
+
+#define FB_IMAGE 43
+
+
+// metrics
+
+#define WIDTH_PAGEFRAME 263
+#define HEIGHT_PAGEFRAME 191
+#define WIDTH_IMG_HELP 25
+#define HEIGHT_IMG_HELP 30
+
+#define COL_1 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define COL_2 (COL_1+0)
+#define COL_3 (COL_2+RSC_SP_GRP_SPACE_X)
+#define COL_11 (COL_3+WIDTH_PAGEFRAME)
+#define COL_12 (COL_11+RSC_SP_DLG_INNERBORDER_RIGHT)
+#define COL_10 (COL_11-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_9 (COL_10-RSC_SP_CTRL_GROUP_X)
+#define COL_8 (COL_9-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_7 (COL_8-RSC_SP_CTRL_GROUP_X)
+#define COL_6 (COL_7-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_5 (COL_6-RSC_SP_CTRL_GROUP_X)
+#define COL_4 (COL_5-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_3_1 (COL_3+RSC_SP_TBPG_INNERBORDER_LEFT)
+#define COL_3_3 (COL_3_1+WIDTH_IMG_HELP)
+#define COL_3_5 (COL_11-RSC_SP_TBPG_INNERBORDER_RIGHT)
+
+#define ROW_1 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ROW_2 (ROW_1+HEIGHT_PAGEFRAME)
+#define ROW_3 (ROW_2+RSC_SP_CTRL_GROUP_Y)
+#define ROW_4 (ROW_3+RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_5 (ROW_4+RSC_SP_DLG_INNERBORDER_BOTTOM)
+#define ROW_1_1 (ROW_1+2)
+#define ROW_1_2 (ROW_1+12)
+#define ROW_1_3 (ROW_1_1+HEIGHT_IMG_HELP+2)
+#define ROW_1_4 (ROW_1_3+8)
+
diff --git a/cui/source/options/treeopt.src b/cui/source/options/treeopt.src
new file mode 100644
index 000000000000..2bf5d0825cdc
--- /dev/null
+++ b/cui/source/options/treeopt.src
@@ -0,0 +1,386 @@
+/*************************************************************************
+ *
+ * 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: treeopt.src,v $
+ * $Revision: 1.22 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "treeopt.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+#define IMAGE_STDBTN_COLOR Color { Red = 0xC000; Green = 0xC000; Blue = 0xC000; }
+
+ModalDialog RID_OFADLG_OPTIONS_TREE
+{
+ HelpID = HID_OFADLG_OPTIONS_TREE;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+
+ Size = MAP_APPFONT ( COL_12 , ROW_5 ) ;
+ Text [ en-US ] = "Options";
+
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( COL_4, ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( COL_6, ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( COL_8, ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_BACK
+ {
+ Pos = MAP_APPFONT ( COL_10, ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Back" ;
+ };
+ //TreeListBox
+ Control TLB_PAGES
+ {
+ Pos = MAP_APPFONT ( COL_1, ROW_1 ) ;
+ Size = MAP_APPFONT ( (COL_2-COL_1), (ROW_4-ROW_1) );
+ TabStop = TRUE ;
+ Border = TRUE;
+ };
+ Control FB_BORDER
+ {
+ Pos = MAP_APPFONT ( COL_3, ROW_1 ) ;
+ Size = MAP_APPFONT ( WIDTH_PAGEFRAME, HEIGHT_PAGEFRAME ) ;
+ Hide = TRUE;
+ };
+ FixedImage IMG_HELP
+ {
+ Pos = MAP_APPFONT ( COL_3_1, ROW_1_1 ) ;
+ Size = MAP_APPFONT ( WIDTH_IMG_HELP, HEIGHT_IMG_HELP ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_PAGE_TITLE
+ {
+ Pos = MAP_APPFONT ( COL_3_3, ROW_1_2 ) ;
+ Size = MAP_APPFONT ( (COL_3_5-COL_3_3), 15 ) ;
+ Hide = TRUE;
+ };
+ FixedLine FL_LINE_1
+ {
+ Pos = MAP_APPFONT ( COL_3_1 , ROW_1_3 ) ;
+ Size = MAP_APPFONT ( (COL_3_5-COL_3_1), 1 ) ;
+ Comment = "Trennlinie" ;
+ Hide = TRUE;
+ };
+ FixedText FT_HELPTEXT
+ {
+ Pos = MAP_APPFONT ( COL_3_3, ROW_1_4 ) ;
+ Size = MAP_APPFONT ( (COL_3_5-COL_3_3), (HEIGHT_PAGEFRAME-ROW_1_4-1) ) ;
+ WordBreak = TRUE;
+ Hide = TRUE;
+ };
+ String ST_LOAD_ERROR
+ {
+ Text [ en-US ] = "The selected module could not be loaded.";
+ };
+ StringArray STR_HELPTEXTS
+ {
+ ItemList [ en-US ] =
+ {
+ < "This dialog is used to define general settings when working with %PRODUCTNAME. Enter your personal data, the defaults to be used when saving documents, and paths to important files. These settings will be saved automatically and used in later sessions as well."; SID_GENERAL_OPTIONS; > ;
+ < "This is where you make settings concerning language and writing aids for your work with %PRODUCTNAME."; SID_LANGUAGE_OPTIONS; > ;
+ < "This is where you configure %PRODUCTNAME for the Internet. You can define search engines or save your proxy settings." ; SID_INET_DLG; > ;
+ < "This is where you specify various settings for text documents. These settings determine how your text documents are handled in %PRODUCTNAME and are valid for all new %PRODUCTNAME Writer documents. You can also define a few settings for the active text document if you save it afterwards." ; SID_SW_EDITOPTIONS; > ;
+ < "This is where you define the basic settings for %PRODUCTNAME documents in HTML format. For example, you decide which contents should be displayed on the screen or printed, how the pages are scrolled on the screen, in which color keywords are highlighted in the source text and much more." ; SID_SW_ONLINEOPTIONS; > ;
+ < "This is where you define various global settings for spreadsheets. For example, you can define which contents should be displayed and in which direction the cursor will move after you enter data in a cell. You also define sort lists, the number of the decimal places displayed, etc." ; SID_SC_EDITOPTIONS; > ;
+ < "This is where you define the settings that apply to all newly saved presentations. Among other things, you decide which contents are displayed on the slides, which default unit of measure is used, if and how grid alignment is used, and if notes and handouts are always printed." ; SID_SD_EDITOPTIONS; > ;
+ < "This is where you define the settings for drawing documents. Among other things, you determine which contents are displayed on the pages, which scale is used, if and how grid alignment is used, and which contents are printed by default." ; SID_SD_GRAPHIC_OPTIONS; > ;
+ < "This is where you select the print format and print options for all newly saved formula documents. These options take effect when you want to print a formula directly from %PRODUCTNAME Math." ; SID_SM_EDITOPTIONS; > ;
+ < "This is where you specify general default settings for your %PRODUCTNAME Charts. Set the colors you want for all new charts." ; SID_SCH_EDITOPTIONS; > ;
+ < "This is where you define general settings for accessing external data sources."; SID_SB_STARBASEOPTIONS; > ;
+ < "This is where you define general settings for opening and saving documents in external formats. You can control the behavior of macros or OLE objects in Microsoft Office documents or define settings for HTML documents." ; SID_FILTER_DLG; > ;
+ };
+ };
+ Bitmap BMP_ROOT_CLOSED
+ {
+ File = "plus.bmp" ;
+ };
+ Bitmap BMP_ROOT_OPENED
+ {
+ File = "minus.bmp" ;
+ };
+};
+
+Resource RID_OFADLG_OPTIONS_TREE_PAGES
+{
+ StringArray SID_GENERAL_OPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME" ; 0; > ;
+ < "User Data" ; RID_SFXPAGE_GENERAL; > ;
+ < "General" ; OFA_TP_MISC; > ;
+ < "Memory" ; OFA_TP_MEMORY; > ;
+ < "View" ; OFA_TP_VIEW ; > ;
+ < "Print" ; RID_SFXPAGE_PRINTOPTIONS; > ;
+ < "Paths" ; RID_SFXPAGE_PATH; > ;
+ < "Colors" ; RID_SVXPAGE_COLOR; > ;
+ < "Fonts" ; RID_SVX_FONT_SUBSTITUTION ; > ;
+ < "Security" ; RID_SVXPAGE_INET_SECURITY ; > ;
+ < "Appearance" ; RID_SVXPAGE_COLORCONFIG ; > ;
+ < "Accessibility" ; RID_SVXPAGE_ACCESSIBILITYCONFIG ; > ;
+ < "Java" ; RID_SVXPAGE_OPTIONS_JAVA ; > ;
+ < "Network Identity" ; RID_SVXPAGE_SSO ; > ;
+ < "Online Update" ; RID_SVXPAGE_ONLINEUPDATE ; > ;
+ < "" ; RID_SVXPAGE_IMPROVEMENT ; > ;
+ };
+ };
+ StringArray SID_LANGUAGE_OPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "Language Settings" ; 0; > ;
+ < "Languages"; OFA_TP_LANGUAGES; > ;
+ < "Writing Aids" ; RID_SFXPAGE_LINGU; > ;
+ < "Searching in Japanese" ; RID_SVXPAGE_JSEARCH_OPTIONS; > ;
+ < "Asian Layout" ; RID_SVXPAGE_ASIAN_LAYOUT; > ;
+ < "Complex Text Layout" ; RID_SVXPAGE_OPTIONS_CTL; >;
+ };
+ };
+ StringArray SID_INET_DLG
+ {
+ //modified by jmeng begin
+ ItemList [ en-US ] =
+ {
+ < "Internet" ; 0; > ;
+ < "Proxy" ; RID_SVXPAGE_INET_PROXY; > ;
+ < "Search" ; RID_SVXPAGE_INET_SEARCH; > ;
+ < "E-mail" ; RID_SVXPAGE_INET_MAIL; > ;
+ < "Browser Plug-in" ; RID_SVXPAGE_INET_MOZPLUGIN; > ;
+ };
+ //modified by jmeng end
+ };
+ StringArray SID_SW_EDITOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Writer" ; 0; > ;
+ < "General" ; RID_SW_TP_OPTLOAD_PAGE ; > ;
+ < "View" ; RID_SW_TP_CONTENT_OPT ;> ;
+ < "Formatting Aids" ; RID_SW_TP_OPTSHDWCRSR ; > ;
+ < "Grid" ; RID_SVXPAGE_GRID ; > ;
+ < "Basic Fonts (Western)" ;RID_SW_TP_STD_FONT ; > ;
+ < "Basic Fonts (Asian)" ;RID_SW_TP_STD_FONT_CJK ; > ;
+ < "Basic Fonts (CTL)" ; RID_SW_TP_STD_FONT_CTL ; > ;
+ < "Print" ; RID_SW_TP_OPTPRINT_PAGE ; > ;
+ < "Table" ; RID_SW_TP_OPTTABLE_PAGE ; > ;
+ < "Changes" ; RID_SW_TP_REDLINE_OPT ; > ;
+ < "Compatibility" ; RID_SW_TP_OPTCOMPATIBILITY_PAGE ; > ;
+ < "AutoCaption" ; RID_SW_TP_OPTCAPTION_PAGE ; > ;
+ < "Mail Merge E-mail" ; RID_SW_TP_MAILCONFIG ; >;
+ };
+ };
+ StringArray SID_SW_ONLINEOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Writer/Web" ; 0; > ;
+ < "View" ; RID_SW_TP_HTML_CONTENT_OPT ;> ;
+ < "Formatting Aids" ; RID_SW_TP_HTML_OPTSHDWCRSR ; > ;
+ < "Grid" ; RID_SW_TP_HTML_OPTGRID_PAGE ; > ;
+ < "Print" ; RID_SW_TP_HTML_OPTPRINT_PAGE ; > ;
+ < "Table" ; RID_SW_TP_HTML_OPTTABLE_PAGE ; > ;
+ < "Background" ; RID_SW_TP_BACKGROUND ; > ;
+ };
+ };
+ StringArray SID_SM_EDITOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Math" ; 0; > ;
+ < "Settings" ; SID_SM_TP_PRINTOPTIONS;> ;
+ };
+ };
+ StringArray SID_SC_EDITOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Calc" ; 0; > ;
+ < "General" ; SID_SC_TP_LAYOUT ;> ;
+ < "View" ; SID_SC_TP_CONTENT ;> ;
+ < "International" ; RID_OFA_TP_INTERNATIONAL ;> ;
+ < "Calculate" ; SID_SC_TP_CALC ;> ;
+ < "Sort Lists" ; SID_SC_TP_USERLISTS ;> ;
+ < "Changes" ; SID_SC_TP_CHANGES ;> ;
+ < "Grid" ; SID_SC_TP_GRID ;> ;
+ < "Print" ; RID_SC_TP_PRINT ;> ;
+ };
+ };
+ StringArray SID_SD_EDITOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Impress" ; 0; > ;
+ < "General"; SID_SI_TP_MISC ; > ;
+ < "View" ; SID_SI_TP_CONTENTS ; > ;
+ < "Grid" ; SID_SI_TP_SNAP ; > ;
+ < "Print" ; SID_SI_TP_PRINT ; > ;
+ };
+ };
+ StringArray SID_SD_GRAPHIC_OPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Draw" ; 0; > ;
+ < "General" ; SID_SD_TP_MISC ; > ;
+ < "View" ; SID_SD_TP_CONTENTS ; > ;
+ < "Grid" ; SID_SD_TP_SNAP ; > ;
+ < "Print" ; SID_SD_TP_PRINT ; > ;
+ };
+ };
+ StringArray SID_SCH_EDITOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "Charts" ; 0; > ;
+ < "Default Colors" ; RID_OPTPAGE_CHART_DEFCOLORS ; > ;
+ };
+ };
+ StringArray SID_FILTER_DLG
+ {
+ ItemList [ en-US ] =
+ {
+ < "Load/Save" ; 0; > ;
+ < "General" ; RID_SFXPAGE_SAVE; > ;
+ < "VBA Properties" ; SID_OPTFILTER_MSOFFICE; > ;
+ < "Microsoft Office" ; RID_OFAPAGE_MSFILTEROPT2; > ;
+ < "HTML Compatibility" ; RID_OFAPAGE_HTMLOPT ; > ;
+ };
+ };
+ StringArray SID_SB_STARBASEOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Base" ; 0; > ;
+ < "Connections" ; SID_SB_CONNECTIONPOOLING; > ;
+ < "Databases" ; SID_SB_DBREGISTEROPTIONS; > ;
+ };
+ };
+};
+String RID_RIDER_SLL_SITE
+{
+ Text [ en-US ] = "Site certificates" ;
+};
+String RID_RIDER_SLL_PERSONAL
+{
+ Text [ en-US ] = "Personal certificates" ;
+};
+
+// RID_OFADLG_OPTIONS_TREE_WARNING ---------------------------------------
+
+ModalDialog RID_OFADLG_OPTIONS_TREE_HINT
+{
+ OutputSize = TRUE;
+ Size = MAP_APPFONT( 240, 105 );
+ Moveable = TRUE;
+ Closeable = TRUE;
+ FixedImage IMG_HINT
+ {
+ Pos = MAP_APPFONT( 6, 6 );
+ Size = MAP_APPFONT( 30, 30 );
+ };
+ FixedText FT_HINT
+ {
+ Pos = MAP_APPFONT( 39, 6 );
+ Size = MAP_APPFONT( 195, 60 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "Please note: the settings displayed refer to the internal browser of %PRODUCTNAME (%PRODUCTNAME Writer/Web). In \"Tools - Options - Browser - External Browser\" the use of a different browser has been activated. In order to be able to use the same settings in other browsers you need to define these in the external browser settings.";
+ };
+ CheckBox CB_DISABLE
+ {
+ Pos = MAP_APPFONT( 39, 69 );
+ Size = MAP_APPFONT( 195, 12 );
+ Text [ en-US ] = "~Do not show information again";
+ };
+ OKButton BTN_HINT
+ {
+ Pos = MAP_APPFONT( 95, 85 );
+ Size = MAP_APPFONT( 50, 14 );
+ };
+};
+
+// ******************************************************************* EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
new file mode 100644
index 000000000000..37be48be6233
--- /dev/null
+++ b/cui/source/options/webconninfo.cxx
@@ -0,0 +1,377 @@
+/*************************************************************************
+ *
+ * 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: webconninfo.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <com/sun/star/task/UrlRecord.hpp>
+#include <com/sun/star/task/XPasswordContainer.hpp>
+#include <com/sun/star/task/XMasterPasswordHandling.hpp>
+#include "com/sun/star/task/XUrlContainer.hpp"
+#include <comphelper/processfactory.hxx>
+#include <comphelper/docpasswordrequest.hxx>
+#include "webconninfo.hxx"
+#include "webconninfo.hrc"
+
+using namespace ::com::sun::star;
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+// class PasswordTable ---------------------------------------------------
+
+PasswordTable::PasswordTable( Window* pParent, const ResId& rResId ) :
+ SvxSimpleTable( pParent, rResId )
+{
+ SetWindowBits( GetStyle() | WB_NOINITIALSELECTION );
+}
+
+void PasswordTable::InsertHeaderItem( USHORT nColumn, const String& rText, HeaderBarItemBits nBits )
+{
+ GetTheHeaderBar()->InsertItem( nColumn, rText, 0, nBits );
+}
+
+void PasswordTable::ResetTabs()
+{
+ SetTabs();
+}
+
+void PasswordTable::Resort( bool bForced )
+{
+ USHORT nColumn = GetSelectedCol();
+ if ( 0 == nColumn || bForced ) // only the first column is sorted
+ {
+ HeaderBarItemBits nBits = GetTheHeaderBar()->GetItemBits(1);
+ BOOL bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
+ SvSortMode eMode = SortAscending;
+
+ if ( bUp )
+ {
+ nBits &= ~HIB_UPARROW;
+ nBits |= HIB_DOWNARROW;
+ eMode = SortDescending;
+ }
+ else
+ {
+ nBits &= ~HIB_DOWNARROW;
+ nBits |= HIB_UPARROW;
+ }
+ GetTheHeaderBar()->SetItemBits( 1, nBits );
+ SvTreeList* pListModel = GetModel();
+ pListModel->SetSortMode( eMode );
+ pListModel->Resort();
+ }
+}
+
+// class WebConnectionInfoDialog -----------------------------------------
+
+// -----------------------------------------------------------------------
+WebConnectionInfoDialog::WebConnectionInfoDialog( Window* pParent ) :
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_WEBCONNECTION_INFO ) )
+ ,m_aNeverShownFI ( this, SVX_RES( FI_NEVERSHOWN ) )
+ ,m_aPasswordsLB ( this, SVX_RES( LB_PASSWORDS ) )
+ ,m_aRemoveBtn ( this, SVX_RES( PB_REMOVE ) )
+ ,m_aRemoveAllBtn ( this, SVX_RES( PB_REMOVEALL ) )
+ ,m_aChangeBtn ( this, SVX_RES( PB_CHANGE ) )
+ ,m_aButtonsFL ( this, SVX_RES( FL_BUTTONS ) )
+ ,m_aCloseBtn ( this, SVX_RES( PB_CLOSE ) )
+ ,m_aHelpBtn ( this, SVX_RES( PB_HELP ) )
+ ,m_nPos ( -1 )
+{
+ static long aStaticTabs[]= { 3, 0, 150, 250 };
+ m_aPasswordsLB.SetTabs( aStaticTabs );
+ m_aPasswordsLB.InsertHeaderItem( 1, SVX_RESSTR( STR_WEBSITE ),
+ HIB_LEFT | HIB_VCENTER | HIB_FIXEDPOS | HIB_CLICKABLE | HIB_UPARROW );
+ m_aPasswordsLB.InsertHeaderItem( 2, SVX_RESSTR( STR_USERNAME ),
+ HIB_LEFT | HIB_VCENTER | HIB_FIXEDPOS );
+ m_aPasswordsLB.ResetTabs();
+
+ FreeResource();
+
+ m_aPasswordsLB.SetHeaderBarClickHdl( LINK( this, WebConnectionInfoDialog, HeaderBarClickedHdl ) );
+ m_aRemoveBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemovePasswordHdl ) );
+ m_aRemoveAllBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemoveAllPasswordsHdl ) );
+ m_aChangeBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, ChangePasswordHdl ) );
+
+ // one button too small for its text?
+ sal_Int32 i = 0;
+ long nBtnTextWidth = 0;
+ Window* pButtons[] = { &m_aRemoveBtn, &m_aRemoveAllBtn, &m_aChangeBtn };
+ Window** pButton = pButtons;
+ const sal_Int32 nBCount = sizeof( pButtons ) / sizeof( pButtons[ 0 ] );
+ for ( ; i < nBCount; ++i, ++pButton )
+ {
+ long nTemp = (*pButton)->GetCtrlTextWidth( (*pButton)->GetText() );
+ if ( nTemp > nBtnTextWidth )
+ nBtnTextWidth = nTemp;
+ }
+ nBtnTextWidth = nBtnTextWidth * 115 / 100; // a little offset
+ long nButtonWidth = m_aRemoveBtn.GetSizePixel().Width();
+ if ( nBtnTextWidth > nButtonWidth )
+ {
+ // so make the buttons broader and its control in front of it smaller
+ long nDelta = nBtnTextWidth - nButtonWidth;
+ pButton = pButtons;
+ for ( i = 0; i < nBCount; ++i, ++pButton )
+ {
+ Point aNewPos = (*pButton)->GetPosPixel();
+ if ( &m_aRemoveAllBtn == (*pButton) )
+ aNewPos.X() += nDelta;
+ else if ( &m_aChangeBtn == (*pButton) )
+ aNewPos.X() -= nDelta;
+ Size aNewSize = (*pButton)->GetSizePixel();
+ aNewSize.Width() += nDelta;
+ (*pButton)->SetPosSizePixel( aNewPos, aNewSize );
+ }
+ }
+
+ FillPasswordList();
+
+ m_aRemoveBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemovePasswordHdl ) );
+ m_aRemoveAllBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemoveAllPasswordsHdl ) );
+ m_aChangeBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, ChangePasswordHdl ) );
+ m_aPasswordsLB.SetSelectHdl( LINK( this, WebConnectionInfoDialog, EntrySelectedHdl ) );
+
+ m_aRemoveBtn.Enable( FALSE );
+ m_aChangeBtn.Enable( FALSE );
+
+ HeaderBarClickedHdl( NULL );
+}
+
+// -----------------------------------------------------------------------
+WebConnectionInfoDialog::~WebConnectionInfoDialog()
+{
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( WebConnectionInfoDialog, HeaderBarClickedHdl, SvxSimpleTable*, pTable )
+{
+ m_aPasswordsLB.Resort( NULL == pTable );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+void WebConnectionInfoDialog::FillPasswordList()
+{
+ try
+ {
+ uno::Reference< task::XMasterPasswordHandling > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ uno::UNO_QUERY );
+
+ if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() )
+ {
+ uno::Reference< task::XPasswordContainer > xPasswdContainer( xMasterPasswd, uno::UNO_QUERY_THROW );
+ uno::Reference< task::XInteractionHandler > xInteractionHandler(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.InteractionHandler" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ uno::Sequence< task::UrlRecord > aURLEntries = xPasswdContainer->getAllPersistent( xInteractionHandler );
+ sal_Int32 nCount = 0;
+ for ( sal_Int32 nURLInd = 0; nURLInd < aURLEntries.getLength(); nURLInd++ )
+ {
+ for ( sal_Int32 nUserInd = 0; nUserInd < aURLEntries[nURLInd].UserList.getLength(); nUserInd++ )
+ {
+ ::rtl::OUString aUIEntry( aURLEntries[nURLInd].Url );
+ aUIEntry += ::rtl::OUString::valueOf( (sal_Unicode)'\t' );
+ aUIEntry += aURLEntries[nURLInd].UserList[nUserInd].UserName;
+ SvLBoxEntry* pEntry = m_aPasswordsLB.InsertEntry( aUIEntry );
+ pEntry->SetUserData( (void*)(nCount++) );
+ }
+ }
+
+ // remember pos of first url container entry.
+ m_nPos = nCount;
+
+ uno::Reference< task::XUrlContainer > xUrlContainer(
+ xPasswdContainer, uno::UNO_QUERY_THROW );
+
+ uno::Sequence< rtl::OUString > aUrls
+ = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ );
+
+ for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ )
+ {
+ ::rtl::OUString aUIEntry( aUrls[ nURLIdx ] );
+ aUIEntry += ::rtl::OUString::valueOf( (sal_Unicode)'\t' );
+ aUIEntry += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*" ) );
+ SvLBoxEntry* pEntry = m_aPasswordsLB.InsertEntry( aUIEntry );
+ pEntry->SetUserData( (void*)(nCount++) );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {}
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( WebConnectionInfoDialog, RemovePasswordHdl, PushButton*, EMPTYARG )
+{
+ try
+ {
+ SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry();
+ if ( pEntry )
+ {
+ ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 );
+ ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 );
+
+ uno::Reference< task::XPasswordContainer > xPasswdContainer(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.PasswordContainer" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData();
+ if ( nPos < m_nPos )
+ {
+ xPasswdContainer->removePersistent( aURL, aUserName );
+ }
+ else
+ {
+ uno::Reference< task::XUrlContainer > xUrlContainer(
+ xPasswdContainer, uno::UNO_QUERY_THROW );
+ xUrlContainer->removeUrl( aURL );
+ }
+ m_aPasswordsLB.RemoveEntry( pEntry );
+ }
+ }
+ catch( uno::Exception& )
+ {}
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( WebConnectionInfoDialog, RemoveAllPasswordsHdl, PushButton*, EMPTYARG )
+{
+ try
+ {
+ uno::Reference< task::XPasswordContainer > xPasswdContainer(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.PasswordContainer" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ // should the master password be requested before?
+ xPasswdContainer->removeAllPersistent();
+
+ uno::Reference< task::XUrlContainer > xUrlContainer(
+ xPasswdContainer, uno::UNO_QUERY_THROW );
+ uno::Sequence< rtl::OUString > aUrls
+ = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ );
+ for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ )
+ xUrlContainer->removeUrl( aUrls[ nURLIdx ] );
+
+ m_aPasswordsLB.Clear();
+ }
+ catch( uno::Exception& )
+ {}
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( WebConnectionInfoDialog, ChangePasswordHdl, PushButton*, EMPTYARG )
+{
+ try
+ {
+ SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry();
+ if ( pEntry )
+ {
+ ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 );
+ ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 );
+
+ ::comphelper::DocPasswordRequest* pPasswordRequest
+ = new ::comphelper::DocPasswordRequest(
+ ::comphelper::DocPasswordRequestType_STANDARD,
+ task::PasswordRequestMode_PASSWORD_CREATE, aURL );
+ uno::Reference< task::XInteractionRequest > rRequest( pPasswordRequest );
+
+ uno::Reference< task::XInteractionHandler > xInteractionHandler(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.InteractionHandler" ) ) ),
+ uno::UNO_QUERY_THROW );
+ xInteractionHandler->handle( rRequest );
+
+ if ( pPasswordRequest->isPassword() )
+ {
+ String aNewPass = pPasswordRequest->getPassword();
+ uno::Sequence< ::rtl::OUString > aPasswd( 1 );
+ aPasswd[0] = aNewPass;
+
+ uno::Reference< task::XPasswordContainer > xPasswdContainer(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.PasswordContainer" ) ) ),
+ uno::UNO_QUERY_THROW );
+ xPasswdContainer->addPersistent(
+ aURL, aUserName, aPasswd, xInteractionHandler );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {}
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( WebConnectionInfoDialog, EntrySelectedHdl, void*, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry();
+ if ( !pEntry )
+ {
+ m_aRemoveBtn.Enable( FALSE );
+ m_aChangeBtn.Enable( FALSE );
+ }
+ else
+ {
+ m_aRemoveBtn.Enable( TRUE );
+
+ // url container entries (-> use system credentials) have
+ // no password
+ sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData();
+ m_aChangeBtn.Enable( nPos < m_nPos );
+ }
+
+ return 0;
+}
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
diff --git a/cui/source/options/webconninfo.hrc b/cui/source/options/webconninfo.hrc
new file mode 100644
index 000000000000..de040b302d89
--- /dev/null
+++ b/cui/source/options/webconninfo.hrc
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: webconninfo.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_WEBCONNINFO_HRC
+#define _SVX_WEBCONNINFO_HRC
+
+#define FI_NEVERSHOWN 10
+#define LB_PASSWORDS 11
+#define PB_REMOVE 12
+#define PB_REMOVEALL 13
+#define PB_CHANGE 14
+#define FL_BUTTONS 15
+// #define PB_OK 16
+#define PB_CLOSE 17
+#define PB_HELP 18
+
+#define STR_WEBSITE 10
+#define STR_USERNAME 11
+
+#define DLG_WIDTH 260
+#define DLG_HEIGHT 150
+
+#define COL_0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define COL_1 (COL_0+RSC_CD_PUSHBUTTON_WIDTH+RSC_SP_CTRL_GROUP_X)
+#define COL_2 (DLG_WIDTH-RSC_SP_DLG_INNERBORDER_LEFT)
+#define COL_C (COL_2-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_B (COL_C-RSC_SP_CTRL_X-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_A (COL_B-RSC_SP_CTRL_GROUP_X-RSC_CD_PUSHBUTTON_WIDTH)
+
+#define ROW_0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ROW_1 (ROW_0+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_5 (DLG_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_4 (ROW_5-RSC_SP_FLGR_SPACE_Y-RSC_CD_FIXEDLINE_HEIGHT)
+#define ROW_3 (ROW_4-RSC_SP_FLGR_SPACE_Y-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_2 (ROW_3-RSC_SP_GRP_SPACE_Y)
+
+#endif // #ifndef _SVX_WEBCONNINFO_HRC
+
diff --git a/cui/source/options/webconninfo.hxx b/cui/source/options/webconninfo.hxx
new file mode 100644
index 000000000000..f24b9f0dd4c8
--- /dev/null
+++ b/cui/source/options/webconninfo.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * 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: webconninfo.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_WEBCONNINFO_HXX
+#define _SVX_WEBCONNINFO_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svx/simptabl.hxx>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ class PasswordTable : public SvxSimpleTable
+ {
+ public:
+ PasswordTable( Window* pParent, const ResId& rResId );
+
+ void InsertHeaderItem( USHORT nColumn, const String& rText, HeaderBarItemBits nBits );
+ void ResetTabs();
+ void Resort( bool bForced );
+ };
+
+ //====================================================================
+ //= class WebConnectionIfoDialog
+ //====================================================================
+ class WebConnectionInfoDialog : public ModalDialog
+ {
+ private:
+ FixedInfo m_aNeverShownFI;
+ PasswordTable m_aPasswordsLB;
+ PushButton m_aRemoveBtn;
+ PushButton m_aRemoveAllBtn;
+ PushButton m_aChangeBtn;
+ FixedLine m_aButtonsFL;
+ CancelButton m_aCloseBtn;
+ HelpButton m_aHelpBtn;
+ sal_Int32 m_nPos;
+
+ DECL_LINK( HeaderBarClickedHdl, SvxSimpleTable* );
+ DECL_LINK( RemovePasswordHdl, PushButton* );
+ DECL_LINK( RemoveAllPasswordsHdl, PushButton* );
+ DECL_LINK( ChangePasswordHdl, PushButton* );
+ DECL_LINK( EntrySelectedHdl, void* );
+
+ void FillPasswordList();
+
+ public:
+ WebConnectionInfoDialog( Window* pParent );
+ ~WebConnectionInfoDialog();
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // #ifndef _SVX_WEBCONNINFO_HXX
+
diff --git a/cui/source/options/webconninfo.src b/cui/source/options/webconninfo.src
new file mode 100644
index 000000000000..328478c56e83
--- /dev/null
+++ b/cui/source/options/webconninfo.src
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * 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: webconninfo.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svtools/controldims.hrc>
+#include "webconninfo.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+ModalDialog RID_SVXDLG_WEBCONNECTION_INFO
+{
+ HelpID = HID_DLG_WEBCONNECTION_INFO ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( DLG_WIDTH , DLG_HEIGHT ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Stored Web Connection Information" ;
+ FixedText FI_NEVERSHOWN
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_0 );
+ Size = MAP_APPFONT( COL_2-COL_0, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Web login information (passwords are never shown)";
+ };
+ Control LB_PASSWORDS
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_1 ) ;
+ Size = MAP_APPFONT ( COL_2-COL_0 , ROW_2-ROW_1 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_REMOVE
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "Remove";
+ };
+ PushButton PB_REMOVEALL
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "Remove All";
+ };
+ PushButton PB_CHANGE
+ {
+ Pos = MAP_APPFONT ( COL_C , ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "Change Password...";
+ };
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT( 0, ROW_4 );
+ Size = MAP_APPFONT( DLG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ CancelButton PB_CLOSE
+ {
+ Pos = MAP_APPFONT ( COL_B , ROW_5 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ Text [ en-US ] = "Close";
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( COL_C , ROW_5 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ String STR_WEBSITE
+ {
+ Text [ en-US ] = "Website";
+ };
+ String STR_USERNAME
+ {
+ Text [ en-US ] = "User name";
+ };
+};
+
diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
new file mode 100644
index 000000000000..9edac23e6669
--- /dev/null
+++ b/cui/source/tabpages/align.cxx
@@ -0,0 +1,299 @@
+/*************************************************************************
+ *
+ * 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: align.cxx,v $
+ * $Revision: 1.26.272.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svx/svxenum.hxx>
+
+#include <svx/dialogs.hrc>
+#include "align.hrc"
+#include <svx/rotmodit.hxx>
+
+#include <svx/algitem.hxx>
+#include <svx/frmdiritem.hxx>
+#include "align.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/dlgutil.hxx>
+#include <tools/shl.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/itemconnect.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svl/languageoptions.hxx>
+#include <svtools/localresaccess.hxx>
+#include <svx/svxids.hrc> //CHINA001
+#include <svx/flagsdef.hxx> //CHINA001
+#include <svl/intitem.hxx> //CHINA001
+#include <sfx2/request.hxx> //CHINA001
+
+namespace svx {
+
+// item connections ===========================================================
+
+// horizontal alignment -------------------------------------------------------
+
+typedef sfx::ValueItemWrapper< SvxHorJustifyItem, SvxCellHorJustify, USHORT > HorJustItemWrapper;
+typedef sfx::ListBoxConnection< HorJustItemWrapper > HorJustConnection;
+
+static const HorJustConnection::MapEntryType s_pHorJustMap[] =
+{
+ { ALIGNDLG_HORALIGN_STD, SVX_HOR_JUSTIFY_STANDARD },
+ { ALIGNDLG_HORALIGN_LEFT, SVX_HOR_JUSTIFY_LEFT },
+ { ALIGNDLG_HORALIGN_CENTER, SVX_HOR_JUSTIFY_CENTER },
+ { ALIGNDLG_HORALIGN_RIGHT, SVX_HOR_JUSTIFY_RIGHT },
+ { ALIGNDLG_HORALIGN_BLOCK, SVX_HOR_JUSTIFY_BLOCK },
+ { ALIGNDLG_HORALIGN_FILL, SVX_HOR_JUSTIFY_REPEAT },
+ { LISTBOX_ENTRY_NOTFOUND, SVX_HOR_JUSTIFY_STANDARD }
+};
+
+// vertical alignment ---------------------------------------------------------
+
+typedef sfx::ValueItemWrapper< SvxVerJustifyItem, SvxCellVerJustify, USHORT > VerJustItemWrapper;
+typedef sfx::ListBoxConnection< VerJustItemWrapper > VerJustConnection;
+
+static const VerJustConnection::MapEntryType s_pVerJustMap[] =
+{
+ { ALIGNDLG_VERALIGN_STD, SVX_VER_JUSTIFY_STANDARD },
+ { ALIGNDLG_VERALIGN_TOP, SVX_VER_JUSTIFY_TOP },
+ { ALIGNDLG_VERALIGN_MID, SVX_VER_JUSTIFY_CENTER },
+ { ALIGNDLG_VERALIGN_BOTTOM, SVX_VER_JUSTIFY_BOTTOM },
+ { LISTBOX_ENTRY_NOTFOUND, SVX_VER_JUSTIFY_STANDARD }
+};
+
+// cell rotate mode -----------------------------------------------------------
+
+typedef sfx::ValueItemWrapper< SvxRotateModeItem, SvxRotateMode, USHORT > RotateModeItemWrapper;
+typedef sfx::ValueSetConnection< RotateModeItemWrapper > RotateModeConnection;
+
+static const RotateModeConnection::MapEntryType s_pRotateModeMap[] =
+{
+ { IID_BOTTOMLOCK, SVX_ROTATE_MODE_BOTTOM },
+ { IID_TOPLOCK, SVX_ROTATE_MODE_TOP },
+ { IID_CELLLOCK, SVX_ROTATE_MODE_STANDARD },
+ { VALUESET_ITEM_NOTFOUND, SVX_ROTATE_MODE_STANDARD }
+};
+
+// ============================================================================
+
+static USHORT s_pRanges[] =
+{
+ SID_ATTR_ALIGN_HOR_JUSTIFY,SID_ATTR_ALIGN_VER_JUSTIFY,
+ SID_ATTR_ALIGN_STACKED,SID_ATTR_ALIGN_LINEBREAK,
+ SID_ATTR_ALIGN_INDENT,SID_ATTR_ALIGN_INDENT,
+ SID_ATTR_ALIGN_DEGREES,SID_ATTR_ALIGN_DEGREES,
+ SID_ATTR_ALIGN_LOCKPOS,SID_ATTR_ALIGN_LOCKPOS,
+ SID_ATTR_ALIGN_HYPHENATION,SID_ATTR_ALIGN_HYPHENATION,
+ SID_ATTR_ALIGN_ASIANVERTICAL,SID_ATTR_ALIGN_ASIANVERTICAL,
+ SID_ATTR_FRAMEDIRECTION,SID_ATTR_FRAMEDIRECTION,
+ SID_ATTR_ALIGN_SHRINKTOFIT,SID_ATTR_ALIGN_SHRINKTOFIT,
+ 0
+};
+
+// ============================================================================
+
+AlignmentTabPage::AlignmentTabPage( Window* pParent, const SfxItemSet& rCoreAttrs ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_ALIGNMENT ), rCoreAttrs ),
+
+ maFlAlignment ( this, SVX_RES( FL_ALIGNMENT ) ),
+ maFtHorAlign ( this, SVX_RES( FT_HORALIGN ) ),
+ maLbHorAlign ( this, SVX_RES( LB_HORALIGN ) ),
+ maFtIndent ( this, SVX_RES( FT_INDENT ) ),
+ maEdIndent ( this, SVX_RES( ED_INDENT ) ),
+ maFtVerAlign ( this, SVX_RES( FT_VERALIGN ) ),
+ maLbVerAlign ( this, SVX_RES( LB_VERALIGN ) ),
+
+ maFlOrient ( this, SVX_RES( FL_ORIENTATION ) ),
+ maCtrlDial ( this, SVX_RES( CTR_DIAL ) ),
+ maFtRotate ( this, SVX_RES( FT_DEGREES ) ),
+ maNfRotate ( this, SVX_RES( NF_DEGREES ) ),
+ maFtRefEdge ( this, SVX_RES( FT_BORDER_LOCK ) ),
+ maVsRefEdge ( this, SVX_RES( CTR_BORDER_LOCK ) ),
+ maCbStacked ( this, SVX_RES( BTN_TXTSTACKED ) ),
+ maCbAsianMode ( this, SVX_RES( BTN_ASIAN_VERTICAL ) ),
+ maOrientHlp ( maCtrlDial, maNfRotate, maCbStacked ),
+
+ maFlProperties ( this, SVX_RES( FL_WRAP ) ),
+ maBtnWrap ( this, SVX_RES( BTN_WRAP ) ),
+ maBtnHyphen ( this, SVX_RES( BTN_HYPH ) ),
+ maBtnShrink ( this, SVX_RES( BTN_SHRINK ) ),
+ maFtFrameDir ( this, SVX_RES( FT_TEXTFLOW ) ),
+ maLbFrameDir ( this, SVX_RES( LB_FRAMEDIR ) )
+{
+ InitVsRefEgde();
+
+ // windows to be disabled, if stacked text is turned ON
+ maOrientHlp.AddDependentWindow( maFtRotate, STATE_CHECK );
+ maOrientHlp.AddDependentWindow( maFtRefEdge, STATE_CHECK );
+ maOrientHlp.AddDependentWindow( maVsRefEdge, STATE_CHECK );
+ // windows to be disabled, if stacked text is turned OFF
+ maOrientHlp.AddDependentWindow( maCbAsianMode, STATE_NOCHECK );
+
+ Link aLink = LINK( this, AlignmentTabPage, UpdateEnableHdl );
+
+ maLbHorAlign.SetSelectHdl( aLink );
+ maBtnWrap.SetClickHdl( aLink );
+
+ // Asian vertical mode
+ maCbAsianMode.Show( SvtCJKOptions().IsVerticalTextEnabled() );
+
+ // CTL frame direction
+ maLbFrameDir.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP );
+ maLbFrameDir.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP );
+ maLbFrameDir.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT );
+ if( !SvtLanguageOptions().IsCTLFontEnabled() )
+ {
+ maFtFrameDir.Hide();
+ maLbFrameDir.Hide();
+ }
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ FreeResource();
+
+ AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, maFtHorAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new HorJustConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, maLbHorAlign, s_pHorJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_INDENT, maFtIndent, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new sfx::UInt16MetricConnection( SID_ATTR_ALIGN_INDENT, maEdIndent, FUNIT_TWIP, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_VER_JUSTIFY, maFtVerAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new VerJustConnection( SID_ATTR_ALIGN_VER_JUSTIFY, maLbVerAlign, s_pVerJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new DialControlConnection( SID_ATTR_ALIGN_DEGREES, maCtrlDial, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_DEGREES, maFtRotate, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_LOCKPOS, maFtRefEdge, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new RotateModeConnection( SID_ATTR_ALIGN_LOCKPOS, maVsRefEdge, s_pRotateModeMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new OrientStackedConnection( SID_ATTR_ALIGN_STACKED, maOrientHlp ) );
+ AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_STACKED, maCbStacked, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_ASIANVERTICAL, maCbAsianMode, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_LINEBREAK, maBtnWrap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_HYPHENATION, maBtnHyphen, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_SHRINKTOFIT, maBtnShrink, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_FRAMEDIRECTION, maFtFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+ AddItemConnection( new FrameDirListBoxConnection( SID_ATTR_FRAMEDIRECTION, maLbFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) );
+}
+
+AlignmentTabPage::~AlignmentTabPage()
+{
+}
+
+SfxTabPage* AlignmentTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new AlignmentTabPage( pParent, rAttrSet );
+}
+
+USHORT* AlignmentTabPage::GetRanges()
+{
+ return s_pRanges;
+}
+
+void AlignmentTabPage::Reset( const SfxItemSet& rCoreAttrs )
+{
+ SfxTabPage::Reset( rCoreAttrs );
+ UpdateEnableControls();
+}
+
+int AlignmentTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+void AlignmentTabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxTabPage::DataChanged( rDCEvt );
+ if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ svt::OLocalResourceAccess aLocalResAcc( SVX_RES( RID_SVXPAGE_ALIGNMENT ), RSC_TABPAGE );
+ InitVsRefEgde();
+ }
+}
+
+void AlignmentTabPage::InitVsRefEgde()
+{
+ // remember selection - is deleted in call to ValueSet::Clear()
+ USHORT nSel = maVsRefEdge.GetSelectItemId();
+
+ ResId aResId( GetBackground().GetColor().IsDark() ? IL_LOCK_BMPS_HC : IL_LOCK_BMPS, DIALOG_MGR() );
+ ImageList aImageList( aResId );
+ Size aItemSize( aImageList.GetImage( IID_BOTTOMLOCK ).GetSizePixel() );
+
+ maVsRefEdge.Clear();
+ maVsRefEdge.SetStyle( maVsRefEdge.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
+
+ maVsRefEdge.SetColCount( 3 );
+ maVsRefEdge.InsertItem( IID_BOTTOMLOCK, aImageList.GetImage( IID_BOTTOMLOCK ), String( SVX_RES( STR_BOTTOMLOCK ) ) );
+ maVsRefEdge.InsertItem( IID_TOPLOCK, aImageList.GetImage( IID_TOPLOCK ), String( SVX_RES( STR_TOPLOCK ) ) );
+ maVsRefEdge.InsertItem( IID_CELLLOCK, aImageList.GetImage( IID_CELLLOCK ), String( SVX_RES( STR_CELLLOCK ) ) );
+
+ maVsRefEdge.SetSizePixel( maVsRefEdge.CalcWindowSizePixel( aItemSize ) );
+
+ maVsRefEdge.SelectItem( nSel );
+}
+
+void AlignmentTabPage::UpdateEnableControls()
+{
+ USHORT nHorAlign = maLbHorAlign.GetSelectEntryPos();
+ bool bHorLeft = (nHorAlign == ALIGNDLG_HORALIGN_LEFT);
+ bool bHorBlock = (nHorAlign == ALIGNDLG_HORALIGN_BLOCK);
+ bool bHorFill = (nHorAlign == ALIGNDLG_HORALIGN_FILL);
+
+ // indent edit field only for left alignment
+ maFtIndent.Enable( bHorLeft );
+ maEdIndent.Enable( bHorLeft );
+
+ // rotation/stacked disabled for fill alignment
+ maOrientHlp.Enable( !bHorFill );
+
+ // hyphenation only for automatic line breaks or for block alignment
+ maBtnHyphen.Enable( maBtnWrap.IsChecked() || bHorBlock );
+
+ // shrink only without automatic line break, and not for block and fill
+ maBtnShrink.Enable( (maBtnWrap.GetState() == STATE_NOCHECK) && !bHorBlock && !bHorFill );
+
+ // visibility of fixed lines
+ maFlAlignment.Show( maLbHorAlign.IsVisible() || maEdIndent.IsVisible() || maLbVerAlign.IsVisible() );
+ maFlOrient.Show( maCtrlDial.IsVisible() || maVsRefEdge.IsVisible() || maCbStacked.IsVisible() || maCbAsianMode.IsVisible() );
+ maFlProperties.Show( maBtnWrap.IsVisible() || maBtnHyphen.IsVisible() || maBtnShrink.IsVisible() || maLbFrameDir.IsVisible() );
+}
+
+IMPL_LINK( AlignmentTabPage, UpdateEnableHdl, void*, EMPTYARG )
+{
+ UpdateEnableControls();
+ return 0;
+}
+
+// ============================================================================
+
+} // namespace svx
+
diff --git a/cui/source/tabpages/align.hrc b/cui/source/tabpages/align.hrc
new file mode 100644
index 000000000000..d9138200d381
--- /dev/null
+++ b/cui/source/tabpages/align.hrc
@@ -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: align.hrc,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_ALIGN_HRC
+#define _SVX_ALIGN_HRC
+
+// defines ------------------------------------------------------------------
+
+// resource id's
+#define FL_ALIGNMENT 10
+#define FT_HORALIGN 11
+#define LB_HORALIGN 12
+#define FT_INDENT 13
+#define ED_INDENT 14
+#define FT_VERALIGN 15
+#define LB_VERALIGN 16
+
+#define FL_ORIENTATION 20
+#define BTN_TXTSTACKED 21
+#define CTR_DIAL 22
+#define FT_DEGREES 23
+#define NF_DEGREES 24
+#define FT_BORDER_LOCK 25
+#define CTR_BORDER_LOCK 26
+#define BTN_ASIAN_VERTICAL 27
+
+#define FL_WRAP 40
+#define BTN_WRAP 41
+#define BTN_HYPH 42
+#define FT_TEXTFLOW 43
+#define LB_FRAMEDIR 44
+#define BTN_SHRINK 45
+
+//#define ED_INDENT1 100
+
+// list box indexes
+#define ALIGNDLG_HORALIGN_STD 0
+#define ALIGNDLG_HORALIGN_LEFT 1
+#define ALIGNDLG_HORALIGN_CENTER 2
+#define ALIGNDLG_HORALIGN_RIGHT 3
+#define ALIGNDLG_HORALIGN_BLOCK 4
+#define ALIGNDLG_HORALIGN_FILL 5
+
+#define ALIGNDLG_VERALIGN_STD 0
+#define ALIGNDLG_VERALIGN_TOP 1
+#define ALIGNDLG_VERALIGN_MID 2
+#define ALIGNDLG_VERALIGN_BOTTOM 3
+
+// image list for ValueSets:
+#define IL_LOCK_BMPS 1100
+#define IL_LOCK_BMPS_HC 1101
+#define IID_BOTTOMLOCK 1
+#define IID_TOPLOCK 2
+#define IID_CELLLOCK 3
+
+#define STR_BOTTOMLOCK 1
+#define STR_TOPLOCK 2
+#define STR_CELLLOCK 3
+
+#endif
+
diff --git a/cui/source/tabpages/align.src b/cui/source/tabpages/align.src
new file mode 100644
index 000000000000..24e88b77a8a0
--- /dev/null
+++ b/cui/source/tabpages/align.src
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * 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: align.src,v $
+ * $Revision: 1.55 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "align.hrc"
+ // pragma ----------------------------------------------------------------
+
+#define MASKCOLOR \
+ MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }
+
+ // define ---------------------------------------------------------------
+#define IL_LOCK_MCOL Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; }
+ // RID_SVXPAGE_ALIGNMENT -------------------------------------------------
+TabPage RID_SVXPAGE_ALIGNMENT
+{
+ HelpId = HID_ALIGNMENT ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Alignment" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ FixedLine FL_ALIGNMENT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Text alignment";
+ };
+ FixedText FT_HORALIGN
+ {
+ Pos = MAP_APPFONT ( 12 ,14 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "Hori~zontal";
+ };
+ ListBox LB_HORALIGN
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 12 , 25 );
+ Size = MAP_APPFONT ( 100 , 60 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "Default" ; ALIGNDLG_HORALIGN_STD ; > ;
+ < "Left" ; ALIGNDLG_HORALIGN_LEFT ; > ;
+ < "Center" ; ALIGNDLG_HORALIGN_CENTER ; > ;
+ < "Right" ; ALIGNDLG_HORALIGN_RIGHT ; > ;
+ < "Justified" ; ALIGNDLG_HORALIGN_BLOCK ; > ;
+ < "Filled" ; ALIGNDLG_HORALIGN_FILL ; > ;
+ };
+ };
+ FixedText FT_INDENT
+ {
+ Pos = MAP_APPFONT ( 118 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "I~ndent" ;
+ };
+ MetricField ED_INDENT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 118 , 25 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 990 ;
+ SpinSize = 10 ;
+ Unit = FUNIT_POINT ;
+ };
+ FixedText FT_VERALIGN
+ {
+ Pos = MAP_APPFONT ( 160 , 14 ) ;
+ Size = MAP_APPFONT ( 88 , 8 ) ;
+ Text [ en-US ] = "~Vertical";
+ };
+ ListBox LB_VERALIGN
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 160 , 25 );
+ Size = MAP_APPFONT ( 88 , 60 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "Default" ; ALIGNDLG_VERALIGN_STD ; > ;
+ < "Top" ; ALIGNDLG_VERALIGN_TOP ; > ;
+ < "Middle" ; ALIGNDLG_VERALIGN_MID ; > ;
+ < "Bottom" ; ALIGNDLG_VERALIGN_BOTTOM ; > ;
+ };
+ };
+ FixedLine FL_ORIENTATION
+ {
+ Pos = MAP_APPFONT ( 6 , 43 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Text orientation" ;
+ };
+ TriStateBox BTN_TXTSTACKED
+ {
+ Pos = MAP_APPFONT ( 133 , 54 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ TabStop = TRUE ;
+ Text[ en-US ] = "Ve~rtically stacked";
+ };
+ Control CTR_DIAL
+ {
+ HelpId = HID_ALIGNMENT_CTR_DIAL ;
+ Pos = MAP_APPFONT ( 12 , 60 ) ;
+ Size = MAP_APPFONT ( 42 , 43 ) ;
+ Text = "ABCD" ;
+ };
+ FixedText FT_DEGREES
+ {
+ Pos = MAP_APPFONT ( 72 , 54 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "De~grees";
+ };
+ NumericField NF_DEGREES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 72 , 65 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 359 ;
+ SpinSize = 5 ;
+ StrictFormat = TRUE ;
+ };
+ FixedText FT_BORDER_LOCK
+ {
+ Pos = MAP_APPFONT ( 72 , 83 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Re~ference edge" ;
+ };
+ Control CTR_BORDER_LOCK
+ {
+ HelpId = HID_ALIGNMENT_CTR_BORDER_LOCK ;
+ Pos = MAP_APPFONT ( 72 , 94 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ TabStop = TRUE ;
+ };
+ TriStateBox BTN_ASIAN_VERTICAL
+ {
+ Pos = MAP_APPFONT ( 143 , 68 ) ;
+ Size = MAP_APPFONT ( 105 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Asian layout ~mode" ;
+ };
+ FixedLine FL_WRAP
+ {
+ Pos = MAP_APPFONT ( 6 , 115 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Properties" ;
+ };
+ TriStateBox BTN_WRAP
+ {
+ Pos = MAP_APPFONT ( 12 , 126 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "~Wrap text automatically" ;
+ };
+ TriStateBox BTN_HYPH
+ {
+ Pos = MAP_APPFONT ( 22 , 139 ) ;
+ Size = MAP_APPFONT ( 226 , 10 ) ;
+ Text [ en-US ] = "Hyphenation ~active";
+ };
+ TriStateBox BTN_SHRINK
+ {
+ Pos = MAP_APPFONT( 12, 152 );
+ Size = MAP_APPFONT( 236, 10 );
+ Text [ en-US ] = "~Shrink to fit cell size";
+ };
+ FixedText FT_TEXTFLOW
+ {
+ Pos = MAP_APPFONT( 12 , 170 );
+ Size = MAP_APPFONT( 64 , 8 );
+ Text [ en-US ] = "Te~xt direction";
+ };
+ ListBox LB_FRAMEDIR
+ {
+ Pos = MAP_APPFONT( 78 , 168 );
+ Size = MAP_APPFONT( 170 , 50 );
+ Border = TRUE;
+ DropDown = TRUE;
+ };
+ ImageList IL_LOCK_BMPS
+ {
+ Prefix = "lo";
+ MaskColor = IL_LOCK_MCOL ;
+ IdList =
+ {
+ IID_BOTTOMLOCK ;
+ IID_TOPLOCK ;
+ IID_CELLLOCK ;
+ };
+ IdCount = { 3 ; };
+ };
+ ImageList IL_LOCK_BMPS_HC
+ {
+ Prefix = "loh";
+ MaskColor = IL_LOCK_MCOL ;
+ IdList =
+ {
+ IID_BOTTOMLOCK ;
+ IID_TOPLOCK ;
+ IID_CELLLOCK ;
+ };
+ IdCount = { 3 ; };
+ };
+ String STR_BOTTOMLOCK
+ {
+ Text [ en-US ] = "Text Extension From Lower Cell Border" ;
+ };
+ String STR_TOPLOCK
+ {
+ Text [ en-US ] = "Text Extension From Upper Cell Border" ;
+ };
+ String STR_CELLLOCK
+ {
+ Text [ en-US ] = "Text Extension Inside Cell" ;
+ };
+};
+ // ********************************************************************** EOF
+
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
new file mode 100644
index 000000000000..3e6908293871
--- /dev/null
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -0,0 +1,2775 @@
+/*************************************************************************
+ *
+ * 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: autocdlg.cxx,v $
+ * $Revision: 1.25 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#define _SVSTDARR_STRINGSISORTDTOR
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/keycodes.hxx>
+#include <sot/exchange.hxx>
+#include <svtools/transfer.hxx>
+#include <unotools/syslocale.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <unotools/charclass.hxx>
+#include <unotools/collatorwrapper.hxx>
+#include <com/sun/star/i18n/CollatorOptions.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <svl/eitem.hxx>
+#include <svl/languageoptions.hxx>
+#include <svx/SmartTagMgr.hxx>
+#include <com/sun/star/smarttags/XSmartTagRecognizer.hpp>
+#include <com/sun/star/smarttags/XSmartTagAction.hpp>
+
+#define _OFA_AUTOCDLG_CXX
+#include "autocdlg.hxx"
+#include "autocdlg.hrc"
+#include "helpid.hrc"
+#include <svx/acorrcfg.hxx>
+#include <svx/svxacorr.hxx>
+#include "cuicharmap.hxx"
+#include <svx/unolingu.hxx>
+#include <svx/dialmgr.hxx>
+
+static LanguageType eLastDialogLanguage = LANGUAGE_SYSTEM;
+
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+static ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& GetProcessFact()
+{
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > xMSF =
+ ::comphelper::getProcessServiceFactory();
+ return xMSF;
+}
+
+/*-----------------14.10.96 15.47-------------------
+
+--------------------------------------------------*/
+
+OfaAutoCorrDlg::OfaAutoCorrDlg(Window* pParent, const SfxItemSet* _pSet ) :
+ SfxTabDialog(pParent, SVX_RES( RID_OFA_AUTOCORR_DLG ), _pSet),
+ aLanguageFT( this, SVX_RES(FT_LANG )),
+ aLanguageLB( this, SVX_RES(LB_LANG ))
+{
+ BOOL bShowSWOptions = FALSE;
+ BOOL bOpenSmartTagOptions = FALSE;
+
+ if ( _pSet )
+ {
+ SFX_ITEMSET_ARG( _pSet, pItem, SfxBoolItem, SID_AUTO_CORRECT_DLG, FALSE );
+ if ( pItem && pItem->GetValue() )
+ bShowSWOptions = TRUE;
+
+ SFX_ITEMSET_ARG( _pSet, pItem2, SfxBoolItem, SID_OPEN_SMARTTAGOPTIONS, FALSE );
+ if ( pItem2 && pItem2->GetValue() )
+ bOpenSmartTagOptions = TRUE;
+ }
+
+ aLanguageFT.SetZOrder(0, WINDOW_ZORDER_FIRST);
+ aLanguageLB.SetZOrder(&aLanguageFT, WINDOW_ZORDER_BEHIND);
+ aLanguageLB.SetHelpId(HID_AUTOCORR_LANGUAGE);
+ FreeResource();
+
+ AddTabPage(RID_OFAPAGE_AUTOCORR_OPTIONS, OfaAutocorrOptionsPage::Create, 0);
+ AddTabPage(RID_OFAPAGE_AUTOFMT_APPLY, OfaSwAutoFmtOptionsPage::Create, 0);
+ AddTabPage(RID_OFAPAGE_AUTOCOMPLETE_OPTIONS, OfaAutoCompleteTabPage::Create, 0);
+ AddTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS, OfaSmartTagOptionsTabPage::Create, 0);
+
+ if (!bShowSWOptions)
+ {
+ RemoveTabPage(RID_OFAPAGE_AUTOFMT_APPLY);
+ RemoveTabPage(RID_OFAPAGE_AUTOCOMPLETE_OPTIONS);
+ RemoveTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS);
+ }
+ else
+ {
+ // remove smart tag tab page if no extensions are installed
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
+ if ( !pOpt || !pOpt->pSmartTagMgr || 0 == pOpt->pSmartTagMgr->NumberOfRecognizers() )
+ RemoveTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS);
+
+ RemoveTabPage(RID_OFAPAGE_AUTOCORR_OPTIONS);
+ }
+
+ AddTabPage(RID_OFAPAGE_AUTOCORR_REPLACE, OfaAutocorrReplacePage::Create, 0);
+ AddTabPage(RID_OFAPAGE_AUTOCORR_EXCEPT, OfaAutocorrExceptPage::Create, 0);
+ AddTabPage(RID_OFAPAGE_AUTOCORR_QUOTE, OfaQuoteTabPage::Create, 0);
+
+ // initialize languages
+ //! LANGUAGE_NONE is displayed as '[All]' and the LanguageType
+ //! will be set to LANGUAGE_DONTKNOW
+ sal_Int16 nLangList = LANG_LIST_WESTERN;
+
+ if( SvtLanguageOptions().IsCTLFontEnabled() )
+ nLangList |= LANG_LIST_CTL;
+ aLanguageLB.SetLanguageList( nLangList, TRUE, TRUE );
+ aLanguageLB.SelectLanguage( LANGUAGE_NONE );
+ USHORT nPos = aLanguageLB.GetSelectEntryPos();
+ DBG_ASSERT( LISTBOX_ENTRY_NOTFOUND != nPos, "listbox entry missing" );
+ aLanguageLB.SetEntryData( nPos, (void*)(long) LANGUAGE_DONTKNOW );
+
+ // Initialisierung funktionier fuer static nicht unter Linux - deswegen hier
+ if( LANGUAGE_SYSTEM == eLastDialogLanguage )
+ eLastDialogLanguage = Application::GetSettings().GetLanguage();
+
+ LanguageType nSelectLang = LANGUAGE_DONTKNOW;
+ nPos = aLanguageLB.GetEntryPos( (void*)(long) eLastDialogLanguage );
+ if (LISTBOX_ENTRY_NOTFOUND != nPos)
+ nSelectLang = eLastDialogLanguage;
+ aLanguageLB.SelectLanguage( nSelectLang );
+
+ aLanguageLB.SetSelectHdl(LINK(this, OfaAutoCorrDlg, SelectLanguageHdl));
+
+ Size aMinSize(aLanguageFT.CalcMinimumSize());
+ //reserve some extra space for CJK accelerators that are possible inserted
+ //later (like '(A)')
+ aLanguageFT.SetPosSizePixel( 0, 0, aMinSize.Width() + 20, 0, WINDOW_POSSIZE_WIDTH );
+
+ if ( bOpenSmartTagOptions )
+ SetCurPageId( RID_OFAPAGE_SMARTTAG_OPTIONS );
+}
+/*-----------------16.10.96 14.06-------------------
+
+--------------------------------------------------*/
+
+BOOL lcl_FindEntry( ListBox& rLB, const String& rEntry,
+ CollatorWrapper& rCmpClass )
+{
+ USHORT nCount = rLB.GetEntryCount();
+ USHORT nSelPos = rLB.GetSelectEntryPos();
+ USHORT i;
+ for(i = 0; i < nCount; i++)
+ {
+ if( 0 == rCmpClass.compareString(rEntry, rLB.GetEntry(i) ))
+ {
+ rLB.SelectEntryPos(i, TRUE);
+ return TRUE;
+ }
+ }
+ if(LISTBOX_ENTRY_NOTFOUND != nSelPos)
+ rLB.SelectEntryPos(nSelPos, FALSE);
+ return FALSE;
+}
+
+/* -----------------23.11.98 10:46-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK(OfaAutoCorrDlg, SelectLanguageHdl, ListBox*, pBox)
+{
+ USHORT nPos = pBox->GetSelectEntryPos();
+ void* pVoid = pBox->GetEntryData(nPos);
+ LanguageType eNewLang = (LanguageType)(long)pVoid;
+ //alte Einstellungen speichern und neu fuellen
+ if(eNewLang != eLastDialogLanguage)
+ {
+ USHORT nPageId = GetCurPageId();
+ if(RID_OFAPAGE_AUTOCORR_REPLACE == nPageId)
+ ((OfaAutocorrReplacePage*)GetTabPage( nPageId ))->SetLanguage(eNewLang);
+ else if(RID_OFAPAGE_AUTOCORR_EXCEPT == nPageId)
+ ((OfaAutocorrExceptPage*)GetTabPage( nPageId ))->SetLanguage(eNewLang);
+ }
+ return 0;
+}
+/*-----------------14.10.96 15.57-------------------
+
+--------------------------------------------------*/
+
+OfaAutocorrOptionsPage::OfaAutocorrOptionsPage( Window* pParent,
+ const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCORR_OPTIONS ), rSet),
+ aCheckLB (this, SVX_RES(CLB_SETTINGS )),
+
+ sInput (SVX_RES(ST_USE_REPLACE )),
+ sDoubleCaps (SVX_RES(ST_CPTL_STT_WORD )),
+ sStartCap (SVX_RES(ST_CPTL_STT_SENT )),
+ sBoldUnderline (SVX_RES(ST_BOLD_UNDER )),
+ sURL (SVX_RES(ST_DETECT_URL )),
+ sNoDblSpaces (SVX_RES(STR_NO_DBL_SPACES )),
+ sHalf (SVX_RES(ST_FRACTION )),
+ sDash (SVX_RES(ST_DASH )),
+ sFirst (SVX_RES(ST_ORDINAL ))
+{
+ FreeResource();
+
+ aCheckLB.SetHelpId(HID_OFAPAGE_AUTOCORR_CLB);
+}
+
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+
+OfaAutocorrOptionsPage::~OfaAutocorrOptionsPage()
+{
+}
+
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+
+SfxTabPage* OfaAutocorrOptionsPage::Create( Window* pParent,
+ const SfxItemSet& rSet)
+{
+ return new OfaAutocorrOptionsPage(pParent, rSet);
+}
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+
+BOOL OfaAutocorrOptionsPage::FillItemSet( SfxItemSet& )
+{
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ long nFlags = pAutoCorrect->GetFlags();
+
+ USHORT nPos = 0;
+ pAutoCorrect->SetAutoCorrFlag(Autocorrect, aCheckLB.IsChecked(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(CptlSttWrd, aCheckLB.IsChecked(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(CptlSttSntnc, aCheckLB.IsChecked(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ChgWeightUnderl, aCheckLB.IsChecked(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(SetINetAttr, aCheckLB.IsChecked(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ChgOrdinalNumber, aCheckLB.IsChecked(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ChgFractionSymbol, aCheckLB.IsChecked(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ChgToEnEmDash, aCheckLB.IsChecked(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(IngnoreDoubleSpace, aCheckLB.IsChecked(nPos++));
+
+ BOOL bReturn = nFlags != pAutoCorrect->GetFlags();
+ if(bReturn )
+ {
+ SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+ pCfg->SetModified();
+ pCfg->Commit();
+ }
+ return bReturn;
+}
+
+/* -----------------23.11.98 16:15-------------------
+ *
+ * --------------------------------------------------*/
+void OfaAutocorrOptionsPage::ActivatePage( const SfxItemSet& )
+{
+ ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(FALSE);
+}
+
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+
+void OfaAutocorrOptionsPage::Reset( const SfxItemSet& )
+{
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ const long nFlags = pAutoCorrect->GetFlags();
+
+ aCheckLB.SetUpdateMode(FALSE);
+ aCheckLB.Clear();
+
+ aCheckLB.InsertEntry(sInput);
+ aCheckLB.InsertEntry(sDoubleCaps);
+ aCheckLB.InsertEntry(sStartCap);
+ aCheckLB.InsertEntry(sBoldUnderline);
+ aCheckLB.InsertEntry(sURL);
+ aCheckLB.InsertEntry(sFirst);
+ aCheckLB.InsertEntry(sHalf);
+ aCheckLB.InsertEntry(sDash);
+ aCheckLB.InsertEntry(sNoDblSpaces);
+
+ USHORT nPos = 0;
+ aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & Autocorrect) );
+ aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & CptlSttWrd) );
+ aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & CptlSttSntnc) );
+ aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgWeightUnderl) );
+ aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & SetINetAttr) );
+ aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgOrdinalNumber) );
+ aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgFractionSymbol) );
+ aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgToEnEmDash) );
+ aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & IngnoreDoubleSpace) );
+
+ aCheckLB.SetUpdateMode(TRUE);
+}
+
+/*********************************************************************/
+/* */
+/* Hilfs-struct fuer dUserDaten der Checklistbox */
+/* */
+/*********************************************************************/
+
+struct ImpUserData
+{
+ String *pString;
+ Font* pFont;
+
+ ImpUserData(String* pText, Font* pFnt)
+ { pString = pText; pFont = pFnt;}
+};
+
+
+/*********************************************************************/
+/* */
+/* Dialog fuer Prozenteinstellung */
+/* */
+/*********************************************************************/
+
+class OfaAutoFmtPrcntSet : public ModalDialog
+{
+ OKButton aOKPB;
+ CancelButton aCancelPB;
+ FixedLine aPrcntFL;
+ MetricField aPrcntMF;
+
+ public:
+ OfaAutoFmtPrcntSet(Window* pParent) :
+ ModalDialog(pParent, SVX_RES(RID_OFADLG_PRCNT_SET)),
+ aOKPB(this, SVX_RES(BT_OK)),
+ aCancelPB(this, SVX_RES(BT_CANCEL)),
+ aPrcntFL(this, SVX_RES(FL_PRCNT)),
+ aPrcntMF(this, SVX_RES(ED_RIGHT_MARGIN))
+ {
+ FreeResource();
+ }
+ MetricField& GetPrcntFld(){return aPrcntMF;}
+};
+
+
+/*********************************************************************/
+/* */
+/* veraenderter LBoxString */
+/* */
+/*********************************************************************/
+
+class OfaImpBrwString : public SvLBoxString
+{
+public:
+
+ OfaImpBrwString( SvLBoxEntry* pEntry, USHORT nFlags,
+ const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr){}
+
+ virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags,
+ SvLBoxEntry* pEntry);
+};
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+
+void __EXPORT OfaImpBrwString::Paint( const Point& rPos, SvLBox& rDev, USHORT /*nFlags*/,
+ SvLBoxEntry* pEntry )
+{
+ rDev.DrawText( rPos, GetText() );
+ if(pEntry->GetUserData())
+ {
+ ImpUserData* pUserData = (ImpUserData* )pEntry->GetUserData();
+ Point aNewPos(rPos);
+ aNewPos.X() += rDev.GetTextWidth(GetText());
+ Font aOldFont( rDev.GetFont());
+ Font aFont( aOldFont );
+ if(pUserData->pFont)
+ {
+ aFont = *pUserData->pFont;
+ aFont.SetColor(aOldFont.GetColor());
+ aFont.SetSize(aOldFont.GetSize());
+ }
+ aFont.SetWeight( WEIGHT_BOLD );
+
+ BOOL bFett = TRUE;
+ USHORT nPos = 0;
+ do {
+ String sTxt( pUserData->pString->GetToken( 0, 1, nPos ));
+
+ if( bFett )
+ rDev.SetFont( aFont );
+
+ rDev.DrawText( aNewPos, sTxt );
+
+ if( STRING_NOTFOUND != nPos )
+ aNewPos.X() += rDev.GetTextWidth( sTxt );
+
+ if( bFett )
+ rDev.SetFont( aOldFont );
+
+ bFett = !bFett;
+ } while( STRING_NOTFOUND != nPos );
+ }
+}
+
+/*********************************************************************/
+/* */
+/* TabPage Autoformat anwenden */
+/* */
+/*********************************************************************/
+
+#define CBCOL_FIRST 0
+#define CBCOL_SECOND 1
+#define CBCOL_BOTH 2
+
+enum OfaAutoFmtOptions
+{
+ USE_REPLACE_TABLE,
+ CORR_UPPER,
+ BEGIN_UPPER,
+ BOLD_UNDERLINE,
+ DETECT_URL,
+ REPLACE_1ST,
+ REPLACE_HALF,
+ REPLACE_DASHES,
+ DEL_SPACES_AT_STT_END,
+ DEL_SPACES_BETWEEN_LINES,
+ IGNORE_DBLSPACE,
+ APPLY_NUMBERING,
+ INSERT_BORDER,
+ CREATE_TABLE,
+ REPLACE_STYLES,
+ DEL_EMPTY_NODE,
+ REPLACE_USER_COLL,
+ REPLACE_BULLETS,
+ REPLACE_QUOTATION,
+ MERGE_SINGLE_LINE_PARA
+};
+
+OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage( Window* pParent,
+ const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SVX_RES(RID_OFAPAGE_AUTOFMT_APPLY), rSet),
+ aCheckLB (this, SVX_RES(CLB_SETTINGS)),
+ aEditPB (this, SVX_RES(PB_EDIT)),
+ aHeader1Expl (this, SVX_RES(FT_HEADER1_EXPLANATION)),
+ aHeader2Expl (this, SVX_RES(FT_HEADER2_EXPLANATION)),
+ sHeader1 (SVX_RES( STR_HEADER1 )),
+ sHeader2 (SVX_RES( STR_HEADER2 )),
+ sDeleteEmptyPara (SVX_RES( ST_DEL_EMPTY_PARA)),
+ sUseReplaceTbl (SVX_RES( ST_USE_REPLACE )),
+ sCptlSttWord (SVX_RES( ST_CPTL_STT_WORD)),
+ sCptlSttSent (SVX_RES( ST_CPTL_STT_SENT)),
+ sTypo (SVX_RES( ST_TYPO )),
+ sUserStyle (SVX_RES( ST_USER_STYLE )),
+ sBullet (SVX_RES( ST_BULLET )),
+ sBoldUnder (SVX_RES( ST_BOLD_UNDER )),
+ sNoDblSpaces (SVX_RES( STR_NO_DBL_SPACES)),
+ sFraction (SVX_RES( ST_FRACTION )),
+ sDetectURL (SVX_RES( ST_DETECT_URL )),
+ sDash (SVX_RES( ST_DASH )),
+ sOrdinal (SVX_RES( ST_ORDINAL )),
+ sRightMargin (SVX_RES( ST_RIGHT_MARGIN )),
+ sNum (SVX_RES( STR_NUM )),
+ sBorder (SVX_RES( STR_BORDER )),
+ sTable (SVX_RES( STR_TABLE )),
+ sReplaceTemplates (SVX_RES( STR_REPLACE_TEMPLATES)),
+ sDelSpaceAtSttEnd (SVX_RES( STR_DEL_SPACES_AT_STT_END)),
+ sDelSpaceBetweenLines(SVX_RES(STR_DEL_SPACES_BETWEEN_LINES)),
+
+ nPercent ( 50 ),
+ pCheckButtonData( NULL )
+
+{
+ FreeResource();
+
+ //typ. Anfuehrungszeichen einsetzen
+ SvtSysLocale aSysLcl;
+ const LocaleDataWrapper& rLcl = aSysLcl.GetLocaleData();
+ sTypo.SearchAndReplace( String::CreateFromAscii("%1"),
+ rLcl.getDoubleQuotationMarkStart());
+ sTypo.SearchAndReplace( String::CreateFromAscii("%2"),
+ rLcl.getDoubleQuotationMarkEnd());
+
+ aCheckLB.SetHelpId(HID_OFAPAGE_AUTOFORMAT_CLB);
+ aCheckLB.SetWindowBits(WB_HSCROLL| WB_VSCROLL);
+
+ aCheckLB.SetSelectHdl(LINK(this, OfaSwAutoFmtOptionsPage, SelectHdl));
+ aCheckLB.SetDoubleClickHdl(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl));
+
+ static long aStaticTabs[]=
+ {
+ 3, 0, 20, 40
+ };
+
+ aCheckLB.SvxSimpleTable::SetTabs(aStaticTabs);
+ String sHeader( sHeader1 );
+ sHeader += '\t';
+ sHeader += sHeader2;
+ sHeader += '\t';
+ aCheckLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND,
+ HIB_CENTER | HIB_VCENTER | HIB_FIXEDPOS | HIB_FIXED);
+
+ aEditPB.SetClickHdl(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl));
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+SvLBoxEntry* OfaSwAutoFmtOptionsPage::CreateEntry(String& rTxt, USHORT nCol)
+{
+ SvLBoxEntry* pEntry = new SvLBoxEntry;
+
+ if ( !pCheckButtonData )
+ {
+ pCheckButtonData = new SvLBoxButtonData( &aCheckLB );
+ aCheckLB.SetCheckButtonData( pCheckButtonData );
+ }
+
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff!
+
+ String sEmpty;
+ if (nCol == CBCOL_SECOND)
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte
+ else
+ pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+
+ if (nCol == CBCOL_FIRST)
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte
+ else
+ pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+ pEntry->AddItem( new OfaImpBrwString( pEntry, 0, rTxt ) );
+
+ return pEntry;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+
+__EXPORT OfaSwAutoFmtOptionsPage::~OfaSwAutoFmtOptionsPage()
+{
+ delete (ImpUserData*) aCheckLB.GetUserData( REPLACE_BULLETS );
+ delete (ImpUserData*) aCheckLB.GetUserData( APPLY_NUMBERING );
+ delete (ImpUserData*) aCheckLB.GetUserData( MERGE_SINGLE_LINE_PARA );
+ delete pCheckButtonData;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+SfxTabPage* __EXPORT OfaSwAutoFmtOptionsPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new OfaSwAutoFmtOptionsPage(pParent, rAttrSet);
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+BOOL OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bModified = FALSE;
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
+ long nFlags = pAutoCorrect->GetFlags();
+
+ BOOL bCheck = aCheckLB.IsChecked(USE_REPLACE_TABLE, CBCOL_FIRST);
+ bModified |= pOpt->bAutoCorrect != bCheck;
+ pOpt->bAutoCorrect = bCheck;
+ pAutoCorrect->SetAutoCorrFlag(Autocorrect,
+ aCheckLB.IsChecked(USE_REPLACE_TABLE, CBCOL_SECOND));
+
+ bCheck = aCheckLB.IsChecked(CORR_UPPER, CBCOL_FIRST);
+ bModified |= pOpt->bCptlSttWrd != bCheck;
+ pOpt->bCptlSttWrd = bCheck;
+ pAutoCorrect->SetAutoCorrFlag(CptlSttWrd,
+ aCheckLB.IsChecked(CORR_UPPER, CBCOL_SECOND));
+
+ bCheck = aCheckLB.IsChecked(BEGIN_UPPER, CBCOL_FIRST);
+ bModified |= pOpt->bCptlSttSntnc != bCheck;
+ pOpt->bCptlSttSntnc = bCheck;
+ pAutoCorrect->SetAutoCorrFlag(CptlSttSntnc,
+ aCheckLB.IsChecked(BEGIN_UPPER, CBCOL_SECOND));
+
+ bCheck = aCheckLB.IsChecked(BOLD_UNDERLINE, CBCOL_FIRST);
+ bModified |= pOpt->bChgWeightUnderl != bCheck;
+ pOpt->bChgWeightUnderl = bCheck;
+ pAutoCorrect->SetAutoCorrFlag(ChgWeightUnderl,
+ aCheckLB.IsChecked(BOLD_UNDERLINE, CBCOL_SECOND));
+
+ pAutoCorrect->SetAutoCorrFlag(IngnoreDoubleSpace,
+ aCheckLB.IsChecked(IGNORE_DBLSPACE, CBCOL_SECOND));
+
+ bCheck = aCheckLB.IsChecked(DETECT_URL, CBCOL_FIRST);
+ bModified |= pOpt->bSetINetAttr != bCheck;
+ pOpt->bSetINetAttr = bCheck;
+ pAutoCorrect->SetAutoCorrFlag(SetINetAttr,
+ aCheckLB.IsChecked(DETECT_URL, CBCOL_SECOND));
+
+ bCheck = aCheckLB.IsChecked(REPLACE_1ST, CBCOL_FIRST);
+ bModified |= pOpt->bChgOrdinalNumber != bCheck;
+ pOpt->bChgOrdinalNumber = bCheck;
+ pAutoCorrect->SetAutoCorrFlag(ChgOrdinalNumber,
+ aCheckLB.IsChecked(REPLACE_1ST, CBCOL_SECOND));
+
+ bCheck = aCheckLB.IsChecked(DEL_EMPTY_NODE, CBCOL_FIRST);
+ bModified |= pOpt->bDelEmptyNode != bCheck;
+ pOpt->bDelEmptyNode = bCheck;
+
+ bCheck = aCheckLB.IsChecked(REPLACE_QUOTATION, CBCOL_FIRST);
+ bModified |= pOpt->bReplaceQuote != bCheck;
+ pOpt->bReplaceQuote = bCheck;
+
+ bCheck = aCheckLB.IsChecked(REPLACE_USER_COLL, CBCOL_FIRST);
+ bModified |= pOpt->bChgUserColl != bCheck;
+ pOpt->bChgUserColl = bCheck;
+
+ bCheck = aCheckLB.IsChecked(REPLACE_BULLETS, CBCOL_FIRST);
+ bModified |= pOpt->bChgEnumNum != bCheck;
+ pOpt->bChgEnumNum = bCheck;
+ bModified |= aBulletFont != pOpt->aBulletFont;
+ pOpt->aBulletFont = aBulletFont;
+ bModified |= String(pOpt->cBullet) != sBulletChar;
+ pOpt->cBullet = sBulletChar.GetChar(0);
+
+ bModified |= aByInputBulletFont != pOpt->aByInputBulletFont;
+ bModified |= String(pOpt->cByInputBullet) != sByInputBulletChar;
+ pOpt->aByInputBulletFont = aByInputBulletFont;
+ pOpt->cByInputBullet = sByInputBulletChar.GetChar(0);
+
+ bCheck = aCheckLB.IsChecked(MERGE_SINGLE_LINE_PARA, CBCOL_FIRST);
+ bModified |= pOpt->bRightMargin != bCheck;
+ pOpt->bRightMargin = bCheck;
+ bModified |= nPercent != pOpt->nRightMargin;
+ pOpt->nRightMargin = (BYTE)nPercent;
+
+ bCheck = aCheckLB.IsChecked(APPLY_NUMBERING, CBCOL_SECOND);
+ bModified |= pOpt->bSetNumRule != bCheck;
+ pOpt->bSetNumRule = bCheck;
+
+ bCheck = aCheckLB.IsChecked(INSERT_BORDER, CBCOL_SECOND);
+ bModified |= pOpt->bSetBorder != bCheck;
+ pOpt->bSetBorder = bCheck;
+
+ bCheck = aCheckLB.IsChecked(CREATE_TABLE, CBCOL_SECOND);
+ bModified |= pOpt->bCreateTable != bCheck;
+ pOpt->bCreateTable = bCheck;
+
+ bCheck = aCheckLB.IsChecked(REPLACE_STYLES, CBCOL_SECOND);
+ bModified |= pOpt->bReplaceStyles != bCheck;
+ pOpt->bReplaceStyles = bCheck;
+
+ bCheck = aCheckLB.IsChecked(REPLACE_HALF, CBCOL_FIRST);
+ bModified |= pOpt->bChgFracionSymbol != bCheck;
+ pOpt->bChgFracionSymbol = bCheck;
+ pAutoCorrect->SetAutoCorrFlag(ChgFractionSymbol,
+ aCheckLB.IsChecked(REPLACE_HALF, CBCOL_SECOND));
+
+ bCheck = aCheckLB.IsChecked(REPLACE_DASHES, CBCOL_FIRST);
+ bModified |= pOpt->bChgToEnEmDash != bCheck;
+ pOpt->bChgToEnEmDash = bCheck;
+ pAutoCorrect->SetAutoCorrFlag(ChgToEnEmDash,
+ aCheckLB.IsChecked(REPLACE_DASHES, CBCOL_SECOND));
+
+ bCheck = aCheckLB.IsChecked(DEL_SPACES_AT_STT_END, CBCOL_FIRST);
+ bModified |= pOpt->bAFmtDelSpacesAtSttEnd != bCheck;
+ pOpt->bAFmtDelSpacesAtSttEnd = bCheck;
+ bCheck = aCheckLB.IsChecked(DEL_SPACES_AT_STT_END, CBCOL_SECOND);
+ bModified |= pOpt->bAFmtByInpDelSpacesAtSttEnd != bCheck;
+ pOpt->bAFmtByInpDelSpacesAtSttEnd = bCheck;
+
+ bCheck = aCheckLB.IsChecked(DEL_SPACES_BETWEEN_LINES, CBCOL_FIRST);
+ bModified |= pOpt->bAFmtDelSpacesBetweenLines != bCheck;
+ pOpt->bAFmtDelSpacesBetweenLines = bCheck;
+ bCheck = aCheckLB.IsChecked(DEL_SPACES_BETWEEN_LINES, CBCOL_SECOND);
+ bModified |= pOpt->bAFmtByInpDelSpacesBetweenLines != bCheck;
+ pOpt->bAFmtByInpDelSpacesBetweenLines = bCheck;
+
+ if(bModified || nFlags != pAutoCorrect->GetFlags())
+ {
+ SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+ pCfg->SetModified();
+ pCfg->Commit();
+ }
+
+ return TRUE;
+}
+
+/* -----------------23.11.98 16:15-------------------
+ *
+ * --------------------------------------------------*/
+void OfaSwAutoFmtOptionsPage::ActivatePage( const SfxItemSet& )
+{
+ ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(FALSE);
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+
+void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet& )
+{
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
+ const long nFlags = pAutoCorrect->GetFlags();
+
+ aCheckLB.SetUpdateMode(FALSE);
+ aCheckLB.Clear();
+
+ // Die folgenden Eintraege muessen in der selben Reihenfolge, wie im
+ // OfaAutoFmtOptions-enum eingefuegt werden!
+ aCheckLB.GetModel()->Insert(CreateEntry(sUseReplaceTbl, CBCOL_BOTH ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sCptlSttWord, CBCOL_BOTH ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sCptlSttSent, CBCOL_BOTH ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sBoldUnder, CBCOL_BOTH ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sDetectURL, CBCOL_BOTH ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sOrdinal, CBCOL_BOTH ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sFraction, CBCOL_BOTH ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sDash, CBCOL_BOTH ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sDelSpaceAtSttEnd, CBCOL_BOTH ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sDelSpaceBetweenLines, CBCOL_BOTH ));
+
+ aCheckLB.GetModel()->Insert(CreateEntry(sNoDblSpaces, CBCOL_SECOND));
+ aCheckLB.GetModel()->Insert(CreateEntry(sNum, CBCOL_SECOND));
+ aCheckLB.GetModel()->Insert(CreateEntry(sBorder, CBCOL_SECOND));
+ aCheckLB.GetModel()->Insert(CreateEntry(sTable, CBCOL_SECOND));
+ aCheckLB.GetModel()->Insert(CreateEntry(sReplaceTemplates, CBCOL_SECOND));
+ aCheckLB.GetModel()->Insert(CreateEntry(sDeleteEmptyPara, CBCOL_FIRST ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sUserStyle, CBCOL_FIRST ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sBullet, CBCOL_FIRST ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sTypo, CBCOL_FIRST ));
+ aCheckLB.GetModel()->Insert(CreateEntry(sRightMargin, CBCOL_FIRST ));
+
+ aCheckLB.CheckEntryPos( USE_REPLACE_TABLE, CBCOL_FIRST, pOpt->bAutoCorrect );
+ aCheckLB.CheckEntryPos( USE_REPLACE_TABLE, CBCOL_SECOND, 0 != (nFlags & Autocorrect));
+ aCheckLB.CheckEntryPos( CORR_UPPER, CBCOL_FIRST, pOpt->bCptlSttWrd );
+ aCheckLB.CheckEntryPos( CORR_UPPER, CBCOL_SECOND, 0 != (nFlags & CptlSttWrd) );
+ aCheckLB.CheckEntryPos( BEGIN_UPPER, CBCOL_FIRST, pOpt->bCptlSttSntnc );
+ aCheckLB.CheckEntryPos( BEGIN_UPPER, CBCOL_SECOND, 0 != (nFlags & CptlSttSntnc) );
+ aCheckLB.CheckEntryPos( BOLD_UNDERLINE, CBCOL_FIRST, pOpt->bChgWeightUnderl );
+ aCheckLB.CheckEntryPos( BOLD_UNDERLINE, CBCOL_SECOND, 0 != (nFlags & ChgWeightUnderl) );
+ aCheckLB.CheckEntryPos( IGNORE_DBLSPACE, CBCOL_SECOND, 0 != (nFlags & IngnoreDoubleSpace) );
+ aCheckLB.CheckEntryPos( DETECT_URL, CBCOL_FIRST, pOpt->bSetINetAttr );
+ aCheckLB.CheckEntryPos( DETECT_URL, CBCOL_SECOND, 0 != (nFlags & SetINetAttr) );
+ aCheckLB.CheckEntryPos( REPLACE_1ST, CBCOL_FIRST, pOpt->bChgOrdinalNumber );
+ aCheckLB.CheckEntryPos( REPLACE_1ST, CBCOL_SECOND, 0 != (nFlags & ChgOrdinalNumber) );
+ aCheckLB.CheckEntryPos( REPLACE_HALF, CBCOL_FIRST, pOpt->bChgFracionSymbol );
+ aCheckLB.CheckEntryPos( REPLACE_HALF, CBCOL_SECOND, 0 != (nFlags & ChgFractionSymbol) );
+ aCheckLB.CheckEntryPos( REPLACE_DASHES, CBCOL_FIRST, pOpt->bChgToEnEmDash );
+ aCheckLB.CheckEntryPos( REPLACE_DASHES, CBCOL_SECOND, 0 != (nFlags & ChgToEnEmDash) );
+ aCheckLB.CheckEntryPos( DEL_SPACES_AT_STT_END, CBCOL_FIRST, pOpt->bAFmtDelSpacesAtSttEnd );
+ aCheckLB.CheckEntryPos( DEL_SPACES_AT_STT_END, CBCOL_SECOND, pOpt->bAFmtByInpDelSpacesAtSttEnd );
+ aCheckLB.CheckEntryPos( DEL_SPACES_BETWEEN_LINES, CBCOL_FIRST, pOpt->bAFmtDelSpacesBetweenLines );
+ aCheckLB.CheckEntryPos( DEL_SPACES_BETWEEN_LINES, CBCOL_SECOND, pOpt->bAFmtByInpDelSpacesBetweenLines );
+ aCheckLB.CheckEntryPos( DEL_EMPTY_NODE, CBCOL_FIRST, pOpt->bDelEmptyNode );
+ aCheckLB.CheckEntryPos( REPLACE_QUOTATION, CBCOL_FIRST, pOpt->bReplaceQuote );
+ aCheckLB.CheckEntryPos( REPLACE_USER_COLL, CBCOL_FIRST, pOpt->bChgUserColl );
+ aCheckLB.CheckEntryPos( REPLACE_BULLETS, CBCOL_FIRST, pOpt->bChgEnumNum );
+
+ aBulletFont = pOpt->aBulletFont;
+ sBulletChar = pOpt->cBullet;
+ ImpUserData* pUserData = new ImpUserData(&sBulletChar, &aBulletFont);
+ aCheckLB.SetUserData( REPLACE_BULLETS, pUserData );
+
+ nPercent = pOpt->nRightMargin;
+ sMargin = ' ';
+ sMargin += String::CreateFromInt32( nPercent );
+ sMargin += '%';
+ pUserData = new ImpUserData(&sMargin, 0);
+ aCheckLB.SetUserData( MERGE_SINGLE_LINE_PARA, pUserData );
+
+ aCheckLB.CheckEntryPos( APPLY_NUMBERING, CBCOL_SECOND, pOpt->bSetNumRule );
+
+ aByInputBulletFont = pOpt->aByInputBulletFont;
+ sByInputBulletChar = pOpt->cByInputBullet;
+ ImpUserData* pUserData2 = new ImpUserData(&sByInputBulletChar, &aByInputBulletFont);
+ aCheckLB.SetUserData( APPLY_NUMBERING , pUserData2 );
+
+ aCheckLB.CheckEntryPos( MERGE_SINGLE_LINE_PARA, CBCOL_FIRST, pOpt->bRightMargin );
+ aCheckLB.CheckEntryPos( INSERT_BORDER, CBCOL_SECOND, pOpt->bSetBorder );
+ aCheckLB.CheckEntryPos( CREATE_TABLE, CBCOL_SECOND, pOpt->bCreateTable );
+ aCheckLB.CheckEntryPos( REPLACE_STYLES, CBCOL_SECOND, pOpt->bReplaceStyles );
+
+ aCheckLB.SetUpdateMode(TRUE);
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+IMPL_LINK(OfaSwAutoFmtOptionsPage, SelectHdl, OfaACorrCheckListBox*, pBox)
+{
+ aEditPB.Enable(0 != pBox->FirstSelected()->GetUserData());
+ return 0;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+IMPL_LINK(OfaSwAutoFmtOptionsPage, EditHdl, PushButton*, EMPTYARG)
+{
+ ULONG nSelEntryPos = aCheckLB.GetSelectEntryPos();
+ if( nSelEntryPos == REPLACE_BULLETS ||
+ nSelEntryPos == APPLY_NUMBERING)
+ {
+ SvxCharacterMap *pMapDlg = new SvxCharacterMap(this);
+ ImpUserData* pUserData = (ImpUserData*)aCheckLB.FirstSelected()->GetUserData();
+ pMapDlg->SetCharFont(*pUserData->pFont);
+ pMapDlg->SetChar( pUserData->pString->GetChar(0) );
+ if(RET_OK == pMapDlg->Execute())
+ {
+ Font aFont(pMapDlg->GetCharFont());
+ *pUserData->pFont = aFont;
+ sal_UCS4 aChar = pMapDlg->GetChar();
+ // using the UCS4 constructor
+ rtl::OUString aOUStr( &aChar, 1 );
+ *pUserData->pString = aOUStr;
+ }
+ delete pMapDlg;
+ }
+ else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos )
+ {
+ // Dialog fuer Prozenteinstellung
+ OfaAutoFmtPrcntSet aDlg(this);
+ aDlg.GetPrcntFld().SetValue(nPercent);
+ if(RET_OK == aDlg.Execute())
+ {
+ nPercent = (USHORT)aDlg.GetPrcntFld().GetValue();
+ sMargin = ' ';
+ sMargin += String::CreateFromInt32( nPercent );
+ sMargin += '%';
+ }
+ }
+ aCheckLB.Invalidate();
+ return 0;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void OfaACorrCheckListBox::SetTabs()
+{
+ SvxSimpleTable::SetTabs();
+ USHORT nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE;
+
+ if( aTabs.Count() > 1 )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
+ }
+ if( aTabs.Count() > 2 )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(2);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
+ }
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void OfaACorrCheckListBox::CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked)
+{
+ if ( nPos < GetEntryCount() )
+ SetCheckButtonState(
+ GetEntry(nPos),
+ nCol,
+ bChecked ? SvButtonState( SV_BUTTON_CHECKED ) :
+ SvButtonState( SV_BUTTON_UNCHECKED ) );
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+BOOL OfaACorrCheckListBox::IsChecked(ULONG nPos, USHORT nCol)
+{
+ return GetCheckButtonState( GetEntry(nPos), nCol ) == SV_BUTTON_CHECKED;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void OfaACorrCheckListBox::SetCheckButtonState( SvLBoxEntry* pEntry, USHORT nCol, SvButtonState eState)
+{
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1));
+
+ DBG_ASSERT(pItem,"SetCheckButton:Item not found");
+ if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
+ {
+ switch( eState )
+ {
+ case SV_BUTTON_CHECKED:
+ pItem->SetStateChecked();
+ break;
+
+ case SV_BUTTON_UNCHECKED:
+ pItem->SetStateUnchecked();
+ break;
+
+ case SV_BUTTON_TRISTATE:
+ pItem->SetStateTristate();
+ break;
+ }
+ InvalidateEntry( pEntry );
+ }
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+SvButtonState OfaACorrCheckListBox::GetCheckButtonState( SvLBoxEntry* pEntry, USHORT nCol ) const
+{
+ SvButtonState eState = SV_BUTTON_UNCHECKED;
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1));
+ DBG_ASSERT(pItem,"GetChButnState:Item not found");
+
+ if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
+ {
+ USHORT nButtonFlags = pItem->GetButtonFlags();
+ eState = pCheckButtonData->ConvertToButtonState( nButtonFlags );
+ }
+
+ return eState;
+}
+
+void OfaACorrCheckListBox::HBarClick()
+{
+ // Sortierung durch diese Ueberladung abgeklemmt
+}
+/* -----------------------------22.05.2002 11:06------------------------------
+
+ ---------------------------------------------------------------------------*/
+void OfaACorrCheckListBox::KeyInput( const KeyEvent& rKEvt )
+{
+ if(!rKEvt.GetKeyCode().GetModifier() &&
+ KEY_SPACE == rKEvt.GetKeyCode().GetCode())
+ {
+ ULONG nSelPos = GetSelectEntryPos();
+ USHORT nCol = GetCurrentTabPos() - 1;
+ if ( nCol < 2 )
+ {
+ CheckEntryPos( nSelPos, nCol, !IsChecked( nSelPos, nCol ) );
+ CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)GetEntry( nSelPos ) );
+ }
+ else
+ {
+ USHORT nCheck = IsChecked(nSelPos, 1) ? 1 : 0;
+ if(IsChecked(nSelPos, 0))
+ nCheck += 2;
+ nCheck--;
+ nCheck &= 3;
+ CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1));
+ CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2));
+ }
+ }
+ else
+ SvxSimpleTable::KeyInput(rKEvt);
+}
+/* -----------------19.11.98 15:57-------------------
+ *
+ * --------------------------------------------------*/
+struct DoubleString
+{
+ String sShort;
+ String sLong;
+ void* pUserData; // CheckBox -> form. Text Bool -> Selektionstext
+};
+typedef DoubleString* DoubleStringPtr;
+SV_DECL_PTRARR_DEL(DoubleStringArray, DoubleStringPtr, 4, 4)
+SV_IMPL_PTRARR(DoubleStringArray, DoubleStringPtr);
+
+/* -----------------19.11.98 16:07-------------------
+ *
+ * --------------------------------------------------*/
+void lcl_ClearTable(DoubleStringTable& rTable)
+{
+ DoubleStringArrayPtr pArray = rTable.Last();
+ while(pArray)
+ {
+ pArray->DeleteAndDestroy(0, pArray->Count());
+ delete pArray;
+ pArray = rTable.Prev();
+ }
+ rTable.Clear();
+}
+
+/*-----------------14.10.96 15.57-------------------
+
+--------------------------------------------------*/
+
+OfaAutocorrReplacePage::OfaAutocorrReplacePage( Window* pParent,
+ const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCORR_REPLACE ), rSet),
+ aTextOnlyCB( this, SVX_RES(CB_TEXT_ONLY )),
+ aShortFT ( this, SVX_RES(FT_SHORT )),
+ aShortED ( this, SVX_RES(ED_SHORT )),
+ aReplaceFT( this, SVX_RES(FT_REPLACE )),
+ aReplaceED( this, SVX_RES(ED_REPLACE )),
+ aReplaceTLB( this, SVX_RES(TLB_REPLACE )),
+ aNewReplacePB( this, SVX_RES(PB_NEW_REPLACE )),
+ aDeleteReplacePB(this,SVX_RES(PB_DELETE_REPLACE )),
+ sModify(SVX_RES(STR_MODIFY)),
+ sNew(aNewReplacePB.GetText()),
+ pFormatText(0),
+ eLang(eLastDialogLanguage),
+ bHasSelectionText(FALSE),
+ bFirstSelect(TRUE),
+ bReplaceEditChanged(FALSE),
+ bSWriter(TRUE)
+{
+ FreeResource();
+ SfxModule *pMod = *(SfxModule**)GetAppData(SHL_WRITER);
+ bSWriter = pMod == SfxModule::GetActiveModule();
+
+ ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage ));
+ pCompareClass = new CollatorWrapper( GetProcessFact() );
+ pCompareCaseClass = new CollatorWrapper( GetProcessFact() );
+ pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n::
+ CollatorOptions::CollatorOptions_IGNORE_CASE );
+ pCompareCaseClass->loadDefaultCollator( aLcl, 0 );
+ pCharClass = new CharClass( aLcl );
+
+ static long nTabs[] = { 2 /* Tab-Count */, 1, 61 };
+ aReplaceTLB.SetTabs( &nTabs[0], MAP_APPFONT );
+
+ aReplaceTLB.SetWindowBits(WB_HSCROLL|WB_CLIPCHILDREN);
+ aReplaceTLB.SetSelectHdl(LINK(this, OfaAutocorrReplacePage, SelectHdl));
+ aNewReplacePB.SetClickHdl( LINK(this, OfaAutocorrReplacePage, NewDelHdl));
+ aDeleteReplacePB.SetClickHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl));
+ aShortED.SetModifyHdl(LINK(this, OfaAutocorrReplacePage, ModifyHdl));
+ aReplaceED.SetModifyHdl(LINK(this, OfaAutocorrReplacePage, ModifyHdl));
+ aShortED.SetActionHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl));
+ aReplaceED.SetActionHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl));
+
+ aReplaceED.SetSpaces(TRUE);
+ aShortED.SetSpaces(TRUE);
+ aShortED.SetMaxTextLen(30);
+}
+
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+
+OfaAutocorrReplacePage::~OfaAutocorrReplacePage()
+{
+ delete pFormatText;
+ lcl_ClearTable(aDoubleStringTable);
+ delete pCompareClass;
+ delete pCompareCaseClass;
+ delete pCharClass;
+}
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* OfaAutocorrReplacePage::Create( Window* pParent,
+ const SfxItemSet& rSet)
+{
+ return new OfaAutocorrReplacePage(pParent, rSet);
+}
+/* -----------------20.11.98 13:26-------------------
+ *
+ * --------------------------------------------------*/
+void OfaAutocorrReplacePage::ActivatePage( const SfxItemSet& )
+{
+ if(eLang != eLastDialogLanguage)
+ SetLanguage(eLastDialogLanguage);
+ ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(TRUE);
+}
+/* -----------------20.11.98 13:26-------------------
+ *
+ * --------------------------------------------------*/
+int OfaAutocorrReplacePage::DeactivatePage( SfxItemSet* )
+{
+ return LEAVE_PAGE;
+}
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+BOOL OfaAutocorrReplacePage::FillItemSet( SfxItemSet& )
+{
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ DoubleStringArrayPtr pDoubleStringArray = aDoubleStringTable.Last();
+ while(pDoubleStringArray)
+ {
+ LanguageType eCurLang = (LanguageType)aDoubleStringTable.GetCurKey();
+ if(eCurLang != eLang) // die aktuelle Sprache wird weiter hinten behandelt
+ {
+ SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eCurLang);
+ USHORT nWordListCount = pWordList->Count();
+ USHORT nDoubleStringArrayCount = pDoubleStringArray->Count();
+ USHORT nPos = nDoubleStringArrayCount;
+ USHORT nLastPos = nPos;
+ // 1. Durchlauf: Eintraege loeschen oder veraendern:
+
+
+ for( USHORT nWordListPos = nWordListCount; nWordListPos; nWordListPos-- )
+ {
+ SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(nWordListPos - 1);
+ String sEntry(pWordPtr->GetShort());
+ // formatierter Text steht nur im Writer
+ BOOL bFound = !bSWriter && !pWordPtr->IsTextOnly();
+ while(!bFound && nPos)
+ {
+ DoubleString* pDouble = pDoubleStringArray->GetObject( nPos - 1);
+
+ if( 0 == pCompareClass->compareString(
+ sEntry, pDouble->sShort ))
+ {
+ nLastPos = nPos - 1;
+ bFound = TRUE;
+ if( !(pWordPtr->IsTextOnly() == (0 == pDouble->pUserData)
+ && 0 == pCompareCaseClass->compareString(
+ pWordPtr->GetLong(), pDouble->sLong ) ) )
+ {
+ pAutoCorrect->PutText(sEntry, pDouble->sLong, eCurLang);
+ }
+ pDoubleStringArray->DeleteAndDestroy(nPos - 1, 1);
+ break;
+ }
+ nPos--;
+ }
+ nPos = nLastPos;
+ if(!bFound)
+ {
+ pAutoCorrect->DeleteText(sEntry, eCurLang);
+ }
+ }
+ nDoubleStringArrayCount = pDoubleStringArray->Count();
+ for(USHORT nDoubleStringArrayPos = 0; nDoubleStringArrayPos < nDoubleStringArrayCount; nDoubleStringArrayPos++ )
+ {
+ //jetzt sollte es nur noch neue Eintraege geben
+ DoubleString* pDouble = pDoubleStringArray->GetObject( nDoubleStringArrayPos );
+ if(pDouble->pUserData == &bHasSelectionText)
+ pAutoCorrect->PutText( pDouble->sShort,
+ *SfxObjectShell::Current(), eCurLang );
+ else
+ {
+ pAutoCorrect->PutText( pDouble->sShort, pDouble->sLong,
+ eCurLang);
+ }
+ }
+ }
+ pDoubleStringArray->DeleteAndDestroy(0, pDoubleStringArray->Count());
+ delete pDoubleStringArray;
+ pDoubleStringArray = aDoubleStringTable.Prev();
+ }
+ aDoubleStringTable.Clear();
+ // jetzt noch die aktuelle Selektion
+ SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eLang);
+ USHORT nWordListCount = pWordList->Count();
+ USHORT nListBoxCount = (USHORT)aReplaceTLB.GetEntryCount();
+
+ aReplaceTLB.SetUpdateMode(FALSE);
+ USHORT nListBoxPos = nListBoxCount;
+ USHORT nLastListBoxPos = nListBoxPos;
+ // 1. Durchlauf: Eintraege loeschen oder veraendern:
+
+ USHORT i;
+ for( i = nWordListCount; i; i-- )
+ {
+ SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(i- 1);
+ String sEntry(pWordPtr->GetShort());
+ // formatierter Text steht nur im Writer
+ BOOL bFound = !bSWriter && !pWordPtr->IsTextOnly();
+ while(!bFound && nListBoxPos)
+ {
+ SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( nListBoxPos - 1);
+ if( 0 == pCompareClass->compareString( sEntry,
+ aReplaceTLB.GetEntryText(pEntry, 0)))
+ {
+ nLastListBoxPos = nListBoxPos - 1;
+ bFound = TRUE;
+ String sLong = aReplaceTLB.GetEntryText(pEntry, 1);
+ if( !(pWordPtr->IsTextOnly() == (0 == pEntry->GetUserData())
+ && 0 == pCompareCaseClass->compareString(
+ pWordPtr->GetLong(), sLong )))
+ {
+ pAutoCorrect->PutText(sEntry, sLong, eLang);
+ }
+ aReplaceTLB.GetModel()->Remove(pEntry);
+ break;
+
+ }
+ nListBoxPos --;
+ }
+ nListBoxPos = nLastListBoxPos;
+ if(!bFound)
+ {
+ pAutoCorrect->DeleteText(sEntry, eLang);
+ }
+
+ }
+ nListBoxCount = (USHORT)aReplaceTLB.GetEntryCount();
+ for(i = 0; i < nListBoxCount; i++ )
+ {
+ //jetzt sollte es nur noch neue Eintraege geben
+ SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i );
+ String sShort = aReplaceTLB.GetEntryText(pEntry, 0);
+ if(pEntry->GetUserData() == &bHasSelectionText)
+ pAutoCorrect->PutText(sShort, *SfxObjectShell::Current(), eLang);
+ else
+ {
+ String sLong = aReplaceTLB.GetEntryText(pEntry, 1);
+ pAutoCorrect->PutText(sShort, sLong, eLang);
+ }
+ }
+
+ return FALSE;
+}
+
+/* -----------------19.11.98 13:16-------------------
+ *
+ * --------------------------------------------------*/
+void OfaAutocorrReplacePage::RefillReplaceBox(BOOL bFromReset,
+ LanguageType eOldLanguage,
+ LanguageType eNewLanguage)
+{
+ eLang = eNewLanguage;
+ if(bFromReset)
+ lcl_ClearTable(aDoubleStringTable);
+ else
+ {
+ DoubleStringArray* pArray = 0;
+ if(aDoubleStringTable.IsKeyValid(eOldLanguage))
+ {
+ pArray = aDoubleStringTable.Seek(ULONG(eOldLanguage));
+ pArray->DeleteAndDestroy(0, pArray->Count());
+ }
+ else
+ {
+ pArray = new DoubleStringArray;
+ aDoubleStringTable.Insert(ULONG(eOldLanguage), pArray);
+ }
+
+ USHORT nListBoxCount = (USHORT)aReplaceTLB.GetEntryCount();
+ USHORT i;
+ for(i = 0; i < nListBoxCount; i++)
+ {
+ DoubleString* pDouble = new DoubleString();
+ SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i );
+ pDouble->sShort = aReplaceTLB.GetEntryText(pEntry, 0);
+ pDouble->sLong = aReplaceTLB.GetEntryText(pEntry, 1);
+ pDouble->pUserData = pEntry->GetUserData();
+ pArray->Insert(pDouble, i);
+ }
+ }
+
+ aReplaceTLB.Clear();
+ if(!bSWriter)
+ {
+ if(pFormatText)
+ pFormatText->DeleteAndDestroy(0, pFormatText->Count());
+ else
+ pFormatText = new SvStringsISortDtor();
+ }
+
+ if(aDoubleStringTable.IsKeyValid(eLang))
+ {
+ DoubleStringArray* pArray = aDoubleStringTable.Seek(ULONG(eNewLanguage));
+ for(USHORT i = 0; i < pArray->Count(); i++)
+ {
+ DoubleString* pDouble = pArray->GetObject(i);
+ BOOL bTextOnly = 0 == pDouble->pUserData;
+ // formatierter Text wird nur im Writer angeboten
+ if(bSWriter || bTextOnly)
+ {
+ String sEntry(pDouble->sShort);
+ sEntry += '\t';
+ sEntry += pDouble->sLong;
+ SvLBoxEntry* pEntry = aReplaceTLB.InsertEntry(sEntry);
+ aTextOnlyCB.Check(bTextOnly);
+ if(!bTextOnly)
+ pEntry->SetUserData(pDouble->pUserData); // Das heisst: mit Formatinfo oder sogar mit Selektionstext
+ }
+ else
+ {
+ pFormatText->Insert(new String(pDouble->sShort));
+ }
+ }
+ }
+ else
+ {
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eLang);
+
+ for(USHORT i = 0; i < pWordList->Count(); i++)
+ {
+ SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(i);
+ BOOL bTextOnly = pWordPtr->IsTextOnly();
+ // formatierter Text wird nur im Writer angeboten
+ if(bSWriter || bTextOnly)
+ {
+ String sEntry(pWordPtr->GetShort());
+ sEntry += '\t';
+ sEntry += pWordPtr->GetLong();
+ SvLBoxEntry* pEntry = aReplaceTLB.InsertEntry(sEntry);
+ aTextOnlyCB.Check(pWordPtr->IsTextOnly());
+ if(!bTextOnly)
+ pEntry->SetUserData(&aTextOnlyCB); // Das heisst: mit Formatinfo
+ }
+ else
+ {
+ pFormatText->Insert(new String(pWordPtr->GetShort()));
+ }
+ }
+ aNewReplacePB.Enable(FALSE);
+ aDeleteReplacePB.Enable(FALSE);
+
+ }
+
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ if( pViewShell && pViewShell->HasSelection( TRUE ) )
+ {
+ bHasSelectionText = TRUE;
+ const String sSelection( pViewShell->GetSelectionText() );
+ aReplaceED.SetText( sSelection );
+ aTextOnlyCB.Check( !bSWriter );
+ aTextOnlyCB.Enable( bSWriter && sSelection.Len() );
+ }
+ else
+ aTextOnlyCB.Enable( FALSE );
+}
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+void OfaAutocorrReplacePage::Reset( const SfxItemSet& )
+{
+ RefillReplaceBox(TRUE, eLang, eLang);
+ aShortED.GrabFocus();
+}
+
+/* -----------------23.11.98 10:33-------------------
+ *
+ * --------------------------------------------------*/
+void OfaAutocorrReplacePage::SetLanguage(LanguageType eSet)
+{
+ //save old settings an refill
+ if(eSet != eLang)
+ {
+ RefillReplaceBox(FALSE, eLang, eSet);
+ eLastDialogLanguage = eSet;
+ delete pCompareClass;
+ delete pCompareCaseClass;
+ delete pCharClass;
+
+ ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage ));
+ pCompareClass = new CollatorWrapper( GetProcessFact() );
+ pCompareCaseClass = new CollatorWrapper( GetProcessFact() );
+ pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n::
+ CollatorOptions::CollatorOptions_IGNORE_CASE );
+ pCompareCaseClass->loadDefaultCollator( aLcl, 0 );
+ pCharClass = new CharClass( aLcl );
+ ModifyHdl(&aShortED);
+ }
+}
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+
+IMPL_LINK(OfaAutocorrReplacePage, SelectHdl, SvTabListBox*, pBox)
+{
+ if(!bFirstSelect || !bHasSelectionText)
+ {
+ SvLBoxEntry* pEntry = pBox->FirstSelected();
+ String sTmpShort(pBox->GetEntryText(pEntry, 0));
+ // wird der Text ueber den ModifyHdl gesetzt, dann steht der Cursor sonst immer am Wortanfang,
+ // obwohl man gerade hier editiert
+ BOOL bSameContent = 0 == pCompareClass->compareString(
+ sTmpShort, aShortED.GetText() );
+ Selection aSel = aShortED.GetSelection();
+ if(aShortED.GetText() != sTmpShort)
+ {
+ aShortED.SetText(sTmpShort);
+ //war es nur eine andere Schreibweise, dann muss die Selektion auch wieder gesetzt werden
+ if(bSameContent)
+ aShortED.SetSelection(aSel);
+ }
+ aReplaceED.SetText(pBox->GetEntryText(pEntry, 1));
+ // mit UserData gibt es eine Formatinfo
+ aTextOnlyCB.Check(0 == pEntry->GetUserData());
+ }
+ else
+ bFirstSelect = FALSE;
+
+ aNewReplacePB.Enable(FALSE);
+ aDeleteReplacePB.Enable();
+ return 0;
+};
+
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+
+IMPL_LINK(OfaAutocorrReplacePage, NewDelHdl, PushButton*, pBtn)
+{
+ SvLBoxEntry* _pEntry = aReplaceTLB.FirstSelected();
+ if(pBtn == &aDeleteReplacePB)
+ {
+ DBG_ASSERT(_pEntry, "keine Eintrag selektiert");
+ if(_pEntry)
+ {
+ aReplaceTLB.GetModel()->Remove(_pEntry);
+ ModifyHdl(&aShortED);
+ return 0;
+ }
+ }
+ if(pBtn == &aNewReplacePB || aNewReplacePB.IsEnabled())
+ {
+ SvLBoxEntry* _pNewEntry = aReplaceTLB.FirstSelected();
+ String sEntry(aShortED.GetText());
+ if(sEntry.Len() && ( aReplaceED.GetText().Len() ||
+ ( bHasSelectionText && bSWriter ) ))
+ {
+ aReplaceTLB.SetUpdateMode(FALSE);
+ USHORT nPos = USHRT_MAX;
+ sEntry += '\t';
+ sEntry += aReplaceED.GetText();
+ if(_pNewEntry)
+ {
+ nPos = (USHORT)aReplaceTLB.GetModel()->GetAbsPos(_pNewEntry);
+ aReplaceTLB.GetModel()->Remove(_pNewEntry);
+ }
+ else
+ {
+ USHORT j;
+ for( j = 0; j < aReplaceTLB.GetEntryCount(); j++ )
+ {
+ SvLBoxEntry* pReplaceEntry = aReplaceTLB.GetEntry(j);
+ if( 0 >= pCompareClass->compareString(sEntry,
+ aReplaceTLB.GetEntryText(pReplaceEntry, 0) ) )
+ break;
+ }
+ nPos = j;
+ }
+ SvLBoxEntry* pInsEntry =
+ aReplaceTLB.InsertEntry(
+ sEntry, static_cast< SvLBoxEntry * >(NULL), false,
+ nPos == USHRT_MAX ? LIST_APPEND : nPos);
+ if( !bReplaceEditChanged && !aTextOnlyCB.IsChecked())
+ pInsEntry->SetUserData(&bHasSelectionText); // neuer formatierter Text
+
+ aReplaceTLB.MakeVisible( pInsEntry );
+ aReplaceTLB.SetUpdateMode(TRUE);
+ // falls der Request aus dem ReplaceEdit kam, dann Focus in das ShortEdit setzen
+ if(aReplaceED.HasFocus())
+ aShortED.GrabFocus();
+
+ }
+ }
+ else
+ {
+ // das kann nur ein Enter in einem der beiden Edit-Felder sein und das
+ // bedeutet EndDialog() - muss im KeyInput ausgewertet werden
+ return 0;
+ }
+ ModifyHdl(&aShortED);
+ return 1;
+}
+
+/*-----------------17.10.96 07.49-------------------
+
+--------------------------------------------------*/
+IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, Edit*, pEdt)
+{
+ SvLBoxEntry* pFirstSel = aReplaceTLB.FirstSelected();
+ BOOL bShort = pEdt == &aShortED;
+ const String rEntry = pEdt->GetText();
+ const String rRepString = aReplaceED.GetText();
+ String aWordStr( pCharClass->lower( rEntry ));
+
+ if(bShort)
+ {
+ if(rEntry.Len())
+ {
+ BOOL bFound = FALSE;
+ BOOL bTmpSelEntry=FALSE;
+
+ for(USHORT i = 0; i < aReplaceTLB.GetEntryCount(); i++)
+ {
+ SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i );
+ String aTestStr=aReplaceTLB.GetEntryText(pEntry, 0);
+ if( 0 == pCompareClass->compareString(rEntry, aTestStr ))
+ {
+ if(rRepString.Len())
+ bFirstSelect = TRUE;
+ aReplaceTLB.SetCurEntry(pEntry);
+ pFirstSel = pEntry;
+ aNewReplacePB.SetText(sModify);
+ bFound= TRUE;
+ break;
+ }
+ else
+ {
+ pCharClass->toLower( aTestStr );
+ if(aTestStr.Search(aWordStr)==0 && !bTmpSelEntry)
+ {
+ aReplaceTLB.MakeVisible(pEntry);
+ bTmpSelEntry=TRUE;
+ }
+ }
+ }
+ if(!bFound)
+ {
+ aReplaceTLB.SelectAll(FALSE);
+ pFirstSel = 0;
+ aNewReplacePB.SetText(sNew);
+ if(bReplaceEditChanged)
+ aTextOnlyCB.Enable(FALSE);
+ }
+ aDeleteReplacePB.Enable(bFound);
+ }
+ else if(aReplaceTLB.GetEntryCount()>0)
+ {
+ SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( 0 );
+ aReplaceTLB.MakeVisible(pEntry);
+ }
+
+ }
+ else if(!bShort)
+ {
+ bReplaceEditChanged = TRUE;
+ if(pFirstSel)
+ {
+ aNewReplacePB.SetText(sModify);
+ }
+ }
+
+ const String& rShortTxt = aShortED.GetText();
+ BOOL bEnableNew = rShortTxt.Len() &&
+ ( rRepString.Len() ||
+ ( bHasSelectionText && bSWriter )) &&
+ ( !pFirstSel || rRepString !=
+ aReplaceTLB.GetEntryText( pFirstSel, 1 ) );
+ if(bEnableNew && pFormatText)
+ {
+ for(USHORT i = 0; i < pFormatText->Count(); i++)
+ if(*pFormatText->GetObject(i) == rShortTxt)
+ {
+ bEnableNew = FALSE;
+ break;
+ }
+ }
+ aNewReplacePB.Enable(bEnableNew);
+
+ return 0;
+}
+
+/* -----------------20.11.98 13:48-------------------
+ *
+ * --------------------------------------------------*/
+
+struct StringsArrays
+{
+
+ SvStringsDtor aAbbrevStrings;
+ SvStringsDtor aDoubleCapsStrings;
+
+ StringsArrays() :
+ aAbbrevStrings(5,5), aDoubleCapsStrings(5,5) {}
+};
+typedef StringsArrays* StringsArraysPtr;
+/* -----------------19.11.98 16:07-------------------
+ *
+ * --------------------------------------------------*/
+BOOL lcl_FindInArray(SvStringsDtor& rStrings, const String& rString)
+{
+ for(USHORT i = 0; i < rStrings.Count(); i++)
+ if(rString == *rStrings.GetObject(i))
+ return TRUE;
+ return FALSE;
+}
+
+void lcl_ClearTable(StringsTable& rTable)
+{
+ StringsArraysPtr pArrays = rTable.Last();
+ while(pArrays)
+ {
+ delete pArrays;
+ pArrays = rTable.Prev();
+ }
+ rTable.Clear();
+}
+
+/*-----------------14.10.96 15.57-------------------
+
+--------------------------------------------------*/
+
+OfaAutocorrExceptPage::OfaAutocorrExceptPage( Window* pParent,
+ const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCORR_EXCEPT ), rSet),
+ aAbbrevFL (this, SVX_RES(FL_ABBREV )),
+ aAbbrevED (this, SVX_RES(ED_ABBREV )),
+ aAbbrevLB (this, SVX_RES(LB_ABBREV )),
+ aNewAbbrevPB (this, SVX_RES(PB_NEWABBREV )),
+ aDelAbbrevPB (this, SVX_RES(PB_DELABBREV )),
+ aAutoAbbrevCB (this, SVX_RES(CB_AUTOABBREV )),
+ aDoubleCapsFL (this, SVX_RES(FL_DOUBLECAPS )),
+ aDoubleCapsED (this, SVX_RES(ED_DOUBLE_CAPS )),
+ aDoubleCapsLB (this, SVX_RES(LB_DOUBLE_CAPS )),
+ aNewDoublePB (this, SVX_RES(PB_NEWDOUBLECAPS)),
+ aDelDoublePB (this, SVX_RES(PB_DELDOUBLECAPS)),
+ aAutoCapsCB (this, SVX_RES(CB_AUTOCAPS )),
+ eLang(eLastDialogLanguage)
+{
+ FreeResource();
+
+ ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage ));
+ pCompareClass = new CollatorWrapper( GetProcessFact() );
+ pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n::
+ CollatorOptions::CollatorOptions_IGNORE_CASE );
+
+ aNewAbbrevPB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl));
+ aDelAbbrevPB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl));
+ aNewDoublePB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl));
+ aDelDoublePB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl));
+
+ aAbbrevLB.SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl));
+ aDoubleCapsLB.SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl));
+ aAbbrevED.SetModifyHdl(LINK(this, OfaAutocorrExceptPage, ModifyHdl));
+ aDoubleCapsED.SetModifyHdl(LINK(this, OfaAutocorrExceptPage, ModifyHdl));
+
+ aAbbrevED.SetActionHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl));
+ aDoubleCapsED.SetActionHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl));
+
+}
+
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+OfaAutocorrExceptPage::~OfaAutocorrExceptPage()
+{
+ lcl_ClearTable(aStringsTable);
+ delete pCompareClass;
+}
+
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* OfaAutocorrExceptPage::Create( Window* pParent,
+ const SfxItemSet& rSet)
+{
+ return new OfaAutocorrExceptPage(pParent, rSet);
+}
+/* -----------------20.11.98 13:26-------------------
+ *
+ * --------------------------------------------------*/
+void OfaAutocorrExceptPage::ActivatePage( const SfxItemSet& )
+{
+ if(eLang != eLastDialogLanguage)
+ SetLanguage(eLastDialogLanguage);
+ ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(TRUE);
+}
+/* -----------------20.11.98 13:26-------------------
+ *
+ * --------------------------------------------------*/
+int OfaAutocorrExceptPage::DeactivatePage( SfxItemSet* )
+{
+ return LEAVE_PAGE;
+}
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+BOOL OfaAutocorrExceptPage::FillItemSet( SfxItemSet& )
+{
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ StringsArraysPtr pArrays = aStringsTable.Last();
+ while(pArrays)
+ {
+ LanguageType eCurLang = (LanguageType)aStringsTable.GetCurKey();
+ if(eCurLang != eLang) // die aktuelle Sprache wird weiter hinten behandelt
+ {
+ SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eCurLang);
+
+ if(pWrdList)
+ {
+ USHORT nCount = pWrdList->Count();
+ USHORT i;
+ for( i = nCount; i; )
+ {
+ String* pString = pWrdList->GetObject( --i );
+ //Eintrag finden u. gfs entfernen
+ if( !lcl_FindInArray(pArrays->aDoubleCapsStrings, *pString))
+ pWrdList->DeleteAndDestroy( i );
+ }
+ nCount = pArrays->aDoubleCapsStrings.Count();
+ for( i = 0; i < nCount; ++i )
+ {
+ String* pEntry = new String( *pArrays->aDoubleCapsStrings.GetObject( i ) );
+ if( !pWrdList->Insert( pEntry ))
+ delete pEntry;
+ }
+ pAutoCorrect->SaveWrdSttExceptList(eCurLang);
+ }
+
+ SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eCurLang);
+
+ if(pCplList)
+ {
+ USHORT nCount = pCplList->Count();
+ USHORT i;
+ for( i = nCount; i; )
+ {
+ String* pString = pCplList->GetObject( --i );
+ if( !lcl_FindInArray(pArrays->aAbbrevStrings, *pString))
+ pCplList->DeleteAndDestroy( i );
+ }
+ nCount = pArrays->aAbbrevStrings.Count();
+ for( i = 0; i < nCount; ++i )
+ {
+ String* pEntry = new String( *pArrays->aAbbrevStrings.GetObject(i) );
+ if( !pCplList->Insert( pEntry ))
+ delete pEntry;
+ }
+ pAutoCorrect->SaveCplSttExceptList(eCurLang);
+ }
+ }
+ pArrays = aStringsTable.Prev();
+ }
+ aStringsTable.Clear();
+
+ SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eLang);
+
+ if(pWrdList)
+ {
+ USHORT nCount = pWrdList->Count();
+ USHORT i;
+ for( i = nCount; i; )
+ {
+ String* pString = pWrdList->GetObject( --i );
+ if( USHRT_MAX == aDoubleCapsLB.GetEntryPos(*pString) )
+ pWrdList->DeleteAndDestroy( i );
+ }
+ nCount = aDoubleCapsLB.GetEntryCount();
+ for( i = 0; i < nCount; ++i )
+ {
+ String* pEntry = new String( aDoubleCapsLB.GetEntry( i ) );
+ if( !pWrdList->Insert( pEntry ))
+ delete pEntry;
+ }
+ pAutoCorrect->SaveWrdSttExceptList(eLang);
+ }
+
+ SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eLang);
+
+ if(pCplList)
+ {
+ USHORT nCount = pCplList->Count();
+ USHORT i;
+ for( i = nCount; i; )
+ {
+ String* pString = pCplList->GetObject( --i );
+ if( USHRT_MAX == aAbbrevLB.GetEntryPos(*pString) )
+ pCplList->DeleteAndDestroy( i );
+ }
+ nCount = aAbbrevLB.GetEntryCount();
+ for( i = 0; i < nCount; ++i )
+ {
+ String* pEntry = new String( aAbbrevLB.GetEntry( i ) );
+ if( !pCplList->Insert( pEntry ))
+ delete pEntry;
+ }
+ pAutoCorrect->SaveCplSttExceptList(eLang);
+ }
+ if(aAutoAbbrevCB.IsChecked() != aAutoAbbrevCB.GetSavedValue())
+ pAutoCorrect->SetAutoCorrFlag( SaveWordCplSttLst, aAutoAbbrevCB.IsChecked());
+ if(aAutoCapsCB.IsChecked() != aAutoCapsCB.GetSavedValue())
+ pAutoCorrect->SetAutoCorrFlag( SaveWordWrdSttLst, aAutoCapsCB.IsChecked());
+ return FALSE;
+}
+
+/* -----------------23.11.98 10:33-------------------
+ *
+ * --------------------------------------------------*/
+void OfaAutocorrExceptPage::SetLanguage(LanguageType eSet)
+{
+ if(eLang != eSet)
+ {
+ //alte Einstellungen speichern und neu fuellen
+ RefillReplaceBoxes(FALSE, eLang, eSet);
+ eLastDialogLanguage = eSet;
+ delete pCompareClass;
+ pCompareClass = new CollatorWrapper( GetProcessFact() );
+ pCompareClass->loadDefaultCollator( SvxCreateLocale( eLastDialogLanguage ),
+ ::com::sun::star::i18n::
+ CollatorOptions::CollatorOptions_IGNORE_CASE );
+ ModifyHdl(&aAbbrevED);
+ ModifyHdl(&aDoubleCapsED);
+ }
+}
+/* -----------------20.11.98 14:06-------------------
+ *
+ * --------------------------------------------------*/
+void OfaAutocorrExceptPage::RefillReplaceBoxes(BOOL bFromReset,
+ LanguageType eOldLanguage,
+ LanguageType eNewLanguage)
+{
+ eLang = eNewLanguage;
+ if(bFromReset)
+ lcl_ClearTable(aStringsTable);
+ else
+ {
+ StringsArraysPtr pArrays = 0;
+ if(aStringsTable.IsKeyValid(eOldLanguage))
+ {
+ pArrays = aStringsTable.Seek(ULONG(eOldLanguage));
+ pArrays->aAbbrevStrings.DeleteAndDestroy(
+ 0, pArrays->aAbbrevStrings.Count());
+ pArrays->aDoubleCapsStrings.DeleteAndDestroy(
+ 0, pArrays->aDoubleCapsStrings.Count());
+ }
+ else
+ {
+ pArrays = new StringsArrays;
+ aStringsTable.Insert(ULONG(eOldLanguage), pArrays);
+ }
+
+ USHORT i;
+ for(i = 0; i < aAbbrevLB.GetEntryCount(); i++)
+ {
+ pArrays->aAbbrevStrings.Insert(
+ new String(aAbbrevLB.GetEntry(i)), i);
+
+ }
+ for(i = 0; i < aDoubleCapsLB.GetEntryCount(); i++)
+ {
+ pArrays->aDoubleCapsStrings.Insert(
+ new String(aDoubleCapsLB.GetEntry(i)), i);
+ }
+ }
+ aDoubleCapsLB.Clear();
+ aAbbrevLB.Clear();
+ String sTemp;
+ aAbbrevED.SetText(sTemp);
+ aDoubleCapsED.SetText(sTemp);
+
+ if(aStringsTable.IsKeyValid(eLang))
+ {
+ StringsArraysPtr pArrays = aStringsTable.Seek(ULONG(eLang));
+ USHORT i;
+ for(i = 0; i < pArrays->aAbbrevStrings.Count(); i++ )
+ {
+ aAbbrevLB.InsertEntry(*pArrays->aAbbrevStrings.GetObject(i));
+ }
+ for( i = 0; i < pArrays->aDoubleCapsStrings.Count(); i++ )
+ {
+ aDoubleCapsLB.InsertEntry(*pArrays->aDoubleCapsStrings.GetObject(i));
+ }
+ }
+ else
+ {
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ const SvStringsISortDtor* pCplList = pAutoCorrect->GetCplSttExceptList(eLang);
+ const SvStringsISortDtor* pWrdList = pAutoCorrect->GetWrdSttExceptList(eLang);
+ USHORT i;
+ for( i = 0; i < pCplList->Count(); i++ )
+ {
+ aAbbrevLB.InsertEntry(*pCplList->GetObject(i));
+ }
+ for( i = 0; i < pWrdList->Count(); i++ )
+ {
+ aDoubleCapsLB.InsertEntry(*pWrdList->GetObject(i));
+ }
+ }
+}
+
+/*-----------------14.10.96 15.58-------------------
+
+--------------------------------------------------*/
+
+void OfaAutocorrExceptPage::Reset( const SfxItemSet& )
+{
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ RefillReplaceBoxes(TRUE, eLang, eLang);
+ aAutoAbbrevCB. Check( pAutoCorrect->IsAutoCorrFlag( SaveWordCplSttLst ));
+ aAutoCapsCB. Check( pAutoCorrect->IsAutoCorrFlag( SaveWordWrdSttLst ));
+ aAutoAbbrevCB.SaveValue();
+ aAutoCapsCB.SaveValue();
+}
+
+/*-----------------16.10.96 12.27-------------------
+
+--------------------------------------------------*/
+
+
+IMPL_LINK(OfaAutocorrExceptPage, NewDelHdl, PushButton*, pBtn)
+{
+ if((pBtn == &aNewAbbrevPB || pBtn == (PushButton*)&aAbbrevED )
+ && aAbbrevED.GetText().Len())
+ {
+ aAbbrevLB.InsertEntry(aAbbrevED.GetText());
+ ModifyHdl(&aAbbrevED);
+ }
+ else if(pBtn == &aDelAbbrevPB)
+ {
+ aAbbrevLB.RemoveEntry(aAbbrevED.GetText());
+ ModifyHdl(&aAbbrevED);
+ }
+ else if((pBtn == &aNewDoublePB || pBtn == (PushButton*)&aDoubleCapsED )
+ && aDoubleCapsED.GetText().Len())
+ {
+ aDoubleCapsLB.InsertEntry(aDoubleCapsED.GetText());
+ ModifyHdl(&aDoubleCapsED);
+ }
+ else if(pBtn == &aDelDoublePB)
+ {
+ aDoubleCapsLB.RemoveEntry(aDoubleCapsED.GetText());
+ ModifyHdl(&aDoubleCapsED);
+ }
+ return 0;
+}
+
+/*-----------------16.10.96 12.57-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(OfaAutocorrExceptPage, SelectHdl, ListBox*, pBox)
+{
+ if(pBox == &aAbbrevLB)
+ {
+ aAbbrevED.SetText(pBox->GetSelectEntry());
+ aNewAbbrevPB.Enable(FALSE);
+ aDelAbbrevPB.Enable();
+ }
+ else
+ {
+ aDoubleCapsED.SetText(pBox->GetSelectEntry());
+ aNewDoublePB.Enable(FALSE);
+ aDelDoublePB.Enable();
+ }
+ return 0;
+}
+
+/*-----------------16.10.96 13.02-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(OfaAutocorrExceptPage, ModifyHdl, Edit*, pEdt)
+{
+// BOOL bSame = pEdt->GetText() == ->GetSelectEntry();
+ const String& sEntry = pEdt->GetText();
+ BOOL bEntryLen = 0!= sEntry.Len();
+ if(pEdt == &aAbbrevED)
+ {
+ BOOL bSame = lcl_FindEntry(aAbbrevLB, sEntry, *pCompareClass);
+ if(bSame && sEntry != aAbbrevLB.GetSelectEntry())
+ pEdt->SetText(aAbbrevLB.GetSelectEntry());
+ aNewAbbrevPB.Enable(!bSame && bEntryLen);
+ aDelAbbrevPB.Enable(bSame && bEntryLen);
+ }
+ else
+ {
+ BOOL bSame = lcl_FindEntry(aDoubleCapsLB, sEntry, *pCompareClass);
+ if(bSame && sEntry != aDoubleCapsLB.GetSelectEntry())
+ pEdt->SetText(aDoubleCapsLB.GetSelectEntry());
+ aNewDoublePB.Enable(!bSame && bEntryLen);
+ aDelDoublePB.Enable(bSame && bEntryLen);
+ }
+ return 0;
+}
+
+/*-----------------16.10.96 15.03-------------------
+
+--------------------------------------------------*/
+
+void AutoCorrEdit::KeyInput( const KeyEvent& rKEvt )
+{
+ const KeyCode aKeyCode = rKEvt.GetKeyCode();
+ const USHORT nModifier = aKeyCode.GetModifier();
+ if( aKeyCode.GetCode() == KEY_RETURN )
+ {
+ //wird bei Enter nichts getan, dann doch die Basisklasse rufen
+ // um den Dialog zu schliessen
+ if(!nModifier && !aActionLink.Call(this))
+ Edit::KeyInput(rKEvt);
+ }
+ else if(bSpaces || aKeyCode.GetCode() != KEY_SPACE)
+ Edit::KeyInput(rKEvt);
+}
+
+/*-----------------03.07.97 13:17-------------------
+
+--------------------------------------------------*/
+
+OfaQuoteTabPage::OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCORR_QUOTE ), rSet),
+ aSingleFL (this, SVX_RES(FL_SINGLE )),
+ aSingleTypoCB (this, SVX_RES(CB_SGL_TYPO )),
+ aSglStartQuoteFT (this, SVX_RES(FT_SGL_STARTQUOTE )),
+ aSglStartQuotePB (this, SVX_RES(PB_SGL_STARTQUOTE )),
+ aSglStartExFT (this, SVX_RES(FT_SGSTEX )),
+ aSglEndQuoteFT (this, SVX_RES(FT_SGL_ENDQUOTE )),
+ aSglEndQuotePB (this, SVX_RES(PB_SGL_ENDQUOTE )),
+ aSglEndExFT (this, SVX_RES(FT_SGENEX )),
+ aSglStandardPB (this, SVX_RES(PB_SGL_STD )),
+
+ aDoubleFL (this, SVX_RES(FL_DOUBLE )),
+ aTypoCB (this, SVX_RES(CB_TYPO )),
+ aStartQuoteFT (this, SVX_RES(FT_STARTQUOTE )),
+ aStartQuotePB (this, SVX_RES(PB_STARTQUOTE )),
+ aDblStartExFT (this, SVX_RES(FT_DBSTEX )),
+ aEndQuoteFT (this, SVX_RES(FT_ENDQUOTE )),
+ aEndQuotePB (this, SVX_RES(PB_ENDQUOTE )),
+ aDblEndExFT (this, SVX_RES(FT_DBECEX )),
+ aDblStandardPB (this, SVX_RES(PB_DBL_STD )),
+
+ sStartQuoteDlg (SVX_RES(STR_CHANGE_START)),
+ sEndQuoteDlg (SVX_RES(STR_CHANGE_END)),
+
+ sStandard(SVX_RES(ST_STANDARD))
+{
+ FreeResource();
+
+ aStartQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl));
+ aEndQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl));
+ aSglStartQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl));
+ aSglEndQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl));
+ aDblStandardPB.SetClickHdl(LINK(this, OfaQuoteTabPage, StdQuoteHdl));
+ aSglStandardPB.SetClickHdl(LINK(this, OfaQuoteTabPage, StdQuoteHdl));
+
+}
+/*-----------------03.07.97 13:17-------------------
+
+--------------------------------------------------*/
+OfaQuoteTabPage::~OfaQuoteTabPage()
+{
+}
+/*-----------------03.07.97 13:17-------------------
+
+--------------------------------------------------*/
+SfxTabPage* OfaQuoteTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new OfaQuoteTabPage(pParent, rAttrSet);
+}
+/*-----------------03.07.97 13:18-------------------
+
+--------------------------------------------------*/
+BOOL OfaQuoteTabPage::FillItemSet( SfxItemSet& )
+{
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+
+ long nFlags = pAutoCorrect->GetFlags();
+ pAutoCorrect->SetAutoCorrFlag(ChgQuotes, aTypoCB.IsChecked());
+ pAutoCorrect->SetAutoCorrFlag(ChgSglQuotes, aSingleTypoCB.IsChecked());
+ BOOL bReturn = nFlags != pAutoCorrect->GetFlags();
+ if(cStartQuote != pAutoCorrect->GetStartDoubleQuote())
+ {
+ bReturn = TRUE;
+ sal_Unicode cUCS2 = static_cast<sal_Unicode>(cStartQuote); //TODO
+ pAutoCorrect->SetStartDoubleQuote(cUCS2);
+ }
+ if(cEndQuote != pAutoCorrect->GetEndDoubleQuote())
+ {
+ bReturn = TRUE;
+ sal_Unicode cUCS2 = static_cast<sal_Unicode>(cEndQuote); //TODO
+ pAutoCorrect->SetEndDoubleQuote(cUCS2);
+ }
+ if(cSglStartQuote != pAutoCorrect->GetStartSingleQuote())
+ {
+ bReturn = TRUE;
+ sal_Unicode cUCS2 = static_cast<sal_Unicode>(cSglStartQuote); //TODO
+ pAutoCorrect->SetStartSingleQuote(cUCS2);
+ }
+ if(cSglEndQuote != pAutoCorrect->GetEndSingleQuote())
+ {
+ bReturn = TRUE;
+ sal_Unicode cUCS2 = static_cast<sal_Unicode>(cSglEndQuote); //TODO
+ pAutoCorrect->SetEndSingleQuote(cUCS2);
+ }
+
+ if(bReturn )
+ {
+ SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+ pCfg->SetModified();
+ pCfg->Commit();
+ }
+ return bReturn;
+}
+/* -----------------23.11.98 16:15-------------------
+ *
+ * --------------------------------------------------*/
+void OfaQuoteTabPage::ActivatePage( const SfxItemSet& )
+{
+ ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(FALSE);
+}
+/*-----------------03.07.97 13:18-------------------
+
+--------------------------------------------------*/
+void OfaQuoteTabPage::Reset( const SfxItemSet& )
+{
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ const long nFlags = pAutoCorrect->GetFlags();
+
+ aTypoCB .Check(0 != (nFlags & ChgQuotes));
+ aSingleTypoCB .Check(0 != (nFlags & ChgSglQuotes));
+ aTypoCB .SaveValue();
+ aSingleTypoCB .SaveValue();
+
+ cStartQuote = pAutoCorrect->GetStartDoubleQuote();
+ cEndQuote = pAutoCorrect->GetEndDoubleQuote();
+ cSglStartQuote = pAutoCorrect->GetStartSingleQuote();
+ cSglEndQuote = pAutoCorrect->GetEndSingleQuote();
+
+ aSglStartExFT .SetText(ChangeStringExt_Impl(cSglStartQuote));
+ aSglEndExFT .SetText(ChangeStringExt_Impl(cSglEndQuote));
+ aDblStartExFT .SetText(ChangeStringExt_Impl(cStartQuote));
+ aDblEndExFT .SetText(ChangeStringExt_Impl(cEndQuote));
+}
+
+
+/*-----------------15.10.96 16.42-------------------
+
+--------------------------------------------------*/
+#define SGL_START 0
+#define DBL_START 1
+#define SGL_END 2
+#define DBL_END 3
+
+
+IMPL_LINK( OfaQuoteTabPage, QuoteHdl, PushButton*, pBtn )
+{
+ USHORT nMode = SGL_START;
+ if(pBtn == &aSglEndQuotePB)
+ nMode = SGL_END;
+ else if(pBtn == &aStartQuotePB)
+ nMode = DBL_START;
+ else if(pBtn == &aEndQuotePB)
+ nMode = DBL_END;
+ // Zeichenauswahl-Dialog starten
+ SvxCharacterMap* pMap = new SvxCharacterMap( this, TRUE );
+ pMap->SetCharFont( OutputDevice::GetDefaultFont(DEFAULTFONT_LATIN_TEXT,
+ LANGUAGE_ENGLISH_US, DEFAULTFONT_FLAGS_ONLYONE, 0 ));
+ pMap->SetText(nMode < SGL_END ? sStartQuoteDlg : sEndQuoteDlg );
+ sal_UCS4 cDlg;
+ //The two lines below are added by BerryJia for Bug95846 Time:2002-8-13 15:50
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ LanguageType eLang = Application::GetSettings().GetLanguage();
+ switch( nMode )
+ {
+ case SGL_START:
+ cDlg = cSglStartQuote;
+ if(cDlg == 0)
+ cDlg = pAutoCorrect->GetQuote('\'',TRUE,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50
+ break;
+ case SGL_END:
+ cDlg = cSglEndQuote;
+ if(cDlg == 0)
+ cDlg = pAutoCorrect->GetQuote('\'',FALSE,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50
+ break;
+ case DBL_START:
+ cDlg = cStartQuote;
+ if(cDlg == 0)
+ cDlg = pAutoCorrect->GetQuote('\"',TRUE,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50
+ break;
+ case DBL_END:
+ cDlg = cEndQuote;
+ if(cDlg == 0)
+ cDlg = pAutoCorrect->GetQuote('\"',FALSE,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50
+ break;
+ default:
+ DBG_ERROR("svx::OfaQuoteTabPage::QuoteHdl(), how to initialize cDlg?" );
+ cDlg = 0;
+ break;
+
+ }
+ pMap->SetChar( cDlg );
+ pMap->DisableFontSelection();
+ if(pMap->Execute() == RET_OK)
+ {
+ sal_UCS4 cNewChar = pMap->GetChar();
+ switch( nMode )
+ {
+ case SGL_START:
+ cSglStartQuote = cNewChar;
+ aSglStartExFT.SetText(ChangeStringExt_Impl(cNewChar));
+ break;
+ case SGL_END:
+ cSglEndQuote = cNewChar;
+ aSglEndExFT.SetText(ChangeStringExt_Impl(cNewChar));
+ break;
+ case DBL_START:
+ cStartQuote = cNewChar;
+ aDblStartExFT.SetText(ChangeStringExt_Impl(cNewChar));
+ break;
+ case DBL_END:
+ cEndQuote = cNewChar;
+ aDblEndExFT.SetText(ChangeStringExt_Impl(cNewChar));
+ break;
+ }
+ }
+ delete pMap;
+
+ return 0;
+}
+
+/*-----------------27.06.97 09.55-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( OfaQuoteTabPage, StdQuoteHdl, PushButton*, pBtn )
+{
+ if(pBtn == &aDblStandardPB)
+ {
+ cStartQuote = 0;
+ aDblStartExFT.SetText(ChangeStringExt_Impl(0));
+ cEndQuote = 0;
+ aDblEndExFT.SetText(ChangeStringExt_Impl(0));
+
+ }
+ else
+ {
+ cSglStartQuote = 0;
+ aSglStartExFT.SetText(ChangeStringExt_Impl(0));
+ cSglEndQuote = 0;
+ aSglEndExFT.SetText(ChangeStringExt_Impl(0));
+ }
+ return 0;
+}
+
+// --------------------------------------------------
+
+String OfaQuoteTabPage::ChangeStringExt_Impl( sal_UCS4 cChar )
+{
+ if( !cChar )
+ return sStandard;
+
+ // convert codepoint value to unicode-hex string
+ sal_UCS4 aStrCodes[32] = { 0, ' ', '(', 'U', '+', '0' };
+ aStrCodes[0] = cChar;
+ int nFullLen = 5;
+ int nHexLen = 4;
+ while( (cChar >> (4*nHexLen)) != 0 )
+ ++nHexLen;
+ for( int i = nHexLen; --i >= 0;)
+ {
+ sal_UCS4 cHexDigit = ((cChar >> (4*i)) & 0x0f) + '0';
+ if( cHexDigit > '9' )
+ cHexDigit += 'A' - ('9' + 1);
+ aStrCodes[ nFullLen++ ] = cHexDigit;
+ }
+ aStrCodes[ nFullLen++ ] = ')';
+ // using the new UCS4 constructor
+ rtl::OUString aOUStr( aStrCodes, nFullLen );
+ return aOUStr;
+}
+
+OfaAutoCompleteTabPage::OfaAutoCompleteTabPage( Window* pParent,
+ const SfxItemSet& rSet )
+ : SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCOMPLETE_OPTIONS ), rSet),
+ aCBActiv (this, SVX_RES(CB_ACTIV)),
+ aCBAppendSpace (this, SVX_RES(CB_APPEND_SPACE)),
+ aCBAsTip (this, SVX_RES(CB_AS_TIP)),
+ aCBCollect (this, SVX_RES(CB_COLLECT)),
+ aCBRemoveList (this, SVX_RES(CB_REMOVE_LIST)),
+ aFTExpandKey (this, SVX_RES(FT_EXPAND_KEY)),
+ aDCBExpandKey (this, SVX_RES(DCB_EXPAND_KEY)),
+ aFTMinWordlen (this, SVX_RES(FT_MIN_WORDLEN)),
+ aNFMinWordlen (this, SVX_RES(NF_MIN_WORDLEN)),
+ aFTMaxEntries (this, SVX_RES(FT_MAX_ENTRIES)),
+ aNFMaxEntries (this, SVX_RES(NF_MAX_ENTRIES)),
+ aLBEntries (*this, SVX_RES(LB_ENTRIES)),
+ aPBEntries (this, SVX_RES(PB_ENTRIES)),
+ pAutoCmpltList( 0 ),
+ nAutoCmpltListCnt( 0 )
+{
+ FreeResource();
+
+ // the defined KEYs
+ static const USHORT aKeyCodes[] = {
+ KEY_END,
+ KEY_RETURN,
+ KEY_SPACE,
+ KEY_RIGHT,
+ KEY_TAB,
+ 0
+ };
+
+ for( const USHORT* pKeys = aKeyCodes; *pKeys; ++pKeys )
+ {
+ KeyCode aKCode( *pKeys );
+ USHORT nPos = aDCBExpandKey.InsertEntry( aKCode.GetName() );
+ aDCBExpandKey.SetEntryData( nPos, (void*)(ULONG)*pKeys );
+ if( KEY_RETURN == *pKeys ) // default to RETURN
+ aDCBExpandKey.SelectEntryPos( nPos );
+ }
+
+ aPBEntries.SetClickHdl(LINK(this, OfaAutoCompleteTabPage, DeleteHdl));
+ aCBActiv.SetToggleHdl(LINK(this, OfaAutoCompleteTabPage, CheckHdl));
+ aCBCollect.SetToggleHdl(LINK(this, OfaAutoCompleteTabPage, CheckHdl));
+}
+
+OfaAutoCompleteTabPage::~OfaAutoCompleteTabPage()
+{
+}
+
+SfxTabPage* OfaAutoCompleteTabPage::Create( Window* pParent,
+ const SfxItemSet& rSet)
+{
+ return new OfaAutoCompleteTabPage( pParent, rSet );
+}
+
+BOOL OfaAutoCompleteTabPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bModified = FALSE, bCheck;
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
+ USHORT nVal;
+
+ bCheck = aCBActiv.IsChecked();
+ bModified |= pOpt->bAutoCompleteWords != bCheck;
+ pOpt->bAutoCompleteWords = bCheck;
+ bCheck = aCBCollect.IsChecked();
+ bModified |= pOpt->bAutoCmpltCollectWords != bCheck;
+ pOpt->bAutoCmpltCollectWords = bCheck;
+ bCheck = !aCBRemoveList.IsChecked(); // inverted value!
+ bModified |= pOpt->bAutoCmpltKeepList != bCheck;
+ pOpt->bAutoCmpltKeepList = bCheck;
+ bCheck = aCBAppendSpace.IsChecked();
+ bModified |= pOpt->bAutoCmpltAppendBlanc != bCheck;
+ pOpt->bAutoCmpltAppendBlanc = bCheck;
+ bCheck = aCBAsTip.IsChecked();
+ bModified |= pOpt->bAutoCmpltShowAsTip != bCheck;
+ pOpt->bAutoCmpltShowAsTip = bCheck;
+
+ nVal = (USHORT)aNFMinWordlen.GetValue();
+ bModified |= nVal != pOpt->nAutoCmpltWordLen;
+ pOpt->nAutoCmpltWordLen = nVal;
+
+ nVal = (USHORT)aNFMaxEntries.GetValue();
+ bModified |= nVal != pOpt->nAutoCmpltListLen;
+ pOpt->nAutoCmpltListLen = nVal;
+
+ nVal = aDCBExpandKey.GetSelectEntryPos();
+ if( nVal < aDCBExpandKey.GetEntryCount() )
+ {
+ ULONG nKey = (ULONG)aDCBExpandKey.GetEntryData( nVal );
+ bModified |= nKey != pOpt->nAutoCmpltExpandKey;
+ pOpt->nAutoCmpltExpandKey = (USHORT)nKey;
+ }
+
+ if( pAutoCmpltList && nAutoCmpltListCnt != aLBEntries.GetEntryCount() )
+ {
+ bModified = TRUE;
+ pOpt->pAutoCmpltList = pAutoCmpltList;
+ }
+ if( bModified )
+ {
+ SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+ pCfg->SetModified();
+ pCfg->Commit();
+ }
+ return TRUE;
+}
+
+void OfaAutoCompleteTabPage::Reset( const SfxItemSet& )
+{
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
+
+ aCBActiv.Check( 0 != pOpt->bAutoCompleteWords );
+ aCBCollect.Check( 0 != pOpt->bAutoCmpltCollectWords );
+ aCBRemoveList.Check( !pOpt->bAutoCmpltKeepList ); //inverted value!
+ aCBAppendSpace.Check( 0 != pOpt->bAutoCmpltAppendBlanc );
+ aCBAsTip.Check( 0 != pOpt->bAutoCmpltShowAsTip );
+
+ aNFMinWordlen.SetValue( pOpt->nAutoCmpltWordLen );
+ aNFMaxEntries.SetValue( pOpt->nAutoCmpltListLen );
+
+ // select the specific KeyCode:
+ {
+ ULONG nKey = pOpt->nAutoCmpltExpandKey;
+ for( USHORT n = 0, nCnt = aDCBExpandKey.GetEntryCount(); n < nCnt; ++n )
+ if( nKey == (ULONG)aDCBExpandKey.GetEntryData( n ))
+ {
+ aDCBExpandKey.SelectEntryPos( n );
+ break;
+ }
+ }
+
+ if( pOpt->pAutoCmpltList && pOpt->pAutoCmpltList->Count() )
+ {
+ pAutoCmpltList = (SvStringsISortDtor*)pOpt->pAutoCmpltList;
+ pOpt->pAutoCmpltList = 0;
+ nAutoCmpltListCnt = pAutoCmpltList->Count();
+ for( USHORT n = 0; n < nAutoCmpltListCnt; ++n )
+ {
+ const StringPtr pStr = pAutoCmpltList->GetObject( n );
+ USHORT nPos = aLBEntries.InsertEntry( *pStr );
+ aLBEntries.SetEntryData( nPos, (void*)pStr );
+ }
+ }
+ else
+ {
+ aLBEntries.Disable();
+ aPBEntries.Disable();
+ }
+
+ CheckHdl( &aCBActiv );
+ CheckHdl( &aCBCollect );
+}
+
+void OfaAutoCompleteTabPage::ActivatePage( const SfxItemSet& )
+{
+ ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage( FALSE );
+}
+
+IMPL_LINK( OfaAutoCompleteTabPage, DeleteHdl, PushButton*, EMPTYARG )
+{
+ USHORT nSelCnt = pAutoCmpltList ? aLBEntries.GetSelectEntryCount() : 0;
+ while( nSelCnt )
+ {
+ USHORT nPos = aLBEntries.GetSelectEntryPos( --nSelCnt );
+ const StringPtr pStr = (StringPtr)aLBEntries.GetEntryData( nPos );
+ aLBEntries.RemoveEntry( nPos );
+ nPos = pAutoCmpltList->GetPos( pStr );
+ if( USHRT_MAX != nPos )
+ pAutoCmpltList->Remove( nPos );
+ }
+ return 0;
+}
+
+IMPL_LINK( OfaAutoCompleteTabPage, CheckHdl, CheckBox*, pBox )
+{
+ BOOL bEnable = pBox->IsChecked();
+ if( pBox == &aCBActiv )
+ {
+ aCBAppendSpace.Enable( bEnable );
+ aCBAppendSpace.Enable( bEnable );
+ aCBAsTip.Enable( bEnable );
+ aDCBExpandKey.Enable( bEnable );
+ }
+ else if(&aCBCollect == pBox)
+ aCBRemoveList.Enable( bEnable );
+ return 0;
+}
+
+void OfaAutoCompleteTabPage::CopyToClipboard() const
+{
+ USHORT nSelCnt = aLBEntries.GetSelectEntryCount();
+ if( pAutoCmpltList && nSelCnt )
+ {
+ TransferDataContainer* pCntnr = new TransferDataContainer;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::datatransfer::XTransferable > xRef( pCntnr );
+
+ ByteString sData;
+ const sal_Char* pLineEnd =
+#if defined(UNX)
+ "\012";
+#else
+ "\015\012";
+#endif
+
+ rtl_TextEncoding nEncode = gsl_getSystemTextEncoding();
+
+ for( USHORT n = 0; n < nSelCnt; ++n )
+ {
+ sData += ByteString( aLBEntries.GetSelectEntry( n ), nEncode );
+ sData += pLineEnd;
+ }
+ pCntnr->CopyByteString( SOT_FORMAT_STRING, sData );
+ pCntnr->CopyToClipboard( (Window*)this );
+ }
+}
+
+long OfaAutoCompleteTabPage::AutoCompleteMultiListBox::PreNotify(
+ NotifyEvent& rNEvt )
+{
+ long nHandled = MultiListBox::PreNotify( rNEvt );
+
+ if( !nHandled && EVENT_KEYUP == rNEvt.GetType() )
+ {
+ const KeyCode& rKeyCode = rNEvt.GetKeyEvent()->GetKeyCode();
+ switch( rKeyCode.GetModifier() | rKeyCode.GetCode() )
+ {
+ case KEY_DELETE:
+ rPage.DeleteHdl( 0 );
+ nHandled = 1;
+ break;
+
+ default:
+ if( KEYFUNC_COPY == rKeyCode.GetFunction() )
+ {
+ rPage.CopyToClipboard();
+ nHandled = 1;
+ }
+ break;
+ }
+ }
+ return nHandled;
+}
+
+// class OfaSmartTagOptionsTabPage ---------------------------------------------
+
+OfaSmartTagOptionsTabPage::OfaSmartTagOptionsTabPage( Window* pParent,
+ const SfxItemSet& rSet )
+ : SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_SMARTTAG_OPTIONS ), rSet),
+ m_aMainCB( this, SVX_RES(CB_SMARTTAGS) ),
+ m_aSmartTagTypesLB( this, SVX_RES(LB_SMARTTAGS) ),
+ m_aPropertiesPB( this, SVX_RES(PB_SMARTTAGS) ),
+ m_aTitleFT( this, SVX_RES(FT_SMARTTAGS) )
+{
+ FreeResource();
+
+ // some options for the list box:
+ m_aSmartTagTypesLB.SetWindowBits( m_aSmartTagTypesLB.GetStyle() | WB_HSCROLL | WB_HIDESELECTION );
+ m_aSmartTagTypesLB.SetHighlightRange();
+
+ // set the handlers:
+ m_aMainCB.SetToggleHdl(LINK(this, OfaSmartTagOptionsTabPage, CheckHdl));
+ m_aPropertiesPB.SetClickHdl(LINK(this, OfaSmartTagOptionsTabPage, ClickHdl));
+ m_aSmartTagTypesLB.SetSelectHdl(LINK(this, OfaSmartTagOptionsTabPage, SelectHdl));
+}
+
+OfaSmartTagOptionsTabPage::~OfaSmartTagOptionsTabPage()
+{
+
+}
+
+SfxTabPage* OfaSmartTagOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet)
+{
+ return new OfaSmartTagOptionsTabPage( pParent, rSet );
+}
+
+/** This struct is used to associate list box entries with smart tag data
+*/
+struct ImplSmartTagLBUserData
+{
+ rtl::OUString maSmartTagType;
+ uno::Reference< smarttags::XSmartTagRecognizer > mxRec;
+ sal_Int32 mnSmartTagIdx;
+
+ ImplSmartTagLBUserData( const rtl::OUString& rSmartTagType,
+ uno::Reference< smarttags::XSmartTagRecognizer > xRec,
+ sal_Int32 nSmartTagIdx ) :
+ maSmartTagType( rSmartTagType ),
+ mxRec( xRec ),
+ mnSmartTagIdx( nSmartTagIdx ) {}
+};
+
+/** Clears m_aSmartTagTypesLB
+*/
+void OfaSmartTagOptionsTabPage::ClearListBox()
+{
+ const ULONG nCount = m_aSmartTagTypesLB.GetEntryCount();
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(i);
+ const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData());
+ delete pUserData;
+ }
+
+ m_aSmartTagTypesLB.Clear();
+}
+
+/** Inserts items into m_aSmartTagTypesLB
+*/
+void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr& rSmartTagMgr )
+{
+ // first we have to clear the list box:
+ ClearListBox();
+
+ // fill list box:
+ const sal_uInt32 nNumberOfRecognizers = rSmartTagMgr.NumberOfRecognizers();
+ const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) );
+ std::vector< ActionReference > aActionReferences;
+
+ for ( sal_uInt32 i = 0; i < nNumberOfRecognizers; ++i )
+ {
+ uno::Reference< smarttags::XSmartTagRecognizer > xRec = rSmartTagMgr.GetRecognizer(i);
+
+ const rtl::OUString aName = xRec->getName( aLocale );
+ const rtl::OUString aDesc = xRec->getDescription( aLocale );
+ const sal_Int32 nNumberOfSupportedSmartTags = xRec->getSmartTagCount();
+
+ for ( sal_Int32 j = 0; j < nNumberOfSupportedSmartTags; ++j )
+ {
+ const rtl::OUString aSmartTagType = xRec->getSmartTagName(j);
+ rtl::OUString aSmartTagCaption = rSmartTagMgr.GetSmartTagCaption( aSmartTagType, aLocale );
+
+ if ( !aSmartTagCaption.getLength() )
+ aSmartTagCaption = aSmartTagType;
+
+ const rtl::OUString aLBEntry = aSmartTagCaption +
+ OUString::createFromAscii(" (") +
+ aName +
+ OUString::createFromAscii(")");
+
+ SvLBoxEntry* pEntry = m_aSmartTagTypesLB.SvTreeListBox::InsertEntry( aLBEntry );
+ if ( pEntry )
+ {
+ const bool bCheck = rSmartTagMgr.IsSmartTagTypeEnabled( aSmartTagType );
+ m_aSmartTagTypesLB.SetCheckButtonState( pEntry, bCheck ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED );
+ pEntry->SetUserData(static_cast<void*>(new ImplSmartTagLBUserData( aSmartTagType, xRec, j ) ) );
+ }
+ }
+ }
+}
+
+/** Handler for the push button
+*/
+IMPL_LINK( OfaSmartTagOptionsTabPage, ClickHdl, PushButton*, EMPTYARG )
+{
+ const USHORT nPos = m_aSmartTagTypesLB.GetSelectEntryPos();
+ const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(nPos);
+ const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData());
+ uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec;
+ const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
+
+ const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) );
+ if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) )
+ xRec->displayPropertyPage( nSmartTagIdx, aLocale );
+
+ return 0;
+}
+
+/** Handler for the check box
+*/
+IMPL_LINK( OfaSmartTagOptionsTabPage, CheckHdl, CheckBox*, EMPTYARG )
+{
+ const BOOL bEnable = m_aMainCB.IsChecked();
+ m_aSmartTagTypesLB.Enable( bEnable );
+ m_aSmartTagTypesLB.Invalidate();
+ m_aPropertiesPB.Enable( false );
+
+ // if the controls are currently enabled, we still have to check
+ // if the properties button should be disabled because the currently
+ // seleted smart tag type does not have a properties dialog.
+ // We do this by calling SelectHdl:
+ if ( bEnable )
+ SelectHdl( &m_aSmartTagTypesLB );
+
+ return 0;
+}
+
+/** Handler for the list box
+*/
+IMPL_LINK(OfaSmartTagOptionsTabPage, SelectHdl, SvxCheckListBox*, EMPTYARG)
+{
+ if ( m_aSmartTagTypesLB.GetEntryCount() < 1 )
+ return 0;
+
+ const USHORT nPos = m_aSmartTagTypesLB.GetSelectEntryPos();
+ const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(nPos);
+ const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData());
+ uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec;
+ const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
+
+ const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) );
+ if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) )
+ m_aPropertiesPB.Enable( sal_True );
+ else
+ m_aPropertiesPB.Enable( sal_False );
+
+ return 0;
+}
+
+/** Propagates the current settings to the smart tag manager.
+*/
+BOOL OfaSmartTagOptionsTabPage::FillItemSet( SfxItemSet& )
+{
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
+ SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr;
+
+ // robust!
+ if ( !pSmartTagMgr )
+ return FALSE;
+
+ BOOL bModifiedSmartTagTypes = FALSE;
+ std::vector< rtl::OUString > aDisabledSmartTagTypes;
+
+ const ULONG nCount = m_aSmartTagTypesLB.GetEntryCount();
+
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(i);
+ const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData());
+ const BOOL bChecked = m_aSmartTagTypesLB.IsChecked(i);
+ const BOOL bIsCurrentlyEnabled = pSmartTagMgr->IsSmartTagTypeEnabled( pUserData->maSmartTagType );
+
+ bModifiedSmartTagTypes = bModifiedSmartTagTypes || ( !bChecked != !bIsCurrentlyEnabled );
+
+ if ( !bChecked )
+ aDisabledSmartTagTypes.push_back( pUserData->maSmartTagType );
+
+ delete pUserData;
+ }
+
+ const BOOL bModifiedRecognize = ( !m_aMainCB.IsChecked() != !pSmartTagMgr->IsLabelTextWithSmartTags() );
+ if ( bModifiedSmartTagTypes || bModifiedRecognize )
+ {
+ bool bLabelTextWithSmartTags = m_aMainCB.IsChecked() ? true : false;
+ pSmartTagMgr->WriteConfiguration( bModifiedRecognize ? &bLabelTextWithSmartTags : 0,
+ bModifiedSmartTagTypes ? &aDisabledSmartTagTypes : 0 );
+ }
+
+ return TRUE;
+}
+
+/** Sets the controls based on the current settings at SmartTagMgr.
+*/
+void OfaSmartTagOptionsTabPage::Reset( const SfxItemSet& )
+{
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
+ const SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr;
+
+ // robust, should not happen!
+ if ( !pSmartTagMgr )
+ return;
+
+ FillListBox( *pSmartTagMgr );
+ m_aSmartTagTypesLB.SelectEntryPos( 0 );
+ m_aMainCB.Check( pSmartTagMgr->IsLabelTextWithSmartTags() );
+ CheckHdl( &m_aMainCB );
+}
+
+void OfaSmartTagOptionsTabPage::ActivatePage( const SfxItemSet& )
+{
+ ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage( FALSE );
+}
+
diff --git a/cui/source/tabpages/autocdlg.hrc b/cui/source/tabpages/autocdlg.hrc
new file mode 100644
index 000000000000..6a698b4397d7
--- /dev/null
+++ b/cui/source/tabpages/autocdlg.hrc
@@ -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: autocdlg.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_AUTOCDLG_HRC
+#define _SVX_AUTOCDLG_HRC
+
+#include <svx/dialogs.hrc>
+
+// defines ------------------------------------------------------------------
+
+#define CLB_SETTINGS 1
+/*
+#define STR_DOUBLECAPS 3
+#define STR_STARTCAPS 4
+#define STR_FIRST 5
+#define STR_HALF 6
+#define STR_DASH 7
+#define STR_BOLDUNDERLINE 8
+#define STR_URL 9
+*/
+
+#define CB_TYPO 11
+#define FT_STARTQUOTE 12
+#define PB_STARTQUOTE 13
+#define FT_ENDQUOTE 14
+#define PB_ENDQUOTE 15
+
+#define FL_ABBREV 16
+#define ED_ABBREV 17
+#define LB_ABBREV 18
+#define PB_NEWABBREV 19
+#define PB_DELABBREV 20
+#define FL_DOUBLECAPS 21
+#define ED_DOUBLE_CAPS 22
+#define LB_DOUBLE_CAPS 23
+#define PB_NEWDOUBLECAPS 24
+#define PB_DELDOUBLECAPS 25
+
+#define ED_SHORT 31
+#define ED_REPLACE 32
+#define TLB_REPLACE 33
+#define CB_TEXT_ONLY 34
+#define PB_NEW_REPLACE 35
+#define PB_DELETE_REPLACE 36
+#define STR_MODIFY 37
+#define STR_CLOSE_AUTOCORR 38
+#define FT_SHORT 39
+#define FT_REPLACE 40
+#define STR_CHANGE_START 41
+#define STR_CHANGE_END 42
+#define CB_AUTOABBREV 43
+#define CB_AUTOCAPS 44
+
+#define FT_SGL_STARTQUOTE 45
+#define PB_SGL_STARTQUOTE 46
+#define FT_SGL_ENDQUOTE 47
+#define PB_SGL_ENDQUOTE 48
+#define PB_SGL_STD 49
+#define PB_DBL_STD 50
+#define FL_SINGLE 51
+#define FL_DOUBLE 52
+#define FT_SGSTEX 53
+#define FT_SGENEX 54
+#define FT_DBSTEX 55
+#define FT_DBECEX 56
+#define CB_SGL_TYPO 57
+#define ST_STANDARD 58
+
+#define PB_EDIT 61
+#define ST_DEL_EMPTY_PARA 62
+#define ST_TYPO 66
+#define ST_USER_STYLE 67
+#define ST_BULLET 68
+#define STR_DEL_SPACES_AT_STT_END 69
+#define STR_DEL_SPACES_BETWEEN_LINES 70
+
+#define ST_RIGHT_MARGIN 74
+#define STR_NUM 75
+#define STR_BORDER 76
+#define STR_TABLE 77
+#define STR_REPLACE_TEMPLATES 78
+#define FL_PRCNT 79
+
+#define STR_HEADER 90
+#define FT_HEADER_EXPLANATION 91
+#define STR_HEADER1 92
+#define STR_HEADER2 93
+#define FT_HEADER1_EXPLANATION 94
+#define FT_HEADER2_EXPLANATION 95
+
+#define ED_RIGHT_MARGIN 100
+#define BT_OK 101
+#define BT_CANCEL 102
+
+#define BT_AWCP_OK 110
+#define BT_AWCP_CANCEL 111
+#define GB_AWCP_VALUE 112
+#define ED_AWCP_WORD_LEN 113
+#define ED_AWCP_LIST_LEN 114
+#define FT_AWCP_WORD_LEN 115
+#define FT_AWCP_LIST_LEN 116
+
+#define CB_ACTIV 121
+#define CB_COLLECT 122
+#define CB_APPEND_SPACE 123
+#define CB_REMOVE_LIST 124
+#define CB_AS_TIP 125
+#define FT_MIN_WORDLEN 126
+#define FT_MAX_ENTRIES 127
+#define NF_MIN_WORDLEN 128
+#define NF_MAX_ENTRIES 129
+#define FT_EXPAND_KEY 130
+#define DCB_EXPAND_KEY 131
+#define LB_ENTRIES 132
+#define PB_ENTRIES 133
+
+
+#define ST_USE_REPLACE 200
+#define ST_CPTL_STT_WORD 201
+#define ST_CPTL_STT_SENT 202
+#define ST_BOLD_UNDER 203
+#define STR_NO_DBL_SPACES 204
+#define ST_DETECT_URL 205
+#define ST_ORDINAL 206
+#define ST_FRACTION 207
+#define ST_DASH 208
+#define FT_LANG 209
+#define LB_LANG 210
+
+#define CB_SMARTTAGS 220
+#define FT_SMARTTAGS 221
+#define LB_SMARTTAGS 222
+#define PB_SMARTTAGS 223
+
+#endif
+
diff --git a/cui/source/tabpages/autocdlg.src b/cui/source/tabpages/autocdlg.src
new file mode 100644
index 000000000000..a087bd7d59dc
--- /dev/null
+++ b/cui/source/tabpages/autocdlg.src
@@ -0,0 +1,856 @@
+/*************************************************************************
+ *
+ * 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: autocdlg.src,v $
+ * $Revision: 1.14 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/svxids.hrc>
+#include "autocdlg.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+ // pragma -------------------------------------------------------------------
+/**************************************************************************/
+/* */
+/* TabDialog RID_OFA_AUTOCORR_DLG */
+/* */
+/**************************************************************************/
+TabDialog RID_OFA_AUTOCORR_DLG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "AutoCorrect" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ SVLook = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_OFAPAGE_AUTOCORR_REPLACE ;
+ Text [ en-US ] = "Replace" ;
+ };
+ PageItem
+ {
+ Identifier = RID_OFAPAGE_AUTOCORR_EXCEPT ;
+ Text [ en-US ] = "Exceptions" ;
+ };
+ PageItem
+ {
+ Identifier = RID_OFAPAGE_AUTOCORR_OPTIONS ;
+ Text [ en-US ] = "Options" ;
+ };
+ PageItem
+ {
+ Identifier = RID_OFAPAGE_AUTOFMT_APPLY ;
+ Text [ en-US ] = "Options" ;
+ };
+ PageItem
+ {
+ Identifier = RID_OFAPAGE_AUTOCORR_QUOTE ;
+ Text [ en-US ] = "Custom Quotes" ;
+ };
+ PageItem
+ {
+ Identifier = RID_OFAPAGE_AUTOCOMPLETE_OPTIONS ;
+ Text [ en-US ] = "Word Completion";
+ };
+ PageItem
+ {
+ Identifier = RID_OFAPAGE_SMARTTAG_OPTIONS ;
+ Text [ en-US ] = "Smart Tags";
+ };
+ };
+ };
+ FixedText FT_LANG
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 140 , 8 ) ;
+
+ Left = TRUE ;
+ Text [ en-US ] = "Replacements and exceptions for language:";
+ };
+ ListBox LB_LANG
+ {
+ Pos = MAP_APPFONT ( 150 , 3 ) ;
+ Size = MAP_APPFONT ( 60 , 100 ) ;
+ DropDown = TRUE;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+};
+#define COMMON_CLB_ENTRIES \
+ String ST_USE_REPLACE \
+ { \
+ Text [ en-US ] = "Use replacement table" ; \
+ }; \
+ String ST_CPTL_STT_WORD \
+ { \
+ Text [ en-US ] = "Correct TWo INitial CApitals" ; \
+ }; \
+ String ST_CPTL_STT_SENT \
+ { \
+ Text [ en-US ] = "Capitalize first letter of every sentence" ; \
+ }; \
+ String ST_BOLD_UNDER \
+ { \
+ Text [ en-US ] = "Automatic *bold* and _underline_" ; \
+ }; \
+ String STR_NO_DBL_SPACES \
+ { \
+ Text [ en-US ] = "Ignore double spaces" ; \
+ }; \
+ String ST_DETECT_URL \
+ { \
+ Text [ en-US ] = "URL Recognition" ; \
+ }; \
+ String ST_ORDINAL \
+ { \
+ Text [ en-US ] = "Replace 1st... with 1^st..." ; \
+ }; \
+ String ST_FRACTION \
+ { \
+ Text [ en-US ] = "Replace 1/2 ... with ½ ..." ; \
+ }; \
+ String ST_DASH \
+ { \
+ Text [ en-US ] = "Replace dashes" ; \
+ };
+
+/**************************************************************************/
+/* */
+/* Beschreibung: Autokorrektur-Optionen */
+/* */
+/**************************************************************************/
+TabPage RID_OFAPAGE_AUTOCORR_OPTIONS
+{
+ HelpId = HID_OFAPAGE_AUTOCORR_OPTIONS ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Settings" ;
+ Control CLB_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 248 , 173 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ COMMON_CLB_ENTRIES
+};
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+TabPage RID_OFAPAGE_AUTOFMT_APPLY
+{
+ HelpID = HID_OFAPAGE_AUTOFMT_OPTIONS ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Control CLB_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 248 , 149 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_EDIT
+ {
+ Pos = MAP_APPFONT ( 6 , 162 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Edit..." ;
+ TabStop = TRUE ;
+ };
+ String STR_HEADER1
+ {
+ Text [ en-US ] = "[M]" ;
+ };
+ String STR_HEADER2
+ {
+ Text [ en-US ] = "[T]" ;
+ };
+ FixedText FT_HEADER1_EXPLANATION
+ {
+ Pos = MAP_APPFONT ( 80 , 159 ) ;
+ Size = MAP_APPFONT ( 174 , 8 ) ;
+ Text [ en-US ] = "[M]: Replace while modifying existing text" ;
+ };
+ FixedText FT_HEADER2_EXPLANATION
+ {
+ Pos = MAP_APPFONT ( 80 , 171 ) ;
+ Size = MAP_APPFONT ( 174 , 8 ) ;
+ Text [ en-US ] = "[T]: AutoFormat/AutoCorrect while typing" ;
+ };
+ COMMON_CLB_ENTRIES
+ String ST_DEL_EMPTY_PARA
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Leere Absätze entfernen : Leere Absõtze entfernen */
+ Text [ en-US ] = "Remove blank paragraphs" ;
+ };
+ String ST_TYPO
+ {
+ Text [ en-US ] = "Replace \"standard\" quotes with %1custom%2 quotes" ;
+ };
+ String ST_USER_STYLE
+ {
+ Text [ en-US ] = "Replace Custom Styles" ;
+ };
+ String ST_BULLET
+ {
+ Text [ en-US ] = "Replace bullets with: " ;
+ };
+ String ST_RIGHT_MARGIN
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Zusammenfassen von einzeiligen Absätzen ab : Zusammenfassen von einzeiligen Absõtzen ab */
+ // Text [ norwegian_wrong ] = "+++Combine single line paragraphs at" ;
+ // Text [ swedish_wrong ] = ~Kombinera enradiga stycken B738vid " ;
+ Text [ en-US ] = "Combine single line paragraphs if length greater than" ;
+ };
+ String STR_NUM
+ {
+ Text [ en-US ] = "Apply numbering - symbol: " ;
+ };
+ String STR_BORDER
+ {
+ Text [ en-US ] = "Apply border" ;
+ };
+ String STR_TABLE
+ {
+ Text [ en-US ] = "Create table" ;
+ };
+ String STR_REPLACE_TEMPLATES
+ {
+ Text [ en-US ] = "Apply Styles" ;
+ };
+ String STR_DEL_SPACES_AT_STT_END
+ {
+ Text [ en-US ] = "Delete spaces and tabs at beginning and end of paragraph";
+ };
+ String STR_DEL_SPACES_BETWEEN_LINES
+ {
+ Text [ en-US ] = "Delete spaces and tabs at end and start of line";
+ };
+};
+
+ModalDialog RID_OFADLG_PRCNT_SET
+{
+ HelpID = SID_AUTOFORMAT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 155 , 43 ) ;
+ Moveable = TRUE ;
+ FixedLine FL_PRCNT
+ {
+ Pos = MAP_APPFONT ( 4 , 3 ) ;
+ Size = MAP_APPFONT ( 87 , 8 ) ;
+ Text [ en-US ] = "Minimum size" ;
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 99 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 99 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ MetricField ED_RIGHT_MARGIN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 7 , 14 ) ;
+ Size = MAP_APPFONT ( 31 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ Value = 77 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ First = 10 ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ Text [ en-US ] = "Combine" ;
+};
+
+/**************************************************************************/
+/* */
+/* Beschreibung: Ersetzungstabelle */
+/* */
+/**************************************************************************/
+TabPage RID_OFAPAGE_AUTOCORR_REPLACE
+{
+ HelpId = HID_OFAPAGE_AUTOCORR_REPLACE ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ FixedText FT_SHORT
+ {
+ Pos = MAP_APPFONT ( 7 , 3 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Repla~ce" ;
+ Left = TRUE ;
+ };
+ Edit ED_SHORT
+ {
+ Pos = MAP_APPFONT ( 7 , 13 ) ;
+ Size = MAP_APPFONT ( 60 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_REPLACE
+ {
+ Pos = MAP_APPFONT ( 71 , 3 ) ;
+ Size = MAP_APPFONT ( 64 , 8 ) ;
+ Text [ en-US ] = "~With:" ;
+ Left = TRUE ;
+ };
+ Edit ED_REPLACE
+ {
+ Pos = MAP_APPFONT ( 71 , 13 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ CheckBox CB_TEXT_ONLY
+ {
+ Pos = MAP_APPFONT ( 140 , 3 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Text only" ;
+ };
+ PushButton PB_NEW_REPLACE
+ {
+ Pos = MAP_APPFONT ( 198 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~New" ;
+ };
+ PushButton PB_DELETE_REPLACE
+ {
+ Pos = MAP_APPFONT ( 198 , 32 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ Control TLB_REPLACE
+ {
+ HelpId = HID_OFACTL_AUTOCORR_REPLACE ;
+ Pos = MAP_APPFONT ( 7 , 29 ) ;
+ Size = MAP_APPFONT ( 187 , 150 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ String STR_MODIFY
+ {
+ Text [ en-US ] = "~Replace" ;
+ };
+};
+/**************************************************************************/
+/* */
+/* Beschreibung: Ausnahmelisten */
+/* */
+/**************************************************************************/
+TabPage RID_OFAPAGE_AUTOCORR_EXCEPT
+{
+ HelpId = HID_OFAPAGE_AUTOCORR_EXCEPT ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ FixedLine FL_ABBREV
+ {
+ Pos = MAP_APPFONT ( 4 , 3 ) ;
+ Size = MAP_APPFONT ( 252 , 8 ) ;
+ Text [ en-US ] = "Abbreviations (no subsequent capital)" ;
+ };
+ Edit ED_ABBREV
+ {
+ Pos = MAP_APPFONT ( 7 , 14 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+ ListBox LB_ABBREV
+ {
+ Pos = MAP_APPFONT ( 7 , 30 ) ;
+ Size = MAP_APPFONT ( 123 , 58 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ SORT = TRUE ;
+ Border = TRUE ;
+ };
+ PushButton PB_NEWABBREV
+ {
+ Pos = MAP_APPFONT ( 198 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ Text [ en-US ] = "~New" ;
+ };
+ PushButton PB_DELABBREV
+ {
+ Pos = MAP_APPFONT ( 198 , 31 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ CheckBox CB_AUTOABBREV
+ {
+ Pos = MAP_APPFONT ( 137 , 78 ) ;
+ Size = MAP_APPFONT ( 111 , 10 ) ;
+ Text [ en-US ] = "~AutoInclude";
+ Text [ en-US ] = "~AutoInclude" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_DOUBLECAPS
+ {
+ Pos = MAP_APPFONT ( 4 , 94 ) ;
+ Size = MAP_APPFONT ( 252 , 8 ) ;
+ Text [ en-US ] = "Words with TWo INitial CApitals" ;
+ };
+ Edit ED_DOUBLE_CAPS
+ {
+ Pos = MAP_APPFONT ( 7 , 105 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+ ListBox LB_DOUBLE_CAPS
+ {
+ Pos = MAP_APPFONT ( 7 , 120 ) ;
+ Size = MAP_APPFONT ( 123 , 59 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ SORT = TRUE ;
+ Border = TRUE ;
+ };
+ PushButton PB_NEWDOUBLECAPS
+ {
+ Pos = MAP_APPFONT ( 198 , 105 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "Ne~w" ;
+ };
+ PushButton PB_DELDOUBLECAPS
+ {
+ Pos = MAP_APPFONT ( 198 , 122 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "Dele~te" ;
+ };
+ CheckBox CB_AUTOCAPS
+ {
+ Pos = MAP_APPFONT ( 137 , 169 ) ;
+ Size = MAP_APPFONT ( 111 , 10 ) ;
+ Text [ en-US ] = "A~utoInclude";
+ Text [ en-US ] = "A~utoInclude" ;
+ };
+};
+/**************************************************************************/
+/* */
+/* Beschreibung: Typografische Anfuehrungszeichen */
+/* */
+/**************************************************************************/
+TabPage RID_OFAPAGE_AUTOCORR_QUOTE
+{
+ HelpId = HID_OFAPAGE_AUTOCORR_QUOTE ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Custom Quotes" ;
+ FixedLine FL_SINGLE
+ {
+ Pos = MAP_APPFONT ( 4 , 3 ) ;
+ Size = MAP_APPFONT ( 252 , 8 ) ;
+ Text [ en-US ] = "Single quotes" ;
+ };
+ Checkbox CB_SGL_TYPO
+ {
+ Pos = MAP_APPFONT ( 7 , 14 ) ;
+ Size = MAP_APPFONT ( 86 , 10 ) ;
+ Text [ en-US ] = "Repla~ce" ;
+ };
+ FixedText FT_SGL_STARTQUOTE
+ {
+ Pos = MAP_APPFONT ( 7 , 30 ) ;
+ Size = MAP_APPFONT ( 86 , 8 ) ;
+ Text [ en-US ] = "~Start quote:" ;
+ };
+ PushButton PB_SGL_STARTQUOTE
+ {
+ Pos = MAP_APPFONT ( 105 , 28 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ Text = "\'" ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_SGSTEX
+ {
+ Pos = MAP_APPFONT ( 124 , 30 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ };
+ FixedText FT_SGL_ENDQUOTE
+ {
+ Pos = MAP_APPFONT ( 7 , 46 ) ;
+ Size = MAP_APPFONT ( 86 , 8 ) ;
+ Text [ en-US ] = "~End quote:" ;
+ };
+ PushButton PB_SGL_ENDQUOTE
+ {
+ Pos = MAP_APPFONT ( 105 , 44 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ Text = "\'" ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_SGENEX
+ {
+ Pos = MAP_APPFONT ( 124 , 46 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ };
+ PushButton PB_SGL_STD
+ {
+ Pos = MAP_APPFONT ( 198 , 63 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Default" ;
+ };
+ FixedLine FL_DOUBLE
+ {
+ Pos = MAP_APPFONT ( 4 , 83 ) ;
+ Size = MAP_APPFONT ( 252 , 8 ) ;
+ Text [ en-US ] = "Double quotes" ;
+ };
+ CheckBox CB_TYPO
+ {
+ Pos = MAP_APPFONT ( 7 , 94 ) ;
+ Size = MAP_APPFONT ( 86 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Repl~ace" ;
+ };
+ FixedText FT_STARTQUOTE
+ {
+ Pos = MAP_APPFONT ( 7 , 110 ) ;
+ Size = MAP_APPFONT ( 86 , 8 ) ;
+ Text [ en-US ] = "Start q~uote:" ;
+ };
+ PushButton PB_STARTQUOTE
+ {
+ Pos = MAP_APPFONT ( 105 , 108 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ Text = "\"" ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_DBSTEX
+ {
+ Pos = MAP_APPFONT ( 124 , 110 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ };
+ FixedText FT_ENDQUOTE
+ {
+ Pos = MAP_APPFONT ( 7 , 126 ) ;
+ Size = MAP_APPFONT ( 86 , 10 ) ;
+ Text [ en-US ] = "E~nd quote:" ;
+ };
+ PushButton PB_ENDQUOTE
+ {
+ Pos = MAP_APPFONT ( 105 , 124 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ Text = "\"" ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_DBECEX
+ {
+ Pos = MAP_APPFONT ( 124 , 126 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ };
+ PushButton PB_DBL_STD
+ {
+ Pos = MAP_APPFONT ( 195 , 143 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "De~fault" ;
+ };
+ String STR_CHANGE_START
+ {
+ Text [ en-US ] = "Start quote" ;
+ };
+ String STR_CHANGE_END
+ {
+ Text [ en-US ] = "End quote" ;
+ };
+ String ST_STANDARD
+ {
+ Text [ en-US ] = "Default" ;
+ };
+};
+
+/**************************************************************************/
+/* */
+/* Beschreibung: automatische Wortergänzung */
+/* */
+/**************************************************************************/
+TabPage RID_OFAPAGE_AUTOCOMPLETE_OPTIONS
+{
+ HelpId = HID_OFAPAGE_AUTOCOMPLETE_OPTIONS ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ CheckBox CB_ACTIV
+ {
+ Pos = MAP_APPFONT( 4, 3 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "Enable word ~completion";
+ };
+ CheckBox CB_APPEND_SPACE
+ {
+ Pos = MAP_APPFONT( 10, 17 );
+ Size = MAP_APPFONT( 110, 10 );
+ Text [ en-US ] = "~Append space";
+ };
+ CheckBox CB_AS_TIP
+ {
+ Pos = MAP_APPFONT( 10, 31 );
+ Size = MAP_APPFONT( 110, 10 );
+ Text [ en-US ] = "~Show as tip";
+ };
+ CheckBox CB_COLLECT
+ {
+ Pos = MAP_APPFONT( 4, 45 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "C~ollect words";
+ };
+ CheckBox CB_REMOVE_LIST
+ {
+ Pos = MAP_APPFONT( 10, 59 );
+ Size = MAP_APPFONT( 110, 40 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "~When closing a document, remove the words collected from it from the list";
+ };
+ FixedText FT_EXPAND_KEY
+ {
+ Pos = MAP_APPFONT( 4, 102 );
+ Size = MAP_APPFONT( 116, 8 );
+ Text [ en-US ] = "Acc~ept with";
+ };
+ ListBox DCB_EXPAND_KEY
+ {
+ Pos = MAP_APPFONT( 4, 113 );
+ Size = MAP_APPFONT( 116, 60 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ Group = TRUE;
+ Sort = FALSE;
+ };
+ FixedText FT_MIN_WORDLEN
+ {
+ Pos = MAP_APPFONT( 4, 129 );
+ Size = MAP_APPFONT( 116, 8 );
+ Text [ en-US ] = "Mi~n. word length";
+ };
+ NumericField NF_MIN_WORDLEN
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 4, 140 );
+ Size = MAP_APPFONT( 30, 12 );
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Value = 10 ;
+ Minimum = 5 ;
+ First = 5 ;
+ Last = 100 ;
+ Maximum = 100 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_MAX_ENTRIES
+ {
+ Pos = MAP_APPFONT( 4, 156 );
+ Size = MAP_APPFONT( 116, 8 );
+ Text [ en-US ] = "~Max. entries";
+ };
+ NumericField NF_MAX_ENTRIES
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 4, 167 );
+ Size = MAP_APPFONT( 30, 12 );
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Value = 500 ;
+ Maximum = 10000;
+ Last = 10000 ;
+ First = 50 ;
+ Minimum = 50;
+ SpinSize = 25 ;
+ };
+ MultiListBox LB_ENTRIES
+ {
+ Pos = MAP_APPFONT( 127, 3 );
+ Size = MAP_APPFONT( 121, 158 );
+ TabStop = TRUE;
+ DropDown = FALSE;
+ Group = TRUE;
+ Border = TRUE;
+ Sort = TRUE;
+ };
+ PushButton PB_ENTRIES
+ {
+ Pos = MAP_APPFONT( 127, 165 );
+ Size = MAP_APPFONT( 121, 14 );
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Delete Entry";
+ };
+ Text [ en-US ] = "Word Completion";
+};
+
+
+/**************************************************************************/
+/* */
+/* Beschreibung: Smart Tag Options */
+/* */
+/**************************************************************************/
+TabPage RID_OFAPAGE_SMARTTAG_OPTIONS
+{
+ HelpId = HID_OFAPAGE_SMARTTAG_OPTIONS ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Smart Tags";
+
+ CheckBox CB_SMARTTAGS
+ {
+ Pos = MAP_APPFONT( 4, 3 );
+ Size = MAP_APPFONT( 116, 10 );
+ Text [ en-US ] = "Label text with smart tags";
+ };
+
+ FixedText FT_SMARTTAGS
+ {
+ Pos = MAP_APPFONT( 12, 15 );
+ Size = MAP_APPFONT( 116, 8 );
+ Text [ en-US ] = "Currently installed smart tags";
+ };
+
+ Control LB_SMARTTAGS
+ {
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 172 , 154 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+
+ PushButton PB_SMARTTAGS
+ {
+ Pos = MAP_APPFONT ( 188 , 25 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "Properties...";
+ };
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
new file mode 100644
index 000000000000..fb3820dd2774
--- /dev/null
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -0,0 +1,1979 @@
+/*************************************************************************
+ *
+ * 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: backgrnd.cxx,v $
+ * $Revision: 1.39 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <unotools/pathoptions.hxx>
+#include <svl/intitem.hxx>
+#include <vcl/msgbox.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfile.hxx>
+#include <svtools/wallitem.hxx>
+#include <svl/cntwall.hxx>
+#include <sfx2/cntids.hrc>
+
+#define _SVX_BACKGRND_CXX
+
+#include <svx/dialogs.hrc>
+#include "backgrnd.hrc"
+#include <svx/svxitems.hrc>
+
+// Tabellenhintergrund
+#define TBL_DEST_CELL 0
+#define TBL_DEST_ROW 1
+#define TBL_DEST_TBL 2
+
+#include <svx/brshitem.hxx>
+#include "backgrnd.hxx"
+
+#include <svx/xtable.hxx>
+#include <svx/opengrf.hxx>
+#include <svx/impgrf.hxx>
+#include <svx/svxerr.hxx>
+#include <svx/drawitem.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/htmlmode.hxx>
+#include <svtools/controldims.hrc>
+#include <svx/svxids.hrc> //CHINA001
+#include <svx/flagsdef.hxx> //CHINA001
+#include <svl/intitem.hxx> //CHINA001
+#include <sfx2/request.hxx> //CHINA001
+using namespace ::com::sun::star;
+// static ----------------------------------------------------------------
+
+static USHORT pRanges[] =
+{
+ SID_VIEW_FLD_PIC, SID_VIEW_FLD_PIC,
+ SID_ATTR_BRUSH, SID_ATTR_BRUSH,
+ SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR,
+ 0
+};
+
+struct SvxBackgroundTable_Impl
+{
+ SvxBrushItem* pCellBrush;
+ SvxBrushItem* pRowBrush;
+ SvxBrushItem* pTableBrush;
+ USHORT nCellWhich;
+ USHORT nRowWhich;
+ USHORT nTableWhich;
+ USHORT nActPos;
+
+ SvxBackgroundTable_Impl() :
+ pCellBrush(NULL), pRowBrush(NULL), pTableBrush(NULL),
+ nCellWhich(0), nRowWhich(0), nTableWhich(0) {}
+};
+
+struct SvxBackgroundPara_Impl
+{
+ SvxBrushItem* pParaBrush;
+ SvxBrushItem* pCharBrush;
+
+ USHORT nActPos;
+
+ SvxBackgroundPara_Impl() :
+ pParaBrush(NULL), pCharBrush(NULL) {}
+};
+
+struct SvxBackgroundPage_Impl
+{
+ Timer* pLoadTimer;
+ BOOL bIsImportDlgInExecute;
+
+ SvxBackgroundPage_Impl() :
+ pLoadTimer(NULL), bIsImportDlgInExecute(FALSE) {}
+};
+/* -----------------------------15.08.2002 12:21------------------------------
+
+ ---------------------------------------------------------------------------*/
+inline BYTE lcl_PercentToTransparency(long nPercent)
+{
+ //0xff must not be returned!
+ return BYTE(nPercent ? (50 + 0xfe * nPercent) / 100 : 0);
+}
+inline BYTE lcl_TransparencyToPercent(BYTE nTrans)
+{
+ return (nTrans * 100 + 127) / 254;
+}
+void lcl_SetTransparency(SvxBrushItem& rBrush, long nTransparency)
+{
+ uno::Any aTransparency;
+ aTransparency <<= (sal_Int8)nTransparency;
+ rBrush.PutValue(aTransparency, MID_GRAPHIC_TRANSPARENCY);
+}
+//-------------------------------------------------------------------------
+
+/* [Beschreibung]
+
+*/
+
+USHORT GetItemId_Impl( ValueSet& rValueSet, const Color& rCol )
+{
+ BOOL bFound = FALSE;
+ USHORT nCount = rValueSet.GetItemCount();
+ USHORT n = 1;
+
+ while ( !bFound && n <= nCount )
+ {
+ Color aValCol = rValueSet.GetItemColor(n);
+
+ bFound = ( aValCol.GetRed() == rCol.GetRed()
+ && aValCol.GetGreen() == rCol.GetGreen()
+ && aValCol.GetBlue() == rCol.GetBlue() );
+
+ if ( !bFound )
+ n++;
+ }
+ return bFound ? n : 0;
+}
+
+// class BackgroundPreview -----------------------------------------------
+
+/* [Beschreibung]
+
+ Vorschaufenster f"ur Brush oder Bitmap
+*/
+
+class BackgroundPreviewImpl : public Window
+{
+public:
+ BackgroundPreviewImpl( Window* pParent,
+ const ResId& rResId, BOOL bIsBmpPreview );
+ ~BackgroundPreviewImpl();
+
+ void NotifyChange( const Color& rColor );
+ void NotifyChange( const Bitmap* pBitmap );
+
+protected:
+ virtual void Paint( const Rectangle& rRect );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ const BOOL bIsBmp;
+ Bitmap* pBitmap;
+ Point aDrawPos;
+ Size aDrawSize;
+ Rectangle aDrawRect;
+ BYTE nTransparency;
+};
+
+//-----------------------------------------------------------------------
+
+BackgroundPreviewImpl::BackgroundPreviewImpl
+(
+ Window* pParent,
+ const ResId& rResId,
+ BOOL bIsBmpPreview
+) :
+
+/* [Beschreibung]
+
+*/
+
+ Window( pParent, rResId ),
+
+ bIsBmp ( bIsBmpPreview ),
+ pBitmap ( NULL ),
+ aDrawRect( Point(0,0), GetOutputSizePixel() ),
+ nTransparency(0)
+
+{
+ SetBorderStyle(WINDOW_BORDER_MONO);
+ Paint( aDrawRect );
+}
+
+//-----------------------------------------------------------------------
+
+BackgroundPreviewImpl::~BackgroundPreviewImpl()
+
+/* [Beschreibung]
+
+*/
+
+{
+ delete pBitmap;
+}
+
+//-----------------------------------------------------------------------
+void BackgroundPreviewImpl::NotifyChange( const Color& rColor )
+{
+ if ( !bIsBmp )
+ {
+ const static Color aTranspCol( COL_TRANSPARENT );
+
+ nTransparency = lcl_TransparencyToPercent( rColor.GetTransparency() );
+
+ SetFillColor( rColor == aTranspCol ? GetSettings().GetStyleSettings().GetFieldColor() : (Color) rColor.GetRGBColor() );
+ Paint( aDrawRect );
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void BackgroundPreviewImpl::NotifyChange( const Bitmap* pNewBitmap )
+/* [Beschreibung]
+
+*/
+
+{
+ if ( bIsBmp && (pNewBitmap || pBitmap) )
+ {
+ if ( pNewBitmap && pBitmap )
+ *pBitmap = *pNewBitmap;
+ else if ( pNewBitmap && !pBitmap )
+ pBitmap = new Bitmap( *pNewBitmap );
+ else if ( !pNewBitmap )
+ DELETEZ( pBitmap );
+
+ if ( pBitmap )
+ {
+ Size aSize = GetOutputSizePixel();
+ // InnerSize == Size without one pixel border
+ Size aInnerSize = aSize;
+ aInnerSize.Width() -= 2;
+ aInnerSize.Height() -= 2;
+ aDrawSize = pBitmap->GetSizePixel();
+
+ // bitmap bigger than preview window?
+ if ( aDrawSize.Width() > aInnerSize.Width() )
+ {
+ aDrawSize.Height() = aDrawSize.Height() * aInnerSize.Width() / aDrawSize.Width();
+ if ( aDrawSize.Height() > aInnerSize.Height() )
+ {
+ aDrawSize.Width() = aDrawSize.Height();
+ aDrawSize.Height() = aInnerSize.Height();
+ }
+ else
+ aDrawSize.Width() = aInnerSize.Width();
+ }
+ else if ( aDrawSize.Height() > aInnerSize.Height() )
+ {
+ aDrawSize.Width() = aDrawSize.Width() * aInnerSize.Height() / aDrawSize.Height();
+ if ( aDrawSize.Width() > aInnerSize.Width() )
+ {
+ aDrawSize.Height() = aDrawSize.Width();
+ aDrawSize.Width() = aInnerSize.Width();
+ }
+ else
+ aDrawSize.Height() = aInnerSize.Height();
+ }
+
+ aDrawPos.X() = (aSize.Width() - aDrawSize.Width()) / 2;
+ aDrawPos.Y() = (aSize.Height() - aDrawSize.Height()) / 2;
+ }
+ Invalidate( aDrawRect );
+ Update();
+ }
+}
+
+//-----------------------------------------------------------------------
+
+void BackgroundPreviewImpl::Paint( const Rectangle& )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SetBackground(Wallpaper(rStyleSettings.GetWindowColor()));
+ SetLineColor();
+ if(bIsBmp)
+ SetFillColor( Color(COL_TRANSPARENT) );
+ DrawRect( aDrawRect );
+ if ( bIsBmp )
+ {
+ if ( pBitmap )
+ DrawBitmap( aDrawPos, aDrawSize, *pBitmap );
+ else
+ {
+ Size aSize = GetOutputSizePixel();
+ DrawLine( Point(0,0), Point(aSize.Width(),aSize.Height()) );
+ DrawLine( Point(0,aSize.Height()), Point(aSize.Width(),0) );
+ }
+ }
+}
+/* -----------------------------27.02.2002 11:07------------------------------
+
+ ---------------------------------------------------------------------------*/
+void BackgroundPreviewImpl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ Invalidate();
+ }
+ Window::DataChanged( rDCEvt );
+}
+
+// class SvxBackgroundTabPage --------------------------------------------
+
+#define HDL(hdl) LINK(this,SvxBackgroundTabPage,hdl)
+
+SvxBackgroundTabPage::SvxBackgroundTabPage( Window* pParent,
+ const SfxItemSet& rCoreSet ) :
+
+/* [Beschreibung]
+
+*/
+
+ SvxTabPage( pParent, SVX_RES( RID_SVXPAGE_BACKGROUND ), rCoreSet ),
+
+ aBorderWin ( this, SVX_RES(CT_BORDER) ),
+ aBackgroundColorSet ( &aBorderWin, SVX_RES( SET_BGDCOLOR ) ),
+ aBackgroundColorBox ( this, SVX_RES( GB_BGDCOLOR ) ),
+ pPreviewWin1 ( new BackgroundPreviewImpl(
+ this, SVX_RES( WIN_PREVIEW1 ), FALSE ) ),
+ aColTransFT ( this, SVX_RES( FT_COL_TRANS ) ),
+ aColTransMF ( this, SVX_RES( MF_COL_TRANS ) ),
+ aBtnBrowse ( this, SVX_RES( BTN_BROWSE ) ),
+ aBtnLink ( this, SVX_RES( BTN_LINK ) ),
+ aBtnPreview ( this, SVX_RES( BTN_PREVIEW ) ),
+ aFtFile ( this, SVX_RES( FT_FILE ) ),
+ aGbFile ( this, SVX_RES( GB_FILE ) ),
+ aBtnPosition ( this, SVX_RES( BTN_POSITION ) ),
+ aBtnArea ( this, SVX_RES( BTN_AREA ) ),
+ aBtnTile ( this, SVX_RES( BTN_TILE ) ),
+ aWndPosition ( this, SVX_RES( WND_POSITION ), RP_MM ),
+ aGbPosition ( this, SVX_RES( GB_POSITION ) ),
+ aGraphTransFL ( this, SVX_RES( FL_GRAPH_TRANS ) ),
+ aGraphTransMF ( this, SVX_RES( MF_GRAPH_TRANS ) ),
+ pPreviewWin2 ( new BackgroundPreviewImpl(
+ this, SVX_RES( WIN_PREVIEW2 ), TRUE ) ),
+ aSelectTxt ( this, SVX_RES( FT_SELECTOR ) ),
+ aLbSelect ( this, SVX_RES( LB_SELECTOR ) ),
+ aStrBrowse ( SVX_RES( STR_BROWSE ) ),
+ aStrUnlinked ( SVX_RES( STR_UNLINKED ) ),
+ aTblDesc ( this, SVX_RES( FT_TBL_DESC ) ),
+ aTblLBox ( this, SVX_RES( LB_TBL_BOX ) ),
+ aParaLBox ( this, SVX_RES( LB_PARA_BOX ) ),
+ nHtmlMode ( 0 ),
+ bAllowShowSelector ( TRUE ),
+ bIsGraphicValid ( FALSE ),
+ bLinkOnly ( FALSE ),
+ bResized ( FALSE ),
+ bColTransparency ( FALSE ),
+ bGraphTransparency ( FALSE ),
+
+ pPageImpl ( new SvxBackgroundPage_Impl ),
+ pImportDlg ( NULL ),
+ pTableBck_Impl ( NULL ),
+ pParaBck_Impl ( NULL )
+
+{
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ 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 ) ) ) )
+ {
+ nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
+ }
+
+ FillColorValueSets_Impl();
+
+ aBackgroundColorSet.SetSelectHdl( HDL(BackgroundColorHdl_Impl) );
+ FreeResource();
+}
+
+//------------------------------------------------------------------------
+
+SvxBackgroundTabPage::~SvxBackgroundTabPage()
+
+/* [Beschreibung]
+
+*/
+
+{
+ delete pPreviewWin1;
+ delete pPreviewWin2;
+ delete pPageImpl->pLoadTimer;
+ delete pPageImpl;
+ delete pImportDlg;
+
+ if( pTableBck_Impl)
+ {
+ delete pTableBck_Impl->pCellBrush;
+ delete pTableBck_Impl->pRowBrush;
+ delete pTableBck_Impl->pTableBrush;
+ delete pTableBck_Impl;
+ }
+
+ if(pParaBck_Impl)
+ {
+ delete pParaBck_Impl->pParaBrush;
+ delete pParaBck_Impl->pCharBrush;
+ delete pParaBck_Impl;
+ }
+}
+
+//------------------------------------------------------------------------
+
+USHORT* SvxBackgroundTabPage::GetRanges()
+
+/* [Beschreibung]
+
+ gibt den Bereich der Which-Werte zur"uck
+*/
+
+{
+ return pRanges;
+}
+
+//------------------------------------------------------------------------
+
+SfxTabPage* SvxBackgroundTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+
+/* [Beschreibung]
+
+ Create-Methode f"ur den TabDialog
+*/
+
+{
+ return ( new SvxBackgroundTabPage( pParent, rAttrSet ) );
+}
+
+//------------------------------------------------------------------------
+
+void SvxBackgroundTabPage::Reset( const SfxItemSet& rSet )
+
+/* [Beschreibung]
+
+*/
+
+{
+// os: So ein Unsinn! Irgendwo laesst sich so ein Item immer finden,
+// es muss aber im rSet vorhanden sein!
+// const SfxPoolItem* pX = GetOldItem( rSet, SID_VIEW_FLD_PIC );
+// if( pX && pX->ISA(SfxWallpaperItem))
+ if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(GetWhich(SID_VIEW_FLD_PIC), FALSE))
+ {
+ ResetFromWallpaperItem( rSet );
+ return;
+ }
+
+ // Zustand des Vorschau-Buttons durch UserData persistent
+ String aUserData = GetUserData();
+ aBtnPreview.Check( aUserData.Len() && sal_Unicode('1') == aUserData.GetChar( 0 ) );
+
+ // nach Reset kein ShowSelector() mehr aufrufen d"urfen
+ bAllowShowSelector = FALSE;
+
+
+ // Input-BrushItem besorgen und auswerten
+ const SvxBrushItem* pBgdAttr = NULL;
+ USHORT nSlot = SID_ATTR_BRUSH;
+ const SfxPoolItem* pItem;
+ USHORT nDestValue = USHRT_MAX;
+
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_BACKGRND_DESTINATION,
+ FALSE, &pItem ) )
+ {
+ nDestValue = ((const SfxUInt16Item*)pItem)->GetValue();
+ aTblLBox.SelectEntryPos(nDestValue);
+
+ switch ( nDestValue )
+ {
+ case TBL_DEST_CELL:
+ nSlot = SID_ATTR_BRUSH;
+ break;
+ case TBL_DEST_ROW:
+ nSlot = SID_ATTR_BRUSH_ROW;
+ break;
+ case TBL_DEST_TBL:
+ nSlot = SID_ATTR_BRUSH_TABLE;
+ break;
+ }
+ }
+ else if( SFX_ITEM_SET == rSet.GetItemState(
+ SID_PARA_BACKGRND_DESTINATION, FALSE, &pItem ) )
+ {
+ nDestValue = ((const SfxUInt16Item*)pItem)->GetValue();
+ // ist gerade Zeichen aktiviert?
+ USHORT nParaSel = aParaLBox.GetSelectEntryPos();
+ if(1 == nParaSel)
+ {
+ // dann war das ein "Standard" - Aufruf
+ nDestValue = nParaSel;
+ }
+ aParaLBox.SelectEntryPos(nDestValue);
+
+ switch ( nDestValue )
+ {
+ case PARA_DEST_PARA:
+ nSlot = SID_ATTR_BRUSH;
+ break;
+ case PARA_DEST_CHAR:
+ nSlot = SID_ATTR_BRUSH_CHAR;
+ break;
+ }
+ }
+ //#111173# the destination item is missing when the parent style has been changed
+ if(USHRT_MAX == nDestValue && (aParaLBox.IsVisible()||aTblLBox.IsVisible()))
+ nDestValue = 0;
+ USHORT nWhich = GetWhich( nSlot );
+
+ if ( rSet.GetItemState( nWhich, FALSE ) >= SFX_ITEM_AVAILABLE )
+ pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) );
+
+ aBtnTile.Check();
+
+ if ( pBgdAttr )
+ {
+ FillControls_Impl(*pBgdAttr, aUserData);
+ aBgdColor = ( (SvxBrushItem*)pBgdAttr )->GetColor();
+ }
+ else
+ {
+ aSelectTxt.Hide();
+ aLbSelect.Hide();
+ aLbSelect.SelectEntryPos( 0 );
+ ShowColorUI_Impl();
+
+ const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_BRUSH );
+
+ if ( pOld )
+ aBgdColor = ( (SvxBrushItem*)pOld )->GetColor();
+ }
+
+ if ( nDestValue != USHRT_MAX )
+ {
+ if(aTblLBox.IsVisible())
+ {
+ USHORT nValue = aTblLBox.GetSelectEntryPos();
+
+ if ( pTableBck_Impl )
+ {
+ DELETEZ( pTableBck_Impl->pCellBrush);
+ DELETEZ( pTableBck_Impl->pRowBrush);
+ DELETEZ( pTableBck_Impl->pTableBrush);
+ }
+ else
+ pTableBck_Impl = new SvxBackgroundTable_Impl();
+
+ pTableBck_Impl->nActPos = nValue;
+
+ nWhich = GetWhich( SID_ATTR_BRUSH );
+ if ( rSet.GetItemState( nWhich, FALSE ) >= SFX_ITEM_AVAILABLE )
+ {
+ pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) );
+ pTableBck_Impl->pCellBrush = new SvxBrushItem(*pBgdAttr);
+ }
+ pTableBck_Impl->nCellWhich = nWhich;
+
+ if ( rSet.GetItemState( SID_ATTR_BRUSH_ROW, FALSE ) >= SFX_ITEM_AVAILABLE )
+ {
+ pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_ROW ) );
+ pTableBck_Impl->pRowBrush = new SvxBrushItem(*pBgdAttr);
+ }
+ pTableBck_Impl->nRowWhich = SID_ATTR_BRUSH_ROW;
+
+ if ( rSet.GetItemState( SID_ATTR_BRUSH_TABLE, FALSE ) >= SFX_ITEM_AVAILABLE )
+ {
+ pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_TABLE ) );
+ pTableBck_Impl->pTableBrush = new SvxBrushItem(*pBgdAttr);
+ }
+ pTableBck_Impl->nTableWhich = SID_ATTR_BRUSH_TABLE;
+
+ TblDestinationHdl_Impl(&aTblLBox);
+ aTblLBox.SaveValue();
+ }
+ else
+ {
+ USHORT nValue = aParaLBox.GetSelectEntryPos();
+
+ if ( pParaBck_Impl )
+ {
+ delete pParaBck_Impl->pParaBrush;
+ delete pParaBck_Impl->pCharBrush;
+ }
+ else
+ pParaBck_Impl = new SvxBackgroundPara_Impl();
+
+ pParaBck_Impl->nActPos = nValue;
+
+ nWhich = GetWhich( SID_ATTR_BRUSH );
+ if ( rSet.GetItemState( nWhich, FALSE ) >= SFX_ITEM_AVAILABLE )
+ {
+ pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) );
+ pParaBck_Impl->pParaBrush = new SvxBrushItem(*pBgdAttr);
+ }
+
+ nWhich = GetWhich( SID_ATTR_BRUSH_CHAR );
+ SfxItemState eState = rSet.GetItemState( nWhich, TRUE );
+ eState = rSet.GetItemState( nWhich, FALSE );
+ if ( rSet.GetItemState( nWhich, TRUE ) > SFX_ITEM_AVAILABLE )
+ {
+ pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) );
+ pParaBck_Impl->pCharBrush = new SvxBrushItem(*pBgdAttr);
+ }
+ else
+ pParaBck_Impl->pCharBrush = new SvxBrushItem(SID_ATTR_BRUSH_CHAR);
+
+ ParaDestinationHdl_Impl(&aParaLBox);
+ aParaLBox.SaveValue();
+ }
+ }
+ if(!bResized)
+ {
+ if(!aLbSelect.IsVisible() && !aTblLBox.IsVisible() && !aParaLBox.IsVisible())
+ {
+ long nY(LogicToPixel(Point(11,14), MAP_APPFONT).X());
+ long nX(LogicToPixel(Point(11,14), MAP_APPFONT).Y());
+ Point aPos(aBorderWin.GetPosPixel());
+ aPos.X() = nX;
+ aPos.Y() = nY;
+ aBorderWin.SetPosPixel(aPos);
+ aPos = pPreviewWin1->GetPosPixel();
+ aPos.Y() = nY;
+ pPreviewWin1->SetPosPixel(aPos);
+ aBackgroundColorBox.Hide();
+ }
+ }
+}
+
+void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet )
+{
+ ShowSelector();
+
+ // Zustand des Vorschau-Buttons durch UserData persistent
+ String aUserData = GetUserData();
+ aBtnPreview.Check( aUserData.Len() && sal_Unicode('1') == aUserData.GetChar( 0 ) );
+
+ // Input-BrushItem besorgen und auswerten
+ const SvxBrushItem* pBgdAttr = NULL;
+ USHORT nSlot = SID_VIEW_FLD_PIC;
+ USHORT nWhich = GetWhich( nSlot );
+ SvxBrushItem* pTemp = 0;
+ const CntWallpaperItem* pItem = 0;
+
+ if ( rSet.GetItemState( nWhich, FALSE ) >= SFX_ITEM_AVAILABLE )
+ {
+ pItem = (const CntWallpaperItem*)&rSet.Get( nWhich );
+ pTemp = new SvxBrushItem( *pItem, nWhich );
+ pBgdAttr = pTemp;
+ }
+
+ aBtnTile.Check();
+
+ if ( pBgdAttr )
+ {
+ FillControls_Impl(*pBgdAttr, aUserData);
+ // Auch bei Anzeige der Grafik, soll die Brush erhalten bleiben
+ if( aBgdColor != pBgdAttr->GetColor() )
+ {
+ aBgdColor = pBgdAttr->GetColor();
+ USHORT nCol = GetItemId_Impl( aBackgroundColorSet, aBgdColor );
+ aBackgroundColorSet.SelectItem( nCol );
+ pPreviewWin1->NotifyChange( aBgdColor );
+ }
+ }
+ else
+ {
+ aLbSelect.SelectEntryPos( 0 );
+ ShowColorUI_Impl();
+
+ const SfxPoolItem* pOld = GetOldItem( rSet, SID_VIEW_FLD_PIC );
+ if ( pOld )
+ aBgdColor = Color( ((CntWallpaperItem*)pOld)->GetColor() );
+ }
+
+ // We now have always a link to the background
+ bLinkOnly = TRUE;
+ aBtnLink.Check( TRUE );
+ aBtnLink.Show( FALSE );
+// if( !pItem || !pItem->GetWallpaper(FALSE).IsBitmap() )
+// aBtnLink.Check();
+
+ delete pTemp;
+}
+
+
+
+//------------------------------------------------------------------------
+
+void SvxBackgroundTabPage::FillUserData()
+
+/* [Beschreibung]
+
+ Beim Destruieren einer SfxTabPage wird diese virtuelle Methode gerufen,
+ damit die TabPage interne Informationen sichern kann.
+
+ In diesem Fall wird der Zustand des Vorschau-Buttons gesichert.
+*/
+
+{
+ SetUserData( String( aBtnPreview.IsChecked() ? sal_Unicode('1') : sal_Unicode('0') ) );
+}
+
+//------------------------------------------------------------------------
+
+BOOL SvxBackgroundTabPage::FillItemSet( SfxItemSet& rCoreSet )
+
+/* [Beschreibung]
+
+*/
+
+{
+ if ( pPageImpl->pLoadTimer && pPageImpl->pLoadTimer->IsActive() )
+ {
+ pPageImpl->pLoadTimer->Stop();
+ LoadTimerHdl_Impl( pPageImpl->pLoadTimer );
+ }
+// os: So ein Unsinn! Irgendwo laesst sich so ein Item immer finden,
+// es muss aber im rSet vorhanden sein!
+
+// const SfxPoolItem* pX = GetOldItem( rCoreSet, SID_VIEW_FLD_PIC );
+// if( pX && pX->ISA(SfxWallpaperItem))
+ if(SFX_ITEM_AVAILABLE <= rCoreSet.GetItemState(GetWhich(SID_VIEW_FLD_PIC), FALSE))
+ return FillItemSetWithWallpaperItem( rCoreSet, SID_VIEW_FLD_PIC );
+
+ BOOL bModified = FALSE;
+ USHORT nSlot = SID_ATTR_BRUSH;
+
+ if ( aTblLBox.IsVisible() )
+ {
+ switch( aTblLBox.GetSelectEntryPos() )
+ {
+ case TBL_DEST_CELL:
+ nSlot = SID_ATTR_BRUSH;
+ break;
+ case TBL_DEST_ROW:
+ nSlot = SID_ATTR_BRUSH_ROW;
+ break;
+ case TBL_DEST_TBL:
+ nSlot = SID_ATTR_BRUSH_TABLE;
+ break;
+ }
+ }
+ else if(aParaLBox.GetData() == &aParaLBox)
+ {
+ switch(aParaLBox.GetSelectEntryPos())
+ {
+ case PARA_DEST_PARA:
+ nSlot = SID_ATTR_BRUSH;
+ break;
+ case PARA_DEST_CHAR:
+ nSlot = SID_ATTR_BRUSH_CHAR;
+ break;
+ }
+ }
+ USHORT nWhich = GetWhich( nSlot );
+
+ const SfxPoolItem* pOld = GetOldItem( rCoreSet, nSlot );
+ SfxItemState eOldItemState = rCoreSet.GetItemState(nSlot, FALSE);
+ const SfxItemSet& rOldSet = GetItemSet();
+
+ BOOL bGraphTransparencyChanged = bGraphTransparency && (aGraphTransMF.GetText() != aGraphTransMF.GetSavedValue());
+ if ( pOld )
+ {
+ const SvxBrushItem& rOldItem = (const SvxBrushItem&)*pOld;
+ SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos();
+ const BOOL bIsBrush = ( 0 == aLbSelect.GetSelectEntryPos() );
+
+ // transparency has to be set if enabled, the color not already set to "No fill" and
+ if( bColTransparency &&
+ aBgdColor.GetTransparency() < 0xff)
+ {
+ aBgdColor.SetTransparency(lcl_PercentToTransparency(static_cast<long>(aColTransMF.GetValue())));
+ }
+ if ( ( (GPOS_NONE == eOldPos) && bIsBrush )
+ || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap gewechselt?
+ {
+ // Hintergrund-Art wurde nicht gewechselt:
+
+ if ( (GPOS_NONE == eOldPos) || !aLbSelect.IsVisible() )
+ {
+ // Brush-Behandlung:
+ if ( rOldItem.GetColor() != aBgdColor ||
+ (SFX_ITEM_AVAILABLE >= eOldItemState && !aBackgroundColorSet.IsNoSelection()))
+ {
+ bModified = TRUE;
+ rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) );
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ rCoreSet.ClearItem( nWhich );
+ }
+ else
+ {
+ // Bitmap-Behandlung:
+
+ SvxGraphicPosition eNewPos = GetGraphicPosition_Impl();
+ const BOOL bIsLink = aBtnLink.IsChecked();
+ const BOOL bWasLink = (NULL != rOldItem.GetGraphicLink() );
+
+
+ if ( !bIsLink && !bIsGraphicValid )
+ bIsGraphicValid = LoadLinkedGraphic_Impl();
+
+ if ( bGraphTransparencyChanged ||
+ eNewPos != eOldPos
+ || bIsLink != bWasLink
+ || ( bWasLink && *rOldItem.GetGraphicLink()
+ != aBgdGraphicPath )
+ || ( !bWasLink && rOldItem.GetGraphic()->GetBitmap()
+ != aBgdGraphic.GetBitmap() )
+ )
+ {
+ bModified = TRUE;
+
+ SvxBrushItem aTmpBrush(nWhich);
+ if ( bIsLink )
+ {
+ aTmpBrush = SvxBrushItem( aBgdGraphicPath,
+ aBgdGraphicFilter,
+ eNewPos,
+ nWhich );
+ }
+ else
+ aTmpBrush = SvxBrushItem( aBgdGraphic,
+ eNewPos,
+ nWhich );
+ lcl_SetTransparency(aTmpBrush, static_cast<long>(aGraphTransMF.GetValue()));
+
+ rCoreSet.Put(aTmpBrush);
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ rCoreSet.ClearItem( nWhich );
+ }
+ }
+ else // Brush <-> Bitmap gewechselt!
+ {
+ if ( bIsBrush )
+ rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) );
+ else
+ {
+ SvxBrushItem* pTmpBrush = 0;
+ if ( aBtnLink.IsChecked() )
+ {
+ pTmpBrush = new SvxBrushItem( aBgdGraphicPath,
+ aBgdGraphicFilter,
+ GetGraphicPosition_Impl(),
+ nWhich );
+ }
+ else
+ {
+ if ( !bIsGraphicValid )
+ bIsGraphicValid = LoadLinkedGraphic_Impl();
+
+ if ( bIsGraphicValid )
+ pTmpBrush = new SvxBrushItem( aBgdGraphic,
+ GetGraphicPosition_Impl(),
+ nWhich );
+ }
+ if(pTmpBrush)
+ {
+ lcl_SetTransparency(*pTmpBrush, static_cast<long>(aGraphTransMF.GetValue()));
+ rCoreSet.Put(*pTmpBrush);
+ delete pTmpBrush;
+ }
+ }
+ bModified = ( bIsBrush || aBtnLink.IsChecked() || bIsGraphicValid );
+ }
+ }
+ else if ( SID_ATTR_BRUSH_CHAR == nSlot && aBgdColor != Color( COL_WHITE ) )
+ {
+ rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) );
+ bModified = TRUE;
+ }
+
+ if( aTblLBox.IsVisible() )
+ {
+ // Der aktuelle Zustand wurde bereits geputtet
+ if( nSlot != SID_ATTR_BRUSH && pTableBck_Impl->pCellBrush)
+ {
+ const SfxPoolItem* pOldCell =
+ GetOldItem( rCoreSet, SID_ATTR_BRUSH );
+
+ if ( *pTableBck_Impl->pCellBrush != *pOldCell )
+ {
+ rCoreSet.Put( *pTableBck_Impl->pCellBrush );
+ bModified |= TRUE;
+ }
+ }
+
+ if( nSlot != SID_ATTR_BRUSH_ROW && pTableBck_Impl->pRowBrush)
+ {
+ const SfxPoolItem* pOldRow =
+ GetOldItem( rCoreSet, SID_ATTR_BRUSH_ROW );
+
+ if ( *pTableBck_Impl->pRowBrush != *pOldRow )
+ {
+ rCoreSet.Put( *pTableBck_Impl->pRowBrush );
+ bModified |= TRUE;
+ }
+ }
+
+ if( nSlot != SID_ATTR_BRUSH_TABLE && pTableBck_Impl->pTableBrush)
+ {
+ const SfxPoolItem* pOldTable =
+ GetOldItem( rCoreSet, SID_ATTR_BRUSH_TABLE );
+
+ if ( *pTableBck_Impl->pTableBrush != *pOldTable )
+ {
+ rCoreSet.Put( *pTableBck_Impl->pTableBrush );
+ bModified |= TRUE;
+ }
+ }
+
+ if( aTblLBox.GetSavedValue() != aTblLBox.GetSelectEntryPos() )
+ {
+ rCoreSet.Put( SfxUInt16Item( SID_BACKGRND_DESTINATION,
+ aTblLBox.GetSelectEntryPos() ) );
+ bModified |= TRUE;
+ }
+ }
+ else if(aParaLBox.GetData() == &aParaLBox)
+ {
+ // Der aktuelle Zustand wurde bereits geputtet
+ if( nSlot != SID_ATTR_BRUSH && aParaLBox.IsVisible()) // nicht im Suchen-Format-Dialog
+ {
+ const SfxPoolItem* pOldPara =
+ GetOldItem( rCoreSet, SID_ATTR_BRUSH );
+
+ if ( *pParaBck_Impl->pParaBrush != *pOldPara )
+ {
+ rCoreSet.Put( *pParaBck_Impl->pParaBrush );
+ bModified |= TRUE;
+ }
+ }
+
+ if( nSlot != SID_ATTR_BRUSH_CHAR )
+ {
+ const SfxPoolItem* pOldChar =
+ GetOldItem( rCoreSet, SID_ATTR_BRUSH_CHAR );
+ DBG_ASSERT(pParaBck_Impl, "pParaBck_Impl == NULL ?");
+ if ( pOldChar &&
+ //#111173# crash report shows that pParaBck_Impl can be NULL, the cause is unknown
+ pParaBck_Impl &&
+ (*pParaBck_Impl->pCharBrush != *pOldChar ||
+ *pParaBck_Impl->pCharBrush != SvxBrushItem(SID_ATTR_BRUSH_CHAR)))
+ {
+ rCoreSet.Put( *pParaBck_Impl->pCharBrush );
+ bModified |= TRUE;
+ }
+ }
+
+ if( aParaLBox.GetSavedValue() != aParaLBox.GetSelectEntryPos() )
+ {
+ rCoreSet.Put( SfxUInt16Item( SID_BACKGRND_DESTINATION,
+ aParaLBox.GetSelectEntryPos() ) );
+ bModified |= TRUE;
+ }
+ }
+ return bModified;
+}
+
+BOOL SvxBackgroundTabPage::FillItemSetWithWallpaperItem( SfxItemSet& rCoreSet, USHORT nSlot)
+{
+ USHORT nWhich = GetWhich( nSlot );
+ const SfxPoolItem* pOld = GetOldItem( rCoreSet, nSlot );
+ const SfxItemSet& rOldSet = GetItemSet();
+ DBG_ASSERT(pOld,"FillItemSetWithWallpaperItem: Item not found");
+
+ SvxBrushItem rOldItem( (const CntWallpaperItem&)*pOld, nWhich );
+ SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos();
+ const BOOL bIsBrush = ( 0 == aLbSelect.GetSelectEntryPos() );
+ BOOL bModified = FALSE;
+
+ if ( ( (GPOS_NONE == eOldPos) && bIsBrush )
+ || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap gewechselt?
+ {
+ // Hintergrund-Art wurde nicht gewechselt:
+
+ if ( (GPOS_NONE == eOldPos) || !aLbSelect.IsVisible() )
+ {
+ // Brush-Behandlung:
+ if ( rOldItem.GetColor() != aBgdColor )
+ {
+ bModified = TRUE;
+ CntWallpaperItem aItem( nWhich );
+ aItem.SetColor( aBgdColor );
+ rCoreSet.Put( aItem );
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ rCoreSet.ClearItem( nWhich );
+ }
+ else
+ {
+ // Bitmap-Behandlung:
+ SvxGraphicPosition eNewPos = GetGraphicPosition_Impl();
+
+ int bBitmapChanged = ( ( eNewPos != eOldPos ) ||
+ ( *rOldItem.GetGraphicLink() != aBgdGraphicPath ) );
+ int bBrushChanged = ( rOldItem.GetColor() != aBgdColor );
+ if( bBitmapChanged || bBrushChanged )
+ {
+ bModified = TRUE;
+
+ CntWallpaperItem aItem( nWhich );
+ WallpaperStyle eWallStyle = SvxBrushItem::GraphicPos2WallpaperStyle(eNewPos);
+ aItem.SetStyle( sal::static_int_cast< USHORT >( eWallStyle ) );
+ aItem.SetColor( aBgdColor );
+ aItem.SetBitmapURL( aBgdGraphicPath );
+ rCoreSet.Put( aItem );
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ rCoreSet.ClearItem( nWhich );
+ }
+ }
+ else // Brush <-> Bitmap gewechselt!
+ {
+ CntWallpaperItem aItem( nWhich );
+ if ( bIsBrush )
+ {
+ aItem.SetColor( aBgdColor );
+ rCoreSet.Put( aItem );
+ }
+ else
+ {
+ WallpaperStyle eWallStyle =
+ SvxBrushItem::GraphicPos2WallpaperStyle( GetGraphicPosition_Impl() );
+ aItem.SetStyle( sal::static_int_cast< USHORT >( eWallStyle ) );
+ aItem.SetColor( aBgdColor );
+ aItem.SetBitmapURL( aBgdGraphicPath );
+ rCoreSet.Put( aItem );
+ }
+
+ bModified = TRUE;
+ }
+ return bModified;
+}
+
+//-----------------------------------------------------------------------
+
+int SvxBackgroundTabPage::DeactivatePage( SfxItemSet* _pSet )
+
+/* [Beschreibung]
+
+ virtuelle Methode, wird beim Deaktivieren gerufen
+*/
+
+{
+ if ( pPageImpl->bIsImportDlgInExecute )
+ return KEEP_PAGE;
+
+ if ( _pSet )
+ FillItemSet( *_pSet );
+
+ return LEAVE_PAGE;
+}
+
+//-----------------------------------------------------------------------
+
+void SvxBackgroundTabPage::PointChanged( Window* , RECT_POINT )
+
+/* [Beschreibung]
+
+*/
+
+{
+ // muss implementiert werden, damit Position-Control funktioniert
+}
+
+//-----------------------------------------------------------------------
+
+void SvxBackgroundTabPage::ShowSelector()
+
+/* [Beschreibung]
+
+*/
+
+{
+ if( bAllowShowSelector)
+ {
+ aSelectTxt.Show();
+ aLbSelect.Show();
+ aLbSelect.SetSelectHdl( HDL(SelectHdl_Impl) );
+ aBtnLink.SetClickHdl( HDL(FileClickHdl_Impl) );
+ aBtnPreview.SetClickHdl( HDL(FileClickHdl_Impl) );
+ aBtnBrowse.SetClickHdl( HDL(BrowseHdl_Impl) );
+ aBtnArea.SetClickHdl( HDL(RadioClickHdl_Impl) );
+ aBtnTile.SetClickHdl( HDL(RadioClickHdl_Impl) );
+ aBtnPosition.SetClickHdl( HDL(RadioClickHdl_Impl) );
+
+ // Verz"ogertes Laden "uber Timer (wg. UI-Update)
+ pPageImpl->pLoadTimer = new Timer;
+ pPageImpl->pLoadTimer->SetTimeout( 500 ); // 500ms verz"ogern
+ pPageImpl->pLoadTimer->SetTimeoutHdl(
+ LINK( this, SvxBackgroundTabPage, LoadTimerHdl_Impl ) );
+
+ bAllowShowSelector = FALSE;
+
+ if(nHtmlMode & HTMLMODE_ON)
+ {
+ if(!(nHtmlMode & HTMLMODE_GRAPH_POS))
+ aBtnPosition.Enable(FALSE);
+ aBtnArea.Enable(FALSE);
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+
+void SvxBackgroundTabPage::RaiseLoadError_Impl()
+
+/* [Beschreibung]
+
+*/
+
+{
+ SfxErrorContext aContext( ERRCTX_SVX_BACKGROUND,
+ String(),
+ this,
+ RID_SVXERRCTX,
+ &DIALOG_MGR() );
+
+ ErrorHandler::HandleError(
+ *new StringErrorInfo( ERRCODE_SVX_GRAPHIC_NOTREADABLE,
+ aBgdGraphicPath ) );
+}
+
+//------------------------------------------------------------------------
+
+BOOL SvxBackgroundTabPage::LoadLinkedGraphic_Impl()
+
+/* [Beschreibung]
+
+*/
+
+{
+ BOOL bResult = ( aBgdGraphicPath.Len() > 0 ) &&
+ ( GRFILTER_OK == LoadGraphic( aBgdGraphicPath,
+ aBgdGraphicFilter,
+ aBgdGraphic ) );
+ return bResult;
+}
+
+//------------------------------------------------------------------------
+
+
+void SvxBackgroundTabPage::FillColorValueSets_Impl()
+
+/* [Beschreibung]
+
+ F"ullen des Farb-Sets
+*/
+
+{
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ const SfxPoolItem* pItem = NULL;
+ XColorTable* pColorTable = NULL;
+ const Size aSize15x15 = Size( 15, 15 );
+ FASTBOOL bOwn = FALSE;
+
+ if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) )
+ pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
+
+ if ( !pColorTable )
+ {
+ bOwn = TRUE;
+ pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+ }
+
+ if ( pColorTable )
+ {
+ short i = 0;
+ long nCount = pColorTable->Count();
+ XColorEntry* pEntry = NULL;
+ Color aColWhite( COL_WHITE );
+ String aStrWhite( SVX_RES( RID_SVXITEMS_COLOR_WHITE ) );
+ WinBits nBits = ( aBackgroundColorSet.GetStyle() | WB_ITEMBORDER | WB_NAMEFIELD | WB_NONEFIELD );
+ aBackgroundColorSet.SetText( String( SVX_RES( RID_SVXSTR_TRANSPARENT ) ) );
+ aBackgroundColorSet.SetStyle( nBits );
+ for ( i = 0; i < nCount; i++ )
+ {
+ pEntry = pColorTable->GetColor(i);
+ aBackgroundColorSet.InsertItem( i + 1, pEntry->GetColor(), pEntry->GetName() );
+ }
+
+ while ( i < 80 )
+ {
+ aBackgroundColorSet.InsertItem( i + 1, aColWhite, aStrWhite );
+ i++;
+ }
+
+ if ( nCount > 80 )
+ {
+ aBackgroundColorSet.SetStyle( nBits | WB_VSCROLL );
+ }
+ }
+
+ if ( bOwn )
+ delete pColorTable;
+
+ aBackgroundColorSet.SetColCount( 10 );
+ aBackgroundColorSet.SetLineCount( 10 );
+ aBackgroundColorSet.CalcWindowSizePixel( aSize15x15 );
+
+}
+
+//------------------------------------------------------------------------
+
+
+
+//------------------------------------------------------------------------
+
+void SvxBackgroundTabPage::ShowColorUI_Impl()
+
+/* [Beschreibung]
+
+ Die Controls f"ur das Einstellen der Grafik ausblenden und die
+ Controls f"ur die Farbeinstellung einblenden.
+*/
+
+{
+ if( !aBackgroundColorSet.IsVisible() )
+ {
+ aBackgroundColorSet.Show();
+ aBackgroundColorBox.Show();
+ aBorderWin.Show();
+ pPreviewWin1->Show();
+ aBtnBrowse.Hide();
+ aFtFile.Hide();
+ aBtnLink.Hide();
+ aBtnPreview.Hide();
+ aGbFile.Hide();
+ aBtnPosition.Hide();
+ aBtnArea.Hide();
+ aBtnTile.Hide();
+ aWndPosition.Hide();
+ aGbPosition.Hide();
+ pPreviewWin2->Hide();
+ aGraphTransFL.Show(FALSE);
+ aGraphTransMF.Show(FALSE);
+ if(bColTransparency)
+ {
+ aColTransFT.Show();
+ aColTransMF.Show();
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxBackgroundTabPage::ShowBitmapUI_Impl()
+
+/* [Beschreibung]
+
+ Die Controls f"ur die Farbeinstellung ausblenden und die
+ Controls f"ur das Einstellen der Grafik einblenden.
+*/
+
+{
+ if ( aLbSelect.IsVisible() &&
+ (
+ aBackgroundColorSet.IsVisible()
+ || !aBtnBrowse.IsVisible() ) )
+ {
+ aBackgroundColorSet.Hide();
+ aBackgroundColorBox.Hide();
+ aBorderWin.Hide();
+ pPreviewWin1->Hide();
+ aBtnBrowse.Show();
+ aFtFile.Show();
+
+ if ( !bLinkOnly && ! nHtmlMode & HTMLMODE_ON )
+ aBtnLink.Show();
+ aBtnPreview.Show();
+ aGbFile.Show();
+ aBtnPosition.Show();
+ aBtnArea.Show();
+ aBtnTile.Show();
+ aWndPosition.Show();
+ aGbPosition.Show();
+ pPreviewWin2->Show();
+ if(bGraphTransparency)
+ {
+ aGraphTransFL.Show();
+ aGraphTransMF.Show();
+ }
+ aColTransFT.Show(FALSE);
+ aColTransMF.Show(FALSE);
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxBackgroundTabPage::SetGraphicPosition_Impl( SvxGraphicPosition ePos )
+
+/* [Beschreibung]
+
+ Die Controls f"ur die Grafikposition einstellen.
+*/
+
+{
+ switch ( ePos )
+ {
+ case GPOS_AREA:
+ {
+ aBtnArea.Check();
+ aWndPosition.Disable();
+ }
+ break;
+
+ case GPOS_TILED:
+ {
+ aBtnTile.Check();
+ aWndPosition.Disable();
+ }
+ break;
+
+ default:
+ {
+ aBtnPosition.Check();
+ aWndPosition.Enable();
+ RECT_POINT eNewPos = RP_MM;
+
+ switch ( ePos )
+ {
+ case GPOS_MM: break;
+ case GPOS_LT: eNewPos = RP_LT; break;
+ case GPOS_MT: eNewPos = RP_MT; break;
+ case GPOS_RT: eNewPos = RP_RT; break;
+ case GPOS_LM: eNewPos = RP_LM; break;
+ case GPOS_RM: eNewPos = RP_RM; break;
+ case GPOS_LB: eNewPos = RP_LB; break;
+ case GPOS_MB: eNewPos = RP_MB; break;
+ case GPOS_RB: eNewPos = RP_RB; break;
+ default: ;//prevent warning
+ }
+ aWndPosition.SetActualRP( eNewPos );
+ }
+ break;
+ }
+ aWndPosition.Invalidate();
+}
+
+//------------------------------------------------------------------------
+
+SvxGraphicPosition SvxBackgroundTabPage::GetGraphicPosition_Impl()
+
+/* [Beschreibung]
+
+ Die Position der Grafik zur"uckgeben.
+*/
+
+{
+ if ( aBtnTile.IsChecked() )
+ return GPOS_TILED;
+ else if ( aBtnArea.IsChecked() )
+ return GPOS_AREA;
+ else
+ {
+ switch ( aWndPosition.GetActualRP() )
+ {
+ case RP_LT: return GPOS_LT;
+ case RP_MT: return GPOS_MT;
+ case RP_RT: return GPOS_RT;
+ case RP_LM: return GPOS_LM;
+ case RP_MM: return GPOS_MM;
+ case RP_RM: return GPOS_RM;
+ case RP_LB: return GPOS_LB;
+ case RP_MB: return GPOS_MB;
+ case RP_RB: return GPOS_RB;
+ }
+ }
+ return GPOS_MM;
+}
+
+//-----------------------------------------------------------------------
+// Handler
+//-----------------------------------------------------------------------
+
+IMPL_LINK( SvxBackgroundTabPage, BackgroundColorHdl_Impl, ValueSet*, EMPTYARG )
+/*
+ Handler, called when color selection is changed
+*/
+{
+ USHORT nItemId = aBackgroundColorSet.GetSelectItemId();
+ Color aColor = nItemId ? ( aBackgroundColorSet.GetItemColor( nItemId ) ) : Color( COL_TRANSPARENT );
+ aBgdColor = aColor;
+ pPreviewWin1->NotifyChange( aBgdColor );
+ BOOL bEnableTransp = aBgdColor.GetTransparency() < 0xff;
+ aColTransFT.Enable(bEnableTransp);
+ aColTransMF.Enable(bEnableTransp);
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxBackgroundTabPage, SelectHdl_Impl, ListBox*, EMPTYARG )
+
+/* [Beschreibung]
+
+*/
+
+{
+ if ( 0 == aLbSelect.GetSelectEntryPos() )
+ {
+ ShowColorUI_Impl();
+ aParaLBox.Enable(); // Zeichenhintergrund kann keine Bitmap sein
+ }
+ else
+ {
+ ShowBitmapUI_Impl();
+ aParaLBox.Enable(FALSE);// Zeichenhintergrund kann keine Bitmap sein
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxBackgroundTabPage, FileClickHdl_Impl, CheckBox*, pBox )
+
+/* [Beschreibung]
+
+*/
+
+{
+ if ( &aBtnLink == pBox )
+ {
+ if ( aBtnLink.IsChecked() )
+ {
+ INetURLObject aObj( aBgdGraphicPath );
+ String aFilePath;
+ if ( aObj.GetProtocol() == INET_PROT_FILE )
+ aFilePath = aObj.getFSysPath( INetURLObject::FSYS_DETECT );
+ else
+ aFilePath = aBgdGraphicPath;
+ aFtFile.SetText( aFilePath );
+ }
+ else
+ aFtFile.SetText( aStrUnlinked );
+ }
+ else if ( &aBtnPreview == pBox )
+ {
+ if ( aBtnPreview.IsChecked() )
+ {
+ if ( !bIsGraphicValid )
+ bIsGraphicValid = LoadLinkedGraphic_Impl();
+
+ if ( bIsGraphicValid )
+ {
+ Bitmap aBmp = aBgdGraphic.GetBitmap();
+ pPreviewWin2->NotifyChange( &aBmp );
+ }
+ else
+ {
+ if ( aBgdGraphicPath.Len() > 0 ) // nur bei gelinkter Grafik
+ RaiseLoadError_Impl(); // ein Fehler
+ pPreviewWin2->NotifyChange( NULL );
+ }
+ }
+ else
+ pPreviewWin2->NotifyChange( NULL );
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxBackgroundTabPage, RadioClickHdl_Impl, RadioButton*, pBtn )
+
+/* [Beschreibung]
+
+*/
+
+{
+ if ( pBtn == &aBtnPosition )
+ {
+ if ( !aWndPosition.IsEnabled() )
+ {
+ aWndPosition.Enable();
+ aWndPosition.Invalidate();
+ }
+ }
+ else if ( aWndPosition.IsEnabled() )
+ {
+ aWndPosition.Disable();
+ aWndPosition.Invalidate();
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxBackgroundTabPage, BrowseHdl_Impl, PushButton* , EMPTYARG )
+
+/* [Beschreibung]
+
+ Handler, gerufen durch das Dr"ucken des Durchsuchen-Buttons.
+ Grafik/Einf"ugen-Dialog erzeugen, Pfad setzen und starten.
+*/
+
+{
+ if ( pPageImpl->pLoadTimer->IsActive() )
+ return 0;
+ BOOL bHtml = 0 != ( nHtmlMode & HTMLMODE_ON );
+
+ pImportDlg = new SvxOpenGraphicDialog( aStrBrowse );
+ if ( bHtml || bLinkOnly )
+ pImportDlg->EnableLink(sal_False);
+ pImportDlg->SetPath( aBgdGraphicPath, aBtnLink.IsChecked() );
+
+ pPageImpl->bIsImportDlgInExecute = TRUE;
+ short nErr = pImportDlg->Execute();
+ pPageImpl->bIsImportDlgInExecute = FALSE;
+
+ if( !nErr )
+ {
+ if ( bHtml )
+ aBtnLink.Check();
+ // wenn Verkn"upfen nicht gecheckt ist und die Vorschau auch nicht,
+ // dann die Vorschau aktivieren, damit der Anwender sieht,
+ // welche Grafik er ausgew"ahlt hat
+ if ( !aBtnLink.IsChecked() && !aBtnPreview.IsChecked() )
+ aBtnPreview.Check( TRUE );
+ // timer-verz"ogertes Laden der Grafik
+ pPageImpl->pLoadTimer->Start();
+ }
+ else
+ DELETEZ( pImportDlg );
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+IMPL_LINK( SvxBackgroundTabPage, LoadTimerHdl_Impl, Timer* , pTimer )
+
+/* [Beschreibung]
+
+ Verz"ogertes Laden der Grafik.
+ Grafik wird nur dann geladen, wenn sie unterschiedlich zur
+ aktuellen Grafik ist.
+*/
+
+{
+ if ( pTimer == pPageImpl->pLoadTimer )
+ {
+ pPageImpl->pLoadTimer->Stop();
+
+ if ( pImportDlg )
+ {
+ INetURLObject aOld( aBgdGraphicPath );
+ INetURLObject aNew( pImportDlg->GetPath() );
+ if ( !aBgdGraphicPath.Len() || aNew != aOld )
+ {
+ // neue Datei gew"ahlt
+ aBgdGraphicPath = pImportDlg->GetPath();
+ aBgdGraphicFilter = pImportDlg->GetCurrentFilter();
+ BOOL bLink = ( nHtmlMode & HTMLMODE_ON ) || bLinkOnly ? TRUE : pImportDlg->IsAsLink();
+ aBtnLink.Check( bLink );
+ aBtnLink.Enable();
+
+ if ( aBtnPreview.IsChecked() )
+ {
+ if( !pImportDlg->GetGraphic(aBgdGraphic) )
+ {
+ bIsGraphicValid = TRUE;
+ }
+ else
+ {
+ aBgdGraphicFilter.Erase();
+ aBgdGraphicPath.Erase();
+ bIsGraphicValid = FALSE;
+ }
+ }
+ else
+ bIsGraphicValid = FALSE; // Grafik erst beim Preview-Click laden
+
+ if ( aBtnPreview.IsChecked() && bIsGraphicValid )
+ {
+ Bitmap aBmp = aBgdGraphic.GetBitmap();
+ pPreviewWin2->NotifyChange( &aBmp );
+ }
+ else
+ pPreviewWin2->NotifyChange( NULL );
+ }
+
+ FileClickHdl_Impl( &aBtnLink );
+ DELETEZ( pImportDlg );
+ }
+ }
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+void SvxBackgroundTabPage::ShowTblControl()
+
+/* [Beschreibung]
+
+*/
+
+{
+ aTblLBox .SetSelectHdl( HDL(TblDestinationHdl_Impl) );
+ aTblLBox .SelectEntryPos(0);
+ aTblDesc.Show();
+ aTblLBox.Show();
+}
+
+//-----------------------------------------------------------------------
+
+void SvxBackgroundTabPage::ShowParaControl(BOOL bCharOnly)
+{
+ aParaLBox.SetSelectHdl(HDL(ParaDestinationHdl_Impl));
+ aParaLBox.SelectEntryPos(0);
+ if(!bCharOnly)
+ {
+ aTblDesc.Show();
+ aParaLBox.Show();
+ }
+ aParaLBox.SetData(&aParaLBox); // hier erkennt man, dass dieser Mode eingeschaltet ist
+}
+//-----------------------------------------------------------------------
+
+IMPL_LINK( SvxBackgroundTabPage, TblDestinationHdl_Impl, ListBox*, pBox )
+
+/* [Beschreibung]
+
+*/
+
+{
+ USHORT nSelPos = pBox->GetSelectEntryPos();
+ if( pTableBck_Impl && pTableBck_Impl->nActPos != nSelPos)
+ {
+ SvxBrushItem** pActItem = new (SvxBrushItem*);
+ USHORT nWhich = 0;
+ switch(pTableBck_Impl->nActPos)
+ {
+ case TBL_DEST_CELL:
+ *pActItem = pTableBck_Impl->pCellBrush;
+ nWhich = pTableBck_Impl->nCellWhich;
+ break;
+ case TBL_DEST_ROW:
+ *pActItem = pTableBck_Impl->pRowBrush;
+ nWhich = pTableBck_Impl->nRowWhich;
+ break;
+ case TBL_DEST_TBL:
+ *pActItem = pTableBck_Impl->pTableBrush;
+ nWhich = pTableBck_Impl->nTableWhich;
+ break;
+ }
+ pTableBck_Impl->nActPos = nSelPos;
+ if(!*pActItem)
+ *pActItem = new SvxBrushItem(nWhich);
+ if(0 == aLbSelect.GetSelectEntryPos()) // Brush ausgewaehlt
+ {
+ **pActItem = SvxBrushItem( aBgdColor, nWhich );
+ }
+ else
+ {
+ SvxGraphicPosition eNewPos = GetGraphicPosition_Impl();
+ const BOOL bIsLink = aBtnLink.IsChecked();
+
+ if ( !bIsLink && !bIsGraphicValid )
+ bIsGraphicValid = LoadLinkedGraphic_Impl();
+
+ if ( bIsLink )
+ **pActItem = SvxBrushItem( aBgdGraphicPath,
+ aBgdGraphicFilter,
+ eNewPos,
+ (*pActItem)->Which() );
+ else
+ **pActItem = SvxBrushItem( aBgdGraphic,
+ eNewPos,
+ (*pActItem)->Which() );
+ }
+ switch(nSelPos)
+ {
+ case TBL_DEST_CELL:
+ *pActItem = pTableBck_Impl->pCellBrush;
+ aLbSelect.Enable();
+ nWhich = pTableBck_Impl->nCellWhich;
+ break;
+ case TBL_DEST_ROW:
+ {
+ if((nHtmlMode & HTMLMODE_ON) && !(nHtmlMode & HTMLMODE_SOME_STYLES))
+ aLbSelect.Disable();
+ *pActItem = pTableBck_Impl->pRowBrush;
+ nWhich = pTableBck_Impl->nRowWhich;
+ }
+ break;
+ case TBL_DEST_TBL:
+ *pActItem = pTableBck_Impl->pTableBrush;
+ aLbSelect.Enable();
+ nWhich = pTableBck_Impl->nTableWhich;
+ break;
+ }
+ String aUserData = GetUserData();
+ if(!*pActItem)
+ *pActItem = new SvxBrushItem(nWhich);
+ FillControls_Impl(**pActItem, aUserData);
+ delete pActItem;
+ }
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+IMPL_LINK( SvxBackgroundTabPage, ParaDestinationHdl_Impl, ListBox*, pBox )
+{
+ USHORT nSelPos = pBox->GetSelectEntryPos();
+ if( pParaBck_Impl && pParaBck_Impl->nActPos != nSelPos)
+ {
+ SvxBrushItem** pActItem = new (SvxBrushItem*);
+ switch(pParaBck_Impl->nActPos)
+ {
+ case PARA_DEST_PARA:
+ *pActItem = pParaBck_Impl->pParaBrush;
+ break;
+ case PARA_DEST_CHAR:
+ *pActItem = pParaBck_Impl->pCharBrush;
+ break;
+ }
+ pParaBck_Impl->nActPos = nSelPos;
+ if(0 == aLbSelect.GetSelectEntryPos()) // Brush ausgewaehlt
+ {
+ USHORT nWhich = (*pActItem)->Which();
+ **pActItem = SvxBrushItem( aBgdColor, nWhich );
+ }
+ else
+ {
+ SvxGraphicPosition eNewPos = GetGraphicPosition_Impl();
+ const BOOL bIsLink = aBtnLink.IsChecked();
+
+ if ( !bIsLink && !bIsGraphicValid )
+ bIsGraphicValid = LoadLinkedGraphic_Impl();
+
+ if ( bIsLink )
+ **pActItem = SvxBrushItem( aBgdGraphicPath,
+ aBgdGraphicFilter,
+ eNewPos,
+ (*pActItem)->Which() );
+ else
+ **pActItem = SvxBrushItem( aBgdGraphic,
+ eNewPos,
+ (*pActItem)->Which() );
+ }
+ switch(nSelPos)
+ {
+ case PARA_DEST_PARA:
+ *pActItem = pParaBck_Impl->pParaBrush;
+ aLbSelect.Enable();
+ break;
+ case PARA_DEST_CHAR:
+ {
+ *pActItem = pParaBck_Impl->pCharBrush;
+ aLbSelect.Enable(FALSE);
+ }
+ break;
+ }
+ String aUserData = GetUserData();
+ FillControls_Impl(**pActItem, aUserData);
+ delete pActItem;
+ }
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
+ const String& rUserData )
+
+/* [Beschreibung]
+
+*/
+
+{
+ SvxGraphicPosition ePos = rBgdAttr.GetGraphicPos();
+ const Color& rColor = rBgdAttr.GetColor();
+ if(bColTransparency)
+ {
+ aColTransMF.SetValue(lcl_TransparencyToPercent(rColor.GetTransparency()));
+ aColTransMF.SaveValue();
+ BOOL bEnableTransp = rColor.GetTransparency() < 0xff;
+ aColTransFT.Enable(bEnableTransp);
+ aColTransMF.Enable(bEnableTransp);
+ //the default setting should be "no transparency"
+ if(!bEnableTransp)
+ aColTransMF.SetValue(0);
+ }
+
+ if ( GPOS_NONE == ePos || !aLbSelect.IsVisible() )
+ {
+ aLbSelect.SelectEntryPos( 0 );
+ ShowColorUI_Impl();
+ Color aTrColor( COL_TRANSPARENT );
+ aBgdColor = rColor;
+
+ USHORT nCol = ( aTrColor != aBgdColor ) ?
+ GetItemId_Impl( aBackgroundColorSet, aBgdColor ) : 0;
+
+ if( aTrColor != aBgdColor && nCol == 0)
+ {
+ aBackgroundColorSet.SetNoSelection();
+ }
+ else
+ {
+ aBackgroundColorSet.SelectItem( nCol );
+ }
+
+ pPreviewWin1->NotifyChange( aBgdColor );
+ if ( aLbSelect.IsVisible() ) // Grafikteil initialisieren
+ {
+ aBgdGraphicFilter.Erase();
+ aBgdGraphicPath.Erase();
+
+ if ( !rUserData.Len() )
+ aBtnPreview.Check( FALSE );
+ aBtnLink.Check( FALSE );
+ aBtnLink.Disable();
+ pPreviewWin2->NotifyChange( NULL );
+ SetGraphicPosition_Impl( GPOS_TILED ); // Kacheln als Default
+ }
+ }
+ else
+ {
+ const String* pStrLink = rBgdAttr.GetGraphicLink();
+ const String* pStrFilter = rBgdAttr.GetGraphicFilter();
+
+ aLbSelect.SelectEntryPos( 1 );
+ ShowBitmapUI_Impl();
+
+ if ( pStrLink )
+ {
+#ifdef DBG_UTIL
+ INetURLObject aObj( *pStrLink );
+ DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
+#endif
+ aBgdGraphicPath = *pStrLink;
+ aBtnLink.Check( TRUE );
+ aBtnLink.Enable();
+ }
+ else
+ {
+ aBgdGraphicPath.Erase();
+ aBtnLink.Check( FALSE );
+ aBtnLink.Disable();
+ }
+
+ if(bGraphTransparency)
+ {
+ const GraphicObject* pObject = rBgdAttr.GetGraphicObject(SfxObjectShell::Current());
+ if(pObject)
+ aGraphTransMF.SetValue(lcl_TransparencyToPercent(pObject->GetAttr().GetTransparency()));
+ else
+ aGraphTransMF.SetValue(0);
+ aGraphTransMF.SaveValue();
+ }
+
+ FileClickHdl_Impl( &aBtnLink );
+
+ if ( pStrFilter )
+ aBgdGraphicFilter = *pStrFilter;
+ else
+ aBgdGraphicFilter.Erase();
+
+ if ( !pStrLink || aBtnPreview.IsChecked() )
+ {
+ // Grafik ist im Item vorhanden und muss nicht
+ // geladen werden:
+
+ const Graphic* pGraphic =
+ rBgdAttr.GetGraphic( SfxObjectShell::Current() );
+
+ if ( !pGraphic && aBtnPreview.IsChecked() )
+ bIsGraphicValid = LoadLinkedGraphic_Impl();
+ else if ( pGraphic )
+ {
+ aBgdGraphic = *pGraphic;
+ bIsGraphicValid = TRUE;
+
+ if ( !rUserData.Len() )
+ aBtnPreview.Check();
+ }
+ else
+ {
+ RaiseLoadError_Impl();
+ bIsGraphicValid = FALSE;
+
+ if ( !rUserData.Len() )
+ aBtnPreview.Check( FALSE );
+ }
+ }
+
+ if ( aBtnPreview.IsChecked() && bIsGraphicValid )
+ {
+ Bitmap aBmp = aBgdGraphic.GetBitmap();
+ pPreviewWin2->NotifyChange( &aBmp );
+ }
+ else
+ pPreviewWin2->NotifyChange( NULL );
+
+ SetGraphicPosition_Impl( ePos );
+ }
+}
+/* -----------------------------09.08.2002 14:04------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxBackgroundTabPage::EnableTransparency(BOOL bColor, BOOL bGraphic)
+{
+ bColTransparency = bColor;
+ bGraphTransparency = bGraphic;
+ if(bColor)
+ {
+ aColTransFT.Show();
+ aColTransMF.Show();
+ }
+ if(bGraphic)
+ {
+ Size aRectSize(aWndPosition.GetSizePixel());
+ Point aRectPos(aWndPosition.GetPosPixel());
+ Point aFLPos(aGraphTransFL.GetPosPixel());
+ Size aTmp(LogicToPixel(Size(RSC_SP_FLGR_SPACE_Y, RSC_SP_FLGR_SPACE_Y), MAP_APPFONT));
+ long nRectHeight = aFLPos.Y() - aRectPos.Y() - aTmp.Height();
+ aRectSize.Height() = nRectHeight;
+ aWndPosition.SetSizePixel(aRectSize);
+ aWndPosition.Invalidate();
+ }
+}
+
+void SvxBackgroundTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False);
+ if (pFlagItem)
+ {
+ UINT32 nFlags=pFlagItem->GetValue();
+ if ( ( nFlags & SVX_SHOW_TBLCTL ) == SVX_SHOW_TBLCTL )
+ ShowTblControl();
+ if ( ( nFlags & SVX_SHOW_PARACTL ) == SVX_SHOW_PARACTL )
+ ShowParaControl();
+ if ( ( nFlags & SVX_SHOW_SELECTOR ) == SVX_SHOW_SELECTOR )
+ ShowSelector();
+ if ( ( nFlags & SVX_ENABLE_TRANSPARENCY ) == SVX_ENABLE_TRANSPARENCY )
+ EnableTransparency(TRUE, TRUE);
+ }
+}
diff --git a/cui/source/tabpages/backgrnd.hrc b/cui/source/tabpages/backgrnd.hrc
new file mode 100644
index 000000000000..ce154afa54b6
--- /dev/null
+++ b/cui/source/tabpages/backgrnd.hrc
@@ -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: backgrnd.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_BACKGRND_HRC
+#define _SVX_BACKGRND_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FT_SELECTOR 1
+#define LB_SELECTOR 1
+
+#define SET_BGDCOLOR 10
+#define GB_BGDCOLOR 11
+#define SET_PATTERN 12
+#define GB_COL_PREVIEW 13
+#define SET_PATCOLOR 14
+#define GB_PATCOLOR 15
+#define CT_BORDER 16
+#define FT_PREVIEW 20
+#define WIN_PREVIEW1 21
+
+#define BTN_BROWSE 20
+#define FT_FILE 21
+#define BTN_LINK 22
+#define BTN_PREVIEW 23
+#define GB_FILE 24
+#define BTN_AREA 25
+#define BTN_TILE 26
+#define BTN_POSITION 27
+#define WND_POSITION 28
+#define GB_POSITION 29
+#define WIN_PREVIEW2 30
+#define GB_PREVIEW 31
+#define LB_TBL_BOX 32
+#define FT_TBL_DESC 33
+#define LB_PARA_BOX 34
+#define FT_COL_TRANS 35
+#define MF_COL_TRANS 36
+#define FL_GRAPH_TRANS 37
+#define MF_GRAPH_TRANS 38
+
+#define STR_BROWSE 1
+#define STR_UNLINKED 2
+
+
+#endif
+
diff --git a/cui/source/tabpages/backgrnd.src b/cui/source/tabpages/backgrnd.src
new file mode 100644
index 000000000000..c89361a18ae3
--- /dev/null
+++ b/cui/source/tabpages/backgrnd.src
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * 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: backgrnd.src,v $
+ * $Revision: 1.40 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svtools/controldims.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include "backgrnd.hrc"
+ // define ----------------------------------------------------------------
+#define UNLINKED_IMAGE \
+ Text [ en-US ] = "Unlinked graphic" ; \
+
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXPAGE_BACKGROUND ------------------------------------------------
+TabPage RID_SVXPAGE_BACKGROUND
+{
+ HelpId = HID_BACKGROUND ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Background" ;
+ FixedText FT_SELECTOR
+ {
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 24 , 10 ) ;
+ Hide = TRUE ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "A~s" ;
+ };
+ ListBox LB_SELECTOR
+ {
+ Hide = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 33 , 3 ) ;
+ Size = MAP_APPFONT ( 82 , 48 ) ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Color" ; Default ; > ;
+ < "Graphic" ; Default ; > ;
+ };
+ };
+ FixedText FT_TBL_DESC
+ {
+ Pos = MAP_APPFONT ( 145 , 5 ) ;
+ Size = MAP_APPFONT ( 24 , 10 ) ;
+ Hide = TRUE ;
+ LeftLabel = TRUE ;
+ /* ### ACHTUNG: Neuer Text in Resource? Fü~r : F³~r */
+ Text [ en-US ] = "F~or" ;
+ };
+ ListBox LB_TBL_BOX
+ {
+ Hide = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 172 , 3 ) ;
+ Size = MAP_APPFONT ( 82 , 48 ) ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Cell" ; > ;
+ < "Row" ; > ;
+ < "Table" ; > ;
+ };
+ };
+ ListBox LB_PARA_BOX
+ {
+ Hide = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 172 , 3 ) ;
+ Size = MAP_APPFONT ( 82 , 48 ) ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Paragraph" ; > ;
+ < "Character" ; > ;
+ };
+ };
+ // Hintergrund-Brush ----------------------------------------------------
+ Control CT_BORDER
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 116+2 , 145+2 ) ;
+ DialogControl = TRUE;
+ };
+ Control SET_BGDCOLOR
+ {
+ HelpId = HID_BACKGROUND_CTL_BGDCOLORSET ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 116 , 145 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine GB_BGDCOLOR
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 21 ) ;
+ Size = MAP_APPFONT ( 248 , 8) ;
+ Text [ en-US ] = "Background color" ;
+ };
+ Window WIN_PREVIEW1
+ {
+ Hide = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 166 , 34 ) ;
+ Size = MAP_APPFONT ( 82 , 40 ) ;
+ };
+ FixedText FT_COL_TRANS
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 166, 74 + RSC_SP_CTRL_Y + 2 ) ;
+ Size = MAP_APPFONT ( 50 , 8) ;
+ Text [ en-US ] = "~Transparency" ;
+ };
+ MetricField MF_COL_TRANS
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 218 , 74 + RSC_SP_CTRL_Y ) ;
+ Size = MAP_APPFONT ( 30 , 12) ;
+ Border = TRUE ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ SpinSize = 5 ;
+ Minimum = 0;
+ Maximum = 100;
+ };
+
+ // Hintergrund-Bitmap ----------------------------------------------------
+ FixedLine GB_FILE
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 23 ) ;
+ Size = MAP_APPFONT ( 153 , 8 ) ;
+ Text [ en-US ] = "File" ;
+ };
+ PushButton BTN_BROWSE
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 + RSC_SP_FLGR_INNERBORDER_LEFT , 23 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Browse..." ;
+ };
+ CheckBox BTN_LINK
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 + RSC_SP_FLGR_INNERBORDER_LEFT + 60 + 2*RSC_SP_CTRL_X, 23 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + 3 ) ;
+ Size = MAP_APPFONT ( 78 , 10 ) ;
+ Text [ en-US ] = "~Link" ;
+ };
+ FixedText FT_FILE
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 + RSC_SP_FLGR_INNERBORDER_LEFT , 23 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + RSC_CD_PUSHBUTTON_HEIGHT + RSC_SP_CTRL_Y ) ;
+ Size = MAP_APPFONT ( 141 , 8 ) ;
+ UNLINKED_IMAGE
+ };
+ FixedLine GB_POSITION
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 78 ) ;
+ Size = MAP_APPFONT ( 153 , 8 ) ;
+ Text [ en-US ] = "Type" ;
+ };
+ RadioButton BTN_POSITION
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 89 ) ;
+ Size = MAP_APPFONT ( 49 , 10 ) ;
+ Text [ en-US ] = "~Position" ;
+ };
+ RadioButton BTN_AREA
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 103 ) ;
+ Size = MAP_APPFONT ( 49 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Fläche : ~Flõche */
+ Text [ en-US ] = "Ar~ea" ;
+ };
+ RadioButton BTN_TILE
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 117 ) ;
+ Size = MAP_APPFONT ( 49 , 10 ) ;
+ Text [ en-US ] = "~Tile" ;
+ };
+ Control WND_POSITION
+ {
+ HelpId = HID_BACKGROUND_CTL_POSITION ;
+ Hide = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 64 , 89 ) ;
+ Size = MAP_APPFONT ( 90 , 87 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_GRAPH_TRANS
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 157 ) ;
+ Size = MAP_APPFONT ( 153 , 8) ;
+ Text [ en-US ] = "Transparency" ;
+ };
+ MetricField MF_GRAPH_TRANS
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 168 ) ;
+ Size = MAP_APPFONT ( 30 , 12) ;
+ Border = TRUE ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ SpinSize = 5 ;
+ Minimum = 0;
+ Maximum = 100;
+ };
+ Window WIN_PREVIEW2
+ {
+ Hide = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 23 + 4 ) ;
+ Size = MAP_APPFONT ( 81 , 139 ) ;
+ };
+ CheckBox BTN_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 170 , 23 + 4 + 139 + RSC_SP_CTRL_GROUP_Y ) ;
+ Size = MAP_APPFONT ( 141 , 10 ) ;
+ Text [ en-US ] = "Pre~view" ;
+ };
+ String STR_BROWSE
+ {
+ Text [ en-US ] = "Find graphics" ;
+ };
+ String STR_UNLINKED
+ {
+ UNLINKED_IMAGE
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/bbdlg.cxx b/cui/source/tabpages/bbdlg.cxx
new file mode 100644
index 000000000000..d243160facf5
--- /dev/null
+++ b/cui/source/tabpages/bbdlg.cxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * 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: bbdlg.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+
+#include <svx/dialogs.hrc>
+#include "page.hrc"
+
+#include "bbdlg.hxx"
+#include "border.hxx"
+#include "backgrnd.hxx"
+#include <svx/dialmgr.hxx>
+
+// class SvxBorderBackgroundDlg ------------------------------------------
+
+SvxBorderBackgroundDlg::SvxBorderBackgroundDlg( Window *pParent,
+ const SfxItemSet& rCoreSet,
+ BOOL bEnableSelector ) :
+
+ SfxTabDialog( pParent, SVX_RES( RID_SVXDLG_BBDLG ), &rCoreSet ),
+ bEnableBackgroundSelector( bEnableSelector )
+{
+ FreeResource();
+ AddTabPage( RID_SVXPAGE_BORDER, SvxBorderTabPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_BACKGROUND, SvxBackgroundTabPage::Create, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+SvxBorderBackgroundDlg::~SvxBorderBackgroundDlg()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxBorderBackgroundDlg::PageCreated( USHORT nPageId, SfxTabPage& rTabPage )
+{
+ // Umschalten zwischen Farbe/Grafik ermoeglichen:
+
+ if ( bEnableBackgroundSelector && (RID_SVXPAGE_BACKGROUND == nPageId) )
+ ((SvxBackgroundTabPage&)rTabPage).ShowSelector( );
+}
+
+
diff --git a/cui/source/tabpages/bbdlg.src b/cui/source/tabpages/bbdlg.src
new file mode 100644
index 000000000000..98b4bf01767e
--- /dev/null
+++ b/cui/source/tabpages/bbdlg.src
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * 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: bbdlg.src,v $
+ * $Revision: 1.22 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXDLG_BBDLG ------------------------------------------------------
+TabDialog RID_SVXDLG_BBDLG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 328 , 155 ) ;
+ Text [ en-US ] = "Border / Background" ;
+ Moveable = TRUE ;
+ // Closeable = TRUE; hat ja einen OKButton
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 2 , 10 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_BORDER ;
+ Text [ en-US ] = "Borders" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ };
+ };
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
new file mode 100644
index 000000000000..39efc210b6d1
--- /dev/null
+++ b/cui/source/tabpages/border.cxx
@@ -0,0 +1,1271 @@
+/*************************************************************************
+ *
+ * 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: border.cxx,v $
+ * $Revision: 1.39 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/module.hxx>
+
+#define _SVX_BORDER_CXX
+
+#include <svx/dialogs.hrc>
+#include <svx/svxitems.hrc>
+#include "border.hrc"
+#include "helpid.hrc"
+
+#define LINESTYLE_HTML_MAX 5
+
+#include <svx/xtable.hxx> // XColorTable
+#include <svx/drawitem.hxx>
+#include <svx/boxitem.hxx>
+#include <svx/shaditem.hxx>
+#include "border.hxx"
+#include <svx/dlgutil.hxx>
+#include <svx/dialmgr.hxx>
+#include "svx/htmlmode.hxx"
+#include <vcl/msgbox.hxx>
+#include <svx/svxids.hrc> //CHINA001
+#include "svx/flagsdef.hxx" //CHINA001
+#include <sfx2/request.hxx>
+#include <svl/intitem.hxx> //CHINA001
+#include <sfx2/itemconnect.hxx>
+#include "borderconn.hxx"
+
+// -----------------------------------------------------------------------
+
+/*
+ * [Beschreibung:]
+ * TabPage zum Einstellen der Rahmen-Attribute.
+ * Benoetigt
+ * ein SvxShadowItem: Schatten
+ * ein SvxBoxItem: Linien links,rechts,oben,unten ),
+ * ein SvxBoxInfo: Linien vertikal,horizontal, Abstaende, Flags )
+ *
+ * Linien koennen drei Zustaende haben.
+ * 1. Show ( -> gueltige Werte )
+ * 2. Hide ( -> NULL-Pointer )
+ * 3. DontCare ( -> gesonderte Valid-Flags im InfoItem )
+ */
+
+// static ----------------------------------------------------------------
+
+static USHORT pRanges[] =
+{
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW,
+ SID_ATTR_ALIGN_MARGIN, SID_ATTR_ALIGN_MARGIN,
+ SID_ATTR_BORDER_CONNECT, SID_ATTR_BORDER_CONNECT,
+ SID_SW_COLLAPSING_BORDERS, SID_SW_COLLAPSING_BORDERS,
+ SID_ATTR_BORDER_DIAG_TLBR, SID_ATTR_BORDER_DIAG_BLTR,
+ 0
+};
+
+BOOL SvxBorderTabPage::bSync = TRUE;
+
+
+//------------------------------------------------------------------------
+
+#define LINE_WIDTH0 (DEF_LINE_WIDTH_0 *100)
+#define LINE_WIDTH1 (DEF_LINE_WIDTH_1 *100)
+#define LINE_WIDTH2 (DEF_LINE_WIDTH_2 *100)
+#define LINE_WIDTH3 (DEF_LINE_WIDTH_3 *100)
+#define LINE_WIDTH4 (DEF_LINE_WIDTH_4 *100)
+#define LINE_WIDTH5 (DEF_LINE_WIDTH_5 *100)
+
+#define DLINE0_OUT (DEF_DOUBLE_LINE0_OUT *100)
+#define DLINE0_IN (DEF_DOUBLE_LINE0_IN *100)
+#define DLINE0_DIST (DEF_DOUBLE_LINE0_DIST *100)
+
+#define DLINE1_OUT (DEF_DOUBLE_LINE1_OUT *100)
+#define DLINE1_IN (DEF_DOUBLE_LINE1_IN *100)
+#define DLINE1_DIST (DEF_DOUBLE_LINE1_DIST *100)
+
+#define DLINE2_OUT (DEF_DOUBLE_LINE2_OUT *100)
+#define DLINE2_IN (DEF_DOUBLE_LINE2_IN *100)
+#define DLINE2_DIST (DEF_DOUBLE_LINE2_DIST *100)
+
+#define DLINE3_OUT (DEF_DOUBLE_LINE3_OUT *100)
+#define DLINE3_IN (DEF_DOUBLE_LINE3_IN *100)
+#define DLINE3_DIST (DEF_DOUBLE_LINE3_DIST *100)
+
+#define DLINE4_OUT (DEF_DOUBLE_LINE4_OUT *100)
+#define DLINE4_IN (DEF_DOUBLE_LINE4_IN *100)
+#define DLINE4_DIST (DEF_DOUBLE_LINE4_DIST *100)
+
+#define DLINE5_OUT (DEF_DOUBLE_LINE5_OUT *100)
+#define DLINE5_IN (DEF_DOUBLE_LINE5_IN *100)
+#define DLINE5_DIST (DEF_DOUBLE_LINE5_DIST *100)
+
+#define DLINE6_OUT (DEF_DOUBLE_LINE6_OUT *100)
+#define DLINE6_IN (DEF_DOUBLE_LINE6_IN *100)
+#define DLINE6_DIST (DEF_DOUBLE_LINE6_DIST *100)
+
+#define DLINE7_OUT (DEF_DOUBLE_LINE7_OUT *100)
+#define DLINE7_IN (DEF_DOUBLE_LINE7_IN *100)
+#define DLINE7_DIST (DEF_DOUBLE_LINE7_DIST *100)
+
+#define DLINE8_OUT (DEF_DOUBLE_LINE8_OUT *100)
+#define DLINE8_IN (DEF_DOUBLE_LINE8_IN *100)
+#define DLINE8_DIST (DEF_DOUBLE_LINE8_DIST *100)
+
+#define DLINE9_OUT (DEF_DOUBLE_LINE9_OUT *100)
+#define DLINE9_IN (DEF_DOUBLE_LINE9_IN *100)
+#define DLINE9_DIST (DEF_DOUBLE_LINE9_DIST *100)
+
+#define DLINE10_OUT (DEF_DOUBLE_LINE10_OUT *100)
+#define DLINE10_IN (DEF_DOUBLE_LINE10_IN *100)
+#define DLINE10_DIST (DEF_DOUBLE_LINE10_DIST*100)
+
+#define RGBCOL(eColorName) (TpBorderRGBColor(eColorName))
+
+// LOKALE FUNKTION
+// Konvertiert in echte RGB-Farben, damit in den Listboxen
+// endlich mal richtig selektiert werden kann.
+
+Color TpBorderRGBColor( ColorData aColorData )
+{
+ Color aRGBColor( aColorData );
+
+ return( aRGBColor );
+}
+
+// -----------------------------------------------------------------------
+
+Color TpBorderRGBColor( const Color& rColor )
+{
+ Color aRGBColor( rColor.GetRed(),
+ rColor.GetGreen(),
+ rColor.GetBlue() );
+
+ return( aRGBColor );
+}
+
+// -----------------------------------------------------------------------
+void lcl_SetDecimalDigitsTo1(MetricField& rField)
+{
+ sal_Int64 nMin = rField.Denormalize( rField.GetMin( FUNIT_TWIP ) );
+ rField.SetDecimalDigits(1);
+ rField.SetMin( rField.Normalize( nMin ), FUNIT_TWIP );
+}
+// -----------------------------------------------------------------------
+
+SvxBorderTabPage::SvxBorderTabPage( Window* pParent,
+ const SfxItemSet& rCoreAttrs )
+
+ : SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_BORDER ), rCoreAttrs ),
+
+ aFlBorder ( this, SVX_RES( FL_BORDER ) ),
+ aDefaultFT ( this, SVX_RES( FT_DEFAULT ) ),
+ aWndPresets ( this, SVX_RES( WIN_PRESETS ) ),
+ aUserDefFT ( this, SVX_RES( FT_USERDEF ) ),
+ aFrameSel ( this, SVX_RES( WIN_FRAMESEL ) ),
+
+ aFlSep1 ( this, SVX_RES( FL_SEPARATOR1 ) ),
+ aFlLine ( this, SVX_RES( FL_LINE ) ),
+ aStyleFT ( this, SVX_RES( FT_STYLE ) ),
+ aLbLineStyle ( this, SVX_RES( LB_LINESTYLE ) ),
+ aColorFT ( this, SVX_RES( FT_COLOR ) ),
+ aLbLineColor ( this, SVX_RES( LB_LINECOLOR ) ),
+
+ aFlSep2 ( this, SVX_RES( FL_SEPARATOR2 ) ),
+ aDistanceFL ( this, SVX_RES( FL_DISTANCE ) ),
+ aLeftFT ( this, SVX_RES( FT_LEFT ) ),
+ aLeftMF ( this, SVX_RES( MF_LEFT ) ),
+ aRightFT ( this, SVX_RES( FT_RIGHT ) ),
+ aRightMF ( this, SVX_RES( MF_RIGHT ) ),
+ aTopFT ( this, SVX_RES( FT_TOP ) ),
+ aTopMF ( this, SVX_RES( MF_TOP ) ),
+ aBottomFT ( this, SVX_RES( FT_BOTTOM ) ),
+ aBottomMF ( this, SVX_RES( MF_BOTTOM ) ),
+ aSynchronizeCB ( this, SVX_RES( CB_SYNC ) ),
+
+ aFlShadow ( this, SVX_RES( FL_SHADOW ) ),
+ aFtShadowPos ( this, SVX_RES( FT_SHADOWPOS ) ),
+ aWndShadows ( this, SVX_RES( WIN_SHADOWS ) ),
+ aFtShadowSize ( this, SVX_RES( FT_SHADOWSIZE ) ),
+ aEdShadowSize ( this, SVX_RES( ED_SHADOWSIZE ) ),
+ aFtShadowColor ( this, SVX_RES( FT_SHADOWCOLOR ) ),
+ aLbShadowColor ( this, SVX_RES( LB_SHADOWCOLOR ) ),
+ aPropertiesFL ( this, SVX_RES( FL_PROPERTIES ) ),
+ aMergeWithNextCB( this, SVX_RES( CB_MERGEWITHNEXT ) ),
+ aMergeAdjacentBordersCB( this, SVX_RES( CB_MERGEADJACENTBORDERS ) ),
+ aShadowImgLstH( SVX_RES(ILH_SDW_BITMAPS)),
+ aShadowImgLst( SVX_RES(IL_SDW_BITMAPS)),
+ aBorderImgLstH( SVX_RES(ILH_PRE_BITMAPS)),
+ aBorderImgLst( SVX_RES(IL_PRE_BITMAPS)),
+ nMinValue(0),
+ nSWMode(0),
+ mbHorEnabled( false ),
+ mbVerEnabled( false ),
+ mbTLBREnabled( false ),
+ mbBLTREnabled( false ),
+ mbUseMarginItem( false )
+
+{
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ /* Use SvxMarginItem instead of margins from SvxBoxItem, if present.
+ -> Remember this state in mbUseMarginItem, because other special handling
+ is needed across various functions... */
+ mbUseMarginItem = rCoreAttrs.GetItemState(GetWhich(SID_ATTR_ALIGN_MARGIN),TRUE) != SFX_ITEM_UNKNOWN;
+
+ // Metrik einstellen
+ FieldUnit eFUnit = GetModuleFieldUnit( &rCoreAttrs );
+
+ if( mbUseMarginItem )
+ {
+ // copied from SvxAlignmentTabPage
+ switch ( eFUnit )
+ {
+ // #103396# the default value (1pt) can't be accurately represented in
+ // inches or pica with two decimals, so point is used instead.
+ case FUNIT_PICA:
+ case FUNIT_INCH:
+ case FUNIT_FOOT:
+ case FUNIT_MILE:
+ eFUnit = FUNIT_POINT;
+ break;
+
+ case FUNIT_CM:
+ case FUNIT_M:
+ case FUNIT_KM:
+ eFUnit = FUNIT_MM;
+ break;
+ default: ;//prevent warning
+ }
+ }
+ else
+ {
+ switch ( eFUnit )
+ {
+ case FUNIT_M:
+ case FUNIT_KM:
+ eFUnit = FUNIT_MM;
+ break;
+ default: ; //prevent warning
+ }
+ }
+
+ SetFieldUnit( aEdShadowSize, eFUnit );
+
+ USHORT nWhich = GetWhich( SID_ATTR_BORDER_INNER, sal_False );
+ BOOL bIsDontCare = TRUE;
+
+ if ( rCoreAttrs.GetItemState( nWhich, TRUE ) >= SFX_ITEM_AVAILABLE )
+ {
+ // Absatz oder Tabelle
+ const SvxBoxInfoItem* pBoxInfo =
+ (const SvxBoxInfoItem*)&( rCoreAttrs.Get( nWhich ) );
+
+ mbHorEnabled = pBoxInfo->IsHorEnabled();
+ mbVerEnabled = pBoxInfo->IsVerEnabled();
+ mbTLBREnabled = sfx::ItemWrapperHelper::IsKnownItem( rCoreAttrs, SID_ATTR_BORDER_DIAG_TLBR );
+ mbBLTREnabled = sfx::ItemWrapperHelper::IsKnownItem( rCoreAttrs, SID_ATTR_BORDER_DIAG_BLTR );
+
+ if(pBoxInfo->IsDist())
+ {
+ SetFieldUnit(aLeftMF, eFUnit);
+ SetFieldUnit(aRightMF, eFUnit);
+ SetFieldUnit(aTopMF, eFUnit);
+ SetFieldUnit(aBottomMF, eFUnit);
+ aSynchronizeCB.Check(bSync);
+ aSynchronizeCB.SetClickHdl(LINK(this, SvxBorderTabPage, SyncHdl_Impl));
+ aLeftMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl));
+ aRightMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl));
+ aTopMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl));
+ aBottomMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl));
+ }
+ else
+ {
+ aFlSep2.Hide();
+ aDistanceFL.Hide();
+ aLeftFT.Hide();
+ aLeftMF.Hide();
+ aRightFT.Hide();
+ aRightMF.Hide();
+ aTopFT.Hide();
+ aTopMF.Hide();
+ aBottomFT.Hide();
+ aBottomMF.Hide();
+ aSynchronizeCB.Hide();
+ }
+ bIsDontCare = !pBoxInfo->IsValid( VALID_DISABLE );
+ }
+ if(!mbUseMarginItem && eFUnit == FUNIT_MM && SFX_MAPUNIT_TWIP == rCoreAttrs.GetPool()->GetMetric( GetWhich( SID_ATTR_BORDER_INNER ) ))
+ {
+ //#i91548# changing the number of decimal digits changes the minimum values, too
+ lcl_SetDecimalDigitsTo1(aLeftMF);
+ lcl_SetDecimalDigitsTo1(aRightMF);
+ lcl_SetDecimalDigitsTo1(aTopMF);
+ lcl_SetDecimalDigitsTo1(aBottomMF);
+ lcl_SetDecimalDigitsTo1(aEdShadowSize);
+ }
+
+ svx::FrameSelFlags nFlags = svx::FRAMESEL_OUTER;
+ if( mbHorEnabled )
+ nFlags |= svx::FRAMESEL_INNER_HOR;
+ if( mbVerEnabled )
+ nFlags |= svx::FRAMESEL_INNER_VER;
+ if( mbTLBREnabled )
+ nFlags |= svx::FRAMESEL_DIAG_TLBR;
+ if( mbBLTREnabled )
+ nFlags |= svx::FRAMESEL_DIAG_BLTR;
+ if( bIsDontCare )
+ nFlags |= svx::FRAMESEL_DONTCARE;
+ aFrameSel.Initialize( nFlags );
+
+ aFrameSel.SetSelectHdl(LINK(this, SvxBorderTabPage, LinesChanged_Impl));
+ aLbLineStyle.SetSelectHdl( LINK( this, SvxBorderTabPage, SelStyleHdl_Impl ) );
+ aLbLineColor.SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) );
+ aLbShadowColor.SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) );
+ aWndPresets.SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) );
+ aWndShadows.SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) );
+
+ FillValueSets();
+ FillLineListBox_Impl();
+
+ // ColorBox aus der XColorTable fuellen.
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ const SfxPoolItem* pItem = NULL;
+ XColorTable* pColorTable = NULL;
+
+ DBG_ASSERT( pDocSh, "DocShell not found!" );
+
+ if ( pDocSh )
+ {
+ pItem = pDocSh->GetItem( SID_COLOR_TABLE );
+ if ( pItem != NULL )
+ pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
+ }
+
+ DBG_ASSERT( pColorTable, "ColorTable not found!" );
+
+ if ( pColorTable )
+ {
+ // fuellen der Linienfarben-Box
+ aLbLineColor.SetUpdateMode( FALSE );
+
+ for ( long i = 0; i < pColorTable->Count(); ++i )
+ {
+ XColorEntry* pEntry = pColorTable->GetColor(i);
+ aLbLineColor.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ }
+ aLbLineColor.SetUpdateMode( TRUE );
+ // dann nur noch in die Schattenfarben-Box kopieren
+ aLbShadowColor.CopyEntries( aLbLineColor );
+ }
+ FreeResource();
+
+ // connections
+
+ bool bSupportsShadow = !SfxItemPool::IsSlot( GetWhich( SID_ATTR_BORDER_SHADOW ) );
+ if( bSupportsShadow )
+ AddItemConnection( svx::CreateShadowConnection( rCoreAttrs, aWndShadows, aEdShadowSize, aLbShadowColor ) );
+ else
+ HideShadowControls();
+
+ if( mbUseMarginItem )
+ AddItemConnection( svx::CreateMarginConnection( rCoreAttrs, aLeftMF, aRightMF, aTopMF, aBottomMF ) );
+ if( aFrameSel.IsBorderEnabled( svx::FRAMEBORDER_TLBR ) )
+ AddItemConnection( svx::CreateFrameLineConnection( SID_ATTR_BORDER_DIAG_TLBR, aFrameSel, svx::FRAMEBORDER_TLBR ) );
+ if( aFrameSel.IsBorderEnabled( svx::FRAMEBORDER_BLTR ) )
+ AddItemConnection( svx::CreateFrameLineConnection( SID_ATTR_BORDER_DIAG_BLTR, aFrameSel, svx::FRAMEBORDER_BLTR ) );
+ // --> OD 2005-03-01 #i43593# - item connection doesn't work for Writer,
+ // because the Writer item sets contain these items
+ // checkbox "Merge with next paragraph" only visible for Writer dialog format.paragraph
+ AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_BORDER_CONNECT, aMergeWithNextCB, sfx::ITEMCONN_DEFAULT ) );
+ aMergeWithNextCB.Hide();
+ // checkbox "Merge adjacent line styles" only visible for Writer dialog format.table
+ AddItemConnection( new sfx::CheckBoxConnection( SID_SW_COLLAPSING_BORDERS, aMergeAdjacentBordersCB, sfx::ITEMCONN_DEFAULT ) );
+ aMergeAdjacentBordersCB.Hide();
+ // <--
+}
+
+// -----------------------------------------------------------------------
+
+SvxBorderTabPage::~SvxBorderTabPage()
+{
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxBorderTabPage::GetRanges()
+{
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxBorderTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SvxBorderTabPage( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxBorderTabPage::ResetFrameLine_Impl( svx::FrameBorderType eBorder, const SvxBorderLine* pCoreLine, bool bValid )
+{
+ if( aFrameSel.IsBorderEnabled( eBorder ) )
+ {
+ if( bValid )
+ aFrameSel.ShowBorder( eBorder, pCoreLine );
+ else
+ aFrameSel.SetBorderDontCare( eBorder );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxBorderTabPage::Reset( const SfxItemSet& rSet )
+{
+ SfxTabPage::Reset( rSet );
+
+ const SvxBoxItem* pBoxItem;
+ const SvxBoxInfoItem* pBoxInfoItem;
+ USHORT nWhichBox = GetWhich(SID_ATTR_BORDER_OUTER);
+ SfxMapUnit eCoreUnit;
+ const Color aColBlack = RGBCOL(COL_BLACK);
+
+ pBoxItem = (const SvxBoxItem*)GetItem( rSet, SID_ATTR_BORDER_OUTER );
+
+
+ pBoxInfoItem = (const SvxBoxInfoItem*)GetItem( rSet, SID_ATTR_BORDER_INNER, sal_False );
+
+ eCoreUnit = rSet.GetPool()->GetMetric( nWhichBox );
+
+ if ( pBoxItem && pBoxInfoItem ) // -> Don't Care
+ {
+ ResetFrameLine_Impl( svx::FRAMEBORDER_LEFT, pBoxItem->GetLeft(), pBoxInfoItem->IsValid( VALID_LEFT ) );
+ ResetFrameLine_Impl( svx::FRAMEBORDER_RIGHT, pBoxItem->GetRight(), pBoxInfoItem->IsValid( VALID_RIGHT ) );
+ ResetFrameLine_Impl( svx::FRAMEBORDER_TOP, pBoxItem->GetTop(), pBoxInfoItem->IsValid( VALID_TOP ) );
+ ResetFrameLine_Impl( svx::FRAMEBORDER_BOTTOM, pBoxItem->GetBottom(), pBoxInfoItem->IsValid( VALID_BOTTOM ) );
+ ResetFrameLine_Impl( svx::FRAMEBORDER_VER, pBoxInfoItem->GetVert(), pBoxInfoItem->IsValid( VALID_VERT ) );
+ ResetFrameLine_Impl( svx::FRAMEBORDER_HOR, pBoxInfoItem->GetHori(), pBoxInfoItem->IsValid( VALID_HORI ) );
+
+ //-------------------
+ // Abstand nach innen
+ //-------------------
+ if( !mbUseMarginItem )
+ {
+ if ( aLeftMF.IsVisible() )
+ {
+ SetMetricValue( aLeftMF, pBoxInfoItem->GetDefDist(), eCoreUnit );
+ SetMetricValue( aRightMF, pBoxInfoItem->GetDefDist(), eCoreUnit );
+ SetMetricValue( aTopMF, pBoxInfoItem->GetDefDist(), eCoreUnit );
+ SetMetricValue( aBottomMF, pBoxInfoItem->GetDefDist(), eCoreUnit );
+
+ nMinValue = static_cast<long>(aLeftMF.GetValue());
+
+ if ( pBoxInfoItem->IsMinDist() )
+ {
+ aLeftMF.SetFirst( nMinValue );
+ aRightMF.SetFirst( nMinValue );
+ aTopMF.SetFirst( nMinValue );
+ aBottomMF.SetFirst( nMinValue );
+ }
+
+ if ( pBoxInfoItem->IsDist() )
+ {
+ if( rSet.GetItemState( nWhichBox, TRUE ) >= SFX_ITEM_DEFAULT )
+ {
+ BOOL bIsAnyBorderVisible = aFrameSel.IsAnyBorderVisible();
+ if( !bIsAnyBorderVisible || !pBoxInfoItem->IsMinDist() )
+ {
+ aLeftMF.SetMin( 0 );
+ aLeftMF.SetFirst( 0 );
+ aRightMF.SetMin( 0 );
+ aRightMF.SetFirst( 0 );
+ aTopMF.SetMin( 0 );
+ aTopMF.SetFirst( 0 );
+ aBottomMF.SetMin( 0 );
+ aBottomMF.SetFirst( 0 );
+ }
+ long nLeftDist = pBoxItem->GetDistance( BOX_LINE_LEFT);
+ SetMetricValue( aLeftMF, nLeftDist, eCoreUnit );
+ long nRightDist = pBoxItem->GetDistance( BOX_LINE_RIGHT);
+ SetMetricValue( aRightMF, nRightDist, eCoreUnit );
+ long nTopDist = pBoxItem->GetDistance( BOX_LINE_TOP);
+ SetMetricValue( aTopMF, nTopDist, eCoreUnit );
+ long nBottomDist = pBoxItem->GetDistance( BOX_LINE_BOTTOM);
+ SetMetricValue( aBottomMF, nBottomDist, eCoreUnit );
+
+ // ist der Abstand auf nicht-default gesetzt,
+ // dann soll der Wert auch nicht
+ // mehr autom. veraendert werden
+
+ // if the distance is set with no active border line
+ // or it is null with an active border line
+ // no automatic changes should be made
+ const long nDefDist = bIsAnyBorderVisible ? pBoxInfoItem->GetDefDist() : 0;
+ BOOL bDiffDist = (nDefDist != nLeftDist ||
+ nDefDist != nRightDist ||
+ nDefDist != nTopDist ||
+ nDefDist != nBottomDist);
+ if((pBoxItem->GetDistance() ||
+ bIsAnyBorderVisible) && bDiffDist )
+ {
+ aLeftMF.SetModifyFlag();
+ aRightMF.SetModifyFlag();
+ aTopMF.SetModifyFlag();
+ aBottomMF.SetModifyFlag();
+ }
+ }
+ else
+ {
+ // #106224# different margins -> do not fill the edits
+ aLeftMF.SetText( String() );
+ aRightMF.SetText( String() );
+ aTopMF.SetText( String() );
+ aBottomMF.SetText( String() );
+ }
+ }
+ aLeftMF.SaveValue();
+ aRightMF.SaveValue();
+ aTopMF.SaveValue();
+ aBottomMF.SaveValue();
+ }
+ }
+ }
+ else
+ {
+ // ResetFrameLine-Aufrufe einsparen:
+ aFrameSel.HideAllBorders();
+ }
+
+ //-------------------------------------------------------------
+ // Linie/Linienfarbe in Controllern darstellen, wenn eindeutig:
+ //-------------------------------------------------------------
+ {
+ // Do all visible lines show the same line widths?
+ USHORT nPrim, nDist, nSecn;
+ bool bWidthEq = aFrameSel.GetVisibleWidth( nPrim, nDist, nSecn );
+ if( bWidthEq )
+ aLbLineStyle.SelectEntry( nPrim * 100, nSecn * 100, nDist * 100 );
+ else
+ aLbLineStyle.SelectEntryPos( 1 );
+
+ // Do all visible lines show the same line color?
+ Color aColor;
+ bool bColorEq = aFrameSel.GetVisibleColor( aColor );
+ if( !bColorEq )
+ aColor.SetColor( COL_BLACK );
+
+ USHORT nSelPos = aLbLineColor.GetEntryPos( aColor );
+ if( nSelPos == LISTBOX_ENTRY_NOTFOUND )
+ nSelPos = aLbLineColor.InsertEntry( aColor, SVX_RESSTR( RID_SVXSTR_COLOR_USER ) );
+
+ aLbLineColor.SelectEntryPos( nSelPos );
+ aLbLineStyle.SetColor( aColor );
+
+ // Select all visible lines, if they are all equal.
+ if( bWidthEq && bColorEq )
+ aFrameSel.SelectAllVisibleBorders();
+
+ // set the current style and color (caches style in control even if nothing is selected)
+ SelStyleHdl_Impl( &aLbLineStyle );
+ SelColHdl_Impl( &aLbLineColor );
+ }
+
+ BOOL bEnable = aWndShadows.GetSelectItemId() > 1 ;
+ aFtShadowSize.Enable(bEnable);
+ aEdShadowSize.Enable(bEnable);
+ aFtShadowColor.Enable(bEnable);
+ aLbShadowColor.Enable(bEnable);
+
+ aWndPresets.SetNoSelection();
+
+ // - keine Line - sollte nicht selektiert sein
+
+ if ( aLbLineStyle.GetSelectEntryPos() == 0 )
+ {
+ aLbLineStyle.SelectEntryPos( 1 );
+ SelStyleHdl_Impl( &aLbLineStyle );
+ }
+
+ const SfxPoolItem* pItem;
+ SfxObjectShell* pShell;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem) ||
+ ( 0 != (pShell = SfxObjectShell::Current()) &&
+ 0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
+ {
+ USHORT nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
+ if(nHtmlMode & HTMLMODE_ON)
+ {
+ //Im Html-Mode gibt es keinen Schatten und nur komplette Umrandungen
+ aFtShadowPos .Disable();
+ aWndShadows .Disable();
+ aFtShadowSize .Disable();
+ aEdShadowSize .Disable();
+ aFtShadowColor.Disable();
+ aLbShadowColor.Disable();
+ aFlShadow .Disable();
+
+ USHORT nLBCount = aLbLineStyle.GetEntryCount();
+ // ist es ein Absatzdialog, dann alle Linien fuer
+ // Sw-Export, sonst ist die Page nicht da
+ if(!(mbHorEnabled || mbVerEnabled)
+ && 0 == (nHtmlMode & HTMLMODE_FULL_ABS_POS) &&
+ SFX_ITEM_AVAILABLE > rSet.GetItemState(GetWhich( SID_ATTR_PARA_LINESPACE )))
+ {
+ for( USHORT i = nLBCount - 1; i > LINESTYLE_HTML_MAX; --i)
+ aLbLineStyle.RemoveEntry(i);
+ }
+
+ if( !(nSWMode & SW_BORDER_MODE_TABLE) )
+ {
+ aUserDefFT.Disable();
+ aFrameSel.Disable();
+ aWndPresets.RemoveItem(3);
+ aWndPresets.RemoveItem(4);
+ aWndPresets.RemoveItem(5);
+ }
+ }
+ }
+
+ LinesChanged_Impl( 0 );
+}
+
+// -----------------------------------------------------------------------
+
+int SvxBorderTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+#define IS_DONT_CARE(a) ((a).GetState() == svx::FRAMESTATE_DONTCARE )
+
+BOOL SvxBorderTabPage::FillItemSet( SfxItemSet& rCoreAttrs )
+{
+ bool bAttrsChanged = SfxTabPage::FillItemSet( rCoreAttrs );
+
+ BOOL bPut = TRUE;
+ USHORT nBoxWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+ USHORT nBoxInfoWhich = rCoreAttrs.GetPool()->GetWhich( SID_ATTR_BORDER_INNER, sal_False );
+ const SfxItemSet& rOldSet = GetItemSet();
+ SvxBoxItem aBoxItem ( nBoxWhich );
+ SvxBoxInfoItem aBoxInfoItem ( nBoxInfoWhich );
+ SvxBoxItem* pOldBoxItem = (SvxBoxItem*)GetOldItem( rCoreAttrs, SID_ATTR_BORDER_OUTER );
+
+ SfxMapUnit eCoreUnit = rOldSet.GetPool()->GetMetric( nBoxWhich );
+ const SfxPoolItem* pOld = 0;
+
+ //------------------
+ // Umrandung aussen:
+ //------------------
+ typedef ::std::pair<svx::FrameBorderType,USHORT> TBorderPair;
+ TBorderPair eTypes1[] = {
+ TBorderPair(svx::FRAMEBORDER_TOP,BOX_LINE_TOP),
+ TBorderPair(svx::FRAMEBORDER_BOTTOM,BOX_LINE_BOTTOM),
+ TBorderPair(svx::FRAMEBORDER_LEFT,BOX_LINE_LEFT),
+ TBorderPair(svx::FRAMEBORDER_RIGHT,BOX_LINE_RIGHT),
+ };
+
+ for (sal_uInt32 i=0; i < sizeof(eTypes1)/sizeof(TBorderPair); ++i)
+ aBoxItem.SetLine( aFrameSel.GetFrameBorderStyle( eTypes1[i].first ), eTypes1[i].second );
+
+ //--------------------------------
+ // Umrandung hor/ver und TableFlag
+ //--------------------------------
+ TBorderPair eTypes2[] = {
+ TBorderPair(svx::FRAMEBORDER_HOR,BOXINFO_LINE_HORI),
+ TBorderPair(svx::FRAMEBORDER_VER,BOXINFO_LINE_VERT)
+ };
+ for (sal_uInt32 j=0; j < sizeof(eTypes2)/sizeof(TBorderPair); ++j)
+ aBoxInfoItem.SetLine( aFrameSel.GetFrameBorderStyle( eTypes2[j].first ), eTypes2[j].second );
+
+ aBoxInfoItem.EnableHor( mbHorEnabled );
+ aBoxInfoItem.EnableVer( mbVerEnabled );
+
+ //-------------------
+ // Abstand nach Innen
+ //-------------------
+ if( aLeftMF.IsVisible() )
+ {
+ // #i40405# enable distance controls for next dialog call
+ aBoxInfoItem.SetDist( TRUE );
+
+ if( !mbUseMarginItem )
+ {
+ // #106224# all edits empty: do nothing
+ if( aLeftMF.GetText().Len() || aRightMF.GetText().Len() ||
+ aTopMF.GetText().Len() || aBottomMF.GetText().Len() )
+ {
+ if ( ((mbHorEnabled || mbVerEnabled || (nSWMode & SW_BORDER_MODE_TABLE)) &&
+ (aLeftMF.IsModified()||aRightMF.IsModified()||
+ aTopMF.IsModified()||aBottomMF.IsModified()) )||
+ aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_TOP ) != svx::FRAMESTATE_HIDE
+ || aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_BOTTOM ) != svx::FRAMESTATE_HIDE
+ || aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_LEFT ) != svx::FRAMESTATE_HIDE
+ || aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_RIGHT ) != svx::FRAMESTATE_HIDE )
+ {
+ SvxBoxInfoItem* pOldBoxInfoItem = (SvxBoxInfoItem*)GetOldItem(
+ rCoreAttrs, SID_ATTR_BORDER_INNER );
+ if (
+ !pOldBoxItem ||
+ aLeftMF .GetText() != aLeftMF .GetSavedValue() ||
+ aRightMF .GetText() != aRightMF .GetSavedValue() ||
+ aTopMF .GetText() != aTopMF .GetSavedValue() ||
+ aBottomMF.GetText() != aBottomMF.GetSavedValue() ||
+ nMinValue == aLeftMF .GetValue() ||
+ nMinValue == aRightMF .GetValue() ||
+ nMinValue == aTopMF .GetValue() ||
+ nMinValue == aBottomMF.GetValue() ||
+ (pOldBoxInfoItem && !pOldBoxInfoItem->IsValid(VALID_DISTANCE))
+ )
+ {
+ aBoxItem.SetDistance( (USHORT)GetCoreValue( aLeftMF, eCoreUnit ), BOX_LINE_LEFT );
+ aBoxItem.SetDistance( (USHORT)GetCoreValue( aRightMF, eCoreUnit ), BOX_LINE_RIGHT );
+ aBoxItem.SetDistance( (USHORT)GetCoreValue( aTopMF, eCoreUnit ), BOX_LINE_TOP );
+ aBoxItem.SetDistance( (USHORT)GetCoreValue( aBottomMF, eCoreUnit ), BOX_LINE_BOTTOM);
+ }
+ else
+ {
+ aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_LEFT ), BOX_LINE_LEFT);
+ aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_RIGHT), BOX_LINE_RIGHT);
+ aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_TOP ), BOX_LINE_TOP);
+ aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_BOTTOM), BOX_LINE_BOTTOM);
+ }
+ aBoxInfoItem.SetValid( VALID_DISTANCE, TRUE );
+ }
+ else
+ aBoxInfoItem.SetValid( VALID_DISTANCE, FALSE );
+ }
+ }
+ }
+
+ //------------------------------------------
+ // Don't Care Status im Info-Item vermerken:
+ //------------------------------------------
+ aBoxInfoItem.SetValid( VALID_TOP, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_TOP ) != svx::FRAMESTATE_DONTCARE );
+ aBoxInfoItem.SetValid( VALID_BOTTOM, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_BOTTOM ) != svx::FRAMESTATE_DONTCARE );
+ aBoxInfoItem.SetValid( VALID_LEFT, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_LEFT ) != svx::FRAMESTATE_DONTCARE );
+ aBoxInfoItem.SetValid( VALID_RIGHT, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_RIGHT ) != svx::FRAMESTATE_DONTCARE );
+ aBoxInfoItem.SetValid( VALID_HORI, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_HOR ) != svx::FRAMESTATE_DONTCARE );
+ aBoxInfoItem.SetValid( VALID_VERT, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_VER ) != svx::FRAMESTATE_DONTCARE );
+
+ //
+ // Put oder Clear der Umrandung?
+ //
+ bPut = TRUE;
+
+ if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nBoxWhich, FALSE ))
+ {
+ bPut = aBoxItem != (const SvxBoxItem&)(rOldSet.Get(nBoxWhich)) ? sal_True : sal_False;
+ }
+ if( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nBoxInfoWhich, FALSE ) )
+ {
+ const SvxBoxInfoItem& rOldBoxInfo = (const SvxBoxInfoItem&)
+ rOldSet.Get(nBoxInfoWhich);
+
+ aBoxInfoItem.SetMinDist( rOldBoxInfo.IsMinDist() );
+ aBoxInfoItem.SetDefDist( rOldBoxInfo.GetDefDist() );
+ bPut |= (aBoxInfoItem != rOldBoxInfo );
+ }
+
+ if ( bPut )
+ {
+ if ( !pOldBoxItem || !( *pOldBoxItem == aBoxItem ) )
+ {
+ rCoreAttrs.Put( aBoxItem );
+ bAttrsChanged |= TRUE;
+ }
+ pOld = GetOldItem( rCoreAttrs, SID_ATTR_BORDER_INNER, sal_False );
+
+ if ( !pOld || !( *(const SvxBoxInfoItem*)pOld == aBoxInfoItem ) )
+ {
+ rCoreAttrs.Put( aBoxInfoItem );
+ bAttrsChanged |= TRUE;
+ }
+ }
+ else
+ {
+ rCoreAttrs.ClearItem( nBoxWhich );
+ rCoreAttrs.ClearItem( nBoxInfoWhich );
+ }
+
+ return bAttrsChanged;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxBorderTabPage::HideShadowControls()
+{
+ aFtShadowPos.Hide();
+ aWndShadows.Hide();
+ aFtShadowSize.Hide();
+ aEdShadowSize.Hide();
+ aFtShadowColor.Hide();
+ aLbShadowColor.Hide();
+ aFlShadow.Hide();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxBorderTabPage, SelPreHdl_Impl, void *, EMPTYARG )
+{
+ const svx::FrameBorderState SHOW = svx::FRAMESTATE_SHOW;
+ const svx::FrameBorderState HIDE = svx::FRAMESTATE_HIDE;
+ const svx::FrameBorderState DONT = svx::FRAMESTATE_DONTCARE;
+
+ static const svx::FrameBorderState ppeStates[][ svx::FRAMEBORDERTYPE_COUNT ] =
+ { /* Left Right Top Bot Hor Ver TLBR BLTR */
+/* ---------------------+--------------------------------------------------- */
+/* IID_PRE_CELL_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
+/* IID_PRE_CELL_ALL */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
+/* IID_PRE_CELL_LR */ { SHOW, SHOW, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
+/* IID_PRE_CELL_TB */ { HIDE, HIDE, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
+/* IID_PRE_CELL_L */ { SHOW, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
+/* IID_PRE_CELL_DIAG */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, SHOW, SHOW },
+/* IID_PRE_HOR_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
+/* IID_PRE_HOR_OUTER */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
+/* IID_PRE_HOR_HOR */ { HIDE, HIDE, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE },
+/* IID_PRE_HOR_ALL */ { SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE },
+/* IID_PRE_HOR_OUTER2 */ { SHOW, SHOW, SHOW, SHOW, DONT, HIDE, HIDE, HIDE },
+/* IID_PRE_VER_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
+/* IID_PRE_VER_OUTER */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
+/* IID_PRE_VER_VER */ { SHOW, SHOW, HIDE, HIDE, HIDE, SHOW, HIDE, HIDE },
+/* IID_PRE_VER_ALL */ { SHOW, SHOW, SHOW, SHOW, HIDE, SHOW, HIDE, HIDE },
+/* IID_PRE_VER_OUTER2 */ { SHOW, SHOW, SHOW, SHOW, HIDE, DONT, HIDE, HIDE },
+/* IID_PRE_TABLE_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
+/* IID_PRE_TABLE_OUTER */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
+/* IID_PRE_TABLE_OUTERH */ { SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE },
+/* IID_PRE_TABLE_ALL */ { SHOW, SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE },
+/* IID_PRE_TABLE_OUTER2 */ { SHOW, SHOW, SHOW, SHOW, DONT, DONT, HIDE, HIDE }
+ };
+
+ // first hide and deselect all frame borders
+ aFrameSel.HideAllBorders();
+ aFrameSel.DeselectAllBorders();
+
+ // Using image ID to find correct line in table above.
+ USHORT nLine = GetPresetImageId( aWndPresets.GetSelectItemId() ) - 1;
+
+ // Apply all styles from the table
+ for( int nBorder = 0; nBorder < svx::FRAMEBORDERTYPE_COUNT; ++nBorder )
+ {
+ svx::FrameBorderType eBorder = svx::GetFrameBorderTypeFromIndex( nBorder );
+ switch( ppeStates[ nLine ][ nBorder ] )
+ {
+ case SHOW: aFrameSel.SelectBorder( eBorder ); break;
+ case HIDE: /* nothing to do */ break;
+ case DONT: aFrameSel.SetBorderDontCare( eBorder ); break;
+ }
+ }
+
+ // Show all lines that have been selected above
+ if( aFrameSel.IsAnyBorderSelected() )
+ {
+ // any visible style, but "no-line" in line list box? -> use hair-line
+ if( (aLbLineStyle.GetSelectEntryPos() == 0) || (aLbLineStyle.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND) )
+ aLbLineStyle.SelectEntryPos( 1 );
+
+ // set current style to all previously selected lines
+ SelStyleHdl_Impl( &aLbLineStyle );
+ SelColHdl_Impl( &aLbLineColor );
+ }
+
+ // Presets ValueSet does not show a selection (used as push buttons).
+ aWndPresets.SetNoSelection();
+
+ LinesChanged_Impl( 0 );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxBorderTabPage, SelSdwHdl_Impl, void *, EMPTYARG )
+{
+ BOOL bEnable = aWndShadows.GetSelectItemId() > 1;
+ aFtShadowSize.Enable(bEnable);
+ aEdShadowSize.Enable(bEnable);
+ aFtShadowColor.Enable(bEnable);
+ aLbShadowColor.Enable(bEnable);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxBorderTabPage, SelColHdl_Impl, ListBox *, pLb )
+{
+ ColorListBox* pColLb = (ColorListBox*)pLb;
+
+ if ( pLb == &aLbLineColor )
+ {
+ aFrameSel.SetColorToSelection( pColLb->GetSelectEntryColor() );
+ aLbLineStyle.SetColor( pColLb->GetSelectEntryColor() );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxBorderTabPage, SelStyleHdl_Impl, ListBox *, pLb )
+{
+ if ( pLb == &aLbLineStyle )
+ aFrameSel.SetStyleToSelection(
+ static_cast< USHORT >( aLbLineStyle.GetSelectEntryLine1() / 100 ),
+ static_cast< USHORT >( aLbLineStyle.GetSelectEntryDistance() / 100 ),
+ static_cast< USHORT >( aLbLineStyle.GetSelectEntryLine2() / 100 ) );
+
+ return 0;
+}
+
+// ============================================================================
+// ValueSet handling
+// ============================================================================
+
+// number of preset images to show
+const USHORT SVX_BORDER_PRESET_COUNT = 5;
+
+// number of shadow images to show
+const USHORT SVX_BORDER_SHADOW_COUNT = 5;
+
+// ----------------------------------------------------------------------------
+
+USHORT SvxBorderTabPage::GetPresetImageId( USHORT nValueSetIdx ) const
+{
+ // table with all sets of predefined border styles
+ static const USHORT ppnImgIds[][ SVX_BORDER_PRESET_COUNT ] =
+ {
+ // simple cell without diagonal frame borders
+ { IID_PRE_CELL_NONE, IID_PRE_CELL_ALL, IID_PRE_CELL_LR, IID_PRE_CELL_TB, IID_PRE_CELL_L },
+ // simple cell with diagonal frame borders
+ { IID_PRE_CELL_NONE, IID_PRE_CELL_ALL, IID_PRE_CELL_LR, IID_PRE_CELL_TB, IID_PRE_CELL_DIAG },
+ // with horizontal inner frame border
+ { IID_PRE_HOR_NONE, IID_PRE_HOR_OUTER, IID_PRE_HOR_HOR, IID_PRE_HOR_ALL, IID_PRE_HOR_OUTER2 },
+ // with vertical inner frame border
+ { IID_PRE_VER_NONE, IID_PRE_VER_OUTER, IID_PRE_VER_VER, IID_PRE_VER_ALL, IID_PRE_VER_OUTER2 },
+ // with horizontal and vertical inner frame borders
+ { IID_PRE_TABLE_NONE, IID_PRE_TABLE_OUTER, IID_PRE_TABLE_OUTERH, IID_PRE_TABLE_ALL, IID_PRE_TABLE_OUTER2 }
+ };
+
+ // find correct set of presets
+ int nLine = 0;
+ if( !mbHorEnabled && !mbVerEnabled )
+ nLine = (mbTLBREnabled || mbBLTREnabled) ? 1 : 0;
+ else if( mbHorEnabled && !mbVerEnabled )
+ nLine = 2;
+ else if( !mbHorEnabled && mbVerEnabled )
+ nLine = 3;
+ else
+ nLine = 4;
+
+ DBG_ASSERT( (1 <= nValueSetIdx) && (nValueSetIdx <= SVX_BORDER_PRESET_COUNT),
+ "SvxBorderTabPage::GetPresetImageId - wrong index" );
+ return ppnImgIds[ nLine ][ nValueSetIdx - 1 ];
+}
+
+USHORT SvxBorderTabPage::GetPresetStringId( USHORT nValueSetIdx ) const
+{
+ // string resource IDs for each image (in order of the IID_PRE_* image IDs)
+ static const USHORT pnStrIds[] =
+ {
+ RID_SVXSTR_TABLE_PRESET_NONE,
+ RID_SVXSTR_PARA_PRESET_ALL,
+ RID_SVXSTR_PARA_PRESET_LEFTRIGHT,
+ RID_SVXSTR_PARA_PRESET_TOPBOTTOM,
+ RID_SVXSTR_PARA_PRESET_ONLYLEFT,
+ RID_SVXSTR_PARA_PRESET_DIAGONAL,
+
+ RID_SVXSTR_TABLE_PRESET_NONE,
+ RID_SVXSTR_TABLE_PRESET_ONLYOUTER,
+ RID_SVXSTR_HOR_PRESET_ONLYHOR,
+ RID_SVXSTR_TABLE_PRESET_OUTERALL,
+ RID_SVXSTR_TABLE_PRESET_OUTERINNER,
+
+ RID_SVXSTR_TABLE_PRESET_NONE,
+ RID_SVXSTR_TABLE_PRESET_ONLYOUTER,
+ RID_SVXSTR_VER_PRESET_ONLYVER,
+ RID_SVXSTR_TABLE_PRESET_OUTERALL,
+ RID_SVXSTR_TABLE_PRESET_OUTERINNER,
+
+ RID_SVXSTR_TABLE_PRESET_NONE,
+ RID_SVXSTR_TABLE_PRESET_ONLYOUTER,
+ RID_SVXSTR_TABLE_PRESET_OUTERHORI,
+ RID_SVXSTR_TABLE_PRESET_OUTERALL,
+ RID_SVXSTR_TABLE_PRESET_OUTERINNER
+ };
+ return pnStrIds[ GetPresetImageId( nValueSetIdx ) - 1 ];
+}
+
+// ----------------------------------------------------------------------------
+
+void SvxBorderTabPage::FillPresetVS()
+{
+ // find correct image list
+ bool bDark = aWndPresets.GetDisplayBackground().GetColor().IsDark();
+ ImageList& rImgList = bDark ? aBorderImgLstH : aBorderImgLst;
+ Size aImgSize( rImgList.GetImage( IID_PRE_CELL_NONE ).GetSizePixel() );
+
+ // basic initialization of the ValueSet
+ aWndPresets.SetColCount( SVX_BORDER_PRESET_COUNT );
+ aWndPresets.SetStyle( aWndPresets.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
+ aWndPresets.SetSizePixel( aWndPresets.CalcWindowSizePixel( aImgSize ) );
+
+ // insert images and help texts
+ for( USHORT nVSIdx = 1; nVSIdx <= SVX_BORDER_PRESET_COUNT; ++nVSIdx )
+ {
+ aWndPresets.InsertItem( nVSIdx );
+ aWndPresets.SetItemImage( nVSIdx, rImgList.GetImage( GetPresetImageId( nVSIdx ) ) );
+ aWndPresets.SetItemText( nVSIdx, SVX_RESSTR( GetPresetStringId( nVSIdx ) ) );
+ }
+
+ // show the control
+ aWndPresets.SetNoSelection();
+ aWndPresets.Show();
+}
+
+// ----------------------------------------------------------------------------
+
+void SvxBorderTabPage::FillShadowVS()
+{
+ // find correct image list
+ bool bDark = aWndShadows.GetDisplayBackground().GetColor().IsDark();
+ ImageList& rImgList = bDark ? aShadowImgLstH : aShadowImgLst;
+ Size aImgSize( rImgList.GetImage( IID_SHADOWNONE ).GetSizePixel() );
+
+ // basic initialization of the ValueSet
+ aWndShadows.SetColCount( SVX_BORDER_SHADOW_COUNT );
+ aWndShadows.SetStyle( aWndShadows.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
+ aWndShadows.SetSizePixel( aWndShadows.CalcWindowSizePixel( aImgSize ) );
+
+ // image resource IDs
+ static const USHORT pnImgIds[ SVX_BORDER_SHADOW_COUNT ] =
+ { IID_SHADOWNONE, IID_SHADOW_BOT_RIGHT, IID_SHADOW_TOP_RIGHT, IID_SHADOW_BOT_LEFT, IID_SHADOW_TOP_LEFT };
+ // string resource IDs for each image
+ static const USHORT pnStrIds[ SVX_BORDER_SHADOW_COUNT ] =
+ { RID_SVXSTR_SHADOW_STYLE_NONE, RID_SVXSTR_SHADOW_STYLE_BOTTOMRIGHT, RID_SVXSTR_SHADOW_STYLE_TOPRIGHT, RID_SVXSTR_SHADOW_STYLE_BOTTOMLEFT, RID_SVXSTR_SHADOW_STYLE_TOPLEFT };
+
+ // insert images and help texts
+ for( USHORT nVSIdx = 1; nVSIdx <= SVX_BORDER_SHADOW_COUNT; ++nVSIdx )
+ {
+ aWndShadows.InsertItem( nVSIdx );
+ aWndShadows.SetItemImage( nVSIdx, rImgList.GetImage( pnImgIds[ nVSIdx - 1 ] ) );
+ aWndShadows.SetItemText( nVSIdx, SVX_RESSTR( pnStrIds[ nVSIdx - 1 ] ) );
+ }
+
+ // show the control
+ aWndShadows.SelectItem( 1 );
+ aWndShadows.Show();
+}
+
+// ----------------------------------------------------------------------------
+
+void SvxBorderTabPage::FillValueSets()
+{
+ FillPresetVS();
+ FillShadowVS();
+}
+
+// ============================================================================
+
+void SvxBorderTabPage::FillLineListBox_Impl()
+{
+ aLbLineStyle.SetUnit( FUNIT_POINT );
+ aLbLineStyle.SetSourceUnit( FUNIT_TWIP );
+
+ // Writer 2.0 Defaults:
+ aLbLineStyle.InsertEntry( SVX_RESSTR( STR_NONE ) );
+
+ aLbLineStyle.InsertEntry( LINE_WIDTH0 );
+ aLbLineStyle.InsertEntry( LINE_WIDTH5 );
+ aLbLineStyle.InsertEntry( LINE_WIDTH1 );
+ aLbLineStyle.InsertEntry( LINE_WIDTH2 );
+ aLbLineStyle.InsertEntry( LINE_WIDTH3 );
+ aLbLineStyle.InsertEntry( LINE_WIDTH4 );
+
+ // OS: wenn hier neue Linienstaerken zugfuegt werden, dann
+ // LINESTYLE_HTML_MAX anpassen
+
+ aLbLineStyle.InsertEntry( DLINE0_OUT, DLINE0_IN, DLINE0_DIST );
+ aLbLineStyle.InsertEntry( DLINE7_OUT, DLINE7_IN, DLINE7_DIST );
+ aLbLineStyle.InsertEntry( DLINE1_OUT, DLINE1_IN, DLINE1_DIST );
+ aLbLineStyle.InsertEntry( DLINE2_OUT, DLINE2_IN, DLINE2_DIST );
+ aLbLineStyle.InsertEntry( DLINE8_OUT, DLINE8_IN, DLINE8_DIST );
+ aLbLineStyle.InsertEntry( DLINE9_OUT, DLINE9_IN, DLINE9_DIST );
+ aLbLineStyle.InsertEntry( DLINE10_OUT,DLINE10_IN,DLINE10_DIST);
+ aLbLineStyle.InsertEntry( DLINE3_OUT, DLINE3_IN, DLINE3_DIST );
+ aLbLineStyle.InsertEntry( DLINE4_OUT, DLINE4_IN, DLINE4_DIST );
+ aLbLineStyle.InsertEntry( DLINE5_OUT, DLINE5_IN, DLINE5_DIST );
+ aLbLineStyle.InsertEntry( DLINE6_OUT, DLINE6_IN, DLINE6_DIST );
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( SvxBorderTabPage, LinesChanged_Impl, void*, EMPTYARG )
+{
+ if(!mbUseMarginItem && aLeftMF.IsVisible())
+ {
+ BOOL bLineSet = aFrameSel.IsAnyBorderVisible();
+ BOOL bMinAllowed = 0 != (nSWMode & (SW_BORDER_MODE_FRAME|SW_BORDER_MODE_TABLE));
+ BOOL bSpaceModified = aLeftMF .IsModified()||
+ aRightMF .IsModified()||
+ aTopMF .IsModified()||
+ aBottomMF.IsModified();
+
+ if(bLineSet)
+ {
+ if(!bMinAllowed)
+ {
+ aLeftMF .SetFirst(nMinValue);
+ aRightMF .SetFirst(nMinValue);
+ aTopMF .SetFirst(nMinValue);
+ aBottomMF.SetFirst(nMinValue);
+ }
+ if(!bSpaceModified)
+ {
+ aLeftMF .SetValue(nMinValue);
+ aRightMF .SetValue(nMinValue);
+ aTopMF .SetValue(nMinValue);
+ aBottomMF.SetValue(nMinValue);
+ }
+ }
+ else
+ {
+ aLeftMF .SetMin(0);
+ aRightMF .SetMin(0);
+ aTopMF .SetMin(0);
+ aBottomMF.SetMin(0);
+ aLeftMF .SetFirst(0);
+ aRightMF .SetFirst(0);
+ aTopMF .SetFirst(0);
+ aBottomMF.SetFirst(0);
+ if(!bSpaceModified)
+ {
+ aLeftMF .SetValue(0);
+ aRightMF .SetValue(0);
+ aTopMF .SetValue(0);
+ aBottomMF.SetValue(0);
+ }
+ }
+ //fuer Tabellen ist alles erlaubt
+ USHORT nValid = VALID_TOP|VALID_BOTTOM|VALID_LEFT|VALID_RIGHT;
+
+ //fuer Rahmen und Absatz wird das Edit disabled, wenn keine Border gesetzt ist
+ if(nSWMode & (SW_BORDER_MODE_FRAME|SW_BORDER_MODE_PARA))
+ {
+ if(bLineSet)
+ {
+ nValid = (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_TOP) == svx::FRAMESTATE_SHOW) ? VALID_TOP : 0;
+ nValid |= (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_BOTTOM) == svx::FRAMESTATE_SHOW) ? VALID_BOTTOM : 0;
+ nValid |= (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_LEFT) == svx::FRAMESTATE_SHOW) ? VALID_LEFT : 0;
+ nValid |= (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_RIGHT ) == svx::FRAMESTATE_SHOW) ? VALID_RIGHT : 0;
+ }
+ else
+ nValid = 0;
+ }
+ aLeftFT.Enable(0 != (nValid&VALID_LEFT));
+ aRightFT.Enable(0 != (nValid&VALID_RIGHT));
+ aTopFT.Enable(0 != (nValid&VALID_TOP));
+ aBottomFT.Enable(0 != (nValid&VALID_BOTTOM));
+ aLeftMF.Enable(0 != (nValid&VALID_LEFT));
+ aRightMF.Enable(0 != (nValid&VALID_RIGHT));
+ aTopMF.Enable(0 != (nValid&VALID_TOP));
+ aBottomMF.Enable(0 != (nValid&VALID_BOTTOM));
+ aSynchronizeCB.Enable( aRightMF.IsEnabled() || aTopMF.IsEnabled() ||
+ aBottomMF.IsEnabled() || aLeftMF.IsEnabled() );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxBorderTabPage, ModifyDistanceHdl_Impl, MetricField*, pField)
+{
+ if ( bSync )
+ {
+ sal_Int64 nVal = pField->GetValue();
+ if(pField != &aLeftMF)
+ aLeftMF.SetValue(nVal);
+ if(pField != &aRightMF)
+ aRightMF.SetValue(nVal);
+ if(pField != &aTopMF)
+ aTopMF.SetValue(nVal);
+ if(pField != &aBottomMF)
+ aBottomMF.SetValue(nVal);
+ }
+ return 0;
+}
+
+IMPL_LINK( SvxBorderTabPage, SyncHdl_Impl, CheckBox*, pBox)
+{
+ bSync = pBox->IsChecked();
+ return 0;
+}
+
+/* -----------------------------03.06.2002 10:15------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxBorderTabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ FillValueSets();
+
+ SfxTabPage::DataChanged( rDCEvt );
+}
+
+void SvxBorderTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pSWModeItem,SfxUInt16Item,SID_SWMODE_TYPE,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False);
+ if (pSWModeItem)
+ {
+ nSWMode = pSWModeItem->GetValue();
+ // --> OD 2005-03-01 #i43593#
+ // show checkbox <aMergeWithNextCB> for format.paragraph
+ if ( nSWMode == SW_BORDER_MODE_PARA )
+ {
+ aMergeWithNextCB.Show();
+ aPropertiesFL.Show();
+ }
+ // show checkbox <aMergeAdjacentBordersCB> for format.paragraph
+ else if ( nSWMode == SW_BORDER_MODE_TABLE )
+ {
+ aMergeAdjacentBordersCB.Show();
+ aPropertiesFL.Show();
+ }
+ // <--
+ }
+ if (pFlagItem)
+ if ( ( pFlagItem->GetValue() & SVX_HIDESHADOWCTL ) == SVX_HIDESHADOWCTL )
+ HideShadowControls();
+}
+
+// ============================================================================
+
diff --git a/cui/source/tabpages/border.hrc b/cui/source/tabpages/border.hrc
new file mode 100644
index 000000000000..7ba1b8cfc757
--- /dev/null
+++ b/cui/source/tabpages/border.hrc
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * 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: border.hrc,v $
+ * $Revision: 1.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.
+ *
+ ************************************************************************/
+#ifndef _SVX_BORDER_HRC
+#define _SVX_BORDER_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FL_BORDER 10
+#define WIN_PRESETS 11
+#define WIN_FRAMESEL 12
+
+#define FL_SEPARATOR1 19
+#define FL_LINE 20
+#define LB_LINESTYLE 21
+#define LB_LINECOLOR 22
+
+#define FL_SEPARATOR2 29
+#define FL_SHADOW 30
+#define FT_SHADOWPOS 31
+#define WIN_SHADOWS 32
+#define FT_SHADOWSIZE 33
+#define ED_SHADOWSIZE 34
+#define FT_SHADOWCOLOR 35
+#define LB_SHADOWCOLOR 36
+
+#define FT_XSPACE 41
+#define ED_XSPACE 42
+
+#define FL_DISTANCE 50
+#define FT_LEFT 51
+#define MF_LEFT 52
+#define FT_RIGHT 53
+#define MF_RIGHT 54
+#define FT_TOP 55
+#define MF_TOP 56
+#define FT_BOTTOM 57
+#define MF_BOTTOM 58
+#define CB_SYNC 59
+#define FT_DEFAULT 60
+#define FT_USERDEF 61
+#define FT_STYLE 62
+#define FT_COLOR 63
+#define FL_PROPERTIES 64
+#define CB_MERGEWITHNEXT 65
+#define CB_MERGEADJACENTBORDERS 66
+
+// ImageListe fuer ValueSets:
+#define IL_PRE_BITMAPS 1400
+#define ILH_PRE_BITMAPS 1401
+#define IID_PRE_CELL_NONE 1
+#define IID_PRE_CELL_ALL 2
+#define IID_PRE_CELL_LR 3
+#define IID_PRE_CELL_TB 4
+#define IID_PRE_CELL_L 5
+#define IID_PRE_CELL_DIAG 6
+#define IID_PRE_HOR_NONE 7
+#define IID_PRE_HOR_OUTER 8
+#define IID_PRE_HOR_HOR 9
+#define IID_PRE_HOR_ALL 10
+#define IID_PRE_HOR_OUTER2 11
+#define IID_PRE_VER_NONE 12
+#define IID_PRE_VER_OUTER 13
+#define IID_PRE_VER_VER 14
+#define IID_PRE_VER_ALL 15
+#define IID_PRE_VER_OUTER2 16
+#define IID_PRE_TABLE_NONE 17
+#define IID_PRE_TABLE_OUTER 18
+#define IID_PRE_TABLE_OUTERH 19
+#define IID_PRE_TABLE_ALL 20
+#define IID_PRE_TABLE_OUTER2 21
+
+#define IL_SDW_BITMAPS 1500
+#define ILH_SDW_BITMAPS 1501
+#define IID_SHADOWNONE 1
+#define IID_SHADOW_BOT_RIGHT 2
+#define IID_SHADOW_BOT_LEFT 3
+#define IID_SHADOW_TOP_RIGHT 4
+#define IID_SHADOW_TOP_LEFT 5
+
+
+#endif
+
diff --git a/cui/source/tabpages/border.src b/cui/source/tabpages/border.src
new file mode 100644
index 000000000000..27f977a6dc3b
--- /dev/null
+++ b/cui/source/tabpages/border.src
@@ -0,0 +1,431 @@
+/*************************************************************************
+ *
+ * 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: border.src,v $
+ * $Revision: 1.64 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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.hrc"
+#include <svx/dialogs.hrc>
+#include "border.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // define ---------------------------------------------------------------
+#define STD_MASKCOLOR Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; }
+ // RID_SVXPAGE_BORDER ---------------------------------------------------
+TabPage RID_SVXPAGE_BORDER
+{
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Helpid = HID_BORDER ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Borders" ;
+ FixedLine FL_BORDER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Line arrangement" ;
+ };
+ FixedText FT_DEFAULT
+ {
+ Pos = MAP_APPFONT ( 12, 14) ;
+ Size = MAP_APPFONT ( 64, 8) ;
+ Text [ en-US ] = "~Default";
+ };
+ Control WIN_PRESETS
+ {
+ HelpId = HID_BORDER_CTL_PRESETS ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 61 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_USERDEF
+ {
+ Pos = MAP_APPFONT (12 , 41) ;
+ Size = MAP_APPFONT ( 64, 8) ;
+ Text [ en-US ] = "~User-defined";
+ };
+ Control WIN_FRAMESEL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Size = MAP_APPFONT ( 61 , 65 ) ;
+ TabStop = TRUE ;
+ Text = "Border control";
+ };
+ FixedLine FL_SEPARATOR1
+ {
+ Pos = MAP_APPFONT ( 77 , 14 ) ;
+ Size = MAP_APPFONT ( 4 , 104 ) ;
+ Vert = TRUE ;
+ };
+ FixedLine FL_LINE
+ {
+ Pos = MAP_APPFONT ( 82 , 3 ) ;
+ Size = MAP_APPFONT ( 83 , 8 ) ;
+ Text [ en-US ] = "Line" ;
+ };
+ FixedText FT_STYLE
+ {
+ Pos = MAP_APPFONT ( 88, 14) ;
+ Size = MAP_APPFONT ( 77, 8) ;
+ Text [ en-US ] = "St~yle";
+ };
+ ListBox LB_LINESTYLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 25 ) ;
+ Size = MAP_APPFONT ( 74 , 66 ) ;
+ };
+ FixedText FT_COLOR
+ {
+ Pos = MAP_APPFONT ( 88, 95 ) ;
+ Size = MAP_APPFONT ( 77, 8 ) ;
+ Text [ en-US ] = "~Color";
+ };
+ ListBox LB_LINECOLOR
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 106 ) ;
+ Size = MAP_APPFONT ( 74 , 68 ) ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ FixedLine FL_SEPARATOR2
+ {
+ Pos = MAP_APPFONT ( 166 , 14 ) ;
+ Size = MAP_APPFONT ( 4 , 104 ) ;
+ Vert = TRUE ;
+ };
+ FixedText FT_LEFT
+ {
+ Pos = MAP_APPFONT ( 177 , 16 ) ;
+ Size = MAP_APPFONT ( 34 , 8 ) ;
+ Text [ en-US ] = "~Left";
+ };
+ MetricField MF_LEFT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 213 , 14 ) ;
+ Size = MAP_APPFONT ( 38 , 12 ) ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ SpinSize = 10 ;
+ First = 100 ;
+ Last = 5000 ;
+ Maximum = 5000 ;
+ Minimum = 0 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ };
+ FixedText FT_RIGHT
+ {
+ Pos = MAP_APPFONT ( 177 , 32 ) ;
+ Size = MAP_APPFONT ( 34 , 8 ) ;
+ Text [ en-US ] = "Right";
+ };
+ MetricField MF_RIGHT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 213 , 30 ) ;
+ Size = MAP_APPFONT ( 38 , 12 ) ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ SpinSize = 10 ;
+ First = 100 ;
+ Last = 5000 ;
+ Maximum = 5000 ;
+ Minimum = 0 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ };
+ FixedText FT_TOP
+ {
+ Pos = MAP_APPFONT ( 177 , 48 ) ;
+ Size = MAP_APPFONT ( 34 , 8 ) ;
+ Text [ en-US ] = "~Top";
+ };
+ MetricField MF_TOP
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 213 , 46 ) ;
+ Size = MAP_APPFONT ( 38 , 12 ) ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ SpinSize = 10 ;
+ First = 100 ;
+ Last = 5000 ;
+ Maximum = 5000 ;
+ Minimum = 0 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ };
+ FixedText FT_BOTTOM
+ {
+ Pos = MAP_APPFONT ( 177 , 64 ) ;
+ Size = MAP_APPFONT ( 34 , 8 ) ;
+ Text [ en-US ] = "~Bottom";
+ };
+ MetricField MF_BOTTOM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 213 , 62 ) ;
+ Size = MAP_APPFONT ( 38 , 12 ) ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ SpinSize = 10 ;
+ First = 100 ;
+ Last = 5000 ;
+ Maximum = 5000 ;
+ Minimum = 0 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ };
+ CheckBox CB_SYNC
+ {
+ Pos = MAP_APPFONT ( 177 , 78 ) ;
+ Size = MAP_APPFONT ( 74 , 10 ) ;
+ Text [ en-US ] = "Synchronize";
+ };
+ FixedLine FL_DISTANCE
+ {
+ Pos = MAP_APPFONT ( 171 , 3 ) ;
+ Size = MAP_APPFONT ( 83 , 8 ) ;
+ Text [ en-US ] = "Spacing to contents";
+ };
+
+ FixedText FT_SHADOWPOS
+ {
+ Pos = MAP_APPFONT ( 12 , 133 ) ;
+ Size = MAP_APPFONT ( 74 , 8 ) ;
+ Text [ en-US ] = "~Position" ;
+ };
+ Control WIN_SHADOWS
+ {
+ HelpId = HID_BORDER_CTL_SHADOWS ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 144 ) ;
+ Size = MAP_APPFONT ( 74 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_SHADOWSIZE
+ {
+ Pos = MAP_APPFONT ( 88 , 133 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Distan~ce";
+ };
+ MetricField ED_SHADOWSIZE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 144 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ SpinSize = 10 ;
+ First = 100 ;
+ Last = 5000 ;
+ Maximum = 5000 ;
+ Minimum = 50 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ };
+ FixedText FT_SHADOWCOLOR
+ {
+ Pos = MAP_APPFONT ( 177 , 133 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "C~olor" ;
+ };
+ ListBox LB_SHADOWCOLOR
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 177 , 144 ) ;
+ Size = MAP_APPFONT ( 74 , 68 ) ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ FixedLine FL_SHADOW
+ {
+ Pos = MAP_APPFONT ( 6 , 123 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Shadow style" ;
+ };
+ FixedLine FL_PROPERTIES
+ {
+ Pos = MAP_APPFONT ( 6 , 162 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Properties" ;
+ };
+ CheckBox CB_MERGEWITHNEXT
+ {
+ Pos = MAP_APPFONT ( 12 , 173 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "~Merge with next paragraph" ;
+ };
+ CheckBox CB_MERGEADJACENTBORDERS
+ {
+ Pos = MAP_APPFONT ( 12 , 173 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "~Merge adjacent line styles" ;
+ };
+
+#define _PREVIEW_IDLIST_ \
+ IdList = \
+ { \
+ IID_PRE_CELL_NONE ; \
+ IID_PRE_CELL_ALL ; \
+ IID_PRE_CELL_LR ; \
+ IID_PRE_CELL_TB ; \
+ IID_PRE_CELL_L ; \
+ IID_PRE_CELL_DIAG ; \
+ IID_PRE_HOR_NONE ; \
+ IID_PRE_HOR_OUTER ; \
+ IID_PRE_HOR_HOR ; \
+ IID_PRE_HOR_ALL ; \
+ IID_PRE_HOR_OUTER2 ; \
+ IID_PRE_VER_NONE ; \
+ IID_PRE_VER_OUTER ; \
+ IID_PRE_VER_VER ; \
+ IID_PRE_VER_ALL ; \
+ IID_PRE_VER_OUTER2 ; \
+ IID_PRE_TABLE_NONE ; \
+ IID_PRE_TABLE_OUTER ; \
+ IID_PRE_TABLE_OUTERH ; \
+ IID_PRE_TABLE_ALL ; \
+ IID_PRE_TABLE_OUTER2 ; \
+ }; \
+ IdCount = { 21 ; };
+
+ ImageList IL_PRE_BITMAPS
+ {
+ Prefix = "pr";
+ MaskColor = STD_MASKCOLOR ;
+ _PREVIEW_IDLIST_
+ };
+ ImageList ILH_PRE_BITMAPS
+ {
+ Prefix = "prh";
+ MaskColor = STD_MASKCOLOR ;
+ _PREVIEW_IDLIST_
+ };
+
+#define _SHADOW_IDLIST_ \
+ IdList = \
+ { \
+ IID_SHADOWNONE ; \
+ IID_SHADOW_BOT_RIGHT ; \
+ IID_SHADOW_BOT_LEFT ; \
+ IID_SHADOW_TOP_RIGHT ; \
+ IID_SHADOW_TOP_LEFT ; \
+ }; \
+ IdCount = { 5 ; };
+
+ ImageList IL_SDW_BITMAPS
+ {
+ Prefix = "sh";
+ MaskColor = STD_MASKCOLOR ;
+ _SHADOW_IDLIST_
+ };
+ ImageList ILH_SDW_BITMAPS
+ {
+ Prefix = "shh";
+ MaskColor = STD_MASKCOLOR ;
+ _SHADOW_IDLIST_
+ };
+};
+
+String RID_SVXSTR_TABLE_PRESET_NONE
+{
+ Text [ en-US ] = "Set No Borders" ;
+};
+String RID_SVXSTR_TABLE_PRESET_ONLYOUTER
+{
+ Text [ en-US ] = "Set Outer Border Only" ;
+};
+String RID_SVXSTR_TABLE_PRESET_OUTERHORI
+{
+ Text [ en-US ] = "Set Outer Border and Horizontal Lines" ;
+};
+String RID_SVXSTR_TABLE_PRESET_OUTERALL
+{
+ Text [ en-US ] = "Set Outer Border and All Inner Lines" ;
+};
+String RID_SVXSTR_TABLE_PRESET_OUTERINNER
+{
+ Text [ en-US ] = "Set Outer Border Without Changing Inner Lines" ;
+};
+String RID_SVXSTR_PARA_PRESET_DIAGONAL
+{
+ Text [ en-US ] = "Set Diagonal Lines Only" ;
+};
+String RID_SVXSTR_PARA_PRESET_ALL
+{
+ Text [ en-US ] = "Set All Four Borders" ;
+};
+String RID_SVXSTR_PARA_PRESET_LEFTRIGHT
+{
+ Text [ en-US ] = "Set Left and Right Borders Only" ;
+};
+String RID_SVXSTR_PARA_PRESET_TOPBOTTOM
+{
+ Text [ en-US ] = "Set Top and Bottom Borders Only" ;
+};
+String RID_SVXSTR_PARA_PRESET_ONLYLEFT
+{
+ Text [ en-US ] = "Set Left Border Only" ;
+};
+String RID_SVXSTR_HOR_PRESET_ONLYHOR
+{
+ Text [ en-US ] = "Set Top and Bottom Borders, and All Inner Lines";
+};
+String RID_SVXSTR_VER_PRESET_ONLYVER
+{
+ Text [ en-US ] = "Set Left and Right Borders, and All Inner Lines";
+};
+String RID_SVXSTR_SHADOW_STYLE_NONE
+{
+ Text [ en-US ] = "No Shadow" ;
+};
+String RID_SVXSTR_SHADOW_STYLE_BOTTOMRIGHT
+{
+ Text [ en-US ] = "Cast Shadow to Bottom Right" ;
+};
+String RID_SVXSTR_SHADOW_STYLE_TOPRIGHT
+{
+ Text [ en-US ] = "Cast Shadow to Top Right" ;
+};
+String RID_SVXSTR_SHADOW_STYLE_BOTTOMLEFT
+{
+ Text [ en-US ] = "Cast Shadow to Bottom Left" ;
+};
+String RID_SVXSTR_SHADOW_STYLE_TOPLEFT
+{
+ Text [ en-US ] = "Cast Shadow to Top Left" ;
+};
+
+// **********************************************************************
diff --git a/cui/source/tabpages/borderconn.cxx b/cui/source/tabpages/borderconn.cxx
new file mode 100644
index 000000000000..c117e631abbd
--- /dev/null
+++ b/cui/source/tabpages/borderconn.cxx
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * 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: borderconn.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "borderconn.hxx"
+#include <svx/frmsel.hxx>
+#include "svx/bolnitem.hxx"
+#include <svx/boxitem.hxx>
+#include <svx/algitem.hxx>
+#include <svx/shaditem.hxx>
+
+namespace svx {
+
+/* ============================================================================
+SvxLineItem connection
+----------------------
+Connects an SvxLineItem (that contains the style of one line of a cell border)
+with one frame border from a svx::FrameSelector control. If this connection is
+used, no additional code is needed in the Reset() and FillItemSet() functions
+of the tab page.
+============================================================================ */
+
+// 1st: item wrappers ---------------------------------------------------------
+
+class LineItemWrapper : public sfx::SingleItemWrapper< SvxLineItem, const SvxBorderLine* >
+{
+public:
+ inline explicit LineItemWrapper( USHORT nSlot ) : SingleItemWrapperType( nSlot ) {}
+
+ virtual const SvxBorderLine* GetItemValue( const SvxLineItem& rItem ) const
+ { return rItem.GetLine(); }
+ virtual void SetItemValue( SvxLineItem& rItem, const SvxBorderLine* pLine ) const
+ { rItem.SetLine( pLine ); }
+};
+
+// 2nd: control wrappers ------------------------------------------------------
+
+class FrameSelectorWrapper : public sfx::SingleControlWrapper< FrameSelector, const SvxBorderLine* >
+{
+public:
+ inline explicit FrameSelectorWrapper( FrameSelector& rFrameSel, FrameBorderType eBorder ) :
+ SingleControlWrapperType( rFrameSel ), meBorder( eBorder ) {}
+
+ virtual bool IsControlDontKnow() const;
+ virtual void SetControlDontKnow( bool bSet );
+
+ virtual const SvxBorderLine* GetControlValue() const;
+ virtual void SetControlValue( const SvxBorderLine* pLine );
+
+private:
+ FrameBorderType meBorder; /// The line this wrapper works with.
+};
+
+bool FrameSelectorWrapper::IsControlDontKnow() const
+{
+ return GetControl().GetFrameBorderState( meBorder ) == FRAMESTATE_DONTCARE;
+}
+
+void FrameSelectorWrapper::SetControlDontKnow( bool bSet )
+{
+ if( bSet )
+ GetControl().SetBorderDontCare( meBorder );
+}
+
+const SvxBorderLine* FrameSelectorWrapper::GetControlValue() const
+{
+ return GetControl().GetFrameBorderStyle( meBorder );
+}
+
+void FrameSelectorWrapper::SetControlValue( const SvxBorderLine* pLine )
+{
+ GetControl().ShowBorder( meBorder, pLine );
+}
+
+// 3rd: connection ------------------------------------------------------------
+
+typedef sfx::ItemControlConnection< LineItemWrapper, FrameSelectorWrapper > FrameLineConnection;
+
+/* ============================================================================
+SvxMarginItem connection
+------------------------
+Connects an SvxMarginItem (that contains the inner margin of all cell borders)
+with the numerical edit controls of the SvxBorderTabPage. If this connection is
+used, no additional code is needed in the Reset() and FillItemSet() functions
+of the tab page.
+============================================================================ */
+
+// 1st: item wrappers ---------------------------------------------------------
+
+typedef sfx::IdentItemWrapper< SvxMarginItem > MarginItemWrapper;
+
+// 2nd: control wrappers ------------------------------------------------------
+
+class MarginControlsWrapper : public sfx::MultiControlWrapper< SvxMarginItem >
+{
+public:
+ explicit MarginControlsWrapper(
+ MetricField& rMfLeft, MetricField& rMfRight,
+ MetricField& rMfTop, MetricField& rMfBottom );
+
+ virtual SvxMarginItem GetControlValue() const;
+ virtual void SetControlValue( SvxMarginItem aItem );
+
+private:
+ sfx::Int16MetricFieldWrapper maLeftWrp;
+ sfx::Int16MetricFieldWrapper maRightWrp;
+ sfx::Int16MetricFieldWrapper maTopWrp;
+ sfx::Int16MetricFieldWrapper maBottomWrp;
+};
+
+MarginControlsWrapper::MarginControlsWrapper(
+ MetricField& rMfLeft, MetricField& rMfRight, MetricField& rMfTop, MetricField& rMfBottom ) :
+ maLeftWrp( rMfLeft, FUNIT_TWIP ),
+ maRightWrp( rMfRight, FUNIT_TWIP ),
+ maTopWrp( rMfTop, FUNIT_TWIP ),
+ maBottomWrp( rMfBottom, FUNIT_TWIP )
+{
+ RegisterControlWrapper( maLeftWrp );
+ RegisterControlWrapper( maRightWrp );
+ RegisterControlWrapper( maTopWrp );
+ RegisterControlWrapper( maBottomWrp );
+}
+
+SvxMarginItem MarginControlsWrapper::GetControlValue() const
+{
+ SvxMarginItem aItem( GetDefaultValue() );
+ if( !maLeftWrp.IsControlDontKnow() )
+ aItem.SetLeftMargin( maLeftWrp.GetControlValue() );
+ if( !maRightWrp.IsControlDontKnow() )
+ aItem.SetRightMargin( maRightWrp.GetControlValue() );
+ if( !maTopWrp.IsControlDontKnow() )
+ aItem.SetTopMargin( maTopWrp.GetControlValue() );
+ if( !maBottomWrp.IsControlDontKnow() )
+ aItem.SetBottomMargin( maBottomWrp.GetControlValue() );
+ return aItem;
+}
+
+void MarginControlsWrapper::SetControlValue( SvxMarginItem aItem )
+{
+ maLeftWrp.SetControlValue( aItem.GetLeftMargin() );
+ maRightWrp.SetControlValue( aItem.GetRightMargin() );
+ maTopWrp.SetControlValue( aItem.GetTopMargin() );
+ maBottomWrp.SetControlValue( aItem.GetBottomMargin() );
+}
+
+// 3rd: connection ------------------------------------------------------------
+
+class MarginConnection : public sfx::ItemControlConnection< MarginItemWrapper, MarginControlsWrapper >
+{
+public:
+ explicit MarginConnection( const SfxItemSet& rItemSet,
+ MetricField& rMfLeft, MetricField& rMfRight,
+ MetricField& rMfTop, MetricField& rMfBottom,
+ sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT );
+};
+
+MarginConnection::MarginConnection( const SfxItemSet& rItemSet,
+ MetricField& rMfLeft, MetricField& rMfRight, MetricField& rMfTop, MetricField& rMfBottom,
+ sfx::ItemConnFlags nFlags ) :
+ ItemControlConnectionType( SID_ATTR_ALIGN_MARGIN, new MarginControlsWrapper( rMfLeft, rMfRight, rMfTop, rMfBottom ), nFlags )
+{
+ mxCtrlWrp->SetDefaultValue( maItemWrp.GetDefaultItem( rItemSet ) );
+}
+
+/* ============================================================================
+SvxShadowItem connection
+------------------------
+Connects an SvxShadowItem (that contains shadow position, size, and color) with
+the controls of the SvxBorderTabPage. If this connection is used, no additional
+code is needed in the Reset() and FillItemSet() functions of the tab page.
+============================================================================ */
+
+// 1st: item wrappers ---------------------------------------------------------
+
+typedef sfx::IdentItemWrapper< SvxShadowItem > ShadowItemWrapper;
+
+// 2nd: control wrappers ------------------------------------------------------
+
+typedef sfx::ValueSetWrapper< SvxShadowLocation > ShadowPosWrapper;
+static const ShadowPosWrapper::MapEntryType s_pShadowPosMap[] =
+{
+ { 1, SVX_SHADOW_NONE },
+ { 2, SVX_SHADOW_BOTTOMRIGHT },
+ { 3, SVX_SHADOW_TOPRIGHT },
+ { 4, SVX_SHADOW_BOTTOMLEFT },
+ { 5, SVX_SHADOW_TOPLEFT },
+ { VALUESET_ITEM_NOTFOUND, SVX_SHADOW_NONE }
+};
+
+class ShadowControlsWrapper : public sfx::MultiControlWrapper< SvxShadowItem >
+{
+public:
+ explicit ShadowControlsWrapper( ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor );
+
+ virtual SvxShadowItem GetControlValue() const;
+ virtual void SetControlValue( SvxShadowItem aItem );
+
+private:
+ ShadowPosWrapper maPosWrp;
+ sfx::UShortMetricFieldWrapper maSizeWrp;
+ sfx::ColorListBoxWrapper maColorWrp;
+};
+
+ShadowControlsWrapper::ShadowControlsWrapper(
+ ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ) :
+ maPosWrp( rVsPos, s_pShadowPosMap ),
+ maSizeWrp( rMfSize, FUNIT_TWIP ),
+ maColorWrp( rLbColor )
+{
+ RegisterControlWrapper( maPosWrp );
+ RegisterControlWrapper( maSizeWrp );
+ RegisterControlWrapper( maColorWrp );
+}
+
+SvxShadowItem ShadowControlsWrapper::GetControlValue() const
+{
+ SvxShadowItem aItem( GetDefaultValue() );
+ if( !maPosWrp.IsControlDontKnow() )
+ aItem.SetLocation( maPosWrp.GetControlValue() );
+ if( !maSizeWrp.IsControlDontKnow() )
+ aItem.SetWidth( maSizeWrp.GetControlValue() );
+ if( !maColorWrp.IsControlDontKnow() )
+ aItem.SetColor( maColorWrp.GetControlValue() );
+ return aItem;
+}
+
+void ShadowControlsWrapper::SetControlValue( SvxShadowItem aItem )
+{
+ maPosWrp.SetControlValue( aItem.GetLocation() );
+ maSizeWrp.SetControlValue( aItem.GetWidth() );
+ maColorWrp.SetControlValue( aItem.GetColor() );
+}
+
+// 3rd: connection ------------------------------------------------------------
+
+class ShadowConnection : public sfx::ItemControlConnection< ShadowItemWrapper, ShadowControlsWrapper >
+{
+public:
+ explicit ShadowConnection( const SfxItemSet& rItemSet,
+ ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor,
+ sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT );
+};
+
+ShadowConnection::ShadowConnection( const SfxItemSet& rItemSet,
+ ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor, sfx::ItemConnFlags nFlags ) :
+ ItemControlConnectionType( SID_ATTR_BORDER_SHADOW, new ShadowControlsWrapper( rVsPos, rMfSize, rLbColor ), nFlags )
+{
+ mxCtrlWrp->SetDefaultValue( maItemWrp.GetDefaultItem( rItemSet ) );
+}
+
+// ============================================================================
+// ============================================================================
+
+sfx::ItemConnectionBase* CreateFrameLineConnection( USHORT nSlot,
+ FrameSelector& rFrameSel, FrameBorderType eBorder, sfx::ItemConnFlags nFlags )
+{
+ return new FrameLineConnection( nSlot, new FrameSelectorWrapper( rFrameSel, eBorder ), nFlags );
+}
+
+sfx::ItemConnectionBase* CreateFrameBoxConnection( USHORT /*nBoxSlot*/, USHORT /*nBoxInfoSlot*/,
+ FrameSelector& /*rFrameSel*/, FrameBorderType /*eBorder*/, sfx::ItemConnFlags /*nFlags*/ )
+{
+ DBG_ERRORFILE( "svx::CreateFrameBoxConnection - not implemented" );
+ return 0;
+}
+
+sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet,
+ MetricField& rMfLeft, MetricField& rMfRight,
+ MetricField& rMfTop, MetricField& rMfBottom,
+ sfx::ItemConnFlags nFlags )
+{
+ return new MarginConnection( rItemSet, rMfLeft, rMfRight, rMfTop, rMfBottom, nFlags );
+}
+
+sfx::ItemConnectionBase* CreateShadowConnection( const SfxItemSet& rItemSet,
+ ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor,
+ sfx::ItemConnFlags nFlags )
+{
+ return new ShadowConnection( rItemSet, rVsPos, rMfSize, rLbColor, nFlags );
+}
+
+// ============================================================================
+
+} // namespace svx
+
diff --git a/cui/source/tabpages/borderconn.hxx b/cui/source/tabpages/borderconn.hxx
new file mode 100644
index 000000000000..740c9c79f283
--- /dev/null
+++ b/cui/source/tabpages/borderconn.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * 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: borderconn.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_BORDERCONN_HXX
+#define SVX_BORDERCONN_HXX
+
+#include <sfx2/itemconnect.hxx>
+#include <svx/framebordertype.hxx>
+
+class SfxItemSet;
+class MetricField;
+class ValueSet;
+class ColorListBox;
+
+namespace svx {
+
+class FrameSelector;
+
+// ============================================================================
+
+/** Creates an item connection object that connects an SvxLineItem with an
+ svx::FrameSelector control. */
+sfx::ItemConnectionBase* CreateFrameLineConnection( USHORT nSlot,
+ FrameSelector& rFrameSel, FrameBorderType eBorder,
+ sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT );
+
+/** Creates an item connection object that connects an SvxBoxItem and an
+ SvxBoxInfoItem with an svx::FrameSelector control. */
+sfx::ItemConnectionBase* CreateFrameBoxConnection(
+ USHORT nBoxSlot, USHORT nBoxInfoSlot,
+ FrameSelector& rFrameSel, FrameBorderType eBorder,
+ sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT );
+
+/** Creates an item connection object that connects an SvxMarginItem with the
+ controls of the SvxBorderTabPage. */
+sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet,
+ MetricField& rMfLeft, MetricField& rMfRight,
+ MetricField& rMfTop, MetricField& rMfBottom,
+ sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT );
+
+/** Creates an item connection object that connects an SvxShadowItem with the
+ controls of the SvxBorderTabPage. */
+sfx::ItemConnectionBase* CreateShadowConnection( const SfxItemSet& rItemSet,
+ ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor,
+ sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT );
+
+// ============================================================================
+
+} // namespace svx
+
+#endif
+
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
new file mode 100644
index 000000000000..f942e9db6a43
--- /dev/null
+++ b/cui/source/tabpages/chardlg.cxx
@@ -0,0 +1,4066 @@
+/*************************************************************************
+ *
+ * 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: chardlg.cxx,v $
+ * $Revision: 1.102.148.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <svx/unolingu.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svl/sfontitm.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <vcl/msgbox.hxx>
+
+#define _SVX_CHARDLG_CXX
+#include <svl/languageoptions.hxx>
+
+#include <svx/dialogs.hrc>
+#include <svx/svxitems.hrc>
+#include "chardlg.hrc"
+
+//Erstmal definieren, damit die Klassendeklarionen angezogen werden.
+
+#include <svx/xtable.hxx> // XColorTable
+#include "chardlg.hxx"
+#include "svx/fontitem.hxx"
+#include <svx/postitem.hxx>
+#include <svx/udlnitem.hxx>
+#include <svx/crsditem.hxx>
+#include <svx/cntritem.hxx>
+#include <svx/langitem.hxx>
+#include <svx/wghtitem.hxx>
+#include <svx/fhgtitem.hxx>
+#include <svx/shdditem.hxx>
+#include <svx/escpitem.hxx>
+#include <svx/prszitem.hxx>
+#include <svx/wrlmitem.hxx>
+#include <svx/cmapitem.hxx>
+#include <svx/kernitem.hxx>
+#include <svx/blnkitem.hxx>
+#include "svx/flstitem.hxx"
+#include <svx/akrnitem.hxx>
+#include <svx/brshitem.hxx>
+#include <svx/colritem.hxx>
+#include "svx/drawitem.hxx"
+#include "svx/dlgutil.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/htmlmode.hxx"
+#include "cuicharmap.hxx"
+#include "chardlg.h"
+#include <svx/emphitem.hxx>
+#include <svx/charreliefitem.hxx>
+#include <svx/twolinesitem.hxx>
+#include <svx/charhiddenitem.hxx>
+#include <svl/stritem.hxx>
+#include <svx/charscaleitem.hxx>
+#include <svx/charrotateitem.hxx>
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialogs.hrc> //CHINA001
+#include <svl/intitem.hxx> //CHINA001
+#include <sfx2/request.hxx> //CHINA001
+#include "svx/flagsdef.hxx" //CHINA001
+
+using namespace ::com::sun::star;
+
+// define ----------------------------------------------------------------
+
+#define ISITEMSET rSet.GetItemState(nWhich)>=SFX_ITEM_DEFAULT
+
+#define CLEARTITEM rSet.InvalidateItem(nWhich)
+
+#define LW_NORMAL 0
+#define LW_GESPERRT 1
+#define LW_SCHMAL 2
+
+// static ----------------------------------------------------------------
+
+static USHORT pNameRanges[] =
+{
+ SID_ATTR_CHAR_FONT,
+ SID_ATTR_CHAR_WEIGHT,
+ SID_ATTR_CHAR_FONTHEIGHT,
+ SID_ATTR_CHAR_FONTHEIGHT,
+ SID_ATTR_CHAR_COLOR,
+ SID_ATTR_CHAR_COLOR,
+ SID_ATTR_CHAR_LANGUAGE,
+ SID_ATTR_CHAR_LANGUAGE,
+ SID_ATTR_CHAR_CJK_FONT,
+ SID_ATTR_CHAR_CJK_WEIGHT,
+ SID_ATTR_CHAR_CTL_FONT,
+ SID_ATTR_CHAR_CTL_WEIGHT,
+ 0
+};
+
+static USHORT pEffectsRanges[] =
+{
+ SID_ATTR_CHAR_SHADOWED,
+ SID_ATTR_CHAR_UNDERLINE,
+ SID_ATTR_CHAR_COLOR,
+ SID_ATTR_CHAR_COLOR,
+ SID_ATTR_CHAR_CASEMAP,
+ SID_ATTR_CHAR_CASEMAP,
+ SID_ATTR_FLASH,
+ SID_ATTR_FLASH,
+ SID_ATTR_CHAR_EMPHASISMARK,
+ SID_ATTR_CHAR_EMPHASISMARK,
+ SID_ATTR_CHAR_RELIEF,
+ SID_ATTR_CHAR_RELIEF,
+ SID_ATTR_CHAR_HIDDEN,
+ SID_ATTR_CHAR_HIDDEN,
+ SID_ATTR_CHAR_OVERLINE,
+ SID_ATTR_CHAR_OVERLINE,
+ 0
+};
+
+static USHORT pPositionRanges[] =
+{
+ SID_ATTR_CHAR_KERNING,
+ SID_ATTR_CHAR_KERNING,
+ SID_ATTR_CHAR_ESCAPEMENT,
+ SID_ATTR_CHAR_ESCAPEMENT,
+ SID_ATTR_CHAR_AUTOKERN,
+ SID_ATTR_CHAR_AUTOKERN,
+ SID_ATTR_CHAR_ROTATED,
+ SID_ATTR_CHAR_SCALEWIDTH,
+ SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
+ SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
+ 0
+};
+
+static USHORT pTwoLinesRanges[] =
+{
+ SID_ATTR_CHAR_TWO_LINES,
+ SID_ATTR_CHAR_TWO_LINES,
+ 0
+};
+
+// C-Funktion ------------------------------------------------------------
+
+inline BOOL StateToAttr( TriState aState )
+{
+ return ( STATE_CHECK == aState );
+}
+
+// class SvxCharBasePage -------------------------------------------------
+
+inline SvxFont& SvxCharBasePage::GetPreviewFont()
+{
+ return m_aPreviewWin.GetFont();
+}
+
+// -----------------------------------------------------------------------
+
+inline SvxFont& SvxCharBasePage::GetPreviewCJKFont()
+{
+ return m_aPreviewWin.GetCJKFont();
+}
+// -----------------------------------------------------------------------
+
+inline SvxFont& SvxCharBasePage::GetPreviewCTLFont()
+{
+ return m_aPreviewWin.GetCTLFont();
+}
+
+// -----------------------------------------------------------------------
+
+SvxCharBasePage::SvxCharBasePage( Window* pParent, const ResId& rResId, const SfxItemSet& rItemset,
+ USHORT nResIdPrewievWin, USHORT nResIdFontTypeFT ):
+ SfxTabPage( pParent, rResId, rItemset ),
+ m_aPreviewWin( this, ResId( nResIdPrewievWin, *rResId.GetResMgr() ) ),
+ m_aFontTypeFT( this, ResId( nResIdFontTypeFT, *rResId.GetResMgr() ) ),
+ m_bPreviewBackgroundToCharacter( FALSE )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxCharBasePage::~SvxCharBasePage()
+{
+}
+
+// -----------------------------------------------------------------------
+
+//void SvxCharBasePage::SetPrevFontAttributes( const SfxItemSet& rSet )
+void SvxCharBasePage::ActivatePage( const SfxItemSet& rSet )
+{
+ SvxFont& rFont = GetPreviewFont();
+ SvxFont& rCJKFont = GetPreviewCJKFont();
+ SvxFont& rCTLFont = GetPreviewCTLFont();
+ USHORT nWhich;
+
+ nWhich = GetWhich( SID_CHAR_DLG_PREVIEW_STRING );
+ if( ISITEMSET )
+ {
+ const SfxStringItem& rItem = ( SfxStringItem& ) rSet.Get( nWhich );
+ ::rtl::OUString aString = rItem.GetValue();
+ if( aString.getLength() != 0 )
+ m_aPreviewWin.SetPreviewText( aString );
+ else
+ m_aPreviewWin.SetFontNameAsPreviewText();
+ }
+
+ // Underline
+ FontUnderline eUnderline;
+ nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE );
+ if( ISITEMSET )
+ {
+ const SvxUnderlineItem& rItem = ( SvxUnderlineItem& ) rSet.Get( nWhich );
+ eUnderline = ( FontUnderline ) rItem.GetValue();
+ m_aPreviewWin.SetTextLineColor( rItem.GetColor() );
+ }
+ else
+ eUnderline = UNDERLINE_NONE;
+
+ rFont.SetUnderline( eUnderline );
+ rCJKFont.SetUnderline( eUnderline );
+ rCTLFont.SetUnderline( eUnderline );
+
+ // Overline
+ FontUnderline eOverline;
+ nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE );
+ if( ISITEMSET )
+ {
+ const SvxOverlineItem& rItem = ( SvxOverlineItem& ) rSet.Get( nWhich );
+ eOverline = ( FontUnderline ) rItem.GetValue();
+ m_aPreviewWin.SetOverlineColor( rItem.GetColor() );
+ }
+ else
+ eOverline = UNDERLINE_NONE;
+
+ rFont.SetOverline( eOverline );
+ rCJKFont.SetOverline( eOverline );
+ rCTLFont.SetOverline( eOverline );
+
+ // Strikeout
+ FontStrikeout eStrikeout;
+ nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT );
+ if( ISITEMSET )
+ {
+ const SvxCrossedOutItem& rItem = ( SvxCrossedOutItem& ) rSet.Get( nWhich );
+ eStrikeout = ( FontStrikeout ) rItem.GetValue();
+ }
+ else
+ eStrikeout = STRIKEOUT_NONE;
+
+ rFont.SetStrikeout( eStrikeout );
+ rCJKFont.SetStrikeout( eStrikeout );
+ rCTLFont.SetStrikeout( eStrikeout );
+
+ // WordLineMode
+ nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE );
+ if( ISITEMSET )
+ {
+ const SvxWordLineModeItem& rItem = ( SvxWordLineModeItem& ) rSet.Get( nWhich );
+ rFont.SetWordLineMode( rItem.GetValue() );
+ rCJKFont.SetWordLineMode( rItem.GetValue() );
+ rCTLFont.SetWordLineMode( rItem.GetValue() );
+ }
+
+ // Emphasis
+ nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK );
+ if( ISITEMSET )
+ {
+ const SvxEmphasisMarkItem& rItem = ( SvxEmphasisMarkItem& ) rSet.Get( nWhich );
+ FontEmphasisMark eMark = rItem.GetEmphasisMark();
+ rFont.SetEmphasisMark( eMark );
+ rCJKFont.SetEmphasisMark( eMark );
+ rCTLFont.SetEmphasisMark( eMark );
+ }
+
+ // Relief
+ nWhich = GetWhich( SID_ATTR_CHAR_RELIEF );
+ if( ISITEMSET )
+ {
+ const SvxCharReliefItem& rItem = ( SvxCharReliefItem& ) rSet.Get( nWhich );
+ FontRelief eFontRelief = ( FontRelief ) rItem.GetValue();
+ rFont.SetRelief( eFontRelief );
+ rCJKFont.SetRelief( eFontRelief );
+ rCTLFont.SetRelief( eFontRelief );
+ }
+
+ // Effects
+ nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP );
+ if( ISITEMSET )
+ {
+ const SvxCaseMapItem& rItem = ( SvxCaseMapItem& ) rSet.Get( nWhich );
+ SvxCaseMap eCaseMap = ( SvxCaseMap ) rItem.GetValue();
+ rFont.SetCaseMap( eCaseMap );
+ rCJKFont.SetCaseMap( eCaseMap );
+ // #i78474# small caps do not exist in CTL fonts
+ rCTLFont.SetCaseMap( eCaseMap == SVX_CASEMAP_KAPITAELCHEN ? SVX_CASEMAP_NOT_MAPPED : eCaseMap );
+ }
+
+ // Outline
+ nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR );
+ if( ISITEMSET )
+ {
+ const SvxContourItem& rItem = ( SvxContourItem& ) rSet.Get( nWhich );
+ BOOL bOutline = rItem.GetValue();
+ rFont.SetOutline( bOutline );
+ rCJKFont.SetOutline( bOutline );
+ rCTLFont.SetOutline( bOutline );
+ }
+
+ // Shadow
+ nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED );
+ if( ISITEMSET )
+ {
+ const SvxShadowedItem& rItem = ( SvxShadowedItem& ) rSet.Get( nWhich );
+ BOOL bShadow = rItem.GetValue();
+ rFont.SetShadow( bShadow );
+ rCJKFont.SetShadow( bShadow );
+ rCTLFont.SetShadow( bShadow );
+ }
+
+ // Background
+ BOOL bTransparent;
+ nWhich = GetWhich( m_bPreviewBackgroundToCharacter ? SID_ATTR_BRUSH : SID_ATTR_BRUSH_CHAR );
+ if( ISITEMSET )
+ {
+ const SvxBrushItem& rBrush = ( SvxBrushItem& ) rSet.Get( nWhich );
+ const Color& rColor = rBrush.GetColor();
+ bTransparent = rColor.GetTransparency() > 0;
+ rFont.SetFillColor( rColor );
+ rCJKFont.SetFillColor( rColor );
+ rCTLFont.SetFillColor( rColor );
+ }
+ else
+ bTransparent = TRUE;
+
+ rFont.SetTransparent( bTransparent );
+ rCJKFont.SetTransparent( bTransparent );
+ rCTLFont.SetTransparent( bTransparent );
+
+ Color aBackCol( COL_TRANSPARENT );
+ if( !m_bPreviewBackgroundToCharacter )
+ {
+ nWhich = GetWhich( SID_ATTR_BRUSH );
+ if( ISITEMSET )
+ {
+ const SvxBrushItem& rBrush = ( SvxBrushItem& ) rSet.Get( nWhich );
+ if( GPOS_NONE == rBrush.GetGraphicPos() )
+ aBackCol = rBrush.GetColor();
+ }
+ }
+ m_aPreviewWin.SetBackColor( aBackCol );
+
+ // Font
+ SetPrevFont( rSet, SID_ATTR_CHAR_FONT, rFont );
+ SetPrevFont( rSet, SID_ATTR_CHAR_CJK_FONT, rCJKFont );
+ SetPrevFont( rSet, SID_ATTR_CHAR_CTL_FONT, rCTLFont );
+
+ // Style
+ SetPrevFontStyle( rSet, SID_ATTR_CHAR_POSTURE, SID_ATTR_CHAR_WEIGHT, rFont );
+ SetPrevFontStyle( rSet, SID_ATTR_CHAR_CJK_POSTURE, SID_ATTR_CHAR_CJK_WEIGHT, rCJKFont );
+ SetPrevFontStyle( rSet, SID_ATTR_CHAR_CTL_POSTURE, SID_ATTR_CHAR_CTL_WEIGHT, rCTLFont );
+
+ // Size
+ SetPrevFontSize( rSet, SID_ATTR_CHAR_FONTHEIGHT, rFont );
+ SetPrevFontSize( rSet, SID_ATTR_CHAR_CJK_FONTHEIGHT, rCJKFont );
+ SetPrevFontSize( rSet, SID_ATTR_CHAR_CTL_FONTHEIGHT, rCTLFont );
+
+ // Color
+ nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
+ if( ISITEMSET )
+ {
+ const SvxColorItem& rItem = ( SvxColorItem& ) rSet.Get( nWhich );
+ Color aCol( rItem.GetValue() );
+ rFont.SetColor( aCol );
+ rCJKFont.SetColor( aCol );
+ rCTLFont.SetColor( aCol );
+
+ m_aPreviewWin.AutoCorrectFontColor(); // handle color COL_AUTO
+ }
+
+ // Kerning
+ nWhich = GetWhich( SID_ATTR_CHAR_KERNING );
+ if( ISITEMSET )
+ {
+ const SvxKerningItem& rItem = ( SvxKerningItem& ) rSet.Get( nWhich );
+ short nKern = ( short )
+ LogicToLogic( rItem.GetValue(), ( MapUnit ) rSet.GetPool()->GetMetric( nWhich ), MAP_TWIP );
+ rFont.SetFixKerning( nKern );
+ rCJKFont.SetFixKerning( nKern );
+ rCTLFont.SetFixKerning( nKern );
+ }
+
+ // Escapement
+ nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT );
+ const BYTE nProp = 100;
+ short nEsc;
+ BYTE nEscProp;
+ if( ISITEMSET )
+ {
+ const SvxEscapementItem& rItem = ( SvxEscapementItem& ) rSet.Get( nWhich );
+ nEsc = rItem.GetEsc();
+ nEscProp = rItem.GetProp();
+
+ if( nEsc == DFLT_ESC_AUTO_SUPER )
+ nEsc = DFLT_ESC_SUPER;
+ else if( nEsc == DFLT_ESC_AUTO_SUB )
+ nEsc = DFLT_ESC_SUB;
+ }
+ else
+ {
+ nEsc = 0;
+ nEscProp = 100;
+ }
+
+ SetPrevFontEscapement( nProp, nEscProp, nEsc );
+
+ // Font width scale
+ SetPrevFontWidthScale( rSet );
+
+ m_aPreviewWin.Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharBasePage::SetPrevFontSize( const SfxItemSet& rSet, USHORT nSlot, SvxFont& rFont )
+{
+ USHORT nWhich = GetWhich( nSlot );
+ long nH;
+ if( rSet.GetItemState( nWhich ) >= SFX_ITEM_SET )
+ {
+ nH = LogicToLogic( ( ( SvxFontHeightItem& ) rSet.Get( nWhich ) ).GetHeight(),
+ ( MapUnit ) rSet.GetPool()->GetMetric( nWhich ),
+ MAP_TWIP );
+ }
+ else
+ nH = 240; // as default 12pt
+
+ rFont.SetSize( Size( 0, nH ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharBasePage::SetPrevFont( const SfxItemSet& rSet, USHORT nSlot, SvxFont& rFont )
+{
+ USHORT nWhich = GetWhich( nSlot );
+ if( ISITEMSET )
+ {
+ const SvxFontItem& rFontItem = ( SvxFontItem& ) rSet.Get( nWhich );
+ rFont.SetFamily( rFontItem.GetFamily() );
+ rFont.SetName( rFontItem.GetFamilyName() );
+ rFont.SetPitch( rFontItem.GetPitch() );
+ rFont.SetCharSet( rFontItem.GetCharSet() );
+ rFont.SetStyleName( rFontItem.GetStyleName() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharBasePage::SetPrevFontStyle( const SfxItemSet& rSet, USHORT nPosture, USHORT nWeight, SvxFont& rFont )
+{
+ USHORT nWhich = GetWhich( nPosture );
+ if( ISITEMSET )
+ {
+ const SvxPostureItem& rItem = ( SvxPostureItem& ) rSet.Get( nWhich );
+ rFont.SetItalic( ( FontItalic ) rItem.GetValue() != ITALIC_NONE ? ITALIC_NORMAL : ITALIC_NONE );
+ }
+
+ nWhich = GetWhich( nWeight );
+ if( ISITEMSET )
+ {
+ SvxWeightItem& rItem = ( SvxWeightItem& ) rSet.Get( nWhich );
+ rFont.SetWeight( ( FontWeight ) rItem.GetValue() != WEIGHT_NORMAL ? WEIGHT_BOLD : WEIGHT_NORMAL );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharBasePage::SetPrevFontWidthScale( const SfxItemSet& rSet )
+{
+ USHORT nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH );
+ if( ISITEMSET )
+ {
+ const SvxCharScaleWidthItem& rItem = ( SvxCharScaleWidthItem& ) rSet.Get( nWhich );
+
+ m_aPreviewWin.SetFontWidthScale( rItem.GetValue() );
+ }
+}
+
+// -----------------------------------------------------------------------
+namespace
+{
+ // -----------------------------------------------------------------------
+ void setPrevFontEscapement(SvxFont& _rFont,BYTE nProp, BYTE nEscProp, short nEsc )
+ {
+ _rFont.SetPropr( nProp );
+ _rFont.SetProprRel( nEscProp );
+ _rFont.SetEscapement( nEsc );
+ }
+ // -----------------------------------------------------------------------
+ // -----------------------------------------------------------------------
+}
+// -----------------------------------------------------------------------
+
+void SvxCharBasePage::SetPrevFontEscapement( BYTE nProp, BYTE nEscProp, short nEsc )
+{
+ setPrevFontEscapement(GetPreviewFont(),nProp,nEscProp,nEsc);
+ setPrevFontEscapement(GetPreviewCJKFont(),nProp,nEscProp,nEsc);
+ setPrevFontEscapement(GetPreviewCTLFont(),nProp,nEscProp,nEsc);
+ m_aPreviewWin.Invalidate();
+}
+
+// SvxCharNamePage_Impl --------------------------------------------------
+
+struct SvxCharNamePage_Impl
+{
+ Timer m_aUpdateTimer;
+ String m_aNoStyleText;
+ String m_aTransparentText;
+ const FontList* m_pFontList;
+ USHORT m_nExtraEntryPos;
+ BOOL m_bMustDelete;
+ BOOL m_bInSearchMode;
+
+ SvxCharNamePage_Impl() :
+
+ m_pFontList ( NULL ),
+ m_nExtraEntryPos( LISTBOX_ENTRY_NOTFOUND ),
+ m_bMustDelete ( FALSE ),
+ m_bInSearchMode ( FALSE )
+
+ {
+ m_aUpdateTimer.SetTimeout( 350 );
+ }
+
+ ~SvxCharNamePage_Impl()
+ {
+ if ( m_bMustDelete )
+ delete m_pFontList;
+ }
+};
+
+// class SvxCharNamePage -------------------------------------------------
+
+SvxCharNamePage::SvxCharNamePage( Window* pParent, const SfxItemSet& rInSet ) :
+
+ SvxCharBasePage( pParent, SVX_RES( RID_SVXPAGE_CHAR_NAME ), rInSet, WIN_CHAR_PREVIEW, FT_CHAR_FONTTYPE ),
+ m_pImpl ( new SvxCharNamePage_Impl )
+{
+ m_pImpl->m_aNoStyleText = String( SVX_RES( STR_CHARNAME_NOSTYLE ) );
+ m_pImpl->m_aTransparentText = String( SVX_RES( STR_CHARNAME_TRANSPARENT ) );
+
+ SvtLanguageOptions aLanguageOptions;
+ sal_Bool bCJK = ( aLanguageOptions.IsCJKFontEnabled() || aLanguageOptions.IsCTLFontEnabled() );
+
+ m_pWestLine = new FixedLine( this, SVX_RES( FL_WEST ) );
+ m_pWestFontNameFT = new FixedText( this, SVX_RES( bCJK ? FT_WEST_NAME : FT_WEST_NAME_NOCJK ) );
+ m_pWestFontNameLB = new FontNameBox( this, SVX_RES( bCJK ? LB_WEST_NAME : LB_WEST_NAME_NOCJK ) );
+ m_pWestFontStyleFT = new FixedText( this, SVX_RES( bCJK ? FT_WEST_STYLE : FT_WEST_STYLE_NOCJK ) );
+ m_pWestFontStyleLB = new FontStyleBox( this, SVX_RES( bCJK ? LB_WEST_STYLE : LB_WEST_STYLE_NOCJK ) );
+ m_pWestFontSizeFT = new FixedText( this, SVX_RES( bCJK ? FT_WEST_SIZE : FT_WEST_SIZE_NOCJK ) );
+ m_pWestFontSizeLB = new FontSizeBox( this, SVX_RES( bCJK ? LB_WEST_SIZE : LB_WEST_SIZE_NOCJK ) );
+
+ if( !bCJK )
+ {
+ m_pColorFL = new FixedLine( this, SVX_RES( FL_COLOR2 ) );
+ m_pColorFT = new FixedText( this, SVX_RES( FT_COLOR2 ) );
+ m_pColorLB = new ColorListBox( this, SVX_RES( LB_COLOR2 ) );
+ }
+
+ m_pWestFontLanguageFT = new FixedText( this, SVX_RES( bCJK ? FT_WEST_LANG : FT_WEST_LANG_NOCJK ) );
+ m_pWestFontLanguageLB = new SvxLanguageBox( this, SVX_RES( bCJK ? LB_WEST_LANG : LB_WEST_LANG_NOCJK ) );
+
+ m_pEastLine = new FixedLine( this, SVX_RES( FL_EAST ) );
+ m_pEastFontNameFT = new FixedText( this, SVX_RES( FT_EAST_NAME ) );
+ m_pEastFontNameLB = new FontNameBox( this, SVX_RES( LB_EAST_NAME ) );
+ m_pEastFontStyleFT = new FixedText( this, SVX_RES( FT_EAST_STYLE ) );
+ m_pEastFontStyleLB = new FontStyleBox( this, SVX_RES( LB_EAST_STYLE ) );
+ m_pEastFontSizeFT = new FixedText( this, SVX_RES( FT_EAST_SIZE ) );
+ m_pEastFontSizeLB = new FontSizeBox( this, SVX_RES( LB_EAST_SIZE ) );
+ m_pEastFontLanguageFT = new FixedText( this, SVX_RES( FT_EAST_LANG ) );
+ m_pEastFontLanguageLB = new SvxLanguageBox( this, SVX_RES( LB_EAST_LANG ) );
+
+ m_pCTLLine = new FixedLine( this, SVX_RES( FL_CTL ) );
+ m_pCTLFontNameFT = new FixedText( this, SVX_RES( FT_CTL_NAME ) );
+ m_pCTLFontNameLB = new FontNameBox( this, SVX_RES( LB_CTL_NAME ) );
+ m_pCTLFontStyleFT = new FixedText( this, SVX_RES( FT_CTL_STYLE ) );
+ m_pCTLFontStyleLB = new FontStyleBox( this, SVX_RES( LB_CTL_STYLE ) );
+ m_pCTLFontSizeFT = new FixedText( this, SVX_RES( FT_CTL_SIZE ) );
+ m_pCTLFontSizeLB = new FontSizeBox( this, SVX_RES( LB_CTL_SIZE ) );
+ m_pCTLFontLanguageFT = new FixedText( this, SVX_RES( FT_CTL_LANG ) );
+ m_pCTLFontLanguageLB = new SvxLanguageBox( this, SVX_RES( LB_CTL_LANG ) );
+
+ if( bCJK )
+ {
+ m_pColorFL = new FixedLine( this, SVX_RES( FL_COLOR2 ) );
+ m_pColorFT = new FixedText( this, SVX_RES( FT_COLOR2 ) );
+ m_pColorLB = new ColorListBox( this, SVX_RES( LB_COLOR2 ) );
+ }
+
+ m_pWestLine ->Show( bCJK );
+ m_pColorFL ->Show( bCJK );
+
+ bCJK = aLanguageOptions.IsCJKFontEnabled();
+ m_pEastLine ->Show( bCJK );
+ m_pEastFontNameFT ->Show( bCJK );
+ m_pEastFontNameLB ->Show( bCJK );
+ m_pEastFontStyleFT ->Show( bCJK );
+ m_pEastFontStyleLB ->Show( bCJK );
+ m_pEastFontSizeFT ->Show( bCJK );
+ m_pEastFontSizeLB ->Show( bCJK );
+ m_pEastFontLanguageFT ->Show( bCJK );
+ m_pEastFontLanguageLB ->Show( bCJK );
+
+ sal_Bool bShowCTL = aLanguageOptions.IsCTLFontEnabled();
+ if ( bShowCTL && !bCJK )
+ {
+ // move CTL controls to the places of the CJK controls, if these controls aren't visible
+ m_pCTLLine ->SetPosPixel( m_pEastLine->GetPosPixel() );
+ m_pCTLFontNameFT ->SetPosPixel( m_pEastFontNameFT->GetPosPixel() );
+ m_pCTLFontNameLB ->SetPosPixel( m_pEastFontNameLB->GetPosPixel() );
+ m_pCTLFontStyleFT ->SetPosPixel( m_pEastFontStyleFT->GetPosPixel() );
+ m_pCTLFontStyleLB ->SetPosPixel( m_pEastFontStyleLB->GetPosPixel() );
+ m_pCTLFontSizeFT ->SetPosPixel( m_pEastFontSizeFT->GetPosPixel() );
+ m_pCTLFontSizeLB ->SetPosPixel( m_pEastFontSizeLB->GetPosPixel() );
+ m_pCTLFontLanguageFT ->SetPosPixel( m_pEastFontLanguageFT->GetPosPixel() );
+ m_pCTLFontLanguageLB ->SetPosPixel( m_pEastFontLanguageLB->GetPosPixel() );
+ }
+ m_pCTLLine ->Show( bShowCTL );
+ m_pCTLFontNameFT ->Show( bShowCTL );
+ m_pCTLFontNameLB ->Show( bShowCTL );
+ m_pCTLFontStyleFT ->Show( bShowCTL );
+ m_pCTLFontStyleLB ->Show( bShowCTL );
+ m_pCTLFontSizeFT ->Show( bShowCTL );
+ m_pCTLFontSizeLB ->Show( bShowCTL );
+ m_pCTLFontLanguageFT ->Show( bShowCTL );
+ m_pCTLFontLanguageLB ->Show( bShowCTL );
+
+ FreeResource();
+
+ m_pWestFontLanguageLB->SetLanguageList( LANG_LIST_WESTERN, TRUE, FALSE, TRUE );
+ m_pEastFontLanguageLB->SetLanguageList( LANG_LIST_CJK, TRUE, FALSE, TRUE );
+ m_pCTLFontLanguageLB->SetLanguageList( LANG_LIST_CTL, TRUE, FALSE, TRUE );
+
+ Initialize();
+}
+
+// -----------------------------------------------------------------------
+
+SvxCharNamePage::~SvxCharNamePage()
+{
+ delete m_pImpl;
+
+ delete m_pWestLine;
+ delete m_pWestFontNameFT;
+ delete m_pWestFontNameLB;
+ delete m_pWestFontStyleFT;
+ delete m_pWestFontStyleLB;
+ delete m_pWestFontSizeFT;
+ delete m_pWestFontSizeLB;
+ delete m_pWestFontLanguageFT;
+ delete m_pWestFontLanguageLB;
+
+ delete m_pEastLine;
+ delete m_pEastFontNameFT;
+ delete m_pEastFontNameLB;
+ delete m_pEastFontStyleFT;
+ delete m_pEastFontStyleLB;
+ delete m_pEastFontSizeFT;
+ delete m_pEastFontSizeLB;
+ delete m_pEastFontLanguageFT;
+ delete m_pEastFontLanguageLB;
+
+ delete m_pCTLLine;
+ delete m_pCTLFontNameFT;
+ delete m_pCTLFontNameLB;
+ delete m_pCTLFontStyleFT;
+ delete m_pCTLFontStyleLB;
+ delete m_pCTLFontSizeFT;
+ delete m_pCTLFontSizeLB;
+ delete m_pCTLFontLanguageFT;
+ delete m_pCTLFontLanguageLB;
+
+ delete m_pColorFL;
+ delete m_pColorFT;
+ delete m_pColorLB;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharNamePage::Initialize()
+{
+ // to handle the changes of the other pages
+ SetExchangeSupport();
+
+ // fill the color box
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ //DBG_ASSERT( pDocSh, "DocShell not found!" );
+ XColorTable* pColorTable = NULL;
+ FASTBOOL bKillTable = FALSE;
+ const SfxPoolItem* pItem = NULL;
+
+ if ( pDocSh )
+ {
+ pItem = pDocSh->GetItem( SID_COLOR_TABLE );
+ if ( pItem != NULL )
+ pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
+ }
+
+ if ( !pColorTable )
+ {
+ pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+ bKillTable = TRUE;
+ }
+
+ m_pColorLB->SetUpdateMode( FALSE );
+
+ {
+ SfxPoolItem* pDummy;
+ SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh );
+ if( !pFrame || SFX_ITEM_DEFAULT > pFrame->GetBindings().QueryState(
+ SID_ATTR_AUTO_COLOR_INVALID, pDummy ))
+ m_pColorLB->InsertEntry( Color( COL_AUTO ),
+ SVX_RESSTR( RID_SVXSTR_AUTOMATIC ));
+ }
+ for ( long i = 0; i < pColorTable->Count(); i++ )
+ {
+ XColorEntry* pEntry = pColorTable->GetColor(i);
+ m_pColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ }
+
+ m_pColorLB->SetUpdateMode( TRUE );
+
+ if ( bKillTable )
+ delete pColorTable;
+
+ m_pColorLB->SetSelectHdl( LINK( this, SvxCharNamePage, ColorBoxSelectHdl_Impl ) );
+
+ Link aLink = LINK( this, SvxCharNamePage, FontModifyHdl_Impl );
+ m_pWestFontNameLB->SetModifyHdl( aLink );
+ m_pWestFontStyleLB->SetModifyHdl( aLink );
+ m_pWestFontSizeLB->SetModifyHdl( aLink );
+ m_pEastFontNameLB->SetModifyHdl( aLink );
+ m_pEastFontStyleLB->SetModifyHdl( aLink );
+ m_pEastFontSizeLB->SetModifyHdl( aLink );
+ m_pCTLFontNameLB->SetModifyHdl( aLink );
+ m_pCTLFontStyleLB->SetModifyHdl( aLink );
+ m_pCTLFontSizeLB->SetModifyHdl( aLink );
+
+ m_pImpl->m_aUpdateTimer.SetTimeoutHdl( LINK( this, SvxCharNamePage, UpdateHdl_Impl ) );
+
+ m_pColorFL->Hide();
+ m_pColorFT->Hide();
+ m_pColorLB->Hide();
+}
+
+// -----------------------------------------------------------------------
+
+const FontList* SvxCharNamePage::GetFontList() const
+{
+ if ( !m_pImpl->m_pFontList )
+ {
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ const SfxPoolItem* pItem;
+
+ /* #110771# SvxFontListItem::GetFontList can return NULL */
+ if ( pDocSh )
+ {
+ pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
+ if ( pItem != NULL )
+ {
+ DBG_ASSERT(NULL != ( (SvxFontListItem*)pItem )->GetFontList(),
+ "Where is the font list?");
+ m_pImpl->m_pFontList = static_cast<const SvxFontListItem*>(pItem )->GetFontList()->Clone();
+ m_pImpl->m_bMustDelete = TRUE;
+ }
+ }
+ if(!m_pImpl->m_pFontList)
+ {
+ m_pImpl->m_pFontList =
+ new FontList( Application::GetDefaultDevice() );
+ m_pImpl->m_bMustDelete = TRUE;
+ }
+ }
+
+ return m_pImpl->m_pFontList;
+}
+
+// -----------------------------------------------------------------------------
+namespace
+{
+ FontInfo calcFontInfo( SvxFont& _rFont,
+ SvxCharNamePage* _pPage,
+ const FontNameBox* _pFontNameLB,
+ const FontStyleBox* _pFontStyleLB,
+ const FontSizeBox* _pFontSizeLB,
+ const FontList* _pFontList,
+ USHORT _nFontWhich,
+ USHORT _nFontHeightWhich)
+ {
+ Size aSize = _rFont.GetSize();
+ aSize.Width() = 0;
+ FontInfo aFontInfo;
+ String sFontName(_pFontNameLB->GetText());
+ BOOL bFontAvailable = _pFontList->IsAvailable( sFontName );
+ if(bFontAvailable || _pFontNameLB->GetSavedValue() != sFontName)
+ aFontInfo = _pFontList->Get( sFontName, _pFontStyleLB->GetText() );
+ else
+ {
+ //get the font from itemset
+ SfxItemState eState = _pPage->GetItemSet().GetItemState( _nFontWhich );
+ if ( eState >= SFX_ITEM_DEFAULT )
+ {
+ const SvxFontItem* pFontItem = (const SvxFontItem*)&( _pPage->GetItemSet().Get( _nFontWhich ) );
+ aFontInfo.SetName(pFontItem->GetFamilyName());
+ aFontInfo.SetStyleName(pFontItem->GetStyleName());
+ aFontInfo.SetFamily(pFontItem->GetFamily());
+ aFontInfo.SetPitch(pFontItem->GetPitch());
+ aFontInfo.SetCharSet(pFontItem->GetCharSet());
+ }
+ }
+ if ( _pFontSizeLB->IsRelative() )
+ {
+ DBG_ASSERT( _pPage->GetItemSet().GetParent(), "No parent set" );
+ const SvxFontHeightItem& rOldItem = (SvxFontHeightItem&)_pPage->GetItemSet().GetParent()->Get( _nFontHeightWhich );
+
+ // alter Wert, skaliert
+ long nHeight;
+ if ( _pFontSizeLB->IsPtRelative() )
+ nHeight = rOldItem.GetHeight() + PointToTwips( static_cast<long>(_pFontSizeLB->GetValue() / 10) );
+ else
+ nHeight = static_cast<long>(rOldItem.GetHeight() * _pFontSizeLB->GetValue() / 100);
+
+ // Umrechnung in twips fuer das Beispiel-Window
+ aSize.Height() =
+ ItemToControl( nHeight, _pPage->GetItemSet().GetPool()->GetMetric( _nFontHeightWhich ), SFX_FUNIT_TWIP );
+ }
+ else if ( _pFontSizeLB->GetText().Len() )
+ aSize.Height() = PointToTwips( static_cast<long>(_pFontSizeLB->GetValue() / 10) );
+ else
+ aSize.Height() = 200; // default 10pt
+ aFontInfo.SetSize( aSize );
+
+ _rFont.SetFamily( aFontInfo.GetFamily() );
+ _rFont.SetName( aFontInfo.GetName() );
+ _rFont.SetStyleName( aFontInfo.GetStyleName() );
+ _rFont.SetPitch( aFontInfo.GetPitch() );
+ _rFont.SetCharSet( aFontInfo.GetCharSet() );
+ _rFont.SetWeight( aFontInfo.GetWeight() );
+ _rFont.SetItalic( aFontInfo.GetItalic() );
+ _rFont.SetSize( aFontInfo.GetSize() );
+
+ return aFontInfo;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharNamePage::UpdatePreview_Impl()
+{
+ SvxFont& rFont = GetPreviewFont();
+ SvxFont& rCJKFont = GetPreviewCJKFont();
+ SvxFont& rCTLFont = GetPreviewCTLFont();
+ // Size
+ Size aSize = rFont.GetSize();
+ aSize.Width() = 0;
+ Size aCJKSize = rCJKFont.GetSize();
+ aCJKSize.Width() = 0;
+ Size aCTLSize = rCTLFont.GetSize();
+ aCTLSize.Width() = 0;
+ // Font
+ const FontList* pFontList = GetFontList();
+ FontInfo aFontInfo =
+ calcFontInfo(rFont,this,m_pWestFontNameLB,m_pWestFontStyleLB,m_pWestFontSizeLB,pFontList,GetWhich( SID_ATTR_CHAR_FONT ),GetWhich( SID_ATTR_CHAR_FONTHEIGHT ));
+
+ calcFontInfo(rCJKFont,this,m_pEastFontNameLB,m_pEastFontStyleLB,m_pEastFontSizeLB,pFontList,GetWhich( SID_ATTR_CHAR_CJK_FONT ),GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT ));
+
+ calcFontInfo(rCTLFont,this,m_pCTLFontNameLB,m_pCTLFontStyleLB,m_pCTLFontSizeLB,pFontList,GetWhich( SID_ATTR_CHAR_CTL_FONT ),GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT ));
+
+ m_aPreviewWin.Invalidate();
+ m_aFontTypeFT.SetText( pFontList->GetFontMapText( aFontInfo ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharNamePage::FillStyleBox_Impl( const FontNameBox* pNameBox )
+{
+ const FontList* pFontList = GetFontList();
+ DBG_ASSERT( pFontList, "no fontlist" );
+
+ FontStyleBox* pStyleBox = NULL;
+
+ if ( m_pWestFontNameLB == pNameBox )
+ pStyleBox = m_pWestFontStyleLB;
+ else if ( m_pEastFontNameLB == pNameBox )
+ pStyleBox = m_pEastFontStyleLB;
+ else if ( m_pCTLFontNameLB == pNameBox )
+ pStyleBox = m_pCTLFontStyleLB;
+ else
+ {
+ DBG_ERRORFILE( "invalid font name box" );
+ }
+
+ pStyleBox->Fill( pNameBox->GetText(), pFontList );
+
+ if ( m_pImpl->m_bInSearchMode )
+ {
+ // Bei der Suche zus"atzliche Eintr"age:
+ // "Nicht Fett" und "Nicht Kursiv"
+ String aEntry = m_pImpl->m_aNoStyleText;
+ const sal_Char sS[] = "%1";
+ aEntry.SearchAndReplaceAscii( sS, pFontList->GetBoldStr() );
+ m_pImpl->m_nExtraEntryPos = pStyleBox->InsertEntry( aEntry );
+ aEntry = m_pImpl->m_aNoStyleText;
+ aEntry.SearchAndReplaceAscii( sS, pFontList->GetItalicStr() );
+ pStyleBox->InsertEntry( aEntry );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharNamePage::FillSizeBox_Impl( const FontNameBox* pNameBox )
+{
+ const FontList* pFontList = GetFontList();
+ DBG_ASSERT( pFontList, "no fontlist" );
+
+ FontStyleBox* pStyleBox = NULL;
+ FontSizeBox* pSizeBox = NULL;
+
+ if ( m_pWestFontNameLB == pNameBox )
+ {
+ pStyleBox = m_pWestFontStyleLB;
+ pSizeBox = m_pWestFontSizeLB;
+ }
+ else if ( m_pEastFontNameLB == pNameBox )
+ {
+ pStyleBox = m_pEastFontStyleLB;
+ pSizeBox = m_pEastFontSizeLB;
+ }
+ else if ( m_pCTLFontNameLB == pNameBox )
+ {
+ pStyleBox = m_pCTLFontStyleLB;
+ pSizeBox = m_pCTLFontSizeLB;
+ }
+ else
+ {
+ DBG_ERRORFILE( "invalid font name box" );
+ }
+
+ FontInfo _aFontInfo( pFontList->Get( pNameBox->GetText(), pStyleBox->GetText() ) );
+ pSizeBox->Fill( &_aFontInfo, pFontList );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp )
+{
+ FixedText* pNameLabel = NULL;
+ FontNameBox* pNameBox = NULL;
+ FixedText* pStyleLabel = NULL;
+ FontStyleBox* pStyleBox = NULL;
+ FixedText* pSizeLabel = NULL;
+ FontSizeBox* pSizeBox = NULL;
+ FixedText* pLangFT = NULL;
+ SvxLanguageBox* pLangBox = NULL;
+ USHORT nWhich = 0;
+
+ switch ( eLangGrp )
+ {
+ case Western :
+ pNameLabel = m_pWestFontNameFT;
+ pNameBox = m_pWestFontNameLB;
+ pStyleLabel = m_pWestFontStyleFT;
+ pStyleBox = m_pWestFontStyleLB;
+ pSizeLabel = m_pWestFontSizeFT;
+ pSizeBox = m_pWestFontSizeLB;
+ pLangFT = m_pWestFontLanguageFT;
+ pLangBox = m_pWestFontLanguageLB;
+ nWhich = GetWhich( SID_ATTR_CHAR_FONT );
+ break;
+
+ case Asian :
+ pNameLabel = m_pEastFontNameFT;
+ pNameBox = m_pEastFontNameLB;
+ pStyleLabel = m_pEastFontStyleFT;
+ pStyleBox = m_pEastFontStyleLB;
+ pSizeLabel = m_pEastFontSizeFT;
+ pSizeBox = m_pEastFontSizeLB;
+ pLangFT = m_pEastFontLanguageFT;
+ pLangBox = m_pEastFontLanguageLB;
+ nWhich = GetWhich( SID_ATTR_CHAR_CJK_FONT );
+ break;
+
+ case Ctl :
+ pNameLabel = m_pCTLFontNameFT;
+ pNameBox = m_pCTLFontNameLB;
+ pStyleLabel = m_pCTLFontStyleFT;
+ pStyleBox = m_pCTLFontStyleLB;
+ pSizeLabel = m_pCTLFontSizeFT;
+ pSizeBox = m_pCTLFontSizeLB;
+ pLangFT = m_pCTLFontLanguageFT;
+ pLangBox = m_pCTLFontLanguageLB;
+ nWhich = GetWhich( SID_ATTR_CHAR_CTL_FONT );
+ break;
+ }
+
+ // die FontListBox fuellen
+ const FontList* pFontList = GetFontList();
+ pNameBox->Fill( pFontList );
+
+ // Font ermitteln
+ const SvxFontItem* pFontItem = NULL;
+ SfxItemState eState = rSet.GetItemState( nWhich );
+
+ if ( eState >= SFX_ITEM_DEFAULT )
+ {
+ pFontItem = (const SvxFontItem*)&( rSet.Get( nWhich ) );
+ pNameBox->SetText( pFontItem->GetFamilyName() );
+ }
+ else
+ {
+ pNameBox->SetText( String() );
+ }
+
+ FillStyleBox_Impl( pNameBox );
+
+ FASTBOOL bStyle = FALSE;
+ FASTBOOL bStyleAvailable = TRUE;
+ FontItalic eItalic = ITALIC_NONE;
+ FontWeight eWeight = WEIGHT_NORMAL;
+ switch ( eLangGrp )
+ {
+ case Western : nWhich = GetWhich( SID_ATTR_CHAR_POSTURE ); break;
+ case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_POSTURE ); break;
+ case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_POSTURE ); break;
+ }
+ eState = rSet.GetItemState( nWhich );
+
+ if ( eState >= SFX_ITEM_DEFAULT )
+ {
+ const SvxPostureItem& rItem = (SvxPostureItem&)rSet.Get( nWhich );
+ eItalic = (FontItalic)rItem.GetValue();
+ bStyle = TRUE;
+ }
+ bStyleAvailable = bStyleAvailable && (eState >= SFX_ITEM_DONTCARE);
+
+ switch ( eLangGrp )
+ {
+ case Western : nWhich = GetWhich( SID_ATTR_CHAR_WEIGHT ); break;
+ case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_WEIGHT ); break;
+ case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_WEIGHT ); break;
+ }
+ eState = rSet.GetItemState( nWhich );
+
+ if ( eState >= SFX_ITEM_DEFAULT )
+ {
+ SvxWeightItem& rItem = (SvxWeightItem&)rSet.Get( nWhich );
+ eWeight = (FontWeight)rItem.GetValue();
+ }
+ else
+ bStyle = FALSE;
+ bStyleAvailable = bStyleAvailable && (eState >= SFX_ITEM_DONTCARE);
+
+ // Aktuell eingestellter Font
+ if ( bStyle && pFontItem )
+ {
+ FontInfo aInfo = pFontList->Get( pFontItem->GetFamilyName(), eWeight, eItalic );
+ pStyleBox->SetText( pFontList->GetStyleName( aInfo ) );
+ }
+ else if ( !m_pImpl->m_bInSearchMode || !bStyle )
+ {
+ pStyleBox->SetText( String() );
+ }
+ else if ( bStyle )
+ {
+ FontInfo aInfo = pFontList->Get( String(), eWeight, eItalic );
+ pStyleBox->SetText( pFontList->GetStyleName( aInfo ) );
+ }
+ if (!bStyleAvailable)
+ {
+ pStyleBox->Disable( );
+ pStyleLabel->Disable( );
+ }
+
+ // SizeBox fuellen
+ FillSizeBox_Impl( pNameBox );
+ switch ( eLangGrp )
+ {
+ case Western : nWhich = GetWhich( SID_ATTR_CHAR_FONTHEIGHT ); break;
+ case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT ); break;
+ case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT ); break;
+ }
+ eState = rSet.GetItemState( nWhich );
+
+ if ( pSizeBox->IsRelativeMode() )
+ {
+ SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich );
+ const SvxFontHeightItem& rItem = (SvxFontHeightItem&)rSet.Get( nWhich );
+
+ if( rItem.GetProp() != 100 || SFX_MAPUNIT_RELATIVE != rItem.GetPropUnit() )
+ {
+ BOOL bPtRel = SFX_MAPUNIT_POINT == rItem.GetPropUnit();
+ pSizeBox->SetPtRelative( bPtRel );
+ pSizeBox->SetValue( bPtRel ? ((short)rItem.GetProp()) * 10 : rItem.GetProp() );
+ }
+ else
+ {
+ pSizeBox->SetRelative();
+ pSizeBox->SetValue( (long)CalcToPoint( rItem.GetHeight(), eUnit, 10 ) );
+ }
+ }
+ else if ( eState >= SFX_ITEM_DEFAULT )
+ {
+ SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich );
+ const SvxFontHeightItem& rItem = (SvxFontHeightItem&)rSet.Get( nWhich );
+ pSizeBox->SetValue( (long)CalcToPoint( rItem.GetHeight(), eUnit, 10 ) );
+ }
+ else
+ {
+ pSizeBox->SetText( String() );
+ if ( eState <= SFX_ITEM_READONLY )
+ {
+ pSizeBox->Disable( );
+ pSizeLabel->Disable( );
+ }
+ }
+
+ switch ( eLangGrp )
+ {
+ case Western : nWhich = GetWhich( SID_ATTR_CHAR_LANGUAGE ); break;
+ case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_LANGUAGE ); break;
+ case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_LANGUAGE ); break;
+ }
+ pLangBox->SetNoSelection();
+ eState = rSet.GetItemState( nWhich );
+
+ switch ( eState )
+ {
+ case SFX_ITEM_UNKNOWN:
+ pLangFT->Hide();
+ pLangBox->Hide();
+ break;
+
+ case SFX_ITEM_DISABLED:
+ case SFX_ITEM_READONLY:
+ pLangFT->Disable();
+ pLangBox->Disable();
+ break;
+
+ case SFX_ITEM_DEFAULT:
+ case SFX_ITEM_SET:
+ {
+ const SvxLanguageItem& rItem = (SvxLanguageItem&)rSet.Get( nWhich );
+ LanguageType eLangType = (LanguageType)rItem.GetValue();
+ DBG_ASSERT( eLangType != LANGUAGE_SYSTEM, "LANGUAGE_SYSTEM not allowed" );
+ if ( eLangType != LANGUAGE_DONTKNOW )
+ pLangBox->SelectLanguage( eLangType );
+ break;
+ }
+ }
+
+ if ( Western == eLangGrp )
+ m_aFontTypeFT.SetText( pFontList->GetFontMapText(
+ pFontList->Get( pNameBox->GetText(), pStyleBox->GetText() ) ) );
+
+ // save these settings
+ pNameBox->SaveValue();
+ pStyleBox->SaveValue();
+ pSizeBox->SaveValue();
+ pLangBox->SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp )
+{
+ BOOL bModified = FALSE;
+
+ FontNameBox* pNameBox = NULL;
+ FontStyleBox* pStyleBox = NULL;
+ FontSizeBox* pSizeBox = NULL;
+ SvxLanguageBox* pLangBox = NULL;
+ USHORT nWhich = 0;
+ USHORT nSlot = 0;
+
+ switch ( eLangGrp )
+ {
+ case Western :
+ pNameBox = m_pWestFontNameLB;
+ pStyleBox = m_pWestFontStyleLB;
+ pSizeBox = m_pWestFontSizeLB;
+ pLangBox = m_pWestFontLanguageLB;
+ nSlot = SID_ATTR_CHAR_FONT;
+ break;
+
+ case Asian :
+ pNameBox = m_pEastFontNameLB;
+ pStyleBox = m_pEastFontStyleLB;
+ pSizeBox = m_pEastFontSizeLB;
+ pLangBox = m_pEastFontLanguageLB;
+ nSlot = SID_ATTR_CHAR_CJK_FONT;
+ break;
+
+ case Ctl :
+ pNameBox = m_pCTLFontNameLB;
+ pStyleBox = m_pCTLFontStyleLB;
+ pSizeBox = m_pCTLFontSizeLB;
+ pLangBox = m_pCTLFontLanguageLB;
+ nSlot = SID_ATTR_CHAR_CTL_FONT;
+ break;
+ }
+
+ nWhich = GetWhich( nSlot );
+ const SfxPoolItem* pItem = NULL;
+ const SfxItemSet& rOldSet = GetItemSet();
+ const SfxPoolItem* pOld = NULL;
+
+ const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL;
+
+ FASTBOOL bChanged = TRUE;
+ const String& rFontName = pNameBox->GetText();
+ const FontList* pFontList = GetFontList();
+ String aStyleBoxText =pStyleBox->GetText();
+ USHORT nEntryPos = pStyleBox->GetEntryPos( aStyleBoxText );
+ if ( nEntryPos >= m_pImpl->m_nExtraEntryPos )
+ aStyleBoxText.Erase();
+ FontInfo aInfo( pFontList->Get( rFontName, aStyleBoxText ) );
+ SvxFontItem aFontItem( aInfo.GetFamily(), aInfo.GetName(), aInfo.GetStyleName(),
+ aInfo.GetPitch(), aInfo.GetCharSet(), nWhich );
+ pOld = GetOldItem( rSet, nSlot );
+
+ if ( pOld )
+ {
+ const SvxFontItem& rItem = *( (const SvxFontItem*)pOld );
+
+ if ( rItem.GetFamilyName() == aFontItem.GetFamilyName() )
+ bChanged = FALSE;
+ }
+
+ if ( !bChanged )
+ bChanged = !pNameBox->GetSavedValue().Len();
+
+ if ( !bChanged && pExampleSet &&
+ pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET &&
+ ( (SvxFontItem*)pItem )->GetFamilyName() != aFontItem.GetFamilyName() )
+ bChanged = TRUE;
+
+ if ( bChanged && rFontName.Len() )
+ {
+ rSet.Put( aFontItem );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ rSet.ClearItem( nWhich );
+
+
+ bChanged = TRUE;
+ switch ( eLangGrp )
+ {
+ case Western : nSlot = SID_ATTR_CHAR_WEIGHT; break;
+ case Asian : nSlot = SID_ATTR_CHAR_CJK_WEIGHT; break;
+ case Ctl : nSlot = SID_ATTR_CHAR_CTL_WEIGHT; break;
+ }
+ nWhich = GetWhich( nSlot );
+ FontWeight eWeight = aInfo.GetWeight();
+ if ( nEntryPos >= m_pImpl->m_nExtraEntryPos )
+ eWeight = WEIGHT_NORMAL;
+ SvxWeightItem aWeightItem( eWeight, nWhich );
+ pOld = GetOldItem( rSet, nSlot );
+
+ if ( pOld )
+ {
+ const SvxWeightItem& rItem = *( (const SvxWeightItem*)pOld );
+
+ if ( rItem.GetValue() == aWeightItem.GetValue() )
+ bChanged = FALSE;
+ }
+
+ if ( !bChanged )
+ {
+ bChanged = !pStyleBox->GetSavedValue().Len();
+
+ if ( m_pImpl->m_bInSearchMode && bChanged &&
+ aInfo.GetWeight() == WEIGHT_NORMAL && aInfo.GetItalic() != ITALIC_NONE )
+ bChanged = FALSE;
+ }
+
+ if ( !bChanged && pExampleSet &&
+ pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET &&
+ ( (SvxWeightItem*)pItem )->GetValue() != aWeightItem.GetValue() )
+ bChanged = TRUE;
+
+ if ( nEntryPos >= m_pImpl->m_nExtraEntryPos )
+ bChanged = ( nEntryPos == m_pImpl->m_nExtraEntryPos );
+
+ String aText( pStyleBox->GetText() ); // Tristate, dann Text leer
+
+ if ( bChanged && aText.Len() )
+ {
+ rSet.Put( aWeightItem );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bChanged = TRUE;
+ switch ( eLangGrp )
+ {
+ case Western : nSlot = SID_ATTR_CHAR_POSTURE; break;
+ case Asian : nSlot = SID_ATTR_CHAR_CJK_POSTURE; break;
+ case Ctl : nSlot = SID_ATTR_CHAR_CTL_POSTURE; break;
+ }
+ nWhich = GetWhich( nSlot );
+ FontItalic eItalic = aInfo.GetItalic();
+ if ( nEntryPos >= m_pImpl->m_nExtraEntryPos )
+ eItalic = ITALIC_NONE;
+ SvxPostureItem aPostureItem( eItalic, nWhich );
+ pOld = GetOldItem( rSet, nSlot );
+
+ if ( pOld )
+ {
+ const SvxPostureItem& rItem = *( (const SvxPostureItem*)pOld );
+
+ if ( rItem.GetValue() == aPostureItem.GetValue() )
+ bChanged = FALSE;
+ }
+
+ if ( !bChanged )
+ {
+ bChanged = !pStyleBox->GetSavedValue().Len();
+
+ if ( m_pImpl->m_bInSearchMode && bChanged &&
+ aInfo.GetItalic() == ITALIC_NONE && aInfo.GetWeight() != WEIGHT_NORMAL )
+ bChanged = FALSE;
+ }
+
+ if ( !bChanged && pExampleSet &&
+ pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET &&
+ ( (SvxPostureItem*)pItem )->GetValue() != aPostureItem.GetValue() )
+ bChanged = TRUE;
+
+ if ( nEntryPos >= m_pImpl->m_nExtraEntryPos )
+ bChanged = ( nEntryPos == ( m_pImpl->m_nExtraEntryPos + 1 ) );
+
+ if ( bChanged && aText.Len() )
+ {
+ rSet.Put( aPostureItem );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ // FontSize
+ long nSize = static_cast<long>(pSizeBox->GetValue());
+
+ if ( !pSizeBox->GetText().Len() ) // GetValue() gibt dann Min-Wert zurueck
+ nSize = 0;
+ long nSavedSize = pSizeBox->GetSavedValue().ToInt32();
+ FASTBOOL bRel = TRUE;
+
+ if ( !pSizeBox->IsRelative() )
+ {
+ nSavedSize *= 10;
+ bRel = FALSE;
+ }
+
+ switch ( eLangGrp )
+ {
+ case Western : nSlot = SID_ATTR_CHAR_FONTHEIGHT; break;
+ case Asian : nSlot = SID_ATTR_CHAR_CJK_FONTHEIGHT; break;
+ case Ctl : nSlot = SID_ATTR_CHAR_CTL_FONTHEIGHT; break;
+ }
+ nWhich = GetWhich( nSlot );
+ const SvxFontHeightItem* pOldHeight = (const SvxFontHeightItem*)GetOldItem( rSet, nSlot );
+ bChanged = ( nSize != nSavedSize );
+
+ if ( !bChanged && pExampleSet &&
+ pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET )
+ {
+ float fSize = (float)nSize / 10;
+ long nVal = CalcToUnit( fSize, rSet.GetPool()->GetMetric( nWhich ) );
+ if ( ( (SvxFontHeightItem*)pItem )->GetHeight() != (UINT32)nVal )
+ bChanged = TRUE;
+ }
+
+ if ( bChanged || !pOldHeight ||
+ bRel != ( SFX_MAPUNIT_RELATIVE != pOldHeight->GetPropUnit() || 100 != pOldHeight->GetProp() ) )
+ {
+ SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich );
+ if ( pSizeBox->IsRelative() )
+ {
+ DBG_ASSERT( GetItemSet().GetParent(), "No parent set" );
+ const SvxFontHeightItem& rOldItem =
+ (const SvxFontHeightItem&)GetItemSet().GetParent()->Get( nWhich );
+
+ SvxFontHeightItem aHeight( 240, 100, nWhich );
+ if ( pSizeBox->IsPtRelative() )
+ aHeight.SetHeight( rOldItem.GetHeight(), (USHORT)( nSize / 10 ), SFX_MAPUNIT_POINT, eUnit );
+ else
+ aHeight.SetHeight( rOldItem.GetHeight(), (USHORT)nSize, SFX_MAPUNIT_RELATIVE );
+ rSet.Put( aHeight );
+ }
+ else
+ {
+ float fSize = (float)nSize / 10;
+ rSet.Put( SvxFontHeightItem( CalcToUnit( fSize, eUnit ), 100, nWhich ) );
+ }
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bChanged = TRUE;
+ switch ( eLangGrp )
+ {
+ case Western : nSlot = SID_ATTR_CHAR_LANGUAGE; break;
+ case Asian : nSlot = SID_ATTR_CHAR_CJK_LANGUAGE; break;
+ case Ctl : nSlot = SID_ATTR_CHAR_CTL_LANGUAGE; break;
+ }
+ nWhich = GetWhich( nSlot );
+ pOld = GetOldItem( rSet, nSlot );
+ USHORT nLangPos = pLangBox->GetSelectEntryPos();
+ LanguageType eLangType = (LanguageType)(ULONG)pLangBox->GetEntryData( nLangPos );
+
+ if ( pOld )
+ {
+ const SvxLanguageItem& rItem = *( (const SvxLanguageItem*)pOld );
+
+ if ( nLangPos == LISTBOX_ENTRY_NOTFOUND || eLangType == (LanguageType)rItem.GetValue() )
+ bChanged = FALSE;
+ }
+
+ if ( !bChanged )
+ bChanged = ( pLangBox->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND );
+
+ if ( bChanged && nLangPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ rSet.Put( SvxLanguageItem( eLangType, nWhich ) );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharNamePage::ResetColor_Impl( const SfxItemSet& rSet )
+{
+ USHORT nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
+ SfxItemState eState = rSet.GetItemState( nWhich );
+
+ switch ( eState )
+ {
+ case SFX_ITEM_UNKNOWN:
+ m_pColorLB->Hide();
+ break;
+
+ case SFX_ITEM_DISABLED:
+ case SFX_ITEM_READONLY:
+ m_pColorLB->Disable();
+ break;
+
+ case SFX_ITEM_DONTCARE:
+ m_pColorLB->SetNoSelection();
+ break;
+
+ case SFX_ITEM_DEFAULT:
+ case SFX_ITEM_SET:
+ {
+ SvxFont& rFont = GetPreviewFont();
+ SvxFont& rCJKFont = GetPreviewCJKFont();
+ SvxFont& rCTLFont = GetPreviewCTLFont();
+ const SvxColorItem& rItem = (SvxColorItem&)rSet.Get( nWhich );
+ Color aColor = rItem.GetValue();
+ rFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor );
+ rCJKFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor );
+ rCTLFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor );
+ m_aPreviewWin.Invalidate();
+ USHORT nSelPos = m_pColorLB->GetEntryPos( aColor );
+ if ( nSelPos == LISTBOX_ENTRY_NOTFOUND && aColor == Color( COL_TRANSPARENT ) )
+ nSelPos = m_pColorLB->GetEntryPos( m_pImpl->m_aTransparentText );
+
+ if ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
+ m_pColorLB->SelectEntryPos( nSelPos );
+ else
+ {
+ nSelPos = m_pColorLB->GetEntryPos( aColor );
+ if ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
+ m_pColorLB->SelectEntryPos( nSelPos );
+ else
+ m_pColorLB->SelectEntryPos(
+ m_pColorLB->InsertEntry( aColor, String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) );
+ }
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxCharNamePage::FillItemSetColor_Impl( SfxItemSet& rSet )
+{
+ USHORT nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
+ const SvxColorItem* pOld = (const SvxColorItem*)GetOldItem( rSet, SID_ATTR_CHAR_COLOR );
+ const SvxColorItem* pItem = NULL;
+ BOOL bChanged = TRUE;
+ const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL;
+ const SfxItemSet& rOldSet = GetItemSet();
+
+ Color aSelectedColor;
+ if ( m_pColorLB->GetSelectEntry() == m_pImpl->m_aTransparentText )
+ aSelectedColor = Color( COL_TRANSPARENT );
+ else
+ aSelectedColor = m_pColorLB->GetSelectEntryColor();
+
+ if ( pOld && pOld->GetValue() == aSelectedColor )
+ bChanged = FALSE;
+
+ if ( !bChanged )
+ bChanged = ( m_pColorLB->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND );
+
+ if ( !bChanged && pExampleSet &&
+ pExampleSet->GetItemState( nWhich, FALSE, (const SfxPoolItem**)&pItem ) == SFX_ITEM_SET &&
+ ( (SvxColorItem*)pItem )->GetValue() != aSelectedColor )
+ bChanged = TRUE;
+
+ BOOL bModified = FALSE;
+
+ if ( bChanged && m_pColorLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ {
+ rSet.Put( SvxColorItem( aSelectedColor, nWhich ) );
+ bModified = TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharNamePage, UpdateHdl_Impl, Timer*, EMPTYARG )
+{
+ UpdatePreview_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharNamePage, FontModifyHdl_Impl, void*, pNameBox )
+{
+ m_pImpl->m_aUpdateTimer.Start();
+
+ if ( m_pWestFontNameLB == pNameBox || m_pEastFontNameLB == pNameBox || m_pCTLFontNameLB == pNameBox )
+ {
+ FillStyleBox_Impl( (FontNameBox*)pNameBox );
+ FillSizeBox_Impl( (FontNameBox*)pNameBox );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharNamePage, ColorBoxSelectHdl_Impl, ColorListBox*, pBox )
+{
+ SvxFont& rFont = GetPreviewFont();
+ SvxFont& rCJKFont = GetPreviewCJKFont();
+ SvxFont& rCTLFont = GetPreviewCTLFont();
+ Color aSelectedColor;
+ if ( pBox->GetSelectEntry() == m_pImpl->m_aTransparentText )
+ aSelectedColor = Color( COL_TRANSPARENT );
+ else
+ aSelectedColor = pBox->GetSelectEntryColor();
+ rFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor );
+ rCJKFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor );
+ rCTLFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor );
+ m_aPreviewWin.Invalidate();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharNamePage::ActivatePage( const SfxItemSet& rSet )
+{
+ SvxCharBasePage::ActivatePage( rSet );
+
+ UpdatePreview_Impl(); // instead of asynchronous calling in ctor
+}
+
+// -----------------------------------------------------------------------
+
+int SvxCharNamePage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxCharNamePage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxCharNamePage( pParent, rSet );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxCharNamePage::GetRanges()
+{
+ return pNameRanges;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharNamePage::Reset( const SfxItemSet& rSet )
+{
+ Reset_Impl( rSet, Western );
+ Reset_Impl( rSet, Asian );
+ Reset_Impl( rSet, Ctl );
+ ResetColor_Impl( rSet );
+ m_pColorLB->SaveValue();
+
+ SetPrevFontWidthScale( rSet );
+ UpdatePreview_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxCharNamePage::FillItemSet( SfxItemSet& rSet )
+{
+ BOOL bModified = FillItemSet_Impl( rSet, Western );
+ bModified |= FillItemSet_Impl( rSet, Asian );
+ bModified |= FillItemSet_Impl( rSet, Ctl );
+//! bModified |= FillItemSetColor_Impl( rSet );
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharNamePage::SetFontList( const SvxFontListItem& rItem )
+{
+ if ( m_pImpl->m_bMustDelete )
+ {
+ delete m_pImpl->m_pFontList;
+ }
+ m_pImpl->m_pFontList = rItem.GetFontList()->Clone();
+ m_pImpl->m_bMustDelete = TRUE;
+}
+
+// -----------------------------------------------------------------------
+namespace
+{
+ void enableRelativeMode( SvxCharNamePage* _pPage, FontSizeBox* _pFontSizeLB, USHORT _nHeightWhich )
+ {
+ _pFontSizeLB->EnableRelativeMode( 5, 995, 5 ); // min 5%, max 995%, step 5
+
+ const SvxFontHeightItem& rHeightItem =
+ (SvxFontHeightItem&)_pPage->GetItemSet().GetParent()->Get( _nHeightWhich );
+ SfxMapUnit eUnit = _pPage->GetItemSet().GetPool()->GetMetric( _nHeightWhich );
+ short nCurHeight =
+ static_cast< short >( CalcToPoint( rHeightItem.GetHeight(), eUnit, 1 ) * 10 );
+
+ // ausgehend von der akt. Hoehe:
+ // - negativ bis minimal 2 pt
+ // - positiv bis maximal 999 pt
+ _pFontSizeLB->EnablePtRelativeMode( sal::static_int_cast< short >(-(nCurHeight - 20)), (9999 - nCurHeight), 10 );
+ }
+}
+// -----------------------------------------------------------------------------
+
+void SvxCharNamePage::EnableRelativeMode()
+{
+ DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no ParentSet!" );
+ enableRelativeMode(this,m_pWestFontSizeLB,GetWhich( SID_ATTR_CHAR_FONTHEIGHT ));
+ enableRelativeMode(this,m_pEastFontSizeLB,GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT ));
+ enableRelativeMode(this,m_pCTLFontSizeLB,GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT ));
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharNamePage::EnableSearchMode()
+{
+ m_pImpl->m_bInSearchMode = TRUE;
+}
+// -----------------------------------------------------------------------
+void SvxCharNamePage::DisableControls( USHORT nDisable )
+{
+ if ( DISABLE_LANGUAGE & nDisable )
+ {
+ if ( m_pWestFontLanguageFT ) m_pWestFontLanguageFT->Disable();
+ if ( m_pWestFontLanguageLB ) m_pWestFontLanguageLB->Disable();
+ if ( m_pEastFontLanguageFT ) m_pEastFontLanguageFT->Disable();
+ if ( m_pEastFontLanguageLB ) m_pEastFontLanguageLB->Disable();
+ if ( m_pCTLFontLanguageFT ) m_pCTLFontLanguageFT->Disable();
+ if ( m_pCTLFontLanguageLB ) m_pCTLFontLanguageLB->Disable();
+ }
+
+ if ( DISABLE_HIDE_LANGUAGE & nDisable )
+ {
+ if ( m_pWestFontLanguageFT ) m_pWestFontLanguageFT->Hide();
+ if ( m_pWestFontLanguageLB ) m_pWestFontLanguageLB->Hide();
+ if ( m_pEastFontLanguageFT ) m_pEastFontLanguageFT->Hide();
+ if ( m_pEastFontLanguageLB ) m_pEastFontLanguageLB->Hide();
+ if ( m_pCTLFontLanguageFT ) m_pCTLFontLanguageFT->Hide();
+ if ( m_pCTLFontLanguageLB ) m_pCTLFontLanguageLB->Hide();
+ }
+}
+
+// -----------------------------------------------------------------------
+void SvxCharNamePage::SetPreviewBackgroundToCharacter()
+{
+ m_bPreviewBackgroundToCharacter = sal_True;
+}
+
+// -----------------------------------------------------------------------
+void SvxCharNamePage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pFontListItem,SvxFontListItem,SID_ATTR_CHAR_FONTLIST,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pDisalbeItem,SfxUInt16Item,SID_DISABLE_CTL,sal_False);
+ if (pFontListItem)
+ SetFontList(*pFontListItem);
+ //CHINA001 SetFontList(pFontListItem->GetFontList());
+
+ if (pFlagItem)
+ {
+ UINT32 nFlags=pFlagItem->GetValue();
+ if ( ( nFlags & SVX_RELATIVE_MODE ) == SVX_RELATIVE_MODE )
+ EnableRelativeMode();
+ if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER )
+ SetPreviewBackgroundToCharacter();
+ }
+ if (pDisalbeItem)
+ DisableControls(pDisalbeItem->GetValue());
+}
+// class SvxCharEffectsPage ----------------------------------------------
+
+SvxCharEffectsPage::SvxCharEffectsPage( Window* pParent, const SfxItemSet& rInSet ) :
+
+ SvxCharBasePage( pParent, SVX_RES( RID_SVXPAGE_CHAR_EFFECTS ), rInSet, WIN_EFFECTS_PREVIEW, FT_EFFECTS_FONTTYPE ),
+
+ m_aFontColorFT ( this, SVX_RES( FT_FONTCOLOR ) ),
+ m_aFontColorLB ( this, SVX_RES( LB_FONTCOLOR ) ),
+
+ m_aEffectsFT ( this, SVX_RES( FT_EFFECTS ) ),
+ m_aEffectsLB ( this, 0 ),
+
+ m_aEffects2LB ( this, SVX_RES( LB_EFFECTS2 ) ),
+
+ m_aReliefFT ( this, SVX_RES( FT_RELIEF ) ),
+ m_aReliefLB ( this, SVX_RES( LB_RELIEF ) ),
+
+ m_aOutlineBtn ( this, SVX_RES( CB_OUTLINE ) ),
+ m_aShadowBtn ( this, SVX_RES( CB_SHADOW ) ),
+ m_aBlinkingBtn ( this, SVX_RES( CB_BLINKING ) ),
+ m_aHiddenBtn ( this, SVX_RES( CB_CHARHIDDEN ) ),
+
+ m_aVerticalLine ( this, SVX_RES( FL_EFFECTS_VERTICAL ) ),
+
+ m_aOverlineFT ( this, SVX_RES( FT_OVERLINE ) ),
+ m_aOverlineLB ( this, SVX_RES( LB_OVERLINE ) ),
+ m_aOverlineColorFT ( this, SVX_RES( FT_OVERLINE_COLOR ) ),
+ m_aOverlineColorLB ( this, SVX_RES( LB_OVERLINE_COLOR ) ),
+ m_aStrikeoutFT ( this, SVX_RES( FT_STRIKEOUT ) ),
+ m_aStrikeoutLB ( this, SVX_RES( LB_STRIKEOUT ) ),
+ m_aUnderlineFT ( this, SVX_RES( FT_UNDERLINE ) ),
+ m_aUnderlineLB ( this, SVX_RES( LB_UNDERLINE ) ),
+ m_aUnderlineColorFT ( this, SVX_RES( FT_UNDERLINE_COLOR ) ),
+ m_aUnderlineColorLB ( this, SVX_RES( LB_UNDERLINE_COLOR ) ),
+ m_aIndividualWordsBtn ( this, SVX_RES( CB_INDIVIDUALWORDS ) ),
+
+ m_aAsianLine ( this, SVX_RES( FL_EFFECTS_ASIAN ) ),
+
+ m_aEmphasisFT ( this, SVX_RES( FT_EMPHASIS ) ),
+ m_aEmphasisLB ( this, SVX_RES( LB_EMPHASIS ) ),
+ m_aPositionFT ( this, SVX_RES( FT_POSITION ) ),
+ m_aPositionLB ( this, SVX_RES( LB_POSITION ) ),
+
+ m_aTransparentColorName ( SVX_RES( STR_CHARNAME_TRANSPARENT ) )
+
+{
+ m_aEffectsLB.Hide();
+ FreeResource();
+ Initialize();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharEffectsPage::Initialize()
+{
+ // to handle the changes of the other pages
+ SetExchangeSupport();
+
+ // HTML-Mode
+ const SfxPoolItem* pItem;
+ SfxObjectShell* pShell;
+ if ( SFX_ITEM_SET == GetItemSet().GetItemState( SID_HTML_MODE, FALSE, &pItem ) ||
+ ( NULL != ( pShell = SfxObjectShell::Current() ) &&
+ NULL != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) )
+ {
+ m_nHtmlMode = ( (const SfxUInt16Item*)pItem )->GetValue();
+ if ( ( m_nHtmlMode & HTMLMODE_ON ) == HTMLMODE_ON )
+ {
+ //!!! hide some controls please
+ }
+ }
+
+ // fill the color box
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ DBG_ASSERT( pDocSh, "DocShell not found!" );
+ XColorTable* pColorTable = NULL;
+ FASTBOOL bKillTable = FALSE;
+
+ if ( pDocSh )
+ {
+ pItem = pDocSh->GetItem( SID_COLOR_TABLE );
+ if ( pItem != NULL )
+ pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
+ }
+
+ if ( !pColorTable )
+ {
+ pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+ bKillTable = TRUE;
+ }
+
+ m_aUnderlineColorLB.SetUpdateMode( FALSE );
+ m_aOverlineColorLB.SetUpdateMode( FALSE );
+ m_aFontColorLB.SetUpdateMode( FALSE );
+
+ {
+ SfxPoolItem* pDummy;
+ SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh );
+ if ( !pFrame ||
+ SFX_ITEM_DEFAULT > pFrame->GetBindings().QueryState( SID_ATTR_AUTO_COLOR_INVALID, pDummy ) )
+ {
+ m_aUnderlineColorLB.InsertAutomaticEntry();
+ m_aOverlineColorLB.InsertAutomaticEntry();
+ m_aFontColorLB.InsertAutomaticEntry();
+ }
+ }
+ for ( long i = 0; i < pColorTable->Count(); i++ )
+ {
+ XColorEntry* pEntry = pColorTable->GetColor(i);
+ m_aUnderlineColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ m_aOverlineColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ m_aFontColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ }
+
+ m_aUnderlineColorLB.SetUpdateMode( TRUE );
+ m_aOverlineColorLB.SetUpdateMode( TRUE );
+ m_aFontColorLB.SetUpdateMode( TRUE );
+ m_aFontColorLB.SetSelectHdl( LINK( this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl ) );
+
+ if ( bKillTable )
+ delete pColorTable;
+
+ // handler
+ Link aLink = LINK( this, SvxCharEffectsPage, SelectHdl_Impl );
+ m_aUnderlineLB.SetSelectHdl( aLink );
+ m_aUnderlineColorLB.SetSelectHdl( aLink );
+ m_aOverlineLB.SetSelectHdl( aLink );
+ m_aOverlineColorLB.SetSelectHdl( aLink );
+ m_aStrikeoutLB.SetSelectHdl( aLink );
+ m_aEmphasisLB.SetSelectHdl( aLink );
+ m_aPositionLB.SetSelectHdl( aLink );
+ m_aEffects2LB.SetSelectHdl( aLink );
+ m_aReliefLB.SetSelectHdl( aLink );
+
+ m_aUnderlineLB.SelectEntryPos( 0 );
+ m_aUnderlineColorLB.SelectEntryPos( 0 );
+ m_aOverlineLB.SelectEntryPos( 0 );
+ m_aOverlineColorLB.SelectEntryPos( 0 );
+ m_aStrikeoutLB.SelectEntryPos( 0 );
+ m_aEmphasisLB.SelectEntryPos( 0 );
+ m_aPositionLB.SelectEntryPos( 0 );
+ SelectHdl_Impl( NULL );
+ SelectHdl_Impl( &m_aEmphasisLB );
+
+ m_aEffects2LB.SelectEntryPos( 0 );
+
+ m_aIndividualWordsBtn.SetClickHdl( LINK( this, SvxCharEffectsPage, CbClickHdl_Impl ) );
+ aLink = LINK( this, SvxCharEffectsPage, TristClickHdl_Impl );
+ m_aOutlineBtn.SetClickHdl( aLink );
+ m_aShadowBtn.SetClickHdl( aLink );
+
+ if ( !SvtLanguageOptions().IsAsianTypographyEnabled() )
+ {
+ m_aAsianLine.Hide();
+ m_aEmphasisFT.Hide();
+ m_aEmphasisLB.Hide();
+ m_aPositionFT.Hide();
+ m_aPositionLB.Hide();
+ }
+}
+// -----------------------------------------------------------------------
+
+void SvxCharEffectsPage::UpdatePreview_Impl()
+{
+ SvxFont& rFont = GetPreviewFont();
+ SvxFont& rCJKFont = GetPreviewCJKFont();
+ SvxFont& rCTLFont = GetPreviewCTLFont();
+
+ USHORT nPos = m_aUnderlineLB.GetSelectEntryPos();
+ FontUnderline eUnderline = (FontUnderline)(ULONG)m_aUnderlineLB.GetEntryData( nPos );
+ nPos = m_aOverlineLB.GetSelectEntryPos();
+ FontUnderline eOverline = (FontUnderline)(ULONG)m_aOverlineLB.GetEntryData( nPos );
+ nPos = m_aStrikeoutLB.GetSelectEntryPos();
+ FontStrikeout eStrikeout = (FontStrikeout)(ULONG)m_aStrikeoutLB.GetEntryData( nPos );
+ rFont.SetUnderline( eUnderline );
+ rCJKFont.SetUnderline( eUnderline );
+ rCTLFont.SetUnderline( eUnderline );
+ m_aPreviewWin.SetTextLineColor( m_aUnderlineColorLB.GetSelectEntryColor() );
+ rFont.SetOverline( eOverline );
+ rCJKFont.SetOverline( eOverline );
+ rCTLFont.SetOverline( eOverline );
+ m_aPreviewWin.SetOverlineColor( m_aOverlineColorLB.GetSelectEntryColor() );
+ rFont.SetStrikeout( eStrikeout );
+ rCJKFont.SetStrikeout( eStrikeout );
+ rCTLFont.SetStrikeout( eStrikeout );
+
+ nPos = m_aPositionLB.GetSelectEntryPos();
+ BOOL bUnder = ( CHRDLG_POSITION_UNDER == (ULONG)m_aPositionLB.GetEntryData( nPos ) );
+ FontEmphasisMark eMark = (FontEmphasisMark)m_aEmphasisLB.GetSelectEntryPos();
+ eMark |= bUnder ? EMPHASISMARK_POS_BELOW : EMPHASISMARK_POS_ABOVE;
+ rFont.SetEmphasisMark( eMark );
+ rCJKFont.SetEmphasisMark( eMark );
+ rCTLFont.SetEmphasisMark( eMark );
+
+ USHORT nRelief = m_aReliefLB.GetSelectEntryPos();
+ if(LISTBOX_ENTRY_NOTFOUND != nRelief)
+ {
+ rFont.SetRelief( (FontRelief)nRelief );
+ rCJKFont.SetRelief( (FontRelief)nRelief );
+ rCTLFont.SetRelief( (FontRelief)nRelief );
+ }
+
+ rFont.SetOutline( StateToAttr( m_aOutlineBtn.GetState() ) );
+ rCJKFont.SetOutline( rFont.IsOutline() );
+ rCTLFont.SetOutline( rFont.IsOutline() );
+
+ rFont.SetShadow( StateToAttr( m_aShadowBtn.GetState() ) );
+ rCJKFont.SetShadow( rFont.IsShadow() );
+ rCTLFont.SetShadow( rFont.IsShadow() );
+
+ USHORT nCapsPos = m_aEffects2LB.GetSelectEntryPos();
+ if ( nCapsPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ rFont.SetCaseMap( (SvxCaseMap)nCapsPos );
+ rCJKFont.SetCaseMap( (SvxCaseMap)nCapsPos );
+ // #i78474# small caps do not exist in CTL fonts
+ rCTLFont.SetCaseMap( static_cast<SvxCaseMap>( nCapsPos == SVX_CASEMAP_KAPITAELCHEN ? SVX_CASEMAP_NOT_MAPPED : (SvxCaseMap)nCapsPos) );
+ }
+
+ BOOL bWordLine = m_aIndividualWordsBtn.IsChecked();
+ rFont.SetWordLineMode( bWordLine );
+ rCJKFont.SetWordLineMode( bWordLine );
+ rCTLFont.SetWordLineMode( bWordLine );
+
+ m_aPreviewWin.Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharEffectsPage::SetCaseMap_Impl( SvxCaseMap eCaseMap )
+{
+ if ( SVX_CASEMAP_END > eCaseMap )
+ m_aEffects2LB.SelectEntryPos(
+ sal::static_int_cast< USHORT >( eCaseMap ) );
+ else
+ {
+ m_aEffects2LB.SetNoSelection();
+ eCaseMap = SVX_CASEMAP_NOT_MAPPED;
+ }
+
+ UpdatePreview_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet )
+{
+ USHORT nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
+ SfxItemState eState = rSet.GetItemState( nWhich );
+
+ switch ( eState )
+ {
+ case SFX_ITEM_UNKNOWN:
+ m_aFontColorFT.Hide();
+ m_aFontColorLB.Hide();
+ break;
+
+ case SFX_ITEM_DISABLED:
+ case SFX_ITEM_READONLY:
+ m_aFontColorFT.Disable();
+ m_aFontColorLB.Disable();
+ break;
+
+ case SFX_ITEM_DONTCARE:
+ m_aFontColorLB.SetNoSelection();
+ break;
+
+ case SFX_ITEM_DEFAULT:
+ case SFX_ITEM_SET:
+ {
+ SvxFont& rFont = GetPreviewFont();
+ SvxFont& rCJKFont = GetPreviewCJKFont();
+ SvxFont& rCTLFont = GetPreviewCTLFont();
+
+ const SvxColorItem& rItem = (SvxColorItem&)rSet.Get( nWhich );
+ Color aColor = rItem.GetValue();
+ rFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor );
+ rCJKFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor );
+ rCTLFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor );
+
+ m_aPreviewWin.Invalidate();
+ USHORT nSelPos = m_aFontColorLB.GetEntryPos( aColor );
+ if ( nSelPos == LISTBOX_ENTRY_NOTFOUND && aColor == Color( COL_TRANSPARENT ) )
+ nSelPos = m_aFontColorLB.GetEntryPos( m_aTransparentColorName );
+
+ if ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
+ m_aFontColorLB.SelectEntryPos( nSelPos );
+ else
+ {
+ nSelPos = m_aFontColorLB.GetEntryPos( aColor );
+ if ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
+ m_aFontColorLB.SelectEntryPos( nSelPos );
+ else
+ m_aFontColorLB.SelectEntryPos(
+ m_aFontColorLB.InsertEntry( aColor, String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) );
+ }
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet )
+{
+ USHORT nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
+ const SvxColorItem* pOld = (const SvxColorItem*)GetOldItem( rSet, SID_ATTR_CHAR_COLOR );
+ const SvxColorItem* pItem = NULL;
+ BOOL bChanged = TRUE;
+ const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL;
+ const SfxItemSet& rOldSet = GetItemSet();
+
+ Color aSelectedColor;
+ if ( m_aFontColorLB.GetSelectEntry() == m_aTransparentColorName )
+ aSelectedColor = Color( COL_TRANSPARENT );
+ else
+ aSelectedColor = m_aFontColorLB.GetSelectEntryColor();
+
+ if ( pOld && pOld->GetValue() == aSelectedColor )
+ bChanged = FALSE;
+
+ if ( !bChanged )
+ bChanged = ( m_aFontColorLB.GetSavedValue() == LISTBOX_ENTRY_NOTFOUND );
+
+ if ( !bChanged && pExampleSet &&
+ pExampleSet->GetItemState( nWhich, FALSE, (const SfxPoolItem**)&pItem ) == SFX_ITEM_SET &&
+ ( (SvxColorItem*)pItem )->GetValue() != aSelectedColor )
+ bChanged = TRUE;
+
+ BOOL bModified = FALSE;
+
+ if ( bChanged && m_aFontColorLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ {
+ rSet.Put( SvxColorItem( aSelectedColor, nWhich ) );
+ bModified = TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharEffectsPage, SelectHdl_Impl, ListBox*, pBox )
+{
+ if ( &m_aEmphasisLB == pBox )
+ {
+ USHORT nEPos = m_aEmphasisLB.GetSelectEntryPos();
+ BOOL bEnable = ( nEPos > 0 && nEPos != LISTBOX_ENTRY_NOTFOUND );
+ m_aPositionFT.Enable( bEnable );
+ m_aPositionLB.Enable( bEnable );
+ }
+ else if( &m_aReliefLB == pBox)
+ {
+ BOOL bEnable = ( pBox->GetSelectEntryPos() == 0 );
+ m_aOutlineBtn.Enable( bEnable );
+ m_aShadowBtn.Enable( bEnable );
+ }
+ else if ( &m_aPositionLB != pBox )
+ {
+ USHORT nUPos = m_aUnderlineLB.GetSelectEntryPos(),
+ nOPos = m_aOverlineLB.GetSelectEntryPos(),
+ nSPos = m_aStrikeoutLB.GetSelectEntryPos();
+ BOOL bUEnable = ( nUPos > 0 && nUPos != LISTBOX_ENTRY_NOTFOUND );
+ BOOL bOEnable = ( nOPos > 0 && nOPos != LISTBOX_ENTRY_NOTFOUND );
+ m_aUnderlineColorFT.Enable( bUEnable );
+ m_aUnderlineColorLB.Enable( bUEnable );
+ m_aOverlineColorFT.Enable( bOEnable );
+ m_aOverlineColorLB.Enable( bOEnable );
+ m_aIndividualWordsBtn.Enable( bUEnable || bOEnable || ( nSPos > 0 && nSPos != LISTBOX_ENTRY_NOTFOUND ) );
+ }
+ UpdatePreview_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharEffectsPage, UpdatePreview_Impl, ListBox*, EMPTYARG )
+{
+ bool bEnable = ( ( m_aUnderlineLB.GetSelectEntryPos() > 0 ) ||
+ ( m_aOverlineLB.GetSelectEntryPos() > 0 ) ||
+ ( m_aStrikeoutLB.GetSelectEntryPos() > 0 ) );
+ m_aIndividualWordsBtn.Enable( bEnable );
+
+ UpdatePreview_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharEffectsPage, CbClickHdl_Impl, CheckBox*, EMPTYARG )
+{
+ UpdatePreview_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharEffectsPage, TristClickHdl_Impl, TriStateBox*, EMPTYARG )
+{
+ UpdatePreview_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharEffectsPage, ColorBoxSelectHdl_Impl, ColorListBox*, pBox )
+{
+ SvxFont& rFont = GetPreviewFont();
+ SvxFont& rCJKFont = GetPreviewCJKFont();
+ SvxFont& rCTLFont = GetPreviewCTLFont();
+
+ Color aSelectedColor;
+ if ( pBox->GetSelectEntry() == m_aTransparentColorName )
+ aSelectedColor = Color( COL_TRANSPARENT );
+ else
+ aSelectedColor = pBox->GetSelectEntryColor();
+ rFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor );
+ rCJKFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor );
+ rCTLFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor );
+
+ m_aPreviewWin.Invalidate();
+ return 0;
+}
+// -----------------------------------------------------------------------
+
+int SvxCharEffectsPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxCharEffectsPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxCharEffectsPage( pParent, rSet );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxCharEffectsPage::GetRanges()
+{
+ return pEffectsRanges;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharEffectsPage::Reset( const SfxItemSet& rSet )
+{
+ SvxFont& rFont = GetPreviewFont();
+ SvxFont& rCJKFont = GetPreviewCJKFont();
+ SvxFont& rCTLFont = GetPreviewCTLFont();
+
+ BOOL bEnable = FALSE;
+
+ // Underline
+ USHORT nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE );
+ rFont.SetUnderline( UNDERLINE_NONE );
+ rCJKFont.SetUnderline( UNDERLINE_NONE );
+ rCTLFont.SetUnderline( UNDERLINE_NONE );
+
+ m_aUnderlineLB.SelectEntryPos( 0 );
+ SfxItemState eState = rSet.GetItemState( nWhich );
+
+ if ( eState >= SFX_ITEM_DONTCARE )
+ {
+ if ( eState == SFX_ITEM_DONTCARE )
+ m_aUnderlineLB.SetNoSelection();
+ else
+ {
+ const SvxUnderlineItem& rItem = (SvxUnderlineItem&)rSet.Get( nWhich );
+ FontUnderline eUnderline = (FontUnderline)rItem.GetValue();
+ rFont.SetUnderline( eUnderline );
+ rCJKFont.SetUnderline( eUnderline );
+ rCTLFont.SetUnderline( eUnderline );
+
+ if ( eUnderline != UNDERLINE_NONE )
+ {
+ for ( USHORT i = 0; i < m_aUnderlineLB.GetEntryCount(); ++i )
+ {
+ if ( (FontUnderline)(ULONG)m_aUnderlineLB.GetEntryData(i) == eUnderline )
+ {
+ m_aUnderlineLB.SelectEntryPos(i);
+ bEnable |= TRUE;
+ break;
+ }
+ }
+
+ Color aColor = rItem.GetColor();
+ USHORT nPos = m_aUnderlineColorLB.GetEntryPos( aColor );
+
+ if ( LISTBOX_ENTRY_NOTFOUND != nPos )
+ m_aUnderlineColorLB.SelectEntryPos( nPos );
+ else
+ {
+ nPos = m_aUnderlineColorLB.GetEntryPos( aColor );
+ if ( LISTBOX_ENTRY_NOTFOUND != nPos )
+ m_aUnderlineColorLB.SelectEntryPos( nPos );
+ else
+ m_aUnderlineColorLB.SelectEntryPos(
+ m_aUnderlineColorLB.InsertEntry( aColor,
+ String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) );
+ }
+ }
+ else
+ {
+ m_aUnderlineColorLB.SelectEntry( Color( COL_AUTO ));
+ m_aUnderlineColorLB.Disable();
+ }
+ }
+ }
+
+ // Overline
+ nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE );
+ rFont.SetOverline( UNDERLINE_NONE );
+ rCJKFont.SetOverline( UNDERLINE_NONE );
+ rCTLFont.SetOverline( UNDERLINE_NONE );
+
+ m_aOverlineLB.SelectEntryPos( 0 );
+ eState = rSet.GetItemState( nWhich );
+
+ if ( eState >= SFX_ITEM_DONTCARE )
+ {
+ if ( eState == SFX_ITEM_DONTCARE )
+ m_aOverlineLB.SetNoSelection();
+ else
+ {
+ const SvxOverlineItem& rItem = (SvxOverlineItem&)rSet.Get( nWhich );
+ FontUnderline eOverline = (FontUnderline)rItem.GetValue();
+ rFont.SetOverline( eOverline );
+ rCJKFont.SetOverline( eOverline );
+ rCTLFont.SetOverline( eOverline );
+
+ if ( eOverline != UNDERLINE_NONE )
+ {
+ for ( USHORT i = 0; i < m_aOverlineLB.GetEntryCount(); ++i )
+ {
+ if ( (FontUnderline)(ULONG)m_aOverlineLB.GetEntryData(i) == eOverline )
+ {
+ m_aOverlineLB.SelectEntryPos(i);
+ bEnable |= TRUE;
+ break;
+ }
+ }
+
+ Color aColor = rItem.GetColor();
+ USHORT nPos = m_aOverlineColorLB.GetEntryPos( aColor );
+
+ if ( LISTBOX_ENTRY_NOTFOUND != nPos )
+ m_aOverlineColorLB.SelectEntryPos( nPos );
+ else
+ {
+ nPos = m_aOverlineColorLB.GetEntryPos( aColor );
+ if ( LISTBOX_ENTRY_NOTFOUND != nPos )
+ m_aOverlineColorLB.SelectEntryPos( nPos );
+ else
+ m_aOverlineColorLB.SelectEntryPos(
+ m_aOverlineColorLB.InsertEntry( aColor,
+ String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) );
+ }
+ }
+ else
+ {
+ m_aOverlineColorLB.SelectEntry( Color( COL_AUTO ));
+ m_aOverlineColorLB.Disable();
+ }
+ }
+ }
+
+ // Strikeout
+ nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT );
+ rFont.SetStrikeout( STRIKEOUT_NONE );
+ rCJKFont.SetStrikeout( STRIKEOUT_NONE );
+ rCTLFont.SetStrikeout( STRIKEOUT_NONE );
+
+ m_aStrikeoutLB.SelectEntryPos( 0 );
+ eState = rSet.GetItemState( nWhich );
+
+ if ( eState >= SFX_ITEM_DONTCARE )
+ {
+ if ( eState == SFX_ITEM_DONTCARE )
+ m_aStrikeoutLB.SetNoSelection();
+ else
+ {
+ const SvxCrossedOutItem& rItem = (SvxCrossedOutItem&)rSet.Get( nWhich );
+ FontStrikeout eStrikeout = (FontStrikeout)rItem.GetValue();
+ rFont.SetStrikeout( eStrikeout );
+ rCJKFont.SetStrikeout( eStrikeout );
+ rCTLFont.SetStrikeout( eStrikeout );
+
+ if ( eStrikeout != STRIKEOUT_NONE )
+ {
+ for ( USHORT i = 0; i < m_aStrikeoutLB.GetEntryCount(); ++i )
+ {
+ if ( (FontStrikeout)(ULONG)m_aStrikeoutLB.GetEntryData(i) == eStrikeout )
+ {
+ m_aStrikeoutLB.SelectEntryPos(i);
+ bEnable |= TRUE;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // WordLineMode
+ nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE );
+ switch ( eState )
+ {
+ case SFX_ITEM_UNKNOWN:
+ m_aIndividualWordsBtn.Hide();
+ break;
+
+ case SFX_ITEM_DISABLED:
+ case SFX_ITEM_READONLY:
+ m_aIndividualWordsBtn.Disable();
+ break;
+
+ case SFX_ITEM_DONTCARE:
+ m_aIndividualWordsBtn.SetState( STATE_DONTKNOW );
+ break;
+
+ case SFX_ITEM_DEFAULT:
+ case SFX_ITEM_SET:
+ {
+ const SvxWordLineModeItem& rItem = (SvxWordLineModeItem&)rSet.Get( nWhich );
+ rFont.SetWordLineMode( rItem.GetValue() );
+ rCJKFont.SetWordLineMode( rItem.GetValue() );
+ rCTLFont.SetWordLineMode( rItem.GetValue() );
+
+ m_aIndividualWordsBtn.Check( rItem.GetValue() );
+ m_aIndividualWordsBtn.Enable( bEnable );
+ break;
+ }
+ }
+
+ // Emphasis
+ nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK );
+ eState = rSet.GetItemState( nWhich );
+
+ if ( eState >= SFX_ITEM_DEFAULT )
+ {
+ const SvxEmphasisMarkItem& rItem = (SvxEmphasisMarkItem&)rSet.Get( nWhich );
+ FontEmphasisMark eMark = rItem.GetEmphasisMark();
+ rFont.SetEmphasisMark( eMark );
+ rCJKFont.SetEmphasisMark( eMark );
+ rCTLFont.SetEmphasisMark( eMark );
+
+ m_aEmphasisLB.SelectEntryPos( (USHORT)( eMark & EMPHASISMARK_STYLE ) );
+ eMark &= ~EMPHASISMARK_STYLE;
+ ULONG nEntryData = ( eMark == EMPHASISMARK_POS_ABOVE )
+ ? CHRDLG_POSITION_OVER
+ : ( eMark == EMPHASISMARK_POS_BELOW ) ? CHRDLG_POSITION_UNDER : 0;
+
+ for ( USHORT i = 0; i < m_aPositionLB.GetEntryCount(); i++ )
+ {
+ if ( nEntryData == (ULONG)m_aPositionLB.GetEntryData(i) )
+ {
+ m_aPositionLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ else if ( eState == SFX_ITEM_DONTCARE )
+ m_aEmphasisLB.SetNoSelection( );
+ else if ( eState == SFX_ITEM_UNKNOWN )
+ {
+ m_aEmphasisFT.Hide();
+ m_aEmphasisLB.Hide();
+ }
+ else // SFX_ITEM_DISABLED or SFX_ITEM_READONLY
+ {
+ m_aEmphasisFT.Disable();
+ m_aEmphasisLB.Disable();
+ }
+
+ // the select handler for the underline/overline/strikeout list boxes
+// SelectHdl_Impl( NULL );
+ DBG_ASSERT(m_aUnderlineLB.GetSelectHdl() == m_aOverlineLB.GetSelectHdl(),
+ "SvxCharEffectsPage::Reset: inconsistence (1)!");
+ DBG_ASSERT(m_aUnderlineLB.GetSelectHdl() == m_aStrikeoutLB.GetSelectHdl(),
+ "SvxCharEffectsPage::Reset: inconsistence (1)!");
+ m_aUnderlineLB.GetSelectHdl().Call(NULL);
+ // don't call SelectHdl_Impl directly!
+ // in DisableControls, we may have re-reouted the select handler
+ // 30.05.2001 - 86262 - frank.schoenheit@germany.sun.com
+
+ // the select handler for the emphasis listbox
+// SelectHdl_Impl( &m_aEmphasisLB );
+ DBG_ASSERT(m_aEmphasisLB.GetSelectHdl() == LINK(this, SvxCharEffectsPage, SelectHdl_Impl),
+ "SvxCharEffectsPage::Reset: inconsistence (2)!");
+ m_aEmphasisLB.GetSelectHdl().Call( &m_aEmphasisLB );
+ // this is for consistency only. Here it would be allowed to call SelectHdl_Impl directly ...
+
+ // Effects
+ SvxCaseMap eCaseMap = SVX_CASEMAP_END;
+ nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP );
+ eState = rSet.GetItemState( nWhich );
+ switch ( eState )
+ {
+ case SFX_ITEM_UNKNOWN:
+ m_aEffectsFT.Hide();
+ m_aEffects2LB.Hide();
+ break;
+
+ case SFX_ITEM_DISABLED:
+ case SFX_ITEM_READONLY:
+ m_aEffectsFT.Disable();
+ m_aEffects2LB.Disable();
+ break;
+
+ case SFX_ITEM_DONTCARE:
+ m_aEffects2LB.SetNoSelection();
+ break;
+
+ case SFX_ITEM_DEFAULT:
+ case SFX_ITEM_SET:
+ {
+ const SvxCaseMapItem& rItem = (const SvxCaseMapItem&)rSet.Get( nWhich );
+ eCaseMap = (SvxCaseMap)rItem.GetValue();
+ break;
+ }
+ }
+ SetCaseMap_Impl( eCaseMap );
+
+ //Relief
+ nWhich = GetWhich(SID_ATTR_CHAR_RELIEF);
+ eState = rSet.GetItemState( nWhich );
+ switch ( eState )
+ {
+ case SFX_ITEM_UNKNOWN:
+ m_aReliefFT.Hide();
+ m_aReliefLB.Hide();
+ break;
+
+ case SFX_ITEM_DISABLED:
+ case SFX_ITEM_READONLY:
+ m_aReliefFT.Disable();
+ m_aReliefLB.Disable();
+ break;
+
+ case SFX_ITEM_DONTCARE:
+ m_aReliefLB.SetNoSelection();
+ break;
+
+ case SFX_ITEM_DEFAULT:
+ case SFX_ITEM_SET:
+ {
+ const SvxCharReliefItem& rItem = (const SvxCharReliefItem&)rSet.Get( nWhich );
+ m_aReliefLB.SelectEntryPos(rItem.GetValue());
+ SelectHdl_Impl(&m_aReliefLB);
+ break;
+ }
+ }
+
+ // Outline
+ nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR );
+ eState = rSet.GetItemState( nWhich );
+ switch ( eState )
+ {
+ case SFX_ITEM_UNKNOWN:
+ m_aOutlineBtn.Hide();
+ break;
+
+ case SFX_ITEM_DISABLED:
+ case SFX_ITEM_READONLY:
+ m_aOutlineBtn.Disable();
+ break;
+
+ case SFX_ITEM_DONTCARE:
+ m_aOutlineBtn.SetState( STATE_DONTKNOW );
+ break;
+
+ case SFX_ITEM_DEFAULT:
+ case SFX_ITEM_SET:
+ {
+ const SvxContourItem& rItem = (SvxContourItem&)rSet.Get( nWhich );
+ m_aOutlineBtn.SetState( (TriState)rItem.GetValue() );
+ m_aOutlineBtn.EnableTriState( FALSE );
+ break;
+ }
+ }
+
+ // Shadow
+ nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED );
+ eState = rSet.GetItemState( nWhich );
+
+ switch ( eState )
+ {
+ case SFX_ITEM_UNKNOWN:
+ m_aShadowBtn.Hide();
+ break;
+
+ case SFX_ITEM_DISABLED:
+ case SFX_ITEM_READONLY:
+ m_aShadowBtn.Disable();
+ break;
+
+ case SFX_ITEM_DONTCARE:
+ m_aShadowBtn.SetState( STATE_DONTKNOW );
+ break;
+
+ case SFX_ITEM_DEFAULT:
+ case SFX_ITEM_SET:
+ {
+ const SvxShadowedItem& rItem = (SvxShadowedItem&)rSet.Get( nWhich );
+ m_aShadowBtn.SetState( (TriState)rItem.GetValue() );
+ m_aShadowBtn.EnableTriState( FALSE );
+ break;
+ }
+ }
+
+ // Blinking
+ nWhich = GetWhich( SID_ATTR_FLASH );
+ eState = rSet.GetItemState( nWhich );
+
+ switch ( eState )
+ {
+ case SFX_ITEM_UNKNOWN:
+ m_aBlinkingBtn.Hide();
+ break;
+
+ case SFX_ITEM_DISABLED:
+ case SFX_ITEM_READONLY:
+ m_aBlinkingBtn.Disable();
+ break;
+
+ case SFX_ITEM_DONTCARE:
+ m_aBlinkingBtn.SetState( STATE_DONTKNOW );
+ break;
+
+ case SFX_ITEM_DEFAULT:
+ case SFX_ITEM_SET:
+ {
+ const SvxBlinkItem& rItem = (SvxBlinkItem&)rSet.Get( nWhich );
+ m_aBlinkingBtn.SetState( (TriState)rItem.GetValue() );
+ m_aBlinkingBtn.EnableTriState( FALSE );
+ break;
+ }
+ }
+ // Hidden
+ nWhich = GetWhich( SID_ATTR_CHAR_HIDDEN );
+ eState = rSet.GetItemState( nWhich );
+
+ switch ( eState )
+ {
+ case SFX_ITEM_UNKNOWN:
+ m_aHiddenBtn.Hide();
+ break;
+
+ case SFX_ITEM_DISABLED:
+ case SFX_ITEM_READONLY:
+ m_aHiddenBtn.Disable();
+ break;
+
+ case SFX_ITEM_DONTCARE:
+ m_aHiddenBtn.SetState( STATE_DONTKNOW );
+ break;
+
+ case SFX_ITEM_DEFAULT:
+ case SFX_ITEM_SET:
+ {
+ const SvxCharHiddenItem& rItem = (SvxCharHiddenItem&)rSet.Get( nWhich );
+ m_aHiddenBtn.SetState( (TriState)rItem.GetValue() );
+ m_aHiddenBtn.EnableTriState( FALSE );
+ break;
+ }
+ }
+
+ SetPrevFontWidthScale( rSet );
+ ResetColor_Impl( rSet );
+
+ // preview update
+ m_aPreviewWin.Invalidate();
+
+ // save this settings
+ m_aUnderlineLB.SaveValue();
+ m_aUnderlineColorLB.SaveValue();
+ m_aOverlineLB.SaveValue();
+ m_aOverlineColorLB.SaveValue();
+ m_aStrikeoutLB.SaveValue();
+ m_aIndividualWordsBtn.SaveValue();
+ m_aEmphasisLB.SaveValue();
+ m_aPositionLB.SaveValue();
+ m_aEffects2LB.SaveValue();
+ m_aReliefLB.SaveValue();
+ m_aOutlineBtn.SaveValue();
+ m_aShadowBtn.SaveValue();
+ m_aBlinkingBtn.SaveValue();
+ m_aHiddenBtn.SaveValue();
+ m_aFontColorLB.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxCharEffectsPage::FillItemSet( SfxItemSet& rSet )
+{
+ const SfxPoolItem* pOld = 0;
+ const SfxItemSet& rOldSet = GetItemSet();
+ BOOL bModified = FALSE;
+ FASTBOOL bChanged = TRUE;
+
+ // Underline
+ USHORT nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE );
+ pOld = GetOldItem( rSet, SID_ATTR_CHAR_UNDERLINE );
+ USHORT nPos = m_aUnderlineLB.GetSelectEntryPos();
+ FontUnderline eUnder = (FontUnderline)(ULONG)m_aUnderlineLB.GetEntryData( nPos );
+
+ if ( pOld )
+ {
+ //! if there are different underline styles in the selection the
+ //! item-state in the 'rOldSet' will be invalid. In this case
+ //! changing the underline style will be allowed if a style is
+ //! selected in the listbox.
+ BOOL bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos &&
+ SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, TRUE );
+
+ const SvxUnderlineItem& rItem = *( (const SvxUnderlineItem*)pOld );
+ if ( (FontUnderline)rItem.GetValue() == eUnder &&
+ ( UNDERLINE_NONE == eUnder || rItem.GetColor() == m_aUnderlineColorLB.GetSelectEntryColor() ) &&
+ ! bAllowChg )
+ bChanged = FALSE;
+ }
+
+ if ( bChanged )
+ {
+ SvxUnderlineItem aNewItem( eUnder, nWhich );
+ aNewItem.SetColor( m_aUnderlineColorLB.GetSelectEntryColor() );
+ rSet.Put( aNewItem );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bChanged = TRUE;
+
+ // Overline
+ nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE );
+ pOld = GetOldItem( rSet, SID_ATTR_CHAR_OVERLINE );
+ nPos = m_aOverlineLB.GetSelectEntryPos();
+ FontUnderline eOver = (FontUnderline)(ULONG)m_aOverlineLB.GetEntryData( nPos );
+
+ if ( pOld )
+ {
+ //! if there are different underline styles in the selection the
+ //! item-state in the 'rOldSet' will be invalid. In this case
+ //! changing the underline style will be allowed if a style is
+ //! selected in the listbox.
+ BOOL bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos &&
+ SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, TRUE );
+
+ const SvxOverlineItem& rItem = *( (const SvxOverlineItem*)pOld );
+ if ( (FontUnderline)rItem.GetValue() == eOver &&
+ ( UNDERLINE_NONE == eOver || rItem.GetColor() == m_aOverlineColorLB.GetSelectEntryColor() ) &&
+ ! bAllowChg )
+ bChanged = FALSE;
+ }
+
+ if ( bChanged )
+ {
+ SvxOverlineItem aNewItem( eOver, nWhich );
+ aNewItem.SetColor( m_aOverlineColorLB.GetSelectEntryColor() );
+ rSet.Put( aNewItem );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bChanged = TRUE;
+
+ // Strikeout
+ nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT );
+ pOld = GetOldItem( rSet, SID_ATTR_CHAR_STRIKEOUT );
+ nPos = m_aStrikeoutLB.GetSelectEntryPos();
+ FontStrikeout eStrike = (FontStrikeout)(ULONG)m_aStrikeoutLB.GetEntryData( nPos );
+
+ if ( pOld )
+ {
+ //! if there are different strikeout styles in the selection the
+ //! item-state in the 'rOldSet' will be invalid. In this case
+ //! changing the strikeout style will be allowed if a style is
+ //! selected in the listbox.
+ BOOL bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos &&
+ SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, TRUE );
+
+ const SvxCrossedOutItem& rItem = *( (const SvxCrossedOutItem*)pOld );
+ if ( !m_aStrikeoutLB.IsEnabled()
+ || ((FontStrikeout)rItem.GetValue() == eStrike && !bAllowChg) )
+ bChanged = FALSE;
+ }
+
+ if ( bChanged )
+ {
+ rSet.Put( SvxCrossedOutItem( eStrike, nWhich ) );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bChanged = TRUE;
+
+ // Individual words
+ nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE );
+ pOld = GetOldItem( rSet, SID_ATTR_CHAR_WORDLINEMODE );
+
+ if ( pOld )
+ {
+ const SvxWordLineModeItem& rItem = *( (const SvxWordLineModeItem*)pOld );
+ if ( rItem.GetValue() == m_aIndividualWordsBtn.IsChecked() )
+ bChanged = FALSE;
+ }
+
+ if ( rOldSet.GetItemState( nWhich ) == SFX_ITEM_DONTCARE &&
+ m_aIndividualWordsBtn.IsChecked() == m_aIndividualWordsBtn.GetSavedValue() )
+ bChanged = FALSE;
+
+ if ( bChanged )
+ {
+ rSet.Put( SvxWordLineModeItem( m_aIndividualWordsBtn.IsChecked(), nWhich ) );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bChanged = TRUE;
+
+ // Emphasis
+ nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK );
+ pOld = GetOldItem( rSet, SID_ATTR_CHAR_EMPHASISMARK );
+ USHORT nMarkPos = m_aEmphasisLB.GetSelectEntryPos();
+ USHORT nPosPos = m_aPositionLB.GetSelectEntryPos();
+ FontEmphasisMark eMark = (FontEmphasisMark)nMarkPos;
+ if ( m_aPositionLB.IsEnabled() )
+ {
+ eMark |= ( CHRDLG_POSITION_UNDER == (ULONG)m_aPositionLB.GetEntryData( nPosPos ) )
+ ? EMPHASISMARK_POS_BELOW : EMPHASISMARK_POS_ABOVE;
+ }
+
+ if ( pOld )
+ {
+ if( rOldSet.GetItemState( nWhich ) != SFX_ITEM_DONTCARE )
+ {
+ const SvxEmphasisMarkItem& rItem = *( (const SvxEmphasisMarkItem*)pOld );
+ if ( rItem.GetEmphasisMark() == eMark )
+ bChanged = FALSE;
+ }
+ }
+
+ if ( rOldSet.GetItemState( nWhich ) == SFX_ITEM_DONTCARE &&
+ m_aEmphasisLB.GetSavedValue() == nMarkPos && m_aPositionLB.GetSavedValue() == nPosPos )
+ bChanged = FALSE;
+
+ if ( bChanged )
+ {
+ rSet.Put( SvxEmphasisMarkItem( eMark, nWhich ) );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bChanged = TRUE;
+
+ // Effects
+ nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP );
+ pOld = GetOldItem( rSet, SID_ATTR_CHAR_CASEMAP );
+ SvxCaseMap eCaseMap = SVX_CASEMAP_NOT_MAPPED;
+ FASTBOOL bChecked = FALSE;
+ USHORT nCapsPos = m_aEffects2LB.GetSelectEntryPos();
+ if ( nCapsPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ eCaseMap = (SvxCaseMap)nCapsPos;
+ bChecked = TRUE;
+ }
+
+ if ( pOld )
+ {
+ //! if there are different effect styles in the selection the
+ //! item-state in the 'rOldSet' will be invalid. In this case
+ //! changing the effect style will be allowed if a style is
+ //! selected in the listbox.
+ BOOL bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos &&
+ SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, TRUE );
+
+ const SvxCaseMapItem& rItem = *( (const SvxCaseMapItem*)pOld );
+ if ( (SvxCaseMap)rItem.GetValue() == eCaseMap && !bAllowChg )
+ bChanged = FALSE;
+ }
+
+ if ( bChanged && bChecked )
+ {
+ rSet.Put( SvxCaseMapItem( eCaseMap, nWhich ) );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bChanged = TRUE;
+
+ //Relief
+ nWhich = GetWhich(SID_ATTR_CHAR_RELIEF);
+ if(m_aReliefLB.GetSelectEntryPos() != m_aReliefLB.GetSavedValue())
+ {
+ m_aReliefLB.SaveValue();
+ SvxCharReliefItem aRelief((FontRelief)m_aReliefLB.GetSelectEntryPos(), nWhich);
+ rSet.Put(aRelief);
+ }
+
+ // Outline
+ const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL;
+ nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR );
+ pOld = GetOldItem( rSet, SID_ATTR_CHAR_CONTOUR );
+ TriState eState = m_aOutlineBtn.GetState();
+ const SfxPoolItem* pItem;
+
+ if ( pOld )
+ {
+ const SvxContourItem& rItem = *( (const SvxContourItem*)pOld );
+ if ( rItem.GetValue() == StateToAttr( eState ) && m_aOutlineBtn.GetSavedValue() == eState )
+ bChanged = FALSE;
+ }
+
+ if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET &&
+ !StateToAttr( eState ) && ( (SvxContourItem*)pItem )->GetValue() )
+ bChanged = TRUE;
+
+ if ( bChanged && eState != STATE_DONTKNOW )
+ {
+ rSet.Put( SvxContourItem( StateToAttr( eState ), nWhich ) );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bChanged = TRUE;
+
+ // Shadow
+ nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED );
+ pOld = GetOldItem( rSet, SID_ATTR_CHAR_SHADOWED );
+ eState = m_aShadowBtn.GetState();
+
+ if ( pOld )
+ {
+ const SvxShadowedItem& rItem = *( (const SvxShadowedItem*)pOld );
+ if ( rItem.GetValue() == StateToAttr( eState ) && m_aShadowBtn.GetSavedValue() == eState )
+ bChanged = FALSE;
+ }
+
+ if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET &&
+ !StateToAttr( eState ) && ( (SvxShadowedItem*)pItem )->GetValue() )
+ bChanged = TRUE;
+
+ if ( bChanged && eState != STATE_DONTKNOW )
+ {
+ rSet.Put( SvxShadowedItem( StateToAttr( eState ), nWhich ) );
+ bModified = TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bChanged = TRUE;
+
+ // Blinking
+ nWhich = GetWhich( SID_ATTR_FLASH );
+ pOld = GetOldItem( rSet, SID_ATTR_FLASH );
+ eState = m_aBlinkingBtn.GetState();
+
+ if ( pOld )
+ {
+ const SvxBlinkItem& rItem = *( (const SvxBlinkItem*)pOld );
+ if ( rItem.GetValue() == StateToAttr( eState ) && m_aBlinkingBtn.GetSavedValue() == eState )
+ bChanged = FALSE;
+ }
+
+ if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET &&
+ !StateToAttr( eState ) && ( (SvxBlinkItem*)pItem )->GetValue() )
+ bChanged = TRUE;
+
+ if ( bChanged && eState != STATE_DONTKNOW )
+ {
+ rSet.Put( SvxBlinkItem( StateToAttr( eState ), nWhich ) );
+ bModified = TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ // Hidden
+ nWhich = GetWhich( SID_ATTR_CHAR_HIDDEN );
+ pOld = GetOldItem( rSet, SID_ATTR_CHAR_HIDDEN );
+ eState = m_aHiddenBtn.GetState();
+ bChanged = TRUE;
+
+ if ( pOld )
+ {
+ const SvxCharHiddenItem& rItem = *( (const SvxCharHiddenItem*)pOld );
+ if ( rItem.GetValue() == StateToAttr( eState ) && m_aHiddenBtn.GetSavedValue() == eState )
+ bChanged = FALSE;
+ }
+
+ if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, FALSE, &pItem ) == SFX_ITEM_SET &&
+ !StateToAttr( eState ) && ( (SvxCharHiddenItem*)pItem )->GetValue() )
+ bChanged = TRUE;
+
+ if ( bChanged && eState != STATE_DONTKNOW )
+ {
+ rSet.Put( SvxCharHiddenItem( StateToAttr( eState ), nWhich ) );
+ bModified = TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bModified |= FillItemSetColor_Impl( rSet );
+
+ return bModified;
+}
+
+void SvxCharEffectsPage::DisableControls( USHORT nDisable )
+{
+ if ( ( DISABLE_CASEMAP & nDisable ) == DISABLE_CASEMAP )
+ {
+ m_aEffectsFT.Disable();
+ m_aEffects2LB.Disable();
+ }
+
+ if ( ( DISABLE_WORDLINE & nDisable ) == DISABLE_WORDLINE )
+ m_aIndividualWordsBtn.Disable();
+
+ if ( ( DISABLE_BLINK & nDisable ) == DISABLE_BLINK )
+ m_aBlinkingBtn.Disable();
+
+ if ( ( DISABLE_UNDERLINE_COLOR & nDisable ) == DISABLE_UNDERLINE_COLOR )
+ {
+ // disable the controls
+ m_aUnderlineColorFT.Disable( );
+ m_aUnderlineColorLB.Disable( );
+ // and reroute the selection handler of the controls which normally would affect the color box dis-/enabling
+ m_aUnderlineLB.SetSelectHdl(LINK(this, SvxCharEffectsPage, UpdatePreview_Impl));
+ m_aStrikeoutLB.SetSelectHdl(LINK(this, SvxCharEffectsPage, UpdatePreview_Impl));
+ }
+}
+
+void SvxCharEffectsPage::EnableFlash()
+{
+ if ( !( ( m_nHtmlMode & HTMLMODE_ON ) && !( m_nHtmlMode & HTMLMODE_BLINK ) ) )
+ m_aBlinkingBtn.Show();
+}
+
+// -----------------------------------------------------------------------
+void SvxCharEffectsPage::SetPreviewBackgroundToCharacter()
+{
+ m_bPreviewBackgroundToCharacter = TRUE;
+}
+
+// -----------------------------------------------------------------------
+void SvxCharEffectsPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pDisableCtlItem,SfxUInt16Item,SID_DISABLE_CTL,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False);
+ if (pDisableCtlItem)
+ DisableControls(pDisableCtlItem->GetValue());
+
+ if (pFlagItem)
+ {
+ UINT32 nFlags=pFlagItem->GetValue();
+ if ( ( nFlags & SVX_ENABLE_FLASH ) == SVX_ENABLE_FLASH )
+ EnableFlash();
+ if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER )
+ SetPreviewBackgroundToCharacter();
+ }
+}
+
+// class SvxCharPositionPage ---------------------------------------------
+
+SvxCharPositionPage::SvxCharPositionPage( Window* pParent, const SfxItemSet& rInSet ) :
+
+ SvxCharBasePage( pParent, SVX_RES( RID_SVXPAGE_CHAR_POSITION ), rInSet, WIN_POS_PREVIEW, FT_POS_FONTTYPE ),
+
+ m_aPositionLine ( this, SVX_RES( FL_POSITION ) ),
+ m_aHighPosBtn ( this, SVX_RES( RB_HIGHPOS ) ),
+ m_aNormalPosBtn ( this, SVX_RES( RB_NORMALPOS ) ),
+ m_aLowPosBtn ( this, SVX_RES( RB_LOWPOS ) ),
+ m_aHighLowFT ( this, SVX_RES( FT_HIGHLOW ) ),
+ m_aHighLowEdit ( this, SVX_RES( ED_HIGHLOW ) ),
+ m_aHighLowRB ( this, SVX_RES( CB_HIGHLOW ) ),
+ m_aFontSizeFT ( this, SVX_RES( FT_FONTSIZE ) ),
+ m_aFontSizeEdit ( this, SVX_RES( ED_FONTSIZE ) ),
+ m_aRotationScalingFL( this, SVX_RES( FL_ROTATION_SCALING ) ),
+ m_aScalingFL ( this, SVX_RES( FL_SCALING ) ),
+ m_a0degRB ( this, SVX_RES( RB_0_DEG ) ),
+ m_a90degRB ( this, SVX_RES( RB_90_DEG ) ),
+ m_a270degRB ( this, SVX_RES( RB_270_DEG ) ),
+ m_aFitToLineCB ( this, SVX_RES( CB_FIT_TO_LINE ) ),
+ m_aScaleWidthFT ( this, SVX_RES( FT_SCALE_WIDTH ) ),
+ m_aScaleWidthMF ( this, SVX_RES( MF_SCALE_WIDTH ) ),
+
+ m_aKerningLine ( this, SVX_RES( FL_KERNING2 ) ),
+ m_aKerningLB ( this, SVX_RES( LB_KERNING2 ) ),
+ m_aKerningFT ( this, SVX_RES( FT_KERNING2 ) ),
+ m_aKerningEdit ( this, SVX_RES( ED_KERNING2 ) ),
+ m_aPairKerningBtn ( this, SVX_RES( CB_PAIRKERNING ) ),
+
+ m_nSuperEsc ( (short)DFLT_ESC_SUPER ),
+ m_nSubEsc ( (short)DFLT_ESC_SUB ),
+ m_nScaleWidthItemSetVal ( 100 ),
+ m_nScaleWidthInitialVal ( 100 ),
+ m_nSuperProp ( (BYTE)DFLT_ESC_PROP ),
+ m_nSubProp ( (BYTE)DFLT_ESC_PROP )
+{
+ FreeResource();
+ Initialize();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharPositionPage::Initialize()
+{
+ // to handle the changes of the other pages
+ SetExchangeSupport();
+
+ GetPreviewFont().SetSize( Size( 0, 240 ) );
+ GetPreviewCJKFont().SetSize( Size( 0, 240 ) );
+ GetPreviewCTLFont().SetSize( Size( 0, 240 ) );
+
+ m_aNormalPosBtn.Check();
+ PositionHdl_Impl( &m_aNormalPosBtn );
+ m_aKerningLB.SelectEntryPos( 0 );
+ KerningSelectHdl_Impl( NULL );
+
+ Link aLink = LINK( this, SvxCharPositionPage, PositionHdl_Impl );
+ m_aHighPosBtn.SetClickHdl( aLink );
+ m_aNormalPosBtn.SetClickHdl( aLink );
+ m_aLowPosBtn.SetClickHdl( aLink );
+
+ aLink = LINK( this, SvxCharPositionPage, RotationHdl_Impl );
+ m_a0degRB .SetClickHdl( aLink );
+ m_a90degRB .SetClickHdl( aLink );
+ m_a270degRB.SetClickHdl( aLink );
+
+ aLink = LINK( this, SvxCharPositionPage, FontModifyHdl_Impl );
+ m_aHighLowEdit.SetModifyHdl( aLink );
+ m_aFontSizeEdit.SetModifyHdl( aLink );
+
+ aLink = LINK( this, SvxCharPositionPage, LoseFocusHdl_Impl );
+ m_aHighLowEdit.SetLoseFocusHdl( aLink );
+ m_aFontSizeEdit.SetLoseFocusHdl( aLink );
+
+ m_aHighLowRB.SetClickHdl( LINK( this, SvxCharPositionPage, AutoPositionHdl_Impl ) );
+ m_aFitToLineCB.SetClickHdl( LINK( this, SvxCharPositionPage, FitToLineHdl_Impl ) );
+ m_aKerningLB.SetSelectHdl( LINK( this, SvxCharPositionPage, KerningSelectHdl_Impl ) );
+ m_aKerningEdit.SetModifyHdl( LINK( this, SvxCharPositionPage, KerningModifyHdl_Impl ) );
+ m_aPairKerningBtn.SetClickHdl( LINK( this, SvxCharPositionPage, PairKerningHdl_Impl ) );
+ m_aScaleWidthMF.SetModifyHdl( LINK( this, SvxCharPositionPage, ScaleWidthModifyHdl_Impl ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharPositionPage::UpdatePreview_Impl( BYTE nProp, BYTE nEscProp, short nEsc )
+{
+ SetPrevFontEscapement( nProp, nEscProp, nEsc );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharPositionPage::SetEscapement_Impl( USHORT nEsc )
+{
+ SvxEscapementItem aEscItm( (SvxEscapement)nEsc, SID_ATTR_CHAR_ESCAPEMENT );
+
+ if ( SVX_ESCAPEMENT_SUPERSCRIPT == nEsc )
+ {
+ aEscItm.GetEsc() = m_nSuperEsc;
+ aEscItm.GetProp() = m_nSuperProp;
+ }
+ else if ( SVX_ESCAPEMENT_SUBSCRIPT == nEsc )
+ {
+ aEscItm.GetEsc() = m_nSubEsc;
+ aEscItm.GetProp() = m_nSubProp;
+ }
+
+ short nFac = aEscItm.GetEsc() < 0 ? -1 : 1;
+
+ m_aHighLowEdit.SetValue( aEscItm.GetEsc() * nFac );
+ m_aFontSizeEdit.SetValue( aEscItm.GetProp() );
+
+ if ( SVX_ESCAPEMENT_OFF == nEsc )
+ {
+ m_aHighLowFT.Disable();
+ m_aHighLowEdit.Disable();
+ m_aFontSizeFT.Disable();
+ m_aFontSizeEdit.Disable();
+ m_aHighLowRB.Disable();
+ }
+ else
+ {
+ m_aFontSizeFT.Enable();
+ m_aFontSizeEdit.Enable();
+ m_aHighLowRB.Enable();
+
+ if ( !m_aHighLowRB.IsChecked() )
+ {
+ m_aHighLowFT.Enable();
+ m_aHighLowEdit.Enable();
+ }
+ else
+ AutoPositionHdl_Impl( &m_aHighLowRB );
+ }
+
+ UpdatePreview_Impl( 100, aEscItm.GetProp(), aEscItm.GetEsc() );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharPositionPage, PositionHdl_Impl, RadioButton*, pBtn )
+{
+ USHORT nEsc = SVX_ESCAPEMENT_OFF; // also when pBtn == NULL
+
+ if ( &m_aHighPosBtn == pBtn )
+ nEsc = SVX_ESCAPEMENT_SUPERSCRIPT;
+ else if ( &m_aLowPosBtn == pBtn )
+ nEsc = SVX_ESCAPEMENT_SUBSCRIPT;
+
+ SetEscapement_Impl( nEsc );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharPositionPage, RotationHdl_Impl, RadioButton*, pBtn )
+{
+ BOOL bEnable = FALSE;
+ if (&m_a90degRB == pBtn || &m_a270degRB == pBtn)
+ bEnable = TRUE;
+ else
+ OSL_ENSURE( &m_a0degRB == pBtn, "unexpected button" );
+ m_aFitToLineCB.Enable( bEnable );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharPositionPage, FontModifyHdl_Impl, MetricField*, EMPTYARG )
+{
+ BYTE nEscProp = (BYTE)m_aFontSizeEdit.GetValue();
+ short nEsc = (short)m_aHighLowEdit.GetValue();
+ nEsc *= m_aLowPosBtn.IsChecked() ? -1 : 1;
+ UpdatePreview_Impl( 100, nEscProp, nEsc );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharPositionPage, AutoPositionHdl_Impl, CheckBox*, pBox )
+{
+ if ( pBox->IsChecked() )
+ {
+ m_aHighLowFT.Disable();
+ m_aHighLowEdit.Disable();
+ }
+ else
+ PositionHdl_Impl( m_aHighPosBtn.IsChecked() ? &m_aHighPosBtn
+ : m_aLowPosBtn.IsChecked() ? &m_aLowPosBtn
+ : &m_aNormalPosBtn );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharPositionPage, FitToLineHdl_Impl, CheckBox*, pBox )
+{
+ if ( &m_aFitToLineCB == pBox)
+ {
+ UINT16 nVal = m_nScaleWidthInitialVal;
+ if (m_aFitToLineCB.IsChecked())
+ nVal = m_nScaleWidthItemSetVal;
+ m_aScaleWidthMF.SetValue( nVal );
+
+ m_aPreviewWin.SetFontWidthScale( nVal );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharPositionPage, KerningSelectHdl_Impl, ListBox*, EMPTYARG )
+{
+ if ( m_aKerningLB.GetSelectEntryPos() > 0 )
+ {
+ m_aKerningFT.Enable();
+ m_aKerningEdit.Enable();
+
+ if ( m_aKerningLB.GetSelectEntryPos() == 2 )
+ {
+ // Condensed -> max value == 1/6 of the current font height
+ SvxFont& rFont = GetPreviewFont();
+ long nMax = rFont.GetSize().Height() / 6;
+ m_aKerningEdit.SetMax( m_aKerningEdit.Normalize( nMax ), FUNIT_TWIP );
+ m_aKerningEdit.SetLast( m_aKerningEdit.GetMax( m_aKerningEdit.GetUnit() ) );
+ }
+ else
+ {
+ m_aKerningEdit.SetMax( 9999 );
+ m_aKerningEdit.SetLast( 9999 );
+ }
+ }
+ else
+ {
+ m_aKerningEdit.SetValue( 0 );
+ m_aKerningFT.Disable();
+ m_aKerningEdit.Disable();
+ }
+
+ KerningModifyHdl_Impl( NULL );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharPositionPage, KerningModifyHdl_Impl, MetricField*, EMPTYARG )
+{
+ long nVal = static_cast<long>(m_aKerningEdit.GetValue());
+ nVal = LogicToLogic( nVal, MAP_POINT, MAP_TWIP );
+ long nKern = (short)m_aKerningEdit.Denormalize( nVal );
+
+ // Condensed? -> then negative
+ if ( m_aKerningLB.GetSelectEntryPos() == 2 )
+ nKern *= -1;
+
+ SvxFont& rFont = GetPreviewFont();
+ SvxFont& rCJKFont = GetPreviewCJKFont();
+ SvxFont& rCTLFont = GetPreviewCTLFont();
+
+ rFont.SetFixKerning( (short)nKern );
+ rCJKFont.SetFixKerning( (short)nKern );
+ rCTLFont.SetFixKerning( (short)nKern );
+ m_aPreviewWin.Invalidate();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharPositionPage, PairKerningHdl_Impl, CheckBox*, EMPTYARG )
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharPositionPage, LoseFocusHdl_Impl, MetricField*, pField )
+{
+#ifdef DBG_UTIL
+ sal_Bool bHigh = m_aHighPosBtn.IsChecked();
+#endif
+ sal_Bool bLow = m_aLowPosBtn.IsChecked();
+ DBG_ASSERT( bHigh || bLow, "normal position is not valid" );
+
+ if ( &m_aHighLowEdit == pField )
+ {
+ if ( bLow )
+ m_nSubEsc = (short)m_aHighLowEdit.GetValue() * -1;
+ else
+ m_nSuperEsc = (short)m_aHighLowEdit.GetValue();
+ }
+ else if ( &m_aFontSizeEdit == pField )
+ {
+ if ( bLow )
+ m_nSubProp = (BYTE)m_aFontSizeEdit.GetValue();
+ else
+ m_nSuperProp = (BYTE)m_aFontSizeEdit.GetValue();
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharPositionPage, ScaleWidthModifyHdl_Impl, MetricField*, EMPTYARG )
+{
+ m_aPreviewWin.SetFontWidthScale( USHORT( m_aScaleWidthMF.GetValue() ) );
+
+ return 0;
+}
+
+/* -----------------28.08.2003 12:12-----------------
+
+ --------------------------------------------------*/
+void SvxCharPositionPage::ActivatePage( const SfxItemSet& rSet )
+{
+ //update the preview
+ SvxCharBasePage::ActivatePage( rSet );
+
+ //the only thing that has to be checked is the max. allowed value for the
+ //condense edit field
+ if ( m_aKerningLB.GetSelectEntryPos() == 2 )
+ {
+ // Condensed -> max value == 1/6 of the current font height
+ SvxFont& rFont = GetPreviewFont();
+ long nMax = rFont.GetSize().Height() / 6;
+ long nKern = (short)m_aKerningEdit.Denormalize( LogicToLogic( static_cast<long>(m_aKerningEdit.GetValue()), MAP_POINT, MAP_TWIP ) );
+ m_aKerningEdit.SetMax( m_aKerningEdit.Normalize( nKern > nMax ? nKern : nMax ), FUNIT_TWIP );
+ m_aKerningEdit.SetLast( m_aKerningEdit.GetMax( m_aKerningEdit.GetUnit() ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SvxCharPositionPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxCharPositionPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxCharPositionPage( pParent, rSet );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxCharPositionPage::GetRanges()
+{
+ return pPositionRanges;
+}
+
+// -----------------------------------------------------------------------
+#define ENABLE_AND_CHECK( aCheckBox ) \
+ if ( !aCheckBox.IsEnabled() ) \
+ aCheckBox.Enable(); \
+ aCheckBox.Check( TRUE )
+
+void SvxCharPositionPage::Reset( const SfxItemSet& rSet )
+{
+ String sUser = GetUserData();
+
+ if ( sUser.Len() )
+ {
+ m_nSuperEsc = (short)sUser.GetToken( 0 ).ToInt32();
+ m_nSubEsc = (short)sUser.GetToken( 1 ).ToInt32();
+ m_nSuperProp = (BYTE)sUser.GetToken( 2 ).ToInt32();
+ m_nSubProp = (BYTE)sUser.GetToken( 3 ).ToInt32();
+ }
+
+ short nEsc = 0;
+ BYTE nEscProp = 100;
+ BYTE nProp = 100;
+
+ m_aHighLowFT.Disable();
+ m_aHighLowEdit.Disable();
+ m_aFontSizeFT.Disable();
+ m_aFontSizeEdit.Disable();
+
+ SvxFont& rFont = GetPreviewFont();
+ SvxFont& rCJKFont = GetPreviewCJKFont();
+ SvxFont& rCTLFont = GetPreviewCTLFont();
+ USHORT nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT );
+
+ if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT )
+ {
+ const SvxEscapementItem& rItem = (SvxEscapementItem&)rSet.Get( nWhich );
+ nEsc = rItem.GetEsc();
+ nEscProp = rItem.GetProp();
+
+ if ( nEsc != 0 )
+ {
+ m_aHighLowFT.Enable();
+ m_aHighLowEdit.Enable();
+ m_aFontSizeFT.Enable();
+ m_aFontSizeEdit.Enable();
+
+ short nFac;
+
+ if ( nEsc > 0 )
+ {
+ nFac = 1;
+ m_aHighPosBtn.Check( TRUE );
+ if ( nEsc == DFLT_ESC_AUTO_SUPER )
+ {
+ ENABLE_AND_CHECK( m_aHighLowRB );
+ nEsc = DFLT_ESC_SUPER;
+ }
+ }
+ else
+ {
+ nFac = -1;
+ m_aLowPosBtn.Check( TRUE );
+ if ( nEsc == DFLT_ESC_AUTO_SUB )
+ {
+ ENABLE_AND_CHECK( m_aHighLowRB );
+ nEsc = DFLT_ESC_SUB;
+ }
+ }
+
+ if ( m_aHighLowRB.IsChecked() )
+ {
+ m_aHighLowFT.Disable();
+ m_aHighLowEdit.Disable();
+ }
+ m_aHighLowEdit.SetValue( m_aHighLowEdit.Normalize( nFac * nEsc ) );
+ }
+ else
+ {
+ m_aNormalPosBtn.Check( TRUE );
+ m_aHighLowRB.Check( TRUE );
+ PositionHdl_Impl( NULL );
+ }
+ //the height has to be set after the handler is called to keep the value also if the escapement is zero
+ m_aFontSizeEdit.SetValue( m_aFontSizeEdit.Normalize( nEscProp ) );
+ }
+ else
+ {
+ m_aHighPosBtn.Check( FALSE );
+ m_aNormalPosBtn.Check( FALSE );
+ m_aLowPosBtn.Check( FALSE );
+ }
+
+ // BspFont setzen
+ SetPrevFontEscapement( nProp, nEscProp, nEsc );
+
+ // Kerning
+ nWhich = GetWhich( SID_ATTR_CHAR_KERNING );
+
+ if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT )
+ {
+ const SvxKerningItem& rItem = (SvxKerningItem&)rSet.Get( nWhich );
+ SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich );
+ MapUnit eOrgUnit = (MapUnit)eUnit;
+ MapUnit ePntUnit( MAP_POINT );
+ long nBig = static_cast<long>(m_aKerningEdit.Normalize( static_cast<long>(rItem.GetValue()) ));
+ long nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit );
+
+ // Kerning am Font setzen, vorher in Twips umrechnen
+ long nKern = LogicToLogic( rItem.GetValue(), (MapUnit)eUnit, MAP_TWIP );
+ rFont.SetFixKerning( (short)nKern );
+ rCJKFont.SetFixKerning( (short)nKern );
+ rCTLFont.SetFixKerning( (short)nKern );
+
+ if ( nKerning > 0 )
+ {
+ m_aKerningLB.SelectEntryPos( LW_GESPERRT );
+ }
+ else if ( nKerning < 0 )
+ {
+ m_aKerningLB.SelectEntryPos( LW_SCHMAL );
+ nKerning = -nKerning;
+ }
+ else
+ {
+ nKerning = 0;
+ m_aKerningLB.SelectEntryPos( LW_NORMAL );
+ }
+ //enable/disable and set min/max of the Edit
+ KerningSelectHdl_Impl(&m_aKerningLB);
+ //the attribute value must be displayed also if it's above the maximum allowed value
+ long nVal = static_cast<long>(m_aKerningEdit.GetMax());
+ if(nVal < nKerning)
+ m_aKerningEdit.SetMax( nKerning );
+ m_aKerningEdit.SetValue( nKerning );
+ }
+ else
+ m_aKerningEdit.SetText( String() );
+
+ // Pair kerning
+ nWhich = GetWhich( SID_ATTR_CHAR_AUTOKERN );
+
+ if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT )
+ {
+ const SvxAutoKernItem& rItem = (SvxAutoKernItem&)rSet.Get( nWhich );
+ m_aPairKerningBtn.Check( rItem.GetValue() );
+ }
+ else
+ m_aPairKerningBtn.Check( FALSE );
+
+ // Scale Width
+ nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH );
+ if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT )
+ {
+ const SvxCharScaleWidthItem& rItem = ( SvxCharScaleWidthItem& ) rSet.Get( nWhich );
+ m_nScaleWidthInitialVal = rItem.GetValue();
+ m_aScaleWidthMF.SetValue( m_nScaleWidthInitialVal );
+ }
+ else
+ m_aScaleWidthMF.SetValue( 100 );
+
+ nWhich = GetWhich( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE );
+ if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT )
+ m_nScaleWidthItemSetVal = ((SfxUInt16Item&) rSet.Get( nWhich )).GetValue();
+
+ // Rotation
+ nWhich = GetWhich( SID_ATTR_CHAR_ROTATED );
+ SfxItemState eState = rSet.GetItemState( nWhich );
+ if( SFX_ITEM_UNKNOWN == eState )
+ {
+ m_aRotationScalingFL.Hide();
+ m_aScalingFL.Show();
+ m_a0degRB.Hide();
+ m_a90degRB.Hide();
+ m_a270degRB.Hide();
+ m_aFitToLineCB.Hide();
+ m_aFitToLineCB .Hide();
+
+
+ // move the following controls upwards
+ Window* aCntrlArr[] = {
+ &m_aScaleWidthFT, &m_aScaleWidthMF, &m_aKerningLine,
+ &m_aKerningLB, &m_aKerningFT, &m_aKerningEdit, &m_aPairKerningBtn,
+ 0 };
+
+ long nDiff = m_aScaleWidthMF.GetPosPixel().Y() -
+ m_a0degRB.GetPosPixel().Y();
+
+ for( Window** ppW = aCntrlArr; *ppW; ++ppW )
+ {
+ Point aPnt( (*ppW)->GetPosPixel() );
+ aPnt.Y() -= nDiff;
+ (*ppW)->SetPosPixel( aPnt );
+ }
+ }
+ else
+ {
+ m_aScalingFL.Hide();
+
+ Link aOldLink( m_aFitToLineCB.GetClickHdl() );
+ m_aFitToLineCB.SetClickHdl( Link() );
+ if( eState >= SFX_ITEM_DEFAULT )
+ {
+ const SvxCharRotateItem& rItem =
+ (SvxCharRotateItem&) rSet.Get( nWhich );
+ if (rItem.IsBottomToTop())
+ m_a90degRB.Check( TRUE );
+ else if (rItem.IsTopToBotton())
+ m_a270degRB.Check( TRUE );
+ else
+ {
+ DBG_ASSERT( 0 == rItem.GetValue(), "incorrect value" );
+ m_a0degRB.Check( TRUE );
+ }
+ m_aFitToLineCB.Check( rItem.IsFitToLine() );
+ }
+ else
+ {
+ if( eState == SFX_ITEM_DONTCARE )
+ {
+ m_a0degRB.Check( FALSE );
+ m_a90degRB.Check( FALSE );
+ m_a270degRB.Check( FALSE );
+ }
+ else
+ m_a0degRB.Check( TRUE );
+
+ m_aFitToLineCB.Check( FALSE );
+ }
+ m_aFitToLineCB.SetClickHdl( aOldLink );
+ m_aFitToLineCB.Enable( !m_a0degRB.IsChecked() );
+
+ // is this value set?
+ if( SFX_ITEM_UNKNOWN == rSet.GetItemState( GetWhich(
+ SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ) ))
+ m_aFitToLineCB.Hide();
+ }
+
+ m_aHighPosBtn.SaveValue();
+ m_aNormalPosBtn.SaveValue();
+ m_aLowPosBtn.SaveValue();
+ m_a0degRB.SaveValue();
+ m_a90degRB.SaveValue();
+ m_a270degRB.SaveValue();
+ m_aFitToLineCB.SaveValue();
+ m_aScaleWidthMF.SaveValue();
+ m_aKerningLB.SaveValue();
+ m_aKerningEdit.SaveValue();
+ m_aPairKerningBtn.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxCharPositionPage::FillItemSet( SfxItemSet& rSet )
+{
+ // Position (hoch, normal oder tief)
+ const SfxItemSet& rOldSet = GetItemSet();
+ BOOL bModified = FALSE, bChanged = TRUE;
+ USHORT nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT );
+ const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_CHAR_ESCAPEMENT );
+ const FASTBOOL bHigh = m_aHighPosBtn.IsChecked();
+ short nEsc;
+ BYTE nEscProp;
+
+ if ( bHigh || m_aLowPosBtn.IsChecked() )
+ {
+ if ( m_aHighLowRB.IsChecked() )
+ nEsc = bHigh ? DFLT_ESC_AUTO_SUPER : DFLT_ESC_AUTO_SUB;
+ else
+ {
+ nEsc = (short)m_aHighLowEdit.Denormalize( m_aHighLowEdit.GetValue() );
+ nEsc *= bHigh ? 1 : -1;
+ }
+ nEscProp = (BYTE)m_aFontSizeEdit.Denormalize( m_aFontSizeEdit.GetValue() );
+ }
+ else
+ {
+ nEsc = 0;
+ nEscProp = 100;
+ }
+
+ if ( pOld )
+ {
+ const SvxEscapementItem& rItem = *( (const SvxEscapementItem*)pOld );
+ if ( rItem.GetEsc() == nEsc && rItem.GetProp() == nEscProp )
+ bChanged = FALSE;
+ }
+
+ if ( !bChanged && !m_aHighPosBtn.GetSavedValue() &&
+ !m_aNormalPosBtn.GetSavedValue() && !m_aLowPosBtn.GetSavedValue() )
+ bChanged = TRUE;
+
+ if ( bChanged &&
+ ( m_aHighPosBtn.IsChecked() || m_aNormalPosBtn.IsChecked() || m_aLowPosBtn.IsChecked() ) )
+ {
+ rSet.Put( SvxEscapementItem( nEsc, nEscProp, nWhich ) );
+ bModified = TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bChanged = TRUE;
+
+ // Kerning
+ nWhich = GetWhich( SID_ATTR_CHAR_KERNING );
+ pOld = GetOldItem( rSet, SID_ATTR_CHAR_KERNING );
+ USHORT nPos = m_aKerningLB.GetSelectEntryPos();
+ short nKerning = 0;
+ SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich );
+
+ if ( nPos == LW_GESPERRT || nPos == LW_SCHMAL )
+ {
+ long nTmp = static_cast<long>(m_aKerningEdit.GetValue());
+ long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit );
+ nKerning = (short)m_aKerningEdit.Denormalize( nVal );
+
+ if ( nPos == LW_SCHMAL )
+ nKerning *= - 1;
+ }
+
+ if ( pOld )
+ {
+ const SvxKerningItem& rItem = *( (const SvxKerningItem*)pOld );
+ if ( rItem.GetValue() == nKerning )
+ bChanged = FALSE;
+ }
+
+ if ( !bChanged &&
+ ( m_aKerningLB.GetSavedValue() == LISTBOX_ENTRY_NOTFOUND ||
+ ( !m_aKerningEdit.GetSavedValue().Len() && m_aKerningEdit.IsEnabled() ) ) )
+ bChanged = TRUE;
+
+ if ( bChanged && nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ rSet.Put( SvxKerningItem( nKerning, nWhich ) );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ bChanged = TRUE;
+
+ // Pair-Kerning
+ nWhich = GetWhich( SID_ATTR_CHAR_AUTOKERN );
+
+ if ( m_aPairKerningBtn.IsChecked() != m_aPairKerningBtn.GetSavedValue() )
+ {
+ rSet.Put( SvxAutoKernItem( m_aPairKerningBtn.IsChecked(), nWhich ) );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ // Scale Width
+ nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH );
+ if ( m_aScaleWidthMF.GetText() != m_aScaleWidthMF.GetSavedValue() )
+ {
+ rSet.Put( SvxCharScaleWidthItem( (USHORT)m_aScaleWidthMF.GetValue(), nWhich ) );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ // Rotation
+ nWhich = GetWhich( SID_ATTR_CHAR_ROTATED );
+ if ( m_a0degRB .IsChecked() != m_a0degRB .GetSavedValue() ||
+ m_a90degRB .IsChecked() != m_a90degRB .GetSavedValue() ||
+ m_a270degRB .IsChecked() != m_a270degRB .GetSavedValue() ||
+ m_aFitToLineCB.IsChecked() != m_aFitToLineCB.GetSavedValue() )
+ {
+ SvxCharRotateItem aItem( 0, m_aFitToLineCB.IsChecked(), nWhich );
+ if (m_a90degRB.IsChecked())
+ aItem.SetBottomToTop();
+ else if (m_a270degRB.IsChecked())
+ aItem.SetTopToBotton();
+ rSet.Put( aItem );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharPositionPage::FillUserData()
+{
+ const sal_Unicode cTok = ';';
+
+ String sUser( UniString::CreateFromInt32( m_nSuperEsc ) );
+ sUser.Append( cTok );
+ sUser.Append( UniString::CreateFromInt32( m_nSubEsc ) );
+ sUser.Append( cTok );
+ sUser.Append( UniString::CreateFromInt32( m_nSuperProp ) );
+ sUser.Append( cTok );
+ sUser.Append( UniString::CreateFromInt32( m_nSubProp ) );
+ SetUserData( sUser );
+}
+
+// -----------------------------------------------------------------------
+void SvxCharPositionPage::SetPreviewBackgroundToCharacter()
+{
+ m_bPreviewBackgroundToCharacter = TRUE;
+}
+// -----------------------------------------------------------------------
+void SvxCharPositionPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False);
+ if (pFlagItem)
+ {
+ UINT32 nFlags=pFlagItem->GetValue();
+ if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER )
+ SetPreviewBackgroundToCharacter();
+ }
+}
+// class SvxCharTwoLinesPage ------------------------------------------------
+
+SvxCharTwoLinesPage::SvxCharTwoLinesPage( Window* pParent, const SfxItemSet& rInSet ) :
+
+ SvxCharBasePage( pParent, SVX_RES( RID_SVXPAGE_CHAR_TWOLINES ), rInSet, WIN_TWOLINES_PREVIEW, FT_TWOLINES_FONTTYPE ),
+
+ m_aSwitchOnLine ( this, SVX_RES( FL_SWITCHON ) ),
+ m_aTwoLinesBtn ( this, SVX_RES( CB_TWOLINES ) ),
+
+ m_aEncloseLine ( this, SVX_RES( FL_ENCLOSE ) ),
+ m_aStartBracketFT ( this, SVX_RES( FT_STARTBRACKET ) ),
+ m_aStartBracketLB ( this, SVX_RES( ED_STARTBRACKET ) ),
+ m_aEndBracketFT ( this, SVX_RES( FT_ENDBRACKET ) ),
+ m_aEndBracketLB ( this, SVX_RES( ED_ENDBRACKET ) ),
+ m_nStartBracketPosition( 0 ),
+ m_nEndBracketPosition( 0 )
+{
+ FreeResource();
+ Initialize();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharTwoLinesPage::Initialize()
+{
+ Size aSize = m_aStartBracketLB.GetSizePixel();
+ aSize.Height() = m_aStartBracketLB.CalcSize( 1, 6 ).Height();
+ m_aStartBracketLB.SetSizePixel( aSize );
+ aSize = m_aEndBracketLB.GetSizePixel();
+ aSize.Height() = m_aEndBracketLB.CalcSize( 1, 6 ).Height();
+ m_aEndBracketLB.SetSizePixel( aSize );
+
+ m_aTwoLinesBtn.Check( FALSE );
+ TwoLinesHdl_Impl( NULL );
+
+ m_aTwoLinesBtn.SetClickHdl( LINK( this, SvxCharTwoLinesPage, TwoLinesHdl_Impl ) );
+
+ Link aLink = LINK( this, SvxCharTwoLinesPage, CharacterMapHdl_Impl );
+ m_aStartBracketLB.SetSelectHdl( aLink );
+ m_aEndBracketLB.SetSelectHdl( aLink );
+
+ SvxFont& rFont = GetPreviewFont();
+ SvxFont& rCJKFont = GetPreviewCJKFont();
+ SvxFont& rCTLFont = GetPreviewCTLFont();
+ rFont.SetSize( Size( 0, 220 ) );
+ rCJKFont.SetSize( Size( 0, 220 ) );
+ rCTLFont.SetSize( Size( 0, 220 ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox )
+{
+ //CHINA001 SvxCharacterMap aDlg( this );
+ bool bStart = pBox == &m_aStartBracketLB;
+ //SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ //if(pFact)
+ {
+ //AbstractSvxCharacterMap* aDlg = pFact->CreateSvxCharacterMap( this, RID_SVXDLG_CHARMAP );
+ SvxCharacterMap* aDlg = new SvxCharacterMap( this );
+ aDlg->DisableFontSelection();//CHINA001 aDlg.DisableFontSelection();
+
+ if ( aDlg->Execute() == RET_OK )//CHINA001 ( aDlg.Execute() == RET_OK )
+ {
+ sal_Unicode cChar = (sal_Unicode) aDlg->GetChar();//CHINA001 aDlg.GetChar();
+ SetBracket( cChar, bStart );
+ }
+ else
+ {
+ pBox->SelectEntryPos( bStart ? m_nStartBracketPosition : m_nEndBracketPosition );
+ }
+ delete aDlg; //add CHINA001
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharTwoLinesPage::SetBracket( sal_Unicode cBracket, BOOL bStart )
+{
+ USHORT nEntryPos = 0;
+ ListBox* pBox = bStart ? &m_aStartBracketLB : &m_aEndBracketLB;
+ if ( 0 == cBracket )
+ pBox->SelectEntryPos(0);
+ else
+ {
+ FASTBOOL bFound = FALSE;
+ for ( USHORT i = 1; i < pBox->GetEntryCount(); ++i )
+ {
+ if ( (ULONG)pBox->GetEntryData(i) != CHRDLG_ENCLOSE_SPECIAL_CHAR )
+ {
+ const sal_Unicode cChar = pBox->GetEntry(i).GetChar(0);
+ if ( cChar == cBracket )
+ {
+ pBox->SelectEntryPos(i);
+ nEntryPos = i;
+ bFound = TRUE;
+ break;
+ }
+ }
+ }
+
+ if ( !bFound )
+ {
+ nEntryPos = pBox->InsertEntry( String( cBracket ) );
+ pBox->SelectEntryPos( nEntryPos );
+ }
+ }
+ if( bStart )
+ m_nStartBracketPosition = nEntryPos;
+ else
+ m_nEndBracketPosition = nEntryPos;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharTwoLinesPage, TwoLinesHdl_Impl, CheckBox*, EMPTYARG )
+{
+ BOOL bChecked = m_aTwoLinesBtn.IsChecked();
+ m_aStartBracketFT.Enable( bChecked );
+ m_aStartBracketLB.Enable( bChecked );
+ m_aEndBracketFT.Enable( bChecked );
+ m_aEndBracketLB.Enable( bChecked );
+
+ UpdatePreview_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharTwoLinesPage, CharacterMapHdl_Impl, ListBox*, pBox )
+{
+ USHORT nPos = pBox->GetSelectEntryPos();
+ if ( CHRDLG_ENCLOSE_SPECIAL_CHAR == (ULONG)pBox->GetEntryData( nPos ) )
+ SelectCharacter( pBox );
+ else
+ {
+ bool bStart = pBox == &m_aStartBracketLB;
+ if( bStart )
+ m_nStartBracketPosition = nPos;
+ else
+ m_nEndBracketPosition = nPos;
+ }
+ UpdatePreview_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharTwoLinesPage::ActivatePage( const SfxItemSet& rSet )
+{
+ SvxCharBasePage::ActivatePage( rSet );
+}
+
+// -----------------------------------------------------------------------
+
+int SvxCharTwoLinesPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxCharTwoLinesPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxCharTwoLinesPage( pParent, rSet );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxCharTwoLinesPage::GetRanges()
+{
+ return pTwoLinesRanges;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCharTwoLinesPage::Reset( const SfxItemSet& rSet )
+{
+ m_aTwoLinesBtn.Check( FALSE );
+ USHORT nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES );
+ SfxItemState eState = rSet.GetItemState( nWhich );
+
+ if ( eState >= SFX_ITEM_DONTCARE )
+ {
+ const SvxTwoLinesItem& rItem = (SvxTwoLinesItem&)rSet.Get( nWhich );
+ m_aTwoLinesBtn.Check( rItem.GetValue() );
+
+ if ( rItem.GetValue() )
+ {
+ SetBracket( rItem.GetStartBracket(), TRUE );
+ SetBracket( rItem.GetEndBracket(), FALSE );
+ }
+ }
+ TwoLinesHdl_Impl( NULL );
+
+ SetPrevFontWidthScale( rSet );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxCharTwoLinesPage::FillItemSet( SfxItemSet& rSet )
+{
+ const SfxItemSet& rOldSet = GetItemSet();
+ BOOL bModified = FALSE, bChanged = TRUE;
+ USHORT nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES );
+ const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_CHAR_TWO_LINES );
+ sal_Bool bOn = m_aTwoLinesBtn.IsChecked();
+ sal_Unicode cStart = ( bOn && m_aStartBracketLB.GetSelectEntryPos() > 0 )
+ ? m_aStartBracketLB.GetSelectEntry().GetChar(0) : 0;
+ sal_Unicode cEnd = ( bOn && m_aEndBracketLB.GetSelectEntryPos() > 0 )
+ ? m_aEndBracketLB.GetSelectEntry().GetChar(0) : 0;
+
+ if ( pOld )
+ {
+ const SvxTwoLinesItem& rItem = *( (const SvxTwoLinesItem*)pOld );
+ if ( rItem.GetValue() == bOn &&
+ ( !bOn || ( rItem.GetStartBracket() == cStart && rItem.GetEndBracket() == cEnd ) ) )
+ bChanged = FALSE;
+ }
+
+ if ( bChanged )
+ {
+ rSet.Put( SvxTwoLinesItem( bOn, cStart, cEnd, nWhich ) );
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) )
+ CLEARTITEM;
+
+ return bModified;
+}
+/* -----------------------------04.12.00 09:48--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxCharTwoLinesPage::UpdatePreview_Impl()
+{
+ sal_Unicode cStart = m_aStartBracketLB.GetSelectEntryPos() > 0
+ ? m_aStartBracketLB.GetSelectEntry().GetChar(0) : 0;
+ sal_Unicode cEnd = m_aEndBracketLB.GetSelectEntryPos() > 0
+ ? m_aEndBracketLB.GetSelectEntry().GetChar(0) : 0;
+ m_aPreviewWin.SetBrackets(cStart, cEnd);
+ m_aPreviewWin.SetTwoLines(m_aTwoLinesBtn.IsChecked());
+ m_aPreviewWin.Invalidate();
+}
+// -----------------------------------------------------------------------
+void SvxCharTwoLinesPage::SetPreviewBackgroundToCharacter()
+{
+ m_bPreviewBackgroundToCharacter = TRUE;
+}
+
+// -----------------------------------------------------------------------
+void SvxCharTwoLinesPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False);
+ if (pFlagItem)
+ {
+ UINT32 nFlags=pFlagItem->GetValue();
+ if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER )
+ SetPreviewBackgroundToCharacter();
+ }
+}
diff --git a/cui/source/tabpages/chardlg.h b/cui/source/tabpages/chardlg.h
new file mode 100644
index 000000000000..83af82c3118c
--- /dev/null
+++ b/cui/source/tabpages/chardlg.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * 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: chardlg.h,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_CHARDLG_H
+#define _SVX_CHARDLG_H
+
+// define ----------------------------------------------------------------
+
+#define CHRDLG_UNDERLINE_NONE 0
+#define CHRDLG_UNDERLINE_SINGLE 1
+#define CHRDLG_UNDERLINE_DOUBLE 2
+#define CHRDLG_UNDERLINE_DOTTED 3
+#define CHRDLG_UNDERLINE_DONTKNOW 4
+#define CHRDLG_UNDERLINE_DASH 5
+#define CHRDLG_UNDERLINE_LONGDASH 6
+#define CHRDLG_UNDERLINE_DASHDOT 7
+#define CHRDLG_UNDERLINE_DASHDOTDOT 8
+#define CHRDLG_UNDERLINE_SMALLWAVE 9
+#define CHRDLG_UNDERLINE_WAVE 10
+#define CHRDLG_UNDERLINE_DOUBLEWAVE 11
+#define CHRDLG_UNDERLINE_BOLD 12
+#define CHRDLG_UNDERLINE_BOLDDOTTED 13
+#define CHRDLG_UNDERLINE_BOLDDASH 14
+#define CHRDLG_UNDERLINE_BOLDLONGDASH 15
+#define CHRDLG_UNDERLINE_BOLDDASHDOT 16
+#define CHRDLG_UNDERLINE_BOLDDASHDOTDOT 17
+#define CHRDLG_UNDERLINE_BOLDWAVE 18
+
+#define CHRDLG_STRIKEOUT_NONE 0
+#define CHRDLG_STRIKEOUT_SINGLE 1
+#define CHRDLG_STRIKEOUT_DOUBLE 2
+#define CHRDLG_STRIKEOUT_DONTKNOW 3
+#define CHRDLG_STRIKEOUT_BOLD 4
+#define CHRDLG_STRIKEOUT_SLASH 5
+#define CHRDLG_STRIKEOUT_X 6
+
+#define CHRDLG_ENCLOSE_NONE 0
+#define CHRDLG_ENCLOSE_ROUND 1
+#define CHRDLG_ENCLOSE_SQUARE 2
+#define CHRDLG_ENCLOSE_POINTED 3
+#define CHRDLG_ENCLOSE_CURVED 4
+#define CHRDLG_ENCLOSE_SPECIAL_CHAR 5
+
+#define CHRDLG_POSITION_OVER 0
+#define CHRDLG_POSITION_UNDER 1
+
+#endif
+
diff --git a/cui/source/tabpages/chardlg.hrc b/cui/source/tabpages/chardlg.hrc
new file mode 100644
index 000000000000..63faba788bbe
--- /dev/null
+++ b/cui/source/tabpages/chardlg.hrc
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * 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: chardlg.hrc,v $
+ * $Revision: 1.15.212.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_CHARDLG_HRC
+#define _SVX_CHARDLG_HRC
+
+// defines ------------------------------------------------------------------
+
+// NamePage -----------------------------------------------------------------
+
+#define FL_WEST 100
+#define FT_WEST_NAME 101
+#define LB_WEST_NAME 102
+#define FT_WEST_STYLE 103
+#define LB_WEST_STYLE 104
+#define FT_WEST_SIZE 105
+#define LB_WEST_SIZE 106
+#define FT_WEST_LANG 107
+#define LB_WEST_LANG 108
+
+#define FL_EAST 110
+#define FT_EAST_NAME 111
+#define LB_EAST_NAME 112
+#define FT_EAST_STYLE 113
+#define LB_EAST_STYLE 114
+#define FT_EAST_SIZE 115
+#define LB_EAST_SIZE 116
+#define FT_EAST_LANG 117
+#define LB_EAST_LANG 118
+
+#define FL_CTL 120
+#define FT_CTL_NAME 121
+#define LB_CTL_NAME 122
+#define FT_CTL_STYLE 123
+#define LB_CTL_STYLE 124
+#define FT_CTL_SIZE 125
+#define LB_CTL_SIZE 126
+#define FT_CTL_LANG 127
+#define LB_CTL_LANG 128
+
+#define WIN_CHAR_PREVIEW 131
+#define FT_CHAR_FONTTYPE 132
+
+#define FL_COLOR2 140
+#define FT_COLOR2 141
+#define LB_COLOR2 142
+
+#define STR_CHARNAME_NOSTYLE 150
+#define STR_CHARNAME_TRANSPARENT 151
+
+// EffectsPage --------------------------------------------------------------
+
+#define FT_FONTCOLOR 201
+#define LB_FONTCOLOR 202
+
+#define FT_EFFECTS 203
+#define LB_EFFECTS 204
+#define LB_EFFECTS2 205
+
+#define FT_RELIEF 206
+#define LB_RELIEF 207
+
+#define CB_OUTLINE 208
+#define CB_SHADOW 209
+#define CB_BLINKING 210
+#define CB_CHARHIDDEN 211
+
+#define FL_EFFECTS_VERTICAL 220
+
+#define FT_OVERLINE 221
+#define LB_OVERLINE 222
+#define FT_OVERLINE_COLOR 223
+#define LB_OVERLINE_COLOR 224
+
+#define FT_STRIKEOUT 225
+#define LB_STRIKEOUT 226
+
+#define FT_UNDERLINE 227
+#define LB_UNDERLINE 228
+#define FT_UNDERLINE_COLOR 229
+#define LB_UNDERLINE_COLOR 230
+
+#define CB_INDIVIDUALWORDS 231
+
+#define FL_EFFECTS_ASIAN 240
+
+#define FT_EMPHASIS 241
+#define LB_EMPHASIS 242
+#define FT_POSITION 243
+#define LB_POSITION 244
+
+#define WIN_EFFECTS_PREVIEW 251
+#define FT_EFFECTS_FONTTYPE 252
+
+#define STR_EFFECTS_TRANSPARENT 260
+#define STR_EFFECTS_CAPITALS 261
+#define STR_EFFECTS_LOWERCASE 262
+#define STR_EFFECTS_TITLE 263
+#define STR_EFFECTS_SMALL 264
+#define STR_EFFECTS_OUTLINE 265
+#define STR_EFFECTS_SHADOW 266
+#define STR_EFFECTS_BLINKING 267
+
+// PositionPage -------------------------------------------------------------
+
+#define FL_POSITION 300
+#define RB_HIGHPOS 301
+#define RB_NORMALPOS 302
+#define RB_LOWPOS 303
+#define FT_HIGHLOW 304
+#define ED_HIGHLOW 305
+#define CB_HIGHLOW 306
+#define FT_FONTSIZE 307
+#define ED_FONTSIZE 308
+#define FL_ROTATION_SCALING 309
+#define FL_SCALING 310
+#define RB_0_DEG 311
+#define RB_90_DEG 312
+#define RB_270_DEG 313
+#define CB_FIT_TO_LINE 314
+#define FT_SCALE_WIDTH 315
+#define MF_SCALE_WIDTH 316
+
+#define FL_KERNING2 320
+#define LB_KERNING2 321
+#define FT_KERNING2 322
+#define ED_KERNING2 323
+#define CB_PAIRKERNING 324
+
+#define WIN_POS_PREVIEW 331
+#define FT_POS_FONTTYPE 332
+
+// TwoLinesPage -------------------------------------------------------------
+
+#define FL_SWITCHON 400
+#define CB_TWOLINES 401
+
+#define FL_ENCLOSE 410
+#define FT_STARTBRACKET 411
+#define ED_STARTBRACKET 412
+#define FT_ENDBRACKET 413
+#define ED_ENDBRACKET 414
+
+#define FL_TWOLINES_PREVIEW 420
+#define WIN_TWOLINES_PREVIEW 421
+#define FT_TWOLINES_FONTTYPE 422
+
+#define FT_WEST_NAME_NOCJK 423
+#define LB_WEST_NAME_NOCJK 424
+#define FT_WEST_STYLE_NOCJK 425
+#define LB_WEST_STYLE_NOCJK 426
+#define FT_WEST_SIZE_NOCJK 427
+#define LB_WEST_SIZE_NOCJK 428
+#define FT_WEST_LANG_NOCJK 429
+#define LB_WEST_LANG_NOCJK 430
+
+#endif
+
diff --git a/cui/source/tabpages/chardlg.src b/cui/source/tabpages/chardlg.src
new file mode 100644
index 000000000000..19ad1e090435
--- /dev/null
+++ b/cui/source/tabpages/chardlg.src
@@ -0,0 +1,1133 @@
+/*************************************************************************
+ *
+ * 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: chardlg.src,v $
+ * $Revision: 1.78.20.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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.hrc"
+#include <svx/dialogs.hrc>
+#include "chardlg.hrc"
+#include "chardlg.h"
+
+// unbekannte Zeichenfarbe
+String RID_SVXSTR_COLOR_USER
+{
+ Text [ en-US ] = "User" ;
+};
+
+// RID_SVXPAGE_CHAR_NAME ----------------------------------------------------
+
+TabPage RID_SVXPAGE_CHAR_NAME
+{
+ HelpId = HID_SVXPAGE_CHAR_NAME ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_WEST
+ {
+ Pos = MAP_APPFONT ( 6 , 3 );
+ Size = MAP_APPFONT ( 248 , 8 );
+ Text [ en-US ] = "Western text font";
+ };
+ FixedText FT_WEST_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 14 );
+ Size = MAP_APPFONT ( 80 , 8 );
+ Text [ en-US ] = "Font";
+ };
+ FixedText FT_WEST_NAME_NOCJK
+ {
+ Pos = MAP_APPFONT ( 12 , 6 );
+ Size = MAP_APPFONT ( 112 , 8 );
+ Text [ en-US ] = "~Font";
+ };
+ ComboBox LB_WEST_NAME
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 12 , 25 );
+ Size = MAP_APPFONT ( 80 , 72 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+ ComboBox LB_WEST_NAME_NOCJK
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 12 , 17 );
+ Size = MAP_APPFONT ( 112 , 71 );
+ TabStop = TRUE;
+ DropDown = FALSE;
+ };
+ FixedText FT_WEST_STYLE
+ {
+ Pos = MAP_APPFONT ( 96 , 14 );
+ Size = MAP_APPFONT ( 40 , 8 );
+ Text [ en-US ] = "~Typeface";
+ };
+ FixedText FT_WEST_STYLE_NOCJK
+ {
+ Pos = MAP_APPFONT ( 130 , 6 );
+ Size = MAP_APPFONT ( 72 , 8 );
+ Text [ en-US ] = "~Typeface";
+ };
+ ComboBox LB_WEST_STYLE
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 96 , 25 );
+ Size = MAP_APPFONT ( 40 , 48 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ "Normal" ;
+ "Italic" ;
+ "Bold" ;
+ "Bold italic" ;
+ };
+ };
+ ComboBox LB_WEST_STYLE_NOCJK
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 130 , 17 );
+ Size = MAP_APPFONT ( 72 , 71 );
+ TabStop = TRUE;
+ DropDown = FALSE;
+ StringList [ en-US ] =
+ {
+ "Normal" ;
+ "Italic" ;
+ "Bold" ;
+ "Bold italic" ;
+ };
+ };
+ FixedText FT_WEST_SIZE
+ {
+ Pos = MAP_APPFONT ( 140 , 14 );
+ Size = MAP_APPFONT ( 38 , 8 );
+ Text [ en-US ] = "Size";
+ };
+ FixedText FT_WEST_SIZE_NOCJK
+ {
+ Pos = MAP_APPFONT ( 208 , 6 );
+ Size = MAP_APPFONT ( 40 , 8 );
+ Text [ en-US ] = "Size";
+ };
+ MetricBox LB_WEST_SIZE
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 140 , 25 );
+ Size = MAP_APPFONT ( 38 , 72 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+ MetricBox LB_WEST_SIZE_NOCJK
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 208 , 17 );
+ Size = MAP_APPFONT ( 40 , 71 );
+ TabStop = TRUE;
+ DropDown = FALSE;
+ };
+ FixedText FT_WEST_LANG
+ {
+ Pos = MAP_APPFONT ( 182 , 14 );
+ Size = MAP_APPFONT ( 66 , 8 );
+ Text [ en-US ] = "Language";
+ };
+ FixedText FT_WEST_LANG_NOCJK
+ {
+ Pos = MAP_APPFONT ( 130 , 94 );
+ Size = MAP_APPFONT ( 72 , 8 );
+ Text [ en-US ] = "~Language";
+ };
+ ListBox LB_WEST_LANG
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 182 , 25 );
+ Size = MAP_APPFONT ( 66 , 72 );
+ TabStop = TRUE;
+ Sort = TRUE ;
+ DropDown = TRUE;
+ };
+ ListBox LB_WEST_LANG_NOCJK
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 130 , 105 );
+ Size = MAP_APPFONT ( 72 , 72 );
+ TabStop = TRUE;
+ Sort = TRUE ;
+ DropDown = TRUE;
+ };
+ FixedLine FL_EAST
+ {
+ Pos = MAP_APPFONT ( 6 , 43 );
+ Size = MAP_APPFONT ( 248 , 8 );
+ Text [ en-US ] = "Asian text font";
+ };
+ FixedText FT_EAST_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 54 );
+ Size = MAP_APPFONT ( 80 , 8 );
+ Text [ en-US ] = "Font";
+ };
+ ComboBox LB_EAST_NAME
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 12 , 65 );
+ Size = MAP_APPFONT ( 80 , 72 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+ FixedText FT_EAST_STYLE
+ {
+ Pos = MAP_APPFONT ( 96 , 54 );
+ Size = MAP_APPFONT ( 40 , 8 );
+ Text [ en-US ] = "T~ypeface";
+ };
+ ComboBox LB_EAST_STYLE
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 96 , 65 );
+ Size = MAP_APPFONT ( 40 , 48 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ "Normal" ;
+ "Italic" ;
+ "Bold" ;
+ "Bold italic" ;
+ };
+ };
+ FixedText FT_EAST_SIZE
+ {
+ Pos = MAP_APPFONT ( 140 , 54 );
+ Size = MAP_APPFONT ( 38 , 8 );
+ Text [ en-US ] = "Size";
+ };
+ MetricBox LB_EAST_SIZE
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 140 , 65 );
+ Size = MAP_APPFONT ( 38 , 72 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+ FixedText FT_EAST_LANG
+ {
+ Pos = MAP_APPFONT ( 182 , 54 );
+ Size = MAP_APPFONT ( 66 , 8 );
+ Text [ en-US ] = "Language";
+ };
+ ListBox LB_EAST_LANG
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 182 , 65 );
+ Size = MAP_APPFONT ( 66 , 72 );
+ TabStop = TRUE;
+ Sort = TRUE ;
+ DropDown = TRUE;
+ };
+ FixedLine FL_CTL
+ {
+ Pos = MAP_APPFONT ( 6 , 83 );
+ Size = MAP_APPFONT ( 248 , 8 );
+ Text [ en-US ] = "CTL font";
+ };
+ FixedText FT_CTL_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 94 );
+ Size = MAP_APPFONT ( 80 , 8 );
+ Text [ en-US ] = "Font";
+ };
+ ComboBox LB_CTL_NAME
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 12 , 105 );
+ Size = MAP_APPFONT ( 80 , 72 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+ FixedText FT_CTL_STYLE
+ {
+ Pos = MAP_APPFONT ( 96 , 94 );
+ Size = MAP_APPFONT ( 40 , 8 );
+ Text [ en-US ] = "Ty~peface";
+ };
+ ComboBox LB_CTL_STYLE
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 96 , 105 );
+ Size = MAP_APPFONT ( 40 , 48 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ "Normal" ;
+ "Italic" ;
+ "Bold" ;
+ "Bold italic" ;
+ };
+ };
+ FixedText FT_CTL_SIZE
+ {
+ Pos = MAP_APPFONT ( 140 , 94 );
+ Size = MAP_APPFONT ( 38 , 8 );
+ Text [ en-US ] = "Size";
+ };
+ MetricBox LB_CTL_SIZE
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 140 , 105 );
+ Size = MAP_APPFONT ( 38 , 72 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+ FixedText FT_CTL_LANG
+ {
+ Pos = MAP_APPFONT ( 182 , 94 );
+ Size = MAP_APPFONT ( 66 , 8 );
+ Text [ en-US ] = "Language";
+ };
+ ListBox LB_CTL_LANG
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 182 , 105 );
+ Size = MAP_APPFONT ( 66 , 72 );
+ TabStop = TRUE;
+ Sort = TRUE ;
+ DropDown = TRUE;
+ };
+ Window WIN_CHAR_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 149 ) ;
+ Size = MAP_APPFONT ( 248 , 37 ) ;
+ Text [ en-US ] = "Example";
+ };
+ FixedText FT_CHAR_FONTTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 129 ) ;
+ Size = MAP_APPFONT ( 248 , 16 ) ;
+ WordBreak = TRUE ;
+ };
+ FixedLine FL_COLOR2
+ {
+ Pos = MAP_APPFONT ( 6 , 83 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Color" ;
+ };
+ FixedText FT_COLOR2
+ {
+ Pos = MAP_APPFONT ( 12 , 94 );
+ Size = MAP_APPFONT ( 58 , 8 );
+ Text [ en-US ] = "Font ~color" ;
+ };
+ ListBox LB_COLOR2
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 12 , 105 );
+ Size = MAP_APPFONT ( 58 , 100 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+ String STR_CHARNAME_NOSTYLE
+ {
+ Text [ en-US ] = "No %1";
+ };
+ String STR_CHARNAME_TRANSPARENT
+ {
+ Text [ en-US ] = "Transparent";
+ };
+};
+
+// RID_SVXPAGE_CHAR_EFFECTS ---------------------------------------------------
+
+TabPage RID_SVXPAGE_CHAR_EFFECTS
+{
+ HelpId = HID_SVXPAGE_CHAR_EFFECTS ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedText FT_FONTCOLOR
+ {
+ Pos = MAP_APPFONT ( 10 , 4 );
+ Size = MAP_APPFONT ( 82 , 8 );
+ Text [ en-US ] = "Font ~color" ;
+ };
+ ListBox LB_FONTCOLOR
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 10 , 15 );
+ Size = MAP_APPFONT ( 82 , 72 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+ FixedText FT_EFFECTS
+ {
+ Pos = MAP_APPFONT( 10 , 33 );
+ Size = MAP_APPFONT( 82 , 8 );
+ Text [ en-US ] = "~Effects" ;
+ };
+ ListBox LB_EFFECTS2
+ {
+ Pos = MAP_APPFONT ( 10 , 44 ) ;
+ Size = MAP_APPFONT ( 82 , 56 ) ;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "(Without)" ; Default ; > ;
+ < "Capitals" ; Default ; > ;
+ < "Lowercase" ; Default ; > ;
+ < "Title" ; Default ; > ;
+ < "Small capitals" ; Default ; > ;
+ };
+ };
+ FixedText FT_RELIEF
+ {
+ Pos = MAP_APPFONT ( 10 , 62 );
+ Size = MAP_APPFONT ( 82 , 8 );
+ Text [ en-US ] = "~Relief";
+ };
+ ListBox LB_RELIEF
+ {
+ Pos = MAP_APPFONT ( 10 , 73 ) ;
+ Size = MAP_APPFONT ( 82 , 56 ) ;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "(Without)" ; Default ; > ;
+ < "Embossed" ; Default ; > ;
+ < "Engraved" ; Default ; > ;
+ };
+ };
+ TriStateBox CB_OUTLINE
+ {
+ Pos = MAP_APPFONT ( 10 , 93 ) ;
+ Size = MAP_APPFONT ( 82 , 10 ) ;
+ Text [ en-US ] = "Out~line" ;
+ };
+ TriStateBox CB_SHADOW
+ {
+ Pos = MAP_APPFONT ( 10 , 107 ) ;
+ Size = MAP_APPFONT ( 82 , 10 ) ;
+ Text [ en-US ] = "Sha~dow" ;
+ };
+ TriStateBox CB_BLINKING
+ {
+ Pos = MAP_APPFONT ( 10 , 121 ) ;
+ Size = MAP_APPFONT ( 82 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "~Blinking" ;
+ };
+ TriStateBox CB_CHARHIDDEN
+ {
+ Pos = MAP_APPFONT ( 10 , 135 ) ;
+ Size = MAP_APPFONT ( 82 , 10 ) ;
+ Text [ en-US ] = "H~idden" ;
+ };
+ FixedLine FL_EFFECTS_VERTICAL
+ {
+ Pos = MAP_APPFONT ( 100 , 4 ) ;
+ Size = MAP_APPFONT ( 4 , 142 ) ;
+ Vert = TRUE;
+ };
+ FixedText FT_OVERLINE
+ {
+ Pos = MAP_APPFONT( 110 , 4 );
+ Size = MAP_APPFONT( 68 , 8 );
+ Text [ en-US ] = "~Overlining" ;
+ };
+ ListBox LB_OVERLINE
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 110 , 15 );
+ Size = MAP_APPFONT ( 68 , 72 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "(Without)" ; CHRDLG_UNDERLINE_NONE ; > ;
+ < "Single" ; CHRDLG_UNDERLINE_SINGLE ; > ;
+ < "Double" ; CHRDLG_UNDERLINE_DOUBLE ; > ;
+ < "Bold"; CHRDLG_UNDERLINE_BOLD; > ;
+ < "Dotted" ; CHRDLG_UNDERLINE_DOTTED ; > ;
+ < "Dotted (Bold)" ; CHRDLG_UNDERLINE_BOLDDOTTED; > ;
+ < "Dash"; CHRDLG_UNDERLINE_DASH; > ;
+ < "Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASH; > ;
+ < "Long Dash"; CHRDLG_UNDERLINE_LONGDASH; > ;
+ < "Long Dash (Bold)"; CHRDLG_UNDERLINE_BOLDLONGDASH; > ;
+ < "Dot Dash"; CHRDLG_UNDERLINE_DASHDOT; > ;
+ < "Dot Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASHDOT; > ;
+ < "Dot Dot Dash"; CHRDLG_UNDERLINE_DASHDOTDOT; > ;
+ < "Dot Dot Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASHDOTDOT; > ;
+ < "Wave"; CHRDLG_UNDERLINE_WAVE; > ;
+ < "Wave (Bold)"; CHRDLG_UNDERLINE_BOLDWAVE; > ;
+ < "Double Wave"; CHRDLG_UNDERLINE_DOUBLEWAVE; > ;
+ };
+ };
+ FixedText FT_OVERLINE_COLOR
+ {
+ Pos = MAP_APPFONT ( 184 , 4 );
+ Size = MAP_APPFONT ( 68 , 8 );
+ Text [ en-US ] = "O~verline color";
+ };
+ ListBox LB_OVERLINE_COLOR
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 184 , 15 );
+ Size = MAP_APPFONT ( 68 , 100 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+ FixedText FT_STRIKEOUT
+ {
+ Pos = MAP_APPFONT ( 110 , 33 );
+ Size = MAP_APPFONT ( 68 , 8 );
+ Text [ en-US ] = "~Strikethrough" ;
+ };
+ ListBox LB_STRIKEOUT
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 110 , 44 );
+ Size = MAP_APPFONT ( 68 , 72 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "(Without)" ; CHRDLG_STRIKEOUT_NONE ; > ;
+ < "Single" ; CHRDLG_STRIKEOUT_SINGLE ; > ;
+ < "Double" ; CHRDLG_STRIKEOUT_DOUBLE ; > ;
+ < "Bold" ; CHRDLG_STRIKEOUT_BOLD ; > ;
+ < "With /" ; CHRDLG_STRIKEOUT_SLASH ; > ;
+ < "With X" ; CHRDLG_STRIKEOUT_X ; > ;
+ };
+ };
+ FixedText FT_UNDERLINE
+ {
+ Pos = MAP_APPFONT( 110 , 62 );
+ Size = MAP_APPFONT( 68 , 8 );
+ Text [ en-US ] = "~Underlining" ;
+ };
+ ListBox LB_UNDERLINE
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 110 , 73 );
+ Size = MAP_APPFONT ( 68 , 72 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "(Without)" ; CHRDLG_UNDERLINE_NONE ; > ;
+ < "Single" ; CHRDLG_UNDERLINE_SINGLE ; > ;
+ < "Double" ; CHRDLG_UNDERLINE_DOUBLE ; > ;
+ < "Bold"; CHRDLG_UNDERLINE_BOLD; > ;
+ < "Dotted" ; CHRDLG_UNDERLINE_DOTTED ; > ;
+ < "Dotted (Bold)" ; CHRDLG_UNDERLINE_BOLDDOTTED; > ;
+ < "Dash"; CHRDLG_UNDERLINE_DASH; > ;
+ < "Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASH; > ;
+ < "Long Dash"; CHRDLG_UNDERLINE_LONGDASH; > ;
+ < "Long Dash (Bold)"; CHRDLG_UNDERLINE_BOLDLONGDASH; > ;
+ < "Dot Dash"; CHRDLG_UNDERLINE_DASHDOT; > ;
+ < "Dot Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASHDOT; > ;
+ < "Dot Dot Dash"; CHRDLG_UNDERLINE_DASHDOTDOT; > ;
+ < "Dot Dot Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASHDOTDOT; > ;
+ < "Wave"; CHRDLG_UNDERLINE_WAVE; > ;
+ < "Wave (Bold)"; CHRDLG_UNDERLINE_BOLDWAVE; > ;
+ < "Double Wave"; CHRDLG_UNDERLINE_DOUBLEWAVE; > ;
+ };
+ };
+ FixedText FT_UNDERLINE_COLOR
+ {
+ Pos = MAP_APPFONT ( 184 , 62 );
+ Size = MAP_APPFONT ( 68 , 8 );
+ Text [ en-US ] = "U~nderline color";
+ };
+ ListBox LB_UNDERLINE_COLOR
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 184 , 73 );
+ Size = MAP_APPFONT ( 68 , 100 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+ CheckBox CB_INDIVIDUALWORDS
+ {
+ Pos = MAP_APPFONT ( 110 , 93 );
+ Size = MAP_APPFONT ( 68 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "Individual ~words" ;
+ };
+ FixedLine FL_EFFECTS_ASIAN
+ {
+ Pos = MAP_APPFONT ( 106 , 110 ) ;
+ Size = MAP_APPFONT ( 148 , 4 ) ;
+ };
+ FixedText FT_EMPHASIS
+ {
+ Pos = MAP_APPFONT ( 110 , 117 );
+ Size = MAP_APPFONT ( 68 , 8 );
+ Text [ en-US ] = "Emp~hasis mark" ;
+ };
+ ListBox LB_EMPHASIS
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 110 , 128 );
+ Size = MAP_APPFONT ( 68 , 72 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "(Without)" ; default ; > ;
+ < "Dot" ; default ; > ;
+ < "Circle" ; default ; > ;
+ < "Disc" ; default ; > ;
+ < "Accent" ; default ; > ;
+ };
+ };
+ FixedText FT_POSITION
+ {
+ Pos = MAP_APPFONT ( 184 , 117 );
+ Size = MAP_APPFONT ( 68 , 8 );
+ Text [ en-US ] = "~Position" ;
+ };
+ ListBox LB_POSITION
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 184 , 128 );
+ Size = MAP_APPFONT ( 68 , 48 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "Above text" ; CHRDLG_POSITION_OVER ; > ;
+ < "Below text" ; CHRDLG_POSITION_UNDER ; > ;
+ };
+ };
+ Window WIN_EFFECTS_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 149 ) ;
+ Size = MAP_APPFONT ( 248 , 37 ) ;
+ Text [ en-US ] = "Example";
+ };
+ FixedText FT_EFFECTS_FONTTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 168 ) ;
+ Size = MAP_APPFONT ( 248 , 16 ) ;
+ WordBreak = TRUE ;
+ Hide = TRUE;
+ };
+ String STR_EFFECTS_CAPITALS
+ {
+ Text [ en-US ] = "Capitals" ;
+ };
+ String STR_EFFECTS_LOWERCASE
+ {
+ Text [ en-US ] = "Lowercase" ;
+ };
+ String STR_EFFECTS_TITLE
+ {
+ Text [ en-US ] = "Title" ;
+ };
+ String STR_EFFECTS_SMALL
+ {
+ Text [ en-US ] = "Small Capitals" ;
+ };
+ String STR_EFFECTS_OUTLINE
+ {
+ Text [ en-US ] = "Outline" ;
+ };
+ String STR_EFFECTS_SHADOW
+ {
+ Text [ en-US ] = "Shadow" ;
+ };
+ String STR_EFFECTS_BLINKING
+ {
+ Text [ en-US ] = "Blinking" ;
+ };
+ String STR_CHARNAME_TRANSPARENT
+ {
+ Text [ en-US ] = "Transparent";
+ };
+};
+
+// RID_SVXPAGE_CHAR_POSITION ------------------------------------------------
+
+TabPage RID_SVXPAGE_CHAR_POSITION
+{
+ HelpId = HID_SVXPAGE_CHAR_POSITION ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 );
+ Size = MAP_APPFONT ( 248 , 8 );
+ Text [ en-US ] = "Position" ;
+ };
+ RadioButton RB_HIGHPOS
+ {
+ Pos = MAP_APPFONT ( 12 , 16 );
+ Size = MAP_APPFONT ( 58 , 10 );
+ Text [ en-US ] = "Superscript" ;
+ TabStop = TRUE;
+ };
+ RadioButton RB_NORMALPOS
+ {
+ Pos = MAP_APPFONT ( 12 , 30 );
+ Size = MAP_APPFONT ( 58 , 10 );
+ Text [ en-US ] = "Normal" ;
+ TabStop = TRUE;
+ };
+ RadioButton RB_LOWPOS
+ {
+ Pos = MAP_APPFONT ( 12 , 44 );
+ Size = MAP_APPFONT ( 58 , 10 );
+ Text [ en-US ] = "Subscript" ;
+ TabStop = TRUE;
+ };
+ FixedText FT_HIGHLOW
+ {
+ Pos = MAP_APPFONT ( 74 , 16 );
+ Size = MAP_APPFONT ( 58 , 8 );
+ Text [ en-US ] = "~Raise/lower by" ;
+ };
+ MetricField ED_HIGHLOW
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 136 , 14 );
+ Size = MAP_APPFONT ( 30 , 12 );
+ TabStop = TRUE;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ };
+ CheckBox CB_HIGHLOW
+ {
+ Pos = MAP_APPFONT ( 172 , 16 );
+ Size = MAP_APPFONT ( 76 , 10 );
+ Text [ en-US ] = "A~utomatic" ;
+ TabStop = TRUE;
+ };
+ FixedText FT_FONTSIZE
+ {
+ Pos = MAP_APPFONT ( 74 , 32 );
+ Size = MAP_APPFONT ( 58 , 8 );
+ Text [ en-US ] = "Relative font size" ;
+ };
+ MetricField ED_FONTSIZE
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 136 , 30 );
+ Size = MAP_APPFONT ( 30 , 12 );
+ TabStop = TRUE;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ };
+ FixedLine FL_ROTATION_SCALING
+ {
+ Pos = MAP_APPFONT ( 6 , 59 );
+ Size = MAP_APPFONT ( 248 , 8 );
+ Text [ en-US ] = "Rotation / scaling" ;
+ };
+ FixedLine FL_SCALING
+ {
+ Pos = MAP_APPFONT ( 6 , 59 );
+ Size = MAP_APPFONT ( 248 , 8 );
+ Text [ en-US ] = "Scaling" ;
+ };
+ RadioButton RB_0_DEG
+ {
+ Pos = MAP_APPFONT ( 12 , 70 );
+ Size = MAP_APPFONT ( 46 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~0 degrees" ;
+ };
+ RadioButton RB_90_DEG
+ {
+ Pos = MAP_APPFONT ( 62 , 70 );
+ Size = MAP_APPFONT ( 46 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~90 degrees" ;
+ };
+ RadioButton RB_270_DEG
+ {
+ Pos = MAP_APPFONT ( 112 , 70 );
+ Size = MAP_APPFONT ( 46 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~270 degrees" ;
+ };
+ CheckBox CB_FIT_TO_LINE
+ {
+ Pos = MAP_APPFONT ( 162 , 70 );
+ Size = MAP_APPFONT ( 86 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "Fit to line" ;
+ };
+ FixedText FT_SCALE_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 86 );
+ Size = MAP_APPFONT ( 80 , 8 );
+ Text [ en-US ] = "Scale ~width" ;
+ };
+ MetricField MF_SCALE_WIDTH
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 94 , 84 );
+ Size = MAP_APPFONT ( 30 , 12 );
+ TabStop = TRUE;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 999 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ First = 50 ;
+ Last = 200 ;
+ SpinSize = 1 ;
+ };
+ FixedLine FL_KERNING2
+ {
+ Pos = MAP_APPFONT ( 6 , 100 );
+ Size = MAP_APPFONT ( 248 , 8 );
+ Text [ en-US ] = "Spacing" ;
+ };
+ ListBox LB_KERNING2
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 12 , 111 );
+ Size = MAP_APPFONT ( 72 , 48 ) ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Default" ; Default ; > ;
+ < "Expanded" ; Default ; > ;
+ < "Condensed" ; Default ; > ;
+ };
+ };
+ FixedText FT_KERNING2
+ {
+ Pos = MAP_APPFONT ( 86 , 113 );
+ Size = MAP_APPFONT ( 24 , 8 );
+ Center = TRUE ;
+ Text [ en-US ] = "b~y" ;
+ };
+ MetricField ED_KERNING2
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 112 , 111 );
+ Size = MAP_APPFONT ( 40 , 12 );
+ TabStop = TRUE;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 1 ;
+ Unit = FUNIT_POINT ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_PAIRKERNING
+ {
+ Pos = MAP_APPFONT ( 156 , 113 );
+ Size = MAP_APPFONT ( 92 , 10 );
+ Text [ en-US ] = "~Pair kerning" ;
+ TabStop = TRUE;
+ };
+ Window WIN_POS_PREVIEW
+ {
+ Text [ en-US ] = "Example" ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 149 ) ;
+ Size = MAP_APPFONT ( 248 , 37 ) ;
+ };
+ FixedText FT_POS_FONTTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 168 ) ;
+ Size = MAP_APPFONT ( 248 , 16 ) ;
+ WordBreak = TRUE ;
+ Hide = TRUE;
+ };
+};
+
+TabPage RID_SVXPAGE_CHAR_TWOLINES
+{
+ HelpId = HID_SVXPAGE_CHAR_TWOLINES ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_SWITCHON
+ {
+ Pos = MAP_APPFONT ( 6 , 3 );
+ Size = MAP_APPFONT ( 248 , 8 );
+ Text [ en-US ] = "Double-lined" ;
+ };
+ CheckBox CB_TWOLINES
+ {
+ Pos = MAP_APPFONT ( 12 , 14 );
+ Size = MAP_APPFONT ( 236 , 10 );
+ Text [ en-US ] = "~Write in double lines" ;
+ TabStop = TRUE;
+ };
+ FixedLine FL_ENCLOSE
+ {
+ Pos = MAP_APPFONT ( 6 , 30 );
+ Size = MAP_APPFONT ( 248 , 8 );
+ Text [ en-US ] = "Enclosing character" ;
+ };
+ FixedText FT_STARTBRACKET
+ {
+ Pos = MAP_APPFONT ( 12 , 41 );
+ Size = MAP_APPFONT ( 90 , 8 );
+ Text [ en-US ] = "I~nitial character" ;
+ };
+ ListBox ED_STARTBRACKET
+ {
+ Pos = MAP_APPFONT ( 12 , 52 );
+ Size = MAP_APPFONT ( 90 , 72 );
+ TabStop = TRUE;
+ Border = TRUE;
+ StringList [ en-US ] =
+ {
+ < "(None)" ; CHRDLG_ENCLOSE_NONE ; > ;
+ < "(" ; CHRDLG_ENCLOSE_ROUND ; > ;
+ < "[" ; CHRDLG_ENCLOSE_SQUARE ; > ;
+ < "<" ; CHRDLG_ENCLOSE_POINTED ; > ;
+ < "{" ; CHRDLG_ENCLOSE_CURVED ; > ;
+ < "Other Characters..." ; CHRDLG_ENCLOSE_SPECIAL_CHAR ; > ;
+ };
+ };
+ FixedText FT_ENDBRACKET
+ {
+ Pos = MAP_APPFONT ( 108 , 41 );
+ Size = MAP_APPFONT ( 90 , 8 );
+ Text [ en-US ] = "Final charact~er" ;
+ };
+ ListBox ED_ENDBRACKET
+ {
+ Pos = MAP_APPFONT ( 108 , 52 );
+ Size = MAP_APPFONT ( 90 , 72 );
+ TabStop = TRUE;
+ Border = TRUE;
+ StringList [ en-US ] =
+ {
+ < "(None)" ; CHRDLG_ENCLOSE_NONE ; > ;
+ < ")" ; CHRDLG_ENCLOSE_ROUND ; > ;
+ < "]" ; CHRDLG_ENCLOSE_SQUARE ; > ;
+ < ">" ; CHRDLG_ENCLOSE_POINTED ; > ;
+ < "}" ; CHRDLG_ENCLOSE_CURVED ; > ;
+ < "Other Characters..." ; CHRDLG_ENCLOSE_SPECIAL_CHAR ; > ;
+ };
+ };
+ Window WIN_TWOLINES_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 149 ) ;
+ Size = MAP_APPFONT ( 248 , 37 ) ;
+ Text [ en-US ] = "Example" ;
+ };
+ FixedText FT_TWOLINES_FONTTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 168 ) ;
+ Size = MAP_APPFONT ( 248 , 16 ) ;
+ WordBreak = TRUE ;
+ Hide = TRUE;
+ };
+};
+
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/connect.cxx b/cui/source/tabpages/connect.cxx
new file mode 100644
index 000000000000..dad2c336043c
--- /dev/null
+++ b/cui/source/tabpages/connect.cxx
@@ -0,0 +1,565 @@
+/*************************************************************************
+ *
+ * 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: connect.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <tools/shl.hxx>
+#include "svx/ofaitem.hxx" // add CHINA001
+#include <sfx2/request.hxx> // add CHINA001
+#define _SVX_CONNECT_CXX
+
+#include <svx/svdoedge.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/svdattrx.hxx>
+#include <svx/svdview.hxx>
+
+#include "svx/connctrl.hxx"
+#include "connect.hxx"
+#include "connect.hrc"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+
+#include <svx/dialogs.hrc>
+
+static USHORT pRanges[] =
+{
+ SDRATTR_EDGE_FIRST,
+ SDRATTR_EDGE_LAST,
+ 0
+};
+
+/*************************************************************************
+|*
+|* Dialog zum Aendern von Konnektoren (Connectors)
+|*
+\************************************************************************/
+
+SvxConnectionDialog::SvxConnectionDialog( Window* pParent, const SfxItemSet& rInAttrs,
+ const SdrView* pSdrView ) :
+ SfxSingleTabDialog( pParent, rInAttrs, RID_SVXPAGE_CONNECTION )
+{
+ SvxConnectionPage* _pPage = new SvxConnectionPage( this, rInAttrs );
+
+ _pPage->SetView( pSdrView );
+ _pPage->Construct();
+
+ SetTabPage( _pPage );
+ SetText( _pPage->GetText() );
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxConnectionDialog::~SvxConnectionDialog()
+{
+}
+
+/*************************************************************************
+|*
+|* Seite zum Aendern von Konnektoren (Connectors)
+|*
+\************************************************************************/
+
+SvxConnectionPage::SvxConnectionPage( Window* pWindow, const SfxItemSet& rInAttrs ) :
+ SfxTabPage ( pWindow, SVX_RES( RID_SVXPAGE_CONNECTION ),
+ rInAttrs ),
+
+ aFtType ( this, SVX_RES( FT_TYPE ) ),
+ aLbType ( this, SVX_RES( LB_TYPE ) ),
+
+ aFlDelta ( this, SVX_RES( FL_DELTA ) ),
+ aFtLine1 ( this, SVX_RES( FT_LINE_1 ) ),
+ aMtrFldLine1 ( this, SVX_RES( MTR_FLD_LINE_1 ) ),
+ aFtLine2 ( this, SVX_RES( FT_LINE_2 ) ),
+ aMtrFldLine2 ( this, SVX_RES( MTR_FLD_LINE_2 ) ),
+ aFtLine3 ( this, SVX_RES( FT_LINE_3 ) ),
+ aMtrFldLine3 ( this, SVX_RES( MTR_FLD_LINE_3 ) ),
+
+ aFlDistance ( this, SVX_RES( FL_DISTANCE ) ),
+ aFtHorz1 ( this, SVX_RES( FT_HORZ_1 ) ),
+ aMtrFldHorz1 ( this, SVX_RES( MTR_FLD_HORZ_1 ) ),
+ aFtVert1 ( this, SVX_RES( FT_VERT_1 ) ),
+ aMtrFldVert1 ( this, SVX_RES( MTR_FLD_VERT_1 ) ),
+ aFtHorz2 ( this, SVX_RES( FT_HORZ_2 ) ),
+ aMtrFldHorz2 ( this, SVX_RES( MTR_FLD_HORZ_2 ) ),
+ aFtVert2 ( this, SVX_RES( FT_VERT_2 ) ),
+ aMtrFldVert2 ( this, SVX_RES( MTR_FLD_VERT_2 ) ),
+
+ aCtlPreview ( this, SVX_RES( CTL_PREVIEW ), rInAttrs ),
+ rOutAttrs ( rInAttrs ),
+ aAttrSet ( *rInAttrs.GetPool() )
+{
+ FreeResource();
+
+ SfxItemPool* pPool = rOutAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ eUnit = pPool->GetMetric( SDRATTR_EDGENODE1HORZDIST );
+
+ FillTypeLB();
+
+ const FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs );
+ SetFieldUnit( aMtrFldHorz1, eFUnit );
+ SetFieldUnit( aMtrFldHorz2, eFUnit );
+ SetFieldUnit( aMtrFldVert1, eFUnit );
+ SetFieldUnit( aMtrFldVert2, eFUnit );
+ SetFieldUnit( aMtrFldLine1, eFUnit );
+ SetFieldUnit( aMtrFldLine2, eFUnit );
+ SetFieldUnit( aMtrFldLine3, eFUnit );
+ if( eFUnit == FUNIT_MM )
+ {
+ aMtrFldHorz1.SetSpinSize( 50 );
+ aMtrFldHorz2.SetSpinSize( 50 );
+ aMtrFldVert1.SetSpinSize( 50 );
+ aMtrFldVert2.SetSpinSize( 50 );
+ aMtrFldLine1.SetSpinSize( 50 );
+ aMtrFldLine2.SetSpinSize( 50 );
+ aMtrFldLine3.SetSpinSize( 50 );
+ }
+
+ // disable 3D border
+ aCtlPreview.SetBorderStyle(WINDOW_BORDER_MONO);
+
+ Link aLink( LINK( this, SvxConnectionPage, ChangeAttrHdl_Impl ) );
+ aMtrFldHorz1.SetModifyHdl( aLink );
+ aMtrFldVert1.SetModifyHdl( aLink );
+ aMtrFldHorz2.SetModifyHdl( aLink );
+ aMtrFldVert2.SetModifyHdl( aLink );
+ aMtrFldLine1.SetModifyHdl( aLink );
+ aMtrFldLine2.SetModifyHdl( aLink );
+ aMtrFldLine3.SetModifyHdl( aLink );
+ aLbType.SetSelectHdl( aLink );
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxConnectionPage::~SvxConnectionPage()
+{
+}
+
+/*************************************************************************
+|*
+|* Liest uebergebenen Item-Set
+|*
+\************************************************************************/
+
+void __EXPORT SvxConnectionPage::Reset( const SfxItemSet& rAttrs )
+{
+ const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_EDGENODE1HORZDIST );
+ const SfxItemPool* pPool = rAttrs.GetPool();
+
+ // SdrEdgeNode1HorzDistItem
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE1HORZDIST );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrEdgeNode1HorzDistItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldHorz1, nValue, eUnit );
+ }
+ else
+ aMtrFldHorz1.SetEmptyFieldValue();
+
+ aMtrFldHorz1.SaveValue();
+
+ // SdrEdgeNode2HorzDistItem
+ pItem = GetItem( rAttrs, SDRATTR_EDGENODE2HORZDIST );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE2HORZDIST );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrEdgeNode2HorzDistItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldHorz2, nValue, eUnit );
+ }
+ else
+ aMtrFldHorz2.SetEmptyFieldValue();
+
+ aMtrFldHorz2.SaveValue();
+
+ // SdrEdgeNode1VertDistItem
+ pItem = GetItem( rAttrs, SDRATTR_EDGENODE1VERTDIST );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE1VERTDIST );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrEdgeNode1VertDistItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldVert1, nValue, eUnit );
+ }
+ else
+ aMtrFldVert1.SetEmptyFieldValue();
+
+ aMtrFldVert1.SaveValue();
+
+ // SdrEdgeNode2VertDistItem
+ pItem = GetItem( rAttrs, SDRATTR_EDGENODE2VERTDIST );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE2VERTDIST );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrEdgeNode2VertDistItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldVert2, nValue, eUnit );
+ }
+ else
+ aMtrFldVert2.SetEmptyFieldValue();
+
+ aMtrFldVert2.SaveValue();
+
+ // SdrEdgeLine1DeltaItem
+ pItem = GetItem( rAttrs, SDRATTR_EDGELINE1DELTA );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE1DELTA );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrEdgeLine1DeltaItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldLine1, nValue, eUnit );
+ }
+ else
+ aMtrFldLine1.SetEmptyFieldValue();
+
+ aMtrFldLine1.SaveValue();
+
+ // SdrEdgeLine2DeltaItem
+ pItem = GetItem( rAttrs, SDRATTR_EDGELINE2DELTA );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE2DELTA );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrEdgeLine2DeltaItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldLine2, nValue, eUnit );
+ }
+ else
+ aMtrFldLine2.SetEmptyFieldValue();
+
+ aMtrFldLine2.SaveValue();
+
+ // SdrEdgeLine3DeltaItem
+ pItem = GetItem( rAttrs, SDRATTR_EDGELINE3DELTA );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE3DELTA );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrEdgeLine3DeltaItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldLine3, nValue, eUnit );
+ }
+ else
+ aMtrFldLine3.SetEmptyFieldValue();
+
+ aMtrFldLine3.SaveValue();
+
+ // SdrEdgeLineDeltaAnzItem
+ pItem = GetItem( rAttrs, SDRATTR_EDGELINEDELTAANZ );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINEDELTAANZ );
+ if( pItem )
+ {
+ UINT16 nValue = ( ( const SdrEdgeLineDeltaAnzItem* )pItem )->GetValue();
+ if( nValue <= 2 )
+ {
+ aFtLine3.Enable( FALSE );
+ aMtrFldLine3.Enable( FALSE );
+ aMtrFldLine3.SetEmptyFieldValue();
+ }
+ if( nValue <= 1 )
+ {
+ aFtLine2.Enable( FALSE );
+ aMtrFldLine2.Enable( FALSE );
+ aMtrFldLine2.SetEmptyFieldValue();
+ }
+ if( nValue == 0 )
+ {
+ aFtLine1.Enable( FALSE );
+ aMtrFldLine1.Enable( FALSE );
+ aMtrFldLine1.SetEmptyFieldValue();
+ }
+ }
+
+ // SdrEdgeKindItem
+ pItem = GetItem( rAttrs, SDRATTR_EDGEKIND );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_EDGEKIND );
+ if( pItem )
+ {
+ SdrEdgeKind nValue = ( ( const SdrEdgeKindItem* )pItem )->GetValue();
+ aLbType.SelectEntryPos( sal::static_int_cast< USHORT >(nValue) );
+ }
+ else
+ aLbType.SetNoSelection();
+ aLbType.SaveValue();
+}
+
+/*************************************************************************
+|*
+|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen
+|*
+\************************************************************************/
+
+BOOL SvxConnectionPage::FillItemSet( SfxItemSet& rAttrs)
+{
+ BOOL bModified = FALSE;
+ INT32 nValue;
+
+ if( aMtrFldHorz1.GetText() != aMtrFldHorz1.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldHorz1, eUnit );
+ rAttrs.Put( SdrEdgeNode1HorzDistItem( nValue ) );
+ bModified = TRUE;
+ }
+
+ if( aMtrFldHorz2.GetText() != aMtrFldHorz2.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldHorz2, eUnit );
+ rAttrs.Put( SdrEdgeNode2HorzDistItem( nValue ) );
+ bModified = TRUE;
+ }
+
+ if( aMtrFldVert1.GetText() != aMtrFldVert1.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldVert1, eUnit );
+ rAttrs.Put( SdrEdgeNode1VertDistItem( nValue ) );
+ bModified = TRUE;
+ }
+
+ if( aMtrFldVert2.GetText() != aMtrFldVert2.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldVert2, eUnit );
+ rAttrs.Put( SdrEdgeNode2VertDistItem( nValue ) );
+ bModified = TRUE;
+ }
+
+ if( aMtrFldLine1.GetText() != aMtrFldLine1.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldLine1, eUnit );
+ rAttrs.Put( SdrEdgeLine1DeltaItem( nValue ) );
+ bModified = TRUE;
+ }
+
+ if( aMtrFldLine2.GetText() != aMtrFldLine2.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldLine2, eUnit );
+ rAttrs.Put( SdrEdgeLine2DeltaItem( nValue ) );
+ bModified = TRUE;
+ }
+
+ if( aMtrFldLine3.GetText() != aMtrFldLine3.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldLine3, eUnit );
+ rAttrs.Put( SdrEdgeLine3DeltaItem( nValue ) );
+ bModified = TRUE;
+ }
+
+
+ USHORT nPos = aLbType.GetSelectEntryPos();
+ if( nPos != aLbType.GetSavedValue() )
+ {
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ rAttrs.Put( SdrEdgeKindItem( (SdrEdgeKind) nPos ) );
+ bModified = TRUE;
+ }
+ }
+
+ return( bModified );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxConnectionPage::Construct()
+{
+ DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
+
+ aCtlPreview.SetView( pView );
+ aCtlPreview.Construct();
+}
+
+/*************************************************************************
+|*
+|* Erzeugt die Seite
+|*
+\************************************************************************/
+
+SfxTabPage* SvxConnectionPage::Create( Window* pWindow,
+ const SfxItemSet& rAttrs )
+{
+ return( new SvxConnectionPage( pWindow, rAttrs ) );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+USHORT* SvxConnectionPage::GetRanges()
+{
+ return( pRanges );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxConnectionPage, ChangeAttrHdl_Impl, void *, p )
+{
+ if( p == &aMtrFldHorz1 )
+ {
+ INT32 nValue = GetCoreValue( aMtrFldHorz1, eUnit );
+ aAttrSet.Put( SdrEdgeNode1HorzDistItem( nValue ) );
+ }
+
+ if( p == &aMtrFldHorz2 )
+ {
+ INT32 nValue = GetCoreValue( aMtrFldHorz2, eUnit );
+ aAttrSet.Put( SdrEdgeNode2HorzDistItem( nValue ) );
+ }
+
+ if( p == &aMtrFldVert1 )
+ {
+ INT32 nValue = GetCoreValue( aMtrFldVert1, eUnit );
+ aAttrSet.Put( SdrEdgeNode1VertDistItem( nValue ) );
+ }
+
+ if( p == &aMtrFldVert2 )
+ {
+ INT32 nValue = GetCoreValue( aMtrFldVert2, eUnit );
+ aAttrSet.Put( SdrEdgeNode2VertDistItem( nValue ) );
+ }
+
+ if( p == &aMtrFldLine1 )
+ {
+ INT32 nValue = GetCoreValue( aMtrFldLine1, eUnit );
+ aAttrSet.Put( SdrEdgeLine1DeltaItem( nValue ) );
+ }
+
+ if( p == &aMtrFldLine2 )
+ {
+ INT32 nValue = GetCoreValue( aMtrFldLine2, eUnit );
+ aAttrSet.Put( SdrEdgeLine2DeltaItem( nValue ) );
+ }
+
+ if( p == &aMtrFldLine3 )
+ {
+ INT32 nValue = GetCoreValue( aMtrFldLine3, eUnit );
+ aAttrSet.Put( SdrEdgeLine3DeltaItem( nValue ) );
+ }
+
+
+ if( p == &aLbType )
+ {
+ USHORT nPos = aLbType.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aAttrSet.Put( SdrEdgeKindItem( (SdrEdgeKind) nPos ) );
+ }
+ }
+
+ aCtlPreview.SetAttributes( aAttrSet );
+
+ if( p == &aLbType )
+ {
+ // Anzahl der Linienversaetze ermitteln
+ USHORT nCount = aCtlPreview.GetLineDeltaAnz();
+
+ aFtLine3.Enable( nCount > 2 );
+ aMtrFldLine3.Enable( nCount > 2 );
+ if( nCount > 2 )
+ aMtrFldLine3.SetValue( aMtrFldLine3.GetValue() );
+ else
+ aMtrFldLine3.SetEmptyFieldValue();
+
+ aFtLine2.Enable( nCount > 1 );
+ aMtrFldLine2.Enable( nCount > 1 );
+ if( nCount > 1 )
+ aMtrFldLine2.SetValue( aMtrFldLine2.GetValue() );
+ else
+ aMtrFldLine2.SetEmptyFieldValue();
+
+ aFtLine1.Enable( nCount > 0 );
+ aMtrFldLine1.Enable( nCount > 0 );
+ if( nCount > 0 )
+ aMtrFldLine1.SetValue( aMtrFldLine1.GetValue() );
+ else
+ aMtrFldLine1.SetEmptyFieldValue();
+
+ }
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxConnectionPage::FillTypeLB()
+{
+ // ListBox mit Verbindernamen fuellen
+ const SfxPoolItem* pItem = GetItem( rOutAttrs, SDRATTR_EDGEKIND );
+ const SfxItemPool* pPool = rOutAttrs.GetPool();
+
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_EDGEKIND );
+ if( pItem )
+ {
+ const SdrEdgeKindItem* pEdgeKindItem = (const SdrEdgeKindItem*) pItem;
+ USHORT nCount = pEdgeKindItem->GetValueCount();
+ String aStr;
+
+ for( USHORT i = 0; i < nCount; i++ )
+ {
+ aStr = pEdgeKindItem->GetValueTextByPos( i );
+ aLbType.InsertEntry( aStr );
+ }
+ }
+}
+void SvxConnectionPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG(&aSet,pOfaPtrItem,OfaPtrItem,SID_OBJECT_LIST,sal_False);
+ if (pOfaPtrItem)
+ SetView( static_cast<SdrView *>(pOfaPtrItem->GetValue()) );
+
+ Construct();
+}
+
diff --git a/cui/source/tabpages/connect.hrc b/cui/source/tabpages/connect.hrc
new file mode 100644
index 000000000000..f6c49e5c7d6e
--- /dev/null
+++ b/cui/source/tabpages/connect.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * 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: connect.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define FL_DISTANCE 1
+#define FL_DELTA 2
+#define FT_LINE_1 1
+#define FT_LINE_2 2
+#define FT_LINE_3 3
+#define MTR_FLD_LINE_1 1
+#define MTR_FLD_LINE_2 2
+#define MTR_FLD_LINE_3 3
+#define FT_HORZ_1 4
+#define FT_HORZ_2 5
+#define MTR_FLD_HORZ_1 4
+#define MTR_FLD_HORZ_2 5
+#define MTR_FLD_VERT_1 6
+#define MTR_FLD_VERT_2 7
+#define FT_VERT_2 7
+#define FT_VERT_1 6
+#define FT_TYPE 8
+#define LB_TYPE 1
+#define CTL_PREVIEW 1
diff --git a/cui/source/tabpages/connect.src b/cui/source/tabpages/connect.src
new file mode 100644
index 000000000000..a2bd502e1717
--- /dev/null
+++ b/cui/source/tabpages/connect.src
@@ -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: connect.src,v $
+ * $Revision: 1.33 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svtools/controldims.hrc>
+#include "connect.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+ // RID_SVXPAGE_CONNECTION ------------------------------------------------
+TabPage RID_SVXPAGE_CONNECTION
+{
+ HelpId = HID_PAGE_CONNECTION ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Connector" ;
+ FixedText FT_TYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 25 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ };
+ ListBox LB_TYPE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 37 , 6 ) ;
+ Size = MAP_APPFONT ( 83 , 54 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedLine FL_DELTA
+ {
+ Pos = MAP_APPFONT ( 6 , 24 ) ;
+ Size = MAP_APPFONT ( 120 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Line skew" ;
+ };
+ FixedText FT_LINE_1
+ {
+ Pos = MAP_APPFONT ( 12 , 37 ) ;
+ Size = MAP_APPFONT ( 66 , 8 ) ;
+ Text [ en-US ] = "Line ~1" ;
+ };
+ MetricField MTR_FLD_LINE_1
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 79 , 35 ) ;
+ Size = MAP_APPFONT ( 41 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ DecimalDigits = 2 ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Unit = FUNIT_CM ;
+ };
+ FixedText FT_LINE_2
+ {
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Size = MAP_APPFONT ( 66 , 8 ) ;
+ Text [ en-US ] = "Line ~2" ;
+ };
+ MetricField MTR_FLD_LINE_2
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 79 , 51 ) ;
+ Size = MAP_APPFONT ( 41 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ DecimalDigits = 2 ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Unit = FUNIT_CM ;
+ };
+ FixedText FT_LINE_3
+ {
+ Pos = MAP_APPFONT ( 12 , 69 ) ;
+ Size = MAP_APPFONT ( 66 , 8 ) ;
+ Text [ en-US ] = "Line ~3" ;
+ };
+ MetricField MTR_FLD_LINE_3
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 79 , 67 ) ;
+ Size = MAP_APPFONT ( 41 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ DecimalDigits = 2 ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Unit = FUNIT_CM ;
+ };
+ FixedLine FL_DISTANCE
+ {
+ Pos = MAP_APPFONT ( 6 , 85 ) ;
+ Size = MAP_APPFONT ( 120 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Line spacing" ;
+ };
+ FixedText FT_HORZ_1
+ {
+ Pos = MAP_APPFONT ( 12 , 98 ) ;
+ Size = MAP_APPFONT ( 66 , 8 ) ;
+ Text [ en-US ] = "~Begin horizontal" ;
+ };
+ MetricField MTR_FLD_HORZ_1
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 79 , 96 ) ;
+ Size = MAP_APPFONT ( 41 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ DecimalDigits = 2 ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Unit = FUNIT_CM ;
+ };
+ FixedText FT_HORZ_2
+ {
+ Pos = MAP_APPFONT ( 12 , 130 ) ;
+ Size = MAP_APPFONT ( 66 , 8 ) ;
+ Text [ en-US ] = "End ~horizontal" ;
+ };
+ MetricField MTR_FLD_HORZ_2
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 79 , 128 ) ;
+ Size = MAP_APPFONT ( 41 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ DecimalDigits = 2 ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Unit = FUNIT_CM ;
+ };
+ FixedText FT_VERT_1
+ {
+ Pos = MAP_APPFONT ( 12 , 114 ) ;
+ Size = MAP_APPFONT ( 66 , 8 ) ;
+ Text [ en-US ] = "Begin ~vertical" ;
+ };
+ MetricField MTR_FLD_VERT_1
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 79 , 112 ) ;
+ Size = MAP_APPFONT ( 41 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ DecimalDigits = 2 ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Unit = FUNIT_CM ;
+ };
+ FixedText FT_VERT_2
+ {
+ Pos = MAP_APPFONT ( 12 , 146 ) ;
+ Size = MAP_APPFONT ( 66 , 8 ) ;
+ Text [ en-US ] = "~End vertical" ;
+ };
+ MetricField MTR_FLD_VERT_2
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 79 , 144 ) ;
+ Size = MAP_APPFONT ( 41 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ DecimalDigits = 2 ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Unit = FUNIT_CM ;
+ };
+ Control CTL_PREVIEW
+ {
+ HelpId = HID_PAGE_CONNECTION_CTL_PREVIEW ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 + 120 + RSC_SP_FLGR_SPACE_Y + RSC_SP_FLGR_INNERBORDER_LEFT , 35 ) ;
+ Size = MAP_APPFONT ( 118 , 121 ) ;
+ QuickHelpText [ en-US ] = "Preview";
+ };
+};
+ // ******************************************************************* EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/dstribut.cxx b/cui/source/tabpages/dstribut.cxx
new file mode 100644
index 000000000000..43fdfe507627
--- /dev/null
+++ b/cui/source/tabpages/dstribut.cxx
@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * 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: dstribut.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <sfx2/basedlgs.hxx>
+#include <svx/dialogs.hrc>
+#include "dstribut.hxx"
+#include "dstribut.hrc"
+
+#include <svx/svddef.hxx>
+#include <svx/dialmgr.hxx>
+#include <tools/shl.hxx>
+
+static USHORT pRanges[] =
+{
+ SDRATTR_MEASURE_FIRST,
+ SDRATTR_MEASURE_LAST,
+ 0
+};
+
+/*************************************************************************
+|*
+|* Dialog
+|*
+\************************************************************************/
+
+SvxDistributeDialog::SvxDistributeDialog(
+ Window* pParent,
+ const SfxItemSet& rInAttrs,
+ SvxDistributeHorizontal eHor,
+ SvxDistributeVertical eVer)
+: SfxSingleTabDialog(pParent, rInAttrs, RID_SVXPAGE_DISTRIBUTE ),
+ mpPage(0L)
+{
+ mpPage = new SvxDistributePage(this, rInAttrs, eHor, eVer);
+ SetTabPage(mpPage);
+ SetText(mpPage->GetText());
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxDistributeDialog::~SvxDistributeDialog()
+{
+}
+
+/*************************************************************************
+|*
+|* Tabpage
+|*
+\************************************************************************/
+
+SvxDistributePage::SvxDistributePage(
+ Window* pWindow,
+ const SfxItemSet& rInAttrs,
+ SvxDistributeHorizontal eHor,
+ SvxDistributeVertical eVer)
+: SvxTabPage(pWindow, SVX_RES(RID_SVXPAGE_DISTRIBUTE), rInAttrs),
+ meDistributeHor(eHor),
+ meDistributeVer(eVer),
+ maFlHorizontal (this, SVX_RES(FL_HORIZONTAL )),
+ maBtnHorNone (this, SVX_RES(BTN_HOR_NONE )),
+ maBtnHorLeft (this, SVX_RES(BTN_HOR_LEFT )),
+ maBtnHorCenter (this, SVX_RES(BTN_HOR_CENTER )),
+ maBtnHorDistance (this, SVX_RES(BTN_HOR_DISTANCE )),
+ maBtnHorRight (this, SVX_RES(BTN_HOR_RIGHT )),
+ maHorLow (this, SVX_RES(IMG_HOR_LOW )),
+ maHorCenter (this, SVX_RES(IMG_HOR_CENTER )),
+ maHorDistance (this, SVX_RES(IMG_HOR_DISTANCE )),
+ maHorHigh (this, SVX_RES(IMG_HOR_HIGH )),
+ maFlVertical (this, SVX_RES(FL_VERTICAL )),
+ maBtnVerNone (this, SVX_RES(BTN_VER_NONE )),
+ maBtnVerTop (this, SVX_RES(BTN_VER_TOP )),
+ maBtnVerCenter (this, SVX_RES(BTN_VER_CENTER )),
+ maBtnVerDistance (this, SVX_RES(BTN_VER_DISTANCE )),
+ maBtnVerBottom (this, SVX_RES(BTN_VER_BOTTOM )),
+ maVerLow (this, SVX_RES(IMG_VER_LOW )),
+ maVerCenter (this, SVX_RES(IMG_VER_CENTER )),
+ maVerDistance (this, SVX_RES(IMG_VER_DISTANCE )),
+ maVerHigh (this, SVX_RES(IMG_VER_HIGH ))
+{
+ maHorLow.SetModeImage( Image( SVX_RES( IMG_HOR_LOW_H ) ), BMP_COLOR_HIGHCONTRAST );
+ maHorCenter.SetModeImage( Image( SVX_RES( IMG_HOR_CENTER_H ) ), BMP_COLOR_HIGHCONTRAST );
+ maHorDistance.SetModeImage( Image( SVX_RES( IMG_HOR_DISTANCE_H ) ), BMP_COLOR_HIGHCONTRAST );
+ maHorHigh.SetModeImage( Image( SVX_RES( IMG_HOR_HIGH_H ) ), BMP_COLOR_HIGHCONTRAST );
+ maVerDistance.SetModeImage( Image( SVX_RES( IMG_VER_DISTANCE_H ) ), BMP_COLOR_HIGHCONTRAST );
+ maVerLow.SetModeImage( Image( SVX_RES( IMG_VER_LOW_H ) ), BMP_COLOR_HIGHCONTRAST );
+ maVerCenter.SetModeImage( Image( SVX_RES( IMG_VER_CENTER_H ) ), BMP_COLOR_HIGHCONTRAST );
+ maVerHigh.SetModeImage( Image( SVX_RES( IMG_VER_HIGH_H ) ), BMP_COLOR_HIGHCONTRAST );
+
+ FreeResource();
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxDistributePage::~SvxDistributePage()
+{
+}
+
+/*************************************************************************
+|*
+|* create the tabpage
+|*
+\************************************************************************/
+
+SfxTabPage* SvxDistributePage::Create(Window* pWindow, const SfxItemSet& rAttrs,
+ SvxDistributeHorizontal eHor, SvxDistributeVertical eVer)
+{
+ return(new SvxDistributePage(pWindow, rAttrs, eHor, eVer));
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+UINT16* SvxDistributePage::GetRanges()
+{
+ return(pRanges);
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxDistributePage::PointChanged(Window* /*pWindow*/, RECT_POINT /*eRP*/)
+{
+}
+
+/*************************************************************************
+|*
+|* read the delivered Item-Set
+|*
+\************************************************************************/
+
+void __EXPORT SvxDistributePage::Reset(const SfxItemSet& )
+{
+ maBtnHorNone.SetState(FALSE);
+ maBtnHorLeft.SetState(FALSE);
+ maBtnHorCenter.SetState(FALSE);
+ maBtnHorDistance.SetState(FALSE);
+ maBtnHorRight.SetState(FALSE);
+
+ switch(meDistributeHor)
+ {
+ case SvxDistributeHorizontalNone : maBtnHorNone.SetState(TRUE); break;
+ case SvxDistributeHorizontalLeft : maBtnHorLeft.SetState(TRUE); break;
+ case SvxDistributeHorizontalCenter : maBtnHorCenter.SetState(TRUE); break;
+ case SvxDistributeHorizontalDistance : maBtnHorDistance.SetState(TRUE); break;
+ case SvxDistributeHorizontalRight : maBtnHorRight.SetState(TRUE); break;
+ }
+
+ maBtnVerNone.SetState(FALSE);
+ maBtnVerTop.SetState(FALSE);
+ maBtnVerCenter.SetState(FALSE);
+ maBtnVerDistance.SetState(FALSE);
+ maBtnVerBottom.SetState(FALSE);
+
+ switch(meDistributeVer)
+ {
+ case SvxDistributeVerticalNone : maBtnVerNone.SetState(TRUE); break;
+ case SvxDistributeVerticalTop : maBtnVerTop.SetState(TRUE); break;
+ case SvxDistributeVerticalCenter : maBtnVerCenter.SetState(TRUE); break;
+ case SvxDistributeVerticalDistance : maBtnVerDistance.SetState(TRUE); break;
+ case SvxDistributeVerticalBottom : maBtnVerBottom.SetState(TRUE); break;
+ }
+}
+
+/*************************************************************************
+|*
+|* Fill the delivered Item-Set with dialogbox-attributes
+|*
+\************************************************************************/
+
+BOOL SvxDistributePage::FillItemSet( SfxItemSet& )
+{
+ SvxDistributeHorizontal eDistributeHor(SvxDistributeHorizontalNone);
+ SvxDistributeVertical eDistributeVer(SvxDistributeVerticalNone);
+
+ if(maBtnHorLeft.IsChecked())
+ eDistributeHor = SvxDistributeHorizontalLeft;
+ else if(maBtnHorCenter.IsChecked())
+ eDistributeHor = SvxDistributeHorizontalCenter;
+ else if(maBtnHorDistance.IsChecked())
+ eDistributeHor = SvxDistributeHorizontalDistance;
+ else if(maBtnHorRight.IsChecked())
+ eDistributeHor = SvxDistributeHorizontalRight;
+
+ if(maBtnVerTop.IsChecked())
+ eDistributeVer = SvxDistributeVerticalTop;
+ else if(maBtnVerCenter.IsChecked())
+ eDistributeVer = SvxDistributeVerticalCenter;
+ else if(maBtnVerDistance.IsChecked())
+ eDistributeVer = SvxDistributeVerticalDistance;
+ else if(maBtnVerBottom.IsChecked())
+ eDistributeVer = SvxDistributeVerticalBottom;
+
+ if(eDistributeHor != meDistributeHor || eDistributeVer != meDistributeVer)
+ {
+ meDistributeHor = eDistributeHor;
+ meDistributeVer = eDistributeVer;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
diff --git a/cui/source/tabpages/dstribut.hrc b/cui/source/tabpages/dstribut.hrc
new file mode 100644
index 000000000000..0834c8640785
--- /dev/null
+++ b/cui/source/tabpages/dstribut.hrc
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * 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: dstribut.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_HORIZONTAL 1
+#define BTN_HOR_NONE 2
+#define BTN_HOR_LEFT 3
+#define BTN_HOR_CENTER 4
+#define BTN_HOR_DISTANCE 5
+#define BTN_HOR_RIGHT 6
+#define FL_VERTICAL 7
+#define BTN_VER_NONE 8
+#define BTN_VER_TOP 9
+#define BTN_VER_CENTER 10
+#define BTN_VER_DISTANCE 11
+#define BTN_VER_BOTTOM 12
+#define IMG_HOR_LOW 14
+#define IMG_HOR_CENTER 15
+#define IMG_HOR_DISTANCE 16
+#define IMG_HOR_HIGH 17
+#define IMG_VER_LOW 18
+#define IMG_VER_CENTER 19
+#define IMG_VER_DISTANCE 20
+#define IMG_VER_HIGH 21
+
+#define IMG_HOR_LOW_H 22
+#define IMG_HOR_CENTER_H 23
+#define IMG_HOR_DISTANCE_H 24
+#define IMG_HOR_HIGH_H 25
+#define IMG_VER_LOW_H 26
+#define IMG_VER_CENTER_H 27
+#define IMG_VER_DISTANCE_H 28
+#define IMG_VER_HIGH_H 29
diff --git a/cui/source/tabpages/dstribut.src b/cui/source/tabpages/dstribut.src
new file mode 100644
index 000000000000..e9e0ede56590
--- /dev/null
+++ b/cui/source/tabpages/dstribut.src
@@ -0,0 +1,293 @@
+/*************************************************************************
+ *
+ * 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: dstribut.src,v $
+ * $Revision: 1.33 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+#include "dstribut.hrc"
+#include "helpid.hrc"
+
+// RID_SVXPAGE_DISTRIBUTE ---------------------------------------------------
+#define STD_MASKCOLOR Color { Red=0xffff; Green=0x0000; Blue=0xffff; }
+TabPage RID_SVXPAGE_DISTRIBUTE
+{
+ HelpId = HID_PAGE_DISTRIBUTE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 81 ) ;
+ Text [ en-US ] = "Distribution" ;
+
+ FixedLine FL_HORIZONTAL
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Horizontal" ;
+ };
+
+ RadioButton BTN_HOR_NONE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 48 , 10 ) ;
+ Text [ en-US ] = "~None" ;
+ };
+
+ RadioButton BTN_HOR_LEFT
+ {
+ Pos = MAP_APPFONT ( 56 , 26 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "~Left" ;
+ };
+
+ RadioButton BTN_HOR_CENTER
+ {
+ Pos = MAP_APPFONT ( 105 , 26 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "~Center" ;
+ };
+
+ RadioButton BTN_HOR_DISTANCE
+ {
+ Pos = MAP_APPFONT ( 154 , 26 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "~Spacing" ;
+ };
+
+ RadioButton BTN_HOR_RIGHT
+ {
+ Pos = MAP_APPFONT ( 203 , 26 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "~Right" ;
+ };
+
+ FixedImage IMG_HOR_LOW {
+ Pos = MAP_APPFONT ( 65 , 10 );
+ Size = MAP_APPFONT ( 15 , 16 );
+ Hide = FALSE;
+ Fixed = Image {
+ ImageBitmap = Bitmap { File = "dsth_low.bmp"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ };
+
+ FixedImage IMG_HOR_CENTER {
+ Pos = MAP_APPFONT ( 114 , 10 );
+ Size = MAP_APPFONT ( 15 , 16 );
+ Hide = FALSE;
+ Fixed = Image {
+ ImageBitmap = Bitmap { File = "dsth_cen.bmp"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ };
+
+ FixedImage IMG_HOR_DISTANCE {
+ Pos = MAP_APPFONT ( 163 , 10 );
+ Size = MAP_APPFONT ( 15 , 16 );
+ Hide = FALSE;
+ Fixed = Image {
+ ImageBitmap = Bitmap { File = "dsth_dst.bmp"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ };
+
+ FixedImage IMG_HOR_HIGH {
+ Pos = MAP_APPFONT ( 212 , 10 );
+ Size = MAP_APPFONT ( 15 , 16 );
+ Hide = FALSE;
+ Fixed = Image {
+ ImageBitmap = Bitmap { File = "dsth_hig.bmp"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ };
+
+ FixedLine FL_VERTICAL
+ {
+ Pos = MAP_APPFONT ( 6 , 42 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Vertical" ;
+ };
+
+ RadioButton BTN_VER_NONE
+ {
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Size = MAP_APPFONT ( 46 , 10 ) ;
+ Text [ en-US ] = "N~one" ;
+ };
+
+ RadioButton BTN_VER_TOP
+ {
+ Pos = MAP_APPFONT ( 56 , 65 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "~Top" ;
+ };
+
+ RadioButton BTN_VER_CENTER
+ {
+ Pos = MAP_APPFONT ( 105 , 65 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "C~enter" ;
+ };
+
+ RadioButton BTN_VER_DISTANCE
+ {
+ Pos = MAP_APPFONT ( 154 , 65 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "S~pacing" ;
+ };
+
+ RadioButton BTN_VER_BOTTOM
+ {
+ Pos = MAP_APPFONT ( 203 , 65 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "~Bottom" ;
+ };
+
+ FixedImage IMG_VER_HIGH {
+ Pos = MAP_APPFONT ( 65 , 49 );
+ Size = MAP_APPFONT ( 15 , 16 );
+ Hide = FALSE;
+ Fixed = Image {
+ ImageBitmap = Bitmap { File = "dstv_hig.bmp"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ };
+
+ FixedImage IMG_VER_CENTER {
+ Pos = MAP_APPFONT ( 114 , 49 );
+ Size = MAP_APPFONT ( 15 , 16 );
+ Hide = FALSE;
+ Fixed = Image {
+ ImageBitmap = Bitmap { File = "dstv_cen.bmp"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ };
+
+ FixedImage IMG_VER_DISTANCE {
+ Pos = MAP_APPFONT ( 163 , 49 );
+ Size = MAP_APPFONT ( 15 , 16 );
+ Hide = FALSE;
+ Fixed = Image {
+ ImageBitmap = Bitmap { File = "dstv_dst.bmp"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ };
+
+ FixedImage IMG_VER_LOW {
+ Pos = MAP_APPFONT ( 212 , 49 );
+ Size = MAP_APPFONT ( 15 , 16 );
+ Hide = FALSE;
+ Fixed = Image {
+ ImageBitmap = Bitmap { File = "dstv_low.bmp"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ };
+
+
+ Image IMG_HOR_LOW_H
+ {
+ ImageBitmap = Bitmap { File = "dsth_low_h.bmp" ; };
+ MaskColor = STD_MASKCOLOR ;
+ };
+
+ Image IMG_HOR_DISTANCE_H
+ {
+ ImageBitmap = Bitmap { File = "dsth_dst_h.bmp" ; };
+ MaskColor = STD_MASKCOLOR ;
+ };
+
+ Image IMG_HOR_CENTER_H
+ {
+ ImageBitmap = Bitmap { File = "dsth_cen_h.bmp" ; };
+ MaskColor = STD_MASKCOLOR ;
+ };
+
+ Image IMG_HOR_HIGH_H
+ {
+ ImageBitmap = Bitmap { File = "dsth_hig_h.bmp" ; };
+ MaskColor = STD_MASKCOLOR ;
+ };
+
+ Image IMG_VER_HIGH_H
+ {
+ ImageBitmap = Bitmap { File = "dstv_hig_h.bmp" ; };
+ MaskColor = STD_MASKCOLOR ;
+ };
+
+ Image IMG_VER_CENTER_H
+ {
+ ImageBitmap = Bitmap { File = "dstv_cen_h.bmp" ; };
+ MaskColor = STD_MASKCOLOR ;
+ };
+
+ Image IMG_VER_DISTANCE_H
+ {
+ ImageBitmap = Bitmap { File = "dstv_dst_h.bmp" ; };
+ MaskColor = STD_MASKCOLOR ;
+ };
+
+ Image IMG_VER_LOW_H
+ {
+ ImageBitmap = Bitmap { File = "dstv_low_h.bmp" ; };
+ MaskColor = STD_MASKCOLOR ;
+ };
+
+};
+
+// ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
new file mode 100644
index 000000000000..4b3087c7a9b2
--- /dev/null
+++ b/cui/source/tabpages/grfpage.cxx
@@ -0,0 +1,838 @@
+/*************************************************************************
+ *
+ * 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: grfpage.cxx,v $
+ * $Revision: 1.20 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <tools/shl.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/sizeitem.hxx>
+#include <svx/brshitem.hxx>
+#include <grfpage.hxx>
+#include <svx/grfcrop.hxx>
+#include <grfpage.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+
+#define CM_1_TO_TWIP 567
+
+
+inline long lcl_GetValue( MetricField& rMetric, FieldUnit eUnit )
+{
+ return static_cast<long>(rMetric.Denormalize( rMetric.GetValue( eUnit )));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Grafik zuschneiden
+ --------------------------------------------------------------------*/
+
+SvxGrfCropPage::SvxGrfCropPage ( Window *pParent, const SfxItemSet &rSet )
+ : SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_GRFCROP ), rSet ),
+ aCropFL( this, SVX_RES( FL_CROP )),
+ aZoomConstRB( this, SVX_RES( RB_ZOOMCONST)),
+ aSizeConstRB( this, SVX_RES( RB_SIZECONST)),
+ aLeftFT( this, SVX_RES( FT_LEFT )),
+ aLeftMF( this, SVX_RES( MF_LEFT )),
+ aRightFT( this, SVX_RES( FT_RIGHT )),
+ aRightMF( this, SVX_RES( MF_RIGHT )),
+ aTopFT( this, SVX_RES( FT_TOP )),
+ aTopMF( this, SVX_RES( MF_TOP )),
+ aBottomFT( this, SVX_RES( FT_BOTTOM )),
+ aBottomMF( this, SVX_RES( MF_BOTTOM )),
+ aZoomFL( this, SVX_RES( FL_ZOOM )),
+ aWidthZoomFT( this, SVX_RES( FT_WIDTHZOOM )),
+ aWidthZoomMF( this, SVX_RES( MF_WIDTHZOOM )),
+ aHeightZoomFT( this, SVX_RES( FT_HEIGHTZOOM)),
+ aHeightZoomMF( this, SVX_RES( MF_HEIGHTZOOM)),
+ aSizeFL( this, SVX_RES( FL_SIZE )),
+ aWidthFT( this, SVX_RES( FT_WIDTH )),
+ aWidthMF( this, SVX_RES( MF_WIDTH )),
+ aHeightFT( this, SVX_RES( FT_HEIGHT )),
+ aHeightMF( this, SVX_RES( MF_HEIGHT )),
+ aOrigSizeFT( this, SVX_RES(FT_ORIG_SIZE)),
+ aOrigSizePB( this, SVX_RES( PB_ORGSIZE )),
+ aExampleWN( this, SVX_RES( WN_BSP )),
+ pLastCropField(0),
+ bInitialized(FALSE),
+ bSetOrigSize(FALSE)
+{
+ FreeResource();
+
+ SetExchangeSupport();
+
+ // set the correct metric
+ const FieldUnit eMetric = GetModuleFieldUnit( &rSet );
+
+ SetFieldUnit( aWidthMF, eMetric );
+ SetFieldUnit( aHeightMF, eMetric );
+ SetFieldUnit( aLeftMF, eMetric );
+ SetFieldUnit( aRightMF, eMetric );
+ SetFieldUnit( aTopMF , eMetric );
+ SetFieldUnit( aBottomMF, eMetric );
+
+ Link aLk = LINK(this, SvxGrfCropPage, SizeHdl);
+ aWidthMF.SetModifyHdl( aLk );
+ aHeightMF.SetModifyHdl( aLk );
+
+ aLk = LINK(this, SvxGrfCropPage, ZoomHdl);
+ aWidthZoomMF.SetModifyHdl( aLk );
+ aHeightZoomMF.SetModifyHdl( aLk );
+
+ aLk = LINK(this, SvxGrfCropPage, CropHdl);
+ aLeftMF.SetDownHdl( aLk );
+ aRightMF.SetDownHdl( aLk );
+ aTopMF.SetDownHdl( aLk );
+ aBottomMF.SetDownHdl( aLk );
+ aLeftMF.SetUpHdl( aLk );
+ aRightMF.SetUpHdl( aLk );
+ aTopMF.SetUpHdl( aLk );
+ aBottomMF.SetUpHdl( aLk );
+
+ aLk = LINK(this, SvxGrfCropPage, CropModifyHdl);
+ aLeftMF.SetModifyHdl( aLk );
+ aRightMF.SetModifyHdl( aLk );
+ aTopMF.SetModifyHdl( aLk );
+ aBottomMF.SetModifyHdl( aLk );
+
+ aLk = LINK(this, SvxGrfCropPage, CropLoseFocusHdl);
+ aLeftMF.SetLoseFocusHdl( aLk );
+ aRightMF.SetLoseFocusHdl( aLk );
+ aTopMF.SetLoseFocusHdl( aLk );
+ aBottomMF.SetLoseFocusHdl( aLk );
+
+ aLk = LINK(this, SvxGrfCropPage, OrigSizeHdl);
+ aOrigSizePB.SetClickHdl( aLk );
+
+ aTimer.SetTimeoutHdl(LINK(this, SvxGrfCropPage, Timeout));
+ aTimer.SetTimeout( 1500 );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SvxGrfCropPage::~SvxGrfCropPage()
+{
+ aTimer.Stop();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* SvxGrfCropPage::Create(Window *pParent, const SfxItemSet &rSet)
+{
+ return new SvxGrfCropPage( pParent, rSet );
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SvxGrfCropPage::Reset( const SfxItemSet &rSet )
+{
+ const SfxPoolItem* pItem;
+ const SfxItemPool& rPool = *rSet.GetPool();
+
+ if(SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich(
+ SID_ATTR_GRAF_KEEP_ZOOM ), TRUE, &pItem ))
+ {
+ if( ((const SfxBoolItem*)pItem)->GetValue() )
+ aZoomConstRB.Check();
+ else
+ aSizeConstRB.Check();
+ aZoomConstRB.SaveValue();
+ }
+
+ USHORT nW = rPool.GetWhich( SID_ATTR_GRAF_CROP );
+ if( SFX_ITEM_SET == rSet.GetItemState( nW, TRUE, &pItem))
+ {
+ FieldUnit eUnit = MapToFieldUnit( rSet.GetPool()->GetMetric( nW ));
+
+ SvxGrfCrop* pCrop = (SvxGrfCrop*)pItem;
+
+ aExampleWN.SetLeft( pCrop->GetLeft());
+ aExampleWN.SetRight( pCrop->GetRight());
+ aExampleWN.SetTop( pCrop->GetTop());
+ aExampleWN.SetBottom( pCrop->GetBottom());
+
+ aLeftMF.SetValue( aLeftMF.Normalize( pCrop->GetLeft()), eUnit );
+ aRightMF.SetValue( aRightMF.Normalize( pCrop->GetRight()), eUnit );
+ aTopMF.SetValue( aTopMF.Normalize( pCrop->GetTop()), eUnit );
+ aBottomMF.SetValue( aBottomMF.Normalize( pCrop->GetBottom()), eUnit );
+ }
+ else
+ {
+ aLeftMF.SetValue( 0 );
+ aRightMF.SetValue( 0 );
+ aTopMF.SetValue( 0 );
+ aBottomMF.SetValue( 0 );
+ }
+
+ nW = rPool.GetWhich( SID_ATTR_PAGE_SIZE );
+ if ( SFX_ITEM_SET == rSet.GetItemState( nW, FALSE, &pItem ) )
+ {
+ // Orientation und Size aus dem PageItem
+ FieldUnit eUnit = MapToFieldUnit( rSet.GetPool()->GetMetric( nW ));
+
+ aPageSize = ((const SvxSizeItem*)pItem)->GetSize();
+
+ sal_Int64 nTmp = aHeightMF.Normalize(aPageSize.Height());
+ aHeightMF.SetMax( nTmp, eUnit );
+ nTmp = aWidthMF.Normalize(aPageSize.Width());
+ aWidthMF.SetMax( nTmp, eUnit );
+ nTmp = aWidthMF.Normalize( 23 );
+ aHeightMF.SetMin( nTmp, eUnit );
+ aWidthMF.SetMin( nTmp, eUnit );
+ }
+ else
+ {
+ aPageSize = OutputDevice::LogicToLogic(
+ Size( CM_1_TO_TWIP, CM_1_TO_TWIP ),
+ MapMode( MAP_TWIP ),
+ MapMode( (MapUnit)rSet.GetPool()->GetMetric( nW ) ) );
+ }
+
+ BOOL bFound = FALSE;
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, FALSE, &pItem ) )
+ {
+ const Graphic* pGrf = ((SvxBrushItem*)pItem)->GetGraphic();
+ if( pGrf )
+ aOrigSize = GetGrfOrigSize( *pGrf );
+
+ if( aOrigSize.Width() && aOrigSize.Height() )
+ {
+ CalcMinMaxBorder();
+ aExampleWN.SetGraphic( *pGrf );
+ aExampleWN.SetFrameSize( aOrigSize );
+
+ bFound = TRUE;
+ if( ((SvxBrushItem*)pItem)->GetGraphicLink() )
+ aGraphicName = *((SvxBrushItem*)pItem)->GetGraphicLink();
+ }
+ }
+
+ GraphicHasChanged( bFound );
+ bReset = TRUE;
+ ActivatePage( rSet );
+ bReset = FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL SvxGrfCropPage::FillItemSet(SfxItemSet &rSet)
+{
+ const SfxItemPool& rPool = *rSet.GetPool();
+ BOOL bModified = FALSE;
+ if( aWidthMF.GetSavedValue() != aWidthMF.GetText() ||
+ aHeightMF.GetSavedValue() != aHeightMF.GetText() )
+ {
+ USHORT nW = rPool.GetWhich( SID_ATTR_GRAF_FRMSIZE );
+ FieldUnit eUnit = MapToFieldUnit( rSet.GetPool()->GetMetric( nW ));
+
+ SvxSizeItem aSz( nW );
+
+ // die Groesse koennte schon von einer anderen Page gesetzt worden sein
+ // #44204#
+ const SfxItemSet* pExSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL;
+ const SfxPoolItem* pItem = 0;
+ if( pExSet && SFX_ITEM_SET ==
+ pExSet->GetItemState( nW, FALSE, &pItem ) )
+ aSz = *(const SvxSizeItem*)pItem;
+ else
+ aSz = (const SvxSizeItem&)GetItemSet().Get( nW );
+
+ Size aTmpSz( aSz.GetSize() );
+ if( aWidthMF.GetText() != aWidthMF.GetSavedValue() )
+ aTmpSz.Width() = lcl_GetValue( aWidthMF, eUnit );
+ if( aHeightMF.GetText() != aHeightMF.GetSavedValue() )
+ aTmpSz.Height() = lcl_GetValue( aHeightMF, eUnit );
+ aSz.SetSize( aTmpSz );
+ aWidthMF.SaveValue();
+ aHeightMF.SaveValue();
+
+ bModified |= 0 != rSet.Put( aSz );
+
+ if( bSetOrigSize )
+ {
+ bModified |= 0 != rSet.Put( SvxSizeItem( rPool.GetWhich(
+ SID_ATTR_GRAF_FRMSIZE_PERCENT ), Size( 0, 0 )) );
+ }
+ }
+ if( aLeftMF.IsModified() || aRightMF.IsModified() ||
+ aTopMF.IsModified() || aBottomMF.IsModified() )
+ {
+ USHORT nW = rPool.GetWhich( SID_ATTR_GRAF_CROP );
+ FieldUnit eUnit = MapToFieldUnit( rSet.GetPool()->GetMetric( nW ));
+ SvxGrfCrop* pNew = (SvxGrfCrop*)rSet.Get( nW ).Clone();
+
+ pNew->SetLeft( lcl_GetValue( aLeftMF, eUnit ) );
+ pNew->SetRight( lcl_GetValue( aRightMF, eUnit ) );
+ pNew->SetTop( lcl_GetValue( aTopMF, eUnit ) );
+ pNew->SetBottom( lcl_GetValue( aBottomMF, eUnit ) );
+ bModified |= 0 != rSet.Put( *pNew );
+ delete pNew;
+ }
+
+ if( aZoomConstRB.GetSavedValue() != aZoomConstRB.IsChecked() )
+ {
+ bModified |= 0 != rSet.Put( SfxBoolItem( rPool.GetWhich(
+ SID_ATTR_GRAF_KEEP_ZOOM), aZoomConstRB.IsChecked() ) );
+ }
+
+ bInitialized = FALSE;
+
+ return bModified;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SvxGrfCropPage::ActivatePage(const SfxItemSet& rSet)
+{
+#ifdef DBG_UTIL
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+#endif
+
+ bSetOrigSize = FALSE;
+
+ // Size
+ Size aSize;
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_FRMSIZE, FALSE, &pItem ) )
+ aSize = ((const SvxSizeItem*)pItem)->GetSize();
+
+ nOldWidth = aSize.Width();
+ nOldHeight = aSize.Height();
+
+ sal_Int64 nWidth = aWidthMF.Normalize(nOldWidth);
+ sal_Int64 nHeight = aHeightMF.Normalize(nOldHeight);
+
+ if (nWidth != aWidthMF.GetValue(FUNIT_TWIP))
+ {
+ if(!bReset)
+ {
+ // Wert wurde von Umlauf-Tabpage geaendert und muss
+ // mit Modify-Flag gesetzt werden
+ aWidthMF.SetUserValue(nWidth, FUNIT_TWIP);
+ }
+ else
+ aWidthMF.SetValue(nWidth, FUNIT_TWIP);
+ }
+ aWidthMF.SaveValue();
+
+ if (nHeight != aHeightMF.GetValue(FUNIT_TWIP))
+ {
+ if (!bReset)
+ {
+ // Wert wurde von Umlauf-Tabpage geaendert und muss
+ // mit Modify-Flag gesetzt werden
+ aHeightMF.SetUserValue(nHeight, FUNIT_TWIP);
+ }
+ else
+ aHeightMF.SetValue(nHeight, FUNIT_TWIP);
+ }
+ aHeightMF.SaveValue();
+ bInitialized = TRUE;
+
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, FALSE, &pItem ) )
+ {
+ const SvxBrushItem& rBrush = *(SvxBrushItem*)pItem;
+ if( rBrush.GetGraphicLink() &&
+ aGraphicName != *rBrush.GetGraphicLink() )
+ aGraphicName = *rBrush.GetGraphicLink();
+
+ const Graphic* pGrf = rBrush.GetGraphic();
+ if( pGrf )
+ {
+ aExampleWN.SetGraphic( *pGrf );
+ aOrigSize = GetGrfOrigSize( *pGrf );
+ aExampleWN.SetFrameSize(aOrigSize);
+ GraphicHasChanged( aOrigSize.Width() && aOrigSize.Height() );
+ CalcMinMaxBorder();
+ }
+ else
+ GraphicHasChanged( FALSE );
+ }
+
+ CalcZoom();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+int SvxGrfCropPage::DeactivatePage(SfxItemSet *_pSet)
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Massstab geaendert, Groesse anpassen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxGrfCropPage, ZoomHdl, MetricField *, pField )
+{
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ SID_ATTR_GRAF_CROP ) ) );
+
+ if( pField == &aWidthZoomMF )
+ {
+ long nLRBorders = lcl_GetValue(aLeftMF, eUnit)
+ +lcl_GetValue(aRightMF, eUnit);
+ aWidthMF.SetValue( aWidthMF.Normalize(
+ ((aOrigSize.Width() - nLRBorders) * pField->GetValue())/100L),
+ eUnit);
+ }
+ else
+ {
+ long nULBorders = lcl_GetValue(aTopMF, eUnit)
+ +lcl_GetValue(aBottomMF, eUnit);
+ aHeightMF.SetValue( aHeightMF.Normalize(
+ ((aOrigSize.Height() - nULBorders ) * pField->GetValue())/100L) ,
+ eUnit );
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Groesse aendern, Massstab anpassen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxGrfCropPage, SizeHdl, MetricField *, pField )
+{
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ SID_ATTR_GRAF_CROP ) ) );
+
+ Size aSize( lcl_GetValue(aWidthMF, eUnit),
+ lcl_GetValue(aHeightMF, eUnit) );
+
+ if(pField == &aWidthMF)
+ {
+ long nWidth = aOrigSize.Width() -
+ ( lcl_GetValue(aLeftMF, eUnit) +
+ lcl_GetValue(aRightMF, eUnit) );
+ if(!nWidth)
+ nWidth++;
+ USHORT nZoom = (USHORT)( aSize.Width() * 100L / nWidth);
+ aWidthZoomMF.SetValue(nZoom);
+ }
+ else
+ {
+ long nHeight = aOrigSize.Height() -
+ ( lcl_GetValue(aTopMF, eUnit) +
+ lcl_GetValue(aBottomMF, eUnit));
+ if(!nHeight)
+ nHeight++;
+ USHORT nZoom = (USHORT)( aSize.Height() * 100L/ nHeight);
+ aHeightZoomMF.SetValue(nZoom);
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Raender auswerten
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxGrfCropPage, CropHdl, const MetricField *, pField )
+{
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ SID_ATTR_GRAF_CROP ) ) );
+
+ BOOL bZoom = aZoomConstRB.IsChecked();
+ if( pField == &aLeftMF || pField == &aRightMF )
+ {
+ long nLeft = lcl_GetValue( aLeftMF, eUnit );
+ long nRight = lcl_GetValue( aRightMF, eUnit );
+ long nWidthZoom = static_cast<long>(aWidthZoomMF.GetValue());
+ if(bZoom && ( ( ( aOrigSize.Width() - (nLeft + nRight )) * nWidthZoom )
+ / 100 >= aPageSize.Width() ) )
+ {
+ if(pField == &aLeftMF)
+ {
+// nLeft = aPageSize.Width() -
+// ((nRight + aOrigSize.Width()) * nWidthZoom) / 100;
+ nLeft = aOrigSize.Width() -
+ ( aPageSize.Width() * 100 / nWidthZoom + nRight );
+ aLeftMF.SetValue( aLeftMF.Normalize( nLeft ), eUnit );
+ }
+ else
+ {
+// nRight = aPageSize.Width() -
+// ((nLeft - aOrigSize.Width()) * nWidthZoom) / 100;
+ nRight = aOrigSize.Width() -
+ ( aPageSize.Width() * 100 / nWidthZoom + nLeft );
+ aRightMF.SetValue( aRightMF.Normalize( nRight ), eUnit );
+ }
+ }
+ aExampleWN.SetLeft(nLeft);
+ aExampleWN.SetRight(nRight);
+ if(bZoom)
+ {
+ //Massstab bleibt -> Breite neu berechnen
+ ZoomHdl(&aWidthZoomMF);
+ }
+ }
+ else
+ {
+ long nTop = lcl_GetValue( aTopMF, eUnit );
+ long nBottom = lcl_GetValue( aBottomMF, eUnit );
+ long nHeightZoom = static_cast<long>(aHeightZoomMF.GetValue());
+ if(bZoom && ( ( ( aOrigSize.Height() - (nTop + nBottom )) * nHeightZoom)
+ / 100 >= aPageSize.Height()))
+ {
+ if(pField == &aTopMF)
+ {
+// nTop = aPageSize.Height() -
+// ((aOrigSize.Height() - nBottom) * nHeightZoom)/ 100;
+ nTop = aOrigSize.Height() -
+ ( aPageSize.Height() * 100 / nHeightZoom + nBottom);
+ aTopMF.SetValue( aWidthMF.Normalize( nTop ), eUnit );
+ }
+ else
+ {
+// nBottom = aPageSize.Height() -
+// ((aOrigSize.Height() - nTop)*nHeightZoom) / 100;
+ nBottom = aOrigSize.Height() -
+ ( aPageSize.Height() * 100 / nHeightZoom + nTop);
+ aBottomMF.SetValue( aWidthMF.Normalize( nBottom ), eUnit );
+ }
+ }
+ aExampleWN.SetTop( nTop );
+ aExampleWN.SetBottom( nBottom );
+ if(bZoom)
+ {
+ //Massstab bleibt -> Hoehe neu berechnen
+ ZoomHdl(&aHeightZoomMF);
+ }
+ }
+ aExampleWN.Invalidate();
+ //Groesse und Raender veraendert -> Massstab neu berechnen
+ if(!bZoom)
+ CalcZoom();
+ CalcMinMaxBorder();
+ return 0;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Originalgroesse einstellen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxGrfCropPage, OrigSizeHdl, PushButton *, EMPTYARG )
+{
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ SID_ATTR_GRAF_CROP ) ) );
+
+ long nWidth = aOrigSize.Width() -
+ lcl_GetValue( aLeftMF, eUnit ) -
+ lcl_GetValue( aRightMF, eUnit );
+ aWidthMF.SetValue( aWidthMF.Normalize( nWidth ), eUnit );
+ long nHeight = aOrigSize.Height() -
+ lcl_GetValue( aTopMF, eUnit ) -
+ lcl_GetValue( aBottomMF, eUnit );
+ aHeightMF.SetValue( aHeightMF.Normalize( nHeight ), eUnit );
+ aWidthZoomMF.SetValue(100);
+ aHeightZoomMF.SetValue(100);
+ bSetOrigSize = TRUE;
+ return 0;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Massstab berechnen
+ --------------------------------------------------------------------*/
+
+void SvxGrfCropPage::CalcZoom()
+{
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ SID_ATTR_GRAF_CROP ) ) );
+
+ long nWidth = lcl_GetValue( aWidthMF, eUnit );
+ long nHeight = lcl_GetValue( aHeightMF, eUnit );
+ long nLRBorders = lcl_GetValue( aLeftMF, eUnit ) +
+ lcl_GetValue( aRightMF, eUnit );
+ long nULBorders = lcl_GetValue( aTopMF, eUnit ) +
+ lcl_GetValue( aBottomMF, eUnit );
+ USHORT nZoom = 0;
+ long nDen;
+ if( (nDen = aOrigSize.Width() - nLRBorders) > 0)
+ nZoom = (USHORT)((( nWidth * 1000L / nDen )+5)/10);
+ aWidthZoomMF.SetValue(nZoom);
+ if( (nDen = aOrigSize.Height() - nULBorders) > 0)
+ nZoom = (USHORT)((( nHeight * 1000L / nDen )+5)/10);
+ else
+ nZoom = 0;
+ aHeightZoomMF.SetValue(nZoom);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Minimal-/Maximalwerte fuer die Raender setzen
+ --------------------------------------------------------------------*/
+
+void SvxGrfCropPage::CalcMinMaxBorder()
+{
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ SID_ATTR_GRAF_CROP ) ) );
+ long nR = lcl_GetValue(aRightMF, eUnit );
+ long nMinWidth = (aOrigSize.Width() * 10) /11;
+ long nMin = nMinWidth - (nR >= 0 ? nR : 0);
+ aLeftMF.SetMax( aLeftMF.Normalize(nMin), eUnit );
+
+ long nL = lcl_GetValue(aLeftMF, eUnit );
+ nMin = nMinWidth - (nL >= 0 ? nL : 0);
+ aRightMF.SetMax( aRightMF.Normalize(nMin), eUnit );
+
+ // Zoom nicht unter 2%
+/* nMin = (aOrigSize.Width() * 102) /100;
+ aLeftMF.SetMax(aPageSize.Width() - nR - nMin);
+ aRightMF.SetMax(aPageSize.Width() - nL - nMin);
+*/
+ long nUp = lcl_GetValue( aTopMF, eUnit );
+ long nMinHeight = (aOrigSize.Height() * 10) /11;
+ nMin = nMinHeight - (nUp >= 0 ? nUp : 0);
+ aBottomMF.SetMax( aBottomMF.Normalize(nMin), eUnit );
+
+ long nLow = lcl_GetValue(aBottomMF, eUnit );
+ nMin = nMinHeight - (nLow >= 0 ? nLow : 0);
+ aTopMF.SetMax( aTopMF.Normalize(nMin), eUnit );
+
+ // Zoom nicht unter 2%
+/* nMin = (aOrigSize.Height() * 102) /100;
+ aTopMF.SetMax(aPageSize.Height() - nLow - nMin);
+ aBottomMF.SetMax(aPageSize.Height() - nUp - nMin);*/
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Spinsize auf 1/20 der Originalgroesse setzen,
+ FixedText mit der Originalgroesse fuellen
+ --------------------------------------------------------------------*/
+
+void SvxGrfCropPage::GraphicHasChanged( BOOL bFound )
+{
+ if( bFound )
+ {
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ SID_ATTR_GRAF_CROP ) ));
+
+ sal_Int64 nSpin = aLeftMF.Normalize(aOrigSize.Width()) / 20;
+ nSpin = MetricField::ConvertValue( nSpin, aOrigSize.Width(), 0,
+ eUnit, aLeftMF.GetUnit());
+
+ // Ist der Rand zu gross, wird er auf beiden Seiten auf 1/3 eingestellt.
+ long nR = lcl_GetValue( aRightMF, eUnit );
+ long nL = lcl_GetValue( aLeftMF, eUnit );
+ if((nL + nR) < - aOrigSize.Width())
+ {
+ long nVal = aOrigSize.Width() / -3;
+ aRightMF.SetValue( aRightMF.Normalize( nVal ), eUnit );
+ aLeftMF.SetValue( aLeftMF.Normalize( nVal ), eUnit );
+ aExampleWN.SetLeft(nVal);
+ aExampleWN.SetRight(nVal);
+ }
+ long nUp = lcl_GetValue(aTopMF, eUnit );
+ long nLow = lcl_GetValue(aBottomMF, eUnit );
+ if((nUp + nLow) < - aOrigSize.Height())
+ {
+ long nVal = aOrigSize.Height() / -3;
+ aTopMF.SetValue( aTopMF.Normalize( nVal ), eUnit );
+ aBottomMF.SetValue( aBottomMF.Normalize( nVal ), eUnit );
+ aExampleWN.SetTop(nVal);
+ aExampleWN.SetBottom(nVal);
+ }
+
+ aLeftMF.SetSpinSize(nSpin);
+ aRightMF.SetSpinSize(nSpin);
+ nSpin = aTopMF.Normalize(aOrigSize.Height()) / 20;
+ nSpin = MetricField::ConvertValue( nSpin, aOrigSize.Width(), 0,
+ eUnit, aLeftMF.GetUnit() );
+ aTopMF.SetSpinSize(nSpin);
+ aBottomMF.SetSpinSize(nSpin);
+
+ //Originalgroesse anzeigen
+ const FieldUnit eMetric = GetModuleFieldUnit( &GetItemSet() );
+
+ MetricField aFld(this, WB_HIDE);
+ SetFieldUnit( aFld, eMetric );
+ aFld.SetDecimalDigits( aWidthMF.GetDecimalDigits() );
+ aFld.SetMax( LONG_MAX - 1 );
+
+ aFld.SetValue( aFld.Normalize( aOrigSize.Width() ), eUnit );
+ String sTemp = aFld.GetText();
+ aFld.SetValue( aFld.Normalize( aOrigSize.Height() ), eUnit );
+ sTemp += UniString::CreateFromAscii(" x ");
+ sTemp += aFld.GetText();
+ aOrigSizeFT.SetText(sTemp);
+ }
+ aLeftFT .Enable(bFound);
+ aLeftMF .Enable(bFound);
+ aRightFT .Enable(bFound);
+ aRightMF .Enable(bFound);
+ aTopFT .Enable(bFound);
+ aTopMF .Enable(bFound);
+ aBottomFT .Enable(bFound);
+ aBottomMF .Enable(bFound);
+ aSizeConstRB .Enable(bFound);
+ aZoomConstRB .Enable(bFound);
+ aWidthFT .Enable(bFound);
+ aWidthMF .Enable(bFound);
+ aHeightFT .Enable(bFound);
+ aHeightMF .Enable(bFound);
+ aWidthZoomFT .Enable(bFound);
+ aWidthZoomMF .Enable(bFound);
+ aHeightZoomFT .Enable(bFound);
+ aHeightZoomMF .Enable(bFound);
+ aExampleWN .Enable(bFound);
+ aOrigSizePB .Enable(bFound);
+ aOrigSizeFT .Enable(bFound);
+}
+
+IMPL_LINK( SvxGrfCropPage, Timeout, Timer *, EMPTYARG )
+{
+ DBG_ASSERT(pLastCropField,"Timeout ohne Feld?");
+ CropHdl(pLastCropField);
+ pLastCropField = 0;
+ return 0;
+}
+
+
+IMPL_LINK( SvxGrfCropPage, CropLoseFocusHdl, MetricField*, pField )
+{
+ aTimer.Stop();
+ CropHdl(pField);
+ pLastCropField = 0;
+ return 0;
+}
+
+
+IMPL_LINK( SvxGrfCropPage, CropModifyHdl, MetricField *, pField )
+{
+ aTimer.Start();
+ pLastCropField = pField;
+ return 0;
+}
+
+Size SvxGrfCropPage::GetGrfOrigSize( const Graphic& rGrf ) const
+{
+ const MapMode aMapTwip( MAP_TWIP );
+ Size aSize( rGrf.GetPrefSize() );
+ if( MAP_PIXEL == rGrf.GetPrefMapMode().GetMapUnit() )
+ aSize = PixelToLogic( aSize, aMapTwip );
+ else
+ aSize = OutputDevice::LogicToLogic( aSize,
+ rGrf.GetPrefMapMode(), aMapTwip );
+ return aSize;
+}
+
+/*****************************************************************/
+
+SvxGrfCropPage::SvxCropExample::SvxCropExample( Window* pPar,
+ const ResId& rResId )
+ : Window( pPar, rResId ),
+ aFrameSize( OutputDevice::LogicToLogic(
+ Size( CM_1_TO_TWIP / 2, CM_1_TO_TWIP / 2 ),
+ MapMode( MAP_TWIP ), GetMapMode() )),
+ aTopLeft(0,0), aBottomRight(0,0)
+{
+ SetBorderStyle( WINDOW_BORDER_MONO );
+}
+
+void SvxGrfCropPage::SvxCropExample::Paint( const Rectangle& )
+{
+ Size aWinSize( PixelToLogic(GetOutputSizePixel() ));
+ SetLineColor();
+ SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() );
+ SetRasterOp( ROP_OVERPAINT );
+ DrawRect( Rectangle( Point(), aWinSize ) );
+
+ SetLineColor( Color( COL_WHITE ) );
+ Rectangle aRect(Point((aWinSize.Width() - aFrameSize.Width())/2,
+ (aWinSize.Height() - aFrameSize.Height())/2),
+ aFrameSize );
+ aGrf.Draw( this, aRect.TopLeft(), aRect.GetSize() );
+
+ Size aSz( 2, 0 );
+ aSz = PixelToLogic( aSz );
+ SetFillColor( Color( COL_TRANSPARENT ) );
+ SetRasterOp( ROP_INVERT );
+ aRect.Left() += aTopLeft.Y();
+ aRect.Top() += aTopLeft.X();
+ aRect.Right() -= aBottomRight.Y();
+ aRect.Bottom() -= aBottomRight.X();
+ DrawRect( aRect );
+}
+
+void SvxGrfCropPage::SvxCropExample::SetFrameSize( const Size& rSz )
+{
+ aFrameSize = rSz;
+ if(!aFrameSize.Width())
+ aFrameSize.Width() = 1;
+ if(!aFrameSize.Height())
+ aFrameSize.Height() = 1;
+ Size aWinSize( GetOutputSizePixel() );
+ Fraction aXScale( aWinSize.Width() * 4, aFrameSize.Width() * 5 );
+ Fraction aYScale( aWinSize.Height() * 4, aFrameSize.Height() * 5 );
+
+ if( aYScale < aXScale )
+ aXScale = aYScale;
+
+ MapMode aMapMode( GetMapMode() );
+
+ aMapMode.SetScaleX( aXScale );
+ aMapMode.SetScaleY( aXScale );
+
+ SetMapMode( aMapMode );
+ Invalidate();
+}
+
+
+
+
diff --git a/cui/source/tabpages/grfpage.hrc b/cui/source/tabpages/grfpage.hrc
new file mode 100644
index 000000000000..5743645f3eb0
--- /dev/null
+++ b/cui/source/tabpages/grfpage.hrc
@@ -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: grfpage.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FT_BOTTOM 1
+#define FT_HEIGHT 2
+#define FT_HEIGHTZOOM 3
+#define FT_LEFT 4
+#define FT_ORIG_SIZE 5
+#define FT_RIGHT 6
+#define FT_TOP 7
+#define FT_WIDTH 8
+#define FT_WIDTHZOOM 9
+#define FL_CROP 10
+#define FL_SIZE 12
+#define FL_ZOOM 13
+#define MF_BOTTOM 14
+#define MF_HEIGHT 15
+#define MF_HEIGHTZOOM 16
+#define MF_LEFT 17
+#define MF_RIGHT 18
+#define MF_TOP 19
+#define MF_WIDTH 20
+#define MF_WIDTHZOOM 21
+#define PB_ORGSIZE 22
+#define RB_SIZECONST 23
+#define RB_ZOOMCONST 24
+#define WN_BSP 25
+
+
diff --git a/cui/source/tabpages/grfpage.src b/cui/source/tabpages/grfpage.src
new file mode 100644
index 000000000000..0d6791fd917d
--- /dev/null
+++ b/cui/source/tabpages/grfpage.src
@@ -0,0 +1,334 @@
+/*************************************************************************
+ *
+ * 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: grfpage.src,v $
+ * $Revision: 1.30 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "helpid.hrc"
+#include "grfpage.hrc"
+
+/************************************************************/
+/* */
+/* */
+/* Crop-Page */
+/* */
+/* */
+/************************************************************/
+TabPage RID_SVXPAGE_GRFCROP
+{
+ Hide = TRUE ;
+ HelpID = HID_SVXPAGE_GRFCROP;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_CROP
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text [ en-US ] = "Crop" ;
+ };
+ FixedText FT_LEFT
+ {
+ Pos = MAP_APPFONT ( 12 , 44 ) ;
+ Size = MAP_APPFONT ( 28 , 8 ) ;
+ Text [ en-US ] = "~Left" ;
+ };
+ MetricField MF_LEFT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 42 , 42 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Text = "12,99" ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -9999 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_RIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 60 ) ;
+ Size = MAP_APPFONT ( 28 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Right" ;
+ };
+ MetricField MF_RIGHT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 42 , 58 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -9999 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_TOP
+ {
+ Pos = MAP_APPFONT ( 94 , 44 ) ;
+ Size = MAP_APPFONT ( 28 , 8 ) ;
+ Text [ en-US ] = "~Top" ;
+ };
+ MetricField MF_TOP
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 42 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Text = "12,99" ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -9999 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_BOTTOM
+ {
+ Pos = MAP_APPFONT ( 94 , 60 ) ;
+ Size = MAP_APPFONT ( 28 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Bottom" ;
+ };
+ MetricField MF_BOTTOM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 58 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -9999 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ RadioButton RB_SIZECONST
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "Keep image si~ze" ;
+ };
+ RadioButton RB_ZOOMCONST
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Check = TRUE ;
+ Text [ en-US ] = "Keep ~scale" ;
+ };
+ Window WN_BSP
+ {
+ Pos = MAP_APPFONT ( 176 , 6 ) ;
+ Size = MAP_APPFONT ( 78 , 78 ) ;
+ Border = TRUE ;
+ };
+ FixedLine FL_ZOOM
+ {
+ Pos = MAP_APPFONT ( 6, 76 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text [ en-US ] = "Scale" ;
+ };
+ FixedText FT_WIDTHZOOM
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 89 ) ;
+ Size = MAP_APPFONT ( 28 , 8 ) ;
+ Text [ en-US ] = "~Width" ;
+ };
+ MetricField MF_WIDTHZOOM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 42 , 87 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Text = "12,99" ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 9999 ;
+ First = 5 ;
+ Last = 1000 ;
+ Maximum = 9999 ;
+ Value = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_HEIGHTZOOM
+ {
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 28 , 8 ) ;
+ Text [ en-US ] = "H~eight" ;
+ Left = TRUE ;
+ };
+ MetricField MF_HEIGHTZOOM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 42 , 103 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 9999 ;
+ First = 5 ;
+ Last = 1000 ;
+ Maximum = 9999 ;
+ Value = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ SpinSize = 10 ;
+ };
+ FixedLine FL_SIZE
+ {
+ Pos = MAP_APPFONT ( 6 , 121 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text [ en-US ] = "Image size" ;
+ };
+ FixedText FT_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 134 ) ;
+ Size = MAP_APPFONT ( 28 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Width" ;
+ };
+ MetricField MF_WIDTH
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 42 , 132 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Text = "12,99" ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 5 ;
+ Maximum = 20000 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 5 ;
+ Last = 20000 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 150 ) ;
+ Size = MAP_APPFONT ( 28 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "H~eight" ;
+ };
+ MetricField MF_HEIGHT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 42 , 148 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 5 ;
+ Maximum = 20000 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 5 ;
+ Last = 20000 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_ORIG_SIZE
+ {
+ Pos = MAP_APPFONT ( 176 , 132 ) ;
+ Size = MAP_APPFONT ( 74 , 8 ) ;
+ };
+ PushButton PB_ORGSIZE
+ {
+ Pos = MAP_APPFONT ( 176 , 143 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Original Size" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx
new file mode 100644
index 000000000000..259e32a5aaae
--- /dev/null
+++ b/cui/source/tabpages/labdlg.cxx
@@ -0,0 +1,653 @@
+/*************************************************************************
+ *
+ * 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: labdlg.cxx,v $
+ * $Revision: 1.19 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <swpossizetabpage.hxx>
+
+#define _SVX_LABDLG_CXX
+
+#include <svx/svdattrx.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include "transfrm.hxx"
+
+#include "labdlg.hrc"
+#include "labdlg.hxx"
+
+// define ----------------------------------------------------------------
+
+#define AZ_OPTIMAL 0
+#define AZ_VON_OBEN 1
+#define AZ_VON_LINKS 2
+#define AZ_HORIZONTAL 3
+#define AZ_VERTIKAL 4
+
+#define AT_OBEN 0
+#define AT_MITTE 1
+#define AT_UNTEN 2
+
+#define WK_OPTIMAL 0
+#define WK_30 1
+#define WK_45 2
+#define WK_60 3
+#define WK_90 4
+
+// static ----------------------------------------------------------------
+
+static USHORT pCaptionRanges[] =
+{
+ SDRATTR_CAPTIONTYPE,
+ SDRATTR_CAPTIONFIXEDANGLE,
+ SDRATTR_CAPTIONANGLE,
+ SDRATTR_CAPTIONGAP,
+ SDRATTR_CAPTIONESCDIR,
+ SDRATTR_CAPTIONESCISREL,
+ SDRATTR_CAPTIONESCREL,
+ SDRATTR_CAPTIONESCABS,
+ SDRATTR_CAPTIONLINELEN,
+ SDRATTR_CAPTIONFITLINELEN,
+ 0
+};
+
+// -----------------------------------------------------------------------
+
+SvxCaptionTabPage::SvxCaptionTabPage(Window* pParent, const SfxItemSet& rInAttrs)
+ : SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_CAPTION ), rInAttrs ),
+
+ aCT_CAPTTYPE( this, SVX_RES( CT_CAPTTYPE ) ),
+ aFT_ABSTAND( this, SVX_RES( FT_ABSTAND ) ),
+ aMF_ABSTAND( this, SVX_RES( MF_ABSTAND ) ),
+ aFT_WINKEL( this, SVX_RES( FT_WINKEL ) ),
+ aLB_WINKEL( this, SVX_RES( LB_WINKEL ) ),
+ aFT_ANSATZ( this, SVX_RES( FT_ANSATZ ) ),
+ aLB_ANSATZ( this, SVX_RES( LB_ANSATZ ) ),
+ aFT_UM( this, SVX_RES( FT_UM ) ),
+ aMF_ANSATZ( this, SVX_RES( MF_ANSATZ ) ),
+ aFT_ANSATZ_REL( this, SVX_RES( FT_ANSATZ_REL ) ),
+ aLB_ANSATZ_REL( this, SVX_RES( LB_ANSATZ_REL ) ),
+ aFT_LAENGE( this, SVX_RES( FT_LAENGE ) ),
+ aMF_LAENGE( this, SVX_RES( MF_LAENGE ) ),
+ aCB_LAENGE( this, SVX_RES( CB_LAENGE ) ),
+
+ aStrHorzList( SVX_RES(STR_HORZ_LIST) ),
+ aStrVertList( SVX_RES(STR_VERT_LIST) ),
+
+ rOutAttrs ( rInAttrs )
+{
+ //------------NYI-------------------------------------------
+ aFT_WINKEL.Hide();
+ aLB_WINKEL.Hide();
+
+ //------------Positionen korrigieren-------------------------
+ aFT_ANSATZ_REL.SetPosPixel( aFT_UM.GetPosPixel() );
+ aLB_ANSATZ_REL.SetPosPixel(
+ Point(
+ aFT_ANSATZ_REL.GetPosPixel().X()+aFT_ANSATZ_REL.GetSizePixel().Width()+6,
+ aLB_ANSATZ.GetPosPixel().Y() )
+ );
+
+ aMF_ANSATZ.SetPosPixel(
+ Point(
+ aFT_UM.GetPosPixel().X()+aFT_UM.GetSizePixel().Width()+6,
+ aLB_ANSATZ.GetPosPixel().Y() )
+ );
+
+ sal_uInt16 nBitmap;
+ for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ )
+ {
+ mpBmpCapTypes[nBitmap] = new Image(Bitmap(SVX_RES(BMP_CAPTTYPE_1 + nBitmap)), COL_LIGHTMAGENTA );
+ mpBmpCapTypesH[nBitmap] = new Image(Bitmap(SVX_RES(BMP_CAPTTYPE_1_H + nBitmap)), COL_LIGHTMAGENTA );
+ }
+
+ //------------ValueSet installieren--------------------------
+ aCT_CAPTTYPE.SetStyle( aCT_CAPTTYPE.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD );
+ aCT_CAPTTYPE.SetColCount(5);//XXX
+ aCT_CAPTTYPE.SetLineCount(1);
+ aCT_CAPTTYPE.SetSelectHdl(LINK( this, SvxCaptionTabPage, SelectCaptTypeHdl_Impl));
+
+ Image aImage;
+ aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_1, aImage, String(SVX_RES(STR_CAPTTYPE_1)));
+ aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_2, aImage, String(SVX_RES(STR_CAPTTYPE_2)));
+ aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_3, aImage, String(SVX_RES(STR_CAPTTYPE_3)));
+
+ FillValueSet();
+
+ aLB_ANSATZ.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzSelectHdl_Impl));
+ aLB_ANSATZ_REL.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzRelSelectHdl_Impl));
+ aCB_LAENGE.SetClickHdl(LINK(this,SvxCaptionTabPage,LineOptHdl_Impl));
+
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SvxCaptionTabPage::~SvxCaptionTabPage()
+{
+ sal_uInt16 nBitmap;
+ for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ )
+ {
+ delete mpBmpCapTypes[nBitmap];
+ delete mpBmpCapTypesH[nBitmap];
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCaptionTabPage::Construct()
+{
+ // Setzen des Rechtecks und der Workingarea
+ DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxCaptionTabPage::FillItemSet( SfxItemSet& _rOutAttrs)
+{
+ SfxItemPool* pPool = _rOutAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+
+ SfxMapUnit eUnit;
+
+ nCaptionType = aCT_CAPTTYPE.GetSelectItemId()-1;
+
+ _rOutAttrs.Put( SdrCaptionTypeItem( (SdrCaptionType) nCaptionType ) );
+
+ if( aMF_ABSTAND.IsValueModified() )
+ {
+ eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONGAP ) );
+ _rOutAttrs.Put( SdrCaptionGapItem( GetCoreValue(aMF_ABSTAND, eUnit ) ) );
+ }
+
+ // Sonderbehandlung!!! XXX
+ if( nCaptionType==SDRCAPT_TYPE1 )
+ {
+ switch( nEscDir )
+ {
+ case SDRCAPT_ESCHORIZONTAL: nEscDir=SDRCAPT_ESCVERTICAL;break;
+ case SDRCAPT_ESCVERTICAL: nEscDir=SDRCAPT_ESCHORIZONTAL;break;
+ }
+ }
+
+ _rOutAttrs.Put( SdrCaptionEscDirItem( (SdrCaptionEscDir)nEscDir ) );
+
+ bEscRel = aLB_ANSATZ_REL.IsVisible();
+ _rOutAttrs.Put( SdrCaptionEscIsRelItem( bEscRel ) );
+
+ if( bEscRel )
+ {
+ long nVal = 0;
+
+ switch( aLB_ANSATZ_REL.GetSelectEntryPos() )
+ {
+ case AT_OBEN: nVal=0;break;
+ case AT_MITTE: nVal=5000;break;
+ case AT_UNTEN: nVal=10000;break;
+ }
+ _rOutAttrs.Put( SdrCaptionEscRelItem( nVal ) );
+ }
+ else
+ {
+ if( aMF_ANSATZ.IsValueModified() )
+ {
+ eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONESCABS ) );
+ _rOutAttrs.Put( SdrCaptionEscAbsItem( GetCoreValue(aMF_ANSATZ, eUnit ) ) );
+ }
+ }
+
+ bFitLineLen = aCB_LAENGE.IsChecked();
+ _rOutAttrs.Put( SdrCaptionFitLineLenItem( bFitLineLen ) );
+
+ if( ! bFitLineLen )
+ {
+ if( aMF_LAENGE.IsValueModified() )
+ {
+ eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONLINELEN ) );
+ _rOutAttrs.Put( SdrCaptionLineLenItem( GetCoreValue(aMF_LAENGE, eUnit ) ) );
+ }
+ }
+
+//NYI-------------die Winkel muessen noch hier rein!!! XXX----------------------
+
+ return( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCaptionTabPage::Reset( const SfxItemSet& )
+{
+
+ //------------Metrik einstellen-----------------------------
+
+ FieldUnit eFUnit = GetModuleFieldUnit( &rOutAttrs );
+
+ switch ( eFUnit )
+ {
+ case FUNIT_CM:
+ case FUNIT_M:
+ case FUNIT_KM:
+ eFUnit = FUNIT_MM;
+ break;
+ default: ;//prevent warning
+ }
+ SetFieldUnit( aMF_ABSTAND, eFUnit );
+ SetFieldUnit( aMF_ANSATZ, eFUnit );
+ SetFieldUnit( aMF_LAENGE, eFUnit );
+
+ SfxItemPool* pPool = rOutAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+
+ USHORT nWhich;
+ SfxMapUnit eUnit;
+
+ //------- Winkel ----------
+ nWhich = GetWhich( SDRATTR_CAPTIONANGLE );
+ nFixedAngle = ( ( const SdrCaptionAngleItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
+
+ //------- absolute Ansatzentfernung ----------
+ nWhich = GetWhich( SDRATTR_CAPTIONESCABS );
+ eUnit = pPool->GetMetric( nWhich );
+ nEscAbs = ( ( const SdrCaptionEscAbsItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
+ SetMetricValue( aMF_ANSATZ, nEscAbs, eUnit );
+ nEscAbs = static_cast<long>(aMF_ANSATZ.GetValue());
+
+ //------- relative Ansatzentfernung ----------
+ nWhich = GetWhich( SDRATTR_CAPTIONESCREL );
+ nEscRel = (long)( ( const SdrCaptionEscRelItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
+
+ //------- Linienlaenge ----------
+ nWhich = GetWhich( SDRATTR_CAPTIONLINELEN );
+ eUnit = pPool->GetMetric( nWhich );
+ nLineLen = ( ( const SdrCaptionLineLenItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
+ SetMetricValue( aMF_LAENGE, nLineLen, eUnit );
+ nLineLen = static_cast<long>(aMF_LAENGE.GetValue());
+
+ //------- Abstand zur Box ----------
+ nWhich = GetWhich( SDRATTR_CAPTIONGAP );
+ eUnit = pPool->GetMetric( nWhich );
+ nGap = ( ( const SdrCaptionGapItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
+ SetMetricValue( aMF_ABSTAND, nGap, eUnit );
+ nGap = static_cast<long>(aMF_ABSTAND.GetValue());
+
+ nCaptionType = (short)( ( const SdrCaptionTypeItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue();
+ bFixedAngle = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFIXEDANGLE ) ) ).GetValue();
+ bFitLineLen = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue();
+ nEscDir = (short)( ( const SdrCaptionEscDirItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ) ).GetValue();
+ bEscRel = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCISREL ) ) ).GetValue();
+
+ // Sonderbehandlung!!! XXX
+ if( nCaptionType==SDRCAPT_TYPE1 )
+ {
+ switch( nEscDir )
+ {
+ case SDRCAPT_ESCHORIZONTAL: nEscDir=SDRCAPT_ESCVERTICAL;break;
+ case SDRCAPT_ESCVERTICAL: nEscDir=SDRCAPT_ESCHORIZONTAL;break;
+ }
+ }
+
+ nAnsatzRelPos=AT_MITTE;
+ nAnsatzTypePos=AZ_OPTIMAL;
+ nWinkelTypePos=WK_OPTIMAL;
+
+ aMF_ABSTAND.SetValue( nGap );
+
+ if( nEscDir == SDRCAPT_ESCHORIZONTAL )
+ {
+ if( bEscRel )
+ {
+ if( nEscRel < 3333 )
+ nAnsatzRelPos = AT_OBEN;
+ if( nEscRel > 6666 )
+ nAnsatzRelPos = AT_UNTEN;
+ nAnsatzTypePos = AZ_HORIZONTAL;
+ }
+ else
+ {
+ nAnsatzTypePos = AZ_VON_OBEN;
+ aMF_ANSATZ.SetValue( nEscAbs );
+ }
+ }
+ else if( nEscDir == SDRCAPT_ESCVERTICAL )
+ {
+ if( bEscRel )
+ {
+ if( nEscRel < 3333 )
+ nAnsatzRelPos = AT_OBEN;
+ if( nEscRel > 6666 )
+ nAnsatzRelPos = AT_UNTEN;
+ nAnsatzTypePos = AZ_VERTIKAL;
+ }
+ else
+ {
+ nAnsatzTypePos = AZ_VON_LINKS;
+ aMF_ANSATZ.SetValue( nEscAbs );
+ }
+ }
+ else if( nEscDir == SDRCAPT_ESCBESTFIT )
+ {
+ nAnsatzTypePos = AZ_OPTIMAL;
+ }
+
+ if( bFixedAngle )
+ {
+ if( nFixedAngle <= 3000 )
+ nWinkelTypePos=WK_30;
+ else if( nFixedAngle <= 4500 )
+ nWinkelTypePos=WK_45;
+ else if( nFixedAngle <= 6000 )
+ nWinkelTypePos=WK_60;
+ else
+ nWinkelTypePos=WK_90;
+ }
+
+ aCB_LAENGE.Check( bFitLineLen );
+ aMF_LAENGE.SetValue( nLineLen );
+
+ aLB_ANSATZ.SelectEntryPos( nAnsatzTypePos );
+ aLB_WINKEL.SelectEntryPos( nWinkelTypePos );
+
+ SetupAnsatz_Impl( nAnsatzTypePos );
+ aCT_CAPTTYPE.SelectItem( nCaptionType+1 );// Enum beginnt bei 0!
+ SetupType_Impl( nCaptionType+1 );
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxCaptionTabPage::Create( Window* pWindow,
+ const SfxItemSet& rOutAttrs )
+{
+ return( new SvxCaptionTabPage( pWindow, rOutAttrs ) );
+}
+
+//------------------------------------------------------------------------
+
+USHORT* SvxCaptionTabPage::GetRanges()
+{
+ return( pCaptionRanges );
+}
+
+//------------------------------------------------------------------------
+
+void SvxCaptionTabPage::SetupAnsatz_Impl( USHORT nType )
+{
+ xub_StrLen nCnt=0, nIdx=0;
+
+ switch( nType )
+ {
+ case AZ_OPTIMAL:
+// aMF_ANSATZ.Hide(); //XXX auch bei OPTIMAL werden Abswerte genommen
+// aFT_UM.Hide();
+ aMF_ANSATZ.Show();
+ aFT_UM.Show();
+ aFT_ANSATZ_REL.Hide();
+ aLB_ANSATZ_REL.Hide();
+ nEscDir = SDRCAPT_ESCBESTFIT;
+ break;
+
+ case AZ_VON_OBEN:
+ aMF_ANSATZ.Show();
+ aFT_UM.Show();
+ aFT_ANSATZ_REL.Hide();
+ aLB_ANSATZ_REL.Hide();
+ nEscDir = SDRCAPT_ESCHORIZONTAL;
+ break;
+
+ case AZ_VON_LINKS:
+ aMF_ANSATZ.Show();
+ aFT_UM.Show();
+ aFT_ANSATZ_REL.Hide();
+ aLB_ANSATZ_REL.Hide();
+ nEscDir = SDRCAPT_ESCVERTICAL;
+ break;
+
+ case AZ_HORIZONTAL:
+ aLB_ANSATZ_REL.Clear();
+ nCnt = aStrHorzList.GetTokenCount();
+ for( nIdx=0 ; nIdx<nCnt ; nIdx++ )
+ aLB_ANSATZ_REL.InsertEntry( aStrHorzList.GetToken(nIdx) );
+ aLB_ANSATZ_REL.SelectEntryPos( nAnsatzRelPos );
+
+ aMF_ANSATZ.Hide();
+ aFT_UM.Hide();
+ aFT_ANSATZ_REL.Show();
+ aLB_ANSATZ_REL.Show();
+ nEscDir = SDRCAPT_ESCHORIZONTAL;
+ break;
+
+ case AZ_VERTIKAL:
+ aLB_ANSATZ_REL.Clear();
+ nCnt = aStrVertList.GetTokenCount();
+ for( nIdx=0 ; nIdx<nCnt ; nIdx++ )
+ aLB_ANSATZ_REL.InsertEntry( aStrVertList.GetToken(nIdx) );
+ aLB_ANSATZ_REL.SelectEntryPos( nAnsatzRelPos );
+
+ aMF_ANSATZ.Hide();
+ aFT_UM.Hide();
+ aFT_ANSATZ_REL.Show();
+ aLB_ANSATZ_REL.Show();
+ nEscDir = SDRCAPT_ESCVERTICAL;
+ break;
+ }
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxCaptionTabPage, AnsatzSelectHdl_Impl, ListBox *, pListBox )
+{
+ if( pListBox == &aLB_ANSATZ )
+ {
+ SetupAnsatz_Impl( aLB_ANSATZ.GetSelectEntryPos() );
+ }
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxCaptionTabPage, AnsatzSelectHdl_Impl, ListBox *, pListBox )
+
+//------------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxCaptionTabPage, AnsatzRelSelectHdl_Impl, ListBox *, pListBox )
+{
+ if( pListBox == &aLB_ANSATZ_REL )
+ {
+ nAnsatzRelPos = aLB_ANSATZ_REL.GetSelectEntryPos();
+ }
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxCaptionTabPage, AnsatzRelSelectHdl_Impl, ListBox *, pListBox )
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxCaptionTabPage, LineOptHdl_Impl, Button *, pButton )
+{
+ if( pButton == &aCB_LAENGE )
+ {
+ if( aCB_LAENGE.IsChecked() || ! aCB_LAENGE.IsEnabled() )
+ {
+ aFT_LAENGE.Disable();
+ aMF_LAENGE.Disable();
+ }
+ else
+ {
+ aFT_LAENGE.Enable();
+ aMF_LAENGE.Enable();
+ }
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxCaptionTabPage, SelectCaptTypeHdl_Impl, void *, EMPTYARG )
+{
+ SetupType_Impl( aCT_CAPTTYPE.GetSelectItemId() );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxCaptionTabPage, SelectCaptTypeHdl_Impl, void *, EMPTYARG )
+
+//------------------------------------------------------------------------
+
+void SvxCaptionTabPage::SetupType_Impl( USHORT nType )
+{
+ switch( nType-1 )
+ {
+ case SDRCAPT_TYPE1:
+ aFT_WINKEL.Disable();
+ aLB_WINKEL.Disable();
+ aFT_LAENGE.Disable();
+ aCB_LAENGE.Disable();
+ LineOptHdl_Impl( &aCB_LAENGE );
+ break;
+
+ case SDRCAPT_TYPE2:
+ aFT_WINKEL.Enable();
+ aLB_WINKEL.Enable();
+ aFT_LAENGE.Disable();
+ aCB_LAENGE.Disable();
+ LineOptHdl_Impl( &aCB_LAENGE );
+ break;
+
+ case SDRCAPT_TYPE3:
+ aFT_WINKEL.Enable();
+ aLB_WINKEL.Enable();
+ aFT_LAENGE.Enable();
+ aCB_LAENGE.Enable();
+ LineOptHdl_Impl( &aCB_LAENGE );
+ break;
+
+ case SDRCAPT_TYPE4:
+ aFT_WINKEL.Enable();
+ aLB_WINKEL.Enable();
+ aFT_LAENGE.Enable();
+ aCB_LAENGE.Enable();
+ LineOptHdl_Impl( &aCB_LAENGE );
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCaptionTabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxTabPage::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ FillValueSet();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCaptionTabPage::FillValueSet()
+{
+ bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
+
+ Image** ppBitmaps = bHighContrast ? mpBmpCapTypesH : mpBmpCapTypes;
+ aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_1, *(ppBitmaps[0]) );
+ aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_2, *(ppBitmaps[1]) );
+ aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_3, *(ppBitmaps[2]) );
+}
+
+//========================================================================
+
+
+SvxCaptionTabDialog::SvxCaptionTabDialog(Window* pParent, const SdrView* pSdrView, USHORT nAnchorTypes)
+ : SfxTabDialog( pParent, SVX_RES( RID_SVXDLG_CAPTION ) ),
+ pView ( pSdrView ),
+ nAnchorCtrls(nAnchorTypes)
+{
+ FreeResource();
+
+ DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
+
+ //different positioning page in Writer
+ if(nAnchorCtrls & 0x00ff )
+ {
+ AddTabPage( RID_SVXPAGE_SWPOSSIZE, SvxSwPosSizeTabPage::Create,
+ SvxSwPosSizeTabPage::GetRanges );
+ RemoveTabPage( RID_SVXPAGE_POSITION_SIZE);
+ }
+ else
+ {
+ AddTabPage( RID_SVXPAGE_POSITION_SIZE, SvxPositionSizeTabPage::Create,
+ SvxPositionSizeTabPage::GetRanges );
+ RemoveTabPage( RID_SVXPAGE_SWPOSSIZE );
+ }
+ AddTabPage( RID_SVXPAGE_CAPTION, SvxCaptionTabPage::Create,
+ SvxCaptionTabPage::GetRanges );
+}
+
+// -----------------------------------------------------------------------
+
+SvxCaptionTabDialog::~SvxCaptionTabDialog()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCaptionTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage )
+{
+ switch( nId )
+ {
+ case RID_SVXPAGE_POSITION_SIZE:
+ ( (SvxPositionSizeTabPage&) rPage ).SetView( pView );
+ ( (SvxPositionSizeTabPage&) rPage ).Construct();
+ if( nAnchorCtrls & SVX_OBJ_NORESIZE )
+ ( (SvxPositionSizeTabPage&) rPage ).DisableResize();
+
+ if( nAnchorCtrls & SVX_OBJ_NOPROTECT )
+ ( (SvxPositionSizeTabPage&) rPage ).DisableProtect();
+ break;
+ case RID_SVXPAGE_SWPOSSIZE :
+ {
+ SvxSwPosSizeTabPage& rSwPage = static_cast<SvxSwPosSizeTabPage&>(rPage);
+ rSwPage.EnableAnchorTypes(nAnchorCtrls);
+ rSwPage.SetValidateFramePosLink( aValidateLink );
+ }
+ break;
+
+ case RID_SVXPAGE_CAPTION:
+ ( (SvxCaptionTabPage&) rPage ).SetView( pView );
+ ( (SvxCaptionTabPage&) rPage ).Construct();
+ break;
+ }
+}
+/*-- 05.03.2004 13:54:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SvxCaptionTabDialog::SetValidateFramePosLink( const Link& rLink )
+{
+ aValidateLink = rLink;
+}
+
+
diff --git a/cui/source/tabpages/labdlg.hrc b/cui/source/tabpages/labdlg.hrc
new file mode 100644
index 000000000000..82ea64c1620c
--- /dev/null
+++ b/cui/source/tabpages/labdlg.hrc
@@ -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: labdlg.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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>
+//#define RID_SVXPAGE_CAPTION 1000
+//#define RID_SVXDLG_CAPTION 1001
+
+#define TAB_CONTROL 1
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+
+#define FT_ABSTAND 1
+#define FT_WINKEL 2
+#define FT_ANSATZ 3
+#define FT_LAENGE 4
+#define FT_UM 5
+#define FT_ANSATZ_REL 6
+
+#define CT_CAPTTYPE 1
+
+#define MF_ABSTAND 1
+#define MF_ANSATZ 2
+#define MF_LAENGE 3
+
+#define CB_LAENGE 1
+
+#define CM_LAENGE 1
+
+#define LB_WINKEL 1
+#define LB_ANSATZ 2
+#define LB_ANSATZ_REL 3
+
+#define STR_CAPTTYPE_1 1
+#define STR_CAPTTYPE_2 2
+#define STR_CAPTTYPE_3 3
+#define STR_CAPTTYPE_4 4
+#define STR_HORZ_LIST 10
+#define STR_VERT_LIST 11
+
+#define BMP_CAPTTYPE_1 1
+#define BMP_CAPTTYPE_2 2
+#define BMP_CAPTTYPE_3 3
+#define BMP_CAPTTYPE_4 4
+
+#define BMP_CAPTTYPE_1_H 5
+#define BMP_CAPTTYPE_2_H 6
+#define BMP_CAPTTYPE_3_H 7
+#define BMP_CAPTTYPE_4_H 8
+
+#define SHOW_HORZ 1
+#define SHOW_VERT 2
+#define SHOW_ABS 3
+#define SHOW_NONE 4
diff --git a/cui/source/tabpages/labdlg.src b/cui/source/tabpages/labdlg.src
new file mode 100644
index 000000000000..f3d464a1558e
--- /dev/null
+++ b/cui/source/tabpages/labdlg.src
@@ -0,0 +1,301 @@
+/*************************************************************************
+ *
+ * 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: labdlg.src,v $
+ * $Revision: 1.34 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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.hrc"
+#include "labdlg.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXPAGE_CAPTION ---------------------------------------------------
+TabPage RID_SVXPAGE_CAPTION
+{
+ HelpId = HID_CAPTION ;
+ Hide = TRUE ;
+ //Size = MAP_APPFONT ( 189 , 97 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Callouts" ;
+ Control CT_CAPTTYPE
+ {
+ HelpId = HID_CAPTION_CTL_TYPE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 187 , 38 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_ABSTAND
+ {
+ Pos = MAP_APPFONT ( 6 , 53 ) ;
+ Size = MAP_APPFONT ( 42 , 8 ) ;
+ Text [ en-US ] = "~Spacing" ;
+ };
+ MetricField MF_ABSTAND
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 50 , 51 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 240000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 50 ;
+ };
+ FixedText FT_WINKEL
+ {
+ Pos = MAP_APPFONT ( 106 , 53 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "~Angle" ;
+ };
+ ListBox LB_WINKEL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 143 , 51 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ StringList [ en-US ] =
+ {
+ < "Free" ; 1 ; > ;
+ < "30 Degrees" ; 3000 ; > ;
+ < "45 Degrees" ; 4500 ; > ;
+ < "60 Degrees" ; 6000 ; > ;
+ < "90 Degrees" ; 9000 ; > ;
+ };
+ };
+ FixedText FT_ANSATZ
+ {
+ Pos = MAP_APPFONT ( 6 , 69 ) ;
+ Size = MAP_APPFONT ( 42 , 8 ) ;
+ Text [ en-US ] = "~Extension" ;
+ };
+ ListBox LB_ANSATZ
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 50 , 67 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ StringList [ en-US ] =
+ {
+ < "Optimal" ; 4 ; > ;
+ < "From top" ; 3 ; > ;
+ < "From left" ; 3 ; > ;
+ < "Horizontal" ; 1 ; > ;
+ < "Vertical" ; 2 ; > ;
+ };
+ };
+ FixedText FT_UM
+ {
+ Pos = MAP_APPFONT ( 106 , 69 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "~By" ;
+ };
+ MetricField MF_ANSATZ
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 143 , 67 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 240000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 50 ;
+ };
+ FixedText FT_ANSATZ_REL
+ {
+ Pos = MAP_APPFONT ( 106 , 69 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "~Position" ;
+ };
+ ListBox LB_ANSATZ_REL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 143 , 67 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_LAENGE
+ {
+ Pos = MAP_APPFONT ( 6 , 85 ) ;
+ Size = MAP_APPFONT ( 42 , 8 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Länge : ~Lõnge */
+ /* ### ACHTUNG: Neuer Text in Resource? ~Länge : ~Lõnge */
+ Text [ en-US ] = "~Length" ;
+ };
+ MetricField MF_LAENGE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 50 , 83 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 240000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 50 ;
+ };
+ CheckBox CB_LAENGE
+ {
+ Pos = MAP_APPFONT ( 106 , 84 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Optimal" ;
+ };
+ String STR_CAPTTYPE_1
+ {
+ Text [ en-US ] = "Straight Line" ;
+ };
+ String STR_CAPTTYPE_2
+ {
+ Text [ en-US ] = "Angled Line" ;
+ };
+ String STR_CAPTTYPE_3
+ {
+ Text [ en-US ] = "Angled Connector Line" ;
+ };
+ String STR_CAPTTYPE_4
+ {
+ Text [ en-US ] = "Double-angled line" ;
+ };
+ String STR_HORZ_LIST
+ {
+ Text [ en-US ] = "Top;Middle;Bottom" ;
+ };
+ String STR_VERT_LIST
+ {
+ Text [ en-US ] = "Left;Middle;Right" ;
+ };
+ Bitmap BMP_CAPTTYPE_1
+ {
+ File = "legtyp1.bmp" ;
+ };
+ Bitmap BMP_CAPTTYPE_2
+ {
+ File = "legtyp2.bmp" ;
+ };
+ Bitmap BMP_CAPTTYPE_3
+ {
+ File = "legtyp3.bmp" ;
+ };
+ Bitmap BMP_CAPTTYPE_4
+ {
+ File = "legtyp4.bmp" ;
+ };
+ Bitmap BMP_CAPTTYPE_1_H
+ {
+ File = "legtyp1_hc.bmp" ;
+ };
+ Bitmap BMP_CAPTTYPE_2_H
+ {
+ File = "legtyp2_hc.bmp" ;
+ };
+ Bitmap BMP_CAPTTYPE_3_H
+ {
+ File = "legtyp3_hc.bmp" ;
+ };
+ Bitmap BMP_CAPTTYPE_4_H
+ {
+ File = "legtyp4_hc.bmp" ;
+ };
+};
+ // RID_SVXDLG_CAPTION ----------------------------------------------------
+
+#define _POS_SIZE_TEXT \
+ Text [ en-US ] = "Position and Size" ; \
+
+TabDialog RID_SVXDLG_CAPTION\
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 237 , 161 ) ;
+ Text [ en-US ] = "Callouts" ;\
+ Moveable = TRUE ;
+ TabControl TAB_CONTROL\
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 189 , 97 ) ;
+ PageList =
+ {
+ PageItem\
+ {
+ Identifier = RID_SVXPAGE_POSITION_SIZE ;
+ PageResID = RID_SVXPAGE_POSITION_SIZE ;
+ _POS_SIZE_TEXT
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_SWPOSSIZE;
+ PageResID = RID_SVXPAGE_SWPOSSIZE;
+ _POS_SIZE_TEXT
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CAPTION ;
+ PageResID = RID_SVXPAGE_CAPTION ;
+ Text [ en-US ] = "Callout" ;
+ };
+ };
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx
new file mode 100644
index 000000000000..b75ce5b8ebd4
--- /dev/null
+++ b/cui/source/tabpages/macroass.cxx
@@ -0,0 +1,719 @@
+/*************************************************************************
+ *
+ * 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: macropg.cxx,v $
+ * $Revision: 1.21 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#define ITEMID_MACRO 0
+#include <svl/macitem.hxx>
+#undef ITEMID_MACRO
+
+#include "macroass.hxx"
+
+#include <basic/basmgr.hxx>
+#include <svx/dialmgr.hxx>
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+
+#include <svtools/svmedit.hxx>
+#include "cfgutil.hxx"
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include "macroass.hrc"
+#include "svx/dialogs.hrc"
+#include <sfx2/macrconf.hxx>
+#include "headertablistbox.hxx"
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::frame::XFrame;
+
+class _SfxMacroTabPage_Impl
+{
+public:
+ _SfxMacroTabPage_Impl( void );
+ ~_SfxMacroTabPage_Impl();
+
+ String maStaticMacroLBLabel;
+ PushButton* pAssignPB;
+ PushButton* pDeletePB;
+ String* pStrEvent;
+ String* pAssignedMacro;
+ ListBox* pScriptTypeLB;
+ _HeaderTabListBox* pEventLB;
+ SfxConfigGroupListBox_Impl* pGroupLB;
+ FixedText* pFT_MacroLBLabel;
+ SfxConfigFunctionListBox_Impl* pMacroLB;
+
+ FixedText* pMacroFT;
+ String* pMacroStr;
+ FNGetRangeHdl fnGetRange;
+ FNGetMacrosOfRangeHdl fnGetMacroOfRange;
+
+ BOOL bReadOnly;
+ Timer maFillGroupTimer;
+ BOOL bGotEvents;
+};
+
+_SfxMacroTabPage_Impl::_SfxMacroTabPage_Impl( void ) :
+ pAssignPB( NULL ),
+ pDeletePB( NULL ),
+ pStrEvent( NULL ),
+ pAssignedMacro( NULL ),
+ pScriptTypeLB( NULL ),
+ pEventLB( NULL ),
+ pGroupLB( NULL ),
+ pFT_MacroLBLabel( NULL ),
+ pMacroLB( NULL ),
+ pMacroFT( NULL ),
+ pMacroStr( NULL ),
+ fnGetRange( NULL ),
+ fnGetMacroOfRange( NULL ),
+ bReadOnly( FALSE ),
+ bGotEvents( FALSE )
+{
+}
+
+_SfxMacroTabPage_Impl::~_SfxMacroTabPage_Impl()
+{
+ delete pAssignPB;
+ delete pDeletePB;
+ delete pStrEvent;
+ delete pAssignedMacro;
+ delete pScriptTypeLB;
+ delete pEventLB;
+ delete pGroupLB;
+ delete pMacroLB;
+ delete pFT_MacroLBLabel;
+ delete pMacroFT;
+ delete pMacroStr;
+}
+
+
+SvStringsDtor* _ImpGetRangeHdl( _SfxMacroTabPage*, const String& rLanguage );
+SvStringsDtor* _ImpGetMacrosOfRangeHdl( _SfxMacroTabPage*, const String& rLanguage, const String& rRange );
+
+static USHORT __FAR_DATA aPageRg[] = {
+ SID_ATTR_MACROITEM, SID_ATTR_MACROITEM,
+ 0
+};
+
+// Achtung im Code wird dieses Array direkt (0, 1, ...) indiziert
+static long nTabs[] =
+ {
+ 2, // Number of Tabs
+ 0, 90
+ };
+
+#define TAB_WIDTH_MIN 10
+
+// IDs for items in HeaderBar of EventLB
+#define ITEMID_EVENT 1
+#define ITMEID_ASSMACRO 2
+
+
+#define LB_EVENTS_ITEMPOS 1
+#define LB_MACROS_ITEMPOS 2
+
+String ConvertToUIName_Impl( SvxMacro *pMacro, const String& /*rLanguage*/ )
+{
+ String aName( pMacro->GetMacName() );
+ String aEntry;
+ if ( ! pMacro->GetLanguage().EqualsAscii("JavaScript") )
+ {
+ USHORT nCount = aName.GetTokenCount('.');
+ aEntry = aName.GetToken( nCount-1, '.' );
+ if ( nCount > 2 )
+ {
+ aEntry += '(';
+ aEntry += aName.GetToken( 0, '.' );
+ aEntry += '.';
+ aEntry += aName.GetToken( nCount-2, '.' );
+ aEntry += ')';
+ }
+ return aEntry;
+ }
+ else
+ return aName;
+}
+
+void _SfxMacroTabPage::EnableButtons( const String& rLangName )
+{
+ // Solange die Eventbox leer ist, nichts tun
+ const SvLBoxEntry* pE = mpImpl->pEventLB->GetListBox().FirstSelected();
+ if ( pE )
+ {
+ // Gebundenes Macro holen
+ const SvxMacro* pM = aTbl.Get( (USHORT)(ULONG) pE->GetUserData() );
+ mpImpl->pDeletePB->Enable( 0 != pM && !mpImpl->bReadOnly );
+
+ // Bei gleichem ScriptType Zuweisung nur, wenn Macro sich
+ // ge"andert hat; bei verschiedenem ScriptType, wenn Script nicht leer
+ String sEventMacro;
+ sEventMacro = ((SvLBoxString*)pE->GetItem( LB_MACROS_ITEMPOS ))->GetText();
+ if ( rLangName.EqualsAscii("JavaScript") )
+ {
+ DBG_ERROR( "_SfxMacroTabPage::EnableButtons(): this is not an up to date usage!" );
+ }
+ else
+ {
+ SfxMacroInfo* pInfo = mpImpl->pMacroLB->GetMacroInfo();
+ String sSelMacro;
+ if ( pInfo )
+ sSelMacro = pInfo->GetMacroName();
+ if( pM && rLangName != pM->GetLanguage() )
+ mpImpl->pAssignPB->Enable( pInfo != 0 && !mpImpl->bReadOnly );
+ else
+ mpImpl->pAssignPB->Enable( pInfo && !mpImpl->bReadOnly && !sSelMacro.EqualsIgnoreCaseAscii( sEventMacro ) );
+ }
+ }
+}
+
+_SfxMacroTabPage::_SfxMacroTabPage( Window* pParent, const ResId& rResId, const SfxItemSet& rAttrSet )
+ : SfxTabPage( pParent, rResId, rAttrSet )
+
+{
+ mpImpl = new _SfxMacroTabPage_Impl;
+ mpImpl->fnGetRange = &_ImpGetRangeHdl;
+ mpImpl->fnGetMacroOfRange = &_ImpGetMacrosOfRangeHdl;
+}
+
+_SfxMacroTabPage::~_SfxMacroTabPage()
+{
+ DELETEZ( mpImpl );
+}
+
+void _SfxMacroTabPage::AddEvent( const String & rEventName, USHORT nEventId )
+{
+ String sTmp( rEventName );
+ sTmp += '\t';
+
+ // falls die Tabelle schon gueltig ist
+ SvxMacro* pM = aTbl.Get( nEventId );
+ if( pM )
+ {
+ String sNew( ConvertToUIName_Impl( pM, mpImpl->pScriptTypeLB->GetSelectEntry() ) );
+ sTmp += sNew;
+ }
+
+ SvLBoxEntry* pE = mpImpl->pEventLB->GetListBox().InsertEntry( sTmp );
+ pE->SetUserData( reinterpret_cast< void* >( sal::static_int_cast< sal_IntPtr >( nEventId )) );
+}
+
+void _SfxMacroTabPage::ScriptChanged( const String& aLangName )
+{
+ // neue Bereiche und deren Funktionen besorgen
+ {
+ mpImpl->pGroupLB->SetScriptType( aLangName );
+ mpImpl->pGroupLB->Show();
+ mpImpl->pMacroLB->Show();
+ mpImpl->pMacroFT->SetText( *mpImpl->pMacroStr );
+ }
+
+ EnableButtons( aLangName );
+}
+
+void _SfxMacroTabPage::SetGetRangeLink( FNGetRangeHdl pFn )
+{
+ mpImpl->fnGetRange = pFn;
+}
+
+FNGetRangeHdl _SfxMacroTabPage::GetGetRangeLink() const
+{
+ return mpImpl->fnGetRange;
+}
+
+void _SfxMacroTabPage::SetGetMacrosOfRangeLink( FNGetMacrosOfRangeHdl pFn )
+{
+ mpImpl->fnGetMacroOfRange = pFn;
+}
+
+FNGetMacrosOfRangeHdl _SfxMacroTabPage::GetGetMacrosOfRangeLink() const
+{
+ return mpImpl->fnGetMacroOfRange;
+}
+
+BOOL _SfxMacroTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ SvxMacroItem aItem( GetWhich( aPageRg[0] ) );
+ ((SvxMacroTableDtor&)aItem.GetMacroTable()) = aTbl;
+
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET != GetItemSet().GetItemState( aItem.Which(), TRUE, &pItem )
+ || aItem != *(SvxMacroItem*)pItem )
+ {
+ rSet.Put( aItem );
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void _SfxMacroTabPage::PageCreated (SfxAllItemSet aSet)
+{
+ const SfxPoolItem* pEventsItem;
+ if( !mpImpl->bGotEvents && SFX_ITEM_SET == aSet.GetItemState( SID_EVENTCONFIG, TRUE, &pEventsItem ) )
+ {
+ mpImpl->bGotEvents = TRUE;
+ const SfxEventNamesList& rList = ((SfxEventNamesItem*)pEventsItem)->GetEvents();
+ for ( USHORT nNo = 0; nNo < rList.Count(); ++nNo )
+ {
+ const SfxEventName *pOwn = rList.GetObject(nNo);
+ AddEvent( pOwn->maUIName, pOwn->mnId );
+ }
+ }
+}
+
+void _SfxMacroTabPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( aPageRg[0] ), TRUE, &pItem ))
+ aTbl = ((SvxMacroItem*)pItem)->GetMacroTable();
+
+ const SfxPoolItem* pEventsItem;
+ if( !mpImpl->bGotEvents && SFX_ITEM_SET == rSet.GetItemState( SID_EVENTCONFIG, TRUE, &pEventsItem ) )
+ {
+ mpImpl->bGotEvents = TRUE;
+ const SfxEventNamesList& rList = ((SfxEventNamesItem*)pEventsItem)->GetEvents();
+ for ( USHORT nNo = 0; nNo < rList.Count(); ++nNo )
+ {
+ const SfxEventName *pOwn = rList.GetObject(nNo);
+ AddEvent( pOwn->maUIName, pOwn->mnId );
+ }
+ }
+
+ FillEvents();
+
+ SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox();
+ SvLBoxEntry* pE = rListBox.GetEntry( 0 );
+ if( pE )
+ rListBox.SetCurEntry( pE );
+}
+
+void _SfxMacroTabPage::SetReadOnly( BOOL bSet )
+{
+ mpImpl->bReadOnly = bSet;
+}
+
+BOOL _SfxMacroTabPage::IsReadOnly() const
+{
+ return mpImpl->bReadOnly;
+}
+
+IMPL_STATIC_LINK( _SfxMacroTabPage, SelectEvent_Impl, SvTabListBox*, EMPTYARG )
+{
+ _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl;
+ SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox();
+ SvLBoxEntry* pE = rListBox.FirstSelected();
+ ULONG nPos;
+ if( !pE || LISTBOX_ENTRY_NOTFOUND ==
+ ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) )
+ {
+ DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" );
+ return 0;
+ }
+
+ USHORT nEventId = (USHORT)(ULONG)pE->GetUserData();
+ String aLanguage = pImpl->pScriptTypeLB->GetSelectEntry();
+
+ const SvxMacro* pM = pThis->aTbl.Get( nEventId );
+ if( pM )
+ {
+ if( aLanguage != pM->GetLanguage() )
+ {
+ pImpl->pScriptTypeLB->SelectEntry( pM->GetLanguage() );
+ pThis->ScriptChanged( pM->GetLanguage() );
+ }
+ else
+ {
+ DBG_ASSERT( !aLanguage.EqualsAscii("JavaScript"), "_SfxMacroTabPage, SelectEvent_Impl(): outdated use!" );
+ }
+ }
+
+ pThis->EnableButtons( aLanguage );
+ return 0;
+}
+
+IMPL_STATIC_LINK( _SfxMacroTabPage, SelectGroup_Impl, ListBox*, EMPTYARG )
+{
+ _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl;
+ String sSel( pImpl->pGroupLB->GetGroup() );
+ String aLanguage = pImpl->pScriptTypeLB->GetSelectEntry();
+ if( !aLanguage.EqualsAscii( "JavaScript" ) )
+ {
+ pImpl->pGroupLB->GroupSelected();
+ SfxMacroInfo* pMacro = pImpl->pMacroLB->GetMacroInfo();
+ String aLabelText;
+ if( pMacro )
+ {
+ aLabelText = pImpl->maStaticMacroLBLabel;
+ aLabelText += pMacro->GetModuleName();
+ }
+ else
+ {
+ // Wenn dort ein Macro drin ist, wurde es selektiert und der
+ // AssignButton schon in SelectMacro richtig enabled
+ pImpl->pAssignPB->Enable( FALSE );
+ }
+
+ pImpl->pFT_MacroLBLabel->SetText( aLabelText );
+ }
+ return 0;
+}
+
+IMPL_STATIC_LINK( _SfxMacroTabPage, SelectMacro_Impl, ListBox*, EMPTYARG )
+{
+ _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl;
+ pImpl->pMacroLB->FunctionSelected();
+ pThis->EnableButtons( pImpl->pScriptTypeLB->GetSelectEntry() );
+ return 0;
+}
+
+IMPL_STATIC_LINK( _SfxMacroTabPage, GetFocus_Impl, Edit*, EMPTYARG )
+{
+ pThis->EnableButtons( DEFINE_CONST_UNICODE("JavaScript") );
+ return 0;
+}
+
+IMPL_STATIC_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton*, pBtn )
+{
+ _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl;
+ SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox();
+ SvLBoxEntry* pE = rListBox.FirstSelected();
+ ULONG nPos;
+ if( !pE || LISTBOX_ENTRY_NOTFOUND ==
+ ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) )
+ {
+ DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" );
+ return 0;
+ }
+
+ const BOOL bAssEnabled = pBtn != pImpl->pDeletePB && pImpl->pAssignPB->IsEnabled();
+
+ // aus der Tabelle entfernen
+ USHORT nEvent = (USHORT)(ULONG)pE->GetUserData();
+ SvxMacro *pRemoveMacro = pThis->aTbl.Remove( nEvent );
+ delete pRemoveMacro;
+
+ String aLanguage = pImpl->pScriptTypeLB->GetSelectEntry();
+ String sNew;
+ if( bAssEnabled )
+ {
+ String sGroup;
+ String sMacro;
+ String aEntryText( sNew );
+ DBG_ASSERT( !aLanguage.EqualsAscii("JavaScript"), "_SfxMacroTabPage, AssignDeleteHdl_Impl(): outdated use!" );
+
+ SfxMacroInfo* pMacro = pImpl->pMacroLB->GetMacroInfo();
+ sMacro = pMacro->GetQualifiedName();
+ sGroup = pImpl->pGroupLB->GetGroup();
+ sNew = pMacro->GetMacroName();
+
+ if( sMacro.CompareToAscii( "vnd.sun.star.script:", 20 ) == COMPARE_EQUAL )
+ {
+ OSL_TRACE("ASSIGN_DELETE: Its a script");
+ pThis->aTbl.Insert(
+ nEvent, new SvxMacro( sMacro, String::CreateFromAscii("Script") ) );
+ }
+ else
+ {
+ OSL_TRACE("ASSIGN_DELETE: Its a basic macro");
+ String sBasicName/*(SfxResId(STR_BASICNAME))*/;
+ if ( aLanguage == sBasicName )
+ pThis->aTbl.Insert( nEvent, new SvxMacro( sMacro, sGroup, STARBASIC ) );
+ else
+ pThis->aTbl.Insert( nEvent, new SvxMacro( sMacro, aLanguage ) );
+ }
+ }
+
+ pImpl->pEventLB->SetUpdateMode( FALSE );
+ pE->ReplaceItem( new SvLBoxString( pE, 0, sNew ), LB_MACROS_ITEMPOS );
+ rListBox.GetModel()->InvalidateEntry( pE );
+ rListBox.Select( pE );
+ rListBox.MakeVisible( pE );
+ rListBox.SetUpdateMode( TRUE );
+
+ pThis->EnableButtons( aLanguage );
+ return 0;
+}
+
+IMPL_STATIC_LINK( _SfxMacroTabPage, ChangeScriptHdl_Impl, RadioButton*, EMPTYARG )
+{
+ pThis->ScriptChanged( pThis->mpImpl->pScriptTypeLB->GetSelectEntry() );
+ return 0;
+}
+
+IMPL_STATIC_LINK( _SfxMacroTabPage, TimeOut_Impl, Timer*, EMPTYARG )
+{
+ // FillMacroList() can take a long time -> show wait cursor and disable input
+ SfxTabDialog* pTabDlg = pThis->GetTabDialog();
+ // perhaps the tabpage is part of a SingleTabDialog then pTabDlg == NULL
+ if ( pTabDlg )
+ {
+ pTabDlg->EnterWait();
+ pTabDlg->EnableInput( FALSE );
+ }
+ pThis->FillMacroList();
+ if ( pTabDlg )
+ {
+ pTabDlg->EnableInput( TRUE );
+ pTabDlg->LeaveWait();
+ }
+ return 0;
+}
+
+void _SfxMacroTabPage::InitAndSetHandler()
+{
+ // Handler installieren
+ SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox();
+ HeaderBar& rHeaderBar = mpImpl->pEventLB->GetHeaderBar();
+ Link aLnk(STATIC_LINK(this, _SfxMacroTabPage, AssignDeleteHdl_Impl ));
+ mpImpl->pMacroLB->SetDoubleClickHdl( aLnk );
+ mpImpl->pDeletePB->SetClickHdl( aLnk );
+ mpImpl->pAssignPB->SetClickHdl( aLnk );
+ rListBox.SetDoubleClickHdl( aLnk );
+
+ rListBox.SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, SelectEvent_Impl ));
+ mpImpl->pGroupLB->SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, SelectGroup_Impl ));
+ mpImpl->pMacroLB->SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, SelectMacro_Impl ));
+
+ mpImpl->pScriptTypeLB->SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, ChangeScriptHdl_Impl ));
+
+ rListBox.SetSelectionMode( SINGLE_SELECTION );
+ rListBox.SetTabs( &nTabs[0], MAP_APPFONT );
+ Size aSize( nTabs[ 2 ], 0 );
+ rHeaderBar.InsertItem( ITEMID_EVENT, *mpImpl->pStrEvent, LogicToPixel( aSize, MapMode( MAP_APPFONT ) ).Width() );
+ aSize.Width() = 1764; // don't know what, so 42^2 is best to use...
+ rHeaderBar.InsertItem( ITMEID_ASSMACRO, *mpImpl->pAssignedMacro, LogicToPixel( aSize, MapMode( MAP_APPFONT ) ).Width() );
+ rListBox.SetSpaceBetweenEntries( 0 );
+
+ mpImpl->pEventLB->Show();
+ mpImpl->pEventLB->ConnectElements();
+
+ mpImpl->pEventLB->Enable( TRUE );
+ mpImpl->pGroupLB->Enable( TRUE );
+ mpImpl->pMacroLB->Enable( TRUE );
+
+ mpImpl->pScriptTypeLB->SetDropDownLineCount( 3 );
+ String sBasicName/*(SfxResId(STR_BASICNAME))*/;
+ mpImpl->pScriptTypeLB->InsertEntry( sBasicName );
+ mpImpl->pScriptTypeLB->SelectEntry( sBasicName );
+
+ mpImpl->pGroupLB->SetFunctionListBox( mpImpl->pMacroLB );
+
+ mpImpl->maFillGroupTimer.SetTimeoutHdl( STATIC_LINK( this, _SfxMacroTabPage, TimeOut_Impl ) );
+ mpImpl->maFillGroupTimer.SetTimeout( 0 );
+ mpImpl->maFillGroupTimer.Start();
+}
+
+void _SfxMacroTabPage::FillMacroList()
+{
+ String aLanguage = mpImpl->pScriptTypeLB->GetSelectEntry();
+ if( ! aLanguage.EqualsAscii("JavaScript") )
+ {
+ // 2 Listboxen
+ SvStringsDtor* pArr = (*mpImpl->fnGetRange)( this, String(/*SfxResId(STR_BASICNAME)*/) );
+ if( pArr )
+ {
+ mpImpl->pGroupLB->Init(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >(),
+ GetFrame(),
+ ::rtl::OUString() );
+
+ delete pArr;
+ }
+ }
+}
+
+void _SfxMacroTabPage::FillEvents()
+{
+ SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox();
+
+ String aLanguage = mpImpl->pScriptTypeLB->GetSelectEntry();
+ ULONG nEntryCnt = rListBox.GetEntryCount();
+
+ // Events aus der Tabelle holen und die EventListBox entsprechen fuellen
+ for( ULONG n = 0 ; n < nEntryCnt ; ++n )
+ {
+ SvLBoxEntry* pE = rListBox.GetEntry( n );
+ if( pE )
+ {
+ SvLBoxString* pLItem = ( SvLBoxString* ) pE->GetItem( LB_MACROS_ITEMPOS );
+ DBG_ASSERT( pLItem && SV_ITEM_ID_LBOXSTRING == pLItem->IsA(), "_SfxMacroTabPage::FillEvents(): no LBoxString" );
+
+ String sOld( pLItem->GetText() );
+ String sNew;
+ USHORT nEventId = ( USHORT ) ( ULONG ) pE->GetUserData();
+ if( aTbl.IsKeyValid( nEventId ) )
+ sNew = ConvertToUIName_Impl( aTbl.Get( nEventId ), aLanguage );
+
+ if( sOld != sNew )
+ {
+ pE->ReplaceItem( new SvLBoxString( pE, 0, sNew ), LB_MACROS_ITEMPOS );
+ rListBox.GetModel()->InvalidateEntry( pE );
+ }
+ }
+ }
+}
+
+void _SfxMacroTabPage::SelectEvent( const String & /*rEventName*/, USHORT nEventId )
+{
+ SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox();
+ ULONG nEntryCnt = rListBox.GetEntryCount();
+
+ for( ULONG n = 0 ; n < nEntryCnt ; ++n )
+ {
+ SvLBoxEntry* pE = rListBox.GetEntry( n );
+ if( pE && ( USHORT ) ( ULONG ) pE->GetUserData() == nEventId )
+ {
+ rListBox.SetCurEntry( pE );
+ rListBox.MakeVisible( pE );
+ break;
+ }
+ }
+}
+
+
+SvStringsDtor* __EXPORT _ImpGetRangeHdl( _SfxMacroTabPage* /*pTbPg*/, const String& rLanguage )
+{
+ SvStringsDtor* pNew = new SvStringsDtor;
+ SfxApplication* pSfxApp = SFX_APP();
+
+ if ( !rLanguage.EqualsAscii("JavaScript") )
+ {
+ pSfxApp->EnterBasicCall();
+
+ // AppBasic einf"ugen
+ String* pNewEntry = new String( pSfxApp->GetName() );
+ pNew->Insert( pNewEntry, pNew->Count() );
+
+ // Aktuelles Dokument
+ SfxObjectShell* pDoc = SfxObjectShell::Current();
+ if ( pDoc )
+ {
+ String aTitle = pDoc->GetTitle();
+
+ // Hack f"ur Aufruf aus der Basic-IDE : das Basic ermitteln, das
+ // gerade bearbeitet wird
+
+ String aAppName(DEFINE_CONST_UNICODE("BASIC - "));
+ USHORT nLen = aAppName.Len();
+ if ( aTitle.CompareIgnoreCaseToAscii( aAppName, nLen ) == COMPARE_EQUAL )
+ {
+ // Basic-Namensprefix entfernen
+ aTitle.Erase( 0, nLen );
+ USHORT nIndex=0, nCount=aTitle.GetTokenCount('.');
+ if ( nCount > 1 )
+ {
+ // Namen der Library entfernen
+ aTitle.GetToken( nCount-2, '.', nIndex );
+ aTitle.Erase( nIndex-1 );
+ }
+
+ // Wenn das App-Basic gerade in der Basic-IDE bearbeitet wird, kein
+ // Dokument verwenden
+ pDoc = SfxObjectShell::GetFirst();
+ while( pDoc )
+ {
+ if ( aTitle == pDoc->GetTitle() )
+ break;
+ pDoc = SfxObjectShell::GetNext( *pDoc );
+ }
+ }
+
+ if ( pDoc && pDoc->GetBasicManager() != SFX_APP()->GetBasicManager() &&
+ pDoc->GetBasicManager()->GetLibCount() )
+ {
+ pNewEntry = new String( aTitle );
+ pNew->Insert( pNewEntry, pNew->Count() );
+ }
+ }
+
+ pSfxApp->LeaveBasicCall();
+ }
+
+ return pNew;
+}
+
+// besorgen der Funktionen eines Bereiches
+SvStringsDtor* __EXPORT _ImpGetMacrosOfRangeHdl(
+ _SfxMacroTabPage* /*pTbPg*/,
+ const String& /*rLanguage*/,
+ const String& /*rRange*/ )
+{
+ SvStringsDtor* pNew = new SvStringsDtor;
+ return pNew;
+}
+
+
+SfxMacroTabPage::SfxMacroTabPage( Window* pParent, const ResId& rResId, const Reference< XFrame >& rxDocumentFrame, const SfxItemSet& rSet )
+ : _SfxMacroTabPage( pParent, rResId, rSet )
+{
+ mpImpl->pStrEvent = new String( SVX_RES( STR_EVENT ) );
+ mpImpl->pAssignedMacro = new String( SVX_RES( STR_ASSMACRO ) );
+ mpImpl->pEventLB = new _HeaderTabListBox( this, SVX_RES( LB_EVENT ) );
+ mpImpl->pAssignPB = new PushButton( this, SVX_RES( PB_ASSIGN ) );
+ mpImpl->pDeletePB = new PushButton( this, SVX_RES( PB_DELETE ) );
+ mpImpl->pScriptTypeLB = new ListBox(this, SVX_RES( LB_SCRIPTTYPE ) );
+ mpImpl->pScriptTypeLB->Hide();
+ mpImpl->pMacroFT = new FixedText( this, SVX_RES( FT_MACRO ) );
+ mpImpl->pGroupLB = new SfxConfigGroupListBox_Impl( this, SVX_RES( LB_GROUP ) );
+ mpImpl->pFT_MacroLBLabel = new FixedText( this, SVX_RES( FT_LABEL4LB_MACROS ) );
+ mpImpl->maStaticMacroLBLabel= mpImpl->pFT_MacroLBLabel->GetText();
+ mpImpl->pMacroLB = new SfxConfigFunctionListBox_Impl( this, SVX_RES( LB_MACROS ) );
+ mpImpl->pMacroStr = new String( SVX_RES( STR_MACROS ) );
+
+ FreeResource();
+
+ SetFrame( rxDocumentFrame );
+
+ InitAndSetHandler();
+
+ ScriptChanged( String( /*SfxResId(STR_BASICNAME)*/ ) );
+}
+
+SfxTabPage* SfxMacroTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SfxMacroTabPage( pParent, SVX_RES( RID_SVXPAGE_EVENTASSIGN ), NULL, rAttrSet );
+}
+
+SfxMacroAssignDlg::SfxMacroAssignDlg( Window* pParent, const Reference< XFrame >& rxDocumentFrame, const SfxItemSet& rSet )
+ : SfxSingleTabDialog( pParent, rSet, 0 )
+{
+ SfxTabPage* pPage = SfxMacroTabPage::Create( this, rSet );
+ pPage->SetFrame( rxDocumentFrame );
+ SetTabPage( pPage );
+}
+
+SfxMacroAssignDlg::~SfxMacroAssignDlg()
+{
+}
+
+
diff --git a/cui/source/tabpages/macroass.hrc b/cui/source/tabpages/macroass.hrc
new file mode 100644
index 000000000000..626cf010adf9
--- /dev/null
+++ b/cui/source/tabpages/macroass.hrc
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * 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: macropg.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _MACROASS_HRC
+#define _MACROASS_HRC
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define LB_EVENT 2
+#define PB_ASSIGN 3
+#define PB_DELETE 4
+#define FT_MACRO 5
+#define LB_GROUP 6
+#define LB_MACROS 7
+#define LB_SCRIPTTYPE 8
+#define FT_LABEL4LB_MACROS 9
+#define STR_JAVASCRIPT 10
+#define STR_MACROS 11
+#define ED_JAVASCRIPT 12
+#define STR_EVENT 13
+#define STR_ASSMACRO 14
+
+
+// COL0<---------------WIDTH_1_2--------------->COL3<->COL4<----WIDTH4---->COL5
+// <--WIDTH1-->COL1<-SPACE1->COL2<--WIDTH2->
+
+#define WIDTH_TP 260 // of whole tabpage
+#define COL5 (WIDTH_TP-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define COL4 (COL5-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL3 (COL4-RSC_SP_CTRL_X)
+#define COL0 (RSC_SP_TBPG_INNERBORDER_LEFT)
+#define WIDTH1_2 (COL3-COL0) // width of upper listbox
+#define SPACE1 4 // space between lower listboxes
+#define WIDTH1 ((WIDTH1_2-SPACE1)/2) // width of lower left listbox
+#define WIDTH2 (WIDTH1_2-WIDTH1-SPACE1) // width of lower right listbox
+#define COL1 (COL0+WIDTH1)
+#define COL2 (COL1+SPACE1)
+
+#define HEIGHT_TP 185 // of whole tabpage
+#define HEIGHT0 62 // of upper listbox
+#define ROW0 6 // more than RSC_SP_FLGR_INNERBORDER_TOP cause of bad design
+#define ROW1 (ROW0+RSC_CD_PUSHBUTTON_HEIGHT) // Assign button
+#define ROW2 (ROW1+RSC_SP_CTRL_GROUP_Y)
+#define ROW3 (ROW2+RSC_CD_PUSHBUTTON_HEIGHT) // Remove button
+#define ROW4 (ROW3+RSC_SP_CTRL_GROUP_Y)
+#define ROW5 (ROW4+RSC_CD_DROPDOWN_HEIGHT) // script type listbox (hidden)
+#define ROW6 (ROW0+HEIGHT0)
+#define ROW7 (ROW6+RSC_SP_CTRL_Y)
+#define HEIGHT_EXTRA7 (RSC_CD_FIXEDTEXT_HEIGHT) // additional height for FT_LABEL4LB_MACROS
+#define ROW7A (ROW7+HEIGHT_EXTRA7)
+#define ROW8 (ROW7+RSC_CD_FIXEDTEXT_HEIGHT+HEIGHT_EXTRA7)// label for lower listboxes (2 lines!)
+#define ROW9 (HEIGHT_TP-RSC_SP_TBPG_INNERBORDER_BOTTOM)
+#define HEIGHT8 (ROW9-ROW8) // of lower listboxes
+
+#endif
+
diff --git a/cui/source/tabpages/macroass.src b/cui/source/tabpages/macroass.src
new file mode 100644
index 000000000000..bb56baae45f6
--- /dev/null
+++ b/cui/source/tabpages/macroass.src
@@ -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: macropg.src,v $
+ * $Revision: 1.39 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "macroass.hrc"
+#include "svx/dialogs.hrc"
+#include "helpid.hrc"
+TabPage RID_SVXPAGE_EVENTASSIGN
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ DialogControl = TRUE ;
+ Size = MAP_APPFONT ( WIDTH_TP , HEIGHT_TP ) ;
+ Text [ en-US ] = "Assign Macro" ;
+ String STR_EVENT
+ {
+ Text [ en-US ] = "Event" ;
+ };
+ String STR_ASSMACRO
+ {
+ Text [ en-US ] = "Assigned macro";
+ };
+ Control LB_EVENT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL0 , ROW0 ) ;
+ Size = MAP_APPFONT ( WIDTH1_2 , HEIGHT0 ) ;
+ TabStop = TRUE ;
+ DialogControl = TRUE ;
+ ClipChildren = TRUE ;
+ Disable = TRUE ;
+ Group = TRUE ;
+ HelpID = HID_MACRO_LB_EVENT ;
+ };
+ FixedText FT_MACRO
+ {
+ Pos = MAP_APPFONT ( COL0 , ROW7A ) ;
+ Size = MAP_APPFONT ( WIDTH1 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Group = TRUE ;
+ };
+ Control LB_GROUP
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL0 , ROW8 ) ;
+ Size = MAP_APPFONT ( WIDTH1 , HEIGHT8 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ HelpId = HID_MACRO_GROUP ;
+ };
+ FixedText FT_LABEL4LB_MACROS
+ {
+ Pos = MAP_APPFONT ( COL2 , ROW7 ) ;
+ Size = MAP_APPFONT ( WIDTH1 , RSC_CD_FIXEDTEXT_HEIGHT + HEIGHT_EXTRA7 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "~Existing macros in:\n" ;
+ };
+ Control LB_MACROS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL2 , ROW8 ) ;
+ Size = MAP_APPFONT ( WIDTH2 , HEIGHT8 ) ;
+ TabStop = TRUE ;
+ HelpId = HID_MACRO_MACROS ;
+ };
+ PushButton PB_ASSIGN
+ {
+ Pos = MAP_APPFONT ( COL4 , ROW0 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ // ### ACHTUNG: Neuer Text in Resource? Z~uweisen : Zuweisen
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Assign" ;
+ };
+ PushButton PB_DELETE
+ {
+ Pos = MAP_APPFONT ( COL4 , ROW2 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Remove" ;
+ };
+ ListBox LB_SCRIPTTYPE
+ {
+ Pos = MAP_APPFONT ( COL4 , ROW4 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , 60 ) ;
+ // en-US was missing
+ Text [ en-US ] = "~Scripting Language" ;
+ TabStop = TRUE ;
+ Disable = FALSE ;
+ DropDown = TRUE ;
+ };
+ String STR_MACROS
+ {
+ Text [ en-US ] = "Macros" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/makefile.mk b/cui/source/tabpages/makefile.mk
new file mode 100755
index 000000000000..a43bf143c2a6
--- /dev/null
+++ b/cui/source/tabpages/makefile.mk
@@ -0,0 +1,112 @@
+#*************************************************************************
+#
+# 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: makefile.mk,v $
+#
+# $Revision: 1.65 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..
+PRJNAME=cui
+TARGET=tabpages
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc
+.ENDIF # ENABLE_LAYOUT == TRUE
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=tabpages
+SRC1FILES = \
+ align.src \
+ autocdlg.src \
+ backgrnd.src \
+ bbdlg.src \
+ border.src \
+ chardlg.src \
+ connect.src \
+ dstribut.src \
+ grfpage.src \
+ macroass.src \
+ measure.src \
+ numfmt.src \
+ numpages.src \
+ page.src \
+ paragrph.src \
+ swpossizetabpage.src \
+ tabstpge.src \
+ textanim.src \
+ textattr.src \
+ labdlg.src \
+ tabarea.src \
+ tabline.src \
+ transfrm.src
+
+
+SLOFILES+=\
+ $(SLO)$/align.obj \
+ $(SLO)$/autocdlg.obj \
+ $(SLO)$/backgrnd.obj \
+ $(SLO)$/bbdlg.obj \
+ $(SLO)$/border.obj \
+ $(SLO)$/borderconn.obj \
+ $(SLO)$/chardlg.obj \
+ $(SLO)$/connect.obj \
+ $(SLO)$/dstribut.obj \
+ $(SLO)$/grfpage.obj \
+ $(SLO)$/labdlg.obj \
+ $(SLO)$/macroass.obj \
+ $(SLO)$/measure.obj \
+ $(SLO)$/numfmt.obj \
+ $(SLO)$/numpages.obj \
+ $(SLO)$/page.obj \
+ $(SLO)$/paragrph.obj \
+ $(SLO)$/swpossizetabpage.obj \
+ $(SLO)$/tabarea.obj \
+ $(SLO)$/tabline.obj \
+ $(SLO)$/tabstpge.obj \
+ $(SLO)$/textanim.obj \
+ $(SLO)$/textattr.obj \
+ $(SLO)$/tparea.obj \
+ $(SLO)$/tpbitmap.obj \
+ $(SLO)$/tpcolor.obj \
+ $(SLO)$/tpgradnt.obj \
+ $(SLO)$/tphatch.obj \
+ $(SLO)$/tpline.obj \
+ $(SLO)$/tplnedef.obj \
+ $(SLO)$/tplneend.obj \
+ $(SLO)$/tpshadow.obj \
+ $(SLO)$/transfrm.obj \
+
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx
new file mode 100644
index 000000000000..dc964f3f0080
--- /dev/null
+++ b/cui/source/tabpages/measure.cxx
@@ -0,0 +1,876 @@
+/*************************************************************************
+ *
+ * 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: measure.cxx,v $
+ * $Revision: 1.18 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <tools/shl.hxx>
+
+#include <svx/dialogs.hrc>
+
+#define _SVX_MEASURE_CXX
+
+#include <svx/svdomeas.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/svdattrx.hxx>
+#include <svx/svdview.hxx>
+
+#include "svx/measctrl.hxx"
+#include "measure.hxx"
+#include "measure.hrc"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include <svx/strarray.hxx>
+#include <sfx2/request.hxx> //add CHINA001
+#include "svx/ofaitem.hxx" //add CHINA001
+
+static USHORT pRanges[] =
+{
+ SDRATTR_MEASURE_FIRST,
+ SDRATTR_MEASURE_LAST,
+ 0
+};
+
+/*************************************************************************
+|*
+|* Dialog to change measure-attributes
+|*
+\************************************************************************/
+
+SvxMeasureDialog::SvxMeasureDialog( Window* pParent, const SfxItemSet& rInAttrs,
+ const SdrView* pSdrView ) :
+ SfxSingleTabDialog( pParent, rInAttrs, RID_SVXPAGE_MEASURE )
+{
+ SvxMeasurePage* _pPage = new SvxMeasurePage( this, rInAttrs );
+
+ _pPage->SetView( pSdrView );
+ _pPage->Construct();
+
+ SetTabPage( _pPage );
+ SetText( _pPage->GetText() );
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxMeasureDialog::~SvxMeasureDialog()
+{
+}
+
+/*************************************************************************
+|*
+|* Tabpage for changing measure-attributes
+|*
+\************************************************************************/
+
+SvxMeasurePage::SvxMeasurePage( Window* pWindow, const SfxItemSet& rInAttrs ) :
+ SvxTabPage ( pWindow, SVX_RES( RID_SVXPAGE_MEASURE ),
+ rInAttrs ),
+
+ aFlLine ( this, SVX_RES( FL_LINE ) ),
+ aFtLineDist ( this, SVX_RES( FT_LINE_DIST ) ),
+ aMtrFldLineDist ( this, SVX_RES( MTR_LINE_DIST ) ),
+ aFtHelplineOverhang ( this, SVX_RES( FT_HELPLINE_OVERHANG ) ),
+ aMtrFldHelplineOverhang ( this, SVX_RES( MTR_FLD_HELPLINE_OVERHANG ) ),
+ aFtHelplineDist ( this, SVX_RES( FT_HELPLINE_DIST ) ),
+ aMtrFldHelplineDist ( this, SVX_RES( MTR_FLD_HELPLINE_DIST ) ),
+ aFtHelpline1Len ( this, SVX_RES( FT_HELPLINE1_LEN ) ),
+ aMtrFldHelpline1Len ( this, SVX_RES( MTR_FLD_HELPLINE1_LEN ) ),
+ aFtHelpline2Len ( this, SVX_RES( FT_HELPLINE2_LEN ) ),
+ aMtrFldHelpline2Len ( this, SVX_RES( MTR_FLD_HELPLINE2_LEN ) ),
+ aTsbBelowRefEdge ( this, SVX_RES( TSB_BELOW_REF_EDGE ) ),
+ aFtDecimalPlaces ( this, SVX_RES( FT_DECIMALPLACES ) ),
+ aMtrFldDecimalPlaces ( this, SVX_RES( MTR_FLD_DECIMALPLACES ) ),
+
+ aFlLabel ( this, SVX_RES( FL_LABEL ) ),
+ aFtPosition ( this, SVX_RES( FT_POSITION ) ),
+ aCtlPosition ( this, SVX_RES( CTL_POSITION ) ),
+ aTsbAutoPosV ( this, SVX_RES( TSB_AUTOPOSV ) ),
+ aTsbAutoPosH ( this, SVX_RES( TSB_AUTOPOSH ) ),
+ aTsbShowUnit ( this, SVX_RES( TSB_SHOW_UNIT ) ),
+ aLbUnit ( this, SVX_RES( LB_UNIT ) ),
+ aTsbParallel ( this, SVX_RES( TSB_PARALLEL ) ),
+ aCtlPreview ( this, SVX_RES( CTL_PREVIEW ), rInAttrs ),
+
+ aFlVert ( this, SVX_RES( FL_VERT ) ),
+ rOutAttrs ( rInAttrs ),
+ aAttrSet ( *rInAttrs.GetPool() ),
+ pView( 0 ),
+
+ bPositionModified ( FALSE )
+{
+ FillUnitLB();
+
+ FreeResource();
+
+ const FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs );
+ SetFieldUnit( aMtrFldLineDist, eFUnit );
+ SetFieldUnit( aMtrFldHelplineOverhang, eFUnit );
+ SetFieldUnit( aMtrFldHelplineDist, eFUnit );
+ SetFieldUnit( aMtrFldHelpline1Len, eFUnit );
+ SetFieldUnit( aMtrFldHelpline2Len, eFUnit );
+ if( eFUnit == FUNIT_MM )
+ {
+ aMtrFldLineDist.SetSpinSize( 50 );
+ aMtrFldHelplineOverhang.SetSpinSize( 50 );
+ aMtrFldHelplineDist.SetSpinSize( 50 );
+ aMtrFldHelpline1Len.SetSpinSize( 50 );
+ aMtrFldHelpline2Len.SetSpinSize( 50 );
+ }
+
+ aTsbAutoPosV.SetClickHdl( LINK( this, SvxMeasurePage, ClickAutoPosHdl_Impl ) );
+ aTsbAutoPosH.SetClickHdl( LINK( this, SvxMeasurePage, ClickAutoPosHdl_Impl ) );
+
+ // set background and border of iconchoicectrl
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ aCtlPreview.SetBackground ( rStyles.GetWindowColor() );
+ aCtlPreview.SetBorderStyle(WINDOW_BORDER_MONO);
+
+ Link aLink( LINK( this, SvxMeasurePage, ChangeAttrHdl_Impl ) );
+ aMtrFldLineDist.SetModifyHdl( aLink );
+ aMtrFldHelplineOverhang.SetModifyHdl( aLink );
+ aMtrFldHelplineDist.SetModifyHdl( aLink );
+ aMtrFldHelpline1Len.SetModifyHdl( aLink );
+ aMtrFldHelpline2Len.SetModifyHdl( aLink );
+ aMtrFldDecimalPlaces.SetModifyHdl( aLink );
+ aTsbBelowRefEdge.SetClickHdl( aLink );
+ aTsbParallel.SetClickHdl( aLink );
+ aTsbShowUnit.SetClickHdl( aLink );
+ aLbUnit.SetSelectHdl( aLink );
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxMeasurePage::~SvxMeasurePage()
+{
+}
+
+/*************************************************************************
+|*
+|* read the delivered Item-Set
+|*
+\************************************************************************/
+
+void __EXPORT SvxMeasurePage::Reset( const SfxItemSet& rAttrs )
+{
+ SfxItemPool* pPool = rAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ eUnit = pPool->GetMetric( SDRATTR_MEASURELINEDIST );
+
+ const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_MEASURELINEDIST );
+
+ // SdrMeasureLineDistItem
+ if( pItem == NULL )
+ pItem = &pPool->GetDefaultItem( SDRATTR_MEASURELINEDIST );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrMeasureLineDistItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldLineDist, nValue, eUnit );
+ }
+ else
+ {
+ aMtrFldLineDist.SetText( String() );
+ }
+ aMtrFldLineDist.SaveValue();
+
+ // SdrMeasureHelplineOverhangItem
+ pItem = GetItem( rAttrs, SDRATTR_MEASUREHELPLINEOVERHANG );
+ if( pItem == NULL )
+ pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEOVERHANG );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrMeasureHelplineOverhangItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldHelplineOverhang, nValue, eUnit );
+ }
+ else
+ {
+ aMtrFldHelplineOverhang.SetText( String() );
+ }
+ aMtrFldHelplineOverhang.SaveValue();
+
+ // SdrMeasureHelplineDistItem
+ pItem = GetItem( rAttrs, SDRATTR_MEASUREHELPLINEDIST );
+ if( pItem == NULL )
+ pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEDIST );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrMeasureHelplineDistItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldHelplineDist, nValue, eUnit );
+ }
+ else
+ {
+ aMtrFldHelplineDist.SetText( String() );
+ }
+ aMtrFldHelplineDist.SaveValue();
+
+ // SdrMeasureHelpline1LenItem
+ pItem = GetItem( rAttrs, SDRATTR_MEASUREHELPLINE1LEN );
+ if( pItem == NULL )
+ pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE1LEN );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrMeasureHelpline1LenItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldHelpline1Len, nValue, eUnit );
+ }
+ else
+ {
+ aMtrFldHelpline1Len.SetText( String() );
+ }
+ aMtrFldHelpline1Len.SaveValue();
+
+ // SdrMeasureHelpline2LenItem
+ pItem = GetItem( rAttrs, SDRATTR_MEASUREHELPLINE2LEN );
+ if( pItem == NULL )
+ pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE2LEN );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrMeasureHelpline2LenItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldHelpline2Len, nValue, eUnit );
+ }
+ else
+ {
+ aMtrFldHelpline2Len.SetText( String() );
+ }
+ aMtrFldHelpline2Len.SaveValue();
+
+ // SdrMeasureBelowRefEdgeItem
+ if( rAttrs.GetItemState( SDRATTR_MEASUREBELOWREFEDGE ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbBelowRefEdge.SetState( ( ( const SdrMeasureBelowRefEdgeItem& )rAttrs.Get( SDRATTR_MEASUREBELOWREFEDGE ) ).
+ GetValue() ? STATE_CHECK : STATE_NOCHECK );
+ aTsbBelowRefEdge.EnableTriState( FALSE );
+ }
+ else
+ {
+ aTsbBelowRefEdge.SetState( STATE_DONTKNOW );
+ }
+ aTsbBelowRefEdge.SaveValue();
+
+ // SdrMeasureDecimalPlacesItem
+ pItem = GetItem( rAttrs, SDRATTR_MEASUREDECIMALPLACES );
+ if( pItem == NULL )
+ pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREDECIMALPLACES );
+ if( pItem )
+ {
+ INT16 nValue = ( ( const SdrMeasureDecimalPlacesItem* )pItem )->GetValue();
+ aMtrFldDecimalPlaces.SetValue( nValue );
+ }
+ else
+ {
+ aMtrFldDecimalPlaces.SetText( String() );
+ }
+ aMtrFldDecimalPlaces.SaveValue();
+
+ // SdrMeasureTextRota90Item
+ // Attention: negate !
+ if( rAttrs.GetItemState( SDRATTR_MEASURETEXTROTA90 ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbParallel.SetState( ( ( const SdrMeasureTextRota90Item& )rAttrs.Get( SDRATTR_MEASURETEXTROTA90 ) ).
+ GetValue() ? STATE_NOCHECK : STATE_CHECK );
+ aTsbParallel.EnableTriState( FALSE );
+ }
+ else
+ {
+ aTsbParallel.SetState( STATE_DONTKNOW );
+ }
+ aTsbParallel.SaveValue();
+
+ // SdrMeasureShowUnitItem
+ if( rAttrs.GetItemState( SDRATTR_MEASURESHOWUNIT ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbShowUnit.SetState( ( ( const SdrMeasureShowUnitItem& )rAttrs.Get( SDRATTR_MEASURESHOWUNIT ) ).
+ GetValue() ? STATE_CHECK : STATE_NOCHECK );
+ aTsbShowUnit.EnableTriState( FALSE );
+ }
+ else
+ {
+ aTsbShowUnit.SetState( STATE_DONTKNOW );
+ }
+ aTsbShowUnit.SaveValue();
+
+ // SdrMeasureUnitItem
+ if( rAttrs.GetItemState( SDRATTR_MEASUREUNIT ) != SFX_ITEM_DONTCARE )
+ {
+ long nFieldUnit = (long) ( ( const SdrMeasureUnitItem& )rAttrs.
+ Get( SDRATTR_MEASUREUNIT ) ).GetValue();
+
+ for( USHORT i = 0; i < aLbUnit.GetEntryCount(); ++i )
+ {
+ if ( (long)aLbUnit.GetEntryData( i ) == nFieldUnit )
+ {
+ aLbUnit.SelectEntryPos( i );
+ break;
+ }
+ }
+ }
+ else
+ {
+ aLbUnit.SetNoSelection();
+ }
+ aLbUnit.SaveValue();
+
+ // Position
+ if ( rAttrs.GetItemState( SDRATTR_MEASURETEXTVPOS ) != SFX_ITEM_DONTCARE )
+ {
+ SdrMeasureTextVPos eVPos = (SdrMeasureTextVPos)
+ ( ( const SdrMeasureTextVPosItem& )rAttrs.Get( SDRATTR_MEASURETEXTVPOS ) ).GetValue();
+ {
+ if ( rAttrs.GetItemState( SDRATTR_MEASURETEXTHPOS ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbAutoPosV.EnableTriState( FALSE );
+ aTsbAutoPosH.EnableTriState( FALSE );
+
+ SdrMeasureTextHPos eHPos = (SdrMeasureTextHPos)
+ ( ( const SdrMeasureTextHPosItem& )rAttrs.Get( SDRATTR_MEASURETEXTHPOS ) ).GetValue();
+ RECT_POINT eRP = RP_MM;
+ switch( eVPos )
+ {
+ case SDRMEASURE_ABOVE:
+ switch( eHPos )
+ {
+ case SDRMEASURE_TEXTLEFTOUTSIDE: eRP = RP_LT; break;
+ case SDRMEASURE_TEXTINSIDE: eRP = RP_MT; break;
+ case SDRMEASURE_TEXTRIGHTOUTSIDE: eRP = RP_RT; break;
+ case SDRMEASURE_TEXTHAUTO: eRP = RP_MT; break;
+ }
+ break;
+ case SDRMEASURETEXT_VERTICALCENTERED:
+ switch( eHPos )
+ {
+ case SDRMEASURE_TEXTLEFTOUTSIDE: eRP = RP_LM; break;
+ case SDRMEASURE_TEXTINSIDE: eRP = RP_MM; break;
+ case SDRMEASURE_TEXTRIGHTOUTSIDE: eRP = RP_RM; break;
+ case SDRMEASURE_TEXTHAUTO: eRP = RP_MM; break;
+ }
+ break;
+ case SDRMEASURE_BELOW:
+ switch( eHPos )
+ {
+ case SDRMEASURE_TEXTLEFTOUTSIDE: eRP = RP_LB; break;
+ case SDRMEASURE_TEXTINSIDE: eRP = RP_MB; break;
+ case SDRMEASURE_TEXTRIGHTOUTSIDE: eRP = RP_RB; break;
+ case SDRMEASURE_TEXTHAUTO: eRP = RP_MB; break;
+ }
+ break;
+ case SDRMEASURE_TEXTVAUTO:
+ switch( eHPos )
+ {
+ case SDRMEASURE_TEXTLEFTOUTSIDE: eRP = RP_LM; break;
+ case SDRMEASURE_TEXTINSIDE: eRP = RP_MM; break;
+ case SDRMEASURE_TEXTRIGHTOUTSIDE: eRP = RP_RM; break;
+ case SDRMEASURE_TEXTHAUTO: eRP = RP_MM; break;
+ }
+ break;
+ default: ;//prevent warning
+ }
+
+ CTL_STATE nState = 0;
+
+ if( eHPos == SDRMEASURE_TEXTHAUTO )
+ {
+ aTsbAutoPosH.SetState( STATE_CHECK );
+ nState = CS_NOHORZ;
+ }
+
+ if( eVPos == SDRMEASURE_TEXTVAUTO )
+ {
+ aTsbAutoPosV.SetState( STATE_CHECK );
+ nState |= CS_NOVERT;
+ }
+
+ aCtlPosition.SetState( nState );
+ aCtlPosition.SetActualRP( eRP );
+ }
+ }
+ }
+ else
+ {
+ aCtlPosition.Reset();
+ aTsbAutoPosV.SetState( STATE_DONTKNOW );
+ aTsbAutoPosH.SetState( STATE_DONTKNOW );
+ }
+
+ // put the attributes to the preview-control,
+ // otherwise the control don't know about
+ // the settings of the dialog (#67930)
+ ChangeAttrHdl_Impl( &aTsbShowUnit );
+ aCtlPreview.SetAttributes( rAttrs );
+
+ bPositionModified = FALSE;
+}
+
+/*************************************************************************
+|*
+|* Fill the delivered Item-Set with dialogbox-attributes
+|*
+\************************************************************************/
+
+BOOL SvxMeasurePage::FillItemSet( SfxItemSet& rAttrs)
+{
+ BOOL bModified = FALSE;
+ INT32 nValue;
+ TriState eState;
+
+ if( aMtrFldLineDist.GetText() != aMtrFldLineDist.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldLineDist, eUnit );
+ rAttrs.Put( SdrMeasureLineDistItem( nValue ) );
+ bModified = TRUE;
+ }
+
+ if( aMtrFldHelplineOverhang.GetText() != aMtrFldHelplineOverhang.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldHelplineOverhang, eUnit );
+ rAttrs.Put( SdrMeasureHelplineOverhangItem( nValue ) );
+ bModified = TRUE;
+ }
+
+ if( aMtrFldHelplineDist.GetText() != aMtrFldHelplineDist.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldHelplineDist, eUnit );
+ rAttrs.Put( SdrMeasureHelplineDistItem( nValue ) );
+ bModified = TRUE;
+ }
+
+ if( aMtrFldHelpline1Len.GetText() != aMtrFldHelpline1Len.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldHelpline1Len, eUnit );
+ rAttrs.Put( SdrMeasureHelpline1LenItem( nValue ) );
+ bModified = TRUE;
+ }
+
+ if( aMtrFldHelpline2Len.GetText() != aMtrFldHelpline2Len.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldHelpline2Len, eUnit );
+ rAttrs.Put( SdrMeasureHelpline2LenItem( nValue ) );
+ bModified = TRUE;
+ }
+
+ eState = aTsbBelowRefEdge.GetState();
+ if( eState != aTsbBelowRefEdge.GetSavedValue() )
+ {
+ rAttrs.Put( SdrMeasureBelowRefEdgeItem( (BOOL) STATE_CHECK == eState ) );
+ bModified = TRUE;
+ }
+
+ if( aMtrFldDecimalPlaces.GetText() != aMtrFldDecimalPlaces.GetSavedValue() )
+ {
+ nValue = static_cast<INT32>(aMtrFldDecimalPlaces.GetValue());
+ rAttrs.Put(
+ SdrMeasureDecimalPlacesItem(
+ sal::static_int_cast< INT16 >( nValue ) ) );
+ bModified = TRUE;
+ }
+
+ eState = aTsbParallel.GetState();
+ if( eState != aTsbParallel.GetSavedValue() )
+ {
+ rAttrs.Put( SdrMeasureTextRota90Item( (BOOL) STATE_NOCHECK == eState ) );
+ bModified = TRUE;
+ }
+
+ eState = aTsbShowUnit.GetState();
+ if( eState != aTsbShowUnit.GetSavedValue() )
+ {
+ rAttrs.Put( SdrMeasureShowUnitItem( (BOOL) STATE_CHECK == eState ) );
+ bModified = TRUE;
+ }
+
+ USHORT nPos = aLbUnit.GetSelectEntryPos();
+ if( nPos != aLbUnit.GetSavedValue() )
+ {
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ USHORT nFieldUnit = (USHORT)(long)aLbUnit.GetEntryData( nPos );
+ FieldUnit _eUnit = (FieldUnit) nFieldUnit;
+ rAttrs.Put( SdrMeasureUnitItem( _eUnit ) );
+ bModified = TRUE;
+ }
+ }
+
+//enum SdrMeasureTextHPos {SDRMEASURE_TEXTHAUTO,SDRMEASURE_TEXTLEFTOUTSIDE,SDRMEASURE_TEXTINSIDE,SDRMEASURE_TEXTRIGHTOUTSIDE};
+//enum SdrMeasureTextVPos {SDRMEASURE_TEXTVAUTO,SDRMEASURE_ABOVE,SDRMEASURETEXT_VERTICALCENTERED,SDRMEASURE_BELOW};
+
+ if( bPositionModified )
+ {
+ // Position
+ SdrMeasureTextVPos eVPos, eOldVPos;
+ SdrMeasureTextHPos eHPos, eOldHPos;
+
+ RECT_POINT eRP = aCtlPosition.GetActualRP();
+ switch( eRP )
+ {
+ default:
+ case RP_LT: eVPos = SDRMEASURE_ABOVE;
+ eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break;
+ case RP_LM: eVPos = SDRMEASURETEXT_VERTICALCENTERED;
+ eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break;
+ case RP_LB: eVPos = SDRMEASURE_BELOW;
+ eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break;
+ case RP_MT: eVPos = SDRMEASURE_ABOVE;
+ eHPos = SDRMEASURE_TEXTINSIDE; break;
+ case RP_MM: eVPos = SDRMEASURETEXT_VERTICALCENTERED;
+ eHPos = SDRMEASURE_TEXTINSIDE; break;
+ case RP_MB: eVPos = SDRMEASURE_BELOW;
+ eHPos = SDRMEASURE_TEXTINSIDE; break;
+ case RP_RT: eVPos = SDRMEASURE_ABOVE;
+ eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break;
+ case RP_RM: eVPos = SDRMEASURETEXT_VERTICALCENTERED;
+ eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break;
+ case RP_RB: eVPos = SDRMEASURE_BELOW;
+ eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break;
+ }
+ if( aTsbAutoPosH.GetState() == STATE_CHECK )
+ eHPos = SDRMEASURE_TEXTHAUTO;
+
+ if( aTsbAutoPosV.GetState() == STATE_CHECK )
+ eVPos = SDRMEASURE_TEXTVAUTO;
+
+ if ( rAttrs.GetItemState( SDRATTR_MEASURETEXTVPOS ) != SFX_ITEM_DONTCARE )
+ {
+ eOldVPos = (SdrMeasureTextVPos)
+ ( ( const SdrMeasureTextVPosItem& )rOutAttrs.Get( SDRATTR_MEASURETEXTVPOS ) ).GetValue();
+ if( eOldVPos != eVPos )
+ {
+ rAttrs.Put( SdrMeasureTextVPosItem( eVPos ) );
+ bModified = TRUE;
+ }
+ }
+ else
+ {
+ rAttrs.Put( SdrMeasureTextVPosItem( eVPos ) );
+ bModified = TRUE;
+ }
+
+ if ( rAttrs.GetItemState( SDRATTR_MEASURETEXTHPOS ) != SFX_ITEM_DONTCARE )
+ {
+ eOldHPos = (SdrMeasureTextHPos)
+ ( ( const SdrMeasureTextHPosItem& )rOutAttrs.Get( SDRATTR_MEASURETEXTHPOS ) ).GetValue();
+ if( eOldHPos != eHPos )
+ {
+ rAttrs.Put( SdrMeasureTextHPosItem( eHPos ) );
+ bModified = TRUE;
+ }
+ }
+ else
+ {
+ rAttrs.Put( SdrMeasureTextHPosItem( eHPos ) );
+ bModified = TRUE;
+ }
+ }
+
+ return( bModified );
+}
+
+/*************************************************************************
+|*
+|* The View have to set at the measure-object to be able to notify
+|* unit and floatingpoint-values
+|*
+\************************************************************************/
+
+void SvxMeasurePage::Construct()
+{
+ DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
+
+ aCtlPreview.pMeasureObj->SetModel( pView->GetModel() );
+ aCtlPreview.Invalidate();
+}
+
+/*************************************************************************
+|*
+|* create the tabpage
+|*
+\************************************************************************/
+
+SfxTabPage* SvxMeasurePage::Create( Window* pWindow,
+ const SfxItemSet& rAttrs )
+{
+ return( new SvxMeasurePage( pWindow, rAttrs ) );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+USHORT* SvxMeasurePage::GetRanges()
+{
+ return( pRanges );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxMeasurePage::PointChanged( Window* pWindow, RECT_POINT /*eRP*/ )
+{
+ ChangeAttrHdl_Impl( pWindow );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxMeasurePage, ClickAutoPosHdl_Impl, void *, p )
+{
+ if( aTsbAutoPosH.GetState() == STATE_CHECK )
+ {
+ switch( aCtlPosition.GetActualRP() )
+ {
+ case RP_LT:
+ case RP_RT:
+ aCtlPosition.SetActualRP( RP_MT );
+ break;
+
+ case RP_LM:
+ case RP_RM:
+ aCtlPosition.SetActualRP( RP_MM );
+ break;
+
+ case RP_LB:
+ case RP_RB:
+ aCtlPosition.SetActualRP( RP_MB );
+ break;
+ default: ;//prevent warning
+ }
+ }
+ if( aTsbAutoPosV.GetState() == STATE_CHECK )
+ {
+ switch( aCtlPosition.GetActualRP() )
+ {
+ case RP_LT:
+ case RP_LB:
+ aCtlPosition.SetActualRP( RP_LM );
+ break;
+
+ case RP_MT:
+ case RP_MB:
+ aCtlPosition.SetActualRP( RP_MM );
+ break;
+
+ case RP_RT:
+ case RP_RB:
+ aCtlPosition.SetActualRP( RP_RM );
+ break;
+ default: ;//prevent warning
+ }
+ }
+ ChangeAttrHdl_Impl( p );
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxMeasurePage, ChangeAttrHdl_Impl, void *, p )
+{
+
+ if( p == &aMtrFldLineDist )
+ {
+ INT32 nValue = GetCoreValue( aMtrFldLineDist, eUnit );
+ aAttrSet.Put( SdrMeasureLineDistItem( nValue ) );
+ }
+
+ if( p == &aMtrFldHelplineOverhang )
+ {
+ INT32 nValue = GetCoreValue( aMtrFldHelplineOverhang, eUnit );
+ aAttrSet.Put( SdrMeasureHelplineOverhangItem( nValue) );
+ }
+
+ if( p == &aMtrFldHelplineDist )
+ {
+ INT32 nValue = GetCoreValue( aMtrFldHelplineDist, eUnit );
+ aAttrSet.Put( SdrMeasureHelplineDistItem( nValue) );
+ }
+
+ if( p == &aMtrFldHelpline1Len )
+ {
+ INT32 nValue = GetCoreValue( aMtrFldHelpline1Len, eUnit );
+ aAttrSet.Put( SdrMeasureHelpline1LenItem( nValue ) );
+ }
+
+ if( p == &aMtrFldHelpline2Len )
+ {
+ INT32 nValue = GetCoreValue( aMtrFldHelpline2Len, eUnit );
+ aAttrSet.Put( SdrMeasureHelpline2LenItem( nValue ) );
+ }
+
+ if( p == &aTsbBelowRefEdge )
+ {
+ TriState eState = aTsbBelowRefEdge.GetState();
+ if( eState != STATE_DONTKNOW )
+ aAttrSet.Put( SdrMeasureBelowRefEdgeItem( (BOOL) STATE_CHECK == eState ) );
+ }
+
+ if( p == &aMtrFldDecimalPlaces )
+ {
+ INT16 nValue = sal::static_int_cast< INT16 >(
+ aMtrFldDecimalPlaces.GetValue() );
+ aAttrSet.Put( SdrMeasureDecimalPlacesItem( nValue ) );
+ }
+
+ if( p == &aTsbParallel )
+ {
+ TriState eState = aTsbParallel.GetState();
+ if( eState != STATE_DONTKNOW )
+ aAttrSet.Put( SdrMeasureTextRota90Item( (BOOL) !STATE_CHECK == eState ) );
+ }
+
+ if( p == &aTsbShowUnit )
+ {
+ TriState eState = aTsbShowUnit.GetState();
+ if( eState != STATE_DONTKNOW )
+ aAttrSet.Put( SdrMeasureShowUnitItem( (BOOL) STATE_CHECK == eState ) );
+ }
+
+ if( p == &aLbUnit )
+ {
+ USHORT nPos = aLbUnit.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ USHORT nFieldUnit = (USHORT)(long)aLbUnit.GetEntryData( nPos );
+ FieldUnit _eUnit = (FieldUnit) nFieldUnit;
+ aAttrSet.Put( SdrMeasureUnitItem( _eUnit ) );
+ }
+ }
+
+ if( p == &aTsbAutoPosV || p == &aTsbAutoPosH || p == &aCtlPosition )
+ {
+ bPositionModified = TRUE;
+
+ // Position
+ RECT_POINT eRP = aCtlPosition.GetActualRP();
+ SdrMeasureTextVPos eVPos;
+ SdrMeasureTextHPos eHPos;
+
+ switch( eRP )
+ {
+ default:
+ case RP_LT: eVPos = SDRMEASURE_ABOVE;
+ eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break;
+ case RP_LM: eVPos = SDRMEASURETEXT_VERTICALCENTERED;
+ eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break;
+ case RP_LB: eVPos = SDRMEASURE_BELOW;
+ eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break;
+ case RP_MT: eVPos = SDRMEASURE_ABOVE;
+ eHPos = SDRMEASURE_TEXTINSIDE; break;
+ case RP_MM: eVPos = SDRMEASURETEXT_VERTICALCENTERED;
+ eHPos = SDRMEASURE_TEXTINSIDE; break;
+ case RP_MB: eVPos = SDRMEASURE_BELOW;
+ eHPos = SDRMEASURE_TEXTINSIDE; break;
+ case RP_RT: eVPos = SDRMEASURE_ABOVE;
+ eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break;
+ case RP_RM: eVPos = SDRMEASURETEXT_VERTICALCENTERED;
+ eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break;
+ case RP_RB: eVPos = SDRMEASURE_BELOW;
+ eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break;
+ }
+
+ CTL_STATE nState = 0;
+
+ if( aTsbAutoPosH.GetState() == STATE_CHECK )
+ {
+ eHPos = SDRMEASURE_TEXTHAUTO;
+ nState = CS_NOHORZ;
+ }
+
+ if( aTsbAutoPosV.GetState() == STATE_CHECK )
+ {
+ eVPos = SDRMEASURE_TEXTVAUTO;
+ nState |= CS_NOVERT;
+ }
+
+ if( p == &aTsbAutoPosV || p == &aTsbAutoPosH )
+ aCtlPosition.SetState( nState );
+
+ aAttrSet.Put( SdrMeasureTextVPosItem( eVPos ) );
+ aAttrSet.Put( SdrMeasureTextHPosItem( eHPos ) );
+ }
+
+ aCtlPreview.SetAttributes( aAttrSet );
+ aCtlPreview.Invalidate();
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxMeasurePage::FillUnitLB()
+{
+ // fill ListBox with metrics
+ SvxStringArray aMetricArr( RID_SVXSTR_FIELDUNIT_TABLE );
+
+ long nUnit = FUNIT_NONE;
+ String aStrMetric( SVX_RES( STR_MEASURE_AUTOMATIC ) );
+ USHORT nPos = aLbUnit.InsertEntry( aStrMetric );
+ aLbUnit.SetEntryData( nPos, (void*)nUnit );
+
+ for( USHORT i = 0; i < aMetricArr.Count(); ++i )
+ {
+ aStrMetric = aMetricArr.GetStringByPos( i );
+ nUnit = aMetricArr.GetValue( i );
+ nPos = aLbUnit.InsertEntry( aStrMetric );
+ aLbUnit.SetEntryData( nPos, (void*)nUnit );
+ }
+}
+void SvxMeasurePage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pOfaPtrItem,OfaPtrItem,SID_OBJECT_LIST,sal_False);
+
+ if (pOfaPtrItem)
+ SetView( static_cast<SdrView *>(pOfaPtrItem->GetValue()));
+
+ Construct();
+}
+
diff --git a/cui/source/tabpages/measure.hrc b/cui/source/tabpages/measure.hrc
new file mode 100644
index 000000000000..b06a36775b3b
--- /dev/null
+++ b/cui/source/tabpages/measure.hrc
@@ -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: measure.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_LINE 1
+#define FL_LABEL 2
+#define FL_VERT 3
+
+#define FT_LINE_DIST 1
+#define FT_HELPLINE_OVERHANG 2
+#define FT_HELPLINE_DIST 3
+#define FT_HELPLINE1_LEN 4
+#define FT_HELPLINE2_LEN 5
+#define FT_POSITION 6
+#define FT_DECIMALPLACES 7
+#define MTR_LINE_DIST 1
+#define MTR_FLD_HELPLINE_OVERHANG 2
+#define MTR_FLD_HELPLINE_DIST 3
+#define MTR_FLD_HELPLINE1_LEN 4
+#define MTR_FLD_HELPLINE2_LEN 5
+#define MTR_FLD_DECIMALPLACES 6
+#define TSB_BELOW_REF_EDGE 1
+#define TSB_SHOW_UNIT 2
+#define TSB_AUTOPOSV 3
+#define TSB_AUTOPOSH 4
+#define TSB_PARALLEL 5
+#define CTL_POSITION 1
+#define CTL_PREVIEW 2
+#define LB_UNIT 1
+
+#define STR_MEASURE_AUTOMATIC 1
diff --git a/cui/source/tabpages/measure.src b/cui/source/tabpages/measure.src
new file mode 100644
index 000000000000..df394e4bdbe3
--- /dev/null
+++ b/cui/source/tabpages/measure.src
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * 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: measure.src,v $
+ * $Revision: 1.30 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+#include "measure.hrc"
+#include "helpid.hrc"
+#define DELTA 20
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXPAGE_MEASURE ---------------------------------------------------
+TabPage RID_SVXPAGE_MEASURE
+{
+ HelpId = HID_PAGE_MEASURE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Dimensioning" ;
+
+ FixedLine FL_LINE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Line";
+ };
+ FixedText FT_LINE_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 65 , 8 ) ;
+ Text [ en-US ] = "Line ~distance" ;
+ };
+ MetricField MTR_LINE_DIST
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 78 , 14 ) ;
+ Size = MAP_APPFONT ( 42 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Unit = FUNIT_MM ;
+ DecimalDigits = 2 ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_HELPLINE_OVERHANG
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 65 , 8 ) ;
+ Text [ en-US ] = "Guide ~overhang" ;
+ };
+ MetricField MTR_FLD_HELPLINE_OVERHANG
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 78 , 30 ) ;
+ Size = MAP_APPFONT ( 42 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Unit = FUNIT_MM ;
+ DecimalDigits = 2 ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_HELPLINE_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 65 , 8 ) ;
+ Text [ en-US ] = "~Guide distance" ;
+ };
+ MetricField MTR_FLD_HELPLINE_DIST
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 78 , 46 ) ;
+ Size = MAP_APPFONT ( 42 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Unit = FUNIT_MM ;
+ DecimalDigits = 2 ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_HELPLINE1_LEN
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 65 , 8 ) ;
+ Text [ en-US ] = "~Left guide" ;
+ };
+ MetricField MTR_FLD_HELPLINE1_LEN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 78 , 62 ) ;
+ Size = MAP_APPFONT ( 42 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Unit = FUNIT_MM ;
+ DecimalDigits = 2 ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_HELPLINE2_LEN
+ {
+ Pos = MAP_APPFONT ( 12 , 80 ) ;
+ Size = MAP_APPFONT ( 65 , 8 ) ;
+ Text [ en-US ] = "~Right guide" ;
+ };
+ MetricField MTR_FLD_HELPLINE2_LEN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 78 , 78 ) ;
+ Size = MAP_APPFONT ( 42 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Unit = FUNIT_MM ;
+ DecimalDigits = 2 ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ };
+ TriStateBox TSB_BELOW_REF_EDGE
+ {
+ Pos = MAP_APPFONT ( 12 , 96 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Measure ~below object";
+ };
+ FixedText FT_DECIMALPLACES
+ {
+ Pos = MAP_APPFONT ( 12 , 112 ) ;
+ Size = MAP_APPFONT ( 65 , 8 ) ;
+
+ Text [ en-US ] = "Decimal places" ;
+ };
+ MetricField MTR_FLD_DECIMALPLACES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 78 , 110 ) ;
+ Size = MAP_APPFONT ( 42 , 12 ) ;
+ TabStop = TRUE ;
+ Right = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ StrictFormat = TRUE ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ };
+ FixedLine FL_VERT
+ {
+ Pos = MAP_APPFONT ( 127 , 14 ) ;
+ Size = MAP_APPFONT ( 4 , 108 ) ;
+ Vert = TRUE ;
+ };
+ FixedLine FL_LABEL
+ {
+ Pos = MAP_APPFONT ( 132 , 3 ) ;
+ Size = MAP_APPFONT ( 122 , 8 ) ;
+ Text [ en-US ] = "Legend";
+ };
+ FixedText FT_POSITION
+ {
+ Pos = MAP_APPFONT ( 138 , 14 ) ;
+ Size = MAP_APPFONT ( 110 , 8 ) ;
+ Text [ en-US ] = "~Text position" ;
+ };
+ Control CTL_POSITION
+ {
+ HelpId = HID_MEASURE_CTL_POSITION ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 154 , 25 ) ;
+ Size = MAP_APPFONT ( 60 , 24 ) ;
+ TabStop = TRUE ;
+ };
+ TriStateBox TSB_AUTOPOSV
+ {
+ Pos = MAP_APPFONT ( 154 , 54 ) ;
+ Size = MAP_APPFONT ( 101 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~AutoVertical" ;
+ };
+ TriStateBox TSB_AUTOPOSH
+ {
+ Pos = MAP_APPFONT ( 154 , 68 ) ;
+ Size = MAP_APPFONT ( 101 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "A~utoHorizontal" ;
+ };
+ TriStateBox TSB_PARALLEL
+ {
+ Pos = MAP_APPFONT ( 138 , 82 ) ;
+ Size = MAP_APPFONT ( 110 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Parallel to line";
+ };
+ TriStateBox TSB_SHOW_UNIT
+ {
+ Pos = MAP_APPFONT ( 138 , 96 ) ;
+ Size = MAP_APPFONT ( 64+40 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Show ~meas. units" ;
+ };
+ ListBox LB_UNIT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 154 , 110 ) ;
+ Size = MAP_APPFONT ( 60 , 80+35 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ Control CTL_PREVIEW
+ {
+ HelpId = HID_MEASURE_CTL_PREVIEW ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 132 ) ;
+ Size = MAP_APPFONT ( 248 , 47 ) ;
+ };
+ String STR_MEASURE_AUTOMATIC
+ {
+ Text [ en-US ] = "Automatic" ;
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
new file mode 100644
index 000000000000..1dbd8e46963d
--- /dev/null
+++ b/cui/source/tabpages/numfmt.cxx
@@ -0,0 +1,1953 @@
+/*************************************************************************
+ *
+ * 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: numfmt.cxx,v $
+ * $Revision: 1.32.128.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#if !ENABLE_LAYOUT_EXPERIMENTAL
+//#undef ENABLE_LAYOUT
+#endif
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <i18npool/lang.h>
+
+#define _SVSTDARR_STRINGS
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#include <svtools/colorcfg.hxx>
+
+#define _SVX_NUMFMT_CXX
+
+#include <svx/dialogs.hrc>
+#include "numfmt.hrc"
+
+#include <svx/numinf.hxx>
+
+#include "numfmt.hxx"
+#include <svx/numfmtsh.hxx>
+#include <svx/dialmgr.hxx>
+#include <sfx2/request.hxx> //CHINA001
+#include <sfx2/app.hxx> //CHINA001
+#include <sfx2/basedlgs.hxx>
+#include "svx/flagsdef.hxx" //CHINA001
+
+#define NUMKEY_UNDEFINED SAL_MAX_UINT32
+
+// static ----------------------------------------------------------------
+
+static USHORT pRanges[] =
+{
+ SID_ATTR_NUMBERFORMAT_VALUE,
+ SID_ATTR_NUMBERFORMAT_INFO,
+ SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
+ SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
+ SID_ATTR_NUMBERFORMAT_ONE_AREA,
+ SID_ATTR_NUMBERFORMAT_ONE_AREA,
+ SID_ATTR_NUMBERFORMAT_SOURCE,
+ SID_ATTR_NUMBERFORMAT_SOURCE,
+ 0
+};
+
+/*************************************************************************
+#* Methode: SvxNumberPreviewImpl Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberPreview
+#*
+#* Funktion: Konstruktor der Klasse SvxNumberPreviewImpl
+#*
+#* Input: Fenster, Resource-ID
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+SvxNumberPreviewImpl::SvxNumberPreviewImpl( Window* pParent, const ResId& rResId ) :
+
+ Window( pParent, rResId )
+
+{
+ Font aFont( GetFont() );
+ aFont.SetTransparent( TRUE );
+ aFont.SetColor( Application::GetSettings().GetStyleSettings().GetFieldColor() );
+ SetFont( aFont );
+ InitSettings( TRUE, TRUE );
+ SetBorderStyle( WINDOW_BORDER_MONO );
+}
+
+/*************************************************************************
+#* Methode: SvxNumberPreviewImpl Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberPreview
+#*
+#* Funktion: Destruktor der Klasse SvxNumberPreviewImpl
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+SvxNumberPreviewImpl::~SvxNumberPreviewImpl()
+{
+}
+
+/*************************************************************************
+#* Methode: NotifyChange Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberPreviewImpl
+#*
+#* Funktion: Funktion fuer das Aendern des Preview- Strings
+#*
+#* Input: String, Farbe
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void SvxNumberPreviewImpl::NotifyChange( const String& rPrevStr,
+ const Color* pColor )
+{
+ aPrevStr = rPrevStr;
+ svtools::ColorConfig aColorConfig;
+ Color aWindowTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+ aPrevCol = pColor ? *pColor : aWindowTextColor;
+ Invalidate();
+ Update();
+}
+
+/*************************************************************************
+#* Methode: Paint Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberPreviewImpl
+#*
+#* Funktion: Funktion fuer das neu zeichnen des Fensters.
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void SvxNumberPreviewImpl::Paint( const Rectangle& )
+{
+ Font aDrawFont = GetFont();
+ Size aSzWnd = GetOutputSizePixel();
+ Point aPosText = Point( (aSzWnd.Width() - GetTextWidth( aPrevStr )) /2,
+ (aSzWnd.Height() - GetTextHeight())/2 );
+
+ aDrawFont.SetColor( aPrevCol );
+ SetFont( aDrawFont );
+ DrawText( aPosText, aPrevStr );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberPreviewImpl::InitSettings( BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ if ( bForeground )
+ {
+ svtools::ColorConfig aColorConfig;
+ Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+
+ if ( IsControlForeground() )
+ aTextColor = GetControlForeground();
+ SetTextColor( aTextColor );
+ }
+
+ if ( bBackground )
+ {
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetWindowColor() );
+ }
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberPreviewImpl::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ InitSettings( TRUE, FALSE );
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ InitSettings( FALSE, TRUE );
+
+ Window::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberPreviewImpl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitSettings( TRUE, TRUE );
+}
+
+// class SvxNumberFormatTabPage ------------------------------------------
+
+#define REMOVE_DONTKNOW() \
+ if ( !aFtLanguage.IsEnabled() ) \
+ { \
+ aFtLanguage .Enable(); \
+ aLbLanguage .Enable(); \
+ aLbLanguage .SelectLanguage( pNumFmtShell->GetCurLanguage() ); \
+ }
+
+#define HDL(hdl) LINK( this, SvxNumberFormatTabPage, hdl )
+
+#include <layout/layout-pre.hxx>
+
+#if ENABLE_LAYOUT
+#undef SVX_RES
+#define SVX_RES(x) #x
+#define SVX_RES_PLAIN(x) ResId (x, DIALOG_MGR ())
+#define THIS_SVX_RES(x) this, #x
+#undef SfxTabPage
+#define SfxTabPage( parent, id, args ) SfxTabPage( parent, "number-format.xml", id, &args )
+#else /* !ENABLE_LAYOUT */
+#define SVX_RES_PLAIN SVX_RES
+#define THIS_SVX_RES SVX_RES
+#endif /* !ENABLE_LAYOUT */
+
+SvxNumberFormatTabPage::SvxNumberFormatTabPage( Window* pParent,
+ const SfxItemSet& rCoreAttrs )
+
+ : SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_NUMBERFORMAT ), rCoreAttrs ),
+
+ aFtCategory ( this, SVX_RES( FT_CATEGORY ) ),
+ aLbCategory ( this, SVX_RES( LB_CATEGORY ) ),
+ aFtFormat ( this, SVX_RES( FT_FORMAT ) ),
+ aLbCurrency ( this, SVX_RES( LB_CURRENCY) ),
+ aLbFormat ( this, SVX_RES( LB_FORMAT ) ),
+ aFtLanguage ( this, SVX_RES( FT_LANGUAGE ) ),
+ aLbLanguage ( this, SVX_RES( LB_LANGUAGE ), FALSE ),
+ aCbSourceFormat ( this, SVX_RES( CB_SOURCEFORMAT ) ),
+ aFtDecimals ( this, SVX_RES( FT_DECIMALS ) ),
+ aEdDecimals ( this, SVX_RES( ED_DECIMALS ) ),
+ aFtLeadZeroes ( this, SVX_RES( FT_LEADZEROES ) ),
+ aEdLeadZeroes ( this, SVX_RES( ED_LEADZEROES ) ),
+ aBtnNegRed ( this, SVX_RES( BTN_NEGRED ) ),
+ aBtnThousand ( this, SVX_RES( BTN_THOUSAND ) ),
+ aFlOptions ( this, SVX_RES( FL_OPTIONS ) ),
+
+ aFtEdFormat ( this, SVX_RES( FT_EDFORMAT ) ),
+ aEdFormat ( this, SVX_RES( ED_FORMAT ) ),
+ aIbAdd ( this, SVX_RES( IB_ADD ) ),
+ aIbInfo ( this, SVX_RES( IB_INFO ) ),
+ aIbRemove ( this, SVX_RES( IB_REMOVE ) ),
+ aFtComment ( this, SVX_RES( FT_COMMENT ) ),
+ aEdComment ( this, SVX_RES( ED_COMMENT ) ),
+
+#if ENABLE_LAYOUT
+ aWndPreview ( LAYOUT_THIS_WINDOW(this), SVX_RES_PLAIN( WND_NUMBER_PREVIEW ) ),
+#else
+ aWndPreview ( this, SVX_RES_PLAIN( WND_NUMBER_PREVIEW ) ),
+#endif
+ pNumItem ( NULL ),
+ pNumFmtShell ( NULL ),
+ nInitFormat ( ULONG_MAX ),
+
+ sAutomaticEntry ( THIS_SVX_RES( STR_AUTO_ENTRY)),
+ pLastActivWindow( NULL )
+{
+#if ENABLE_LAYOUT
+ aLbFormat.Clear ();
+#endif /* ENABLE_LAYOUT */
+
+ Init_Impl();
+ SetExchangeSupport(); // diese Page braucht ExchangeSupport
+ FreeResource();
+ nFixedCategory=-1;
+}
+
+SvxNumberFormatTabPage::~SvxNumberFormatTabPage()
+{
+ delete pNumFmtShell;
+ delete pNumItem;
+}
+
+void SvxNumberFormatTabPage::Init_Impl()
+{
+ ImageList aIconList( SVX_RES_PLAIN ( IL_ICON ) );
+ ImageList aIconListHC( SVX_RES_PLAIN ( IL_ICON_HC ) );
+
+ bNumItemFlag=TRUE;
+ bOneAreaFlag=FALSE;
+
+ nCatHeight=aLbCategory.GetSizePixel().Height();
+
+ nCurFormatY =aLbFormat.GetPosPixel().Y();
+ nCurFormatHeight=aLbFormat.GetSizePixel().Height();
+ nStdFormatY =aLbCurrency.GetPosPixel().Y();
+ nStdFormatHeight=nCurFormatY-nStdFormatY+nCurFormatHeight;
+
+ aIbAdd. SetModeImage( aIconList.GetImage( IID_ADD ) );
+ aIbAdd. SetModeImage( aIconListHC.GetImage( IID_ADD ), BMP_COLOR_HIGHCONTRAST );
+
+ aIbRemove. SetModeImage( aIconList.GetImage( IID_REMOVE ) );
+ aIbRemove. SetModeImage( aIconListHC.GetImage( IID_REMOVE ), BMP_COLOR_HIGHCONTRAST );
+
+ aIbInfo. SetModeImage( aIconList.GetImage( IID_INFO ) );
+ aIbInfo. SetModeImage( aIconListHC.GetImage( IID_INFO ), BMP_COLOR_HIGHCONTRAST );
+
+ aIbAdd.Enable(FALSE );
+ aIbRemove.Enable(FALSE );
+ aIbInfo.Enable(FALSE );
+
+ aEdComment.SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert
+ //holen
+ aEdComment.Hide();
+
+ aCbSourceFormat.Check( FALSE );
+ aCbSourceFormat.Disable();
+ aCbSourceFormat.Hide();
+
+// Handler verbinden
+ Link aLink = LINK( this, SvxNumberFormatTabPage, SelFormatHdl_Impl );
+
+ aLbCategory .SetSelectHdl( aLink );
+ aLbFormat .SetSelectHdl( aLink );
+ aLbLanguage .SetSelectHdl( aLink );
+ aLbCurrency .SetSelectHdl( aLink );
+ aCbSourceFormat .SetClickHdl( aLink );
+
+ aLink = LINK( this, SvxNumberFormatTabPage, OptHdl_Impl );
+
+ aEdDecimals .SetModifyHdl( aLink );
+ aEdLeadZeroes .SetModifyHdl( aLink );
+ aBtnNegRed .SetClickHdl( aLink );
+ aBtnThousand .SetClickHdl( aLink );
+ aLbFormat .SetDoubleClickHdl( HDL( DoubleClickHdl_Impl ) );
+ aEdFormat .SetModifyHdl( HDL( EditHdl_Impl ) );
+ aIbAdd.SetClickHdl( HDL( ClickHdl_Impl ) );
+ aIbRemove.SetClickHdl( HDL( ClickHdl_Impl ) );
+ aIbInfo.SetClickHdl( HDL( ClickHdl_Impl ) );
+
+ aLink = LINK( this, SvxNumberFormatTabPage, LostFocusHdl_Impl);
+
+ aEdComment .SetLoseFocusHdl( aLink);
+ aResetWinTimer .SetTimeoutHdl(LINK( this, SvxNumberFormatTabPage, TimeHdl_Impl));
+ aResetWinTimer .SetTimeout( 10);
+
+ // Sprachen-ListBox initialisieren
+
+ aLbLanguage.InsertLanguage( LANGUAGE_SYSTEM );
+ // Don't list ambiguous locales where we won't be able to convert the
+ // LanguageType back to an identical Language_Country name and therefore
+ // couldn't load the i18n LocaleData. Show DebugMsg in non-PRODUCT version.
+ ::com::sun::star::uno::Sequence< sal_uInt16 > xLang =
+ LocaleDataWrapper::getInstalledLanguageTypes();
+ sal_Int32 nCount = xLang.getLength();
+ for ( sal_Int32 i=0; i<nCount; i++ )
+ {
+ aLbLanguage.InsertLanguage( xLang[i] );
+ }
+}
+
+/*************************************************************************
+#* Methode: GetRanges Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Liefert Bereichsangaben zurueck.
+#*
+#* Input: ---
+#*
+#* Output: Bereich
+#*
+#************************************************************************/
+
+USHORT* SvxNumberFormatTabPage::GetRanges()
+{
+ return pRanges;
+}
+
+
+/*************************************************************************
+#* Methode: Create Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Erzeugt eine neue Zahlenformat- Seite.
+#*
+#* Input: Fenster, SfxItemSet
+#*
+#* Output: neue TabPage
+#*
+#************************************************************************/
+
+SfxTabPage* SvxNumberFormatTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SvxNumberFormatTabPage( pParent, rAttrSet ) );
+}
+
+
+/*************************************************************************
+#* Methode: Reset Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Die Attribute des Dialogs werden mit Hilfe
+#* des Itemsets neu eingestellt.
+#*
+#* Input: SfxItemSet
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void SvxNumberFormatTabPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxUInt32Item* pValFmtAttr = NULL;
+ const SfxPoolItem* pItem = NULL;
+ const SfxBoolItem* pAutoEntryAttr = NULL;
+
+ USHORT nCatLbSelPos = 0;
+ USHORT nFmtLbSelPos = 0;
+ LanguageType eLangType = LANGUAGE_DONTKNOW;
+ SvxDelStrgs aFmtEntryList;
+ SvxNumberValueType eValType = SVX_VALUE_TYPE_UNDEFINED;
+ double nValDouble = 0;
+ String aValString;
+ SfxItemState eState = SFX_ITEM_DONTCARE;
+
+
+ eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_NOLANGUAGE ),TRUE,&pItem);
+
+ if(eState==SFX_ITEM_SET)
+ {
+ const SfxBoolItem* pBoolLangItem = (const SfxBoolItem*)
+ GetItem( rSet, SID_ATTR_NUMBERFORMAT_NOLANGUAGE);
+
+ if(pBoolLangItem!=NULL && pBoolLangItem->GetValue())
+ {
+ HideLanguage();
+ }
+ else
+ {
+ HideLanguage(FALSE);
+ }
+
+ }
+
+ eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_INFO ),TRUE,&pItem);
+
+ if(eState==SFX_ITEM_SET)
+ {
+ if(pNumItem==NULL)
+ {
+ bNumItemFlag=TRUE;
+ pNumItem= (SvxNumberInfoItem *) pItem->Clone();
+ }
+ else
+ {
+ bNumItemFlag=FALSE;
+ }
+ }
+ else
+ {
+ bNumItemFlag=FALSE;
+ }
+
+
+ eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_ONE_AREA ));
+
+ if(eState==SFX_ITEM_SET)
+ {
+ const SfxBoolItem* pBoolItem = (const SfxBoolItem*)
+ GetItem( rSet, SID_ATTR_NUMBERFORMAT_ONE_AREA);
+
+ if(pBoolItem!=NULL)
+ {
+ bOneAreaFlag= pBoolItem->GetValue();
+ }
+ }
+ //bOneAreaFlag=TRUE; //@@ Debug-Test
+
+ eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_SOURCE ) );
+
+ if ( eState == SFX_ITEM_SET )
+ {
+ const SfxBoolItem* pBoolItem = (const SfxBoolItem*)
+ GetItem( rSet, SID_ATTR_NUMBERFORMAT_SOURCE );
+ if ( pBoolItem )
+ aCbSourceFormat.Check( pBoolItem->GetValue() );
+ else
+ aCbSourceFormat.Check( FALSE );
+ aCbSourceFormat.Enable();
+ aCbSourceFormat.Show();
+ }
+ else
+ {
+ BOOL bInit = FALSE; // set to TRUE for debug test
+ aCbSourceFormat.Check( bInit );
+ aCbSourceFormat.Enable( bInit );
+ aCbSourceFormat.Show( bInit );
+ }
+
+ // pNumItem muss von aussen gesetzt worden sein!
+ DBG_ASSERT( pNumItem, "No NumberInfo, no NumberFormatter, good bye.CRASH. :-(" );
+
+ // aktuellen Zahlenformat-Tabellenindex holen
+ eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_VALUE ) );
+
+ if ( SFX_ITEM_DONTCARE != eState )
+ pValFmtAttr = (const SfxUInt32Item*)
+ GetItem( rSet, SID_ATTR_NUMBERFORMAT_VALUE );
+
+ eValType = pNumItem->GetValueType();
+
+ switch ( eValType )
+ {
+ case SVX_VALUE_TYPE_STRING:
+ aValString = pNumItem->GetValueString();
+ break;
+ case SVX_VALUE_TYPE_NUMBER:
+ // #50441# string may be set in addition to the value
+ aValString = pNumItem->GetValueString();
+ nValDouble = pNumItem->GetValueDouble();
+ break;
+ case SVX_VALUE_TYPE_UNDEFINED:
+ default:
+ break;
+ }
+
+ // nun sind alle Informationen fuer die Formatierer-Shell beisammen:
+
+ if ( pNumFmtShell )
+ delete pNumFmtShell; // ggF. alte Shell loeschen (==Reset)
+
+ nInitFormat = ( pValFmtAttr ) // Init-Key merken
+ ? pValFmtAttr->GetValue() // (fuer FillItemSet())
+ : ULONG_MAX; // == DONT_KNOW
+
+
+ if ( eValType == SVX_VALUE_TYPE_STRING )
+ pNumFmtShell =SvxNumberFormatShell::Create(
+ pNumItem->GetNumberFormatter(),
+ (pValFmtAttr) ? nInitFormat : 0L,
+ eValType,
+ aValString );
+ else
+ pNumFmtShell =SvxNumberFormatShell::Create(
+ pNumItem->GetNumberFormatter(),
+ (pValFmtAttr) ? nInitFormat : 0L,
+ eValType,
+ nValDouble,
+ &aValString );
+
+ FillCurrencyBox();
+
+ String aPrevString;
+ Color* pDummy = NULL;
+ pNumFmtShell->GetInitSettings( nCatLbSelPos, eLangType, nFmtLbSelPos,
+ aFmtEntryList, aPrevString, pDummy );
+
+ aLbCurrency.SelectEntryPos((USHORT)pNumFmtShell->GetCurrencySymbol());
+
+ nFixedCategory=nCatLbSelPos;
+ if(bOneAreaFlag)
+ {
+ String sFixedCategory=aLbCategory.GetEntry(nFixedCategory);
+ aLbCategory.Clear();
+ aLbCategory.InsertEntry(sFixedCategory);
+ SetCategory(0);
+ }
+ else
+ {
+ SetCategory(nCatLbSelPos );
+ }
+ eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_ADD_AUTO ) );
+ if(SFX_ITEM_SET == eState)
+ pAutoEntryAttr = (const SfxBoolItem*)
+ GetItem( rSet, SID_ATTR_NUMBERFORMAT_ADD_AUTO );
+ // no_NO is an alias for nb_NO and normally isn't listed, we need it for
+ // backwards compatibility, but only if the format passed is of
+ // LanguageType no_NO.
+ if ( eLangType == LANGUAGE_NORWEGIAN )
+ {
+ aLbLanguage.RemoveLanguage( eLangType ); // in case we're already called
+ aLbLanguage.InsertLanguage( eLangType );
+ }
+ aLbLanguage.SelectLanguage( eLangType );
+ if(pAutoEntryAttr)
+ AddAutomaticLanguage_Impl(eLangType, pAutoEntryAttr->GetValue());
+ UpdateFormatListBox_Impl(FALSE,TRUE);
+
+//! erAck 26.01.01
+//! This spoils everything because it rematches currency formats based on
+//! the selected aLbCurrency entry instead of the current format.
+//! Besides that everything seems to be initialized by now, so why call it?
+// SelFormatHdl_Impl( &aLbCategory );
+
+ if ( pValFmtAttr )
+ {
+ EditHdl_Impl( &aEdFormat ); // UpdateOptions_Impl() als Seiteneffekt
+ }
+ else // DONT_KNOW
+ {
+ // Kategoriewechsel und direkte Eingabe sind moeglich, sonst nix:
+ Obstructing();
+ }
+
+ if ( aCbSourceFormat.IsChecked() )
+ {
+ // everything disabled except SourceFormat checkbox
+ EnableBySourceFormat_Impl();
+ }
+
+ DeleteEntryList_Impl(aFmtEntryList);
+}
+
+/*************************************************************************
+#* Methode: Obstructing Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Sperren der Controls mit Ausnahme von Kategoriewechsel
+#* und direkter Eingabe.
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+void SvxNumberFormatTabPage::Obstructing()
+{
+ aLbFormat .SetNoSelection();
+ aLbLanguage .SetNoSelection();
+ aFtLanguage .Disable();
+ aLbLanguage .Disable();
+
+ aIbAdd.Enable(FALSE );
+ aIbRemove.Enable(FALSE );
+ aIbInfo.Enable(FALSE );
+
+ aBtnNegRed .Disable();
+ aBtnThousand .Disable();
+ aFtLeadZeroes .Disable();
+ aFtDecimals .Disable();
+ aEdLeadZeroes .Disable();
+ aEdDecimals .Disable();
+ aFlOptions .Disable();
+ aEdDecimals .SetText( String() );
+ aEdLeadZeroes .SetText( String() );
+ aBtnNegRed .Check( FALSE );
+ aBtnThousand .Check( FALSE );
+ aWndPreview .NotifyChange( String() );
+
+ aLbCategory .SelectEntryPos( 0 );
+ aEdFormat .SetText( String() );
+ aFtComment .SetText( String() );
+ aEdComment .SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert
+ //holen
+
+ aEdFormat .GrabFocus();
+}
+
+
+/*************************************************************************
+#* Enable/Disable dialog parts depending on the value of the SourceFormat
+#* checkbox.
+#************************************************************************/
+void SvxNumberFormatTabPage::EnableBySourceFormat_Impl()
+{
+ BOOL bEnable = !aCbSourceFormat.IsChecked();
+ if ( !bEnable )
+ aCbSourceFormat.GrabFocus();
+ aFtCategory .Enable( bEnable );
+ aLbCategory .Enable( bEnable );
+ aFtFormat .Enable( bEnable );
+ aLbCurrency .Enable( bEnable );
+ aLbFormat .Enable( bEnable );
+ aFtLanguage .Enable( bEnable );
+ aLbLanguage .Enable( bEnable );
+ aFtDecimals .Enable( bEnable );
+ aEdDecimals .Enable( bEnable );
+ aFtLeadZeroes .Enable( bEnable );
+ aEdLeadZeroes .Enable( bEnable );
+ aBtnNegRed .Enable( bEnable );
+ aBtnThousand .Enable( bEnable );
+ aFlOptions .Enable( bEnable );
+ aFtEdFormat .Enable( bEnable );
+ aEdFormat .Enable( bEnable );
+ aIbAdd .Enable( bEnable );
+ aIbRemove .Enable( bEnable );
+ aIbInfo .Enable( bEnable );
+ aFtComment .Enable( bEnable );
+ aEdComment .Enable( bEnable );
+ aLbFormat.Invalidate(); // #i43322#
+}
+
+
+/*************************************************************************
+#* Methode: HideLanguage Datum:14.05.98
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Versteckt die Spracheinstellung:
+#*
+#* Input: BOOL nFlag
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void SvxNumberFormatTabPage::HideLanguage(BOOL nFlag)
+{
+ Size aSize=aLbCategory.GetSizePixel();
+
+ if(nFlag)
+ {
+ aSize.Height()=aLbFormat.GetSizePixel().Height();
+ }
+ else
+ {
+ aSize.Height()=nCatHeight;
+ }
+
+ aLbCategory.SetSizePixel(aSize);
+
+ aFtLanguage.Show(!nFlag);
+ aLbLanguage.Show(!nFlag);
+}
+
+/*************************************************************************
+#* Methode: FillItemSet Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Stellt die Attribute im ItemSet ein,
+#* sowie in der DocShell den numItem, wenn
+#* bNumItemFlag nicht gesetzt ist.
+#*
+#* Input: SfxItemSet
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+BOOL SvxNumberFormatTabPage::FillItemSet( SfxItemSet& rCoreAttrs )
+{
+ BOOL bDataChanged = aFtLanguage.IsEnabled() || aCbSourceFormat.IsEnabled();
+ if ( bDataChanged )
+ {
+ const SfxItemSet& rMyItemSet = GetItemSet();
+ USHORT nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_VALUE );
+ SfxItemState eItemState = rMyItemSet.GetItemState( nWhich, FALSE );
+
+ // OK chosen - Is format code input entered already taken over?
+ // If not, simulate Add. Upon syntax error ignore input and prevent Put.
+ String aFormat = aEdFormat.GetText();
+ sal_uInt32 nCurKey = pNumFmtShell->GetCurNumFmtKey();
+
+ if ( aIbAdd.IsEnabled() || pNumFmtShell->IsTmpCurrencyFormat(aFormat) )
+ { // #79599# It is not sufficient to just add the format code (or
+ // delete it in case of bOneAreaFlag and resulting category change).
+ // Upon switching tab pages we need all settings to be consistent
+ // in case this page will be redisplayed later.
+ bDataChanged = (ClickHdl_Impl( &aIbAdd ) != 0);
+ nCurKey = pNumFmtShell->GetCurNumFmtKey();
+ }
+ else if(nCurKey == NUMKEY_UNDEFINED)
+ { // something went wrong, e.g. in Writer #70281#
+ pNumFmtShell->FindEntry(aFormat, &nCurKey);
+ }
+
+ //---------------------------------------------------------------
+ // Chosen format:
+ // --------------
+ if ( bDataChanged )
+ {
+ bDataChanged = ( nInitFormat != nCurKey );
+
+ if (bDataChanged)
+ {
+ rCoreAttrs.Put( SfxUInt32Item( nWhich, nCurKey ) );
+ }
+ else if(SFX_ITEM_DEFAULT == eItemState)
+ {
+ rCoreAttrs.ClearItem( nWhich );
+ }
+ }
+
+ // --------------------------------------------------------------
+ // List of changed user defined formats:
+ // -------------------------------------
+ const sal_uInt32 nDelCount = pNumFmtShell->GetUpdateDataCount();
+
+ if ( nDelCount > 0 )
+ {
+ sal_uInt32* pDelArr = new sal_uInt32[nDelCount];
+
+ pNumFmtShell->GetUpdateData( pDelArr, nDelCount );
+ pNumItem->SetDelFormatArray( pDelArr, nDelCount );
+
+ if(bNumItemFlag==TRUE)
+ {
+ rCoreAttrs.Put( *pNumItem );
+ }
+ else
+ {
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+
+ DBG_ASSERT( pDocSh, "DocShell not found!" );
+
+
+ if ( pDocSh )
+ pDocSh->PutItem( *pNumItem );
+ }
+ delete [] pDelArr;
+ }
+
+ //---------------------------------------------------------------
+ // Whether source format is to be taken or not:
+ // --------------------------------------------
+ if ( aCbSourceFormat.IsEnabled() )
+ {
+ USHORT _nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_SOURCE );
+ SfxItemState _eItemState = rMyItemSet.GetItemState( _nWhich, FALSE );
+ const SfxBoolItem* pBoolItem = (const SfxBoolItem*)
+ GetItem( rMyItemSet, SID_ATTR_NUMBERFORMAT_SOURCE );
+ BOOL bOld = (pBoolItem ? pBoolItem->GetValue() : FALSE);
+ rCoreAttrs.Put( SfxBoolItem( _nWhich, aCbSourceFormat.IsChecked() ) );
+ if ( !bDataChanged )
+ bDataChanged = (bOld != (BOOL) aCbSourceFormat.IsChecked() ||
+ _eItemState != SFX_ITEM_SET);
+ }
+
+ // FillItemSet is only called on OK, here we can notify the
+ // NumberFormatShell that all new user defined formats are valid.
+ pNumFmtShell->ValidateNewEntries();
+ if(aLbLanguage.IsVisible() &&
+ LISTBOX_ENTRY_NOTFOUND != aLbLanguage.GetEntryPos(sAutomaticEntry))
+ rCoreAttrs.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ADD_AUTO,
+ aLbLanguage.GetSelectEntry() == sAutomaticEntry));
+ }
+
+ return bDataChanged;
+}
+
+
+int SvxNumberFormatTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+/* if ( (ULONG_MAX != nInitFormat) && _pSet )
+ {
+ const ULONG nCurKey = pNumFmtShell->GetCurNumFmtKey();
+ const USHORT nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_VALUE );
+ SfxItemState eItemState = GetItemSet().GetItemState( nWhich, FALSE );
+
+ if ( (nInitFormat == nCurKey) && (SFX_ITEM_DEFAULT == eItemState) )
+ _pSet->ClearItem( nWhich );
+ else
+ _pSet->Put( SfxUInt32Item( nWhich, nCurKey ) );
+ }
+ */
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+void SvxNumberFormatTabPage::SetInfoItem( const SvxNumberInfoItem& rItem )
+{
+ if(pNumItem==NULL)
+ {
+ pNumItem = (SvxNumberInfoItem*)rItem.Clone();
+ }
+}
+
+void SvxNumberFormatTabPage::FillFormatListBox_Impl( SvxDelStrgs& rEntries )
+{
+ String* pEntry;
+ String aTmpString;
+ String aTmpCatString;
+ Font aFont=aLbCategory.GetFont();
+ USHORT i = 0;
+ short nTmpCatPos;
+ short aPrivCat;
+
+ aLbFormat.Clear();
+ aLbFormat.SetUpdateMode( FALSE );
+
+ USHORT nCount = rEntries.Count();
+
+ if(nCount<1) return;
+
+ if(bOneAreaFlag)
+ {
+ nTmpCatPos=nFixedCategory;
+ }
+ else
+ {
+ nTmpCatPos=aLbCategory.GetSelectEntryPos();
+ }
+
+ switch (nTmpCatPos)
+ {
+ case CAT_ALL:
+ case CAT_TEXT:
+ case CAT_NUMBER: i=1;
+ pEntry=rEntries[0];
+ if(pEntry!=NULL)
+ {
+ if (nTmpCatPos == CAT_TEXT)
+ aTmpString=*pEntry;
+ else
+ aTmpString = pNumFmtShell->GetStandardName();
+ aPrivCat=pNumFmtShell->GetCategory4Entry(0);
+ aLbFormat.InsertFontEntry( aTmpString, aFont );
+ }
+ break;
+
+ default: break;
+ }
+
+ if(pNumFmtShell!=NULL)
+ {
+ for ( ; i < nCount; ++i )
+ {
+ pEntry = rEntries[i];
+ aPrivCat=pNumFmtShell->GetCategory4Entry(i);
+ if(aPrivCat!=CAT_TEXT)
+ {
+ Color* pPreviewColor = NULL;
+ String aPreviewString( GetExpColorString( pPreviewColor, *pEntry, aPrivCat ) );
+ Font aEntryFont( aLbFormat.GetFont() );
+ aLbFormat.InsertFontEntry( aPreviewString, aEntryFont, pPreviewColor );
+ }
+ else
+ {
+ aLbFormat.InsertFontEntry(*pEntry,aFont);
+ }
+ }
+ }
+ aLbFormat.SetUpdateMode( TRUE );
+ DeleteEntryList_Impl(rEntries);
+}
+
+
+/*************************************************************************
+#* Methode: DeleteEntryList_Impl Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Loescht eine SvStrings- Liste
+#*
+#* Input: String-liste
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void SvxNumberFormatTabPage::DeleteEntryList_Impl( SvxDelStrgs& rEntries )
+{
+ USHORT nCount = rEntries.Count();
+ rEntries.DeleteAndDestroy(0,nCount);
+}
+
+
+/*************************************************************************
+#* Methode: UpdateOptions_Impl Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Stellt je nach eingestelltem Format die Options-
+#* attribute neu ein.
+#*
+#* Input: Flag, ob sich die Kategorie geaendert hat.
+#*
+#* Output: ---
+#*
+#***?********************************************************************/
+
+void SvxNumberFormatTabPage::UpdateOptions_Impl( BOOL bCheckCatChange /*= FALSE*/ )
+{
+ SvxDelStrgs aEntryList;
+ String theFormat = aEdFormat.GetText();
+ USHORT nCurCategory = aLbCategory.GetSelectEntryPos();
+ USHORT nCategory = nCurCategory;
+ USHORT nDecimals = 0;
+ USHORT nZeroes = 0;
+ BOOL bNegRed = FALSE;
+ BOOL bThousand = FALSE;
+ short nTmpCatPos;
+ USHORT nCurrencyPos =aLbCurrency.GetSelectEntryPos();
+
+ if(bOneAreaFlag)
+ {
+ nTmpCatPos=nFixedCategory;
+ nCurCategory=nFixedCategory;
+ }
+ else
+ {
+ nTmpCatPos=nCurCategory;
+ }
+
+
+ pNumFmtShell->GetOptions( theFormat,
+ bThousand, bNegRed,
+ nDecimals, nZeroes,
+ nCategory );
+ BOOL bDoIt=FALSE;
+ if(nCategory==CAT_CURRENCY)
+ {
+ USHORT nTstPos=pNumFmtShell->FindCurrencyFormat(theFormat);
+ if(nCurrencyPos!=nTstPos && nTstPos!=(USHORT)-1)
+ {
+ aLbCurrency.SelectEntryPos(nTstPos);
+ pNumFmtShell->SetCurrencySymbol(nTstPos);
+ bDoIt=TRUE;
+ }
+ }
+
+
+
+ if ( nCategory != nCurCategory || bDoIt)
+ {
+ if ( bCheckCatChange )
+ {
+ if(bOneAreaFlag)
+ SetCategory(0);
+ else
+ SetCategory(nCategory );
+
+ UpdateFormatListBox_Impl( TRUE, FALSE );
+ }
+ }
+ else if ( aLbFormat.GetEntryCount() > 0 )
+ {
+ sal_uInt32 nCurEntryKey=NUMKEY_UNDEFINED;
+ if(!pNumFmtShell->FindEntry( aEdFormat.GetText(),&nCurEntryKey))
+ {
+ aLbFormat.SetNoSelection();
+ }
+ }
+ if(bOneAreaFlag)
+ {
+ nCategory=nFixedCategory;
+ }
+
+ switch ( nCategory )
+ {
+ case CAT_NUMBER:
+ case CAT_PERCENT:
+ case CAT_CURRENCY:
+ aFlOptions.Enable();
+ aFtDecimals.Enable();
+ aEdDecimals.Enable();
+ aFtLeadZeroes.Enable();
+ aEdLeadZeroes.Enable();
+ aBtnNegRed.Enable();
+ aBtnThousand.Enable();
+ /*
+ aEdDecimals .SetValue( nDecimals );
+ aEdLeadZeroes.SetValue( nZeroes );
+ */
+ aEdDecimals .SetText( UniString::CreateFromInt32( nDecimals ) );
+ aEdLeadZeroes.SetText( UniString::CreateFromInt32( nZeroes ) );
+ aBtnNegRed .Check( bNegRed );
+ aBtnThousand .Check( bThousand );
+ break;
+
+ case CAT_ALL:
+ case CAT_USERDEFINED:
+ case CAT_TEXT:
+ case CAT_DATE:
+ case CAT_TIME:
+ case CAT_BOOLEAN:
+ case CAT_SCIENTIFIC:
+ case CAT_FRACTION:
+ default:
+ aFlOptions .Disable();
+ aFtDecimals .Disable();
+ aEdDecimals .Disable();
+ aFtLeadZeroes .Disable();
+ aEdLeadZeroes .Disable();
+ aBtnNegRed .Disable();
+ aBtnThousand .Disable();
+ aEdDecimals .SetText( UniString::CreateFromInt32( 0 ) );
+ aEdLeadZeroes .SetText( UniString::CreateFromInt32( 0 ) );
+ aBtnNegRed .Check( FALSE );
+ aBtnThousand .Check( FALSE );
+ }
+}
+
+
+/*************************************************************************
+#* Methode: UpdateFormatListBox_Impl Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Aktualisiert die Format- Listbox und zusaetzlich
+#* wird abhaengig vom bUpdateEdit- Flag der String
+#* in der Editbox geaendert.
+#*
+#* Input: Flags fuer Kategorie und Editbox
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void SvxNumberFormatTabPage::UpdateFormatListBox_Impl
+ (
+ USHORT bCat, // Category oder Land/Sprache ListBox?
+ BOOL bUpdateEdit // Format-Edit aktualisieren?
+ )
+{
+ SvxDelStrgs aEntryList;
+ short nFmtLbSelPos = 0;
+ short nTmpCatPos;
+
+ if(bOneAreaFlag)
+ {
+ nTmpCatPos=nFixedCategory;
+ }
+ else
+ {
+ nTmpCatPos=aLbCategory.GetSelectEntryPos();
+ }
+
+
+ if ( bCat )
+ {
+ Point aPos=aLbFormat.GetPosPixel();
+ Size aSize=aLbFormat.GetSizePixel();
+
+ if(nTmpCatPos!=CAT_CURRENCY)
+ {
+ aPos.Y()=nStdFormatY;
+ aSize.Height()=nStdFormatHeight;
+ aLbFormat.SetPosSizePixel(aPos,aSize);
+#if ENABLE_LAYOUT
+ aLbCurrency.Disable();
+#else /* !ENABLE_LAYOUT */
+ aLbCurrency.Hide();
+#endif /* !ENABLE_LAYOUT */
+ }
+ else
+ {
+ aPos.Y()=nCurFormatY;
+ aSize.Height()=nCurFormatHeight;
+ aLbFormat.SetPosSizePixel(aPos,aSize);
+#if ENABLE_LAYOUT
+ aLbCurrency.Enable();
+#else /* !ENABLE_LAYOUT */
+ aLbCurrency.Show();
+#endif /* !ENABLE_LAYOUT */
+ }
+
+ pNumFmtShell->CategoryChanged( nTmpCatPos,nFmtLbSelPos, aEntryList );
+ }
+ else
+ pNumFmtShell->LanguageChanged( aLbLanguage.GetSelectLanguage(),
+ nFmtLbSelPos,aEntryList );
+
+ REMOVE_DONTKNOW() // ggF. UI-Enable
+
+
+ if ( (aEntryList.Count() > 0) && (nFmtLbSelPos != SELPOS_NONE) )
+ {
+ if(bUpdateEdit)
+ {
+ String aFormat=*aEntryList[nFmtLbSelPos];
+ aEdFormat.SetText(aFormat);
+ aFtComment.SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos));
+
+ //@23.09.97 aEdFormat.SetText( aLbFormat.GetSelectEntry() );
+ }
+
+ if(!bOneAreaFlag || !bCat)
+ {
+ FillFormatListBox_Impl( aEntryList );
+ aLbFormat.SelectEntryPos( nFmtLbSelPos );
+
+ aFtComment.SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos));
+ if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos))
+ {
+ if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0)
+ {
+ aFtComment.SetText(aLbCategory.GetEntry(1));
+ }
+ }
+ ChangePreviewText( (USHORT)nFmtLbSelPos );
+ }
+
+ }
+ else
+ {
+ FillFormatListBox_Impl( aEntryList );
+ if(nFmtLbSelPos != SELPOS_NONE)
+ {
+ aLbFormat.SelectEntryPos( (USHORT)nFmtLbSelPos );
+
+ aFtComment.SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos));
+ if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos))
+ {
+ if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0)
+ {
+ aFtComment.SetText(aLbCategory.GetEntry(1));
+ }
+ }
+ }
+ else
+ {
+ aLbFormat.SetNoSelection();
+ }
+
+ if ( bUpdateEdit )
+ {
+ aEdFormat.SetText( String() );
+ aWndPreview.NotifyChange( String() );
+ }
+ }
+}
+
+
+/*************************************************************************
+#* Handle: DoubleClickHdl_Impl Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Bei einem Doppelklick in die Format- Listbox
+#* wird der Wert uebernommen und der OK-Button
+#* ausgeloest
+#*
+#* Input: Pointer auf Listbox
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+IMPL_LINK( SvxNumberFormatTabPage, DoubleClickHdl_Impl, SvxFontListBox*, pLb )
+{
+ if ( pLb == &aLbFormat )
+ {
+ SelFormatHdl_Impl( pLb );
+
+ if ( fnOkHdl.IsSet() )
+ { // Uebergangsloesung, sollte von SfxTabPage angeboten werden
+ fnOkHdl.Call( NULL );
+ }
+ else
+ {
+ SfxSingleTabDialog* pParent = dynamic_cast< SfxSingleTabDialog* >( GetParent() );
+ OKButton* pOKButton = pParent ? pParent->GetOKButton() : NULL;
+ if ( pOKButton )
+ pOKButton->Click();
+ }
+ }
+ return 0;
+}
+
+
+/*************************************************************************
+#* Methode: SelFormatHdl_Impl Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Wird aufgerufen, wenn sich die Sprache, die Kategorie
+#* oder das Format aendert. Dem entsprechend werden die
+#* Einstellungen geaendert.
+#*
+#* Input: Pointer auf Listbox
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+IMPL_LINK( SvxNumberFormatTabPage, SelFormatHdl_Impl, void *, pLb )
+{
+ if ( (CheckBox*)pLb == &aCbSourceFormat )
+ {
+ EnableBySourceFormat_Impl(); // enable/disable everything else
+ if ( aCbSourceFormat.IsChecked() )
+ return 0; // just disabled everything else
+
+ // Reinit options enable/disable for current selection.
+
+#if ENABLE_LAYOUT
+ if (aLbFormat.GetSelectEntryPos () == LISTBOX_ENTRY_NOTFOUND)
+#else /* !ENABLE_LAYOUT */
+ // Current category may be UserDefined with no format entries defined.
+ // And yes, aLbFormat is a SvxFontListBox with ULONG list positions,
+ // implementation returns a LIST_APPEND if empty, comparison with
+ // USHORT LISTBOX_ENTRY_NOTFOUND wouldn't match.
+ if ( aLbFormat.GetSelectEntryPos() == LIST_APPEND )
+#endif /* !ENABLE_LAYOUT */
+ pLb = &aLbCategory; // continue with the current category selected
+ else
+ pLb = &aLbFormat; // continue with the current format selected
+ }
+
+ short nTmpCatPos;
+
+ if(bOneAreaFlag)
+ {
+ nTmpCatPos=nFixedCategory;
+ }
+ else
+ {
+ nTmpCatPos=aLbCategory.GetSelectEntryPos();
+ }
+
+ USHORT nCurrencyPos=LISTBOX_ENTRY_NOTFOUND ;
+
+ if(nTmpCatPos==CAT_CURRENCY && (ListBox *)pLb == &aLbCurrency )
+ {
+ nCurrencyPos=aLbCurrency.GetSelectEntryPos();
+ pNumFmtShell->SetCurrencySymbol(nCurrencyPos);
+ }
+
+ //--------------------------------------------------------------------
+ // Format-ListBox ----------------------------------------------------
+ if ( (SvxFontListBox *)pLb == &aLbFormat )
+ {
+ USHORT nSelPos = (USHORT) aLbFormat.GetSelectEntryPos();
+ String aFormat = aLbFormat.GetSelectEntry();
+ String aComment;
+ SvxDelStrgs aEntryList;
+
+ short nFmtLbSelPos = nSelPos;
+
+ aFormat=pNumFmtShell->GetFormat4Entry(nSelPos);
+ aComment=pNumFmtShell->GetComment4Entry(nSelPos);
+ if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos))
+ {
+ if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0)
+ {
+ aComment=aLbCategory.GetEntry(1);
+ }
+ }
+
+ if ( aFormat.Len() > 0 )
+ {
+ if(!aEdFormat.HasFocus()) aEdFormat.SetText( aFormat );
+ aFtComment.SetText(aComment);
+ ChangePreviewText( nSelPos );
+ }
+
+ REMOVE_DONTKNOW() // ggF. UI-Enable
+
+ if ( pNumFmtShell->FindEntry( aFormat) )
+ {
+ aIbAdd.Enable(FALSE );
+ BOOL bIsUserDef=pNumFmtShell->IsUserDefined( aFormat );
+ aIbRemove.Enable(bIsUserDef);
+ aIbInfo.Enable(bIsUserDef);
+
+ }
+ else
+ {
+ aIbAdd.Enable(TRUE );
+ aIbInfo.Enable(TRUE );
+ aIbRemove.Enable(FALSE );
+ aFtComment.SetText(aEdComment.GetText());
+
+ }
+ UpdateOptions_Impl( FALSE );
+
+ //-------
+ return 0;
+ //-------
+ }
+
+ //--------------------------------------------------------------------
+ // Kategorie-ListBox -------------------------------------------------
+ if ( pLb == &aLbCategory || pLb == &aLbCurrency)
+ {
+ UpdateFormatListBox_Impl( TRUE, TRUE );
+ EditHdl_Impl( NULL );
+ UpdateOptions_Impl( FALSE );
+
+ //-------
+ return 0;
+ //-------
+ }
+
+ //--------------------------------------------------------------------
+ // Sprache/Land-ListBox ----------------------------------------------
+ if ( pLb == &aLbLanguage )
+ {
+ UpdateFormatListBox_Impl( FALSE, TRUE );
+ EditHdl_Impl( &aEdFormat );
+
+ //-------
+ return 0;
+ //-------
+ }
+ return 0;
+}
+
+
+/*************************************************************************
+#* Methode: ClickHdl_Impl, ImageButton* pIB Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Wenn, der Hinzufuegen- oder Entfernen- Button
+#* wird diese Funktion aufgerufen und die Zahlenformat-
+#* Liste den entsprechend geaendert.
+#*
+#* Input: Toolbox- Button
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, ImageButton*, pIB)
+{
+ BOOL bAdded = FALSE;
+ BOOL bDeleted = FALSE;
+ ULONG nReturn = 0;
+ const ULONG nReturnChanged = 0x1; // THE boolean return value
+ const ULONG nReturnAdded = 0x2; // temp: format added
+ const ULONG nReturnOneArea = 0x4; // temp: one area but category changed => ignored
+
+ if(pIB==&aIbAdd)
+ { // Also called from FillItemSet() if a temporary currency format has
+ // to be added, not only if the Add button is enabled.
+ String aFormat = aEdFormat.GetText();
+ SvxDelStrgs aEntryList;
+ SvxDelStrgs a2EntryList;
+ USHORT nCatLbSelPos = 0;
+ short nFmtLbSelPos = SELPOS_NONE;
+ xub_StrLen nErrPos=0;
+
+ pNumFmtShell->SetCurCurrencyEntry(NULL);
+ bAdded = pNumFmtShell->AddFormat( aFormat, nErrPos,
+ nCatLbSelPos, nFmtLbSelPos,
+ aEntryList);
+ if ( bAdded )
+ nReturn |= nReturnChanged | nReturnAdded;
+
+ if(pLastActivWindow== (Window *) &aEdComment)
+ {
+ aEdFormat.GrabFocus();
+ aEdComment.Hide();
+ aFtComment.Show();
+ aFtComment.SetText(aEdComment.GetText());
+ }
+
+ if ( !nErrPos ) // Syntax ok?
+ {
+ if(nCatLbSelPos==CAT_CURRENCY)
+ {
+ aLbCurrency.SelectEntryPos((USHORT)pNumFmtShell->GetCurrencySymbol());
+ }
+
+ if(bOneAreaFlag && (nFixedCategory!=nCatLbSelPos))
+ {
+ if(bAdded) DeleteEntryList_Impl(aEntryList);
+ bDeleted = pNumFmtShell->RemoveFormat( aFormat,
+ nCatLbSelPos,
+ nFmtLbSelPos,
+ a2EntryList);
+ if(bDeleted) DeleteEntryList_Impl(a2EntryList);
+ aEdFormat.GrabFocus();
+ aEdFormat.SetSelection( Selection( (short)nErrPos, SELECTION_MAX ) );
+ nReturn |= nReturnOneArea;
+ }
+ else
+ {
+ if ( bAdded && (nFmtLbSelPos != SELPOS_NONE) )
+ {
+ // Alles klar
+ if(bOneAreaFlag) //@@ ???
+ SetCategory(0);
+ else
+ SetCategory(nCatLbSelPos );
+
+ FillFormatListBox_Impl( aEntryList );
+ if(aEdComment.GetText()!=aLbCategory.GetEntry(1))
+ {
+ pNumFmtShell->SetComment4Entry(nFmtLbSelPos,
+ aEdComment.GetText());
+ }
+ else
+ {
+ pNumFmtShell->SetComment4Entry(nFmtLbSelPos,
+ String());
+ }
+ aLbFormat.SelectEntryPos( (USHORT)nFmtLbSelPos );
+ aEdFormat.SetText( aFormat );
+
+ //aEdComment.SetText(String()); //@@ ???
+ aEdComment.SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert
+ //holen
+ ChangePreviewText( (USHORT)nFmtLbSelPos );
+ }
+ }
+ }
+ else // Syntaxfehler
+ {
+ aEdFormat.GrabFocus();
+ aEdFormat.SetSelection( Selection( (short)nErrPos, SELECTION_MAX ) );
+ }
+ EditHdl_Impl( &aEdFormat );
+ nReturn = ((nReturn & nReturnOneArea) ? 0 : (nReturn & nReturnChanged));
+ }
+ else if(pIB==&aIbRemove)
+ {
+ String aFormat = aEdFormat.GetText();
+ SvxDelStrgs aEntryList;
+ USHORT nCatLbSelPos = 0;
+ short nFmtLbSelPos = SELPOS_NONE;
+
+ bDeleted = pNumFmtShell->RemoveFormat( aFormat,
+ nCatLbSelPos,
+ nFmtLbSelPos,
+ aEntryList );
+
+ aEdComment.SetText(aLbCategory.GetEntry(1));
+ if ( bDeleted )
+ {
+ if(nFmtLbSelPos>=0 && nFmtLbSelPos<aEntryList.Count())
+ {
+ aFormat = *aEntryList[nFmtLbSelPos];
+ }
+
+ FillFormatListBox_Impl( aEntryList );
+
+ if ( nFmtLbSelPos != SELPOS_NONE )
+ {
+ if(bOneAreaFlag) //@@ ???
+ SetCategory(0);
+ else
+ SetCategory(nCatLbSelPos );
+
+ aLbFormat.SelectEntryPos( (USHORT)nFmtLbSelPos );
+ aEdFormat.SetText( aFormat );
+ ChangePreviewText( (USHORT)nFmtLbSelPos );
+ }
+ else
+ {
+ // auf "Alle/Standard" setzen
+ SetCategory(0 );
+ SelFormatHdl_Impl( &aLbCategory );
+ }
+ }
+ EditHdl_Impl( &aEdFormat );
+ }
+ else if(pIB==&aIbInfo)
+ {
+ if(!(pLastActivWindow== (Window *) &aEdComment))
+ {
+ aEdComment.SetText(aFtComment.GetText());
+ aEdComment.Show();
+ aFtComment.Hide();
+ aEdComment.GrabFocus();
+ }
+ else
+ {
+ aEdFormat.GrabFocus();
+ aEdComment.Hide();
+ aFtComment.Show();
+ }
+ }
+
+ return nReturn;
+}
+
+
+/*************************************************************************
+#* Methode: EditHdl_Impl Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Wenn der Eintrag im Eingabefeld geaendert wird,
+#* so wird die Vorschau aktualisiert und
+#*
+#* Input: Pointer auf Editbox
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+IMPL_LINK( SvxNumberFormatTabPage, EditHdl_Impl, Edit*, pEdFormat )
+{
+ sal_uInt32 nCurKey = NUMKEY_UNDEFINED;
+
+ if ( aEdFormat.GetText().Len() == 0 )
+ {
+ aIbAdd.Enable(FALSE );
+ aIbRemove.Enable(FALSE );
+ aIbInfo.Enable(FALSE );
+ aFtComment.SetText(String());
+ }
+ else
+ {
+ String aFormat = aEdFormat.GetText();
+ //aFtComment.SetText(String());
+ MakePreviewText( aFormat );
+
+ if ( pNumFmtShell->FindEntry( aFormat, &nCurKey ) )
+ {
+ aIbAdd.Enable(FALSE );
+ BOOL bUserDef=pNumFmtShell->IsUserDefined( aFormat );
+
+ aIbRemove.Enable(bUserDef);
+ aIbInfo.Enable(bUserDef);
+
+ if(bUserDef)
+ {
+ USHORT nTmpCurPos=pNumFmtShell->FindCurrencyFormat(aFormat );
+
+ if(nTmpCurPos!=(USHORT)-1)
+ aLbCurrency.SelectEntryPos(nTmpCurPos);
+ }
+ short nPosi=pNumFmtShell->GetListPos4Entry(aFormat);
+ if(nPosi>=0)
+ aLbFormat.SelectEntryPos( (USHORT)nPosi);
+
+ }
+ else
+ {
+
+ aIbAdd.Enable(TRUE );
+ aIbInfo.Enable(TRUE);
+ aIbRemove.Enable(FALSE );
+
+ aFtComment.SetText(aEdComment.GetText());
+
+ }
+ }
+
+ if ( pEdFormat )
+ {
+ pNumFmtShell->SetCurNumFmtKey( nCurKey );
+ UpdateOptions_Impl( TRUE );
+ }
+
+ return 0;
+}
+
+
+/*************************************************************************
+#* Methode: NotifyChange Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Fuehrt Aenderungen in den Zahlen- Attributen durch.
+#*
+#* Input: Options- Controls
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+IMPL_LINK( SvxNumberFormatTabPage, OptHdl_Impl, void *, pOptCtrl )
+{
+ if ( ((NumericField*)pOptCtrl == &aEdLeadZeroes)
+ || ((NumericField*)pOptCtrl == &aEdDecimals)
+ || ((CheckBox*) pOptCtrl == &aBtnNegRed)
+ || ((CheckBox*) pOptCtrl == &aBtnThousand) )
+ {
+ String aFormat;
+ BOOL bThousand = aBtnThousand.IsEnabled()
+ && aBtnThousand.IsChecked();
+ BOOL bNegRed = aBtnNegRed.IsEnabled()
+ && aBtnNegRed.IsChecked();
+ USHORT nPrecision = (aEdDecimals.IsEnabled())
+ ? (USHORT)aEdDecimals.GetValue()
+ : (USHORT)0;
+ USHORT nLeadZeroes = (aEdLeadZeroes.IsEnabled())
+ ? (USHORT)aEdLeadZeroes.GetValue()
+ : (USHORT)0;
+
+ pNumFmtShell->MakeFormat( aFormat,
+ bThousand, bNegRed,
+ nPrecision, nLeadZeroes,
+ (USHORT)aLbFormat.GetSelectEntryPos() );
+
+ aEdFormat.SetText( aFormat );
+ //aFtComment.SetText(String());
+ MakePreviewText( aFormat );
+
+ if ( pNumFmtShell->FindEntry( aFormat ) )
+ {
+ aIbAdd.Enable(FALSE );
+ BOOL bUserDef=pNumFmtShell->IsUserDefined( aFormat );
+ aIbRemove.Enable(bUserDef);
+ aIbInfo.Enable(bUserDef);
+ EditHdl_Impl( &aEdFormat);
+
+ }
+ else
+ {
+ EditHdl_Impl( NULL );
+ aLbFormat.SetNoSelection();
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( SvxNumberFormatTabPage, TimeHdl_Impl, Timer*, EMPTYARG)
+{
+ pLastActivWindow=NULL;
+ return 0;
+}
+
+
+/*************************************************************************
+#* Methode: LostFocusHdl_Impl Datum:30.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Fuehrt Aenderungen in den Zahlen- Attributen durch.
+#*
+#* Input: Options- Controls
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+IMPL_LINK( SvxNumberFormatTabPage, LostFocusHdl_Impl, Edit *, pEd)
+{
+ if (pEd==&aEdComment)
+ {
+ aResetWinTimer.Start();
+ aFtComment.SetText(aEdComment.GetText());
+ aEdComment.Hide();
+ aFtComment.Show();
+ if(!aIbAdd.IsEnabled())
+ {
+ USHORT nSelPos = (USHORT) aLbFormat.GetSelectEntryPos();
+ pNumFmtShell->SetComment4Entry(nSelPos,
+ aEdComment.GetText());
+ aEdComment.SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert
+ //holen
+ }
+ }
+ return 0;
+}
+
+/*************************************************************************
+#* Methode: NotifyChange Datum:02.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Fuehrt Aenderungen in den Zahlen- Attributen durch.
+#*
+#* Input: Options- Controls
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+String SvxNumberFormatTabPage::GetExpColorString(
+ Color*& rpPreviewColor, const String& rFormatStr, short nTmpCatPos)
+{
+ double nVal = 0;
+ switch (nTmpCatPos)
+ {
+ case CAT_CURRENCY: nVal=SVX_NUMVAL_CURRENCY; break;
+
+ case CAT_SCIENTIFIC:
+ case CAT_FRACTION:
+ case CAT_NUMBER: nVal=SVX_NUMVAL_STANDARD; break;
+
+ case CAT_PERCENT: nVal=SVX_NUMVAL_PERCENT; break;
+
+ case CAT_ALL: nVal=SVX_NUMVAL_STANDARD; break;
+
+ case CAT_TIME: nVal=SVX_NUMVAL_TIME; break;
+ case CAT_DATE: nVal=SVX_NUMVAL_DATE; break;
+
+ case CAT_BOOLEAN: nVal=SVX_NUMVAL_BOOLEAN; break;
+
+ case CAT_USERDEFINED:
+ case CAT_TEXT:
+ default: nVal=0;break;
+ }
+
+ String aPreviewString;
+ pNumFmtShell->MakePrevStringFromVal( rFormatStr, aPreviewString, rpPreviewColor, nVal );
+ return aPreviewString;
+}
+
+void SvxNumberFormatTabPage::MakePreviewText( const String& rFormat )
+{
+ String aPreviewString;
+ Color* pPreviewColor = NULL;
+ pNumFmtShell->MakePreviewString( rFormat, aPreviewString, pPreviewColor );
+ aWndPreview.NotifyChange( aPreviewString, pPreviewColor );
+}
+
+void SvxNumberFormatTabPage::ChangePreviewText( USHORT nPos )
+{
+ String aPreviewString;
+ Color* pPreviewColor = NULL;
+ pNumFmtShell->FormatChanged( nPos, aPreviewString, pPreviewColor );
+ aWndPreview.NotifyChange( aPreviewString, pPreviewColor );
+}
+
+long SvxNumberFormatTabPage::PreNotify( NotifyEvent& rNEvt )
+{
+ if(rNEvt.GetType()==EVENT_LOSEFOCUS)
+ {
+ if ( rNEvt.GetWindow() == dynamic_cast< Window* >( &aEdComment ) && !aEdComment.IsVisible() )
+ {
+ pLastActivWindow = NULL;
+ }
+ else
+ {
+ pLastActivWindow = rNEvt.GetWindow();
+ }
+ }
+
+ return SfxTabPage::PreNotify( rNEvt );
+}
+/*************************************************************************
+#* Methode: SetOkHdl Datum:01.11.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatTabPage
+#*
+#* Funktion: Setzt den OkHandler neu.
+#*
+#* Input: Neuer OkHandler
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void SvxNumberFormatTabPage::SetOkHdl( const Link& rOkHandler )
+{
+ fnOkHdl = rOkHandler;
+}
+
+void SvxNumberFormatTabPage::FillCurrencyBox()
+{
+ SvStringsDtor aList;
+ NfShCurrencyEntries rEntries;
+ XubString* pEntry = NULL;
+ USHORT nPos=0;
+ USHORT nSelPos=0;
+
+ pNumFmtShell->GetCurrencySymbols( aList, &nSelPos);
+
+ for(USHORT i=1;i<aList.Count();i++)
+ {
+ pEntry=aList[i];
+ nPos=aLbCurrency.InsertEntry( *pEntry);
+ }
+ aLbCurrency.SelectEntryPos(nSelPos);
+}
+
+void SvxNumberFormatTabPage::SetCategory(USHORT nPos)
+{
+ USHORT nCurCategory = aLbCategory.GetSelectEntryPos();
+ Point aPos=aLbFormat.GetPosPixel();
+ Size aSize=aLbFormat.GetSizePixel();
+ USHORT nTmpCatPos;
+
+ if(bOneAreaFlag)
+ {
+ nTmpCatPos=nFixedCategory;
+ }
+ else
+ {
+ nTmpCatPos=nPos;
+ }
+
+ if(aLbCategory.GetEntryCount()==1 || nCurCategory!=nPos)
+ {
+ if(nTmpCatPos!=CAT_CURRENCY)
+ {
+ aPos.Y()=nStdFormatY;
+ aSize.Height()=nStdFormatHeight;
+ aLbFormat.SetPosSizePixel(aPos,aSize);
+ aLbCurrency.Hide();
+ }
+ else
+ {
+ aPos.Y()=nCurFormatY;
+ aSize.Height()=nCurFormatHeight;
+ aLbFormat.SetPosSizePixel(aPos,aSize);
+ aLbCurrency.Show();
+ }
+ }
+ aLbCategory.SelectEntryPos(nPos);
+}
+/* -----------------12.11.2002 14:35-----------------
+ * to support Writer text field language handling an
+ * additional entry needs to be inserted into the ListBox
+ * which marks a certain language as automatically detected
+ * Additionally the "Default" language is removed
+ * --------------------------------------------------*/
+void SvxNumberFormatTabPage::AddAutomaticLanguage_Impl(LanguageType eAutoLang, BOOL bSelect)
+{
+ aLbLanguage.RemoveLanguage(LANGUAGE_SYSTEM);
+ USHORT nPos = aLbLanguage.InsertEntry(sAutomaticEntry);
+ aLbLanguage.SetEntryData(nPos, (void*)(ULONG)eAutoLang);
+ if(bSelect)
+ aLbLanguage.SelectEntryPos(nPos);
+}
+
+void SvxNumberFormatTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pNumberInfoItem,SvxNumberInfoItem,SID_ATTR_NUMBERFORMAT_INFO,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pLinkItem,SfxLinkItem,SID_LINK_TYPE,sal_False);
+ if (pNumberInfoItem)
+ SetNumberFormatList(*pNumberInfoItem);
+ if (pLinkItem)
+ SetOkHdl(pLinkItem->GetValue());
+}
diff --git a/cui/source/tabpages/numfmt.hrc b/cui/source/tabpages/numfmt.hrc
new file mode 100644
index 000000000000..102c5a212ac6
--- /dev/null
+++ b/cui/source/tabpages/numfmt.hrc
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * 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: numfmt.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_NUMFMT_HRC
+#define _SVX_NUMFMT_HRC
+
+// defines ------------------------------------------------------------------
+
+//================================================
+// Zahlen-TabPage:
+#define WND_NUMBER_PREVIEW 2
+#define FT_CATEGORY 3
+#define FT_FORMAT 4
+#define FT_OPTIONS 5
+#define FT_EDFORMAT 6
+#define LB_CATEGORY 9
+#define LB_FORMAT 10
+#define FL_OPTIONS 11
+#define FT_LANGUAGE 12
+#define LB_LANGUAGE 13
+#define ED_FORMAT 14
+#define BTN_ADD 15
+#define BTN_REMOVE 16
+#define BMP_CHECK 17
+#define BMP_DCHECK 18
+#define BMP_CROSS 19
+#define BMP_DCROSS 20
+#define FT_DECIMALS 21
+#define ED_DECIMALS 22
+#define FT_LEADZEROES 23
+#define ED_LEADZEROES 24
+#define BTN_NEGRED 25
+#define BTN_THOUSAND 26
+#define FT_COMMENT 27
+#define ED_COMMENT 28
+#define IB_ADD 29
+#define IB_REMOVE 30
+#define IB_INFO 31
+#define IL_ICON 32
+#define LB_CURRENCY 33
+#define CB_SOURCEFORMAT 34
+#define IL_ICON_HC 35
+#define STR_AUTO_ENTRY 36
+
+#define TBX_ADDREMOVE 1
+#define IID_ADD 1
+#define IID_REMOVE 2
+#define IID_INFO 3
+
+#endif
+
diff --git a/cui/source/tabpages/numfmt.src b/cui/source/tabpages/numfmt.src
new file mode 100644
index 000000000000..96269bb9ec09
--- /dev/null
+++ b/cui/source/tabpages/numfmt.src
@@ -0,0 +1,297 @@
+/*************************************************************************
+ *
+ * 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: numfmt.src,v $
+ * $Revision: 1.51 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "numfmt.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXPAGE_NUMBERFORMAT ----------------------------------------------
+TabPage RID_SVXPAGE_NUMBERFORMAT
+{
+ HelpId = HID_NUMBERFORMAT ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Number Format" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_CATEGORY
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "~Category" ;
+ };
+ ListBox LB_CATEGORY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 71 ) ;
+ AutoHScroll = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "All" ; Default ; > ;
+ < "User-defined" ; Default ; > ;
+ < "Number" ; Default ; > ;
+ < "Percent" ; Default ; > ;
+ < "Currency" ; Default ; > ;
+ < "Date" ; Default ; > ;
+ < "Time" ; Default ; > ;
+ < "Scientific" ; Default ; > ;
+ < "Fraction" ; Default ; > ;
+ < "Boolean Value" ; Default ; > ;
+ < "Text" ; Default ; > ;
+ };
+ };
+ FixedText FT_EDFORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 136 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "~Format code" ;
+ };
+ Edit ED_FORMAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 147 ) ;
+ Size = MAP_APPFONT ( 200 , 12 ) ;
+ };
+ FixedText FT_COMMENT
+ {
+ Pos = MAP_APPFONT ( 6 , 163 ) ;
+ Size = MAP_APPFONT ( 248 , 16 ) ;
+ WordBreak = TRUE ;
+ NoLabel = TRUE ;
+ };
+ Edit ED_COMMENT
+ {
+ Hide = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 163 ) ;
+ Size = MAP_APPFONT ( 248 , 12 ) ;
+ };
+ FixedText FT_FORMAT
+ {
+ Pos = MAP_APPFONT ( 82 , 3 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "F~ormat" ;
+ };
+
+ ListBox LB_CURRENCY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 82 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 71 ) ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Automatically" ; Default ; > ;
+ };
+ };
+
+ Control LB_FORMAT
+ {
+ HelpId = HID_NUMBERFORMAT_LB_FORMAT ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 82 , 27 ) ;
+ Size = MAP_APPFONT ( 90 , 58 ) ;
+ TabStop = TRUE ;
+ };
+
+ FixedText FT_DECIMALS
+ {
+ Pos = MAP_APPFONT ( 12 , 104 ) ;
+ Size = MAP_APPFONT ( 69 , 8 ) ;
+ Text [ en-US ] = "~Decimal places" ;
+ };
+ NumericField ED_DECIMALS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 84 , 102 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Spin = TRUE ;
+ Maximum = 20 ;
+ Last = 15 ;
+ First = 0 ;
+ StrictFormat = TRUE ;
+ SpinSize = 1 ;
+ Repeat = TRUE ;
+ };
+ FixedText FT_LEADZEROES
+ {
+ Pos = MAP_APPFONT ( 12 , 120 ) ;
+ Size = MAP_APPFONT ( 69 , 8 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Führende ~Nullen : F³hrende ~Nullen */
+ Text [ en-US ] = "Leading ~zeroes" ;
+ };
+ NumericField ED_LEADZEROES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 84 , 118 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Spin = TRUE ;
+ Maximum = 20 ;
+ Last = 15 ;
+ First = 0 ;
+ StrictFormat = TRUE ;
+ SpinSize = 1 ;
+ Repeat = TRUE ;
+ };
+ CheckBox BTN_NEGRED
+ {
+ Pos = MAP_APPFONT ( 133 , 104 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "~Negative numbers red" ;
+ };
+ CheckBox BTN_THOUSAND
+ {
+ Pos = MAP_APPFONT ( 133 , 120 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "~Thousands separator" ;
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 91 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Options" ;
+ };
+ FixedText FT_LANGUAGE
+ {
+ Pos = MAP_APPFONT ( 178 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Language" ;
+ };
+ ListBox LB_LANGUAGE
+ {
+ Border = TRUE ;
+ Sort = TRUE ;
+ Pos = MAP_APPFONT ( 178 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 71 ) ;
+ DropDown = TRUE ;
+ };
+ CheckBox CB_SOURCEFORMAT
+ {
+ Pos = MAP_APPFONT ( 178 , 42 ) ;
+ Size = MAP_APPFONT ( 76 , 10 ) ;
+ Text [ en-US ] = "So~urce format" ;
+ };
+ Window WND_NUMBER_PREVIEW
+ {
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 178 , 67 ) ;
+ Size = MAP_APPFONT ( 76 , 18 ) ;
+ HelpId = HID_NUMBERFORMAT_WND_NUMBER_PREVIEW ;
+ };
+ ImageButton IB_ADD
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 208 , 146 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ HelpId = HID_NUMBERFORMAT_TBI_ADD ;
+ QuickHelpText [ en-US ] = "Add" ;
+ };
+ ImageButton IB_REMOVE
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 240 , 146 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ HelpId = HID_NUMBERFORMAT_TBI_REMOVE ;
+ QuickHelpText [ en-US ] = "Remove" ;
+ };
+ ImageButton IB_INFO
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 224 , 146 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ HelpId = HID_NUMBERFORMAT_TBI_INFO ;
+ QuickHelpText [ en-US ] = "Edit Comment" ;
+ };
+ ImageList IL_ICON
+ {
+ Prefix = "nu";
+ MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+ IdList =
+ {
+ IID_ADD ;
+ IID_REMOVE ;
+ IID_INFO ;
+ };
+ IdCount = { 3 ; };
+ };
+ ImageList IL_ICON_HC
+ {
+ Prefix = "nuh";
+ MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+ IdList =
+ {
+ IID_ADD ;
+ IID_REMOVE ;
+ IID_INFO ;
+ };
+ IdCount = { 3 ; };
+ };
+
+ String STR_AUTO_ENTRY
+ {
+ Text [ en-US ] = "Automatic";
+ };
+
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
new file mode 100644
index 000000000000..e8852c666b6c
--- /dev/null
+++ b/cui/source/tabpages/numpages.cxx
@@ -0,0 +1,4038 @@
+/*************************************************************************
+ *
+ * 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: numpages.cxx,v $
+ * $Revision: 1.64 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/RelOrientation.hpp>
+
+#include <numpages.hxx>
+#include <numpages.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <tools/shl.hxx>
+#include <i18npool/mslangid.hxx>
+#include <svtools/valueset.hxx>
+#include <helpid.hrc>
+#include <svx/numitem.hxx>
+#include <svl/eitem.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/gallery.hxx>
+#include <svl/urihelper.hxx>
+#include <svx/brshitem.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/msgbox.hxx>
+#include "cuicharmap.hxx"
+#include <svx/flstitem.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/xtable.hxx>
+#include <svx/drawitem.hxx>
+#include <svx/numvset.hxx>
+#include <svx/htmlmode.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svx/unolingu.hxx>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
+#include <com/sun/star/text/XNumberingFormatter.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/text/XNumberingTypeInfo.hpp>
+
+#include <algorithm>
+#include <vector>
+#include "svx/opengrf.hxx"
+
+#include <svx/dialogs.hrc> //CHINA001
+#include <sfx2/request.hxx> //CHINA001
+#include <svl/aeitem.hxx> //add CHINA001
+#include <svl/stritem.hxx>//add CHINA001
+#include <svl/slstitm.hxx> //add CHINA001
+
+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;
+using namespace com::sun::star::text;
+using namespace com::sun::star::container;
+using namespace com::sun::star::style;
+using rtl::OUString;
+#define C2U(cChar) OUString::createFromAscii(cChar)
+
+SV_IMPL_PTRARR(SvxNumSettingsArr_Impl,SvxNumSettings_ImplPtr);
+
+/*-----------------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
+
+#define SHOW_NUMBERING 0
+#define SHOW_BULLET 1
+#define SHOW_BITMAP 2
+
+#define MAX_BMP_WIDTH 16
+#define MAX_BMP_HEIGHT 16
+
+static BOOL bLastRelative = FALSE;
+static const sal_Char cNumberingType[] = "NumberingType";
+static const sal_Char cValue[] = "Value";
+static const sal_Char cParentNumbering[] = "ParentNumbering";
+static const sal_Char cPrefix[] = "Prefix";
+static const sal_Char cSuffix[] = "Suffix";
+static const sal_Char cBulletChar[] = "BulletChar";
+static const sal_Char cBulletFontName[] = "BulletFontName";
+/* -----------------------------31.01.01 10:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference<XDefaultNumberingProvider> lcl_GetNumberingProvider()
+{
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ Reference < XInterface > xI = xMSF->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) );
+ Reference<XDefaultNumberingProvider> xRet(xI, UNO_QUERY);
+ DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\"");
+
+ return xRet;
+}
+/* -----------------------------31.01.01 11:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxNumSettings_ImplPtr lcl_CreateNumSettingsPtr(const Sequence<PropertyValue>& rLevelProps)
+{
+ const PropertyValue* pValues = rLevelProps.getConstArray();
+ SvxNumSettings_ImplPtr pNew = new SvxNumSettings_Impl;
+ for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++)
+ {
+ if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cNumberingType)))
+ pValues[j].Value >>= pNew->nNumberType;
+ else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cPrefix)))
+ pValues[j].Value >>= pNew->sPrefix;
+ else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cSuffix)))
+ pValues[j].Value >>= pNew->sSuffix;
+ else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cParentNumbering)))
+ pValues[j].Value >>= pNew->nParentNumbering;
+ else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletChar)))
+ pValues[j].Value >>= pNew->sBulletChar;
+ else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletFontName)))
+ pValues[j].Value >>= pNew->sBulletFont;
+ }
+ return pNew;
+}
+/* -----------------28.10.98 08:32-------------------
+ *
+ * --------------------------------------------------*/
+// Die Auswahl an Bullets aus den StarSymbol
+static const sal_Unicode aBulletTypes[] =
+{
+ 0x2022,
+ 0x25cf,
+ 0xe00c,
+ 0xe00a,
+ 0x2794,
+ 0x27a2,
+ 0x2717,
+ 0x2714
+};
+/* -----------------28.10.98 09:42-------------------
+ *
+ * --------------------------------------------------*/
+static sal_Char __READONLY_DATA aNumChar[] =
+{
+ 'A', //CHARS_UPPER_LETTER
+ 'a', //CHARS_LOWER_LETTER
+ 'I', //ROMAN_UPPER
+ 'i', //ROMAN_LOWER
+ '1', //ARABIC
+ ' '
+};
+
+/*-----------------18.03.98 08:35-------------------
+ Ist eins der maskierten Formate gesetzt?
+--------------------------------------------------*/
+BOOL lcl_IsNumFmtSet(SvxNumRule* pNum, USHORT nLevelMask)
+{
+ BOOL bRet = FALSE;
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < SVX_MAX_NUM && !bRet; i++ )
+ {
+ if(nLevelMask & nMask)
+ bRet |= 0 != pNum->Get( i );
+ nMask <<= 1 ;
+ }
+ return bRet;
+}
+/* -----------------28.10.98 08:50-------------------
+ *
+ * --------------------------------------------------*/
+
+Font& lcl_GetDefaultBulletFont()
+{
+ static BOOL bInit = 0;
+ static Font aDefBulletFont( UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ),
+ String(), Size( 0, 14 ) );
+ if(!bInit)
+ {
+ aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
+ aDefBulletFont.SetFamily( FAMILY_DONTKNOW );
+ aDefBulletFont.SetPitch( PITCH_DONTKNOW );
+ aDefBulletFont.SetWeight( WEIGHT_DONTKNOW );
+ aDefBulletFont.SetTransparent( TRUE );
+ bInit = TRUE;
+ }
+ return aDefBulletFont;
+}
+
+
+/**************************************************************************/
+/* */
+/* */
+/**************************************************************************/
+
+
+SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(Window* pParent,
+ const SfxItemSet& rSet) :
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PICK_SINGLE_NUM ), rSet ),
+ aValuesFL( this, SVX_RES(FL_VALUES) ),
+ pExamplesVS( new SvxNumValueSet(this, SVX_RES(VS_VALUES), NUM_PAGETYPE_SINGLENUM )),
+ pActNum(0),
+ pSaveNum(0),
+ nActNumLvl( USHRT_MAX ),
+ bModified(FALSE),
+ bPreset(FALSE),
+ nNumItemId(SID_ATTR_NUMBERING_RULE)
+{
+ FreeResource();
+ SetExchangeSupport();
+ pExamplesVS->SetSelectHdl(LINK(this, SvxSingleNumPickTabPage, NumSelectHdl_Impl));
+ pExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, DoubleClickHdl_Impl));
+ pExamplesVS->SetHelpId(HID_VALUESET_SINGLENUM );
+
+ Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
+ if(xDefNum.is())
+ {
+ Sequence< Sequence< PropertyValue > > aNumberings;
+ LanguageType eLang = Application::GetSettings().GetLanguage();
+ Locale aLocale = SvxCreateLocale(eLang);
+ try
+ {
+ aNumberings =
+ xDefNum->getDefaultContinuousNumberingLevels( aLocale );
+
+
+ sal_Int32 nLength = aNumberings.getLength() > NUM_VALUSET_COUNT ? NUM_VALUSET_COUNT :aNumberings.getLength();
+
+ const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray();
+ for(sal_Int32 i = 0; i < nLength; i++)
+ {
+ SvxNumSettings_ImplPtr pNew = lcl_CreateNumSettingsPtr(pValuesArr[i]);
+ aNumSettingsArr.Insert(pNew, aNumSettingsArr.Count());
+ }
+ }
+ catch(Exception&)
+ {
+ }
+ Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
+ pExamplesVS->SetNumberingSettings(aNumberings, xFormat, aLocale);
+ }
+}
+/*-----------------07.02.97 12.08-------------------
+
+--------------------------------------------------*/
+
+ SvxSingleNumPickTabPage::~SvxSingleNumPickTabPage()
+{
+ delete pActNum;
+ delete pExamplesVS;
+ delete pSaveNum;
+ aNumSettingsArr.DeleteAndDestroy(0, aNumSettingsArr.Count());
+}
+
+/*-----------------07.02.97 12.13-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* SvxSingleNumPickTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SvxSingleNumPickTabPage(pParent, rAttrSet);
+}
+
+/*-----------------07.02.97 12.09-------------------
+
+--------------------------------------------------*/
+
+
+BOOL SvxSingleNumPickTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ if(bPreset || bModified && pSaveNum)
+ {
+ *pSaveNum = *pActNum;
+ rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
+ rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
+ }
+
+ return bModified;
+}
+
+/*-----------------08.02.97 16.27-------------------
+
+--------------------------------------------------*/
+
+void SvxSingleNumPickTabPage::ActivatePage(const SfxItemSet& rSet)
+{
+ const SfxPoolItem* pItem;
+ bPreset = FALSE;
+ BOOL bIsPreset = FALSE;
+ const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ if(pExampleSet)
+ {
+ if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem))
+ bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
+ if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem))
+ nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem))
+ {
+ delete pSaveNum;
+ pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+ }
+ if(*pSaveNum != *pActNum)
+ {
+ *pActNum = *pSaveNum;
+ pExamplesVS->SetNoSelection();
+ }
+ // ersten Eintrag vorselektieren
+ if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))
+ {
+ pExamplesVS->SelectItem(1);
+ NumSelectHdl_Impl(pExamplesVS);
+ bPreset = TRUE;
+ }
+ bPreset |= bIsPreset;
+
+ bModified = FALSE;
+}
+
+/*-----------------08.02.97 11.28-------------------
+
+--------------------------------------------------*/
+
+int SvxSingleNumPickTabPage::DeactivatePage(SfxItemSet *_pSet)
+{
+ if(_pSet)
+ FillItemSet(*_pSet);
+ return TRUE;
+}
+
+/*-----------------07.02.97 12.09-------------------
+
+--------------------------------------------------*/
+
+
+void SvxSingleNumPickTabPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem;
+// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel();
+ //im Draw gibt es das Item als WhichId, im Writer nur als SlotId
+ SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem);
+ if(eState != SFX_ITEM_SET)
+ {
+ nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
+ eState = rSet.GetItemState(nNumItemId, FALSE, &pItem);
+ }
+ DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
+ delete pSaveNum;
+ pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+
+ if(!pActNum)
+ pActNum = new SvxNumRule(*pSaveNum);
+ else if(*pSaveNum != *pActNum)
+ *pActNum = *pSaveNum;
+}
+/*-----------------08.02.97 11.40-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(SvxSingleNumPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
+{
+ if(pActNum)
+ {
+ bPreset = FALSE;
+ bModified = TRUE;
+ USHORT nIdx = pExamplesVS->GetSelectItemId() - 1;
+ DBG_ASSERT(aNumSettingsArr.Count() > nIdx, "wrong index");
+ if(aNumSettingsArr.Count() <= nIdx)
+ return 0;
+ SvxNumSettings_ImplPtr _pSet = aNumSettingsArr.GetObject(nIdx);
+ sal_Int16 eNewType = _pSet->nNumberType;
+ const sal_Unicode cLocalPrefix = _pSet->sPrefix.getLength() ? _pSet->sPrefix.getStr()[0] : 0;
+ const sal_Unicode cLocalSuffix = _pSet->sSuffix.getLength() ? _pSet->sSuffix.getStr()[0] : 0;
+
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aFmt(pActNum->GetLevel(i));
+ aFmt.SetNumberingType(eNewType);
+ String aEmptyStr;
+ if(cLocalPrefix == ' ')
+ aFmt.SetPrefix( aEmptyStr );
+ else
+ aFmt.SetPrefix(_pSet->sPrefix);
+ if(cLocalSuffix == ' ')
+ aFmt.SetSuffix( aEmptyStr );
+ else
+ aFmt.SetSuffix(_pSet->sSuffix);
+ aFmt.SetCharFmtName(sNumCharFmtName);
+ // #62069# // #92724#
+ aFmt.SetBulletRelSize(100);
+ pActNum->SetLevel(i, aFmt);
+ }
+ nMask <<= 1 ;
+ }
+ }
+ return 0;
+}
+
+/*-----------------06.06.97 11.15-------------------
+
+--------------------------------------------------*/
+IMPL_LINK(SvxSingleNumPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG)
+{
+ NumSelectHdl_Impl(pExamplesVS);
+ OKButton& rOk = GetTabDialog()->GetOKButton();
+ rOk.GetClickHdl().Call(&rOk);
+ return 0;
+}
+
+/**************************************************************************/
+/* */
+/* */
+/**************************************************************************/
+
+
+SvxBulletPickTabPage::SvxBulletPickTabPage(Window* pParent,
+ const SfxItemSet& rSet) :
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PICK_BULLET ), rSet ),
+ aValuesFL( this, SVX_RES(FL_VALUES) ),
+ pExamplesVS( new SvxNumValueSet(this, SVX_RES(VS_VALUES), NUM_PAGETYPE_BULLET )),
+ pActNum(0),
+ pSaveNum(0),
+ nActNumLvl( USHRT_MAX ),
+ bModified(FALSE),
+ bPreset(FALSE),
+ nNumItemId(SID_ATTR_NUMBERING_RULE)
+{
+ FreeResource();
+ SetExchangeSupport();
+ pExamplesVS->SetSelectHdl(LINK(this, SvxBulletPickTabPage, NumSelectHdl_Impl));
+ pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl));
+ pExamplesVS->SetHelpId(HID_VALUESET_BULLET );
+
+}
+/*-----------------07.02.97 12.10-------------------
+
+--------------------------------------------------*/
+
+
+ SvxBulletPickTabPage::~SvxBulletPickTabPage()
+{
+ delete pActNum;
+ delete pExamplesVS;
+ delete pSaveNum;
+}
+/*-----------------07.02.97 12.10-------------------
+
+--------------------------------------------------*/
+
+
+SfxTabPage* SvxBulletPickTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SvxBulletPickTabPage(pParent, rAttrSet);
+}
+
+/*-----------------07.02.97 12.10-------------------
+
+--------------------------------------------------*/
+
+
+BOOL SvxBulletPickTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ if(bPreset || bModified && pActNum)
+ {
+ *pSaveNum = *pActNum;
+ rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
+ rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
+ }
+ return bModified;
+}
+/*-----------------08.02.97 16.28-------------------
+
+--------------------------------------------------*/
+
+void SvxBulletPickTabPage::ActivatePage(const SfxItemSet& rSet)
+{
+ const SfxPoolItem* pItem;
+ bPreset = FALSE;
+ BOOL bIsPreset = FALSE;
+ const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ if(pExampleSet)
+ {
+ if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem))
+ bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
+ if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem))
+ nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem))
+ {
+ delete pSaveNum;
+ pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+ }
+ if(*pSaveNum != *pActNum)
+ {
+ *pActNum = *pSaveNum;
+ pExamplesVS->SetNoSelection();
+ }
+ // ersten Eintrag vorselektieren
+ if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))
+ {
+ pExamplesVS->SelectItem(1);
+ NumSelectHdl_Impl(pExamplesVS);
+ bPreset = TRUE;
+ }
+ bPreset |= bIsPreset;
+ bModified = FALSE;
+}
+/*-----------------08.02.97 11.28-------------------
+
+--------------------------------------------------*/
+
+int SvxBulletPickTabPage::DeactivatePage(SfxItemSet *_pSet)
+{
+ if(_pSet)
+ FillItemSet(*_pSet);
+ return TRUE;
+}
+
+/*-----------------07.02.97 12.11-------------------
+
+--------------------------------------------------*/
+
+
+void SvxBulletPickTabPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem;
+ //im Draw gibt es das Item als WhichId, im Writer nur als SlotId
+ SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem);
+ if(eState != SFX_ITEM_SET)
+ {
+ nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
+ eState = rSet.GetItemState(nNumItemId, FALSE, &pItem);
+ }
+ DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
+ delete pSaveNum;
+ pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+
+// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel();
+
+ if(!pActNum)
+ pActNum = new SvxNumRule(*pSaveNum);
+ else if(*pSaveNum != *pActNum)
+ *pActNum = *pSaveNum;
+}
+/*-----------------08.02.97 11.58-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(SvxBulletPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
+{
+ if(pActNum)
+ {
+ bPreset = FALSE;
+ bModified = TRUE;
+ sal_Unicode cChar = aBulletTypes[pExamplesVS->GetSelectItemId() - 1];
+ Font& rActBulletFont = lcl_GetDefaultBulletFont();
+
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aFmt(pActNum->GetLevel(i));
+ aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL );
+ aFmt.SetBulletFont(&rActBulletFont);
+ aFmt.SetBulletChar(cChar );
+ aFmt.SetCharFmtName(sBulletCharFmtName);
+ // #62069# // #92724#
+ aFmt.SetBulletRelSize(45);
+ pActNum->SetLevel(i, aFmt);
+ }
+ nMask <<= 1;
+ }
+ }
+
+ return 0;
+}
+
+/*-----------------06.06.97 11.16-------------------
+
+--------------------------------------------------*/
+IMPL_LINK(SvxBulletPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG)
+{
+ NumSelectHdl_Impl(pExamplesVS);
+ OKButton& rOk = GetTabDialog()->GetOKButton();
+ rOk.GetClickHdl().Call(&rOk);
+ return 0;
+}
+
+//Add CHINA001
+void SvxBulletPickTabPage::PageCreated(SfxAllItemSet aSet)
+{
+
+ SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);
+
+ if (pBulletCharFmt)
+ SetCharFmtName( pBulletCharFmt->GetValue());
+
+
+}
+//end of add CHINA001
+/**************************************************************************/
+/* */
+/* */
+/**************************************************************************/
+
+
+SvxNumPickTabPage::SvxNumPickTabPage(Window* pParent,
+ const SfxItemSet& rSet) :
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PICK_NUM ), rSet ),
+ aValuesFL( this, SVX_RES(FL_VALUES) ),
+ pExamplesVS( new SvxNumValueSet(this, SVX_RES(VS_VALUES), NUM_PAGETYPE_NUM )),
+ pActNum(0),
+ pSaveNum(0),
+ nActNumLvl( USHRT_MAX ),
+ nNumItemId(SID_ATTR_NUMBERING_RULE),
+ bModified(FALSE),
+ bPreset(FALSE)
+{
+
+ FreeResource();
+
+ SetExchangeSupport();
+
+ pExamplesVS->SetSelectHdl(LINK(this, SvxNumPickTabPage, NumSelectHdl_Impl));
+ pExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, DoubleClickHdl_Impl));
+ pExamplesVS->SetHelpId(HID_VALUESET_NUM );
+
+ Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
+ if(xDefNum.is())
+ {
+ Sequence<Reference<XIndexAccess> > aOutlineAccess;
+ LanguageType eLang = Application::GetSettings().GetLanguage();
+ Locale aLocale = SvxCreateLocale(eLang);
+ try
+ {
+ aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale );
+
+ for(sal_Int32 nItem = 0;
+ nItem < aOutlineAccess.getLength() && nItem < NUM_VALUSET_COUNT;
+ nItem++ )
+ {
+ SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[ nItem ];
+
+ Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem];
+ for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++)
+ {
+ Any aValueAny = xLevel->getByIndex(nLevel);
+ Sequence<PropertyValue> aLevelProps;
+ aValueAny >>= aLevelProps;
+ SvxNumSettings_ImplPtr pNew = lcl_CreateNumSettingsPtr(aLevelProps);
+ rItemArr.Insert( pNew, rItemArr.Count() );
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ }
+ Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
+ pExamplesVS->SetOutlineNumberingSettings(aOutlineAccess, xFormat, aLocale);
+ }
+}
+/*-----------------07.02.97 12.12-------------------
+
+--------------------------------------------------*/
+
+
+ SvxNumPickTabPage::~SvxNumPickTabPage()
+{
+ delete pActNum;
+ delete pExamplesVS;
+ delete pSaveNum;
+}
+
+/*-----------------07.02.97 12.12-------------------
+
+--------------------------------------------------*/
+
+
+SfxTabPage* SvxNumPickTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SvxNumPickTabPage(pParent, rAttrSet);
+}
+
+/*-----------------07.02.97 12.12-------------------
+
+--------------------------------------------------*/
+
+
+BOOL SvxNumPickTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ if(bPreset || bModified && pActNum)
+ {
+ *pSaveNum = *pActNum;
+ rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
+ rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
+ }
+ return bModified;
+}
+/*-----------------08.02.97 16.28-------------------
+
+--------------------------------------------------*/
+
+void SvxNumPickTabPage::ActivatePage(const SfxItemSet& rSet)
+{
+ const SfxPoolItem* pItem;
+ bPreset = FALSE;
+ BOOL bIsPreset = FALSE;
+ const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ if(pExampleSet)
+ {
+ if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem))
+ bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
+ if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem))
+ nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem))
+ {
+ delete pSaveNum;
+ pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+ }
+ if(*pSaveNum != *pActNum)
+ {
+ *pActNum = *pSaveNum;
+ pExamplesVS->SetNoSelection();
+ }
+ // ersten Eintrag vorselektieren
+ if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))
+ {
+ pExamplesVS->SelectItem(1);
+ NumSelectHdl_Impl(pExamplesVS);
+ bPreset = TRUE;
+ }
+ bPreset |= bIsPreset;
+ bModified = FALSE;
+}
+
+/* -----------------08.02.97 11.29-------------------
+
+--------------------------------------------------*/
+
+int SvxNumPickTabPage::DeactivatePage(SfxItemSet *_pSet)
+{
+ if(_pSet)
+ FillItemSet(*_pSet);
+ return TRUE;
+}
+
+/*-----------------07.02.97 12.12-------------------
+
+--------------------------------------------------*/
+
+void SvxNumPickTabPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem;
+ //im Draw gibt es das Item als WhichId, im Writer nur als SlotId
+ SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem);
+ if(eState != SFX_ITEM_SET)
+ {
+ nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
+ eState = rSet.GetItemState(nNumItemId, FALSE, &pItem);
+ }
+ DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
+ delete pSaveNum;
+ pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+
+// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel();
+ if(!pActNum)
+ pActNum = new SvxNumRule(*pSaveNum);
+ else if(*pSaveNum != *pActNum)
+ *pActNum = *pSaveNum;
+
+}
+
+/*-----------------08.02.97 11.58-------------------
+ Hier werden alle Ebenen veraendert,
+--------------------------------------------------*/
+
+IMPL_LINK(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
+{
+ if(pActNum)
+ {
+ bPreset = FALSE;
+ bModified = TRUE;
+
+ const FontList* pList = 0;
+
+ SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[pExamplesVS->GetSelectItemId() - 1];
+
+ Font& rActBulletFont = lcl_GetDefaultBulletFont();
+ SvxNumSettings_ImplPtr pLevelSettings = 0;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(rItemArr.Count() > i)
+ pLevelSettings = rItemArr[i];
+ if(!pLevelSettings)
+ break;
+ SvxNumberFormat aFmt(pActNum->GetLevel(i));
+ aFmt.SetNumberingType( pLevelSettings->nNumberType );
+ USHORT nUpperLevelOrChar = (USHORT)pLevelSettings->nParentNumbering;
+ if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL)
+ {
+ if( pLevelSettings->sBulletFont.getLength() &&
+ pLevelSettings->sBulletFont.compareTo(
+ rActBulletFont.GetName()))
+ {
+ //search for the font
+ if(!pList)
+ {
+ SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
+ const SvxFontListItem* pFontListItem =
+ (const SvxFontListItem* )pCurDocShell
+ ->GetItem( SID_ATTR_CHAR_FONTLIST );
+ pList = pFontListItem ? pFontListItem->GetFontList() : 0;
+ }
+ if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) )
+ {
+ FontInfo aInfo = pList->Get(
+ pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE);
+ Font aFont(aInfo);
+ aFmt.SetBulletFont(&aFont);
+ }
+ else
+ {
+ //if it cannot be found then create a new one
+ Font aCreateFont( pLevelSettings->sBulletFont,
+ String(), Size( 0, 14 ) );
+ aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW );
+ aCreateFont.SetFamily( FAMILY_DONTKNOW );
+ aCreateFont.SetPitch( PITCH_DONTKNOW );
+ aCreateFont.SetWeight( WEIGHT_DONTKNOW );
+ aCreateFont.SetTransparent( TRUE );
+ aFmt.SetBulletFont( &aCreateFont );
+ }
+ }
+ else
+ aFmt.SetBulletFont( &rActBulletFont );
+
+ aFmt.SetBulletChar( pLevelSettings->sBulletChar.getLength()
+ ? pLevelSettings->sBulletChar.getStr()[0]
+ : 0 );
+ aFmt.SetCharFmtName( sBulletCharFmtName );
+ // #62069# // #92724#
+ aFmt.SetBulletRelSize(45);
+ }
+ else
+ {
+ aFmt.SetIncludeUpperLevels(sal::static_int_cast< BYTE >(0 != nUpperLevelOrChar ? pActNum->GetLevelCount() : 0));
+ aFmt.SetCharFmtName(sNumCharFmtName);
+ // #62069# // #92724#
+ aFmt.SetBulletRelSize(100);
+ }
+ aFmt.SetPrefix(pLevelSettings->sPrefix);
+ aFmt.SetSuffix(pLevelSettings->sSuffix);
+ pActNum->SetLevel(i, aFmt);
+ }
+ }
+ return 0;
+}
+
+/*-----------------06.06.97 11.16-------------------
+
+--------------------------------------------------*/
+IMPL_LINK(SvxNumPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG)
+{
+ NumSelectHdl_Impl(pExamplesVS);
+ OKButton& rOk = GetTabDialog()->GetOKButton();
+ rOk.GetClickHdl().Call(&rOk);
+ return 0;
+}
+
+//add CHINA001 begin
+void SvxNumPickTabPage::PageCreated(SfxAllItemSet aSet)
+{
+ SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);
+
+
+ if (pNumCharFmt &&pBulletCharFmt)
+ SetCharFmtNames( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue());
+}
+//end of CHINA001
+/*-----------------07.02.97 15.59-------------------
+
+--------------------------------------------------*/
+void lcl_PaintLevel(OutputDevice* pVDev, sal_Int16 nNumberingType,
+ const OUString& rBulletChar, const OUString& rText, const OUString& rFontName,
+ Point& rLeft, Font& rRuleFont, const Font& rTextFont)
+{
+
+ if(NumberingType::CHAR_SPECIAL == nNumberingType )
+ {
+ rRuleFont.SetStyleName(rFontName);
+ pVDev->SetFont(rRuleFont);
+ pVDev->DrawText(rLeft, rBulletChar);
+ rLeft.X() += pVDev->GetTextWidth(rBulletChar);
+ }
+ else
+ {
+ pVDev->SetFont(rTextFont);
+ pVDev->DrawText(rLeft, rText);
+ rLeft.X() += pVDev->GetTextWidth(rText);
+ }
+}
+
+/**************************************************************************/
+/* */
+/* */
+/**************************************************************************/
+
+SvxBitmapPickTabPage::SvxBitmapPickTabPage(Window* pParent,
+ const SfxItemSet& rSet) :
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PICK_BMP ), rSet ),
+ aValuesFL( this, SVX_RES(FL_VALUES) ),
+ pExamplesVS( new SvxBmpNumValueSet(this, SVX_RES(VS_VALUES)/*, aGrfNames*/ )),
+ aErrorText( this, SVX_RES(FT_ERROR)),
+ aLinkedCB( this, SVX_RES(CB_LINKED)),
+ pActNum(0),
+ pSaveNum(0),
+ nActNumLvl( USHRT_MAX ),
+ nNumItemId(SID_ATTR_NUMBERING_RULE),
+ bModified(FALSE),
+ bPreset(FALSE)
+{
+ FreeResource();
+ SetExchangeSupport();
+ eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
+ pExamplesVS->SetSelectHdl(LINK(this, SvxBitmapPickTabPage, NumSelectHdl_Impl));
+ pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBitmapPickTabPage, DoubleClickHdl_Impl));
+ aLinkedCB.SetClickHdl(LINK(this, SvxBitmapPickTabPage, LinkBmpHdl_Impl));
+
+ // Grafiknamen ermitteln
+
+ GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
+ pExamplesVS->SetHelpId(HID_VALUESET_NUMBMP );
+ for(USHORT i = 0; i < aGrfNames.Count(); i++)
+ {
+ pExamplesVS->InsertItem( i + 1, i);
+ String* pGrfNm = (String*) aGrfNames.GetObject(i);
+ INetURLObject aObj(*pGrfNm);
+ if(aObj.GetProtocol() == INET_PROT_FILE)
+ *pGrfNm = aObj.PathToFileName();
+ pExamplesVS->SetItemText( i + 1, *pGrfNm );
+ }
+ if(!aGrfNames.Count())
+ {
+ aErrorText.Show();
+ }
+ else
+ {
+ pExamplesVS->Show();
+ pExamplesVS->Format();
+ }
+
+}
+
+/*-----------------12.02.97 07.46-------------------
+
+--------------------------------------------------*/
+
+ SvxBitmapPickTabPage::~SvxBitmapPickTabPage()
+{
+ String* pStr = (String*)aGrfNames.First();
+ while( pStr )
+ {
+ delete pStr;
+ pStr = (String*)aGrfNames.Next();
+ }
+ delete pExamplesVS;
+ delete pActNum;
+ delete pSaveNum;
+}
+
+/*-----------------12.02.97 07.46-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* SvxBitmapPickTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SvxBitmapPickTabPage(pParent, rAttrSet);
+}
+
+/*-----------------12.02.97 07.46-------------------
+
+--------------------------------------------------*/
+
+void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet)
+{
+ const SfxPoolItem* pItem;
+ bPreset = FALSE;
+ BOOL bIsPreset = FALSE;
+// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel();
+ const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ if(pExampleSet)
+ {
+ if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem))
+ bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
+ if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem))
+ nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem))
+ {
+ delete pSaveNum;
+ pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+ }
+ if(*pSaveNum != *pActNum)
+ {
+ *pActNum = *pSaveNum;
+ pExamplesVS->SetNoSelection();
+ }
+ // ersten Eintrag vorselektieren
+ if(aGrfNames.Count() &&
+ (pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)))
+ {
+ pExamplesVS->SelectItem(1);
+ NumSelectHdl_Impl(pExamplesVS);
+ bPreset = TRUE;
+ }
+ bPreset |= bIsPreset;
+ bModified = FALSE;
+}
+/*-----------------12.02.97 07.46-------------------
+
+--------------------------------------------------*/
+
+int SvxBitmapPickTabPage::DeactivatePage(SfxItemSet *_pSet)
+{
+ if(_pSet)
+ FillItemSet(*_pSet);
+ return TRUE;
+}
+/*-----------------12.02.97 07.46-------------------
+
+--------------------------------------------------*/
+
+BOOL SvxBitmapPickTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ if ( !aGrfNames.Count() )
+ {
+// das ist im SfxItemSet leider nicht zulaessig #52134#
+// rSet.DisableItem(SID_ATTR_NUMBERING_RULE);
+ return FALSE;
+ }
+ if(bPreset || bModified && pActNum)
+ {
+ *pSaveNum = *pActNum;
+ rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
+ rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
+ }
+
+ return bModified;
+}
+/*-----------------12.02.97 07.46-------------------
+
+--------------------------------------------------*/
+
+void SvxBitmapPickTabPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem;
+ //im Draw gibt es das Item als WhichId, im Writer nur als SlotId
+ SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem);
+ if(eState != SFX_ITEM_SET)
+ {
+ nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
+ eState = rSet.GetItemState(nNumItemId, FALSE, &pItem);
+ }
+ DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
+ delete pSaveNum;
+ pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+
+ if(!pActNum)
+ pActNum = new SvxNumRule(*pSaveNum);
+ else if(*pSaveNum != *pActNum)
+ *pActNum = *pSaveNum;
+ if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP))
+ {
+ aLinkedCB.Check(FALSE);
+ aLinkedCB.Enable(FALSE);
+ }
+ else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP))
+ {
+ aLinkedCB.Check(TRUE);
+ aLinkedCB.Enable(FALSE);
+ }
+}
+
+/*-----------------12.02.97 07.53-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
+{
+ if(pActNum)
+ {
+ bPreset = FALSE;
+ bModified = TRUE;
+ USHORT nIdx = pExamplesVS->GetSelectItemId() - 1;
+
+ String* pGrfName = 0;
+ if(aGrfNames.Count() > nIdx)
+ pGrfName = (String*)aGrfNames.GetObject(nIdx);
+
+ USHORT nMask = 1;
+ String aEmptyStr;
+ USHORT nSetNumberingType = SVX_NUM_BITMAP;
+ if(aLinkedCB.IsChecked())
+ nSetNumberingType |= LINK_TOKEN;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aFmt(pActNum->GetLevel(i));
+ aFmt.SetNumberingType(nSetNumberingType);
+ aFmt.SetPrefix( aEmptyStr );
+ aFmt.SetSuffix( aEmptyStr );
+ aFmt.SetCharFmtName( sNumCharFmtName );
+
+ Graphic aGraphic;
+ if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nIdx, &aGraphic))
+ {
+ Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
+ sal_Int16 eOrient = text::VertOrientation::LINE_CENTER;
+ aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit);
+ SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH );
+ aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient );
+ }
+ else if(pGrfName)
+ aFmt.SetGraphic( *pGrfName );
+ pActNum->SetLevel(i, aFmt);
+ }
+ nMask <<= 1 ;
+ }
+ }
+
+ return 0;
+}
+
+/*-----------------06.06.97 11.17-------------------
+
+--------------------------------------------------*/
+IMPL_LINK(SvxBitmapPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG)
+{
+ NumSelectHdl_Impl(pExamplesVS);
+ OKButton& rOk = GetTabDialog()->GetOKButton();
+ rOk.GetClickHdl().Call(&rOk);
+ return 0;
+}
+/* -----------------03.11.99 13:46-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SvxBitmapPickTabPage, LinkBmpHdl_Impl, CheckBox*, EMPTYARG )
+{
+ if(!pExamplesVS->IsNoSelection())
+ {
+ NumSelectHdl_Impl(pExamplesVS);
+ }
+ return 0;
+}
+/*-----------------13.02.97 09.40-------------------
+
+--------------------------------------------------*/
+
+//CHINA001 SvxBmpNumValueSet::SvxBmpNumValueSet( Window* pParent, const ResId& rResId/*, const List& rStrNames*/ ) :
+//CHINA001
+//CHINA001 SvxNumValueSet( pParent, rResId, NUM_PAGETYPE_BMP ),
+//CHINA001 // rStrList ( rStrNames ),
+//CHINA001 bGrfNotFound( FALSE )
+//CHINA001
+//CHINA001 {
+//CHINA001 GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
+//CHINA001 SetStyle( GetStyle() | WB_VSCROLL );
+//CHINA001 SetLineCount( 3 );
+//CHINA001 aFormatTimer.SetTimeout(300);
+//CHINA001 aFormatTimer.SetTimeoutHdl(LINK(this, SvxBmpNumValueSet, FormatHdl_Impl));
+//CHINA001 }
+//CHINA001
+//CHINA001 /*-----------------13.02.97 09.41-------------------
+//CHINA001
+//CHINA001 --------------------------------------------------*/
+//CHINA001
+//CHINA001 SvxBmpNumValueSet::~SvxBmpNumValueSet()
+//CHINA001 {
+//CHINA001 GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
+//CHINA001 aFormatTimer.Stop();
+//CHINA001 }
+//CHINA001 /*-----------------13.02.97 09.41-------------------
+//CHINA001
+//CHINA001 --------------------------------------------------*/
+//CHINA001
+//CHINA001 void SvxBmpNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
+//CHINA001 {
+//CHINA001 SvxNumValueSet::UserDraw(rUDEvt);
+//CHINA001
+//CHINA001 Rectangle aRect = rUDEvt.GetRect();
+//CHINA001 OutputDevice* pDev = rUDEvt.GetDevice();
+//CHINA001 USHORT nItemId = rUDEvt.GetItemId();
+//CHINA001 Point aBLPos = aRect.TopLeft();
+//CHINA001
+//CHINA001 int nRectHeight = aRect.GetHeight();
+//CHINA001 Size aSize(nRectHeight/8, nRectHeight/8);
+//CHINA001
+//CHINA001 Graphic aGraphic;
+//CHINA001 if(!GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nItemId - 1,
+//CHINA001 &aGraphic, NULL))
+//CHINA001 {
+//CHINA001 bGrfNotFound = TRUE;
+//CHINA001 }
+//CHINA001 else
+//CHINA001 {
+//CHINA001 Point aPos(aBLPos.X() + 5, 0);
+//CHINA001 for( USHORT i = 0; i < 3; i++ )
+//CHINA001 {
+//CHINA001 USHORT nY = 11 + i * 33;
+//CHINA001 aPos.Y() = aBLPos.Y() + nRectHeight * nY / 100;
+//CHINA001 aGraphic.Draw( pDev, aPos, aSize );
+//CHINA001 }
+//CHINA001 }
+//CHINA001 }
+//CHINA001
+//CHINA001 /*-----------------14.02.97 07.34-------------------
+//CHINA001
+//CHINA001 --------------------------------------------------*/
+//CHINA001
+//CHINA001 IMPL_LINK(SvxBmpNumValueSet, FormatHdl_Impl, Timer*, EMPTYARG)
+//CHINA001 {
+//CHINA001 // nur, wenn eine Grafik nicht da war, muss formatiert werden
+//CHINA001 if(bGrfNotFound)
+//CHINA001 {
+//CHINA001 bGrfNotFound = FALSE;
+//CHINA001 Format();
+//CHINA001 }
+//CHINA001 Invalidate();
+//CHINA001 return 0;
+//CHINA001 }
+/*-----------------01.12.97 16:15-------------------
+ Tabpage Numerierungsoptionen
+--------------------------------------------------*/
+#define NUM_NO_GRAPHIC 1000
+SvxNumOptionsTabPage::SvxNumOptionsTabPage(Window* pParent,
+ const SfxItemSet& rSet) :
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_NUM_OPTIONS ), rSet ),
+
+ aFormatFL( this, SVX_RES(FL_FORMAT )),
+ aLevelFT( this, SVX_RES(FT_LEVEL )),
+ aLevelLB( this, SVX_RES(LB_LEVEL )),
+ aFmtFT( this, SVX_RES(FT_FMT )),
+ aFmtLB( this, SVX_RES(LB_FMT )),
+ aPrefixFT( this, SVX_RES(FT_PREFIX )),
+ aPrefixED( this, SVX_RES(ED_PREFIX )),
+ aSuffixFT( this, SVX_RES(FT_SUFFIX )),
+ aSuffixED( this, SVX_RES(ED_SUFFIX )),
+ aCharFmtFT( this, SVX_RES(FT_CHARFMT )),
+ aCharFmtLB( this, SVX_RES(LB_CHARFMT )),
+ aBulColorFT( this, SVX_RES(FT_BUL_COLOR)),
+ aBulColLB( this, SVX_RES(LB_BUL_COLOR)),
+ aBulRelSizeFT( this, SVX_RES(FT_BUL_REL_SIZE)),
+ aBulRelSizeMF( this, SVX_RES(MF_BUL_REL_SIZE)),
+ aAllLevelFT( this, SVX_RES(FT_ALL_LEVEL)),
+ aAllLevelNF( this, SVX_RES(NF_ALL_LEVEL)),
+ aStartFT( this, SVX_RES(FT_START )),
+ aStartED( this, SVX_RES(ED_START )),
+ aBulletPB( this, SVX_RES(PB_BULLET )),
+ aAlignFT( this, SVX_RES(FT_ALIGN )),
+ aAlignLB( this, SVX_RES(LB_ALIGN )),
+ aBitmapFT( this, SVX_RES(FT_BITMAP )),
+ aBitmapMB( this, SVX_RES(MB_BITMAP )),
+ aSizeFT( this, SVX_RES(FT_SIZE )),
+ aWidthMF( this, SVX_RES(MF_WIDTH )),
+ aMultFT( this, SVX_RES(FT_MULT )),
+ aHeightMF( this, SVX_RES(MF_HEIGHT )),
+ aRatioCB( this, SVX_RES(CB_RATIO )),
+ aOrientFT( this, SVX_RES(FT_ORIENT )),
+ aOrientLB( this, SVX_RES(LB_ORIENT )),
+ aSameLevelFL( this, SVX_RES(FL_SAME_LEVEL)),
+ aSameLevelCB( this, SVX_RES(CB_SAME_LEVEL)),
+ pPreviewWIN( new SvxNumberingPreview(this, SVX_RES(WIN_PREVIEW ))),
+ pActNum(0),
+ pSaveNum(0),
+ bLastWidthModified(FALSE),
+ bModified(FALSE),
+ bPreset(FALSE),
+ bAutomaticCharStyles(TRUE),
+ bHTMLMode(FALSE),
+ bMenuButtonInitialized(FALSE),
+ sBullet(SVX_RES(STR_BULLET)),
+ nBullet(0xff),
+ nActNumLvl(USHRT_MAX),
+ nNumItemId(SID_ATTR_NUMBERING_RULE)
+{
+ sStartWith = aStartFT.GetText();
+ pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
+ SetExchangeSupport();
+ aActBulletFont = lcl_GetDefaultBulletFont();
+
+ aBulletPB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, BulletHdl_Impl));
+ aFmtLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl));
+ aBitmapMB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, GraphicHdl_Impl));
+ aLevelLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, LevelHdl_Impl));
+ aCharFmtLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, CharFmtHdl_Impl));
+ aWidthMF.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl));
+ aHeightMF.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl));
+ aRatioCB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, RatioHdl_Impl));
+ aStartED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
+ aPrefixED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
+ aSuffixED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
+ aAllLevelNF.SetModifyHdl(LINK(this,SvxNumOptionsTabPage, AllLevelHdl_Impl));
+ aOrientLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, OrientHdl_Impl));
+ aSameLevelCB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, SameLevelHdl_Impl));
+ aBulRelSizeMF.SetModifyHdl(LINK(this,SvxNumOptionsTabPage, BulRelSizeHdl_Impl));
+ aBulColLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, BulColorHdl_Impl));
+ aInvalidateTimer.SetTimeoutHdl(LINK(this, SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl));
+ aInvalidateTimer.SetTimeout(50);
+
+ aBitmapMB.GetPopupMenu()->SetHighlightHdl(LINK(this, SvxNumOptionsTabPage, PopupActivateHdl_Impl));
+ PopupMenu* pPopup = new PopupMenu;
+ aBitmapMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup );
+
+ pPopup->InsertItem( NUM_NO_GRAPHIC, String(SVX_RES(ST_POPUP_EMPTY_ENTRY)) );
+ pPopup->EnableItem( NUM_NO_GRAPHIC, FALSE );
+
+ eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
+
+ FreeResource();
+
+ //get advanced numbering types from the component
+ Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
+ Reference<XNumberingTypeInfo> xInfo(xDefNum, UNO_QUERY);
+
+ // Extended numbering schemes present in the resource but not offered by
+ // the i18n framework per configuration must be removed from the listbox.
+ // Watch out for the ugly 0x88/*SVX_NUM_BITMAP|0x80*/ to not remove that.
+ const USHORT nDontRemove = 0xffff;
+ ::std::vector< USHORT> aRemove( aFmtLB.GetEntryCount(), nDontRemove);
+ for (size_t i=0; i<aRemove.size(); ++i)
+ {
+ USHORT nEntryData = (USHORT)(ULONG)aFmtLB.GetEntryData(
+ sal::static_int_cast< USHORT >(i));
+ if (nEntryData > NumberingType::CHARS_LOWER_LETTER_N &&
+ nEntryData != (SVX_NUM_BITMAP | 0x80))
+ aRemove[i] = nEntryData;
+ }
+ if(xInfo.is())
+ {
+ Sequence<sal_Int16> aTypes = xInfo->getSupportedNumberingTypes( );
+ const sal_Int16* pTypes = aTypes.getConstArray();
+ for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
+ {
+ sal_Int16 nCurrent = pTypes[nType];
+ if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
+ {
+ sal_Bool bInsert = sal_True;
+ for(USHORT nEntry = 0; nEntry < aFmtLB.GetEntryCount(); nEntry++)
+ {
+ USHORT nEntryData = (USHORT)(ULONG)aFmtLB.GetEntryData(nEntry);
+ if(nEntryData == (USHORT) nCurrent)
+ {
+ bInsert = sal_False;
+ aRemove[nEntry] = nDontRemove;
+ break;
+ }
+ }
+ if(bInsert)
+ {
+ OUString aIdent = xInfo->getNumberingIdentifier( nCurrent );
+ USHORT nPos = aFmtLB.InsertEntry(aIdent);
+ aFmtLB.SetEntryData(nPos,(void*)(ULONG)nCurrent);
+ }
+ }
+ }
+ }
+ for (size_t i=0; i<aRemove.size(); ++i)
+ {
+ if (aRemove[i] != nDontRemove)
+ {
+ USHORT nPos = aFmtLB.GetEntryPos( (void*)(ULONG)aRemove[i]);
+ aFmtLB.RemoveEntry( nPos);
+ }
+ }
+}
+
+/*-----------------01.12.97 16:30-------------------
+
+--------------------------------------------------*/
+SvxNumOptionsTabPage::~SvxNumOptionsTabPage()
+{
+ delete aBitmapMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
+ String* pStr = (String*)aGrfNames.First();
+ while( pStr )
+ {
+ delete pStr;
+ pStr = (String*)aGrfNames.Next();
+ }
+ delete pActNum;
+ delete pPreviewWIN;
+ delete pSaveNum;
+}
+
+/*-----------------03.12.97 07:52-------------------
+
+--------------------------------------------------*/
+void SvxNumOptionsTabPage::SetMetric(FieldUnit eMetric)
+{
+ if(eMetric == FUNIT_MM)
+ {
+ aWidthMF .SetDecimalDigits(1);
+ aHeightMF .SetDecimalDigits(1);
+ }
+ aWidthMF .SetUnit( eMetric );
+ aHeightMF .SetUnit( eMetric );
+}
+
+/*-----------------01.12.97 16:30-------------------
+
+--------------------------------------------------*/
+SfxTabPage* SvxNumOptionsTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SvxNumOptionsTabPage(pParent, rAttrSet);
+};
+/*-----------------01.12.97 16:29-------------------
+
+--------------------------------------------------*/
+void SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet)
+{
+ const SfxPoolItem* pItem;
+ const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ UINT16 nTmpNumLvl = USHRT_MAX;
+ if(pExampleSet)
+ {
+ if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem))
+ bPreset = ((const SfxBoolItem*)pItem)->GetValue();
+ if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem))
+ nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem))
+ {
+ delete pSaveNum;
+ pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+ }
+ //
+ bModified = (!pActNum->Get( 0 ) || bPreset);
+ if(*pActNum != *pSaveNum ||
+ nActNumLvl != nTmpNumLvl)
+ {
+ nActNumLvl = nTmpNumLvl;
+ USHORT nMask = 1;
+ aLevelLB.SetUpdateMode(FALSE);
+ aLevelLB.SetNoSelection();
+ aLevelLB.SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX);
+ if(nActNumLvl != USHRT_MAX)
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ aLevelLB.SelectEntryPos( i, TRUE);
+ nMask <<= 1 ;
+ }
+ aLevelLB.SetUpdateMode(TRUE);
+ *pActNum = *pSaveNum;
+ InitControls();
+ }
+
+}
+/*-----------------01.12.97 16:29-------------------
+
+--------------------------------------------------*/
+int SvxNumOptionsTabPage::DeactivatePage(SfxItemSet * _pSet)
+{
+ if(_pSet)
+ FillItemSet(*_pSet);
+ return TRUE;
+}
+/*-----------------01.12.97 16:29-------------------
+
+--------------------------------------------------*/
+BOOL SvxNumOptionsTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl));
+ if(bModified && pActNum)
+ {
+ *pSaveNum = *pActNum;
+ rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
+ rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, FALSE));
+ }
+ return bModified;
+};
+/*-----------------01.12.97 16:29-------------------
+
+--------------------------------------------------*/
+void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem;
+ //im Draw gibt es das Item als WhichId, im Writer nur als SlotId
+ SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem);
+ if(eState != SFX_ITEM_SET)
+ {
+ nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
+ eState = rSet.GetItemState(nNumItemId, FALSE, &pItem);
+ }
+ DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
+ delete pSaveNum;
+ pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+
+ // Ebenen einfuegen
+ if(!aLevelLB.GetEntryCount())
+ {
+ for(USHORT i = 1; i <= pSaveNum->GetLevelCount(); i++)
+ aLevelLB.InsertEntry( UniString::CreateFromInt32(i));
+ if(pSaveNum->GetLevelCount() > 1)
+ {
+ String sEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "1 - " ) ) );
+ sEntry += UniString::CreateFromInt32( pSaveNum->GetLevelCount() );
+ aLevelLB.InsertEntry(sEntry);
+ aLevelLB.SelectEntry(sEntry);
+ }
+ else
+ aLevelLB.SelectEntryPos(0);
+ }
+ else
+ aLevelLB.SelectEntryPos(aLevelLB.GetEntryCount() - 1);
+
+// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel();
+ USHORT nMask = 1;
+ aLevelLB.SetUpdateMode(FALSE);
+ aLevelLB.SetNoSelection();
+ if(nActNumLvl == USHRT_MAX)
+ {
+ aLevelLB.SelectEntryPos( pSaveNum->GetLevelCount(), TRUE);
+ }
+ else
+ for(USHORT i = 0; i < pSaveNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ aLevelLB.SelectEntryPos( i, TRUE);
+ nMask <<= 1 ;
+ }
+ aLevelLB.SetUpdateMode(TRUE);
+
+ if(!pActNum)
+ pActNum = new SvxNumRule(*pSaveNum);
+ else if(*pSaveNum != *pActNum)
+ *pActNum = *pSaveNum;
+ pPreviewWIN->SetNumRule(pActNum);
+ aSameLevelCB.Check(pActNum->IsContinuousNumbering());
+
+ //ColorListBox bei Bedarf fuellen
+ if ( pActNum->IsFeatureSupported( NUM_BULLET_COLOR ) )
+ {
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ DBG_ASSERT( pDocSh, "DocShell not found!" );
+ XColorTable* pColorTable = NULL;
+ FASTBOOL bKillTable = FALSE;
+ if ( pDocSh )
+ {
+ pItem = pDocSh->GetItem( SID_COLOR_TABLE );
+ if ( pItem )
+ pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
+ }
+
+ if ( !pColorTable )
+ {
+ pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+ bKillTable = TRUE;
+ }
+
+ aBulColLB.InsertEntry( Color( COL_AUTO ), SVX_RESSTR( RID_SVXSTR_AUTOMATIC ));
+
+ for ( long i = 0; i < pColorTable->Count(); i++ )
+ {
+ XColorEntry* pEntry = pColorTable->GetColor(i);
+ aBulColLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ }
+
+ if ( bKillTable )
+ delete pColorTable;
+ }
+
+ SfxObjectShell* pShell;
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, FALSE, &pItem )
+ || ( 0 != ( pShell = SfxObjectShell::Current()) &&
+ 0 != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) )
+ {
+ USHORT nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
+ bHTMLMode = 0 != (nHtmlMode&HTMLMODE_ON);
+ }
+
+ BOOL bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE);
+ aCharFmtFT.Show(bCharFmt);
+ aCharFmtLB.Show(bCharFmt);
+
+ BOOL bContinuous = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
+
+ BOOL bAllLevel = bContinuous && !bHTMLMode;
+ aAllLevelFT.Show(bAllLevel);
+ aAllLevelNF.Show(bAllLevel);
+
+ aSameLevelFL.Show(bContinuous);
+ aSameLevelCB.Show(bContinuous);
+ //wieder Missbrauch: im Draw gibt es die Numerierung nur bis zum Bitmap
+ // without SVX_NUM_NUMBER_NONE
+ //remove types that are unsupported by Draw/Impress
+ if(!bContinuous)
+ {
+ USHORT nFmtCount = aFmtLB.GetEntryCount();
+ for(USHORT i = nFmtCount; i; i--)
+ {
+ USHORT nEntryData = (USHORT)(ULONG)aFmtLB.GetEntryData(i - 1);
+ if(/*SVX_NUM_NUMBER_NONE == nEntryData ||*/
+ ((SVX_NUM_BITMAP|LINK_TOKEN) == nEntryData))
+ aFmtLB.RemoveEntry(i - 1);
+ }
+ }
+ //one must be enabled
+ if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP))
+ {
+ long nData = SVX_NUM_BITMAP|LINK_TOKEN;
+ USHORT nPos = aFmtLB.GetEntryPos((void*)nData);
+ if(LISTBOX_ENTRY_NOTFOUND != nPos)
+ aFmtLB.RemoveEntry(nPos);
+ }
+ else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP))
+ {
+ long nData = SVX_NUM_BITMAP;
+ USHORT nPos = aFmtLB.GetEntryPos((void*)nData);
+ if(LISTBOX_ENTRY_NOTFOUND != nPos)
+ aFmtLB.RemoveEntry(nPos);
+ }
+ if(pActNum->IsFeatureSupported(NUM_SYMBOL_ALIGNMENT))
+ {
+ aAlignFT.Show();
+ aAlignLB.Show();
+ Size aSz(aFormatFL.GetSizePixel());
+ aSz.Height() = aLevelFT.GetSizePixel().Height();
+ aFormatFL.SetSizePixel(aSz);
+ aAlignLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
+ }
+
+ //MegaHack: Aufgrund eines nicht fixbaren 'designfehlers' im Impress
+ //Alle arten der numerischen Aufzaehlungen loeschen
+ if(pActNum->IsFeatureSupported(NUM_NO_NUMBERS))
+ {
+ USHORT nFmtCount = aFmtLB.GetEntryCount();
+ for(USHORT i = nFmtCount; i; i--)
+ {
+ USHORT nEntryData = (USHORT)(ULONG)aFmtLB.GetEntryData(i - 1);
+ if( /*nEntryData >= SVX_NUM_CHARS_UPPER_LETTER &&*/ nEntryData <= SVX_NUM_NUMBER_NONE)
+ aFmtLB.RemoveEntry(i - 1);
+ }
+ }
+
+ InitControls();
+ bModified = FALSE;
+
+}
+/*-----------------02.12.97 13:47-------------------
+
+--------------------------------------------------*/
+void SvxNumOptionsTabPage::InitControls()
+{
+ BOOL bShowBullet = TRUE;
+ BOOL bShowBitmap = TRUE;
+ BOOL bSameType = TRUE;
+ BOOL bSameStart = TRUE;
+ BOOL bSamePrefix = TRUE;
+ BOOL bSameSuffix = TRUE;
+ BOOL bAllLevel = TRUE;
+ BOOL bSameCharFmt = TRUE;
+ BOOL bSameVOrient = TRUE;
+ BOOL bSameSize = TRUE;
+ BOOL bSameBulColor = TRUE;
+ BOOL bSameBulRelSize= TRUE;
+ BOOL bSameAdjust = TRUE;
+
+ const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
+ String sFirstCharFmt;
+ sal_Int16 eFirstOrient = text::VertOrientation::NONE;
+ Size aFirstSize(0,0);
+ USHORT nMask = 1;
+ USHORT nLvl = USHRT_MAX;
+ USHORT nHighestLevel = 0;
+ String aEmptyStr;
+
+ BOOL bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR);
+ BOOL bBullRelSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE);
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ aNumFmtArr[i] = &pActNum->GetLevel(i);
+ bShowBullet &= aNumFmtArr[i]->GetNumberingType() == SVX_NUM_CHAR_SPECIAL;
+ bShowBitmap &= (aNumFmtArr[i]->GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP;
+ if(USHRT_MAX == nLvl)
+ {
+ nLvl = i;
+ sFirstCharFmt = aNumFmtArr[i]->GetCharFmtName();
+ eFirstOrient = aNumFmtArr[i]->GetVertOrient();
+ if(bShowBitmap)
+ aFirstSize = aNumFmtArr[i]->GetGraphicSize();
+ }
+ if( i > nLvl)
+ {
+ bSameType &= aNumFmtArr[i]->GetNumberingType() == aNumFmtArr[nLvl]->GetNumberingType();
+ bSameStart = aNumFmtArr[i]->GetStart() == aNumFmtArr[nLvl]->GetStart();
+
+ bSamePrefix = aNumFmtArr[i]->GetPrefix() == aNumFmtArr[nLvl]->GetPrefix();
+ bSameSuffix = aNumFmtArr[i]->GetSuffix() == aNumFmtArr[nLvl]->GetSuffix();
+ bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[nLvl]->GetIncludeUpperLevels();
+ bSameCharFmt &= sFirstCharFmt == aNumFmtArr[i]->GetCharFmtName();
+ bSameVOrient &= eFirstOrient == aNumFmtArr[i]->GetVertOrient();
+ if(bShowBitmap && bSameSize)
+ bSameSize &= aNumFmtArr[i]->GetGraphicSize() == aFirstSize;
+ bSameBulColor &= aNumFmtArr[i]->GetBulletColor() == aNumFmtArr[nLvl]->GetBulletColor();
+ bSameBulRelSize &= aNumFmtArr[i]->GetBulletRelSize() == aNumFmtArr[nLvl]->GetBulletRelSize();
+ bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust();
+ }
+ nHighestLevel = i;
+ }
+ else
+ aNumFmtArr[i] = 0;
+
+ nMask <<= 1 ;
+
+ }
+ SwitchNumberType(bShowBullet ? 1 : bShowBitmap ? 2 : 0);
+ CheckForStartValue_Impl(aNumFmtArr[nLvl]->GetNumberingType());
+ if(bShowBitmap)
+ {
+ if(!bSameVOrient || eFirstOrient == text::VertOrientation::NONE)
+ aOrientLB.SetNoSelection();
+ else
+ aOrientLB.SelectEntryPos(
+ sal::static_int_cast< USHORT >(eFirstOrient - 1));
+ // kein text::VertOrientation::NONE
+
+ if(bSameSize)
+ {
+ SetMetricValue(aHeightMF, aFirstSize.Height(), eCoreUnit);
+ SetMetricValue(aWidthMF, aFirstSize.Width(), eCoreUnit);
+ }
+ else
+ {
+ aHeightMF.SetText(aEmptyStr);
+ aWidthMF.SetText(aEmptyStr);
+ }
+ }
+
+ if(bSameType)
+ {
+ USHORT nLBData = (USHORT) aNumFmtArr[nLvl]->GetNumberingType();
+ aFmtLB.SelectEntryPos(aFmtLB.GetEntryPos( (void*)sal::static_int_cast<sal_uIntPtr>( nLBData ) ));
+ }
+ else
+ aFmtLB.SetNoSelection();
+
+ aAllLevelNF.Enable(nHighestLevel > 0 && !aSameLevelCB.IsChecked());
+ aAllLevelNF.SetMax(nHighestLevel + 1);
+ if(bAllLevel)
+ {
+ aAllLevelNF.SetValue(aNumFmtArr[nLvl]->GetIncludeUpperLevels());
+ }
+ else
+ {
+ aAllLevelNF.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);
+ }
+ else
+ {
+ aAlignLB.SetNoSelection();
+ }
+
+ if(bBullRelSize)
+ {
+ if(bSameBulRelSize)
+ aBulRelSizeMF.SetValue(aNumFmtArr[nLvl]->GetBulletRelSize());
+ else
+ aBulRelSizeMF.SetText(aEmptyStr);
+ }
+ if(bBullColor)
+ {
+ if(bSameBulColor)
+ aBulColLB.SelectEntry(aNumFmtArr[nLvl]->GetBulletColor());
+ else
+ aBulColLB.SetNoSelection();
+ }
+ switch(nBullet)
+ {
+ case SHOW_NUMBERING:
+ if(bSameStart)
+ {
+ aStartED.SetValue(aNumFmtArr[nLvl]->GetStart());
+ }
+ else
+ aStartED.SetText(aEmptyStr);
+ break;
+ case SHOW_BULLET:
+ {
+// const Font* pFnt = aNumFmtArr[Lvl]->GetBulletFont();
+// if(pFnt)
+// ChgTxtFont(aBulletFT, *pFnt);
+// aBulletFT.SetText(String((char)aNumFmtArr[nLvl]->GetBulletChar()));
+ }
+ break;
+ case SHOW_BITMAP:
+ break;
+ }
+
+ if(bSamePrefix)
+ aPrefixED.SetText(aNumFmtArr[nLvl]->GetPrefix());
+ else
+ aPrefixED.SetText(aEmptyStr);
+ if(bSameSuffix)
+ aSuffixED.SetText(aNumFmtArr[nLvl]->GetSuffix());
+ else
+ aSuffixED.SetText(aEmptyStr);
+
+ if(bSameCharFmt)
+ {
+ if(sFirstCharFmt.Len())
+ aCharFmtLB.SelectEntry(sFirstCharFmt);
+ else
+ aCharFmtLB.SelectEntryPos( 0 );
+ }
+ else
+ aCharFmtLB.SetNoSelection();
+
+ pPreviewWIN->SetLevel(nActNumLvl);
+ pPreviewWIN->Invalidate();
+}
+
+/*-----------------02.12.97 14:01-------------------
+ 0 - Nummer; 1 - Bullet; 2 - Bitmap
+--------------------------------------------------*/
+
+void SvxNumOptionsTabPage::SwitchNumberType( BYTE nType, BOOL )
+{
+ if(nBullet == nType)
+ return;
+ nBullet = nType;
+ BOOL bBitmap = FALSE;
+ BOOL bBullet = FALSE;
+ BOOL bEnableBitmap = FALSE;
+ if(nType == SHOW_NUMBERING)
+ {
+ // Label umschalten, alten Text merken
+ aStartFT.SetText(sStartWith);
+
+ }
+ else if(nType == SHOW_BULLET)
+ {
+ // Label umschalten, alten Text merken
+ aStartFT.SetText(sBullet);
+ bBullet = TRUE;
+ }
+ else
+ {
+ bBitmap = TRUE;
+ bEnableBitmap = TRUE;
+ }
+ BOOL bNumeric = !(bBitmap||bBullet);
+ aPrefixFT.Show(bNumeric);
+ aPrefixED.Show(bNumeric);
+ aSuffixFT.Show(bNumeric);
+ aSuffixED.Show(bNumeric);
+
+ BOOL bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE);
+ aCharFmtFT.Show(!bBitmap && bCharFmt);
+ aCharFmtLB.Show(!bBitmap && bCharFmt);
+
+ // das ist eigentlich Missbrauch, da fuer die vollst. Numerierung kein
+ // eigenes Flag existiert
+ BOOL bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
+ BOOL bAllLevel = bNumeric && bAllLevelFeature && !bHTMLMode;
+ aAllLevelFT.Show(bAllLevel);
+ aAllLevelNF.Show(bAllLevel);
+
+ aStartFT.Show(!bBitmap);
+ aStartED.Show(!(bBullet||bBitmap));
+
+ aBulletPB.Show(bBullet);
+ BOOL bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR);
+ aBulColorFT.Show( !bBitmap && bBullColor );
+ aBulColLB.Show( !bBitmap && bBullColor );
+ BOOL bBullResSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE);
+ aBulRelSizeFT.Show( !bBitmap && bBullResSize );
+ aBulRelSizeMF.Show( !bBitmap && bBullResSize );
+
+ aBitmapFT .Show(bBitmap);
+ aBitmapMB .Show(bBitmap);
+
+ aSizeFT .Show(bBitmap);
+ aWidthMF .Show(bBitmap);
+ aMultFT .Show(bBitmap);
+ aHeightMF .Show(bBitmap);
+ aRatioCB .Show(bBitmap);
+
+ aOrientFT .Show(bBitmap && bAllLevelFeature);
+ aOrientLB .Show(bBitmap && bAllLevelFeature);
+
+ aSizeFT .Enable(bEnableBitmap);
+ aWidthMF .Enable(bEnableBitmap);
+ aMultFT .Enable(bEnableBitmap);
+ aHeightMF .Enable(bEnableBitmap);
+ aRatioCB .Enable(bEnableBitmap);
+ aOrientFT .Enable(bEnableBitmap);
+ aOrientLB .Enable(bEnableBitmap);
+
+}
+/*-----------------02.12.97 13:51-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, LevelHdl_Impl, ListBox *, pBox )
+{
+ USHORT nSaveNumLvl = nActNumLvl;
+ nActNumLvl = 0;
+ if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) &&
+ (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff))
+ {
+ nActNumLvl = 0xFFFF;
+ pBox->SetUpdateMode(FALSE);
+ for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ )
+ pBox->SelectEntryPos( i, FALSE );
+ pBox->SetUpdateMode(TRUE);
+ }
+ else if(pBox->GetSelectEntryCount())
+ {
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ )
+ {
+ if(pBox->IsEntryPosSelected( i ))
+ nActNumLvl |= nMask;
+ nMask <<= 1;
+ }
+ pBox->SelectEntryPos( pActNum->GetLevelCount(), FALSE );
+ }
+ else
+ {
+ nActNumLvl = nSaveNumLvl;
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ )
+ {
+ if(nActNumLvl & nMask)
+ {
+ pBox->SelectEntryPos(i);
+ break;
+ }
+ nMask <<=1;
+ }
+ }
+ InitControls();
+ return 0;
+}
+/* -----------------------------05.04.2002 15:30------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl, Timer*, EMPTYARG )
+{
+ pPreviewWIN->Invalidate();
+ return 0;
+}
+/*-----------------03.12.97 12:01-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, AllLevelHdl_Impl, NumericField*, pBox )
+{
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ USHORT nMask = 1;
+ for(USHORT e = 0; e < pActNum->GetLevelCount(); e++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(e));
+ aNumFmt.SetIncludeUpperLevels((BYTE) std::min(pBox->GetValue(), sal_Int64(e + 1)) );
+ pActNum->SetLevel(e, aNumFmt);
+ }
+ nMask <<= 1;
+ }
+ }
+ SetModified();
+ return 0;
+}
+
+/*-----------------02.12.97 08:56-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, ListBox *, pBox )
+{
+ String sSelectStyle;
+ sal_Int16 eOldType;
+ BOOL bShowOrient = FALSE;
+ BOOL bBmp = FALSE;
+ String aEmptyStr;
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ eOldType = aNumFmt.GetNumberingType();
+ // PAGEDESC gibt es nicht
+ USHORT nNumType = (USHORT)(ULONG)pBox->GetEntryData(pBox->GetSelectEntryPos());
+ aNumFmt.SetNumberingType((sal_Int16)nNumType);
+ sal_uInt16 nNumberingType = aNumFmt.GetNumberingType();
+ if(SVX_NUM_BITMAP == (nNumberingType&(~LINK_TOKEN)))
+ {
+ bBmp |= 0 != aNumFmt.GetBrush();
+ aNumFmt.SetIncludeUpperLevels( FALSE );
+ aNumFmt.SetSuffix( aEmptyStr );
+ aNumFmt.SetPrefix( aEmptyStr );
+ if(!bBmp)
+ aNumFmt.SetGraphic(aEmptyStr);
+ pActNum->SetLevel(i, aNumFmt);
+ SwitchNumberType(SHOW_BITMAP, bBmp );
+ bShowOrient = TRUE;
+ }
+ else if( SVX_NUM_CHAR_SPECIAL == nNumberingType )
+ {
+ aNumFmt.SetIncludeUpperLevels( FALSE );
+ aNumFmt.SetSuffix( aEmptyStr );
+ aNumFmt.SetPrefix( aEmptyStr );
+ if( !aNumFmt.GetBulletFont() )
+ aNumFmt.SetBulletFont(&aActBulletFont);
+ if( !aNumFmt.GetBulletChar() )
+ aNumFmt.SetBulletChar( SVX_DEF_BULLET );
+ pActNum->SetLevel(i, aNumFmt);
+ SwitchNumberType(SHOW_BULLET);
+ //ChgTxtFont(aBulletFT, *aNumFmt.GetBulletFont());
+ //aBulletFT.SetText( aNumFmt.GetBulletChar() );
+ // Zuweisung der Zeichenvorlage automatisch
+ if(bAutomaticCharStyles)
+ {
+ sSelectStyle = sBulletCharFmtName;
+ }
+ }
+ else
+ {
+ aNumFmt.SetPrefix( aPrefixED.GetText() );
+ aNumFmt.SetSuffix( aSuffixED.GetText() );
+// aNumFmt.SetBulletFont(0);
+ SwitchNumberType(SHOW_NUMBERING);
+ pActNum->SetLevel(i, aNumFmt);
+ CheckForStartValue_Impl(nNumberingType);
+
+ // Zuweisung der Zeichenvorlage automatisch
+ if(bAutomaticCharStyles)
+ {
+ sSelectStyle = sNumCharFmtName;
+ }
+ }
+ }
+ nMask <<= 1;
+ }
+ BOOL bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
+ if(bShowOrient && bAllLevelFeature)
+ {
+ aOrientFT.Show();
+ aOrientLB.Show();
+ }
+ else
+ {
+ aOrientFT.Hide();
+ aOrientLB.Hide();
+ }
+ SetModified();
+ if(sSelectStyle.Len())
+ {
+ aCharFmtLB.SelectEntry(sSelectStyle);
+ CharFmtHdl_Impl(&aCharFmtLB);
+ // bAutomaticCharStyles wird im CharFmtHdl_Impl zurueckgesetzt
+ bAutomaticCharStyles = TRUE;
+ }
+ return 0;
+}
+/* -----------------06.11.2002 14:27-----------------
+ *
+ * --------------------------------------------------*/
+void SvxNumOptionsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType)
+{
+ BOOL bIsNull = aStartED.GetValue() == 0;
+ BOOL bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC ||
+ SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType ||
+ SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType;
+ aStartED.SetMin(bNoZeroAllowed ? 1 : 0);
+ if(bIsNull && bNoZeroAllowed)
+ aStartED.GetModifyHdl().Call(&aStartED);
+}
+/*-----------------03.12.97 16:43-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, OrientHdl_Impl, ListBox *, pBox )
+{
+ USHORT nPos = pBox->GetSelectEntryPos();
+ nPos ++; // kein VERT_NONE
+
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
+ {
+ const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
+ const Size& rSize = aNumFmt.GetGraphicSize();
+ sal_Int16 eOrient = (sal_Int16)nPos;
+ aNumFmt.SetGraphicBrush( pBrushItem, &rSize, &eOrient );
+ pActNum->SetLevel(i, aNumFmt);
+ }
+ }
+ nMask <<= 1;
+ }
+ SetModified(FALSE);
+ return 0;
+
+}
+
+/*-----------------06.12.97 12:00-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, SameLevelHdl_Impl, CheckBox *, pBox )
+{
+ BOOL bSet = pBox->IsChecked();
+ pActNum->SetContinuousNumbering(bSet);
+ BOOL bRepaint = FALSE;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ if(aNumFmt.GetNumberingType() != SVX_NUM_NUMBER_NONE)
+ {
+ bRepaint = TRUE;
+ break;
+ }
+ }
+ SetModified(bRepaint);
+ InitControls();
+ return 0;
+}
+/* -----------------16.11.98 14:20-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, BulColorHdl_Impl, ColorListBox*, pBox )
+{
+ Color nSetColor = pBox->GetSelectEntryColor();
+
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ aNumFmt.SetBulletColor(nSetColor);
+ pActNum->SetLevel(i, aNumFmt);
+ }
+ nMask <<= 1;
+ }
+ SetModified();
+ return 0;
+}
+/* -----------------16.11.98 14:20-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, BulRelSizeHdl_Impl, MetricField *, pField)
+{
+ USHORT nRelSize = (USHORT)pField->GetValue();
+
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ aNumFmt.SetBulletRelSize(nRelSize);
+ pActNum->SetLevel(i, aNumFmt);
+ }
+ nMask <<= 1;
+ }
+ SetModified();
+ return 0;
+}
+
+/*-----------------02.12.97 10:50-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, GraphicHdl_Impl, MenuButton *, pButton )
+{
+ USHORT nItemId = pButton->GetCurItemId();
+ String aGrfName;
+ Size aSize;
+ sal_Bool bSucc(sal_False);
+ SvxOpenGraphicDialog aGrfDlg( SVX_RES(RID_STR_EDIT_GRAPHIC) );
+// aGrfDlg.SetDialogHelpId( HID_NUMBERINGOPT_SEL_GRF_FROM_FILE );
+
+ if(MN_GALLERY_ENTRY <= nItemId )
+ {
+ aGrfName = *((String*)aGrfNames.GetObject( nItemId - MN_GALLERY_ENTRY));
+ Graphic aGraphic;
+ if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nItemId - MN_GALLERY_ENTRY, &aGraphic))
+ {
+ aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
+ bSucc = sal_True;
+ }
+ }
+ else
+ {
+ aGrfDlg.EnableLink( sal_False );
+ aGrfDlg.AsLink( sal_False );
+ if ( !aGrfDlg.Execute() )
+ {
+ // ausgewaehlten Filter merken
+ aGrfName = aGrfDlg.GetPath();
+
+ Graphic aGraphic;
+ if( !aGrfDlg.GetGraphic(aGraphic) )
+ {
+ aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
+ bSucc = sal_True;
+ }
+ }
+ }
+ if(bSucc)
+ {
+ aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit);
+
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ aNumFmt.SetCharFmtName(sNumCharFmtName);
+ aNumFmt.SetGraphic(aGrfName);
+
+ // Size schon mal fuer spaeteren Groessenabgleich setzen
+ const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
+ // initiate asynchronous loading
+ sal_Int16 eOrient = aNumFmt.GetVertOrient();
+ aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient );
+ aInitSize[i] = aNumFmt.GetGraphicSize();
+
+ pActNum->SetLevel(i, aNumFmt);
+ }
+ nMask <<= 1;
+ }
+ aRatioCB .Enable();
+ aSizeFT .Enable();
+ aMultFT.Enable();
+ aWidthMF .Enable();
+ aHeightMF.Enable();
+ SetMetricValue(aWidthMF, aSize.Width(), eCoreUnit);
+ SetMetricValue(aHeightMF, aSize.Height(), eCoreUnit);
+ aOrientFT.Enable();
+ aOrientLB.Enable();
+ SetModified();
+ //needed due to asynchronous loading of graphics in the SvxBrushItem
+ aInvalidateTimer.Start();
+ }
+ return 0;
+}
+/* -----------------27.07.99 12:20-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, PopupActivateHdl_Impl, Menu *, EMPTYARG )
+{
+ if(!bMenuButtonInitialized)
+ {
+ bMenuButtonInitialized = TRUE;
+ EnterWait();
+ PopupMenu* pPopup = aBitmapMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
+ GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
+ if(aGrfNames.Count())
+ {
+ pPopup->RemoveItem( pPopup->GetItemPos( NUM_NO_GRAPHIC ));
+ String aEmptyStr;
+ GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
+
+ for(USHORT i = 0; i < aGrfNames.Count(); i++)
+ {
+ Graphic aGraphic;
+ String sGrfName = *(const String*)aGrfNames.GetObject(i);
+ INetURLObject aObj(sGrfName);
+ if(aObj.GetProtocol() == INET_PROT_FILE)
+ sGrfName = aObj.PathToFileName();
+ if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, i, &aGraphic))
+ {
+ Bitmap aBitmap(aGraphic.GetBitmap());
+ Size aSize(aBitmap.GetSizePixel());
+ if(aSize.Width() > MAX_BMP_WIDTH ||
+ aSize.Height() > MAX_BMP_HEIGHT)
+ {
+ BOOL bWidth = aSize.Width() > aSize.Height();
+ double nScale = bWidth ?
+ (double)MAX_BMP_WIDTH / (double)aSize.Width():
+ (double)MAX_BMP_HEIGHT / (double)aSize.Height();
+ aBitmap.Scale(nScale, nScale);
+ }
+ Image aImage(aBitmap);
+
+ pPopup->InsertItem(MN_GALLERY_ENTRY + i, sGrfName, aImage );
+ }
+ else
+ {
+ Image aImage;
+ pPopup->InsertItem(
+ MN_GALLERY_ENTRY + i, sGrfName, aImage );
+ }
+ }
+ GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
+ }
+ LeaveWait();
+ }
+ return 0;
+}
+
+/*-----------------02.12.97 10:58-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, BulletHdl_Impl, Button *, EMPTYARG )
+{
+ SvxCharacterMap* pMap = new SvxCharacterMap( this, TRUE );
+
+ USHORT nMask = 1;
+ const Font* pFmtFont = 0;
+ BOOL bSameBullet = TRUE;
+ sal_Unicode cBullet = 0;
+ BOOL bFirst = TRUE;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ const SvxNumberFormat& rCurFmt = pActNum->GetLevel(i);
+ if(bFirst)
+ {
+ cBullet = rCurFmt.GetBulletChar();
+ }
+ else if(rCurFmt.GetBulletChar() != cBullet )
+ {
+ bSameBullet = FALSE;
+ break;
+ }
+ if(!pFmtFont)
+ pFmtFont = rCurFmt.GetBulletFont();
+ bFirst = FALSE;
+ }
+ nMask <<= 1;
+
+ }
+
+ if(pFmtFont)
+ pMap->SetCharFont(*pFmtFont);
+ else
+ pMap->SetCharFont(aActBulletFont);
+ if(bSameBullet)
+ pMap->SetChar( cBullet );
+ if(pMap->Execute() == RET_OK)
+ {
+ // Font Numrules umstellen
+ aActBulletFont = pMap->GetCharFont();
+
+ USHORT _nMask = 1;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & _nMask)
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ aNumFmt.SetBulletFont(&aActBulletFont); ;
+ aNumFmt.SetBulletChar( (sal_Unicode) pMap->GetChar() );
+ pActNum->SetLevel(i, aNumFmt);
+ }
+ _nMask <<= 1;
+ }
+
+ SetModified();
+ }
+ delete pMap;
+ return 0;
+}
+
+/*-----------------03.03.97 15:21-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, MetricField *, pField)
+{
+ BOOL bWidth = pField == &aWidthMF;
+ bLastWidthModified = bWidth;
+ BOOL bRatio = aRatioCB.IsChecked();
+ long nWidthVal = static_cast<long>(aWidthMF.Denormalize(aWidthMF.GetValue(FUNIT_100TH_MM)));
+ long nHeightVal = static_cast<long>(aHeightMF.Denormalize(aHeightMF.GetValue(FUNIT_100TH_MM)));
+ nWidthVal = OutputDevice::LogicToLogic( nWidthVal ,
+ MAP_100TH_MM, (MapUnit)eCoreUnit );
+ nHeightVal = OutputDevice::LogicToLogic( nHeightVal,
+ MAP_100TH_MM, (MapUnit)eCoreUnit);
+ double fSizeRatio;
+
+ BOOL bRepaint = FALSE;
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
+ {
+ Size aSize(aNumFmt.GetGraphicSize() );
+ Size aSaveSize(aSize);
+
+ if (aInitSize[i].Height())
+ fSizeRatio = (double)aInitSize[i].Width() / (double)aInitSize[i].Height();
+ else
+ fSizeRatio = (double)1;
+
+ if(bWidth)
+ {
+ long nDelta = nWidthVal - aInitSize[i].Width();
+ aSize.Width() = nWidthVal;
+ if (bRatio)
+ {
+ aSize.Height() = aInitSize[i].Height() + (long)((double)nDelta / fSizeRatio);
+ aHeightMF.SetUserValue(aHeightMF.Normalize(
+ OutputDevice::LogicToLogic( aSize.Height(), (MapUnit)eCoreUnit, MAP_100TH_MM )),
+ FUNIT_100TH_MM);
+ }
+ }
+ else
+ {
+ long nDelta = nHeightVal - aInitSize[i].Height();
+ aSize.Height() = nHeightVal;
+ if (bRatio)
+ {
+ aSize.Width() = aInitSize[i].Width() + (long)((double)nDelta * fSizeRatio);
+ aWidthMF.SetUserValue(aWidthMF.Normalize(
+ OutputDevice::LogicToLogic( aSize.Width(), (MapUnit)eCoreUnit, MAP_100TH_MM )),
+ FUNIT_100TH_MM);
+ }
+ }
+ const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
+ sal_Int16 eOrient = aNumFmt.GetVertOrient();
+ if(aSize != aSaveSize)
+ bRepaint = TRUE;
+ aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient );
+ pActNum->SetLevel(i, aNumFmt);
+ }
+ }
+ nMask <<= 1;
+ }
+ SetModified(bRepaint);
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SvxNumOptionsTabPage, RatioHdl_Impl, CheckBox *, pBox )
+{
+ if (pBox->IsChecked())
+ {
+ if (bLastWidthModified)
+ SizeHdl_Impl(&aWidthMF);
+ else
+ SizeHdl_Impl(&aHeightMF);
+ }
+ return 0;
+}
+
+/*-----------------02.12.97 16:07-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, CharFmtHdl_Impl, ListBox *, EMPTYARG )
+{
+ bAutomaticCharStyles = FALSE;
+ USHORT nEntryPos = aCharFmtLB.GetSelectEntryPos();
+ String sEntry = aCharFmtLB.GetSelectEntry();
+ USHORT nMask = 1;
+ String aEmptyStr;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ if( 0 == nEntryPos )
+ aNumFmt.SetCharFmtName(aEmptyStr);
+ else
+ {
+ if(SVX_NUM_BITMAP != (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
+ aNumFmt.SetCharFmtName(sEntry);
+ }
+ pActNum->SetLevel(i, aNumFmt);
+ }
+ nMask <<= 1;
+ }
+ SetModified(FALSE);
+ return 0;
+
+};
+
+/*-----------------03.12.97 11:01-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumOptionsTabPage, EditModifyHdl_Impl, Edit *, pEdit )
+{
+ BOOL bPrefix = pEdit == &aPrefixED;
+ BOOL bSuffix = pEdit == &aSuffixED;
+ BOOL bStart = pEdit == &aStartED;
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ if(bPrefix)
+ aNumFmt.SetPrefix( aPrefixED.GetText() );
+ else if(bSuffix)
+ aNumFmt.SetSuffix( aSuffixED.GetText() );
+ else if(bStart)
+ aNumFmt.SetStart( (USHORT)aStartED.GetValue() );
+ else //align
+ {
+ USHORT nPos = aAlignLB.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->SetLevel(i, aNumFmt);
+ }
+ nMask <<= 1;
+ }
+ SetModified();
+
+ return 0;
+}
+
+/*-----------------09.12.97 11:49-------------------
+
+--------------------------------------------------*/
+USHORT lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &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;
+
+}
+
+/*-----------------09.12.97 11:54-------------------
+
+--------------------------------------------------*/
+USHORT lcl_DrawBullet(VirtualDevice* pVDev,
+ const SvxNumberFormat& rFmt, USHORT nXStart,
+ USHORT nYStart, const Size& rSize)
+{
+ Font aTmpFont(pVDev->GetFont());
+
+ //per Uno kann es sein, dass kein Font gesetzt ist!
+ Font aFont(rFmt.GetBulletFont() ? *rFmt.GetBulletFont() : aTmpFont);
+ Size aTmpSize(rSize);
+ aTmpSize.Width() *= rFmt.GetBulletRelSize();
+ aTmpSize.Width() /= 100 ;
+ aTmpSize.Height() *= rFmt.GetBulletRelSize();
+ aTmpSize.Height() /= 100 ;
+ // bei einer Hoehe von Null wird in Ursprungshoehe gezeichnet
+ if(!aTmpSize.Height())
+ aTmpSize.Height() = 1;
+ aFont.SetSize(aTmpSize);
+ aFont.SetTransparent(TRUE);
+ Color aBulletColor = rFmt.GetBulletColor();
+ if(aBulletColor.GetColor() == COL_AUTO)
+ aBulletColor = Color(pVDev->GetFillColor().IsDark() ? COL_WHITE : COL_BLACK);
+ else if(aBulletColor == pVDev->GetFillColor())
+ aBulletColor.Invert();
+ aFont.SetColor(aBulletColor);
+ pVDev->SetFont( aFont );
+ String aText(sal_Unicode(rFmt.GetBulletChar()));
+ long nY = nYStart;
+ nY -= ((aTmpSize.Height() - rSize.Height())/ 2);
+ pVDev->DrawText( Point(nXStart, nY), aText );
+ USHORT nRet = (USHORT)pVDev->GetTextWidth(aText);
+
+ pVDev->SetFont(aTmpFont);
+ return nRet;
+}
+/*-----------------02.12.97 10:34-------------------
+ Vorschau der Numerierung painten
+--------------------------------------------------*/
+void SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ )
+{
+ Size aSize(PixelToLogic(GetOutputSizePixel()));
+ Rectangle aRect(Point(0,0), aSize);
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const Color aBackColor = rStyleSettings.GetFieldColor();
+ const Color aTextColor = rStyleSettings.GetFieldTextColor();
+
+ VirtualDevice* pVDev = new VirtualDevice(*this);
+ pVDev->EnableRTL( IsRTLEnabled() );
+ pVDev->SetMapMode(GetMapMode());
+ pVDev->SetOutputSize( aSize );
+
+ Color aLineColor(COL_LIGHTGRAY);
+ if(aLineColor == aBackColor)
+ aLineColor.Invert();
+ pVDev->SetLineColor(aLineColor);
+ pVDev->SetFillColor( aBackColor );
+ 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 = sal::static_int_cast< USHORT >(aSize.Width() / (3 * pActNum->GetLevelCount()));
+ if(pActNum->GetLevelCount() < 10)
+ nXStep /= 2;
+ USHORT nYStart = 4;
+ // fuer ein einziges Level darf nicht die gesamte Hoehe benutzt werden
+ USHORT nYStep = sal::static_int_cast< USHORT >((aSize.Height() - 6)/ (pActNum->GetLevelCount() > 1 ? pActNum->GetLevelCount() : 5));
+ aStdFont = OutputDevice::GetDefaultFont(
+ DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE);
+ aStdFont.SetColor(aTextColor);
+ aStdFont.SetFillColor(aBackColor);
+
+ //
+ USHORT nFontHeight = nYStep * 6 / 10;
+ if(bPosition)
+ nFontHeight = nYStep * 15 / 10;
+ aStdFont.SetSize(Size( 0, nFontHeight ));
+
+ SvxNodeNum aNum( (BYTE)0 );
+ USHORT nPreNum = pActNum->GetLevel(0).GetStart();
+
+ if(bPosition)
+ {
+ USHORT nLineHeight = nFontHeight * 8 / 7;
+ BYTE nStart = 0;
+ while( !(nActLevel & (1<<nStart)) )
+ {
+ nStart++;
+ }
+ if(nStart)
+ nStart--;
+ BYTE nEnd = std::min( (BYTE)(nStart + 3), (BYTE)pActNum->GetLevelCount() );
+ for( BYTE nLevel = nStart; nLevel < nEnd; ++nLevel )
+ {
+ const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
+ aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
+
+ // --> OD 2008-01-16 #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;
+ //im draw ist das zulaeesig
+ if(nTextOffset < 0)
+ nNumberXPos = nNumberXPos + nTextOffset;
+ }
+ 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() &(~LINK_TOKEN)))
+ {
+ nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev, rFmt,
+ nNumberXPos,
+ nYStart, nWidthRelation) : 0;
+ }
+ else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
+ {
+ nBulletWidth = rFmt.IsShowSymbol() ?
+ lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize()) : 0;
+ }
+ else
+ {
+ pVDev->SetFont(aStdFont);
+ aNum.SetLevel( nLevel );
+ if(pActNum->IsContinuousNumbering())
+ aNum.GetLevelVal()[nLevel] = nPreNum;
+ String aText(pActNum->MakeNumString( aNum ));
+ Font aSaveFont = pVDev->GetFont();
+ Font aColorFont(aSaveFont);
+ Color aTmpBulletColor = rFmt.GetBulletColor();
+ if(aTmpBulletColor.GetColor() == COL_AUTO)
+ aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK);
+ else if(aTmpBulletColor == aBackColor)
+ aTmpBulletColor.Invert();
+ aColorFont.SetColor(aTmpBulletColor);
+ pVDev->SetFont(aColorFont);
+ pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
+ pVDev->SetFont(aSaveFont);
+ nBulletWidth = (USHORT)pVDev->GetTextWidth(aText);
+ nPreNum++;
+ }
+ // --> OD 2008-01-16 #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-01-16 #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( aBackColor );
+ pVDev->DrawRect( aRect1 );
+
+ Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2));
+ pVDev->DrawRect( aRect2 );
+ nYStart += 2 * nLineHeight;
+ }
+ }
+ else
+ {
+ //#i5153# painting gray or black rectangles as 'normal' numbering text
+ String sMsg( RTL_CONSTASCII_USTRINGPARAM( "Preview") );
+ long nWidth = pVDev->GetTextWidth(sMsg);
+ long nTextHeight = pVDev->GetTextHeight();
+ long nRectHeight = nTextHeight * 2 / 3;
+ long nTopOffset = nTextHeight - nRectHeight;
+ Color aBlackColor(COL_BLACK);
+ if(aBlackColor == aBackColor)
+ aBlackColor.Invert();
+
+ for( BYTE nLevel = 0; nLevel < pActNum->GetLevelCount();
+ ++nLevel, nYStart = nYStart + nYStep )
+ {
+ const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
+ aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
+ // --> OD 2008-01-31 #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()&(~LINK_TOKEN)) )
+ {
+ if(rFmt.IsShowSymbol())
+ {
+ nTextOffset = lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation);
+ nTextOffset = nTextOffset + nXStep;
+ }
+ }
+ else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
+ {
+ if(rFmt.IsShowSymbol())
+ {
+ nTextOffset = lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize());
+ nTextOffset = nTextOffset + nXStep;
+ }
+ }
+ else
+ {
+ Font aColorFont(aStdFont);
+ Color aTmpBulletColor = rFmt.GetBulletColor();
+ if(aTmpBulletColor.GetColor() == COL_AUTO)
+ aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK);
+ else if(aTmpBulletColor == aBackColor)
+ aTmpBulletColor.Invert();
+ aColorFont.SetColor(aTmpBulletColor);
+ pVDev->SetFont(aColorFont);
+ aNum.SetLevel( nLevel );
+ if(pActNum->IsContinuousNumbering())
+ aNum.GetLevelVal()[nLevel] = nPreNum;
+ String aText(pActNum->MakeNumString( aNum ));
+ pVDev->DrawText( Point(nXStart, nYStart), aText );
+ pVDev->SetFont(aStdFont);
+ nTextOffset = (USHORT)pVDev->GetTextWidth(aText);
+ nTextOffset = nTextOffset + nXStep;
+ nPreNum++;
+ }
+ if(pOutlineNames)
+ {
+ //#i5153# outline numberings still use the style names as text
+ pVDev->SetFont(aStdFont);
+ sMsg = pOutlineNames[nLevel];
+ pVDev->DrawText( Point(nXStart + nTextOffset, nYStart), sMsg );
+ }
+ else
+ {
+ //#i5153# the selected rectangle(s) should be black
+ if( 0 != (nActLevel & (1<<nLevel)))
+ {
+ pVDev->SetFillColor( aBlackColor );
+ pVDev->SetLineColor( aBlackColor );
+ }
+ else
+ {
+ //#i5153# unselected levels are gray
+ pVDev->SetFillColor( aLineColor );
+ pVDev->SetLineColor( aLineColor );
+ }
+ Rectangle aRect1(Point(nXStart + nTextOffset, nYStart + nTopOffset), Size(nWidth, nRectHeight));
+ pVDev->DrawRect(aRect1);
+ }
+ }
+ }
+ }
+ DrawOutDev( Point(0,0), aSize,
+ Point(0,0), aSize,
+ *pVDev );
+ delete pVDev;
+
+}
+
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+SvxNumPositionTabPage::SvxNumPositionTabPage(Window* pParent,
+ const SfxItemSet& rSet) :
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_NUM_POSITION ), rSet ),
+ aPositionFL( this, SVX_RES(FL_POSITION )),
+ aLevelFT( this, SVX_RES(FT_LEVEL )),
+ aLevelLB( this, SVX_RES(LB_LEVEL )),
+ aDistBorderFT( this, SVX_RES(FT_BORDERDIST )),
+ aDistBorderMF( this, SVX_RES(MF_BORDERDIST )),
+ aRelativeCB( this, SVX_RES(CB_RELATIVE )),
+ aIndentFT( this, SVX_RES(FT_INDENT )),
+ aIndentMF( this, SVX_RES(MF_INDENT )),
+ aDistNumFT( this, SVX_RES(FT_NUMDIST )),
+ aDistNumMF( this, SVX_RES(MF_NUMDIST )),
+ aAlignFT( this, SVX_RES(FT_ALIGN )),
+ aAlignLB( this, SVX_RES(LB_ALIGN )),
+ // --> OD 2008-01-10 #newlistlevelattrs#
+ aLabelFollowedByFT( this, SVX_RES(FT_LABEL_FOLLOWED_BY) ),
+ aLabelFollowedByLB( this, SVX_RES(LB_LABEL_FOLLOWED_BY) ),
+ aListtabFT( this, SVX_RES(FT_LISTTAB) ),
+ aListtabMF( this, SVX_RES(MF_LISTTAB) ),
+ aAlign2FT( this, SVX_RES(FT_ALIGN_2) ),
+ aAlign2LB( this, SVX_RES(LB_ALIGN_2) ),
+ aAlignedAtFT( this, SVX_RES(FT_ALIGNED_AT) ),
+ aAlignedAtMF( this, SVX_RES(MF_ALIGNED_AT) ),
+ aIndentAtFT( this, SVX_RES(FT_INDENT_AT) ),
+ aIndentAtMF( this, SVX_RES(MF_INDENT_AT) ),
+ // <--
+ aStandardPB( this, SVX_RES(PB_STANDARD )),
+ pPreviewWIN( new SvxNumberingPreview(this, SVX_RES(WIN_PREVIEW ))),
+ pActNum(0),
+ pSaveNum(0),
+ nActNumLvl( USHRT_MAX ),
+ nNumItemId(SID_ATTR_NUMBERING_RULE),
+ bModified(false),
+ bPreset(false),
+ bInInintControl(FALSE),
+ // --> OD 2008-01-11 #newlistlevelattrs#
+ bLabelAlignmentPosAndSpaceModeActive( false )
+ // <--
+{
+ FreeResource();
+ SetExchangeSupport();
+ pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
+
+ aRelativeCB.Check();
+ aAlignLB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl));
+ // --> OD 2008-01-10 #newlistlevelattrs#
+ aAlign2LB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl));
+ 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, SvxNumPositionTabPage, DistanceHdl_Impl);
+
+ aDistBorderMF.SetUpHdl(aLk);
+ aDistBorderMF.SetDownHdl(aLk);
+ aDistBorderMF.SetLoseFocusHdl(aLk);
+
+ aDistNumMF.SetUpHdl(aLk);
+ aDistNumMF.SetDownHdl(aLk);
+ aDistNumMF.SetLoseFocusHdl(aLk);
+
+ aIndentMF.SetUpHdl(aLk);
+ aIndentMF.SetDownHdl(aLk);
+ aIndentMF.SetLoseFocusHdl(aLk);
+
+ // --> OD 2008-01-10 #newlistlevelattrs#
+ aLabelFollowedByLB.SetDropDownLineCount( aLabelFollowedByLB.GetEntryCount() );
+ aLabelFollowedByLB.SetSelectHdl( LINK(this, SvxNumPositionTabPage, LabelFollowedByHdl_Impl) );
+
+ aLk = LINK(this, SvxNumPositionTabPage, ListtabPosHdl_Impl);
+ aListtabMF.SetUpHdl(aLk);
+ aListtabMF.SetDownHdl(aLk);
+ aListtabMF.SetLoseFocusHdl(aLk);
+
+ aLk = LINK(this, SvxNumPositionTabPage, AlignAtHdl_Impl);
+ aAlignedAtMF.SetUpHdl(aLk);
+ aAlignedAtMF.SetDownHdl(aLk);
+ aAlignedAtMF.SetLoseFocusHdl(aLk);
+
+ aLk = LINK(this, SvxNumPositionTabPage, IndentAtHdl_Impl);
+ aIndentAtMF.SetUpHdl(aLk);
+ aIndentAtMF.SetDownHdl(aLk);
+ aIndentAtMF.SetLoseFocusHdl(aLk);
+ // <--
+
+ aLevelLB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, LevelHdl_Impl));
+ aRelativeCB.SetClickHdl(LINK(this, SvxNumPositionTabPage, RelativeHdl_Impl));
+ aStandardPB.SetClickHdl(LINK(this, SvxNumPositionTabPage, StandardHdl_Impl));
+
+
+ aRelativeCB.Check(bLastRelative);
+ pPreviewWIN->SetPositionMode();
+ eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
+
+ //HACK("der Wert sollte mal sinnvol gesetzt werden")
+ long nWidth = 10000;
+ nWidth = OutputDevice::LogicToLogic( nWidth,
+ (MapUnit)eCoreUnit, MAP_100TH_MM );
+
+ aDistBorderMF.SetMax(aDistBorderMF.Normalize( nWidth ), FUNIT_100TH_MM );
+ aDistNumMF .SetMax(aDistNumMF .Normalize( nWidth ), FUNIT_100TH_MM );
+ aIndentMF .SetMax(aIndentMF .Normalize( nWidth ), FUNIT_100TH_MM );
+ // --> OD 2008-02-18 #newlistlevelattrs#
+ aListtabMF.SetMax(aListtabMF.Normalize( nWidth ), FUNIT_100TH_MM );
+ aAlignedAtMF.SetMax(aAlignedAtMF.Normalize( nWidth ), FUNIT_100TH_MM );
+ aIndentAtMF.SetMax(aIndentAtMF.Normalize( nWidth ), FUNIT_100TH_MM );
+ // <--
+ long nLast2 = nWidth /2;
+ aDistBorderMF.SetLast( aDistBorderMF.Normalize( nLast2 ), FUNIT_100TH_MM );
+ aDistNumMF .SetLast( aDistNumMF .Normalize( nLast2 ), FUNIT_100TH_MM );
+ aIndentMF .SetLast( aIndentMF .Normalize( nLast2 ), FUNIT_100TH_MM );
+ // --> OD 2008-02-18 #newlistlevelattrs#
+ aListtabMF.SetLast(aListtabMF.Normalize( nLast2 ), FUNIT_100TH_MM );
+ aAlignedAtMF.SetLast(aAlignedAtMF.Normalize( nLast2 ), FUNIT_100TH_MM );
+ aIndentAtMF.SetLast(aIndentAtMF.Normalize( nLast2 ), FUNIT_100TH_MM );
+ // <--
+
+#if OSL_DEBUG_LEVEL > 1
+ pDebugFixedText = new FixedText(this, 0);
+ pDebugFixedText->Show();
+ Size aSize(200, 20);
+ Point aPos(250,0);
+
+ pDebugFixedText->SetPosSizePixel(aPos, aSize);
+ pDebugFixedText->SetText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Das ist ein Debug-Text" ) ) );
+#endif
+}
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+SvxNumPositionTabPage::~SvxNumPositionTabPage()
+{
+ delete pActNum;
+ delete pPreviewWIN;
+ delete pSaveNum;
+#if OSL_DEBUG_LEVEL > 1
+ delete pDebugFixedText;
+#endif
+}
+/*-------------------------------------------------------*/
+
+#if OSL_DEBUG_LEVEL > 1
+void lcl_PrintDebugOutput(FixedText& rFixed, const SvxNumberFormat& rNumFmt)
+{
+#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
+
+ sal_Char const sHash[] = " # ";
+ if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ String sDebugText( UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetAbsLSpace() ) ) );
+ sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) );
+ sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetCharTextDistance() ) );
+ sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) );
+ sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetFirstLineOffset() ) );
+ rFixed.SetText(sDebugText);
+ }
+ else if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ String sDebugText( UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetListtabPos() ) ) );
+ sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) );
+ sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetFirstLineIndent() ) );
+ sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) );
+ sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetIndentAt() ) );
+ rFixed.SetText(sDebugText);
+ }
+
+}
+#endif
+
+/*-----------------03.12.97 10:06-------------------
+
+--------------------------------------------------*/
+void SvxNumPositionTabPage::InitControls()
+{
+ bInInintControl = TRUE;
+ // --> OD 2008-01-11 #newlistlevelattrs#
+ const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive &&
+ aRelativeCB.IsEnabled() && aRelativeCB.IsChecked();
+ // <--
+ const bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 &&
+ USHRT_MAX != nActNumLvl;
+
+ aDistBorderMF.Enable( !bLabelAlignmentPosAndSpaceModeActive &&
+ ( bSingleSelection || bRelative ) );
+ aDistBorderFT.Enable( !bLabelAlignmentPosAndSpaceModeActive &&
+ ( bSingleSelection || bRelative ) );
+
+ bool bSetDistEmpty = false;
+ bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive;
+ bool bSameDist = !bLabelAlignmentPosAndSpaceModeActive;
+ bool bSameIndent = !bLabelAlignmentPosAndSpaceModeActive;
+ bool bSameAdjust = true;
+
+ // --> OD 2008-01-11 #newlistlevelattrs#
+ bool bSameLabelFollowedBy = bLabelAlignmentPosAndSpaceModeActive;
+ bool bSameListtab = bLabelAlignmentPosAndSpaceModeActive;
+ bool bSameAlignAt = bLabelAlignmentPosAndSpaceModeActive;
+ bool bSameIndentAt = bLabelAlignmentPosAndSpaceModeActive;
+ // <--
+
+ const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
+ USHORT nMask = 1;
+ USHORT nLvl = USHRT_MAX;
+ long nFirstBorderText = 0;
+ long nFirstBorderTextRelative = -1;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ aNumFmtArr[i] = &pActNum->GetLevel(i);
+ if(nActNumLvl & nMask)
+ {
+ if(USHRT_MAX == nLvl)
+ {
+ nLvl = i;
+ if ( !bLabelAlignmentPosAndSpaceModeActive )
+ {
+ 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-01-11 #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();
+ }
+ SetMetricValue(aDistBorderMF, nDistBorderNum, eCoreUnit);
+ }
+ else
+ bSetDistEmpty = true;
+
+#if OSL_DEBUG_LEVEL > 1
+ lcl_PrintDebugOutput(*pDebugFixedText, *aNumFmtArr[nLvl]);
+#endif
+
+ const String aEmptyStr;
+ if(bSameDist)
+ SetMetricValue(aDistNumMF, aNumFmtArr[nLvl]->GetCharTextDistance(), eCoreUnit);
+ else
+ aDistNumMF.SetText(aEmptyStr);
+ if(bSameIndent)
+ SetMetricValue(aIndentMF, - aNumFmtArr[nLvl]->GetFirstLineOffset(), eCoreUnit);
+ 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-01-11 #newlistlevelattrs#
+ aAlign2LB.SelectEntryPos( nPos );
+ // <--
+ }
+ else
+ {
+ aAlignLB.SetNoSelection();
+ // --> OD 2008-01-11 #newlistlevelattrs#
+ aAlign2LB.SetNoSelection();
+ // <--
+ }
+
+ // --> OD 2008-01-11 #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 )
+ {
+ SetMetricValue( aListtabMF, aNumFmtArr[nLvl]->GetListtabPos(), eCoreUnit );
+ }
+ else
+ {
+ aListtabMF.SetText(aEmptyStr);
+ }
+ }
+ else
+ {
+ aListtabFT.Enable( false );
+ aListtabMF.Enable( false );
+ aListtabMF.SetText(aEmptyStr);
+ }
+
+ if ( bSameAlignAt )
+ {
+ SetMetricValue( aAlignedAtMF,
+ aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent(),
+ eCoreUnit );
+ }
+ else
+ {
+ aAlignedAtMF.SetText(aEmptyStr);
+ }
+
+ if ( bSameIndentAt )
+ {
+ SetMetricValue( aIndentAtMF, aNumFmtArr[nLvl]->GetIndentAt(), eCoreUnit );
+ }
+ else
+ {
+ aIndentAtMF.SetText(aEmptyStr);
+ }
+ // <--
+
+ if ( bSetDistEmpty )
+ aDistBorderMF.SetText(aEmptyStr);
+
+ bInInintControl = FALSE;
+}
+
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+void SvxNumPositionTabPage::ActivatePage(const SfxItemSet& rSet)
+{
+ const SfxPoolItem* pItem;
+ UINT16 nTmpNumLvl = USHRT_MAX;
+ const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ if(pExampleSet)
+ {
+ if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem))
+ bPreset = ((const SfxBoolItem*)pItem)->GetValue();
+ if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem))
+ nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
+ }
+ //
+ if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem))
+ {
+ delete pSaveNum;
+ pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+ }
+ bModified = (!pActNum->Get( 0 ) || bPreset);
+ if(*pSaveNum != *pActNum ||
+ nActNumLvl != nTmpNumLvl )
+ {
+ *pActNum = *pSaveNum;
+ nActNumLvl = nTmpNumLvl;
+ USHORT nMask = 1;
+ aLevelLB.SetUpdateMode(FALSE);
+ aLevelLB.SetNoSelection();
+ aLevelLB.SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX);
+ if(nActNumLvl != USHRT_MAX)
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ aLevelLB.SelectEntryPos( i, TRUE);
+ nMask <<= 1 ;
+ }
+ aRelativeCB.Enable(nActNumLvl != 1);
+ aLevelLB.SetUpdateMode(TRUE);
+
+ // --> OD 2008-01-11 #newlistlevelattrs#
+ InitPosAndSpaceMode();
+ ShowControlsDependingOnPosAndSpaceMode();
+ // <--
+
+ InitControls();
+ }
+ pPreviewWIN->SetLevel(nActNumLvl);
+ pPreviewWIN->Invalidate();
+}
+
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+int SvxNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet)
+{
+ if(_pSet)
+ FillItemSet(*_pSet);
+ return TRUE;
+}
+
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+BOOL SvxNumPositionTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl));
+
+ if(bModified && pActNum)
+ {
+ *pSaveNum = *pActNum;
+ rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
+ rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, FALSE));
+ }
+ return bModified;
+}
+
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+void SvxNumPositionTabPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem;
+ //im Draw gibt es das Item als WhichId, im Writer nur als SlotId
+ SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem);
+ if(eState != SFX_ITEM_SET)
+ {
+ nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
+ eState = rSet.GetItemState(nNumItemId, FALSE, &pItem);
+ }
+ DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
+ delete pSaveNum;
+ pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
+
+ // Ebenen einfuegen
+ if(!aLevelLB.GetEntryCount())
+ {
+ for(USHORT i = 1; i <= pSaveNum->GetLevelCount(); i++)
+ aLevelLB.InsertEntry(UniString::CreateFromInt32(i));
+ if(pSaveNum->GetLevelCount() > 1)
+ {
+ String sEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "1 - ") ) );
+ sEntry.Append( UniString::CreateFromInt32( pSaveNum->GetLevelCount() ) );
+ aLevelLB.InsertEntry(sEntry);
+ aLevelLB.SelectEntry(sEntry);
+ }
+ else
+ aLevelLB.SelectEntryPos(0);
+ }
+ else
+ aLevelLB.SelectEntryPos(aLevelLB.GetEntryCount() - 1);
+ USHORT nMask = 1;
+ aLevelLB.SetUpdateMode(FALSE);
+ aLevelLB.SetNoSelection();
+ if(nActNumLvl == USHRT_MAX)
+ {
+ aLevelLB.SelectEntryPos( pSaveNum->GetLevelCount(), TRUE);
+ }
+ else
+ for(USHORT i = 0; i < pSaveNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ aLevelLB.SelectEntryPos( i, TRUE);
+ nMask <<= 1;
+ }
+ aLevelLB.SetUpdateMode(TRUE);
+
+ if(!pActNum)
+ pActNum = new SvxNumRule(*pSaveNum);
+ else if(*pSaveNum != *pActNum)
+ *pActNum = *pSaveNum;
+ pPreviewWIN->SetNumRule(pActNum);
+
+ // --> OD 2008-01-11 #newlistlevelattrs#
+ InitPosAndSpaceMode();
+ ShowControlsDependingOnPosAndSpaceMode();
+// const BOOL bDraw = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
+// aDistNumFT.Show(bDraw);
+// aDistNumMF.Show(bDraw);
+ // <--
+
+ InitControls();
+ bModified = FALSE;
+}
+
+// --> OD 2008-01-11 #newlistlevelattrs#
+void SvxNumPositionTabPage::InitPosAndSpaceMode()
+{
+ if ( pActNum == 0 )
+ {
+ DBG_ASSERT( false,
+ "<SvxNumPositionTabPage::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 < pActNum->GetLevelCount(); ++i )
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
+ ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode();
+ if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ break;
+ }
+ }
+ nMask <<= 1;
+ }
+
+ bLabelAlignmentPosAndSpaceModeActive =
+ ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT;
+}
+
+void SvxNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode()
+{
+ aDistBorderFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aDistBorderMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aRelativeCB.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aIndentFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aIndentMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aDistNumFT.Show( !bLabelAlignmentPosAndSpaceModeActive &&
+ pActNum->IsFeatureSupported(NUM_CONTINUOUS) );
+ aDistNumMF.Show( !bLabelAlignmentPosAndSpaceModeActive &&
+ pActNum->IsFeatureSupported(NUM_CONTINUOUS));
+ 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* SvxNumPositionTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SvxNumPositionTabPage(pParent, rAttrSet);
+}
+
+/*-----------------04.12.97 12:51-------------------
+
+--------------------------------------------------*/
+void SvxNumPositionTabPage::SetMetric(FieldUnit eMetric)
+{
+ 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( SvxNumPositionTabPage, EditModifyHdl_Impl, Edit *, EMPTYARG )
+{
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+
+ // --> OD 2008-01-11 #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->SetLevel(i, aNumFmt);
+ }
+ nMask <<= 1;
+ }
+ SetModified();
+ return 0;
+}
+/*-----------------03.12.97 11:11-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumPositionTabPage, LevelHdl_Impl, ListBox *, pBox )
+{
+ USHORT nSaveNumLvl = nActNumLvl;
+ nActNumLvl = 0;
+ if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) &&
+ (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff))
+ {
+ nActNumLvl = 0xFFFF;
+ pBox->SetUpdateMode(FALSE);
+ for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ )
+ pBox->SelectEntryPos( i, FALSE );
+ pBox->SetUpdateMode(TRUE);
+ }
+ else if(pBox->GetSelectEntryCount())
+ {
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ )
+ {
+ if(pBox->IsEntryPosSelected( i ))
+ nActNumLvl |= nMask;
+ nMask <<= 1;
+ }
+ pBox->SelectEntryPos( pActNum->GetLevelCount(), FALSE );
+ }
+ else
+ {
+ nActNumLvl = nSaveNumLvl;
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ )
+ {
+ if(nActNumLvl & nMask)
+ {
+ pBox->SelectEntryPos(i);
+ break;
+ }
+ nMask <<=1;
+ }
+ }
+ aRelativeCB.Enable(nActNumLvl != 1);
+ SetModified();
+ // --> OD 2008-01-15 #newlistlevelattrs#
+ InitPosAndSpaceMode();
+ ShowControlsDependingOnPosAndSpaceMode();
+ // <--
+ InitControls();
+ return 0;
+}
+/*-----------------03.12.97 12:24-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumPositionTabPage, DistanceHdl_Impl, MetricField *, pFld )
+{
+ if(bInInintControl)
+ return 0;
+ long nValue = GetCoreValue(*pFld, eCoreUnit);
+ USHORT nMask = 1;
+#if OSL_DEBUG_LEVEL > 1
+ BOOL bFirst = TRUE;
+#endif
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) );
+ if(pFld == &aDistBorderMF)
+ {
+
+ if(aRelativeCB.IsChecked())
+ {
+ if(0 == i)
+ {
+ long nTmp = aNumFmt.GetFirstLineOffset();
+ aNumFmt.SetAbsLSpace( USHORT(nValue - nTmp));
+ }
+ else
+ {
+ long nTmp = pActNum->GetLevel( i - 1 ).GetAbsLSpace() +
+ pActNum->GetLevel( i - 1 ).GetFirstLineOffset() -
+ pActNum->GetLevel( 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 );
+ }
+
+#if OSL_DEBUG_LEVEL > 1
+ if(bFirst)
+ lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt);
+ bFirst = FALSE;
+#endif
+ pActNum->SetLevel( i, aNumFmt );
+ }
+ nMask <<= 1;
+ }
+
+ SetModified();
+ if(!aDistBorderMF.IsEnabled())
+ {
+ String aEmptyStr;
+ aDistBorderMF.SetText(aEmptyStr);
+ }
+
+ return 0;
+}
+
+/*-----------------04.12.97 12:35-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumPositionTabPage, RelativeHdl_Impl, 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 < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ const SvxNumberFormat &rNumFmt = pActNum->GetLevel(i);
+ if(bFirst)
+ {
+ nValue = rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset();
+ if(bOn && i)
+ nValue -= (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset());
+ }
+ else
+ bSetValue = nValue ==
+ (rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset()) -
+ (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset());
+ bFirst = FALSE;
+ }
+ nMask <<= 1;
+ }
+
+ }
+ String aEmptyStr;
+ if(bSetValue)
+ SetMetricValue(aDistBorderMF, nValue, eCoreUnit);
+ else
+ aDistBorderMF.SetText(aEmptyStr);
+ aDistBorderMF.Enable(bOn || bSingleSelection);
+ aDistBorderFT.Enable(bOn || bSingleSelection);
+ bLastRelative = bOn;
+ return 0;
+}
+
+// --> OD 2008-01-14 #newlistlevelattrs#
+IMPL_LINK( SvxNumPositionTabPage, 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 < pActNum->GetLevelCount(); ++i )
+ {
+ if ( nActNumLvl & nMask )
+ {
+ SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
+ aNumFmt.SetLabelFollowedBy( eLabelFollowedBy );
+ pActNum->SetLevel( i, aNumFmt );
+
+ if ( nFirstLvl == USHRT_MAX )
+ {
+ nFirstLvl = i;
+ }
+ else
+ {
+ bSameListtabPos &= aNumFmt.GetListtabPos() ==
+ pActNum->GetLevel( 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 )
+ {
+ SetMetricValue( aListtabMF, pActNum->GetLevel( nFirstLvl ).GetListtabPos(), eCoreUnit );
+ }
+ else
+ {
+ aListtabMF.SetText( String() );
+ }
+
+ SetModified();
+
+ return 0;
+}
+// <--
+
+// --> OD 2008-01-14 #newlistlevelattrs#
+IMPL_LINK( SvxNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld )
+{
+ // determine value to be set at the chosen list levels
+ const long nValue = GetCoreValue( *pFld, eCoreUnit );
+
+ // set value at the chosen list levels
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i )
+ {
+ if ( nActNumLvl & nMask )
+ {
+ SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
+ aNumFmt.SetListtabPos( nValue );
+ pActNum->SetLevel( i, aNumFmt );
+#if OSL_DEBUG_LEVEL > 1
+ lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt);
+#endif
+ }
+ nMask <<= 1;
+ }
+
+ SetModified();
+
+ return 0;
+}
+// <--
+
+// --> OD 2008-01-14 #newlistlevelattrs#
+IMPL_LINK( SvxNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld )
+{
+ // determine value to be set at the chosen list levels
+ const long nValue = GetCoreValue( *pFld, eCoreUnit );
+
+ // set value at the chosen list levels
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i )
+ {
+ if ( nActNumLvl & nMask )
+ {
+ SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
+ const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
+ aNumFmt.SetFirstLineIndent( nFirstLineIndent );
+ pActNum->SetLevel( i, aNumFmt );
+#if OSL_DEBUG_LEVEL > 1
+ lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt);
+#endif
+ }
+ nMask <<= 1;
+ }
+
+ SetModified();
+
+ return 0;
+}
+// <--
+
+// --> OD 2008-01-14 #newlistlevelattrs#
+IMPL_LINK( SvxNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld )
+{
+ // determine value to be set at the chosen list levels
+ const long nValue = GetCoreValue( *pFld, eCoreUnit );
+
+ // set value at the chosen list levels
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i )
+ {
+ if ( nActNumLvl & nMask )
+ {
+ SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
+ const long nAlignedAt = aNumFmt.GetIndentAt() +
+ aNumFmt.GetFirstLineIndent();
+ aNumFmt.SetIndentAt( nValue );
+ const long nNewFirstLineIndent = nAlignedAt - nValue;
+ aNumFmt.SetFirstLineIndent( nNewFirstLineIndent );
+ pActNum->SetLevel( i, aNumFmt );
+#if OSL_DEBUG_LEVEL > 1
+ lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt);
+#endif
+ }
+ nMask <<= 1;
+ }
+
+ SetModified();
+
+ return 0;
+}
+// <--
+/*-----------------05.12.97 15:33-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxNumPositionTabPage, StandardHdl_Impl, PushButton *, EMPTYARG )
+{
+ USHORT nMask = 1;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SvxNumRule aTmpNumRule( pActNum->GetFeatureFlags(),
+ pActNum->GetLevelCount(),
+ pActNum->IsContinuousNumbering(),
+ SVX_RULETYPE_NUMBERING,
+ pActNum->GetLevel( 0 ).GetPositionAndSpaceMode() );
+ // <--
+ for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) );
+ SvxNumberFormat aTempFmt(aTmpNumRule.GetLevel( 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->SetLevel( i, aNumFmt );
+ }
+ nMask <<= 1;
+ }
+
+ InitControls();
+ SetModified();
+ return 0;
+}
+
+void SvxNumPositionTabPage::SetModified(BOOL bRepaint)
+{
+ bModified = TRUE;
+ if(bRepaint)
+ {
+ pPreviewWIN->SetLevel(nActNumLvl);
+ pPreviewWIN->Invalidate();
+ }
+}
+
+void SvxNumOptionsTabPage::SetModified(BOOL bRepaint)
+{
+ bModified = TRUE;
+ if(bRepaint)
+ {
+ pPreviewWIN->SetLevel(nActNumLvl);
+ pPreviewWIN->Invalidate();
+ }
+}
+
+//Add CHINA001
+void SvxNumOptionsTabPage::PageCreated(SfxAllItemSet aSet)
+{
+ SFX_ITEMSET_ARG (&aSet,pListItem,SfxStringListItem,SID_CHAR_FMT_LIST_BOX,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False);
+
+ if (pNumCharFmt &&pBulletCharFmt)
+ SetCharFmts( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue());
+
+ if (pListItem)
+ {
+ ListBox& myCharFmtLB = GetCharFmtListBox();
+ const List *pList = (pListItem)->GetList();
+ sal_uInt32 nCount = pList->Count();;
+ for(sal_uInt32 i = 0; i < nCount; i++)
+ {
+ myCharFmtLB.InsertEntry(*(const String*)(pList->GetObject(i)) );
+
+ }
+ }
+ if (pMetricItem)
+ SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));
+}
+
+//end of add CHINA001
+
+//add CHINA001 begin
+
+void SvxNumPositionTabPage::PageCreated(SfxAllItemSet aSet)
+{
+ SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False);
+
+ if (pMetricItem)
+ SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));
+}
diff --git a/cui/source/tabpages/numpages.hrc b/cui/source/tabpages/numpages.hrc
new file mode 100644
index 000000000000..59ea5d0e8a94
--- /dev/null
+++ b/cui/source/tabpages/numpages.hrc
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * 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: numpages.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_ALIGN 50
+#define LB_ALIGN 51
+#define FT_DIST_BORDER 52
+#define MF_DIST_BORDER 53
+#define FT_DIST_NUM 54
+#define MF_DIST_NUM 55
+#define GB_POS 56
+
+#define LB_FMT_CHAR 60
+#define FT_FMT_CHAR 61
+
+#define FT_WIDTH 67
+#define FI_URL 68
+#define FT_HEIGHT 70
+
+
+#define MN_STD_NUMBER 120
+#define MD_DEL_NUMBER 121
+#define MN_STD_BULLET 122
+#define MN_DEL_BULLET 123
+
+#define STR_BULLET 200
+//#define STR_NUMFMT_1 201
+//#define STR_NUMFMT_2 202
+//#define STR_NUMFMT_3 203
+//#define STR_NUMFMT_4 204
+//#define STR_NUMFMT_5 205
+//#define STR_NUMFMT_6 206
+//#define STR_NUMFMT_7 207
+//#define STR_NUMFMT_8 208
+//#define STR_NUMFMT_7_HTML 209
+
+#define LB_FORM 210
+#define ED_FORM 211
+#define GB_FORM 212
+
+#define BT_BULLET 213
+
+#define FL_VALUES 220
+#define VS_VALUES 221
+#define ST_CUSTOMIZE 222
+#define FT_ERROR 223
+#define CB_LINKED 224
+
+#define FT_LEVEL 151
+#define LB_LEVEL 152
+#define FL_FORMAT 153
+#define FL_POSITION 154
+#define FT_PREFIX 155
+#define ED_PREFIX 156
+#define FT_FMT 157
+#define LB_FMT 158
+#define FT_SUFFIX 159
+#define ED_SUFFIX 160
+#define FT_BORDERDIST 161
+#define MF_BORDERDIST 162
+#define FT_NUMDIST 163
+#define MF_NUMDIST 164
+#define FT_INDENT 165
+#define MF_INDENT 166
+#define FT_CHARFMT 167
+#define LB_CHARFMT 168
+#define NF_ALL_LEVEL 169
+#define FT_START 170
+#define ED_START 171
+#define FT_BULLET 172
+#define PB_BULLET 173
+#define WIN_PREVIEW 174
+#define FT_BITMAP 175
+#define PB_SEARCH 176
+#define CB_RATIO 177
+#define FT_SIZE 178
+#define MF_WIDTH 179
+#define FT_MULT 180
+#define MF_HEIGHT 181
+#define FT_ORIENT 182
+#define LB_ORIENT 183
+#define MB_BITMAP 184
+#define CB_RELATIVE 185
+#define FT_ALL_LEVEL 186
+#define PB_STANDARD 187
+#define CB_SAME_LEVEL 188
+#define FL_SAME_LEVEL 189
+#define FT_BUL_COLOR 190
+#define LB_BUL_COLOR 191
+#define FT_BUL_REL_SIZE 192
+#define MF_BUL_REL_SIZE 193
+// 194 removed
+#define ST_POPUP_EMPTY_ENTRY 195
+
+#define MN_GRAPHIC_DLG 1
+#define MN_GALLERY 2
+#define MN_GALLERY_ENTRY 100
+
+#define FT_LABEL_FOLLOWED_BY 250
+#define LB_LABEL_FOLLOWED_BY 251
+#define FT_LISTTAB 252
+#define MF_LISTTAB 253
+#define FT_ALIGN_2 254
+#define LB_ALIGN_2 255
+#define FT_ALIGNED_AT 256
+#define MF_ALIGNED_AT 257
+#define FT_INDENT_AT 258
+#define MF_INDENT_AT 259
+
diff --git a/cui/source/tabpages/numpages.src b/cui/source/tabpages/numpages.src
new file mode 100644
index 000000000000..e202b2d13a84
--- /dev/null
+++ b/cui/source/tabpages/numpages.src
@@ -0,0 +1,910 @@
+/*************************************************************************
+ *
+ * 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: numpages.src,v $
+ * $Revision: 1.64.242.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <helpid.hrc>
+#include <numpages.hrc>
+
+/**************************************************************************/
+/* */
+/* TabPage */
+/* */
+/**************************************************************************/
+TabPage RID_SVXPAGE_PICK_BULLET
+{
+ HelpID = HID_SVXPAGE_PICK_BULLET ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ FixedLine FL_VALUES
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Selection" ;
+ };
+ Control VS_VALUES
+ {
+ Pos = MAP_APPFONT ( 9 , 14 ) ;
+ Size = MAP_APPFONT ( 242 , 167 ) ;
+ TabStop = TRUE ;
+ };
+};
+/**************************************************************************/
+/* */
+/* TabPage */
+/* */
+/**************************************************************************/
+TabPage RID_SVXPAGE_PICK_SINGLE_NUM
+{
+ HelpID = HID_SVXPAGE_PICK_SINGLE_NUM ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ FixedLine FL_VALUES
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Selection" ;
+ };
+ Control VS_VALUES
+ {
+ Pos = MAP_APPFONT ( 9 , 14 ) ;
+ Size = MAP_APPFONT ( 242 , 167 ) ;
+ TabStop = TRUE ;
+ };
+};
+/**************************************************************************/
+/* */
+/* TabPage */
+/* */
+/**************************************************************************/
+TabPage RID_SVXPAGE_PICK_NUM
+{
+ HelpID = HID_SVXPAGE_PICK_NUM;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ FixedLine FL_VALUES
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Selection" ;
+ };
+ Control VS_VALUES
+ {
+ Pos = MAP_APPFONT ( 9 , 14 ) ;
+ Size = MAP_APPFONT ( 242 , 167 ) ;
+ TabStop = TRUE ;
+ };
+};
+/**************************************************************************/
+/* */
+/* TabPage */
+/* */
+/**************************************************************************/
+TabPage RID_SVXPAGE_PICK_BMP
+{
+ HelpID = HID_SVXPAGE_PICK_BMP;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ FixedLine FL_VALUES
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Selection" ;
+ };
+ Control VS_VALUES
+ {
+ Pos = MAP_APPFONT ( 9 , 14 ) ;
+ Size = MAP_APPFONT ( 242 , 152 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_LINKED
+ {
+ Pos = MAP_APPFONT ( 9 , 169 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Link graphics";
+ };
+ FixedText FT_ERROR
+ {
+ Pos = MAP_APPFONT ( 9 , 14 ) ;
+ Size = MAP_APPFONT ( 242 , 30 ) ;
+ Text [ en-US ] = "The Gallery theme 'Bullets' is empty (no graphics)." ;
+ Hide = TRUE ;
+ WordBreak = TRUE ;
+ };
+};
+/**************************************************************************/
+/* */
+/* TabPage Numerierungsoptionen */
+/* */
+/**************************************************************************/
+TabPage RID_SVXPAGE_NUM_OPTIONS
+{
+ HelpID = HID_SVXPAGE_NUM_OPTIONS ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ FixedText FT_LEVEL
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Level" ;
+ };
+ MultiListBox LB_LEVEL
+ {
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 26 , 154 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ Border = TRUE ;
+ SimpleMode = TRUE ;
+ };
+ FixedLine FL_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Format" ;
+ };
+ FixedText FT_FMT
+ {
+ Pos = MAP_APPFONT ( 50 , 27 ) ;
+ Size = MAP_APPFONT ( 50, 8 ) ;
+ Text [ en-US ] = "~Numbering" ;
+ };
+ ListBox LB_FMT
+ {
+ Pos = MAP_APPFONT ( 103 , 25 ) ;
+ Size = MAP_APPFONT ( 67 , 72 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ StringList [ 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 */; > ;
+ < "Linked graphics" ; 0x88/*SVX_NUM_BITMAP|0x80 */; > ;
+ < "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 */; > ;
+
+ };
+ };
+ FixedText FT_PREFIX
+ {
+ Pos = MAP_APPFONT ( 50 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Before" ;
+ Left = TRUE ;
+ };
+ Edit ED_PREFIX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 41 ) ;
+ Size = MAP_APPFONT ( 67 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 50 ;
+ };
+ FixedText FT_SUFFIX
+ {
+ Pos = MAP_APPFONT ( 50 , 59 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "After" ;
+ Left = TRUE ;
+ };
+ Edit ED_SUFFIX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 57 ) ;
+ Size = MAP_APPFONT ( 67 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 50 ;
+ };
+ FixedText FT_CHARFMT
+ {
+ Pos = MAP_APPFONT ( 50 , 75 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Character Style" ;
+ };
+ ListBox LB_CHARFMT
+ {
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 73 ) ;
+ Size = MAP_APPFONT ( 67 , 72 ) ;
+ };
+ FixedText FT_BUL_COLOR
+ {
+ Pos = MAP_APPFONT ( 50 , 75 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Color";
+ };
+ ListBox LB_BUL_COLOR
+ {
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 73 ) ;
+ Size = MAP_APPFONT ( 67 , 100 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_BUL_REL_SIZE
+ {
+ Pos = MAP_APPFONT ( 50 , 91 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "~Relative size";
+ };
+ MetricField MF_BUL_REL_SIZE
+ {
+ Pos = MAP_APPFONT ( 103 , 89 ) ;
+ Size = MAP_APPFONT ( 67 , 12 ) ;
+ Border = TRUE ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ SpinSize = 1 ;
+ Minimum = 1;
+ Maximum = 250;
+ Hide = TRUE;
+ };
+ FixedText FT_ALL_LEVEL
+ {
+ Pos = MAP_APPFONT ( 50 , 91 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Show sublevels" ;
+ };
+ NumericField NF_ALL_LEVEL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 89 ) ;
+ Size = MAP_APPFONT ( 67 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 10 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 10 ;
+ };
+ FixedText FT_START
+ {
+ Pos = MAP_APPFONT ( 50 , 107 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Start at" ;
+ Left = TRUE ;
+ };
+ NumericField ED_START
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 105 ) ;
+ Size = MAP_APPFONT ( 67 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 65535 ;
+ Value = 1 ;
+ First = 0 ;
+ Last = 65535 ;
+ };
+ FixedText FT_ALIGN
+ {
+ Pos = MAP_APPFONT ( 50 , 135 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Alignment" ;
+ Hide = TRUE;
+ };
+ ListBox LB_ALIGN
+ {
+ Pos = MAP_APPFONT ( 103 , 133 ) ;
+ Size = MAP_APPFONT ( 40 , 40 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Hide = TRUE;
+ StringList [ en-US ] =
+ {
+ < "Left" ; > ;
+ < "Centered" ; > ;
+ < "Right" ; > ;
+ };
+ };
+ String STR_BULLET
+ {
+ Text [ en-US ] = "Character" ;
+ };
+ PushButton PB_BULLET
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 105 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ Text = "..." ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_BITMAP
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 50 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Graphics" ;
+ };
+ MenuButton MB_BITMAP
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 41 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ ButtonMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_GRAPHIC_DLG ;
+ // HelpID = HID_NUM_NAMED_NUMS ;
+ Text [ en-US ] = "From file..." ;
+ };
+ MenuItem
+ {
+ Identifier = MN_GALLERY ;
+ Text [ en-US ] = "Gallery";
+ };
+ };
+ };
+ Text [ en-US ] = "Select..." ;
+ };
+ FixedText FT_SIZE
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 50 , 61 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Width" ;
+ };
+ MetricField MF_WIDTH
+ {
+ Pos = MAP_APPFONT ( 103 , 59 ) ;
+ Size = MAP_APPFONT ( 67 , 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 ;
+ Hide = TRUE ;
+ };
+ FixedText FT_MULT
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 50 , 77 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Height" ;
+ };
+ MetricField MF_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 103 , 75 ) ;
+ Size = MAP_APPFONT ( 67 , 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 ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_RATIO
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 50 , 91 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "Keep ratio" ;
+ };
+ FixedText FT_ORIENT
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 50 , 105 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Alignment" ;
+ };
+ ListBox LB_ORIENT
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 103 ) ;
+ Size = MAP_APPFONT ( 67 , 72 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ StringList [ en-US ] =
+ {
+ < "Top of baseline" ; > ;
+ < "Center of baseline" ; > ;
+ < "Bottom of baseline" ; > ;
+ < "Top of character" ; > ;
+ < "Center of character" ; > ;
+ < "Bottom of character" ; > ;
+ < "Top of line" ; > ;
+ < "Center of line" ; > ;
+ < "Bottom of line" ; > ;
+ };
+ };
+ FixedLine FL_SAME_LEVEL
+ {
+ Pos = MAP_APPFONT ( 47 , 156 ) ;
+ Size = MAP_APPFONT ( 126 , 8 ) ;
+ Text [ en-US ] = "All levels" ;
+ };
+ CheckBox CB_SAME_LEVEL
+ {
+ Pos = MAP_APPFONT ( 53 , 167 ) ;
+ Size = MAP_APPFONT ( 114 , 10 ) ;
+ Text [ en-US ] = "~Consecutive numbering" ;
+ };
+ Window WIN_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 179 , 25 ) ;
+ Size = MAP_APPFONT ( 69 , 154 ) ;
+ Border = TRUE ;
+ };
+ String ST_POPUP_EMPTY_ENTRY
+ {
+ Text [ en-US ] = "There are no graphics in the 'Bullets' Gallery theme.";
+ };
+
+};
+/**************************************************************************/
+/* */
+/* TabPage Positionen */
+/* */
+/**************************************************************************/
+TabPage RID_SVXPAGE_NUM_POSITION
+{
+ HelpID = HID_SVXPAGE_NUM_POSITION ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ FixedText FT_LEVEL
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 50, 8 ) ;
+ Text [ en-US ] = "Level" ;
+ };
+ MultiListBox LB_LEVEL
+ {
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 26 , 154 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ Border = TRUE ;
+ SimpleMode = TRUE ;
+ };
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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 ;
+ };
+};
+
+String RID_STR_EDIT_GRAPHIC
+{
+ Text [ en-US ] = "Link" ;
+};
+String RID_STR_FULLNUMS_1 { Text = "1.|1.1|a)|61589|61589" ; };
+String RID_STR_FULLNUMS_2 { Text = "1.|a)|61589|61589|61589" ; };
+String RID_STR_FULLNUMS_3 { Text = "1.|(a)|i.|A.|61589" ; };
+String RID_STR_FULLNUMS_4 { Text = "1.|1.|1.|1.|1." ; };
+String RID_STR_FULLNUMS_5 { Text = "I.|A.|i.|a)|61589" ; };
+String RID_STR_FULLNUMS_6 { Text = "A.|I.|a.|i.|61589" ; };
+String RID_STR_FULLNUMS_7 { Text = "1|1.1|1.1.1|1.1.1.1|1.1.1.1.1" ; };
+String RID_STR_FULLNUMS_8 { Text = "61487|61488|61485|61589|61589" ; };
+String RID_STR_FULLNUMS_7_HTML { Text = "I.|I.|I|I.|I." ; };
+
+String RID_SVXSTR_BULLET_DESCRIPTION_0
+{
+ Text [en-US] = "Solid small circular bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_1
+{
+ Text [en-US] = "Solid large circular bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_2
+{
+ Text [en-US] = "Solid diamond bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_3
+{
+ Text [en-US] = "Solid large square bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_4
+{
+ Text [en-US] = "Right pointing arrow bullets filled out";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_5
+{
+ Text [en-US] = "Right pointing arrow bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_6
+{
+ Text [en-US] = "Check mark bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_7
+{
+ Text [en-US] = "Tick mark bullets";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_0
+{
+ Text [en-US] = "Number 1) 2) 3)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_1
+{
+ Text [en-US] = "Number 1. 2. 3.";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_2
+{
+ Text [en-US] = "Number (1) (2) (3)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_3
+{
+ Text [en-US] = "Uppercase Roman number I. II. III.";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_4
+{
+ Text [en-US] = "Uppercase letter A) B) C)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_5
+{
+ Text [en-US] = "Lowercase letter a) b) c)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_6
+{
+ Text [en-US] = "Lowercase letter (a) (b) (c)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_7
+{
+ Text [en-US] = "Lowercase Roman number i. ii. iii.";
+};
+
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_0
+{
+ Text [en-US] = "Numeric, numeric, lowercase letters, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_1
+{
+ Text [en-US] = "Numeric, lowercase letters, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_2
+{
+ Text [en-US] = "Numeric, lowercase letters, lowercase Roman, uppercase letters, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_3
+{
+ Text [en-US] = "Numeric";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_4
+{
+ Text [en-US] = "Uppercase Roman, uppercase letters, lowercase Roman, lowercase letters, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_5
+{
+ Text [en-US] = "Uppercase letters, uppercase Roman, lowercase letters, lowercase Roman, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_6
+{
+ Text [en-US] = "Numeric with all sublevels";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_7
+{
+ Text [en-US] = "Right pointing bullet, right pointing arrow bullet, solid diamond bullet, solid small circular bullet";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
new file mode 100644
index 000000000000..082363ebed23
--- /dev/null
+++ b/cui/source/tabpages/page.cxx
@@ -0,0 +1,1771 @@
+/*************************************************************************
+ *
+ * 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: page.cxx,v $
+ * $Revision: 1.42 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <tools/resary.hxx>
+#include <vcl/graph.hxx>
+#include <sfx2/viewsh.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/languageoptions.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/configitem.hxx>
+#include "svx/htmlmode.hxx"
+
+#define _SVX_PAGE_CXX
+
+#include <svx/dialogs.hrc>
+#include "page.hrc"
+#include "helpid.hrc"
+#include "page.hxx"
+#include <svx/pageitem.hxx>
+#include <svx/brshitem.hxx>
+#include <svx/boxitem.hxx>
+#include <svx/shaditem.hxx>
+#include <svx/pbinitem.hxx>
+#include <svx/lrspitem.hxx>
+#include <svx/ulspitem.hxx>
+#include <svx/sizeitem.hxx>
+#include <svx/frmdiritem.hxx>
+#include "svx/dlgutil.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/paperinf.hxx>
+#include <svx/dialmgr.hxx>
+#include <sfx2/module.hxx>
+#include <svl/stritem.hxx>
+#include <svx/svxids.hrc> //CHINA001
+
+// #i4219#
+#include <svtools/optionsdrawinglayer.hxx>
+#include <svl/slstitm.hxx> //CHINA001
+#include <svl/aeitem.hxx> //CHINA001
+#include <sfx2/request.hxx> //CHINA001
+// configuration helper =======================================================
+
+/** Helper to get a configuration setting.
+ @descr This is a HACK to get a configuration item directly. Normally the
+ OfaHtmlOptions class from 'offmgr' project would do the job, but we cannot
+ use it here. On the other hand, the OfaHtmlOptions cannot be moved to
+ 'svtools', because it uses 'svx' itself...
+ The correct way would be to move OfaHtmlOptions to 'svtools' anyway, and to
+ remove the dependency from 'svx' (a call to the static function
+ SvxTextEncodingBox::GetBestMimeEncoding(), which contains low level
+ operations that can be moved to lower projects, i.e. 'rtl'). Then this
+ class can be removed, and the OfaHtmlOptions can be used instead. */
+class SvxHtmlExportModeConfigItem_Impl : public utl::ConfigItem
+{
+public:
+ explicit SvxHtmlExportModeConfigItem_Impl();
+
+ /** Returns the HTML export mode, as read from the configuration. */
+ inline sal_Int32 GetExportMode() const { return mnExpMode; }
+
+ /** Returns true, if the current HTML export mode is set to HTML 3.2. */
+ inline bool IsExportModeHTML32() const { return mnExpMode == 0; } // 0 == HTML_CFG_HTML32, see offmgr/htmlcfg.hxx
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames);
+
+private:
+ sal_Int32 mnExpMode;
+};
+
+SvxHtmlExportModeConfigItem_Impl::SvxHtmlExportModeConfigItem_Impl() :
+ utl::ConfigItem( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/HTML/Export" ) ) ),
+ mnExpMode( 3 ) // default to 3 == HTML_CFG_NS40, see offmgr/htmlcfg.hxx
+{
+ using com::sun::star::uno::Sequence;
+ using com::sun::star::uno::Any;
+
+ Sequence< rtl::OUString > aPropNames( 1 );
+ aPropNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Browser" ) );
+ Sequence< Any > aPropValues( GetProperties( aPropNames ) );
+ if( aPropValues.getLength() == 1 )
+ aPropValues[ 0 ] >>= mnExpMode;
+}
+
+void SvxHtmlExportModeConfigItem_Impl::Commit()
+{
+}
+
+void SvxHtmlExportModeConfigItem_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{
+}
+
+// static ----------------------------------------------------------------
+
+static const long MINBODY = 284; // 0,5cm in twips aufgerundet
+//static const long PRINT_OFFSET = 17; // 0,03cm in twips abgerundet
+static const long PRINT_OFFSET = 0; // why was this ever set to 17 ? it led to wrong right and bottom margins.
+
+static USHORT pRanges[] =
+{
+ SID_ATTR_BORDER_OUTER,
+ SID_ATTR_BORDER_SHADOW,
+ SID_ATTR_LRSPACE,
+ SID_ATTR_PAGE_SHARED,
+ SID_SWREGISTER_COLLECTION,
+ SID_SWREGISTER_MODE,
+ 0
+};
+
+// ------- Mapping Seitenlayout ------------------------------------------
+
+USHORT aArr[] =
+{
+ SVX_PAGE_ALL,
+ SVX_PAGE_MIRROR,
+ SVX_PAGE_RIGHT,
+ SVX_PAGE_LEFT
+};
+
+// -----------------------------------------------------------------------
+
+USHORT PageUsageToPos_Impl( USHORT nUsage )
+{
+ const USHORT nCount = sizeof(aArr) / sizeof(USHORT);
+
+ for ( USHORT i = 0; i < nCount; ++i )
+ if ( aArr[i] == ( nUsage & 0x000f ) )
+ return i;
+ return SVX_PAGE_ALL;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT PosToPageUsage_Impl( USHORT nPos )
+{
+ const USHORT nCount = sizeof(aArr) / sizeof(USHORT);
+
+ if ( nPos >= nCount )
+ return 0;
+ return aArr[nPos];
+}
+
+// -----------------------------------------------------------------------
+
+Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxItem& rBox )
+{
+ Size aSz;
+ aSz.Height() = rShadow.CalcShadowSpace( SHADOW_BOTTOM ) + rBox.CalcLineSpace( BOX_LINE_BOTTOM );
+ aSz.Height() += rShadow.CalcShadowSpace( SHADOW_TOP ) + rBox.CalcLineSpace( BOX_LINE_TOP );
+ aSz.Width() = rShadow.CalcShadowSpace( SHADOW_LEFT ) + rBox.CalcLineSpace( BOX_LINE_LEFT );
+ aSz.Width() += rShadow.CalcShadowSpace( SHADOW_RIGHT ) + rBox.CalcLineSpace( BOX_LINE_RIGHT );
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+long ConvertLong_Impl( const long nIn, SfxMapUnit eUnit )
+{
+ return OutputDevice::LogicToLogic( nIn, (MapUnit)eUnit, MAP_TWIP );
+}
+
+BOOL IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize )
+{
+ if ( pSize )
+ {
+ Size aSize = pSize->GetSize();
+ long nDiffW = Abs( rSize.Width () - aSize.Width () );
+ long nDiffH = Abs( rSize.Height() - aSize.Height() );
+ return ( nDiffW < 10 && nDiffH < 10 );
+ }
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+#define MARGIN_LEFT ( (MarginPosition)0x0001 )
+#define MARGIN_RIGHT ( (MarginPosition)0x0002 )
+#define MARGIN_TOP ( (MarginPosition)0x0004 )
+#define MARGIN_BOTTOM ( (MarginPosition)0x0008 )
+
+struct SvxPage_Impl
+{
+ MarginPosition m_nPos;
+ Printer* mpDefPrinter;
+ bool mbDelPrinter;
+
+ SvxPage_Impl() :
+ m_nPos( 0 ),
+ mpDefPrinter( 0 ),
+ mbDelPrinter( false ) {}
+
+ ~SvxPage_Impl() { if ( mbDelPrinter ) delete mpDefPrinter; }
+};
+
+// class SvxPageDescPage --------------------------------------------------
+
+// gibt den Bereich der Which-Werte zur"uck
+
+USHORT* SvxPageDescPage::GetRanges()
+{
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxPageDescPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxPageDescPage( pParent, rSet );
+}
+
+// -----------------------------------------------------------------------
+
+SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PAGE ), rAttr ),
+
+ aPaperSizeFl ( this, SVX_RES( FL_PAPER_SIZE ) ),
+ aPaperFormatText ( this, SVX_RES( FT_PAPER_FORMAT ) ),
+ aPaperSizeBox ( this, SVX_RES( LB_PAPER_SIZE ) ),
+ aPaperWidthText ( this, SVX_RES( FT_PAPER_WIDTH ) ),
+ aPaperWidthEdit ( this, SVX_RES( ED_PAPER_WIDTH ) ),
+ aPaperHeightText ( this, SVX_RES( FT_PAPER_HEIGHT ) ),
+ aPaperHeightEdit ( this, SVX_RES( ED_PAPER_HEIGHT ) ),
+ aOrientationFT ( this, SVX_RES( FT_ORIENTATION ) ),
+ aPortraitBtn ( this, SVX_RES( RB_PORTRAIT ) ),
+ aLandscapeBtn ( this, SVX_RES( RB_LANDSCAPE ) ),
+ aBspWin ( this, SVX_RES( WN_BSP ) ),
+ aTextFlowLbl ( this, SVX_RES( FT_TEXT_FLOW ) ),
+ aTextFlowBox ( this, SVX_RES( LB_TEXT_FLOW ) ),
+ aPaperTrayLbl ( this, SVX_RES( FT_PAPER_TRAY ) ),
+ aPaperTrayBox ( this, SVX_RES( LB_PAPER_TRAY ) ),
+ aMarginFl ( this, SVX_RES( FL_MARGIN ) ),
+ aLeftMarginLbl ( this, SVX_RES( FT_LEFT_MARGIN ) ),
+ aLeftMarginEdit ( this, SVX_RES( ED_LEFT_MARGIN ) ),
+ aRightMarginLbl ( this, SVX_RES( FT_RIGHT_MARGIN ) ),
+ aRightMarginEdit ( this, SVX_RES( ED_RIGHT_MARGIN ) ),
+ aTopMarginLbl ( this, SVX_RES( FT_TOP_MARGIN ) ),
+ aTopMarginEdit ( this, SVX_RES( ED_TOP_MARGIN ) ),
+ aBottomMarginLbl ( this, SVX_RES( FT_BOTTOM_MARGIN ) ),
+ aBottomMarginEdit ( this, SVX_RES( ED_BOTTOM_MARGIN ) ),
+
+ aLayoutFL ( this, SVX_RES( FL_LAYOUT ) ),
+ aPageText ( this, SVX_RES( FT_PAGELAYOUT ) ),
+ aLayoutBox ( this, SVX_RES( LB_LAYOUT ) ),
+ aNumberFormatText ( this, SVX_RES( FT_NUMBER_FORMAT ) ),
+ aNumberFormatBox ( this, SVX_RES( LB_NUMBER_FORMAT ) ),
+ aBottomSeparatorFl ( this, SVX_RES( FL_BOTTOM_SEP ) ),
+ aTblAlignFT ( this, SVX_RES( FT_TBL_ALIGN ) ),
+ aHorzBox ( this, SVX_RES( CB_HORZ ) ),
+ aVertBox ( this, SVX_RES( CB_VERT ) ),
+ aAdaptBox ( this, SVX_RES( CB_ADAPT ) ),
+ aRegisterCB ( this, SVX_RES( CB_REGISTER ) ),
+ aRegisterFT ( this, SVX_RES( FT_REGISTER ) ),
+ aRegisterLB ( this, SVX_RES( LB_REGISTER ) ),
+
+ aInsideText ( SVX_RES( STR_INSIDE ) ),
+ aOutsideText ( SVX_RES( STR_OUTSIDE ) ),
+ aPrintRangeQueryText( SVX_RES( STR_QUERY_PRINTRANGE ) ),
+
+ bLandscape ( FALSE ),
+ eMode ( SVX_PAGE_MODE_STANDARD ),
+ ePaperStart ( PAPER_A3 ),
+ ePaperEnd ( PAPER_ENV_DL ),
+ pImpl ( new SvxPage_Impl )
+
+{
+ bBorderModified = FALSE;
+ FreeResource();
+ aBspWin.EnableRTL( FALSE );
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ SvtLanguageOptions aLangOptions;
+ sal_Bool bCJK = aLangOptions.IsAsianTypographyEnabled();
+ sal_Bool bCTL = aLangOptions.IsCTLFontEnabled();
+ sal_Bool bWeb = sal_False;
+ const SfxPoolItem* pItem;
+
+ SfxObjectShell* pShell;
+ if(SFX_ITEM_SET == rAttr.GetItemState(SID_HTML_MODE, FALSE, &pItem) ||
+ ( 0 != (pShell = SfxObjectShell::Current()) &&
+ 0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
+ bWeb = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON);
+
+ // #109989# get the HTML export setting from configuration.
+ // !! This is a hack, see comments in SvxHtmlExportModeConfigItem_Impl class above.
+ bool bHTML32 = SvxHtmlExportModeConfigItem_Impl().IsExportModeHTML32();
+
+ // fill text flow listbox with valid entries
+ aTextFlowBox.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_PAGEDIR_LTR_HORI ), FRMDIR_HORI_LEFT_TOP );
+ if( bCTL )
+ aTextFlowBox.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_PAGEDIR_RTL_HORI ), FRMDIR_HORI_RIGHT_TOP );
+ // #109989# do not show vertical directions in Writer/Web
+ if( !bWeb )
+ {
+ if( bCJK )
+ aTextFlowBox.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_PAGEDIR_RTL_VERT ), FRMDIR_VERT_TOP_RIGHT );
+// if( ... )
+// aTextFlowBox.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_PAGEDIR_LTR_VERT ), FRMDIR_VERT_TOP_LEFT );
+ }
+
+ // #109989# show the text direction box in Writer/Web too, but only, if HTML export mode is not HTML3.2.
+ if( !(bWeb && bHTML32) && (bCJK || bCTL) &&
+ SFX_ITEM_UNKNOWN < rAttr.GetItemState(GetWhich( SID_ATTR_FRAMEDIRECTION )))
+ {
+ aTextFlowLbl.Show();
+ aTextFlowBox.Show();
+ aTextFlowBox.SetSelectHdl(LINK(this, SvxPageDescPage, FrameDirectionModify_Impl ));
+
+ aBspWin.EnableFrameDirection(sal_True);
+ }
+ Init_Impl();
+
+ FieldUnit eFUnit = GetModuleFieldUnit( &rAttr );
+ SetFieldUnit( aLeftMarginEdit, eFUnit );
+ SetFieldUnit( aRightMarginEdit, eFUnit );
+ SetFieldUnit( aTopMarginEdit, eFUnit );
+ SetFieldUnit( aBottomMarginEdit, eFUnit );
+ SetFieldUnit( aPaperWidthEdit, eFUnit );
+ SetFieldUnit( aPaperHeightEdit, eFUnit );
+
+ if ( SfxViewShell::Current() && SfxViewShell::Current()->GetPrinter() )
+ pImpl->mpDefPrinter = (Printer*)SfxViewShell::Current()->GetPrinter();
+ else
+ {
+ pImpl->mpDefPrinter = new Printer;
+ pImpl->mbDelPrinter = true;
+ }
+
+ MapMode aOldMode = pImpl->mpDefPrinter->GetMapMode();
+ pImpl->mpDefPrinter->SetMapMode( MAP_TWIP );
+
+ // First- und Last-Werte f"ur die R"ander setzen
+ Size aPaperSize = pImpl->mpDefPrinter->GetPaperSize();
+ Size aPrintSize = pImpl->mpDefPrinter->GetOutputSize();
+ /*
+ * einen Punkt ( 0,0 ) in logische Koordinaten zu konvertieren,
+ * sieht aus wie Unsinn; ist aber sinnvoll, wenn der Ursprung des
+ * Koordinatensystems verschoben ist.
+ */
+ Point aPrintOffset = pImpl->mpDefPrinter->GetPageOffset() -
+ pImpl->mpDefPrinter->PixelToLogic( Point() );
+ pImpl->mpDefPrinter->SetMapMode( aOldMode );
+
+ long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET;
+ aLeftMarginEdit.SetFirst( aLeftMarginEdit.Normalize( aPrintOffset.X() ), FUNIT_TWIP );
+ nFirstLeftMargin = static_cast<long>(aLeftMarginEdit.GetFirst());
+ aRightMarginEdit.SetFirst( aRightMarginEdit.Normalize(
+ aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X() + nOffset ), FUNIT_TWIP);
+ nFirstRightMargin = static_cast<long>(aRightMarginEdit.GetFirst());
+ aTopMarginEdit.SetFirst( aTopMarginEdit.Normalize( aPrintOffset.Y() ), FUNIT_TWIP );
+ nFirstTopMargin = static_cast<long>(aTopMarginEdit.GetFirst());
+ aBottomMarginEdit.SetFirst( aBottomMarginEdit.Normalize(
+ aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y() + nOffset ), FUNIT_TWIP );
+ nFirstBottomMargin = static_cast<long>(aBottomMarginEdit.GetFirst());
+ aLeftMarginEdit.SetLast( aLeftMarginEdit.Normalize(
+ aPrintOffset.X() + aPrintSize.Width() ), FUNIT_TWIP );
+ nLastLeftMargin = static_cast<long>(aLeftMarginEdit.GetLast());
+ aRightMarginEdit.SetLast( aRightMarginEdit.Normalize(
+ aPrintOffset.X() + aPrintSize.Width() ), FUNIT_TWIP );
+ nLastRightMargin = static_cast<long>(aRightMarginEdit.GetLast());
+ aTopMarginEdit.SetLast( aTopMarginEdit.Normalize(
+ aPrintOffset.Y() + aPrintSize.Height() ), FUNIT_TWIP );
+ nLastTopMargin = static_cast<long>(aTopMarginEdit.GetLast());
+ aBottomMarginEdit.SetLast( aBottomMarginEdit.Normalize(
+ aPrintOffset.Y() + aPrintSize.Height() ), FUNIT_TWIP );
+ nLastBottomMargin = static_cast<long>(aBottomMarginEdit.GetLast());
+
+ // #i4219# get DrawingLayer options
+ const SvtOptionsDrawinglayer aDrawinglayerOpt;
+
+ // #i4219# take Maximum now from configuration (1/100th cm)
+ // was: 11900 -> 119 cm ;new value 3 meters -> 300 cm -> 30000
+ aPaperWidthEdit.SetMax(aPaperWidthEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperWidth()), FUNIT_CM);
+ aPaperWidthEdit.SetLast(aPaperWidthEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperWidth()), FUNIT_CM);
+ aPaperHeightEdit.SetMax(aPaperHeightEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperHeight()), FUNIT_CM);
+ aPaperHeightEdit.SetLast(aPaperHeightEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperHeight()), FUNIT_CM);
+
+ // #i4219# also for margins (1/100th cm). Was: 9999, keeping.
+ aLeftMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperLeftMargin());
+ aLeftMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperLeftMargin());
+ aRightMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperRightMargin());
+ aRightMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperRightMargin());
+ aTopMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperTopMargin());
+ aTopMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperTopMargin());
+ aBottomMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperBottomMargin());
+ aBottomMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperBottomMargin());
+}
+
+// -----------------------------------------------------------------------
+
+SvxPageDescPage::~SvxPageDescPage()
+{
+ delete pImpl;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageDescPage::Init_Impl()
+{
+ aLeftText = aLeftMarginLbl.GetText();
+ aRightText = aRightMarginLbl.GetText();
+
+ // Handler einstellen
+ aLayoutBox.SetSelectHdl( LINK( this, SvxPageDescPage, LayoutHdl_Impl ) );
+ aPaperSizeBox.SetDropDownLineCount(10);
+
+ aPaperTrayBox.SetGetFocusHdl(
+ LINK( this, SvxPageDescPage, PaperBinHdl_Impl ) );
+ aPaperSizeBox.SetSelectHdl(
+ LINK( this, SvxPageDescPage, PaperSizeSelect_Impl ) );
+ aPaperWidthEdit.SetModifyHdl(
+ LINK( this, SvxPageDescPage, PaperSizeModify_Impl ) );
+ aPaperHeightEdit.SetModifyHdl(
+ LINK( this, SvxPageDescPage, PaperSizeModify_Impl ) );
+ aLandscapeBtn.SetClickHdl(
+ LINK( this, SvxPageDescPage, SwapOrientation_Impl ) );
+ aPortraitBtn.SetClickHdl(
+ LINK( this, SvxPageDescPage, SwapOrientation_Impl ) );
+
+ Link aLink = LINK( this, SvxPageDescPage, BorderModify_Impl );
+ aLeftMarginEdit.SetModifyHdl( aLink );
+ aRightMarginEdit.SetModifyHdl( aLink );
+ aTopMarginEdit.SetModifyHdl( aLink );
+ aBottomMarginEdit.SetModifyHdl( aLink );
+
+ aLink = LINK( this, SvxPageDescPage, RangeHdl_Impl );
+ aPaperWidthEdit.SetLoseFocusHdl( aLink );
+ aPaperHeightEdit.SetLoseFocusHdl( aLink );
+ aLeftMarginEdit.SetLoseFocusHdl( aLink );
+ aRightMarginEdit.SetLoseFocusHdl( aLink );
+ aTopMarginEdit.SetLoseFocusHdl( aLink );
+ aBottomMarginEdit.SetLoseFocusHdl( aLink );
+
+ aHorzBox.SetClickHdl( LINK( this, SvxPageDescPage, CenterHdl_Impl ) );
+ aVertBox.SetClickHdl( LINK( this, SvxPageDescPage, CenterHdl_Impl ) );
+
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageDescPage::Reset( const SfxItemSet& rSet )
+{
+ SfxItemPool* pPool = rSet.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ SfxMapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) );
+
+ // R"ander (Links/Rechts) einstellen
+ const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_LRSPACE );
+
+ if ( pItem )
+ {
+ const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)*pItem;
+ SetMetricValue( aLeftMarginEdit, rLRSpace.GetLeft(), eUnit );
+ aBspWin.SetLeft(
+ (USHORT)ConvertLong_Impl( (long)rLRSpace.GetLeft(), eUnit ) );
+ SetMetricValue( aRightMarginEdit, rLRSpace.GetRight(), eUnit );
+ aBspWin.SetRight(
+ (USHORT)ConvertLong_Impl( (long)rLRSpace.GetRight(), eUnit ) );
+ }
+
+ // R"ander (Oben/Unten) einstellen
+ pItem = GetItem( rSet, SID_ATTR_ULSPACE );
+
+ if ( pItem )
+ {
+ const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)*pItem;
+ SetMetricValue( aTopMarginEdit, rULSpace.GetUpper(), eUnit );
+ aBspWin.SetTop(
+ (USHORT)ConvertLong_Impl( (long)rULSpace.GetUpper(), eUnit ) );
+ SetMetricValue( aBottomMarginEdit, rULSpace.GetLower(), eUnit );
+ aBspWin.SetBottom(
+ (USHORT)ConvertLong_Impl( (long)rULSpace.GetLower(), eUnit ) );
+ }
+
+ // allgemeine Seitendaten
+ SvxNumType eNumType = SVX_ARABIC;
+ bLandscape = ( pImpl->mpDefPrinter->GetOrientation() == ORIENTATION_LANDSCAPE );
+ USHORT nUse = (USHORT)SVX_PAGE_ALL;
+ pItem = GetItem( rSet, SID_ATTR_PAGE );
+
+ if ( pItem )
+ {
+ const SvxPageItem& rItem = (const SvxPageItem&)*pItem;
+ eNumType = rItem.GetNumType();
+ nUse = rItem.GetPageUsage();
+ bLandscape = rItem.IsLandscape();
+ }
+
+ // Ausrichtung
+ aLayoutBox.SelectEntryPos( ::PageUsageToPos_Impl( nUse ) );
+ aBspWin.SetUsage( nUse );
+ LayoutHdl_Impl( 0 );
+
+ // Numerierungsart der Seitenvorlage einstellen
+ aNumberFormatBox.SelectEntryPos( sal::static_int_cast< USHORT >(eNumType) );
+
+ // Aktueller Papierschacht
+ aPaperTrayBox.Clear();
+ BYTE nPaperBin = PAPERBIN_PRINTER_SETTINGS;
+ pItem = GetItem( rSet, SID_ATTR_PAGE_PAPERBIN );
+
+ if ( pItem )
+ {
+ nPaperBin = ( (const SvxPaperBinItem*)pItem )->GetValue();
+
+ if ( nPaperBin >= pImpl->mpDefPrinter->GetPaperBinCount() )
+ nPaperBin = PAPERBIN_PRINTER_SETTINGS;
+ }
+
+ String aBinName;
+
+ if ( PAPERBIN_PRINTER_SETTINGS == nPaperBin )
+ aBinName = SVX_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS );
+ else
+ aBinName = pImpl->mpDefPrinter->GetPaperBinName( (USHORT)nPaperBin );
+
+ USHORT nEntryPos = aPaperTrayBox.InsertEntry( aBinName );
+ aPaperTrayBox.SetEntryData( nEntryPos, (void*)(ULONG)nPaperBin );
+ aPaperTrayBox.SelectEntry( aBinName );
+
+ // Size rausholen
+ Size aPaperSize = SvxPaperInfo::GetPaperSize( pImpl->mpDefPrinter );
+ pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
+
+ if ( pItem )
+ aPaperSize = ( (const SvxSizeItem*)pItem )->GetSize();
+
+ FASTBOOL bOrientationSupport =
+ pImpl->mpDefPrinter->HasSupport( SUPPORT_SET_ORIENTATION );
+#ifdef OS2
+ // unter OS/2 wird bei HasSupport() immer TRUE returned
+ // aber nur als Dummy, deshalb FALSE
+ bOrientationSupport = FALSE;
+#endif
+
+ if ( !bOrientationSupport &&
+ aPaperSize.Width() > aPaperSize.Height() )
+ bLandscape = TRUE;
+
+ aLandscapeBtn.Check( bLandscape );
+ aPortraitBtn.Check( !bLandscape );
+
+ aBspWin.SetSize( Size( ConvertLong_Impl( aPaperSize.Width(), eUnit ),
+ ConvertLong_Impl( aPaperSize.Height(), eUnit ) ) );
+
+ aPaperSize = OutputDevice::LogicToLogic(aPaperSize, (MapUnit)eUnit, MAP_100TH_MM);
+ if ( bLandscape )
+ Swap( aPaperSize );
+
+ // Actual Paper Format
+ Paper ePaper = SvxPaperInfo::GetSvxPaper( aPaperSize, MAP_100TH_MM, TRUE );
+
+ if ( PAPER_USER != ePaper )
+ aPaperSize = SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM );
+
+ if ( bLandscape )
+ Swap( aPaperSize );
+
+ // Werte in die Edits eintragen
+ SetMetricValue( aPaperHeightEdit, aPaperSize.Height(), SFX_MAPUNIT_100TH_MM );
+ SetMetricValue( aPaperWidthEdit, aPaperSize.Width(), SFX_MAPUNIT_100TH_MM );
+ aPaperSizeBox.Clear();
+
+ USHORT nActPos = LISTBOX_ENTRY_NOTFOUND;
+ USHORT nAryId = RID_SVXSTRARY_PAPERSIZE_STD;
+
+ if ( ePaperStart != PAPER_A3 )
+ nAryId = RID_SVXSTRARY_PAPERSIZE_DRAW;
+ ResStringArray aPaperAry( SVX_RES( nAryId ) );
+ sal_uInt32 nCnt = aPaperAry.Count();
+
+ for ( sal_uInt32 i = 0; i < nCnt; ++i )
+ {
+ String aStr = aPaperAry.GetString(i);
+ Paper eSize = (Paper)aPaperAry.GetValue(i);
+ USHORT nPos = aPaperSizeBox.InsertEntry( aStr );
+ aPaperSizeBox.SetEntryData( nPos, (void*)(ULONG)eSize );
+
+ if ( eSize == ePaper )
+ nActPos = nPos;
+ }
+ // aktuelles Papierformat selektieren
+ aPaperSizeBox.SelectEntryPos( nActPos );
+
+ // Applikationsspezifisch
+
+ switch ( eMode )
+ {
+ case SVX_PAGE_MODE_CENTER:
+ {
+ aTblAlignFT.Show();
+ aHorzBox.Show();
+ aVertBox.Show();
+ DisableVerticalPageDir();
+
+ // Horizontale Ausrichtung
+ pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
+ aHorzBox.Check( pItem ? ( (const SfxBoolItem*)pItem )->GetValue()
+ : FALSE );
+
+ // Vertikale Ausrichtung
+ pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
+ aVertBox.Check( pItem ? ( (const SfxBoolItem*)pItem )->GetValue()
+ : FALSE );
+
+ // Beispiel-Fenster auf Tabelle setzen
+ aBspWin.SetTable( TRUE );
+ aBspWin.SetHorz( aHorzBox.IsChecked() );
+ aBspWin.SetVert( aVertBox.IsChecked() );
+
+ break;
+ }
+
+ case SVX_PAGE_MODE_PRESENTATION:
+ {
+ DisableVerticalPageDir();
+ aAdaptBox.Show();
+ pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
+ aAdaptBox.Check( pItem ?
+ ( (const SfxBoolItem*)pItem )->GetValue() : FALSE );
+
+ //!!! hidden, weil von StarDraw nicht implementiert
+ aLayoutBox.Hide();
+ aPageText.Hide();
+
+ break;
+ }
+ default: ;//prevent warning
+ }
+
+
+ // im Beispiel Hintergrund und Umrandung anzeigen
+ ResetBackground_Impl( rSet );
+//! UpdateExample_Impl();
+ RangeHdl_Impl( 0 );
+
+ // Header Footer anzeigen
+ InitHeadFoot_Impl( rSet );
+
+ // R"ander auf Hoch/Quer updaten, dann Beispiel updaten
+ bBorderModified = FALSE;
+ SwapFirstValues_Impl( FALSE );
+ UpdateExample_Impl();
+
+ // Alte Werte sichern
+ aLeftMarginEdit.SaveValue();
+ aRightMarginEdit.SaveValue();
+ aTopMarginEdit.SaveValue();
+ aBottomMarginEdit.SaveValue();
+ aLayoutBox.SaveValue();
+ aNumberFormatBox.SaveValue();
+ aPaperSizeBox.SaveValue();
+ aPaperWidthEdit.SaveValue();
+ aPaperHeightEdit.SaveValue();
+ aPortraitBtn.SaveValue();
+ aLandscapeBtn.SaveValue();
+ aPaperTrayBox.SaveValue();
+ aVertBox.SaveValue();
+ aHorzBox.SaveValue();
+ aAdaptBox.SaveValue();
+
+ CheckMarginEdits( true );
+
+ // Registerhaltigkeit
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_SWREGISTER_MODE))
+ {
+ aRegisterCB.Check(((const SfxBoolItem&)rSet.Get(
+ SID_SWREGISTER_MODE)).GetValue());
+ aRegisterCB.SaveValue();
+ RegisterModify(&aRegisterCB);
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_SWREGISTER_COLLECTION))
+ {
+ aRegisterLB.SelectEntry(
+ ((const SfxStringItem&)rSet.Get(SID_SWREGISTER_COLLECTION)).GetValue());
+ aRegisterLB.SaveValue();
+ }
+
+ SfxItemState eState = rSet.GetItemState( GetWhich( SID_ATTR_FRAMEDIRECTION ),
+ TRUE, &pItem );
+ if( SFX_ITEM_UNKNOWN != eState )
+ {
+ sal_uInt32 nVal = SFX_ITEM_SET == eState
+ ? ((SvxFrameDirectionItem*)pItem)->GetValue()
+ : 0;
+ aTextFlowBox.SelectEntryValue( static_cast< SvxFrameDirection >( nVal ) );
+ aTextFlowBox.SaveValue();
+ aBspWin.SetFrameDirection(nVal);
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageDescPage::FillUserData()
+{
+ if ( SVX_PAGE_MODE_PRESENTATION == eMode )
+ SetUserData( UniString::CreateFromInt32( (sal_Int32)aAdaptBox.IsChecked() ) );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxPageDescPage::FillItemSet( SfxItemSet& rSet )
+{
+ BOOL bModified = FALSE;
+ const SfxItemSet& rOldSet = GetItemSet();
+ SfxItemPool* pPool = rOldSet.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ USHORT nWhich = GetWhich( SID_ATTR_LRSPACE );
+ SfxMapUnit eUnit = pPool->GetMetric( nWhich );
+ const SfxPoolItem* pOld = 0;
+
+ // alten linken und rechten Rand kopieren
+ SvxLRSpaceItem aMargin( (const SvxLRSpaceItem&)rOldSet.Get( nWhich ) );
+
+ // alten oberen und unteren Rand kopieren
+ nWhich = GetWhich( SID_ATTR_ULSPACE );
+ SvxULSpaceItem aTopMargin( (const SvxULSpaceItem&)rOldSet.Get( nWhich ) );
+
+ if ( aLeftMarginEdit.GetText() != aLeftMarginEdit.GetSavedValue() )
+ {
+ aMargin.SetLeft( (USHORT)GetCoreValue( aLeftMarginEdit, eUnit ) );
+ bModified |= TRUE;
+ }
+
+ if ( aRightMarginEdit.GetText() != aRightMarginEdit.GetSavedValue() )
+ {
+ aMargin.SetRight( (USHORT)GetCoreValue( aRightMarginEdit, eUnit ) );
+ bModified |= TRUE;
+ }
+
+ // Linken und rechten Rand setzen
+ if ( bModified )
+ {
+ pOld = GetOldItem( rSet, SID_ATTR_LRSPACE );
+
+ if ( !pOld || !( *(const SvxLRSpaceItem*)pOld == aMargin ) )
+ rSet.Put( aMargin );
+ else
+ bModified = FALSE;
+ }
+
+ BOOL bMod = FALSE;
+
+ if ( aTopMarginEdit.GetText() != aTopMarginEdit.GetSavedValue() )
+ {
+ aTopMargin.SetUpper( (USHORT)GetCoreValue( aTopMarginEdit, eUnit ) );
+ bMod |= TRUE;
+ }
+
+ if ( aBottomMarginEdit.GetText() != aBottomMarginEdit.GetSavedValue() )
+ {
+ aTopMargin.SetLower( (USHORT)GetCoreValue( aBottomMarginEdit, eUnit ) );
+ bMod |= TRUE;
+ }
+
+ // unteren oberen Rand setzen
+ //
+ if ( bMod )
+ {
+ pOld = GetOldItem( rSet, SID_ATTR_ULSPACE );
+
+ if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aTopMargin ) )
+ {
+ bModified |= TRUE;
+ rSet.Put( aTopMargin );
+ }
+ }
+
+ // Druckerschacht
+ nWhich = GetWhich( SID_ATTR_PAGE_PAPERBIN );
+ USHORT nPos = aPaperTrayBox.GetSelectEntryPos();
+ USHORT nBin = (USHORT)(ULONG)aPaperTrayBox.GetEntryData( nPos );
+ pOld = GetOldItem( rSet, SID_ATTR_PAGE_PAPERBIN );
+
+ if ( !pOld || ( (const SvxPaperBinItem*)pOld )->GetValue() != nBin )
+ {
+ rSet.Put( SvxPaperBinItem( nWhich, (BYTE)nBin ) );
+ bModified |= TRUE;
+ }
+
+ nPos = aPaperSizeBox.GetSelectEntryPos();
+ Paper ePaper = (Paper)(ULONG)aPaperSizeBox.GetEntryData( nPos );
+ const USHORT nOld = aPaperSizeBox.GetSavedValue();
+ BOOL bChecked = aLandscapeBtn.IsChecked();
+
+ if ( PAPER_USER == ePaper )
+ {
+ if ( nOld != nPos ||
+ aPaperWidthEdit.IsValueModified() ||
+ aPaperHeightEdit.IsValueModified() ||
+ bChecked != aLandscapeBtn.GetSavedValue() )
+ {
+ Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ),
+ GetCoreValue( aPaperHeightEdit, eUnit ) );
+ pOld = GetOldItem( rSet, SID_ATTR_PAGE_SIZE );
+
+ if ( !pOld || ( (const SvxSizeItem*)pOld )->GetSize() != aSize )
+ {
+ rSet.Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) );
+ bModified |= TRUE;
+ }
+ }
+ }
+ else
+ {
+ if ( nOld != nPos || bChecked != aLandscapeBtn.GetSavedValue() )
+ {
+ Size aSize( SvxPaperInfo::GetPaperSize( ePaper, (MapUnit)eUnit ) );
+
+ if ( bChecked )
+ Swap( aSize );
+
+ pOld = GetOldItem( rSet, SID_ATTR_PAGE_SIZE );
+
+ if ( !pOld || ( (const SvxSizeItem*)pOld )->GetSize() != aSize )
+ {
+ rSet.Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) );
+ bModified |= TRUE;
+ }
+ }
+ }
+
+ // sonstiges Zeug der Page
+ nWhich = GetWhich( SID_ATTR_PAGE );
+ SvxPageItem aPage( (const SvxPageItem&)rOldSet.Get( nWhich ) );
+ bMod = aLayoutBox.GetSelectEntryPos() != aLayoutBox.GetSavedValue();
+
+ if ( bMod )
+ aPage.SetPageUsage(
+ ::PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ) );
+
+ if ( bChecked != aLandscapeBtn.GetSavedValue() )
+ {
+ aPage.SetLandscape(bChecked);
+ bMod |= TRUE;
+ }
+
+ // Einstellen der Numerierungsart der Seite
+ nPos = aNumberFormatBox.GetSelectEntryPos();
+
+ if ( nPos != aNumberFormatBox.GetSavedValue() )
+ {
+ aPage.SetNumType( (SvxNumType)nPos );
+ bMod |= TRUE;
+ }
+
+ if ( bMod )
+ {
+ pOld = GetOldItem( rSet, SID_ATTR_PAGE );
+
+ if ( !pOld || !( *(const SvxPageItem*)pOld == aPage ) )
+ {
+ rSet.Put( aPage );
+ bModified |= TRUE;
+ }
+ }
+ else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich ) )
+ rSet.ClearItem( nWhich );
+ else
+ rSet.Put( rOldSet.Get( nWhich ) );
+
+ // Modispezifische Controls auswerten
+
+ switch ( eMode )
+ {
+ case SVX_PAGE_MODE_CENTER:
+ {
+ if ( aHorzBox.IsChecked() != aHorzBox.GetSavedValue() )
+ {
+ SfxBoolItem aHorz( GetWhich( SID_ATTR_PAGE_EXT1 ),
+ aHorzBox.IsChecked() );
+ rSet.Put( aHorz );
+ bModified |= TRUE;
+ }
+
+ if ( aVertBox.IsChecked() != aVertBox.GetSavedValue() )
+ {
+ SfxBoolItem aVert( GetWhich( SID_ATTR_PAGE_EXT2 ),
+ aVertBox.IsChecked() );
+ rSet.Put( aVert );
+ bModified |= TRUE;
+ }
+ break;
+ }
+
+ case SVX_PAGE_MODE_PRESENTATION:
+ {
+ // immer putten, damit Draw das auswerten kann
+ rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_PAGE_EXT1 ),
+ aAdaptBox.IsChecked() ) );
+ bModified |= TRUE;
+ break;
+ }
+ default: ;//prevent warning
+
+ }
+
+ if(aRegisterCB.IsVisible() &&
+ (aRegisterCB.IsChecked() || aRegisterCB.GetSavedValue() != aRegisterCB.IsChecked()))
+ {
+ const SfxBoolItem& rRegItem = (const SfxBoolItem&)rOldSet.Get(SID_SWREGISTER_MODE);
+ SfxBoolItem* pRegItem = (SfxBoolItem*)rRegItem.Clone();
+ BOOL bCheck = aRegisterCB.IsChecked();
+ pRegItem->SetValue(bCheck);
+ rSet.Put(*pRegItem);
+ bModified |= TRUE;
+ if(bCheck)
+ {
+ bModified |= TRUE;
+ rSet.Put(SfxStringItem(SID_SWREGISTER_COLLECTION,
+ aRegisterLB.GetSelectEntry()));
+ }
+ delete pRegItem;
+ }
+
+ SvxFrameDirection eDirection = aTextFlowBox.GetSelectEntryValue();
+ if( aTextFlowBox.IsVisible() && (eDirection != aTextFlowBox.GetSavedValue()) )
+ {
+ rSet.Put( SvxFrameDirectionItem( eDirection, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) );
+ bModified = TRUE;
+ }
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPageDescPage, LayoutHdl_Impl, ListBox *, EMPTYARG )
+{
+ // innen au\sen umschalten
+ const USHORT nPos = PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() );
+
+ if ( nPos == SVX_PAGE_MIRROR )
+ {
+ if ( aLeftMarginLbl.GetText() != aInsideText )
+ aLeftMarginLbl.SetText( aInsideText );
+
+ if ( aRightMarginLbl.GetText() != aOutsideText )
+ aRightMarginLbl.SetText( aOutsideText );
+ }
+ else
+ {
+ if ( aLeftMarginLbl.GetText() != aLeftText )
+ aLeftMarginLbl.SetText( aLeftText );
+
+ if ( aRightMarginLbl.GetText() != aRightText )
+ aRightMarginLbl.SetText( aRightText );
+ }
+ UpdateExample_Impl( true );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPageDescPage, PaperBinHdl_Impl, ListBox *, EMPTYARG )
+{
+ if ( aPaperTrayBox.GetEntryCount() > 1 )
+ // schon gef"ullt
+ return 0;
+
+ // Schacht-Box initialisieren
+ String aOldName = aPaperTrayBox.GetSelectEntry();
+ aPaperTrayBox.SetUpdateMode( FALSE );
+ aPaperTrayBox.Clear();
+ USHORT nEntryPos = aPaperTrayBox.InsertEntry(
+ SVX_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS ) );
+ aPaperTrayBox.SetEntryData( nEntryPos,
+ (void*)(ULONG)PAPERBIN_PRINTER_SETTINGS );
+ String aPaperBin( SVX_RES( RID_SVXSTR_PAPERBIN ) );
+ USHORT nBinCount = pImpl->mpDefPrinter->GetPaperBinCount();
+
+ for ( USHORT i = 0; i < nBinCount; ++i )
+ {
+ String aName = pImpl->mpDefPrinter->GetPaperBinName(i);
+
+ if ( !aName.Len() )
+ {
+ aName = aPaperBin;
+ aName.Append( sal_Unicode(' ') );
+ aName.Append( UniString::CreateFromInt32( i+1 ) );
+ }
+ nEntryPos = aPaperTrayBox.InsertEntry( aName );
+ aPaperTrayBox.SetEntryData( nEntryPos, (void*)(ULONG)i );
+ }
+ aPaperTrayBox.SelectEntry( aOldName );
+ aPaperTrayBox.SetUpdateMode( TRUE );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPageDescPage, PaperSizeSelect_Impl, ListBox *, pBox )
+{
+ const USHORT nPos = pBox->GetSelectEntryPos();
+ Paper ePaper = (Paper)(ULONG)aPaperSizeBox.GetEntryData( nPos );
+
+ if ( ePaper != PAPER_USER )
+ {
+ Size aSize( SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM ) );
+
+ if ( aLandscapeBtn.IsChecked() )
+ Swap( aSize );
+
+ if ( aSize.Height() < aPaperHeightEdit.GetMin( FUNIT_100TH_MM ) )
+ aPaperHeightEdit.SetMin(
+ aPaperHeightEdit.Normalize( aSize.Height() ), FUNIT_100TH_MM );
+ if ( aSize.Width() < aPaperWidthEdit.GetMin( FUNIT_100TH_MM ) )
+ aPaperWidthEdit.SetMin(
+ aPaperWidthEdit.Normalize( aSize.Width() ), FUNIT_100TH_MM );
+ SetMetricValue( aPaperHeightEdit, aSize.Height(), SFX_MAPUNIT_100TH_MM );
+ SetMetricValue( aPaperWidthEdit, aSize.Width(), SFX_MAPUNIT_100TH_MM );
+
+ // R"ander ggf. neu berechnen
+ CalcMargin_Impl();
+
+ RangeHdl_Impl( 0 );
+ UpdateExample_Impl( true );
+
+ if ( eMode == SVX_PAGE_MODE_PRESENTATION )
+ {
+ // Draw: bei Papierformat soll der Rand 1cm betragen
+ long nTmp = 0;
+ BOOL bScreen = ( PAPER_SCREEN == ePaper );
+
+ if ( !bScreen )
+ // bei Bildschirm keinen Rand
+ nTmp = 1; // entspr. 1cm
+
+ // Abfragen, ob fuer Raender 0 gesetzt ist:
+ if ( bScreen || aRightMarginEdit.GetValue() == 0 )
+ {
+ SetMetricValue( aRightMarginEdit, nTmp, SFX_MAPUNIT_CM );
+ if ( !bScreen &&
+ aRightMarginEdit.GetFirst() > aRightMarginEdit.GetValue() )
+ aRightMarginEdit.SetValue( aRightMarginEdit.GetFirst() );
+ }
+ if ( bScreen || aLeftMarginEdit.GetValue() == 0 )
+ {
+ SetMetricValue( aLeftMarginEdit, nTmp, SFX_MAPUNIT_CM );
+ if ( !bScreen &&
+ aLeftMarginEdit.GetFirst() > aLeftMarginEdit.GetValue() )
+ aLeftMarginEdit.SetValue( aLeftMarginEdit.GetFirst() );
+ }
+ if ( bScreen || aBottomMarginEdit.GetValue() == 0 )
+ {
+ SetMetricValue( aBottomMarginEdit, nTmp, SFX_MAPUNIT_CM );
+ if ( !bScreen &&
+ aBottomMarginEdit.GetFirst() > aBottomMarginEdit.GetValue() )
+ aBottomMarginEdit.SetValue( aBottomMarginEdit.GetFirst() );
+ }
+ if ( bScreen || aTopMarginEdit.GetValue() == 0 )
+ {
+ SetMetricValue( aTopMarginEdit, nTmp, SFX_MAPUNIT_CM );
+ if ( !bScreen &&
+ aTopMarginEdit.GetFirst() > aTopMarginEdit.GetValue() )
+ aTopMarginEdit.SetValue( aTopMarginEdit.GetFirst() );
+ }
+ UpdateExample_Impl( true );
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPageDescPage, PaperSizeModify_Impl, Edit *, EMPTYARG )
+{
+ USHORT nWhich = GetWhich( SID_ATTR_LRSPACE );
+ SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWhich );
+ Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ),
+ GetCoreValue( aPaperHeightEdit, eUnit ) );
+ Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, (MapUnit)eUnit, TRUE );
+ USHORT nEntryCount = aPaperSizeBox.GetEntryCount();
+
+ for ( USHORT i = 0; i < nEntryCount; ++i )
+ {
+ Paper eTmp = (Paper)(ULONG)aPaperSizeBox.GetEntryData(i);
+
+ if ( eTmp == ePaper )
+ {
+ aPaperSizeBox.SelectEntryPos(i);
+ break;
+ }
+ }
+ UpdateExample_Impl( true );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPageDescPage, SwapOrientation_Impl, RadioButton *, pBtn )
+{
+ if (
+ (!bLandscape && pBtn == &aLandscapeBtn) ||
+ (bLandscape && pBtn == &aPortraitBtn)
+ )
+ {
+ bLandscape = aLandscapeBtn.IsChecked();
+
+ const long lWidth = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_100TH_MM );
+ const long lHeight = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_100TH_MM );
+
+ // swap with and height
+ SetMetricValue( aPaperWidthEdit, lHeight, SFX_MAPUNIT_100TH_MM );
+ SetMetricValue( aPaperHeightEdit, lWidth, SFX_MAPUNIT_100TH_MM );
+
+ // recalculate margins if necessary
+ CalcMargin_Impl();
+
+ PaperSizeSelect_Impl( &aPaperSizeBox );
+ RangeHdl_Impl( 0 );
+ SwapFirstValues_Impl( bBorderModified );
+ UpdateExample_Impl( true );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageDescPage::SwapFirstValues_Impl( FASTBOOL bSet )
+{
+ MapMode aOldMode = pImpl->mpDefPrinter->GetMapMode();
+ Orientation eOri = ORIENTATION_PORTRAIT;
+
+ if ( bLandscape )
+ eOri = ORIENTATION_LANDSCAPE;
+ Orientation eOldOri = pImpl->mpDefPrinter->GetOrientation();
+ pImpl->mpDefPrinter->SetOrientation( eOri );
+ pImpl->mpDefPrinter->SetMapMode( MAP_TWIP );
+
+ // First- und Last-Werte f"ur die R"ander setzen
+ Size aPaperSize = pImpl->mpDefPrinter->GetPaperSize();
+ Size aPrintSize = pImpl->mpDefPrinter->GetOutputSize();
+ /*
+ * einen Punkt ( 0,0 ) in logische Koordinaten zu konvertieren,
+ * sieht aus wie Unsinn; ist aber sinnvoll, wenn der Ursprung des
+ * Koordinatensystems verschoben ist.
+ */
+ Point aPrintOffset = pImpl->mpDefPrinter->GetPageOffset() -
+ pImpl->mpDefPrinter->PixelToLogic( Point() );
+ pImpl->mpDefPrinter->SetMapMode( aOldMode );
+ pImpl->mpDefPrinter->SetOrientation( eOldOri );
+
+ sal_Int64 nSetL = aLeftMarginEdit.Denormalize(
+ aLeftMarginEdit.GetValue( FUNIT_TWIP ) );
+ sal_Int64 nSetR = aRightMarginEdit.Denormalize(
+ aRightMarginEdit.GetValue( FUNIT_TWIP ) );
+ sal_Int64 nSetT = aTopMarginEdit.Denormalize(
+ aTopMarginEdit.GetValue( FUNIT_TWIP ) );
+ sal_Int64 nSetB = aBottomMarginEdit.Denormalize(
+ aBottomMarginEdit.GetValue( FUNIT_TWIP ) );
+
+ long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET;
+ long nNewL = aPrintOffset.X();
+ long nNewR =
+ aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X() + nOffset;
+ long nNewT = aPrintOffset.Y();
+ long nNewB =
+ aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y() + nOffset;
+
+ aLeftMarginEdit.SetFirst( aLeftMarginEdit.Normalize( nNewL ), FUNIT_TWIP );
+ nFirstLeftMargin = static_cast<long>(aLeftMarginEdit.GetFirst());
+ aRightMarginEdit.SetFirst( aRightMarginEdit.Normalize( nNewR ), FUNIT_TWIP );
+ nFirstRightMargin = static_cast<long>(aRightMarginEdit.GetFirst());
+ aTopMarginEdit.SetFirst( aTopMarginEdit.Normalize( nNewT ), FUNIT_TWIP );
+ nFirstTopMargin = static_cast<long>(aTopMarginEdit.GetFirst());
+ aBottomMarginEdit.SetFirst( aBottomMarginEdit.Normalize( nNewB ), FUNIT_TWIP );
+ nFirstBottomMargin = static_cast<long>(aBottomMarginEdit.GetFirst());
+
+ if ( bSet )
+ {
+ // ggf. auch die Werte umsetzen,
+ if ( nSetL < nNewL )
+ aLeftMarginEdit.SetValue( aLeftMarginEdit.Normalize( nNewL ),
+ FUNIT_TWIP );
+ if ( nSetR < nNewR )
+ aRightMarginEdit.SetValue( aRightMarginEdit.Normalize( nNewR ),
+ FUNIT_TWIP );
+ if ( nSetT < nNewT )
+ aTopMarginEdit.SetValue( aTopMarginEdit.Normalize( nNewT ),
+ FUNIT_TWIP );
+ if ( nSetB < nNewB )
+ aBottomMarginEdit.SetValue( aBottomMarginEdit.Normalize( nNewB ),
+ FUNIT_TWIP );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxPageDescPage, BorderModify_Impl, MetricField *, EMPTYARG )
+{
+ if ( !bBorderModified )
+ bBorderModified = TRUE;
+ UpdateExample_Impl();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxPageDescPage, BorderModify_Impl, MetricField *, EMPTYARG )
+
+// -----------------------------------------------------------------------
+
+void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground )
+{
+ // Size
+ Size aSize( GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP ),
+ GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP ) );
+
+ aBspWin.SetSize( aSize );
+
+ // R"ander
+ aBspWin.SetTop( GetCoreValue( aTopMarginEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetBottom( GetCoreValue( aBottomMarginEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetLeft( GetCoreValue( aLeftMarginEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetRight( GetCoreValue( aRightMarginEdit, SFX_MAPUNIT_TWIP ) );
+
+ // Layout
+ aBspWin.SetUsage( PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ) );
+ if ( bResetbackground )
+ aBspWin.ResetBackground();
+ aBspWin.Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageDescPage::ResetBackground_Impl( const SfxItemSet& rSet )
+{
+ USHORT nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET );
+
+ if ( rSet.GetItemState( nWhich, FALSE ) == SFX_ITEM_SET )
+ {
+ const SvxSetItem& rSetItem =
+ (const SvxSetItem&)rSet.Get( nWhich, FALSE );
+ const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
+ const SfxBoolItem& rOn =
+ (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rOn.GetValue() )
+ {
+ nWhich = GetWhich( SID_ATTR_BRUSH );
+
+ if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBrushItem& rItem =
+ (const SvxBrushItem&)rTmpSet.Get( nWhich );
+ aBspWin.SetHdColor( rItem.GetColor() );
+ }
+ nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+
+ if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBoxItem& rItem =
+ (const SvxBoxItem&)rTmpSet.Get( nWhich );
+ aBspWin.SetHdBorder( rItem );
+ }
+ }
+ }
+
+ nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET );
+
+ if ( rSet.GetItemState( nWhich, FALSE ) == SFX_ITEM_SET )
+ {
+ const SvxSetItem& rSetItem =
+ (const SvxSetItem&)rSet.Get( nWhich, FALSE );
+ const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
+ const SfxBoolItem& rOn =
+ (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rOn.GetValue() )
+ {
+ nWhich = GetWhich( SID_ATTR_BRUSH );
+
+ if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBrushItem& rItem =
+ (const SvxBrushItem&)rTmpSet.Get( nWhich );
+ aBspWin.SetFtColor( rItem.GetColor() );
+ }
+ nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+
+ if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBoxItem& rItem =
+ (const SvxBoxItem&)rTmpSet.Get( nWhich );
+ aBspWin.SetFtBorder( rItem );
+ }
+ }
+ }
+
+ const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_BRUSH );
+
+ if ( pItem )
+ {
+ aBspWin.SetColor( ( (const SvxBrushItem*)pItem )->GetColor() );
+ const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic();
+
+ if ( pGrf )
+ {
+ Bitmap aBitmap = pGrf->GetBitmap();
+ aBspWin.SetBitmap( &aBitmap );
+ }
+ else
+ aBspWin.SetBitmap( NULL );
+ }
+
+ pItem = GetItem( rSet, SID_ATTR_BORDER_OUTER );
+
+ if ( pItem )
+ aBspWin.SetBorder( (SvxBoxItem&)*pItem );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
+{
+ bLandscape = aLandscapeBtn.IsChecked();
+ const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
+
+ if ( pItem )
+ aBspWin.SetSize( ( (const SvxSizeItem*)pItem )->GetSize() );
+
+ const SvxSetItem* pSetItem = 0;
+
+ // Kopfzeilen-Attribute auswerten
+
+ if ( SFX_ITEM_SET ==
+ rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ),
+ FALSE, (const SfxPoolItem**)&pSetItem ) )
+ {
+ const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
+ const SfxBoolItem& rHeaderOn =
+ (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rHeaderOn.GetValue() )
+ {
+ const SvxSizeItem& rSize = (const SvxSizeItem&)
+ rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
+ const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
+ rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
+ long nDist = rUL.GetLower();
+ aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
+ aBspWin.SetHdDist( nDist );
+ const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
+ rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
+ aBspWin.SetHdLeft( rLR.GetLeft() );
+ aBspWin.SetHdRight( rLR.GetRight() );
+ aBspWin.SetHeader( TRUE );
+ }
+ else
+ aBspWin.SetHeader( FALSE );
+
+ // im Beispiel Hintergrund und Umrandung anzeigen
+ USHORT nWhich = GetWhich( SID_ATTR_BRUSH );
+
+ if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxBrushItem& rItem =
+ (const SvxBrushItem&)rHeaderSet.Get( nWhich );
+ aBspWin.SetHdColor( rItem.GetColor() );
+ }
+ nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+
+ if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxBoxItem& rItem =
+ (const SvxBoxItem&)rHeaderSet.Get( nWhich );
+ aBspWin.SetHdBorder( rItem );
+ }
+ }
+
+ // Fusszeilen-Attribute auswerten
+
+ if ( SFX_ITEM_SET ==
+ rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ),
+ FALSE, (const SfxPoolItem**)&pSetItem ) )
+ {
+ const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
+ const SfxBoolItem& rFooterOn =
+ (const SfxBoolItem&)rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rFooterOn.GetValue() )
+ {
+ const SvxSizeItem& rSize = (const SvxSizeItem&)
+ rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
+ const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
+ rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
+ long nDist = rUL.GetUpper();
+ aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
+ aBspWin.SetFtDist( nDist );
+ const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
+ rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
+ aBspWin.SetFtLeft( rLR.GetLeft() );
+ aBspWin.SetFtRight( rLR.GetRight() );
+ aBspWin.SetFooter( TRUE );
+ }
+ else
+ aBspWin.SetFooter( FALSE );
+
+ // im Beispiel Hintergrund und Umrandung anzeigen
+ USHORT nWhich = GetWhich( SID_ATTR_BRUSH );
+
+ if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxBrushItem& rItem =
+ (const SvxBrushItem&)rFooterSet.Get( nWhich );
+ aBspWin.SetFtColor( rItem.GetColor() );
+ }
+ nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+
+ if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxBoxItem& rItem =
+ (const SvxBoxItem&)rFooterSet.Get( nWhich );
+ aBspWin.SetFtBorder( rItem );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageDescPage::ActivatePage( const SfxItemSet& rSet )
+{
+ InitHeadFoot_Impl( rSet );
+ ResetBackground_Impl( rSet );
+ RangeHdl_Impl( 0 );
+}
+
+// -----------------------------------------------------------------------
+
+int SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ // Abfrage, ob die Seitenr"ander ausserhalb des Druckbereichs liegen
+ // Wenn nicht, dann den Anwender fragen, ob sie "ubernommen werden sollen.
+ // Wenn nicht, dann auf der TabPage bleiben.
+ USHORT nPos = aPaperSizeBox.GetSelectEntryPos();
+ Paper ePaper = (Paper)(ULONG)aPaperSizeBox.GetEntryData( nPos );
+
+ if ( ePaper != PAPER_SCREEN && IsMarginOutOfRange() )
+ {
+ if ( QueryBox( this, WB_YES_NO | WB_DEF_NO, aPrintRangeQueryText ).Execute() == RET_NO )
+ {
+ MetricField* pField = NULL;
+ if ( IsPrinterRangeOverflow( aLeftMarginEdit, nFirstLeftMargin, nLastLeftMargin, MARGIN_LEFT ) )
+ pField = &aLeftMarginEdit;
+ if ( IsPrinterRangeOverflow( aRightMarginEdit, nFirstRightMargin, nLastRightMargin, MARGIN_RIGHT )
+ && !pField )
+ pField = &aRightMarginEdit;
+ if ( IsPrinterRangeOverflow( aTopMarginEdit, nFirstTopMargin, nLastTopMargin, MARGIN_TOP )
+ && !pField )
+ pField = &aTopMarginEdit;
+ if ( IsPrinterRangeOverflow( aBottomMarginEdit, nFirstBottomMargin, nLastBottomMargin, MARGIN_BOTTOM )
+ && !pField )
+ pField = &aBottomMarginEdit;
+ if ( pField )
+ pField->GrabFocus();
+ UpdateExample_Impl();
+ return KEEP_PAGE;
+ }
+ else
+ CheckMarginEdits( false );
+ }
+
+ if ( _pSet )
+ {
+ FillItemSet( *_pSet );
+
+ // ggf. hoch/quer putten
+ USHORT nWh = GetWhich( SID_ATTR_PAGE_SIZE );
+ SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWh );
+ Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ),
+ GetCoreValue( aPaperHeightEdit, eUnit ) );
+
+ // putten, wenn aktuelle Gr"o/se unterschiedlich zum Wert in _pSet
+ const SvxSizeItem* pSize = (const SvxSizeItem*)GetItem( *_pSet, SID_ATTR_PAGE_SIZE );
+ if ( aSize.Width() && ( !pSize || !IsEqualSize_Impl( pSize, aSize ) ) )
+ _pSet->Put( SvxSizeItem( nWh, aSize ) );
+ }
+
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPageDescPage, RangeHdl_Impl, Edit *, EMPTYARG )
+{
+ // Aktuelle Header-Breite/H"ohe aus dem Bsp
+ long nHHeight = aBspWin.GetHdHeight();
+ long nHDist = aBspWin.GetHdDist();
+
+ // Aktuelle Footer-Breite/H"ohe aus dem Bsp
+ long nFHeight = aBspWin.GetFtHeight();
+ long nFDist = aBspWin.GetFtDist();
+
+ // Aktuelle Header/Footer-R"ander aus dem Bsp
+ long nHFLeft = Max( aBspWin.GetHdLeft(), aBspWin.GetFtLeft() );
+ long nHFRight = Max( aBspWin.GetHdRight(), aBspWin.GetFtRight() );
+
+ // Aktuelle Werte der Seitenr"ander
+ long nBT = static_cast<long>(aTopMarginEdit.Denormalize(aTopMarginEdit.GetValue(FUNIT_TWIP)));
+ long nBB = static_cast<long>(aBottomMarginEdit.Denormalize(aBottomMarginEdit.GetValue(FUNIT_TWIP)));
+ long nBL = static_cast<long>(aLeftMarginEdit.Denormalize(aLeftMarginEdit.GetValue(FUNIT_TWIP)));
+ long nBR = static_cast<long>(aRightMarginEdit.Denormalize(aRightMarginEdit.GetValue(FUNIT_TWIP)));
+
+ // Breite Umrandung der Seite berechnen
+ const SfxItemSet* _pSet = &GetItemSet();
+ Size aBorder;
+
+ if ( _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_SHADOW) ) >=
+ SFX_ITEM_AVAILABLE &&
+ _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_OUTER) ) >=
+ SFX_ITEM_AVAILABLE )
+ {
+ aBorder = ( GetMinBorderSpace_Impl(
+ (const SvxShadowItem&)_pSet->Get(GetWhich(SID_ATTR_BORDER_SHADOW)),
+ (const SvxBoxItem&)_pSet->Get(GetWhich(SID_ATTR_BORDER_OUTER))));
+ }
+
+ long nH = static_cast<long>(aPaperHeightEdit.Denormalize(aPaperHeightEdit.GetValue(FUNIT_TWIP)));
+ long nW = static_cast<long>(aPaperWidthEdit.Denormalize(aPaperWidthEdit.GetValue(FUNIT_TWIP)));
+
+ // Grenzen Papier
+ // Maximum liegt bei 54cm
+ //
+ long nMin = nHHeight + nHDist + nFDist + nFHeight + nBT + nBB +
+ MINBODY + aBorder.Height();
+ aPaperHeightEdit.SetMin(aPaperHeightEdit.Normalize(nMin), FUNIT_TWIP);
+
+ nMin = MINBODY + nBL + nBR + aBorder.Width();
+ aPaperWidthEdit.SetMin(aPaperWidthEdit.Normalize(nMin), FUNIT_TWIP);
+
+ // Falls sich die Papiergr"o\se ge"adert hat
+ nH = static_cast<long>(aPaperHeightEdit.Denormalize(aPaperHeightEdit.GetValue(FUNIT_TWIP)));
+ nW = static_cast<long>(aPaperWidthEdit.Denormalize(aPaperWidthEdit.GetValue(FUNIT_TWIP)));
+
+ // Top
+ long nMax = nH - nBB - aBorder.Height() - MINBODY -
+ nFDist - nFHeight - nHDist - nHHeight;
+
+ aTopMarginEdit.SetMax(aTopMarginEdit.Normalize(nMax), FUNIT_TWIP);
+
+ // Bottom
+ nMax = nH - nBT - aBorder.Height() - MINBODY -
+ nFDist - nFHeight - nHDist - nHHeight;
+
+ aBottomMarginEdit.SetMax(aTopMarginEdit.Normalize(nMax), FUNIT_TWIP);
+
+ // Left
+ nMax = nW - nBR - MINBODY - aBorder.Width() - nHFLeft - nHFRight;
+ aLeftMarginEdit.SetMax(aLeftMarginEdit.Normalize(nMax), FUNIT_TWIP);
+
+ // Right
+ nMax = nW - nBL - MINBODY - aBorder.Width() - nHFLeft - nHFRight;
+ aRightMarginEdit.SetMax(aRightMarginEdit.Normalize(nMax), FUNIT_TWIP);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageDescPage::CalcMargin_Impl()
+{
+ // Aktuelle Werte der Seitenr"ander
+ long nBT = GetCoreValue( aTopMarginEdit, SFX_MAPUNIT_TWIP );
+ long nBB = GetCoreValue( aBottomMarginEdit, SFX_MAPUNIT_TWIP );
+
+ long nBL = GetCoreValue( aLeftMarginEdit, SFX_MAPUNIT_TWIP );
+ long nBR = GetCoreValue( aRightMarginEdit, SFX_MAPUNIT_TWIP );
+
+ long nH = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP );
+ long nW = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP );
+
+ long nWidth = nBL + nBR + MINBODY;
+ long nHeight = nBT + nBB + MINBODY;
+
+ if ( nWidth > nW || nHeight > nH )
+ {
+ if ( nWidth > nW )
+ {
+ long nTmp = nBL <= nBR ? nBR : nBL;
+ nTmp -= nWidth - nW;
+
+ if ( nBL <= nBR )
+ SetMetricValue( aRightMarginEdit, nTmp, SFX_MAPUNIT_TWIP );
+ else
+ SetMetricValue( aLeftMarginEdit, nTmp, SFX_MAPUNIT_TWIP );
+ }
+
+ if ( nHeight > nH )
+ {
+ long nTmp = nBT <= nBB ? nBB : nBT;
+ nTmp -= nHeight - nH;
+
+ if ( nBT <= nBB )
+ SetMetricValue( aBottomMarginEdit, nTmp, SFX_MAPUNIT_TWIP );
+ else
+ SetMetricValue( aTopMarginEdit, nTmp, SFX_MAPUNIT_TWIP );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxPageDescPage, CenterHdl_Impl, CheckBox *, EMPTYARG )
+{
+ aBspWin.SetHorz( aHorzBox.IsChecked() );
+ aBspWin.SetVert( aVertBox.IsChecked() );
+ UpdateExample_Impl();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxPageDescPage, CenterHdl_Impl, CheckBox *, EMPTYARG )
+
+// -----------------------------------------------------------------------
+
+void SvxPageDescPage::SetCollectionList(const List* pList)
+{
+ sStandardRegister = *(String*)pList->GetObject(0);
+ for( USHORT i = 1; i < pList->Count(); i++ )
+ {
+ aRegisterLB.InsertEntry(*(String*)pList->GetObject(i));
+ }
+
+ aRegisterCB .Show();
+ aRegisterFT .Show();
+ aRegisterLB.Show();
+ aRegisterCB.SetClickHdl(LINK(this, SvxPageDescPage, RegisterModify));
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPageDescPage, RegisterModify, CheckBox*, pBox )
+{
+ BOOL bEnable = FALSE;
+ if(pBox->IsChecked())
+ {
+ bEnable = TRUE;
+ if(USHRT_MAX == aRegisterLB.GetSelectEntryPos())
+ aRegisterLB.SelectEntry(sStandardRegister);
+ }
+ aRegisterFT.Enable( bEnable );
+ aRegisterLB.Enable( bEnable );
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+
+void SvxPageDescPage::DisableVerticalPageDir()
+{
+ aTextFlowBox.RemoveEntryValue( FRMDIR_VERT_TOP_RIGHT );
+ aTextFlowBox.RemoveEntryValue( FRMDIR_VERT_TOP_LEFT );
+ if( aTextFlowBox.GetEntryCount() < 2 )
+ {
+ aTextFlowLbl.Hide();
+ aTextFlowBox.Hide();
+ aBspWin.EnableFrameDirection( sal_False );
+ }
+}
+
+IMPL_LINK( SvxPageDescPage, FrameDirectionModify_Impl, ListBox*, EMPTYARG)
+{
+ aBspWin.SetFrameDirection( (sal_uInt32) aTextFlowBox.GetSelectEntryValue() );
+ aBspWin.Invalidate();
+ return 0;
+}
+
+bool SvxPageDescPage::IsPrinterRangeOverflow(
+ MetricField& rField, long nFirstMargin, long nLastMargin, MarginPosition nPos )
+{
+ bool bRet = false;
+ bool bCheck = ( ( pImpl->m_nPos & nPos ) == 0 );
+ long nValue = static_cast<long>(rField.GetValue());
+ if ( bCheck &&
+ ( nValue < nFirstMargin || nValue > nLastMargin ) &&
+ rField.GetText() != rField.GetSavedValue() )
+ {
+ rField.SetValue( nValue < nFirstMargin ? nFirstMargin : nLastMargin );
+ bRet = true;
+ }
+
+ return bRet;
+}
+
+/** Check if a value of a margin edit is outside the printer paper margins
+ and save this information.
+*/
+void SvxPageDescPage::CheckMarginEdits( bool _bClear )
+{
+ if ( _bClear )
+ pImpl->m_nPos = 0;
+
+ sal_Int64 nValue = aLeftMarginEdit.GetValue();
+ if ( nValue < nFirstLeftMargin || nValue > nLastLeftMargin )
+ pImpl->m_nPos |= MARGIN_LEFT;
+ nValue = aRightMarginEdit.GetValue();
+ if ( nValue < nFirstRightMargin || nValue > nLastRightMargin )
+ pImpl->m_nPos |= MARGIN_RIGHT;
+ nValue = aTopMarginEdit.GetValue();
+ if ( nValue < nFirstTopMargin || nValue > nLastTopMargin )
+ pImpl->m_nPos |= MARGIN_TOP;
+ nValue = aBottomMarginEdit.GetValue();
+ if ( nValue < nFirstBottomMargin || nValue > nLastBottomMargin )
+ pImpl->m_nPos |= MARGIN_BOTTOM;
+}
+
+bool SvxPageDescPage::IsMarginOutOfRange()
+{
+ bool bRet = ( ( ( !( pImpl->m_nPos & MARGIN_LEFT ) &&
+ ( aLeftMarginEdit.GetText() != aLeftMarginEdit.GetSavedValue() ) ) &&
+ ( aLeftMarginEdit.GetValue() < nFirstLeftMargin ||
+ aLeftMarginEdit.GetValue() > nLastLeftMargin ) ) ||
+ ( ( !( pImpl->m_nPos & MARGIN_RIGHT ) &&
+ ( aRightMarginEdit.GetText() != aRightMarginEdit.GetSavedValue() ) ) &&
+ ( aRightMarginEdit.GetValue() < nFirstRightMargin ||
+ aRightMarginEdit.GetValue() > nLastRightMargin ) ) ||
+ ( ( !( pImpl->m_nPos & MARGIN_TOP ) &&
+ ( aTopMarginEdit.GetText() != aTopMarginEdit.GetSavedValue() ) ) &&
+ ( aTopMarginEdit.GetValue() < nFirstTopMargin ||
+ aTopMarginEdit.GetValue() > nLastTopMargin ) ) ||
+ ( ( !( pImpl->m_nPos & MARGIN_BOTTOM ) &&
+ ( aBottomMarginEdit.GetText() != aBottomMarginEdit.GetSavedValue() ) ) &&
+ ( aBottomMarginEdit.GetValue() < nFirstBottomMargin ||
+ aBottomMarginEdit.GetValue() > nLastBottomMargin ) ) );
+ return bRet;
+}
+
+void SvxPageDescPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pModeItem,SfxAllEnumItem,SID_ENUM_PAGE_MODE,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pPaperStartItem,SfxAllEnumItem,SID_PAPER_START,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pPaperEndItem,SfxAllEnumItem,SID_PAPER_END,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pCollectListItem,SfxStringListItem,SID_COLLECT_LIST,sal_False);
+ if (pModeItem)
+ SetMode((SvxModeType)pModeItem->GetEnumValue());
+ if (pPaperStartItem && pPaperEndItem)
+ SetPaperFormatRanges( (Paper)pPaperStartItem->GetEnumValue(), (Paper)pPaperEndItem->GetEnumValue() );
+ if (pCollectListItem)
+ SetCollectionList(pCollectListItem->GetList());
+}
diff --git a/cui/source/tabpages/page.h b/cui/source/tabpages/page.h
new file mode 100644
index 000000000000..98aefdc79cc4
--- /dev/null
+++ b/cui/source/tabpages/page.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * 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: page.h,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PAGE_H
+#define _SVX_PAGE_H
+
+// define ----------------------------------------------------------------
+
+#define PAPERSIZE_A0 0
+#define PAPERSIZE_A1 1
+#define PAPERSIZE_A2 2
+#define PAPERSIZE_A3 3
+#define PAPERSIZE_A4 4
+#define PAPERSIZE_A5 5
+#define PAPERSIZE_B4_ISO 6
+#define PAPERSIZE_B5_ISO 7
+#define PAPERSIZE_LETTER 8
+#define PAPERSIZE_LEGAL 9
+#define PAPERSIZE_TABLOID 10
+#define PAPERSIZE_USER 11
+#define PAPERSIZE_B6_ISO 12
+#define PAPERSIZE_C4 13
+#define PAPERSIZE_C5 14
+#define PAPERSIZE_C6 15
+#define PAPERSIZE_C65 16
+#define PAPERSIZE_DL 17
+#define PAPERSIZE_DIA 18
+#define PAPERSIZE_SCREEN 19
+#define PAPERSIZE_C 20
+#define PAPERSIZE_D 21
+#define PAPERSIZE_E 22
+#define PAPERSIZE_EXECUTIVE 23
+#define PAPERSIZE_LEGAL2 24
+#define PAPERSIZE_MONARCH 25
+#define PAPERSIZE_COM675 26
+#define PAPERSIZE_COM9 27
+#define PAPERSIZE_COM10 28
+#define PAPERSIZE_COM11 29
+#define PAPERSIZE_COM12 30
+#define PAPERSIZE_KAI16 31
+#define PAPERSIZE_KAI32 32
+#define PAPERSIZE_KAI32BIG 33
+#define PAPERSIZE_B4_JIS 34
+#define PAPERSIZE_B5_JIS 35
+#define PAPERSIZE_B6_JIS 36
+
+#endif
+
diff --git a/cui/source/tabpages/page.hrc b/cui/source/tabpages/page.hrc
new file mode 100644
index 000000000000..bd2810a39061
--- /dev/null
+++ b/cui/source/tabpages/page.hrc
@@ -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: page.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PAGE_HRC
+#define _SVX_PAGE_HRC
+
+// defines ---------------------------------------------------------------
+
+#define FT_LEFT_MARGIN 10
+#define ED_LEFT_MARGIN 11
+#define FT_RIGHT_MARGIN 12
+#define ED_RIGHT_MARGIN 13
+#define FT_TOP_MARGIN 14
+#define ED_TOP_MARGIN 15
+#define FT_BOTTOM_MARGIN 16
+#define ED_BOTTOM_MARGIN 17
+#define FL_MARGIN 18
+
+#define LB_LAYOUT 20
+#define FT_PAGELAYOUT 21
+
+#define LB_NUMBER_FORMAT 30
+#define FL_LAYOUT 31
+#define FT_NUMBER_FORMAT 32
+
+#define FT_TEXT_FLOW 35
+#define LB_TEXT_FLOW 36
+
+#define WN_BSP 40
+
+#define FT_ORIENTATION 48
+#define FT_PAPER_FORMAT 49
+#define LB_PAPER_SIZE 50
+#define RB_PORTRAIT 51
+#define RB_LANDSCAPE 52
+#define FT_PAPER_WIDTH 53
+#define ED_PAPER_WIDTH 54
+#define FT_PAPER_HEIGHT 55
+#define ED_PAPER_HEIGHT 56
+#define FT_PAPER_TRAY 57
+#define LB_PAPER_TRAY 58
+#define FL_PAPER_SIZE 59
+
+#define CB_REGISTER 60
+#define FT_REGISTER 61
+#define LB_REGISTER 62
+#define FL_BOTTOM_SEP 64
+
+#define CB_HORZ 70
+#define CB_VERT 71
+#define CB_ADAPT 72
+#define FT_TBL_ALIGN 73
+
+#define PB_BACK 80
+
+#define STR_INSIDE 90
+#define STR_OUTSIDE 91
+#define STR_QUERY_PRINTRANGE 92
+
+#endif
+
diff --git a/cui/source/tabpages/page.src b/cui/source/tabpages/page.src
new file mode 100644
index 000000000000..6a44e41729a7
--- /dev/null
+++ b/cui/source/tabpages/page.src
@@ -0,0 +1,668 @@
+/*************************************************************************
+ *
+ * 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: page.src,v $
+ * $Revision: 1.71 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "page.hrc"
+#include "page.h"
+
+ // RID_SVXPAGE_PAGE ------------------------------------------------------
+
+TabPage RID_SVXPAGE_PAGE
+{
+ HelpId = HID_FORMAT_PAGE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_PAPER_SIZE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text [ en-US ] = "Paper format" ;
+ };
+ FixedText FT_PAPER_FORMAT
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "~Format";
+ };
+ ListBox LB_PAPER_SIZE
+ {
+ Pos = MAP_APPFONT ( 50 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 64 ) ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ FixedText FT_PAPER_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "~Width" ;
+ Left = TRUE ;
+ };
+ MetricField ED_PAPER_WIDTH
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 50, 30 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ // #i4219# taken from congiguration now Maximum = 11900 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ // #i4219# Last = 11900 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_PAPER_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "~Height" ;
+ Left = TRUE ;
+ };
+ MetricField ED_PAPER_HEIGHT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 50 , 46 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ // #i4219# taken from congiguration now Maximum = 11900 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ // #i4219# Last = 11900 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_ORIENTATION
+ {
+ Pos = MAP_APPFONT ( 12 , 62 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "Orientation";
+ };
+ RadioButton RB_PORTRAIT
+ {
+ Pos = MAP_APPFONT ( 50 , 62 ) ;
+ Size = MAP_APPFONT ( 53 , 10 ) ;
+ Check = TRUE ;
+ Text [ en-US ] = "~Portrait" ;
+ };
+ RadioButton RB_LANDSCAPE
+ {
+ Pos = MAP_APPFONT ( 50 , 74 ) ;
+ Size = MAP_APPFONT ( 53 , 10 ) ;
+ Text [ en-US ] = "L~andscape";
+ };
+ Window WN_BSP
+ {
+ Pos = MAP_APPFONT ( 176 , 6 ) ;
+ Size = MAP_APPFONT ( 75 , 46 ) ;
+ };
+
+ FixedText FT_TEXT_FLOW
+ {
+ Pos = MAP_APPFONT ( 113 , 60 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Text direction";
+ };
+ ListBox LB_TEXT_FLOW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 165 , 58 ) ;
+ Size = MAP_APPFONT ( 83 , 50 ) ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ };
+
+ FixedText FT_PAPER_TRAY
+ {
+ Pos = MAP_APPFONT ( 113 , 74 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Paper ~tray";
+ };
+ ListBox LB_PAPER_TRAY
+ {
+ Pos = MAP_APPFONT ( 165 , 72 ) ;
+ Size = MAP_APPFONT ( 83 , 50 ) ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ FixedLine FL_MARGIN
+ {
+ Pos = MAP_APPFONT ( 6 , 90 ) ;
+ Size = MAP_APPFONT ( 95 , 8 ) ;
+ Text [ en-US ] = "Margins";
+ };
+ FixedText FT_LEFT_MARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 103 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "~Left" ;
+ Left = TRUE ;
+ };
+ MetricField ED_LEFT_MARGIN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 55 , 101 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ // #i4219# taken from congiguration now Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ // #i4219# Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_RIGHT_MARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 119 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "~Right" ;
+ Left = TRUE ;
+ };
+ MetricField ED_RIGHT_MARGIN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 55 , 117 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ // #i4219# taken from congiguration now Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ // #i4219# Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_TOP_MARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 135 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "~Top" ;
+ Left = TRUE ;
+ };
+ MetricField ED_TOP_MARGIN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 55 , 133 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ // #i4219# taken from congiguration now Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ // #i4219# Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_BOTTOM_MARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 151 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "~Bottom" ;
+ Left = TRUE ;
+ };
+ MetricField ED_BOTTOM_MARGIN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 55 , 149 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ // #i4219# taken from congiguration now Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ // #i4219# Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedLine FL_BOTTOM_SEP
+ {
+ Pos = MAP_APPFONT ( 102 , 101 ) ;
+ Size = MAP_APPFONT ( 4 , 68 ) ;
+ Vert = TRUE;
+ };
+ FixedLine FL_LAYOUT
+ {
+ Pos = MAP_APPFONT ( 107, 90 ) ;
+ Size = MAP_APPFONT ( 147 , 8 ) ;
+ Text [ en-US ] = "Layout settings";
+ };
+ FixedText FT_PAGELAYOUT
+ {
+ Pos = MAP_APPFONT ( 113 , 103 ) ;
+ Size = MAP_APPFONT ( 54 , 8 ) ;
+ Text [ en-US ] = "Page layout" ;
+ };
+ ListBox LB_LAYOUT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170, 101 ) ;
+ Size = MAP_APPFONT ( 78 , 44 ) ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Right and left" ; Default ; > ;
+ < "Mirrored" ; Default ; > ;
+ < "Only right" ; Default ; > ;
+ < "Only left" ; Default ; > ;
+ };
+ };
+ FixedText FT_NUMBER_FORMAT
+ {
+ Pos = MAP_APPFONT ( 113 , 119 ) ;
+ Size = MAP_APPFONT ( 54 , 8 ) ;
+ Text [ en-US ] = "For~mat";
+ };
+ ListBox LB_NUMBER_FORMAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 117 ) ;
+ Size = MAP_APPFONT ( 78 , 64 ) ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "A, B, C, ..." ; Default ; > ;
+ < "a, b, c, ..." ; Default ; > ;
+ < "I, II, III, ..." ; Default ; > ;
+ < "i, ii, iii, ..." ; Default ; > ;
+ < "1, 2, 3, ..." ; Default ; > ;
+ < "None" ; Default ; > ;
+ };
+ };
+ FixedText FT_TBL_ALIGN
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 113 , 133 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Table alignment";
+ };
+ CheckBox CB_HORZ
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 175 , 133 ) ;
+ Size = MAP_APPFONT ( 73 , 10 ) ;
+ Text [ en-US ] = "Hori~zontal" ;
+ };
+ CheckBox CB_VERT
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 175 , 147 ) ;
+ Size = MAP_APPFONT ( 73 , 10 ) ;
+ Text [ en-US ] = "~Vertical" ;
+ };
+ CheckBox CB_ADAPT
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 113 , 133 ) ;
+ Size = MAP_APPFONT ( 135 , 10 ) ;
+ Text [ en-US ] = "~Fit object to paper format";
+ };
+ /* Registerhaltigkeit (fuer SW) */
+ CheckBox CB_REGISTER
+ {
+ Pos = MAP_APPFONT ( 113 , 133 ) ;
+ Size = MAP_APPFONT ( 135 , 10 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Register-true" ;
+ };
+ FixedText FT_REGISTER
+ {
+ Pos = MAP_APPFONT ( 122 , 147 ) ;
+ Size = MAP_APPFONT ( 126 , 8 ) ;
+ Text [ en-US ] = "Reference ~Style" ;
+ Hide = TRUE ;
+ };
+ ListBox LB_REGISTER
+ {
+ Pos = MAP_APPFONT ( 122 , 157 ) ;
+ Size = MAP_APPFONT ( 126 , 50 ) ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ Sort = TRUE ;
+ HScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ String STR_INSIDE
+ {
+ Text [ en-US ] = "I~nner" ;
+ };
+ String STR_OUTSIDE
+ {
+ Text [ en-US ] = "O~uter" ;
+ };
+ String STR_QUERY_PRINTRANGE
+ {
+ Text [ en-US ] = "The margin settings are out of print range.\n\nDo you still want to apply these settings?";
+ };
+};
+ // App-spezifische Res
+String RID_SVXSTR_WRITER_PAGE
+{
+ Text [ en-US ] = "Continuation page" ;
+};
+ // Papierformate
+String RID_SVXSTR_PAPER_A0
+{
+ Text = "A0" ;
+};
+String RID_SVXSTR_PAPER_A1
+{
+ Text = "A1" ;
+};
+String RID_SVXSTR_PAPER_A2
+{
+ Text = "A2" ;
+};
+String RID_SVXSTR_PAPER_A3
+{
+ Text = "A3" ;
+};
+String RID_SVXSTR_PAPER_A4
+{
+ Text = "A4" ;
+};
+String RID_SVXSTR_PAPER_A5
+{
+ Text = "A5" ;
+};
+String RID_SVXSTR_PAPER_B4_ISO
+{
+ Text = "B4 (ISO)" ;
+};
+String RID_SVXSTR_PAPER_B5_ISO
+{
+ Text = "B5 (ISO)" ;
+};
+String RID_SVXSTR_PAPER_LETTER
+{
+ Text = "Letter" ;
+};
+String RID_SVXSTR_PAPER_LEGAL
+{
+ Text = "Legal" ;
+};
+String RID_SVXSTR_PAPER_TABLOID
+{
+ Text = "Tabloid" ;
+};
+String RID_SVXSTR_PAPER_USER
+{
+ Text [ en-US ] = "User Defined" ;
+};
+String RID_SVXSTR_PAPER_B6_ISO
+{
+ Text = "B6 (ISO)" ;
+};
+String RID_SVXSTR_PAPER_C4
+{
+ Text = "C4 Envelope" ;
+};
+String RID_SVXSTR_PAPER_C5
+{
+ Text = "C5 Envelope" ;
+};
+String RID_SVXSTR_PAPER_C6
+{
+ Text = "C6 Envelope" ;
+};
+String RID_SVXSTR_PAPER_C65
+{
+ Text = "C6/5 Envelope" ;
+};
+String RID_SVXSTR_PAPER_DL
+{
+ Text = "DL Envelope" ;
+};
+String RID_SVXSTR_PAPER_DIA
+{
+ Text = "Dia Slide" ;
+};
+String RID_SVXSTR_PAPER_SCREEN
+{
+ Text [ en-US ] = "Screen" ;
+};
+String RID_SVXSTR_PAPER_C
+{
+ Text = "C" ;
+};
+String RID_SVXSTR_PAPER_D
+{
+ Text = "D" ;
+};
+String RID_SVXSTR_PAPER_E
+{
+ Text = "E" ;
+};
+String RID_SVXSTR_PAPER_EXECUTIVE
+{
+ Text = "Executive" ;
+};
+String RID_SVXSTR_PAPER_LEGAL2
+{
+ Text = "Long Bond" ;
+};
+String RID_SVXSTR_PAPER_MONARCH
+{
+ Text = "#8 (Monarch) Envelope" ;
+};
+String RID_SVXSTR_PAPER_COM675
+{
+ Text = "#6 3/4 (Personal) Envelope" ;
+};
+String RID_SVXSTR_PAPER_COM9
+{
+ Text = "#9 Envelope" ;
+};
+String RID_SVXSTR_PAPER_COM10
+{
+ Text = "#10 Envelope" ;
+};
+String RID_SVXSTR_PAPER_COM11
+{
+ Text = "#11 Envelope" ;
+};
+String RID_SVXSTR_PAPER_COM12
+{
+ Text = "#12 Envelope" ;
+};
+String RID_SVXSTR_PAPER_KAI16
+{
+ Text = "16 Kai" ;
+};
+String RID_SVXSTR_PAPER_KAI32
+{
+ Text = "32 Kai" ;
+};
+String RID_SVXSTR_PAPER_KAI32BIG
+{
+ Text = "Big 32 Kai" ;
+};
+String RID_SVXSTR_PAPER_B4_JIS
+{
+ Text = "B4 (JIS)" ;
+};
+String RID_SVXSTR_PAPER_B5_JIS
+{
+ Text = "B5 (JIS)" ;
+};
+String RID_SVXSTR_PAPER_B6_JIS
+{
+ Text = "B6 (JIS)" ;
+};
+StringArray RID_SVXSTRARY_PAPERSIZE_STD
+{
+ ItemList [ en-US ] =
+ {
+ < "A5" ; PAPERSIZE_A5 ; > ;
+ < "A4" ; PAPERSIZE_A4 ; > ;
+ < "A3" ; PAPERSIZE_A3 ; > ;
+ < "B6 (ISO)" ; PAPERSIZE_B6_ISO ; > ;
+ < "B5 (ISO)" ; PAPERSIZE_B5_ISO ; > ;
+ < "B4 (ISO)" ; PAPERSIZE_B4_ISO ; > ;
+ < "Letter" ; PAPERSIZE_LETTER ; > ;
+ < "Legal" ; PAPERSIZE_LEGAL ; > ;
+ < "Long Bond" ; PAPERSIZE_LEGAL2 ; > ;
+ < "Tabloid" ; PAPERSIZE_TABLOID ; > ;
+ < "B6 (JIS)" ; PAPERSIZE_B6_JIS ; > ;
+ < "B5 (JIS)" ; PAPERSIZE_B5_JIS ; > ;
+ < "B4 (JIS)" ; PAPERSIZE_B4_JIS ; > ;
+ < "16 Kai" ; PAPERSIZE_KAI16; > ;
+ < "32 Kai" ; PAPERSIZE_KAI32; > ;
+ < "Big 32 Kai" ; PAPERSIZE_KAI32BIG; > ;
+ < "User" ; PAPERSIZE_USER ; > ;
+ < "DL Envelope" ; PAPERSIZE_DL ; > ;
+ < "C6 Envelope" ; PAPERSIZE_C6 ; > ;
+ < "C6/5 Envelope" ; PAPERSIZE_C65 ; > ;
+ < "C5 Envelope" ; PAPERSIZE_C5 ; > ;
+ < "C4 Envelope" ; PAPERSIZE_C4 ; > ;
+ < "#6 3/4 (Personal) Envelope" ; PAPERSIZE_COM675; > ;
+ < "#8 (Monarch) Envelope" ; PAPERSIZE_MONARCH; > ;
+ < "#9 Envelope" ; PAPERSIZE_COM9; > ;
+ < "#10 Envelope" ; PAPERSIZE_COM10; > ;
+ < "#11 Envelope" ; PAPERSIZE_COM11; > ;
+ < "#12 Envelope" ; PAPERSIZE_COM12; > ;
+ };
+};
+StringArray RID_SVXSTRARY_PAPERSIZE_DRAW
+{
+ ItemList [ en-US ] =
+ {
+ < "A5" ; PAPERSIZE_A5 ; > ;
+ < "A4" ; PAPERSIZE_A4 ; > ;
+ < "A3" ; PAPERSIZE_A3 ; > ;
+ < "A2" ; PAPERSIZE_A2 ; > ;
+ < "A1" ; PAPERSIZE_A1 ; > ;
+ < "A0" ; PAPERSIZE_A0 ; > ;
+ < "B6 (ISO)" ; PAPERSIZE_B6_ISO ; > ;
+ < "B5 (ISO)" ; PAPERSIZE_B5_ISO ; > ;
+ < "B4 (ISO)" ; PAPERSIZE_B4_ISO ; > ;
+ < "Letter" ; PAPERSIZE_LETTER ; > ;
+ < "Legal" ; PAPERSIZE_LEGAL ; > ;
+ < "Long Bond" ; PAPERSIZE_LEGAL2 ; > ;
+ < "Tabloid" ; PAPERSIZE_TABLOID ; > ;
+ < "B6 (JIS)" ; PAPERSIZE_B6_JIS ; > ;
+ < "B5 (JIS)" ; PAPERSIZE_B5_JIS ; > ;
+ < "B4 (JIS)" ; PAPERSIZE_B4_JIS ; > ;
+ < "16 Kai" ; PAPERSIZE_KAI16; > ;
+ < "32 Kai" ; PAPERSIZE_KAI32; > ;
+ < "Big 32 Kai" ; PAPERSIZE_KAI32BIG; > ;
+ < "User" ; PAPERSIZE_USER ; > ;
+ < "DL Envelope" ; PAPERSIZE_DL ; > ;
+ < "C6 Envelope" ; PAPERSIZE_C6 ; > ;
+ < "C6/5 Envelope" ; PAPERSIZE_C65 ; > ;
+ < "C5 Envelope" ; PAPERSIZE_C5 ; > ;
+ < "C4 Envelope" ; PAPERSIZE_C4 ; > ;
+ < "Dia Slide" ; PAPERSIZE_DIA ; > ;
+ < "Screen" ; PAPERSIZE_SCREEN ; > ;
+ };
+};
+String RID_SVXSTR_PAPERBIN
+{
+ Text [ en-US ] = "Paper tray" ;
+};
+String RID_SVXSTR_PAPERBIN_SETTINGS
+{
+ Text [ en-US ] = "[From printer settings]" ;
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
new file mode 100644
index 000000000000..40920fa38c97
--- /dev/null
+++ b/cui/source/tabpages/paragrph.cxx
@@ -0,0 +1,2374 @@
+/*************************************************************************
+ *
+ * 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: paragrph.cxx,v $
+ * $Revision: 1.54 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <svl/style.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/module.hxx>
+#include <vcl/mnemonic.hxx>
+
+#define _SVX_PARAGRPH_CXX 0
+
+#include <svl/languageoptions.hxx>
+#include <svx/pgrditem.hxx>
+#include <svx/dialogs.hrc>
+#include "paragrph.hrc"
+#include "paragrph.hxx"
+#include <svx/frmdiritem.hxx>
+#include <svx/lspcitem.hxx>
+#include <svx/adjitem.hxx>
+#include <svx/orphitem.hxx>
+#include <svx/widwitem.hxx>
+#include <svx/tstpitem.hxx>
+#include <svx/pmdlitem.hxx>
+#include <svx/spltitem.hxx>
+#include <svx/hyznitem.hxx>
+#include <svx/ulspitem.hxx>
+#include <svx/lrspitem.hxx>
+#include <svx/brkitem.hxx>
+#include <svx/keepitem.hxx>
+#include "svx/dlgutil.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/htmlmode.hxx"
+#include <svx/paravertalignitem.hxx>
+#include <svl/eitem.hxx> //add CHINA001
+#include <sfx2/request.hxx> //add CHINA001
+#include <svl/intitem.hxx> //add CHINA001
+
+// static ----------------------------------------------------------------
+
+static USHORT pStdRanges[] =
+{
+ SID_ATTR_PARA_LINESPACE, // 10033
+ SID_ATTR_PARA_LINESPACE,
+ SID_ATTR_LRSPACE, // 10048 -
+ SID_ATTR_ULSPACE, // 10049
+ SID_ATTR_PARA_REGISTER, // 10413
+ SID_ATTR_PARA_REGISTER,
+ 0
+};
+
+static USHORT pAlignRanges[] =
+{
+ SID_ATTR_PARA_ADJUST, // 10027
+ SID_ATTR_PARA_ADJUST,
+ 0
+};
+
+static USHORT pExtRanges[] =
+{
+ SID_ATTR_PARA_PAGEBREAK, // 10037 -
+ SID_ATTR_PARA_WIDOWS, // 10041
+ SID_ATTR_PARA_MODEL, // 10065 -
+ SID_ATTR_PARA_KEEP, // 10066
+ 0
+};
+
+// define ----------------------------------------------------------------
+
+#define MAX_DURCH 5670 // 10 cm ist sinnvoll als maximaler Durchschuss
+ // laut BP
+#define FIX_DIST_DEF 283 // Standard-Fix-Abstand 0,5cm
+
+// enum ------------------------------------------------------------------
+
+enum LineSpaceList
+{
+ LLINESPACE_1 = 0,
+ LLINESPACE_15 = 1,
+ LLINESPACE_2 = 2,
+ LLINESPACE_PROP = 3,
+ LLINESPACE_MIN = 4,
+ LLINESPACE_DURCH= 5,
+ LLINESPACE_FIX = 6,
+ LLINESPACE_END
+};
+
+// C-Funktion ------------------------------------------------------------
+
+void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 );
+
+void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace,
+ int eSpace, long lValue )
+{
+ switch ( eSpace )
+ {
+ case LLINESPACE_1:
+ rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
+ break;
+
+ case LLINESPACE_15:
+ rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ rLineSpace.SetPropLineSpace( 150 );
+ break;
+
+ case LLINESPACE_2:
+ rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ rLineSpace.SetPropLineSpace( 200 );
+ break;
+
+ case LLINESPACE_PROP:
+ rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ rLineSpace.SetPropLineSpace( (BYTE)lValue );
+ break;
+
+ case LLINESPACE_MIN:
+ rLineSpace.SetLineHeight( (USHORT)lValue );
+ rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
+ break;
+
+ case LLINESPACE_DURCH:
+ rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ rLineSpace.SetInterLineSpace( (USHORT)lValue );
+ break;
+
+ case LLINESPACE_FIX:
+ rLineSpace.SetLineHeight((USHORT)lValue);
+ rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX;
+ rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
+ break;
+ }
+}
+
+
+USHORT GetHtmlMode_Impl(const SfxItemSet& rSet)
+{
+ USHORT nHtmlMode = 0;
+ const SfxPoolItem* pItem = 0;
+ SfxObjectShell* pShell;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem) ||
+ ( 0 != (pShell = SfxObjectShell::Current()) &&
+ 0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
+ {
+ nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
+ }
+ return nHtmlMode;
+
+}
+
+// class SvxStdParagraphTabPage ------------------------------------------
+
+IMPL_LINK( SvxStdParagraphTabPage, ELRLoseFocusHdl, Edit *, EMPTYARG )
+{
+//! if ( aLeftIndent.IsRelativeMode() )
+//! return 0; //!!!
+
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ FieldUnit eUnit =
+ MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
+
+ sal_Int64 nL = aLeftIndent.Denormalize( aLeftIndent.GetValue( eUnit ) );
+ sal_Int64 nR = aRightIndent.Denormalize( aRightIndent.GetValue( eUnit ) );
+ String aTmp = aFLineIndent.GetText();
+
+ // Erstzeilen Einzug
+ if( aLeftIndent.GetMin() < 0 )
+ aFLineIndent.SetMin( -99999, FUNIT_MM );
+ else
+ aFLineIndent.SetMin( aFLineIndent.Normalize( -nL ), eUnit );
+
+ // Check nur fuer konkrete Breite (Shell)
+ sal_Int64 nTmp = nWidth - nL - nR - MM50;
+ aFLineIndent.SetMax( aFLineIndent.Normalize( nTmp ), eUnit );
+
+ if ( !aTmp.Len() )
+ aFLineIndent.SetEmptyFieldValue();
+ // Maximum Links Rechts
+ aTmp = aLeftIndent.GetText();
+ nTmp = nWidth - nR - MM50;
+ aLeftIndent.SetMax( aLeftIndent.Normalize( nTmp ), eUnit );
+
+ if ( !aTmp.Len() )
+ aLeftIndent.SetEmptyFieldValue();
+ aTmp = aRightIndent.GetText();
+ nTmp = nWidth - nL - MM50;
+ aRightIndent.SetMax( aRightIndent.Normalize( nTmp ), eUnit );
+
+ if ( !aTmp.Len() )
+ aRightIndent.SetEmptyFieldValue();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxStdParagraphTabPage::Create( Window* pParent,
+ const SfxItemSet& rSet)
+{
+ return new SvxStdParagraphTabPage( pParent, rSet );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxStdParagraphTabPage::FillItemSet( SfxItemSet& rOutSet )
+{
+ SfxItemState eState = SFX_ITEM_UNKNOWN;
+ const SfxPoolItem* pOld = 0;
+ SfxItemPool* pPool = rOutSet.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+
+ BOOL bModified = FALSE;
+ USHORT nWhich;
+ USHORT nPos = aLineDist.GetSelectEntryPos();
+
+ if ( LISTBOX_ENTRY_NOTFOUND != nPos &&
+ ( nPos != aLineDist.GetSavedValue() ||
+ aLineDistAtPercentBox.IsValueModified() ||
+ aLineDistAtMetricBox.IsValueModified() ) )
+ {
+ nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
+ SfxMapUnit eUnit = pPool->GetMetric( nWhich );
+ SvxLineSpacingItem aSpacing(
+ (const SvxLineSpacingItem&)GetItemSet().Get( nWhich ) );
+
+ switch ( nPos )
+ {
+ case LLINESPACE_1:
+ case LLINESPACE_15:
+ case LLINESPACE_2:
+ SetLineSpace_Impl( aSpacing, nPos );
+ break;
+
+ case LLINESPACE_PROP:
+ SetLineSpace_Impl( aSpacing, nPos,
+ static_cast<long>(aLineDistAtPercentBox.Denormalize(
+ aLineDistAtPercentBox.GetValue() )) );
+ break;
+
+ case LLINESPACE_MIN:
+ case LLINESPACE_DURCH:
+ case LLINESPACE_FIX:
+ SetLineSpace_Impl( aSpacing, nPos,
+ GetCoreValue( aLineDistAtMetricBox, eUnit ) );
+ break;
+
+ default:
+ DBG_ERROR( "unbekannter Type fuer Zeilenabstand." );
+ break;
+ }
+ eState = GetItemSet().GetItemState( nWhich );
+ pOld = GetOldItem( rOutSet, SID_ATTR_PARA_LINESPACE );
+
+ if ( !pOld || !( *(const SvxLineSpacingItem*)pOld == aSpacing ) ||
+ SFX_ITEM_DONTCARE == eState )
+ {
+ rOutSet.Put( aSpacing );
+ bModified |= TRUE;
+ }
+ }
+
+ if ( aTopDist.IsValueModified() || aBottomDist.IsValueModified() )
+ {
+ nWhich = GetWhich( SID_ATTR_ULSPACE );
+ SfxMapUnit eUnit = pPool->GetMetric( nWhich );
+ pOld = GetOldItem( rOutSet, SID_ATTR_ULSPACE );
+ SvxULSpaceItem aMargin( nWhich );
+
+ if ( bRelativeMode )
+ {
+ DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
+
+ const SvxULSpaceItem& rOldItem =
+ (const SvxULSpaceItem&)GetItemSet().GetParent()->Get( nWhich );
+
+ if ( aTopDist.IsRelative() )
+ aMargin.SetUpper( rOldItem.GetUpper(),
+ (USHORT)aTopDist.GetValue() );
+ else
+ aMargin.SetUpper( (USHORT)GetCoreValue( aTopDist, eUnit ) );
+
+ if ( aBottomDist.IsRelative() )
+ aMargin.SetLower( rOldItem.GetLower(),
+ (USHORT)aBottomDist.GetValue() );
+ else
+ aMargin.SetLower( (USHORT)GetCoreValue( aBottomDist, eUnit ) );
+
+ }
+ else
+ {
+ aMargin.SetUpper( (USHORT)GetCoreValue( aTopDist, eUnit ) );
+ aMargin.SetLower( (USHORT)GetCoreValue( aBottomDist, eUnit ) );
+ }
+ eState = GetItemSet().GetItemState( nWhich );
+
+ if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aMargin ) ||
+ SFX_ITEM_DONTCARE == eState )
+ {
+ rOutSet.Put( aMargin );
+ bModified |= TRUE;
+ }
+ }
+ FASTBOOL bNullTab = FALSE;
+
+ if ( aLeftIndent.IsValueModified() ||
+ aFLineIndent.IsValueModified() ||
+ aRightIndent.IsValueModified()
+ || aAutoCB.GetSavedValue() != aAutoCB.IsChecked() )
+ {
+ nWhich = GetWhich( SID_ATTR_LRSPACE );
+ SfxMapUnit eUnit = pPool->GetMetric( nWhich );
+ SvxLRSpaceItem aMargin( nWhich );
+ pOld = GetOldItem( rOutSet, SID_ATTR_LRSPACE );
+
+ if ( bRelativeMode )
+ {
+ DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
+
+ const SvxLRSpaceItem& rOldItem =
+ (const SvxLRSpaceItem&)GetItemSet().GetParent()->Get( nWhich );
+
+ if ( aLeftIndent.IsRelative() )
+ aMargin.SetTxtLeft( rOldItem.GetTxtLeft(),
+ (USHORT)aLeftIndent.GetValue() );
+ else
+ aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) );
+
+ if ( aRightIndent.IsRelative() )
+ aMargin.SetRight( rOldItem.GetRight(),
+ (USHORT)aRightIndent.GetValue() );
+ else
+ aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) );
+
+ if ( aFLineIndent.IsRelative() )
+ aMargin.SetTxtFirstLineOfst( rOldItem.GetTxtFirstLineOfst(),
+ (USHORT)aFLineIndent.GetValue() );
+ else
+ aMargin.SetTxtFirstLineOfst(
+ (USHORT)GetCoreValue( aFLineIndent, eUnit ) );
+ }
+ else
+ {
+ aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) );
+ aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) );
+ aMargin.SetTxtFirstLineOfst(
+ (USHORT)GetCoreValue( aFLineIndent, eUnit ) );
+ }
+ aMargin.SetAutoFirst(aAutoCB.IsChecked());
+ if ( aMargin.GetTxtFirstLineOfst() < 0 )
+ bNullTab = TRUE;
+ eState = GetItemSet().GetItemState( nWhich );
+
+ if ( !pOld || !( *(const SvxLRSpaceItem*)pOld == aMargin ) ||
+ SFX_ITEM_DONTCARE == eState )
+ {
+ rOutSet.Put( aMargin );
+ bModified |= TRUE;
+ }
+ }
+
+ if ( bNullTab )
+ {
+ MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
+ if ( MAP_100TH_MM != eUnit )
+ {
+
+ // negativer Erstzeileneinzug -> ggf. Null Default-Tabstop setzen
+ USHORT _nWhich = GetWhich( SID_ATTR_TABSTOP );
+ const SfxItemSet& rInSet = GetItemSet();
+
+ if ( rInSet.GetItemState( _nWhich ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxTabStopItem& rTabItem =
+ (const SvxTabStopItem&)rInSet.Get( _nWhich );
+ SvxTabStopItem aNullTab( rTabItem );
+ SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT );
+ aNullTab.Insert( aNull );
+ rOutSet.Put( aNullTab );
+ }
+ }
+ }
+ if( aRegisterCB.IsVisible())
+ {
+ const SfxBoolItem* pBoolItem = (SfxBoolItem*)GetOldItem(
+ rOutSet, SID_ATTR_PARA_REGISTER);
+ SfxBoolItem* pRegItem = (SfxBoolItem*)pBoolItem->Clone();
+ USHORT _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
+ BOOL bSet = pRegItem->GetValue();
+
+ if(aRegisterCB.IsChecked() != bSet )
+ {
+ pRegItem->SetValue(!bSet);
+ rOutSet.Put(*pRegItem);
+ bModified |= TRUE;
+ }
+ else if ( SFX_ITEM_DEFAULT == GetItemSet().GetItemState( _nWhich, FALSE ) )
+ rOutSet.ClearItem(_nWhich);
+ delete pRegItem;
+ }
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxStdParagraphTabPage::Reset( const SfxItemSet& rSet )
+{
+ SfxItemPool* pPool = rSet.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool?" );
+ String aEmpty;
+
+ // Metrik einstellen
+ FieldUnit eFUnit = GetModuleFieldUnit( &rSet );
+ SetFieldUnit( aLeftIndent, eFUnit );
+ SetFieldUnit( aRightIndent, eFUnit );
+ SetFieldUnit( aFLineIndent, eFUnit );
+ SetFieldUnit( aTopDist, eFUnit );
+ SetFieldUnit( aBottomDist, eFUnit );
+ SetFieldUnit( aLineDistAtMetricBox, eFUnit );
+
+ USHORT _nWhich = GetWhich( SID_ATTR_LRSPACE );
+ SfxItemState eItemState = rSet.GetItemState( _nWhich );
+
+ if ( eItemState >= SFX_ITEM_AVAILABLE )
+ {
+ SfxMapUnit eUnit = pPool->GetMetric( _nWhich );
+
+ if ( bRelativeMode )
+ {
+ const SvxLRSpaceItem& rOldItem =
+ (const SvxLRSpaceItem&)rSet.Get( _nWhich );
+
+ if ( rOldItem.GetPropLeft() != 100 )
+ {
+ aLeftIndent.SetRelative( TRUE );
+ aLeftIndent.SetValue( rOldItem.GetPropLeft() );
+ }
+ else
+ {
+ aLeftIndent.SetRelative();
+ SetFieldUnit( aLeftIndent, eFUnit );
+ SetMetricValue( aLeftIndent, rOldItem.GetTxtLeft(), eUnit );
+ }
+
+ if ( rOldItem.GetPropRight() != 100 )
+ {
+ aRightIndent.SetRelative( TRUE );
+ aRightIndent.SetValue( rOldItem.GetPropRight() );
+ }
+ else
+ {
+ aRightIndent.SetRelative();
+ SetFieldUnit( aRightIndent, eFUnit );
+ SetMetricValue( aRightIndent, rOldItem.GetRight(), eUnit );
+ }
+
+ if ( rOldItem.GetPropTxtFirstLineOfst() != 100 )
+ {
+ aFLineIndent.SetRelative( TRUE );
+ aFLineIndent.SetValue( rOldItem.GetPropTxtFirstLineOfst() );
+ }
+ else
+ {
+ aFLineIndent.SetRelative();
+ aFLineIndent.SetMin(-9999);
+ SetFieldUnit( aFLineIndent, eFUnit );
+ SetMetricValue( aFLineIndent, rOldItem.GetTxtFirstLineOfst(),
+ eUnit );
+ }
+ aAutoCB.Check(rOldItem.IsAutoFirst());
+ }
+ else
+ {
+ const SvxLRSpaceItem& rSpace =
+ (const SvxLRSpaceItem&)rSet.Get( _nWhich );
+
+ SetMetricValue( aLeftIndent, rSpace.GetTxtLeft(), eUnit );
+ SetMetricValue( aRightIndent, rSpace.GetRight(), eUnit );
+ SetMetricValue( aFLineIndent, rSpace.GetTxtFirstLineOfst(), eUnit );
+ aAutoCB.Check(rSpace.IsAutoFirst());
+ }
+ AutoHdl_Impl(&aAutoCB);
+ }
+ else
+ {
+ aLeftIndent.SetEmptyFieldValue();
+ aRightIndent.SetEmptyFieldValue();
+ aFLineIndent.SetEmptyFieldValue();
+ }
+
+ _nWhich = GetWhich( SID_ATTR_ULSPACE );
+ eItemState = rSet.GetItemState( _nWhich );
+
+ if ( eItemState >= SFX_ITEM_AVAILABLE )
+ {
+ SfxMapUnit eUnit = pPool->GetMetric( _nWhich );
+
+ if ( bRelativeMode )
+ {
+ const SvxULSpaceItem& rOldItem =
+ (const SvxULSpaceItem&)rSet.Get( _nWhich );
+
+ if ( rOldItem.GetPropUpper() != 100 )
+ {
+ aTopDist.SetRelative( TRUE );
+ aTopDist.SetValue( rOldItem.GetPropUpper() );
+ }
+ else
+ {
+ aTopDist.SetRelative();
+ SetFieldUnit( aTopDist, eFUnit );
+ SetMetricValue( aTopDist, rOldItem.GetUpper(), eUnit );
+ }
+
+ if ( rOldItem.GetPropLower() != 100 )
+ {
+ aBottomDist.SetRelative( TRUE );
+ aBottomDist.SetValue( rOldItem.GetPropLower() );
+ }
+ else
+ {
+ aBottomDist.SetRelative();
+ SetFieldUnit( aBottomDist, eFUnit );
+ SetMetricValue( aBottomDist, rOldItem.GetLower(), eUnit );
+ }
+ }
+ else
+ {
+ const SvxULSpaceItem& rTopMargin =
+ (const SvxULSpaceItem&)rSet.Get( _nWhich );
+ SetMetricValue( aTopDist, rTopMargin.GetUpper(), eUnit );
+ SetMetricValue( aBottomDist, rTopMargin.GetLower(), eUnit );
+ }
+ }
+ else
+ {
+ aTopDist.SetEmptyFieldValue();
+ aBottomDist.SetEmptyFieldValue();
+ }
+
+ _nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
+ eItemState = rSet.GetItemState( _nWhich );
+
+ if ( eItemState >= SFX_ITEM_AVAILABLE )
+ SetLineSpacing_Impl( (const SvxLineSpacingItem &)rSet.Get( _nWhich ) );
+ else
+ aLineDist.SetNoSelection();
+
+
+ _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
+ eItemState = rSet.GetItemState( _nWhich );
+
+ if ( eItemState >= SFX_ITEM_AVAILABLE )
+ aRegisterCB.Check( ((const SfxBoolItem &)rSet.Get( _nWhich )).GetValue());
+ aRegisterCB.SaveValue();
+ USHORT nHtmlMode = GetHtmlMode_Impl(rSet);
+ if(nHtmlMode & HTMLMODE_ON)
+ {
+ aRegisterCB.Hide();
+ aRegisterFL.Hide();
+ aAutoCB.Hide();
+ if(!(nHtmlMode & HTMLMODE_SOME_STYLES)) // IE oder SW
+ {
+ aRightLabel.Disable();
+ aRightIndent.Disable();
+ aTopDist.Disable(); //HTML3.2 und NS 3.0
+ aBottomDist.Disable();
+ if(!(nHtmlMode & HTMLMODE_FIRSTLINE)) //NS 3.0
+ {
+ aFLineIndent.Disable();
+ aFLineLabel.Disable();
+ }
+ }
+ }
+
+ ELRLoseFocusHdl( NULL );
+ aAutoCB.SaveValue();
+ aLineDist.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxStdParagraphTabPage::EnableRelativeMode()
+{
+ DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
+
+ aLeftIndent.EnableRelativeMode( 0, 999 );
+ aFLineIndent.EnableRelativeMode( 0, 999 );
+ aRightIndent.EnableRelativeMode( 0, 999 );
+ aTopDist.EnableRelativeMode( 0, 999 );
+ aBottomDist.EnableRelativeMode( 0, 999 );
+ bRelativeMode = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxStdParagraphTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ ELRLoseFocusHdl( NULL );
+
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window* pParent,
+ const SfxItemSet& rAttr ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_STD_PARAGRAPH ), rAttr ),
+
+ aLeftLabel ( this, SVX_RES( FT_LEFTINDENT ) ),
+ aLeftIndent ( this, SVX_RES( ED_LEFTINDENT ) ),
+ aRightLabel ( this, SVX_RES( FT_RIGHTINDENT ) ),
+ aRightIndent ( this, SVX_RES( ED_RIGHTINDENT ) ),
+
+ aFLineLabel ( this, SVX_RES( FT_FLINEINDENT ) ),
+ aFLineIndent ( this, SVX_RES( ED_FLINEINDENT ) ),
+ aAutoCB ( this, SVX_RES( CB_AUTO ) ),
+ aIndentFrm ( this, SVX_RES( FL_INDENT ) ),
+ aTopLabel ( this, SVX_RES( FT_TOPDIST ) ),
+ aTopDist ( this, SVX_RES( ED_TOPDIST ) ),
+ aBottomLabel ( this, SVX_RES( FT_BOTTOMDIST ) ),
+ aBottomDist ( this, SVX_RES( ED_BOTTOMDIST ) ),
+ aDistFrm ( this, SVX_RES( FL_DIST ) ),
+ aLineDist ( this, SVX_RES( LB_LINEDIST ) ),
+ aLineDistAtLabel ( this, SVX_RES( FT_LINEDIST ) ),
+ aLineDistAtPercentBox ( this, SVX_RES( ED_LINEDISTPERCENT ) ),
+ aLineDistAtMetricBox ( this, SVX_RES( ED_LINEDISTMETRIC ) ),
+ aLineDistFrm ( this, SVX_RES( FL_LINEDIST ) ),
+ sAbsDist ( SVX_RES(ST_LINEDIST_ABS) ),
+ aExampleWin ( this, SVX_RES( WN_EXAMPLE ) ),
+ aRegisterCB ( this, SVX_RES( CB_REGISTER ) ),
+ aRegisterFL ( this, SVX_RES( FL_REGISTER ) ),
+ pActLineDistFld ( &aLineDistAtPercentBox ),
+ nAbst ( MAX_DURCH ),
+ nWidth ( 11905 /*567 * 50*/ ),
+ nMinFixDist(0L),
+
+ bRelativeMode ( FALSE ),
+ bNegativeIndents(FALSE)
+
+{
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ aLineDistAtMetricBox.Hide();
+ FreeResource();
+ Init_Impl();
+ aFLineIndent.SetMin(-9999); // wird default auf 0 gesetzt
+}
+
+
+// -----------------------------------------------------------------------
+
+void SvxStdParagraphTabPage::EnableNegativeMode()
+{
+ aLeftIndent.SetMin(-9999);
+ aRightIndent.SetMin(-9999);
+ aRightIndent.EnableNegativeMode();
+ aLeftIndent.EnableNegativeMode();
+ bNegativeIndents = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxStdParagraphTabPage::GetRanges()
+{
+ return pStdRanges;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxStdParagraphTabPage::SetLineSpacing_Impl
+(
+ const SvxLineSpacingItem &rAttr
+)
+{
+ SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( rAttr.Which() );
+
+ switch( rAttr.GetLineSpaceRule() )
+ {
+ case SVX_LINE_SPACE_AUTO:
+ {
+ SvxInterLineSpace eInter = rAttr.GetInterLineSpaceRule();
+
+ switch( eInter )
+ {
+ // Default einzeilig
+ case SVX_INTER_LINE_SPACE_OFF:
+ aLineDist.SelectEntryPos( LLINESPACE_1 );
+ break;
+
+ // Default einzeilig
+ case SVX_INTER_LINE_SPACE_PROP:
+ if ( 100 == rAttr.GetPropLineSpace() )
+ {
+ aLineDist.SelectEntryPos( LLINESPACE_1 );
+ break;
+ }
+ // 1.5zeilig
+ if ( 150 == rAttr.GetPropLineSpace() )
+ {
+ aLineDist.SelectEntryPos( LLINESPACE_15 );
+ break;
+ }
+ // 2zeilig
+ if ( 200 == rAttr.GetPropLineSpace() )
+ {
+ aLineDist.SelectEntryPos( LLINESPACE_2 );
+ break;
+ }
+ // eingestellter Prozentwert
+ aLineDistAtPercentBox.
+ SetValue( aLineDistAtPercentBox.Normalize(
+ rAttr.GetPropLineSpace() ) );
+ aLineDist.SelectEntryPos( LLINESPACE_PROP );
+ break;
+
+ case SVX_INTER_LINE_SPACE_FIX:
+ SetMetricValue( aLineDistAtMetricBox,
+ rAttr.GetInterLineSpace(), eUnit );
+ aLineDist.SelectEntryPos( LLINESPACE_DURCH );
+ break;
+ default: ;//prevent warning
+ }
+ }
+ break;
+ case SVX_LINE_SPACE_FIX:
+ SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
+ aLineDist.SelectEntryPos( LLINESPACE_FIX );
+ break;
+
+ case SVX_LINE_SPACE_MIN:
+ SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
+ aLineDist.SelectEntryPos( LLINESPACE_MIN );
+ break;
+ default: ;//prevent warning
+ }
+ LineDistHdl_Impl( &aLineDist );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxStdParagraphTabPage, LineDistHdl_Impl, ListBox *, pBox )
+{
+ switch( pBox->GetSelectEntryPos() )
+ {
+ case LLINESPACE_1:
+ case LLINESPACE_15:
+ case LLINESPACE_2:
+ aLineDistAtLabel.Enable(FALSE);
+ pActLineDistFld->Enable(FALSE);
+ pActLineDistFld->SetText( String() );
+ break;
+
+ case LLINESPACE_DURCH:
+ // Setzen eines sinnvollen Defaults?
+ // MS Begrenzen min(10, aPageSize)
+ aLineDistAtPercentBox.Hide();
+ pActLineDistFld = &aLineDistAtMetricBox;
+ aLineDistAtMetricBox.SetMin(0);
+
+
+ if ( !aLineDistAtMetricBox.GetText().Len() )
+ aLineDistAtMetricBox.SetValue(
+ aLineDistAtMetricBox.Normalize( 1 ) );
+ aLineDistAtPercentBox.Hide();
+ pActLineDistFld->Show();
+ pActLineDistFld->Enable();
+ aLineDistAtLabel.Enable();
+ break;
+
+ case LLINESPACE_MIN:
+ aLineDistAtPercentBox.Hide();
+ pActLineDistFld = &aLineDistAtMetricBox;
+ aLineDistAtMetricBox.SetMin(0);
+
+ if ( !aLineDistAtMetricBox.GetText().Len() )
+ aLineDistAtMetricBox.SetValue(
+ aLineDistAtMetricBox.Normalize( 10 ), FUNIT_TWIP );
+ aLineDistAtPercentBox.Hide();
+ pActLineDistFld->Show();
+ pActLineDistFld->Enable();
+ aLineDistAtLabel.Enable();
+ break;
+
+ case LLINESPACE_PROP:
+ aLineDistAtMetricBox.Hide();
+ pActLineDistFld = &aLineDistAtPercentBox;
+
+ if ( !aLineDistAtPercentBox.GetText().Len() )
+ aLineDistAtPercentBox.SetValue(
+ aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP );
+ aLineDistAtMetricBox.Hide();
+ pActLineDistFld->Show();
+ pActLineDistFld->Enable();
+ aLineDistAtLabel.Enable();
+ break;
+ case LLINESPACE_FIX:
+ {
+ aLineDistAtPercentBox.Hide();
+ pActLineDistFld = &aLineDistAtMetricBox;
+ sal_Int64 nTemp = aLineDistAtMetricBox.GetValue();
+ aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP);
+
+ // wurde der Wert beim SetMin veraendert, dann ist es Zeit
+ // fuer den default
+ if ( aLineDistAtMetricBox.GetValue() != nTemp )
+ SetMetricValue( aLineDistAtMetricBox,
+ FIX_DIST_DEF, SFX_MAPUNIT_TWIP ); // fix gibt's nur im Writer
+ aLineDistAtPercentBox.Hide();
+ pActLineDistFld->Show();
+ pActLineDistFld->Enable();
+ aLineDistAtLabel.Enable();
+ }
+ break;
+ }
+ UpdateExample_Impl( TRUE );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxStdParagraphTabPage, ModifyHdl_Impl, SvxRelativeField *, EMPTYARG )
+{
+ UpdateExample_Impl();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxStdParagraphTabPage, ModifyHdl_Impl, SvxRelativeField *, EMPTYARG )
+
+// -----------------------------------------------------------------------
+
+void SvxStdParagraphTabPage::Init_Impl()
+{
+ aLineDist.SetSelectHdl(
+ LINK( this, SvxStdParagraphTabPage, LineDistHdl_Impl ) );
+
+ Link aLink = LINK( this, SvxStdParagraphTabPage, ELRLoseFocusHdl );
+ aFLineIndent.SetLoseFocusHdl( aLink );
+ aLeftIndent.SetLoseFocusHdl( aLink );
+ aRightIndent.SetLoseFocusHdl( aLink );
+
+ aLink = LINK( this, SvxStdParagraphTabPage, ModifyHdl_Impl );
+ aFLineIndent.SetModifyHdl( aLink );
+ aLeftIndent.SetModifyHdl( aLink );
+ aRightIndent.SetModifyHdl( aLink );
+ aTopDist.SetModifyHdl( aLink );
+ aBottomDist.SetModifyHdl( aLink );
+
+ aAutoCB.SetClickHdl( LINK( this, SvxStdParagraphTabPage, AutoHdl_Impl ));
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ FieldUnit eUnit =
+ MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
+
+ aTopDist.SetMax( aTopDist.Normalize( nAbst ), eUnit );
+ aBottomDist.SetMax( aBottomDist.Normalize( nAbst ), eUnit );
+ aLineDistAtMetricBox.SetMax(
+ aLineDistAtMetricBox.Normalize( nAbst ), eUnit );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxStdParagraphTabPage::UpdateExample_Impl( BOOL bAll )
+{
+ aExampleWin.SetFirstLineOfst(
+ (short)aFLineIndent.Denormalize( aFLineIndent.GetValue( FUNIT_TWIP ) ) );
+ aExampleWin.SetLeftMargin(
+ static_cast<long>(aLeftIndent.Denormalize( aLeftIndent.GetValue( FUNIT_TWIP ) ) ) );
+ aExampleWin.SetRightMargin(
+ static_cast<long>(aRightIndent.Denormalize( aRightIndent.GetValue( FUNIT_TWIP ) ) ) );
+ aExampleWin.SetUpper(
+ (USHORT)aTopDist.Denormalize( aTopDist.GetValue( FUNIT_TWIP ) ) );
+ aExampleWin.SetLower(
+ (USHORT)aBottomDist.Denormalize( aBottomDist.GetValue( FUNIT_TWIP ) ) );
+
+
+
+ USHORT nPos = aLineDist.GetSelectEntryPos();
+
+ switch ( nPos )
+ {
+ case LLINESPACE_1:
+ case LLINESPACE_15:
+ case LLINESPACE_2:
+ aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos );
+ break;
+
+ case LLINESPACE_PROP:
+ aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos,
+ (USHORT)aLineDistAtPercentBox.Denormalize(
+ aLineDistAtPercentBox.GetValue() ) );
+ break;
+
+ case LLINESPACE_MIN:
+ case LLINESPACE_DURCH:
+ case LLINESPACE_FIX:
+ aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos,
+ (USHORT)GetCoreValue( aLineDistAtMetricBox, SFX_MAPUNIT_TWIP ) );
+ break;
+ }
+ aExampleWin.Draw( bAll );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxStdParagraphTabPage::EnableRegisterMode()
+{
+ aRegisterCB.Show();
+ aRegisterFL.Show();
+}
+
+/*-----------------16.01.97 19.54-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxStdParagraphTabPage, AutoHdl_Impl, CheckBox*, pBox )
+{
+ BOOL bEnable = !pBox->IsChecked();
+ aFLineLabel .Enable(bEnable);
+ aFLineIndent.Enable(bEnable);
+ return 0;
+}
+
+/*-----------------16.01.97 18.00-------------------
+
+--------------------------------------------------*/
+void SvxStdParagraphTabPage::SetPageWidth( USHORT nPageWidth )
+{
+ nWidth = nPageWidth;
+}
+/*-----------------16.01.97 18.01-------------------
+
+--------------------------------------------------*/
+void SvxStdParagraphTabPage::SetMaxDistance( USHORT nMaxDist )
+{
+ nAbst = nMaxDist;
+}
+
+/*-----------------17.01.97 08.11-------------------
+
+--------------------------------------------------*/
+void SvxStdParagraphTabPage::EnableAutoFirstLine()
+{
+ aAutoCB.Show();
+}
+
+/*-----------------11.06.97 11.48-------------------
+ absoluter Zeilenabstand
+--------------------------------------------------*/
+void SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip)
+{
+ aLineDist.InsertEntry(sAbsDist);
+ nMinFixDist = nMinTwip;
+}
+
+//addd CHINA001 begin
+void SvxStdParagraphTabPage::PageCreated(SfxAllItemSet aSet)
+{
+
+/* CHINA001 different bit represent call to different method of SvxStdParagraphTabPage
+ 0x0001 --->EnableRelativeMode()
+ 0x0002 --->EnableRegisterMode()
+ 0x0004 --->EnableAutoFirstLine()
+ 0x0008 --->EnableNegativeMode()
+
+
+ */
+ SFX_ITEMSET_ARG (&aSet,pPageWidthItem,SfxUInt16Item,SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pFlagSetItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pLineDistItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,sal_False);
+
+ if (pPageWidthItem)
+ SetPageWidth(pPageWidthItem->GetValue());
+
+ if (pFlagSetItem )
+ if (( 0x0001 & pFlagSetItem->GetValue())== 0x0001 )
+ EnableRelativeMode();
+
+ if (pFlagSetItem)
+ if (( 0x0002 & pFlagSetItem->GetValue())== 0x0002 )
+ EnableRegisterMode();
+
+ if (pFlagSetItem)
+ if ( ( 0x0004 & pFlagSetItem->GetValue())== 0x0004 )
+ EnableAutoFirstLine();
+
+ if(pLineDistItem)
+ EnableAbsLineDist(pLineDistItem->GetValue());
+
+ if (pFlagSetItem)
+ if (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 )
+ EnableNegativeMode();
+
+}
+//end of CHINA001
+
+#define LASTLINEPOS_DEFAULT 0
+#define LASTLINEPOS_LEFT 1
+
+#define LASTLINECOUNT_OLD 3
+#define LASTLINECOUNT_NEW 4
+
+// class SvxParaAlignTabPage ------------------------------------------------
+
+/*-----------------16.01.97 19.34-------------------
+
+--------------------------------------------------*/
+SvxParaAlignTabPage::SvxParaAlignTabPage( Window* pParent, const SfxItemSet& rSet )
+ : SfxTabPage(pParent, SVX_RES( RID_SVXPAGE_ALIGN_PARAGRAPH ),rSet),
+ aAlignFrm ( this, SVX_RES( FL_ALIGN ) ),
+ aLeft ( this, SVX_RES( BTN_LEFTALIGN ) ),
+ aRight ( this, SVX_RES( BTN_RIGHTALIGN ) ),
+ aCenter ( this, SVX_RES( BTN_CENTERALIGN ) ),
+ aJustify ( this, SVX_RES( BTN_JUSTIFYALIGN ) ),
+ aLastLineFT ( this, SVX_RES( FT_LASTLINE ) ),
+ aLastLineLB ( this, SVX_RES( LB_LASTLINE ) ),
+ aExpandCB ( this, SVX_RES( CB_EXPAND ) ),
+ aSnapToGridCB ( this, SVX_RES( CB_SNAP ) ),
+ aExampleWin ( this, SVX_RES( WN_EXAMPLE ) ),
+
+ aVertAlignFL ( this, SVX_RES( FL_VERTALIGN ) ),
+ aVertAlignFT ( this, SVX_RES( FT_VERTALIGN ) ),
+ aVertAlignLB ( this, SVX_RES( LB_VERTALIGN ) ),
+
+ aPropertiesFL ( this, SVX_RES( FL_PROPERTIES )),
+ aTextDirectionFT ( this, SVX_RES( FT_TEXTDIRECTION )),
+ aTextDirectionLB ( this, SVX_RES( LB_TEXTDIRECTION ))
+{
+ SvtLanguageOptions aLangOptions;
+ USHORT nLastLinePos = LASTLINEPOS_DEFAULT;
+
+ if ( aLangOptions.IsAsianTypographyEnabled() )
+ {
+ String sLeft(SVX_RES(ST_LEFTALIGN_ASIAN));
+ aLeft.SetText(sLeft);
+ aRight.SetText(String(SVX_RES(ST_RIGHTALIGN_ASIAN)));
+ sLeft = MnemonicGenerator::EraseAllMnemonicChars( sLeft );
+
+ if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_OLD )
+ {
+ aLastLineLB.RemoveEntry( 0 );
+ aLastLineLB.InsertEntry( sLeft, 0 );
+ }
+ else
+ nLastLinePos = LASTLINEPOS_LEFT;
+ }
+ // remove "Default" or "Left" entry, depends on CJKOptions
+ if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_NEW )
+ aLastLineLB.RemoveEntry( nLastLinePos );
+
+ FreeResource();
+ Link aLink = LINK( this, SvxParaAlignTabPage, AlignHdl_Impl );
+ aLeft.SetClickHdl( aLink );
+ aRight.SetClickHdl( aLink );
+ aCenter.SetClickHdl( aLink );
+ aJustify.SetClickHdl( aLink );
+ aLastLineLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, LastLineHdl_Impl ) );
+ aTextDirectionLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, TextDirectionHdl_Impl ) );
+
+ USHORT nHtmlMode = GetHtmlMode_Impl(rSet);
+ if(!(nHtmlMode & HTMLMODE_ON) || (0 != (nHtmlMode & HTMLMODE_SOME_STYLES)) )
+ {
+ if( aLangOptions.IsCTLFontEnabled() )
+ {
+ aTextDirectionLB.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP );
+ aTextDirectionLB.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP );
+ aTextDirectionLB.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT );
+
+ aPropertiesFL.Show();
+ aTextDirectionFT.Show();
+ aTextDirectionLB.Show();
+ }
+ }
+}
+
+/*-----------------16.01.97 19.33-------------------
+
+--------------------------------------------------*/
+SvxParaAlignTabPage::~SvxParaAlignTabPage()
+{
+}
+
+/*-----------------16.01.97 19.33-------------------
+
+--------------------------------------------------*/
+int SvxParaAlignTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+/*-----------------16.01.97 19.33-------------------
+
+--------------------------------------------------*/
+SfxTabPage* SvxParaAlignTabPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxParaAlignTabPage(pParent, rSet);
+}
+
+/*-----------------16.01.97 19.33-------------------
+
+--------------------------------------------------*/
+USHORT* SvxParaAlignTabPage::GetRanges()
+{
+ return pAlignRanges;
+
+}
+
+/*-----------------16.01.97 19.33-------------------
+
+--------------------------------------------------*/
+BOOL SvxParaAlignTabPage::FillItemSet( SfxItemSet& rOutSet )
+{
+ BOOL bModified = FALSE;
+
+ FASTBOOL bAdj = FALSE, bChecked = FALSE;
+ SvxAdjust eAdjust = SVX_ADJUST_LEFT;
+
+ if ( aLeft.IsChecked() )
+ {
+ eAdjust = SVX_ADJUST_LEFT;
+ bAdj = !aLeft.GetSavedValue();
+ bChecked = TRUE;
+ }
+ else if ( aRight.IsChecked() )
+ {
+ eAdjust = SVX_ADJUST_RIGHT;
+ bAdj = !aRight.GetSavedValue();
+ bChecked = TRUE;
+ }
+ else if ( aCenter.IsChecked() )
+ {
+ eAdjust = SVX_ADJUST_CENTER;
+ bAdj = !aCenter.GetSavedValue();
+ bChecked = TRUE;
+ }
+ else if ( aJustify.IsChecked() )
+ {
+ eAdjust = SVX_ADJUST_BLOCK;
+ bAdj = !aJustify.GetSavedValue() ||
+ aExpandCB.IsChecked() != aExpandCB.GetSavedValue() ||
+ aLastLineLB.GetSelectEntryPos() != aLastLineLB.GetSavedValue();
+ bChecked = TRUE;
+ }
+ USHORT _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
+
+ if ( bAdj )
+ {
+ const SvxAdjustItem* pOld =
+ (const SvxAdjustItem*)GetOldItem( rOutSet, SID_ATTR_PARA_ADJUST );
+ SvxAdjust eOneWord = aExpandCB.IsChecked() ? SVX_ADJUST_BLOCK
+ : SVX_ADJUST_LEFT;
+ USHORT nLBPos = aLastLineLB.GetSelectEntryPos();
+ SvxAdjust eLastBlock = SVX_ADJUST_LEFT;
+
+ if ( 1 == nLBPos )
+ eLastBlock = SVX_ADJUST_CENTER;
+ else if ( 2 == nLBPos )
+ eLastBlock = SVX_ADJUST_BLOCK;
+
+ FASTBOOL bNothingWasChecked =
+ !aLeft.GetSavedValue() && !aRight.GetSavedValue() &&
+ !aCenter.GetSavedValue() && !aJustify.GetSavedValue();
+
+ if ( !pOld || pOld->GetAdjust() != eAdjust ||
+ pOld->GetOneWord() != eOneWord ||
+ pOld->GetLastBlock() != eLastBlock ||
+ ( bChecked && bNothingWasChecked ) )
+ {
+ bModified |= TRUE;
+ SvxAdjustItem aAdj(
+ (const SvxAdjustItem&)GetItemSet().Get( _nWhich ) );
+ aAdj.SetAdjust( eAdjust );
+ aAdj.SetOneWord( eOneWord );
+ aAdj.SetLastBlock( eLastBlock );
+ rOutSet.Put( aAdj );
+ }
+ }
+ if(aSnapToGridCB.IsChecked() != aSnapToGridCB.GetSavedValue())
+ {
+ rOutSet.Put(SvxParaGridItem(aSnapToGridCB.IsChecked(), GetWhich( SID_ATTR_PARA_SNAPTOGRID )));
+ bModified = TRUE;
+ }
+ if(aVertAlignLB.GetSavedValue() != aVertAlignLB.GetSelectEntryPos())
+ {
+ rOutSet.Put(SvxParaVertAlignItem(aVertAlignLB.GetSelectEntryPos(), GetWhich( SID_PARA_VERTALIGN )));
+ bModified = TRUE;
+ }
+
+ if( aTextDirectionLB.IsVisible() )
+ {
+ SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue();
+ if( eDir != aTextDirectionLB.GetSavedValue() )
+ {
+ rOutSet.Put( SvxFrameDirectionItem( eDir, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) );
+ bModified = TRUE;
+ }
+ }
+
+ return bModified;
+}
+
+/*-----------------16.01.97 19.33-------------------
+
+--------------------------------------------------*/
+void SvxParaAlignTabPage::Reset( const SfxItemSet& rSet )
+{
+ USHORT _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
+ SfxItemState eItemState = rSet.GetItemState( _nWhich );
+
+ USHORT nLBSelect = 0;
+ if ( eItemState >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxAdjustItem& rAdj = (const SvxAdjustItem&)rSet.Get( _nWhich );
+
+ switch ( rAdj.GetAdjust() /*!!! VB fragen rAdj.GetLastBlock()*/ )
+ {
+ case SVX_ADJUST_LEFT: aLeft.Check(); break;
+
+ case SVX_ADJUST_RIGHT: aRight.Check(); break;
+
+ case SVX_ADJUST_CENTER: aCenter.Check(); break;
+
+ case SVX_ADJUST_BLOCK: aJustify.Check(); break;
+ default: ; //prevent warning
+ }
+ BOOL bEnable = aJustify.IsChecked();
+ aLastLineFT.Enable(bEnable);
+ aLastLineLB.Enable(bEnable);
+ aExpandCB .Enable(bEnable);
+
+ aExpandCB.Check(SVX_ADJUST_BLOCK == rAdj.GetOneWord());
+ switch(rAdj.GetLastBlock())
+ {
+ case SVX_ADJUST_LEFT: nLBSelect = 0; break;
+
+ case SVX_ADJUST_CENTER: nLBSelect = 1; break;
+
+ case SVX_ADJUST_BLOCK: nLBSelect = 2; break;
+ default: ; //prevent warning
+ }
+ }
+ else
+ {
+ aLeft.Check( FALSE );
+ aRight.Check( FALSE );
+ aCenter.Check( FALSE );
+ aJustify.Check( FALSE );
+ }
+ aLastLineLB.SelectEntryPos(nLBSelect);
+
+ USHORT nHtmlMode = GetHtmlMode_Impl(rSet);
+ if(nHtmlMode & HTMLMODE_ON)
+ {
+ aLastLineLB.Hide();
+ aLastLineFT.Hide();
+ aExpandCB.Hide();
+ if(!(nHtmlMode & HTMLMODE_FULL_STYLES|HTMLMODE_FIRSTLINE) )
+ aJustify.Disable();
+ aSnapToGridCB.Show(FALSE);
+ }
+ _nWhich = GetWhich(SID_ATTR_PARA_SNAPTOGRID);
+ eItemState = rSet.GetItemState( _nWhich );
+ if ( eItemState >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxParaGridItem& rSnap = (const SvxParaGridItem&)rSet.Get( _nWhich );
+ aSnapToGridCB.Check(rSnap.GetValue());
+ }
+
+ _nWhich = GetWhich( SID_PARA_VERTALIGN );
+ eItemState = rSet.GetItemState( _nWhich );
+
+ if ( eItemState >= SFX_ITEM_AVAILABLE )
+ {
+ aVertAlignLB.Show();
+ aVertAlignFL.Show();
+ aVertAlignFT.Show();
+
+ const SvxParaVertAlignItem& rAlign = (const SvxParaVertAlignItem&)rSet.Get( _nWhich );
+ aVertAlignLB.SelectEntryPos(rAlign.GetValue());
+ }
+
+ _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
+ //text direction
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( _nWhich ) )
+ {
+ const SvxFrameDirectionItem& rFrameDirItem = ( const SvxFrameDirectionItem& ) rSet.Get( _nWhich );
+ aTextDirectionLB.SelectEntryValue( (SvxFrameDirection)rFrameDirItem.GetValue() );
+ aTextDirectionLB.SaveValue();
+ }
+
+ aSnapToGridCB.SaveValue();
+ aVertAlignLB.SaveValue();
+ aLeft.SaveValue();
+ aRight.SaveValue();
+ aCenter.SaveValue();
+ aJustify.SaveValue();
+ aLastLineLB.SaveValue();
+ aExpandCB.SaveValue();
+
+ UpdateExample_Impl(TRUE);
+}
+
+/*-----------------17.01.97 08.06-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SvxParaAlignTabPage, AlignHdl_Impl, RadioButton*, EMPTYARG )
+{
+ BOOL bJustify = aJustify.IsChecked();
+ aLastLineFT.Enable(bJustify);
+ aLastLineLB.Enable(bJustify);
+ aExpandCB.Enable(bJustify);
+ UpdateExample_Impl(FALSE);
+ return 0;
+}
+
+IMPL_LINK( SvxParaAlignTabPage, LastLineHdl_Impl, ListBox*, EMPTYARG )
+{
+ UpdateExample_Impl(FALSE);
+ return 0;
+}
+
+IMPL_LINK( SvxParaAlignTabPage, TextDirectionHdl_Impl, ListBox*, EMPTYARG )
+{
+ SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue();
+ switch ( eDir )
+ {
+ // check the default alignment for this text direction
+ case FRMDIR_HORI_LEFT_TOP : aLeft.Check( TRUE ); break;
+ case FRMDIR_HORI_RIGHT_TOP : aRight.Check( TRUE ); break;
+ case FRMDIR_ENVIRONMENT : /* do nothing */ break;
+ default:
+ {
+ DBG_ERRORFILE( "SvxParaAlignTabPage::TextDirectionHdl_Impl(): other directions not supported" );
+ }
+ }
+
+ return 0;
+}
+
+/*-----------------16.01.97 19.34-------------------
+
+--------------------------------------------------*/
+void SvxParaAlignTabPage::UpdateExample_Impl( BOOL bAll )
+{
+ if ( aLeft.IsChecked() )
+ aExampleWin.SetAdjust( SVX_ADJUST_LEFT );
+ else if ( aRight.IsChecked() )
+ aExampleWin.SetAdjust( SVX_ADJUST_RIGHT );
+ else if ( aCenter.IsChecked() )
+ aExampleWin.SetAdjust( SVX_ADJUST_CENTER );
+ else if ( aJustify.IsChecked() )
+ {
+ aExampleWin.SetAdjust( SVX_ADJUST_BLOCK );
+ SvxAdjust eLastBlock = SVX_ADJUST_LEFT;
+ USHORT nLBPos = aLastLineLB.GetSelectEntryPos();
+ if(nLBPos == 1)
+ eLastBlock = SVX_ADJUST_CENTER;
+ else if(nLBPos == 2)
+ eLastBlock = SVX_ADJUST_BLOCK;
+ aExampleWin.SetLastLine( eLastBlock );
+ }
+
+ aExampleWin.Draw( bAll );
+}
+/*-----------------17.01.97 08.04-------------------
+ Erweiterungen fuer den Blocksatz einschalten
+--------------------------------------------------*/
+void SvxParaAlignTabPage::EnableJustifyExt()
+{
+ aLastLineFT.Show();
+ aLastLineLB.Show();
+ aExpandCB .Show();
+ SvtLanguageOptions aCJKOptions;
+ if(aCJKOptions.IsAsianTypographyEnabled())
+ aSnapToGridCB.Show();
+
+}
+//add CHINA001 begin
+void SvxParaAlignTabPage::PageCreated (SfxAllItemSet aSet)
+{
+ SFX_ITEMSET_ARG (&aSet,pBoolItem,SfxBoolItem,SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_False);
+ if (pBoolItem)
+ if(pBoolItem->GetValue())
+ EnableJustifyExt();
+}
+//end of CHINA001
+// class SvxExtParagraphTabPage ------------------------------------------
+
+SfxTabPage* SvxExtParagraphTabPage::Create( Window* pParent,
+ const SfxItemSet& rSet )
+{
+ return new SvxExtParagraphTabPage( pParent, rSet );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxExtParagraphTabPage::FillItemSet( SfxItemSet& rOutSet )
+{
+ BOOL bModified = FALSE;
+ USHORT _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
+ const TriState eHyphenState = aHyphenBox.GetState();
+ const SfxPoolItem* pOld = GetOldItem( rOutSet, SID_ATTR_PARA_HYPHENZONE );
+
+ if ( eHyphenState != aHyphenBox.GetSavedValue() ||
+ aExtHyphenBeforeBox.IsValueModified() ||
+ aExtHyphenAfterBox.IsValueModified() ||
+ aMaxHyphenEdit.IsValueModified() )
+ {
+ SvxHyphenZoneItem aHyphen(
+ (const SvxHyphenZoneItem&)GetItemSet().Get( _nWhich ) );
+ aHyphen.SetHyphen( eHyphenState == STATE_CHECK );
+
+ if ( eHyphenState == STATE_CHECK )
+ {
+ aHyphen.GetMinLead() = (BYTE)aExtHyphenBeforeBox.GetValue();
+ aHyphen.GetMinTrail() = (BYTE)aExtHyphenAfterBox.GetValue();
+ }
+ aHyphen.GetMaxHyphens() = (BYTE)aMaxHyphenEdit.GetValue();
+
+ if ( !pOld ||
+ !( *(SvxHyphenZoneItem*)pOld == aHyphen ) ||
+ eHyphenState != aHyphenBox.GetSavedValue())
+ {
+ rOutSet.Put( aHyphen );
+ bModified |= TRUE;
+ }
+ }
+
+ if (aPagenumEdit.IsEnabled() && aPagenumEdit.IsValueModified())
+ {
+ SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM,
+ (USHORT)aPagenumEdit.GetValue() );
+
+ pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGENUM );
+
+ if ( !pOld || ( (const SfxUInt16Item*)pOld )->GetValue() != aPageNum.GetValue() )
+ {
+ rOutSet.Put( aPageNum );
+ bModified |= TRUE;
+ }
+ }
+
+ // Seitenumbruch
+
+ TriState eState = aApplyCollBtn.GetState();
+ FASTBOOL bIsPageModel = FALSE;
+
+ _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
+ String sPage;
+ if ( eState != aApplyCollBtn.GetSavedValue() ||
+ ( STATE_CHECK == eState &&
+ aApplyCollBox.GetSelectEntryPos() != aApplyCollBox.GetSavedValue() ) )
+ {
+ if ( eState == STATE_CHECK )
+ {
+ sPage = aApplyCollBox.GetSelectEntry();
+ bIsPageModel = 0 != sPage.Len();
+ }
+ pOld = GetOldItem( rOutSet, SID_ATTR_PARA_MODEL );
+
+ if ( !pOld || ( (const SvxPageModelItem*)pOld )->GetValue() != sPage )
+ {
+ rOutSet.Put( SvxPageModelItem( sPage, FALSE, _nWhich ) );
+ bModified |= TRUE;
+ }
+ else
+ bIsPageModel = FALSE;
+ }
+ else if(STATE_CHECK == eState && aApplyCollBtn.IsEnabled())
+ bIsPageModel = TRUE;
+ else
+ rOutSet.Put( SvxPageModelItem( sPage, FALSE, _nWhich ) );
+
+ _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
+
+ if ( bIsPageModel )
+ // wird PageModel eingeschaltet, dann immer PageBreak ausschalten
+ rOutSet.Put( SvxFmtBreakItem( SVX_BREAK_NONE, _nWhich ) );
+ else
+ {
+ eState = aPageBreakBox.GetState();
+ SfxItemState eModelState = GetItemSet().GetItemState(SID_ATTR_PARA_MODEL, FALSE);
+
+ if ( (eModelState == SFX_ITEM_SET && STATE_CHECK == aPageBreakBox.GetState()) ||
+ eState != aPageBreakBox.GetSavedValue() ||
+ aBreakTypeLB.GetSelectEntryPos() != aBreakTypeLB.GetSavedValue() ||
+ aBreakPositionLB.GetSelectEntryPos() != aBreakPositionLB.GetSavedValue() )
+ {
+ const SvxFmtBreakItem rOldBreak(
+ (const SvxFmtBreakItem&)GetItemSet().Get( _nWhich ));
+ SvxFmtBreakItem aBreak(rOldBreak.GetBreak(), rOldBreak.Which());
+
+ switch ( eState )
+ {
+ case STATE_CHECK:
+ {
+ BOOL bBefore = aBreakPositionLB.GetSelectEntryPos() == 0;
+
+ if ( aBreakTypeLB.GetSelectEntryPos() == 0 )
+ {
+ 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 );
+ }
+ break;
+ }
+
+ case STATE_NOCHECK:
+ aBreak.SetValue( SVX_BREAK_NONE );
+ break;
+ default: ; //prevent warning
+ }
+ pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGEBREAK );
+
+ if ( eState != aPageBreakBox.GetSavedValue() ||
+ !pOld || !( *(const SvxFmtBreakItem*)pOld == aBreak ) )
+ {
+ bModified |= TRUE;
+ rOutSet.Put( aBreak );
+ }
+ }
+ }
+
+
+ // Absatztrennung
+ _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
+ eState = aKeepTogetherBox.GetState();
+
+ if ( eState != aKeepTogetherBox.GetSavedValue() )
+ {
+ pOld = GetOldItem( rOutSet, SID_ATTR_PARA_SPLIT );
+
+ if ( !pOld || ( (const SvxFmtSplitItem*)pOld )->GetValue() !=
+ ( eState == STATE_NOCHECK ) )
+ {
+ rOutSet.Put( SvxFmtSplitItem( eState == STATE_NOCHECK, _nWhich ) );
+ bModified |= TRUE;
+ }
+ }
+
+ // Absaetze zusammenhalten
+ _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
+ eState = aKeepParaBox.GetState();
+
+ if ( eState != aKeepParaBox.GetSavedValue() )
+ {
+ pOld = GetOldItem( rOutSet, SID_ATTR_PARA_KEEP );
+
+ // hat sich der Status geaendert, muss immer geputtet werden
+ rOutSet.Put( SvxFmtKeepItem( eState == STATE_CHECK, _nWhich ) );
+ bModified |= TRUE;
+ }
+
+ // Witwen und Waisen
+ _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
+ eState = aWidowBox.GetState();
+
+ if ( eState != aWidowBox.GetSavedValue() ||
+ aWidowRowNo.IsValueModified() )
+ {
+ SvxWidowsItem rItem( eState == STATE_CHECK ?
+ (BYTE)aWidowRowNo.GetValue() : 0, _nWhich );
+ pOld = GetOldItem( rOutSet, SID_ATTR_PARA_WIDOWS );
+
+ if ( eState != aWidowBox.GetSavedValue() || !pOld || !( *(const SvxWidowsItem*)pOld == rItem ) )
+ {
+ rOutSet.Put( rItem );
+ bModified |= TRUE;
+ }
+ }
+
+ _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
+ eState = aOrphanBox.GetState();
+
+ if ( eState != aOrphanBox.GetSavedValue() ||
+ aOrphanRowNo.IsValueModified() )
+ {
+ SvxOrphansItem rItem( eState == STATE_CHECK ?
+ (BYTE)aOrphanRowNo.GetValue() : 0, _nWhich );
+ pOld = GetOldItem( rOutSet, SID_ATTR_PARA_ORPHANS );
+
+ if ( eState != aOrphanBox.GetSavedValue() ||
+ !pOld ||
+ !( *(const SvxOrphansItem*)pOld == rItem ) )
+ {
+ rOutSet.Put( rItem );
+ bModified |= TRUE;
+ }
+ }
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxExtParagraphTabPage::Reset( const SfxItemSet& rSet )
+{
+ USHORT _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
+ SfxItemState eItemState = rSet.GetItemState( _nWhich );
+
+ BOOL bItemAvailable = eItemState >= SFX_ITEM_AVAILABLE;
+ BOOL bIsHyphen = FALSE;
+ if( !bHtmlMode && bItemAvailable )
+ {
+ const SvxHyphenZoneItem& rHyphen =
+ (const SvxHyphenZoneItem&)rSet.Get( _nWhich );
+ aHyphenBox.EnableTriState( FALSE );
+
+ bIsHyphen = rHyphen.IsHyphen();
+ aHyphenBox.SetState( bIsHyphen ? STATE_CHECK : STATE_NOCHECK );
+
+ aExtHyphenBeforeBox.SetValue( rHyphen.GetMinLead() );
+ aExtHyphenAfterBox.SetValue( rHyphen.GetMinTrail() );
+ aMaxHyphenEdit.SetValue( rHyphen.GetMaxHyphens() );
+ }
+ else
+ {
+ aHyphenBox.SetState( STATE_DONTKNOW );
+ }
+ BOOL bEnable = bItemAvailable && bIsHyphen;
+ aExtHyphenBeforeBox.Enable(bEnable);
+ aExtHyphenAfterBox.Enable(bEnable);
+ aBeforeText.Enable(bEnable);
+ aAfterText.Enable(bEnable);
+ aMaxHyphenLabel.Enable(bEnable);
+ aMaxHyphenEdit.Enable(bEnable);
+
+ _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM );
+
+ if ( rSet.GetItemState(_nWhich) >= SFX_ITEM_AVAILABLE )
+ {
+ const USHORT nPageNum =
+ ( (const SfxUInt16Item&)rSet.Get( _nWhich ) ).GetValue();
+ aPagenumEdit.SetValue( nPageNum );
+ }
+
+ if ( bPageBreak )
+ {
+ // zuerst PageModel behandeln
+ _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
+ BOOL bIsPageModel = FALSE;
+ eItemState = rSet.GetItemState( _nWhich );
+
+ if ( eItemState >= SFX_ITEM_SET )
+ {
+ aApplyCollBtn.EnableTriState( FALSE );
+
+ const SvxPageModelItem& rModel =
+ (const SvxPageModelItem&)rSet.Get( _nWhich );
+ String aStr( rModel.GetValue() );
+
+ if ( aStr.Len() &&
+ aApplyCollBox.GetEntryPos( aStr ) != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aApplyCollBox.SelectEntry( aStr );
+ aApplyCollBtn.SetState( STATE_CHECK );
+ bIsPageModel = TRUE;
+
+ aPageBreakBox.Enable();
+ aPageBreakBox.EnableTriState( FALSE );
+ aBreakTypeFT.Enable();
+ aBreakTypeLB.Enable();
+ aBreakPositionFT.Enable();
+ aBreakPositionLB.Enable();
+ aApplyCollBtn.Enable();
+ aPageBreakBox.SetState( STATE_CHECK );
+
+ //select page break
+ aBreakTypeLB.SelectEntryPos(0);
+ //select break before
+ aBreakPositionLB.SelectEntryPos(0);
+ }
+ else
+ {
+ aApplyCollBox.SetNoSelection();
+ aApplyCollBtn.SetState( STATE_NOCHECK );
+ }
+ }
+ else if ( SFX_ITEM_DONTCARE == eItemState )
+ {
+ aApplyCollBtn.EnableTriState( TRUE );
+ aApplyCollBtn.SetState( STATE_DONTKNOW );
+ aApplyCollBox.SetNoSelection();
+ }
+ else
+ {
+ aApplyCollBtn.Enable(FALSE);
+ aApplyCollBox.Enable(FALSE);
+ aPagenumEdit.Enable(FALSE);
+ aPagenumText.Enable(FALSE);
+ }
+//!!! ApplyCollClickHdl_Impl( &aApplyCollBtn );
+
+ if ( !bIsPageModel )
+ {
+ _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
+ eItemState = rSet.GetItemState( _nWhich );
+
+ if ( eItemState >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxFmtBreakItem& rPageBreak =
+ (const SvxFmtBreakItem&)rSet.Get( _nWhich );
+
+ SvxBreak eBreak = (SvxBreak)rPageBreak.GetValue();
+
+ // PageBreak nicht ueber CTRL-RETURN,
+ // dann kann CheckBox frei gegeben werden
+ aPageBreakBox.Enable();
+ aPageBreakBox.EnableTriState( FALSE );
+ aBreakTypeFT.Enable();
+ aBreakTypeLB.Enable();
+ aBreakPositionFT.Enable();
+ aBreakPositionLB.Enable();
+
+ aPageBreakBox.SetState( STATE_CHECK );
+
+ BOOL _bEnable = eBreak != SVX_BREAK_NONE &&
+ eBreak != SVX_BREAK_COLUMN_BEFORE &&
+ eBreak != SVX_BREAK_COLUMN_AFTER;
+ aApplyCollBtn.Enable(_bEnable);
+ if(!_bEnable)
+ {
+ aApplyCollBox.Enable(_bEnable);
+ aPagenumEdit.Enable(_bEnable);
+ }
+
+ if ( eBreak == SVX_BREAK_NONE )
+ aPageBreakBox.SetState( STATE_NOCHECK );
+
+ USHORT nType = 0; // selection position in break type ListBox : Page
+ USHORT nPosition = 0; // selection position in break position ListBox : Before
+ switch ( eBreak )
+ {
+ case SVX_BREAK_PAGE_BEFORE:
+ break;
+ case SVX_BREAK_PAGE_AFTER:
+ nPosition = 1;
+ break;
+ case SVX_BREAK_COLUMN_BEFORE:
+ nType = 1;
+ break;
+ case SVX_BREAK_COLUMN_AFTER:
+ nType = 1;
+ nPosition = 1;
+ break;
+ default: ;//prevent warning
+ }
+ aBreakTypeLB.SelectEntryPos(nType);
+ aBreakPositionLB.SelectEntryPos(nPosition);
+ }
+ else if ( SFX_ITEM_DONTCARE == eItemState )
+ aPageBreakBox.SetState( STATE_DONTKNOW );
+ else
+ {
+ aPageBreakBox.Enable(FALSE);
+ aBreakTypeFT.Enable(FALSE);
+ aBreakTypeLB.Enable(FALSE);
+ aBreakPositionFT.Enable(FALSE);
+ aBreakPositionLB.Enable(FALSE);
+ }
+ }
+
+ PageBreakPosHdl_Impl( &aBreakPositionLB );
+ PageBreakHdl_Impl( &aPageBreakBox );
+ }
+
+ _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
+ eItemState = rSet.GetItemState( _nWhich );
+
+ if ( eItemState >= SFX_ITEM_AVAILABLE )
+ {
+ aKeepParaBox.EnableTriState( FALSE );
+ const SvxFmtKeepItem& rKeep =
+ (const SvxFmtKeepItem&)rSet.Get( _nWhich );
+
+ if ( rKeep.GetValue() )
+ aKeepParaBox.SetState( STATE_CHECK );
+ else
+ aKeepParaBox.SetState( STATE_NOCHECK );
+ }
+ else if ( SFX_ITEM_DONTCARE == eItemState )
+ aKeepParaBox.SetState( STATE_DONTKNOW );
+ else
+ aKeepParaBox.Enable(FALSE);
+
+ _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
+ eItemState = rSet.GetItemState( _nWhich );
+
+ if ( eItemState >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxFmtSplitItem& rSplit =
+ (const SvxFmtSplitItem&)rSet.Get( _nWhich );
+ aKeepTogetherBox.EnableTriState( FALSE );
+
+ if ( !rSplit.GetValue() )
+ aKeepTogetherBox.SetState( STATE_CHECK );
+ else
+ {
+ aKeepTogetherBox.SetState( STATE_NOCHECK );
+
+ // Witwen und Waisen
+ aWidowBox.Enable();
+ _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
+ SfxItemState eTmpState = rSet.GetItemState( _nWhich );
+
+ if ( eTmpState >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxWidowsItem& rWidow =
+ (const SvxWidowsItem&)rSet.Get( _nWhich );
+ aWidowBox.EnableTriState( FALSE );
+ const USHORT nLines = rWidow.GetValue();
+
+ BOOL _bEnable = nLines > 0;
+ aWidowRowNo.SetValue( aWidowRowNo.Normalize( nLines ) );
+ aWidowBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK);
+ aWidowRowNo.Enable(_bEnable);
+ aWidowRowLabel.Enable(_bEnable);
+
+ }
+ else if ( SFX_ITEM_DONTCARE == eTmpState )
+ aWidowBox.SetState( STATE_DONTKNOW );
+ else
+ aWidowBox.Enable(FALSE);
+
+ aOrphanBox.Enable();
+ _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
+ eTmpState = rSet.GetItemState( _nWhich );
+
+ if ( eTmpState >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxOrphansItem& rOrphan =
+ (const SvxOrphansItem&)rSet.Get( _nWhich );
+ const USHORT nLines = rOrphan.GetValue();
+ aOrphanBox.EnableTriState( FALSE );
+
+ BOOL _bEnable = nLines > 0;
+ aOrphanBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK);
+ aOrphanRowNo.SetValue( aOrphanRowNo.Normalize( nLines ) );
+ aOrphanRowNo.Enable(_bEnable);
+ aOrphanRowLabel.Enable(_bEnable);
+
+ }
+ else if ( SFX_ITEM_DONTCARE == eTmpState )
+ aOrphanBox.SetState( STATE_DONTKNOW );
+ else
+ aOrphanBox.Enable(FALSE);
+ }
+ }
+ else if ( SFX_ITEM_DONTCARE == eItemState )
+ aKeepTogetherBox.SetState( STATE_DONTKNOW );
+ else
+ aKeepTogetherBox.Enable(FALSE);
+
+ // damit alles richt enabled wird
+ KeepTogetherHdl_Impl( 0 );
+ WidowHdl_Impl( 0 );
+ OrphanHdl_Impl( 0 );
+
+ aHyphenBox.SaveValue();
+ aExtHyphenBeforeBox.SaveValue();
+ aExtHyphenAfterBox.SaveValue();
+ aMaxHyphenEdit.SaveValue();
+ aPageBreakBox.SaveValue();
+ aBreakPositionLB.SaveValue();
+ aBreakTypeLB.SaveValue();
+ aApplyCollBtn.SaveValue();
+ aApplyCollBox.SaveValue();
+ aPagenumEdit.SaveValue();
+ aKeepTogetherBox.SaveValue();
+ aKeepParaBox.SaveValue();
+ aWidowBox.SaveValue();
+ aOrphanBox.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+int SvxExtParagraphTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxExtParagraphTabPage::DisablePageBreak()
+{
+ bPageBreak = FALSE;
+ aPageBreakBox.Enable(FALSE);
+ aBreakTypeLB.RemoveEntry(0);
+ aBreakPositionFT.Enable(FALSE);
+ aBreakPositionLB.Enable(FALSE);
+ aApplyCollBtn.Enable(FALSE);
+ aApplyCollBox.Enable(FALSE);
+ aPagenumEdit.Enable(FALSE);
+}
+
+// -----------------------------------------------------------------------
+
+SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window* pParent, const SfxItemSet& rAttr ) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_EXT_PARAGRAPH ), rAttr ),
+
+ aHyphenBox ( this, SVX_RES( BTN_HYPHEN ) ),
+ aBeforeText ( this, SVX_RES( FT_HYPHENBEFORE ) ),
+ aExtHyphenBeforeBox ( this, SVX_RES( ED_HYPHENBEFORE ) ),
+ aAfterText ( this, SVX_RES( FT_HYPHENAFTER ) ),
+ aExtHyphenAfterBox ( this, SVX_RES( ED_HYPHENAFTER ) ),
+ aMaxHyphenLabel ( this, SVX_RES( FT_MAXHYPH ) ),
+ aMaxHyphenEdit ( this, SVX_RES( ED_MAXHYPH ) ),
+ aExtFL ( this, SVX_RES( FL_HYPHEN ) ),
+ aBreaksFL ( this, SVX_RES( FL_BREAKS ) ),
+ aPageBreakBox ( this, SVX_RES( BTN_PAGEBREAK ) ),
+ aBreakTypeFT ( this, SVX_RES( FT_BREAKTYPE )),
+ aBreakTypeLB ( this, SVX_RES( LB_BREAKTYPE )),
+ aBreakPositionFT ( this, SVX_RES( FT_BREAKPOSITION )),
+ aBreakPositionLB ( this, SVX_RES( LB_BREAKPOSITION )),
+// aPageBox ( this, SVX_RES( BTN_BREAKPAGE ) ),
+// aColumnBox ( this, SVX_RES( BTN_BREAKCOLUMN ) ),
+// aBeforeBox ( this, SVX_RES( BTN_PAGEBREAKBEFORE ) ),
+// aAfterBox ( this, SVX_RES( BTN_PAGEBREAKAFTER ) ),
+ aApplyCollBtn ( this, SVX_RES( BTN_PAGECOLL ) ),
+ aApplyCollBox ( this, SVX_RES( LB_PAGECOLL ) ),
+ aPagenumText ( this, SVX_RES( FT_PAGENUM ) ),
+ aPagenumEdit ( this, SVX_RES( ED_PAGENUM ) ),
+ aExtendFL ( this, SVX_RES( FL_OPTIONS ) ),
+ aKeepTogetherBox ( this, SVX_RES( BTN_KEEPTOGETHER ) ),
+ aKeepParaBox ( this, SVX_RES( CB_KEEPTOGETHER ) ),
+ aOrphanBox ( this, SVX_RES( BTN_ORPHANS ) ),
+ aOrphanRowNo ( this, SVX_RES( ED_ORPHANS ) ),
+ aOrphanRowLabel ( this, SVX_RES( FT_ORPHANS ) ),
+ aWidowBox ( this, SVX_RES( BTN_WIDOWS ) ),
+ aWidowRowNo ( this, SVX_RES( ED_WIDOWS ) ),
+ aWidowRowLabel ( this, SVX_RES( FT_WIDOWS ) ),
+ bPageBreak ( TRUE ),
+ bHtmlMode ( FALSE ),
+ nStdPos ( 0 )
+{
+ FreeResource();
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ aHyphenBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, HyphenClickHdl_Impl ) );
+ aPageBreakBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, PageBreakHdl_Impl ) );
+ aKeepTogetherBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, KeepTogetherHdl_Impl ) );
+ aWidowBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, WidowHdl_Impl ) );
+ aOrphanBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, OrphanHdl_Impl ) );
+ aApplyCollBtn.SetClickHdl( LINK( this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl ) );
+ aBreakTypeLB.SetSelectHdl( LINK( this, SvxExtParagraphTabPage, PageBreakTypeHdl_Impl ) );
+ aBreakPositionLB.SetSelectHdl( LINK( this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl ) );
+
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+ if ( pSh )
+ {
+ SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool();
+ pPool->SetSearchMask( SFX_STYLE_FAMILY_PAGE );
+ SfxStyleSheetBase* pStyle = pPool->First();
+ String aStdName;
+
+ while( pStyle )
+ {
+ if ( aStdName.Len() == 0 )
+ // first style == standard style
+ aStdName = pStyle->GetName();
+ aApplyCollBox.InsertEntry( pStyle->GetName() );
+ pStyle = pPool->Next();
+ }
+ nStdPos = aApplyCollBox.GetEntryPos( aStdName );
+ }
+
+ USHORT nHtmlMode = GetHtmlMode_Impl( rAttr );
+ if ( nHtmlMode & HTMLMODE_ON )
+ {
+ bHtmlMode = TRUE;
+ aHyphenBox .Enable(FALSE);
+ aBeforeText .Enable(FALSE);
+ aExtHyphenBeforeBox .Enable(FALSE);
+ aAfterText .Enable(FALSE);
+ aExtHyphenAfterBox .Enable(FALSE);
+ aMaxHyphenLabel .Enable(FALSE);
+ aMaxHyphenEdit .Enable(FALSE);
+ aExtFL .Enable(FALSE);
+ aPagenumText .Enable(FALSE);
+ aPagenumEdit .Enable(FALSE);
+ // no column break in HTML
+ aBreakTypeLB.RemoveEntry(1);
+ }
+}
+
+// -----------------------------------------------------------------------
+
+__EXPORT SvxExtParagraphTabPage::~SvxExtParagraphTabPage()
+{
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxExtParagraphTabPage::GetRanges()
+{
+ return pExtRanges;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxExtParagraphTabPage, PageBreakHdl_Impl, TriStateBox *, EMPTYARG )
+{
+ switch ( aPageBreakBox.GetState() )
+ {
+ case STATE_CHECK:
+ aBreakTypeFT.Enable();
+ aBreakTypeLB.Enable();
+ aBreakPositionFT.Enable();
+ aBreakPositionLB.Enable();
+
+ if ( 0 == aBreakTypeLB.GetSelectEntryPos()&&
+ 0 == aBreakPositionLB.GetSelectEntryPos() )
+ {
+ aApplyCollBtn.Enable();
+
+ BOOL bEnable = STATE_CHECK == aApplyCollBtn.GetState() &&
+ aApplyCollBox.GetEntryCount();
+ aApplyCollBox.Enable(bEnable);
+ if(!bHtmlMode)
+ {
+ aPagenumText.Enable(bEnable);
+ aPagenumEdit.Enable(bEnable);
+ }
+ }
+ break;
+
+ case STATE_NOCHECK:
+ case STATE_DONTKNOW:
+ aApplyCollBtn.SetState( STATE_NOCHECK );
+ aApplyCollBtn.Enable(FALSE);
+ aApplyCollBox.Enable(FALSE);
+ aPagenumText.Enable(FALSE);
+ aPagenumEdit.Enable(FALSE);
+ aBreakTypeFT.Enable(FALSE);
+ aBreakTypeLB.Enable(FALSE);
+ aBreakPositionFT.Enable(FALSE);
+ aBreakPositionLB.Enable(FALSE);
+ break;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxExtParagraphTabPage, KeepTogetherHdl_Impl, TriStateBox *, EMPTYARG )
+{
+ BOOL bEnable = aKeepTogetherBox.GetState() == STATE_NOCHECK;
+ aWidowBox.Enable(bEnable);
+ aOrphanBox.Enable(bEnable);
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxExtParagraphTabPage, WidowHdl_Impl, TriStateBox *, EMPTYARG )
+{
+ switch ( aWidowBox.GetState() )
+ {
+ case STATE_CHECK:
+ aWidowRowNo.Enable();
+ aWidowRowLabel.Enable();
+ aKeepTogetherBox.Enable(FALSE);
+ break;
+
+ case STATE_NOCHECK:
+ if ( aOrphanBox.GetState() == STATE_NOCHECK )
+ aKeepTogetherBox.Enable();
+
+ // kein break
+ case STATE_DONTKNOW:
+ aWidowRowNo.Enable(FALSE);
+ aWidowRowLabel.Enable(FALSE);
+ break;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxExtParagraphTabPage, OrphanHdl_Impl, TriStateBox *, EMPTYARG )
+{
+ switch( aOrphanBox.GetState() )
+ {
+ case STATE_CHECK:
+ aOrphanRowNo.Enable();
+ aOrphanRowLabel.Enable();
+ aKeepTogetherBox.Enable(FALSE);
+ break;
+
+ case STATE_NOCHECK:
+ if ( aWidowBox.GetState() == STATE_NOCHECK )
+ aKeepTogetherBox.Enable();
+
+ // kein break
+ case STATE_DONTKNOW:
+ aOrphanRowNo.Enable(FALSE);
+ aOrphanRowLabel.Enable(FALSE);
+ break;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxExtParagraphTabPage, HyphenClickHdl_Impl, TriStateBox *, EMPTYARG )
+{
+
+ BOOL bEnable = aHyphenBox.GetState() == STATE_CHECK;
+ aBeforeText.Enable(bEnable);
+ aExtHyphenBeforeBox.Enable(bEnable);
+ aAfterText.Enable(bEnable);
+ aExtHyphenAfterBox.Enable(bEnable);
+ aMaxHyphenLabel.Enable(bEnable);
+ aMaxHyphenEdit.Enable(bEnable);
+ aHyphenBox.SetState( bEnable ? STATE_CHECK : STATE_NOCHECK);
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, TriStateBox *, EMPTYARG )
+{
+ BOOL bEnable = FALSE;
+ if ( aApplyCollBtn.GetState() == STATE_CHECK &&
+ aApplyCollBox.GetEntryCount() )
+ {
+ bEnable = TRUE;
+ aApplyCollBox.SelectEntryPos( nStdPos );
+ }
+ else
+ {
+ aApplyCollBox.SetNoSelection();
+ }
+ aApplyCollBox.Enable(bEnable);
+ if(!bHtmlMode)
+ {
+ aPagenumText.Enable(bEnable);
+ aPagenumEdit.Enable(bEnable);
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxExtParagraphTabPage, PageBreakPosHdl_Impl, ListBox *, pListBox )
+{
+ if ( 0 == pListBox->GetSelectEntryPos() )
+ {
+ aApplyCollBtn.Enable();
+
+ BOOL bEnable = aApplyCollBtn.GetState() == STATE_CHECK &&
+ aApplyCollBox.GetEntryCount();
+
+ aApplyCollBox.Enable(bEnable);
+ if(!bHtmlMode)
+ {
+ aPagenumText.Enable(bEnable);
+ aPagenumEdit.Enable(bEnable);
+ }
+ }
+ else if ( 1 == pListBox->GetSelectEntryPos() )
+ {
+ aApplyCollBtn.SetState( STATE_NOCHECK );
+ aApplyCollBtn.Enable(FALSE);
+ aApplyCollBox.Enable(FALSE);
+ aPagenumText.Enable(FALSE);
+ aPagenumEdit.Enable(FALSE);
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxExtParagraphTabPage, PageBreakTypeHdl_Impl, ListBox *, pListBox )
+{
+ //column break or break break after
+ USHORT nBreakPos = aBreakPositionLB.GetSelectEntryPos();
+ if ( pListBox->GetSelectEntryPos() == 1 || 1 == nBreakPos)
+ {
+ aApplyCollBtn.SetState( STATE_NOCHECK );
+ aApplyCollBtn.Enable(FALSE);
+ aApplyCollBox.Enable(FALSE);
+ aPagenumText.Enable(FALSE);
+ aPagenumEdit.Enable(FALSE);
+ }
+ else
+ PageBreakPosHdl_Impl( &aBreakPositionLB );
+ return 0;
+}
+//Add CHINA001 begin
+void SvxExtParagraphTabPage::PageCreated(SfxAllItemSet aSet)
+{
+
+
+ SFX_ITEMSET_ARG (&aSet,pDisablePageBreakItem,SfxBoolItem,SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_False);
+
+ if (pDisablePageBreakItem)
+ if ( pDisablePageBreakItem->GetValue())
+ DisablePageBreak();
+
+
+}
+//end of Add CHINA001
+/*-- 29.11.00 11:36:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SvxAsianTabPage::SvxAsianTabPage( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SVX_RES( RID_SVXPAGE_PARA_ASIAN ), rSet),
+ aOptionsFL( this, SVX_RES(FL_AS_OPTIONS )),
+ aForbiddenRulesCB( this, SVX_RES(CB_AS_FORBIDDEN )),
+ aHangingPunctCB( this, SVX_RES(CB_AS_HANG_PUNC )),
+ aScriptSpaceCB( this, SVX_RES(CB_AS_SCRIPT_SPACE ))//,
+
+{
+ FreeResource();
+
+ Link aLink = LINK( this, SvxAsianTabPage, ClickHdl_Impl );
+ aHangingPunctCB.SetClickHdl( aLink );
+ aScriptSpaceCB.SetClickHdl( aLink );
+ aForbiddenRulesCB.SetClickHdl( aLink );
+
+}
+/*-- 29.11.00 11:36:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SvxAsianTabPage::~SvxAsianTabPage()
+{
+}
+/*-- 29.11.00 11:36:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage* SvxAsianTabPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxAsianTabPage(pParent, rSet);
+}
+/*-- 29.11.00 11:36:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+USHORT* SvxAsianTabPage::GetRanges()
+{
+ static USHORT pRanges[] =
+ {
+ SID_ATTR_PARA_SCRIPTSPACE, SID_ATTR_PARA_FORBIDDEN_RULES,
+ 0
+ };
+ return pRanges;
+}
+/*-- 29.11.00 11:36:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SvxAsianTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ BOOL bRet = FALSE;
+ SfxItemPool* pPool = rSet.GetPool();
+ if(aScriptSpaceCB.IsChecked() != aScriptSpaceCB.GetSavedValue())
+ {
+ SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
+ pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone();
+ pNewItem->SetValue(aScriptSpaceCB.IsChecked());
+ rSet.Put(*pNewItem);
+ delete pNewItem;
+ bRet = TRUE;
+ }
+ if(aHangingPunctCB.IsChecked() != aHangingPunctCB.GetSavedValue())
+ {
+ SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
+ pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone();
+ pNewItem->SetValue(aHangingPunctCB.IsChecked());
+ rSet.Put(*pNewItem);
+ delete pNewItem;
+ bRet = TRUE;
+ }
+ if(aForbiddenRulesCB.IsChecked() != aForbiddenRulesCB.GetSavedValue())
+ {
+ SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
+ pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone();
+ pNewItem->SetValue(aForbiddenRulesCB.IsChecked());
+ rSet.Put(*pNewItem);
+ delete pNewItem;
+ bRet = TRUE;
+ }
+ return bRet;
+}
+/*-- 29.11.00 11:36:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_SetBox(const SfxItemSet& rSet, USHORT nSlotId, TriStateBox& rBox)
+{
+ USHORT _nWhich = rSet.GetPool()->GetWhich(nSlotId);
+ SfxItemState eState = rSet.GetItemState(_nWhich, TRUE);
+ if(!eState || eState == SFX_ITEM_DISABLED )
+ rBox.Enable(FALSE);
+ else if(eState >= SFX_ITEM_AVAILABLE)
+ {
+ rBox.EnableTriState( FALSE );
+ rBox.Check(((const SfxBoolItem&)rSet.Get(_nWhich)).GetValue());
+ }
+ else
+ rBox.SetState( STATE_DONTKNOW );
+ rBox.SaveValue();
+}
+
+
+void SvxAsianTabPage::Reset( const SfxItemSet& rSet )
+{
+ lcl_SetBox(rSet, SID_ATTR_PARA_FORBIDDEN_RULES, aForbiddenRulesCB );
+// lcl_SetBox(rSet, , aAllowWordBreakCB );
+ lcl_SetBox(rSet, SID_ATTR_PARA_HANGPUNCTUATION, aHangingPunctCB );
+
+
+ //character distance not yet available
+// lcl_SetBox(rSet, , aPuntuationCB );
+ lcl_SetBox(rSet, SID_ATTR_PARA_SCRIPTSPACE, aScriptSpaceCB );
+// lcl_SetBox(rSet, , aAdjustNumbersCB );
+// aAllowWordBreakCB .Enable(FALSE);
+// aPuntuationCB .Enable(FALSE);
+// aAdjustNumbersCB .Enable(FALSE);
+}
+/* -----------------------------19.12.00 12:59--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SvxAsianTabPage, ClickHdl_Impl, TriStateBox*, pBox )
+{
+ pBox->EnableTriState( FALSE );
+ return 0;
+}
diff --git a/cui/source/tabpages/paragrph.hrc b/cui/source/tabpages/paragrph.hrc
new file mode 100644
index 000000000000..6b0b835b07e3
--- /dev/null
+++ b/cui/source/tabpages/paragrph.hrc
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * 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: paragrph.hrc,v $
+ * $Revision: 1.19 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PARAGRPH_HRC
+#define _SVX_PARAGRPH_HRC
+
+// StandardTabPage ----------------------------------------------------------
+
+#define FT_LEFTINDENT 10
+#define ED_LEFTINDENT 11
+#define FT_FLINEINDENT 12
+#define ED_FLINEINDENT 13
+#define FT_RIGHTINDENT 14
+#define ED_RIGHTINDENT 15
+#define FL_INDENT 16
+
+#define FT_TOPDIST 20
+#define ED_TOPDIST 21
+#define FT_BOTTOMDIST 22
+#define ED_BOTTOMDIST 23
+#define FL_DIST 24
+
+#define BTN_LEFTALIGN 30
+#define BTN_RIGHTALIGN 31
+#define BTN_CENTERALIGN 32
+#define BTN_JUSTIFYALIGN 33
+#define FL_ALIGN 34
+#define FL_VERTALIGN 35
+#define LB_VERTALIGN 36
+#define FL_VERTEX 37
+#define CB_SNAP 38
+#define FT_VERTALIGN 39
+
+
+#define LB_LINEDIST 40
+#define FT_LINEDIST 41
+#define ED_LINEDISTPERCENT 42
+#define ED_LINEDISTMETRIC 43
+#define FL_LINEDIST 44
+#define WN_EXAMPLE 46
+
+#define CB_AUTO 48
+#define FT_LASTLINE 49
+#define LB_LASTLINE 50
+#define CB_EXPAND 51
+#define ST_LINEDIST_ABS 52
+#define ST_LEFTALIGN_ASIAN 53
+#define ST_RIGHTALIGN_ASIAN 54
+
+// ExtendedTabPage ----------------------------------------------------------
+
+#define BTN_HYPHEN 50
+#define ED_HYPHENBEFORE 52
+#define FT_HYPHENBEFORE 53
+#define ED_HYPHENAFTER 55
+#define FT_HYPHENAFTER 56
+#define FL_HYPHEN 57
+
+#define BTN_PAGEBREAK 60
+#define FT_BREAKTYPE 61
+#define LB_BREAKTYPE 62
+#define FT_BREAKPOSITION 63
+#define LB_BREAKPOSITION 64
+#define BTN_PAGECOLL 65
+#define LB_PAGECOLL 66
+#define BTN_KEEPTOGETHER 67
+#define BTN_WIDOWS 68
+#define ED_WIDOWS 69
+#define FT_WIDOWS 70
+#define BTN_ORPHANS 71
+#define ED_ORPHANS 72
+#define FT_ORPHANS 73
+#define FL_OPTIONS 74
+#define FT_PAGENUM 75
+#define ED_PAGENUM 76
+#define FL_BREAKS 77
+
+#define CB_KEEPTOGETHER 80
+#define FT_MAXHYPH 81
+#define ED_MAXHYPH 83
+
+#define CB_REGISTER 84
+#define FL_REGISTER 85
+#define FL_PROPERTIES 90
+#define FT_TEXTDIRECTION 91
+#define LB_TEXTDIRECTION 92
+
+
+//asian typography
+#define FL_AS_OPTIONS 1
+#define CB_AS_HANG_PUNC 2
+
+#define CB_AS_FORBIDDEN 4
+
+#define CB_AS_SCRIPT_SPACE 7
+
+#endif
+
diff --git a/cui/source/tabpages/paragrph.src b/cui/source/tabpages/paragrph.src
new file mode 100644
index 000000000000..996242dccbda
--- /dev/null
+++ b/cui/source/tabpages/paragrph.src
@@ -0,0 +1,734 @@
+/*************************************************************************
+ *
+ * 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: paragrph.src,v $
+ * $Revision: 1.85 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "paragrph.hrc"
+
+ // RID_SVXPAGE_STD_PARAGRAPH ---------------------------------------------
+TabPage RID_SVXPAGE_STD_PARAGRAPH
+{
+ HelpId = HID_FORMAT_PARAGRAPH_STD ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Indents and Spacing" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_LEFTINDENT
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Before text" ;
+ };
+ MetricField ED_LEFTINDENT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 135 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_RIGHTINDENT
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "After text" ;
+ };
+ MetricField ED_RIGHTINDENT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 135 , 30 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_FLINEINDENT
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "~First line" ;
+ Left = TRUE ;
+ };
+ MetricField ED_FLINEINDENT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 135 , 46 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -9999 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = -9999 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_AUTO
+ {
+ Pos = MAP_APPFONT ( 12 , 61 ) ;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Automatic" ;
+ };
+ FixedLine FL_INDENT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 173 , 8 ) ;
+ Text [ en-US ] = "Indent" ;
+ };
+ FixedText FT_TOPDIST
+ {
+ Pos = MAP_APPFONT ( 12 , 90 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Ab~ove paragraph" ;
+ };
+ MetricField ED_TOPDIST
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 135 , 88 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_BOTTOMDIST
+ {
+ Pos = MAP_APPFONT ( 12 , 104 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Below paragraph" ;
+ };
+ MetricField ED_BOTTOMDIST
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 135 , 104 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedLine FL_DIST
+ {
+ Pos = MAP_APPFONT ( 6 , 77 ) ;
+ Size = MAP_APPFONT ( 173 , 8 ) ;
+ Text [ en-US ] = "Spacing" ;
+ };
+ ListBox LB_LINEDIST
+ {
+ Pos = MAP_APPFONT ( 12 , 133 ) ;
+ Size = MAP_APPFONT ( 55 , 72 ) ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Single" ; Default ; > ;
+ < "1.5 lines" ; Default ; > ;
+ < "Double" ; Default ; > ;
+ < "Proportional" ; Default ; > ;
+ < "At least" ; Default ; > ;
+ < "Leading" ; Default ; > ;
+ };
+ };
+ String ST_LINEDIST_ABS
+ {
+ Text [ en-US ] = "Fixed" ;
+ };
+ FixedText FT_LINEDIST
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 70 , 135 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "of" ;
+ Left = TRUE ;
+ };
+ MetricField ED_LINEDISTPERCENT
+ {
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 135 , 133 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 50 ;
+ Maximum = 200 ;
+ Value = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ First = 50 ;
+ Last = 200 ;
+ SpinSize = 1 ;
+ };
+ MetricField ED_LINEDISTMETRIC
+ {
+ Disable = TRUE ;
+ Border = TRUE ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 135 , 133 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedLine FL_LINEDIST
+ {
+ Pos = MAP_APPFONT ( 6 , 122 ) ;
+ Size = MAP_APPFONT ( 173 , 8 ) ;
+ Text [ en-US ] = "Line spacing" ;
+ };
+ Window WN_EXAMPLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 185 , 7 ) ;
+ Size = MAP_APPFONT ( 68 , 112 ) ;
+ };
+ CheckBox CB_REGISTER
+ {
+ Pos = MAP_APPFONT ( 12 , 162 ) ;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "A~ctivate" ;
+ };
+ FixedLine FL_REGISTER
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 173 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Register-true" ;
+ };
+
+};
+ // RID_SVXPAGE_ALIGN_PARAGRAPH ---------------------------------------------
+TabPage RID_SVXPAGE_ALIGN_PARAGRAPH
+{
+ HelpId = HID_FORMAT_PARAGRAPH_ALIGN ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Alignment" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_ALIGN
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 173 , 8 ) ;
+ Text [ en-US ] = "Options" ;
+ Group = TRUE ;
+ };
+ RadioButton BTN_LEFTALIGN
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 161 , 10 ) ;
+ Text [ en-US ] = "~Left" ;
+ Group = TRUE ;
+ };
+ RadioButton BTN_RIGHTALIGN
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 161 , 10 ) ;
+ Text [ en-US ] = "Righ~t" ;
+ };
+ RadioButton BTN_CENTERALIGN
+ {
+ Pos = MAP_APPFONT ( 12 , 42 ) ;
+ Size = MAP_APPFONT ( 161 , 10 ) ;
+ Text [ en-US ] = "~Center" ;
+ };
+ RadioButton BTN_JUSTIFYALIGN
+ {
+ Pos = MAP_APPFONT ( 12 , 56 ) ;
+ Size = MAP_APPFONT ( 161 , 10 ) ;
+ Text [ en-US ] = "Justified" ;
+ };
+ String ST_LEFTALIGN_ASIAN
+ {
+ Text [ en-US ] = "~Left/Top" ;
+ };
+ String ST_RIGHTALIGN_ASIAN
+ {
+ Text [ en-US ] = "Righ~t/Bottom" ;
+ };
+ FixedText FT_LASTLINE
+ {
+ Pos = MAP_APPFONT ( 20 , 72 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Last line" ;
+ };
+ ListBox LB_LASTLINE
+ {
+ Pos = MAP_APPFONT ( 105 , 70 ) ;
+ Size = MAP_APPFONT ( 70 , 50 ) ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Default" ; Default ; > ;
+ < "Left" ; Default ; > ;
+ < "Centered" ; Default ; > ;
+ < "Justified"; Default; > ;
+ };
+ };
+ CheckBox CB_EXPAND
+ {
+ Pos = MAP_APPFONT ( 20 , 86 ) ;
+ Size = MAP_APPFONT ( 153 , 10 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Expand single word" ;
+ };
+ CheckBox CB_SNAP
+ {
+ Pos = MAP_APPFONT ( 20 , 100 ) ;
+ Size = MAP_APPFONT ( 153 , 10 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Snap to text grid (if active)";
+ };
+ Window WN_EXAMPLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 185 , 7 ) ;
+ Size = MAP_APPFONT ( 68 , 112 ) ;
+ };
+ FixedLine FL_VERTALIGN
+ {
+ Pos = MAP_APPFONT ( 6 , 122 ) ;
+ Size = MAP_APPFONT ( 173 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Text-to-text";
+ };
+ FixedText FT_VERTALIGN
+ {
+ Pos = MAP_APPFONT ( 12 , 135 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "~Alignment";
+ };
+ ListBox LB_VERTALIGN
+ {
+ Pos = MAP_APPFONT ( 105 , 133 ) ;
+ Size = MAP_APPFONT ( 70 , 50 ) ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Automatic" ; > ;
+ < "Base line" ; > ;
+ < "Top" ; > ;
+ < "Middle" ; > ;
+ < "Bottom" ; > ;
+ };
+ };
+ FixedLine FL_PROPERTIES
+ {
+ Pos = MAP_APPFONT ( 6 , 154 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Properties";
+ };
+ FixedText FT_TEXTDIRECTION
+ {
+ Pos = MAP_APPFONT ( 12 , 167 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Text ~direction";
+ };
+ ListBox LB_TEXTDIRECTION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 105 , 165 ) ;
+ Size = MAP_APPFONT ( 146 , 50 ) ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ };
+};
+ // RID_SVXPAGE_EXT_PARAGRAPH ---------------------------------------------
+TabPage RID_SVXPAGE_EXT_PARAGRAPH
+{
+ HelpId = HID_FORMAT_PARAGRAPH_EXT ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Text Flow" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ TriStateBox BTN_HYPHEN
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "A~utomatically" ;
+ };
+ NumericField ED_HYPHENBEFORE
+ {
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 21 , 26 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 2 ;
+ Maximum = 9 ;
+ Value = 2 ;
+ First = 2 ;
+ Last = 9 ;
+ };
+ FixedText FT_HYPHENBEFORE
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 48 , 29 ) ;
+ Size = MAP_APPFONT ( 200 , 8 ) ;
+ Text [ en-US ] = "C~haracters at line end" ;
+ Left = TRUE ;
+ };
+ NumericField ED_HYPHENAFTER
+ {
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 21 , 41 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 2 ;
+ Maximum = 9 ;
+ Value = 2 ;
+ First = 2 ;
+ Last = 9 ;
+ };
+ FixedText FT_HYPHENAFTER
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 48 , 43 ) ;
+ Size = MAP_APPFONT ( 200 , 8 ) ;
+ Text [ en-US ] = "Cha~racters at line begin" ;
+ Left = TRUE ;
+ };
+ FixedText FT_MAXHYPH
+ {
+ Pos = MAP_APPFONT ( 48 , 57 ) ;
+ Size = MAP_APPFONT ( 200 , 8 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "~Maximum number of consecutive hyphens" ;
+ };
+ NumericField ED_MAXHYPH
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 21 , 55 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ Last = 99 ;
+ };
+ FixedLine FL_HYPHEN
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Hyphenation" ;
+ };
+ FixedLine FL_OPTIONS
+ { // is moved one section deeper to not raise unnecessary translations
+ Pos = MAP_APPFONT ( 6 , 116 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Options" ;
+ Group = TRUE ;
+ };
+ FixedLine FL_BREAKS
+ {
+ Pos = MAP_APPFONT ( 6 , 73 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Breaks" ;
+ Group = TRUE ;
+ };
+ TriStateBox BTN_PAGEBREAK
+ {
+ // Disable = TRUE;
+ Pos = MAP_APPFONT ( 12 , 86 ) ;
+ Size = MAP_APPFONT ( 61 , 10 ) ;
+ Text [ en-US ] = "Insert" ;
+ Group = TRUE ;
+ };
+ FixedText FT_BREAKTYPE
+ {
+ Pos = MAP_APPFONT ( 75 , 86 ) ;
+ Size = MAP_APPFONT ( 21 , 10 ) ;
+ Text [ en-US ] = "~Type";
+ };
+ ListBox LB_BREAKTYPE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 98 , 84 ) ;
+ Size = MAP_APPFONT ( 61 , 50 ) ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Page" ; 0; > ;
+ < "Column" ; 1; > ;
+ };
+ };
+ FixedText FT_BREAKPOSITION
+ {
+ Pos = MAP_APPFONT ( 163 , 86 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Right = TRUE;
+ Text [ en-US ] = "Position";
+ };
+ ListBox LB_BREAKPOSITION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 211 , 84 ) ;
+ Size = MAP_APPFONT ( 40 , 50 ) ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Before" ; 0; > ;
+ < "After" ; 1; > ;
+ };
+ };
+ TriStateBox BTN_PAGECOLL
+ {
+ // Disable = TRUE;
+ Pos = MAP_APPFONT (21 , 100 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ Text [ en-US ] = "With Page St~yle" ;
+ Group = TRUE ;
+ };
+ ListBox LB_PAGECOLL
+ {
+ // Disable = TRUE;
+ Pos = MAP_APPFONT ( 98 , 98 ) ;
+ Size = MAP_APPFONT ( 61 , 50 ) ;
+ DropDown = TRUE ;
+ Sort = TRUE;
+ };
+ FixedText FT_PAGENUM
+ {
+ Pos = MAP_APPFONT ( 163 , 100 ) ;
+ Size = MAP_APPFONT ( 45 , 8 ) ;
+ Right = TRUE ;
+ Text [ en-US ] = "Page ~number" ;
+ };
+ NumericField ED_PAGENUM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 211 , 98 ) ;
+ Size = MAP_APPFONT ( 26 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ Value = 0 ;
+ First = 0 ;
+ Last = 9999 ;
+ };
+ TriStateBox BTN_KEEPTOGETHER
+ {
+ Pos = MAP_APPFONT ( 12 , 127 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "~Do not split paragraph" ;
+ Group = TRUE ;
+ };
+ TriStateBox CB_KEEPTOGETHER
+ {
+ Pos = MAP_APPFONT ( 12, 141 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "~Keep with next paragraph" ;
+ };
+ TriStateBox BTN_ORPHANS
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 155 ) ;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "~Orphan control";
+ };
+ NumericField ED_ORPHANS
+ {
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 134 , 153 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 2 ;
+ Maximum = 9 ;
+ Value = 2 ;
+ First = 2 ;
+ Last = 9 ;
+ };
+ FixedText FT_ORPHANS
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 161 , 155 ) ;
+ Size = MAP_APPFONT ( 86 , 8 ) ;
+ Text [ en-US ] = "Lines" ;
+ Left = TRUE ;
+ };
+ TriStateBox BTN_WIDOWS
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 169 ) ;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "~Widow control";
+ };
+ NumericField ED_WIDOWS
+ {
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 134 , 167 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 2 ;
+ Maximum = 9 ;
+ Value = 2 ;
+ First = 2 ;
+ Last = 9 ;
+ };
+ FixedText FT_WIDOWS
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 161 , 169 ) ;
+ Size = MAP_APPFONT ( 86 , 8 ) ;
+ Text [ en-US ] = "Lines" ;
+ Left = TRUE ;
+ };
+};
+/*-- 29.11.00 11:36:24---------------------------------------------------
+ Asian typography
+ -----------------------------------------------------------------------*/
+TabPage RID_SVXPAGE_PARA_ASIAN
+{
+ HelpId = HID_SVXPAGE_PARA_ASIAN ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Asian Typography";
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_AS_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Line change";
+ };
+ TriStateBox CB_AS_FORBIDDEN
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "Apply list of forbidden characters to the beginning and end of lines";
+ };
+ TriStateBox CB_AS_HANG_PUNC
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "Allow hanging punctuation";
+ };
+ TriStateBox CB_AS_SCRIPT_SPACE
+ {
+ Pos = MAP_APPFONT ( 12 , 42 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "Apply spacing between Asian, Latin and Complex text";
+ };
+};
+
+// ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
new file mode 100644
index 000000000000..09168fc9a16e
--- /dev/null
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -0,0 +1,1973 @@
+/*************************************************************************
+ *
+ * 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: swpossizetabpage.cxx,v $
+ * $Revision: 1.17 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <cstddef>
+#include <swpossizetabpage.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/anchorid.hxx>
+#include <svl/aeitem.hxx>
+#include <svx/swframevalidation.hxx>
+#include <tools/debug.hxx>
+#include <svx/dialogs.hrc>
+#include <swpossizetabpage.hrc>
+#include <svx/htmlmode.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/rectenum.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::text;
+#define SwFPos SvxSwFramePosString
+
+struct FrmMap
+{
+ SvxSwFramePosString::StringId eStrId;
+ SvxSwFramePosString::StringId eMirrorStrId;
+ short nAlign;
+ ULONG nLBRelations;
+};
+
+struct RelationMap
+{
+ SvxSwFramePosString::StringId eStrId;
+ SvxSwFramePosString::StringId eMirrorStrId;
+ ULONG nLBRelation;
+ short nRelation;
+};
+struct StringIdPair_Impl
+{
+ SvxSwFramePosString::StringId eHori;
+ SvxSwFramePosString::StringId eVert;
+};
+
+#define LB_FRAME 0x00000001L // paragraph text area
+#define LB_PRTAREA 0x00000002L // paragraph text area + indents
+#define LB_VERT_FRAME 0x00000004L // vertical paragraph text area
+#define LB_VERT_PRTAREA 0x00000008L // vertical paragraph text area + indents
+#define LB_REL_FRM_LEFT 0x00000010L // left paragraph margin
+#define LB_REL_FRM_RIGHT 0x00000020L // right paragraph margin
+
+#define LB_REL_PG_LEFT 0x00000040L // left page margin
+#define LB_REL_PG_RIGHT 0x00000080L // right page margin
+#define LB_REL_PG_FRAME 0x00000100L // complete page
+#define LB_REL_PG_PRTAREA 0x00000200L // text area of page
+
+#define LB_FLY_REL_PG_LEFT 0x00000400L // left frame margin
+#define LB_FLY_REL_PG_RIGHT 0x00000800L // right frame margin
+#define LB_FLY_REL_PG_FRAME 0x00001000L // complete frame
+#define LB_FLY_REL_PG_PRTAREA 0x00002000L // frame interior
+
+#define LB_REL_BASE 0x00010000L // as char, relative to baseline
+#define LB_REL_CHAR 0x00020000L // as char, relative to character
+#define LB_REL_ROW 0x00040000L // as char, relative to line
+
+// 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, RelOrientation::FRAME},
+ {SwFPos::PRTAREA, SwFPos::PRTAREA, LB_PRTAREA, RelOrientation::PRINT_AREA},
+ {SwFPos::REL_PG_LEFT, SwFPos::MIR_REL_PG_LEFT, LB_REL_PG_LEFT, RelOrientation::PAGE_LEFT},
+ {SwFPos::REL_PG_RIGHT, SwFPos::MIR_REL_PG_RIGHT, LB_REL_PG_RIGHT, RelOrientation::PAGE_RIGHT},
+ {SwFPos::REL_FRM_LEFT, SwFPos::MIR_REL_FRM_LEFT, LB_REL_FRM_LEFT, RelOrientation::FRAME_LEFT},
+ {SwFPos::REL_FRM_RIGHT, SwFPos::MIR_REL_FRM_RIGHT, LB_REL_FRM_RIGHT, RelOrientation::FRAME_RIGHT},
+ {SwFPos::REL_PG_FRAME, SwFPos::REL_PG_FRAME, LB_REL_PG_FRAME, RelOrientation::PAGE_FRAME},
+ {SwFPos::REL_PG_PRTAREA,SwFPos::REL_PG_PRTAREA, LB_REL_PG_PRTAREA, RelOrientation::PAGE_PRINT_AREA},
+ {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, RelOrientation::CHAR},
+
+ {SwFPos::FLY_REL_PG_LEFT, SwFPos::FLY_MIR_REL_PG_LEFT, LB_FLY_REL_PG_LEFT, RelOrientation::PAGE_LEFT},
+ {SwFPos::FLY_REL_PG_RIGHT, SwFPos::FLY_MIR_REL_PG_RIGHT, LB_FLY_REL_PG_RIGHT, RelOrientation::PAGE_RIGHT},
+ {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_REL_PG_FRAME, RelOrientation::PAGE_FRAME},
+ {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_REL_PG_PRTAREA, RelOrientation::PAGE_PRINT_AREA},
+
+ {SwFPos::REL_BORDER, SwFPos::REL_BORDER, LB_VERT_FRAME, RelOrientation::FRAME},
+ {SwFPos::REL_PRTAREA, SwFPos::REL_PRTAREA, LB_VERT_PRTAREA, RelOrientation::PRINT_AREA},
+
+ // OD 10.11.2003 #i22305#
+ {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_VERT_FRAME, RelOrientation::FRAME},
+ {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_VERT_PRTAREA, RelOrientation::PRINT_AREA},
+
+ // OD 11.11.2003 #i22341#
+ {SwFPos::REL_LINE, SwFPos::REL_LINE, LB_VERT_LINE, RelOrientation::TEXT_LINE}
+};
+
+static RelationMap __FAR_DATA aAsCharRelationMap[] =
+{
+ {SwFPos::REL_BASE, SwFPos::REL_BASE, LB_REL_BASE, RelOrientation::FRAME},
+ {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, RelOrientation::FRAME},
+ {SwFPos::REL_ROW, SwFPos::REL_ROW, LB_REL_ROW, RelOrientation::FRAME}
+};
+
+/*--------------------------------------------------------------------
+ Anchored at page
+ --------------------------------------------------------------------*/
+
+#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, HoriOrientation::LEFT, HORI_PAGE_REL},
+ {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_PAGE_REL},
+ {SwFPos::CENTER_HORI,SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_PAGE_REL},
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_PAGE_REL}
+};
+
+static FrmMap __FAR_DATA aHPageHtmlMap[] =
+{
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, 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, VertOrientation::TOP, VERT_PAGE_REL},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_PAGE_REL},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_PAGE_REL},
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_PAGE_REL}
+};
+
+static FrmMap __FAR_DATA aVPageHtmlMap[] =
+{
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, LB_REL_PG_FRAME}
+};
+
+/*--------------------------------------------------------------------
+ Anchored at frame
+ --------------------------------------------------------------------*/
+
+#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, HoriOrientation::LEFT, HORI_FRAME_REL},
+ {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_FRAME_REL},
+ {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_FRAME_REL},
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_FRAME_REL}
+};
+
+static FrmMap __FAR_DATA aHFlyHtmlMap[] =
+{
+ {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, LB_FLY_REL_PG_FRAME},
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, 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_VERT_FRAME|LB_FLY_VERT_PRTAREA)
+
+static FrmMap __FAR_DATA aVFrameMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_FRAME_REL},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_FRAME_REL},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_FRAME_REL},
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_FRAME_REL}
+};
+
+static FrmMap __FAR_DATA aVFlyHtmlMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_FLY_VERT_FRAME},
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, LB_FLY_VERT_FRAME}
+};
+
+static FrmMap __FAR_DATA aVMultiSelectionMap[] =
+{
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, 0}
+};
+static FrmMap __FAR_DATA aHMultiSelectionMap[] =
+{
+ {SwFPos::FROMLEFT, SwFPos::FROMLEFT, HoriOrientation::NONE, 0}
+};
+
+/*--------------------------------------------------------------------
+ Anchored at paragraph
+ --------------------------------------------------------------------*/
+
+#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, HoriOrientation::LEFT, HORI_PARA_REL},
+ {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_PARA_REL},
+ {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_PARA_REL},
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_PARA_REL}
+};
+
+#define HTML_HORI_PARA_REL (LB_FRAME|LB_PRTAREA)
+
+static FrmMap __FAR_DATA aHParaHtmlMap[] =
+{
+ {SwFPos::LEFT, SwFPos::LEFT, HoriOrientation::LEFT, HTML_HORI_PARA_REL},
+ {SwFPos::RIGHT, SwFPos::RIGHT, HoriOrientation::RIGHT, HTML_HORI_PARA_REL}
+};
+
+static FrmMap __FAR_DATA aHParaHtmlAbsMap[] =
+{
+ {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HTML_HORI_PARA_REL},
+ {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HTML_HORI_PARA_REL}
+};
+
+
+#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, VertOrientation::TOP, VERT_PARA_REL},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_PARA_REL},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_PARA_REL},
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_PARA_REL}
+};
+
+static FrmMap __FAR_DATA aVParaHtmlMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_VERT_PRTAREA}
+};
+
+/*--------------------------------------------------------------------
+ Anchored at character
+ --------------------------------------------------------------------*/
+
+#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, HoriOrientation::LEFT, HORI_CHAR_REL},
+ {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_CHAR_REL},
+ {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_CHAR_REL},
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, 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, HoriOrientation::LEFT, HTML_HORI_CHAR_REL},
+ {SwFPos::RIGHT, SwFPos::RIGHT, HoriOrientation::RIGHT, HTML_HORI_CHAR_REL}
+};
+
+static FrmMap __FAR_DATA aHCharHtmlAbsMap[] =
+{
+ {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, LB_PRTAREA|LB_REL_CHAR},
+ {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, LB_PRTAREA},
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, 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, VertOrientation::TOP, VERT_CHAR_REL|LB_REL_CHAR},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_CHAR_REL|LB_REL_CHAR},
+ {SwFPos::BELOW, SwFPos::BELOW, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_CHAR_REL|LB_REL_CHAR},
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_CHAR_REL},
+ {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, VertOrientation::NONE, LB_REL_CHAR|LB_VERT_LINE},
+ {SwFPos::TOP, SwFPos::TOP, VertOrientation::LINE_TOP, LB_VERT_LINE},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::LINE_BOTTOM, LB_VERT_LINE},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::LINE_CENTER, LB_VERT_LINE}
+};
+
+
+static FrmMap __FAR_DATA aVCharHtmlMap[] =
+{
+ {SwFPos::BELOW, SwFPos::BELOW, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}
+};
+
+static FrmMap __FAR_DATA aVCharHtmlAbsMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_REL_CHAR},
+ {SwFPos::BELOW, SwFPos::BELOW, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}
+};
+/*--------------------------------------------------------------------
+ anchored as character
+ --------------------------------------------------------------------*/
+
+static FrmMap __FAR_DATA aVAsCharMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_REL_BASE},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, LB_REL_BASE},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, LB_REL_BASE},
+
+ {SwFPos::TOP, SwFPos::TOP, VertOrientation::CHAR_TOP, LB_REL_CHAR},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CHAR_CENTER, LB_REL_CHAR},
+
+ {SwFPos::TOP, SwFPos::TOP, VertOrientation::LINE_TOP, LB_REL_ROW},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::LINE_BOTTOM, LB_REL_ROW},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::LINE_CENTER, LB_REL_ROW},
+
+ {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, VertOrientation::NONE, LB_REL_BASE}
+};
+
+static FrmMap __FAR_DATA aVAsCharHtmlMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_REL_BASE},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, LB_REL_BASE},
+
+ {SwFPos::TOP, SwFPos::TOP, VertOrientation::CHAR_TOP, LB_REL_CHAR},
+
+ {SwFPos::TOP, SwFPos::TOP, VertOrientation::LINE_TOP, LB_REL_ROW},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::LINE_BOTTOM, LB_REL_ROW},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::LINE_CENTER, LB_REL_ROW}
+};
+/*-- 05.03.2004 15:52:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+std::size_t lcl_GetFrmMapCount(const FrmMap* pMap)
+{
+ if ( pMap )
+ {
+ std::size_t 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;
+ if( pMap == aVMultiSelectionMap)
+ return sizeof(aVMultiSelectionMap) / aSizeOf;
+ if( pMap == aHMultiSelectionMap)
+ return sizeof(aHMultiSelectionMap) / aSizeOf;
+ return sizeof(aHPageMap) / aSizeOf;
+ }
+ return 0;
+}
+/*-- 03.03.2004 12:21:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+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;
+
+ std::size_t nRelMapSize = lcl_GetFrmMapCount( _pMap );
+ for ( std::size_t nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos )
+ {
+ if ( ( !_bUseMirrorStr && _pMap[nRelMapPos].eStrId == _eStrId ) ||
+ ( _bUseMirrorStr && _pMap[nRelMapPos].eMirrorStrId == _eStrId ) )
+ {
+ nLBRelations |= _pMap[nRelMapPos].nLBRelations;
+ }
+ }
+
+ return nLBRelations;
+}
+/*-- 03.03.2004 12:21:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SvxSwPosSizeTabPage::SvxSwPosSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_SWPOSSIZE ), rInAttrs ),
+#ifdef _MSC_VER
+#pragma warning (disable : 4355)
+#endif
+ m_aSizeFL( this, SVX_RES( FL_SIZE ) ),
+ m_aWidthFT( this, SVX_RES( FT_WIDTH ) ),
+ m_aWidthMF( this, SVX_RES( MF_WIDTH ) ),
+ m_aHeightFT( this, SVX_RES( FT_HEIGHT ) ),
+ m_aHeightMF( this, SVX_RES( MF_HEIGHT ) ),
+ m_aKeepRatioCB(this,SVX_RES( CB_KEEPRATIO) ),
+ m_aSeparatorFL(this,SVX_RES( FL_SEPARATOR) ),
+
+ m_aAnchorFL( this, SVX_RES( FL_ANCHOR ) ),
+ m_aToPageRB( this, SVX_RES( RB_TOPAGE ) ),
+ m_aToParaRB( this, SVX_RES( RB_TOPARA ) ),
+ m_aToCharRB( this, SVX_RES( RB_TOCHAR ) ),
+ m_aAsCharRB( this, SVX_RES( RB_ASCHAR ) ),
+ m_aToFrameRB( this, SVX_RES( RB_TOFRAME) ),
+
+ m_aProtectionFL( this, SVX_RES( FL_PROTECTION ) ),
+ m_aPositionCB( this, SVX_RES( CB_POSITION ) ),
+ m_aSizeCB( this, SVX_RES( CB_SIZE ) ),
+
+ m_aPositionFL( this, SVX_RES( FL_POSITION ) ),
+ m_aHoriFT( this, SVX_RES( FT_HORI ) ),
+ m_aHoriLB( this, SVX_RES( LB_HORI ) ),
+ m_aHoriByFT( this, SVX_RES( FT_HORIBY ) ),
+ m_aHoriByMF( this, SVX_RES( MF_HORIBY ) ),
+ m_aHoriToFT( this, SVX_RES( FT_HORITO ) ),
+ m_aHoriToLB( this, SVX_RES( LB_HORITO ) ),
+
+ m_aHoriMirrorCB( this, SVX_RES( CB_HORIMIRROR ) ),
+
+ m_aVertFT( this, SVX_RES( FT_VERT ) ),
+ m_aVertLB( this, SVX_RES( LB_VERT ) ),
+ m_aVertByFT( this, SVX_RES( FT_VERTBY ) ),
+ m_aVertByMF( this, SVX_RES( MF_VERTBY ) ),
+ m_aVertToFT( this, SVX_RES( FT_VERTTO ) ),
+ m_aVertToLB( this, SVX_RES( LB_VERTTO ) ),
+
+ m_aFollowCB( this, SVX_RES( CB_FOLLOW ) ),
+ m_aExampleWN( this, SVX_RES( WN_EXAMPLE ) ),
+#ifdef _MSC_VER
+#pragma warning (default : 4355)
+#endif
+ m_pVMap( 0 ),
+ m_pHMap( 0 ),
+ m_pSdrView( 0 ),
+ m_nOldH(HoriOrientation::CENTER),
+ m_nOldHRel(RelOrientation::FRAME),
+ m_nOldV(VertOrientation::TOP),
+ m_nOldVRel(RelOrientation::PRINT_AREA),
+ m_fWidthHeightRatio(1.0),
+ m_nHtmlMode(0),
+ m_bHtmlMode(false),
+ m_bAtHoriPosModified(false),
+ m_bAtVertPosModified(false),
+ m_bIsVerticalFrame(false),
+ m_bPositioningDisabled(false),
+ m_bIsMultiSelection(false),
+ m_bIsInRightToLeft(false)
+{
+ FreeResource();
+ FieldUnit eDlgUnit = GetModuleFieldUnit( &rInAttrs );
+ SetFieldUnit( m_aHoriByMF, eDlgUnit, TRUE );
+ SetFieldUnit( m_aVertByMF, eDlgUnit, TRUE );
+ SetFieldUnit( m_aWidthMF , eDlgUnit, TRUE );
+ SetFieldUnit( m_aHeightMF, eDlgUnit, TRUE );
+
+ SetExchangeSupport();
+
+ Link aLk = LINK(this, SvxSwPosSizeTabPage, RangeModifyHdl);
+ m_aWidthMF. SetLoseFocusHdl( aLk );
+ m_aHeightMF. SetLoseFocusHdl( aLk );
+ m_aHoriByMF.SetLoseFocusHdl( aLk );
+ m_aVertByMF.SetLoseFocusHdl( aLk );
+ m_aFollowCB.SetClickHdl( aLk );
+
+ aLk = LINK(this, SvxSwPosSizeTabPage, ModifyHdl);
+ m_aWidthMF. SetModifyHdl( aLk );
+ m_aHeightMF. SetModifyHdl( aLk );
+ m_aHoriByMF.SetModifyHdl( aLk );
+ m_aVertByMF.SetModifyHdl( aLk );
+
+ aLk = LINK(this, SvxSwPosSizeTabPage, AnchorTypeHdl);
+ m_aToPageRB.SetClickHdl( aLk );
+ m_aToParaRB.SetClickHdl( aLk );
+ m_aToCharRB.SetClickHdl( aLk );
+ m_aAsCharRB.SetClickHdl( aLk );
+ m_aToFrameRB.SetClickHdl( aLk );
+
+ m_aHoriLB.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, PosHdl));
+ m_aVertLB. SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, PosHdl));
+
+ m_aHoriToLB.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, RelHdl));
+ m_aVertToLB.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, RelHdl));
+
+ m_aHoriMirrorCB.SetClickHdl(LINK(this, SvxSwPosSizeTabPage, MirrorHdl));
+ m_aPositionCB.SetClickHdl(LINK(this, SvxSwPosSizeTabPage, ProtectHdl));
+}
+/*-- 03.03.2004 12:21:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SvxSwPosSizeTabPage::~SvxSwPosSizeTabPage()
+{
+}
+/*-- 03.03.2004 12:21:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage* SvxSwPosSizeTabPage::Create( Window* pParent, const SfxItemSet& rSet)
+{
+ return new SvxSwPosSizeTabPage(pParent, rSet);
+}
+/*-- 05.03.2004 17:27:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+USHORT* SvxSwPosSizeTabPage::GetRanges()
+{
+ static USHORT pSwPosRanges[] =
+ {
+ SID_ATTR_TRANSFORM_POS_X,
+ SID_ATTR_TRANSFORM_POS_Y,
+ SID_ATTR_TRANSFORM_PROTECT_POS,
+ SID_ATTR_TRANSFORM_PROTECT_POS,
+ SID_ATTR_TRANSFORM_INTERN,
+ SID_ATTR_TRANSFORM_INTERN,
+ SID_ATTR_TRANSFORM_ANCHOR,
+ SID_ATTR_TRANSFORM_VERT_ORIENT,
+ SID_ATTR_TRANSFORM_WIDTH,
+ SID_ATTR_TRANSFORM_SIZE_POINT,
+ SID_ATTR_TRANSFORM_PROTECT_POS,
+ SID_ATTR_TRANSFORM_INTERN,
+ SID_ATTR_TRANSFORM_AUTOWIDTH,
+ SID_ATTR_TRANSFORM_VERT_ORIENT,
+ SID_HTML_MODE,
+ SID_HTML_MODE,
+ SID_SW_FOLLOW_TEXT_FLOW,
+ SID_SW_FOLLOW_TEXT_FLOW,
+ SID_ATTR_TRANSFORM_HORI_POSITION,
+ SID_ATTR_TRANSFORM_VERT_POSITION,
+ 0
+ };
+ return pSwPosRanges;
+}
+/*-- 03.03.2004 12:21:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SvxSwPosSizeTabPage::FillItemSet( SfxItemSet& rSet)
+{
+ bool bAnchorChanged = false;
+ short nAnchor = GetAnchorType(&bAnchorChanged);
+ BOOL bModified = FALSE;
+ if(bAnchorChanged)
+ {
+ rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR, nAnchor));
+ bModified |= TRUE;
+ }
+ if ( m_aPositionCB.GetState() != m_aPositionCB.GetSavedValue() )
+ {
+ if( m_aPositionCB.GetState() == STATE_DONTKNOW )
+ rSet.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS );
+ else
+ rSet.Put(
+ SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ),
+ m_aPositionCB.GetState() == STATE_CHECK ? TRUE : FALSE ) );
+ bModified |= TRUE;
+ }
+
+ if ( m_aSizeCB.GetState() != m_aSizeCB.GetSavedValue() )
+ {
+ if ( m_aSizeCB.GetState() == STATE_DONTKNOW )
+ rSet.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE );
+ else
+ rSet.Put(
+ SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ),
+ m_aSizeCB.GetState() == STATE_CHECK ? TRUE : FALSE ) );
+ bModified |= TRUE;
+ }
+
+ const SfxItemSet& rOldSet = GetItemSet();
+
+ if(!m_bPositioningDisabled)
+ {
+ //on multiple selections the positioning is set via SdrView
+ if(m_bIsMultiSelection)
+ {
+ if( m_aHoriByMF.IsValueModified() || m_aVertByMF.IsValueModified() )
+ {
+ long nHoriByPos =
+ static_cast<long>(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP)));
+ long nVertByPos =
+ static_cast<long>(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP)));
+
+ // Altes Rechteck mit CoreUnit
+ m_aRect = m_pSdrView->GetAllMarkedRect();
+ m_pSdrView->GetSdrPageView()->LogicToPagePos( m_aRect );
+
+ nHoriByPos += m_aAnchorPos.X();
+ nVertByPos += m_aAnchorPos.Y();
+
+ rSet.Put( SfxInt32Item( GetWhich( SID_ATTR_TRANSFORM_POS_X ), nHoriByPos ) );
+ rSet.Put( SfxInt32Item( GetWhich( SID_ATTR_TRANSFORM_POS_Y ), nVertByPos ) );
+
+ bModified |= TRUE;
+ }
+ }
+ else
+ {
+ if ( m_pHMap )
+ {
+ const SfxInt16Item& rHoriOrient =
+ static_cast<const SfxInt16Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_ORIENT));
+ const SfxInt16Item& rHoriRelation =
+ static_cast<const SfxInt16Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_RELATION));
+ const SfxInt32Item& rHoriPosition =
+ static_cast<const SfxInt32Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_POSITION)) ;
+
+ USHORT nMapPos = GetMapPos(m_pHMap, m_aHoriLB);
+ short nAlign = GetAlignment(m_pHMap, nMapPos, m_aHoriLB, m_aHoriToLB);
+ short nRel = GetRelation(m_pHMap, m_aHoriToLB);
+ const long nHoriByPos =
+ static_cast<long>(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP)));
+ if (
+ nAlign != rHoriOrient.GetValue() ||
+ nRel != rHoriRelation.GetValue() ||
+ (m_aHoriByMF.IsEnabled() && nHoriByPos != rHoriPosition.GetValue())
+ )
+ {
+ rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_ORIENT, nAlign));
+ rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_RELATION, nRel));
+ if(m_aHoriByMF.IsEnabled())
+ rSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_HORI_POSITION, nHoriByPos));
+ bModified |= TRUE;
+ }
+ }
+ if(m_aHoriMirrorCB.IsEnabled() && m_aHoriMirrorCB.IsChecked() != m_aHoriMirrorCB.GetSavedValue())
+ bModified |= 0 != rSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_HORI_MIRROR, m_aHoriMirrorCB.IsChecked()));
+
+ if ( m_pVMap )
+ {
+ const SfxInt16Item& rVertOrient =
+ static_cast<const SfxInt16Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_ORIENT));
+ const SfxInt16Item& rVertRelation =
+ static_cast<const SfxInt16Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_RELATION));
+ const SfxInt32Item& rVertPosition =
+ static_cast<const SfxInt32Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_POSITION));
+
+ USHORT nMapPos = GetMapPos(m_pVMap, m_aVertLB);
+ short nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB);
+ short nRel = GetRelation(m_pVMap, m_aVertToLB);
+ // --> OD 2004-10-21 #i34055# - convert vertical position for
+ // as-character anchored objects
+ long nVertByPos =
+ static_cast<long>(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP)));
+ if ( GetAnchorType() == TextContentAnchorType_AS_CHARACTER )
+ {
+ nVertByPos *= -1;
+ }
+ // <--
+ if ( nAlign != rVertOrient.GetValue() ||
+ nRel != rVertRelation.GetValue() ||
+ ( m_aVertByMF.IsEnabled() &&
+ nVertByPos != rVertPosition.GetValue() ) )
+ {
+ rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_ORIENT, nAlign));
+ rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_RELATION, nRel));
+ if(m_aVertByMF.IsEnabled())
+ rSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_VERT_POSITION, nVertByPos));
+ bModified |= TRUE;
+ }
+ }
+
+ // OD 19.09.2003 #i18732#
+ if(m_aFollowCB.IsChecked() != m_aFollowCB.GetSavedValue())
+ {
+ //Writer internal type - based on SfxBoolItem
+ const SfxPoolItem* pItem = GetItem( rOldSet, SID_SW_FOLLOW_TEXT_FLOW);
+ if(pItem)
+ {
+ SfxBoolItem* pFollow = static_cast<SfxBoolItem*>(pItem->Clone());
+ pFollow->SetValue(m_aFollowCB.IsChecked());
+ bModified |= 0 != rSet.Put(*pFollow);
+ delete pFollow;
+ }
+ }
+ }
+ }
+ if ( m_aWidthMF.IsValueModified() || m_aHeightMF.IsValueModified() )
+ {
+ sal_uInt32 nWidth = static_cast<sal_uInt32>(m_aWidthMF.Denormalize(m_aWidthMF.GetValue(FUNIT_TWIP)));
+ sal_uInt32 nHeight = static_cast<sal_uInt32>(m_aHeightMF.Denormalize(m_aHeightMF.GetValue(FUNIT_TWIP)));
+ rSet.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ),
+ (UINT32) nWidth ) );
+ rSet.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ),
+ (UINT32) nHeight ) );
+ //this item is required by SdrEditView::SetGeoAttrToMarked()
+ rSet.Put( SfxAllEnumItem( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT ), RP_LT ) );
+
+ bModified |= TRUE;
+ }
+
+ return bModified;
+}
+/*-- 03.03.2004 12:21:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SvxSwPosSizeTabPage::Reset( const SfxItemSet& rSet)
+{
+ const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_TRANSFORM_ANCHOR );
+ bool bInvalidateAnchor = false;
+ short nAnchorType = TextContentAnchorType_AT_PARAGRAPH;
+ if(pItem)
+ {
+ nAnchorType = static_cast<const SfxInt16Item*>(pItem)->GetValue();
+ switch(nAnchorType)
+ {
+ case TextContentAnchorType_AT_PAGE: m_aToPageRB.Check(); break;
+ case TextContentAnchorType_AT_PARAGRAPH: m_aToParaRB.Check(); break;
+ case TextContentAnchorType_AT_CHARACTER: m_aToCharRB.Check(); break;
+ case TextContentAnchorType_AS_CHARACTER: m_aAsCharRB.Check(); break;
+ case TextContentAnchorType_AT_FRAME: m_aToFrameRB.Check(); break;
+ default : bInvalidateAnchor = true;
+ }
+ m_aToPageRB.SaveValue();
+ m_aToParaRB.SaveValue();
+ m_aToCharRB.SaveValue();
+ m_aAsCharRB.SaveValue();
+ m_aToFrameRB.SaveValue();
+ }
+ if(bInvalidateAnchor)
+ {
+ m_aToPageRB.Enable( FALSE );
+ m_aToParaRB.Enable( FALSE );
+ m_aToCharRB.Enable( FALSE );
+ m_aAsCharRB.Enable( FALSE );
+ m_aToFrameRB.Enable( FALSE );
+ }
+
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_PROTECT_POS );
+ if ( pItem )
+ {
+ sal_Bool bProtected = ( ( const SfxBoolItem* )pItem )->GetValue();
+ m_aPositionCB.SetState( bProtected ? STATE_CHECK : STATE_NOCHECK );
+ m_aPositionCB.EnableTriState( FALSE );
+ m_aSizeCB.Enable( !bProtected );
+ }
+ else
+ {
+ m_aPositionCB.SetState( STATE_DONTKNOW );
+ }
+
+ m_aPositionCB.SaveValue();
+
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_PROTECT_SIZE );
+
+ if ( pItem )
+ {
+ m_aSizeCB.SetState( ( (const SfxBoolItem*)pItem )->GetValue()
+ ? STATE_CHECK : STATE_NOCHECK );
+ m_aSizeCB.EnableTriState( FALSE );
+ }
+ else
+ m_aSizeCB.SetState( STATE_DONTKNOW );
+ m_aSizeCB.SaveValue();
+
+ pItem = GetItem( rSet, SID_HTML_MODE );
+ if(pItem)
+ m_nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ m_bHtmlMode = 0 != (m_bHtmlMode & HTMLMODE_ON);
+
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT );
+ if(pItem && static_cast<const SfxBoolItem*>(pItem)->GetValue())
+ {
+ String sHLabel = m_aHoriFT.GetText();
+ m_aHoriFT.SetText(m_aVertFT.GetText());
+ m_aVertFT.SetText(sHLabel);
+ m_bIsVerticalFrame = true;
+ }
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_IN_RTL_TEXT);
+ if(pItem)
+ m_bIsInRightToLeft = static_cast<const SfxBoolItem*>(pItem)->GetValue();
+
+ pItem = GetItem( rSet, SID_SW_FOLLOW_TEXT_FLOW);
+ if(pItem)
+ {
+ const bool bFollowTextFlow =
+ static_cast<const SfxBoolItem*>(pItem)->GetValue();
+ m_aFollowCB.Check( bFollowTextFlow );
+ }
+ m_aFollowCB.SaveValue();
+
+ if(m_bHtmlMode)
+ {
+ if( 0 == (m_nHtmlMode & HTMLMODE_FULL_ABS_POS))
+ {
+ m_aHeightFT .Enable( FALSE );
+ m_aHeightMF .Enable( FALSE );
+ }
+ if( 0 == (m_nHtmlMode & HTMLMODE_SOME_ABS_POS))
+ {
+ if(GetAnchorType() == TextContentAnchorType_AT_PAGE)
+ {
+ m_aToParaRB.Check();
+ }
+ m_aToPageRB.Enable(FALSE);
+ }
+ m_aHoriMirrorCB.Show(FALSE);
+ m_aKeepRatioCB.Enable(FALSE);
+ // OD 19.09.2003 #i18732# - hide checkbox in HTML mode
+ m_aFollowCB.Show(FALSE);
+ }
+ else
+ {
+ // OD 06.11.2003 #i18732# correct enable/disable of check box 'Mirror on..'
+ m_aHoriMirrorCB.Enable(!m_aAsCharRB.IsChecked() && !m_bIsMultiSelection);
+
+ // OD 06.11.2003 #i18732# - enable/disable check box 'Follow text flow'.
+ m_aFollowCB.Enable( m_aToParaRB.IsChecked() ||
+ m_aToCharRB.IsChecked() );
+ }
+
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_WIDTH );
+ sal_Int32 nWidth = Max( pItem ? ( static_cast<const SfxUInt32Item*>(pItem)->GetValue()) : 0, (UINT32)1 );
+
+ m_aWidthMF.SetValue(m_aWidthMF.Normalize(nWidth), FUNIT_TWIP);
+
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HEIGHT );
+ sal_Int32 nHeight = Max( pItem ? ( static_cast<const SfxUInt32Item*>(pItem)->GetValue()) : 0, (UINT32)1 );
+ m_aHeightMF.SetValue(m_aHeightMF.Normalize(nHeight), FUNIT_TWIP);
+ m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0;
+
+ if(!m_bPositioningDisabled)
+ {
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_ORIENT);
+ if(pItem)
+ {
+ short nHoriOrientation = static_cast< const SfxInt16Item*>(pItem)->GetValue();
+ m_nOldH = nHoriOrientation;
+ }
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_VERT_ORIENT);
+ if(pItem)
+ {
+ short nVertOrientation = static_cast< const SfxInt16Item*>(pItem)->GetValue();
+ m_nOldV = nVertOrientation;
+ }
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_RELATION);
+ if(pItem)
+ {
+ m_nOldHRel = static_cast< const SfxInt16Item*>(pItem)->GetValue();
+ }
+
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_VERT_RELATION);
+ if(pItem)
+ {
+ m_nOldVRel = static_cast< const SfxInt16Item*>(pItem)->GetValue();
+ }
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_MIRROR);
+ if(pItem)
+ m_aHoriMirrorCB.Check(static_cast<const SfxBoolItem*>(pItem)->GetValue());
+ m_aHoriMirrorCB.SaveValue();
+
+ sal_Int32 nHoriPos = 0;
+ sal_Int32 nVertPos = 0;
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_POSITION);
+ if(pItem)
+ nHoriPos = static_cast<const SfxInt32Item*>(pItem)->GetValue();
+ pItem = GetItem( rSet, SID_ATTR_TRANSFORM_VERT_POSITION);
+ if(pItem)
+ nVertPos = static_cast<const SfxInt32Item*>(pItem)->GetValue();
+
+ InitPos(nAnchorType, m_nOldH, m_nOldHRel, m_nOldV, m_nOldVRel, nHoriPos, nVertPos);
+
+ m_aVertByMF.SaveValue();
+ m_aHoriByMF.SaveValue();
+ // OD 19.09.2003 #i18732#
+ m_aFollowCB.SaveValue();
+
+ RangeModifyHdl(&m_aWidthMF); // initially set maximum values
+ }
+}
+/*-- 03.03.2004 12:21:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SvxSwPosSizeTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if( _pSet )
+ FillItemSet( *_pSet );
+ return( LEAVE_PAGE );
+}
+/*-- 04.03.2004 09:14:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SvxSwPosSizeTabPage::EnableAnchorTypes(USHORT nAnchorEnable)
+{
+ if((nAnchorEnable & SVX_OBJ_AT_FLY))
+ m_aToFrameRB.Show();
+ if(!(nAnchorEnable & SVX_OBJ_PAGE))
+ m_aToPageRB.Enable(FALSE);
+}
+/*-- 04.03.2004 09:33:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+short SvxSwPosSizeTabPage::GetAnchorType(bool* pbHasChanged)
+{
+ short nRet = -1;
+ RadioButton* pCheckedButton = 0;
+ if(m_aToParaRB.IsEnabled())
+ {
+ if(m_aToPageRB.IsChecked())
+ {
+ nRet = TextContentAnchorType_AT_PAGE;
+ pCheckedButton = &m_aToPageRB;
+ }
+ else if(m_aToParaRB.IsChecked())
+ {
+ nRet = TextContentAnchorType_AT_PARAGRAPH;
+ pCheckedButton = &m_aToParaRB;
+ }
+ else if(m_aToCharRB.IsChecked())
+ {
+ nRet = TextContentAnchorType_AT_CHARACTER;
+ pCheckedButton = &m_aToCharRB;
+ }
+ else if(m_aAsCharRB.IsChecked())
+ {
+ nRet = TextContentAnchorType_AS_CHARACTER;
+ pCheckedButton = &m_aAsCharRB;
+ }
+ else if(m_aToFrameRB.IsChecked())
+ {
+ nRet = TextContentAnchorType_AT_FRAME;
+ pCheckedButton = &m_aToFrameRB;
+ }
+ }
+ if(pbHasChanged)
+ {
+ if(pCheckedButton)
+ *pbHasChanged = pCheckedButton->IsChecked() != pCheckedButton->GetSavedValue();
+ else
+ *pbHasChanged = false;
+ }
+ return nRet;
+}
+/*-- 05.03.2004 10:43:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SvxSwPosSizeTabPage, RangeModifyHdl, Edit *, EMPTYARG )
+{
+ if(m_bPositioningDisabled)
+ return 0;
+ SvxSwFrameValidation aVal;
+
+ aVal.nAnchorType = GetAnchorType();
+ aVal.bAutoHeight = false;
+ aVal.bAutoWidth = false;
+ aVal.bMirror = m_aHoriMirrorCB.IsChecked();
+ // OD 18.09.2003 #i18732#
+ aVal.bFollowTextFlow = m_aFollowCB.IsChecked();
+
+ if ( m_pHMap )
+ {
+ // Ausrichtung Horizontal
+ USHORT nMapPos = GetMapPos(m_pHMap, m_aHoriToLB);
+ USHORT nAlign = GetAlignment(m_pHMap, nMapPos, m_aHoriLB, m_aHoriToLB);
+ USHORT nRel = GetRelation(m_pHMap, m_aHoriToLB);
+
+ aVal.nHoriOrient = (short)nAlign;
+ aVal.nHRelOrient = (short)nRel;
+ }
+ else
+ aVal.nHoriOrient = HoriOrientation::NONE;
+
+ if ( m_pVMap )
+ {
+ // Ausrichtung Vertikal
+ USHORT nMapPos = GetMapPos(m_pVMap, m_aVertLB);
+ USHORT nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB);
+ USHORT nRel = GetRelation(m_pVMap, m_aVertToLB);
+
+ aVal.nVertOrient = (short)nAlign;
+ aVal.nVRelOrient = (short)nRel;
+ }
+ else
+ aVal.nVertOrient = VertOrientation::NONE;
+
+ const long nAtHorzPosVal =
+ static_cast<long>(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP)));
+ const long nAtVertPosVal =
+ static_cast<long>(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP)));
+
+ aVal.nHPos = nAtHorzPosVal;
+ aVal.nVPos = nAtVertPosVal;
+
+ sal_Int32 nWidth = static_cast<sal_uInt32>(m_aWidthMF. Denormalize(m_aWidthMF.GetValue(FUNIT_TWIP)));
+ sal_Int32 nHeight = static_cast<sal_uInt32>(m_aHeightMF.Denormalize(m_aHeightMF.GetValue(FUNIT_TWIP)));
+ aVal.nWidth = nWidth;
+ aVal.nHeight = nHeight;
+
+ if(m_aValidateLink.IsSet())
+ m_aValidateLink.Call(&aVal);
+
+ nWidth = aVal.nWidth;
+ nHeight = aVal.nHeight;
+
+ // Mindestbreite auch fuer Vorlage
+ m_aHeightMF.SetMin(m_aHeightMF.Normalize(aVal.nMinHeight), FUNIT_TWIP);
+ m_aWidthMF. SetMin(m_aWidthMF.Normalize(aVal.nMinWidth), FUNIT_TWIP);
+
+ sal_Int32 nMaxWidth(aVal.nMaxWidth);
+ sal_Int32 nMaxHeight(aVal.nMaxHeight);
+
+ sal_Int64 nTmp = m_aHeightMF.Normalize(nMaxHeight);
+ m_aHeightMF.SetMax(nTmp, FUNIT_TWIP);
+
+ nTmp = m_aWidthMF.Normalize(nMaxWidth);
+ m_aWidthMF.SetMax(nTmp, FUNIT_TWIP);
+
+ m_aHoriByMF.SetMin(m_aHoriByMF.Normalize(aVal.nMinHPos), FUNIT_TWIP);
+ m_aHoriByMF.SetMax(m_aHoriByMF.Normalize(aVal.nMaxHPos), FUNIT_TWIP);
+ if ( aVal.nHPos != nAtHorzPosVal )
+ m_aHoriByMF.SetValue(m_aHoriByMF.Normalize(aVal.nHPos), FUNIT_TWIP);
+
+ m_aVertByMF.SetMin(m_aVertByMF.Normalize(aVal.nMinVPos ), FUNIT_TWIP);
+ m_aVertByMF.SetMax(m_aVertByMF.Normalize(aVal.nMaxVPos), FUNIT_TWIP);
+ if ( aVal.nVPos != nAtVertPosVal )
+ m_aVertByMF.SetValue(m_aVertByMF.Normalize(aVal.nVPos), FUNIT_TWIP);
+
+ return 0;
+}
+/*-- 05.03.2004 11:12:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SvxSwPosSizeTabPage, AnchorTypeHdl, RadioButton *, EMPTYARG )
+{
+ m_aHoriMirrorCB.Enable(!m_aAsCharRB.IsChecked() && !m_bIsMultiSelection);
+
+ // OD 06.11.2003 #i18732# - enable check box 'Follow text flow' for anchor
+ // type to-paragraph' and to-character
+ m_aFollowCB.Enable( m_aToParaRB.IsChecked() || m_aToCharRB.IsChecked() );
+
+ short nId = GetAnchorType();
+
+ InitPos( nId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX);
+ RangeModifyHdl(0);
+
+ if(m_bHtmlMode)
+ {
+ PosHdl(&m_aHoriLB);
+ PosHdl(&m_aVertLB);
+ }
+ return 0;
+}
+/*-- 05.03.2004 14:20:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SvxSwPosSizeTabPage, MirrorHdl, CheckBox *, EMPTYARG )
+{
+ short nId = GetAnchorType();
+ InitPos( nId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX);
+
+ return 0;
+}
+/*-- 05.03.2004 14:20:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SvxSwPosSizeTabPage, RelHdl, ListBox *, pLB )
+{
+ BOOL bHori = pLB == &m_aHoriToLB;
+
+ UpdateExample();
+
+ if (bHori)
+ m_bAtHoriPosModified = TRUE;
+ else
+ m_bAtVertPosModified = TRUE;
+
+ // OD 12.11.2003 #i22341# - following special handling no longer needed
+ /*
+ if (!bHori && m_pVMap == aVCharMap)
+ {
+ // Ausrichtung Vertikal
+ String sEntry;
+ USHORT nMapPos = GetMapPos(m_pVMap, m_aVertLB);
+ USHORT nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB);
+ USHORT nRel = GetRelation(m_pVMap, m_aVertToLB);
+
+ if (nRel == SwFPos::REL_CHAR)
+ sEntry = m_aFramePosString.GetString(SwFPos::FROMBOTTOM);
+ else
+ sEntry = m_aFramePosString.GetString(SwFPos::FROMTOP);
+
+ USHORT nOldPos = m_aVertLB.GetSelectEntryPos();
+
+ String sName = m_aVertLB.GetEntry(m_aVertLB.GetEntryCount() - 1);
+ if (sName != sEntry)
+ {
+ m_aVertLB.RemoveEntry(m_aVertLB.GetEntryCount() - 1);
+ m_aVertLB.InsertEntry(sEntry);
+ m_aVertLB.SelectEntryPos(nOldPos);
+ }
+ }
+ */
+ if(m_bHtmlMode && TextContentAnchorType_AT_CHARACTER == GetAnchorType()) // wieder Sonderbehandlung
+ {
+ if(bHori)
+ {
+ USHORT nRel = GetRelation(m_pHMap, m_aHoriToLB);
+ if(RelOrientation::PRINT_AREA == nRel && 0 == m_aVertLB.GetSelectEntryPos())
+ {
+ m_aVertLB.SelectEntryPos(1);
+ }
+ else if(RelOrientation::CHAR == nRel && 1 == m_aVertLB.GetSelectEntryPos())
+ {
+ m_aVertLB.SelectEntryPos(0);
+ }
+ }
+ }
+ if (pLB) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde
+ RangeModifyHdl(0);
+
+ return 0;
+
+}
+/*-- 05.03.2004 14:20:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SvxSwPosSizeTabPage, PosHdl, ListBox *, pLB )
+{
+ BOOL bHori = pLB == &m_aHoriLB;
+ ListBox *pRelLB = bHori ? &m_aHoriToLB : &m_aVertToLB;
+ FixedText *pRelFT = bHori ? &m_aHoriToFT : &m_aVertToFT;
+ FrmMap *pMap = bHori ? m_pHMap : m_pVMap;
+
+
+ USHORT nMapPos = GetMapPos(pMap, *pLB);
+ USHORT nAlign = GetAlignment(pMap, nMapPos, *pLB, *pRelLB);
+
+ if (bHori)
+ {
+ BOOL bEnable = HoriOrientation::NONE == nAlign;
+ m_aHoriByMF.Enable( bEnable );
+ m_aHoriByFT.Enable( bEnable );
+ }
+ else
+ {
+ BOOL bEnable = VertOrientation::NONE == nAlign;
+ m_aVertByMF.Enable( bEnable );
+ m_aVertByFT.Enable( bEnable );
+ }
+
+ if (pLB) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde
+ RangeModifyHdl( 0 );
+
+ short 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)
+ m_bAtHoriPosModified = TRUE;
+ else
+ m_bAtVertPosModified = TRUE;
+
+ // Sonderbehandlung fuer HTML-Mode mit horz-vert-Abhaengigkeiten
+ if(m_bHtmlMode && m_nHtmlMode & HTMLMODE_SOME_ABS_POS &&
+ TextContentAnchorType_AT_CHARACTER == GetAnchorType())
+ {
+ BOOL bSet = FALSE;
+ if(bHori)
+ {
+ // rechts ist nur unterhalb erlaubt - von links nur oben
+ // von links am Zeichen -> unterhalb
+ if((HoriOrientation::LEFT == nAlign || HoriOrientation::RIGHT == nAlign) &&
+ 0 == m_aVertLB.GetSelectEntryPos())
+ {
+ if(RelOrientation::FRAME == nRel)
+ m_aVertLB.SelectEntryPos(1);
+ else
+ m_aVertLB.SelectEntryPos(0);
+ bSet = TRUE;
+ }
+ else if(HoriOrientation::LEFT == nAlign && 1 == m_aVertLB.GetSelectEntryPos())
+ {
+ m_aVertLB.SelectEntryPos(0);
+ bSet = TRUE;
+ }
+ else if(HoriOrientation::NONE == nAlign && 1 == m_aVertLB.GetSelectEntryPos())
+ {
+ m_aVertLB.SelectEntryPos(0);
+ bSet = TRUE;
+ }
+ if(bSet)
+ PosHdl(&m_aVertLB);
+ }
+ else
+ {
+ if(VertOrientation::TOP == nAlign)
+ {
+ if(1 == m_aHoriLB.GetSelectEntryPos())
+ {
+ m_aHoriLB.SelectEntryPos(0);
+ bSet = TRUE;
+ }
+ m_aHoriToLB.SelectEntryPos(1);
+ }
+ else if(VertOrientation::CHAR_BOTTOM == nAlign)
+ {
+ if(2 == m_aHoriLB.GetSelectEntryPos())
+ {
+ m_aHoriLB.SelectEntryPos(0);
+ bSet = TRUE;
+ }
+ m_aHoriToLB.SelectEntryPos(0) ;
+ }
+ if(bSet)
+ PosHdl(&m_aHoriLB);
+ }
+
+ }
+ return 0;
+}
+/*-- 05.03.2004 14:20:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SvxSwPosSizeTabPage, ModifyHdl, Edit *, pEdit )
+{
+ sal_Int64 nWidth = m_aWidthMF.Denormalize(m_aWidthMF.GetValue(FUNIT_TWIP));
+ sal_Int64 nHeight = m_aHeightMF.Denormalize(m_aHeightMF.GetValue(FUNIT_TWIP));
+ if ( m_aKeepRatioCB.IsChecked() )
+ {
+ if ( pEdit == &m_aWidthMF )
+ {
+ nHeight = sal_Int64((double)nWidth / m_fWidthHeightRatio);
+ m_aHeightMF.SetValue(m_aHeightMF.Normalize(nHeight), FUNIT_TWIP);
+ }
+ else if(pEdit == &m_aHeightMF)
+ {
+ nWidth = sal_Int64((double)nHeight * m_fWidthHeightRatio);
+ m_aWidthMF.SetValue(m_aWidthMF.Normalize(nWidth), FUNIT_TWIP);
+ }
+ }
+ m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0;
+ UpdateExample();
+ return 0;
+}
+/*-- 11.03.2004 15:40:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SvxSwPosSizeTabPage, ProtectHdl, TriStateBox *, EMPTYARG)
+{
+ m_aSizeCB.Enable(m_aPositionCB.IsEnabled() && !m_aPositionCB.IsChecked());
+ return 0;
+}
+/*-- 05.03.2004 14:20:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+short SvxSwPosSizeTabPage::GetRelation(FrmMap *, 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;
+}
+/*-- 05.03.2004 14:20:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+short SvxSwPosSizeTabPage::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;
+ std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap);
+ SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId;
+
+ for (std::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;
+}
+/*-- 05.03.2004 14:20:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+USHORT SvxSwPosSizeTabPage::GetMapPos(FrmMap *pMap, ListBox &rAlignLB)
+{
+ USHORT nMapPos = 0;
+ USHORT nLBSelPos = rAlignLB.GetSelectEntryPos();
+
+ if (nLBSelPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap)
+ {
+ std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap);
+ String sSelEntry(rAlignLB.GetSelectEntry());
+
+ for (std::size_t i = 0; i < nMapCount; i++)
+ {
+ SvxSwFramePosString::StringId eResId = pMap[i].eStrId;
+
+ String sEntry = m_aFramePosString.GetString(eResId);
+
+ if (sEntry == sSelEntry)
+ {
+ nMapPos = sal::static_int_cast< USHORT >(i);
+ break;
+ }
+ }
+ }
+ else
+ nMapPos = nLBSelPos;
+ }
+
+ return nMapPos;
+}
+/*-- 05.03.2004 14:20:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SvxSwPosSizeTabPage::InitPos(short nAnchor,
+ USHORT nH,
+ USHORT nHRel,
+ USHORT nV,
+ USHORT nVRel,
+ long nX,
+ long nY)
+{
+ USHORT nPos = m_aVertLB.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND && m_pVMap )
+ {
+ m_nOldV = m_pVMap[nPos].nAlign;
+ nPos = m_aVertToLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ m_nOldVRel = ((RelationMap *)m_aVertToLB.GetEntryData(nPos))->nRelation;
+ }
+
+ nPos = m_aHoriLB.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND && m_pHMap )
+ {
+ m_nOldH = m_pHMap[nPos].nAlign;
+
+ nPos = m_aHoriToLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ m_nOldHRel = ((RelationMap *)m_aHoriToLB.GetEntryData(nPos))->nRelation;
+ }
+
+ BOOL bEnable = TRUE;
+ if( m_bIsMultiSelection )
+ {
+ m_pVMap = aVMultiSelectionMap;
+ m_pHMap = aHMultiSelectionMap;
+ }
+ else if( nAnchor == TextContentAnchorType_AT_PAGE )
+ {
+ m_pVMap = m_bHtmlMode ? aVPageHtmlMap : aVPageMap;
+ m_pHMap = m_bHtmlMode ? aHPageHtmlMap : aHPageMap;
+ }
+ else if ( nAnchor == TextContentAnchorType_AT_FRAME )
+ {
+ // OD 19.09.2003 #i18732# - own vertical alignment map for to frame
+ // anchored objects.
+ m_pVMap = m_bHtmlMode ? aVFlyHtmlMap : aVFrameMap;
+ m_pHMap = m_bHtmlMode ? aHFlyHtmlMap : aHFrameMap;
+ }
+ else if ( nAnchor == TextContentAnchorType_AT_PARAGRAPH )
+ {
+ if(m_bHtmlMode)
+ {
+ m_pVMap = aVParaHtmlMap;
+ m_pHMap = m_nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHParaHtmlAbsMap : aHParaHtmlMap;
+ }
+ else
+ {
+ m_pVMap = aVParaMap;
+ m_pHMap = aHParaMap;
+ }
+ }
+ else if ( nAnchor == TextContentAnchorType_AT_CHARACTER )
+ {
+ if(m_bHtmlMode)
+ {
+ m_pVMap = m_nHtmlMode & HTMLMODE_SOME_ABS_POS ? aVCharHtmlAbsMap : aVCharHtmlMap;
+ m_pHMap = m_nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHCharHtmlAbsMap : aHCharHtmlMap;
+ }
+ else
+ {
+ m_pVMap = aVCharMap;
+ m_pHMap = aHCharMap;
+ }
+ }
+ else if ( nAnchor == TextContentAnchorType_AS_CHARACTER )
+ {
+ m_pVMap = m_bHtmlMode ? aVAsCharHtmlMap : aVAsCharMap;
+ m_pHMap = 0;
+ bEnable = FALSE;
+ }
+ m_aHoriLB.Enable( bEnable );
+ m_aHoriFT.Enable( bEnable );
+
+ // aktuelle Pos selektieren
+ // Horizontal
+ if ( nH == USHRT_MAX )
+ {
+ nH = m_nOldH;
+ nHRel = m_nOldHRel;
+ }
+ // OD 12.11.2003 #i22341# - pass <nHRel> as 3rd parameter to method <FillPosLB>
+ USHORT nMapPos = FillPosLB(m_pHMap, nH, nHRel, m_aHoriLB);
+ FillRelLB(m_pHMap, nMapPos, nH, nHRel, m_aHoriToLB, m_aHoriToFT);
+
+ // Vertikal
+ if ( nV == USHRT_MAX )
+ {
+ nV = m_nOldV;
+ nVRel = m_nOldVRel;
+ }
+ // OD 12.11.2003 #i22341# - pass <nVRel> as 3rd parameter to method <FillPosLB>
+ nMapPos = FillPosLB(m_pVMap, nV, nVRel, m_aVertLB);
+ FillRelLB(m_pVMap, nMapPos, nV, nVRel, m_aVertToLB, m_aVertToFT);
+
+ // Edits init
+ bEnable = nH == HoriOrientation::NONE &&
+ nAnchor != TextContentAnchorType_AS_CHARACTER;//#61359# warum nicht in Formaten&& !bFormat;
+ if (!bEnable)
+ {
+ m_aHoriByMF.SetValue( 0, FUNIT_TWIP );
+ if (nX != LONG_MAX && m_bHtmlMode)
+ m_aHoriByMF.SetModifyFlag();
+ }
+ else if(m_bIsMultiSelection)
+ {
+ m_aHoriByMF.SetValue( m_aHoriByMF.Normalize(m_aRect.Left()), FUNIT_TWIP );
+ }
+ else
+ {
+ if (nX != LONG_MAX)
+ m_aHoriByMF.SetValue( m_aHoriByMF.Normalize(nX), FUNIT_TWIP );
+ }
+ m_aHoriByFT.Enable( bEnable );
+ m_aHoriByMF.Enable( bEnable );
+
+ bEnable = nV == VertOrientation::NONE;
+ if ( !bEnable )
+ {
+ m_aVertByMF.SetValue( 0, FUNIT_TWIP );
+ if(nY != LONG_MAX && m_bHtmlMode)
+ m_aVertByMF.SetModifyFlag();
+ }
+ else if(m_bIsMultiSelection)
+ {
+ m_aVertByMF.SetValue( m_aVertByMF.Normalize(m_aRect.Top()), FUNIT_TWIP );
+ }
+ else
+ {
+ if ( nAnchor == TextContentAnchorType_AS_CHARACTER )
+ {
+ if ( nY == LONG_MAX )
+ nY = 0;
+ else
+ nY *= -1;
+ }
+ if ( nY != LONG_MAX )
+ m_aVertByMF.SetValue( m_aVertByMF.Normalize(nY), FUNIT_TWIP );
+ }
+ m_aVertByFT.Enable( bEnable );
+ m_aVertByMF.Enable( bEnable );
+ UpdateExample();
+}
+/*-- 05.03.2004 14:20:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SvxSwPosSizeTabPage::UpdateExample()
+{
+ USHORT nPos = m_aHoriLB.GetSelectEntryPos();
+ if ( m_pHMap && nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ USHORT nMapPos = GetMapPos(m_pHMap, m_aHoriLB);
+ short nAlign = GetAlignment(m_pHMap, nMapPos, m_aHoriLB, m_aHoriToLB);
+ short nRel = GetRelation(m_pHMap, m_aHoriToLB);
+
+ m_aExampleWN.SetHAlign(nAlign);
+ m_aExampleWN.SetHoriRel(nRel);
+ }
+
+ nPos = m_aVertLB.GetSelectEntryPos();
+ if ( m_pVMap && nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ USHORT nMapPos = GetMapPos(m_pVMap, m_aVertLB);
+ USHORT nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB);
+ USHORT nRel = GetRelation(m_pVMap, m_aVertToLB);
+
+ m_aExampleWN.SetVAlign(nAlign);
+ m_aExampleWN.SetVertRel(nRel);
+ }
+
+ // Size
+ long nXPos = static_cast<long>(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP)));
+ long nYPos = static_cast<long>(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP)));
+ m_aExampleWN.SetRelPos(Point(nXPos, nYPos));
+
+ m_aExampleWN.SetAnchor( GetAnchorType() );
+ m_aExampleWN.Invalidate();
+}
+/*-- 05.03.2004 14:20:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ULONG SvxSwPosSizeTabPage::FillRelLB(FrmMap *pMap, USHORT nMapPos, USHORT nAlign,
+ USHORT nRel, ListBox &rLB, FixedText &rFT)
+{
+ String sSelEntry;
+ ULONG nLBRelations = 0;
+ std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap);
+
+ rLB.Clear();
+
+ if (nMapPos < nMapCount)
+ {
+ if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap)
+ {
+ String sOldEntry(rLB.GetSelectEntry());
+ USHORT nRelCount = sizeof(aAsCharRelationMap) / sizeof(RelationMap);
+ SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId;
+
+ for (std::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, m_bIsVerticalFrame, m_bIsInRightToLeft);
+ String sEntry = m_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,
+ ( m_aHoriMirrorCB.IsChecked()
+ ? pMap[nMapPos].eMirrorStrId
+ : pMap[nMapPos].eStrId ),
+ m_aHoriMirrorCB.IsChecked() );
+ }
+ else
+ {
+ nLBRelations = pMap[nMapPos].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 sStrId1 = m_aHoriMirrorCB.IsChecked() ? aRelationMap[nRelPos].eMirrorStrId : aRelationMap[nRelPos].eStrId;
+ sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft);
+ String sEntry = m_aFramePosString.GetString(sStrId1);
+ 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 RelOrientation::FRAME: nRel = RelOrientation::PAGE_FRAME; break;
+ case RelOrientation::PRINT_AREA: nRel = RelOrientation::PAGE_PRINT_AREA; break;
+ case RelOrientation::PAGE_LEFT: nRel = RelOrientation::FRAME_LEFT; break;
+ case RelOrientation::PAGE_RIGHT: nRel = RelOrientation::FRAME_RIGHT; break;
+ case RelOrientation::FRAME_LEFT: nRel = RelOrientation::PAGE_LEFT; break;
+ case RelOrientation::FRAME_RIGHT: nRel = RelOrientation::PAGE_RIGHT; break;
+ case RelOrientation::PAGE_FRAME: nRel = RelOrientation::FRAME; break;
+ case RelOrientation::PAGE_PRINT_AREA: nRel = 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);
+ }
+ }
+ }
+
+ rLB.Enable(rLB.GetEntryCount() != 0);
+ rFT.Enable(rLB.GetEntryCount() != 0);
+
+ RelHdl(&rLB);
+
+ return nLBRelations;
+}
+/*-- 05.03.2004 14:20:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+USHORT SvxSwPosSizeTabPage::FillPosLB(FrmMap *_pMap,
+ 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
+ std::size_t nCount = ::lcl_GetFrmMapCount(_pMap);
+ for (std::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 = m_aHoriMirrorCB.IsChecked() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId;
+ eStrId = lcl_ChangeResIdToVerticalOrRTL(eStrId, m_bIsVerticalFrame, m_bIsInRightToLeft);
+ String sEntry(m_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);
+}
+/*-- 09.03.2004 15:37:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SvxSwPosSizeTabPage::SetView( const SdrView* pSdrView )
+{
+ m_pSdrView = pSdrView;
+ if(!m_pSdrView)
+ {
+ DBG_ERROR("No SdrView* set");
+ return;
+ }
+
+ // Setzen des Rechtecks und der Workingarea
+ m_aRect = m_pSdrView->GetAllMarkedRect();
+ m_pSdrView->GetSdrPageView()->LogicToPagePos( m_aRect );
+
+ // get WorkArea
+ m_aWorkArea = m_pSdrView->GetWorkArea();
+
+ // Beruecksichtigung Ankerposition (bei Writer)
+ const SdrMarkList& rMarkList = m_pSdrView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() >= 1 )
+ {
+ const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ m_aAnchorPos = pObj->GetAnchorPos();
+
+ if( m_aAnchorPos != Point(0,0) ) // -> Writer
+ {
+ for( USHORT i = 1; i < rMarkList.GetMarkCount(); i++ )
+ {
+ pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
+ if( m_aAnchorPos != pObj->GetAnchorPos() )
+ {
+ // different anchor positions -> disable positioning
+ m_aPositionFL.Enable(FALSE);
+ m_aHoriFT.Enable(FALSE);
+ m_aHoriLB.Enable(FALSE);
+ m_aHoriByFT.Enable(FALSE);
+ m_aHoriByMF.Enable(FALSE);
+ m_aHoriToFT.Enable(FALSE);
+ m_aHoriToLB.Enable(FALSE);
+ m_aHoriMirrorCB.Enable(FALSE);
+ m_aVertFT.Enable(FALSE);
+ m_aVertLB.Enable(FALSE);
+ m_aVertByFT.Enable(FALSE);
+ m_aVertByMF.Enable(FALSE);
+ m_aVertToFT.Enable(FALSE);
+ m_aVertToLB.Enable(FALSE);
+ m_aFollowCB.Enable(FALSE);
+ m_aHoriByMF.SetText(String());
+ m_aVertByMF.SetText(String());
+
+ m_bPositioningDisabled = true;
+ return;
+ }
+ }
+ }
+ Point aPt = m_aAnchorPos * -1;
+ Point aPt2 = aPt;
+
+ aPt += m_aWorkArea.TopLeft();
+ m_aWorkArea.SetPos( aPt );
+
+ aPt2 += m_aRect.TopLeft();
+ m_aRect.SetPos( aPt2 );
+ }
+
+ // this should happen via SID_ATTR_TRANSFORM_AUTOSIZE
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ SdrObjKind eKind = (SdrObjKind) pObj->GetObjIdentifier();
+ if( ( pObj->GetObjInventor() == SdrInventor ) &&
+ ( eKind==OBJ_TEXT || eKind==OBJ_TITLETEXT || eKind==OBJ_OUTLINETEXT) &&
+ ( (SdrTextObj*) pObj )->HasText() )
+ {
+ DBG_ERROR("AutoWidth/AutoHeight should be enabled");
+ }
+ }
+ else
+ m_bIsMultiSelection = true;
+
+ // use page offset and recalculate
+ Point aPt( m_pSdrView->GetSdrPageView()->GetPageOrigin() );
+
+ // Massstab
+ Fraction aUIScale = m_pSdrView->GetModel()->GetUIScale();
+
+// lcl_ScaleRect( m_aWorkArea, aUIScale );
+// lcl_ScaleRect( m_aRect, aUIScale );
+// lcl_ScalePoint( aPt, aUIScale );
+
+ // Metrik konvertieren
+// int nDigits = maMtrPosX.GetDecimalDigits();
+
+// aPt = lcl_ConvertPoint( aPt, nDigits, (MapUnit) mePoolUnit, meDlgUnit );
+// m_aWorkArea = lcl_ConvertRect( m_aWorkArea, nDigits, (MapUnit) mePoolUnit, meDlgUnit );
+// m_aRect = lcl_ConvertRect( m_aRect, nDigits, (MapUnit) mePoolUnit, meDlgUnit );
+
+ // use page offset
+// aPt *= -1;
+// aPt += m_aWorkArea.TopLeft();
+// m_aWorkArea.SetPos( aPt );
+
+ //SetMinMaxPosition();
+}
+
diff --git a/cui/source/tabpages/swpossizetabpage.hrc b/cui/source/tabpages/swpossizetabpage.hrc
new file mode 100644
index 000000000000..af4a081cb045
--- /dev/null
+++ b/cui/source/tabpages/swpossizetabpage.hrc
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * 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: swpossizetabpage.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FL_SIZE 1
+#define FT_WIDTH 2
+#define MF_WIDTH 3
+#define FT_HEIGHT 4
+#define MF_HEIGHT 5
+#define CB_KEEPRATIO 6
+#define FL_SEPARATOR 7
+#define FL_ANCHOR 8
+#define RB_TOPAGE 9
+#define RB_TOPARA 10
+#define RB_TOCHAR 11
+#define RB_ASCHAR 12
+#define RB_TOFRAME 13
+#define FL_PROTECTION 14
+#define CB_POSITION 15
+#define CB_SIZE 16
+#define FL_POSITION 17
+#define FT_HORI 18
+#define LB_HORI 19
+#define FT_HORIBY 20
+#define MF_HORIBY 21
+#define FT_HORITO 22
+#define LB_HORITO 23
+#define CB_HORIMIRROR 24
+#define FT_VERT 25
+#define LB_VERT 26
+#define FT_VERTBY 27
+#define MF_VERTBY 28
+#define FT_VERTTO 29
+#define LB_VERTTO 30
+#define CB_FOLLOW 31
+#define WN_EXAMPLE 32
diff --git a/cui/source/tabpages/swpossizetabpage.hxx b/cui/source/tabpages/swpossizetabpage.hxx
new file mode 100644
index 000000000000..911d72de1f48
--- /dev/null
+++ b/cui/source/tabpages/swpossizetabpage.hxx
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * 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: swpossizetabpage.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SWPOSSIZETABPAGE_HXX
+#define _SVX_SWPOSSIZETABPAGE_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+#include <svx/swframeposstrings.hxx>
+#include <svx/swframeexample.hxx>
+
+/*-- 01.03.2004 15:45:01---------------------------------------------------
+ SvxSwPosSizeTabPage - position and size page for Writer drawing objects
+ -----------------------------------------------------------------------*/
+struct FrmMap;
+class SdrView;
+class SvxSwPosSizeTabPage : public SfxTabPage
+{
+ using TabPage::DeactivatePage;
+
+ FixedLine m_aSizeFL;
+ FixedText m_aWidthFT;
+ MetricField m_aWidthMF;
+ FixedText m_aHeightFT;
+ MetricField m_aHeightMF;
+ CheckBox m_aKeepRatioCB;
+
+ FixedLine m_aSeparatorFL;
+
+ FixedLine m_aAnchorFL;
+ RadioButton m_aToPageRB;
+ RadioButton m_aToParaRB;
+ RadioButton m_aToCharRB;
+ RadioButton m_aAsCharRB;
+ RadioButton m_aToFrameRB;
+
+ FixedLine m_aProtectionFL;
+ TriStateBox m_aPositionCB;
+ TriStateBox m_aSizeCB;
+
+ FixedLine m_aPositionFL;
+ FixedText m_aHoriFT;
+ ListBox m_aHoriLB;
+ FixedText m_aHoriByFT;
+ MetricField m_aHoriByMF;
+ FixedText m_aHoriToFT;
+ ListBox m_aHoriToLB;
+
+ CheckBox m_aHoriMirrorCB;
+
+ FixedText m_aVertFT;
+ ListBox m_aVertLB;
+ FixedText m_aVertByFT;
+ MetricField m_aVertByMF;
+ FixedText m_aVertToFT;
+ ListBox m_aVertToLB;
+
+ CheckBox m_aFollowCB;
+
+ SvxSwFrameExample m_aExampleWN;
+
+ Link m_aValidateLink;
+
+ //'string provider'
+ SvxSwFramePosString m_aFramePosString;
+
+ Rectangle m_aRect; //size of all selected objects
+ Rectangle m_aWorkArea;
+ Point m_aAnchorPos;
+
+ FrmMap* m_pVMap;
+ FrmMap* m_pHMap;
+ const SdrView* m_pSdrView;
+
+ // initial values
+ short m_nOldH;
+ short m_nOldHRel;
+ short m_nOldV;
+ short m_nOldVRel;
+
+ double m_fWidthHeightRatio; //width-to-height ratio to support the KeepRatio button
+ USHORT m_nHtmlMode;
+ bool m_bHtmlMode;
+ bool m_bAtHoriPosModified;
+ bool m_bAtVertPosModified;
+ bool m_bIsVerticalFrame;
+ bool m_bPositioningDisabled;
+ bool m_bIsMultiSelection;
+ bool m_bIsInRightToLeft;
+
+
+
+ DECL_LINK( RangeModifyHdl, Edit * );
+ DECL_LINK( AnchorTypeHdl, RadioButton * );
+ DECL_LINK( PosHdl, ListBox * );
+ DECL_LINK( RelHdl, ListBox * );
+ DECL_LINK( MirrorHdl, CheckBox * );
+ DECL_LINK( ModifyHdl, Edit * );
+ DECL_LINK( ProtectHdl, TriStateBox *);
+
+ void InitPos(short nAnchorType, USHORT nH, USHORT nHRel,
+ USHORT nV, USHORT nVRel,
+ long nX, long nY);
+ USHORT GetMapPos(FrmMap *pMap, ListBox &rAlignLB);
+ short GetAlignment(FrmMap *pMap, USHORT nMapPos, ListBox &rAlignLB, ListBox &rRelationLB);
+ short GetRelation(FrmMap *pMap, ListBox &rRelationLB);
+ short GetAnchorType(bool* pbHasChanged = 0);
+ ULONG FillRelLB(FrmMap *pMap, USHORT nLBSelPos, USHORT nAlign, USHORT nRel, ListBox &rLB, FixedText &rFT);
+ USHORT FillPosLB(FrmMap *pMap, USHORT nAlign, const USHORT _nRel, ListBox &rLB);
+
+ void UpdateExample();
+
+public:
+ SvxSwPosSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+ ~SvxSwPosSizeTabPage();
+
+ static SfxTabPage* Create( Window*, const SfxItemSet& );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet & );
+
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+ void EnableAnchorTypes(USHORT nAnchorEnable);
+
+ void SetValidateFramePosLink( const Link& rLink )
+ {m_aValidateLink = rLink;}
+
+ void SetView( const SdrView* pSdrView );
+};
+
+#endif
diff --git a/cui/source/tabpages/swpossizetabpage.src b/cui/source/tabpages/swpossizetabpage.src
new file mode 100644
index 000000000000..ee8bac14f688
--- /dev/null
+++ b/cui/source/tabpages/swpossizetabpage.src
@@ -0,0 +1,299 @@
+/*************************************************************************
+ *
+ * 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: swpossizetabpage.src,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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.hrc"
+#include <svx/dialogs.hrc>
+#include "swpossizetabpage.hrc"
+ // pragma -------------------------------------------------------------------
+
+
+ // RID_SVXPAGE_POSITION_SIZE ------------------------------------------------
+TabPage RID_SVXPAGE_SWPOSSIZE
+{
+ HelpId = HID_SVXPAGE_SWPOSSIZE;
+ Hide = TRUE ;
+ Text[ en-US ] = "Position and Size" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_SIZE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 104 , 8 ) ;
+ Text [ en-US ] = "Size" ;
+ };
+ FixedText FT_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 43 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Width" ;
+ };
+ MetricField MF_WIDTH
+ {
+ Pos = MAP_APPFONT ( 59 , 14 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ Border = TRUE ;
+ 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 ;
+ };
+ FixedText FT_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 43 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "H~eight" ;
+ };
+ MetricField MF_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 59 , 30 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ Border = TRUE ;
+ 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_KEEPRATIO
+ {
+ Pos = MAP_APPFONT ( 12 , 45 ) ;
+ Size = MAP_APPFONT ( 95 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Keep ratio" ;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 111 , 14 ) ;
+ Size = MAP_APPFONT ( 4 , 66 ) ;
+ Vert = TRUE;
+ };
+ FixedLine FL_ANCHOR
+ {
+ Pos = MAP_APPFONT ( 116 , 3 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Anchor" ;
+ };
+ RadioButton RB_TOPAGE
+ {
+ Pos = MAP_APPFONT ( 122 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "To ~page";
+ };
+ RadioButton RB_TOPARA
+ {
+ Pos = MAP_APPFONT ( 122 , 28 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "To paragrap~h";
+ };
+ RadioButton RB_TOCHAR
+ {
+ Pos = MAP_APPFONT ( 122 , 42 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "To cha~racter";
+ };
+ RadioButton RB_ASCHAR
+ {
+ Pos = MAP_APPFONT ( 122 , 56 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~As character" ;
+ };
+ RadioButton RB_TOFRAME
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 122 , 70 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "To ~frame";
+ };
+ Window WN_EXAMPLE
+ {
+ Pos = MAP_APPFONT ( 202 , 14 ) ;
+ Size = MAP_APPFONT ( 52 , 66 ) ;
+ };
+ FixedLine FL_PROTECTION
+ {
+ Pos = MAP_APPFONT ( 6 , 86 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Protect" ;
+ };
+ TriStateBox CB_POSITION
+ {
+ Pos = MAP_APPFONT ( 12 , 97 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Position" ;
+ };
+ TriStateBox CB_SIZE
+ {
+ Pos = MAP_APPFONT ( 122 , 97 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Size" ;
+ };
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( 6 , 113 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Position" ;
+ };
+ FixedText FT_HORI
+ {
+ Pos = MAP_APPFONT ( 12 , 126 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Hori~zontal" ;
+ };
+ ListBox LB_HORI
+ {
+ Pos = MAP_APPFONT ( 49 , 124 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_HORIBY
+ {
+ Pos = MAP_APPFONT ( 101 , 126 ) ;
+ Size = MAP_APPFONT ( 20 , 8 ) ;
+ Center = TRUE ;
+ Text [ en-US ] = "b~y" ;
+ };
+ MetricField MF_HORIBY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 123 , 124 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ 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_HORITO
+ {
+ Pos = MAP_APPFONT ( 160 , 126 ) ;
+ Size = MAP_APPFONT ( 21 , 8 ) ;
+ Center = TRUE ;
+ Text [ en-US ] = "~to" ;
+ };
+ ListBox LB_HORITO
+ {
+ Pos = MAP_APPFONT ( 183 , 124 ) ;
+ Size = MAP_APPFONT ( 65 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ CheckBox CB_HORIMIRROR
+ {
+ Pos = MAP_APPFONT ( 12 , 139 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Mirror on even pages" ;
+ };
+ FixedText FT_VERT
+ {
+ Pos = MAP_APPFONT ( 12 , 155 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Vertical" ;
+ };
+ ListBox LB_VERT
+ {
+ Pos = MAP_APPFONT ( 49 , 153 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_VERTBY
+ {
+ Pos = MAP_APPFONT ( 101 , 155 ) ;
+ Size = MAP_APPFONT ( 20 , 8 ) ;
+ Center = TRUE ;
+ Text [ en-US ] = "by" ;
+ };
+ MetricField MF_VERTBY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 123 , 153 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ 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_VERTTO
+ {
+ Pos = MAP_APPFONT ( 160 , 155 ) ;
+ Size = MAP_APPFONT ( 21 , 8 ) ;
+ Center = TRUE ;
+ Text [ en-US ] = "t~o" ;
+ };
+ ListBox LB_VERTTO
+ {
+ Pos = MAP_APPFONT ( 183 , 153 ) ;
+ Size = MAP_APPFONT ( 65 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ CheckBox CB_FOLLOW
+ {
+ Pos = MAP_APPFONT ( 12 , 168 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Follow text flow" ;
+ };
+};
diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx
new file mode 100644
index 000000000000..412b1affe5c4
--- /dev/null
+++ b/cui/source/tabpages/tabarea.cxx
@@ -0,0 +1,370 @@
+/*************************************************************************
+ *
+ * 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: tabarea.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <tools/ref.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svx/svdmark.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdview.hxx>
+
+#define _SVX_TABAREA_CXX
+
+#include <svx/dialogs.hrc>
+#include <svx/xtable.hxx>
+#include "svx/globl3d.hxx"
+#include <svx/svdmodel.hxx>
+#include "svx/drawitem.hxx"
+#include "cuitabarea.hxx"
+#include "tabarea.hrc"
+#include "dlgname.hxx"
+//#include "dlgname.hrc"
+#include <svx/dialmgr.hxx>
+
+#define DLGWIN this->GetParent()->GetParent()
+
+/*************************************************************************
+|*
+|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+|*
+|************************************************************************/
+
+SvxAreaTabDialog::SvxAreaTabDialog
+(
+ Window* pParent,
+ const SfxItemSet* pAttr,
+ SdrModel* pModel,
+ const SdrView* /* pSdrView */
+) :
+
+ SfxTabDialog( pParent, SVX_RES( RID_SVXDLG_AREA ), pAttr ),
+
+ mpDrawModel ( pModel ),
+// mpView ( pSdrView ),
+ mpColorTab ( pModel->GetColorTable() ),
+ mpNewColorTab ( pModel->GetColorTable() ),
+ mpGradientList ( pModel->GetGradientList() ),
+ mpNewGradientList ( pModel->GetGradientList() ),
+ mpHatchingList ( pModel->GetHatchList() ),
+ mpNewHatchingList ( pModel->GetHatchList() ),
+ mpBitmapList ( pModel->GetBitmapList() ),
+ mpNewBitmapList ( pModel->GetBitmapList() ),
+ mrOutAttrs ( *pAttr ),
+ mnColorTableState ( CT_NONE ),
+ mnBitmapListState ( CT_NONE ),
+ mnGradientListState ( CT_NONE ),
+ mnHatchingListState ( CT_NONE ),
+ mnPageType( PT_AREA ),
+ mnDlgType( 0 ),
+ mnPos( 0 ),
+ mbAreaTP( sal_False ),
+ mbDeleteColorTable( TRUE )
+{
+ FreeResource();
+
+ AddTabPage( RID_SVXPAGE_AREA, SvxAreaTabPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_SHADOW, SvxShadowTabPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_TRANSPARENCE, SvxTransparenceTabPage::Create, 0);
+ AddTabPage( RID_SVXPAGE_COLOR, SvxColorTabPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_GRADIENT, SvxGradientTabPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_HATCH, SvxHatchTabPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_BITMAP, SvxBitmapTabPage::Create, 0);
+
+ SetCurPageId( RID_SVXPAGE_AREA );
+
+ CancelButton& rBtnCancel = GetCancelButton();
+ rBtnCancel.SetClickHdl( LINK( this, SvxAreaTabDialog, CancelHdlImpl ) );
+//! rBtnCancel.SetText( SVX_RESSTR( RID_SVXSTR_CLOSE ) );
+}
+
+// -----------------------------------------------------------------------
+
+SvxAreaTabDialog::~SvxAreaTabDialog()
+{
+}
+
+
+// -----------------------------------------------------------------------
+
+void SvxAreaTabDialog::SavePalettes()
+{
+ SfxObjectShell* pShell = SfxObjectShell::Current();
+ /*uno::Reference< frame::XDispatchProvider > xDispatchProvider;
+ if ( !pShell )
+ {
+ uno::Reference< frame::XModel> xModel = mpDrawModel->getUnoModel();
+ if ( xModel.is() )
+ xDispatchProvider.set(xModel->getCurrentController(),uno::UNO_QUERY);
+ }*/
+ if( mpNewColorTab != mpDrawModel->GetColorTable() )
+ {
+ if(mbDeleteColorTable)
+ delete mpDrawModel->GetColorTable();
+ mpDrawModel->SetColorTable( mpNewColorTab );
+ SvxColorTableItem aColorTableItem( mpNewColorTab, SID_COLOR_TABLE );
+ if ( pShell )
+ pShell->PutItem( aColorTableItem );
+ else
+ {
+ mpDrawModel->GetItemPool().Put(aColorTableItem,SID_COLOR_TABLE);
+ }
+ mpColorTab = mpDrawModel->GetColorTable();
+ }
+ if( mpNewGradientList != mpDrawModel->GetGradientList() )
+ {
+ delete mpDrawModel->GetGradientList();
+ mpDrawModel->SetGradientList( mpNewGradientList );
+ SvxGradientListItem aItem( mpNewGradientList, SID_GRADIENT_LIST );
+ if ( pShell )
+ pShell->PutItem( aItem );
+ else
+ {
+ mpDrawModel->GetItemPool().Put(aItem,SID_GRADIENT_LIST);
+ }
+ mpGradientList = mpDrawModel->GetGradientList();
+ }
+ if( mpNewHatchingList != mpDrawModel->GetHatchList() )
+ {
+ delete mpDrawModel->GetHatchList();
+ mpDrawModel->SetHatchList( mpNewHatchingList );
+ SvxHatchListItem aItem( mpNewHatchingList, SID_HATCH_LIST );
+ if ( pShell )
+ pShell->PutItem( aItem );
+ else
+ {
+ mpDrawModel->GetItemPool().Put(aItem,SID_HATCH_LIST);
+ }
+ mpHatchingList = mpDrawModel->GetHatchList();
+ }
+ if( mpNewBitmapList != mpDrawModel->GetBitmapList() )
+ {
+ delete mpDrawModel->GetBitmapList();
+ mpDrawModel->SetBitmapList( mpNewBitmapList );
+ SvxBitmapListItem aItem( mpNewBitmapList, SID_BITMAP_LIST );
+ if ( pShell )
+ pShell->PutItem( aItem );
+ else
+ {
+ mpDrawModel->GetItemPool().Put(aItem,SID_BITMAP_LIST);
+ }
+ mpBitmapList = mpDrawModel->GetBitmapList();
+ }
+
+ // Speichern der Tabellen, wenn sie geaendert wurden.
+
+ const String aPath( SvtPathOptions().GetPalettePath() );
+
+ if( mnHatchingListState & CT_MODIFIED )
+ {
+ mpHatchingList->SetPath( aPath );
+ mpHatchingList->Save();
+
+ SvxHatchListItem aItem( mpHatchingList, SID_HATCH_LIST );
+ // ToolBoxControls werden benachrichtigt:
+ if ( pShell )
+ pShell->PutItem( aItem );
+ else
+ {
+ mpDrawModel->GetItemPool().Put(aItem);
+ }
+ }
+
+ if( mnBitmapListState & CT_MODIFIED )
+ {
+ mpBitmapList->SetPath( aPath );
+ mpBitmapList->Save();
+
+ SvxBitmapListItem aItem( mpBitmapList, SID_BITMAP_LIST );
+ // ToolBoxControls werden benachrichtigt:
+ if ( pShell )
+ pShell->PutItem( aItem );
+ else
+ {
+ mpDrawModel->GetItemPool().Put(aItem);
+ }
+ }
+
+ if( mnGradientListState & CT_MODIFIED )
+ {
+ mpGradientList->SetPath( aPath );
+ mpGradientList->Save();
+
+ SvxGradientListItem aItem( mpGradientList, SID_GRADIENT_LIST );
+ // ToolBoxControls werden benachrichtigt:
+ if ( pShell )
+ pShell->PutItem( aItem );
+ else
+ {
+ mpDrawModel->GetItemPool().Put(aItem);
+ }
+ }
+
+ if( mnColorTableState & CT_MODIFIED )
+ {
+ mpColorTab->SetPath( aPath );
+ mpColorTab->Save();
+
+ SvxColorTableItem aItem( mpColorTab, SID_COLOR_TABLE );
+ // ToolBoxControls werden benachrichtigt:
+ if ( pShell )
+ pShell->PutItem( aItem );
+ else
+ {
+ mpDrawModel->GetItemPool().Put(aItem);
+ }
+ }
+}
+// -----------------------------------------------------------------------
+
+short SvxAreaTabDialog::Ok()
+{
+ SavePalettes();
+
+ // Es wird RET_OK zurueckgeliefert, wenn wenigstens eine
+ // TabPage in FillItemSet() TRUE zurueckliefert. Dieses
+ // geschieht z.Z. standardmaessig.
+ return( SfxTabDialog::Ok() );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxAreaTabDialog, CancelHdlImpl, void *, EMPTYARG)
+{
+ SavePalettes();
+
+ EndDialog( RET_CANCEL );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxAreaTabDialog, CancelHdlImpl, void *, p )
+
+// -----------------------------------------------------------------------
+
+void SvxAreaTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage )
+{
+ switch( nId )
+ {
+ case RID_SVXPAGE_AREA:
+ ( (SvxAreaTabPage&) rPage ).SetColorTable( mpColorTab );
+ ( (SvxAreaTabPage&) rPage ).SetGradientList( mpGradientList );
+ ( (SvxAreaTabPage&) rPage ).SetHatchingList( mpHatchingList );
+ ( (SvxAreaTabPage&) rPage ).SetBitmapList( mpBitmapList );
+ //CHINA001 ( (SvxAreaTabPage&) rPage ).SetPageType( &mnPageType );
+ ( (SvxAreaTabPage&) rPage ).SetPageType( mnPageType ); //add CHINA001
+ //CHINA001 ( (SvxAreaTabPage&) rPage ).SetDlgType( &mnDlgType );
+ ( (SvxAreaTabPage&) rPage ).SetDlgType( mnDlgType );//add CHINA001
+ //CHINA001 ( (SvxAreaTabPage&) rPage ).SetPos( &nPos );
+ ( (SvxAreaTabPage&) rPage ).SetPos( mnPos );//add CHINA001
+ ( (SvxAreaTabPage&) rPage ).SetAreaTP( &mbAreaTP );
+ ( (SvxAreaTabPage&) rPage ).SetGrdChgd( &mnGradientListState );
+ ( (SvxAreaTabPage&) rPage ).SetHtchChgd( &mnHatchingListState );
+ ( (SvxAreaTabPage&) rPage ).SetBmpChgd( &mnBitmapListState );
+ ( (SvxAreaTabPage&) rPage ).SetColorChgd( &mnColorTableState );
+ ( (SvxAreaTabPage&) rPage ).Construct();
+ // ActivatePage() wird das erste mal nicht gerufen
+ ( (SvxAreaTabPage&) rPage ).ActivatePage( mrOutAttrs );
+
+ break;
+
+ case RID_SVXPAGE_SHADOW:
+ {
+ ( (SvxShadowTabPage&) rPage ).SetColorTable( mpColorTab );
+ ( (SvxShadowTabPage&) rPage ).SetPageType( mnPageType );//CHINA001 ( (SvxShadowTabPage&) rPage ).SetPageType( &mnPageType );
+ ( (SvxShadowTabPage&) rPage ).SetDlgType( mnDlgType );//CHINA001 ( (SvxShadowTabPage&) rPage ).SetDlgType( &mnDlgType );
+ //( (SvxShadowTabPage&) rPage ).SetPos( &nPos );
+ ( (SvxShadowTabPage&) rPage ).SetAreaTP( &mbAreaTP );
+ ( (SvxShadowTabPage&) rPage ).SetColorChgd( &mnColorTableState );
+ ( (SvxShadowTabPage&) rPage ).Construct();
+ }
+ break;
+
+ case RID_SVXPAGE_GRADIENT:
+ ( (SvxGradientTabPage&) rPage ).SetColorTable( mpColorTab );
+ ( (SvxGradientTabPage&) rPage ).SetGradientList( mpGradientList );
+ ( (SvxGradientTabPage&) rPage ).SetPageType( &mnPageType );
+ ( (SvxGradientTabPage&) rPage ).SetDlgType( &mnDlgType );
+ ( (SvxGradientTabPage&) rPage ).SetPos( &mnPos );
+ ( (SvxGradientTabPage&) rPage ).SetAreaTP( &mbAreaTP );
+ ( (SvxGradientTabPage&) rPage ).SetGrdChgd( &mnGradientListState );
+ ( (SvxGradientTabPage&) rPage ).SetColorChgd( &mnColorTableState );
+ ( (SvxGradientTabPage&) rPage ).Construct();
+ break;
+
+ case RID_SVXPAGE_HATCH:
+ ( (SvxHatchTabPage&) rPage ).SetColorTable( mpColorTab );
+ ( (SvxHatchTabPage&) rPage ).SetHatchingList( mpHatchingList );
+ ( (SvxHatchTabPage&) rPage ).SetPageType( &mnPageType );
+ ( (SvxHatchTabPage&) rPage ).SetDlgType( &mnDlgType );
+ ( (SvxHatchTabPage&) rPage ).SetPos( &mnPos );
+ ( (SvxHatchTabPage&) rPage ).SetAreaTP( &mbAreaTP );
+ ( (SvxHatchTabPage&) rPage ).SetHtchChgd( &mnHatchingListState );
+ ( (SvxHatchTabPage&) rPage ).SetColorChgd( &mnColorTableState );
+ ( (SvxHatchTabPage&) rPage ).Construct();
+ break;
+
+ case RID_SVXPAGE_BITMAP:
+ ( (SvxBitmapTabPage&) rPage ).SetColorTable( mpColorTab );
+ ( (SvxBitmapTabPage&) rPage ).SetBitmapList( mpBitmapList );
+ ( (SvxBitmapTabPage&) rPage ).SetPageType( &mnPageType );
+ ( (SvxBitmapTabPage&) rPage ).SetDlgType( &mnDlgType );
+ ( (SvxBitmapTabPage&) rPage ).SetPos( &mnPos );
+ ( (SvxBitmapTabPage&) rPage ).SetAreaTP( &mbAreaTP );
+ ( (SvxBitmapTabPage&) rPage ).SetBmpChgd( &mnBitmapListState );
+ ( (SvxBitmapTabPage&) rPage ).SetColorChgd( &mnColorTableState );
+ ( (SvxBitmapTabPage&) rPage ).Construct();
+ break;
+
+ case RID_SVXPAGE_COLOR:
+ ( (SvxColorTabPage&) rPage ).SetColorTable( mpColorTab );
+ ( (SvxColorTabPage&) rPage ).SetPageType( &mnPageType );
+ ( (SvxColorTabPage&) rPage ).SetDlgType( &mnDlgType );
+ ( (SvxColorTabPage&) rPage ).SetPos( &mnPos );
+ ( (SvxColorTabPage&) rPage ).SetAreaTP( &mbAreaTP );
+ ( (SvxColorTabPage&) rPage ).SetColorChgd( &mnColorTableState );
+ ( (SvxColorTabPage&) rPage ).SetDeleteColorTable( mbDeleteColorTable );
+ ( (SvxColorTabPage&) rPage ).Construct();
+ break;
+
+ case RID_SVXPAGE_TRANSPARENCE:
+ ( (SvxTransparenceTabPage&) rPage ).SetPageType( mnPageType );//CHINA001 ( (SvxTransparenceTabPage&) rPage ).SetPageType( &mnPageType );
+ ( (SvxTransparenceTabPage&) rPage ).SetDlgType( mnDlgType );//CHINA001 ( (SvxTransparenceTabPage&) rPage ).SetDlgType( &mnDlgType );
+ ( (SvxTransparenceTabPage&) rPage ).Construct();
+ break;
+
+ }
+}
+
+
diff --git a/cui/source/tabpages/tabarea.hrc b/cui/source/tabpages/tabarea.hrc
new file mode 100644
index 000000000000..c79e52d82380
--- /dev/null
+++ b/cui/source/tabpages/tabarea.hrc
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tabarea.hrc,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define BTN_LOAD 5
+#define BTN_SAVE 6
+#define GRP_FILL 1
+#define GRP_SHADOW 2
+#define GRP_PREVIEW 3
+#define GRP_TRANSPARENT 4
+#define GRP_STEPCOUNT 5
+#define CTL_PREVIEW 1
+#define CTL_POSITION 2
+//#define CTL_GRADIENT_PREVIEW 3
+//#define CTL_HATCHING_PREVIEW 4
+#define CTL_COLOR_PREVIEW 5
+#define CTL_BITMAP_PREVIEW 6
+#define MTR_FLD_DISTANCE 1
+#define TSB_INVISIBLE 1
+#define TSB_SHOW_SHADOW 2
+#define TSB_STEPCOUNT 3
+#define TSB_TILE 4
+#define TSB_STRETCH 5
+#define TSB_ORIGINAL 6
+#define AREADLG_INVISIBLE 0
+#define AREADLG_COLOR 1
+#define AREADLG_GRADIENT 2
+#define AREADLG_HATCH 3
+#define AREADLG_BITMAP 4
+
+#define LB_COLOR 1
+#define LB_GRADIENT 2
+#define LB_HATCHING 3
+#define LB_BITMAP 4
+//#define LB_TRANSPARENT 5
+#define LB_BITMAPS 4
+#define LB_BACKGROUND_COLOR 3
+#define LB_DLG_TYPE 99
+#define GRP_COLOR 1
+#define BTN_ADD 1
+#define BTN_IMPORT 2
+#define BTN_MODIFY 3
+#define BTN_DELETE 4
+#define FT_COLOR 1
+#define FT_BACKGROUND_COLOR 2
+#define FT_POSITION 2
+#define FT_DISTANCE 1
+#define FT_LINE_COLOR 2
+#define FT_LINE_TYPE 1
+#define FT_LINE_DISTANCE 3
+#define FT_LINE_ANGLE 4
+#define GRP_LINE 1
+#define GRP_HATCHINGS 5
+#define MTR_FLD_ANGLE 3
+#define CTL_ANGLE 2
+#define LB_HATCHINGS 4
+#define LB_LINE_TYPE 1
+#define LB_LINE_COLOR 3
+#define GRP_GRADIENTS 4
+#define GRP_GRADIENT_TYPE 5
+#define LB_GRADIENTS 3
+#define LB_GRADIENT_TYPES 4
+#define LB_COLOR_FROM 1
+#define LB_COLOR_TO 2
+#define FT_COLOR_FROM 1
+#define FT_COLOR_TO 2
+#define FT_CENTER_X 3
+#define FT_CENTER_Y 5
+#define FT_ANGLE 4
+#define FT_BORDER 6
+#define MTR_COLOR_FROM 4
+#define MTR_COLOR_TO 5
+#define MTR_CENTER_X 2
+#define MTR_CENTER_Y 3
+#define MTR_BORDER 6
+#define MTR_ANGLE 1
+#define NUM_FLD_STEPCOUNT 1
+#define FT_PIXEL_EDIT 4
+#define CTL_PIXEL 2
+#define FT_TYPE 7
+#define FT_SHADOW_COLOR 10
+#define LB_SHADOW_COLOR 10
+#define FL_PROP 2
+#define FL_SIZE 3
+#define FL_POSITION 4
+#define FL_OFFSET 5
+#define FL_STEPCOUNT 7
+
+// Farben definieren TabPage
+// nur temporaer !!!
+// #define RID_SVXPAGE_COLOR 999
+
+//#define GRP_COLORTABLE 1
+//#define GRP_COLORMODEL 2
+
+#define BTN_WORK_ON 2
+#define CTL_COLORTABLE 3
+#define CTL_PREVIEW_OLD 1
+#define CTL_PREVIEW_NEW 2
+#define FT_NAME 2
+#define EDT_NAME 1
+// #define LB_COLOR 1
+#define LB_COLORMODEL 2
+#define FT_1 3
+#define FT_2 4
+#define FT_3 5
+#define FT_4 6
+#define MTR_FLD_1 1
+#define MTR_FLD_2 2
+#define MTR_FLD_3 3
+#define MTR_FLD_4 4
+#define FT_TABLE_NAME 7
+#define MTR_FLD_X_SIZE 4
+#define MTR_FLD_Y_SIZE 5
+#define GRP_SIZE 6
+#define TSB_SCALE 1
+#define GRP_POSITION 7
+#define FT_X_OFFSET 1
+#define FT_Y_OFFSET 2
+#define MTR_FLD_X_OFFSET 1
+#define MTR_FLD_Y_OFFSET 2
+#define LB_AREA_TYPE 19
+#define RBT_ROW 6
+#define RBT_COLUMN 7
+#define MTR_FLD_OFFSET 3
+#define GRP_OFFSET 8
+
+#define FT_TRANSPARENT 9
+#define FT_X_SIZE 10
+#define FT_Y_SIZE 11
+#define FT_BITMAPS_HIDDEN 12
+
+#define RBT_TRANS_OFF 8
+#define RBT_TRANS_LINEAR 9
+#define RBT_TRANS_GRADIENT 10
+#define GRP_TRANS_MODE 9
+#define GRP_TRANS_GRADIENT 10
+#define CTL_TRANS_PREVIEW 19
+
+#define FT_TRGR_TYPE 12
+#define LB_TRGR_GRADIENT_TYPES 3
+#define FT_TRGR_CENTER_X 13
+#define MTR_TRGR_CENTER_X 4
+#define FT_TRGR_CENTER_Y 14
+#define MTR_TRGR_CENTER_Y 5
+#define FT_TRGR_ANGLE 15
+#define MTR_TRGR_ANGLE 6
+#define FT_TRGR_BORDER 16
+#define MTR_TRGR_BORDER 7
+#define FT_TRGR_START_VALUE 17
+#define MTR_TRGR_START_VALUE 8
+#define FT_TRGR_END_VALUE 18
+#define MTR_TRGR_END_VALUE 9
+#define MTR_TRANSPARENT 10
+
+#define MTR_SHADOW_TRANSPARENT 11
+
+// Hatch-Background on Area-TabPage
+#define GRP_HATCHBCKGRD 20
+#define CB_HATCHBCKGRD 21
+#define LB_HATCHBCKGRDCOLOR 22
+
+
+#define IMG_LOAD_H 23
+#define IMG_SAVE_H 24
diff --git a/cui/source/tabpages/tabarea.src b/cui/source/tabpages/tabarea.src
new file mode 100644
index 000000000000..877d1c5799fd
--- /dev/null
+++ b/cui/source/tabpages/tabarea.src
@@ -0,0 +1,1541 @@
+/*************************************************************************
+ *
+ * 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: tabarea.src,v $
+ * $Revision: 1.65 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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.hrc"
+#include <svx/dialogs.hrc>
+#include "tabarea.hrc"
+
+#define MASKCOLOR MaskColor = Color{ Red = 0xff00 ; Green = 0x0000 ; Blue = 0xff00 ; };
+
+
+ // RID_SVXPAGE_AREA ------------------------------------------------------
+#define TRANS_GRAD_OFFSET_X 6
+#define TRANS_GRAD_OFFSET_Y 64
+#define TRANS_GRAD_FIELD_SEPARATION 24
+
+TabPage RID_SVXPAGE_TRANSPARENCE
+{
+ HelpID = HID_AREA_TRANSPARENCE;
+ Hide = TRUE;
+ Size = MAP_APPFONT ( 260 , 185 );
+ FixedLine FL_PROP
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Transparency mode";
+ };
+ RadioButton RBT_TRANS_OFF
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 110 , 10 ) ;
+ Text [ en-US ] = "~No transparency";
+ };
+ RadioButton RBT_TRANS_LINEAR
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Transparency";
+ };
+ MetricField MTR_TRANSPARENT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 72 , 26 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ RadioButton RBT_TRANS_GRADIENT
+ {
+ Pos = MAP_APPFONT ( 12 , 42 ) ;
+ Size = MAP_APPFONT ( 110 , 10 ) ;
+ Text [ en-US ] = "Gradient";
+ };
+ FixedText FT_TRGR_TYPE
+ {
+ Pos = MAP_APPFONT ( 21 , 56 ) ;
+ Size = MAP_APPFONT ( 41 , 8 ) ;
+ Text [ en-US ] = "Ty~pe";
+ };
+ ListBox LB_TRGR_GRADIENT_TYPES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 72 , 54 ) ;
+ Size = MAP_APPFONT ( 53 , 63 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Linear" ; Default ; > ;
+ < "Axial" ; Default ; > ;
+ < "Radial" ; Default ; > ;
+ < "Ellipsoid" ; Default ; > ;
+ < "Quadratic" ; Default ; > ;
+ < "Square" ; Default ; > ;
+ };
+ };
+ FixedText FT_TRGR_CENTER_X
+ {
+ Pos = MAP_APPFONT ( 21 , 72 ) ;
+ Size = MAP_APPFONT ( 41 , 8 ) ;
+ Text [ en-US ] = "Center ~X";
+ };
+ MetricField MTR_TRGR_CENTER_X
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 72 , 70 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_TRGR_CENTER_Y
+ {
+ Pos = MAP_APPFONT ( 21 , 88 ) ;
+ Size = MAP_APPFONT ( 41 , 8 ) ;
+ Text [ en-US ] = "Center ~Y";
+ };
+ MetricField MTR_TRGR_CENTER_Y
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 72 , 86 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_TRGR_ANGLE
+ {
+ Pos = MAP_APPFONT ( 21 , 104 ) ;
+ Size = MAP_APPFONT ( 41 , 8 ) ;
+ Text [ en-US ] = "~Angle";
+ };
+ MetricField MTR_TRGR_ANGLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 72 , 102 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 359 ;
+ Unit = FUNIT_CUSTOM ;
+ Last = 359 ;
+ SpinSize = 15 ;
+ CustomUnitText [ en-US ] = " degrees";
+ };
+ FixedText FT_TRGR_BORDER
+ {
+ Pos = MAP_APPFONT ( 15 + TRANS_GRAD_OFFSET_X, 56 + TRANS_GRAD_OFFSET_Y) ;
+ Size = MAP_APPFONT ( 41, 8 ) ;
+ Text [ en-US ] = "~Border";
+ };
+ MetricField MTR_TRGR_BORDER
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 + TRANS_GRAD_OFFSET_X, 54 + TRANS_GRAD_OFFSET_Y) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_TRGR_START_VALUE
+ {
+ Pos = MAP_APPFONT ( 21 , 136 ) ;
+ Size = MAP_APPFONT ( 41 , 8 ) ;
+ Text [ en-US ] = "~Start value";
+ };
+ MetricField MTR_TRGR_START_VALUE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 72 , 134 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_TRGR_END_VALUE
+ {
+ Pos = MAP_APPFONT ( 21 , 152 ) ;
+ Size = MAP_APPFONT ( 41 , 8 ) ;
+ Text [ en-US ] = "~End value";
+ };
+ MetricField MTR_TRGR_END_VALUE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 72 , 150 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ Control CTL_BITMAP_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 138 , 14 ) ;
+ Size = MAP_APPFONT ( 110 , 42 ) ;
+ };
+ Control CTL_TRANS_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 138 , 14 ) ;
+ Size = MAP_APPFONT ( 110 , 42 ) ;
+ };
+ Text [ en-US ] = "Transparency";
+};
+
+ // RID_SVXPAGE_AREA ------------------------------------------------------
+TabPage RID_SVXPAGE_AREA
+{
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ HelpID = HID_AREA_AREA ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Area" ;
+
+ FixedLine FL_PROP
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 120, 8 ) ;
+ Text [ en-US ] = "Fill";
+ };
+ ListBox LB_AREA_TYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 108 , 60 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ StringList [ en-US ] =
+ {
+ < "None" ; Default ; > ;
+ < "Color" ; Default ; > ;
+ < "Gradient" ; Default ; > ;
+ < "Hatching" ; Default ; > ;
+ < "Bitmap" ; Default ; > ;
+ };
+ };
+
+
+ ListBox LB_COLOR
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 108 , 103 ) ;
+ TabStop = TRUE ;
+ };
+ ListBox LB_GRADIENT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 108 , 103 ) ;
+ TabStop = TRUE ;
+ };
+ ListBox LB_HATCHING
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 108 , 103 ) ;
+ TabStop = TRUE ;
+ };
+ ListBox LB_BITMAP
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 108 , 103 ) ;
+ TabStop = TRUE ;
+ };
+
+ // ---------- preview ----------
+
+ Control CTL_COLOR_PREVIEW
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 12 , 137 ) ;
+ Size = MAP_APPFONT ( 110 , 42 ) ;
+ };
+ Control CTL_BITMAP_PREVIEW
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 12 , 137 ) ;
+ Size = MAP_APPFONT ( 110 , 42 ) ;
+ Hide = TRUE ;
+ };
+
+ // ---------- for gradients ----------
+
+ FixedLine FL_STEPCOUNT
+ {
+ Pos = MAP_APPFONT ( 132 , 3 ) ;
+ Size = MAP_APPFONT ( 122 , 8 ) ;
+ Text [ en-US ] = "Increments" ;
+ };
+ TriStateBox TSB_STEPCOUNT
+ {
+ Pos = MAP_APPFONT ( 138 , 15 ) ;
+ Size = MAP_APPFONT ( 68 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "A~utomatic" ;
+ };
+ NumericField NUM_FLD_STEPCOUNT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 208 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 3 ;
+ First = 3 ;
+ Maximum = 256 ;
+ Last = 256 ;
+ StrictFormat = TRUE ;
+ };
+
+ // ---------- for hatches ----------
+
+ CheckBox CB_HATCHBCKGRD
+ {
+ Pos = MAP_APPFONT ( 132 , 3 ) ;
+ Size = MAP_APPFONT ( 122 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Background color" ;
+ };
+ ListBox LB_HATCHBCKGRDCOLOR
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 141 , 16 ) ;
+ Size = MAP_APPFONT ( 70 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+
+ // ---------- for bitmaps ----------
+
+ FixedLine FL_SIZE
+ {
+ Pos = MAP_APPFONT ( 132 , 3 ) ;
+ Size = MAP_APPFONT ( 122 , 8 ) ;
+ Text [ en-US ] = "Size" ;
+ };
+ TriStateBox TSB_ORIGINAL
+ {
+ Pos = MAP_APPFONT ( 138 , 15 ) ;
+ Size = MAP_APPFONT ( 48 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Original" ;
+ };
+ TriStateBox TSB_SCALE
+ {
+ Pos = MAP_APPFONT ( 138 , 30 ) ;
+ Size = MAP_APPFONT ( 48 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Re~lative" ;
+ };
+ FixedText FT_X_SIZE
+ {
+ Pos = MAP_APPFONT ( 187 , 15 ) ;
+ Size = MAP_APPFONT ( 24 , 8 ) ;
+ Text [ en-US ] = "Wi~dth" ;
+ };
+ MetricField MTR_FLD_X_SIZE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 212 , 14 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ CustomUnitText = "%" ;
+ Minimum = 5 ;
+ Maximum = 100 ;
+ First = 5 ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_Y_SIZE
+ {
+ Pos = MAP_APPFONT ( 187 , 31 ) ;
+ Size = MAP_APPFONT ( 24 , 8 ) ;
+ Text [ en-US ] = "H~eight" ;
+ };
+ MetricField MTR_FLD_Y_SIZE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 212 , 29 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ CustomUnitText = "%" ;
+ Minimum = 5 ;
+ Maximum = 100 ;
+ First = 5 ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ SpinSize = 5 ;
+ };
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( 132 , 47 ) ;
+ Size = MAP_APPFONT ( 122 , 8 ) ;
+ Text [ en-US ] = "Position" ;
+ };
+
+ Control CTL_POSITION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 138 , 57 ) ;
+ Size = MAP_APPFONT ( 40 , 27 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_X_OFFSET
+ {
+ Pos = MAP_APPFONT ( 138 , 89 ) ;
+ Size = MAP_APPFONT ( 39 , 8 ) ;
+ Text [ en-US ] = "~X Offset" ;
+ };
+ FixedText FT_Y_OFFSET
+ {
+ Pos = MAP_APPFONT ( 139 , 104 ) ;
+ Size = MAP_APPFONT ( 78 , 8 ) ;
+ Text [ en-US ] = "~Y Offset" ;
+ };
+ MetricField MTR_FLD_X_OFFSET
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 219 , 87 ) ;
+ Size = MAP_APPFONT ( 29 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Maximum = 100 ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ MetricField MTR_FLD_Y_OFFSET
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 219 , 102 ) ;
+ Size = MAP_APPFONT ( 29 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ TriStateBox TSB_TILE
+ {
+ Pos = MAP_APPFONT ( 138 , 117 ) ;
+ Size = MAP_APPFONT ( 54 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Tile" ;
+ };
+ TriStateBox TSB_STRETCH
+ {
+ Pos = MAP_APPFONT ( 194 , 117 ) ;
+ Size = MAP_APPFONT ( 54 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Auto~Fit" ;
+ };
+ FixedLine FL_OFFSET
+ {
+ Pos = MAP_APPFONT ( 132 , 133 ) ;
+ Size = MAP_APPFONT ( 122 , 8 ) ;
+ Text [ en-US ] = "Offset" ;
+ };
+ RadioButton RBT_ROW
+ {
+ Pos = MAP_APPFONT ( 138 , 144 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ Text [ en-US ] = "Ro~w" ;
+ };
+ RadioButton RBT_COLUMN
+ {
+ Pos = MAP_APPFONT ( 138 , 158 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ Text [ en-US ] = "Colu~mn" ;
+ };
+ MetricField MTR_FLD_OFFSET
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 219 , 157 ) ;
+ Size = MAP_APPFONT ( 29 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+};
+ // RID_SVXPAGE_SHADOW ------------------------------------------------------
+TabPage RID_SVXPAGE_SHADOW
+{
+ HelpID = HID_AREA_SHADOW ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Shadow" ;
+ FixedLine FL_PROP
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Properties";
+ };
+ TriStateBox TSB_SHOW_SHADOW
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 110 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Use shadow";
+ };
+ FixedText FT_POSITION
+ {
+ Pos = MAP_APPFONT ( 12 , 33 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "~Position";
+ };
+ Control CTL_POSITION
+ {
+ HelpId = HID_TPSHADOW_CTRL ;
+ Pos = MAP_APPFONT ( 65 , 31 ) ;
+ Size = MAP_APPFONT ( 57 , 29 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_DISTANCE
+ {
+ Pos = MAP_APPFONT ( 12 , 69 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Distance";
+ };
+ MetricField MTR_FLD_DISTANCE
+ {
+ Pos = MAP_APPFONT ( 65 , 67 ) ;
+ Size = MAP_APPFONT ( 47 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99999 ;
+ Minimum = 0 ; // #i33700#
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ Last = 99999 ;
+ /*SpinSize = 100 ; */
+ SpinSize = 1 ;
+ };
+ ListBox LB_SHADOW_COLOR
+ {
+ Pos = MAP_APPFONT ( 65 , 86 ) ;
+ Size = MAP_APPFONT ( 57 , 100 ) ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_SHADOW_COLOR
+ {
+ Pos = MAP_APPFONT ( 12 , 88 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Color" ;
+ };
+ FixedText FT_TRANSPARENT
+ {
+ Pos = MAP_APPFONT ( 12 , 107 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Transparency";
+ };
+ MetricField MTR_SHADOW_TRANSPARENT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 65 , 105 ) ;
+ Size = MAP_APPFONT ( 47 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ Control CTL_COLOR_PREVIEW
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 138 , 14 ) ;
+ Size = MAP_APPFONT ( 110 , 42 ) ;
+ TabStop = FALSE ;
+ };
+};
+ // RID_SVXPAGE_HATCH --------------------------------------------------------
+TabPage RID_SVXPAGE_HATCH
+{
+ HelpID = HID_AREA_HATCH ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Hatching" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_PROP
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Properties";
+ };
+ FixedText FT_LINE_DISTANCE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 78 , 8 ) ;
+ Text [ en-US ] = "~Spacing" ;
+ };
+ MetricField MTR_FLD_DISTANCE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 30 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = 30 ;
+ Last = 9999 ;
+ SpinSize = 100 ;
+ };
+ FixedText FT_LINE_ANGLE
+ {
+ Pos = MAP_APPFONT ( 12 , 41 ) ;
+ Size = MAP_APPFONT ( 78 , 8 ) ;
+ Text [ en-US ] = "A~ngle" ;
+ };
+ MetricField MTR_FLD_ANGLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 52 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 359 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = " degrees" ;
+ Last = 359 ;
+ SpinSize = 15 ;
+ };
+ Control CTL_ANGLE
+ {
+ HelpId = HID_TPHATCH_CTRL ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 72 ) ;
+ Size = MAP_APPFONT ( 39 , 39 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_LINE_TYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 123 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Line type" ;
+ };
+ ListBox LB_LINE_TYPE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 134 ) ;
+ Size = MAP_APPFONT ( 62 , 62 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Single" ; Default ; > ;
+ < "Crossed" ; Default ; > ;
+ < "Triple" ; Default ; > ;
+ };
+ };
+ FixedText FT_LINE_COLOR
+ {
+ Pos = MAP_APPFONT ( 12 , 150 ) ;
+ Size = MAP_APPFONT ( 49 , 8 ) ;
+ Text [ en-US ] = "Line ~color" ;
+ };
+ ListBox LB_LINE_COLOR
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 161 ) ;
+ Size = MAP_APPFONT ( 62 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ ListBox LB_HATCHINGS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 14 ) ;
+ Size = MAP_APPFONT ( 88 , 110 ) ;
+ TabStop = TRUE ;
+ };
+ Control CTL_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 131 ) ;
+ Size = MAP_APPFONT ( 88 , 42 ) ;
+ };
+ PushButton BTN_ADD
+ {
+ Pos = MAP_APPFONT ( 197 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_MODIFY
+ {
+ Pos = MAP_APPFONT ( 197 , 32 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Modify..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_DELETE
+ {
+ Pos = MAP_APPFONT ( 197 , 68 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete..." ;
+ TabStop = TRUE ;
+ };
+ ImageButton BTN_LOAD
+ {
+ Pos = MAP_APPFONT ( 197 , 104 ) ;
+ Size = MAP_APPFONT ( 16 , 16 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Load Hatches List" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "sc05501.bmp" ;
+ };
+ MASKCOLOR
+ };
+ };
+ ImageButton BTN_SAVE
+ {
+ Pos = MAP_APPFONT ( 197 , 124 ) ;
+ Size = MAP_APPFONT ( 16 , 16 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Save Hatches List" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "sc05502.bmp" ;
+ };
+ MASKCOLOR
+ };
+ };
+};
+ // RID_SVXPAGE_BITMAP -------------------------------------------------------
+TabPage RID_SVXPAGE_BITMAP
+{
+ HelpID = HID_AREA_BITMAP ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Bitmap Patterns" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_PROP
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Properties";
+ };
+ FixedText FT_PIXEL_EDIT
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 85 , 8 ) ;
+ Text [ en-US ] = "Pattern Editor";
+ };
+ Control CTL_PIXEL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 72 , 72 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_COLOR
+ {
+ Pos = MAP_APPFONT ( 12 , 104 ) ;
+ Size = MAP_APPFONT ( 85 , 8 ) ;
+ Text [ en-US ] = "~Foreground color";
+ };
+ ListBox LB_COLOR
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 115 ) ;
+ Size = MAP_APPFONT ( 62 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ FixedText FT_BACKGROUND_COLOR
+ {
+ Pos = MAP_APPFONT ( 12 , 131 ) ;
+ Size = MAP_APPFONT ( 85 , 8 ) ;
+ Text [ en-US ] = "~Background color";
+ };
+ ListBox LB_BACKGROUND_COLOR
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 142 ) ;
+ Size = MAP_APPFONT ( 62 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ FixedText FT_BITMAPS_HIDDEN
+ {
+ // Hidden label that provides the name for the bitmaps list box.
+ Text [ en-US ] = "Bitmap";
+ };
+ ListBox LB_BITMAPS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 14 ) ;
+ Size = MAP_APPFONT ( 88 , 110 ) ;
+ TabStop = TRUE ;
+ };
+ Control CTL_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 131 ) ;
+ Size = MAP_APPFONT ( 88 , 42 ) ;
+ };
+ PushButton BTN_ADD
+ {
+ Pos = MAP_APPFONT ( 197 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_MODIFY
+ {
+ Pos = MAP_APPFONT ( 197 , 32 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Modify..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_IMPORT
+ {
+ Pos = MAP_APPFONT ( 197 , 50 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Import..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_DELETE
+ {
+ Pos = MAP_APPFONT ( 197 , 68 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete..." ;
+ TabStop = TRUE ;
+ };
+ ImageButton BTN_LOAD
+ {
+ Pos = MAP_APPFONT ( 197 , 104 ) ;
+ Size = MAP_APPFONT ( 16 , 16 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Load Bitmap List" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "sc05501.bmp" ;
+ };
+ MASKCOLOR
+ };
+ };
+ ImageButton BTN_SAVE
+ {
+ Pos = MAP_APPFONT ( 197 , 124 ) ;
+ Size = MAP_APPFONT ( 16 , 16 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Save Bitmap List" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "sc05502.bmp" ;
+ };
+ MASKCOLOR
+ };
+ };
+};
+ // RID_SVXPAGE_GRADIENT -----------------------------------------------------
+TabPage RID_SVXPAGE_GRADIENT
+{
+ HelpID = HID_AREA_GRADIENT ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Gradients" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_PROP
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Properties";
+ };
+ FixedText FT_TYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 26 , 8 ) ;
+ Text [ en-US ] = "Ty~pe" ;
+ };
+ ListBox LB_GRADIENT_TYPES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 49 , 14 ) ;
+ Size = MAP_APPFONT ( 48, 63 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Linear" ; Default ; > ;
+ < "Axial" ; Default ; > ;
+ < "Radial" ; Default ; > ;
+ < "Ellipsoid" ; Default ; > ;
+ < "Square" ; Default ; > ;
+ < "Rectangular" ; Default ; > ;
+ };
+ };
+ FixedText FT_CENTER_X
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 37 , 8 ) ;
+ Text [ en-US ] = "Center ~X" ;
+ };
+ MetricField MTR_CENTER_X
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 49 , 30 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_CENTER_Y
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 37 , 8 ) ;
+ Text [ en-US ] = "Center ~Y" ;
+ };
+ MetricField MTR_CENTER_Y
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 49 , 46 ) ;
+ Size = MAP_APPFONT ( 40, 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_ANGLE
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 37 , 8 ) ;
+ Text [ en-US ] = "A~ngle" ;
+ };
+ MetricField MTR_ANGLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 49 , 62 ) ;
+ Size = MAP_APPFONT ( 40, 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 359 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = " degrees" ;
+ Last = 359 ;
+ SpinSize = 15 ;
+ };
+ FixedText FT_BORDER
+ {
+ Pos = MAP_APPFONT ( 12 , 80 ) ;
+ Size = MAP_APPFONT ( 32 , 8 ) ;
+ Text [ en-US ] = "~Border" ;
+ };
+ MetricField MTR_BORDER
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 49 , 78 ) ;
+ Size = MAP_APPFONT ( 40, 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_COLOR_FROM
+ {
+ Pos = MAP_APPFONT ( 12 , 99 ) ;
+ Size = MAP_APPFONT ( 32 , 8 ) ;
+ Text [ en-US ] = "~From" ;
+ };
+ ListBox LB_COLOR_FROM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 49 , 97 ) ;
+ Size = MAP_APPFONT ( 48, 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ MetricField MTR_COLOR_FROM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 49 , 113 ) ;
+ Size = MAP_APPFONT ( 40, 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_COLOR_TO
+ {
+ Pos = MAP_APPFONT ( 12 , 133 ) ;
+ Size = MAP_APPFONT ( 32 , 8 ) ;
+ Text [ en-US ] = "~To" ;
+ };
+ ListBox LB_COLOR_TO
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 49 , 131 ) ;
+ Size = MAP_APPFONT ( 48, 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ MetricField MTR_COLOR_TO
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 49 , 147 ) ;
+ Size = MAP_APPFONT ( 40, 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ ListBox LB_GRADIENTS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 103 , 14 ) ;
+ Size = MAP_APPFONT ( 88 , 110 ) ;
+ TabStop = TRUE ;
+ };
+ Control CTL_PREVIEW
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 103 , 131 ) ;
+ Size = MAP_APPFONT ( 88 , 42 ) ;
+ };
+ PushButton BTN_ADD
+ {
+ Pos = MAP_APPFONT ( 197 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_MODIFY
+ {
+ Pos = MAP_APPFONT ( 197 , 32 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Modify..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_DELETE
+ {
+ Pos = MAP_APPFONT ( 197 , 68 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete..." ;
+ TabStop = TRUE ;
+ };
+ ImageButton BTN_LOAD
+ {
+ Pos = MAP_APPFONT ( 197 , 104 ) ;
+ Size = MAP_APPFONT ( 16 , 16 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Load Gradients List" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "sc05501.bmp" ;
+ };
+ MASKCOLOR
+ };
+ };
+ ImageButton BTN_SAVE
+ {
+ Pos = MAP_APPFONT ( 197 , 124 ) ;
+ Size = MAP_APPFONT ( 16 , 16 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Save Gradients List" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "sc05502.bmp" ;
+ };
+ MASKCOLOR
+ };
+ };
+};
+ // RID_SVXPAGE_COLOR --------------------------------------------------------
+TabPage RID_SVXPAGE_COLOR
+{
+ HelpId = HID_OPTIONS_COLOR ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Colors" ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_PROP
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Properties";
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 28 , 8 ) ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit EDT_NAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 42 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_COLOR
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 28 , 8 ) ;
+ Text [ en-US ] = "C~olor" ;
+ };
+ ListBox LB_COLOR
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 42 , 30 ) ;
+ Size = MAP_APPFONT ( 76 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+
+ FixedText FT_TABLE_NAME
+ {
+ Pos = MAP_APPFONT ( 42 , 48 ) ;
+ Size = MAP_APPFONT ( 94 , 8 ) ;
+ Text [ en-US ] = "Color table" ;
+ };
+ Control CTL_COLORTABLE
+ {
+ Border = TRUE ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 42 , 59 ) ;
+ Size = MAP_APPFONT ( 94 , 117 ) ;
+ TabStop = TRUE ;
+ };
+
+ Control CTL_PREVIEW_OLD
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 157 , 14 ) ;
+ Size = MAP_APPFONT ( 34 , 25 ) ;
+ };
+ Control CTL_PREVIEW_NEW
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 157, 39 ) ;
+ Size = MAP_APPFONT ( 34 , 25 ) ;
+ };
+ ListBox LB_COLORMODEL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 157 , 71 ) ;
+ Size = MAP_APPFONT ( 34 , 12 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "RGB" ; Default ; > ;
+ < "CMYK" ; Default ; > ;
+ };
+ };
+ FixedText FT_1
+ {
+ Pos = MAP_APPFONT ( 142 , 89 ) ;
+ Size = MAP_APPFONT ( 15 , 8 ) ;
+ Text = "~C" ;
+ };
+ MetricField MTR_FLD_1
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 157 , 87 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ };
+ FixedText FT_2
+ {
+ Pos = MAP_APPFONT ( 142 , 105 ) ;
+ Size = MAP_APPFONT ( 15 , 8 ) ;
+ Text = "~M" ;
+ };
+ MetricField MTR_FLD_2
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 157 , 103 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ };
+ FixedText FT_3
+ {
+ Pos = MAP_APPFONT ( 142 , 121 ) ;
+ Size = MAP_APPFONT ( 15 , 8 ) ;
+ Text = "~Y" ;
+ };
+ MetricField MTR_FLD_3
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 157 , 119 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ };
+ FixedText FT_4
+ {
+ Pos = MAP_APPFONT ( 142 , 137 ) ;
+ Size = MAP_APPFONT ( 15 , 8 ) ;
+ Text = "~K" ;
+ };
+ MetricField MTR_FLD_4
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 157 , 135 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ };
+ PushButton BTN_ADD
+ {
+ Pos = MAP_APPFONT ( 197 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add" ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_WORK_ON
+ {
+ Pos = MAP_APPFONT ( 197 , 50 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Edit..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_DELETE
+ {
+ Pos = MAP_APPFONT ( 197 , 68 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_MODIFY
+ {
+ Pos = MAP_APPFONT ( 197, 32 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Modify" ;
+ TabStop = TRUE ;
+ };
+ ImageButton BTN_LOAD
+ {
+ Pos = MAP_APPFONT ( 197 , 104 ) ;
+ Size = MAP_APPFONT ( 16 , 16 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Load Color List" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "sc05501.bmp" ;
+ };
+ MASKCOLOR
+ };
+ };
+ ImageButton BTN_SAVE
+ {
+ Pos = MAP_APPFONT ( 197 , 124 ) ;
+ Size = MAP_APPFONT ( 16 , 16 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Save Color List" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "sc05502.bmp" ;
+ };
+ MASKCOLOR
+ };
+ };
+};
+ // RID_SVXDLG_AREA ----------------------------------------------------------
+TabDialog RID_SVXDLG_AREA
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Area" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_AREA ;
+ Text [ en-US ] = "Area" ;
+ PageResID = RID_SVXPAGE_AREA ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_SHADOW ;
+ PageResID = RID_SVXPAGE_SHADOW ;
+ Text [ en-US ] = "Shadow" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_TRANSPARENCE ;
+ Text [ en-US ] = "Transparency";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_COLOR ;
+ Text [ en-US ] = "Colors" ;
+ PageResID = RID_SVXPAGE_COLOR ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_GRADIENT ;
+ Text [ en-US ] = "Gradients" ;
+ PageResID = RID_SVXPAGE_GRADIENT ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_HATCH ;
+ Text [ en-US ] = "Hatching" ;
+ PageResID = RID_SVXPAGE_HATCH ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_BITMAP ;
+ Text [ en-US ] = "Bitmaps" ;
+ PageResID = RID_SVXPAGE_BITMAP ;
+ };
+ };
+ };
+};
+
+Image RID_SVXIMG_LOAD_H
+{
+ ImageBitmap = Bitmap
+ {
+ File = "sch05501.bmp" ;
+ };
+ MASKCOLOR
+};
+
+Image RID_SVXIMG_SAVE_H
+{
+ ImageBitmap = Bitmap
+ {
+ File = "sch05502.bmp" ;
+ };
+ MASKCOLOR
+};
+
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx
new file mode 100644
index 000000000000..c25aabb5aeed
--- /dev/null
+++ b/cui/source/tabpages/tabline.cxx
@@ -0,0 +1,300 @@
+/*************************************************************************
+ *
+ * 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: tabline.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+
+#define _SVX_TABLINE_CXX
+#include <svx/dialogs.hrc>
+#include "tabline.hrc"
+//#include "dlgname.hrc"
+
+#include "cuitabarea.hxx"
+#include "cuitabline.hxx"
+#include "dlgname.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/xtable.hxx>
+#include "svx/drawitem.hxx"
+
+#define DLGWIN this->GetParent()->GetParent()
+
+#define BITMAP_WIDTH 32
+#define BITMAP_HEIGHT 12
+#define XOUT_WIDTH 150
+
+/*************************************************************************
+|*
+|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+|*
+\************************************************************************/
+
+SvxLineTabDialog::SvxLineTabDialog
+(
+ Window* pParent,
+ const SfxItemSet* pAttr,
+ SdrModel* pModel,
+ const SdrObject* pSdrObj,
+ BOOL bHasObj
+) :
+
+ SfxTabDialog ( pParent, SVX_RES( RID_SVXDLG_LINE ), pAttr ),
+ pDrawModel ( pModel ),
+ pObj ( pSdrObj ),
+ rOutAttrs ( *pAttr ),
+ pColorTab ( pModel->GetColorTable() ),
+ mpNewColorTab ( pModel->GetColorTable() ),
+ pDashList ( pModel->GetDashList() ),
+ pNewDashList ( pModel->GetDashList() ),
+ pLineEndList ( pModel->GetLineEndList() ),
+ pNewLineEndList ( pModel->GetLineEndList() ),
+ bObjSelected ( bHasObj ),
+ nLineEndListState( CT_NONE ),
+ nDashListState( CT_NONE ),
+ mnColorTableState( CT_NONE ),
+ nPageType( 0 ), // wird hier in erster Linie benutzt, um mit FillItemSet
+ // die richtigen Attribute zu erhalten ( noch Fragen? )
+ nDlgType( 0 ),
+ nPosDashLb( 0 ),
+ nPosLineEndLb( 0 ),
+ mnPos( 0 ),
+ mbAreaTP( sal_False ),
+ mbDeleteColorTable( TRUE )
+{
+ FreeResource();
+
+ bool bLineOnly = false;
+ if( pObj && pObj->GetObjInventor() == SdrInventor )
+ {
+ switch( pObj->GetObjIdentifier() )
+ {
+ case OBJ_LINE:
+ case OBJ_PLIN:
+ case OBJ_PATHLINE:
+ case OBJ_FREELINE:
+ case OBJ_MEASURE:
+ case OBJ_EDGE:
+ bLineOnly = true;
+
+ default:
+ break;
+ }
+
+ }
+
+ AddTabPage( RID_SVXPAGE_LINE, SvxLineTabPage::Create, 0);
+ if( bLineOnly )
+ AddTabPage( RID_SVXPAGE_SHADOW, SvxShadowTabPage::Create, 0 );
+ else
+ RemoveTabPage( RID_SVXPAGE_SHADOW );
+
+ AddTabPage( RID_SVXPAGE_LINE_DEF, SvxLineDefTabPage::Create, 0);
+ AddTabPage( RID_SVXPAGE_LINEEND_DEF, SvxLineEndDefTabPage::Create, 0);
+// AddTabPage( RID_SVXPAGE_COLOR, SvxColorTabPage::Create, 0 );
+
+ SetCurPageId( RID_SVXPAGE_LINE );
+
+ CancelButton& rBtnCancel = GetCancelButton();
+ rBtnCancel.SetClickHdl( LINK( this, SvxLineTabDialog, CancelHdlImpl ) );
+//! rBtnCancel.SetText( SVX_RESSTR( RID_SVXSTR_CLOSE ) );
+}
+
+// -----------------------------------------------------------------------
+
+SvxLineTabDialog::~SvxLineTabDialog()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineTabDialog::SavePalettes()
+{
+ SfxObjectShell* pShell = SfxObjectShell::Current();
+ if( mpNewColorTab != pDrawModel->GetColorTable() )
+ {
+ if(mbDeleteColorTable)
+ delete pDrawModel->GetColorTable();
+ pDrawModel->SetColorTable( mpNewColorTab );
+ if ( pShell )
+ pShell->PutItem( SvxColorTableItem( mpNewColorTab, SID_COLOR_TABLE ) );
+ pColorTab = pDrawModel->GetColorTable();
+ }
+ if( pNewDashList != pDrawModel->GetDashList() )
+ {
+ delete pDrawModel->GetDashList();
+ pDrawModel->SetDashList( pNewDashList );
+ if ( pShell )
+ pShell->PutItem( SvxDashListItem( pNewDashList, SID_DASH_LIST ) );
+ pDashList = pDrawModel->GetDashList();
+ }
+ if( pNewLineEndList != pDrawModel->GetLineEndList() )
+ {
+ delete pDrawModel->GetLineEndList();
+ pDrawModel->SetLineEndList( pNewLineEndList );
+ if ( pShell )
+ pShell->PutItem( SvxLineEndListItem( pNewLineEndList, SID_LINEEND_LIST ) );
+ pLineEndList = pDrawModel->GetLineEndList();
+ }
+
+ // Speichern der Tabellen, wenn sie geaendert wurden.
+
+ const String aPath( SvtPathOptions().GetPalettePath() );
+
+ if( nDashListState & CT_MODIFIED )
+ {
+ pDashList->SetPath( aPath );
+ pDashList->Save();
+
+ // ToolBoxControls werden benachrichtigt:
+ if ( pShell )
+ pShell->PutItem( SvxDashListItem( pDashList, SID_DASH_LIST ) );
+ }
+
+ if( nLineEndListState & CT_MODIFIED )
+ {
+ pLineEndList->SetPath( aPath );
+ pLineEndList->Save();
+
+ // ToolBoxControls werden benachrichtigt:
+ if ( pShell )
+ pShell->PutItem( SvxLineEndListItem( pLineEndList, SID_LINEEND_LIST ) );
+ }
+
+ if( mnColorTableState & CT_MODIFIED )
+ {
+ pColorTab->SetPath( aPath );
+ pColorTab->Save();
+
+ // ToolBoxControls werden benachrichtigt:
+ if ( pShell )
+ pShell->PutItem( SvxColorTableItem( pColorTab, SID_COLOR_TABLE ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+short SvxLineTabDialog::Ok()
+{
+ SavePalettes();
+
+ // Es wird RET_OK zurueckgeliefert, wenn wenigstens eine
+ // TabPage in FillItemSet() TRUE zurueckliefert. Dieses
+ // geschieht z.Z. standardmaessig.
+ return( SfxTabDialog::Ok() );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxLineTabDialog, CancelHdlImpl, void *, EMPTYARG )
+{
+ SavePalettes();
+
+ EndDialog( RET_CANCEL );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxLineTabDialog, CancelHdlImpl, void *, EMPTYARG )
+
+// -----------------------------------------------------------------------
+
+void SvxLineTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage )
+{
+ switch( nId )
+ {
+ case RID_SVXPAGE_LINE:
+ ( (SvxLineTabPage&) rPage ).SetColorTable( pColorTab );
+ ( (SvxLineTabPage&) rPage ).SetDashList( pDashList );
+ ( (SvxLineTabPage&) rPage ).SetLineEndList( pLineEndList );
+ ( (SvxLineTabPage&) rPage ).SetDlgType( nDlgType );//CHINA001 ( (SvxLineTabPage&) rPage ).SetDlgType( &nDlgType );
+ ( (SvxLineTabPage&) rPage ).SetPageType( nPageType );//CHINA001 ( (SvxLineTabPage&) rPage ).SetPageType( &nPageType );
+ ( (SvxLineTabPage&) rPage ).SetPosDashLb( &nPosDashLb );
+ ( (SvxLineTabPage&) rPage ).SetPosLineEndLb( &nPosLineEndLb );
+ ( (SvxLineTabPage&) rPage ).SetDashChgd( &nDashListState );
+ ( (SvxLineTabPage&) rPage ).SetLineEndChgd( &nLineEndListState );
+ ( (SvxLineTabPage&) rPage ).SetObjSelected( bObjSelected );
+ ( (SvxLineTabPage&) rPage ).Construct();
+ ( (SvxLineTabPage&) rPage ).SetColorChgd( &mnColorTableState );
+ // ActivatePage() wird das erste mal nicht gerufen
+ ( (SvxLineTabPage&) rPage ).ActivatePage( rOutAttrs );
+ break;
+
+ case RID_SVXPAGE_LINE_DEF:
+ ( (SvxLineDefTabPage&) rPage ).SetDashList( pDashList );
+ ( (SvxLineDefTabPage&) rPage ).SetDlgType( &nDlgType );
+ ( (SvxLineDefTabPage&) rPage ).SetPageType( &nPageType );
+ ( (SvxLineDefTabPage&) rPage ).SetPosDashLb( &nPosDashLb );
+ ( (SvxLineDefTabPage&) rPage ).SetDashChgd( &nDashListState );
+ ( (SvxLineDefTabPage&) rPage ).SetObjSelected( bObjSelected );
+ ( (SvxLineDefTabPage&) rPage ).Construct();
+ break;
+
+ case RID_SVXPAGE_LINEEND_DEF:
+ ( (SvxLineEndDefTabPage&) rPage ).SetLineEndList( pLineEndList );
+ ( (SvxLineEndDefTabPage&) rPage ).SetPolyObj( pObj );
+ ( (SvxLineEndDefTabPage&) rPage ).SetDlgType( &nDlgType );
+ ( (SvxLineEndDefTabPage&) rPage ).SetPageType( &nPageType );
+ ( (SvxLineEndDefTabPage&) rPage ).SetPosLineEndLb( &nPosLineEndLb );
+ ( (SvxLineEndDefTabPage&) rPage ).SetLineEndChgd( &nLineEndListState );
+ ( (SvxLineEndDefTabPage&) rPage ).SetObjSelected( bObjSelected );
+ ( (SvxLineEndDefTabPage&) rPage ).Construct();
+ break;
+
+ case RID_SVXPAGE_SHADOW:
+ {
+ ( (SvxShadowTabPage&) rPage ).SetColorTable( pColorTab );
+ ( (SvxShadowTabPage&) rPage ).SetPageType( nPageType );
+ ( (SvxShadowTabPage&) rPage ).SetDlgType( nDlgType );
+ ( (SvxShadowTabPage&) rPage ).SetAreaTP( &mbAreaTP );
+ ( (SvxShadowTabPage&) rPage ).SetColorChgd( &mnColorTableState );
+ ( (SvxShadowTabPage&) rPage ).Construct();
+ }
+ break;
+/*
+ case RID_SVXPAGE_COLOR:
+ ( (SvxColorTabPage&) rPage ).SetColorTable( pColorTab );
+ ( (SvxColorTabPage&) rPage ).SetPageType( &nPageType );
+ ( (SvxColorTabPage&) rPage ).SetDlgType( &nDlgType );
+ ( (SvxColorTabPage&) rPage ).SetPos( &mnPos );
+ ( (SvxColorTabPage&) rPage ).SetAreaTP( &mbAreaTP );
+ ( (SvxColorTabPage&) rPage ).SetColorChgd( &mnColorTableState );
+ ( (SvxColorTabPage&) rPage ).SetDeleteColorTable( mbDeleteColorTable );
+ ( (SvxColorTabPage&) rPage ).Construct();
+ break;
+*/
+ }
+}
+
+
diff --git a/cui/source/tabpages/tabline.hrc b/cui/source/tabpages/tabline.hrc
new file mode 100644
index 000000000000..c1e884ad4ab3
--- /dev/null
+++ b/cui/source/tabpages/tabline.hrc
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * 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: tabline.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 1
+#define LB_COLOR 1
+#define FT_COLOR 1
+#define LB_LINE_STYLE 2
+#define FT_LINE_STYLE 3
+#define FT_LINE_WIDTH 2
+#define MTR_FLD_LINE_WIDTH 1
+#define TSB_INVISIBLE 1
+#define FL_LINE 1
+#define FL_LINE_ENDS 2
+#define FT_LINE_START 4
+#define FT_LINE_END 8
+#define FT_LINE_ENDS_STYLE 5
+#define FT_LINE_ENDS_WIDTH 6
+#define LB_START_STYLE 3
+#define LB_END_STYLE 4
+#define MTR_FLD_START_WIDTH 3
+#define MTR_FLD_END_WIDTH 2
+#define CBX_SYNCHRONIZE 1
+#define FL_MEASURING 3
+#define CTL_POSITION 2
+#define FT_POSITION 9
+#define TSB_SHOW_MEASURING 2
+#define CTL_PREVIEW 1
+#define FL_DEFINITION 1
+#define FT_NUMBER 3
+#define FT_DISTANCE 2
+#define FT_LENGTH 4
+#define TSB_SYNCHRONIZE 3
+#define LB_TYPE_1 3
+#define FT_TYPE 1
+#define LB_TYPE_2 1
+#define NUM_FLD_1 1
+#define NUM_FLD_2 2
+#define MTR_FLD_DISTANCE 1
+#define MTR_FLD_LENGTH_1 3
+#define MTR_FLD_LENGTH_2 4
+#define FT_LINESTYLE 10
+#define LB_LINESTYLES 2
+#define BTN_ADD 1
+#define BTN_MODIFY 2
+#define BTN_DELETE 3
+#define BTN_LOAD 5
+#define BTN_SAVE 6
+#define EDT_NAME 1
+#define LB_LINEENDS 1
+#define FL_TIP 1
+#define FI_TIP 10
+#define TSB_CENTER_START 4
+#define TSB_CENTER_END 5
+#define FT_TRANSPARENT 10
+#define MTR_LINE_TRANSPARENT 5
+#define FL_SEPARATOR 4
+#define FT_LINE_END_STYLE 11
+#define FT_TITLE 12
+
+// #116827#
+#define FL_EDGE_STYLE 5
+#define FT_EDGE_STYLE 13
+#define LB_EDGE_STYLE 5
+
+//Symbole (fuer StarChart)
+#define FT_SYMBOL_WIDTH 20
+#define FT_SYMBOL_HEIGHT 21
+#define MF_SYMBOL_WIDTH 22
+#define MF_SYMBOL_HEIGHT 23
+#define CB_SYMBOL_RATIO 24
+#define FL_SYMBOL_FORMAT 25
+#define MB_SYMBOL_BITMAP 26
+
+
+#define MN_GRAPHIC_DLG 1
+#define MN_GALLERY 2
+#define MN_SYMBOLS 3
+#define MN_SYMBOLS_NONE 4
+#define MN_SYMBOLS_AUTO 5
+#define MN_GALLERY_ENTRY 100
+
+
diff --git a/cui/source/tabpages/tabline.src b/cui/source/tabpages/tabline.src
new file mode 100644
index 000000000000..55e50c0e78b4
--- /dev/null
+++ b/cui/source/tabpages/tabline.src
@@ -0,0 +1,803 @@
+/*************************************************************************
+ *
+ * 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: tabline.src,v $
+ * $Revision: 1.45 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "tabline.hrc"
+
+// Selecting LineStyle / Color / Width --------------------
+
+#define MASKCOLOR MaskColor = Color{ Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+
+TabPage RID_SVXPAGE_LINE
+{
+ Size = MAP_APPFONT ( 260 , 185 );
+ HelpId = HID_LINE_LINE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Lines" ;
+ FixedLine FL_LINE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
+ Text [ en-US ] = "Line properties" ;
+ };
+ FixedText FT_LINE_STYLE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "~Style" ;
+ };
+ ListBox LB_LINE_STYLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 100 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ FixedText FT_COLOR
+ {
+ Pos = MAP_APPFONT ( 12 , 41 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "Colo~r" ;
+ };
+ ListBox LB_COLOR
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 52 ) ;
+ Size = MAP_APPFONT ( 100 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ FixedText FT_LINE_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 68 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "~Width" ;
+ };
+ MetricField MTR_FLD_LINE_WIDTH
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 79 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Right = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 5000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Value = 1 ;
+ Unit = FUNIT_MM ;
+ Last = 5000 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_TRANSPARENT
+ {
+ Pos = MAP_APPFONT ( 12 , 95 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "~Transparency" ;
+ };
+ MetricField MTR_LINE_TRANSPARENT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 106 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 118 , 14 ) ;
+ Size = MAP_APPFONT ( 6 , 111 ) ;
+ Vert = TRUE;
+ };
+ FixedLine FL_LINE_ENDS
+ {
+ Pos = MAP_APPFONT ( 124 , 3 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+ Text [ en-US ] = "Arrow styles" ;
+ };
+ FixedText FT_LINE_ENDS_STYLE
+ {
+ Pos = MAP_APPFONT ( 130 , 14 ) ;
+ Size = MAP_APPFONT ( 118 , 8 ) ;
+ Text [ en-US ] = "St~yle" ;
+ };
+ ListBox LB_START_STYLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 25 ) ;
+ Size = MAP_APPFONT ( 57 , 99 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ ListBox LB_END_STYLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 191 , 25 ) ;
+ Size = MAP_APPFONT ( 57 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ FixedText FT_LINE_ENDS_WIDTH
+ {
+ Pos = MAP_APPFONT ( 130 , 41 ) ;
+ Size = MAP_APPFONT ( 118 , 8 ) ;
+ Text [ en-US ] = "Wi~dth" ;
+ };
+ MetricField MTR_FLD_START_WIDTH
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 52 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Right = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 5000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Value = 1 ;
+ Unit = FUNIT_MM ;
+ Last = 5000 ;
+ SpinSize = 10 ;
+ };
+ MetricField MTR_FLD_END_WIDTH
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 191 , 52 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Right = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 5000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Value = 1 ;
+ Unit = FUNIT_MM ;
+ Last = 5000 ;
+ SpinSize = 10 ;
+ };
+ TriStateBox TSB_CENTER_START
+ {
+ Pos = MAP_APPFONT ( 130 , 68 ) ;
+ Size = MAP_APPFONT ( 57 , 10 ) ;
+ Text [ en-US ] = "Ce~nter" ;
+ TabStop = TRUE ;
+ };
+ TriStateBox TSB_CENTER_END
+ {
+ Pos = MAP_APPFONT ( 191 , 68 ) ;
+ Size = MAP_APPFONT ( 57 , 10 ) ;
+ Text [ en-US ] = "C~enter" ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_SYNCHRONIZE
+ {
+ // #116827#
+ // Pos = MAP_APPFONT ( 130 , 107 ) ;
+ Pos = MAP_APPFONT ( 130 , 68 + (16 - 4) ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "Synchroni~ze ends" ;
+ TabStop = TRUE ;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+ // #116827#
+
+ FixedLine FL_EDGE_STYLE
+ {
+ Pos = MAP_APPFONT ( 124 , 3 + (16 * 6) - 4 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+ Text [ en-US ] = "Corner style" ;
+ };
+ FixedText FT_EDGE_STYLE
+ {
+ Pos = MAP_APPFONT ( 130 , 14 + (16 * 6) - 4 ) ;
+ Size = MAP_APPFONT ( 118 , 8 ) ;
+ Text [ en-US ] = "Sty~le" ;
+ };
+ ListBox LB_EDGE_STYLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 25 + (16 * 6) - 4 ) ;
+ Size = MAP_APPFONT ( 57 , 99 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Rounded" ; Default ; > ;
+ < "- none -" ; > ;
+ < "Mitered" ; > ;
+ < "Beveled" ; > ;
+ };
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ Control CTL_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 135 ) ;
+ Size = MAP_APPFONT ( 248 , 40 ) ;
+ };
+
+ //#58425# Symbole auf einer Linie (z.B. StarChart) ->
+ FixedLine FL_SYMBOL_FORMAT
+ {
+ Hide = TRUE ;
+
+ Pos = MAP_APPFONT ( 124 , 3 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+ Text [ en-US ] = "Icon";
+ };
+
+ MenuButton MB_SYMBOL_BITMAP
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ ButtonMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_SYMBOLS_NONE;
+ Text [ en-US ] = "No Symbol";
+ };
+ MenuItem
+ {
+ Identifier = MN_SYMBOLS_AUTO;
+ Text [ en-US ] = "Automatic";
+ };
+ MenuItem
+ {
+ Identifier = MN_GRAPHIC_DLG ;
+ Text [ en-US ] = "From file..." ;
+ };
+ MenuItem
+ {
+ Identifier = MN_GALLERY ;
+ Text [ en-US ] = "Gallery";
+ };
+ MenuItem
+ {
+ Identifier = MN_SYMBOLS;
+ Text [ en-US ] = "Symbols";
+ };
+ };
+ };
+ Text [ en-US ] = "Select..." ;
+ };
+ FixedText FT_SYMBOL_WIDTH
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 32 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] = "Width" ;
+ };
+ MetricField MF_SYMBOL_WIDTH
+ {
+ Pos = MAP_APPFONT ( 191 , 30 );
+ Size = MAP_APPFONT ( 57 , 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 ;
+ Hide = TRUE ;
+ };
+ FixedText FT_SYMBOL_HEIGHT
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 48 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] = "Height" ;
+ };
+ MetricField MF_SYMBOL_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 191 , 46 );
+ Size = MAP_APPFONT ( 57 , 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 ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_SYMBOL_RATIO
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 62 );
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "Keep ratio" ;
+ };
+};
+
+// Defining LineStyles --------------------
+
+TabPage RID_SVXPAGE_LINE_DEF
+{
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ HelpId = HID_LINE_DEF ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Define line styles" ;
+
+ FixedLine FL_DEFINITION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Properties" ;
+ };
+ FixedText FT_TYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 34 ) ;
+ Size = MAP_APPFONT ( 52 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ };
+ ListBox LB_TYPE_1
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , 32 ) ;
+ Size = MAP_APPFONT ( 43 , 49 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Dot" ; Default ; > ;
+ < "Dash" ; Default ; > ;
+ };
+ };
+ ListBox LB_TYPE_2
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 113 , 32 ) ;
+ Size = MAP_APPFONT ( 43 , 49 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Dot" ; Default ; > ;
+ < "Dash" ; Default ; > ;
+ };
+ };
+ FixedText FT_NUMBER
+ {
+ Pos = MAP_APPFONT ( 12 , 50 ) ;
+ Size = MAP_APPFONT ( 52 , 8 ) ;
+ Text [ en-US ] = "~Number" ;
+ };
+ NumericField NUM_FLD_1
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , 48 ) ;
+ Size = MAP_APPFONT ( 43 , 12 ) ;
+ TabStop = TRUE ;
+ Right = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ StrictFormat = TRUE ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ };
+ NumericField NUM_FLD_2
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 113 , 48 ) ;
+ Size = MAP_APPFONT ( 43 , 12 ) ;
+ TabStop = TRUE ;
+ Right = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ StrictFormat = TRUE ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_LENGTH
+ {
+ Pos = MAP_APPFONT ( 12 , 66 ) ;
+ Size = MAP_APPFONT ( 52 , 8 ) ;
+ Text [ en-US ] = "~Length" ;
+ };
+ MetricField MTR_FLD_LENGTH_1
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , 64 ) ;
+ Size = MAP_APPFONT ( 43 , 12 ) ;
+ TabStop = TRUE ;
+ Right = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ Maximum = 5000 ;
+ Last = 5000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Value = 1 ;
+ Unit = FUNIT_MM ;
+ CustomUnitText = " %" ;
+ SpinSize = 10 ;
+ };
+ MetricField MTR_FLD_LENGTH_2
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 113 , 64 ) ;
+ Size = MAP_APPFONT ( 43 , 12 ) ;
+ TabStop = TRUE ;
+ Right = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ Maximum = 5000 ;
+ Last = 5000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Value = 1 ;
+ Unit = FUNIT_MM ;
+ CustomUnitText = " %" ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_DISTANCE
+ {
+ Pos = MAP_APPFONT ( 12 , 81 ) ;
+ Size = MAP_APPFONT ( 52 , 8 ) ;
+ Text [ en-US ] = "~Spacing" ;
+ };
+ MetricField MTR_FLD_DISTANCE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , 79 ) ;
+ Size = MAP_APPFONT ( 43 , 12 ) ;
+ TabStop = TRUE ;
+ Right = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 5000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Value = 1 ;
+ Unit = FUNIT_MM ;
+ CustomUnitText = " %" ;
+ Last = 5000 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CBX_SYNCHRONIZE
+ {
+ Pos = MAP_APPFONT ( 12 , 95 ) ;
+ Size = MAP_APPFONT ( 174 , 10 ) ;
+ Text [ en-US ] = "~Fit to line width" ;
+ TabStop = TRUE ;
+ };
+
+ // ----------------------------------------
+
+ FixedText FT_LINESTYLE
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 52 , 8 ) ;
+ Text [ en-US ] = "Line style" ;
+ };
+ ListBox LB_LINESTYLES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , 14 ) ;
+ Size = MAP_APPFONT ( 120 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ PushButton BTN_ADD
+ {
+ Pos = MAP_APPFONT ( 198 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_MODIFY
+ {
+ Pos = MAP_APPFONT ( 198 , 34 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Modify..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_DELETE
+ {
+ Pos = MAP_APPFONT ( 198 , 54 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete..." ;
+ TabStop = TRUE ;
+ };
+ ImageButton BTN_LOAD
+ {
+ Pos = MAP_APPFONT ( 198 , 74 ) ;
+ Size = MAP_APPFONT ( 16 , 16 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Load Line Styles" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "sc05501.bmp" ;
+ };
+ MASKCOLOR
+ };
+ };
+ ImageButton BTN_SAVE
+ {
+ Pos = MAP_APPFONT ( 198 , 96 ) ;
+ Size = MAP_APPFONT ( 16 , 16 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Save Line Styles" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "sc05502.bmp" ;
+ };
+ MASKCOLOR
+ };
+ };
+ Control CTL_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 135 ) ;
+ Size = MAP_APPFONT ( 248 , 40 ) ;
+ };
+
+};
+
+// Defining LineEnds --------------------
+
+TabPage RID_SVXPAGE_LINEEND_DEF
+{
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ HelpId = HID_LINE_ENDDEF ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Arrowheads" ;
+
+ FixedLine FL_TIP
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Organize arrow styles" ;
+ };
+ FixedText FI_TIP
+ {
+ Pos = MAP_APPFONT ( 6 , 123 ) ;
+ Size = MAP_APPFONT ( 252 , 8 ) ;
+ Text [ en-US ] = "Add a selected object to create new arrow styles." ;
+ WordBreak = TRUE ;
+ };
+
+ FixedText FT_LINE_END_STYLE
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Text [ en-US ] = "Arrow style" ;
+ };
+ Edit EDT_NAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 98 , 14 ) ;
+ Size = MAP_APPFONT ( 87 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_TITLE
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Text [ en-US ] = "~Title" ;
+ };
+ ListBox LB_LINEENDS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 98 , 30 ) ;
+ Size = MAP_APPFONT ( 87 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ PushButton BTN_ADD
+ {
+ Pos = MAP_APPFONT ( 198 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_MODIFY
+ {
+ Pos = MAP_APPFONT ( 198 , 34 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Modify..." ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_DELETE
+ {
+ Pos = MAP_APPFONT ( 198 , 54 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete..." ;
+ TabStop = TRUE ;
+ };
+ ImageButton BTN_LOAD
+ {
+ Pos = MAP_APPFONT ( 198 , 74 ) ;
+ Size = MAP_APPFONT ( 16 , 16 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Load Arrow Styles" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "sc05501.bmp" ;
+ };
+ MASKCOLOR
+ };
+ };
+ ImageButton BTN_SAVE
+ {
+ Pos = MAP_APPFONT ( 198 , 96 ) ;
+ Size = MAP_APPFONT ( 16 , 16 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Save Arrow Styles" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "sc05502.bmp" ;
+ };
+ MASKCOLOR
+ };
+ };
+
+ Control CTL_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 135 ) ;
+ Size = MAP_APPFONT ( 248 , 40 ) ;
+ };
+
+};
+ // RID_SVXDLG_LINE ----------------------------------------------------------
+TabDialog RID_SVXDLG_LINE
+{
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Line" ;
+ Moveable = TRUE ;
+ TabControl TAB_CONTROL
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_LINE ;
+ Text [ en-US ] = "Line" ;
+ PageResID = RID_SVXPAGE_LINE ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_SHADOW ;
+ PageResID = RID_SVXPAGE_SHADOW ;
+ Text [ en-US ] = "Shadow" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_LINE_DEF ;
+ Text [ en-US ] = "Line Styles" ;
+ PageResID = RID_SVXPAGE_LINE_DEF ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_LINEEND_DEF ;
+ Text [ en-US ] = "Arrow Styles" ;
+ PageResID = RID_SVXPAGE_LINEEND_DEF ;
+ };
+/*
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_COLOR ;
+ Text [ en-US ] = "Colors" ;
+ PageResID = RID_SVXPAGE_COLOR ;
+ };
+*/
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx
new file mode 100644
index 000000000000..a1effa923086
--- /dev/null
+++ b/cui/source/tabpages/tabstpge.cxx
@@ -0,0 +1,746 @@
+/*************************************************************************
+ *
+ * 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: tabstpge.cxx,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/app.hxx>
+#include <tools/shl.hxx>
+#include <svtools/ruler.hxx>
+
+#define _SVX_TABSTPGE_CXX
+
+#include <svx/dialogs.hrc>
+#include "tabstpge.hrc"
+#include <svx/lrspitem.hxx>
+#include "tabstpge.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include <sfx2/module.hxx>
+#include <svl/cjkoptions.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/request.hxx> //CHINA001
+#include <svx/svxids.hrc> //add CHINA001
+#include <svl/intitem.hxx> //add CHINA001
+
+// class TabWin_Impl -----------------------------------------------------
+
+class TabWin_Impl : public Window
+{
+private:
+ USHORT nTabStyle;
+
+public:
+ TabWin_Impl( Window* pParent, const ResId& rId, USHORT nStyle ) :
+ Window( pParent, rId ),
+ nTabStyle( nStyle ) {}
+
+ virtual void Paint( const Rectangle& rRect );
+};
+
+// static ----------------------------------------------------------------
+
+static USHORT pRanges[] =
+{
+ SID_ATTR_TABSTOP,
+ SID_ATTR_TABSTOP_OFFSET,
+ 0
+};
+
+// C-Funktion ------------------------------------------------------------
+
+void FillUpWithDefTabs_Impl( long nDefDist, SvxTabStopItem& rTabs )
+{
+ if( rTabs.Count() )
+ return;
+ {
+ SvxTabStop aSwTabStop( nDefDist, SVX_TAB_ADJUST_DEFAULT );
+ rTabs.Insert( aSwTabStop );
+ }
+}
+
+// class TabWin_Impl -----------------------------------------------------
+
+void TabWin_Impl::Paint( const Rectangle& )
+{
+ // Tabulatoren malen
+ Point aPnt;
+ Size aSize = GetOutputSizePixel();
+ aPnt.X() = aSize.Width() / 2;
+ aPnt.Y() = aSize.Height() / 2;
+ Ruler::DrawTab( this, aPnt, nTabStyle );
+}
+
+// class SvxTabulatorTabPage ---------------------------------------------
+
+SvxTabulatorTabPage::SvxTabulatorTabPage( Window* pParent,
+ const SfxItemSet& rAttr ):
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_TABULATOR ), rAttr ),
+
+ aTabBox ( this, SVX_RES( ED_TABPOS ) ),
+ aTabLabel ( this, SVX_RES( FL_TABPOS ) ),
+ aTabLabelVert ( this, SVX_RES( FL_TABPOS_VERT ) ),
+ aLeftTab ( this, SVX_RES( BTN_TABTYPE_LEFT ) ),
+ aRightTab ( this, SVX_RES( BTN_TABTYPE_RIGHT ) ),
+ aCenterTab ( this, SVX_RES( BTN_TABTYPE_CENTER ) ),
+ aDezTab ( this, SVX_RES( BTN_TABTYPE_DECIMAL ) ),
+ pLeftWin ( new TabWin_Impl( this, SVX_RES( WIN_TABLEFT ), (USHORT)(RULER_TAB_LEFT|WB_HORZ) ) ),
+ pRightWin ( new TabWin_Impl( this, SVX_RES( WIN_TABRIGHT ), (USHORT)(RULER_TAB_RIGHT|WB_HORZ) ) ),
+ pCenterWin ( new TabWin_Impl( this, SVX_RES( WIN_TABCENTER ), (USHORT)(RULER_TAB_CENTER|WB_HORZ) ) ),
+ pDezWin ( new TabWin_Impl( this, SVX_RES( WIN_TABDECIMAL ), (USHORT)(RULER_TAB_DECIMAL|WB_HORZ) ) ),
+ aDezCharLabel ( this, SVX_RES( FT_TABTYPE_DECCHAR ) ),
+ aDezChar ( this, SVX_RES( ED_TABTYPE_DECCHAR ) ),
+ aTabTypeLabel ( this, SVX_RES( FL_TABTYPE ) ),
+ aNoFillChar ( this, SVX_RES( BTN_FILLCHAR_NO ) ),
+ aFillPoints ( this, SVX_RES( BTN_FILLCHAR_POINTS ) ),
+ aFillDashLine ( this, SVX_RES( BTN_FILLCHAR_DASHLINE ) ),
+ aFillSolidLine ( this, SVX_RES( BTN_FILLCHAR_UNDERSCORE ) ),
+ aFillSpecial ( this, SVX_RES( BTN_FILLCHAR_OTHER ) ),
+ aFillChar ( this, SVX_RES( ED_FILLCHAR_OTHER ) ),
+ aFillLabel ( this, SVX_RES( FL_FILLCHAR ) ),
+ aNewBtn ( this, SVX_RES( BTN_NEW ) ),
+ aDelAllBtn ( this, SVX_RES( BTN_DELALL ) ),
+ aDelBtn ( this, SVX_RES( BTN_DEL ) ),
+
+ aAktTab ( 0 ),
+ aNewTabs ( 0, 0, SVX_TAB_ADJUST_LEFT, GetWhich( SID_ATTR_TABSTOP ) ),
+ nDefDist ( 0 ),
+ eDefUnit( FUNIT_100TH_MM ),
+ bCheck ( FALSE )
+
+{
+ SvtCJKOptions aCJKOptions;
+ if(aCJKOptions.IsAsianTypographyEnabled())
+ {
+ aLeftTab .SetText(String(SVX_RES( ST_LEFTTAB_ASIAN )));
+ aRightTab .SetText(String(SVX_RES( ST_RIGHTTAB_ASIAN )));
+ }
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+
+ // Metrik einstellen
+ FieldUnit eFUnit = GetModuleFieldUnit( &rAttr );
+ SetFieldUnit( aTabBox, eFUnit );
+
+ // Buttons initialisieren
+ aNewBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, NewHdl_Impl ) );
+ aDelBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, DelHdl_Impl ) );
+ aDelAllBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, DelAllHdl_Impl ) );
+
+ Link aLink = LINK( this, SvxTabulatorTabPage, TabTypeCheckHdl_Impl );
+ aLeftTab.SetClickHdl( aLink );
+ aRightTab.SetClickHdl( aLink );
+ aDezTab.SetClickHdl( aLink );
+ aCenterTab.SetClickHdl( aLink );
+
+ aDezChar.SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage, GetDezCharHdl_Impl ) );
+ aDezChar.SetMaxTextLen(1);
+ aDezChar.Disable();
+ aDezCharLabel.Disable();
+
+ aLink = LINK( this, SvxTabulatorTabPage, FillTypeCheckHdl_Impl );
+ aNoFillChar.SetClickHdl( aLink );
+ aFillPoints.SetClickHdl( aLink );
+ aFillDashLine.SetClickHdl( aLink );
+ aFillSolidLine.SetClickHdl( aLink );
+ aFillSpecial.SetClickHdl( aLink );
+ aFillChar.SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage, GetFillCharHdl_Impl ) );
+ aFillChar.SetMaxTextLen(1);
+ aFillChar.Disable();
+
+ aTabBox.SetDoubleClickHdl( LINK( this, SvxTabulatorTabPage, SelectHdl_Impl ) );
+ aTabBox.SetModifyHdl( LINK( this, SvxTabulatorTabPage, ModifyHdl_Impl ) );
+
+ // das Default-Dezimalzeichen vom System holen
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ aAktTab.GetDecimal() = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SvxTabulatorTabPage::~SvxTabulatorTabPage()
+{
+ delete pLeftWin;
+ delete pRightWin;
+ delete pCenterWin;
+ delete pDezWin;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxTabulatorTabPage::GetRanges()
+{
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxTabulatorTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ BOOL bModified = FALSE;
+
+ // Hier die Werte aus den Controls eintueten
+ if ( aNewBtn.IsEnabled() )
+ NewHdl_Impl( 0 );
+
+ // call at first the LoseFocus-Handler
+ GetDezCharHdl_Impl( &aDezChar );
+ GetFillCharHdl_Impl( &aFillChar );
+
+ FillUpWithDefTabs_Impl( nDefDist, aNewTabs );
+ SfxItemPool* pPool = rSet.GetPool();
+ MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
+ const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_TABSTOP );
+
+ if ( MAP_100TH_MM != eUnit )
+ {
+ // Wenn sich im ItemSet ein LRSpaceItem mit negativen Erstzeileneinzug
+ // befindet, muss im TabStopItem auf der Position 0 ein DefTab sein.
+ const SfxPoolItem* pLRSpace;
+ // wenn nicht im neuen Set, dann vielleicht im alten
+ if ( SFX_ITEM_SET !=
+ rSet.GetItemState( GetWhich( SID_ATTR_LRSPACE ), TRUE, &pLRSpace ) )
+ pLRSpace = GetOldItem( rSet, SID_ATTR_LRSPACE );
+
+ if ( pLRSpace && ( (SvxLRSpaceItem*)pLRSpace )->GetTxtFirstLineOfst() < 0 )
+ {
+ SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT );
+ aNewTabs.Insert( aNull );
+ }
+
+ SvxTabStopItem aTmp( aNewTabs );
+ aTmp.Remove( 0, aTmp.Count() );
+
+ for ( USHORT i = 0; i < aNewTabs.Count(); ++i )
+ {
+ SvxTabStop aTmpStop = aNewTabs[i];
+ aTmpStop.GetTabPos() =
+ LogicToLogic( aTmpStop.GetTabPos(), MAP_100TH_MM, eUnit );
+ aTmp.Insert( aTmpStop );
+ }
+
+ if ( !pOld || !( *( (SvxTabStopItem*)pOld ) == aTmp ) )
+ {
+ rSet.Put( aTmp );
+ bModified = TRUE;
+ }
+ }
+ else if ( !pOld || !( *( (SvxTabStopItem*)pOld ) == aNewTabs ) )
+ {
+ rSet.Put( aNewTabs );
+ bModified = TRUE;
+ }
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxTabulatorTabPage::Create( Window* pParent,
+ const SfxItemSet& rSet)
+{
+ return ( new SvxTabulatorTabPage( pParent, rSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxTabulatorTabPage::Reset( const SfxItemSet& rSet )
+{
+ SfxItemPool* pPool = rSet.GetPool();
+ MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
+
+ // Aktuelle Tabs
+ const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_TABSTOP );
+
+ if ( pItem )
+ {
+ if ( MAP_100TH_MM != eUnit )
+ {
+ SvxTabStopItem aTmp( *( (const SvxTabStopItem*)pItem ) );
+ aNewTabs.Remove( 0, aNewTabs.Count() );
+
+ for ( USHORT i = 0; i < aTmp.Count(); ++i )
+ {
+ SvxTabStop aTmpStop = aTmp[i];
+ aTmpStop.GetTabPos() =
+ LogicToLogic( aTmpStop.GetTabPos(), eUnit, MAP_100TH_MM );
+ aNewTabs.Insert( aTmpStop );
+ }
+ }
+ else
+ aNewTabs = *( (const SvxTabStopItem*)pItem );
+ }
+ else
+ aNewTabs.Remove( 0, aNewTabs.Count() );
+
+ // Default-Tab - Abstand
+ nDefDist = SVX_TAB_DEFDIST;
+ pItem = GetItem( rSet, SID_ATTR_TABSTOP_DEFAULTS );
+
+ if ( pItem )
+ nDefDist = LogicToLogic(
+ (long)((const SfxUInt16Item*)pItem)->GetValue(), eUnit, MAP_100TH_MM );
+
+ // Aktuell selektierte Tab-Pos
+ USHORT nTabPos = 0;
+ pItem = GetItem( rSet, SID_ATTR_TABSTOP_POS );
+
+ if ( pItem )
+ nTabPos = ( (const SfxUInt16Item*)pItem )->GetValue();
+
+ InitTabPos_Impl( nTabPos );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxTabulatorTabPage::DisableControls( const USHORT nFlag )
+{
+ if ( ( TABTYPE_LEFT & nFlag ) == TABTYPE_LEFT )
+ {
+ aLeftTab.Disable();
+ pLeftWin->Disable();
+ }
+ if ( ( TABTYPE_RIGHT & nFlag ) == TABTYPE_RIGHT )
+ {
+ aRightTab.Disable();
+ pRightWin->Disable();
+ }
+ if ( ( TABTYPE_CENTER & nFlag ) == TABTYPE_CENTER )
+ {
+ aCenterTab.Disable();
+ pCenterWin->Disable();
+ }
+ if ( ( TABTYPE_DEZIMAL & nFlag ) == TABTYPE_DEZIMAL )
+ {
+ aDezTab.Disable();
+ pDezWin->Disable();
+ aDezCharLabel.Disable();
+ aDezChar.Disable();
+ }
+ if ( ( TABTYPE_ALL & nFlag ) == TABTYPE_ALL )
+ aTabTypeLabel.Disable();
+ if ( ( TABFILL_NONE & nFlag ) == TABFILL_NONE )
+ aNoFillChar.Disable();
+ if ( ( TABFILL_POINT & nFlag ) == TABFILL_POINT )
+ aFillPoints.Disable();
+ if ( ( TABFILL_DASHLINE & nFlag ) == TABFILL_DASHLINE )
+ aFillDashLine.Disable();
+ if ( ( TABFILL_SOLIDLINE & nFlag ) == TABFILL_SOLIDLINE )
+ aFillSolidLine.Disable();
+ if ( ( TABFILL_SPECIAL & nFlag ) == TABFILL_SPECIAL )
+ {
+ aFillSpecial.Disable();
+ aFillChar.Disable();
+ }
+ if ( ( TABFILL_ALL & nFlag ) == TABFILL_ALL )
+ aFillLabel.Disable();
+}
+
+// -----------------------------------------------------------------------
+
+int SvxTabulatorTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxTabulatorTabPage::InitTabPos_Impl( USHORT nTabPos )
+{
+ aTabBox.Clear();
+
+ long nOffset = 0;
+ const SfxPoolItem* pItem = 0;
+ if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, TRUE, &pItem )
+ == SFX_ITEM_SET )
+ {
+ nOffset = ( (const SfxInt32Item*)pItem )->GetValue();
+ MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
+ nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MAP_100TH_MM );
+ }
+
+ // Aktuelle TabPos korrigieren und Defaults-Tabs
+ for ( USHORT i = 0; i < aNewTabs.Count(); i++ )
+ {
+ if ( aNewTabs[i].GetAdjustment() != SVX_TAB_ADJUST_DEFAULT )
+ {
+ aTabBox.InsertValue( aTabBox.Normalize(
+ aNewTabs[i].GetTabPos() + nOffset ), eDefUnit );
+ }
+ else
+ aNewTabs.Remove( i-- );
+ }
+
+ // aktuellen Tabulator auswaehlen
+ const USHORT nSize = aNewTabs.Count();
+
+ if ( nTabPos >= nSize )
+ nTabPos = 0;
+
+ // alle RadioButtons erstmal ausschalten
+ aLeftTab.Check( TRUE );
+ aNoFillChar.Check( TRUE );
+
+ if( aTabBox.GetEntryCount() > 0 )
+ {
+ aTabBox.SetText( aTabBox.GetEntry( nTabPos ) );
+ aAktTab = aNewTabs[nTabPos];
+
+ SetFillAndTabType_Impl();
+ aNewBtn.Disable();
+ aDelBtn.Enable();
+ }
+ else
+ { // kein Eintrag dann ist 0 der Default-Wert
+ aTabBox.SetValue( 0, eDefUnit );
+
+ aNewBtn.Enable();
+ aDelBtn.Disable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxTabulatorTabPage::SetFillAndTabType_Impl()
+{
+ RadioButton* pTypeBtn = 0;
+ RadioButton* pFillBtn = 0;
+
+ aDezChar.Disable();
+ aDezCharLabel.Disable();
+
+ if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_LEFT )
+ pTypeBtn = &aLeftTab;
+ else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_RIGHT )
+ pTypeBtn = &aRightTab;
+ else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_DECIMAL )
+ {
+ pTypeBtn = &aDezTab;
+ aDezChar.Enable();
+ aDezCharLabel.Enable();
+ aDezChar.SetText( String( (sal_Unicode)aAktTab.GetDecimal() ) );
+ }
+ else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_CENTER )
+ pTypeBtn = &aCenterTab;
+
+ if ( pTypeBtn )
+ pTypeBtn->Check();
+
+ aFillChar.Disable();
+ aFillChar.SetText( String() );
+
+ if ( aAktTab.GetFill() == ' ' )
+ pFillBtn = &aNoFillChar;
+ else if ( aAktTab.GetFill() == '-' )
+ pFillBtn = &aFillDashLine;
+ else if ( aAktTab.GetFill() == '_' )
+ pFillBtn = &aFillSolidLine;
+ else if ( aAktTab.GetFill() == '.' )
+ pFillBtn = &aFillPoints;
+ else
+ {
+ pFillBtn = &aFillSpecial;
+ aFillChar.Enable();
+ aFillChar.SetText( String( (sal_Unicode)aAktTab.GetFill() ) );
+ }
+ pFillBtn->Check();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxTabulatorTabPage, NewHdl_Impl, Button *, pBtn )
+{
+ // Einen neuen Hinzufuegen und Selectieren
+ // Wert aus der Anzeige holen
+ long nVal = static_cast<long>(aTabBox.Denormalize( aTabBox.GetValue( eDefUnit ) ));
+
+ // Wenn der pBtn == 0 && der Value == 0 dann keinen Tab Erzeugen
+ // weil ueber OK erzeugt
+ if ( nVal == 0 && pBtn == 0 )
+ return 0;
+
+ long nOffset = 0;
+ const SfxPoolItem* pItem = 0;
+
+ if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, TRUE, &pItem ) ==
+ SFX_ITEM_SET )
+ {
+ nOffset = ( (const SfxInt32Item*)pItem )->GetValue();
+ MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
+ nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MAP_100TH_MM );
+ }
+ const long nReal = nVal - nOffset;
+ USHORT nSize = aTabBox.GetEntryCount();
+
+ USHORT i;
+ for( i = 0; i < nSize; i++ )
+ {
+ if ( nReal < aNewTabs[i].GetTabPos() )
+ break;
+ }
+
+ // ListBox-Eintrag vornehmen
+ aTabBox.InsertValue( aTabBox.Normalize( nVal ), eDefUnit, i );
+ aAktTab.GetTabPos() = nReal;
+ SvxTabAdjust eAdj = SVX_TAB_ADJUST_LEFT;
+
+ if ( aRightTab.IsChecked() )
+ eAdj = SVX_TAB_ADJUST_RIGHT;
+ else if ( aCenterTab.IsChecked() )
+ eAdj = SVX_TAB_ADJUST_CENTER;
+ else if ( aDezTab.IsChecked() )
+ eAdj = SVX_TAB_ADJUST_DECIMAL;
+
+ aAktTab.GetAdjustment() = eAdj;
+ aNewTabs.Insert( aAktTab );
+
+ aNewBtn.Disable();
+ aDelBtn.Enable();
+ aTabBox.GrabFocus();
+
+ // falls kein RadioButton geclickt wurde,
+ // muss trotzdem geputtet werden
+ bCheck |= TRUE;
+ // set the selection into the position Edit
+ aTabBox.SetSelection(Selection(0, aTabBox.GetText().Len()));
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxTabulatorTabPage, DelHdl_Impl, Button *, EMPTYARG )
+{
+ USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue() );
+
+ if ( nPos == COMBOBOX_ENTRY_NOTFOUND )
+ return 0;
+
+ if ( aTabBox.GetEntryCount() == 1 )
+ {
+ DelAllHdl_Impl( 0 );
+ return 0;
+ }
+
+ // Tab loeschen
+ aTabBox.RemoveEntry( nPos );
+ aNewTabs.Remove( nPos );
+
+ // aAktTab neu setzen
+ const USHORT nSize = aNewTabs.Count();
+
+ if ( nSize > 0 )
+ {
+ // Pos korrigieren
+ nPos = ( ( nSize - 1 ) >= nPos) ? nPos : nPos - 1;
+ aTabBox.SetValue( aTabBox.GetValue( nPos ) );
+ aAktTab = aNewTabs[nPos];
+ }
+
+ // Falls keine Tabs Enable Disable Controls
+ if ( aTabBox.GetEntryCount() == 0 )
+ {
+ aDelBtn.Disable();
+ aNewBtn.Enable();
+ aTabBox.GrabFocus();
+ }
+
+ // falls kein RadioButton geclickt wurde,
+ // muss trotzdem geputtet werden
+ bCheck |= TRUE;
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxTabulatorTabPage, DelAllHdl_Impl, Button *, EMPTYARG )
+{
+ if ( aNewTabs.Count() )
+ {
+ aNewTabs = SvxTabStopItem( 0 );
+ InitTabPos_Impl();
+
+ // damit in FillItemSet() geputtet wird
+ bCheck |= TRUE;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxTabulatorTabPage, TabTypeCheckHdl_Impl, RadioButton *, pBox )
+{
+ bCheck |= TRUE;
+ SvxTabAdjust eAdj;
+ aDezChar.Disable();
+ aDezCharLabel.Disable();
+ aDezChar.SetText( String() );
+
+ if ( pBox == &aLeftTab )
+ eAdj = SVX_TAB_ADJUST_LEFT;
+ else if ( pBox == &aRightTab )
+ eAdj = SVX_TAB_ADJUST_RIGHT;
+ else if ( pBox == &aCenterTab )
+ eAdj = SVX_TAB_ADJUST_CENTER;
+ else
+ {
+ eAdj = SVX_TAB_ADJUST_DECIMAL;
+ aDezChar.Enable();
+ aDezCharLabel.Enable();
+ aDezChar.SetText( String( (sal_Unicode)aAktTab.GetDecimal() ) );
+ }
+
+ aAktTab.GetAdjustment() = eAdj;
+ USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
+
+ if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
+ {
+ aNewTabs.Remove( nPos );
+ aNewTabs.Insert( aAktTab );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxTabulatorTabPage, FillTypeCheckHdl_Impl, RadioButton *, pBox )
+{
+ bCheck |= TRUE;
+ BYTE cFill = ' ';
+ aFillChar.SetText( String() );
+ aFillChar.Disable();
+
+ if( pBox == &aFillSpecial )
+ aFillChar.Enable();
+ else if ( pBox == &aNoFillChar )
+ cFill = ' ';
+ else if ( pBox == &aFillSolidLine )
+ cFill = '_';
+ else if ( pBox == &aFillPoints )
+ cFill = '.';
+ else if ( pBox == &aFillDashLine )
+ cFill = '-';
+
+ aAktTab.GetFill() = cFill;
+ USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
+
+ if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
+ {
+ aNewTabs.Remove( nPos );
+ aNewTabs.Insert( aAktTab );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxTabulatorTabPage, GetFillCharHdl_Impl, Edit *, pEdit )
+{
+ String aChar( pEdit->GetText() );
+
+ if ( aChar.Len() > 0 )
+ aAktTab.GetFill() = aChar.GetChar( 0 );
+
+ const USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit);
+ if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
+ {
+ aNewTabs.Remove( nPos );
+ aNewTabs.Insert( aAktTab );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxTabulatorTabPage, GetDezCharHdl_Impl, Edit *, pEdit )
+{
+ String aChar( pEdit->GetText() );
+ if ( aChar.Len() > 0 && ( aChar.GetChar( 0 ) >= ' '))
+ aAktTab.GetDecimal() = aChar.GetChar( 0 );
+
+ USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
+ if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
+ {
+ aNewTabs.Remove( nPos );
+ aNewTabs.Insert( aAktTab );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxTabulatorTabPage, SelectHdl_Impl, MetricBox *, EMPTYARG )
+{
+ USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
+ if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
+ {
+ aAktTab = aNewTabs[nPos];
+ aNewBtn.Disable();
+ SetFillAndTabType_Impl();
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxTabulatorTabPage, ModifyHdl_Impl, MetricBox *, EMPTYARG )
+{
+ USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
+ if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
+ {
+ aAktTab = aNewTabs[nPos];
+ SetFillAndTabType_Impl();
+
+ aAktTab.GetTabPos() =
+ static_cast<long>(aTabBox.Denormalize( aTabBox.GetValue( eDefUnit ) ));
+
+ aNewBtn.Disable();
+ aDelBtn.Enable();
+ return 0;
+ }
+ aNewBtn.Enable();
+ aDelBtn.Disable();
+ return 0;
+}
+//add CHINA001 Begin
+void SvxTabulatorTabPage::PageCreated(SfxAllItemSet aSet)
+{
+ SFX_ITEMSET_ARG (&aSet,pControlItem,SfxUInt16Item,SID_SVXTABULATORTABPAGE_CONTROLFLAGS,sal_False);
+ if (pControlItem)
+ DisableControls(pControlItem->GetValue());
+}
+//end of CHINA001
diff --git a/cui/source/tabpages/tabstpge.hrc b/cui/source/tabpages/tabstpge.hrc
new file mode 100644
index 000000000000..60752fa70109
--- /dev/null
+++ b/cui/source/tabpages/tabstpge.hrc
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * 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: tabstpge.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TABSTPGE_HRC
+#define _SVX_TABSTPGE_HRC
+
+// defines ------------------------------------------------------------------
+
+#define ED_TABPOS 10
+#define FL_TABPOS 11
+#define FL_TABPOS_VERT 12
+
+#define BTN_TABTYPE_LEFT 20
+#define WIN_TABLEFT 21
+#define BTN_TABTYPE_RIGHT 22
+#define WIN_TABRIGHT 23
+#define BTN_TABTYPE_CENTER 24
+#define WIN_TABCENTER 25
+#define BTN_TABTYPE_DECIMAL 26
+#define WIN_TABDECIMAL 27
+#define ED_TABTYPE_DECCHAR 28
+#define FT_TABTYPE_DECCHAR 29
+#define FL_TABTYPE 30
+
+
+#define BTN_FILLCHAR_NO 40
+#define BTN_FILLCHAR_POINTS 41
+#define BTN_FILLCHAR_DASHLINE 42
+#define BTN_FILLCHAR_UNDERSCORE 43
+#define BTN_FILLCHAR_OTHER 44
+#define ED_FILLCHAR_OTHER 45
+#define FL_FILLCHAR 46
+
+#define BTN_NEW 50
+#define BTN_DEL 51
+#define BTN_DELALL 52
+#define ST_LEFTTAB_ASIAN 53
+#define ST_RIGHTTAB_ASIAN 54
+#endif
+
diff --git a/cui/source/tabpages/tabstpge.src b/cui/source/tabpages/tabstpge.src
new file mode 100644
index 000000000000..2b3649ef968f
--- /dev/null
+++ b/cui/source/tabpages/tabstpge.src
@@ -0,0 +1,234 @@
+/*************************************************************************
+ *
+ * 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: tabstpge.src,v $
+ * $Revision: 1.31 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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.hrc"
+#include <svx/dialogs.hrc>
+#include "tabstpge.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXPAGE_TABULATOR -------------------------------------------------
+TabPage RID_SVXPAGE_TABULATOR
+{
+ HelpId = HID_TABULATOR ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Tabs" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_TABPOS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 48 , 8 ) ;
+ Text [ en-US ] = "Position" ;
+ };
+ MetricBox ED_TABPOS
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 39 , 165 ) ;
+ Minimum = -5600 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ };
+ FixedLine FL_TABPOS_VERT
+ {
+ Pos = MAP_APPFONT ( 55 , 14 ) ;
+ Size = MAP_APPFONT ( 4 , 165 ) ;
+ Vert = TRUE;
+ };
+ FixedLine FL_TABTYPE
+ {
+ Pos = MAP_APPFONT ( 60 , 3 ) ;
+ Size = MAP_APPFONT ( 138 , 8 ) ;
+ Text [ en-US ] = "Type" ;
+ };
+ RadioButton BTN_TABTYPE_LEFT
+ {
+ Pos = MAP_APPFONT ( 66 , 14 ) ;
+ Size = MAP_APPFONT ( 89 , 10 ) ;
+ Text [ en-US ] = "~Left" ;
+ Check = TRUE ;
+ };
+ Window WIN_TABLEFT
+ {
+ Pos = MAP_APPFONT ( 157 , 14 ) ;
+ Size = MAP_APPFONT ( 7 , 10 ) ;
+ };
+ RadioButton BTN_TABTYPE_RIGHT
+ {
+ Pos = MAP_APPFONT ( 66 , 28 ) ;
+ Size = MAP_APPFONT ( 89 , 10 ) ;
+ Text [ en-US ] = "Righ~t" ;
+ };
+ Window WIN_TABRIGHT
+ {
+ Pos = MAP_APPFONT ( 157 , 28 ) ;
+ Size = MAP_APPFONT ( 7 , 10 ) ;
+ };
+ RadioButton BTN_TABTYPE_CENTER
+ {
+ Pos = MAP_APPFONT ( 66 , 42 ) ;
+ Size = MAP_APPFONT ( 89 , 10 ) ;
+ Text [ en-US ] = "C~entered" ;
+ };
+ Window WIN_TABCENTER
+ {
+ Pos = MAP_APPFONT ( 157 , 42 ) ;
+ Size = MAP_APPFONT ( 7 , 10 ) ;
+ };
+ RadioButton BTN_TABTYPE_DECIMAL
+ {
+ Pos = MAP_APPFONT ( 66 , 56 ) ;
+ Size = MAP_APPFONT ( 89 , 10 ) ;
+ Text [ en-US ] = "Deci~mal" ;
+ };
+ Window WIN_TABDECIMAL
+ {
+ Pos = MAP_APPFONT ( 157 , 56 ) ;
+ Size = MAP_APPFONT ( 7 , 10 ) ;
+ };
+ FixedText FT_TABTYPE_DECCHAR
+ {
+ Pos = MAP_APPFONT ( 75 , 70 ) ;
+ Size = MAP_APPFONT ( 79 , 8 ) ;
+ Text [ en-US ] = "~Character" ;
+ };
+ Edit ED_TABTYPE_DECCHAR
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 156 , 68 ) ;
+ Size = MAP_APPFONT ( 9 , 12 ) ;
+ Left = TRUE ;
+ };
+ FixedLine FL_FILLCHAR
+ {
+ Pos = MAP_APPFONT ( 60 , 86 ) ;
+ Size = MAP_APPFONT ( 138 , 8 ) ;
+ Text [ en-US ] = "Fill character" ;
+ };
+ RadioButton BTN_FILLCHAR_NO
+ {
+ Pos = MAP_APPFONT ( 66 , 97 ) ;
+ Size = MAP_APPFONT ( 89 , 10 ) ;
+ Text [ en-US ] = "N~one" ;
+ Check = TRUE ;
+ };
+ RadioButton BTN_FILLCHAR_POINTS
+ {
+ Pos = MAP_APPFONT ( 66 , 111 ) ;
+ Size = MAP_APPFONT ( 89 , 10 ) ;
+ Text = "~........" ;
+ };
+ RadioButton BTN_FILLCHAR_DASHLINE
+ {
+ Pos = MAP_APPFONT ( 66 , 125 ) ;
+ Size = MAP_APPFONT ( 89 , 10 ) ;
+ Text = "~--------" ;
+ };
+ RadioButton BTN_FILLCHAR_UNDERSCORE
+ {
+ Pos = MAP_APPFONT ( 66 , 139 ) ;
+ Size = MAP_APPFONT ( 89 , 10 ) ;
+ Text = "~_____" ;
+ };
+ RadioButton BTN_FILLCHAR_OTHER
+ {
+ Pos = MAP_APPFONT ( 66 , 153 ) ;
+ Size = MAP_APPFONT ( 89 , 10 ) ;
+ Text [ en-US ] = "Character" ;
+ };
+ Edit ED_FILLCHAR_OTHER
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 156 , 151 ) ;
+ Size = MAP_APPFONT ( 9 , 12 ) ;
+ Left = TRUE ;
+ };
+ PushButton BTN_NEW
+ {
+ Pos = MAP_APPFONT ( 204 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~New" ;
+ };
+ PushButton BTN_DELALL
+ {
+ Pos = MAP_APPFONT ( 204 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Delete ~All" ;
+ };
+ PushButton BTN_DEL
+ {
+ Pos = MAP_APPFONT ( 204 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ String ST_LEFTTAB_ASIAN
+ {
+ Text [ en-US ] = "~Left/Top" ;
+ };
+ String ST_RIGHTTAB_ASIAN
+ {
+ Text [ en-US ] = "Righ~t/Bottom" ;
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/textanim.cxx b/cui/source/tabpages/textanim.cxx
new file mode 100644
index 000000000000..a278d11970bf
--- /dev/null
+++ b/cui/source/tabpages/textanim.cxx
@@ -0,0 +1,759 @@
+/*************************************************************************
+ *
+ * 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: textanim.cxx,v $
+ * $Revision: 1.17 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <tools/shl.hxx>
+
+#include <svx/dialogs.hrc>
+
+#ifndef _SVX_TEXTANIM_CXX
+#define _SVX_TEXTANIM_CXX
+#endif
+#include "textanim.hxx"
+#include "textanim.hrc"
+#include "textattr.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+
+static USHORT pRanges[] =
+{
+ SDRATTR_TEXT_ANIKIND,
+ SDRATTR_TEXT_ANIAMOUNT,
+ 0
+};
+
+/*************************************************************************
+|*
+|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+|*
+\************************************************************************/
+
+__EXPORT SvxTextTabDialog::SvxTextTabDialog( Window* pParent,
+ const SfxItemSet* pAttr,
+ const SdrView* pSdrView ) :
+ SfxTabDialog ( pParent, SVX_RES( RID_SVXDLG_TEXT ), pAttr ),
+ rOutAttrs ( *pAttr ),
+ pView ( pSdrView )
+{
+ FreeResource();
+
+ AddTabPage( RID_SVXPAGE_TEXTATTR, SvxTextAttrPage::Create, 0);
+ AddTabPage( RID_SVXPAGE_TEXTANIMATION, SvxTextAnimationPage::Create, 0);
+}
+
+/*************************************************************************
+|*
+|* PageCreated()
+|*
+\************************************************************************/
+
+void __EXPORT SvxTextTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage )
+{
+ switch( nId )
+ {
+ case RID_SVXPAGE_TEXTATTR:
+ {
+ ( (SvxTextAttrPage&) rPage ).SetView( pView );
+ ( (SvxTextAttrPage&) rPage ).Construct();
+ }
+ break;
+
+ case RID_SVXPAGE_TEXTANIMATION:
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Page
+|*
+\************************************************************************/
+
+SvxTextAnimationPage::SvxTextAnimationPage( Window* pWindow, const SfxItemSet& rInAttrs ) :
+ SfxTabPage ( pWindow, SVX_RES( RID_SVXPAGE_TEXTANIMATION ),
+ rInAttrs ),
+ aFlEffect ( this, SVX_RES(FL_EFFECT)),
+ aFtEffects ( this, SVX_RES(FT_EFFECTS)),
+ aLbEffect ( this, SVX_RES( LB_EFFECT ) ),
+ //aCtlEffect ( this, SVX_RES( CTL_EFFECT ) ),
+ aFtDirection ( this, SVX_RES(FT_DIRECTION) ),
+ aBtnUp ( this, SVX_RES( BTN_UP ) ),
+ aBtnLeft ( this, SVX_RES( BTN_LEFT ) ),
+ aBtnRight ( this, SVX_RES( BTN_RIGHT ) ),
+ aBtnDown ( this, SVX_RES( BTN_DOWN ) ),
+
+ aFlProperties ( this, SVX_RES(FL_PROPERTIES)),
+ aTsbStartInside ( this, SVX_RES( TSB_START_INSIDE ) ),
+ aTsbStopInside ( this, SVX_RES( TSB_STOP_INSIDE ) ),
+
+ aFtCount ( this, SVX_RES(FT_COUNT)),
+ aTsbEndless ( this, SVX_RES( TSB_ENDLESS ) ),
+ aNumFldCount ( this, SVX_RES( NUM_FLD_COUNT ) ),
+
+ aFtAmount ( this, SVX_RES(FT_AMOUNT)),
+ aTsbPixel ( this, SVX_RES( TSB_PIXEL ) ),
+ aMtrFldAmount ( this, SVX_RES( MTR_FLD_AMOUNT ) ),
+
+ aFtDelay ( this, SVX_RES(FT_DELAY)),
+ aTsbAuto ( this, SVX_RES( TSB_AUTO ) ),
+ aMtrFldDelay ( this, SVX_RES( MTR_FLD_DELAY ) ),
+
+ rOutAttrs ( rInAttrs ),
+ eAniKind ( SDRTEXTANI_NONE )
+{
+ FreeResource();
+
+ eFUnit = GetModuleFieldUnit( &rInAttrs );
+ SfxItemPool* pPool = rOutAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
+
+ Construct();
+
+ aLbEffect.SetSelectHdl(
+ LINK( this, SvxTextAnimationPage, SelectEffectHdl_Impl ) );
+ aTsbEndless.SetClickHdl(
+ LINK( this, SvxTextAnimationPage, ClickEndlessHdl_Impl ) );
+ aTsbAuto.SetClickHdl(
+ LINK( this, SvxTextAnimationPage, ClickAutoHdl_Impl ) );
+ aTsbPixel.SetClickHdl(
+ LINK( this, SvxTextAnimationPage, ClickPixelHdl_Impl ) );
+
+ Link aLink( LINK( this, SvxTextAnimationPage, ClickDirectionHdl_Impl ) );
+ aBtnUp.SetClickHdl( aLink );
+ aBtnLeft.SetClickHdl( aLink );
+ aBtnRight.SetClickHdl( aLink );
+ aBtnDown.SetClickHdl( aLink );
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxTextAnimationPage::~SvxTextAnimationPage()
+{
+}
+
+/*************************************************************************
+|*
+|* Liest uebergebenen Item-Set
+|*
+\************************************************************************/
+
+void __EXPORT SvxTextAnimationPage::Reset( const SfxItemSet& rAttrs )
+{
+ const SfxItemPool* pPool = rAttrs.GetPool();
+
+ // Animationstyp
+ const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIKIND );
+
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIKIND );
+ if( pItem )
+ {
+ eAniKind = ( ( const SdrTextAniKindItem* )pItem )->GetValue();
+ aLbEffect.SelectEntryPos( sal::static_int_cast< USHORT >(eAniKind) );
+ }
+ else
+ aLbEffect.SetNoSelection();
+ aLbEffect.SaveValue();
+
+ // Animationsrichtung
+ pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIDIRECTION );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDIRECTION );
+ if( pItem )
+ {
+ SdrTextAniDirection eValue = ( ( const SdrTextAniDirectionItem* )pItem )->GetValue();
+ SelectDirection( eValue );
+ }
+ else
+ {
+ aBtnUp.Check( FALSE );
+ aBtnLeft.Check( FALSE );
+ aBtnRight.Check( FALSE );
+ aBtnDown.Check( FALSE );
+ }
+ aBtnUp.SaveValue();
+ aBtnLeft.SaveValue();
+ aBtnRight.SaveValue();
+ aBtnDown.SaveValue();
+
+ // Start inside
+ pItem = GetItem( rAttrs, SDRATTR_TEXT_ANISTARTINSIDE );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTARTINSIDE );
+ if( pItem )
+ {
+ aTsbStartInside.EnableTriState( FALSE );
+ BOOL bValue = ( ( const SdrTextAniStartInsideItem* )pItem )->GetValue();
+ if( bValue )
+ aTsbStartInside.SetState( STATE_CHECK );
+ else
+ aTsbStartInside.SetState( STATE_NOCHECK );
+ }
+ else
+ aTsbStartInside.SetState( STATE_DONTKNOW );
+ aTsbStartInside.SaveValue();
+
+ // Stop inside
+ pItem = GetItem( rAttrs, SDRATTR_TEXT_ANISTOPINSIDE );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTOPINSIDE );
+ if( pItem )
+ {
+ aTsbStopInside.EnableTriState( FALSE );
+ BOOL bValue = ( ( const SdrTextAniStopInsideItem* )pItem )->GetValue();
+ if( bValue )
+ aTsbStopInside.SetState( STATE_CHECK );
+ else
+ aTsbStopInside.SetState( STATE_NOCHECK );
+ }
+ else
+ aTsbStopInside.SetState( STATE_DONTKNOW );
+ aTsbStopInside.SaveValue();
+
+ // Anzahl
+ pItem = GetItem( rAttrs, SDRATTR_TEXT_ANICOUNT );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANICOUNT );
+ if( pItem )
+ {
+ aTsbEndless.EnableTriState( FALSE );
+ long nValue = (long) ( ( const SdrTextAniCountItem* )pItem )->GetValue();
+ aNumFldCount.SetValue( nValue );
+ if( nValue == 0 )
+ {
+ if( eAniKind == SDRTEXTANI_SLIDE )
+ {
+ aTsbEndless.SetState( STATE_NOCHECK );
+ aTsbEndless.Enable( FALSE );
+ }
+ else
+ {
+ aTsbEndless.SetState( STATE_CHECK );
+ aNumFldCount.SetEmptyFieldValue();
+ }
+ }
+ else
+ aTsbEndless.SetState( STATE_NOCHECK );
+ }
+ else
+ {
+ aNumFldCount.SetEmptyFieldValue();
+ aTsbEndless.SetState( STATE_DONTKNOW );
+ }
+ aTsbEndless.SaveValue();
+ aNumFldCount.SaveValue();
+
+ // Verzoegerung
+ pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIDELAY );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDELAY );
+ if( pItem )
+ {
+ aTsbAuto.EnableTriState( FALSE );
+ long nValue = (long) ( ( const SdrTextAniDelayItem* )pItem )->GetValue();
+ aMtrFldDelay.SetValue( nValue );
+ if( nValue == 0 )
+ {
+ aTsbAuto.SetState( STATE_CHECK );
+ aMtrFldDelay.SetEmptyFieldValue();
+ }
+ else
+ aTsbAuto.SetState( STATE_NOCHECK );
+ }
+ else
+ {
+ aMtrFldDelay.SetEmptyFieldValue();
+ aTsbAuto.SetState( STATE_DONTKNOW );
+ }
+ aTsbAuto.SaveValue();
+ aMtrFldDelay.SaveValue();
+
+ // Schrittweite
+ pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIAMOUNT );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIAMOUNT );
+ if( pItem )
+ {
+ aTsbPixel.EnableTriState( FALSE );
+ long nValue = (long) ( ( const SdrTextAniAmountItem* )pItem )->GetValue();
+ if( nValue <= 0 )
+ {
+ aTsbPixel.SetState( STATE_CHECK );
+ nValue = -nValue;
+ if( nValue == 0 )
+ nValue++;
+ aMtrFldAmount.SetUnit( FUNIT_CUSTOM );
+ aMtrFldAmount.SetDecimalDigits( 0 );
+
+ aMtrFldAmount.SetSpinSize( 1 );
+ aMtrFldAmount.SetMin( 1 );
+ aMtrFldAmount.SetFirst( 1 );
+ aMtrFldAmount.SetMax( 100 );
+ aMtrFldAmount.SetLast( 100 );
+
+ aMtrFldAmount.SetValue( nValue );
+ }
+ else
+ {
+ aTsbPixel.SetState( STATE_NOCHECK );
+ aMtrFldAmount.SetUnit( eFUnit );
+ aMtrFldAmount.SetDecimalDigits( 2 );
+
+ aMtrFldAmount.SetSpinSize( 10 );
+ aMtrFldAmount.SetMin( 1 );
+ aMtrFldAmount.SetFirst( 1 );
+ aMtrFldAmount.SetMax( 10000 );
+ aMtrFldAmount.SetLast( 10000 );
+
+ SetMetricValue( aMtrFldAmount, nValue, eUnit );
+ }
+ }
+ else
+ {
+ aMtrFldAmount.Disable();
+ aMtrFldAmount.SetEmptyFieldValue();
+ aTsbPixel.SetState( STATE_DONTKNOW );
+ }
+ aTsbPixel.SaveValue();
+ aMtrFldAmount.SaveValue();
+
+
+ SelectEffectHdl_Impl( NULL );
+ ClickEndlessHdl_Impl( NULL );
+ ClickAutoHdl_Impl( NULL );
+ //ClickPixelHdl_Impl( NULL );
+}
+
+/*************************************************************************
+|*
+|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen
+|*
+\************************************************************************/
+
+BOOL SvxTextAnimationPage::FillItemSet( SfxItemSet& rAttrs)
+{
+ BOOL bModified = FALSE;
+ USHORT nPos;
+ TriState eState;
+
+ // Animationstyp
+ nPos = aLbEffect.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND &&
+ nPos != aLbEffect.GetSavedValue() )
+ {
+ rAttrs.Put( SdrTextAniKindItem( (SdrTextAniKind) nPos ) );
+ bModified = TRUE;
+ }
+
+ // Animationsrichtung
+ if( aBtnUp.GetSavedValue() != aBtnUp.IsChecked() ||
+ aBtnLeft.GetSavedValue() != aBtnLeft.IsChecked() ||
+ aBtnRight.GetSavedValue() != aBtnRight.IsChecked() ||
+ aBtnDown.GetSavedValue() != aBtnDown.IsChecked() )
+ {
+ SdrTextAniDirection eValue = (SdrTextAniDirection) GetSelectedDirection();
+ rAttrs.Put( SdrTextAniDirectionItem( eValue ) );
+ bModified = TRUE;
+ }
+
+ // Start inside
+ eState = aTsbStartInside.GetState();
+ if( eState != aTsbStartInside.GetSavedValue() )
+ {
+ rAttrs.Put( SdrTextAniStartInsideItem( (BOOL) STATE_CHECK == eState ) );
+ bModified = TRUE;
+ }
+
+ // Stop inside
+ eState = aTsbStopInside.GetState();
+ if( eState != aTsbStopInside.GetSavedValue() )
+ {
+ rAttrs.Put( SdrTextAniStopInsideItem( (BOOL) STATE_CHECK == eState ) );
+ bModified = TRUE;
+ }
+
+ // Anzahl
+ eState = aTsbEndless.GetState();
+ String aStr = aNumFldCount.GetText();
+ if( eState != aTsbEndless.GetSavedValue() ||
+ aStr != aNumFldCount.GetSavedValue() )
+ {
+ sal_Int64 nValue = 0;
+ if( eState == STATE_CHECK /*#89844#*/ && aTsbEndless.IsEnabled())
+ bModified = TRUE;
+ else
+ {
+ if( aStr != aNumFldCount.GetSavedValue() )
+ {
+ nValue = aNumFldCount.GetValue();
+ bModified = TRUE;
+ }
+ }
+ if( bModified )
+ rAttrs.Put( SdrTextAniCountItem( (UINT16) nValue ) );
+ }
+
+ // Verzoegerung
+ eState = aTsbAuto.GetState();
+ aStr = aMtrFldDelay.GetText();
+ if( eState != aTsbAuto.GetSavedValue() ||
+ aStr != aMtrFldDelay.GetSavedValue() )
+ {
+ sal_Int64 nValue = 0;
+ if( eState == STATE_CHECK )
+ bModified = TRUE;
+ else
+ {
+ if( aStr != aMtrFldDelay.GetSavedValue() )
+ {
+ nValue = aMtrFldDelay.GetValue();
+ bModified = TRUE;
+ }
+ }
+ if( bModified )
+ rAttrs.Put( SdrTextAniDelayItem( (UINT16) nValue ) );
+ }
+
+ // Schrittweite
+ eState = aTsbPixel.GetState();
+ aStr = aMtrFldAmount.GetText();
+ if( eState != aTsbPixel.GetSavedValue() ||
+ aStr != aMtrFldAmount.GetSavedValue() )
+ {
+ sal_Int64 nValue = 0;
+ if( eState == STATE_CHECK )
+ {
+ nValue = aMtrFldAmount.GetValue();
+ nValue = -nValue;
+ }
+ else
+ {
+ nValue = GetCoreValue( aMtrFldAmount, eUnit );
+ }
+ rAttrs.Put( SdrTextAniAmountItem( (INT16) nValue ) );
+
+ bModified = TRUE;
+ }
+
+ return( bModified );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxTextAnimationPage::Construct()
+{
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+USHORT* SvxTextAnimationPage::GetRanges()
+{
+ return( pRanges );
+}
+
+/*************************************************************************
+|*
+|* Erzeugt die Seite
+|*
+\************************************************************************/
+
+SfxTabPage* SvxTextAnimationPage::Create( Window* pWindow,
+ const SfxItemSet& rAttrs )
+{
+ return( new SvxTextAnimationPage( pWindow, rAttrs ) );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxTextAnimationPage, SelectEffectHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbEffect.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ eAniKind = (SdrTextAniKind) nPos;
+ switch( eAniKind )
+ {
+ case SDRTEXTANI_NONE:
+ {
+ aFtDirection.Disable();
+ aBtnUp.Disable();
+ aBtnLeft.Disable();
+ aBtnRight.Disable();
+ aBtnDown.Disable();
+ aTsbStartInside.Disable();
+ aTsbStopInside.Disable();
+
+ aTsbEndless.Disable();
+ aNumFldCount.Disable();
+ aFtCount.Disable();
+
+ aTsbAuto.Disable();
+ aMtrFldDelay.Disable();
+ aFtDelay.Disable();
+
+ aTsbPixel.Disable();
+ aMtrFldAmount.Disable();
+ aFtAmount.Disable();
+ }
+ break;
+
+ case SDRTEXTANI_BLINK:
+ case SDRTEXTANI_SCROLL:
+ case SDRTEXTANI_ALTERNATE:
+ case SDRTEXTANI_SLIDE:
+ {
+ if( eAniKind == SDRTEXTANI_SLIDE )
+ {
+ aTsbStartInside.Disable();
+ aTsbStopInside.Disable();
+
+ aTsbEndless.Disable();
+ aNumFldCount.Enable();
+ aNumFldCount.SetValue( aNumFldCount.GetValue() );
+ }
+ else
+ {
+ aTsbStartInside.Enable();
+ aTsbStopInside.Enable();
+
+ aTsbEndless.Enable();
+ ClickEndlessHdl_Impl( NULL );
+ }
+ aFtCount.Enable();
+
+ aTsbAuto.Enable();
+ aFtDelay.Enable();
+ ClickAutoHdl_Impl( NULL );
+
+ if( eAniKind == SDRTEXTANI_BLINK )
+ {
+ aFtDirection.Disable();
+ aBtnUp.Disable();
+ aBtnLeft.Disable();
+ aBtnRight.Disable();
+ aBtnDown.Disable();
+
+ aTsbPixel.Disable();
+ aMtrFldAmount.Disable();
+ aFtAmount.Disable();
+ }
+ else
+ {
+ aFtDirection.Enable();
+ aBtnUp.Enable();
+ aBtnLeft.Enable();
+ aBtnRight.Enable();
+ aBtnDown.Enable();
+
+ aTsbPixel.Enable();
+ aMtrFldAmount.Enable();
+ aFtAmount.Enable();
+ }
+ }
+ break;
+ }
+
+ }
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxTextAnimationPage, ClickEndlessHdl_Impl, void *, EMPTYARG )
+{
+
+ if( eAniKind != SDRTEXTANI_SLIDE )
+ {
+ TriState eState = aTsbEndless.GetState();
+ if( eState != STATE_NOCHECK )
+ {
+ aNumFldCount.Disable();
+ aNumFldCount.SetEmptyFieldValue();
+ }
+ else
+ {
+ aNumFldCount.Enable();
+ aNumFldCount.SetValue( aNumFldCount.GetValue() );
+ }
+ }
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxTextAnimationPage, ClickAutoHdl_Impl, void *, EMPTYARG )
+{
+ TriState eState = aTsbAuto.GetState();
+ if( eState != STATE_NOCHECK )
+ {
+ aMtrFldDelay.Disable();
+ aMtrFldDelay.SetEmptyFieldValue();
+ }
+ else
+ {
+ aMtrFldDelay.Enable();
+ aMtrFldDelay.SetValue( aMtrFldDelay.GetValue() );
+ }
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxTextAnimationPage, ClickPixelHdl_Impl, void *, EMPTYARG )
+{
+ TriState eState = aTsbPixel.GetState();
+ if( eState == STATE_CHECK )
+ {
+ sal_Int64 nValue = aMtrFldAmount.GetValue() / 10;
+ aMtrFldAmount.Enable();
+ aMtrFldAmount.SetUnit( FUNIT_CUSTOM );
+ //SetFieldUnit( aMtrFldAmount, FUNIT_CUSTOM );
+ aMtrFldAmount.SetDecimalDigits( 0 );
+
+ aMtrFldAmount.SetSpinSize( 1 );
+ aMtrFldAmount.SetMin( 1 );
+ aMtrFldAmount.SetFirst( 1 );
+ aMtrFldAmount.SetMax( 100 );
+ aMtrFldAmount.SetLast( 100 );
+
+ aMtrFldAmount.SetValue( nValue );
+ }
+ else if( eState == STATE_NOCHECK )
+ {
+ sal_Int64 nValue = aMtrFldAmount.GetValue() * 10;
+ aMtrFldAmount.Enable();
+ aMtrFldAmount.SetUnit( eFUnit );
+ //SetFieldUnit( aMtrFldAmount, eFUnit );
+ aMtrFldAmount.SetDecimalDigits( 2 );
+
+ aMtrFldAmount.SetSpinSize( 10 );
+ aMtrFldAmount.SetMin( 1 );
+ aMtrFldAmount.SetFirst( 1 );
+ aMtrFldAmount.SetMax( 10000 );
+ aMtrFldAmount.SetLast( 10000 );
+
+ aMtrFldAmount.SetValue( nValue );
+ }
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxTextAnimationPage, ClickDirectionHdl_Impl, ImageButton *, pBtn )
+{
+ aBtnUp.Check( pBtn == &aBtnUp );
+ aBtnLeft.Check( pBtn == &aBtnLeft );
+ aBtnRight.Check( pBtn == &aBtnRight );
+ aBtnDown.Check( pBtn == &aBtnDown );
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxTextAnimationPage::SelectDirection( SdrTextAniDirection nValue )
+{
+ aBtnUp.Check( nValue == SDRTEXTANI_UP );
+ aBtnLeft.Check( nValue == SDRTEXTANI_LEFT );
+ aBtnRight.Check( nValue == SDRTEXTANI_RIGHT );
+ aBtnDown.Check( nValue == SDRTEXTANI_DOWN );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+USHORT SvxTextAnimationPage::GetSelectedDirection()
+{
+ USHORT nValue = 0;
+
+ if( aBtnUp.IsChecked() )
+ nValue = SDRTEXTANI_UP;
+ else if( aBtnLeft.IsChecked() )
+ nValue = SDRTEXTANI_LEFT;
+ else if( aBtnRight.IsChecked() )
+ nValue = SDRTEXTANI_RIGHT;
+ else if( aBtnDown.IsChecked() )
+ nValue = SDRTEXTANI_DOWN;
+
+ return( nValue );
+}
+
+
diff --git a/cui/source/tabpages/textanim.hrc b/cui/source/tabpages/textanim.hrc
new file mode 100644
index 000000000000..97d6b7c64525
--- /dev/null
+++ b/cui/source/tabpages/textanim.hrc
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * 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: textanim.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define LB_EFFECT 1
+#define CTL_EFFECT 1
+#define TSB_START_INSIDE 1
+#define TSB_STOP_INSIDE 2
+#define FL_EFFECT 1
+#define FT_EFFECTS 1
+#define FT_DIRECTION 2
+#define FL_PROPERTIES 2
+#define FT_COUNT 3
+#define TSB_ENDLESS 3
+#define NUM_FLD_COUNT 1
+#define FT_AMOUNT 4
+#define MTR_FLD_AMOUNT 1
+#define FT_DELAY 5
+#define MTR_FLD_DELAY 2
+#define TSB_PIXEL 4
+#define TSB_AUTO 5
+#define BTN_UP 1
+#define BTN_LEFT 2
+#define BTN_RIGHT 3
+#define BTN_DOWN 4
diff --git a/cui/source/tabpages/textanim.src b/cui/source/tabpages/textanim.src
new file mode 100644
index 000000000000..d9c211a020f5
--- /dev/null
+++ b/cui/source/tabpages/textanim.src
@@ -0,0 +1,322 @@
+/*************************************************************************
+ *
+ * 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: textanim.src,v $
+ * $Revision: 1.38 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svtools/controldims.hrc>
+#include <svx/dialogs.hrc>
+#include "textanim.hrc"
+
+// direction image buttons
+#define MA_HALFBUTTON_WIDTH 7
+#define MA_BUTTON_WIDTH (2 * MA_HALFBUTTON_WIDTH)
+#define MA_BUTTON_HEIGHT (2 * MA_HALFBUTTON_WIDTH)
+#define BUTTON_SIZE MAP_APPFONT( MA_BUTTON_WIDTH, MA_BUTTON_WIDTH )
+#define MA_MOVEBUT_GRACE_X 6
+
+// height of first group Text effects
+#define MA_EFFECTSGROUP_HEIGHT (RSC_CD_FIXEDLINE_HEIGHT + \
+ RSC_SP_FLGR_INNERBORDER_LEFT + \
+/* direction buttons */ 3*MA_BUTTON_HEIGHT + \
+ RSC_SP_FLGR_INNERBORDER_BOTTOM + RSC_SP_FLGR_SPACE_Y)
+
+// height of second group height of FIXEDTEXT
+#define MA_PROPERTIESGROUP_HEIGHT (RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_LEFT + \
+/* text initially visible */ RSC_CD_CHECKBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + \
+/* text finally visible */ RSC_CD_CHECKBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + \
+/* animation runs */ RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_GROUP_Y + \
+/* number of runs */ RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + \
+/* step size */ RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_GROUP_Y + \
+/* number of pixel */ RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + \
+/* step delay */ RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_GROUP_Y + \
+/* delay time */ RSC_CD_TEXTBOX_HEIGHT)
+
+
+// left space for real controls
+#define MA_LEFT_SPACE (RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT)
+
+// tabpage total size
+#define MA_TOTAL_WIDTH 260
+#define MA_TOTAL_HEIGHT RSC_SP_TBPG_INNERBORDER_TOP + MA_EFFECTSGROUP_HEIGHT + MA_PROPERTIESGROUP_HEIGHT + RSC_SP_TBPG_INNERBORDER_BOTTOM
+
+// X position and width of effects drop down
+#define MA_EFFECTLIST_X 50
+#define MA_EFFECTLIST_WIDTH 95
+
+
+ // RID_SVXPAGE_TEXTANIMATION ---------------------------------------------
+TabPage RID_SVXPAGE_TEXTANIMATION
+{
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( MA_TOTAL_WIDTH , 185 ) ;
+ Text [ en-US ] = "Animation" ;
+ FixedLine FL_EFFECT
+ {
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT, RSC_SP_TBPG_INNERBORDER_TOP ) ;
+ Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Text animation effects" ;
+ };
+#define MA_CURR_Y RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + MA_BUTTON_HEIGHT
+ FixedText FT_EFFECTS
+ {
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y + 3 ) ;
+ Size = MAP_APPFONT ( MA_EFFECTLIST_X - RSC_SP_CTRL_DESC_X - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_FLGR_INNERBORDER_LEFT,
+ RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "E~ffect" ;
+ };
+ ListBox LB_EFFECT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MA_EFFECTLIST_X, MA_CURR_Y + 1 ) ;
+ Size = MAP_APPFONT ( MA_EFFECTLIST_WIDTH , 57 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "No Effect" ; Default ; > ;
+ < "Blink" ; Default ; > ;
+ < "Scroll Through" ; Default ; > ;
+ < "Scroll Back and Forth" ; Default ; > ;
+ < "Scroll In" ; Default ; > ;
+ };
+ };
+ FixedText FT_DIRECTION
+ {
+ Pos = MAP_APPFONT ( MA_EFFECTLIST_X + MA_EFFECTLIST_WIDTH + RSC_SP_CTRL_X, MA_CURR_Y + 3 ) ;
+ Size = MAP_APPFONT ( MA_TOTAL_WIDTH -
+ (MA_MOVEBUT_GRACE_X + 3*MA_BUTTON_WIDTH + RSC_SP_TBPG_INNERBORDER_RIGHT + RSC_SP_FLGR_INNERBORDER_RIGHT) -
+ (MA_EFFECTLIST_X + MA_EFFECTLIST_WIDTH + RSC_SP_CTRL_X + RSC_SP_CTRL_DESC_X + 6),
+ RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Right = TRUE;
+ Text [ en-US ] = "Direction" ;
+ };
+ ImageButton BTN_UP
+ {
+ Pos = MAP_APPFONT ( MA_TOTAL_WIDTH - MA_MOVEBUT_GRACE_X - 2*MA_BUTTON_WIDTH - RSC_SP_TBPG_INNERBORDER_RIGHT - RSC_SP_FLGR_INNERBORDER_RIGHT,
+ RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP );
+ Size = BUTTON_SIZE ;
+ Symbol = IMAGEBUTTON_ARROW_UP ;
+ QuickHelpText [ en-US ] = "To Top" ;
+ };
+ ImageButton BTN_LEFT
+ {
+ Pos = MAP_APPFONT ( MA_TOTAL_WIDTH - MA_MOVEBUT_GRACE_X - 3*MA_BUTTON_WIDTH - RSC_SP_TBPG_INNERBORDER_RIGHT - RSC_SP_FLGR_INNERBORDER_RIGHT,
+ RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + MA_BUTTON_HEIGHT);
+ Size = BUTTON_SIZE ;
+ Symbol = IMAGEBUTTON_ARROW_LEFT ;
+ QuickHelpText [ en-US ] = "To Left" ;
+ };
+ ImageButton BTN_RIGHT
+ {
+ Pos = MAP_APPFONT ( MA_TOTAL_WIDTH - MA_MOVEBUT_GRACE_X - MA_BUTTON_WIDTH - RSC_SP_TBPG_INNERBORDER_RIGHT - RSC_SP_FLGR_INNERBORDER_RIGHT,
+ RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + MA_BUTTON_HEIGHT ) ;
+ Size = BUTTON_SIZE ;
+ Symbol = IMAGEBUTTON_ARROW_RIGHT ;
+ QuickHelpText [ en-US ] = "To Right" ;
+ };
+ ImageButton BTN_DOWN
+ {
+ Pos = MAP_APPFONT ( MA_TOTAL_WIDTH - MA_MOVEBUT_GRACE_X - 2*MA_BUTTON_WIDTH - RSC_SP_TBPG_INNERBORDER_RIGHT - RSC_SP_FLGR_INNERBORDER_RIGHT,
+ RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + 2*MA_BUTTON_HEIGHT ) ;
+ Size = BUTTON_SIZE ;
+ Symbol = IMAGEBUTTON_ARROW_DOWN ;
+ QuickHelpText [ en-US ] = "To Bottom" ;
+ };
+
+ FixedLine FL_PROPERTIES
+ {
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT , RSC_SP_TBPG_INNERBORDER_TOP + MA_EFFECTSGROUP_HEIGHT ) ;
+ Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Properties" ;
+ };
+#define MA_CURR_Y2 RSC_SP_TBPG_INNERBORDER_TOP + MA_EFFECTSGROUP_HEIGHT + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP
+ TriStateBox TSB_START_INSIDE
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y2 ) ;
+ Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "S~tart inside" ;
+ };
+#define MA_CURR_Y3 MA_CURR_Y2 + RSC_CD_CHECKBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y
+ TriStateBox TSB_STOP_INSIDE
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y3 ) ;
+ Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Text visible when exiting" ;
+ };
+#define MA_CURR_Y4 MA_CURR_Y3 + RSC_CD_CHECKBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y
+ FixedText FT_COUNT
+ {
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y4 ) ;
+ Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12,
+ RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Animation cycles" ;
+ };
+#define MA_CURR_Y5 MA_CURR_Y4 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP
+ TriStateBox TSB_ENDLESS
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 9 , MA_CURR_Y5 + 2 ) ;
+ Size = MAP_APPFONT ( 71 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "~Continuous" ;
+ };
+ NumericField NUM_FLD_COUNT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 80 + RSC_SP_CTRL_GROUP_X,
+ MA_CURR_Y5 ) ;
+ Size = MAP_APPFONT ( 50 , RSC_CD_TEXTBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ };
+#define MA_CURR_Y6 MA_CURR_Y5 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y
+ FixedText FT_AMOUNT
+ {
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y6 ) ;
+ Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12,
+ RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Increment" ;
+ };
+#define MA_CURR_Y7 MA_CURR_Y6 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP
+ TriStateBox TSB_PIXEL
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 9 , MA_CURR_Y7 + 2 ) ;
+ Size = MAP_APPFONT ( 71 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "~Pixels" ;
+ };
+ MetricField MTR_FLD_AMOUNT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 80 + RSC_SP_CTRL_GROUP_X,
+ MA_CURR_Y7 ) ;
+ Size = MAP_APPFONT ( 50 , RSC_CD_TEXTBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " Pixel" ;
+ Minimum = 1 ;
+ First = 1 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ };
+#define MA_CURR_Y8 MA_CURR_Y7 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y
+ FixedText FT_DELAY
+ {
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y8 ) ;
+ Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12,
+ RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Delay" ;
+ };
+#define MA_CURR_Y9 MA_CURR_Y8 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP
+ TriStateBox TSB_AUTO
+ {
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 9 , MA_CURR_Y9 + 2 ) ;
+ Size = MAP_APPFONT ( 71 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Automatic" ;
+ };
+ MetricField MTR_FLD_DELAY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 80 + RSC_SP_CTRL_GROUP_X,
+ MA_CURR_Y9 ) ;
+ Size = MAP_APPFONT ( 50 , RSC_CD_TEXTBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Spinsize = 50 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " ms" ;
+ Maximum = 30000 ;
+ Last = 30000 ;
+ };
+};
+ // RID_SVXDLG_TEXT -------------------------------------------------------
+TabDialog RID_SVXDLG_TEXT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 185 + 46 ) ;
+ Text [ en-US ] = "Text" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ PageResID = RID_SVXPAGE_TEXTATTR ;
+ Identifier = RID_SVXPAGE_TEXTATTR ;
+ Text [ en-US ] = "Text" ;
+ };
+ PageItem
+ {
+ PageResID = RID_SVXPAGE_TEXTANIMATION ;
+ Identifier = RID_SVXPAGE_TEXTANIMATION ;
+ Text [ en-US ] = "Text Animation" ;
+ };
+ };
+ };
+};
+ // ******************************************************************* EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx
new file mode 100644
index 000000000000..a4549b3b1d40
--- /dev/null
+++ b/cui/source/tabpages/textattr.cxx
@@ -0,0 +1,801 @@
+/*************************************************************************
+ *
+ * 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: textattr.cxx,v $
+ * $Revision: 1.28 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <tools/shl.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svddef.hxx>
+#include <svx/sdtditm.hxx>
+#include <svx/sdtagitm.hxx>
+#include <svx/sdtaitm.hxx>
+#include <svx/sdtfsitm.hxx>
+#include <svx/sdtcfitm.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdmark.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdotext.hxx>
+
+#ifndef _SVX_TEXTATTR_CXX
+#define _SVX_TEXTATTR_CXX
+#endif
+#include "textattr.hxx"
+#include "textattr.hrc"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include <sfx2/request.hxx> //add CHINA001
+#include <svx/ofaitem.hxx> //add CHINA001
+#include <svx/svxids.hrc> //add CHINA001
+#include <svx/writingmodeitem.hxx>
+
+static USHORT pRanges[] =
+{
+ SDRATTR_MISC_FIRST, SDRATTR_TEXT_HORZADJUST,
+ SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE,
+ 0
+};
+
+/*************************************************************************
+|*
+|* Dialog zum Kopieren von Objekten
+|*
+\************************************************************************/
+
+//CHINA001 SvxTextAttrDialog::SvxTextAttrDialog( Window* pParent, const SfxItemSet& rInAttrs,
+//CHINA001 const SdrView* pSdrView ) :
+//CHINA001 SfxSingleTabDialog( pParent, rInAttrs, RID_SVXPAGE_TEXTATTR )
+//CHINA001 {
+//CHINA001 SvxTextAttrPage* pPage = new SvxTextAttrPage( this, rInAttrs );
+//CHINA001
+//CHINA001 pPage->SetView( pSdrView );
+//CHINA001 pPage->Construct();
+//CHINA001
+//CHINA001 SetTabPage( pPage );
+//CHINA001 SetText( pPage->GetText() );
+//CHINA001 }
+//CHINA001
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+//CHINA001 SvxTextAttrDialog::~SvxTextAttrDialog()
+//CHINA001 {
+//CHINA001 }
+
+/*************************************************************************
+|*
+|* Dialog (Seite) zum Kopieren von Objekten
+|*
+\************************************************************************/
+
+SvxTextAttrPage::SvxTextAttrPage( Window* pWindow, const SfxItemSet& rInAttrs ) :
+ SvxTabPage ( pWindow, SVX_RES( RID_SVXPAGE_TEXTATTR ),
+ rInAttrs ),
+
+ aFlText ( this, SVX_RES( FL_TEXT ) ),
+ aTsbAutoGrowWidth ( this, SVX_RES( TSB_AUTOGROW_WIDTH ) ),
+ aTsbAutoGrowHeight ( this, SVX_RES( TSB_AUTOGROW_HEIGHT ) ),
+ aTsbFitToSize ( this, SVX_RES( TSB_FIT_TO_SIZE ) ),
+ aTsbContour ( this, SVX_RES( TSB_CONTOUR ) ),
+ aTsbWordWrapText( this, SVX_RES( TSB_WORDWRAP_TEXT ) ),
+ aTsbAutoGrowSize( this, SVX_RES( TSB_AUTOGROW_SIZE ) ),
+ aFlDistance ( this, SVX_RES( FL_DISTANCE ) ),
+ aFtLeft ( this, SVX_RES( FT_LEFT ) ),
+ aMtrFldLeft ( this, SVX_RES( MTR_FLD_LEFT ) ),
+ aFtRight ( this, SVX_RES( FT_RIGHT ) ),
+ aMtrFldRight ( this, SVX_RES( MTR_FLD_RIGHT ) ),
+ aFtTop ( this, SVX_RES( FT_TOP ) ),
+ aMtrFldTop ( this, SVX_RES( MTR_FLD_TOP ) ),
+ aFtBottom ( this, SVX_RES( FT_BOTTOM ) ),
+ aMtrFldBottom ( this, SVX_RES( MTR_FLD_BOTTOM ) ),
+
+ aFlSeparator ( this, SVX_RES( FL_SEPARATOR ) ),
+
+ aFlPosition ( this, SVX_RES( FL_POSITION ) ),
+ aCtlPosition ( this, SVX_RES( CTL_POSITION ),
+ RP_MM, 240, 100 ),
+ aTsbFullWidth ( this, SVX_RES( TSB_FULL_WIDTH ) ),
+
+ rOutAttrs ( rInAttrs )
+{
+ FreeResource();
+
+ FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs );
+ SetFieldUnit( aMtrFldLeft, eFUnit );
+ SetFieldUnit( aMtrFldRight, eFUnit );
+ SetFieldUnit( aMtrFldTop, eFUnit );
+ SetFieldUnit( aMtrFldBottom, eFUnit );
+
+ Link aLink( LINK( this, SvxTextAttrPage, ClickHdl_Impl ) );
+ aTsbAutoGrowWidth.SetClickHdl( aLink );
+ aTsbAutoGrowHeight.SetClickHdl( aLink );
+ aTsbFitToSize.SetClickHdl( aLink );
+ aTsbContour.SetClickHdl( aLink );
+
+ aTsbFullWidth.SetClickHdl(
+ LINK( this, SvxTextAttrPage, ClickFullWidthHdl_Impl ) );
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxTextAttrPage::~SvxTextAttrPage()
+{
+}
+
+/*************************************************************************
+|*
+|* Liest uebergebenen Item-Set
+|*
+\************************************************************************/
+
+void __EXPORT SvxTextAttrPage::Reset( const SfxItemSet& rAttrs )
+{
+ SfxItemPool* pPool = rAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ SfxMapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
+
+ // Linker Abstand vom Rahmen
+ const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_TEXT_LEFTDIST );
+
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LEFTDIST );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrTextLeftDistItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldLeft, nValue, eUnit );
+ }
+ else
+ aMtrFldLeft.SetText( String() );
+ aMtrFldLeft.SaveValue();
+
+ // Rechter Abstand vom Rahmen
+ pItem = GetItem( rAttrs, SDRATTR_TEXT_RIGHTDIST );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_RIGHTDIST );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrTextRightDistItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldRight, nValue, eUnit );
+ }
+ else
+ aMtrFldRight.SetText( String() );
+ aMtrFldRight.SaveValue();
+
+ // Oberer Abstand vom Rahmen
+ pItem = GetItem( rAttrs, SDRATTR_TEXT_UPPERDIST );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_UPPERDIST );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrTextUpperDistItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldTop, nValue, eUnit );
+ }
+ else
+ aMtrFldTop.SetText( String() );
+ aMtrFldTop.SaveValue();
+
+ // Unterer Abstand vom Rahmen
+ pItem = GetItem( rAttrs, SDRATTR_TEXT_LOWERDIST );
+ if( !pItem )
+ pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LOWERDIST );
+ if( pItem )
+ {
+ long nValue = ( ( const SdrTextLowerDistItem* )pItem )->GetValue();
+ SetMetricValue( aMtrFldBottom, nValue, eUnit );
+ }
+ else
+ aMtrFldBottom.SetText( String() );
+ aMtrFldBottom.SaveValue();
+
+ // An Hoehe anpassen
+ if ( rAttrs.GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbAutoGrowHeight.SetState( ( ( const SdrTextAutoGrowHeightItem& )rAttrs.Get( SDRATTR_TEXT_AUTOGROWHEIGHT ) ).
+ GetValue() ? STATE_CHECK : STATE_NOCHECK );
+ aTsbAutoGrowHeight.EnableTriState( FALSE );
+ }
+ else
+ aTsbAutoGrowHeight.SetState( STATE_DONTKNOW );
+ aTsbAutoGrowHeight.SaveValue();
+
+ // An Breite anpassen
+ if ( rAttrs.GetItemState( SDRATTR_TEXT_AUTOGROWWIDTH ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbAutoGrowWidth.SetState( ( ( const SdrTextAutoGrowWidthItem& )rAttrs.Get( SDRATTR_TEXT_AUTOGROWWIDTH ) ).
+ GetValue() ? STATE_CHECK : STATE_NOCHECK );
+ aTsbAutoGrowWidth.EnableTriState( FALSE );
+ }
+ else
+ aTsbAutoGrowWidth.SetState( STATE_DONTKNOW );
+ aTsbAutoGrowWidth.SaveValue();
+
+ // autogrowsize
+ if ( rAttrs.GetItemState( SDRATTR_TEXT_AUTOGROWSIZE ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbAutoGrowSize.SetState( ( ( const SdrTextAutoGrowHeightItem& )rAttrs.Get( SDRATTR_TEXT_AUTOGROWHEIGHT ) ).
+ GetValue() ? STATE_CHECK : STATE_NOCHECK );
+ aTsbAutoGrowSize.EnableTriState( FALSE );
+ }
+ else
+ aTsbAutoGrowSize.SetState( STATE_DONTKNOW );
+ aTsbAutoGrowSize.SaveValue();
+
+ // wordwrap text
+ if ( rAttrs.GetItemState( SDRATTR_TEXT_WORDWRAP ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbWordWrapText.SetState( ( ( const SdrTextWordWrapItem& )rAttrs.Get( SDRATTR_TEXT_WORDWRAP ) ).
+ GetValue() ? STATE_CHECK : STATE_NOCHECK );
+ aTsbWordWrapText.EnableTriState( FALSE );
+ }
+ else
+ aTsbWordWrapText.SetState( STATE_DONTKNOW );
+ aTsbWordWrapText.SaveValue();
+
+
+ // #103516# Do the setup based on states of hor/ver adjust
+ // Setup center field and FullWidth
+ SfxItemState eVState = rAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
+ SfxItemState eHState = rAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
+
+ if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState)
+ {
+ // VertAdjust and HorAdjust are unequivocal, thus
+ SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)rAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
+ SdrTextHorzAdjust eTHA = (SdrTextHorzAdjust)((const SdrTextHorzAdjustItem&)rAttrs.Get(SDRATTR_TEXT_HORZADJUST)).GetValue();
+ RECT_POINT eRP = RP_LB;
+
+ aTsbFullWidth.EnableTriState( FALSE );
+
+ // Translate item values into local anchor position.
+ switch (eTVA)
+ {
+ case SDRTEXTVERTADJUST_TOP:
+ {
+ switch (eTHA)
+ {
+ case SDRTEXTHORZADJUST_LEFT: eRP = RP_LT; break;
+ case SDRTEXTHORZADJUST_BLOCK:
+ case SDRTEXTHORZADJUST_CENTER: eRP = RP_MT; break;
+ case SDRTEXTHORZADJUST_RIGHT: eRP = RP_RT; break;
+ }
+ break;
+ }
+ case SDRTEXTVERTADJUST_BLOCK:
+ case SDRTEXTVERTADJUST_CENTER:
+ {
+ switch (eTHA)
+ {
+ case SDRTEXTHORZADJUST_LEFT: eRP = RP_LM; break;
+ case SDRTEXTHORZADJUST_BLOCK:
+ case SDRTEXTHORZADJUST_CENTER: eRP = RP_MM; break;
+ case SDRTEXTHORZADJUST_RIGHT: eRP = RP_RM; break;
+ }
+ break;
+ }
+ case SDRTEXTVERTADJUST_BOTTOM:
+ {
+ switch (eTHA)
+ {
+ case SDRTEXTHORZADJUST_LEFT: eRP = RP_LB; break;
+ case SDRTEXTHORZADJUST_BLOCK:
+ case SDRTEXTHORZADJUST_CENTER: eRP = RP_MB; break;
+ case SDRTEXTHORZADJUST_RIGHT: eRP = RP_RB; break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ // See if we have to check the "full width" check button.
+ sal_Bool bLeftToRight(IsTextDirectionLeftToRight());
+
+ if((bLeftToRight && (SDRTEXTHORZADJUST_BLOCK == eTHA)) || (!bLeftToRight && (SDRTEXTVERTADJUST_BLOCK == eTVA)))
+ {
+ // Move anchor to valid position.
+ ClickFullWidthHdl_Impl(NULL);
+ aTsbFullWidth.SetState(STATE_CHECK);
+ }
+
+ aCtlPosition.SetActualRP( eRP );
+ }
+ else
+ {
+ // VertAdjust or HorAdjust is not unequivocal
+ aCtlPosition.Reset();
+
+ aCtlPosition.SetState(STATE_DONTKNOW);
+ aCtlPosition.DoCompletelyDisable(sal_True);
+
+ aTsbFullWidth.SetState(STATE_DONTKNOW);
+ aTsbFullWidth.Enable( sal_False );
+ aFlPosition.Enable( sal_False );
+ }
+
+ // Am Rahmen anpassen
+ if ( rAttrs.GetItemState( SDRATTR_TEXT_FITTOSIZE ) != SFX_ITEM_DONTCARE )
+ {
+ SdrFitToSizeType eFTS = (SdrFitToSizeType)
+ ( ( const SdrTextFitToSizeTypeItem& )rAttrs.Get( SDRATTR_TEXT_FITTOSIZE ) ).GetValue();
+ aTsbFitToSize.SetState( eFTS == SDRTEXTFIT_NONE ? STATE_NOCHECK : STATE_CHECK );
+ aTsbFitToSize.EnableTriState( FALSE );
+ }
+ else
+ aTsbFitToSize.SetState( STATE_DONTKNOW );
+ aTsbFitToSize.SaveValue();
+
+ // Konturfluss
+ if( rAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME ) != SFX_ITEM_DONTCARE )
+ {
+ BOOL bContour = ( ( const SdrTextContourFrameItem& )rAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue();
+ aTsbContour.SetState( bContour ? STATE_CHECK : STATE_NOCHECK );
+ aTsbContour.EnableTriState( FALSE );
+ }
+ else
+ aTsbContour.SetState( STATE_DONTKNOW );
+ aTsbContour.SaveValue();
+
+ ClickHdl_Impl( NULL );
+}
+
+/*************************************************************************
+|*
+|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen
+|*
+\************************************************************************/
+
+BOOL SvxTextAttrPage::FillItemSet( SfxItemSet& rAttrs)
+{
+ SfxItemPool* pPool = rAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ SfxMapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
+
+ INT32 nValue;
+ TriState eState;
+
+ if( aMtrFldLeft.GetText() != aMtrFldLeft.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldLeft, eUnit );
+ rAttrs.Put( SdrTextLeftDistItem( nValue ) );
+ }
+
+ if( aMtrFldRight.GetText() != aMtrFldRight.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldRight, eUnit );
+ rAttrs.Put( SdrTextRightDistItem( nValue ) );
+ }
+
+ if( aMtrFldTop.GetText() != aMtrFldTop.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldTop, eUnit );
+ rAttrs.Put( SdrTextUpperDistItem( nValue ) );
+ }
+
+ if( aMtrFldBottom.GetText() != aMtrFldBottom.GetSavedValue() )
+ {
+ nValue = GetCoreValue( aMtrFldBottom, eUnit );
+ rAttrs.Put( SdrTextLowerDistItem( nValue ) );
+ }
+
+ eState = aTsbAutoGrowHeight.GetState();
+ if( eState != aTsbAutoGrowHeight.GetSavedValue() )
+ {
+ rAttrs.Put( SdrTextAutoGrowHeightItem( (BOOL) STATE_CHECK == eState ) );
+ }
+
+ eState = aTsbAutoGrowWidth.GetState();
+ if( eState != aTsbAutoGrowWidth.GetSavedValue() )
+ {
+ rAttrs.Put( SdrTextAutoGrowWidthItem( (BOOL) STATE_CHECK == eState ) );
+ }
+
+ eState = aTsbAutoGrowSize.GetState();
+ if( eState != aTsbAutoGrowSize.GetSavedValue() )
+ {
+ rAttrs.Put( SdrTextAutoGrowHeightItem( (BOOL) STATE_CHECK == eState ) );
+ }
+
+ eState = aTsbWordWrapText.GetState();
+ if( eState != aTsbWordWrapText.GetSavedValue() )
+ {
+ rAttrs.Put( SdrTextWordWrapItem( (BOOL) STATE_CHECK == eState ) );
+ }
+
+ // Konturfluss
+ eState = aTsbContour.GetState();
+ if( eState != aTsbContour.GetSavedValue() )
+ {
+ rAttrs.Put( SdrTextContourFrameItem( (BOOL) STATE_CHECK == eState ) );
+ }
+
+ eState = aTsbFitToSize.GetState();
+ if( eState != aTsbFitToSize.GetSavedValue() )
+ {
+ SdrFitToSizeType eFTS;
+ switch( eState )
+ {
+ default: ; //prevent warning
+ DBG_ERROR( "svx::SvxTextAttrPage::FillItemSet(), unhandled state!" );
+ case STATE_NOCHECK: eFTS = SDRTEXTFIT_NONE; break;
+ //case STATE_CHECK: eFTS = SDRTEXTFIT_RESIZEATTR; break;
+ case STATE_CHECK: eFTS = SDRTEXTFIT_PROPORTIONAL; break;
+ }
+ rAttrs.Put( SdrTextFitToSizeTypeItem( eFTS ) );
+ }
+
+ // zentriert
+ RECT_POINT eRP = aCtlPosition.GetActualRP();
+ SdrTextVertAdjust eTVA, eOldTVA;
+ SdrTextHorzAdjust eTHA, eOldTHA;
+
+ switch( eRP )
+ {
+ default:
+ case RP_LT: eTVA = SDRTEXTVERTADJUST_TOP;
+ eTHA = SDRTEXTHORZADJUST_LEFT; break;
+ case RP_LM: eTVA = SDRTEXTVERTADJUST_CENTER;
+ eTHA = SDRTEXTHORZADJUST_LEFT; break;
+ case RP_LB: eTVA = SDRTEXTVERTADJUST_BOTTOM;
+ eTHA = SDRTEXTHORZADJUST_LEFT; break;
+ case RP_MT: eTVA = SDRTEXTVERTADJUST_TOP;
+ eTHA = SDRTEXTHORZADJUST_CENTER; break;
+ case RP_MM: eTVA = SDRTEXTVERTADJUST_CENTER;
+ eTHA = SDRTEXTHORZADJUST_CENTER; break;
+ case RP_MB: eTVA = SDRTEXTVERTADJUST_BOTTOM;
+ eTHA = SDRTEXTHORZADJUST_CENTER; break;
+ case RP_RT: eTVA = SDRTEXTVERTADJUST_TOP;
+ eTHA = SDRTEXTHORZADJUST_RIGHT; break;
+ case RP_RM: eTVA = SDRTEXTVERTADJUST_CENTER;
+ eTHA = SDRTEXTHORZADJUST_RIGHT; break;
+ case RP_RB: eTVA = SDRTEXTVERTADJUST_BOTTOM;
+ eTHA = SDRTEXTHORZADJUST_RIGHT; break;
+ }
+
+ // #103516# Do not change values if adjust controls were disabled.
+ sal_Bool bIsDisabled(aCtlPosition.IsCompletelyDisabled());
+
+ if(!bIsDisabled)
+ {
+ if( aTsbFullWidth.GetState() == STATE_CHECK )
+ {
+ if (IsTextDirectionLeftToRight())
+ eTHA = SDRTEXTHORZADJUST_BLOCK;
+ else
+ eTVA = SDRTEXTVERTADJUST_BLOCK;
+ }
+
+ if ( rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ) != SFX_ITEM_DONTCARE )
+ {
+ eOldTVA = (SdrTextVertAdjust)
+ ( ( const SdrTextVertAdjustItem& )rOutAttrs.Get( SDRATTR_TEXT_VERTADJUST ) ).GetValue();
+ if( eOldTVA != eTVA )
+ rAttrs.Put( SdrTextVertAdjustItem( eTVA ) );
+ }
+ else
+ rAttrs.Put( SdrTextVertAdjustItem( eTVA ) );
+
+ if ( rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ) != SFX_ITEM_DONTCARE )
+ {
+ eOldTHA = (SdrTextHorzAdjust)
+ ( ( const SdrTextHorzAdjustItem& )rOutAttrs.Get( SDRATTR_TEXT_HORZADJUST ) ).GetValue();
+ if( eOldTHA != eTHA )
+ rAttrs.Put( SdrTextHorzAdjustItem( eTHA ) );
+ }
+ else
+ rAttrs.Put( SdrTextHorzAdjustItem( eTHA ) );
+ }
+
+ return( TRUE );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxTextAttrPage::Construct()
+{
+ DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
+
+ bFitToSizeEnabled = bContourEnabled = TRUE;
+ bWordWrapTextEnabled = bAutoGrowSizeEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = FALSE;
+
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ SdrObjKind eKind = (SdrObjKind) pObj->GetObjIdentifier();
+ if( pObj->GetObjInventor() == SdrInventor )
+ {
+ switch( eKind )
+ {
+ case OBJ_TEXT :
+ case OBJ_TITLETEXT :
+ case OBJ_OUTLINETEXT :
+ case OBJ_CAPTION :
+ {
+ if ( ((SdrTextObj*)pObj)->HasText() )
+ {
+ // Konturfluss ist NICHT bei reinen Textobjekten m�glich
+ bContourEnabled = FALSE;
+
+ // Breite und Hoehe anpassen ist NUR bei reinen Textobjekten m�glich
+ bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = TRUE;
+ }
+ }
+ break;
+ case OBJ_CUSTOMSHAPE :
+ {
+ bFitToSizeEnabled = bContourEnabled = FALSE;
+ bAutoGrowSizeEnabled = TRUE;
+ bWordWrapTextEnabled = TRUE;
+ }
+ break;
+ default: ;//prevent warning
+ }
+ }
+ }
+ aTsbAutoGrowHeight.Enable( bAutoGrowHeightEnabled );
+ aTsbAutoGrowWidth.Enable( bAutoGrowWidthEnabled );
+ aTsbFitToSize.Enable( bFitToSizeEnabled );
+ aTsbContour.Enable( bContourEnabled );
+ aTsbAutoGrowSize.Enable( bAutoGrowSizeEnabled );
+ aTsbWordWrapText.Enable( bWordWrapTextEnabled );
+}
+
+/*************************************************************************
+|*
+|* Erzeugt die Seite
+|*
+\************************************************************************/
+
+SfxTabPage* SvxTextAttrPage::Create( Window* pWindow,
+ const SfxItemSet& rAttrs )
+{
+ return( new SvxTextAttrPage( pWindow, rAttrs ) );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+USHORT* SvxTextAttrPage::GetRanges()
+{
+ return( pRanges );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+/** Check whether we have to uncheck the "Full width" check box.
+*/
+void SvxTextAttrPage::PointChanged( Window*, RECT_POINT eRP )
+{
+ if (aTsbFullWidth.GetState() == STATE_CHECK)
+ {
+ // Depending on write direction and currently checked anchor we have
+ // to uncheck the "full width" button.
+ if (IsTextDirectionLeftToRight())
+ switch( eRP )
+ {
+ case RP_LT:
+ case RP_LM:
+ case RP_LB:
+ case RP_RT:
+ case RP_RM:
+ case RP_RB:
+ aTsbFullWidth.SetState( STATE_NOCHECK );
+ break;
+ default: ;//prevent warning
+ }
+ else
+ switch (eRP)
+ {
+ case RP_LT:
+ case RP_MT:
+ case RP_RT:
+ case RP_LB:
+ case RP_MB:
+ case RP_RB:
+ aTsbFullWidth.SetState( STATE_NOCHECK );
+ break;
+ default: ;//prevent warning
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Aendert evtl. die Position des Positions-Controls
+|*
+\************************************************************************/
+
+/** When switching the "full width" check button on the text anchor may have
+ to be moved to a valid and adjacent position. This position depends on
+ the current anchor position and the text writing direction.
+*/
+IMPL_LINK( SvxTextAttrPage, ClickFullWidthHdl_Impl, void *, EMPTYARG )
+{
+ if( aTsbFullWidth.GetState() == STATE_CHECK )
+ {
+ if (IsTextDirectionLeftToRight())
+ {
+ // Move text anchor to horizontal middle axis.
+ switch( aCtlPosition.GetActualRP() )
+ {
+ case RP_LT:
+ case RP_RT:
+ aCtlPosition.SetActualRP( RP_MT );
+ break;
+
+ case RP_LM:
+ case RP_RM:
+ aCtlPosition.SetActualRP( RP_MM );
+ break;
+
+ case RP_LB:
+ case RP_RB:
+ aCtlPosition.SetActualRP( RP_MB );
+ break;
+ default: ;//prevent warning
+ }
+ }
+ else
+ {
+ // Move text anchor to vertical middle axis.
+ switch( aCtlPosition.GetActualRP() )
+ {
+ case RP_LT:
+ case RP_LB:
+ aCtlPosition.SetActualRP( RP_LM );
+ break;
+
+ case RP_MT:
+ case RP_MB:
+ aCtlPosition.SetActualRP( RP_MM );
+ break;
+
+ case RP_RT:
+ case RP_RB:
+ aCtlPosition.SetActualRP( RP_RM );
+ break;
+ default: ;//prevent warning
+ }
+ }
+ }
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Enabled/Disabled "Groesse an Text" oder "Am Rahmen Anpassen"
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxTextAttrPage, ClickHdl_Impl, void *, EMPTYARG )
+{
+ BOOL bAutoGrowWidth = aTsbAutoGrowWidth.GetState() == STATE_CHECK;
+ BOOL bAutoGrowHeight = aTsbAutoGrowHeight.GetState() == STATE_CHECK;
+ BOOL bFitToSize = aTsbFitToSize.GetState() == STATE_CHECK;
+ BOOL bContour = aTsbContour.GetState() == STATE_CHECK;
+
+ aTsbContour.Enable( !bFitToSize &&
+ !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) &&
+ bContourEnabled );
+
+ aTsbAutoGrowWidth.Enable( !bFitToSize &&
+ !( bContour && bContourEnabled ) &&
+ bAutoGrowWidthEnabled );
+
+ aTsbAutoGrowHeight.Enable( !bFitToSize &&
+ !( bContour && bContourEnabled ) &&
+ bAutoGrowHeightEnabled );
+
+ aTsbFitToSize.Enable( !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) &&
+ !( bContour && bContourEnabled ) &&
+ bFitToSizeEnabled );
+
+ // #101901# enable/disable metric fields and decorations dependent of contour
+ aMtrFldLeft.Enable(!bContour);
+ aMtrFldRight.Enable(!bContour);
+ aMtrFldTop.Enable(!bContour);
+ aMtrFldBottom.Enable(!bContour);
+ aFlDistance.Enable(!bContour);
+ aFtLeft.Enable(!bContour);
+ aFtRight.Enable(!bContour);
+ aFtTop.Enable(!bContour);
+ aFtBottom.Enable(!bContour);
+
+ if( bContour && bContourEnabled )
+ {
+ aMtrFldLeft.SetValue( 0 );
+ aMtrFldRight.SetValue( 0 );
+ aMtrFldTop.SetValue( 0 );
+ aMtrFldBottom.SetValue( 0 );
+ }
+
+ // #103516# Do the setup based on states of hor/ver adjust
+ SfxItemState eVState = rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
+ SfxItemState eHState = rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
+ sal_Bool bHorAndVer(SFX_ITEM_DONTCARE == eVState || SFX_ITEM_DONTCARE == eHState);
+
+ // #83698# enable/disable text anchoring dependent of contour
+ aCtlPosition.Enable(!bContour && !bHorAndVer);
+ aTsbFullWidth.Enable(!bContour && !bHorAndVer);
+ aFlPosition.Enable(!bContour && !bHorAndVer);
+
+ return( 0L );
+}
+
+
+bool SvxTextAttrPage::IsTextDirectionLeftToRight (void) const
+{
+ // Determine the text writing direction with left to right as default.
+ bool bLeftToRightDirection = true;
+ SfxItemState eState = rOutAttrs.GetItemState(SDRATTR_TEXTDIRECTION);
+
+ if(SFX_ITEM_DONTCARE != eState)
+ {
+ const SvxWritingModeItem& rItem = static_cast<const SvxWritingModeItem&> (
+ rOutAttrs.Get (SDRATTR_TEXTDIRECTION));
+ if (rItem.GetValue() == com::sun::star::text::WritingMode_TB_RL)
+ bLeftToRightDirection = false;
+ }
+ return bLeftToRightDirection;
+}
+
+//add CHINA001 begin
+void SvxTextAttrPage::PageCreated(SfxAllItemSet aSet)
+{
+ SFX_ITEMSET_ARG (&aSet,pViewItem,OfaPtrItem,SID_SVXTEXTATTRPAGE_VIEW,sal_False);
+
+ if (pViewItem)
+ SetView( static_cast<SdrView *>(pViewItem->GetValue()));
+
+ Construct();
+}
+
+//end of CHINA001
diff --git a/cui/source/tabpages/textattr.hrc b/cui/source/tabpages/textattr.hrc
new file mode 100644
index 000000000000..5abc50f04250
--- /dev/null
+++ b/cui/source/tabpages/textattr.hrc
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * 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: textattr.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_TEXT 2
+#define FL_DISTANCE 1
+#define FL_POSITION 3
+#define FL_SEPARATOR 4
+#define TSB_AUTOGROW_HEIGHT 1
+#define TSB_AUTOGROW_WIDTH 2
+#define TSB_FIT_TO_SIZE 3
+#define TSB_FULL_WIDTH 4
+#define TSB_CONTOUR 5
+#define TSB_WORDWRAP_TEXT 6
+#define TSB_AUTOGROW_SIZE 7
+#define CTL_POSITION 1
+#define FT_LEFT 1
+#define MTR_FLD_LEFT 1
+#define FT_RIGHT 2
+#define MTR_FLD_RIGHT 2
+#define FT_TOP 3
+#define MTR_FLD_TOP 3
+#define FT_BOTTOM 4
+#define MTR_FLD_BOTTOM 4
diff --git a/cui/source/tabpages/textattr.src b/cui/source/tabpages/textattr.src
new file mode 100644
index 000000000000..d0d22044bb51
--- /dev/null
+++ b/cui/source/tabpages/textattr.src
@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * 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: textattr.src,v $
+ * $Revision: 1.33 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svtools/controldims.hrc>
+#include <svx/dialogs.hrc>
+#include "textattr.hrc"
+#include "helpid.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXPAGE_TEXTATTR --------------------------------------------------
+TabPage RID_SVXPAGE_TEXTATTR
+{
+ HelpId = HID_PAGE_TEXTATTR ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Text" ;
+ FixedLine FL_TEXT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Text" ;
+ };
+ TriStateBox TSB_AUTOGROW_WIDTH
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 102 , 10 ) ;
+ Text [ en-US ] = "Fit wi~dth to text" ;
+ };
+ TriStateBox TSB_AUTOGROW_HEIGHT
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 102 , 10 ) ;
+ Text [ en-US ] = "Fit h~eight to text" ;
+ };
+ TriStateBox TSB_FIT_TO_SIZE
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 42 ) ;
+ Size = MAP_APPFONT ( 102 , 10 ) ;
+ Text [ en-US ] = "~Fit to frame" ;
+ };
+ TriStateBox TSB_CONTOUR
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 56 ) ;
+ Size = MAP_APPFONT ( 102 , 10 ) ;
+ Text [ en-US ] = "~Adjust to contour" ;
+ };
+ TriStateBox TSB_WORDWRAP_TEXT
+ {
+ TabStop = TRUE;
+ Pos = MAP_APPFONT( 132, 14 ) ;
+ Size = MAP_APPFONT( 127 , 10 ) ;
+ Text [ en-US ] = "~Word wrap text in shape";
+ };
+ TriStateBox TSB_AUTOGROW_SIZE
+ {
+ TabStop = TRUE;
+ Pos = MAP_APPFONT( 132, 28 );
+ Size = MAP_APPFONT( 127 , 10 );
+ Text [ en-US ] = "~Resize shape to fit text";
+ };
+ FixedLine FL_DISTANCE
+ {
+ Pos = MAP_APPFONT ( 6 , 72 ) ;
+ Size = MAP_APPFONT ( 114 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Spacing to borders" ;
+ };
+ FixedText FT_LEFT
+ {
+ Pos = MAP_APPFONT ( 12 , 85 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Left" ;
+ };
+ FixedText FT_RIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 101 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Right" ;
+ };
+ FixedText FT_TOP
+ {
+ Pos = MAP_APPFONT ( 12 , 117 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Top" ;
+ };
+ FixedText FT_BOTTOM
+ {
+ Pos = MAP_APPFONT ( 12 , 133 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Bottom" ;
+ };
+ MetricField MTR_FLD_LEFT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 69 , 83 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ };
+ MetricField MTR_FLD_RIGHT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 69 , 99 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ };
+ MetricField MTR_FLD_TOP
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 69 , 115 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ };
+ MetricField MTR_FLD_BOTTOM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 69 , 131 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ Minimum = -10000 ;
+ First = -10000 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 121 , 83 ) ;
+ Size = MAP_APPFONT ( RSC_CD_FIXEDLINE_WIDTH , 66 ) ;
+ Vert = TRUE;
+ };
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( 126 , 72 ) ;
+ Size = MAP_APPFONT ( 128 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Text anchor" ;
+ };
+ Control CTL_POSITION
+ {
+ HelpId = HID_TEXTATTR_CTL_POSITION ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 132 , 83 ) ;
+ Size = MAP_APPFONT ( 116 , 52 ) ;
+ TabStop = TRUE ;
+ };
+ TriStateBox TSB_FULL_WIDTH
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 132 , 139 ) ;
+ Size = MAP_APPFONT ( 116 , 10 ) ;
+ Text [ en-US ] = "Full ~width" ;
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
new file mode 100644
index 000000000000..82992149715d
--- /dev/null
+++ b/cui/source/tabpages/tparea.cxx
@@ -0,0 +1,2582 @@
+/*************************************************************************
+ *
+ * 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: tparea.cxx,v $
+ * $Revision: 1.31 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+
+#define _SVX_TPAREA_CXX
+
+#if defined (UNX) || defined (WTC) || defined (ICC) || defined(WNT)
+#include <stdlib.h>
+#endif
+
+#include "svx/xattr.hxx"
+#include <svx/xpool.hxx>
+#include <svx/dialogs.hrc>
+#include "tabarea.hrc"
+//#include "dlgname.hrc"
+#include <svx/xflbckit.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xlineit0.hxx>
+#include "svx/drawitem.hxx"
+#include "cuitabarea.hxx"
+#include "dlgname.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include <svl/intitem.hxx> //add CHINA001
+#include <sfx2/request.hxx>//add CHINA001
+
+#define DLGWIN this->GetParent()->GetParent()
+
+// static ----------------------------------------------------------------
+
+static USHORT pAreaRanges[] =
+{
+ XATTR_GRADIENTSTEPCOUNT,
+ XATTR_GRADIENTSTEPCOUNT,
+ SID_ATTR_FILL_STYLE,
+ SID_ATTR_FILL_BITMAP,
+ 0
+};
+
+static USHORT pTransparenceRanges[] =
+{
+ XATTR_FILLTRANSPARENCE,
+ XATTR_FILLTRANSPARENCE,
+ SDRATTR_SHADOWTRANSPARENCE,
+ SDRATTR_SHADOWTRANSPARENCE,
+ XATTR_FILLFLOATTRANSPARENCE,
+ XATTR_FILLFLOATTRANSPARENCE,
+ 0
+};
+
+/*************************************************************************
+|*
+|* Dialog for transparence
+|*
+\************************************************************************/
+
+IMPL_LINK(SvxTransparenceTabPage, ClickTransOffHdl_Impl, void *, EMPTYARG)
+{
+ // disable all other controls
+ ActivateLinear(FALSE);
+ ActivateGradient(FALSE);
+
+ // Preview
+ rXFSet.ClearItem (XATTR_FILLTRANSPARENCE);
+ rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE);
+ aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
+
+ InvalidatePreview( FALSE );
+
+ return( 0L );
+}
+
+IMPL_LINK(SvxTransparenceTabPage, ClickTransLinearHdl_Impl, void *, EMPTYARG)
+{
+ // enable linear, disable other
+ ActivateLinear(TRUE);
+ ActivateGradient(FALSE);
+
+ // preview
+ rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE);
+ ModifyTransparentHdl_Impl (NULL);
+
+ return( 0L );
+}
+
+IMPL_LINK(SvxTransparenceTabPage, ClickTransGradientHdl_Impl, void *, EMPTYARG)
+{
+ // enable gradient, disable other
+ ActivateLinear(FALSE);
+ ActivateGradient(TRUE);
+
+ // preview
+ rXFSet.ClearItem (XATTR_FILLTRANSPARENCE);
+ ModifiedTrgrHdl_Impl (NULL);
+
+ return( 0L );
+}
+
+void SvxTransparenceTabPage::ActivateLinear(BOOL bActivate)
+{
+ aMtrTransparent.Enable(bActivate);
+}
+
+IMPL_LINK(SvxTransparenceTabPage, ModifyTransparentHdl_Impl, void*, EMPTYARG)
+{
+ UINT16 nPos = (UINT16)aMtrTransparent.GetValue();
+ XFillTransparenceItem aItem(nPos);
+ rXFSet.Put(XFillTransparenceItem(aItem));
+
+ // preview
+ InvalidatePreview();
+
+ return 0L;
+}
+
+IMPL_LINK(SvxTransparenceTabPage, ModifiedTrgrHdl_Impl, void *, pControl)
+{
+ if(pControl == &aLbTrgrGradientType || pControl == this)
+ {
+ XGradientStyle eXGS = (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos();
+ SetControlState_Impl( eXGS );
+ }
+
+ // preview
+ UINT8 nStartCol = (UINT8)(((UINT16)aMtrTrgrStartValue.GetValue() * 255) / 100);
+ UINT8 nEndCol = (UINT8)(((UINT16)aMtrTrgrEndValue.GetValue() * 255) / 100);
+ XGradient aTmpGradient(
+ Color(nStartCol, nStartCol, nStartCol),
+ Color(nEndCol, nEndCol, nEndCol),
+ (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(),
+ (UINT16)aMtrTrgrAngle.GetValue() * 10,
+ (UINT16)aMtrTrgrCenterX.GetValue(),
+ (UINT16)aMtrTrgrCenterY.GetValue(),
+ (UINT16)aMtrTrgrBorder.GetValue(),
+ 100, 100);
+
+ String aString;
+ XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aTmpGradient);
+ rXFSet.Put ( aItem );
+
+ InvalidatePreview();
+
+ return( 0L );
+}
+
+void SvxTransparenceTabPage::ActivateGradient(BOOL bActivate)
+{
+ aFtTrgrType.Enable(bActivate);
+ aLbTrgrGradientType.Enable(bActivate);
+ aFtTrgrCenterX.Enable(bActivate);
+ aMtrTrgrCenterX.Enable(bActivate);
+ aFtTrgrCenterY.Enable(bActivate);
+ aMtrTrgrCenterY.Enable(bActivate);
+ aFtTrgrAngle.Enable(bActivate);
+ aMtrTrgrAngle.Enable(bActivate);
+ aFtTrgrBorder.Enable(bActivate);
+ aMtrTrgrBorder.Enable(bActivate);
+ aFtTrgrStartValue.Enable(bActivate);
+ aMtrTrgrStartValue.Enable(bActivate);
+ aFtTrgrEndValue.Enable(bActivate);
+ aMtrTrgrEndValue.Enable(bActivate);
+
+ if(bActivate)
+ {
+ XGradientStyle eXGS = (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos();
+ SetControlState_Impl( eXGS );
+ }
+}
+
+IMPL_LINK(SvxTransparenceTabPage, ChangeTrgrTypeHdl_Impl, void *, EMPTYARG)
+{
+ return( 0L );
+}
+
+void SvxTransparenceTabPage::SetControlState_Impl(XGradientStyle eXGS)
+{
+ switch(eXGS)
+ {
+ case XGRAD_LINEAR:
+ case XGRAD_AXIAL:
+ aFtTrgrCenterX.Disable();
+ aMtrTrgrCenterX.Disable();
+ aFtTrgrCenterY.Disable();
+ aMtrTrgrCenterY.Disable();
+ aFtTrgrAngle.Enable();
+ aMtrTrgrAngle.Enable();
+ break;
+
+ case XGRAD_RADIAL:
+ aFtTrgrCenterX.Enable();
+ aMtrTrgrCenterX.Enable();
+ aFtTrgrCenterY.Enable();
+ aMtrTrgrCenterY.Enable();
+ aFtTrgrAngle.Disable();
+ aMtrTrgrAngle.Disable();
+ break;
+
+ case XGRAD_ELLIPTICAL:
+ aFtTrgrCenterX.Enable();
+ aMtrTrgrCenterX.Enable();
+ aFtTrgrCenterY.Enable();
+ aMtrTrgrCenterY.Enable();
+ aFtTrgrAngle.Enable();
+ aMtrTrgrAngle.Enable();
+ break;
+
+ case XGRAD_SQUARE:
+ case XGRAD_RECT:
+ aFtTrgrCenterX.Enable();
+ aMtrTrgrCenterX.Enable();
+ aFtTrgrCenterY.Enable();
+ aMtrTrgrCenterY.Enable();
+ aFtTrgrAngle.Enable();
+ aMtrTrgrAngle.Enable();
+ break;
+ }
+}
+
+SvxTransparenceTabPage::SvxTransparenceTabPage(Window* pParent, const SfxItemSet& rInAttrs)
+: SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_TRANSPARENCE ), rInAttrs),
+ rOutAttrs ( rInAttrs ),
+ nPageType(0),
+ nDlgType(0),
+
+ aFlProp ( this, SVX_RES( FL_PROP ) ),
+ aRbtTransOff ( this, SVX_RES( RBT_TRANS_OFF ) ),
+ aRbtTransLinear ( this, SVX_RES( RBT_TRANS_LINEAR ) ),
+ aRbtTransGradient ( this, SVX_RES( RBT_TRANS_GRADIENT ) ),
+
+ aMtrTransparent ( this, SVX_RES( MTR_TRANSPARENT ) ),
+
+ aFtTrgrType ( this, SVX_RES( FT_TRGR_TYPE ) ),
+ aLbTrgrGradientType ( this, SVX_RES( LB_TRGR_GRADIENT_TYPES ) ),
+ aFtTrgrCenterX ( this, SVX_RES( FT_TRGR_CENTER_X ) ),
+ aMtrTrgrCenterX ( this, SVX_RES( MTR_TRGR_CENTER_X ) ),
+ aFtTrgrCenterY ( this, SVX_RES( FT_TRGR_CENTER_Y ) ),
+ aMtrTrgrCenterY ( this, SVX_RES( MTR_TRGR_CENTER_Y ) ),
+ aFtTrgrAngle ( this, SVX_RES( FT_TRGR_ANGLE ) ),
+ aMtrTrgrAngle ( this, SVX_RES( MTR_TRGR_ANGLE ) ),
+ aFtTrgrBorder ( this, SVX_RES( FT_TRGR_BORDER ) ),
+ aMtrTrgrBorder ( this, SVX_RES( MTR_TRGR_BORDER ) ),
+ aFtTrgrStartValue ( this, SVX_RES( FT_TRGR_START_VALUE ) ),
+ aMtrTrgrStartValue ( this, SVX_RES( MTR_TRGR_START_VALUE ) ),
+ aFtTrgrEndValue ( this, SVX_RES( FT_TRGR_END_VALUE ) ),
+ aMtrTrgrEndValue ( this, SVX_RES( MTR_TRGR_END_VALUE ) ),
+
+ aCtlBitmapPreview ( this, SVX_RES( CTL_BITMAP_PREVIEW ) ),
+ aCtlXRectPreview ( this, SVX_RES( CTL_TRANS_PREVIEW ) ),
+ bBitmap ( FALSE ),
+ pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
+ aXFillAttr ( pXPool ),
+ rXFSet ( aXFillAttr.GetItemSet() )
+{
+ FreeResource();
+
+ // main selection
+ aRbtTransOff.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransOffHdl_Impl));
+ aRbtTransLinear.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransLinearHdl_Impl));
+ aRbtTransGradient.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransGradientHdl_Impl));
+
+ // linear transparency
+ aMtrTransparent.SetValue( 50 );
+ aMtrTransparent.SetModifyHdl(LINK(this, SvxTransparenceTabPage, ModifyTransparentHdl_Impl));
+
+ // gradient transparency
+ aMtrTrgrEndValue.SetValue( 100 );
+ aMtrTrgrStartValue.SetValue( 0 );
+ aLbTrgrGradientType.SetSelectHdl(LINK(this, SvxTransparenceTabPage, ChangeTrgrTypeHdl_Impl));
+ Link aLink = LINK( this, SvxTransparenceTabPage, ModifiedTrgrHdl_Impl);
+ aLbTrgrGradientType.SetSelectHdl( aLink );
+ aMtrTrgrCenterX.SetModifyHdl( aLink );
+ aMtrTrgrCenterY.SetModifyHdl( aLink );
+ aMtrTrgrAngle.SetModifyHdl( aLink );
+ aMtrTrgrBorder.SetModifyHdl( aLink );
+ aMtrTrgrStartValue.SetModifyHdl( aLink );
+ aMtrTrgrEndValue.SetModifyHdl( aLink );
+
+ // this page needs ExchangeSupport
+ SetExchangeSupport();
+}
+
+void SvxTransparenceTabPage::Construct()
+{
+}
+
+SfxTabPage* SvxTransparenceTabPage::Create(Window* pWindow, const SfxItemSet& rAttrs)
+{
+ return(new SvxTransparenceTabPage(pWindow, rAttrs));
+}
+
+UINT16* SvxTransparenceTabPage::GetRanges()
+{
+ return(pTransparenceRanges);
+}
+
+BOOL SvxTransparenceTabPage::FillItemSet(SfxItemSet& rAttrs)
+{
+ const SfxPoolItem* pGradientItem = NULL;
+ const SfxPoolItem* pLinearItem = NULL;
+ SfxItemState eStateGradient(rOutAttrs.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem));
+ SfxItemState eStateLinear(rOutAttrs.GetItemState(XATTR_FILLTRANSPARENCE, TRUE, &pLinearItem));
+ BOOL bGradActive = (eStateGradient == SFX_ITEM_SET && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled());
+ BOOL bLinearActive = (eStateLinear == SFX_ITEM_SET && ((XFillTransparenceItem*)pLinearItem)->GetValue() != 0);
+
+ // #103765#
+ BOOL bGradUsed = (eStateGradient == SFX_ITEM_DONTCARE);
+ BOOL bLinearUsed = (eStateLinear == SFX_ITEM_DONTCARE);
+
+ BOOL bModified(FALSE);
+ BOOL bSwitchOffLinear(FALSE);
+ BOOL bSwitchOffGradient(FALSE);
+
+ if(aMtrTransparent.IsEnabled())
+ {
+ // linear transparence
+ UINT16 nPos = (UINT16)aMtrTransparent.GetValue();
+ if(nPos != (UINT16)aMtrTransparent.GetSavedValue().ToInt32() || !bLinearActive)
+ {
+ XFillTransparenceItem aItem(nPos);
+ SdrShadowTransparenceItem aShadowItem(nPos);
+ const SfxPoolItem* pOld = GetOldItem(rAttrs, XATTR_FILLTRANSPARENCE);
+ if(!pOld || !(*(const XFillTransparenceItem*)pOld == aItem) || !bLinearActive)
+ {
+ rAttrs.Put(aItem);
+ rAttrs.Put(aShadowItem);
+ bModified = TRUE;
+ bSwitchOffGradient = TRUE;
+ }
+ }
+ }
+ else if(aLbTrgrGradientType.IsEnabled())
+ {
+ // transparence gradient, fill ItemSet from values
+ if(!bGradActive
+ || (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos() != (XGradientStyle)aLbTrgrGradientType.GetSavedValue()
+ || (UINT16)aMtrTrgrAngle.GetValue() != (UINT16)aMtrTrgrAngle.GetSavedValue().ToInt32()
+ || (UINT16)aMtrTrgrCenterX.GetValue() != (UINT16)aMtrTrgrCenterX.GetSavedValue().ToInt32()
+ || (UINT16)aMtrTrgrCenterY.GetValue() != (UINT16)aMtrTrgrCenterY.GetSavedValue().ToInt32()
+ || (UINT16)aMtrTrgrBorder.GetValue() != (UINT16)aMtrTrgrBorder.GetSavedValue().ToInt32()
+ || (UINT16)aMtrTrgrStartValue.GetValue() != (UINT16)aMtrTrgrStartValue.GetSavedValue().ToInt32()
+ || (UINT16)aMtrTrgrEndValue.GetValue() != (UINT16)aMtrTrgrEndValue.GetSavedValue().ToInt32() )
+ {
+ UINT8 nStartCol = (UINT8)(((UINT16)aMtrTrgrStartValue.GetValue() * 255) / 100);
+ UINT8 nEndCol = (UINT8)(((UINT16)aMtrTrgrEndValue.GetValue() * 255) / 100);
+ XGradient aTmpGradient(
+ Color(nStartCol, nStartCol, nStartCol),
+ Color(nEndCol, nEndCol, nEndCol),
+ (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(),
+ (UINT16)aMtrTrgrAngle.GetValue() * 10,
+ (UINT16)aMtrTrgrCenterX.GetValue(),
+ (UINT16)aMtrTrgrCenterY.GetValue(),
+ (UINT16)aMtrTrgrBorder.GetValue(),
+ 100, 100);
+
+ String aString;
+ XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aTmpGradient);
+ const SfxPoolItem* pOld = GetOldItem(rAttrs, XATTR_FILLFLOATTRANSPARENCE);
+
+ if(!pOld || !(*(const XFillFloatTransparenceItem*)pOld == aItem) || !bGradActive)
+ {
+ rAttrs.Put(aItem);
+ bModified = TRUE;
+ bSwitchOffLinear = TRUE;
+ }
+ }
+ }
+ else
+ {
+ // no transparence
+ bSwitchOffGradient = TRUE;
+ bSwitchOffLinear = TRUE;
+ }
+
+ // disable unused XFillFloatTransparenceItem
+ if(bSwitchOffGradient && (bGradActive || bGradUsed))
+ {
+ Color aColor(COL_BLACK);
+ XGradient aGrad(aColor, Color(COL_WHITE));
+ aGrad.SetStartIntens(100);
+ aGrad.SetEndIntens(100);
+ String aString;
+ XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aGrad);
+ aItem.SetEnabled(FALSE);
+ rAttrs.Put(aItem);
+ bModified = TRUE;
+ }
+
+ // disable unused XFillFloatTransparenceItem
+ if(bSwitchOffLinear && (bLinearActive || bLinearUsed))
+ {
+ XFillTransparenceItem aItem(0);
+ SdrShadowTransparenceItem aShadowItem(0);
+ rAttrs.Put(aItem);
+ rAttrs.Put(aShadowItem);
+ bModified = TRUE;
+ }
+ //add CHINA001 begin
+ rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));
+ //add CHINA001 end
+ return bModified;
+}
+
+void SvxTransparenceTabPage::Reset(const SfxItemSet& rAttrs)
+{
+ const SfxPoolItem* pGradientItem = NULL;
+ SfxItemState eStateGradient(rAttrs.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem));
+ if(!pGradientItem)
+ pGradientItem = &rAttrs.Get(XATTR_FILLFLOATTRANSPARENCE);
+ BOOL bGradActive = (eStateGradient == SFX_ITEM_SET && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled());
+
+ const SfxPoolItem* pLinearItem = NULL;
+ SfxItemState eStateLinear(rAttrs.GetItemState(XATTR_FILLTRANSPARENCE, TRUE, &pLinearItem));
+ if(!pLinearItem)
+ pLinearItem = &rAttrs.Get(XATTR_FILLTRANSPARENCE);
+ BOOL bLinearActive = (eStateLinear == SFX_ITEM_SET && ((XFillTransparenceItem*)pLinearItem)->GetValue() != 0);
+
+ // transparence gradient
+ const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
+ XGradientStyle eXGS(rGradient.GetGradientStyle());
+ aLbTrgrGradientType.SelectEntryPos(sal::static_int_cast< USHORT >(eXGS));
+ aMtrTrgrAngle.SetValue(rGradient.GetAngle() / 10);
+ aMtrTrgrBorder.SetValue(rGradient.GetBorder());
+ aMtrTrgrCenterX.SetValue(rGradient.GetXOffset());
+ aMtrTrgrCenterY.SetValue(rGradient.GetYOffset());
+ aMtrTrgrStartValue.SetValue((UINT16)((((UINT16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255));
+ aMtrTrgrEndValue.SetValue((UINT16)((((UINT16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255));
+
+ // linear transparence
+ UINT16 nTransp = ((XFillTransparenceItem*)pLinearItem)->GetValue();
+ aMtrTransparent.SetValue(bLinearActive ? nTransp : 50);
+ ModifyTransparentHdl_Impl(NULL);
+
+ // select the correct radio button
+ if(bGradActive)
+ {
+ // transparence gradient, set controls appropriate to item
+ aRbtTransGradient.Check();
+ ClickTransGradientHdl_Impl(NULL);
+ }
+ else if(bLinearActive)
+ {
+ // linear transparence
+ aRbtTransLinear.Check();
+ ClickTransLinearHdl_Impl(NULL);
+ }
+ else
+ {
+ // no transparence
+ aRbtTransOff.Check();
+ ClickTransOffHdl_Impl(NULL);
+ ModifiedTrgrHdl_Impl(NULL);
+ }
+
+ // save values
+ aMtrTransparent.SaveValue();
+ aLbTrgrGradientType.SaveValue();
+ aMtrTrgrCenterX.SaveValue();
+ aMtrTrgrCenterY.SaveValue();
+ aMtrTrgrAngle.SaveValue();
+ aMtrTrgrBorder.SaveValue();
+ aMtrTrgrStartValue.SaveValue();
+ aMtrTrgrEndValue.SaveValue();
+
+ BOOL bActive = InitPreview ( rAttrs );
+ InvalidatePreview ( bActive );
+}
+
+void SvxTransparenceTabPage::ActivatePage(const SfxItemSet& rSet)
+{
+ //add CHINA001 Begin
+ SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False);
+ if (pPageTypeItem)
+ SetPageType(pPageTypeItem->GetValue());
+ //add CHINA001 end
+ //CHINA001 if(*pDlgType == 0) // Flaechen-Dialog
+ //CHINA001 *pPageType = PT_TRANSPARENCE;
+ if(nDlgType == 0) //add CHINA001 // Flaechen-Dialog
+ nPageType = PT_TRANSPARENCE; //add CHINA001
+
+ InitPreview ( rSet );
+}
+
+int SvxTransparenceTabPage::DeactivatePage(SfxItemSet* _pSet)
+{
+ if( _pSet )
+ FillItemSet( *_pSet );
+ return(LEAVE_PAGE);
+}
+
+void SvxTransparenceTabPage::PointChanged(Window* , RECT_POINT eRcPt)
+{
+ eRP = eRcPt;
+}
+
+//
+// Preview-Methods
+//
+BOOL SvxTransparenceTabPage::InitPreview ( const SfxItemSet& rSet )
+{
+ // set transparencetyp for preview
+ if ( aRbtTransOff.IsChecked() )
+ {
+ ClickTransOffHdl_Impl(NULL);
+ } else if ( aRbtTransLinear.IsChecked() )
+ {
+ ClickTransLinearHdl_Impl(NULL);
+ } else if ( aRbtTransGradient.IsChecked() )
+ {
+ ClickTransGradientHdl_Impl(NULL);
+ }
+
+ // Get fillstyle for preview
+ rXFSet.Put ( ( XFillStyleItem& ) rSet.Get(XATTR_FILLSTYLE) );
+ rXFSet.Put ( ( XFillColorItem& ) rSet.Get(XATTR_FILLCOLOR) );
+ rXFSet.Put ( ( XFillGradientItem& ) rSet.Get(XATTR_FILLGRADIENT) );
+ rXFSet.Put ( ( XFillHatchItem& ) rSet.Get(XATTR_FILLHATCH) );
+ rXFSet.Put ( ( XFillBackgroundItem&)rSet.Get(XATTR_FILLBACKGROUND) );
+ rXFSet.Put ( ( XFillBitmapItem& ) rSet.Get(XATTR_FILLBITMAP) );
+
+ aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
+
+ bBitmap = ( ( ( XFillStyleItem& )rSet.Get(XATTR_FILLSTYLE) ).GetValue() == XFILL_BITMAP );
+
+ // show the right preview window
+ if ( bBitmap )
+ {
+ aCtlBitmapPreview.Show();
+ aCtlXRectPreview.Hide();
+ }
+ else
+ {
+ aCtlBitmapPreview.Hide();
+ aCtlXRectPreview.Show();
+ }
+
+ return !aRbtTransOff.IsChecked();
+}
+
+void SvxTransparenceTabPage::InvalidatePreview (BOOL bEnable)
+{
+ if ( bBitmap )
+ {
+ if ( bEnable )
+ {
+ aCtlBitmapPreview.Enable();
+ aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ }
+ else
+ aCtlBitmapPreview.Disable();
+ aCtlBitmapPreview.Invalidate();
+ }
+ else
+ {
+ if ( bEnable )
+ {
+ aCtlXRectPreview.Enable();
+ aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ }
+ else
+ aCtlXRectPreview.Disable();
+ aCtlXRectPreview.Invalidate();
+ }
+}
+
+void SvxTransparenceTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
+
+ if (pPageTypeItem)
+ SetPageType(pPageTypeItem->GetValue());
+ if (pDlgTypeItem)
+ SetDlgType(pDlgTypeItem->GetValue());
+ Construct();
+}
+/*************************************************************************
+|*
+|* Dialog to modify fill-attributes
+|*
+\************************************************************************/
+
+SvxAreaTabPage::SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+
+ SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_AREA ), rInAttrs ),
+
+ aFlProp ( this, SVX_RES( FL_PROP ) ),
+ aTypeLB ( this, SVX_RES( LB_AREA_TYPE ) ),
+
+ aLbColor ( this, SVX_RES( LB_COLOR ) ),
+ aLbGradient ( this, SVX_RES( LB_GRADIENT ) ),
+ aLbHatching ( this, SVX_RES( LB_HATCHING ) ),
+ aLbBitmap ( this, SVX_RES( LB_BITMAP ) ),
+ aCtlBitmapPreview ( this, SVX_RES( CTL_BITMAP_PREVIEW ) ),
+
+ aTsbStepCount ( this, SVX_RES( TSB_STEPCOUNT ) ),
+ aFlStepCount ( this, SVX_RES( FL_STEPCOUNT ) ),
+ aNumFldStepCount ( this, SVX_RES( NUM_FLD_STEPCOUNT ) ),
+
+ aCbxHatchBckgrd ( this, SVX_RES( CB_HATCHBCKGRD ) ),
+ aLbHatchBckgrdColor ( this, SVX_RES( LB_HATCHBCKGRDCOLOR ) ),
+
+ aFlSize ( this, SVX_RES( FL_SIZE ) ),
+ aTsbOriginal ( this, SVX_RES( TSB_ORIGINAL ) ),
+ aTsbScale ( this, SVX_RES( TSB_SCALE ) ),
+ aFtXSize ( this, SVX_RES( FT_X_SIZE ) ),
+ aMtrFldXSize ( this, SVX_RES( MTR_FLD_X_SIZE ) ),
+ aFtYSize ( this, SVX_RES( FT_Y_SIZE ) ),
+ aMtrFldYSize ( this, SVX_RES( MTR_FLD_Y_SIZE ) ),
+ aFlPosition ( this, SVX_RES( FL_POSITION ) ),
+ aCtlPosition ( this, SVX_RES( CTL_POSITION ), RP_RM, 110, 80, CS_RECT ),
+ aFtXOffset ( this, SVX_RES( FT_X_OFFSET ) ),
+ aMtrFldXOffset ( this, SVX_RES( MTR_FLD_X_OFFSET ) ),
+ aFtYOffset ( this, SVX_RES( FT_Y_OFFSET ) ),
+ aMtrFldYOffset ( this, SVX_RES( MTR_FLD_Y_OFFSET ) ),
+ aTsbTile ( this, SVX_RES( TSB_TILE ) ),
+ aTsbStretch ( this, SVX_RES( TSB_STRETCH ) ),
+ aFlOffset ( this, SVX_RES( FL_OFFSET ) ),
+ aRbtRow ( this, SVX_RES( RBT_ROW ) ),
+ aRbtColumn ( this, SVX_RES( RBT_COLUMN ) ),
+ aMtrFldOffset ( this, SVX_RES( MTR_FLD_OFFSET ) ),
+
+ aCtlXRectPreview ( this, SVX_RES( CTL_COLOR_PREVIEW ) ),
+
+ rOutAttrs ( rInAttrs ),
+
+ pColorTab( NULL ),
+ pGradientList( NULL ),
+ pHatchingList( NULL ),
+ pBitmapList( NULL ),
+
+ pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
+ aXFillAttr ( pXPool ),
+ rXFSet ( aXFillAttr.GetItemSet() )
+{
+ FreeResource();
+
+ // Gruppen, die sich ueberlagern
+ aLbBitmap.Hide();
+ aCtlBitmapPreview.Hide();
+
+ aFlStepCount.Hide();
+ aTsbStepCount.Hide();
+ aNumFldStepCount.Hide();
+
+ aTsbTile.Hide();
+ aTsbStretch.Hide();
+ aTsbScale.Hide();
+ aTsbOriginal.Hide();
+ aFtXSize.Hide();
+ aMtrFldXSize.Hide();
+ aFtYSize.Hide();
+ aMtrFldYSize.Hide();
+ aFlSize.Hide();
+ aRbtRow.Hide();
+ aRbtColumn.Hide();
+ aMtrFldOffset.Hide();
+ aFlOffset.Hide();
+ aCtlPosition.Hide();
+ aFtXOffset.Hide();
+ aMtrFldXOffset.Hide();
+ aFtYOffset.Hide();
+ aMtrFldYOffset.Hide();
+ aFlPosition.Hide();
+ // Controls for Hatch-Background
+ aCbxHatchBckgrd.Hide();
+ aLbHatchBckgrdColor.Hide();
+
+
+ aTsbOriginal.EnableTriState( FALSE );
+
+
+ // this page needs ExchangeSupport
+ SetExchangeSupport();
+
+ // set Metrics
+ eFUnit = GetModuleFieldUnit( &rInAttrs );
+
+ switch ( eFUnit )
+ {
+ case FUNIT_M:
+ case FUNIT_KM:
+ eFUnit = FUNIT_MM;
+ break;
+ default: ;//prevent warning
+ }
+ SetFieldUnit( aMtrFldXSize, eFUnit, TRUE );
+ SetFieldUnit( aMtrFldYSize, eFUnit, TRUE );
+
+ // get PoolUnit
+ SfxItemPool* pPool = rOutAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool?" );
+ ePoolUnit = pPool->GetMetric( XATTR_FILLBMP_SIZEX );
+
+ // Setzen Output-Devices
+ rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ rXFSet.Put( XFillColorItem( String(), COL_BLACK ) );
+ aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aLbColor.SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyColorHdl_Impl ) );
+ aLbHatchBckgrdColor.SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl ) );
+ aCbxHatchBckgrd.SetToggleHdl( LINK( this, SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl ) );
+
+ aLbGradient.SetSelectHdl(
+ LINK( this, SvxAreaTabPage, ModifyGradientHdl_Impl ) );
+ aLbHatching.SetSelectHdl(
+ LINK( this, SvxAreaTabPage, ModifyHatchingHdl_Impl ) );
+ aLbBitmap.SetSelectHdl(
+ LINK( this, SvxAreaTabPage, ModifyBitmapHdl_Impl ) );
+
+ aTsbStepCount.SetClickHdl(
+ LINK( this, SvxAreaTabPage, ModifyStepCountHdl_Impl ) );
+ aNumFldStepCount.SetModifyHdl(
+ LINK( this, SvxAreaTabPage, ModifyStepCountHdl_Impl ) );
+
+ Link aLink( LINK( this, SvxAreaTabPage, ModifyTileHdl_Impl ) );
+ aTsbTile.SetClickHdl( aLink );
+ aTsbStretch.SetClickHdl( aLink );
+ aTsbOriginal.SetClickHdl( aLink );
+ aMtrFldXSize.SetModifyHdl( aLink );
+ aMtrFldYSize.SetModifyHdl( aLink );
+ aRbtRow.SetClickHdl( aLink );
+ aRbtColumn.SetClickHdl( aLink );
+ aMtrFldOffset.SetModifyHdl( aLink );
+ aMtrFldXOffset.SetModifyHdl( aLink );
+ aMtrFldYOffset.SetModifyHdl( aLink );
+ aTsbScale.SetClickHdl( LINK( this, SvxAreaTabPage, ClickScaleHdl_Impl ) );
+
+ aTypeLB.SetSelectHdl( LINK( this, SvxAreaTabPage, SelectDialogTypeHdl_Impl ) );
+
+ // #i76307# always paint the preview in LTR, because this is what the document does
+ aCtlXRectPreview.EnableRTL(FALSE);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxAreaTabPage::Construct()
+{
+ // fill colortables / lists
+ aLbColor.Fill( pColorTab );
+ aLbHatchBckgrdColor.Fill ( pColorTab );
+
+ aLbGradient.Fill( pGradientList );
+ aLbHatching.Fill( pHatchingList );
+ aLbBitmap.Fill( pBitmapList );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet )
+{
+ USHORT _nPos = 0;
+ USHORT nCount;
+ //add CHINA001 Begin
+ SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
+ SFX_ITEMSET_ARG (&rSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False);
+ if (pPageTypeItem)
+ SetPageType(pPageTypeItem->GetValue());
+ if (pPosItem)
+ SetPos(pPosItem->GetValue());
+ //add CHINA001 end
+ if( nDlgType == 0 )//CHINA001 if( *pDlgType == 0 ) // Flaechen-Dialog
+ {
+ *pbAreaTP = TRUE;
+
+ if( pColorTab )
+ {
+ // Bitmapliste
+ if( *pnBitmapListState )
+ {
+ if( *pnBitmapListState & CT_CHANGED )
+ pBitmapList = ( (SvxAreaTabDialog*) DLGWIN )->
+ GetNewBitmapList();
+
+ _nPos = aLbBitmap.GetSelectEntryPos();
+
+ aLbBitmap.Clear();
+ aLbBitmap.Fill( pBitmapList );
+ nCount = aLbBitmap.GetEntryCount();
+ if( nCount == 0 )
+ ; // This case should never occur
+ else if( nCount <= _nPos )
+ aLbBitmap.SelectEntryPos( 0 );
+ else
+ aLbBitmap.SelectEntryPos( _nPos );
+ ModifyBitmapHdl_Impl( this );
+ }
+ // hatch-liste
+ if( *pnHatchingListState )
+ {
+ if( *pnHatchingListState & CT_CHANGED )
+ pHatchingList = ( (SvxAreaTabDialog*) DLGWIN )->
+ GetNewHatchingList();
+
+ _nPos = aLbHatching.GetSelectEntryPos();
+
+ aLbHatching.Clear();
+ aLbHatching.Fill( pHatchingList );
+ nCount = aLbHatching.GetEntryCount();
+ if( nCount == 0 )
+ ; // This case should never occur
+ else if( nCount <= _nPos )
+ aLbHatching.SelectEntryPos( 0 );
+ else
+ aLbHatching.SelectEntryPos( _nPos );
+ ModifyHatchingHdl_Impl( this );
+
+ ModifyHatchBckgrdColorHdl_Impl( this );
+ }
+ // gradient-liste
+ if( *pnGradientListState )
+ {
+ if( *pnGradientListState & CT_CHANGED )
+ pGradientList = ( (SvxAreaTabDialog*) DLGWIN )->
+ GetNewGradientList();
+
+ _nPos = aLbGradient.GetSelectEntryPos();
+
+ aLbGradient.Clear();
+ aLbGradient.Fill( pGradientList );
+ nCount = aLbGradient.GetEntryCount();
+ if( nCount == 0 )
+ ; // This case should never occur
+ else if( nCount <= _nPos )
+ aLbGradient.SelectEntryPos( 0 );
+ else
+ aLbGradient.SelectEntryPos( _nPos );
+ ModifyGradientHdl_Impl( this );
+ }
+ // ColorTable
+ if( *pnColorTableState )
+ {
+ if( *pnColorTableState & CT_CHANGED )
+ pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->
+ GetNewColorTable();
+ // aLbColor
+ _nPos = aLbColor.GetSelectEntryPos();
+ aLbColor.Clear();
+ aLbColor.Fill( pColorTab );
+ nCount = aLbColor.GetEntryCount();
+ if( nCount == 0 )
+ ; // This case should never occur
+ else if( nCount <= _nPos )
+ aLbColor.SelectEntryPos( 0 );
+ else
+ aLbColor.SelectEntryPos( _nPos );
+
+ ModifyColorHdl_Impl( this );
+
+ // Backgroundcolor of hatch
+ _nPos = aLbHatchBckgrdColor.GetSelectEntryPos();
+ aLbHatchBckgrdColor.Clear();
+ aLbHatchBckgrdColor.Fill( pColorTab );
+ nCount = aLbHatchBckgrdColor.GetEntryCount();
+ if( nCount == 0 )
+ ; // This case should never occur
+ else if( nCount <= _nPos )
+ aLbHatchBckgrdColor.SelectEntryPos( 0 );
+ else
+ aLbHatchBckgrdColor.SelectEntryPos( _nPos );
+
+ ModifyHatchBckgrdColorHdl_Impl( this );
+ }
+
+ // evaluate if any other Tabpage set another filltype
+ if( aTypeLB.GetSelectEntryPos() > XFILL_NONE)
+ {
+ switch( nPageType )//CHINA001 switch( *pPageType )
+ {
+ case PT_GRADIENT:
+ aTypeLB.SelectEntryPos( XFILL_GRADIENT );
+ aLbGradient.SelectEntryPos( _nPos );//CHINA001 aLbGradient.SelectEntryPos( *pPos );
+ ClickGradientHdl_Impl( this );
+ break;
+
+ case PT_HATCH:
+ aTypeLB.SelectEntryPos( XFILL_HATCH );
+ aLbHatching.SelectEntryPos( _nPos );//CHINA001 aLbHatching.SelectEntryPos( *pPos );
+ ClickHatchingHdl_Impl( this );
+ break;
+
+ case PT_BITMAP:
+ aTypeLB.SelectEntryPos( XFILL_BITMAP );
+ aLbBitmap.SelectEntryPos( _nPos );//CHINA001 aLbBitmap.SelectEntryPos( *pPos );
+ ClickBitmapHdl_Impl( this );
+ break;
+
+ case PT_COLOR:
+ aTypeLB.SelectEntryPos( XFILL_SOLID );
+ aLbColor.SelectEntryPos( _nPos );//CHINA001 aLbColor.SelectEntryPos( *pPos );
+ aLbHatchBckgrdColor.SelectEntryPos( _nPos ); //CHINA001 aLbHatchBckgrdColor.SelectEntryPos( *pPos );
+ ClickColorHdl_Impl( this );
+ break;
+ }
+ }
+ nPageType = PT_AREA;//CHINA001 *pPageType = PT_AREA;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if( nDlgType == 0 ) // Flaechen-Dialog//CHINA001 if( *pDlgType == 0 ) // Flaechen-Dialog
+ {
+ XFillStyle eStyle = (XFillStyle) aTypeLB.GetSelectEntryPos();
+ switch( eStyle )
+ {
+ case XFILL_GRADIENT:
+ {
+ nPageType = PT_GRADIENT;//CHINA001 *pPageType = PT_GRADIENT;
+ nPos = aLbGradient.GetSelectEntryPos();//CHINA001 *pPos = aLbGradient.GetSelectEntryPos();
+ }
+ break;
+ case XFILL_HATCH:
+ {
+ nPageType = PT_HATCH;//CHINA001 *pPageType = PT_HATCH;
+ nPos = aLbHatching.GetSelectEntryPos();//CHINA001 *pPos = aLbHatching.GetSelectEntryPos();
+ }
+ break;
+ case XFILL_BITMAP:
+ {
+ nPageType = PT_BITMAP;//CHINA001 *pPageType = PT_BITMAP;
+ nPos = aLbBitmap.GetSelectEntryPos();//CHINA001 *pPos = aLbBitmap.GetSelectEntryPos();
+ }
+ break;
+ case XFILL_SOLID:
+ {
+ nPageType = PT_COLOR;//CHINA001 *pPageType = PT_COLOR;
+ nPos = aLbColor.GetSelectEntryPos();//CHINA001 *pPos = aLbColor.GetSelectEntryPos();
+ }
+ break;
+ default: ;//prevent warning
+ }
+ }
+
+ if( _pSet )
+ FillItemSet( *_pSet );
+
+ return( LEAVE_PAGE );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxAreaTabPage::FillItemSet( SfxItemSet& rAttrs )
+{
+ const SfxPoolItem* pOld = NULL;
+ USHORT _nPos;
+ BOOL bModified = FALSE;
+
+ if( nDlgType != 0 || *pbAreaTP )//CHINA001 if( *pDlgType != 0 || *pbAreaTP )
+ {
+ XFillStyle eStyle = (XFillStyle) aTypeLB.GetSelectEntryPos();
+ XFillStyle eSavedStyle = (XFillStyle) aTypeLB.GetSavedValue();
+ switch( eStyle )
+ {
+ case XFILL_NONE:
+ {
+ if( eSavedStyle != eStyle )
+ {
+ XFillStyleItem aStyleItem( XFILL_NONE );
+ pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
+ if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
+ {
+ rAttrs.Put( aStyleItem );
+ bModified = TRUE;
+ }
+ }
+ }
+ break;
+ case XFILL_SOLID:
+ {
+ _nPos = aLbColor.GetSelectEntryPos();
+ if( _nPos != LISTBOX_ENTRY_NOTFOUND &&
+ _nPos != aLbColor.GetSavedValue() )
+ {
+ XFillColorItem aItem( aLbColor.GetSelectEntry(),
+ aLbColor.GetSelectEntryColor() );
+ pOld = GetOldItem( rAttrs, XATTR_FILLCOLOR );
+ if ( !pOld || !( *(const XFillColorItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+ // NEU
+ if( (eSavedStyle != eStyle) &&
+ ( bModified ||
+ SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE ) ) )
+ {
+ XFillStyleItem aStyleItem( XFILL_SOLID );
+ pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
+ if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
+ {
+ rAttrs.Put( aStyleItem );
+ bModified = TRUE;
+ }
+ }
+ }
+ break;
+ case XFILL_GRADIENT:
+ {
+ _nPos = aLbGradient.GetSelectEntryPos();
+ if( _nPos != LISTBOX_ENTRY_NOTFOUND &&
+ _nPos != aLbGradient.GetSavedValue() )
+ {
+ XGradient aGradient = pGradientList->GetGradient( _nPos )->GetGradient();
+ String aString = aLbGradient.GetSelectEntry();
+ XFillGradientItem aItem( aString, aGradient );
+ pOld = GetOldItem( rAttrs, XATTR_FILLGRADIENT );
+ if ( !pOld || !( *(const XFillGradientItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+ // NEU
+ if( (eSavedStyle != eStyle) &&
+ ( bModified ||
+ SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), TRUE ) ) )
+ {
+ XFillStyleItem aStyleItem( XFILL_GRADIENT );
+ pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
+ if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
+ {
+ rAttrs.Put( aStyleItem );
+ bModified = TRUE;
+ }
+ }
+ }
+ break;
+ case XFILL_HATCH:
+ {
+ _nPos = aLbHatching.GetSelectEntryPos();
+ if( _nPos != LISTBOX_ENTRY_NOTFOUND &&
+ _nPos != aLbHatching.GetSavedValue() )
+ {
+ XHatch aHatching = pHatchingList->GetHatch( _nPos )->GetHatch();
+ String aString = aLbHatching.GetSelectEntry();
+ XFillHatchItem aItem( aString, aHatching );
+ pOld = GetOldItem( rAttrs, XATTR_FILLHATCH );
+ if ( !pOld || !( *(const XFillHatchItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+ XFillBackgroundItem aItem ( aCbxHatchBckgrd.IsChecked() );
+ rAttrs.Put( aItem );
+ nPos = aLbHatchBckgrdColor.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND &&
+ nPos != aLbHatchBckgrdColor.GetSavedValue() )
+ {
+ XFillColorItem aFillColorItem( aLbHatchBckgrdColor.GetSelectEntry(),
+ aLbHatchBckgrdColor.GetSelectEntryColor() );
+ pOld = GetOldItem( rAttrs, XATTR_FILLCOLOR );
+ if ( !pOld || !( *(const XFillColorItem*)pOld == aFillColorItem ) )
+ {
+ rAttrs.Put( aFillColorItem );
+ bModified = TRUE;
+ }
+ }
+ // NEU
+ if( (eSavedStyle != eStyle) &&
+ ( bModified ||
+ SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), TRUE ) ) )
+ {
+ XFillStyleItem aStyleItem( XFILL_HATCH );
+ pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
+ if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
+ {
+ rAttrs.Put( aStyleItem );
+ bModified = TRUE;
+ }
+ }
+ }
+ break;
+ case XFILL_BITMAP:
+ {
+ nPos = aLbBitmap.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND &&
+ nPos != aLbBitmap.GetSavedValue() )
+ {
+ XOBitmap aXOBitmap = pBitmapList->GetBitmap( nPos )->GetXBitmap();
+ String aString = aLbBitmap.GetSelectEntry();
+ XFillBitmapItem aFillBitmapItem( aString, aXOBitmap );
+ pOld = GetOldItem( rAttrs, XATTR_FILLBITMAP );
+ if ( !pOld || !( *(const XFillBitmapItem*)pOld == aFillBitmapItem ) )
+ {
+ rAttrs.Put( aFillBitmapItem );
+ bModified = TRUE;
+ }
+ }
+ // NEU
+ if( (eSavedStyle != eStyle) &&
+ ( bModified ||
+ SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), TRUE ) ) )
+ {
+ XFillStyleItem aStyleItem( XFILL_BITMAP );
+ pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
+ if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
+ {
+ rAttrs.Put( aStyleItem );
+ bModified = TRUE;
+ }
+ }
+ }
+ break;
+ }
+
+ // Schrittweite
+ if( aTsbStepCount.IsEnabled() )
+ {
+ UINT16 nValue = 0;
+ BOOL bValueModified = FALSE;
+ TriState eState = aTsbStepCount.GetState();
+ if( eState == STATE_CHECK )
+ {
+ if( eState != aTsbStepCount.GetSavedValue() )
+ bValueModified = TRUE;
+ }
+ else
+ {
+ // Zustand != Disabled ?
+ if( aNumFldStepCount.GetText().Len() > 0 )
+ {
+ nValue = (UINT16) aNumFldStepCount.GetValue();
+ if( nValue != (UINT16) aNumFldStepCount.GetSavedValue().ToInt32() )
+ bValueModified = TRUE;
+ }
+ }
+ if( bValueModified )
+ {
+ XGradientStepCountItem aFillBitmapItem( nValue );
+ pOld = GetOldItem( rAttrs, XATTR_GRADIENTSTEPCOUNT );
+ if ( !pOld || !( *(const XGradientStepCountItem*)pOld == aFillBitmapItem ) )
+ {
+ rAttrs.Put( aFillBitmapItem );
+ bModified = TRUE;
+ }
+ }
+ }
+
+ // Kacheln
+ if( aTsbTile.IsEnabled() )
+ {
+ TriState eState = aTsbTile.GetState();
+ if( eState != aTsbTile.GetSavedValue() )
+ {
+ XFillBmpTileItem aFillBmpTileItem(
+ sal::static_int_cast< BOOL >( eState ) );
+ pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILE );
+ if ( !pOld || !( *(const XFillBmpTileItem*)pOld == aFillBmpTileItem ) )
+ {
+ rAttrs.Put( aFillBmpTileItem );
+ bModified = TRUE;
+ }
+ }
+ }
+ // Stretchen
+ if( aTsbStretch.IsEnabled() )
+ {
+ TriState eState = aTsbStretch.GetState();
+ if( eState != aTsbStretch.GetSavedValue() )
+ {
+ XFillBmpStretchItem aFillBmpStretchItem(
+ sal::static_int_cast< BOOL >( eState ) );
+ pOld = GetOldItem( rAttrs, XATTR_FILLBMP_STRETCH );
+ if ( !pOld || !( *(const XFillBmpStretchItem*)pOld == aFillBmpStretchItem ) )
+ {
+ rAttrs.Put( aFillBmpStretchItem );
+ bModified = TRUE;
+ }
+ }
+ }
+
+ // Originalgroesse (im UI) wird wie folgt benutzt:
+ // Controls sind disabled, muessen aber gesetzt werden.
+ // SizeX = 0; SizeY = 0; Log = TRUE
+
+ //aTsbScale
+ TriState eState = aTsbScale.GetState();
+ if( eState != aTsbScale.GetSavedValue() ||
+ ( !aTsbScale.IsEnabled() &&
+ aTsbOriginal.IsEnabled() &&
+ aTsbScale.GetSavedValue() != STATE_CHECK ) )
+ {
+ XFillBmpSizeLogItem* pItem = NULL;
+ if( aTsbScale.IsEnabled() )
+ pItem = new XFillBmpSizeLogItem( eState == STATE_NOCHECK );
+ else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK )
+ pItem = new XFillBmpSizeLogItem( TRUE );
+
+ if( pItem )
+ {
+ pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZELOG );
+ if ( !pOld || !( *(const XFillBmpSizeLogItem*)pOld == *pItem ) )
+ {
+ rAttrs.Put( *pItem );
+ bModified = TRUE;
+ }
+ delete pItem;
+ }
+ }
+
+ //aMtrFldXSize
+ String aStr = aMtrFldXSize.GetText();
+ {
+ XFillBmpSizeXItem* pItem = NULL;
+ TriState eScaleState = aTsbScale.GetState();
+
+ if( aMtrFldXSize.IsEnabled() &&
+ aStr.Len() > 0 &&
+ aStr != aMtrFldXSize.GetSavedValue() )
+ {
+ if( eScaleState == STATE_NOCHECK )
+ pItem = new XFillBmpSizeXItem( GetCoreValue( aMtrFldXSize, ePoolUnit ) );
+ else
+ {
+ // Prozentwerte werden negativ gesetzt, damit
+ // diese nicht skaliert werden; dieses wird
+ // im Item beruecksichtigt ( KA05.11.96 )
+ pItem = new XFillBmpSizeXItem( -labs( static_cast<long>(aMtrFldXSize.GetValue()) ) );
+ }
+ }
+ else if( aTsbOriginal.IsEnabled() &&
+ aTsbOriginal.GetState() == STATE_CHECK &&
+ aMtrFldXSize.GetSavedValue().Len() > 0 )
+ pItem = new XFillBmpSizeXItem( 0 );
+
+ if( pItem )
+ {
+ pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZEX );
+ if ( !pOld || !( *(const XFillBmpSizeXItem*)pOld == *pItem ) )
+ {
+ rAttrs.Put( *pItem );
+ bModified = TRUE;
+ }
+ delete pItem;
+ }
+ }
+
+ //aMtrFldYSize
+ aStr = aMtrFldYSize.GetText();
+ {
+ XFillBmpSizeYItem* pItem = NULL;
+ TriState eScaleState = aTsbScale.GetState();
+
+ if( aMtrFldYSize.IsEnabled() &&
+ aStr.Len() > 0 &&
+ aStr != aMtrFldYSize.GetSavedValue() )
+ {
+ if( eScaleState == STATE_NOCHECK )
+ pItem = new XFillBmpSizeYItem( GetCoreValue( aMtrFldYSize, ePoolUnit ) );
+ else
+ {
+ // Prozentwerte werden negativ gesetzt, damit
+ // diese vom MetricItem nicht skaliert werden;
+ // dieses wird im Item beruecksichtigt ( KA05.11.96 )
+ pItem = new XFillBmpSizeYItem( -labs( static_cast<long>(aMtrFldYSize.GetValue()) ) );
+ }
+ }
+ else if( aTsbOriginal.IsEnabled() &&
+ aTsbOriginal.GetState() == STATE_CHECK &&
+ aMtrFldYSize.GetSavedValue().Len() > 0 )
+ pItem = new XFillBmpSizeYItem( 0 );
+
+ if( pItem )
+ {
+ pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZEY );
+ if ( !pOld || !( *(const XFillBmpSizeYItem*)pOld == *pItem ) )
+ {
+ rAttrs.Put( *pItem );
+ bModified = TRUE;
+ }
+ delete pItem;
+ }
+ }
+
+ //aRbtRow
+ //aRbtColumn
+ //aMtrFldOffset
+ if( aMtrFldOffset.IsEnabled() )
+ {
+ String aMtrString = aMtrFldOffset.GetText();
+ if( ( aMtrString.Len() > 0 &&
+ aMtrString != aMtrFldOffset.GetSavedValue() ) ||
+ aRbtRow.GetSavedValue() != aRbtRow.IsChecked() ||
+ aRbtColumn.GetSavedValue() != aRbtColumn.IsChecked() )
+ {
+ if( aRbtRow.IsChecked() )
+ {
+ XFillBmpTileOffsetXItem aFillBmpTileOffsetXItem( (UINT16) aMtrFldOffset.GetValue() );
+ pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILEOFFSETX );
+ if ( !pOld || !( *(const XFillBmpTileOffsetXItem*)pOld == aFillBmpTileOffsetXItem ) )
+ {
+ rAttrs.Put( aFillBmpTileOffsetXItem );
+ rAttrs.Put( XFillBmpTileOffsetYItem( 0 ) );
+ bModified = TRUE;
+ }
+ }
+ else if( aRbtColumn.IsChecked() )
+ {
+ XFillBmpTileOffsetYItem aFillBmpTileOffsetYItem( (UINT16) aMtrFldOffset.GetValue() );
+ pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILEOFFSETY );
+ if ( !pOld || !( *(const XFillBmpTileOffsetYItem*)pOld == aFillBmpTileOffsetYItem ) )
+ {
+ rAttrs.Put( aFillBmpTileOffsetYItem );
+ rAttrs.Put( XFillBmpTileOffsetXItem( 0 ) );
+ bModified = TRUE;
+ }
+ }
+ }
+ }
+
+ //aCtlPosition
+ if( aCtlPosition.IsEnabled() )
+ {
+ BOOL bPut = FALSE;
+ RECT_POINT _eRP = aCtlPosition.GetActualRP();
+
+ if( SFX_ITEM_DONTCARE == rOutAttrs.GetItemState( XATTR_FILLBMP_POS ) )
+ bPut = TRUE;
+ else
+ {
+ RECT_POINT eValue = ( ( const XFillBmpPosItem& ) rOutAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue();
+ if( eValue != _eRP )
+ bPut = TRUE;
+ }
+ if( bPut )
+ {
+ XFillBmpPosItem aFillBmpPosItem( _eRP );
+ pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POS );
+ if ( !pOld || !( *(const XFillBmpPosItem*)pOld == aFillBmpPosItem ) )
+ {
+ rAttrs.Put( aFillBmpPosItem );
+ bModified = TRUE;
+ }
+ }
+ }
+
+ //aMtrFldXOffset
+ if( aMtrFldXOffset.IsEnabled() )
+ {
+ String sMtrXOffset = aMtrFldXOffset.GetText();
+ if( sMtrXOffset.Len() > 0 &&
+ sMtrXOffset != aMtrFldXOffset.GetSavedValue() )
+ {
+ XFillBmpPosOffsetXItem aFillBmpPosOffsetXItem( (UINT16) aMtrFldXOffset.GetValue() );
+ pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POSOFFSETX );
+ if ( !pOld || !( *(const XFillBmpPosOffsetXItem*)pOld == aFillBmpPosOffsetXItem ) )
+ {
+ rAttrs.Put( aFillBmpPosOffsetXItem );
+ bModified = TRUE;
+ }
+ }
+ }
+
+ //aMtrFldYOffset
+ if( aMtrFldYOffset.IsEnabled() )
+ {
+ String sMtrYOffset = aMtrFldYOffset.GetText();
+ if( sMtrYOffset.Len() > 0 &&
+ sMtrYOffset != aMtrFldYOffset.GetSavedValue() )
+ {
+ XFillBmpPosOffsetYItem aFillBmpPosOffsetYItem( (UINT16) aMtrFldYOffset.GetValue() );
+ pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POSOFFSETY );
+ if ( !pOld || !( *(const XFillBmpPosOffsetYItem*)pOld == aFillBmpPosOffsetYItem ) )
+ {
+ rAttrs.Put( aFillBmpPosOffsetYItem );
+ bModified = TRUE;
+ }
+ }
+ }
+ //add CHINA001 begin
+ rAttrs.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ rAttrs.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos));
+ //add CHINA001 end
+ }
+
+ return( bModified );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxAreaTabPage::Reset( const SfxItemSet& rAttrs )
+{
+ //const SfxPoolItem *pPoolItem = NULL;
+
+ XFillStyle eXFS;
+ if( rAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE )
+ {
+ eXFS = (XFillStyle) ( ( ( const XFillStyleItem& ) rAttrs.
+ Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue() );
+ aTypeLB.SelectEntryPos( sal::static_int_cast< USHORT >( eXFS ) );
+ switch( eXFS )
+ {
+ case XFILL_NONE:
+ ClickInvisibleHdl_Impl( this );
+ break;
+
+ case XFILL_SOLID:
+ //if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) )
+ if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLCOLOR ) )
+ {
+ XFillColorItem aColorItem( ( const XFillColorItem& )
+ rAttrs.Get( XATTR_FILLCOLOR ) );
+
+ aLbColor.SelectEntry( aColorItem.GetColorValue() );
+ aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() );
+ }
+ ClickColorHdl_Impl( this );
+
+ break;
+
+ case XFILL_GRADIENT:
+ //if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), TRUE, &pPoolItem ) )
+ if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLGRADIENT ) )
+ {
+ XFillGradientItem aGradientItem( ( ( const XFillGradientItem& )
+ rAttrs.Get( XATTR_FILLGRADIENT ) ) );
+ String aString( aGradientItem.GetName() );
+ XGradient aGradient( aGradientItem.GetGradientValue() );
+
+ aLbGradient.SelectEntryByList( pGradientList, aString, aGradient );
+ }
+ ClickGradientHdl_Impl( this );
+ break;
+
+ case XFILL_HATCH:
+ //if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), TRUE, &pPoolItem ) )
+ if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLHATCH ) )
+ {
+ aLbHatching.SelectEntry( ( ( const XFillHatchItem& )
+ rAttrs.Get( XATTR_FILLHATCH ) ).GetName() );
+ }
+ ClickHatchingHdl_Impl( this );
+
+ if ( SFX_ITEM_DONTCARE != rAttrs.GetItemState ( XATTR_FILLBACKGROUND ) )
+ {
+ aCbxHatchBckgrd.Check ( ( ( const XFillBackgroundItem& ) rAttrs.Get ( XATTR_FILLBACKGROUND ) ).GetValue() );
+ }
+ ToggleHatchBckgrdColorHdl_Impl( this );
+ if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLCOLOR ) )
+ {
+ XFillColorItem aColorItem( ( const XFillColorItem& )
+ rAttrs.Get( XATTR_FILLCOLOR ) );
+
+ aLbColor.SelectEntry( aColorItem.GetColorValue() );
+ aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() );
+ }
+ break;
+
+ case XFILL_BITMAP:
+ {
+ if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLBITMAP ) )
+ {
+ XFillBitmapItem aBitmapItem( ( const XFillBitmapItem& )
+ rAttrs.Get( XATTR_FILLBITMAP ) );
+
+ String aString( aBitmapItem.GetName() );
+ aLbBitmap.SelectEntry( aString );
+ }
+ ClickBitmapHdl_Impl( this );
+ }
+ break;
+
+ default:
+ //aLbColor.SelectEntryPos(0);
+ //aRbtColor.Check();
+ break;
+ }
+ }
+ else
+ {
+ // Alle LBs nicht zug"anglich machen
+ aLbColor.Hide();
+ aLbGradient.Hide();
+ aLbHatching.Hide();
+ aLbBitmap.Hide();
+ aCtlBitmapPreview.Hide();
+ aLbColor.Disable();
+ aLbColor.Show();
+
+ // Damit Reset() auch mit Zurueck richtig funktioniert
+ aTypeLB.SetNoSelection();
+ }
+
+ // Schrittweite
+ if( ( rAttrs.GetItemState( XATTR_GRADIENTSTEPCOUNT ) != SFX_ITEM_DONTCARE ) ||
+ ( rAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE ) )
+ {
+ aTsbStepCount.EnableTriState( FALSE );
+ UINT16 nValue = ( ( const XGradientStepCountItem& ) rAttrs.Get( XATTR_GRADIENTSTEPCOUNT ) ).GetValue();
+ if( nValue == 0 )
+ {
+ aTsbStepCount.SetState( STATE_CHECK );
+ aNumFldStepCount.SetText( String() );
+ }
+ else
+ {
+ aTsbStepCount.SetState( STATE_NOCHECK );
+ aNumFldStepCount.SetValue( nValue );
+ }
+ ModifyStepCountHdl_Impl( &aTsbStepCount );
+ }
+ else
+ {
+ aTsbStepCount.SetState( STATE_DONTKNOW );
+ aNumFldStepCount.SetText( String() );
+ }
+
+ // Attribute fuer die Bitmap-Fuellung
+
+ // Ist Kacheln gesetzt?
+ if( rAttrs.GetItemState( XATTR_FILLBMP_TILE ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbTile.EnableTriState( FALSE );
+
+ if( ( ( const XFillBmpTileItem& ) rAttrs.Get( XATTR_FILLBMP_TILE ) ).GetValue() )
+ aTsbTile.SetState( STATE_CHECK );
+ else
+ aTsbTile.SetState( STATE_NOCHECK );
+ }
+ else
+ aTsbTile.SetState( STATE_DONTKNOW );
+
+ // Ist Stretchen gesetzt?
+ if( rAttrs.GetItemState( XATTR_FILLBMP_STRETCH ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbStretch.EnableTriState( FALSE );
+
+ if( ( ( const XFillBmpStretchItem& ) rAttrs.Get( XATTR_FILLBMP_STRETCH ) ).GetValue() )
+ aTsbStretch.SetState( STATE_CHECK );
+ else
+ aTsbStretch.SetState( STATE_NOCHECK );
+ }
+ else
+ aTsbStretch.SetState( STATE_DONTKNOW );
+
+
+ //aTsbScale
+ if( rAttrs.GetItemState( XATTR_FILLBMP_SIZELOG ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbScale.EnableTriState( FALSE );
+
+ if( ( ( const XFillBmpSizeLogItem& ) rAttrs.Get( XATTR_FILLBMP_SIZELOG ) ).GetValue() )
+ aTsbScale.SetState( STATE_NOCHECK );
+ else
+ aTsbScale.SetState( STATE_CHECK );
+
+ ClickScaleHdl_Impl( NULL );
+ }
+ else
+ aTsbScale.SetState( STATE_DONTKNOW );
+
+
+ // Status fuer Originalgroesse ermitteln
+ TriState eOriginal = STATE_NOCHECK;
+
+ //aMtrFldXSize
+ if( rAttrs.GetItemState( XATTR_FILLBMP_SIZEX ) != SFX_ITEM_DONTCARE )
+ {
+ INT32 nValue = ( ( const XFillBmpSizeXItem& ) rAttrs.Get( XATTR_FILLBMP_SIZEX ) ).GetValue();
+ if( aTsbScale.GetState() == STATE_CHECK )
+ {
+ // Wenn im Item eine Prozentangabe steckt,
+ // so ist diese wegen des MetricItems negativ
+ aMtrFldXSize.SetValue( labs( nValue ) );
+ }
+ else
+ SetMetricValue( aMtrFldXSize, nValue, ePoolUnit );
+ aMtrFldXSize.SaveValue();
+
+ if( nValue == 0 )
+ {
+ eOriginal = STATE_CHECK;
+ // Wert ist beim Ausschalten von Originalgroesse sonst zu klein
+ // (Performance-Problem)
+ aMtrFldXSize.SetValue( 100 );
+ }
+ }
+ else
+ {
+ aMtrFldXSize.SetText( String() );
+ aMtrFldXSize.SaveValue();
+ }
+
+ //aMtrFldYSize
+ if( rAttrs.GetItemState( XATTR_FILLBMP_SIZEY ) != SFX_ITEM_DONTCARE )
+ {
+ INT32 nValue = ( ( const XFillBmpSizeYItem& ) rAttrs.Get( XATTR_FILLBMP_SIZEY ) ).GetValue();
+ if( aTsbScale.GetState() == STATE_CHECK )
+ {
+ // Wenn im Item eine Prozentangabe steckt,
+ // so ist diese wegen des MetricItems negativ
+ aMtrFldYSize.SetValue( labs( nValue ) );
+ }
+ else
+ SetMetricValue( aMtrFldYSize, nValue, ePoolUnit );
+ aMtrFldYSize.SaveValue();
+
+ if( nValue == 0 )
+ aMtrFldYSize.SetValue( 100 ); //s.o.
+ else
+ eOriginal = STATE_NOCHECK;
+ }
+ else
+ {
+ aMtrFldYSize.SetText( String() );
+ aMtrFldYSize.SaveValue();
+ eOriginal = STATE_NOCHECK;
+ }
+
+ // aTsbOriginal
+ aTsbOriginal.SetState( eOriginal );
+
+ // #93372# Setting proper state after changing button
+ ModifyTileHdl_Impl( NULL );
+
+ //aRbtRow
+ //aRbtColumn
+ //aMtrFldOffset
+ if( rAttrs.GetItemState( XATTR_FILLBMP_TILEOFFSETX ) != SFX_ITEM_DONTCARE )
+ {
+ UINT16 nValue = ( ( const XFillBmpTileOffsetXItem& ) rAttrs.Get( XATTR_FILLBMP_TILEOFFSETX ) ).GetValue();
+ if( nValue > 0 )
+ {
+ aMtrFldOffset.SetValue( nValue );
+ aRbtRow.Check();
+ }
+ else if( rAttrs.GetItemState( XATTR_FILLBMP_TILEOFFSETY ) != SFX_ITEM_DONTCARE )
+ {
+ nValue = ( ( const XFillBmpTileOffsetYItem& ) rAttrs.Get( XATTR_FILLBMP_TILEOFFSETY ) ).GetValue();
+ if( nValue > 0 )
+ {
+ aMtrFldOffset.SetValue( nValue );
+ aRbtColumn.Check();
+ }
+ }
+ else
+ aMtrFldOffset.SetValue( 0 );
+ }
+ else
+ aMtrFldOffset.SetText( String() );
+
+
+ //aCtlPosition
+ if( rAttrs.GetItemState( XATTR_FILLBMP_POS ) != SFX_ITEM_DONTCARE )
+ {
+ RECT_POINT eValue = ( ( const XFillBmpPosItem& ) rAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue();
+ aCtlPosition.SetActualRP( eValue );
+ }
+ else
+ aCtlPosition.Reset();
+
+ //aMtrFldXOffset
+ if( rAttrs.GetItemState( XATTR_FILLBMP_POSOFFSETX ) != SFX_ITEM_DONTCARE )
+ {
+ INT32 nValue = ( ( const XFillBmpPosOffsetXItem& ) rAttrs.Get( XATTR_FILLBMP_POSOFFSETX ) ).GetValue();
+ aMtrFldXOffset.SetValue( nValue );
+ }
+ else
+ aMtrFldXOffset.SetText( String() );
+
+ //aMtrFldYOffset
+ if( rAttrs.GetItemState( XATTR_FILLBMP_POSOFFSETY ) != SFX_ITEM_DONTCARE )
+ {
+ INT32 nValue = ( ( const XFillBmpPosOffsetYItem& ) rAttrs.Get( XATTR_FILLBMP_POSOFFSETY ) ).GetValue();
+ aMtrFldYOffset.SetValue( nValue );
+ }
+ else
+ aMtrFldYOffset.SetText( String() );
+
+ // Erst hier, damit Tile und Stretch mit beruecksichtigt wird
+ if( aTypeLB.GetSelectEntryPos() == XFILL_BITMAP )
+ ClickBitmapHdl_Impl( NULL );
+
+ // Werte sichern
+ aTypeLB.SaveValue();
+ aLbColor.SaveValue();
+ aLbGradient.SaveValue();
+ aLbHatching.SaveValue();
+ //aCbxHatchBckgrd.SaveValue();
+ aLbHatchBckgrdColor.SaveValue();
+ aLbBitmap.SaveValue();
+// aLbTransparent.SaveValue();
+ aTsbStepCount.SaveValue();
+ aNumFldStepCount.SaveValue();
+ aTsbTile.SaveValue();
+ aTsbStretch.SaveValue();
+ aTsbScale.SaveValue();
+ aRbtRow.SaveValue();
+ aRbtColumn.SaveValue();
+ aMtrFldOffset.SaveValue();
+ aMtrFldXOffset.SaveValue();
+ aMtrFldYOffset.SaveValue();
+ //aMtrFldXSize.SaveValue(); <- wird oben behandelt
+ //aMtrFldYSize.SaveValue(); <- wird oben behandelt
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxAreaTabPage::Create( Window* pWindow,
+ const SfxItemSet& rAttrs )
+{
+ return( new SvxAreaTabPage( pWindow, rAttrs ) );
+}
+
+//------------------------------------------------------------------------
+
+USHORT* SvxAreaTabPage::GetRanges()
+{
+ return( pAreaRanges );
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK( SvxAreaTabPage, SelectDialogTypeHdl_Impl, ListBox *, EMPTYARG )
+{
+ switch( (XFillStyle)aTypeLB.GetSelectEntryPos() )
+ {
+ case XFILL_NONE: ClickInvisibleHdl_Impl( this ); break;
+ case XFILL_SOLID: ClickColorHdl_Impl( this ); break;
+ case XFILL_GRADIENT: ClickGradientHdl_Impl( this ); break;
+ case XFILL_HATCH: ClickHatchingHdl_Impl( this ); break;
+ case XFILL_BITMAP: ClickBitmapHdl_Impl( this ); break;
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxAreaTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG )
+{
+ aTsbTile.Hide();
+ aTsbStretch.Hide();
+ aTsbScale.Hide();
+ aTsbOriginal.Hide();
+ aFtXSize.Hide();
+ aMtrFldXSize.Hide();
+ aFtYSize.Hide();
+ aMtrFldYSize.Hide();
+ aFlSize.Hide();
+ aRbtRow.Hide();
+ aRbtColumn.Hide();
+ aMtrFldOffset.Hide();
+ aFlOffset.Hide();
+ aCtlPosition.Hide();
+ aFtXOffset.Hide();
+ aMtrFldXOffset.Hide();
+ aFtYOffset.Hide();
+ aMtrFldYOffset.Hide();
+ aFlPosition.Hide();
+
+ aLbColor.Hide();
+ aLbGradient.Hide();
+ aLbHatching.Hide();
+ aLbBitmap.Hide();
+ aCtlXRectPreview.Hide();
+ aCtlBitmapPreview.Hide();
+
+ aFlStepCount.Hide();
+ aTsbStepCount.Hide();
+ aNumFldStepCount.Hide();
+
+ // Controls for Hatch-Background
+ aCbxHatchBckgrd.Hide();
+ aLbHatchBckgrdColor.Hide();
+
+ rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
+ aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aCtlXRectPreview.Invalidate();
+ aCtlBitmapPreview.Invalidate();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ClickColorHdl_Impl, void *, EMPTYARG )
+{
+ aTsbTile.Hide();
+ aTsbStretch.Hide();
+ aTsbScale.Hide();
+ aTsbOriginal.Hide();
+ aFtXSize.Hide();
+ aMtrFldXSize.Hide();
+ aFtYSize.Hide();
+ aMtrFldYSize.Hide();
+ aFlSize.Hide();
+ aRbtRow.Hide();
+ aRbtColumn.Hide();
+ aMtrFldOffset.Hide();
+ aFlOffset.Hide();
+ aCtlPosition.Hide();
+ aFtXOffset.Hide();
+ aMtrFldXOffset.Hide();
+ aFtYOffset.Hide();
+ aMtrFldYOffset.Hide();
+ aFlPosition.Hide();
+
+ aLbColor.Enable();
+ aLbColor.Show();
+ aLbGradient.Hide();
+ aLbHatching.Hide();
+ aLbBitmap.Hide();
+ aCtlXRectPreview.Enable();
+ aCtlXRectPreview.Show();
+ aCtlBitmapPreview.Hide();
+
+ aFlStepCount.Hide();
+ aTsbStepCount.Hide();
+ aNumFldStepCount.Hide();
+
+ // Controls for Hatch-Background
+ aCbxHatchBckgrd.Hide();
+ aLbHatchBckgrdColor.Hide();
+
+ // Text der Tabelle setzen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ INetURLObject aURL( pColorTab->GetPath() );
+
+ aURL.Append( pColorTab->GetName() );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ ModifyColorHdl_Impl( this );
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ModifyColorHdl_Impl, void *, EMPTYARG )
+{
+ const SfxPoolItem* pPoolItem = NULL;
+ USHORT _nPos = aLbColor.GetSelectEntryPos();
+ aLbHatchBckgrdColor.SelectEntryPos( _nPos );
+ if( _nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ rXFSet.Put( XFillColorItem( String(),
+ aLbColor.GetSelectEntryColor() ) );
+ }
+ // NEU
+ else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) )
+ {
+ rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue() );
+ rXFSet.Put( XFillColorItem( String(), aColor ) );
+ }
+ else
+ rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
+
+ aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlXRectPreview.Invalidate();
+
+ return( 0L );
+}
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ClickGradientHdl_Impl, void *, EMPTYARG )
+{
+ aTsbTile.Hide();
+ aTsbStretch.Hide();
+ aTsbScale.Hide();
+ aTsbOriginal.Hide();
+ aFtXSize.Hide();
+ aMtrFldXSize.Hide();
+ aFtYSize.Hide();
+ aMtrFldYSize.Hide();
+ aFlSize.Hide();
+ aRbtRow.Hide();
+ aRbtColumn.Hide();
+ aMtrFldOffset.Hide();
+ aFlOffset.Hide();
+ aCtlPosition.Hide();
+ aFtXOffset.Hide();
+ aMtrFldXOffset.Hide();
+ aFtYOffset.Hide();
+ aMtrFldYOffset.Hide();
+ aFlPosition.Hide();
+
+ aLbColor.Hide();
+ aLbGradient.Enable();
+ aLbGradient.Show();
+ aLbHatching.Hide();
+ aLbBitmap.Hide();
+ aCtlXRectPreview.Enable();
+ aCtlXRectPreview.Show();
+ aCtlBitmapPreview.Hide();
+
+ aFlStepCount.Enable();
+ aFlStepCount.Show();
+ aTsbStepCount.Enable();
+ aTsbStepCount.Show();
+ aNumFldStepCount.Show();
+
+ // Controls for Hatch-Background
+ aCbxHatchBckgrd.Hide();
+ aLbHatchBckgrdColor.Hide();
+
+ // Text der Tabelle setzen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ INetURLObject aURL( pGradientList->GetPath() );
+
+ aURL.Append( pGradientList->GetName() );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ ModifyGradientHdl_Impl( this );
+ ModifyStepCountHdl_Impl( &aTsbStepCount );
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ModifyGradientHdl_Impl, void *, EMPTYARG )
+{
+ const SfxPoolItem* pPoolItem = NULL;
+ USHORT _nPos = aLbGradient.GetSelectEntryPos();
+ if( _nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ // ItemSet fuellen und an aCtlXRectPreview weiterleiten
+ XGradientEntry* pEntry = pGradientList->GetGradient( _nPos );
+
+ rXFSet.Put( XFillStyleItem( XFILL_GRADIENT ) );
+ rXFSet.Put( XFillGradientItem( String(),
+ pEntry->GetGradient() ) );
+ }
+ // NEU
+ else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), TRUE, &pPoolItem ) )
+ {
+ rXFSet.Put( XFillStyleItem( XFILL_GRADIENT ) );
+ rXFSet.Put( XFillGradientItem( String(), ( ( const XFillGradientItem* ) pPoolItem )->GetGradientValue() ) );
+ }
+ else
+ rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
+
+ aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlXRectPreview.Invalidate();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ClickHatchingHdl_Impl, void *, EMPTYARG )
+{
+ aLbColor.Hide();
+ aLbGradient.Hide();
+ aLbHatching.Enable();
+ aLbHatching.Show();
+ aLbBitmap.Hide();
+ aCtlXRectPreview.Enable();
+ aCtlXRectPreview.Show();
+ aCtlBitmapPreview.Hide();
+
+// aGrpTransparent.Hide();
+// aLbTransparent.Hide();
+ aFlStepCount.Hide();
+ aTsbStepCount.Hide();
+ aNumFldStepCount.Hide();
+
+ aTsbTile.Hide();
+ aTsbStretch.Hide();
+ aTsbScale.Hide();
+ aTsbOriginal.Hide();
+ aFtXSize.Hide();
+ aMtrFldXSize.Hide();
+ aFtYSize.Hide();
+ aMtrFldYSize.Hide();
+ aFlSize.Hide();
+ aRbtRow.Hide();
+ aRbtColumn.Hide();
+ aMtrFldOffset.Hide();
+ aFlOffset.Hide();
+ aCtlPosition.Hide();
+ aFtXOffset.Hide();
+ aMtrFldXOffset.Hide();
+ aFtYOffset.Hide();
+ aMtrFldYOffset.Hide();
+ aFlPosition.Hide();
+
+ // Controls for Hatch-Background
+ aCbxHatchBckgrd.Show();
+ aLbHatchBckgrdColor.Show();
+ aCbxHatchBckgrd.Enable();
+ aLbHatchBckgrdColor.Enable();
+
+ // Text der Tabelle setzen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ INetURLObject aURL( pHatchingList->GetPath() );
+
+ aURL.Append( pHatchingList->GetName() );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(String(aURL.getBase()).Copy( 0, 15 ));
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ ModifyHatchingHdl_Impl( this );
+ ModifyHatchBckgrdColorHdl_Impl( this );
+ ToggleHatchBckgrdColorHdl_Impl( this );
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ModifyHatchingHdl_Impl, void *, EMPTYARG )
+{
+ const SfxPoolItem* pPoolItem = NULL;
+ USHORT _nPos = aLbHatching.GetSelectEntryPos();
+ if( _nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ // ItemSet fuellen und an aCtlXRectPreview weiterleiten
+ XHatchEntry* pEntry = pHatchingList->GetHatch( _nPos );
+
+ rXFSet.Put( XFillStyleItem( XFILL_HATCH ) );
+ rXFSet.Put( XFillHatchItem( String(), pEntry->GetHatch() ) );
+ }
+ // NEU
+ else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), TRUE, &pPoolItem ) )
+ {
+ rXFSet.Put( XFillStyleItem( XFILL_HATCH ) );
+ rXFSet.Put( XFillHatchItem( String(), ( ( const XFillHatchItem* ) pPoolItem )->GetHatchValue() ) );
+ }
+ else
+ rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
+
+ aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlXRectPreview.Invalidate();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl, void *, EMPTYARG )
+{
+ const SfxPoolItem* pPoolItem = NULL;
+ USHORT _nPos = aLbHatchBckgrdColor.GetSelectEntryPos();
+ aLbColor.SelectEntryPos( _nPos );
+ if( _nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+// rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ rXFSet.Put( XFillColorItem( String(),
+ aLbHatchBckgrdColor.GetSelectEntryColor() ) );
+ }
+ // NEU
+ else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) )
+ {
+// rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue() );
+ rXFSet.Put( XFillColorItem( String(), aColor ) );
+ }
+ else
+ rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
+
+ aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlXRectPreview.Invalidate();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl, void *, EMPTYARG )
+{
+ // switch on/off backgroundcolor for hatches
+ aLbHatchBckgrdColor.Enable( aCbxHatchBckgrd.IsChecked() );
+
+ XFillBackgroundItem aItem( aCbxHatchBckgrd.IsChecked() );
+ rXFSet.Put ( aItem, XATTR_FILLBACKGROUND );
+
+ aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlXRectPreview.Invalidate();
+
+ if( aLbHatchBckgrdColor.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
+ {
+ if ( SFX_ITEM_SET == rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )//>= SFX_ITEM_DEFAULT )
+ {
+ XFillColorItem aColorItem( (const XFillColorItem&)rOutAttrs.Get( XATTR_FILLCOLOR ) );
+ aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() );
+ }
+ }
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ClickBitmapHdl_Impl, void *, EMPTYARG )
+{
+ aLbColor.Hide();
+ aLbGradient.Hide();
+ aLbHatching.Hide();
+ aLbBitmap.Enable();
+ aLbBitmap.Show();
+ aCtlBitmapPreview.Enable();
+ aCtlBitmapPreview.Show();
+ aCtlXRectPreview.Hide();
+// aGrpPreview.Hide();
+// aGrpTransparent.Hide();
+// aLbTransparent.Hide();
+ aFlStepCount.Hide();
+ aTsbStepCount.Hide();
+ aNumFldStepCount.Hide();
+
+ aTsbTile.Enable();
+ aTsbStretch.Enable();
+ aTsbScale.Enable();
+ aTsbOriginal.Enable();
+ aFtXSize.Enable();
+ aMtrFldXSize.Enable();
+ aFtYSize.Enable();
+ aMtrFldYSize.Enable();
+ aFlSize.Enable();
+ aCtlPosition.Enable();
+ aFtXOffset.Enable();
+ aMtrFldXOffset.Enable();
+ aFtYOffset.Enable();
+ aMtrFldYOffset.Enable();
+ aFlPosition.Enable();
+ aRbtRow.Enable();
+ aRbtColumn.Enable();
+ aMtrFldOffset.Enable();
+ aFlOffset.Enable();
+
+ // Controls for Hatch-Background
+ aCbxHatchBckgrd.Hide();
+ aLbHatchBckgrdColor.Hide();
+
+ aTsbTile.Show();
+ aTsbStretch.Show();
+ aTsbScale.Show();
+ aTsbOriginal.Show();
+ aFtXSize.Show();
+ aMtrFldXSize.Show();
+ aFtYSize.Show();
+ aMtrFldYSize.Show();
+ aFlSize.Show();
+ aCtlPosition.Show();
+ aFtXOffset.Show();
+ aMtrFldXOffset.Show();
+ aFtYOffset.Show();
+ aMtrFldYOffset.Show();
+ aFlPosition.Show();
+ aRbtRow.Show();
+ aRbtColumn.Show();
+ aMtrFldOffset.Show();
+ aFlOffset.Show();
+
+ // Text der Tabelle setzen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ INetURLObject aURL( pBitmapList->GetPath() );
+
+ aURL.Append( pBitmapList->GetName() );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ ModifyBitmapHdl_Impl( this );
+ ModifyTileHdl_Impl( &aTsbOriginal );
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ModifyBitmapHdl_Impl, void *, EMPTYARG )
+{
+ const SfxPoolItem* pPoolItem = NULL;
+ USHORT _nPos = aLbBitmap.GetSelectEntryPos();
+ if( _nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ // ItemSet fuellen und an aCtlXRectPreview weiterleiten
+ XBitmapEntry* pEntry = pBitmapList->GetBitmap( _nPos );
+
+ rXFSet.Put( XFillStyleItem( XFILL_BITMAP ) );
+ rXFSet.Put( XFillBitmapItem( String(), pEntry->GetXBitmap() ) );
+ }
+ // NEU
+ else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), TRUE, &pPoolItem ) )
+ {
+ rXFSet.Put( XFillStyleItem( XFILL_BITMAP ) );
+ rXFSet.Put( XFillBitmapItem( String(), ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() ) );
+ }
+ else
+ rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
+
+ aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlBitmapPreview.Invalidate();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+//IMPL_LINK( SvxAreaTabPage, ModifyTransparentHdl_Impl, void *, EMPTYARG )
+//{
+// USHORT nPos = aLbTransparent.GetSelectEntryPos();
+// if( nPos != LISTBOX_ENTRY_NOTFOUND )
+// {
+// XFillTransparenceItem aItem( nPos * 25 );
+//
+// rXFSet.Put( XFillTransparenceItem( aItem ) );
+// aCtlXRectPreview.SetAttributes( aXFillAttr );
+//
+// aCtlXRectPreview.Invalidate();
+// }
+//
+// return( 0L );
+//}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ModifyStepCountHdl_Impl, void *, p )
+{
+ if( p == &aTsbStepCount )
+ {
+ if( aTsbStepCount.GetState() == STATE_NOCHECK )
+ {
+ if( aNumFldStepCount.GetText().Len() == 0 )
+ aNumFldStepCount.SetText( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "64") ));
+
+ aNumFldStepCount.Enable();
+ }
+ else
+ aNumFldStepCount.Disable();
+ }
+
+ UINT16 nValue = 0;
+ if( aTsbStepCount.GetState() != STATE_CHECK )
+ {
+ // Zustand != Disabled ?
+ if( aNumFldStepCount.GetText().Len() > 0 )
+ nValue = (UINT16) aNumFldStepCount.GetValue();
+ }
+ rXFSet.Put( XGradientStepCountItem( nValue ) );
+ aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlXRectPreview.Invalidate();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ModifyTileHdl_Impl, void *, EMPTYARG )
+{
+ TriState eState = aTsbTile.GetState();
+ if( eState == STATE_CHECK )
+ {
+ aTsbStretch.Disable();
+ aRbtRow.Enable();
+ aRbtColumn.Enable();
+ aMtrFldOffset.Enable();
+ aFlOffset.Enable();
+
+ aCtlPosition.Enable();
+ aCtlPosition.Invalidate();
+ aFtXOffset.Enable();
+ aMtrFldXOffset.Enable();
+ aFtYOffset.Enable();
+ aMtrFldYOffset.Enable();
+ aFlPosition.Enable();
+
+ aTsbScale.Enable();
+ aTsbOriginal.Enable();
+ aFtXSize.Enable();
+ aMtrFldXSize.Enable();
+ aFtYSize.Enable();
+ aMtrFldYSize.Enable();
+ aFlSize.Enable();
+ }
+ else if( eState == STATE_NOCHECK )
+ {
+ aTsbStretch.Enable();
+ aRbtRow.Disable();
+ aRbtColumn.Disable();
+ aMtrFldOffset.Disable();
+ aFlOffset.Disable();
+
+ aCtlPosition.Disable();
+ aCtlPosition.Invalidate();
+ aFtXOffset.Disable();
+ aMtrFldXOffset.Disable();
+ aFtYOffset.Disable();
+ aMtrFldYOffset.Disable();
+ aFlPosition.Disable();
+
+ if( aTsbStretch.GetState() != STATE_NOCHECK )
+ {
+ aTsbScale.Disable();
+ aTsbOriginal.Disable();
+ aFtXSize.Disable();
+ aMtrFldXSize.Disable();
+ aFtYSize.Disable();
+ aMtrFldYSize.Disable();
+ aFlSize.Disable();
+ }
+ else
+ {
+ aTsbScale.Enable();
+ aTsbOriginal.Enable();
+ aFtXSize.Enable();
+ aMtrFldXSize.Enable();
+ aFtYSize.Enable();
+ aMtrFldYSize.Enable();
+ aFlSize.Enable();
+ }
+ }
+ else
+ {
+ aTsbStretch.Disable();
+ aRbtRow.Disable();
+ aRbtColumn.Disable();
+ aMtrFldOffset.Disable();
+ aFlOffset.Disable();
+
+ aCtlPosition.Disable();
+ aCtlPosition.Invalidate();
+ aFtXOffset.Disable();
+ aMtrFldXOffset.Disable();
+ aFtYOffset.Disable();
+ aMtrFldYOffset.Disable();
+ aFlPosition.Disable();
+
+ aTsbScale.Disable();
+ aTsbOriginal.Disable();
+ aFtXSize.Disable();
+ aMtrFldXSize.Disable();
+ aFtYSize.Disable();
+ aMtrFldYSize.Disable();
+ aFlSize.Disable();
+ }
+
+ if( aTsbOriginal.GetState() == STATE_CHECK )
+ {
+ aMtrFldXSize.SetText( String() );
+ aMtrFldYSize.SetText( String() );
+ aFtXSize.Disable();
+ aFtYSize.Disable();
+ aMtrFldXSize.Disable();
+ aMtrFldYSize.Disable();
+ aTsbScale.Disable();
+ }
+ else
+ {
+ aMtrFldXSize.SetValue( aMtrFldXSize.GetValue() );
+ aMtrFldYSize.SetValue( aMtrFldYSize.GetValue() );
+ /*
+ if( eState == STATE_CHECK )
+ {
+ aFtXSize.Enable();
+ aFtYSize.Enable();
+ aMtrFldXSize.Enable();
+ aMtrFldYSize.Enable();
+ }
+ */
+ }
+
+ rXFSet.Put( XFillBmpTileItem( sal::static_int_cast< BOOL >( eState ) ) );
+
+ if( aTsbStretch.IsEnabled() )
+ rXFSet.Put(
+ XFillBmpStretchItem(
+ sal::static_int_cast< BOOL >( aTsbStretch.GetState() ) ) );
+
+ if( aTsbScale.IsEnabled() )
+ rXFSet.Put( XFillBmpSizeLogItem( aTsbScale.GetState() == STATE_NOCHECK ) );
+
+ if( aMtrFldXSize.IsEnabled() )
+ {
+ XFillBmpSizeXItem* pItem = NULL;
+ TriState eScaleState = aTsbScale.GetState();
+
+ if( eScaleState == STATE_NOCHECK )
+ pItem = new XFillBmpSizeXItem( GetCoreValue( aMtrFldXSize, ePoolUnit ) );
+ else
+ pItem = new XFillBmpSizeXItem( -labs( static_cast<long>(aMtrFldXSize.GetValue()) ) );
+
+ rXFSet.Put( *pItem );
+
+ delete pItem;
+ }
+ else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK )
+ {
+ // Originalgroesse -> Size == 0
+ rXFSet.Put( XFillBmpSizeXItem( 0 ) );
+ rXFSet.Put( XFillBmpSizeLogItem( TRUE ) );
+ }
+
+ if( aMtrFldYSize.IsEnabled() )
+ {
+ XFillBmpSizeYItem* pItem = NULL;
+ TriState eScaleState = aTsbScale.GetState();
+
+ if( eScaleState == STATE_NOCHECK )
+ pItem = new XFillBmpSizeYItem( GetCoreValue( aMtrFldYSize, ePoolUnit ) );
+ else
+ pItem = new XFillBmpSizeYItem( -labs( static_cast<long>(aMtrFldYSize.GetValue()) ) );
+
+ rXFSet.Put( *pItem );
+
+ delete pItem;
+ }
+ else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK )
+ {
+ // Originalgroesse -> Size == 0
+ rXFSet.Put( XFillBmpSizeYItem( 0 ) );
+ rXFSet.Put( XFillBmpSizeLogItem( TRUE ) );
+ }
+
+ if( aMtrFldOffset.IsEnabled() )
+ {
+ if( aRbtRow.IsChecked() )
+ {
+ rXFSet.Put( XFillBmpTileOffsetXItem( (UINT16) aMtrFldOffset.GetValue() ) );
+ rXFSet.Put( XFillBmpTileOffsetYItem( (UINT16) 0 ) );
+ }
+ else if( aRbtColumn.IsChecked() )
+ {
+ rXFSet.Put( XFillBmpTileOffsetXItem( (UINT16) 0 ) );
+ rXFSet.Put( XFillBmpTileOffsetYItem( (UINT16) aMtrFldOffset.GetValue() ) );
+ }
+ }
+
+ if( aCtlPosition.IsEnabled() )
+ rXFSet.Put( XFillBmpPosItem( aCtlPosition.GetActualRP() ) );
+
+ if( aMtrFldXOffset.IsEnabled() )
+ rXFSet.Put( XFillBmpPosOffsetXItem( (UINT16) aMtrFldXOffset.GetValue() ) );
+
+ if( aMtrFldYOffset.IsEnabled() )
+ rXFSet.Put( XFillBmpPosOffsetYItem( (UINT16) aMtrFldYOffset.GetValue() ) );
+
+
+ aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlBitmapPreview.Invalidate();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAreaTabPage, ClickScaleHdl_Impl, void *, EMPTYARG )
+{
+ if( aTsbScale.GetState() == STATE_CHECK )
+ {
+ aMtrFldXSize.SetDecimalDigits( 0 );
+ aMtrFldXSize.SetUnit( FUNIT_CUSTOM );
+ aMtrFldXSize.SetValue( 100 );
+ aMtrFldXSize.SetMax( 100 );
+ aMtrFldXSize.SetLast( 100 );
+
+ aMtrFldYSize.SetDecimalDigits( 0 );
+ aMtrFldYSize.SetUnit( FUNIT_CUSTOM );
+ aMtrFldYSize.SetValue( 100 );
+ aMtrFldYSize.SetMax( 100 );
+ aMtrFldYSize.SetLast( 100 );
+ }
+ else
+ {
+ aMtrFldXSize.SetDecimalDigits( 2 );
+ aMtrFldXSize.SetUnit( eFUnit );
+ aMtrFldXSize.SetValue( 100 );
+ aMtrFldXSize.SetMax( 999900 );
+ aMtrFldXSize.SetLast( 100000 );
+
+ aMtrFldYSize.SetDecimalDigits( 2 );
+ aMtrFldYSize.SetUnit( eFUnit );
+ aMtrFldYSize.SetValue( 100 );
+ aMtrFldYSize.SetMax( 999900 );
+ aMtrFldYSize.SetLast( 100000 );
+ }
+
+ ModifyTileHdl_Impl( NULL );
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+void SvxAreaTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt )
+{
+ eRP = eRcPt;
+
+ // Ausrichtung der Bitmapfuellung
+ ModifyTileHdl_Impl( pWindow );
+}
+
+void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pGradientListItem,SvxGradientListItem,SID_GRADIENT_LIST,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pHatchingListItem,SvxHatchListItem,SID_HATCH_LIST,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pBitmapListItem,SvxBitmapListItem,SID_BITMAP_LIST,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False);
+
+ if (pColorTabItem)
+ SetColorTable(pColorTabItem->GetColorTable());
+ if (pGradientListItem)
+ SetGradientList(pGradientListItem->GetGradientList());
+ if (pHatchingListItem)
+ SetHatchingList(pHatchingListItem->GetHatchList());
+ if (pBitmapListItem)
+ SetBitmapList(pBitmapListItem->GetBitmapList());
+ if (pPageTypeItem)
+ SetPageType(pPageTypeItem->GetValue());
+ if (pDlgTypeItem)
+ SetDlgType(pDlgTypeItem->GetValue());
+ if (pPosItem)
+ SetPos(pPosItem->GetValue());
+ Construct();
+}
+
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
new file mode 100644
index 000000000000..6ced6dd266f8
--- /dev/null
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -0,0 +1,1170 @@
+/*************************************************************************
+ *
+ * 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: tpbitmap.cxx,v $
+ * $Revision: 1.31 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+//svdraw.hxx
+#define _SVDRAW_HXX
+#define _SDR_NOITEMS
+#define _SDR_NOTOUCH
+#define _SDR_NOTRANSFORM
+#define _SDR_NOOBJECTS
+#define _SDR_NOVIEWS
+#define _SDR_NOVIEWMARKER
+#define _SDR_NODRAGMETHODS
+#define _SDR_NOUNDO
+#define _SDR_NOXOUTDEV
+#include <vcl/wrkwin.hxx>
+#include <tools/shl.hxx>
+#include <vcl/msgbox.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <unotools/localfilehelper.hxx>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <vcl/bmpacc.hxx>
+
+#define _SVX_TPBITMAP_CXX
+
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "svx/xattr.hxx"
+#include <svx/xpool.hxx>
+#include <svx/xtable.hxx>
+#include "svx/xoutbmp.hxx"
+#include "svx/drawitem.hxx"
+#include "cuitabarea.hxx"
+#include "tabarea.hrc"
+#include "defdlgname.hxx" //CHINA001 #include "dlgname.hxx"
+//#include "dlgname.hrc"
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialmgr.hxx>
+#include "svx/opengrf.hxx"
+
+#define DLGWIN this->GetParent()->GetParent()
+
+/*************************************************************************
+|*
+|* Dialog zum Aendern und Definieren der Bitmaps
+|*
+\************************************************************************/
+
+SvxBitmapTabPage::SvxBitmapTabPage
+(
+ Window* pParent,
+ const SfxItemSet& rInAttrs
+) :
+
+ SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_BITMAP ), rInAttrs ),
+
+ aCtlPixel ( this, SVX_RES( CTL_PIXEL ) ),
+ aFtPixelEdit ( this, SVX_RES( FT_PIXEL_EDIT ) ),
+ aFtColor ( this, SVX_RES( FT_COLOR ) ),
+ aLbColor ( this, SVX_RES( LB_COLOR ) ),
+ aFtBackgroundColor ( this, SVX_RES( FT_BACKGROUND_COLOR ) ),
+ aLbBackgroundColor ( this, SVX_RES( LB_BACKGROUND_COLOR ) ),
+ // This fix text is used only to provide the name for the following
+ // bitmap list box. The fixed text is not displayed.
+ aLbBitmapsHidden ( this, SVX_RES( FT_BITMAPS_HIDDEN ) ),
+ aLbBitmaps ( this, SVX_RES( LB_BITMAPS ) ),
+ aFlProp ( this, SVX_RES( FL_PROP ) ),
+ aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ),
+ aBtnAdd ( this, SVX_RES( BTN_ADD ) ),
+ aBtnModify ( this, SVX_RES( BTN_MODIFY ) ),
+ aBtnImport ( this, SVX_RES( BTN_IMPORT ) ),
+ aBtnDelete ( this, SVX_RES( BTN_DELETE ) ),
+ aBtnLoad ( this, SVX_RES( BTN_LOAD ) ),
+ aBtnSave ( this, SVX_RES( BTN_SAVE ) ),
+
+ aBitmapCtl ( this, aCtlPreview.GetSizePixel() ),
+ rOutAttrs ( rInAttrs ),
+
+ pColorTab( NULL ),
+ pBitmapList( NULL ),
+
+ pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
+ aXFStyleItem ( XFILL_BITMAP ),
+ aXBitmapItem ( String(), XOBitmap() ),
+ aXFillAttr ( pXPool ),
+ rXFSet ( aXFillAttr.GetItemSet() )
+{
+ aBtnLoad.SetModeImage( Image( SVX_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST );
+ aBtnSave.SetModeImage( Image( SVX_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST );
+ FreeResource();
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ // Setzen des Output-Devices
+ rXFSet.Put( aXFStyleItem );
+ rXFSet.Put( aXBitmapItem );
+ //aCtlPreview.SetAttributes( aXFillAttr );
+
+ aBtnAdd.SetClickHdl( LINK( this, SvxBitmapTabPage, ClickAddHdl_Impl ) );
+ aBtnImport.SetClickHdl(
+ LINK( this, SvxBitmapTabPage, ClickImportHdl_Impl ) );
+ aBtnModify.SetClickHdl(
+ LINK( this, SvxBitmapTabPage, ClickModifyHdl_Impl ) );
+ aBtnDelete.SetClickHdl(
+ LINK( this, SvxBitmapTabPage, ClickDeleteHdl_Impl ) );
+ aBtnLoad.SetClickHdl( LINK( this, SvxBitmapTabPage, ClickLoadHdl_Impl ) );
+ aBtnSave.SetClickHdl( LINK( this, SvxBitmapTabPage, ClickSaveHdl_Impl ) );
+
+ aLbBitmaps.SetSelectHdl(
+ LINK( this, SvxBitmapTabPage, ChangeBitmapHdl_Impl ) );
+ aLbColor.SetSelectHdl(
+ LINK( this, SvxBitmapTabPage, ChangePixelColorHdl_Impl ) );
+ aLbBackgroundColor.SetSelectHdl(
+ LINK( this, SvxBitmapTabPage, ChangeBackgrndColorHdl_Impl ) );
+
+}
+
+// -----------------------------------------------------------------------
+
+void SvxBitmapTabPage::Construct()
+{
+ // Farbtabellen
+ aLbColor.Fill( pColorTab );
+ aLbBackgroundColor.CopyEntries( aLbColor );
+
+ // Bitmaptabelle
+ aLbBitmaps.Fill( pBitmapList );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxBitmapTabPage::ActivatePage( const SfxItemSet& )
+{
+ USHORT nPos;
+ USHORT nCount;
+
+ if( *pDlgType == 0 ) // Flaechen-Dialog
+ {
+ *pbAreaTP = FALSE;
+
+ if( pColorTab )
+ {
+ // ColorTable
+ if( *pnColorTableState & CT_CHANGED ||
+ *pnColorTableState & CT_MODIFIED )
+ {
+ if( *pnColorTableState & CT_CHANGED )
+ pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable();
+
+ // LbColor
+ nPos = aLbColor.GetSelectEntryPos();
+ aLbColor.Clear();
+ aLbColor.Fill( pColorTab );
+ nCount = aLbColor.GetEntryCount();
+ if( nCount == 0 )
+ ; // Dieser Fall sollte nicht auftreten
+ else if( nCount <= nPos )
+ aLbColor.SelectEntryPos( 0 );
+ else
+ aLbColor.SelectEntryPos( nPos );
+
+ // LbColorBackground
+ nPos = aLbBackgroundColor.GetSelectEntryPos();
+ aLbBackgroundColor.Clear();
+ aLbBackgroundColor.CopyEntries( aLbColor );
+ nCount = aLbBackgroundColor.GetEntryCount();
+ if( nCount == 0 )
+ ; // Dieser Fall sollte nicht auftreten
+ else if( nCount <= nPos )
+ aLbBackgroundColor.SelectEntryPos( 0 );
+ else
+ aLbBackgroundColor.SelectEntryPos( nPos );
+
+ ChangePixelColorHdl_Impl( this );
+ ChangeBackgrndColorHdl_Impl( this );
+ }
+
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ INetURLObject aURL( pBitmapList->GetPath() );
+
+ aURL.Append( pBitmapList->GetName() );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ if( *pPageType == PT_BITMAP && *pPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aLbBitmaps.SelectEntryPos( *pPos );
+ }
+ // Farben koennten geloescht worden sein
+ ChangeBitmapHdl_Impl( this );
+
+ *pPageType = PT_BITMAP;
+ *pPos = LISTBOX_ENTRY_NOTFOUND;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SvxBitmapTabPage::DeactivatePage( SfxItemSet* _pSet)
+{
+ if ( CheckChanges_Impl() == -1L )
+ return KEEP_PAGE;
+
+ if( _pSet )
+ FillItemSet( *_pSet );
+
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxBitmapTabPage::FillItemSet( SfxItemSet& _rOutAttrs )
+{
+ if( *pDlgType == 0 && *pbAreaTP == FALSE ) // Flaechen-Dialog
+ {
+ if( *pPageType == PT_BITMAP )
+ {
+ // CheckChanges_Impl(); <-- doppelte Abfrage ?
+
+ XOBitmap aXOBitmap;
+ String aString;
+ USHORT nPos = aLbBitmaps.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aXOBitmap = pBitmapList->GetBitmap( nPos )->GetXBitmap();
+ aString = aLbBitmaps.GetSelectEntry();
+
+ }
+ else
+ {
+ aXOBitmap = aBitmapCtl.GetXBitmap();
+
+ // #85339# if it's an array, force conversion to bitmap before using it.
+ if(aXOBitmap.GetBitmapType() == XBITMAP_8X8)
+ aXOBitmap.GetBitmap();
+
+ }
+ _rOutAttrs.Put( XFillStyleItem( XFILL_BITMAP ) );
+ _rOutAttrs.Put( XFillBitmapItem( aString, aXOBitmap ) );
+ }
+ }
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxBitmapTabPage::Reset( const SfxItemSet& )
+{
+ // aLbBitmaps.SelectEntryPos( 0 );
+
+ aBitmapCtl.SetLines( aCtlPixel.GetLineCount() );
+ aBitmapCtl.SetPixelColor( aLbColor.GetSelectEntryColor() );
+ aBitmapCtl.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() );
+ aBitmapCtl.SetBmpArray( aCtlPixel.GetBitmapPixelPtr() );
+
+ // Bitmap holen und darstellen
+ XFillBitmapItem aBmpItem( (const String &) String(), aBitmapCtl.GetXBitmap() );
+ rXFSet.Put( aBmpItem );
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlPreview.Invalidate();
+
+ ChangeBitmapHdl_Impl( this );
+
+ // Status der Buttons ermitteln
+ if( pBitmapList->Count() )
+ {
+ aBtnAdd.Enable();
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ else
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxBitmapTabPage::Create( Window* pWindow,
+ const SfxItemSet& rSet )
+{
+ return new SvxBitmapTabPage( pWindow, rSet );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxBitmapTabPage, ChangeBitmapHdl_Impl, void *, EMPTYARG )
+{
+ XOBitmap* pXOBitmap = NULL;
+ int nPos = aLbBitmaps.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ pXOBitmap = new XOBitmap( ( (XBitmapEntry*) pBitmapList->GetBitmap( nPos ) )->GetXBitmap() );
+ else
+ {
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), TRUE, &pPoolItem ) )
+ {
+ XFillStyle eXFS = (XFillStyle) ( ( const XFillStyleItem* ) pPoolItem )->GetValue();
+ if( ( XFILL_BITMAP == eXFS ) &&
+ ( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), TRUE, &pPoolItem ) ) )
+ {
+ pXOBitmap = new XOBitmap( ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() );
+ }
+ }
+ if( !pXOBitmap )
+ {
+ aLbBitmaps.SelectEntryPos( 0 );
+ nPos = aLbBitmaps.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ pXOBitmap = new XOBitmap( ( (XBitmapEntry*) pBitmapList->GetBitmap( nPos ) )->GetXBitmap() );
+ }
+ }
+ if( pXOBitmap )
+ {
+ //WorkWindow aTmpWW( DLGWIN );
+ //VirtualDevice aVD( aTmpWW );
+ //USHORT nLines = aCtlPixel.GetLineCount();
+ //Color aPixelColor, aBackColor;
+ //BOOL bPixelColor = FALSE;
+ //USHORT nWidth = pBitmap->GetSizePixel().Width();
+ //USHORT nHeight = pBitmap->GetSizePixel().Height();
+
+ // #85339# try to convert bitmapped item to array item.
+ if(pXOBitmap->GetBitmapType() == XBITMAP_IMPORT)
+ {
+ Bitmap aBitmap(pXOBitmap->GetBitmap());
+ Size aSizePixel(aBitmap.GetSizePixel());
+
+ if(8 == aSizePixel.Width() && 8 == aSizePixel.Height())
+ {
+ sal_uInt16* pPixelArray = new sal_uInt16[64];
+ sal_uInt32 nCol1(0xffffffff); // background
+ sal_uInt32 nCol2(0xffffffff); // pixel
+ BitmapReadAccess* pAccess = aBitmap.AcquireReadAccess();
+ sal_Bool bValid(TRUE);
+
+ if(pAccess)
+ {
+ for(sal_uInt32 a(0); bValid && a < 64; a++)
+ {
+ const BitmapColor aBmCol = pAccess->GetColor(a>>3, a%8);
+ Color aRgbCol(aBmCol.GetRed(), aBmCol.GetGreen(), aBmCol.GetBlue());
+ sal_uInt32 nColVal = aRgbCol.GetRGBColor();
+
+ // test with nCol1
+ if(nCol1 != nColVal)
+ {
+ if(0xffffffff == nCol1)
+ {
+ // nCol1 is used first time
+ nCol1 = nColVal;
+ pPixelArray[a] = 0;
+ }
+ else
+ {
+ // test with nCol2
+ if(nCol2 != nColVal)
+ {
+ if(0xffffffff == nCol2)
+ {
+ // nCol2 used first time
+ nCol2 = nColVal;
+ pPixelArray[a] = 1;
+ }
+ else
+ {
+ // Third color detected
+ bValid = FALSE;
+ }
+ }
+ else
+ {
+ // color is pixel color
+ pPixelArray[a] = 1;
+ }
+ }
+ }
+ else
+ {
+ // color is background color
+ pPixelArray[a] = 0;
+ }
+ }
+
+ // release ReadAccess
+ aBitmap.ReleaseAccess(pAccess);
+ }
+ else
+ {
+ // no access -> no success
+ bValid = FALSE;
+ }
+
+ if(bValid)
+ {
+ Color aCol1(nCol1);
+ Color aCol2(nCol2);
+
+ // no pixel color found? Use opposite od background color.
+ if(0xffffffff == nCol2)
+ {
+ aCol2 = Color(
+ 0xff - aCol1.GetRed(),
+ 0xff - aCol1.GetGreen(),
+ 0xff - aCol1.GetBlue());
+ }
+
+ // transformation did work, create a new Item
+ delete pXOBitmap;
+ pXOBitmap = new XOBitmap(pPixelArray, aCol2, aCol1);
+ }
+
+ // cleanup
+ delete[] pPixelArray;
+ }
+ }
+
+ aLbColor.SetNoSelection();
+ aLbBackgroundColor.SetNoSelection();
+
+ if( pXOBitmap->GetBitmapType() == XBITMAP_IMPORT )
+ {
+ aCtlPixel.Reset();
+ aCtlPixel.SetPaintable( FALSE );
+ aCtlPixel.Disable();
+ aFtPixelEdit.Disable();
+ aFtColor.Disable();
+ aLbColor.Disable();
+ aFtBackgroundColor.Disable();
+ aLbBackgroundColor.Disable();
+ aBtnModify.Disable();
+ aBtnAdd.Disable();
+ }
+ else if( pXOBitmap->GetBitmapType() == XBITMAP_8X8 )
+ {
+ aCtlPixel.SetPaintable( TRUE );
+ aCtlPixel.Enable();
+ aFtPixelEdit.Enable();
+ aFtColor.Enable();
+ aLbColor.Enable();
+ aFtBackgroundColor.Enable();
+ aLbBackgroundColor.Enable();
+ aBtnModify.Enable();
+ aBtnAdd.Enable();
+
+ // Setzen des PixelControls
+ aCtlPixel.SetXBitmap( *pXOBitmap );
+
+ Color aPixelColor = pXOBitmap->GetPixelColor();
+ Color aBackColor = pXOBitmap->GetBackgroundColor();
+
+ aBitmapCtl.SetPixelColor( aPixelColor );
+ aBitmapCtl.SetBackgroundColor( aBackColor );
+
+ // Wenn der Eintrag nicht in der Listbox ist, wird die Farbe
+ // temporaer hinzugenommen
+ if( 0 == aLbBitmaps.GetSelectEntryPos() )
+ {
+ aLbColor.SelectEntry( Color( COL_BLACK ) );
+ ChangePixelColorHdl_Impl( this );
+ }
+ else
+ aLbColor.SelectEntry( aPixelColor );
+ if( aLbColor.GetSelectEntryCount() == 0 )
+ {
+ aLbColor.InsertEntry( aPixelColor, String() );
+ aLbColor.SelectEntry( aPixelColor );
+ }
+ aLbBackgroundColor.SelectEntry( aBackColor );
+ if( aLbBackgroundColor.GetSelectEntryCount() == 0 )
+ {
+ aLbBackgroundColor.InsertEntry( aBackColor, String() );
+ aLbBackgroundColor.SelectEntry( aBackColor );
+ }
+ }
+ aCtlPixel.Invalidate();
+
+ // Bitmap darstellen
+ XFillBitmapItem aXBmpItem( (const String &) String(), *pXOBitmap );
+ rXFSet.Put( aXBmpItem );
+
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlPreview.Invalidate();
+
+ bBmpChanged = FALSE;
+ delete pXOBitmap;
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+long SvxBitmapTabPage::CheckChanges_Impl()
+{
+ USHORT nPos = aLbBitmaps.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ String aString = aLbBitmaps.GetSelectEntry();
+
+ if( bBmpChanged )
+ {
+ ResMgr& rMgr = DIALOG_MGR();
+ Image aWarningBoxImage = WarningBox::GetStandardImage();
+ //CHINA001 SvxMessDialog aMessDlg( DLGWIN,
+ //CHINA001 String( SVX_RES( RID_SVXSTR_BITMAP, rMgr ) ),
+ //CHINA001 String( SVX_RES( RID_SVXSTR_ASK_CHANGE_BITMAP, rMgr ) ),
+ //CHINA001 &aWarningBoxImage );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX,
+ String( ResId( RID_SVXSTR_BITMAP, rMgr ) ),
+ String( ResId( RID_SVXSTR_ASK_CHANGE_BITMAP, rMgr ) ),
+ &aWarningBoxImage );
+ DBG_ASSERT(aMessDlg, "Dialogdiet fail!");//CHINA001
+ aMessDlg->SetButtonText( MESS_BTN_1, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_1,
+ String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
+ aMessDlg->SetButtonText( MESS_BTN_2, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_2,
+ String( ResId( RID_SVXSTR_ADD, rMgr ) ) );
+
+ short nRet = aMessDlg->Execute(); //CHINA001 short nRet = aMessDlg.Execute();
+
+ switch( nRet )
+ {
+ case RET_BTN_1: // Aendern
+ {
+ ClickModifyHdl_Impl( this );
+ }
+ break;
+
+ case RET_BTN_2: // Hinzufuegen
+ {
+ ClickAddHdl_Impl( this );
+ nPos = aLbBitmaps.GetSelectEntryPos();
+ }
+ break;
+
+ case RET_CANCEL:
+ // return( -1L );
+ break;
+ // return( TRUE ); // Abbruch
+ }
+ delete aMessDlg; //add by CHINA001
+ }
+ }
+ nPos = aLbBitmaps.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ *pPos = nPos;
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxBitmapTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
+{
+ ResMgr& rMgr = DIALOG_MGR();
+ String aNewName( ResId( RID_SVXSTR_BITMAP, rMgr ) );
+ String aDesc( ResId( RID_SVXSTR_DESC_NEW_BITMAP, rMgr ) );
+ String aName;
+
+ long nCount = pBitmapList->Count();
+ long j = 1;
+ BOOL bDifferent = FALSE;
+
+ while( !bDifferent )
+ {
+ aName = aNewName;
+ aName += sal_Unicode(' ');
+ aName += UniString::CreateFromInt32( j++ );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ if( aName == pBitmapList->GetBitmap( i )->GetName() )
+ bDifferent = FALSE;
+ }
+
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ WarningBox* pWarnBox = NULL;
+ USHORT nError = RID_SVXSTR_WARN_NAME_DUPLICATE;
+
+ while( pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ if( aName == pBitmapList->GetBitmap( i )->GetName() )
+ bDifferent = FALSE;
+
+ if( bDifferent ) {
+ nError = 0;
+ break;
+ }
+
+ if( !pWarnBox )
+ {
+ pWarnBox = new WarningBox( DLGWIN,
+ WinBits( WB_OK_CANCEL ),
+ String( ResId( nError, rMgr ) ) );
+ pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE );
+ }
+
+ if( pWarnBox->Execute() != RET_OK )
+ break;
+ }
+ //Rectangle aDlgRect( pDlg->GetPosPixel(), pDlg->GetSizePixel() );
+ delete pDlg;
+ delete pWarnBox;
+
+ if( !nError )
+ {
+ XBitmapEntry* pEntry = 0;
+ if( aCtlPixel.IsEnabled() )
+ {
+ XOBitmap aXOBitmap = aBitmapCtl.GetXBitmap();
+
+ // #85339# if it's an array, force conversion to bitmap before using it.
+ if(aXOBitmap.GetBitmapType() == XBITMAP_8X8)
+ aXOBitmap.GetBitmap();
+
+ pEntry = new XBitmapEntry( aXOBitmap, aName );
+ }
+ else // Es muss sich um eine nicht vorhandene importierte Bitmap handeln
+ {
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == rOutAttrs.GetItemState( XATTR_FILLBITMAP, TRUE, &pPoolItem ) )
+ {
+ XOBitmap aXOBitmap( ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() );
+ pEntry = new XBitmapEntry( aXOBitmap, aName );
+ }
+ }
+
+ DBG_ASSERT( pEntry, "SvxBitmapTabPage::ClickAddHdl_Impl(), pEntry == 0 ?" );
+
+ if( pEntry )
+ {
+ pBitmapList->Insert( pEntry );
+
+ aLbBitmaps.Append( pEntry );
+ aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 );
+
+#ifdef WNT
+ // hack: #31355# W.P.
+ Rectangle aRect( aLbBitmaps.GetPosPixel(), aLbBitmaps.GetSizePixel() );
+ if( TRUE ) { // ??? overlapped with pDlg
+ // and srolling
+ Invalidate( aRect );
+ //aLbBitmaps.Invalidate();
+ }
+#endif
+
+ // Flag fuer modifiziert setzen
+ *pnBitmapListState |= CT_MODIFIED;
+
+ ChangeBitmapHdl_Impl( this );
+ }
+ }
+
+ // Status der Buttons ermitteln
+ if( pBitmapList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ return 0L;
+}
+
+
+/******************************************************************************/
+/******************************************************************************/
+
+
+//------------------------------------------------------------------------
+
+#ifdef _MSC_VER
+#pragma optimize ( "", off )
+#endif
+
+IMPL_LINK( SvxBitmapTabPage, ClickImportHdl_Impl, void *, EMPTYARG )
+{
+ ResMgr& rMgr = DIALOG_MGR();
+ SvxOpenGraphicDialog aDlg( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Import" ) ) );
+ aDlg.EnableLink(sal_False);
+
+ if( !aDlg.Execute() )
+ {
+ Graphic aGraphic;
+ int nError = 1;
+
+ EnterWait();
+ nError = aDlg.GetGraphic( aGraphic );
+ LeaveWait();
+
+ if( !nError )
+ {
+ String aDesc( ResId(RID_SVXSTR_DESC_EXT_BITMAP, rMgr) );
+ WarningBox* pWarnBox = NULL;
+
+ // convert file URL to UI name
+ String aName;
+ INetURLObject aURL( aDlg.GetPath() );
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aURL.GetName().GetToken( 0, '.' ), aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, String(aURL.GetName()).GetToken( 0, '.' ), aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ nError = RID_SVXSTR_WARN_NAME_DUPLICATE;
+
+ while( pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+
+ BOOL bDifferent = TRUE;
+ long nCount = pBitmapList->Count();
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ if( aName == pBitmapList->GetBitmap( i )->GetName() )
+ bDifferent = FALSE;
+
+ if( bDifferent ) {
+ nError = 0;
+ break;
+ }
+
+ if( !pWarnBox )
+ {
+ pWarnBox = new WarningBox( DLGWIN,
+ WinBits( WB_OK_CANCEL ),
+ String( ResId( nError, rMgr ) ) );
+ pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE );
+ }
+
+
+ if( pWarnBox->Execute() != RET_OK )
+ break;
+ }
+ //Rectangle aDlgRect( pDlg->GetPosPixel(), pDlg->GetSizePixel() );
+ delete pDlg;
+ delete pWarnBox;
+
+ if( !nError )
+ {
+ Bitmap aBmp( aGraphic.GetBitmap() );
+ XBitmapEntry* pEntry =
+ new XBitmapEntry( XOBitmap( aBmp ), aName );
+ pBitmapList->Insert( pEntry );
+
+ aLbBitmaps.Append( pEntry );
+ aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 );
+
+#ifdef WNT
+ // hack: #31355# W.P.
+ Rectangle aRect( aLbBitmaps.GetPosPixel(), aLbBitmaps.GetSizePixel() );
+ if( TRUE ) { // ??? overlapped with pDlg
+ // and srolling
+ Invalidate( aRect );
+ //aLbBitmaps.Invalidate();
+ }
+#endif
+
+ // Flag fuer modifiziert setzen
+ *pnBitmapListState |= CT_MODIFIED;
+
+ ChangeBitmapHdl_Impl( this );
+ }
+ }
+ else
+ // Graphik konnte nicht geladen werden
+ ErrorBox( DLGWIN,
+ WinBits( WB_OK ),
+ String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
+ }
+
+ return 0L;
+}
+
+#ifdef _MSC_VER
+#pragma optimize ( "", on )
+#endif
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxBitmapTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbBitmaps.GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ ResMgr& rMgr = DIALOG_MGR();
+ String aNewName( ResId( RID_SVXSTR_BITMAP, rMgr ) );
+ String aDesc( ResId( RID_SVXSTR_DESC_NEW_BITMAP, rMgr ) );
+ String aName( pBitmapList->GetBitmap( nPos )->GetName() );
+ String aOldName = aName;
+
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+
+ long nCount = pBitmapList->Count();
+ BOOL bDifferent = FALSE;
+ BOOL bLoop = TRUE;
+
+ while( bLoop && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ {
+ if( aName == pBitmapList->GetBitmap( i )->GetName() &&
+ aName != aOldName )
+ bDifferent = FALSE;
+ }
+
+ if( bDifferent )
+ {
+ bLoop = FALSE;
+ XBitmapEntry* pEntry = pBitmapList->GetBitmap( nPos );
+
+ pEntry->SetName( aName );
+
+ XOBitmap aXOBitmap = aBitmapCtl.GetXBitmap();
+
+ // #85339# if it's an array, force conversion to bitmap before using it.
+ if(aXOBitmap.GetBitmapType() == XBITMAP_8X8)
+ aXOBitmap.GetBitmap();
+
+ pEntry->SetXBitmap( aXOBitmap );
+
+ aLbBitmaps.Modify( pEntry, nPos );
+ aLbBitmaps.SelectEntryPos( nPos );
+
+ // Flag fuer modifiziert setzen
+ *pnBitmapListState |= CT_MODIFIED;
+
+ bBmpChanged = FALSE;
+ }
+ else
+ {
+ WarningBox aBox( DLGWIN, WinBits( WB_OK ), String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+ aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
+ aBox.Execute();
+ }
+ }
+ delete pDlg;
+ }
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxBitmapTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbBitmaps.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+//! SVX_RES( RID_SVXSTR_DEL_BITMAP ),
+ String( SVX_RES( RID_SVXSTR_ASK_DEL_BITMAP ) ) );
+
+ if( aQueryBox.Execute() == RET_YES )
+ {
+ delete pBitmapList->Remove( nPos );
+ aLbBitmaps.RemoveEntry( nPos );
+ aLbBitmaps.SelectEntryPos( 0 );
+
+ aCtlPreview.Invalidate();
+ aCtlPixel.Invalidate();
+
+ ChangeBitmapHdl_Impl( this );
+
+ // Flag fuer modifiziert setzen
+ *pnBitmapListState |= CT_MODIFIED;
+ }
+ }
+ // Status der Buttons ermitteln
+ if( !pBitmapList->Count() )
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxBitmapTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nReturn = RET_YES;
+ ResMgr& rMgr = DIALOG_MGR();
+
+ if ( *pnBitmapListState & CT_MODIFIED )
+ {
+ nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
+ String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
+
+ if ( nReturn == RET_YES )
+ pBitmapList->Save();
+ }
+
+ if ( nReturn != RET_CANCEL )
+ {
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sob" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+ INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ EnterWait();
+ INetURLObject aURL( aDlg.GetPath() );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ // Tabelle speichern
+ XBitmapList* pBmpList = new XBitmapList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool );
+ pBmpList->SetName( aURL.getName() );
+ if( pBmpList->Load() )
+ {
+ if( pBmpList )
+ {
+ // Pruefen, ob Tabelle geloescht werden darf:
+ if( pBitmapList != ( (SvxAreaTabDialog*) DLGWIN )->GetBitmapList() )
+ delete pBitmapList;
+
+ pBitmapList = pBmpList;
+ ( (SvxAreaTabDialog*) DLGWIN )->SetNewBitmapList( pBitmapList );
+
+ aLbBitmaps.Clear();
+ aLbBitmaps.Fill( pBitmapList );
+ Reset( rOutAttrs );
+
+ pBitmapList->SetName( aURL.getName() );
+
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ // Flag fuer gewechselt setzen
+ *pnBitmapListState |= CT_CHANGED;
+ // Flag fuer modifiziert entfernen
+ *pnBitmapListState &= ~CT_MODIFIED;
+ }
+ LeaveWait();
+ }
+ else
+ {
+ LeaveWait();
+ ErrorBox( DLGWIN, WinBits( WB_OK ),
+ String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
+ }
+ }
+ }
+
+ // Status der Buttons ermitteln
+ if( pBitmapList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ else
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxBitmapTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
+{
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sob" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+
+ INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+ DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( pBitmapList->GetName().Len() )
+ {
+ aFile.Append( pBitmapList->GetName() );
+
+ if( !aFile.getExtension().getLength() )
+ aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "sob" ) ) );
+ }
+
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aDlg.GetPath() );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ pBitmapList->SetName( aURL.getName() );
+ pBitmapList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if( pBitmapList->Save() )
+ {
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ // Flag fuer gespeichert setzen
+ *pnBitmapListState |= CT_SAVED;
+ // Flag fuer modifiziert entfernen
+ *pnBitmapListState &= ~CT_MODIFIED;
+ }
+ else
+ {
+ ErrorBox( DLGWIN, WinBits( WB_OK ),
+ String( SVX_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
+ }
+ }
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxBitmapTabPage, ChangePixelColorHdl_Impl, void *, EMPTYARG )
+{
+ aCtlPixel.SetPixelColor( aLbColor.GetSelectEntryColor() );
+ aCtlPixel.Invalidate();
+
+ aBitmapCtl.SetPixelColor( aLbColor.GetSelectEntryColor() );
+
+ // Bitmap holen und darstellen
+ rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) );
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlPreview.Invalidate();
+
+ bBmpChanged = TRUE;
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxBitmapTabPage, ChangeBackgrndColorHdl_Impl, void *, EMPTYARG )
+{
+ aCtlPixel.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() );
+ aCtlPixel.Invalidate();
+
+ aBitmapCtl.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() );
+
+ // Bitmap holen und darstellen
+ rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) );
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlPreview.Invalidate();
+
+ bBmpChanged = TRUE;
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+void SvxBitmapTabPage::PointChanged( Window* pWindow, RECT_POINT )
+{
+ if( pWindow == &aCtlPixel )
+ {
+ aBitmapCtl.SetBmpArray( aCtlPixel.GetBitmapPixelPtr() );
+
+ // Bitmap holen und darstellen
+ rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) );
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlPreview.Invalidate();
+
+ bBmpChanged = TRUE;
+ }
+}
+
+
+
+
+Window* SvxBitmapTabPage::GetParentLabeledBy( const Window* pLabeled ) const
+{
+ if (pLabeled == &aLbBitmaps)
+ return const_cast<FixedText*>(&aLbBitmapsHidden);
+ else
+ return SvxTabPage::GetParentLabeledBy (pLabeled);
+}
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
new file mode 100644
index 000000000000..86c1b5ab7565
--- /dev/null
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -0,0 +1,1280 @@
+/*************************************************************************
+ *
+ * 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: tpcolor.cxx,v $
+ * $Revision: 1.33 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <svtools/colrdlg.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+
+#define _SVX_TPCOLOR_CXX
+
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "svx/xattr.hxx"
+#include <svx/xpool.hxx>
+#include <svx/xtable.hxx>
+#include "svx/drawitem.hxx"
+#include "cuitabarea.hxx"
+#include "tabarea.hrc"
+#include "defdlgname.hxx" //CHINA001 #include "dlgname.hxx"
+//#include "dlgname.hrc"
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialmgr.hxx>
+#include <cuitabline.hxx>
+
+#define DLGWIN GetParentDialog( this )
+
+/*************************************************************************
+|*
+|* Dialog zum Aendern und Definieren der Farben
+|*
+\************************************************************************/
+
+static Window* GetParentDialog( Window* pWindow )
+{
+ while( pWindow )
+ {
+ if( pWindow->IsDialog() )
+ break;
+
+ pWindow = pWindow->GetParent();
+ }
+
+ return pWindow;
+}
+
+SvxColorTabPage::SvxColorTabPage
+(
+ Window* pParent,
+ const SfxItemSet& rInAttrs
+) :
+
+ SfxTabPage ( pParent, SVX_RES( RID_SVXPAGE_COLOR ), rInAttrs ),
+
+ aFlProp ( this, SVX_RES( FL_PROP ) ),
+ aFtName ( this, SVX_RES( FT_NAME ) ),
+ aEdtName ( this, SVX_RES( EDT_NAME ) ),
+ aFtColor ( this, SVX_RES( FT_COLOR ) ),
+ aLbColor ( this, SVX_RES( LB_COLOR ) ),
+
+ aTableNameFT ( this, SVX_RES( FT_TABLE_NAME ) ),
+ aValSetColorTable ( this, SVX_RES( CTL_COLORTABLE ) ),
+
+ aCtlPreviewOld ( this, SVX_RES( CTL_PREVIEW_OLD ) ),
+ aCtlPreviewNew ( this, SVX_RES( CTL_PREVIEW_NEW ) ),
+
+ aLbColorModel ( this, SVX_RES( LB_COLORMODEL ) ),
+ aFtColorModel1 ( this, SVX_RES( FT_1 ) ),
+ aMtrFldColorModel1 ( this, SVX_RES( MTR_FLD_1 ) ),
+ aFtColorModel2 ( this, SVX_RES( FT_2 ) ),
+ aMtrFldColorModel2 ( this, SVX_RES( MTR_FLD_2 ) ),
+ aFtColorModel3 ( this, SVX_RES( FT_3 ) ),
+ aMtrFldColorModel3 ( this, SVX_RES( MTR_FLD_3 ) ),
+ aFtColorModel4 ( this, SVX_RES( FT_4 ) ),
+ aMtrFldColorModel4 ( this, SVX_RES( MTR_FLD_4 ) ),
+ aBtnAdd ( this, SVX_RES( BTN_ADD ) ),
+ aBtnModify ( this, SVX_RES( BTN_MODIFY ) ),
+ aBtnWorkOn ( this, SVX_RES( BTN_WORK_ON ) ),
+ aBtnDelete ( this, SVX_RES( BTN_DELETE ) ),
+ aBtnLoad ( this, SVX_RES( BTN_LOAD ) ),
+ aBtnSave ( this, SVX_RES( BTN_SAVE ) ),
+
+ rOutAttrs ( rInAttrs ),
+ pColorTab( NULL ),
+
+ bDeleteColorTable ( TRUE ),
+
+ pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
+ aXFStyleItem ( XFILL_SOLID ),
+ aXFillColorItem ( String(), Color( COL_BLACK ) ),
+ aXFillAttr ( pXPool ),
+ rXFSet ( aXFillAttr.GetItemSet() ),
+
+ eCM ( CM_RGB )
+
+{
+ aBtnLoad.SetModeImage( Image( SVX_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST );
+ aBtnSave.SetModeImage( Image( SVX_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST );
+
+ FreeResource();
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ // Setzen des Output-Devices
+ rXFSet.Put( aXFStyleItem );
+ rXFSet.Put( aXFillColorItem );
+ aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() );
+
+ // Handler ueberladen
+ aLbColor.SetSelectHdl(
+ LINK( this, SvxColorTabPage, SelectColorLBHdl_Impl ) );
+ aValSetColorTable.SetSelectHdl(
+ LINK( this, SvxColorTabPage, SelectValSetHdl_Impl ) );
+ aLbColorModel.SetSelectHdl(
+ LINK( this, SvxColorTabPage, SelectColorModelHdl_Impl ) );
+
+ Link aLink = LINK( this, SvxColorTabPage, ModifiedHdl_Impl );
+ aMtrFldColorModel1.SetModifyHdl( aLink );
+ aMtrFldColorModel2.SetModifyHdl( aLink );
+ aMtrFldColorModel3.SetModifyHdl( aLink );
+ aMtrFldColorModel4.SetModifyHdl( aLink );
+
+ aBtnAdd.SetClickHdl( LINK( this, SvxColorTabPage, ClickAddHdl_Impl ) );
+ aBtnModify.SetClickHdl(
+ LINK( this, SvxColorTabPage, ClickModifyHdl_Impl ) );
+ aBtnWorkOn.SetClickHdl(
+ LINK( this, SvxColorTabPage, ClickWorkOnHdl_Impl ) );
+ aBtnDelete.SetClickHdl(
+ LINK( this, SvxColorTabPage, ClickDeleteHdl_Impl ) );
+ aBtnLoad.SetClickHdl( LINK( this, SvxColorTabPage, ClickLoadHdl_Impl ) );
+ aBtnSave.SetClickHdl( LINK( this, SvxColorTabPage, ClickSaveHdl_Impl ) );
+
+ // ValueSet
+ aValSetColorTable.SetStyle( aValSetColorTable.GetStyle() | WB_VSCROLL | WB_ITEMBORDER );
+ aValSetColorTable.SetColCount( 8 );
+ aValSetColorTable.SetLineCount( 10 );
+ aValSetColorTable.SetExtraSpacing( 0 );
+ aValSetColorTable.Show();
+
+}
+
+// -----------------------------------------------------------------------
+
+void SvxColorTabPage::Construct()
+{
+ aLbColor.Fill( pColorTab );
+ FillValueSet_Impl( aValSetColorTable );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxColorTabPage::ActivatePage( const SfxItemSet& )
+{
+ if( *pDlgType == 0 ) // Flaechen-Dialog
+ {
+ *pbAreaTP = FALSE;
+
+ if( pColorTab )
+ {
+ if( *pPageType == PT_COLOR && *pPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aLbColor.SelectEntryPos( *pPos );
+ aValSetColorTable.SelectItem( aLbColor.GetSelectEntryPos() + 1 );
+ aEdtName.SetText( aLbColor.GetSelectEntry() );
+
+ ChangeColorHdl_Impl( this );
+ }
+ else if( *pPageType == PT_COLOR && *pPos == LISTBOX_ENTRY_NOTFOUND )
+ {
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) )
+ {
+ aLbColorModel.SelectEntryPos( CM_RGB );
+
+ aAktuellColor.SetColor ( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue().GetColor() );
+
+ aEdtName.SetText( ( ( const XFillColorItem* ) pPoolItem )->GetName() );
+
+ aMtrFldColorModel1.SetValue( ColorToPercent_Impl( aAktuellColor.GetRed() ) );
+ aMtrFldColorModel2.SetValue( ColorToPercent_Impl( aAktuellColor.GetGreen() ) );
+ aMtrFldColorModel3.SetValue( ColorToPercent_Impl( aAktuellColor.GetBlue() ) );
+
+ // ItemSet fuellen und an XOut weiterleiten
+ rXFSet.Put( XFillColorItem( String(), aAktuellColor ) );
+ aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aCtlPreviewNew.Invalidate();
+ aCtlPreviewOld.Invalidate();
+ }
+ }
+
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ INetURLObject aURL( pColorTab->GetPath() );
+
+ aURL.Append( pColorTab->GetName() );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if ( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ aTableNameFT.SetText( aString );
+
+ // Damit evtl. geaenderte Farbe verworfen wird
+ SelectColorLBHdl_Impl( this );
+
+ *pPageType = PT_COLOR;
+ *pPos = LISTBOX_ENTRY_NOTFOUND;
+ }
+ }
+ else
+ {
+ // Buttons werden gehided, weil Paletten z.Z. nur
+ // ueber den AreaDlg funktionieren!!!
+ // ActivatePage() muss von anderen Dialogen explizit
+ // gerufen werden, da ActivatePage() nicht gerufen wird,
+ // wenn Seite als Erste im Dialog angezeigt wird
+ aBtnLoad.Hide();
+ aBtnSave.Hide();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SvxColorTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( CheckChanges_Impl() == -1L )
+ return( KEEP_PAGE );
+
+ if( _pSet )
+ FillItemSet( *_pSet );
+
+ return( LEAVE_PAGE );
+}
+
+// -----------------------------------------------------------------------
+
+long SvxColorTabPage::CheckChanges_Impl()
+{
+ // wird hier benutzt, um Aenderungen NICHT zu verlieren
+
+ Color aTmpColor (aAktuellColor);
+ if (eCM != CM_RGB)
+ ConvertColorValues (aTmpColor, CM_RGB);
+
+ USHORT nPos = aLbColor.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ Color aColor = pColorTab->GetColor( nPos )->GetColor();
+ String aString = aLbColor.GetSelectEntry();
+
+ // aNewColor, da COL_USER != COL_irgendwas, auch wenn RGB-Werte gleich
+ // Color aNewColor( aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue() );
+
+ if( ColorToPercent_Impl( aTmpColor.GetRed() ) != ColorToPercent_Impl( aColor.GetRed() ) ||
+ ColorToPercent_Impl( aTmpColor.GetGreen() ) != ColorToPercent_Impl( aColor.GetGreen() ) ||
+ ColorToPercent_Impl( aTmpColor.GetBlue() ) != ColorToPercent_Impl( aColor.GetBlue() ) ||
+ aString != aEdtName.GetText() )
+ {
+ ResMgr& rMgr = DIALOG_MGR();
+ Image aWarningBoxImage = WarningBox::GetStandardImage();
+ //CHINA001 SvxMessDialog aMessDlg( DLGWIN,
+ //CHINA001 String( SVX_RES( RID_SVXSTR_COLOR, pMgr ) ),
+ //CHINA001 String( ResId( RID_SVXSTR_ASK_CHANGE_COLOR, pMgr ) ),
+ //CHINA001 &aWarningBoxImage );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX,
+ String( ResId( RID_SVXSTR_COLOR, rMgr ) ),
+ String( ResId( RID_SVXSTR_ASK_CHANGE_COLOR, rMgr ) ),
+ &aWarningBoxImage );
+ DBG_ASSERT(aMessDlg, "Dialogdiet fail!");//CHINA001
+ aMessDlg->SetButtonText( MESS_BTN_1, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_1,
+ String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
+ aMessDlg->SetButtonText( MESS_BTN_2, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_2,
+ String( ResId( RID_SVXSTR_ADD, rMgr ) ) );
+
+ short nRet = aMessDlg->Execute(); //CHINA001 short nRet = aMessDlg.Execute();
+
+ switch( nRet )
+ {
+ case RET_BTN_1: // Aendern
+ {
+ ClickModifyHdl_Impl( this );
+ aColor = pColorTab->GetColor( nPos )->GetColor();
+ }
+ break;
+
+ case RET_BTN_2: // Hinzufuegen
+ {
+ ClickAddHdl_Impl( this );
+ nPos = aLbColor.GetSelectEntryPos();
+ aColor = pColorTab->GetColor( nPos )->GetColor();
+ }
+ break;
+
+ case RET_CANCEL:
+ // return( -1L ); <-- wuerde die Seite nicht verlassen
+ break;
+ // return( TRUE ); // Abbruch
+ }
+ delete aMessDlg; //add by CHINA001
+ }
+ }
+ if( *pDlgType == 0 ) // Flaechen-Dialog
+ {
+ nPos = aLbColor.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ *pPos = nPos;
+ }
+ }
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxColorTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ if( ( *pDlgType != 0 ) ||
+ ( *pPageType == PT_COLOR && *pbAreaTP == FALSE ) )
+ {
+ String aString;
+ Color aColor;
+
+ // CheckChanges_Impl(); <-- doppelte Abfrage ?
+
+ USHORT nPos = aLbColor.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aColor = pColorTab->GetColor( nPos )->GetColor();
+ aString = aLbColor.GetSelectEntry();
+ }
+ else
+ {
+ aColor.SetColor (aAktuellColor.GetColor());
+ if (eCM != CM_RGB)
+ ConvertColorValues (aColor, CM_RGB);
+ }
+ rSet.Put( XFillColorItem( aString, aColor ) );
+ rSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ }
+
+ return( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxColorTabPage::Reset( const SfxItemSet& rSet )
+{
+ USHORT nState = rSet.GetItemState( XATTR_FILLCOLOR );
+
+ if ( nState >= SFX_ITEM_DEFAULT )
+ {
+ XFillColorItem aColorItem( (const XFillColorItem&)rSet.Get( XATTR_FILLCOLOR ) );
+ aLbColor.SelectEntry( aColorItem.GetColorValue() );
+ aValSetColorTable.SelectItem( aLbColor.GetSelectEntryPos() + 1 );
+ aEdtName.SetText( aLbColor.GetSelectEntry() );
+ }
+
+ // Farbmodell setzen
+ String aStr = GetUserData();
+ aLbColorModel.SelectEntryPos( (USHORT) aStr.ToInt32() );
+
+ ChangeColorHdl_Impl( this );
+ SelectColorModelHdl_Impl( this );
+
+ aCtlPreviewOld.Invalidate();
+
+ // Status der Buttons ermitteln
+ if( pColorTab->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnWorkOn.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ else
+ {
+ aBtnModify.Disable();
+ aBtnWorkOn.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxColorTabPage::Create( Window* pWindow,
+ const SfxItemSet& rOutAttrs )
+{
+ return( new SvxColorTabPage( pWindow, rOutAttrs ) );
+}
+
+//------------------------------------------------------------------------
+
+//
+// Wird aufgerufen, wenn Inhalt der MtrFileds f�r Farbwerte ver�ndert wird
+//
+IMPL_LINK( SvxColorTabPage, ModifiedHdl_Impl, void *, EMPTYARG )
+{
+ // lese aktuelle MtrFields aus, wenn cmyk, dann k-Wert als Trans.-Farbe
+ aAktuellColor.SetColor ( Color( (UINT8)PercentToColor_Impl( (USHORT) aMtrFldColorModel4.GetValue() ),
+ (UINT8)PercentToColor_Impl( (USHORT) aMtrFldColorModel1.GetValue() ),
+ (UINT8)PercentToColor_Impl( (USHORT) aMtrFldColorModel2.GetValue() ),
+ (UINT8)PercentToColor_Impl( (USHORT) aMtrFldColorModel3.GetValue() ) ).GetColor() );
+
+ Color aTmpColor(aAktuellColor);
+ if (eCM != CM_RGB)
+ ConvertColorValues (aTmpColor, CM_RGB);
+
+ rXFSet.Put( XFillColorItem( String(), aTmpColor ) );
+ aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aCtlPreviewNew.Invalidate();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+//
+// Button 'Hinzuf�gen'
+//
+IMPL_LINK( SvxColorTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
+{
+ Window *pWindow = this;
+ bool bEnabled;
+ while( pWindow )
+ {
+ bEnabled = pWindow->IsEnabled();
+ pWindow = pWindow->GetParent();
+ }
+
+ ResMgr& rMgr = DIALOG_MGR();
+ String aDesc( ResId( RID_SVXSTR_DESC_COLOR, rMgr ) );
+ String aName( aEdtName.GetText() );
+ XColorEntry* pEntry;
+ long nCount = pColorTab->Count();
+ BOOL bDifferent = TRUE;
+
+ // Pruefen, ob Name schon vorhanden ist
+ for ( long i = 0; i < nCount && bDifferent; i++ )
+ if ( aName == pColorTab->GetColor( i )->GetName() )
+ bDifferent = FALSE;
+
+ // Wenn ja, wird wiederholt ein neuer Name angefordert
+ if ( !bDifferent )
+ {
+ WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ),
+ String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+ aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
+ aWarningBox.Execute();
+
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ BOOL bLoop = TRUE;
+
+ while ( !bDifferent && bLoop && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ {
+ if( aName == pColorTab->GetColor( i )->GetName() )
+ bDifferent = FALSE;
+ }
+
+ if( bDifferent )
+ bLoop = FALSE;
+ else
+ aWarningBox.Execute();
+ }
+ delete( pDlg );
+ }
+
+ // Wenn nicht vorhanden, wird Eintrag aufgenommen
+ if( bDifferent )
+ {
+ if (eCM != CM_RGB)
+ ConvertColorValues (aAktuellColor, CM_RGB);
+ pEntry = new XColorEntry( aAktuellColor, aName );
+
+ pColorTab->Insert( pColorTab->Count(), pEntry );
+
+ aLbColor.Append( pEntry );
+ aValSetColorTable.InsertItem( aValSetColorTable.GetItemCount() + 1,
+ pEntry->GetColor(), pEntry->GetName() );
+
+ aLbColor.SelectEntryPos( aLbColor.GetEntryCount() - 1 );
+
+ // Flag fuer modifiziert setzen
+ *pnColorTableState |= CT_MODIFIED;
+
+ SelectColorLBHdl_Impl( this );
+ }
+ // Status der Buttons ermitteln
+ if( pColorTab->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnWorkOn.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+//
+// Button '�ndern'
+//
+IMPL_LINK( SvxColorTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbColor.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ ResMgr& rMgr = DIALOG_MGR();
+ String aDesc( ResId( RID_SVXSTR_DESC_COLOR, rMgr ) );
+ String aName( aEdtName.GetText() );
+ long nCount = pColorTab->Count();
+ BOOL bDifferent = TRUE;
+
+ // Pruefen, ob Name schon vorhanden ist
+ for ( long i = 0; i < nCount && bDifferent; i++ )
+ if ( aName == pColorTab->GetColor( i )->GetName() && nPos != i )
+ bDifferent = FALSE;
+
+ // Wenn ja, wird wiederholt ein neuer Name angefordert
+ if ( !bDifferent )
+ {
+ WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ),
+ String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+ aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
+ aWarningBox.Execute();
+
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ BOOL bLoop = TRUE;
+
+ while ( !bDifferent && bLoop && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+ bDifferent = TRUE;
+
+ for ( long i = 0; i < nCount && bDifferent; i++ )
+ if( aName == pColorTab->GetColor( i )->GetName() && nPos != i )
+ bDifferent = FALSE;
+
+ if( bDifferent )
+ bLoop = FALSE;
+ else
+ aWarningBox.Execute();
+ }
+ delete( pDlg );
+ }
+
+ // Wenn nicht vorhanden, wird Eintrag aufgenommen
+ if( bDifferent )
+ {
+ XColorEntry* pEntry = pColorTab->GetColor( nPos );
+
+ Color aTmpColor (aAktuellColor);
+ if (eCM != CM_RGB)
+ ConvertColorValues (aTmpColor, CM_RGB);
+
+ pEntry->SetColor( aTmpColor );
+ pEntry->SetName( aName );
+
+ aLbColor.Modify( pEntry, nPos );
+ aLbColor.SelectEntryPos( nPos );
+ /////
+ aValSetColorTable.SetItemColor( nPos + 1, pEntry->GetColor() );
+ aValSetColorTable.SetItemText( nPos + 1, pEntry->GetName() );
+ aEdtName.SetText( aName );
+
+ aCtlPreviewOld.Invalidate();
+
+ // Flag fuer modifiziert setzen
+ *pnColorTableState |= CT_MODIFIED;
+ }
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+//
+// Button 'Bearbeiten'
+//
+IMPL_LINK( SvxColorTabPage, ClickWorkOnHdl_Impl, void *, EMPTYARG )
+{
+ SvColorDialog* pColorDlg = new SvColorDialog( DLGWIN );
+
+ Color aTmpColor (aAktuellColor);
+ if (eCM != CM_RGB)
+ ConvertColorValues (aTmpColor, CM_RGB);
+
+ pColorDlg->SetColor (aTmpColor);
+
+ if( pColorDlg->Execute() == RET_OK )
+ {
+ USHORT nK = 0;
+ Color aPreviewColor = pColorDlg->GetColor();
+ aAktuellColor = aPreviewColor;
+ if (eCM != CM_RGB)
+ ConvertColorValues (aAktuellColor, eCM);
+
+ aMtrFldColorModel1.SetValue( ColorToPercent_Impl( aAktuellColor.GetRed() ) );
+ aMtrFldColorModel2.SetValue( ColorToPercent_Impl( aAktuellColor.GetGreen() ) );
+ aMtrFldColorModel3.SetValue( ColorToPercent_Impl( aAktuellColor.GetBlue() ) );
+ aMtrFldColorModel4.SetValue( ColorToPercent_Impl( nK ) );
+
+ // ItemSet fuellen und an XOut weiterleiten
+ rXFSet.Put( XFillColorItem( String(), aPreviewColor ) );
+ //aCtlPreviewOld.SetAttributes( aXFillAttr );
+ aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aCtlPreviewNew.Invalidate();
+ }
+ delete( pColorDlg );
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+//
+// Button 'Loeschen'
+//
+IMPL_LINK( SvxColorTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbColor.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+ String( SVX_RES( RID_SVXSTR_ASK_DEL_COLOR ) ) );
+
+ if( aQueryBox.Execute() == RET_YES )
+ {
+ // Jetzt wird richtig geloescht
+ ULONG nCount = pColorTab->Count() - 1;
+ XColorEntry* pEntry;
+
+ pEntry = pColorTab->Remove( nPos );
+ DBG_ASSERT( pEntry, "ColorEntry nicht vorhanden (1) !" );
+ delete pEntry;
+
+ for( ULONG i = nPos; i < nCount; i++ )
+ {
+ pEntry = pColorTab->Remove( i + 1 );
+ DBG_ASSERT( pEntry, "ColorEntry nicht vorhanden (2) !" );
+ pColorTab->Insert( i, pEntry );
+ }
+
+ // Listbox und ValueSet aktualisieren
+ aLbColor.RemoveEntry( nPos );
+ aValSetColorTable.Clear();
+ FillValueSet_Impl( aValSetColorTable );
+
+ // Positionieren
+ aLbColor.SelectEntryPos( nPos );
+ SelectColorLBHdl_Impl( this );
+
+ aCtlPreviewOld.Invalidate();
+
+ // Flag fuer modifiziert setzen
+ *pnColorTableState |= CT_MODIFIED;
+ }
+ }
+ // Status der Buttons ermitteln
+ if( !pColorTab->Count() )
+ {
+ aBtnModify.Disable();
+ aBtnWorkOn.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+//
+// Button 'Farbtabelle laden'
+//
+IMPL_LINK( SvxColorTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
+{
+ ResMgr& rMgr = DIALOG_MGR();
+ USHORT nReturn = RET_YES;
+
+ if( *pnColorTableState & CT_MODIFIED )
+ {
+ nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
+ String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
+
+ if ( nReturn == RET_YES )
+ pColorTab->Save();
+ }
+
+ if ( nReturn != RET_CANCEL )
+ {
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soc" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+ INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aDlg.GetPath() );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ // Tabelle speichern
+ XColorTable* pColTab = new XColorTable( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool );
+ pColTab->SetName( aURL.getName() ); // XXX
+ if( pColTab->Load() )
+ {
+ if( pColTab )
+ {
+ // Pruefen, ob Tabelle geloescht werden darf:
+ const XColorTable *pTempTable = 0;
+ SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( DLGWIN );
+ SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( DLGWIN );
+ if( pArea )
+ {
+ pTempTable = pArea->GetColorTable();
+ }
+ else if( pLine )
+ {
+ pTempTable = pLine->GetColorTable();
+ }
+
+ if( pColorTab != pTempTable )
+ {
+ if( bDeleteColorTable )
+ delete pColorTab;
+ else
+ bDeleteColorTable = TRUE;
+ }
+
+ pColorTab = pColTab;
+ if( pArea )
+ {
+ pArea->SetNewColorTable( pColorTab );
+ }
+ else if( pLine )
+ {
+ pLine->SetNewColorTable( pColorTab );
+ }
+
+ aLbColor.Clear();
+ aValSetColorTable.Clear();
+ Construct();
+ Reset( rOutAttrs );
+
+ pColorTab->SetName( aURL.getName() );
+
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ aTableNameFT.SetText( aString );
+
+ // Flag fuer gewechselt setzen
+ *pnColorTableState |= CT_CHANGED;
+ // Flag fuer modifiziert entfernen
+ *pnColorTableState &= ~CT_MODIFIED;
+
+ if( aLbColor.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
+ aLbColor.SelectEntryPos( 0 );
+ else
+ aLbColor.SelectEntryPos( aLbColor.GetSelectEntryPos() );
+
+ ChangeColorHdl_Impl( this );
+ SelectColorLBHdl_Impl( this );
+ }
+ }
+ else
+ {
+ //aIStream.Close();
+ ErrorBox aErrorBox( DLGWIN, WinBits( WB_OK ),
+ String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) );
+ aErrorBox.Execute();
+ }
+ }
+ }
+
+ // Status der Buttons ermitteln
+ if ( pColorTab->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnWorkOn.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ else
+ {
+ aBtnModify.Disable();
+ aBtnWorkOn.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+//
+// Button 'Farbtabelle speichern'
+//
+IMPL_LINK( SvxColorTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
+{
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soc" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+
+ INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+ DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( pColorTab->GetName().Len() )
+ {
+ aFile.Append( pColorTab->GetName() );
+
+ if( !aFile.getExtension().getLength() )
+ aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soc" ) ) );
+ }
+
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aDlg.GetPath() );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ pColorTab->SetName( aURL.getName() );
+ pColorTab->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if( pColorTab->Save() )
+ {
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+ aTableNameFT.SetText( aString );
+
+ // Flag fuer gespeichert setzen
+ *pnColorTableState |= CT_SAVED;
+ // Flag fuer modifiziert entfernen
+ *pnColorTableState &= ~CT_MODIFIED;
+ }
+ else
+ {
+ ErrorBox aErrorBox( DLGWIN, WinBits( WB_OK ),
+ String( SVX_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) );
+ aErrorBox.Execute();
+ }
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxColorTabPage, SelectColorLBHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbColor.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aValSetColorTable.SelectItem( nPos + 1 );
+ aEdtName.SetText( aLbColor.GetSelectEntry() );
+
+ rXFSet.Put( XFillColorItem( String(),
+ aLbColor.GetSelectEntryColor() ) );
+ aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aCtlPreviewOld.Invalidate();
+ aCtlPreviewNew.Invalidate();
+
+ ChangeColorHdl_Impl( this );
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxColorTabPage, SelectValSetHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aValSetColorTable.GetSelectItemId();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aLbColor.SelectEntryPos( nPos - 1 );
+ aEdtName.SetText( aLbColor.GetSelectEntry() );
+
+ rXFSet.Put( XFillColorItem( String(),
+ aLbColor.GetSelectEntryColor() ) );
+ aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aCtlPreviewOld.Invalidate();
+ aCtlPreviewNew.Invalidate();
+
+ ChangeColorHdl_Impl( this );
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+//
+// Farbwerte je nach �bergebenes Farbmodell umrechnen
+//
+void SvxColorTabPage::ConvertColorValues (Color& rColor, ColorModel eModell)
+{
+ switch (eModell)
+ {
+ case CM_RGB:
+ {
+ CmykToRgb_Impl (rColor, (USHORT)rColor.GetTransparency() );
+ rColor.SetTransparency ((UINT8) 0);
+ }
+ break;
+
+ case CM_CMYK:
+ {
+ USHORT nK;
+ RgbToCmyk_Impl (rColor, nK );
+ rColor.SetTransparency ((UINT8) nK);
+ }
+ break;
+ }
+}
+
+//
+// Auswahl Listbox 'Farbmodell' (RGB/CMY)
+//
+IMPL_LINK( SvxColorTabPage, SelectColorModelHdl_Impl, void *, EMPTYARG )
+{
+ int nPos = aLbColorModel.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ if (eCM != (ColorModel) nPos)
+ {
+ // wenn Farbmodell geaendert wurde, dann Werte umrechnen
+ ConvertColorValues (aAktuellColor, (ColorModel) nPos);
+ }
+
+ eCM = (ColorModel) nPos;
+
+ switch( eCM )
+ {
+ case CM_RGB:
+ {
+ String aStr( aLbColorModel.GetSelectEntry() );
+ String aColorStr( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "~X" ) ) );
+ xub_StrLen nIdx = 1;
+ aColorStr.SetChar( nIdx, aStr.GetChar( 0 ) );
+ aFtColorModel1.SetText( aColorStr );
+ aColorStr.SetChar( nIdx, aStr.GetChar( 1 ) );
+ aFtColorModel2.SetText( aColorStr );
+ aColorStr.SetChar( nIdx, aStr.GetChar( 2 ) );
+ aFtColorModel3.SetText( aColorStr );
+
+ aFtColorModel4.Hide();
+ aMtrFldColorModel4.Hide();
+ aMtrFldColorModel4.SetValue( 0L );
+
+ aMtrFldColorModel1.SetHelpId( HID_TPCOLOR_RGB_1 );
+ aMtrFldColorModel2.SetHelpId( HID_TPCOLOR_RGB_2 );
+ aMtrFldColorModel3.SetHelpId( HID_TPCOLOR_RGB_3 );
+
+ // Da der alte HelpText noch am Control steht wuerde
+ // ein Umsetzen der HelpID alleine nichts bewirken
+ aMtrFldColorModel1.SetHelpText( String() );
+ aMtrFldColorModel2.SetHelpText( String() );
+ aMtrFldColorModel3.SetHelpText( String() );
+
+ // RGB-Werte im Bereich 0..255 verarbeiten (nicht in %),
+ // dazu MetricField's entsprechend einstellen
+ aMtrFldColorModel1.SetUnit(FUNIT_NONE);
+ aMtrFldColorModel1.SetMin(0);
+ aMtrFldColorModel1.SetMax(255);
+ aMtrFldColorModel1.SetLast(255);
+
+ aMtrFldColorModel2.SetUnit(FUNIT_NONE);
+ aMtrFldColorModel2.SetMin(0);
+ aMtrFldColorModel2.SetMax(255);
+ aMtrFldColorModel2.SetLast(255);
+
+ aMtrFldColorModel3.SetUnit(FUNIT_NONE);
+ aMtrFldColorModel3.SetMin(0);
+ aMtrFldColorModel3.SetMax(255);
+ aMtrFldColorModel3.SetLast(255);
+ }
+ break;
+
+ case CM_CMYK:
+ {
+ String aStr( aLbColorModel.GetSelectEntry() );
+ String aColorStr( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "~X" ) ) );
+ xub_StrLen nIdx = 1;
+ aColorStr.SetChar( nIdx, aStr.GetChar( 0 ) );
+ aFtColorModel1.SetText( aColorStr );
+ aColorStr.SetChar( nIdx, aStr.GetChar( 1 ) );
+ aFtColorModel2.SetText( aColorStr );
+ aColorStr.SetChar( nIdx,aStr.GetChar( 2 ) );
+ aFtColorModel3.SetText( aColorStr );
+ aColorStr.SetChar( nIdx,aStr.GetChar( 3 ) );
+ aFtColorModel4.SetText( aColorStr );
+
+ aFtColorModel4.Show();
+ aMtrFldColorModel4.Show();
+
+ aMtrFldColorModel1.SetHelpId( HID_TPCOLOR_CMYK_1 );
+ aMtrFldColorModel2.SetHelpId( HID_TPCOLOR_CMYK_2 );
+ aMtrFldColorModel3.SetHelpId( HID_TPCOLOR_CMYK_3 );
+
+ // s.o.
+ aMtrFldColorModel1.SetHelpText( String() );
+ aMtrFldColorModel2.SetHelpText( String() );
+ aMtrFldColorModel3.SetHelpText( String() );
+
+ // CMYK-Werte im Bereich 0..100% verarbeiten,
+ // dazu MetricField's entsprechend einstellen
+ String aStrUnit( RTL_CONSTASCII_USTRINGPARAM( " %" ) );
+
+ aMtrFldColorModel1.SetUnit(FUNIT_CUSTOM);
+ aMtrFldColorModel1.SetCustomUnitText( aStrUnit );
+ aMtrFldColorModel1.SetMin(0);
+ aMtrFldColorModel1.SetMax(100);
+ aMtrFldColorModel1.SetLast(100);
+
+ aMtrFldColorModel2.SetUnit(FUNIT_CUSTOM);
+ aMtrFldColorModel2.SetCustomUnitText( aStrUnit );
+ aMtrFldColorModel2.SetMin(0);
+ aMtrFldColorModel2.SetMax(100);
+ aMtrFldColorModel2.SetLast(100);
+
+ aMtrFldColorModel3.SetUnit(FUNIT_CUSTOM);
+ aMtrFldColorModel3.SetCustomUnitText( aStrUnit );
+ aMtrFldColorModel3.SetMin(0);
+ aMtrFldColorModel3.SetMax(100);
+ aMtrFldColorModel3.SetLast(100);
+ }
+ break;
+ }
+
+ aMtrFldColorModel1.SetValue( ColorToPercent_Impl( aAktuellColor.GetRed() ) );
+ aMtrFldColorModel2.SetValue( ColorToPercent_Impl( aAktuellColor.GetGreen() ) );
+ aMtrFldColorModel3.SetValue( ColorToPercent_Impl( aAktuellColor.GetBlue() ) );
+ aMtrFldColorModel4.SetValue( ColorToPercent_Impl( aAktuellColor.GetTransparency() ) );
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+long SvxColorTabPage::ChangeColorHdl_Impl( void* )
+{
+ int nPos = aLbColor.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ XColorEntry* pEntry = pColorTab->GetColor( nPos );
+
+ aAktuellColor.SetColor ( pEntry->GetColor().GetColor() );
+ if (eCM != CM_RGB)
+ ConvertColorValues (aAktuellColor, eCM);
+
+ aMtrFldColorModel1.SetValue( ColorToPercent_Impl( aAktuellColor.GetRed() ) );
+ aMtrFldColorModel2.SetValue( ColorToPercent_Impl( aAktuellColor.GetGreen() ) );
+ aMtrFldColorModel3.SetValue( ColorToPercent_Impl( aAktuellColor.GetBlue() ) );
+ aMtrFldColorModel4.SetValue( ColorToPercent_Impl( aAktuellColor.GetTransparency() ) );
+
+ // ItemSet fuellen und an XOut weiterleiten
+ rXFSet.Put( XFillColorItem( String(), pEntry->GetColor() ) );
+ aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aCtlPreviewNew.Invalidate();
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+void SvxColorTabPage::FillValueSet_Impl( ValueSet& rVs )
+{
+ long nCount = pColorTab->Count();
+ XColorEntry* pColorEntry;
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pColorEntry = pColorTab->GetColor( i );
+ rVs.InsertItem( (USHORT) i + 1, pColorEntry->GetColor(), pColorEntry->GetName() );
+ }
+}
+
+//------------------------------------------------------------------------
+
+// Ein RGB-Wert wird in einen CMYK-Wert konvertiert, wobei die Color-
+// Klasse vergewaltigt wird, da R in C, G in M und B in Y umgewandelt
+// wird. Der Wert K wird in einer Extra-Variablen gehalten.
+// Bei weiteren Farbmodellen sollte man hierfuer eigene Klassen entwickeln,
+// die dann auch entsprechende Casts enthalten.
+
+void SvxColorTabPage::RgbToCmyk_Impl( Color& rColor, USHORT& rK )
+{
+ USHORT nColor1, nColor2, nColor3;
+ USHORT nProzent; // nur temporaer !!!
+
+ nColor1 = 255 - rColor.GetRed();
+ nProzent = ColorToPercent_Impl( nColor1 );
+
+ nColor2 = 255 - rColor.GetGreen();
+ nProzent = ColorToPercent_Impl( nColor2 );
+
+ nColor3 = 255 - rColor.GetBlue();
+ nProzent = ColorToPercent_Impl( nColor3 );
+
+ rK = Min( Min( nColor1, nColor2 ), nColor3 );
+
+ rColor.SetRed( sal::static_int_cast< UINT8 >( nColor1 - rK ) );
+ rColor.SetGreen( sal::static_int_cast< UINT8 >( nColor2 - rK ) );
+ rColor.SetBlue( sal::static_int_cast< UINT8 >( nColor3 - rK ) );
+}
+
+//------------------------------------------------------------------------
+
+// Umgekehrter Fall zu RgbToCmyk_Impl (s.o.)
+
+void SvxColorTabPage::CmykToRgb_Impl( Color& rColor, const USHORT nK )
+{
+ long lTemp;
+
+ lTemp = 255 - ( rColor.GetRed() + nK );
+
+ if( lTemp < 0L )
+ lTemp = 0L;
+ rColor.SetRed( (BYTE)lTemp );
+
+ lTemp = 255 - ( rColor.GetGreen() + nK );
+
+ if( lTemp < 0L )
+ lTemp = 0L;
+ rColor.SetGreen( (BYTE)lTemp );
+
+ lTemp = 255 - ( rColor.GetBlue() + nK );
+
+ if( lTemp < 0L )
+ lTemp = 0L;
+ rColor.SetBlue( (BYTE)lTemp );
+}
+
+//------------------------------------------------------------------------
+
+USHORT SvxColorTabPage::ColorToPercent_Impl( USHORT nColor )
+{
+ USHORT nWert = 0;
+
+ switch (eCM)
+ {
+ case CM_RGB :
+ nWert = nColor;
+ break;
+
+ case CM_CMYK:
+ nWert = (USHORT) ( (double) nColor * 100.0 / 255.0 + 0.5 );
+ break;
+ }
+
+ return ( nWert );
+}
+
+//------------------------------------------------------------------------
+
+USHORT SvxColorTabPage::PercentToColor_Impl( USHORT nPercent )
+{
+ USHORT nWert = 0;
+
+ switch (eCM)
+ {
+ case CM_RGB :
+ nWert = nPercent;
+ break;
+
+ case CM_CMYK:
+ nWert = (USHORT) ( (double) nPercent * 255.0 / 100.0 + 0.5 );
+ break;
+ }
+
+ return ( nWert );
+}
+
+//------------------------------------------------------------------------
+
+void SvxColorTabPage::FillUserData()
+{
+ // Das Farbmodell wird in der Ini-Datei festgehalten
+ SetUserData( UniString::CreateFromInt32( eCM ) );
+}
+
+
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
new file mode 100644
index 000000000000..02e7be1bde3b
--- /dev/null
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -0,0 +1,943 @@
+/*************************************************************************
+ *
+ * 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: tpgradnt.cxx,v $
+ * $Revision: 1.26 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <vcl/wrkwin.hxx>
+#include <tools/shl.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+
+#define _SVX_TPGRADNT_CXX
+
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "svx/xattr.hxx"
+#include <svx/xtable.hxx>
+#include <svx/xpool.hxx>
+#include "svx/drawitem.hxx"
+#include "cuitabarea.hxx"
+#include "tabarea.hrc"
+#include "defdlgname.hxx" //CHINA001 #include "dlgname.hxx"
+//#include "dlgname.hrc"
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialmgr.hxx>
+
+#define DLGWIN this->GetParent()->GetParent()
+
+#define BITMAP_WIDTH 32
+#define BITMAP_HEIGHT 12
+
+/*************************************************************************
+|*
+|* Dialog zum Aendern und Definieren der Farbverlaeufe
+|*
+\************************************************************************/
+
+SvxGradientTabPage::SvxGradientTabPage
+(
+ Window* pParent,
+ const SfxItemSet& rInAttrs
+) :
+ SfxTabPage ( pParent, SVX_RES( RID_SVXPAGE_GRADIENT ), rInAttrs ),
+
+ aFlProp ( this, SVX_RES( FL_PROP ) ),
+ aFtType ( this, SVX_RES( FT_TYPE ) ),
+ aLbGradientType ( this, SVX_RES( LB_GRADIENT_TYPES ) ),
+ aFtCenterX ( this, SVX_RES( FT_CENTER_X ) ),
+ aMtrCenterX ( this, SVX_RES( MTR_CENTER_X ) ),
+ aFtCenterY ( this, SVX_RES( FT_CENTER_Y ) ),
+ aMtrCenterY ( this, SVX_RES( MTR_CENTER_Y ) ),
+ aFtAngle ( this, SVX_RES( FT_ANGLE ) ),
+ aMtrAngle ( this, SVX_RES( MTR_ANGLE ) ),
+ aFtBorder ( this, SVX_RES( FT_BORDER ) ),
+ aMtrBorder ( this, SVX_RES( MTR_BORDER ) ),
+ aFtColorFrom ( this, SVX_RES( FT_COLOR_FROM ) ),
+ aLbColorFrom ( this, SVX_RES( LB_COLOR_FROM ) ),
+ aMtrColorFrom ( this, SVX_RES( MTR_COLOR_FROM ) ),
+ aFtColorTo ( this, SVX_RES( FT_COLOR_TO ) ),
+ aLbColorTo ( this, SVX_RES( LB_COLOR_TO ) ),
+ aMtrColorTo ( this, SVX_RES( MTR_COLOR_TO ) ),
+ aLbGradients ( this, SVX_RES( LB_GRADIENTS ) ),
+ aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ),
+ aBtnAdd ( this, SVX_RES( BTN_ADD ) ),
+ aBtnModify ( this, SVX_RES( BTN_MODIFY ) ),
+ aBtnDelete ( this, SVX_RES( BTN_DELETE ) ),
+ aBtnLoad ( this, SVX_RES( BTN_LOAD ) ),
+ aBtnSave ( this, SVX_RES( BTN_SAVE ) ),
+
+ rOutAttrs ( rInAttrs ),
+
+ pColorTab( NULL ),
+ pGradientList( NULL ),
+
+ pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
+ aXFStyleItem ( XFILL_GRADIENT ),
+ aXGradientItem ( String(), XGradient( COL_BLACK, COL_WHITE ) ),
+ aXFillAttr ( pXPool ),
+ rXFSet ( aXFillAttr.GetItemSet() )
+{
+ aBtnLoad.SetModeImage( Image( SVX_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST );
+ aBtnSave.SetModeImage( Image( SVX_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST );
+
+ FreeResource();
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ // Solange NICHT vom Item unterstuetzt
+
+ //aMtrColorTo.Disable();
+ aMtrColorTo.SetValue( 100 );
+ //aMtrColorFrom.Disable();
+ aMtrColorFrom.SetValue( 100 );
+
+ // Setzen des Output-Devices
+ rXFSet.Put( aXFStyleItem );
+ rXFSet.Put( aXGradientItem );
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+
+ // Handler ueberladen
+ aLbGradients.SetSelectHdl(
+ LINK( this, SvxGradientTabPage, ChangeGradientHdl_Impl ) );
+ aBtnAdd.SetClickHdl( LINK( this, SvxGradientTabPage, ClickAddHdl_Impl ) );
+ aBtnModify.SetClickHdl(
+ LINK( this, SvxGradientTabPage, ClickModifyHdl_Impl ) );
+ aBtnDelete.SetClickHdl(
+ LINK( this, SvxGradientTabPage, ClickDeleteHdl_Impl ) );
+
+ Link aLink = LINK( this, SvxGradientTabPage, ModifiedHdl_Impl );
+ aLbGradientType.SetSelectHdl( aLink );
+ aMtrCenterX.SetModifyHdl( aLink );
+ aMtrCenterY.SetModifyHdl( aLink );
+ aMtrAngle.SetModifyHdl( aLink );
+ aMtrBorder.SetModifyHdl( aLink );
+ aMtrColorFrom.SetModifyHdl( aLink );
+ aLbColorFrom.SetSelectHdl( aLink );
+ aMtrColorTo.SetModifyHdl( aLink );
+ aLbColorTo.SetSelectHdl( aLink );
+
+ aBtnLoad.SetClickHdl(
+ LINK( this, SvxGradientTabPage, ClickLoadHdl_Impl ) );
+ aBtnSave.SetClickHdl(
+ LINK( this, SvxGradientTabPage, ClickSaveHdl_Impl ) );
+
+ // #i76307# always paint the preview in LTR, because this is what the document does
+ aCtlPreview.EnableRTL( FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxGradientTabPage::Construct()
+{
+ // Farbtabelle
+ aLbColorFrom.Fill( pColorTab );
+ aLbColorTo.CopyEntries( aLbColorFrom );
+
+ // Farbverlauftabelle
+ aLbGradients.Fill( pGradientList );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxGradientTabPage::ActivatePage( const SfxItemSet& )
+{
+ USHORT nPos;
+ USHORT nCount;
+
+ if( *pDlgType == 0 ) // Flaechen-Dialog
+ {
+ *pbAreaTP = FALSE;
+
+ if( pColorTab )
+ {
+ // ColorTable
+ if( *pnColorTableState & CT_CHANGED ||
+ *pnColorTableState & CT_MODIFIED )
+ {
+ if( *pnColorTableState & CT_CHANGED )
+ pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable();
+
+ // LbColorFrom
+ nPos = aLbColorFrom.GetSelectEntryPos();
+ aLbColorFrom.Clear();
+ aLbColorFrom.Fill( pColorTab );
+ nCount = aLbColorFrom.GetEntryCount();
+ if( nCount == 0 )
+ ; // Dieser Fall sollte nicht auftreten
+ else if( nCount <= nPos )
+ aLbColorFrom.SelectEntryPos( 0 );
+ else
+ aLbColorFrom.SelectEntryPos( nPos );
+
+ // LbColorTo
+ nPos = aLbColorTo.GetSelectEntryPos();
+ aLbColorTo.Clear();
+ aLbColorTo.CopyEntries( aLbColorFrom );
+ nCount = aLbColorTo.GetEntryCount();
+ if( nCount == 0 )
+ ; // Dieser Fall sollte nicht auftreten
+ else if( nCount <= nPos )
+ aLbColorTo.SelectEntryPos( 0 );
+ else
+ aLbColorTo.SelectEntryPos( nPos );
+
+ ModifiedHdl_Impl( this );
+ }
+
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ INetURLObject aURL( pGradientList->GetPath() );
+
+ aURL.Append( pGradientList->GetName() );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if ( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ if ( *pPageType == PT_GRADIENT && *pPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aLbGradients.SelectEntryPos( *pPos );
+ }
+ // Farben koennten geloescht worden sein
+ ChangeGradientHdl_Impl( this );
+
+ *pPageType = PT_GRADIENT;
+ *pPos = LISTBOX_ENTRY_NOTFOUND;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SvxGradientTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if( CheckChanges_Impl() == -1L )
+ return KEEP_PAGE;
+
+ if( _pSet )
+ FillItemSet( *_pSet );
+
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+long SvxGradientTabPage::CheckChanges_Impl()
+{
+ // wird hier benutzt, um Aenderungen NICHT zu verlieren
+ XGradient aTmpGradient( aLbColorFrom.GetSelectEntryColor(),
+ aLbColorTo.GetSelectEntryColor(),
+ (XGradientStyle) aLbGradientType.GetSelectEntryPos(),
+ static_cast<long>(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden
+ (USHORT) aMtrCenterX.GetValue(),
+ (USHORT) aMtrCenterY.GetValue(),
+ (USHORT) aMtrBorder.GetValue(),
+ (USHORT) aMtrColorFrom.GetValue(),
+ (USHORT) aMtrColorTo.GetValue() );
+
+ USHORT nPos = aLbGradients.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ XGradient aGradient = pGradientList->GetGradient( nPos )->GetGradient();
+ String aString = aLbGradients.GetSelectEntry();
+
+ if( !( aTmpGradient == aGradient ) )
+ {
+ ResMgr& rMgr = DIALOG_MGR();
+ Image aWarningBoxImage = WarningBox::GetStandardImage();
+ //CHINA001 SvxMessDialog aMessDlg( DLGWIN,
+ //CHINA001 String( ResId( RID_SVXSTR_GRADIENT, rMgr ) ),
+ //CHINA001 String( ResId( RID_SVXSTR_ASK_CHANGE_GRADIENT, rMgr ) ),
+ //CHINA001 &aWarningBoxImage );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX,
+ String( ResId( RID_SVXSTR_GRADIENT, rMgr ) ),
+ String( ResId( RID_SVXSTR_ASK_CHANGE_GRADIENT, rMgr ) ),
+ &aWarningBoxImage );
+ DBG_ASSERT(aMessDlg, "Dialogdiet fail!");//CHINA001
+ aMessDlg->SetButtonText( MESS_BTN_1, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_1,
+ String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
+ aMessDlg->SetButtonText( MESS_BTN_2, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_2,
+ String( ResId( RID_SVXSTR_ADD, rMgr ) ) );
+
+ short nRet = aMessDlg->Execute(); //CHINA001 short nRet = aMessDlg.Execute();
+
+ switch( nRet )
+ {
+ case RET_BTN_1: // Aendern
+ {
+ ClickModifyHdl_Impl( this );
+ aGradient = pGradientList->GetGradient( nPos )->GetGradient();
+ }
+ break;
+
+ case RET_BTN_2: // Hinzufuegen
+ {
+ ClickAddHdl_Impl( this );
+ nPos = aLbGradients.GetSelectEntryPos();
+ aGradient = pGradientList->GetGradient( nPos )->GetGradient();
+ }
+ break;
+
+ case RET_CANCEL:
+ // return( -1L ); <-- wuerde die Seite nicht verlassen
+ break;
+ // return( TRUE ); // Abbruch
+ }
+ delete aMessDlg; //add by CHINA001
+ }
+ }
+ nPos = aLbGradients.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ *pPos = nPos;
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxGradientTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ if( *pDlgType == 0 && *pPageType == PT_GRADIENT && *pbAreaTP == FALSE )
+ {
+ // CheckChanges(); <-- doppelte Abfrage ?
+
+ XGradient* pXGradient = NULL;
+ String aString;
+ USHORT nPos = aLbGradients.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ pXGradient = new XGradient( pGradientList->GetGradient( nPos )->GetGradient() );
+ aString = aLbGradients.GetSelectEntry();
+
+ }
+ else
+ // Farbverlauf wurde (unbekannt) uebergeben
+ {
+ pXGradient = new XGradient( aLbColorFrom.GetSelectEntryColor(),
+ aLbColorTo.GetSelectEntryColor(),
+ (XGradientStyle) aLbGradientType.GetSelectEntryPos(),
+ static_cast<long>(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden
+ (USHORT) aMtrCenterX.GetValue(),
+ (USHORT) aMtrCenterY.GetValue(),
+ (USHORT) aMtrBorder.GetValue(),
+ (USHORT) aMtrColorFrom.GetValue(),
+ (USHORT) aMtrColorTo.GetValue() );
+ }
+ DBG_ASSERT( pXGradient, "XGradient konnte nicht erzeugt werden" );
+ rSet.Put( XFillStyleItem( XFILL_GRADIENT ) );
+ rSet.Put( XFillGradientItem( aString, *pXGradient ) );
+
+ delete pXGradient;
+ }
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxGradientTabPage::Reset( const SfxItemSet& )
+{
+ // aLbGradients.SelectEntryPos( 0 );
+ ChangeGradientHdl_Impl( this );
+
+ // Status der Buttons ermitteln
+ if( pGradientList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ else
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxGradientTabPage::Create( Window* pWindow,
+ const SfxItemSet& rOutAttrs )
+{
+ return new SvxGradientTabPage( pWindow, rOutAttrs );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGradientTabPage, ModifiedHdl_Impl, void *, pControl )
+{
+ XGradientStyle eXGS = (XGradientStyle) aLbGradientType.GetSelectEntryPos();
+
+ XGradient aXGradient( aLbColorFrom.GetSelectEntryColor(),
+ aLbColorTo.GetSelectEntryColor(),
+ eXGS,
+ static_cast<long>(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden
+ (USHORT) aMtrCenterX.GetValue(),
+ (USHORT) aMtrCenterY.GetValue(),
+ (USHORT) aMtrBorder.GetValue(),
+ (USHORT) aMtrColorFrom.GetValue(),
+ (USHORT) aMtrColorTo.GetValue() );
+
+ // Enablen/Disablen von Controls
+ if( pControl == &aLbGradientType || pControl == this )
+ SetControlState_Impl( eXGS );
+
+ // Anzeigen im XOutDev
+ rXFSet.Put( XFillGradientItem( String(), aXGradient ) );
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aCtlPreview.Invalidate();
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGradientTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
+{
+ ResMgr& rMgr = DIALOG_MGR();
+ String aNewName( ResId( RID_SVXSTR_GRADIENT, rMgr ) );
+ String aDesc( ResId( RID_SVXSTR_DESC_GRADIENT, rMgr ) );
+ String aName;
+
+ long nCount = pGradientList->Count();
+ long j = 1;
+ BOOL bDifferent = FALSE;
+
+ while( !bDifferent )
+ {
+ aName = aNewName;
+ aName += sal_Unicode(' ');
+ aName += UniString::CreateFromInt32( j++ );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ if( aName == pGradientList->GetGradient( i )->GetName() )
+ bDifferent = FALSE;
+ }
+
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ WarningBox* pWarnBox = NULL;
+ USHORT nError = RID_SVXSTR_WARN_NAME_DUPLICATE;
+
+ while( pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ if( aName == pGradientList->GetGradient( i )->GetName() )
+ bDifferent = FALSE;
+
+ if( bDifferent )
+ {
+ nError = 0;
+ break;
+ }
+
+ if( !pWarnBox )
+ {
+ pWarnBox = new WarningBox( DLGWIN,
+ WinBits( WB_OK_CANCEL ),
+ String( ResId( nError, rMgr ) ) );
+ pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE );
+ }
+
+ if( pWarnBox->Execute() != RET_OK )
+ break;
+ }
+ //Rectangle aDlgRect( pDlg->GetPosPixel(), pDlg->GetSizePixel() );
+ delete pDlg;
+ delete pWarnBox;
+
+ if( !nError )
+ {
+ XGradient aXGradient( aLbColorFrom.GetSelectEntryColor(),
+ aLbColorTo.GetSelectEntryColor(),
+ (XGradientStyle) aLbGradientType.GetSelectEntryPos(),
+ static_cast<long>(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden
+ (USHORT) aMtrCenterX.GetValue(),
+ (USHORT) aMtrCenterY.GetValue(),
+ (USHORT) aMtrBorder.GetValue(),
+ (USHORT) aMtrColorFrom.GetValue(),
+ (USHORT) aMtrColorTo.GetValue() );
+ XGradientEntry* pEntry = new XGradientEntry( aXGradient, aName );
+
+ pGradientList->Insert( pEntry, nCount );
+
+ aLbGradients.Append( pEntry );
+
+ aLbGradients.SelectEntryPos( aLbGradients.GetEntryCount() - 1 );
+
+#ifdef WNT
+ // hack: #31355# W.P.
+ Rectangle aRect( aLbGradients.GetPosPixel(), aLbGradients.GetSizePixel() );
+ if( TRUE ) { // ??? overlapped with pDlg
+ // and srolling
+ Invalidate( aRect );
+ //aLbGradients.Invalidate();
+ }
+#endif
+
+ // Flag fuer modifiziert setzen
+ *pnGradientListState |= CT_MODIFIED;
+
+ ChangeGradientHdl_Impl( this );
+ }
+
+ // Status der Buttons ermitteln
+ if( pGradientList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGradientTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbGradients.GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ ResMgr& rMgr = DIALOG_MGR();
+ String aNewName( ResId( RID_SVXSTR_GRADIENT, rMgr ) );
+ String aDesc( ResId( RID_SVXSTR_DESC_GRADIENT, rMgr ) );
+ String aName( pGradientList->GetGradient( nPos )->GetName() );
+ String aOldName = aName;
+
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+
+ long nCount = pGradientList->Count();
+ BOOL bDifferent = FALSE;
+ BOOL bLoop = TRUE;
+
+ while( bLoop && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ {
+ if( aName == pGradientList->GetGradient( i )->GetName() &&
+ aName != aOldName )
+ bDifferent = FALSE;
+ }
+
+ if( bDifferent )
+ {
+ bLoop = FALSE;
+ XGradient aXGradient( aLbColorFrom.GetSelectEntryColor(),
+ aLbColorTo.GetSelectEntryColor(),
+ (XGradientStyle) aLbGradientType.GetSelectEntryPos(),
+ static_cast<long>(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden
+ (USHORT) aMtrCenterX.GetValue(),
+ (USHORT) aMtrCenterY.GetValue(),
+ (USHORT) aMtrBorder.GetValue(),
+ (USHORT) aMtrColorFrom.GetValue(),
+ (USHORT) aMtrColorTo.GetValue() );
+
+ XGradientEntry* pEntry = new XGradientEntry( aXGradient, aName );
+
+ delete pGradientList->Replace( pEntry, nPos );
+
+ aLbGradients.Modify( pEntry, nPos );
+
+ aLbGradients.SelectEntryPos( nPos );
+
+ // Flag fuer modifiziert setzen
+ *pnGradientListState |= CT_MODIFIED;
+ }
+ else
+ {
+ WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+ aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
+ aBox.Execute();
+ }
+
+ }
+ delete pDlg;
+ }
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGradientTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbGradients.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+//! SVX_RES( RID_SVXSTR_DEL_GRADIENT ),
+ String( SVX_RES( RID_SVXSTR_ASK_DEL_GRADIENT ) ) );
+
+ if ( aQueryBox.Execute() == RET_YES )
+ {
+ delete pGradientList->Remove( nPos );
+ aLbGradients.RemoveEntry( nPos );
+ aLbGradients.SelectEntryPos( 0 );
+
+ aCtlPreview.Invalidate();
+
+ ChangeGradientHdl_Impl( this );
+
+ // Flag fuer modifiziert setzen
+ *pnGradientListState |= CT_MODIFIED;
+ }
+ }
+ // Status der Buttons ermitteln
+ if( !pGradientList->Count() )
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxGradientTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
+{
+ ResMgr& rMgr = DIALOG_MGR();
+ USHORT nReturn = RET_YES;
+
+ if ( *pnGradientListState & CT_MODIFIED )
+ {
+ nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
+ String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
+
+ if ( nReturn == RET_YES )
+ pGradientList->Save();
+ }
+
+ if ( nReturn != RET_CANCEL )
+ {
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sog" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+ INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if( aDlg.Execute() == ERRCODE_NONE )
+ {
+ EnterWait();
+
+ INetURLObject aURL( aDlg.GetPath() );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ // Liste speichern
+ XGradientList* pGrdList = new XGradientList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool );
+ pGrdList->SetName( aURL.getName() );
+
+ if ( pGrdList->Load() )
+ {
+ if ( pGrdList )
+ {
+ // Pruefen, ob Tabelle geloescht werden darf:
+ if ( pGradientList !=
+ ( (SvxAreaTabDialog*) DLGWIN )->GetGradientList() )
+ delete pGradientList;
+
+ pGradientList = pGrdList;
+ ( (SvxAreaTabDialog*) DLGWIN )->
+ SetNewGradientList( pGradientList );
+
+ aLbGradients.Clear();
+ aLbGradients.Fill( pGradientList );
+ Reset( rOutAttrs );
+
+ pGradientList->SetName( aURL.getName() );
+
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ // Flag fuer gewechselt setzen
+ *pnGradientListState |= CT_CHANGED;
+ // Flag fuer modifiziert entfernen
+ *pnGradientListState &= ~CT_MODIFIED;
+ }
+ LeaveWait();
+ }
+ else
+ {
+ LeaveWait();
+ //aIStream.Close();
+ ErrorBox( DLGWIN, WinBits( WB_OK ),
+ String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
+ }
+ }
+ }
+
+ // Status der Buttons ermitteln
+ if( pGradientList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ else
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxGradientTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
+{
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sog" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+
+ INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+ DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( pGradientList->GetName().Len() )
+ {
+ aFile.Append( pGradientList->GetName() );
+
+ if( !aFile.getExtension().getLength() )
+ aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "sog" ) ) );
+ }
+
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aDlg.GetPath() );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ pGradientList->SetName( aURL.getName() );
+ pGradientList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if( pGradientList->Save() )
+ {
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ // Flag fuer gespeichert setzen
+ *pnGradientListState |= CT_SAVED;
+ // Flag fuer modifiziert entfernen
+ *pnGradientListState &= ~CT_MODIFIED;
+ }
+ else
+ {
+ ErrorBox( DLGWIN, WinBits( WB_OK ),
+ String( SVX_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
+ }
+ }
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGradientTabPage, ChangeGradientHdl_Impl, void *, EMPTYARG )
+{
+ XGradient* pGradient = NULL;
+ int nPos = aLbGradients.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ pGradient = new XGradient( ( (XGradientEntry*) pGradientList->GetGradient( nPos ) )->GetGradient() );
+ else
+ {
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), TRUE, &pPoolItem ) )
+ {
+ if( ( XFILL_GRADIENT == (XFillStyle) ( ( const XFillStyleItem* ) pPoolItem )->GetValue() ) &&
+ ( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), TRUE, &pPoolItem ) ) )
+ {
+ pGradient = new XGradient( ( ( const XFillGradientItem* ) pPoolItem )->GetGradientValue() );
+ }
+ }
+ if( !pGradient )
+ {
+ aLbGradients.SelectEntryPos( 0 );
+ nPos = aLbGradients.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ pGradient = new XGradient( ( (XGradientEntry*) pGradientList->GetGradient( nPos ) )->GetGradient() );
+ }
+ }
+
+ if( pGradient )
+ {
+ XGradientStyle eXGS = pGradient->GetGradientStyle();
+
+ aLbGradientType.SelectEntryPos(
+ sal::static_int_cast< USHORT >( eXGS ) );
+ // Wenn der EIntrag nicht in der Listbox ist, werden die Farben
+ // temporaer hinzugenommen
+ aLbColorFrom.SetNoSelection();
+ aLbColorFrom.SelectEntry( pGradient->GetStartColor() );
+
+ if ( aLbColorFrom.GetSelectEntryCount() == 0 )
+ {
+ aLbColorFrom.InsertEntry( pGradient->GetStartColor(),
+ String() );
+ aLbColorFrom.SelectEntry( pGradient->GetStartColor() );
+ }
+ aLbColorTo.SetNoSelection();
+ aLbColorTo.SelectEntry( pGradient->GetEndColor() );
+
+ if ( aLbColorTo.GetSelectEntryCount() == 0 )
+ {
+ aLbColorTo.InsertEntry( pGradient->GetEndColor(), String() );
+ aLbColorTo.SelectEntry( pGradient->GetEndColor() );
+ }
+
+ aMtrAngle.SetValue( pGradient->GetAngle() / 10 ); // sollte in Resource geaendert werden
+ aMtrBorder.SetValue( pGradient->GetBorder() );
+ aMtrCenterX.SetValue( pGradient->GetXOffset() );
+ aMtrCenterY.SetValue( pGradient->GetYOffset() );
+ aMtrColorFrom.SetValue( pGradient->GetStartIntens() );
+ aMtrColorTo.SetValue( pGradient->GetEndIntens() );
+
+ // Controls Disablen/Enablen
+ SetControlState_Impl( eXGS );
+
+ // ItemSet fuellen und an aCtlPreview weiterleiten
+ rXFSet.Put( XFillGradientItem( String(), *pGradient ) );
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aCtlPreview.Invalidate();
+ delete pGradient;
+ }
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+void SvxGradientTabPage::SetControlState_Impl( XGradientStyle eXGS )
+{
+ switch( eXGS )
+ {
+ case XGRAD_LINEAR:
+ case XGRAD_AXIAL:
+ aFtCenterX.Disable();
+ aMtrCenterX.Disable();
+ aFtCenterY.Disable();
+ aMtrCenterY.Disable();
+ aFtAngle.Enable();
+ aMtrAngle.Enable();
+ break;
+
+ case XGRAD_RADIAL:
+ aFtCenterX.Enable();
+ aMtrCenterX.Enable();
+ aFtCenterY.Enable();
+ aMtrCenterY.Enable();
+ aFtAngle.Disable();
+ aMtrAngle.Disable();
+ break;
+
+ case XGRAD_ELLIPTICAL:
+ aFtCenterX.Enable();
+ aMtrCenterX.Enable();
+ aFtCenterY.Enable();
+ aMtrCenterY.Enable();
+ aFtAngle.Enable();
+ aMtrAngle.Enable();
+ break;
+
+ case XGRAD_SQUARE:
+ case XGRAD_RECT:
+ aFtCenterX.Enable();
+ aMtrCenterX.Enable();
+ aFtCenterY.Enable();
+ aMtrCenterY.Enable();
+ aFtAngle.Enable();
+ aMtrAngle.Enable();
+ break;
+ }
+}
+
+
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
new file mode 100644
index 000000000000..f1ca099749cd
--- /dev/null
+++ b/cui/source/tabpages/tphatch.cxx
@@ -0,0 +1,901 @@
+/*************************************************************************
+ *
+ * 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: tphatch.cxx,v $
+ * $Revision: 1.29 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+
+#define _SVX_TPHATCH_CXX
+
+#include <svx/dialogs.hrc>
+#include "tabarea.hrc"
+//#include "dlgname.hrc"
+#include "helpid.hrc"
+#include "svx/xattr.hxx"
+#include <svx/xpool.hxx>
+#include <svx/xtable.hxx>
+#include "svx/drawitem.hxx"
+#include "cuitabarea.hxx"
+#include "defdlgname.hxx" //CHINA001 #include "dlgname.hxx"
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+
+#define DLGWIN this->GetParent()->GetParent()
+
+#define BITMAP_WIDTH 32
+#define BITMAP_HEIGHT 12
+
+/*************************************************************************
+|*
+|* Dialog zum Aendern und Definieren der Schraffuren
+|*
+\************************************************************************/
+
+SvxHatchTabPage::SvxHatchTabPage
+(
+ Window* pParent,
+ const SfxItemSet& rInAttrs
+) :
+
+ SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_HATCH ), rInAttrs ),
+
+ aFtDistance ( this, SVX_RES( FT_LINE_DISTANCE ) ),
+ aMtrDistance ( this, SVX_RES( MTR_FLD_DISTANCE ) ),
+ aFtAngle ( this, SVX_RES( FT_LINE_ANGLE ) ),
+ aMtrAngle ( this, SVX_RES( MTR_FLD_ANGLE ) ),
+ aCtlAngle ( this, SVX_RES( CTL_ANGLE ),
+ RP_RB, 200, 80, CS_ANGLE ),
+ aFlProp ( this, SVX_RES( FL_PROP ) ),
+ aFtLineType ( this, SVX_RES( FT_LINE_TYPE ) ),
+ aLbLineType ( this, SVX_RES( LB_LINE_TYPE ) ),
+ aFtLineColor ( this, SVX_RES( FT_LINE_COLOR ) ),
+ aLbLineColor ( this, SVX_RES( LB_LINE_COLOR ) ),
+ aLbHatchings ( this, SVX_RES( LB_HATCHINGS ) ),
+ aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ),
+ aBtnAdd ( this, SVX_RES( BTN_ADD ) ),
+ aBtnModify ( this, SVX_RES( BTN_MODIFY ) ),
+ aBtnDelete ( this, SVX_RES( BTN_DELETE ) ),
+ aBtnLoad ( this, SVX_RES( BTN_LOAD ) ),
+ aBtnSave ( this, SVX_RES( BTN_SAVE ) ),
+
+ rOutAttrs ( rInAttrs ),
+ pColorTab( NULL ),
+ pHatchingList( NULL ),
+
+ pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
+ aXFStyleItem ( XFILL_HATCH ),
+ aXHatchItem ( String(), XHatch() ),
+ aXFillAttr ( pXPool ),
+ rXFSet ( aXFillAttr.GetItemSet() )
+
+{
+ aBtnLoad.SetModeImage( Image( SVX_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST );
+ aBtnSave.SetModeImage( Image( SVX_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST );
+
+ FreeResource();
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ // Metrik einstellen
+ FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs );
+
+ switch ( eFUnit )
+ {
+ case FUNIT_M:
+ case FUNIT_KM:
+ eFUnit = FUNIT_MM;
+ break;
+ default: ;//prevent warning
+ }
+ SetFieldUnit( aMtrDistance, eFUnit );
+
+ // PoolUnit ermitteln
+ SfxItemPool* pPool = rOutAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool?" );
+ ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH );
+
+ // Setzen des Output-Devices
+ rXFSet.Put( aXFStyleItem );
+ rXFSet.Put( aXHatchItem );
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aLbHatchings.SetSelectHdl( LINK( this, SvxHatchTabPage, ChangeHatchHdl_Impl ) );
+
+ Link aLink = LINK( this, SvxHatchTabPage, ModifiedHdl_Impl );
+ aMtrDistance.SetModifyHdl( aLink );
+ aMtrAngle.SetModifyHdl( aLink );
+ aLbLineType.SetSelectHdl( aLink );
+ aLbLineColor.SetSelectHdl( aLink );
+
+ aBtnAdd.SetClickHdl( LINK( this, SvxHatchTabPage, ClickAddHdl_Impl ) );
+ aBtnModify.SetClickHdl(
+ LINK( this, SvxHatchTabPage, ClickModifyHdl_Impl ) );
+ aBtnDelete.SetClickHdl(
+ LINK( this, SvxHatchTabPage, ClickDeleteHdl_Impl ) );
+ aBtnLoad.SetClickHdl( LINK( this, SvxHatchTabPage, ClickLoadHdl_Impl ) );
+ aBtnSave.SetClickHdl( LINK( this, SvxHatchTabPage, ClickSaveHdl_Impl ) );
+
+ aCtlPreview.SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxHatchTabPage::Construct()
+{
+ // Farbtabelle
+ aLbLineColor.Fill( pColorTab );
+
+ // Schraffurentabelle
+ aLbHatchings.Fill( pHatchingList );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet )
+{
+ USHORT nPos;
+ USHORT nCount;
+
+ if( *pDlgType == 0 ) // Flaechen-Dialog
+ {
+ *pbAreaTP = FALSE;
+
+ if( pColorTab )
+ {
+ // ColorTable
+ if( *pnColorTableState & CT_CHANGED ||
+ *pnColorTableState & CT_MODIFIED )
+ {
+ if( *pnColorTableState & CT_CHANGED )
+ pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable();
+
+ // LbLineColor
+ nPos = aLbLineColor.GetSelectEntryPos();
+ aLbLineColor.Clear();
+ aLbLineColor.Fill( pColorTab );
+ nCount = aLbLineColor.GetEntryCount();
+ if( nCount == 0 )
+ ; // Dieser Fall sollte nicht auftreten
+ else if( nCount <= nPos )
+ aLbLineColor.SelectEntryPos( 0 );
+ else
+ aLbLineColor.SelectEntryPos( nPos );
+
+ ModifiedHdl_Impl( this );
+ }
+
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ INetURLObject aURL( pHatchingList->GetPath() );
+
+ aURL.Append( pHatchingList->GetName() );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if ( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ if( *pPageType == PT_HATCH && *pPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aLbHatchings.SelectEntryPos( *pPos );
+ }
+ // Farben koennten geloescht worden sein
+ ChangeHatchHdl_Impl( this );
+
+ *pPageType = PT_HATCH;
+ *pPos = LISTBOX_ENTRY_NOTFOUND;
+ }
+ }
+
+ rXFSet.Put ( ( XFillColorItem& ) rSet.Get(XATTR_FILLCOLOR) );
+ rXFSet.Put ( ( XFillBackgroundItem&)rSet.Get(XATTR_FILLBACKGROUND) );
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlPreview.Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+int SvxHatchTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( CheckChanges_Impl() == -1L )
+ return KEEP_PAGE;
+
+ if( _pSet )
+ FillItemSet( *_pSet );
+
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+long SvxHatchTabPage::CheckChanges_Impl()
+{
+ if( aMtrDistance.GetText() != aMtrDistance.GetSavedValue() ||
+ aMtrAngle.GetText() != aMtrAngle.GetSavedValue() ||
+ aLbLineType.GetSelectEntryPos() != aLbLineType.GetSavedValue() ||
+ aLbLineColor.GetSelectEntryPos() != aLbLineColor.GetSavedValue() ||
+ aLbHatchings.GetSelectEntryPos() != aLbHatchings.GetSavedValue() )
+ {
+ ResMgr& rMgr = DIALOG_MGR();
+ Image aWarningBoxImage = WarningBox::GetStandardImage();
+ //CHINA001 SvxMessDialog aMessDlg( DLGWIN,
+ //CHINA001 String( ResId( RID_SVXSTR_HATCH, rMgr ) ),
+ //CHINA001 String( ResId( RID_SVXSTR_ASK_CHANGE_HATCH, rMgr ) ),
+ //CHINA001 &aWarningBoxImage );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX,
+ String( ResId( RID_SVXSTR_HATCH, rMgr ) ),
+ String( ResId( RID_SVXSTR_ASK_CHANGE_HATCH, rMgr ) ),
+ &aWarningBoxImage );
+ DBG_ASSERT(aMessDlg, "Dialogdiet fail!");//CHINA001
+ aMessDlg->SetButtonText( MESS_BTN_1, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_1,
+ String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
+ aMessDlg->SetButtonText( MESS_BTN_2, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_2,
+ String( ResId( RID_SVXSTR_ADD, rMgr ) ) );
+
+ short nRet = aMessDlg->Execute(); //CHINA001 short nRet = aMessDlg.Execute();
+
+ switch( nRet )
+ {
+ case RET_BTN_1: // Aendern
+ {
+ ClickModifyHdl_Impl( this );
+ }
+ break;
+
+ case RET_BTN_2: // Hinzufuegen
+ {
+ ClickAddHdl_Impl( this );
+ }
+ break;
+
+ case RET_CANCEL:
+ // return( -1L ); <-- wuerde die Seite nicht verlassen
+ break;
+ // return( TRUE ); // Abbruch
+ }
+ delete aMessDlg; //add by CHINA001
+ }
+
+ USHORT nPos = aLbHatchings.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ *pPos = nPos;
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxHatchTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ if( *pDlgType == 0 && *pbAreaTP == FALSE ) // Flaechen-Dialog
+ {
+ if( *pPageType == PT_HATCH )
+ {
+ // CheckChanges(); <-- doppelte Abfrage ?
+
+ XHatch* pXHatch = NULL;
+ String aString;
+ USHORT nPos = aLbHatchings.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ pXHatch = new XHatch( pHatchingList->GetHatch( nPos )->GetHatch() );
+ aString = aLbHatchings.GetSelectEntry();
+ }
+ // Farbverlauf wurde (unbekannt) uebergeben
+ else
+ {
+ pXHatch = new XHatch( aLbLineColor.GetSelectEntryColor(),
+ (XHatchStyle) aLbLineType.GetSelectEntryPos(),
+ GetCoreValue( aMtrDistance, ePoolUnit ),
+ static_cast<long>(aMtrAngle.GetValue() * 10) );
+ }
+ DBG_ASSERT( pXHatch, "XHatch konnte nicht erzeugt werden" );
+ rSet.Put( XFillStyleItem( XFILL_HATCH ) );
+ rSet.Put( XFillHatchItem( aString, *pXHatch ) );
+
+ delete pXHatch;
+ }
+ }
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxHatchTabPage::Reset( const SfxItemSet& rSet )
+{
+ // aLbHatchings.SelectEntryPos( 0 );
+ ChangeHatchHdl_Impl( this );
+
+ // Status der Buttons ermitteln
+ if( pHatchingList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ else
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+
+ rXFSet.Put ( ( XFillColorItem& ) rSet.Get(XATTR_FILLCOLOR) );
+ rXFSet.Put ( ( XFillBackgroundItem&)rSet.Get(XATTR_FILLBACKGROUND) );
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+ aCtlPreview.Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxHatchTabPage::Create( Window* pWindow,
+ const SfxItemSet& rSet )
+{
+ return new SvxHatchTabPage( pWindow, rSet );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxHatchTabPage, ModifiedHdl_Impl, void *, p )
+{
+ if( p == &aMtrAngle )
+ {
+ // Setzen des Winkels im AngleControl
+ switch( aMtrAngle.GetValue() )
+ {
+ case 135: aCtlAngle.SetActualRP( RP_LT ); break;
+ case 90: aCtlAngle.SetActualRP( RP_MT ); break;
+ case 45: aCtlAngle.SetActualRP( RP_RT ); break;
+ case 180: aCtlAngle.SetActualRP( RP_LM ); break;
+ case 0: aCtlAngle.SetActualRP( RP_RM ); break;
+ case 225: aCtlAngle.SetActualRP( RP_LB ); break;
+ case 270: aCtlAngle.SetActualRP( RP_MB ); break;
+ case 315: aCtlAngle.SetActualRP( RP_RB ); break;
+ default: aCtlAngle.SetActualRP( RP_MM ); break;
+ }
+ }
+
+ XHatch aXHatch( aLbLineColor.GetSelectEntryColor(),
+ (XHatchStyle) aLbLineType.GetSelectEntryPos(),
+ GetCoreValue( aMtrDistance, ePoolUnit ),
+ static_cast<long>(aMtrAngle.GetValue() * 10) );
+
+ rXFSet.Put( XFillHatchItem( String(), aXHatch ) );
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aCtlPreview.Invalidate();
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxHatchTabPage, ChangeHatchHdl_Impl, void *, EMPTYARG )
+{
+ XHatch* pHatch = NULL;
+ int nPos = aLbHatchings.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ pHatch = new XHatch( ( (XHatchEntry*) pHatchingList->GetHatch( nPos ) )->GetHatch() );
+ else
+ {
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), TRUE, &pPoolItem ) )
+ {
+ if( ( XFILL_HATCH == (XFillStyle) ( ( const XFillStyleItem* ) pPoolItem )->GetValue() ) &&
+ ( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), TRUE, &pPoolItem ) ) )
+ {
+ pHatch = new XHatch( ( ( const XFillHatchItem* ) pPoolItem )->GetHatchValue() );
+ }
+ }
+ if( !pHatch )
+ {
+ aLbHatchings.SelectEntryPos( 0 );
+ nPos = aLbHatchings.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ pHatch = new XHatch( ( (XHatchEntry*) pHatchingList->GetHatch( nPos ) )->GetHatch() );
+ }
+ }
+ if( pHatch )
+ {
+ aLbLineType.SelectEntryPos(
+ sal::static_int_cast< USHORT >( pHatch->GetHatchStyle() ) );
+ // Wenn der Eintrag nicht in der Listbox ist, wird die Farbe
+ // temporaer hinzugenommen
+ aLbLineColor.SetNoSelection();
+ aLbLineColor.SelectEntry( pHatch->GetColor() );
+ if( aLbLineColor.GetSelectEntryCount() == 0 )
+ {
+ aLbLineColor.InsertEntry( pHatch->GetColor(), String() );
+ aLbLineColor.SelectEntry( pHatch->GetColor() );
+ }
+ SetMetricValue( aMtrDistance, pHatch->GetDistance(), ePoolUnit );
+ aMtrAngle.SetValue( pHatch->GetAngle() / 10 );
+
+ // Setzen des Winkels im AngleControl
+ switch( aMtrAngle.GetValue() )
+ {
+ case 135: aCtlAngle.SetActualRP( RP_LT ); break;
+ case 90: aCtlAngle.SetActualRP( RP_MT ); break;
+ case 45: aCtlAngle.SetActualRP( RP_RT ); break;
+ case 180: aCtlAngle.SetActualRP( RP_LM ); break;
+ case 0: aCtlAngle.SetActualRP( RP_RM ); break;
+ case 225: aCtlAngle.SetActualRP( RP_LB ); break;
+ case 270: aCtlAngle.SetActualRP( RP_MB ); break;
+ case 315: aCtlAngle.SetActualRP( RP_RB ); break;
+ default: aCtlAngle.SetActualRP( RP_MM ); break;
+ }
+
+ // Backgroundcolor
+ /*
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBACKGROUND ), TRUE, &pPoolItem ) )
+ {
+ rXFSet.Put ( XFillBackgroundItem( ( ( XFillBackgroundItem* )pPoolItem)->GetValue() ) );
+ if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) )
+ {
+ Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetValue() );
+ rXFSet.Put( XFillColorItem( String(), aColor ) );
+ }
+ }
+ */
+ // ItemSet fuellen und an aCtlPreview weiterleiten
+ rXFSet.Put( XFillHatchItem( String(), *pHatch ) );
+ aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
+
+ aCtlPreview.Invalidate();
+ delete pHatch;
+ }
+ aMtrDistance.SaveValue();
+ aMtrAngle.SaveValue();
+ aLbLineType.SaveValue();
+ aLbLineColor.SaveValue();
+ aLbHatchings.SaveValue();
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxHatchTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
+{
+ ResMgr& rMgr = DIALOG_MGR();
+ String aNewName( ResId( RID_SVXSTR_HATCH, rMgr ) );
+ String aDesc( ResId( RID_SVXSTR_DESC_HATCH, rMgr ) );
+ String aName;
+
+ long nCount = pHatchingList->Count();
+ long j = 1;
+ BOOL bDifferent = FALSE;
+
+ while( !bDifferent )
+ {
+ aName = aNewName;
+ aName += sal_Unicode(' ');
+ aName += UniString::CreateFromInt32( j++ );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ if( aName == pHatchingList->GetHatch( i )->GetName() )
+ bDifferent = FALSE;
+ }
+
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ WarningBox* pWarnBox = NULL;
+ USHORT nError = RID_SVXSTR_WARN_NAME_DUPLICATE;
+
+ while( pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ if( aName == pHatchingList->GetHatch( i )->GetName() )
+ bDifferent = FALSE;
+
+ if( bDifferent ) {
+ nError = 0;
+ break;
+ }
+
+ if( !pWarnBox )
+ {
+ pWarnBox = new WarningBox( DLGWIN,
+ WinBits( WB_OK_CANCEL ),
+ String( ResId( nError, rMgr ) ) );
+ pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE );
+ }
+
+ if( pWarnBox->Execute() != RET_OK )
+ break;
+ }
+ //Rectangle aDlgRect( pDlg->GetPosPixel(), pDlg->GetSizePixel() );
+ delete pDlg;
+ delete pWarnBox;
+
+ if( !nError )
+ {
+ XHatch aXHatch( aLbLineColor.GetSelectEntryColor(),
+ (XHatchStyle) aLbLineType.GetSelectEntryPos(),
+ GetCoreValue( aMtrDistance, ePoolUnit ),
+ static_cast<long>(aMtrAngle.GetValue() * 10) );
+ XHatchEntry* pEntry = new XHatchEntry( aXHatch, aName );
+
+ pHatchingList->Insert( pEntry, nCount );
+
+ aLbHatchings.Append( pEntry );
+
+ aLbHatchings.SelectEntryPos( aLbHatchings.GetEntryCount() - 1 );
+
+#ifdef WNT
+ // hack: #31355# W.P.
+ Rectangle aRect( aLbHatchings.GetPosPixel(), aLbHatchings.GetSizePixel() );
+ if( TRUE ) { // ??? overlapped with pDlg
+ // and srolling
+ Invalidate( aRect );
+ //aLbHatchings.Invalidate();
+ }
+#endif
+
+ // Flag fuer modifiziert setzen
+ *pnHatchingListState |= CT_MODIFIED;
+
+ ChangeHatchHdl_Impl( this );
+ }
+
+ // Status der Buttons ermitteln
+ if( pHatchingList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxHatchTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbHatchings.GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ ResMgr& rMgr = DIALOG_MGR();
+ String aNewName( ResId( RID_SVXSTR_HATCH, rMgr ) );
+ String aDesc( ResId( RID_SVXSTR_DESC_HATCH, rMgr ) );
+ String aName( pHatchingList->GetHatch( nPos )->GetName() );
+ String aOldName = aName;
+
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+
+ long nCount = pHatchingList->Count();
+ BOOL bDifferent = FALSE;
+ BOOL bLoop = TRUE;
+ while( bLoop && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ {
+ if( aName == pHatchingList->GetHatch( i )->GetName() &&
+ aName != aOldName )
+ bDifferent = FALSE;
+ }
+
+ if( bDifferent )
+ {
+ bLoop = FALSE;
+ XHatch aXHatch( aLbLineColor.GetSelectEntryColor(),
+ (XHatchStyle) aLbLineType.GetSelectEntryPos(),
+ GetCoreValue( aMtrDistance, ePoolUnit ),
+ static_cast<long>(aMtrAngle.GetValue() * 10) );
+
+ XHatchEntry* pEntry = new XHatchEntry( aXHatch, aName );
+
+ delete pHatchingList->Replace( pEntry, nPos );
+
+ aLbHatchings.Modify( pEntry, nPos );
+
+ aLbHatchings.SelectEntryPos( nPos );
+
+ // Werte sichern fuer Changes-Erkennung ( -> Methode )
+ aMtrDistance.SaveValue();
+ aMtrAngle.SaveValue();
+ aLbLineType.SaveValue();
+ aLbLineColor.SaveValue();
+ aLbHatchings.SaveValue();
+
+ // Flag fuer modifiziert setzen
+ *pnHatchingListState |= CT_MODIFIED;
+ }
+ else
+ {
+ WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+ aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
+ aBox.Execute();
+ }
+ }
+ delete( pDlg );
+ }
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxHatchTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbHatchings.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+//! SVX_RES( RID_SVXSTR_DEL_HATCH ),
+ String( SVX_RES( RID_SVXSTR_ASK_DEL_HATCH ) ) );
+
+ if( aQueryBox.Execute() == RET_YES )
+ {
+ delete pHatchingList->Remove( nPos );
+ aLbHatchings.RemoveEntry( nPos );
+ aLbHatchings.SelectEntryPos( 0 );
+
+ aCtlPreview.Invalidate();
+
+ ChangeHatchHdl_Impl( this );
+
+ // Flag fuer modifiziert setzen
+ *pnHatchingListState |= CT_MODIFIED;
+ }
+ }
+ // Status der Buttons ermitteln
+ if( !pHatchingList->Count() )
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxHatchTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
+{
+ ResMgr& rMgr = DIALOG_MGR();
+ USHORT nReturn = RET_YES;
+
+ if ( *pnHatchingListState & CT_MODIFIED )
+ {
+ nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
+ String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
+
+ if ( nReturn == RET_YES )
+ pHatchingList->Save();
+ }
+
+ if ( nReturn != RET_CANCEL )
+ {
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soh" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+ INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if( aDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aDlg.GetPath() );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ // Liste speichern
+ XHatchList* pHatchList = new XHatchList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool );
+ pHatchList->SetName( aURL.getName() );
+ if( pHatchList->Load() )
+ {
+ if( pHatchList )
+ {
+ // Pruefen, ob Tabelle geloescht werden darf:
+ if( pHatchingList != ( (SvxAreaTabDialog*) DLGWIN )->GetHatchingList() )
+ delete pHatchingList;
+
+ pHatchingList = pHatchList;
+ ( (SvxAreaTabDialog*) DLGWIN )->SetNewHatchingList( pHatchingList );
+
+ aLbHatchings.Clear();
+ aLbHatchings.Fill( pHatchingList );
+ Reset( rOutAttrs );
+
+ pHatchingList->SetName( aURL.getName() );
+
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ // Flag fuer gewechselt setzen
+ *pnHatchingListState |= CT_CHANGED;
+ // Flag fuer modifiziert entfernen
+ *pnHatchingListState &= ~CT_MODIFIED;
+ }
+ }
+ else
+ ErrorBox( DLGWIN, WinBits( WB_OK ),
+ String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
+ }
+ }
+
+ // Status der Buttons ermitteln
+ if ( pHatchingList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ else
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxHatchTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
+{
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soh" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+
+ INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+ DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( pHatchingList->GetName().Len() )
+ {
+ aFile.Append( pHatchingList->GetName() );
+
+ if( !aFile.getExtension().getLength() )
+ aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soh" ) ) );
+ }
+
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aDlg.GetPath() );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ pHatchingList->SetName( aURL.getName() );
+ pHatchingList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if( pHatchingList->Save() )
+ {
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aURL.getBase().getLength() > 18 )
+ {
+ aString += String(aURL.getBase()).Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += String(aURL.getBase());
+
+ // Flag fuer gespeichert setzen
+ *pnHatchingListState |= CT_SAVED;
+ // Flag fuer modifiziert entfernen
+ *pnHatchingListState &= ~CT_MODIFIED;
+ }
+ else
+ {
+ ErrorBox( DLGWIN, WinBits( WB_OK ),
+ String( SVX_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
+ }
+ }
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+
+void SvxHatchTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt )
+{
+ if( pWindow == &aCtlAngle )
+ {
+ switch( eRcPt )
+ {
+ case RP_LT: aMtrAngle.SetValue( 135 ); break;
+ case RP_MT: aMtrAngle.SetValue( 90 ); break;
+ case RP_RT: aMtrAngle.SetValue( 45 ); break;
+ case RP_LM: aMtrAngle.SetValue( 180 ); break;
+ case RP_RM: aMtrAngle.SetValue( 0 ); break;
+ case RP_LB: aMtrAngle.SetValue( 225 ); break;
+ case RP_MB: aMtrAngle.SetValue( 270 ); break;
+ case RP_RB: aMtrAngle.SetValue( 315 ); break;
+ case RP_MM: break;
+ }
+ ModifiedHdl_Impl( this );
+ }
+}
+
+
+void SvxHatchTabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ aCtlPreview.SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+
+ SvxTabPage::DataChanged( rDCEvt );
+}
+
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
new file mode 100644
index 000000000000..47228dcd013c
--- /dev/null
+++ b/cui/source/tabpages/tpline.cxx
@@ -0,0 +1,1926 @@
+/*************************************************************************
+ *
+ * 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: tpline.cxx,v $
+ * $Revision: 1.45 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#ifndef _SVX_SIZEITEM_HXX //autogen
+
+#include <svx/sizeitem.hxx>
+#endif
+#include <tools/shl.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+
+#define _SVX_TPLINE_CXX
+
+#include <svx/dialogs.hrc>
+#include "tabline.hrc"
+#include "svx/xattr.hxx"
+#include <svx/xpool.hxx>
+#include <svx/xtable.hxx>
+#include "svx/drawitem.hxx"
+#include "cuitabline.hxx"
+#include "dlgname.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include <svx/svdmodel.hxx>
+#include "svx/svxgrahicitem.hxx"
+//#include "linectrl.hrc"
+#include <sfx2/request.hxx>
+#include "svx/ofaitem.hxx"
+#include <svx/svdobj.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/numvset.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/numitem.hxx>
+#include <svx/svxenum.hxx>
+#include <sfx2/objsh.hxx>
+#include <svx/brshitem.hxx>
+#include <svx/gallery.hxx>
+#include <svx/xbitmap.hxx>
+#include <unotools/localfilehelper.hxx>
+#include "svx/opengrf.hxx"
+
+#define MAX_BMP_WIDTH 16
+#define MAX_BMP_HEIGHT 16
+// define ----------------------------------------------------------------
+
+#define DLGWIN this->GetParent()->GetParent()
+
+#define BITMAP_WIDTH 32
+#define BITMAP_HEIGHT 12
+#define XOUT_WIDTH 150
+
+// static ----------------------------------------------------------------
+
+static USHORT pLineRanges[] =
+{
+ XATTR_LINETRANSPARENCE,
+ XATTR_LINETRANSPARENCE,
+ SID_ATTR_LINE_STYLE,
+ SID_ATTR_LINE_ENDCENTER,
+ 0
+};
+
+/*************************************************************************
+|*
+|* Dialog zum Aendern der Linien
+|*
+\************************************************************************/
+
+SvxLineTabPage::SvxLineTabPage
+(
+ Window* pParent,
+ const SfxItemSet& rInAttrs
+) :
+ SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_LINE ), rInAttrs ),
+ aFtLineStyle ( this, SVX_RES( FT_LINE_STYLE ) ),
+ aLbLineStyle ( this, SVX_RES( LB_LINE_STYLE ) ),
+ aFtColor ( this, SVX_RES( FT_COLOR ) ),
+ aLbColor ( this, SVX_RES( LB_COLOR ) ),
+ aFtLineWidth ( this, SVX_RES( FT_LINE_WIDTH ) ),
+ aMtrLineWidth ( this, SVX_RES( MTR_FLD_LINE_WIDTH ) ),
+ aFtTransparent ( this, SVX_RES( FT_TRANSPARENT ) ),
+ aMtrTransparent ( this, SVX_RES( MTR_LINE_TRANSPARENT ) ),
+ aFlLine ( this, SVX_RES( FL_LINE ) ),
+ aFtLineEndsStyle ( this, SVX_RES( FT_LINE_ENDS_STYLE ) ),
+ aLbStartStyle ( this, SVX_RES( LB_START_STYLE ) ),
+ aFtLineEndsWidth ( this, SVX_RES( FT_LINE_ENDS_WIDTH ) ),
+ aMtrStartWidth ( this, SVX_RES( MTR_FLD_START_WIDTH ) ),
+ aTsbCenterStart ( this, SVX_RES( TSB_CENTER_START ) ),
+ aLbEndStyle ( this, SVX_RES( LB_END_STYLE ) ),
+ aMtrEndWidth ( this, SVX_RES( MTR_FLD_END_WIDTH ) ),
+ aTsbCenterEnd ( this, SVX_RES( TSB_CENTER_END ) ),
+ aCbxSynchronize ( this, SVX_RES( CBX_SYNCHRONIZE ) ),
+ aFlLineEnds ( this, SVX_RES( FL_LINE_ENDS ) ),
+ aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ),
+ aFLSeparator ( this, SVX_RES( FL_SEPARATOR ) ),
+
+ // #116827#
+ maFLEdgeStyle ( this, SVX_RES( FL_EDGE_STYLE ) ),
+ maFTEdgeStyle ( this, SVX_RES( FT_EDGE_STYLE ) ),
+ maLBEdgeStyle ( this, SVX_RES( LB_EDGE_STYLE ) ),
+
+ pSymbolList(NULL),
+ bNewSize(false),
+ nNumMenuGalleryItems(0),
+ nSymbolType(SVX_SYMBOLTYPE_UNKNOWN), //unbekannt bzw. unchanged
+ pSymbolAttr(NULL),
+ //#58425# Symbole auf einer Linie (z.B. StarChart)
+ aFlSymbol ( this, SVX_RES(FL_SYMBOL_FORMAT)),
+ aSymbolMB ( this, SVX_RES(MB_SYMBOL_BITMAP)),
+ aSymbolWidthFT ( this, SVX_RES(FT_SYMBOL_WIDTH)),
+ aSymbolWidthMF ( this, SVX_RES(MF_SYMBOL_WIDTH)),
+ aSymbolHeightFT ( this, SVX_RES(FT_SYMBOL_HEIGHT)),
+ aSymbolHeightMF ( this, SVX_RES(MF_SYMBOL_HEIGHT)),
+ aSymbolRatioCB ( this, SVX_RES(CB_SYMBOL_RATIO)),
+
+ bLastWidthModified(FALSE),
+ aSymbolLastSize(Size(0,0)),
+ bSymbols(FALSE),
+
+ rOutAttrs ( rInAttrs ),
+ bObjSelected( sal_False ),
+
+ pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
+ aXLStyle ( XLINE_DASH ),
+ aXWidth ( 1 ),
+ aXDash ( String(), XDash( XDASH_RECT, 3, 7, 2, 40, 15 ) ),
+ aXColor ( String(), COL_LIGHTRED ),
+ aXLineAttr ( pXPool ),
+ rXLSet ( aXLineAttr.GetItemSet() ),
+ pnLineEndListState( 0 ),
+ pnDashListState( 0 ),
+ pnColorTableState( 0 ),
+ nPageType ( 0 )//CHINA001 pPageType ( NULL ),
+{
+ FreeResource();
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ // Metrik einstellen
+ FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs );
+
+ switch ( eFUnit )
+ {
+ case FUNIT_M:
+ case FUNIT_KM:
+ eFUnit = FUNIT_MM;
+ // no break -> we now have mm
+ case FUNIT_MM:
+ aMtrLineWidth.SetSpinSize( 50 );
+ aMtrStartWidth.SetSpinSize( 50 );
+ aMtrEndWidth.SetSpinSize( 50 );
+ break;
+
+ case FUNIT_INCH:
+ aMtrLineWidth.SetSpinSize( 2 );
+ aMtrStartWidth.SetSpinSize( 2 );
+ aMtrEndWidth.SetSpinSize( 2 );
+ break;
+ default: ;//prevent warning
+ }
+ SetFieldUnit( aMtrLineWidth, eFUnit );
+ SetFieldUnit( aMtrStartWidth, eFUnit );
+ SetFieldUnit( aMtrEndWidth, eFUnit );
+
+ // PoolUnit ermitteln
+ SfxItemPool* pPool = rOutAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool?" );
+ ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
+
+ aLbLineStyle.SetSelectHdl(
+ LINK( this, SvxLineTabPage, ClickInvisibleHdl_Impl ) );
+ aLbColor.SetSelectHdl(
+ LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) );
+ aMtrLineWidth.SetModifyHdl(
+ LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) );
+ aMtrTransparent.SetModifyHdl(
+ LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl ) );
+
+ Link aStart = LINK( this, SvxLineTabPage, ChangeStartHdl_Impl );
+ Link aEnd = LINK( this, SvxLineTabPage, ChangeEndHdl_Impl );
+ aLbStartStyle.SetSelectHdl( aStart );
+ aLbEndStyle.SetSelectHdl( aEnd );
+ aMtrStartWidth.SetModifyHdl( aStart );
+ aMtrEndWidth.SetModifyHdl( aEnd );
+ aTsbCenterStart.SetClickHdl( aStart );
+ aTsbCenterEnd.SetClickHdl( aEnd );
+
+ pColorTab = NULL;
+ pDashList = NULL;
+ pLineEndList = NULL;
+
+ // #116827#
+ Link aEdgeStyle = LINK( this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl );
+ maLBEdgeStyle.SetSelectHdl( aEdgeStyle );
+
+ //#58425# Symbole auf einer Linie (z.B. StarChart) , MB-Handler setzen
+ aSymbolMB.SetSelectHdl(LINK(this, SvxLineTabPage, GraphicHdl_Impl));
+ aSymbolMB.SetActivateHdl(LINK(this, SvxLineTabPage, MenuCreateHdl_Impl));
+ aSymbolWidthMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl));
+ aSymbolHeightMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl));
+ aSymbolRatioCB.SetClickHdl(LINK(this, SvxLineTabPage, RatioHdl_Impl));
+
+ aSymbolRatioCB.Check(TRUE);
+ ShowSymbolControls(FALSE);
+
+ // #63083#
+ nActLineWidth = -1;
+}
+//#58425# Symbole auf einer Linie (z.B. StarChart) , Symbol-Controls aktivieren
+void SvxLineTabPage::ShowSymbolControls(BOOL bOn)
+{
+ bSymbols=bOn;
+ aSymbolWidthFT.Show(bOn);
+ aSymbolWidthMF.Show(bOn);
+ aSymbolHeightFT.Show(bOn);
+ aSymbolHeightMF.Show(bOn);
+ aFlSymbol.Show(bOn);
+ aSymbolRatioCB.Show(bOn);
+ aSymbolMB.Show(bOn);
+ aCtlPreview.ShowSymbol(bOn);
+}
+// -----------------------------------------------------------------------
+//#58425# Symbole auf einer Linie (z.B. StarChart) , dtor neu!
+SvxLineTabPage::~SvxLineTabPage()
+{
+ delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
+
+ if(pSymbolList)
+ delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
+
+ String* pStr = (String*)aGrfNames.First();
+ while( pStr )
+ {
+ delete pStr;
+ pStr = (String*)aGrfNames.Next();
+ }
+ SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.First();
+ while( pInfo )
+ {
+ delete pInfo->pBrushItem;
+ delete pInfo;
+ pInfo = (SvxBmpItemInfo*)aGrfBrushItems.Next();
+ }
+}
+void SvxLineTabPage::Construct()
+{
+ // Farbtabelle
+ aLbColor.Fill( pColorTab );
+ FillListboxes();
+}
+
+void SvxLineTabPage::FillListboxes()
+{
+ ResMgr& rMgr = DIALOG_MGR();
+ USHORT nOldSelect = aLbLineStyle.GetSelectEntryPos();
+ aLbLineStyle.FillStyles();
+ aLbLineStyle.Fill( pDashList );
+ aLbLineStyle.SelectEntryPos( nOldSelect );
+
+ // LinienEndenStile
+ String sNone( ResId( RID_SVXSTR_NONE, rMgr ) );
+ nOldSelect = aLbStartStyle.GetSelectEntryPos();
+ aLbStartStyle.Clear();
+ aLbStartStyle.InsertEntry( sNone );
+ aLbStartStyle.Fill( pLineEndList );
+ aLbStartStyle.SelectEntryPos( nOldSelect );
+ nOldSelect = aLbEndStyle.GetSelectEntryPos();
+ aLbEndStyle.Clear();
+ aLbEndStyle.InsertEntry( sNone );
+ aLbEndStyle.Fill( pLineEndList, FALSE );
+ aLbEndStyle.SelectEntryPos( nOldSelect );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet )
+{
+ SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False); //add CHINA001 begin
+ if (pPageTypeItem)
+ SetPageType(pPageTypeItem->GetValue()); //add CHINA001 end
+ if( nDlgType == 0 && pDashList ) //CHINA001 if( *pDlgType == 0 && pDashList ) // Linien-Dialog
+ {
+ ResMgr& rMgr = DIALOG_MGR();
+ USHORT nPos;
+ USHORT nCount;
+
+ // Dashliste
+ if( ( *pnDashListState & CT_MODIFIED ) ||
+ ( *pnDashListState & CT_CHANGED ) )
+ {
+ if( *pnDashListState & CT_CHANGED )
+ pDashList = ( (SvxLineTabDialog*) DLGWIN )->
+ GetNewDashList();
+ *pnDashListState = CT_NONE;
+
+ // Styleliste
+ nPos = aLbLineStyle.GetSelectEntryPos();
+
+ aLbLineStyle.Clear();
+ aLbLineStyle.InsertEntry(
+ String( ResId( RID_SVXSTR_INVISIBLE, rMgr ) ) );
+ aLbLineStyle.InsertEntry(
+ String( ResId( RID_SVXSTR_SOLID, rMgr ) ) );
+ aLbLineStyle.Fill( pDashList );
+ nCount = aLbLineStyle.GetEntryCount();
+
+ if ( nCount == 0 )
+ ; // Dieser Fall sollte nicht auftreten
+ else if( nCount <= nPos )
+ aLbLineStyle.SelectEntryPos( 0 );
+ else
+ aLbLineStyle.SelectEntryPos( nPos );
+ // SelectStyleHdl_Impl( this );
+ }
+
+ INetURLObject aDashURL( pDashList->GetPath() );
+
+ aDashURL.Append( pDashList->GetName() );
+ DBG_ASSERT( aDashURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+/* // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( ResId( RID_SVXSTR_TABLE, pMgr ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aDashURL.getBase().Len() > 18 )
+ {
+ aString += aDashURL.getBase().Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += aDashURL.getBase();
+
+ aGrpLine.SetText( aString );
+*/
+ // LineEndliste
+ if( ( *pnLineEndListState & CT_MODIFIED ) ||
+ ( *pnLineEndListState & CT_CHANGED ) )
+ {
+ if( *pnLineEndListState & CT_CHANGED )
+ pLineEndList = ( (SvxLineTabDialog*) DLGWIN )->
+ GetNewLineEndList();
+ *pnLineEndListState = CT_NONE;
+
+ nPos = aLbLineStyle.GetSelectEntryPos();
+ String sNone( ResId( RID_SVXSTR_NONE, rMgr ) );
+ aLbStartStyle.Clear();
+ aLbStartStyle.InsertEntry( sNone );
+
+ aLbStartStyle.Fill( pLineEndList );
+ nCount = aLbStartStyle.GetEntryCount();
+ if( nCount == 0 )
+ ; // Dieser Fall sollte nicht auftreten
+ else if( nCount <= nPos )
+ aLbStartStyle.SelectEntryPos( 0 );
+ else
+ aLbStartStyle.SelectEntryPos( nPos );
+
+ aLbEndStyle.Clear();
+ aLbEndStyle.InsertEntry( sNone );
+
+ aLbEndStyle.Fill( pLineEndList, FALSE );
+ nCount = aLbEndStyle.GetEntryCount();
+
+ if( nCount == 0 )
+ ; // Dieser Fall sollte nicht auftreten
+ else if( nCount <= nPos )
+ aLbEndStyle.SelectEntryPos( 0 );
+ else
+ aLbEndStyle.SelectEntryPos( nPos );
+ }
+ INetURLObject aLineURL( pLineEndList->GetPath() );
+
+ aLineURL.Append( pLineEndList->GetName() );
+ DBG_ASSERT( aLineURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+/* // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ aString = String( ResId( RID_SVXSTR_TABLE, pMgr ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aLineURL.getBase().Len() > 18 )
+ {
+ aString += aLineURL.getBase().Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += aLineURL.getBase();
+
+ aGrpLineEnds.SetText( aString );
+*/
+ // Auswertung, ob von einer anderen TabPage ein anderer Fuelltyp gesetzt wurde
+ if( aLbLineStyle.GetSelectEntryPos() != 0 )
+ {
+ if( nPageType == 2 ) // 1//CHINA001 if( *pPageType == 2 ) // 1
+ {
+ aLbLineStyle.SelectEntryPos( *pPosDashLb + 2 ); // +2 wegen SOLID und INVLISIBLE
+ ChangePreviewHdl_Impl( this );
+ }
+ if( nPageType == 3 )//CHINA001 if( *pPageType == 3 )
+ {
+ aLbStartStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID
+ aLbEndStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID
+ ChangePreviewHdl_Impl( this );
+ }
+ }
+
+ // ColorTable
+ if( *pnColorTableState )
+ {
+ if( *pnColorTableState & CT_CHANGED )
+ pColorTab = ( (SvxLineTabDialog*) DLGWIN )->
+ GetNewColorTable();
+ // aLbColor
+ sal_uInt16 nColorPos = aLbColor.GetSelectEntryPos();
+ aLbColor.Clear();
+ aLbColor.Fill( pColorTab );
+ nCount = aLbColor.GetEntryCount();
+ if( nCount == 0 )
+ ; // This case should never occur
+ else if( nCount <= nColorPos )
+ aLbColor.SelectEntryPos( 0 );
+ else
+ aLbColor.SelectEntryPos( nColorPos );
+
+ ChangePreviewHdl_Impl( this );
+ }
+
+ nPageType = 0;//CHINA001 *pPageType = 0;
+ }
+ // Seite existiert im Ctor noch nicht, deswegen hier!
+
+ else if ( nDlgType == 1100 || // Chart-Dialog//CHINA001 else if ( *pDlgType == 1100 || // Chart-Dialog
+ nDlgType == 1101 )//CHINA001 *pDlgType == 1101 )
+ {
+ aFtLineEndsStyle.Hide();
+ aFtLineEndsWidth.Hide();
+ aLbStartStyle.Hide();
+ aMtrStartWidth.Hide();
+ aTsbCenterStart.Hide();
+ aLbEndStyle.Hide();
+ aMtrEndWidth.Hide();
+ aTsbCenterEnd.Hide();
+ aCbxSynchronize.Hide();
+ aFlLineEnds.Hide();
+
+ // #116827#
+ maFLEdgeStyle.Hide();
+ maFTEdgeStyle.Hide();
+ maLBEdgeStyle.Hide();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SvxLineTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if( nDlgType == 0 ) // Linien-Dialog//CHINA001 if( *pDlgType == 0 ) // Linien-Dialog
+ {
+ nPageType = 1; // evtl. fuer Erweiterungen//CHINA001 *pPageType = 1; // evtl. fuer Erweiterungen
+ *pPosDashLb = aLbLineStyle.GetSelectEntryPos() - 2;// erster Eintrag SOLID !!!
+ USHORT nPos = aLbStartStyle.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ nPos--;
+ *pPosLineEndLb = nPos;
+ }
+
+ if( _pSet )
+ FillItemSet( *_pSet );
+
+ return( LEAVE_PAGE );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxLineTabPage::FillItemSet( SfxItemSet& rAttrs )
+{
+ const SfxPoolItem* pOld = NULL;
+ USHORT nPos;
+ BOOL bModified = FALSE;
+
+ // Um evtl. Modifikationen der Liste vorzubeugen
+ // werden Items anderer Seiten nicht gesetzt
+ if( nDlgType != 0 || nPageType != 2 )//CHINA001 if( *pDlgType != 0 || *pPageType != 2 )
+ {
+ nPos = aLbLineStyle.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND &&
+ nPos != aLbLineStyle.GetSavedValue() )
+ {
+ XLineStyleItem* pStyleItem = NULL;
+
+ if( nPos == 0 )
+ pStyleItem = new XLineStyleItem( XLINE_NONE );
+ else if( nPos == 1 )
+ pStyleItem = new XLineStyleItem( XLINE_SOLID );
+ else
+ {
+ pStyleItem = new XLineStyleItem( XLINE_DASH );
+
+ // Zusaetzliche Sicherheit
+ if( pDashList->Count() > (long) ( nPos - 2 ) )
+ {
+ XLineDashItem aDashItem( aLbLineStyle.GetSelectEntry(),
+ pDashList->GetDash( nPos - 2 )->GetDash() );
+ pOld = GetOldItem( rAttrs, XATTR_LINEDASH );
+ if ( !pOld || !( *(const XLineDashItem*)pOld == aDashItem ) )
+ {
+ rAttrs.Put( aDashItem );
+ bModified = TRUE;
+ }
+ }
+ }
+ pOld = GetOldItem( rAttrs, XATTR_LINESTYLE );
+ if ( !pOld || !( *(const XLineStyleItem*)pOld == *pStyleItem ) )
+ {
+ rAttrs.Put( *pStyleItem );
+ bModified = TRUE;
+ }
+ delete pStyleItem;
+ }
+ }
+ // Linienbreite
+ // GetSavedValue() liefert String!
+ if( aMtrLineWidth.GetText() != aMtrLineWidth.GetSavedValue() )
+ {
+ XLineWidthItem aItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) );
+ pOld = GetOldItem( rAttrs, XATTR_LINEWIDTH );
+ if ( !pOld || !( *(const XLineWidthItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+ //Breite Linienanfang
+ if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() )
+ {
+ XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) );
+ pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH );
+ if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+ //Breite Linienende
+ if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() )
+ {
+ XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) );
+ pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH );
+ if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+
+ // Linienfarbe
+ if( aLbColor.GetSelectEntryPos() != aLbColor.GetSavedValue() )
+ {
+ XLineColorItem aItem( aLbColor.GetSelectEntry(),
+ aLbColor.GetSelectEntryColor() );
+ pOld = GetOldItem( rAttrs, XATTR_LINECOLOR );
+ if ( !pOld || !( *(const XLineColorItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+
+ if( nDlgType != 0 || nPageType != 3 )//CHINA001 if( *pDlgType != 0 || *pPageType != 3 )
+ {
+ // Linienanfang
+ nPos = aLbStartStyle.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND &&
+ nPos != aLbStartStyle.GetSavedValue() )
+ {
+ XLineStartItem* pItem = NULL;
+ if( nPos == 0 )
+ pItem = new XLineStartItem();
+ else if( pLineEndList->Count() > (long) ( nPos - 1 ) )
+ pItem = new XLineStartItem( aLbStartStyle.GetSelectEntry(),
+ pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
+ pOld = GetOldItem( rAttrs, XATTR_LINESTART );
+ if( pItem &&
+ ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) )
+ {
+ rAttrs.Put( *pItem );
+ bModified = TRUE;
+ }
+ delete pItem;
+ }
+ // Linienende
+ nPos = aLbEndStyle.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND &&
+ nPos != aLbEndStyle.GetSavedValue() )
+ {
+ XLineEndItem* pItem = NULL;
+ if( nPos == 0 )
+ pItem = new XLineEndItem();
+ else if( pLineEndList->Count() > (long) ( nPos - 1 ) )
+ pItem = new XLineEndItem( aLbEndStyle.GetSelectEntry(),
+ pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
+ pOld = GetOldItem( rAttrs, XATTR_LINEEND );
+ if( pItem &&
+ ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) )
+ {
+ rAttrs.Put( *pItem );
+ bModified = TRUE;
+ }
+ delete pItem;
+ }
+ }
+
+ // Linienenden zentriert
+ TriState eState = aTsbCenterStart.GetState();
+ if( eState != aTsbCenterStart.GetSavedValue() )
+ {
+ XLineStartCenterItem aItem( sal::static_int_cast< BOOL >( eState ) );
+ pOld = GetOldItem( rAttrs, XATTR_LINESTARTCENTER );
+ if ( !pOld || !( *(const XLineStartCenterItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+ eState = aTsbCenterEnd.GetState();
+ if( eState != aTsbCenterEnd.GetSavedValue() )
+ {
+ XLineEndCenterItem aItem( sal::static_int_cast< BOOL >( eState ) );
+ pOld = GetOldItem( rAttrs, XATTR_LINEENDCENTER );
+ if ( !pOld || !( *(const XLineEndCenterItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+
+ //Breite Linienanfang
+ if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() )
+ {
+ XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) );
+ pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH );
+ if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+ //Breite Linienende
+ if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() )
+ {
+ XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) );
+ pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH );
+ if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+
+ // Transparenz
+ UINT16 nVal = (UINT16)aMtrTransparent.GetValue();
+ if( nVal != (UINT16)aMtrTransparent.GetSavedValue().ToInt32() )
+ {
+ XLineTransparenceItem aItem( nVal );
+ pOld = GetOldItem( rAttrs, XATTR_LINETRANSPARENCE );
+ if ( !pOld || !( *(const XLineTransparenceItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+
+ // #116827#
+ nPos = maLBEdgeStyle.GetSelectEntryPos();
+ if( LISTBOX_ENTRY_NOTFOUND != nPos && nPos != maLBEdgeStyle.GetSavedValue() )
+ {
+ XLineJointItem* pNew = 0L;
+
+ switch(nPos)
+ {
+ case 0: // Rounded, default
+ {
+ pNew = new XLineJointItem(XLINEJOINT_ROUND);
+ break;
+ }
+ case 1: // - none -
+ {
+ pNew = new XLineJointItem(XLINEJOINT_NONE);
+ break;
+ }
+ case 2: // Miter
+ {
+ pNew = new XLineJointItem(XLINEJOINT_MITER);
+ break;
+ }
+ case 3: // Bevel
+ {
+ pNew = new XLineJointItem(XLINEJOINT_BEVEL);
+ break;
+ }
+ }
+
+ if(pNew)
+ {
+ pOld = GetOldItem( rAttrs, XATTR_LINEJOINT );
+
+ if(!pOld || !(*(const XLineJointItem*)pOld == *pNew))
+ {
+ rAttrs.Put( *pNew );
+ bModified = TRUE;
+ }
+
+ delete pNew;
+ }
+ }
+
+ if(nSymbolType!=SVX_SYMBOLTYPE_UNKNOWN || bNewSize)
+ {
+ //wurde also per Auswahl gesetzt oder Gr��e ist anders
+ SvxSizeItem aSItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),aSymbolSize);
+ const SfxPoolItem* pSOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE) );
+ bNewSize = pSOld ? *(const SvxSizeItem *)pSOld != aSItem : bNewSize ;
+ if(bNewSize)
+ {
+ rAttrs.Put(aSItem);
+ bModified=TRUE;
+ }
+
+ SfxInt32Item aTItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),nSymbolType);
+ const SfxPoolItem* pTOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE) );
+ bool bNewType = pTOld == NULL || *(const SfxInt32Item*)pTOld != aTItem;
+ if(bNewType && nSymbolType==SVX_SYMBOLTYPE_UNKNOWN)
+ bNewType=false;//kleine Korrektur, Typ wurde garnicht gesetzt -> kein Type-Item erzeugen!
+ if(bNewType)
+ {
+ rAttrs.Put(aTItem);
+ bModified=TRUE;
+ }
+
+ if(nSymbolType!=SVX_SYMBOLTYPE_NONE)
+ {
+ SvxBrushItem aBItem(aSymbolGraphic,GPOS_MM,rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH));
+ const SfxPoolItem* pBOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH) );
+ bool bNewBrush =
+ pBOld == NULL || *(const SvxBrushItem*)pBOld != aBItem;
+ if(bNewBrush)
+ {
+ rAttrs.Put(aBItem);
+ bModified=TRUE;
+ }
+ }
+ }
+ rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));//add CHINA001
+ return( bModified );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxLineTabPage::FillXLSet_Impl()
+{
+ USHORT nPos;
+
+ if( aLbLineStyle.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
+ {
+ //rXLSet.Put( XLineDashItem ( rOutAttrs.Get( GetWhich( XATTR_LINEDASH ) ) ) );
+ rXLSet.Put( XLineStyleItem( XLINE_NONE ) );
+ }
+ else if( aLbLineStyle.IsEntryPosSelected( 0 ) )
+ rXLSet.Put( XLineStyleItem( XLINE_NONE ) );
+ else if( aLbLineStyle.IsEntryPosSelected( 1 ) )
+ rXLSet.Put( XLineStyleItem( XLINE_SOLID ) );
+ else
+ {
+ rXLSet.Put( XLineStyleItem( XLINE_DASH ) );
+
+ nPos = aLbLineStyle.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ rXLSet.Put( XLineDashItem( aLbLineStyle.GetSelectEntry(),
+ pDashList->GetDash( nPos - 2 )->GetDash() ) );
+ }
+ }
+
+ nPos = aLbStartStyle.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ if( nPos == 0 )
+ rXLSet.Put( XLineStartItem() );
+ else
+ rXLSet.Put( XLineStartItem( aLbStartStyle.GetSelectEntry(),
+ pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
+ }
+ nPos = aLbEndStyle.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ if( nPos == 0 )
+ rXLSet.Put( XLineEndItem() );
+ else
+ rXLSet.Put( XLineEndItem( aLbEndStyle.GetSelectEntry(),
+ pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
+ }
+
+ // #116827#
+ nPos = maLBEdgeStyle.GetSelectEntryPos();
+ if(LISTBOX_ENTRY_NOTFOUND != nPos)
+ {
+ switch(nPos)
+ {
+ case 0: // Rounded, default
+ {
+ rXLSet.Put(XLineJointItem(XLINEJOINT_ROUND));
+ break;
+ }
+ case 1: // - none -
+ {
+ rXLSet.Put(XLineJointItem(XLINEJOINT_NONE));
+ break;
+ }
+ case 2: // Miter
+ {
+ rXLSet.Put(XLineJointItem(XLINEJOINT_MITER));
+ break;
+ }
+ case 3: // Bevel
+ {
+ rXLSet.Put(XLineJointItem(XLINEJOINT_BEVEL));
+ break;
+ }
+ }
+ }
+
+ rXLSet.Put( XLineStartWidthItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ) );
+ rXLSet.Put( XLineEndWidthItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ) );
+
+ rXLSet.Put( XLineWidthItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) ) );
+ rXLSet.Put( XLineColorItem( aLbColor.GetSelectEntry(),
+ aLbColor.GetSelectEntryColor() ) );
+
+ // Linienenden zentriert
+ if( aTsbCenterStart.GetState() == STATE_CHECK )
+ rXLSet.Put( XLineStartCenterItem( TRUE ) );
+ else if( aTsbCenterStart.GetState() == STATE_NOCHECK )
+ rXLSet.Put( XLineStartCenterItem( FALSE ) );
+
+ if( aTsbCenterEnd.GetState() == STATE_CHECK )
+ rXLSet.Put( XLineEndCenterItem( TRUE ) );
+ else if( aTsbCenterEnd.GetState() == STATE_NOCHECK )
+ rXLSet.Put( XLineEndCenterItem( FALSE ) );
+
+ // Transparenz
+ UINT16 nVal = (UINT16)aMtrTransparent.GetValue();
+ rXLSet.Put( XLineTransparenceItem( nVal ) );
+
+ // #116827#
+ aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
+
+ return( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineTabPage::Reset( const SfxItemSet& rAttrs )
+{
+ String aString;
+ XLineStyle eXLS; // XLINE_NONE, XLINE_SOLID, XLINE_DASH
+
+ // Linienstil
+/*
+ if( bObjSelected &&
+ rAttrs.GetItemState( GetWhich( XATTR_LINESTYLE ) ) == SFX_ITEM_DEFAULT )
+ {
+ aLbLineStyle.Disable();
+ }
+*/
+ const SfxPoolItem *pPoolItem;
+ long nSymType=SVX_SYMBOLTYPE_UNKNOWN;
+ BOOL bPrevSym=FALSE;
+ BOOL bEnable=TRUE;
+ BOOL bIgnoreGraphic=FALSE;
+ BOOL bIgnoreSize=FALSE;
+ if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),TRUE,&pPoolItem) == SFX_ITEM_SET)
+ {
+ nSymType=((const SfxInt32Item *)pPoolItem)->GetValue();
+ }
+
+ if(nSymType == SVX_SYMBOLTYPE_AUTO)
+ {
+ aSymbolGraphic=aAutoSymbolGraphic;
+ aSymbolSize=aSymbolLastSize=aAutoSymbolGraphic.GetPrefSize();
+ bPrevSym=TRUE;
+ }
+ else if(nSymType == SVX_SYMBOLTYPE_NONE)
+ {
+ bEnable=FALSE;
+ bIgnoreGraphic=TRUE;
+ bIgnoreSize=TRUE;
+ }
+ else if(nSymType >= 0)
+ {
+ VirtualDevice aVDev;
+ aVDev.SetMapMode(MapMode(MAP_100TH_MM));
+
+ SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
+ pModel->GetItemPool().FreezeIdRanges();
+ SdrPage* pPage = new SdrPage( *pModel, FALSE );
+ pPage->SetSize(Size(1000,1000));
+ pModel->InsertPage( pPage, 0 );
+ SdrView* pView = new SdrView( pModel, &aVDev );
+ pView->hideMarkHandles();
+ SdrPageView* pPageView = pView->ShowSdrPage(pPage);
+// SdrPageView* pPageView = pView->ShowSdrPage(pPage, Point());
+ SdrObject *pObj=NULL;
+ long nSymTmp=nSymType;
+ if(pSymbolList)
+ {
+ if(pSymbolList->GetObjCount())
+ {
+ nSymTmp=nSymTmp%pSymbolList->GetObjCount(); //Liste wird als cyclisch betrachtet!!!
+ pObj=pSymbolList->GetObj(nSymTmp);
+ if(pObj)
+ {
+ pObj=pObj->Clone();
+ pPage->NbcInsertObject(pObj);
+ pView->MarkObj(pObj,pPageView);
+ if(pSymbolAttr)
+ {
+ pObj->SetMergedItemSet(*pSymbolAttr);
+ }
+ else
+ {
+ pObj->SetMergedItemSet(rOutAttrs);
+ }
+ GDIMetaFile aMeta(pView->GetAllMarkedMetaFile());
+
+ aSymbolGraphic=Graphic(aMeta);
+ aSymbolSize=pObj->GetSnapRect().GetSize();
+ aSymbolGraphic.SetPrefSize(aSymbolSize);
+ aSymbolGraphic.SetPrefMapMode(MAP_100TH_MM);
+ bPrevSym=TRUE;
+ bEnable=TRUE;
+ bIgnoreGraphic=TRUE;
+
+ pView->UnmarkAll();
+ pObj=pPage->RemoveObject(0);
+ SdrObject::Free( pObj );
+ }
+ }
+ }
+ delete pView;
+ delete pModel;
+ }
+ if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH),TRUE,&pPoolItem) == SFX_ITEM_SET)
+ {
+ const Graphic* pGraphic = ((const SvxBrushItem *)pPoolItem)->GetGraphic();
+ if( pGraphic )
+ {
+ if(!bIgnoreGraphic)
+ {
+ aSymbolGraphic=*pGraphic;
+ }
+ if(!bIgnoreSize)
+ {
+ aSymbolSize=OutputDevice::LogicToLogic( pGraphic->GetPrefSize(),
+ pGraphic->GetPrefMapMode(),
+ MAP_100TH_MM );
+ }
+ bPrevSym=TRUE;
+ }
+ }
+ if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),TRUE,&pPoolItem) == SFX_ITEM_SET)
+ {
+ aSymbolSize = ((const SvxSizeItem *)pPoolItem)->GetSize();
+ }
+
+
+ aSymbolRatioCB.Enable(bEnable);
+ aSymbolHeightFT.Enable(bEnable);
+ aSymbolWidthFT.Enable(bEnable);
+ aSymbolWidthMF.Enable(bEnable);
+ aSymbolHeightMF.Enable(bEnable);
+ if(bPrevSym)
+ {
+ SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit);
+ SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(),ePoolUnit);
+ aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
+ aSymbolLastSize=aSymbolSize;
+ }
+
+ if( rAttrs.GetItemState( XATTR_LINESTYLE ) != SFX_ITEM_DONTCARE )
+ {
+ eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( XATTR_LINESTYLE ) ).GetValue();
+
+ switch( eXLS )
+ {
+ case XLINE_NONE:
+ aLbLineStyle.SelectEntryPos( 0 );
+ break;
+ case XLINE_SOLID:
+ aLbLineStyle.SelectEntryPos( 1 );
+ break;
+
+ case XLINE_DASH:
+ aLbLineStyle.SetNoSelection();
+ aLbLineStyle.SelectEntry( ( ( const XLineDashItem& ) rAttrs.
+ Get( XATTR_LINEDASH ) ).GetName() );
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ {
+ aLbLineStyle.SetNoSelection();
+ }
+
+ // Linienstaerke
+/*
+ if( bObjSelected &&
+ rAttrs.GetItemState( GetWhich( XATTR_LINEWIDTH ) ) == SFX_ITEM_DEFAULT )
+ {
+ aMtrLineWidth.Disable();
+ }
+*/
+ if( rAttrs.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE )
+ {
+ SetMetricValue( aMtrLineWidth, ( ( const XLineWidthItem& ) rAttrs.
+ Get( XATTR_LINEWIDTH ) ).GetValue(), ePoolUnit );
+ }
+ else
+ aMtrLineWidth.SetText( String() );
+
+ // Linienfarbe
+/*
+ if( bObjSelected &&
+ rAttrs.GetItemState( GetWhich( XATTR_LINECOLOR ) ) == SFX_ITEM_DEFAULT )
+ {
+ aLbColor.Disable();
+ }
+*/
+ aLbColor.SetNoSelection();
+
+ if ( rAttrs.GetItemState( XATTR_LINECOLOR ) != SFX_ITEM_DONTCARE )
+ {
+ Color aCol = ( ( const XLineColorItem& ) rAttrs.Get( XATTR_LINECOLOR ) ).GetColorValue();
+ aLbColor.SelectEntry( aCol );
+ if( aLbColor.GetSelectEntryCount() == 0 )
+ {
+ aLbColor.InsertEntry( aCol, String() );
+ aLbColor.SelectEntry( aCol );
+ }
+ }
+
+ // LinienAnfang
+ if( bObjSelected &&
+ rAttrs.GetItemState( XATTR_LINESTART ) == SFX_ITEM_DEFAULT )
+ {
+ aLbStartStyle.Disable();
+ }
+ else if( rAttrs.GetItemState( XATTR_LINESTART ) != SFX_ITEM_DONTCARE )
+ {
+ // #86265# select entry using list and polygon, not string
+ sal_Bool bSelected(FALSE);
+ const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineStartItem&)rAttrs.Get(XATTR_LINESTART)).GetLineStartValue();
+
+ for(sal_Int32 a(0);!bSelected && a < pLineEndList->Count(); a++)
+ {
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a);
+ const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
+
+ if(rItemPolygon == rEntryPolygon)
+ {
+ // select this entry
+ aLbStartStyle.SelectEntryPos((sal_uInt16)a + 1);
+ bSelected = TRUE;
+ }
+ }
+
+ if(!bSelected)
+ aLbStartStyle.SelectEntryPos( 0 );
+ }
+ else
+ {
+ aLbStartStyle.SetNoSelection();
+ }
+
+ // LinienEnde
+ if( bObjSelected &&
+ rAttrs.GetItemState( XATTR_LINEEND ) == SFX_ITEM_DEFAULT )
+ {
+ aLbEndStyle.Disable();
+ }
+ else if( rAttrs.GetItemState( XATTR_LINEEND ) != SFX_ITEM_DONTCARE )
+ {
+ // #86265# select entry using list and polygon, not string
+ sal_Bool bSelected(FALSE);
+ const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineEndItem&)rAttrs.Get(XATTR_LINEEND)).GetLineEndValue();
+
+ for(sal_Int32 a(0);!bSelected && a < pLineEndList->Count(); a++)
+ {
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a);
+ const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
+
+ if(rItemPolygon == rEntryPolygon)
+ {
+ // select this entry
+ aLbEndStyle.SelectEntryPos((sal_uInt16)a + 1);
+ bSelected = TRUE;
+ }
+ }
+
+ if(!bSelected)
+ aLbEndStyle.SelectEntryPos( 0 );
+ }
+ else
+ {
+ aLbEndStyle.SetNoSelection();
+ }
+
+ // LinienAnfang St"arke
+ if( bObjSelected &&
+ rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) == SFX_ITEM_DEFAULT )
+ {
+ aMtrStartWidth.Disable();
+ }
+ else if( rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) != SFX_ITEM_DONTCARE )
+ {
+ SetMetricValue( aMtrStartWidth, ( ( const XLineStartWidthItem& ) rAttrs.
+ Get( XATTR_LINESTARTWIDTH ) ).GetValue(), ePoolUnit );
+ }
+ else
+ aMtrStartWidth.SetText( String() );
+
+ // LinienEnde St"arke
+ if( bObjSelected &&
+ rAttrs.GetItemState( XATTR_LINEENDWIDTH ) == SFX_ITEM_DEFAULT )
+ {
+ aMtrEndWidth.Disable();
+ }
+ else if( rAttrs.GetItemState( XATTR_LINEENDWIDTH ) != SFX_ITEM_DONTCARE )
+ {
+ SetMetricValue( aMtrEndWidth, ( ( const XLineEndWidthItem& ) rAttrs.
+ Get( XATTR_LINEENDWIDTH ) ).GetValue(), ePoolUnit );
+ }
+ else
+ aMtrEndWidth.SetText( String() );
+
+ // Linienenden zentriert (Start)
+ if( bObjSelected &&
+ rAttrs.GetItemState( XATTR_LINESTARTCENTER ) == SFX_ITEM_DEFAULT )
+ {
+ aTsbCenterStart.Disable();
+ }
+ else if( rAttrs.GetItemState( XATTR_LINESTARTCENTER ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbCenterStart.EnableTriState( FALSE );
+
+ if( ( ( const XLineStartCenterItem& ) rAttrs.Get( XATTR_LINESTARTCENTER ) ).GetValue() )
+ aTsbCenterStart.SetState( STATE_CHECK );
+ else
+ aTsbCenterStart.SetState( STATE_NOCHECK );
+ }
+ else
+ {
+ aTsbCenterStart.SetState( STATE_DONTKNOW );
+ }
+
+ // Linienenden zentriert (Ende)
+ if( bObjSelected &&
+ rAttrs.GetItemState( XATTR_LINEENDCENTER ) == SFX_ITEM_DEFAULT )
+ {
+ aTsbCenterEnd.Disable();
+ }
+ else if( rAttrs.GetItemState( XATTR_LINEENDCENTER ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbCenterEnd.EnableTriState( FALSE );
+
+ if( ( ( const XLineEndCenterItem& ) rAttrs.Get( XATTR_LINEENDCENTER ) ).GetValue() )
+ aTsbCenterEnd.SetState( STATE_CHECK );
+ else
+ aTsbCenterEnd.SetState( STATE_NOCHECK );
+ }
+ else
+ {
+ aTsbCenterEnd.SetState( STATE_DONTKNOW );
+ }
+
+ // Transparenz
+ if( rAttrs.GetItemState( XATTR_LINETRANSPARENCE ) != SFX_ITEM_DONTCARE )
+ {
+ USHORT nTransp = ( ( const XLineTransparenceItem& ) rAttrs.
+ Get( XATTR_LINETRANSPARENCE ) ).GetValue();
+ aMtrTransparent.SetValue( nTransp );
+ ChangeTransparentHdl_Impl( NULL );
+ }
+ else
+ aMtrTransparent.SetText( String() );
+
+ if( !aLbStartStyle.IsEnabled() &&
+ !aLbEndStyle.IsEnabled() &&
+ !aMtrStartWidth.IsEnabled() &&
+ !aMtrEndWidth.IsEnabled() &&
+ !aTsbCenterStart.IsEnabled()&&
+ !aTsbCenterEnd.IsEnabled() )
+ {
+ aCbxSynchronize.Disable();
+ aFtLineEndsStyle.Disable();
+ aFtLineEndsWidth.Disable();
+ aFlLineEnds.Disable();
+ }
+
+ // Synchronisieren
+ // Jetzt wird der Wert aus der INI-Datei geholt (#42258#)
+ String aStr = GetUserData();
+ aCbxSynchronize.Check( (BOOL)aStr.ToInt32() );
+
+ // #116827#
+ if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINEJOINT))
+ {
+ maFTEdgeStyle.Disable();
+ maLBEdgeStyle.Disable();
+ }
+ else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINEJOINT))
+ {
+ XLineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue();
+
+ switch(eLineJoint)
+ {
+ case XLINEJOINT_ROUND : maLBEdgeStyle.SelectEntryPos(0); break;
+ case XLINEJOINT_NONE : maLBEdgeStyle.SelectEntryPos(1); break;
+ case XLINEJOINT_MITER : maLBEdgeStyle.SelectEntryPos(2); break;
+ case XLINEJOINT_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break;
+ case XLINEJOINT_MIDDLE : break;
+ }
+ }
+ else
+ {
+ maLBEdgeStyle.SetNoSelection();
+ }
+
+ /*
+ if( aLbStartStyle.GetSelectEntryPos() == aLbEndStyle.GetSelectEntryPos() &&
+ aMtrStartWidth.GetValue() == aMtrEndWidth.GetValue() &&
+ aTsbCenterStart.GetState() == aTsbCenterEnd.GetState() )
+ {
+ aCbxSynchronize.Check();
+ }
+ */
+
+ // Werte sichern
+ aLbLineStyle.SaveValue();
+ aMtrLineWidth.SaveValue();
+ aLbColor.SaveValue();
+ aLbStartStyle.SaveValue();
+ aLbEndStyle.SaveValue();
+ aMtrStartWidth.SaveValue();
+ aMtrEndWidth.SaveValue();
+ aTsbCenterStart.SaveValue();
+ aTsbCenterEnd.SaveValue();
+ aMtrTransparent.SaveValue();
+
+ // #116827#
+ maLBEdgeStyle.SaveValue();
+
+ ClickInvisibleHdl_Impl( this );
+ //ClickMeasuringHdl_Impl( this );
+ //aCtlPosition.Reset();
+
+ ChangePreviewHdl_Impl( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxLineTabPage::Create( Window* pWindow,
+ const SfxItemSet& rAttrs )
+{
+ return( new SvxLineTabPage( pWindow, rAttrs ) );
+}
+
+//------------------------------------------------------------------------
+
+USHORT* SvxLineTabPage::GetRanges()
+{
+ return( pLineRanges );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineTabPage, ChangePreviewHdl_Impl, void *, pCntrl )
+{
+ if(pCntrl == &aMtrLineWidth)
+ {
+ // Linienbreite und Start/EndBreite
+ INT32 nNewLineWidth = GetCoreValue( aMtrLineWidth, ePoolUnit );
+ if(nActLineWidth == -1)
+ {
+ // Noch nicht initialisiert, hole den Startwert
+ const SfxPoolItem* pOld = GetOldItem( rXLSet, XATTR_LINEWIDTH );
+ INT32 nStartLineWidth = 0;
+ if(pOld)
+ nStartLineWidth = (( const XLineWidthItem *)pOld)->GetValue();
+ nActLineWidth = nStartLineWidth;
+ }
+
+ if(nActLineWidth != nNewLineWidth)
+ {
+ // Anpassungen Start/EndWidth #63083#
+ INT32 nValAct = GetCoreValue( aMtrStartWidth, ePoolUnit );
+ INT32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
+ if(nValNew < 0)
+ nValNew = 0;
+ SetMetricValue( aMtrStartWidth, nValNew, ePoolUnit );
+
+ nValAct = GetCoreValue( aMtrEndWidth, ePoolUnit );
+ nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
+ if(nValNew < 0)
+ nValNew = 0;
+ SetMetricValue( aMtrEndWidth, nValNew, ePoolUnit );
+ }
+
+ // Aktuellen Wert merken
+ nActLineWidth = nNewLineWidth;
+ }
+
+ FillXLSet_Impl();
+ aCtlPreview.Invalidate();
+
+ // Transparenz entspr. zugaenglich machen
+ if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar
+ {
+ aFtTransparent.Disable();
+ aMtrTransparent.Disable();
+ }
+ else
+ {
+ aFtTransparent.Enable();
+ aMtrTransparent.Enable();
+ }
+
+ const bool bHasLineStart = aLbStartStyle.GetSelectEntryPos() != 0;
+ const bool bHasLineEnd = aLbEndStyle.GetSelectEntryPos() != 0;
+
+ aFtLineEndsWidth.Enable( bHasLineStart || bHasLineEnd );
+ aMtrStartWidth.Enable( bHasLineStart );
+ aTsbCenterStart.Enable( bHasLineStart );
+ aMtrEndWidth.Enable( bHasLineEnd );
+ aTsbCenterEnd.Enable( bHasLineEnd );
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineTabPage, ChangeStartHdl_Impl, void *, p )
+{
+ if( aCbxSynchronize.IsChecked() )
+ {
+ if( p == &aMtrStartWidth )
+ aMtrEndWidth.SetValue( aMtrStartWidth.GetValue() );
+ if( p == &aLbStartStyle )
+ aLbEndStyle.SelectEntryPos( aLbStartStyle.GetSelectEntryPos() );
+ if( p == &aTsbCenterStart )
+ aTsbCenterEnd.SetState( aTsbCenterStart.GetState() );
+ }
+
+ ChangePreviewHdl_Impl( this );
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+// #116827#
+
+IMPL_LINK( SvxLineTabPage, ChangeEdgeStyleHdl_Impl, void *, EMPTYARG )
+{
+ ChangePreviewHdl_Impl( this );
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG )
+{
+ if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar
+ {
+ aFtColor.Disable();
+ if(!bSymbols)
+ aLbColor.Disable();
+ aFtLineWidth.Disable();
+ aMtrLineWidth.Disable();
+
+ if( aFlLineEnds.IsEnabled() )
+ {
+ aFtLineEndsStyle.Disable();
+ aFtLineEndsWidth.Disable();
+ aLbStartStyle.Disable();
+ aMtrStartWidth.Disable();
+ aTsbCenterStart.Disable();
+ aLbEndStyle.Disable();
+ aMtrEndWidth.Disable();
+ aTsbCenterEnd.Disable();
+ aCbxSynchronize.Disable();
+
+ // #116827#
+ maFTEdgeStyle.Disable();
+ maLBEdgeStyle.Disable();
+ }
+ }
+ else
+ {
+ aFtColor.Enable();
+ aLbColor.Enable();
+ aFtLineWidth.Enable();
+ aMtrLineWidth.Enable();
+
+ if( aFlLineEnds.IsEnabled() )
+ {
+ aFtLineEndsStyle.Enable();
+ aFtLineEndsWidth.Enable();
+ aLbStartStyle.Enable();
+ aMtrStartWidth.Enable();
+ aTsbCenterStart.Enable();
+ aLbEndStyle.Enable();
+ aMtrEndWidth.Enable();
+ aTsbCenterEnd.Enable();
+ aCbxSynchronize.Enable();
+
+ // #116827#
+ maFTEdgeStyle.Enable();
+ maLBEdgeStyle.Enable();
+ }
+ }
+ ChangePreviewHdl_Impl( NULL );
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineTabPage, ChangeEndHdl_Impl, void *, p )
+{
+ if( aCbxSynchronize.IsChecked() )
+ {
+ if( p == &aMtrEndWidth )
+ aMtrStartWidth.SetValue( aMtrEndWidth.GetValue() );
+ if( p == &aLbEndStyle )
+ aLbStartStyle.SelectEntryPos( aLbEndStyle.GetSelectEntryPos() );
+ if( p == &aTsbCenterEnd )
+ aTsbCenterStart.SetState( aTsbCenterEnd.GetState() );
+ }
+
+ ChangePreviewHdl_Impl( this );
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+/*
+
+long SvxLineTabPage::ClickMeasuringHdl_Impl( void* )
+{
+ if( aTsbShowMeasuring.GetState() == STATE_NOCHECK )
+ {
+ aFtPosition.Disable();
+ aCtlPosition.Disable();
+ }
+ else
+ {
+ aFtPosition.Enable();
+ aCtlPosition.Enable();
+ }
+ aCtlPosition.Invalidate();
+
+ return( 0L );
+}
+*/
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineTabPage, ChangeTransparentHdl_Impl, void *, EMPTYARG )
+{
+ UINT16 nVal = (UINT16)aMtrTransparent.GetValue();
+ XLineTransparenceItem aItem( nVal );
+
+ rXLSet.Put( XLineTransparenceItem( aItem ) );
+
+ // #116827#
+ FillXLSet_Impl();
+
+ aCtlPreview.Invalidate();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+void SvxLineTabPage::PointChanged( Window*, RECT_POINT eRcPt )
+{
+ eRP = eRcPt;
+}
+
+//------------------------------------------------------------------------
+
+void SvxLineTabPage::FillUserData()
+{
+ // Abgleich wird in der Ini-Datei festgehalten
+ UniString aStrUserData = UniString::CreateFromInt32( (sal_Int32) aCbxSynchronize.IsChecked() );
+ SetUserData( aStrUserData );
+}
+
+
+//#58425# Symbole auf einer Linie (z.B. StarChart)
+//Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton)
+//der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage
+IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
+{
+ //Popup initialisieren
+ if(!pButton->GetPopupMenu()->GetPopupMenu( MN_GALLERY ))
+ {
+ // Gallery-Eintraege besorgen
+ GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
+
+ PopupMenu* pPopup = new PopupMenu;
+ String aEmptyStr;
+ SfxObjectShell *pDocSh = SfxObjectShell::Current();
+
+ nNumMenuGalleryItems=aGrfNames.Count();
+ for(long i = 0; i < nNumMenuGalleryItems; i++)
+ {
+ const String* pGrfName = (const String*)aGrfNames.GetObject(i);
+ const String* pUIName = pGrfName;
+
+ // convert URL encodings to UI characters (eg %20 for spaces)
+ String aPhysicalName;
+ if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( *pGrfName, aPhysicalName ))
+ pUIName = &aPhysicalName;
+
+ SvxBrushItem* pBrushItem = new SvxBrushItem(*pGrfName, aEmptyStr, GPOS_AREA, SID_ATTR_BRUSH);
+ pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
+
+ SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
+ pInfo->pBrushItem = pBrushItem;
+ pInfo->nItemId = (UINT16)(MN_GALLERY_ENTRY + i);
+ aGrfBrushItems.Insert(pInfo, i);
+ const Graphic* pGraphic = pBrushItem->GetGraphic(pDocSh);
+
+ if(pGraphic)
+ {
+ Bitmap aBitmap(pGraphic->GetBitmap());
+ Size aSize(aBitmap.GetSizePixel());
+ if(aSize.Width() > MAX_BMP_WIDTH ||
+ aSize.Height() > MAX_BMP_HEIGHT)
+ {
+ BOOL bWidth = aSize.Width() > aSize.Height();
+ double nScale = bWidth ?
+ (double)MAX_BMP_WIDTH / (double)aSize.Width():
+ (double)MAX_BMP_HEIGHT / (double)aSize.Height();
+ aBitmap.Scale(nScale, nScale);
+
+ }
+ Image aImage(aBitmap);
+ pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
+ }
+ else
+ {
+ Image aImage;
+ pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
+ }
+ }
+ aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup );
+ if(!aGrfNames.Count())
+ aSymbolMB.GetPopupMenu()->EnableItem(MN_GALLERY, FALSE);
+ }
+
+ if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && pSymbolList)
+ {
+ VirtualDevice aVDev;
+ aVDev.SetMapMode(MapMode(MAP_100TH_MM));
+ SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
+ pModel->GetItemPool().FreezeIdRanges();
+ // Page
+ SdrPage* pPage = new SdrPage( *pModel, FALSE );
+ pPage->SetSize(Size(1000,1000));
+ pModel->InsertPage( pPage, 0 );
+ // 3D View
+ SdrView* pView = new SdrView( pModel, &aVDev );
+ pView->hideMarkHandles();
+// SdrPageView* pPageView = pView->ShowSdrPage(pPage, Point());
+ SdrPageView* pPageView = pView->ShowSdrPage(pPage);
+
+ PopupMenu* pPopup = new PopupMenu;
+ String aEmptyStr;
+ for(long i=0;; ++i)
+ {
+ SdrObject *pObj=pSymbolList->GetObj(i);
+ if(pObj==NULL)
+ break;
+ pObj=pObj->Clone();
+ //const String* pGrfName = (const String*)aGrfNames.GetObject(i);
+ String *pStr=new String();//String(i));
+ aGrfNames.Insert(pStr,LIST_APPEND);
+ //Rectangle aRect(pObj->GetLogicRect());
+ pPage->NbcInsertObject(pObj);
+ pView->MarkObj(pObj,pPageView);
+ if(pSymbolAttr)
+ {
+ pObj->SetMergedItemSet(*pSymbolAttr);
+ }
+ else
+ {
+ pObj->SetMergedItemSet(rOutAttrs);
+ }
+
+ Bitmap aBitmap(pView->GetAllMarkedBitmap());
+ GDIMetaFile aMeta(pView->GetAllMarkedMetaFile());
+ pView->UnmarkAll();
+ pObj=pPage->RemoveObject(0);
+ SdrObject::Free(pObj);
+
+ SvxBrushItem* pBrushItem = new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH);
+ pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
+
+ SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
+ pInfo->pBrushItem = pBrushItem;
+ pInfo->nItemId = (UINT16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems);
+ aGrfBrushItems.Insert(pInfo, nNumMenuGalleryItems + i);
+
+ Size aSize(aBitmap.GetSizePixel());
+ if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
+ {
+ BOOL bWidth = aSize.Width() > aSize.Height();
+ double nScale = bWidth ?
+ (double)MAX_BMP_WIDTH / (double)aSize.Width():
+ (double)MAX_BMP_HEIGHT / (double)aSize.Height();
+ aBitmap.Scale(nScale, nScale);
+ }
+ Image aImage(aBitmap);
+ pPopup->InsertItem(pInfo->nItemId,*pStr,aImage);
+ }
+ aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup );
+ if(!aGrfNames.Count())
+ aSymbolMB.GetPopupMenu()->EnableItem(MN_SYMBOLS, FALSE);
+
+ delete pView;
+ delete pModel;
+ }
+ return 0;
+}
+//#58425# Symbole auf einer Linie (z.B. StarChart)
+//Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton)
+//der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage:
+IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem)
+{
+ PopupMenu* pPopup = pThis->aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
+
+ SvxBmpItemInfo* pBmpInfo = 0;
+ for ( USHORT i = 0; i < pThis->aGrfBrushItems.Count(); i++ )
+ {
+ SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)pThis->aGrfBrushItems.GetObject(i);
+ if( pInfo->pBrushItem == pItem )
+ {
+ pBmpInfo = pInfo; break;
+ }
+ }
+ if( pBmpInfo )
+ {
+ if( pItem->GetGraphic() )
+ {
+ Bitmap aBitmap(pItem->GetGraphic()->GetBitmap());
+ Size aSize(aBitmap.GetSizePixel());
+ if(aSize.Width() > MAX_BMP_WIDTH ||
+ aSize.Height() > MAX_BMP_HEIGHT)
+ {
+ BOOL bWidth = aSize.Width() > aSize.Height();
+ double nScale = bWidth ?
+ (double)MAX_BMP_WIDTH / (double)aSize.Width():
+ (double)MAX_BMP_HEIGHT / (double)aSize.Height();
+ aBitmap.Scale(nScale, nScale);
+ }
+ Image aImage(aBitmap);
+ pPopup->SetItemImage( pBmpInfo->nItemId, aImage );
+ }
+ }
+
+ return 0;
+}
+
+//#58425# Symbole auf einer Linie (z.B. StarChart)
+//Handler f�r Menuebutton
+IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton )
+{
+ USHORT nItemId = pButton->GetCurItemId();
+ const Graphic* pGraphic = 0;
+ Graphic aGraphic;
+ String aGrfName;
+ BOOL bResetSize = FALSE;
+ BOOL bEnable=TRUE;
+ long nPreviousSymbolType = nSymbolType;
+
+ if(nItemId >= MN_GALLERY_ENTRY)
+ {
+ if( (nItemId-MN_GALLERY_ENTRY) >= nNumMenuGalleryItems)
+ {
+ nSymbolType=nItemId-MN_GALLERY_ENTRY-nNumMenuGalleryItems; //Index der Liste
+ }
+ else
+ {
+ nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
+ bResetSize = TRUE;
+ }
+ SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.GetObject(nItemId - MN_GALLERY_ENTRY);
+ pGraphic = pInfo->pBrushItem->GetGraphic();
+ }
+ else switch(nItemId)
+ {
+ case MN_SYMBOLS_AUTO:
+ {
+ pGraphic=&aAutoSymbolGraphic;
+ aAutoSymbolGraphic.SetPrefSize( Size(253,253) );
+ nSymbolType=SVX_SYMBOLTYPE_AUTO;
+ }
+ break;
+
+ case MN_SYMBOLS_NONE:
+ {
+ nSymbolType=SVX_SYMBOLTYPE_NONE;
+ pGraphic=NULL;
+ bEnable=FALSE;
+ }
+ break;
+ default:
+ {
+ SvxOpenGraphicDialog aGrfDlg(SVX_RES(RID_STR_EDIT_GRAPHIC));
+ aGrfDlg.EnableLink(sal_False);
+ aGrfDlg.AsLink(sal_False);
+ if( !aGrfDlg.Execute() )
+ {
+ // ausgewaehlten Filter merken
+ aGrfName = aGrfDlg.GetPath();
+ if( !aGrfDlg.GetGraphic(aGraphic) )
+ {
+ nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
+ pGraphic = &aGraphic;
+ bResetSize = TRUE;
+ }
+ }
+ if( !pGraphic )
+ return 0;
+ }
+ break;
+ }
+
+ if(pGraphic)
+ {
+ Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic);
+ aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)ePoolUnit);
+ aSymbolGraphic=*pGraphic;
+ if( bResetSize )
+ {
+ aSymbolSize=aSize;
+ }
+ else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM )
+ { //#i31097# Data Point Symbol size changes when a different symbol is choosen(maoyg)
+ if( aSymbolSize.Width() != aSymbolSize.Height() )
+ {
+ aSize.setWidth( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
+ aSize.setHeight( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
+ aSymbolSize = aSize;
+ }
+ }
+ aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
+ }
+ else
+ {
+ aSymbolGraphic=Graphic();
+ aCtlPreview.SetSymbol(NULL,aSymbolSize);
+ bEnable=FALSE;
+ }
+ aSymbolLastSize=aSymbolSize;
+ SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit);
+ SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(), ePoolUnit);
+ aSymbolRatioCB.Enable(bEnable);
+ aSymbolHeightFT.Enable(bEnable);
+ aSymbolWidthFT.Enable(bEnable);
+ aSymbolWidthMF.Enable(bEnable);
+ aSymbolHeightMF.Enable(bEnable);
+ aCtlPreview.Invalidate();
+
+ return 0;
+}
+IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, MetricField *, pField)
+{
+ bNewSize=true;
+ BOOL bWidth = (BOOL)(pField == &aSymbolWidthMF);
+ bLastWidthModified = bWidth;
+ BOOL bRatio = aSymbolRatioCB.IsChecked();
+ long nWidthVal = static_cast<long>(aSymbolWidthMF.Denormalize(aSymbolWidthMF.GetValue(FUNIT_100TH_MM)));
+ long nHeightVal= static_cast<long>(aSymbolHeightMF.Denormalize(aSymbolHeightMF.GetValue(FUNIT_100TH_MM)));
+ nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MAP_100TH_MM,(MapUnit)ePoolUnit );
+ nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MAP_100TH_MM,(MapUnit)ePoolUnit);
+ aSymbolSize=Size(nWidthVal,nHeightVal);
+ double fSizeRatio = (double)1;
+
+ if(bRatio)
+ {
+ if (aSymbolLastSize.Height() && aSymbolLastSize.Width())
+ fSizeRatio = (double)aSymbolLastSize.Width() / aSymbolLastSize.Height();
+ }
+
+ //Size aSymbolSize(aSymbolLastSize);
+
+ if(bWidth)
+ {
+ long nDelta = nWidthVal - aSymbolLastSize.Width();
+ aSymbolSize.Width() = nWidthVal;
+ if (bRatio)
+ {
+ aSymbolSize.Height() = aSymbolLastSize.Height() + (long)((double)nDelta / fSizeRatio);
+ aSymbolSize.Height() = OutputDevice::LogicToLogic( aSymbolSize.Height(),(MapUnit)ePoolUnit, MAP_100TH_MM );
+ aSymbolHeightMF.SetUserValue(aSymbolHeightMF.Normalize(aSymbolSize.Height()), FUNIT_100TH_MM);
+ }
+ }
+ else
+ {
+ long nDelta = nHeightVal - aSymbolLastSize.Height();
+ aSymbolSize.Height() = nHeightVal;
+ if (bRatio)
+ {
+ aSymbolSize.Width() = aSymbolLastSize.Width() + (long)((double)nDelta * fSizeRatio);
+ aSymbolSize.Width() = OutputDevice::LogicToLogic( aSymbolSize.Width(),
+ (MapUnit)ePoolUnit, MAP_100TH_MM );
+ aSymbolWidthMF.SetUserValue(aSymbolWidthMF.Normalize(aSymbolSize.Width()), FUNIT_100TH_MM);
+ }
+ }
+ aCtlPreview.ResizeSymbol(aSymbolSize);
+ aSymbolLastSize=aSymbolSize;
+ return 0;
+}
+IMPL_LINK( SvxLineTabPage, RatioHdl_Impl, CheckBox *, pBox )
+{
+ if (pBox->IsChecked())
+ {
+ if (bLastWidthModified)
+ SizeHdl_Impl(&aSymbolWidthMF);
+ else
+ SizeHdl_Impl(&aSymbolHeightMF);
+ }
+ return 0;
+}
+
+
+void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SvxTabPage::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ FillListboxes();
+ }
+}
+
+void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pDashListItem,SvxDashListItem,SID_DASH_LIST,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pLineEndListItem,SvxLineEndListItem,SID_LINEEND_LIST,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pSdrObjListItem,OfaPtrItem,SID_OBJECT_LIST,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pSymbolAttrItem,SfxTabDialogItem,SID_ATTR_SET,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pGraphicItem,SvxGraphicItem,SID_GRAPHIC,sal_False);
+
+ if (pColorTabItem)
+ SetColorTable(pColorTabItem->GetColorTable());
+ if (pDashListItem)
+ SetDashList(pDashListItem->GetDashList());
+ if (pLineEndListItem)
+ SetLineEndList(pLineEndListItem->GetLineEndList());
+ if (pPageTypeItem)
+ SetPageType(pPageTypeItem->GetValue());
+ if (pDlgTypeItem)
+ SetDlgType(pDlgTypeItem->GetValue());
+ Construct();
+
+ if(pSdrObjListItem) //symbols
+ {
+ ShowSymbolControls(TRUE);
+ pSymbolList = static_cast<SdrObjList*>(pSdrObjListItem->GetValue());
+ if (pSymbolAttrItem)
+ pSymbolAttr = new SfxItemSet(pSymbolAttrItem->GetItemSet());
+ if(pGraphicItem)
+ aAutoSymbolGraphic = pGraphicItem->GetGraphic();
+ }
+}
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
new file mode 100644
index 000000000000..776b5184d760
--- /dev/null
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -0,0 +1,1020 @@
+/*************************************************************************
+ *
+ * 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: tplnedef.cxx,v $
+ * $Revision: 1.31 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+
+#define _SVX_TPLNEDEF_CXX
+
+#include <svx/dialogs.hrc>
+#include "tabline.hrc"
+//#include "dlgname.hrc"
+#include "helpid.hrc"
+
+#include "svx/xattr.hxx"
+#include <svx/xpool.hxx>
+#include <svx/xtable.hxx>
+
+#include "svx/drawitem.hxx"
+#include "cuitabline.hxx"
+#include "defdlgname.hxx" //CHINA001 #include "dlgname.hxx"
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+
+#define DLGWIN this->GetParent()->GetParent()
+
+#define BITMAP_WIDTH 32
+#define BITMAP_HEIGHT 12
+#define XOUT_WIDTH 150
+
+/*************************************************************************
+|*
+|* Dialog zum Definieren von Linienstilen
+|*
+\************************************************************************/
+
+SvxLineDefTabPage::SvxLineDefTabPage
+(
+ Window* pParent,
+ const SfxItemSet& rInAttrs
+) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_LINE_DEF ), rInAttrs ),
+
+ aFlDefinition ( this, SVX_RES( FL_DEFINITION ) ),
+ aFTLinestyle ( this, SVX_RES( FT_LINESTYLE ) ),
+ aLbLineStyles ( this, SVX_RES( LB_LINESTYLES ) ),
+ aFtType ( this, SVX_RES( FT_TYPE ) ),
+ aLbType1 ( this, SVX_RES( LB_TYPE_1 ) ),
+ aLbType2 ( this, SVX_RES( LB_TYPE_2 ) ),
+ aFtNumber ( this, SVX_RES( FT_NUMBER ) ),
+ aNumFldNumber1 ( this, SVX_RES( NUM_FLD_1 ) ),
+ aNumFldNumber2 ( this, SVX_RES( NUM_FLD_2 ) ),
+ aFtLength ( this, SVX_RES( FT_LENGTH ) ),
+ aMtrLength1 ( this, SVX_RES( MTR_FLD_LENGTH_1 ) ),
+ aMtrLength2 ( this, SVX_RES( MTR_FLD_LENGTH_2 ) ),
+ aFtDistance ( this, SVX_RES( FT_DISTANCE ) ),
+ aMtrDistance ( this, SVX_RES( MTR_FLD_DISTANCE ) ),
+ aCbxSynchronize ( this, SVX_RES( CBX_SYNCHRONIZE ) ),
+ aBtnAdd ( this, SVX_RES( BTN_ADD ) ),
+ aBtnModify ( this, SVX_RES( BTN_MODIFY ) ),
+ aBtnDelete ( this, SVX_RES( BTN_DELETE ) ),
+ aBtnLoad ( this, SVX_RES( BTN_LOAD ) ),
+ aBtnSave ( this, SVX_RES( BTN_SAVE ) ),
+ aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ),
+
+ rOutAttrs ( rInAttrs ),
+
+ pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
+ aXLStyle ( XLINE_DASH ),
+ aXWidth ( XOUT_WIDTH ),
+ aXDash ( String(), XDash( XDASH_RECT, 3, 7, 2, 40, 15 ) ),
+ aXColor ( String(), COL_BLACK ),
+ aXLineAttr ( pXPool ),
+ rXLSet ( aXLineAttr.GetItemSet() )
+{
+ aBtnLoad.SetModeImage( Image( SVX_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST );
+ aBtnSave.SetModeImage( Image( SVX_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST );
+
+ FreeResource();
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ // Metrik einstellen
+ eFUnit = GetModuleFieldUnit( &rInAttrs );
+
+ switch ( eFUnit )
+ {
+ case FUNIT_M:
+ case FUNIT_KM:
+ eFUnit = FUNIT_MM;
+ break;
+ default: ; //prevent warning
+ }
+ SetFieldUnit( aMtrDistance, eFUnit );
+ SetFieldUnit( aMtrLength1, eFUnit );
+ SetFieldUnit( aMtrLength2, eFUnit );
+
+ // PoolUnit ermitteln
+ SfxItemPool* pPool = rOutAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool?" );
+ ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
+
+ rXLSet.Put( aXLStyle );
+ rXLSet.Put( aXWidth );
+ rXLSet.Put( aXDash );
+ rXLSet.Put( aXColor );
+
+ // #i34740#
+ aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
+
+ aBtnAdd.SetClickHdl( LINK( this, SvxLineDefTabPage, ClickAddHdl_Impl ) );
+ aBtnModify.SetClickHdl(
+ LINK( this, SvxLineDefTabPage, ClickModifyHdl_Impl ) );
+ aBtnDelete.SetClickHdl(
+ LINK( this, SvxLineDefTabPage, ClickDeleteHdl_Impl ) );
+ aBtnLoad.SetClickHdl( LINK( this, SvxLineDefTabPage, ClickLoadHdl_Impl ) );
+ aBtnSave.SetClickHdl( LINK( this, SvxLineDefTabPage, ClickSaveHdl_Impl ) );
+
+ aNumFldNumber1.SetModifyHdl(
+ LINK( this, SvxLineDefTabPage, ChangeNumber1Hdl_Impl ) );
+ aNumFldNumber2.SetModifyHdl(
+ LINK( this, SvxLineDefTabPage, ChangeNumber2Hdl_Impl ) );
+ aLbLineStyles.SetSelectHdl(
+ LINK( this, SvxLineDefTabPage, SelectLinestyleHdl_Impl ) );
+
+ // Absolut (in mm) oder Relativ (in %)
+ aCbxSynchronize.SetClickHdl(
+ LINK( this, SvxLineDefTabPage, ChangeMetricHdl_Impl ) );
+
+ // Wenn sich etwas aendert, muss Preview upgedatet werden werden
+ Link aLink = LINK( this, SvxLineDefTabPage, SelectTypeHdl_Impl );
+ aLbType1.SetSelectHdl( aLink );
+ aLbType2.SetSelectHdl( aLink );
+ aLink = LINK( this, SvxLineDefTabPage, ChangePreviewHdl_Impl );
+ aMtrLength1.SetModifyHdl( aLink );
+ aMtrLength2.SetModifyHdl( aLink );
+ aMtrDistance.SetModifyHdl( aLink );
+
+ pDashList = NULL;
+}
+
+
+// -----------------------------------------------------------------------
+
+void SvxLineDefTabPage::Construct()
+{
+ // Linienstile
+ aLbLineStyles.Fill( pDashList );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineDefTabPage::ActivatePage( const SfxItemSet& )
+{
+ if( *pDlgType == 0 ) // Flaechen-Dialog
+ {
+ // ActivatePage() wird aufgerufen bevor der Dialog PageCreated() erhaelt !!!
+ if( pDashList )
+ {
+ if( *pPageType == 1 &&
+ *pPosDashLb != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aLbLineStyles.SelectEntryPos( *pPosDashLb );
+ }
+ // Damit evtl. vorhandener Linestyle verworfen wird
+ SelectLinestyleHdl_Impl( this );
+
+ // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ INetURLObject aURL( pDashList->GetPath() );
+
+ aURL.Append( pDashList->GetName() );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+/* if ( aURL.getBase().Len() > 18 )
+ {
+ aString += aURL.getBase().Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += aURL.getBase();
+
+ aFTLinestyle.SetText( aString );
+*/
+ *pPageType = 0; // 2
+ *pPosDashLb = LISTBOX_ENTRY_NOTFOUND;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SvxLineDefTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ CheckChanges_Impl();
+
+ if( _pSet )
+ FillItemSet( *_pSet );
+
+ return( LEAVE_PAGE );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineDefTabPage::CheckChanges_Impl()
+{
+ // wird hier benutzt, um Aenderungen NICHT zu verlieren
+ //XDashStyle eXDS;
+
+ if( aNumFldNumber1.GetText() != aNumFldNumber1.GetSavedValue() ||
+ aMtrLength1.GetText() != aMtrLength1.GetSavedValue() ||
+ aLbType1.GetSelectEntryPos() != aLbType1.GetSavedValue() ||
+ aNumFldNumber2.GetText() != aNumFldNumber2.GetSavedValue() ||
+ aMtrLength2.GetText() != aMtrLength2.GetSavedValue() ||
+ aLbType2.GetSelectEntryPos() != aLbType2.GetSavedValue() ||
+ aMtrDistance.GetText() != aMtrDistance.GetSavedValue() )
+ {
+ ResMgr& rMgr = DIALOG_MGR();
+ Image aWarningBoxImage = WarningBox::GetStandardImage();
+ //CHINA001 SvxMessDialog aMessDlg( DLGWIN,
+ //CHINA001 String( ResId( RID_SVXSTR_LINESTYLE, rMgr ) ),
+ //CHINA001 String( ResId( RID_SVXSTR_ASK_CHANGE_LINESTYLE, rMgr ) ),
+ //CHINA001 &aWarningBoxImage );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX,
+ String( ResId( RID_SVXSTR_LINESTYLE, rMgr ) ),
+ String( ResId( RID_SVXSTR_ASK_CHANGE_LINESTYLE, rMgr ) ),
+ &aWarningBoxImage );
+ DBG_ASSERT(aMessDlg, "Dialogdiet fail!");//CHINA001
+ aMessDlg->SetButtonText( MESS_BTN_1, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_1,
+ String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
+ aMessDlg->SetButtonText( MESS_BTN_2, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_2,
+ String( ResId( RID_SVXSTR_ADD, rMgr ) ) );
+
+ short nRet = aMessDlg->Execute(); //CHINA001 short nRet = aMessDlg.Execute();
+
+ switch( nRet )
+ {
+ case RET_BTN_1: // Aendern
+ {
+ ClickModifyHdl_Impl( this );
+ //aXDash = pDashList->Get( nPos )->GetDash();
+ }
+ break;
+
+ case RET_BTN_2: // Hinzufuegen
+ {
+ ClickAddHdl_Impl( this );
+ //nPos = aLbLineStyles.GetSelectEntryPos();
+ //aXDash = pDashList->Get( nPos )->GetDash();
+ }
+ break;
+
+ case RET_CANCEL:
+ break;
+ // return( TRUE ); // Abbruch
+ }
+ delete aMessDlg; //add by CHINA001
+ }
+
+
+
+ USHORT nPos = aLbLineStyles.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ *pPosDashLb = nPos;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxLineDefTabPage::FillItemSet( SfxItemSet& rAttrs )
+{
+ if( *pDlgType == 0 ) // Linien-Dialog
+ {
+ if( *pPageType == 2 )
+ {
+ //CheckChanges_Impl();
+
+ FillDash_Impl();
+
+ String aString( aLbLineStyles.GetSelectEntry() );
+ rAttrs.Put( XLineStyleItem( XLINE_DASH ) );
+ rAttrs.Put( XLineDashItem( aString, aDash ) );
+ }
+ }
+ return( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineDefTabPage::Reset( const SfxItemSet& rAttrs )
+{
+ if( rAttrs.GetItemState( GetWhich( XATTR_LINESTYLE ) ) != SFX_ITEM_DONTCARE )
+ {
+ XLineStyle eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( GetWhich( XATTR_LINESTYLE ) ) ).GetValue();
+
+ switch( eXLS )
+ {
+ case XLINE_NONE:
+ case XLINE_SOLID:
+ aLbLineStyles.SelectEntryPos( 0 );
+ break;
+
+ case XLINE_DASH:
+ {
+ const XLineDashItem& rDashItem = ( const XLineDashItem& ) rAttrs.Get( XATTR_LINEDASH );
+ aDash = rDashItem.GetDashValue();
+
+ aLbLineStyles.SetNoSelection();
+ aLbLineStyles.SelectEntry( rDashItem.GetName() );
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ SelectLinestyleHdl_Impl( NULL );
+
+ // Status der Buttons ermitteln
+ if( pDashList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ else
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxLineDefTabPage::Create( Window* pWindow,
+ const SfxItemSet& rOutAttrs )
+{
+ return( new SvxLineDefTabPage( pWindow, rOutAttrs ) );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineDefTabPage, SelectLinestyleHdl_Impl, void *, p )
+{
+ if( pDashList->Count() > 0 )
+ {
+ int nTmp = aLbLineStyles.GetSelectEntryPos();
+ if( nTmp == LISTBOX_ENTRY_NOTFOUND )
+ {
+ }
+ else
+ aDash = pDashList->GetDash( nTmp )->GetDash();
+
+ FillDialog_Impl();
+
+ rXLSet.Put( XLineDashItem( String(), aDash ) );
+
+ // #i34740#
+ aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
+
+ aCtlPreview.Invalidate();
+
+ // Wird erst hier gesetzt, um den Style nur dann zu uebernehmen,
+ // wenn in der ListBox ein Eintrag ausgewaehlt wurde
+ // Wenn ueber Reset() gerufen wurde ist p == NULL
+ if( p )
+ *pPageType = 2;
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxLineDefTabPage, ChangePreviewHdl_Impl, void *, EMPTYARG )
+{
+ FillDash_Impl();
+ aCtlPreview.Invalidate();
+
+ return( 0L );
+}
+IMPL_LINK_INLINE_END( SvxLineDefTabPage, ChangePreviewHdl_Impl, void *, EMPTYARG )
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineDefTabPage, ChangeNumber1Hdl_Impl, void *, EMPTYARG )
+{
+ if( aNumFldNumber1.GetValue() == 0L )
+ {
+ aNumFldNumber2.SetMin( 1L );
+ aNumFldNumber2.SetFirst( 1L );
+ }
+ else
+ {
+ aNumFldNumber2.SetMin( 0L );
+ aNumFldNumber2.SetFirst( 0L );
+ }
+
+ ChangePreviewHdl_Impl( this );
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineDefTabPage, ChangeNumber2Hdl_Impl, void *, EMPTYARG )
+{
+ if( aNumFldNumber2.GetValue() == 0L )
+ {
+ aNumFldNumber1.SetMin( 1L );
+ aNumFldNumber1.SetFirst( 1L );
+ }
+ else
+ {
+ aNumFldNumber1.SetMin( 0L );
+ aNumFldNumber1.SetFirst( 0L );
+ }
+
+ ChangePreviewHdl_Impl( this );
+
+ return( 0L );
+}
+
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineDefTabPage, ChangeMetricHdl_Impl, void *, p )
+{
+ if( !aCbxSynchronize.IsChecked() && aMtrLength1.GetUnit() != eFUnit )
+ {
+ long nTmp1, nTmp2, nTmp3;
+
+ // Wurde ueber Control geaendert
+ if( p )
+ {
+ nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit ) * XOUT_WIDTH / 100;
+ nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit ) * XOUT_WIDTH / 100;
+ nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit ) * XOUT_WIDTH / 100;
+ }
+ else
+ {
+ nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit );
+ nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit );
+ nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit );
+ }
+ aMtrLength1.SetDecimalDigits( 2 );
+ aMtrLength2.SetDecimalDigits( 2 );
+ aMtrDistance.SetDecimalDigits( 2 );
+
+ // Metrik einstellen
+ aMtrLength1.SetUnit( eFUnit );
+ aMtrLength2.SetUnit( eFUnit );
+ aMtrDistance.SetUnit( eFUnit );
+
+ SetMetricValue( aMtrLength1, nTmp1, ePoolUnit );
+ SetMetricValue( aMtrLength2, nTmp2, ePoolUnit );
+ SetMetricValue( aMtrDistance, nTmp3, ePoolUnit );
+ }
+ else if( aCbxSynchronize.IsChecked() && aMtrLength1.GetUnit() != FUNIT_CUSTOM )
+ {
+ long nTmp1, nTmp2, nTmp3;
+
+ // Wurde ueber Control geaendert
+ if( p )
+ {
+ nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit ) * 100 / XOUT_WIDTH;
+ nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit ) * 100 / XOUT_WIDTH;
+ nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit ) * 100 / XOUT_WIDTH;
+ }
+ else
+ {
+ nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit );
+ nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit );
+ nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit );
+ }
+
+ aMtrLength1.SetDecimalDigits( 0 );
+ aMtrLength2.SetDecimalDigits( 0 );
+ aMtrDistance.SetDecimalDigits( 0 );
+
+ aMtrLength1.SetUnit( FUNIT_CUSTOM );
+ aMtrLength2.SetUnit( FUNIT_CUSTOM );
+ aMtrDistance.SetUnit( FUNIT_CUSTOM );
+
+
+ SetMetricValue( aMtrLength1, nTmp1, ePoolUnit );
+ SetMetricValue( aMtrLength2, nTmp2, ePoolUnit );
+ SetMetricValue( aMtrDistance, nTmp3, ePoolUnit );
+ }
+ SelectTypeHdl_Impl( NULL );
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineDefTabPage, SelectTypeHdl_Impl, void *, p )
+{
+ if ( p == &aLbType1 || !p )
+ {
+ if ( aLbType1.GetSelectEntryPos() == 0 )
+ {
+ aMtrLength1.Disable();
+ aMtrLength1.SetText( String() );
+ }
+ else if ( !aMtrLength1.IsEnabled() )
+ {
+ aMtrLength1.Enable();
+ aMtrLength1.Reformat();
+ }
+ }
+
+ if ( p == &aLbType2 || !p )
+ {
+ if ( aLbType2.GetSelectEntryPos() == 0 )
+ {
+ aMtrLength2.Disable();
+ aMtrLength2.SetText( String() );
+ }
+ else if ( !aMtrLength2.IsEnabled() )
+ {
+ aMtrLength2.Enable();
+ aMtrLength2.Reformat();
+ }
+ }
+ ChangePreviewHdl_Impl( p );
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
+{
+ ResMgr& rMgr = DIALOG_MGR();
+ String aNewName( ResId( RID_SVXSTR_LINESTYLE, rMgr ) );
+ String aDesc( ResId( RID_SVXSTR_DESC_LINESTYLE, rMgr ) );
+ String aName;
+ XDashEntry* pEntry;
+
+ long nCount = pDashList->Count();
+ long j = 1;
+ BOOL bDifferent = FALSE;
+
+ while ( !bDifferent )
+ {
+ aName = aNewName;
+ aName += sal_Unicode(' ');
+ aName += UniString::CreateFromInt32( j++ );
+ bDifferent = TRUE;
+
+ for ( long i = 0; i < nCount && bDifferent; i++ )
+ if ( aName == pDashList->GetDash( i )->GetName() )
+ bDifferent = FALSE;
+ }
+
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ BOOL bLoop = TRUE;
+
+ while ( bLoop && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ {
+ if( aName == pDashList->GetDash( i )->GetName() )
+ bDifferent = FALSE;
+ }
+
+ if( bDifferent )
+ {
+ bLoop = FALSE;
+ FillDash_Impl();
+
+ pEntry = new XDashEntry( aDash, aName );
+
+ long nDashCount = pDashList->Count();
+ pDashList->Insert( pEntry, nDashCount );
+ Bitmap* pBitmap = pDashList->GetBitmap( nDashCount );
+ aLbLineStyles.Append( pEntry, pBitmap );
+
+ aLbLineStyles.SelectEntryPos( aLbLineStyles.GetEntryCount() - 1 );
+
+ // Flag fuer modifiziert setzen
+ *pnDashListState |= CT_MODIFIED;
+
+ *pPageType = 2;
+
+ // Werte sichern fuer Changes-Erkennung ( -> Methode )
+ aNumFldNumber1.SaveValue();
+ aMtrLength1.SaveValue();
+ aLbType1.SaveValue();
+ aNumFldNumber2.SaveValue();
+ aMtrLength2.SaveValue();
+ aLbType2.SaveValue();
+ aMtrDistance.SaveValue();
+ }
+ else
+ {
+ WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+ aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
+ aBox.Execute();
+ }
+ }
+ delete( pDlg );
+
+ // Status der Buttons ermitteln
+ if ( pDashList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineDefTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbLineStyles.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ ResMgr& rMgr = DIALOG_MGR();
+ String aNewName( ResId( RID_SVXSTR_LINESTYLE, rMgr ) );
+ String aDesc( ResId( RID_SVXSTR_DESC_LINESTYLE, rMgr ) );
+ String aName( pDashList->GetDash( nPos )->GetName() );
+ String aOldName = aName;
+
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+
+ long nCount = pDashList->Count();
+ BOOL bDifferent = FALSE;
+ BOOL bLoop = TRUE;
+
+ while ( bLoop && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ {
+ if( aName == pDashList->GetDash( i )->GetName() &&
+ aName != aOldName )
+ bDifferent = FALSE;
+ }
+
+ if ( bDifferent )
+ {
+ bLoop = FALSE;
+ FillDash_Impl();
+
+ XDashEntry* pEntry = new XDashEntry( aDash, aName );
+
+ delete pDashList->Replace( pEntry, nPos );
+ Bitmap* pBitmap = pDashList->GetBitmap( nPos );
+ aLbLineStyles.Modify( pEntry, nPos, pBitmap );
+
+ aLbLineStyles.SelectEntryPos( nPos );
+
+ // Flag fuer modifiziert setzen
+ *pnDashListState |= CT_MODIFIED;
+
+ *pPageType = 2;
+
+ // Werte sichern fuer Changes-Erkennung ( -> Methode )
+ aNumFldNumber1.SaveValue();
+ aMtrLength1.SaveValue();
+ aLbType1.SaveValue();
+ aNumFldNumber2.SaveValue();
+ aMtrLength2.SaveValue();
+ aLbType2.SaveValue();
+ aMtrDistance.SaveValue();
+ }
+ else
+ {
+ WarningBox aBox( DLGWIN, WinBits( WB_OK ), String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+ aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
+ aBox.Execute();
+ }
+ }
+ delete( pDlg );
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineDefTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbLineStyles.GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+//! SVX_RES( RID_SVXSTR_DEL_LINESTYLE ),
+ String( SVX_RES( RID_SVXSTR_ASK_DEL_LINESTYLE ) ) );
+
+ if ( aQueryBox.Execute() == RET_YES )
+ {
+ delete pDashList->Remove( nPos );
+ aLbLineStyles.RemoveEntry( nPos );
+ aLbLineStyles.SelectEntryPos( 0 );
+
+ SelectLinestyleHdl_Impl( this );
+ *pPageType = 0; // Style soll nicht uebernommen werden
+
+ // Flag fuer modifiziert setzen
+ *pnDashListState |= CT_MODIFIED;
+
+ ChangePreviewHdl_Impl( this );
+ }
+ }
+
+ // Status der Buttons ermitteln
+ if ( !pDashList->Count() )
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLineDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
+{
+ ResMgr& rMgr = DIALOG_MGR();
+ USHORT nReturn = RET_YES;
+
+ if ( *pnDashListState & CT_MODIFIED )
+ {
+ nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
+ String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
+
+ if ( nReturn == RET_YES )
+ pDashList->Save();
+ }
+
+ if ( nReturn != RET_CANCEL )
+ {
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sod" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+ INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if( aDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aDlg.GetPath() );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ // Liste speichern
+ XDashList* pDshLst = new XDashList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool );
+ pDshLst->SetName( aURL.getName() );
+
+ if( pDshLst->Load() )
+ {
+ if( pDshLst )
+ {
+ // Pruefen, ob Tabelle geloescht werden darf:
+ if( pDashList != ( (SvxLineTabDialog*) DLGWIN )->GetDashList() )
+ delete pDashList;
+
+ pDashList = pDshLst;
+ ( (SvxLineTabDialog*) DLGWIN )->SetNewDashList( pDashList );
+
+ aLbLineStyles.Clear();
+ aLbLineStyles.Fill( pDashList );
+ Reset( rOutAttrs );
+
+ pDashList->SetName( aURL.getName() );
+
+/* // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aURL.getBase().Len() > 18 )
+ {
+ aString += aURL.getBase().Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += aURL.getBase();
+
+ aGrpLinestyles.SetText( aString );
+*/
+ // Flag fuer gewechselt setzen
+ *pnDashListState |= CT_CHANGED;
+ // Flag fuer modifiziert entfernen
+ *pnDashListState &= ~CT_MODIFIED;
+ }
+ }
+ else
+ //aIStream.Close();
+ ErrorBox( DLGWIN, WinBits( WB_OK ),
+ String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
+ }
+ }
+
+ // Status der Buttons ermitteln
+ if ( pDashList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ else
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLineDefTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
+{
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sod" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+
+ INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+ DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( pDashList->GetName().Len() )
+ {
+ aFile.Append( pDashList->GetName() );
+
+ if( !aFile.getExtension().getLength() )
+ aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "sod" ) ) );
+ }
+
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aDlg.GetPath() );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ pDashList->SetName( aURL.getName() );
+ pDashList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if( pDashList->Save() )
+ {
+/* // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aURL.getBase().Len() > 18 )
+ {
+ aString += aURL.getBase().Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += aURL.getBase();
+
+ aGrpLinestyles.SetText( aString );
+*/
+ // Flag fuer gespeichert setzen
+ *pnDashListState |= CT_SAVED;
+ // Flag fuer modifiziert entfernen
+ *pnDashListState &= ~CT_MODIFIED;
+ }
+ else
+ {
+ ErrorBox( DLGWIN, WinBits( WB_OK ),
+ String( SVX_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
+ }
+ }
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+void SvxLineDefTabPage::FillDash_Impl()
+{
+ XDashStyle eXDS;
+
+/* Alle Stile werden z.Z. nicht benutzt
+ if( aRbtEnds1.IsChecked() )
+ eXDS = XDASH_ROUND;
+ else if( aRbtEnds2.IsChecked() )
+ eXDS = XDASH_RECT;
+ else
+ eXDS = XDASH_RECT;
+*/
+ if( aCbxSynchronize.IsChecked() )
+ eXDS = XDASH_RECTRELATIVE;
+ else
+ eXDS = XDASH_RECT;
+
+ aDash.SetDashStyle( eXDS );
+ aDash.SetDots( (BYTE) aNumFldNumber1.GetValue() );
+ aDash.SetDotLen( aLbType1.GetSelectEntryPos() == 0 ? 0 :
+ GetCoreValue( aMtrLength1, ePoolUnit ) );
+ aDash.SetDashes( (BYTE) aNumFldNumber2.GetValue() );
+ aDash.SetDashLen( aLbType2.GetSelectEntryPos() == 0 ? 0 :
+ GetCoreValue( aMtrLength2, ePoolUnit ) );
+ aDash.SetDistance( GetCoreValue( aMtrDistance, ePoolUnit ) );
+
+ rXLSet.Put( XLineDashItem( String(), aDash ) );
+
+ // #i34740#
+ aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
+}
+
+//------------------------------------------------------------------------
+
+void SvxLineDefTabPage::FillDialog_Impl()
+{
+ XDashStyle eXDS = aDash.GetDashStyle(); // XDASH_RECT, XDASH_ROUND
+ if( eXDS == XDASH_RECTRELATIVE )
+ aCbxSynchronize.Check();
+ else
+ aCbxSynchronize.Check( FALSE );
+
+ aNumFldNumber1.SetValue( aDash.GetDots() );
+ //aMtrLength1.SetValue( aDash.GetDotLen() );
+ SetMetricValue( aMtrLength1, aDash.GetDotLen(), ePoolUnit );
+ aLbType1.SelectEntryPos( aDash.GetDotLen() == 0 ? 0 : 1 );
+ aNumFldNumber2.SetValue( aDash.GetDashes() );
+ //aMtrLength2.SetValue( aDash.GetDashLen() );
+ SetMetricValue( aMtrLength2, aDash.GetDashLen(), ePoolUnit );
+ aLbType2.SelectEntryPos( aDash.GetDashLen() == 0 ? 0 : 1 );
+ //aMtrDistance.SetValue( aDash.GetDistance() );
+ SetMetricValue( aMtrDistance, aDash.GetDistance(), ePoolUnit );
+
+ ChangeMetricHdl_Impl( NULL );
+
+ // Werte sichern fuer Changes-Erkennung ( -> Methode )
+ aNumFldNumber1.SaveValue();
+ aMtrLength1.SaveValue();
+ aLbType1.SaveValue();
+ aNumFldNumber2.SaveValue();
+ aMtrLength2.SaveValue();
+ aLbType2.SaveValue();
+ aMtrDistance.SaveValue();
+}
+
+
+void SvxLineDefTabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxTabPage::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ USHORT nOldSelect = aLbLineStyles.GetSelectEntryPos();
+ aLbLineStyles.Clear();
+ aLbLineStyles.Fill( pDashList );
+ aLbLineStyles.SelectEntryPos( nOldSelect );
+ }
+}
+
diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx
new file mode 100644
index 000000000000..a01ee39d19a3
--- /dev/null
+++ b/cui/source/tabpages/tplneend.cxx
@@ -0,0 +1,753 @@
+/*************************************************************************
+ *
+ * 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: tplneend.cxx,v $
+ * $Revision: 1.31 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+
+#define _SVX_TPLNEEND_CXX
+
+#include <svx/dialogs.hrc>
+#include "tabline.hrc"
+#include "helpid.hrc"
+
+#include <svx/svdobj.hxx>
+#include <svx/svdopath.hxx>
+#include "svx/drawitem.hxx"
+#include <svx/xpool.hxx>
+#include <svx/xtable.hxx>
+#include "cuitabline.hxx"
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+
+#define DLGWIN this->GetParent()->GetParent()
+
+#define BITMAP_WIDTH 32
+#define BITMAP_HEIGHT 12
+#define XOUT_WIDTH 150
+
+/*************************************************************************
+|*
+|* Dialog zum Definieren von Linienenden-Stilen
+|*
+\************************************************************************/
+
+SvxLineEndDefTabPage::SvxLineEndDefTabPage
+(
+ Window* pParent,
+ const SfxItemSet& rInAttrs
+) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_LINEEND_DEF ), rInAttrs ),
+
+ aFlTip ( this, SVX_RES( FL_TIP ) ),
+ aFTTitle ( this, SVX_RES( FT_TITLE ) ),
+ aEdtName ( this, SVX_RES( EDT_NAME ) ),
+ aFTLineEndStyle ( this, SVX_RES( FT_LINE_END_STYLE ) ),
+ aLbLineEnds ( this, SVX_RES( LB_LINEENDS ) ),
+ aBtnAdd ( this, SVX_RES( BTN_ADD ) ),
+ aBtnModify ( this, SVX_RES( BTN_MODIFY ) ),
+ aBtnDelete ( this, SVX_RES( BTN_DELETE ) ),
+ aBtnLoad ( this, SVX_RES( BTN_LOAD ) ),
+ aBtnSave ( this, SVX_RES( BTN_SAVE ) ),
+ aFiTip ( this, SVX_RES( FI_TIP ) ),
+ aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ),
+
+ rOutAttrs ( rInAttrs ),
+ pPolyObj( NULL ),
+
+ pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
+ aXLStyle ( XLINE_SOLID ),
+ aXWidth ( XOUT_WIDTH ),
+ aXColor ( String(), COL_BLACK ),
+ aXLineAttr ( pXPool ),
+ rXLSet ( aXLineAttr.GetItemSet() ),
+ pLineEndList( NULL )
+{
+ aBtnLoad.SetModeImage( Image( SVX_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST );
+ aBtnSave.SetModeImage( Image( SVX_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST );
+
+ FreeResource();
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ rXLSet.Put( aXLStyle );
+ rXLSet.Put( aXWidth );
+ rXLSet.Put( aXColor );
+ rXLSet.Put( XLineStartWidthItem( aCtlPreview.GetOutputSize().Height() / 2 ) );
+ rXLSet.Put( XLineEndWidthItem( aCtlPreview.GetOutputSize().Height() / 2 ) );
+
+ // #i34740#
+ aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
+
+ aBtnAdd.SetClickHdl(
+ LINK( this, SvxLineEndDefTabPage, ClickAddHdl_Impl ) );
+ aBtnModify.SetClickHdl(
+ LINK( this, SvxLineEndDefTabPage, ClickModifyHdl_Impl ) );
+ aBtnDelete.SetClickHdl(
+ LINK( this, SvxLineEndDefTabPage, ClickDeleteHdl_Impl ) );
+ aBtnLoad.SetClickHdl(
+ LINK( this, SvxLineEndDefTabPage, ClickLoadHdl_Impl ) );
+ aBtnSave.SetClickHdl(
+ LINK( this, SvxLineEndDefTabPage, ClickSaveHdl_Impl ) );
+
+ aLbLineEnds.SetSelectHdl(
+ LINK( this, SvxLineEndDefTabPage, SelectLineEndHdl_Impl ) );
+
+}
+
+//------------------------------------------------------------------------
+
+SvxLineEndDefTabPage::~SvxLineEndDefTabPage()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineEndDefTabPage::Construct()
+{
+ aLbLineEnds.Fill( pLineEndList );
+
+ bool bCreateArrowPossible = true;
+
+ if( !pPolyObj )
+ {
+ bCreateArrowPossible = false;
+ }
+ else if( !pPolyObj->ISA( SdrPathObj ) )
+ {
+ SdrObjTransformInfoRec aInfoRec;
+ pPolyObj->TakeObjInfo( aInfoRec );
+ SdrObject* pNewObj = 0;
+ if( aInfoRec.bCanConvToPath )
+ pNewObj = pPolyObj->ConvertToPolyObj( TRUE, FALSE );
+
+ bCreateArrowPossible = pNewObj && pNewObj->ISA( SdrPathObj );
+ SdrObject::Free( pNewObj );
+ }
+
+ if( !bCreateArrowPossible )
+ aBtnAdd.Disable();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineEndDefTabPage::ActivatePage( const SfxItemSet& )
+{
+ if( *pDlgType == 0 ) // Flaechen-Dialog
+ {
+ // ActivatePage() wird aufgerufen bevor der Dialog PageCreated() erhaelt !!!
+ if( pLineEndList )
+ {
+ if( *pPosLineEndLb != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aLbLineEnds.SelectEntryPos( *pPosLineEndLb );
+ SelectLineEndHdl_Impl( this );
+ }
+ INetURLObject aURL( pLineEndList->GetPath() );
+
+ aURL.Append( pLineEndList->GetName() );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+/* // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aURL.getBase().Len() > 18 )
+ {
+ aString += aURL.getBase().Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += aURL.getBase();
+
+ aGrpLineEnds.SetText( aString );
+*/
+ *pPageType = 0; // 3
+ *pPosLineEndLb = LISTBOX_ENTRY_NOTFOUND;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SvxLineEndDefTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ CheckChanges_Impl();
+
+ if( _pSet )
+ FillItemSet( *_pSet );
+
+ return( LEAVE_PAGE );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineEndDefTabPage::CheckChanges_Impl()
+{
+ USHORT nPos = aLbLineEnds.GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ String aString = aEdtName.GetText();
+
+ if( aString != aLbLineEnds.GetSelectEntry() )
+ {
+ QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+//! SVX_RES( RID_SVXSTR_LINEEND ),
+ String( SVX_RES( RID_SVXSTR_ASK_CHANGE_LINEEND ) ) );
+
+ if ( aQueryBox.Execute() == RET_YES )
+ ClickModifyHdl_Impl( this );
+ }
+ }
+ nPos = aLbLineEnds.GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ *pPosLineEndLb = nPos;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxLineEndDefTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ if( *pDlgType == 0 ) // Linien-Dialog
+ {
+ if( *pPageType == 3 )
+ {
+ CheckChanges_Impl();
+
+ long nPos = aLbLineEnds.GetSelectEntryPos();
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
+
+ rSet.Put( XLineStartItem( pEntry->GetName(), pEntry->GetLineEnd() ) );
+ rSet.Put( XLineEndItem( pEntry->GetName(), pEntry->GetLineEnd() ) );
+ }
+ }
+ return( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineEndDefTabPage::Reset( const SfxItemSet& )
+{
+ aLbLineEnds.SelectEntryPos( 0 );
+
+ // Update lineend
+ if( pLineEndList->Count() > 0 )
+ {
+ int nPos = aLbLineEnds.GetSelectEntryPos();
+
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
+
+ aEdtName.SetText( aLbLineEnds.GetSelectEntry() );
+
+ rXLSet.Put( XLineStartItem( String(), pEntry->GetLineEnd() ) );
+ rXLSet.Put( XLineEndItem( String(), pEntry->GetLineEnd() ) );
+
+ // #i34740#
+ aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
+
+ aCtlPreview.Invalidate();
+ }
+
+ // Status der Buttons ermitteln
+ if( pLineEndList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ else
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxLineEndDefTabPage::Create( Window* pWindow,
+ const SfxItemSet& rSet )
+{
+ return( new SvxLineEndDefTabPage( pWindow, rSet ) );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineEndDefTabPage, SelectLineEndHdl_Impl, void *, EMPTYARG )
+{
+ if( pLineEndList->Count() > 0 )
+ {
+ int nPos = aLbLineEnds.GetSelectEntryPos();
+
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
+
+ aEdtName.SetText( aLbLineEnds.GetSelectEntry() );
+
+ rXLSet.Put( XLineStartItem( String(), pEntry->GetLineEnd() ) );
+ rXLSet.Put( XLineEndItem( String(), pEntry->GetLineEnd() ) );
+
+ // #i34740#
+ aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
+
+ aCtlPreview.Invalidate();
+
+ // Wird erst hier gesetzt, um den Style nur dann zu uebernehmen,
+ // wenn in der ListBox ein Eintrag ausgewaehlt wurde
+ *pPageType = 3;
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+long SvxLineEndDefTabPage::ChangePreviewHdl_Impl( void* )
+{
+ aCtlPreview.Invalidate();
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineEndDefTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbLineEnds.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ ResMgr& rMgr = DIALOG_MGR();
+ String aDesc( ResId( RID_SVXSTR_DESC_LINEEND, rMgr ) );
+ String aName( aEdtName.GetText() );
+ long nCount = pLineEndList->Count();
+ BOOL bDifferent = TRUE;
+
+ // Pruefen, ob Name schon vorhanden ist
+ for ( long i = 0; i < nCount && bDifferent; i++ )
+ if ( aName == pLineEndList->GetLineEnd( i )->GetName() )
+ bDifferent = FALSE;
+
+ // Wenn ja, wird wiederholt ein neuer Name angefordert
+ if ( !bDifferent )
+ {
+ WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ),
+ String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+ aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
+ aWarningBox.Execute();
+
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ BOOL bLoop = TRUE;
+
+ while( !bDifferent && bLoop && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ {
+ if( aName == pLineEndList->GetLineEnd( i )->GetName() )
+ bDifferent = FALSE;
+ }
+
+ if( bDifferent )
+ bLoop = FALSE;
+ else
+ aWarningBox.Execute();
+ }
+ delete( pDlg );
+ }
+
+ // Wenn nicht vorhanden, wird Eintrag aufgenommen
+ if( bDifferent )
+ {
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
+
+ pEntry->SetName( aName );
+ aEdtName.SetText( aName );
+
+ aLbLineEnds.Modify( pEntry, nPos, pLineEndList->GetBitmap( nPos ) );
+ aLbLineEnds.SelectEntryPos( nPos );
+
+ // Flag fuer modifiziert setzen
+ *pnLineEndListState |= CT_MODIFIED;
+
+ *pPageType = 3;
+ }
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineEndDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
+{
+ if( pPolyObj )
+ {
+ const SdrObject* pNewObj;
+ SdrObject* pConvPolyObj = NULL;
+
+ if( pPolyObj->ISA( SdrPathObj ) )
+ {
+ pNewObj = pPolyObj;
+ }
+ else
+ {
+ SdrObjTransformInfoRec aInfoRec;
+ pPolyObj->TakeObjInfo( aInfoRec );
+
+ if( aInfoRec.bCanConvToPath )
+ {
+ pNewObj = pConvPolyObj = pPolyObj->ConvertToPolyObj( TRUE, FALSE );
+
+ if( !pNewObj || !pNewObj->ISA( SdrPathObj ) )
+ return( 0L ); // Abbruch, zusaetzliche Sicherheit, die bei
+ // Gruppenobjekten aber nichts bringt.
+ }
+ else return( 0L ); // Abbruch
+ }
+
+ basegfx::B2DPolyPolygon aNewPolyPolygon(((SdrPathObj*)pNewObj)->GetPathPoly());
+ basegfx::B2DRange aNewRange(basegfx::tools::getRange(aNewPolyPolygon));
+
+ // Normalisieren
+ basegfx::B2DHomMatrix aMatrix;
+ aMatrix.translate(-aNewRange.getMinX(), -aNewRange.getMinY());
+ aNewPolyPolygon.transform(aMatrix);
+
+ // Loeschen des angelegten PolyObjektes
+ SdrObject::Free( pConvPolyObj );
+
+ XLineEndEntry* pEntry;
+
+ ResMgr& rMgr = DIALOG_MGR();
+ String aNewName( ResId( RID_SVXSTR_LINEEND, rMgr ) );
+ String aDesc( ResId( RID_SVXSTR_DESC_LINEEND, rMgr ) );
+ String aName;
+
+ long nCount = pLineEndList->Count();
+ long j = 1;
+ BOOL bDifferent = FALSE;
+
+ while ( !bDifferent )
+ {
+ aName = aNewName;
+ aName += sal_Unicode(' ');
+ aName += UniString::CreateFromInt32( j++ );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ if ( aName == pLineEndList->GetLineEnd( i )->GetName() )
+ bDifferent = FALSE;
+ }
+
+ //CHINA001 SvxNameDialog* pDlg = new SvxNameDialog( DLGWIN, aName, aDesc );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc, RID_SVXDLG_NAME );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ BOOL bLoop = TRUE;
+
+ while ( bLoop && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ {
+ if( aName == pLineEndList->GetLineEnd( i )->GetName() )
+ bDifferent = FALSE;
+ }
+
+ if( bDifferent )
+ {
+ bLoop = FALSE;
+ pEntry = new XLineEndEntry( aNewPolyPolygon, aName );
+
+ long nLineEndCount = pLineEndList->Count();
+ pLineEndList->Insert( pEntry, nLineEndCount );
+ Bitmap* pBitmap = pLineEndList->GetBitmap( nLineEndCount );
+
+ // Zur ListBox hinzufuegen
+ aLbLineEnds.Append( pEntry, pBitmap );
+ aLbLineEnds.SelectEntryPos( aLbLineEnds.GetEntryCount() - 1 );
+
+ // Flag fuer modifiziert setzen
+ *pnLineEndListState |= CT_MODIFIED;
+
+ SelectLineEndHdl_Impl( this );
+ }
+ else
+ {
+ WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
+ aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
+ aBox.Execute();
+ }
+ }
+ delete pDlg;
+ }
+ else
+ aBtnAdd.Disable();
+
+ // Status der Buttons ermitteln
+ if ( pLineEndList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineEndDefTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
+{
+ USHORT nPos = aLbLineEnds.GetSelectEntryPos();
+
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
+//! SVX_RES( RID_SVXSTR_DEL_LINEEND ),
+ String( SVX_RES( RID_SVXSTR_ASK_DEL_LINEEND ) ) );
+
+ if ( aQueryBox.Execute() == RET_YES )
+ {
+ delete pLineEndList->Remove( nPos );
+ aLbLineEnds.RemoveEntry( nPos );
+ aLbLineEnds.SelectEntryPos( 0 );
+
+ SelectLineEndHdl_Impl( this );
+ *pPageType = 0; // LineEnd soll nicht uebernommen werden
+
+ // Flag fuer modifiziert setzen
+ *pnLineEndListState |= CT_MODIFIED;
+
+ ChangePreviewHdl_Impl( this );
+ }
+ }
+ // Status der Buttons ermitteln
+ if( !pLineEndList->Count() )
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineEndDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
+{
+ ResMgr& rMgr = DIALOG_MGR();
+ USHORT nReturn = RET_YES;
+
+ if ( *pnLineEndListState & CT_MODIFIED )
+ {
+ nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
+ String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
+
+ if ( nReturn == RET_YES )
+ pLineEndList->Save();
+ }
+
+ if ( nReturn != RET_CANCEL )
+ {
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soe" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+ INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if( aDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aDlg.GetPath() );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ // Liste speichern
+ XLineEndList* pLeList = new XLineEndList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool );
+ pLeList->SetName( aURL.getName() );
+ if( pLeList->Load() )
+ {
+ if( pLeList )
+ {
+ // Pruefen, ob Tabelle geloescht werden darf:
+ if( pLineEndList != ( (SvxLineTabDialog*) DLGWIN )->GetLineEndList() )
+ delete pLineEndList;
+
+ pLineEndList = pLeList;
+ ( (SvxLineTabDialog*) DLGWIN )->SetNewLineEndList( pLineEndList );
+ aLbLineEnds.Clear();
+ aLbLineEnds.Fill( pLineEndList );
+ Reset( rOutAttrs );
+
+ pLineEndList->SetName( aURL.getName() );
+
+/* // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ if( aURL.getBase().Len() > 18 )
+ {
+ aString += aURL.getBase().Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += aURL.getBase();
+
+ aGrpLineEnds.SetText( aString );
+*/
+ // Flag fuer gewechselt setzen
+ *pnLineEndListState |= CT_CHANGED;
+ // Flag fuer modifiziert entfernen
+ *pnLineEndListState &= ~CT_MODIFIED;
+ }
+ }
+ else
+ ErrorBox( DLGWIN, WinBits( WB_OK ),
+ String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
+ }
+ }
+
+ // Status der Buttons ermitteln
+ if ( pLineEndList->Count() )
+ {
+ aBtnModify.Enable();
+ aBtnDelete.Enable();
+ aBtnSave.Enable();
+ }
+ else
+ {
+ aBtnModify.Disable();
+ aBtnDelete.Disable();
+ aBtnSave.Disable();
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxLineEndDefTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
+{
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soe" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+
+ INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+ DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( pLineEndList->GetName().Len() )
+ {
+ aFile.Append( pLineEndList->GetName() );
+
+ if( !aFile.getExtension().getLength() )
+ aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soe" ) ) );
+ }
+
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aDlg.GetPath() );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ pLineEndList->SetName( aURL.getName() );
+ pLineEndList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if( pLineEndList->Save() )
+ {
+/* // Ermitteln (evtl. abschneiden) des Namens und in
+ // der GroupBox darstellen
+ String aString( SVX_RES( RID_SVXSTR_TABLE ) );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( aURL.getBase().Len() > 18 )
+ {
+ aString += aURL.getBase().Copy( 0, 15 );
+ aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+ }
+ else
+ aString += aURL.getBase();
+ aGrpLineEnds.SetText( aString );
+*/
+ // Flag fuer gespeichert setzen
+ *pnLineEndListState |= CT_SAVED;
+ // Flag fuer modifiziert entfernen
+ *pnLineEndListState &= ~CT_MODIFIED;
+ }
+ else
+ {
+ ErrorBox( DLGWIN, WinBits( WB_OK ),
+ String( SVX_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
+ }
+ }
+ return( 0L );
+}
+
+void SvxLineEndDefTabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxTabPage::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ USHORT nOldSelect = aLbLineEnds.GetSelectEntryPos();
+ aLbLineEnds.Clear();
+ aLbLineEnds.Fill( pLineEndList );
+ aLbLineEnds.SelectEntryPos( nOldSelect );
+ }
+}
+
diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx
new file mode 100644
index 000000000000..09f8eb4a805b
--- /dev/null
+++ b/cui/source/tabpages/tpshadow.cxx
@@ -0,0 +1,612 @@
+/*************************************************************************
+ *
+ * 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: tpshadow.cxx,v $
+ * $Revision: 1.20 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+
+#define _SVX_TPSHADOW_CXX
+
+#include "svx/xattr.hxx"
+#include <svx/xpool.hxx>
+#include <svx/dialogs.hrc>
+#include "tabarea.hrc"
+#include <svx/svdattr.hxx>
+#include "svx/drawitem.hxx"
+#include "cuitabarea.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include <cuitabline.hxx>
+
+#include <svx/xlineit0.hxx>
+#include <sfx2/request.hxx> //add CHINA001
+
+#define DLGWIN this->GetParent()->GetParent()
+
+// static ----------------------------------------------------------------
+
+static USHORT pShadowRanges[] =
+{
+ SDRATTR_SHADOWCOLOR,
+ SDRATTR_SHADOWTRANSPARENCE,
+ SID_ATTR_FILL_SHADOW,
+ SID_ATTR_FILL_SHADOW,
+ 0
+};
+
+/*************************************************************************
+|*
+|* Dialog zum Aendern des Schattens
+|*
+\************************************************************************/
+
+SvxShadowTabPage::SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+
+ SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_SHADOW ), rInAttrs ),
+
+ aFlProp ( this, SVX_RES( FL_PROP ) ),
+ aTsbShowShadow ( this, SVX_RES( TSB_SHOW_SHADOW ) ),
+ aFtPosition ( this, SVX_RES( FT_POSITION ) ),
+ aCtlPosition ( this, SVX_RES( CTL_POSITION ) ),
+ aFtDistance ( this, SVX_RES( FT_DISTANCE ) ),
+ aMtrDistance ( this, SVX_RES( MTR_FLD_DISTANCE ) ),
+ aFtShadowColor ( this, SVX_RES( FT_SHADOW_COLOR ) ),
+ aLbShadowColor ( this, SVX_RES( LB_SHADOW_COLOR ) ),
+ aFtTransparent ( this, SVX_RES( FT_TRANSPARENT ) ),
+ aMtrTransparent ( this, SVX_RES( MTR_SHADOW_TRANSPARENT ) ),
+ aCtlXRectPreview ( this, SVX_RES( CTL_COLOR_PREVIEW ) ),
+ rOutAttrs ( rInAttrs ),
+ pColorTab( NULL ),
+ bDisable ( FALSE ),
+ pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
+ aXFillAttr ( pXPool ),
+ rXFSet ( aXFillAttr.GetItemSet() )
+{
+ FreeResource();
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ // Metrik einstellen
+ FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs );
+
+ switch ( eFUnit )
+ {
+ case FUNIT_M:
+ case FUNIT_KM:
+ eFUnit = FUNIT_MM;
+ break;
+ default: ;//prevent warning
+ }
+ SetFieldUnit( aMtrDistance, eFUnit );
+
+ // PoolUnit ermitteln
+ SfxItemPool* pPool = rOutAttrs.GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool?" );
+ ePoolUnit = pPool->GetMetric( SDRATTR_SHADOWXDIST );
+
+ // Setzen des Output-Devices
+ XFillStyle eXFS = XFILL_SOLID;
+ if( rOutAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE )
+ {
+ eXFS = (XFillStyle) ( ( ( const XFillStyleItem& ) rOutAttrs.
+ Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue() );
+ switch( eXFS )
+ {
+ //case XFILL_NONE: --> NICHTS
+
+ case XFILL_SOLID:
+ if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )
+ {
+ XFillColorItem aColorItem( ( const XFillColorItem& )
+ rOutAttrs.Get( XATTR_FILLCOLOR ) );
+ rXFSet.Put( aColorItem );
+ }
+ break;
+
+ case XFILL_GRADIENT:
+ if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLGRADIENT ) )
+ {
+ XFillGradientItem aGradientItem( ( ( const XFillGradientItem& )
+ rOutAttrs.Get( XATTR_FILLGRADIENT ) ) );
+ rXFSet.Put( aGradientItem );
+ }
+ break;
+
+ case XFILL_HATCH:
+ if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLHATCH ) )
+ {
+ XFillHatchItem aHatchItem( ( ( const XFillHatchItem& )
+ rOutAttrs.Get( XATTR_FILLHATCH ) ) );
+ rXFSet.Put( aHatchItem );
+ }
+ break;
+
+ case XFILL_BITMAP:
+ {
+ if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLBITMAP ) )
+ {
+ XFillBitmapItem aBitmapItem( ( const XFillBitmapItem& )
+ rOutAttrs.Get( XATTR_FILLBITMAP ) );
+ rXFSet.Put( aBitmapItem );
+ }
+ }
+ break;
+ case XFILL_NONE : break;
+ }
+ }
+ else
+ {
+ rXFSet.Put( XFillColorItem( String(), COL_LIGHTRED ) );
+ }
+
+ if(XFILL_NONE == eXFS)
+ {
+ // #i96350#
+ // fallback to solid fillmode when no fill mode is provided to have
+ // a reasonable shadow preview. The used color will be a set one or
+ // the default (currently blue8)
+ eXFS = XFILL_SOLID;
+ }
+
+ rXFSet.Put( XFillStyleItem( eXFS ) );
+ aCtlXRectPreview.SetRectangleAttributes(aXFillAttr.GetItemSet());
+ //aCtlXRectPreview.SetFillAttr( aXFillAttr );
+
+ aTsbShowShadow.SetClickHdl( LINK( this, SvxShadowTabPage, ClickShadowHdl_Impl ) );
+ Link aLink = LINK( this, SvxShadowTabPage, ModifyShadowHdl_Impl );
+ aLbShadowColor.SetSelectHdl( aLink );
+ aMtrTransparent.SetModifyHdl( aLink );
+ aMtrDistance.SetModifyHdl( aLink );
+
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShadowTabPage::Construct()
+{
+ // Farbtabelle fuellen
+ aLbShadowColor.Fill( pColorTab );
+
+ if( bDisable )
+ {
+ aTsbShowShadow.Disable();
+ aFtPosition.Disable();
+ aCtlPosition.Disable();
+ aFtDistance.Disable();
+ aMtrDistance.Disable();
+ aFtShadowColor.Disable();
+ aLbShadowColor.Disable();
+ aFtTransparent.Disable();
+ aMtrTransparent.Disable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet )
+{
+ USHORT nPos;
+ USHORT nCount;
+ //add CHINA001 Begin
+ SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
+ if (pPageTypeItem)
+ SetPageType(pPageTypeItem->GetValue());
+ //add CHINA001 end
+ if( nDlgType == 0 ) //CHINA001 // Flaechen-Dialogif( *pDlgType == 0 ) // Flaechen-Dialog
+ {
+ if( pColorTab )
+ {
+ // ColorTable
+ if( *pnColorTableState & CT_CHANGED ||
+ *pnColorTableState & CT_MODIFIED )
+ {
+ if( *pnColorTableState & CT_CHANGED )
+ {
+ SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( DLGWIN );
+ if( pArea )
+ {
+ pColorTab = pArea->GetNewColorTable();
+ }
+ else
+ {
+ SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( DLGWIN );
+ if( pLine )
+ pColorTab = pLine->GetNewColorTable();
+ }
+ }
+
+ // aLbShadowColor
+ nPos = aLbShadowColor.GetSelectEntryPos();
+ aLbShadowColor.Clear();
+ aLbShadowColor.Fill( pColorTab );
+ nCount = aLbShadowColor.GetEntryCount();
+ if( nCount == 0 )
+ ; // Dieser Fall sollte nicht auftreten
+ else if( nCount <= nPos )
+ aLbShadowColor.SelectEntryPos( 0 );
+ else
+ aLbShadowColor.SelectEntryPos( nPos );
+
+ ModifyShadowHdl_Impl( this );
+ }
+ nPageType = PT_SHADOW;//CHINA001 *pPageType = PT_SHADOW;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SvxShadowTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if( _pSet )
+ FillItemSet( *_pSet );
+
+ return( LEAVE_PAGE );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxShadowTabPage::FillItemSet( SfxItemSet& rAttrs )
+{
+ const SfxPoolItem* pOld = NULL;
+ BOOL bModified = FALSE;
+
+ if( !bDisable )
+ {
+ // Schatten
+ TriState eState = aTsbShowShadow.GetState();
+ if( eState != aTsbShowShadow.GetSavedValue() )
+ {
+ SdrShadowItem aItem( sal::static_int_cast< BOOL >( eState ) );
+ pOld = GetOldItem( rAttrs, SDRATTR_SHADOW );
+ if ( !pOld || !( *(const SdrShadowItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+
+ // Schatten-Entfernung
+ // Etwas umstaendliche Abfrage, ob etwas geaendert wurde,
+ // da Items nicht direkt auf Controls abbildbar sind
+ INT32 nX = 0L, nY = 0L;
+ INT32 nXY = GetCoreValue( aMtrDistance, ePoolUnit );
+
+ switch( aCtlPosition.GetActualRP() )
+ {
+ case RP_LT: nX = nY = -nXY; break;
+ case RP_MT: nY = -nXY; break;
+ case RP_RT: nX = nXY; nY = -nXY; break;
+ case RP_LM: nX = -nXY; break;
+ case RP_RM: nX = nXY; break;
+ case RP_LB: nX = -nXY; nY = nXY; break;
+ case RP_MB: nY = nXY; break;
+ case RP_RB: nX = nY = nXY; break;
+ case RP_MM: break;
+ }
+
+ // Wenn die Werte des Schattenabstanden==SFX_ITEM_DONTCARE und der angezeigte
+ // String im entspr. MetricField=="", dann w�rde der Vergleich zw. alten und
+ // neuen Distance-Werte ein falsches Ergebnis liefern, da in so einem Fall die
+ // neuen Distance-Werte den Default-Werten des MetricField entspr�chen !!!!
+ if ( !aMtrDistance.IsEmptyFieldValue() ||
+ rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE ||
+ rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE )
+ {
+ INT32 nOldX = 9876543; // Unmoeglicher Wert, entspr. DontCare
+ INT32 nOldY = 9876543;
+ if( rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE &&
+ rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE )
+ {
+ nOldX = ( ( const SdrShadowXDistItem& ) rOutAttrs.
+ Get( SDRATTR_SHADOWXDIST ) ).GetValue();
+ nOldY = ( ( const SdrShadowYDistItem& ) rOutAttrs.
+ Get( SDRATTR_SHADOWYDIST ) ).GetValue();
+ }
+ SdrShadowXDistItem aXItem( nX );
+ pOld = GetOldItem( rAttrs, SDRATTR_SHADOWXDIST );
+ if ( nX != nOldX &&
+ ( !pOld || !( *(const SdrShadowXDistItem*)pOld == aXItem ) ) )
+ {
+ rAttrs.Put( aXItem );
+ bModified = TRUE;
+ }
+ SdrShadowYDistItem aYItem( nY );
+ pOld = GetOldItem( rAttrs, SDRATTR_SHADOWYDIST );
+ if ( nY != nOldY &&
+ ( !pOld || !( *(const SdrShadowYDistItem*)pOld == aYItem ) ) )
+ {
+ rAttrs.Put( aYItem );
+ bModified = TRUE;
+ }
+ }
+
+ // ShadowColor
+ USHORT nPos = aLbShadowColor.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND &&
+ nPos != aLbShadowColor.GetSavedValue() )
+ {
+ SdrShadowColorItem aItem( aLbShadowColor.GetSelectEntry(),
+ aLbShadowColor.GetSelectEntryColor() );
+ pOld = GetOldItem( rAttrs, SDRATTR_SHADOWCOLOR );
+ if ( !pOld || !( *(const SdrShadowColorItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+
+ // Transparenz
+ UINT16 nVal = (UINT16)aMtrTransparent.GetValue();
+ if( nVal != (UINT16)aMtrTransparent.GetSavedValue().ToInt32() )
+ {
+ SdrShadowTransparenceItem aItem( nVal );
+ pOld = GetOldItem( rAttrs, SDRATTR_SHADOWTRANSPARENCE );
+ if ( !pOld || !( *(const SdrShadowTransparenceItem*)pOld == aItem ) )
+ {
+ rAttrs.Put( aItem );
+ bModified = TRUE;
+ }
+ }
+ }
+ //add CHINA001 begin
+ rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));
+ //add CHINA001 end
+ return( bModified );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShadowTabPage::Reset( const SfxItemSet& rAttrs )
+{
+ if( !bDisable )
+ {
+ // Alle Objekte koennen einen Schatten besitzen
+ // z.Z. gibt es nur 8 m�gliche Positionen den Schatten zu setzen
+
+ // Ist Schatten gesetzt?
+ if( rAttrs.GetItemState( SDRATTR_SHADOW ) != SFX_ITEM_DONTCARE )
+ {
+ aTsbShowShadow.EnableTriState( FALSE );
+
+ if( ( ( const SdrShadowItem& ) rAttrs.Get( SDRATTR_SHADOW ) ).GetValue() )
+ aTsbShowShadow.SetState( STATE_CHECK );
+ else
+ {
+ aTsbShowShadow.SetState( STATE_NOCHECK );
+ }
+ }
+ else
+ aTsbShowShadow.SetState( STATE_DONTKNOW );
+
+ // Entfernung (nur 8 moegliche Positionen), deshalb
+ // wird nur ein Item ausgewertet
+
+ if( rAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE &&
+ rAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE )
+ {
+ INT32 nX = ( ( const SdrShadowXDistItem& ) rAttrs.Get( SDRATTR_SHADOWXDIST ) ).GetValue();
+ INT32 nY = ( ( const SdrShadowYDistItem& ) rAttrs.Get( SDRATTR_SHADOWYDIST ) ).GetValue();
+
+ if( nX != 0 )
+ SetMetricValue( aMtrDistance, nX < 0L ? -nX : nX, ePoolUnit );
+ else
+ SetMetricValue( aMtrDistance, nY < 0L ? -nY : nY, ePoolUnit );
+
+ // Setzen des Schatten-Controls
+ if ( nX < 0L && nY < 0L ) aCtlPosition.SetActualRP( RP_LT );
+ else if( nX == 0L && nY < 0L ) aCtlPosition.SetActualRP( RP_MT );
+ else if( nX > 0L && nY < 0L ) aCtlPosition.SetActualRP( RP_RT );
+ else if( nX < 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_LM );
+ // Mittelpunkt gibt es nicht mehr
+ else if( nX == 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_RB );
+ else if( nX > 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_RM );
+ else if( nX < 0L && nY > 0L ) aCtlPosition.SetActualRP( RP_LB );
+ else if( nX == 0L && nY > 0L ) aCtlPosition.SetActualRP( RP_MB );
+ else if( nX > 0L && nY > 0L ) aCtlPosition.SetActualRP( RP_RB );
+ }
+ else
+ {
+ // determine default-distance
+ SfxItemPool* pPool = rOutAttrs.GetPool();
+ SdrShadowXDistItem* pXDistItem = (SdrShadowXDistItem*)&pPool->GetDefaultItem (SDRATTR_SHADOWXDIST);
+ SdrShadowYDistItem* pYDistItem = (SdrShadowYDistItem*)&pPool->GetDefaultItem (SDRATTR_SHADOWYDIST);
+ if (pXDistItem && pYDistItem)
+ {
+ INT32 nX = pXDistItem->GetValue();
+ INT32 nY = pYDistItem->GetValue();
+ if( nX != 0 )
+ SetMetricValue( aMtrDistance, nX < 0L ? -nX : nX, ePoolUnit );
+ else
+ SetMetricValue( aMtrDistance, nY < 0L ? -nY : nY, ePoolUnit );
+ }
+
+ // Tristate, z.B. mehrer Objekte wurden markiert, wovon einige einen Schatten besitzen, einige nicht.
+ // Der anzuzeigende Text des MetricFields wird auf "" gesetzt und dient in der Methode FillItemSet
+ // als Erkennungszeichen daf�r, das der Distance-Wert NICHT ver�ndert wurde !!!!
+ aMtrDistance.SetText( String() );
+ aCtlPosition.SetActualRP( RP_MM );
+ }
+
+ // SchattenFarbe:
+ if( rAttrs.GetItemState( SDRATTR_SHADOWCOLOR ) != SFX_ITEM_DONTCARE )
+ {
+ aLbShadowColor.SelectEntry( ( ( const SdrShadowColorItem& ) rAttrs.Get( SDRATTR_SHADOWCOLOR ) ).GetColorValue() );
+ }
+ else
+ aLbShadowColor.SetNoSelection();
+
+ // Transparenz
+ if( rAttrs.GetItemState( SDRATTR_SHADOWTRANSPARENCE ) != SFX_ITEM_DONTCARE )
+ {
+ USHORT nTransp = ( ( const SdrShadowTransparenceItem& ) rAttrs.Get( SDRATTR_SHADOWTRANSPARENCE ) ).GetValue();
+ aMtrTransparent.SetValue( nTransp );
+ }
+ else
+ aMtrTransparent.SetText( String() );
+
+ // Werte sichern
+ //aCtlPosition
+ aMtrDistance.SaveValue();
+ aLbShadowColor.SaveValue();
+ aTsbShowShadow.SaveValue();
+
+ // #66832# This field was not saved, but used to determine changes.
+ // Why? Seems to be the error.
+ // It IS the error.
+ aMtrTransparent.SaveValue();
+
+ ClickShadowHdl_Impl( NULL );
+ ModifyShadowHdl_Impl( NULL );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxShadowTabPage::Create( Window* pWindow,
+ const SfxItemSet& rAttrs )
+{
+ return( new SvxShadowTabPage( pWindow, rAttrs ) );
+}
+
+//------------------------------------------------------------------------
+
+USHORT* SvxShadowTabPage::GetRanges()
+{
+ return( pShadowRanges );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxShadowTabPage, ClickShadowHdl_Impl, void *, EMPTYARG )
+{
+ if( aTsbShowShadow.GetState() == STATE_NOCHECK )
+ {
+ aFtPosition.Disable();
+ aCtlPosition.Disable();
+ aFtDistance.Disable();
+ aMtrDistance.Disable();
+ aFtShadowColor.Disable();
+ aLbShadowColor.Disable();
+ aFtTransparent.Disable();
+ aMtrTransparent.Disable();
+ }
+ else
+ {
+ aFtPosition.Enable();
+ aCtlPosition.Enable();
+ aFtDistance.Enable();
+ aMtrDistance.Enable();
+ aFtShadowColor.Enable();
+ aLbShadowColor.Enable();
+ aFtTransparent.Enable();
+ aMtrTransparent.Enable();
+ }
+ aCtlPosition.Invalidate();
+
+ ModifyShadowHdl_Impl( NULL );
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxShadowTabPage, ModifyShadowHdl_Impl, void *, EMPTYARG )
+{
+ if( aTsbShowShadow.GetState() == STATE_CHECK )
+ rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ else
+ rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
+
+ USHORT nPos = aLbShadowColor.GetSelectEntryPos();
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ rXFSet.Put( XFillColorItem( String(),
+ aLbShadowColor.GetSelectEntryColor() ) );
+ }
+ UINT16 nVal = (UINT16)aMtrTransparent.GetValue();
+ XFillTransparenceItem aItem( nVal );
+ rXFSet.Put( XFillTransparenceItem( aItem ) );
+
+ // Schatten-Entfernung
+ INT32 nX = 0L, nY = 0L;
+ INT32 nXY = GetCoreValue( aMtrDistance, ePoolUnit );
+ switch( aCtlPosition.GetActualRP() )
+ {
+ case RP_LT: nX = nY = -nXY; break;
+ case RP_MT: nY = -nXY; break;
+ case RP_RT: nX = nXY; nY = -nXY; break;
+ case RP_LM: nX = -nXY; break;
+ case RP_RM: nX = nXY; break;
+ case RP_LB: nX = -nXY; nY = nXY; break;
+ case RP_MB: nY = nXY; break;
+ case RP_RB: nX = nY = nXY; break;
+ case RP_MM: break;
+ }
+
+ aCtlXRectPreview.SetShadowPosition(Point(nX, nY));
+
+ aCtlXRectPreview.SetShadowAttributes(aXFillAttr.GetItemSet());
+ //aCtlXRectPreview.SetFillAttr( aXFillAttr );
+ aCtlXRectPreview.Invalidate();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+void SvxShadowTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt )
+{
+ eRP = eRcPt;
+
+ // Schatten neu zeichnen
+ ModifyShadowHdl_Impl( pWindow );
+}
+
+void SvxShadowTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
+{
+ SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
+
+
+ if (pColorTabItem)
+ SetColorTable(pColorTabItem->GetColorTable());
+ if (pPageTypeItem)
+ SetPageType(pPageTypeItem->GetValue());
+ if (pDlgTypeItem)
+ SetDlgType(pDlgTypeItem->GetValue());
+ Construct();
+}
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
new file mode 100644
index 000000000000..63f9491b7379
--- /dev/null
+++ b/cui/source/tabpages/transfrm.cxx
@@ -0,0 +1,1701 @@
+/*************************************************************************
+ *
+ * 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: transfrm.cxx,v $
+ * $Revision: 1.33 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <tools/shl.hxx>
+#include <sfx2/app.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/sderitm.hxx>
+
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include "transfrm.hrc"
+#include <svx/sizeitem.hxx>
+
+#include "transfrm.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include <svx/svxenum.hxx>
+#include "svx/anchorid.hxx"
+#include <sfx2/module.hxx>
+#include <svl/rectitem.hxx>
+#include <svl/aeitem.hxx>
+#include <swpossizetabpage.hxx>
+
+// Toleranz fuer WorkingArea
+#define DIFF 1000
+
+// static ----------------------------------------------------------------
+
+static USHORT pPosSizeRanges[] =
+{
+ SID_ATTR_TRANSFORM_POS_X,
+ SID_ATTR_TRANSFORM_POS_Y,
+ SID_ATTR_TRANSFORM_PROTECT_POS,
+ SID_ATTR_TRANSFORM_PROTECT_POS,
+ SID_ATTR_TRANSFORM_INTERN,
+ SID_ATTR_TRANSFORM_INTERN,
+ SID_ATTR_TRANSFORM_ANCHOR,
+ SID_ATTR_TRANSFORM_VERT_ORIENT,
+ SID_ATTR_TRANSFORM_WIDTH,
+ SID_ATTR_TRANSFORM_SIZE_POINT,
+ SID_ATTR_TRANSFORM_PROTECT_POS,
+ SID_ATTR_TRANSFORM_INTERN,
+ SID_ATTR_TRANSFORM_AUTOWIDTH,
+ SID_ATTR_TRANSFORM_AUTOHEIGHT,
+ 0
+};
+
+static USHORT pAngleRanges[] =
+{
+ SID_ATTR_TRANSFORM_ROT_X,
+ SID_ATTR_TRANSFORM_ANGLE,
+ SID_ATTR_TRANSFORM_INTERN,
+ SID_ATTR_TRANSFORM_INTERN,
+ 0
+};
+
+static USHORT pSlantRanges[] =
+{
+ SDRATTR_ECKENRADIUS,
+ SDRATTR_ECKENRADIUS,
+ SID_ATTR_TRANSFORM_SHEAR,
+ SID_ATTR_TRANSFORM_SHEAR_VERTICAL,
+ SID_ATTR_TRANSFORM_INTERN,
+ SID_ATTR_TRANSFORM_INTERN,
+ 0
+};
+
+void lcl_ConvertRect(basegfx::B2DRange& rRange, const sal_uInt16 nDigits, const MapUnit ePoolUnit, const FieldUnit eDlgUnit)
+{
+ const basegfx::B2DPoint aTopLeft(
+ (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinX()), nDigits, ePoolUnit, eDlgUnit),
+ (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinY()), nDigits, ePoolUnit, eDlgUnit));
+ const basegfx::B2DPoint aBottomRight(
+ (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxX()), nDigits, ePoolUnit, eDlgUnit),
+ (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxY()), nDigits, ePoolUnit, eDlgUnit));
+
+ rRange = basegfx::B2DRange(aTopLeft, aBottomRight);
+}
+
+void lcl_ScaleRect(basegfx::B2DRange& rRange, const Fraction aUIScale)
+{
+ const double fFactor(1.0 / double(aUIScale));
+ rRange = basegfx::B2DRange(rRange.getMinimum() * fFactor, rRange.getMaximum() * fFactor);
+}
+
+/*************************************************************************
+|*
+|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+|*
+\************************************************************************/
+
+SvxTransformTabDialog::SvxTransformTabDialog( Window* pParent, const SfxItemSet* pAttr,
+ const SdrView* pSdrView, USHORT nAnchorTypes ) :
+ SfxTabDialog( pParent, SVX_RES( RID_SVXDLG_TRANSFORM ), pAttr ),
+ pView ( pSdrView ),
+ nAnchorCtrls(nAnchorTypes)
+{
+ DBG_ASSERT(pView, "no valid view (!)");
+ FreeResource();
+
+ //different positioning page in Writer
+ if(nAnchorCtrls & 0x00ff)
+ {
+ AddTabPage(RID_SVXPAGE_SWPOSSIZE, SvxSwPosSizeTabPage::Create, SvxSwPosSizeTabPage::GetRanges);
+ RemoveTabPage(RID_SVXPAGE_POSITION_SIZE);
+ }
+ else
+ {
+ AddTabPage(RID_SVXPAGE_POSITION_SIZE, SvxPositionSizeTabPage::Create, SvxPositionSizeTabPage::GetRanges);
+ RemoveTabPage(RID_SVXPAGE_SWPOSSIZE);
+ }
+
+ AddTabPage(RID_SVXPAGE_ANGLE, SvxAngleTabPage::Create, SvxAngleTabPage::GetRanges);
+ AddTabPage(RID_SVXPAGE_SLANT, SvxSlantTabPage::Create, SvxSlantTabPage::GetRanges);
+}
+
+// -----------------------------------------------------------------------
+
+SvxTransformTabDialog::~SvxTransformTabDialog()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxTransformTabDialog::PageCreated(USHORT nId, SfxTabPage &rPage)
+{
+ switch(nId)
+ {
+ case RID_SVXPAGE_POSITION_SIZE:
+ {
+ SvxPositionSizeTabPage& rSvxPos = static_cast<SvxPositionSizeTabPage&>(rPage);
+ rSvxPos.SetView(pView);
+ rSvxPos.Construct();
+
+ if(nAnchorCtrls & SVX_OBJ_NORESIZE)
+ {
+ rSvxPos.DisableResize();
+ }
+
+ if(nAnchorCtrls & SVX_OBJ_NOPROTECT)
+ {
+ rSvxPos.DisableProtect();
+ rSvxPos.UpdateControlStates();
+ }
+
+ break;
+ }
+ case RID_SVXPAGE_SWPOSSIZE :
+ {
+ SvxSwPosSizeTabPage& rSwPos = static_cast<SvxSwPosSizeTabPage&>(rPage);
+
+ rSwPos.EnableAnchorTypes(nAnchorCtrls);
+ rSwPos.SetValidateFramePosLink(aValidateLink);
+ rSwPos.SetView(pView);
+
+ break;
+ }
+
+ case RID_SVXPAGE_ANGLE:
+ {
+ SvxAngleTabPage& rSvxAng = static_cast<SvxAngleTabPage&>(rPage);
+
+ rSvxAng.SetView( pView );
+ rSvxAng.Construct();
+
+ break;
+ }
+
+ case RID_SVXPAGE_SLANT:
+ {
+ SvxSlantTabPage& rSvxSlnt = static_cast<SvxSlantTabPage&>(rPage);
+
+ rSvxSlnt.SetView( pView );
+ rSvxSlnt.Construct();
+
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxTransformTabDialog::SetValidateFramePosLink(const Link& rLink)
+{
+ aValidateLink = rLink;
+}
+
+/*************************************************************************
+|*
+|* Dialog zum Aendern der Position des Drehwinkels und des Drehwinkels
+|* der Grafikobjekte
+|*
+\************************************************************************/
+
+SvxAngleTabPage::SvxAngleTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_ANGLE ), rInAttrs ),
+ aFlPosition ( this, SVX_RES( FL_POSITION ) ),
+ aFtPosX ( this, SVX_RES( FT_POS_X ) ),
+ aMtrPosX ( this, SVX_RES( MTR_FLD_POS_X ) ),
+ aFtPosY ( this, SVX_RES( FT_POS_Y ) ),
+ aMtrPosY ( this, SVX_RES( MTR_FLD_POS_Y ) ),
+ aFtPosPresets ( this, SVX_RES(FT_POSPRESETS) ),
+ aCtlRect ( this, SVX_RES( CTL_RECT ) ),
+
+ aFlAngle ( this, SVX_RES( FL_ANGLE ) ),
+ aFtAngle ( this, SVX_RES( FT_ANGLE ) ),
+ aMtrAngle ( this, SVX_RES( MTR_FLD_ANGLE ) ),
+ aFtAnglePresets ( this, SVX_RES(FT_ANGLEPRESETS) ),
+ aCtlAngle ( this, SVX_RES( CTL_ANGLE ),
+ RP_RB, 200, 80, CS_ANGLE ),
+ rOutAttrs ( rInAttrs )
+{
+ FreeResource();
+
+ // calculate PoolUnit
+ SfxItemPool* pPool = rOutAttrs.GetPool();
+ DBG_ASSERT( pPool, "no pool (!)" );
+ ePoolUnit = pPool->GetMetric(SID_ATTR_TRANSFORM_POS_X);
+
+ aMtrAngle.SetModifyHdl(LINK( this, SvxAngleTabPage, ModifiedHdl));
+}
+
+// -----------------------------------------------------------------------
+
+void SvxAngleTabPage::Construct()
+{
+ DBG_ASSERT(pView, "No valid view (!)");
+ eDlgUnit = GetModuleFieldUnit(&GetItemSet());
+ SetFieldUnit(aMtrPosX, eDlgUnit, TRUE);
+ SetFieldUnit(aMtrPosY, eDlgUnit, TRUE);
+
+ if(FUNIT_MILE == eDlgUnit || FUNIT_KM == eDlgUnit)
+ {
+ aMtrPosX.SetDecimalDigits( 3 );
+ aMtrPosY.SetDecimalDigits( 3 );
+ }
+
+ { // #i75273#
+ Rectangle aTempRect(pView->GetAllMarkedRect());
+ pView->GetSdrPageView()->LogicToPagePos(aTempRect);
+ maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom());
+ }
+
+ // Take anchor into account (Writer)
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+
+ if(rMarkList.GetMarkCount())
+ {
+ const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ maAnchor = basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y());
+
+ if(!maAnchor.equalZero()) // -> Writer
+ {
+ maRange = basegfx::B2DRange(maRange.getMinimum() - maAnchor, maRange.getMaximum() - maAnchor);
+ }
+ }
+
+ // take scale into account
+ const Fraction aUIScale(pView->GetModel()->GetUIScale());
+ lcl_ScaleRect(maRange, aUIScale);
+
+ // take UI units into account
+ sal_uInt16 nDigits(aMtrPosX.GetDecimalDigits());
+ lcl_ConvertRect(maRange, nDigits, (MapUnit)ePoolUnit, eDlgUnit);
+
+ if(!pView->IsRotateAllowed())
+ {
+ aFlPosition.Disable();
+ aFtPosX.Disable();
+ aMtrPosX.Disable();
+ aFtPosY.Disable();
+ aMtrPosY.Disable();
+ aFtPosPresets.Disable();
+ aCtlRect.Disable();
+ aFlAngle.Disable();
+ aFtAngle.Disable();
+ aMtrAngle.Disable();
+ aFtAnglePresets.Disable();
+ aCtlAngle.Disable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxAngleTabPage::FillItemSet(SfxItemSet& rSet)
+{
+ BOOL bModified = FALSE;
+
+ if(aMtrAngle.IsValueModified() || aMtrPosX.IsValueModified() || aMtrPosY.IsValueModified())
+ {
+ const double fUIScale(double(pView->GetModel()->GetUIScale()));
+ const double fTmpX((GetCoreValue(aMtrPosX, ePoolUnit) + maAnchor.getX()) * fUIScale);
+ const double fTmpY((GetCoreValue(aMtrPosY, ePoolUnit) + maAnchor.getY()) * fUIScale);
+
+ rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ANGLE), static_cast<sal_Int32>(aMtrAngle.GetValue())));
+ rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_X), basegfx::fround(fTmpX)));
+ rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_Y), basegfx::fround(fTmpY)));
+
+ bModified |= TRUE;
+ }
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxAngleTabPage::Reset(const SfxItemSet& rAttrs)
+{
+ const double fUIScale(double(pView->GetModel()->GetUIScale()));
+
+ const SfxPoolItem* pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_ROT_X );
+ if(pItem)
+ {
+ const double fTmp(((double)((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getX()) / fUIScale);
+ SetMetricValue(aMtrPosX, basegfx::fround(fTmp), ePoolUnit);
+ }
+ else
+ {
+ aMtrPosX.SetText( String() );
+ }
+
+ pItem = GetItem(rAttrs, SID_ATTR_TRANSFORM_ROT_Y);
+ if(pItem)
+ {
+ const double fTmp(((double)((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getY()) / fUIScale);
+ SetMetricValue(aMtrPosY, basegfx::fround(fTmp), ePoolUnit);
+ }
+ else
+ {
+ aMtrPosX.SetText( String() );
+ }
+
+ pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_ANGLE );
+ if(pItem)
+ {
+ aMtrAngle.SetValue(((const SfxInt32Item*)pItem)->GetValue());
+ }
+ else
+ {
+ aMtrAngle.SetText( String() );
+ }
+
+ aMtrAngle.SaveValue();
+ ModifiedHdl(this);
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxAngleTabPage::Create( Window* pWindow, const SfxItemSet& rSet)
+{
+ return(new SvxAngleTabPage(pWindow, rSet));
+}
+
+//------------------------------------------------------------------------
+
+USHORT* SvxAngleTabPage::GetRanges()
+{
+ return(pAngleRanges);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxAngleTabPage::ActivatePage(const SfxItemSet& /*rSet*/)
+{
+}
+
+// -----------------------------------------------------------------------
+
+int SvxAngleTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if(_pSet)
+ {
+ FillItemSet(*_pSet);
+ }
+
+ return LEAVE_PAGE;
+}
+
+//------------------------------------------------------------------------
+
+void SvxAngleTabPage::PointChanged(Window* pWindow, RECT_POINT eRP)
+{
+ if(pWindow == &aCtlRect)
+ {
+ switch(eRP)
+ {
+ case RP_LT:
+ {
+ aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE );
+ aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE );
+ break;
+ }
+ case RP_MT:
+ {
+ aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE );
+ aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE );
+ break;
+ }
+ case RP_RT:
+ {
+ aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE );
+ aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE );
+ break;
+ }
+ case RP_LM:
+ {
+ aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE );
+ aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE );
+ break;
+ }
+ case RP_MM:
+ {
+ aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE );
+ aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE );
+ break;
+ }
+ case RP_RM:
+ {
+ aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE );
+ aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE );
+ break;
+ }
+ case RP_LB:
+ {
+ aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE );
+ aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE );
+ break;
+ }
+ case RP_MB:
+ {
+ aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE );
+ aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE );
+ break;
+ }
+ case RP_RB:
+ {
+ aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE );
+ aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE );
+ break;
+ }
+ }
+ }
+ else if(pWindow == &aCtlAngle)
+ {
+ switch( eRP )
+ {
+ case RP_LT: aMtrAngle.SetUserValue( 13500, FUNIT_NONE ); break;
+ case RP_MT: aMtrAngle.SetUserValue( 9000, FUNIT_NONE ); break;
+ case RP_RT: aMtrAngle.SetUserValue( 4500, FUNIT_NONE ); break;
+ case RP_LM: aMtrAngle.SetUserValue( 18000, FUNIT_NONE ); break;
+ case RP_RM: aMtrAngle.SetUserValue( 0, FUNIT_NONE ); break;
+ case RP_LB: aMtrAngle.SetUserValue( 22500, FUNIT_NONE ); break;
+ case RP_MB: aMtrAngle.SetUserValue( 27000, FUNIT_NONE ); break;
+ case RP_RB: aMtrAngle.SetUserValue( 31500, FUNIT_NONE ); break;
+ case RP_MM: break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxAngleTabPage, ModifiedHdl, void *, EMPTYARG )
+{
+ switch(aMtrAngle.GetValue())
+ {
+ case 13500: aCtlAngle.SetActualRP( RP_LT ); break;
+ case 9000: aCtlAngle.SetActualRP( RP_MT ); break;
+ case 4500: aCtlAngle.SetActualRP( RP_RT ); break;
+ case 18000: aCtlAngle.SetActualRP( RP_LM ); break;
+ case 0: aCtlAngle.SetActualRP( RP_RM ); break;
+ case 22500: aCtlAngle.SetActualRP( RP_LB ); break;
+ case 27000: aCtlAngle.SetActualRP( RP_MB ); break;
+ case 31500: aCtlAngle.SetActualRP( RP_RB ); break;
+ default: aCtlAngle.SetActualRP( RP_MM ); break;
+ }
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Dialog zum Aendern des Eckenradius und zum Schraegstellen
+|*
+\************************************************************************/
+
+SvxSlantTabPage::SvxSlantTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_SLANT ), rInAttrs ),
+
+ aFlRadius ( this, SVX_RES( FL_RADIUS ) ),
+ aFtRadius ( this, SVX_RES( FT_RADIUS ) ),
+ aMtrRadius ( this, SVX_RES( MTR_FLD_RADIUS ) ),
+ aFlAngle ( this, SVX_RES( FL_SLANT ) ),
+ aFtAngle ( this, SVX_RES( FT_ANGLE ) ),
+ aMtrAngle ( this, SVX_RES( MTR_FLD_ANGLE ) ),
+ rOutAttrs ( rInAttrs )
+{
+ FreeResource();
+
+ // this page needs ExchangeSupport
+ SetExchangeSupport();
+
+ // evaluate PoolUnit
+ SfxItemPool* pPool = rOutAttrs.GetPool();
+ DBG_ASSERT( pPool, "no pool (!)" );
+ ePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSlantTabPage::Construct()
+{
+ // get the range
+ DBG_ASSERT(pView, "no valid view (!)");
+ eDlgUnit = GetModuleFieldUnit(&GetItemSet());
+ SetFieldUnit(aMtrRadius, eDlgUnit, TRUE);
+
+ { // #i75273#
+ Rectangle aTempRect(pView->GetAllMarkedRect());
+ pView->GetSdrPageView()->LogicToPagePos(aTempRect);
+ maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom());
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxSlantTabPage::FillItemSet(SfxItemSet& rAttrs)
+{
+ BOOL bModified = FALSE;
+ INT32 nValue = 0L;
+ String aStr = aMtrRadius.GetText();
+
+ if( aStr != aMtrRadius.GetSavedValue() )
+ {
+ Fraction aUIScale = pView->GetModel()->GetUIScale();
+ long nTmp = GetCoreValue( aMtrRadius, ePoolUnit );
+ nTmp = Fraction( nTmp ) * aUIScale;
+
+ rAttrs.Put( SdrEckenradiusItem( nTmp ) );
+ bModified = TRUE;
+ }
+
+ aStr = aMtrAngle.GetText();
+
+ if( aStr != aMtrAngle.GetSavedValue() )
+ {
+ nValue = static_cast<INT32>(aMtrAngle.GetValue());
+ rAttrs.Put( SfxInt32Item( SID_ATTR_TRANSFORM_SHEAR, nValue ) );
+ bModified = TRUE;
+ }
+
+ if( bModified )
+ {
+ // Referenzpunkt setzen
+ // #75897#
+ Rectangle aObjectRect(pView->GetAllMarkedRect());
+ pView->GetSdrPageView()->LogicToPagePos(aObjectRect);
+ Point aPt = aObjectRect.Center();
+
+ rAttrs.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_X, aPt.X()));
+ rAttrs.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_Y, aPt.Y()));
+ rAttrs.Put( SfxBoolItem( SID_ATTR_TRANSFORM_SHEAR_VERTICAL, FALSE ) );
+ }
+
+ return( bModified );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSlantTabPage::Reset(const SfxItemSet& rAttrs)
+{
+ // if the view has selected objects, items with SFX_ITEM_DEFAULT need to be disabled
+ const SfxPoolItem* pItem;
+
+ // Eckenradius
+ if(!pView->IsEdgeRadiusAllowed())
+ {
+ aFlRadius.Disable();
+ aFtRadius.Disable();
+ aMtrRadius.Disable();
+ aMtrRadius.SetText( String() );
+ }
+ else
+ {
+ pItem = GetItem( rAttrs, SDRATTR_ECKENRADIUS );
+
+ if( pItem )
+ {
+ const double fUIScale(double(pView->GetModel()->GetUIScale()));
+ const double fTmp((double)((const SdrEckenradiusItem*)pItem)->GetValue() / fUIScale);
+ SetMetricValue(aMtrRadius, basegfx::fround(fTmp), ePoolUnit);
+ }
+ else
+ {
+ aMtrRadius.SetText( String() );
+ }
+ }
+
+ aMtrRadius.SaveValue();
+
+ // Schraegstellen: Winkel
+ if( !pView->IsShearAllowed() )
+ {
+ aFlAngle.Disable();
+ aFtAngle.Disable();
+ aMtrAngle.Disable();
+ aMtrAngle.SetText( String() );
+ }
+ else
+ {
+ pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_SHEAR );
+
+ if( pItem )
+ {
+ aMtrAngle.SetValue( ( (const SfxInt32Item*)pItem )->GetValue() );
+ }
+ else
+ {
+ aMtrAngle.SetText( String() );
+ }
+ }
+
+ aMtrAngle.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxSlantTabPage::Create( Window* pWindow, const SfxItemSet& rOutAttrs )
+{
+ return( new SvxSlantTabPage( pWindow, rOutAttrs ) );
+}
+
+//------------------------------------------------------------------------
+
+USHORT* SvxSlantTabPage::GetRanges()
+{
+ return( pSlantRanges );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSlantTabPage::ActivatePage( const SfxItemSet& rSet )
+{
+ SfxRectangleItem* pRectItem = NULL;
+
+ if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_TRANSFORM_INTERN ) , FALSE, (const SfxPoolItem**) &pRectItem ) )
+ {
+ const Rectangle aTempRect(pRectItem->GetValue());
+ maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom());
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SvxSlantTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if(_pSet)
+ {
+ FillItemSet(*_pSet);
+ }
+
+ return LEAVE_PAGE;
+}
+
+//------------------------------------------------------------------------
+
+void SvxSlantTabPage::PointChanged( Window* , RECT_POINT )
+{
+}
+
+/*************************************************************************
+|*
+|* Dialog for changing position and size of graphic objects
+|*
+\************************************************************************/
+
+SvxPositionSizeTabPage::SvxPositionSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_POSITION_SIZE ), rInAttrs ),
+ maFlPosition ( this, SVX_RES( FL_POSITION ) ),
+ maFtPosX ( this, SVX_RES( FT_POS_X ) ),
+ maMtrPosX ( this, SVX_RES( MTR_FLD_POS_X ) ),
+ maFtPosY ( this, SVX_RES( FT_POS_Y ) ),
+ maMtrPosY ( this, SVX_RES( MTR_FLD_POS_Y ) ),
+ maFtPosReference ( this, SVX_RES( FT_POSREFERENCE ) ),
+ maCtlPos ( this, SVX_RES( CTL_POSRECT ), RP_LT ),
+
+ maFlSize ( this, SVX_RES( FL_SIZE ) ),
+ maFtWidth ( this, SVX_RES( FT_WIDTH ) ),
+ maMtrWidth ( this, SVX_RES( MTR_FLD_WIDTH ) ),
+ maFtHeight ( this, SVX_RES( FT_HEIGHT ) ),
+ maMtrHeight ( this, SVX_RES( MTR_FLD_HEIGHT ) ),
+ maCbxScale ( this, SVX_RES( CBX_SCALE ) ),
+ maFtSizeReference ( this, SVX_RES( FT_SIZEREFERENCE) ),
+ maCtlSize ( this, SVX_RES( CTL_SIZERECT ), RP_LT ),
+
+ maFlProtect ( this, SVX_RES( FL_PROTECT) ),
+ maTsbPosProtect ( this, SVX_RES( TSB_POSPROTECT ) ),
+ maTsbSizeProtect ( this, SVX_RES( TSB_SIZEPROTECT ) ),
+
+
+ maFlAdjust ( this, SVX_RES( FL_ADJUST ) ),
+ maTsbAutoGrowWidth ( this, SVX_RES( TSB_AUTOGROW_WIDTH ) ),
+ maTsbAutoGrowHeight ( this, SVX_RES( TSB_AUTOGROW_HEIGHT ) ),
+
+ maFlDivider (this, SVX_RES( FL_DIVIDER ) ),
+
+ mrOutAttrs ( rInAttrs ),
+ mnProtectSizeState( STATE_NOCHECK ),
+ mbPageDisabled ( FALSE ),
+ mbProtectDisabled( false ),
+ mbSizeDisabled( false ),
+ mbAdjustDisabled( true )
+{
+ FreeResource();
+
+ // this pege needs ExchangeSupport
+ SetExchangeSupport();
+
+ // evaluate PoolUnit
+ SfxItemPool* pPool = mrOutAttrs.GetPool();
+ DBG_ASSERT( pPool, "no pool (!)" );
+ mePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X );
+
+ meRP = RP_LT; // s.o.
+
+ maMtrWidth.SetModifyHdl( LINK( this, SvxPositionSizeTabPage, ChangeWidthHdl ) );
+ maMtrHeight.SetModifyHdl( LINK( this, SvxPositionSizeTabPage, ChangeHeightHdl ) );
+ maCbxScale.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickAutoHdl ) );
+
+ maTsbAutoGrowWidth.Disable();
+ maTsbAutoGrowHeight.Disable();
+ maFlAdjust.Disable();
+
+ // #i2379# disable controls when protected
+ maTsbPosProtect.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ChangePosProtectHdl ) );
+ maTsbSizeProtect.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ChangeSizeProtectHdl ) );
+
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPositionSizeTabPage::Construct()
+{
+ // get range and work area
+ DBG_ASSERT( mpView, "no valid view (!)" );
+ meDlgUnit = GetModuleFieldUnit( &GetItemSet() );
+ SetFieldUnit( maMtrPosX, meDlgUnit, TRUE );
+ SetFieldUnit( maMtrPosY, meDlgUnit, TRUE );
+ SetFieldUnit( maMtrWidth, meDlgUnit, TRUE );
+ SetFieldUnit( maMtrHeight, meDlgUnit, TRUE );
+
+ if(FUNIT_MILE == meDlgUnit || FUNIT_KM == meDlgUnit)
+ {
+ maMtrPosX.SetDecimalDigits( 3 );
+ maMtrPosY.SetDecimalDigits( 3 );
+ maMtrWidth.SetDecimalDigits( 3 );
+ maMtrHeight.SetDecimalDigits( 3 );
+ }
+
+ { // #i75273#
+ Rectangle aTempRect(mpView->GetAllMarkedRect());
+ mpView->GetSdrPageView()->LogicToPagePos(aTempRect);
+ maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom());
+ }
+
+ { // #i75273#
+ Rectangle aTempRect(mpView->GetWorkArea());
+ mpView->GetSdrPageView()->LogicToPagePos(aTempRect);
+ maWorkRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom());
+ }
+
+ // take anchor into account (Writer)
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if(rMarkList.GetMarkCount())
+ {
+ const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ maAnchor = basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y());
+
+ if(!maAnchor.equalZero()) // -> Writer
+ {
+ for(sal_uInt16 i(1); i < rMarkList.GetMarkCount(); i++)
+ {
+ pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+
+ if(maAnchor != basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y()))
+ {
+ // diferent anchor positions
+ maMtrPosX.SetText( String() );
+ maMtrPosY.SetText( String() );
+ mbPageDisabled = TRUE;
+ return;
+ }
+ }
+
+ // translate ranges about anchor
+ maRange = basegfx::B2DRange(maRange.getMinimum() - maAnchor, maRange.getMaximum() - maAnchor);
+ maWorkRange = basegfx::B2DRange(maWorkRange.getMinimum() - maAnchor, maWorkRange.getMaximum() - maAnchor);
+ }
+ }
+
+ // this should happen via SID_ATTR_TRANSFORM_AUTOSIZE
+ if(1 == rMarkList.GetMarkCount())
+ {
+ const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier());
+
+ if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText())
+ {
+ mbAdjustDisabled = false;
+ maFlAdjust.Enable();
+ maTsbAutoGrowWidth.Enable();
+ maTsbAutoGrowHeight.Enable();
+ maTsbAutoGrowWidth.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickSizeProtectHdl ) );
+ maTsbAutoGrowHeight.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickSizeProtectHdl ) );
+
+ // is used as flag to evaluate if its selectable
+ maTsbAutoGrowWidth.EnableTriState( FALSE );
+ maTsbAutoGrowHeight.EnableTriState( FALSE );
+ }
+ }
+
+ // take scale into account
+ const Fraction aUIScale(mpView->GetModel()->GetUIScale());
+ lcl_ScaleRect( maWorkRange, aUIScale );
+ lcl_ScaleRect( maRange, aUIScale );
+
+ // take UI units into account
+ const sal_uInt16 nDigits(maMtrPosX.GetDecimalDigits());
+ lcl_ConvertRect( maWorkRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit );
+ lcl_ConvertRect( maRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit );
+
+ SetMinMaxPosition();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxPositionSizeTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+{
+ BOOL bModified(FALSE);
+
+ if ( maMtrWidth.HasFocus() )
+ {
+ ChangeWidthHdl( this );
+ }
+
+ if ( maMtrHeight.HasFocus() )
+ {
+ ChangeHeightHdl( this );
+ }
+
+ if( !mbPageDisabled )
+ {
+ if ( maMtrPosX.IsValueModified() || maMtrPosY.IsValueModified() )
+ {
+ const double fUIScale(double(mpView->GetModel()->GetUIScale()));
+ double fX((GetCoreValue( maMtrPosX, mePoolUnit ) + maAnchor.getX()) * fUIScale);
+ double fY((GetCoreValue( maMtrPosY, mePoolUnit ) + maAnchor.getY()) * fUIScale);
+
+ { // #i75273#
+ Rectangle aTempRect(mpView->GetAllMarkedRect());
+ mpView->GetSdrPageView()->LogicToPagePos(aTempRect);
+ maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom());
+ }
+
+ // #101581# GetTopLeftPosition(...) needs coordinates after UI scaling, in real PagePositions
+ GetTopLeftPosition(fX, fY, maRange);
+
+ rOutAttrs.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_X), basegfx::fround(fX)));
+ rOutAttrs.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_Y), basegfx::fround(fY)));
+
+ bModified |= TRUE;
+ }
+
+ if ( maTsbPosProtect.GetState() != maTsbPosProtect.GetSavedValue() )
+ {
+ if( maTsbPosProtect.GetState() == STATE_DONTKNOW )
+ {
+ rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS );
+ }
+ else
+ {
+ rOutAttrs.Put(
+ SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ),
+ maTsbPosProtect.GetState() == STATE_CHECK ? TRUE : FALSE ) );
+ }
+
+ bModified |= TRUE;
+ }
+ }
+
+ if ( maMtrWidth.IsValueModified() || maMtrHeight.IsValueModified() )
+ {
+ Fraction aUIScale = mpView->GetModel()->GetUIScale();
+
+ // get Width
+ double nWidth = static_cast<double>(maMtrWidth.GetValue( meDlgUnit ));
+ nWidth = MetricField::ConvertDoubleValue( nWidth, maMtrWidth.GetBaseValue(), maMtrWidth.GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM );
+ long lWidth = long(nWidth * (double)aUIScale);
+ lWidth = OutputDevice::LogicToLogic( lWidth, MAP_100TH_MM, (MapUnit)mePoolUnit );
+ lWidth = static_cast<long>(maMtrWidth.Denormalize( lWidth ));
+
+ // get Height
+ double nHeight = static_cast<double>(maMtrHeight.GetValue( meDlgUnit ));
+ nHeight = MetricField::ConvertDoubleValue( nHeight, maMtrHeight.GetBaseValue(), maMtrHeight.GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM );
+ long lHeight = long(nHeight * (double)aUIScale);
+ lHeight = OutputDevice::LogicToLogic( lHeight, MAP_100TH_MM, (MapUnit)mePoolUnit );
+ lHeight = static_cast<long>(maMtrWidth.Denormalize( lHeight ));
+
+ // put Width & Height to itemset
+ rOutAttrs.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ),
+ (UINT32) lWidth ) );
+ rOutAttrs.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ),
+ (UINT32) lHeight ) );
+ rOutAttrs.Put( SfxAllEnumItem( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT ), sal::static_int_cast< USHORT >( meRP ) ) );
+ bModified |= TRUE;
+ }
+
+ if ( maTsbSizeProtect.GetState() != maTsbSizeProtect.GetSavedValue() )
+ {
+ if ( maTsbSizeProtect.GetState() == STATE_DONTKNOW )
+ rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE );
+ else
+ rOutAttrs.Put(
+ SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ),
+ maTsbSizeProtect.GetState() == STATE_CHECK ? TRUE : FALSE ) );
+ bModified |= TRUE;
+ }
+
+ if ( maTsbAutoGrowWidth.GetState() != maTsbAutoGrowWidth.GetSavedValue() )
+ {
+ if ( !maTsbAutoGrowWidth.IsTriStateEnabled() )
+ {
+ if( maTsbAutoGrowWidth.GetState() == STATE_DONTKNOW )
+ rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_AUTOWIDTH );
+ else
+ rOutAttrs.Put(
+ SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_AUTOWIDTH ),
+ maTsbAutoGrowWidth.GetState() == STATE_CHECK ? TRUE : FALSE ) );
+ }
+ bModified |= TRUE;
+ }
+
+ if ( maTsbAutoGrowHeight.GetState() != maTsbAutoGrowHeight.GetSavedValue() )
+ {
+ if ( !maTsbAutoGrowHeight.IsTriStateEnabled() )
+ {
+ if( maTsbAutoGrowHeight.GetState() == STATE_DONTKNOW )
+ rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_AUTOHEIGHT );
+ else
+ rOutAttrs.Put(
+ SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_AUTOHEIGHT ),
+ maTsbAutoGrowHeight.GetState() == STATE_CHECK ? TRUE : FALSE ) );
+ }
+ bModified |= TRUE;
+ }
+
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPositionSizeTabPage::Reset( const SfxItemSet& )
+{
+ const SfxPoolItem* pItem;
+ const double fUIScale(double(mpView->GetModel()->GetUIScale()));
+
+ if ( !mbPageDisabled )
+ {
+ pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_X );
+ if ( pItem )
+ {
+ const double fTmp((((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getX()) / fUIScale);
+ SetMetricValue(maMtrPosX, basegfx::fround(fTmp), mePoolUnit);
+ }
+
+ pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_Y );
+ if ( pItem )
+ {
+ const double fTmp((((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getY()) / fUIScale);
+ SetMetricValue(maMtrPosY, basegfx::fround(fTmp), mePoolUnit);
+ }
+
+ pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_POS );
+ if ( pItem )
+ {
+ sal_Bool bProtected = ( ( const SfxBoolItem* )pItem )->GetValue();
+ maTsbPosProtect.SetState( bProtected ? STATE_CHECK : STATE_NOCHECK );
+ maTsbPosProtect.EnableTriState( FALSE );
+ }
+ else
+ {
+ maTsbPosProtect.SetState( STATE_DONTKNOW );
+ }
+
+ maTsbPosProtect.SaveValue();
+ maCtlPos.Reset();
+
+ // #i2379# Disable controls for protected objects
+ ChangePosProtectHdl( this );
+ }
+
+ { // #i75273# set width
+ pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_WIDTH );
+ mfOldWidth = std::max( pItem ? (double)((const SfxUInt32Item*)pItem)->GetValue() : 0.0, 1.0 );
+ double fTmpWidth((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldWidth), (MapUnit)mePoolUnit, MAP_100TH_MM)) / fUIScale);
+
+ if(maMtrWidth.GetDecimalDigits())
+ fTmpWidth *= pow(10.0, maMtrWidth.GetDecimalDigits());
+
+ fTmpWidth = MetricField::ConvertDoubleValue(fTmpWidth, maMtrWidth.GetBaseValue(), maMtrWidth.GetDecimalDigits(), FUNIT_100TH_MM, meDlgUnit);
+ maMtrWidth.SetValue(static_cast<sal_Int64>(fTmpWidth), meDlgUnit);
+ }
+
+ { // #i75273# set height
+ pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_HEIGHT );
+ mfOldHeight = std::max( pItem ? (double)((const SfxUInt32Item*)pItem)->GetValue() : 0.0, 1.0 );
+ double fTmpHeight((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldHeight), (MapUnit)mePoolUnit, MAP_100TH_MM)) / fUIScale);
+
+ if(maMtrHeight.GetDecimalDigits())
+ fTmpHeight *= pow(10.0, maMtrHeight.GetDecimalDigits());
+
+ fTmpHeight = MetricField::ConvertDoubleValue(fTmpHeight, maMtrHeight.GetBaseValue(), maMtrHeight.GetDecimalDigits(), FUNIT_100TH_MM, meDlgUnit);
+ maMtrHeight.SetValue(static_cast<sal_Int64>(fTmpHeight), meDlgUnit);
+ }
+
+ pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_SIZE );
+ if ( pItem )
+ {
+ maTsbSizeProtect.SetState( ( (const SfxBoolItem*)pItem )->GetValue()
+ ? STATE_CHECK : STATE_NOCHECK );
+ maTsbSizeProtect.EnableTriState( FALSE );
+ }
+ else
+ maTsbSizeProtect.SetState( STATE_DONTKNOW );
+
+ pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_AUTOWIDTH );
+ if ( pItem )
+ {
+ maTsbAutoGrowWidth.SetState( ( ( const SfxBoolItem* )pItem )->GetValue()
+ ? STATE_CHECK : STATE_NOCHECK );
+ }
+ else
+ maTsbAutoGrowWidth.SetState( STATE_DONTKNOW );
+
+ pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_AUTOHEIGHT );
+ if ( pItem )
+ {
+ maTsbAutoGrowHeight.SetState( ( ( const SfxBoolItem* )pItem )->GetValue()
+ ? STATE_CHECK : STATE_NOCHECK );
+ }
+ else
+ maTsbAutoGrowHeight.SetState( STATE_DONTKNOW );
+
+ // Ist Abgleich gesetzt?
+ String aStr = GetUserData();
+ maCbxScale.Check( (BOOL)aStr.ToInt32() );
+
+ maTsbSizeProtect.SaveValue();
+ maTsbAutoGrowWidth.SaveValue();
+ maTsbAutoGrowHeight.SaveValue();
+ ClickSizeProtectHdl( NULL );
+
+ // #i2379# Disable controls for protected objects
+ ChangeSizeProtectHdl( this );
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxPositionSizeTabPage::Create( Window* pWindow, const SfxItemSet& rOutAttrs )
+{
+ return( new SvxPositionSizeTabPage( pWindow, rOutAttrs ) );
+}
+
+//------------------------------------------------------------------------
+
+USHORT* SvxPositionSizeTabPage::GetRanges()
+{
+ return( pPosSizeRanges );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPositionSizeTabPage::ActivatePage( const SfxItemSet& rSet )
+{
+ SfxRectangleItem* pRectItem = NULL;
+
+ if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_TRANSFORM_INTERN ) , FALSE, (const SfxPoolItem**) &pRectItem ) )
+ {
+ { // #i75273#
+ const Rectangle aTempRect(pRectItem->GetValue());
+ maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom());
+ }
+
+ SetMinMaxPosition();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SvxPositionSizeTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if( _pSet )
+ {
+ double fX((double)maMtrPosX.GetValue());
+ double fY((double)maMtrPosY.GetValue());
+
+ GetTopLeftPosition(fX, fY, maRange);
+ const Rectangle aOutRectangle(
+ basegfx::fround(fX), basegfx::fround(fY),
+ basegfx::fround(fX + maRange.getWidth()), basegfx::fround(fY + maRange.getHeight()));
+ _pSet->Put(SfxRectangleItem(SID_ATTR_TRANSFORM_INTERN, aOutRectangle));
+
+ FillItemSet(*_pSet);
+ }
+
+ return LEAVE_PAGE;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxPositionSizeTabPage, ChangePosProtectHdl, void *, EMPTYARG )
+{
+ // #106572# Remember user's last choice
+ maTsbSizeProtect.SetState( maTsbPosProtect.GetState() == STATE_CHECK ? STATE_CHECK : mnProtectSizeState );
+ UpdateControlStates();
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+void SvxPositionSizeTabPage::UpdateControlStates()
+{
+ const bool bPosProtect = maTsbPosProtect.GetState() == STATE_CHECK;
+ const bool bSizeProtect = maTsbSizeProtect.GetState() == STATE_CHECK;
+ const bool bHeightChecked = !maTsbAutoGrowHeight.IsTriStateEnabled() && (maTsbAutoGrowHeight.GetState() == STATE_CHECK);
+ const bool bWidthChecked = !maTsbAutoGrowWidth.IsTriStateEnabled() && (maTsbAutoGrowWidth.GetState() == STATE_CHECK);
+
+ maFlPosition.Enable( !bPosProtect && !mbPageDisabled );
+ maFtPosX.Enable( !bPosProtect && !mbPageDisabled );
+ maMtrPosX.Enable( !bPosProtect && !mbPageDisabled );
+ maFtPosY.Enable( !bPosProtect && !mbPageDisabled );
+ maMtrPosY.Enable( !bPosProtect && !mbPageDisabled );
+ maFtPosReference.Enable( !bPosProtect && !mbPageDisabled );
+ maCtlPos.Enable( !bPosProtect );
+ maTsbPosProtect.Enable( !mbProtectDisabled && !mbPageDisabled );
+
+ maFlSize.Enable( !mbSizeDisabled && !bSizeProtect );
+ maCtlSize.Enable( !mbSizeDisabled && !bSizeProtect && (!bHeightChecked || !bWidthChecked) );
+ maFtWidth.Enable( !mbSizeDisabled && !bSizeProtect && !bWidthChecked );
+ maMtrWidth.Enable( !mbSizeDisabled && !bSizeProtect && !bWidthChecked );
+ maFtHeight.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked );
+ maMtrHeight.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked );
+ maCbxScale.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked && !bWidthChecked );
+ maFtSizeReference.Enable( !mbSizeDisabled && !bSizeProtect );
+ maFlProtect.Enable( !mbProtectDisabled );
+ maTsbSizeProtect.Enable( !mbProtectDisabled && !bPosProtect );
+
+ maFlAdjust.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled );
+ maTsbAutoGrowWidth.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled );
+ maTsbAutoGrowHeight.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled );
+
+ maCtlSize.Invalidate();
+ maCtlPos.Invalidate();
+
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxPositionSizeTabPage, ChangeSizeProtectHdl, void *, EMPTYARG )
+{
+ if( maTsbSizeProtect.IsEnabled() )
+ {
+ // #106572# Remember user's last choice
+
+ // Note: this works only as long as the dialog is open. When
+ // the user closes the dialog, there is no way to remember
+ // whether size was enabled or disabled befor pos protect was
+ // clicked. Thus, if pos protect is selected, the dialog is
+ // closed and reopened again, unchecking pos protect will
+ // always uncheck size protect, too. That's life.
+ mnProtectSizeState = maTsbSizeProtect.GetState();
+ }
+
+ UpdateControlStates();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxPositionSizeTabPage, ChangePosXHdl, void *, EMPTYARG )
+{
+ return( 0L );
+}
+IMPL_LINK_INLINE_END( SvxPositionSizeTabPage, ChangePosXHdl, void *, EMPTYARG )
+
+//------------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxPositionSizeTabPage, ChangePosYHdl, void *, EMPTYARG )
+{
+ return( 0L );
+}
+IMPL_LINK_INLINE_END( SvxPositionSizeTabPage, ChangePosYHdl, void *, EMPTYARG )
+
+//------------------------------------------------------------------------
+
+void SvxPositionSizeTabPage::SetMinMaxPosition()
+{
+ // position
+ double fLeft(maWorkRange.getMinX());
+ double fTop(maWorkRange.getMinY());
+ double fRight(maWorkRange.getMaxX());
+ double fBottom(maWorkRange.getMaxY());
+
+ switch ( maCtlPos.GetActualRP() )
+ {
+ case RP_LT:
+ {
+ fRight -= maRange.getWidth();
+ fBottom -= maRange.getHeight();
+ break;
+ }
+ case RP_MT:
+ {
+ fLeft += maRange.getWidth() / 2.0;
+ fRight -= maRange.getWidth() / 2.0;
+ fBottom -= maRange.getHeight();
+ break;
+ }
+ case RP_RT:
+ {
+ fLeft += maRange.getWidth();
+ fBottom -= maRange.getHeight();
+ break;
+ }
+ case RP_LM:
+ {
+ fRight -= maRange.getWidth();
+ fTop += maRange.getHeight() / 2.0;
+ fBottom -= maRange.getHeight() / 2.0;
+ break;
+ }
+ case RP_MM:
+ {
+ fLeft += maRange.getWidth() / 2.0;
+ fRight -= maRange.getWidth() / 2.0;
+ fTop += maRange.getHeight() / 2.0;
+ fBottom -= maRange.getHeight() / 2.0;
+ break;
+ }
+ case RP_RM:
+ {
+ fLeft += maRange.getWidth();
+ fTop += maRange.getHeight() / 2.0;
+ fBottom -= maRange.getHeight() / 2.0;
+ break;
+ }
+ case RP_LB:
+ {
+ fRight -= maRange.getWidth();
+ fTop += maRange.getHeight();
+ break;
+ }
+ case RP_MB:
+ {
+ fLeft += maRange.getWidth() / 2.0;
+ fRight -= maRange.getWidth() / 2.0;
+ fTop += maRange.getHeight();
+ break;
+ }
+ case RP_RB:
+ {
+ fLeft += maRange.getWidth();
+ fTop += maRange.getHeight();
+ break;
+ }
+ }
+
+ const double fMaxLong((double)(MetricField::ConvertValue( LONG_MAX, 0, MAP_100TH_MM, meDlgUnit ) - 1L));
+ fLeft = (fLeft > fMaxLong) ? fMaxLong : (fLeft < -fMaxLong) ? -fMaxLong : fLeft;
+ fRight = (fRight > fMaxLong) ? fMaxLong : (fRight < -fMaxLong) ? -fMaxLong : fRight;
+ fTop = (fTop > fMaxLong) ? fMaxLong : (fTop < -fMaxLong) ? -fMaxLong : fTop;
+ fBottom = (fBottom > fMaxLong) ? fMaxLong : (fBottom < -fMaxLong) ? -fMaxLong : fBottom;
+
+ // #i75273# normalizing when setting the min/max values was wrong, removed
+ maMtrPosX.SetMin(basegfx::fround64(fLeft));
+ maMtrPosX.SetFirst(basegfx::fround64(fLeft));
+ maMtrPosX.SetMax(basegfx::fround64(fRight));
+ maMtrPosX.SetLast(basegfx::fround64(fRight));
+ maMtrPosY.SetMin(basegfx::fround64(fTop));
+ maMtrPosY.SetFirst(basegfx::fround64(fTop));
+ maMtrPosY.SetMax(basegfx::fround64(fBottom));
+ maMtrPosY.SetLast(basegfx::fround64(fBottom));
+
+ // size
+ fLeft = maWorkRange.getMinX();
+ fTop = maWorkRange.getMinY();
+ fRight = maWorkRange.getMaxX();
+ fBottom = maWorkRange.getMaxY();
+ double fNewX(0);
+ double fNewY(0);
+
+ switch ( maCtlSize.GetActualRP() )
+ {
+ case RP_LT:
+ {
+ fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft );
+ fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop );
+ break;
+ }
+ case RP_MT:
+ {
+ fNewX = std::min( maRange.getCenter().getX() - fLeft, fRight - maRange.getCenter().getX() ) * 2.0;
+ fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop );
+ break;
+ }
+ case RP_RT:
+ {
+ fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() );
+ fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop );
+ break;
+ }
+ case RP_LM:
+ {
+ fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft );
+ fNewY = std::min( maRange.getCenter().getY() - fTop, fBottom - maRange.getCenter().getY() ) * 2.0;
+ break;
+ }
+ case RP_MM:
+ {
+ const double f1(maRange.getCenter().getX() - fLeft);
+ const double f2(fRight - maRange.getCenter().getX());
+ const double f3(std::min(f1, f2));
+ const double f4(maRange.getCenter().getY() - fTop);
+ const double f5(fBottom - maRange.getCenter().getY());
+ const double f6(std::min(f4, f5));
+
+ fNewX = f3 * 2.0;
+ fNewY = f6 * 3.0;
+
+ break;
+ }
+ case RP_RM:
+ {
+ fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() );
+ fNewY = std::min( maRange.getCenter().getY() - fTop, fBottom - maRange.getCenter().getY() ) * 2.0;
+ break;
+ }
+ case RP_LB:
+ {
+ fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft );
+ fNewY = maWorkRange.getHeight() - ( fBottom - maRange.getMaxY() );
+ break;
+ }
+ case RP_MB:
+ {
+ fNewX = std::min( maRange.getCenter().getX() - fLeft, fRight - maRange.getCenter().getX() ) * 2.0;
+ fNewY = maWorkRange.getHeight() - ( maRange.getMaxY() - fBottom );
+ break;
+ }
+ case RP_RB:
+ {
+ fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() );
+ fNewY = maWorkRange.getHeight() - ( fBottom - maRange.getMaxY() );
+ break;
+ }
+ }
+
+ // #i75273# normalizing when setting the min/max values was wrong, removed
+ maMtrWidth.SetMax(basegfx::fround64(fNewX));
+ maMtrWidth.SetLast(basegfx::fround64(fNewX));
+ maMtrHeight.SetMax(basegfx::fround64(fNewY));
+ maMtrHeight.SetLast(basegfx::fround64(fNewY));
+}
+
+//------------------------------------------------------------------------
+
+void SvxPositionSizeTabPage::GetTopLeftPosition(double& rfX, double& rfY, const basegfx::B2DRange& rRange)
+{
+ switch (maCtlPos.GetActualRP())
+ {
+ case RP_LT:
+ {
+ break;
+ }
+ case RP_MT:
+ {
+ rfX -= rRange.getCenter().getX() - rRange.getMinX();
+ break;
+ }
+ case RP_RT:
+ {
+ rfX -= rRange.getWidth();
+ break;
+ }
+ case RP_LM:
+ {
+ rfY -= rRange.getCenter().getY() - rRange.getMinY();
+ break;
+ }
+ case RP_MM:
+ {
+ rfX -= rRange.getCenter().getX() - rRange.getMinX();
+ rfY -= rRange.getCenter().getY() - rRange.getMinY();
+ break;
+ }
+ case RP_RM:
+ {
+ rfX -= rRange.getWidth();
+ rfY -= rRange.getCenter().getY() - rRange.getMinY();
+ break;
+ }
+ case RP_LB:
+ {
+ rfY -= rRange.getHeight();
+ break;
+ }
+ case RP_MB:
+ {
+ rfX -= rRange.getCenter().getX() - rRange.getMinX();
+ rfY -= rRange.getHeight();
+ break;
+ }
+ case RP_RB:
+ {
+ rfX -= rRange.getWidth();
+ rfY -= rRange.getHeight();
+ break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxPositionSizeTabPage::PointChanged( Window* pWindow, RECT_POINT eRP )
+{
+ if( pWindow == &maCtlPos )
+ {
+ SetMinMaxPosition();
+ switch( eRP )
+ {
+ case RP_LT:
+ {
+ maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) );
+ maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) );
+ break;
+ }
+ case RP_MT:
+ {
+ maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) );
+ maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) );
+ break;
+ }
+ case RP_RT:
+ {
+ maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) );
+ maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) );
+ break;
+ }
+ case RP_LM:
+ {
+ maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) );
+ maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) );
+ break;
+ }
+ case RP_MM:
+ {
+ maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) );
+ maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) );
+ break;
+ }
+ case RP_RM:
+ {
+ maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) );
+ maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) );
+ break;
+ }
+ case RP_LB:
+ {
+ maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) );
+ maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) );
+ break;
+ }
+ case RP_MB:
+ {
+ maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) );
+ maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) );
+ break;
+ }
+ case RP_RB:
+ {
+ maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) );
+ maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) );
+ break;
+ }
+ }
+ }
+ else
+ {
+ meRP = eRP;
+
+ Rectangle aTmpRect( GetRect() );
+ SetMinMaxPosition();
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxPositionSizeTabPage::DisableResize()
+{
+ mbSizeDisabled = true;
+}
+
+//------------------------------------------------------------------------
+
+void SvxPositionSizeTabPage::DisableProtect()
+{
+ mbProtectDisabled = true;
+}
+
+//------------------------------------------------------------------------
+
+Rectangle SvxPositionSizeTabPage::GetRect()
+{
+ double fLeft(maRange.getMinX());
+ double fTop(maRange.getMinY());
+ double fRight(fLeft + (double)maMtrWidth.GetValue());
+ double fBottom(fTop + (double)maMtrHeight.GetValue());
+
+ switch ( maCtlSize.GetActualRP() )
+ {
+ case RP_LT:
+ {
+ break;
+ }
+ case RP_MT:
+ {
+ fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0;
+ break;
+ }
+ case RP_RT:
+ {
+ fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() );
+ break;
+ }
+ case RP_LM:
+ {
+ fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0;
+ break;
+ }
+ case RP_MM:
+ {
+ fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0;
+ fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0;
+ break;
+ }
+ case RP_RM:
+ {
+ fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() );
+ fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0;
+ break;
+ }
+ case RP_LB:
+ {
+ fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() );
+ break;
+ }
+ case RP_MB:
+ {
+ fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0;
+ fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() );
+ break;
+ }
+ case RP_RB:
+ {
+ fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() );
+ fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() );
+ break;
+ }
+ }
+
+ return Rectangle(basegfx::fround(fLeft), basegfx::fround(fTop), basegfx::fround(fRight), basegfx::fround(fBottom));
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxPositionSizeTabPage, ChangeWidthHdl, void *, EMPTYARG )
+{
+ if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() )
+ {
+ sal_Int64 nHeight(basegfx::fround64((mfOldHeight * (double)maMtrWidth.GetValue()) / mfOldWidth));
+
+ if(nHeight <= maMtrHeight.GetMax(FUNIT_NONE))
+ {
+ maMtrHeight.SetUserValue(nHeight, FUNIT_NONE);
+ }
+ else
+ {
+ nHeight = maMtrHeight.GetMax(FUNIT_NONE);
+ maMtrHeight.SetUserValue(nHeight);
+
+ const sal_Int64 nWidth(basegfx::fround64((mfOldWidth * (double)nHeight) / mfOldHeight));
+ maMtrWidth.SetUserValue(nWidth, FUNIT_NONE);
+ }
+ }
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxPositionSizeTabPage, ChangeHeightHdl, void *, EMPTYARG )
+{
+ if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() )
+ {
+ sal_Int64 nWidth(basegfx::fround64((mfOldWidth * (double)maMtrHeight.GetValue()) / mfOldHeight));
+
+ if(nWidth <= maMtrWidth.GetMax(FUNIT_NONE))
+ {
+ maMtrWidth.SetUserValue(nWidth, FUNIT_NONE);
+ }
+ else
+ {
+ nWidth = maMtrWidth.GetMax(FUNIT_NONE);
+ maMtrWidth.SetUserValue(nWidth);
+
+ const sal_Int64 nHeight(basegfx::fround64((mfOldHeight * (double)nWidth) / mfOldWidth));
+ maMtrHeight.SetUserValue(nHeight, FUNIT_NONE);
+ }
+ }
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxPositionSizeTabPage, ClickSizeProtectHdl, void *, EMPTYARG )
+{
+ UpdateControlStates();
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxPositionSizeTabPage, ClickAutoHdl, void *, EMPTYARG )
+{
+ if( maCbxScale.IsChecked() )
+ {
+ mfOldWidth = std::max( (double)GetCoreValue( maMtrWidth, mePoolUnit ), 1.0 );
+ mfOldHeight = std::max( (double)GetCoreValue( maMtrHeight, mePoolUnit ), 1.0 );
+ }
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+void SvxPositionSizeTabPage::FillUserData()
+{
+ // Abgleich wird in der Ini-Datei festgehalten
+ UniString aStr = UniString::CreateFromInt32( (sal_Int32) maCbxScale.IsChecked() );
+ SetUserData( aStr );
+}
+
+// eof
diff --git a/cui/source/tabpages/transfrm.hrc b/cui/source/tabpages/transfrm.hrc
new file mode 100644
index 000000000000..a49a8c3f3985
--- /dev/null
+++ b/cui/source/tabpages/transfrm.hrc
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * 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: transfrm.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 1
+#define BTN_OK 2
+#define BTN_CANCEL 3
+#define BTN_HELP 4
+#define FT_POS_X 5
+#define FT_POS_Y 6
+#define MTR_FLD_POS_X 7
+#define MTR_FLD_POS_Y 8
+#define CBX_COPY 9
+#define TSB_PROTECT 10
+#define TSB_AUTO 11
+#define TSB_AUTOGROW_HEIGHT 12
+#define TSB_AUTOGROW_WIDTH 13
+#define BTN_RESET 14
+#define FT_WIDTH 15
+#define FT_HEIGHT 16
+#define MTR_FLD_WIDTH 17
+#define MTR_FLD_HEIGHT 18
+#define MTR_FLD_ANGLE 19
+#define CTL_RECT 20
+#define CTL_ANGLE 21
+#define CBX_SCALE 22
+#define FL_ADJUST 23
+#define FL_POSITION 24
+#define FL_SIZE 25
+#define FL_SLANT 26
+#define FL_RADIUS 27
+#define FT_RADIUS 28
+#define MTR_FLD_RADIUS 29
+#define FL_ANGLE 30
+#define FT_ANGLE 31
+#define TSB_VERTICAL 32
+#define FL_ANCHOR 33
+#define FT_ANCHOR 34
+#define LB_ANCHOR 35
+#define FT_ORIENT 36
+#define FT_REFERENCE 37
+#define FT_POSPRESETS 38
+#define FT_ANGLEPRESETS 39
+#define LB_ORIENT 40
+#define FT_SIZEREFERENCE 41
+#define CTL_SIZERECT 42
+#define FT_POSREFERENCE 43
+#define CTL_POSRECT 44
+#define TSB_POSPROTECT 45
+#define TSB_SIZEPROTECT 46
+#define FL_PROTECT 47
+#define FL_DIVIDER 48
+
+//
diff --git a/cui/source/tabpages/transfrm.src b/cui/source/tabpages/transfrm.src
new file mode 100644
index 000000000000..1a64d5962f85
--- /dev/null
+++ b/cui/source/tabpages/transfrm.src
@@ -0,0 +1,612 @@
+/*************************************************************************
+ *
+ * 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: transfrm.src,v $
+ * $Revision: 1.57 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svtools/controldims.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include "transfrm.hrc"
+ // pragma -------------------------------------------------------------------
+
+#define MA_TABPAGE_HEIGHT 185
+
+ // RID_SVXPAGE_POSITION_SIZE ------------------------------------------------
+TabPage RID_SVXPAGE_POSITION_SIZE
+{
+ HelpId = HID_TRANS_POSITION_SIZE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Position and Size" ;
+ Size = MAP_APPFONT ( 260 , MA_TABPAGE_HEIGHT ) ;
+
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Position" ;
+ };
+ FixedText FT_POS_X
+ {
+ Pos = MAP_APPFONT ( 12 , 16 + 8 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Position ~X" ;
+ };
+ FixedText FT_POS_Y
+ {
+ Pos = MAP_APPFONT ( 12 , 32 + 8 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Position ~Y" ;
+ };
+ MetricField MTR_FLD_POS_X
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 14 + 8 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -120000 ;
+ Maximum = 240000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 10 ;
+ };
+ MetricField MTR_FLD_POS_Y
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 30 + 8 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -120000 ;
+ Maximum = 240000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_POSREFERENCE
+ {
+ Pos = MAP_APPFONT ( 178 , 2 + 8 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Base point";
+ };
+ Control CTL_POSRECT
+ {
+ HelpId = HID_TPPOSITION_CTRL ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 178 , 12 + 8 ) ;
+ Size = MAP_APPFONT ( 48 , 34 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Base point" ;
+ };
+
+ // size
+
+ FixedLine FL_SIZE
+ {
+ Pos = MAP_APPFONT ( 6 , 56 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Size" ;
+ };
+ FixedText FT_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 16 + 61 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Wi~dth" ;
+ };
+ FixedText FT_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 32 + 61 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "H~eight" ;
+ };
+ MetricField MTR_FLD_WIDTH
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 14 + 61 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 120000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 10 ;
+ };
+ MetricField MTR_FLD_HEIGHT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 30 + 61 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 120000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_SIZEREFERENCE
+ {
+ Pos = MAP_APPFONT ( 178 , 2 + 61 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Base point";
+ };
+ Control CTL_SIZERECT
+ {
+ HelpId = HID_TPSIZE_CTRL ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 178 , 12 + 61 ) ;
+ Size = MAP_APPFONT ( 48 , 34 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Base point" ;
+ };
+ CheckBox CBX_SCALE
+ {
+ Pos = MAP_APPFONT ( 12 , 47 + 61 ) ;
+ Size = MAP_APPFONT ( 162 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Keep ratio" ;
+ };
+
+ // Protect
+
+ FixedLine FL_PROTECT
+ {
+ Pos = MAP_APPFONT ( 6 , 120 ) ;
+ Size = MAP_APPFONT ( 119 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Protect" ;
+ };
+
+ TriStateBox TSB_POSPROTECT
+ {
+ Pos = MAP_APPFONT ( 12 , 10 + 120 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ Text [ en-US ] = "Position" ;
+ TabStop = TRUE ;
+ };
+
+ TriStateBox TSB_SIZEPROTECT
+ {
+ Pos = MAP_APPFONT ( 12 , 24 + 120 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ Text [ en-US ] = "~Size" ;
+ TabStop = TRUE ;
+ };
+
+ // Adjust
+
+ FixedLine FL_ADJUST
+ {
+ Pos = MAP_APPFONT ( 6 + 123 + 6 , 120 ) ;
+ Size = MAP_APPFONT ( 119 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Adapt" ;
+ };
+ TriStateBox TSB_AUTOGROW_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 + 121 + 8, 10 + 120 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ Text [ en-US ] = "~Fit width to text" ;
+ TabStop = TRUE ;
+ };
+ TriStateBox TSB_AUTOGROW_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12 + 121 + 8, 24 + 120 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ Text [ en-US ] = "Fit ~height to text" ;
+ TabStop = TRUE ;
+ };
+
+ FixedLine FL_DIVIDER
+ {
+ Pos = MAP_APPFONT( 6 + 119 + 5, 128 );
+ Size = MAP_APPFONT( RSC_CD_FIXEDLINE_WIDTH, 26 );
+ Vert = True;
+ };
+
+ // Anchor
+
+ FixedLine FL_ANCHOR
+ {
+ Pos = MAP_APPFONT ( 6 + 123 + 6 , 120 ) ;
+ Size = MAP_APPFONT ( 119 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Anchor" ;
+ };
+ FixedText FT_ANCHOR
+ {
+ Pos = MAP_APPFONT ( 12 + 121 + 8, 10 + 120 ) ;
+ Size = MAP_APPFONT ( 37 , 10 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Anchor" ;
+ };
+ ListBox LB_ANCHOR
+ {
+ Pos = MAP_APPFONT ( 46 + 121 + 16 , 8 + 120 ) ;
+ Size = MAP_APPFONT ( 54 , 60 ) ;
+ Hide = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "To paragraph" ; > ;
+ < "As character" ; > ;
+ < "To page" ; > ;
+ < "To frame" ; > ;
+ };
+ };
+ FixedText FT_ORIENT
+ {
+ Pos = MAP_APPFONT ( 12 + 121 + 8, 24 + 120 ) ;
+ Size = MAP_APPFONT ( 37 , 10 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "P~osition";
+ };
+ ListBox LB_ORIENT
+ {
+ Pos = MAP_APPFONT ( 46 + 121 + 16 , 22 + 120 );
+ Size = MAP_APPFONT ( 54 , 60 ) ;
+ Hide = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "From top" ; > ;
+ < "Above" ; > ;
+ < "Centered" ; > ;
+ < "Below" ; > ;
+ < "Top of character" ; > ;
+ < "Center of character" ; > ;
+ < "Bottom of character" ; > ;
+ < "Top of line" ; > ;
+ < "Center of line" ; > ;
+ < "Bottom of line" ; > ;
+ };
+ };
+};
+
+ // RID_SVXPAGE_ANGLE --------------------------------------------------------
+TabPage RID_SVXPAGE_ANGLE
+{
+ HelpId = HID_TRANS_ANGLE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Angle" ;
+ Size = MAP_APPFONT ( 260 , MA_TABPAGE_HEIGHT ) ;
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Pivot point" ;
+ };
+ FixedText FT_POS_X
+ {
+ Pos = MAP_APPFONT ( 12 , 16 + 11 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Position ~X" ;
+ };
+ FixedText FT_POS_Y
+ {
+ Pos = MAP_APPFONT ( 12 , 32 + 11 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Position ~Y" ;
+ };
+ MetricField MTR_FLD_POS_X
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 14 + 11 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -500000 ;
+ Maximum = 500000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 10 ;
+ };
+ MetricField MTR_FLD_POS_Y
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 30 + 11 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -500000 ;
+ Maximum = 500000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_POSPRESETS
+ {
+ Pos = MAP_APPFONT ( 178 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Default settings";
+ };
+ Control CTL_RECT
+ {
+ HelpId = HID_TPROTATION_CTRL1 ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 178 , 14 + 11 ) ;
+ Size = MAP_APPFONT ( 70 , 48 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Rotation point" ;
+ };
+ FixedLine FL_ANGLE
+ {
+ Pos = MAP_APPFONT ( 6 , 71 + 11 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Rotation angle" ;
+ };
+ FixedText FT_ANGLE
+ {
+ Pos = MAP_APPFONT ( 12 , 84 + 22 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "~Angle" ;
+ };
+ MetricField MTR_FLD_ANGLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 82 + 22 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -500000 ;
+ Maximum = 500000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = " degrees" ;
+ SpinSize = 500 ;
+ };
+ FixedText FT_ANGLEPRESETS
+ {
+ Pos = MAP_APPFONT ( 178 , 82 + 11 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Default settings";
+ };
+ Control CTL_ANGLE
+ {
+ HelpId = HID_TPROTATION_CTRL2 ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 178 , 82 + 22 ) ;
+ Size = MAP_APPFONT ( 70 , 48 ) ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Rotation Angle";
+ };
+};
+ // RID_SVXPAGE_SLANT -----------------------------------------------------
+TabPage RID_SVXPAGE_SLANT
+{
+ HelpId = HID_TRANS_SLANT ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , MA_TABPAGE_HEIGHT ) ;
+ Text [ en-US ] = "Slant & Corner Radius" ;
+ FixedLine FL_RADIUS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Corner radius" ;
+ };
+ FixedText FT_RADIUS
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "~Radius" ;
+ };
+ MetricField MTR_FLD_RADIUS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 14 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 500000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 10 ;
+ };
+ FixedLine FL_SLANT
+ {
+ Pos = MAP_APPFONT ( 6 , 35 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Slant" ;
+ };
+ FixedText FT_ANGLE
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "~Angle" ;
+ };
+ MetricField MTR_FLD_ANGLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 46 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -8900 ;
+ First = -8900 ;
+ Maximum = 8900 ;
+ Last = 8900 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CUSTOM ;
+ SpinSize = 500 ;
+ CustomUnitText [ en-US ] = " degrees" ;
+ };
+};
+ // RID_SVXDLG_TRANSFORM -----------------------------------------------------
+
+#define _POS_SIZE_TEXT \
+ Text [ en-US ] = "Position and Size" ; \
+
+
+TabDialog RID_SVXDLG_TRANSFORM\
+{
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , MA_TABPAGE_HEIGHT + 41 ) ;
+ Text [ en-US ] = "Position and Size" ;\
+ Moveable = TRUE ;
+ TabControl TAB_CONTROL\
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , MA_TABPAGE_HEIGHT ) ;
+ PageList =
+ {
+ PageItem\
+ {
+ Identifier = RID_SVXPAGE_POSITION_SIZE ;
+ PageResID = RID_SVXPAGE_POSITION_SIZE ;
+ _POS_SIZE_TEXT
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_SWPOSSIZE;
+ PageResID = RID_SVXPAGE_SWPOSSIZE;
+ _POS_SIZE_TEXT
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_ANGLE ;
+ Text [ en-US ] = "Rotation" ;
+ PageResID = RID_SVXPAGE_ANGLE ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_SLANT ;
+ PageResID = RID_SVXPAGE_SLANT ;
+ Text [ en-US ] = "Slant & Corner Radius" ;
+ };
+ };
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+