summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basegfx/source/polygon/b2dpolygoncutandtouch.cxx6
-rw-r--r--comphelper/inc/comphelper/propertycontainerhelper.hxx2
-rw-r--r--comphelper/inc/comphelper/stillreadwriteinteraction.hxx69
-rw-r--r--comphelper/source/misc/makefile.mk1
-rw-r--r--comphelper/source/misc/mediadescriptor.cxx121
-rw-r--r--comphelper/source/misc/stillreadwriteinteraction.cxx144
-rw-r--r--i18npool/inc/transliteration_body.hxx25
-rw-r--r--i18npool/source/breakiterator/data/ja.dic1
-rw-r--r--i18npool/source/localedata/data/ak_GH.xml3
-rw-r--r--i18npool/source/localedata/data/bs_BA.xml9
-rw-r--r--i18npool/source/localedata/data/ee_GH.xml3
-rw-r--r--i18npool/source/localedata/data/en_GH.xml6
-rw-r--r--i18npool/source/localedata/data/en_US.xml3
-rw-r--r--i18npool/source/localedata/data/eo.xml3
-rw-r--r--i18npool/source/localedata/data/eu.xml5
-rw-r--r--i18npool/source/localedata/data/fur_IT.xml3
-rw-r--r--i18npool/source/localedata/data/fy_NL.xml3
-rw-r--r--i18npool/source/localedata/data/gsc_FR.xml11
-rw-r--r--i18npool/source/localedata/data/gug_PY.xml3
-rw-r--r--i18npool/source/localedata/data/ha_GH.xml3
-rw-r--r--i18npool/source/localedata/data/hil_PH.xml3
-rw-r--r--i18npool/source/localedata/data/hr_HR.xml9
-rw-r--r--i18npool/source/localedata/data/hy_AM.xml3
-rw-r--r--i18npool/source/localedata/data/is_IS.xml5
-rw-r--r--i18npool/source/localedata/data/ka_GE.xml3
-rw-r--r--i18npool/source/localedata/data/kk_KZ.xml3
-rw-r--r--i18npool/source/localedata/data/km_KH.xml3
-rw-r--r--i18npool/source/localedata/data/ko_KR.xml5
-rw-r--r--i18npool/source/localedata/data/ku_TR.xml3
-rw-r--r--i18npool/source/localedata/data/lg_UG.xml7
-rw-r--r--i18npool/source/localedata/data/ln_CD.xml3
-rw-r--r--i18npool/source/localedata/data/lt_LT.xml5
-rw-r--r--i18npool/source/localedata/data/lv_LV.xml2
-rw-r--r--i18npool/source/localedata/data/mk_MK.xml3
-rw-r--r--i18npool/source/localedata/data/mt_MT.xml3
-rw-r--r--i18npool/source/localedata/data/my_MM.xml3
-rw-r--r--i18npool/source/localedata/data/ne_NP.xml3
-rw-r--r--i18npool/source/localedata/data/oc_FR.xml3
-rw-r--r--i18npool/source/localedata/data/or_IN.xml3
-rw-r--r--i18npool/source/localedata/data/sg_CF.xml3
-rw-r--r--i18npool/source/localedata/data/sh_RS.xml3
-rw-r--r--i18npool/source/localedata/data/shs_CA.xml3
-rw-r--r--i18npool/source/localedata/data/sk_SK.xml5
-rw-r--r--i18npool/source/localedata/data/sl_SI.xml3
-rw-r--r--i18npool/source/localedata/data/so_SO.xml3
-rw-r--r--i18npool/source/localedata/data/sr_RS.xml3
-rw-r--r--i18npool/source/localedata/data/sw_TZ.xml3
-rw-r--r--i18npool/source/localedata/data/tk_TM.xml3
-rw-r--r--i18npool/source/localedata/data/tpi_PG.xml3
-rw-r--r--i18npool/source/localedata/data/uk_UA.xml9
-rw-r--r--i18npool/source/localedata/data/vi_VN.xml3
-rw-r--r--i18npool/source/localedata/data/zh_CN.xml23
-rw-r--r--i18npool/source/localedata/data/zh_TW.xml25
-rw-r--r--i18npool/source/registerservices/registerservices.cxx12
-rwxr-xr-x[-rw-r--r--]i18npool/source/transliteration/transliteration_body.cxx263
-rw-r--r--i18npool/util/makefile.mk1
-rw-r--r--l10ntools/inc/export.hxx2
-rwxr-xr-xl10ntools/java/jpropex/build.xml169
-rw-r--r--l10ntools/java/jpropex/java/JPropEx.java429
-rw-r--r--l10ntools/java/jpropex/java/Main.java (renamed from svtools/source/uno/unoifac2.hrc)30
-rw-r--r--l10ntools/java/jpropex/java/NoLocalizeFilter.java (renamed from svtools/source/uno/unoifac2.src)99
-rw-r--r--l10ntools/java/jpropex/java/OrderedHashMap.java96
-rw-r--r--l10ntools/java/jpropex/java/SdfData.java109
-rw-r--r--l10ntools/java/jpropex/java/SdfEntity.java254
-rwxr-xr-xl10ntools/java/jpropex/jpropex10
-rwxr-xr-xl10ntools/java/jpropex/jpropex.MF1
-rwxr-xr-xl10ntools/java/jpropex/makefile.mk36
-rw-r--r--l10ntools/prj/build.lst3
-rw-r--r--l10ntools/prj/d.lst3
-rw-r--r--[-rwxr-xr-x]l10ntools/scripts/localize.pl10
-rw-r--r--l10ntools/source/export.cxx12
-rw-r--r--l10ntools/source/help/HelpLinker.cxx2
-rw-r--r--l10ntools/source/localize.cxx15
-rw-r--r--l10ntools/source/merge.cxx16
-rw-r--r--sax/inc/sax/tools/converter.hxx1
-rw-r--r--sax/prj/build.lst1
-rw-r--r--sax/qa/cppunit/makefile.mk71
-rw-r--r--sax/qa/cppunit/test_converter.cxx244
-rw-r--r--sax/qa/cppunit/version.map34
-rw-r--r--sax/source/tools/converter.cxx165
-rw-r--r--svl/inc/svl/solar.hrc4
-rw-r--r--svl/inc/svl/svl.hrc160
-rw-r--r--svl/source/items/cstitem.src2
-rw-r--r--svl/source/items/dateitem.cxx3
-rw-r--r--svl/source/items/nranges.cxx4
-rw-r--r--svl/source/items/srchitem.cxx72
-rw-r--r--svl/source/misc/inettype.cxx4
-rw-r--r--svl/source/misc/mediatyp.src2
-rwxr-xr-x[-rw-r--r--]svtools/inc/svtools/accessiblefactory.hxx16
-rwxr-xr-xsvtools/inc/svtools/accessibletable.hxx2
-rw-r--r--svtools/inc/svtools/accessibletableprovider.hxx2
-rw-r--r--svtools/inc/svtools/brwbox.hxx4
-rw-r--r--svtools/inc/svtools/filter.hxx5
-rw-r--r--svtools/inc/svtools/popupmenucontrollerbase.hxx141
-rw-r--r--svtools/inc/svtools/popupwindowcontroller.hxx85
-rw-r--r--svtools/inc/svtools/roadmapwizard.hxx15
-rw-r--r--svtools/inc/svtools/svtabbx.hxx2
-rw-r--r--svtools/inc/svtools/svtools.hrc (renamed from svl/inc/svl/svtools.hrc)137
-rw-r--r--svtools/inc/svtools/table/tablecontrol.hxx6
-rw-r--r--svtools/inc/svtools/toolbarmenu.hxx155
-rw-r--r--svtools/inc/svtools/toolboxcontroller.hxx35
-rwxr-xr-xsvtools/inc/svtools/toolpanel/decklayouter.hxx104
-rw-r--r--svtools/inc/svtools/toolpanel/drawerlayouter.hxx102
-rw-r--r--svtools/inc/svtools/toolpanel/paneltabbar.hxx102
-rw-r--r--svtools/inc/svtools/toolpanel/refbase.hxx80
-rw-r--r--svtools/inc/svtools/toolpanel/tabalignment.hxx47
-rw-r--r--svtools/inc/svtools/toolpanel/tabitemcontent.hxx48
-rwxr-xr-xsvtools/inc/svtools/toolpanel/tablayouter.hxx112
-rw-r--r--svtools/inc/svtools/toolpanel/toolpanel.hxx147
-rwxr-xr-xsvtools/inc/svtools/toolpanel/toolpaneldeck.hxx193
-rw-r--r--svtools/inc/svtools/valueset.hxx3
-rw-r--r--svtools/inc/svtools/wizardmachine.hxx48
-rw-r--r--svtools/prj/build.lst5
-rw-r--r--svtools/prj/d.lst3
-rw-r--r--svtools/source/brwbox/brwbox1.cxx5
-rw-r--r--svtools/source/brwbox/brwbox2.cxx15
-rw-r--r--svtools/source/brwbox/brwbox3.cxx2
-rw-r--r--svtools/source/brwbox/datwin.hxx1
-rw-r--r--svtools/source/brwbox/editbrowsebox.cxx2
-rw-r--r--svtools/source/brwbox/editbrowsebox.src2
-rw-r--r--svtools/source/contnr/fileview.cxx2
-rw-r--r--svtools/source/contnr/fileview.src2
-rw-r--r--svtools/source/contnr/svcontnr.src2
-rw-r--r--svtools/source/contnr/svimpbox.cxx44
-rw-r--r--svtools/source/contnr/svlbox.cxx11
-rw-r--r--svtools/source/contnr/svtabbx.cxx4
-rw-r--r--svtools/source/contnr/svtreebx.cxx49
-rw-r--r--svtools/source/contnr/templwin.cxx2
-rw-r--r--svtools/source/contnr/templwin.src2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/calendar.cxx2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/calendar.src2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/collatorres.cxx2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/ctrlbox.cxx2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/ctrlbox.src2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/ctrltool.cxx2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/ctrltool.src2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/indexentryres.cxx2
-rwxr-xr-x[-rw-r--r--]svtools/source/control/makefile.mk4
-rw-r--r--svtools/source/control/toolbarmenu.cxx1805
-rw-r--r--svtools/source/control/toolbarmenuacc.cxx1003
-rw-r--r--svtools/source/control/toolbarmenuimp.hxx314
-rw-r--r--svtools/source/control/valueacc.cxx7
-rwxr-xr-x[-rw-r--r--]svtools/source/control/valueimp.hxx1
-rw-r--r--svtools/source/control/valueset.cxx51
-rw-r--r--svtools/source/dialogs/addresstemplate.cxx2
-rw-r--r--svtools/source/dialogs/addresstemplate.src2
-rw-r--r--svtools/source/dialogs/logindlg.cxx2
-rw-r--r--svtools/source/dialogs/logindlg.src2
-rw-r--r--svtools/source/dialogs/printdlg.hrc2
-rw-r--r--svtools/source/dialogs/prnsetup.hrc2
-rw-r--r--svtools/source/dialogs/roadmapwizard.cxx57
-rw-r--r--svtools/source/dialogs/wizardmachine.cxx99
-rw-r--r--svtools/source/dialogs/wizardmachine.src2
-rw-r--r--svtools/source/filter.vcl/filter/dlgejpg.hrc2
-rw-r--r--svtools/source/filter.vcl/filter/dlgepng.hrc2
-rw-r--r--svtools/source/filter.vcl/filter/dlgexpor.hrc2
-rw-r--r--svtools/source/filter.vcl/filter/filter.cxx8
-rw-r--r--svtools/source/filter.vcl/filter/strings.hrc2
-rw-r--r--svtools/source/filter.vcl/jpeg/jpeg.cxx15
-rw-r--r--svtools/source/inc/iodlg.hrc2
-rw-r--r--svtools/source/inc/jpeg.hxx11
-rw-r--r--svtools/source/inc/svimpbox.hxx2
-rw-r--r--svtools/source/java/javaerror.src2
-rw-r--r--svtools/source/java/javainteractionhandler.cxx2
-rw-r--r--svtools/source/java/patchjavaerror.src2
-rw-r--r--svtools/source/misc/ehdl.cxx2
-rw-r--r--svtools/source/misc/ehdl.src2
-rw-r--r--svtools/source/misc/embedhlp.cxx2
-rw-r--r--svtools/source/misc/errtxt.src2
-rw-r--r--svtools/source/misc/helpagent.src2
-rw-r--r--svtools/source/misc/helpagentwindow.cxx2
-rw-r--r--svtools/source/misc/imagemgr.cxx2
-rw-r--r--svtools/source/misc/imagemgr.src2
-rw-r--r--svtools/source/misc/imageresourceaccess.cxx12
-rw-r--r--[-rwxr-xr-x]svtools/source/misc/langtab.cxx2
-rw-r--r--svtools/source/misc/langtab.src4
-rwxr-xr-x[-rw-r--r--]svtools/source/misc/svtaccessiblefactory.cxx18
-rw-r--r--svtools/source/productregistration/productregistration.cxx2
-rw-r--r--svtools/source/productregistration/registrationdlg.cxx2
-rw-r--r--svtools/source/productregistration/registrationdlg.src2
-rw-r--r--svtools/source/table/tablecontrol.cxx45
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx6
-rw-r--r--svtools/source/table/tablecontrol_impl.hxx1
-rw-r--r--svtools/source/table/tabledatawindow.cxx5
-rw-r--r--svtools/source/toolpanel/drawerlayouter.cxx305
-rw-r--r--svtools/source/toolpanel/dummypanel.cxx107
-rw-r--r--svtools/source/toolpanel/dummypanel.hxx70
-rwxr-xr-xsvtools/source/toolpanel/makefile.mk68
-rwxr-xr-xsvtools/source/toolpanel/paneldecklisteners.cxx137
-rwxr-xr-xsvtools/source/toolpanel/paneldecklisteners.hxx72
-rwxr-xr-xsvtools/source/toolpanel/paneltabbar.cxx1356
-rw-r--r--svtools/source/toolpanel/paneltabbarpeer.cxx101
-rw-r--r--svtools/source/toolpanel/paneltabbarpeer.hxx69
-rw-r--r--svtools/source/toolpanel/refbase.cxx56
-rw-r--r--svtools/source/toolpanel/tabbargeometry.cxx328
-rw-r--r--svtools/source/toolpanel/tabbargeometry.hxx137
-rw-r--r--svtools/source/toolpanel/tabitemdescriptor.hxx90
-rwxr-xr-xsvtools/source/toolpanel/tablayouter.cxx262
-rw-r--r--svtools/source/toolpanel/toolpanel.cxx54
-rw-r--r--svtools/source/toolpanel/toolpanel.src57
-rw-r--r--svtools/source/toolpanel/toolpanelcollection.cxx193
-rw-r--r--svtools/source/toolpanel/toolpanelcollection.hxx69
-rwxr-xr-xsvtools/source/toolpanel/toolpaneldeck.cxx560
-rwxr-xr-xsvtools/source/toolpanel/toolpaneldeckpeer.cxx99
-rwxr-xr-xsvtools/source/toolpanel/toolpaneldeckpeer.hxx69
-rw-r--r--svtools/source/toolpanel/toolpaneldrawer.cxx373
-rw-r--r--svtools/source/toolpanel/toolpaneldrawer.hxx113
-rw-r--r--svtools/source/toolpanel/toolpaneldrawerpeer.cxx142
-rw-r--r--svtools/source/toolpanel/toolpaneldrawerpeer.hxx56
-rw-r--r--svtools/source/uno/makefile.mk7
-rw-r--r--svtools/source/uno/miscservices.cxx23
-rw-r--r--svtools/source/uno/popupmenucontrollerbase.cxx420
-rw-r--r--svtools/source/uno/popupwindowcontroller.cxx258
-rwxr-xr-xsvtools/source/uno/svtxgridcontrol.cxx23
-rwxr-xr-xsvtools/source/uno/svtxgridcontrol.hxx2
-rw-r--r--svtools/source/uno/toolboxcontroller.cxx213
-rw-r--r--svtools/source/uno/treecontrolpeer.cxx20
-rw-r--r--svtools/source/uno/treecontrolpeer.hxx1
-rw-r--r--svtools/source/uno/unowizard.hxx117
-rw-r--r--svtools/source/uno/wizard/makefile.mk48
-rw-r--r--svtools/source/uno/wizard/unowizard.cxx452
-rw-r--r--svtools/source/uno/wizard/wizardpagecontroller.cxx190
-rw-r--r--svtools/source/uno/wizard/wizardpagecontroller.hxx75
-rw-r--r--svtools/source/uno/wizard/wizardshell.cxx279
-rw-r--r--svtools/source/uno/wizard/wizardshell.hxx147
-rw-r--r--svtools/util/makefile.mk48
-rw-r--r--svtools/workben/toolpanel/makefile.mk110
-rwxr-xr-xsvtools/workben/toolpanel/toolpaneltest.cxx880
-rw-r--r--svtools/workben/unodialog/roadmapskeleton.cxx4
-rw-r--r--svtools/workben/unodialog/roadmapskeleton.hxx2
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindow.hxx18
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx39
-rw-r--r--toolkit/inc/toolkit/controls/dialogcontrol.hxx8
-rw-r--r--toolkit/inc/toolkit/controls/roadmapcontrol.hxx6
-rw-r--r--toolkit/inc/toolkit/controls/unocontrol.hxx14
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolmodel.hxx1
-rw-r--r--toolkit/inc/toolkit/controls/unocontrols.hxx125
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx4
-rw-r--r--toolkit/inc/toolkit/helper/servicenames.hxx6
-rw-r--r--toolkit/source/awt/vclxmenu.cxx44
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx10
-rw-r--r--toolkit/source/awt/vclxwindow.cxx319
-rw-r--r--toolkit/source/awt/vclxwindows.cxx193
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx40
-rw-r--r--toolkit/source/controls/tksimpleanimation.cxx5
-rw-r--r--toolkit/source/controls/tkthrobber.cxx19
-rw-r--r--toolkit/source/controls/tree/treecontrol.cxx8
-rw-r--r--toolkit/source/controls/tree/treecontrol.hxx1
-rw-r--r--toolkit/source/controls/unocontrol.cxx52
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx23
-rw-r--r--toolkit/source/controls/unocontrols.cxx610
-rw-r--r--toolkit/source/helper/property.cxx4
-rw-r--r--toolkit/source/helper/registerservices.cxx16
-rw-r--r--toolkit/source/helper/servicenames.cxx8
-rw-r--r--tools/inc/tools/diagnose_ex.h29
-rw-r--r--tools/inc/tools/gen.hxx15
-rw-r--r--tools/inc/tools/preextstl.h15
-rw-r--r--tools/inc/tools/solar.h24
-rw-r--r--tools/inc/tools/svborder.hxx8
-rw-r--r--tools/source/stream/strmunx.cxx4
-rwxr-xr-xtransex3/java/jpropex/build.xml169
-rw-r--r--transex3/java/jpropex/java/JPropEx.java400
-rw-r--r--transex3/java/jpropex/java/Main.java38
-rw-r--r--transex3/java/jpropex/java/NoLocalizeFilter.java55
-rw-r--r--transex3/java/jpropex/java/OrderedHashMap.java96
-rw-r--r--transex3/java/jpropex/java/SdfData.java108
-rw-r--r--transex3/java/jpropex/java/SdfEntity.java254
-rwxr-xr-xtransex3/java/jpropex/jpropex10
-rwxr-xr-xtransex3/java/jpropex/jpropex.MF1
-rwxr-xr-xtransex3/java/jpropex/makefile.mk36
-rw-r--r--ucbhelper/inc/ucbhelper/propertyvalueset.hxx370
-rw-r--r--ucbhelper/prj/build.lst13
-rw-r--r--ucbhelper/source/provider/propertyvalueset.cxx89
-rw-r--r--ucbhelper/workben/myucp/makefile.mk1
-rw-r--r--unotools/inc/unotools/configmgr.hxx3
-rw-r--r--unotools/inc/unotools/confignode.hxx67
-rwxr-xr-x[-rw-r--r--]unotools/inc/unotools/lingucfg.hxx4
-rw-r--r--unotools/source/config/configmgr.cxx15
-rw-r--r--unotools/source/config/confignode.cxx262
-rw-r--r--unotools/source/config/configvaluecontainer.cxx2
-rwxr-xr-x[-rw-r--r--]unotools/source/config/lingucfg.cxx71
-rw-r--r--unotools/source/i18n/transliterationwrapper.cxx40
-rw-r--r--vcl/aqua/inc/salgdi.h8
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx20
-rw-r--r--vcl/aqua/source/gdi/salnativewidgets.cxx10
-rw-r--r--vcl/aqua/source/window/salframe.cxx95
-rw-r--r--vcl/inc/vcl/dockwin.hxx5
-rw-r--r--vcl/inc/vcl/graphite_cache.hxx19
-rw-r--r--vcl/inc/vcl/graphite_layout.hxx9
-rw-r--r--vcl/inc/vcl/help.hxx1
-rw-r--r--vcl/inc/vcl/impfont.hxx4
-rw-r--r--vcl/inc/vcl/lstbox.hxx1
-rw-r--r--vcl/inc/vcl/outdev.hxx44
-rw-r--r--vcl/inc/vcl/salgdi.hxx12
-rw-r--r--vcl/inc/vcl/syswin.hxx2
-rw-r--r--vcl/inc/vcl/vclevent.hxx4
-rw-r--r--vcl/inc/vcl/window.h2
-rw-r--r--vcl/inc/vcl/window.hxx50
-rw-r--r--vcl/os2/inc/salgdi.h8
-rw-r--r--vcl/source/app/help.cxx30
-rw-r--r--vcl/source/control/ilstbox.cxx7
-rw-r--r--vcl/source/control/lstbox.cxx11
-rw-r--r--vcl/source/control/tabctrl.cxx5
-rw-r--r--vcl/source/fontsubset/cff.cxx31
-rw-r--r--vcl/source/gdi/image.cxx22
-rwxr-xr-x[-rw-r--r--]vcl/source/gdi/makefile.mk1
-rw-r--r--vcl/source/gdi/metric.cxx7
-rw-r--r--vcl/source/gdi/outdev.cxx10
-rw-r--r--vcl/source/gdi/outdev3.cxx1
-rw-r--r--vcl/source/gdi/outdevnative.cxx290
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx2
-rw-r--r--vcl/source/gdi/pngread.cxx2
-rw-r--r--vcl/source/gdi/salgdilayout.cxx24
-rwxr-xr-xvcl/source/gdi/sallayout.cxx13
-rw-r--r--vcl/source/gdi/salnativewidgets-none.cxx7
-rw-r--r--vcl/source/glyphs/graphite_layout.cxx227
-rw-r--r--vcl/source/window/dockmgr.cxx88
-rw-r--r--vcl/source/window/menu.cxx4
-rw-r--r--vcl/source/window/seleng.cxx6
-rw-r--r--vcl/source/window/syswin.cxx61
-rw-r--r--vcl/source/window/window.cxx51
-rw-r--r--vcl/source/window/window3.cxx259
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx3
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx143
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx33
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkframe.hxx1
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkgdi.hxx42
-rw-r--r--vcl/unx/inc/saldisp.hxx1
-rw-r--r--vcl/unx/inc/salgdi.h13
-rw-r--r--vcl/unx/kde/kdedata.cxx3
-rw-r--r--vcl/unx/kde/salnativewidgets-kde.cxx25
-rw-r--r--vcl/unx/kde4/KDESalGraphics.cxx8
-rw-r--r--vcl/unx/kde4/KDESalGraphics.hxx15
-rw-r--r--vcl/unx/kde4/KDEXLib.cxx5
-rw-r--r--vcl/unx/source/app/saldata.cxx6
-rw-r--r--vcl/unx/source/fontmanager/fontconfig.cxx28
-rw-r--r--vcl/unx/source/fontmanager/fontmanager.cxx30
-rw-r--r--vcl/unx/source/gdi/salgdi.cxx787
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx2
-rw-r--r--vcl/util/makefile.mk1
-rw-r--r--vcl/win/inc/salgdi.h8
-rw-r--r--vcl/win/source/gdi/salgdi3.cxx17
-rw-r--r--vcl/win/source/gdi/salnativewidgets-luna.cxx46
-rw-r--r--[-rwxr-xr-x]vcl/win/source/window/salframe.cxx4
344 files changed, 19766 insertions, 3151 deletions
diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
index 11955ceb22f9..e03aadfe1577 100644
--- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
+++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
@@ -364,7 +364,8 @@ namespace basegfx
if(fTools::moreOrEqual(fCutB, fZero) && fTools::less(fCutB, fOne))
{
// cut is in both ranges. Add points for A and B
- if(fTools::equalZero(fCutA))
+ // #i111715# use fTools::equal instead of fTools::equalZero for better accuracy
+ if(fTools::equal(fCutA, fZero))
{
// ignore for start point in first edge; this is handled
// by outer methods and would just produce a double point
@@ -379,7 +380,8 @@ namespace basegfx
rTempPointsA.push_back(temporaryPoint(aCutPoint, a, fCutA));
}
- if(fTools::equalZero(fCutB))
+ // #i111715# use fTools::equal instead of fTools::equalZero for better accuracy
+ if(fTools::equal(fCutB, fZero))
{
// ignore for start point in first edge; this is handled
// by outer methods and would just produce a double point
diff --git a/comphelper/inc/comphelper/propertycontainerhelper.hxx b/comphelper/inc/comphelper/propertycontainerhelper.hxx
index 247e1a678e02..82848203699c 100644
--- a/comphelper/inc/comphelper/propertycontainerhelper.hxx
+++ b/comphelper/inc/comphelper/propertycontainerhelper.hxx
@@ -42,7 +42,7 @@ namespace comphelper
//.........................................................................
// infos about one single property
-struct COMPHELPER_DLLPRIVATE PropertyDescription
+struct COMPHELPER_DLLPUBLIC PropertyDescription
{
// the possibilities where a property holding object may be located
enum LocationType
diff --git a/comphelper/inc/comphelper/stillreadwriteinteraction.hxx b/comphelper/inc/comphelper/stillreadwriteinteraction.hxx
new file mode 100644
index 000000000000..1ade47220c6f
--- /dev/null
+++ b/comphelper/inc/comphelper/stillreadwriteinteraction.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef _COMPHELPER_STILLREADWRITEINTERACTION_HXX_
+#define _COMPHELPER_STRILLREADWRITEINTERACTION_HXX_
+
+//_______________________________________________
+// includes
+#include <ucbhelper/interceptedinteraction.hxx>
+
+#ifndef __COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP__
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#endif
+
+#include <ucbhelper/interceptedinteraction.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//_______________________________________________
+// namespace
+
+namespace comphelper{
+class COMPHELPER_DLLPUBLIC StillReadWriteInteraction : public ::ucbhelper::InterceptedInteraction
+{
+private:
+ static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0;
+ static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1;
+
+ sal_Bool m_bUsed;
+ sal_Bool m_bHandledByMySelf;
+ sal_Bool m_bHandledByInternalHandler;
+
+public:
+ StillReadWriteInteraction(const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler);
+
+ void resetInterceptions();
+ void resetErrorStates();
+ sal_Bool wasWriteError();
+
+private:
+ virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest);
+
+};
+}
+#endif
diff --git a/comphelper/source/misc/makefile.mk b/comphelper/source/misc/makefile.mk
index a49c2eb59c84..cecba554b332 100644
--- a/comphelper/source/misc/makefile.mk
+++ b/comphelper/source/misc/makefile.mk
@@ -93,6 +93,7 @@ SLOFILES= \
$(SLO)$/comphelper_module.obj \
$(SLO)$/comphelper_services.obj \
$(SLO)$/componentbase.obj \
+ $(SLO)$/stillreadwriteinteraction.obj \
# --- Targets ----------------------------------
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index 1710a43027cf..1bc40a454d43 100644
--- a/comphelper/source/misc/mediadescriptor.cxx
+++ b/comphelper/source/misc/mediadescriptor.cxx
@@ -28,6 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_comphelper.hxx"
#include <comphelper/mediadescriptor.hxx>
+#include <comphelper/stillreadwriteinteraction.hxx>
//_______________________________________________
// includes
@@ -59,22 +60,10 @@
#include <com/sun/star/util/XURLTransformer.hpp>
#endif
-#ifndef __COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP__
-#include <com/sun/star/ucb/InteractiveIOException.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP__
-#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
-#endif
-
#ifndef __COM_SUN_STAR_UCB_COMMANDFAILEDEXCEPTION_HPP__
#include <com/sun/star/ucb/CommandFailedException.hpp>
#endif
-#ifndef __COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP__
-#include <com/sun/star/task/XInteractionAbort.hpp>
-#endif
-
#ifndef __COM_SUN_STAR_URI_XURIREFERENCEFACTORY_HPP__
#include <com/sun/star/uri/XUriReferenceFactory.hpp>
#endif
@@ -673,114 +662,6 @@ sal_Bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference
}
/*-----------------------------------------------*/
-class StillReadWriteInteraction : public ::ucbhelper::InterceptedInteraction
-{
- private:
- static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0;
- static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1;
-
- sal_Bool m_bUsed;
- sal_Bool m_bHandledByMySelf;
- sal_Bool m_bHandledByInternalHandler;
-
- public:
- StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler)
- : m_bUsed (sal_False)
- , m_bHandledByMySelf (sal_False)
- , m_bHandledByInternalHandler(sal_False)
- {
- ::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions;
- ::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest;
-
- aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION;
- aInterceptedRequest.Request <<= css::ucb::InteractiveIOException();
- aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0));
- aInterceptedRequest.MatchExact = sal_False;
- lInterceptions.push_back(aInterceptedRequest);
-
- aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION;
- aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException();
- aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0));
- aInterceptedRequest.MatchExact = sal_False;
- lInterceptions.push_back(aInterceptedRequest);
-
- setInterceptedHandler(xHandler);
- setInterceptions(lInterceptions);
- }
-
- void resetInterceptions()
- {
- setInterceptions(::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest >());
- }
-
- void resetErrorStates()
- {
- m_bUsed = sal_False;
- m_bHandledByMySelf = sal_False;
- m_bHandledByInternalHandler = sal_False;
- }
-
- sal_Bool wasWriteError()
- {
- return (m_bUsed && m_bHandledByMySelf);
- }
-
- private:
- virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest)
- {
- // we are used!
- m_bUsed = sal_True;
-
- // check if its a real interception - might some parameters are not the right ones ...
- sal_Bool bAbort = sal_False;
- switch(aRequest.Handle)
- {
- case HANDLE_INTERACTIVEIOEXCEPTION:
- {
- css::ucb::InteractiveIOException exIO;
- xRequest->getRequest() >>= exIO;
- bAbort = (
- (exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED )
- || (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION )
-#ifdef MACOSX
- // this is a workaround for MAC, on this platform if the file is locked
- // the returned error code looks to be wrong
- || (exIO.Code == css::ucb::IOErrorCode_GENERAL )
-#endif
- );
- }
- break;
-
- case HANDLE_UNSUPPORTEDDATASINKEXCEPTION:
- {
- bAbort = sal_True;
- }
- break;
- }
-
- // handle interaction by ourself
- if (bAbort)
- {
- m_bHandledByMySelf = sal_True;
- css::uno::Reference< css::task::XInteractionContinuation > xAbort = ::ucbhelper::InterceptedInteraction::extractContinuation(
- xRequest->getContinuations(),
- ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0)));
- if (!xAbort.is())
- return ::ucbhelper::InterceptedInteraction::E_NO_CONTINUATION_FOUND;
- xAbort->select();
- return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED;
- }
-
- // Otherwhise use internal handler.
- if (m_xInterceptedHandler.is())
- {
- m_bHandledByInternalHandler = sal_True;
- m_xInterceptedHandler->handle(xRequest);
- }
- return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED;
- }
-};
/*-----------------------------------------------
25.03.2004 12:29
diff --git a/comphelper/source/misc/stillreadwriteinteraction.cxx b/comphelper/source/misc/stillreadwriteinteraction.cxx
new file mode 100644
index 000000000000..9054f0754b5e
--- /dev/null
+++ b/comphelper/source/misc/stillreadwriteinteraction.cxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_comphelper.hxx"
+#include <comphelper/stillreadwriteinteraction.hxx>
+
+#ifndef __COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP__
+#include <com/sun/star/ucb/InteractiveIOException.hpp>
+#endif
+
+#ifndef __COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP__
+#include <com/sun/star/task/XInteractionAbort.hpp>
+#endif
+
+#ifndef __COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP__
+#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
+#endif
+
+namespace comphelper{
+
+ namespace css = ::com::sun::star;
+
+StillReadWriteInteraction::StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler)
+ : m_bUsed (sal_False)
+ , m_bHandledByMySelf (sal_False)
+ , m_bHandledByInternalHandler(sal_False)
+{
+ ::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions;
+ ::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest;
+
+ aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION;
+ aInterceptedRequest.Request <<= css::ucb::InteractiveIOException();
+ aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0));
+ aInterceptedRequest.MatchExact = sal_False;
+ lInterceptions.push_back(aInterceptedRequest);
+
+ aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION;
+ aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException();
+ aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0));
+ aInterceptedRequest.MatchExact = sal_False;
+ lInterceptions.push_back(aInterceptedRequest);
+
+ setInterceptedHandler(xHandler);
+ setInterceptions(lInterceptions);
+}
+
+void StillReadWriteInteraction::resetInterceptions()
+{
+ setInterceptions(::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest >());
+}
+
+void StillReadWriteInteraction::resetErrorStates()
+{
+ m_bUsed = sal_False;
+ m_bHandledByMySelf = sal_False;
+ m_bHandledByInternalHandler = sal_False;
+}
+
+sal_Bool StillReadWriteInteraction::wasWriteError()
+{
+ return (m_bUsed && m_bHandledByMySelf);
+}
+
+ucbhelper::InterceptedInteraction::EInterceptionState StillReadWriteInteraction::intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest)
+{
+ // we are used!
+ m_bUsed = sal_True;
+
+ // check if its a real interception - might some parameters are not the right ones ...
+ sal_Bool bAbort = sal_False;
+ switch(aRequest.Handle)
+ {
+ case HANDLE_INTERACTIVEIOEXCEPTION:
+ {
+ css::ucb::InteractiveIOException exIO;
+ xRequest->getRequest() >>= exIO;
+ bAbort = (
+ (exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED )
+ || (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION )
+ || (exIO.Code == css::ucb::IOErrorCode_NOT_EXISTING )
+#ifdef MACOSX
+ // this is a workaround for MAC, on this platform if the file is locked
+ // the returned error code looks to be wrong
+ || (exIO.Code == css::ucb::IOErrorCode_GENERAL )
+#endif
+ );
+ }
+ break;
+
+ case HANDLE_UNSUPPORTEDDATASINKEXCEPTION:
+ {
+ bAbort = sal_True;
+ }
+ break;
+ }
+
+ // handle interaction by ourself
+ if (bAbort)
+ {
+ m_bHandledByMySelf = sal_True;
+ css::uno::Reference< css::task::XInteractionContinuation > xAbort = ::ucbhelper::InterceptedInteraction::extractContinuation(
+ xRequest->getContinuations(),
+ ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0)));
+ if (!xAbort.is())
+ return ::ucbhelper::InterceptedInteraction::E_NO_CONTINUATION_FOUND;
+ xAbort->select();
+ return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED;
+ }
+
+ // Otherwhise use internal handler.
+ if (m_xInterceptedHandler.is())
+ {
+ m_bHandledByInternalHandler = sal_True;
+ m_xInterceptedHandler->handle(xRequest);
+ }
+ return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED;
+}
+}
diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx
index a03b61a90194..3d474a0a53dc 100644
--- a/i18npool/inc/transliteration_body.hxx
+++ b/i18npool/inc/transliteration_body.hxx
@@ -90,6 +90,31 @@ public:
};
#endif
+
+#if defined( TRANSLITERATION_ALL )
+class Transliteration_togglecase : public Transliteration_body
+{
+public:
+ Transliteration_togglecase();
+};
+
+class Transliteration_titlecase : public Transliteration_body
+{
+public:
+ Transliteration_titlecase();
+
+ virtual rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException);
+};
+
+class Transliteration_sentencecase : public Transliteration_body
+{
+public:
+ Transliteration_sentencecase();
+
+ virtual rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException);
+};
+#endif
+
} } } }
#endif
diff --git a/i18npool/source/breakiterator/data/ja.dic b/i18npool/source/breakiterator/data/ja.dic
index ed76e4b4a271..d2923833e57d 100644
--- a/i18npool/source/breakiterator/data/ja.dic
+++ b/i18npool/source/breakiterator/data/ja.dic
@@ -21386,6 +21386,7 @@
シャッター
シャット
シャットアウト
+シャットダウン
シャッãƒ
シャツ
シャトル
diff --git a/i18npool/source/localedata/data/ak_GH.xml b/i18npool/source/localedata/data/ak_GH.xml
index 95ac2069db31..afdbf1c2b227 100644
--- a/i18npool/source/localedata/data/ak_GH.xml
+++ b/i18npool/source/localedata/data/ak_GH.xml
@@ -337,8 +337,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/bs_BA.xml b/i18npool/source/localedata/data/bs_BA.xml
index 1a6eeb82ff44..0dea5e435ec5 100644
--- a/i18npool/source/localedata/data/bs_BA.xml
+++ b/i18npool/source/localedata/data/bs_BA.xml
@@ -366,9 +366,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
-<Transliteration unoid="LOWERCASE_UPPERCASE"/>
-<Transliteration unoid="UPPERCASE_LOWERCASE"/>
-<Transliteration unoid="IGNORE_CASE"/>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/ee_GH.xml b/i18npool/source/localedata/data/ee_GH.xml
index eb19dec770da..2d4807774a8b 100644
--- a/i18npool/source/localedata/data/ee_GH.xml
+++ b/i18npool/source/localedata/data/ee_GH.xml
@@ -331,8 +331,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/en_GH.xml b/i18npool/source/localedata/data/en_GH.xml
index 660cd759944b..37437468a651 100644
--- a/i18npool/source/localedata/data/en_GH.xml
+++ b/i18npool/source/localedata/data/en_GH.xml
@@ -329,11 +329,7 @@
<DecimalPlaces>2</DecimalPlaces>
</Currency>
</LC_CURRENCY>
- <LC_TRANSLITERATION>
- <Transliteration unoid="LOWERCASE_UPPERCASE" />
- <Transliteration unoid="UPPERCASE_LOWERCASE" />
- <Transliteration unoid="IGNORE_CASE" />
- </LC_TRANSLITERATION>
+<LC_TRANSLITERATION ref="en_US"/>
<LC_MISC>
<ReservedWords>
<trueWord>True</trueWord>
diff --git a/i18npool/source/localedata/data/en_US.xml b/i18npool/source/localedata/data/en_US.xml
index 2a99dcd0fb14..7029b7cc5b30 100644
--- a/i18npool/source/localedata/data/en_US.xml
+++ b/i18npool/source/localedata/data/en_US.xml
@@ -475,8 +475,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/eo.xml b/i18npool/source/localedata/data/eo.xml
index 62098fdf75ef..33a42a8fd675 100644
--- a/i18npool/source/localedata/data/eo.xml
+++ b/i18npool/source/localedata/data/eo.xml
@@ -321,8 +321,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/eu.xml b/i18npool/source/localedata/data/eu.xml
index 5f0119b1285d..64184d0125f0 100644
--- a/i18npool/source/localedata/data/eu.xml
+++ b/i18npool/source/localedata/data/eu.xml
@@ -328,9 +328,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
- <Transliteration unoid="LOWERCASE_UPPERCASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/fur_IT.xml b/i18npool/source/localedata/data/fur_IT.xml
index cfec124d68b6..5aee7cbfdf15 100644
--- a/i18npool/source/localedata/data/fur_IT.xml
+++ b/i18npool/source/localedata/data/fur_IT.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/fy_NL.xml b/i18npool/source/localedata/data/fy_NL.xml
index 651d13417842..a4a7cc48f2da 100644
--- a/i18npool/source/localedata/data/fy_NL.xml
+++ b/i18npool/source/localedata/data/fy_NL.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/gsc_FR.xml b/i18npool/source/localedata/data/gsc_FR.xml
index 0a13281f9d7b..01242e586e7a 100644
--- a/i18npool/source/localedata/data/gsc_FR.xml
+++ b/i18npool/source/localedata/data/gsc_FR.xml
@@ -323,9 +323,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
-<Transliteration unoid="LOWERCASE_UPPERCASE"/>
-<Transliteration unoid="UPPERCASE_LOWERCASE"/>
-<Transliteration unoid="IGNORE_CASE"/>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
@@ -355,4 +358,4 @@
</LC_NumberingLevel>
<LC_OutLineNumberingLevel ref="en_US"/>
</Locale>
-<!--Version 1.0 --> \ No newline at end of file
+<!--Version 1.0 -->
diff --git a/i18npool/source/localedata/data/gug_PY.xml b/i18npool/source/localedata/data/gug_PY.xml
index c21104c3d13e..60230ae64dac 100644
--- a/i18npool/source/localedata/data/gug_PY.xml
+++ b/i18npool/source/localedata/data/gug_PY.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/ha_GH.xml b/i18npool/source/localedata/data/ha_GH.xml
index 1794447c0e4d..6d56b80cc580 100644
--- a/i18npool/source/localedata/data/ha_GH.xml
+++ b/i18npool/source/localedata/data/ha_GH.xml
@@ -334,8 +334,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/hil_PH.xml b/i18npool/source/localedata/data/hil_PH.xml
index 6396ff261c90..1bd10219d366 100644
--- a/i18npool/source/localedata/data/hil_PH.xml
+++ b/i18npool/source/localedata/data/hil_PH.xml
@@ -324,8 +324,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/hr_HR.xml b/i18npool/source/localedata/data/hr_HR.xml
index 4c3786539b38..484efdcb9ba0 100644
--- a/i18npool/source/localedata/data/hr_HR.xml
+++ b/i18npool/source/localedata/data/hr_HR.xml
@@ -318,9 +318,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
-<Transliteration unoid="LOWERCASE_UPPERCASE"/>
-<Transliteration unoid="UPPERCASE_LOWERCASE"/>
-<Transliteration unoid="IGNORE_CASE"/>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/hy_AM.xml b/i18npool/source/localedata/data/hy_AM.xml
index 92913732a090..47c2e35d6e7b 100644
--- a/i18npool/source/localedata/data/hy_AM.xml
+++ b/i18npool/source/localedata/data/hy_AM.xml
@@ -320,8 +320,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/is_IS.xml b/i18npool/source/localedata/data/is_IS.xml
index 7e77c1d2cdad..3b16c6e4bca5 100644
--- a/i18npool/source/localedata/data/is_IS.xml
+++ b/i18npool/source/localedata/data/is_IS.xml
@@ -314,9 +314,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
- <Transliteration unoid="LOWERCASE_UPPERCASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/ka_GE.xml b/i18npool/source/localedata/data/ka_GE.xml
index d0a9a20369e1..ada35b465543 100644
--- a/i18npool/source/localedata/data/ka_GE.xml
+++ b/i18npool/source/localedata/data/ka_GE.xml
@@ -320,8 +320,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/kk_KZ.xml b/i18npool/source/localedata/data/kk_KZ.xml
index e5c8cc95d2fe..a9147655cdec 100644
--- a/i18npool/source/localedata/data/kk_KZ.xml
+++ b/i18npool/source/localedata/data/kk_KZ.xml
@@ -322,8 +322,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/km_KH.xml b/i18npool/source/localedata/data/km_KH.xml
index dff43def273b..bddd0e91791e 100644
--- a/i18npool/source/localedata/data/km_KH.xml
+++ b/i18npool/source/localedata/data/km_KH.xml
@@ -346,8 +346,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/ko_KR.xml b/i18npool/source/localedata/data/ko_KR.xml
index bbd5b0ded2be..3a3fbb0fb9a9 100644
--- a/i18npool/source/localedata/data/ko_KR.xml
+++ b/i18npool/source/localedata/data/ko_KR.xml
@@ -564,8 +564,11 @@
<Transliteration unoid="IGNORE_WIDTH"/>
<Transliteration unoid="FULLWIDTH_HALFWIDTH"/>
<Transliteration unoid="HALFWIDTH_FULLWIDTH"/>
- <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="NumToTextFormalHangul_ko"/>
<Transliteration unoid="NumToTextFormalLower_ko"/>
<Transliteration unoid="NumToTextFormalUpper_ko"/>
diff --git a/i18npool/source/localedata/data/ku_TR.xml b/i18npool/source/localedata/data/ku_TR.xml
index 4af9e2cd28d2..0413353b8486 100644
--- a/i18npool/source/localedata/data/ku_TR.xml
+++ b/i18npool/source/localedata/data/ku_TR.xml
@@ -330,8 +330,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/lg_UG.xml b/i18npool/source/localedata/data/lg_UG.xml
index c6b3b740b10d..5fc78c71cec2 100644
--- a/i18npool/source/localedata/data/lg_UG.xml
+++ b/i18npool/source/localedata/data/lg_UG.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
- <Transliteration unoid="LOWERCASE_UPPERCASE" />
- <Transliteration unoid="UPPERCASE_LOWERCASE" />
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE" />
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/ln_CD.xml b/i18npool/source/localedata/data/ln_CD.xml
index 602b19fb8fd8..daf7376c9df5 100644
--- a/i18npool/source/localedata/data/ln_CD.xml
+++ b/i18npool/source/localedata/data/ln_CD.xml
@@ -327,8 +327,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/lt_LT.xml b/i18npool/source/localedata/data/lt_LT.xml
index c23f542d6b5d..cd4cb0aca929 100644
--- a/i18npool/source/localedata/data/lt_LT.xml
+++ b/i18npool/source/localedata/data/lt_LT.xml
@@ -346,9 +346,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
- <Transliteration unoid="LOWERCASE_UPPERCASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/lv_LV.xml b/i18npool/source/localedata/data/lv_LV.xml
index 27bb0f13e409..ab76b4930bc6 100644
--- a/i18npool/source/localedata/data/lv_LV.xml
+++ b/i18npool/source/localedata/data/lv_LV.xml
@@ -325,6 +325,8 @@
</LC_CURRENCY>
<LC_TRANSLITERATION>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE" />
</LC_TRANSLITERATION>
diff --git a/i18npool/source/localedata/data/mk_MK.xml b/i18npool/source/localedata/data/mk_MK.xml
index b9862478513e..10e488e3cac1 100644
--- a/i18npool/source/localedata/data/mk_MK.xml
+++ b/i18npool/source/localedata/data/mk_MK.xml
@@ -322,8 +322,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/mt_MT.xml b/i18npool/source/localedata/data/mt_MT.xml
index 790bd97303e0..bcc5869932b4 100644
--- a/i18npool/source/localedata/data/mt_MT.xml
+++ b/i18npool/source/localedata/data/mt_MT.xml
@@ -324,8 +324,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/my_MM.xml b/i18npool/source/localedata/data/my_MM.xml
index dada8a5402d9..6c12c8986c8f 100644
--- a/i18npool/source/localedata/data/my_MM.xml
+++ b/i18npool/source/localedata/data/my_MM.xml
@@ -395,8 +395,11 @@
</LC_CURRENCY>
<LC_TRANSLITERATION>
<!-- There is often English mixed with Myanmar, so leave these in for now -->
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/ne_NP.xml b/i18npool/source/localedata/data/ne_NP.xml
index cca8be996a70..558027ac0e1c 100644
--- a/i18npool/source/localedata/data/ne_NP.xml
+++ b/i18npool/source/localedata/data/ne_NP.xml
@@ -322,8 +322,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/oc_FR.xml b/i18npool/source/localedata/data/oc_FR.xml
index ef3dd47c0dc6..c64fe872c6e8 100644
--- a/i18npool/source/localedata/data/oc_FR.xml
+++ b/i18npool/source/localedata/data/oc_FR.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/or_IN.xml b/i18npool/source/localedata/data/or_IN.xml
index 168b542f1894..22333451f6ea 100644
--- a/i18npool/source/localedata/data/or_IN.xml
+++ b/i18npool/source/localedata/data/or_IN.xml
@@ -322,8 +322,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/sg_CF.xml b/i18npool/source/localedata/data/sg_CF.xml
index 075b1a43ae18..61ee40b8081e 100644
--- a/i18npool/source/localedata/data/sg_CF.xml
+++ b/i18npool/source/localedata/data/sg_CF.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/sh_RS.xml b/i18npool/source/localedata/data/sh_RS.xml
index 4b744bdd5913..01faa188c9e2 100644
--- a/i18npool/source/localedata/data/sh_RS.xml
+++ b/i18npool/source/localedata/data/sh_RS.xml
@@ -211,8 +211,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/shs_CA.xml b/i18npool/source/localedata/data/shs_CA.xml
index c7e46fa3453d..cfd01f31ac0d 100644
--- a/i18npool/source/localedata/data/shs_CA.xml
+++ b/i18npool/source/localedata/data/shs_CA.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/sk_SK.xml b/i18npool/source/localedata/data/sk_SK.xml
index 7820ef290a46..b233f3981284 100644
--- a/i18npool/source/localedata/data/sk_SK.xml
+++ b/i18npool/source/localedata/data/sk_SK.xml
@@ -369,9 +369,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
- <Transliteration unoid="LOWERCASE_UPPERCASE" />
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/sl_SI.xml b/i18npool/source/localedata/data/sl_SI.xml
index b4de5c4a184b..19139d5e0cc0 100644
--- a/i18npool/source/localedata/data/sl_SI.xml
+++ b/i18npool/source/localedata/data/sl_SI.xml
@@ -331,8 +331,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/so_SO.xml b/i18npool/source/localedata/data/so_SO.xml
index 981cb54aff3e..e332e2b07d52 100644
--- a/i18npool/source/localedata/data/so_SO.xml
+++ b/i18npool/source/localedata/data/so_SO.xml
@@ -330,8 +330,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/sr_RS.xml b/i18npool/source/localedata/data/sr_RS.xml
index 4023c2d4afeb..13133333f37e 100644
--- a/i18npool/source/localedata/data/sr_RS.xml
+++ b/i18npool/source/localedata/data/sr_RS.xml
@@ -350,8 +350,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/sw_TZ.xml b/i18npool/source/localedata/data/sw_TZ.xml
index 22bf61807a54..3a92d8eb3593 100644
--- a/i18npool/source/localedata/data/sw_TZ.xml
+++ b/i18npool/source/localedata/data/sw_TZ.xml
@@ -322,8 +322,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/tk_TM.xml b/i18npool/source/localedata/data/tk_TM.xml
index cfd09c63c4ab..c30d1f782811 100644
--- a/i18npool/source/localedata/data/tk_TM.xml
+++ b/i18npool/source/localedata/data/tk_TM.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/tpi_PG.xml b/i18npool/source/localedata/data/tpi_PG.xml
index 0017a1081233..51cc3500cc57 100644
--- a/i18npool/source/localedata/data/tpi_PG.xml
+++ b/i18npool/source/localedata/data/tpi_PG.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/uk_UA.xml b/i18npool/source/localedata/data/uk_UA.xml
index 981c24f7c94f..1025096c7a6a 100644
--- a/i18npool/source/localedata/data/uk_UA.xml
+++ b/i18npool/source/localedata/data/uk_UA.xml
@@ -369,9 +369,12 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
-<Transliteration unoid="UPPERCASE_LOWERCASE"/>
-<Transliteration unoid="IGNORE_CASE"/>
-<Transliteration unoid="LOWERCASE_UPPERCASE" />
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
+ <Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ReservedWords>
diff --git a/i18npool/source/localedata/data/vi_VN.xml b/i18npool/source/localedata/data/vi_VN.xml
index 4b9bfb266051..93fc1ee3adc4 100644
--- a/i18npool/source/localedata/data/vi_VN.xml
+++ b/i18npool/source/localedata/data/vi_VN.xml
@@ -323,8 +323,11 @@
</Currency>
</LC_CURRENCY>
<LC_TRANSLITERATION>
+ <Transliteration unoid="SENTENCE_CASE"/>
<Transliteration unoid="LOWERCASE_UPPERCASE"/>
<Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
<Transliteration unoid="IGNORE_CASE"/>
</LC_TRANSLITERATION>
<LC_MISC>
diff --git a/i18npool/source/localedata/data/zh_CN.xml b/i18npool/source/localedata/data/zh_CN.xml
index 0fadbf5d9075..c9d1371cb753 100644
--- a/i18npool/source/localedata/data/zh_CN.xml
+++ b/i18npool/source/localedata/data/zh_CN.xml
@@ -415,16 +415,19 @@
<!--more currency should be put here -->
</LC_CURRENCY>
<LC_TRANSLITERATION>
-<Transliteration unoid="UPPERCASE_LOWERCASE"/>
-<Transliteration unoid="LOWERCASE_UPPERCASE"/>
-<Transliteration unoid="HALFWIDTH_FULLWIDTH"/>
-<Transliteration unoid="FULLWIDTH_HALFWIDTH"/>
-<Transliteration unoid="NumToTextLower_zh_CN"/>
-<Transliteration unoid="NumToTextUpper_zh_CN"/>
-<Transliteration unoid="NumToCharLower_zh_CN"/>
-<Transliteration unoid="NumToCharUpper_zh_CN"/>
-<Transliteration unoid="IGNORE_CASE"/>
-<Transliteration unoid="IGNORE_WIDTH"/>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
+ <Transliteration unoid="NumToTextLower_zh_CN"/>
+ <Transliteration unoid="NumToTextUpper_zh_CN"/>
+ <Transliteration unoid="NumToCharLower_zh_CN"/>
+ <Transliteration unoid="NumToCharUpper_zh_CN"/>
+ <Transliteration unoid="HALFWIDTH_FULLWIDTH"/>
+ <Transliteration unoid="FULLWIDTH_HALFWIDTH"/>
+ <Transliteration unoid="IGNORE_CASE"/>
+ <Transliteration unoid="IGNORE_WIDTH"/>
</LC_TRANSLITERATION>
<LC_MISC>
<ForbiddenCharacters>
diff --git a/i18npool/source/localedata/data/zh_TW.xml b/i18npool/source/localedata/data/zh_TW.xml
index 1d1e476b7771..aa53647057f8 100644
--- a/i18npool/source/localedata/data/zh_TW.xml
+++ b/i18npool/source/localedata/data/zh_TW.xml
@@ -343,17 +343,20 @@
<!--more currency should be put here -->
</LC_CURRENCY>
<LC_TRANSLITERATION>
-<Transliteration unoid="NumToTextLower_zh_TW" />
-<Transliteration unoid="NumToTextUpper_zh_TW" />
-<Transliteration unoid="NumToCharLower_zh_TW" />
-<Transliteration unoid="NumToCharUpper_zh_TW" />
-<Transliteration unoid="TextToChuyin_zh_TW" />
-<Transliteration unoid="IGNORE_CASE" />
-<Transliteration unoid="UPPERCASE_LOWERCASE" />
-<Transliteration unoid="LOWERCASE_UPPERCASE" />
-<Transliteration unoid="IGNORE_WIDTH" />
-<Transliteration unoid="HALFWIDTH_FULLWIDTH"/>
-<Transliteration unoid="HALFWIDTH_FULLWIDTH"/>
+ <Transliteration unoid="SENTENCE_CASE"/>
+ <Transliteration unoid="LOWERCASE_UPPERCASE"/>
+ <Transliteration unoid="UPPERCASE_LOWERCASE"/>
+ <Transliteration unoid="TITLE_CASE"/>
+ <Transliteration unoid="TOGGLE_CASE"/>
+ <Transliteration unoid="NumToTextLower_zh_TW" />
+ <Transliteration unoid="NumToTextUpper_zh_TW" />
+ <Transliteration unoid="NumToCharLower_zh_TW" />
+ <Transliteration unoid="NumToCharUpper_zh_TW" />
+ <Transliteration unoid="TextToChuyin_zh_TW" />
+ <Transliteration unoid="HALFWIDTH_FULLWIDTH"/>
+ <Transliteration unoid="FULLWIDTH_HALFWIDTH"/>
+ <Transliteration unoid="IGNORE_CASE" />
+ <Transliteration unoid="IGNORE_WIDTH" />
</LC_TRANSLITERATION>
<LC_MISC>
<ForbiddenCharacters>
diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx
index 2274aa5b714d..280e12dfe4f7 100644
--- a/i18npool/source/registerservices/registerservices.cxx
+++ b/i18npool/source/registerservices/registerservices.cxx
@@ -170,6 +170,9 @@ IMPL_CREATEINSTANCE_MSF( TextConversion_zh )
IMPL_CREATEINSTANCE( Transliteration_u2l )
IMPL_CREATEINSTANCE( Transliteration_l2u )
+IMPL_CREATEINSTANCE( Transliteration_sentencecase )
+IMPL_CREATEINSTANCE( Transliteration_titlecase )
+IMPL_CREATEINSTANCE( Transliteration_togglecase )
IMPL_CREATEINSTANCE( Transliteration_caseignore )
IMPL_CREATEINSTANCE( hiraganaToKatakana )
IMPL_CREATEINSTANCE( katakanaToHiragana )
@@ -421,6 +424,15 @@ static const struct InstancesArray {
TRLT_IMPLNAME_PREFIX "LOWERCASE_UPPERCASE",
&Transliteration_l2u_CreateInstance },
{ TRLT_SERVICELNAME_L10N,
+ TRLT_IMPLNAME_PREFIX "SENTENCE_CASE",
+ &Transliteration_sentencecase_CreateInstance },
+ { TRLT_SERVICELNAME_L10N,
+ TRLT_IMPLNAME_PREFIX "TITLE_CASE",
+ &Transliteration_titlecase_CreateInstance },
+ { TRLT_SERVICELNAME_L10N,
+ TRLT_IMPLNAME_PREFIX "TOGGLE_CASE",
+ &Transliteration_togglecase_CreateInstance },
+ { TRLT_SERVICELNAME_L10N,
TRLT_IMPLNAME_PREFIX "IGNORE_CASE",
&Transliteration_caseignore_CreateInstance },
{ TRLT_SERVICELNAME_L10N,
diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx
index a869f6713b99..b58347826470 100644..100755
--- a/i18npool/source/transliteration/transliteration_body.cxx
+++ b/i18npool/source/transliteration/transliteration_body.cxx
@@ -28,7 +28,17 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_i18npool.hxx"
+#include <rtl/ustrbuf.hxx>
#include <i18nutil/casefolding.hxx>
+#include <i18nutil/unicode.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
+
+
+#include "characterclassificationImpl.hxx"
+#include "breakiteratorImpl.hxx"
+
#define TRANSLITERATION_ALL
#include "transliteration_body.hxx"
@@ -36,8 +46,11 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::rtl;
+#define A2OU(x) OUString::createFromAscii(x)
+
namespace com { namespace sun { namespace star { namespace i18n {
+
Transliteration_body::Transliteration_body()
{
nMappingType = 0;
@@ -68,9 +81,35 @@ Transliteration_body::transliterateRange( const OUString& str1, const OUString&
return ostr;
}
+
+static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Unicode cChar )
+{
+ sal_uInt8 nRes = nMappingType;
+
+ // take care of TOGGLE_CASE transliteration:
+ // nMappingType should not be a combination of flags, thuse we decide now
+ // which one to use.
+ if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower))
+ {
+ const sal_Int16 nType = unicode::getUnicodeType( cChar );
+ if (nType & 0x02 /* lower case*/)
+ nRes = MappingTypeLowerToUpper;
+ else
+ {
+ OSL_ENSURE( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" );
+ nRes = MappingTypeUpperToLower;
+ }
+ }
+
+ return nRes;
+}
+
+
OUString SAL_CALL
-Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
- Sequence< sal_Int32 >& offset) throw(RuntimeException)
+Transliteration_body::transliterate(
+ const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
+ Sequence< sal_Int32 >& offset)
+ throw(RuntimeException)
{
#if 0
/* Performance optimization:
@@ -139,7 +178,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos,
sal_Int32 nOffCount = 0, i;
for (i = 0; i < nCount; i++)
{
- const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType);
+ // take care of TOGGLE_CASE transliteration:
+ sal_uInt8 nTmpMappingType = nMappingType;
+ if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower))
+ nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] );
+
+ const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType );
nOffCount += map.nmap;
}
rtl_uString* pStr = x_rtl_uString_new_WithLength( nOffCount, 1 ); // our x_rtl_ustring.h
@@ -152,7 +196,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos,
sal_Int32 * pArr = offset.getArray();
for (i = 0; i < nCount; i++)
{
- const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType);
+ // take care of TOGGLE_CASE transliteration:
+ sal_uInt8 nTmpMappingType = nMappingType;
+ if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower))
+ nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] );
+
+ const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType );
for (sal_Int32 k = 0; k < map.nmap; k++)
{
pArr[j] = i + startPos;
@@ -184,7 +233,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos,
sal_Int32 j = 0;
for ( sal_Int32 i = 0; i < nCount; i++)
{
- const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType);
+ // take care of TOGGLE_CASE transliteration:
+ sal_uInt8 nTmpMappingType = nMappingType;
+ if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower))
+ nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] );
+
+ const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType );
for (sal_Int32 k = 0; k < map.nmap; k++)
{
out[j++] = map.map[k];
@@ -258,4 +312,203 @@ Transliteration_l2u::Transliteration_l2u()
implementationName = "com.sun.star.i18n.Transliteration.Transliteration_l2u";
}
+Transliteration_togglecase::Transliteration_togglecase()
+{
+ // usually nMappingType must NOT be a combiantion of different flages here,
+ // but we take care of that problem in Transliteration_body::transliterate above
+ // before that value is used. There we will decide which of both is to be used on
+ // a per character basis.
+ nMappingType = MappingTypeLowerToUpper | MappingTypeUpperToLower;
+ transliterationName = "toggle(generic)";
+ implementationName = "com.sun.star.i18n.Transliteration.Transliteration_togglecase";
+}
+
+Transliteration_titlecase::Transliteration_titlecase()
+{
+ nMappingType = MappingTypeToTitle;
+ transliterationName = "title(generic)";
+ implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase";
+}
+
+rtl::OUString SAL_CALL Transliteration_titlecase::transliterate(
+ const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
+ Sequence< sal_Int32 >& /*offset*/ )
+ throw(RuntimeException)
+{
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ CharacterClassificationImpl aCharClassImpl( xMSF );
+
+ // possible problem: the locale is not exactly specific for each word in the text...
+ OUString aRes( aCharClassImpl.toTitle( inStr, startPos, nCount, aLocale ) );
+ return aRes;
+}
+
+Transliteration_sentencecase::Transliteration_sentencecase()
+{
+ nMappingType = MappingTypeToTitle; // though only to be applied to the first word...
+ transliterationName = "sentence(generic)";
+ implementationName = "com.sun.star.i18n.Transliteration.Transliteration_sentencecase";
+}
+
+rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate(
+ const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
+ Sequence< sal_Int32 >& offset )
+ throw(RuntimeException)
+{
+ // inspired from Transliteration_body::transliterate
+ sal_Int32 nOffCount = 0, i;
+ bool bPoint = true;
+ if (useOffset)
+ {
+ for( i = 0; i < nCount; ++i ) {
+ sal_Unicode c = inStr.getStr()[ i + startPos ];
+ if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) {
+ bPoint = true;
+ nOffCount++;
+ }
+ else if( unicode::isAlpha( c ) || unicode::isDigit( c ) )
+ {
+ const Mapping* map = 0;
+ if( bPoint && unicode::isLower( c ))
+ {
+ map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper);
+ bPoint = false;
+ }
+ else if (!bPoint && unicode::isUpper( c ))
+ {
+ map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower);
+ }
+
+ if(map == 0)
+ {
+ nOffCount++;
+ }
+ else
+ {
+ nOffCount += map->nmap;
+ }
+ }
+ else
+ {
+ nOffCount++;
+ }
+ }
+ }
+
+ bPoint = true;
+ rtl::OUStringBuffer result;
+
+ if (useOffset)
+ {
+ result.ensureCapacity(nOffCount);
+ if ( nOffCount != offset.getLength() )
+ offset.realloc( nOffCount );
+ }
+
+
+ sal_Int32 j = 0;
+ sal_Int32 * pArr = offset.getArray();
+ for( i = 0; i < nCount; ++i ) {
+ sal_Unicode c = inStr.getStr()[ i + startPos ];
+ if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) {
+ bPoint = true;
+ result.append(c);
+ pArr[j++] = i + startPos;
+ }
+ else if( unicode::isAlpha( c ) || unicode::isDigit( c ) )
+ {
+ const Mapping* map = 0;
+ if( bPoint && unicode::isLower( c ))
+ {
+ map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper);
+ }
+ else if (!bPoint && unicode::isUpper( c ))
+ {
+ map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower);
+ }
+
+ if(map == 0)
+ {
+ result.append( c );
+ pArr[j++] = i + startPos;
+ }
+ else
+ {
+ for (sal_Int32 k = 0; k < map->nmap; k++)
+ {
+ result.append( map->map[k] );
+ pArr[j++] = i + startPos;
+ }
+ }
+ bPoint = false;
+ }
+ else
+ {
+ result.append( c );
+ pArr[j++] = i + startPos;
+ }
+ }
+ return result.makeStringAndClear();
+}
+
+#if 0
+// TL: alternative implemntation try. But breakiterator has its problem too since
+// beginOfSentence does not work as expected with '.'. See comment below.
+// For the time being I will leave this code here as a from-scratch sample if the
+// breakiterator works better at some point...
+rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate(
+ const OUString& inStr, sal_Int32 nStartPos, sal_Int32 nCount,
+ Sequence< sal_Int32 >& /*offset*/ )
+ throw(RuntimeException)
+{
+ OUString aRes( inStr.copy( nStartPos, nCount ) );
+
+ if (nStartPos >= 0 && nStartPos < inStr.getLength() && nCount > 0)
+ {
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ BreakIteratorImpl brk( xMSF );
+
+ sal_Int32 nSentenceStart = -1, nOldSentenceStart = -1;
+ sal_Int32 nPos = nStartPos + nCount - 1;
+ while (nPos >= nStartPos && nPos != -1)
+ {
+ // possible problem: the locale is not exactly specific for each sentence in the text,
+ // but it is the only one we have...
+ nOldSentenceStart = nSentenceStart;
+ nSentenceStart = brk.beginOfSentence( inStr, nPos, aLocale );
+
+ // since the breakiterator completely ignores '.' characvters as end-of-sentence when
+ // the next word is lower case we need to take care of that ourself. The drawback:
+ // la mid-sentence abbreviation like e.g. will now be identified as end-of-sentence. :-(
+ // Well, at least the other product does it in the same way...
+ sal_Int32 nFullStopPos = inStr.lastIndexOf( (sal_Unicode)'.', nPos );
+ nPos = nSentenceStart;
+ if (nFullStopPos > 0 && nFullStopPos > nSentenceStart)
+ {
+ Boundary aBd2 = brk.nextWord( inStr, nFullStopPos, aLocale, WordType::DICTIONARY_WORD );
+ nSentenceStart = aBd2.startPos;
+ nPos = nFullStopPos;
+ }
+
+ if (nSentenceStart < nOldSentenceStart || nOldSentenceStart == -1)
+ {
+ // the sentence start might be a quotation mark or some kind of bracket, thus
+ // we need the first dictionary word starting or following this position
+ // Boundary aBd1 = brk.nextWord( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD );
+ Boundary aBd2 = brk.getWordBoundary( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD, true );
+ // OUString aWord1( inStr.copy( aBd1.startPos, aBd1.endPos - aBd1.startPos + 1 ) );
+ OUString aWord2( inStr.copy( aBd2.startPos, aBd2.endPos - aBd2.startPos + 1 ) );
+ }
+ else
+ break; // prevent endless loop
+
+ // continue with previous sentence
+ if (nPos != -1)
+ --nPos;
+ }
+ }
+ return aRes;
+}
+#endif
+
} } } }
diff --git a/i18npool/util/makefile.mk b/i18npool/util/makefile.mk
index d9b87d19e6ca..57f802be62fe 100644
--- a/i18npool/util/makefile.mk
+++ b/i18npool/util/makefile.mk
@@ -68,6 +68,7 @@ SHL1LIBS=$(LIB1TARGET)
SHL1STDLIBS= \
$(I18NUTILLIB) \
$(I18NISOLANGLIB) \
+ $(COMPHELPERLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB) \
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx
index 13fad506b54d..d1474503882f 100644
--- a/l10ntools/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -461,6 +461,8 @@ public:
bTitleFirst[ nId ] = true;
}
BOOL GetText( ByteString &rReturn, USHORT nTyp, const ByteString &nLangIndex, BOOL bDel = FALSE );
+ BOOL GetTransex3Text( ByteString &rReturn, USHORT nTyp, const ByteString &nLangIndex, BOOL bDel = FALSE );
+
};
//
diff --git a/l10ntools/java/jpropex/build.xml b/l10ntools/java/jpropex/build.xml
new file mode 100755
index 000000000000..d74fb3975d0f
--- /dev/null
+++ b/l10ntools/java/jpropex/build.xml
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<project name="jpropex" default="main" basedir=".">
+
+ <!-- ================================================================= -->
+ <!-- settings -->
+ <!-- ================================================================= -->
+
+ <!-- name of this sub target used in recursive builds -->
+ <property name="target" value="jpropex"/>
+
+ <!-- name of jar file created, without .jar extension -->
+ <property name="jarname" value="jpropex"/>
+
+ <!-- relative path to project directory -->
+ <property name="prj" value="."/>
+
+ <!-- build output directory -->
+ <property name="out" value="build"/>
+
+ <!-- build directories -->
+ <property name="build.dir" value="${out}"/>
+ <property name="build.class" value="${build.dir}/class/jpropex"/>
+ <property name="build.misc" value="${build.dir}/misc/jpropex"/>
+
+ <!-- start of java source code package structure -->
+ <property name="java.dir" value="java"/>
+
+ <!-- define how to handle CLASSPATH environment -->
+ <property name="build.sysclasspath" value="ignore"/>
+
+ <!-- classpath settings for compile and javadoc tasks -->
+ <path id="classpath">
+ <pathelement location="."/>
+ <pathelement location="${build.class}"/>
+ </path>
+
+ <!-- name to display in documentation -->
+ <!-- <property name="docname" value="l10n converter"/> -->
+
+ <!-- set "modern" java compiler -->
+ <property name="build.compiler" value="modern"/>
+
+ <!-- set wether we want to compile with debug information -->
+ <property name="debug" value="on"/>
+
+ <!-- set wether we want to compile with optimisation -->
+ <property name="optimize" value="off"/>
+
+ <!-- set wether we want to compile with or without deprecation -->
+ <property name="deprecation" value="on"/>
+
+ <target name="info">
+ <echo message="--------------------"/>
+ <echo message="${target}"/>
+ <echo message="--------------------"/>
+ </target>
+
+ <!-- ================================================================= -->
+ <!-- custom targets -->
+ <!-- ================================================================= -->
+
+ <!-- the main target, called in recursive builds -->
+ <target name="main" depends="info,prepare,compile,jar"/>
+
+ <!-- prepare output directories -->
+ <target name="prepare">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.class}"/>
+ <mkdir dir="${build.misc}"/>
+ </target>
+
+
+ <target name="res" depends="prepare">
+ <copy todir="${build.class}">
+ <fileset dir="${java.dir}">
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.form"/>
+ <include name="**/*.gif "/>
+ <include name="**/*.htm"/>
+ <include name="**/*.html"/>
+ <include name="**/*.js"/>
+ <include name="**/*.mod"/>
+ <include name="**/*.sql"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xsl"/>
+ <include name="**/*.map"/>
+
+ </fileset>
+ </copy>
+ </target>
+
+
+ <target name="compile" depends="prepare,res">
+ <javac destdir="${build.class}"
+ debug="${debug}"
+ deprecation="${deprication}"
+ optimize="${optimize}"
+ classpathref="classpath">
+ <src path="${java.dir}"/>
+ <include name="**/*.java"/>
+ </javac>
+ </target>
+
+ <!-- clean up -->
+ <target name="clean" depends="prepare">
+ <delete includeEmptyDirs="true">
+ <fileset dir="${build.class}">
+ <patternset>
+ <include name="${package}/**/*.class"/>
+ </patternset>
+ </fileset>
+ </delete>
+ </target>
+
+ <!-- create jar file -->
+ <target name="jar" depends="prepare,compile" if="build.class">
+ <jar jarfile="${build.class}/${jarname}.jar"
+ basedir="${build.class}"
+ manifest="${jarname}.MF">
+ <include name="**/*.class"/>
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.form"/>
+ <include name="**/*.gif "/>
+ <include name="**/*.htm"/>
+ <include name="**/*.html"/>
+ <include name="**/*.js"/>
+ <include name="**/*.mod"/>
+ <include name="**/*.sql"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xsl"/>
+ <include name="**/*.map"/>
+ </jar>
+ </target>
+
+ <target name="test" depends="prepare">
+ </target>
+
+</project>
+
diff --git a/l10ntools/java/jpropex/java/JPropEx.java b/l10ntools/java/jpropex/java/JPropEx.java
new file mode 100644
index 000000000000..d0f72d627aaf
--- /dev/null
+++ b/l10ntools/java/jpropex/java/JPropEx.java
@@ -0,0 +1,429 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+import java.util.*;
+import java.io.*;
+
+public class JPropEx
+{
+ private String inputFileArg = "";
+ private String outputFileArg = "";
+ private String pathPrefixArg = "";
+ private String pathPostfixArg = "";
+ private String projectArg = "";
+ private String rootArg = "";
+ private Vector forcedLangsArg;
+ private Vector langsArg;
+ private String inputSdfFileArg = "";
+ private boolean isQuiet = false;
+ private final String resourceType = "javaproperties";
+ private final String sourceLanguage = "en-US";
+ //private SdfData data;
+
+ public JPropEx()
+ {
+ //data = new SdfData();
+ }
+
+ public JPropEx( String args[] )
+ {
+ super();
+ parseArguments( args );
+ testCL();
+ //testArguments();
+ if( inputSdfFileArg != null && inputSdfFileArg.length() > 0 )
+ merge();
+ else
+ extract();
+ }
+
+ private String getSimpleArg( String[] args , int x )
+ {
+ if( x < args.length ) x++;
+ else
+ {
+ System.err.println("ERROR: Missing arg for "+args[ x ]+"\n");
+ help();
+ }
+ return args[ x ];
+ }
+ private Vector getComplexArg( String[] args , int x )
+ {
+ if( x < args.length ) x++;
+ else
+ {
+ System.err.println("ERROR: Missing arg for "+args[ x ]+"\n");
+ help();
+ }
+ String value = args[ x ];
+ Vector values = new Vector( Arrays.asList( value.split(",") ) );
+ return values;
+ }
+
+ private void testCL()
+ {
+ if( inputFileArg.length()>0 && ( ( pathPrefixArg.length()>0 && pathPostfixArg.length()>0 ) || outputFileArg.length()>0 ) && projectArg.length()>0 && rootArg.length()>0 && langsArg.size()>0 )
+ if( ( inputSdfFileArg.length()>0 && ( outputFileArg.length()>0 || ( pathPrefixArg.length()>0 && pathPostfixArg.length()>0 ) ) ) || ( inputFileArg.length()>0 && outputFileArg.length()>0 ) )
+ return;
+ System.out.println("ERROR: Strange parameters!");
+ help();
+ System.exit( -1 );
+ }
+ private void help()
+ {
+ System.out.println("jpropex -> extract / merge java properties files");
+ System.out.println("-p <project> -r <project_root> -i <input>|@<input> -o <output> -x <path1> -y <path2> -m <sdf_file> -l <lang>\n");
+ System.out.println("Example:\ncd /data/cws/l10ntooling17/DEV300/ooo/reportbuilder/java/com/sun/star/report/function/metadata");
+ System.out.println("Extract:\njpropex -p reportbuilder -r ../../../../../../.. -i Title-Function.properties -o new.sdf -l en-US");
+ System.out.println("Merge: use either ( -x path -y more_path ) or ( -o ) and ( -i filename ) or ( -i @filename ). @filename contains a list with files");
+ System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivo -i @abc -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf");
+ System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivo -i @abc -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf");
+ System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -o ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/ -i Title-Function.properties -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf");
+ System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivooo -i Title-Function.properties -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf");
+ System.exit( -1 );
+ }
+
+ private void extract()
+ {
+ SdfData data = new SdfData();
+ java.util.Properties prop = loadProp( inputFileArg );
+
+ // Get a prototype that already contains the most common settings
+ SdfEntity dolly = prepareSdfObj( inputFileArg );
+ String key;
+ SdfEntity currentStr;
+ String value;
+ for( Enumeration e = prop.propertyNames() ; e.hasMoreElements() ; )
+ {
+ key = (String) e.nextElement();
+ currentStr = (SdfEntity) dolly.clone();
+ // Set the new LID and the string text
+ currentStr.setLid( key );
+ value = prop.getProperty( key , "" );
+ //if( value.equals("") ) System.err.println("Warning: in file "+inputFileArg+" the string with the key "+key+" has a empty string!");
+ currentStr.setText( (prop.getProperty( key )).replaceAll("\t" , " " ) ); // TODO: Quoting!!!!
+ data.add( currentStr );
+ }
+ data.write( outputFileArg );
+ }
+
+ private SdfEntity prepareSdfObj( String filename )
+ {
+ String path = makeAbs( filename );
+ //String path = makeAbs( inputFileArg );
+ path = path.replace( rootArg + "/" , "" );
+ path = path.replace("/","\\");
+ return new SdfEntity( projectArg , path , "" /* dummy1 */ , resourceType , "", "" , "" , "" , "" /* dummy2 */ ,
+ sourceLanguage , "", "" , "" , "" , "2002-02-02 02:02:02" );
+ }
+
+ private void merge()
+ {
+ SdfData data = getSdfData();
+ if( inputFileArg.startsWith("@") )
+ {
+ // Read files
+ Vector fileList = readFileList( inputFileArg );
+ for( Enumeration e = fileList.elements(); e.hasMoreElements(); )
+ mergeFile( (String) e.nextElement() , data , false );
+ }
+ else
+ {
+ // Single file
+ mergeFile( inputFileArg , data , true );
+ }
+ }
+
+ private Vector readFileList( String filename )
+ {
+ Vector lines = new Vector();
+ try
+ {
+ BufferedReader in = new BufferedReader( new FileReader( filename.substring( 1 ) ) );
+ while( in.ready() )
+ lines.add( in.readLine() );
+ }
+ catch( IOException e )
+ {
+ System.out.println("ERROR: Can't open file '"+filename.substring( 1 )+"'");
+ System.exit( -1 );
+ }
+ return lines;
+ }
+
+ private void mergeFile( String filename , SdfData data , boolean isSingleFile )
+ {
+ java.util.Properties sourceProp = loadProp( filename );
+ Vector langs = getLanguages( data );
+ HashMap props = new HashMap();
+ // Create a properties object for every language
+ for( Enumeration e = langs.elements(); e.hasMoreElements();)
+ {
+ props.put( (String)e.nextElement() , new java.util.Properties() );
+ }
+ // Get a prototype that already contains the most common settings
+
+ SdfEntity dolly = prepareSdfObj( filename );
+ String key;
+ String sourceString;
+ SdfEntity curStr;
+ SdfEntity curEntity;
+ SdfEntity mergedEntity;
+ String curLang;
+ for( Enumeration e = sourceProp.propertyNames() ; e.hasMoreElements() ; ) // For all property keys
+ {
+ key = (String) e.nextElement();
+ sourceString = sourceProp.getProperty( key );
+ curStr = (SdfEntity) dolly.clone();
+ curStr.setLid( key );
+ for( Enumeration lang = langs.elements(); lang.hasMoreElements(); ) // merge in every language
+ {
+ curEntity = (SdfEntity) curStr.clone();
+ curLang = (String) lang.nextElement();
+ curEntity.setLangid( curLang );
+ mergedEntity = data.get( curEntity );
+ if( mergedEntity == null )
+ {
+ // if case there is not translation the fallback to the en-US source string
+ ( (java.util.Properties) props.get( curLang )).setProperty( curEntity.getLid() , sourceString );
+ }
+ else
+ {
+ // Set the merged text from the sdf file
+ ( (java.util.Properties) props.get( curLang )).setProperty( mergedEntity.getLid() , mergedEntity.getText() ); // TODO: Quoting ???
+ }
+ }
+
+ }
+ // Now write them out
+ String lang;
+ for( Iterator i = props.keySet().iterator() ; i.hasNext() ; )
+ {
+ lang = (String) i.next();
+ writeSinglePropertiesFile( filename , (java.util.Properties) props.get( lang ) , lang , isSingleFile );
+ }
+ }
+ private void writeSinglePropertiesFile( String filename , java.util.Properties prop , String lang , boolean isSingleFile )
+ {
+ // Prepare path to file
+ int filenameIdx = filename.lastIndexOf( "/" ) > 0 ? filename.lastIndexOf( "/" )+1 : 0 ;
+ String path = new String();
+ String name = new String();
+ String lcLang = lang.toLowerCase();
+ // use of -x <path> -y <more_path>
+ // -> <path>/<lang>/<more_path>
+ if( pathPrefixArg != null && pathPrefixArg.length()>0 && pathPostfixArg != null && pathPostfixArg.length()>0 )
+ {
+ path = new StringBuffer().append( pathPrefixArg ).append( "/" ).append( lcLang ).append( "/" ).append( pathPostfixArg ).append( "/" ).toString();
+ name = new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) )
+ .append( "_" ).append( lcLang.replaceAll("-","_") ).append( ".properties" ).toString();
+ }
+ //use of -i <one_filename>
+ else if( !isSingleFile && outputFileArg != null && outputFileArg.length()>0 )
+ {
+ name = outputFileArg;
+ name += new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) )
+ .append( "_" ).append( lcLang.replaceAll("-","_") ).append( ".properties" ).toString();
+ //name = outputFileArg;
+ }
+ //use of -i @<file_containing_many_filenames>
+ else if( isSingleFile && outputFileArg != null && outputFileArg.length()>0 )
+ {
+ name = outputFileArg;
+ name += new StringBuffer().append( inputFileArg.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) )
+ .append( "_" ).append( lcLang.replaceAll("-","_") ).append( ".properties" ).toString();
+ //name = outputFileArg;
+ }
+ else
+ {
+ System.err.println("ERROR: No outputfile specified .. either -o or -x -y !");
+ System.exit( -1 );
+ }
+
+ File dir = new File( path );
+ try
+ {
+ if( !dir.exists() && path.length()>0 )
+ {
+ if( !dir.mkdirs() )
+ {
+ System.out.println("ERROR: Can't create directory '"+path+"' !!!");
+ System.exit( -1 );
+ }
+ }
+ }
+ catch( SecurityException e )
+ {
+ System.out.println("ERROR: Can't create directory '"+path+"'!!!Wrong Permissions?");
+ System.exit( -1 );
+ }
+ path += name;
+ // Write the properties file
+ System.out.println("DBG: Writing to "+path);
+ try{
+ BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( path ) );
+ if( prop == null )
+ System.out.println("DBG: prop == null!!!");
+ prop.store( out , "" ); // Legal headers?
+ }
+ catch( IOException e )
+ {
+ System.out.println("ERROR: Can't write file '"+path+"' !!!!");
+ System.exit( -1 );
+ }
+ }
+
+ private SdfData getSdfData()
+ {
+ SdfData data = new SdfData( inputSdfFileArg );
+ data.read();
+ return data;
+ }
+ private Vector getLanguages( SdfData data )
+ {
+ Vector langs = new Vector();
+
+ if( ((String)langsArg.get( 0 )).equalsIgnoreCase( "all" ) ) // for "-l all" use all languages found in the -m sdf file
+ langs.addAll( data.getLanguages() );
+ else
+ langs.addAll( langsArg ); // use the langs giving by -l
+
+ if( forcedLangsArg != null )
+ langs.addAll( forcedLangsArg );
+
+ return removeDupes( langs );
+ }
+ private Vector removeDupes( Vector vec )
+ {
+ Collection coll = new LinkedHashSet( vec );
+ return new Vector( coll );
+ }
+ private java.util.Properties loadProp( String filename )
+ {
+ java.util.Properties prop = new java.util.Properties();
+ try
+ {
+ prop.load( new BufferedInputStream( new NoLocalizeFilter( new FileInputStream( filename ) ) ) );
+ }
+ catch( IOException e )
+ {
+ System.err.println("ERROR: Can't read file '"+filename+"'!!!");
+ }
+ return prop;
+ }
+ private void parseArguments( String[] args )
+ {
+
+ if( args.length == 0 )
+ {
+ System.out.println("ERROR: No args???");
+ help();
+ System.exit( -1 );
+ }
+ for( int x = 0; x < args.length ; x++ )
+ {
+ if( args[ x ].equalsIgnoreCase("-i") )
+ {
+ // Input resource file
+ inputFileArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-o") )
+ {
+ // Output sdf file
+ outputFileArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-x") )
+ {
+ // path prefix
+ pathPrefixArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-y") )
+ {
+ // path postfix
+ pathPostfixArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-p") )
+ {
+ // project
+ projectArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-r") )
+ {
+ // root
+ rootArg = getSimpleArg( args , x );
+ rootArg = makeAbs( rootArg );
+ }
+ else if( args[ x ].equalsIgnoreCase("-lf") )
+ {
+ // forced langs
+ forcedLangsArg = getComplexArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-l") )
+ {
+ // langs
+ langsArg = getComplexArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-m") )
+ {
+ // input sdf file
+ inputSdfFileArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-qq") )
+ {
+ isQuiet = true;
+ }
+ }
+ }
+ private String makeAbs( String path )
+ {
+ File file;
+ try
+ {
+ file = new File( path );
+ return file.getCanonicalPath();
+ }catch( IOException e )
+ {
+ e.printStackTrace();
+ System.exit( -1 );
+ }
+ return null;
+ }
+/* private boolean testArguments()
+ {
+ // nice merge
+ if( inputSdfFileArg != null && inputSdfFileArg.length()>0 )
+ // nice merge
+ return projectArg != null && rootArg != null && inputFileArg != null && pathPrefixArg != null && pathPostfixArg != null && langsArg != null &&
+ projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && pathPrefixArg.length()>0 && pathPostfixArg.length()>0 && langsArg.size()>0 ;
+ else
+ // nice extract
+ return projectArg != null && rootArg != null && inputFileArg != null && outputFileArg != null && langsArg != null &&
+ projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && outputFileArg.length()>0 && langsArg.size()>0;
+ }
+*/
+}
diff --git a/svtools/source/uno/unoifac2.hrc b/l10ntools/java/jpropex/java/Main.java
index a31d07e0bd27..23dc477ddec3 100644
--- a/svtools/source/uno/unoifac2.hrc
+++ b/l10ntools/java/jpropex/java/Main.java
@@ -25,28 +25,14 @@
*
************************************************************************/
-#ifndef _SVT_UNO_UNOIFAC_HRC_
-#define _SVT_UNO_UNOIFAC_HRC_
+class Main
+{
-#ifndef _SOLAR_HRC
-#include <svl/solar.hrc>
-#endif
-
-//! Um den Überblick über alle benutzten HelpID's zu behalten sind diese
-//! zentral in <helpid.hrc>
-#ifndef _SVT_HELPID_HRC
-#include <svtools/helpid.hrc>
-#endif
-
-// RID's fuer das Kontextmenu der Textkomponente
-#define RID_CONTEXTMENU (RID_APP_START + 1024)
-#define RID_OPEN_LINK (RID_APP_START + 10)
-#define RID_OPEN_LINK_NEW (RID_APP_START + 11)
-#define RID_DOWNLOAD (RID_APP_START + 12)
-#define RID_ADD_BOOKMARK (RID_APP_START + 13)
-#define RID_COPY_LINK (RID_APP_START + 14)
-
-
-#endif
+ public static void main( String args[] )
+ {
+ JPropEx jpropex = new JPropEx( args );
+ //jpropex.init();
+ }
+}
diff --git a/svtools/source/uno/unoifac2.src b/l10ntools/java/jpropex/java/NoLocalizeFilter.java
index 406701ca4fc1..3bfa53df2296 100644
--- a/svtools/source/uno/unoifac2.src
+++ b/l10ntools/java/jpropex/java/NoLocalizeFilter.java
@@ -26,82 +26,31 @@
************************************************************************/
+import java.io.*;
+import java.util.regex.*;
-#ifndef _SVT_UNO_UNOIFAC_HRC_
-#include <unoifac2.hrc>
-#endif
-
-
-Menu RID_CONTEXTMENU
+// exit if the sequence x-no-localize is found in stream!
+public class NoLocalizeFilter extends FilterInputStream
{
- ItemList =
+ InputStream in;
+ Pattern p = Pattern.compile("#[\\s]*x-no-translate");
+
+ public NoLocalizeFilter( InputStream in ) {
+ super(in);
+ this.in = in;
+ }
+ public int read(byte[] b, int off, int len) throws IOException
{
- MenuItem
- {
- Identifier = RID_OPEN_LINK ;
- HelpId = HID_TEXTCPNT_OPEN_LINK ;
- Text [ en-US ] = "~Open";
- };
- MenuItem
- {
- Identifier = RID_OPEN_LINK_NEW ;
- HelpId = HID_TEXTCPNT_OPEN_LINK_NEW ;
- Text [ en-US ] = "Open in New ~Window";
- };
- MenuItem
- {
- Identifier = RID_DOWNLOAD ;
- HelpId = HID_TEXTCPNT_DOWNLOAD ;
- Text [ en-US ] = "~Download...";
- };
- MenuItem
+ String search = new String( b );
+ Matcher m = p.matcher( search );
+ if( m.find() )
+ //if( search.contains("x-no-translate" ) ) // TODO: fixme!
{
- Separator = TRUE;
- };
- MenuItem
- {
- Identifier = RID_ADD_BOOKMARK ;
- HelpId = HID_TEXTCPNT_ADD_BOOKMARK ;
- Text [ en-US ] = "Add ~Link";
- };
- MenuItem
- {
- Separator = TRUE;
- };
- MenuItem
- {
- Identifier = RID_COPY_LINK ;
- HelpId = HID_TEXTCPNT_COPY_LINK ;
- Text [ en-US ] = "Cop~y Link" ;
- };
- };
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ System.out.println("found x-no-translate");
+ in.close();
+ close();
+ System.exit( 0 );
+ }
+ return in.read( b , off , len );
+ }
+}
diff --git a/l10ntools/java/jpropex/java/OrderedHashMap.java b/l10ntools/java/jpropex/java/OrderedHashMap.java
new file mode 100644
index 000000000000..a462d598b307
--- /dev/null
+++ b/l10ntools/java/jpropex/java/OrderedHashMap.java
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+import java.util.*;
+
+// LinkedHashMap implrementation
+public class OrderedHashMap
+{
+ private HashMap hm = new HashMap();
+ private LinkedList list = new LinkedList();
+
+ public Iterator iterator() { return list.iterator(); }
+
+ public boolean isEmpty() { return hm.isEmpty(); }
+ public Object get( Object key ) { return hm.get( key ); }
+ public Object get( int index ) { return hm.get( list.get( index ) ); }
+ public Iterator keys() { return list.iterator(); }
+ public Object add( Object key , Object value )
+ {
+ list.add( key );
+ return hm.put( key, value );
+ }
+ public Object add( int index , Object key , Object value )
+ {
+ list.add( index , key );
+ return hm.put( key, value );
+ }
+ public Object remove( Object key )
+ {
+ list.remove( list.indexOf( key ) );
+ return hm.remove( key );
+ }
+ public void move( int idxFrom , int idxTo )
+ {
+ Object key = list.get( idxFrom );
+ list.remove( idxFrom );
+ list.add( idxTo , key );
+ }
+ public void move( Object key , int idxTo )
+ {
+ move( list.indexOf( key ) , idxTo );
+ }
+ public int size()
+ {
+ return hm.size();
+ }
+ public Enumeration elements()
+ {
+ return new OHMenum( this );
+ }
+}
+
+final class OHMenum implements Enumeration
+{
+ OrderedHashMap ohm;
+ int index = 0;
+
+ private OHMenum(){};
+ public OHMenum( OrderedHashMap ohm ){
+ this.ohm = ohm ;
+ }
+
+ public boolean hasMoreElements()
+ {
+ return index < ohm.size();
+ }
+ public Object nextElement()
+ {
+ return ohm.get( index++ );
+ }
+}
diff --git a/l10ntools/java/jpropex/java/SdfData.java b/l10ntools/java/jpropex/java/SdfData.java
new file mode 100644
index 000000000000..80b8ea890f26
--- /dev/null
+++ b/l10ntools/java/jpropex/java/SdfData.java
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+import java.util.*;
+import java.io.*;
+
+public class SdfData
+{
+ private String filename;
+ private OrderedHashMap ohm;
+ private LinkedHashSet languagesFound;
+
+ public SdfData()
+ {
+ languagesFound = new LinkedHashSet();
+ ohm = new OrderedHashMap();
+ languagesFound = new LinkedHashSet();
+ }
+ public SdfData( String filename )
+ {
+ this();
+ this.filename = filename;
+ }
+
+ public LinkedHashSet getLanguages()
+ {
+ return languagesFound;
+ }
+ public SdfEntity get( SdfEntity obj )
+ {
+ return (SdfEntity) ohm.get( (String)obj.getId() );
+ }
+ public SdfEntity get( String key ){
+ return (SdfEntity) ohm.get( key );
+ }
+ public void add( SdfEntity obj )
+ {
+ ohm.add( obj.getId() , obj );
+ }
+
+ public void read()
+ {
+ BufferedReader in;
+ try
+ {
+ in = new BufferedReader( new FileReader( filename ) );
+ SdfEntity entity;
+ while( in.ready() )
+ {
+ String line = in.readLine();
+ if( line.length() > 0 )
+ {
+ entity = new SdfEntity( line );
+ ohm.add( entity.getId() , entity ); // test if is valid
+ languagesFound.add( entity.getLangid() );
+ }
+ }
+ in.close();
+ }
+ catch( IOException e )
+ {
+ System.out.println("Error: reading file " + filename);
+ System.exit( -1 );
+ }
+ }
+ public void write( String filename )
+ {
+ FileWriter out;
+ try
+ {
+ out = new FileWriter( filename , true ); // Always append
+ for( Enumeration e = ohm.elements(); e.hasMoreElements(); )
+ {
+ out.write( ( (SdfEntity) e.nextElement() ).toString() + "\n" );
+ }
+ out.close();
+ }
+ catch( IOException e )
+ {
+ System.out.println("Error: Can't write to file " + filename);
+ System.exit( -1 );
+ }
+ }
+}
diff --git a/l10ntools/java/jpropex/java/SdfEntity.java b/l10ntools/java/jpropex/java/SdfEntity.java
new file mode 100644
index 000000000000..52dc61ca40ca
--- /dev/null
+++ b/l10ntools/java/jpropex/java/SdfEntity.java
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+public class SdfEntity implements Cloneable{
+ private String project = new String("");
+ private String source_file = new String("");
+ private String dummy1 = new String("");
+ private String resource_type= new String("");
+ private String gid = new String("");
+ private String lid = new String("");
+ private String helpid = new String("");
+ private String platform = new String("");
+ private String dummy2 = new String("");
+ private String langid = new String("");
+ private String text = new String("");
+ private String helptext = new String("");
+ private String quickhelptext= new String("");
+ private String title = new String("");
+ private String date = new String("");
+
+ public static int PROJECT_POS = 0;
+ public static int SOURCE_FILE_POS = 1;
+ public static int DUMMY1_POS = 2;
+ public static int RESOURCE_TYPE_POS = 3;
+ public static int GID_POS = 4;
+ public static int LID_POS = 5;
+ public static int HELPID_POS = 6;
+ public static int PLATFORM_POS = 7;
+ public static int DUMMY2_POS = 8;
+ public static int LANGID_POS = 9;
+ public static int TEXT_POS = 10;
+ public static int HELPTEXT_POS = 11;
+ public static int QUICKHELPTEXT_POS = 12;
+ public static int TITLE_POS = 13;
+ public static int DATE_POS = 14;
+
+ public Object clone()
+ {
+ try
+ {
+ return super.clone();
+ }
+ catch( CloneNotSupportedException e )
+ {
+ System.out.println("ERROR: Can not clone, something is broken here ....");
+ System.exit( -1 );
+ }
+ return null; // dummy
+ }
+
+ public SdfEntity( String line ){
+ // isValid?
+ setProperties( line ) ;
+ }
+ public SdfEntity(String project, String source_file, String dummy1, String resource_type, String gid, String lid, String helpid, String platform, String dummy2, String langid, String text, String helptext, String quickhelptext, String title , String date) {
+ super();
+ this.project = project;
+ this.source_file = source_file;
+ this.dummy1 = dummy1;
+ this.resource_type = resource_type;
+ this.gid = gid;
+ this.lid = lid;
+ this.helpid = helpid;
+ this.platform = platform;
+ this.dummy2 = dummy2;
+ this.langid = langid;
+ this.text = text;
+ this.helptext = helptext;
+ this.quickhelptext = quickhelptext;
+ this.title = title;
+ this.date = date;
+ }
+
+ public void setProperties( String line ){
+
+ String[] splitted = line.split("\t");
+
+ setProject( splitted[ SdfEntity.PROJECT_POS ] );
+ setSource_file( splitted[ SdfEntity.SOURCE_FILE_POS ] );
+ setDummy1( splitted[ SdfEntity.DUMMY1_POS ] );
+ setResource_type( splitted[ SdfEntity.RESOURCE_TYPE_POS ] );
+ setGid( splitted[ SdfEntity.GID_POS ] );
+ setLid( splitted[ SdfEntity.LID_POS ] );
+ setHelpid( splitted[ SdfEntity.HELPID_POS ] );
+ setPlatform( splitted[ SdfEntity.PLATFORM_POS ] );
+ setDummy2( splitted[ SdfEntity.DUMMY2_POS ] );
+ setLangid( splitted[ SdfEntity.LANGID_POS ] );
+ setText( splitted[ SdfEntity.TEXT_POS ] );
+ setHelptext( splitted[ SdfEntity.HELPTEXT_POS ] );
+ setQuickhelptext( splitted[ SdfEntity.QUICKHELPTEXT_POS ] );
+ setTitle( splitted[ SdfEntity.TITLE_POS ] );
+ setDate( splitted[ SdfEntity.DATE_POS ] );
+ }
+
+ public String getFileId(){
+ return project+"\\"+source_file;
+ }
+ public String getResourcePath(){
+ return source_file.substring(0 , source_file.lastIndexOf( "\\" )-1 );
+ }
+ public String toString(){
+ return new StringBuffer( project ).append( "\t" ).append( source_file ).append( "\t" ).append( dummy1 ).append( "\t" ).append( resource_type ).append( "\t" ).append( gid ).append( "\t" )
+ .append( lid ).append( "\t" ).append( helpid ).append( "\t" ).append( platform ).append( "\t" ).append( dummy2 ).append( "\t" ).append( langid ).append( "\t" )
+ .append( text ).append( "\t" ).append( helptext ).append( "\t" ).append( quickhelptext ).append( "\t" ).append( title ).append( "\t" ).append( date ).toString();
+ }
+ public String getId(){
+ return new StringBuffer( project ).append( gid ).append( lid ).append( source_file ).append( resource_type ).append( platform ).append( helpid ).append( langid ).toString();
+ }
+
+ public String getDummy1() {
+ return dummy1;
+ }
+
+ public void setDummy1(String dummy1) {
+ this.dummy1 = dummy1;
+ }
+
+ public String getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(String platform) {
+ this.platform = platform;
+ }
+
+ public String getDummy2() {
+ return dummy2;
+ }
+
+ public void setDummy2(String dummy2) {
+ this.dummy2 = dummy2;
+ }
+
+ public String getGid() {
+ return gid;
+ }
+
+ public void setGid(String gid) {
+ this.gid = gid;
+ }
+
+ public String getHelpid() {
+ return helpid;
+ }
+
+ public void setHelpid(String helpid) {
+ this.helpid = helpid;
+ }
+
+ public String getHelptext() {
+ return helptext;
+ }
+
+ public void setHelptext(String helptext) {
+ this.helptext = helptext;
+ }
+
+ public String getLangid() {
+ return langid;
+ }
+
+ public void setLangid(String langid) {
+ this.langid = langid;
+ }
+
+ public String getLid() {
+ return lid;
+ }
+
+ public void setLid(String lid) {
+ this.lid = lid;
+ }
+
+ public String getProject() {
+ return project;
+ }
+
+ public void setProject(String project) {
+ this.project = project;
+ }
+
+ public String getQuickhelptext() {
+ return quickhelptext;
+ }
+
+ public void setQuickhelptext(String quickhelptext) {
+ this.quickhelptext = quickhelptext;
+ }
+
+ public String getResource_type() {
+ return resource_type;
+ }
+
+ public void setResource_type(String resource_type) {
+ this.resource_type = resource_type;
+ }
+
+ public String getSource_file() {
+ return source_file;
+ }
+
+ public void setSource_file(String source_file) {
+ this.source_file = source_file;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ public String getDate() {
+ return date;
+ }
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+
+}
diff --git a/l10ntools/java/jpropex/jpropex b/l10ntools/java/jpropex/jpropex
new file mode 100755
index 000000000000..2d62d13b093e
--- /dev/null
+++ b/l10ntools/java/jpropex/jpropex
@@ -0,0 +1,10 @@
+#!/bin/sh
+if [ x${SOLARENV}x = xx ]; then
+ echo No environment found, please use 'configure' or 'setsolar'
+ exit 1
+fi
+if [ x${JAVA_HOME}x = xx ]; then
+ echo No Java found!
+ exit 1
+fi
+exec java -DSOLARSRC=${SOLARSRC} -DWORK_STAMP=${WORK_STAMP} -DUSE_SHELL= -jar ${SOLARVER}/${INPATH}/bin${UPDMINOREXT}/jpropex.jar "$@"
diff --git a/l10ntools/java/jpropex/jpropex.MF b/l10ntools/java/jpropex/jpropex.MF
new file mode 100755
index 000000000000..3e22e7e9bfbf
--- /dev/null
+++ b/l10ntools/java/jpropex/jpropex.MF
@@ -0,0 +1 @@
+Main-Class: Main
diff --git a/l10ntools/java/jpropex/makefile.mk b/l10ntools/java/jpropex/makefile.mk
new file mode 100755
index 000000000000..f86d2c830025
--- /dev/null
+++ b/l10ntools/java/jpropex/makefile.mk
@@ -0,0 +1,36 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+
+PRJ=../..
+PRJNAME=transex3
+TARGET=jpropex
+
+.INCLUDE : ant.mk
+
+ALLTAR : ANTBUILD
+
diff --git a/l10ntools/prj/build.lst b/l10ntools/prj/build.lst
index ff961c096cbd..8387154897b3 100644
--- a/l10ntools/prj/build.lst
+++ b/l10ntools/prj/build.lst
@@ -3,8 +3,7 @@ tr l10ntools usr1 - all tr_mkout NULL
tr l10ntools\inc nmake - all tr_inc NULL
tr l10ntools\source nmake - all tr_src tr_inc NULL
tr l10ntools\layout nmake - all rt_layout tr_src tr_inc NULL
-#tr l10ntools\java\l10nconv nmake - all tr_conv NULL
-#tr l10ntools\java\receditor nmake - all tr_rece NULL
+tr l10ntools\java\jpropex nmake - all tr_blah NULL
tr l10ntools\source\help nmake - all tr_bla_help NULL
tr l10ntools\source\filter\utils nmake - all tr_bla_utils NULL
tr l10ntools\source\filter\merge nmake - all tr_bla_merge tr_bla_utils NULL
diff --git a/l10ntools/prj/d.lst b/l10ntools/prj/d.lst
index f75c16b43764..0b6a43444613 100644
--- a/l10ntools/prj/d.lst
+++ b/l10ntools/prj/d.lst
@@ -29,6 +29,7 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help
..\%__SRC%\bin\ulfconv %_DEST%\bin%_EXT%\ulfconv
..\%__SRC%\class\FCFGMerge.jar %_DEST%\bin%_EXT%\FCFGMerge.jar
..\%__SRC%\class\HelpIndexerTool.jar %_DEST%\bin%_EXT%\HelpIndexerTool.jar
+..\%__SRC%\class\jpropex\jpropex.jar %_DEST%\bin%_EXT%\jpropex.jar
..\%__SRC%\bin\HelpLinker %_DEST%\bin%_EXT%\HelpLinker
..\%__SRC%\bin\HelpCompiler %_DEST%\bin%_EXT%\HelpCompiler
..\%__SRC%\bin\HelpCompiler.exe %_DEST%\bin%_EXT%\HelpCompiler.exe
@@ -40,6 +41,7 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help
..\%__SRC%\class\receditor\receditor.jar %_DEST%\bin%_EXT%\receditor.jar
+..\java\jpropex\jpropex %_DEST%\bin%_EXT%\jpropex
..\scripts\localize.pl %_DEST%\bin%_EXT%\localize.pl
..\scripts\localize_old.pl %_DEST%\bin%_EXT%\localize_old.pl
..\scripts\localize %_DEST%\bin%_EXT%\localize
@@ -50,6 +52,7 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help
..\inc\l10ntools\directory.hxx %_DEST%\inc%_EXT%\l10ntools\directory.hxx
..\inc\l10ntools\file.hxx %_DEST%\inc%_EXT%\l10ntools\file.hxx
..\inc\l10ntools\vosapp.hxx %_DEST%\inc%_EXT%\l10ntools\vosapp.hxx
+..\source\filter\merge\FCFGMerge.cfg %_DEST%\inc%_EXT%\l10ntools\FCFGMerge.cfg
..\inc\utf8conv.hxx %_DEST%\inc%_EXT%\l10ntools\utf8conv.hxx
..\%__SRC%\lib\transex.lib %_DEST%\lib%_EXT%\transex.lib
diff --git a/l10ntools/scripts/localize.pl b/l10ntools/scripts/localize.pl
index 82ef331a63d5..4aea1d933992 100755..100644
--- a/l10ntools/scripts/localize.pl
+++ b/l10ntools/scripts/localize.pl
@@ -272,7 +272,9 @@ sub write_sdf
foreach my $lang( keys( %{ $string_hash } ) )
{
my @sdf_file;
+ next , if( $lang eq "en-US" );
+ mkdir $l10n_file."/$lang";
# mkdir!!!!
my $current_l10n_file = $l10n_file."/$lang/localize.sdf";
print "Writing '$current_l10n_file'\n";
@@ -380,11 +382,9 @@ sub merge_gsicheck{
my ( $TMPHANDLE , $tmpfile ) = File::Temp::tempfile();
close ( $TMPHANDLE );
- if( $ENV{WRAPCMD} ){
- $command = "$ENV{WRAPCMD} gsicheck";
- }else{
- $command = "gsicheck";
- }
+ $command = "$ENV{WRAPCMD} " if( $ENV{WRAPCMD} );
+ $command .= "$ENV{SOLARVER}/$ENV{INPATH}/bin/gsicheck";
+
my $errfile = $sdffile.".err";
$command .= " -k -c -wcf $tmpfile -wef $errfile -l \"\" $sdffile";
#my $rc = system( $command );
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index a3df11c2920b..59f29525eda4 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -2096,7 +2096,7 @@ BOOL Export::PrepareTextToMerge( ByteString &rText, USHORT nTyp,
}
ByteString sContent;
- pEntrys->GetText( sContent, nTyp, nLangIndex );
+ pEntrys->GetTransex3Text( sContent, nTyp, nLangIndex );
//if ( !sContent.Len() && ( ! nLangIndex.EqualsIgnoreCaseAscii("en-US") )) {
if ( !sContent.Len() && ( ! Export::isSourceLanguage( nLangIndex ) )) {
rText = sOrigText;
@@ -2158,7 +2158,7 @@ void Export::MergeRest( ResData *pResData, USHORT nMode )
sCur = aLanguages[ n ];
ByteString sText;
- BOOL bText = pEntry->GetText( sText, STRING_TYP_TEXT, sCur , TRUE );
+ BOOL bText = pEntry->GetTransex3Text( sText, STRING_TYP_TEXT, sCur , TRUE );
if ( bText && sText.Len() && sText != "-" ) {
ByteString sOutput;
if ( bNextMustBeDefineEOL) {
@@ -2211,7 +2211,7 @@ void Export::MergeRest( ResData *pResData, USHORT nMode )
sCur = aLanguages[ n ];
ByteString sText;
- BOOL bText = pEntry->GetText( sText, STRING_TYP_QUICKHELPTEXT, sCur, TRUE );
+ BOOL bText = pEntry->GetTransex3Text( sText, STRING_TYP_QUICKHELPTEXT, sCur, TRUE );
if ( bText && sText.Len() && sText != "-" ) {
ByteString sOutput;
if ( bNextMustBeDefineEOL) {
@@ -2258,7 +2258,7 @@ void Export::MergeRest( ResData *pResData, USHORT nMode )
sCur = aLanguages[ n ];
ByteString sText;
- BOOL bText = pEntry->GetText( sText, STRING_TYP_TITLE, sCur, TRUE );
+ BOOL bText = pEntry->GetTransex3Text( sText, STRING_TYP_TITLE, sCur, TRUE );
if ( bText && sText.Len() && sText != "-" ) {
ByteString sOutput;
if ( bNextMustBeDefineEOL) {
@@ -2343,9 +2343,9 @@ void Export::MergeRest( ResData *pResData, USHORT nMode )
//printf("Lang %s, List Index %d\n",sCur.GetBuffer(),(int)nLIndex);
ByteString sText;
BOOL bText;
- bText = pEntrys->GetText( sText, STRING_TYP_TEXT, sCur, TRUE );
+ bText = pEntrys->GetTransex3Text( sText, STRING_TYP_TEXT, sCur, TRUE );
if( !bText )
- bText = pEntrys->GetText( sText , STRING_TYP_TEXT, SOURCE_LANGUAGE , FALSE );
+ bText = pEntrys->GetTransex3Text( sText , STRING_TYP_TEXT, SOURCE_LANGUAGE , FALSE );
// Use fallback, if data is missing in sdf file
//if( !bText && pResData->sResTyp.Equals( "pairedlist" ) ){
diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx
index e270a525393d..94139f89de1e 100644
--- a/l10ntools/source/help/HelpLinker.cxx
+++ b/l10ntools/source/help/HelpLinker.cxx
@@ -1104,7 +1104,7 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp
args.push_back(std::string( argv[i]) );
for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp )
- delete argv[iXhp + 3];
+ delete[] argv[iXhp + 3];
delete[] argv;
rtl::OString aOExtensionLanguageRoot = rtl::OUStringToOString( aExtensionLanguageRoot, fs::getThreadTextEncoding() );
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index b869098faed7..1d1428ff2dc0 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -66,6 +66,7 @@ const char *ExeTable[][5] = {
{ "xcs", "cfgex", "-UTF8 -e -f", "negative", "iso" },
{ "xrm", "xrmex", "-UTF8 -e", "negative", "iso" },
{ "xhp", "helpex", " -e", "negative", "noiso" },
+ //{ "properties", "jpropex", " -e", "negative", "noiso" },
{ "NULL", "NULL", "NULL", "NULL", "NULL" }
};
@@ -959,8 +960,16 @@ int _cdecl main( int argc, char *argv[] )
aIter.SetLanguageRestriction( sLanguages );
if ( bExport ){
if( bQuiet2 ){ /*printf("");*/fflush( stdout );}
- aIter.Extract( sFileName );
- if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());}
+ if( *iter == "ooo" )
+ aIter.Extract( sFileName );
+ else
+ {
+ ByteString sFileNameWithExt( sFileName );
+ sFileNameWithExt += ByteString( "." );
+ sFileNameWithExt += ByteString( (*iter).c_str() );
+ aIter.Extract( sFileNameWithExt );
+ }
+ if( bQuiet2 ){ printf("\n%d files found!\n",aIter.GetFileCnt());}
}
}
if( hasPwd )
@@ -973,7 +982,7 @@ int _cdecl main( int argc, char *argv[] )
if ( bExport ){
if( bQuiet2 ){ /*printf("");*/fflush( stdout );}
aIter.Extract( sFileName );
- if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());}
+ if( bQuiet2 ){ printf("\n%d files found!\n",aIter.GetFileCnt());}
}
}
diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx
index 3284b7026107..e15a5c8a28fa 100644
--- a/l10ntools/source/merge.cxx
+++ b/l10ntools/source/merge.cxx
@@ -50,6 +50,22 @@ ByteString PFormEntrys::Dump(){
return sRet;
}
+BOOL PFormEntrys::GetTransex3Text( ByteString &rReturn,
+ USHORT nTyp, const ByteString &nLangIndex, BOOL bDel )
+{
+ BOOL rc = GetText( rReturn , nTyp , nLangIndex , bDel );
+ ByteString test( rReturn );
+ for( USHORT idx = 0; idx < rReturn.Len(); idx++ )
+ {
+ if( rReturn.GetChar( idx ) == '\"' && ( idx >= 1 ) && rReturn.GetChar( idx-1 ) == '\\' )
+ {
+ rReturn.Erase( idx-1 , 1 );
+ }
+ }
+ //if( !rReturn.Equals( test ) )
+ // printf("*CHANGED******************\n%s\n%s\n",test.GetBuffer(),rReturn.GetBuffer());
+ return rc;
+}
/*****************************************************************************/
BOOL PFormEntrys::GetText( ByteString &rReturn,
USHORT nTyp, const ByteString &nLangIndex, BOOL bDel )
diff --git a/sax/inc/sax/tools/converter.hxx b/sax/inc/sax/tools/converter.hxx
index 1e783b4a4ec9..4b65c1dc83b2 100644
--- a/sax/inc/sax/tools/converter.hxx
+++ b/sax/inc/sax/tools/converter.hxx
@@ -32,6 +32,7 @@
#include <sal/types.h>
+#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/util/MeasureUnit.hpp>
diff --git a/sax/prj/build.lst b/sax/prj/build.lst
index e3f70c484610..653d77ce9e25 100644
--- a/sax/prj/build.lst
+++ b/sax/prj/build.lst
@@ -3,3 +3,4 @@ ax sax usr1 - all ax_mkout NULL
ax sax\source\expatwrap nmake - all ax_expatwrap NULL
ax sax\source\tools nmake - all ax_tools NULL
ax sax\source\fastparser nmake - all ax_fastparser ax_expatwrap ax_tools NULL
+ax sax\qa\cppunit nmake - all ax_qa_cppunit ax_tools NULL
diff --git a/sax/qa/cppunit/makefile.mk b/sax/qa/cppunit/makefile.mk
new file mode 100644
index 000000000000..e06eca25a737
--- /dev/null
+++ b/sax/qa/cppunit/makefile.mk
@@ -0,0 +1,71 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=../..
+PRJNAME=sax
+TARGET=qa_cppunit
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+DLLPRE = # no leading "lib" on .so files
+
+# --- Libs ---------------------------------------------------------
+
+SHL1OBJS= \
+ $(SLO)/test_converter.obj \
+
+
+SHL1STDLIBS= \
+ $(SAXLIB) \
+ $(SALLIB) \
+ $(CPPUNITLIB) \
+
+
+SHL1TARGET= test_converter
+SHL1RPATH = NONE
+SHL1IMPLIB= i$(SHL1TARGET)
+# SHL1DEF= $(MISC)/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+# DEF1EXPORTFILE= export.exp
+SHL1VERSIONMAP= version.map
+
+# --- All object files ---------------------------------------------
+
+SLOFILES= \
+ $(SHL1OBJS) \
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+.INCLUDE : _cppunit.mk
+
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
new file mode 100644
index 000000000000..1ea781afff95
--- /dev/null
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -0,0 +1,244 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Duration.hpp>
+
+#include "sax/tools/converter.hxx"
+
+
+using namespace ::com::sun::star;
+using sax::Converter;
+
+
+namespace {
+
+class ConverterTest
+ : public ::CppUnit::TestFixture
+{
+public:
+ virtual void setUp();
+ virtual void tearDown();
+
+ void testDuration();
+ void testDateTime();
+
+ CPPUNIT_TEST_SUITE(ConverterTest);
+ CPPUNIT_TEST(testDuration);
+ CPPUNIT_TEST(testDateTime);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+};
+
+void ConverterTest::setUp()
+{
+}
+
+void ConverterTest::tearDown()
+{
+}
+
+static bool eqDuration(util::Duration a, util::Duration b) {
+ return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days
+ && a.Hours == b.Hours && a.Minutes == b.Minutes
+ && a.Seconds == b.Seconds
+ && a.MilliSeconds == b.MilliSeconds
+ && a.Negative == b.Negative;
+}
+
+static void doTest(util::Duration const & rid, char const*const pis,
+ char const*const i_pos = 0)
+{
+ char const*const pos((i_pos) ? i_pos : pis);
+ util::Duration od;
+ ::rtl::OUString is(::rtl::OUString::createFromAscii(pis));
+ bool bSuccess = Converter::convertDuration(od, is);
+ OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dm",
+ od.Negative, od.Years, od.Months, od.Days,
+ od.Hours, od.Minutes, od.Seconds, od.MilliSeconds);
+ CPPUNIT_ASSERT(bSuccess);
+ CPPUNIT_ASSERT(eqDuration(rid, od));
+ ::rtl::OUStringBuffer buf;
+ Converter::convertDuration(buf, od);
+ OSL_TRACE(
+ ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8));
+ CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos));
+}
+
+static void doTestDurationF(char const*const pis)
+{
+ util::Duration od;
+ bool bSuccess = Converter::convertDuration(od,
+ ::rtl::OUString::createFromAscii(pis));
+ OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH",
+ od.Negative, od.Years, od.Months, od.Days,
+ od.Hours, od.Minutes, od.Seconds, od.MilliSeconds);
+ CPPUNIT_ASSERT(!bSuccess);
+}
+
+void ConverterTest::testDuration()
+{
+ OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n");
+ doTest( util::Duration(false, 1, 0, 0, 0, 0, 0, 0), "P1Y" );
+ doTest( util::Duration(false, 0, 42, 0, 0, 0, 0, 0), "P42M" );
+ doTest( util::Duration(false, 0, 0, 111, 0, 0, 0, 0), "P111D" );
+ doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190), "PT0.19S" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 90), "PT0.09S" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.009S" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999),
+ "PT9.999999999999999999999999999999S", "PT9.999S" );
+ doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" );
+ doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 10),
+ "-P7Y6M5DT4H3M2.01S" );
+ doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" );
+ doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" );
+ doTestDurationF("1Y1M"); // invalid: no ^P
+ doTestDurationF("P-1Y1M"); // invalid: - after P
+ doTestDurationF("P1M1Y"); // invalid: Y after M
+ doTestDurationF("PT1Y"); // invalid: Y after T
+ doTestDurationF("P1Y1M1M"); // invalid: M twice, no T
+ doTestDurationF("P1YT1MT1M"); // invalid: T twice
+ doTestDurationF("P1YT"); // invalid: T but no H,M,S
+ doTestDurationF("P99999999999Y"); // cannot parse so many Ys
+ doTestDurationF("PT.1S"); // invalid: no 0 preceding .
+ doTestDurationF("PT5M.134S"); // invalid: no 0 preceding .
+ doTestDurationF("PT1.S"); // invalid: no digit following .
+ OSL_TRACE("\nSAX CONVERTER TEST END\n");
+}
+
+
+static bool eqDateTime(util::DateTime a, util::DateTime b) {
+ return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day
+ && a.Hours == b.Hours && a.Minutes == b.Minutes
+ && a.Seconds == b.Seconds
+ && a.HundredthSeconds == b.HundredthSeconds;
+}
+
+static void doTest(util::DateTime const & rdt, char const*const pis,
+ char const*const i_pos = 0)
+{
+ char const*const pos((i_pos) ? i_pos : pis);
+ ::rtl::OUString is(::rtl::OUString::createFromAscii(pis));
+ util::DateTime odt;
+ bool bSuccess( Converter::convertDateTime(odt, is) );
+ OSL_TRACE("Y:%d M:%d D:%d H:%d M:%d S:%d H:%d",
+ odt.Year, odt.Month, odt.Day,
+ odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds);
+ CPPUNIT_ASSERT(bSuccess);
+ CPPUNIT_ASSERT(eqDateTime(rdt, odt));
+ ::rtl::OUStringBuffer buf;
+ Converter::convertDateTime(buf, odt, true);
+ OSL_TRACE(
+ ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8));
+ CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos));
+}
+
+static void doTestDateTimeF(char const*const pis)
+{
+ util::DateTime odt;
+ bool bSuccess = Converter::convertDateTime(odt,
+ ::rtl::OUString::createFromAscii(pis));
+ OSL_TRACE("Y:%d M:%d D:%d H:%dH M:%d S:%d H:%d",
+ odt.Year, odt.Month, odt.Day,
+ odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds);
+ CPPUNIT_ASSERT(!bSuccess);
+}
+
+void ConverterTest::testDateTime()
+{
+ OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n");
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), "0001-01-01T00:00:00" );
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
+ "0001-01-01T00:00:00Z", "0001-01-01T00:00:00" );
+// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00" );
+// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00Z" );
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
+ "0001-01-01T00:00:00-00:00", "0001-01-01T00:00:00" );
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
+ "0001-01-01T00:00:00+00:00", "0001-01-01T00:00:00" );
+ doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 2, 1, 1)*/,
+ "0001-01-02T00:00:00-12:00", "0001-01-02T00:00:00" );
+// "0001-02-01T12:00:00" );
+ doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 1, 1, 1)*/,
+ "0001-01-02T00:00:00+12:00", "0001-01-02T00:00:00" );
+// "0001-01-01T12:00:00" );
+ doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
+ "9999-12-31T23:59:59.99" );
+ doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
+ "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.99" );
+ doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
+ "9999-12-31T23:59:59.9999999999999999999999999999999999999",
+ "9999-12-31T23:59:59.99" );
+ doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
+ "9999-12-31T23:59:59.9999999999999999999999999999999999999Z",
+ "9999-12-31T23:59:59.99" );
+ doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333)
+ /*(0, 0, 0, 0, 2, 1, 333)*/,
+ "0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ );
+ doTestDateTimeF( "+0001-01-01T00:00:00" ); // invalid: ^+
+ doTestDateTimeF( "1-01-01T00:00:00" ); // invalid: < 4 Y
+ doTestDateTimeF( "0001-1-01T00:00:00" ); // invalid: < 2 M
+ doTestDateTimeF( "0001-01-1T00:00:00" ); // invalid: < 2 D
+ doTestDateTimeF( "0001-01-01T0:00:00" ); // invalid: < 2 H
+ doTestDateTimeF( "0001-01-01T00:0:00" ); // invalid: < 2 M
+ doTestDateTimeF( "0001-01-01T00:00:0" ); // invalid: < 2 S
+ doTestDateTimeF( "0001-01-01T00:00:00." ); // invalid: .$
+ doTestDateTimeF( "0001-01-01T00:00:00+1:00" ); // invalid: < 2 TZ H
+ doTestDateTimeF( "0001-01-01T00:00:00+00:1" ); // invalid: < 2 TZ M
+ doTestDateTimeF( "0001-13-01T00:00:00" ); // invalid: M > 12
+ doTestDateTimeF( "0001-01-32T00:00:00" ); // invalid: D > 31
+ doTestDateTimeF( "0001-01-01T25:00:00" ); // invalid: H > 24
+ doTestDateTimeF( "0001-01-01T00:60:00" ); // invalid: H > 59
+ doTestDateTimeF( "0001-01-01T00:00:60" ); // invalid: S > 59
+ doTestDateTimeF( "0001-01-01T24:01:00" ); // invalid: H=24, but M != 0
+ doTestDateTimeF( "0001-01-01T24:00:01" ); // invalid: H=24, but S != 0
+ doTestDateTimeF( "0001-01-01T24:00:00.1" ); // invalid: H=24, but H != 0
+ doTestDateTimeF( "0001-01-02T00:00:00+15:00" ); // invalid: TZ > +14:00
+ doTestDateTimeF( "0001-01-02T00:00:00+14:01" ); // invalid: TZ > +14:00
+ doTestDateTimeF( "0001-01-02T00:00:00-15:00" ); // invalid: TZ < -14:00
+ doTestDateTimeF( "0001-01-02T00:00:00-14:01" ); // invalid: TZ < -14:00
+ OSL_TRACE("\nSAX CONVERTER TEST END\n");
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
diff --git a/sax/qa/cppunit/version.map b/sax/qa/cppunit/version.map
new file mode 100644
index 000000000000..3308588ef6f8
--- /dev/null
+++ b/sax/qa/cppunit/version.map
@@ -0,0 +1,34 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+UDK_3_0_0 {
+ global:
+ cppunitTestPlugIn;
+
+ local:
+ *;
+};
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 35bfba29c904..5df3044bd6d3 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -1217,78 +1217,6 @@ bool Converter::convertDuration(util::Duration& rDuration,
return bSuccess;
}
-#if 0
-//FIXME
-struct Test {
- static bool eqDuration(util::Duration a, util::Duration b) {
- return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days
- && a.Hours == b.Hours && a.Minutes == b.Minutes
- && a.Seconds == b.Seconds
- && a.MilliSeconds == b.MilliSeconds
- && a.Negative == b.Negative;
- }
- static void doTest(util::Duration const & rid, char const*const pis,
- char const*const i_pos = 0)
- {
- char const*const pos((i_pos) ? i_pos : pis);
- util::Duration od;
- ::rtl::OUString is(::rtl::OUString::createFromAscii(pis));
- bool bSuccess = Converter::convertDuration(od, is);
- OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dm",
- od.Negative, od.Years, od.Months, od.Days,
- od.Hours, od.Minutes, od.Seconds, od.MilliSeconds);
- OSL_ASSERT(bSuccess);
- OSL_ASSERT(eqDuration(rid, od));
- ::rtl::OUStringBuffer buf;
- Converter::convertDuration(buf, od);
- OSL_TRACE(
- ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8));
- OSL_ASSERT(buf.makeStringAndClear().equalsAscii(pos));
- }
- static void doTestF(const char * pis)
- {
- util::Duration od;
- bool bSuccess = Converter::convertDuration(od,
- ::rtl::OUString::createFromAscii(pis));
- OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH",
- od.Negative, od.Years, od.Months, od.Days,
- od.Hours, od.Minutes, od.Seconds, od.MilliSeconds);
- OSL_ASSERT(!bSuccess);
- }
- Test() {
- OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n");
- doTest( util::Duration(false, 1, 0, 0, 0, 0, 0, 0), "P1Y" );
- doTest( util::Duration(false, 0, 42, 0, 0, 0, 0, 0), "P42M" );
- doTest( util::Duration(false, 0, 0, 111, 0, 0, 0, 0), "P111D" );
- doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" );
- doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" );
- doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" );
- doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190), "PT0.19S" );
- doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 90), "PT0.09S" );
- doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.009S" );
- doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999),
- "PT9.999999999999999999999999999999S", "PT9.999S" );
- doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" );
- doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 10),
- "-P7Y6M5DT4H3M2.01S" );
- doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" );
- doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" );
- doTestF("1Y1M"); // invalid: no ^P
- doTestF("P-1Y1M"); // invalid: - after P
- doTestF("P1M1Y"); // invalid: Y after M
- doTestF("PT1Y"); // invalid: Y after T
- doTestF("P1Y1M1M"); // invalid: M twice, no T
- doTestF("P1YT1MT1M"); // invalid: T twice
- doTestF("P1YT"); // invalid: T but no H,M,S
- doTestF("P99999999999Y"); // cannot parse so many Ys
- doTestF("PT.1S"); // invalid: no 0 preceding .
- doTestF("PT5M.134S"); // invalid: no 0 preceding .
- doTestF("PT1.S"); // invalid: no digit following .
- OSL_TRACE("\nSAX CONVERTER TEST END\n");
- }
-};
-static Test test;
-#endif
/** convert util::Date to ISO "date" string */
void Converter::convertDate(
@@ -1675,99 +1603,6 @@ bool Converter::convertDateOrDateTime(
return bSuccess;
}
-#if 0
-struct Test {
- static bool eqDateTime(util::DateTime a, util::DateTime b) {
- return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day
- && a.Hours == b.Hours && a.Minutes == b.Minutes
- && a.Seconds == b.Seconds
- && a.HundredthSeconds == b.HundredthSeconds;
- }
- static void doTest(util::DateTime const & rdt, char const*const pis,
- char const*const i_pos = 0)
- {
- char const*const pos((i_pos) ? i_pos : pis);
- ::rtl::OUString is(::rtl::OUString::createFromAscii(pis));
- util::DateTime odt;
- bool bSuccess( Converter::convertDateTime(odt, is) );
- OSL_TRACE("Y:%d M:%d D:%d H:%d M:%d S:%d H:%d",
- odt.Year, odt.Month, odt.Day,
- odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds);
- OSL_ASSERT(bSuccess);
- OSL_ASSERT(eqDateTime(rdt, odt));
- ::rtl::OUStringBuffer buf;
- Converter::convertDateTime(buf, odt, true);
- OSL_TRACE(
- ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8));
- OSL_ASSERT(buf.makeStringAndClear().equalsAscii(pos));
- }
- static void doTestF(const char * pis)
- {
- util::DateTime odt;
- bool bSuccess = Converter::convertDateTime(odt,
- ::rtl::OUString::createFromAscii(pis));
- OSL_TRACE("Y:%d M:%d D:%d H:%dH M:%d S:%d H:%d",
- odt.Year, odt.Month, odt.Day,
- odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds);
- OSL_ASSERT(!bSuccess);
- }
- Test() {
- OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n");
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), "0001-01-01T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
- "0001-01-01T00:00:00Z", "0001-01-01T00:00:00" );
-// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00" );
-// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00Z" );
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
- "0001-01-01T00:00:00-00:00", "0001-01-01T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
- "0001-01-01T00:00:00+00:00", "0001-01-01T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 2, 1, 1)*/,
- "0001-01-02T00:00:00-12:00", "0001-01-02T00:00:00" );
-// "0001-02-01T12:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 1, 1, 1)*/,
- "0001-01-02T00:00:00+12:00", "0001-01-02T00:00:00" );
-// "0001-01-01T12:00:00" );
- doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
- "9999-12-31T23:59:59.99" );
- doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
- "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.99" );
- doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
- "9999-12-31T23:59:59.9999999999999999999999999999999999999",
- "9999-12-31T23:59:59.99" );
- doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
- "9999-12-31T23:59:59.9999999999999999999999999999999999999Z",
- "9999-12-31T23:59:59.99" );
- doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333)
- /*(0, 0, 0, 0, 2, 1, 333)*/,
- "0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ );
- doTestF( "+0001-01-01T00:00:00" ); // invalid: ^+
- doTestF( "1-01-01T00:00:00" ); // invalid: < 4 Y
- doTestF( "0001-1-01T00:00:00" ); // invalid: < 2 M
- doTestF( "0001-01-1T00:00:00" ); // invalid: < 2 D
- doTestF( "0001-01-01T0:00:00" ); // invalid: < 2 H
- doTestF( "0001-01-01T00:0:00" ); // invalid: < 2 M
- doTestF( "0001-01-01T00:00:0" ); // invalid: < 2 S
- doTestF( "0001-01-01T00:00:00." ); // invalid: .$
- doTestF( "0001-01-01T00:00:00+1:00" ); // invalid: < 2 TZ H
- doTestF( "0001-01-01T00:00:00+00:1" ); // invalid: < 2 TZ M
- doTestF( "0001-13-01T00:00:00" ); // invalid: M > 12
- doTestF( "0001-01-32T00:00:00" ); // invalid: D > 31
- doTestF( "0001-01-01T25:00:00" ); // invalid: H > 24
- doTestF( "0001-01-01T00:60:00" ); // invalid: H > 59
- doTestF( "0001-01-01T00:00:60" ); // invalid: S > 59
- doTestF( "0001-01-01T24:01:00" ); // invalid: H=24, but M != 0
- doTestF( "0001-01-01T24:00:01" ); // invalid: H=24, but S != 0
- doTestF( "0001-01-01T24:00:00.1" ); // invalid: H=24, but H != 0
- doTestF( "0001-01-02T00:00:00+15:00" ); // invalid: TZ > +14:00
- doTestF( "0001-01-02T00:00:00+14:01" ); // invalid: TZ > +14:00
- doTestF( "0001-01-02T00:00:00-15:00" ); // invalid: TZ < -14:00
- doTestF( "0001-01-02T00:00:00-14:01" ); // invalid: TZ < -14:00
- OSL_TRACE("\nSAX CONVERTER TEST END\n");
- }
-};
-static Test test;
-#endif
/** gets the position of the first comma after npos in the string
rStr. Commas inside '"' pairs are not matched */
diff --git a/svl/inc/svl/solar.hrc b/svl/inc/svl/solar.hrc
index b559766b982b..6d13d46ec759 100644
--- a/svl/inc/svl/solar.hrc
+++ b/svl/inc/svl/solar.hrc
@@ -99,8 +99,8 @@
#define RID_GOODIES_START (RID_LIB_START+7400)
#define RID_GOODIES_END (RID_LIB_START+7449)
-#define RID_CHANNEL_START (RID_LIB_START+7450)
-#define RID_CHANNEL_END (RID_LIB_START+7899)
+#define RID_SVL_START (RID_LIB_START+7450)
+#define RID_SVL_END (RID_LIB_START+7899)
#define RID_CHAOS_START (RID_LIB_START+7900)
#define RID_CHAOS_END (RID_LIB_START+7999)
diff --git a/svl/inc/svl/svl.hrc b/svl/inc/svl/svl.hrc
new file mode 100644
index 000000000000..d63e84f2b91f
--- /dev/null
+++ b/svl/inc/svl/svl.hrc
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: svtools.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 _SVL_HRC
+#define _SVL_HRC
+
+#include <svl/solar.hrc>
+
+#define STR_SVT_MIMETYPE_START (RID_SVL_START)
+#define STR_SVT_MIMETYPE_APP_OCTSTREAM (STR_SVT_MIMETYPE_START+0)
+#define STR_SVT_MIMETYPE_APP_PDF (STR_SVT_MIMETYPE_START+1)
+#define STR_SVT_MIMETYPE_APP_RTF (STR_SVT_MIMETYPE_START+2)
+#define STR_SVT_MIMETYPE_APP_MSWORD (STR_SVT_MIMETYPE_START+3)
+#define STR_SVT_MIMETYPE_APP_STARCALC (STR_SVT_MIMETYPE_START+4)
+#define STR_SVT_MIMETYPE_APP_STARCHART (STR_SVT_MIMETYPE_START+5)
+#define STR_SVT_MIMETYPE_APP_STARDRAW (STR_SVT_MIMETYPE_START+6)
+#define STR_SVT_MIMETYPE_APP_STARIMAGE (STR_SVT_MIMETYPE_START+7)
+#define STR_SVT_MIMETYPE_APP_STARMATH (STR_SVT_MIMETYPE_START+8)
+#define STR_SVT_MIMETYPE_APP_STARWRITER (STR_SVT_MIMETYPE_START+9)
+#define STR_SVT_MIMETYPE_APP_ZIP (STR_SVT_MIMETYPE_START+10)
+#define STR_SVT_MIMETYPE_AUDIO_AIFF (STR_SVT_MIMETYPE_START+11)
+#define STR_SVT_MIMETYPE_AUDIO_BASIC (STR_SVT_MIMETYPE_START+12)
+#define STR_SVT_MIMETYPE_AUDIO_MIDI (STR_SVT_MIMETYPE_START+13)
+#define STR_SVT_MIMETYPE_AUDIO_WAV (STR_SVT_MIMETYPE_START+14)
+#define STR_SVT_MIMETYPE_IMAGE_GIF (STR_SVT_MIMETYPE_START+15)
+#define STR_SVT_MIMETYPE_IMAGE_JPEG (STR_SVT_MIMETYPE_START+16)
+#define STR_SVT_MIMETYPE_IMAGE_PCX (STR_SVT_MIMETYPE_START+17)
+#define STR_SVT_MIMETYPE_IMAGE_BMP (STR_SVT_MIMETYPE_START+18)
+#define STR_SVT_MIMETYPE_TEXT_HTML (STR_SVT_MIMETYPE_START+19)
+#define STR_SVT_MIMETYPE_TEXT_PLAIN (STR_SVT_MIMETYPE_START+20)
+#define STR_SVT_MIMETYPE_TEXT_URL (STR_SVT_MIMETYPE_START+21)
+#define STR_SVT_MIMETYPE_TEXT_VCARD (STR_SVT_MIMETYPE_START+22)
+#define STR_SVT_MIMETYPE_VIDEO_VDO (STR_SVT_MIMETYPE_START+23)
+#define STR_SVT_MIMETYPE_VIDEO_MSVIDEO (STR_SVT_MIMETYPE_START+24)
+#define STR_SVT_MIMETYPE_X_STARMAIL (STR_SVT_MIMETYPE_START+25)
+#define STR_SVT_MIMETYPE_X_VRML (STR_SVT_MIMETYPE_START+26)
+#define STR_SVT_MIMETYPE_APP_STARHELP (STR_SVT_MIMETYPE_START+27)
+#define STR_SVT_MIMETYPE_APP_STARIMPRESS (STR_SVT_MIMETYPE_START+28)
+#define STR_SVT_MIMETYPE_APP_SCHED_CMB (STR_SVT_MIMETYPE_START+29)
+#define STR_SVT_MIMETYPE_APP_SCHED_EVT (STR_SVT_MIMETYPE_START+30)
+#define STR_SVT_MIMETYPE_APP_SCHED_TASK (STR_SVT_MIMETYPE_START+31)
+#define STR_SVT_MIMETYPE_APP_SCHED_TVIEW (STR_SVT_MIMETYPE_START+32)
+
+#define STR_SVT_MIMETYPE_CNT_MSG (STR_SVT_MIMETYPE_START+33)
+#define STR_SVT_MIMETYPE_CNT_DOCUMENT (STR_SVT_MIMETYPE_START+34)
+#define STR_SVT_MIMETYPE_CNT_POP3BOX (STR_SVT_MIMETYPE_START+35)
+#define STR_SVT_MIMETYPE_CNT_IMAPBOX (STR_SVT_MIMETYPE_START+36)
+#define STR_SVT_MIMETYPE_CNT_IMAPFLD (STR_SVT_MIMETYPE_START+37)
+#define STR_SVT_MIMETYPE_CNT_VIMBOX (STR_SVT_MIMETYPE_START+38)
+#define STR_SVT_MIMETYPE_CNT_VIMINBOX (STR_SVT_MIMETYPE_START+39)
+#define STR_SVT_MIMETYPE_CNT_BBBOX (STR_SVT_MIMETYPE_START+40)
+#define STR_SVT_MIMETYPE_CNT_VIM_BB (STR_SVT_MIMETYPE_START+41)
+#define STR_SVT_MIMETYPE_CNT_NEWSBOX (STR_SVT_MIMETYPE_START+42)
+#define STR_SVT_MIMETYPE_CNT_NEWSGRP (STR_SVT_MIMETYPE_START+43)
+#define STR_SVT_MIMETYPE_CNT_OUTBOX (STR_SVT_MIMETYPE_START+44)
+#define STR_SVT_MIMETYPE_CNT_FTPBOX (STR_SVT_MIMETYPE_START+45)
+#define STR_SVT_MIMETYPE_CNT_FTPFLD (STR_SVT_MIMETYPE_START+46)
+#define STR_SVT_MIMETYPE_CNT_FTPFILE (STR_SVT_MIMETYPE_START+47)
+#define STR_SVT_MIMETYPE_CNT_FTPLINK (STR_SVT_MIMETYPE_START+48)
+#define STR_SVT_MIMETYPE_CNT_HTTPBOX (STR_SVT_MIMETYPE_START+49)
+#define STR_SVT_MIMETYPE_CNT_FSYSBOX (STR_SVT_MIMETYPE_START+50)
+#define STR_SVT_MIMETYPE_CNT_FSYSFLD (STR_SVT_MIMETYPE_START+51)
+#define STR_SVT_MIMETYPE_CNT_FSYSFILE (STR_SVT_MIMETYPE_START+52)
+#define STR_SVT_MIMETYPE_CNT_FSYSURLFILE (STR_SVT_MIMETYPE_START+53)
+#define STR_SVT_MIMETYPE_CNT_PUBLBOX (STR_SVT_MIMETYPE_START+54)
+#define STR_SVT_MIMETYPE_CNT_SRCHBOX (STR_SVT_MIMETYPE_START+55)
+#define STR_SVT_MIMETYPE_CNT_SUBSCRBOX (STR_SVT_MIMETYPE_START+56)
+#define STR_SVT_MIMETYPE_CNT_BOOKMARK (STR_SVT_MIMETYPE_START+57)
+#define STR_SVT_MIMETYPE_CNT_CDF (STR_SVT_MIMETYPE_START+58)
+#define STR_SVT_MIMETYPE_CNT_CDFSUB (STR_SVT_MIMETYPE_START+59)
+#define STR_SVT_MIMETYPE_CNT_CDFITEM (STR_SVT_MIMETYPE_START+60)
+#define STR_SVT_MIMETYPE_CNT_STARCHANNEL (STR_SVT_MIMETYPE_START+61)
+#define STR_SVT_MIMETYPE_CNT_TRASHBOX (STR_SVT_MIMETYPE_START+62)
+#define STR_SVT_MIMETYPE_CNT_TRASH (STR_SVT_MIMETYPE_START+63)
+#define STR_SVT_MIMETYPE_CNT_REMOV_VOL (STR_SVT_MIMETYPE_START+64)
+#define STR_SVT_MIMETYPE_CNT_FIX_VOL (STR_SVT_MIMETYPE_START+65)
+#define STR_SVT_MIMETYPE_CNT_REM_VOL (STR_SVT_MIMETYPE_START+66)
+#define STR_SVT_MIMETYPE_CNT_RAM_VOL (STR_SVT_MIMETYPE_START+67)
+#define STR_SVT_MIMETYPE_CNT_CDROM (STR_SVT_MIMETYPE_START+68)
+#define STR_SVT_MIMETYPE_CNT_DISK_35 (STR_SVT_MIMETYPE_START+69)
+#define STR_SVT_MIMETYPE_CNT_DISK_525 (STR_SVT_MIMETYPE_START+70)
+#define STR_SVT_MIMETYPE_CNT_TAPEDRIVE (STR_SVT_MIMETYPE_START+71)
+#define STR_SVT_MIMETYPE_APP_GAL (STR_SVT_MIMETYPE_START+72)
+#define STR_SVT_MIMETYPE_APP_GAL_THEME (STR_SVT_MIMETYPE_START+73)
+#define STR_SVT_MIMETYPE_CNT_SEPARATOR (STR_SVT_MIMETYPE_START+74)
+#define STR_SVT_MIMETYPE_APP_STARW_GLOB (STR_SVT_MIMETYPE_START+75)
+#define STR_SVT_MIMETYPE_APP_SDM (STR_SVT_MIMETYPE_START+76)
+#define STR_SVT_MIMETYPE_APP_SMD (STR_SVT_MIMETYPE_START+77)
+#define STR_SVT_MIMETYPE_APP_STARW_WEB (STR_SVT_MIMETYPE_START+78)
+#define STR_SVT_MIMETYPE_SCHEDULE (STR_SVT_MIMETYPE_START+79)
+#define STR_SVT_MIMETYPE_SCHEDULE_EVT (STR_SVT_MIMETYPE_START+80)
+#define STR_SVT_MIMETYPE_SCHEDULE_TASK (STR_SVT_MIMETYPE_START+81)
+#define STR_SVT_MIMETYPE_SCHEDULE_FEVT (STR_SVT_MIMETYPE_START+82)
+#define STR_SVT_MIMETYPE_SCHEDULE_FTASK (STR_SVT_MIMETYPE_START+83)
+#define STR_SVT_MIMETYPE_FRAMESET (STR_SVT_MIMETYPE_START+84)
+#define STR_SVT_MIMETYPE_MACRO (STR_SVT_MIMETYPE_START+85)
+#define STR_SVT_MIMETYPE_CNT_SFSYSFOLDER (STR_SVT_MIMETYPE_START+86)
+#define STR_SVT_MIMETYPE_CNT_SFSYSFILE (STR_SVT_MIMETYPE_START+87)
+#define STR_SVT_MIMETYPE_APP_TEMPLATE (STR_SVT_MIMETYPE_START+88)
+#define STR_SVT_MIMETYPE_IMAGE_GENERIC (STR_SVT_MIMETYPE_START+89)
+#define STR_SVT_MIMETYPE_APP_MSEXCEL (STR_SVT_MIMETYPE_START+90)
+#define STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL (STR_SVT_MIMETYPE_START+91)
+#define STR_SVT_MIMETYPE_APP_MSPPOINT (STR_SVT_MIMETYPE_START+92)
+#define STR_SVT_MIMETYPE_TEXT_VCALENDAR (STR_SVT_MIMETYPE_START+93)
+#define STR_SVT_MIMETYPE_TEXT_ICALENDAR (STR_SVT_MIMETYPE_START+94)
+#define STR_SVT_MIMETYPE_TEXT_XMLICALENDAR (STR_SVT_MIMETYPE_START+95)
+#define STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP (STR_SVT_MIMETYPE_START+96)
+#define STR_SVT_MIMETYPE_INET_MSG_RFC822 (STR_SVT_MIMETYPE_START+97)
+#define STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE (STR_SVT_MIMETYPE_START+98)
+#define STR_SVT_MIMETYPE_INET_MULTI_DIGEST (STR_SVT_MIMETYPE_START+99)
+#define STR_SVT_MIMETYPE_INET_MULTI_PARALLEL (STR_SVT_MIMETYPE_START+100)
+#define STR_SVT_MIMETYPE_INET_MULTI_RELATED (STR_SVT_MIMETYPE_START+101)
+#define STR_SVT_MIMETYPE_INET_MULTI_MIXED (STR_SVT_MIMETYPE_START+102)
+#define STR_SVT_MIMETYPE_APP_IMPRESSPACKED (STR_SVT_MIMETYPE_START+103)
+#define STR_SVT_MIMETYPE_APP_JAR (STR_SVT_MIMETYPE_START+104)
+#define STR_SVT_MIMETYPE_IMAGE_PNG (STR_SVT_MIMETYPE_START+105)
+#define STR_SVT_MIMETYPE_IMAGE_TIFF (STR_SVT_MIMETYPE_START+106)
+
+#define STR_SVT_MIMETYPE_APP_SXCALC (STR_SVT_MIMETYPE_START+107)
+#define STR_SVT_MIMETYPE_APP_SXCHART (STR_SVT_MIMETYPE_START+108)
+#define STR_SVT_MIMETYPE_APP_SXDRAW (STR_SVT_MIMETYPE_START+109)
+#define STR_SVT_MIMETYPE_APP_SXMATH (STR_SVT_MIMETYPE_START+110)
+#define STR_SVT_MIMETYPE_APP_SXWRITER (STR_SVT_MIMETYPE_START+111)
+#define STR_SVT_MIMETYPE_APP_SXIMPRESS (STR_SVT_MIMETYPE_START+112)
+#define STR_SVT_MIMETYPE_APP_SXGLOBAL (STR_SVT_MIMETYPE_START+113)
+#define STR_SVT_MIMETYPE_APP_SXIPACKED (STR_SVT_MIMETYPE_START+114)
+#define STR_SVT_MIMETYPE_END (STR_SVT_MIMETYPE_APP_SXIPACKED)
+
+#define STR_COLUM_DT_AUTO (STR_SVT_MIMETYPE_END+1)
+
+#endif // #ifndef _SVTOOLS_HRC
+
+// ******************************************************************* EOF
+
diff --git a/svl/source/items/cstitem.src b/svl/source/items/cstitem.src
index b3511ffb302b..009fcb19e3c6 100644
--- a/svl/source/items/cstitem.src
+++ b/svl/source/items/cstitem.src
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svl/svl.hrc>
String STR_COLUM_DT_AUTO
{
Text [ en-US ] = "automatic" ;
diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx
index 3c8e85c461f2..27170c1d4f6e 100644
--- a/svl/source/items/dateitem.cxx
+++ b/svl/source/items/dateitem.cxx
@@ -33,7 +33,7 @@
#define _DATETIMEITEM_CXX
#include <svl/dateitem.hxx>
#include <svl/svldata.hxx>
-#include <svl/svtools.hrc>
+#include <svl/svl.hrc>
#include <unotools/intlwrapper.hxx>
#include <comphelper/processfactory.hxx>
@@ -45,7 +45,6 @@
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/lang/Locale.hpp>
-
// STATIC DATA -----------------------------------------------------------
DBG_NAME(SfxDateTimeItem)
diff --git a/svl/source/items/nranges.cxx b/svl/source/items/nranges.cxx
index 284bc251a3a4..813c1fec8ebd 100644
--- a/svl/source/items/nranges.cxx
+++ b/svl/source/items/nranges.cxx
@@ -480,7 +480,7 @@ SfxNumRanges& SfxNumRanges::operator -=
NUMTYPE nThisSize = Count_Impl(_pRanges);
NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) );
NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ];
- memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 );
+ memset( pTarget, 0, sizeof(NUMTYPE)*nTargetSize );
memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize );
NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0;
@@ -690,7 +690,7 @@ SfxNumRanges& SfxNumRanges::operator /=
NUMTYPE nThisSize = Count_Impl(_pRanges);
NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) );
NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ];
- memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 );
+ memset( pTarget, 0, sizeof(NUMTYPE)*nTargetSize );
memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize );
NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0;
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index b7422c56224b..cc033bc6905e 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -151,40 +151,44 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) :
rFlags |= TransliterationModules_IGNORE_CASE;
if ( aOpt.IsMatchFullHalfWidthForms())
rFlags |= TransliterationModules_IGNORE_WIDTH;
- if ( aOpt.IsMatchHiraganaKatakana())
- rFlags |= TransliterationModules_IGNORE_KANA;
- if ( aOpt.IsMatchContractions())
- rFlags |= TransliterationModules_ignoreSize_ja_JP;
- if ( aOpt.IsMatchMinusDashChoon())
- rFlags |= TransliterationModules_ignoreMinusSign_ja_JP;
- if ( aOpt.IsMatchRepeatCharMarks())
- rFlags |= TransliterationModules_ignoreIterationMark_ja_JP;
- if ( aOpt.IsMatchVariantFormKanji())
- rFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP;
- if ( aOpt.IsMatchOldKanaForms())
- rFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP;
- if ( aOpt.IsMatchDiziDuzu())
- rFlags |= TransliterationModules_ignoreZiZu_ja_JP;
- if ( aOpt.IsMatchBavaHafa())
- rFlags |= TransliterationModules_ignoreBaFa_ja_JP;
- if ( aOpt.IsMatchTsithichiDhizi())
- rFlags |= TransliterationModules_ignoreTiJi_ja_JP;
- if ( aOpt.IsMatchHyuiyuByuvyu())
- rFlags |= TransliterationModules_ignoreHyuByu_ja_JP;
- if ( aOpt.IsMatchSesheZeje())
- rFlags |= TransliterationModules_ignoreSeZe_ja_JP;
- if ( aOpt.IsMatchIaiya())
- rFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP;
- if ( aOpt.IsMatchKiku())
- rFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP;
- if ( aOpt.IsIgnorePunctuation())
- rFlags |= TransliterationModules_ignoreSeparator_ja_JP;
- if ( aOpt.IsIgnoreWhitespace())
- rFlags |= TransliterationModules_ignoreSpace_ja_JP;
- if ( aOpt.IsIgnoreProlongedSoundMark())
- rFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP;
- if ( aOpt.IsIgnoreMiddleDot())
- rFlags |= TransliterationModules_ignoreMiddleDot_ja_JP;
+ if ( bAsianOptions )
+ {
+ if ( aOpt.IsMatchHiraganaKatakana())
+ rFlags |= TransliterationModules_IGNORE_KANA;
+ if ( aOpt.IsMatchContractions())
+ rFlags |= TransliterationModules_ignoreSize_ja_JP;
+ if ( aOpt.IsMatchMinusDashChoon())
+ rFlags |= TransliterationModules_ignoreMinusSign_ja_JP;
+ if ( aOpt.IsMatchRepeatCharMarks())
+ rFlags |= TransliterationModules_ignoreIterationMark_ja_JP;
+ if ( aOpt.IsMatchVariantFormKanji())
+ rFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP;
+ if ( aOpt.IsMatchOldKanaForms())
+ rFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP;
+ if ( aOpt.IsMatchDiziDuzu())
+ rFlags |= TransliterationModules_ignoreZiZu_ja_JP;
+ if ( aOpt.IsMatchBavaHafa())
+ rFlags |= TransliterationModules_ignoreBaFa_ja_JP;
+ if ( aOpt.IsMatchTsithichiDhizi())
+ rFlags |= TransliterationModules_ignoreTiJi_ja_JP;
+ if ( aOpt.IsMatchHyuiyuByuvyu())
+ rFlags |= TransliterationModules_ignoreHyuByu_ja_JP;
+ if ( aOpt.IsMatchSesheZeje())
+ rFlags |= TransliterationModules_ignoreSeZe_ja_JP;
+ if ( aOpt.IsMatchIaiya())
+ rFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP;
+ if ( aOpt.IsMatchKiku())
+ rFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP;
+ if ( aOpt.IsIgnorePunctuation())
+ rFlags |= TransliterationModules_ignoreSeparator_ja_JP;
+ if ( aOpt.IsIgnoreWhitespace())
+ rFlags |= TransliterationModules_ignoreSpace_ja_JP;
+ if ( aOpt.IsIgnoreProlongedSoundMark())
+ rFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP;
+ if ( aOpt.IsIgnoreMiddleDot())
+ rFlags |= TransliterationModules_ignoreMiddleDot_ja_JP;
+ }
+
}
// -----------------------------------------------------------------------
diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index ee9aa5932525..0b9efdf22afd 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -31,9 +31,7 @@
#include <tools/wldcrd.hxx>
#include <svl/inettype.hxx>
#include <svl/svldata.hxx>
-#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
-#endif
+#include <svl/svl.hrc>
#ifndef _SVSTDARR_STRINGSSORT_DECL
#define _SVSTDARR_STRINGSSORT
diff --git a/svl/source/misc/mediatyp.src b/svl/source/misc/mediatyp.src
index 195b2c640d67..333963c1d2d9 100644
--- a/svl/source/misc/mediatyp.src
+++ b/svl/source/misc/mediatyp.src
@@ -32,7 +32,7 @@
//============================================================================
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svl/svl.hrc>
#endif
String STR_SVT_MIMETYPE_APP_OCTSTREAM
diff --git a/svtools/inc/svtools/accessiblefactory.hxx b/svtools/inc/svtools/accessiblefactory.hxx
index b435d3da96a7..9606e93a2fa0 100644..100755
--- a/svtools/inc/svtools/accessiblefactory.hxx
+++ b/svtools/inc/svtools/accessiblefactory.hxx
@@ -61,6 +61,10 @@ namespace svt
{
//........................................................................
+ class ToolPanelDeck;
+ class IToolPanelDeck;
+ class PanelTabBar;
+
/** a function which is able to create a factory for the standard Accessible/Context
components needed for standard toolkit controls
@@ -162,6 +166,18 @@ namespace svt
sal_Int32 _nRowPos,
sal_uInt16 _nColPos
) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleToolPanelDeck(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
+ ::svt::ToolPanelDeck& i_rPanelDeck
+ ) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleToolPanelTabBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
+ ::svt::IToolPanelDeck& i_rPanelDeck,
+ ::svt::PanelTabBar& i_rTabBar
+ ) = 0;
};
//........................................................................
diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx
index 7098d2b0d4ef..198a24b8eb62 100755
--- a/svtools/inc/svtools/accessibletable.hxx
+++ b/svtools/inc/svtools/accessibletable.hxx
@@ -99,7 +99,7 @@ public:
AccessibleTableControlObjType eObjType ) const= 0;
// Window
- virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) = 0;
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0;
virtual void GrabFocus()= 0;
virtual XACC GetAccessible( BOOL bCreate = TRUE )= 0;
virtual Window* GetAccessibleParentWindow() const= 0;
diff --git a/svtools/inc/svtools/accessibletableprovider.hxx b/svtools/inc/svtools/accessibletableprovider.hxx
index fd29c72f35be..d14aecce9f58 100644
--- a/svtools/inc/svtools/accessibletableprovider.hxx
+++ b/svtools/inc/svtools/accessibletableprovider.hxx
@@ -132,7 +132,7 @@ public:
virtual BOOL GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) = 0;
// Window
- virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) = 0;
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0;
virtual void GrabFocus() = 0;
virtual XACC GetAccessible( BOOL bCreate = TRUE ) = 0;
virtual Window* GetAccessibleParentWindow() const = 0;
diff --git a/svtools/inc/svtools/brwbox.hxx b/svtools/inc/svtools/brwbox.hxx
index 9adeaf7efd05..42fb4b4d36ac 100644
--- a/svtools/inc/svtools/brwbox.hxx
+++ b/svtools/inc/svtools/brwbox.hxx
@@ -96,8 +96,6 @@ typedef ULONG BrowserMode;
#define BROWSER_HIGHLIGHT_NONE 0x0100 // == BROWSER_HIDESELECT
#define BROWSER_HIGHLIGHT_TOGGLE 0x00000000 // old default => NULL, dont use!
-#define BROWSER_HIGHLIGHT_AUTO 0x00010000
-#define BROWSER_HIGHLIGHT_MANU 0x00020000
#define BROWSER_HEADERBAR_NEW 0x00040000
#define BROWSER_AUTOSIZE_LASTCOL 0x00080000
@@ -848,7 +846,7 @@ public:
virtual sal_Bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const;
virtual String GetAccessibleCellText(long _nRow, USHORT _nColPos) const;
virtual BOOL GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector );
- virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
virtual void GrabFocus();
virtual XACC GetAccessible( BOOL bCreate = TRUE );
virtual Window* GetAccessibleParentWindow() const;
diff --git a/svtools/inc/svtools/filter.hxx b/svtools/inc/svtools/filter.hxx
index 770e81b00551..49ec77adfea5 100644
--- a/svtools/inc/svtools/filter.hxx
+++ b/svtools/inc/svtools/filter.hxx
@@ -62,6 +62,8 @@ class Graphic;
#define GRFILTER_ABORT 6
#define GRFILTER_TOOBIG 7
+#define GRFILTER_OUTHINT_GREY 1
+
#define GRFILTER_FORMAT_NOTFOUND ((USHORT)0xFFFF)
#define GRFILTER_FORMAT_DONTKNOW ((USHORT)0xFFFF)
@@ -323,7 +325,7 @@ protected:
sal_Bool bDummy2;
sal_Bool bDummy3;
sal_Bool bDummy4;
- long nDummy1;
+ long nExpGraphHint;
long nDummy2;
void* pDummy1;
void* pDummy2;
@@ -374,6 +376,7 @@ public:
USHORT ExportGraphic( const Graphic& rGraphic, const String& rPath,
SvStream& rOStm, USHORT nFormat = GRFILTER_FORMAT_DONTKNOW,
const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData = NULL );
+ long GetExportGraphicHint() const { return nExpGraphHint; }
USHORT CanImportGraphic( const INetURLObject& rPath,
USHORT nFormat = GRFILTER_FORMAT_DONTKNOW,
diff --git a/svtools/inc/svtools/popupmenucontrollerbase.hxx b/svtools/inc/svtools/popupmenucontrollerbase.hxx
new file mode 100644
index 000000000000..b062234a512e
--- /dev/null
+++ b/svtools/inc/svtools/popupmenucontrollerbase.hxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __SVTOOLS_POPUPMENUCONTROLLERBASE_HXX_
+#define __SVTOOLS_POPUPMENUCONTROLLERBASE_HXX_
+
+#include "svtools/svtdllapi.h"
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+#include <com/sun/star/uri/XUriReference.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+//_________________________________________________________________________________________________________________
+// includes of other projects
+//_________________________________________________________________________________________________________________
+#include <toolkit/awt/vclxmenu.hxx>
+#include <cppuhelper/compbase7.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <cppuhelper/weak.hxx>
+#include <rtl/ustring.hxx>
+
+namespace svt
+{
+ struct PopupMenuControllerBaseDispatchInfo;
+
+ typedef ::cppu::WeakComponentImplHelper7<
+ com::sun::star::lang::XServiceInfo ,
+ com::sun::star::frame::XPopupMenuController ,
+ com::sun::star::lang::XInitialization ,
+ com::sun::star::frame::XStatusListener ,
+ com::sun::star::awt::XMenuListener ,
+ com::sun::star::frame::XDispatchProvider ,
+ com::sun::star::frame::XDispatch > PopupMenuControllerBaseType;
+
+ class SVT_DLLPUBLIC PopupMenuControllerBase : protected ::comphelper::OBaseMutex, // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public PopupMenuControllerBaseType
+ {
+ public:
+ PopupMenuControllerBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+ virtual ~PopupMenuControllerBase();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ // XPopupMenuController
+ virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // XMenuListener
+ virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XDispatchProvider
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& sTarget, sal_Int32 nFlags ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& lDescriptor ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XDispatch
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& seqProperties ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ void dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
+
+ protected:
+ void throwIfDisposed() throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** helper method to cause statusChanged is called once for the given command url */
+ void SAL_CALL updateCommand( const rtl::OUString& rCommandURL );
+
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing();
+
+ virtual void resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
+ virtual void impl_setPopupMenu();
+ virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
+ ::rtl::OUString determineBaseURL( const ::rtl::OUString& aURL );
+
+ DECL_STATIC_LINK( PopupMenuControllerBase, ExecuteHdl_Impl, PopupMenuControllerBaseDispatchInfo* );
+
+
+ bool m_bInitialized;
+ rtl::OUString m_aCommandURL;
+ rtl::OUString m_aBaseURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xDispatch;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > m_xPopupMenu;
+ };
+}
+
+#endif // __SVTOOLS_POPUPMENUCONTROLLERBASE_HXX_
diff --git a/svtools/inc/svtools/popupwindowcontroller.hxx b/svtools/inc/svtools/popupwindowcontroller.hxx
new file mode 100644
index 000000000000..4877d0184318
--- /dev/null
+++ b/svtools/inc/svtools/popupwindowcontroller.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __SVTOOLS_POPUPWINDOWCONTROLLER_HXX_
+#define __SVTOOLS_POPUPWINDOWCONTROLLER_HXX_
+
+#include "svtools/svtdllapi.h"
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include "svtools/toolboxcontroller.hxx"
+#include "boost/scoped_ptr.hpp"
+
+class Window;
+
+namespace svt
+{
+class PopupWindowControllerImpl;
+
+class SVT_DLLPUBLIC PopupWindowController : public svt::ToolboxController, public ::com::sun::star::lang::XServiceInfo
+{
+public:
+ PopupWindowController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+ const rtl::OUString& aCommandURL );
+ ~PopupWindowController();
+
+ virtual ::Window* createPopupWindow( ::Window* pParent ) = 0;
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) = 0;
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
+private:
+ boost::scoped_ptr< PopupWindowControllerImpl > mpImpl;
+};
+
+} // namespace svt
+
+#endif // __SVTOOLS_POPUPWINDOWCONTROLLER_HXX_
diff --git a/svtools/inc/svtools/roadmapwizard.hxx b/svtools/inc/svtools/roadmapwizard.hxx
index 49a0f441c49c..5d8e0d9b01bb 100644
--- a/svtools/inc/svtools/roadmapwizard.hxx
+++ b/svtools/inc/svtools/roadmapwizard.hxx
@@ -80,6 +80,11 @@ namespace svt
const ResId& _rRes,
sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP
);
+ RoadmapWizard(
+ Window* _pParent,
+ const WinBits i_nStyle,
+ sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP
+ );
~RoadmapWizard( );
void SetRoadmapBitmap( const BitmapEx& _rBitmap );
@@ -137,7 +142,7 @@ protected:
You can only activate paths which share the first <code>k</code> states with the path
which is previously active (if any), where <code>k</code> is the index of the
- current state within the current page.
+ current state within the current path.
<example>
Say you have paths, <code>(0,1,2,5)</code> and <code>(0,1,4,5)</code>. This means that after
@@ -197,6 +202,10 @@ protected:
*/
void enableState( WizardState _nState, bool _bEnable = true );
+ /** returns true if and only if the given state is known in at least one declared path
+ */
+ bool knowsState( WizardState _nState ) const;
+
// OWizardMachine overriables
virtual void enterState( WizardState _nState );
@@ -230,13 +239,15 @@ protected:
private:
SVT_DLLPRIVATE void ResizeFixedLine();
- private:
DECL_DLLPRIVATE_LINK( OnRoadmapItemSelected, void* );
/** updates the roadmap control to show the given path, as far as possible
(modulo conflicts with other paths)
*/
SVT_DLLPRIVATE void implUpdateRoadmap( );
+
+ private:
+ SVT_DLLPRIVATE void impl_construct();
};
//........................................................................
diff --git a/svtools/inc/svtools/svtabbx.hxx b/svtools/inc/svtools/svtabbx.hxx
index 8b8092260e33..89fd92a4fc09 100644
--- a/svtools/inc/svtools/svtabbx.hxx
+++ b/svtools/inc/svtools/svtabbx.hxx
@@ -251,7 +251,7 @@ public:
virtual BOOL GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector );
// Window
- virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
virtual void GrabFocus();
virtual XACC GetAccessible( BOOL bCreate = TRUE );
virtual Window* GetAccessibleParentWindow() const;
diff --git a/svl/inc/svl/svtools.hrc b/svtools/inc/svtools/svtools.hrc
index 738bee6cbf21..a57a0f5bb0fe 100644
--- a/svl/inc/svl/svtools.hrc
+++ b/svtools/inc/svtools/svtools.hrc
@@ -2,10 +2,13 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
+ * $RCSfile: svtools.hrc,v $
+ * $Revision: 1.7 $
+ *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -87,7 +90,6 @@
#define STR_SVT_SAMPLES_HELP (RID_SVTOOLS_START+66)
#define STR_WARNING_ITEM (RID_SVTOOLS_START+90)
-#define STR_COLUM_DT_AUTO (RID_SVTOOLS_START+99)
#define CONFIG_BASIC_FORMAT_START (RID_SVTOOLS_START+102)
#define STR_BASICKEY_FORMAT_ON (RID_SVTOOLS_START+103)
@@ -119,127 +121,7 @@
#define STR_KEYERR_INVALID_CNR (RID_SVTOOLS_START+139)
#define RID_LIMITED_DIALOG (RID_SVTOOLS_START+140)
-#define STR_SVT_MIMETYPE_START (RID_SVTOOLS_START+141)
-#define STR_SVT_MIMETYPE_APP_OCTSTREAM (STR_SVT_MIMETYPE_START+0)
-#define STR_SVT_MIMETYPE_APP_PDF (STR_SVT_MIMETYPE_START+1)
-#define STR_SVT_MIMETYPE_APP_RTF (STR_SVT_MIMETYPE_START+2)
-#define STR_SVT_MIMETYPE_APP_MSWORD (STR_SVT_MIMETYPE_START+3)
-#define STR_SVT_MIMETYPE_APP_STARCALC (STR_SVT_MIMETYPE_START+4)
-#define STR_SVT_MIMETYPE_APP_STARCHART (STR_SVT_MIMETYPE_START+5)
-#define STR_SVT_MIMETYPE_APP_STARDRAW (STR_SVT_MIMETYPE_START+6)
-#define STR_SVT_MIMETYPE_APP_STARIMAGE (STR_SVT_MIMETYPE_START+7)
-#define STR_SVT_MIMETYPE_APP_STARMATH (STR_SVT_MIMETYPE_START+8)
-#define STR_SVT_MIMETYPE_APP_STARWRITER (STR_SVT_MIMETYPE_START+9)
-#define STR_SVT_MIMETYPE_APP_ZIP (STR_SVT_MIMETYPE_START+10)
-#define STR_SVT_MIMETYPE_AUDIO_AIFF (STR_SVT_MIMETYPE_START+11)
-#define STR_SVT_MIMETYPE_AUDIO_BASIC (STR_SVT_MIMETYPE_START+12)
-#define STR_SVT_MIMETYPE_AUDIO_MIDI (STR_SVT_MIMETYPE_START+13)
-#define STR_SVT_MIMETYPE_AUDIO_WAV (STR_SVT_MIMETYPE_START+14)
-#define STR_SVT_MIMETYPE_IMAGE_GIF (STR_SVT_MIMETYPE_START+15)
-#define STR_SVT_MIMETYPE_IMAGE_JPEG (STR_SVT_MIMETYPE_START+16)
-#define STR_SVT_MIMETYPE_IMAGE_PCX (STR_SVT_MIMETYPE_START+17)
-#define STR_SVT_MIMETYPE_IMAGE_BMP (STR_SVT_MIMETYPE_START+18)
-#define STR_SVT_MIMETYPE_TEXT_HTML (STR_SVT_MIMETYPE_START+19)
-#define STR_SVT_MIMETYPE_TEXT_PLAIN (STR_SVT_MIMETYPE_START+20)
-#define STR_SVT_MIMETYPE_TEXT_URL (STR_SVT_MIMETYPE_START+21)
-#define STR_SVT_MIMETYPE_TEXT_VCARD (STR_SVT_MIMETYPE_START+22)
-#define STR_SVT_MIMETYPE_VIDEO_VDO (STR_SVT_MIMETYPE_START+23)
-#define STR_SVT_MIMETYPE_VIDEO_MSVIDEO (STR_SVT_MIMETYPE_START+24)
-#define STR_SVT_MIMETYPE_X_STARMAIL (STR_SVT_MIMETYPE_START+25)
-#define STR_SVT_MIMETYPE_X_VRML (STR_SVT_MIMETYPE_START+26)
-#define STR_SVT_MIMETYPE_APP_STARHELP (STR_SVT_MIMETYPE_START+27)
-#define STR_SVT_MIMETYPE_APP_STARIMPRESS (STR_SVT_MIMETYPE_START+28)
-#define STR_SVT_MIMETYPE_APP_SCHED_CMB (STR_SVT_MIMETYPE_START+29)
-#define STR_SVT_MIMETYPE_APP_SCHED_EVT (STR_SVT_MIMETYPE_START+30)
-#define STR_SVT_MIMETYPE_APP_SCHED_TASK (STR_SVT_MIMETYPE_START+31)
-#define STR_SVT_MIMETYPE_APP_SCHED_TVIEW (STR_SVT_MIMETYPE_START+32)
-
-#define STR_SVT_MIMETYPE_CNT_MSG (STR_SVT_MIMETYPE_START+33)
-#define STR_SVT_MIMETYPE_CNT_DOCUMENT (STR_SVT_MIMETYPE_START+34)
-#define STR_SVT_MIMETYPE_CNT_POP3BOX (STR_SVT_MIMETYPE_START+35)
-#define STR_SVT_MIMETYPE_CNT_IMAPBOX (STR_SVT_MIMETYPE_START+36)
-#define STR_SVT_MIMETYPE_CNT_IMAPFLD (STR_SVT_MIMETYPE_START+37)
-#define STR_SVT_MIMETYPE_CNT_VIMBOX (STR_SVT_MIMETYPE_START+38)
-#define STR_SVT_MIMETYPE_CNT_VIMINBOX (STR_SVT_MIMETYPE_START+39)
-#define STR_SVT_MIMETYPE_CNT_BBBOX (STR_SVT_MIMETYPE_START+40)
-#define STR_SVT_MIMETYPE_CNT_VIM_BB (STR_SVT_MIMETYPE_START+41)
-#define STR_SVT_MIMETYPE_CNT_NEWSBOX (STR_SVT_MIMETYPE_START+42)
-#define STR_SVT_MIMETYPE_CNT_NEWSGRP (STR_SVT_MIMETYPE_START+43)
-#define STR_SVT_MIMETYPE_CNT_OUTBOX (STR_SVT_MIMETYPE_START+44)
-#define STR_SVT_MIMETYPE_CNT_FTPBOX (STR_SVT_MIMETYPE_START+45)
-#define STR_SVT_MIMETYPE_CNT_FTPFLD (STR_SVT_MIMETYPE_START+46)
-#define STR_SVT_MIMETYPE_CNT_FTPFILE (STR_SVT_MIMETYPE_START+47)
-#define STR_SVT_MIMETYPE_CNT_FTPLINK (STR_SVT_MIMETYPE_START+48)
-#define STR_SVT_MIMETYPE_CNT_HTTPBOX (STR_SVT_MIMETYPE_START+49)
-#define STR_SVT_MIMETYPE_CNT_FSYSBOX (STR_SVT_MIMETYPE_START+50)
-#define STR_SVT_MIMETYPE_CNT_FSYSFLD (STR_SVT_MIMETYPE_START+51)
-#define STR_SVT_MIMETYPE_CNT_FSYSFILE (STR_SVT_MIMETYPE_START+52)
-#define STR_SVT_MIMETYPE_CNT_FSYSURLFILE (STR_SVT_MIMETYPE_START+53)
-#define STR_SVT_MIMETYPE_CNT_PUBLBOX (STR_SVT_MIMETYPE_START+54)
-#define STR_SVT_MIMETYPE_CNT_SRCHBOX (STR_SVT_MIMETYPE_START+55)
-#define STR_SVT_MIMETYPE_CNT_SUBSCRBOX (STR_SVT_MIMETYPE_START+56)
-#define STR_SVT_MIMETYPE_CNT_BOOKMARK (STR_SVT_MIMETYPE_START+57)
-#define STR_SVT_MIMETYPE_CNT_CDF (STR_SVT_MIMETYPE_START+58)
-#define STR_SVT_MIMETYPE_CNT_CDFSUB (STR_SVT_MIMETYPE_START+59)
-#define STR_SVT_MIMETYPE_CNT_CDFITEM (STR_SVT_MIMETYPE_START+60)
-#define STR_SVT_MIMETYPE_CNT_STARCHANNEL (STR_SVT_MIMETYPE_START+61)
-#define STR_SVT_MIMETYPE_CNT_TRASHBOX (STR_SVT_MIMETYPE_START+62)
-#define STR_SVT_MIMETYPE_CNT_TRASH (STR_SVT_MIMETYPE_START+63)
-#define STR_SVT_MIMETYPE_CNT_REMOV_VOL (STR_SVT_MIMETYPE_START+64)
-#define STR_SVT_MIMETYPE_CNT_FIX_VOL (STR_SVT_MIMETYPE_START+65)
-#define STR_SVT_MIMETYPE_CNT_REM_VOL (STR_SVT_MIMETYPE_START+66)
-#define STR_SVT_MIMETYPE_CNT_RAM_VOL (STR_SVT_MIMETYPE_START+67)
-#define STR_SVT_MIMETYPE_CNT_CDROM (STR_SVT_MIMETYPE_START+68)
-#define STR_SVT_MIMETYPE_CNT_DISK_35 (STR_SVT_MIMETYPE_START+69)
-#define STR_SVT_MIMETYPE_CNT_DISK_525 (STR_SVT_MIMETYPE_START+70)
-#define STR_SVT_MIMETYPE_CNT_TAPEDRIVE (STR_SVT_MIMETYPE_START+71)
-#define STR_SVT_MIMETYPE_APP_GAL (STR_SVT_MIMETYPE_START+72)
-#define STR_SVT_MIMETYPE_APP_GAL_THEME (STR_SVT_MIMETYPE_START+73)
-#define STR_SVT_MIMETYPE_CNT_SEPARATOR (STR_SVT_MIMETYPE_START+74)
-#define STR_SVT_MIMETYPE_APP_STARW_GLOB (STR_SVT_MIMETYPE_START+75)
-#define STR_SVT_MIMETYPE_APP_SDM (STR_SVT_MIMETYPE_START+76)
-#define STR_SVT_MIMETYPE_APP_SMD (STR_SVT_MIMETYPE_START+77)
-#define STR_SVT_MIMETYPE_APP_STARW_WEB (STR_SVT_MIMETYPE_START+78)
-#define STR_SVT_MIMETYPE_SCHEDULE (STR_SVT_MIMETYPE_START+79)
-#define STR_SVT_MIMETYPE_SCHEDULE_EVT (STR_SVT_MIMETYPE_START+80)
-#define STR_SVT_MIMETYPE_SCHEDULE_TASK (STR_SVT_MIMETYPE_START+81)
-#define STR_SVT_MIMETYPE_SCHEDULE_FEVT (STR_SVT_MIMETYPE_START+82)
-#define STR_SVT_MIMETYPE_SCHEDULE_FTASK (STR_SVT_MIMETYPE_START+83)
-#define STR_SVT_MIMETYPE_FRAMESET (STR_SVT_MIMETYPE_START+84)
-#define STR_SVT_MIMETYPE_MACRO (STR_SVT_MIMETYPE_START+85)
-#define STR_SVT_MIMETYPE_CNT_SFSYSFOLDER (STR_SVT_MIMETYPE_START+86)
-#define STR_SVT_MIMETYPE_CNT_SFSYSFILE (STR_SVT_MIMETYPE_START+87)
-#define STR_SVT_MIMETYPE_APP_TEMPLATE (STR_SVT_MIMETYPE_START+88)
-#define STR_SVT_MIMETYPE_IMAGE_GENERIC (STR_SVT_MIMETYPE_START+89)
-#define STR_SVT_MIMETYPE_APP_MSEXCEL (STR_SVT_MIMETYPE_START+90)
-#define STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL (STR_SVT_MIMETYPE_START+91)
-#define STR_SVT_MIMETYPE_APP_MSPPOINT (STR_SVT_MIMETYPE_START+92)
-#define STR_SVT_MIMETYPE_TEXT_VCALENDAR (STR_SVT_MIMETYPE_START+93)
-#define STR_SVT_MIMETYPE_TEXT_ICALENDAR (STR_SVT_MIMETYPE_START+94)
-#define STR_SVT_MIMETYPE_TEXT_XMLICALENDAR (STR_SVT_MIMETYPE_START+95)
-#define STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP (STR_SVT_MIMETYPE_START+96)
-#define STR_SVT_MIMETYPE_INET_MSG_RFC822 (STR_SVT_MIMETYPE_START+97)
-#define STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE (STR_SVT_MIMETYPE_START+98)
-#define STR_SVT_MIMETYPE_INET_MULTI_DIGEST (STR_SVT_MIMETYPE_START+99)
-#define STR_SVT_MIMETYPE_INET_MULTI_PARALLEL (STR_SVT_MIMETYPE_START+100)
-#define STR_SVT_MIMETYPE_INET_MULTI_RELATED (STR_SVT_MIMETYPE_START+101)
-#define STR_SVT_MIMETYPE_INET_MULTI_MIXED (STR_SVT_MIMETYPE_START+102)
-#define STR_SVT_MIMETYPE_APP_IMPRESSPACKED (STR_SVT_MIMETYPE_START+103)
-#define STR_SVT_MIMETYPE_APP_JAR (STR_SVT_MIMETYPE_START+104)
-#define STR_SVT_MIMETYPE_IMAGE_PNG (STR_SVT_MIMETYPE_START+105)
-#define STR_SVT_MIMETYPE_IMAGE_TIFF (STR_SVT_MIMETYPE_START+106)
-
-#define STR_SVT_MIMETYPE_APP_SXCALC (STR_SVT_MIMETYPE_START+107)
-#define STR_SVT_MIMETYPE_APP_SXCHART (STR_SVT_MIMETYPE_START+108)
-#define STR_SVT_MIMETYPE_APP_SXDRAW (STR_SVT_MIMETYPE_START+109)
-#define STR_SVT_MIMETYPE_APP_SXMATH (STR_SVT_MIMETYPE_START+110)
-#define STR_SVT_MIMETYPE_APP_SXWRITER (STR_SVT_MIMETYPE_START+111)
-#define STR_SVT_MIMETYPE_APP_SXIMPRESS (STR_SVT_MIMETYPE_START+112)
-#define STR_SVT_MIMETYPE_APP_SXGLOBAL (STR_SVT_MIMETYPE_START+113)
-#define STR_SVT_MIMETYPE_APP_SXIPACKED (STR_SVT_MIMETYPE_START+114)
-#define STR_SVT_MIMETYPE_END (STR_SVT_MIMETYPE_APP_SXIPACKED)
-
-#define STR_SVT_PRNDLG_START (STR_SVT_MIMETYPE_END+1)
+#define STR_SVT_PRNDLG_START (RID_SVTOOLS_START+141)
#define DLG_SVT_PRNDLG_PRNSETUPDLG (STR_SVT_PRNDLG_START+0)
#define DLG_SVT_PRNDLG_PRINTDLG (STR_SVT_PRNDLG_START+1)
#define STR_SVT_PRNDLG_READY (STR_SVT_PRNDLG_START+2)
@@ -366,8 +248,8 @@
// String-Ids for accessibility
#define STR_SVT_ACC_BEGIN (STR_SVT_FILEPICKER_END+1)
- // FREE
- // FREE
+#define STR_SVT_TOOL_PANEL_BUTTON_FWD (STR_SVT_ACC_BEGIN+0)
+#define STR_SVT_TOOL_PANEL_BUTTON_BACK (STR_SVT_ACC_BEGIN+1)
#define STR_SVT_ACC_DESC_TABLISTBOX (STR_SVT_ACC_BEGIN+2)
#define STR_SVT_ACC_DESC_FILEVIEW (STR_SVT_ACC_BEGIN+3)
#define STR_SVT_ACC_DESC_FOLDER (STR_SVT_ACC_BEGIN+4)
@@ -468,6 +350,11 @@
#define RID_IMG_BITMAPFONT_HC (RID_SVTOOLS_START + 16)
#define RID_IMG_SCALABLEFONT_HC (RID_SVTOOLS_START + 17)
+#define IMG_TRIANGLE_RIGHT (RID_SVTOOLS_START + 18)
+#define IMG_TRIANGLE_RIGHT_HC (RID_SVTOOLS_START + 19)
+#define IMG_TRIANGLE_DOWN (RID_SVTOOLS_START + 20)
+#define IMG_TRIANGLE_DOWN_HC (RID_SVTOOLS_START + 21)
+
#define IMG_SVT_FOLDER (RID_SVTOOLS_START + 40)
#define IMG_SVT_NEWDOC (RID_SVTOOLS_START + 52)
diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx
index 313b2b7b7735..6eb7f063f9fa 100644
--- a/svtools/inc/svtools/table/tablecontrol.hxx
+++ b/svtools/inc/svtools/table/tablecontrol.hxx
@@ -177,7 +177,7 @@ namespace svt { namespace table
virtual void GetFocus();
virtual void LoseFocus();
virtual void KeyInput( const KeyEvent& rKEvt );
- //virtual long Notify(NotifyEvent& rNEvt);
+ virtual void StateChanged( StateChangedType i_nStateChange );
/** Creates and returns the accessible object of the whole GridControl. */
SVT_DLLPRIVATE virtual XACC CreateAccessible();
@@ -189,7 +189,7 @@ namespace svt { namespace table
::utl::AccessibleStateSetHelper& rStateSet,
AccessibleTableControlObjType eObjType ) const;
//// Window
- virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
virtual void GrabFocus();
virtual XACC GetAccessible( BOOL bCreate = TRUE );
virtual Window* GetAccessibleParentWindow() const;
@@ -221,9 +221,9 @@ namespace svt { namespace table
::com::sun::star::uno::Sequence< sal_Int32 >& getColumnsForTooltip();
::com::sun::star::uno::Sequence< ::rtl::OUString >& getTextForTooltip();
void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols);
+ void clearSelection();
void selectionChanged(bool _bChanged);
-
protected:
/// retrieves the XAccessible implementation associated with the GridControl instance
::svt::IAccessibleFactory& getAccessibleFactory();
diff --git a/svtools/inc/svtools/toolbarmenu.hxx b/svtools/inc/svtools/toolbarmenu.hxx
new file mode 100644
index 000000000000..92b873158a98
--- /dev/null
+++ b/svtools/inc/svtools/toolbarmenu.hxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVTOOLS_TOOLBARMENU_HXX_
+#define _SVTOOLS_TOOLBARMENU_HXX_
+
+#include "svtools/svtdllapi.h"
+
+#include <com/sun/star/frame/FeatureStateEvent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <vector>
+
+#include <rtl/ref.hxx>
+
+#include <vcl/ctrl.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/dockwin.hxx>
+
+class ValueSet;
+
+namespace svtools {
+
+class ToolbarMenuEntry;
+struct ToolbarMenu_Impl;
+
+class SVT_DLLPUBLIC ToolbarMenu : public DockingWindow
+{
+ friend class ToolbarMenuStatusListener;
+ friend struct ToolbarMenu_Impl;
+public:
+ ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ Window* pParentWindow,
+ WinBits nBits );
+
+ ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ Window* pParentWindow,
+ const ResId& rResId );
+
+ ~ToolbarMenu();
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvent );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+ void appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits = 0 );
+ void appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits = 0 );
+ void appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits = 0 );
+ void appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits = 0 );
+ void appendSeparator();
+
+ /** creates an empty ValueSet that is initialized and can be inserted with appendEntry. */
+ ValueSet* createEmptyValueSetControl();
+
+ void checkEntry( int nEntryId, bool bCheck = true );
+ bool isEntryChecked( int nEntryId ) const;
+
+ void enableEntry( int nEntryId, bool bEnable = true );
+ bool isEntryEnabled( int nEntryId ) const;
+
+ void setEntryText( int nEntryId, const String& rStr );
+ const String& getEntryText( int nEntryId ) const;
+
+ void setEntryImage( int nEntryId, const Image& rImage );
+ const Image& getEntryImage( int nEntryId ) const;
+
+ const Size& getMenuSize() const;
+
+ void SetSelectHdl( const Link& rLink );
+ const Link& GetSelectHdl() const;
+
+ int getSelectedEntryId() const;
+ int getHighlightedEntryId() const;
+
+ void highlightFirstEntry();
+
+protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+ // todo: move to new base class that will replace SfxPopupWindow
+ void AddStatusListener( const rtl::OUString& rCommandURL );
+ void RemoveStatusListener( const rtl::OUString& rCommandURL );
+ void UpdateStatus( const rtl::OUString& rCommandURL );
+
+ bool IsInPopupMode();
+ void EndPopupMode();
+
+ // XStatusListener (subclasses must override this one to get the status updates
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ void StateChanged( StateChangedType nType );
+ void DataChanged( const DataChangedEvent& rDCEvt );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame() const;
+private:
+ DECL_LINK( HighlightHdl, Control * );
+
+ void initStatusListener();
+
+ void implInit( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+ void initWindow();
+
+ Size implCalcSize();
+
+ void appendEntry( ToolbarMenuEntry* pEntry );
+
+ void implPaint( ToolbarMenuEntry* pThisOnly = NULL, bool bHighlight = false );
+
+ void implHighlightEntry( int nHighlightEntry, bool bHighlight );
+ void implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown );
+
+ void implChangeHighlightEntry( int nEntry );
+ void implSelectEntry( int nSelectedEntry );
+
+ ToolbarMenuEntry* implCursorUpDown( bool bUp, bool bHomeEnd );
+ ToolbarMenuEntry* implGetEntry( int nEntry ) const;
+ ToolbarMenuEntry* implSearchEntry( int nEntryId ) const;
+
+ ToolbarMenu_Impl* mpImpl;
+};
+
+} // namespace svtools
+
+#endif
diff --git a/svtools/inc/svtools/toolboxcontroller.hxx b/svtools/inc/svtools/toolboxcontroller.hxx
index 27ed315a3c04..7a49b294759c 100644
--- a/svtools/inc/svtools/toolboxcontroller.hxx
+++ b/svtools/inc/svtools/toolboxcontroller.hxx
@@ -42,12 +42,20 @@
#include <cppuhelper/interfacecontainer.hxx>
#include <comphelper/broadcasthelper.hxx>
#include <com/sun/star/util/XURLTransformer.hpp>
-
+//shizhoubo for ToolbarController Visiable
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+//end
#ifndef INCLUDED_HASH_MAP
#include <hash_map>
#define INCLUDED_HASH_MAP
#endif
+class ToolBox;
+
namespace svt
{
struct ToolboxController_Impl;
@@ -57,9 +65,13 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
public ::com::sun::star::lang::XInitialization,
public ::com::sun::star::util::XUpdatable,
public ::com::sun::star::lang::XComponent,
- public ::comphelper::OBaseMutex,
+ public ::comphelper::OMutexAndBroadcastHelper,//shizhoubo
+ public ::comphelper::OPropertyContainer,//shizhoubo
+ public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >,//shizhoubo
public ::cppu::OWeakObject
{
+ private:
+ sal_Bool m_bSupportVisiable; //shizhoubo
public:
ToolboxController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
@@ -91,6 +103,7 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
// XEventListener
+ using cppu::OPropertySetHelper::disposing;
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
// XStatusListener
@@ -102,8 +115,26 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
+ // OPropertySetHelper //shizhoubo
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue ) throw(com::sun::star::uno::Exception);
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& rConvertedValue, com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const com::sun::star::uno::Any& rValue) throw(com::sun::star::lang::IllegalArgumentException);
+ // XPropertySet //shizhoubo
+ virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ // OPropertyArrayUsageHelper //shizhoubo
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+
+ const rtl::OUString& getCommandURL() const { return m_aCommandURL; }
+ const rtl::OUString& getModuleName() const;
+
+ void dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
+
+ void enable( bool bEnable );
protected:
+ bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox );
+ void setSupportVisiableProperty(sal_Bool bValue); //shizhoubo
struct Listener
{
Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) :
diff --git a/svtools/inc/svtools/toolpanel/decklayouter.hxx b/svtools/inc/svtools/toolpanel/decklayouter.hxx
new file mode 100755
index 000000000000..da03d7c6c3aa
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/decklayouter.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVT_DECKLAYOUTER_HXX
+#define SVT_DECKLAYOUTER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <rtl/ref.hxx>
+
+#include <boost/optional.hpp>
+
+namespace com { namespace sun { namespace star { namespace accessibility {
+ class XAccessible;
+} } } }
+class Rectangle;
+class Point;
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= IDeckLayouter
+ //====================================================================
+ class IDeckLayouter : public ::rtl::IReference
+ {
+ public:
+ /** re-arranges the elements of the tool deck, taking into account the
+ available space for the complete deck.
+
+ @param i_rDeckPlayground
+ the playground for the complete tool panel deck
+ @return
+ the content area for a single tool panel
+ */
+ virtual ::Rectangle Layout( const ::Rectangle& i_rDeckPlayground ) = 0;
+
+ /** destroys the instance
+
+ Since the layouter is ref-counted, but might keep references to non-ref-counted objects
+ (in particular, the ToolPanelDeck, which is a VCL-Window, and thus cannot be ref-counted),
+ Destroy is the definitive way to dispose the instance. Technically, it's still alive afterwards,
+ but non-functional.
+ */
+ virtual void Destroy() = 0;
+
+ /** assuming that a layouter neesds to provide some kind of panel selector control, this method
+ requests to set the focus to this control.
+ */
+ virtual void SetFocusToPanelSelector() = 0;
+
+ /** returns the number of components in the XAccessible hierarchy which are needed to represent all elements
+ the layouter is responsible form.
+
+ Note that the implementation must guarantee that the count is fixed over the life time of the layouter.
+ */
+ virtual size_t GetAccessibleChildCount() const = 0;
+
+ /** retrieves the XAccessible implementation for the <code>i_nChildIndex</code>'th child in the XAccessible
+ hierarchy.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetAccessibleChild(
+ const size_t i_nChildIndex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ ) = 0;
+
+ virtual ~IDeckLayouter()
+ {
+ }
+ };
+
+ typedef ::rtl::Reference< IDeckLayouter > PDeckLayouter;
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_DECKLAYOUTER_HXX
diff --git a/svtools/inc/svtools/toolpanel/drawerlayouter.hxx b/svtools/inc/svtools/toolpanel/drawerlayouter.hxx
new file mode 100644
index 000000000000..0ecf493d0e98
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/drawerlayouter.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVT_DRAWERLAYOUTER_HXX
+#define SVT_DRAWERLAYOUTER_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/refbase.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+#include "svtools/toolpanel/decklayouter.hxx"
+
+#include <boost/shared_ptr.hpp>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ class ToolPanelViewShell;
+ class ToolPanelDrawer;
+ typedef ::boost::shared_ptr< ToolPanelDrawer > PToolPanelDrawer;
+
+ //==================================================================================================================
+ //= ToolPanelDrawer
+ //==================================================================================================================
+ /** a class which implements a tool panel selector in the form of the classical drawers
+ */
+ class SVT_DLLPUBLIC DrawerDeckLayouter :public RefBase
+ ,public IDeckLayouter
+ ,public IToolPanelDeckListener
+ {
+ public:
+ DrawerDeckLayouter(
+ ::Window& i_rParentWindow,
+ IToolPanelDeck& i_rPanels
+ );
+ ~DrawerDeckLayouter();
+
+ // IReference
+ DECLARE_IREFERENCE()
+
+ // IDeckLayouter
+ virtual Rectangle Layout( const Rectangle& i_rDeckPlayground );
+ virtual void Destroy();
+ virtual void SetFocusToPanelSelector();
+ virtual size_t GetAccessibleChildCount() const;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetAccessibleChild(
+ const size_t i_nChildIndex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ );
+
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+ private:
+ // triggers a re-arrance of the panel deck elements
+ void impl_triggerRearrange() const;
+ size_t impl_getPanelPositionFromWindow( const Window* i_pDrawerWindow ) const;
+ void impl_removeDrawer( const size_t i_nPosition );
+
+ DECL_LINK( OnWindowEvent, VclSimpleEvent* );
+
+private:
+ Window& m_rParentWindow;
+ IToolPanelDeck& m_rPanelDeck;
+ ::std::vector< PToolPanelDrawer > m_aDrawers;
+ ::boost::optional< size_t > m_aLastKnownActivePanel;
+ };
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
+
+#endif // SVT_DRAWERLAYOUTER_HXX
diff --git a/svtools/inc/svtools/toolpanel/paneltabbar.hxx b/svtools/inc/svtools/toolpanel/paneltabbar.hxx
new file mode 100644
index 000000000000..668935d8a739
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/paneltabbar.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVT_PANELTABBAR_HXX
+#define SVT_PANELTABBAR_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/tabalignment.hxx"
+#include "svtools/toolpanel/tabitemcontent.hxx"
+
+#include <vcl/ctrl.hxx>
+
+#include <memory>
+#include <boost/optional.hpp>
+
+class PushButton;
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ class PanelTabBar_Impl;
+ class IToolPanelDeck;
+
+ //====================================================================
+ //= PanelTabBar
+ //====================================================================
+ /** a tab bar for selecting panels
+
+ At the moment, this control aligns the tabs vertically, this might be extended to also support a horizontal
+ layout in the future.
+ */
+ class SVT_DLLPUBLIC PanelTabBar : public Control
+ {
+ public:
+ PanelTabBar( Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent );
+ ~PanelTabBar();
+
+ // attribute access
+ TabItemContent GetTabItemContent() const;
+ void SetTabItemContent( const TabItemContent& i_eItemContent );
+
+ ::boost::optional< size_t > GetFocusedPanelItem() const;
+ void FocusPanelItem( const size_t i_nItemPos );
+ Rectangle GetItemScreenRect( const size_t i_nItemPos ) const;
+ bool IsVertical() const;
+ IToolPanelDeck& GetPanelDeck() const;
+ PushButton& GetScrollButton( const bool i_bForward );
+
+ // Window overridables
+ virtual Size GetOptimalSize( WindowSizeType i_eType ) const;
+
+ protected:
+ // Window overridables
+ virtual void Paint( const Rectangle& i_rRect );
+ virtual void Resize();
+ virtual void MouseMove( const MouseEvent& i_rMouseEvent );
+ virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent );
+ virtual void MouseButtonUp( const MouseEvent& i_rMouseEvent );
+ virtual void RequestHelp( const HelpEvent& i_rHelpEvent );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void KeyInput( const KeyEvent& i_rKeyEvent );
+ virtual void DataChanged( const DataChangedEvent& i_rDataChanedEvent );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
+ GetComponentInterface( BOOL i_bCreate );
+
+ private:
+ ::std::auto_ptr< PanelTabBar_Impl > m_pImpl;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_PANELTABBAR_HXX
+
diff --git a/svtools/inc/svtools/toolpanel/refbase.hxx b/svtools/inc/svtools/toolpanel/refbase.hxx
new file mode 100644
index 000000000000..991d6e619090
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/refbase.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVT_REFBASE_HXX
+#define SVT_REFBASE_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <rtl/ref.hxx>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= RefBase
+ //====================================================================
+ class SVT_DLLPUBLIC RefBase : public ::rtl::IReference
+ {
+ protected:
+ RefBase()
+ :m_refCount( 0 )
+ {
+ }
+
+ virtual ~RefBase()
+ {
+ }
+
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+ private:
+ oslInterlockedCount m_refCount;
+ };
+
+#define DECLARE_IREFERENCE() \
+ virtual oslInterlockedCount SAL_CALL acquire(); \
+ virtual oslInterlockedCount SAL_CALL release();
+
+
+#define IMPLEMENT_IREFERENCE( classname ) \
+ oslInterlockedCount classname::acquire() \
+ { \
+ return RefBase::acquire(); \
+ } \
+ oslInterlockedCount classname::release() \
+ { \
+ return RefBase::release(); \
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_REFBASE_HXX
diff --git a/svtools/inc/svtools/toolpanel/tabalignment.hxx b/svtools/inc/svtools/toolpanel/tabalignment.hxx
new file mode 100644
index 000000000000..cc3f17469ffe
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/tabalignment.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVT_TABALIGNMENT_HXX
+#define SVT_TABALIGNMENT_HXX
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ enum TabAlignment
+ {
+ TABS_LEFT,
+ TABS_RIGHT,
+ TABS_TOP,
+ TABS_BOTTOM
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TABALIGNMENT_HXX
diff --git a/svtools/inc/svtools/toolpanel/tabitemcontent.hxx b/svtools/inc/svtools/toolpanel/tabitemcontent.hxx
new file mode 100644
index 000000000000..a1cf9deae9f4
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/tabitemcontent.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVT_TABITEMCONTENT_HXX
+#define SVT_TABITEMCONTENT_HXX
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ enum TabItemContent
+ {
+ TABITEM_IMAGE_AND_TEXT,
+ TABITEM_IMAGE_ONLY,
+ TABITEM_TEXT_ONLY,
+
+ TABITEM_AUTO
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TABITEMCONTENT_HXX
diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx
new file mode 100755
index 000000000000..92b36acf9114
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVT_TABLAYOUTER_HXX
+#define SVT_TABLAYOUTER_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/decklayouter.hxx"
+#include "svtools/toolpanel/tabalignment.hxx"
+#include "svtools/toolpanel/tabitemcontent.hxx"
+#include "svtools/toolpanel/refbase.hxx"
+
+#include <memory>
+
+#include <boost/noncopyable.hpp>
+
+class Window;
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ class IToolPanelDeck;
+
+ struct TabDeckLayouter_Data;
+
+ //====================================================================
+ //= TabDeckLayouter
+ //====================================================================
+ class SVT_DLLPUBLIC TabDeckLayouter :public RefBase
+ ,public IDeckLayouter
+ ,public ::boost::noncopyable
+ {
+ public:
+ /** creates a new layouter
+ @param i_rParent
+ is the parent window for any VCL windows the layouter needs to create.
+ @param i_rPanels
+ is the panel deck which the layouter is responsible for.
+ @param i_eAlignment
+ specifies the alignment of the panel selector
+ @param TabItemContent
+ specifies the content to show on the tab items
+ */
+ TabDeckLayouter(
+ Window& i_rParent,
+ IToolPanelDeck& i_rPanels,
+ const TabAlignment i_eAlignment,
+ const TabItemContent i_eItemContent
+ );
+ ~TabDeckLayouter();
+
+ // attribute access
+ TabItemContent GetTabItemContent() const;
+ void SetTabItemContent( const TabItemContent& i_eItemContent );
+ TabAlignment GetTabAlignment() const;
+
+ // helpers for the A11Y implementation
+ ::boost::optional< size_t >
+ GetFocusedPanelItem() const;
+ void FocusPanelItem( const size_t i_nItemPos );
+ bool IsPanelSelectorEnabled() const;
+ bool IsPanelSelectorVisible() const;
+ Rectangle GetItemScreenRect( const size_t i_nItemPos ) const;
+
+ // IDeckLayouter
+ virtual Rectangle Layout( const Rectangle& i_rDeckPlayground );
+ virtual void Destroy();
+ virtual void SetFocusToPanelSelector();
+ virtual size_t GetAccessibleChildCount() const;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetAccessibleChild(
+ const size_t i_nChildIndex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ );
+
+ // IReference
+ DECLARE_IREFERENCE()
+
+ private:
+ ::std::auto_ptr< TabDeckLayouter_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TABLAYOUTER_HXX
diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx
new file mode 100644
index 000000000000..432dea64e8b5
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVT_TOOLPANEL_HXX
+#define SVT_TOOLPANEL_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/refbase.hxx"
+
+#include <rtl/ustring.hxx>
+#include <vcl/image.hxx>
+#include <vcl/smartid.hxx>
+
+#include <boost/noncopyable.hpp>
+
+class Rectangle;
+class Window;
+namespace com { namespace sun { namespace star { namespace accessibility {
+ class XAccessible;
+} } } }
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= IToolPanel
+ //====================================================================
+ /** abstract interface for a single tool panel
+ */
+ class SVT_DLLPUBLIC IToolPanel : public ::rtl::IReference
+ {
+ public:
+ /// retrieves the display name of the panel
+ virtual ::rtl::OUString GetDisplayName() const = 0;
+
+ /// retrieves the image associated with the panel, if any
+ virtual Image GetImage() const = 0;
+
+ /// retrieves the help ID associated with the panel, if any.
+ virtual SmartId GetHelpID() const = 0;
+
+ /** activates the panel
+
+ Usually, this means the panel's Window is created (if not previosly done so) and shown.
+
+ @param i_rParentWindow
+ the parent window to anchor the panel window at. Subsequent calls to the Activate
+ method will always get the same parent window. The complete area of this window is
+ available, and should be used, for the panel window.
+ */
+ virtual void Activate( Window& i_rParentWindow ) = 0;
+
+ /** deactivates the panel
+
+ There are different ways how an implementation could deactivate a panel. The easiest way
+ would be to simply hide the associated Window. Alternatively, you could completely destroy it,
+ or decide to cache it by re-parenting it to another (temporary, invisible) window.
+ */
+ virtual void Deactivate() = 0;
+
+ /** sets a new size for the panel's Window
+
+ The panel window is always expected to be positioned at (0,0), relative to the parent window
+ which was passed to the Activate member. Resizing the panel window is necessary when the size of
+ this parent window changes. Effectively, this method is a means of convenience, to relief panel
+ implementations from reacting on size changes of their parent window themselves.
+ */
+ virtual void SetSizePixel( const Size& i_rPanelWindowSize ) = 0;
+
+ /// sets the focus to the panel window
+ virtual void GrabFocus() = 0;
+
+ /** release any resources associated with the panel.
+
+ In particular, implementations should ultimately destroy the VCL window which implements the panel
+ window. No subsequent calls to any other method will happen after Destroy has been called.
+ */
+ virtual void Dispose() = 0;
+
+ /** creates an XAccessible for the tool panel
+
+ Implementations are allowed to create a new instance each time this method is called, the caller
+ is responsible for caching the XAccessible implementation, if this is desired.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ CreatePanelAccessible(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ ) = 0;
+
+ virtual ~IToolPanel()
+ {
+ }
+ };
+
+ typedef ::rtl::Reference< IToolPanel > PToolPanel;
+
+ //====================================================================
+ //= ToolPanelBase
+ //====================================================================
+ /** base class for tool panel implementations, adding ref count implementation to the IToolPanel interface,
+ but still being abstract
+ */
+ class SVT_DLLPUBLIC ToolPanelBase :public IToolPanel
+ ,public RefBase
+ ,public ::boost::noncopyable
+ {
+ protected:
+ ToolPanelBase();
+ ~ToolPanelBase();
+
+ public:
+ DECLARE_IREFERENCE()
+
+ private:
+ oslInterlockedCount m_refCount;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TOOLPANEL_HXX
diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx
new file mode 100755
index 000000000000..a1009591ffba
--- /dev/null
+++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVT_TOOLPANELDECK_HXX
+#define SVT_TOOLPANELDECK_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/toolpanel.hxx"
+#include "svtools/toolpanel/decklayouter.hxx"
+
+#include <vcl/ctrl.hxx>
+
+#include <boost/optional.hpp>
+#include <memory>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ class ToolPanelCollection;
+ class ToolPanelDeck_Impl;
+
+ //====================================================================
+ //= IToolPanelDeckListener
+ //====================================================================
+ class SAL_NO_VTABLE IToolPanelDeckListener
+ {
+ public:
+ /** called when a panel has been inserted into the deck
+ */
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0;
+
+ /** called when a panel has been removed from the deck
+ */
+ virtual void PanelRemoved( const size_t i_nPosition ) = 0;
+
+ /** called when the active panel of the deck changed
+ */
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) = 0;
+
+ /** called when a new layouter has been set at a tool panel deck.
+
+ The method is called after the old layouter has been disposed (i.e. its Destroy method has been
+ invoked), and after the complete deck has been re-layouter.
+ */
+ virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ) = 0;
+
+ /** called when the tool panel deck which the listener registered at is dying. The listener is required to
+ release all references to the deck then.
+ */
+ virtual void Dying() = 0;
+ };
+
+ //====================================================================
+ //= IToolPanelDeck
+ //====================================================================
+ class SVT_DLLPUBLIC IToolPanelDeck
+ {
+ public:
+ /** returns the number of panels in the container
+ */
+ virtual size_t GetPanelCount() const = 0;
+
+ /** retrieves the panel with the given index. Invalid indexes will be reported via an assertion in the
+ non-product version, and silently ignored in the product version, with a NULL panel being returned.
+ */
+ virtual PToolPanel GetPanel( const size_t i_nPos ) const = 0;
+
+ /** returns the number of the currently active panel.
+ */
+ virtual ::boost::optional< size_t >
+ GetActivePanel() const = 0;
+
+ /** activates the panel with the given number. If the given number is larger or equal to the number of panels
+ in the deck, this will be reported via an assertion in non-product builds, and otherwise ignored.
+ @param i_rPanel
+ the number of the panel to activate. If this is not set, the currently active panel is de-activated,
+ and no new panel is activated at all. Whether or not this makes sense for your application is at
+ your own discretion.
+ */
+ virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) = 0;
+
+ /** inserts a new panel into the container. NULL panels are not allowed, as are positions greater than the
+ current panel count. Violations of this will be reported via an assertion in the non-product version, and
+ silently ignored in the product version.
+ */
+ virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0;
+
+ /** removes a panel specified by its position.
+
+ Note: It is the responsibility of the caller to ensure that the panel is destroyed appropriately. That is,
+ the tool panel deck will <em>not</em> invoke <member>IToolPanel::Dispose</member> on the removed panel.
+ The advantage is that the panel might be re-used later, with the disadvantage that the owner of the panel
+ deck must know whether Dispose must be invoked after removal, or whether the panel will properly
+ dispose itself when its ref count drops to 0.
+ */
+ virtual PToolPanel RemovePanel( const size_t i_nPosition ) = 0;
+
+ /** adds a new listener to be notified when the container content changes. The caller is responsible
+ for life time control, i.e. removing the listener before it actually dies.
+ */
+ virtual void AddListener( IToolPanelDeckListener& i_rListener ) = 0;
+
+ /** removes a container listener previously added via addListener.
+ */
+ virtual void RemoveListener( IToolPanelDeckListener& i_rListener ) = 0;
+ };
+
+ //====================================================================
+ //= ToolPanelDeck
+ //====================================================================
+ class SVT_DLLPUBLIC ToolPanelDeck :public Control
+ ,public IToolPanelDeck
+ {
+ public:
+ ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle = WB_DIALOGCONTROL );
+ ~ToolPanelDeck();
+
+ // attributes
+ PDeckLayouter GetLayouter() const;
+ void SetLayouter( const PDeckLayouter& i_pNewLayouter );
+
+ /** returns the window which acts as anchor for the panel windows.
+
+ This is a single dedicated window, which is passed to the IToolPanel::ActivatePanel method
+ whenever a panel is activated, to act as parent window for the panel's VCL-Window.
+ */
+ ::Window& GetPanelWindowAnchor();
+ const ::Window& GetPanelWindowAnchor() const;
+
+ /** sets the window which should act as parent in the A11Y object hierarchy.
+
+ Calling this method has no effect if CreateAccessible had always been called.
+ */
+ void SetAccessibleParentWindow( ::Window* i_pAccessibleParent );
+ ::Window* GetAccessibleParentWindow() const;
+
+ // IToolPanelDeck
+ virtual size_t GetPanelCount() const;
+ virtual PToolPanel GetPanel( const size_t i_nPos ) const;
+ virtual ::boost::optional< size_t >
+ GetActivePanel() const;
+ virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel );
+ virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual PToolPanel RemovePanel( const size_t i_nPosition );
+ virtual void AddListener( IToolPanelDeckListener& i_rListener );
+ virtual void RemoveListener( IToolPanelDeckListener& i_rListener );
+
+ protected:
+ // Window overridables
+ virtual void Resize();
+ virtual long Notify( NotifyEvent& i_rNotifyEvent );
+ virtual void GetFocus();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
+ GetComponentInterface( BOOL i_bCreate );
+
+ private:
+ ::std::auto_ptr< ToolPanelDeck_Impl > m_pImpl;
+
+ private:
+ using Window::GetAccessibleParentWindow;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TOOLPANELDECK_HXX
diff --git a/svtools/inc/svtools/valueset.hxx b/svtools/inc/svtools/valueset.hxx
index 9d72751c5e20..0937d824daf0 100644
--- a/svtools/inc/svtools/valueset.hxx
+++ b/svtools/inc/svtools/valueset.hxx
@@ -426,6 +426,9 @@ public:
void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
+ void SetHighlightHdl( const Link& rLink );
+ const Link& GetHighlightHdl() const;
+
private:
/** Determine whether RTL (right to left writing) is active. For this
method to return <true/> two conditions have to be fullfilled:
diff --git a/svtools/inc/svtools/wizardmachine.hxx b/svtools/inc/svtools/wizardmachine.hxx
index f45087f78705..02562ac4bb63 100644
--- a/svtools/inc/svtools/wizardmachine.hxx
+++ b/svtools/inc/svtools/wizardmachine.hxx
@@ -42,6 +42,7 @@ namespace svt
//.........................................................................
// wizard buttons
+#define WZB_NONE 0x0000
#define WZB_NEXT 0x0001
#define WZB_PREVIOUS 0x0002
#define WZB_FINISH 0x0004
@@ -62,12 +63,11 @@ namespace svt
eTravelForward, // traveling forward (maybe with skipping pages)
eTravelBackward, // traveling backward (maybe with skipping pages)
eFinish, // the wizard is about to be finished
- eValidate, // the data should be validated only, no traveling wll happen
- eValidateNoUI // the data should be validated only, without displaying error messages and other UI
+ eValidate // the data should be validated only, no traveling wll happen
};
};
- class SAL_NO_VTABLE IWizardPage : public WizardTypes
+ class SAL_NO_VTABLE IWizardPageController
{
public:
//-----------------------------------------------------------------
@@ -78,7 +78,16 @@ namespace svt
// to be committed for this.
// So initializePage and commitPage are designated to initialitzing/committing data on the page.
virtual void initializePage() = 0;
- virtual sal_Bool commitPage( CommitPageReason _eReason ) = 0;
+ virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason ) = 0;
+
+ /** determines whether or not it is allowed to advance to a next page
+
+ You should make this dependent on the current state of the page only, not on
+ states on other pages of the whole dialog.
+
+ The default implementation always returns <TRUE/>.
+ */
+ virtual bool canAdvance() const = 0;
};
//=====================================================================
@@ -87,7 +96,7 @@ namespace svt
class OWizardMachine;
struct WizardPageImplData;
- class SVT_DLLPUBLIC OWizardPage : public TabPage, public IWizardPage
+ class SVT_DLLPUBLIC OWizardPage : public TabPage, public IWizardPageController
{
private:
WizardPageImplData* m_pImpl;
@@ -101,23 +110,10 @@ namespace svt
OWizardPage( Window* _pParent, const ResId& _rResId );
~OWizardPage();
- // This methods behave somewhat different than ActivatePage/DeactivatePage
- // The latter are handled by the base class itself whenever changing the pages is in the offing,
- // i.e., when it's already decided which page is the next.
- // We may have situations where the next page depends on the state of the current, which needs
- // to be committed for this.
- // So initializePage and commitPage are designated to initialitzing/committing data on the page.
+ // IWizardPageController overridables
virtual void initializePage();
- virtual sal_Bool commitPage( CommitPageReason _eReason );
-
- /** determines whether or not it is allowed to advance to a next page
-
- You should make this dependent on the current state of the page only, not on
- states on other pages of the whole dialog.
-
- The default implementation always returns <TRUE/>.
- */
- virtual bool canAdvance() const;
+ virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason );
+ virtual bool canAdvance() const;
protected:
// TabPage overridables
@@ -189,6 +185,7 @@ namespace svt
For the button flags, use any combination of the WZB_* flags.
*/
OWizardMachine(Window* _pParent, const ResId& _rRes, sal_uInt32 _nButtonFlags );
+ OWizardMachine(Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags );
~OWizardMachine();
/// enable (or disable) buttons
@@ -263,7 +260,7 @@ namespace svt
/** called when the finish button is pressed
<p>By default, only the base class' Finnish method (which is not virtual) is called</p>
*/
- virtual sal_Bool onFinish(sal_Int32 _nResult);
+ virtual sal_Bool onFinish();
/// travel to the next state
sal_Bool travelNext();
@@ -342,7 +339,8 @@ namespace svt
*/
WizardState getCurrentState() const { return WizardDialog::GetCurLevel(); }
- virtual IWizardPage* getWizardPage(TabPage* _pCurrentPage) const;
+ virtual IWizardPageController*
+ getPageController( TabPage* _pCurrentPage ) const;
/** retrieves a copy of the state history, i.e. all states we already visited
*/
@@ -355,6 +353,9 @@ namespace svt
void resumeTraveling( AccessGuard );
bool isTravelingSuspended() const;
+ protected:
+ TabPage* GetOrCreatePage( const WizardState i_nState );
+
private:
// long OnNextPage( PushButton* );
DECL_DLLPRIVATE_LINK(OnNextPage, PushButton*);
@@ -363,6 +364,7 @@ namespace svt
SVT_DLLPRIVATE void implResetDefault(Window* _pWindow);
SVT_DLLPRIVATE void implUpdateTitle();
+ SVT_DLLPRIVATE void implConstruct( const sal_uInt32 _nButtonFlags );
};
/// helper class to temporarily suspend any traveling in the wizard
diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst
index 15dbc36467d2..a7d8569de301 100644
--- a/svtools/prj/build.lst
+++ b/svtools/prj/build.lst
@@ -21,10 +21,13 @@ st svtools\source\plugapp nmake - all st_papp st_inc NULL
st svtools\source\svhtml nmake - all st_html st_inc NULL
st svtools\source\svrtf nmake - all st_rtf st_inc NULL
st svtools\source\table nmake - all st_table st_inc NULL
+st svtools\source\toolpanel nmake - all st_toolpanel st_inc NULL
st svtools\source\uno nmake - all st_uno st_inc NULL
+st svtools\source\uno\wizard nmake - all st_uno_wiz st_inc NULL
st svtools\source\urlobj nmake - all st__url st_inc NULL
-st svtools\util nmake - all st_util st_svtgraphic st__brw st__ctr st_conf st_ctl st_dial st_edit st__misc st__url st_html st_papp st_rtf st_table st_uno st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_svtjava NULL
+st svtools\util nmake - all st_util st_svtgraphic st__brw st__ctr st_conf st_ctl st_dial st_edit st__misc st__url st_html st_papp st_rtf st_table st_toolpanel st_uno st_uno_wiz st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_svtjava NULL
st svtools\source\hatchwindow nmake - all st_hatchwin st_inc NULL
st svtools\source\productregistration nmake - all st_prodreg st_util st_inc NULL
st svtools\workben\unodialog nmake - all st_workben_udlg st_util NULL
+st svtools\workben\toolpanel nmake - all st_workben_toolpanel st_util st_toolpanel NULL
st svtools\qa\unoapi nmake - all st_qa_unoapi NULL
diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst
index 4a9e8314e0d8..b46ddef72311 100644
--- a/svtools/prj/d.lst
+++ b/svtools/prj/d.lst
@@ -1,6 +1,7 @@
mkdir: %COMMON_DEST%\bin%_EXT%\hid
mkdir: %COMMON_DEST%\res%_EXT%
mkdir: %_DEST%\inc%_EXT%\svtools
+mkdir: %_DEST%\inc%_EXT%\svtools\toolpanel
mkdir: %_DEST%\inc%_EXT%\svtools\table
..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
@@ -31,6 +32,8 @@ mkdir: %_DEST%\inc%_EXT%\svtools\table
..\inc\*.h %_DEST%\inc%_EXT%\svtools\*.h
..\inc\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc
+..\inc\svtools\toolpanel\*.* %_DEST%\inc%_EXT%\svtools\toolpanel\*.hrc
+
dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi"
*.xml %_DEST%\xml%_EXT%\*.xml
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index 9a4903b1e093..3a29c4ae63fa 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -2446,8 +2446,6 @@ void BrowseBox::SetMode( BrowserMode nMode )
BROWSER_AUTO_HSCROLL |
BROWSER_TRACKING_TIPS |
// BROWSER_HIGHLIGHT_NONE |
- BROWSER_HIGHLIGHT_AUTO |
-// BROWSER_HIGHLIGHT_MANU |
BROWSER_HEADERBAR_NEW |
// BROWSER_AUTOSIZE_LASTCOL |
0;
@@ -2517,9 +2515,6 @@ void BrowseBox::SetMode( BrowserMode nMode )
pVScroll->SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
pVScroll->SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) );
- getDataWindow()->bHighlightAuto =
- BROWSER_HIGHLIGHT_AUTO == ( nMode & BROWSER_HIGHLIGHT_AUTO ) ||
- BROWSER_HIGHLIGHT_MANU != ( nMode & BROWSER_HIGHLIGHT_MANU );
getDataWindow()->bAutoSizeLastCol =
BROWSER_AUTOSIZE_LASTCOL == ( nMode & BROWSER_AUTOSIZE_LASTCOL );
getDataWindow()->bOwnDataChangedHdl =
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index da07415dfee8..68cf316e813b 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -340,10 +340,6 @@ void BrowseBox::ToggleSelection( BOOL bForce )
if ( !bForce &&
( bNotToggleSel || !IsUpdateMode() || !bSelectionIsVisible ) )
return;
-//MI, 28.01.98
-// if ( !getDataWindow()->bHighlightToggle &&
-// !getDataWindow()->bHighlightAuto )
-// return;
// only highlight painted areas!
bNotToggleSel = TRUE;
@@ -984,11 +980,10 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, BOOL
Size( _rRect.GetSize().Width(), nDataRowHeigt ) );
PaintRow( _rOut, aRowRect );
- BOOL bRowAutoHighlight = _bDrawSelections
- && !bHideSelect
- && ((BrowserDataWin&)GetDataWindow()).bHighlightAuto
- && IsRowSelected( nRow );
- if ( bRowAutoHighlight )
+ BOOL bRowSelected = _bDrawSelections
+ && !bHideSelect
+ && IsRowSelected( nRow );
+ if ( bRowSelected )
{
_rOut.SetTextColor( rHighlightTextColor );
_rOut.SetFillColor( rHighlightFillColor );
@@ -1082,7 +1077,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, BOOL
bRetouching = TRUE;
// reset auto-highlight
- if ( bRowAutoHighlight )
+ if ( bRowSelected )
{
_rOut.SetTextColor( aOldTextColor );
_rOut.SetFillColor( aOldFillColor );
diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx
index 449d5642e034..102af1b6e1a1 100644
--- a/svtools/source/brwbox/brwbox3.cxx
+++ b/svtools/source/brwbox/brwbox3.cxx
@@ -542,7 +542,7 @@ BOOL BrowseBox::GetGlyphBoundRects( const Point& rOrigin, const String& rStr, in
return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, nBase, rVector );
}
// -----------------------------------------------------------------------------
-Rectangle BrowseBox::GetWindowExtentsRelative( Window *pRelativeWindow )
+Rectangle BrowseBox::GetWindowExtentsRelative( Window *pRelativeWindow ) const
{
return Control::GetWindowExtentsRelative( pRelativeWindow );
}
diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx
index e068f669e46e..1deb8aeb5b56 100644
--- a/svtools/source/brwbox/datwin.hxx
+++ b/svtools/source/brwbox/datwin.hxx
@@ -142,7 +142,6 @@ public:
FASTBOOL bAutoVScroll; // autohide horizontaler Scrollbar
FASTBOOL bUpdateMode; // nicht SV-UpdateMode wegen Invalidate()
FASTBOOL bAutoSizeLastCol;// last column always fills up window
- FASTBOOL bHighlightAuto; // new auto-highlight by SetFont() etc.
FASTBOOL bResizeOnPaint; // outstanding resize-event
FASTBOOL bUpdateOnUnlock; // Update() while locked
FASTBOOL bInUpdateScrollbars; // Rekursionsschutz
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index 817ab743140a..4f0afbaf5d2d 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -47,7 +47,7 @@
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#include <algorithm>
diff --git a/svtools/source/brwbox/editbrowsebox.src b/svtools/source/brwbox/editbrowsebox.src
index 8c00c673c32b..6511d97ea86a 100644
--- a/svtools/source/brwbox/editbrowsebox.src
+++ b/svtools/source/brwbox/editbrowsebox.src
@@ -30,7 +30,7 @@
#endif
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
ImageList RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 8538e344bdc1..843de83f7710 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -34,7 +34,7 @@
#include <svtools/headbar.hxx>
#include <svtools/svtabbx.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include "fileview.hrc"
#include "contentenumeration.hxx"
#include <svtools/AccessibleBrowseBoxObjType.hxx>
diff --git a/svtools/source/contnr/fileview.src b/svtools/source/contnr/fileview.src
index e45f35fc1927..f40530c10347 100644
--- a/svtools/source/contnr/fileview.src
+++ b/svtools/source/contnr/fileview.src
@@ -27,7 +27,7 @@
// includes ------------------------------------------------------------------
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include "fileview.hrc"
#include <svtools/helpid.hrc>
diff --git a/svtools/source/contnr/svcontnr.src b/svtools/source/contnr/svcontnr.src
index c296cc686c1d..bcd1e060664f 100644
--- a/svtools/source/contnr/svcontnr.src
+++ b/svtools/source/contnr/svcontnr.src
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
Image RID_IMG_TREENODE_COLLAPSED
{
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 426f55be5b93..7111a29a6a8a 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -47,7 +47,7 @@
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
// #102891# --------------------
@@ -3115,7 +3115,7 @@ void lcl_DeleteSubPopups(PopupMenu* pPopup)
}
}
-void SvImpLBox::Command( const CommandEvent& rCEvt )
+bool SvImpLBox::Command( const CommandEvent& rCEvt )
{
USHORT nCommand = rCEvt.GetCommand();
@@ -3123,9 +3123,22 @@ void SvImpLBox::Command( const CommandEvent& rCEvt )
aEditTimer.Stop();
// Rollmaus-Event?
- if( ( ( nCommand == COMMAND_WHEEL ) || ( nCommand == COMMAND_STARTAUTOSCROLL ) || ( nCommand == COMMAND_AUTOSCROLL ) )
- && pView->HandleScrollCommand( rCEvt, &aHorSBar, &aVerSBar ) )
- return;
+ if ( ( ( nCommand == COMMAND_WHEEL )
+ || ( nCommand == COMMAND_STARTAUTOSCROLL )
+ || ( nCommand == COMMAND_AUTOSCROLL )
+ )
+ && pView->HandleScrollCommand( rCEvt, &aHorSBar, &aVerSBar )
+ )
+ {
+ return true;
+ }
+
+ if ( ( nCommand == COMMAND_CONTEXTMENU )
+ && !bContextMenuHandling
+ )
+ {
+ return false;
+ }
if( bContextMenuHandling && nCommand == COMMAND_CONTEXTMENU )
{
@@ -3174,8 +3187,6 @@ void SvImpLBox::Command( const CommandEvent& rCEvt )
{ // deselect all
pView->SelectAll( FALSE );
}
-
-
}
else
{ // key event (or at least no mouse event)
@@ -3235,15 +3246,18 @@ void SvImpLBox::Command( const CommandEvent& rCEvt )
aSelRestore.pop();
}
}
+ return true;
}
-#ifndef NOCOMMAND
- else
- {
- const Point& rPos = rCEvt.GetMousePosPixel();
- if( rPos.X() < aOutputSize.Width() && rPos.Y() < aOutputSize.Height() )
- aSelEng.Command( rCEvt );
- }
-#endif
+
+ const Point& rPos = rCEvt.GetMousePosPixel();
+ if( rPos.X() < aOutputSize.Width() && rPos.Y() < aOutputSize.Height() )
+ aSelEng.Command( rCEvt );
+
+ // strictly, this is not correct. However, it leads to a behavior compatible to the one at the time
+ // when this method did have a void return value ...
+ // A proper solution would be to give the EditEngine::Command also a boolean return value, and forward
+ // this (or false) to our caller
+ return true;
}
void SvImpLBox::BeginScroll()
diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx
index 2752e813052e..fb71f64772ad 100644
--- a/svtools/source/contnr/svlbox.cxx
+++ b/svtools/source/contnr/svlbox.cxx
@@ -1515,9 +1515,10 @@ void SvLBox::MakeVisible( SvLBoxEntry* )
DBG_CHKTHIS(SvLBox,0);
}
-void SvLBox::Command( const CommandEvent& )
+void SvLBox::Command( const CommandEvent& i_rCommandEvent )
{
DBG_CHKTHIS(SvLBox,0);
+ Control::Command( i_rCommandEvent );
}
void SvLBox::KeyInput( const KeyEvent& rKEvt )
@@ -1774,10 +1775,14 @@ void SvLBox::StartDrag( sal_Int8, const Point& rPosPixel )
{
DBG_CHKTHIS(SvLBox,0);
+ nOldDragMode = GetDragDropMode();
+ if ( !nOldDragMode )
+ return;
+
ReleaseMouse();
+
SvLBoxEntry* pEntry = GetEntry( rPosPixel ); // GetDropTarget( rPos );
- nOldDragMode = GetDragDropMode();
- if( !pEntry || !nOldDragMode )
+ if( !pEntry )
{
DragFinished( DND_ACTION_NONE );
return;
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index 9d4ad1ba15b5..53fbded59f11 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -31,7 +31,7 @@
#include <svtools/headbar.hxx>
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
@@ -1232,7 +1232,7 @@ BOOL SvHeaderTabListBox::GetGlyphBoundRects( const Point& rOrigin, const String&
return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, nBase, rVector );
}
// -----------------------------------------------------------------------
-Rectangle SvHeaderTabListBox::GetWindowExtentsRelative( Window *pRelativeWindow )
+Rectangle SvHeaderTabListBox::GetWindowExtentsRelative( Window *pRelativeWindow ) const
{
return Control::GetWindowExtentsRelative( pRelativeWindow );
}
diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx
index 143ac922eebc..bf6e41f93f36 100644
--- a/svtools/source/contnr/svtreebx.cxx
+++ b/svtools/source/contnr/svtreebx.cxx
@@ -40,6 +40,7 @@ class TabBar;
#include <svtools/svlbox.hxx>
#include <svtools/svlbitm.hxx>
#include <svtools/svtreebx.hxx>
+#include <tools/diagnose_ex.h>
#include <svimpbox.hxx>
#include <unotools/accessiblestatesethelper.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -427,17 +428,6 @@ SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText,SvLBoxEntry* pPa
else
SvLBox::Insert( pEntry, pParent, nPos );
- short nExpWidth = (short)rDefExpBmp.GetSizePixel().Width();
- short nColWidth = (short)rDefColBmp.GetSizePixel().Width();
- short nMax = Max(nExpWidth, nColWidth);
- // #97680# ----------------
- nMax = pImp->UpdateContextBmpWidthVector( pEntry, nMax );
- if( nMax > nContextBmpWidthMax )
- {
- nContextBmpWidthMax = nMax;
- SetTabs();
- }
-
aPrevInsertedExpBmp = rDefExpBmp;
aPrevInsertedColBmp = rDefColBmp;
@@ -468,17 +458,6 @@ SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText,
else
SvLBox::Insert( pEntry, pParent, nPos );
- short nExpWidth = (short)aExpEntryBmp.GetSizePixel().Width();
- short nColWidth = (short)aCollEntryBmp.GetSizePixel().Width();
- short nMax = Max(nExpWidth, nColWidth);
- // #97680# ----------------
- nMax = pImp->UpdateContextBmpWidthVector( pEntry, nMax );
- if( nMax > nContextBmpWidthMax )
- {
- nContextBmpWidthMax = nMax;
- SetTabs();
- }
-
aPrevInsertedExpBmp = aExpEntryBmp;
aPrevInsertedColBmp = aCollEntryBmp;
@@ -1041,7 +1020,7 @@ BOOL SvTreeListBox::Expand( SvLBoxEntry* pParent )
// --> OD 2009-04-01 #i92103#
if ( bExpanded )
{
- pImp->CallEventListeners( VCLEVENT_LISTBOX_ENTRY_EXPANDED, pParent );
+ pImp->CallEventListeners( VCLEVENT_ITEM_EXPANDED, pParent );
}
// <--
@@ -1068,7 +1047,7 @@ BOOL SvTreeListBox::Collapse( SvLBoxEntry* pParent )
// --> OD 2009-04-01 #i92103#
if ( bCollapsed )
{
- pImp->CallEventListeners( VCLEVENT_LISTBOX_ENTRY_COLLAPSED, pParent );
+ pImp->CallEventListeners( VCLEVENT_ITEM_COLLAPSED, pParent );
}
// <--
@@ -2250,7 +2229,8 @@ Region SvTreeListBox::GetDragRegion() const
void SvTreeListBox::Command( const CommandEvent& rCEvt )
{
DBG_CHKTHIS(SvTreeListBox,0);
- pImp->Command( rCEvt );
+ if ( !pImp->Command( rCEvt ) )
+ SvLBox::Command( rCEvt );
}
@@ -2346,6 +2326,25 @@ void SvTreeListBox::ModelNotification( USHORT nActionId, SvListEntry* pEntry1,
SvLBox::ModelNotification( nActionId, pEntry1, pEntry2, nPos );
switch( nActionId )
{
+ case LISTACTION_INSERTED:
+ {
+ SvLBoxEntry* pEntry( dynamic_cast< SvLBoxEntry* >( pEntry1 ) );
+ ENSURE_OR_BREAK( pEntry, "SvTreeListBox::ModelNotification: invalid entry!" );
+ SvLBoxContextBmp* pBmpItem = static_cast< SvLBoxContextBmp* >( pEntry->GetFirstItem( SV_ITEM_ID_LBOXCONTEXTBMP ) );
+ if ( !pBmpItem )
+ break;
+ const Image& rBitmap1( pBmpItem->GetBitmap1() );
+ const Image& rBitmap2( pBmpItem->GetBitmap2() );
+ short nMaxWidth = short( Max( rBitmap1.GetSizePixel().Width(), rBitmap2.GetSizePixel().Width() ) );
+ nMaxWidth = pImp->UpdateContextBmpWidthVector( pEntry, nMaxWidth );
+ if( nMaxWidth > nContextBmpWidthMax )
+ {
+ nContextBmpWidthMax = nMaxWidth;
+ SetTabs();
+ }
+ }
+ break;
+
case LISTACTION_RESORTING:
SetUpdateMode( FALSE );
break;
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx
index 47b5ab9aa4b9..61112f6669ca 100644
--- a/svtools/source/contnr/templwin.cxx
+++ b/svtools/source/contnr/templwin.cxx
@@ -41,7 +41,7 @@
#include "imgdef.hxx"
#include "txtattr.hxx"
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#ifndef _SVTOOLS_TEMPLWIN_HRC
#include "templwin.hrc"
diff --git a/svtools/source/contnr/templwin.src b/svtools/source/contnr/templwin.src
index 636c54ef6632..048d052c18d8 100644
--- a/svtools/source/contnr/templwin.src
+++ b/svtools/source/contnr/templwin.src
@@ -30,7 +30,7 @@
#include "templwin.hrc"
#include "controldims.hrc"
#include <svtools/helpid.hrc>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
// Magenta and Grey as mask colors
#define MASK_COL_MAGENTA Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx
index c83ffa3ed70f..f7b49ac57eeb 100644..100755
--- a/svtools/source/control/calendar.cxx
+++ b/svtools/source/control/calendar.cxx
@@ -59,7 +59,7 @@
#include <com/sun/star/i18n/CalendarFieldIndex.hpp>
#define _SV_CALENDAR_CXX
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <calendar.hxx>
diff --git a/svtools/source/control/calendar.src b/svtools/source/control/calendar.src
index 15c82cfdd184..4dd31765a5c1 100644..100755
--- a/svtools/source/control/calendar.src
+++ b/svtools/source/control/calendar.src
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
String STR_SVT_CALENDAR_DAY
{
Text [ en-US ] = "Day" ;
diff --git a/svtools/source/control/collatorres.cxx b/svtools/source/control/collatorres.cxx
index 23a84e757ebe..9988bfdadbb9 100644..100755
--- a/svtools/source/control/collatorres.cxx
+++ b/svtools/source/control/collatorres.cxx
@@ -29,7 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
#include <svtools/svtdata.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <collatorres.hxx>
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 2f692944d3c7..d44b18a29ae1 100644..100755
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -40,7 +40,7 @@
#include <unotools/charclass.hxx>
#include <svtools/svtdata.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <ctrlbox.hxx>
#include <ctrltool.hxx>
diff --git a/svtools/source/control/ctrlbox.src b/svtools/source/control/ctrlbox.src
index 0c63aef259b3..95440c905d89 100644..100755
--- a/svtools/source/control/ctrlbox.src
+++ b/svtools/source/control/ctrlbox.src
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#ifndef IMAGE_STDBTN_COLOR
#define IMAGE_STDBTN_COLOR Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 9abd14331fe4..bd965aca66a6 100644..100755
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -42,7 +42,7 @@
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <ctrltool.hxx>
diff --git a/svtools/source/control/ctrltool.src b/svtools/source/control/ctrltool.src
index 3e1c1ba884f8..72420af4908e 100644..100755
--- a/svtools/source/control/ctrltool.src
+++ b/svtools/source/control/ctrltool.src
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
String STR_SVT_STYLE_LIGHT
{
diff --git a/svtools/source/control/indexentryres.cxx b/svtools/source/control/indexentryres.cxx
index 32e3aa14c0dc..5a79edab5b77 100644..100755
--- a/svtools/source/control/indexentryres.cxx
+++ b/svtools/source/control/indexentryres.cxx
@@ -29,7 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
#include <svtools/svtdata.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <indexentryres.hxx>
diff --git a/svtools/source/control/makefile.mk b/svtools/source/control/makefile.mk
index a40a81163eb3..a2e622730635 100644..100755
--- a/svtools/source/control/makefile.mk
+++ b/svtools/source/control/makefile.mk
@@ -51,7 +51,9 @@ EXCEPTIONSFILES=\
$(SLO)$/scriptedtext.obj\
$(SLO)$/fmtfield.obj \
$(SLO)$/inettbc.obj \
- $(SLO)$/valueacc.obj
+ $(SLO)$/valueacc.obj \
+ $(SLO)$/toolbarmenu.obj \
+ $(SLO)$/toolbarmenuacc.obj
SLOFILES=\
$(EXCEPTIONSFILES) \
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
new file mode 100644
index 000000000000..f07ebd7fe8cd
--- /dev/null
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -0,0 +1,1805 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <comphelper/processfactory.hxx>
+
+#include <vcl/dockwin.hxx>
+#include <vcl/decoview.hxx>
+#include <vcl/image.hxx>
+#include <vcl/taskpanelist.hxx>
+#include <vcl/toolbox.hxx>
+
+#include "svtools/valueset.hxx"
+#include "svtools/toolbarmenu.hxx"
+#include "toolbarmenuimp.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::accessibility;
+
+namespace svtools {
+
+// --------------------------------------------------------------------
+
+static Window* GetTopMostParentSystemWindow( Window* pWindow )
+{
+ OSL_ASSERT( pWindow );
+ if ( pWindow )
+ {
+ // ->manually search topmost system window
+ // required because their might be another system window between this and the top window
+ pWindow = pWindow->GetParent();
+ SystemWindow* pTopMostSysWin = NULL;
+ while ( pWindow )
+ {
+ if ( pWindow->IsSystemWindow() )
+ pTopMostSysWin = (SystemWindow*)pWindow;
+ pWindow = pWindow->GetParent();
+ }
+ pWindow = pTopMostSysWin;
+ OSL_ASSERT( pWindow );
+ return pWindow;
+ }
+
+ return NULL;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenuEntry::init( int nEntryId, MenuItemBits nBits )
+{
+ mnEntryId = nEntryId;
+ mnBits = nBits;
+
+ mbHasText = false;
+ mbHasImage = false;
+ mbChecked = false;
+ mbEnabled = true;
+
+ mpControl = NULL;
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry::ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const String& rText, MenuItemBits nBits )
+: mrMenu( rMenu )
+{
+ init( nEntryId, nBits );
+
+ maText = rText;
+ mbHasText = true;
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry::ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, MenuItemBits nBits )
+: mrMenu( rMenu )
+{
+ init( nEntryId, nBits );
+
+ maImage = rImage;
+ mbHasImage = true;
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry::ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits )
+: mrMenu( rMenu )
+{
+ init( nEntryId, nBits );
+
+ maText = rText;
+ mbHasText = true;
+
+ maImage = rImage;
+ mbHasImage = true;
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry::ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, Control* pControl, MenuItemBits nBits )
+: mrMenu( rMenu )
+{
+ init( nEntryId, nBits );
+
+ if( pControl )
+ {
+ mpControl = pControl;
+ mpControl->Show();
+ }
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry::~ToolbarMenuEntry()
+{
+ if( mxAccContext.is() )
+ {
+ Reference< XComponent > xComponent( mxAccContext, UNO_QUERY );
+ if( xComponent.is() )
+ xComponent->dispose();
+ mxAccContext.clear();
+ }
+ delete mpControl;
+}
+
+// --------------------------------------------------------------------
+
+const Reference< XAccessibleContext >& ToolbarMenuEntry::GetAccessible( bool bCreate /* = false */ )
+{
+ if( !mxAccContext.is() && bCreate )
+ {
+ if( mpControl )
+ {
+ mxAccContext = Reference< XAccessibleContext >( mpControl->GetAccessible( TRUE ), UNO_QUERY );
+ }
+ else
+ {
+ mxAccContext = Reference< XAccessibleContext >( new ToolbarMenuEntryAcc( this ) );
+ }
+ }
+
+ return mxAccContext;
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 ToolbarMenuEntry::getAccessibleChildCount() throw (RuntimeException)
+{
+ if( mpControl )
+ {
+ const Reference< XAccessibleContext >& xContext = GetAccessible( true );
+ if( xContext.is() )
+ {
+ return xContext->getAccessibleChildCount();
+ }
+ }
+ return 1;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XAccessible > ToolbarMenuEntry::getAccessibleChild( sal_Int32 index ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const Reference< XAccessibleContext >& xContext = GetAccessible( true );
+ if( mpControl )
+ {
+ if( xContext.is() )
+ {
+ return xContext->getAccessibleChild(index);
+ }
+ }
+ else if( index == 0 )
+ {
+ Reference< XAccessible > xRet( xContext, UNO_QUERY );
+ if( xRet.is() )
+ return xRet;
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenu_Impl::ToolbarMenu_Impl( ToolbarMenu& rMenu, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame )
+: mrMenu( rMenu )
+, mxFrame( xFrame )
+, mxServiceManager( ::comphelper::getProcessServiceFactory() )
+, mnCheckPos(0)
+, mnImagePos(0)
+, mnTextPos(0)
+, mnHighlightedEntry(-1)
+, mnSelectedEntry(-1)
+, mnLastColumn(0)
+{
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenu_Impl::~ToolbarMenu_Impl()
+{
+ setAccessible( 0 );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu_Impl::setAccessible( ToolbarMenuAcc* pAccessible )
+{
+ if( mxAccessible.get() != pAccessible )
+ {
+ if( mxAccessible.is() )
+ mxAccessible->dispose();
+
+ mxAccessible.set( pAccessible );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolbarMenu_Impl::fireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue )
+{
+ if( mxAccessible.is() )
+ mxAccessible->FireAccessibleEvent( nEventId, rOldValue, rNewValue );
+}
+
+// -----------------------------------------------------------------------
+
+bool ToolbarMenu_Impl::hasAccessibleListeners()
+{
+ return( mxAccessible.is() && mxAccessible->HasAccessibleListeners() );
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 ToolbarMenu_Impl::getAccessibleChildCount() throw (RuntimeException)
+{
+ sal_Int32 nCount = 0;
+ const int nEntryCount = maEntryVector.size();
+ for( int nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = maEntryVector[nEntry];
+ if( pEntry )
+ {
+ if( pEntry->mpControl )
+ {
+ nCount += pEntry->getAccessibleChildCount();
+ }
+ else
+ {
+ nCount += 1;
+ }
+ }
+ }
+
+ return nCount;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XAccessible > ToolbarMenu_Impl::getAccessibleChild( sal_Int32 index ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const int nEntryCount = maEntryVector.size();
+ for( int nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = maEntryVector[nEntry];
+ if( pEntry )
+ {
+ const sal_Int32 nCount = pEntry->getAccessibleChildCount();
+ if( index < nCount )
+ {
+ return pEntry->getAccessibleChild( index );
+ }
+ index -= nCount;
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// --------------------------------------------------------------------
+
+Reference< XAccessible > ToolbarMenu_Impl::getAccessibleChild( Control* pControl, sal_Int32 childIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const int nEntryCount = maEntryVector.size();
+ for( int nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = maEntryVector[nEntry];
+ if( pEntry && (pEntry->mpControl == pControl) )
+ {
+ return pEntry->getAccessibleChild( childIndex );
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu_Impl::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const int nEntryCount = maEntryVector.size();
+ for( int nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = maEntryVector[nEntry];
+ if( pEntry )
+ {
+ const sal_Int32 nCount = pEntry->getAccessibleChildCount();
+ if( nChildIndex < nCount )
+ {
+ if( pEntry->mpControl )
+ {
+ Reference< XAccessibleSelection > xSel( pEntry->GetAccessible(true), UNO_QUERY_THROW );
+ xSel->selectAccessibleChild(nChildIndex);
+ }
+ else if( pEntry->mnEntryId != TITLE_ID )
+ {
+ mrMenu.implSelectEntry( nEntry );
+ }
+ return;
+ }
+ nChildIndex -= nCount;
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool ToolbarMenu_Impl::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const int nEntryCount = maEntryVector.size();
+ for( int nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = maEntryVector[nEntry];
+ if( pEntry )
+ {
+ const sal_Int32 nCount = pEntry->getAccessibleChildCount();
+ if( nChildIndex < nCount )
+ {
+ if( mnHighlightedEntry == nEntry )
+ {
+ if( pEntry->mpControl )
+ {
+ Reference< XAccessibleSelection > xSel( pEntry->GetAccessible(true), UNO_QUERY_THROW );
+ xSel->isAccessibleChildSelected(nChildIndex);
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ nChildIndex -= nCount;
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu_Impl::clearAccessibleSelection()
+{
+ if( mnHighlightedEntry != -1 )
+ {
+ mrMenu.implHighlightEntry( mnHighlightedEntry, false );
+ mnHighlightedEntry = -1;
+ }
+}
+
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu_Impl::notifyHighlightedEntry()
+{
+ if( hasAccessibleListeners() )
+ {
+ ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry );
+ if( pEntry && pEntry->mbEnabled && (pEntry->mnEntryId != TITLE_ID) )
+ {
+ Any aNew;
+ Any aOld( mxOldSelection );
+ if( pEntry->mpControl )
+ {
+ sal_Int32 nChildIndex = 0;
+ // todo: if other controls than ValueSet are allowed, addapt this code
+ ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl );
+ if( pValueSet )
+ nChildIndex = static_cast< sal_Int32 >( pValueSet->GetItemPos( pValueSet->GetSelectItemId() ) );
+
+ if( nChildIndex >= pEntry->getAccessibleChildCount() )
+ return;
+
+ aNew <<= getAccessibleChild( pEntry->mpControl, nChildIndex );
+ }
+ else
+ {
+ aNew <<= pEntry->GetAccessible(true);
+ }
+
+ fireAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOld, aNew );
+ fireAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOld, aNew );
+ fireAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), Any( AccessibleStateType::FOCUSED ) );
+ aNew >>= mxOldSelection;
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry* ToolbarMenu_Impl::implGetEntry( int nEntry ) const
+{
+ if( (nEntry < 0) || (nEntry >= (int)maEntryVector.size() ) )
+ return NULL;
+
+ return maEntryVector[nEntry];
+}
+
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( ToolbarMenu, HighlightHdl, Control *, pControl )
+{
+ (void)pControl;
+ mpImpl->notifyHighlightedEntry();
+ return 0;
+}
+
+// ====================================================================
+
+ToolbarMenu::ToolbarMenu( const Reference< XFrame >& rFrame, Window* pParentWindow, WinBits nBits )
+: DockingWindow(pParentWindow, nBits)
+{
+ implInit(rFrame);
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenu::ToolbarMenu( const Reference< XFrame >& rFrame, Window* pParentWindow, const ResId& rResId )
+: DockingWindow(pParentWindow, rResId)
+{
+ implInit(rFrame);
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::implInit(const Reference< XFrame >& rFrame)
+{
+ mpImpl = new ToolbarMenu_Impl( *this, rFrame );
+
+ initWindow();
+
+ Window* pWindow = GetTopMostParentSystemWindow( this );
+ if ( pWindow )
+ ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this );
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenu::~ToolbarMenu()
+{
+ Window* pWindow = GetTopMostParentSystemWindow( this );
+ if ( pWindow )
+ ((SystemWindow *)pWindow)->GetTaskPaneList()->RemoveWindow( this );
+
+ if ( mpImpl->mxStatusListener.is() )
+ {
+ mpImpl->mxStatusListener->dispose();
+ mpImpl->mxStatusListener.clear();
+ }
+
+ // delete all menu entries
+ const int nEntryCount = mpImpl->maEntryVector.size();
+ int nEntry;
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ delete mpImpl->maEntryVector[nEntry];
+ }
+
+ delete mpImpl;
+}
+
+// --------------------------------------------------------------------
+
+int ToolbarMenu::getSelectedEntryId() const
+{
+ ToolbarMenuEntry* pEntry = implGetEntry( mpImpl->mnSelectedEntry );
+ return pEntry ? pEntry->mnEntryId : -1;
+}
+
+// --------------------------------------------------------------------
+
+int ToolbarMenu::getHighlightedEntryId() const
+{
+ ToolbarMenuEntry* pEntry = implGetEntry( mpImpl->mnHighlightedEntry );
+ return pEntry ? pEntry->mnEntryId : -1;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::checkEntry( int nEntryId, bool bChecked )
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ if( pEntry && pEntry->mbChecked != bChecked )
+ {
+ pEntry->mbChecked = bChecked;
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool ToolbarMenu::isEntryChecked( int nEntryId ) const
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ return pEntry && pEntry->mbChecked;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::enableEntry( int nEntryId, bool bEnable )
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ if( pEntry && pEntry->mbEnabled != bEnable )
+ {
+ pEntry->mbEnabled = bEnable;
+ if( pEntry->mpControl )
+ {
+ pEntry->mpControl->Enable( bEnable );
+
+ // hack for the valueset to make it paint itself anew
+ pEntry->mpControl->Resize();
+ }
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool ToolbarMenu::isEntryEnabled( int nEntryId ) const
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ return pEntry && pEntry->mbEnabled;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::setEntryText( int nEntryId, const String& rStr )
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ if( pEntry && pEntry->maText != rStr )
+ {
+ pEntry->maText = rStr;
+ mpImpl->maSize = implCalcSize();
+ if( IsVisible() )
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------------------
+
+const String& ToolbarMenu::getEntryText( int nEntryId ) const
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ if( pEntry )
+ return pEntry->maText;
+ else
+ {
+ static String aEmptyStr;
+ return aEmptyStr;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::setEntryImage( int nEntryId, const Image& rImage )
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ if( pEntry && pEntry->maImage != rImage )
+ {
+ pEntry->maImage = rImage;
+ mpImpl->maSize = implCalcSize();
+ if( IsVisible() )
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------------------
+
+const Image& ToolbarMenu::getEntryImage( int nEntryId ) const
+{
+ ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId );
+ if( pEntry )
+ return pEntry->maImage;
+ else
+ {
+ static Image aEmptyImage;
+ return aEmptyImage;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::initWindow()
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ SetControlBackground( GetSettings().GetStyleSettings().GetFaceGradientColor() );
+
+ SetPointFont( rStyleSettings.GetMenuFont() );
+ SetBackground( Wallpaper( GetControlBackground() ) );
+ SetTextColor( rStyleSettings.GetMenuTextColor() );
+ SetTextFillColor();
+ SetLineColor();
+
+ mpImpl->maSize = implCalcSize();
+}
+
+// --------------------------------------------------------------------
+
+Size ToolbarMenu::implCalcSize()
+{
+ const long nFontHeight = GetTextHeight();
+ long nExtra = nFontHeight/4;
+
+ Size aSz;
+ Size aMaxImgSz;
+ long nMaxTextWidth = 0;
+ long nMinMenuItemHeight = nFontHeight+2;
+ sal_Bool bCheckable = sal_False;
+
+ const int nEntryCount = mpImpl->maEntryVector.size();
+ int nEntry;
+
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ const bool bUseImages = rSettings.GetUseImagesInMenus();
+
+ // get maximum image size
+ if( bUseImages )
+ {
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry];
+ if( pEntry && pEntry->mbHasImage )
+ {
+ Size aImgSz( pEntry->maImage.GetSizePixel() );
+ nMinMenuItemHeight = std::max( nMinMenuItemHeight, aImgSz.Height() + 6 );
+ aMaxImgSz.Width() = std::max( aMaxImgSz.Width(), aImgSz.Width() );
+ }
+ }
+ }
+
+ mpImpl->mnCheckPos = nExtra;
+ mpImpl->mnImagePos = nExtra;
+ mpImpl->mnTextPos = mpImpl->mnImagePos + aMaxImgSz.Width();
+
+ if ( aMaxImgSz.Width() )
+ mpImpl->mnTextPos += std::max( nExtra, 7L );
+ if ( bCheckable )
+ mpImpl->mnTextPos += 16;
+
+ // set heights, calc maximum width
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry];
+
+ if( pEntry )
+ {
+ if ( ( pEntry->mnBits ) & ( MIB_RADIOCHECK | MIB_CHECKABLE ) )
+ bCheckable = sal_True;
+
+ // Text:
+ if( pEntry->mbHasText || pEntry->mbHasImage )
+ {
+ pEntry->maSize.Height() = nMinMenuItemHeight;
+
+ if( pEntry->mbHasText )
+ {
+ long nTextWidth = GetCtrlTextWidth( pEntry->maText ) + mpImpl->mnTextPos + nExtra;
+ nMaxTextWidth = std::max( nTextWidth, nMaxTextWidth );
+ }
+ }
+ // Control:
+ else if( pEntry->mpControl )
+ {
+ Size aControlSize( pEntry->mpControl->GetOutputSizePixel() );
+
+ nMaxTextWidth = std::max( aControlSize.Width(), nMaxTextWidth );
+ pEntry->maSize.Height() = aControlSize.Height() + 1;
+ }
+
+ }
+ }
+
+ aSz.Width() = nMaxTextWidth + (BORDER_X<<1);
+
+ // positionate controls
+ int nY = BORDER_Y;
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry];
+
+ if( pEntry )
+ {
+ pEntry->maSize.Width() = nMaxTextWidth;
+
+ if( pEntry->mpControl )
+ {
+ Size aControlSize( pEntry->mpControl->GetOutputSizePixel() );
+ Point aControlPos( (aSz.Width() - aControlSize.Width())>>1, nY);
+
+ pEntry->mpControl->SetPosPixel( aControlPos );
+
+ pEntry->maRect = Rectangle( aControlPos, aControlSize );
+ }
+ else
+ {
+ pEntry->maRect = Rectangle( Point( 0, nY ), pEntry->maSize );
+ }
+
+ nY += pEntry->maSize.Height();
+ }
+ else
+ {
+ nY += SEPARATOR_HEIGHT;
+ }
+ }
+
+ aSz.Height() += nY + BORDER_Y;
+
+ return aSz;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::highlightFirstEntry()
+{
+ implChangeHighlightEntry( 0 );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::GetFocus()
+{
+ if( mpImpl->mnHighlightedEntry == -1 )
+ implChangeHighlightEntry( 0 );
+
+ DockingWindow::GetFocus();
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::LoseFocus()
+{
+ if( mpImpl->mnHighlightedEntry != -1 )
+ implChangeHighlightEntry( -1 );
+
+ DockingWindow::LoseFocus();
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits )
+{
+ appendEntry( new ToolbarMenuEntry( *this, nEntryId, rStr, nItemBits ) );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits )
+{
+ appendEntry( new ToolbarMenuEntry( *this, nEntryId, rImage, nItemBits ) );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits )
+{
+ appendEntry( new ToolbarMenuEntry( *this, nEntryId, rImage, rStr, nItemBits ) );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits )
+{
+ appendEntry( new ToolbarMenuEntry( *this, nEntryId, pControl, nItemBits ) );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::appendEntry( ToolbarMenuEntry* pEntry )
+{
+ mpImpl->maEntryVector.push_back( pEntry );
+ mpImpl->maSize = implCalcSize();
+ if( IsVisible() )
+ Invalidate();
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::appendSeparator()
+{
+ appendEntry( 0 );
+}
+
+// --------------------------------------------------------------------
+
+/** creates an empty ValueSet that is initialized and can be inserted with appendEntry. */
+ValueSet* ToolbarMenu::createEmptyValueSetControl()
+{
+ ValueSet* pSet = new ValueSet( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT );
+ pSet->EnableFullItemMode( FALSE );
+ pSet->SetColor( GetControlBackground() );
+ pSet->SetHighlightHdl( LINK( this, ToolbarMenu, HighlightHdl ) );
+ return pSet;
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry* ToolbarMenu::implGetEntry( int nEntry ) const
+{
+ return mpImpl->implGetEntry( nEntry );
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry* ToolbarMenu::implSearchEntry( int nEntryId ) const
+{
+ const int nEntryCount = mpImpl->maEntryVector.size();
+ int nEntry;
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* p = mpImpl->maEntryVector[nEntry];
+ if( p && p->mnEntryId == nEntryId )
+ {
+ return p;
+ }
+ }
+
+ return NULL;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight )
+{
+ Size aSz( GetOutputSizePixel() );
+ long nX = 0, nY = 0;
+
+ const int nEntryCount = mpImpl->maEntryVector.size();
+ int nEntry;
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry];
+ if( pEntry && (nEntry == nHighlightEntry) )
+ {
+ // no highlights for controls only items
+ if( pEntry->mpControl )
+ {
+ if( !bHighlight )
+ {
+ ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl );
+ if( pValueSet )
+ {
+ pValueSet->SetNoSelection();
+ }
+ }
+ break;
+ }
+
+ bool bRestoreLineColor = false;
+ Color oldLineColor;
+ bool bDrawItemRect = true;
+
+ Rectangle aItemRect( Point( nX, nY ), Size( aSz.Width(), pEntry->maSize.Height() ) );
+ if ( pEntry->mnBits & MIB_POPUPSELECT )
+ {
+ long nFontHeight = GetTextHeight();
+ aItemRect.Right() -= nFontHeight + nFontHeight/4;
+ }
+
+ if( IsNativeControlSupported( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL ) )
+ {
+ Size aPxSize( GetOutputSizePixel() );
+ Push( PUSH_CLIPREGION );
+ IntersectClipRegion( Rectangle( Point( nX, nY ), Size( aSz.Width(), pEntry->maSize.Height() ) ) );
+ Rectangle aCtrlRect( Point( nX, 0 ), Size( aPxSize.Width()-nX, aPxSize.Height() ) );
+ DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL,
+ Region( aCtrlRect ),
+ CTRL_STATE_ENABLED,
+ ImplControlValue(),
+ OUString() );
+ if( bHighlight && IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM ) )
+ {
+ bDrawItemRect = false;
+ if( FALSE == DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_ITEM,
+ Region( aItemRect ),
+ CTRL_STATE_SELECTED | ( pEntry->mbEnabled? CTRL_STATE_ENABLED: 0 ),
+ ImplControlValue(),
+ OUString() ) )
+ {
+ bDrawItemRect = bHighlight;
+ }
+ }
+ else
+ bDrawItemRect = bHighlight;
+ Pop();
+ }
+ if( bDrawItemRect )
+ {
+ if ( bHighlight )
+ {
+ if( pEntry->mbEnabled )
+ SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() );
+ else
+ {
+ SetFillColor();
+ oldLineColor = GetLineColor();
+ SetLineColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() );
+ bRestoreLineColor = true;
+ }
+ }
+ else
+ SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() );
+
+ DrawRect( aItemRect );
+ }
+ implPaint( pEntry, bHighlight );
+ if( bRestoreLineColor )
+ SetLineColor( oldLineColor );
+ break;
+ }
+
+ nY += pEntry ? pEntry->maSize.Height() : SEPARATOR_HEIGHT;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::implSelectEntry( int nSelectedEntry )
+{
+ mpImpl->mnSelectedEntry = nSelectedEntry;
+
+ ToolbarMenuEntry* pEntry = NULL;
+ if( nSelectedEntry != -1 )
+ pEntry = mpImpl->maEntryVector[ nSelectedEntry ];
+
+ if( pEntry )
+ mpImpl->maSelectHdl.Call( this );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ implHighlightEntry( rMEvt, true );
+
+ implSelectEntry( mpImpl->mnHighlightedEntry );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::MouseButtonUp( const MouseEvent& )
+{
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( !IsVisible() )
+ return;
+
+ implHighlightEntry( rMEvt, false );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown )
+{
+ long nY = 0;
+ long nMouseY = rMEvt.GetPosPixel().Y();
+ Size aOutSz = GetOutputSizePixel();
+ if ( ( nMouseY >= 0 ) && ( nMouseY < aOutSz.Height() ) )
+ {
+ bool bHighlighted = FALSE;
+
+ const int nEntryCount = mpImpl->maEntryVector.size();
+ int nEntry;
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry];
+ if( pEntry )
+ {
+ long nOldY = nY;
+ nY += pEntry->maSize.Height();
+
+ if( pEntry->mnEntryId != TITLE_ID )
+ {
+ if ( ( nOldY <= nMouseY ) && ( nY > nMouseY ) )
+ {
+ if( bMBDown )
+ {
+ if( nEntry != mpImpl->mnHighlightedEntry )
+ {
+ implChangeHighlightEntry( nEntry );
+ }
+ }
+ else
+ {
+ if ( nEntry != mpImpl->mnHighlightedEntry )
+ {
+ implChangeHighlightEntry( nEntry );
+ }
+ }
+ bHighlighted = true;
+ }
+ }
+ }
+ else
+ {
+ nY += SEPARATOR_HEIGHT;
+ }
+ }
+ if ( !bHighlighted )
+ implChangeHighlightEntry( -1 );
+ }
+ else
+ {
+ implChangeHighlightEntry( -1 );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::implChangeHighlightEntry( int nEntry )
+{
+ if( mpImpl->mnHighlightedEntry != -1 )
+ {
+ implHighlightEntry( mpImpl->mnHighlightedEntry, false );
+ }
+
+ mpImpl->mnHighlightedEntry = nEntry;
+ Invalidate();
+
+ if( mpImpl->mnHighlightedEntry != -1 )
+ {
+ implHighlightEntry( mpImpl->mnHighlightedEntry, true );
+ }
+
+ mpImpl->notifyHighlightedEntry();
+}
+
+// --------------------------------------------------------------------
+
+static bool implCheckSubControlCursorMove( Control* pControl, bool bUp, int& nLastColumn )
+{
+ ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl );
+ if( pValueSet )
+ {
+ USHORT nItemPos = pValueSet->GetItemPos( pValueSet->GetSelectItemId() );
+ if( nItemPos != VALUESET_ITEM_NOTFOUND )
+ {
+ const USHORT nColCount = pValueSet->GetColCount();
+ const USHORT nLine = nItemPos / nColCount;
+
+ nLastColumn = nItemPos - (nLine * nColCount);
+
+ if( bUp )
+ {
+ return nLine > 0;
+ }
+ else
+ {
+ const USHORT nLineCount = (pValueSet->GetItemCount() + nColCount - 1) / nColCount;
+ return (nLine+1) < nLineCount;
+ }
+ }
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd )
+{
+ int n = 0, nLoop = 0;
+ if( !bHomeEnd )
+ {
+ n = mpImpl->mnHighlightedEntry;
+ if( n == -1 )
+ {
+ if( bUp )
+ n = 0;
+ else
+ n = mpImpl->maEntryVector.size()-1;
+ }
+ else
+ {
+ // if we have a currently selected entry and
+ // cursor keys are used than check if this entry
+ // has a control that can use those cursor keys
+ ToolbarMenuEntry* pData = mpImpl->maEntryVector[n];
+ if( pData && pData->mpControl && !pData->mbHasText )
+ {
+ if( implCheckSubControlCursorMove( pData->mpControl, bUp, mpImpl->mnLastColumn ) )
+ return pData;
+ }
+ }
+ nLoop = n;
+ }
+ else
+ {
+ // absolute positioning
+ if( bUp )
+ {
+ n = mpImpl->maEntryVector.size();
+ nLoop = n-1;
+ }
+ else
+ {
+ n = -1;
+ nLoop = mpImpl->maEntryVector.size()-1;
+ }
+ }
+
+ do
+ {
+ if( bUp )
+ {
+ if ( n )
+ n--;
+ else
+ if( mpImpl->mnHighlightedEntry == -1 )
+ n = mpImpl->maEntryVector.size()-1;
+ else
+ break;
+ }
+ else
+ {
+ if( n < ((int)mpImpl->maEntryVector.size()-1) )
+ n++;
+ else
+ if( mpImpl->mnHighlightedEntry == -1 )
+ n = 0;
+ else
+ break;
+ }
+
+ ToolbarMenuEntry* pData = mpImpl->maEntryVector[n];
+ if( pData && (pData->mnEntryId != TITLE_ID) )
+ {
+ implChangeHighlightEntry( n );
+ return pData;
+ }
+ } while ( n != nLoop );
+
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu_Impl::implHighlightControl( USHORT nCode, Control* pControl )
+{
+ ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl );
+ if( pValueSet )
+ {
+ const USHORT nItemCount = pValueSet->GetItemCount();
+ USHORT nItemPos = VALUESET_ITEM_NOTFOUND;
+ switch( nCode )
+ {
+ case KEY_UP:
+ {
+ const USHORT nColCount = pValueSet->GetColCount();
+ const USHORT nLastLine = nItemCount / nColCount;
+ nItemPos = std::min( ((nLastLine-1) * nColCount) + mnLastColumn, nItemCount-1 );
+ break;
+ }
+ case KEY_DOWN:
+ nItemPos = std::min( mnLastColumn, nItemCount-1 );
+ break;
+ case KEY_END:
+ nItemPos = nItemCount -1;
+ break;
+ case KEY_HOME:
+ nItemPos = 0;
+ break;
+ }
+ pValueSet->SelectItem( pValueSet->GetItemId( nItemPos ) );
+ notifyHighlightedEntry();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::KeyInput( const KeyEvent& rKEvent )
+{
+ Control* pForwardControl = 0;
+ USHORT nCode = rKEvent.GetKeyCode().GetCode();
+ switch ( nCode )
+ {
+ case KEY_UP:
+ case KEY_DOWN:
+ {
+ int nOldEntry = mpImpl->mnHighlightedEntry;
+ ToolbarMenuEntry*p = implCursorUpDown( nCode == KEY_UP, false );
+ if( p && p->mpControl )
+ {
+ if( nOldEntry != mpImpl->mnHighlightedEntry )
+ {
+ mpImpl->implHighlightControl( nCode, p->mpControl );
+ }
+ else
+ {
+ // in case we are in a system floating window, GrabFocus does not work :-/
+ pForwardControl = p->mpControl;
+ }
+ }
+ }
+ break;
+ case KEY_END:
+ case KEY_HOME:
+ {
+ ToolbarMenuEntry* p = implCursorUpDown( nCode == KEY_END, true );
+ if( p && p->mpControl )
+ {
+ mpImpl->implHighlightControl( nCode, p->mpControl );
+ }
+ }
+ break;
+ case KEY_F6:
+ case KEY_ESCAPE:
+ {
+ // Ctrl-F6 acts like ESC here, the menu bar however will then put the focus in the document
+ if( nCode == KEY_F6 && !rKEvent.GetKeyCode().IsMod1() )
+ break;
+
+ implSelectEntry( -1 );
+ }
+ break;
+
+ case KEY_RETURN:
+ {
+ ToolbarMenuEntry* pEntry = implGetEntry( mpImpl->mnHighlightedEntry );
+ if ( pEntry && pEntry->mbEnabled && (pEntry->mnEntryId != TITLE_ID) )
+ {
+ if( pEntry->mpControl )
+ {
+ pForwardControl = pEntry->mpControl;
+ }
+ else
+ {
+ implSelectEntry( mpImpl->mnHighlightedEntry );
+ }
+ }
+ }
+ break;
+ default:
+ {
+ ToolbarMenuEntry* pEntry = implGetEntry( mpImpl->mnHighlightedEntry );
+ if ( pEntry && pEntry->mbEnabled && pEntry->mpControl && !pEntry->mbHasText )
+ {
+ pForwardControl = pEntry->mpControl;
+ }
+ }
+
+ }
+ if( pForwardControl )
+ pForwardControl->KeyInput( rKEvent );
+
+}
+
+// --------------------------------------------------------------------
+static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRect, bool i_bHighlight )
+{
+ BOOL bNativeOk = FALSE;
+ if( i_pWindow->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) )
+ {
+ ImplControlValue aControlValue;
+ Region aCtrlRegion( i_rRect );
+ ControlState nState = CTRL_STATE_PRESSED | CTRL_STATE_ENABLED;
+
+ aControlValue.setTristateVal( BUTTONVALUE_ON );
+
+ bNativeOk = i_pWindow->DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON,
+ aCtrlRegion, nState, aControlValue,
+ rtl::OUString() );
+ }
+
+ if( ! bNativeOk )
+ {
+ const StyleSettings& rSettings = i_pWindow->GetSettings().GetStyleSettings();
+ Color aColor( i_bHighlight ? rSettings.GetMenuHighlightTextColor() : rSettings.GetHighlightColor() );
+ i_pWindow->DrawSelectionBackground( i_rRect, 0, i_bHighlight, TRUE, FALSE, 2, NULL, &aColor );
+ }
+}
+
+static long ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, long& rRadioHeight, long &rMaxWidth )
+{
+ rMaxWidth = rCheckHeight = rRadioHeight = 0;
+
+ ImplControlValue aVal;
+ Region aNativeBounds;
+ Region aNativeContent;
+ Point tmp( 0, 0 );
+ Region aCtrlRegion( Rectangle( tmp, Size( 100, 15 ) ) );
+ if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_CHECK_MARK ) )
+ {
+ if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP),
+ ControlPart(PART_MENU_ITEM_CHECK_MARK),
+ aCtrlRegion,
+ ControlState(CTRL_STATE_ENABLED),
+ aVal,
+ OUString(),
+ aNativeBounds,
+ aNativeContent )
+ )
+ {
+ rCheckHeight = aNativeBounds.GetBoundRect().GetHeight();
+ rMaxWidth = aNativeContent.GetBoundRect().GetWidth();
+ }
+ }
+ if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_RADIO_MARK ) )
+ {
+ if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP),
+ ControlPart(PART_MENU_ITEM_RADIO_MARK),
+ aCtrlRegion,
+ ControlState(CTRL_STATE_ENABLED),
+ aVal,
+ OUString(),
+ aNativeBounds,
+ aNativeContent )
+ )
+ {
+ rRadioHeight = aNativeBounds.GetBoundRect().GetHeight();
+ rMaxWidth = Max (rMaxWidth, aNativeContent.GetBoundRect().GetWidth());
+ }
+ }
+ return (rCheckHeight > rRadioHeight) ? rCheckHeight : rRadioHeight;
+}
+
+void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted )
+{
+ USHORT nBorder = 0; long nStartY = 0; // from Menu implementations, needed when we support native menu background & scrollable menu
+
+ long nFontHeight = GetTextHeight();
+// long nExtra = nFontHeight/4;
+
+ long nCheckHeight = 0, nRadioHeight = 0, nMaxCheckWidth = 0;
+ ImplGetNativeCheckAndRadioSize( this, nCheckHeight, nRadioHeight, nMaxCheckWidth );
+
+ DecorationView aDecoView( this );
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ const bool bUseImages = rSettings.GetUseImagesInMenus();
+
+ int nOuterSpace = 0; // ImplGetSVData()->maNWFData.mnMenuFormatExtraBorder;
+ Point aTopLeft( nOuterSpace, nOuterSpace ), aTmpPos;
+
+ Size aOutSz( GetOutputSizePixel() );
+ const int nEntryCount = mpImpl->maEntryVector.size();
+ int nEntry;
+ for( nEntry = 0; nEntry < nEntryCount; nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry];
+
+ Point aPos( aTopLeft );
+ aPos.Y() += nBorder;
+ aPos.Y() += nStartY;
+
+
+ if( (pEntry == 0) && !pThisOnly )
+ {
+ // Separator
+ aTmpPos.Y() = aPos.Y() + ((SEPARATOR_HEIGHT-2)/2);
+ aTmpPos.X() = aPos.X() + 2 + nOuterSpace;
+ SetLineColor( rSettings.GetShadowColor() );
+ DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) );
+ aTmpPos.Y()++;
+ SetLineColor( rSettings.GetLightColor() );
+ DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) );
+ SetLineColor();
+ }
+ else if( !pThisOnly || ( pEntry == pThisOnly ) )
+ {
+ const bool bTitle = pEntry->mnEntryId == TITLE_ID;
+
+ if ( pThisOnly && bHighlighted )
+ SetTextColor( rSettings.GetMenuHighlightTextColor() );
+
+ if( aPos.Y() >= 0 )
+ {
+ long nTextOffsetY = ((pEntry->maSize.Height()-nFontHeight)/2);
+
+ USHORT nTextStyle = 0;
+ USHORT nSymbolStyle = 0;
+ USHORT nImageStyle = 0;
+
+ if( !pEntry->mbEnabled )
+ {
+ nTextStyle |= TEXT_DRAW_DISABLE;
+ nSymbolStyle |= SYMBOL_DRAW_DISABLE;
+ nImageStyle |= IMAGE_DRAW_DISABLE;
+ }
+
+ Rectangle aOuterCheckRect( Point( aPos.X()+mpImpl->mnCheckPos, aPos.Y() ), Size( pEntry->maSize.Height(), pEntry->maSize.Height() ) );
+ aOuterCheckRect.Left() += 1;
+ aOuterCheckRect.Right() -= 1;
+ aOuterCheckRect.Top() += 1;
+ aOuterCheckRect.Bottom() -= 1;
+
+ if( bTitle )
+ {
+ // fill the background
+ Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) );
+ SetFillColor(rSettings.GetDialogColor());
+ SetLineColor();
+ DrawRect(aRect);
+ SetLineColor( rSettings.GetLightColor() );
+ DrawLine( aRect.TopLeft(), aRect.TopRight() );
+ SetLineColor( rSettings.GetShadowColor() );
+ DrawLine( aRect.BottomLeft(), aRect.BottomRight() );
+ }
+
+ // CheckMark
+ if ( pEntry->HasCheck() )
+ {
+ // draw selection transparent marker if checked
+ // onto that either a checkmark or the item image
+ // will be painted
+ // however do not do this if native checks will be painted since
+ // the selection color too often does not fit the theme's check and/or radio
+
+ if( !pEntry->mbHasImage )
+ {
+ if( this->IsNativeControlSupported( CTRL_MENU_POPUP,
+ (pEntry->mnBits & MIB_RADIOCHECK)
+ ? PART_MENU_ITEM_CHECK_MARK
+ : PART_MENU_ITEM_RADIO_MARK ) )
+ {
+ ControlPart nPart = ((pEntry->mnBits & MIB_RADIOCHECK)
+ ? PART_MENU_ITEM_RADIO_MARK
+ : PART_MENU_ITEM_CHECK_MARK);
+
+ ControlState nState = 0;
+
+ if ( pEntry->mbChecked )
+ nState |= CTRL_STATE_PRESSED;
+
+ if ( pEntry->mbEnabled )
+ nState |= CTRL_STATE_ENABLED;
+
+ if ( bHighlighted )
+ nState |= CTRL_STATE_SELECTED;
+
+ long nCtrlHeight = (pEntry->mnBits & MIB_RADIOCHECK) ? nCheckHeight : nRadioHeight;
+ aTmpPos.X() = aOuterCheckRect.Left() + (aOuterCheckRect.GetWidth() - nCtrlHeight)/2;
+ aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - nCtrlHeight)/2;
+
+ Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) );
+ DrawNativeControl( CTRL_MENU_POPUP, nPart, Region( aCheckRect ), nState, ImplControlValue(), OUString() );
+ }
+ else if ( pEntry->mbChecked ) // by default do nothing for unchecked items
+ {
+ ImplPaintCheckBackground( this, aOuterCheckRect, pThisOnly && bHighlighted );
+
+ SymbolType eSymbol;
+ Size aSymbolSize;
+ if ( pEntry->mnBits & MIB_RADIOCHECK )
+ {
+ eSymbol = SYMBOL_RADIOCHECKMARK;
+ aSymbolSize = Size( nFontHeight/2, nFontHeight/2 );
+ }
+ else
+ {
+ eSymbol = SYMBOL_CHECKMARK;
+ aSymbolSize = Size( (nFontHeight*25)/40, nFontHeight/2 );
+ }
+ aTmpPos.X() = aOuterCheckRect.Left() + (aOuterCheckRect.GetWidth() - aSymbolSize.Width())/2;
+ aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - aSymbolSize.Height())/2;
+ Rectangle aRect( aTmpPos, aSymbolSize );
+ aDecoView.DrawSymbol( aRect, eSymbol, GetTextColor(), nSymbolStyle );
+ }
+ }
+ }
+
+ // Image:
+ if( pEntry->mbHasImage && bUseImages )
+ {
+ // Don't render an image for a check thing
+ /* if((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || !pEntry->HasCheck() )*/
+ {
+ if( pEntry->mbChecked )
+ ImplPaintCheckBackground( this, aOuterCheckRect, pThisOnly && bHighlighted );
+ aTmpPos = aOuterCheckRect.TopLeft();
+ aTmpPos.X() += (aOuterCheckRect.GetWidth()-pEntry->maImage.GetSizePixel().Width())/2;
+ aTmpPos.Y() += (aOuterCheckRect.GetHeight()-pEntry->maImage.GetSizePixel().Height())/2;
+ DrawImage( aTmpPos, pEntry->maImage, nImageStyle );
+ }
+ }
+
+ // Text:
+ if( pEntry->mbHasText )
+ {
+ aTmpPos.X() = aPos.X() + (bTitle ? 4 : mpImpl->mnTextPos);
+ aTmpPos.Y() = aPos.Y();
+ aTmpPos.Y() += nTextOffsetY;
+ USHORT nStyle = nTextStyle|TEXT_DRAW_MNEMONIC;
+
+ DrawCtrlText( aTmpPos, pEntry->maText, 0, pEntry->maText.Len(), nStyle, NULL, NULL ); // pVector, pDisplayText );
+ }
+
+/*
+ // Accel
+ if ( !bLayout && !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled() )
+ {
+ XubString aAccText = pData->aAccelKey.GetName();
+ aTmpPos.X() = aOutSz.Width() - this->GetTextWidth( aAccText );
+ aTmpPos.X() -= 4*nExtra;
+
+ aTmpPos.X() -= nOuterSpace;
+ aTmpPos.Y() = aPos.Y();
+ aTmpPos.Y() += nTextOffsetY;
+ this->DrawCtrlText( aTmpPos, aAccText, 0, aAccText.Len(), nTextStyle );
+ }
+*/
+
+/*
+ // SubMenu?
+ if ( !bLayout && !bIsMenuBar && pData->pSubMenu )
+ {
+ aTmpPos.X() = aOutSz.Width() - nFontHeight + nExtra - nOuterSpace;
+ aTmpPos.Y() = aPos.Y();
+ aTmpPos.Y() += nExtra/2;
+ aTmpPos.Y() += ( pEntry->maSize.Height() / 2 ) - ( nFontHeight/4 );
+ if ( pEntry->mnBits & MIB_POPUPSELECT )
+ {
+ this->SetTextColor( rSettings.GetMenuTextColor() );
+ Point aTmpPos2( aPos );
+ aTmpPos2.X() = aOutSz.Width() - nFontHeight - nFontHeight/4;
+ aDecoView.DrawFrame(
+ Rectangle( aTmpPos2, Size( nFontHeight+nFontHeight/4, pEntry->maSize.Height() ) ), FRAME_DRAW_GROUP );
+ }
+ aDecoView.DrawSymbol(
+ Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ),
+ SYMBOL_SPIN_RIGHT, this->GetTextColor(), nSymbolStyle );
+// if ( pEntry->mnBits & MIB_POPUPSELECT )
+// {
+// aTmpPos.Y() += nFontHeight/2 ;
+// this->SetLineColor( rSettings.GetShadowColor() );
+// this->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) );
+// this->SetLineColor( rSettings.GetLightColor() );
+// aTmpPos.Y()++;
+// this->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) );
+// this->SetLineColor();
+// }
+ }
+*/
+
+ if ( pThisOnly && bHighlighted )
+ {
+ // This restores the normal menu or menu bar text
+ // color for when it is no longer highlighted.
+ SetTextColor( rSettings.GetMenuTextColor() );
+ }
+ }
+ }
+
+ aTopLeft.Y() += pEntry ? pEntry->maSize.Height() : SEPARATOR_HEIGHT;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::Paint( const Rectangle& )
+{
+ SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() );
+
+ implPaint();
+
+ if( mpImpl->mnHighlightedEntry != -1 )
+ implHighlightEntry( mpImpl->mnHighlightedEntry, true );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::RequestHelp( const HelpEvent& rHEvt )
+{
+ DockingWindow::RequestHelp( rHEvt );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::StateChanged( StateChangedType nType )
+{
+ DockingWindow::StateChanged( nType );
+
+ if ( ( nType == STATE_CHANGE_CONTROLFOREGROUND ) || ( nType == STATE_CHANGE_CONTROLBACKGROUND ) )
+ {
+ initWindow();
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ DockingWindow::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ initWindow();
+ Invalidate();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) )
+ {
+ implCursorUpDown( pData->GetDelta() > 0L, false );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+Reference< ::com::sun::star::accessibility::XAccessible > ToolbarMenu::CreateAccessible()
+{
+ mpImpl->setAccessible( new ToolbarMenuAcc( *mpImpl ) );
+ return Reference< XAccessible >( mpImpl->mxAccessible.get() );
+}
+
+// --------------------------------------------------------------------
+
+// todo: move to new base class that will replace SfxPopupWindo
+void ToolbarMenu::AddStatusListener( const rtl::OUString& rCommandURL )
+{
+ initStatusListener();
+ mpImpl->mxStatusListener->addStatusListener( rCommandURL );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::RemoveStatusListener( const rtl::OUString& rCommandURL )
+{
+ mpImpl->mxStatusListener->removeStatusListener( rCommandURL );
+}
+// --------------------------------------------------------------------
+
+
+void ToolbarMenu::UpdateStatus( const rtl::OUString& rCommandURL )
+{
+ mpImpl->mxStatusListener->updateStatus( rCommandURL );
+}
+
+// --------------------------------------------------------------------
+
+// XStatusListener (subclasses must override this one to get the status updates
+void SAL_CALL ToolbarMenu::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& /*Event*/ ) throw ( ::com::sun::star::uno::RuntimeException )
+{
+}
+
+// --------------------------------------------------------------------
+
+class ToolbarMenuStatusListener : public svt::FrameStatusListener
+{
+public:
+ ToolbarMenuStatusListener( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+ ToolbarMenu& rToolbarMenu );
+
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ ToolbarMenu* mpMenu;
+};
+
+// --------------------------------------------------------------------
+
+ToolbarMenuStatusListener::ToolbarMenuStatusListener(
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+ ToolbarMenu& rToolbarMenu )
+: svt::FrameStatusListener( xServiceManager, xFrame )
+, mpMenu( &rToolbarMenu )
+{
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuStatusListener::dispose() throw (::com::sun::star::uno::RuntimeException)
+{
+ mpMenu = 0;
+ svt::FrameStatusListener::dispose();
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuStatusListener::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException )
+{
+ if( mpMenu )
+ mpMenu->statusChanged( Event );
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::initStatusListener()
+{
+ if( !mpImpl->mxStatusListener.is() )
+ mpImpl->mxStatusListener.set( new ToolbarMenuStatusListener( mpImpl->mxServiceManager, mpImpl->mxFrame, *this ) );
+}
+
+// --------------------------------------------------------------------
+
+bool ToolbarMenu::IsInPopupMode()
+{
+ return GetDockingManager()->IsInPopupMode(this);
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::EndPopupMode()
+{
+ GetDockingManager()->EndPopupMode(this);
+}
+
+// --------------------------------------------------------------------
+
+const Size& ToolbarMenu::getMenuSize() const
+{
+ return mpImpl->maSize;
+}
+
+// --------------------------------------------------------------------
+
+void ToolbarMenu::SetSelectHdl( const Link& rLink )
+{
+ mpImpl->maSelectHdl = rLink;
+}
+
+// --------------------------------------------------------------------
+
+const Link& ToolbarMenu::GetSelectHdl() const
+{
+ return mpImpl->maSelectHdl;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XFrame > ToolbarMenu::GetFrame() const
+{
+ return mpImpl->mxFrame;
+}
+
+// --------------------------------------------------------------------
+
+
+// --------------------------------------------------------------------
+
+}
+
+
diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx
new file mode 100644
index 000000000000..020467084748
--- /dev/null
+++ b/svtools/source/control/toolbarmenuacc.cxx
@@ -0,0 +1,1003 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+
+#include <unotools/accessiblestatesethelper.hxx>
+
+#include <vcl/svapp.hxx>
+
+#include "svtools/toolbarmenu.hxx"
+
+#include "toolbarmenuimp.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+
+namespace svtools {
+
+// ------------------
+// - ToolbarMenuAcc -
+// ------------------
+
+ToolbarMenuAcc::ToolbarMenuAcc( ToolbarMenu_Impl& rParent )
+: ToolbarMenuAccComponentBase(m_aMutex)
+, mpParent( &rParent )
+, mbIsFocused(false)
+{
+ mpParent->mrMenu.AddEventListener( LINK( this, ToolbarMenuAcc, WindowEventListener ) );
+}
+
+// -----------------------------------------------------------------------------
+
+ToolbarMenuAcc::~ToolbarMenuAcc()
+{
+ if( mpParent )
+ mpParent->mrMenu.RemoveEventListener( LINK( this, ToolbarMenuAcc, WindowEventListener ) );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ToolbarMenuAcc, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
+
+ /* Ignore VCLEVENT_WINDOW_ENDPOPUPMODE, because the UNO accessibility wrapper
+ * might have been destroyed by the previous VCLEventListener (if no AT tool
+ * is running), e.g. sub-toolbars in impress.
+ */
+ if ( mpParent && pEvent && pEvent->ISA( VclWindowEvent ) && (pEvent->GetId() != VCLEVENT_WINDOW_ENDPOPUPMODE) )
+ {
+ DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "Window???" );
+ if( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
+ {
+ ProcessWindowEvent( *(VclWindowEvent*)pEvent );
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolbarMenuAcc::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ Any aOldValue, aNewValue;
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_OBJECT_DYING:
+ {
+ mpParent->mrMenu.RemoveEventListener( LINK( this, ToolbarMenuAcc, WindowEventListener ) );
+ mpParent = 0;
+ }
+ break;
+
+ case VCLEVENT_WINDOW_GETFOCUS:
+ {
+ if( !mbIsFocused )
+ {
+ mpParent->notifyHighlightedEntry();
+ mbIsFocused = true;
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ {
+ if( mbIsFocused )
+ {
+ mbIsFocused = false;
+ }
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolbarMenuAcc::FireAccessibleEvent( short nEventId, const Any& rOldValue, const Any& rNewValue )
+{
+ if( nEventId )
+ {
+ EventListenerVector aTmpListeners( mxEventListeners );
+ EventListenerVector::const_iterator aIter( aTmpListeners.begin() );
+ AccessibleEventObject aEvtObject;
+
+ aEvtObject.EventId = nEventId;
+ aEvtObject.Source = static_cast<XWeak*>(this);
+ aEvtObject.NewValue = rNewValue;
+ aEvtObject.OldValue = rOldValue;
+
+ while( aIter != aTmpListeners.end() )
+ {
+ try
+ {
+ (*aIter)->notifyEvent( aEvtObject );
+ }
+ catch( Exception& )
+ {
+ }
+
+ aIter++;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleContext > SAL_CALL ToolbarMenuAcc::getAccessibleContext() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ return this;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuAcc::getAccessibleChildCount() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+
+ return mpParent->getAccessibleChildCount();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+
+ return mpParent->getAccessibleChild(i);
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleParent() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XAccessible > xRet;
+
+ Window* pParent = mpParent->mrMenu.GetParent();
+ if( pParent )
+ xRet = pParent->GetAccessible();
+
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuAcc::getAccessibleIndexInParent() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+
+ Window* pParent = mpParent->mrMenu.GetParent();
+ if( pParent )
+ {
+ for( USHORT i = 0, nCount = pParent->GetChildCount(); i < nCount ; i++ )
+ {
+ if( pParent->GetChild( i ) == &mpParent->mrMenu )
+ return i;
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 SAL_CALL ToolbarMenuAcc::getAccessibleRole() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ return AccessibleRole::LIST;
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL ToolbarMenuAcc::getAccessibleDescription() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "ToolbarMenu" ) );
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL ToolbarMenuAcc::getAccessibleName() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ OUString aRet;
+
+ if( mpParent )
+ aRet = mpParent->mrMenu.GetAccessibleName();
+
+ if( !aRet.getLength() )
+ {
+ Window* pLabel = mpParent->mrMenu.GetLabeledBy();
+ if( pLabel && pLabel != &mpParent->mrMenu )
+ aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() );
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleRelationSet > SAL_CALL ToolbarMenuAcc::getAccessibleRelationSet() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ return Reference< XAccessibleRelationSet >();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleStateSet > SAL_CALL ToolbarMenuAcc::getAccessibleStateSet() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper();
+
+ // Set some states.
+ pStateSet->AddState (AccessibleStateType::ENABLED);
+ pStateSet->AddState (AccessibleStateType::SENSITIVE);
+ pStateSet->AddState (AccessibleStateType::SHOWING);
+ pStateSet->AddState (AccessibleStateType::VISIBLE);
+ pStateSet->AddState (AccessibleStateType::MANAGES_DESCENDANTS);
+ pStateSet->AddState (AccessibleStateType::FOCUSABLE);
+ if (mbIsFocused)
+ pStateSet->AddState (AccessibleStateType::FOCUSED);
+
+ return pStateSet;
+}
+
+// -----------------------------------------------------------------------------
+
+Locale SAL_CALL ToolbarMenuAcc::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ const ::rtl::OUString aEmptyStr;
+ Reference< XAccessible > xParent( getAccessibleParent() );
+ Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr );
+
+ if( xParent.is() )
+ {
+ Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
+
+ if( xParentContext.is() )
+ aRet = xParentContext->getLocale ();
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::addEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ if( rxListener.is() )
+ {
+ EventListenerVector::const_iterator aIter = mxEventListeners.begin();
+ bool bFound = false;
+
+ while( !bFound && ( aIter != mxEventListeners.end() ) )
+ {
+ if( *aIter == rxListener )
+ bFound = true;
+ else
+ aIter++;
+ }
+
+ if (!bFound)
+ mxEventListeners.push_back( rxListener );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::removeEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ if( rxListener.is() )
+ {
+ EventListenerVector::iterator aIter = mxEventListeners.begin();
+ bool bFound = false;
+
+ while( !bFound && ( aIter != mxEventListeners.end() ) )
+ {
+ if( *aIter == rxListener )
+ {
+ mxEventListeners.erase( aIter );
+ bFound = true;
+ }
+ else
+ aIter++;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL ToolbarMenuAcc::containsPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const awt::Rectangle aRect( getBounds() );
+ const Point aSize( aRect.Width, aRect.Height );
+ const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
+
+ return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+
+ Reference< XAccessible > xRet;
+
+ const Point aVclPoint( aPoint.X, aPoint.Y );
+
+ const int nEntryCount = mpParent->maEntryVector.size();
+ for( int nEntry = 0; (nEntry < nEntryCount) && !xRet.is(); nEntry++ )
+ {
+ ToolbarMenuEntry* pEntry = mpParent->maEntryVector[nEntry];
+ if( pEntry && pEntry->maRect.IsInside( aVclPoint ) )
+ {
+ if( pEntry->mpControl )
+ {
+ awt::Point aChildPoint( aPoint.X - pEntry->maRect.Left(), aPoint.Y - pEntry->maRect.Top() );
+ Reference< XAccessibleComponent > xComp( pEntry->GetAccessible(true), UNO_QUERY_THROW );
+ xRet = xComp->getAccessibleAtPoint(aChildPoint);
+ }
+ else
+ {
+ xRet = Reference< XAccessible >( pEntry->GetAccessible(true), UNO_QUERY );
+ }
+ }
+ }
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Rectangle SAL_CALL ToolbarMenuAcc::getBounds() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ const Point aOutPos( mpParent->mrMenu.GetPosPixel() );
+ const Size aOutSize( mpParent->mrMenu.GetOutputSizePixel() );
+ awt::Rectangle aRet;
+
+ aRet.X = aOutPos.X();
+ aRet.Y = aOutPos.Y();
+ aRet.Width = aOutSize.Width();
+ aRet.Height = aOutSize.Height();
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Point SAL_CALL ToolbarMenuAcc::getLocation() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ const Point aOutPos( mpParent->mrMenu.GetPosPixel() );
+ return awt::Point( aOutPos.X(), aOutPos.Y() );
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Point SAL_CALL ToolbarMenuAcc::getLocationOnScreen() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ const Point aScreenPos( mpParent->mrMenu.OutputToAbsoluteScreenPixel( Point() ) );
+ return awt::Point( aScreenPos.X(), aScreenPos.Y() );
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Size SAL_CALL ToolbarMenuAcc::getSize() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ const Size aOutSize( mpParent->mrMenu.GetOutputSizePixel() );
+ return awt::Size( aOutSize.Width(), aOutSize.Height() );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::grabFocus() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ mpParent->mrMenu.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL ToolbarMenuAcc::getAccessibleKeyBinding() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ return Any();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuAcc::getForeground() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ UINT32 nColor = Application::GetSettings().GetStyleSettings().GetMenuTextColor().GetColor();
+ return static_cast<sal_Int32>(nColor);
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuAcc::getBackground() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ UINT32 nColor = Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor();
+ return static_cast<sal_Int32>(nColor);
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+
+ mpParent->selectAccessibleChild( nChildIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL ToolbarMenuAcc::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+ return mpParent->isAccessibleChildSelected( nChildIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::clearAccessibleSelection() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+ mpParent->clearAccessibleSelection();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::selectAllAccessibleChildren() throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ // unsupported due to single selection only
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuAcc::getSelectedAccessibleChildCount() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ThrowIfDisposed();
+
+ return mpParent->mnHighlightedEntry != -1 ? 1 : 0;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ if( (mpParent->mnHighlightedEntry != -1) && (nSelectedChildIndex == 0) )
+ {
+ ToolbarMenuEntry* pEntry = mpParent->maEntryVector[ mpParent->mnHighlightedEntry ];
+ if( pEntry )
+ {
+ if( pEntry->mpControl )
+ {
+ Reference< XAccessibleSelection > xSel( pEntry->GetAccessible(true), UNO_QUERY_THROW );
+ return xSel->getSelectedAccessibleChild(0);
+ }
+ else
+ return Reference< XAccessible >( pEntry->GetAccessible(true), UNO_QUERY );
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ThrowIfDisposed();
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // Because of the single selection we can reset the whole selection when
+ // the specified child is currently selected.
+ if (isAccessibleChildSelected(nChildIndex))
+ mpParent->clearAccessibleSelection();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuAcc::disposing (void)
+{
+ EventListenerVector aListenerListCopy;
+
+ {
+ // Make a copy of the list and clear the original.
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard (m_aMutex);
+ aListenerListCopy = mxEventListeners;
+ mxEventListeners.clear();
+
+ // Reset the pointer to the parent. It has to be the one who has
+ // disposed us because he is dying.
+ mpParent = NULL;
+ }
+
+ // Inform all listeners that this objects is disposing.
+ EventListenerVector::const_iterator aListenerIterator (aListenerListCopy.begin());
+ EventObject aEvent (static_cast<XAccessible*>(this));
+ while(aListenerIterator != aListenerListCopy.end())
+ {
+ try
+ {
+ (*aListenerIterator)->disposing (aEvent);
+ }
+ catch( Exception& )
+ {
+ // Ignore exceptions.
+ }
+
+ ++aListenerIterator;
+ }
+}
+
+void ToolbarMenuAcc::ThrowIfDisposed (void) throw (DisposedException)
+{
+ if(rBHelper.bDisposed || rBHelper.bInDispose || !mpParent)
+ {
+ throw DisposedException ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")), static_cast<XWeak*>(this));
+ }
+}
+
+// -----------------------
+// - ToolbarMenuEntryAcc -
+// -----------------------
+
+ToolbarMenuEntryAcc::ToolbarMenuEntryAcc( ToolbarMenuEntry* pParent )
+: ToolbarMenuEntryAccBase( m_aMutex )
+, mpParent( pParent )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+ToolbarMenuEntryAcc::~ToolbarMenuEntryAcc()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ToolbarMenuEntryAcc::FireAccessibleEvent( short nEventId, const Any& rOldValue, const Any& rNewValue )
+{
+ if( nEventId )
+ {
+ EventListenerVector aTmpListeners( mxEventListeners );
+ ::std::vector< Reference< XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() );
+ AccessibleEventObject aEvtObject;
+
+ aEvtObject.EventId = nEventId;
+ aEvtObject.Source = static_cast<XWeak*>(this);
+ aEvtObject.NewValue = rNewValue;
+ aEvtObject.OldValue = rOldValue;
+
+ while( aIter != aTmpListeners.end() )
+ {
+ (*aIter)->notifyEvent( aEvtObject );
+ aIter++;
+ }
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuEntryAcc::disposing (void)
+{
+ EventListenerVector aListenerListCopy;
+
+ {
+ // Make a copy of the list and clear the original.
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard (m_aMutex);
+ aListenerListCopy = mxEventListeners;
+ mxEventListeners.clear();
+
+ // Reset the pointer to the parent. It has to be the one who has
+ // disposed us because he is dying.
+ mpParent = NULL;
+ }
+
+ // Inform all listeners that this objects is disposing.
+ EventListenerVector::const_iterator aListenerIterator (aListenerListCopy.begin());
+ EventObject aEvent (static_cast<XAccessible*>(this));
+ while(aListenerIterator != aListenerListCopy.end())
+ {
+ try
+ {
+ (*aListenerIterator)->disposing (aEvent);
+ }
+ catch( Exception& )
+ {
+ // Ignore exceptions.
+ }
+
+ ++aListenerIterator;
+ }
+}
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleContext > SAL_CALL ToolbarMenuEntryAcc::getAccessibleContext() throw (RuntimeException)
+{
+ return this;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getAccessibleChildCount() throw (RuntimeException)
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleChild( sal_Int32 ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ throw IndexOutOfBoundsException();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleParent() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XAccessible > xRet;
+
+ if( mpParent )
+ xRet = mpParent->mrMenu.GetAccessible();
+
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getAccessibleIndexInParent() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // The index defaults to -1 to indicate the child does not belong to its
+ // parent.
+ sal_Int32 nIndexInParent = -1;
+
+ if( mpParent )
+ {
+ Reference< XAccessibleContext > xParent( mpParent->mrMenu.GetAccessible(), UNO_QUERY );
+
+ if( xParent.is() )
+ {
+ Reference< XAccessible > xThis( this );
+
+ const sal_Int32 nCount = xParent->getAccessibleChildCount();
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ if( xParent->getAccessibleChild(nIndex) == xThis )
+ {
+ nIndexInParent = nIndex;
+ break;
+ }
+ }
+ }
+ }
+
+ return nIndexInParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 SAL_CALL ToolbarMenuEntryAcc::getAccessibleRole() throw (RuntimeException)
+{
+ return AccessibleRole::LIST_ITEM;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL ToolbarMenuEntryAcc::getAccessibleDescription() throw (RuntimeException)
+{
+ return ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL ToolbarMenuEntryAcc::getAccessibleName() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ String aRet;
+
+ if( mpParent )
+ {
+ aRet = mpParent->maText;
+
+ if( !aRet.Len() )
+ {
+ aRet = String( RTL_CONSTASCII_USTRINGPARAM( "Item " ) );
+ aRet += String::CreateFromInt32( mpParent->mnEntryId );
+ }
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleRelationSet > SAL_CALL ToolbarMenuEntryAcc::getAccessibleRelationSet() throw (RuntimeException)
+{
+ return Reference< XAccessibleRelationSet >();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleStateSet > SAL_CALL ToolbarMenuEntryAcc::getAccessibleStateSet() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
+
+ if( mpParent )
+ {
+ pStateSet->AddState (AccessibleStateType::ENABLED);
+ pStateSet->AddState (AccessibleStateType::SENSITIVE);
+ pStateSet->AddState (AccessibleStateType::SHOWING);
+ pStateSet->AddState (AccessibleStateType::VISIBLE);
+ pStateSet->AddState (AccessibleStateType::TRANSIENT);
+ if( mpParent->mnEntryId != TITLE_ID )
+ {
+ pStateSet->AddState( AccessibleStateType::SELECTABLE );
+
+ // SELECTED
+ if( mpParent->mrMenu.getHighlightedEntryId() == mpParent->mnEntryId )
+ pStateSet->AddState( AccessibleStateType::SELECTED );
+ }
+ }
+
+ return pStateSet;
+}
+
+// -----------------------------------------------------------------------------
+
+Locale SAL_CALL ToolbarMenuEntryAcc::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+ const ::rtl::OUString aEmptyStr;
+ Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr );
+
+ Reference< XAccessible > xParent( getAccessibleParent() );
+ if( xParent.is() )
+ {
+ Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
+
+ if( xParentContext.is() )
+ aRet = xParentContext->getLocale();
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuEntryAcc::addEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException)
+{
+ const ::vos::OGuard aGuard( maMutex );
+
+ if( rxListener.is() )
+ {
+ EventListenerVector::const_iterator aIter( mxEventListeners.begin() );
+ bool bFound = false;
+
+ while( !bFound && ( aIter != mxEventListeners.end() ) )
+ {
+ if( *aIter == rxListener )
+ bFound = true;
+ else
+ aIter++;
+ }
+
+ if (!bFound)
+ mxEventListeners.push_back( rxListener );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuEntryAcc::removeEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException)
+{
+ const ::vos::OGuard aGuard( maMutex );
+
+ if( rxListener.is() )
+ {
+ EventListenerVector::iterator aIter = mxEventListeners.begin();
+ bool bFound = false;
+
+ while( !bFound && ( aIter != mxEventListeners.end() ) )
+ {
+ if( *aIter == rxListener )
+ {
+ mxEventListeners.erase( aIter );
+ bFound = true;
+ }
+ else
+ aIter++;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL ToolbarMenuEntryAcc::containsPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ const awt::Rectangle aRect( getBounds() );
+ const Point aSize( aRect.Width, aRect.Height );
+ const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
+
+ return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
+{
+ Reference< XAccessible > xRet;
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Rectangle SAL_CALL ToolbarMenuEntryAcc::getBounds() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ awt::Rectangle aRet;
+
+ if( mpParent )
+ {
+ Rectangle aRect( mpParent->maRect );
+ Point aOrigin;
+ Rectangle aParentRect( aOrigin, mpParent->mrMenu.GetOutputSizePixel() );
+
+ aRect.Intersection( aParentRect );
+
+ aRet.X = aRect.Left();
+ aRet.Y = aRect.Top();
+ aRet.Width = aRect.GetWidth();
+ aRet.Height = aRect.GetHeight();
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Point SAL_CALL ToolbarMenuEntryAcc::getLocation() throw (RuntimeException)
+{
+ const awt::Rectangle aRect( getBounds() );
+ return awt::Point( aRect.X, aRect.Y );
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Point SAL_CALL ToolbarMenuEntryAcc::getLocationOnScreen() throw (RuntimeException)
+{
+ const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ awt::Point aRet;
+
+ if( mpParent )
+ {
+ const Point aScreenPos( mpParent->mrMenu.OutputToAbsoluteScreenPixel( mpParent->maRect.TopLeft() ) );
+
+ aRet.X = aScreenPos.X();
+ aRet.Y = aScreenPos.Y();
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Size SAL_CALL ToolbarMenuEntryAcc::getSize() throw (RuntimeException)
+{
+ const awt::Rectangle aRect( getBounds() );
+ awt::Size aRet;
+
+ aRet.Width = aRect.Width;
+ aRet.Height = aRect.Height;
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ToolbarMenuEntryAcc::grabFocus() throw (RuntimeException)
+{
+ // nothing to do
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL ToolbarMenuEntryAcc::getAccessibleKeyBinding() throw (RuntimeException)
+{
+ return Any();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getForeground( ) throw (RuntimeException)
+{
+ return static_cast<sal_Int32>(Application::GetSettings().GetStyleSettings().GetMenuTextColor().GetColor());
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getBackground( ) throw (RuntimeException)
+{
+ return static_cast<sal_Int32>(Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor());
+}
+
+}
diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx
new file mode 100644
index 000000000000..d1de4f704b76
--- /dev/null
+++ b/svtools/source/control/toolbarmenuimp.hxx
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <vos/mutex.hxx>
+#include <vcl/image.hxx>
+#include <vcl/menu.hxx>
+
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/compbase5.hxx>
+#include <comphelper/broadcasthelper.hxx>
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include <rtl/ref.hxx>
+
+#include <vector>
+
+#include "framestatuslistener.hxx"
+
+#include "svtools/valueset.hxx"
+
+namespace svtools {
+
+struct ToolbarMenu_Impl;
+class ToolbarMenu;
+class ToolbarMenuEntry;
+
+typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener > > EventListenerVector;
+typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector;
+
+const int EXTRAITEMHEIGHT = 0; // 4;
+const int SEPARATOR_HEIGHT = 4;
+const int TITLE_ID = -1;
+const int BORDER_X = 0;
+const int BORDER_Y = 0;
+
+// --------------------
+// - ToolbarMenuEntry -
+// --------------------
+
+class ToolbarMenuEntry
+{
+public:
+ ToolbarMenu& mrMenu;
+
+ int mnEntryId;
+ MenuItemBits mnBits;
+ Size maSize;
+
+ bool mbHasText;
+ bool mbHasImage;
+ bool mbChecked;
+ bool mbEnabled;
+
+ String maText;
+ Image maImage;
+ Control* mpControl;
+ Rectangle maRect;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > mxAccContext;
+
+public:
+ ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const String& rText, MenuItemBits nBits );
+ ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, MenuItemBits nBits );
+ ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits );
+ ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, Control* pControl, MenuItemBits nBits );
+ ~ToolbarMenuEntry();
+
+ void init( int nEntryId, MenuItemBits nBits );
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& GetAccessible( bool bCreate = false );
+
+ sal_Int32 getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ bool HasCheck() const
+ {
+ return mbChecked || ( mnBits & ( MIB_RADIOCHECK | MIB_CHECKABLE | MIB_AUTOCHECK ) );
+ }
+};
+
+// ---------------
+// - ToolbarMenuAcc -
+// ---------------
+
+typedef ::cppu::WeakComponentImplHelper5<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleSelection >
+ ToolbarMenuAccComponentBase;
+
+class ToolbarMenuAcc :
+ public ::comphelper::OBaseMutex,
+ public ToolbarMenuAccComponentBase
+{
+public:
+
+ ToolbarMenuAcc( ToolbarMenu_Impl& rParent );
+ ~ToolbarMenuAcc();
+
+ void FireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
+ bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
+
+public:
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ using cppu::WeakComponentImplHelper5<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleSelection>::addEventListener;
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ using cppu::WeakComponentImplHelper5<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleSelection>::removeEventListener;
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+
+private:
+ EventListenerVector mxEventListeners;
+ ToolbarMenu_Impl* mpParent;
+ /// The current FOCUSED state.
+ bool mbIsFocused;
+
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+ /** Tell all listeners that the object is dying. This callback is
+ usually called from the WeakComponentImplHelper class.
+ */
+ virtual void SAL_CALL disposing (void);
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of beeing disposed). If that is the case then
+ DisposedException is thrown to inform the (indirect) caller of the
+ foul deed.
+ */
+ void ThrowIfDisposed (void) throw (::com::sun::star::lang::DisposedException);
+};
+
+// -----------------------
+// - ToolbarMenuEntryAcc -
+// -----------------------
+
+typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent > ToolbarMenuEntryAccBase;
+
+class ToolbarMenuEntryAcc : public ::comphelper::OBaseMutex,
+ public ToolbarMenuEntryAccBase
+{
+public:
+ ToolbarMenuEntryAcc( ToolbarMenuEntry* pParent );
+ ~ToolbarMenuEntryAcc();
+
+ void FireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
+ bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ using ToolbarMenuEntryAccBase::addEventListener;
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ using ToolbarMenuEntryAccBase::removeEventListener;
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ EventListenerVector mxEventListeners;
+ ::vos::OMutex maMutex;
+ ToolbarMenuEntry* mpParent;
+
+ /** Tell all listeners that the object is dying. This callback is
+ usually called from the WeakComponentImplHelper class.
+ */
+ virtual void SAL_CALL disposing (void);
+};
+
+// -----------------------------------------------------------------------------
+
+struct ToolbarMenu_Impl
+{
+ ToolbarMenu& mrMenu;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
+ rtl::Reference< svt::FrameStatusListener > mxStatusListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceManager;
+ rtl::Reference< ToolbarMenuAcc > mxAccessible;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxOldSelection;
+
+ ToolbarMenuEntryVector maEntryVector;
+
+ int mnCheckPos;
+ int mnImagePos;
+ int mnTextPos;
+
+ int mnHighlightedEntry;
+ int mnSelectedEntry;
+ int mnLastColumn;
+
+ Size maSize;
+
+ Link maSelectHdl;
+
+ ToolbarMenu_Impl( ToolbarMenu& rMenu, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
+ ~ToolbarMenu_Impl();
+
+ void setAccessible( ToolbarMenuAcc* pAccessible );
+
+ void fireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
+ bool hasAccessibleListeners();
+
+ sal_Int32 getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( Control* pControl, sal_Int32 childIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ void selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ sal_Bool isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void clearAccessibleSelection();
+
+ ToolbarMenuEntry* implGetEntry( int nEntry ) const;
+ void notifyHighlightedEntry();
+
+ void implHighlightControl( USHORT nCode, Control* pControl );
+};
+
+}
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 6712e75aa9b4..66da5636d89c 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -976,10 +976,7 @@ sal_Int16 SAL_CALL ValueItemAcc::getAccessibleRole()
::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleDescription()
throw (uno::RuntimeException)
{
- const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- String aRet( RTL_CONSTASCII_USTRINGPARAM( "ValueSet item" ) );
-
- return aRet;
+ return ::rtl::OUString();
}
// -----------------------------------------------------------------------------
@@ -1239,7 +1236,7 @@ sal_Int32 SAL_CALL ValueItemAcc::getBackground( )
throw (uno::RuntimeException)
{
UINT32 nColor;
- if (mpParent->meType == VALUESETITEM_COLOR)
+ if (mpParent && mpParent->meType == VALUESETITEM_COLOR)
nColor = mpParent->maColor.GetColor();
else
nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx
index f74cdf00a4db..abde4a015ab8 100644..100755
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -111,6 +111,7 @@ struct ValueSet_Impl
{
::std::auto_ptr< ValueItemList > mpItemList;
bool mbIsTransientChildrenDisabled;
+ Link maHighlightHdl;
ValueSet_Impl() : mpItemList( ::std::auto_ptr< ValueItemList >( new ValueItemList() ) ),
mbIsTransientChildrenDisabled( false )
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index bb48c11c7c0b..62193eadf735 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -1418,7 +1418,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
{
USHORT nLastItem = (USHORT)mpImpl->mpItemList->Count();
USHORT nItemPos = VALUESET_ITEM_NOTFOUND;
- USHORT nCurPos;
+ USHORT nCurPos = VALUESET_ITEM_NONEITEM;
USHORT nCalcPos;
if ( !nLastItem || !ImplGetFirstItem() )
@@ -1431,8 +1431,6 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
if ( mnSelItemId )
nCurPos = GetItemPos( mnSelItemId );
- else
- nCurPos = VALUESET_ITEM_NONEITEM;
nCalcPos = nCurPos;
//switch off selection mode if key travelling is used
@@ -1528,30 +1526,20 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
nCalcPos - ( nLineCount * mnCols ));
else
{
- if( (KEY_UP == rKEvt.GetKeyCode().GetCode() ) && (GetStyle() & WB_MENUSTYLEVALUESET) )
+ if ( mpNoneItem )
{
- Window* pParent = GetParent();
- pParent->GrabFocus();
- pParent->KeyInput( rKEvt );
- break;
+ mnCurCol = nCalcPos%mnCols;
+ nItemPos = VALUESET_ITEM_NONEITEM;
}
else
{
- if ( mpNoneItem )
- {
- mnCurCol = nCalcPos%mnCols;
- nItemPos = VALUESET_ITEM_NONEITEM;
- }
+ if ( nLastItem+1 <= mnCols )
+ nItemPos = nCalcPos;
else
{
- if ( nLastItem+1 <= mnCols )
- nItemPos = nCalcPos;
- else
- {
- nItemPos = ((((nLastItem+1)/mnCols)-1)*mnCols)+(nCalcPos%mnCols);
- if ( nItemPos+mnCols <= nLastItem )
- nItemPos = nItemPos + mnCols;
- }
+ nItemPos = ((((nLastItem+1)/mnCols)-1)*mnCols)+(nCalcPos%mnCols);
+ if ( nItemPos+mnCols <= nLastItem )
+ nItemPos = nItemPos + mnCols;
}
}
}
@@ -1580,6 +1568,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
nCalcPos + ( nLineCount * mnCols ));
else
{
+#if 0
if( (KEY_DOWN == rKEvt.GetKeyCode().GetCode() ) && (GetStyle() & WB_MENUSTYLEVALUESET) )
{
Window* pParent = GetParent();
@@ -1588,6 +1577,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
break;
}
else
+#endif
{
if ( mpNoneItem )
{
@@ -1620,7 +1610,6 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
bDefault = TRUE;
break;
}
-
if(!bDefault)
EndSelection();
if ( nItemPos != VALUESET_ITEM_NOTFOUND )
@@ -1630,6 +1619,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
nItemId = GetItemId( nItemPos );
else
nItemId = 0;
+
if ( nItemId != mnSelItemId )
{
SelectItem( nItemId );
@@ -2278,6 +2268,7 @@ void ValueSet::SelectItem( USHORT nItemId )
::com::sun::star::uno::Any aOldAny, aNewAny;
ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::SELECTION_CHANGED, aOldAny, aNewAny );
}
+ mpImpl->maHighlightHdl.Call(this);
}
}
@@ -2749,3 +2740,19 @@ bool ValueSet::IsRTLActive (void)
return Application::GetSettings().GetLayoutRTL() && IsRTLEnabled();
}
+// -----------------------------------------------------------------------
+
+void ValueSet::SetHighlightHdl( const Link& rLink )
+{
+ mpImpl->maHighlightHdl = rLink;
+}
+
+// -----------------------------------------------------------------------
+
+const Link& ValueSet::GetHighlightHdl() const
+{
+ return mpImpl->maHighlightHdl;
+}
+
+// -----------------------------------------------------------------------
+
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 2849ddb71d10..9a66230f012c 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -36,7 +36,7 @@
#include "addresstemplate.hrc"
#endif
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#ifndef _SVT_HELPID_HRC
#include <svtools/helpid.hrc>
diff --git a/svtools/source/dialogs/addresstemplate.src b/svtools/source/dialogs/addresstemplate.src
index f4812f8b7566..0652dfb9d0f5 100644
--- a/svtools/source/dialogs/addresstemplate.src
+++ b/svtools/source/dialogs/addresstemplate.src
@@ -26,7 +26,7 @@
************************************************************************/
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#ifndef _SVT_ADDRESSTEMPLATE_HRC_
#include "addresstemplate.hrc"
diff --git a/svtools/source/dialogs/logindlg.cxx b/svtools/source/dialogs/logindlg.cxx
index c9edf632d2ec..036d5d71a4cf 100644
--- a/svtools/source/dialogs/logindlg.cxx
+++ b/svtools/source/dialogs/logindlg.cxx
@@ -35,7 +35,7 @@
#include "logindlg.hrc"
#endif
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#include <svtools/svtdata.hxx>
diff --git a/svtools/source/dialogs/logindlg.src b/svtools/source/dialogs/logindlg.src
index 338b608ab0e4..f6e3565d8cd9 100644
--- a/svtools/source/dialogs/logindlg.src
+++ b/svtools/source/dialogs/logindlg.src
@@ -26,7 +26,7 @@
************************************************************************/
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#ifndef _SVTOOLS_LOGINDLG_HRC_
diff --git a/svtools/source/dialogs/printdlg.hrc b/svtools/source/dialogs/printdlg.hrc
index ef780acbb47c..83b7b0b28c82 100644
--- a/svtools/source/dialogs/printdlg.hrc
+++ b/svtools/source/dialogs/printdlg.hrc
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#define FL_PRINTER 1
#define LB_NAMES 2
diff --git a/svtools/source/dialogs/prnsetup.hrc b/svtools/source/dialogs/prnsetup.hrc
index 7d10c4652d45..4a06c3cf0e63 100644
--- a/svtools/source/dialogs/prnsetup.hrc
+++ b/svtools/source/dialogs/prnsetup.hrc
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#define FL_PRINTER 1
#define LB_NAMES 2
diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx
index 2c71e60e8101..c28cfe1d4b18 100644
--- a/svtools/source/dialogs/roadmapwizard.cxx
+++ b/svtools/source/dialogs/roadmapwizard.cxx
@@ -29,7 +29,7 @@
#include "precompiled_svtools.hxx"
#include <svtools/roadmapwizard.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/svtdata.hxx>
#include "roadmap.hxx"
#include <tools/debug.hxx>
@@ -182,7 +182,21 @@ namespace svt
,m_pImpl( new RoadmapWizardImpl )
{
DBG_CTOR( RoadmapWizard, CheckInvariants );
+ impl_construct();
+ }
+
+ //--------------------------------------------------------------------
+ RoadmapWizard::RoadmapWizard( Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags )
+ :OWizardMachine( _pParent, i_nStyle, _nButtonFlags )
+ ,m_pImpl( new RoadmapWizardImpl )
+ {
+ DBG_CTOR( RoadmapWizard, CheckInvariants );
+ impl_construct();
+ }
+ //--------------------------------------------------------------------
+ void RoadmapWizard::impl_construct()
+ {
SetLeftAlignedButtonCount( 1 );
SetEmptyViewMargin();
@@ -328,15 +342,16 @@ namespace svt
if ( (sal_Int32)aNewPathPos->second.size() <= nCurrentStatePathIndex )
return;
-#if OSL_DEBUG_LEVEL > 0
// assert that the current and the new path are equal, up to nCurrentStatePathIndex
Paths::const_iterator aActivePathPos = m_pImpl->aPaths.find( m_pImpl->nActivePath );
if ( aActivePathPos != m_pImpl->aPaths.end() )
{
- DBG_ASSERT( m_pImpl->getFirstDifferentIndex( aActivePathPos->second, aNewPathPos->second ) > nCurrentStatePathIndex,
- "RoadmapWizard::activate: you cannot activate a path which conflicts with the current one *before* the current state!" );
+ if ( m_pImpl->getFirstDifferentIndex( aActivePathPos->second, aNewPathPos->second ) <= nCurrentStatePathIndex )
+ {
+ OSL_ENSURE( false, "RoadmapWizard::activate: you cannot activate a path which conflicts with the current one *before* the current state!" );
+ return;
+ }
}
-#endif
m_pImpl->nActivePath = _nPathId;
m_pImpl->bActivePathIsDefinite = _bDecideForIt;
@@ -383,8 +398,14 @@ namespace svt
}
// can we advance from the current page?
- const OWizardPage* pCurrentPage = dynamic_cast< const OWizardPage* >( GetPage( getCurrentState() ) );
- const bool bCurrentPageCanAdvance = !pCurrentPage || pCurrentPage->canAdvance();
+ bool bCurrentPageCanAdvance = true;
+ TabPage* pCurrentPage = GetPage( getCurrentState() );
+ if ( pCurrentPage )
+ {
+ const IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
+ OSL_ENSURE( pController != NULL, "RoadmapWizard::implUpdateRoadmap: no controller for the current page!" );
+ bCurrentPageCanAdvance = !pController || pController->canAdvance();
+ }
// now, we have to remove all items after nCurrentStatePathIndex, and insert the items from the active
// path, up to (excluding) nUpperStepBoundary
@@ -641,11 +662,33 @@ namespace svt
// if the state is currently in the roadmap, reflect it's new status
m_pImpl->pRoadmap->EnableRoadmapItem( (RoadmapTypes::ItemId)_nState, _bEnable );
}
+
+ //--------------------------------------------------------------------
+ bool RoadmapWizard::knowsState( WizardState i_nState ) const
+ {
+ for ( Paths::const_iterator path = m_pImpl->aPaths.begin();
+ path != m_pImpl->aPaths.end();
+ ++path
+ )
+ {
+ for ( WizardPath::const_iterator state = path->second.begin();
+ state != path->second.end();
+ ++state
+ )
+ {
+ if ( *state == i_nState )
+ return true;
+ }
+ }
+ return false;
+ }
+
//--------------------------------------------------------------------
bool RoadmapWizard::isStateEnabled( WizardState _nState ) const
{
return m_pImpl->aDisabledStates.find( _nState ) == m_pImpl->aDisabledStates.end();
}
+
//--------------------------------------------------------------------
void RoadmapWizard::Resize()
{
diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx
index 6a09f85036fd..2053da80019d 100644
--- a/svtools/source/dialogs/wizardmachine.cxx
+++ b/svtools/source/dialogs/wizardmachine.cxx
@@ -30,10 +30,11 @@
#include <svtools/wizardmachine.hxx>
#include <svtools/helpid.hrc>
#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
#include <vcl/msgbox.hxx>
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
//.........................................................................
@@ -101,7 +102,7 @@ namespace svt
}
//---------------------------------------------------------------------
- sal_Bool OWizardPage::commitPage( CommitPageReason )
+ sal_Bool OWizardPage::commitPage( WizardTypes::CommitPageReason )
{
return sal_True;
}
@@ -161,6 +162,25 @@ namespace svt
,m_pHelp(NULL)
,m_pImpl( new WizardMachineImplData )
{
+ implConstruct( _nButtonFlags );
+ }
+
+ //---------------------------------------------------------------------
+ OWizardMachine::OWizardMachine(Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags )
+ :WizardDialog( _pParent, i_nStyle )
+ ,m_pFinish(NULL)
+ ,m_pCancel(NULL)
+ ,m_pNextPage(NULL)
+ ,m_pPrevPage(NULL)
+ ,m_pHelp(NULL)
+ ,m_pImpl( new WizardMachineImplData )
+ {
+ implConstruct( _nButtonFlags );
+ }
+
+ //---------------------------------------------------------------------
+ void OWizardMachine::implConstruct( const sal_uInt32 _nButtonFlags )
+ {
m_pImpl->sTitleBase = GetText();
// create the buttons according to the wizard button flags
@@ -225,8 +245,6 @@ namespace svt
AddButton( m_pCancel, WIZARDDIALOG_BUTTON_STDOFFSET_X );
}
-
-
}
//---------------------------------------------------------------------
@@ -274,35 +292,42 @@ namespace svt
}
//---------------------------------------------------------------------
- void OWizardMachine::ActivatePage()
+ TabPage* OWizardMachine::GetOrCreatePage( const WizardState i_nState )
{
- WizardDialog::ActivatePage();
-
- WizardState nCurrentLevel = GetCurLevel();
- if (NULL == GetPage(nCurrentLevel))
+ if ( NULL == GetPage( i_nState ) )
{
- TabPage* pNewPage = createPage(nCurrentLevel);
- DBG_ASSERT(pNewPage, "OWizardMachine::ActivatePage: invalid new page (NULL)!");
+ TabPage* pNewPage = createPage( i_nState );
+ DBG_ASSERT( pNewPage, "OWizardMachine::GetOrCreatePage: invalid new page (NULL)!" );
// fill up the page sequence of our base class (with dummies)
- while (m_pImpl->nFirstUnknownPage < nCurrentLevel)
+ while ( m_pImpl->nFirstUnknownPage < i_nState )
{
- AddPage(NULL);
+ AddPage( NULL );
++m_pImpl->nFirstUnknownPage;
}
- if (m_pImpl->nFirstUnknownPage == nCurrentLevel)
+ if ( m_pImpl->nFirstUnknownPage == i_nState )
{
// encountered this page number the first time
- AddPage(pNewPage);
+ AddPage( pNewPage );
++m_pImpl->nFirstUnknownPage;
}
else
// already had this page - just change it
- SetPage(nCurrentLevel, pNewPage);
+ SetPage( i_nState, pNewPage );
}
+ return GetPage( i_nState );
+ }
- enterState(nCurrentLevel);
+ //---------------------------------------------------------------------
+ void OWizardMachine::ActivatePage()
+ {
+ WizardDialog::ActivatePage();
+
+ WizardState nCurrentLevel = GetCurLevel();
+ GetOrCreatePage( nCurrentLevel );
+
+ enterState( nCurrentLevel );
}
//---------------------------------------------------------------------
@@ -330,8 +355,10 @@ namespace svt
if (m_pCancel && (_nWizardButtonFlags & WZB_CANCEL))
pNewDefButton = m_pCancel;
- if (pNewDefButton)
- defaultButton(pNewDefButton);
+ if ( pNewDefButton )
+ defaultButton( pNewDefButton );
+ else
+ implResetDefault( this );
}
//---------------------------------------------------------------------
@@ -395,9 +422,10 @@ namespace svt
void OWizardMachine::enterState(WizardState _nState)
{
// tell the page
- IWizardPage* pCurrentPage = getWizardPage(GetPage(_nState));
- if ( pCurrentPage )
- pCurrentPage->initializePage();
+ IWizardPageController* pController = getPageController( GetPage( _nState ) );
+ OSL_ENSURE( pController, "OWizardMachine::enterState: no controller for the given page!" );
+ if ( pController )
+ pController->initializePage();
if ( isAutomaticNextButtonStateEnabled() )
enableButtons( WZB_NEXT, canAdvance() );
@@ -419,9 +447,9 @@ namespace svt
}
//---------------------------------------------------------------------
- sal_Bool OWizardMachine::onFinish(sal_Int32 _nResult)
+ sal_Bool OWizardMachine::onFinish()
{
- return Finnish(_nResult);
+ return Finnish( RET_OK );
}
//---------------------------------------------------------------------
@@ -434,8 +462,7 @@ namespace svt
{
return 0L;
}
- long nRet = onFinish( RET_OK );
- return nRet;
+ return onFinish() ? 1L : 0L;
}
//---------------------------------------------------------------------
@@ -447,10 +474,9 @@ namespace svt
//---------------------------------------------------------------------
sal_Bool OWizardMachine::prepareLeaveCurrentState( CommitPageReason _eReason )
{
- IWizardPage* pCurrentPage = getWizardPage(GetPage(getCurrentState()));
- if ( pCurrentPage )
- return pCurrentPage->commitPage( _eReason );
- return sal_True;
+ IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
+ ENSURE_OR_RETURN( pController != NULL, "OWizardMachine::prepareLeaveCurrentState: no controller for the current page!", sal_True );
+ return pController->commitPage( _eReason );
}
//---------------------------------------------------------------------
@@ -664,10 +690,10 @@ namespace svt
}
//---------------------------------------------------------------------
- IWizardPage* OWizardMachine::getWizardPage(TabPage* _pCurrentPage) const
+ IWizardPageController* OWizardMachine::getPageController( TabPage* _pCurrentPage ) const
{
- OWizardPage* pPage = dynamic_cast< OWizardPage* >( _pCurrentPage );
- return pPage;
+ IWizardPageController* pController = dynamic_cast< IWizardPageController* >( _pCurrentPage );
+ return pController;
}
//---------------------------------------------------------------------
@@ -690,11 +716,12 @@ namespace svt
//---------------------------------------------------------------------
void OWizardMachine::updateTravelUI()
{
- OWizardPage* pPage = dynamic_cast< OWizardPage* >( GetPage( getCurrentState() ) );
+ const IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
+ OSL_ENSURE( pController != NULL, "RoadmapWizard::updateTravelUI: no controller for the current page!" );
bool bCanAdvance =
- ( !pPage || pPage->canAdvance() ) // the current page allows to advance
- && canAdvance(); // the dialog as a whole allows to advance
+ ( !pController || pController->canAdvance() ) // the current page allows to advance
+ && canAdvance(); // the dialog as a whole allows to advance
enableButtons( WZB_NEXT, bCanAdvance );
}
diff --git a/svtools/source/dialogs/wizardmachine.src b/svtools/source/dialogs/wizardmachine.src
index c3570335773f..9c82ea30071f 100644
--- a/svtools/source/dialogs/wizardmachine.src
+++ b/svtools/source/dialogs/wizardmachine.src
@@ -26,7 +26,7 @@
************************************************************************/
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
String STR_WIZDLG_FINISH
diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hrc b/svtools/source/filter.vcl/filter/dlgejpg.hrc
index 523a1d9553f1..90a3c1d162be 100644
--- a/svtools/source/filter.vcl/filter/dlgejpg.hrc
+++ b/svtools/source/filter.vcl/filter/dlgejpg.hrc
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#define BTN_OK 1
#define BTN_CANCEL 1
diff --git a/svtools/source/filter.vcl/filter/dlgepng.hrc b/svtools/source/filter.vcl/filter/dlgepng.hrc
index 4a05771534ab..b3ffaab3ab1e 100644
--- a/svtools/source/filter.vcl/filter/dlgepng.hrc
+++ b/svtools/source/filter.vcl/filter/dlgepng.hrc
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#define BTN_OK 1
#define BTN_CANCEL 1
diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hrc b/svtools/source/filter.vcl/filter/dlgexpor.hrc
index 2e5377ce4fcb..69870c9b00b0 100644
--- a/svtools/source/filter.vcl/filter/dlgexpor.hrc
+++ b/svtools/source/filter.vcl/filter/dlgexpor.hrc
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#define BTN_OK_PIX 1
#define BTN_CANCEL_PIX 1
diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx
index e8121f1d7e94..c8a79d3a35cd 100644
--- a/svtools/source/filter.vcl/filter/filter.cxx
+++ b/svtools/source/filter.vcl/filter/filter.cxx
@@ -992,7 +992,8 @@ namespace { struct Cache : public rtl::Static<ImpFilterLibCache, Cache> {}; }
// -----------------
GraphicFilter::GraphicFilter( sal_Bool bConfig ) :
- bUseConfig ( bConfig )
+ bUseConfig ( bConfig ),
+ nExpGraphHint ( 0 )
{
ImplInit();
}
@@ -1678,6 +1679,7 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat
USHORT nFormatCount = GetExportFormatCount();
ResetLastError();
+ nExpGraphHint = 0;
if( nFormat == GRFILTER_FORMAT_DONTKNOW )
{
@@ -1850,8 +1852,10 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat
}
else if( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) )
{
- if( !ExportJPEG( rOStm, aGraphic, pFilterData ) )
+ bool bExportedGrayJPEG = false;
+ if( !ExportJPEG( rOStm, aGraphic, pFilterData, &bExportedGrayJPEG ) )
nStatus = GRFILTER_FORMATERROR;
+ nExpGraphHint = bExportedGrayJPEG ? GRFILTER_OUTHINT_GREY : 0;
if( rOStm.GetError() )
nStatus = GRFILTER_IOERROR;
diff --git a/svtools/source/filter.vcl/filter/strings.hrc b/svtools/source/filter.vcl/filter/strings.hrc
index ac162bff09f4..0eea67fb2338 100644
--- a/svtools/source/filter.vcl/filter/strings.hrc
+++ b/svtools/source/filter.vcl/filter/strings.hrc
@@ -24,4 +24,4 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
diff --git a/svtools/source/filter.vcl/jpeg/jpeg.cxx b/svtools/source/filter.vcl/jpeg/jpeg.cxx
index 7fd2e09a82dd..a2de92171af3 100644
--- a/svtools/source/filter.vcl/jpeg/jpeg.cxx
+++ b/svtools/source/filter.vcl/jpeg/jpeg.cxx
@@ -590,10 +590,11 @@ ReadState JPEGReader::Read( Graphic& rGraphic )
// - JPEGWriter -
// --------------
-JPEGWriter::JPEGWriter( SvStream& rStm, const uno::Sequence< beans::PropertyValue >* pFilterData ) :
+JPEGWriter::JPEGWriter( SvStream& rStm, const uno::Sequence< beans::PropertyValue >* pFilterData, bool* pExportWasGrey ) :
rOStm ( rStm ),
pAcc ( NULL ),
- pBuffer ( NULL )
+ pBuffer ( NULL ),
+ pExpWasGrey ( pExportWasGrey )
{
FilterConfigItem aConfigItem( (uno::Sequence< beans::PropertyValue >*)pFilterData );
bGreys = aConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), 0 ) != 0;
@@ -704,6 +705,9 @@ BOOL JPEGWriter::Write( const Graphic& rGraphic )
bGreys = sal_True;
}
+ if( pExpWasGrey )
+ *pExpWasGrey = bGreys;
+
if( pAcc )
{
bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB );
@@ -765,8 +769,11 @@ BOOL ImportJPEG( SvStream& rStm, Graphic& rGraphic, void* pCallerData, sal_Int32
// - ExportJPEG -
// --------------
-BOOL ExportJPEG( SvStream& rOStm, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData )
+BOOL ExportJPEG( SvStream& rOStm, const Graphic& rGraphic,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData,
+ bool* pExportWasGrey
+ )
{
- JPEGWriter aJPEGWriter( rOStm, pFilterData );
+ JPEGWriter aJPEGWriter( rOStm, pFilterData, pExportWasGrey );
return aJPEGWriter.Write( rGraphic );
}
diff --git a/svtools/source/inc/iodlg.hrc b/svtools/source/inc/iodlg.hrc
index 918e47f849b4..e78e3fb687fe 100644
--- a/svtools/source/inc/iodlg.hrc
+++ b/svtools/source/inc/iodlg.hrc
@@ -29,7 +29,7 @@
#define _SVTOOLS_IODLGIMPL_HRC
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
// ModalDialog DLG_SVT_EXPLORERFILE
diff --git a/svtools/source/inc/jpeg.hxx b/svtools/source/inc/jpeg.hxx
index 906bcd9ea2de..9923190c5e21 100644
--- a/svtools/source/inc/jpeg.hxx
+++ b/svtools/source/inc/jpeg.hxx
@@ -99,13 +99,16 @@ class JPEGWriter
sal_Bool bGreys;
sal_Int32 nQuality;
+ bool* pExpWasGrey;
+
com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
public:
void* GetScanline( long nY );
- JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData );
+ JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData,
+ bool* pExportWasGrey = NULL );
~JPEGWriter() {};
BOOL Write( const Graphic& rGraphic );
@@ -119,6 +122,10 @@ public:
BOOL ImportJPEG( SvStream& rStream, Graphic& rGraphic, void* pCallerData, sal_Int32 nImportFlags );
-BOOL ExportJPEG( SvStream& rStream, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData );
+BOOL ExportJPEG( SvStream& rStream,
+ const Graphic& rGraphic,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData,
+ bool* pExportWasGrey = NULL
+ );
#endif // _JPEG_HXX
diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx
index cde986b3cb7d..92b9f960b65c 100644
--- a/svtools/source/inc/svimpbox.hxx
+++ b/svtools/source/inc/svimpbox.hxx
@@ -340,7 +340,7 @@ public:
const Size& GetOutputSize() const { return aOutputSize;}
void KeyUp( BOOL bPageUp, BOOL bNotifyScroll = TRUE );
void KeyDown( BOOL bPageDown, BOOL bNotifyScroll = TRUE );
- void Command( const CommandEvent& rCEvt );
+ bool Command( const CommandEvent& rCEvt );
void Invalidate();
void DestroyAnchor() { pAnchor=0; aSelEng.Reset(); }
diff --git a/svtools/source/java/javaerror.src b/svtools/source/java/javaerror.src
index e16992a3473d..d5990c05a663 100644
--- a/svtools/source/java/javaerror.src
+++ b/svtools/source/java/javaerror.src
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
WarningBox WARNINGBOX_JAVANOTFOUND
{
diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx
index 3dde9c33cd48..ec34ed07f25d 100644
--- a/svtools/source/java/javainteractionhandler.cxx
+++ b/svtools/source/java/javainteractionhandler.cxx
@@ -30,7 +30,7 @@
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <tools/resid.hxx>
#include <com/sun/star/task/XInteractionContinuation.hpp>
#include <com/sun/star/task/XInteractionAbort.hpp>
diff --git a/svtools/source/java/patchjavaerror.src b/svtools/source/java/patchjavaerror.src
index e16992a3473d..d5990c05a663 100644
--- a/svtools/source/java/patchjavaerror.src
+++ b/svtools/source/java/patchjavaerror.src
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
WarningBox WARNINGBOX_JAVANOTFOUND
{
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index cf476098056b..bf9e87d33a74 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -42,7 +42,7 @@
#include <svtools/ehdl.hxx>
#include <svtools/svtdata.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include "sfxecode.hxx"
//=========================================================================
diff --git a/svtools/source/misc/ehdl.src b/svtools/source/misc/ehdl.src
index 55ab99b93bdf..436e06b7f3c5 100644
--- a/svtools/source/misc/ehdl.src
+++ b/svtools/source/misc/ehdl.src
@@ -26,7 +26,7 @@
************************************************************************/
#define __RSC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include "sfxecode.hxx"
// pragma ----------------------------------------------------------------
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index f606e1e2e4b1..3aa0016c225e 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -30,7 +30,7 @@
#include <svtools/embedhlp.hxx>
#include <svtools/filter.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <comphelper/embeddedobjectcontainer.hxx>
diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src
index 4e9a316308e0..6c1a90ae6412 100644
--- a/svtools/source/misc/errtxt.src
+++ b/svtools/source/misc/errtxt.src
@@ -26,7 +26,7 @@
************************************************************************/
#define __RSC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include "sfxecode.hxx"
// pragma ----------------------------------------------------------------
Resource RID_ERRCTX
diff --git a/svtools/source/misc/helpagent.src b/svtools/source/misc/helpagent.src
index c649c1f17a40..1f2eaaa291a3 100644
--- a/svtools/source/misc/helpagent.src
+++ b/svtools/source/misc/helpagent.src
@@ -26,7 +26,7 @@
************************************************************************/
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
Bitmap BMP_HELP_AGENT_IMAGE
diff --git a/svtools/source/misc/helpagentwindow.cxx b/svtools/source/misc/helpagentwindow.cxx
index 55800a213a2e..1d407bbdb611 100644
--- a/svtools/source/misc/helpagentwindow.cxx
+++ b/svtools/source/misc/helpagentwindow.cxx
@@ -36,7 +36,7 @@
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#ifndef _SVT_HELPID_HRC
#include <svtools/helpid.hrc>
diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx
index 391ad02e6aa1..c02ebc4477c6 100644
--- a/svtools/source/misc/imagemgr.cxx
+++ b/svtools/source/misc/imagemgr.cxx
@@ -52,7 +52,7 @@
#include <rtl/logfile.hxx>
#include <unotools/configmgr.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include "imagemgr.hrc"
#include <svtools/svtdata.hxx>
#include <vos/mutex.hxx>
diff --git a/svtools/source/misc/imagemgr.src b/svtools/source/misc/imagemgr.src
index 0664cdc6bc87..cdc9f8da1c87 100644
--- a/svtools/source/misc/imagemgr.src
+++ b/svtools/source/misc/imagemgr.src
@@ -26,7 +26,7 @@
************************************************************************/
// includes ******************************************************************
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include "imagemgr.hrc"
// images ********************************************************************
diff --git a/svtools/source/misc/imageresourceaccess.cxx b/svtools/source/misc/imageresourceaccess.cxx
index a4f19d9e004a..436c3f721833 100644
--- a/svtools/source/misc/imageresourceaccess.cxx
+++ b/svtools/source/misc/imageresourceaccess.cxx
@@ -48,8 +48,6 @@ namespace svt
{
//........................................................................
-#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
-
using namespace ::utl;
using namespace ::comphelper;
using namespace ::com::sun::star::io;
@@ -141,8 +139,14 @@ namespace svt
//--------------------------------------------------------------------
bool GraphicAccess::isSupportedURL( const ::rtl::OUString& _rURL )
{
- ::rtl::OUString sIndicator( RTL_CONSTASCII_USTRINGPARAM( "private:resource/" ) );
- return ( ( _rURL.indexOf( sIndicator ) == 0 ) || ( _rURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 ) );
+ if ( ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/" ) ) == 0 )
+ || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:graphicrepository/" ) ) == 0 )
+ || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:standardimage/" ) ) == 0 )
+ || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) == 0 )
+ || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.extension://" ) ) == 0 )
+ )
+ return true;
+ return false;
}
//--------------------------------------------------------------------
diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx
index b656dbf501c4..d1ff94572a99 100755..100644
--- a/svtools/source/misc/langtab.cxx
+++ b/svtools/source/misc/langtab.cxx
@@ -39,7 +39,7 @@
#include <i18npool/lang.h>
#include <i18npool/mslangid.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <svtools/langtab.hxx>
#include <unotools/syslocale.hxx>
diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src
index 39f9362e3940..1cb20d27fc12 100644
--- a/svtools/source/misc/langtab.src
+++ b/svtools/source/misc/langtab.src
@@ -26,7 +26,7 @@
************************************************************************/
// include ---------------------------------------------------------------
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#define RSC_RESOURCE_USAGE 1
#include <i18npool/lang.h>
@@ -138,7 +138,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE
< "Lithuanian" ; LANGUAGE_LITHUANIAN ; > ;
< "Macedonian" ; LANGUAGE_MACEDONIAN ; > ;
< "Malay (Malaysia)" ; LANGUAGE_MALAY_MALAYSIA ; > ;
- < "Malay (Brunei Darusalam)" ; LANGUAGE_MALAY_BRUNEI_DARUSSALAM ; > ;
+ < "Malay (Brunei Darussalam)" ; LANGUAGE_MALAY_BRUNEI_DARUSSALAM ; > ;
< "Malayalam" ; LANGUAGE_MALAYALAM ; > ;
< "Manipuri" ; LANGUAGE_MANIPURI ; > ;
< "Marathi" ; LANGUAGE_MARATHI ; > ;
diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx
index 1a8284642698..b20863db3208 100644..100755
--- a/svtools/source/misc/svtaccessiblefactory.cxx
+++ b/svtools/source/misc/svtaccessiblefactory.cxx
@@ -209,6 +209,24 @@ namespace svt
{
return NULL;
}
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleToolPanelDeck(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*i_rAccessibleParent*/,
+ ::svt::ToolPanelDeck& /*i_rPanelDeck*/
+ )
+ {
+ return NULL;
+ }
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleToolPanelTabBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*i_rAccessibleParent*/,
+ ::svt::IToolPanelDeck& /*i_rPanelDeck*/,
+ ::svt::PanelTabBar& /*i_rTabBar*/
+ )
+ {
+ return NULL;
+ }
};
//----------------------------------------------------------------
diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx
index 4a5db9cf47c4..39629f5c3f77 100644
--- a/svtools/source/productregistration/productregistration.cxx
+++ b/svtools/source/productregistration/productregistration.cxx
@@ -32,7 +32,7 @@
#include "unotools/regoptions.hxx"
#include "registrationdlg.hxx"
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#include "cppuhelper/factory.hxx"
#include <cppuhelper/implbase1.hxx>
diff --git a/svtools/source/productregistration/registrationdlg.cxx b/svtools/source/productregistration/registrationdlg.cxx
index 93b7e5c88462..460cedb060d1 100644
--- a/svtools/source/productregistration/registrationdlg.cxx
+++ b/svtools/source/productregistration/registrationdlg.cxx
@@ -32,7 +32,7 @@
#if 0 /* @@@ */
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#endif /* @@@ */
diff --git a/svtools/source/productregistration/registrationdlg.src b/svtools/source/productregistration/registrationdlg.src
index e0598ab05e60..c4cdcbcbe3ec 100644
--- a/svtools/source/productregistration/registrationdlg.src
+++ b/svtools/source/productregistration/registrationdlg.src
@@ -29,7 +29,7 @@
#include "registrationdlg.hrc"
#endif
#ifndef _SVTOOLS_HRC
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#endif
#ifndef _SVT_HELPID_HRC
#include <svtools/helpid.hrc>
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index 418348c81b7d..1770bfd7dd02 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -76,6 +76,11 @@ namespace svt { namespace table
aTableData->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) );
aTableData->SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) );
m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl());
+
+ // by default, use the background as determined by the style settings
+ const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
+ SetBackground( Wallpaper( aWindowColor ) );
+ SetFillColor( aWindowColor );
}
//--------------------------------------------------------------------
@@ -120,6 +125,39 @@ namespace svt { namespace table
}
}
}
+
+
+ //--------------------------------------------------------------------
+ void TableControl::StateChanged( StateChangedType i_nStateChange )
+ {
+ Control::StateChanged( i_nStateChange );
+
+ // forward certain settings to the data window
+ switch ( i_nStateChange )
+ {
+ case STATE_CHANGE_CONTROLBACKGROUND:
+ if ( IsControlBackground() )
+ getDataWindow()->SetControlBackground( GetControlBackground() );
+ else
+ getDataWindow()->SetControlBackground();
+ break;
+
+ case STATE_CHANGE_CONTROLFOREGROUND:
+ if ( IsControlForeground() )
+ getDataWindow()->SetControlForeground( GetControlForeground() );
+ else
+ getDataWindow()->SetControlForeground();
+ break;
+
+ case STATE_CHANGE_CONTROLFONT:
+ if ( IsControlFont() )
+ getDataWindow()->SetControlFont( GetControlFont() );
+ else
+ getDataWindow()->SetControlFont();
+ break;
+ }
+ }
+
//--------------------------------------------------------------------
void TableControl::Resize()
{
@@ -175,6 +213,11 @@ namespace svt { namespace table
return m_pImpl->goTo( _nColPos, _nRowPos );
}
//--------------------------------------------------------------------
+ void TableControl::clearSelection()
+ {
+ m_pImpl->clearSelection();
+ }
+ //--------------------------------------------------------------------
void TableControl::InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved)
{
Rectangle _rRect;
@@ -401,7 +444,7 @@ void TableControl::FillAccessibleStateSet(
}
}
-Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow )
+Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow ) const
{
return Control::GetWindowExtentsRelative( pRelativeWindow );
}
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index 1526dbdb778d..3288ab6a4284 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -1647,6 +1647,12 @@ namespace svt { namespace table
{
return m_nRowSelected;
}
+ //--------------------------------------------------------------------
+ void TableControl_Impl::clearSelection()
+ {
+ m_nRowSelected.clear();
+ }
+ //--------------------------------------------------------------------
//-------------------------------------------------------------------------------
void TableControl_Impl::removeSelectedRow(RowPos _nRowPos)
{
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index 0a487c77c76c..12b518aa3578 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -204,6 +204,7 @@ namespace svt { namespace table
/** updates the vector, which contains the selected rows after removing the row nRowPos*/
void removeSelectedRow(RowPos _nRowPos);
void invalidateRows();
+ void clearSelection();
// IAbstractTableControl
virtual void hideCursor();
virtual void showCursor();
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index e307071e2699..3245b7e84aac 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -47,6 +47,10 @@ namespace svt { namespace table
,m_rTableControl ( _rTableControl )
,m_nRowAlreadySelected( -1 )
{
+ // by default, use the background as determined by the style settings
+ const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
+ SetBackground( Wallpaper( aWindowColor ) );
+ SetFillColor( aWindowColor );
}
//--------------------------------------------------------------------
@@ -54,6 +58,7 @@ namespace svt { namespace table
{
m_rTableControl.doPaintContent( rUpdateRect );
}
+
//--------------------------------------------------------------------
void TableDataWindow::MouseMove( const MouseEvent& rMEvt )
{
diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx
new file mode 100644
index 000000000000..040f33045fff
--- /dev/null
+++ b/svtools/source/toolpanel/drawerlayouter.cxx
@@ -0,0 +1,305 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "svtools/toolpanel/drawerlayouter.hxx"
+#include "toolpaneldrawer.hxx"
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+#include <comphelper/accimplaccess.hxx>
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::accessibility::XAccessible;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= DrawerDeckLayouter
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ DrawerDeckLayouter::DrawerDeckLayouter( ::Window& i_rParentWindow, IToolPanelDeck& i_rPanels )
+ :m_rParentWindow( i_rParentWindow )
+ ,m_rPanelDeck( i_rPanels )
+ ,m_aDrawers()
+ ,m_aLastKnownActivePanel()
+ {
+ m_rPanelDeck.AddListener( *this );
+
+ // simulate PanelInserted events for the panels which are already there
+ for ( size_t i=0; i<m_rPanelDeck.GetPanelCount(); ++i )
+ PanelInserted( m_rPanelDeck.GetPanel( i ), i );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DrawerDeckLayouter::~DrawerDeckLayouter()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPLEMENT_IREFERENCE( DrawerDeckLayouter )
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle DrawerDeckLayouter::Layout( const Rectangle& i_rDeckPlayground )
+ {
+ const size_t nPanelCount( m_rPanelDeck.GetPanelCount() );
+ if ( nPanelCount == 0 )
+ return i_rDeckPlayground;
+
+ const int nWidth( i_rDeckPlayground.GetWidth() );
+ ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() );
+ if ( !aActivePanel )
+ aActivePanel = m_aLastKnownActivePanel;
+
+ // arrange the title bars which are *above* the active panel (or *all* if there is no active panel), plus
+ // the title bar of the active panel itself
+ Point aUpperDrawerPos( i_rDeckPlayground.TopLeft() );
+ const size_t nUpperBound = !!aActivePanel ? *aActivePanel : nPanelCount - 1;
+ for ( size_t i=0; i<=nUpperBound; ++i )
+ {
+ sal_uInt32 nDrawerHeight = m_aDrawers[i]->GetPreferredHeightPixel();
+ m_aDrawers[i]->SetPosSizePixel(
+ aUpperDrawerPos, Size( nWidth, nDrawerHeight ) );
+ aUpperDrawerPos.Move( 0, nDrawerHeight );
+ }
+
+ // arrange title bars which are below the active panel (or *none* if there is no active panel)
+ Point aLowerDrawerPos( i_rDeckPlayground.BottomLeft() );
+ for ( size_t j = nPanelCount - 1; j > nUpperBound; --j )
+ {
+ sal_uInt32 nDrawerHeight = m_aDrawers[j]->GetPreferredHeightPixel();
+ m_aDrawers[j]->SetPosSizePixel(
+ Point( aLowerDrawerPos.X(), aLowerDrawerPos.Y() - nDrawerHeight + 1 ),
+ Size( nWidth, nDrawerHeight )
+ );
+ aLowerDrawerPos.Move( 0, -nDrawerHeight );
+ }
+
+ // fincally calculate the rectangle for the active panel
+ return Rectangle(
+ aUpperDrawerPos,
+ Size( nWidth, aLowerDrawerPos.Y() - aUpperDrawerPos.Y() + 1 )
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::Destroy()
+ {
+ while ( !m_aDrawers.empty() )
+ impl_removeDrawer( 0 );
+ m_rPanelDeck.RemoveListener( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::SetFocusToPanelSelector()
+ {
+ const size_t nPanelCount( m_rPanelDeck.GetPanelCount() );
+ if ( !nPanelCount )
+ // nothing to focus
+ return;
+ ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() );
+ if ( !aActivePanel )
+ aActivePanel = 0;
+ ENSURE_OR_RETURN_VOID( *aActivePanel < m_aDrawers.size(), "DrawerDeckLayouter::SetFocusToPanelSelector: invalid active panel, or inconsistent drawers!" );
+ m_aDrawers[ *aActivePanel ]->GrabFocus();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ size_t DrawerDeckLayouter::GetAccessibleChildCount() const
+ {
+ return m_aDrawers.size();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > DrawerDeckLayouter::GetAccessibleChild( const size_t i_nChildIndex, const Reference< XAccessible >& i_rParentAccessible )
+ {
+ ENSURE_OR_RETURN( i_nChildIndex < m_aDrawers.size(), "illegal index", NULL );
+
+ const PToolPanelDrawer pDrawer( m_aDrawers[ i_nChildIndex ] );
+
+ Reference< XAccessible > xItemAccessible = pDrawer->GetAccessible( FALSE );
+ if ( !xItemAccessible.is() )
+ {
+ xItemAccessible = pDrawer->GetAccessible( TRUE );
+ ENSURE_OR_RETURN( xItemAccessible.is(), "illegal accessible provided by the drawer implementation!", NULL );
+ OSL_VERIFY( ::comphelper::OAccessibleImplementationAccess::setAccessibleParent( xItemAccessible->getAccessibleContext(),
+ i_rParentAccessible ) );
+ }
+
+ return xItemAccessible;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "DrawerDeckLayouter::PanelInserted: inconsistency!" );
+
+ PToolPanelDrawer pDrawer( new ToolPanelDrawer( m_rParentWindow, i_pPanel->GetDisplayName() ) );
+ pDrawer->SetSmartHelpId( i_pPanel->GetHelpID() );
+ // proper Z-Order
+ if ( i_nPosition == 0 )
+ {
+ pDrawer->SetZOrder( NULL, WINDOW_ZORDER_FIRST );
+ }
+ else
+ {
+ const PToolPanelDrawer pFirstDrawer( m_aDrawers[ i_nPosition - 1 ] );
+ pDrawer->SetZOrder( pFirstDrawer.get(), WINDOW_ZORDER_BEHIND );
+ }
+
+ pDrawer->Show();
+ pDrawer->AddEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) );
+ m_aDrawers.insert( m_aDrawers.begin() + i_nPosition, pDrawer );
+ impl_triggerRearrange();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::PanelRemoved( const size_t i_nPosition )
+ {
+ impl_removeDrawer( i_nPosition );
+ impl_triggerRearrange();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::impl_triggerRearrange() const
+ {
+ // this is somewhat hacky, it assumes that the parent of our panels is a tool panel deck, which, in its
+ // Resize implementation, rearrances all elements.
+ m_rParentWindow.Resize();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ if ( !!i_rOldActive )
+ {
+ OSL_ENSURE( *i_rOldActive < m_aDrawers.size(), "DrawerDeckLayouter::ActivePanelChanged: illegal old index!" );
+ m_aDrawers[ *i_rOldActive ]->SetExpanded( false );
+ }
+
+ if ( !!i_rNewActive )
+ {
+ OSL_ENSURE( *i_rNewActive < m_aDrawers.size(), "DrawerDeckLayouter::ActivePanelChanged: illegal new index!" );
+ m_aDrawers[ *i_rNewActive ]->SetExpanded( true );
+ }
+
+ impl_triggerRearrange();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::LayouterChanged( const PDeckLayouter& i_rNewLayouter )
+ {
+ // not interested in
+ (void)i_rNewLayouter;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ size_t DrawerDeckLayouter::impl_getPanelPositionFromWindow( const Window* i_pDrawerWindow ) const
+ {
+ for ( ::std::vector< PToolPanelDrawer >::const_iterator drawerPos = m_aDrawers.begin();
+ drawerPos != m_aDrawers.end();
+ ++drawerPos
+ )
+ {
+ if ( drawerPos->get() == i_pDrawerWindow )
+ return drawerPos - m_aDrawers.begin();
+ }
+ return m_aDrawers.size();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::impl_removeDrawer( const size_t i_nPosition )
+ {
+ OSL_PRECOND( i_nPosition < m_aDrawers.size(), "DrawerDeckLayouter::impl_removeDrawer: invalid panel position!" );
+ m_aDrawers[ i_nPosition ]->RemoveEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) );
+ OSL_ENSURE( m_aDrawers[ i_nPosition ].unique(), "DrawerDeckLayouter::impl_removeDrawer: somebody else is still holding a reference!" );
+ m_aDrawers.erase( m_aDrawers.begin() + i_nPosition );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( DrawerDeckLayouter, OnWindowEvent, VclSimpleEvent*, i_pEvent )
+ {
+ const VclWindowEvent* pWindowEvent = PTR_CAST( VclWindowEvent, i_pEvent );
+ ENSURE_OR_RETURN( pWindowEvent, "no WindowEvent", 0L );
+
+ bool bActivatePanel = false;
+ switch ( pWindowEvent->GetId() )
+ {
+ case VCLEVENT_WINDOW_MOUSEBUTTONUP:
+ {
+ const MouseEvent* pMouseEvent = static_cast< const MouseEvent* >( pWindowEvent->GetData() );
+ ENSURE_OR_RETURN( pMouseEvent, "no mouse event with MouseButtonUp", 0L );
+ if ( pMouseEvent->GetButtons() == MOUSE_LEFT )
+ {
+ bActivatePanel = true;
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_KEYINPUT:
+ {
+ const KeyEvent* pKeyEvent = static_cast< const KeyEvent* >( pWindowEvent->GetData() );
+ ENSURE_OR_RETURN( pKeyEvent, "no key event with KeyInput", 0L );
+ const KeyCode& rKeyCode( pKeyEvent->GetKeyCode() );
+ if ( ( rKeyCode.GetModifier() == 0 ) && ( rKeyCode.GetCode() == KEY_RETURN ) )
+ {
+ bActivatePanel = true;
+ }
+ }
+ break;
+ }
+ if ( bActivatePanel )
+ {
+ const size_t nPanelPos = impl_getPanelPositionFromWindow( pWindowEvent->GetWindow() );
+ if ( nPanelPos != m_rPanelDeck.GetActivePanel() )
+ {
+ m_rPanelDeck.ActivatePanel( nPanelPos );
+ }
+ else
+ {
+ PToolPanel pPanel( m_rPanelDeck.GetPanel( nPanelPos ) );
+ pPanel->GrabFocus();
+ }
+ return 1L;
+ }
+ return 0L;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerDeckLayouter::Dying()
+ {
+ Destroy();
+ }
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/toolpanel/dummypanel.cxx b/svtools/source/toolpanel/dummypanel.cxx
new file mode 100644
index 000000000000..20f140a6e610
--- /dev/null
+++ b/svtools/source/toolpanel/dummypanel.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "dummypanel.hxx"
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::accessibility::XAccessible;
+
+ //====================================================================
+ //= DummyPanel
+ //====================================================================
+ //--------------------------------------------------------------------
+ DummyPanel::DummyPanel()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ DummyPanel::~DummyPanel()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_IREFERENCE( DummyPanel )
+
+ //--------------------------------------------------------------------
+ void DummyPanel::Activate( Window& )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void DummyPanel::Deactivate()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void DummyPanel::SetSizePixel( const Size& )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString DummyPanel::GetDisplayName() const
+ {
+ return ::rtl::OUString();
+ }
+
+ //--------------------------------------------------------------------
+ Image DummyPanel::GetImage() const
+ {
+ return Image();
+ }
+
+ //--------------------------------------------------------------------
+ SmartId DummyPanel::GetHelpID() const
+ {
+ return SmartId();
+ }
+
+ //--------------------------------------------------------------------
+ void DummyPanel::GrabFocus()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void DummyPanel::Dispose()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > DummyPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible )
+ {
+ (void)i_rParentAccessible;
+ return NULL;
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/dummypanel.hxx b/svtools/source/toolpanel/dummypanel.hxx
new file mode 100644
index 000000000000..adb98e52077e
--- /dev/null
+++ b/svtools/source/toolpanel/dummypanel.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef DUMMYPANEL_HXX
+#define DUMMYPANEL_HXX
+
+#include "svtools/toolpanel/toolpanel.hxx"
+#include "svtools/toolpanel/refbase.hxx"
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= DummyPanel
+ //====================================================================
+ /// is a dummy implementation of the IToolPanel interface
+ class DummyPanel :public RefBase
+ ,public IToolPanel
+ {
+ public:
+ DummyPanel();
+ ~DummyPanel();
+
+ // IToolPanel
+ virtual ::rtl::OUString GetDisplayName() const;
+ virtual Image GetImage() const;
+ virtual SmartId GetHelpID() const;
+ virtual void Activate( Window& i_rParentWindow );
+ virtual void Deactivate();
+ virtual void SetSizePixel( const Size& i_rPanelWindowSize );
+ virtual void GrabFocus();
+ virtual void Dispose();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ CreatePanelAccessible(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ );
+
+ DECLARE_IREFERENCE()
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // DUMMYPANEL_HXX
diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk
new file mode 100755
index 000000000000..58282056f529
--- /dev/null
+++ b/svtools/source/toolpanel/makefile.mk
@@ -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: makefile.mk,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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=svtools
+TARGET=toolpanel
+
+# --- Settings -----------------------------------------------------
+
+ENABLE_EXCEPTIONS=TRUE
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/svt.pmk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES=\
+ toolpanel.src
+
+SLOFILES=\
+ $(SLO)$/drawerlayouter.obj \
+ $(SLO)$/dummypanel.obj \
+ $(SLO)$/paneldecklisteners.obj \
+ $(SLO)$/paneltabbar.obj \
+ $(SLO)$/paneltabbarpeer.obj \
+ $(SLO)$/refbase.obj \
+ $(SLO)$/tabbargeometry.obj \
+ $(SLO)$/tablayouter.obj \
+ $(SLO)$/toolpanel.obj \
+ $(SLO)$/toolpanelcollection.obj \
+ $(SLO)$/toolpaneldrawer.obj \
+ $(SLO)$/toolpaneldrawerpeer.obj \
+ $(SLO)$/toolpaneldeck.obj \
+ $(SLO)$/toolpaneldeckpeer.obj \
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/toolpanel/paneldecklisteners.cxx b/svtools/source/toolpanel/paneldecklisteners.cxx
new file mode 100755
index 000000000000..32ba9b5c6a24
--- /dev/null
+++ b/svtools/source/toolpanel/paneldecklisteners.cxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "paneldecklisteners.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= PanelDeckListeners
+ //====================================================================
+ //--------------------------------------------------------------------
+ PanelDeckListeners::PanelDeckListeners()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ PanelDeckListeners::~PanelDeckListeners()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners );
+ for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->PanelInserted( i_pPanel, i_nPosition );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::PanelRemoved( const size_t i_nPosition )
+ {
+ ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners );
+ for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->PanelRemoved( i_nPosition );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners );
+ for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->ActivePanelChanged( i_rOldActive, i_rNewActive );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::LayouterChanged( const PDeckLayouter& i_rNewLayouter )
+ {
+ ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners );
+ for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin();
+ loop != aListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->LayouterChanged( i_rNewLayouter );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::Dying()
+ {
+ while ( !m_aListeners.empty() )
+ {
+ IToolPanelDeckListener* pListener( *m_aListeners.begin() );
+ m_aListeners.erase( m_aListeners.begin() );
+ pListener->Dying();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::AddListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_aListeners.push_back( &i_rListener );
+ }
+
+ //--------------------------------------------------------------------
+ void PanelDeckListeners::RemoveListener( IToolPanelDeckListener& i_rListener )
+ {
+ for ( ::std::vector< IToolPanelDeckListener* >::iterator lookup = m_aListeners.begin();
+ lookup != m_aListeners.end();
+ ++lookup
+ )
+ {
+ if ( *lookup == &i_rListener )
+ {
+ m_aListeners.erase( lookup );
+ return;
+ }
+ }
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/paneldecklisteners.hxx b/svtools/source/toolpanel/paneldecklisteners.hxx
new file mode 100755
index 000000000000..bc7e2ae7db88
--- /dev/null
+++ b/svtools/source/toolpanel/paneldecklisteners.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef PANELDECKLISTENERS_HXX
+#define PANELDECKLISTENERS_HXX
+
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+
+#include <boost/optional.hpp>
+#include <vector>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ class IToolPanelDeckListener;
+
+ //====================================================================
+ //= PanelDeckListeners
+ //====================================================================
+ /** implements a container for IToolPanelDeckListeners
+ */
+ class PanelDeckListeners
+ {
+ public:
+ PanelDeckListeners();
+ ~PanelDeckListeners();
+
+ // IToolPanelDeckListener equivalents, forward the events to all registered listeners
+ void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ void PanelRemoved( const size_t i_nPosition );
+ void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ void LayouterChanged( const PDeckLayouter& i_rNewLayouter );
+ void Dying();
+
+ // listener maintainance
+ void AddListener( IToolPanelDeckListener& i_rListener );
+ void RemoveListener( IToolPanelDeckListener& i_rListener );
+
+ private:
+ ::std::vector< IToolPanelDeckListener* > m_aListeners;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // PANELDECKLISTENERS_HXX
diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx
new file mode 100755
index 000000000000..38aee00c8f55
--- /dev/null
+++ b/svtools/source/toolpanel/paneltabbar.cxx
@@ -0,0 +1,1356 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "svtools/toolpanel/paneltabbar.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+#include "svtools/svtdata.hxx"
+#include "svtools/svtools.hrc"
+
+#include "tabitemdescriptor.hxx"
+#include "paneltabbarpeer.hxx"
+#include "tabbargeometry.hxx"
+
+#include <vcl/button.hxx>
+#include <vcl/help.hxx>
+#include <vcl/virdev.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <boost/optional.hpp>
+#include <vector>
+
+// space around an item
+#define ITEM_OUTER_SPACE 2 * 3
+// spacing before and after an item's text
+#define ITEM_TEXT_FLOW_SPACE 5
+// space between item icon and icon text
+#define ITEM_ICON_TEXT_DISTANCE 4
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::awt::XWindowPeer;
+
+ typedef sal_uInt16 ItemFlags;
+
+ #define ITEM_STATE_NORMAL 0x00
+ #define ITEM_STATE_ACTIVE 0x01
+ #define ITEM_STATE_HOVERED 0x02
+ #define ITEM_STATE_FOCUSED 0x04
+ #define ITEM_POSITION_FIRST 0x08
+ #define ITEM_POSITION_LAST 0x10
+
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ ControlState lcl_ItemToControlState( const ItemFlags i_nItemFlags )
+ {
+ ControlState nState = CTRL_STATE_ENABLED;
+ if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_FOCUSED | CTRL_STATE_PRESSED;
+ if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER;
+ if ( i_nItemFlags & ITEM_STATE_ACTIVE ) nState |= CTRL_STATE_SELECTED;
+ return nState;
+ }
+ }
+
+ //==================================================================================================================
+ //= ITabBarRenderer
+ //==================================================================================================================
+ class SAL_NO_VTABLE ITabBarRenderer
+ {
+ public:
+ /** fills the background of our target device
+ */
+ virtual void renderBackground() const = 0;
+ virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const = 0;
+ virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const = 0;
+ virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const = 0;
+
+ // TODO: postRenderItem takes the "real" window, i.e. effectively the tab bar. This is because
+ // DrawSelectionBackground needs to be applied after everything else is painted, and is available at the Window
+ // class, but not at the OutputDevice. This makes the API somewhat weird, as we're now mixing operations on the
+ // target device, done in a normalized geometry, with operations on the window, done in a transformed geometry.
+ // So, we should get rid of postRenderItem completely.
+ };
+ typedef ::boost::shared_ptr< ITabBarRenderer > PTabBarRenderer;
+
+ //==================================================================================================================
+ //= VCLItemRenderer - declaration
+ //==================================================================================================================
+ class VCLItemRenderer : public ITabBarRenderer
+ {
+ public:
+ VCLItemRenderer( OutputDevice& i_rTargetDevice )
+ :m_rTargetDevice( i_rTargetDevice )
+ {
+ }
+
+ // ITabBarRenderer
+ virtual void renderBackground() const;
+ virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const;
+ virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const;
+ virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const;
+
+ protected:
+ OutputDevice& getTargetDevice() const { return m_rTargetDevice; }
+
+ private:
+ OutputDevice& m_rTargetDevice;
+ };
+
+ //==================================================================================================================
+ //= VCLItemRenderer - implementation
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ void VCLItemRenderer::renderBackground() const
+ {
+ getTargetDevice().DrawRect( Rectangle( Point(), getTargetDevice().GetOutputSizePixel() ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle VCLItemRenderer::calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const
+ {
+ (void)i_nItemFlags;
+ // no decorations at all
+ return i_rContentArea;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void VCLItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const
+ {
+ (void)i_rContentRect;
+ (void)i_nItemFlags;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void VCLItemRenderer::postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const
+ {
+ const bool bActive = ( ( i_nItemFlags & ITEM_STATE_ACTIVE ) != 0 );
+ const bool bHovered = ( ( i_nItemFlags & ITEM_STATE_HOVERED ) != 0 );
+ const bool bFocused = ( ( i_nItemFlags & ITEM_STATE_FOCUSED ) != 0 );
+ if ( bActive || bHovered || bFocused )
+ {
+ Rectangle aSelectionRect( i_rItemRect );
+ aSelectionRect.Left() += ITEM_OUTER_SPACE / 2;
+ aSelectionRect.Top() += ITEM_OUTER_SPACE / 2;
+ aSelectionRect.Right() -= ITEM_OUTER_SPACE / 2;
+ aSelectionRect.Bottom() -= ITEM_OUTER_SPACE / 2;
+ i_rActualWindow.DrawSelectionBackground(
+ aSelectionRect,
+ ( bHovered || bFocused ) ? ( bActive ? 1 : 2 ) : 0 /* hilight */,
+ bActive /* check */,
+ TRUE /* border */,
+ FALSE /* ext border only */,
+ 0 /* corner radius */,
+ NULL,
+ NULL
+ );
+ }
+ }
+
+ //==================================================================================================================
+ //= NWFToolboxItemRenderer - declaration
+ //==================================================================================================================
+ class NWFToolboxItemRenderer : public ITabBarRenderer
+ {
+ public:
+ NWFToolboxItemRenderer( OutputDevice& i_rTargetDevice )
+ :m_rTargetDevice( i_rTargetDevice )
+ {
+ }
+
+ // ITabBarRenderer
+ virtual void renderBackground() const;
+ virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const;
+ virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const;
+ virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const;
+
+ protected:
+ OutputDevice& getTargetDevice() const { return m_rTargetDevice; }
+
+ private:
+ OutputDevice& m_rTargetDevice;
+ };
+
+ //==================================================================================================================
+ //= NWFToolboxItemRenderer - implementation
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ void NWFToolboxItemRenderer::renderBackground() const
+ {
+ getTargetDevice().DrawRect( Rectangle( Point(), getTargetDevice().GetOutputSizePixel() ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle NWFToolboxItemRenderer::calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const
+ {
+ // don't ask GetNativeControlRegion, this will not deliver proper results in all cases.
+ // Instead, simply assume that both the content and the bounding region are the same.
+// const ControlState nState( lcl_ItemToControlState( i_nItemFlags );
+// const ImplControlValue aControlValue;
+// bool bNativeOK = m_rTargetWindow.GetNativeControlRegion(
+// CTRL_TOOLBAR, PART_BUTTON,
+// i_rContentArea, nState,
+// aControlValue, ::rtl::OUString(),
+// aBoundingRegion, aContentRegion
+// );
+ (void)i_nItemFlags;
+ return Rectangle(
+ Point( i_rContentArea.Left() - 1, i_rContentArea.Top() - 1 ),
+ Size( i_rContentArea.GetWidth() + 2, i_rContentArea.GetHeight() + 2 )
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void NWFToolboxItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const
+ {
+ const ControlState nState = lcl_ItemToControlState( i_nItemFlags );
+
+ ImplControlValue aControlValue;
+ aControlValue.setTristateVal( ( i_nItemFlags & ITEM_STATE_ACTIVE ) ? BUTTONVALUE_ON : BUTTONVALUE_OFF );
+
+ bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, i_rContentRect, nState, aControlValue, rtl::OUString() );
+ (void)bNativeOK;
+ OSL_ENSURE( bNativeOK, "NWFToolboxItemRenderer::preRenderItem: inconsistent NWF implementation!" );
+ // IsNativeControlSupported returned true, previously, otherwise we would not be here ...
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void NWFToolboxItemRenderer::postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const
+ {
+ (void)i_rActualWindow;
+ (void)i_rItemRect;
+ (void)i_nItemFlags;
+ }
+
+ //==================================================================================================================
+ //= NWFTabItemRenderer - declaration
+ //==================================================================================================================
+ class NWFTabItemRenderer : public ITabBarRenderer
+ {
+ public:
+ NWFTabItemRenderer( OutputDevice& i_rTargetDevice )
+ :m_rTargetDevice( i_rTargetDevice )
+ {
+ }
+
+ // ITabBarRenderer
+ virtual void renderBackground() const;
+ virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const;
+ virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const;
+ virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const;
+
+ protected:
+ OutputDevice& getTargetDevice() const { return m_rTargetDevice; }
+
+ private:
+ OutputDevice& m_rTargetDevice;
+ };
+
+ //==================================================================================================================
+ //= NWFTabItemRenderer - implementation
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ void NWFTabItemRenderer::renderBackground() const
+ {
+ Rectangle aBackground( Point(), getTargetDevice().GetOutputSizePixel() );
+ getTargetDevice().DrawRect( aBackground );
+
+ aBackground.Top() = aBackground.Bottom();
+ getTargetDevice().DrawNativeControl( CTRL_TAB_PANE, PART_ENTIRE_CONTROL, aBackground,
+ CTRL_STATE_ENABLED, ImplControlValue(), ::rtl::OUString() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle NWFTabItemRenderer::calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const
+ {
+ const ControlState nState( lcl_ItemToControlState( i_nItemFlags ) );
+
+ TabitemValue tiValue;
+ ImplControlValue aControlValue( (void*)(&tiValue) );
+
+ Region aBoundingRegion, aContentRegion;
+ bool bNativeOK = getTargetDevice().GetNativeControlRegion(
+ CTRL_TAB_ITEM, PART_ENTIRE_CONTROL,
+ i_rContentArea, nState,
+ aControlValue, ::rtl::OUString(),
+ aBoundingRegion, aContentRegion
+ );
+ (void)bNativeOK;
+ OSL_ENSURE( bNativeOK, "NWFTabItemRenderer::calculateDecorations: GetNativeControlRegion not implemented for CTRL_TAB_ITEM?!" );
+
+ return aBoundingRegion.GetBoundRect();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void NWFTabItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const
+ {
+ const ControlState nState = lcl_ItemToControlState( i_nItemFlags );
+
+ TabitemValue tiValue;
+ if ( i_nItemFlags & ITEM_POSITION_FIRST )
+ tiValue.mnAlignment |= TABITEM_FIRST_IN_GROUP;
+ if ( i_nItemFlags & ITEM_POSITION_LAST )
+ tiValue.mnAlignment |= TABITEM_LAST_IN_GROUP;
+
+ ImplControlValue aControlValue( (void *)(&tiValue) );
+
+ bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, i_rContentRect, nState, aControlValue, rtl::OUString() );
+ (void)bNativeOK;
+ OSL_ENSURE( bNativeOK, "NWFTabItemRenderer::preRenderItem: inconsistent NWF implementation!" );
+ // IsNativeControlSupported returned true, previously, otherwise we would not be here ...
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void NWFTabItemRenderer::postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const
+ {
+ (void)i_rActualWindow;
+ (void)i_rItemRect;
+ (void)i_nItemFlags;
+ }
+
+ //==================================================================================================================
+ //= PanelTabBar_Impl
+ //==================================================================================================================
+ class PanelTabBar_Impl : public IToolPanelDeckListener
+ {
+ public:
+ PanelTabBar_Impl( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent );
+
+ ~PanelTabBar_Impl()
+ {
+ m_rPanelDeck.RemoveListener( *this );
+ }
+
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ (void)i_pPanel;
+ (void)i_nPosition;
+ m_bItemsDirty = true;
+ m_rTabBar.Invalidate();
+
+ Relayout();
+ }
+
+ virtual void PanelRemoved( const size_t i_nPosition )
+ {
+ m_bItemsDirty = true;
+ m_rTabBar.Invalidate();
+
+ if ( i_nPosition < m_nScrollPosition )
+ --m_nScrollPosition;
+
+ Relayout();
+ }
+
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+ void UpdateScrollButtons()
+ {
+ m_aScrollBack.Enable( m_nScrollPosition > 0 );
+ m_aScrollForward.Enable( m_nScrollPosition < m_aItems.size() - 1 );
+ }
+
+ void Relayout();
+ void EnsureItemsCache();
+ ::boost::optional< size_t > FindItemForPoint( const Point& i_rPoint ) const;
+ void DrawItem( const size_t i_nItemIndex, const Rectangle& i_rBoundaries ) const;
+ void InvalidateItem( const size_t i_nItemIndex, const ItemFlags i_nAdditionalItemFlags = 0 ) const;
+ void CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const;
+ Rectangle GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const;
+ Rectangle GetItemScreenRect( const size_t i_nItemPos ) const;
+
+ void FocusItem( const ::boost::optional< size_t >& i_rItemPos );
+
+ inline bool IsVertical() const
+ {
+ return ( ( m_eTabAlignment == TABS_LEFT )
+ || ( m_eTabAlignment == TABS_RIGHT )
+ );
+ }
+
+ protected:
+ DECL_LINK( OnScroll, const PushButton* );
+
+ void impl_calcItemRects();
+ Size impl_calculateItemContentSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent ) const;
+ void impl_renderItemContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) const;
+ ItemFlags impl_getItemFlags( const size_t i_nItemIndex ) const;
+
+ public:
+ PanelTabBar& m_rTabBar;
+ TabBarGeometry m_aGeometry;
+ NormalizedArea m_aNormalizer;
+ TabAlignment m_eTabAlignment;
+ IToolPanelDeck& m_rPanelDeck;
+
+ VirtualDevice m_aRenderDevice;
+ PTabBarRenderer m_pRenderer;
+
+ ::boost::optional< size_t > m_aHoveredItem;
+ ::boost::optional< size_t > m_aFocusedItem;
+ bool m_bMouseButtonDown;
+
+ ItemDescriptors m_aItems;
+ bool m_bItemsDirty;
+
+ PushButton m_aScrollBack;
+ PushButton m_aScrollForward;
+
+ size_t m_nScrollPosition;
+ };
+
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------------------------------------------------
+ #if OSL_DEBUG_LEVEL > 0
+ static void lcl_checkConsistency( const PanelTabBar_Impl& i_rImpl )
+ {
+ if ( !i_rImpl.m_bItemsDirty )
+ {
+ if ( i_rImpl.m_rPanelDeck.GetPanelCount() != i_rImpl.m_aItems.size() )
+ {
+ OSL_ENSURE( false, "lcl_checkConsistency: inconsistent array sizes!" );
+ return;
+ }
+ for ( size_t i = 0; i < i_rImpl.m_rPanelDeck.GetPanelCount(); ++i )
+ {
+ if ( i_rImpl.m_rPanelDeck.GetPanel( i ).get() != i_rImpl.m_aItems[i].pPanel.get() )
+ {
+ OSL_ENSURE( false, "lcl_checkConsistency: array elements are inconsistent!" );
+ return;
+ }
+ }
+ }
+ }
+
+ #define DBG_CHECK( data ) \
+ lcl_checkConsistency( data );
+ #else
+ #define DBG_CHECK( data ) \
+ (void)data;
+ #endif
+
+ //--------------------------------------------------------------------------------------------------------------
+ class ClipItemRegion
+ {
+ public:
+ ClipItemRegion( const PanelTabBar_Impl& i_rImpl )
+ :m_rDevice( i_rImpl.m_rTabBar )
+ {
+ m_rDevice.Push( PUSH_CLIPREGION );
+ m_rDevice.SetClipRegion( i_rImpl.m_aNormalizer.getTransformed( i_rImpl.m_aGeometry.getItemsRect(), i_rImpl.m_eTabAlignment ) );
+ }
+
+ ~ClipItemRegion()
+ {
+ m_rDevice.Pop();
+ }
+
+ private:
+ OutputDevice& m_rDevice;
+ };
+ }
+
+ //==================================================================================================================
+ //= PanelTabBar_Impl - implementation
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ PanelTabBar_Impl::PanelTabBar_Impl( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
+ :m_rTabBar( i_rTabBar )
+ ,m_aGeometry( i_eItemContent )
+ ,m_aNormalizer()
+ ,m_eTabAlignment( i_eAlignment )
+ ,m_rPanelDeck( i_rPanelDeck )
+ ,m_aRenderDevice( i_rTabBar )
+ ,m_pRenderer()
+ ,m_aHoveredItem()
+ ,m_aFocusedItem()
+ ,m_bMouseButtonDown( false )
+ ,m_aItems()
+ ,m_bItemsDirty( true )
+ ,m_aScrollBack( &i_rTabBar, WB_BEVELBUTTON )
+ ,m_aScrollForward( &i_rTabBar, WB_BEVELBUTTON )
+ ,m_nScrollPosition( 0 )
+ {
+#ifdef WNT
+ if ( m_aRenderDevice.IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) )
+ // this mode requires the NWF framework to be able to render those items onto a virtual
+ // device. For some frameworks (some GTK themes, in particular), this is known to fail.
+ // So, be on the safe side for the moment.
+ m_pRenderer.reset( new NWFTabItemRenderer( m_aRenderDevice ) );
+ else
+#endif
+ if ( m_aRenderDevice.IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) )
+ m_pRenderer.reset( new NWFToolboxItemRenderer( m_aRenderDevice ) );
+ else
+ m_pRenderer.reset( new VCLItemRenderer( m_aRenderDevice ) );
+
+ m_aRenderDevice.SetLineColor();
+
+ m_rPanelDeck.AddListener( *this );
+
+ m_aScrollBack.SetSymbol( IsVertical() ? SYMBOL_ARROW_UP : SYMBOL_ARROW_LEFT );
+ m_aScrollBack.Show();
+ m_aScrollBack.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) );
+ m_aScrollBack.SetAccessibleDescription( String( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_FWD ) ) );
+ m_aScrollBack.SetAccessibleName( m_aScrollBack.GetAccessibleDescription() );
+
+ m_aScrollForward.SetSymbol( IsVertical() ? SYMBOL_ARROW_DOWN : SYMBOL_ARROW_RIGHT );
+ m_aScrollForward.Show();
+ m_aScrollForward.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) );
+ m_aScrollForward.SetAccessibleDescription( String( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_BACK ) ) );
+ m_aScrollForward.SetAccessibleName( m_aScrollForward.GetAccessibleDescription() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::impl_calcItemRects()
+ {
+ m_aItems.resize(0);
+
+ Point aCompletePos( m_aGeometry.getFirstItemPosition() );
+ Point aIconOnlyPos( aCompletePos );
+ Point aTextOnlyPos( aCompletePos );
+
+ for ( size_t i = 0;
+ i < m_rPanelDeck.GetPanelCount();
+ ++i
+ )
+ {
+ PToolPanel pPanel( m_rPanelDeck.GetPanel( i ) );
+
+ ItemDescriptor aItem;
+ aItem.pPanel = pPanel;
+
+ Rectangle aContentArea;
+
+ const Size aCompleteSize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_AND_TEXT ) );
+ const Size aIconOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_ONLY ) );
+ const Size aTextOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_TEXT_ONLY ) );
+
+ // TODO: have one method calculating all sizes?
+
+ // remember the three areas
+ aItem.aCompleteArea = Rectangle( aCompletePos, aCompleteSize );
+ aItem.aIconOnlyArea = Rectangle( aIconOnlyPos, aIconOnlySize );
+ aItem.aTextOnlyArea = Rectangle( aTextOnlyPos, aTextOnlySize );
+
+ m_aItems.push_back( aItem );
+
+ aCompletePos = aItem.aCompleteArea.TopRight();
+ aIconOnlyPos = aItem.aIconOnlyArea.TopRight();
+ aTextOnlyPos = aItem.aTextOnlyArea.TopRight();
+ }
+
+ m_bItemsDirty = false;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Size PanelTabBar_Impl::impl_calculateItemContentSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent ) const
+ {
+ // calculate the size needed for the content
+ OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "PanelTabBar_Impl::impl_calculateItemContentSize: illegal TabItemContent value!" );
+
+ const Image aImage( i_pPanel->GetImage() );
+ const bool bUseImage = !!aImage && ( i_eItemContent != TABITEM_TEXT_ONLY );
+
+ const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() );
+ const bool bUseText = ( sItemText.getLength() != 0 ) && ( i_eItemContent != TABITEM_IMAGE_ONLY );
+
+ Size aItemContentSize;
+ if ( bUseImage )
+ {
+ aItemContentSize = aImage.GetSizePixel();
+ }
+
+ if ( bUseText )
+ {
+ if ( bUseImage )
+ aItemContentSize.Width() += ITEM_ICON_TEXT_DISTANCE;
+
+ // add space for text
+ const Size aTextSize( m_rTabBar.GetCtrlTextWidth( sItemText ), m_rTabBar.GetTextHeight() );
+ aItemContentSize.Width() += aTextSize.Width();
+ aItemContentSize.Height() = ::std::max( aItemContentSize.Height(), aTextSize.Height() );
+
+ aItemContentSize.Width() += 2 * ITEM_TEXT_FLOW_SPACE;
+ }
+
+ if ( !bUseImage && !bUseText )
+ {
+ // have a minimal size - this is pure heuristics, but if it doesn't suit your needs, then give your panels
+ // a name and or image! :)
+ aItemContentSize = Size( 16, 16 );
+ }
+
+ aItemContentSize.Width() += 2 * ITEM_OUTER_SPACE;
+ aItemContentSize.Height() += 2 * ITEM_OUTER_SPACE;
+
+ return aItemContentSize;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::impl_renderItemContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) const
+ {
+ OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "PanelTabBar_Impl::impl_renderItemContent: illegal TabItemContent value!" );
+
+ Rectangle aRenderArea( i_rContentArea );
+ if ( IsVertical() )
+ {
+ aRenderArea.Top() += ITEM_OUTER_SPACE;
+ }
+ else
+ {
+ aRenderArea.Left() += ITEM_OUTER_SPACE;
+ }
+
+ // draw the image
+ const Image aItemImage( i_pPanel->GetImage() );
+ const Size aImageSize( aItemImage.GetSizePixel() );
+ const bool bUseImage = !!aItemImage && ( i_eItemContent != TABITEM_TEXT_ONLY );
+
+ if ( bUseImage )
+ {
+ Point aImagePos;
+ if ( IsVertical() )
+ {
+ aImagePos.X() = aRenderArea.Left() + ( aRenderArea.GetWidth() - aImageSize.Width() ) / 2;
+ aImagePos.Y() = aRenderArea.Top();
+ }
+ else
+ {
+ aImagePos.X() = aRenderArea.Left();
+ aImagePos.Y() = aRenderArea.Top() + ( aRenderArea.GetHeight() - aImageSize.Height() ) / 2;
+ }
+ m_rTabBar.DrawImage( aImagePos, aItemImage );
+ }
+
+ const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() );
+ const bool bUseText = ( sItemText.getLength() != 0 ) && ( i_eItemContent != TABITEM_IMAGE_ONLY );
+
+ if ( bUseText )
+ {
+ if ( IsVertical() )
+ {
+ if ( bUseImage )
+ aRenderArea.Top() += aImageSize.Height() + ITEM_ICON_TEXT_DISTANCE;
+ aRenderArea.Top() += ITEM_TEXT_FLOW_SPACE;
+ }
+ else
+ {
+ if ( bUseImage )
+ aRenderArea.Left() += aImageSize.Width() + ITEM_ICON_TEXT_DISTANCE;
+ aRenderArea.Left() += ITEM_TEXT_FLOW_SPACE;
+ }
+
+ // draw the text
+ const Size aTextSize( m_rTabBar.GetCtrlTextWidth( sItemText ), m_rTabBar.GetTextHeight() );
+ Point aTextPos( aRenderArea.TopLeft() );
+ if ( IsVertical() )
+ {
+ m_rTabBar.Push( PUSH_FONT );
+
+ Font aFont( m_rTabBar.GetFont() );
+ aFont.SetOrientation( 2700 );
+ aFont.SetVertical( TRUE );
+ m_rTabBar.SetFont( aFont );
+
+ aTextPos.X() += aTextSize.Height();
+ aTextPos.X() += ( aRenderArea.GetWidth() - aTextSize.Height() ) / 2;
+ }
+ else
+ {
+ aTextPos.Y() += ( aRenderArea.GetHeight() - aTextSize.Height() ) / 2;
+ }
+
+ m_rTabBar.DrawText( aTextPos, sItemText );
+
+ if ( IsVertical() )
+ {
+ m_rTabBar.Pop();
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const
+ {
+ BitmapEx aBitmap( m_aRenderDevice.GetBitmapEx(
+ i_rLogicalRect.TopLeft(),
+ Size(
+ i_rLogicalRect.GetSize().Width(),
+ i_rLogicalRect.GetSize().Height()
+ )
+ ) );
+ if ( IsVertical() )
+ {
+ aBitmap.Rotate( 2700, COL_BLACK );
+ if ( m_eTabAlignment == TABS_LEFT )
+ aBitmap.Mirror( BMP_MIRROR_HORZ );
+ }
+ else if ( m_eTabAlignment == TABS_BOTTOM )
+ {
+ aBitmap.Mirror( BMP_MIRROR_VERT );
+ }
+
+ const Rectangle aActualRect( m_aNormalizer.getTransformed( i_rLogicalRect, m_eTabAlignment ) );
+ m_rTabBar.DrawBitmapEx( aActualRect.TopLeft(), aBitmap );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::InvalidateItem( const size_t i_nItemIndex, const ItemFlags i_nAdditionalItemFlags ) const
+ {
+ const ItemDescriptor& rItem( m_aItems[ i_nItemIndex ] );
+ const ItemFlags nItemFlags( impl_getItemFlags( i_nItemIndex ) | i_nAdditionalItemFlags );
+
+ const Rectangle aNormalizedContent( GetActualLogicalItemRect( rItem.GetCurrentRect() ) );
+ const Rectangle aNormalizedBounds( m_pRenderer->calculateDecorations( aNormalizedContent, nItemFlags ) );
+
+ const Rectangle aActualBounds = m_aNormalizer.getTransformed( aNormalizedBounds, m_eTabAlignment );
+ m_rTabBar.Invalidate( aActualBounds );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ItemFlags PanelTabBar_Impl::impl_getItemFlags( const size_t i_nItemIndex ) const
+ {
+ ItemFlags nItemFlags( ITEM_STATE_NORMAL );
+ if ( m_aHoveredItem == i_nItemIndex )
+ {
+ nItemFlags |= ITEM_STATE_HOVERED;
+ if ( m_bMouseButtonDown )
+ nItemFlags |= ITEM_STATE_ACTIVE;
+ }
+
+ if ( m_rPanelDeck.GetActivePanel() == i_nItemIndex )
+ nItemFlags |= ITEM_STATE_ACTIVE;
+
+ if ( m_aFocusedItem == i_nItemIndex )
+ nItemFlags |= ITEM_STATE_FOCUSED;
+
+ if ( 0 == i_nItemIndex )
+ nItemFlags |= ITEM_POSITION_FIRST;
+
+ if ( m_rPanelDeck.GetPanelCount() - 1 == i_nItemIndex )
+ nItemFlags |= ITEM_POSITION_LAST;
+
+ return nItemFlags;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::DrawItem( const size_t i_nItemIndex, const Rectangle& i_rBoundaries ) const
+ {
+ const ItemDescriptor& rItem( m_aItems[ i_nItemIndex ] );
+ const ItemFlags nItemFlags( impl_getItemFlags( i_nItemIndex ) );
+
+ // the normalized bounding and content rect
+ const Rectangle aNormalizedContent( GetActualLogicalItemRect( rItem.GetCurrentRect() ) );
+ const Rectangle aNormalizedBounds( m_pRenderer->calculateDecorations( aNormalizedContent, nItemFlags ) );
+
+ // check whether the item actually overlaps with the painting area
+ if ( !i_rBoundaries.IsEmpty() )
+ {
+ const Rectangle aItemRect( GetActualLogicalItemRect( rItem.GetCurrentRect() ) );
+ if ( !aItemRect.IsOver( i_rBoundaries ) )
+ return;
+ }
+
+ m_rTabBar.SetUpdateMode( FALSE );
+
+ // the aligned bounding and content rect
+ const Rectangle aActualBounds = m_aNormalizer.getTransformed( aNormalizedBounds, m_eTabAlignment );
+ const Rectangle aActualContent = m_aNormalizer.getTransformed( aNormalizedContent, m_eTabAlignment );
+
+ // render item "background" layer
+ m_pRenderer->preRenderItem( aNormalizedContent, nItemFlags );
+
+ // copy from the virtual device to ourself
+ CopyFromRenderDevice( aNormalizedBounds );
+
+ // render the actual item content
+ impl_renderItemContent( rItem.pPanel, aActualContent, rItem.eContent );
+
+ // render item "foreground" layer
+ m_pRenderer->postRenderItem( m_rTabBar, aActualBounds, nItemFlags );
+
+ m_rTabBar.SetUpdateMode( TRUE );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::EnsureItemsCache()
+ {
+ if ( m_bItemsDirty == false )
+ {
+ DBG_CHECK( *this );
+ return;
+ }
+ impl_calcItemRects();
+ OSL_POSTCOND( m_bItemsDirty == false, "PanelTabBar_Impl::EnsureItemsCache: cache still dirty!" );
+ DBG_CHECK( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::Relayout()
+ {
+ EnsureItemsCache();
+
+ const Size aOutputSize( m_rTabBar.GetOutputSizePixel() );
+ m_aNormalizer = NormalizedArea( Rectangle( Point(), aOutputSize ), IsVertical() );
+ const Size aLogicalOutputSize( m_aNormalizer.getReferenceSize() );
+
+ // forward actual output size to our render device
+ m_aRenderDevice.SetOutputSizePixel( aLogicalOutputSize );
+
+ // re-calculate the size of the scroll buttons and of the items
+ m_aGeometry.relayout( aLogicalOutputSize, m_aItems );
+
+ if ( m_aGeometry.getButtonBackRect().IsEmpty() )
+ {
+ m_aScrollBack.Hide();
+ }
+ else
+ {
+ const Rectangle aButtonBack( m_aNormalizer.getTransformed( m_aGeometry.getButtonBackRect(), m_eTabAlignment ) );
+ m_aScrollBack.SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() );
+ m_aScrollBack.Show();
+ }
+
+ if ( m_aGeometry.getButtonForwardRect().IsEmpty() )
+ {
+ m_aScrollForward.Hide();
+ }
+ else
+ {
+ const Rectangle aButtonForward( m_aNormalizer.getTransformed( m_aGeometry.getButtonForwardRect(), m_eTabAlignment ) );
+ m_aScrollForward.SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() );
+ m_aScrollForward.Show();
+ }
+
+ UpdateScrollButtons();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< size_t > PanelTabBar_Impl::FindItemForPoint( const Point& i_rPoint ) const
+ {
+ Point aPoint( IsVertical() ? i_rPoint.Y() : i_rPoint.X(), IsVertical() ? i_rPoint.X() : i_rPoint.Y() );
+
+ if ( !m_aGeometry.getItemsRect().IsInside( aPoint ) )
+ return ::boost::optional< size_t >();
+
+ size_t i=0;
+ for ( ItemDescriptors::const_iterator item = m_aItems.begin();
+ item != m_aItems.end();
+ ++item, ++i
+ )
+ {
+ Rectangle aItemRect( GetActualLogicalItemRect( item->GetCurrentRect() ) );
+ if ( aItemRect.IsInside( aPoint ) )
+ {
+ return ::boost::optional< size_t >( i );
+ }
+ }
+ return ::boost::optional< size_t >();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle PanelTabBar_Impl::GetItemScreenRect( const size_t i_nItemPos ) const
+ {
+ ENSURE_OR_RETURN( i_nItemPos < m_aItems.size(), "PanelTabBar_Impl::GetItemScreenRect: invalid item pos!", Rectangle() );
+ const ItemDescriptor& rItem( m_aItems[ i_nItemPos ] );
+ const Rectangle aItemRect( m_aNormalizer.getTransformed(
+ GetActualLogicalItemRect( rItem.GetCurrentRect() ),
+ m_eTabAlignment ) );
+
+ const Rectangle aTabBarRect( m_rTabBar.GetWindowExtentsRelative( NULL ) );
+ return Rectangle(
+ Point( aTabBarRect.Left() + aItemRect.Left(), aTabBarRect.Top() + aItemRect.Top() ),
+ aItemRect.GetSize()
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::FocusItem( const ::boost::optional< size_t >& i_rItemPos )
+ {
+ // reset old focus item
+ if ( !!m_aFocusedItem )
+ InvalidateItem( *m_aFocusedItem );
+ m_aFocusedItem.reset();
+
+ // mark the active icon as focused
+ if ( !!i_rItemPos )
+ {
+ m_aFocusedItem = i_rItemPos;
+ InvalidateItem( *m_aFocusedItem );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( PanelTabBar_Impl, OnScroll, const PushButton*, i_pButton )
+ {
+ if ( i_pButton == &m_aScrollBack )
+ {
+ OSL_ENSURE( m_nScrollPosition > 0, "PanelTabBar_Impl::OnScroll: inconsistency!" );
+ --m_nScrollPosition;
+ m_rTabBar.Invalidate();
+ }
+ else if ( i_pButton == &m_aScrollForward )
+ {
+ OSL_ENSURE( m_nScrollPosition < m_aItems.size() - 1, "PanelTabBar_Impl::OnScroll: inconsistency!" );
+ ++m_nScrollPosition;
+ m_rTabBar.Invalidate();
+ }
+
+ UpdateScrollButtons();
+
+ return 0L;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle PanelTabBar_Impl::GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const
+ {
+ // care for the offset imposed by our geometry, i.e. whether or not we have scroll buttons
+ Rectangle aItemRect( i_rLogicalItemRect );
+ aItemRect.Move( m_aGeometry.getItemsRect().Left() - m_aGeometry.getButtonBackRect().Left(), 0 );
+
+ // care for the current scroll position
+ OSL_ENSURE( m_nScrollPosition < m_aItems.size(), "GetActualLogicalItemRect: invalid scroll position!" );
+ if ( ( m_nScrollPosition > 0 ) && ( m_nScrollPosition < m_aItems.size() ) )
+ {
+ long nOffsetX = m_aItems[ m_nScrollPosition ].GetCurrentRect().Left() - m_aItems[ 0 ].GetCurrentRect().Left();
+ long nOffsetY = m_aItems[ m_nScrollPosition ].GetCurrentRect().Top() - m_aItems[ 0 ].GetCurrentRect().Top();
+ aItemRect.Move( -nOffsetX, -nOffsetY );
+ }
+
+ return aItemRect;
+ }
+
+ //==================================================================================================================
+ //= PanelTabBar_Impl
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ EnsureItemsCache();
+
+ if ( !!i_rOldActive )
+ InvalidateItem( *i_rOldActive, ITEM_STATE_ACTIVE );
+ if ( !!i_rNewActive )
+ InvalidateItem( *i_rNewActive );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::LayouterChanged( const PDeckLayouter& i_rNewLayouter )
+ {
+ // not interested in
+ (void)i_rNewLayouter;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar_Impl::Dying()
+ {
+ // not interested in - the notifier is a member of this instance here, so we're dying ourself at the moment
+ }
+
+ //==================================================================================================================
+ //= PanelTabBar
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ PanelTabBar::PanelTabBar( Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
+ :Control( &i_rParentWindow, 0 )
+ ,m_pImpl( new PanelTabBar_Impl( *this, i_rPanelDeck, i_eAlignment, i_eItemContent ) )
+ {
+ DBG_CHECK( *m_pImpl );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ PanelTabBar::~PanelTabBar()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TabItemContent PanelTabBar::GetTabItemContent() const
+ {
+ return m_pImpl->m_aGeometry.getItemContent();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::SetTabItemContent( const TabItemContent& i_eItemContent )
+ {
+ m_pImpl->m_aGeometry.setItemContent( i_eItemContent );
+ m_pImpl->Relayout();
+ Invalidate();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IToolPanelDeck& PanelTabBar::GetPanelDeck() const
+ {
+ DBG_CHECK( *m_pImpl );
+ return m_pImpl->m_rPanelDeck;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Size PanelTabBar::GetOptimalSize( WindowSizeType i_eType ) const
+ {
+ m_pImpl->EnsureItemsCache();
+ Size aOptimalSize( m_pImpl->m_aGeometry.getOptimalSize( m_pImpl->m_aItems, i_eType == WINDOWSIZE_MINIMUM ) );
+ if ( m_pImpl->IsVertical() )
+ ::std::swap( aOptimalSize.Width(), aOptimalSize.Height() );
+ return aOptimalSize;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::Resize()
+ {
+ Control::Resize();
+ m_pImpl->Relayout();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::Paint( const Rectangle& i_rRect )
+ {
+ m_pImpl->EnsureItemsCache();
+
+ // background
+ const Rectangle aNormalizedPaintArea( m_pImpl->m_aNormalizer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) );
+ m_pImpl->m_aRenderDevice.Push( PUSH_CLIPREGION );
+ m_pImpl->m_aRenderDevice.SetClipRegion( aNormalizedPaintArea );
+ m_pImpl->m_pRenderer->renderBackground();
+ m_pImpl->m_aRenderDevice.Pop();
+ m_pImpl->CopyFromRenderDevice( aNormalizedPaintArea );
+
+ // ensure the items really paint into their own playground only
+ ClipItemRegion aClipItems( *m_pImpl );
+
+ const Rectangle aLogicalPaintRect( m_pImpl->m_aNormalizer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) );
+
+ const ::boost::optional< size_t > aActivePanel( m_pImpl->m_rPanelDeck.GetActivePanel() );
+ const ::boost::optional< size_t > aHoveredPanel( m_pImpl->m_aHoveredItem );
+
+ // items:
+ // 1. paint all non-active, non-hovered items
+ size_t i=0;
+ for ( ItemDescriptors::const_iterator item = m_pImpl->m_aItems.begin();
+ item != m_pImpl->m_aItems.end();
+ ++item, ++i
+ )
+ {
+ if ( i == aActivePanel )
+ continue;
+
+ if ( aHoveredPanel == i )
+ continue;
+
+ m_pImpl->DrawItem( i, aLogicalPaintRect );
+ }
+
+ // 2. paint the item which is hovered, /without/ the mouse button pressed down
+ if ( !!aHoveredPanel && !m_pImpl->m_bMouseButtonDown )
+ m_pImpl->DrawItem( *aHoveredPanel, aLogicalPaintRect );
+
+ // 3. paint the active item
+ if ( !!aActivePanel )
+ m_pImpl->DrawItem( *aActivePanel, aLogicalPaintRect );
+
+ // 4. paint the item which is hovered, /with/ the mouse button pressed down
+ if ( !!aHoveredPanel && m_pImpl->m_bMouseButtonDown )
+ m_pImpl->DrawItem( *aHoveredPanel, aLogicalPaintRect );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::MouseMove( const MouseEvent& i_rMouseEvent )
+ {
+ m_pImpl->EnsureItemsCache();
+
+ ::boost::optional< size_t > aOldItem( m_pImpl->m_aHoveredItem );
+ ::boost::optional< size_t > aNewItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) );
+
+ if ( i_rMouseEvent.IsLeaveWindow() )
+ aNewItem.reset();
+
+ if ( aOldItem != aNewItem )
+ {
+ if ( !!aOldItem )
+ m_pImpl->InvalidateItem( *aOldItem );
+
+ m_pImpl->m_aHoveredItem = aNewItem;
+
+ if ( !!aNewItem )
+ m_pImpl->InvalidateItem( *aNewItem );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::MouseButtonDown( const MouseEvent& i_rMouseEvent )
+ {
+ Control::MouseButtonDown( i_rMouseEvent );
+
+ if ( !i_rMouseEvent.IsLeft() )
+ return;
+
+ m_pImpl->EnsureItemsCache();
+
+ ::boost::optional< size_t > aHitItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) );
+ if ( !aHitItem )
+ return;
+
+ CaptureMouse();
+ m_pImpl->m_bMouseButtonDown = true;
+
+ m_pImpl->InvalidateItem( *aHitItem );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::MouseButtonUp( const MouseEvent& i_rMouseEvent )
+ {
+ Control::MouseButtonUp( i_rMouseEvent );
+
+ if ( m_pImpl->m_bMouseButtonDown )
+ {
+ ::boost::optional< size_t > aHitItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) );
+ if ( !!aHitItem )
+ {
+ // re-draw that item now that we're not in mouse-down mode anymore
+ m_pImpl->InvalidateItem( *aHitItem );
+ // activate the respective panel
+ m_pImpl->m_rPanelDeck.ActivatePanel( *aHitItem );
+ }
+
+ OSL_ENSURE( IsMouseCaptured(), "PanelTabBar::MouseButtonUp: inconsistency!" );
+ if ( IsMouseCaptured() )
+ ReleaseMouse();
+ m_pImpl->m_bMouseButtonDown = false;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::RequestHelp( const HelpEvent& i_rHelpEvent )
+ {
+ m_pImpl->EnsureItemsCache();
+
+ ::boost::optional< size_t > aHelpItem( m_pImpl->FindItemForPoint( ScreenToOutputPixel( i_rHelpEvent.GetMousePosPixel() ) ) );
+ if ( !aHelpItem )
+ return;
+
+ const ItemDescriptor& rItem( m_pImpl->m_aItems[ *aHelpItem ] );
+ if ( rItem.eContent != TABITEM_IMAGE_ONLY )
+ // if the text is displayed for the item, we do not need to show it as tooltip
+ return;
+
+ const ::rtl::OUString sItemText( rItem.pPanel->GetDisplayName() );
+ if ( i_rHelpEvent.GetMode() == HELPMODE_BALLOON )
+ Help::ShowBalloon( this, OutputToScreenPixel( rItem.GetCurrentRect().Center() ), rItem.GetCurrentRect(), sItemText );
+ else
+ Help::ShowQuickHelp( this, rItem.GetCurrentRect(), sItemText );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::GetFocus()
+ {
+ Control::GetFocus();
+ if ( !m_pImpl->m_aFocusedItem )
+ m_pImpl->FocusItem( m_pImpl->m_rPanelDeck.GetActivePanel() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::LoseFocus()
+ {
+ Control::LoseFocus();
+
+ if ( !!m_pImpl->m_aFocusedItem )
+ {
+ m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem );
+ }
+
+ m_pImpl->m_aFocusedItem.reset();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ class KeyInputHandler
+ {
+ public:
+ KeyInputHandler( Control& i_rControl, const KeyEvent& i_rKeyEvent )
+ :m_rControl( i_rControl )
+ ,m_rKeyEvent( i_rKeyEvent )
+ ,m_bHandled( false )
+ {
+ }
+
+ ~KeyInputHandler()
+ {
+ if ( !m_bHandled )
+ m_rControl.Control::KeyInput( m_rKeyEvent );
+ }
+
+ void setHandled()
+ {
+ m_bHandled = true;
+ }
+
+ private:
+ Control& m_rControl;
+ const KeyEvent& m_rKeyEvent;
+ bool m_bHandled;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::KeyInput( const KeyEvent& i_rKeyEvent )
+ {
+ KeyInputHandler aKeyInputHandler( *this, i_rKeyEvent );
+
+ const KeyCode& rKeyCode( i_rKeyEvent.GetKeyCode() );
+ if ( rKeyCode.GetModifier() != 0 )
+ // only interested in mere key presses
+ return;
+
+ // if there are less than 2 panels, we cannot travel them ...
+ const size_t nPanelCount( m_pImpl->m_rPanelDeck.GetPanelCount() );
+ if ( nPanelCount < 2 )
+ return;
+
+ OSL_PRECOND( !!m_pImpl->m_aFocusedItem, "PanelTabBar::KeyInput: we should have a focused item here!" );
+ // if we get KeyInput events, we should have the focus. In this case, m_aFocusedItem should not be empty,
+ // except if there are no panels, but then we bail out of this method here earlier ...
+
+ bool bFocusNext = false;
+ bool bFocusPrev = false;
+
+ switch ( rKeyCode.GetCode() )
+ {
+ case KEY_UP: bFocusPrev = true; break;
+ case KEY_DOWN: bFocusNext = true; break;
+ case KEY_LEFT:
+ if ( IsRTLEnabled() )
+ bFocusNext = true;
+ else
+ bFocusPrev = true;
+ break;
+ case KEY_RIGHT:
+ if ( IsRTLEnabled() )
+ bFocusPrev = true;
+ else
+ bFocusNext = true;
+ break;
+ case KEY_RETURN:
+ m_pImpl->m_rPanelDeck.ActivatePanel( *m_pImpl->m_aFocusedItem );
+ break;
+ }
+
+ if ( !bFocusNext && !bFocusPrev )
+ return;
+
+ m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem );
+ if ( bFocusNext )
+ {
+ m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + 1 ) % nPanelCount );
+ }
+ else
+ {
+ m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + nPanelCount - 1 ) % nPanelCount );
+ }
+ m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem );
+
+ // don't delegate to base class
+ aKeyInputHandler.setHandled();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::DataChanged( const DataChangedEvent& i_rDataChanedEvent )
+ {
+ Control::DataChanged( i_rDataChanedEvent );
+
+ if ( ( i_rDataChanedEvent.GetType() == DATACHANGED_SETTINGS )
+ && ( ( i_rDataChanedEvent.GetFlags() & SETTINGS_STYLE ) != 0 )
+ )
+ {
+ Invalidate();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool PanelTabBar::IsVertical() const
+ {
+ return m_pImpl->IsVertical();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ PushButton& PanelTabBar::GetScrollButton( const bool i_bForward )
+ {
+ return i_bForward ? m_pImpl->m_aScrollForward : m_pImpl->m_aScrollBack;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< size_t > PanelTabBar::GetFocusedPanelItem() const
+ {
+ return m_pImpl->m_aFocusedItem;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void PanelTabBar::FocusPanelItem( const size_t i_nItemPos )
+ {
+ ENSURE_OR_RETURN_VOID( i_nItemPos < m_pImpl->m_rPanelDeck.GetPanelCount(), "PanelTabBar::FocusPanelItem: illegal item pos!" );
+
+ if ( !HasChildPathFocus() )
+ GrabFocus();
+
+ m_pImpl->FocusItem( i_nItemPos );
+ OSL_POSTCOND( !!m_pImpl->m_aFocusedItem, "PanelTabBar::FocusPanelItem: have the focus, but no focused item?" );
+ if ( !!m_pImpl->m_aFocusedItem )
+ m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem );
+ m_pImpl->m_aFocusedItem.reset( i_nItemPos );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle PanelTabBar::GetItemScreenRect( const size_t i_nItemPos ) const
+ {
+ return m_pImpl->GetItemScreenRect( i_nItemPos );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWindowPeer > PanelTabBar::GetComponentInterface( BOOL i_bCreate )
+ {
+ Reference< XWindowPeer > xWindowPeer( Control::GetComponentInterface( FALSE ) );
+ if ( !xWindowPeer.is() && i_bCreate )
+ {
+ xWindowPeer.set( new PanelTabBarPeer( *this ) );
+ SetComponentInterface( xWindowPeer );
+ }
+ return xWindowPeer;
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/paneltabbarpeer.cxx b/svtools/source/toolpanel/paneltabbarpeer.cxx
new file mode 100644
index 000000000000..d8329109ffb4
--- /dev/null
+++ b/svtools/source/toolpanel/paneltabbarpeer.cxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "paneltabbarpeer.hxx"
+#include "svtools/toolpanel/paneltabbar.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::accessibility::XAccessibleContext;
+ using ::com::sun::star::lang::DisposedException;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= PanelTabBarPeer
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ PanelTabBarPeer::PanelTabBarPeer( PanelTabBar& i_rTabBar )
+ :VCLXWindow()
+ ,m_pTabBar( &i_rTabBar )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ PanelTabBarPeer::~PanelTabBarPeer()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessibleContext > PanelTabBarPeer::CreateAccessibleContext()
+ {
+ ::vos::OGuard aSolarGuard( GetMutex() );
+ if ( m_pTabBar == NULL )
+ throw DisposedException( ::rtl::OUString(), *this );
+
+
+
+ Window* pAccessibleParent( m_pTabBar->GetAccessibleParentWindow() );
+ ENSURE_OR_RETURN( pAccessibleParent != NULL, "no accessible parent => no accessible context", NULL );
+ Reference< XAccessible > xAccessibleParent( pAccessibleParent->GetAccessible(), UNO_SET_THROW );
+ return m_aAccessibleFactory.getFactory().createAccessibleToolPanelTabBar( xAccessibleParent, m_pTabBar->GetPanelDeck(), *m_pTabBar );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL PanelTabBarPeer::dispose() throw(RuntimeException)
+ {
+ {
+ ::vos::OGuard aSolarGuard( GetMutex() );
+ m_pTabBar = NULL;
+ }
+ VCLXWindow::dispose();
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/paneltabbarpeer.hxx b/svtools/source/toolpanel/paneltabbarpeer.hxx
new file mode 100644
index 000000000000..7c2e5188d994
--- /dev/null
+++ b/svtools/source/toolpanel/paneltabbarpeer.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVT_PANELTABBARPEER_HXX
+#define SVT_PANELTABBARPEER_HXX
+
+#include "svtaccessiblefactory.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ class PanelTabBar;
+ //====================================================================
+ //= PanelTabBarPeer
+ //====================================================================
+ class PanelTabBarPeer : public VCLXWindow
+ {
+ public:
+ PanelTabBarPeer( PanelTabBar& i_rTabBar );
+
+ protected:
+ ~PanelTabBarPeer();
+
+ // VCLXWindow overridables
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+
+ // XComponent
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ private:
+ AccessibleFactoryAccess m_aAccessibleFactory;
+ PanelTabBar* m_pTabBar;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_PANELTABBARPEER_HXX
diff --git a/svtools/source/toolpanel/refbase.cxx b/svtools/source/toolpanel/refbase.cxx
new file mode 100644
index 000000000000..f41aa2d9bb9c
--- /dev/null
+++ b/svtools/source/toolpanel/refbase.cxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "svtools/toolpanel/refbase.hxx"
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= RefBase
+ //====================================================================
+ //--------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL RefBase::acquire()
+ {
+ return osl_incrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL RefBase::release()
+ {
+ oslInterlockedCount newCount = osl_decrementInterlockedCount( &m_refCount );
+ if ( 0 == newCount )
+ delete this;
+ return newCount;
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx
new file mode 100644
index 000000000000..45c40cee6ef2
--- /dev/null
+++ b/svtools/source/toolpanel/tabbargeometry.cxx
@@ -0,0 +1,328 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "tabbargeometry.hxx"
+
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/numeric/ftools.hxx>
+
+#include <vcl/window.hxx>
+
+#include <algorithm>
+
+// the width (or height, depending on alignment) of the scroll buttons
+#define BUTTON_FLOW_WIDTH 20
+// the space between the scroll buttons and the items
+#define BUTTON_FLOW_SPACE 2
+// outer space to apply between the tab bar borders and any content. Note that those refer to a "normalized" geometry,
+// i.e. if the tab bar were aligned at the top
+#define OUTER_SPACE_LEFT 2
+#define OUTER_SPACE_TOP 4
+#define OUTER_SPACE_RIGHT 4
+#define OUTER_SPACE_BOTTOM 2
+
+// outer space to apply between the area for the items, and the actual items. They refer to a normalized geometry.
+#define ITEMS_INSET_LEFT 4
+#define ITEMS_INSET_TOP 3
+#define ITEMS_INSET_RIGHT 4
+#define ITEMS_INSET_BOTTOM 0
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------------------------------------------------
+ static void lcl_transform( Rectangle& io_rRect, const ::basegfx::B2DHomMatrix& i_rTransformation )
+ {
+ ::basegfx::B2DRange aRect( io_rRect.Left(), io_rRect.Top(), io_rRect.Right(), io_rRect.Bottom() );
+ aRect.transform( i_rTransformation );
+ io_rRect.Left() = long( aRect.getMinX() );
+ io_rRect.Top() = long( aRect.getMinY() );
+ io_rRect.Right() = long( aRect.getMaxX() );
+ io_rRect.Bottom() = long( aRect.getMaxY() );
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ /** transforms the given, possible rotated playground,
+ */
+ void lcl_rotate( const Rectangle& i_rReference, Rectangle& io_rArea, const bool i_bRight )
+ {
+ // step 1: move the to-be-upper-left corner (left/bottom) of the rectangle to (0,0)
+ ::basegfx::B2DHomMatrix aTransformation;
+ aTransformation.translate(
+ i_bRight ? -i_rReference.Left() : -i_rReference.Right(),
+ i_bRight ? -i_rReference.Bottom() : -i_rReference.Top()
+ );
+
+ // step 2: rotate by -90 degrees
+ aTransformation.rotate( i_bRight ? +F_PI2 : -F_PI2 );
+ // note:
+ // on the screen, the ordinate goes top-down, while basegfx calculates in a system where the
+ // ordinate goes bottom-up; thus the "wrong" sign before F_PI2 here
+
+ // step 3: move back to original coordinates
+ aTransformation.translate( i_rReference.Left(), i_rReference.Top() );
+
+ // apply transformation
+ lcl_transform( io_rArea, aTransformation );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void lcl_mirrorHorizontally( const Rectangle& i_rReferenceArea, Rectangle& io_rArea )
+ {
+ io_rArea.Left() = i_rReferenceArea.Left() + i_rReferenceArea.Right() - io_rArea.Left();
+ io_rArea.Right() = i_rReferenceArea.Left() + i_rReferenceArea.Right() - io_rArea.Right();
+ ::std::swap( io_rArea.Left(), io_rArea.Right() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void lcl_mirrorVertically( const Rectangle& i_rReferenceArea, Rectangle& io_rArea )
+ {
+ io_rArea.Top() = i_rReferenceArea.Top() + i_rReferenceArea.Bottom() - io_rArea.Top();
+ io_rArea.Bottom() = i_rReferenceArea.Top() + i_rReferenceArea.Bottom() - io_rArea.Bottom();
+ ::std::swap( io_rArea.Top(), io_rArea.Bottom() );
+ }
+
+ //==================================================================================================================
+ //= NormalizedArea
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ NormalizedArea::NormalizedArea()
+ :m_aReference()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ NormalizedArea::NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical )
+ :m_aReference( i_bIsVertical ? Rectangle( i_rReference.TopLeft(), Size( i_rReference.GetHeight(), i_rReference.GetWidth() ) ) : i_rReference )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle NormalizedArea::getTransformed( const Rectangle& i_rArea, const TabAlignment i_eTargetAlignment ) const
+ {
+ Rectangle aResult( i_rArea );
+
+ if ( ( i_eTargetAlignment == TABS_RIGHT )
+ || ( i_eTargetAlignment == TABS_LEFT )
+ )
+ {
+ lcl_rotate( m_aReference, aResult, true );
+
+ if ( i_eTargetAlignment == TABS_LEFT )
+ {
+ Rectangle aReference( m_aReference );
+ aReference.Transpose();
+ lcl_mirrorHorizontally( aReference, aResult );
+ }
+ }
+ else
+ if ( i_eTargetAlignment == TABS_BOTTOM )
+ {
+ lcl_mirrorVertically( m_aReference, aResult );
+ }
+
+ return aResult;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle NormalizedArea::getNormalized( const Rectangle& i_rArea, const TabAlignment i_eTargetAlignment ) const
+ {
+ Rectangle aResult( i_rArea );
+
+ if ( ( i_eTargetAlignment == TABS_RIGHT )
+ || ( i_eTargetAlignment == TABS_LEFT )
+ )
+ {
+ Rectangle aReference( m_aReference );
+ lcl_rotate( m_aReference, aReference, true );
+
+ if ( i_eTargetAlignment == TABS_LEFT )
+ {
+ lcl_mirrorHorizontally( aReference, aResult );
+ }
+
+ lcl_rotate( aReference, aResult, false );
+ }
+ else
+ if ( i_eTargetAlignment == TABS_BOTTOM )
+ {
+ lcl_mirrorVertically( m_aReference, aResult );
+ }
+ return aResult;
+ }
+
+ //==================================================================================================================
+ //= TabBarGeometry
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ TabBarGeometry::TabBarGeometry( const TabItemContent i_eItemContent )
+ :m_eTabItemContent( i_eItemContent )
+ ,m_aItemsInset()
+ ,m_aButtonBackRect()
+ ,m_aItemsRect()
+ ,m_aButtonForwardRect()
+ {
+ m_aItemsInset.Left() = ITEMS_INSET_LEFT;
+ m_aItemsInset.Top() = ITEMS_INSET_TOP;
+ m_aItemsInset.Right() = ITEMS_INSET_RIGHT;
+ m_aItemsInset.Bottom() = ITEMS_INSET_BOTTOM;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TabBarGeometry::~TabBarGeometry()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool TabBarGeometry::impl_fitItems( ItemDescriptors& io_rItems ) const
+ {
+ if ( io_rItems.empty() )
+ // nothing to do, "no items" perfectly fit into any space we have ...
+ return true;
+
+ // the available size
+ Size aOutputSize( getItemsRect().GetSize() );
+ // shrunk by the outer space
+ aOutputSize.Width() -= m_aItemsInset.Right();
+ aOutputSize.Height() -= m_aItemsInset.Bottom();
+ const Rectangle aFitInto( Point( 0, 0 ), aOutputSize );
+
+ TabItemContent eItemContent( getItemContent() );
+ if ( eItemContent == TABITEM_AUTO )
+ {
+ // the "content modes" to try
+ TabItemContent eTryThis[] =
+ {
+ TABITEM_IMAGE_ONLY, // assumed to have the smallest rects
+ TABITEM_TEXT_ONLY,
+ TABITEM_IMAGE_AND_TEXT // assumed to have the largest rects
+ };
+
+
+ // determine which of the different version fits
+ eItemContent = eTryThis[0];
+ size_t nTryIndex = 2;
+ while ( nTryIndex > 0 )
+ {
+ const Point aBottomRight( io_rItems.rbegin()->GetRect( eTryThis[ nTryIndex ] ).BottomRight() );
+ if ( aFitInto.IsInside( aBottomRight ) )
+ {
+ eItemContent = eTryThis[ nTryIndex ];
+ break;
+ }
+ --nTryIndex;
+ }
+ }
+
+ // propagate to the items
+ for ( ItemDescriptors::iterator item = io_rItems.begin();
+ item != io_rItems.end();
+ ++item
+ )
+ {
+ item->eContent = eItemContent;
+ }
+
+ const ItemDescriptor& rLastItem( *io_rItems.rbegin() );
+ const Point aLastItemBottomRight( rLastItem.GetCurrentRect().BottomRight() );
+ return aFitInto.Left() <= aLastItemBottomRight.X()
+ && aFitInto.Right() >= aLastItemBottomRight.X();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Size TabBarGeometry::getOptimalSize( ItemDescriptors& io_rItems, const bool i_bMinimalSize ) const
+ {
+ if ( io_rItems.empty() )
+ return Size(
+ m_aItemsInset.Left() + m_aItemsInset.Right(),
+ m_aItemsInset.Top() + m_aItemsInset.Bottom()
+ );
+
+ // the rect of the last item
+ const Rectangle& rLastItemRect( i_bMinimalSize ? io_rItems.rbegin()->aIconOnlyArea : io_rItems.rbegin()->aCompleteArea );
+ return Size(
+ rLastItemRect.Left() + 1 + m_aItemsInset.Right(),
+ rLastItemRect.Top() + 1 + rLastItemRect.Bottom() + m_aItemsInset.Bottom()
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TabBarGeometry::relayout( const Size& i_rActualOutputSize, ItemDescriptors& io_rItems )
+ {
+ // assume all items fit
+ Point aButtonBackPos( OUTER_SPACE_LEFT, OUTER_SPACE_TOP );
+ m_aButtonBackRect = Rectangle( aButtonBackPos, Size( 1, 1 ) );
+ m_aButtonBackRect.SetEmpty();
+
+ Point aButtonForwardPos( i_rActualOutputSize.Width(), OUTER_SPACE_TOP );
+ m_aButtonForwardRect = Rectangle( aButtonForwardPos, Size( 1, 1 ) );
+ m_aButtonForwardRect.SetEmpty();
+
+ Point aItemsPos( OUTER_SPACE_LEFT, 0 );
+ Size aItemsSize( i_rActualOutputSize.Width() - OUTER_SPACE_LEFT - OUTER_SPACE_RIGHT, i_rActualOutputSize.Height() );
+ m_aItemsRect = Rectangle( aItemsPos, aItemsSize );
+
+ if ( !impl_fitItems( io_rItems ) )
+ {
+ // assumption was wrong, the items do not fit => calculate rects for the scroll buttons
+ const Size aButtonSize( BUTTON_FLOW_WIDTH, i_rActualOutputSize.Height() - OUTER_SPACE_TOP - OUTER_SPACE_BOTTOM );
+
+ aButtonBackPos = Point( OUTER_SPACE_LEFT, OUTER_SPACE_TOP );
+ m_aButtonBackRect = Rectangle( aButtonBackPos, aButtonSize );
+
+ aButtonForwardPos = Point( i_rActualOutputSize.Width() - BUTTON_FLOW_WIDTH - OUTER_SPACE_RIGHT, OUTER_SPACE_TOP );
+ m_aButtonForwardRect = Rectangle( aButtonForwardPos, aButtonSize );
+
+ aItemsPos.X() = aButtonBackPos.X() + aButtonSize.Width() + BUTTON_FLOW_SPACE;
+ aItemsSize.Width() = aButtonForwardPos.X() - BUTTON_FLOW_SPACE - aItemsPos.X();
+ m_aItemsRect = Rectangle( aItemsPos, aItemsSize );
+
+ // fit items, again. In the TABITEM_AUTO case, the smaller playground for the items might lead to another
+ // item content.
+ impl_fitItems( io_rItems );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Point TabBarGeometry::getFirstItemPosition() const
+ {
+ return Point( m_aItemsInset.Left(), m_aItemsInset.Top() );
+ }
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/toolpanel/tabbargeometry.hxx b/svtools/source/toolpanel/tabbargeometry.hxx
new file mode 100644
index 000000000000..059d69a3e233
--- /dev/null
+++ b/svtools/source/toolpanel/tabbargeometry.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef TABBARGEOMETRY_HXX
+#define TABBARGEOMETRY_HXX
+
+#include "svtools/toolpanel/tabalignment.hxx"
+
+#include "tabitemdescriptor.hxx"
+
+#include <tools/gen.hxx>
+#include <tools/svborder.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= NormalizedArea
+ //==================================================================================================================
+ /** a rectangle which automatically translates between unrotated and rotated geometry.
+
+ It can be operated as if it were an unrotated area, but is able to provide corrdinates of rotated objects,
+ relative to its playground.
+ */
+ class NormalizedArea
+ {
+ public:
+ NormalizedArea();
+ NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical );
+
+ /** transforms a rectangle, relative to our playground, into a coordinate system defined by the given alignment
+ @param i_rArea
+ the area which is to be transformed.
+ */
+ Rectangle getTransformed(
+ const Rectangle& i_rArea,
+ const TabAlignment i_eTargetAlignment
+ ) const;
+
+ /** normalizes an already transformed rectangle
+ @param i_rArea
+ the area which is to be normalized.
+ */
+ Rectangle getNormalized(
+ const Rectangle& i_rArea,
+ const TabAlignment i_eTargetAlignment
+ ) const;
+
+
+ Size getReferenceSize() const { return m_aReference.GetSize(); }
+ const Rectangle&
+ getReference() const { return m_aReference; }
+
+ private:
+ // the normalized reference area
+ Rectangle m_aReference;
+ };
+
+ //==================================================================================================================
+ //= TabBarGeometry
+ //==================================================================================================================
+ class TabBarGeometry_Impl;
+ class TabBarGeometry
+ {
+ public:
+ TabBarGeometry( const TabItemContent i_eItemContent );
+ ~TabBarGeometry();
+
+ // retrieves the rectangle to be occupied by the button for scrolling backward through the items
+ const Rectangle& getButtonBackRect() const { return m_aButtonBackRect; }
+ // retrieves the rectangle to be occupied by the items
+ const Rectangle& getItemsRect() const { return m_aItemsRect; }
+ // retrieves the rectangle to be occupied by the button for scrolling forward through the items
+ const Rectangle& getButtonForwardRect() const { return m_aButtonForwardRect; }
+
+ inline TabItemContent
+ getItemContent() const { return m_eTabItemContent; }
+ inline void setItemContent( const TabItemContent i_eItemContent ) { m_eTabItemContent = i_eItemContent; }
+
+ /** adjusts the sizes of the buttons and the item's playground, plus the sizes of the items
+ */
+ void relayout( const Size& i_rActualOutputSize, ItemDescriptors& io_rItems );
+
+ /** calculates the optimal size of the tab bar, depending on the item's sizes
+ */
+ Size getOptimalSize( ItemDescriptors& io_rItems, const bool i_bMinimalSize ) const;
+
+ /** retrieves the position where the first item should start, relative to the item rect
+ */
+ Point getFirstItemPosition() const;
+
+ private:
+ bool impl_fitItems( ItemDescriptors& io_rItems ) const;
+
+ private:
+ /// specifies the content to be displayed in the tab items
+ TabItemContent m_eTabItemContent;
+ /// specifies the inset to be used in the items area, depends on the actual alignment
+ SvBorder m_aItemsInset;
+ // the (logical) rectangle to be used for the "back" button, empty if the button is not needed
+ Rectangle m_aButtonBackRect;
+ // the (logical) rectangle to be used for the items
+ Rectangle m_aItemsRect;
+ // the (logical) rectangle to be used for the "forward" button, empty if the button is not needed
+ Rectangle m_aButtonForwardRect;
+ };
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
+
+#endif // TABBARGEOMETRY_HXX
diff --git a/svtools/source/toolpanel/tabitemdescriptor.hxx b/svtools/source/toolpanel/tabitemdescriptor.hxx
new file mode 100644
index 000000000000..8005816b0fe2
--- /dev/null
+++ b/svtools/source/toolpanel/tabitemdescriptor.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef TABITEMDESCRIPTOR_HXX
+#define TABITEMDESCRIPTOR_HXX
+
+#include "svtools/toolpanel/toolpanel.hxx"
+#include "svtools/toolpanel/tabitemcontent.hxx"
+
+#include <tools/gen.hxx>
+#include <osl/diagnose.h>
+
+#include <vector>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //==================================================================================================================
+ //= ItemDescriptor
+ //==================================================================================================================
+ struct ItemDescriptor
+ {
+ PToolPanel pPanel;
+ Rectangle aCompleteArea; // bounding area if the both text and icon are to be rendererd
+ Rectangle aIconOnlyArea; // bounding area if the icon is to be rendererd
+ Rectangle aTextOnlyArea; // bounding area if the text is to be rendererd
+ TabItemContent eContent;
+ // content to be used for this particular item. Might differ from item content which has been set
+ // up for the complete control, in case not the complete content fits into the available space.
+
+ ItemDescriptor()
+ :pPanel()
+ ,aCompleteArea()
+ ,aIconOnlyArea()
+ ,aTextOnlyArea()
+ ,eContent( TABITEM_IMAGE_AND_TEXT )
+ {
+ }
+
+ const Rectangle& GetRect( const TabItemContent i_eItemContent ) const
+ {
+ OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "ItemDescriptor::GetRect: illegal value!" );
+
+ return ( i_eItemContent == TABITEM_IMAGE_AND_TEXT )
+ ? aCompleteArea
+ : ( ( i_eItemContent == TABITEM_TEXT_ONLY )
+ ? aTextOnlyArea
+ : aIconOnlyArea
+ );
+ }
+
+ const Rectangle& GetCurrentRect() const
+ {
+ return GetRect( eContent );
+ }
+ };
+
+ typedef ::std::vector< ItemDescriptor > ItemDescriptors;
+
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // TABITEMDESCRIPTOR_HXX
diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx
new file mode 100755
index 000000000000..f68bbc1bbd0f
--- /dev/null
+++ b/svtools/source/toolpanel/tablayouter.cxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "svtools/toolpanel/tablayouter.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+#include "svtools/toolpanel/paneltabbar.hxx"
+#include "svtaccessiblefactory.hxx"
+
+#include <tools/gen.hxx>
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::accessibility::XAccessible;
+
+ //====================================================================
+ //= TabDeckLayouter_Data
+ //====================================================================
+ struct TabDeckLayouter_Data
+ {
+ TabAlignment eAlignment;
+ IToolPanelDeck& rPanels;
+ ::std::auto_ptr< PanelTabBar > pTabBar;
+ AccessibleFactoryAccess aAccessibleFactory;
+
+ TabDeckLayouter_Data( Window& i_rParent, IToolPanelDeck& i_rPanels,
+ const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
+ :eAlignment( i_eAlignment )
+ ,rPanels( i_rPanels )
+ ,pTabBar( new PanelTabBar( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) )
+ {
+ pTabBar->Show();
+ }
+ };
+
+ //====================================================================
+ //= helper
+ //====================================================================
+ namespace
+ {
+ static bool lcl_isVerticalTabBar( const TabAlignment i_eAlignment )
+ {
+ return ( i_eAlignment == TABS_RIGHT )
+ || ( i_eAlignment == TABS_LEFT );
+ }
+
+ static bool lcl_checkDisposed( const TabDeckLayouter_Data& i_rData )
+ {
+ if ( !i_rData.pTabBar.get() )
+ {
+ OSL_ENSURE( false, "lcl_checkDisposed: already disposed!" );
+ return true;
+ }
+ return false;
+ }
+ }
+
+ //====================================================================
+ //= TabDeckLayouter
+ //====================================================================
+ //--------------------------------------------------------------------
+ TabDeckLayouter::TabDeckLayouter( Window& i_rParent, IToolPanelDeck& i_rPanels,
+ const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
+ :m_pData( new TabDeckLayouter_Data( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ TabDeckLayouter::~TabDeckLayouter()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_IREFERENCE( TabDeckLayouter )
+
+ //--------------------------------------------------------------------
+ TabItemContent TabDeckLayouter::GetTabItemContent() const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return TABITEM_IMAGE_AND_TEXT;
+ return m_pData->pTabBar->GetTabItemContent();
+ }
+
+ //--------------------------------------------------------------------
+ void TabDeckLayouter::SetTabItemContent( const TabItemContent& i_eItemContent )
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return;
+ m_pData->pTabBar->SetTabItemContent( i_eItemContent );
+ }
+
+ //--------------------------------------------------------------------
+ TabAlignment TabDeckLayouter::GetTabAlignment() const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return TABS_RIGHT;
+ return m_pData->eAlignment;
+ }
+
+ //--------------------------------------------------------------------
+ ::boost::optional< size_t > TabDeckLayouter::GetFocusedPanelItem() const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return ::boost::optional< size_t >();
+ return m_pData->pTabBar->GetFocusedPanelItem();
+ }
+
+ //--------------------------------------------------------------------
+ void TabDeckLayouter::FocusPanelItem( const size_t i_nItemPos )
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return;
+ m_pData->pTabBar->FocusPanelItem( i_nItemPos );
+ }
+
+ //--------------------------------------------------------------------
+ bool TabDeckLayouter::IsPanelSelectorEnabled() const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return false;
+ return m_pData->pTabBar->IsEnabled();
+ }
+
+ //--------------------------------------------------------------------
+ bool TabDeckLayouter::IsPanelSelectorVisible() const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return false;
+ return m_pData->pTabBar->IsVisible();
+ }
+
+ //--------------------------------------------------------------------
+ Rectangle TabDeckLayouter::GetItemScreenRect( const size_t i_nItemPos ) const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return Rectangle();
+ return m_pData->pTabBar->GetItemScreenRect( i_nItemPos );
+ }
+
+ //--------------------------------------------------------------------
+ Rectangle TabDeckLayouter::Layout( const Rectangle& i_rDeckPlayground )
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return i_rDeckPlayground;
+
+ const Size aPreferredSize( m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_PREFERRED ) );
+ if ( lcl_isVerticalTabBar( m_pData->eAlignment ) )
+ {
+ Size aTabBarSize = ( aPreferredSize.Width() < i_rDeckPlayground.GetWidth() )
+ ? aPreferredSize
+ : m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_MINIMUM );
+ aTabBarSize.Height() = i_rDeckPlayground.GetHeight();
+
+ Rectangle aPanelRect( i_rDeckPlayground );
+ if ( m_pData->eAlignment == TABS_RIGHT )
+ {
+ aPanelRect.Right() -= aTabBarSize.Width();
+ Point aTabBarTopLeft( aPanelRect.TopRight() );
+ aTabBarTopLeft.X() += 1;
+ m_pData->pTabBar->SetPosSizePixel( aTabBarTopLeft, aTabBarSize );
+ }
+ else
+ {
+ m_pData->pTabBar->SetPosSizePixel( aPanelRect.TopLeft(), aTabBarSize );
+ aPanelRect.Left() += aTabBarSize.Width();
+ }
+ if ( aPanelRect.Left() >= aPanelRect.Right() )
+ aPanelRect = Rectangle();
+
+ return aPanelRect;
+ }
+
+ Size aTabBarSize = ( aPreferredSize.Height() < i_rDeckPlayground.GetHeight() )
+ ? aPreferredSize
+ : m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_MINIMUM );
+ aTabBarSize.Width() = i_rDeckPlayground.GetWidth();
+
+ Rectangle aPanelRect( i_rDeckPlayground );
+ if ( m_pData->eAlignment == TABS_TOP )
+ {
+ m_pData->pTabBar->SetPosSizePixel( aPanelRect.TopLeft(), aTabBarSize );
+ aPanelRect.Top() += aTabBarSize.Height();
+ }
+ else
+ {
+ aPanelRect.Bottom() -= aTabBarSize.Height();
+ Point aTabBarTopLeft( aPanelRect.BottomLeft() );
+ aTabBarTopLeft.Y() -= 1;
+ m_pData->pTabBar->SetPosSizePixel( aTabBarTopLeft, aTabBarSize );
+ }
+ if ( aPanelRect.Top() >= aPanelRect.Bottom() )
+ aPanelRect = Rectangle();
+
+ return aPanelRect;
+ }
+
+ //--------------------------------------------------------------------
+ void TabDeckLayouter::Destroy()
+ {
+ m_pData->pTabBar.reset();
+ }
+
+ //--------------------------------------------------------------------
+ void TabDeckLayouter::SetFocusToPanelSelector()
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return;
+ m_pData->pTabBar->GrabFocus();
+ }
+
+ //--------------------------------------------------------------------
+ size_t TabDeckLayouter::GetAccessibleChildCount() const
+ {
+ if ( lcl_checkDisposed( *m_pData ) )
+ return 0;
+
+ return 1;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > TabDeckLayouter::GetAccessibleChild( const size_t i_nChildIndex, const Reference< XAccessible >& i_rParentAccessible )
+ {
+ (void)i_nChildIndex;
+ (void)i_rParentAccessible;
+ if ( lcl_checkDisposed( *m_pData ) )
+ return NULL;
+
+ return m_pData->pTabBar->GetAccessible( TRUE );
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/toolpanel.cxx b/svtools/source/toolpanel/toolpanel.cxx
new file mode 100644
index 000000000000..f7b999494563
--- /dev/null
+++ b/svtools/source/toolpanel/toolpanel.cxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "svtools/toolpanel/toolpanel.hxx"
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= ToolPanelBase
+ //====================================================================
+ //--------------------------------------------------------------------
+ ToolPanelBase::ToolPanelBase()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ToolPanelBase::~ToolPanelBase()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_IREFERENCE( ToolPanelBase )
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/toolpanel.src b/svtools/source/toolpanel/toolpanel.src
new file mode 100644
index 000000000000..5908a8fbcf98
--- /dev/null
+++ b/svtools/source/toolpanel/toolpanel.src
@@ -0,0 +1,57 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svtools/svtools.hrc"
+
+String STR_SVT_TOOL_PANEL_BUTTON_FWD
+{
+ Text [ en-US ] = "Tab Panel Scroll Button, backward";
+};
+
+String STR_SVT_TOOL_PANEL_BUTTON_BACK
+{
+ Text [ en-US ] = "Tab Panel Scroll Button, forward";
+};
+
+Image IMG_TRIANGLE_RIGHT
+{
+ ImageBitmap = Bitmap { File = "triangle_right.png"; };
+};
+
+Image IMG_TRIANGLE_RIGHT_HC
+{
+ ImageBitmap = Bitmap { File = "triangle_right_hc.png"; };
+};
+
+Image IMG_TRIANGLE_DOWN
+{
+ ImageBitmap = Bitmap { File = "triangle_down.png"; };
+};
+
+Image IMG_TRIANGLE_DOWN_HC
+{
+ ImageBitmap = Bitmap { File = "plus.png"; } ;
+};
diff --git a/svtools/source/toolpanel/toolpanelcollection.cxx b/svtools/source/toolpanel/toolpanelcollection.cxx
new file mode 100644
index 000000000000..baefbd92400f
--- /dev/null
+++ b/svtools/source/toolpanel/toolpanelcollection.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "toolpanelcollection.hxx"
+#include "paneldecklisteners.hxx"
+
+#include <tools/diagnose_ex.h>
+
+#include <vector>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= ToolPanelCollection_Data
+ //====================================================================
+ struct ToolPanelCollection_Data
+ {
+ ::std::vector< PToolPanel > aPanels;
+ ::boost::optional< size_t > aActivePanel;
+ PanelDeckListeners aListeners;
+ };
+
+ //====================================================================
+ //= ToolPanelCollection
+ //====================================================================
+ //--------------------------------------------------------------------
+ ToolPanelCollection::ToolPanelCollection()
+ :m_pData( new ToolPanelCollection_Data )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ToolPanelCollection::~ToolPanelCollection()
+ {
+ m_pData->aListeners.Dying();
+ }
+
+ //--------------------------------------------------------------------
+ size_t ToolPanelCollection::GetPanelCount() const
+ {
+ return m_pData->aPanels.size();
+ }
+
+ //--------------------------------------------------------------------
+ ::boost::optional< size_t > ToolPanelCollection::GetActivePanel() const
+ {
+ return m_pData->aActivePanel;
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelCollection::ActivatePanel( const ::boost::optional< size_t >& i_rPanel )
+ {
+ if ( !!i_rPanel )
+ {
+ OSL_ENSURE( *i_rPanel < GetPanelCount(), "ToolPanelCollection::ActivatePanel: illegal panel no.!" );
+ if ( *i_rPanel >= GetPanelCount() )
+ return;
+ }
+
+ if ( m_pData->aActivePanel == i_rPanel )
+ return;
+
+ const ::boost::optional< size_t > aOldPanel( m_pData->aActivePanel );
+ m_pData->aActivePanel = i_rPanel;
+
+ // notify listeners
+ m_pData->aListeners.ActivePanelChanged( aOldPanel, m_pData->aActivePanel );
+ }
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelCollection::GetPanel( const size_t i_nPos ) const
+ {
+ OSL_ENSURE( i_nPos < m_pData->aPanels.size(), "ToolPanelCollection::GetPanel: illegal position!" );
+ if ( i_nPos >= m_pData->aPanels.size() )
+ return PToolPanel();
+ return m_pData->aPanels[ i_nPos ];
+ }
+
+ //--------------------------------------------------------------------
+ size_t ToolPanelCollection::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ OSL_ENSURE( i_pPanel.get(), "ToolPanelCollection::InsertPanel: illegal panel!" );
+ if ( !i_pPanel.get() )
+ return 0;
+
+ // insert
+ const size_t position = i_nPosition < m_pData->aPanels.size() ? i_nPosition : m_pData->aPanels.size();
+ m_pData->aPanels.insert( m_pData->aPanels.begin() + position, i_pPanel );
+
+ // update active panel
+ if ( !!m_pData->aActivePanel )
+ {
+ if ( i_nPosition <= *m_pData->aActivePanel )
+ ++*m_pData->aActivePanel;
+ }
+
+ // notifications
+ m_pData->aListeners.PanelInserted( i_pPanel, i_nPosition );
+
+ return position;
+ }
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelCollection::RemovePanel( const size_t i_nPosition )
+ {
+ OSL_ENSURE( i_nPosition < m_pData->aPanels.size(), "ToolPanelCollection::RemovePanel: illegal position!" );
+ if ( i_nPosition >= m_pData->aPanels.size() )
+ return NULL;
+
+ // if the active panel is going to be removed, activate another one (before the actual removal)
+ if ( m_pData->aActivePanel == i_nPosition )
+ {
+ const ::boost::optional< size_t > aOldActive( m_pData->aActivePanel );
+
+ if ( i_nPosition + 1 < GetPanelCount() )
+ {
+ ++*m_pData->aActivePanel;
+ }
+ else if ( i_nPosition > 0 )
+ {
+ --*m_pData->aActivePanel;
+ }
+ else
+ {
+ m_pData->aActivePanel.reset();
+ }
+
+ m_pData->aListeners.ActivePanelChanged( aOldActive, m_pData->aActivePanel );
+ }
+
+ // remember the removed panel for the aller
+ PToolPanel pRemovedPanel( m_pData->aPanels[ i_nPosition ] );
+
+ // actually remove
+ m_pData->aPanels.erase( m_pData->aPanels.begin() + i_nPosition );
+
+ if ( !!m_pData->aActivePanel )
+ {
+ if ( i_nPosition < *m_pData->aActivePanel )
+ {
+ --*m_pData->aActivePanel;
+ }
+ }
+
+ // notify removed panel
+ m_pData->aListeners.PanelRemoved( i_nPosition );
+
+ return pRemovedPanel;
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelCollection::AddListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_pData->aListeners.AddListener( i_rListener );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelCollection::RemoveListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_pData->aListeners.RemoveListener( i_rListener );
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/toolpanelcollection.hxx b/svtools/source/toolpanel/toolpanelcollection.hxx
new file mode 100644
index 000000000000..2bdba38546c9
--- /dev/null
+++ b/svtools/source/toolpanel/toolpanelcollection.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef TOOLPANELCOLLECTION_HXX
+#define TOOLPANELCOLLECTION_HXX
+
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+
+#include <memory>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ struct ToolPanelCollection_Data;
+
+ //====================================================================
+ //= ToolPanelCollection
+ //====================================================================
+ class ToolPanelCollection : public IToolPanelDeck
+ {
+ public:
+ ToolPanelCollection();
+ ~ToolPanelCollection();
+
+ // IToolPanelDeck
+ virtual size_t GetPanelCount() const;
+ virtual PToolPanel GetPanel( const size_t i_nPos ) const;
+ virtual ::boost::optional< size_t >
+ GetActivePanel() const;
+ virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel );
+ virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual PToolPanel RemovePanel( const size_t i_nPosition );
+ virtual void AddListener( IToolPanelDeckListener& i_rListener );
+ virtual void RemoveListener( IToolPanelDeckListener& i_rListener );
+
+ private:
+ ::std::auto_ptr< ToolPanelCollection_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // TOOLPANELCOLLECTION_HXX
diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx
new file mode 100755
index 000000000000..e157090bbf0e
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldeck.cxx
@@ -0,0 +1,560 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "dummypanel.hxx"
+#include "toolpanelcollection.hxx"
+#include "paneldecklisteners.hxx"
+#include "toolpaneldeckpeer.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+#include "svtools/toolpanel/tablayouter.hxx"
+#include "svtools/toolpanel/drawerlayouter.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+#include <boost/optional.hpp>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::accessibility::XAccessible;
+ using ::com::sun::star::awt::XWindowPeer;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ /** === end UNO using === **/
+ namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole;
+
+ enum DeckAction
+ {
+ /// activates the first panel
+ ACTION_ACTIVATE_FIRST,
+ // activates the panel after the currently active panel
+ ACTION_ACTIVATE_NEXT,
+ // activates the panel before the currently active panel
+ ACTION_ACTIVATE_PREV,
+ // activates the last panel
+ ACTION_ACTIVATE_LAST,
+
+ // toggles the focus between the active panel and the panel selector
+ ACTION_TOGGLE_FOCUS,
+ };
+
+ //====================================================================
+ //= ToolPanelDeck_Impl
+ //====================================================================
+ class ToolPanelDeck_Impl : public IToolPanelDeckListener
+ {
+ public:
+ ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck )
+ :m_rDeck( i_rDeck )
+ ,m_aPanelAnchor( &i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL )
+ ,m_aPanels()
+ ,m_pDummyPanel( new DummyPanel )
+ ,m_pLayouter()
+ ,m_bInDtor( false )
+ ,m_pAccessibleParent( NULL )
+ {
+ m_aPanels.AddListener( *this );
+ m_aPanelAnchor.Show();
+ m_aPanelAnchor.SetAccessibleRole( AccessibleRole::PANEL );
+ }
+
+ ~ToolPanelDeck_Impl()
+ {
+ m_bInDtor = true;
+ }
+
+ PDeckLayouter GetLayouter() const { return m_pLayouter; }
+ void SetLayouter( const PDeckLayouter& i_pNewLayouter );
+
+ Window& GetPanelWindowAnchor() { return m_aPanelAnchor; }
+ const Window& GetPanelWindowAnchor() const { return m_aPanelAnchor; }
+
+ bool IsDead() const { return m_bInDtor; }
+
+ /// notifies our listeners that we're going to die. Only to be called from with our anti-impl's destructor
+ void NotifyDying()
+ {
+ m_aPanels.RemoveListener( *this );
+ m_aListeners.Dying();
+ }
+
+ // IToolPanelDeck equivalents
+ size_t GetPanelCount() const;
+ PToolPanel GetPanel( const size_t i_nPos ) const;
+ ::boost::optional< size_t >
+ GetActivePanel() const;
+ void ActivatePanel( const ::boost::optional< size_t >& i_rPanel );
+ size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ PToolPanel RemovePanel( const size_t i_nPosition );
+ void AddListener( IToolPanelDeckListener& i_rListener );
+ void RemoveListener( IToolPanelDeckListener& i_rListener );
+
+ /// re-layouts everything
+ void LayoutAll() { ImplDoLayout(); }
+
+ void DoAction( const DeckAction i_eAction );
+
+ bool FocusActivePanel();
+
+ void SetAccessibleParentWindow( Window* i_pAccessibleParent );
+ Window* GetAccessibleParentWindow() const { return m_pAccessibleParent; }
+
+ protected:
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+ private:
+ void ImplDoLayout();
+ PToolPanel GetActiveOrDummyPanel_Impl();
+
+ private:
+ ToolPanelDeck& m_rDeck;
+ Window m_aPanelAnchor;
+ ToolPanelCollection m_aPanels;
+ PToolPanel m_pDummyPanel;
+ PanelDeckListeners m_aListeners;
+ PDeckLayouter m_pLayouter;
+ bool m_bInDtor;
+ Window* m_pAccessibleParent;
+ };
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelDeck_Impl::GetActiveOrDummyPanel_Impl()
+ {
+ ::boost::optional< size_t > aActivePanel( m_aPanels.GetActivePanel() );
+ if ( !aActivePanel )
+ return m_pDummyPanel;
+ return m_aPanels.GetPanel( *aActivePanel );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::SetLayouter( const PDeckLayouter& i_pNewLayouter )
+ {
+ ENSURE_OR_RETURN_VOID( i_pNewLayouter.get(), "invalid layouter" );
+
+ if ( m_pLayouter.get() )
+ m_pLayouter->Destroy();
+
+ m_pLayouter = i_pNewLayouter;
+
+ ImplDoLayout();
+
+ m_aListeners.LayouterChanged( m_pLayouter );
+ }
+
+ //--------------------------------------------------------------------
+ size_t ToolPanelDeck_Impl::GetPanelCount() const
+ {
+ return m_aPanels.GetPanelCount();
+ }
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelDeck_Impl::GetPanel( const size_t i_nPos ) const
+ {
+ return m_aPanels.GetPanel( i_nPos );
+ }
+
+ //--------------------------------------------------------------------
+ ::boost::optional< size_t > ToolPanelDeck_Impl::GetActivePanel() const
+ {
+ return m_aPanels.GetActivePanel();
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::ActivatePanel( const ::boost::optional< size_t >& i_rPanel )
+ {
+ m_aPanels.ActivatePanel( i_rPanel );
+ }
+
+ //--------------------------------------------------------------------
+ size_t ToolPanelDeck_Impl::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ return m_aPanels.InsertPanel( i_pPanel, i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelDeck_Impl::RemovePanel( const size_t i_nPosition )
+ {
+ return m_aPanels.RemovePanel( i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::ImplDoLayout()
+ {
+ const Rectangle aDeckPlayground( Point(), m_rDeck.GetOutputSizePixel() );
+
+ // ask the layouter what is left for our panel, and position the panel container window appropriately
+ Rectangle aPlaygroundArea( aDeckPlayground );
+ OSL_ENSURE( m_pLayouter.get(), "ToolPanelDeck_Impl::ImplDoLayout: no layouter!" );
+ if ( m_pLayouter.get() )
+ {
+ aPlaygroundArea = m_pLayouter->Layout( aDeckPlayground );
+ }
+ m_aPanelAnchor.SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() );
+
+ // position the active panel
+ const PToolPanel pActive( GetActiveOrDummyPanel_Impl() );
+ pActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::AddListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_aListeners.AddListener( i_rListener );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::RemoveListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_aListeners.RemoveListener( i_rListener );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::DoAction( const DeckAction i_eAction )
+ {
+ const size_t nPanelCount( m_aPanels.GetPanelCount() );
+ ::boost::optional< size_t > aActivatePanel;
+ ::boost::optional< size_t > aCurrentPanel( GetActivePanel() );
+
+ switch ( i_eAction )
+ {
+ case ACTION_ACTIVATE_FIRST:
+ if ( nPanelCount > 0 )
+ aActivatePanel = 0;
+ break;
+ case ACTION_ACTIVATE_PREV:
+ if ( !aCurrentPanel && ( nPanelCount > 0 ) )
+ aActivatePanel = nPanelCount - 1;
+ else
+ if ( !!aCurrentPanel && ( *aCurrentPanel > 0 ) )
+ aActivatePanel = *aCurrentPanel - 1;
+ break;
+ case ACTION_ACTIVATE_NEXT:
+ if ( !aCurrentPanel && ( nPanelCount > 0 ) )
+ aActivatePanel = 0;
+ else
+ if ( !!aCurrentPanel && ( *aCurrentPanel < nPanelCount - 1 ) )
+ aActivatePanel = *aCurrentPanel + 1;
+ break;
+ case ACTION_ACTIVATE_LAST:
+ if ( nPanelCount > 0 )
+ aActivatePanel = nPanelCount - 1;
+ break;
+ case ACTION_TOGGLE_FOCUS:
+ {
+ PToolPanel pActivePanel( GetActiveOrDummyPanel_Impl() );
+ if ( !m_aPanelAnchor.HasChildPathFocus() )
+ pActivePanel->GrabFocus();
+ else
+ GetLayouter()->SetFocusToPanelSelector();
+ }
+ break;
+ }
+
+ if ( !!aActivatePanel )
+ {
+ ActivatePanel( aActivatePanel );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ bool ToolPanelDeck_Impl::FocusActivePanel()
+ {
+ ::boost::optional< size_t > aActivePanel( m_aPanels.GetActivePanel() );
+ if ( !aActivePanel )
+ return false;
+
+ PToolPanel pActivePanel( m_aPanels.GetPanel( *aActivePanel ) );
+ pActivePanel->GrabFocus();
+ return true;
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ // multiplex to our own listeners
+ m_aListeners.PanelInserted( i_pPanel, i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::PanelRemoved( const size_t i_nPosition )
+ {
+ // multiplex to our own listeners
+ m_aListeners.PanelRemoved( i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ // hide the old panel
+ if ( !!i_rOldActive )
+ {
+ const PToolPanel pOldActive( m_aPanels.GetPanel( *i_rOldActive ) );
+ pOldActive->Deactivate();
+ }
+
+ // position and show the new panel
+ const PToolPanel pNewActive( !i_rNewActive ? m_pDummyPanel : m_aPanels.GetPanel( *i_rNewActive ) );
+ pNewActive->Activate( m_aPanelAnchor );
+ pNewActive->GrabFocus();
+
+ // resize the panel (cannot guarantee it has ever been resized before
+ pNewActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() );
+
+ // multiplex to our own listeners
+ m_aListeners.ActivePanelChanged( i_rOldActive, i_rNewActive );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::LayouterChanged( const PDeckLayouter& i_rNewLayouter )
+ {
+ // not interested in
+ (void)i_rNewLayouter;
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::Dying()
+ {
+ // not interested in. Since the ToolPanelCollection is our member, this just means we ourself
+ // are dying, and we already sent this notification in our dtor.
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck_Impl::SetAccessibleParentWindow( Window* i_pAccessibleParent )
+ {
+ m_pAccessibleParent = i_pAccessibleParent;
+ }
+
+ //====================================================================
+ //= ToolPanelDeck
+ //====================================================================
+ //--------------------------------------------------------------------
+ ToolPanelDeck::ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle )
+ :Control( &i_rParent, i_nStyle )
+ ,m_pImpl( new ToolPanelDeck_Impl( *this ) )
+ {
+ // use a default layouter
+// SetLayouter( PDeckLayouter( new TabDeckLayouter( *this, *this, TABS_RIGHT, TABITEM_IMAGE_AND_TEXT ) ) );
+ SetLayouter( PDeckLayouter( new DrawerDeckLayouter( *this, *this ) ) );
+ }
+
+ //--------------------------------------------------------------------
+ ToolPanelDeck::~ToolPanelDeck()
+ {
+ m_pImpl->NotifyDying();
+ GetLayouter()->Destroy();
+
+ Hide();
+ for ( size_t i=0; i<GetPanelCount(); ++i )
+ {
+ PToolPanel pPanel( GetPanel( i ) );
+ pPanel->Dispose();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ size_t ToolPanelDeck::GetPanelCount() const
+ {
+ return m_pImpl->GetPanelCount();
+ }
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelDeck::GetPanel( const size_t i_nPos ) const
+ {
+ return m_pImpl->GetPanel( i_nPos );
+ }
+
+ //--------------------------------------------------------------------
+ ::boost::optional< size_t > ToolPanelDeck::GetActivePanel() const
+ {
+ return m_pImpl->GetActivePanel();
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::ActivatePanel( const ::boost::optional< size_t >& i_rPanel )
+ {
+ m_pImpl->ActivatePanel( i_rPanel );
+ }
+
+ //--------------------------------------------------------------------
+ size_t ToolPanelDeck::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ return m_pImpl->InsertPanel( i_pPanel, i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ PToolPanel ToolPanelDeck::RemovePanel( const size_t i_nPosition )
+ {
+ return m_pImpl->RemovePanel( i_nPosition );
+ }
+
+ //--------------------------------------------------------------------
+ PDeckLayouter ToolPanelDeck::GetLayouter() const
+ {
+ return m_pImpl->GetLayouter();
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::SetLayouter( const PDeckLayouter& i_pNewLayouter )
+ {
+ return m_pImpl->SetLayouter( i_pNewLayouter );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::AddListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_pImpl->AddListener( i_rListener );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::RemoveListener( IToolPanelDeckListener& i_rListener )
+ {
+ m_pImpl->RemoveListener( i_rListener );
+ }
+
+ //--------------------------------------------------------------------
+ Window& ToolPanelDeck::GetPanelWindowAnchor()
+ {
+ return m_pImpl->GetPanelWindowAnchor();
+ }
+
+ //--------------------------------------------------------------------
+ const Window& ToolPanelDeck::GetPanelWindowAnchor() const
+ {
+ return m_pImpl->GetPanelWindowAnchor();
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::Resize()
+ {
+ Control::Resize();
+ m_pImpl->LayoutAll();
+ }
+
+ //--------------------------------------------------------------------
+ long ToolPanelDeck::Notify( NotifyEvent& i_rNotifyEvent )
+ {
+ bool bHandled = false;
+ if ( i_rNotifyEvent.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pEvent = i_rNotifyEvent.GetKeyEvent();
+ const KeyCode& rKeyCode = pEvent->GetKeyCode();
+ if ( rKeyCode.GetModifier() == KEY_MOD1 )
+ {
+ bHandled = true;
+ switch ( rKeyCode.GetCode() )
+ {
+ case KEY_HOME:
+ m_pImpl->DoAction( ACTION_ACTIVATE_FIRST );
+ break;
+ case KEY_PAGEUP:
+ m_pImpl->DoAction( ACTION_ACTIVATE_PREV );
+ break;
+ case KEY_PAGEDOWN:
+ m_pImpl->DoAction( ACTION_ACTIVATE_NEXT );
+ break;
+ case KEY_END:
+ m_pImpl->DoAction( ACTION_ACTIVATE_LAST );
+ break;
+ default:
+ bHandled = false;
+ break;
+ }
+ }
+ else if ( rKeyCode.GetModifier() == ( KEY_MOD1 | KEY_SHIFT ) )
+ {
+ if ( rKeyCode.GetCode() == KEY_E )
+ {
+ m_pImpl->DoAction( ACTION_TOGGLE_FOCUS );
+ bHandled = true;
+ }
+ }
+ }
+
+ if ( bHandled )
+ return 1;
+
+ return Control::Notify( i_rNotifyEvent );
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::GetFocus()
+ {
+ Control::GetFocus();
+ if ( m_pImpl->IsDead() )
+ return;
+ if ( !m_pImpl->FocusActivePanel() )
+ {
+ PDeckLayouter pLayouter( GetLayouter() );
+ ENSURE_OR_RETURN_VOID( pLayouter.get(), "ToolPanelDeck::GetFocus: no layouter?!" );
+ pLayouter->SetFocusToPanelSelector();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ToolPanelDeck::SetAccessibleParentWindow( Window* i_pAccessibleParent )
+ {
+ m_pImpl->SetAccessibleParentWindow( i_pAccessibleParent );
+ }
+
+ //--------------------------------------------------------------------
+ Window* ToolPanelDeck::GetAccessibleParentWindow() const
+ {
+ Window* pAccessibleParent( m_pImpl->GetAccessibleParentWindow() );
+ if ( !pAccessibleParent )
+ pAccessibleParent = Window::GetAccessibleParentWindow();
+ return pAccessibleParent;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XWindowPeer > ToolPanelDeck::GetComponentInterface( BOOL i_bCreate )
+ {
+ Reference< XWindowPeer > xWindowPeer( Control::GetComponentInterface( FALSE ) );
+ if ( !xWindowPeer.is() && i_bCreate )
+ {
+ xWindowPeer.set( new ToolPanelDeckPeer( *this ) );
+ SetComponentInterface( xWindowPeer );
+ }
+ return xWindowPeer;
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.cxx b/svtools/source/toolpanel/toolpaneldeckpeer.cxx
new file mode 100755
index 000000000000..0a84a90b4fb3
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldeckpeer.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "toolpaneldeckpeer.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::accessibility::XAccessibleContext;
+ using ::com::sun::star::lang::DisposedException;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= ToolPanelDeckPeer
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelDeckPeer::ToolPanelDeckPeer( ToolPanelDeck& i_rDeck )
+ :VCLXWindow()
+ ,m_pDeck( &i_rDeck )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelDeckPeer::~ToolPanelDeckPeer()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessibleContext > ToolPanelDeckPeer::CreateAccessibleContext()
+ {
+ ::vos::OGuard aSolarGuard( GetMutex() );
+ if ( m_pDeck == NULL )
+ throw DisposedException( ::rtl::OUString(), *this );
+
+ Window* pAccessibleParent( m_pDeck->GetAccessibleParentWindow() );
+ ENSURE_OR_RETURN( pAccessibleParent != NULL, "no accessible parent => no accessible context", NULL );
+ Reference< XAccessible > xAccessibleParent( pAccessibleParent->GetAccessible(), UNO_SET_THROW );
+ return m_aAccessibleFactory.getFactory().createAccessibleToolPanelDeck( xAccessibleParent, *m_pDeck );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL ToolPanelDeckPeer::dispose() throw(RuntimeException)
+ {
+ {
+ ::vos::OGuard aSolarGuard( GetMutex() );
+ m_pDeck = NULL;
+ }
+ VCLXWindow::dispose();
+ }
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.hxx b/svtools/source/toolpanel/toolpaneldeckpeer.hxx
new file mode 100755
index 000000000000..4b6607ecbd05
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldeckpeer.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVT_TOOLPANELDECKPEER_HXX
+#define SVT_TOOLPANELDECKPEER_HXX
+
+#include "svtaccessiblefactory.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ class ToolPanelDeck;
+ //==================================================================================================================
+ //= ToolPanelDeckPeer
+ //==================================================================================================================
+ class ToolPanelDeckPeer : public VCLXWindow
+ {
+ public:
+ ToolPanelDeckPeer( ToolPanelDeck& i_rDeck );
+
+ protected:
+ ~ToolPanelDeckPeer();
+
+ // VCLXWindow overridables
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+
+ // XComponent
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ private:
+ AccessibleFactoryAccess m_aAccessibleFactory;
+ ToolPanelDeck* m_pDeck;
+ };
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
+
+#endif // SVT_TOOLPANELDECKPEER_HXX
diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx
new file mode 100644
index 000000000000..851556bc7874
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldrawer.cxx
@@ -0,0 +1,373 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "toolpaneldrawer.hxx"
+#include "toolpaneldrawerpeer.hxx"
+#include "svtools/svtdata.hxx"
+#include "svtools/svtools.hrc"
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+#include <vcl/lineinfo.hxx>
+#include <vcl/image.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/vclevent.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::awt::XWindowPeer;
+ namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole;
+
+ static const int s_nIndentationWidth = 16;
+
+ //==================================================================================================================
+ //= DrawerVisualization
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ DrawerVisualization::DrawerVisualization( ToolPanelDrawer& i_rParent )
+ :Window( &i_rParent )
+ ,m_rDrawer( i_rParent )
+ {
+ SetMouseTransparent( TRUE );
+ Show();
+ SetAccessibleRole( AccessibleRole::LABEL );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DrawerVisualization::~DrawerVisualization()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DrawerVisualization::Paint( const Rectangle& i_rBoundingBox )
+ {
+ Window::Paint( i_rBoundingBox );
+ m_rDrawer.Paint();
+ }
+
+ //==================================================================================================================
+ //= ToolPanelDrawer
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelDrawer::ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle )
+ :Window( &i_rParent, WB_TABSTOP )
+ ,m_pPaintDevice( new VirtualDevice( *this ) )
+ ,m_aVisualization( *this )
+ ,m_bFocused( false )
+ ,m_bExpanded( false )
+ {
+ EnableMapMode( FALSE );
+ SetBackground( Wallpaper() );
+ SetPointer( POINTER_REFHAND );
+
+ SetAccessibleRole( AccessibleRole::LIST_ITEM );
+
+ SetText( i_rTitle );
+ SetAccessibleName( i_rTitle );
+ SetAccessibleDescription( i_rTitle );
+
+ m_aVisualization.SetAccessibleName( i_rTitle );
+ m_aVisualization.SetAccessibleDescription( i_rTitle );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelDrawer::~ToolPanelDrawer()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ long ToolPanelDrawer::GetPreferredHeightPixel() const
+ {
+ Rectangle aTitleBarBox( impl_calcTitleBarBox( impl_calcTextBoundingBox() ) );
+ return aTitleBarBox.GetHeight();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::Paint()
+ {
+ m_pPaintDevice->SetMapMode( GetMapMode() );
+ m_pPaintDevice->SetOutputSize( GetOutputSizePixel() );
+ m_pPaintDevice->SetSettings( GetSettings() );
+ m_pPaintDevice->SetDrawMode( GetDrawMode() );
+
+ const Rectangle aTextBox( impl_calcTextBoundingBox() );
+ impl_paintBackground( impl_calcTitleBarBox( aTextBox ) );
+
+ Rectangle aFocusBox( impl_paintExpansionIndicator( aTextBox ) );
+
+ m_pPaintDevice->DrawText( aTextBox, GetText(), impl_getTextStyle() );
+
+ aFocusBox.Union( aTextBox );
+ aFocusBox.Left() += 2;
+ impl_paintFocusIndicator( aFocusBox );
+
+ m_aVisualization.DrawOutDev(
+ Point(), GetOutputSizePixel(),
+ Point(), GetOutputSizePixel(),
+ *m_pPaintDevice
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle ToolPanelDrawer::impl_paintExpansionIndicator( const Rectangle& i_rTextBox )
+ {
+ Rectangle aExpansionIndicatorArea;
+
+ Image aImage( impl_getExpansionIndicator() );
+ const int nHeight( aImage.GetSizePixel().Height() );
+ if ( nHeight > 0 )
+ {
+ Point aPosition(
+ 0,
+ i_rTextBox.Top() + ( GetTextHeight() - nHeight ) / 2
+ );
+ m_pPaintDevice->DrawImage( aPosition, aImage );
+
+ aExpansionIndicatorArea = Rectangle( aPosition, aImage.GetSizePixel() );
+ }
+
+ return aExpansionIndicatorArea;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Image ToolPanelDrawer::impl_getExpansionIndicator() const
+ {
+ const bool bHighContrastMode( GetSettings().GetStyleSettings().GetHighContrastMode() != 0 );
+ USHORT nResourceId = 0;
+ if ( m_bExpanded )
+ if ( bHighContrastMode )
+ nResourceId = IMG_TRIANGLE_DOWN_HC;
+ else
+ nResourceId = IMG_TRIANGLE_DOWN;
+ else
+ if ( bHighContrastMode )
+ nResourceId = IMG_TRIANGLE_RIGHT_HC;
+ else
+ nResourceId = IMG_TRIANGLE_RIGHT;
+ return Image( SvtResId( nResourceId ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ USHORT ToolPanelDrawer::impl_getTextStyle() const
+ {
+ const USHORT nBasicStyle = TEXT_DRAW_LEFT
+ | TEXT_DRAW_TOP
+ | TEXT_DRAW_WORDBREAK;
+
+ if ( IsEnabled() )
+ return nBasicStyle;
+
+ return nBasicStyle | TEXT_DRAW_DISABLE;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::impl_paintBackground( const Rectangle& i_rTitleBarBox )
+ {
+ m_pPaintDevice->SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() );
+ m_pPaintDevice->DrawRect( i_rTitleBarBox );
+
+ m_pPaintDevice->SetFillColor();
+ m_pPaintDevice->SetLineColor( GetSettings().GetStyleSettings().GetLightColor() );
+ m_pPaintDevice->DrawLine( i_rTitleBarBox.TopLeft(), i_rTitleBarBox.TopRight() );
+ m_pPaintDevice->DrawLine( i_rTitleBarBox.TopLeft(), i_rTitleBarBox.BottomLeft() );
+
+ m_pPaintDevice->SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
+ m_pPaintDevice->DrawLine( i_rTitleBarBox.BottomLeft(), i_rTitleBarBox.BottomRight() );
+ m_pPaintDevice->DrawLine( i_rTitleBarBox.TopRight(), i_rTitleBarBox.BottomRight() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::impl_paintFocusIndicator( const Rectangle& i_rTextBox )
+ {
+ if ( m_bFocused )
+ {
+ const Rectangle aTextPixelBox( m_pPaintDevice->LogicToPixel( i_rTextBox ) );
+
+ m_pPaintDevice->EnableMapMode( FALSE );
+ m_pPaintDevice->SetFillColor();
+
+ Rectangle aBox( i_rTextBox );
+ aBox.Top() -= 1;
+ aBox.Bottom() += 1;
+
+ m_pPaintDevice->DrawRect( aTextPixelBox );
+
+ LineInfo aDottedStyle( LINE_DASH );
+ aDottedStyle.SetDashCount( 0 );
+ aDottedStyle.SetDotCount( 1 );
+ aDottedStyle.SetDotLen( 1 );
+ aDottedStyle.SetDistance( 1 );
+
+ m_pPaintDevice->SetLineColor( COL_BLACK );
+ m_pPaintDevice->DrawPolyLine( Polygon( aTextPixelBox ), aDottedStyle );
+ m_pPaintDevice->EnableMapMode( FALSE );
+ }
+ else
+ HideFocus();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::GetFocus()
+ {
+ m_bFocused = true;
+ Invalidate();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::LoseFocus()
+ {
+ m_bFocused = false;
+ Invalidate();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::Resize()
+ {
+ Window::Resize();
+ m_aVisualization.SetPosSizePixel( Point(), GetOutputSizePixel() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::MouseButtonDown( const MouseEvent& i_rMouseEvent )
+ {
+ // consume this event, and do not forward to the base class - it would sent a NotifyEvent, which in turn, when
+ // we live in a DockingWindow, would start undocking
+ (void)i_rMouseEvent;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::DataChanged( const DataChangedEvent& i_rEvent )
+ {
+ Window::DataChanged( i_rEvent );
+
+ switch ( i_rEvent.GetType() )
+ {
+ case DATACHANGED_SETTINGS:
+ if ( ( i_rEvent.GetFlags() & SETTINGS_STYLE ) == 0 )
+ break;
+ SetSettings( Application::GetSettings() );
+ m_pPaintDevice.reset( new VirtualDevice( *this ) );
+
+ // fall through.
+
+ case DATACHANGED_FONTS:
+ case DATACHANGED_FONTSUBSTITUTION:
+ {
+ const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() );
+
+ // Font.
+ Font aFont = rStyleSettings.GetAppFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+
+ // Color.
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetButtonTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+
+ Invalidate();
+ }
+ break;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWindowPeer > ToolPanelDrawer::GetComponentInterface( BOOL i_bCreate )
+ {
+ Reference< XWindowPeer > xWindowPeer( Window::GetComponentInterface( FALSE ) );
+ if ( !xWindowPeer.is() && i_bCreate )
+ {
+ xWindowPeer.set( new ToolPanelDrawerPeer() );
+ SetComponentInterface( xWindowPeer );
+ }
+ return xWindowPeer;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle ToolPanelDrawer::impl_calcTextBoundingBox() const
+ {
+ Font aFont( GetFont() );
+ if ( m_bExpanded )
+ aFont.SetWeight( m_bExpanded ? WEIGHT_BOLD : WEIGHT_NORMAL );
+ m_pPaintDevice->SetFont( aFont );
+
+ int nAvailableWidth = m_pPaintDevice->GetTextWidth( GetText() );
+
+ Rectangle aTextBox(
+ Point(),
+ Size(
+ nAvailableWidth,
+ GetSettings().GetStyleSettings().GetTitleHeight()
+ )
+ );
+ aTextBox.Top() += ( aTextBox.GetHeight() - GetTextHeight() ) / 2;
+ aTextBox.Left() += s_nIndentationWidth;
+ aTextBox.Right() -= 1;
+
+ aTextBox = m_pPaintDevice->GetTextRect( aTextBox, GetText(), impl_getTextStyle() );
+ return aTextBox;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Rectangle ToolPanelDrawer::impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const
+ {
+ Rectangle aTitleBarBox( i_rTextBox );
+ aTitleBarBox.Bottom() += aTitleBarBox.Top();
+ aTitleBarBox.Top() = 0;
+ aTitleBarBox.Left() = 0;
+
+ const long nWidth = GetOutputSizePixel().Width();
+ if ( aTitleBarBox.GetWidth() < nWidth )
+ aTitleBarBox.Right() = nWidth - 1;
+
+ return aTitleBarBox;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawer::SetExpanded( const bool i_bExpanded )
+ {
+ if ( m_bExpanded != i_bExpanded )
+ {
+ m_bExpanded = i_bExpanded;
+ CallEventListeners( m_bExpanded ? VCLEVENT_ITEM_EXPANDED : VCLEVENT_ITEM_COLLAPSED );
+ Invalidate();
+ }
+ }
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx
new file mode 100644
index 000000000000..a465a0a6c9e1
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldrawer.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include <vcl/window.hxx>
+#include <vcl/virdev.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ class ToolPanelDrawer;
+ //==================================================================================================================
+ //= DrawerVisualization
+ //==================================================================================================================
+ /** serves a single purpose - let ZoomText read the drawers ...
+
+ Strange enough, ZoomText does not read the drawers when they get the focus (in none of the combinations
+ of AccessibleRoles I tried), except when it does have an AccessibleChild with the role LABEL. To "inject"
+ such a child into the A11Y hierarchy, we use this window here.
+
+ (We could also inject the A11Y component on the A11Y level only, but this would mean additional code. With
+ this approach here, VCL/toolkit will take care of creating and maintaining the A11Y component for us.)
+ */
+ class DrawerVisualization : public Window
+ {
+ public:
+ DrawerVisualization( ToolPanelDrawer& i_rParent );
+ ~DrawerVisualization();
+
+ protected:
+ // Window overridables
+ virtual void Paint( const Rectangle& i_rBoundingBox );
+
+ private:
+ ToolPanelDrawer& m_rDrawer;
+ };
+
+ //==================================================================================================================
+ //= ToolPanelDrawer
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ class ToolPanelDrawer : public Window
+ {
+ public:
+ ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle );
+ ~ToolPanelDrawer();
+
+ long GetPreferredHeightPixel() const;
+ void SetExpanded( const bool i_bExpanded );
+ bool IsExpanded() const { return m_bExpanded; }
+
+ void Paint();
+
+ protected:
+ // Window overridables
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void Resize();
+ virtual void DataChanged( const DataChangedEvent& i_rEvent );
+ virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
+ GetComponentInterface( BOOL i_bCreate );
+
+ private:
+ Rectangle impl_calcTextBoundingBox() const;
+ Rectangle impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const;
+ void impl_paintBackground( const Rectangle& i_rTitleBarBox );
+ USHORT impl_getTextStyle() const;
+ void impl_paintFocusIndicator( const Rectangle& i_rTextBox );
+ Rectangle impl_paintExpansionIndicator( const Rectangle& i_rTextBox );
+ Image impl_getExpansionIndicator() const;
+
+ // don't expose SetText. Our text is used as AccessibleName/Desc, and those are not expected to change.
+ using Window::SetText;
+ using Window::Paint;
+
+ private:
+ ::std::auto_ptr< VirtualDevice > m_pPaintDevice;
+ DrawerVisualization m_aVisualization;
+ bool m_bFocused;
+ bool m_bExpanded;
+ };
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
new file mode 100644
index 000000000000..959527330897
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "toolpaneldrawerpeer.hxx"
+#include "toolpaneldrawer.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <vcl/vclevent.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::accessibility::XAccessibleContext;
+ /** === end UNO using === **/
+ namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType;
+ namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
+
+ //==================================================================================================================
+ //= ToolPanelDrawerContext
+ //==================================================================================================================
+ class ToolPanelDrawerContext : public VCLXAccessibleComponent
+ {
+ public:
+ ToolPanelDrawerContext( VCLXWindow& i_rWindow )
+ :VCLXAccessibleComponent( &i_rWindow )
+ {
+ }
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& i_rVclWindowEvent );
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet );
+
+ protected:
+ ~ToolPanelDrawerContext()
+ {
+ }
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawerContext::ProcessWindowEvent( const VclWindowEvent& i_rVclWindowEvent )
+ {
+ VCLXAccessibleComponent::ProcessWindowEvent( i_rVclWindowEvent );
+
+ switch ( i_rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_ITEM_EXPANDED:
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), makeAny( AccessibleStateType::EXPANDED ) );
+ break;
+ case VCLEVENT_ITEM_COLLAPSED:
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, makeAny( AccessibleStateType::EXPANDED ), Any() );
+ break;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelDrawerContext::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet )
+ {
+ VCLXAccessibleComponent::FillAccessibleStateSet( i_rStateSet );
+ if ( !GetWindow() )
+ return;
+
+ i_rStateSet.AddState( AccessibleStateType::EXPANDABLE );
+ i_rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+
+ const ToolPanelDrawer* pDrawer( dynamic_cast< const ToolPanelDrawer* > ( GetWindow() ) );
+ ENSURE_OR_RETURN_VOID( pDrawer, "ToolPanelDrawerContext::FillAccessibleStateSet: illegal window!" );
+ if ( pDrawer->IsExpanded() )
+ i_rStateSet.AddState( AccessibleStateType::EXPANDED );
+
+ if ( pDrawer->HasChildPathFocus() )
+ i_rStateSet.AddState( AccessibleStateType::FOCUSED );
+ }
+
+ //==================================================================================================================
+ //= ToolPanelDrawerPeer
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelDrawerPeer::ToolPanelDrawerPeer()
+ :VCLXWindow()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelDrawerPeer::~ToolPanelDrawerPeer()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessibleContext > ToolPanelDrawerPeer::CreateAccessibleContext()
+ {
+ ::vos::OGuard aSolarGuard( GetMutex() );
+ return new ToolPanelDrawerContext( *this );
+ }
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.hxx b/svtools/source/toolpanel/toolpaneldrawerpeer.hxx
new file mode 100644
index 000000000000..5fcf0ac0ae7c
--- /dev/null
+++ b/svtools/source/toolpanel/toolpaneldrawerpeer.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVT_TOOLPANELDRAWERPEER_HXX
+#define SVT_TOOLPANELDRAWERPEER_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= ToolPanelDrawerPeer
+ //==================================================================================================================
+ class ToolPanelDrawerPeer : public VCLXWindow
+ {
+ public:
+ ToolPanelDrawerPeer();
+
+ protected:
+ ~ToolPanelDrawerPeer();
+
+ // VCLXWindow overridables
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+ };
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
+
+#endif // SVT_TOOLPANELDRAWERPEER_HXX
diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk
index 7bfe37624947..7c1c44006047 100644
--- a/svtools/source/uno/makefile.mk
+++ b/svtools/source/uno/makefile.mk
@@ -38,9 +38,6 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
-SRS1NAME= uno
-SRC1FILES= unoifac2.src
-
SLOFILES= \
$(SLO)$/addrtempuno.obj \
$(SLO)$/contextmenuhelper.obj \
@@ -55,7 +52,9 @@ SLOFILES= \
$(SLO)$/unoevent.obj \
$(SLO)$/unoiface.obj \
$(SLO)$/unoimap.obj \
- $(SLO)$/svtxgridcontrol.obj
+ $(SLO)$/svtxgridcontrol.obj \
+ $(SLO)$/popupwindowcontroller.obj \
+ $(SLO)$/popupmenucontrollerbase.obj
# --- Targets ------------------------------------------------------
diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx
index 433c1e1acbcb..e16a1ecb56dc 100644
--- a/svtools/source/uno/miscservices.cxx
+++ b/svtools/source/uno/miscservices.cxx
@@ -38,10 +38,13 @@
#include <uno/mapping.hxx>
#include "provider.hxx"
#include "renderer.hxx"
+#include "unowizard.hxx"
#include <com/sun/star/registry/XRegistryKey.hpp>
#include "comphelper/servicedecl.hxx"
+#include "cppuhelper/implementationentry.hxx"
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::lang;
@@ -67,6 +70,20 @@ extern sdecl::ServiceDecl const serviceDecl;
Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \
}
+namespace
+{
+ static struct ::cppu::ImplementationEntry s_aServiceEntries[] =
+ {
+ {
+ ::svt::uno::Wizard::Create,
+ ::svt::uno::Wizard::getImplementationName_static,
+ ::svt::uno::Wizard::getSupportedServiceNames_static,
+ ::cppu::createSingleComponentFactory, NULL, 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+ };
+}
+
// -------------------------------------------------------------------------------------
DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno )
@@ -126,9 +143,9 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo (
xNewKey->createKey( aServices.getConstArray()[ i ] );
if ( !component_writeInfoHelper( reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), reinterpret_cast< registry::XRegistryKey* >( _pRegistryKey ), serviceDecl ) )
- return false;
+ return false;
- return sal_True;
+ return ::cppu::component_writeInfoHelper( pServiceManager, _pRegistryKey, s_aServiceEntries );
}
return sal_False;
}
@@ -185,6 +202,8 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
else
{
pResult = component_getFactoryHelper( pImplementationName, reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ),reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ), serviceDecl );
+ if ( !pResult )
+ pResult = ::cppu::component_getFactoryHelper( pImplementationName, _pServiceManager, pRegistryKey, s_aServiceEntries );
}
if ( xFactory.is() )
diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx
new file mode 100644
index 000000000000..ac75a1b9a24b
--- /dev/null
+++ b/svtools/source/uno/popupmenucontrollerbase.cxx
@@ -0,0 +1,420 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+//_________________________________________________________________________________________________________________
+// my own includes
+//_________________________________________________________________________________________________________________
+#include "svtools/popupmenucontrollerbase.hxx"
+
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/awt/MenuItemStyle.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/awt/XMenuExtended.hpp>
+
+//_________________________________________________________________________________________________________________
+// includes of other projects
+//_________________________________________________________________________________________________________________
+
+#ifndef _VCL_MENU_HXX_
+#include <vcl/menu.hxx>
+#endif
+#include <vcl/svapp.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/logfile.hxx>
+#include <vos/mutex.hxx>
+
+//_________________________________________________________________________________________________________________
+// Defines
+//_________________________________________________________________________________________________________________
+//
+
+using ::rtl::OUString;
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::util;
+
+namespace svt
+{
+
+struct PopupMenuControllerBaseDispatchInfo
+{
+ Reference< XDispatch > mxDispatch;
+ const URL maURL;
+ const Sequence< PropertyValue > maArgs;
+
+ PopupMenuControllerBaseDispatchInfo( const Reference< XDispatch >& xDispatch, const URL& rURL, const Sequence< PropertyValue >& rArgs )
+ : mxDispatch( xDispatch ), maURL( rURL ), maArgs( rArgs ) {}
+};
+
+PopupMenuControllerBase::PopupMenuControllerBase( const Reference< XMultiServiceFactory >& xServiceManager ) :
+ ::comphelper::OBaseMutex(),
+ PopupMenuControllerBaseType(m_aMutex),
+ m_bInitialized( false ),
+ m_xServiceManager( xServiceManager )
+{
+ if ( m_xServiceManager.is() )
+ m_xURLTransformer.set( m_xServiceManager->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))),UNO_QUERY );
+}
+
+PopupMenuControllerBase::~PopupMenuControllerBase()
+{
+}
+
+// protected function
+void PopupMenuControllerBase::throwIfDisposed() throw ( RuntimeException )
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ throw com::sun::star::lang::DisposedException();
+}
+
+// protected function
+void PopupMenuControllerBase::resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu )
+{
+ VCLXPopupMenu* pPopupMenu = 0;
+ if ( rPopupMenu.is() && rPopupMenu->getItemCount() > 0 )
+ {
+ pPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu );
+ if ( pPopupMenu )
+ {
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+
+ PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
+ pVCLPopupMenu->Clear();
+ }
+ }
+}
+
+void SAL_CALL PopupMenuControllerBase::disposing()
+{
+ // Reset our members and set disposed flag
+ osl::MutexGuard aLock( m_aMutex );
+ m_xFrame.clear();
+ m_xDispatch.clear();
+ m_xPopupMenu.clear();
+ m_xServiceManager.clear();
+}
+
+// XServiceInfo
+
+sal_Bool SAL_CALL PopupMenuControllerBase::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
+{
+ const Sequence< rtl::OUString > aSNL( getSupportedServiceNames() );
+ const rtl::OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return true;
+
+ return false;
+}
+
+// XEventListener
+void SAL_CALL PopupMenuControllerBase::disposing( const EventObject& ) throw ( RuntimeException )
+{
+ osl::MutexGuard aLock( m_aMutex );
+ m_xFrame.clear();
+ m_xDispatch.clear();
+ m_xPopupMenu.clear();
+}
+
+// XMenuListener
+void SAL_CALL PopupMenuControllerBase::highlight( const awt::MenuEvent& ) throw (RuntimeException)
+{
+}
+
+void PopupMenuControllerBase::impl_select(const Reference< XDispatch >& _xDispatch,const URL& aURL)
+{
+ Sequence<PropertyValue> aArgs;
+ OSL_ENSURE(_xDispatch.is(),"PopupMenuControllerBase::impl_select: No dispatch");
+ if ( _xDispatch.is() )
+ _xDispatch->dispatch( aURL, aArgs );
+}
+
+void SAL_CALL PopupMenuControllerBase::select( const awt::MenuEvent& rEvent ) throw (RuntimeException)
+{
+ throwIfDisposed();
+
+ osl::MutexGuard aLock( m_aMutex );
+
+ Reference< awt::XMenuExtended > xExtMenu( m_xPopupMenu, UNO_QUERY );
+ if( xExtMenu.is() )
+ {
+ Sequence<PropertyValue> aArgs;
+ dispatchCommand( xExtMenu->getCommand( rEvent.MenuId ), aArgs );
+ }
+}
+
+void PopupMenuControllerBase::dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs )
+{
+ osl::MutexGuard aLock( m_aMutex );
+
+ throwIfDisposed();
+
+ try
+ {
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY_THROW );
+ URL aURL;
+ aURL.Complete = sCommandURL;
+ m_xURLTransformer->parseStrict( aURL );
+
+ Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW );
+
+ Application::PostUserEvent( STATIC_LINK(0, PopupMenuControllerBase, ExecuteHdl_Impl), new PopupMenuControllerBaseDispatchInfo( xDispatch, aURL, rArgs ) );
+
+ }
+ catch( Exception& )
+ {
+ }
+
+}
+
+IMPL_STATIC_LINK_NOINSTANCE( PopupMenuControllerBase, ExecuteHdl_Impl, PopupMenuControllerBaseDispatchInfo*, pDispatchInfo )
+{
+ pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs );
+ delete pDispatchInfo;
+ return 0;
+}
+
+void SAL_CALL PopupMenuControllerBase::activate( const awt::MenuEvent& ) throw (RuntimeException)
+{
+}
+
+void SAL_CALL PopupMenuControllerBase::deactivate( const awt::MenuEvent& ) throw (RuntimeException)
+{
+}
+
+void SAL_CALL PopupMenuControllerBase::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException )
+{
+ osl::ClearableMutexGuard aLock( m_aMutex );
+ throwIfDisposed();
+ aLock.clear();
+
+ updateCommand( m_aCommandURL );
+}
+
+void SAL_CALL PopupMenuControllerBase::updateCommand( const rtl::OUString& rCommandURL )
+{
+ osl::ClearableMutexGuard aLock( m_aMutex );
+ Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ Reference< XDispatch > xDispatch( m_xDispatch );
+ URL aTargetURL;
+ aTargetURL.Complete = rCommandURL;
+ m_xURLTransformer->parseStrict( aTargetURL );
+ aLock.clear();
+
+ // Add/remove status listener to get a status update once
+ if ( xDispatch.is() )
+ {
+ xDispatch->addStatusListener( xStatusListener, aTargetURL );
+ xDispatch->removeStatusListener( xStatusListener, aTargetURL );
+ }
+}
+
+
+// XDispatchProvider
+Reference< XDispatch > SAL_CALL
+PopupMenuControllerBase::queryDispatch(
+ const URL& /*aURL*/,
+ const rtl::OUString& /*sTarget*/,
+ sal_Int32 /*nFlags*/ )
+throw( RuntimeException )
+{
+ // must be implemented by subclass
+ osl::MutexGuard aLock( m_aMutex );
+ throwIfDisposed();
+
+ return Reference< XDispatch >();
+}
+
+Sequence< Reference< XDispatch > > SAL_CALL PopupMenuControllerBase::queryDispatches( const Sequence< DispatchDescriptor >& lDescriptor ) throw( RuntimeException )
+{
+ // Create return list - which must have same size then the given descriptor
+ // It's not allowed to pack it!
+ osl::ClearableMutexGuard aLock( m_aMutex );
+ throwIfDisposed();
+ aLock.clear();
+
+ sal_Int32 nCount = lDescriptor.getLength();
+ uno::Sequence< uno::Reference< frame::XDispatch > > lDispatcher( nCount );
+
+ // Step over all descriptors and try to get any dispatcher for it.
+ for( sal_Int32 i=0; i<nCount; ++i )
+ {
+ lDispatcher[i] = queryDispatch( lDescriptor[i].FeatureURL ,
+ lDescriptor[i].FrameName ,
+ lDescriptor[i].SearchFlags );
+ }
+
+ return lDispatcher;
+}
+
+// XDispatch
+void SAL_CALL
+PopupMenuControllerBase::dispatch(
+ const URL& /*aURL*/,
+ const Sequence< PropertyValue >& /*seqProperties*/ )
+throw( ::com::sun::star::uno::RuntimeException )
+{
+ // must be implemented by subclass
+ osl::MutexGuard aLock( m_aMutex );
+ throwIfDisposed();
+}
+
+void SAL_CALL
+PopupMenuControllerBase::addStatusListener(
+ const Reference< XStatusListener >& xControl,
+ const URL& aURL )
+throw( ::com::sun::star::uno::RuntimeException )
+{
+ osl::ResettableMutexGuard aLock( m_aMutex );
+ throwIfDisposed();
+ aLock.clear();
+
+ bool bStatusUpdate( false );
+ rBHelper.addListener( ::getCppuType( &xControl ), xControl );
+
+ aLock.reset();
+ if ( aURL.Complete.indexOf( m_aBaseURL ) == 0 )
+ bStatusUpdate = true;
+ aLock.clear();
+
+ if ( bStatusUpdate )
+ {
+ // Dummy update for popup menu controllers
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.State = Any();
+ xControl->statusChanged( aEvent );
+ }
+}
+
+void SAL_CALL PopupMenuControllerBase::removeStatusListener(
+ const Reference< XStatusListener >& xControl,
+ const URL& /*aURL*/ )
+throw( ::com::sun::star::uno::RuntimeException )
+{
+ rBHelper.removeListener( ::getCppuType( &xControl ), xControl );
+}
+
+::rtl::OUString PopupMenuControllerBase::determineBaseURL( const ::rtl::OUString& aURL )
+{
+ // Just use the main part of the URL for popup menu controllers
+ sal_Int32 nQueryPart( 0 );
+ sal_Int32 nSchemePart( 0 );
+ rtl::OUString aMainURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.popup:" ));
+
+ nSchemePart = aURL.indexOf( ':' );
+ if (( nSchemePart > 0 ) &&
+ ( aURL.getLength() > ( nSchemePart+1 )))
+ {
+ nQueryPart = aURL.indexOf( '?', nSchemePart );
+ if ( nQueryPart > 0 )
+ aMainURL += aURL.copy( nSchemePart, nQueryPart-nSchemePart );
+ else if ( nQueryPart == -1 )
+ aMainURL += aURL.copy( nSchemePart+1 );
+ }
+
+ return aMainURL;
+}
+
+// XInitialization
+void SAL_CALL PopupMenuControllerBase::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
+{
+ osl::MutexGuard aLock( m_aMutex );
+
+ sal_Bool bInitalized( m_bInitialized );
+ if ( !bInitalized )
+ {
+ PropertyValue aPropValue;
+ rtl::OUString aCommandURL;
+ Reference< XFrame > xFrame;
+
+ for ( int i = 0; i < aArguments.getLength(); i++ )
+ {
+ if ( aArguments[i] >>= aPropValue )
+ {
+ if ( aPropValue.Name.equalsAscii( "Frame" ))
+ aPropValue.Value >>= xFrame;
+ else if ( aPropValue.Name.equalsAscii( "CommandURL" ))
+ aPropValue.Value >>= aCommandURL;
+ }
+ }
+
+ if ( xFrame.is() && aCommandURL.getLength() )
+ {
+ m_xFrame = xFrame;
+ m_aCommandURL = aCommandURL;
+ m_aBaseURL = determineBaseURL( aCommandURL );
+ m_bInitialized = true;
+ }
+ }
+}
+// XPopupMenuController
+void SAL_CALL PopupMenuControllerBase::setPopupMenu( const Reference< awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException )
+{
+ osl::MutexGuard aLock( m_aMutex );
+ throwIfDisposed();
+
+ if ( m_xFrame.is() && !m_xPopupMenu.is() )
+ {
+ // Create popup menu on demand
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+
+ m_xPopupMenu = xPopupMenu;
+ m_xPopupMenu->addMenuListener( Reference< awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
+
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
+
+ URL aTargetURL;
+ aTargetURL.Complete = m_aCommandURL;
+ m_xURLTransformer->parseStrict( aTargetURL );
+ m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
+
+ impl_setPopupMenu();
+
+ updatePopupMenu();
+ }
+}
+void PopupMenuControllerBase::impl_setPopupMenu()
+{
+}
+}
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx
new file mode 100644
index 000000000000..4fbaff23714d
--- /dev/null
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -0,0 +1,258 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include <vcl/toolbox.hxx>
+#include <vcl/svapp.hxx>
+
+#include "svtools/popupwindowcontroller.hxx"
+#include "svtools/toolbarmenu.hxx"
+
+using rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+
+namespace svt
+{
+
+class PopupWindowControllerImpl
+{
+public:
+ PopupWindowControllerImpl();
+ ~PopupWindowControllerImpl();
+
+ void SetPopupWindow( ::Window* pPopupWindow, ToolBox* pToolBox );
+
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+ DECL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, Window* );
+
+private:
+ ::Window* mpPopupWindow;
+ ToolBox* mpToolBox;
+};
+
+PopupWindowControllerImpl::PopupWindowControllerImpl()
+: mpPopupWindow( 0 )
+, mpToolBox( 0 )
+{
+}
+
+PopupWindowControllerImpl::~PopupWindowControllerImpl()
+{
+ if( mpPopupWindow )
+ SetPopupWindow(0,0);
+}
+
+void PopupWindowControllerImpl::SetPopupWindow( ::Window* pPopupWindow, ToolBox* pToolBox )
+{
+ if( mpPopupWindow )
+ {
+ mpPopupWindow->RemoveEventListener( LINK( this, PopupWindowControllerImpl, WindowEventListener ) );
+ Application::PostUserEvent( STATIC_LINK( this, PopupWindowControllerImpl, AsyncDeleteWindowHdl ), mpPopupWindow );
+ }
+ mpPopupWindow = pPopupWindow;
+ mpToolBox = pToolBox;
+
+ if( mpPopupWindow )
+ {
+ mpPopupWindow->AddEventListener( LINK( this, PopupWindowControllerImpl, WindowEventListener ));
+ }
+}
+
+IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ VclWindowEvent* pWindowEvent = dynamic_cast< VclWindowEvent* >( pEvent );
+ if( pWindowEvent )
+ {
+ switch( pWindowEvent->GetId() )
+ {
+ case VCLEVENT_WINDOW_CLOSE:
+ case VCLEVENT_WINDOW_ENDPOPUPMODE:
+ SetPopupWindow(0,0);
+ break;
+
+ case VCLEVENT_WINDOW_SHOW:
+ {
+ if( mpPopupWindow )
+ {
+ if( mpToolBox )
+ mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_OPEN, (void*)mpPopupWindow );
+ mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_GETFOCUS, 0 );
+
+ svtools::ToolbarMenu* pToolbarMenu = dynamic_cast< svtools::ToolbarMenu* >( mpPopupWindow );
+ if( pToolbarMenu )
+ pToolbarMenu->highlightFirstEntry();
+ break;
+ }
+ break;
+ }
+ case VCLEVENT_WINDOW_HIDE:
+ {
+ if( mpPopupWindow )
+ {
+ mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS, 0 );
+ if( mpToolBox )
+ mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_CLOSE, (void*)mpPopupWindow );
+ }
+ break;
+ }
+ }
+ }
+ return 1;
+}
+
+//--------------------------------------------------------------------
+
+IMPL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, Window*, pWindow )
+{
+ (void)*pThis;
+ delete pWindow;
+ return 0;
+}
+
+//========================================================================
+// class PopupWindowController
+//========================================================================
+
+PopupWindowController::PopupWindowController( const Reference< lang::XMultiServiceFactory >& rServiceManager,
+ const Reference< frame::XFrame >& xFrame,
+ const OUString& aCommandURL )
+: svt::ToolboxController( rServiceManager, xFrame, aCommandURL )
+, mpImpl( new PopupWindowControllerImpl() )
+{
+}
+
+PopupWindowController::~PopupWindowController()
+{
+}
+
+// XInterface
+Any SAL_CALL PopupWindowController::queryInterface( const Type& aType )
+throw (RuntimeException)
+{
+ Any a( ToolboxController::queryInterface( aType ) );
+ if ( a.hasValue() )
+ return a;
+
+ return ::cppu::queryInterface( aType, static_cast< lang::XServiceInfo* >( this ));
+}
+
+void SAL_CALL PopupWindowController::acquire() throw ()
+{
+ ToolboxController::acquire();
+}
+
+void SAL_CALL PopupWindowController::release() throw ()
+{
+ ToolboxController::release();
+}
+
+// XServiceInfo
+sal_Bool SAL_CALL PopupWindowController::supportsService( const OUString& ServiceName ) throw(RuntimeException)
+{
+ const Sequence< OUString > aSNL( getSupportedServiceNames() );
+ const OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return true;
+
+ return false;
+}
+
+// XInitialization
+void SAL_CALL PopupWindowController::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ svt::ToolboxController::initialize( aArguments );
+ if( m_aCommandURL.getLength() )
+ addStatusListener( m_aCommandURL );
+}
+
+// XComponent
+void SAL_CALL PopupWindowController::dispose() throw (RuntimeException)
+{
+ if( m_aCommandURL.getLength() )
+ removeStatusListener( m_aCommandURL );
+
+ svt::ToolboxController::dispose();
+}
+
+
+// XStatusListener
+void SAL_CALL PopupWindowController::statusChanged( const frame::FeatureStateEvent& rEvent ) throw ( RuntimeException )
+{
+ svt::ToolboxController::statusChanged(rEvent);
+ enable( rEvent.IsEnabled );
+}
+
+// XToolbarController
+void SAL_CALL PopupWindowController::execute( sal_Int16 KeyModifier ) throw (RuntimeException)
+{
+ svt::ToolboxController::execute( KeyModifier );
+}
+
+void SAL_CALL PopupWindowController::click() throw (RuntimeException)
+{
+ svt::ToolboxController::click();
+}
+
+void SAL_CALL PopupWindowController::doubleClick() throw (RuntimeException)
+{
+ svt::ToolboxController::doubleClick();
+}
+
+Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() throw (RuntimeException)
+{
+ ToolBox* pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ if( pToolBox )
+ {
+ ::Window* pItemWindow = pToolBox->GetItemWindow( pToolBox->GetDownItemId() );
+ ::Window* pWin = createPopupWindow( pItemWindow ? pItemWindow : pToolBox );
+ if( pWin )
+ {
+ pWin->EnableDocking(true);
+ mpImpl->SetPopupWindow(pWin,pToolBox);
+ ::Window::GetDockingManager()->StartPopupMode( pToolBox, pWin, FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE |FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE );
+ }
+ }
+ return Reference< awt::XWindow >();
+}
+
+Reference< awt::XWindow > SAL_CALL PopupWindowController::createItemWindow( const Reference< awt::XWindow >& /*Parent*/ )
+ throw (RuntimeException)
+{
+ return Reference< awt::XWindow >();
+}
+
+}
+
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index b411181c2aab..99b36c390f23 100755
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -79,7 +79,6 @@ SVTXGridControl::SVTXGridControl()
//--------------------------------------------------------------------
SVTXGridControl::~SVTXGridControl()
{
- DELETEZ(m_pTableModel);
}
::com::sun::star::uno::Any SVTXGridControl::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
@@ -129,6 +128,18 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
TableControl* pTable = (TableControl*)GetWindow();
switch( GetPropertyId( PropertyName ) )
{
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ {
+ // let the base class handle this for the TableControl
+ VCLXWindow::setProperty( PropertyName, aValue );
+ // and forward to the grid control's data window
+ if ( pTable->IsBackground() )
+ pTable->getDataWindow()->SetBackground( pTable->GetBackground() );
+ else
+ pTable->getDataWindow()->SetBackground();
+ }
+ break;
+
case BASEPROPERTY_GRID_SELECTIONMODE:
{
SelectionType eSelectionType;
@@ -410,6 +421,7 @@ void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
}
void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aGuard( GetMutex() );
TableControl* pTable = (TableControl*)GetWindow();
if ( pTable )
{
@@ -425,6 +437,8 @@ void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeEx
}
void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aGuard( GetMutex() );
+
std::vector< Any > newRow;
Sequence< Any > rawRowData = Event.rowData;
int colCount = m_xColumnModel->getColumnCount();
@@ -471,6 +485,8 @@ void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridD
void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aGuard( GetMutex() );
+
TableControl* pTable = (TableControl*)GetWindow();
if(Event.index == -1)
{
@@ -478,6 +494,7 @@ void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::Gri
deselectAllRows();
if(m_pTableModel->hasRowHeaders())
m_pTableModel->getRowHeaderName().clear();
+ pTable->clearSelection();
m_pTableModel->getCellContent().clear();
if(pTable->isAccessibleAlive())
{
@@ -511,6 +528,8 @@ void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::Gri
void SAL_CALL SVTXGridControl::columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aGuard( GetMutex() );
+
TableControl* pTable = (TableControl*)GetWindow();
if(Event.valueName == rtl::OUString::createFromAscii("ColumnResize"))
{
@@ -558,6 +577,8 @@ void SAL_CALL SVTXGridControl::columnChanged(const ::com::sun::star::awt::grid:
}
void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aGuard( GetMutex() );
+
TableControl* pTable = (TableControl*)GetWindow();
if(Event.valueName == rtl::OUString::createFromAscii("RowHeight"))
{
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
index bcb8badf72e5..b15507e4614f 100755
--- a/svtools/source/uno/svtxgridcontrol.hxx
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -51,7 +51,7 @@ class SVTXGridControl : public ::cppu::ImplInheritanceHelper3< VCLXWindow, ::com
::com::sun::star::awt::grid::XGridDataListener, ::com::sun::star::awt::grid::XGridColumnListener>
{
private:
- UnoControlTableModel* m_pTableModel;
+ ::boost::shared_ptr< UnoControlTableModel > m_pTableModel;
::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >m_xDataModel;
::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >m_xColumnModel;
bool m_bHasColumnHeaders;
diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx
index 3f0b4e7c0ee6..92ae93f5080d 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -42,6 +42,14 @@
#include <toolkit/unohlp.hxx>
#endif
#include <vcl/toolbox.hxx>
+//shizhobo
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+const int TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE = 1;
+const int TOOLBARCONTROLLER_PROPCOUNT = 1;
+const rtl::OUString TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE( RTL_CONSTASCII_USTRINGPARAM( "SupportsVisiable" ));
+//end
+
+using ::rtl::OUString;
using namespace ::cppu;
using namespace ::com::sun::star::awt;
@@ -54,17 +62,38 @@ using namespace ::com::sun::star::frame;
namespace svt
{
+
+struct DispatchInfo
+{
+ Reference< XDispatch > mxDispatch;
+ const URL maURL;
+ const Sequence< PropertyValue > maArgs;
+
+ DispatchInfo( const Reference< XDispatch >& xDispatch, const URL& rURL, const Sequence< PropertyValue >& rArgs )
+ : mxDispatch( xDispatch ), maURL( rURL ), maArgs( rArgs ) {}
+};
+
struct ToolboxController_Impl
{
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xParentWindow;
::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xUrlTransformer;
+ rtl::OUString m_sModuleName;
+ sal_uInt16 m_nToolBoxId;
+
+ DECL_STATIC_LINK( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo* );
+
+ ToolboxController_Impl()
+ : m_nToolBoxId( SAL_MAX_UINT16 )
+ {}
};
ToolboxController::ToolboxController(
+
const Reference< XMultiServiceFactory >& rServiceManager,
const Reference< XFrame >& xFrame,
const ::rtl::OUString& aCommandURL ) :
- OWeakObject()
+ OPropertyContainer(GetBroadcastHelper())
+ , OWeakObject()
, m_bInitialized( sal_False )
, m_bDisposed( sal_False )
, m_xFrame(xFrame)
@@ -72,6 +101,10 @@ ToolboxController::ToolboxController(
, m_aCommandURL( aCommandURL )
, m_aListenerContainer( m_aMutex )
{
+ //registger Propertyh by shizhoubo
+ registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY,
+ &m_bSupportVisiable, getCppuType(&m_bSupportVisiable));
+
m_pImpl = new ToolboxController_Impl;
try
@@ -86,11 +119,16 @@ ToolboxController::ToolboxController(
}
ToolboxController::ToolboxController() :
- OWeakObject()
+ OPropertyContainer(GetBroadcastHelper())
+ , OWeakObject()
, m_bInitialized( sal_False )
, m_bDisposed( sal_False )
, m_aListenerContainer( m_aMutex )
{
+ //registger Propertyh by shizhoubo
+ registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY,
+ &m_bSupportVisiable, getCppuType(&m_bSupportVisiable));
+
m_pImpl = new ToolboxController_Impl;
}
@@ -146,11 +184,16 @@ throw ( RuntimeException )
static_cast< XInitialization* >( this ),
static_cast< XComponent* >( this ),
static_cast< XUpdatable* >( this ));
-
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
+ if ( !a.hasValue())
+ {
+ a = ::cppu::queryInterface(rType
+ ,static_cast<XPropertySet*>(this)
+ ,static_cast<XMultiPropertySet*>(this)
+ ,static_cast<XFastPropertySet*>(this));
+ if (!a.hasValue())
+ return OWeakObject::queryInterface( rType );
+ }
+ return a;
}
void SAL_CALL ToolboxController::acquire() throw ()
@@ -166,11 +209,6 @@ void SAL_CALL ToolboxController::release() throw ()
void SAL_CALL ToolboxController::initialize( const Sequence< Any >& aArguments )
throw ( Exception, RuntimeException )
{
- const rtl::OUString aFrameName( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- const rtl::OUString aCommandURLName( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
- const rtl::OUString aServiceManagerName( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" ));
- const rtl::OUString aParentWindow( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ));
-
bool bInitialized( true );
{
@@ -186,20 +224,23 @@ throw ( Exception, RuntimeException )
{
vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
m_bInitialized = sal_True;
-
+ //shizhoubo add
+ m_bSupportVisiable = sal_False;
PropertyValue aPropValue;
for ( int i = 0; i < aArguments.getLength(); i++ )
{
if ( aArguments[i] >>= aPropValue )
{
- if ( aPropValue.Name.equalsAscii( "Frame" ))
+ if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Frame") ))
m_xFrame.set(aPropValue.Value,UNO_QUERY);
- else if ( aPropValue.Name.equalsAscii( "CommandURL" ))
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CommandURL") ))
aPropValue.Value >>= m_aCommandURL;
- else if ( aPropValue.Name.equalsAscii( "ServiceManager" ))
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ServiceManager") ))
m_xServiceManager.set(aPropValue.Value,UNO_QUERY);
- else if ( aPropValue.Name.equalsAscii( "ParentWindow" ))
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ParentWindow") ))
m_pImpl->m_xParentWindow.set(aPropValue.Value,UNO_QUERY);
+ else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ModuleName" ) ) )
+ aPropValue.Value >>= m_pImpl->m_sModuleName;
}
}
@@ -704,4 +745,142 @@ Reference< ::com::sun::star::awt::XWindow > ToolboxController::getParent() const
{
return m_pImpl->m_xParentWindow;
}
+
+const rtl::OUString& ToolboxController::getModuleName() const
+{
+ return m_pImpl->m_sModuleName;
+}
+
+void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequence< PropertyValue >& rArgs )
+{
+ try
+ {
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY_THROW );
+ URL aURL;
+ aURL.Complete = sCommandURL;
+ getURLTransformer()->parseStrict( aURL );
+
+ Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW );
+
+ Application::PostUserEvent( STATIC_LINK(0, ToolboxController_Impl, ExecuteHdl_Impl), new DispatchInfo( xDispatch, aURL, rArgs ) );
+
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+//
+//-------------------------------------------------------------------------
+// XPropertySet by shizhoubo
+com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL ToolboxController::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException)
+{
+ Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+//-------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& ToolboxController::getInfoHelper()
+{
+ return *const_cast<ToolboxController*>(this)->getArrayHelper();
+}
+//OPropertyArrayUsageHelper by shizhoubo
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* ToolboxController::createArrayHelper( ) const
+{
+ com::sun::star::uno::Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+//shizhoubo for supportsvisiable
+void ToolboxController::setSupportVisiableProperty(sal_Bool bValue)
+{
+ m_bSupportVisiable = bValue;
+}
+//OPropertySetHelper by shizhoubo
+sal_Bool SAL_CALL ToolboxController::convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue ,
+ com::sun::star::uno::Any& aOldValue ,
+ sal_Int32 nHandle ,
+ const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException )
+{
+ switch (nHandle)
+ {
+ case TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE:
+ {
+ sal_Bool aNewValue;
+ aValue >>= aNewValue;
+ if (aNewValue != m_bSupportVisiable)
+ {
+ aConvertedValue <<= aNewValue;
+ aOldValue <<= m_bSupportVisiable;
+ return sal_True;
+ }
+ return sal_False;
+ }
+ }
+ return OPropertyContainer::convertFastPropertyValue(aConvertedValue, aOldValue, nHandle, aValue);
+}
+
+void SAL_CALL ToolboxController::setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const com::sun::star::uno::Any& aValue )
+throw( com::sun::star::uno::Exception)
+{
+ OPropertyContainer::setFastPropertyValue_NoBroadcast(nHandle, aValue);
+ if (TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE == nHandle)
+ {
+ sal_Bool rValue(sal_False);
+ if (( aValue >>= rValue ) && m_bInitialized)
+ this->setSupportVisiableProperty( rValue );
+ }
+}
+
+//--------------------------------------------------------------------
+
+IMPL_STATIC_LINK_NOINSTANCE( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo*, pDispatchInfo )
+{
+ pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs );
+ delete pDispatchInfo;
+ return 0;
+}
+
+void ToolboxController::enable( bool bEnable )
+{
+ ToolBox* pToolBox = 0;
+ sal_uInt16 nItemId = 0;
+ if( getToolboxId( nItemId, &pToolBox ) )
+ {
+ pToolBox->EnableItem( nItemId, bEnable ? TRUE : FALSE );
+ }
+}
+
+bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox )
+{
+ if( (m_pImpl->m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == 0) )
+ return m_pImpl->m_nToolBoxId;
+
+ ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+
+ if( (m_pImpl->m_nToolBoxId == SAL_MAX_UINT16) && pToolBox )
+ {
+ const sal_uInt16 nCount = pToolBox->GetItemCount();
+ for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos )
+ {
+ const sal_uInt16 nItemId = pToolBox->GetItemId( nPos );
+ if ( pToolBox->GetItemCommand( nItemId ) == String( m_aCommandURL ) )
+ {
+ m_pImpl->m_nToolBoxId = nItemId;
+ break;
+ }
+ }
+ }
+
+ if( ppToolBox )
+ *ppToolBox = pToolBox;
+
+ rItemId = m_pImpl->m_nToolBoxId;
+
+ return (rItemId != SAL_MAX_UINT16) && (( ppToolBox == 0) || (*ppToolBox != 0) );
+}
+//end
+
} // svt
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index a46b9605a00d..7fb1a007960f 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/view/SelectionType.hpp>
#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <com/sun/star/awt/tree/XMutableTreeNode.hpp>
#include <treecontrolpeer.hxx>
@@ -208,7 +209,9 @@ void TreeControlPeer::removeEntry( UnoTreeListEntry* pEntry )
{
TreeNodeMap::iterator aIter( mpTreeNodeMap->find( pEntry->mxNode ) );
if( aIter != mpTreeNodeMap->end() )
+ {
mpTreeNodeMap->erase( aIter );
+ }
}
}
@@ -280,14 +283,14 @@ UnoTreeListEntry* TreeControlPeer::createEntry( const Reference< XTreeNode >& xN
pEntry->AddItem( pUnoItem );
+ mpTreeImpl->insert( pEntry, pParent, nPos );
+
if( msDefaultExpandedGraphicURL.getLength() )
mpTreeImpl->SetExpandedEntryBmp( pEntry, maDefaultExpandedImage );
if( msDefaultCollapsedGraphicURL.getLength() )
mpTreeImpl->SetCollapsedEntryBmp( pEntry, maDefaultCollapsedImage );
- mpTreeImpl->insert( pEntry, pParent, nPos );
-
updateEntry( pEntry );
}
return pEntry;
@@ -915,6 +918,19 @@ Reference< XTreeNode > SAL_CALL TreeControlPeer::getClosestNodeForLocation( sal_
// -------------------------------------------------------------------
+awt::Rectangle SAL_CALL TreeControlPeer::getNodeRect( const Reference< XTreeNode >& i_Node ) throw (IllegalArgumentException, RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow();
+ UnoTreeListEntry* pEntry = getEntry( i_Node, true );
+
+ ::Rectangle aEntryRect( rTree.GetFocusRect( pEntry, rTree.GetEntryPosition( pEntry ).Y() ) );
+ return VCLUnoHelper::ConvertToAWTRect( aEntryRect );
+}
+
+// -------------------------------------------------------------------
+
sal_Bool SAL_CALL TreeControlPeer::isEditing( ) throw (RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
diff --git a/svtools/source/uno/treecontrolpeer.hxx b/svtools/source/uno/treecontrolpeer.hxx
index 015e131321f8..336830804a6f 100644
--- a/svtools/source/uno/treecontrolpeer.hxx
+++ b/svtools/source/uno/treecontrolpeer.hxx
@@ -91,6 +91,7 @@ public:
virtual void SAL_CALL removeTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getClosestNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getNodeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isEditing( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL stopEditing( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL cancelEditing( ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/svtools/source/uno/unowizard.hxx b/svtools/source/uno/unowizard.hxx
new file mode 100644
index 000000000000..ceb8fac14eb6
--- /dev/null
+++ b/svtools/source/uno/unowizard.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVT_UNO_WIZARD_HXX
+#define SVT_UNO_WIZARD_HXX
+
+#include "svtools/genericunodialog.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/dialogs/XWizard.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/ui/dialogs/XWizardController.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/componentcontext.hxx>
+
+//......................................................................................................................
+namespace svt { namespace uno
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= Wizard - declaration
+ //==================================================================================================================
+ typedef ::cppu::ImplInheritanceHelper1 < ::svt::OGenericUnoDialog
+ , ::com::sun::star::ui::dialogs::XWizard
+ > Wizard_Base;
+ class Wizard;
+ typedef ::comphelper::OPropertyArrayUsageHelper< Wizard > Wizard_PBase;
+ class Wizard : public Wizard_Base
+ , public Wizard_PBase
+ {
+ public:
+ Wizard( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext );
+
+ // ::com::sun::star::lang::XServiceInfo - static version
+ static ::rtl::OUString SAL_CALL getImplementationName_static() throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static() throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext );
+
+ protected:
+ // ::com::sun::star::lang::XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ // ::com::sun::star::ui::dialogs::XWizard
+ virtual ::rtl::OUString SAL_CALL getHelpURL() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpURL( const ::rtl::OUString& _helpurl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getDialogWindow() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > SAL_CALL getCurrentPage( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL enableButton( ::sal_Int16 WizardButton, ::sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultButton( ::sal_Int16 WizardButton ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL travelNext( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL travelPrevious( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL enablePage( ::sal_Int16 PageID, ::sal_Bool Enable ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::util::InvalidStateException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateTravelUI( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL advanceTo( ::sal_Int16 PageId ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL goBackTo( ::sal_Int16 PageId ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL activatePath( ::sal_Int16 PathIndex, ::sal_Bool Final ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::util::InvalidStateException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::ui::dialogs::XExecutableDialog
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL execute( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ protected:
+ ~Wizard();
+
+ protected:
+ virtual Dialog* createDialog( Window* _pParent );
+ virtual void destroyDialog();
+
+ private:
+ ::comphelper::ComponentContext m_aContext;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > > m_aWizardSteps;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController;
+ ::rtl::OUString m_sHelpURL;
+ };
+
+//......................................................................................................................
+} } // namespace svt::uno
+//......................................................................................................................
+
+#endif // SVT_UNO_WIZARD_HXX
diff --git a/svtools/source/uno/wizard/makefile.mk b/svtools/source/uno/wizard/makefile.mk
new file mode 100644
index 000000000000..521496fc5d48
--- /dev/null
+++ b/svtools/source/uno/wizard/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=../../..
+
+PRJNAME=svtools
+TARGET=unowiz
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/svt.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/unowizard.obj \
+ $(SLO)$/wizardshell.obj \
+ $(SLO)$/wizardpagecontroller.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx
new file mode 100644
index 000000000000..9440c0e69f26
--- /dev/null
+++ b/svtools/source/uno/wizard/unowizard.cxx
@@ -0,0 +1,452 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "../unowizard.hxx"
+#include "wizardshell.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
+#include <com/sun/star/ui/dialogs/XWizardController.hpp>
+#include <com/sun/star/ui/dialogs/WizardButton.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+#include <rtl/strbuf.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+//......................................................................................................................
+namespace svt { namespace uno
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::XServiceInfo;
+ using ::com::sun::star::ui::dialogs::XWizard;
+ using ::com::sun::star::lang::XInitialization;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::uno::XComponentContext;
+ using ::com::sun::star::beans::Property;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::ucb::AlreadyInitializedException;
+ using ::com::sun::star::ui::dialogs::XWizardController;
+ using ::com::sun::star::ui::dialogs::XWizardPage;
+ using ::com::sun::star::container::NoSuchElementException;
+ using ::com::sun::star::util::InvalidStateException;
+ using ::com::sun::star::awt::XWindow;
+ /** === end UNO using === **/
+ namespace WizardButton = ::com::sun::star::ui::dialogs::WizardButton;
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ sal_uInt32 lcl_convertWizardButtonToWZB( const sal_Int16 i_nWizardButton )
+ {
+ switch ( i_nWizardButton )
+ {
+ case WizardButton::NONE: return WZB_NONE;
+ case WizardButton::NEXT: return WZB_NEXT;
+ case WizardButton::PREVIOUS: return WZB_PREVIOUS;
+ case WizardButton::FINISH: return WZB_FINISH;
+ case WizardButton::CANCEL: return WZB_CANCEL;
+ case WizardButton::HELP: return WZB_HELP;
+ }
+ OSL_ENSURE( false, "lcl_convertWizardButtonToWZB: invalid WizardButton constant!" );
+ return WZB_NONE;
+ }
+ }
+
+ //==================================================================================================================
+ //= Wizard - implementation
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ Wizard::Wizard( const Reference< XComponentContext >& _rxContext )
+ :Wizard_Base( _rxContext )
+ ,m_aContext( _rxContext )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ Wizard::~Wizard()
+ {
+ // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
+ // so this virtual-method-call the base class does does not work, we're already dead then ...
+ if ( m_pDialog )
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( m_pDialog )
+ destroyDialog();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL Wizard::Create( const Reference< XComponentContext >& _rxContext )
+ {
+ return *(new Wizard( _rxContext ) );
+ }
+
+ //--------------------------------------------------------------------
+ namespace
+ {
+ static void lcl_checkPaths( const Sequence< Sequence< sal_Int16 > >& i_rPaths, const Reference< XInterface >& i_rContext )
+ {
+ // need at least one path
+ if ( i_rPaths.getLength() == 0 )
+ throw IllegalArgumentException( ::rtl::OUString(), i_rContext, 2 );
+
+ // each path must be of length 1, at least
+ for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i )
+ {
+ if ( i_rPaths[i].getLength() == 0 )
+ throw IllegalArgumentException( ::rtl::OUString(), i_rContext, 2 );
+
+ // page IDs must be in ascending order
+ sal_Int16 nPreviousPageID = i_rPaths[i][0];
+ for ( sal_Int32 j=1; j<i_rPaths[i].getLength(); ++j )
+ {
+ if ( i_rPaths[i][j] <= nPreviousPageID )
+ {
+ ::rtl::OStringBuffer message;
+ message.append( "Path " );
+ message.append( i );
+ message.append( ": invalid page ID sequence - each page ID must be greater than the previous one." );
+ throw IllegalArgumentException(
+ ::rtl::OStringToOUString( message.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US ),
+ i_rContext, 2 );
+ }
+ nPreviousPageID = i_rPaths[i][j];
+ }
+ }
+
+ // if we have one path, that's okay
+ if ( i_rPaths.getLength() == 1 )
+ return;
+
+ // if we have multiple paths, they must start with the same page id
+ const sal_Int16 nFirstPageId = i_rPaths[0][0];
+ for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i )
+ {
+ if ( i_rPaths[i][0] != nFirstPageId )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "All paths must start with the same page id." ) ),
+ i_rContext, 2 );
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL Wizard::initialize( const Sequence< Any >& i_Arguments ) throw (Exception, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( m_bInitialized )
+ throw AlreadyInitializedException( ::rtl::OUString(), *this );
+
+ if ( i_Arguments.getLength() != 2 )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, -1 );
+
+ // the second argument must be a XWizardController, for each constructor
+ m_xController.set( i_Arguments[1], UNO_QUERY );
+ if ( !m_xController.is() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 2 );
+
+ // the first arg is either a single path (short[]), or multiple paths (short[][])
+ Sequence< sal_Int16 > aSinglePath;
+ i_Arguments[0] >>= aSinglePath;
+ Sequence< Sequence< sal_Int16 > > aMultiplePaths;
+ i_Arguments[0] >>= aMultiplePaths;
+
+ if ( !aMultiplePaths.getLength() )
+ {
+ aMultiplePaths.realloc(1);
+ aMultiplePaths[0] = aSinglePath;
+ }
+ lcl_checkPaths( aMultiplePaths, *this );
+ // if we survived this, the paths are valid, and we're done here ...
+ m_aWizardSteps = aMultiplePaths;
+
+ m_bInitialized = true;
+ }
+
+ //--------------------------------------------------------------------
+ Dialog* Wizard::createDialog( Window* i_pParent )
+ {
+ WizardShell* pDialog( new WizardShell( i_pParent, this, m_xController, m_aWizardSteps ) );
+ pDialog->SetSmartHelpId( SmartId( m_sHelpURL ) );
+ pDialog->setTitleBase( m_sTitle );
+ return pDialog;
+ }
+
+ //--------------------------------------------------------------------
+ void Wizard::destroyDialog()
+ {
+ if ( m_pDialog )
+ m_sHelpURL = m_pDialog->GetSmartHelpId().GetStr();
+
+ Wizard_Base::destroyDialog();
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL Wizard::getImplementationName_static() throw(RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.uno.Wizard" ) );
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL Wizard::getSupportedServiceNames_static() throw(RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServices(1);
+ aServices[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.Wizard" ) );
+ return aServices;
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL Wizard::getImplementationName() throw(RuntimeException)
+ {
+ return getImplementationName_static();
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL Wizard::getSupportedServiceNames() throw(RuntimeException)
+ {
+ return getSupportedServiceNames_static();
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XPropertySetInfo > SAL_CALL Wizard::getPropertySetInfo() throw(RuntimeException)
+ {
+ return createPropertySetInfo( getInfoHelper() );
+ }
+
+ //--------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& SAL_CALL Wizard::getInfoHelper()
+ {
+ return *const_cast< Wizard* >( this )->getArrayHelper();
+ }
+
+ //--------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper* Wizard::createArrayHelper( ) const
+ {
+ Sequence< Property > aProps;
+ describeProperties( aProps );
+ return new ::cppu::OPropertyArrayHelper( aProps );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL Wizard::getHelpURL() throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pDialog )
+ return m_sHelpURL;
+
+ const SmartId aSmartId( m_pDialog->GetSmartHelpId() );
+ return aSmartId.GetStr();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::setHelpURL( const ::rtl::OUString& i_HelpURL ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pDialog )
+ m_sHelpURL = i_HelpURL;
+ else
+ m_pDialog->SetSmartHelpId( SmartId( i_HelpURL ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWindow > SAL_CALL Wizard::getDialogWindow() throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ENSURE_OR_RETURN( m_pDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", NULL );
+ return Reference< XWindow >( m_pDialog->GetComponentInterface(), UNO_QUERY );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::enableButton( ::sal_Int16 i_WizardButton, ::sal_Bool i_Enable ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enableButtons: invalid dialog implementation!" );
+
+ pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::setDefaultButton( ::sal_Int16 i_WizardButton ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::setDefaultButton: invalid dialog implementation!" );
+
+ pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL Wizard::travelNext( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelNext: invalid dialog implementation!" );
+
+ return pWizardImpl->travelNext();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL Wizard::travelPrevious( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelPrevious: invalid dialog implementation!" );
+
+ return pWizardImpl->travelPrevious();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::enablePage( ::sal_Int16 i_PageID, ::sal_Bool i_Enable ) throw (NoSuchElementException, InvalidStateException, RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enablePage: invalid dialog implementation!" );
+
+ if ( !pWizardImpl->knowsPage( i_PageID ) )
+ throw NoSuchElementException( ::rtl::OUString(), *this );
+
+ if ( i_PageID == pWizardImpl->getCurrentPage() )
+ throw InvalidStateException( ::rtl::OUString(), *this );
+
+ pWizardImpl->enablePage( i_PageID, i_Enable );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::updateTravelUI( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" );
+
+ pWizardImpl->updateTravelUI();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL Wizard::advanceTo( ::sal_Int16 i_PageId ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::advanceTo: invalid dialog implementation!" );
+
+ return pWizardImpl->advanceTo( i_PageId );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL Wizard::goBackTo( ::sal_Int16 i_PageId ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::goBackTo: invalid dialog implementation!" );
+
+ return pWizardImpl->goBackTo( i_PageId );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWizardPage > SAL_CALL Wizard::getCurrentPage( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!" );
+
+ return pWizardImpl->getCurrentWizardPage();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::activatePath( ::sal_Int16 i_PathIndex, ::sal_Bool i_Final ) throw (NoSuchElementException, InvalidStateException, RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) )
+ throw NoSuchElementException( ::rtl::OUString(), *this );
+
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" );
+
+ pWizardImpl->activatePath( i_PathIndex, i_Final );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Wizard::setTitle( const ::rtl::OUString& i_Title ) throw (RuntimeException)
+ {
+ // simply disambiguate
+ Wizard_Base::OGenericUnoDialog::setTitle( i_Title );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int16 SAL_CALL Wizard::execute( ) throw (RuntimeException)
+ {
+ return Wizard_Base::OGenericUnoDialog::execute();
+ }
+
+//......................................................................................................................
+} } // namespace svt::uno
+//......................................................................................................................
diff --git a/svtools/source/uno/wizard/wizardpagecontroller.cxx b/svtools/source/uno/wizard/wizardpagecontroller.cxx
new file mode 100644
index 000000000000..d6f7029b477c
--- /dev/null
+++ b/svtools/source/uno/wizard/wizardpagecontroller.cxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "wizardpagecontroller.hxx"
+#include "wizardshell.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+/** === end UNO includes === **/
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace svt { namespace uno
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::ui::dialogs::XWizardController;
+ using ::com::sun::star::awt::XWindow;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::awt::XControl;
+ /** === end UNO using === **/
+ using namespace ::com::sun::star;
+
+ //==================================================================================================================
+ //= WizardPageController
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ WizardPageController::WizardPageController( WizardShell& i_rParent, const Reference< XWizardController >& i_rController,
+ const sal_Int16 i_nPageId )
+ :m_xController( i_rController )
+ ,m_xWizardPage()
+ ,m_nPageId( i_nPageId )
+ {
+ ENSURE_OR_THROW( m_xController.is(), "no controller" );
+ try
+ {
+ m_xWizardPage.set( m_xController->createPage(
+ Reference< XWindow >( i_rParent.GetComponentInterface( TRUE ), UNO_QUERY_THROW ),
+ m_nPageId
+ ), UNO_SET_THROW );
+
+ Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW );
+ xPageWindow->setVisible( sal_True );
+
+ TabPage* pTabPage( getTabPage() );
+ if ( pTabPage )
+ pTabPage->SetStyle( pTabPage->GetStyle() | WB_CHILDDLGCTRL | WB_DIALOGCONTROL );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ WizardPageController::~WizardPageController()
+ {
+ try
+ {
+ if ( m_xWizardPage.is() )
+ m_xWizardPage->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TabPage* WizardPageController::getTabPage() const
+ {
+ ENSURE_OR_RETURN( m_xWizardPage.is(), "WizardPageController::getTabPage: no external wizard page!", NULL );
+ try
+ {
+ Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW );
+ Window* pPageWindow = VCLUnoHelper::GetWindow( xPageWindow );
+ if ( pPageWindow == NULL )
+ {
+ // windows created via the XContainerWindowProvider might be controls, not real windows, so resolve
+ // that one indirection
+ const Reference< XControl > xPageControl( m_xWizardPage->getWindow(), UNO_QUERY_THROW );
+ xPageWindow.set( xPageControl->getPeer(), UNO_QUERY_THROW );
+ pPageWindow = VCLUnoHelper::GetWindow( xPageWindow );
+ }
+
+ OSL_ENSURE( pPageWindow != NULL, "WizardPageController::getTabPage: unable to find the Window implementation for the page's window!" );
+ return dynamic_cast< TabPage* >( pPageWindow );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void WizardPageController::initializePage()
+ {
+ if ( !m_xWizardPage.is() )
+ return;
+
+ try
+ {
+ m_xWizardPage->activatePage();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool WizardPageController::commitPage( WizardTypes::CommitPageReason i_eReason )
+ {
+ if ( !m_xWizardPage.is() )
+ return sal_True;
+
+ try
+ {
+ return m_xWizardPage->commitPage( WizardShell::convertCommitReasonToTravelType( i_eReason ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return sal_True;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool WizardPageController::canAdvance() const
+ {
+ if ( !m_xWizardPage.is() )
+ return true;
+
+ try
+ {
+ return m_xWizardPage->canAdvance();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return true;
+ }
+
+//......................................................................................................................
+} } // namespace svt::uno
+//......................................................................................................................
diff --git a/svtools/source/uno/wizard/wizardpagecontroller.hxx b/svtools/source/uno/wizard/wizardpagecontroller.hxx
new file mode 100644
index 000000000000..9de04d2f0dd4
--- /dev/null
+++ b/svtools/source/uno/wizard/wizardpagecontroller.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX
+#define SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX
+
+#include "svtools/wizardmachine.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/dialogs/XWizardController.hpp>
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace svt { namespace uno
+{
+//......................................................................................................................
+
+ class WizardShell;
+
+ //==================================================================================================================
+ //= WizardPageController
+ //==================================================================================================================
+ class WizardPageController : public IWizardPageController
+ {
+ public:
+ WizardPageController(
+ WizardShell& i_rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController,
+ const sal_Int16 i_nPageId
+ );
+ ~WizardPageController();
+
+ // IWizardPageController overridables
+ virtual void initializePage();
+ virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason );
+ virtual bool canAdvance() const;
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage >&
+ getWizardPage() const { return m_xWizardPage; }
+ TabPage* getTabPage() const;
+
+ private:
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > m_xWizardPage;
+ const sal_Int16 m_nPageId;
+ };
+
+//......................................................................................................................
+} } // namespace svt::uno
+//......................................................................................................................
+
+#endif // SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX
diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx
new file mode 100644
index 000000000000..7737b214ac1f
--- /dev/null
+++ b/svtools/source/uno/wizard/wizardshell.cxx
@@ -0,0 +1,279 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svtools.hxx"
+
+#include "wizardshell.hxx"
+#include "wizardpagecontroller.hxx"
+
+#include <tools/diagnose_ex.h>
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/dialogs/WizardTravelType.hpp>
+/** === end UNO includes === **/
+
+#include <vcl/msgbox.hxx>
+
+//......................................................................................................................
+namespace svt { namespace uno
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::ui::dialogs::XWizardController;
+ using ::com::sun::star::ui::dialogs::XWizard;
+ using ::com::sun::star::ui::dialogs::XWizardPage;
+ /** === end UNO using === **/
+ namespace WizardTravelType = ::com::sun::star::ui::dialogs::WizardTravelType;
+
+ //==================================================================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------------------------------------------------
+ sal_Int16 lcl_determineFirstPageID( const Sequence< Sequence< sal_Int16 > >& i_rPaths )
+ {
+ ENSURE_OR_THROW( ( i_rPaths.getLength() > 0 ) && ( i_rPaths[0].getLength() > 0 ), "illegal paths" );
+ return i_rPaths[0][0];
+ }
+ }
+
+ //==================================================================================================================
+ //= WizardShell
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ WizardShell::WizardShell( Window* i_pParent, const Reference< XWizard >& i_rWizard, const Reference< XWizardController >& i_rController,
+ const Sequence< Sequence< sal_Int16 > >& i_rPaths )
+ :WizardShell_Base( i_pParent, WB_MOVEABLE | WB_CLOSEABLE )
+ ,m_xWizard( i_rWizard )
+ ,m_xController( i_rController )
+ ,m_nFirstPageID( lcl_determineFirstPageID( i_rPaths ) )
+ {
+ ENSURE_OR_THROW( m_xWizard.is() && m_xController.is(), "invalid wizard/controller" );
+
+ // declare the paths
+ for ( sal_Int32 i=0; i<i_rPaths.getLength(); ++i )
+ {
+ const Sequence< sal_Int16 >& rPath( i_rPaths[i] );
+ WizardPath aPath( rPath.getLength() );
+ for ( sal_Int32 j=0; j<rPath.getLength(); ++j )
+ aPath[j] = impl_pageIdToState( rPath[j] );
+ declarePath( i, aPath );
+ }
+
+ // create the first page, to know the page size
+ TabPage* pStartPage = GetOrCreatePage( impl_pageIdToState( i_rPaths[0][0] ) );
+ SetPageSizePixel( pStartPage->GetSizePixel() );
+
+ // some defaults
+ ShowButtonFixedLine( true );
+ SetRoadmapInteractive( true );
+ enableAutomaticNextButtonState();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ WizardShell::~WizardShell()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ short WizardShell::Execute()
+ {
+ ActivatePage();
+ return WizardShell_Base::Execute();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int16 WizardShell::convertCommitReasonToTravelType( const CommitPageReason i_eReason )
+ {
+ switch ( i_eReason )
+ {
+ case WizardTypes::eTravelForward:
+ return WizardTravelType::FORWARD;
+
+ case WizardTypes::eTravelBackward:
+ return WizardTravelType::BACKWARD;
+
+ case WizardTypes::eFinish:
+ return WizardTravelType::FINISH;
+
+ default:
+ break;
+ }
+ OSL_ENSURE( false, "WizardShell::convertCommitReasonToTravelType: unsupported CommitPageReason!" );
+ return WizardTravelType::FINISH;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void WizardShell::enterState( WizardState i_nState )
+ {
+ WizardShell_Base::enterState( i_nState );
+
+ if ( !m_xController.is() )
+ return;
+
+ try
+ {
+ m_xController->onActivatePage( impl_stateToPageId( i_nState ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool WizardShell::leaveState( WizardState i_nState )
+ {
+ if ( !WizardShell_Base::leaveState( i_nState ) )
+ return sal_False;
+
+ if ( !m_xController.is() )
+ return sal_True;
+
+ try
+ {
+ m_xController->onDeactivatePage( impl_stateToPageId( i_nState ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return sal_True;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ PWizardPageController WizardShell::impl_getController( TabPage* i_pPage ) const
+ {
+ Page2ControllerMap::const_iterator pos = m_aPageControllers.find( i_pPage );
+ ENSURE_OR_RETURN( pos != m_aPageControllers.end(), "WizardShell::impl_getController: no controller for this page!", PWizardPageController() );
+ return pos->second;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWizardPage > WizardShell::getCurrentWizardPage() const
+ {
+ const WizardState eState = getCurrentState();
+
+ PWizardPageController pController( impl_getController( GetPage( eState ) ) );
+ ENSURE_OR_RETURN( pController, "WizardShell::getCurrentWizardPage: invalid page/controller!", NULL );
+
+ return pController->getWizardPage();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void WizardShell::enablePage( const sal_Int16 i_nPageID, const sal_Bool i_bEnable )
+ {
+ enableState( impl_pageIdToState( i_nPageID ), i_bEnable );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TabPage* WizardShell::createPage( WizardState i_nState )
+ {
+ ENSURE_OR_RETURN( m_xController.is(), "WizardShell::createPage: no WizardController!", NULL );
+
+ ::boost::shared_ptr< WizardPageController > pController( new WizardPageController( *this, m_xController, impl_stateToPageId( i_nState ) ) );
+ TabPage* pPage = pController->getTabPage();
+ OSL_ENSURE( pPage != NULL, "WizardShell::createPage: illegal tab page!" );
+ if ( pPage == NULL )
+ {
+ // fallback for ill-behaved clients: empty page
+ pPage = new TabPage( this, 0 );
+ pPage->SetSizePixel( LogicToPixel( Size( 280, 185 ), MAP_APPFONT ) );
+ }
+
+ m_aPageControllers[ pPage ] = pController;
+ return pPage;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IWizardPageController* WizardShell::getPageController( TabPage* i_pCurrentPage ) const
+ {
+ return impl_getController( i_pCurrentPage ).get();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ String WizardShell::getStateDisplayName( WizardState i_nState ) const
+ {
+ try
+ {
+ if ( m_xController.is() )
+ return m_xController->getPageTitle( impl_stateToPageId( i_nState ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ // fallback for ill-behaved clients: the numeric state
+ return String::CreateFromInt32( i_nState );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool WizardShell::canAdvance() const
+ {
+ try
+ {
+ if ( m_xController.is() && !m_xController->canAdvance() )
+ return false;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return WizardShell_Base::canAdvance();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool WizardShell::onFinish()
+ {
+ try
+ {
+ if ( m_xController.is() && !m_xController->confirmFinish() )
+ return sal_False;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return WizardShell_Base::onFinish();
+ }
+
+//......................................................................................................................
+} } // namespace svt::uno
+//......................................................................................................................
diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx
new file mode 100644
index 000000000000..338b4f38dc4a
--- /dev/null
+++ b/svtools/source/uno/wizard/wizardshell.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVT_UNO_WIZARD_SHELL
+#define SVT_UNO_WIZARD_SHELL
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/dialogs/XWizardController.hpp>
+#include <com/sun/star/ui/dialogs/XWizard.hpp>
+/** === end UNO includes === **/
+
+#include <svtools/roadmapwizard.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <map>
+
+//......................................................................................................................
+namespace svt { namespace uno
+{
+//......................................................................................................................
+
+ class WizardPageController;
+ typedef ::boost::shared_ptr< WizardPageController > PWizardPageController;
+
+ //==================================================================================================================
+ //= WizardShell
+ //==================================================================================================================
+ typedef ::svt::RoadmapWizard WizardShell_Base;
+ class WizardShell : public WizardShell_Base
+ {
+ public:
+ WizardShell(
+ Window* _pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >& i_rWizard,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > >& i_rPaths
+ );
+ virtual ~WizardShell();
+
+ // Dialog overridables
+ virtual short Execute();
+
+ // OWizardMachine overridables
+ virtual TabPage* createPage( WizardState i_nState );
+ virtual void enterState( WizardState i_nState );
+ virtual sal_Bool leaveState( WizardState i_nState );
+ virtual String getStateDisplayName( WizardState i_nState ) const;
+ virtual bool canAdvance() const;
+ virtual sal_Bool onFinish();
+ virtual IWizardPageController*
+ getPageController( TabPage* _pCurrentPage ) const;
+
+ // attribute access
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >&
+ getWizard() const { return m_xWizard; }
+
+ static sal_Int16 convertCommitReasonToTravelType( const CommitPageReason i_eReason );
+
+ // operations
+ sal_Bool advanceTo( const sal_Int16 i_nPageId )
+ {
+ return skipUntil( impl_pageIdToState( i_nPageId ) );
+ }
+ sal_Bool goBackTo( const sal_Int16 i_nPageId )
+ {
+ return skipBackwardUntil( impl_pageIdToState( i_nPageId ) );
+ }
+ sal_Bool travelNext() { return WizardShell_Base::travelNext(); }
+ sal_Bool travelPrevious() { return WizardShell_Base::travelPrevious(); }
+
+ void activatePath( const sal_Int16 i_nPathID, const sal_Bool i_bFinal )
+ {
+ WizardShell_Base::activatePath( PathId( i_nPathID ), i_bFinal );
+ }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage >
+ getCurrentWizardPage() const;
+
+ sal_Int16 getCurrentPage() const
+ {
+ return impl_stateToPageId( getCurrentState() );
+ }
+
+ void enablePage( const sal_Int16 i_PageID, const sal_Bool i_Enable );
+
+ bool knowsPage( const sal_Int16 i_nPageID ) const
+ {
+ return knowsState( impl_pageIdToState( i_nPageID ) );
+ }
+
+ private:
+ sal_Int16 impl_stateToPageId( const WizardTypes::WizardState i_nState ) const
+ {
+ return static_cast< sal_Int16 >( i_nState + m_nFirstPageID );
+ }
+
+ WizardState impl_pageIdToState( const sal_Int16 i_nPageId ) const
+ {
+ return static_cast< WizardState >( i_nPageId - m_nFirstPageID );
+ }
+
+ PWizardPageController impl_getController( TabPage* i_pPage ) const;
+
+ // prevent outside access to some base class members
+ using WizardShell_Base::skip;
+ using WizardShell_Base::skipUntil;
+ using WizardShell_Base::skipBackwardUntil;
+ using WizardShell_Base::getCurrentState;
+ using WizardShell_Base::activatePath;
+
+ private:
+ typedef ::std::map< TabPage*, PWizardPageController > Page2ControllerMap;
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard > m_xWizard;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController;
+ const sal_Int16 m_nFirstPageID;
+ Page2ControllerMap m_aPageControllers;
+ };
+
+//......................................................................................................................
+} } // namespace svt::uno
+//......................................................................................................................
+
+#endif // SVT_UNO_WIZARD_SHELL
diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk
index ab05facdb065..f9c14a540410 100644
--- a/svtools/util/makefile.mk
+++ b/svtools/util/makefile.mk
@@ -48,30 +48,32 @@ LIB2TARGET= $(LB)$/svtool.lib
LIB2FILES= $(LB)$/_svt.lib
.ENDIF
-LIB1TARGET= $(SLB)$/svt.lib
+LIB1TARGET= $(SLB)/svt.lib
LIB1FILES= \
- $(SLB)$/browse.lib \
- $(SLB)$/config.lib \
- $(SLB)$/svcontnr.lib \
- $(SLB)$/ctrl.lib \
- $(SLB)$/dialogs.lib \
- $(SLB)$/edit.lib \
- $(SLB)$/filter.lib \
- $(SLB)$/filter.uno.lib \
+ $(SLB)/browse.lib \
+ $(SLB)/config.lib \
+ $(SLB)/svcontnr.lib \
+ $(SLB)/ctrl.lib \
+ $(SLB)/dialogs.lib \
+ $(SLB)/edit.lib \
+ $(SLB)/filter.lib \
+ $(SLB)/filter.uno.lib \
$(SLB)$/graphic.lib \
- $(SLB)$/igif.lib \
- $(SLB)$/jpeg.lib \
- $(SLB)$/ixpm.lib \
- $(SLB)$/ixbm.lib \
- $(SLB)$/wmf.lib \
- $(SLB)$/java.lib \
- $(SLB)$/misc.lib \
- $(SLB)$/plugapp.lib \
- $(SLB)$/svhtml.lib \
- $(SLB)$/svrtf.lib \
- $(SLB)$/table.lib \
- $(SLB)$/unoiface.lib \
- $(SLB)$/urlobj.lib
+ $(SLB)/igif.lib \
+ $(SLB)/jpeg.lib \
+ $(SLB)/ixpm.lib \
+ $(SLB)/ixbm.lib \
+ $(SLB)/wmf.lib \
+ $(SLB)/java.lib \
+ $(SLB)/misc.lib \
+ $(SLB)/plugapp.lib \
+ $(SLB)/svhtml.lib \
+ $(SLB)/svrtf.lib \
+ $(SLB)/table.lib \
+ $(SLB)/unoiface.lib \
+ $(SLB)/unowiz.lib \
+ $(SLB)/urlobj.lib \
+ $(SLB)/toolpanel.lib
# generation of resourcen-lib ----------------------------------------
@@ -84,8 +86,8 @@ RESLIB1SRSFILES= \
$(SRS)$/dialogs.srs \
$(SRS)$/plugapp.srs \
$(SRS)$/svcontnr.srs \
- $(SRS)$/uno.srs \
$(SRS)$/browse.srs \
+ $(SRS)$/toolpanel.srs \
$(SRS)$/javaerror.srs
RESLIB3NAME= $(RESTARGETPATCH)
diff --git a/svtools/workben/toolpanel/makefile.mk b/svtools/workben/toolpanel/makefile.mk
new file mode 100644
index 000000000000..e64e3cd8eccd
--- /dev/null
+++ b/svtools/workben/toolpanel/makefile.mk
@@ -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: makefile.mk,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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=svtools
+TARGET=toolpaneltest
+TARGETTYPE=GUI
+LIBTARGET=NO
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= toolpaneltest.cxx
+
+OBJFILES= $(OBJ)$/toolpaneltest.obj
+
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJFILES)
+APP1STDLIBS=\
+ $(VCLLIB) \
+ $(UCBHELPERLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(BASEGFXLIB) \
+ $(SVTOOLLIB) \
+
+APP1RAPTH=BRAND
+
+.IF "$(GUI)"!="UNX"
+APP1DEF= $(MISC)$/$(TARGET).def
+.ENDIF
+
+.IF "$(COM)"=="GCC"
+ADDOPTFILES=$(OBJ)$/toolpaneltest.obj
+add_cflagscxx="-frtti -fexceptions"
+.ENDIF
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
+# ------------------------------------------------------------------
+# MAC
+# ------------------------------------------------------------------
+
+.IF "$(GUI)" == "MAC"
+
+$(MISC)$/$(TARGET).def: makefile
+ echo Kein Def-File fuer Applikationen auf Mac
+.ENDIF
+
+
+# ------------------------------------------------------------------
+# Windows
+# ------------------------------------------------------------------
+
+.IF "$(GUI)" == "WIN"
+
+$(MISC)$/$(TARGET).def: makefile
+ echo NAME $(TARGET) >$@
+ echo DESCRIPTION 'ToolPanel - Testprogramm' >>$@
+ echo EXETYPE WINDOWS >>$@
+ echo STUB 'winSTUB.EXE' >>$@
+ echo PROTMODE >>$@
+ echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@
+ echo DATA PRELOAD MOVEABLE MULTIPLE >>$@
+ echo HEAPSIZE 8192 >>$@
+ echo STACKSIZE 32768 >>$@
+
+.ENDIF
+
diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx
new file mode 100755
index 000000000000..6d044cee7c93
--- /dev/null
+++ b/svtools/workben/toolpanel/toolpaneltest.cxx
@@ -0,0 +1,880 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 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_svtools.hxx"
+
+#include "ctrlbox.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+#include "svtools/toolpanel/tablayouter.hxx"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/bootstrap.hxx>
+#include <cppuhelper/servicefactory.hxx>
+#include <tools/diagnose_ex.h>
+#include <ucbhelper/contentbroker.hxx>
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/help.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/taskpanelist.hxx>
+#include <vcl/wrkwin.hxx>
+
+namespace svt { namespace toolpanel
+{
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::uno::XComponentContext;
+using ::com::sun::star::accessibility::XAccessible;
+
+//=============================================================================
+//= PanelDemo
+//=============================================================================
+class PanelDemo : public Application
+{
+public:
+ virtual void Main();
+
+private:
+ static Reference< XMultiServiceFactory > createApplicationServiceManager();
+};
+
+//=============================================================================
+//= ColoredPanelWindow
+//=============================================================================
+class ColoredPanelWindow : public Window
+{
+public:
+ ColoredPanelWindow( Window& i_rParent, const Color& i_rColor, const String& i_rTitle )
+ :Window( &i_rParent )
+ ,m_aEdit( this, WB_BORDER )
+ ,m_aTabControl( this )
+ ,m_sTitle( i_rTitle )
+ {
+ SetLineColor();
+ SetFillColor( i_rColor );
+
+ m_aEdit.Show();
+ m_aTabControl.Show();
+
+ const sal_Char* pTabTitles[] =
+ {
+ "This", "is a", "Tab", "Control", "intended", "for", "comparison"
+ };
+ for ( size_t i=0; i < sizeof( pTabTitles ) / sizeof( pTabTitles[0] ); ++i )
+ {
+ String sText( String::CreateFromAscii( pTabTitles[i] ) );
+ m_aTabControl.InsertPage( i + 1, sText );
+ }
+ }
+
+ virtual void Paint( const Rectangle& /*i_rRect*/ )
+ {
+ const Size aOutputSize( GetOutputSizePixel() );
+ const Rectangle aTitleRect( Point( 10, 10 ), Size( aOutputSize.Width() - 20, 20 ) );
+ DrawRect( aTitleRect );
+ SetTextColor( GetFillColor().IsDark() ? COL_WHITE : COL_BLACK );
+ DrawText( aTitleRect, m_sTitle, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER );
+ }
+
+ virtual void GetFocus()
+ {
+ m_aEdit.GrabFocus();
+ }
+
+ virtual void Resize()
+ {
+ const Size aOutputSize( GetOutputSizePixel() );
+ m_aEdit.SetPosSizePixel(
+ Point( 20, 40 ),
+ Size( aOutputSize.Width() - 40, 20 )
+ );
+ m_aTabControl.SetPosSizePixel(
+ Point( 20, 70 ),
+ Size( aOutputSize.Width() - 40, 150 )
+ );
+ }
+
+private:
+ Edit m_aEdit;
+ TabControl m_aTabControl;
+ String m_sTitle;
+};
+
+//=============================================================================
+//= ColoredPanel
+//=============================================================================
+class ColoredPanel : public IToolPanel
+{
+public:
+ ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_Char* i_pAsciiPanelName );
+ ColoredPanel( Window& i_rParent, const Color& i_rColor, const String& i_rPanelName );
+ ~ColoredPanel();
+
+ // IToolPanel
+ virtual ::rtl::OUString GetDisplayName() const;
+ virtual Image GetImage() const;
+ virtual SmartId GetHelpID() const;
+ virtual void Activate( Window& i_rParentWindow );
+ virtual void Deactivate();
+ virtual void SetSizePixel( const Size& i_rPanelWindowSize );
+ virtual void GrabFocus();
+ virtual void Dispose();
+ virtual Reference< XAccessible > CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible );
+
+ // IReference
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+private:
+ oslInterlockedCount m_refCount;
+ ::std::auto_ptr< ColoredPanelWindow >
+ m_pWindow;
+ ::rtl::OUString m_aPanelName;
+ BitmapEx m_aPanelIcon;
+};
+
+//=============================================================================
+//= ColoredPanel
+//=============================================================================
+//-----------------------------------------------------------------------------
+ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_Char* i_pAsciiPanelName )
+ :m_refCount(0)
+ ,m_pWindow( new ColoredPanelWindow( i_rParent, i_rColor, ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) ) )
+ ,m_aPanelName( ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) )
+ ,m_aPanelIcon()
+{
+ Bitmap aBitmap( Size( 16, 16 ), 8 );
+ m_aPanelIcon = BitmapEx( aBitmap );
+ m_aPanelIcon.Erase( i_rColor );
+}
+
+//-----------------------------------------------------------------------------
+ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const String& i_rPanelName )
+ :m_refCount(0)
+ ,m_pWindow( new ColoredPanelWindow( i_rParent, i_rColor, i_rPanelName ) )
+ ,m_aPanelName( i_rPanelName )
+ ,m_aPanelIcon()
+{
+ Bitmap aBitmap( Size( 16, 16 ), 8 );
+ m_aPanelIcon = BitmapEx( aBitmap );
+ m_aPanelIcon.Erase( i_rColor );
+}
+
+//-----------------------------------------------------------------------------
+ColoredPanel::~ColoredPanel()
+{
+}
+
+//-----------------------------------------------------------------------------
+oslInterlockedCount SAL_CALL ColoredPanel::acquire()
+{
+ return osl_incrementInterlockedCount( &m_refCount );
+}
+
+//-----------------------------------------------------------------------------
+oslInterlockedCount SAL_CALL ColoredPanel::release()
+{
+ oslInterlockedCount newCount = osl_decrementInterlockedCount( &m_refCount );
+ if ( 0 == newCount )
+ delete this;
+ return newCount;
+}
+
+//-----------------------------------------------------------------------------
+void ColoredPanel::Activate( Window& i_rParentWindow )
+{
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ OSL_ENSURE( &i_rParentWindow == m_pWindow->GetParent(), "ColoredPanel::Activate: unexpected new parent window!" );
+ // the documentation of IToolPanel::Activate says it is guaranteed that the parent window is
+ // always the same ...
+ m_pWindow->SetPosSizePixel( Point(), i_rParentWindow.GetSizePixel() );
+ m_pWindow->Show();
+}
+
+//-----------------------------------------------------------------------------
+void ColoredPanel::Deactivate()
+{
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow->Hide();
+}
+
+//-----------------------------------------------------------------------------
+void ColoredPanel::SetSizePixel( const Size& i_rPanelWindowSize )
+{
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow->SetSizePixel( i_rPanelWindowSize );
+}
+
+//-----------------------------------------------------------------------------
+void ColoredPanel::GrabFocus()
+{
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow->GrabFocus();
+}
+
+//-----------------------------------------------------------------------------
+void ColoredPanel::Dispose()
+{
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow.reset();
+}
+
+//-----------------------------------------------------------------------------
+Reference< XAccessible > ColoredPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible )
+{
+ ENSURE_OR_RETURN( m_pWindow.get(), "disposed!", NULL );
+ (void)i_rParentAccessible;
+ return m_pWindow->GetAccessible();
+}
+
+//-----------------------------------------------------------------------------
+::rtl::OUString ColoredPanel::GetDisplayName() const
+{
+ return m_aPanelName;
+}
+
+//-----------------------------------------------------------------------------
+Image ColoredPanel::GetImage() const
+{
+ return Image( m_aPanelIcon );
+}
+
+//-----------------------------------------------------------------------------
+SmartId ColoredPanel::GetHelpID() const
+{
+ return SmartId();
+}
+
+//=============================================================================
+//= OptionsWindow
+//=============================================================================
+class PanelDemoMainWindow;
+class OptionsWindow :public Window
+ ,public ::svt::IToolPanelDeckListener
+{
+public:
+ OptionsWindow( PanelDemoMainWindow& i_rParent );
+ ~OptionsWindow();
+
+ // Window overridables
+ virtual void Resize();
+ virtual void GetFocus();
+ virtual void StateChanged( StateChangedType i_nStateChange );
+
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+private:
+ DECL_LINK( OnRadioToggled, RadioButton* );
+ DECL_LINK( OnListEntrySelected, ListBox* );
+ DECL_LINK( OnListEntryDoubleClicked, ListBox* );
+ DECL_LINK( OnButtonClicked, PushButton* );
+ DECL_LINK( OnEditModified, Edit* );
+
+ void impl_initPanelList();
+ void impl_updateRemoveButton();
+ void impl_updateInsertButton();
+
+private:
+ FixedLine m_aAlignmentHeader;
+ RadioButton m_aAlignLeft;
+ RadioButton m_aAlignRight;
+ RadioButton m_aAlignTop;
+ RadioButton m_aAlignBottom;
+ FixedLine m_aTabItemContent;
+ RadioButton m_aImagesAndText;
+ RadioButton m_aImagesOnly;
+ RadioButton m_aTextOnly;
+ RadioButton m_aAutomaticContent;
+
+ FixedLine m_aPanelsHeader;
+ ListBox m_aPanelList;
+ PushButton m_aRemovePanel;
+ ColorListBox m_aColors;
+ Edit m_aNewPanelName;
+ PushButton m_aInsertPanel;
+};
+
+//=============================================================================
+//= PanelDemoMainWindow
+//=============================================================================
+class PanelDemoMainWindow : public WorkWindow
+{
+public:
+ PanelDemoMainWindow();
+ ~PanelDemoMainWindow();
+
+ // window overridables
+ virtual void Resize();
+
+public:
+ // operations
+ void AlignTabs( const ::svt::TabAlignment i_eAlignment );
+ void SetTabItemContent( const TabItemContent i_eItemContent );
+
+ // member access
+ IToolPanelDeck& GetToolPanelDeck();
+ PToolPanel CreateToolPanel( const Color& i_rColor, const String& i_rPanelName );
+
+protected:
+ virtual void GetFocus();
+
+private:
+ ToolPanelDeck m_aToolPanelDeck;
+ OptionsWindow m_aDemoOptions;
+};
+
+//=============================================================================
+//= PanelDemoMainWindow - implementation
+//=============================================================================
+//-----------------------------------------------------------------------------
+OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent )
+ :Window( &i_rParent, WB_BORDER | WB_DIALOGCONTROL )
+ ,m_aAlignmentHeader( this )
+ ,m_aAlignLeft( this, WB_GROUP )
+ ,m_aAlignRight( this, 0 )
+ ,m_aAlignTop( this, 0 )
+ ,m_aAlignBottom( this, 0 )
+ ,m_aTabItemContent( this )
+ ,m_aImagesAndText( this )
+ ,m_aImagesOnly( this )
+ ,m_aTextOnly( this )
+ ,m_aAutomaticContent( this )
+ ,m_aPanelsHeader( this )
+ ,m_aPanelList( this )
+ ,m_aRemovePanel( this )
+ ,m_aColors( this, WB_DROPDOWN )
+ ,m_aNewPanelName( this, WB_BORDER )
+ ,m_aInsertPanel( this )
+{
+ SetBorderStyle( WINDOW_BORDER_MONO );
+
+ m_aColors.InsertEntry( Color( COL_BLACK ), String( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
+ m_aColors.InsertEntry( Color( COL_BLUE ), String( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) ) );
+ m_aColors.InsertEntry( Color( COL_GREEN ), String( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
+ m_aColors.InsertEntry( Color( COL_CYAN ), String( RTL_CONSTASCII_USTRINGPARAM( "Cyan" ) ) );
+ m_aColors.InsertEntry( Color( COL_RED ), String( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
+ m_aColors.InsertEntry( Color( COL_MAGENTA ), String( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) );
+ m_aColors.InsertEntry( Color( COL_BROWN ), String( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) );
+ m_aColors.InsertEntry( Color( COL_GRAY ), String( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) );
+ m_aColors.InsertEntry( Color( COL_LIGHTGRAY ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Gray" ) ) );
+ m_aColors.InsertEntry( Color( COL_LIGHTBLUE ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Blue" ) ) );
+ m_aColors.InsertEntry( Color( COL_LIGHTGREEN ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Green" ) ) );
+ m_aColors.InsertEntry( Color( COL_LIGHTCYAN ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Cyan" ) ) );
+ m_aColors.InsertEntry( Color( COL_LIGHTRED ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Red" ) ) );
+ m_aColors.InsertEntry( Color( COL_LIGHTMAGENTA ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Magenta" ) ) );
+ m_aColors.InsertEntry( Color( COL_YELLOW ), String( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) );
+ m_aColors.InsertEntry( Color( COL_WHITE ), String( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) );
+ m_aColors.SetDropDownLineCount( 16 );
+
+ Window* pControls[] =
+ {
+ &m_aAlignmentHeader, &m_aAlignLeft, &m_aAlignRight, &m_aAlignTop, &m_aAlignBottom, &m_aTabItemContent,
+ &m_aImagesAndText, &m_aImagesOnly, &m_aTextOnly, &m_aAutomaticContent, &m_aPanelsHeader, &m_aPanelList,
+ &m_aRemovePanel, &m_aColors, &m_aNewPanelName, &m_aInsertPanel
+ };
+ const sal_Char* pTexts[] =
+ {
+ "Tab Bar Alignment", "Left", "Right", "Top", "Bottom", "Tab Items", "Images and Text", "Images only",
+ "Text only", "Automatic", "Panels", "", "Remove Panel", "", "", "Insert Panel"
+ };
+ for ( size_t i=0; i < sizeof( pControls ) / sizeof( pControls[0] ); ++i )
+ {
+ const WindowType eWindowType = pControls[i]->GetType();
+
+ pControls[i]->SetText( String::CreateFromAscii( pTexts[i] ) );
+ pControls[i]->Show();
+
+ if ( eWindowType == WINDOW_RADIOBUTTON )
+ static_cast< RadioButton* >( pControls[i] )->SetToggleHdl( LINK( this, OptionsWindow, OnRadioToggled ) );
+
+ if ( eWindowType == WINDOW_LISTBOX )
+ {
+ static_cast< ListBox* >( pControls[i] )->SetSelectHdl( LINK( this, OptionsWindow, OnListEntrySelected ) );
+ static_cast< ListBox* >( pControls[i] )->SetDoubleClickHdl( LINK( this, OptionsWindow, OnListEntryDoubleClicked ) );
+ }
+
+ if ( eWindowType == WINDOW_PUSHBUTTON )
+ {
+ static_cast< PushButton* >( pControls[i] )->SetClickHdl( LINK( this, OptionsWindow, OnButtonClicked ) );
+ }
+
+ if ( eWindowType == WINDOW_EDIT )
+ {
+ static_cast< Edit* >( pControls[i] )->SetModifyHdl( LINK( this, OptionsWindow, OnEditModified ) );
+ }
+ }
+
+ m_aAlignRight.Check();
+ m_aImagesAndText.Check();
+
+ Show();
+}
+
+//-----------------------------------------------------------------------------
+OptionsWindow::~OptionsWindow()
+{
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::impl_updateInsertButton()
+{
+ m_aInsertPanel.Enable( ( m_aColors.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) && ( m_aNewPanelName.GetText().Len() > 0 ) );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::impl_updateRemoveButton()
+{
+ m_aRemovePanel.Enable( m_aPanelList.GetSelectEntryCount() > 0 );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::impl_initPanelList()
+{
+ m_aPanelList.Clear();
+
+ PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) );
+ IToolPanelDeck& rPanelDeck( rController.GetToolPanelDeck() );
+
+ for ( size_t i=0; i<rPanelDeck.GetPanelCount(); ++i )
+ {
+ PToolPanel pPanel = rPanelDeck.GetPanel( i );
+ m_aPanelList.InsertEntry( pPanel->GetDisplayName(), pPanel->GetImage() );
+ }
+ ActivePanelChanged( ::boost::optional< size_t >(), rPanelDeck.GetActivePanel() );
+
+ impl_updateRemoveButton();
+ impl_updateInsertButton();
+
+ rPanelDeck.AddListener( *this );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::StateChanged( StateChangedType i_nStateChange )
+{
+ Window::StateChanged( i_nStateChange );
+
+ if ( i_nStateChange == STATE_CHANGE_INITSHOW )
+ {
+ impl_initPanelList();
+ }
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::GetFocus()
+{
+ Window::GetFocus();
+ RadioButton* pRadios[] =
+ {
+ &m_aAlignLeft, &m_aAlignRight, &m_aAlignTop, &m_aAlignBottom
+ };
+ for ( size_t i=0; i < sizeof( pRadios ) / sizeof( pRadios[0] ); ++i )
+ {
+ if ( pRadios[i]->IsChecked() )
+ {
+ pRadios[i]->GrabFocus();
+ break;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::Resize()
+{
+ Window::Resize();
+
+ const Size aOutputSize( GetOutputSizePixel() );
+
+ const Size aSpacing( LogicToPixel( Size( 3, 3 ), MAP_APPFONT ) );
+ const long nIndent( LogicToPixel( Size( 6, 9 ), MAP_APPFONT ).Width() );
+ const long nFixedLineHeight( LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height() );
+ const long nEditLineHeight( LogicToPixel( Size( 0, 12 ), MAP_APPFONT ).Height() );
+ const long nButtonLineHeight( LogicToPixel( Size( 0, 14 ), MAP_APPFONT ).Height() );
+
+ const long nSuperordinateWidth = aOutputSize.Width() - 2 * aSpacing.Width();
+ const long nSuperordinateX = aSpacing.Width();
+
+ const long nSubordinateWidth = aOutputSize.Width() - 2 * aSpacing.Width() - nIndent;
+ const long nSubordinateX = aSpacing.Width() + nIndent;
+
+ Point aItemPos( nSuperordinateX, aSpacing.Height() );
+
+ struct ControlRow
+ {
+ Window* pWindow;
+ bool bSubordinate;
+ size_t nRows;
+
+ ControlRow( Window& i_rWindow, const bool i_bSubordinate, const size_t i_nRows = 1 )
+ :pWindow( &i_rWindow )
+ ,bSubordinate( i_bSubordinate )
+ ,nRows( i_nRows )
+ {
+ }
+ };
+ ControlRow aControlRows[] =
+ {
+ ControlRow( m_aAlignmentHeader, false ),
+ ControlRow( m_aAlignLeft, true ),
+ ControlRow( m_aAlignRight, true ),
+ ControlRow( m_aAlignTop, true ),
+ ControlRow( m_aAlignBottom, true ),
+ ControlRow( m_aTabItemContent, false ),
+ ControlRow( m_aImagesAndText, true ),
+ ControlRow( m_aImagesOnly, true ),
+ ControlRow( m_aTextOnly, true ),
+ ControlRow( m_aAutomaticContent, true ),
+ ControlRow( m_aPanelsHeader, false ),
+ ControlRow( m_aPanelList, true, 6 ),
+ ControlRow( m_aRemovePanel, true ),
+ ControlRow( m_aColors, true ),
+ ControlRow( m_aNewPanelName, true ),
+ ControlRow( m_aInsertPanel, true )
+ };
+ bool bPreviousWasSubordinate = false;
+ for ( size_t i=0; i < sizeof( aControlRows ) / sizeof( aControlRows[0] ); ++i )
+ {
+ aItemPos.X() = ( aControlRows[i].bSubordinate ) ? nSubordinateX : nSuperordinateX;
+
+ if ( bPreviousWasSubordinate && !aControlRows[i].bSubordinate )
+ aItemPos.Y() += aSpacing.Height();
+ bPreviousWasSubordinate = aControlRows[i].bSubordinate;
+
+ // height depends on the window type
+ const WindowType eWindowType = aControlRows[i].pWindow->GetType();
+ long nControlHeight( nFixedLineHeight );
+ if ( ( eWindowType == WINDOW_EDIT )
+ || ( eWindowType == WINDOW_LISTBOX )
+ )
+ {
+ nControlHeight = nEditLineHeight;
+ }
+ else
+ if ( ( eWindowType == WINDOW_PUSHBUTTON )
+ )
+ {
+ nControlHeight = nButtonLineHeight;
+ }
+
+ Size aControlSize(
+ aControlRows[i].bSubordinate ? nSubordinateWidth : nSuperordinateWidth,
+ nControlHeight * aControlRows[i].nRows
+ );
+ aControlRows[i].pWindow->SetPosSizePixel( aItemPos, aControlSize );
+
+ aItemPos.Move( 0, aControlSize.Height() + aSpacing.Height() );
+ }
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition )
+{
+ m_aPanelList.InsertEntry( i_pPanel->GetDisplayName(), i_pPanel->GetImage(), USHORT( i_nPosition ) );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::PanelRemoved( const size_t i_nPosition )
+{
+ m_aPanelList.RemoveEntry( USHORT( i_nPosition ) );
+ impl_updateRemoveButton();
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+{
+ (void)i_rOldActive;
+
+ if ( !i_rNewActive )
+ m_aPanelList.SetNoSelection();
+ else
+ m_aPanelList.SelectEntryPos( USHORT( *i_rNewActive ) );
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::LayouterChanged( const PDeckLayouter& i_rNewLayouter )
+{
+ (void)i_rNewLayouter;
+ // not interested in
+}
+
+//-----------------------------------------------------------------------------
+void OptionsWindow::Dying()
+{
+ // not interested in
+}
+
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnListEntrySelected, ListBox*, i_pListBox )
+{
+ if ( i_pListBox == &m_aColors )
+ {
+ m_aNewPanelName.SetText( m_aColors.GetEntry( m_aColors.GetSelectEntryPos() ) );
+ impl_updateInsertButton();
+ }
+ else if ( i_pListBox == &m_aPanelList )
+ {
+ impl_updateRemoveButton();
+ }
+ return 0L;
+}
+
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnListEntryDoubleClicked, ListBox*, i_pListBox )
+{
+ PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) );
+
+ if ( i_pListBox == &m_aPanelList )
+ {
+ size_t nActivatePanel = size_t( m_aPanelList.GetSelectEntryPos() );
+ rController.GetToolPanelDeck().ActivatePanel( nActivatePanel );
+ }
+
+ return 0L;
+}
+
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnEditModified, Edit*, i_pEdit )
+{
+ if ( i_pEdit && &m_aNewPanelName )
+ {
+ impl_updateInsertButton();
+ }
+
+ return 0L;
+}
+
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnButtonClicked, PushButton*, i_pPushButton )
+{
+ PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) );
+
+ if ( i_pPushButton == &m_aRemovePanel )
+ {
+ rController.GetToolPanelDeck().RemovePanel( size_t( m_aPanelList.GetSelectEntryPos() ) );
+ }
+ else if ( i_pPushButton == &m_aInsertPanel )
+ {
+ PToolPanel pNewPanel( rController.CreateToolPanel( m_aColors.GetEntryColor( m_aColors.GetSelectEntryPos() ), m_aNewPanelName.GetText() ) );
+
+ ::boost::optional< size_t > aActivePanel( rController.GetToolPanelDeck().GetActivePanel() );
+ size_t nNewPanelPos = !aActivePanel ? rController.GetToolPanelDeck().GetPanelCount() : *aActivePanel + 1;
+
+ rController.GetToolPanelDeck().InsertPanel( pNewPanel, nNewPanelPos );
+ }
+ return 0L;
+}
+
+//-----------------------------------------------------------------------------
+IMPL_LINK( OptionsWindow, OnRadioToggled, RadioButton*, i_pRadioButton )
+{
+ PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) );
+
+ if ( i_pRadioButton->IsChecked() )
+ {
+ if ( i_pRadioButton == &m_aAlignLeft )
+ {
+ rController.AlignTabs( TABS_LEFT );
+ }
+ else if ( i_pRadioButton == &m_aAlignRight )
+ {
+ rController.AlignTabs( TABS_RIGHT );
+ }
+ else if ( i_pRadioButton == &m_aAlignTop )
+ {
+ rController.AlignTabs( TABS_TOP );
+ }
+ else if ( i_pRadioButton == &m_aAlignBottom )
+ {
+ rController.AlignTabs( TABS_BOTTOM );
+ }
+ else if ( i_pRadioButton == &m_aImagesAndText )
+ {
+ rController.SetTabItemContent( TABITEM_IMAGE_AND_TEXT );
+ }
+ else if ( i_pRadioButton == &m_aImagesOnly )
+ {
+ rController.SetTabItemContent( TABITEM_IMAGE_ONLY );
+ }
+ else if ( i_pRadioButton == &m_aTextOnly )
+ {
+ rController.SetTabItemContent( TABITEM_TEXT_ONLY );
+ }
+ else if ( i_pRadioButton == &m_aAutomaticContent )
+ {
+ rController.SetTabItemContent( TABITEM_AUTO );
+ }
+ }
+ return 0L;
+}
+//=============================================================================
+//= PanelDemoMainWindow - implementation
+//=============================================================================
+//-----------------------------------------------------------------------------
+PanelDemoMainWindow::PanelDemoMainWindow()
+ :WorkWindow( NULL, WB_APP | WB_STDWORK | WB_CLIPCHILDREN )
+ ,m_aToolPanelDeck( *this, WB_BORDER )
+ ,m_aDemoOptions( *this )
+{
+ m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), Size( 500, 300 ) );
+ m_aToolPanelDeck.SetBorderStyle( WINDOW_BORDER_MONO );
+
+ m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), Color( COL_RED ), "Red" ) ), m_aToolPanelDeck.GetPanelCount() );
+ m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), Color( COL_GREEN ), "Some flavor of Green" ) ), m_aToolPanelDeck.GetPanelCount() );
+ m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), RGB_COLORDATA( 255, 255, 0 ), "Yellow is ugly" ) ), m_aToolPanelDeck.GetPanelCount() );
+ m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), RGB_COLORDATA( 0, 0, 128 ), "Blue is the Color" ) ), m_aToolPanelDeck.GetPanelCount() );
+
+ m_aToolPanelDeck.ActivatePanel( size_t( 0 ) );
+ m_aToolPanelDeck.Show();
+
+ SetText( String::CreateFromAscii( "ToolPanelDeck Demo Application" ) );
+ Show();
+
+ Help::EnableQuickHelp();
+
+ GetSystemWindow()->GetTaskPaneList()->AddWindow( &m_aToolPanelDeck );
+ GetSystemWindow()->GetTaskPaneList()->AddWindow( &m_aDemoOptions );
+}
+
+//-----------------------------------------------------------------------------
+PanelDemoMainWindow::~PanelDemoMainWindow()
+{
+ GetSystemWindow()->GetTaskPaneList()->RemoveWindow( &m_aDemoOptions );
+ GetSystemWindow()->GetTaskPaneList()->RemoveWindow( &m_aToolPanelDeck );
+}
+
+//-----------------------------------------------------------------------------
+void PanelDemoMainWindow::GetFocus()
+{
+ WorkWindow::GetFocus();
+ m_aToolPanelDeck.GrabFocus();
+}
+
+//-----------------------------------------------------------------------------
+void PanelDemoMainWindow::Resize()
+{
+ WorkWindow::Resize();
+ Size aSize( GetOutputSizePixel() );
+ aSize.Width() -= 240;
+ aSize.Height() -= 40;
+ m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), aSize );
+
+ m_aDemoOptions.SetPosSizePixel(
+ Point( 20 + aSize.Width(), 20 ),
+ Size( 200, aSize.Height() )
+ );
+}
+
+//-----------------------------------------------------------------------------
+void PanelDemoMainWindow::AlignTabs( const ::svt::TabAlignment i_eAlignment )
+{
+ TabItemContent eCurrentItemContent( TABITEM_IMAGE_AND_TEXT );
+ TabDeckLayouter* pLayouter = dynamic_cast< TabDeckLayouter* >( m_aToolPanelDeck.GetLayouter().get() );
+ OSL_ENSURE( pLayouter, "PanelDemoMainWindow::AlignTabs: wrong layouter!" );
+ if ( pLayouter )
+ eCurrentItemContent = pLayouter->GetTabItemContent();
+
+ m_aToolPanelDeck.SetLayouter( PDeckLayouter( new TabDeckLayouter( m_aToolPanelDeck, m_aToolPanelDeck, i_eAlignment, eCurrentItemContent ) ) );
+}
+
+//-----------------------------------------------------------------------------
+void PanelDemoMainWindow::SetTabItemContent( const TabItemContent i_eItemContent )
+{
+ TabDeckLayouter* pLayouter = dynamic_cast< TabDeckLayouter* >( m_aToolPanelDeck.GetLayouter().get() );
+ OSL_ENSURE( pLayouter, "PanelDemoMainWindow::SetTabItemContent: wrong layouter!" );
+ // we currently use tab layouters only ...
+ if ( !pLayouter )
+ return;
+
+ pLayouter->SetTabItemContent( i_eItemContent );
+}
+
+//-----------------------------------------------------------------------------
+IToolPanelDeck& PanelDemoMainWindow::GetToolPanelDeck()
+{
+ return m_aToolPanelDeck;
+}
+
+//-----------------------------------------------------------------------------
+PToolPanel PanelDemoMainWindow::CreateToolPanel( const Color& i_rColor, const String& i_rPanelName )
+{
+ return PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), i_rColor, i_rPanelName ) );
+}
+
+//=============================================================================
+//= PanelDemo
+//=============================================================================
+//-----------------------------------------------------------------------------
+Reference< XMultiServiceFactory > PanelDemo::createApplicationServiceManager()
+{
+ Reference< XMultiServiceFactory > xMS;
+ try
+ {
+ Reference< XComponentContext > xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext();
+ if ( xComponentContext.is() )
+ xMS = xMS.query( xComponentContext->getServiceManager() );
+ }
+ catch( const ::com::sun::star::uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return xMS;
+}
+
+//-----------------------------------------------------------------------------
+void __EXPORT PanelDemo::Main()
+{
+ // create service factory
+ Reference< XMultiServiceFactory > xSMgr = createApplicationServiceManager();
+ ::comphelper::setProcessServiceFactory( xSMgr );
+
+ // initialize the UCB
+ Sequence< Any > aArgs(2);
+ aArgs[0] <<= rtl::OUString::createFromAscii( "Local" );
+ aArgs[1] <<= rtl::OUString::createFromAscii( "Office" );
+ ::ucbhelper::ContentBroker::initialize( xSMgr, aArgs );
+
+ // run the application
+ PanelDemoMainWindow aWindow;
+ Execute();
+}
+
+PanelDemo aTheApplication;
+
+} } // namespace ::svt::toolpanel
diff --git a/svtools/workben/unodialog/roadmapskeleton.cxx b/svtools/workben/unodialog/roadmapskeleton.cxx
index f261f219c3fd..e3ed06707f14 100644
--- a/svtools/workben/unodialog/roadmapskeleton.cxx
+++ b/svtools/workben/unodialog/roadmapskeleton.cxx
@@ -103,9 +103,9 @@ namespace udlg
}
//--------------------------------------------------------------------
- sal_Bool RoadmapSkeletonDialog::onFinish( sal_Int32 _nResult )
+ sal_Bool RoadmapSkeletonDialog::onFinish()
{
- return RoadmapSkeletonDialog_Base::onFinish( _nResult );
+ return RoadmapSkeletonDialog_Base::onFinish();
}
//........................................................................
diff --git a/svtools/workben/unodialog/roadmapskeleton.hxx b/svtools/workben/unodialog/roadmapskeleton.hxx
index 216c940b842a..8859390c4b58 100644
--- a/svtools/workben/unodialog/roadmapskeleton.hxx
+++ b/svtools/workben/unodialog/roadmapskeleton.hxx
@@ -52,7 +52,7 @@ namespace udlg
virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason );
virtual sal_Bool leaveState( WizardState _nState );
virtual WizardState determineNextState( WizardState _nCurrentState ) const;
- virtual sal_Bool onFinish( sal_Int32 _nResult );
+ virtual sal_Bool onFinish();
private:
::comphelper::ComponentContext m_aContext;
diff --git a/toolkit/inc/toolkit/awt/vclxwindow.hxx b/toolkit/inc/toolkit/awt/vclxwindow.hxx
index 97f36850dff9..6ad3c3ab6076 100644
--- a/toolkit/inc/toolkit/awt/vclxwindow.hxx
+++ b/toolkit/inc/toolkit/awt/vclxwindow.hxx
@@ -51,6 +51,7 @@
#include <stdarg.h>
#include <list>
+#include <boost/function.hpp>
class Window;
class VclSimpleEvent;
@@ -114,6 +115,23 @@ protected:
::cppu::OInterfaceContainerHelper& GetTopWindowListeners();
public:
+ typedef ::boost::function0< void > Callback;
+
+protected:
+ /** executes the given callback asynchronously
+
+ At the moment the callback is called, the Solar Mutex is not locked. In particular, this implies that
+ you cannot rely on |this| not being disposed. However, you *can* rely on |this| being still alive (i.e.
+ having a ref count > 0).
+
+ As a consequence, this can be used for doing listener notifications, using event multiplexers. Those multiplexers
+ care for the disposed state themself, and are alive as long as |this| is alive.
+ */
+ void ImplExecuteAsyncWithoutSolarLock(
+ const Callback& i_callback
+ );
+
+public:
VCLXWindow( bool bWithDefaultProps = false );
~VCLXWindow();
diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx
index c334e4d9af65..ca3267bffb5e 100644
--- a/toolkit/inc/toolkit/awt/vclxwindows.hxx
+++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -75,7 +75,7 @@
#include <com/sun/star/awt/XFixedHyperlink.hpp>
#include <com/sun/star/awt/XFixedText.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
-#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/awt/XDialog2.hpp>
#include <com/sun/star/awt/XRadioButton.hpp>
#include <com/sun/star/awt/XCurrencyField.hpp>
#include <com/sun/star/awt/XPatternField.hpp>
@@ -83,7 +83,9 @@
#include <com/sun/star/awt/XComboBox.hpp>
#include <com/sun/star/awt/XCheckBox.hpp>
#include <com/sun/star/awt/XImageConsumer.hpp>
+#include <com/sun/star/awt/XItemListListener.hpp>
#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase2.hxx>
#include "toolkit/awt/vclxwindow.hxx"
@@ -388,7 +390,7 @@ public:
// ----------------------------------------------------
// class VCLXDialog
// ----------------------------------------------------
-class VCLXDialog : public ::com::sun::star::awt::XDialog,
+class VCLXDialog : public ::com::sun::star::awt::XDialog2,
public VCLXTopWindow
{
public:
@@ -404,6 +406,10 @@ public:
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::awt::XDialog2
+ virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpId( ::sal_Int32 Id ) throw (::com::sun::star::uno::RuntimeException);
+
// ::com::sun::star::awt::XDialog
void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException);
::rtl::OUString SAL_CALL getTitle( ) throw(::com::sun::star::uno::RuntimeException);
@@ -677,9 +683,12 @@ public:
// ----------------------------------------------------
// class VCLXListBox
// ----------------------------------------------------
-class VCLXListBox : public ::com::sun::star::awt::XListBox,
- public ::com::sun::star::awt::XTextLayoutConstrains,
- public VCLXWindow
+typedef ::cppu::ImplInheritanceHelper3 < VCLXWindow
+ , ::com::sun::star::awt::XListBox
+ , ::com::sun::star::awt::XTextLayoutConstrains
+ , ::com::sun::star::awt::XItemListListener
+ > VCLXListBox_Base;
+class VCLXListBox : public VCLXListBox_Base
{
private:
ActionListenerMultiplexer maActionListeners;
@@ -694,16 +703,6 @@ protected:
public:
VCLXListBox();
- // ::com::sun::star::uno::XInterface
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
- void SAL_CALL release() throw() { OWeakObject::release(); }
-
- // ::com::sun::star::lang::XTypeProvider
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-
-
// ::com::sun::star::lang::XComponent
void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
@@ -744,6 +743,16 @@ public:
void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+ // XItemListListener
+ virtual void SAL_CALL listItemInserted( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemRemoved( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemModified( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL allItemsRemoved( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
};
diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
index b6a0e66b2430..0c5731d3f923 100644
--- a/toolkit/inc/toolkit/controls/dialogcontrol.hxx
+++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
@@ -36,7 +36,7 @@
#include <com/sun/star/util/XChangesListener.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
-#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/awt/XDialog2.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
#include <cppuhelper/implbase6.hxx>
#include <cppuhelper/implbase5.hxx>
@@ -186,7 +186,7 @@ protected:
// ----------------------------------------------------
typedef ::cppu::ImplHelper6 < ::com::sun::star::container::XContainerListener
, ::com::sun::star::awt::XTopWindow
- , ::com::sun::star::awt::XDialog
+ , ::com::sun::star::awt::XDialog2
, ::com::sun::star::util::XChangesListener
, ::com::sun::star::util::XModifyListener
, ::com::sun::star::awt::XWindowListener
@@ -272,6 +272,10 @@ public:
void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::awt::XDialog2
+ virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpId( ::sal_Int32 Id ) throw (::com::sun::star::uno::RuntimeException);
+
// ::com::sun::star::awt::XDialog
void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException);
::rtl::OUString SAL_CALL getTitle() throw(::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/inc/toolkit/controls/roadmapcontrol.hxx b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx
index 7ac858a6a7b7..46f31947b276 100644
--- a/toolkit/inc/toolkit/controls/roadmapcontrol.hxx
+++ b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx
@@ -132,15 +132,9 @@ namespace toolkit{
// ::com::sun::star::io::XPersistObject
::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::beans::XMultiPropertySet
-// ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
-
-
// ::com::sun::star::lang::XServiceInfo
DECLIMPL_SERVICEINFO_DERIVED( UnoControlRoadmapModel, UnoControlModel, szServiceName2_UnoControlRoadmapModel )
-// void ImplPropertyChanged( sal_uInt16 nPropId );
-
sal_Int32 SAL_CALL getCount() throw (RuntimeException);
virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
diff --git a/toolkit/inc/toolkit/controls/unocontrol.hxx b/toolkit/inc/toolkit/controls/unocontrol.hxx
index 578b5070e8e8..0515abe27128 100644
--- a/toolkit/inc/toolkit/controls/unocontrol.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrol.hxx
@@ -38,6 +38,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/awt/XUnitConversion.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <cppuhelper/weakagg.hxx>
#include <osl/mutex.hxx>
@@ -46,7 +47,7 @@
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <cppuhelper/weakref.hxx>
-#include <cppuhelper/implbase7.hxx>
+#include <cppuhelper/implbase8.hxx>
#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
#include <com/sun/star/awt/XVclWindowPeer.hpp>
@@ -73,13 +74,14 @@ struct UnoControl_Data;
// ----------------------------------------------------
// class UnoControl
// ----------------------------------------------------
-typedef ::cppu::WeakAggImplHelper7 < ::com::sun::star::awt::XControl
+typedef ::cppu::WeakAggImplHelper8 < ::com::sun::star::awt::XControl
, ::com::sun::star::awt::XWindow2
, ::com::sun::star::awt::XView
, ::com::sun::star::beans::XPropertiesChangeListener
, ::com::sun::star::lang::XServiceInfo
, ::com::sun::star::accessibility::XAccessible
, ::com::sun::star::util::XModeChangeBroadcaster
+ , ::com::sun::star::awt::XUnitConversion
> UnoControl_Base;
class TOOLKIT_DLLPUBLIC UnoControl : public UnoControl_Base
@@ -119,7 +121,7 @@ protected:
::osl::Mutex& GetMutex() { return maMutex; }
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > getParentPeer() const;
- void updateFromModel();
+ virtual void updateFromModel();
void peerCreated();
bool ImplCheckLocalize( ::rtl::OUString& _rPossiblyLocalizable );
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer );
@@ -220,6 +222,12 @@ public:
virtual void SAL_CALL addModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ // XUnitConversion
+ virtual ::com::sun::star::awt::Point SAL_CALL convertPointToLogic( const ::com::sun::star::awt::Point& Point, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL convertPointToPixel( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL convertSizeToLogic( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL convertSizeToPixel( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
private:
// ::com::sun::star::beans::XPropertiesChangeListener
void SAL_CALL propertiesChange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& evt ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
index 2de5e36aa02c..a443cb4d2d6b 100644
--- a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
@@ -74,7 +74,6 @@ protected:
void ImplRegisterProperties( const std::list< sal_uInt16 > &rIds );
void ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault );
::com::sun::star::uno::Sequence<sal_Int32> ImplGetPropertyIds() const;
- virtual void ImplPropertyChanged( sal_uInt16 nPropId );
virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
sal_Bool ImplHasProperty( sal_uInt16 nPropId ) const;
diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx
index a4015dfd3b44..88449418c70a 100644
--- a/toolkit/inc/toolkit/controls/unocontrols.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrols.hxx
@@ -51,6 +51,7 @@
#include <com/sun/star/awt/XCurrencyField.hpp>
#include <com/sun/star/awt/XPatternField.hpp>
#include <com/sun/star/awt/XProgressBar.hpp>
+#include <com/sun/star/awt/XItemList.hpp>
#include <com/sun/star/graphic/XGraphicObject.hpp>
#include <toolkit/controls/unocontrolmodel.hxx>
#include <toolkit/controls/unocontrolbase.hxx>
@@ -58,12 +59,17 @@
#include <toolkit/helper/servicenames.hxx>
#include <vcl/imgcons.hxx>
#include <vcl/bitmapex.hxx>
+#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase1.hxx>
#include <comphelper/uno3.hxx>
#include <list>
+#include <vector>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/optional.hpp>
#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:"
@@ -751,19 +757,18 @@ public:
// ----------------------------------------------------
// class UnoControlListBoxModel
// ----------------------------------------------------
-class UnoControlListBoxModel : public UnoControlModel
+struct UnoControlListBoxModel_Data;
+typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel
+ , ::com::sun::star::awt::XItemList
+ > UnoControlListBoxModel_Base;
+class UnoControlListBoxModel :public UnoControlListBoxModel_Base
{
-protected:
- ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
- ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-
public:
UnoControlListBoxModel();
- UnoControlListBoxModel( const UnoControlListBoxModel& rModel ) : UnoControlModel( rModel ) {;}
+ UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource );
UnoControlModel* Clone() const { return new UnoControlListBoxModel( *this ); }
- void ImplPropertyChanged( sal_uInt16 nPropId );
virtual void ImplNormalizePropertySequence(
const sal_Int32 _nCount, /// the number of entries in the arrays
sal_Int32* _pHandles, /// the handles of the properties to set
@@ -780,41 +785,87 @@ public:
// ::com::sun::star::lang::XServiceInfo
DECLIMPL_SERVICEINFO_DERIVED( UnoControlListBoxModel, UnoControlModel, szServiceName2_UnoControlListBoxModel )
+ // ::com::sun::star::awt::XItemList
+ virtual ::sal_Int32 SAL_CALL getItemCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertItem( ::sal_Int32 Position, const ::rtl::OUString& ItemText, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertItemText( ::sal_Int32 Position, const ::rtl::OUString& ItemText ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertItemImage( ::sal_Int32 Position, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeItem( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAllItems( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemText( ::sal_Int32 Position, const ::rtl::OUString& ItemText ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemImage( ::sal_Int32 Position, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemTextAndImage( ::sal_Int32 Position, const ::rtl::OUString& ItemText, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemData( ::sal_Int32 Position, const ::com::sun::star::uno::Any& DataValue ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getItemText( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getItemImage( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL getItemTextAndImage( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getItemData( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Pair< ::rtl::OUString, ::rtl::OUString > > SAL_CALL getAllItems( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addItemListListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeItemListListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OPropertySetHelper
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+private:
+ void impl_notifyItemListEvent_nolck(
+ const sal_Int32 i_nItemPosition,
+ const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
+ void ( SAL_CALL ::com::sun::star::awt::XItemListListener::*NotificationMethod )( const ::com::sun::star::awt::ItemListEvent& )
+ );
+
+ void impl_handleInsert(
+ const sal_Int32 i_nItemPosition,
+ const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
+ ::osl::ClearableMutexGuard& i_rClearBeforeNotify
+ );
+
+ void impl_handleRemove(
+ const sal_Int32 i_nItemPosition,
+ ::osl::ClearableMutexGuard& i_rClearBeforeNotify
+ );
+
+ void impl_handleModify(
+ const sal_Int32 i_nItemPosition,
+ const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
+ ::osl::ClearableMutexGuard& i_rClearBeforeNotify
+ );
+
+ void impl_getStringItemList( ::std::vector< ::rtl::OUString >& o_rStringItems ) const;
+ void impl_setStringItemList_nolck( const ::std::vector< ::rtl::OUString >& i_rStringItems );
+
+private:
+ ::boost::scoped_ptr< UnoControlListBoxModel_Data > m_pData;
+ ::cppu::OInterfaceContainerHelper m_aItemListListeners;
};
// ----------------------------------------------------
// class UnoListBoxControl
// ----------------------------------------------------
-class UnoListBoxControl : public UnoControlBase,
- public ::com::sun::star::awt::XListBox,
- public ::com::sun::star::awt::XItemListener,
- public ::com::sun::star::awt::XLayoutConstrains,
- public ::com::sun::star::awt::XTextLayoutConstrains
+typedef ::cppu::AggImplInheritanceHelper5 < UnoControlBase
+ , ::com::sun::star::awt::XListBox
+ , ::com::sun::star::awt::XItemListener
+ , ::com::sun::star::awt::XLayoutConstrains
+ , ::com::sun::star::awt::XTextLayoutConstrains
+ , ::com::sun::star::awt::XItemListListener
+ > UnoListBoxControl_Base;
+class UnoListBoxControl : public UnoListBoxControl_Base
{
-private:
- ActionListenerMultiplexer maActionListeners;
- ItemListenerMultiplexer maItemListeners;
-
public:
-
UnoListBoxControl();
::rtl::OUString GetComponentServiceName();
- void ImplUpdateSelectedItemsProperty();
- void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
-
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
- ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
- void SAL_CALL release() throw() { OWeakAggObject::release(); }
void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
- // ::com::sun::star::lang::XTypeProvider
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-
// ::com::sun::star::awt::XListBox
void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
@@ -851,9 +902,27 @@ public:
::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException);
+ // XUnoControl
+ sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XItemListListener
+ virtual void SAL_CALL listItemInserted( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemRemoved( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemModified( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL allItemsRemoved( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+
// ::com::sun::star::lang::XServiceInfo
DECLIMPL_SERVICEINFO_DERIVED( UnoListBoxControl, UnoControlBase, szServiceName2_UnoControlListBox )
+protected:
+ void ImplUpdateSelectedItemsProperty();
+ virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+ virtual void updateFromModel();
+
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
};
// ----------------------------------------------------
diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
index d5f484145316..f8a1a703799c 100644
--- a/toolkit/inc/toolkit/helper/property.hxx
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -199,7 +199,9 @@ namespace rtl {
#define BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND 148
#define BASEPROPERTY_GRID_HEADER_BACKGROUND 149
#define BASEPROPERTY_GRID_LINE_COLOR 150
-#define BASEPROPERTY_GRID_ROW_BACKGROUND 151
+#define BASEPROPERTY_GRID_ROW_BACKGROUND 151
+#define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152
+#define BASEPROPERTY_ITEM_SEPARATOR_POS 153
// Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx
index 70f18f91fb09..96d9d5810cc0 100644
--- a/toolkit/inc/toolkit/helper/servicenames.hxx
+++ b/toolkit/inc/toolkit/helper/servicenames.hxx
@@ -98,8 +98,10 @@ extern const sal_Char __FAR_DATA szServiceName_DefaultGridDataModel[];
extern const sal_Char __FAR_DATA szServiceName_DefaultGridColumnModel[];
extern const sal_Char __FAR_DATA szServiceName_GridColumn[];
-extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName_UnoSimpleAnimationControlModel[];
-extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName_UnoThrobberControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName2_UnoSimpleAnimationControl[];
+extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[], szServiceName2_UnoSimpleAnimationControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName2_UnoThrobberControl[];
+extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[], szServiceName2_UnoThrobberControlModel[];
extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[];
// ExtUnoWrapper:
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index 1992a8d721a6..5e44df58318e 100644
--- a/toolkit/source/awt/vclxmenu.cxx
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -37,11 +37,13 @@
#include <cppuhelper/typeprovider.hxx>
#include <rtl/memory.h>
#include <rtl/uuid.h>
+#include <vos/mutex.hxx>
#include <vcl/menu.hxx>
#include <vcl/keycod.hxx>
#include <vcl/image.hxx>
#include <vcl/mnemonic.hxx>
+#include <vcl/svapp.hxx>
#include <com/sun/star/awt/KeyModifier.hpp>
@@ -416,6 +418,7 @@ void VCLXMenu::removeMenuListener( const ::com::sun::star::uno::Reference< ::com
void VCLXMenu::insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -424,6 +427,7 @@ void VCLXMenu::insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_
void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
sal_Int32 nItemCount = (sal_Int32)mpMenu->GetItemCount();
@@ -438,6 +442,7 @@ void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::
sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mpMenu ? mpMenu->GetItemCount() : 0;
@@ -445,6 +450,7 @@ sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeExcepti
sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mpMenu ? mpMenu->GetItemId( nPos ) : 0;
@@ -452,6 +458,7 @@ sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::Run
sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mpMenu ? mpMenu->GetItemPos( nId ) : 0;
@@ -459,6 +466,7 @@ sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::Run
void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -467,6 +475,7 @@ void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::su
sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mpMenu ? mpMenu->IsItemEnabled( nItemId ) : sal_False;
@@ -474,6 +483,7 @@ sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::un
void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -482,6 +492,7 @@ void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) th
::rtl::OUString VCLXMenu::getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::rtl::OUString aItemText;
@@ -492,6 +503,7 @@ void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) th
void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& rxPopupMenu ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
VCLXMenu* pVCLMenu = VCLXMenu::GetImplementation( rxPopupMenu );
@@ -510,6 +522,7 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref
::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > VCLXMenu::getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > aRef;
@@ -533,6 +546,7 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref
// ::com::sun::star::awt::XPopupMenu
void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -541,6 +555,7 @@ void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::Ru
void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -549,6 +564,7 @@ void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::
sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mpMenu ? mpMenu->GetDefaultItem() : 0;
@@ -556,6 +572,7 @@ sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeExcep
void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -564,6 +581,7 @@ void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun:
sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mpMenu ? mpMenu->IsItemChecked( nItemId ) : sal_False;
@@ -571,6 +589,7 @@ sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::un
sal_Int16 VCLXMenu::execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxWindowPeer, const ::com::sun::star::awt::Rectangle& rArea, sal_Int16 nFlags ) throw(::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
sal_Int16 nRet = 0;
@@ -582,6 +601,7 @@ sal_Int16 VCLXMenu::execute( const ::com::sun::star::uno::Reference< ::com::sun:
void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -590,6 +610,7 @@ void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aC
::rtl::OUString SAL_CALL VCLXMenu::getCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::rtl::OUString aItemCommand;
@@ -600,6 +621,7 @@ void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aC
void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString& aHelp ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -608,6 +630,7 @@ void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString
::rtl::OUString SAL_CALL VCLXMenu::getHelpCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::rtl::OUString aHelpCommand;
@@ -708,12 +731,14 @@ namespace
::sal_Bool SAL_CALL VCLXMenu::isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return IsPopupMenu();
}
void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
mpMenu->Clear();
@@ -724,6 +749,7 @@ void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::awt::MenuItemType aMenuItemType =
@@ -740,6 +766,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
void SAL_CALL VCLXMenu::hideDisabledEntries( ::sal_Bool bHide )
throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
{
@@ -761,6 +788,7 @@ throw (::com::sun::star::uno::RuntimeException)
::sal_Bool SAL_CALL VCLXMenu::isInExecute( )
throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -773,6 +801,7 @@ throw (::com::sun::star::uno::RuntimeException)
void SAL_CALL VCLXMenu::endExecute()
throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -783,6 +812,7 @@ throw (::com::sun::star::uno::RuntimeException)
void SAL_CALL VCLXMenu::setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo )
throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
@@ -807,6 +837,7 @@ throw (::com::sun::star::uno::RuntimeException)
::com::sun::star::awt::MenuLogo SAL_CALL VCLXMenu::getLogo( )
throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::awt::MenuLogo aAWTMenuLogo;
@@ -827,6 +858,7 @@ throw (::com::sun::star::uno::RuntimeException)
void SAL_CALL VCLXMenu::enableAutoMnemonics( ::sal_Bool bEnable )
throw (::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu )
{
@@ -843,6 +875,7 @@ void SAL_CALL VCLXMenu::setAcceleratorKeyEvent( ::sal_Int16 nItemId,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -858,6 +891,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::awt::KeyEvent aKeyEvent;
@@ -876,6 +910,7 @@ void SAL_CALL VCLXMenu::setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString&
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -890,6 +925,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
rtl::OUString sHelpText;
@@ -907,6 +943,7 @@ void SAL_CALL VCLXMenu::setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUStri
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -921,6 +958,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
rtl::OUString sTipHelpText;
@@ -939,6 +977,7 @@ void SAL_CALL VCLXMenu::setItemImage(
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -954,6 +993,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > rxGraphic;
@@ -973,6 +1013,7 @@ void SAL_CALL VCLXMenu::setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAng
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -987,6 +1028,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::sal_Int32 nItemImageAngle( 0 );
@@ -1003,6 +1045,7 @@ void SAL_CALL VCLXMenu::setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
@@ -1017,6 +1060,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException)
{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
sal_Bool bMirrorMode( sal_False );
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 2eeafa73d2d2..f85e29c21099 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -632,7 +632,15 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
// Wenn die Component einen Parent braucht, dann NULL zurueckgeben,
// spaeter mal ::com::sun::star::uno::Exception...
sal_Bool bException = sal_True;
- if ( ( nType == WINDOW_DIALOG ) || ( nType == WINDOW_MODALDIALOG ) || ( nType == WINDOW_MODELESSDIALOG ) )
+ if ( ( nType == WINDOW_DIALOG )
+ || ( nType == WINDOW_MODALDIALOG )
+ || ( nType == WINDOW_MODELESSDIALOG )
+ || ( nType == WINDOW_MESSBOX )
+ || ( nType == WINDOW_INFOBOX )
+ || ( nType == WINDOW_WARNINGBOX )
+ || ( nType == WINDOW_ERRORBOX )
+ || ( nType == WINDOW_QUERYBOX )
+ )
bException = sal_False;
else if ( ( nType == WINDOW_WINDOW ) ||
( nType == WINDOW_WORKWINDOW ) ||
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 248571819067..dd4d56586b03 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -67,6 +67,8 @@
#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <boost/bind.hpp>
+
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
@@ -109,117 +111,15 @@ namespace
m_rFlag = false;
}
};
-
- //................................................................
- //. MouseEventType
- //................................................................
- enum MouseEventType
- {
- META_FIRST_MOUSE_EVENT = 0,
-
- EVENT_MOUSE_PRESSED = 0,
- EVENT_MOUSE_RELEASED = 1,
- EVENT_MOUSE_ENTERED = 2,
- EVENT_MOUSE_EXITED = 3,
-
- META_LAST_MOUSE_EVENT = 3
- };
-
- //................................................................
- //. PlainEventType
- //................................................................
- enum PlainEventType
- {
- META_FIRST_PLAIN_EVENT = 4,
-
- EVENT_WINDOW_ENABLED = 4,
- EVENT_WINDOW_DISABLED = 5,
-
- META_LAST_PLAIN_EVENT = 5
- };
-
-#if OSL_DEBUG_LEVEL > 0
- static void checkEventDefinitions()
- {
- OSL_ENSURE( (int)META_LAST_MOUSE_EVENT < (int)META_FIRST_PLAIN_EVENT, "checkEventDefinitions: invalid event definitions!" );
- }
- #define DBG_CHECK_EVENTS() checkEventDefinitions()
-#else
- #define DBG_CHECK_EVENTS()
-#endif
-
- //................................................................
- //. AnyWindowEvent
- //................................................................
- struct AnyWindowEvent : public ::comphelper::AnyEvent
- {
- private:
- awt::MouseEvent m_aMouseEvent;
- lang::EventObject m_aPlainEvent;
-
- sal_Int32 m_nEventType;
-
- public:
- AnyWindowEvent( const awt::MouseEvent& _rEvent, MouseEventType _nType )
- :comphelper::AnyEvent()
- ,m_aMouseEvent( _rEvent )
- ,m_nEventType( static_cast< sal_Int32 >( _nType ) )
- {
- DBG_CHECK_EVENTS();
- }
-
- AnyWindowEvent( const lang::EventObject& _rEvent, PlainEventType _nType )
- :comphelper::AnyEvent()
- ,m_aPlainEvent( _rEvent )
- ,m_nEventType( static_cast< sal_Int32 >( _nType ) )
- {
- DBG_CHECK_EVENTS();
- }
-
- bool isMouseEvent() const
- {
- return ( META_FIRST_MOUSE_EVENT <= m_nEventType ) && ( m_nEventType <= META_LAST_MOUSE_EVENT );
- }
-
- bool isPlainEvent() const
- {
- return ( META_FIRST_PLAIN_EVENT <= m_nEventType ) && ( m_nEventType <= META_LAST_PLAIN_EVENT );
- }
-
- const awt::MouseEvent& getMouseEvent() const
- {
- OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEvent: no mouse event!" );
- return m_aMouseEvent;
- }
-
- MouseEventType getMouseEventType() const
- {
- OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEventType: no mouse event!" );
- return static_cast< MouseEventType >( m_nEventType );
- }
-
- const lang::EventObject& getPlainEvent() const
- {
- OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEvent: no plain event!" );
- return m_aPlainEvent;
- }
-
- PlainEventType getPlainEventType() const
- {
- OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEventType: no mouse event!" );
- return static_cast< PlainEventType >( m_nEventType );
- }
- };
}
//====================================================================
//= VCLXWindowImpl
//====================================================================
-class SAL_DLLPRIVATE VCLXWindowImpl : public ::comphelper::IEventProcessor
+class SAL_DLLPRIVATE VCLXWindowImpl
{
private:
- typedef ::std::vector< ::rtl::Reference< ::comphelper::AnyEvent > >
- EventArray;
+ typedef ::std::vector< VCLXWindow::Callback > CallbackArray;
private:
VCLXWindow& mrAntiImpl;
@@ -243,8 +143,8 @@ private:
VclContainerListenerMultiplexer maContainerListeners;
TopWindowListenerMultiplexer maTopWindowListeners;
- EventArray maEvents;
- ULONG mnEventId;
+ CallbackArray maCallbackEvents;
+ ULONG mnCallbackEventId;
public:
bool mbDisposing : 1;
@@ -285,13 +185,9 @@ public:
void setDirectVisible( sal_Bool bDirectVisible ) { mbDirectVisible = bDirectVisible; }
sal_Bool isDirectVisible() { return mbDirectVisible; }
- /** asynchronously notifies a mouse event to the VCLXWindow's XMouseListeners
- */
- void notifyMouseEvent( const awt::MouseEvent& _rMouseEvent, MouseEventType _nType );
-
- /** asynchronously notifies an event described by an EventObject to the respective listeners
+ /** impl-version of VCLXWindow::ImplExecuteAsyncWithoutSolarLock
*/
- void notifyPlainEvent( const lang::EventObject& _rPlainEvent, PlainEventType _nType );
+ void callBackAsync( const VCLXWindow::Callback& i_callback );
/** notifies the object that its VCLXWindow is being disposed
*/
@@ -322,21 +218,10 @@ protected:
virtual void SAL_CALL acquire();
virtual void SAL_CALL release();
- // IEventProcessor
- virtual void processEvent( const ::comphelper::AnyEvent& _rEvent );
-
private:
- DECL_LINK( OnProcessEvent, void* );
+ DECL_LINK( OnProcessCallbacks, void* );
private:
- /** notifies an arbitrary event
- @param _rEvent
- the event to notify
- */
- void impl_notifyAnyEvent(
- const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent
- );
-
private:
/** determines whether the instance is already disposed
@precond
@@ -373,7 +258,7 @@ VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex,
,maPaintListeners( _rAntiImpl )
,maContainerListeners( _rAntiImpl )
,maTopWindowListeners( _rAntiImpl )
- ,mnEventId( 0 )
+ ,mnCallbackEventId( 0 )
,mbDisposing( false )
,mbDesignMode( false )
,mbSynthesizingVCLEvent( false )
@@ -394,9 +279,10 @@ VCLXWindowImpl::~VCLXWindowImpl()
void VCLXWindowImpl::disposing()
{
::vos::OGuard aGuard( mrMutex );
- if ( mnEventId )
- Application::RemoveUserEvent( mnEventId );
- mnEventId = 0;
+ if ( mnCallbackEventId )
+ Application::RemoveUserEvent( mnCallbackEventId );
+ mnCallbackEventId = 0;
+
mbDisposed= true;
::com::sun::star::lang::EventObject aEvent;
@@ -415,54 +301,48 @@ void VCLXWindowImpl::disposing()
}
//--------------------------------------------------------------------
-void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent )
+void VCLXWindowImpl::callBackAsync( const VCLXWindow::Callback& i_callback )
{
- maEvents.push_back( _rEvent );
- if ( !mnEventId )
- mnEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessEvent ) );
-}
-
-//--------------------------------------------------------------------
-void VCLXWindowImpl::notifyMouseEvent( const awt::MouseEvent& _rMouseEvent, MouseEventType _nType )
-{
- ::vos::OClearableGuard aGuard( mrMutex );
- if ( maMouseListeners.getLength() )
- impl_notifyAnyEvent( new AnyWindowEvent( _rMouseEvent, _nType ) );
+ DBG_TESTSOLARMUTEX();
+ maCallbackEvents.push_back( i_callback );
+ if ( !mnCallbackEventId )
+ {
+ // ensure our VCLXWindow is not destroyed while the event is underway
+ mrAntiImpl.acquire();
+ mnCallbackEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessCallbacks ) );
+ }
}
-//--------------------------------------------------------------------
-void VCLXWindowImpl::notifyPlainEvent( const lang::EventObject& _rPlainEvent, PlainEventType _nType )
+//----------------------------------------------------------------------------------------------------------------------
+IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG )
{
- ::vos::OClearableGuard aGuard( mrMutex );
- if ( maWindow2Listeners.getLength() )
- impl_notifyAnyEvent( new AnyWindowEvent( _rPlainEvent, _nType ) );
-}
+ const Reference< uno::XInterface > xKeepAlive( mrAntiImpl );
-//--------------------------------------------------------------------
-IMPL_LINK( VCLXWindowImpl, OnProcessEvent, void*, EMPTYARG )
-{
- // work on a copy of the events array
- EventArray aEventsCopy;
+ // work on a copy of the callback array
+ CallbackArray aCallbacksCopy;
{
::vos::OGuard aGuard( mrMutex );
- aEventsCopy = maEvents;
- maEvents.clear();
+ aCallbacksCopy = maCallbackEvents;
+ maCallbackEvents.clear();
- if ( !mnEventId )
+ // we acquired our VCLXWindow once before posting the event, release this one ref now
+ mrAntiImpl.release();
+
+ if ( !mnCallbackEventId )
// we were disposed while waiting for the mutex to lock
return 1L;
- mnEventId = 0;
+ mnCallbackEventId = 0;
}
{
::toolkit::ReleaseSolarMutex aReleaseSolar;
- for ( EventArray::const_iterator loop = aEventsCopy.begin();
- loop != aEventsCopy.end();
+ for ( CallbackArray::const_iterator loop = aCallbacksCopy.begin();
+ loop != aCallbacksCopy.end();
++loop
)
{
- processEvent( *(*loop) );
+ (*loop)();
}
}
@@ -470,59 +350,6 @@ IMPL_LINK( VCLXWindowImpl, OnProcessEvent, void*, EMPTYARG )
}
//--------------------------------------------------------------------
-void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent )
-{
- ::vos::OGuard aGuard( mrMutex );
- if ( impl_isDisposed() )
- // while we were waiting for our mutex, another thread disposed us
- return;
-
- const AnyWindowEvent& rEventDescriptor( static_cast< const AnyWindowEvent& >( _rEvent ) );
- if ( rEventDescriptor.isMouseEvent() )
- {
- const awt::MouseEvent& rEvent( rEventDescriptor.getMouseEvent() );
- switch ( rEventDescriptor.getMouseEventType() )
- {
- case EVENT_MOUSE_PRESSED:
- maMouseListeners.mousePressed( rEvent );
- break;
- case EVENT_MOUSE_RELEASED:
- maMouseListeners.mouseReleased( rEvent );
- break;
- case EVENT_MOUSE_ENTERED:
- maMouseListeners.mouseEntered( rEvent );
- break;
- case EVENT_MOUSE_EXITED:
- maMouseListeners.mouseExited( rEvent );
- break;
- default:
- DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (1)?" );
- break;
- }
- }
- else if ( rEventDescriptor.isPlainEvent() )
- {
- const lang::EventObject& rEvent( rEventDescriptor.getPlainEvent() );
- switch ( rEventDescriptor.getPlainEventType() )
- {
- case EVENT_WINDOW_ENABLED:
- maWindow2Listeners.notifyEach( &XWindowListener2::windowEnabled, rEvent );
- break;
- case EVENT_WINDOW_DISABLED:
- maWindow2Listeners.notifyEach( &XWindowListener2::windowDisabled, rEvent );
- break;
- default:
- DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (2)?" );
- break;
- }
- }
- else
- {
- DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (3)?" );
- }
-}
-
-//--------------------------------------------------------------------
void SAL_CALL VCLXWindowImpl::acquire()
{
mrAntiImpl.acquire();
@@ -581,6 +408,13 @@ VCLXWindow::~VCLXWindow()
}
}
+//----------------------------------------------------------------------------------------------------------------------
+void VCLXWindow::ImplExecuteAsyncWithoutSolarLock( const Callback& i_callback )
+{
+ mpImpl->callBackAsync( i_callback );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
::toolkit::IAccessibleFactory& VCLXWindow::getAccessibleFactory()
{
return mpImpl->getAccessibleFactory().getFactory();
@@ -641,6 +475,28 @@ IMPL_LINK( VCLXWindow, WindowEventListener, VclSimpleEvent*, pEvent )
return 0;
}
+namespace
+{
+ struct CallWindow2Listener
+ {
+ CallWindow2Listener( ::cppu::OInterfaceContainerHelper& i_rWindow2Listeners, const bool i_bEnabled, const EventObject& i_rEvent )
+ :m_rWindow2Listeners( i_rWindow2Listeners )
+ ,m_bEnabled( i_bEnabled )
+ ,m_aEvent( i_rEvent )
+ {
+ }
+
+ void operator()()
+ {
+ m_rWindow2Listeners.notifyEach( m_bEnabled ? &XWindowListener2::windowEnabled : &XWindowListener2::windowDisabled, m_aEvent );
+ }
+
+ ::cppu::OInterfaceContainerHelper& m_rWindow2Listeners;
+ const bool m_bEnabled;
+ const EventObject m_aEvent;
+ };
+}
+
void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
{
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis( (::cppu::OWeakObject*)this );
@@ -650,10 +506,12 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
case VCLEVENT_WINDOW_ENABLED:
case VCLEVENT_WINDOW_DISABLED:
{
- bool bEnabled = ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() );
- EventObject aEvent( *this );
- mpImpl->notifyPlainEvent( aEvent,
- bEnabled ? EVENT_WINDOW_ENABLED : EVENT_WINDOW_DISABLED );
+ Callback aCallback = CallWindow2Listener(
+ mpImpl->getWindow2Listeners(),
+ ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() ),
+ EventObject( *this )
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
break;
@@ -884,7 +742,13 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
MouseEvent aMEvt( aWhere, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 );
awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( aMEvt, *this ) );
aEvent.PopupTrigger = sal_True;
- mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_PRESSED );
+
+ Callback aCallback = ::boost::bind(
+ &MouseListenerMultiplexer::mousePressed,
+ &mpImpl->getMouseListeners(),
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
}
break;
@@ -894,10 +758,13 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
if ( mpImpl->getMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) )
{
awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) );
- mpImpl->notifyMouseEvent(
- aEvent,
- pMouseEvt->IsEnterWindow() ? EVENT_MOUSE_ENTERED : EVENT_MOUSE_EXITED
+
+ Callback aCallback = ::boost::bind(
+ pMouseEvt->IsEnterWindow() ? &MouseListenerMultiplexer::mouseEntered : &MouseListenerMultiplexer::mouseExited,
+ &mpImpl->getMouseListeners(),
+ aEvent
);
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
if ( mpImpl->getMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() )
@@ -916,7 +783,12 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
if ( mpImpl->getMouseListeners().getLength() )
{
awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) );
- mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_PRESSED );
+ Callback aCallback = ::boost::bind(
+ &MouseListenerMultiplexer::mousePressed,
+ &mpImpl->getMouseListeners(),
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
}
break;
@@ -925,7 +797,12 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
if ( mpImpl->getMouseListeners().getLength() )
{
awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) );
- mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_RELEASED );
+ Callback aCallback = ::boost::bind(
+ &MouseListenerMultiplexer::mouseReleased,
+ &mpImpl->getMouseListeners(),
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
}
break;
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index e2fc78421d5e..26e84905ee01 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -29,7 +29,7 @@
#include "precompiled_toolkit.hxx"
#include <toolkit/awt/vclxwindows.hxx>
#include <com/sun/star/awt/ScrollBarOrientation.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <toolkit/helper/vclunohelper.hxx>
#include <toolkit/helper/macros.hxx>
#include <toolkit/helper/property.hxx>
@@ -43,6 +43,9 @@
#include <com/sun/star/system/XSystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/awt/ImageScaleMode.hpp>
+#include <com/sun/star/awt/XItemList.hpp>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/processfactory.hxx>
#ifndef _SV_BUTTON_HXX
@@ -58,12 +61,20 @@
#include <vcl/scrbar.hxx>
#include <vcl/svapp.hxx>
#include <vcl/tabpage.hxx>
-#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::lang::EventObject;
+using ::com::sun::star::awt::ItemListEvent;
+using ::com::sun::star::awt::XItemList;
using ::com::sun::star::graphic::XGraphic;
+using ::com::sun::star::graphic::XGraphicProvider;
using namespace ::com::sun::star;
using namespace ::com::sun::star::awt::VisualEffect;
@@ -626,7 +637,13 @@ void VCLXButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
::com::sun::star::awt::ActionEvent aEvent;
aEvent.Source = (::cppu::OWeakObject*)this;
aEvent.ActionCommand = maActionCommand;
- maActionListeners.actionPerformed( aEvent );
+
+ Callback aCallback = ::boost::bind(
+ &ActionListenerMultiplexer::actionPerformed,
+ &maActionListeners,
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
}
}
break;
@@ -1529,6 +1546,8 @@ void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_HELPURL,
BASEPROPERTY_LINECOUNT,
BASEPROPERTY_MULTISELECTION,
+ BASEPROPERTY_MULTISELECTION_SIMPLEMODE,
+ BASEPROPERTY_ITEM_SEPARATOR_POS,
BASEPROPERTY_PRINTABLE,
BASEPROPERTY_SELECTEDITEMS,
BASEPROPERTY_STRINGITEMLIST,
@@ -1550,22 +1569,6 @@ VCLXListBox::VCLXListBox()
{
}
-// ::com::sun::star::uno::XInterface
-::com::sun::star::uno::Any VCLXListBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::XListBox*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) );
- return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
-}
-
-// ::com::sun::star::lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( VCLXListBox )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XListBox>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
- VCLXWindow::getTypes()
-IMPL_XTYPEPROVIDER_END
-
void VCLXListBox::dispose() throw(::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
@@ -1914,6 +1917,13 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com:
sal_uInt16 nPropType = GetPropertyId( PropertyName );
switch ( nPropType )
{
+ case BASEPROPERTY_ITEM_SEPARATOR_POS:
+ {
+ sal_Int16 nSeparatorPos(0);
+ if ( Value >>= nSeparatorPos )
+ pListBox->SetSeparatorPos( nSeparatorPos );
+ }
+ break;
case BASEPROPERTY_READONLY:
{
sal_Bool b = sal_Bool();
@@ -1928,6 +1938,9 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com:
pListBox->EnableMultiSelection( b );
}
break;
+ case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
+ ::toolkit::adjustBooleanWindowStyle( Value, pListBox, WB_SIMPLEMODE, sal_False );
+ break;
case BASEPROPERTY_LINECOUNT:
{
sal_Int16 n = sal_Int16();
@@ -1982,6 +1995,9 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com:
sal_uInt16 nPropType = GetPropertyId( PropertyName );
switch ( nPropType )
{
+ case BASEPROPERTY_ITEM_SEPARATOR_POS:
+ aProp <<= sal_Int16( pListBox->GetSeparatorPos() );
+ break;
case BASEPROPERTY_READONLY:
{
aProp <<= (sal_Bool) pListBox->IsReadOnly();
@@ -1992,6 +2008,11 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com:
aProp <<= (sal_Bool) pListBox->IsMultiSelectionEnabled();
}
break;
+ case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
+ {
+ aProp <<= (sal_Bool)( ( pListBox->GetStyle() & WB_SIMPLEMODE ) == 0 );
+ }
+ break;
case BASEPROPERTY_LINECOUNT:
{
aProp <<= (sal_Int16) pListBox->GetDropDownLineCount();
@@ -2096,6 +2117,114 @@ void VCLXListBox::ImplCallItemListeners()
}
}
+namespace
+{
+ Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL )
+ {
+ if ( !i_rImageURL.getLength() )
+ return Image();
+
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XGraphicProvider > xProvider;
+ if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ {
+ ::comphelper::NamedValueCollection aMediaProperties;
+ aMediaProperties.put( "URL", i_rImageURL );
+ Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
+ return Image( xGraphic );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return Image();
+ }
+}
+
+void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemInserted: no ListBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pListBox->GetEntryCount() ) ),
+ "VCLXListBox::listItemInserted: illegal (inconsistent) item position!" );
+ pListBox->InsertEntry(
+ i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
+ i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
+ i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXListBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemRemoved: no ListBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
+ "VCLXListBox::listItemRemoved: illegal (inconsistent) item position!" );
+
+ pListBox->RemoveEntry( i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXListBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
+ "VCLXListBox::listItemModified: illegal (inconsistent) item position!" );
+
+ // VCL's ListBox does not support changing an entry's text or image, so remove and re-insert
+
+ const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pListBox->GetEntry( i_rEvent.ItemPosition ) );
+ const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition ) );
+
+ pListBox->RemoveEntry( i_rEvent.ItemPosition );
+ pListBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXListBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
+
+ pListBox->Clear();
+
+ (void)i_rEvent;
+}
+
+void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
+
+ pListBox->Clear();
+
+ Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
+ uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems();
+ for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
+ {
+ pListBox->InsertEntry( aItems[i].First, lcl_getImageFromURL( aItems[i].Second ) );
+ }
+}
+
+void SAL_CALL VCLXListBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ // just disambiguate
+ VCLXWindow::disposing( i_rEvent );
+}
// ----------------------------------------------------
// class VCLXMessageBox
@@ -2205,16 +2334,36 @@ VCLXDialog::~VCLXDialog()
::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
{
::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XDialog2*, this ),
SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) );
return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
}
// ::com::sun::star::lang::XTypeProvider
IMPL_XTYPEPROVIDER_START( VCLXDialog )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog2>* ) NULL ),
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
VCLXTopWindow::getTypes()
IMPL_XTYPEPROVIDER_END
+void SAL_CALL VCLXDialog::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Dialog* pDialog = dynamic_cast< Dialog* >( GetWindow() );
+ if ( pDialog )
+ pDialog->EndDialog( i_result );
+}
+
+void SAL_CALL VCLXDialog::setHelpId( ::sal_Int32 i_id ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetHelpId( i_id );
+}
+
void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
@@ -2261,11 +2410,7 @@ sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException)
void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( GetMutex() );
-
- Dialog* pDlg = (Dialog*) GetWindow();
- if ( pDlg )
- pDlg->EndDialog( 0 );
+ endDialog(0);
}
void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index db9634fb44a1..405356c2b7ac 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -43,6 +43,9 @@
#include "toolkit/controls/tkscrollbar.hxx"
#endif
#include <toolkit/controls/stdtabcontroller.hxx>
+#include <toolkit/controls/tksimpleanimation.hxx>
+#include <toolkit/controls/tkthrobber.hxx>
+
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/WindowAttribute.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
@@ -453,6 +456,10 @@ Reference< XInterface > UnoControlDialogModel::createInstance( const ::rtl::OUSt
pNewModel = new OGeometryControlModel< UnoTreeModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoGridModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoSimpleAnimationControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoSimpleAnimationControlModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoThrobberControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoThrobberControlModel >;
if ( !pNewModel )
{
@@ -492,7 +499,7 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th
static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
if ( !pNamesSeq )
{
- pNamesSeq = new Sequence< ::rtl::OUString >( 21 );
+ pNamesSeq = new Sequence< ::rtl::OUString >( 24 );
::rtl::OUString* pNames = pNamesSeq->getArray();
pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel );
pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel );
@@ -515,8 +522,9 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th
pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel );
pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel );
pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel );
- pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
-
+ pNames[21] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
+ pNames[22] = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel );
+ pNames[23] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControlModel );
}
return *pNamesSeq;
}
@@ -1975,6 +1983,20 @@ void UnoDialogControl::ImplUpdateResourceResolver()
}
}
+void SAL_CALL UnoDialogControl::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
+{
+ Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
+ if ( xPeerDialog.is() )
+ xPeerDialog->endDialog( i_result );
+}
+
+void SAL_CALL UnoDialogControl::setHelpId( ::sal_Int32 i_id ) throw (RuntimeException)
+{
+ Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
+ if ( xPeerDialog.is() )
+ xPeerDialog->setHelpId( i_id );
+}
+
void UnoDialogControl::setTitle( const ::rtl::OUString& Title ) throw(RuntimeException)
{
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
@@ -2081,24 +2103,24 @@ throw (RuntimeException)
::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
{
-
-
- ::rtl::OUString ret;
-
::rtl::OUString baseLocation;
::rtl::OUString url;
rbase >>= baseLocation;
rUrl >>= url;
+ ::rtl::OUString absoluteURL( url );
if ( url.getLength() > 0 )
{
INetURLObject urlObj(baseLocation);
urlObj.removeSegment();
baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
- ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
+
+ ::rtl::OUString testAbsoluteURL;
+ if ( ::osl::FileBase::E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) )
+ absoluteURL = testAbsoluteURL;
}
- return ret;
+ return absoluteURL;
}
diff --git a/toolkit/source/controls/tksimpleanimation.cxx b/toolkit/source/controls/tksimpleanimation.cxx
index 9c32ba500407..3d89bf59af82 100644
--- a/toolkit/source/controls/tksimpleanimation.cxx
+++ b/toolkit/source/controls/tksimpleanimation.cxx
@@ -109,8 +109,9 @@ namespace toolkit
throw( uno::RuntimeException )
{
uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 1 );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel );
+ aServices.realloc( aServices.getLength() + 2 );
+ aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel );
return aServices;
}
diff --git a/toolkit/source/controls/tkthrobber.cxx b/toolkit/source/controls/tkthrobber.cxx
index 978d3183fe23..1dc83f860e34 100644
--- a/toolkit/source/controls/tkthrobber.cxx
+++ b/toolkit/source/controls/tkthrobber.cxx
@@ -46,8 +46,13 @@ namespace toolkit
//--------------------------------------------------------------------
UnoThrobberControlModel::UnoThrobberControlModel()
{
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
}
//--------------------------------------------------------------------
@@ -63,6 +68,8 @@ namespace toolkit
{
case BASEPROPERTY_DEFAULTCONTROL:
return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl ) );
+ case BASEPROPERTY_BORDER:
+ return uno::makeAny( (sal_Int16) 0 );
default:
return UnoControlModel::ImplGetDefaultValue( nPropId );
}
@@ -100,8 +107,9 @@ namespace toolkit
throw( uno::RuntimeException )
{
uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 1 );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
+ aServices.realloc( aServices.getLength() + 2 );
+ aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControlModel );
return aServices;
}
@@ -151,8 +159,9 @@ namespace toolkit
throw( uno::RuntimeException )
{
uno::Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 1 );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl );
+ aServices.realloc( aServices.getLength() + 2 );
+ aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControl );
return aServices;
}
diff --git a/toolkit/source/controls/tree/treecontrol.cxx b/toolkit/source/controls/tree/treecontrol.cxx
index 5655e4e10abc..8606792fdf2f 100644
--- a/toolkit/source/controls/tree/treecontrol.cxx
+++ b/toolkit/source/controls/tree/treecontrol.cxx
@@ -67,6 +67,7 @@ UnoTreeModel::UnoTreeModel()
ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
ImplRegisterProperty( BASEPROPERTY_HELPURL );
ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
ImplRegisterProperty( BASEPROPERTY_TREE_SELECTIONTYPE );
ImplRegisterProperty( BASEPROPERTY_TREE_EDITABLE );
ImplRegisterProperty( BASEPROPERTY_TREE_DATAMODEL );
@@ -361,6 +362,13 @@ Reference< XTreeNode > SAL_CALL UnoTreeControl::getClosestNodeForLocation( sal_I
// -------------------------------------------------------------------
+awt::Rectangle SAL_CALL UnoTreeControl::getNodeRect( const Reference< XTreeNode >& Node ) throw (IllegalArgumentException, RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getNodeRect( Node );
+}
+
+// -------------------------------------------------------------------
+
sal_Bool SAL_CALL UnoTreeControl::isEditing( ) throw (RuntimeException)
{
return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isEditing();
diff --git a/toolkit/source/controls/tree/treecontrol.hxx b/toolkit/source/controls/tree/treecontrol.hxx
index 0cae86616aa4..e646664c4a64 100644
--- a/toolkit/source/controls/tree/treecontrol.hxx
+++ b/toolkit/source/controls/tree/treecontrol.hxx
@@ -114,6 +114,7 @@ public:
virtual void SAL_CALL removeTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getClosestNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getNodeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isEditing( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL stopEditing( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL cancelEditing( ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 1abe0b34004f..d91077823495 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -1535,3 +1535,55 @@ void SAL_CALL UnoControl::removeModeChangeApproveListener( const Reference< XMod
throw NoSupportException( );
}
+//----------------------------------------------------------------------------------------------------------------------
+awt::Point SAL_CALL UnoControl::convertPointToLogic( const awt::Point& i_Point, ::sal_Int16 i_TargetUnit ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XUnitConversion > xPeerConversion;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerConversion = xPeerConversion.query( getPeer() );
+ }
+ if ( xPeerConversion.is() )
+ return xPeerConversion->convertPointToLogic( i_Point, i_TargetUnit );
+ return awt::Point( );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+awt::Point SAL_CALL UnoControl::convertPointToPixel( const awt::Point& i_Point, ::sal_Int16 i_SourceUnit ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XUnitConversion > xPeerConversion;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerConversion = xPeerConversion.query( getPeer() );
+ }
+ if ( xPeerConversion.is() )
+ return xPeerConversion->convertPointToPixel( i_Point, i_SourceUnit );
+ return awt::Point( );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+awt::Size SAL_CALL UnoControl::convertSizeToLogic( const awt::Size& i_Size, ::sal_Int16 i_TargetUnit ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XUnitConversion > xPeerConversion;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerConversion = xPeerConversion.query( getPeer() );
+ }
+ if ( xPeerConversion.is() )
+ return xPeerConversion->convertSizeToLogic( i_Size, i_TargetUnit );
+ return awt::Size( );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+awt::Size SAL_CALL UnoControl::convertSizeToPixel( const awt::Size& i_Size, ::sal_Int16 i_SourceUnit ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XUnitConversion > xPeerConversion;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerConversion = xPeerConversion.query( getPeer() );
+ }
+ if ( xPeerConversion.is() )
+ return xPeerConversion->convertSizeToPixel( i_Size, i_SourceUnit );
+ return awt::Size( );
+}
+
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index 29b683a5ed40..91d202409e86 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -216,10 +216,6 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const
return mpData->Get( nPropId ) ? sal_True : sal_False;
}
-void UnoControlModel::ImplPropertyChanged( sal_uInt16 )
-{
-}
-
::com::sun::star::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
::com::sun::star::uno::Any aDefault;
@@ -267,6 +263,7 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 )
aDefault <<= Reference< awt::XDevice >();
break;
+ case BASEPROPERTY_ITEM_SEPARATOR_POS:
case BASEPROPERTY_VERTICALALIGN:
case BASEPROPERTY_BORDERCOLOR:
case BASEPROPERTY_SYMBOL_COLOR:
@@ -342,6 +339,7 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 )
case BASEPROPERTY_HARDLINEBREAKS:
case BASEPROPERTY_NOLABEL: aDefault <<= (sal_Bool) sal_False; break;
+ case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
case BASEPROPERTY_HIDEINACTIVESELECTION:
case BASEPROPERTY_ENFORCE_FORMAT:
case BASEPROPERTY_AUTOCOMPLETE:
@@ -1259,22 +1257,13 @@ sal_Bool UnoControlModel::convertFastPropertyValue( Any & rConvertedValue, Any &
void UnoControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
// Fehlt: Die gefakten Einzelproperties des FontDescriptors...
ImplControlProperty* pProp = mpData->Get( nPropId );
- if ( pProp )
- {
- DBG_ASSERT( ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID ) || ( GetPropertyAttribs( (sal_uInt16)nPropId ) & ::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), "Property darf nicht VOID sein!" );
- ImplPropertyChanged( (sal_uInt16)nPropId );
- pProp->SetValue( rValue );
- }
- else
- {
- // exception...
- DBG_ERROR( "SetPropertyValues: Invalid Property!" );
- }
+ ENSURE_OR_RETURN_VOID( pProp, "UnoControlModel::setFastPropertyValue_NoBroadcast: invalid property id!" );
+
+ DBG_ASSERT( ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID ) || ( GetPropertyAttribs( (sal_uInt16)nPropId ) & ::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), "Property darf nicht VOID sein!" );
+ pProp->SetValue( rValue );
}
void UnoControlModel::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nPropId ) const
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index ae9e59d045e7..cfb71111e3dc 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -73,8 +73,11 @@
#include <tools/time.hxx>
#include <algorithm>
+#include <functional>
using namespace ::com::sun::star;
+using ::com::sun::star::graphic::XGraphic;
+using ::com::sun::star::uno::Reference;
using namespace ::toolkit;
@@ -1841,19 +1844,130 @@ sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException)
return sal_True;
}
-// ----------------------------------------------------
-// class UnoControlListBoxModel
-// ----------------------------------------------------
+// =====================================================================================================================
+// = UnoControlListBoxModel_Data
+// =====================================================================================================================
+struct ListItem
+{
+ ::rtl::OUString ItemText;
+ ::rtl::OUString ItemImageURL;
+ Any ItemData;
+
+ ListItem()
+ :ItemText()
+ ,ItemImageURL()
+ ,ItemData()
+ {
+ }
+
+ ListItem( const ::rtl::OUString& i_rItemText )
+ :ItemText( i_rItemText )
+ ,ItemImageURL()
+ ,ItemData()
+ {
+ }
+};
+
+typedef beans::Pair< ::rtl::OUString, ::rtl::OUString > UnoListItem;
+
+struct StripItemData : public ::std::unary_function< ListItem, UnoListItem >
+{
+ UnoListItem operator()( const ListItem& i_rItem )
+ {
+ return UnoListItem( i_rItem.ItemText, i_rItem.ItemImageURL );
+ }
+};
+
+struct UnoControlListBoxModel_Data
+{
+ UnoControlListBoxModel_Data( UnoControlListBoxModel& i_rAntiImpl )
+ :m_bSettingLegacyProperty( false )
+ ,m_rAntiImpl( i_rAntiImpl )
+ ,m_aListItems()
+ {
+ }
+
+ sal_Int32 getItemCount() const { return sal_Int32( m_aListItems.size() ); }
+
+ const ListItem& getItem( const sal_Int32 i_nIndex ) const
+ {
+ if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
+ return m_aListItems[ i_nIndex ];
+ }
+
+ ListItem& getItem( const sal_Int32 i_nIndex )
+ {
+ return const_cast< ListItem& >( static_cast< const UnoControlListBoxModel_Data* >( this )->getItem( i_nIndex ) );
+ }
+
+ ListItem& insertItem( const sal_Int32 i_nIndex )
+ {
+ if ( ( i_nIndex < 0 ) || ( i_nIndex > sal_Int32( m_aListItems.size() ) ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
+ return *m_aListItems.insert( m_aListItems.begin() + i_nIndex, ListItem() );
+ }
+
+ Sequence< UnoListItem > getAllItems() const
+ {
+ Sequence< UnoListItem > aItems( sal_Int32( m_aListItems.size() ) );
+ ::std::transform( m_aListItems.begin(), m_aListItems.end(), aItems.getArray(), StripItemData() );
+ return aItems;
+ }
+
+ void setAllItems( const ::std::vector< ListItem >& i_rItems )
+ {
+ m_aListItems = i_rItems;
+ }
+
+ void removeItem( const sal_Int32 i_nIndex )
+ {
+ if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
+ m_aListItems.erase( m_aListItems.begin() + i_nIndex );
+ }
+
+ void removeAllItems()
+ {
+ ::std::vector< ListItem > aEmpty;
+ m_aListItems.swap( aEmpty );
+ }
+
+public:
+ bool m_bSettingLegacyProperty;
+
+private:
+ UnoControlListBoxModel& m_rAntiImpl;
+ ::std::vector< ListItem > m_aListItems;
+};
+
+// =====================================================================================================================
+// = UnoControlListBoxModel
+// =====================================================================================================================
+// ---------------------------------------------------------------------------------------------------------------------
UnoControlListBoxModel::UnoControlListBoxModel()
+ :UnoControlListBoxModel_Base()
+ ,m_pData( new UnoControlListBoxModel_Data( *this ) )
+ ,m_aItemListListeners( GetMutex() )
{
UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXListBox );
}
+// ---------------------------------------------------------------------------------------------------------------------
+UnoControlListBoxModel::UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource )
+ :UnoControlListBoxModel_Base( i_rSource )
+ ,m_pData( new UnoControlListBoxModel_Data( *this ) )
+ ,m_aItemListListeners( GetMutex() )
+{
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
::rtl::OUString UnoControlListBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
{
return ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel );
}
+// ---------------------------------------------------------------------------------------------------------------------
uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
@@ -1865,6 +1979,7 @@ uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return UnoControlModel::ImplGetDefaultValue( nPropId );
}
+// ---------------------------------------------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper& UnoControlListBoxModel::getInfoHelper()
{
static UnoPropertyArrayHelper* pHelper = NULL;
@@ -1876,6 +1991,7 @@ uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return *pHelper;
}
+// ---------------------------------------------------------------------------------------------------------------------
// beans::XMultiPropertySet
uno::Reference< beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException)
{
@@ -1883,19 +1999,61 @@ uno::Reference< beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySet
return xInfo;
}
-void UnoControlListBoxModel::ImplPropertyChanged( sal_uInt16 nPropId )
+// ---------------------------------------------------------------------------------------------------------------------
+namespace
+{
+ struct CreateListItem : public ::std::unary_function< ::rtl::OUString, ListItem >
+ {
+ ListItem operator()( const ::rtl::OUString& i_rItemText )
+ {
+ return ListItem( i_rItemText );
+ }
+ };
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) throw (uno::Exception)
{
- if ( nPropId == BASEPROPERTY_STRINGITEMLIST )
+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+
+ if ( nHandle == BASEPROPERTY_STRINGITEMLIST )
{
+ // reset selection
uno::Sequence<sal_Int16> aSeq;
uno::Any aAny;
aAny <<= aSeq;
setPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny );
- }
- UnoControlModel::ImplPropertyChanged( nPropId );
+ if ( !m_pData->m_bSettingLegacyProperty )
+ {
+ // synchronize the legacy StringItemList property with our list items
+ Sequence< ::rtl::OUString > aStringItemList;
+ Any aPropValue;
+ getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
+ OSL_VERIFY( aPropValue >>= aStringItemList );
+
+ ::std::vector< ListItem > aItems( aStringItemList.getLength() );
+ ::std::transform(
+ aStringItemList.getConstArray(),
+ aStringItemList.getConstArray() + aStringItemList.getLength(),
+ aItems.begin(),
+ CreateListItem()
+ );
+ m_pData->setAllItems( aItems );
+
+ // since an XItemListListener does not have a "all items modified" or some such method,
+ // we simulate this by notifying removal of all items, followed by insertion of all new
+ // items
+ lang::EventObject aEvent;
+ aEvent.Source = *this;
+ m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
+ // TODO: OPropertySetHelper calls into this method with the mutex locked ...
+ // which is wrong for the above notifications ...
+ }
+ }
}
+// ---------------------------------------------------------------------------------------------------------------------
void UnoControlListBoxModel::ImplNormalizePropertySequence( const sal_Int32 _nCount, sal_Int32* _pHandles,
uno::Any* _pValues, sal_Int32* _pValidHandles ) const SAL_THROW(())
{
@@ -1906,12 +2064,327 @@ void UnoControlListBoxModel::ImplNormalizePropertySequence( const sal_Int32 _nCo
UnoControlModel::ImplNormalizePropertySequence( _nCount, _pHandles, _pValues, _pValidHandles );
}
+// ---------------------------------------------------------------------------------------------------------------------
+::sal_Int32 SAL_CALL UnoControlListBoxModel::getItemCount() throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ return m_pData->getItemCount();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::insertItem( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->insertItem( i_nPosition ) );
+ rItem.ItemText = i_rItemText;
+ rItem.ItemImageURL = i_rItemImageURL;
+
+ impl_handleInsert( i_nPosition, i_rItemText, i_rItemImageURL, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::insertItemText( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->insertItem( i_nPosition ) );
+ rItem.ItemText = i_rItemText;
+
+ impl_handleInsert( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::insertItemImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->insertItem( i_nPosition ) );
+ rItem.ItemImageURL = i_rItemImageURL;
+
+ impl_handleInsert( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::removeItem( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ m_pData->removeItem( i_nPosition );
+
+ impl_handleRemove( i_nPosition, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::removeAllItems( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ m_pData->removeAllItems();
+
+ impl_handleRemove( -1, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setItemText( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ rItem.ItemText = i_rItemText;
+
+ impl_handleModify( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setItemImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ rItem.ItemImageURL = i_rItemImageURL;
+
+ impl_handleModify( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setItemTextAndImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ rItem.ItemText = i_rItemText;
+ rItem.ItemImageURL = i_rItemImageURL;
+
+ impl_handleModify( i_nPosition, i_rItemText, i_rItemImageURL, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setItemData( ::sal_Int32 i_nPosition, const Any& i_rDataValue ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ rItem.ItemData = i_rDataValue;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemText( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ const ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ return rItem.ItemText;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ const ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ return rItem.ItemImageURL;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL UnoControlListBoxModel::getItemTextAndImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ const ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ return beans::Pair< ::rtl::OUString, ::rtl::OUString >( rItem.ItemText, rItem.ItemImageURL );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+Any SAL_CALL UnoControlListBoxModel::getItemData( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ const ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ return rItem.ItemData;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > SAL_CALL UnoControlListBoxModel::getAllItems( ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ return m_pData->getAllItems();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::addItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException)
+{
+ if ( i_Listener.is() )
+ m_aItemListListeners.addInterface( i_Listener );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::removeItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException)
+{
+ if ( i_Listener.is() )
+ m_aItemListListeners.removeInterface( i_Listener );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_getStringItemList( ::std::vector< ::rtl::OUString >& o_rStringItems ) const
+{
+ Sequence< ::rtl::OUString > aStringItemList;
+ Any aPropValue;
+ getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
+ OSL_VERIFY( aPropValue >>= aStringItemList );
+
+ o_rStringItems.resize( size_t( aStringItemList.getLength() ) );
+ ::std::copy(
+ aStringItemList.getConstArray(),
+ aStringItemList.getConstArray() + aStringItemList.getLength(),
+ o_rStringItems.begin()
+ );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_setStringItemList_nolck( const ::std::vector< ::rtl::OUString >& i_rStringItems )
+{
+ Sequence< ::rtl::OUString > aStringItems( i_rStringItems.size() );
+ ::std::copy(
+ i_rStringItems.begin(),
+ i_rStringItems.end(),
+ aStringItems.getArray()
+ );
+ m_pData->m_bSettingLegacyProperty = true;
+ try
+ {
+ setFastPropertyValue( BASEPROPERTY_STRINGITEMLIST, uno::makeAny( aStringItems ) );
+ }
+ catch( const Exception& )
+ {
+ m_pData->m_bSettingLegacyProperty = false;
+ throw;
+ }
+ m_pData->m_bSettingLegacyProperty = false;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_handleInsert( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
+{
+ // SYNCHRONIZED ----->
+ // sync with legacy StringItemList property
+ ::std::vector< ::rtl::OUString > aStringItems;
+ impl_getStringItemList( aStringItems );
+ OSL_ENSURE( size_t( i_nItemPosition ) <= aStringItems.size(), "UnoControlListBoxModel::impl_handleInsert" );
+ if ( size_t( i_nItemPosition ) <= aStringItems.size() )
+ {
+ const ::rtl::OUString sItemText( !!i_rItemText ? *i_rItemText : ::rtl::OUString() );
+ aStringItems.insert( aStringItems.begin() + i_nItemPosition, sItemText );
+ }
+
+ i_rClearBeforeNotify.clear();
+ // <----- SYNCHRONIZED
+ impl_setStringItemList_nolck( aStringItems );
+
+ // notify ItemListListeners
+ impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemInserted );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_handleRemove( const sal_Int32 i_nItemPosition, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
+{
+ // SYNCHRONIZED ----->
+ const bool bAllItems = ( i_nItemPosition < 0 );
+ // sync with legacy StringItemList property
+ ::std::vector< ::rtl::OUString > aStringItems;
+ impl_getStringItemList( aStringItems );
+ if ( !bAllItems )
+ {
+ OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleRemove" );
+ if ( size_t( i_nItemPosition ) < aStringItems.size() )
+ {
+ aStringItems.erase( aStringItems.begin() + i_nItemPosition );
+ }
+ }
+ else
+ {
+ aStringItems.resize(0);
+ }
+
+ i_rClearBeforeNotify.clear();
+ // <----- SYNCHRONIZED
+ impl_setStringItemList_nolck( aStringItems );
+
+ // notify ItemListListeners
+ if ( bAllItems )
+ {
+ EventObject aEvent( *this );
+ m_aItemListListeners.notifyEach( &XItemListListener::allItemsRemoved, aEvent );
+ }
+ else
+ {
+ impl_notifyItemListEvent_nolck( i_nItemPosition, ::boost::optional< ::rtl::OUString >(), ::boost::optional< ::rtl::OUString >(),
+ &XItemListListener::listItemRemoved );
+ }
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_handleModify( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
+{
+ // SYNCHRONIZED ----->
+ if ( !!i_rItemText )
+ {
+ // sync with legacy StringItemList property
+ ::std::vector< ::rtl::OUString > aStringItems;
+ impl_getStringItemList( aStringItems );
+ OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleModify" );
+ if ( size_t( i_nItemPosition ) < aStringItems.size() )
+ {
+ aStringItems[ i_nItemPosition] = *i_rItemText;
+ }
+
+ i_rClearBeforeNotify.clear();
+ // <----- SYNCHRONIZED
+ impl_setStringItemList_nolck( aStringItems );
+ }
+ else
+ {
+ i_rClearBeforeNotify.clear();
+ // <----- SYNCHRONIZED
+ }
+
+ // notify ItemListListeners
+ impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemModified );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_notifyItemListEvent_nolck( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
+ void ( SAL_CALL XItemListListener::*NotificationMethod )( const ItemListEvent& ) )
+{
+ ItemListEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.ItemPosition = i_nItemPosition;
+ if ( !!i_rItemText )
+ {
+ aEvent.ItemText.IsPresent = sal_True;
+ aEvent.ItemText.Value = *i_rItemText;
+ }
+ if ( !!i_rItemImageURL )
+ {
+ aEvent.ItemImageURL.IsPresent = sal_True;
+ aEvent.ItemImageURL.Value = *i_rItemImageURL;
+ }
+
+ m_aItemListListeners.notifyEach( NotificationMethod, aEvent );
+}
+
// ----------------------------------------------------
// class UnoListBoxControl
// ----------------------------------------------------
UnoListBoxControl::UnoListBoxControl()
- : maActionListeners( *this ),
- maItemListeners( *this )
+ :maActionListeners( *this )
+ ,maItemListeners( *this )
{
maComponentInfos.nWidth = 100;
maComponentInfos.nHeight = 12;
@@ -1922,27 +2395,6 @@ UnoListBoxControl::UnoListBoxControl()
return ::rtl::OUString::createFromAscii( "listbox" );
}
-// uno::XInterface
-uno::Any UnoListBoxControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XListBox*, this ),
- SAL_STATIC_CAST( awt::XItemListener*, this ),
- SAL_STATIC_CAST( lang::XEventListener*, SAL_STATIC_CAST( awt::XItemListener*, this ) ),
- SAL_STATIC_CAST( awt::XLayoutConstrains*, this ),
- SAL_STATIC_CAST( awt::XTextLayoutConstrains*, this ) );
- return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoListBoxControl )
- getCppuType( ( uno::Reference< awt::XListBox>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XItemListener>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XLayoutConstrains>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XTextLayoutConstrains>* ) NULL ),
- UnoControlBase::getTypes()
-IMPL_XTYPEPROVIDER_END
-
void UnoListBoxControl::dispose() throw(uno::RuntimeException)
{
lang::EventObject aEvt;
@@ -1966,24 +2418,32 @@ void UnoListBoxControl::ImplUpdateSelectedItemsProperty()
}
}
-void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
+void UnoListBoxControl::updateFromModel()
{
- UnoControl::ImplSetPeerProperty( rPropName, rVal );
+ UnoControlBase::updateFromModel();
- // Wenn die SelectedItems vor der StringItemList gesetzt werden,
- // hat das keine Auswirkung...
+ Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY );
+ ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoListBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
+
+ EventObject aEvent( getModel() );
+ xItemListListener->itemListChanged( aEvent );
+
+ // notify the change of the SelectedItems property, again. While our base class, in updateFromModel,
+ // already did this, our peer(s) can only legitimately set the selection after they have the string
+ // item list, which we just notified with the itemListChanged call.
+ const ::rtl::OUString sSelectedItemsPropName( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ) );
+ ImplSetPeerProperty( sSelectedItemsPropName, ImplGetPropertyValue( sSelectedItemsPropName ) );
+}
+
+void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
+{
if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) )
- {
- ::rtl::OUString aSelPropName = GetPropertyName( BASEPROPERTY_SELECTEDITEMS );
- uno::Any aVal = ImplGetPropertyValue( aSelPropName );
- if ( !( aVal.getValueType().getTypeClass() == uno::TypeClass_VOID ) )
- {
- uno::Reference< awt::XVclWindowPeer > xW( getPeer(), uno::UNO_QUERY );
- if (xW.is())
- // same comment as in UnoControl::ImplSetPeerProperty - see there
- xW->setProperty( aSelPropName, aVal );
- }
- }
+ // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item
+ // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes
+ // will be forwarded to the peer, which will update itself accordingly.
+ return;
+
+ UnoControl::ImplSetPeerProperty( rPropName, rVal );
}
void UnoListBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
@@ -2281,6 +2741,66 @@ void UnoListBoxControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines
Impl_getColumnsAndLines( nCols, nLines );
}
+sal_Bool SAL_CALL UnoListBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ const Reference< XItemList > xOldItems( getModel(), UNO_QUERY );
+ OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoListBoxControl::setModel: illegal old model!" );
+ const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY );
+ OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoListBoxControl::setModel: illegal new model!" );
+
+ if ( !UnoListBoxControl_Base::setModel( i_rModel ) )
+ return sal_False;
+
+ if ( xOldItems.is() )
+ xOldItems->removeItemListListener( this );
+ if ( xNewItems.is() )
+ xNewItems->addItemListListener( this );
+
+ return sal_True;
+}
+
+void SAL_CALL UnoListBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemInserted: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->listItemInserted( i_rEvent );
+}
+
+void SAL_CALL UnoListBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemRemoved: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->listItemRemoved( i_rEvent );
+}
+
+void SAL_CALL UnoListBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemModified: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->listItemModified( i_rEvent );
+}
+
+void SAL_CALL UnoListBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::allItemsRemoved: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->allItemsRemoved( i_rEvent );
+}
+
+void SAL_CALL UnoListBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::itemListChanged: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->itemListChanged( i_rEvent );
+}
+
// ----------------------------------------------------
// class UnoControlComboBoxModel
// ----------------------------------------------------
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index 6711e4503511..9a3dc7b9bfb3 100644
--- a/toolkit/source/helper/property.cxx
+++ b/toolkit/source/helper/property.cxx
@@ -191,6 +191,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_2 ( "ImageAlign", IMAGEALIGN, sal_Int16, BOUND, MAYBEDEFAULT),
DECL_PROP_2 ( "ImagePosition", IMAGEPOSITION, sal_Int16, BOUND, MAYBEDEFAULT),
DECL_PROP_2 ( "ImageURL", IMAGEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "ItemSeparatorPos", ITEM_SEPARATOR_POS, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "Label", LABEL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
DECL_PROP_3 ( "LineColor", LINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "LineCount", LINECOUNT, sal_Int16, BOUND, MAYBEDEFAULT ),
@@ -203,6 +204,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_1 ( "MouseTransparent", MOUSETRANSPARENT, bool, BOUND ),
DECL_PROP_2 ( "MultiLine", MULTILINE, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "MultiSelection", MULTISELECTION, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "MultiSelectionSimpleMode", MULTISELECTION_SIMPLEMODE, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "NativeWidgetLook", NATIVE_WIDGET_LOOK, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "NoLabel", NOLABEL, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "Orientation", ORIENTATION, sal_Int32, BOUND, MAYBEDEFAULT ),
@@ -222,7 +224,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_DEP_PROP_3 ( "ScrollValue", SCROLLVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "ScrollValueMax", SCROLLVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "ScrollValueMin", SCROLLVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "SelectedItems", SELECTEDITEMS, Sequence<sal_Int16>, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_2 ( "SelectedItems", SELECTEDITEMS, Sequence<sal_Int16>, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "ShowThousandsSeparator", NUMSHOWTHOUSANDSEP, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "Sizeable", SIZEABLE, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "Spin", SPIN, bool, BOUND, MAYBEDEFAULT ),
diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
index 7d1dcaeb2762..aedf4024f2b9 100644
--- a/toolkit/source/helper/registerservices.cxx
+++ b/toolkit/source/helper/registerservices.cxx
@@ -284,10 +284,10 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager,
registerServices( xRegistryKey, "TreeControl", szServiceName_TreeControl );
registerServices( xRegistryKey, "TreeControlModel", szServiceName_TreeControlModel );
registerServices( xRegistryKey, "MutableTreeDataModel", szServiceName_MutableTreeDataModel );
- registerServices( xRegistryKey, "UnoSimpleAnimationControlModel", szServiceName_UnoSimpleAnimationControlModel );
- registerServices( xRegistryKey, "UnoSimpleAnimationControl", szServiceName_UnoSimpleAnimationControl );
- registerServices( xRegistryKey, "UnoThrobberControlModel", szServiceName_UnoThrobberControlModel );
- registerServices( xRegistryKey, "UnoThrobberControl", szServiceName_UnoThrobberControl );
+ registerServices( xRegistryKey, "UnoSimpleAnimationControlModel", szServiceName_UnoSimpleAnimationControlModel, szServiceName2_UnoSimpleAnimationControlModel );
+ registerServices( xRegistryKey, "UnoSimpleAnimationControl", szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl );
+ registerServices( xRegistryKey, "UnoThrobberControlModel", szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel );
+ registerServices( xRegistryKey, "UnoThrobberControl", szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl );
registerServices( xRegistryKey, "UnoFixedHyperlinkControl", szServiceName_UnoControlFixedHyperlink );
registerServices( xRegistryKey, "UnoControlFixedHyperlinkModel", szServiceName_UnoControlFixedHyperlinkModel );
registerServices( xRegistryKey, "GridControl", szServiceName_GridControl );
@@ -371,10 +371,10 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL )
CHECKANDCREATEFACTORY( TreeControlModel, szServiceName_TreeControlModel, NULL )
CHECKANDCREATEFACTORY( MutableTreeDataModel, szServiceName_MutableTreeDataModel, NULL )
- CHECKANDCREATEFACTORY( UnoSimpleAnimationControlModel, szServiceName_UnoSimpleAnimationControlModel, NULL )
- CHECKANDCREATEFACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, NULL )
- CHECKANDCREATEFACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, NULL )
- CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, NULL )
+ CHECKANDCREATEFACTORY( UnoSimpleAnimationControlModel, szServiceName_UnoSimpleAnimationControlModel, szServiceName2_UnoSimpleAnimationControlModel )
+ CHECKANDCREATEFACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl )
+ CHECKANDCREATEFACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel )
+ CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl )
CHECKANDCREATEFACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
CHECKANDCREATEFACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
CHECKANDCREATEFACTORY( GridControl, szServiceName_GridControl, NULL );
diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
index 1885387561cb..6a376391f46d 100644
--- a/toolkit/source/helper/servicenames.cxx
+++ b/toolkit/source/helper/servicenames.cxx
@@ -92,10 +92,10 @@ const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt
const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl";
const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel";
-const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoSimpleAnimationControlModel";
-const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoSimpleAnimationControl";
-const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[] = "com.sun.star.awt.UnoThrobberControlModel";
-const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl";
+const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoSimpleAnimationControlModel", szServiceName2_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoControlSimpleAnimationModel";
+const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoSimpleAnimationControl", szServiceName2_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoControlSimpleAnimation";
+const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[] = "com.sun.star.awt.UnoThrobberControlModel", szServiceName2_UnoThrobberControlModel[] = "com.sun.star.awt.UnoControlThrobberModel";
+const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl", szServiceName2_UnoThrobberControl[] = "com.sun.star.awt.UnoControlThrobber";
const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[] = "com.sun.star.awt.UnoControlFixedHyperlink";
const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlinkModel[] = "com.sun.star.awt.UnoControlFixedHyperlinkModel";
const sal_Char __FAR_DATA szServiceName_GridControl[] = "com.sun.star.awt.grid.UnoControlGrid";
diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h
index fac739b32583..b244d11dc305 100644
--- a/tools/inc/tools/diagnose_ex.h
+++ b/tools/inc/tools/diagnose_ex.h
@@ -130,6 +130,17 @@
#define ENSURE_OR_RETURN_FALSE(c, m) \
ENSURE_OR_RETURN(c, m, false)
+/** This macro asserts the given condition (in debug mode), and
+ returns afterwards, without return value "void".
+ */
+#define ENSURE_OR_RETURN_VOID( c, m ) \
+ if( !(c) ) \
+ { \
+ OSL_ENSURE( c, m ); \
+ return; \
+ }
+
+
/** This macro asserts the given condition (in debug mode), and
returns afterwards, without return value "void".
@@ -141,6 +152,24 @@
return; \
}
+/** asserts a given condition (in debug mode), and continues the most-inner
+ loop if the condition is not met
+*/
+#define ENSURE_OR_CONTINUE( c, m ) \
+ if ( !(c) ) \
+ { \
+ OSL_ENSURE( false, m ); \
+ continue; \
+ }
+/** asserts a given condition (in debug mode), and continues the most-inner
+ loop if the condition is not met
+*/
+#define ENSURE_OR_BREAK( c, m ) \
+ if ( !(c) ) \
+ { \
+ OSL_ENSURE( false, m ); \
+ break; \
+ }
#endif // TOOLS_DIAGNOSE_EX_H
diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx
index 85da22126b77..308cc02165ce 100644
--- a/tools/inc/tools/gen.hxx
+++ b/tools/inc/tools/gen.hxx
@@ -420,6 +420,7 @@ public:
Point Center() const;
void Move( long nHorzMove, long nVertMove );
+ inline void Transpose();
inline void SetPos( const Point& rPoint );
void SetSize( const Size& rSize );
inline Size GetSize() const;
@@ -578,6 +579,20 @@ inline void Rectangle::Move( long nHorzMove, long nVertMove )
nBottom += nVertMove;
}
+void Rectangle::Transpose()
+{
+ if ( !IsEmpty() )
+ {
+ long swap( nLeft );
+ nLeft = nTop;
+ nTop = swap;
+
+ swap = nRight;
+ nRight = nBottom;
+ nBottom = swap;
+ }
+}
+
inline void Rectangle::SetPos( const Point& rPoint )
{
if ( nRight != RECT_EMPTY )
diff --git a/tools/inc/tools/preextstl.h b/tools/inc/tools/preextstl.h
index 4d0418d01c57..27aed38686f0 100644
--- a/tools/inc/tools/preextstl.h
+++ b/tools/inc/tools/preextstl.h
@@ -24,8 +24,11 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
+//1. Force inclusion of a std:: using header to ensure the stlport define
+//of std as "stlport"
+#include <algorithm>
#if defined(ADAPT_EXT_STL)
+//2. Force inclusion of stlport headers to get their stlport:: definitions
# include <ostream>
# include <istream>
# include <fstream>
@@ -33,12 +36,14 @@
# include <vector>
# include <list>
# include <map>
-# include <algorithm>
+//3. Now force inclusion of native headers to get their std:: definitions
# if defined(std)
# define std_was_redefined_as_stlport std
# undef std
# define _STLP_OUTERMOST_HEADER_ID 0xdeadbeaf
-# pragma GCC visibility push(default)
+# if defined(_GNUC__)
+# pragma GCC visibility push(default)
+# endif
# include _STLP_NATIVE_HEADER(exception_defines.h)
# include _STLP_NATIVE_HEADER(limits)
# include _STLP_NATIVE_HEADER(memory)
@@ -56,7 +61,9 @@
# include _STLP_NATIVE_HEADER(vector)
# include _STLP_NATIVE_HEADER(list)
# include _STLP_NATIVE_HEADER(map)
-# pragma GCC visibility pop
+# if defined(_GNUC__)
+# pragma GCC visibility pop
+# endif
# endif
#endif
//ext_std resolves to the std that external c++ libs, e.g. Graphite were built
diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h
index 2ae0fa5f2f32..096d34d05b9e 100644
--- a/tools/inc/tools/solar.h
+++ b/tools/inc/tools/solar.h
@@ -122,23 +122,13 @@ typedef BYTE SVBT64[8];
#ifdef __cplusplus
inline BYTE SVBT8ToByte ( const SVBT8 p ) { return p[0]; }
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT2 == 1
-inline USHORT SVBT16ToShort( const SVBT16 p ) { return *(USHORT*)p; }
-#else
inline USHORT SVBT16ToShort( const SVBT16 p ) { return (USHORT)p[0]
+ ((USHORT)p[1] << 8); }
-#endif
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT4 == 1
-inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return *(sal_uInt32*)p; }
-#else
inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return (sal_uInt32)p[0]
+ ((sal_uInt32)p[1] << 8)
+ ((sal_uInt32)p[2] << 16)
+ ((sal_uInt32)p[3] << 24); }
-#endif
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT8 == 1
-inline double SVBT64ToDouble( const SVBT64 p ) { return *(double*)p; }
-#elif defined OSL_LITENDIAN
+#if defined OSL_LITENDIAN
inline double SVBT64ToDouble( const SVBT64 p ) { double n;
((BYTE*)&n)[0] = p[0];
((BYTE*)&n)[1] = p[1];
@@ -163,23 +153,13 @@ inline double SVBT64ToDouble( const SVBT64 p ) { double n;
#endif
inline void ByteToSVBT8 ( BYTE n, SVBT8 p ) { p[0] = n; }
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT2 == 1
-inline void ShortToSVBT16( USHORT n, SVBT16 p ) { *(USHORT*)p = n; }
-#else
inline void ShortToSVBT16( USHORT n, SVBT16 p ) { p[0] = (BYTE) n;
p[1] = (BYTE)(n >> 8); }
-#endif
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT4 == 1
-inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { *(sal_uInt32*)p = n; }
-#else
inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { p[0] = (BYTE) n;
p[1] = (BYTE)(n >> 8);
p[2] = (BYTE)(n >> 16);
p[3] = (BYTE)(n >> 24); }
-#endif
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT8 == 1
-inline void DoubleToSVBT64( double n, SVBT64 p ) { *(double*)p = n; }
-#elif defined OSL_LITENDIAN
+#if defined OSL_LITENDIAN
inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((BYTE*)&n)[0];
p[1] = ((BYTE*)&n)[1];
p[2] = ((BYTE*)&n)[2];
diff --git a/tools/inc/tools/svborder.hxx b/tools/inc/tools/svborder.hxx
index 9523a71a060f..a0509bcc89be 100644
--- a/tools/inc/tools/svborder.hxx
+++ b/tools/inc/tools/svborder.hxx
@@ -49,6 +49,14 @@ public:
}
BOOL operator != ( const SvBorder & rObj ) const
{ return !(*this == rObj); }
+ SvBorder & operator = ( const SvBorder & rBorder )
+ {
+ Left() = rBorder.Left();
+ Top() = rBorder.Top();
+ Right() = rBorder.Right();
+ Bottom() = rBorder.Bottom();
+ return *this;
+ }
SvBorder & operator += ( const SvBorder & rBorder )
{
Left() += rBorder.Left();
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 9e4f501d1823..88ccb2113e0d 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -209,7 +209,7 @@ static sal_uInt32 GetSvError( int nErrno )
{ 0, SVSTREAM_OK },
{ EACCES, SVSTREAM_ACCESS_DENIED },
{ EBADF, SVSTREAM_INVALID_HANDLE },
-#if defined( RS6000 ) || defined( ALPHA ) || defined( HP9000 ) || defined( NETBSD ) || defined(FREEBSD) || defined(MACOSX)
+#if defined( RS6000 ) || defined( ALPHA ) || defined( HP9000 ) || defined( NETBSD ) || defined(FREEBSD) || defined(MACOSX) || defined(__FreeBSD_kernel__)
{ EDEADLK, SVSTREAM_LOCKING_VIOLATION },
#else
{ EDEADLOCK, SVSTREAM_LOCKING_VIOLATION },
@@ -223,7 +223,7 @@ static sal_uInt32 GetSvError( int nErrno )
{ EAGAIN, SVSTREAM_LOCKING_VIOLATION },
{ EISDIR, SVSTREAM_PATH_NOT_FOUND },
{ ELOOP, SVSTREAM_PATH_NOT_FOUND },
-#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX)
+#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX) && ! defined(__FreeBSD_kernel__)
{ EMULTIHOP, SVSTREAM_PATH_NOT_FOUND },
{ ENOLINK, SVSTREAM_PATH_NOT_FOUND },
#endif
diff --git a/transex3/java/jpropex/build.xml b/transex3/java/jpropex/build.xml
new file mode 100755
index 000000000000..d74fb3975d0f
--- /dev/null
+++ b/transex3/java/jpropex/build.xml
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<project name="jpropex" default="main" basedir=".">
+
+ <!-- ================================================================= -->
+ <!-- settings -->
+ <!-- ================================================================= -->
+
+ <!-- name of this sub target used in recursive builds -->
+ <property name="target" value="jpropex"/>
+
+ <!-- name of jar file created, without .jar extension -->
+ <property name="jarname" value="jpropex"/>
+
+ <!-- relative path to project directory -->
+ <property name="prj" value="."/>
+
+ <!-- build output directory -->
+ <property name="out" value="build"/>
+
+ <!-- build directories -->
+ <property name="build.dir" value="${out}"/>
+ <property name="build.class" value="${build.dir}/class/jpropex"/>
+ <property name="build.misc" value="${build.dir}/misc/jpropex"/>
+
+ <!-- start of java source code package structure -->
+ <property name="java.dir" value="java"/>
+
+ <!-- define how to handle CLASSPATH environment -->
+ <property name="build.sysclasspath" value="ignore"/>
+
+ <!-- classpath settings for compile and javadoc tasks -->
+ <path id="classpath">
+ <pathelement location="."/>
+ <pathelement location="${build.class}"/>
+ </path>
+
+ <!-- name to display in documentation -->
+ <!-- <property name="docname" value="l10n converter"/> -->
+
+ <!-- set "modern" java compiler -->
+ <property name="build.compiler" value="modern"/>
+
+ <!-- set wether we want to compile with debug information -->
+ <property name="debug" value="on"/>
+
+ <!-- set wether we want to compile with optimisation -->
+ <property name="optimize" value="off"/>
+
+ <!-- set wether we want to compile with or without deprecation -->
+ <property name="deprecation" value="on"/>
+
+ <target name="info">
+ <echo message="--------------------"/>
+ <echo message="${target}"/>
+ <echo message="--------------------"/>
+ </target>
+
+ <!-- ================================================================= -->
+ <!-- custom targets -->
+ <!-- ================================================================= -->
+
+ <!-- the main target, called in recursive builds -->
+ <target name="main" depends="info,prepare,compile,jar"/>
+
+ <!-- prepare output directories -->
+ <target name="prepare">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.class}"/>
+ <mkdir dir="${build.misc}"/>
+ </target>
+
+
+ <target name="res" depends="prepare">
+ <copy todir="${build.class}">
+ <fileset dir="${java.dir}">
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.form"/>
+ <include name="**/*.gif "/>
+ <include name="**/*.htm"/>
+ <include name="**/*.html"/>
+ <include name="**/*.js"/>
+ <include name="**/*.mod"/>
+ <include name="**/*.sql"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xsl"/>
+ <include name="**/*.map"/>
+
+ </fileset>
+ </copy>
+ </target>
+
+
+ <target name="compile" depends="prepare,res">
+ <javac destdir="${build.class}"
+ debug="${debug}"
+ deprecation="${deprication}"
+ optimize="${optimize}"
+ classpathref="classpath">
+ <src path="${java.dir}"/>
+ <include name="**/*.java"/>
+ </javac>
+ </target>
+
+ <!-- clean up -->
+ <target name="clean" depends="prepare">
+ <delete includeEmptyDirs="true">
+ <fileset dir="${build.class}">
+ <patternset>
+ <include name="${package}/**/*.class"/>
+ </patternset>
+ </fileset>
+ </delete>
+ </target>
+
+ <!-- create jar file -->
+ <target name="jar" depends="prepare,compile" if="build.class">
+ <jar jarfile="${build.class}/${jarname}.jar"
+ basedir="${build.class}"
+ manifest="${jarname}.MF">
+ <include name="**/*.class"/>
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.form"/>
+ <include name="**/*.gif "/>
+ <include name="**/*.htm"/>
+ <include name="**/*.html"/>
+ <include name="**/*.js"/>
+ <include name="**/*.mod"/>
+ <include name="**/*.sql"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xsl"/>
+ <include name="**/*.map"/>
+ </jar>
+ </target>
+
+ <target name="test" depends="prepare">
+ </target>
+
+</project>
+
diff --git a/transex3/java/jpropex/java/JPropEx.java b/transex3/java/jpropex/java/JPropEx.java
new file mode 100644
index 000000000000..20175febe5d5
--- /dev/null
+++ b/transex3/java/jpropex/java/JPropEx.java
@@ -0,0 +1,400 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+import java.util.*;
+import java.io.*;
+
+public class JPropEx
+{
+ private String inputFileArg;
+ private String outputFileArg;
+ private String pathPrefixArg;
+ private String pathPostfixArg;
+ private String projectArg;
+ private String rootArg;
+ private Vector forcedLangsArg;
+ private Vector langsArg;
+ private String inputSdfFileArg;
+ private boolean isQuiet = false;
+ private final String resourceType = "javaproperties";
+ private final String sourceLanguage = "en-US";
+ //private SdfData data;
+
+ public JPropEx()
+ {
+ //data = new SdfData();
+ }
+
+ public JPropEx( String args[] )
+ {
+ super();
+ parseArguments( args );
+ testArguments();
+ if( inputSdfFileArg != null && inputSdfFileArg.length() > 0 )
+ merge();
+ else
+ extract();
+ }
+
+ private String getSimpleArg( String[] args , int x )
+ {
+ if( x < args.length ) x++;
+ else
+ {
+ System.err.println("ERROR: Missing arg for "+args[ x ]+"\n");
+ help();
+ }
+ return args[ x ];
+ }
+ private Vector getComplexArg( String[] args , int x )
+ {
+ if( x < args.length ) x++;
+ else
+ {
+ System.err.println("ERROR: Missing arg for "+args[ x ]+"\n");
+ help();
+ }
+ String value = args[ x ];
+ Vector values = new Vector( Arrays.asList( value.split(",") ) );
+ return values;
+ }
+
+ private void help()
+ {
+ System.out.println("jpropex extract / merge java properties files");
+ System.exit( -1 );
+ }
+
+ private void extract()
+ {
+ SdfData data = new SdfData();
+ java.util.Properties prop = loadProp( inputFileArg );
+
+ // Get a prototype that already contains the most common settings
+ SdfEntity dolly = prepareSdfObj();
+ String key;
+ SdfEntity currentStr;
+ String value;
+ for( Enumeration e = prop.propertyNames() ; e.hasMoreElements() ; )
+ {
+ key = (String) e.nextElement();
+ currentStr = (SdfEntity) dolly.clone();
+ // Set the new LID and the string text
+ currentStr.setLid( key );
+ value = prop.getProperty( key , "" );
+ //if( value.equals("") ) System.err.println("Warning: in file "+inputFileArg+" the string with the key "+key+" has a empty string!");
+ currentStr.setText( (prop.getProperty( key )).replaceAll("\t" , " " ) ); // TODO: Quoting!!!!
+ data.add( currentStr );
+ }
+ data.write( outputFileArg );
+ }
+
+ private SdfEntity prepareSdfObj()
+ {
+ String path = makeAbs( inputFileArg );
+ path = path.replace( rootArg + "/" , "" );
+ path = path.replace("/","\\");
+ return new SdfEntity( projectArg , path , "" /* dummy1 */ , resourceType , "", "" , "" , "" , "" /* dummy2 */ ,
+ sourceLanguage , "", "" , "" , "" , "2002-02-02 02:02:02" );
+ }
+
+ private void merge()
+ {
+ SdfData data = getSdfData();
+ if( inputFileArg.startsWith("@") )
+ {
+ // Read files
+ Vector fileList = readFileList( inputFileArg );
+ for( Enumeration e = fileList.elements(); e.hasMoreElements(); )
+ mergeFile( (String) e.nextElement() , data );
+ }
+ else
+ {
+ // Single file
+ mergeFile( inputFileArg , data );
+ }
+ }
+
+ private Vector readFileList( String filename )
+ {
+ Vector lines = new Vector();
+ try
+ {
+ BufferedReader in = new BufferedReader( new FileReader( filename.substring( 1 ) ) );
+ while( in.ready() )
+ lines.add( in.readLine() );
+ }
+ catch( IOException e )
+ {
+ System.out.println("ERROR: Can't open file '"+filename.substring( 1 )+"'");
+ System.exit( -1 );
+ }
+ return lines;
+ }
+
+ private void mergeFile( String filename , SdfData data )
+ {
+ java.util.Properties sourceProp = loadProp( filename );
+ Vector langs = getLanguages( data );
+ HashMap props = new HashMap();
+ // Create a properties object for every language
+ for( Enumeration e = langs.elements(); e.hasMoreElements();)
+ {
+
+ props.put( (String)e.nextElement() , new java.util.Properties() );
+ }
+ // Get a prototype that already contains the most common settings
+
+ SdfEntity dolly = prepareSdfObj();
+ String key;
+ String sourceString;
+ SdfEntity curStr;
+ SdfEntity curEntity;
+ SdfEntity mergedEntity;
+ String curLang;
+ for( Enumeration e = sourceProp.propertyNames() ; e.hasMoreElements() ; ) // For all property keys
+ {
+ key = (String) e.nextElement();
+ sourceString = sourceProp.getProperty( key );
+ curStr = (SdfEntity) dolly.clone();
+ curStr.setLid( key );
+ for( Enumeration lang = langs.elements(); lang.hasMoreElements(); ) // merge in every language
+ {
+ curEntity = (SdfEntity) curStr.clone();
+ curLang = (String) lang.nextElement();
+ curEntity.setLangid( curLang );
+ mergedEntity = data.get( curEntity );
+ if( mergedEntity == null )
+ {
+ // if case there is not translation the fallback to the en-US source string
+ ( (java.util.Properties) props.get( curLang )).setProperty( curEntity.getLid() , sourceString );
+ }
+ else
+ {
+ // Set the merged text from the sdf file
+ ( (java.util.Properties) props.get( curLang )).setProperty( mergedEntity.getLid() , mergedEntity.getText() ); // TODO: Quoting ???
+ }
+ }
+
+ }
+ // Now write them out
+ String lang;
+ for( Iterator i = props.keySet().iterator() ; i.hasNext() ; )
+ {
+ lang = (String) i.next();
+ writeSinglePropertiesFile( filename , (java.util.Properties) props.get( lang ) , lang );
+ }
+ }
+ private void writeSinglePropertiesFile( String filename , java.util.Properties prop , String lang )
+ {
+ // Prepare path to file
+ int filenameIdx = filename.lastIndexOf( "/" ) > 0 ? filename.lastIndexOf( "/" )+1 : 0 ;
+ String path = new String();
+ String name = new String();
+ if( pathPrefixArg != null && pathPrefixArg.length()>0 && pathPostfixArg != null && pathPostfixArg.length()>0 )
+ {
+ path = new StringBuffer().append( pathPrefixArg ).append( "/" ).append( lang ).append( "/" ).append( pathPostfixArg ).append( "/" ).toString();
+ name = new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) )
+ .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString();
+ }
+ else if( outputFileArg != null && outputFileArg.length()>0 )
+ {
+ name = outputFileArg;
+ name += new StringBuffer().append( inputFileArg.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) )
+ .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString();
+
+ //name = outputFileArg;
+ }
+ else
+ {
+ System.err.println("ERROR: No outputfile specified .. either -o or -x -y !");
+ System.exit( -1 );
+ }
+
+ File dir = new File( path );
+ try
+ {
+ if( !dir.exists() && path.length()>0 )
+ {
+ if( !dir.mkdirs() )
+ {
+ System.out.println("ERROR: Can't create directory '"+path+"' !!!");
+ System.exit( -1 );
+ }
+ }
+ }
+ catch( SecurityException e )
+ {
+ System.out.println("ERROR: Can't create directory '"+path+"'!!!Wrong Permissions?");
+ System.exit( -1 );
+ }
+ path += name;
+ // Write the properties file
+ System.out.println("DBG: Writing to "+path);
+ try{
+ BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( path ) );
+ if( prop == null )
+ System.out.println("DBG: prop == null!!!");
+ prop.store( out , "" ); // Legal headers?
+ }
+ catch( IOException e )
+ {
+ System.out.println("ERROR: Can't write file '"+path+"' !!!!");
+ System.exit( -1 );
+ }
+ }
+
+ private SdfData getSdfData()
+ {
+ SdfData data = new SdfData( inputSdfFileArg );
+ data.read();
+ return data;
+ }
+ private Vector getLanguages( SdfData data )
+ {
+ Vector langs = new Vector();
+
+ if( ((String)langsArg.get( 0 )).equalsIgnoreCase( "all" ) ) // for "-l all" use all languages found in the -m sdf file
+ langs.addAll( data.getLanguages() );
+ else
+ langs.addAll( langsArg ); // use the langs giving by -l
+
+ if( forcedLangsArg != null )
+ langs.addAll( forcedLangsArg );
+
+ return removeDupes( langs );
+ }
+ private Vector removeDupes( Vector vec )
+ {
+ Collection coll = new LinkedHashSet( vec );
+ return new Vector( coll );
+ }
+ private java.util.Properties loadProp( String filename )
+ {
+ java.util.Properties prop = new java.util.Properties();
+ try
+ {
+ prop.load( new BufferedInputStream( new NoLocalizeFilter( new FileInputStream( filename ) ) ) );
+ }
+ catch( IOException e )
+ {
+ System.err.println("ERROR: Can't read file '"+filename+"'!!!");
+ }
+ return prop;
+ }
+ private void parseArguments( String[] args )
+ {
+
+ if( args.length == 0 )
+ {
+ System.out.println("ERROR: No args???");
+ help();
+ System.exit( -1 );
+ }
+ for( int x = 0; x < args.length ; x++ )
+ {
+ if( args[ x ].equalsIgnoreCase("-i") )
+ {
+ // Input resource file
+ inputFileArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-o") )
+ {
+ // Output sdf file
+ outputFileArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-x") )
+ {
+ // path prefix
+ pathPrefixArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-y") )
+ {
+ // path postfix
+ pathPostfixArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-p") )
+ {
+ // project
+ projectArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-r") )
+ {
+ // root
+ rootArg = getSimpleArg( args , x );
+ rootArg = makeAbs( rootArg );
+ }
+ else if( args[ x ].equalsIgnoreCase("-lf") )
+ {
+ // forced langs
+ forcedLangsArg = getComplexArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-l") )
+ {
+ // langs
+ langsArg = getComplexArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-m") )
+ {
+ // input sdf file
+ inputSdfFileArg = getSimpleArg( args , x );
+ }
+ else if( args[ x ].equalsIgnoreCase("-qq") )
+ {
+ isQuiet = true;
+ }
+ }
+ }
+ private String makeAbs( String path )
+ {
+ File file;
+ try
+ {
+ file = new File( path );
+ return file.getCanonicalPath();
+ }catch( IOException e )
+ {
+ e.printStackTrace();
+ System.exit( -1 );
+ }
+ return null;
+ }
+ private boolean testArguments()
+ {
+ // nice merge
+ if( inputSdfFileArg != null && inputSdfFileArg.length()>0 )
+ // nice merge
+ return projectArg != null && rootArg != null && inputFileArg != null && pathPrefixArg != null && pathPostfixArg != null && langsArg != null &&
+ projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && pathPrefixArg.length()>0 && pathPostfixArg.length()>0 && langsArg.size()>0 ;
+ else
+ // nice extract
+ return projectArg != null && rootArg != null && inputFileArg != null && outputFileArg != null && langsArg != null &&
+ projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && outputFileArg.length()>0 && langsArg.size()>0;
+ }
+
+}
diff --git a/transex3/java/jpropex/java/Main.java b/transex3/java/jpropex/java/Main.java
new file mode 100644
index 000000000000..23dc477ddec3
--- /dev/null
+++ b/transex3/java/jpropex/java/Main.java
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+class Main
+{
+
+ public static void main( String args[] )
+ {
+ JPropEx jpropex = new JPropEx( args );
+ //jpropex.init();
+ }
+}
+
diff --git a/transex3/java/jpropex/java/NoLocalizeFilter.java b/transex3/java/jpropex/java/NoLocalizeFilter.java
new file mode 100644
index 000000000000..c1e62fc951a8
--- /dev/null
+++ b/transex3/java/jpropex/java/NoLocalizeFilter.java
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+import java.io.*;
+import java.util.regex.*;
+
+// exit if the sequence x-no-localize is found in stream!
+public class NoLocalizeFilter extends FilterInputStream
+{
+ InputStream in;
+// Pattern p = Pattern.compile("[\\s]*#[\\s]*x-no-translate");
+
+ public NoLocalizeFilter( InputStream in ) {
+ super(in);
+ this.in = in;
+ }
+ public int read(byte[] b, int off, int len) throws IOException
+ {
+ String search = new String( b );
+// Matcher m = p.matcher( search );
+ if( search.contains("x-no-translate" ) ) // TODO: fixme!
+ {
+// System.out.println("found x-no-translate");
+ in.close();
+ close();
+ System.exit( 0 );
+ }
+ return in.read( b , off , len );
+ }
+}
diff --git a/transex3/java/jpropex/java/OrderedHashMap.java b/transex3/java/jpropex/java/OrderedHashMap.java
new file mode 100644
index 000000000000..a462d598b307
--- /dev/null
+++ b/transex3/java/jpropex/java/OrderedHashMap.java
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+import java.util.*;
+
+// LinkedHashMap implrementation
+public class OrderedHashMap
+{
+ private HashMap hm = new HashMap();
+ private LinkedList list = new LinkedList();
+
+ public Iterator iterator() { return list.iterator(); }
+
+ public boolean isEmpty() { return hm.isEmpty(); }
+ public Object get( Object key ) { return hm.get( key ); }
+ public Object get( int index ) { return hm.get( list.get( index ) ); }
+ public Iterator keys() { return list.iterator(); }
+ public Object add( Object key , Object value )
+ {
+ list.add( key );
+ return hm.put( key, value );
+ }
+ public Object add( int index , Object key , Object value )
+ {
+ list.add( index , key );
+ return hm.put( key, value );
+ }
+ public Object remove( Object key )
+ {
+ list.remove( list.indexOf( key ) );
+ return hm.remove( key );
+ }
+ public void move( int idxFrom , int idxTo )
+ {
+ Object key = list.get( idxFrom );
+ list.remove( idxFrom );
+ list.add( idxTo , key );
+ }
+ public void move( Object key , int idxTo )
+ {
+ move( list.indexOf( key ) , idxTo );
+ }
+ public int size()
+ {
+ return hm.size();
+ }
+ public Enumeration elements()
+ {
+ return new OHMenum( this );
+ }
+}
+
+final class OHMenum implements Enumeration
+{
+ OrderedHashMap ohm;
+ int index = 0;
+
+ private OHMenum(){};
+ public OHMenum( OrderedHashMap ohm ){
+ this.ohm = ohm ;
+ }
+
+ public boolean hasMoreElements()
+ {
+ return index < ohm.size();
+ }
+ public Object nextElement()
+ {
+ return ohm.get( index++ );
+ }
+}
diff --git a/transex3/java/jpropex/java/SdfData.java b/transex3/java/jpropex/java/SdfData.java
new file mode 100644
index 000000000000..60f218c0ae15
--- /dev/null
+++ b/transex3/java/jpropex/java/SdfData.java
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+import java.util.*;
+import java.io.*;
+
+public class SdfData
+{
+ private String filename;
+ private OrderedHashMap ohm;
+ private LinkedHashSet languagesFound;
+
+ public SdfData()
+ {
+ languagesFound = new LinkedHashSet();
+ ohm = new OrderedHashMap();
+ languagesFound = new LinkedHashSet();
+ }
+ public SdfData( String filename ){
+ this();
+ this.filename = filename;
+ }
+
+ public LinkedHashSet getLanguages()
+ {
+ return languagesFound;
+ }
+ public SdfEntity get( SdfEntity obj )
+ {
+ return (SdfEntity) ohm.get( (String)obj.getId() );
+ }
+ public SdfEntity get( String key ){
+ return (SdfEntity) ohm.get( key );
+ }
+ public void add( SdfEntity obj )
+ {
+ ohm.add( obj.getId() , obj );
+ }
+
+ public void read()
+ {
+ BufferedReader in;
+ try
+ {
+ in = new BufferedReader( new FileReader( filename ) );
+ SdfEntity entity;
+ while( in.ready() )
+ {
+ String line = in.readLine();
+ if( line.length() > 0 )
+ {
+ entity = new SdfEntity( line );
+ ohm.add( entity.getId() , entity ); // test if is valid
+ languagesFound.add( entity.getLangid() );
+ }
+ }
+ in.close();
+ }
+ catch( IOException e )
+ {
+ System.out.println("Error: reading file " + filename);
+ System.exit( -1 );
+ }
+ }
+ public void write( String filename )
+ {
+ FileWriter out;
+ try
+ {
+ out = new FileWriter( filename , true ); // Always append
+ for( Enumeration e = ohm.elements(); e.hasMoreElements(); )
+ {
+ out.write( ( (SdfEntity) e.nextElement() ).toString() + "\n" );
+ }
+ out.close();
+ }
+ catch( IOException e )
+ {
+ System.out.println("Error: Can't write to file " + filename);
+ System.exit( -1 );
+ }
+ }
+}
diff --git a/transex3/java/jpropex/java/SdfEntity.java b/transex3/java/jpropex/java/SdfEntity.java
new file mode 100644
index 000000000000..e2c1606ee7c2
--- /dev/null
+++ b/transex3/java/jpropex/java/SdfEntity.java
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+public class SdfEntity implements Cloneable{
+ private String project = new String("");
+ private String source_file = new String("");
+ private String dummy1 = new String("");
+ private String resource_type= new String("");
+ private String gid = new String("");
+ private String lid = new String("");
+ private String helpid = new String("");
+ private String platform = new String("");
+ private String dummy2 = new String("");
+ private String langid = new String("");
+ private String text = new String("");
+ private String helptext = new String("");
+ private String quickhelptext= new String("");
+ private String title = new String("");
+ private String date = new String("");
+
+ public static int PROJECT_POS = 0;
+ public static int SOURCE_FILE_POS = 1;
+ public static int DUMMY1_POS = 2;
+ public static int RESOURCE_TYPE_POS = 3;
+ public static int GID_POS = 4;
+ public static int LID_POS = 5;
+ public static int HELPID_POS = 6;
+ public static int PLATFORM_POS = 7;
+ public static int DUMMY2_POS = 8;
+ public static int LANGID_POS = 9;
+ public static int TEXT_POS = 10;
+ public static int HELPTEXT_POS = 11;
+ public static int QUICKHELPTEXT_POS = 12;
+ public static int TITLE_POS = 13;
+ public static int DATE_POS = 14;
+
+ public Object clone()
+ {
+ try
+ {
+ return super.clone();
+ }
+ catch( CloneNotSupportedException e )
+ {
+ System.out.println("ERROR: Can not clone, soemthing is broken here ....");
+ System.exit( -1 );
+ }
+ return null; // dummy
+ }
+
+ public SdfEntity( String line ){
+ // isValid?
+ setProperties( line ) ;
+ }
+ public SdfEntity(String project, String source_file, String dummy1, String resource_type, String gid, String lid, String helpid, String platform, String dummy2, String langid, String text, String helptext, String quickhelptext, String title , String date) {
+ super();
+ this.project = project;
+ this.source_file = source_file;
+ this.dummy1 = dummy1;
+ this.resource_type = resource_type;
+ this.gid = gid;
+ this.lid = lid;
+ this.helpid = helpid;
+ this.platform = platform;
+ this.dummy2 = dummy2;
+ this.langid = langid;
+ this.text = text;
+ this.helptext = helptext;
+ this.quickhelptext = quickhelptext;
+ this.title = title;
+ this.date = date;
+ }
+
+ public void setProperties( String line ){
+
+ String[] splitted = line.split("\t");
+
+ setProject( splitted[ SdfEntity.PROJECT_POS ] );
+ setSource_file( splitted[ SdfEntity.SOURCE_FILE_POS ] );
+ setDummy1( splitted[ SdfEntity.DUMMY1_POS ] );
+ setResource_type( splitted[ SdfEntity.RESOURCE_TYPE_POS ] );
+ setGid( splitted[ SdfEntity.GID_POS ] );
+ setLid( splitted[ SdfEntity.LID_POS ] );
+ setHelpid( splitted[ SdfEntity.HELPID_POS ] );
+ setPlatform( splitted[ SdfEntity.PLATFORM_POS ] );
+ setDummy2( splitted[ SdfEntity.DUMMY2_POS ] );
+ setLangid( splitted[ SdfEntity.LANGID_POS ] );
+ setText( splitted[ SdfEntity.TEXT_POS ] );
+ setHelptext( splitted[ SdfEntity.HELPTEXT_POS ] );
+ setQuickhelptext( splitted[ SdfEntity.QUICKHELPTEXT_POS ] );
+ setTitle( splitted[ SdfEntity.TITLE_POS ] );
+ setDate( splitted[ SdfEntity.DATE_POS ] );
+ }
+
+ public String getFileId(){
+ return project+"\\"+source_file;
+ }
+ public String getResourcePath(){
+ return source_file.substring(0 , source_file.lastIndexOf( "\\" )-1 );
+ }
+ public String toString(){
+ return project+"\t"+source_file+"\t"+dummy1+"\t"+resource_type+"\t"+gid+"\t"
+ +lid+"\t"+helpid+"\t"+platform+"\t"+dummy2+"\t"+langid+"\t"
+ +text+"\t"+helptext+"\t"+quickhelptext+"\t"+title+"\t"+date;
+ }
+ public String getId(){
+ return project+gid+lid+source_file+resource_type+platform+helpid;
+ }
+
+ public String getDummy1() {
+ return dummy1;
+ }
+
+ public void setDummy1(String dummy1) {
+ this.dummy1 = dummy1;
+ }
+
+ public String getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(String platform) {
+ this.platform = platform;
+ }
+
+ public String getDummy2() {
+ return dummy2;
+ }
+
+ public void setDummy2(String dummy2) {
+ this.dummy2 = dummy2;
+ }
+
+ public String getGid() {
+ return gid;
+ }
+
+ public void setGid(String gid) {
+ this.gid = gid;
+ }
+
+ public String getHelpid() {
+ return helpid;
+ }
+
+ public void setHelpid(String helpid) {
+ this.helpid = helpid;
+ }
+
+ public String getHelptext() {
+ return helptext;
+ }
+
+ public void setHelptext(String helptext) {
+ this.helptext = helptext;
+ }
+
+ public String getLangid() {
+ return langid;
+ }
+
+ public void setLangid(String langid) {
+ this.langid = langid;
+ }
+
+ public String getLid() {
+ return lid;
+ }
+
+ public void setLid(String lid) {
+ this.lid = lid;
+ }
+
+ public String getProject() {
+ return project;
+ }
+
+ public void setProject(String project) {
+ this.project = project;
+ }
+
+ public String getQuickhelptext() {
+ return quickhelptext;
+ }
+
+ public void setQuickhelptext(String quickhelptext) {
+ this.quickhelptext = quickhelptext;
+ }
+
+ public String getResource_type() {
+ return resource_type;
+ }
+
+ public void setResource_type(String resource_type) {
+ this.resource_type = resource_type;
+ }
+
+ public String getSource_file() {
+ return source_file;
+ }
+
+ public void setSource_file(String source_file) {
+ this.source_file = source_file;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ public String getDate() {
+ return date;
+ }
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+
+}
diff --git a/transex3/java/jpropex/jpropex b/transex3/java/jpropex/jpropex
new file mode 100755
index 000000000000..2d62d13b093e
--- /dev/null
+++ b/transex3/java/jpropex/jpropex
@@ -0,0 +1,10 @@
+#!/bin/sh
+if [ x${SOLARENV}x = xx ]; then
+ echo No environment found, please use 'configure' or 'setsolar'
+ exit 1
+fi
+if [ x${JAVA_HOME}x = xx ]; then
+ echo No Java found!
+ exit 1
+fi
+exec java -DSOLARSRC=${SOLARSRC} -DWORK_STAMP=${WORK_STAMP} -DUSE_SHELL= -jar ${SOLARVER}/${INPATH}/bin${UPDMINOREXT}/jpropex.jar "$@"
diff --git a/transex3/java/jpropex/jpropex.MF b/transex3/java/jpropex/jpropex.MF
new file mode 100755
index 000000000000..3e22e7e9bfbf
--- /dev/null
+++ b/transex3/java/jpropex/jpropex.MF
@@ -0,0 +1 @@
+Main-Class: Main
diff --git a/transex3/java/jpropex/makefile.mk b/transex3/java/jpropex/makefile.mk
new file mode 100755
index 000000000000..f86d2c830025
--- /dev/null
+++ b/transex3/java/jpropex/makefile.mk
@@ -0,0 +1,36 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+
+PRJ=../..
+PRJNAME=transex3
+TARGET=jpropex
+
+.INCLUDE : ant.mk
+
+ALLTAR : ANTBUILD
+
diff --git a/ucbhelper/inc/ucbhelper/propertyvalueset.hxx b/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
index ed02a80f571f..82d440df0c02 100644
--- a/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
+++ b/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
@@ -32,6 +32,7 @@
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/sdbc/XColumnLocate.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/beans/Property.hpp>
#include <cppuhelper/weak.hxx>
#include "osl/mutex.hxx"
@@ -43,7 +44,6 @@ namespace com { namespace sun { namespace star { namespace script {
} } } }
namespace com { namespace sun { namespace star { namespace beans {
- struct Property;
struct PropertyValue;
class XPropertySet;
} } } }
@@ -205,175 +205,205 @@ public:
*/
sal_Int32 getLength() const;
- /**
- * This method appends a string to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendString ( const ::com::sun::star::beans::Property& rProp,
- const ::rtl::OUString& rValue );
-
- /**
- * This method appends a boolean to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendBoolean ( const ::com::sun::star::beans::Property& rProp,
- sal_Bool bValue );
-
- /**
- * This method appends a byte to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendByte ( const ::com::sun::star::beans::Property& rProp,
- sal_Int8 nValue );
-
- /**
- * This method appends a short to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendShort ( const ::com::sun::star::beans::Property& rProp,
- sal_Int16 nValue );
-
- /**
- * This method appends an int to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendInt ( const ::com::sun::star::beans::Property& rProp,
- sal_Int32 nValue );
-
- /**
- * This method appends a long to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendLong ( const ::com::sun::star::beans::Property& rProp,
- sal_Int64 nValue );
-
- /**
- * This method appends a float to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendFloat ( const ::com::sun::star::beans::Property& rProp,
- float nValue );
-
- /**
- * This method appends a double to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendDouble ( const ::com::sun::star::beans::Property& rProp,
- double nValue );
-
- /**
- * This method appends a byte sequence to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendBytes ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Sequence<
- sal_Int8 >& rValue );
-
- /**
- * This method appends a date to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendDate ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::util::Date& rValue );
-
- /**
- * This method appends a time to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendTime ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::util::Time& rValue );
-
- /**
- * This method appends a timestamp to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendTimestamp( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::util::DateTime& rValue );
-
- /**
- * This method appends a binary stream to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendBinaryStream ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::io::XInputStream >&
- rValue );
-
- /**
- * This method appends a character stream to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendCharacterStream( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::io::XInputStream >&
- rValue );
-
- /**
- * This method appends an object ( any ) to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendObject ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Any& rValue );
-
- /**
- * This method appends a ref to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendRef ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::sdbc::XRef >& rValue );
-
- /**
- * This method appends a blob to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendBlob ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::sdbc::XBlob >& rValue );
-
- /**
- * This method appends a clob to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendClob ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::sdbc::XClob >& rValue );
-
- /**
- * This method appends an array to the value set.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendArray ( const ::com::sun::star::beans::Property& rProp,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::sdbc::XArray >& rValue );
-
- /**
- * This method appends a void value ( a "hole" ) to the value set. This
- * is useful, since void values indicate errors, like non-existing
- * property (-values) etc.
- *
- * @param rProp is the property the value belongs to.
- */
- void appendVoid ( const ::com::sun::star::beans::Property& rProp );
+ void appendString( const ::rtl::OUString& rPropName, const ::rtl::OUString& rValue );
+ void appendString( const sal_Char* pAsciiPropName, const ::rtl::OUString& rValue )
+ {
+ appendString( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendString( const ::com::sun::star::beans::Property& rProp, const ::rtl::OUString& rValue )
+ {
+ appendString( rProp.Name, rValue );
+ }
+
+ void appendBoolean( const ::rtl::OUString& rPropName, sal_Bool bValue );
+ void appendBoolean( const sal_Char* pAsciiPropName, sal_Bool bValue )
+ {
+ appendBoolean( ::rtl::OUString::createFromAscii( pAsciiPropName ), bValue );
+ }
+ void appendBoolean( const ::com::sun::star::beans::Property& rProp, sal_Bool bValue )
+ {
+ appendBoolean( rProp.Name, bValue );
+ }
+
+ void appendByte( const ::rtl::OUString& rPropName, sal_Int8 nValue );
+ void appendByte( const sal_Char* pAsciiPropName, sal_Int8 nValue )
+ {
+ appendByte( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
+ }
+ void appendByte( const ::com::sun::star::beans::Property& rProp, sal_Int8 nValue )
+ {
+ appendByte( rProp.Name, nValue );
+ }
+
+ void appendShort( const ::rtl::OUString& rPropName, sal_Int16 nValue );
+ void appendShort( const sal_Char* pAsciiPropName, sal_Int16 nValue )
+ {
+ appendShort( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
+ }
+ void appendShort( const ::com::sun::star::beans::Property& rProp, sal_Int16 nValue )
+ {
+ appendShort( rProp.Name, nValue );
+ }
+
+ void appendInt( const ::rtl::OUString& rPropName, sal_Int32 nValue );
+ void appendInt( const sal_Char* pAsciiPropName, sal_Int32 nValue )
+ {
+ appendInt( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
+ }
+ void appendInt( const ::com::sun::star::beans::Property& rProp, sal_Int32 nValue )
+ {
+ appendInt( rProp.Name, nValue );
+ }
+
+ void appendLong( const ::rtl::OUString& rPropName, sal_Int64 nValue );
+ void appendLong( const sal_Char* pAsciiPropName, sal_Int64 nValue )
+ {
+ appendLong( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
+ }
+ void appendLong( const ::com::sun::star::beans::Property& rProp, sal_Int64 nValue )
+ {
+ appendLong( rProp.Name, nValue );
+ }
+
+ void appendFloat( const ::rtl::OUString& rPropName, float nValue );
+ void appendFloat( const sal_Char* pAsciiPropName, float nValue )
+ {
+ appendFloat( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
+ }
+ void appendFloat( const ::com::sun::star::beans::Property& rProp, float nValue )
+ {
+ appendFloat( rProp.Name, nValue );
+ }
+
+ void appendDouble( const ::rtl::OUString& rPropName, double nValue );
+ void appendDouble( const sal_Char* pAsciiPropName, double nValue )
+ {
+ appendDouble( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
+ }
+ void appendDouble( const ::com::sun::star::beans::Property& rProp, double nValue )
+ {
+ appendDouble( rProp.Name, nValue );
+ }
+
+ void appendBytes( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Sequence< sal_Int8 >& rValue );
+ void appendBytes( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Sequence< sal_Int8 >& rValue )
+ {
+ appendBytes( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendBytes( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Sequence< sal_Int8 >& rValue )
+ {
+ appendBytes( rProp.Name, rValue );
+ }
+
+ void appendDate( const ::rtl::OUString& rPropName, const ::com::sun::star::util::Date& rValue );
+ void appendDate( const sal_Char* pAsciiPropName, const ::com::sun::star::util::Date& rValue )
+ {
+ appendDate( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendDate( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::util::Date& rValue )
+ {
+ appendDate( rProp.Name, rValue );
+ }
+
+ void appendTime( const ::rtl::OUString& rPropName, const ::com::sun::star::util::Time& rValue );
+ void appendTime( const sal_Char* pAsciiPropName, const ::com::sun::star::util::Time& rValue )
+ {
+ appendTime( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendTime( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::util::Time& rValue )
+ {
+ appendTime( rProp.Name, rValue );
+ }
+
+ void appendTimestamp( const ::rtl::OUString& rPropName, const ::com::sun::star::util::DateTime& rValue );
+ void appendTimestamp( const sal_Char* pAsciiPropName, const ::com::sun::star::util::DateTime& rValue )
+ {
+ appendTimestamp( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendTimestamp( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::util::DateTime& rValue )
+ {
+ appendTimestamp( rProp.Name, rValue );
+ }
+
+ void appendBinaryStream( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue );
+ void appendBinaryStream( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue )
+ {
+ appendBinaryStream( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendBinaryStream( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue )
+ {
+ appendBinaryStream( rProp.Name, rValue );
+ }
+
+ void appendCharacterStream( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue );
+ void appendCharacterStream( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue )
+ {
+ appendCharacterStream( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendCharacterStream( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue )
+ {
+ appendCharacterStream( rProp.Name, rValue );
+ }
+
+ void appendObject( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rValue );
+ void appendObject( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Any& rValue )
+ {
+ appendObject( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendObject( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Any& rValue )
+ {
+ appendObject( rProp.Name, rValue );
+ }
+
+ void appendRef( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& rValue );
+ void appendRef( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& rValue )
+ {
+ appendRef( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendRef( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& rValue )
+ {
+ appendRef( rProp.Name, rValue );
+ }
+
+ void appendBlob( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& rValue );
+ void appendBlob( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& rValue )
+ {
+ appendBlob( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendBlob( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& rValue )
+ {
+ appendBlob( rProp.Name, rValue );
+ }
+
+ void appendClob( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& rValue );
+ void appendClob( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& rValue )
+ {
+ appendClob( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendClob( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& rValue )
+ {
+ appendClob( rProp.Name, rValue );
+ }
+
+ void appendArray( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& rValue );
+ void appendArray( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& rValue )
+ {
+ appendArray( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
+ }
+ void appendArray( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& rValue )
+ {
+ appendArray( rProp.Name, rValue );
+ }
+
+ void appendVoid( const ::rtl::OUString& rPropName );
+ void appendVoid( const sal_Char* pAsciiPropName)
+ {
+ appendVoid( ::rtl::OUString::createFromAscii( pAsciiPropName ) );
+ }
+ void appendVoid( const ::com::sun::star::beans::Property& rProp )
+ {
+ appendVoid( rProp.Name );
+ }
/**
* This method tries to append all property values contained in a
diff --git a/ucbhelper/prj/build.lst b/ucbhelper/prj/build.lst
index 3f49d69c987f..bbd01df9022a 100644
--- a/ucbhelper/prj/build.lst
+++ b/ucbhelper/prj/build.lst
@@ -1,6 +1,7 @@
-uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL
-uh ucbhelper usr1 - all uh_mkout NULL
-uh ucbhelper\inc nmake - all uh_inc NULL
-uh ucbhelper\source\client nmake - all uh_client uh_inc NULL
-uh ucbhelper\source\provider nmake - all uh_provider uh_inc NULL
-uh ucbhelper\util nmake - all uh_util uh_client uh_provider NULL
+uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL
+uh ucbhelper usr1 - all uh_mkout NULL
+uh ucbhelper\inc nmake - all uh_inc NULL
+uh ucbhelper\source\client nmake - all uh_client uh_inc NULL
+uh ucbhelper\source\provider nmake - all uh_provider uh_inc NULL
+uh ucbhelper\util nmake - all uh_util uh_client uh_provider NULL
+uh ucbhelper\workben\myucp nmake - all uh_wb_myucp uh_util NULL
diff --git a/ucbhelper/source/provider/propertyvalueset.cxx b/ucbhelper/source/provider/propertyvalueset.cxx
index 5d9cfe31cf87..1c857ca467f0 100644
--- a/ucbhelper/source/provider/propertyvalueset.cxx
+++ b/ucbhelper/source/provider/propertyvalueset.cxx
@@ -89,7 +89,8 @@ const sal_uInt32 OBJECT_VALUE_SET = 0x00040000;
struct PropertyValue
{
- Property aProperty;
+ ::rtl::OUString
+ sPropertyName;
sal_uInt32 nPropsSet;
sal_uInt32 nOrigValue;
@@ -240,12 +241,12 @@ class PropertyValues : public PropertyValuesVector {};
_member_name_, \
getCppuType( static_cast< const _type_ * >( 0 ) ) )
-#define SETVALUE_IMPL( _property_, _type_name_, _member_name_, _value_ ) \
+#define SETVALUE_IMPL( _prop_name_, _type_name_, _member_name_, _value_ ) \
\
osl::MutexGuard aGuard( m_aMutex ); \
\
ucbhelper_impl::PropertyValue aNewValue; \
- aNewValue.aProperty = _property_; \
+ aNewValue.sPropertyName = _prop_name_; \
aNewValue.nPropsSet = _type_name_; \
aNewValue.nOrigValue = _type_name_; \
aNewValue._member_name_ = _value_; \
@@ -642,7 +643,7 @@ sal_Int32 SAL_CALL PropertyValueSet::findColumn( const OUString& columnName )
sal_Int32 nCount = m_pValues->size();
for ( sal_Int32 n = 0; n < nCount; ++n )
{
- if ( (*m_pValues)[ n ].aProperty.Name.equals( columnName ) )
+ if ( (*m_pValues)[ n ].sPropertyName.equals( columnName ) )
return sal_Int32( n + 1 ); // Index is 1-based.
}
}
@@ -682,144 +683,144 @@ sal_Int32 PropertyValueSet::getLength() const
}
//=========================================================================
-void PropertyValueSet::appendString( const Property& rProp,
+void PropertyValueSet::appendString( const ::rtl::OUString& rPropName,
const OUString& rValue )
{
- SETVALUE_IMPL( rProp, STRING_VALUE_SET, aString, rValue );
+ SETVALUE_IMPL( rPropName, STRING_VALUE_SET, aString, rValue );
}
//=========================================================================
-void PropertyValueSet::appendBoolean( const Property& rProp,
+void PropertyValueSet::appendBoolean( const ::rtl::OUString& rPropName,
sal_Bool bValue )
{
- SETVALUE_IMPL( rProp, BOOLEAN_VALUE_SET, bBoolean, bValue );
+ SETVALUE_IMPL( rPropName, BOOLEAN_VALUE_SET, bBoolean, bValue );
}
//=========================================================================
-void PropertyValueSet::appendByte( const Property& rProp,
+void PropertyValueSet::appendByte( const ::rtl::OUString& rPropName,
sal_Int8 nValue )
{
- SETVALUE_IMPL( rProp, BYTE_VALUE_SET, nByte, nValue );
+ SETVALUE_IMPL( rPropName, BYTE_VALUE_SET, nByte, nValue );
}
//=========================================================================
-void PropertyValueSet::appendShort( const Property& rProp,
+void PropertyValueSet::appendShort( const ::rtl::OUString& rPropName,
sal_Int16 nValue )
{
- SETVALUE_IMPL( rProp, SHORT_VALUE_SET, nShort, nValue );
+ SETVALUE_IMPL( rPropName, SHORT_VALUE_SET, nShort, nValue );
}
//=========================================================================
-void PropertyValueSet::appendInt( const Property& rProp,
+void PropertyValueSet::appendInt( const ::rtl::OUString& rPropName,
sal_Int32 nValue )
{
- SETVALUE_IMPL( rProp, INT_VALUE_SET, nInt, nValue );
+ SETVALUE_IMPL( rPropName, INT_VALUE_SET, nInt, nValue );
}
//=========================================================================
-void PropertyValueSet::appendLong( const Property& rProp,
+void PropertyValueSet::appendLong( const ::rtl::OUString& rPropName,
sal_Int64 nValue )
{
- SETVALUE_IMPL( rProp, LONG_VALUE_SET, nLong, nValue );
+ SETVALUE_IMPL( rPropName, LONG_VALUE_SET, nLong, nValue );
}
//=========================================================================
-void PropertyValueSet::appendFloat( const Property& rProp,
+void PropertyValueSet::appendFloat( const ::rtl::OUString& rPropName,
float nValue )
{
- SETVALUE_IMPL( rProp, FLOAT_VALUE_SET, nFloat, nValue );
+ SETVALUE_IMPL( rPropName, FLOAT_VALUE_SET, nFloat, nValue );
}
//=========================================================================
-void PropertyValueSet::appendDouble( const Property& rProp,
+void PropertyValueSet::appendDouble( const ::rtl::OUString& rPropName,
double nValue )
{
- SETVALUE_IMPL( rProp, DOUBLE_VALUE_SET, nDouble, nValue );
+ SETVALUE_IMPL( rPropName, DOUBLE_VALUE_SET, nDouble, nValue );
}
//=========================================================================
-void PropertyValueSet::appendBytes( const Property& rProp,
+void PropertyValueSet::appendBytes( const ::rtl::OUString& rPropName,
const Sequence< sal_Int8 >& rValue )
{
- SETVALUE_IMPL( rProp, BYTES_VALUE_SET, aBytes, rValue );
+ SETVALUE_IMPL( rPropName, BYTES_VALUE_SET, aBytes, rValue );
}
//=========================================================================
-void PropertyValueSet::appendDate( const Property& rProp,
+void PropertyValueSet::appendDate( const ::rtl::OUString& rPropName,
const Date& rValue )
{
- SETVALUE_IMPL( rProp, DATE_VALUE_SET, aDate, rValue );
+ SETVALUE_IMPL( rPropName, DATE_VALUE_SET, aDate, rValue );
}
//=========================================================================
-void PropertyValueSet::appendTime( const Property& rProp,
+void PropertyValueSet::appendTime( const ::rtl::OUString& rPropName,
const Time& rValue )
{
- SETVALUE_IMPL( rProp, TIME_VALUE_SET, aTime, rValue );
+ SETVALUE_IMPL( rPropName, TIME_VALUE_SET, aTime, rValue );
}
//=========================================================================
-void PropertyValueSet::appendTimestamp( const Property& rProp,
+void PropertyValueSet::appendTimestamp( const ::rtl::OUString& rPropName,
const DateTime& rValue )
{
- SETVALUE_IMPL( rProp, TIMESTAMP_VALUE_SET, aTimestamp, rValue );
+ SETVALUE_IMPL( rPropName, TIMESTAMP_VALUE_SET, aTimestamp, rValue );
}
//=========================================================================
void PropertyValueSet::appendBinaryStream(
- const Property& rProp,
+ const ::rtl::OUString& rPropName,
const Reference< XInputStream >& rValue )
{
- SETVALUE_IMPL( rProp, BINARYSTREAM_VALUE_SET, xBinaryStream, rValue );
+ SETVALUE_IMPL( rPropName, BINARYSTREAM_VALUE_SET, xBinaryStream, rValue );
}
//=========================================================================
void PropertyValueSet::appendCharacterStream(
- const Property& rProp,
+ const ::rtl::OUString& rPropName,
const Reference< XInputStream >& rValue )
{
- SETVALUE_IMPL( rProp, CHARACTERSTREAM_VALUE_SET, xCharacterStream, rValue );
+ SETVALUE_IMPL( rPropName, CHARACTERSTREAM_VALUE_SET, xCharacterStream, rValue );
}
//=========================================================================
-void PropertyValueSet::appendObject( const Property& rProp,
+void PropertyValueSet::appendObject( const ::rtl::OUString& rPropName,
const Any& rValue )
{
- SETVALUE_IMPL( rProp, OBJECT_VALUE_SET, aObject, rValue );
+ SETVALUE_IMPL( rPropName, OBJECT_VALUE_SET, aObject, rValue );
}
//=========================================================================
-void PropertyValueSet::appendRef( const Property& rProp,
+void PropertyValueSet::appendRef( const ::rtl::OUString& rPropName,
const Reference< XRef >& rValue )
{
- SETVALUE_IMPL( rProp, REF_VALUE_SET, xRef, rValue );
+ SETVALUE_IMPL( rPropName, REF_VALUE_SET, xRef, rValue );
}
//=========================================================================
-void PropertyValueSet::appendBlob( const Property& rProp,
+void PropertyValueSet::appendBlob( const ::rtl::OUString& rPropName,
const Reference< XBlob >& rValue )
{
- SETVALUE_IMPL( rProp, BLOB_VALUE_SET, xBlob, rValue );
+ SETVALUE_IMPL( rPropName, BLOB_VALUE_SET, xBlob, rValue );
}
//=========================================================================
-void PropertyValueSet::appendClob( const Property& rProp,
+void PropertyValueSet::appendClob( const ::rtl::OUString& rPropName,
const Reference< XClob >& rValue )
{
- SETVALUE_IMPL( rProp, CLOB_VALUE_SET, xClob, rValue );
+ SETVALUE_IMPL( rPropName, CLOB_VALUE_SET, xClob, rValue );
}
//=========================================================================
-void PropertyValueSet::appendArray( const Property& rProp,
+void PropertyValueSet::appendArray( const ::rtl::OUString& rPropName,
const Reference< XArray >& rValue )
{
- SETVALUE_IMPL( rProp, ARRAY_VALUE_SET, xArray, rValue );
+ SETVALUE_IMPL( rPropName, ARRAY_VALUE_SET, xArray, rValue );
}
//=========================================================================
-void PropertyValueSet::appendVoid( const Property& rProp )
+void PropertyValueSet::appendVoid( const ::rtl::OUString& rPropName )
{
- SETVALUE_IMPL( rProp, NO_VALUE_SET, aObject, Any() );
+ SETVALUE_IMPL( rPropName, NO_VALUE_SET, aObject, Any() );
}
//=========================================================================
diff --git a/ucbhelper/workben/myucp/makefile.mk b/ucbhelper/workben/myucp/makefile.mk
index 77faad2e0396..6fbad4e8a953 100644
--- a/ucbhelper/workben/myucp/makefile.mk
+++ b/ucbhelper/workben/myucp/makefile.mk
@@ -46,6 +46,7 @@ NO_BSYMBOLIC=TRUE
# --- Settings ---------------------------------------------------------
.INCLUDE: settings.mk
+.INCLUDE : ../../version.mk
# --- General -----------------------------------------------------
diff --git a/unotools/inc/unotools/configmgr.hxx b/unotools/inc/unotools/configmgr.hxx
index 82af190aab4f..c26ff5245739 100644
--- a/unotools/inc/unotools/configmgr.hxx
+++ b/unotools/inc/unotools/configmgr.hxx
@@ -99,7 +99,8 @@ namespace utl
PRODUCTXMLFILEFORMATVERSION,
WRITERCOMPATIBILITYVERSIONOOO11,
OPENSOURCECONTEXT,
- ABOUTBOXPRODUCTVERSION
+ ABOUTBOXPRODUCTVERSION,
+ OOOVENDOR
};
//direct readonly access to some special configuration elements
static com::sun::star::uno::Any GetDirectConfigProperty(ConfigProperty eProp);
diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx
index 8745508375a1..57b5f5bd2afb 100644
--- a/unotools/inc/unotools/confignode.hxx
+++ b/unotools/inc/unotools/confignode.hxx
@@ -35,6 +35,11 @@
#include <com/sun/star/util/XChangesBatch.hpp>
#include <unotools/eventlisteneradapter.hxx>
+namespace comphelper
+{
+ class ComponentContext;
+}
+
//........................................................................
namespace utl
{
@@ -59,19 +64,23 @@ namespace utl
m_xReplaceAccess; /// replacing child values
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
m_xContainerAccess; /// modifying set nodes (optional interface of our UNO object)
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- m_xProvider; /// the configuration provider which supplied the nodes of the hierarchy we're a part of
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ m_xDummy;
sal_Bool m_bEscapeNames; /// escape names before accessing children ?
::rtl::OUString
m_sCompletePath;
OConfigurationNode insertNode(const ::rtl::OUString& _rName,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xNode) const throw();
+
protected:
/// constructs a node object with an interface representing a node
OConfigurationNode(
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxNode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxProvider);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxNode
+ );
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >&
+ getUNONode() const { return m_xDirectAccess; }
public:
/// constructs an empty and invalid node object
@@ -88,6 +97,9 @@ namespace utl
/// returns the local name of the node
::rtl::OUString getLocalName() const;
+ /// returns the fully qualified path of the node
+ ::rtl::OUString getNodePath() const;
+
/** open a sub node
@param _rPath access path of the to-be-opened sub node. May be a hierarchical path.
*/
@@ -186,14 +198,6 @@ namespace utl
*/
sal_Bool getEscape() const { return m_bEscapeNames; }
- /** clone the object, creating a new hierarchy where the root represents the same node as the object
- where this method is called does.<p/>
- The new hierarchy does not share any updates with the one the object is a part of, i.e. any changes made
- in the existing hierarchy are not visible to the newly created one until committed (and vice versa).
- @param _rRoot out parameter. upon return, contains the object representing the root of the new hierarchy.
- */
- OConfigurationTreeRoot cloneAsRoot() const throw();
-
/// invalidate the object
virtual void clear() throw();
@@ -246,22 +250,23 @@ namespace utl
/** ctor<p/>
*/
OConfigurationTreeRoot(
- const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >& _rxRootNode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxProvider);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >& _rxRootNode
+ );
/** ctor for a readonly node
*/
OConfigurationTreeRoot(
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxRootNode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxProvider);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxRootNode
+ );
public:
- /// modes to used when creating a top-level node object
+ /// modes to use when creating a top-level node object
enum CREATION_MODE
{
- CM_READONLY, /// open the node (i.e. sub tree) for read access only
- CM_UPDATABLE, /// open the node (i.e. sub tree) for read and write access
- CM_PREFER_UPDATABLE /// open the node (i.e. sub tree) for read and write access, if this fails, open it for read acces
+ /// open the node (i.e. sub tree) for read access only
+ CM_READONLY,
+ /// open the node (i.e. sub tree) for read and write access, fall back to read-only if write access is not possible
+ CM_UPDATABLE
};
public:
@@ -270,6 +275,22 @@ namespace utl
*/
OConfigurationTreeRoot() :OConfigurationNode() { }
+ /** creates a configuration tree for the given path in the given mode
+ */
+ OConfigurationTreeRoot(
+ const ::comphelper::ComponentContext& i_rContext,
+ const sal_Char* i_pAsciiNodePath,
+ const bool i_bUpdatable
+ );
+
+ /** creates a configuration tree for the given path in the given mode
+ */
+ OConfigurationTreeRoot(
+ const ::comphelper::ComponentContext& i_rContext,
+ const ::rtl::OUString& i_rNodePath,
+ const bool i_bUpdatable
+ );
+
/// copy ctor
OConfigurationTreeRoot(const OConfigurationTreeRoot& _rSource)
:OConfigurationNode(_rSource), m_xCommitter(_rSource.m_xCommitter) { }
@@ -293,7 +314,7 @@ namespace utl
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxConfProvider,
const ::rtl::OUString& _rPath,
sal_Int32 _nDepth = -1,
- CREATION_MODE _eMode = CM_PREFER_UPDATABLE,
+ CREATION_MODE _eMode = CM_UPDATABLE,
sal_Bool _bLazyWrite = sal_True
);
@@ -310,7 +331,7 @@ namespace utl
@param _eMode specifies which privileges should be applied when retrieving the node
*/
static OConfigurationTreeRoot createWithServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
- const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_PREFER_UPDATABLE, sal_Bool _bLazyWrite = sal_True);
+ const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_UPDATABLE, sal_Bool _bLazyWrite = sal_True);
/** tolerant version of the <member>createWithServiceFactory</member>
@@ -319,7 +340,7 @@ namespace utl
given node path does not exist) are still asserted.</p>
*/
static OConfigurationTreeRoot tryCreateWithServiceFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
- const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_PREFER_UPDATABLE, sal_Bool _bLazyWrite = sal_True );
+ const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_UPDATABLE, sal_Bool _bLazyWrite = sal_True );
/** commit all changes made on the subtree the object is the root for<p/>
All changes made on any <type>OConfigurationNode</type> object retrieved (maybe indirect) from this root
diff --git a/unotools/inc/unotools/lingucfg.hxx b/unotools/inc/unotools/lingucfg.hxx
index 720a2efb381c..9a26bdd73021 100644..100755
--- a/unotools/inc/unotools/lingucfg.hxx
+++ b/unotools/inc/unotools/lingucfg.hxx
@@ -230,8 +230,10 @@ public:
::rtl::OUString GetSpellAndGrammarDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
::rtl::OUString GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
::rtl::OUString GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
+ ::rtl::OUString GetThesaurusDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
+ ::rtl::OUString GetSynonymsContextImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
- bool HasAnyVendorImages() const;
+ bool HasVendorImages( const char *pImageName ) const;
bool HasGrammarChecker() const;
};
diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx
index 5f16733b5249..0df6d49afe59 100644
--- a/unotools/source/config/configmgr.cxx
+++ b/unotools/source/config/configmgr.cxx
@@ -70,6 +70,8 @@ namespace
: public rtl::Static< ::rtl::OUString, ProductVersion > {};
struct AboutBoxProductVersion
: public rtl::Static< ::rtl::OUString, AboutBoxProductVersion > {};
+ struct OOOVendor
+ : public rtl::Static< ::rtl::OUString, OOOVendor > {};
struct ProductExtension
: public rtl::Static< ::rtl::OUString, ProductExtension > {};
struct XMLFileFormatName
@@ -433,6 +435,14 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
return aRet;
}
+ rtl::OUString &rOOOVendor = OOOVendor::get();
+ if ( eProp == OOOVENDOR && rOOOVendor.getLength() )
+ {
+ aRet <<= rOOOVendor;
+ return aRet;
+ }
+
+
rtl::OUString &rProductExtension = ProductExtension::get();
if ( eProp == PRODUCTEXTENSION && rProductExtension.getLength() )
{
@@ -493,6 +503,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
case PRODUCTXMLFILEFORMATNAME :
case PRODUCTXMLFILEFORMATVERSION:
case OPENSOURCECONTEXT:
+ case OOOVENDOR:
case ABOUTBOXPRODUCTVERSION: sPath += C2U("Setup/Product"); break;
case DEFAULTCURRENCY: sPath += C2U("Setup/L10N"); break;
@@ -526,6 +537,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
case PRODUCTNAME: sProperty = C2U("ooName"); break;
case PRODUCTVERSION: sProperty = C2U("ooSetupVersion"); break;
case ABOUTBOXPRODUCTVERSION: sProperty = C2U("ooSetupVersionAboutBox"); break;
+ case OOOVENDOR: sProperty = C2U("ooVendor"); break;
case PRODUCTEXTENSION: sProperty = C2U("ooSetupExtension"); break;
case PRODUCTXMLFILEFORMATNAME: sProperty = C2U("ooXMLFileFormatName"); break;
case PRODUCTXMLFILEFORMATVERSION: sProperty = C2U("ooXMLFileFormatVersion"); break;
@@ -565,6 +577,9 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
if ( eProp == PRODUCTVERSION )
aRet >>= rProductVersion;
+ if( eProp == OOOVENDOR )
+ aRet >>= rOOOVendor;
+
if ( eProp == ABOUTBOXPRODUCTVERSION )
{
aRet >>= rAboutBoxProductVersion;
diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx
index 802a63782cf9..181c7ca46c8f 100644
--- a/unotools/source/config/confignode.cxx
+++ b/unotools/source/config/confignode.cxx
@@ -40,6 +40,8 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <comphelper/extract.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
#include <rtl/string.hxx>
#if OSL_DEBUG_LEVEL > 0
#include <rtl/strbuf.hxx>
@@ -60,9 +62,8 @@ namespace utl
//= OConfigurationNode
//========================================================================
//------------------------------------------------------------------------
- OConfigurationNode::OConfigurationNode(const Reference< XInterface >& _rxNode, const Reference< XMultiServiceFactory >& _rxProvider)
- :m_xProvider(_rxProvider)
- ,m_bEscapeNames(sal_False)
+ OConfigurationNode::OConfigurationNode(const Reference< XInterface >& _rxNode )
+ :m_bEscapeNames(sal_False)
{
OSL_ENSURE(_rxNode.is(), "OConfigurationNode::OConfigurationNode: invalid node interface!");
if (_rxNode.is())
@@ -98,7 +99,6 @@ namespace utl
,m_xDirectAccess(_rSource.m_xDirectAccess)
,m_xReplaceAccess(_rSource.m_xReplaceAccess)
,m_xContainerAccess(_rSource.m_xContainerAccess)
- ,m_xProvider(_rSource.m_xProvider)
,m_bEscapeNames(_rSource.m_bEscapeNames)
,m_sCompletePath(_rSource.m_sCompletePath)
{
@@ -116,7 +116,6 @@ namespace utl
m_xDirectAccess = _rSource.m_xDirectAccess;
m_xContainerAccess = _rSource.m_xContainerAccess;
m_xReplaceAccess = _rSource.m_xReplaceAccess;
- m_xProvider = _rSource.m_xProvider;
m_bEscapeNames = _rSource.m_bEscapeNames;
m_sCompletePath = _rSource.m_sCompletePath;
@@ -153,6 +152,22 @@ namespace utl
}
//------------------------------------------------------------------------
+ ::rtl::OUString OConfigurationNode::getNodePath() const
+ {
+ ::rtl::OUString sNodePath;
+ try
+ {
+ Reference< XHierarchicalName > xNamed( m_xDirectAccess, UNO_QUERY_THROW );
+ sNodePath = xNamed->getHierarchicalName();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return sNodePath;
+ }
+
+ //------------------------------------------------------------------------
::rtl::OUString OConfigurationNode::normalizeName(const ::rtl::OUString& _rName, NAMEORIGIN _eOrigin) const
{
::rtl::OUString sName(_rName);
@@ -244,7 +259,7 @@ namespace utl
::rtl::OUString sName = normalizeName(_rName, NO_CALLER);
m_xContainerAccess->insertByName(sName, makeAny(_xNode));
// if we're here, all was ok ...
- return OConfigurationNode(_xNode, m_xProvider);
+ return OConfigurationNode( _xNode );
}
catch(const Exception&)
{
@@ -308,7 +323,7 @@ namespace utl
OSL_ENSURE(sal_False, "OConfigurationNode::openNode: could not open the node!");
}
if (xNode.is())
- return OConfigurationNode(xNode, m_xProvider);
+ return OConfigurationNode( xNode );
}
catch(NoSuchElementException& e)
{
@@ -470,60 +485,112 @@ namespace utl
}
//------------------------------------------------------------------------
- OConfigurationTreeRoot OConfigurationNode::cloneAsRoot() const throw()
+ void OConfigurationNode::clear() throw()
{
- OSL_ENSURE(m_xHierarchyAccess.is(), "OConfigurationNode::cloneAsRoot: object is invalid!");
- if (m_xHierarchyAccess.is())
+ m_xHierarchyAccess.clear();
+ m_xDirectAccess.clear();
+ m_xReplaceAccess.clear();
+ m_xContainerAccess.clear();
+ }
+
+ //========================================================================
+ //= helper
+ //========================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& lcl_getProviderServiceName( )
{
- // first get the complete path of the node we represent
- ::rtl::OUString sCompletePath;
- Reference< XHierarchicalName > xNodeNameAccess(m_xHierarchyAccess, UNO_QUERY);
- if (xNodeNameAccess.is())
+ static ::rtl::OUString s_sProviderServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) );
+ return s_sProviderServiceName;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XMultiServiceFactory > lcl_getConfigProvider( const ::comphelper::ComponentContext& i_rContext )
+ {
+ try
{
- try
- {
- sCompletePath = xNodeNameAccess->getHierarchicalName();
- OSL_ENSURE(sCompletePath.getLength(), "OConfigurationNode::cloneAsRoot: invalid path retrieved!");
- }
- catch(Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
+ Reference< XMultiServiceFactory > xProvider( i_rContext.createComponent( lcl_getProviderServiceName() ), UNO_QUERY_THROW );
+ return xProvider;
+ }
+ catch ( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
+ return NULL;
+ }
- // then create a new tree root object with that path and our provider
- OSL_ENSURE(m_xProvider.is(), "OConfigurationNode::cloneAsRoot: have an invalid provider!");
- if (sCompletePath.getLength() && m_xProvider.is())
+ //--------------------------------------------------------------------
+ Reference< XInterface > lcl_createConfigurationRoot( const Reference< XMultiServiceFactory >& i_rxConfigProvider,
+ const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable, const sal_Int32 i_nDepth, const bool i_bLazyWrite )
+ {
+ ENSURE_OR_RETURN( i_rxConfigProvider.is(), "invalid provider", NULL );
+ try
{
- return OConfigurationTreeRoot::createWithProvider(m_xProvider, sCompletePath, -1, isReadonly() ? OConfigurationTreeRoot::CM_READONLY : OConfigurationTreeRoot::CM_PREFER_UPDATABLE);
+ ::comphelper::NamedValueCollection aArgs;
+ aArgs.put( "nodepath", i_rNodePath );
+ aArgs.put( "lazywrite", i_bLazyWrite );
+ aArgs.put( "depth", i_nDepth );
+
+ ::rtl::OUString sAccessService = ::rtl::OUString::createFromAscii(
+ i_bUpdatable
+ ? "com.sun.star.configuration.ConfigurationUpdateAccess"
+ : "com.sun.star.configuration.ConfigurationAccess" );
+
+ Reference< XInterface > xRoot(
+ i_rxConfigProvider->createInstanceWithArguments( sAccessService, aArgs.getWrappedPropertyValues() ),
+ UNO_SET_THROW
+ );
+ return xRoot;
}
+ catch ( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return NULL;
}
- return OConfigurationTreeRoot();
+ }
+ //========================================================================
+ //= OConfigurationTreeRoot
+ //========================================================================
+ //------------------------------------------------------------------------
+ OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference< XChangesBatch >& _rxRootNode )
+ :OConfigurationNode( _rxRootNode.get() )
+ ,m_xCommitter(_rxRootNode)
+ {
}
//------------------------------------------------------------------------
- void OConfigurationNode::clear() throw()
+ OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference< XInterface >& _rxRootNode )
+ :OConfigurationNode( _rxRootNode )
+ ,m_xCommitter( _rxRootNode, UNO_QUERY )
{
- m_xHierarchyAccess.clear();
- m_xDirectAccess.clear();
- m_xReplaceAccess.clear();
- m_xContainerAccess.clear();
}
- //========================================================================
- //= OConfigurationTreeRoot
- //========================================================================
//------------------------------------------------------------------------
- OConfigurationTreeRoot::OConfigurationTreeRoot(const Reference< XChangesBatch >& _rxRootNode, const Reference< XMultiServiceFactory >& _rxProvider)
- :OConfigurationNode(_rxRootNode.get(), _rxProvider)
- ,m_xCommitter(_rxRootNode)
+ OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const sal_Char* i_pAsciiNodePath, const bool i_bUpdatable )
+ :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ),
+ ::rtl::OUString::createFromAscii( i_pAsciiNodePath ), i_bUpdatable, -1, false ).get() )
+ ,m_xCommitter()
{
+ if ( i_bUpdatable )
+ {
+ m_xCommitter.set( getUNONode(), UNO_QUERY );
+ OSL_ENSURE( m_xCommitter.is(), "OConfigurationTreeRoot::OConfigurationTreeRoot: could not create an updatable node!" );
+ }
}
//------------------------------------------------------------------------
- OConfigurationTreeRoot::OConfigurationTreeRoot(const Reference< XInterface >& _rxRootNode, const Reference< XMultiServiceFactory >& _rxProvider)
- :OConfigurationNode(_rxRootNode.get(), _rxProvider)
+ OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable )
+ :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ),
+ i_rNodePath, i_bUpdatable, -1, false ).get() )
+ ,m_xCommitter()
{
+ if ( i_bUpdatable )
+ {
+ m_xCommitter.set( getUNONode(), UNO_QUERY );
+ OSL_ENSURE( m_xCommitter.is(), "OConfigurationTreeRoot::OConfigurationTreeRoot: could not create an updatable node!" );
+ }
}
//------------------------------------------------------------------------
@@ -555,117 +622,20 @@ namespace utl
return sal_False;
}
- namespace
- {
- static const ::rtl::OUString& lcl_getProviderServiceName( )
- {
- static ::rtl::OUString s_sProviderServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) );
- return s_sProviderServiceName;
- }
- }
-
//------------------------------------------------------------------------
OConfigurationTreeRoot OConfigurationTreeRoot::createWithProvider(const Reference< XMultiServiceFactory >& _rxConfProvider, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite)
{
- OSL_ENSURE(_rxConfProvider.is(), "OConfigurationTreeRoot::createWithProvider: invalid provider!");
-
-#ifdef DBG_UTIL
- if (_rxConfProvider.is())
- {
- try
- {
- Reference< XServiceInfo > xSI(_rxConfProvider, UNO_QUERY);
- if (!xSI.is())
- {
- OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: no XServiceInfo interface on the provider!");
- }
- else
- {
- OSL_ENSURE(xSI->supportsService( lcl_getProviderServiceName( ) ),
- "OConfigurationTreeRoot::createWithProvider: sure this is a provider? Missing the ConfigurationProvider service!");
- }
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-#endif
-
- sal_Bool bTryAgain(sal_False);
- do
- {
- if (_rxConfProvider.is())
- {
- try
- {
- Sequence< Any > aCreationArgs(3);
- aCreationArgs[0] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), 0, makeAny(_rPath), PropertyState_DIRECT_VALUE));
- aCreationArgs[1] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("depth")), 0, makeAny((sal_Int32)_nDepth), PropertyState_DIRECT_VALUE));
- aCreationArgs[2] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("lazywrite")), 0, ::cppu::bool2any(_bLazyWrite), PropertyState_DIRECT_VALUE));
-
- ::rtl::OUString sAccessService = ::rtl::OUString::createFromAscii(CM_READONLY == _eMode
- ? "com.sun.star.configuration.ConfigurationAccess"
- : "com.sun.star.configuration.ConfigurationUpdateAccess");
-
- Reference< XInterface > xRoot = _rxConfProvider->createInstanceWithArguments(sAccessService, aCreationArgs);
- if (!xRoot.is())
- {
- OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: could not create the node access!");
- }
- else if (CM_READONLY == _eMode)
- {
- return OConfigurationTreeRoot(xRoot, _rxConfProvider);
- }
- else
- { // get the changes batch interface
- Reference< XChangesBatch > xCommitter(xRoot, UNO_QUERY);
- if (xCommitter.is())
- return OConfigurationTreeRoot(xCommitter, _rxConfProvider);
- else
- OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: invalid root object (missing interface XChangesBatch)!");
-
- // dispose the object if it is already created, but unusable
- Reference< XComponent > xComp(xRoot, UNO_QUERY);
- if (xComp.is())
- try { xComp->dispose(); } catch(Exception&) { }
- }
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- bTryAgain = CM_PREFER_UPDATABLE == _eMode;
- if (bTryAgain)
- _eMode = CM_READONLY;
- }
- while (bTryAgain);
-
+ Reference< XInterface > xRoot( lcl_createConfigurationRoot(
+ _rxConfProvider, _rPath, _eMode != CM_READONLY, _nDepth, _bLazyWrite ) );
+ if ( xRoot.is() )
+ return OConfigurationTreeRoot( xRoot );
return OConfigurationTreeRoot();
}
//------------------------------------------------------------------------
- OConfigurationTreeRoot OConfigurationTreeRoot::createWithServiceFactory(const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite)
+ OConfigurationTreeRoot OConfigurationTreeRoot::createWithServiceFactory( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite )
{
- OSL_ENSURE(_rxORB.is(), "OConfigurationTreeRoot::createWithServiceFactory: invalid service factory!");
- if (_rxORB.is())
- {
- try
- {
- Reference< XInterface > xProvider = _rxORB->createInstance( lcl_getProviderServiceName( ) );
- OSL_ENSURE(xProvider.is(), "OConfigurationTreeRoot::createWithServiceFactory: could not instantiate the config provider service!");
- Reference< XMultiServiceFactory > xProviderAsFac(xProvider, UNO_QUERY);
- OSL_ENSURE(xProviderAsFac.is() || !xProvider.is(), "OConfigurationTreeRoot::createWithServiceFactory: the provider is missing an interface!");
- if (xProviderAsFac.is())
- return createWithProvider(xProviderAsFac, _rPath, _nDepth, _eMode, _bLazyWrite);
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- return OConfigurationTreeRoot();
+ return createWithProvider( lcl_getConfigProvider( _rxORB ), _rPath, _nDepth, _eMode, _bLazyWrite );
}
//------------------------------------------------------------------------
@@ -681,9 +651,9 @@ namespace utl
if ( xConfigFactory.is() )
return createWithProvider( xConfigFactory, _rPath, _nDepth, _eMode, _bLazyWrite );
}
- catch(Exception&)
+ catch(const Exception&)
{
- // silent this, 'cause the contract of this method states "no assertions"
+ // silence this, 'cause the contract of this method states "no assertions"
}
}
return OConfigurationTreeRoot();
diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx
index c04f29428bf5..653305f92f74 100644
--- a/unotools/source/config/configvaluecontainer.cxx
+++ b/unotools/source/config/configvaluecontainer.cxx
@@ -331,7 +331,7 @@ namespace utl
m_pImpl->xORB,
_rConfigLocation,
_nLevels,
- ( _nAccessFlags & CVC_UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_PREFER_UPDATABLE : OConfigurationTreeRoot::CM_READONLY,
+ ( _nAccessFlags & CVC_UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_UPDATABLE : OConfigurationTreeRoot::CM_READONLY,
( _nAccessFlags & CVC_IMMEDIATE_UPDATE ) ? sal_False : sal_True
);
#ifdef DBG_UTIL
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index 35e0fb8af223..39233f022534 100644..100755
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -1406,21 +1406,72 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage(
}
-bool SvtLinguConfig::HasAnyVendorImages() const
+::rtl::OUString SvtLinguConfig::GetThesaurusDialogImage(
+ const ::rtl::OUString &rServiceImplName,
+ bool bHighContrast ) const
{
- bool bRes = false;
- try
+ rtl::OUString aRes;
+ if (rServiceImplName.getLength() > 0)
{
- uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW );
+ rtl::OUString aImageName( A2OU( bHighContrast ? "ThesaurusDialogImage_HC" : "ThesaurusDialogImage" ));
+ rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
+ aRes = aPath;
+ }
+ return aRes;
+}
- uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() );
- bRes = aElementNames.getLength() > 0;
+
+::rtl::OUString SvtLinguConfig::GetSynonymsContextImage(
+ const ::rtl::OUString &rServiceImplName,
+ bool bHighContrast ) const
+{
+ rtl::OUString aRes;
+ if (rServiceImplName.getLength() > 0)
+ {
+ rtl::OUString aImageName( A2OU( bHighContrast ? "SynonymsContextMenuImage_HC" : "SynonymsContextMenuImage" ));
+ rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
+ aRes = aPath;
}
- catch (uno::Exception &)
+ return aRes;
+}
+
+
+bool SvtLinguConfig::HasVendorImages( const char *pImageName ) const
+{
+ bool bRes = false;
+ if (pImageName)
{
- DBG_ASSERT( 0, "exception caught. HasAnyVendorImages failed" );
+ try
+ {
+ uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW );
+
+ uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() );
+ sal_Int32 nVendors = aElementNames.getLength();
+ const rtl::OUString *pVendor = aElementNames.getConstArray();
+ for (sal_Int32 i = 0; i < nVendors; ++i)
+ {
+ uno::Reference< container::XNameAccess > xNA2( xNA->getByName( pVendor[i] ), uno::UNO_QUERY_THROW );
+ uno::Sequence< rtl::OUString > aPropNames( xNA2->getElementNames() );
+ sal_Int32 nProps = aPropNames.getLength();
+ const rtl::OUString *pPropNames = aPropNames.getConstArray();
+ for (sal_Int32 k = 0; k < nProps; ++k)
+ {
+ // for a quicker check we ignore the HC image names here
+ const OUString &rName = pPropNames[k];
+ if (rName.equalsAscii( pImageName ))
+ {
+ bRes = true;
+ break;
+ }
+ }
+ }
+ }
+ catch (uno::Exception &)
+ {
+ DBG_ASSERT( 0, "exception caught. HasVendorImages failed" );
+ }
}
return bRes;
}
diff --git a/unotools/source/i18n/transliterationwrapper.cxx b/unotools/source/i18n/transliterationwrapper.cxx
index 062e34286d4b..a10a52802e19 100644
--- a/unotools/source/i18n/transliterationwrapper.cxx
+++ b/unotools/source/i18n/transliterationwrapper.cxx
@@ -31,11 +31,12 @@
#include <unotools/transliterationwrapper.hxx>
#include <tools/debug.hxx>
#include <i18npool/mslangid.hxx>
-#ifndef _COMPHELPER_COMPONENTFACTORY_HXX_
#include <comphelper/componentfactory.hxx>
-#endif
+
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
#define TRANSLIT_LIBRARYNAME "i18n"
#define TRANSLIT_SERVICENAME "com.sun.star.i18n.Transliteration"
@@ -147,7 +148,10 @@ sal_Bool TransliterationWrapper::needLanguageForTheMode() const
{
return TransliterationModules_UPPERCASE_LOWERCASE == nType ||
TransliterationModules_LOWERCASE_UPPERCASE == nType ||
- TransliterationModules_IGNORE_CASE == nType;
+ TransliterationModules_IGNORE_CASE == nType ||
+ (sal_uInt32) TransliterationModulesExtra::SENTENCE_CASE == (sal_uInt32) nType ||
+ (sal_uInt32) TransliterationModulesExtra::TITLE_CASE == (sal_uInt32) nType ||
+ (sal_uInt32) TransliterationModulesExtra::TOGGLE_CASE == (sal_uInt32) nType;
}
@@ -165,14 +169,32 @@ void TransliterationWrapper::loadModuleIfNeeded( sal_uInt16 nLang )
sal_Bool bLoad = bFirstCall;
bFirstCall = sal_False;
- if( nLanguage != nLang )
+ if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::SENTENCE_CASE )
{
- setLanguageLocaleImpl( nLang );
- if( !bLoad )
- bLoad = needLanguageForTheMode();
+ if( bLoad )
+ loadModuleByImplName(String::CreateFromAscii("SENTENCE_CASE"), nLang);
+ }
+ else if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::TITLE_CASE )
+ {
+ if( bLoad )
+ loadModuleByImplName(String::CreateFromAscii("TITLE_CASE"), nLang);
+ }
+ else if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::TOGGLE_CASE )
+ {
+ if( bLoad )
+ loadModuleByImplName(String::CreateFromAscii("TOGGLE_CASE"), nLang);
+ }
+ else
+ {
+ if( nLanguage != nLang )
+ {
+ setLanguageLocaleImpl( nLang );
+ if( !bLoad )
+ bLoad = needLanguageForTheMode();
+ }
+ if( bLoad )
+ loadModuleImpl();
}
- if( bLoad )
- loadModuleImpl();
}
diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h
index d83067cb64b8..247de1b95dec 100644
--- a/vcl/aqua/inc/salgdi.h
+++ b/vcl/aqua/inc/salgdi.h
@@ -230,15 +230,15 @@ public:
CGPoint* makeCGptArray(ULONG nPoints, const SalPoint* pPtAry);
// native widget rendering methods that require mirroring
virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside );
+ const Point& aPos, BOOL& rIsInside );
virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const rtl::OUString& aCaption );
virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const rtl::OUString& aCaption );
+ const rtl::OUString& aCaption );
virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption,
+ const ImplControlValue& aValue, const rtl::OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
// get device resolution
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index 1ef370f43a92..5b1e24befc9b 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -473,7 +473,6 @@ static void AddPolygonToPath( CGMutablePathRef xPath,
const CGAffineTransform* pTransform = NULL;
const bool bHasCurves = rPolygon.areControlPointsUsed();
- bool bPendingCurve = false;
for( int nPointIdx = 0, nPrevIdx = 0;; nPrevIdx = nPointIdx++ )
{
int nClosedIdx = nPointIdx;
@@ -488,7 +487,7 @@ static void AddPolygonToPath( CGMutablePathRef xPath,
::basegfx::B2DPoint aPoint = rPolygon.getB2DPoint( nClosedIdx );
- if(bPixelSnap)
+ if( bPixelSnap)
{
// snap device coordinates to full pixels
aPoint.setX( basegfx::fround( aPoint.getX() ) );
@@ -498,9 +497,19 @@ static void AddPolygonToPath( CGMutablePathRef xPath,
if( bLineDraw )
aPoint += aHalfPointOfs;
- if( !nPointIdx ) // first point
+ if( !nPointIdx ) { // first point => just move there
CGPathMoveToPoint( xPath, pTransform, aPoint.getX(), aPoint.getY() );
- else if( !bPendingCurve ) // line segment
+ continue;
+ }
+
+ bool bPendingCurve = false;
+ if( bHasCurves )
+ {
+ bPendingCurve = rPolygon.isNextControlPointUsed( nPrevIdx );
+ bPendingCurve |= rPolygon.isPrevControlPointUsed( nClosedIdx );
+ }
+
+ if( !bPendingCurve ) // line segment
CGPathAddLineToPoint( xPath, pTransform, aPoint.getX(), aPoint.getY() );
else // cubic bezier segment
{
@@ -514,9 +523,6 @@ static void AddPolygonToPath( CGMutablePathRef xPath,
CGPathAddCurveToPoint( xPath, pTransform, aCP1.getX(), aCP1.getY(),
aCP2.getX(), aCP2.getY(), aPoint.getX(), aPoint.getY() );
}
-
- if( bHasCurves )
- bPendingCurve = rPolygon.isNextControlPointUsed( nClosedIdx );
}
if( bClosePath )
diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx
index b4b843eaca58..5eccf88dc523 100644
--- a/vcl/aqua/source/gdi/salnativewidgets.cxx
+++ b/vcl/aqua/source/gdi/salnativewidgets.cxx
@@ -380,7 +380,7 @@ BOOL AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart n
* nType/nPart combination.
*/
BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& rPos, SalControlHandle& rControlHandle, BOOL& rIsInside )
+ const Point& rPos, BOOL& rIsInside )
{
if ( nType == CTRL_SCROLLBAR )
{
@@ -468,7 +468,6 @@ UInt32 AquaSalGraphics::getTrackState( ControlState nState )
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the AquaSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL AquaSalGraphics::drawNativeControl(ControlType nType,
@@ -476,7 +475,6 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType,
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const rtl::OUString& aCaption )
{
BOOL bOK = FALSE;
@@ -1226,12 +1224,11 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the AquaSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const rtl::OUString& aCaption )
+ const rtl::OUString& aCaption )
{
return( FALSE );
}
@@ -1248,11 +1245,10 @@ BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPar
*
* rControlRegion: The bounding region of the control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the AquaSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption,
+ const ImplControlValue& aValue, const rtl::OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion )
{
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index 0fd028864bf4..b14354e1b4bd 100644
--- a/vcl/aqua/source/window/salframe.cxx
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -1357,40 +1357,81 @@ void AquaSalFrame::GetWorkArea( Rectangle& rRect )
SalPointerState AquaSalFrame::GetPointerState()
{
SalPointerState state;
+ state.mnState = 0;
// get position
NSPoint aPt = [mpWindow mouseLocationOutsideOfEventStream];
CocoaToVCL( aPt, false );
state.maPos = Point(static_cast<long>(aPt.x), static_cast<long>(aPt.y));
- // FIXME: replace Carbon by Cocoa
- // Cocoa does not have an equivalent for GetCurrentEventButtonState
- // and GetCurrentEventKeyModifiers.
- // we could try to get away with tracking all events for modifierKeys
- // and all mouse events for button state in VCL_NSApllication::sendEvent,
- // but it is unclear whether this will get us the same result.
- // leave in GetCurrentEventButtonState and GetCurrentEventKeyModifiers for now
+ NSEvent* pCur = [NSApp currentEvent];
+ bool bMouseEvent = false;
+ if( pCur )
+ {
+ bMouseEvent = true;
+ switch( [pCur type] )
+ {
+ case NSLeftMouseDown: state.mnState |= MOUSE_LEFT; break;
+ case NSLeftMouseUp: break;
+ case NSRightMouseDown: state.mnState |= MOUSE_RIGHT; break;
+ case NSRightMouseUp: break;
+ case NSOtherMouseDown: state.mnState |= ([pCur buttonNumber] == 2) ? MOUSE_MIDDLE : 0; break;
+ case NSOtherMouseUp: break;
+ case NSMouseMoved: break;
+ case NSLeftMouseDragged: state.mnState |= MOUSE_LEFT; break;
+ case NSRightMouseDragged: state.mnState |= MOUSE_RIGHT; break;
+ case NSOtherMouseDragged: state.mnState |= ([pCur buttonNumber] == 2) ? MOUSE_MIDDLE : 0; break;
+ break;
+ default:
+ bMouseEvent = false;
+ break;
+ }
+ }
+ if( bMouseEvent )
+ {
+ unsigned int nMask = (unsigned int)[pCur modifierFlags];
+ if( (nMask & NSShiftKeyMask) != 0 )
+ state.mnState |= KEY_SHIFT;
+ if( (nMask & NSControlKeyMask) != 0 )
+ state.mnState |= KEY_MOD3;
+ if( (nMask & NSAlternateKeyMask) != 0 )
+ state.mnState |= KEY_MOD2;
+ if( (nMask & NSCommandKeyMask) != 0 )
+ state.mnState |= KEY_MOD1;
+
+ }
+ else
+ {
+ // FIXME: replace Carbon by Cocoa
+ // Cocoa does not have an equivalent for GetCurrentEventButtonState
+ // and GetCurrentEventKeyModifiers.
+ // we could try to get away with tracking all events for modifierKeys
+ // and all mouse events for button state in VCL_NSApllication::sendEvent,
+ // but it is unclear whether this will get us the same result.
+ // leave in GetCurrentEventButtonState and GetCurrentEventKeyModifiers for now
+
+ // fill in button state
+ UInt32 nState = GetCurrentEventButtonState();
+ state.mnState = 0;
+ if( nState & 1 )
+ state.mnState |= MOUSE_LEFT; // primary button
+ if( nState & 2 )
+ state.mnState |= MOUSE_RIGHT; // secondary button
+ if( nState & 4 )
+ state.mnState |= MOUSE_MIDDLE; // tertiary button
+
+ // fill in modifier state
+ nState = GetCurrentEventKeyModifiers();
+ if( nState & shiftKey )
+ state.mnState |= KEY_SHIFT;
+ if( nState & controlKey )
+ state.mnState |= KEY_MOD3;
+ if( nState & optionKey )
+ state.mnState |= KEY_MOD2;
+ if( nState & cmdKey )
+ state.mnState |= KEY_MOD1;
+ }
- // fill in button state
- UInt32 nState = GetCurrentEventButtonState();
- state.mnState = 0;
- if( nState & 1 )
- state.mnState |= MOUSE_LEFT; // primary button
- if( nState & 2 )
- state.mnState |= MOUSE_RIGHT; // secondary button
- if( nState & 4 )
- state.mnState |= MOUSE_MIDDLE; // tertiary button
-
- // fill in modifier state
- nState = GetCurrentEventKeyModifiers();
- if( nState & shiftKey )
- state.mnState |= KEY_SHIFT;
- if( nState & controlKey )
- state.mnState |= KEY_MOD3;
- if( nState & optionKey )
- state.mnState |= KEY_MOD2;
- if( nState & cmdKey )
- state.mnState |= KEY_MOD1;
return state;
}
diff --git a/vcl/inc/vcl/dockwin.hxx b/vcl/inc/vcl/dockwin.hxx
index 3a1dca044bb7..61464400d595 100644
--- a/vcl/inc/vcl/dockwin.hxx
+++ b/vcl/inc/vcl/dockwin.hxx
@@ -152,7 +152,7 @@ public:
void Unlock();
BOOL IsLocked() const;
- void StartPopupMode( ToolBox* pParentToolBox );
+ void StartPopupMode( ToolBox* pParentToolBox, ULONG nPopupModeFlags );
BOOL IsInPopupMode() const;
void TitleButtonClick( USHORT nButton );
@@ -234,7 +234,10 @@ public:
BOOL IsLocked( const Window *pWin );
void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin );
+ void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin, ULONG nPopupModeFlags );
+
BOOL IsInPopupMode( const Window *pWin );
+ void EndPopupMode( const Window *pWin );
// required because those methods are not virtual in Window (!!!) and must
// be availbale from the toolkit
diff --git a/vcl/inc/vcl/graphite_cache.hxx b/vcl/inc/vcl/graphite_cache.hxx
index eba5109c7446..5472b32dd62f 100644
--- a/vcl/inc/vcl/graphite_cache.hxx
+++ b/vcl/inc/vcl/graphite_cache.hxx
@@ -127,7 +127,7 @@ public:
}
m_segMap.clear();
};
- GrSegRecord * getSegment(ImplLayoutArgs & layoutArgs, bool bIsRtl)
+ GrSegRecord * getSegment(ImplLayoutArgs & layoutArgs, bool bIsRtl, int segCharLimit)
{
GrSegRecord * found = NULL;
// try to find a segment starting at correct place, if not, try to find a
@@ -152,8 +152,6 @@ public:
if (found->m_seg->startCharacter() <= layoutArgs.mnMinCharPos &&
found->m_seg->stopCharacter() >= layoutArgs.mnEndCharPos)
{
- const size_t seg_char_limit = min(layoutArgs.mnLength, layoutArgs.mnEndCharPos
- + GraphiteLayout::EXTRA_CONTEXT_LENGTH);
DBG_ASSERT(found && found->m_seg, "null entry in GraphiteSegmentCache");
// restore original start character, in case it has changed
found->m_seg->setTextSourceOffset(found->m_startChar);
@@ -161,7 +159,7 @@ public:
// interest
// We could use substr and ==, but substr does a copy,
// so its probably faster to do it like this
- for (size_t i = layoutArgs.mnMinCharPos; i < seg_char_limit; i++)
+ for (int i = layoutArgs.mnMinCharPos; i < segCharLimit; i++)
{
//if (!found->m_rope->match(rtl::OUString(layoutArgs.mpStr[i], layoutArgs.mnLength), i - found->m_seg->startCharacter()))
if (found->m_rope->getStr()[i-found->m_seg->startCharacter()] != layoutArgs.mpStr[i])
@@ -171,6 +169,15 @@ public:
{
return NULL;
}
+ if (found->m_seg->stopCharacter() > layoutArgs.mnEndCharPos &&
+ static_cast<int>(found->char2BaseGlyph().size()) > layoutArgs.mnEndCharPos)
+ {
+ // check that the requested end character isn't mid cluster
+ if (found->char2BaseGlyph()[layoutArgs.mnEndCharPos-layoutArgs.mnMinCharPos] == -1)
+ {
+ return NULL;
+ }
+ }
// if (found->m_lockCount != 0)
// OutputDebugString("Multple users of SegRecord!");
found->m_lockCount++;
@@ -183,10 +190,8 @@ public:
// this is expecially needed when editing a large paragraph
// each edit changes the pointers, but if we don't reuse any segments it gets very
// slow.
- const size_t seg_char_limit = min(layoutArgs.mnLength, layoutArgs.mnEndCharPos
- + GraphiteLayout::EXTRA_CONTEXT_LENGTH);
rtl::OUString * rope = new rtl::OUString(layoutArgs.mpStr + layoutArgs.mnMinCharPos,
- seg_char_limit - layoutArgs.mnMinCharPos);
+ segCharLimit - layoutArgs.mnMinCharPos);
if (!rope) return NULL;
size_t nHash = (*(rope)).hashCode();
GrRMEntry range = m_ropeMap.equal_range(nHash);
diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx
index 1fbb11211ca0..520f4620cd90 100644
--- a/vcl/inc/vcl/graphite_layout.hxx
+++ b/vcl/inc/vcl/graphite_layout.hxx
@@ -75,6 +75,14 @@ namespace grutils { class GrFeatureParser; }
class VCL_DLLPUBLIC GraphiteLayout : public SalLayout
{
public:
+ // Mask to allow Word break status to be stored within mvChar2BaseGlyph
+ enum {
+ WORD_BREAK_BEFORE = 0x40000000,
+ HYPHEN_BREAK_BEFORE = 0x80000000,
+ BREAK_MASK = 0xC0000000,
+ GLYPH_INDEX_MASK = 0x3FFFFFFF
+ } LineBreakMask;
+
class Glyphs : public std::vector<GlyphItem>
{
public:
@@ -159,6 +167,7 @@ private:
std::pair<int,int> glyph_to_chars(const GlyphItem &) const;
std::pair<long,long> caret_positions(size_t) const;
+ void expandOrCondense(ImplLayoutArgs &rArgs);
};
diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx
index 4bca986812ed..30308aa8a723 100644
--- a/vcl/inc/vcl/help.hxx
+++ b/vcl/inc/vcl/help.hxx
@@ -48,6 +48,7 @@ class Window;
#define QUICKHELP_BOTTOM ((USHORT)0x0020)
#define QUICKHELP_NOAUTOPOS (QUICKHELP_LEFT | QUICKHELP_CENTER | QUICKHELP_RIGHT | QUICKHELP_TOP | QUICKHELP_VCENTER | QUICKHELP_BOTTOM)
#define QUICKHELP_CTRLTEXT ((USHORT)0x0040)
+#define QUICKHELP_NOEVADEPOINTER ((USHORT)0x4000)
#define QUICKHELP_BIDI_RTL ((USHORT)0x8000)
// By changes you must also change: rsc/vclrsc.hxx
diff --git a/vcl/inc/vcl/impfont.hxx b/vcl/inc/vcl/impfont.hxx
index 6ce9f21500b5..a1104bbf4a86 100644
--- a/vcl/inc/vcl/impfont.hxx
+++ b/vcl/inc/vcl/impfont.hxx
@@ -177,7 +177,8 @@ class CmapResult;
class VCL_DLLPUBLIC ImplFontCharMap
{
public:
- explicit ImplFontCharMap( const CmapResult& );
+ explicit ImplFontCharMap( const CmapResult& );
+ virtual ~ImplFontCharMap();
static ImplFontCharMap* GetDefaultMap( bool bSymbols=false);
@@ -201,7 +202,6 @@ public:
int GetGlyphIndex( sal_uInt32 ) const;
private:
- /*virtual*/ ~ImplFontCharMap();
int ImplFindRangeIndex( sal_uInt32 ) const;
// prevent assignment and copy construction
diff --git a/vcl/inc/vcl/lstbox.hxx b/vcl/inc/vcl/lstbox.hxx
index 98cd05d999dd..3659e5aee485 100644
--- a/vcl/inc/vcl/lstbox.hxx
+++ b/vcl/inc/vcl/lstbox.hxx
@@ -130,6 +130,7 @@ public:
virtual USHORT GetEntryPos( const XubString& rStr ) const;
virtual USHORT GetEntryPos( const void* pData ) const;
+ Image GetEntryImage( USHORT nPos ) const;
virtual XubString GetEntry( USHORT nPos ) const;
virtual USHORT GetEntryCount() const;
diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx
index 70c1e6aa624d..9b748f2b5937 100644
--- a/vcl/inc/vcl/outdev.hxx
+++ b/vcl/inc/vcl/outdev.hxx
@@ -39,6 +39,7 @@
#include <vcl/mapmod.hxx>
#include <vcl/wall.hxx>
#include <vcl/settings.hxx>
+#include <vcl/salnativewidgets.hxx>
#include <tools/poly.hxx>
#include <basegfx/vector/b2enums.hxx>
#include <com/sun/star/uno/Reference.h>
@@ -1177,6 +1178,49 @@ public:
BitmapEx GetDownsampledBitmapEx( const Size& rDstSz,
const Point& rSrcPt, const Size& rSrcSz,
const BitmapEx& rBmpEx, long nMaxBmpDPIX, long nMaxBmpDPIY );
+
+ //-------------------------------------
+ // Native Widget Rendering functions
+ //-------------------------------------
+
+ // These all just call through to the private mpGraphics functions of the same name.
+
+ // Query the platform layer for control support
+ BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart );
+
+ // Query the native control to determine if it was acted upon
+ BOOL HitTestNativeControl( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ const Point& aPos,
+ BOOL& rIsInside );
+
+ // Request rendering of a particular control and/or part
+ BOOL DrawNativeControl( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ ::rtl::OUString aCaption );
+
+ // Request rendering of a caption string for a control
+ BOOL DrawNativeControlText( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ ::rtl::OUString aCaption );
+
+ // Query the native control's actual drawing region (including adornment)
+ BOOL GetNativeControlRegion( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ ::rtl::OUString aCaption,
+ Region &rNativeBoundingRegion,
+ Region &rNativeContentRegion );
+
};
#endif // _SV_OUTDEV_HXX
diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx
index 02e9efbc0f94..510e797678b0 100644
--- a/vcl/inc/vcl/salgdi.hxx
+++ b/vcl/inc/vcl/salgdi.hxx
@@ -159,15 +159,15 @@ protected:
// native widget rendering methods that require mirroring
virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside );
+ const Point& aPos, BOOL& rIsInside );
virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const rtl::OUString& aCaption );
virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const rtl::OUString& aCaption );
+ const rtl::OUString& aCaption );
virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption,
+ const ImplControlValue& aValue, const rtl::OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
/** Render bitmap with alpha channel
@@ -442,7 +442,6 @@ public:
ControlPart nPart,
const Region& rControlRegion,
const Point& aPos,
- SalControlHandle& rControlHandle,
BOOL& rIsInside,
const OutputDevice *pOutDev );
@@ -452,7 +451,6 @@ public:
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const rtl::OUString& aCaption,
const OutputDevice *pOutDev );
@@ -462,7 +460,6 @@ public:
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const rtl::OUString& aCaption,
const OutputDevice *pOutDev );
@@ -472,7 +469,6 @@ public:
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const rtl::OUString& aCaption,
Region &rNativeBoundingRegion,
Region &rNativeContentRegion,
diff --git a/vcl/inc/vcl/syswin.hxx b/vcl/inc/vcl/syswin.hxx
index b0e74df9a767..b3a7d9b8775e 100644
--- a/vcl/inc/vcl/syswin.hxx
+++ b/vcl/inc/vcl/syswin.hxx
@@ -179,6 +179,8 @@ private:
SystemWindow (const SystemWindow &);
SystemWindow & operator= (const SystemWindow &);
+ SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, Window* i_pConfigureWin );
+
protected:
// Single argument ctors shall be explicit.
explicit SystemWindow( WindowType nType );
diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx
index fcf1d2ee0387..8ccb880fce34 100644
--- a/vcl/inc/vcl/vclevent.hxx
+++ b/vcl/inc/vcl/vclevent.hxx
@@ -154,8 +154,8 @@ namespace com { namespace sun { namespace star {
#define VCLEVENT_TOOLBOX_FORMATCHANGED 1172 // request new layout
#define VCLEVENT_COMBOBOX_SETTEXT 1173
// --> OD 2009-04-01 #i92103#
-#define VCLEVENT_LISTBOX_ENTRY_EXPANDED 1174
-#define VCLEVENT_LISTBOX_ENTRY_COLLAPSED 1175
+#define VCLEVENT_ITEM_EXPANDED 1174
+#define VCLEVENT_ITEM_COLLAPSED 1175
// <--
#define VCLEVENT_DROPDOWN_PRE_OPEN 1176
diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h
index 9d917a09b6de..691c3ed18421 100644
--- a/vcl/inc/vcl/window.h
+++ b/vcl/inc/vcl/window.h
@@ -56,7 +56,6 @@ class VirtualDevice;
class Cursor;
class ImplDevFontList;
class ImplFontCache;
-class SalControlHandle;
class SmartId;
class VCLXWindow;
class SalFrame;
@@ -120,7 +119,6 @@ struct ImplWinData
USHORT mnTrackFlags;
USHORT mnIsTopWindow;
BOOL mbMouseOver; // tracks mouse over for native widget paint effect
- SalControlHandle* mpSalControlHandle; // native data for NWF
BOOL mbEnableNativeWidget; // toggle native widget rendering
SmartId* mpSmartHelpId;
SmartId* mpSmartUniqueId;
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index 3d1cc91ee468..8264767e59ad 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -124,6 +124,8 @@ namespace dnd {
namespace vcl { struct ControlLayoutData; }
+namespace svt { class PopupWindowControllerImpl; }
+
// ---------------
// - WindowTypes -
// ---------------
@@ -362,6 +364,8 @@ class VCL_DLLPUBLIC Window : public OutputDevice
friend class ImplPopupFloatWin;
friend class MenuFloatingWindow;
+ friend class svt::PopupWindowControllerImpl;
+
private:
// NOTE: to remove many dependencies of other modules
// to this central file, all members are now hidden
@@ -548,20 +552,18 @@ public:
SAL_DLLPRIVATE ::std::vector<Window *>& ImplGetOwnerDrawList();
SAL_DLLPRIVATE Window* ImplGetTopmostFrameWindow();
- SAL_DLLPRIVATE Rectangle ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly );
+ SAL_DLLPRIVATE Rectangle ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) const;
SAL_DLLPRIVATE void ImplNotifyIconifiedState( BOOL bIconified );
SAL_DLLPRIVATE bool ImplStopDnd();
SAL_DLLPRIVATE void ImplStartDnd();
SAL_DLLPRIVATE static void ImplInitAppFontData( Window* pWindow );
- SAL_DLLPRIVATE void ImplInitSalControlHandle();
SAL_DLLPRIVATE void ImplPaintToDevice( OutputDevice* pTargetOutDev, const Point& rPos );
SAL_DLLPRIVATE BOOL ImplIsInTaskPaneList();
SAL_DLLPRIVATE void ImplIsInTaskPaneList( BOOL mbIsInTaskList );
SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas >
ImplGetCanvas( const Size& rFullscreenSize, bool bFullscreen, bool bSpriteCanvas ) const;
- SAL_DLLPRIVATE void ImplMoveControlValue( ControlType, const ImplControlValue&, const Point& ) const;
private:
// Default construction is forbidden and not implemented.
@@ -856,9 +858,9 @@ public:
Point AbsoluteScreenToOutputPixel( const Point& rPos ) const;
Rectangle GetDesktopRectPixel() const;
// window extents including border and decoratrion
- Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
+ Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
// window extents of the client window, coordinates to be used in SetPosPixel
- Rectangle GetClientWindowExtentsRelative( Window *pRelativeWindow );
+ Rectangle GetClientWindowExtentsRelative( Window *pRelativeWindow ) const;
virtual BOOL IsScrollable() const;
virtual void Scroll( long nHorzScroll, long nVertScroll,
@@ -1092,44 +1094,6 @@ public:
void EnableNativeWidget( BOOL bEnable = TRUE );
BOOL IsNativeWidgetEnabled() const;
- // These all just call through to the private mpWindowImpl->mpFrame functions of the same name.
-
- // Query the platform layer for control support
- BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart );
-
- // Query the native control to determine if it was acted upon
- BOOL HitTestNativeControl( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- const Point& aPos,
- BOOL& rIsInside );
-
- // Request rendering of a particular control and/or part
- BOOL DrawNativeControl( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- rtl::OUString aCaption );
-
- // Request rendering of a caption string for a control
- BOOL DrawNativeControlText( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- rtl::OUString aCaption );
-
- // Query the native control's actual drawing region (including adornment)
- BOOL GetNativeControlRegion( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- rtl::OUString aCaption,
- Region &rNativeBoundingRegion,
- Region &rNativeContentRegion );
-
// a helper method for a Control's Draw method
void PaintToDevice( OutputDevice* pDevice, const Point& rPos, const Size& rSize );
diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h
index ce486084a5b1..b8dc4eba0199 100644
--- a/vcl/os2/inc/salgdi.h
+++ b/vcl/os2/inc/salgdi.h
@@ -197,15 +197,15 @@ protected:
#if 0
// native widget rendering methods that require mirroring
virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside );
+ const Point& aPos, BOOL& rIsInside );
virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
rtl::OUString aCaption );
virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, rtl::OUString aCaption );
+ rtl::OUString aCaption );
virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, rtl::OUString aCaption,
+ const ImplControlValue& aValue, rtl::OUString aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
#endif
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index b4ab10887fcd..ac1da931ba06 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -759,18 +759,26 @@ void ImplSetHelpWindowPos( Window* pHelpWin, USHORT nHelpWinStyle, USHORT nStyle
else if ( ( aPos.Y() + aSz.Height() ) > aScreenRect.Bottom() )
aPos.Y() = aScreenRect.Bottom() - aSz.Height();
- // the popup must not appear under the mouse
- // otherwise it would directly be closed due to a focus change...
- Rectangle aHelpRect( aPos, aSz );
- if( aHelpRect.IsInside( mPos ) )
+ if( ! (nStyle & QUICKHELP_NOEVADEPOINTER) )
{
- Point delta(2,2);
- Point pSize( aSz.Width(), aSz.Height() );
- Point pTest( mPos - pSize - delta );
- if( pTest.X() > aScreenRect.Left() && pTest.Y() > aScreenRect.Top() )
- aPos = pTest;
- else
- aPos = mPos + delta;
+ /* the remark below should be obsolete by now as the helpwindow should
+ not be focusable, leaving it as a hint. However it is sensible in most
+ conditions to evade the mouse pointer so the content window is fully visible.
+
+ // the popup must not appear under the mouse
+ // otherwise it would directly be closed due to a focus change...
+ */
+ Rectangle aHelpRect( aPos, aSz );
+ if( aHelpRect.IsInside( mPos ) )
+ {
+ Point delta(2,2);
+ Point pSize( aSz.Width(), aSz.Height() );
+ Point pTest( mPos - pSize - delta );
+ if( pTest.X() > aScreenRect.Left() && pTest.Y() > aScreenRect.Top() )
+ aPos = pTest;
+ else
+ aPos = mPos + delta;
+ }
}
Window* pWindow = pHelpWin->GetParent()->ImplGetFrameWindow();
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index cd74a4cd88ce..ebccfdc1e6bb 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -741,6 +741,13 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry )
aMetrics.nEntryHeight );
}
+ if ( !aMetrics.bText && !aMetrics.bImage && !IsUserDrawEnabled() )
+ {
+ // entries which have no (aka an empty) text, and no image, and are not user-drawn, should be
+ // shown nonetheless
+ aMetrics.nEntryHeight = mnTextHeight + mnBorder;
+ }
+
if ( aMetrics.nEntryWidth > mnMaxWidth )
mnMaxWidth = aMetrics.nEntryWidth;
if ( aMetrics.nEntryHeight > mnMaxHeight )
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 70b67c0a3d57..6c7df5b106bf 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -885,6 +885,8 @@ void ListBox::StateChanged( StateChangedType nType )
{
SetStyle( ImplInitStyle( GetStyle() ) );
mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE );
+ BOOL bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? TRUE : FALSE;
+ mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
}
else if( nType == STATE_CHANGE_MIRRORING )
{
@@ -1081,6 +1083,15 @@ void ListBox::RemoveEntry( USHORT nPos )
// -----------------------------------------------------------------------
+Image ListBox::GetEntryImage( USHORT nPos ) const
+{
+ if ( mpImplLB->GetEntryList()->HasEntryImage( nPos ) )
+ return mpImplLB->GetEntryList()->GetEntryImage( nPos );
+ return Image();
+}
+
+// -----------------------------------------------------------------------
+
USHORT ListBox::GetEntryPos( const XubString& rStr ) const
{
USHORT nPos = mpImplLB->GetEntryList()->FindEntry( rStr );
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 89fbe6d3db78..95f84626b582 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -408,6 +408,9 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth )
if( aImageSize.Height() > aSize.Height() )
aSize.Height() = aImageSize.Height();
+ aSize.Width() += TAB_TABOFFSET_X*2;
+ aSize.Height() += TAB_TABOFFSET_Y*2;
+
Region aCtrlRegion( Rectangle( (const Point&)Point( 0, 0 ), aSize ) );
Region aBoundingRgn, aContentRgn;
const ImplControlValue aControlValue( BUTTONVALUE_DONTKNOW, rtl::OUString(), 0 );
@@ -419,8 +422,6 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth )
return aCont.GetSize();
}
- aSize.Width() += TAB_TABOFFSET_X*2;
- aSize.Height() += TAB_TABOFFSET_Y*2;
// For systems without synthetic bold support
if ( mbExtraSpace )
aSize.Width() += TAB_EXTRASPACE_X;
diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index 620ca64f44d9..cb565122ea63 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -469,7 +469,7 @@ public: // TODO: is public really needed?
private:
// typeop exceution context
int mnStackIdx;
- ValType mnValStack[ NMAXSTACK];
+ ValType mnValStack[ NMAXSTACK+4];
ValType mnTransVals[ NMAXTRANS];
int mnHintSize;
@@ -1242,16 +1242,33 @@ void CffSubsetterContext::convertOneTypeEsc( void)
break;
}
case TYPE2OP::HFLEX1: {
- assert( mnStackIdx == 9 );
- writeCurveTo( mnStackIdx, -9, -8, -7, -6, -5, -6 );
- writeCurveTo( mnStackIdx, -4, -6, -3, -2, -1, -8 );
+ assert( mnStackIdx == 9);
+#if 0 // emulate hflex1 as straight line
+ const ValType* pX = &mnValStack[ mnStackIdx];
+ const ValType fDX = pX[-9] + pX[-7] + pX[-5] + pX[-4] + pX[-3] + pX[-1];
+ writeType1Val( fDX);
+ writeTypeOp( TYPE1OP::HLINETO);
+#else // emulate hflex1 as two curves
+ writeCurveTo( mnStackIdx, -9, -8, -7, -6, -5, 0);
+ writeCurveTo( mnStackIdx, -4, 0, -3, -2, -1, 0);
+ // TODO: emulate hflex1 using othersubr call
+#endif
mnStackIdx -= 9;
}
break;
case TYPE2OP::HFLEX: {
- assert( mnStackIdx == 7 );
- writeCurveTo( mnStackIdx, -7, 0, -6, -5, -4, -5 );
- writeCurveTo( mnStackIdx, -3, -5, -2, 0, -1, 0 );
+ assert( mnStackIdx == 7);
+ ValType* pX = &mnValStack[ mnStackIdx];
+#if 0 // emulate hflex as straight line
+ const ValType fDX = pX[-7] + pX[-6] + pX[-4] + pX[-3] + pX[-2] + pX[-1];
+ writeType1Val( fDX);
+ writeTypeOp( TYPE1OP::HLINETO);
+#else // emulate hflex as two curves
+ pX[+1] = -pX[-5]; // temp: +dy5==-dy2
+ writeCurveTo( mnStackIdx, -7, 0, -6, -5, -4, 0);
+ writeCurveTo( mnStackIdx, -3, 0, -2, +1, -1, 0);
+ // TODO: emulate hflex using othersubr call
+#endif
mnStackIdx -= 7;
}
break;
diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx
index e3f63a03d081..e79308b2664e 100644
--- a/vcl/source/gdi/image.cxx
+++ b/vcl/source/gdi/image.cxx
@@ -50,6 +50,10 @@
#include <vcl/image.h>
#include <vcl/image.hxx>
+#if OSL_DEBUG_LEVEL > 0
+#include <rtl/strbuf.hxx>
+#endif
+
DBG_NAME( Image )
DBG_NAME( ImageList )
@@ -543,11 +547,19 @@ void ImageAryData::Load(const rtl::OUString &rPrefix)
rtl::OUString aFileName = rPrefix;
aFileName += maName;
-#ifdef DBG_UTIL
- bool bSuccess = aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true );
- DBG_ASSERT (bSuccess, "ImageAryData::Failed to load image");
-#else
- aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true );
+#if OSL_DEBUG_LEVEL > 0
+ bool bSuccess =
+#endif
+ aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true );
+#if OSL_DEBUG_LEVEL > 0
+ if ( !bSuccess )
+ {
+ ::rtl::OStringBuffer aMessage;
+ aMessage.append( "ImageAryData::Load: failed to load image '" );
+ aMessage.append( ::rtl::OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ aMessage.append( "'" );
+ OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+ }
#endif
}
diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk
index 75f2b3fffc64..f069828f25f9 100644..100755
--- a/vcl/source/gdi/makefile.mk
+++ b/vcl/source/gdi/makefile.mk
@@ -106,6 +106,7 @@ SLOFILES= $(EXCEPTIONSFILES) \
$(SLO)$/outdev4.obj \
$(SLO)$/outdev5.obj \
$(SLO)$/outdev6.obj \
+ $(SLO)$/outdevnative.obj \
$(SLO)$/regband.obj \
$(SLO)$/region.obj \
$(SLO)$/wall.obj \
diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx
index e5f54df41c9e..325146b6be8a 100644
--- a/vcl/source/gdi/metric.cxx
+++ b/vcl/source/gdi/metric.cxx
@@ -386,8 +386,9 @@ int ImplFontCharMap::GetGlyphIndex( sal_uInt32 cChar ) const
const bool bSymbolic = (mpRangeCodes[0]>=0xF000) & (mpRangeCodes[1]<=0xF0FF);
if( !bSymbolic )
return 0;
- // check for symbol aliasing (U+F0xx -> U+00xx)
- nRange = ImplFindRangeIndex( cChar | 0xF000 );
+ // check for symbol aliasing (U+00xx <-> U+F0xx)
+ cChar |= 0xF000;
+ nRange = ImplFindRangeIndex( cChar );
}
// check that we are inside a range
if( (nRange & 1) != 0 )
@@ -401,7 +402,7 @@ int ImplFontCharMap::GetGlyphIndex( sal_uInt32 cChar ) const
nGlyphIndex += nStartIndex;
} else {
// the glyphid array has the glyph index
- nGlyphIndex = mpGlyphIds[ nGlyphIndex - nStartIndex];
+ nGlyphIndex = mpGlyphIds[ nGlyphIndex - nStartIndex ];
}
return nGlyphIndex;
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index 62be0130e068..bb5e4e3ba36d 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -2383,6 +2383,16 @@ void OutputDevice::impPaintLineGeometryWithEvtlExpand(
{
const double fHalfLineWidth((rInfo.GetWidth() * 0.5) + 0.5);
+ if(aLinePolyPolygon.areControlPointsUsed())
+ {
+ // #i110768# When area geometry has to be created, do not
+ // use the fallback bezier decomposition inside createAreaGeometry,
+ // but one that is at least as good as ImplSubdivideBezier was.
+ // There, Polygon::AdaptiveSubdivide was used with default parameter
+ // 1.0 as quality index.
+ aLinePolyPolygon = basegfx::tools::adaptiveSubdivideByDistance(aLinePolyPolygon, 1.0);
+ }
+
for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
{
aFillPolyPolygon.append(basegfx::tools::createAreaGeometry(
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index f4fcba72b0c2..949d3df5275f 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -579,6 +579,7 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang,
{
aFont.SetHeight( nDefaultHeight );
aFont.SetWeight( WEIGHT_NORMAL );
+ aFont.SetLanguage( eLang );
if ( aFont.GetCharSet() == RTL_TEXTENCODING_DONTKNOW )
aFont.SetCharSet( gsl_getSystemTextEncoding() );
diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx
new file mode 100644
index 000000000000..fed41ec4de85
--- /dev/null
+++ b/vcl/source/gdi/outdevnative.cxx
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "vcl/outdev.hxx"
+#include "vcl/window.hxx"
+#include "vcl/salgdi.hxx"
+#include "vcl/salnativewidgets.hxx"
+#include "vcl/pdfextoutdevdata.hxx"
+
+// -----------------------------------------------------------------------
+
+static bool lcl_enableNativeWidget( const OutputDevice& i_rDevice )
+{
+ const OutDevType eType( i_rDevice.GetOutDevType() );
+ switch ( eType )
+ {
+
+ case OUTDEV_WINDOW:
+ return dynamic_cast< const Window* >( &i_rDevice )->IsNativeWidgetEnabled();
+
+ case OUTDEV_VIRDEV:
+ {
+ const ::vcl::ExtOutDevData* pOutDevData( i_rDevice.GetExtOutDevData() );
+ const ::vcl::PDFExtOutDevData* pPDFData( dynamic_cast< const ::vcl::PDFExtOutDevData* >( pOutDevData ) );
+ if ( pPDFData != NULL )
+ return false;
+ return true;
+ }
+
+ default:
+ return false;
+ }
+}
+
+// -----------------------------------------------------------------------
+// These functions are mainly passthrough functions that allow access to
+// the SalFrame behind a Window object for native widget rendering purposes.
+// -----------------------------------------------------------------------
+
+// -----------------------------------------------------------------------
+
+BOOL OutputDevice::IsNativeControlSupported( ControlType nType, ControlPart nPart )
+{
+ if( !lcl_enableNativeWidget( *this ) )
+ return FALSE;
+
+ if ( !mpGraphics )
+ if ( !ImplGetGraphics() )
+ return FALSE;
+
+ return( mpGraphics->IsNativeControlSupported(nType, nPart) );
+}
+
+
+// -----------------------------------------------------------------------
+
+BOOL OutputDevice::HitTestNativeControl( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ const Point& aPos,
+ BOOL& rIsInside )
+{
+ if( !lcl_enableNativeWidget( *this ) )
+ return FALSE;
+
+ if ( !mpGraphics )
+ if ( !ImplGetGraphics() )
+ return FALSE;
+
+ Point aWinOffs( mnOutOffX, mnOutOffY );
+ Region screenRegion( rControlRegion );
+ screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
+
+ return( mpGraphics->HitTestNativeControl(nType, nPart, screenRegion, Point( aPos.X() + mnOutOffX, aPos.Y() + mnOutOffY ),
+ rIsInside, this ) );
+}
+
+// -----------------------------------------------------------------------
+
+static void lcl_moveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta )
+{
+ if( aValue.getOptionalVal() )
+ {
+ switch( nType )
+ {
+ case CTRL_SLIDER:
+ {
+ SliderValue* pSlVal = reinterpret_cast<SliderValue*>(aValue.getOptionalVal());
+ pSlVal->maThumbRect.Move( rDelta.X(), rDelta.Y() );
+ }
+ break;
+ case CTRL_SCROLLBAR:
+ {
+ ScrollbarValue* pScVal = reinterpret_cast<ScrollbarValue*>(aValue.getOptionalVal());
+ pScVal->maThumbRect.Move( rDelta.X(), rDelta.Y() );
+ pScVal->maButton1Rect.Move( rDelta.X(), rDelta.Y() );
+ pScVal->maButton2Rect.Move( rDelta.X(), rDelta.Y() );
+ }
+ break;
+ case CTRL_SPINBOX:
+ case CTRL_SPINBUTTONS:
+ {
+ SpinbuttonValue* pSpVal = reinterpret_cast<SpinbuttonValue*>(aValue.getOptionalVal());
+ pSpVal->maUpperRect.Move( rDelta.X(), rDelta.Y() );
+ pSpVal->maLowerRect.Move( rDelta.X(), rDelta.Y() );
+ }
+ break;
+ case CTRL_TOOLBAR:
+ {
+ ToolbarValue* pTVal = reinterpret_cast<ToolbarValue*>(aValue.getOptionalVal());
+ pTVal->maGripRect.Move( rDelta.X(), rDelta.Y() );
+ }
+ break;
+ }
+ }
+}
+
+BOOL OutputDevice::DrawNativeControl( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ ::rtl::OUString aCaption )
+{
+ if( !lcl_enableNativeWidget( *this ) )
+ return FALSE;
+
+ /*
+ if( !IsInPaint() && IsPaintTransparent() )
+ {
+ // only required if called directly (ie, we're not in Paint() ):
+ // force redraw (Paint()) for transparent controls
+ // to trigger a repaint of the background
+ Region aClipRgn( GetClipRegion() );
+ if( !rControlRegion.IsEmpty() )
+ aClipRgn.Intersect( rControlRegion );
+ Invalidate( aClipRgn, INVALIDATE_UPDATE );
+ return TRUE;
+ }
+ */
+
+ // make sure the current clip region is initialized correctly
+ if ( !mpGraphics )
+ if ( !ImplGetGraphics() )
+ return FALSE;
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return TRUE;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+
+ // Convert the coordinates from relative to Window-absolute, so we draw
+ // in the correct place in platform code
+ Point aWinOffs( mnOutOffX, mnOutOffY );
+ Region screenRegion( rControlRegion );
+ screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
+
+ // do so for ImplControlValue members, also
+ lcl_moveControlValue( nType, aValue, aWinOffs );
+
+ Region aTestRegion( GetActiveClipRegion() );
+ aTestRegion.Intersect( rControlRegion );
+ if( aTestRegion == rControlRegion )
+ nState |= CTRL_CACHING_ALLOWED; // control is not clipped, caching allowed
+
+ BOOL bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, aValue, aCaption, this );
+
+ // transform back ImplControlValue members
+ lcl_moveControlValue( nType, aValue, Point()-aWinOffs );
+
+ return bRet;
+}
+
+
+// -----------------------------------------------------------------------
+
+BOOL OutputDevice::DrawNativeControlText(ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ ::rtl::OUString aCaption )
+{
+ if( !lcl_enableNativeWidget( *this ) )
+ return FALSE;
+
+ // make sure the current clip region is initialized correctly
+ if ( !mpGraphics )
+ if ( !ImplGetGraphics() )
+ return false;
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return true;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+
+ // Convert the coordinates from relative to Window-absolute, so we draw
+ // in the correct place in platform code
+ Point aWinOffs( mnOutOffX, mnOutOffY );
+ Region screenRegion( rControlRegion );
+ screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
+ lcl_moveControlValue( nType, aValue, aWinOffs );
+
+ BOOL bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, aValue, aCaption, this );
+
+ // transform back ImplControlValue members
+ lcl_moveControlValue( nType, aValue, Point()-aWinOffs );
+
+ return bRet;
+}
+
+
+// -----------------------------------------------------------------------
+
+BOOL OutputDevice::GetNativeControlRegion( ControlType nType,
+ ControlPart nPart,
+ const Region& rControlRegion,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ ::rtl::OUString aCaption,
+ Region &rNativeBoundingRegion,
+ Region &rNativeContentRegion )
+{
+ if( !lcl_enableNativeWidget( *this ) )
+ return FALSE;
+
+ if ( !mpGraphics )
+ if ( !ImplGetGraphics() )
+ return FALSE;
+
+ // Convert the coordinates from relative to Window-absolute, so we draw
+ // in the correct place in platform code
+ Point aWinOffs( mnOutOffX, mnOutOffY );
+ Region screenRegion( rControlRegion );
+ screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
+ lcl_moveControlValue( nType, aValue, aWinOffs );
+
+ BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, aValue,
+ aCaption, rNativeBoundingRegion,
+ rNativeContentRegion, this );
+ if( bRet )
+ {
+ // transform back native regions
+ rNativeBoundingRegion.Move( -aWinOffs.X(), -aWinOffs.Y() );
+ rNativeContentRegion.Move( -aWinOffs.X(), -aWinOffs.Y() );
+ }
+ // transform back ImplControlValue members
+ lcl_moveControlValue( nType, aValue, Point()-aWinOffs );
+
+ return bRet;
+}
+
+
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 7ee5889ba532..77f7f74fc10e 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9749,7 +9749,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
aLine.append( " ]\n" );
}
}
- else if( m_bIsPDF_A1 )
+ else if( m_bIsPDF_A1 && (bWriteMask || aTransparentColor != Color( COL_TRANSPARENT )) )
m_aErrors.insert( PDFWriter::Warning_Transparency_Omitted_PDFA );
aLine.append( ">>\n"
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index b7eb8e5f50bf..11971db34378 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -703,7 +703,7 @@ void PNGReaderImpl::ImplGetGrayPalette( sal_uInt16 nBitDepth )
nBitDepth = 8;
sal_uInt16 nPaletteEntryCount = 1 << nBitDepth;
- sal_uInt32 nAdd = 256 / (nPaletteEntryCount - 1);
+ sal_uInt32 nAdd = nBitDepth ? 256 / (nPaletteEntryCount - 1) : 0;
// no bitdepth==2 available
// but bitdepth==4 with two unused bits is close enough
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 55d6f7bdd892..84e45979d679 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -669,7 +669,7 @@ BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void*
}
BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside, const OutputDevice *pOutDev )
+ const Point& aPos, BOOL& rIsInside, const OutputDevice *pOutDev )
{
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
{
@@ -677,10 +677,10 @@ BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, co
Region rgn( rControlRegion );
mirror( pt.X(), pOutDev );
mirror( rgn, pOutDev );
- return hitTestNativeControl( nType, nPart, rgn, pt, rControlHandle, rIsInside );
+ return hitTestNativeControl( nType, nPart, rgn, pt, rIsInside );
}
else
- return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rControlHandle, rIsInside );
+ return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rIsInside );
}
void SalGraphics::mirror( ControlType nType, const ImplControlValue& rVal, const OutputDevice* pOutDev, bool bBack ) const
@@ -722,7 +722,7 @@ void SalGraphics::mirror( ControlType nType, const ImplControlValue& rVal, const
}
BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const OUString& aCaption, const OutputDevice *pOutDev )
{
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
@@ -730,33 +730,33 @@ BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const
Region rgn( rControlRegion );
mirror( rgn, pOutDev );
mirror( nType, aValue, pOutDev );
- BOOL bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption );
+ BOOL bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, aCaption );
mirror( nType, aValue, pOutDev, true );
return bRet;
}
else
- return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption );
+ return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, aCaption );
}
BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& aCaption, const OutputDevice *pOutDev )
+ const OUString& aCaption, const OutputDevice *pOutDev )
{
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
{
Region rgn( rControlRegion );
mirror( rgn, pOutDev );
mirror( nType, aValue, pOutDev );
- BOOL bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption );
+ BOOL bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, aCaption );
mirror( nType, aValue, pOutDev, true );
return bRet;
}
else
- return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption );
+ return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, aCaption );
}
BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption,
+ const ImplControlValue& aValue, const OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion, const OutputDevice *pOutDev )
{
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) )
@@ -764,7 +764,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart,
Region rgn( rControlRegion );
mirror( rgn, pOutDev );
mirror( nType, aValue, pOutDev );
- if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption,
+ if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, aCaption,
rNativeBoundingRegion, rNativeContentRegion ) )
{
mirror( rNativeBoundingRegion, pOutDev, true );
@@ -779,7 +779,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart,
}
}
else
- return getNativeControlRegion( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption,
+ return getNativeControlRegion( nType, nPart, rControlRegion, nState, aValue, aCaption,
rNativeBoundingRegion, rNativeContentRegion );
}
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 80ae3a3a8c7f..5e187944c706 100755
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -133,20 +133,21 @@ int GetVerticalFlags( sal_UCS4 nChar )
/* #i52932# remember:
nChar == 0x2010 || nChar == 0x2015
nChar == 0x2016 || nChar == 0x2026
- are GF_NONE also, but already handled in the first if
+ are GF_NONE also, but already handled in the outer if condition
*/
if((nChar >= 0x3008 && nChar <= 0x301C && nChar != 0x3012)
|| (nChar == 0xFF3B || nChar == 0xFF3D)
|| (nChar >= 0xFF5B && nChar <= 0xFF9F) // halfwidth forms
- || (nChar == 0xFFE3)
- || (nChar >= 0x02F800 && nChar <= 0x02FFFF) )
+ || (nChar == 0xFFE3) )
return GF_NONE; // not rotated
else if( nChar == 0x30fc )
return GF_ROTR; // right
return GF_ROTL; // left
}
+ else if( (nChar >= 0x20000) && (nChar <= 0x3FFFF) ) // all SIP/TIP ideographs
+ return GF_ROTL; // left
- return GF_NONE;
+ return GF_NONE; // not rotated as default
}
// -----------------------------------------------------------------------
@@ -1800,8 +1801,8 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
int nRunStart, nRunEnd;
while (rArgs.GetNextRun(&nRunStart, &nRunEnd, &bRtl))
{
- if (bRtl) std::fill(vRtl.begin() + ( nRunStart - rArgs.mnMinCharPos ),
- vRtl.begin() + ( nRunEnd - rArgs.mnMinCharPos ), true);
+ if (bRtl) std::fill(vRtl.begin() + (nRunStart - rArgs.mnMinCharPos),
+ vRtl.begin() + (nRunEnd - rArgs.mnMinCharPos), true);
}
rArgs.ResetPos();
diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx
index 8b87f142ba25..7faf12d062fe 100644
--- a/vcl/source/gdi/salnativewidgets-none.cxx
+++ b/vcl/source/gdi/salnativewidgets-none.cxx
@@ -60,7 +60,6 @@ BOOL SalGraphics::hitTestNativeControl( ControlType,
ControlPart,
const Region&,
const Point&,
- SalControlHandle&,
BOOL& )
{
return( FALSE );
@@ -74,7 +73,6 @@ BOOL SalGraphics::hitTestNativeControl( ControlType,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL SalGraphics::drawNativeControl( ControlType,
@@ -82,7 +80,6 @@ BOOL SalGraphics::drawNativeControl( ControlType,
const Region&,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
return( FALSE );
@@ -97,7 +94,6 @@ BOOL SalGraphics::drawNativeControl( ControlType,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL SalGraphics::drawNativeControlText( ControlType,
@@ -105,7 +101,6 @@ BOOL SalGraphics::drawNativeControlText( ControlType,
const Region&,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
return( FALSE );
@@ -123,7 +118,6 @@ BOOL SalGraphics::drawNativeControlText( ControlType,
*
* rControlRegion: The bounding region of the control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL SalGraphics::getNativeControlRegion( ControlType,
@@ -131,7 +125,6 @@ BOOL SalGraphics::getNativeControlRegion( ControlType,
const Region&,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString&,
Region &,
Region & )
diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 6e75d1fde868..ff2fd8f306b1 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -353,6 +353,46 @@ std::pair<float,float> GraphiteLayout::Glyphs::appendCluster(gr::Segment & rSeg,
assert(size() < rGlyph2Char.size());
rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] = size();
rGlyph2Char[size()] = nFirstCharInCluster;
+
+ // can we break before this cluster?
+ // Glyphs may have either a positive or negative breakWeight refering to
+ // the position after or before the glyph respectively
+ int nPrevBreakWeight = 0;
+ if (nFirstGlyphInCluster > 0)
+ {
+ nPrevBreakWeight = (iGlyphs.first + (nFirstGlyphInCluster - 1))->breakweight();
+ }
+ int nBreakWeight = aFirstGlyph.breakweight();
+ if (nBreakWeight < 0)
+ {
+ // negative means it applies to the position before the glyph's character
+ nBreakWeight *= -1;
+ if (nPrevBreakWeight > 0 && nPrevBreakWeight < nBreakWeight)
+ {
+ // prevBreakWeight wins
+ nBreakWeight = nPrevBreakWeight;
+ }
+ }
+ else
+ {
+ nBreakWeight = 0;
+ // positive means break after
+ if (nPrevBreakWeight > 0)
+ nBreakWeight = nPrevBreakWeight;
+ }
+ if (nBreakWeight > gr::klbNoBreak/*0*/ &&
+ // nBreakWeight <= gr::klbHyphenBreak) // uses Graphite hyphenation
+ nBreakWeight <= gr::klbLetterBreak) // Needed for issue 111272
+ {
+ if (nBreakWeight < gr::klbHyphenBreak)
+ rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= WORD_BREAK_BEFORE;
+ else
+ rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= HYPHEN_BREAK_BEFORE;
+ }
+ // always allow a break before a space even if graphite doesn't
+ if (rArgs.mpStr[nFirstCharInCluster] == 0x20)
+ rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= WORD_BREAK_BEFORE;
+
bool bBaseGlyph = true;
for (int j = nFirstGlyphInCluster;
j != nNextGlyph; j += nDelta)
@@ -409,7 +449,7 @@ std::pair<float,float> GraphiteLayout::Glyphs::appendCluster(gr::Segment & rSeg,
}
}
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"Cluster g[%d-%d) c[%d-%d)%x x%ld y%f\n", nFirstGlyphInCluster, nNextGlyph, nFirstCharInCluster, nNextChar, rArgs.mpStr[nFirstCharInCluster], nXPos, aFirstGlyph.yOffset());
+ fprintf(grLog(),"Cluster g[%d-%d) c[%d-%d)%x x%ld y%f bw%d\n", nFirstGlyphInCluster, nNextGlyph, nFirstCharInCluster, nNextChar, rArgs.mpStr[nFirstCharInCluster], nXPos, aFirstGlyph.yOffset(), nBreakWeight);
#endif
return aBounds;
}
@@ -641,6 +681,19 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs)
if (bRtl && (mrFont.getSupportedScriptDirections() & gr::kfsdcHorizRtl))
maLayout.setRightToLeft(bRtl);
+ // Context is often needed beyond the specified end, however, we don't
+ // want it if there has been a direction change, since it is hard
+ // to tell between reordering within one direction and multi-directional
+ // text. Extra context, can also cause problems with ligatures stradling
+ // a hyphenation point, so disable if CTL is disabled.
+ const int nSegCharLimit = min(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH);
+ int limit = rArgs.mnEndCharPos;
+ if ((nSegCharLimit > limit) && !(SAL_LAYOUT_COMPLEX_DISABLED & rArgs.mnFlags))
+ {
+ limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos,
+ nSegCharLimit - rArgs.mnEndCharPos, bRtl);
+ }
+
#ifdef GRCACHE
GrFontHasher hasher(mrFont);
sal_Int32 aFontHash = hasher.hashCode(mpFeatures);
@@ -648,7 +701,7 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs)
(GraphiteCacheHandler::instance).getCache(aFontHash);
if (pCache)
{
- *pSegRecord = pCache->getSegment(rArgs, bRtl);
+ *pSegRecord = pCache->getSegment(rArgs, bRtl, nSegCharLimit);
if (*pSegRecord)
{
pSegment = (*pSegRecord)->getSegment();
@@ -667,18 +720,6 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs)
}
#endif
- // Context is often needed beyond the specified end, however, we don't
- // want it if there has been a direction change, since it is hard
- // to tell between reordering within one direction and multi-directional
- // text.
- const int segCharLimit = min(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH);
- int limit = rArgs.mnEndCharPos;
- if (segCharLimit > limit)
- {
- limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos,
- segCharLimit - rArgs.mnEndCharPos, bRtl);
- }
-
// Create a new TextSource object for the engine.
mpTextSrc = new TextSourceAdaptor(rArgs, limit);
if (mpFeatures) mpTextSrc->setFeatures(mpFeatures);
@@ -795,27 +836,35 @@ bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment)
int GraphiteLayout::GetTextBreak(long maxmnWidth, long char_extra, int factor) const
{
- // Adjust maxmnWidth so FindNextBreakPoint returns a sensible answer.
- maxmnWidth -= (mnEndCharPos-mnMinCharPos-1)*char_extra; // extra character spacing.
- maxmnWidth /= factor; // scaling factor.
+#ifdef GRLAYOUT_DEBUG
+ fprintf(grLog(),"Gr::GetTextBreak c[%d-%d) maxWidth %ld char extra %ld factor %d\n",
+ mnMinCharPos, mnEndCharPos, maxmnWidth, char_extra, factor);
+#endif
- // Ask the segment for the nearest whole letter break for the width.
- //float width;
- float targetWidth = maxmnWidth/mfScaling;
// return quickly if this segment is narrower than the target width
- // (sometimes graphite doesn't seem to realise this!)
- if (targetWidth > mnWidth)
+ if (maxmnWidth > mnWidth * factor + char_extra * (mnEndCharPos - mnMinCharPos - 1))
return STRING_LEN;
- //int nBreak = mpSegment->findNextBreakPoint(mnMinCharPos,
- // gr::klbWordBreak, gr::klbLetterBreak, targetWidth, &width);
- // LineFillSegment seems to give better results that findNextBreakPoint
- // though it may be slower
- gr::LayoutEnvironment aLE;
- gr::LineFillSegment lineSeg(const_cast<gr::Font *>(&mrFont), mpTextSrc, &aLE,
- mnMinCharPos, mpTextSrc->getContextLength(),
- targetWidth);
- int nBreak = lineSeg.stopCharacter();
+ long nWidth = mvCharDxs[0] * factor;
+ int nLastBreak = -1;
+ for (size_t i = 1; i < mvCharDxs.size(); i++)
+ {
+ nWidth += char_extra;
+ if (nWidth > maxmnWidth) break;
+ if (mvChar2BaseGlyph[i] != -1)
+ {
+ if (mvChar2BaseGlyph[i] & (WORD_BREAK_BEFORE | HYPHEN_BREAK_BEFORE))
+ nLastBreak = static_cast<int>(i);
+ }
+ nWidth += (mvCharDxs[i] - mvCharDxs[i-1]) * factor;
+ }
+ int nBreak = mnMinCharPos;
+ if (nLastBreak > -1)
+ nBreak += nLastBreak;
+
+#ifdef GRLAYOUT_DEBUG
+ fprintf(grLog(), "Gr::GetTextBreak break after %d\n", nBreak - mnMinCharPos);
+#endif
if (nBreak > mnEndCharPos) nBreak = STRING_LEN;
else if (nBreak < mnMinCharPos) nBreak = mnMinCharPos;
@@ -833,9 +882,10 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const
{
for (size_t i = 0; i < mvCharDxs.size(); i++)
{
- assert((mvChar2BaseGlyph[i] >= -1) && (mvChar2BaseGlyph[i] < (signed)mvGlyphs.size()));
+ assert( (mvChar2BaseGlyph[i] == -1) ||
+ ((signed)(mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK) < (signed)mvGlyphs.size()));
if (mvChar2BaseGlyph[i] != -1 &&
- mvGlyphs[mvChar2BaseGlyph[i]].mnGlyphIndex == GF_DROPPED)
+ mvGlyphs[mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK].mnGlyphIndex == GF_DROPPED)
{
// when used in MultiSalLayout::GetTextBreak dropped glyphs
// must have zero width
@@ -865,7 +915,6 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const
void GraphiteLayout::AdjustLayout(ImplLayoutArgs& rArgs)
{
SalLayout::AdjustLayout(rArgs);
-
if(rArgs.mpDXArray)
{
std::vector<int> vDeltaWidths(mvGlyphs.size(), 0);
@@ -894,8 +943,75 @@ void GraphiteLayout::AdjustLayout(ImplLayoutArgs& rArgs)
}
}
}
+ else if (rArgs.mnLayoutWidth > 0)
+ {
+#ifdef GRLAYOUT_DEBUG
+ fprintf(grLog(), "AdjustLayout width %ld=>%ld\n", mnWidth, rArgs.mnLayoutWidth);
+#endif
+ expandOrCondense(rArgs);
+ }
}
+void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
+{
+ int nDeltaWidth = rArgs.mnLayoutWidth - mnWidth;
+ if (nDeltaWidth > 0) // expand, just expand between clusters
+ {
+ int nClusterCount = 0;
+ for (size_t j = 0; j < mvGlyphs.size(); j++)
+ {
+ if (mvGlyphs[j].IsClusterStart())
+ {
+ ++nClusterCount;
+ }
+ }
+ if (nClusterCount > 1)
+ {
+ float fExtraPerCluster = static_cast<float>(nDeltaWidth) / static_cast<float>(nClusterCount - 1);
+ int nCluster = 0;
+ int nOffset = 0;
+ for (size_t i = 0; i < mvGlyphs.size(); i++)
+ {
+ if (mvGlyphs[i].IsClusterStart())
+ {
+ nOffset = fExtraPerCluster * nCluster;
+ size_t nCharIndex = mvGlyph2Char[i];
+ mvCharDxs[nCharIndex] += nOffset;
+ // adjust char dxs for rest of characters in cluster
+ while (++nCharIndex < mvGlyph2Char.size())
+ {
+ int nChar2Base = (mvChar2BaseGlyph[nCharIndex] == -1)? -1 : mvChar2BaseGlyph[nCharIndex] & GLYPH_INDEX_MASK;
+ if (nChar2Base == -1 || nChar2Base == static_cast<int>(i))
+ mvCharDxs[nCharIndex] += nOffset;
+ }
+ ++nCluster;
+ }
+ mvGlyphs[i].maLinearPos.X() += nOffset;
+ }
+ }
+ }
+ else // condense - apply a factor to all glyph positions
+ {
+ if (mvGlyphs.size() == 0) return;
+ Glyphs::iterator iLastGlyph = mvGlyphs.begin() + (mvGlyphs.size() - 1);
+ // position last glyph using original width
+ float fXFactor = static_cast<float>(rArgs.mnLayoutWidth - iLastGlyph->mnOrigWidth) / static_cast<float>(iLastGlyph->maLinearPos.X());
+#ifdef GRLAYOUT_DEBUG
+ fprintf(grLog(), "Condense by factor %f\n", fXFactor);
+#endif
+ iLastGlyph->maLinearPos.X() = rArgs.mnLayoutWidth - iLastGlyph->mnOrigWidth;
+ Glyphs::iterator iGlyph = mvGlyphs.begin();
+ while (iGlyph != iLastGlyph)
+ {
+ iGlyph->maLinearPos.X() = static_cast<float>(iGlyph->maLinearPos.X()) * fXFactor;
+ ++iGlyph;
+ }
+ for (size_t i = 0; i < mvCharDxs.size(); i++)
+ {
+ mvCharDxs[i] = fXFactor * static_cast<float>(mvCharDxs[i]);
+ }
+ }
+}
void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDeltaWidth)
{
@@ -917,37 +1033,39 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
int nPrevClusterLastChar = -1;
for (size_t i = 0; i < nChars; i++)
{
- if (mvChar2BaseGlyph[i] > -1 && mvChar2BaseGlyph[i] != nPrevClusterGlyph)
+ int nChar2Base = (mvChar2BaseGlyph[i] == -1)? -1 : mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK;
+ if ((nChar2Base > -1) && (nChar2Base != nPrevClusterGlyph))
{
- assert((mvChar2BaseGlyph[i] > -1) && (mvChar2BaseGlyph[i] < (signed)mvGlyphs.size()));
- GlyphItem & gi = mvGlyphs[mvChar2BaseGlyph[i]];
+ assert((nChar2Base > -1) && (nChar2Base < (signed)mvGlyphs.size()));
+ GlyphItem & gi = mvGlyphs[nChar2Base];
if (!gi.IsClusterStart())
continue;
// find last glyph of this cluster
size_t j = i + 1;
int nLastChar = i;
- int nLastGlyph = mvChar2BaseGlyph[i];
+ int nLastGlyph = nChar2Base;
for (; j < nChars; j++)
{
- assert((mvChar2BaseGlyph[j] >= -1) && (mvChar2BaseGlyph[j] < (signed)mvGlyphs.size()));
- if (mvChar2BaseGlyph[j] != -1 && mvGlyphs[mvChar2BaseGlyph[j]].IsClusterStart())
+ int nChar2BaseJ = (mvChar2BaseGlyph[j] == -1)? -1 : mvChar2BaseGlyph[j] & GLYPH_INDEX_MASK;
+ assert((nChar2BaseJ >= -1) && (nChar2BaseJ < (signed)mvGlyphs.size()));
+ if (nChar2BaseJ != -1 && mvGlyphs[nChar2BaseJ].IsClusterStart())
{
- nLastGlyph = mvChar2BaseGlyph[j] + ((bRtl)? 1 : -1);
+ nLastGlyph = nChar2BaseJ + ((bRtl)? 1 : -1);
nLastChar = j - 1;
break;
}
}
if (nLastGlyph < 0)
{
- nLastGlyph = mvChar2BaseGlyph[i];
+ nLastGlyph = nChar2Base;
}
// Its harder to find the last glyph rtl, since the first of
// cluster is still on the left so we need to search towards
// the previous cluster to the right
if (bRtl)
{
- nLastGlyph = mvChar2BaseGlyph[i];
+ nLastGlyph = nChar2Base;
while (nLastGlyph + 1 < (signed)mvGlyphs.size() &&
!mvGlyphs[nLastGlyph+1].IsClusterStart())
{
@@ -983,7 +1101,7 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
// update glyph positions
if (bRtl)
{
- for (int n = mvChar2BaseGlyph[i]; n <= nLastGlyph; n++)
+ for (int n = nChar2Base; n <= nLastGlyph; n++)
{
assert((n > - 1) && (n < (signed)mvGlyphs.size()));
mvGlyphs[n].maLinearPos.X() += -nDGlyphOrigin + nXOffset;
@@ -991,17 +1109,17 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
}
else
{
- for (int n = mvChar2BaseGlyph[i]; n <= nLastGlyph; n++)
+ for (int n = nChar2Base; n <= nLastGlyph; n++)
{
assert((n > - 1) && (n < (signed)mvGlyphs.size()));
mvGlyphs[n].maLinearPos.X() += nDGlyphOrigin + nXOffset;
}
}
- rDeltaWidth[mvChar2BaseGlyph[i]] = nDWidth;
+ rDeltaWidth[nChar2Base] = nDWidth;
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"c%d g%d-%d dW%ld-%ld=%ld dX%ld x%ld\t", (int)i, mvChar2BaseGlyph[i], nLastGlyph, nNewClusterWidth, nOrigClusterWidth, nDWidth, nDGlyphOrigin, mvGlyphs[mvChar2BaseGlyph[i]].maLinearPos.X());
+ fprintf(grLog(),"c%d g%d-%d dW%ld-%ld=%ld dX%ld x%ld\t", (int)i, nChar2Base, nLastGlyph, nNewClusterWidth, nOrigClusterWidth, nDWidth, nDGlyphOrigin, mvGlyphs[nChar2Base].maLinearPos.X());
#endif
- nPrevClusterGlyph = mvChar2BaseGlyph[i];
+ nPrevClusterGlyph = nChar2Base;
nPrevClusterLastChar = nLastChar;
i = nLastChar;
}
@@ -1043,7 +1161,7 @@ void GraphiteLayout::kashidaJustify(std::vector<int>& rDeltaWidths, sal_GlyphId
continue;
}
// calculate gap, ignore if too small
- int nGapWidth = rDeltaWidths[nOrigGlyphIndex];;
+ int nGapWidth = rDeltaWidths[nOrigGlyphIndex];
// worst case is one kashida even for mini-gaps
if( 3 * nGapWidth < nKashidaWidth )
{
@@ -1104,13 +1222,14 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray
{
if (mvChar2BaseGlyph[nCharSlot] != -1)
{
- assert((mvChar2BaseGlyph[nCharSlot] > -1) && (mvChar2BaseGlyph[nCharSlot] < (signed)mvGlyphs.size()));
- GlyphItem gi = mvGlyphs[mvChar2BaseGlyph[nCharSlot]];
+ int nChar2Base = mvChar2BaseGlyph[nCharSlot] & GLYPH_INDEX_MASK;
+ assert((mvChar2BaseGlyph[nCharSlot] > -1) && (nChar2Base < (signed)mvGlyphs.size()));
+ GlyphItem gi = mvGlyphs[nChar2Base];
if (gi.mnGlyphIndex == GF_DROPPED)
{
continue;
}
- int nCluster = mvChar2BaseGlyph[nCharSlot];
+ int nCluster = nChar2Base;
long origClusterWidth = gi.mnNewWidth;
long nMin = gi.maLinearPos.X();
long nMax = gi.maLinearPos.X() + gi.mnNewWidth;
@@ -1135,7 +1254,7 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray
pCaretXArray[i] = nMin;
pCaretXArray[i+1] = nMax;
}
- prevBase = mvChar2BaseGlyph[nCharSlot];
+ prevBase = nChar2Base;
prevClusterWidth = origClusterWidth;
}
else if (prevBase > -1)
@@ -1268,7 +1387,7 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out,
#ifdef GRLAYOUT_DEBUG
fprintf(grLog(),"GetNextGlyphs g%d c%d x%ld,%ld adv%ld, pos %ld,%ld\n", glyph_slot - 1,
- mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance,
+ GLYPH_INDEX_MASK&mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance,
aPosOut.X(), aPosOut.Y());
#endif
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index e3a8d2ce35de..e67c2d9ecfd5 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -426,11 +426,19 @@ void DockingManager::SetFloatingMode( const Window *pWindow, BOOL bFloating )
pWrapper->SetFloatingMode( bFloating );
}
-void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow )
+void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow, ULONG nFlags )
{
ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
if( pWrapper )
- pWrapper->StartPopupMode( pParentToolBox );
+ pWrapper->StartPopupMode( pParentToolBox, nFlags );
+}
+
+void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow )
+{
+ StartPopupMode( pParentToolBox, pWindow, FLOATWIN_POPUPMODE_ALLOWTEAROFF |
+ FLOATWIN_POPUPMODE_NOFOCUSCLOSE |
+ FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE |
+ FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE );
}
BOOL DockingManager::IsInPopupMode( const Window *pWindow )
@@ -442,6 +450,17 @@ BOOL DockingManager::IsInPopupMode( const Window *pWindow )
return FALSE;
}
+// -----------------------------------------------------------------------
+
+void DockingManager::EndPopupMode( const Window *pWin )
+{
+ ImplDockingWindowWrapper *pWrapper = GetDockingWindowWrapper( pWin );
+ if( pWrapper && pWrapper->GetFloatingWindow() && pWrapper->GetFloatingWindow()->IsInPopupMode() )
+ pWrapper->GetFloatingWindow()->EndPopupMode();
+}
+
+// -----------------------------------------------------------------------
+
void DockingManager::AddWindow( const Window *pWindow )
{
ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
@@ -515,12 +534,15 @@ private:
ImplDockingWindowWrapper* mpDockingWin;
BOOL mbHighlight;
BOOL mbMoving;
+ bool mbTrackingEnabled;
Point maDelta;
Point maTearOffPosition;
+ bool mbGripAtBottom;
+ bool mbHasGrip;
void ImplSetBorder();
public:
- ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin );
+ ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip );
~ImplPopupFloatWin();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
@@ -537,9 +559,11 @@ public:
Point GetTearOffPosition() const;
void DrawGrip();
void DrawBorder();
+
+ bool hasGrip() const { return mbHasGrip; }
};
-ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin ) :
+ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip ) :
FloatingWindow( pParent, WB_NOBORDER | WB_SYSTEMWINDOW | WB_NOSHADOW)
{
mpWindowImpl->mbToolbarFloatingWindow = TRUE; // indicate window type, required for accessibility
@@ -547,6 +571,9 @@ ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper*
mpDockingWin = pDockingWin;
mbHighlight = FALSE;
mbMoving = FALSE;
+ mbTrackingEnabled = FALSE;
+ mbGripAtBottom = TRUE;
+ mbHasGrip = bHasGrip;
ImplSetBorder();
}
@@ -582,7 +609,9 @@ void ImplPopupFloatWin::ImplSetBorder()
// we're using a special border for the grip
// by setting those members the method SetOutputSizePixel() can
// be used to set the proper window size
- mpWindowImpl->mnTopBorder = 1 + POPUP_DRAGHEIGHT+2;
+ mpWindowImpl->mnTopBorder = 1;
+ if( hasGrip() )
+ mpWindowImpl->mnTopBorder += POPUP_DRAGHEIGHT+2;
mpWindowImpl->mnBottomBorder = 1;
mpWindowImpl->mnLeftBorder = 1;
mpWindowImpl->mnRightBorder = 1;
@@ -596,13 +625,25 @@ void ImplPopupFloatWin::Resize()
Rectangle ImplPopupFloatWin::GetDragRect() const
{
- return Rectangle( 1, 1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT );
+ Rectangle aRect;
+ if( hasGrip() )
+ {
+ aRect = Rectangle( 1,1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT );
+ if( mbGripAtBottom )
+ {
+ int height = GetOutputSizePixel().Height();
+ aRect.Top() = height - 3 - POPUP_DRAGHEIGHT;
+ aRect.Bottom() = aRect.Top() + 1 + POPUP_DRAGHEIGHT;
+ }
+ }
+ return aRect;
}
Point ImplPopupFloatWin::GetToolboxPosition() const
{
// return inner position where a toolbox could be placed
- Point aPt( 1, 1+GetDragRect().getHeight() ); // grip + border
+ Point aPt( 1, 1 + ((mbGripAtBottom || !hasGrip()) ? 0 : GetDragRect().getHeight()) ); // grip + border
+
return aPt;
}
@@ -616,7 +657,6 @@ Point ImplPopupFloatWin::GetTearOffPosition() const
void ImplPopupFloatWin::DrawBorder()
{
SetFillColor();
- SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
Point aPt;
Rectangle aRect( aPt, GetOutputSizePixel() );
@@ -626,9 +666,16 @@ void ImplPopupFloatWin::DrawBorder()
if( !aItemClipRect.IsEmpty() )
{
aItemClipRect.SetPos( AbsoluteScreenToOutputPixel( aItemClipRect.TopLeft() ) );
+
+ // draw the excluded border part with the background color of a toolbox
+ SetClipRegion( Region( aItemClipRect ) );
+ SetLineColor( GetSettings().GetStyleSettings().GetFaceColor() );
+ DrawRect( aRect );
+
aClipRgn.Exclude( aItemClipRect );
SetClipRegion( aClipRgn );
}
+ SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
DrawRect( aRect );
SetClipRegion( oldClipRgn );
}
@@ -724,7 +771,8 @@ void ImplPopupFloatWin::Paint( const Rectangle& )
Rectangle aRect( aPt, GetOutputSizePixel() );
DrawWallpaper( aRect, Wallpaper( GetSettings().GetStyleSettings().GetFaceGradientColor() ) );
DrawBorder();
- DrawGrip();
+ if( hasGrip() )
+ DrawGrip();
}
void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt )
@@ -733,7 +781,7 @@ void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt )
if( !ToolBox::AlwaysLocked() ) // no tear off if locking is enabled
{
- if( rMEvt.IsLeft() && GetDragRect().IsInside( aMousePos ) )
+ if( mbTrackingEnabled && rMEvt.IsLeft() && GetDragRect().IsInside( aMousePos ) )
{
// start window move
mbMoving = TRUE;
@@ -755,6 +803,7 @@ void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt )
void ImplPopupFloatWin::MouseButtonUp( const MouseEvent& rMEvt )
{
+ mbTrackingEnabled = false;
FloatingWindow::MouseButtonUp( rMEvt );
}
@@ -769,6 +818,11 @@ void ImplPopupFloatWin::MouseButtonDown( const MouseEvent& rMEvt )
ImplMirrorFramePos(aState.maPos);
maTearOffPosition = GetWindow( WINDOW_BORDER )->GetPosPixel();
maDelta = aState.maPos - maTearOffPosition;
+ mbTrackingEnabled = true;
+ }
+ else
+ {
+ mbTrackingEnabled = false;
}
}
@@ -1187,7 +1241,7 @@ BOOL ImplDockingWindowWrapper::IsTitleButtonVisible( USHORT nButton ) const
// -----------------------------------------------------------------------
-void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox )
+void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, ULONG nFlags )
{
// do nothing if window is floating
if( IsFloatingMode() )
@@ -1202,7 +1256,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox )
mpOldBorderWin = NULL; // no border window found
// the new parent for popup mode
- ImplPopupFloatWin* pWin = new ImplPopupFloatWin( mpParent, this );
+ ImplPopupFloatWin* pWin = new ImplPopupFloatWin( mpParent, this, (nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) != 0 );
pWin->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper, PopupModeEnd ) );
pWin->SetText( GetWindow()->GetText() );
@@ -1232,12 +1286,6 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox )
// (SetPosPixel etc. check for valid mpFloatWin pointer)
mpFloatWin = pWin;
- ULONG nFlags = FLOATWIN_POPUPMODE_ALLOWTEAROFF |
- FLOATWIN_POPUPMODE_NOFOCUSCLOSE |
- FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE |
- FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE;
-// |FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE;
-
// if the subtoolbar was opened via keyboard make sure that key events
// will go into subtoolbar
if( pParentToolBox->IsKeyEvent() )
@@ -1339,7 +1387,7 @@ void ImplDockingWindowWrapper::SetFloatingMode( BOOL bFloatMode )
aSettings.SetStyleSettings( aStyleSettings );
pWin->SetSettings( aSettings );*/
- mpFloatWin = pWin;
+// mpFloatWin = pWin;
GetWindow()->mpWindowImpl->mpBorderWindow = NULL;
@@ -1374,6 +1422,8 @@ void ImplDockingWindowWrapper::SetFloatingMode( BOOL bFloatMode )
pWin->SetMinOutputSizePixel( maMinOutSize );
pWin->SetMaxOutputSizePixel( maMaxOutSize );
+ mpFloatWin = pWin;
+
if ( bVisible )
GetWindow()->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index ddfb1125d0d7..cebe1d1f596c 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -32,6 +32,7 @@
#include "vcl/salinst.hxx"
#include "tools/list.hxx"
#include "tools/debug.hxx"
+#include "tools/diagnose_ex.h"
#include "vcl/svdata.hxx"
#include "vcl/svapp.hxx"
#include "vcl/mnemonic.hxx"
@@ -3464,6 +3465,9 @@ USHORT PopupMenu::Execute( Window* pExecWindow, const Point& rPopupPos )
USHORT PopupMenu::Execute( Window* pExecWindow, const Rectangle& rRect, USHORT nFlags )
{
+ ENSURE_OR_RETURN( pExecWindow, "PopupMenu::Execute: need a non-NULL window!", 0 );
+
+
ULONG nPopupModeFlags = 0;
if ( nFlags & POPUPMENU_EXECUTE_DOWN )
nPopupModeFlags = FLOATWIN_POPUPMODE_DOWN;
diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx
index b4f4d0f2b6df..d4ee01c26d61 100644
--- a/vcl/source/window/seleng.cxx
+++ b/vcl/source/window/seleng.cxx
@@ -200,7 +200,11 @@ void SelectionEngine::CursorPosChanging( BOOL bShift, BOOL bMod1 )
BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt )
{
nFlags &= (~SELENG_CMDEVT);
- if ( !pFunctionSet || !pWin || rMEvt.GetClicks() > 1 || rMEvt.IsRight() )
+ if ( !pFunctionSet || !pWin )
+ return FALSE;
+ const bool bRightClickCursorPositioning =
+ rMEvt.IsRight() && rMEvt.GetClicks() == 1 && !IsInSelection();
+ if ( (rMEvt.GetClicks() > 1 || rMEvt.IsRight()) && !bRightClickCursorPositioning )
return FALSE;
USHORT nModifier = rMEvt.GetModifier() | nLockedMods;
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 056b55dc3b61..f3624ef56f59 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -659,6 +659,63 @@ static void ImplWindowStateToStr( const WindowStateData& rData, ByteString& rStr
// -----------------------------------------------------------------------
+void SystemWindow::ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, Window* i_pConfigureWin )
+{
+ Rectangle aScreenRect;
+ if( Application::IsMultiDisplay() )
+ {
+ aScreenRect = Application::GetScreenPosSizePixel( GetScreenNumber() );
+ }
+ else
+ {
+ aScreenRect = Application::GetScreenPosSizePixel( 0 );
+ for( unsigned int i = 1; i < Application::GetScreenCount(); i++ )
+ aScreenRect.Union( Application::GetScreenPosSizePixel( i ) );
+ }
+ // unfortunately most of the time width and height are not really known
+ if( i_nWidth < 1 )
+ i_nWidth = 50;
+ if( i_nHeight < 1 )
+ i_nHeight = 50;
+
+ // check left border
+ bool bMove = false;
+ if( io_rX + i_nWidth < aScreenRect.Left() )
+ {
+ bMove = true;
+ io_rX = aScreenRect.Left();
+ }
+ // check right border
+ if( io_rX > aScreenRect.Right() - i_nWidth )
+ {
+ bMove = true;
+ io_rX = aScreenRect.Right() - i_nWidth;
+ }
+ // check top border
+ if( io_rY + i_nHeight < aScreenRect.Top() )
+ {
+ bMove = true;
+ io_rY = aScreenRect.Top();
+ }
+ // check bottom border
+ if( io_rY > aScreenRect.Bottom() - i_nHeight )
+ {
+ bMove = true;
+ io_rY = aScreenRect.Bottom() - i_nHeight;
+ }
+ Window* pParent = i_pConfigureWin->GetParent();
+ if( bMove && pParent )
+ {
+ // calculate absolute screen pos here, since that is what is contained in WindowState
+ Point aParentAbsPos( pParent->OutputToAbsoluteScreenPixel( Point(0,0) ) );
+ Size aParentSizePixel( pParent->GetOutputSizePixel() );
+ Point aPos( (aParentSizePixel.Width() - i_nWidth) / 2,
+ (aParentSizePixel.Height() - i_nHeight) / 2 );
+ io_rX = aParentAbsPos.X() + aPos.X();
+ io_rY = aParentAbsPos.Y() + aPos.Y();
+ }
+}
+
void SystemWindow::SetWindowStateData( const WindowStateData& rData )
{
ULONG nValidMask = rData.GetMask();
@@ -701,6 +758,10 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData )
//nState &= ~(WINDOWSTATE_STATE_MINIMIZED);
aState.mnState = nState & SAL_FRAMESTATE_SYSTEMMASK;
+ // normalize window positions onto screen
+ ImplMoveToScreen( aState.mnX, aState.mnY, aState.mnWidth, aState.mnHeight, pWindow );
+ ImplMoveToScreen( aState.mnMaximizedX, aState.mnMaximizedY, aState.mnMaximizedWidth, aState.mnMaximizedHeight, pWindow );
+
// #96568# avoid having multiple frames at the same screen location
// do the check only if not maximized
if( !((rData.GetMask() & WINDOWSTATE_MASK_STATE) && (nState & WINDOWSTATE_STATE_MAXIMIZED)) )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b47aa50a2e72..ca92d9ed6c5b 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -98,6 +98,7 @@
#include "vcl/lazydelete.hxx"
#include <set>
+#include <typeinfo>
using namespace rtl;
using namespace ::com::sun::star::uno;
@@ -1322,7 +1323,6 @@ ImplWinData* Window::ImplGetWinData() const
mpWindowImpl->mpWinData->mnIsTopWindow = (USHORT) ~0; // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow())
mpWindowImpl->mpWinData->mbMouseOver = FALSE;
mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? FALSE : TRUE; // TRUE: try to draw this control with native theme API
- mpWindowImpl->mpWinData->mpSalControlHandle = NULL;
mpWindowImpl->mpWinData->mpSmartHelpId = NULL;
mpWindowImpl->mpWinData->mpSmartUniqueId = NULL;
}
@@ -4328,6 +4328,27 @@ Window::Window( Window* pParent, const ResId& rResId )
}
// -----------------------------------------------------------------------
+#if OSL_DEBUG_LEVEL > 0
+namespace
+{
+ void lcl_appendWindowInfo( ByteString& io_rErrorString, const Window& i_rWindow )
+ {
+ // skip border windows, they don't carry information which helps diagnosing the problem
+ const Window* pWindow( &i_rWindow );
+ while ( pWindow && ( pWindow->GetType() == WINDOW_BORDERWINDOW ) )
+ pWindow = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ if ( !pWindow )
+ pWindow = &i_rWindow;
+
+ io_rErrorString += char(13);
+ io_rErrorString += typeid( *pWindow ).name();
+ io_rErrorString += " (window text: '";
+ io_rErrorString += ByteString( pWindow->GetText(), RTL_TEXTENCODING_UTF8 );
+ io_rErrorString += "')";
+ }
+}
+#endif
+// -----------------------------------------------------------------------
Window::~Window()
{
@@ -4460,9 +4481,7 @@ Window::~Window()
if ( ImplIsRealParentPath( pTempWin ) )
{
bError = TRUE;
- if ( aErrorStr.Len() )
- aErrorStr += "; ";
- aErrorStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 );
+ lcl_appendWindowInfo( aErrorStr, *pTempWin );
}
pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
}
@@ -4483,9 +4502,7 @@ Window::~Window()
if ( ImplIsRealParentPath( pTempWin ) )
{
bError = TRUE;
- if ( aErrorStr.Len() )
- aErrorStr += "; ";
- aErrorStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 );
+ lcl_appendWindowInfo( aErrorStr, *pTempWin );
}
pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame;
}
@@ -4507,10 +4524,8 @@ Window::~Window()
pTempWin = mpWindowImpl->mpFirstChild;
while ( pTempWin )
{
- aTempStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 );
+ lcl_appendWindowInfo( aTempStr, *pTempWin );
pTempWin = pTempWin->mpWindowImpl->mpNext;
- if ( pTempWin )
- aTempStr += "; ";
}
DBG_ERROR( aTempStr.GetBuffer() );
GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed!
@@ -4524,10 +4539,8 @@ Window::~Window()
pTempWin = mpWindowImpl->mpFirstOverlap;
while ( pTempWin )
{
- aTempStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 );
+ lcl_appendWindowInfo( aTempStr, *pTempWin );
pTempWin = pTempWin->mpWindowImpl->mpNext;
- if ( pTempWin )
- aTempStr += "; ";
}
DBG_ERROR( aTempStr.GetBuffer() );
GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed!
@@ -4722,10 +4735,6 @@ Window::~Window()
delete mpWindowImpl->mpWinData->mpFocusRect;
if ( mpWindowImpl->mpWinData->mpTrackRect )
delete mpWindowImpl->mpWinData->mpTrackRect;
- // Native widget support
- delete mpWindowImpl->mpWinData->mpSalControlHandle;
- mpWindowImpl->mpWinData->mpSalControlHandle = NULL;
-
if ( mpWindowImpl->mpWinData->mpSmartHelpId )
delete mpWindowImpl->mpWinData->mpSmartHelpId;
if ( mpWindowImpl->mpWinData->mpSmartUniqueId )
@@ -7444,13 +7453,13 @@ Rectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle &rR
// -----------------------------------------------------------------------
-Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow )
+Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow ) const
{
// with decoration
return ImplGetWindowExtentsRelative( pRelativeWindow, FALSE );
}
-Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow )
+Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) const
{
// without decoration
return ImplGetWindowExtentsRelative( pRelativeWindow, TRUE );
@@ -7458,12 +7467,12 @@ Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow )
// -----------------------------------------------------------------------
-Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly )
+Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) const
{
SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
// make sure we use the extent of our border window,
// otherwise we miss a few pixels
- Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this;
+ const Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this;
Point aPos( pWin->OutputToScreenPixel( Point(0,0) ) );
aPos.X() += g.nX;
diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx
index aecbc9c3ef0c..65019ba2a4af 100644
--- a/vcl/source/window/window3.cxx
+++ b/vcl/source/window/window3.cxx
@@ -28,269 +28,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#define _SV_WINDOW_CXX
-
-#include "svsys.h"
-#include "vcl/window.h"
#include "vcl/window.hxx"
#include "vcl/waitobj.hxx"
-#include "vcl/salgdi.hxx"
-#include "vcl/salnativewidgets.hxx"
-#include "vcl/salctrlhandle.hxx"
-#include "rtl/ustring.hxx"
#include "vcl/button.hxx"
-using namespace rtl;
-
-// -----------------------------------------------------------------------
-// These functions are mainly passthrough functions that allow access to
-// the SalFrame behind a Window object for native widget rendering purposes.
-// -----------------------------------------------------------------------
-
-void Window::ImplInitSalControlHandle()
-{
- // create SalControlHandle on demand
- // not needed for ordinary windows
- // TODO: move creation to SalGraphics
- //if( !ImplGetWinData()->mpSalControlHandle )
- // ImplGetWinData()->mpSalControlHandle = new SalControlHandle;
-}
-
-// -----------------------------------------------------------------------
-
-BOOL Window::IsNativeControlSupported( ControlType nType, ControlPart nPart )
-{
- if( !IsNativeWidgetEnabled() )
- return FALSE;
-
- if ( !mpGraphics )
- if ( !ImplGetGraphics() )
- return FALSE;
-
- return( mpGraphics->IsNativeControlSupported(nType, nPart) );
-}
-
-
-// -----------------------------------------------------------------------
-
-BOOL Window::HitTestNativeControl( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- const Point& aPos,
- BOOL& rIsInside )
-{
- if( !IsNativeWidgetEnabled() )
- return FALSE;
-
- if ( !mpGraphics )
- if ( !ImplGetGraphics() )
- return FALSE;
-
- ImplInitSalControlHandle();
-
- Point aWinOffs;
- aWinOffs = OutputToScreenPixel( aWinOffs );
- Region screenRegion( rControlRegion );
- screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
-
- return( mpGraphics->HitTestNativeControl(nType, nPart, screenRegion, OutputToScreenPixel( aPos ), *ImplGetWinData()->mpSalControlHandle, rIsInside, this ) );
-}
-
-// -----------------------------------------------------------------------
-
-void Window::ImplMoveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta ) const
-{
- if( aValue.getOptionalVal() )
- {
- switch( nType )
- {
- case CTRL_SLIDER:
- {
- SliderValue* pSlVal = reinterpret_cast<SliderValue*>(aValue.getOptionalVal());
- pSlVal->maThumbRect.Move( rDelta.X(), rDelta.Y() );
- }
- break;
- case CTRL_SCROLLBAR:
- {
- ScrollbarValue* pScVal = reinterpret_cast<ScrollbarValue*>(aValue.getOptionalVal());
- pScVal->maThumbRect.Move( rDelta.X(), rDelta.Y() );
- pScVal->maButton1Rect.Move( rDelta.X(), rDelta.Y() );
- pScVal->maButton2Rect.Move( rDelta.X(), rDelta.Y() );
- }
- break;
- case CTRL_SPINBOX:
- case CTRL_SPINBUTTONS:
- {
- SpinbuttonValue* pSpVal = reinterpret_cast<SpinbuttonValue*>(aValue.getOptionalVal());
- pSpVal->maUpperRect.Move( rDelta.X(), rDelta.Y() );
- pSpVal->maLowerRect.Move( rDelta.X(), rDelta.Y() );
- }
- break;
- case CTRL_TOOLBAR:
- {
- ToolbarValue* pTVal = reinterpret_cast<ToolbarValue*>(aValue.getOptionalVal());
- pTVal->maGripRect.Move( rDelta.X(), rDelta.Y() );
- }
- break;
- }
- }
-}
-
-BOOL Window::DrawNativeControl( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- OUString aCaption )
-{
- if( !IsNativeWidgetEnabled() )
- return FALSE;
-
- /*
- if( !IsInPaint() && IsPaintTransparent() )
- {
- // only required if called directly (ie, we're not in Paint() ):
- // force redraw (Paint()) for transparent controls
- // to trigger a repaint of the background
- Region aClipRgn( GetClipRegion() );
- if( !rControlRegion.IsEmpty() )
- aClipRgn.Intersect( rControlRegion );
- Invalidate( aClipRgn, INVALIDATE_UPDATE );
- return TRUE;
- }
- */
-
- ImplInitSalControlHandle();
-
- // make sure the current clip region is initialized correctly
- if ( !mpGraphics )
- if ( !ImplGetGraphics() )
- return FALSE;
-
- if ( mbInitClipRegion )
- ImplInitClipRegion();
- if ( mbOutputClipped )
- return TRUE;
-
- if ( mbInitLineColor )
- ImplInitLineColor();
- if ( mbInitFillColor )
- ImplInitFillColor();
-
- // Convert the coordinates from relative to Window-absolute, so we draw
- // in the correct place in platform code
- Point aWinOffs;
- aWinOffs = OutputToScreenPixel( aWinOffs );
- Region screenRegion( rControlRegion );
- screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
-
- // do so for ImplControlValue members, also
- ImplMoveControlValue( nType, aValue, aWinOffs );
-
- Region aTestRegion( GetActiveClipRegion() );
- aTestRegion.Intersect( rControlRegion );
- if( aTestRegion == rControlRegion )
- nState |= CTRL_CACHING_ALLOWED; // control is not clipped, caching allowed
-
- BOOL bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, aValue, *ImplGetWinData()->mpSalControlHandle, aCaption, this );
-
- // transform back ImplControlValue members
- ImplMoveControlValue( nType, aValue, Point()-aWinOffs );
-
- return bRet;
-}
-
-
-// -----------------------------------------------------------------------
-
-BOOL Window::DrawNativeControlText(ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- OUString aCaption )
-{
- if( !IsNativeWidgetEnabled() )
- return FALSE;
-
- ImplInitSalControlHandle();
-
- // make sure the current clip region is initialized correctly
- if ( !mpGraphics )
- if ( !ImplGetGraphics() )
- return false;
-
- if ( mbInitClipRegion )
- ImplInitClipRegion();
- if ( mbOutputClipped )
- return true;
-
- if ( mbInitLineColor )
- ImplInitLineColor();
- if ( mbInitFillColor )
- ImplInitFillColor();
-
- // Convert the coordinates from relative to Window-absolute, so we draw
- // in the correct place in platform code
- Point aWinOffs;
- aWinOffs = OutputToScreenPixel( aWinOffs );
- Region screenRegion( rControlRegion );
- screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
- ImplMoveControlValue( nType, aValue, aWinOffs );
-
- BOOL bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, aValue, *ImplGetWinData()->mpSalControlHandle, aCaption, this );
-
- // transform back ImplControlValue members
- ImplMoveControlValue( nType, aValue, Point()-aWinOffs );
-
- return bRet;
-}
-
-
-// -----------------------------------------------------------------------
-
-BOOL Window::GetNativeControlRegion( ControlType nType,
- ControlPart nPart,
- const Region& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- OUString aCaption,
- Region &rNativeBoundingRegion,
- Region &rNativeContentRegion )
-{
- if( !IsNativeWidgetEnabled() )
- return FALSE;
-
- if ( !mpGraphics )
- if ( !ImplGetGraphics() )
- return FALSE;
-
- ImplInitSalControlHandle();
-
- // Convert the coordinates from relative to Window-absolute, so we draw
- // in the correct place in platform code
- Point aWinOffs;
- aWinOffs = OutputToScreenPixel( aWinOffs );
- Region screenRegion( rControlRegion );
- screenRegion.Move( aWinOffs.X(), aWinOffs.Y());
- ImplMoveControlValue( nType, aValue, aWinOffs );
-
- BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, aValue,
- *ImplGetWinData()->mpSalControlHandle, aCaption, rNativeBoundingRegion,
- rNativeContentRegion, this );
- if( bRet )
- {
- // transform back native regions
- rNativeBoundingRegion.Move( -aWinOffs.X(), -aWinOffs.Y() );
- rNativeContentRegion.Move( -aWinOffs.X(), -aWinOffs.Y() );
- }
- // transform back ImplControlValue members
- ImplMoveControlValue( nType, aValue, Point()-aWinOffs );
-
- return bRet;
-}
-
-
// -----------------------------------------------------------------------
WaitObject::~WaitObject()
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index f63f999738a7..2679f4a29c02 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -636,9 +636,6 @@ void GtkXLib::Init()
Display *pDisp = gdk_x11_display_get_xdisplay( pGdkDisp );
- XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
- XSetErrorHandler ( (XErrorHandler)X11SalData::XErrorHdl );
-
m_pGtkSalDisplay = new GtkSalDisplay( pGdkDisp );
gdk_window_add_filter( NULL, call_filterGdkEvent, m_pGtkSalDisplay );
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index de4d55b0230a..cdc72485ae6c 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -191,34 +191,34 @@ static void NWCalcArrowRect( const Rectangle& rButton, Rectangle& rArrow );
//---
static Rectangle NWGetButtonArea( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption );
+ const ImplControlValue& aValue, const OUString& rCaption );
//---
static Rectangle NWGetEditBoxPixmapRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption );
+ const ImplControlValue& aValue, const OUString& rCaption );
static void NWPaintOneEditBox( int nScreen, GdkDrawable * gdkDrawable, GdkRectangle *gdkRect,
ControlType nType, ControlPart nPart, Rectangle aEditBoxRect,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
//---
static Rectangle NWGetSpinButtonRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption );
+ const ImplControlValue& aValue, const OUString& rCaption );
static void NWPaintOneSpinButton( int nScreen, GdkPixmap * pixmap, ControlType nType, ControlPart nPart, Rectangle aAreaRect,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const OUString& rCaption );
//---
static Rectangle NWGetComboBoxButtonRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption );
+ const ImplControlValue& aValue, const OUString& rCaption );
//---
static Rectangle NWGetListBoxButtonRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption );
+ const ImplControlValue& aValue, const OUString& rCaption );
static Rectangle NWGetListBoxIndicatorRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption );
+ const ImplControlValue& aValue, const OUString& rCaption );
static Rectangle NWGetToolbarRect( int nScreen,
ControlType nType,
@@ -226,7 +226,6 @@ static Rectangle NWGetToolbarRect( int nScreen,
Rectangle aAreaRect,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const OUString& rCaption );
//---
@@ -620,7 +619,6 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType,
ControlPart nPart,
const Region& rControlRegion,
const Point& aPos,
- SalControlHandle&,
BOOL& rIsInside )
{
if ( ( nType == CTRL_SCROLLBAR ) &&
@@ -725,7 +723,6 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation.
* rCaption: A caption or title string (like button text etc)
*/
BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
@@ -733,13 +730,12 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const OUString& rCaption )
{
if( (nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL) &&
aValue.getTristateVal() == BUTTONVALUE_MIXED )
{
- return drawNativeMixedStateCheck( nType, nPart, rControlRegion, nState, aValue, rControlHandle, rCaption );
+ return drawNativeMixedStateCheck( nType, nPart, rControlRegion, nState, aValue, rCaption );
}
BOOL returnVal = FALSE;
@@ -802,61 +798,61 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
if ( (nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL) )
{
- returnVal = NWPaintGTKButton( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKButton( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType==CTRL_RADIOBUTTON) && (nPart==PART_ENTIRE_CONTROL) )
{
- returnVal = NWPaintGTKRadio( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKRadio( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL) )
{
- returnVal = NWPaintGTKCheck( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKCheck( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType==CTRL_SCROLLBAR) && ((nPart==PART_DRAW_BACKGROUND_HORZ) || (nPart==PART_DRAW_BACKGROUND_VERT)) )
{
- returnVal = NWPaintGTKScrollbar( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKScrollbar( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( ((nType==CTRL_EDITBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==HAS_BACKGROUND_TEXTURE)) )
|| ((nType==CTRL_SPINBOX) && (nPart==HAS_BACKGROUND_TEXTURE))
|| ((nType==CTRL_COMBOBOX) && (nPart==HAS_BACKGROUND_TEXTURE))
|| ((nType==CTRL_LISTBOX) && (nPart==HAS_BACKGROUND_TEXTURE)) )
{
- returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( ((nType==CTRL_MULTILINE_EDITBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==HAS_BACKGROUND_TEXTURE)) ) )
{
- returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( ((nType==CTRL_SPINBOX) || (nType==CTRL_SPINBUTTONS))
&& ((nPart==PART_ENTIRE_CONTROL) || (nPart==PART_ALL_BUTTONS)) )
{
- returnVal = NWPaintGTKSpinBox( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKSpinBox( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType == CTRL_COMBOBOX) &&
( (nPart==PART_ENTIRE_CONTROL)
||(nPart==PART_BUTTON_DOWN)
) )
{
- returnVal = NWPaintGTKComboBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKComboBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType==CTRL_TAB_ITEM) || (nType==CTRL_TAB_PANE) || (nType==CTRL_TAB_BODY) || (nType==CTRL_FIXEDBORDER) )
{
if ( nType == CTRL_TAB_BODY )
returnVal = TRUE;
else
- returnVal = NWPaintGTKTabItem( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption);
+ returnVal = NWPaintGTKTabItem( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption);
}
else if ( (nType==CTRL_LISTBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==PART_WINDOW)) )
{
- returnVal = NWPaintGTKListBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKListBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType== CTRL_TOOLBAR) )
{
- returnVal = NWPaintGTKToolbar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKToolbar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if ( (nType== CTRL_MENUBAR) )
{
- returnVal = NWPaintGTKMenubar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKMenubar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if( (nType == CTRL_MENU_POPUP)
&& ( (nPart == PART_ENTIRE_CONTROL)
@@ -866,19 +862,19 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
)
)
{
- returnVal = NWPaintGTKPopupMenu( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKPopupMenu( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if( (nType == CTRL_TOOLTIP) && (nPart == PART_ENTIRE_CONTROL) )
{
- returnVal = NWPaintGTKTooltip( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKTooltip( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if( (nType == CTRL_PROGRESS) && (nPart == PART_ENTIRE_CONTROL) )
{
- returnVal = NWPaintGTKProgress( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKProgress( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if( (nType == CTRL_LISTNODE) && (nPart == PART_ENTIRE_CONTROL) )
{
- returnVal = NWPaintGTKListNode( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKListNode( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
else if( (nType == CTRL_LISTNET) && (nPart == PART_ENTIRE_CONTROL) )
{
@@ -887,7 +883,7 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
}
else if( (nType == CTRL_SLIDER) )
{
- returnVal = NWPaintGTKSlider( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ returnVal = NWPaintGTKSlider( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
}
if( pixmap )
@@ -904,7 +900,6 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType,
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const OUString& rCaption )
{
// need to emulate something for mixed state
@@ -927,7 +922,7 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType,
SetClipRegion( pFontGC_, aRegion );
XDestroyRegion( aRegion );
- returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, rCaption );
+ returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption );
if( returnVal )
{
@@ -938,7 +933,7 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType,
XUnionRectWithRegion( &aXRect, aRegion, aRegion );
SetClipRegion( pFontGC_, aRegion );
XDestroyRegion( aRegion );
- returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, rCaption );
+ returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption );
}
// clean up
@@ -957,7 +952,6 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation.
* rCaption: A caption or title string (like button text etc)
*/
BOOL GtkSalGraphics::drawNativeControlText( ControlType,
@@ -965,7 +959,6 @@ BOOL GtkSalGraphics::drawNativeControlText( ControlType,
const Region&,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
return( FALSE );
@@ -983,7 +976,6 @@ BOOL GtkSalGraphics::drawNativeControlText( ControlType,
*
* rControlRegion: The bounding region of the control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation.
* rCaption: A caption or title string (like button text etc)
*/
BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
@@ -991,7 +983,6 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const OUString& rCaption,
Region &rNativeBoundingRegion,
Region &rNativeContentRegion )
@@ -1003,7 +994,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
&& (rControlRegion.GetBoundRect().GetHeight() > 16) )
{
rNativeBoundingRegion = NWGetButtonArea( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(),
- nState, aValue, rControlHandle, rCaption );
+ nState, aValue, rCaption );
rNativeContentRegion = rControlRegion;
returnVal = TRUE;
@@ -1011,7 +1002,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
if ( (nType==CTRL_COMBOBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) )
{
rNativeBoundingRegion = NWGetComboBoxButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState,
- aValue, rControlHandle, rCaption );
+ aValue, rCaption );
rNativeContentRegion = rNativeBoundingRegion;
returnVal = TRUE;
@@ -1020,7 +1011,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
{
rNativeBoundingRegion = NWGetSpinButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState,
- aValue, rControlHandle, rCaption );
+ aValue, rCaption );
rNativeContentRegion = rNativeBoundingRegion;
returnVal = TRUE;
@@ -1028,7 +1019,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
if ( (nType==CTRL_LISTBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) )
{
rNativeBoundingRegion = NWGetListBoxButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState,
- aValue, rControlHandle, rCaption );
+ aValue, rCaption );
rNativeContentRegion = rNativeBoundingRegion;
returnVal = TRUE;
@@ -1041,7 +1032,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
(nPart==PART_BUTTON)
))
{
- rNativeBoundingRegion = NWGetToolbarRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, aValue, rControlHandle, rCaption );
+ rNativeBoundingRegion = NWGetToolbarRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, aValue, rCaption );
rNativeContentRegion = rNativeBoundingRegion;
returnVal = TRUE;
}
@@ -1155,7 +1146,7 @@ BOOL GtkSalGraphics::NWPaintGTKButton(
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue&,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
GtkStateType stateType;
GtkShadowType shadowType;
@@ -1268,7 +1259,7 @@ BOOL GtkSalGraphics::NWPaintGTKButton(
static Rectangle NWGetButtonArea( int nScreen,
ControlType, ControlPart, Rectangle aAreaRect, ControlState nState,
- const ImplControlValue&, SalControlHandle&, const OUString& )
+ const ImplControlValue&, const OUString& )
{
gboolean interiorFocus;
gint focusWidth;
@@ -1324,7 +1315,7 @@ BOOL GtkSalGraphics::NWPaintGTKRadio( GdkDrawable* gdkDrawable,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState,
- const ImplControlValue& aValue, SalControlHandle&,
+ const ImplControlValue& aValue,
const OUString& )
{
GtkStateType stateType;
@@ -1383,7 +1374,7 @@ BOOL GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable,
const clipList& rClipList,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
GtkStateType stateType;
GtkShadowType shadowType;
@@ -1438,7 +1429,7 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList&,
ControlState nState,
- const ImplControlValue& aValue, SalControlHandle&,
+ const ImplControlValue& aValue,
const OUString& )
{
ScrollbarValue* pScrollbarVal = (ScrollbarValue *)(aValue.getOptionalVal());
@@ -1844,7 +1835,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const ImplControlValue& aValue,
const OUString& rCaption )
{
Rectangle pixmapRect;
@@ -1853,7 +1844,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable,
// Find the overall bounding rect of the buttons's drawing area,
// plus its actual draw rect excluding adornment
pixmapRect = NWGetEditBoxPixmapRect( m_nScreen, nType, nPart, rControlRectangle,
- nState, aValue, rControlHandle, rCaption );
+ nState, aValue, rCaption );
for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
{
clipRect.x = it->Left();
@@ -1861,7 +1852,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable,
clipRect.width = it->GetWidth();
clipRect.height = it->GetHeight();
- NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, pixmapRect, nState, aValue, rControlHandle, rCaption );
+ NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, pixmapRect, nState, aValue, rCaption );
}
return( TRUE );
@@ -1878,7 +1869,6 @@ static Rectangle NWGetEditBoxPixmapRect(int nScreen,
Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
Rectangle pixmapRect = aAreaRect;
@@ -1915,7 +1905,6 @@ static void NWPaintOneEditBox( int nScreen,
Rectangle aEditBoxRect,
ControlState nState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
GtkStateType stateType;
@@ -1984,7 +1973,7 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
const clipList&,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption )
+ const OUString& rCaption )
{
GdkPixmap * pixmap;
Rectangle pixmapRect;
@@ -2032,8 +2021,8 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
if ( !pixmap )
return( FALSE );
- upBtnRect = NWGetSpinButtonRect( m_nScreen, nType, upBtnPart, pixmapRect, upBtnState, aValue, rControlHandle, rCaption );
- downBtnRect = NWGetSpinButtonRect( m_nScreen, nType, downBtnPart, pixmapRect, downBtnState, aValue, rControlHandle, rCaption );
+ upBtnRect = NWGetSpinButtonRect( m_nScreen, nType, upBtnPart, pixmapRect, upBtnState, aValue, rCaption );
+ downBtnRect = NWGetSpinButtonRect( m_nScreen, nType, downBtnPart, pixmapRect, downBtnState, aValue, rCaption );
if ( (nType==CTRL_SPINBOX) && (nPart!=PART_ALL_BUTTONS) )
{
@@ -2043,7 +2032,7 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
aEditBoxRect.setX( 0 );
aEditBoxRect.setY( 0 );
- NWPaintOneEditBox( m_nScreen, pixmap, NULL, nType, nPart, aEditBoxRect, nState, aValue, rControlHandle, rCaption );
+ NWPaintOneEditBox( m_nScreen, pixmap, NULL, nType, nPart, aEditBoxRect, nState, aValue, rCaption );
}
NWSetWidgetState( gWidgetData[m_nScreen].gSpinButtonWidget, nState, stateType );
@@ -2060,8 +2049,8 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
shadowRect.GetWidth(), shadowRect.GetHeight() );
}
- NWPaintOneSpinButton( m_nScreen, pixmap, nType, upBtnPart, pixmapRect, upBtnState, aValue, rControlHandle, rCaption );
- NWPaintOneSpinButton( m_nScreen, pixmap, nType, downBtnPart, pixmapRect, downBtnState, aValue, rControlHandle, rCaption );
+ NWPaintOneSpinButton( m_nScreen, pixmap, nType, upBtnPart, pixmapRect, upBtnState, aValue, rCaption );
+ NWPaintOneSpinButton( m_nScreen, pixmap, nType, downBtnPart, pixmapRect, downBtnState, aValue, rCaption );
if( !NWRenderPixmapToScreen(pixmap, pixmapRect) )
{
@@ -2081,7 +2070,6 @@ static Rectangle NWGetSpinButtonRect( int nScreen,
Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
gint buttonSize;
@@ -2125,7 +2113,6 @@ static void NWPaintOneSpinButton( int nScreen,
Rectangle aAreaRect,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const OUString& rCaption )
{
Rectangle buttonRect;
@@ -2137,7 +2124,7 @@ static void NWPaintOneSpinButton( int nScreen,
NWEnsureGTKSpinButton( nScreen );
NWConvertVCLStateToGTKState( nState, &stateType, &shadowType );
- buttonRect = NWGetSpinButtonRect( nScreen, nType, nPart, aAreaRect, nState, aValue, rControlHandle, rCaption );
+ buttonRect = NWGetSpinButtonRect( nScreen, nType, nPart, aAreaRect, nState, aValue, rCaption );
NWSetWidgetState( gWidgetData[nScreen].gSpinButtonWidget, nState, stateType );
gtk_paint_box( gWidgetData[nScreen].gSpinButtonWidget->style, pixmap, stateType, shadowType, NULL, gWidgetData[nScreen].gSpinButtonWidget,
@@ -2169,7 +2156,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
const clipList& rClipList,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption )
+ const OUString& rCaption )
{
Rectangle pixmapRect;
Rectangle buttonRect;
@@ -2194,7 +2181,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
NWSetWidgetState( gWidgetData[m_nScreen].gComboWidget, nState, stateType );
NWSetWidgetState( gWidgetData[m_nScreen].gArrowWidget, nState, stateType );
- buttonRect = NWGetComboBoxButtonRect( m_nScreen, nType, PART_BUTTON_DOWN, pixmapRect, nState, aValue, rControlHandle, rCaption );
+ buttonRect = NWGetComboBoxButtonRect( m_nScreen, nType, PART_BUTTON_DOWN, pixmapRect, nState, aValue, rCaption );
if( nPart == PART_BUTTON_DOWN )
buttonRect.Left() += 1;
@@ -2216,7 +2203,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
if( nPart == PART_ENTIRE_CONTROL )
NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, aEditBoxRect,
- nState, aValue, rControlHandle, rCaption );
+ nState, aValue, rCaption );
// Buttons must paint opaque since some themes have alpha-channel enabled buttons
gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
@@ -2247,7 +2234,6 @@ static Rectangle NWGetComboBoxButtonRect( int nScreen,
Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
Rectangle aButtonRect;
@@ -2302,7 +2288,7 @@ BOOL GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
const clipList&,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
GdkPixmap * pixmap;
Rectangle pixmapRect;
@@ -2444,7 +2430,7 @@ BOOL GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable,
const clipList& rClipList,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption )
+ const OUString& rCaption )
{
Rectangle pixmapRect;
Rectangle widgetRect;
@@ -2511,7 +2497,7 @@ BOOL GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable,
y+(widgetRect.Top() - pixmapRect.Top()),
widgetRect.GetWidth(), widgetRect.GetHeight() );
aIndicatorRect = NWGetListBoxIndicatorRect( m_nScreen, nType, nPart, widgetRect, nState,
- aValue, rControlHandle, rCaption );
+ aValue, rCaption );
gtk_paint_tab( gWidgetData[m_nScreen].gOptionMenuWidget->style, gdkDrawable, stateType, shadowType, &clipRect,
gWidgetData[m_nScreen].gOptionMenuWidget, "optionmenutab",
x+(aIndicatorRect.Left() - pixmapRect.Left()),
@@ -2538,7 +2524,7 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar(
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
GtkStateType stateType;
GtkShadowType shadowType;
@@ -2685,7 +2671,7 @@ BOOL GtkSalGraphics::NWPaintGTKMenubar(
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue&,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
GtkStateType stateType;
GtkShadowType shadowType;
@@ -2770,7 +2756,7 @@ BOOL GtkSalGraphics::NWPaintGTKPopupMenu(
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue&,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
// #i50745# gtk does not draw disabled menu entries (and crux theme
// even crashes), draw them using vcl functionality.
@@ -2900,7 +2886,7 @@ BOOL GtkSalGraphics::NWPaintGTKTooltip(
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState, const ImplControlValue&,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
NWEnsureGTKTooltip( m_nScreen );
@@ -2938,7 +2924,7 @@ BOOL GtkSalGraphics::NWPaintGTKListNode(
const Rectangle& rControlRectangle,
const clipList&,
ControlState nState, const ImplControlValue& rValue,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
NWEnsureGTKTreeView( m_nScreen );
@@ -2992,7 +2978,7 @@ BOOL GtkSalGraphics::NWPaintGTKProgress(
const Rectangle& rControlRectangle,
const clipList&,
ControlState, const ImplControlValue& rValue,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
NWEnsureGTKProgressBar( m_nScreen );
@@ -3056,7 +3042,7 @@ BOOL GtkSalGraphics::NWPaintGTKSlider(
const Rectangle& rControlRectangle,
const clipList&,
ControlState nState, const ImplControlValue& rValue,
- SalControlHandle&, const OUString& )
+ const OUString& )
{
NWEnsureGTKSlider( m_nScreen );
@@ -3185,7 +3171,6 @@ static Rectangle NWGetListBoxButtonRect( int nScreen,
Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
Rectangle aPartRect;
@@ -3248,7 +3233,6 @@ static Rectangle NWGetListBoxIndicatorRect( int nScreen,
Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
Rectangle aIndicatorRect;
@@ -3295,7 +3279,6 @@ static Rectangle NWGetToolbarRect( int nScreen,
Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
Rectangle aRet;
@@ -3471,11 +3454,11 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aBackColor = getColor( pMenubarStyle->bg[GTK_STATE_NORMAL] );
aStyleSet.SetMenuBarColor( aBackColor );
aBackColor = getColor( pMenuStyle->bg[GTK_STATE_NORMAL] );
- aTextColor = getColor( pMenuTextStyle->text[GTK_STATE_NORMAL] );
+ aTextColor = getColor( pMenuTextStyle->fg[GTK_STATE_NORMAL] );
aStyleSet.SetMenuColor( aBackColor );
aStyleSet.SetMenuTextColor( aTextColor );
- aTextColor = getColor( pMenubarStyle->text[GTK_STATE_NORMAL] );
+ aTextColor = getColor( pMenubarStyle->fg[GTK_STATE_NORMAL] );
aStyleSet.SetMenuBarTextColor( aTextColor );
#if OSL_DEBUG_LEVEL > 1
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 3d11ce8a37ea..11d567c85098 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -1353,15 +1353,11 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate )
//
// i.e. having a time < that of the toplevel frame means that the toplevel frame gets unfocused.
// awesome.
- bool bMetaCity = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity");
- if( nUserTime == 0 &&
- ( bMetaCity ||
- (
- getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz") &&
- (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION))
- )
- )
- )
+ bool bHack =
+ getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") ||
+ getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz")
+ ;
+ if( nUserTime == 0 && bHack )
{
/* #i99360# ugly workaround an X11 library bug */
nUserTime= getDisplay()->GetLastUserEventTime( true );
@@ -1369,7 +1365,7 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate )
}
lcl_set_user_time( GTK_WIDGET(m_pWindow)->window, nUserTime );
- if( bMetaCity && ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) )
+ if( bHack && ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) )
m_bSetFocusOnMap = true;
gtk_widget_show( m_pWindow );
@@ -3240,7 +3236,8 @@ GtkSalFrame::IMHandler::IMHandler( GtkSalFrame* pFrame )
: m_pFrame(pFrame),
m_nPrevKeyPresses( 0 ),
m_pIMContext( NULL ),
- m_bFocused( true )
+ m_bFocused( true ),
+ m_bPreeditJustChanged( false )
{
m_aInputEvent.mpTextAttr = NULL;
createIMContext();
@@ -3415,6 +3412,8 @@ bool GtkSalFrame::IMHandler::handleKeyEvent( GdkEventKey* pEvent )
if( aDel.isDeleted() )
return true;
+ m_bPreeditJustChanged = false;
+
if( bResult )
return true;
else
@@ -3444,6 +3443,8 @@ bool GtkSalFrame::IMHandler::handleKeyEvent( GdkEventKey* pEvent )
if( aDel.isDeleted() )
return true;
+ m_bPreeditJustChanged = false;
+
std::list<PreviousKeyPress>::iterator iter = m_aPrevKeyPresses.begin();
std::list<PreviousKeyPress>::iterator iter_end = m_aPrevKeyPresses.end();
while (iter != iter_end)
@@ -3507,8 +3508,6 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p
{
GTK_YIELD_GRAB();
- bool bWasPreedit = (pThis->m_aInputEvent.mpTextAttr != 0);
-
pThis->m_aInputEvent.mnTime = 0;
pThis->m_aInputEvent.mpTextAttr = 0;
pThis->m_aInputEvent.maText = String( pText, RTL_TEXTENCODING_UTF8 );
@@ -3532,6 +3531,9 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p
* or because there never was a preedit.
*/
bool bSingleCommit = false;
+ bool bWasPreedit =
+ (pThis->m_aInputEvent.mpTextAttr != 0) ||
+ pThis->m_bPreeditJustChanged;
if( ! bWasPreedit
&& pThis->m_aInputEvent.maText.Len() == 1
&& ! pThis->m_aPrevKeyPresses.empty()
@@ -3546,7 +3548,6 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p
bSingleCommit = true;
}
}
-
if( ! bSingleCommit )
{
pThis->m_pFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void*)&pThis->m_aInputEvent);
@@ -3594,6 +3595,8 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
}
}
+ pThis->m_bPreeditJustChanged = true;
+
bool bEndPreedit = (!pText || !*pText) && pThis->m_aInputEvent.mpTextAttr != NULL;
pThis->m_aInputEvent.mnTime = 0;
pThis->m_aInputEvent.maText = String( pText, RTL_TEXTENCODING_UTF8 );
@@ -3677,6 +3680,8 @@ void GtkSalFrame::IMHandler::signalIMPreeditEnd( GtkIMContext*, gpointer im_hand
GtkSalFrame::IMHandler* pThis = (GtkSalFrame::IMHandler*)im_handler;
GTK_YIELD_GRAB();
+ pThis->m_bPreeditJustChanged = true;
+
vcl::DeletionListener aDel( pThis->m_pFrame );
pThis->doCallEndExtTextInput();
if( ! aDel.isDeleted() )
diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx
index 88a26b401eed..18dd476fc2c4 100644
--- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx
@@ -130,6 +130,7 @@ class GtkSalFrame : public SalFrame
int m_nPrevKeyPresses; // avoid using size()
GtkIMContext* m_pIMContext;
bool m_bFocused;
+ bool m_bPreeditJustChanged;
SalExtTextInputEvent m_aInputEvent;
std::vector< USHORT > m_aInputFlags;
diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
index ed3f782c8576..065b5435eeb0 100644
--- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
@@ -64,15 +64,15 @@ public:
// native widget methods
virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart );
virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside );
+ const Point& aPos, BOOL& rIsInside );
virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const rtl::OUString& rCaption );
virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const rtl::OUString& rCaption );
+ const rtl::OUString& rCaption );
virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& rCaption,
+ const ImplControlValue& aValue, const rtl::OUString& rCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
//helper methods for frame's UpdateSettings
@@ -101,86 +101,86 @@ protected:
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKRadio( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKCheck( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKScrollbar( ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKEditBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKTabItem( ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKListBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKToolbar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKMenubar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKPopupMenu( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKTooltip( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKProgress( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const OUString& rCaption );
+ const OUString& rCaption );
BOOL drawNativeMixedStateCheck( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const rtl::OUString& rCaption );
};
diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx
index e54d6e828911..3734cbec6ef7 100644
--- a/vcl/unx/inc/saldisp.hxx
+++ b/vcl/unx/inc/saldisp.hxx
@@ -231,6 +231,7 @@ protected:
XErrorHandler m_aHandler;
};
std::vector< XErrorStackEntry > m_aXErrorHandlerStack;
+ XIOErrorHandler m_aOrigXIOErrorHandler;
public:
SalXLib();
virtual ~SalXLib();
diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h
index da69f04b6f8f..6ccea2c4a00c 100644
--- a/vcl/unx/inc/salgdi.h
+++ b/vcl/unx/inc/salgdi.h
@@ -57,6 +57,10 @@ class ImplLayoutArgs;
class X11FontLayout;
class ServerFontLayout;
+namespace basegfx {
+ class B2DTrapezoid;
+}
+
// -=-= SalGraphicsData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
class CairoFontsCache
@@ -289,8 +293,11 @@ public:
virtual void drawPolyPolygon( sal_uInt32 nPoly,
const sal_uInt32* pPoints,
PCONSTSALPOINT* pPtAry );
- virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency );
- virtual bool drawPolyLine( const ::basegfx::B2DPolygon& rPolygon, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin);
+ virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
+ virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin );
+ virtual bool drawFilledTrapezoids( const ::basegfx::B2DTrapezoid*, int nTrapCount, double fTransparency );
+
+#if 1 // TODO: remove these obselete methods
virtual sal_Bool drawPolyLineBezier( ULONG nPoints,
const SalPoint* pPtAry,
const BYTE* pFlgAry );
@@ -301,6 +308,8 @@ public:
const sal_uInt32* pPoints,
const SalPoint* const* pPtAry,
const BYTE* const* pFlgAry );
+#endif
+
virtual void copyArea( long nDestX,
long nDestY,
long nSrcX,
diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx
index 5e2801e47fc6..34b0ff652cde 100644
--- a/vcl/unx/kde/kdedata.cxx
+++ b/vcl/unx/kde/kdedata.cxx
@@ -182,9 +182,6 @@ void KDEXLib::Init()
SalDisplay *pSalDisplay = new SalKDEDisplay( pDisp );
- XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
- XSetErrorHandler ( (XErrorHandler)X11SalData::XErrorHdl );
-
pInputMethod->CreateMethod( pDisp );
pInputMethod->AddConnectionWatch( pDisp, (void*)this );
pSalDisplay->SetInputMethod( pInputMethod );
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index ea9161235ac9..3adc9f5c679a 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -1177,18 +1177,18 @@ class KDESalGraphics : public X11SalGraphics
virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart );
virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart,
const Region& rControlRegion, const Point& aPos,
- SalControlHandle& rControlHandle, BOOL& rIsInside );
+ BOOL& rIsInside );
virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart,
const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const ImplControlValue& aValue,
const OUString& aCaption );
virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart,
const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const ImplControlValue& aValue,
const OUString& aCaption );
virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart,
const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const ImplControlValue& aValue,
const OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
};
@@ -1242,7 +1242,7 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
*/
BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart,
const Region& rControlRegion, const Point& rPos,
- SalControlHandle&, BOOL& rIsInside )
+ BOOL& rIsInside )
{
if ( nType == CTRL_SCROLLBAR )
{
@@ -1344,15 +1344,12 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart,
@param aValue
An optional value (tristate/numerical/string).
- @param rControlHandle
- Carries platform dependent data and is maintained by the SalFrame implementation.
-
@param aCaption
A caption or title string (like button text etc.)
*/
BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart,
const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle&,
+ const ImplControlValue& aValue,
const OUString& )
{
BOOL bReturn = FALSE;
@@ -1489,15 +1486,12 @@ BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart,
@param aValue
An optional value (tristate/numerical/string)
- @param rControlHandle
- Carries platform dependent data and is maintained by the SalFrame implementation.
-
@param aCaption
A caption or title string (like button text etc.)
*/
BOOL KDESalGraphics::drawNativeControlText( ControlType, ControlPart,
const Region&, ControlState,
- const ImplControlValue&, SalControlHandle&,
+ const ImplControlValue&,
const OUString& )
{
return FALSE;
@@ -1517,15 +1511,12 @@ BOOL KDESalGraphics::drawNativeControlText( ControlType, ControlPart,
@param aValue
An optional value (tristate/numerical/string)
- @param rControlHandle
- Carries platform dependent data and is maintained by the SalFrame implementation.
-
@param aCaption
A caption or title string (like button text etc.)
*/
BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart,
const Region& rControlRegion, ControlState nState,
- const ImplControlValue&, SalControlHandle&,
+ const ImplControlValue&,
const OUString&,
Region &rNativeBoundingRegion, Region &rNativeContentRegion )
{
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index 25dd50ce3958..5f8b5d2ae59e 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -158,7 +158,7 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par
BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart,
const Region&, const Point&,
- SalControlHandle&, BOOL& )
+ BOOL& )
{
return FALSE;
}
@@ -220,7 +220,7 @@ namespace
BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
const Region& rControlRegion, ControlState nControlState,
- const ImplControlValue& value, SalControlHandle&,
+ const ImplControlValue& value,
const OUString& )
{
// put not implemented types here
@@ -567,7 +567,7 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
const Region& controlRegion, ControlState controlState,
- const ImplControlValue& val, SalControlHandle&,
+ const ImplControlValue& val,
const OUString&,
Region &nativeBoundingRegion, Region &nativeContentRegion )
{
@@ -744,7 +744,7 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
{
if( part == PART_BORDER )
{
- int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
+ int size = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
USHORT nStyle = val.getNumericVal();
if( nStyle & FRAME_DRAW_NODRAW )
{
diff --git a/vcl/unx/kde4/KDESalGraphics.hxx b/vcl/unx/kde4/KDESalGraphics.hxx
index b5328f462a16..5661d743e0cd 100644
--- a/vcl/unx/kde4/KDESalGraphics.hxx
+++ b/vcl/unx/kde4/KDESalGraphics.hxx
@@ -59,7 +59,7 @@ class KDESalGraphics : public X11SalGraphics
*/
virtual BOOL hitTestNativeControl( ControlType type, ControlPart part,
const Region& rControlRegion, const Point& aPos,
- SalControlHandle& rControlHandle, BOOL& rIsInside );
+ BOOL& rIsInside );
/** Draw the requested control described by part/nControlState.
@param rControlRegion
@@ -68,15 +68,12 @@ class KDESalGraphics : public X11SalGraphics
@param aValue
An optional value (tristate/numerical/string).
- @param rControlHandle
- Carries platform dependent data and is maintained by the SalFrame implementation.
-
@param aCaption
A caption or title string (like button text etc.)
*/
virtual BOOL drawNativeControl( ControlType type, ControlPart part,
const Region& rControlRegion, ControlState nControlState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const ImplControlValue& aValue,
const rtl::OUString& aCaption );
/** Draw text on the widget.
@@ -85,12 +82,11 @@ class KDESalGraphics : public X11SalGraphics
@param rControlRegion The bounding region of the complete control in VCL frame coordinates.
@param aValue An optional value (tristate/numerical/string)
- @param rControlHandle Carries platform dependent data and is maintained by the SalFrame implementation.
@param aCaption A caption or title string (like button text etc.)
*/
virtual BOOL drawNativeControlText( ControlType, ControlPart,
const Region&, ControlState,
- const ImplControlValue&, SalControlHandle&,
+ const ImplControlValue&,
const rtl::OUString& ) { return false; }
/** Check if the bounding regions match.
@@ -106,15 +102,12 @@ class KDESalGraphics : public X11SalGraphics
@param aValue
An optional value (tristate/numerical/string)
- @param rControlHandle
- Carries platform dependent data and is maintained by the SalFrame implementation.
-
@param aCaption
A caption or title string (like button text etc.)
*/
virtual BOOL getNativeControlRegion( ControlType type, ControlPart part,
const Region& rControlRegion, ControlState nControlState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const ImplControlValue& aValue,
const rtl::OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
}; \ No newline at end of file
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index 2e5b86b79f9c..6a2793b8abe3 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -148,9 +148,6 @@ void KDEXLib::Init()
((VCLKDEApplication*)m_pApplication)->disp = pSalDisplay;
- XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
- XSetErrorHandler ( (XErrorHandler)X11SalData::XErrorHdl );
-
pInputMethod->CreateMethod( pDisp );
pInputMethod->AddConnectionWatch( pDisp, (void*)this );
pSalDisplay->SetInputMethod( pInputMethod );
@@ -175,4 +172,4 @@ void KDEXLib::doStartup()
fprintf( stderr, "called KStartupInfo::appStarted()\n" );
#endif
}
-} \ No newline at end of file
+}
diff --git a/vcl/unx/source/app/saldata.cxx b/vcl/unx/source/app/saldata.cxx
index 75d18de0787a..50ef71df8619 100644
--- a/vcl/unx/source/app/saldata.cxx
+++ b/vcl/unx/source/app/saldata.cxx
@@ -353,8 +353,9 @@ SalXLib::SalXLib()
nFDs_ = m_pTimeoutFDS[0] + 1;
}
- PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) );
m_bHaveSystemChildFrames = false;
+ m_aOrigXIOErrorHandler = XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
+ PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) );
}
SalXLib::~SalXLib()
@@ -364,6 +365,7 @@ SalXLib::~SalXLib()
close (m_pTimeoutFDS[1]);
PopXErrorLevel();
+ XSetIOErrorHandler (m_aOrigXIOErrorHandler);
}
void SalXLib::PushXErrorLevel( bool bIgnore )
@@ -459,8 +461,6 @@ void SalXLib::Init()
exit(0);
}
- XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
-
SalDisplay *pSalDisplay = new SalX11Display( pDisp );
pInputMethod->CreateMethod( pDisp );
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index bc6de4fbc94a..816c8fb0b4c4 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -123,6 +123,8 @@ class FontCfgWrapper
FcPattern* (*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*);
FcBool (*m_pFcConfigAppFontAddFile)(FcConfig*, const FcChar8*);
FcBool (*m_pFcConfigAppFontAddDir)(FcConfig*, const FcChar8*);
+ FcBool (*m_pFcConfigParseAndLoad)(FcConfig*,const FcChar8*,FcBool);
+
FcBool (*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind);
FcBool (*m_pFcPatternAddInteger)(FcPattern*,const char*,int);
FcBool (*m_pFcPatternAddDouble)(FcPattern*,const char*,double);
@@ -221,6 +223,9 @@ public:
{ return m_pFcConfigAppFontAddFile( pConfig, pFileName ); }
FcBool FcConfigAppFontAddDir(FcConfig* pConfig, const FcChar8* pDirName )
{ return m_pFcConfigAppFontAddDir( pConfig, pDirName ); }
+ FcBool FcConfigParseAndLoad( FcConfig* pConfig, const FcChar8* pFileName, FcBool bComplain )
+ { return m_pFcConfigParseAndLoad( pConfig, pFileName, bComplain ); }
+
void FcDefaultSubstitute( FcPattern* pPattern )
{ m_pFcDefaultSubstitute( pPattern ); }
FcPattern* FcFontSetMatch( FcConfig* pConfig, FcFontSet **ppFontSet, int nset, FcPattern* pPattern, FcResult* pResult )
@@ -326,6 +331,8 @@ FontCfgWrapper::FontCfgWrapper()
loadSymbol( "FcConfigAppFontAddFile" );
m_pFcConfigAppFontAddDir = (FcBool(*)(FcConfig*, const FcChar8*))
loadSymbol( "FcConfigAppFontAddDir" );
+ m_pFcConfigParseAndLoad = (FcBool(*)(FcConfig*, const FcChar8*, FcBool))
+ loadSymbol( "FcConfigParseAndLoad" );
m_pFcDefaultSubstitute = (void(*)(FcPattern *))
loadSymbol( "FcDefaultSubstitute" );
m_pFcFontSetMatch = (FcPattern*(*)(FcConfig*,FcFontSet**,int,FcPattern*,FcResult*))
@@ -383,6 +390,7 @@ FontCfgWrapper::FontCfgWrapper()
m_pFcPatternGetBool &&
m_pFcConfigAppFontAddFile &&
m_pFcConfigAppFontAddDir &&
+ m_pFcConfigParseAndLoad &&
m_pFcDefaultSubstitute &&
m_pFcConfigSubstitute &&
m_pFcPatternAddInteger &&
@@ -767,10 +775,14 @@ int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl
// set family name
if( pUpdate->m_nFamilyName != nFamilyName )
{
+#if 0 // fontconfig prefers nameid=16 for the family name which is all fine
+ // but Writer suffers from #i79878#
+ // the only reasonable workaround for now is to use the classic nameid=1
pUpdate->m_aAliases.remove( pUpdate->m_nFamilyName );
pUpdate->m_aAliases.push_back( pUpdate->m_nFamilyName );
pUpdate->m_aAliases.remove( nFamilyName );
pUpdate->m_nFamilyName = nFamilyName;
+#endif
}
if( eWeightRes == FcResultMatch )
pUpdate->m_eWeight = convertWeight(weight);
@@ -836,13 +848,25 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName )
if( nVersion <= 20400 )
return false;
const char* pDirName = (const char*)rDirName.getStr();
- bool bRet = (rWrapper.FcConfigAppFontAddDir( rWrapper.FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue);
+ bool bDirOk = (rWrapper.FcConfigAppFontAddDir( rWrapper.FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue);
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bRet );
#endif
- return bRet;
+ if( bDirOk )
+ {
+ const rtl::OString aConfFileName = rDirName + "/fc_local.conf";
+ bool bCfgOk = rWrapper.FcConfigParseAndLoad( rWrapper.FcConfigGetCurrent(),
+ (FcChar8*)aConfFileName.getStr(), FcTrue );
+ (void)bCfgOk; // silence compiler warning
+
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "FcConfigParseAndLoad( \"%s\") => %d\n", aConfFileName.getStr(), bCfgOk );
+#endif
+ }
+
+ return bDirOk;
}
static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern,
diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx
index 93e3eef53ab3..21183dc567ec 100644
--- a/vcl/unx/source/fontmanager/fontmanager.cxx
+++ b/vcl/unx/source/fontmanager/fontmanager.cxx
@@ -40,6 +40,7 @@
#include "vcl/fontcache.hxx"
#include "vcl/fontcache.hxx"
#include "vcl/fontsubset.hxx"
+#include "vcl/impfont.hxx"
#include "vcl/strhelper.hxx"
#include "vcl/ppdparser.hxx"
#include "vcl/svdata.hxx"
@@ -3795,6 +3796,35 @@ void PrintFontManager::getGlyphWidths( fontID nFont,
free( pMetrics );
rUnicodeEnc.clear();
}
+
+ // fill the unicode map
+ // TODO: isn't this map already available elsewhere in the fontmanager?
+ const sal_uInt8* pCmapData = NULL;
+ int nCmapSize = 0;
+ if( GetSfntTable( pTTFont, O_cmap, &pCmapData, &nCmapSize ) )
+ {
+ CmapResult aCmapResult;
+ if( ParseCMAP( pCmapData, nCmapSize, aCmapResult ) )
+ {
+ const ImplFontCharMap aCharMap( aCmapResult );
+ for( sal_uInt32 cOld = 0;;)
+ {
+ // get next unicode covered by font
+ const sal_uInt32 c = aCharMap.GetNextChar( cOld );
+ if( c == cOld )
+ break;
+ cOld = c;
+#if 1 // TODO: remove when sal_Unicode covers all of unicode
+ if( c > (sal_Unicode)~0 )
+ break;
+#endif
+ // get the matching glyph index
+ const sal_uInt32 nGlyphId = aCharMap.GetGlyphIndex( c );
+ // update the requested map
+ rUnicodeEnc[ (sal_Unicode)c ] = nGlyphId;
+ }
+ }
+ }
}
CloseTTFont( pTTFont );
}
diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx
index 7637d3b2bd02..15e391256344 100644
--- a/vcl/unx/source/gdi/salgdi.cxx
+++ b/vcl/unx/source/gdi/salgdi.cxx
@@ -50,8 +50,9 @@
#include "basegfx/polygon/b2dpolygonclipper.hxx"
#include "basegfx/polygon/b2dlinegeometry.hxx"
#include "basegfx/matrix/b2dhommatrix.hxx"
-#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include "basegfx/matrix/b2dhommatrixtools.hxx"
#include "basegfx/polygon/b2dpolypolygoncutter.hxx"
+#include "basegfx/polygon/b2dtrapezoid.hxx"
#include <vector>
#include <queue>
@@ -1087,115 +1088,6 @@ SystemGraphicsData X11SalGraphics::GetGraphicsData() const
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-// B2DPolygon support methods
-
-namespace { // anonymous namespace to prevent export
-// the methods and structures here are used by the
-// B2DPolyPolygon->RenderTrapezoid conversion algorithm
-
-// compare two line segments
-// assumption: both segments point downward
-// assumption: they must have at least some y-overlap
-// assumption: rA.p1.y <= rB.p1.y
-bool IsLeftOf( const XLineFixed& rA, const XLineFixed& rB )
-{
- bool bAbove = (rA.p1.y <= rB.p1.y);
- const XLineFixed& rU = bAbove ? rA : rB;
- const XLineFixed& rL = bAbove ? rB : rA;
-
- const XFixed aXDiff = rU.p2.x - rU.p1.x;
- const XFixed aYDiff = rU.p2.y - rU.p1.y;
-
- // compare upper point of lower segment with line through upper segment
- if( (rU.p1.y != rL.p1.y) || (rU.p1.x != rL.p1.x) )
- {
- const sal_Int64 n1 = (sal_Int64)aXDiff * (rL.p1.y - rU.p1.y);
- const sal_Int64 n2 = (sal_Int64)aYDiff * (rL.p1.x - rU.p1.x);
- if( n1 != n2 )
- return ((n1 < n2) == bAbove);
- }
-
- // compare lower point of lower segment with line through upper segment
- if( (rU.p2.y != rL.p2.y) || (rU.p2.x != rL.p2.x) )
- {
- const sal_Int64 n3 = (sal_Int64)aXDiff * (rL.p2.y - rU.p1.y);
- const sal_Int64 n4 = (sal_Int64)aYDiff * (rL.p2.x - rU.p1.x);
- if( n3 != n4 )
- return ((n3 < n4) == bAbove);
- }
-
- // both segments overlap
- return false;
-}
-
-struct HalfTrapezoid
-{
- // assumptions:
- // maLine.p1.y <= mnY < maLine.p2.y
- XLineFixed maLine;
- XFixed mnY;
-
- XFixed getXMin() const { return std::min( maLine.p1.x, maLine.p2.x); }
- XFixed getXMax() const { return std::max( maLine.p1.x, maLine.p2.x); }
-};
-
-class HalfTrapCompare
-{
-public:
- bool operator()( const HalfTrapezoid& rA, const HalfTrapezoid& rB ) const
- {
- bool bIsTopLeft = false;
- if( rA.mnY != rB.mnY ) // sort top-first if possible
- bIsTopLeft = (rA.mnY < rB.mnY);
- else // else sort left-first
- bIsTopLeft = IsLeftOf( rA.maLine, rB.maLine );
- // adjust to priority_queue sorting convention
- return !bIsTopLeft;
- }
-};
-
-typedef std::vector< HalfTrapezoid > HTVector;
-typedef std::priority_queue< HalfTrapezoid, HTVector, HalfTrapCompare > HTQueueBase;
-// we need a priority queue with a reserve() to prevent countless reallocations
-class HTQueue
-: public HTQueueBase
-{
-public:
- void reserve( size_t n ) { c.reserve( n ); }
- void swapvec( HTVector& v ) { c.swap( v ); }
-};
-
-typedef std::vector<XTrapezoid> TrapezoidVector;
-
-class TrapezoidXCompare
-{
- const TrapezoidVector& mrVector;
-public:
- TrapezoidXCompare( const TrapezoidVector& rVector )
- : mrVector( rVector ) {}
- bool operator()( int nA, int nB ) const
- { return IsLeftOf( mrVector[nA].left, mrVector[nB].left ); }
-};
-
-typedef std::multiset< int, TrapezoidXCompare > ActiveTrapSet;
-
-class TrapezoidYCompare
-{
- const TrapezoidVector& mrVector;
-public:
- TrapezoidYCompare( const TrapezoidVector& rVector )
- : mrVector( rVector ) {}
- bool operator()( int nA, int nB ) const
- { return (mrVector[nA].bottom < mrVector[nB].bottom); }
-};
-
-typedef std::multiset< int, TrapezoidYCompare > VerticalTrapSet;
-
-#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND
-void splitIntersectingSegments( HTVector&);
-#endif // DISABLE_SOLVECROSSOVER_WORKAROUND
-} // end of anonymous namespace
-
// draw a poly-polygon
bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPolyPoly, double fTransparency)
{
@@ -1219,329 +1111,66 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly
if( pRenderEnv )
return FALSE;
- // check xrender support for trapezoids
- XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
- if( !rRenderPeer.AreTrapezoidsSupported() )
- return FALSE;
- Picture aDstPic = GetXRenderPicture();
- // check xrender support for this drawable
- if( !aDstPic )
- return FALSE;
+ // snap to raster if requested
+ basegfx::B2DPolyPolygon aPolyPoly = rOrigPolyPoly;
+ const bool bSnapToRaster = !getAntiAliasB2DDraw();
+ if( bSnapToRaster )
+ aPolyPoly = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges( aPolyPoly );
// don't bother with polygons outside of visible area
const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), GetGraphicsHeight() );
- const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rOrigPolyPoly );
- const bool bNeedViewClip = aPolyRange.isInside( aViewRange );
- if( !aPolyRange.overlaps( aViewRange ) )
+ aPolyPoly = basegfx::tools::clipPolyPolygonOnRange( aPolyPoly, aViewRange, true, false );
+ if( !aPolyPoly.count() )
return true;
- // convert the polypolygon to trapezoids
-
- // prepare the polypolygon for the algorithm below:
- // - clip it against the view range
- // - make sure it contains no self-intersections
- // while we are at it guess the number of involved polygon points
- int nHTQueueReserve = 0;
- basegfx::B2DPolyPolygon aGoodPolyPoly;
- for( int nOrigPolyIdx = 0; nOrigPolyIdx < nOrigPolyCount; ++nOrigPolyIdx )
- {
- const ::basegfx::B2DPolygon aOuterPolygon = rOrigPolyPoly.getB2DPolygon( nOrigPolyIdx );
-
- // render-trapezoids should be inside the view => clip polygon against view range
- basegfx::B2DPolyPolygon aClippedPolygon( aOuterPolygon );
- if( bNeedViewClip )
- {
- aClippedPolygon = basegfx::tools::clipPolygonOnRange( aOuterPolygon, aViewRange, true, false );
- DBG_ASSERT( aClippedPolygon.count(), "polygon confirmed to overlap with view should not get here" );
- }
- const int nClippedPolyCount = aClippedPolygon.count();
- if( !nClippedPolyCount )
- continue;
-
-#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND
- for( int nClippedPolyIdx = 0; nClippedPolyIdx < nClippedPolyCount; ++nClippedPolyIdx )
- {
- const ::basegfx::B2DPolygon aSolvedPolygon = aClippedPolygon.getB2DPolygon( nClippedPolyIdx );
- const int nPointCount = aSolvedPolygon.count();
- aGoodPolyPoly.append( aSolvedPolygon );
- nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount;
- }
-#else // DISABLE_SOLVECROSSOVER_WORKAROUND
- // #i103259# polypoly.solveCrossover() fails to remove self-intersections
- // but polygon.solveCrossover() works. Use it to build the intersection-free polypolygon
- // TODO: if the self-intersection prevention is too expensive make the trap-algorithm tolerate intersections
- for( int nClippedPolyIdx = 0; nClippedPolyIdx < nClippedPolyCount; ++nClippedPolyIdx )
- {
- ::basegfx::B2DPolygon aUnsolvedPolygon = aClippedPolygon.getB2DPolygon( nClippedPolyIdx );
- basegfx::B2DPolyPolygon aSolvedPolyPoly( basegfx::tools::solveCrossovers( aUnsolvedPolygon) );
- const int nSolvedPolyCount = aSolvedPolyPoly.count();
- for( int nSolvedPolyIdx = 0; nSolvedPolyIdx < nSolvedPolyCount; ++nSolvedPolyIdx )
- {
- // build the intersection-free polypolygon one by one
- const ::basegfx::B2DPolygon aSolvedPolygon = aSolvedPolyPoly.getB2DPolygon( nSolvedPolyIdx );
- aGoodPolyPoly.append( aSolvedPolygon );
- // and while we are at it use the conviently available point count to guess the number of needed half-traps
- const int nPointCount = aSolvedPolygon.count();
- nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount;
- }
- }
-#endif // DISABLE_SOLVECROSSOVER_WORKAROUND
- }
- // #i100922# try to prevent priority-queue reallocations by reservering enough
- nHTQueueReserve = ((4*nHTQueueReserve) | 0x1FFF) + 1;
- HTVector aHTVector;
- aHTVector.reserve( nHTQueueReserve );
-
- // first convert the B2DPolyPolygon to HalfTrapezoids
- const int nGoodPolyCount = aGoodPolyPoly.count();
- for( int nGoodPolyIdx = 0; nGoodPolyIdx < nGoodPolyCount; ++nGoodPolyIdx )
- {
- ::basegfx::B2DPolygon aInnerPolygon = aGoodPolyPoly.getB2DPolygon( nGoodPolyIdx );
-
- // render-trapezoids have linear edges => get rid of bezier segments
- if( aInnerPolygon.areControlPointsUsed() )
- aInnerPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aInnerPolygon, 0.125 );
-
- const int nPointCount = aInnerPolygon.count();
- if( nPointCount >= 3 )
- {
- // convert polygon point pairs to HalfTrapezoids
- // connect the polygon point with the first one if needed
- XPointFixed aOldXPF = { 0, 0 };
- XPointFixed aNewXPF;
- for( int nPointIdx = 0; nPointIdx <= nPointCount; ++nPointIdx, aOldXPF = aNewXPF )
- {
- // auto-close the polygon if needed
- const int k = (nPointIdx < nPointCount) ? nPointIdx : 0;
- const ::basegfx::B2DPoint& aPoint = aInnerPolygon.getB2DPoint( k );
-
- // convert the B2DPoint into XRENDER units
- if(getAntiAliasB2DDraw())
- {
- aNewXPF.x = XDoubleToFixed( aPoint.getX() );
- aNewXPF.y = XDoubleToFixed( aPoint.getY() );
- }
- else
- {
- aNewXPF.x = XDoubleToFixed( basegfx::fround( aPoint.getX() ) );
- aNewXPF.y = XDoubleToFixed( basegfx::fround( aPoint.getY() ) );
- }
-
- // check if enough data is available for a new HalfTrapezoid
- if( nPointIdx == 0 )
- continue;
-
- // construct HalfTrapezoid as topdown segment
- HalfTrapezoid aHT;
- if( aNewXPF.y < aOldXPF.y )
- {
- aHT.maLine.p1 = aNewXPF;
- aHT.maLine.p2 = aOldXPF;
- }
- else
- {
- aHT.maLine.p2 = aNewXPF;
- aHT.maLine.p1 = aOldXPF;
- }
-
- aHT.mnY = aHT.maLine.p1.y;
+ // tesselate the polypolygon into trapezoids
+ basegfx::B2DTrapezoidVector aB2DTrapVector;
+ basegfx::tools::trapezoidSubdivide( aB2DTrapVector, aPolyPoly );
+ const int nTrapCount = aB2DTrapVector.size();
+ const bool bDrawn = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency );
+ return bDrawn;
+}
-#if 0 // ignore clipped HalfTrapezoids
- if( aHT.mnY < 0 )
- aHT.mnY = 0;
- else if( aHT.mnY > 10000 )
- continue;
-#endif
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- // queue up the HalfTrapezoid
- aHTVector.push_back( aHT );
- }
- }
- }
+bool X11SalGraphics::drawFilledTrapezoids( const ::basegfx::B2DTrapezoid* pB2DTraps, int nTrapCount, double fTransparency )
+{
+ if( nTrapCount <= 0 )
+ return true;
- if( aHTVector.empty() )
- return TRUE;
+ Picture aDstPic = GetXRenderPicture();
+ // check xrender support for this drawable
+ if( !aDstPic )
+ return false;
-#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND
- // find intersecting halftraps and split them up
- // TODO: remove when solveCrossOvers gets fast enough so its use can be enabled above
- // FAQ: why should segment intersection be handled before adaptiveSubdivide()?
- // Answer: because it is conceptually much faster
- // Example: consider two intersecting circles with a diameter of 1000 pixels
- // before subdivision: eight bezier segments
- // after subdivision: more than a thousand line segments
- // since even the best generic intersection finders have a complexity of O((n+k)*log(n+k))
- // it shows that testing while the segment count is still low is a much better approach.
- splitIntersectingSegments( aHTVector);
-#endif // DISABLE_SOLVECROSSOVER_WORKAROUND
-
- // build queue from vector of intersection-free segments
- // TODO: is replacing the priority-queue by a sorted vector worth it?
- std::make_heap( aHTVector.begin(), aHTVector.end(), HalfTrapCompare());
- HTQueue aHTQueue;
- aHTQueue.swapvec( aHTVector);
-
- // then convert the HalfTrapezoids into full Trapezoids
- TrapezoidVector aTrapVector;
- aTrapVector.reserve( aHTQueue.size() * 2 ); // just a guess
-
- TrapezoidXCompare aTrapXCompare( aTrapVector );
- ActiveTrapSet aActiveTraps( aTrapXCompare );
-
- TrapezoidYCompare aTrapYCompare( aTrapVector );
- VerticalTrapSet aVerticalTraps( aTrapYCompare );
-
- while( !aHTQueue.empty() )
+ // convert the B2DTrapezoids into XRender-Trapezoids
+ typedef std::vector<XTrapezoid> TrapezoidVector;
+ TrapezoidVector aTrapVector( nTrapCount );
+ const basegfx::B2DTrapezoid* pB2DTrap = pB2DTraps;
+ for( int i = 0; i < nTrapCount; ++pB2DTrap, ++i )
{
- XTrapezoid aTrapezoid;
-
- // convert a HalfTrapezoid pair
- // get the left side of the trapezoid
- const HalfTrapezoid& rLeft = aHTQueue.top();
- aTrapezoid.top = rLeft.mnY;
- aTrapezoid.left = rLeft.maLine;
- aHTQueue.pop();
-
- // ignore left segment that would result in an empty trapezoid
- if( aTrapezoid.left.p2.y <= aTrapezoid.top )
- continue;
-
- // get the right side of the trapezoid
- aTrapezoid.right.p2.y = aTrapezoid.bottom;
- while( !aHTQueue.empty() ) {
- const HalfTrapezoid& rRight = aHTQueue.top();
- aTrapezoid.right = rRight.maLine;
- aHTQueue.pop();
- // ignore right segment that would result in an empty trapezoid
- if( aTrapezoid.right.p2.y > aTrapezoid.top )
- break;
- }
-
- // the topmost endpoint determines the trapezoid bottom
- aTrapezoid.bottom = aTrapezoid.left.p2.y;
- if( aTrapezoid.bottom > aTrapezoid.right.p2.y )
- aTrapezoid.bottom = aTrapezoid.right.p2.y;
-
- // keep the full Trapezoid candidate
- aTrapVector.push_back( aTrapezoid );
-
- // unless it splits another trapezoid that is still active
- bool bSplit = false;
- ActiveTrapSet::iterator aActiveTrapsIt = aActiveTraps.begin();
- while(aActiveTrapsIt != aActiveTraps.end())
- {
- XTrapezoid& rLeftTrap = aTrapVector[ *aActiveTrapsIt ];
-
- // skip until first overlap candidate
- // TODO: use stl::*er_bound() instead
- if( IsLeftOf( aTrapezoid.left, rLeftTrap.left) )
- {
- ++aActiveTrapsIt;
- continue;
- }
-
- // in the ActiveTrapSet there are still trapezoids where
- // a vertical overlap with new trapezoids is no longer possible
- // they could have been removed in the verticaltraps loop below
- // but this would be expensive and is not needed as we can
- // simply ignore them until we stumble upon them here.
- if( rLeftTrap.bottom <= aTrapezoid.top )
- {
- ActiveTrapSet::iterator it = aActiveTrapsIt;
- if( aActiveTrapsIt != aActiveTraps.begin() )
- {
- --aActiveTrapsIt;
- aActiveTraps.erase( it );
- ++aActiveTrapsIt;
- }
- else
- {
- aActiveTraps.erase( it );
- aActiveTrapsIt = aActiveTraps.begin();
- }
- continue;
- }
-
- // check if there is horizontal overlap
- // aTrapezoid.left==rLeftTrap.right is allowed though
- if( !IsLeftOf( aTrapezoid.left, rLeftTrap.right ) )
- {
- ++aActiveTrapsIt;
- continue;
- }
-
- // prepare to split the old trapezoid and keep its upper part
- // find the old trapezoids entry in the VerticalTrapSet and remove it
- typedef std::pair<VerticalTrapSet::iterator, VerticalTrapSet::iterator> VTSPair;
- VTSPair aVTSPair = aVerticalTraps.equal_range( *aActiveTrapsIt );
- VerticalTrapSet::iterator aVTSit = aVTSPair.first;
- for(; aVTSit != aVTSPair.second; ++aVTSit )
- {
- if( *aVTSit != *aActiveTrapsIt )
- continue;
- aVerticalTraps.erase( aVTSit );
- break;
- }
- // then update the old trapezoid's bottom
- rLeftTrap.bottom = aTrapezoid.top;
- // enter the updated old trapzoid in VerticalTrapSet
- aVerticalTraps.insert( aVerticalTraps.begin(), *aActiveTrapsIt );
- // the old trapezoid is no longer active
- aActiveTraps.erase( aActiveTrapsIt );
-
- // the trapezoid causing the split has become obsolete
- // so its both sides have to be re-queued
- HalfTrapezoid aHT;
- aHT.mnY = aTrapezoid.top;
- aHT.maLine = aTrapezoid.left;
- aHTQueue.push( aHT );
- aHT.maLine = aTrapezoid.right;
- aHTQueue.push( aHT );
-
- bSplit = true;
- break;
- }
-
- // keep or forget the resulting full Trapezoid
- if( bSplit )
- aTrapVector.pop_back();
- else
- {
- aActiveTraps.insert( aTrapVector.size()-1 );
- aVerticalTraps.insert( aTrapVector.size()-1 );
- }
-
- // mark trapezoids that can no longer be split as inactive
- // and recycle their sides which were not fully resolved
- static const XFixed nMaxTop = +0x7FFFFFFF;
- const XFixed nNewTop = aHTQueue.empty() ? nMaxTop : aHTQueue.top().mnY;
- while( !aVerticalTraps.empty() )
- {
- // check the next trapezoid to be retired
- const XTrapezoid& rOldTrap = aTrapVector[ *aVerticalTraps.begin() ];
- if( nNewTop < rOldTrap.bottom )
- break;
- // this trapezoid can no longer be split
- aVerticalTraps.erase( aVerticalTraps.begin() );
-
- // recycle its sides that were not fully resolved
- HalfTrapezoid aHT;
- aHT.mnY = rOldTrap.bottom;
-
- if( rOldTrap.left.p2.y > aHT.mnY )
- {
- aHT.maLine = rOldTrap.left;
- aHTQueue.push( aHT );
- }
- if( rOldTrap.right.p2.y > aHT.mnY )
- {
- aHT.maLine = rOldTrap.right;
- aHTQueue.push( aHT );
- }
- }
+ XTrapezoid& rTrap = aTrapVector[ i ] ;
+
+ // set y-coordinates
+ const double fY1 = pB2DTrap->getTopY();
+ rTrap.left.p1.y = rTrap.right.p1.y = rTrap.top = XDoubleToFixed( fY1 );
+ const double fY2 = pB2DTrap->getBottomY();
+ rTrap.left.p2.y = rTrap.right.p2.y = rTrap.bottom = XDoubleToFixed( fY2 );
+
+ // set x-coordinates
+ const double fXL1 = pB2DTrap->getTopXLeft();
+ rTrap.left.p1.x = XDoubleToFixed( fXL1 );
+ const double fXR1 = pB2DTrap->getTopXRight();
+ rTrap.right.p1.x = XDoubleToFixed( fXR1 );
+ const double fXL2 = pB2DTrap->getBottomXLeft();
+ rTrap.left.p2.x = XDoubleToFixed( fXL2 );
+ const double fXR2 = pB2DTrap->getBottomXRight();
+ rTrap.right.p2.x = XDoubleToFixed( fXR2 );
}
- // create xrender Picture for polygon foreground
+ // get xrender Picture for polygon foreground
+ // TODO: cache it like the target picture which uses GetXRenderPicture()
+ XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
SalDisplay::RenderEntry& rEntry = GetDisplay()->GetRenderEntries( m_nScreen )[ 32 ];
if( !rEntry.m_aPicture )
{
@@ -1569,15 +1198,17 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly
rRenderPeer.CompositeTrapezoids( PictOpOver,
rEntry.m_aPicture, aDstPic, pMaskFormat, 0, 0, &aTrapVector[0], aTrapVector.size() );
- return TRUE;
+ return true;
}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin)
{
+ const bool bIsHairline = (rLineWidth.getX() == rLineWidth.getY()) && (rLineWidth.getX() <= 1.2);
+
// #i101491#
- if(rPolygon.count() > 1000)
+ if( !bIsHairline && (rPolygon.count() > 1000) )
{
// the used basegfx::tools::createAreaGeometry is simply too
// expensive with very big polygons; fallback to caller (who
@@ -1587,33 +1218,44 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const :
// the same way.
return false;
}
- const XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
- if( !rRenderPeer.AreTrapezoidsSupported() )
- return false;
- // get the area polygon for the line polygon
+ // temporarily adjust brush color to pen color
+ // since the line is drawn as an area-polygon
+ const SalColor aKeepBrushColor = nBrushColor_;
+ nBrushColor_ = nPenColor_;
+
+ // #i11575#desc5#b adjust B2D tesselation result to raster positions
basegfx::B2DPolygon aPolygon = rPolygon;
- if( (rLineWidth.getX() != rLineWidth.getY())
- && !basegfx::fTools::equalZero( rLineWidth.getY() ) )
+ const double fHalfWidth = 0.5 * rLineWidth.getX();
+ aPolygon.transform( basegfx::tools::createTranslateB2DHomMatrix(+fHalfWidth,+fHalfWidth) );
+
+ // shortcut for hairline drawing to improve performance
+ if( bIsHairline )
{
- // prepare for createAreaGeometry() with anisotropic linewidth
- aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getX() / rLineWidth.getY()));
+ // hairlines can benefit from a simplified tesselation
+ // e.g. for hairlines the linejoin style can be ignored
+ basegfx::B2DTrapezoidVector aB2DTrapVector;
+ basegfx::tools::createLineTrapezoidFromB2DPolygon( aB2DTrapVector, aPolygon, rLineWidth.getX() );
+
+ // draw tesselation result
+ const int nTrapCount = aB2DTrapVector.size();
+ const bool bDrawOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, 0.0 );
+
+ // restore the original brush GC
+ nBrushColor_ = aKeepBrushColor;
+ return bDrawOk;
}
- // special handling for hairlines to improve the drawing performance
- // TODO: revisit after basegfx performance related changes
- const bool bIsHairline = (rLineWidth.getX() < 1.2) && (rLineWidth.getY() < 1.2);
- if( bIsHairline )
+ // get the area polygon for the line polygon
+ if( (rLineWidth.getX() != rLineWidth.getY())
+ && !basegfx::fTools::equalZero( rLineWidth.getY() ) )
{
- // for hairlines the linejoin style becomes irrelevant
- eLineJoin = basegfx::B2DLINEJOIN_NONE;
- // createAreaGeometry is still too expensive when beziers are involved
- if( aPolygon.areControlPointsUsed() )
- aPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aPolygon, 0.125 );
+ // prepare for createAreaGeometry() with anisotropic linewidth
+ aPolygon.transform( basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getX() / rLineWidth.getY()));
}
// create the area-polygon for the line
- const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon, 0.5*rLineWidth.getX(), eLineJoin) );
+ const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon, fHalfWidth, eLineJoin) );
if( (rLineWidth.getX() != rLineWidth.getY())
&& !basegfx::fTools::equalZero( rLineWidth.getX() ) )
@@ -1622,11 +1264,6 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const :
aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getY() / rLineWidth.getX()));
}
- // temporarily adjust brush color to pen color
- // since the line is drawn as an area-polygon
- const SalColor aKeepBrushColor = nBrushColor_;
- nBrushColor_ = nPenColor_;
-
// draw each area polypolygon component individually
// to emulate the polypolygon winding rule "non-zero"
bool bDrawOk = true;
@@ -1634,7 +1271,7 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const :
for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
{
const ::basegfx::B2DPolyPolygon aOnePoly( aAreaPolyPoly.getB2DPolygon( nPolyIdx ) );
- bDrawOk = drawPolyPolygon( aOnePoly, 0.0);
+ bDrawOk = drawPolyPolygon( aOnePoly, 0.0 );
if( !bDrawOk )
break;
}
@@ -1646,259 +1283,3 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const :
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND
-// TODO: move the intersection solver into basegfx
-// and then support bezier-intersection finding too
-
-namespace { // anonymous namespace to prevent export
-
-typedef HalfTrapezoid LineSeg;
-typedef HTVector LSVector;
-
-inline bool operator==( const LineSeg& r1, const LineSeg& r2)
-{
- if( r1.maLine.p2.y != r2.maLine.p2.y) return false;
- if( r1.maLine.p2.x != r2.maLine.p2.x) return false;
- if( r1.maLine.p1.y != r2.maLine.p1.y) return false;
- if( r1.maLine.p1.x != r2.maLine.p1.x) return false;
- return true;
-}
-
-struct LSYMinCmp
-{
- bool operator()( const LineSeg& r1, const LineSeg& r2) const
- { return r2.maLine.p1.y < r1.maLine.p1.y; }
-};
-
-struct LSYMaxCmp
-{
- bool operator()( const LineSeg& r1, const LineSeg& r2) const
- { return r2.maLine.p2.y < r1.maLine.p2.y; }
-};
-
-struct LSXMinCmp
-{
- bool operator()( const LineSeg& r1, const LineSeg& r2) const
- { return( r1.getXMin() < r2.getXMin()); }
-};
-
-struct CutPoint
-{
- XFixed mnSegmentId;
- float mfCutParam;
- XPointFixed maPoint;
-};
-
-struct CutPointCmp
-{
- bool operator()( const CutPoint& r1, const CutPoint& r2) const
- {
- if( r1.mnSegmentId != r2.mnSegmentId)
- return (r1.mnSegmentId < r2.mnSegmentId);
- return (r1.mfCutParam < r2.mfCutParam);
- }
-};
-
-bool findIntersection( const LineSeg& rLS1, const LineSeg& rLS2, CutPoint aCutPoints[2])
-{
- // segments intersect at r1.p1 + s*(r1.p2-r1.p1) == r2.p1 + t*(r2.p2-r2.p1)
- // when both segment-parameters are ((0 <s<1) && (0<t<1))
- // (r1.p1 - r2.p1) == s * (r1.p1 - r1.p2) + t * (r2.p2 - r2.p1)
- // =>
- // (r1.p1x - r2.p1x) == s * (r1.p1x - r1.p2x) + t * (r2.p2x - r2.p1x)
- // (r1.p1y - r2.p1y) == s * (r1.p1y - r1.p2y) + t * (r2.p2y - r2.p1y)
- // check if lines are identical or parallel => not intersecting
- const XLineFixed& r1 = rLS1.maLine;
- const XLineFixed& r2 = rLS2.maLine;
- const double fDet = (double)(r1.p1.x - r1.p2.x) * (r2.p2.y - r2.p1.y)
- - (double)(r2.p2.x - r2.p1.x) * (r1.p1.y - r1.p2.y);
- static const double fEps = 1e-8;
- if( fabs(fDet) < fEps)
- return false;
- // check if intersecting with first segment
- const double fS1 = (double)(r2.p2.y - r2.p1.y) * (r1.p1.x - r2.p1.x);
- const double fS2 = (double)(r2.p2.x - r2.p1.x) * (r2.p1.y - r1.p1.y);
- const double fS = (fS1 + fS2) / fDet;
- if( (fS <= +fEps) || (fS >= 1-fEps))
- return false;
- // check if intersecting with second segment
- const double fT1 = (double)(r1.p2.y - r1.p1.y) * (r1.p1.x - r2.p1.x);
- const double fT2 = (double)(r1.p2.x - r1.p1.x) * (r2.p1.y - r1.p1.y);
- const double fT = (fT1 + fT2) / fDet;
- if( (fT <= +fEps) || (fT >= 1-fEps))
- return false;
- // force the intersection point to be exactly identical on both segments
- aCutPoints[0].maPoint.x = (XFixed)(r1.p1.x + fS * (r1.p2.x - r1.p1.x));
- aCutPoints[0].maPoint.y = (XFixed)(r1.p1.y + fS * (r1.p2.y - r1.p1.y));
- aCutPoints[1].maPoint.x = aCutPoints[0].maPoint.x;
- aCutPoints[1].maPoint.y = aCutPoints[0].maPoint.y;
- aCutPoints[0].mnSegmentId = rLS1.mnY;
- aCutPoints[0].mfCutParam = (float)fS;
- aCutPoints[1].mnSegmentId = rLS2.mnY;
- aCutPoints[1].mfCutParam = (float)fT;
- return true;
-}
-
-typedef std::priority_queue< LineSeg, LSVector, LSYMinCmp> LSYMinQueueBase;
-typedef std::priority_queue< LineSeg, LSVector, LSYMaxCmp> LSYMaxQueueBase;
-typedef std::multiset< LineSeg, LSXMinCmp> LSXMinSet;
-typedef std::set< CutPoint, CutPointCmp> CutPointSet;
-
-class LSYMinQueue : public LSYMinQueueBase
-{
-public:
- void reserve( size_t n) { c.reserve(n);}
- void swapvec( LSVector& v) { c.swap(v);}
-};
-
-class LSYMaxQueue : public LSYMaxQueueBase
-{
-public:
- void reserve( size_t n) { c.reserve(n);}
-};
-
-void addAndCutSegment( LSVector& rLSVector, const LineSeg& rLS, CutPointSet& rCutPointSet)
-{
- // short circuit when no segment was cut
- if( rCutPointSet.empty()) {
- rLSVector.push_back( rLS);
- return;
- }
-
- // find the first cut point for this segment
- LineSeg aCS = rLS;
- CutPoint aMinCutPoint;
- aMinCutPoint.mnSegmentId = rLS.mnY;
- aMinCutPoint.mfCutParam = 0.0;
- CutPointSet::iterator itFirst = rCutPointSet.lower_bound( aMinCutPoint);
- CutPointSet::iterator it = itFirst;
- // iterate through all cut points of this segment
- for(; it != rCutPointSet.end(); ++it) {
- const CutPoint rCutPoint = (*it);
- if( rCutPoint.mnSegmentId != rLS.mnY)
- break;
- // cut segment at the cutpoint
- aCS.maLine.p2 = rCutPoint.maPoint;
- rLSVector.push_back( aCS);
- // prepare for next segment cut
- aCS.maLine.p1 = aCS.maLine.p2;
- }
- // remove cutparams that will no longer be needed
- // TODO: is it worth it or should we just keep the cutparams?
- rCutPointSet.erase( itFirst, it);
-
- // add segment part remaining after last cut
- aCS.maLine.p2 = rLS.maLine.p2;
- rLSVector.push_back( aCS);
-}
-
-void splitIntersectingSegments( LSVector& rLSVector)
-{
- // get a unique id for each lineseg, temporarily abuse the mnY member
- LSVector::iterator aLSit = rLSVector.begin();
- for( int i = 0; aLSit != rLSVector.end(); ++aLSit) {
- LineSeg& rLS = *aLSit;
- rLS.mnY = i++;
- }
- // get an y-sorted queue from the input vector
- LSYMinQueue aYMinQueue;
- std::make_heap( rLSVector.begin(), rLSVector.end(), LSYMinCmp());
- aYMinQueue.swapvec( rLSVector);
-
- // prepare the result vector
- // try to avoid reallocations by guessing a reasonable result size
- rLSVector.reserve( aYMinQueue.size() * 3/2 );
-
- // find all intersections
- CutPointSet aCutPointSet;
- LSXMinSet aXMinSet;
- LSYMaxQueue aYMaxQueue;
- aYMaxQueue.reserve( aYMinQueue.size());
- // sweep-down and check all segment-pairs that overlap
- while( !aYMinQueue.empty()) {
- // get next input-segment
- const LineSeg& rLS = aYMinQueue.top();
- // retire obsoleted segments
- const XFixed fYCur = rLS.maLine.p1.y;
- while( !aYMaxQueue.empty()) {
- // check next segment to be retired
- const LineSeg& rOS = aYMaxQueue.top();
- if( fYCur < rOS.maLine.p2.y)
- break;
- // emit resolved segment into result
- addAndCutSegment( rLSVector, rOS, aCutPointSet);
- // find segment to be retired in xmin-compare-set
- LSXMinSet::iterator itR = aXMinSet.lower_bound( rOS);
- while( !(*itR == rOS)) ++itR;
- // retire segment from xmin-compare-set
- aXMinSet.erase( itR);
- // this segment is pining for the fjords
- aYMaxQueue.pop();
- }
-
- // iterate over all segments that might overlap
- // skip over the leftmost segments that cannot overlap
- const XFixed fXMax = rLS.getXMax();
- LSXMinSet::const_iterator itC = aXMinSet.begin();
- for(; itC != aXMinSet.end(); ++itC)
- if( (*itC).getXMin() <= fXMax)
- break;
- // TODO: if the linear search becomes too expensive
- // then use an XMaxQueue based approach to replace it
- const XFixed fXMin = rLS.getXMin();
- for(; itC != aXMinSet.end(); ++itC) {
- const LineSeg& rOS = *itC;
- if( fXMin >= rOS.getXMax())
- continue;
- if( fXMax < rOS.getXMin())
- break;
- CutPoint aCutPoints[2];
- if( !findIntersection( rLS, rOS, aCutPoints))
- continue;
- // remember cut parameters
- // TODO: std::set seems to use individual allocations
- // which results in perf-problems for many entries
- // => pre-allocate nodes by using a non-default allocator
- aCutPointSet.insert( aCutPoints[0]);
- aCutPointSet.insert( aCutPoints[1]);
- }
- // add segment to xmin-compare-set
- // TODO: do we have a good insertion hint?
- aXMinSet.insert( /*itC,*/ rLS);
- // register segment for retirement
- aYMaxQueue.push( rLS);
- aYMinQueue.pop();
- }
-
- // retire the remaining segments
- aXMinSet.clear();
- while( !aYMaxQueue.empty()) {
- // emit segments and cut them up if needed
- const LineSeg& rLS = aYMaxQueue.top();
- addAndCutSegment( rLSVector, rLS, aCutPointSet);
- aYMaxQueue.pop();
- }
-
- // get the segments ready to be consumed by the drawPolygon() caller
- aLSit = rLSVector.begin();
- LSVector::iterator aLSit2 = aLSit;
- for(; aLSit != rLSVector.end(); ++aLSit) {
- LineSeg& rLS = *aLSit;
- // restore the segment top member
- rLS.mnY = rLS.maLine.p1.y;
- // remove horizontal segments for now
- // TODO: until the trapezoid converter is adjusted to handle them
- if( rLS.maLine.p1.y == rLS.maLine.p2.y )
- continue;
- *(aLSit2++) = rLS;
- }
- if(aLSit2 != aLSit)
- rLSVector.resize( aLSit2 - rLSVector.begin() );
-}
-
-} // end anonymous namespace
-
-#endif // DISABLE_SOLVECROSSOVER_WORKAROUND
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index f00ee26c0d4d..6024b66f6010 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -2041,7 +2041,7 @@ static ImplFontSelectData GetFcSubstitute(const ImplFontSelectData &rFontSelData
{
ImplFontSelectData aRet(rFontSelData);
- const rtl::OString aLangAttrib; //TODO: = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage );
+ const rtl::OString aLangAttrib = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage );
psp::italic::type eItalic = psp::italic::Unknown;
if( rFontSelData.GetSlant() != ITALIC_DONTKNOW )
diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk
index d501765c8491..eb54531c375c 100644
--- a/vcl/util/makefile.mk
+++ b/vcl/util/makefile.mk
@@ -299,6 +299,7 @@ SHL2DEPN=$(SHL1IMPLIBN) $(SHL1TARGETN)
SHL2STDLIBS=\
$(VCLLIB)\
$(I18NPAPERLIB) \
+ $(I18NISOLANGLIB) \
$(TOOLSLIB) \
$(VOSLIB) \
$(BASEGFXLIB) \
diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h
index 6b58e0c5375a..4b97eeb98c0b 100644
--- a/vcl/win/inc/salgdi.h
+++ b/vcl/win/inc/salgdi.h
@@ -228,15 +228,15 @@ protected:
// native widget rendering methods that require mirroring
virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside );
+ const Point& aPos, BOOL& rIsInside );
virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ ControlState nState, const ImplControlValue& aValue,
const rtl::OUString& aCaption );
virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
- SalControlHandle& rControlHandle, const rtl::OUString& aCaption );
+ const rtl::OUString& aCaption );
virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption,
+ const ImplControlValue& aValue, const rtl::OUString& aCaption,
Region &rNativeBoundingRegion, Region &rNativeContentRegion );
virtual bool drawAlphaBitmap( const SalTwoRect&,
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index 1638c4e1bd36..d1b5a9cfdeae 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -1579,15 +1579,24 @@ HFONT WinSalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFont
&& (ImplSalWICompareAscii( aLogFont.lfFaceName, "Courier" ) == 0) )
lstrcpynW( aLogFont.lfFaceName, L"Courier New", 11 );
- // limit font requests to MAXFONTHEIGHT
+ // #i47675# limit font requests to MAXFONTHEIGHT
// TODO: share MAXFONTHEIGHT font instance
- if( -aLogFont.lfHeight <= MAXFONTHEIGHT )
+ if( (-aLogFont.lfHeight <= MAXFONTHEIGHT)
+ && (+aLogFont.lfWidth <= MAXFONTHEIGHT) )
+ {
o_rFontScale = 1.0;
- else
+ }
+ else if( -aLogFont.lfHeight >= +aLogFont.lfWidth )
{
o_rFontScale = -aLogFont.lfHeight / (float)MAXFONTHEIGHT;
aLogFont.lfHeight = -MAXFONTHEIGHT;
- aLogFont.lfWidth = static_cast<LONG>( aLogFont.lfWidth / o_rFontScale );
+ aLogFont.lfWidth = FRound( aLogFont.lfWidth / o_rFontScale );
+ }
+ else // #i95867# also limit font widths
+ {
+ o_rFontScale = +aLogFont.lfWidth / (float)MAXFONTHEIGHT;
+ aLogFont.lfWidth = +MAXFONTHEIGHT;
+ aLogFont.lfHeight = FRound( aLogFont.lfHeight / o_rFontScale );
}
hNewFont = ::CreateFontIndirectW( &aLogFont );
diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx
index d1f11433d532..be5d7f8360bc 100644
--- a/vcl/win/source/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx
@@ -319,7 +319,6 @@ BOOL WinSalGraphics::hitTestNativeControl( ControlType,
ControlPart,
const Region&,
const Point&,
- SalControlHandle&,
BOOL& )
{
return FALSE;
@@ -425,7 +424,6 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
ControlPart nPart,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle&,
OUString aCaption )
{
// a listbox dropdown is actually a combobox dropdown
@@ -961,7 +959,6 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the WinSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL WinSalGraphics::drawNativeControl( ControlType nType,
@@ -969,7 +966,6 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType,
const Region& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- SalControlHandle& rControlHandle,
const OUString& aCaption )
{
BOOL bOk = false;
@@ -1060,7 +1056,7 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType,
OUString aCaptionStr( aCaption.replace('~', '&') ); // translate mnemonics
bOk = ImplDrawNativeControl(mhDC, hTheme, rc,
nType, nPart, nState, aValue,
- rControlHandle, aCaptionStr );
+ aCaptionStr );
// restore alignment
SetTextAlign( mhDC, ta );
@@ -1080,7 +1076,6 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType,
*
* rControlRegion: The bounding region of the complete control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the WinSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL WinSalGraphics::drawNativeControlText( ControlType,
@@ -1088,7 +1083,6 @@ BOOL WinSalGraphics::drawNativeControlText( ControlType,
const Region&,
ControlState,
const ImplControlValue&,
- SalControlHandle&,
const OUString& )
{
return( false );
@@ -1106,15 +1100,13 @@ BOOL WinSalGraphics::drawNativeControlText( ControlType,
*
* rControlRegion: The bounding region of the control in VCL frame coordinates.
* aValue: An optional value (tristate/numerical/string)
- * rControlHandle: Carries platform dependent data and is maintained by the WinSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
BOOL WinSalGraphics::getNativeControlRegion( ControlType nType,
ControlPart nPart,
const Region& rControlRegion,
- ControlState,
- const ImplControlValue&,
- SalControlHandle&,
+ ControlState nState,
+ const ImplControlValue& rControlValue,
const OUString&,
Region &rNativeBoundingRegion,
Region &rNativeContentRegion )
@@ -1230,6 +1222,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType,
}
}
}
+
if( nType == CTRL_SLIDER && ( (nPart == PART_THUMB_HORZ) || (nPart == PART_THUMB_VERT) ) )
{
HTHEME hTheme = getThemeHandle( mhWnd, L"Trackbar");
@@ -1258,6 +1251,37 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType,
}
}
+ if ( ( nType == CTRL_TAB_ITEM ) && ( nPart == PART_ENTIRE_CONTROL ) )
+ {
+ Rectangle aControlRect( rControlRegion.GetBoundRect() );
+ rNativeContentRegion = aControlRect;
+
+ --aControlRect.Bottom();
+
+ TabitemValue *pValue = static_cast< TabitemValue* >( rControlValue.getOptionalVal() );
+ if ( pValue )
+ {
+ if ( pValue->isBothAligned() )
+ --aControlRect.Right();
+ }
+
+ if ( nState & CTRL_STATE_SELECTED )
+ {
+ aControlRect.Left() -= 2;
+ if ( pValue && !pValue->isBothAligned() )
+ {
+ if ( pValue->isLeftAligned() || pValue->isNotAligned() )
+ aControlRect.Right() += 2;
+ if ( pValue->isRightAligned() )
+ aControlRect.Right() += 1;
+ }
+ aControlRect.Top() -= 2;
+ aControlRect.Bottom() += 2;
+ }
+ rNativeBoundingRegion = aControlRect;
+ bRet = TRUE;
+ }
+
ReleaseDC( mhWnd, hDC );
return( bRet );
}
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index a6567464ac5e..7314fd2b6164 100755..100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2891,8 +2891,8 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
BOOL bCompBorder = (aStyleSettings.GetOptions() & (STYLE_OPTION_MACSTYLE | STYLE_OPTION_UNIXSTYLE)) == 0;
// TODO: once those options vanish: just set bCompBorder to TRUE
// to have the system colors read
- aStyleSettings.SetScrollBarSize( Min( GetSystemMetrics( SM_CXVSCROLL ), 20 ) ); // #99956# do not allow huge scrollbars, most of the UI is not scaled anymore
- aStyleSettings.SetSpinSize( Min( GetSystemMetrics( SM_CXVSCROLL ), 20 ) );
+ aStyleSettings.SetScrollBarSize( GetSystemMetrics( SM_CXVSCROLL ) );
+ aStyleSettings.SetSpinSize( GetSystemMetrics( SM_CXVSCROLL ) );
aStyleSettings.SetCursorBlinkTime( GetCaretBlinkTime() );
if ( bCompBorder )
{