diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-03-11 14:24:23 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-03-11 14:24:23 +0100 |
commit | 67d2af6fac2d9bad52a6b1f6e0cbd1229eb88a42 (patch) | |
tree | 898019746162b464578da9c8345158a74321c904 /vcl/source | |
parent | 86fb5fff88be611785b7908aac2a44475d77705f (diff) | |
parent | e2a3d487efb2bd5e582eb10e4150530c3f7377c5 (diff) |
Merge commit 'ooo/DEV300_m101' into intm101
The following builds for me:
basebmp, basegfx, comphelper, dtrans, i18npool, i18nutil, l10ntools, o3tl,
psprint_config, regexp, rsc, sax, sot, tools, ucbhelper, unotools, vcl
The rest still needs fixing ;-)
Conflicts:
canvas/prj/build.lst
canvas/source/cairo/cairo_textlayout.cxx
canvas/source/directx/dx_winstuff.hxx
canvas/source/tools/image.cxx
canvas/source/vcl/canvashelper.cxx
comphelper/inc/comphelper/documentconstants.hxx
comphelper/inc/comphelper/optionalvalue.hxx
comphelper/inc/comphelper/querydeep.hxx
comphelper/prj/build.lst
comphelper/qa/complex/makefile.mk
comphelper/qa/string/test_string_noadditional.cxx
comphelper/source/misc/componentmodule.cxx
comphelper/source/misc/mimeconfighelper.cxx
comphelper/source/misc/querydeep.cxx
comphelper/source/misc/uieventslogger.cxx
comphelper/source/property/TypeGeneration.cxx
comphelper/test/uno_iterators/uno_iterators.cxx
comphelper/util/makefile.mk
cppcanvas/source/mtfrenderer/implrenderer.cxx
dtrans/prj/build.lst
dtrans/source/generic/dtrans.cxx
dtrans/source/win32/dtobj/FmtFilter.cxx
i18npool/prj/build.lst
i18npool/source/localedata/data/localedata_others.map
i18npool/source/localedata/data/makefile.mk
i18npool/source/localedata/localedata.cxx
i18npool/source/localedata/saxparser.cxx
i18npool/source/registerservices/registerservices.cxx
i18npool/source/search/textsearch.cxx
l10ntools/inc/cfgmerge.hxx
l10ntools/inc/export.hxx
l10ntools/inc/gsicheck.hxx
l10ntools/inc/l10ntools/vosapp.hxx
l10ntools/inc/tagtest.hxx
l10ntools/inc/xmlparse.hxx
l10ntools/layout/layoutparse.cxx
l10ntools/layout/tralay.cxx
l10ntools/source/cfgmerge.cxx
l10ntools/source/export.cxx
l10ntools/source/export2.cxx
l10ntools/source/gsicheck.cxx
l10ntools/source/help/HelpLinker.cxx
l10ntools/source/lngex.cxx
l10ntools/source/lngmerge.cxx
l10ntools/source/merge.cxx
l10ntools/source/tagtest.cxx
l10ntools/source/xmlparse.cxx
padmin/source/fontentry.cxx
padmin/source/padialog.cxx
padmin/source/padialog.src
padmin/source/pamain.cxx
rsc/inc/rscarray.hxx
rsc/inc/rscclass.hxx
rsc/inc/rscclobj.hxx
rsc/inc/rsccont.hxx
rsc/inc/rscdb.hxx
rsc/inc/rscdef.hxx
rsc/inc/rscmgr.hxx
rsc/inc/rscrange.hxx
rsc/inc/rsctop.hxx
rsc/inc/vclrsc.hxx
rsc/source/parser/rscdb.cxx
rsc/source/parser/rscicpx.cxx
rsc/source/parser/rscinit.cxx
rsc/source/prj/start.cxx
rsc/source/res/rscarray.cxx
rsc/source/res/rscclass.cxx
rsc/source/res/rscclobj.cxx
rsc/source/res/rsccont.cxx
rsc/source/res/rscmgr.cxx
rsc/source/res/rscrange.cxx
rsc/source/res/rsctop.cxx
rsc/source/rsc/rsc.cxx
rsc/source/tools/rscdef.cxx
rsc/source/tools/rsctools.cxx
sax/source/expatwrap/sax_expat.cxx
sax/source/fastparser/facreg.cxx
sax/source/tools/fastserializer.cxx
sot/inc/sot/filelist.hxx
sot/inc/sot/object.hxx
sot/source/base/factory.cxx
sot/source/base/filelist.cxx
sot/source/sdstor/stg.cxx
sot/source/sdstor/stgcache.cxx
sot/source/sdstor/stgole.cxx
sot/source/sdstor/stgstrms.cxx
sot/source/sdstor/storage.cxx
sot/source/sdstor/ucbstorage.cxx
svl/inc/svl/cenumitm.hxx
svl/inc/svl/cintitem.hxx
svl/inc/svl/cntwall.hxx
svl/inc/svl/ctypeitm.hxx
svl/inc/svl/custritm.hxx
svl/inc/svl/dateitem.hxx
svl/inc/svl/filerec.hxx
svl/inc/svl/globalnameitem.hxx
svl/inc/svl/ilstitem.hxx
svl/inc/svl/imageitm.hxx
svl/inc/svl/intitem.hxx
svl/inc/svl/itempool.hxx
svl/inc/svl/itemset.hxx
svl/inc/svl/lckbitem.hxx
svl/inc/svl/poolitem.hxx
svl/inc/svl/ptitem.hxx
svl/inc/svl/rectitem.hxx
svl/inc/svl/sfontitm.hxx
svl/inc/svl/slstitm.hxx
svl/inc/svl/srchitem.hxx
svl/inc/svl/svarray.hxx
svl/inc/svl/svdde.hxx
svl/inc/svl/svstdarr.hxx
svl/inc/svl/szitem.hxx
svl/inc/svl/visitem.hxx
svl/inc/svl/zforlist.hxx
svl/inc/svl/zformat.hxx
svl/prj/build.lst
svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx
svl/qa/complex/ConfigItems/helper/makefile.mk
svl/qa/makefile.mk
svl/source/filepicker/pickerhelper.cxx
svl/source/filerec/filerec.cxx
svl/source/items/cenumitm.cxx
svl/source/items/cintitem.cxx
svl/source/items/cntwall.cxx
svl/source/items/ctypeitm.cxx
svl/source/items/custritm.cxx
svl/source/items/dateitem.cxx
svl/source/items/globalnameitem.cxx
svl/source/items/ilstitem.cxx
svl/source/items/imageitm.cxx
svl/source/items/intitem.cxx
svl/source/items/itempool.cxx
svl/source/items/itemprop.cxx
svl/source/items/itemset.cxx
svl/source/items/lckbitem.cxx
svl/source/items/poolio.cxx
svl/source/items/poolitem.cxx
svl/source/items/ptitem.cxx
svl/source/items/rectitem.cxx
svl/source/items/slstitm.cxx
svl/source/items/srchitem.cxx
svl/source/items/style.cxx
svl/source/items/szitem.cxx
svl/source/items/visitem.cxx
svl/source/items/whiter.cxx
svl/source/memtools/svarray.cxx
svl/source/misc/PasswordHelper.cxx
svl/source/misc/adrparse.cxx
svl/source/misc/lngmisc.cxx
svl/source/notify/brdcst.cxx
svl/source/notify/listener.cxx
svl/source/notify/listenerbase.cxx
svl/source/numbers/makefile.mk
svl/source/numbers/nbdll.cxx
svl/source/numbers/zforfind.cxx
svl/source/numbers/zforlist.cxx
svl/source/numbers/zformat.cxx
svl/source/numbers/zforscan.cxx
svl/source/passwordcontainer/passwordcontainer.cxx
svl/source/svdde/ddecli.cxx
svl/source/svdde/ddeimp.hxx
svl/source/svdde/ddemlos2.h
svl/source/svdde/ddesvr.cxx
svl/source/undo/undo.cxx
svl/source/uno/registerservices.cxx
svl/util/makefile.mk
svtools/bmpmaker/bmpsum.cxx
svtools/bmpmaker/g2g.cxx
svtools/bmpmaker/makefile.mk
svtools/inc/borderhelper.hxx
svtools/inc/svtools/accessiblefactory.hxx
svtools/inc/svtools/apearcfg.hxx
svtools/inc/svtools/brwbox.hxx
svtools/inc/svtools/ctrlbox.hxx
svtools/inc/svtools/ctrltool.hxx
svtools/inc/svtools/editbrowsebox.hxx
svtools/inc/svtools/ehdl.hxx
svtools/inc/svtools/embedhlp.hxx
svtools/inc/svtools/filter.hxx
svtools/inc/svtools/ivctrl.hxx
svtools/inc/svtools/parhtml.hxx
svtools/inc/svtools/printdlg.hxx
svtools/inc/svtools/rtftoken.h
svtools/inc/svtools/ruler.hxx
svtools/inc/svtools/svicnvw.hxx
svtools/inc/svtools/svlbitm.hxx
svtools/inc/svtools/svlbox.hxx
svtools/inc/svtools/svtreebx.hxx
svtools/inc/svtools/tabbar.hxx
svtools/inc/svtools/table/abstracttablecontrol.hxx
svtools/inc/svtools/taskbar.hxx
svtools/inc/svtools/textview.hxx
svtools/inc/svtools/valueset.hxx
svtools/source/brwbox/brwbox1.cxx
svtools/source/brwbox/brwbox2.cxx
svtools/source/brwbox/datwin.cxx
svtools/source/brwbox/datwin.hxx
svtools/source/brwbox/makefile.mk
svtools/source/config/apearcfg.cxx
svtools/source/config/htmlcfg.cxx
svtools/source/config/menuoptions.cxx
svtools/source/config/miscopt.cxx
svtools/source/contnr/cont_pch.cxx
svtools/source/contnr/ctrdll.cxx
svtools/source/contnr/fileview.cxx
svtools/source/contnr/imivctl1.cxx
svtools/source/contnr/ivctrl.cxx
svtools/source/contnr/makefile.mk
svtools/source/contnr/svcontnr.src
svtools/source/contnr/svicnvw.cxx
svtools/source/contnr/svimpbox.cxx
svtools/source/contnr/svimpicn.cxx
svtools/source/contnr/svlbitm.cxx
svtools/source/contnr/svtreebx.cxx
svtools/source/contnr/templwin.cxx
svtools/source/contnr/templwin.hxx
svtools/source/control/asynclink.cxx
svtools/source/control/ctrlbox.cxx
svtools/source/control/ctrldll.cxx
svtools/source/control/ctrltool.cxx
svtools/source/control/filectrl.cxx
svtools/source/control/filectrl.src
svtools/source/control/headbar.cxx
svtools/source/control/inettbc.cxx
svtools/source/control/makefile.mk
svtools/source/control/prgsbar.cxx
svtools/source/control/roadmap.cxx
svtools/source/control/ruler.cxx
svtools/source/control/scriptedtext.cxx
svtools/source/control/stdmenu.cxx
svtools/source/control/tabbar.cxx
svtools/source/control/taskbar.cxx
svtools/source/control/taskbox.cxx
svtools/source/control/taskmisc.cxx
svtools/source/control/taskstat.cxx
svtools/source/control/valueacc.cxx
svtools/source/control/valueset.cxx
svtools/source/dialogs/addresstemplate.cxx
svtools/source/dialogs/addresstemplate.src
svtools/source/dialogs/colrdlg.src
svtools/source/dialogs/filedlg2.cxx
svtools/source/dialogs/filedlg2.hxx
svtools/source/dialogs/makefile.mk
svtools/source/dialogs/printdlg.cxx
svtools/source/dialogs/printdlg.src
svtools/source/dialogs/propctrl.cxx
svtools/source/dialogs/propctrl.hxx
svtools/source/dialogs/property.cxx
svtools/source/edit/makefile.mk
svtools/source/edit/sychconv.cxx
svtools/source/edit/syntaxhighlight.cxx
svtools/source/edit/textdoc.cxx
svtools/source/edit/texteng.cxx
svtools/source/edit/textundo.cxx
svtools/source/edit/textview.cxx
svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx
svtools/source/filter.vcl/filter/dlgejpg.cxx
svtools/source/filter.vcl/filter/dlgejpg.hxx
svtools/source/filter.vcl/filter/dlgejpg.src
svtools/source/filter.vcl/filter/dlgepng.cxx
svtools/source/filter.vcl/filter/dlgepng.hxx
svtools/source/filter.vcl/filter/dlgepng.src
svtools/source/filter.vcl/filter/dlgexpor.cxx
svtools/source/filter.vcl/filter/dlgexpor.hxx
svtools/source/filter.vcl/filter/dlgexpor.src
svtools/source/filter.vcl/filter/filter2.cxx
svtools/source/filter.vcl/filter/makefile.mk
svtools/source/filter.vcl/filter/sgfbram.cxx
svtools/source/filter.vcl/filter/sgvmain.cxx
svtools/source/filter.vcl/filter/sgvspln.cxx
svtools/source/filter.vcl/filter/strings.src
svtools/source/filter.vcl/jpeg/makefile.mk
svtools/source/filter.vcl/wmf/emfwr.cxx
svtools/source/filter.vcl/wmf/emfwr.hxx
svtools/source/filter.vcl/wmf/enhwmf.cxx
svtools/source/filter.vcl/wmf/winmtf.hxx
svtools/source/filter.vcl/wmf/wmfwr.cxx
svtools/source/filter.vcl/wmf/wmfwr.hxx
svtools/source/graphic/grfcache.cxx
svtools/source/graphic/grfcache.hxx
svtools/source/graphic/grfmgr.cxx
svtools/source/graphic/makefile.mk
svtools/source/inc/accessibletableimp.hxx
svtools/source/inc/svimpbox.hxx
svtools/source/java/patchjavaerror.src
svtools/source/misc/ehdl.cxx
svtools/source/misc/errtxt.src
svtools/source/misc/helpagentwindow.cxx
svtools/source/misc/imagemgr.cxx
svtools/source/misc/imagemgr.src
svtools/source/misc/imageresourceaccess.cxx
svtools/source/misc/imap.cxx
svtools/source/misc/langtab.src
svtools/source/misc/makefile.mk
svtools/source/misc/svtdata.cxx
svtools/source/misc/templatefoldercache.cxx
svtools/source/misc/transfer2.cxx
svtools/source/misc/undo.src
svtools/source/plugapp/commtest.cxx
svtools/source/plugapp/commtest.src
svtools/source/plugapp/makefile.mk
svtools/source/plugapp/testtool.src
svtools/source/productregistration/productregistration.cxx
svtools/source/svhtml/htmlkywd.cxx
svtools/source/svhtml/parhtml.cxx
svtools/source/svrtf/rtfkey2.cxx
svtools/source/svrtf/rtfkeywd.cxx
svtools/source/table/defaultinputhandler.cxx
svtools/source/table/makefile.mk
svtools/source/table/tablecontrol.cxx
svtools/source/table/tablecontrol_impl.cxx
svtools/source/table/tablecontrol_impl.hxx
svtools/source/table/tabledatawindow.cxx
svtools/source/table/tablegeometry.cxx
svtools/source/table/tablegeometry.hxx
svtools/source/toolpanel/makefile.mk
svtools/source/toolpanel/toolpaneldrawer.cxx
svtools/source/uno/addrtempuno.cxx
svtools/source/uno/miscservices.cxx
svtools/source/uno/svtxgridcontrol.cxx
svtools/source/uno/svtxgridcontrol.hxx
svtools/source/uno/toolboxcontroller.cxx
svtools/source/uno/treecontrolpeer.cxx
svtools/source/uno/unocontroltablemodel.cxx
svtools/source/uno/unocontroltablemodel.hxx
svtools/source/uno/unoimap.cxx
svtools/source/urlobj/inetimg.cxx
svtools/util/makefile.mk
svtools/workben/browser.cxx
svtools/workben/cui/makefile.mk
svtools/workben/makefile.mk
svtools/workben/stest.cxx
svtools/workben/toolpanel/makefile.mk
svtools/workben/urange.cxx
toolkit/inc/toolkit/awt/vclxdevice.hxx
toolkit/inc/toolkit/awt/vclxgraphics.hxx
toolkit/inc/toolkit/awt/vclxwindows.hxx
toolkit/inc/toolkit/controls/dialogcontrol.hxx
toolkit/inc/toolkit/helper/property.hxx
toolkit/inc/toolkit/helper/servicenames.hxx
toolkit/inc/toolkit/helper/throbberimpl.hxx
toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java
toolkit/source/awt/asynccallback.cxx
toolkit/source/awt/vclxgraphics.cxx
toolkit/source/awt/vclxtoolkit.cxx
toolkit/source/awt/vclxwindow.cxx
toolkit/source/awt/xsimpleanimation.cxx
toolkit/source/awt/xthrobber.cxx
toolkit/source/controls/dialogcontrol.cxx
toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
toolkit/source/controls/grid/defaultgriddatamodel.cxx
toolkit/source/controls/grid/gridcontrol.cxx
toolkit/source/controls/grid/initguard.hxx
toolkit/source/controls/unocontrol.cxx
toolkit/source/controls/unocontrolcontainer.cxx
toolkit/source/controls/unocontrols.cxx
toolkit/source/helper/listenermultiplexer.cxx
toolkit/source/helper/property.cxx
toolkit/source/helper/registerservices.cxx
toolkit/source/helper/servicenames.cxx
toolkit/source/helper/throbberimpl.cxx
toolkit/source/helper/tkresmgr.cxx
tools/StaticLibrary_ooopathutils.mk
tools/bootstrp/addexes/makefile.mk
tools/bootstrp/addexes2/makefile.mk
tools/bootstrp/addexes2/mkfilt.cxx
tools/bootstrp/command.cxx
tools/bootstrp/cppdep.cxx
tools/bootstrp/iserver.cxx
tools/bootstrp/makefile.mk
tools/bootstrp/mkcreate.cxx
tools/bootstrp/prj.cxx
tools/bootstrp/rscdep.cxx
tools/bootstrp/sstring.cxx
tools/inc/bootstrp/command.hxx
tools/inc/bootstrp/mkcreate.hxx
tools/inc/bootstrp/prj.hxx
tools/inc/bootstrp/sstring.hxx
tools/inc/tools/agapi.hxx
tools/inc/tools/agitem.hxx
tools/inc/tools/chapi.hxx
tools/inc/tools/download.hxx
tools/inc/tools/eacopier.hxx
tools/inc/tools/fract.hxx
tools/inc/tools/fsys.hxx
tools/inc/tools/geninfo.hxx
tools/inc/tools/globname.hxx
tools/inc/tools/inetmime.hxx
tools/inc/tools/multisel.hxx
tools/inc/tools/poly.hxx
tools/inc/tools/postsys.h
tools/inc/tools/postwin.h
tools/inc/tools/presys.h
tools/inc/tools/prewin.h
tools/inc/tools/pstm.hxx
tools/inc/tools/ref.hxx
tools/inc/tools/simplerm.hxx
tools/inc/tools/solar.h
tools/inc/tools/table.hxx
tools/inc/tools/urlkeys.hxx
tools/inc/tools/urlobj.hxx
tools/prj/build.lst
tools/prj/d.lst
tools/qa/makefile.mk
tools/source/communi/geninfo.cxx
tools/source/debug/debug.cxx
tools/source/fsys/dirent.cxx
tools/source/fsys/tdir.cxx
tools/source/fsys/unx.cxx
tools/source/fsys/urlobj.cxx
tools/source/generic/color.cxx
tools/source/generic/config.cxx
tools/source/generic/fract.cxx
tools/source/inet/inetmime.cxx
tools/source/memtools/multisel.cxx
tools/source/memtools/table.cxx
tools/source/rc/resmgr.cxx
tools/source/ref/globname.cxx
tools/source/ref/pstm.cxx
tools/source/solar/solar.c
tools/source/stream/strmos2.cxx
tools/source/stream/strmunx.cxx
tools/source/stream/strmwnt.cxx
tools/source/string/makefile.mk
tools/source/testtoolloader/testtoolloader.cxx
tools/test/makefile.mk
tools/util/makefile.mk
tools/win/inc/dll.hxx
tools/win/inc/parser.hxx
tools/win/inc/shellex.h
tools/win/inc/shutil.h
tools/win/inc/toolsdll.hxx
tools/win/inc/winshell.hxx
tools/workben/makefile.mk
ucbhelper/source/client/proxydecider.cxx
ucbhelper/workben/ucbexplorer/ucbexplorer.hrc
unotools/inc/unotools/unotunnelhelper.hxx
unotools/source/config/fltrcfg.cxx
unotools/source/config/lingucfg.cxx
unotools/source/config/misccfg.cxx
unotools/source/config/pathoptions.cxx
unotools/source/config/searchopt.cxx
unotools/source/i18n/localedatawrapper.cxx
unotools/source/ucbhelper/localfilehelper.cxx
unotools/source/ucbhelper/ucbhelper.cxx
unotools/source/ucbhelper/xtempfile.cxx
vcl/aqua/inc/salbmp.h
vcl/aqua/inc/salgdi.h
vcl/aqua/inc/salinst.h
vcl/aqua/source/app/salinst.cxx
vcl/aqua/source/gdi/aquaprintaccessoryview.mm
vcl/aqua/source/gdi/salgdi.cxx
vcl/aqua/source/gdi/salprn.cxx
vcl/aqua/source/window/salframeview.mm
vcl/aqua/source/window/salobj.cxx
vcl/inc/vcl/bitmap.hxx
vcl/inc/vcl/brdwin.hxx
vcl/inc/vcl/button.hxx
vcl/inc/vcl/cmdevt.hxx
vcl/inc/vcl/cvtgrf.hxx
vcl/inc/vcl/dialog.hxx
vcl/inc/vcl/dockwin.hxx
vcl/inc/vcl/event.hxx
vcl/inc/vcl/fixed.hxx
vcl/inc/vcl/fldunit.hxx
vcl/inc/vcl/floatwin.hxx
vcl/inc/vcl/gdimtf.hxx
vcl/inc/vcl/glyphcache.hxx
vcl/inc/vcl/graphite_adaptors.hxx
vcl/inc/vcl/graphite_features.hxx
vcl/inc/vcl/graphite_layout.hxx
vcl/inc/vcl/ilstbox.hxx
vcl/inc/vcl/image.h
vcl/inc/vcl/imgctrl.hxx
vcl/inc/vcl/impbmpconv.hxx
vcl/inc/vcl/impprn.hxx
vcl/inc/vcl/jobset.h
vcl/inc/vcl/keycodes.hxx
vcl/inc/vcl/lstbox.hxx
vcl/inc/vcl/mapunit.hxx
vcl/inc/vcl/menu.hxx
vcl/inc/vcl/msgbox.hxx
vcl/inc/vcl/outdev.hxx
vcl/inc/vcl/prndlg.hxx
vcl/inc/vcl/salatype.hxx
vcl/inc/vcl/salbmp.hxx
vcl/inc/vcl/salgdi.hxx
vcl/inc/vcl/salinst.hxx
vcl/inc/vcl/seleng.hxx
vcl/inc/vcl/settings.hxx
vcl/inc/vcl/smartid.hxx
vcl/inc/vcl/status.hxx
vcl/inc/vcl/strhelper.hxx
vcl/inc/vcl/svapp.hxx
vcl/inc/vcl/svdata.hxx
vcl/inc/vcl/syschild.hxx
vcl/inc/vcl/sysdata.hxx
vcl/inc/vcl/taskpanelist.hxx
vcl/inc/vcl/toolbox.hxx
vcl/inc/vcl/vclevent.hxx
vcl/inc/vcl/windata.hxx
vcl/inc/vcl/window.hxx
vcl/inc/vcl/wintypes.hxx
vcl/os2/source/app/salinst.cxx
vcl/os2/source/gdi/salgdi.cxx
vcl/os2/source/window/salmenu.cxx
vcl/os2/source/window/salobj.cxx
vcl/prj/build.lst
vcl/source/app/dbggui.cxx
vcl/source/app/help.cxx
vcl/source/app/idlemgr.cxx
vcl/source/app/settings.cxx
vcl/source/app/svapp.cxx
vcl/source/app/svdata.cxx
vcl/source/app/svmain.cxx
vcl/source/app/svmainhook.cxx
vcl/source/app/unohelp.cxx
vcl/source/app/vclevent.cxx
vcl/source/control/button.cxx
vcl/source/control/combobox.cxx
vcl/source/control/edit.cxx
vcl/source/control/field.cxx
vcl/source/control/fixed.cxx
vcl/source/control/ilstbox.cxx
vcl/source/control/imgctrl.cxx
vcl/source/control/makefile.mk
vcl/source/control/tabctrl.cxx
vcl/source/gdi/bitmap.cxx
vcl/source/gdi/bitmap2.cxx
vcl/source/gdi/bitmap4.cxx
vcl/source/gdi/bmpconv.cxx
vcl/source/gdi/cvtsvm.cxx
vcl/source/gdi/font.cxx
vcl/source/gdi/gdimtf.cxx
vcl/source/gdi/image.cxx
vcl/source/gdi/impimage.cxx
vcl/source/gdi/jobset.cxx
vcl/source/gdi/makefile.mk
vcl/source/gdi/metaact.cxx
vcl/source/gdi/outdev.cxx
vcl/source/gdi/outdev3.cxx
vcl/source/gdi/outdev4.cxx
vcl/source/gdi/outdevnative.cxx
vcl/source/gdi/pdfwriter.cxx
vcl/source/gdi/pdfwriter_impl.cxx
vcl/source/gdi/print3.cxx
vcl/source/gdi/salmisc.cxx
vcl/source/glyphs/gcach_ftyp.cxx
vcl/source/glyphs/gcach_ftyp.hxx
vcl/source/glyphs/glyphcache.cxx
vcl/source/glyphs/graphite_cache.cxx
vcl/source/glyphs/graphite_layout.cxx
vcl/source/glyphs/graphite_textsrc.hxx
vcl/source/helper/canvasbitmap.cxx
vcl/source/helper/smartid.cxx
vcl/source/helper/xconnection.cxx
vcl/source/src/btntext.src
vcl/source/src/images.src
vcl/source/src/print.src
vcl/source/window/accel.cxx
vcl/source/window/accmgr.cxx
vcl/source/window/brdwin.cxx
vcl/source/window/btndlg.cxx
vcl/source/window/dlgctrl.cxx
vcl/source/window/javachild.cxx
vcl/source/window/menu.cxx
vcl/source/window/msgbox.cxx
vcl/source/window/printdlg.cxx
vcl/source/window/status.cxx
vcl/source/window/syschild.cxx
vcl/source/window/toolbox.cxx
vcl/source/window/toolbox2.cxx
vcl/source/window/window.cxx
vcl/source/window/window2.cxx
vcl/source/window/wrkwin.cxx
vcl/unx/gtk/app/gtkdata.cxx
vcl/unx/gtk/app/gtkinst.cxx
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
vcl/unx/gtk/window/gtkframe.cxx
vcl/unx/gtk/window/gtkobject.cxx
vcl/unx/headless/svpbmp.hxx
vcl/unx/headless/svpgdi.cxx
vcl/unx/headless/svpgdi.hxx
vcl/unx/headless/svpinst.cxx
vcl/unx/headless/svpinst.hxx
vcl/unx/headless/svpprn.cxx
vcl/unx/headless/svpprn.hxx
vcl/unx/headless/svppspgraphics.cxx
vcl/unx/headless/svppspgraphics.hxx
vcl/unx/headless/svptext.cxx
vcl/unx/inc/dtint.hxx
vcl/unx/inc/plugins/gtk/gtkdata.hxx
vcl/unx/inc/pspgraphics.h
vcl/unx/inc/salbmp.h
vcl/unx/inc/saldata.hxx
vcl/unx/inc/saldisp.hxx
vcl/unx/inc/salgdi.h
vcl/unx/inc/salinst.h
vcl/unx/inc/xfont.hxx
vcl/unx/kde/kdedata.cxx
vcl/unx/kde4/KDESalGraphics.cxx
vcl/unx/source/app/keysymnames.cxx
vcl/unx/source/app/saldata.cxx
vcl/unx/source/app/saldisp.cxx
vcl/unx/source/app/salinst.cxx
vcl/unx/source/app/wmadaptor.cxx
vcl/unx/source/dtrans/X11_selection.cxx
vcl/unx/source/dtrans/X11_service.cxx
vcl/unx/source/gdi/makefile.mk
vcl/unx/source/gdi/pspgraphics.cxx
vcl/unx/source/gdi/salgdi.cxx
vcl/unx/source/gdi/salgdi3.cxx
vcl/unx/source/gdi/salprnpsp.cxx
vcl/unx/source/gdi/xfont.cxx
vcl/unx/source/gdi/xlfd_attr.cxx
vcl/unx/source/gdi/xlfd_attr.hxx
vcl/unx/source/gdi/xlfd_extd.cxx
vcl/unx/source/gdi/xlfd_extd.hxx
vcl/unx/source/gdi/xlfd_smpl.cxx
vcl/unx/source/gdi/xlfd_smpl.hxx
vcl/unx/source/printer/ppdparser.cxx
vcl/unx/source/printer/printerinfomanager.cxx
vcl/unx/source/window/salframe.cxx
vcl/unx/source/window/salmenu.cxx
vcl/unx/source/window/salobj.cxx
vcl/util/makefile2.pmk
vcl/win/inc/salbmp.h
vcl/win/inc/saldata.hxx
vcl/win/inc/salgdi.h
vcl/win/inc/salinst.h
vcl/win/source/app/saldata.cxx
vcl/win/source/app/salinst.cxx
vcl/win/source/gdi/salgdi.cxx
vcl/win/source/gdi/salgdi3.cxx
vcl/win/source/gdi/salprn.cxx
vcl/win/source/gdi/winlayout.cxx
vcl/win/source/window/salframe.cxx
vcl/win/source/window/salobj.cxx
vcl/workben/outdevgrind.cxx
vos/inc/vos/execabl.hxx
vos/inc/vos/macros.hxx
vos/inc/vos/pipe.hxx
vos/inc/vos/process.hxx
vos/inc/vos/refernce.hxx
vos/inc/vos/signal.hxx
vos/inc/vos/socket.hxx
vos/inc/vos/stream.hxx
vos/inc/vos/thread.hxx
vos/source/pipe.cxx
vos/source/process.cxx
vos/source/signal.cxx
vos/source/thread.cxx
vos/source/timer.cxx
Diffstat (limited to 'vcl/source')
174 files changed, 15674 insertions, 13045 deletions
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index cee78645b9f2..727911db36bd 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -38,32 +38,33 @@ #include <cmath> #include <limits.h> -#include <vcl/svdata.hxx> -#include <svsys.h> +#include "vcl/svdata.hxx" +#include "svsys.h" #ifdef WNT #undef min #endif -#include <tools/debug.hxx> -#include <vcl/svdata.hxx> -#include <vcl/svapp.hxx> -#include <vcl/event.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/button.hxx> -#include <vcl/edit.hxx> -#include <vcl/fixed.hxx> -#include <vcl/group.hxx> -#include <vcl/field.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/sound.hxx> -#include <vcl/threadex.hxx> -#include <vcl/dbggui.hxx> -#include <com/sun/star/i18n/XCharacterClassification.hpp> - -#include <vcl/unohelp.hxx> -#include <vcl/unohelp2.hxx> +#include "tools/debug.hxx" +#include "vcl/svdata.hxx" +#include "vcl/svapp.hxx" +#include "vcl/event.hxx" +#include "vcl/lstbox.hxx" +#include "vcl/button.hxx" +#include "vcl/edit.hxx" +#include "vcl/fixed.hxx" +#include "vcl/group.hxx" +#include "vcl/field.hxx" +#include "vcl/msgbox.hxx" +#include "vcl/wrkwin.hxx" +#include "vcl/sound.hxx" +#include "vcl/threadex.hxx" +#include "vcl/dbggui.hxx" +#include "com/sun/star/i18n/XCharacterClassification.hpp" + +#include "vcl/unohelp.hxx" +#include "vcl/unohelp2.hxx" #include <osl/mutex.hxx> +#include "vcl/salinst.hxx" #include <map> #include <algorithm> @@ -411,7 +412,7 @@ static const sal_Char* pDbgHelpText[] = " //...\n", "}\n", "\n", -"char& String::operator [] ( USHORT nIndex )\n", +"char& String::operator [] ( sal_uInt16 nIndex )\n", "{\n", " DBG_CHKTHIS( String, DbgCheckString );\n", " DBG_ASSERT( nIndex <= pData->nLen, \"String::[] : nIndex > Len\" );\n", @@ -419,7 +420,7 @@ static const sal_Char* pDbgHelpText[] = " //...\n", "}\n", "\n", -"USHORT String::Search( const String& rStr, USHORT nIndex ) const\n", +"sal_uInt16 String::Search( const String& rStr, sal_uInt16 nIndex ) const\n", "{\n", " DBG_CHKTHIS( String, DbgCheckString );\n", " DBG_CHKOBJ( &rStr, String, DbgCheckString );\n", @@ -451,19 +452,19 @@ namespace ++channel ) { - USHORT nEntryPos = rList.InsertEntry( channel->first ); + sal_uInt16 nEntryPos = rList.InsertEntry( channel->first ); rList.SetEntryData( nEntryPos, reinterpret_cast< void* >( channel->second ) ); } } // ------------------------------------------------------------------- - void ImplSelectChannel( ListBox& rList, ULONG nChannelToSelect, USHORT nPositionOffset ) + void ImplSelectChannel( ListBox& rList, sal_uLong nChannelToSelect, sal_uInt16 nPositionOffset ) { if ( nChannelToSelect < DBG_OUT_USER_CHANNEL_0 ) - rList.SelectEntryPos( (USHORT)( nChannelToSelect - nPositionOffset ) ); + rList.SelectEntryPos( (sal_uInt16)( nChannelToSelect - nPositionOffset ) ); else { - for ( USHORT pos = 0; pos < rList.GetEntryCount(); ++pos ) + for ( sal_uInt16 pos = 0; pos < rList.GetEntryCount(); ++pos ) { DbgChannelId nChannelId = static_cast< DbgChannelId >( reinterpret_cast<sal_IntPtr>(rList.GetEntryData( pos )) ); if ( nChannelId == nChannelToSelect ) @@ -475,9 +476,9 @@ namespace } } // ------------------------------------------------------------------- - DbgChannelId ImplGetChannelId( const ListBox& rList, USHORT nPositionOffset ) + DbgChannelId ImplGetChannelId( const ListBox& rList, sal_uInt16 nPositionOffset ) { - USHORT nSelectedChannelPos = rList.GetSelectEntryPos(); + sal_uInt16 nSelectedChannelPos = rList.GetSelectEntryPos(); DbgChannelId nSelectedChannel = static_cast< DbgChannelId >( reinterpret_cast<sal_IntPtr>(rList.GetEntryData( nSelectedChannelPos )) ); if ( nSelectedChannel == 0) return (DbgChannelId)( nSelectedChannelPos + nPositionOffset ); @@ -501,14 +502,14 @@ private: public: DbgWindow(); - virtual BOOL Close(); + virtual sal_Bool Close(); virtual void Resize(); virtual long PreNotify( NotifyEvent& rNEvt ); void InsertLine( const XubString& rLine ); void Update() { WorkWindow::Update(); maLstBox.Update(); } private: - void GetAssertionEntryRange( USHORT nInbetweenEntry, USHORT& nFirst, USHORT& nLast ); + void GetAssertionEntryRange( sal_uInt16 nInbetweenEntry, sal_uInt16& nFirst, sal_uInt16& nLast ); }; // ----------------- @@ -520,10 +521,10 @@ class DbgInfoDialog : public ModalDialog private: ListBox maListBox; OKButton maOKButton; - BOOL mbHelpText; + sal_Bool mbHelpText; public: - DbgInfoDialog( Window* pParent, BOOL bHelpText = FALSE ); + DbgInfoDialog( Window* pParent, sal_Bool bHelpText = sal_False ); void SetInfoText( const XubString& rStr ); }; @@ -582,7 +583,7 @@ private: CancelButton maCancelButton; PushButton maInfoButton; HelpButton maHelpButton; - USHORT mnErrorOff; + sal_uInt16 mnErrorOff; public: DbgDialog(); @@ -621,7 +622,7 @@ DbgWindow::DbgWindow() : // ----------------------------------------------------------------------- -BOOL DbgWindow::Close() +sal_Bool DbgWindow::Close() { // remember window position ByteString aState( GetWindowState() ); @@ -636,7 +637,7 @@ BOOL DbgWindow::Close() delete this; ImplGetSVData()->maWinData.mpDbgWin = NULL; - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -648,7 +649,7 @@ void DbgWindow::Resize() // ----------------------------------------------------------------------- -void DbgWindow::GetAssertionEntryRange( USHORT nInbetweenEntry, USHORT& nFirst, USHORT& nLast ) +void DbgWindow::GetAssertionEntryRange( sal_uInt16 nInbetweenEntry, sal_uInt16& nFirst, sal_uInt16& nLast ) { nFirst = nInbetweenEntry; while ( nFirst > 0 ) @@ -657,7 +658,7 @@ void DbgWindow::GetAssertionEntryRange( USHORT nInbetweenEntry, USHORT& nFirst, break; --nFirst; } - USHORT nEntryCount = maLstBox.GetEntryCount(); + sal_uInt16 nEntryCount = maLstBox.GetEntryCount(); nLast = nInbetweenEntry + 1; while ( nLast < nEntryCount ) { @@ -689,12 +690,12 @@ long DbgWindow::PreNotify( NotifyEvent& rNEvt ) Rectangle aEntryRect( maLstBox.GetBoundingRectangle( maLstBox.GetSelectEntryPos() ) ); aPos = aEntryRect.Center(); } - USHORT nSelected = aMenu.Execute( rNEvt.GetWindow(), aPos ); + sal_uInt16 nSelected = aMenu.Execute( rNEvt.GetWindow(), aPos ); if ( nSelected == 1 ) { // search all entries which belong to this assertion - USHORT nAssertionFirst = 0; - USHORT nAssertionLast = 0; + sal_uInt16 nAssertionFirst = 0; + sal_uInt16 nAssertionLast = 0; GetAssertionEntryRange( maLstBox.GetSelectEntryPos(), nAssertionFirst, nAssertionLast ); // build the string to copy to the clipboard @@ -723,23 +724,23 @@ void DbgWindow::InsertLine( const XubString& rLine ) XubString aStr = rLine; aStr.ConvertLineEnd( LINEEND_LF ); xub_StrLen nPos = aStr.Search( _LF ); - BOOL bFirstEntry = TRUE; + sal_Bool bFirstEntry = sal_True; while ( nPos != STRING_NOTFOUND ) { if ( maLstBox.GetEntryCount() >= DBGWIN_MAXLINES ) maLstBox.RemoveEntry( 0 ); - USHORT nInsertionPos = maLstBox.InsertEntry( aStr.Copy( 0, nPos ) ); + sal_uInt16 nInsertionPos = maLstBox.InsertEntry( aStr.Copy( 0, nPos ) ); if ( bFirstEntry ) maLstBox.SetEntryData( nInsertionPos, reinterpret_cast< void* >( 0x00000001 ) ); - bFirstEntry = FALSE; + bFirstEntry = sal_False; aStr.Erase( 0, nPos+1 ); nPos = aStr.Search( _LF ); } if ( maLstBox.GetEntryCount() >= DBGWIN_MAXLINES ) maLstBox.RemoveEntry( 0 ); - USHORT nInsertionPos = maLstBox.InsertEntry( aStr ); + sal_uInt16 nInsertionPos = maLstBox.InsertEntry( aStr ); if ( bFirstEntry ) maLstBox.SetEntryData( nInsertionPos, reinterpret_cast< void* >( 0x00000001 ) ); maLstBox.SetTopEntry( DBGWIN_MAXLINES-1 ); @@ -802,7 +803,7 @@ DbgDialog::DbgDialog() : maXtorThis.Show(); maXtorThis.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "T~his" ) ) ); if ( pData->nTestFlags & DBG_TEST_XTOR_THIS ) - maXtorThis.Check( TRUE ); + maXtorThis.Check( sal_True ); maXtorThis.SetPosSizePixel( LogicToPixel( Point( 10, 15 ), aAppMap ), aButtonSize ); } @@ -811,7 +812,7 @@ DbgDialog::DbgDialog() : maXtorFunc.Show(); maXtorFunc.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Function" ) ) ); if ( pData->nTestFlags & DBG_TEST_XTOR_FUNC ) - maXtorFunc.Check( TRUE ); + maXtorFunc.Check( sal_True ); maXtorFunc.SetPosSizePixel( LogicToPixel( Point( 75, 15 ), aAppMap ), aButtonSize ); } @@ -820,7 +821,7 @@ DbgDialog::DbgDialog() : maXtorExit.Show(); maXtorExit.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "E~xit" ) ) ); if ( pData->nTestFlags & DBG_TEST_XTOR_EXIT ) - maXtorExit.Check( TRUE ); + maXtorExit.Check( sal_True ); maXtorExit.SetPosSizePixel( LogicToPixel( Point( 140, 15 ), aAppMap ), aButtonSize ); } @@ -829,7 +830,7 @@ DbgDialog::DbgDialog() : maXtorReport.Show(); maXtorReport.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Report" ) ) ); if ( pData->nTestFlags & DBG_TEST_XTOR_REPORT ) - maXtorReport.Check( TRUE ); + maXtorReport.Check( sal_True ); maXtorReport.SetPosSizePixel( LogicToPixel( Point( 205, 15 ), aAppMap ), aButtonSize ); } @@ -838,7 +839,7 @@ DbgDialog::DbgDialog() : maXtorTrace.Show(); maXtorTrace.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Trace" ) ) ); if ( pData->nTestFlags & DBG_TEST_XTOR_TRACE ) - maXtorTrace.Check( TRUE ); + maXtorTrace.Check( sal_True ); maXtorTrace.SetPosSizePixel( LogicToPixel( Point( 270, 15 ), aAppMap ), aButtonSize ); } @@ -854,7 +855,7 @@ DbgDialog::DbgDialog() : maMemInit.Show(); maMemInit.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Initialize" ) ) ); if ( pData->nTestFlags & DBG_TEST_MEM_INIT ) - maMemInit.Check( TRUE ); + maMemInit.Check( sal_True ); maMemInit.SetPosSizePixel( LogicToPixel( Point( 10, 50 ), aAppMap ), aButtonSize ); } @@ -863,7 +864,7 @@ DbgDialog::DbgDialog() : maMemOverwrite.Show(); maMemOverwrite.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Overwrite" )) ); if ( pData->nTestFlags & DBG_TEST_MEM_OVERWRITE ) - maMemOverwrite.Check( TRUE ); + maMemOverwrite.Check( sal_True ); maMemOverwrite.SetPosSizePixel( LogicToPixel( Point( 75, 50 ), aAppMap ), aButtonSize ); } @@ -872,7 +873,7 @@ DbgDialog::DbgDialog() : maMemOverwriteFree.Show(); maMemOverwriteFree.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Free" ) ) ); if ( pData->nTestFlags & DBG_TEST_MEM_OVERWRITEFREE ) - maMemOverwriteFree.Check( TRUE ); + maMemOverwriteFree.Check( sal_True ); maMemOverwriteFree.SetPosSizePixel( LogicToPixel( Point( 140, 50 ), aAppMap ), aButtonSize ); } @@ -881,7 +882,7 @@ DbgDialog::DbgDialog() : maMemPtr.Show(); maMemPtr.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Pointer" ) ) ); if ( pData->nTestFlags & DBG_TEST_MEM_POINTER ) - maMemPtr.Check( TRUE ); + maMemPtr.Check( sal_True ); maMemPtr.SetPosSizePixel( LogicToPixel( Point( 205, 50 ), aAppMap ), aButtonSize ); } @@ -890,7 +891,7 @@ DbgDialog::DbgDialog() : maMemReport.Show(); maMemReport.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Report" ) ) ); if ( pData->nTestFlags & DBG_TEST_MEM_REPORT ) - maMemReport.Check( TRUE ); + maMemReport.Check( sal_True ); maMemReport.SetPosSizePixel( LogicToPixel( Point( 270, 50 ), aAppMap ), aButtonSize ); } @@ -899,7 +900,7 @@ DbgDialog::DbgDialog() : maMemTrace.Show(); maMemTrace.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Trace" ) ) ); if ( pData->nTestFlags & DBG_TEST_MEM_TRACE ) - maMemTrace.Check( TRUE ); + maMemTrace.Check( sal_True ); maMemTrace.SetPosSizePixel( LogicToPixel( Point( 10, 65 ), aAppMap ), aButtonSize ); } @@ -908,7 +909,7 @@ DbgDialog::DbgDialog() : maMemLeakReport.Show(); maMemLeakReport.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Leak-Report" ) ) ); if ( pData->nTestFlags & DBG_TEST_MEM_LEAKREPORT ) - maMemLeakReport.Check( TRUE ); + maMemLeakReport.Check( sal_True ); maMemLeakReport.SetPosSizePixel( LogicToPixel( Point( 75, 65 ), aAppMap ), aButtonSize ); } @@ -917,7 +918,7 @@ DbgDialog::DbgDialog() : maMemNewDel.Show(); maMemNewDel.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~New/Delete" ) ) ); if ( pData->nTestFlags & DBG_TEST_MEM_NEWDEL ) - maMemNewDel.Check( TRUE ); + maMemNewDel.Check( sal_True ); maMemNewDel.SetPosSizePixel( LogicToPixel( Point( 140, 65 ), aAppMap ), aButtonSize ); } @@ -926,7 +927,7 @@ DbgDialog::DbgDialog() : maMemXtor.Show(); maMemXtor.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Ob~ject Test" ) ) ); if ( pData->nTestFlags & DBG_TEST_MEM_XTOR ) - maMemXtor.Check( TRUE ); + maMemXtor.Check( sal_True ); maMemXtor.SetPosSizePixel( LogicToPixel( Point( 205, 65 ), aAppMap ), aButtonSize ); } @@ -942,7 +943,7 @@ DbgDialog::DbgDialog() : maProf.Show(); maProf.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Profiling" ) ) ); if ( pData->nTestFlags & DBG_TEST_PROFILING ) - maProf.Check( TRUE ); + maProf.Check( sal_True ); maProf.SetPosSizePixel( LogicToPixel( Point( 10, 95 ), aAppMap ), aButtonSize ); } @@ -951,7 +952,7 @@ DbgDialog::DbgDialog() : maRes.Show(); maRes.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Resourcen" ) ) ); if ( pData->nTestFlags & DBG_TEST_RESOURCE ) - maRes.Check( TRUE ); + maRes.Check( sal_True ); maRes.SetPosSizePixel( LogicToPixel( Point( 75, 95 ), aAppMap ), aButtonSize ); } @@ -960,7 +961,7 @@ DbgDialog::DbgDialog() : maDialog.Show(); maDialog.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Dialog" ) ) ); if ( pData->nTestFlags & DBG_TEST_DIALOG ) - maDialog.Check( TRUE ); + maDialog.Check( sal_True ); maDialog.SetPosSizePixel( LogicToPixel( Point( 140, 95 ), aAppMap ), aButtonSize ); } @@ -969,7 +970,7 @@ DbgDialog::DbgDialog() : maBoldAppFont.Show(); maBoldAppFont.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Bold AppFont" ) ) ); if ( pData->nTestFlags & DBG_TEST_BOLDAPPFONT ) - maBoldAppFont.Check( TRUE ); + maBoldAppFont.Check( sal_True ); maBoldAppFont.SetPosSizePixel( LogicToPixel( Point( 205, 95 ), aAppMap ), aButtonSize ); maBoldAppFont.SaveValue(); @@ -994,7 +995,7 @@ DbgDialog::DbgDialog() : maOverwrite.Show(); maOverwrite.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Overwrite ~File" ) ) ); if ( pData->bOverwrite ) - maOverwrite.Check( TRUE ); + maOverwrite.Check( sal_True ); maOverwrite.SetPosSizePixel( LogicToPixel( Point( 205, 130 ), aAppMap ), aButtonSize ); } @@ -1003,7 +1004,7 @@ DbgDialog::DbgDialog() : maHookOSLBox.Show(); maHookOSLBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Reroute osl debug ~messages" ) ) ); if ( pData->bHookOSLAssert ) - maHookOSLBox.Check( TRUE ); + maHookOSLBox.Check( sal_True ); maHookOSLBox.SetPosSizePixel( LogicToPixel( Point( 10, 240 ), aAppMap ), LogicToPixel( Size( 100, 12 ), aAppMap ) ); } @@ -1206,8 +1207,8 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton ) aData.aInclFilter[sizeof( aData.aInclFilter )-1] = '\0'; aData.aExclFilter[sizeof( aData.aExclFilter )-1] = '\0'; - aData.bOverwrite = maOverwrite.IsChecked() ? TRUE : FALSE; - aData.bHookOSLAssert = maHookOSLBox.IsChecked() ? TRUE : FALSE; + aData.bOverwrite = maOverwrite.IsChecked() ? sal_True : sal_False; + aData.bHookOSLAssert = maHookOSLBox.IsChecked() ? sal_True : sal_False; if ( maXtorThis.IsChecked() ) aData.nTestFlags |= DBG_TEST_XTOR_THIS; @@ -1301,7 +1302,7 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton ) ) ) ); aBox.Execute(); } - EndDialog( TRUE ); + EndDialog( sal_True ); } else if ( pButton == &maInfoButton ) { @@ -1324,7 +1325,7 @@ void DbgDialog::RequestHelp( const HelpEvent& rHEvt ) { if ( rHEvt.GetMode() & HELPMODE_CONTEXT ) { - DbgInfoDialog aInfoDialog( this, TRUE ); + DbgInfoDialog aInfoDialog( this, sal_True ); XubString aHelpText; const sal_Char** pHelpStrs = pDbgHelpText; while ( *pHelpStrs ) @@ -1340,7 +1341,7 @@ void DbgDialog::RequestHelp( const HelpEvent& rHEvt ) // ======================================================================= -DbgInfoDialog::DbgInfoDialog( Window* pParent, BOOL bHelpText ) : +DbgInfoDialog::DbgInfoDialog( Window* pParent, sal_Bool bHelpText ) : ModalDialog( pParent, WB_STDMODAL ), maListBox( this, WB_BORDER | WB_AUTOHSCROLL ), maOKButton( this, WB_DEFBUTTON ) @@ -1367,12 +1368,12 @@ DbgInfoDialog::DbgInfoDialog( Window* pParent, BOOL bHelpText ) : void DbgInfoDialog::SetInfoText( const XubString& rStr ) { - maListBox.SetUpdateMode( FALSE ); + maListBox.SetUpdateMode( sal_False ); maListBox.Clear(); XubString aStr = rStr; aStr.ConvertLineEnd( LINEEND_LF ); - USHORT nStrIndex = 0; - USHORT nFoundIndex; + sal_uInt16 nStrIndex = 0; + sal_uInt16 nFoundIndex; do { nFoundIndex = aStr.Search( _LF, nStrIndex ); @@ -1380,8 +1381,8 @@ void DbgInfoDialog::SetInfoText( const XubString& rStr ) if ( mbHelpText ) { long nMaxWidth = maListBox.GetOutputSizePixel().Width()-30; - USHORT nLastIndex = 0; - USHORT nIndex = aTextParagraph.Search( ' ' ); + sal_uInt16 nLastIndex = 0; + sal_uInt16 nIndex = aTextParagraph.Search( ' ' ); while ( nIndex != STRING_NOTFOUND ) { if ( maListBox.GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth ) @@ -1411,15 +1412,15 @@ void DbgInfoDialog::SetInfoText( const XubString& rStr ) nStrIndex = nFoundIndex+1; } while ( nFoundIndex != STRING_NOTFOUND ); - maListBox.SetUpdateMode( TRUE ); + maListBox.SetUpdateMode( sal_True ); } // ======================================================================= void DbgDialogTest( Window* pWindow ) { - BOOL aAccelBuf[65536]; - USHORT nChildCount = pWindow->GetChildCount(); + sal_Bool aAccelBuf[65536]; + sal_uInt16 nChildCount = pWindow->GetChildCount(); Window* pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD ); Window* pChild; Point aTabPos; @@ -1433,9 +1434,9 @@ void DbgDialogTest( Window* pWindow ) if ( pWindow->IsDialog() ) { - BOOL bOKCancelButton = FALSE; - BOOL bDefPushButton = FALSE; - BOOL bButton = FALSE; + sal_Bool bOKCancelButton = sal_False; + sal_Bool bDefPushButton = sal_False; + sal_Bool bButton = sal_False; pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD ); while ( pGetChild ) { @@ -1443,11 +1444,11 @@ void DbgDialogTest( Window* pWindow ) if ( pChild->ImplIsPushButton() ) { - bButton = TRUE; + bButton = sal_True; if ( (pChild->GetType() == WINDOW_OKBUTTON) || (pChild->GetType() == WINDOW_CANCELBUTTON) ) - bOKCancelButton = TRUE; + bOKCancelButton = sal_True; if ( pChild->GetStyle() & WB_DEFBUTTON ) - bDefPushButton = TRUE; + bDefPushButton = sal_True; } pGetChild = pGetChild->GetWindow( WINDOW_NEXT ); @@ -1462,7 +1463,7 @@ void DbgDialogTest( Window* pWindow ) } } - USHORT i = 0; + sal_uInt16 i = 0; pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD ); while ( pGetChild ) { @@ -1474,7 +1475,7 @@ void DbgDialogTest( Window* pWindow ) { XubString aText = pChild->GetText(); XubString aErrorText = aText; - USHORT nAccelPos = STRING_NOTFOUND; + sal_uInt16 nAccelPos = STRING_NOTFOUND; xub_Unicode cAccel = 0; if ( aErrorText.Len() > 128 ) { @@ -1495,7 +1496,7 @@ void DbgDialogTest( Window* pWindow ) if ( aAccelBuf[cAccel] ) DbgOutTypef( DBG_OUT_ERROR, "Double mnemonic char: %c", cAccel ); else - aAccelBuf[cAccel] = TRUE; + aAccelBuf[cAccel] = sal_True; } } } @@ -1648,66 +1649,66 @@ void DbgDialogTest( Window* pWindow ) if ( pChild->IsVisible() ) { - BOOL bMaxWarning = FALSE; + sal_Bool bMaxWarning = sal_False; if ( pChild->GetType() == WINDOW_NUMERICFIELD ) { NumericField* pField = (NumericField*)pChild; if ( pField->GetMax() == LONG_MAX ) - bMaxWarning = TRUE; + bMaxWarning = sal_True; } else if ( pChild->GetType() == WINDOW_METRICFIELD ) { MetricField* pField = (MetricField*)pChild; if ( pField->GetMax() == LONG_MAX ) - bMaxWarning = TRUE; + bMaxWarning = sal_True; } else if ( pChild->GetType() == WINDOW_CURRENCYFIELD ) { CurrencyField* pField = (CurrencyField*)pChild; if ( pField->GetMax() == LONG_MAX ) - bMaxWarning = TRUE; + bMaxWarning = sal_True; } else if ( pChild->GetType() == WINDOW_TIMEFIELD ) { TimeField* pField = (TimeField*)pChild; if ( pField->GetMax() == Time( 23, 59, 59, 99 ) ) - bMaxWarning = TRUE; + bMaxWarning = sal_True; } else if ( pChild->GetType() == WINDOW_DATEFIELD ) { DateField* pField = (DateField*)pChild; if ( pField->GetMax() == Date( 31, 12, 9999 ) ) - bMaxWarning = TRUE; + bMaxWarning = sal_True; } else if ( pChild->GetType() == WINDOW_NUMERICBOX ) { NumericBox* pBox = (NumericBox*)pChild; if ( pBox->GetMax() == LONG_MAX ) - bMaxWarning = TRUE; + bMaxWarning = sal_True; } else if ( pChild->GetType() == WINDOW_METRICBOX ) { MetricBox* pBox = (MetricBox*)pChild; if ( pBox->GetMax() == LONG_MAX ) - bMaxWarning = TRUE; + bMaxWarning = sal_True; } else if ( pChild->GetType() == WINDOW_CURRENCYBOX ) { CurrencyBox* pBox = (CurrencyBox*)pChild; if ( pBox->GetMax() == LONG_MAX ) - bMaxWarning = TRUE; + bMaxWarning = sal_True; } else if ( pChild->GetType() == WINDOW_TIMEBOX ) { TimeBox* pBox = (TimeBox*)pChild; if ( pBox->GetMax() == Time( 23, 59, 59, 99 ) ) - bMaxWarning = TRUE; + bMaxWarning = sal_True; } else if ( pChild->GetType() == WINDOW_DATEBOX ) { DateBox* pBox = (DateBox*)pChild; if ( pBox->GetMax() == Date( 31, 12, 9999 ) ) - bMaxWarning = TRUE; + bMaxWarning = sal_True; } if ( bMaxWarning ) { @@ -1761,7 +1762,7 @@ void DbgDialogTest( Window* pWindow ) aTabPos = aNewPos; } - for ( USHORT j = 0; j < i; j++ ) + for ( sal_uInt16 j = 0; j < i; j++ ) { if ( ((pRectAry[j].Right() != 0) || (pRectAry[j].Bottom() != 0)) && aChildRect.IsOver( pRectAry[j] ) ) @@ -1839,8 +1840,8 @@ long SolarMessageBoxExecutor::doIt() #if ! defined USE_VCL_MSGBOX #ifdef WNT - BOOL bOldCallTimer = pSVData->mbNoCallTimer; - pSVData->mbNoCallTimer = TRUE; + sal_Bool bOldCallTimer = pSVData->mbNoCallTimer; + pSVData->mbNoCallTimer = sal_True; MessageBeep( MB_ICONHAND ); nResult = MessageBoxW( 0, (LPWSTR)m_sDebugMessage.GetBuffer(), L"Debug Output", MB_TASKMODAL | MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONSTOP ); @@ -1859,7 +1860,7 @@ long SolarMessageBoxExecutor::doIt() } #endif // WNT #else - USHORT nOldMode = Application::GetSystemWindowMode(); + sal_uInt16 nOldMode = Application::GetSystemWindowMode(); Application::SetSystemWindowMode( nOldMode & ~SYSTEMWINDOW_MODE_NOAUTOMODE ); DbgMessageBox aBox( m_sDebugMessage ); Application::SetSystemWindowMode( nOldMode ); @@ -1945,12 +1946,12 @@ long SolarWindowPrinter::doIt() void DbgPrintWindow( const char* pLine ) { - static BOOL bIn = FALSE; + static sal_Bool bIn = sal_False; // keine rekursiven Traces if ( bIn ) return; - bIn = TRUE; + bIn = sal_True; SolarWindowPrinter aPrinter( String( pLine, RTL_TEXTENCODING_UTF8 ) ); TimeValue aTimeout; aTimeout.Seconds = 2; aTimeout.Nanosec = 0; @@ -1959,14 +1960,16 @@ void DbgPrintWindow( const char* pLine ) if ( aPrinter.didTimeout() ) DbgPrintShell( pLine ); - bIn = FALSE; + bIn = sal_False; } // ======================================================================= -#ifdef WNT -void ImplDbgTestSolarMutex(); -#endif +void ImplDbgTestSolarMutex() +{ + bool bCheck = ImplGetSVData()->mpDefInst->CheckYieldMutex(); + OSL_ENSURE( bCheck, "SolarMutex not locked" ); +} // ======================================================================= @@ -1974,9 +1977,7 @@ void DbgGUIInit() { DbgSetPrintMsgBox( DbgPrintMsgBox ); DbgSetPrintWindow( DbgPrintWindow ); -#ifdef WNT DbgSetTestSolarMutex( ImplDbgTestSolarMutex ); -#endif } // ----------------------------------------------------------------------- @@ -1985,9 +1986,7 @@ void DbgGUIDeInit() { DbgSetPrintMsgBox( NULL ); DbgSetPrintWindow( NULL ); -#ifdef WNT DbgSetTestSolarMutex( NULL ); -#endif DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin; if ( pDbgWindow ) @@ -2004,7 +2003,7 @@ void DbgGUIStart() { DbgDialog* pDialog = new DbgDialog; // Fuer den Debug-Dialog schalten wir Dialogtests aus - ULONG nOldFlags = pData->nTestFlags; + sal_uLong nOldFlags = pData->nTestFlags; pData->nTestFlags &= ~DBG_TEST_DIALOG; if ( !pDialog->Execute() ) pData->nTestFlags |= (nOldFlags & DBG_TEST_DIALOG); @@ -2019,7 +2018,7 @@ void DbgGUIStart() // ----------------------------------------------------------------------- -USHORT DbgRegisterNamedUserChannel( const XubString& _rChannelUIName, DbgPrintLine pProc ) +sal_uInt16 DbgRegisterNamedUserChannel( const XubString& _rChannelUIName, DbgPrintLine pProc ) { DbgChannelId nChannelId = DbgRegisterUserChannel( pProc ); UserDefinedChannels& rChannels = ImplDbgGetUserDefinedChannels(); diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index f26b5d3cb400..41263675840f 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -37,6 +37,7 @@ #include "vcl/help.hxx" #include "vcl/helpwin.hxx" #include "tools/debug.hxx" +#include "tools/diagnose_ex.h" #include "tools/time.hxx" // ======================================================================= @@ -63,27 +64,20 @@ Help::~Help() // ----------------------------------------------------------------------- -BOOL Help::Start( ULONG, const Window* ) -{ - return FALSE; -} - -void Help::OpenHelpAgent( ULONG ) +void Help::OpenHelpAgent( const rtl::OString& ) { } // ----------------------------------------------------------------------- -BOOL Help::Start( const XubString&, const Window* ) +sal_Bool Help::Start( const XubString&, const Window* ) { - return FALSE; + return sal_False; } -// ----------------------------------------------------------------------- - -XubString Help::GetHelpText( ULONG, const Window* ) +sal_Bool Help::SearchKeyword( const XubString& ) { - return ImplGetSVEmptyStr(); + return sal_False; } // ----------------------------------------------------------------------- @@ -97,26 +91,26 @@ XubString Help::GetHelpText( const String&, const Window* ) void Help::EnableContextHelp() { - ImplGetSVData()->maHelpData.mbContextHelp = TRUE; + ImplGetSVData()->maHelpData.mbContextHelp = sal_True; } // ----------------------------------------------------------------------- void Help::DisableContextHelp() { - ImplGetSVData()->maHelpData.mbContextHelp = FALSE; + ImplGetSVData()->maHelpData.mbContextHelp = sal_False; } // ----------------------------------------------------------------------- -BOOL Help::IsContextHelpEnabled() +sal_Bool Help::IsContextHelpEnabled() { return ImplGetSVData()->maHelpData.mbContextHelp; } // ----------------------------------------------------------------------- -BOOL Help::StartContextHelp() +sal_Bool Help::StartContextHelp() { ImplSVData* pSVData = ImplGetSVData(); @@ -128,74 +122,74 @@ BOOL Help::StartContextHelp() Point aMousePos = pWindow->OutputToScreenPixel( pWindow->GetPointerPosPixel() ); HelpEvent aHelpEvent( aMousePos, HELPMODE_CONTEXT ); pWindow->RequestHelp( aHelpEvent ); - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- void Help::EnableExtHelp() { - ImplGetSVData()->maHelpData.mbExtHelp = TRUE; + ImplGetSVData()->maHelpData.mbExtHelp = sal_True; } // ----------------------------------------------------------------------- void Help::DisableExtHelp() { - ImplGetSVData()->maHelpData.mbExtHelp = FALSE; + ImplGetSVData()->maHelpData.mbExtHelp = sal_False; } // ----------------------------------------------------------------------- -BOOL Help::IsExtHelpEnabled() +sal_Bool Help::IsExtHelpEnabled() { return ImplGetSVData()->maHelpData.mbExtHelp; } // ----------------------------------------------------------------------- -BOOL Help::StartExtHelp() +sal_Bool Help::StartExtHelp() { ImplSVData* pSVData = ImplGetSVData(); if ( pSVData->maHelpData.mbExtHelp && !pSVData->maHelpData.mbExtHelpMode ) { - pSVData->maHelpData.mbExtHelpMode = TRUE; + pSVData->maHelpData.mbExtHelpMode = sal_True; pSVData->maHelpData.mbOldBalloonMode = pSVData->maHelpData.mbBalloonHelp; - pSVData->maHelpData.mbBalloonHelp = TRUE; + pSVData->maHelpData.mbBalloonHelp = sal_True; if ( pSVData->maWinData.mpAppWin ) pSVData->maWinData.mpAppWin->ImplGenerateMouseMove(); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL Help::EndExtHelp() +sal_Bool Help::EndExtHelp() { ImplSVData* pSVData = ImplGetSVData(); if ( pSVData->maHelpData.mbExtHelp && pSVData->maHelpData.mbExtHelpMode ) { - pSVData->maHelpData.mbExtHelpMode = FALSE; + pSVData->maHelpData.mbExtHelpMode = sal_False; pSVData->maHelpData.mbBalloonHelp = pSVData->maHelpData.mbOldBalloonMode; if ( pSVData->maWinData.mpAppWin ) pSVData->maWinData.mpAppWin->ImplGenerateMouseMove(); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL Help::IsExtHelpActive() +sal_Bool Help::IsExtHelpActive() { return ImplGetSVData()->maHelpData.mbExtHelpMode; } @@ -204,101 +198,115 @@ BOOL Help::IsExtHelpActive() void Help::EnableBalloonHelp() { - ImplGetSVData()->maHelpData.mbBalloonHelp = TRUE; + ImplGetSVData()->maHelpData.mbBalloonHelp = sal_True; } // ----------------------------------------------------------------------- void Help::DisableBalloonHelp() { - ImplGetSVData()->maHelpData.mbBalloonHelp = FALSE; + ImplGetSVData()->maHelpData.mbBalloonHelp = sal_False; } // ----------------------------------------------------------------------- -BOOL Help::IsBalloonHelpEnabled() +sal_Bool Help::IsBalloonHelpEnabled() { return ImplGetSVData()->maHelpData.mbBalloonHelp; } // ----------------------------------------------------------------------- -BOOL Help::ShowBalloon( Window* pParent, +sal_Bool Help::ShowBalloon( Window* pParent, const Point& rScreenPos, const XubString& rHelpText ) { ImplShowHelpWindow( pParent, HELPWINSTYLE_BALLOON, 0, rHelpText, ImplGetSVEmptyStr(), rScreenPos ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL Help::ShowBalloon( Window* pParent, +sal_Bool Help::ShowBalloon( Window* pParent, const Point& rScreenPos, const Rectangle& rRect, const XubString& rHelpText ) { ImplShowHelpWindow( pParent, HELPWINSTYLE_BALLOON, 0, rHelpText, ImplGetSVEmptyStr(), rScreenPos, &rRect ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- void Help::EnableQuickHelp() { - ImplGetSVData()->maHelpData.mbQuickHelp = TRUE; + ImplGetSVData()->maHelpData.mbQuickHelp = sal_True; } // ----------------------------------------------------------------------- void Help::DisableQuickHelp() { - ImplGetSVData()->maHelpData.mbQuickHelp = FALSE; + ImplGetSVData()->maHelpData.mbQuickHelp = sal_False; } // ----------------------------------------------------------------------- -BOOL Help::IsQuickHelpEnabled() +sal_Bool Help::IsQuickHelpEnabled() { return ImplGetSVData()->maHelpData.mbQuickHelp; } // ----------------------------------------------------------------------- -BOOL Help::ShowQuickHelp( Window* pParent, +sal_Bool Help::ShowQuickHelp( Window* pParent, const Rectangle& rScreenRect, const XubString& rHelpText, const XubString& rLongHelpText, - USHORT nStyle ) + sal_uInt16 nStyle ) { ImplShowHelpWindow( pParent, HELPWINSTYLE_QUICK, nStyle, rHelpText, rLongHelpText, pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rScreenRect ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -ULONG Help::ShowTip( Window* pParent, const Rectangle& rRect, - const XubString& rText, USHORT nStyle ) +sal_uIntPtr Help::ShowTip( Window* pParent, const Rectangle& rScreenRect, + const XubString& rText, sal_uInt16 nStyle ) { - USHORT nHelpWinStyle = HELPWINSTYLE_QUICK; + sal_uInt16 nHelpWinStyle = ( ( nStyle & QUICKHELP_TIP_STYLE_BALLOON ) != 0 ) ? HELPWINSTYLE_BALLOON : HELPWINSTYLE_QUICK; HelpTextWindow* pHelpWin = new HelpTextWindow( pParent, rText, nHelpWinStyle, nStyle ); + sal_uIntPtr nId = reinterpret_cast< sal_uIntPtr >( pHelpWin ); + UpdateTip( nId, pParent, rScreenRect, rText ); + + pHelpWin->ShowHelp( HELPDELAY_NONE ); + return nId; +} + +// ----------------------------------------------------------------------- + +void Help::UpdateTip( sal_uIntPtr nId, Window* pParent, const Rectangle& rScreenRect, const XubString& rText ) +{ + HelpTextWindow* pHelpWin = reinterpret_cast< HelpTextWindow* >( nId ); + ENSURE_OR_RETURN_VOID( pHelpWin != NULL, "Help::UpdateTip: invalid ID!" ); + Size aSz = pHelpWin->CalcOutSize(); pHelpWin->SetOutputSizePixel( aSz ); - ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle, - pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rRect ); - pHelpWin->ShowHelp( HELPDELAY_NONE ); - return (ULONG)pHelpWin; + ImplSetHelpWindowPos( pHelpWin, pHelpWin->GetWinStyle(), pHelpWin->GetStyle(), + pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rScreenRect ); + + pHelpWin->SetHelpText( rText ); } // ----------------------------------------------------------------------- -void Help::HideTip( ULONG nId ) +void Help::HideTip( sal_uLong nId ) { HelpTextWindow* pHelpWin = (HelpTextWindow*)nId; Window* pFrameWindow = pHelpWin->ImplGetFrameWindow(); @@ -312,13 +320,13 @@ void Help::HideTip( ULONG nId ) // ======================================================================= -HelpTextWindow::HelpTextWindow( Window* pParent, const XubString& rText, USHORT nHelpWinStyle, USHORT nStyle ) : +HelpTextWindow::HelpTextWindow( Window* pParent, const XubString& rText, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle ) : //FloatingWindow( pParent->ImplGetFrameWindow(), WB_SYSTEMWINDOW ), FloatingWindow( pParent, WB_SYSTEMWINDOW|WB_TOOLTIPWIN ), // #105827# if we change the parent, mirroring will not work correctly when positioning this window maHelpText( rText ) { SetType( WINDOW_HELPTEXTWINDOW ); - ImplSetMouseTransparent( TRUE ); + ImplSetMouseTransparent( sal_True ); mnHelpWinStyle = nHelpWinStyle; mnStyle = nStyle; // on windows this will raise the application window, because help windows are system windows now @@ -331,9 +339,9 @@ HelpTextWindow::HelpTextWindow( Window* pParent, const XubString& rText, USHORT SetTextAlign( ALIGN_TOP ); if ( IsNativeControlSupported( CTRL_TOOLTIP, PART_ENTIRE_CONTROL ) ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else @@ -346,7 +354,7 @@ HelpTextWindow::HelpTextWindow( Window* pParent, const XubString& rText, USHORT if( mnStyle & QUICKHELP_BIDI_RTL ) { - ULONG nLayoutMode = GetLayoutMode(); + sal_uLong nLayoutMode = GetLayoutMode(); nLayoutMode |= TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT; SetLayoutMode( nLayoutMode ); } @@ -355,7 +363,7 @@ HelpTextWindow::HelpTextWindow( Window* pParent, const XubString& rText, USHORT ImplSVData* pSVData = ImplGetSVData(); if ( pSVData->maHelpData.mbSetKeyboardHelp ) - pSVData->maHelpData.mbKeyboardHelp = TRUE; + pSVData->maHelpData.mbKeyboardHelp = sal_True; const HelpSettings& rHelpSettings = pParent->GetSettings().GetHelpSettings(); maShowTimer.SetTimeoutHdl( LINK( this, HelpTextWindow, TimerHdl ) ); @@ -392,13 +400,13 @@ void HelpTextWindow::SetHelpText( const String& rHelpText ) else // HELPWINSTYLE_BALLOON { Point aTmpPoint; - USHORT nCharsInLine = 35 + ((maHelpText.Len()/100)*5); + sal_uInt16 nCharsInLine = 35 + ((maHelpText.Len()/100)*5); XubString aXXX; aXXX.Fill( nCharsInLine, 'x' ); // Durchschnittliche Breite, damit nicht jedes Fenster anders. long nWidth = GetTextWidth( aXXX ); Size aTmpSize( nWidth, 0x7FFFFFFF ); Rectangle aTry1( aTmpPoint, aTmpSize ); - USHORT nDrawFlags = TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK | + sal_uInt16 nDrawFlags = TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK | TEXT_DRAW_LEFT | TEXT_DRAW_TOP; if ( mnStyle & QUICKHELP_CTRLTEXT ) nDrawFlags |= TEXT_DRAW_MNEMONIC; @@ -420,7 +428,7 @@ void HelpTextWindow::SetHelpText( const String& rHelpText ) void HelpTextWindow::ImplShow() { ImplDelData aDogTag( this ); - Show( TRUE, SHOW_NOACTIVATE ); + Show( sal_True, SHOW_NOACTIVATE ); if( !aDogTag.IsDelete() ) Update(); } @@ -450,7 +458,7 @@ void HelpTextWindow::Paint( const Rectangle& ) } else // HELPWINSTYLE_BALLOON { - USHORT nDrawFlags = TEXT_DRAW_MULTILINE|TEXT_DRAW_WORDBREAK| + sal_uInt16 nDrawFlags = TEXT_DRAW_MULTILINE|TEXT_DRAW_WORDBREAK| TEXT_DRAW_LEFT|TEXT_DRAW_TOP; if ( mnStyle & QUICKHELP_CTRLTEXT ) nDrawFlags |= TEXT_DRAW_MNEMONIC; @@ -476,9 +484,9 @@ void HelpTextWindow::Paint( const Rectangle& ) // ----------------------------------------------------------------------- -void HelpTextWindow::ShowHelp( USHORT nDelayMode ) +void HelpTextWindow::ShowHelp( sal_uInt16 nDelayMode ) { - ULONG nTimeout = 0; + sal_uLong nTimeout = 0; if ( nDelayMode != HELPDELAY_NONE ) { // Im ExtendedHelp-Fall die Hilfe schneller anzeigen @@ -559,9 +567,9 @@ String HelpTextWindow::GetText() const // ----------------------------------------------------------------------- -BOOL HelpTextWindow::RegisterAccessibleParent() +sal_Bool HelpTextWindow::RegisterAccessibleParent() { - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -572,7 +580,7 @@ void HelpTextWindow::RevokeAccessibleParent() // ======================================================================= -void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle, +void ImplShowHelpWindow( Window* pParent, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle, const XubString& rHelpText, const XubString& rStatusText, const Point& rScreenPos, const Rectangle* pHelpArea ) { @@ -582,15 +590,19 @@ void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle, return; HelpTextWindow* pHelpWin = pSVData->maHelpData.mpHelpWin; - USHORT nDelayMode = HELPDELAY_NORMAL; + sal_uInt16 nDelayMode = HELPDELAY_NORMAL; if ( pHelpWin ) { DBG_ASSERT( pHelpWin != pParent, "HelpInHelp ?!" ); - if ( (( pHelpWin->GetHelpText() != rHelpText ) || - ( pHelpWin->GetWinStyle() != nHelpWinStyle ) || - ( pHelpArea && ( pHelpWin->GetHelpArea() != *pHelpArea ) ) ) - && pSVData->maHelpData.mbRequestingHelp ) + if ( ( ( pHelpWin->GetHelpText() != rHelpText ) + || ( pHelpWin->GetWinStyle() != nHelpWinStyle ) + || ( pHelpArea + && ( pHelpWin->GetHelpArea() != *pHelpArea ) + ) + ) + && pSVData->maHelpData.mbRequestingHelp + ) { // remove help window if no HelpText or other HelpText or // other help mode. but keep it if we are scrolling, ie not requesting help @@ -602,8 +614,8 @@ void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle, } else { - bool bTextChanged = rHelpText != pHelpWin->GetHelpText(); - if( bTextChanged ) + bool const bTextChanged = rHelpText != pHelpWin->GetHelpText(); + if ( bTextChanged || ( ( nStyle & QUICKHELP_FORCE_REPOSITION ) != 0 ) ) { Window * pWindow = pHelpWin->GetParent()->ImplGetFrameWindow(); Rectangle aInvRect( pHelpWin->GetWindowExtentsRelative( pWindow ) ); @@ -621,8 +633,10 @@ void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle, if ( !pHelpWin && rHelpText.Len() ) { - ULONG nCurTime = Time::GetSystemTicks(); - if( (nCurTime - pSVData->maHelpData.mnLastHelpHideTime) < pParent->GetSettings().GetHelpSettings().GetTipDelay() ) + sal_uLong nCurTime = Time::GetSystemTicks(); + if ( ( ( nCurTime - pSVData->maHelpData.mnLastHelpHideTime ) < pParent->GetSettings().GetHelpSettings().GetTipDelay() ) + || ( ( nStyle & QUICKHELP_NO_DELAY ) != 0 ) + ) nDelayMode = HELPDELAY_NONE; DBG_ASSERT( !pHelpWin, "Noch ein HelpWin ?!" ); @@ -657,7 +671,7 @@ void ImplDestroyHelpWindow( bool bUpdateHideTime ) if( pHelpWin->IsVisible() ) pWindow->Invalidate( aInvRect ); pSVData->maHelpData.mpHelpWin = NULL; - pSVData->maHelpData.mbKeyboardHelp = FALSE; + pSVData->maHelpData.mbKeyboardHelp = sal_False; pHelpWin->Hide(); delete pHelpWin; if( bUpdateHideTime ) @@ -667,7 +681,7 @@ void ImplDestroyHelpWindow( bool bUpdateHideTime ) // ----------------------------------------------------------------------- -void ImplSetHelpWindowPos( Window* pHelpWin, USHORT nHelpWinStyle, USHORT nStyle, +void ImplSetHelpWindowPos( Window* pHelpWin, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle, const Point& rPos, const Rectangle* pHelpArea ) { Point aPos = rPos; diff --git a/vcl/source/app/i18nhelp.cxx b/vcl/source/app/i18nhelp.cxx index 6841d84b424b..0f9a8df94255 100644 --- a/vcl/source/app/i18nhelp.cxx +++ b/vcl/source/app/i18nhelp.cxx @@ -131,7 +131,7 @@ sal_Int32 vcl::I18nHelper::CompareString( const String& rStr1, const String& rSt { // Change mbTransliterateIgnoreCase and destroy the warpper, next call to // ImplGetTransliterationWrapper() will create a wrapper with the correct bIgnoreCase - ((vcl::I18nHelper*)this)->mbTransliterateIgnoreCase = FALSE; + ((vcl::I18nHelper*)this)->mbTransliterateIgnoreCase = sal_False; delete ((vcl::I18nHelper*)this)->mpTransliterationWrapper; ((vcl::I18nHelper*)this)->mpTransliterationWrapper = NULL; } @@ -150,7 +150,7 @@ sal_Bool vcl::I18nHelper::MatchString( const String& rStr1, const String& rStr2 { // Change mbTransliterateIgnoreCase and destroy the warpper, next call to // ImplGetTransliterationWrapper() will create a wrapper with the correct bIgnoreCase - ((vcl::I18nHelper*)this)->mbTransliterateIgnoreCase = TRUE; + ((vcl::I18nHelper*)this)->mbTransliterateIgnoreCase = sal_True; delete ((vcl::I18nHelper*)this)->mpTransliterationWrapper; ((vcl::I18nHelper*)this)->mpTransliterationWrapper = NULL; } @@ -164,8 +164,8 @@ sal_Bool vcl::I18nHelper::MatchMnemonic( const String& rString, sal_Unicode cMne { ::osl::Guard< ::osl::Mutex > aGuard( ((vcl::I18nHelper*)this)->maMutex ); - BOOL bEqual = FALSE; - USHORT n = rString.Search( '~' ); + sal_Bool bEqual = sal_False; + sal_uInt16 n = rString.Search( '~' ); if ( n != STRING_NOTFOUND ) { String aMatchStr( rString, n+1, STRING_LEN ); // not only one char, because of transliteration... @@ -182,7 +182,7 @@ String vcl::I18nHelper::GetDate( const Date& rDate ) const return ImplGetLocaleDataWrapper().getDate( rDate ); } -String vcl::I18nHelper::GetNum( long nNumber, USHORT nDecimals, BOOL bUseThousandSep, BOOL bTrailingZeros ) const +String vcl::I18nHelper::GetNum( long nNumber, sal_uInt16 nDecimals, sal_Bool bUseThousandSep, sal_Bool bTrailingZeros ) const { return ImplGetLocaleDataWrapper().getNum( nNumber, nDecimals, bUseThousandSep, bTrailingZeros ); } diff --git a/vcl/source/app/idlemgr.cxx b/vcl/source/app/idlemgr.cxx index 1ed8785bc8c8..cc6502a74896 100644 --- a/vcl/source/app/idlemgr.cxx +++ b/vcl/source/app/idlemgr.cxx @@ -36,8 +36,8 @@ struct ImplIdleData { Link maIdleHdl; - USHORT mnPriority; - BOOL mbTimeout; + sal_uInt16 mnPriority; + sal_Bool mbTimeout; }; #define IMPL_IDLETIMEOUT 350 @@ -66,14 +66,14 @@ ImplIdleMgr::~ImplIdleMgr() // ----------------------------------------------------------------------- -BOOL ImplIdleMgr::InsertIdleHdl( const Link& rLink, USHORT nPriority ) +sal_Bool ImplIdleMgr::InsertIdleHdl( const Link& rLink, sal_uInt16 nPriority ) { size_t nPos = (size_t)-1; size_t n = mpIdleList->size(); for ( size_t i = 0; i < n; ++i ) { // we need to check each element to verify that rLink isn't in the array if ( (*mpIdleList)[ i ]->maIdleHdl == rLink ) { - return FALSE; + return sal_False; } if ( nPriority <= (*mpIdleList)[ i ]->mnPriority ) { nPos = i; @@ -83,7 +83,7 @@ BOOL ImplIdleMgr::InsertIdleHdl( const Link& rLink, USHORT nPriority ) ImplIdleData* pIdleData = new ImplIdleData; pIdleData->maIdleHdl = rLink; pIdleData->mnPriority = nPriority; - pIdleData->mbTimeout = FALSE; + pIdleData->mbTimeout = sal_False; if ( nPos < mpIdleList->size() ) { ImplIdleList::iterator it = mpIdleList->begin(); @@ -97,7 +97,7 @@ BOOL ImplIdleMgr::InsertIdleHdl( const Link& rLink, USHORT nPriority ) if ( !maTimer.IsActive() ) maTimer.Start(); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -124,12 +124,12 @@ IMPL_LINK( ImplIdleMgr, TimeoutHdl, Timer*, EMPTYARG ) for ( size_t i = 0; i < mpIdleList->size(); ++i ) { ImplIdleData* pIdleData = (*mpIdleList)[ i ]; if ( !pIdleData->mbTimeout ) { - pIdleData->mbTimeout = TRUE; + pIdleData->mbTimeout = sal_True; pIdleData->maIdleHdl.Call( GetpApp() ); // May have been removed in the handler for ( size_t j = 0; j < mpIdleList->size(); ++j ) { if ( (*mpIdleList)[ j ] == pIdleData ) { - pIdleData->mbTimeout = FALSE; + pIdleData->mbTimeout = sal_False; break; } } diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 08f199d5281c..8cbd1d816f8c 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -39,7 +39,6 @@ #include <vcl/salbmp.hxx> #include <vcl/salobj.hxx> #include <vcl/salmenu.hxx> -#include <vcl/salctrlhandle.hxx> // this file contains the virtual destructors of the sal interface // compilers ususally put their vtables where the destructor is @@ -75,6 +74,29 @@ void SalInstance::FillFontPathList( std::list< rtl::OString >& ) // do nothing } +SalMenu* SalInstance::CreateMenu( sal_Bool, Menu* ) +{ + // default: no native menus + return NULL; +} + +void SalInstance::DestroyMenu( SalMenu* pMenu ) +{ + (void)pMenu; + OSL_ENSURE( pMenu == 0, "DestroyMenu called with non-native menus" ); +} + +SalMenuItem* SalInstance::CreateMenuItem( const SalItemParams* ) +{ + return NULL; +} + +void SalInstance::DestroyMenuItem( SalMenuItem* pItem ) +{ + (void)pItem; + OSL_ENSURE( pItem == 0, "DestroyMenu called with non-native menus" ); +} + SalTimer::~SalTimer() { } @@ -95,10 +117,10 @@ SalPrinter::~SalPrinter() { } -BOOL SalPrinter::StartJob( const String*, const String&, const String&, +sal_Bool SalPrinter::StartJob( const String*, const String&, const String&, ImplJobSetup*, vcl::PrinterController& ) { - return FALSE; + return sal_False; } SalInfoPrinter::~SalInfoPrinter() @@ -117,7 +139,7 @@ SalMenu::~SalMenu() { } -bool SalMenu::ShowNativePopupMenu(FloatingWindow *, const Rectangle&, ULONG ) +bool SalMenu::ShowNativePopupMenu(FloatingWindow *, const Rectangle&, sal_uLong ) { return false; } @@ -127,11 +149,11 @@ bool SalMenu::AddMenuBarButton( const SalMenuButtonItem& ) return false; } -void SalMenu::RemoveMenuBarButton( USHORT ) +void SalMenu::RemoveMenuBarButton( sal_uInt16 ) { } -Rectangle SalMenu::GetMenuBarButtonRectPixel( USHORT, SalFrame* ) +Rectangle SalMenu::GetMenuBarButtonRectPixel( sal_uInt16, SalFrame* ) { return Rectangle(); } @@ -139,8 +161,5 @@ Rectangle SalMenu::GetMenuBarButtonRectPixel( USHORT, SalFrame* ) SalMenuItem::~SalMenuItem() { } -SalControlHandle::~SalControlHandle() -{ -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx index d75b669b51f4..89aaf9026312 100644 --- a/vcl/source/app/session.cxx +++ b/vcl/source/app/session.cxx @@ -40,6 +40,12 @@ #include <list> +namespace { + +namespace css = com::sun::star; + +} + using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::frame; @@ -54,12 +60,12 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient { struct Listener { - Reference< XSessionManagerListener > m_xListener; + css::uno::Reference< XSessionManagerListener > m_xListener; bool m_bInteractionRequested; bool m_bInteractionDone; bool m_bSaveDone; - Listener( const Reference< XSessionManagerListener >& xListener ) + Listener( const css::uno::Reference< XSessionManagerListener >& xListener ) : m_xListener( xListener ), m_bInteractionRequested( false ), m_bInteractionDone( false ), @@ -86,11 +92,11 @@ public: VCLSession(); virtual ~VCLSession(); - virtual void SAL_CALL addSessionManagerListener( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); - virtual void SAL_CALL removeSessionManagerListener( const Reference< XSessionManagerListener>& xListener ) throw( RuntimeException ); - virtual void SAL_CALL queryInteraction( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); - virtual void SAL_CALL interactionDone( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); - virtual void SAL_CALL saveDone( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); + virtual void SAL_CALL addSessionManagerListener( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); + virtual void SAL_CALL removeSessionManagerListener( const css::uno::Reference< XSessionManagerListener>& xListener ) throw( RuntimeException ); + virtual void SAL_CALL queryInteraction( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); + virtual void SAL_CALL interactionDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); + virtual void SAL_CALL saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); virtual sal_Bool SAL_CALL cancelShutdown() throw( RuntimeException ); }; @@ -148,7 +154,7 @@ void VCLSession::callSaveRequested( bool bShutdown, bool bCancelable ) } } - ULONG nAcquireCount = Application::ReleaseSolarMutex(); + sal_uLong nAcquireCount = Application::ReleaseSolarMutex(); for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it ) it->m_xListener->doSave( bShutdown, bCancelable ); Application::AcquireSolarMutex( nAcquireCount ); @@ -176,7 +182,7 @@ void VCLSession::callInteractionGranted( bool bInteractionGranted ) } } - ULONG nAcquireCount = Application::ReleaseSolarMutex(); + sal_uLong nAcquireCount = Application::ReleaseSolarMutex(); for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it ) it->m_xListener->approveInteraction( bInteractionGranted ); @@ -194,7 +200,7 @@ void VCLSession::callShutdownCancelled() m_bInteractionRequested = m_bInteractionDone = m_bInteractionGranted = false; } - ULONG nAcquireCount = Application::ReleaseSolarMutex(); + sal_uLong nAcquireCount = Application::ReleaseSolarMutex(); for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it ) it->m_xListener->shutdownCanceled(); Application::AcquireSolarMutex( nAcquireCount ); @@ -211,10 +217,10 @@ void VCLSession::callQuit() m_bInteractionRequested = m_bInteractionDone = m_bInteractionGranted = false; } - ULONG nAcquireCount = Application::ReleaseSolarMutex(); + sal_uLong nAcquireCount = Application::ReleaseSolarMutex(); for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it ) { - Reference< XSessionManagerListener2 > xListener2( it->m_xListener, UNO_QUERY ); + css::uno::Reference< XSessionManagerListener2 > xListener2( it->m_xListener, UNO_QUERY ); if( xListener2.is() ) xListener2->doQuit(); } @@ -246,14 +252,14 @@ void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent ) } } -void SAL_CALL VCLSession::addSessionManagerListener( const Reference<XSessionManagerListener>& xListener ) throw( RuntimeException ) +void SAL_CALL VCLSession::addSessionManagerListener( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException ) { osl::MutexGuard aGuard( m_aMutex ); m_aListeners.push_back( Listener( xListener ) ); } -void SAL_CALL VCLSession::removeSessionManagerListener( const Reference<XSessionManagerListener>& xListener ) throw( RuntimeException ) +void SAL_CALL VCLSession::removeSessionManagerListener( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException ) { osl::MutexGuard aGuard( m_aMutex ); @@ -270,7 +276,7 @@ void SAL_CALL VCLSession::removeSessionManagerListener( const Reference<XSession } } -void SAL_CALL VCLSession::queryInteraction( const Reference<XSessionManagerListener>& xListener ) throw( RuntimeException ) +void SAL_CALL VCLSession::queryInteraction( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException ) { if( m_bInteractionGranted ) { @@ -297,7 +303,7 @@ void SAL_CALL VCLSession::queryInteraction( const Reference<XSessionManagerListe } } -void SAL_CALL VCLSession::interactionDone( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ) +void SAL_CALL VCLSession::interactionDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ) { osl::MutexGuard aGuard( m_aMutex ); int nRequested = 0, nDone = 0; @@ -320,7 +326,7 @@ void SAL_CALL VCLSession::interactionDone( const Reference< XSessionManagerListe } } -void SAL_CALL VCLSession::saveDone( const Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ) +void SAL_CALL VCLSession::saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ) { osl::MutexGuard aGuard( m_aMutex ); @@ -361,13 +367,13 @@ Sequence< rtl::OUString > SAL_CALL vcl_session_getSupportedServiceNames() return aRet; } -Reference< XInterface > SAL_CALL vcl_session_createInstance( const Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/ ) +css::uno::Reference< XInterface > SAL_CALL vcl_session_createInstance( const css::uno::Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/ ) { ImplSVData* pSVData = ImplGetSVData(); if( ! pSVData->xSMClient.is() ) pSVData->xSMClient = new VCLSession(); - return Reference< XInterface >(pSVData->xSMClient, UNO_QUERY ); + return css::uno::Reference< XInterface >(pSVData->xSMClient, UNO_QUERY ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 253c9f8d2ff2..84b8d7cc9154 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -148,18 +148,18 @@ void MachineSettings::CopyData() // ----------------------------------------------------------------------- -BOOL MachineSettings::operator ==( const MachineSettings& rSet ) const +sal_Bool MachineSettings::operator ==( const MachineSettings& rSet ) const { if ( mpData == rSet.mpData ) - return TRUE; + return sal_True; if ( (mpData->mnOptions == rSet.mpData->mnOptions) && (mpData->mnScreenOptions == rSet.mpData->mnScreenOptions) && (mpData->mnPrintOptions == rSet.mpData->mnPrintOptions) && (mpData->mnScreenRasterFontDeviation == rSet.mpData->mnScreenRasterFontDeviation) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ======================================================================= @@ -179,7 +179,7 @@ ImplMouseData::ImplMouseData() mnDragLinkCode = KEY_SHIFT | KEY_MOD1; mnContextMenuCode = MOUSE_RIGHT; mnContextMenuClicks = 1; - mbContextMenuDown = TRUE; + mbContextMenuDown = sal_True; mnMiddleButtonAction = MOUSE_MIDDLE_AUTOSCROLL; mnScrollRepeat = 100; mnButtonStartRepeat = 370; @@ -281,10 +281,10 @@ void MouseSettings::CopyData() // ----------------------------------------------------------------------- -BOOL MouseSettings::operator ==( const MouseSettings& rSet ) const +sal_Bool MouseSettings::operator ==( const MouseSettings& rSet ) const { if ( mpData == rSet.mpData ) - return TRUE; + return sal_True; if ( (mpData->mnOptions == rSet.mpData->mnOptions) && (mpData->mnDoubleClkTime == rSet.mpData->mnDoubleClkTime) && @@ -307,9 +307,9 @@ BOOL MouseSettings::operator ==( const MouseSettings& rSet ) const (mpData->mnMenuDelay == rSet.mpData->mnMenuDelay) && (mpData->mnFollow == rSet.mpData->mnFollow) && (mpData->mnWheelBehavior == rSet.mpData->mnWheelBehavior ) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ======================================================================= @@ -391,15 +391,15 @@ void KeyboardSettings::CopyData() // ----------------------------------------------------------------------- -BOOL KeyboardSettings::operator ==( const KeyboardSettings& rSet ) const +sal_Bool KeyboardSettings::operator ==( const KeyboardSettings& rSet ) const { if ( mpData == rSet.mpData ) - return TRUE; + return sal_True; if ( (mpData->mnOptions == rSet.mpData->mnOptions) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ======================================================================= @@ -418,12 +418,11 @@ ImplStyleData::ImplStyleData() mnCursorBlinkTime = STYLE_CURSOR_NOBLINKTIME; mnScreenZoom = 100; mnScreenFontZoom = 100; - mnRadioButtonStyle = 0; - mnCheckBoxStyle = 0; - mnPushButtonStyle = 0; - mnTabControlStyle = 0; mnLogoDisplayTime = LOGO_DISPLAYTIME_STARTTIME; - mnDragFullOptions = 0; + mnDragFullOptions = DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | + DRAGFULL_OPTION_OBJECTMOVE | DRAGFULL_OPTION_OBJECTSIZE | + DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT | + DRAGFULL_OPTION_SCROLL; mnAnimationOptions = 0; mnSelectionOptions = 0; mnDisplayOptions = 0; @@ -520,10 +519,6 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : mnCursorBlinkTime = rData.mnCursorBlinkTime; mnScreenZoom = rData.mnScreenZoom; mnScreenFontZoom = rData.mnScreenFontZoom; - mnRadioButtonStyle = rData.mnRadioButtonStyle; - mnCheckBoxStyle = rData.mnCheckBoxStyle; - mnPushButtonStyle = rData.mnPushButtonStyle; - mnTabControlStyle = rData.mnTabControlStyle; mnLogoDisplayTime = rData.mnLogoDisplayTime; mnDragFullOptions = rData.mnDragFullOptions; mnAnimationOptions = rData.mnAnimationOptions; @@ -615,12 +610,6 @@ void ImplStyleData::SetStandardStyles() maHighlightLinkColor = Color( COL_LIGHTBLUE ); maFontColor = Color( COL_BLACK ); - mnRadioButtonStyle &= ~STYLE_RADIOBUTTON_STYLE; - mnCheckBoxStyle &= ~STYLE_CHECKBOX_STYLE; - mnPushButtonStyle &= ~STYLE_PUSHBUTTON_STYLE; - mnTabControlStyle = 0; - - mnOptions &= ~(STYLE_OPTION_SYSTEMSTYLE | STDSYS_STYLE); mnBorderSize = 1; mnTitleHeight = 18; mnFloatTitleHeight = 13; @@ -630,8 +619,8 @@ void ImplStyleData::SetStandardStyles() mnUseSystemUIFonts = 1; mnUseFlatBorders = 0; mnUseFlatMenues = 0; - mbPreferredUseImagesInMenus = TRUE; - mnSkipDisabledInMenus = (USHORT)FALSE; + mbPreferredUseImagesInMenus = sal_True; + mnSkipDisabledInMenus = (sal_uInt16)sal_False; Gradient aGrad( GRADIENT_LINEAR, DEFAULT_WORKSPACE_GRADIENT_START_COLOR, DEFAULT_WORKSPACE_GRADIENT_END_COLOR ); maWorkspaceGradient = Wallpaper( aGrad ); @@ -681,13 +670,13 @@ void StyleSettings::Set3DColors( const Color& rColor ) mpData->maShadowColor = rColor; mpData->maLightColor.IncreaseLuminance( 64 ); mpData->maShadowColor.DecreaseLuminance( 64 ); - ULONG nRed = mpData->maLightColor.GetRed(); - ULONG nGreen = mpData->maLightColor.GetGreen(); - ULONG nBlue = mpData->maLightColor.GetBlue(); - nRed += (ULONG)(mpData->maShadowColor.GetRed()); - nGreen += (ULONG)(mpData->maShadowColor.GetGreen()); - nBlue += (ULONG)(mpData->maShadowColor.GetBlue()); - mpData->maCheckedColor = Color( (BYTE)(nRed/2), (BYTE)(nGreen/2), (BYTE)(nBlue/2) ); + sal_uLong nRed = mpData->maLightColor.GetRed(); + sal_uLong nGreen = mpData->maLightColor.GetGreen(); + sal_uLong nBlue = mpData->maLightColor.GetBlue(); + nRed += (sal_uLong)(mpData->maShadowColor.GetRed()); + nGreen += (sal_uLong)(mpData->maShadowColor.GetGreen()); + nBlue += (sal_uLong)(mpData->maShadowColor.GetBlue()); + mpData->maCheckedColor = Color( (sal_uInt8)(nRed/2), (sal_uInt8)(nGreen/2), (sal_uInt8)(nBlue/2) ); } else { @@ -699,7 +688,7 @@ void StyleSettings::Set3DColors( const Color& rColor ) // ----------------------------------------------------------------------- -::rtl::OUString StyleSettings::ImplSymbolsStyleToName( ULONG nStyle ) const +::rtl::OUString StyleSettings::ImplSymbolsStyleToName( sal_uLong nStyle ) const { switch ( nStyle ) { @@ -718,7 +707,7 @@ void StyleSettings::Set3DColors( const Color& rColor ) // ----------------------------------------------------------------------- -ULONG StyleSettings::ImplNameToSymbolsStyle( const ::rtl::OUString &rName ) const +sal_uLong StyleSettings::ImplNameToSymbolsStyle( const ::rtl::OUString &rName ) const { if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default")) ) return STYLE_SYMBOLS_DEFAULT; @@ -762,22 +751,22 @@ void StyleSettings::SetPreferredSymbolsStyleName( const ::rtl::OUString &rName ) // ----------------------------------------------------------------------- -ULONG StyleSettings::GetCurrentSymbolsStyle() const +sal_uLong StyleSettings::GetCurrentSymbolsStyle() const { // style selected in Tools -> Options... -> OpenOffice.org -> View - ULONG nStyle = GetSymbolsStyle(); + sal_uLong nStyle = GetSymbolsStyle(); if ( nStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nStyle) ) ) { // the preferred style can be read from the desktop setting by the desktop native widgets modules - ULONG nPreferredStyle = GetPreferredSymbolsStyle(); + sal_uLong nPreferredStyle = GetPreferredSymbolsStyle(); if ( nPreferredStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nPreferredStyle) ) ) { // use a hardcoded desktop-specific fallback if no preferred style has been detected static bool sbFallbackDesktopChecked = false; - static ULONG snFallbackDesktopStyle = STYLE_SYMBOLS_DEFAULT; + static sal_uLong snFallbackDesktopStyle = STYLE_SYMBOLS_DEFAULT; if ( !sbFallbackDesktopChecked ) { @@ -799,10 +788,10 @@ ULONG StyleSettings::GetCurrentSymbolsStyle() const // ----------------------------------------------------------------------- -ULONG StyleSettings::GetAutoSymbolsStyle() const +sal_uLong StyleSettings::GetAutoSymbolsStyle() const { const ::rtl::OUString& rDesktopEnvironment = Application::GetDesktopEnvironment(); - ULONG nRet = STYLE_SYMBOLS_DEFAULT; + sal_uLong nRet = STYLE_SYMBOLS_DEFAULT; bool bCont = true; try @@ -833,9 +822,9 @@ ULONG StyleSettings::GetAutoSymbolsStyle() const // falback to any existing style if ( ! CheckSymbolStyle (nRet) ) { - for ( ULONG n = 0 ; n <= STYLE_SYMBOLS_THEMES_MAX ; n++ ) + for ( sal_uLong n = 0 ; n <= STYLE_SYMBOLS_THEMES_MAX ; n++ ) { - ULONG nStyleToCheck = n; + sal_uLong nStyleToCheck = n; // auto is not a real theme => can't be fallback if ( nStyleToCheck == STYLE_SYMBOLS_AUTO ) @@ -860,7 +849,7 @@ ULONG StyleSettings::GetAutoSymbolsStyle() const // ----------------------------------------------------------------------- -bool StyleSettings::CheckSymbolStyle( ULONG nStyle ) const +bool StyleSettings::CheckSymbolStyle( sal_uLong nStyle ) const { if ( nStyle == STYLE_SYMBOLS_INDUSTRIAL ) return false; // industrial is dead @@ -871,15 +860,15 @@ bool StyleSettings::CheckSymbolStyle( ULONG nStyle ) const // ----------------------------------------------------------------------- -BOOL StyleSettings::GetUseImagesInMenus() const +sal_Bool StyleSettings::GetUseImagesInMenus() const { // icon mode selected in Tools -> Options... -> OpenOffice.org -> View - USHORT nStyle = mpData->mnUseImagesInMenus; + sal_uInt16 nStyle = mpData->mnUseImagesInMenus; if ( nStyle == STYLE_MENUIMAGES_AUTO ) return GetPreferredUseImagesInMenus(); - return (BOOL)nStyle; + return (sal_Bool)nStyle; } // ----------------------------------------------------------------------- @@ -892,40 +881,12 @@ void StyleSettings::SetStandardStyles() // ----------------------------------------------------------------------- -void StyleSettings::SetStandardWinStyles() -{ - return; // no more style changes since NWF -} - -// ----------------------------------------------------------------------- - -void StyleSettings::SetStandardOS2Styles() -{ - return; // no more style changes since NWF -} - -// ----------------------------------------------------------------------- - -void StyleSettings::SetStandardMacStyles() -{ - return; // no more style changes since NWF -} - -// ----------------------------------------------------------------------- - -void StyleSettings::SetStandardUnixStyles() -{ - return; // no more style changes since NWF -} - -// ----------------------------------------------------------------------- - Color StyleSettings::GetFaceGradientColor() const { // compute a brighter face color that can be used in gradients // for a convex look (eg toolbars) - USHORT h, s, b; + sal_uInt16 h, s, b; GetFaceColor().RGBtoHSB( h, s, b ); if( s > 1) s=1; if( b < 98) b=98; @@ -937,7 +898,7 @@ Color StyleSettings::GetFaceGradientColor() const Color StyleSettings::GetSeparatorColor() const { // compute a brighter shadow color for separators (used in toolbars or between menubar and toolbars on Windows XP) - USHORT h, s, b; + sal_uInt16 h, s, b; GetShadowColor().RGBtoHSB( h, s, b ); b += b/4; s -= s/4; @@ -978,15 +939,15 @@ void StyleSettings::CopyData() // ----------------------------------------------------------------------- -inline BOOL ImplIsBackOrWhite( const Color& rColor ) +inline sal_Bool ImplIsBackOrWhite( const Color& rColor ) { - UINT8 nLuminance = rColor.GetLuminance(); + sal_uInt8 nLuminance = rColor.GetLuminance(); return ( nLuminance < 8 ) || ( nLuminance > 250 ); } -BOOL StyleSettings::IsHighContrastBlackAndWhite() const +sal_Bool StyleSettings::IsHighContrastBlackAndWhite() const { - BOOL bBWOnly = TRUE; + sal_Bool bBWOnly = sal_True; // Only use B&W if fully B&W, like on GNOME. // Some colors like CheckedColor and HighlightColor are not B&W in Windows Standard HC Black, @@ -995,41 +956,41 @@ BOOL StyleSettings::IsHighContrastBlackAndWhite() const // Unfortunately, GNOME uses a very very dark color (0x000033) instead of BLACK (0x000000) if ( !ImplIsBackOrWhite( GetFaceColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; else if ( !ImplIsBackOrWhite( GetHighlightTextColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; else if ( !ImplIsBackOrWhite( GetWindowColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; else if ( !ImplIsBackOrWhite( GetWindowTextColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; else if ( !ImplIsBackOrWhite( GetButtonTextColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; else if ( !ImplIsBackOrWhite( GetButtonTextColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; else if ( !ImplIsBackOrWhite( GetGroupTextColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; else if ( !ImplIsBackOrWhite( GetLabelTextColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; else if ( !ImplIsBackOrWhite( GetDialogColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; else if ( !ImplIsBackOrWhite( GetFieldColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; else if ( !ImplIsBackOrWhite( GetMenuColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; else if ( !ImplIsBackOrWhite( GetMenuBarColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; else if ( !ImplIsBackOrWhite( GetMenuHighlightColor() ) ) - bBWOnly = FALSE; + bBWOnly = sal_False; return bBWOnly; } // ----------------------------------------------------------------------- -BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const +sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const { if ( mpData == rSet.mpData ) - return TRUE; + return sal_True; if ( (mpData->mnOptions == rSet.mpData->mnOptions) && (mpData->mnAutoMnemonic == rSet.mpData->mnAutoMnemonic) && @@ -1054,14 +1015,12 @@ BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const (mpData->mnAntialiasedMin == rSet.mpData->mnAntialiasedMin) && (mpData->mnScreenZoom == rSet.mpData->mnScreenZoom) && (mpData->mnScreenFontZoom == rSet.mpData->mnScreenFontZoom) && - (mpData->mnRadioButtonStyle == rSet.mpData->mnRadioButtonStyle) && - (mpData->mnCheckBoxStyle == rSet.mpData->mnCheckBoxStyle) && - (mpData->mnPushButtonStyle == rSet.mpData->mnPushButtonStyle) && - (mpData->mnTabControlStyle == rSet.mpData->mnTabControlStyle) && (mpData->mnHighContrast == rSet.mpData->mnHighContrast) && (mpData->mnUseSystemUIFonts == rSet.mpData->mnUseSystemUIFonts) && (mpData->mnUseFlatBorders == rSet.mpData->mnUseFlatBorders) && (mpData->mnUseFlatMenues == rSet.mpData->mnUseFlatMenues) && + (mpData->mnSymbolsStyle == rSet.mpData->mnSymbolsStyle) && + (mpData->mnPreferredSymbolsStyle == rSet.mpData->mnPreferredSymbolsStyle) && (mpData->maFaceColor == rSet.mpData->maFaceColor) && (mpData->maCheckedColor == rSet.mpData->maCheckedColor) && (mpData->maLightColor == rSet.mpData->maLightColor) && @@ -1123,9 +1082,9 @@ BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const (mpData->mbPreferredUseImagesInMenus == rSet.mpData->mbPreferredUseImagesInMenus) && (mpData->mnSkipDisabledInMenus == rSet.mpData->mnSkipDisabledInMenus) && (mpData->maFontColor == rSet.mpData->maFontColor )) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ======================================================================= @@ -1133,10 +1092,10 @@ BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const ImplMiscData::ImplMiscData() { mnRefCount = 1; - mnEnableATT = sal::static_int_cast<USHORT>(~0U); - mnDisablePrinting = sal::static_int_cast<USHORT>(~0U); + mnEnableATT = sal::static_int_cast<sal_uInt16>(~0U); + mnDisablePrinting = sal::static_int_cast<sal_uInt16>(~0U); static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI - mbEnableLocalizedDecimalSep = (pEnv != NULL) ? TRUE : FALSE; + mbEnableLocalizedDecimalSep = (pEnv != NULL) ? sal_True : sal_False; } // ----------------------------------------------------------------------- @@ -1212,24 +1171,24 @@ void MiscSettings::CopyData() // ----------------------------------------------------------------------- -BOOL MiscSettings::operator ==( const MiscSettings& rSet ) const +sal_Bool MiscSettings::operator ==( const MiscSettings& rSet ) const { if ( mpData == rSet.mpData ) - return TRUE; + return sal_True; if ( (mpData->mnEnableATT == rSet.mpData->mnEnableATT ) && (mpData->mnDisablePrinting == rSet.mpData->mnDisablePrinting ) && (mpData->mbEnableLocalizedDecimalSep == rSet.mpData->mbEnableLocalizedDecimalSep ) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL MiscSettings::GetDisablePrinting() const +sal_Bool MiscSettings::GetDisablePrinting() const { - if( mpData->mnDisablePrinting == (USHORT)~0 ) + if( mpData->mnDisablePrinting == (sal_uInt16)~0 ) { rtl::OUString aEnable = vcl::SettingsConfigItem::get()-> @@ -1238,15 +1197,15 @@ BOOL MiscSettings::GetDisablePrinting() const mpData->mnDisablePrinting = aEnable.equalsIgnoreAsciiCaseAscii( "true" ) ? 1 : 0; } - return (BOOL)mpData->mnDisablePrinting; + return (sal_Bool)mpData->mnDisablePrinting; } // ----------------------------------------------------------------------- -BOOL MiscSettings::GetEnableATToolSupport() const +sal_Bool MiscSettings::GetEnableATToolSupport() const { #ifdef WNT - if( mpData->mnEnableATT == (USHORT)~0 ) + if( mpData->mnEnableATT == (sal_uInt16)~0 ) { // Check in the Windows registry if an AT tool wants Accessibility support to // be activated .. @@ -1257,7 +1216,7 @@ BOOL MiscSettings::GetEnableATToolSupport() const &hkey) ) { DWORD dwType; - WIN_BYTE Data[6]; // possible values: "true", "false", "1", "0", DWORD + sal_uInt8 Data[6]; // possible values: "true", "false", "1", "0", DWORD DWORD cbData = sizeof(Data); if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology", @@ -1269,7 +1228,7 @@ BOOL MiscSettings::GetEnableATToolSupport() const mpData->mnEnableATT = ((0 == stricmp((const char *) Data, "1")) || (0 == stricmp((const char *) Data, "true"))); break; case REG_DWORD: - mpData->mnEnableATT = (USHORT) (((DWORD *) Data)[0]); + mpData->mnEnableATT = (sal_uInt16) (((DWORD *) Data)[0]); break; default: // Unsupported registry type @@ -1282,7 +1241,7 @@ BOOL MiscSettings::GetEnableATToolSupport() const } #endif - if( mpData->mnEnableATT == (USHORT)~0 ) + if( mpData->mnEnableATT == (sal_uInt16)~0 ) { static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" ); if( !pEnv || !*pEnv ) @@ -1299,12 +1258,12 @@ BOOL MiscSettings::GetEnableATToolSupport() const } } - return (BOOL)mpData->mnEnableATT; + return (sal_Bool)mpData->mnEnableATT; } // ----------------------------------------------------------------------- -void MiscSettings::SetDisablePrinting( BOOL bEnable ) +void MiscSettings::SetDisablePrinting( sal_Bool bEnable ) { if ( bEnable != mpData->mnDisablePrinting ) { @@ -1318,11 +1277,11 @@ void MiscSettings::SetDisablePrinting( BOOL bEnable ) // ----------------------------------------------------------------------- -void MiscSettings::SetEnableATToolSupport( BOOL bEnable ) +void MiscSettings::SetEnableATToolSupport( sal_Bool bEnable ) { if ( bEnable != mpData->mnEnableATT ) { - BOOL bDummy; + sal_Bool bDummy; if( bEnable && !ImplInitAccessBridge(false, bDummy) ) return; @@ -1335,7 +1294,7 @@ void MiscSettings::SetEnableATToolSupport( BOOL bEnable ) &hkey) ) { DWORD dwType; - WIN_BYTE Data[6]; // possible values: "true", "false", 1, 0 + sal_uInt8 Data[6]; // possible values: "true", "false", 1, 0 DWORD cbData = sizeof(Data); if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology", @@ -1346,7 +1305,7 @@ void MiscSettings::SetEnableATToolSupport( BOOL bEnable ) case REG_SZ: RegSetValueEx(hkey, "SupportAssistiveTechnology", NULL, dwType, - bEnable ? (WIN_BYTE *) "true" : (WIN_BYTE *) "false", + bEnable ? (sal_uInt8 *) "true" : (sal_uInt8 *) "false", bEnable ? sizeof("true") : sizeof("false")); break; case REG_DWORD: @@ -1372,13 +1331,13 @@ void MiscSettings::SetEnableATToolSupport( BOOL bEnable ) } } -void MiscSettings::SetEnableLocalizedDecimalSep( BOOL bEnable ) +void MiscSettings::SetEnableLocalizedDecimalSep( sal_Bool bEnable ) { CopyData(); mpData->mbEnableLocalizedDecimalSep = bEnable; } -BOOL MiscSettings::GetEnableLocalizedDecimalSep() const +sal_Bool MiscSettings::GetEnableLocalizedDecimalSep() const { return mpData->mbEnableLocalizedDecimalSep; } @@ -1462,15 +1421,15 @@ void NotificationSettings::CopyData() // ----------------------------------------------------------------------- -BOOL NotificationSettings::operator ==( const NotificationSettings& rSet ) const +sal_Bool NotificationSettings::operator ==( const NotificationSettings& rSet ) const { if ( mpData == rSet.mpData ) - return TRUE; + return sal_True; if ( (mpData->mnOptions == rSet.mpData->mnOptions) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ======================================================================= @@ -1558,18 +1517,18 @@ void HelpSettings::CopyData() // ----------------------------------------------------------------------- -BOOL HelpSettings::operator ==( const HelpSettings& rSet ) const +sal_Bool HelpSettings::operator ==( const HelpSettings& rSet ) const { if ( mpData == rSet.mpData ) - return TRUE; + return sal_True; if ( (mpData->mnOptions == rSet.mpData->mnOptions ) && (mpData->mnTipDelay == rSet.mpData->mnTipDelay ) && (mpData->mnTipTimeout == rSet.mpData->mnTipTimeout ) && (mpData->mnBalloonDelay == rSet.mpData->mnBalloonDelay ) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ======================================================================= @@ -1698,12 +1657,12 @@ void AllSettings::CopyData() // ----------------------------------------------------------------------- -ULONG AllSettings::Update( ULONG nFlags, const AllSettings& rSet ) +sal_uLong AllSettings::Update( sal_uLong nFlags, const AllSettings& rSet ) { DBG_CHKTHIS( AllSettings, NULL ); DBG_CHKOBJ( &rSet, AllSettings, NULL ); - ULONG nChangeFlags = 0; + sal_uLong nChangeFlags = 0; if ( nFlags & SETTINGS_MACHINE ) { @@ -1800,12 +1759,12 @@ ULONG AllSettings::Update( ULONG nFlags, const AllSettings& rSet ) // ----------------------------------------------------------------------- -ULONG AllSettings::GetChangeFlags( const AllSettings& rSet ) const +sal_uLong AllSettings::GetChangeFlags( const AllSettings& rSet ) const { DBG_CHKTHIS( AllSettings, NULL ); DBG_CHKOBJ( &rSet, AllSettings, NULL ); - ULONG nChangeFlags = 0; + sal_uLong nChangeFlags = 0; if ( mpData->maMachineSettings != rSet.mpData->maMachineSettings ) nChangeFlags |= SETTINGS_MACHINE; @@ -1836,13 +1795,13 @@ ULONG AllSettings::GetChangeFlags( const AllSettings& rSet ) const // ----------------------------------------------------------------------- -BOOL AllSettings::operator ==( const AllSettings& rSet ) const +sal_Bool AllSettings::operator ==( const AllSettings& rSet ) const { DBG_CHKTHIS( AllSettings, NULL ); DBG_CHKOBJ( &rSet, AllSettings, NULL ); if ( mpData == rSet.mpData ) - return TRUE; + return sal_True; if ( (mpData->maMachineSettings == rSet.mpData->maMachineSettings) && (mpData->maMouseSettings == rSet.mpData->maMouseSettings) && @@ -1855,10 +1814,10 @@ BOOL AllSettings::operator ==( const AllSettings& rSet ) const (mpData->maLocale == rSet.mpData->maLocale) && (mpData->mnWindowUpdate == rSet.mpData->mnWindowUpdate) ) { - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -1924,7 +1883,7 @@ void AllSettings::SetUILanguage( LanguageType ) // ----------------------------------------------------------------------- -BOOL AllSettings::GetLayoutRTL() const +sal_Bool AllSettings::GetLayoutRTL() const { static const char* pEnv = getenv("SAL_RTL_ENABLED" ); static int nUIMirroring = -1; // -1: undef, 0: auto, 1: on 2: off @@ -1933,7 +1892,7 @@ BOOL AllSettings::GetLayoutRTL() const if( pEnv ) return true; - BOOL bRTL = FALSE; + sal_Bool bRTL = sal_False; if( nUIMirroring == -1 ) { @@ -1943,7 +1902,7 @@ BOOL AllSettings::GetLayoutRTL() const OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/I18N/CTL")) ); // note: case sensisitive ! if ( aNode.isValid() ) { - BOOL bTmp = BOOL(); + sal_Bool bTmp = sal_Bool(); ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("UIMirroring")) ); if( aValue >>= bTmp ) { @@ -2053,7 +2012,7 @@ void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint ) if ( nHint & SYSLOCALEOPTIONS_HINT_DECSEP ) { MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); - BOOL bIsDecSepAsLocale = aAllSettings.mpData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale(); + sal_Bool bIsDecSepAsLocale = aAllSettings.mpData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale(); if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale ) { aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale ); diff --git a/vcl/source/app/sound.cxx b/vcl/source/app/sound.cxx index cae4991b3f18..13f832339977 100644 --- a/vcl/source/app/sound.cxx +++ b/vcl/source/app/sound.cxx @@ -35,6 +35,7 @@ #include <vcl/salframe.hxx> #include <tools/debug.hxx> #include <vcl/svdata.hxx> +#include <vcl/svapp.hxx> #include <vcl/window.hxx> #include <vcl/salbtype.hxx> #include <vcl/sound.hxx> @@ -42,6 +43,10 @@ void Sound::Beep( SoundType eType, Window* pWindow ) { + // #i91990# + if ( Application::IsHeadlessModeEnabled() ) + return; + if( !pWindow ) { Window* pDefWindow = ImplGetDefaultWindow(); diff --git a/vcl/source/app/stdtext.cxx b/vcl/source/app/stdtext.cxx index 22b51d8afef5..3fc2e67cc488 100644 --- a/vcl/source/app/stdtext.cxx +++ b/vcl/source/app/stdtext.cxx @@ -38,7 +38,7 @@ // ======================================================================= -XubString GetStandardText( USHORT nStdText ) +XubString GetStandardText( sal_uInt16 nStdText ) { ResMgr* pResMgr = ImplGetResMgr(); XubString aText; @@ -50,7 +50,7 @@ XubString GetStandardText( USHORT nStdText ) // ======================================================================= void ShowServiceNotAvailableError( Window* pParent, - const XubString& rServiceName, BOOL bError ) + const XubString& rServiceName, sal_Bool bError ) { XubString aText( GetStandardText( STANDARD_TEXT_SERVICE_NOT_AVAILABLE ) ); aText.SearchAndReplaceAscii( "%s", rServiceName ); diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 46a32b699650..e4cf7bf32330 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -44,7 +44,6 @@ #include "vcl/event.hxx" #include "vcl/vclevent.hxx" #include "vcl/virdev.hxx" -#include "vcl/windata.hxx" #include "vcl/window.h" #include "vcl/wrkwin.hxx" #include "vcl/idlemgr.hxx" @@ -82,12 +81,12 @@ using namespace ::com::sun::star::uno; class ImplReservedKey { public: - ImplReservedKey( KeyCode aKeyCode, USHORT nResId ) : + ImplReservedKey( KeyCode aKeyCode, sal_uInt16 nResId ) : mKeyCode(aKeyCode), mnResId( nResId) {} KeyCode mKeyCode; - USHORT mnResId; + sal_uInt16 mnResId; }; typedef std::pair<ImplReservedKey*, size_t> ReservedKeys; @@ -183,16 +182,16 @@ struct ImplEventHook struct ImplPostEventData { - ULONG mnEvent; + sal_uLong mnEvent; const Window* mpWin; - ULONG mnEventId; + sal_uLong mnEventId; KeyEvent maKeyEvent; MouseEvent maMouseEvent; - ImplPostEventData( ULONG nEvent, const Window* pWin, const KeyEvent& rKeyEvent ) : + ImplPostEventData( sal_uLong nEvent, const Window* pWin, const KeyEvent& rKeyEvent ) : mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maKeyEvent( rKeyEvent ) {} - ImplPostEventData( ULONG nEvent, const Window* pWin, const MouseEvent& rMouseEvent ) : + ImplPostEventData( sal_uLong nEvent, const Window* pWin, const MouseEvent& rMouseEvent ) : mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maMouseEvent( rMouseEvent ) {} ~ImplPostEventData() {} @@ -241,7 +240,7 @@ void Application::InitAppRes( const ResId& ) // ----------------------------------------------------------------------- -BOOL Application::QueryExit() +sal_Bool Application::QueryExit() { WorkWindow* pAppWin = ImplGetSVData()->maWinData.mpAppWin; @@ -249,12 +248,12 @@ BOOL Application::QueryExit() if ( pAppWin ) return pAppWin->Close(); else - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -void Application::UserEvent( ULONG, void* ) +void Application::UserEvent( sal_uLong, void* ) { } @@ -319,7 +318,7 @@ sal_uInt16 Application::GetCommandLineParamCount() // ----------------------------------------------------------------------- -XubString Application::GetCommandLineParam( USHORT nParam ) +XubString Application::GetCommandLineParam( sal_uInt16 nParam ) { rtl::OUString aParam; osl_getCommandArg( nParam, &aParam.pData ); @@ -356,7 +355,7 @@ const XubString& Application::GetAppFileName() // ----------------------------------------------------------------------- -USHORT Application::Exception( USHORT nError ) +sal_uInt16 Application::Exception( sal_uInt16 nError ) { switch ( nError & EXC_MAJORTYPE ) { @@ -398,12 +397,12 @@ void Application::Abort( const XubString& rErrorText ) // ----------------------------------------------------------------------- -ULONG Application::GetReservedKeyCodeCount() +sal_uLong Application::GetReservedKeyCodeCount() { return ImplReservedKeys::get()->second; } -const KeyCode* Application::GetReservedKeyCode( ULONG i ) +const KeyCode* Application::GetReservedKeyCode( sal_uLong i ) { if( i >= GetReservedKeyCodeCount() ) return NULL; @@ -411,7 +410,7 @@ const KeyCode* Application::GetReservedKeyCode( ULONG i ) return &ImplReservedKeys::get()->first[i].mKeyCode; } -String Application::GetReservedKeyCodeDescription( ULONG i ) +String Application::GetReservedKeyCodeDescription( sal_uLong i ) { ResMgr* pResMgr = ImplGetResMgr(); if( ! pResMgr ) @@ -430,12 +429,12 @@ void Application::Execute() DBG_STARTAPPEXECUTE(); ImplSVData* pSVData = ImplGetSVData(); - pSVData->maAppData.mbInAppExecute = TRUE; + pSVData->maAppData.mbInAppExecute = sal_True; while ( !pSVData->maAppData.mbAppQuit ) Application::Yield(); - pSVData->maAppData.mbInAppExecute = FALSE; + pSVData->maAppData.mbInAppExecute = sal_False; DBG_ENDAPPEXECUTE(); } @@ -497,7 +496,7 @@ void Application::Yield( bool i_bAllEvents ) IMPL_STATIC_LINK_NOINSTANCE( ImplSVAppData, ImplQuitMsg, void*, EMPTYARG ) { - ImplGetSVData()->maAppData.mbAppQuit = TRUE; + ImplGetSVData()->maAppData.mbAppQuit = sal_True; return 0; } @@ -525,7 +524,7 @@ oslThreadIdentifier Application::GetMainThreadIdentifier() // ----------------------------------------------------------------------- -ULONG Application::ReleaseSolarMutex() +sal_uLong Application::ReleaseSolarMutex() { ImplSVData* pSVData = ImplGetSVData(); return pSVData->mpDefInst->ReleaseYieldMutex(); @@ -533,7 +532,7 @@ ULONG Application::ReleaseSolarMutex() // ----------------------------------------------------------------------- -void Application::AcquireSolarMutex( ULONG nCount ) +void Application::AcquireSolarMutex( sal_uLong nCount ) { ImplSVData* pSVData = ImplGetSVData(); pSVData->mpDefInst->AcquireYieldMutex( nCount ); @@ -541,56 +540,56 @@ void Application::AcquireSolarMutex( ULONG nCount ) // ----------------------------------------------------------------------- -BOOL Application::IsInMain() +sal_Bool Application::IsInMain() { return ImplGetSVData()->maAppData.mbInAppMain; } // ----------------------------------------------------------------------- -BOOL Application::IsInExecute() +sal_Bool Application::IsInExecute() { return ImplGetSVData()->maAppData.mbInAppExecute; } // ----------------------------------------------------------------------- -BOOL Application::IsShutDown() +sal_Bool Application::IsShutDown() { return ImplGetSVData()->maAppData.mbAppQuit; } // ----------------------------------------------------------------------- -BOOL Application::IsInModalMode() +sal_Bool Application::IsInModalMode() { return (ImplGetSVData()->maAppData.mnModalMode != 0); } // ----------------------------------------------------------------------- -USHORT Application::GetModalModeCount() +sal_uInt16 Application::GetModalModeCount() { return ImplGetSVData()->maAppData.mnModalMode; } // ----------------------------------------------------------------------- -USHORT Application::GetDispatchLevel() +sal_uInt16 Application::GetDispatchLevel() { return ImplGetSVData()->maAppData.mnDispatchLevel; } // ----------------------------------------------------------------------- -BOOL Application::AnyInput( USHORT nType ) +sal_Bool Application::AnyInput( sal_uInt16 nType ) { - return (BOOL)ImplGetSVData()->mpDefInst->AnyInput( nType ); + return (sal_Bool)ImplGetSVData()->mpDefInst->AnyInput( nType ); } // ----------------------------------------------------------------------- -ULONG Application::GetLastInputInterval() +sal_uLong Application::GetLastInputInterval() { return (Time::GetSystemTicks()-ImplGetSVData()->maAppData.mnLastInputTime); } @@ -599,7 +598,7 @@ ULONG Application::GetLastInputInterval() extern int nImplSysDialog; -BOOL Application::IsUICaptured() +sal_Bool Application::IsUICaptured() { ImplSVData* pSVData = ImplGetSVData(); // Wenn Mouse gecaptured, oder im TrackingModus oder im Auswahlmodus @@ -608,37 +607,37 @@ BOOL Application::IsUICaptured() // D&D aktive !!! if ( pSVData->maWinData.mpCaptureWin || pSVData->maWinData.mpTrackWin || pSVData->maWinData.mpFirstFloat || nImplSysDialog ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL Application::IsUserActive( USHORT nTest ) +sal_Bool Application::IsUserActive( sal_uInt16 nTest ) { if ( nTest & (USERACTIVE_MOUSEDRAG | USERACTIVE_INPUT) ) { if ( IsUICaptured() ) - return TRUE; + return sal_True; } if ( nTest & USERACTIVE_INPUT ) { if ( GetLastInputInterval() < 500 ) - return TRUE; + return sal_True; if ( AnyInput( INPUT_KEYBOARD ) ) - return TRUE; + return sal_True; } if ( nTest & USERACTIVE_MODALDIALOG ) { if ( ImplGetSVData()->maAppData.mnModalDialog ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -662,10 +661,10 @@ void Application::MergeSystemSettings( AllSettings& rSettings ) { // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings pWindow->ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings ); - pSVData->maAppData.mbSettingsInit = TRUE; + pSVData->maAppData.mbSettingsInit = sal_True; } // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings - pWindow->ImplUpdateGlobalSettings( rSettings, FALSE ); + pWindow->ImplUpdateGlobalSettings( rSettings, sal_False ); } } @@ -707,7 +706,7 @@ void Application::SetSettings( const AllSettings& rSettings ) } ResMgr::SetDefaultLocale( rSettings.GetUILocale() ); *pSVData->maAppData.mpSettings = rSettings; - ULONG nChangeFlags = aOldSettings.GetChangeFlags( *pSVData->maAppData.mpSettings ); + sal_uLong nChangeFlags = aOldSettings.GetChangeFlags( *pSVData->maAppData.mpSettings ); if ( nChangeFlags ) { DataChangedEvent aDCEvt( DATACHANGED_SETTINGS, &aOldSettings, nChangeFlags ); @@ -738,7 +737,7 @@ void Application::SetSettings( const AllSettings& rSettings ) Window* pClientWin = pFrame; while ( pClientWin->ImplGetClientWindow() ) pClientWin = pClientWin->ImplGetClientWindow(); - pClientWin->UpdateSettings( rSettings, TRUE ); + pClientWin->UpdateSettings( rSettings, sal_True ); Window* pTempWin = pFrame->mpWindowImpl->mpFrameData->mpFirstOverlap; while ( pTempWin ) @@ -748,7 +747,7 @@ void Application::SetSettings( const AllSettings& rSettings ) pClientWin = pTempWin; while ( pClientWin->ImplGetClientWindow() ) pClientWin = pClientWin->ImplGetClientWindow(); - pClientWin->UpdateSettings( rSettings, TRUE ); + pClientWin->UpdateSettings( rSettings, sal_True ); pTempWin = pTempWin->mpWindowImpl->mpNextOverlap; } @@ -827,7 +826,7 @@ void Application::NotifyAllWindows( DataChangedEvent& rDCEvt ) // ----------------------------------------------------------------------- -void Application::ImplCallEventListeners( ULONG nEvent, Window *pWin, void* pData ) +void Application::ImplCallEventListeners( sal_uLong nEvent, Window *pWin, void* pData ) { ImplSVData* pSVData = ImplGetSVData(); VclWindowEvent aEvent( pWin, nEvent, pData ); @@ -885,13 +884,13 @@ void Application::RemoveKeyListener( const Link& rKeyListener ) // ----------------------------------------------------------------------- -BOOL Application::HandleKey( ULONG nEvent, Window *pWin, KeyEvent* pKeyEvent ) +sal_Bool Application::HandleKey( sal_uLong nEvent, Window *pWin, KeyEvent* pKeyEvent ) { // let listeners process the key event VclWindowEvent aEvent( pWin, nEvent, (void *) pKeyEvent ); ImplSVData* pSVData = ImplGetSVData(); - BOOL bProcessed = FALSE; + sal_Bool bProcessed = sal_False; if ( pSVData->maAppData.mpKeyListeners ) bProcessed = pSVData->maAppData.mpKeyListeners->Process( &aEvent ); @@ -901,10 +900,10 @@ BOOL Application::HandleKey( ULONG nEvent, Window *pWin, KeyEvent* pKeyEvent ) // ----------------------------------------------------------------------------- -ULONG Application::PostKeyEvent( ULONG nEvent, Window *pWin, KeyEvent* pKeyEvent ) +sal_uLong Application::PostKeyEvent( sal_uLong nEvent, Window *pWin, KeyEvent* pKeyEvent ) { const SolarMutexGuard aGuard; - ULONG nEventId = 0; + sal_uLong nEventId = 0; if( pWin && pKeyEvent ) { @@ -928,10 +927,10 @@ ULONG Application::PostKeyEvent( ULONG nEvent, Window *pWin, KeyEvent* pKeyEvent // ----------------------------------------------------------------------------- -ULONG Application::PostMouseEvent( ULONG nEvent, Window *pWin, MouseEvent* pMouseEvent ) +sal_uLong Application::PostMouseEvent( sal_uLong nEvent, Window *pWin, MouseEvent* pMouseEvent ) { const SolarMutexGuard aGuard; - ULONG nEventId = 0; + sal_uLong nEventId = 0; if( pWin && pMouseEvent ) { @@ -968,8 +967,8 @@ IMPL_STATIC_LINK_NOINSTANCE( Application, PostEventHandler, void*, pCallData ) const SolarMutexGuard aGuard; ImplPostEventData* pData = static_cast< ImplPostEventData * >( pCallData ); const void* pEventData; - ULONG nEvent; - const ULONG nEventId = pData->mnEventId; + sal_uLong nEvent; + const sal_uLong nEventId = pData->mnEventId; switch( pData->mnEvent ) { @@ -1005,7 +1004,7 @@ IMPL_STATIC_LINK_NOINSTANCE( Application, PostEventHandler, void*, pCallData ) }; if( pData->mpWin && pData->mpWin->mpWindowImpl->mpFrameWindow && pEventData ) - ImplWindowFrameProc( pData->mpWin->mpWindowImpl->mpFrameWindow, NULL, (USHORT) nEvent, pEventData ); + ImplWindowFrameProc( pData->mpWin->mpWindowImpl->mpFrameWindow, NULL, (sal_uInt16) nEvent, pEventData ); // remove this event from list of posted events, watch for destruction of internal data ::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() ); @@ -1050,7 +1049,7 @@ void Application::RemoveMouseAndKeyEvents( Window* pWin ) // ----------------------------------------------------------------------- -BOOL Application::IsProcessedMouseOrKeyEvent( ULONG nEventId ) +sal_Bool Application::IsProcessedMouseOrKeyEvent( sal_uLong nEventId ) { const SolarMutexGuard aGuard; @@ -1060,79 +1059,79 @@ BOOL Application::IsProcessedMouseOrKeyEvent( ULONG nEventId ) while( aIter != aPostedEventList.end() ) { if( (*aIter).second->mnEventId == nEventId ) - return FALSE; + return sal_False; else ++aIter; } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -ULONG Application::PostUserEvent( ULONG nEvent, void* pEventData ) +sal_uLong Application::PostUserEvent( sal_uLong nEvent, void* pEventData ) { - ULONG nEventId; + sal_uLong nEventId; PostUserEvent( nEventId, nEvent, pEventData ); return nEventId; } // ----------------------------------------------------------------------- -ULONG Application::PostUserEvent( const Link& rLink, void* pCaller ) +sal_uLong Application::PostUserEvent( const Link& rLink, void* pCaller ) { - ULONG nEventId; + sal_uLong nEventId; PostUserEvent( nEventId, rLink, pCaller ); return nEventId; } // ----------------------------------------------------------------------- -BOOL Application::PostUserEvent( ULONG& rEventId, ULONG nEvent, void* pEventData ) +sal_Bool Application::PostUserEvent( sal_uLong& rEventId, sal_uLong nEvent, void* pEventData ) { ImplSVEvent* pSVEvent = new ImplSVEvent; pSVEvent->mnEvent = nEvent; pSVEvent->mpData = pEventData; pSVEvent->mpLink = NULL; pSVEvent->mpWindow = NULL; - pSVEvent->mbCall = TRUE; - rEventId = (ULONG)pSVEvent; + pSVEvent->mbCall = sal_True; + rEventId = (sal_uLong)pSVEvent; Window* pDefWindow = ImplGetDefaultWindow(); if ( pDefWindow && pDefWindow->ImplGetFrame()->PostEvent( pSVEvent ) ) - return TRUE; + return sal_True; else { rEventId = 0; delete pSVEvent; - return FALSE; + return sal_False; } } // ----------------------------------------------------------------------- -BOOL Application::PostUserEvent( ULONG& rEventId, const Link& rLink, void* pCaller ) +sal_Bool Application::PostUserEvent( sal_uLong& rEventId, const Link& rLink, void* pCaller ) { ImplSVEvent* pSVEvent = new ImplSVEvent; pSVEvent->mnEvent = 0; pSVEvent->mpData = pCaller; pSVEvent->mpLink = new Link( rLink ); pSVEvent->mpWindow = NULL; - pSVEvent->mbCall = TRUE; - rEventId = (ULONG)pSVEvent; + pSVEvent->mbCall = sal_True; + rEventId = (sal_uLong)pSVEvent; Window* pDefWindow = ImplGetDefaultWindow(); if ( pDefWindow && pDefWindow->ImplGetFrame()->PostEvent( pSVEvent ) ) - return TRUE; + return sal_True; else { rEventId = 0; delete pSVEvent; - return FALSE; + return sal_False; } } // ----------------------------------------------------------------------- -void Application::RemoveUserEvent( ULONG nUserEvent ) +void Application::RemoveUserEvent( sal_uLong nUserEvent ) { if(nUserEvent) { @@ -1150,13 +1149,13 @@ void Application::RemoveUserEvent( ULONG nUserEvent ) pSVEvent->mpWindow = NULL; } - pSVEvent->mbCall = FALSE; + pSVEvent->mbCall = sal_False; } } // ----------------------------------------------------------------------- -BOOL Application::InsertIdleHdl( const Link& rLink, USHORT nPrio ) +sal_Bool Application::InsertIdleHdl( const Link& rLink, sal_uInt16 nPrio ) { ImplSVData* pSVData = ImplGetSVData(); @@ -1438,7 +1437,7 @@ unsigned int Application::GetBestScreen( const Rectangle& i_rRect ) // ----------------------------------------------------------------------- -BOOL Application::InsertAccel( Accelerator* pAccel ) +sal_Bool Application::InsertAccel( Accelerator* pAccel ) { ImplSVData* pSVData = ImplGetSVData(); @@ -1469,17 +1468,17 @@ void Application::FlushAccel() // ----------------------------------------------------------------------- -BOOL Application::CallAccel( const KeyCode& rKeyCode, USHORT nRepeat ) +sal_Bool Application::CallAccel( const KeyCode& rKeyCode, sal_uInt16 nRepeat ) { ImplSVData* pSVData = ImplGetSVData(); if ( pSVData->maAppData.mpAccelMgr ) { if ( pSVData->maAppData.mpAccelMgr->IsAccelKey( rKeyCode, nRepeat ) ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -1498,21 +1497,21 @@ Help* Application::GetHelp() // ----------------------------------------------------------------------- -void Application::EnableAutoHelpId( BOOL bEnabled ) +void Application::EnableAutoHelpId( sal_Bool bEnabled ) { ImplGetSVData()->maHelpData.mbAutoHelpId = bEnabled; } // ----------------------------------------------------------------------- -BOOL Application::IsAutoHelpIdEnabled() +sal_Bool Application::IsAutoHelpIdEnabled() { return ImplGetSVData()->maHelpData.mbAutoHelpId; } // ----------------------------------------------------------------------- -void Application::EnableAutoMnemonic( BOOL bEnabled ) +void Application::EnableAutoMnemonic( sal_Bool bEnabled ) { AllSettings aSettings = GetSettings(); StyleSettings aStyle = aSettings.GetStyleSettings(); @@ -1523,7 +1522,7 @@ void Application::EnableAutoMnemonic( BOOL bEnabled ) // ----------------------------------------------------------------------- -BOOL Application::IsAutoMnemonicEnabled() +sal_Bool Application::IsAutoMnemonicEnabled() { return GetSettings().GetStyleSettings().GetAutoMnemonic(); } @@ -1561,7 +1560,7 @@ Window* Application::GetDefDialogParent() // #103442# find some useful dialog parent if there // was no default set // NOTE: currently even the default is not used - if( FALSE && pSVData->maWinData.mpDefDialogParent != NULL ) + if( sal_False && pSVData->maWinData.mpDefDialogParent != NULL ) return pSVData->maWinData.mpDefDialogParent; else { @@ -1625,28 +1624,28 @@ Window* Application::GetDefDialogParent() // ----------------------------------------------------------------------- -void Application::EnableDialogCancel( BOOL bDialogCancel ) +void Application::EnableDialogCancel( sal_Bool bDialogCancel ) { ImplGetSVData()->maAppData.mbDialogCancel = bDialogCancel; } // ----------------------------------------------------------------------- -BOOL Application::IsDialogCancelEnabled() +sal_Bool Application::IsDialogCancelEnabled() { return ImplGetSVData()->maAppData.mbDialogCancel; } // ----------------------------------------------------------------------- -void Application::SetSystemWindowMode( USHORT nMode ) +void Application::SetSystemWindowMode( sal_uInt16 nMode ) { ImplGetSVData()->maAppData.mnSysWinMode = nMode; } // ----------------------------------------------------------------------- -USHORT Application::GetSystemWindowMode() +sal_uInt16 Application::GetSystemWindowMode() { return ImplGetSVData()->maAppData.mnSysWinMode; } @@ -1696,7 +1695,7 @@ UniqueItemId Application::CreateUniqueId() ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > Application::GetVCLToolkit() { ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > xT; - UnoWrapperBase* pWrapper = Application::GetUnoWrapper( TRUE ); + UnoWrapperBase* pWrapper = Application::GetUnoWrapper( sal_True ); if ( pWrapper ) xT = pWrapper->GetVCLToolkit(); return xT; @@ -1706,13 +1705,13 @@ UniqueItemId Application::CreateUniqueId() extern "C" { static void SAL_CALL thisModule() {} } -UnoWrapperBase* Application::GetUnoWrapper( BOOL bCreateIfNotExist ) +UnoWrapperBase* Application::GetUnoWrapper( sal_Bool bCreateIfNotExist ) { ImplSVData* pSVData = ImplGetSVData(); - static BOOL bAlreadyTriedToCreate = FALSE; + static sal_Bool bAlreadyTriedToCreate = sal_False; if ( !pSVData->mpUnoWrapper && bCreateIfNotExist && !bAlreadyTriedToCreate ) { - ::rtl::OUString aLibName = ::vcl::unohelper::CreateLibraryName( "tk", TRUE ); + ::rtl::OUString aLibName = ::vcl::unohelper::CreateLibraryName( "tk", sal_True ); oslModule hTkLib = osl_loadModuleRelative( &thisModule, aLibName.pData, SAL_LOADMODULE_DEFAULT ); if ( hTkLib ) @@ -1725,7 +1724,7 @@ UnoWrapperBase* Application::GetUnoWrapper( BOOL bCreateIfNotExist ) } } DBG_ASSERT( pSVData->mpUnoWrapper, "UnoWrapper could not be created!" ); - bAlreadyTriedToCreate = TRUE; + bAlreadyTriedToCreate = sal_True; } return pSVData->mpUnoWrapper; } @@ -1746,9 +1745,12 @@ void Application::SetUnoWrapper( UnoWrapperBase* pWrapper ) ImplSVData* pSVData = ImplGetSVData(); if( !pSVData->mxDisplayConnection.is() ) + { pSVData->mxDisplayConnection.set( new ::vcl::DisplayConnection ); + pSVData->mxDisplayConnection->start(); + } - return pSVData->mxDisplayConnection; + return pSVData->mxDisplayConnection.get(); } // ----------------------------------------------------------------------- @@ -1767,7 +1769,7 @@ const Link& Application::GetFilterHdl() // ----------------------------------------------------------------------- -BOOL ImplCallHotKey( const KeyCode& rKeyCode ) +sal_Bool ImplCallHotKey( const KeyCode& rKeyCode ) { ImplSVData* pSVData = ImplGetSVData(); ImplHotKey* pHotKeyData = pSVData->maAppData.mpFirstHotKey; @@ -1776,13 +1778,13 @@ BOOL ImplCallHotKey( const KeyCode& rKeyCode ) if ( pHotKeyData->maKeyCode.IsDefinedKeyCodeEqual( rKeyCode ) ) { pHotKeyData->maLink.Call( pHotKeyData->mpUserData ); - return TRUE; + return sal_True; } pHotKeyData = pHotKeyData->mpNext; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -1804,7 +1806,7 @@ void ImplFreeHotKeyData() // ----------------------------------------------------------------------- -ULONG Application::AddHotKey( const KeyCode& rKeyCode, const Link& rLink, void* pData ) +sal_uIntPtr Application::AddHotKey( const KeyCode& rKeyCode, const Link& rLink, void* pData ) { ImplSVData* pSVData = ImplGetSVData(); ImplHotKey* pHotKeyData = new ImplHotKey; @@ -1813,12 +1815,12 @@ ULONG Application::AddHotKey( const KeyCode& rKeyCode, const Link& rLink, void* pHotKeyData->maLink = rLink; pHotKeyData->mpNext = pSVData->maAppData.mpFirstHotKey; pSVData->maAppData.mpFirstHotKey = pHotKeyData; - return (ULONG)pHotKeyData; + return (sal_uIntPtr)pHotKeyData; } // ----------------------------------------------------------------------- -void Application::RemoveHotKey( ULONG nId ) +void Application::RemoveHotKey( sal_uIntPtr nId ) { ImplSVData* pSVData = ImplGetSVData(); ImplHotKey* pFindHotKeyData = (ImplHotKey*)nId; @@ -1862,7 +1864,7 @@ void ImplFreeEventHookData() // ----------------------------------------------------------------------- -ULONG Application::AddEventHook( VCLEventHookProc pProc, void* pData ) +sal_uIntPtr Application::AddEventHook( VCLEventHookProc pProc, void* pData ) { ImplSVData* pSVData = ImplGetSVData(); ImplEventHook* pEventHookData = new ImplEventHook; @@ -1870,12 +1872,12 @@ ULONG Application::AddEventHook( VCLEventHookProc pProc, void* pData ) pEventHookData->mpProc = pProc; pEventHookData->mpNext = pSVData->maAppData.mpFirstEventHook; pSVData->maAppData.mpFirstEventHook = pEventHookData; - return (ULONG)pEventHookData; + return (sal_uIntPtr)pEventHookData; } // ----------------------------------------------------------------------- -void Application::RemoveEventHook( ULONG nId ) +void Application::RemoveEventHook( sal_uIntPtr nId ) { ImplSVData* pSVData = ImplGetSVData(); ImplEventHook* pFindEventHookData = (ImplEventHook*)nId; @@ -1943,14 +1945,14 @@ const LocaleDataWrapper& Application::GetAppLocaleDataWrapper() // ----------------------------------------------------------------------- -void Application::EnableHeadlessMode( BOOL bEnable ) +void Application::EnableHeadlessMode( sal_Bool bEnable ) { EnableDialogCancel( bEnable ); } // ----------------------------------------------------------------------- -BOOL Application::IsHeadlessModeEnabled() +sal_Bool Application::IsHeadlessModeEnabled() { return IsDialogCancelEnabled(); } @@ -2011,14 +2013,14 @@ void Application::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const r pSVData->mpDefInst->AddToRecentDocumentList(rFileUrl, rMimeType); } -BOOL Application::IsAccessibilityEnabled() +sal_Bool Application::IsAccessibilityEnabled() { - return FALSE; + return sal_False; } -BOOL InitAccessBridge( BOOL bShowCancel, BOOL &rCancelled ) +sal_Bool InitAccessBridge( sal_Bool bShowCancel, sal_Bool &rCancelled ) { - BOOL bRet = true; + sal_Bool bRet = true; // Disable Java bridge on UNIX #if defined UNX @@ -2032,7 +2034,7 @@ BOOL InitAccessBridge( BOOL bShowCancel, BOOL &rCancelled ) // disable accessibility if the user chooses to continue AllSettings aSettings = Application::GetSettings(); MiscSettings aMisc = aSettings.GetMiscSettings(); - aMisc.SetEnableATToolSupport( FALSE ); + aMisc.SetEnableATToolSupport( sal_False ); aSettings.SetMiscSettings( aMisc ); Application::SetSettings( aSettings ); } diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index b21ee99b777e..ee46f14acae0 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -28,45 +28,54 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" + #include <string.h> #include <boost/ptr_container/ptr_vector.hpp> -#include <svsys.h> -#include <vcl/salinst.hxx> -#include <vcl/salframe.hxx> - -#include <osl/mutex.hxx> - -#include <osl/process.h> #include <osl/file.hxx> -#include <uno/current_context.hxx> -#include <cppuhelper/implbase1.hxx> -#include <tools/debug.hxx> -#include <unotools/fontcfg.hxx> -#include <vcl/configsettings.hxx> -#include <vcl/svdata.hxx> -#include <vcl/window.h> -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/unohelp.hxx> -#include <vcl/button.hxx> // for Button::GetStandardText -#include <vcl/dockwin.hxx> // for DockingManager -#include <vcl/salimestatus.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/awt/XExtendedToolkit.hpp> -#include <com/sun/star/java/JavaNotConfiguredException.hpp> -#include <com/sun/star/java/JavaVMCreationFailureException.hpp> -#include <com/sun/star/java/MissingJavaRuntimeException.hpp> -#include <com/sun/star/java/JavaDisabledException.hpp> - -#include <com/sun/star/lang/XComponent.hpp> +#include <osl/mutex.hxx> +#include <rtl/process.h> + +#include "tools/debug.hxx" +#include "tools/resary.hxx" + +#include "vcl/salinst.hxx" +#include "vcl/salframe.hxx" +#include "vcl/configsettings.hxx" +#include "vcl/svdata.hxx" +#include "vcl/window.h" +#include "vcl/svapp.hxx" +#include "vcl/wrkwin.hxx" +#include "vcl/msgbox.hxx" +#include "vcl/unohelp.hxx" +#include "vcl/button.hxx" // for Button::GetStandardText +#include "vcl/dockwin.hxx" // for DockingManager +#include "vcl/salimestatus.hxx" +#include "vcl/salsys.hxx" +#include "vcl/svids.hrc" +#include "vcl/xconnection.hxx" + +#include "unotools/fontcfg.hxx" + +#include "cppuhelper/implbase1.hxx" +#include "uno/current_context.hxx" + +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/awt/XExtendedToolkit.hpp" +#include "com/sun/star/java/JavaNotConfiguredException.hpp" +#include "com/sun/star/java/JavaVMCreationFailureException.hpp" +#include "com/sun/star/java/MissingJavaRuntimeException.hpp" +#include "com/sun/star/java/JavaDisabledException.hpp" #include <stdio.h> -#include <vcl/salsys.hxx> -#include <vcl/svids.hrc> -#include <rtl/instance.hxx> + +namespace { + +namespace css = com::sun::star; + +} using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -126,6 +135,9 @@ void ImplInitSVData() break; } } + + // mark default layout border as unitialized + pImplSVData->maAppData.mnDefaultLayoutBorder = -1; } // ----------------------------------------------------------------------- @@ -161,6 +173,13 @@ void ImplDeInitSVData() delete pSVData->maAppData.mpMSFTempFileName; pSVData->maAppData.mpMSFTempFileName = NULL; } + + if( pSVData->maCtrlData.mpFieldUnitStrings ) + delete pSVData->maCtrlData.mpFieldUnitStrings, pSVData->maCtrlData.mpFieldUnitStrings = NULL; + if( pSVData->maCtrlData.mpCleanUnitStrings ) + delete pSVData->maCtrlData.mpCleanUnitStrings, pSVData->maCtrlData.mpCleanUnitStrings = NULL; + if( pSVData->mpPaperNames ) + delete pSVData->mpPaperNames, pSVData->mpPaperNames = NULL; } // ----------------------------------------------------------------------- @@ -238,6 +257,52 @@ ResId VclResId( sal_Int32 nId ) return ResId( nId, *pMgr ); } +FieldUnitStringList* ImplGetFieldUnits() +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->maCtrlData.mpFieldUnitStrings ) + { + ResMgr* pResMgr = ImplGetResMgr(); + if( pResMgr ) + { + ResStringArray aUnits( ResId (SV_FUNIT_STRINGS, *pResMgr) ); + sal_uInt32 nUnits = aUnits.Count(); + pSVData->maCtrlData.mpFieldUnitStrings = new FieldUnitStringList(); + pSVData->maCtrlData.mpFieldUnitStrings->reserve( nUnits ); + for( sal_uInt32 i = 0; i < nUnits; i++ ) + { + std::pair< String, FieldUnit > aElement( aUnits.GetString(i), static_cast<FieldUnit>(aUnits.GetValue(i)) ); + pSVData->maCtrlData.mpFieldUnitStrings->push_back( aElement ); + } + } + } + return pSVData->maCtrlData.mpFieldUnitStrings; +} + +FieldUnitStringList* ImplGetCleanedFieldUnits() +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->maCtrlData.mpCleanUnitStrings ) + { + FieldUnitStringList* pUnits = ImplGetFieldUnits(); + if( pUnits ) + { + size_t nUnits = pUnits->size(); + pSVData->maCtrlData.mpCleanUnitStrings = new FieldUnitStringList(); + pSVData->maCtrlData.mpCleanUnitStrings->reserve( nUnits ); + for( size_t i = 0; i < nUnits; i++ ) + { + String aUnit( (*pUnits)[i].first ); + aUnit.EraseAllChars( sal_Unicode( ' ' ) ); + aUnit.ToLowerAscii(); + std::pair< String, FieldUnit > aElement( aUnit, (*pUnits)[i].second ); + pSVData->maCtrlData.mpCleanUnitStrings->push_back( aElement ); + } + } + } + return pSVData->maCtrlData.mpCleanUnitStrings; +} + DockingManager* ImplGetDockingManager() { ImplSVData* pSVData = ImplGetSVData(); @@ -279,16 +344,16 @@ com::sun::star::uno::Any AccessBridgeCurrentContext::getValueByName( const rtl:: } -bool ImplInitAccessBridge(BOOL bAllowCancel, BOOL &rCancelled) +bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) { - rCancelled = FALSE; + rCancelled = sal_False; bool bErrorMessage = true; // Note: - // if bAllowCancel is TRUE we were called from application startup + // if bAllowCancel is sal_True we were called from application startup // where we will disable any Java errorboxes and show our own accessibility dialog if Java throws an exception - // if bAllowCancel is FALSE we were called from Tools->Options + // if bAllowCancel is sal_False we were called from Tools->Options // where we will see Java errorboxes, se we do not show our dialogs in addition to Java's try @@ -305,12 +370,12 @@ bool ImplInitAccessBridge(BOOL bAllowCancel, BOOL &rCancelled) ImplSVData* pSVData = ImplGetSVData(); if( ! pSVData->mxAccessBridge.is() ) { - Reference< XMultiServiceFactory > xFactory(vcl::unohelper::GetMultiServiceFactory()); + css::uno::Reference< XMultiServiceFactory > xFactory(vcl::unohelper::GetMultiServiceFactory()); if( xFactory.is() ) { - Reference< XExtendedToolkit > xToolkit = - Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY); + css::uno::Reference< XExtendedToolkit > xToolkit = + css::uno::Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY); Sequence< Any > arguments(1); arguments[0] = makeAny(xToolkit); @@ -365,7 +430,7 @@ bool ImplInitAccessBridge(BOOL bAllowCancel, BOOL &rCancelled) // Do not change the setting in case the user chooses to cancel if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret ) - rCancelled = TRUE; + rCancelled = sal_True; } return false; @@ -390,7 +455,7 @@ bool ImplInitAccessBridge(BOOL bAllowCancel, BOOL &rCancelled) // Do not change the setting in case the user chooses to cancel if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret ) - rCancelled = TRUE; + rCancelled = sal_True; } return false; @@ -415,7 +480,7 @@ bool ImplInitAccessBridge(BOOL bAllowCancel, BOOL &rCancelled) // Do not change the setting in case the user chooses to cancel if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret ) - rCancelled = TRUE; + rCancelled = sal_True; } return false; @@ -440,7 +505,7 @@ bool ImplInitAccessBridge(BOOL bAllowCancel, BOOL &rCancelled) // Do not change the setting in case the user chooses to cancel if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret ) - rCancelled = TRUE; + rCancelled = sal_True; } return false; @@ -482,7 +547,7 @@ bool ImplInitAccessBridge(BOOL bAllowCancel, BOOL &rCancelled) // Do not change the setting in case the user chooses to cancel if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret ) - rCancelled = TRUE; + rCancelled = sal_True; } else { diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 37091c86e62a..cc1ccc45facf 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -90,11 +90,8 @@ #include "rtl/strbuf.hxx" #endif -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; - - +using ::rtl::OUString; +using namespace ::com::sun::star; // ======================================================================= @@ -165,27 +162,23 @@ int ImplSVMain() DBG_ASSERT( pSVData->mpApp, "no instance of class Application" ); - Reference<XMultiServiceFactory> xMS; + uno::Reference<lang::XMultiServiceFactory> xMS; int nReturn = EXIT_FAILURE; - BOOL bInit = InitVCL( xMS ); + sal_Bool bInit = InitVCL( xMS ); if( bInit ) { // Application-Main rufen - pSVData->maAppData.mbInAppMain = TRUE; + pSVData->maAppData.mbInAppMain = sal_True; nReturn = pSVData->mpApp->Main(); - pSVData->maAppData.mbInAppMain = FALSE; + pSVData->maAppData.mbInAppMain = sal_False; } if( pSVData->mxDisplayConnection.is() ) { - vcl::DisplayConnection* pConnection = - dynamic_cast<vcl::DisplayConnection*>(pSVData->mxDisplayConnection.get()); - - if( pConnection ) - pConnection->dispatchDowningEvent(); + pSVData->mxDisplayConnection->terminate(); pSVData->mxDisplayConnection.clear(); } @@ -194,10 +187,10 @@ int ImplSVMain() // be some events in the AWT EventQueue, which need the SolarMutex which // - on the other hand - is destroyed in DeInitVCL(). So empty the queue // here .. - Reference< XComponent > xComponent(pSVData->mxAccessBridge, UNO_QUERY); + uno::Reference< lang::XComponent > xComponent(pSVData->mxAccessBridge, uno::UNO_QUERY); if( xComponent.is() ) { - ULONG nCount = Application::ReleaseSolarMutex(); + sal_uLong nCount = Application::ReleaseSolarMutex(); xComponent->dispose(); Application::AcquireSolarMutex(nCount); pSVData->mxAccessBridge.clear(); @@ -210,7 +203,7 @@ int ImplSVMain() int SVMain() { // #i47888# allow for alternative initialization as required for e.g. MacOSX - extern BOOL ImplSVMainHook( int* ); + extern sal_Bool ImplSVMainHook( int* ); int nRet; if( ImplSVMainHook( &nRet ) ) @@ -244,13 +237,13 @@ private: com::sun::star::uno::Reference< com::sun::star::uno::XCurrentContext > m_xNextContext; }; -Any SAL_CALL DesktopEnvironmentContext::getValueByName( const rtl::OUString& Name) throw (RuntimeException) +uno::Any SAL_CALL DesktopEnvironmentContext::getValueByName( const rtl::OUString& Name) throw (uno::RuntimeException) { - Any retVal; + uno::Any retVal; if (Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("system.desktop-environment"))) { - retVal = makeAny( Application::GetDesktopEnvironment() ); + retVal = uno::makeAny( Application::GetDesktopEnvironment() ); } else if( m_xNextContext.is() ) { @@ -260,12 +253,12 @@ Any SAL_CALL DesktopEnvironmentContext::getValueByName( const rtl::OUString& Nam return retVal; } -BOOL InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) +sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) { RTL_LOGFILE_CONTEXT( aLog, "vcl (ss112471) ::InitVCL" ); if( pExceptionHandler != NULL ) - return FALSE; + return sal_False; if( ! ImplGetSVData() ) ImplInitSVData(); @@ -294,7 +287,7 @@ BOOL InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XM RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ ::CreateSalInstance" ); pSVData->mpDefInst = CreateSalInstance(); if ( !pSVData->mpDefInst ) - return FALSE; + return sal_False; RTL_LOGFILE_CONTEXT_TRACE( aLog, "} ::CreateSalInstance" ); // Desktop Environment context (to be able to get value of "system.desktop-environment" as soon as possible) @@ -319,7 +312,7 @@ BOOL InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XM // Initialize global data pSVData->maGDIData.mpScreenFontList = new ImplDevFontList; - pSVData->maGDIData.mpScreenFontCache = new ImplFontCache( FALSE ); + pSVData->maGDIData.mpScreenFontCache = new ImplFontCache( sal_False ); pSVData->maGDIData.mpGrfConverter = new GraphicConverter; // Exception-Handler setzen @@ -328,7 +321,7 @@ BOOL InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XM // Debug-Daten initialisieren DBGGUI_INIT(); - return TRUE; + return sal_True; } namespace @@ -341,12 +334,12 @@ namespace */ class VCLUnoWrapperDeleter : public cppu::WeakImplHelper1<com::sun::star::lang::XEventListener> { - virtual void SAL_CALL disposing(EventObject const& rSource) throw(RuntimeException); + virtual void SAL_CALL disposing(lang::EventObject const& rSource) throw(uno::RuntimeException); }; void -VCLUnoWrapperDeleter::disposing(EventObject const& /* rSource */) - throw(RuntimeException) +VCLUnoWrapperDeleter::disposing(lang::EventObject const& /* rSource */) + throw(uno::RuntimeException) { ImplSVData* const pSVData = ImplGetSVData(); if (pSVData && pSVData->mpUnoWrapper) @@ -361,7 +354,7 @@ VCLUnoWrapperDeleter::disposing(EventObject const& /* rSource */) void DeInitVCL() { ImplSVData* pSVData = ImplGetSVData(); - pSVData->mbDeInit = TRUE; + pSVData->mbDeInit = sal_True; vcl::DeleteOnDeinitBase::ImplDeleteOnDeInit(); @@ -475,14 +468,14 @@ void DeInitVCL() { try { - Reference<XComponent> const xDesktop( + uno::Reference<lang::XComponent> const xDesktop( comphelper::createProcessComponent( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), - UNO_QUERY_THROW) + uno::UNO_QUERY_THROW) ; xDesktop->addEventListener(new VCLUnoWrapperDeleter()); } - catch (Exception const&) + catch (uno::Exception const&) { // ignore } diff --git a/vcl/source/app/svmainhook.cxx b/vcl/source/app/svmainhook.cxx index 725f90f05dc1..dd446125a7aa 100644 --- a/vcl/source/app/svmainhook.cxx +++ b/vcl/source/app/svmainhook.cxx @@ -32,9 +32,9 @@ #ifndef MACOSX -BOOL ImplSVMainHook( int * ) +sal_Bool ImplSVMainHook( int * ) { - return FALSE; // indicate that ImplSVMainHook is not implemented + return sal_False; // indicate that ImplSVMainHook is not implemented } #else @@ -46,7 +46,7 @@ BOOL ImplSVMainHook( int * ) #include <postmac.h> #include <unistd.h> -extern BOOL ImplSVMain(); +extern sal_Bool ImplSVMain(); // ============================================================================ @@ -76,7 +76,7 @@ static void RunSVMain(void *pData) _exit( 0 ); } -BOOL ImplSVMainHook( int *pnInit ) +sal_Bool ImplSVMainHook( int *pnInit ) { // Mac OS X requires that any Cocoa code have a CFRunLoop started in the // primordial thread. Since all of the AWT classes in Java 1.4 and higher @@ -110,7 +110,7 @@ BOOL ImplSVMainHook( int *pnInit ) osl_joinWithThread( hThreadID ); osl_destroyThread( hThreadID ); - return TRUE; // indicate that ImplSVMainHook is implemented + return sal_True; // indicate that ImplSVMainHook is implemented } #endif // MACOSX diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx index d83c11e4f270..6c2d08b18659 100644 --- a/vcl/source/app/timer.cxx +++ b/vcl/source/app/timer.cxx @@ -42,7 +42,7 @@ // ======================================================================= -#define MAX_TIMER_PERIOD ((ULONG)0xFFFFFFFF) +#define MAX_TIMER_PERIOD ((sal_uLong)0xFFFFFFFF) // --------------------- // - TimeManager-Types - @@ -52,10 +52,10 @@ struct ImplTimerData { ImplTimerData* mpNext; // Pointer to the next Instance Timer* mpSVTimer; // Pointer to SV Timer instance - ULONG mnUpdateTime; // Last Update Time - ULONG mnTimerUpdate; // TimerCallbackProcs on stack - BOOL mbDelete; // Wurde Timer waehren Update() geloescht - BOOL mbInTimeout; // Befinden wir uns im Timeout-Handler + sal_uLong mnUpdateTime; // Last Update Time + sal_uLong mnTimerUpdate; // TimerCallbackProcs on stack + sal_Bool mbDelete; // Wurde Timer waehren Update() geloescht + sal_Bool mbInTimeout; // Befinden wir uns im Timeout-Handler }; // ======================================================================= @@ -72,7 +72,7 @@ void Timer::ImplDeInitTimer() ImplTimerData* pTempTimerData = pTimerData; if ( pTimerData->mpSVTimer ) { - pTimerData->mpSVTimer->mbActive = FALSE; + pTimerData->mpSVTimer->mbActive = sal_False; pTimerData->mpSVTimer->mpTimerData = NULL; } pTimerData = pTimerData->mpNext; @@ -89,7 +89,7 @@ void Timer::ImplDeInitTimer() // ----------------------------------------------------------------------- -static void ImplStartTimer( ImplSVData* pSVData, ULONG nMS ) +static void ImplStartTimer( ImplSVData* pSVData, sal_uLong nMS ) { if ( !nMS ) nMS = 1; @@ -108,15 +108,15 @@ void Timer::ImplTimerCallbackProc() ImplSVData* pSVData = ImplGetSVData(); ImplTimerData* pTimerData; ImplTimerData* pPrevTimerData; - ULONG nMinPeriod = MAX_TIMER_PERIOD; - ULONG nDeltaTime; - ULONG nTime = Time::GetSystemTicks(); + sal_uLong nMinPeriod = MAX_TIMER_PERIOD; + sal_uLong nDeltaTime; + sal_uLong nTime = Time::GetSystemTicks(); if ( pSVData->mbNoCallTimer ) return; pSVData->mnTimerUpdate++; - pSVData->mbNotAllTimerCalled = TRUE; + pSVData->mbNotAllTimerCalled = sal_True; // Suche Timer raus, wo der Timeout-Handler gerufen werden muss pTimerData = pSVData->mpFirstTimerData; @@ -137,14 +137,14 @@ void Timer::ImplTimerCallbackProc() // kein AutoTimer, dann anhalten if ( !pTimerData->mpSVTimer->mbAuto ) { - pTimerData->mpSVTimer->mbActive = FALSE; - pTimerData->mbDelete = TRUE; + pTimerData->mpSVTimer->mbActive = sal_False; + pTimerData->mbDelete = sal_True; } // call Timeout - pTimerData->mbInTimeout = TRUE; + pTimerData->mbInTimeout = sal_True; pTimerData->mpSVTimer->Timeout(); - pTimerData->mbInTimeout = FALSE; + pTimerData->mbInTimeout = sal_False; } } @@ -152,7 +152,7 @@ void Timer::ImplTimerCallbackProc() } // Neue Zeit ermitteln - ULONG nNewTime = Time::GetSystemTicks(); + sal_uLong nNewTime = Time::GetSystemTicks(); pPrevTimerData = NULL; pTimerData = pSVData->mpFirstTimerData; while ( pTimerData ) @@ -213,7 +213,7 @@ void Timer::ImplTimerCallbackProc() ImplStartTimer( pSVData, nMinPeriod ); pSVData->mnTimerUpdate--; - pSVData->mbNotAllTimerCalled = FALSE; + pSVData->mbNotAllTimerCalled = sal_False; } // ======================================================================= @@ -222,8 +222,8 @@ Timer::Timer() { mpTimerData = NULL; mnTimeout = 1; - mbAuto = FALSE; - mbActive = FALSE; + mbAuto = sal_False; + mbActive = sal_False; } // ----------------------------------------------------------------------- @@ -232,8 +232,8 @@ Timer::Timer( const Timer& rTimer ) { mpTimerData = NULL; mnTimeout = rTimer.mnTimeout; - mbAuto = FALSE; - mbActive = FALSE; + mbAuto = sal_False; + mbActive = sal_False; maTimeoutHdl = rTimer.maTimeoutHdl; if ( rTimer.IsActive() ) @@ -246,7 +246,7 @@ Timer::~Timer() { if ( mpTimerData ) { - mpTimerData->mbDelete = TRUE; + mpTimerData->mbDelete = sal_True; mpTimerData->mpSVTimer = NULL; } } @@ -260,7 +260,7 @@ void Timer::Timeout() // ----------------------------------------------------------------------- -void Timer::SetTimeout( ULONG nNewTimeout ) +void Timer::SetTimeout( sal_uLong nNewTimeout ) { mnTimeout = nNewTimeout; @@ -277,7 +277,7 @@ void Timer::SetTimeout( ULONG nNewTimeout ) void Timer::Start() { - mbActive = TRUE; + mbActive = sal_True; ImplSVData* pSVData = ImplGetSVData(); if ( !mpTimerData ) @@ -297,8 +297,8 @@ void Timer::Start() mpTimerData->mpSVTimer = this; mpTimerData->mnUpdateTime = Time::GetSystemTicks(); mpTimerData->mnTimerUpdate = pSVData->mnTimerUpdate; - mpTimerData->mbDelete = FALSE; - mpTimerData->mbInTimeout = FALSE; + mpTimerData->mbDelete = sal_False; + mpTimerData->mbInTimeout = sal_False; // !!!!! Wegen SFX hinten einordnen !!!!! ImplTimerData* pPrev = NULL; @@ -325,7 +325,7 @@ void Timer::Start() { mpTimerData->mnUpdateTime = Time::GetSystemTicks(); mpTimerData->mnTimerUpdate = pSVData->mnTimerUpdate; - mpTimerData->mbDelete = FALSE; + mpTimerData->mbDelete = sal_False; } } @@ -333,10 +333,10 @@ void Timer::Start() void Timer::Stop() { - mbActive = FALSE; + mbActive = sal_False; if ( mpTimerData ) - mpTimerData->mbDelete = TRUE; + mpTimerData->mbDelete = sal_True; } // ----------------------------------------------------------------------- @@ -346,7 +346,7 @@ Timer& Timer::operator=( const Timer& rTimer ) if ( IsActive() ) Stop(); - mbActive = FALSE; + mbActive = sal_False; mnTimeout = rTimer.mnTimeout; maTimeoutHdl = rTimer.maTimeoutHdl; @@ -360,14 +360,14 @@ Timer& Timer::operator=( const Timer& rTimer ) AutoTimer::AutoTimer() { - mbAuto = TRUE; + mbAuto = sal_True; } // ----------------------------------------------------------------------- AutoTimer::AutoTimer( const AutoTimer& rTimer ) : Timer( rTimer ) { - mbAuto = TRUE; + mbAuto = sal_True; } // ----------------------------------------------------------------------- diff --git a/vcl/source/app/unohelp2.cxx b/vcl/source/app/unohelp2.cxx index 0640d9cfbc49..1fe4158433a0 100644 --- a/vcl/source/app/unohelp2.cxx +++ b/vcl/source/app/unohelp2.cxx @@ -85,7 +85,7 @@ namespace vcl { namespace unohelper { { uno::Any aAny; - ULONG nT = SotExchange::GetFormat( rFlavor ); + sal_uLong nT = SotExchange::GetFormat( rFlavor ); if ( nT == SOT_FORMAT_STRING ) { aAny <<= (::rtl::OUString)GetString(); @@ -106,7 +106,7 @@ namespace vcl { namespace unohelper { sal_Bool TextDataObject::isDataFlavorSupported( const datatransfer::DataFlavor& rFlavor ) throw(uno::RuntimeException) { - ULONG nT = SotExchange::GetFormat( rFlavor ); + sal_uLong nT = SotExchange::GetFormat( rFlavor ); return ( nT == SOT_FORMAT_STRING ); } diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx index 705eebf93aee..f7614c99046b 100644 --- a/vcl/source/app/vclevent.cxx +++ b/vcl/source/app/vclevent.cxx @@ -41,7 +41,7 @@ TYPEINIT0(VclSimpleEvent); TYPEINIT1(VclWindowEvent, VclSimpleEvent); TYPEINIT1(VclMenuEvent, VclSimpleEvent); -VclAccessibleEvent::VclAccessibleEvent( ULONG n, const Reference<XAccessible>& rxAccessible ) : +VclAccessibleEvent::VclAccessibleEvent( sal_uLong n, const Reference<XAccessible>& rxAccessible ) : VclSimpleEvent(n), mxAccessible(rxAccessible) { @@ -84,12 +84,12 @@ void VclEventListeners::Call( VclSimpleEvent* pEvent ) const } } -BOOL VclEventListeners::Process( VclSimpleEvent* pEvent ) const +sal_Bool VclEventListeners::Process( VclSimpleEvent* pEvent ) const { if ( m_aListeners.empty() ) - return FALSE; + return sal_False; - BOOL bProcessed = FALSE; + sal_Bool bProcessed = sal_False; // Copy the list, because this can be destroyed when calling a Link... std::list<Link> aCopy( m_aListeners ); std::list<Link>::iterator aIter( aCopy.begin() ); @@ -97,7 +97,7 @@ BOOL VclEventListeners::Process( VclSimpleEvent* pEvent ) const { if( (*aIter).Call( pEvent ) != 0 ) { - bProcessed = TRUE; + bProcessed = sal_True; break; } aIter++; diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index 69be4002928f..9325c047b5d7 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -59,6 +59,10 @@ extern Sequence< OUString > SAL_CALL FontIdentificator_getSupportedServiceNames( extern OUString SAL_CALL FontIdentificator_getImplementationName(); extern Reference< XInterface > SAL_CALL FontIdentificator_createInstance( const Reference< XMultiServiceFactory > & ); +extern Sequence< OUString > SAL_CALL StringMirror_getSupportedServiceNames(); +extern OUString SAL_CALL StringMirror_getImplementationName(); +extern Reference< XInterface > SAL_CALL StringMirror_createInstance( const Reference< XMultiServiceFactory > & ); + extern Sequence< OUString > SAL_CALL Clipboard_getSupportedServiceNames(); extern OUString SAL_CALL Clipboard_getImplementationName(); extern Reference< XSingleServiceFactory > SAL_CALL Clipboard_createFactory( const Reference< XMultiServiceFactory > & ); @@ -81,62 +85,6 @@ extern "C" { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - VCL_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pXUnoKey ) - { - if( pXUnoKey ) - { - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey( reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( pXUnoKey ) ); - - OUStringBuffer aImplName(64); - aImplName.appendAscii( "/" ); - aImplName.append( vcl_session_getImplementationName() ); - aImplName.appendAscii( "/UNO/SERVICES/" ); - aImplName.append( vcl_session_getSupportedServiceNames()[0] ); - xKey->createKey( aImplName.makeStringAndClear() ); - - aImplName.appendAscii( "/" ); - aImplName.append( vcl::DisplayAccess_getImplementationName() ); - aImplName.appendAscii( "/UNO/SERVICES/" ); - aImplName.append( vcl::DisplayAccess_getSupportedServiceNames()[0] ); - xKey->createKey( aImplName.makeStringAndClear() ); - - aImplName.appendAscii( "/" ); - aImplName.append( vcl::FontIdentificator_getImplementationName() ); - aImplName.appendAscii( "/UNO/SERVICES/" ); - aImplName.append( vcl::FontIdentificator_getSupportedServiceNames()[0] ); - xKey->createKey( aImplName.makeStringAndClear() ); - - #if defined UNX - aImplName.appendAscii( "/" ); - aImplName.append( vcl::Clipboard_getImplementationName() ); - aImplName.appendAscii( "/UNO/SERVICES/" ); - aImplName.append( vcl::Clipboard_getSupportedServiceNames()[0] ); - xKey->createKey( aImplName.makeStringAndClear() ); - - aImplName.appendAscii( "/" ); - aImplName.append( vcl::DragSource_getImplementationName() ); - aImplName.appendAscii( "/UNO/SERVICES/" ); - aImplName.append( vcl::DragSource_getSupportedServiceNames()[0] ); - xKey->createKey( aImplName.makeStringAndClear() ); - - aImplName.appendAscii( "/" ); - aImplName.append( vcl::DropTarget_getImplementationName() ); - aImplName.appendAscii( "/UNO/SERVICES/" ); - aImplName.append( vcl::DropTarget_getSupportedServiceNames()[0] ); - xKey->createKey( aImplName.makeStringAndClear() ); - #endif - - return sal_True; - } - catch( ::com::sun::star::registry::InvalidRegistryException& ) - { - } - } - return sal_False; - } - VCL_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pXUnoSMgr, @@ -169,6 +117,12 @@ extern "C" { xMgr, vcl::FontIdentificator_getImplementationName(), vcl::FontIdentificator_createInstance, vcl::FontIdentificator_getSupportedServiceNames() ); } + else if( vcl::StringMirror_getImplementationName().equalsAscii( pImplementationName ) ) + { + xFactory = ::cppu::createSingleFactory( + xMgr, vcl::StringMirror_getImplementationName(), vcl::StringMirror_createInstance, + vcl::StringMirror_getSupportedServiceNames() ); + } else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) ) { xFactory = vcl::Clipboard_createFactory( xMgr ); diff --git a/vcl/source/components/makefile.mk b/vcl/source/components/makefile.mk index e30975dbc099..982687104c01 100644 --- a/vcl/source/components/makefile.mk +++ b/vcl/source/components/makefile.mk @@ -39,9 +39,10 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- -SLOFILES= $(SLO)$/display.obj \ - $(SLO)$/dtranscomp.obj \ - $(SLO)$/fontident.obj \ +SLOFILES= $(SLO)$/display.obj \ + $(SLO)$/dtranscomp.obj \ + $(SLO)$/fontident.obj \ + $(SLO)$/stringmirror.obj \ $(SLO)$/factory.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/source/components/stringmirror.cxx b/vcl/source/components/stringmirror.cxx new file mode 100644 index 000000000000..78806914a7c4 --- /dev/null +++ b/vcl/source/components/stringmirror.cxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/util/XStringMapping.hpp" + +#include "cppuhelper/implbase2.hxx" +#include "rtl/ustrbuf.hxx" +#include "vcl/svapp.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::util; + +// ----------------------------------------------------------------------- + +namespace vcl +{ + +class StringMirror : public ::cppu::WeakAggImplHelper2< XStringMapping, XServiceInfo > +{ +public: + StringMirror() + {} + + virtual ~StringMirror() + {} + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const OUString& ) throw (RuntimeException); + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); + + // XStringMapping + virtual sal_Bool SAL_CALL mapStrings( Sequence< OUString >& io_rStrings ) throw (RuntimeException) + { + sal_Int32 nItems = io_rStrings.getLength(); + for( sal_Int32 n = 0; n < nItems; n++ ) + { + rtl::OUString& rStr( io_rStrings.getArray()[n] ); + + sal_Int32 nLen = rStr.getLength(); + rtl::OUStringBuffer aMirror( nLen ); + for(sal_Int32 i = nLen - 1; i >= 0; i--) + { + sal_Unicode cChar = rStr[ i ]; + aMirror.append(sal_Unicode(GetMirroredChar(cChar))); + } + rStr = aMirror.makeStringAndClear(); + } + return sal_True; + } +}; + +Sequence< OUString > StringMirror_getSupportedServiceNames() +{ + static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.StringMirror" ) ); + static Sequence< OUString > aServiceNames( &aServiceName, 1 ); + return aServiceNames; +} + +OUString StringMirror_getImplementationName() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "vcl::StringMirror" ) ); +} + +Reference< XInterface > SAL_CALL StringMirror_createInstance( const Reference< XMultiServiceFactory >& ) +{ + return static_cast< ::cppu::OWeakObject * >( new StringMirror ); +} + + +// XServiceInfo +OUString SAL_CALL StringMirror::getImplementationName() throw (RuntimeException) +{ + return StringMirror_getImplementationName(); +} + +sal_Bool SAL_CALL StringMirror::supportsService( const OUString& i_rServiceName ) throw (RuntimeException) +{ + Sequence< OUString > aSN( StringMirror_getSupportedServiceNames() ); + for( sal_Int32 nService = 0; nService < aSN.getLength(); nService++ ) + { + if( aSN[nService] == i_rServiceName ) + return sal_True; + } + return sal_False; +} + +Sequence< OUString > SAL_CALL StringMirror::getSupportedServiceNames() throw (RuntimeException) +{ + return StringMirror_getSupportedServiceNames(); +} + +} // namespace vcl diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 962ad4553a29..7efaf732da34 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -77,8 +77,8 @@ class ImplCommonButtonData public: Rectangle maFocusRect; Rectangle maSymbolRect; - USHORT mnButtonState; - BOOL mbSmallSymbol; + sal_uInt16 mnButtonState; + sal_Bool mbSmallSymbol; Image maImage; BitmapEx* mpBitmapEx; @@ -94,7 +94,7 @@ public: ImplCommonButtonData::ImplCommonButtonData() { mnButtonState = 0; - mbSmallSymbol = FALSE; + mbSmallSymbol = sal_False; mpBitmapEx = NULL; meImageAlign = IMAGEALIGN_TOP; @@ -180,12 +180,12 @@ XubString Button::GetStandardText( StandardButtonType eButton ) ResMgr* pResMgr = ImplGetResMgr(); if( pResMgr ) { - ResId aResId( aResIdAry[(USHORT)eButton].nResId, *pResMgr ); + ResId aResId( aResIdAry[(sal_uInt16)eButton].nResId, *pResMgr ); aText = String( aResId ); } else { - ByteString aT( aResIdAry[(USHORT)eButton].pDefText ); + ByteString aT( aResIdAry[(sal_uInt16)eButton].pDefText ); aText = String( aT, RTL_TEXTENCODING_ASCII_US ); } return aText; @@ -199,7 +199,7 @@ XubString Button::GetStandardHelpText( StandardButtonType /* eButton */ ) return aHelpText; } // ----------------------------------------------------------------------- -BOOL Button::SetModeImage( const Image& rImage ) +sal_Bool Button::SetModeImage( const Image& rImage ) { if ( rImage != mpButtonData->maImage ) { @@ -210,7 +210,7 @@ BOOL Button::SetModeImage( const Image& rImage ) StateChanged( STATE_CHANGE_DATA ); } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -220,7 +220,7 @@ const Image Button::GetModeImage( ) const } // ----------------------------------------------------------------------- -BOOL Button::HasImage() const +sal_Bool Button::HasImage() const { return !!(mpButtonData->maImage); } @@ -242,15 +242,15 @@ ImageAlign Button::GetImageAlign() const } // ----------------------------------------------------------------------- -BOOL Button::SetModeBitmap( const BitmapEx& rBitmap ) +sal_Bool Button::SetModeBitmap( const BitmapEx& rBitmap ) { if ( SetModeImage( rBitmap ) ) { if ( !mpButtonData->mpBitmapEx ) mpButtonData->mpBitmapEx = new BitmapEx( rBitmap ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -290,11 +290,11 @@ void Button::ImplSetSymbolRect( const Rectangle& i_rRect ) // ----------------------------------------------------------------------- -USHORT Button::ImplGetTextStyle( XubString& rText, WinBits nWinStyle, - ULONG nDrawFlags ) +sal_uInt16 Button::ImplGetTextStyle( XubString& rText, WinBits nWinStyle, + sal_uLong nDrawFlags ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - USHORT nTextStyle = FixedText::ImplGetTextStyle( nWinStyle & ~WB_DEFBUTTON ); + sal_uInt16 nTextStyle = FixedText::ImplGetTextStyle( nWinStyle & ~WB_DEFBUTTON ); if ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC ) { @@ -321,15 +321,15 @@ USHORT Button::ImplGetTextStyle( XubString& rText, WinBits nWinStyle, // ----------------------------------------------------------------------- void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, - Size& rSize, BOOL bLayout, - ULONG nImageSep, ULONG nDrawFlags, - USHORT nTextStyle, Rectangle *pSymbolRect, + Size& rSize, sal_Bool bLayout, + sal_uLong nImageSep, sal_uLong nDrawFlags, + sal_uInt16 nTextStyle, Rectangle *pSymbolRect, bool bAddImageSep ) { XubString aText( GetText() ); - BOOL bDrawImage = HasImage() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOIMAGE ); - BOOL bDrawText = aText.Len() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOTEXT ); - BOOL bHasSymbol = pSymbolRect ? TRUE : FALSE; + sal_Bool bDrawImage = HasImage() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOIMAGE ); + sal_Bool bDrawText = aText.Len() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOTEXT ); + sal_Bool bHasSymbol = pSymbolRect ? sal_True : sal_False; // No text and no image => nothing to do => return if ( !bDrawImage && !bDrawText && !bHasSymbol ) @@ -580,7 +580,7 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, } } - USHORT nStyle = 0; + sal_uInt16 nStyle = 0; if ( ! ( nDrawFlags & WINDOW_DRAW_NODISABLE ) && ! IsEnabled() ) @@ -640,13 +640,13 @@ const Rectangle& Button::ImplGetFocusRect() const } // ----------------------------------------------------------------------- -USHORT& Button::ImplGetButtonState() +sal_uInt16& Button::ImplGetButtonState() { return mpButtonData->mnButtonState; } // ----------------------------------------------------------------------- -USHORT Button::ImplGetButtonState() const +sal_uInt16 Button::ImplGetButtonState() const { return mpButtonData->mnButtonState; } @@ -668,13 +668,13 @@ SymbolAlign Button::ImplGetSymbolAlign() const } // ----------------------------------------------------------------------- -void Button::ImplSetSmallSymbol( BOOL bSmall ) +void Button::ImplSetSmallSymbol( sal_Bool bSmall ) { mpButtonData->mbSmallSymbol = bSmall; } // ----------------------------------------------------------------------- -void Button::EnableImageDisplay( BOOL bEnable ) +void Button::EnableImageDisplay( sal_Bool bEnable ) { if( bEnable ) mpButtonData->mnButtonState &= ~BUTTON_DRAW_NOIMAGE; @@ -683,13 +683,13 @@ void Button::EnableImageDisplay( BOOL bEnable ) } // ----------------------------------------------------------------------- -BOOL Button::IsImageDisplayEnabled() +sal_Bool Button::IsImageDisplayEnabled() { return (mpButtonData->mnButtonState & BUTTON_DRAW_NOIMAGE) == 0; } // ----------------------------------------------------------------------- -void Button::EnableTextDisplay( BOOL bEnable ) +void Button::EnableTextDisplay( sal_Bool bEnable ) { if( bEnable ) mpButtonData->mnButtonState &= ~BUTTON_DRAW_NOTEXT; @@ -698,53 +698,12 @@ void Button::EnableTextDisplay( BOOL bEnable ) } // ----------------------------------------------------------------------- -BOOL Button::IsTextDisplayEnabled() +sal_Bool Button::IsTextDisplayEnabled() { return (mpButtonData->mnButtonState & BUTTON_DRAW_NOTEXT) == 0; } // ----------------------------------------------------------------------- -void Button::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Control::DataChanged( rDCEvt ); - - // The flag SETTINGS_IN_UPDATE_SETTINGS is set when the settings changed due to a - // Application::SettingsChanged event. In this scenario we want to keep the style settings - // of our radio buttons and our check boxes. - if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && - ( rDCEvt.GetFlags() & SETTINGS_IN_UPDATE_SETTINGS ) ) - - { - const AllSettings* pOldSettings = rDCEvt.GetOldSettings(); - if ( pOldSettings ) - { - BOOL bResetStyleSettings = FALSE; - AllSettings aAllSettings = GetSettings(); - StyleSettings aStyleSetting = aAllSettings.GetStyleSettings(); - - USHORT nCheckBoxStyle = aStyleSetting.GetCheckBoxStyle(); - if ( nCheckBoxStyle != pOldSettings->GetStyleSettings().GetCheckBoxStyle() ) - { - aStyleSetting.SetCheckBoxStyle( pOldSettings->GetStyleSettings().GetCheckBoxStyle() ); - bResetStyleSettings = TRUE; - } - - USHORT nRadioButtonStyle = aStyleSetting.GetRadioButtonStyle(); - if ( nRadioButtonStyle != pOldSettings->GetStyleSettings().GetRadioButtonStyle() ) - { - aStyleSetting.SetRadioButtonStyle( pOldSettings->GetStyleSettings().GetRadioButtonStyle() ); - bResetStyleSettings = TRUE; - } - - if ( bResetStyleSettings ) - { - aAllSettings.SetStyleSettings( pOldSettings->GetStyleSettings() ); - SetSettings( aAllSettings ); - } - } - } -} - void Button::SetSmallSymbol (bool small) { ImplSetSmallSymbol (small); @@ -759,14 +718,14 @@ bool Button::IsSmallSymbol () const void PushButton::ImplInitPushButtonData() { - mpWindowImpl->mbPushButton = TRUE; + mpWindowImpl->mbPushButton = sal_True; meSymbol = SYMBOL_NOSYMBOL; meState = STATE_NOCHECK; meSaveValue = STATE_NOCHECK; mnDDStyle = 0; - mbPressed = FALSE; - mbInUserDraw = FALSE; + mbPressed = sal_False; + mbInUserDraw = sal_False; } // ----------------------------------------------------------------------- @@ -779,7 +738,7 @@ void PushButton::ImplInit( Window* pParent, WinBits nStyle ) if ( nStyle & WB_NOLIGHTBORDER ) ImplGetButtonState() |= BUTTON_DRAW_NOLIGHTBORDER; - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); } // ----------------------------------------------------------------------- @@ -820,8 +779,8 @@ const Color& PushButton::GetCanonicalTextColor( const StyleSettings& _rStyle ) c // ----------------------------------------------------------------------- -void PushButton::ImplInitSettings( BOOL bFont, - BOOL bForeground, BOOL bBackground ) +void PushButton::ImplInitSettings( sal_Bool bFont, + sal_Bool bForeground, sal_Bool bBackground ) { Button::ImplInitSettings( bFont, bForeground ); @@ -831,20 +790,21 @@ void PushButton::ImplInitSettings( BOOL bFont, // #i38498#: do not check for GetParent()->IsChildTransparentModeEnabled() // otherwise the formcontrol button will be overdrawn due to PARENTCLIPMODE_NOCLIP // for radio and checkbox this is ok as they shoud appear transparent in documents - if ( IsNativeControlSupported( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL ) ) + if ( IsNativeControlSupported( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL ) || + (GetStyle() & WB_FLATBUTTON) != 0 ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); mpWindowImpl->mbUseNativeFocus = (GetStyle() & WB_FLATBUTTON) ? false : ImplGetSVData()->maNWFData.mbNoFocusRects; } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); } } } @@ -852,132 +812,13 @@ void PushButton::ImplInitSettings( BOOL bFont, // ----------------------------------------------------------------------- void PushButton::ImplDrawPushButtonFrame( Window* pDev, - Rectangle& rRect, USHORT nStyle ) + Rectangle& rRect, sal_uInt16 nStyle ) { if ( !(pDev->GetStyle() & (WB_RECTSTYLE | WB_SMALLSTYLE)) ) { StyleSettings aStyleSettings = pDev->GetSettings().GetStyleSettings(); if ( pDev->IsControlBackground() ) aStyleSettings.Set3DColors( pDev->GetControlBackground() ); - - USHORT nPushButtonSysStyle = aStyleSettings.GetPushButtonStyle() & STYLE_PUSHBUTTON_STYLE; - if ( nPushButtonSysStyle == STYLE_PUSHBUTTON_MAC ) - { - pDev->SetLineColor(); - pDev->SetFillColor( aStyleSettings.GetFaceColor() ); - pDev->DrawRect( rRect ); - - if ( (aStyleSettings.GetOptions() & STYLE_OPTION_MONO) || - (pDev->GetOutDevType() == OUTDEV_PRINTER) ) - nStyle |= BUTTON_DRAW_MONO; - - if ( nStyle & BUTTON_DRAW_DEFAULT ) - { - if ( nStyle & BUTTON_DRAW_MONO ) - pDev->SetLineColor( Color( COL_BLACK ) ); - else - pDev->SetLineColor( aStyleSettings.GetDarkShadowColor() ); - - pDev->DrawLine( Point( rRect.Left()+3, rRect.Top() ), - Point( rRect.Right()-3, rRect.Top() ) ); - pDev->DrawLine( Point( rRect.Left()+3, rRect.Bottom() ), - Point( rRect.Right()-3, rRect.Bottom() ) ); - pDev->DrawLine( Point( rRect.Left(), rRect.Top()+3 ), - Point( rRect.Left(), rRect.Bottom()-3 ) ); - pDev->DrawLine( Point( rRect.Right(), rRect.Top()+3 ), - Point( rRect.Right(), rRect.Bottom()-3 ) ); - pDev->DrawPixel( Point( rRect.Left()+2, rRect.Top()+1 ) ); - pDev->DrawPixel( Point( rRect.Left()+1, rRect.Top()+2 ) ); - pDev->DrawPixel( Point( rRect.Right()-2, rRect.Top()+1 ) ); - pDev->DrawPixel( Point( rRect.Right()-1, rRect.Top()+2 ) ); - pDev->DrawPixel( Point( rRect.Left()+2, rRect.Bottom()-1 ) ); - pDev->DrawPixel( Point( rRect.Left()+1, rRect.Bottom()-2 ) ); - pDev->DrawPixel( Point( rRect.Right()-2, rRect.Bottom()-1 ) ); - pDev->DrawPixel( Point( rRect.Right()-1, rRect.Bottom()-2 ) ); - - if ( nStyle & BUTTON_DRAW_MONO ) - pDev->SetLineColor( Color( COL_BLACK ) ); - else - pDev->SetLineColor( aStyleSettings.GetShadowColor() ); - pDev->DrawLine( Point( rRect.Left()+3, rRect.Bottom()-1 ), - Point( rRect.Right()-3, rRect.Bottom()-1 ) ); - pDev->DrawLine( Point( rRect.Right()-1, rRect.Top()+3 ), - Point( rRect.Right()-1, rRect.Bottom()-3 ) ); - pDev->DrawPixel( Point( rRect.Right()-3, rRect.Bottom()-2 ) ); - pDev->DrawPixel( Point( rRect.Right()-2, rRect.Bottom()-2 ) ); - pDev->DrawPixel( Point( rRect.Right()-2, rRect.Bottom()-3 ) ); - } - - rRect.Left() += 2; - rRect.Top() += 2; - rRect.Right() -= 2; - rRect.Bottom() -= 2; - - if ( nStyle & BUTTON_DRAW_MONO ) - pDev->SetLineColor( Color( COL_BLACK ) ); - else - pDev->SetLineColor( aStyleSettings.GetDarkShadowColor() ); - - pDev->DrawLine( Point( rRect.Left()+2, rRect.Top() ), - Point( rRect.Right()-2, rRect.Top() ) ); - pDev->DrawLine( Point( rRect.Left()+2, rRect.Bottom() ), - Point( rRect.Right()-2, rRect.Bottom() ) ); - pDev->DrawLine( Point( rRect.Left(), rRect.Top()+2 ), - Point( rRect.Left(), rRect.Bottom()-2 ) ); - pDev->DrawLine( Point( rRect.Right(), rRect.Top()+2 ), - Point( rRect.Right(), rRect.Bottom()-2 ) ); - pDev->DrawPixel( Point( rRect.Left()+1, rRect.Top()+1 ) ); - pDev->DrawPixel( Point( rRect.Right()-1, rRect.Top()+1 ) ); - pDev->DrawPixel( Point( rRect.Left()+1, rRect.Bottom()-1 ) ); - pDev->DrawPixel( Point( rRect.Right()-1, rRect.Bottom()-1 ) ); - - pDev->SetLineColor(); - if ( nStyle & BUTTON_DRAW_CHECKED ) - pDev->SetFillColor( aStyleSettings.GetCheckedColor() ); - else - pDev->SetFillColor( aStyleSettings.GetFaceColor() ); - pDev->DrawRect( Rectangle( rRect.Left()+2, rRect.Top()+2, rRect.Right()-2, rRect.Bottom()-2 ) ); - - if ( !(nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED)) ) - { - if ( nStyle & BUTTON_DRAW_MONO ) - pDev->SetLineColor( Color( COL_BLACK ) ); - else - pDev->SetLineColor( aStyleSettings.GetShadowColor() ); - pDev->DrawLine( Point( rRect.Left()+2, rRect.Bottom()-1 ), - Point( rRect.Right()-2, rRect.Bottom()-1 ) ); - pDev->DrawLine( Point( rRect.Right()-1, rRect.Top()+2 ), - Point( rRect.Right()-1, rRect.Bottom()-2 ) ); - pDev->DrawPixel( Point( rRect.Right()-2, rRect.Bottom()-2 ) ); - pDev->SetLineColor( aStyleSettings.GetLightColor() ); - } - else - pDev->SetLineColor( aStyleSettings.GetShadowColor() ); - - if ( !(nStyle & BUTTON_DRAW_MONO) ) - { - pDev->DrawLine( Point( rRect.Left()+2, rRect.Top()+1 ), - Point( rRect.Right()-2, rRect.Top()+1 ) ); - pDev->DrawLine( Point( rRect.Left()+1, rRect.Top()+2 ), - Point( rRect.Left()+1, rRect.Bottom()-2 ) ); - pDev->DrawPixel( Point( rRect.Top()+2, rRect.Right()+2 ) ); - } - - rRect.Left() += 2; - rRect.Top() += 2; - rRect.Right() -= 2; - rRect.Bottom() -= 2; - - if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) ) - { - rRect.Left()++; - rRect.Top()++; - rRect.Right()++; - rRect.Bottom()++; - } - - return; - } } DecorationView aDecoView( pDev ); @@ -998,36 +839,22 @@ void PushButton::ImplDrawPushButtonFrame( Window* pDev, // ----------------------------------------------------------------------- -BOOL PushButton::ImplHitTestPushButton( Window* pDev, +sal_Bool PushButton::ImplHitTestPushButton( Window* pDev, const Point& rPos ) { Point aTempPoint; Rectangle aTestRect( aTempPoint, pDev->GetOutputSizePixel() ); - if ( !(pDev->GetStyle() & (WB_RECTSTYLE | WB_SMALLSTYLE)) ) - { - const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings(); - - USHORT nPushButtonSysStyle = rStyleSettings.GetPushButtonStyle() & STYLE_PUSHBUTTON_STYLE; - if ( nPushButtonSysStyle == STYLE_PUSHBUTTON_MAC ) - { - aTestRect.Left() += 2; - aTestRect.Top() += 2; - aTestRect.Right() -= 2; - aTestRect.Bottom() -= 2; - } - } - return aTestRect.IsInside( rPos ); } // ----------------------------------------------------------------------- -USHORT PushButton::ImplGetTextStyle( ULONG nDrawFlags ) const +sal_uInt16 PushButton::ImplGetTextStyle( sal_uLong nDrawFlags ) const { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - USHORT nTextStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_MULTILINE | TEXT_DRAW_ENDELLIPSIS; + sal_uInt16 nTextStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_MULTILINE | TEXT_DRAW_ENDELLIPSIS; if ( ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) || ( nDrawFlags & WINDOW_DRAW_MONO ) ) @@ -1062,7 +889,7 @@ USHORT PushButton::ImplGetTextStyle( ULONG nDrawFlags ) const static void ImplDrawBtnDropDownArrow( OutputDevice* pDev, long nX, long nY, - Color& rColor, BOOL bBlack ) + Color& rColor, sal_Bool bBlack ) { Color aOldLineColor = pDev->GetLineColor(); Color aOldFillColor = pDev->GetFillColor(); @@ -1088,16 +915,18 @@ static void ImplDrawBtnDropDownArrow( OutputDevice* pDev, // ----------------------------------------------------------------------- -void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags, +void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, sal_uLong nDrawFlags, const Rectangle& rRect, - bool bLayout ) + bool bLayout, + bool bMenuBtnSep + ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); Rectangle aInRect = rRect; Color aColor; XubString aText = PushButton::GetText(); // PushButton:: wegen MoreButton - USHORT nTextStyle = ImplGetTextStyle( nDrawFlags ); - USHORT nStyle; + sal_uInt16 nTextStyle = ImplGetTextStyle( nDrawFlags ); + sal_uInt16 nStyle; if( aInRect.nRight < aInRect.nLeft || aInRect.nBottom < aInRect.nTop ) aInRect.SetEmpty(); @@ -1124,7 +953,7 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags Size aSize = rRect.GetSize(); Point aPos = rRect.TopLeft(); - ULONG nImageSep = 1 + (pDev->GetTextHeight()-10)/2; + sal_uLong nImageSep = 1 + (pDev->GetTextHeight()-10)/2; if( nImageSep < 1 ) nImageSep = 1; if ( mnDDStyle == PUSHBUTTON_DROPDOWN_MENUBUTTON ) @@ -1138,19 +967,22 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags aSize.Width() -= ( 5 + nSymbolSize ); ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep, - nDrawFlags, nTextStyle, NULL, (GetStyle() & WB_FLATBUTTON) != 0 ); + nDrawFlags, nTextStyle, NULL, true ); } else ImplCalcSymbolRect( aInRect ); if( ! bLayout ) { - DecorationView aDecoView( pDev ); long nDistance = (aInRect.GetHeight() > 10) ? 2 : 1; - long nX = aInRect.Left() - 2*nDistance;; - Point aStartPt( nX, aInRect.Top()+nDistance ); - Point aEndPt( nX, aInRect.Bottom()-nDistance ); - aDecoView.DrawSeparator( aStartPt, aEndPt ); + DecorationView aDecoView( pDev ); + if( bMenuBtnSep ) + { + long nX = aInRect.Left() - 2*nDistance;; + Point aStartPt( nX, aInRect.Top()+nDistance ); + Point aEndPt( nX, aInRect.Bottom()-nDistance ); + aDecoView.DrawSeparator( aStartPt, aEndPt ); + } aDecoView.DrawSymbol( aInRect, SYMBOL_SPIN_DOWN, aColor, nStyle ); aInRect.Left() -= 2*nDistance; ImplSetSymbolRect( aInRect ); @@ -1162,7 +994,7 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags // FIXME: (GetStyle() & WB_FLATBUTTON) != 0 is preliminary // in the next major this should be replaced by "true" ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep, nDrawFlags, - nTextStyle, IsSymbol() ? &aSymbolRect : NULL, (GetStyle() & WB_FLATBUTTON) != 0 ); + nTextStyle, IsSymbol() ? &aSymbolRect : NULL, true ); if ( IsSymbol() && ! bLayout ) { @@ -1173,7 +1005,7 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags if ( mnDDStyle == PUSHBUTTON_DROPDOWN_TOOLBOX && !bLayout ) { - BOOL bBlack = FALSE; + sal_Bool bBlack = sal_False; Color aArrowColor( COL_BLACK ); if ( !(nDrawFlags & WINDOW_DRAW_MONO) ) @@ -1183,7 +1015,7 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags else { aArrowColor = Color( COL_LIGHTGREEN ); - bBlack = TRUE; + bBlack = sal_True; } } @@ -1211,13 +1043,13 @@ void PushButton::ImplDrawPushButton( bool bLayout ) if( !bLayout ) HideFocus(); - USHORT nButtonStyle = ImplGetButtonState(); + sal_uInt16 nButtonStyle = ImplGetButtonState(); Point aPoint; Size aOutSz( GetOutputSizePixel() ); Rectangle aRect( aPoint, aOutSz ); Rectangle aInRect = aRect; Rectangle aTextRect; - BOOL bNativeOK = FALSE; + sal_Bool bNativeOK = sal_False; // adjust style if button should be rendered 'pressed' if ( mbPressed ) @@ -1247,7 +1079,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) break; } - BOOL bDropDown = ( IsSymbol() && (GetSymbol()==SYMBOL_SPIN_DOWN) && !GetText().Len() ); + sal_Bool bDropDown = ( IsSymbol() && (GetSymbol()==SYMBOL_SPIN_DOWN) && !GetText().Len() ); if( bDropDown && (aCtrlType == CTRL_COMBOBOX || aCtrlType == CTRL_LISTBOX ) ) { @@ -1258,11 +1090,11 @@ void PushButton::ImplDrawPushButton( bool bLayout ) { Edit* pEdit = static_cast<Edit*>(GetParent()); if( pEdit->ImplUseNativeBorder( pEdit->GetStyle() ) ) - bNativeOK = TRUE; + bNativeOK = sal_True; } else if( GetParent()->IsNativeControlSupported( aCtrlType, HAS_BACKGROUND_TEXTURE) ) { - bNativeOK = TRUE; + bNativeOK = sal_True; } if( !bNativeOK && GetParent()->IsNativeControlSupported( aCtrlType, PART_BUTTON_DOWN ) ) { @@ -1291,7 +1123,13 @@ void PushButton::ImplDrawPushButton( bool bLayout ) return; bool bRollOver = (IsMouseOver() && aInRect.IsInside( GetPointerPosPixel() )); - if ( (bNativeOK=IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL)) == TRUE ) + bool bDrawMenuSep = true; + if( (GetStyle() & WB_FLATBUTTON) ) + { + if( ! bRollOver && ! HasFocus() ) + bDrawMenuSep = false; + } + if ( (bNativeOK=IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL)) == sal_True ) { PushButtonValue aControlValue; Rectangle aCtrlRegion( aInRect ); @@ -1341,13 +1179,13 @@ void PushButton::ImplDrawPushButton( bool bLayout ) // draw content using the same aInRect as non-native VCL would do ImplDrawPushButtonContent( this, (nState&CTRL_STATE_ROLLOVER) ? WINDOW_DRAW_ROLLOVER : 0, - aInRect, bLayout ); + aInRect, bLayout, bDrawMenuSep ); if ( HasFocus() ) ShowFocus( ImplGetFocusRect() ); } - if ( bNativeOK == FALSE ) + if ( bNativeOK == sal_False ) { // draw PushButtonFrame, aInRect has content size afterwards if( (GetStyle() & WB_FLATBUTTON) ) @@ -1367,7 +1205,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) } // draw content - ImplDrawPushButtonContent( this, 0, aInRect, bLayout ); + ImplDrawPushButtonContent( this, 0, aInRect, bLayout, bDrawMenuSep ); if( ! bLayout && HasFocus() ) { @@ -1378,14 +1216,14 @@ void PushButton::ImplDrawPushButton( bool bLayout ) // ----------------------------------------------------------------------- -void PushButton::ImplSetDefButton( BOOL bSet ) +void PushButton::ImplSetDefButton( sal_Bool bSet ) { Size aSize( GetSizePixel() ); Point aPos( GetPosPixel() ); int dLeft(0), dRight(0), dTop(0), dBottom(0); - BOOL bSetPos = FALSE; + sal_Bool bSetPos = sal_False; - if ( (IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL)) == TRUE ) + if ( (IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL)) == sal_True ) { Rectangle aBound, aCont; Rectangle aCtrlRect( 0, 0, 80, 20 ); // use a constant size to avoid accumulating @@ -1438,7 +1276,7 @@ void PushButton::ImplSetDefButton( BOOL bSet ) // ----------------------------------------------------------------------- -BOOL PushButton::ImplIsDefButton() const +sal_Bool PushButton::ImplIsDefButton() const { return (ImplGetButtonState() & BUTTON_DRAW_DEFAULT) != 0; } @@ -1488,7 +1326,7 @@ void PushButton::MouseButtonDown( const MouseEvent& rMEvt ) if ( rMEvt.IsLeft() && ImplHitTestPushButton( this, rMEvt.GetPosPixel() ) ) { - USHORT nTrackFlags = 0; + sal_uInt16 nTrackFlags = 0; if ( ( GetStyle() & WB_REPEAT ) && ! ( GetStyle() & WB_TOGGLE ) ) @@ -1521,11 +1359,11 @@ void PushButton::Tracking( const TrackingEvent& rTEvt ) { if ( IsChecked() ) { - Check( FALSE ); + Check( sal_False ); ImplGetButtonState() &= ~BUTTON_DRAW_PRESSED; } else - Check( TRUE ); + Check( sal_True ); } } else @@ -1610,11 +1448,11 @@ void PushButton::KeyUp( const KeyEvent& rKEvt ) { if ( IsChecked() ) { - Check( FALSE ); + Check( sal_False ); ImplGetButtonState() &= ~BUTTON_DRAW_PRESSED; } else - Check( TRUE ); + Check( sal_True ); Toggle(); } @@ -1649,7 +1487,7 @@ void PushButton::Paint( const Rectangle& ) // ----------------------------------------------------------------------- void PushButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - ULONG nFlags ) + sal_uLong nFlags ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -1681,14 +1519,14 @@ void PushButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, pDev->SetTextFillColor(); DecorationView aDecoView( pDev ); - USHORT nButtonStyle = 0; + sal_uInt16 nButtonStyle = 0; if ( nFlags & WINDOW_DRAW_MONO ) nButtonStyle |= BUTTON_DRAW_MONO; if ( IsChecked() ) nButtonStyle |= BUTTON_DRAW_CHECKED; aRect = aDecoView.DrawButton( aRect, nButtonStyle ); - ImplDrawPushButtonContent( pDev, nFlags, aRect, false ); + ImplDrawPushButtonContent( pDev, nFlags, aRect, false, true ); pDev->Pop(); } @@ -1753,17 +1591,17 @@ void PushButton::StateChanged( StateChangedType nType ) else if ( (nType == STATE_CHANGE_ZOOM) || (nType == STATE_CHANGE_CONTROLFONT) ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } } @@ -1779,7 +1617,7 @@ void PushButton::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); Invalidate(); } } @@ -1821,7 +1659,7 @@ long PushButton::PreNotify( NotifyEvent& rNEvt ) break; } - BOOL bDropDown = ( IsSymbol() && (GetSymbol()==SYMBOL_SPIN_DOWN) && !GetText().Len() ); + sal_Bool bDropDown = ( IsSymbol() && (GetSymbol()==SYMBOL_SPIN_DOWN) && !GetText().Len() ); if( bDropDown && GetParent()->IsNativeControlSupported( aCtrlType, PART_ENTIRE_CONTROL) && !GetParent()->IsNativeControlSupported( aCtrlType, PART_BUTTON_DOWN) ) @@ -1884,7 +1722,7 @@ SymbolAlign PushButton::GetSymbolAlign() const // ----------------------------------------------------------------------- -void PushButton::SetDropDown( USHORT nStyle ) +void PushButton::SetDropDown( sal_uInt16 nStyle ) { if ( mnDDStyle != nStyle ) { @@ -1920,7 +1758,7 @@ void PushButton::SetState( TriState eState ) // ----------------------------------------------------------------------- -void PushButton::SetPressed( BOOL bPressed ) +void PushButton::SetPressed( sal_Bool bPressed ) { if ( mbPressed != bPressed ) { @@ -1961,7 +1799,7 @@ Size PushButton::CalcMinimumSize( long nMaxWidth ) const aSize = GetModeImage().GetSizePixel(); if ( PushButton::GetText().Len() && ! (ImplGetButtonState() & BUTTON_DRAW_NOTEXT) ) { - ULONG nDrawFlags = 0; + sal_uLong nDrawFlags = 0; Size textSize = GetTextRect( Rectangle( Point(), Size( nMaxWidth ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ), PushButton::GetText(), ImplGetTextStyle( nDrawFlags ) ).GetSize(); aSize.Width() += int( textSize.Width () * 1.15 ); @@ -2034,7 +1872,7 @@ void OKButton::Click() if ( pParent->IsDialog() ) { if ( ((Dialog*)pParent)->IsInExecute() ) - ((Dialog*)pParent)->EndDialog( TRUE ); + ((Dialog*)pParent)->EndDialog( sal_True ); // gegen rekursive Aufrufe schuetzen else if ( !((Dialog*)pParent)->IsInClose() ) { @@ -2100,7 +1938,7 @@ void CancelButton::Click() if ( pParent->IsDialog() ) { if ( ((Dialog*)pParent)->IsInExecute() ) - ((Dialog*)pParent)->EndDialog( FALSE ); + ((Dialog*)pParent)->EndDialog( sal_False ); // gegen rekursive Aufrufe schuetzen else if ( !((Dialog*)pParent)->IsInClose() ) { @@ -2174,10 +2012,10 @@ void HelpButton::Click() void RadioButton::ImplInitRadioButtonData() { - mbChecked = FALSE; - mbSaveValue = FALSE; - mbRadioCheck = TRUE; - mbStateChanged = FALSE; + mbChecked = sal_False; + mbSaveValue = sal_False; + mbRadioCheck = sal_True; + mbStateChanged = sal_False; } // ----------------------------------------------------------------------- @@ -2187,7 +2025,7 @@ void RadioButton::ImplInit( Window* pParent, WinBits nStyle ) nStyle = ImplInitStyle( pParent->GetWindow( WINDOW_LASTCHILD ), nStyle ); Button::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); } // ----------------------------------------------------------------------- @@ -2222,8 +2060,8 @@ const Color& RadioButton::GetCanonicalTextColor( const StyleSettings& _rStyle ) // ----------------------------------------------------------------------- -void RadioButton::ImplInitSettings( BOOL bFont, - BOOL bForeground, BOOL bBackground ) +void RadioButton::ImplInitSettings( sal_Bool bFont, + sal_Bool bForeground, sal_Bool bBackground ) { Button::ImplInitSettings( bFont, bForeground ); @@ -2233,18 +2071,18 @@ void RadioButton::ImplInitSettings( BOOL bFont, if ( !IsControlBackground() && (pParent->IsChildTransparentModeEnabled() || IsNativeControlSupported( CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL ) ) ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); if( IsNativeControlSupported( CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL ) ) mpWindowImpl->mbUseNativeFocus = ImplGetSVData()->maNWFData.mbNoFocusRects; } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -2277,10 +2115,10 @@ void RadioButton::ImplInvalidateOrDrawRadioButtonState() void RadioButton::ImplDrawRadioButtonState() { - BOOL bNativeOK = FALSE; + sal_Bool bNativeOK = sal_False; // no native drawing for image radio buttons - if ( !maImage && (bNativeOK=IsNativeControlSupported(CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL)) == TRUE ) + if ( !maImage && (bNativeOK=IsNativeControlSupported(CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL)) == sal_True ) { ImplControlValue aControlValue( mbChecked ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); Rectangle aCtrlRect( maStateRect.TopLeft(), maStateRect.GetSize() ); @@ -2299,12 +2137,12 @@ void RadioButton::ImplDrawRadioButtonState() } -if ( bNativeOK == FALSE ) +if ( bNativeOK == sal_False ) { // kein Image-RadioButton if ( !maImage ) { - USHORT nStyle = ImplGetButtonState(); + sal_uInt16 nStyle = ImplGetButtonState(); if ( !IsEnabled() ) nStyle |= BUTTON_DRAW_DISABLED; if ( mbChecked ) @@ -2323,8 +2161,8 @@ if ( bNativeOK == FALSE ) const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); Rectangle aImageRect = maStateRect; Size aImageSize = maImage.GetSizePixel(); - BOOL bEnabled = IsEnabled(); - USHORT nButtonStyle = FRAME_DRAW_DOUBLEIN; + sal_Bool bEnabled = IsEnabled(); + sal_uInt16 nButtonStyle = FRAME_DRAW_DOUBLEIN; aImageSize.Width() = CalcZoom( aImageSize.Width() ); aImageSize.Height() = CalcZoom( aImageSize.Height() ); @@ -2387,7 +2225,7 @@ if ( bNativeOK == FALSE ) // ----------------------------------------------------------------------- -void RadioButton::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, +void RadioButton::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize, const Size& rImageSize, Rectangle& rStateRect, Rectangle& rMouseRect, bool bLayout ) @@ -2407,7 +2245,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, if ( ( aText.Len() && ! (ImplGetButtonState() & BUTTON_DRAW_NOTEXT) ) || ( HasImage() && ! (ImplGetButtonState() & BUTTON_DRAW_NOIMAGE) ) ) { - USHORT nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); + sal_uInt16 nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() ); Size aSize( rSize ); @@ -2481,7 +2319,7 @@ da im Writer ansonsten die Images noch weiter oben haengen } else { - BOOL bTopImage = (nWinStyle & WB_TOP) != 0; + sal_Bool bTopImage = (nWinStyle & WB_TOP) != 0; Size aImageSize = maImage.GetSizePixel(); Rectangle aImageRect( rPos, rSize ); long nTextHeight = pDev->GetTextHeight(); @@ -2543,7 +2381,7 @@ void RadioButton::ImplDrawRadioButton( bool bLayout ) ImplDraw( this, 0, Point(), GetOutputSizePixel(), aImageSize, maStateRect, maMouseRect, bLayout ); - if( !bLayout || (IsNativeControlSupported(CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL)==TRUE) ) + if( !bLayout || (IsNativeControlSupported(CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL)==sal_True) ) { if ( !maImage && HasFocus() ) ShowFocus( ImplGetFocusRect() ); @@ -2603,7 +2441,7 @@ void RadioButton::ImplUncheckAllOther() { ImplDelData aDelData; pWindow->ImplAddDel( &aDelData ); - ((RadioButton*)pWindow)->SetState( FALSE ); + ((RadioButton*)pWindow)->SetState( sal_False ); if ( aDelData.IsDelete() ) return; pWindow->ImplRemoveDel( &aDelData ); @@ -2634,7 +2472,7 @@ void RadioButton::ImplUncheckAllOther() { ImplDelData aDelData; pWindow->ImplAddDel( &aDelData ); - ((RadioButton*)pWindow)->SetState( FALSE ); + ((RadioButton*)pWindow)->SetState( sal_False ); if ( aDelData.IsDelete() ) return; pWindow->ImplRemoveDel( &aDelData ); @@ -2650,10 +2488,10 @@ void RadioButton::ImplUncheckAllOther() // ----------------------------------------------------------------------- -void RadioButton::ImplCallClick( BOOL bGrabFocus, USHORT nFocusFlags ) +void RadioButton::ImplCallClick( sal_Bool bGrabFocus, sal_uInt16 nFocusFlags ) { mbStateChanged = !mbChecked; - mbChecked = TRUE; + mbChecked = sal_True; mpWindowImpl->mnStyle |= WB_TABSTOP; ImplInvalidateOrDrawRadioButtonState(); ImplDelData aDelData; @@ -2674,7 +2512,7 @@ void RadioButton::ImplCallClick( BOOL bGrabFocus, USHORT nFocusFlags ) if ( aDelData.IsDelete() ) return; ImplRemoveDel( &aDelData ); - mbStateChanged = FALSE; + mbStateChanged = sal_False; } // ----------------------------------------------------------------------- @@ -2708,9 +2546,9 @@ void RadioButton::ImplLoadRes( const ResId& rResId ) Button::ImplLoadRes( rResId ); //anderer Wert als Default ? - USHORT nChecked = ReadShortRes(); + sal_uInt16 nChecked = ReadShortRes(); if ( nChecked ) - SetState( TRUE ); + SetState( sal_True ); } // ----------------------------------------------------------------------- @@ -2831,7 +2669,7 @@ void RadioButton::Paint( const Rectangle& ) // ----------------------------------------------------------------------- void RadioButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - ULONG nFlags ) + sal_uLong nFlags ) { if ( !maImage ) { @@ -2970,17 +2808,17 @@ void RadioButton::StateChanged( StateChangedType nType ) else if ( (nType == STATE_CHANGE_ZOOM) || (nType == STATE_CHANGE_CONTROLFONT) ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } } @@ -2996,7 +2834,7 @@ void RadioButton::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); Invalidate(); } } @@ -3039,14 +2877,14 @@ void RadioButton::Toggle() // ----------------------------------------------------------------------- -BOOL RadioButton::SetModeRadioImage( const Image& rImage ) +sal_Bool RadioButton::SetModeRadioImage( const Image& rImage ) { if ( rImage != maImage ) { maImage = rImage; StateChanged( STATE_CHANGE_DATA ); } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -3058,7 +2896,7 @@ const Image& RadioButton::GetModeRadioImage( ) const // ----------------------------------------------------------------------- -void RadioButton::SetState( BOOL bCheck ) +void RadioButton::SetState( sal_Bool bCheck ) { // TabStop-Flag richtig mitfuehren if ( bCheck ) @@ -3076,7 +2914,7 @@ void RadioButton::SetState( BOOL bCheck ) // ----------------------------------------------------------------------- -void RadioButton::Check( BOOL bCheck ) +void RadioButton::Check( sal_Bool bCheck ) { // TabStop-Flag richtig mitfuehren if ( bCheck ) @@ -3142,7 +2980,7 @@ Size RadioButton::ImplGetRadioImageSize() const static void LoadThemedImageList (const StyleSettings &rStyleSettings, ImageList *pList, const ResId &rResId, - USHORT nImages) + sal_uInt16 nImages) { Color aColorAry1[6]; Color aColorAry2[6]; @@ -3166,11 +3004,11 @@ static void LoadThemedImageList (const StyleSettings &rStyleSettings, aColorAry1, aColorAry2, sizeof(aColorAry1) / sizeof(Color)); } -Image RadioButton::GetRadioImage( const AllSettings& rSettings, USHORT nFlags ) +Image RadioButton::GetRadioImage( const AllSettings& rSettings, sal_uInt16 nFlags ) { ImplSVData* pSVData = ImplGetSVData(); const StyleSettings& rStyleSettings = rSettings.GetStyleSettings(); - USHORT nStyle = rStyleSettings.GetRadioButtonStyle() & STYLE_RADIOBUTTON_STYLE; + sal_uInt16 nStyle = 0; if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) nStyle = STYLE_RADIOBUTTON_MONO; @@ -3213,7 +3051,7 @@ Image RadioButton::GetRadioImage( const AllSettings& rSettings, USHORT nFlags ) pSVData->maCtrlData.mnRadioStyle = nStyle; } - USHORT nId; + sal_uInt16 nId; if ( nFlags & BUTTON_DRAW_DISABLED ) { if ( nFlags & BUTTON_DRAW_CHECKED ) @@ -3323,7 +3161,7 @@ void CheckBox::ImplInitCheckBoxData() { meState = STATE_NOCHECK; meSaveValue = STATE_NOCHECK; - mbTriState = FALSE; + mbTriState = sal_False; } // ----------------------------------------------------------------------- @@ -3333,7 +3171,7 @@ void CheckBox::ImplInit( Window* pParent, WinBits nStyle ) nStyle = ImplInitStyle( pParent->GetWindow( WINDOW_LASTCHILD ), nStyle ); Button::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); } // ----------------------------------------------------------------------- @@ -3363,8 +3201,8 @@ const Color& CheckBox::GetCanonicalTextColor( const StyleSettings& _rStyle ) con // ----------------------------------------------------------------------- -void CheckBox::ImplInitSettings( BOOL bFont, - BOOL bForeground, BOOL bBackground ) +void CheckBox::ImplInitSettings( sal_Bool bFont, + sal_Bool bForeground, sal_Bool bBackground ) { Button::ImplInitSettings( bFont, bForeground ); @@ -3374,18 +3212,18 @@ void CheckBox::ImplInitSettings( BOOL bFont, if ( !IsControlBackground() && (pParent->IsChildTransparentModeEnabled() || IsNativeControlSupported( CTRL_CHECKBOX, PART_ENTIRE_CONTROL ) ) ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); if( IsNativeControlSupported( CTRL_CHECKBOX, PART_ENTIRE_CONTROL ) ) ImplGetWindowImpl()->mbUseNativeFocus = ImplGetSVData()->maNWFData.mbNoFocusRects; } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -3403,10 +3241,10 @@ void CheckBox::ImplLoadRes( const ResId& rResId ) if ( rResId.GetRT() != RSC_TRISTATEBOX ) { - USHORT nChecked = ReadShortRes(); + sal_uInt16 nChecked = ReadShortRes(); //anderer Wert als Default ? if( nChecked ) - Check( TRUE ); + Check( sal_True ); } } @@ -3428,9 +3266,9 @@ void CheckBox::ImplInvalidateOrDrawCheckBoxState() void CheckBox::ImplDrawCheckBoxState() { - bool bNativeOK = TRUE; + bool bNativeOK = sal_True; - if ( (bNativeOK=IsNativeControlSupported(CTRL_CHECKBOX, PART_ENTIRE_CONTROL)) == TRUE ) + if ( (bNativeOK=IsNativeControlSupported(CTRL_CHECKBOX, PART_ENTIRE_CONTROL)) == sal_True ) { ImplControlValue aControlValue( meState == STATE_CHECK ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); Rectangle aCtrlRegion( maStateRect ); @@ -3453,9 +3291,9 @@ void CheckBox::ImplDrawCheckBoxState() aControlValue, rtl::OUString() ); } - if ( bNativeOK == FALSE ) + if ( bNativeOK == sal_False ) { - USHORT nStyle = ImplGetButtonState(); + sal_uInt16 nStyle = ImplGetButtonState(); if ( !IsEnabled() ) nStyle |= BUTTON_DRAW_DISABLED; if ( meState == STATE_DONTKNOW ) @@ -3472,7 +3310,7 @@ void CheckBox::ImplDrawCheckBoxState() // ----------------------------------------------------------------------- -void CheckBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, +void CheckBox::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize, const Size& rImageSize, Rectangle& rStateRect, Rectangle& rMouseRect, bool bLayout ) @@ -3487,7 +3325,7 @@ void CheckBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, if ( ( aText.Len() && ! (ImplGetButtonState() & BUTTON_DRAW_NOTEXT) ) || ( HasImage() && ! (ImplGetButtonState() & BUTTON_DRAW_NOIMAGE) ) ) { - USHORT nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); + sal_uInt16 nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() ); Size aSize( rSize ); @@ -3761,7 +3599,7 @@ void CheckBox::Paint( const Rectangle& ) // ----------------------------------------------------------------------- void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - ULONG nFlags ) + sal_uLong nFlags ) { MapMode aResMapMode( MAP_100TH_MM ); Point aPos = pDev->LogicToPixel( rPos ); @@ -3951,17 +3789,17 @@ void CheckBox::StateChanged( StateChangedType nType ) else if ( (nType == STATE_CHANGE_ZOOM) || (nType == STATE_CHANGE_CONTROLFONT) ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } } @@ -3977,7 +3815,7 @@ void CheckBox::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); Invalidate(); } } @@ -4035,7 +3873,7 @@ void CheckBox::SetState( TriState eState ) // ----------------------------------------------------------------------- -void CheckBox::EnableTriState( BOOL bTriState ) +void CheckBox::EnableTriState( sal_Bool bTriState ) { if ( mbTriState != bTriState ) { @@ -4085,11 +3923,11 @@ Size CheckBox::ImplGetCheckImageSize() const return aSize; } -Image CheckBox::GetCheckImage( const AllSettings& rSettings, USHORT nFlags ) +Image CheckBox::GetCheckImage( const AllSettings& rSettings, sal_uInt16 nFlags ) { ImplSVData* pSVData = ImplGetSVData(); const StyleSettings& rStyleSettings = rSettings.GetStyleSettings(); - USHORT nStyle = rStyleSettings.GetCheckBoxStyle() & STYLE_CHECKBOX_STYLE; + sal_uInt16 nStyle = 0; if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) nStyle = STYLE_CHECKBOX_MONO; @@ -4116,7 +3954,7 @@ Image CheckBox::GetCheckImage( const AllSettings& rSettings, USHORT nFlags ) pSVData->maCtrlData.mnCheckStyle = nStyle; } - USHORT nId; + sal_uInt16 nId; if ( nFlags & BUTTON_DRAW_DISABLED ) { if ( nFlags & BUTTON_DRAW_DONTKNOW ) @@ -4244,7 +4082,7 @@ ImageButton::ImageButton( Window* pParent, WinBits nStyle ) : ImageButton::ImageButton( Window* pParent, const ResId& rResId ) : PushButton( pParent, rResId.SetRT( RSC_IMAGEBUTTON ) ) { - ULONG nObjMask = ReadLongRes(); + sal_uLong nObjMask = ReadLongRes(); if ( RSC_IMAGEBUTTON_IMAGE & nObjMask ) { @@ -4293,7 +4131,7 @@ ImageRadioButton::ImageRadioButton( Window* pParent, WinBits nStyle ) : ImageRadioButton::ImageRadioButton( Window* pParent, const ResId& rResId ) : RadioButton( pParent, rResId.SetRT( RSC_IMAGERADIOBUTTON ) ) { - ULONG nObjMask = ReadLongRes(); + sal_uLong nObjMask = ReadLongRes(); if ( RSC_IMAGERADIOBUTTON_IMAGE & nObjMask ) { @@ -4313,7 +4151,7 @@ ImageRadioButton::~ImageRadioButton() TriStateBox::TriStateBox( Window* pParent, WinBits nStyle ) : CheckBox( pParent, nStyle ) { - EnableTriState( TRUE ); + EnableTriState( sal_True ); } // ----------------------------------------------------------------------- @@ -4321,15 +4159,15 @@ TriStateBox::TriStateBox( Window* pParent, WinBits nStyle ) : TriStateBox::TriStateBox( Window* pParent, const ResId& rResId ) : CheckBox( pParent, rResId.SetRT( RSC_TRISTATEBOX ) ) { - EnableTriState( TRUE ); + EnableTriState( sal_True ); - ULONG nTriState = ReadLongRes(); - USHORT bDisableTriState = ReadShortRes(); + sal_uLong nTriState = ReadLongRes(); + sal_uInt16 bDisableTriState = ReadShortRes(); //anderer Wert als Default ? if ( (TriState)nTriState != STATE_NOCHECK ) SetState( (TriState)nTriState ); if ( bDisableTriState ) - EnableTriState( FALSE ); + EnableTriState( sal_False ); } // ----------------------------------------------------------------------- @@ -4391,7 +4229,7 @@ void DisclosureButton::ImplDrawCheckBoxState() if( ! pImg ) return; - USHORT nStyle = 0; + sal_uInt16 nStyle = 0; if( ! IsEnabled() ) nStyle |= IMAGE_DRAW_DISABLE; diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index e65925db282c..9881edd62ca3 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -46,7 +46,7 @@ // ======================================================================= -inline ULONG ImplCreateKey( USHORT nPos ) +inline sal_uLong ImplCreateKey( sal_uInt16 nPos ) { // Key = Pos+1, wegen Pos 0 return nPos+1; @@ -60,7 +60,7 @@ static void lcl_GetSelectedEntries( Table& rSelectedPos, const XubString& rText, { XubString aToken = rText.GetToken( --n, cTokenSep ); aToken.EraseLeadingAndTrailingChars( ' ' ); - USHORT nPos = pEntryList->FindEntry( aToken ); + sal_uInt16 nPos = pEntryList->FindEntry( aToken ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) rSelectedPos.Insert( ImplCreateKey( nPos ), (void*)sal_IntPtr(1L) ); } @@ -122,9 +122,9 @@ void ComboBox::ImplInitComboBoxData() mpFloatWin = NULL; mnDDHeight = 0; - mbDDAutoSize = TRUE; - mbSyntheticModify = FALSE; - mbMatchCase = FALSE; + mbDDAutoSize = sal_True; + mbSyntheticModify = sal_False; + mbMatchCase = sal_False; mcMultiSep = ';'; } @@ -134,7 +134,7 @@ void ComboBox::ImplCalcEditHeight() { sal_Int32 nLeft, nTop, nRight, nBottom; GetBorder( nLeft, nTop, nRight, nBottom ); - mnDDHeight = (USHORT)(mpSubEdit->GetTextHeight() + nTop + nBottom + 4); + mnDDHeight = (sal_uInt16)(mpSubEdit->GetTextHeight() + nTop + nBottom + 4); if ( !IsDropDownBox() ) mnDDHeight += 4; @@ -150,7 +150,7 @@ void ComboBox::ImplCalcEditHeight() { const long nNCHeight = aBoundRegion.GetHeight(); if( mnDDHeight < nNCHeight ) - mnDDHeight = sal::static_int_cast<USHORT>( nNCHeight ); + mnDDHeight = sal::static_int_cast<sal_uInt16>( nNCHeight ); } } @@ -160,7 +160,7 @@ void ComboBox::ImplInit( Window* pParent, WinBits nStyle ) { ImplInitStyle( nStyle ); - BOOL bNoBorder = ( nStyle & WB_NOBORDER ) ? TRUE : FALSE; + sal_Bool bNoBorder = ( nStyle & WB_NOBORDER ) ? sal_True : sal_False; if ( !(nStyle & WB_DROPDOWN) ) { nStyle &= ~WB_BORDER; @@ -181,7 +181,7 @@ void ComboBox::ImplInit( Window* pParent, WinBits nStyle ) if( nStyle & WB_DROPDOWN ) { mpFloatWin = new ImplListBoxFloatingWindow( this ); - mpFloatWin->SetAutoWidth( TRUE ); + mpFloatWin->SetAutoWidth( sal_True ); mpFloatWin->SetPopupModeEndHdl( LINK( this, ComboBox, ImplPopupModeEndHdl ) ); mpBtn = new ImplBtn( this, WB_NOLIGHTBORDER | WB_RECTSTYLE ); @@ -204,10 +204,10 @@ void ComboBox::ImplInit( Window* pParent, WinBits nStyle ) } mpSubEdit = new Edit( this, nEditStyle ); - mpSubEdit->EnableRTL( FALSE ); + mpSubEdit->EnableRTL( sal_False ); SetSubEdit( mpSubEdit ); mpSubEdit->SetPosPixel( Point() ); - EnableAutocomplete( TRUE ); + EnableAutocomplete( sal_True ); mpSubEdit->Show(); Window* pLBParent = this; @@ -225,11 +225,11 @@ void ComboBox::ImplInit( Window* pParent, WinBits nStyle ) if ( mpFloatWin ) mpFloatWin->SetImplListBox( mpImplLB ); else - mpImplLB->GetMainWindow()->AllowGrabFocus( TRUE ); + mpImplLB->GetMainWindow()->AllowGrabFocus( sal_True ); ImplCalcEditHeight(); - SetCompoundControl( TRUE ); + SetCompoundControl( sal_True ); } // ----------------------------------------------------------------------- @@ -249,11 +249,11 @@ void ComboBox::ImplLoadRes( const ResId& rResId ) { Edit::ImplLoadRes( rResId ); - ULONG nNumber = ReadLongRes(); + sal_uLong nNumber = ReadLongRes(); if( nNumber ) { - for( USHORT i = 0; i < nNumber; i++ ) + for( sal_uInt16 i = 0; i < nNumber; i++ ) { InsertEntry( ReadStringRes(), LISTBOX_APPEND ); } @@ -262,7 +262,7 @@ void ComboBox::ImplLoadRes( const ResId& rResId ) // ----------------------------------------------------------------------- -void ComboBox::EnableAutocomplete( BOOL bEnable, BOOL bMatchCase ) +void ComboBox::EnableAutocomplete( sal_Bool bEnable, sal_Bool bMatchCase ) { mbMatchCase = bMatchCase; @@ -274,7 +274,7 @@ void ComboBox::EnableAutocomplete( BOOL bEnable, BOOL bMatchCase ) // ----------------------------------------------------------------------- -BOOL ComboBox::IsAutocompleteEnabled() const +sal_Bool ComboBox::IsAutocompleteEnabled() const { return mpSubEdit->GetAutocompleteHdl().IsSet(); } @@ -288,10 +288,10 @@ IMPL_LINK( ComboBox, ImplClickBtnHdl, void*, EMPTYARG ) if ( !mpImplLB->GetEntryList()->GetMRUCount() ) ImplUpdateFloatSelection(); else - mpImplLB->SelectEntry( 0 , TRUE ); - mpBtn->SetPressed( TRUE ); + mpImplLB->SelectEntry( 0 , sal_True ); + mpBtn->SetPressed( sal_True ); SetSelection( Selection( 0, SELECTION_MAX ) ); - mpFloatWin->StartFloat( TRUE ); + mpFloatWin->StartFloat( sal_True ); ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); ImplClearLayoutData(); @@ -309,9 +309,9 @@ IMPL_LINK( ComboBox, ImplPopupModeEndHdl, void*, EMPTYARG ) { if ( !mpImplLB->GetEntryList()->IsEntryPosSelected( mpFloatWin->GetPopupModeStartSaveSelection() ) ) { - mpImplLB->SelectEntry( mpFloatWin->GetPopupModeStartSaveSelection(), TRUE ); - BOOL bTravelSelect = mpImplLB->IsTravelSelect(); - mpImplLB->SetTravelSelect( TRUE ); + mpImplLB->SelectEntry( mpFloatWin->GetPopupModeStartSaveSelection(), sal_True ); + sal_Bool bTravelSelect = mpImplLB->IsTravelSelect(); + mpImplLB->SetTravelSelect( sal_True ); Select(); mpImplLB->SetTravelSelect( bTravelSelect ); } @@ -321,7 +321,7 @@ IMPL_LINK( ComboBox, ImplPopupModeEndHdl, void*, EMPTYARG ) if( mpImplLB ) mpImplLB->GetMainWindow()->ImplClearLayoutData(); - mpBtn->SetPressed( FALSE ); + mpBtn->SetPressed( sal_False ); ImplCallEventListeners( VCLEVENT_DROPDOWN_CLOSE ); return 0; } @@ -341,36 +341,36 @@ IMPL_LINK( ComboBox, ImplAutocompleteHdl, Edit*, pEdit ) { XubString aFullText = pEdit->GetText(); XubString aStartText = aFullText.Copy( 0, (xub_StrLen)aSel.Max() ); - USHORT nStart = mpImplLB->GetCurrentPos(); + sal_uInt16 nStart = mpImplLB->GetCurrentPos(); if ( nStart == LISTBOX_ENTRY_NOTFOUND ) nStart = 0; - BOOL bForward = TRUE; + sal_Bool bForward = sal_True; if ( eAction == AUTOCOMPLETE_TABFORWARD ) nStart++; else if ( eAction == AUTOCOMPLETE_TABBACKWARD ) { - bForward = FALSE; + bForward = sal_False; nStart = nStart ? nStart - 1 : mpImplLB->GetEntryList()->GetEntryCount()-1; } - USHORT nPos = LISTBOX_ENTRY_NOTFOUND; + sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND; if( ! mbMatchCase ) { // Try match case insensitive from current position - nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, nStart, bForward, TRUE ); + nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, nStart, bForward, sal_True ); if ( nPos == LISTBOX_ENTRY_NOTFOUND ) // Try match case insensitive, but from start - nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, bForward ? 0 : (mpImplLB->GetEntryList()->GetEntryCount()-1), bForward, TRUE ); + nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, bForward ? 0 : (mpImplLB->GetEntryList()->GetEntryCount()-1), bForward, sal_True ); } if ( nPos == LISTBOX_ENTRY_NOTFOUND ) // Try match full from current position - nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, nStart, bForward, FALSE ); + nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, nStart, bForward, sal_False ); if ( nPos == LISTBOX_ENTRY_NOTFOUND ) // Match full, but from start - nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, bForward ? 0 : (mpImplLB->GetEntryList()->GetEntryCount()-1), bForward, FALSE ); + nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, bForward ? 0 : (mpImplLB->GetEntryList()->GetEntryCount()-1), bForward, sal_False ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) { @@ -387,8 +387,8 @@ IMPL_LINK( ComboBox, ImplAutocompleteHdl, Edit*, pEdit ) IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG ) { - BOOL bPopup = IsInDropDown(); - BOOL bCallSelect = FALSE; + sal_Bool bPopup = IsInDropDown(); + sal_Bool bCallSelect = sal_False; if ( mpImplLB->IsSelectionChanged() || bPopup ) { XubString aText; @@ -404,7 +404,7 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG ) XubString aToken = aText.GetToken( 0, mcMultiSep, nIndex ); xub_StrLen nTokenLen = aToken.Len(); aToken.EraseLeadingAndTrailingChars( ' ' ); - USHORT nP = mpImplLB->GetEntryList()->FindEntry( aToken ); + sal_uInt16 nP = mpImplLB->GetEntryList()->FindEntry( aToken ); if ( (nP != LISTBOX_ENTRY_NOTFOUND) && (!mpImplLB->GetEntryList()->IsEntryPosSelected( nP )) ) { aText.Erase( nPrevIndex, nTokenLen ); @@ -421,10 +421,10 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG ) // Fehlende Eintraege anhaengen... Table aSelInText; lcl_GetSelectedEntries( aSelInText, aText, mcMultiSep, mpImplLB->GetEntryList() ); - USHORT nSelectedEntries = mpImplLB->GetEntryList()->GetSelectEntryCount(); - for ( USHORT n = 0; n < nSelectedEntries; n++ ) + sal_uInt16 nSelectedEntries = mpImplLB->GetEntryList()->GetSelectEntryCount(); + for ( sal_uInt16 n = 0; n < nSelectedEntries; n++ ) { - USHORT nP = mpImplLB->GetEntryList()->GetSelectEntryPos( n ); + sal_uInt16 nP = mpImplLB->GetEntryList()->GetSelectEntryPos( n ); if ( !aSelInText.IsKeyValid( ImplCreateKey( nP ) ) ) { if ( aText.Len() && (aText.GetChar( aText.Len()-1 ) != mcMultiSep) ) @@ -450,7 +450,7 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG ) aNewSelection.Min() = aText.Len(); mpSubEdit->SetSelection( aNewSelection ); - bCallSelect = TRUE; + bCallSelect = sal_True; } // #84652# Call GrabFocus and EndPopupMode before calling Select/Modify, but after changing the text @@ -465,9 +465,9 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG ) if ( bCallSelect ) { mpSubEdit->SetModifyFlag(); - mbSyntheticModify = TRUE; + mbSyntheticModify = sal_True; Modify(); - mbSyntheticModify = FALSE; + mbSyntheticModify = sal_False; if (ImplGetWindowImpl() != NULL) //liuchen 2009-7-28, resolve the problem that soffice get crashed if in ComboBox_Change event a Worksheets("SheetX").Activate sentence needs to be executed { Select(); @@ -493,7 +493,7 @@ IMPL_LINK( ComboBox, ImplSelectionChangedHdl, void*, n ) { if ( !mpImplLB->IsTrackingSelect() ) { - USHORT nChanged = (USHORT)(ULONG)n; + sal_uInt16 nChanged = (sal_uInt16)(sal_uLong)n; if ( !mpSubEdit->IsReadOnly() && mpImplLB->GetEntryList()->IsEntryPosSelected( nChanged ) ) mpSubEdit->SetText( mpImplLB->GetEntryList()->GetEntryText( nChanged ) ); } @@ -522,11 +522,11 @@ void ComboBox::ToggleDropDown() if ( !mpImplLB->GetEntryList()->GetMRUCount() ) ImplUpdateFloatSelection(); else - mpImplLB->SelectEntry( 0 , TRUE ); + mpImplLB->SelectEntry( 0 , sal_True ); ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN ); - mpBtn->SetPressed( TRUE ); + mpBtn->SetPressed( sal_True ); SetSelection( Selection( 0, SELECTION_MAX ) ); - mpFloatWin->StartFloat( TRUE ); + mpFloatWin->StartFloat( sal_True ); ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); } } @@ -548,7 +548,7 @@ void ComboBox::DoubleClick() // ----------------------------------------------------------------------- -void ComboBox::EnableAutoSize( BOOL bAuto ) +void ComboBox::EnableAutoSize( sal_Bool bAuto ) { mbDDAutoSize = bAuto; if ( mpFloatWin ) @@ -562,7 +562,7 @@ void ComboBox::EnableAutoSize( BOOL bAuto ) // ----------------------------------------------------------------------- -void ComboBox::EnableDDAutoWidth( BOOL b ) +void ComboBox::EnableDDAutoWidth( sal_Bool b ) { if ( mpFloatWin ) mpFloatWin->SetAutoWidth( b ); @@ -570,15 +570,15 @@ void ComboBox::EnableDDAutoWidth( BOOL b ) // ----------------------------------------------------------------------- -BOOL ComboBox::IsDDAutoWidthEnabled() const +sal_Bool ComboBox::IsDDAutoWidthEnabled() const { - return mpFloatWin ? mpFloatWin->IsAutoWidth() : FALSE; + return mpFloatWin ? mpFloatWin->IsAutoWidth() : sal_False; } // ----------------------------------------------------------------------- -void ComboBox::SetDropDownLineCount( USHORT nLines ) +void ComboBox::SetDropDownLineCount( sal_uInt16 nLines ) { if ( mpFloatWin ) mpFloatWin->SetDropDownLineCount( nLines ); @@ -586,9 +586,9 @@ void ComboBox::SetDropDownLineCount( USHORT nLines ) // ----------------------------------------------------------------------- -USHORT ComboBox::GetDropDownLineCount() const +sal_uInt16 ComboBox::GetDropDownLineCount() const { - USHORT nLines = 0; + sal_uInt16 nLines = 0; if ( mpFloatWin ) nLines = mpFloatWin->GetDropDownLineCount(); return nLines; @@ -597,7 +597,7 @@ USHORT ComboBox::GetDropDownLineCount() const // ----------------------------------------------------------------------- void ComboBox::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, - USHORT nFlags ) + sal_uInt16 nFlags ) { if( IsDropDownBox() && ( nFlags & WINDOW_POSSIZE_SIZE ) ) { @@ -758,7 +758,7 @@ void ComboBox::StateChanged( StateChangedType nType ) else if ( nType == STATE_CHANGE_STYLE ) { SetStyle( ImplInitStyle( GetStyle() ) ); - mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE ); + mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? sal_True : sal_False ); } else if( nType == STATE_CHANGE_MIRRORING ) { @@ -813,7 +813,7 @@ long ComboBox::Notify( NotifyEvent& rNEvt ) && !IsReadOnly() ) { KeyEvent aKeyEvt = *rNEvt.GetKeyEvent(); - USHORT nKeyCode = aKeyEvt.GetKeyCode().GetCode(); + sal_uInt16 nKeyCode = aKeyEvt.GetKeyCode().GetCode(); switch( nKeyCode ) { case KEY_UP: @@ -825,11 +825,11 @@ long ComboBox::Notify( NotifyEvent& rNEvt ) if( ( nKeyCode == KEY_DOWN ) && mpFloatWin && !mpFloatWin->IsInPopupMode() && aKeyEvt.GetKeyCode().IsMod2() ) { ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN ); - mpBtn->SetPressed( TRUE ); + mpBtn->SetPressed( sal_True ); if ( mpImplLB->GetEntryList()->GetMRUCount() ) - mpImplLB->SelectEntry( 0 , TRUE ); + mpImplLB->SelectEntry( 0 , sal_True ); SetSelection( Selection( 0, SELECTION_MAX ) ); - mpFloatWin->StartFloat( FALSE ); + mpFloatWin->StartFloat( sal_False ); ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); nDone = 1; } @@ -860,14 +860,14 @@ long ComboBox::Notify( NotifyEvent& rNEvt ) { if( mpFloatWin->HasChildPathFocus() ) mpSubEdit->GrabFocus(); - else if ( mpFloatWin->IsInPopupMode() && !HasChildPathFocus( TRUE ) ) + else if ( mpFloatWin->IsInPopupMode() && !HasChildPathFocus( sal_True ) ) mpFloatWin->EndPopupMode(); } else if( (rNEvt.GetType() == EVENT_COMMAND) && (rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL) && (rNEvt.GetWindow() == mpSubEdit) ) { - USHORT nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() ); + sal_uInt16 nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() ); if ( ( nWheelBehavior == MOUSE_WHEEL_ALWAYS ) || ( ( nWheelBehavior == MOUSE_WHEEL_FOCUS_ONLY ) && HasChildPathFocus() @@ -924,12 +924,12 @@ void ComboBox::Modify() void ComboBox::ImplUpdateFloatSelection() { // Text in der ListBox in den sichtbaren Bereich bringen - mpImplLB->SetCallSelectionChangedHdl( FALSE ); + mpImplLB->SetCallSelectionChangedHdl( sal_False ); if ( !IsMultiSelectionEnabled() ) { XubString aSearchStr( mpSubEdit->GetText() ); - USHORT nSelect = LISTBOX_ENTRY_NOTFOUND; - BOOL bSelect = TRUE; + sal_uInt16 nSelect = LISTBOX_ENTRY_NOTFOUND; + sal_Bool bSelect = sal_True; if ( mpImplLB->GetCurrentPos() != LISTBOX_ENTRY_NOTFOUND ) { @@ -943,7 +943,7 @@ void ComboBox::ImplUpdateFloatSelection() if ( nSelect == LISTBOX_ENTRY_NOTFOUND ) { nSelect = mpImplLB->GetEntryList()->FindMatchingEntry( aSearchStr ); - bSelect = FALSE; + bSelect = sal_False; } if( nSelect != LISTBOX_ENTRY_NOTFOUND ) @@ -956,7 +956,7 @@ void ComboBox::ImplUpdateFloatSelection() { nSelect = mpImplLB->GetEntryList()->GetSelectEntryPos( 0 ); if( nSelect != LISTBOX_ENTRY_NOTFOUND ) - mpImplLB->SelectEntry( nSelect, FALSE ); + mpImplLB->SelectEntry( nSelect, sal_False ); mpImplLB->ResetCurrentPos(); } } @@ -964,28 +964,28 @@ void ComboBox::ImplUpdateFloatSelection() { Table aSelInText; lcl_GetSelectedEntries( aSelInText, mpSubEdit->GetText(), mcMultiSep, mpImplLB->GetEntryList() ); - for ( USHORT n = 0; n < mpImplLB->GetEntryList()->GetEntryCount(); n++ ) + for ( sal_uInt16 n = 0; n < mpImplLB->GetEntryList()->GetEntryCount(); n++ ) mpImplLB->SelectEntry( n, aSelInText.IsKeyValid( ImplCreateKey( n ) ) ); } - mpImplLB->SetCallSelectionChangedHdl( TRUE ); + mpImplLB->SetCallSelectionChangedHdl( sal_True ); } // ----------------------------------------------------------------------- -USHORT ComboBox::InsertEntry( const XubString& rStr, USHORT nPos ) +sal_uInt16 ComboBox::InsertEntry( const XubString& rStr, sal_uInt16 nPos ) { - USHORT nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr ); - nRealPos = sal::static_int_cast<USHORT>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount()); + sal_uInt16 nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr ); + nRealPos = sal::static_int_cast<sal_uInt16>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount()); CallEventListeners( VCLEVENT_COMBOBOX_ITEMADDED, (void*) sal_IntPtr(nRealPos) ); return nRealPos; } // ----------------------------------------------------------------------- -USHORT ComboBox::InsertEntry( const XubString& rStr, const Image& rImage, USHORT nPos ) +sal_uInt16 ComboBox::InsertEntry( const XubString& rStr, const Image& rImage, sal_uInt16 nPos ) { - USHORT nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr, rImage ); - nRealPos = sal::static_int_cast<USHORT>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount()); + sal_uInt16 nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr, rImage ); + nRealPos = sal::static_int_cast<sal_uInt16>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount()); CallEventListeners( VCLEVENT_COMBOBOX_ITEMADDED, (void*) sal_IntPtr(nRealPos) ); return nRealPos; } @@ -999,7 +999,7 @@ void ComboBox::RemoveEntry( const XubString& rStr ) // ----------------------------------------------------------------------- -void ComboBox::RemoveEntry( USHORT nPos ) +void ComboBox::RemoveEntry( sal_uInt16 nPos ) { mpImplLB->RemoveEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); CallEventListeners( VCLEVENT_COMBOBOX_ITEMREMOVED, (void*) sal_IntPtr(nPos) ); @@ -1014,7 +1014,7 @@ void ComboBox::Clear() } // ----------------------------------------------------------------------- -Image ComboBox::GetEntryImage( USHORT nPos ) const +Image ComboBox::GetEntryImage( sal_uInt16 nPos ) const { if ( mpImplLB->GetEntryList()->HasEntryImage( nPos ) ) return mpImplLB->GetEntryList()->GetEntryImage( nPos ); @@ -1023,70 +1023,70 @@ Image ComboBox::GetEntryImage( USHORT nPos ) const // ----------------------------------------------------------------------- -USHORT ComboBox::GetEntryPos( const XubString& rStr ) const +sal_uInt16 ComboBox::GetEntryPos( const XubString& rStr ) const { - USHORT nPos = mpImplLB->GetEntryList()->FindEntry( rStr ); + sal_uInt16 nPos = mpImplLB->GetEntryList()->FindEntry( rStr ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - nPos = sal::static_int_cast<USHORT>(nPos - mpImplLB->GetEntryList()->GetMRUCount()); + nPos = sal::static_int_cast<sal_uInt16>(nPos - mpImplLB->GetEntryList()->GetMRUCount()); return nPos; } // ----------------------------------------------------------------------- -USHORT ComboBox::GetEntryPos( const void* pData ) const +sal_uInt16 ComboBox::GetEntryPos( const void* pData ) const { - USHORT nPos = mpImplLB->GetEntryList()->FindEntry( pData ); + sal_uInt16 nPos = mpImplLB->GetEntryList()->FindEntry( pData ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - nPos = sal::static_int_cast<USHORT>(nPos - mpImplLB->GetEntryList()->GetMRUCount()); + nPos = sal::static_int_cast<sal_uInt16>(nPos - mpImplLB->GetEntryList()->GetMRUCount()); return nPos; } // ----------------------------------------------------------------------- -XubString ComboBox::GetEntry( USHORT nPos ) const +XubString ComboBox::GetEntry( sal_uInt16 nPos ) const { return mpImplLB->GetEntryList()->GetEntryText( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); } // ----------------------------------------------------------------------- -USHORT ComboBox::GetEntryCount() const +sal_uInt16 ComboBox::GetEntryCount() const { return mpImplLB->GetEntryList()->GetEntryCount() - mpImplLB->GetEntryList()->GetMRUCount(); } // ----------------------------------------------------------------------- -BOOL ComboBox::IsTravelSelect() const +sal_Bool ComboBox::IsTravelSelect() const { return mpImplLB->IsTravelSelect(); } // ----------------------------------------------------------------------- -BOOL ComboBox::IsInDropDown() const +sal_Bool ComboBox::IsInDropDown() const { return mpFloatWin && mpFloatWin->IsInPopupMode(); } // ----------------------------------------------------------------------- -void ComboBox::EnableMultiSelection( BOOL bMulti ) +void ComboBox::EnableMultiSelection( sal_Bool bMulti ) { - mpImplLB->EnableMultiSelection( bMulti, FALSE ); - mpImplLB->SetMultiSelectionSimpleMode( TRUE ); + mpImplLB->EnableMultiSelection( bMulti, sal_False ); + mpImplLB->SetMultiSelectionSimpleMode( sal_True ); } // ----------------------------------------------------------------------- -BOOL ComboBox::IsMultiSelectionEnabled() const +sal_Bool ComboBox::IsMultiSelectionEnabled() const { return mpImplLB->IsMultiSelectionEnabled(); } // ----------------------------------------------------------------------- -long ComboBox::CalcWindowSizePixel( USHORT nLines ) const +long ComboBox::CalcWindowSizePixel( sal_uInt16 nLines ) const { return mpImplLB->GetEntryHeight() * nLines; } @@ -1153,7 +1153,7 @@ Size ComboBox::CalcAdjustedSize( const Size& rPrefSize ) const // ----------------------------------------------------------------------- -Size ComboBox::CalcSize( USHORT nColumns, USHORT nLines ) const +Size ComboBox::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const { // ggf. werden ScrollBars eingeblendet Size aMinSz = CalcMinimumSize(); @@ -1193,28 +1193,28 @@ Size ComboBox::CalcSize( USHORT nColumns, USHORT nLines ) const // ----------------------------------------------------------------------- -void ComboBox::GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const +void ComboBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const { long nCharWidth = GetTextWidth( UniString( 'x' ) ); if ( !IsDropDownBox() ) { Size aOutSz = mpImplLB->GetMainWindow()->GetOutputSizePixel(); - rnCols = (USHORT)(aOutSz.Width()/nCharWidth); - rnLines = (USHORT)(aOutSz.Height()/mpImplLB->GetEntryHeight()); + rnCols = (sal_uInt16)(aOutSz.Width()/nCharWidth); + rnLines = (sal_uInt16)(aOutSz.Height()/mpImplLB->GetEntryHeight()); } else { Size aOutSz = mpSubEdit->GetOutputSizePixel(); - rnCols = (USHORT)(aOutSz.Width()/nCharWidth); + rnCols = (sal_uInt16)(aOutSz.Width()/nCharWidth); rnLines = 1; } } // ----------------------------------------------------------------------- -void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ) +void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { - mpImplLB->GetMainWindow()->ImplInitSettings( TRUE, TRUE, TRUE ); + mpImplLB->GetMainWindow()->ImplInitSettings( sal_True, sal_True, sal_True ); Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -1229,8 +1229,8 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, U // Border/Background pDev->SetLineColor(); pDev->SetFillColor(); - BOOL bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER); - BOOL bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground(); + sal_Bool bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER); + sal_Bool bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground(); if ( bBorder || bBackground ) { Rectangle aRect( aPos, aSize ); @@ -1252,7 +1252,7 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, U long nOnePixel = GetDrawPixel( pDev, 1 ); long nTextHeight = pDev->GetTextHeight(); long nEditHeight = nTextHeight + 6*nOnePixel; - USHORT nTextStyle = TEXT_DRAW_VCENTER; + sal_uInt16 nTextStyle = TEXT_DRAW_VCENTER; // First, draw the edit part mpSubEdit->Draw( pDev, aPos, Size( aSize.Width(), nEditHeight ), nFlags ); @@ -1284,10 +1284,10 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, U Rectangle aClip( aPos, aSize ); pDev->IntersectClipRegion( aClip ); - USHORT nLines = (USHORT) ( (aSize.Height()-nEditHeight) / nTextHeight ); + sal_uInt16 nLines = (sal_uInt16) ( (aSize.Height()-nEditHeight) / nTextHeight ); if ( !nLines ) nLines = 1; - USHORT nTEntry = IsReallyVisible() ? mpImplLB->GetTopEntry() : 0; + sal_uInt16 nTEntry = IsReallyVisible() ? mpImplLB->GetTopEntry() : 0; Rectangle aTextRect( aPos, aSize ); @@ -1297,7 +1297,7 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, U aTextRect.Bottom() = aTextRect.Top() + nTextHeight; // the drawing starts here - for ( USHORT n = 0; n < nLines; n++ ) + for ( sal_uInt16 n = 0; n < nLines; n++ ) { pDev->DrawText( aTextRect, mpImplLB->GetEntryList()->GetEntryText( n+nTEntry ), nTextStyle ); aTextRect.Top() += nTextHeight; @@ -1346,21 +1346,21 @@ const Size& ComboBox::GetUserItemSize() const // ----------------------------------------------------------------------- -void ComboBox::EnableUserDraw( BOOL bUserDraw ) +void ComboBox::EnableUserDraw( sal_Bool bUserDraw ) { mpImplLB->GetMainWindow()->EnableUserDraw( bUserDraw ); } // ----------------------------------------------------------------------- -BOOL ComboBox::IsUserDrawEnabled() const +sal_Bool ComboBox::IsUserDrawEnabled() const { return mpImplLB->GetMainWindow()->IsUserDrawEnabled(); } // ----------------------------------------------------------------------- -void ComboBox::DrawEntry( const UserDrawEvent& rEvt, BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos ) +void ComboBox::DrawEntry( const UserDrawEvent& rEvt, sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos ) { DBG_ASSERT( rEvt.GetDevice() == mpImplLB->GetMainWindow(), "DrawEntry?!" ); mpImplLB->GetMainWindow()->DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos ); @@ -1368,7 +1368,7 @@ void ComboBox::DrawEntry( const UserDrawEvent& rEvt, BOOL bDrawImage, BOOL bDraw // ----------------------------------------------------------------------- -void ComboBox::SetSeparatorPos( USHORT n ) +void ComboBox::SetSeparatorPos( sal_uInt16 n ) { mpImplLB->SetSeparatorPos( n ); } @@ -1382,7 +1382,7 @@ void ComboBox::SetSeparatorPos() // ----------------------------------------------------------------------- -USHORT ComboBox::GetSeparatorPos() const +sal_uInt16 ComboBox::GetSeparatorPos() const { return mpImplLB->GetSeparatorPos(); } @@ -1403,58 +1403,58 @@ XubString ComboBox::GetMRUEntries( xub_Unicode cSep ) const // ----------------------------------------------------------------------- -void ComboBox::SetMaxMRUCount( USHORT n ) +void ComboBox::SetMaxMRUCount( sal_uInt16 n ) { mpImplLB->SetMaxMRUCount( n ); } // ----------------------------------------------------------------------- -USHORT ComboBox::GetMaxMRUCount() const +sal_uInt16 ComboBox::GetMaxMRUCount() const { return mpImplLB->GetMaxMRUCount(); } // ----------------------------------------------------------------------- -USHORT ComboBox::GetDisplayLineCount() const +sal_uInt16 ComboBox::GetDisplayLineCount() const { return mpImplLB->GetDisplayLineCount(); } // ----------------------------------------------------------------------- -void ComboBox::SetEntryData( USHORT nPos, void* pNewData ) +void ComboBox::SetEntryData( sal_uInt16 nPos, void* pNewData ) { mpImplLB->SetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount(), pNewData ); } // ----------------------------------------------------------------------- -void* ComboBox::GetEntryData( USHORT nPos ) const +void* ComboBox::GetEntryData( sal_uInt16 nPos ) const { return mpImplLB->GetEntryList()->GetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); } // ----------------------------------------------------------------------- -void ComboBox::SetTopEntry( USHORT nPos ) +void ComboBox::SetTopEntry( sal_uInt16 nPos ) { mpImplLB->SetTopEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); } // ----------------------------------------------------------------------- -void ComboBox::ShowProminentEntry( USHORT nPos ) +void ComboBox::ShowProminentEntry( sal_uInt16 nPos ) { mpImplLB->ShowProminentEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); } // ----------------------------------------------------------------------- -USHORT ComboBox::GetTopEntry() const +sal_uInt16 ComboBox::GetTopEntry() const { - USHORT nPos = GetEntryCount() ? mpImplLB->GetTopEntry() : LISTBOX_ENTRY_NOTFOUND; + sal_uInt16 nPos = GetEntryCount() ? mpImplLB->GetTopEntry() : LISTBOX_ENTRY_NOTFOUND; if ( nPos < mpImplLB->GetEntryList()->GetMRUCount() ) nPos = 0; return nPos; @@ -1504,29 +1504,29 @@ const Wallpaper& ComboBox::GetDisplayBackground() const return rBack; } // ----------------------------------------------------------------------------- -USHORT ComboBox::GetSelectEntryCount() const +sal_uInt16 ComboBox::GetSelectEntryCount() const { return mpImplLB->GetEntryList()->GetSelectEntryCount(); } // ----------------------------------------------------------------------------- -USHORT ComboBox::GetSelectEntryPos( USHORT nIndex ) const +sal_uInt16 ComboBox::GetSelectEntryPos( sal_uInt16 nIndex ) const { - USHORT nPos = mpImplLB->GetEntryList()->GetSelectEntryPos( nIndex ); + sal_uInt16 nPos = mpImplLB->GetEntryList()->GetSelectEntryPos( nIndex ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) { if ( nPos < mpImplLB->GetEntryList()->GetMRUCount() ) nPos = mpImplLB->GetEntryList()->FindEntry( mpImplLB->GetEntryList()->GetEntryText( nPos ) ); - nPos = sal::static_int_cast<USHORT>(nPos - mpImplLB->GetEntryList()->GetMRUCount()); + nPos = sal::static_int_cast<sal_uInt16>(nPos - mpImplLB->GetEntryList()->GetMRUCount()); } return nPos; } // ----------------------------------------------------------------------------- -BOOL ComboBox::IsEntryPosSelected( USHORT nPos ) const +sal_Bool ComboBox::IsEntryPosSelected( sal_uInt16 nPos ) const { return mpImplLB->GetEntryList()->IsEntryPosSelected( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); } // ----------------------------------------------------------------------------- -void ComboBox::SelectEntryPos( USHORT nPos, BOOL bSelect) +void ComboBox::SelectEntryPos( sal_uInt16 nPos, sal_Bool bSelect) { if ( nPos < mpImplLB->GetEntryList()->GetEntryCount() ) mpImplLB->SelectEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), bSelect ); @@ -1538,7 +1538,7 @@ void ComboBox::SetNoSelection() mpSubEdit->SetText( String() ); } // ----------------------------------------------------------------------------- -Rectangle ComboBox::GetBoundingRectangle( USHORT nItem ) const +Rectangle ComboBox::GetBoundingRectangle( sal_uInt16 nItem ) const { Rectangle aRect = mpImplLB->GetMainWindow()->GetBoundingRectangle( nItem ); Rectangle aOffset = mpImplLB->GetMainWindow()->GetWindowExtentsRelative( (Window*)this ); @@ -1547,7 +1547,7 @@ Rectangle ComboBox::GetBoundingRectangle( USHORT nItem ) const } // ----------------------------------------------------------------------------- -void ComboBox::SetBorderStyle( USHORT nBorderStyle ) +void ComboBox::SetBorderStyle( sal_uInt16 nBorderStyle ) { Window::SetBorderStyle( nBorderStyle ); if ( !IsDropDownBox() ) @@ -1558,7 +1558,7 @@ void ComboBox::SetBorderStyle( USHORT nBorderStyle ) } // ----------------------------------------------------------------------------- -long ComboBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const +long ComboBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rPos ) const { if( !HasLayoutData() ) FillLayoutData(); @@ -1578,7 +1578,7 @@ long ComboBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const aConvPoint = pMain->PixelToLogic( aConvPoint ); // try to find entry - USHORT nEntry = pMain->GetEntryPosForPoint( aConvPoint ); + sal_uInt16 nEntry = pMain->GetEntryPosForPoint( aConvPoint ); if( nEntry == LISTBOX_ENTRY_NOTFOUND ) nIndex = -1; else diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index ad45da3b706e..99cd6b3cba60 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -48,7 +48,7 @@ using namespace vcl; void Control::ImplInitControlData() { - mbHasFocus = FALSE; + mbHasFocus = sal_False; mpControlData = new ImplControlData; } @@ -304,10 +304,10 @@ long Control::Notify( NotifyEvent& rNEvt ) { if ( !mbHasFocus ) { - mbHasFocus = TRUE; + mbHasFocus = sal_True; if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_GETFOCUS, maGetFocusHdl, this ) ) // been destroyed within the handler - return TRUE; + return sal_True; } } else @@ -317,10 +317,10 @@ long Control::Notify( NotifyEvent& rNEvt ) Window* pFocusWin = Application::GetFocusWindow(); if ( !pFocusWin || !ImplIsWindowOrChild( pFocusWin ) ) { - mbHasFocus = FALSE; + mbHasFocus = sal_False; if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_LOSEFOCUS, maLoseFocusHdl, this ) ) // been destroyed within the handler - return TRUE; + return sal_True; } } } @@ -373,7 +373,7 @@ void Control::AppendLayoutData( const Control& rSubControl ) const // ----------------------------------------------------------------- -BOOL Control::ImplCallEventListenersAndHandler( ULONG nEvent, const Link& rHandler, void* pCaller ) +sal_Bool Control::ImplCallEventListenersAndHandler( sal_uLong nEvent, const Link& rHandler, void* pCaller ) { ImplDelData aCheckDelete; ImplAddDel( &aCheckDelete ); @@ -386,10 +386,10 @@ BOOL Control::ImplCallEventListenersAndHandler( ULONG nEvent, const Link& rHand if ( !aCheckDelete.IsDelete() ) { ImplRemoveDel( &aCheckDelete ); - return FALSE; + return sal_False; } } - return TRUE; + return sal_True; } // ----------------------------------------------------------------- @@ -448,8 +448,8 @@ void Control::DataChanged( const DataChangedEvent& rDCEvt) { AllSettings aSettings = GetSettings(); StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - ULONG nOldOptions = rDCEvt.GetOldSettings()->GetStyleSettings().GetOptions(); - ULONG nNewOptions = aStyleSettings.GetOptions(); + sal_uLong nOldOptions = rDCEvt.GetOldSettings()->GetStyleSettings().GetOptions(); + sal_uLong nNewOptions = aStyleSettings.GetOptions(); if ( !(nNewOptions & STYLE_OPTION_MONO) && ( nOldOptions & STYLE_OPTION_MONO ) ) { @@ -518,7 +518,7 @@ const Color& Control::GetCanonicalTextColor( const StyleSettings& _rStyle ) cons } // ----------------------------------------------------------------- -void Control::ImplInitSettings( const BOOL _bFont, const BOOL _bForeground ) +void Control::ImplInitSettings( const sal_Bool _bFont, const sal_Bool _bForeground ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -545,7 +545,7 @@ void Control::ImplInitSettings( const BOOL _bFont, const BOOL _bForeground ) // ----------------------------------------------------------------- void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const XubString& _rStr, - USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) const + sal_uInt16 _nStyle, MetricVector* _pVector, String* _pDisplayText ) const { #ifdef FS_DEBUG if ( !_pVector ) diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 15ce9476cdd1..41d5ca198cf2 100644..100755 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -113,17 +113,19 @@ struct DDInfo Cursor aCursor; Selection aDndStartSel; xub_StrLen nDropPos; - BOOL bStarterOfDD; - BOOL bDroppedInMe; - BOOL bVisCursor; + sal_Bool bStarterOfDD; + sal_Bool bDroppedInMe; + sal_Bool bVisCursor; + sal_Bool bIsStringSupported; DDInfo() { aCursor.SetStyle( CURSOR_SHADOW ); nDropPos = 0; - bStarterOfDD = FALSE; - bDroppedInMe = FALSE; - bVisCursor = FALSE; + bStarterOfDD = sal_False; + bDroppedInMe = sal_False; + bVisCursor = sal_False; + bIsStringSupported = sal_False; } }; @@ -132,11 +134,11 @@ struct DDInfo struct Impl_IMEInfos { String aOldTextAfterStartPos; - USHORT* pAttribs; + sal_uInt16* pAttribs; xub_StrLen nPos; xub_StrLen nLen; - BOOL bCursor; - BOOL bWasCursorOverwrite; + sal_Bool bCursor; + sal_Bool bWasCursorOverwrite; Impl_IMEInfos( xub_StrLen nPos, const String& rOldTextAfterStartPos ); ~Impl_IMEInfos(); @@ -152,9 +154,9 @@ Impl_IMEInfos::Impl_IMEInfos( xub_StrLen nP, const String& rOldTextAfterStartPos { nPos = nP; nLen = 0; - bCursor = TRUE; + bCursor = sal_True; pAttribs = NULL; - bWasCursorOverwrite = FALSE; + bWasCursorOverwrite = sal_False; } // ----------------------------------------------------------------------- @@ -170,8 +172,8 @@ void Impl_IMEInfos::CopyAttribs( const xub_StrLen* pA, xub_StrLen nL ) { nLen = nL; delete[] pAttribs; - pAttribs = new USHORT[ nL ]; - rtl_copyMemory( pAttribs, pA, nL*sizeof(USHORT) ); + pAttribs = new sal_uInt16[ nL ]; + rtl_copyMemory( pAttribs, pA, nL*sizeof(sal_uInt16) ); } // ----------------------------------------------------------------------- @@ -228,7 +230,7 @@ Edit::Edit( Window* pParent, const ResId& rResId, bool bDisableAccessibleLabeled ImplInit( pParent, nStyle ); ImplLoadRes( rResId ); if ( bDisableAccessibleLabeledByRelation ) - ImplGetWindowImpl()->mbDisableAccessibleLabeledByRelation = TRUE; + ImplGetWindowImpl()->mbDisableAccessibleLabeledByRelation = sal_True; // Derived MultiLineEdit takes care to call Show only after MultiLineEdit // ctor has already started: @@ -281,21 +283,21 @@ void Edit::ImplInitEditData() mnAlign = EDIT_ALIGN_LEFT; mnMaxTextLen = EDIT_NOLIMIT; meAutocompleteAction = AUTOCOMPLETE_KEYINPUT; - mbModified = FALSE; - mbInternModified = FALSE; - mbReadOnly = FALSE; - mbInsertMode = TRUE; - mbClickedInSelection = FALSE; - mbActivePopup = FALSE; - mbIsSubEdit = FALSE; - mbInMBDown = FALSE; + mbModified = sal_False; + mbInternModified = sal_False; + mbReadOnly = sal_False; + mbInsertMode = sal_True; + mbClickedInSelection = sal_False; + mbActivePopup = sal_False; + mbIsSubEdit = sal_False; + mbInMBDown = sal_False; mpDDInfo = NULL; mpIMEInfos = NULL; mcEchoChar = 0; // --- RTL --- no default mirroring for Edit controls // note: controls that use a subedit will revert this (SpinField, ComboBox) - EnableRTL( FALSE ); + EnableRTL( sal_False ); vcl::unohelper::DragAndDropWrapper* pDnDWrapper = new vcl::unohelper::DragAndDropWrapper( this ); mxDnDListener = pDnDWrapper; @@ -342,7 +344,7 @@ void Edit::ImplInit( Window* pParent, WinBits nStyle ) SetCursor( new Cursor ); SetPointer( Pointer( POINTER_TEXT ) ); - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); uno::Reference< datatransfer::dnd::XDragGestureListener> xDGL( mxDnDListener, uno::UNO_QUERY ); uno::Reference< datatransfer::dnd::XDragGestureRecognizer > xDGR = GetDragGestureRecognizer(); @@ -370,7 +372,7 @@ WinBits Edit::ImplInitStyle( WinBits nStyle ) // ----------------------------------------------------------------------- -BOOL Edit::IsCharInput( const KeyEvent& rKeyEvent ) +sal_Bool Edit::IsCharInput( const KeyEvent& rKeyEvent ) { // In the future we must use new Unicode functions for this xub_Unicode cCharCode = rKeyEvent.GetCharCode(); @@ -384,13 +386,13 @@ BOOL Edit::IsCharInput( const KeyEvent& rKeyEvent ) void Edit::ImplModified() { - mbModified = TRUE; + mbModified = sal_True; Modify(); } // ----------------------------------------------------------------------- -void Edit::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) +void Edit::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -537,7 +539,7 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout ) } Cursor* pCursor = GetCursor(); - BOOL bVisCursor = pCursor ? pCursor->IsVisible() : FALSE; + sal_Bool bVisCursor = pCursor ? pCursor->IsVisible() : sal_False; if ( pCursor ) pCursor->Hide(); @@ -545,7 +547,7 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout ) const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if ( IsEnabled() ) - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); else SetTextColor( rStyleSettings.GetDisableColor() ); @@ -566,7 +568,7 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout ) else SetTextFillColor( IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor() ); - BOOL bDrawSelection = maSelection.Len() && ( HasFocus() || ( GetStyle() & WB_NOHIDESELECTION ) || mbActivePopup ); + sal_Bool bDrawSelection = maSelection.Len() && ( HasFocus() || ( GetStyle() & WB_NOHIDESELECTION ) || mbActivePopup ); long nPos = nStart ? pDX[2*nStart] : 0; aPos.X() = nPos + mnXOffset + ImplGetExtraOffset(); @@ -656,7 +658,7 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout ) for( i = 0; i < mpIMEInfos->nLen; ) { - USHORT nAttr = mpIMEInfos->pAttribs[i]; + sal_uInt16 nAttr = mpIMEInfos->pAttribs[i]; Region aClip; int nIndex = i; while( nIndex < mpIMEInfos->nLen && mpIMEInfos->pAttribs[nIndex] == nAttr) // #112631# check nIndex before using it @@ -712,7 +714,7 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout ) // ----------------------------------------------------------------------- -void Edit::ImplDelete( const Selection& rSelection, BYTE nDirection, BYTE nMode ) +void Edit::ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uInt8 nMode ) { XubString aText = ImplGetText(); @@ -772,7 +774,7 @@ void Edit::ImplDelete( const Selection& rSelection, BYTE nDirection, BYTE nMode maSelection.Min() = aSelection.Min(); maSelection.Max() = aSelection.Min(); ImplAlignAndPaint(); - mbInternModified = TRUE; + mbInternModified = sal_True; } // ----------------------------------------------------------------------- @@ -787,19 +789,19 @@ String Edit::ImplGetValidString( const String& rString ) const } // ----------------------------------------------------------------------- -Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const +uno::Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const { //!! since we don't want to become incompatible in the next minor update //!! where this code will get integrated into, xISC will be a local //!! variable instead of a class member! - Reference < i18n::XBreakIterator > xBI; + uno::Reference < i18n::XBreakIterator > xBI; // if ( !xBI.is() ) { - Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference < XInterface > xI = xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator")) ); + uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + uno::Reference < XInterface > xI = xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator")) ); if ( xI.is() ) { - Any x = xI->queryInterface( ::getCppuType((const Reference< i18n::XBreakIterator >*)0) ); + Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XBreakIterator >*)0) ); x >>= xBI; } } @@ -807,19 +809,19 @@ Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const } // ----------------------------------------------------------------------- -Reference < i18n::XExtendedInputSequenceChecker > Edit::ImplGetInputSequenceChecker() const +uno::Reference < i18n::XExtendedInputSequenceChecker > Edit::ImplGetInputSequenceChecker() const { //!! since we don't want to become incompatible in the next minor update //!! where this code will get integrated into, xISC will be a local //!! variable instead of a class member! - Reference < i18n::XExtendedInputSequenceChecker > xISC; + uno::Reference < i18n::XExtendedInputSequenceChecker > xISC; // if ( !xISC.is() ) { - Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference < XInterface > xI = xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.InputSequenceChecker")) ); + uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + uno::Reference < XInterface > xI = xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.InputSequenceChecker")) ); if ( xI.is() ) { - Any x = xI->queryInterface( ::getCppuType((const Reference< i18n::XExtendedInputSequenceChecker >*)0) ); + Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XExtendedInputSequenceChecker >*)0) ); x >>= xISC; } } @@ -894,8 +896,8 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_ // get access to the configuration of this office module try { - Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference< container::XNameAccess > xModuleCfg( ::comphelper::ConfigurationHelper::openConfig( + uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + uno::Reference< container::XNameAccess > xModuleCfg( ::comphelper::ConfigurationHelper::openConfig( xMSF, sModule, ::comphelper::ConfigurationHelper::E_READONLY ), @@ -995,7 +997,7 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_ } ImplAlignAndPaint(); - mbInternModified = TRUE; + mbInternModified = sal_True; } // ----------------------------------------------------------------------- @@ -1019,7 +1021,7 @@ void Edit::ImplSetText( const XubString& rText, const Selection* pNewSelection ) ImplAlign(); if ( pNewSelection ) - ImplSetSelection( *pNewSelection, FALSE ); + ImplSetSelection( *pNewSelection, sal_False ); if ( mnXOffset && !pNewSelection ) maSelection.Max() = 0; @@ -1157,7 +1159,7 @@ void Edit::ImplClearBackground( long nXStart, long nXEnd ) // ----------------------------------------------------------------------- -void Edit::ImplShowCursor( BOOL bOnlyIfVisible ) +void Edit::ImplShowCursor( sal_Bool bOnlyIfVisible ) { if ( !IsUpdateMode() || ( bOnlyIfVisible && !IsReallyVisible() ) ) return; @@ -1350,7 +1352,7 @@ xub_StrLen Edit::ImplGetCharPos( const Point& rWindowPos ) const // ----------------------------------------------------------------------- -void Edit::ImplSetCursorPos( xub_StrLen nChar, BOOL bSelect ) +void Edit::ImplSetCursorPos( xub_StrLen nChar, sal_Bool bSelect ) { Selection aSelection( maSelection ); aSelection.Max() = nChar; @@ -1442,7 +1444,7 @@ void Edit::MouseButtonDown( const MouseEvent& rMEvt ) if ( rMEvt.GetClicks() < 4 ) { - mbClickedInSelection = FALSE; + mbClickedInSelection = sal_False; if ( rMEvt.GetClicks() == 3 ) { ImplSetSelection( Selection( 0, 0xFFFF ) ); @@ -1457,7 +1459,7 @@ void Edit::MouseButtonDown( const MouseEvent& rMEvt ) ImplCopyToSelectionClipboard(); } else if ( !rMEvt.IsShift() && HasFocus() && aSelection.IsInside( nChar ) ) - mbClickedInSelection = TRUE; + mbClickedInSelection = sal_True; else if ( rMEvt.IsLeft() ) ImplSetCursorPos( nChar, rMEvt.IsShift() ); @@ -1465,9 +1467,9 @@ void Edit::MouseButtonDown( const MouseEvent& rMEvt ) StartTracking( STARTTRACK_SCROLLREPEAT ); } - mbInMBDown = TRUE; // Dann im GetFocus nicht alles selektieren + mbInMBDown = sal_True; // Dann im GetFocus nicht alles selektieren GrabFocus(); - mbInMBDown = FALSE; + mbInMBDown = sal_False; } // ----------------------------------------------------------------------- @@ -1477,8 +1479,8 @@ void Edit::MouseButtonUp( const MouseEvent& rMEvt ) if ( mbClickedInSelection && rMEvt.IsLeft() ) { xub_StrLen nChar = ImplGetCharPos( rMEvt.GetPosPixel() ); - ImplSetCursorPos( nChar, FALSE ); - mbClickedInSelection = FALSE; + ImplSetCursorPos( nChar, sal_False ); + mbClickedInSelection = sal_False; } else if ( rMEvt.IsMiddle() && !mbReadOnly && ( GetSettings().GetMouseSettings().GetMiddleButtonAction() == MOUSE_MIDDLE_PASTESELECTION ) ) @@ -1498,8 +1500,8 @@ void Edit::Tracking( const TrackingEvent& rTEvt ) if ( mbClickedInSelection ) { xub_StrLen nChar = ImplGetCharPos( rTEvt.GetMouseEvent().GetPosPixel() ); - ImplSetCursorPos( nChar, FALSE ); - mbClickedInSelection = FALSE; + ImplSetCursorPos( nChar, sal_False ); + mbClickedInSelection = sal_False; } else if ( rTEvt.GetMouseEvent().IsLeft() ) { @@ -1511,7 +1513,7 @@ void Edit::Tracking( const TrackingEvent& rTEvt ) if( !mbClickedInSelection ) { xub_StrLen nChar = ImplGetCharPos( rTEvt.GetMouseEvent().GetPosPixel() ); - ImplSetCursorPos( nChar, TRUE ); + ImplSetCursorPos( nChar, sal_True ); } } @@ -1521,13 +1523,13 @@ void Edit::Tracking( const TrackingEvent& rTEvt ) // ----------------------------------------------------------------------- -BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) +sal_Bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) { - BOOL bDone = FALSE; - USHORT nCode = rKEvt.GetKeyCode().GetCode(); + sal_Bool bDone = sal_False; + sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); KeyFuncType eFunc = rKEvt.GetKeyCode().GetFunction(); - mbInternModified = FALSE; + mbInternModified = sal_False; if ( eFunc != KEYFUNC_DONTKNOW ) { @@ -1539,7 +1541,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) { Cut(); ImplModified(); - bDone = TRUE; + bDone = sal_True; } } break; @@ -1549,7 +1551,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) if ( !(GetStyle() & WB_PASSWORD) ) { Copy(); - bDone = TRUE; + bDone = sal_True; } } break; @@ -1559,7 +1561,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) if ( !mbReadOnly ) { Paste(); - bDone = TRUE; + bDone = sal_True; } } break; @@ -1569,7 +1571,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) if ( !mbReadOnly ) { Undo(); - bDone = TRUE; + bDone = sal_True; } } break; @@ -1584,7 +1586,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) if ( nCode == KEY_A ) { ImplSetSelection( Selection( 0, maText.Len() ) ); - bDone = TRUE; + bDone = sal_True; } else if ( rKEvt.GetKeyCode().IsShift() && (nCode == KEY_S) ) { @@ -1598,7 +1600,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) ImplInsertText( aChars ); ImplModified(); } - bDone = TRUE; + bDone = sal_True; } } } @@ -1610,7 +1612,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) case com::sun::star::awt::Key::SELECT_ALL: { ImplSetSelection( Selection( 0, maText.Len() ) ); - bDone = TRUE; + bDone = sal_True; } break; @@ -1736,7 +1738,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) } } - bDone = TRUE; + bDone = sal_True; } } break; @@ -1750,8 +1752,8 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) { if ( !mbReadOnly && !rKEvt.GetKeyCode().IsMod2() ) { - BYTE nDel = (nCode == KEY_DELETE) ? EDIT_DEL_RIGHT : EDIT_DEL_LEFT; - BYTE nMode = rKEvt.GetKeyCode().IsMod1() ? EDIT_DELMODE_RESTOFWORD : EDIT_DELMODE_SIMPLE; + sal_uInt8 nDel = (nCode == KEY_DELETE) ? EDIT_DEL_RIGHT : EDIT_DEL_LEFT; + sal_uInt8 nMode = rKEvt.GetKeyCode().IsMod1() ? EDIT_DELMODE_RESTOFWORD : EDIT_DELMODE_SIMPLE; if ( (nMode == EDIT_DELMODE_RESTOFWORD) && rKEvt.GetKeyCode().IsShift() ) nMode = EDIT_DELMODE_RESTOFCONTENT; switch( nCode ) @@ -1778,7 +1780,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) ImplDelete( maSelection, nDel, nMode ); if ( maText.Len() != nOldLen ) ImplModified(); - bDone = TRUE; + bDone = sal_True; } } break; @@ -1788,11 +1790,14 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) if ( !mpIMEInfos && !mbReadOnly && !rKEvt.GetKeyCode().IsMod2() ) { SetInsertMode( !mbInsertMode ); - bDone = TRUE; + bDone = sal_True; } } break; + /* #i101255# disable autocomplete tab forward/backward + users expect tab/shif-tab to move the focus to other controls + not suddenly to cycle the autocompletion case KEY_TAB: { if ( !mbReadOnly && maAutocompleteHdl.IsSet() && @@ -1810,16 +1815,17 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) // Wurde nichts veraendert, dann TAB fuer DialogControl if ( GetSelection().Len() ) - bDone = TRUE; + bDone = sal_True; } } break; + */ default: { if ( IsCharInput( rKEvt ) ) { - bDone = TRUE; // Auch bei ReadOnly die Zeichen schlucken. + bDone = sal_True; // Auch bei ReadOnly die Zeichen schlucken. if ( !mbReadOnly ) { ImplInsertText( rKEvt.GetCharCode(), 0, sal_True ); @@ -1887,9 +1893,9 @@ void Edit::Resize() // ----------------------------------------------------------------------- -void Edit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ) +void Edit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -1904,8 +1910,8 @@ void Edit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG // Border/Background pDev->SetLineColor(); pDev->SetFillColor(); - BOOL bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER); - BOOL bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground(); + sal_Bool bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER); + sal_Bool bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground(); if ( bBorder || bBackground ) { Rectangle aRect( aPos, aSize ); @@ -1997,7 +2003,7 @@ void Edit::GetFocus() { maUndoText = maText; - ULONG nSelOptions = GetSettings().GetStyleSettings().GetSelectionOptions(); + sal_uLong nSelOptions = GetSettings().GetStyleSettings().GetSelectionOptions(); if ( !( GetStyle() & (WB_NOHIDESELECTION|WB_READONLY) ) && ( GetGetFocusFlags() & (GETFOCUS_INIT|GETFOCUS_TAB|GETFOCUS_CURSOR|GETFOCUS_MNEMONIC) ) ) { @@ -2094,22 +2100,22 @@ void Edit::Command( const CommandEvent& rCEvt ) if ( !maSelection.Len() ) { - pPopup->EnableItem( SV_MENU_EDIT_CUT, FALSE ); - pPopup->EnableItem( SV_MENU_EDIT_COPY, FALSE ); - pPopup->EnableItem( SV_MENU_EDIT_DELETE, FALSE ); + pPopup->EnableItem( SV_MENU_EDIT_CUT, sal_False ); + pPopup->EnableItem( SV_MENU_EDIT_COPY, sal_False ); + pPopup->EnableItem( SV_MENU_EDIT_DELETE, sal_False ); } if ( IsReadOnly() ) { - pPopup->EnableItem( SV_MENU_EDIT_CUT, FALSE ); - pPopup->EnableItem( SV_MENU_EDIT_PASTE, FALSE ); - pPopup->EnableItem( SV_MENU_EDIT_DELETE, FALSE ); - pPopup->EnableItem( SV_MENU_EDIT_INSERTSYMBOL, FALSE ); + pPopup->EnableItem( SV_MENU_EDIT_CUT, sal_False ); + pPopup->EnableItem( SV_MENU_EDIT_PASTE, sal_False ); + pPopup->EnableItem( SV_MENU_EDIT_DELETE, sal_False ); + pPopup->EnableItem( SV_MENU_EDIT_INSERTSYMBOL, sal_False ); } else { // Paste nur, wenn Text im Clipboard - BOOL bData = FALSE; + sal_Bool bData = sal_False; uno::Reference< datatransfer::clipboard::XClipboard > xClipboard = GetClipboard(); if ( xClipboard.is() ) { @@ -2127,17 +2133,17 @@ void Edit::Command( const CommandEvent& rCEvt ) } if ( maUndoText == maText ) - pPopup->EnableItem( SV_MENU_EDIT_UNDO, FALSE ); + pPopup->EnableItem( SV_MENU_EDIT_UNDO, sal_False ); if ( ( maSelection.Min() == 0 ) && ( maSelection.Max() == maText.Len() ) ) - pPopup->EnableItem( SV_MENU_EDIT_SELECTALL, FALSE ); + pPopup->EnableItem( SV_MENU_EDIT_SELECTALL, sal_False ); if ( !pImplFncGetSpecialChars ) { - USHORT nPos = pPopup->GetItemPos( SV_MENU_EDIT_INSERTSYMBOL ); + sal_uInt16 nPos = pPopup->GetItemPos( SV_MENU_EDIT_INSERTSYMBOL ); pPopup->RemoveItem( nPos ); pPopup->RemoveItem( nPos-1 ); } - mbActivePopup = TRUE; + mbActivePopup = sal_True; Selection aSaveSel = GetSelection(); // Falls jemand in Get/LoseFocus die Selektion verbiegt, z.B. URL-Zeile... Point aPos = rCEvt.GetMousePosPixel(); if ( !rCEvt.IsMouseEvent() ) @@ -2146,7 +2152,7 @@ void Edit::Command( const CommandEvent& rCEvt ) Size aSize = GetOutputSizePixel(); aPos = Point( aSize.Width()/2, aSize.Height()/2 ); } - USHORT n = pPopup->Execute( this, aPos ); + sal_uInt16 n = pPopup->Execute( this, aPos ); Edit::DeletePopupMenu( pPopup ); SetSelection( aSaveSel ); switch ( n ) @@ -2185,7 +2191,7 @@ void Edit::Command( const CommandEvent& rCEvt ) } break; } - mbActivePopup = FALSE; + mbActivePopup = sal_False; } else if ( rCEvt.GetCommand() == COMMAND_VOICE ) { @@ -2233,12 +2239,12 @@ void Edit::Command( const CommandEvent& rCEvt ) } else if ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT ) { - BOOL bInsertMode = !mpIMEInfos->bWasCursorOverwrite; + sal_Bool bInsertMode = !mpIMEInfos->bWasCursorOverwrite; delete mpIMEInfos; mpIMEInfos = NULL; // Font wieder ohne Attribute einstellen, wird jetzt im Repaint nicht // mehr neu initialisiert - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); SetInsertMode( bInsertMode ); @@ -2262,20 +2268,20 @@ void Edit::Command( const CommandEvent& rCEvt ) maText.Insert( pData->GetText(), mpIMEInfos->nPos ); if ( mpIMEInfos->bWasCursorOverwrite ) { - USHORT nOldIMETextLen = mpIMEInfos->nLen; - USHORT nNewIMETextLen = pData->GetText().Len(); + sal_uInt16 nOldIMETextLen = mpIMEInfos->nLen; + sal_uInt16 nNewIMETextLen = pData->GetText().Len(); if ( ( nOldIMETextLen > nNewIMETextLen ) && ( nNewIMETextLen < mpIMEInfos->aOldTextAfterStartPos.Len() ) ) { // restore old characters - USHORT nRestore = nOldIMETextLen - nNewIMETextLen; + sal_uInt16 nRestore = nOldIMETextLen - nNewIMETextLen; maText.Insert( mpIMEInfos->aOldTextAfterStartPos.Copy( nNewIMETextLen, nRestore ), mpIMEInfos->nPos + nNewIMETextLen ); } else if ( ( nOldIMETextLen < nNewIMETextLen ) && ( nOldIMETextLen < mpIMEInfos->aOldTextAfterStartPos.Len() ) ) { // overwrite - USHORT nOverwrite = nNewIMETextLen - nOldIMETextLen; + sal_uInt16 nOverwrite = nNewIMETextLen - nOldIMETextLen; if ( ( nOldIMETextLen + nOverwrite ) > mpIMEInfos->aOldTextAfterStartPos.Len() ) nOverwrite = mpIMEInfos->aOldTextAfterStartPos.Len() - nOldIMETextLen; maText.Erase( mpIMEInfos->nPos + nNewIMETextLen, nOverwrite ); @@ -2307,7 +2313,7 @@ void Edit::Command( const CommandEvent& rCEvt ) { if ( mpIMEInfos ) { - xub_StrLen nCursorPos = (USHORT)GetSelection().Max(); + xub_StrLen nCursorPos = (sal_uInt16)GetSelection().Max(); SetCursorRect( NULL, GetTextWidth( maText, nCursorPos, mpIMEInfos->nPos+mpIMEInfos->nLen-nCursorPos ) ); } @@ -2337,10 +2343,10 @@ void Edit::StateChanged( StateChangedType nType ) mnXOffset = 0; // Falls vorher GrabFocus, als Groesse noch falsch. ImplAlign(); if ( !mpSubEdit ) - ImplShowCursor( FALSE ); + ImplShowCursor( sal_False ); } // update background (eventual SetPaintTransparent) - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); } else if ( nType == STATE_CHANGE_ENABLE ) { @@ -2359,7 +2365,7 @@ void Edit::StateChanged( StateChangedType nType ) SetStyle( nStyle ); } - USHORT nOldAlign = mnAlign; + sal_uInt16 nOldAlign = mnAlign; mnAlign = EDIT_ALIGN_LEFT; // --- RTL --- hack: right align until keyinput and cursor travelling works @@ -2393,8 +2399,8 @@ void Edit::StateChanged( StateChangedType nType ) { if ( !mpSubEdit ) { - ImplInitSettings( TRUE, FALSE, FALSE ); - ImplShowCursor( TRUE ); + ImplInitSettings( sal_True, sal_False, sal_False ); + ImplShowCursor( sal_True ); Invalidate(); } } @@ -2402,7 +2408,7 @@ void Edit::StateChanged( StateChangedType nType ) { if ( !mpSubEdit ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); ImplShowCursor(); Invalidate(); } @@ -2411,7 +2417,7 @@ void Edit::StateChanged( StateChangedType nType ) { if ( !mpSubEdit ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } } @@ -2419,7 +2425,7 @@ void Edit::StateChanged( StateChangedType nType ) { if ( !mpSubEdit ) { - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } } @@ -2438,8 +2444,8 @@ void Edit::DataChanged( const DataChangedEvent& rDCEvt ) { if ( !mpSubEdit ) { - ImplInitSettings( TRUE, TRUE, TRUE ); - ImplShowCursor( TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); + ImplShowCursor( sal_True ); Invalidate(); } } @@ -2460,7 +2466,7 @@ void Edit::ImplShowDDCursor() mpDDInfo->aCursor.SetPos( aCursorRect.TopLeft() ); mpDDInfo->aCursor.SetSize( aCursorRect.GetSize() ); mpDDInfo->aCursor.Show(); - mpDDInfo->bVisCursor = TRUE; + mpDDInfo->bVisCursor = sal_True; } } @@ -2471,7 +2477,7 @@ void Edit::ImplHideDDCursor() if ( mpDDInfo && mpDDInfo->bVisCursor ) { mpDDInfo->aCursor.Hide(); - mpDDInfo->bVisCursor = FALSE; + mpDDInfo->bVisCursor = sal_False; } } @@ -2523,7 +2529,7 @@ IMPL_LINK( Edit, ImplUpdateDataHdl, Timer*, EMPTYARG ) // ----------------------------------------------------------------------- -void Edit::EnableUpdateData( ULONG nTimeout ) +void Edit::EnableUpdateData( sal_uLong nTimeout ) { if ( !nTimeout ) DisableUpdateData(); @@ -2550,7 +2556,7 @@ void Edit::SetEchoChar( xub_Unicode c ) // ----------------------------------------------------------------------- -void Edit::SetReadOnly( BOOL bReadOnly ) +void Edit::SetReadOnly( sal_Bool bReadOnly ) { if ( mbReadOnly != bReadOnly ) { @@ -2573,7 +2579,7 @@ void Edit::SetAutocompleteHdl( const Link& rHdl ) // ----------------------------------------------------------------------- -void Edit::SetInsertMode( BOOL bInsert ) +void Edit::SetInsertMode( sal_Bool bInsert ) { if ( bInsert != mbInsertMode ) { @@ -2587,7 +2593,7 @@ void Edit::SetInsertMode( BOOL bInsert ) // ----------------------------------------------------------------------- -BOOL Edit::IsInsertMode() const +sal_Bool Edit::IsInsertMode() const { if ( mpSubEdit ) return mpSubEdit->IsInsertMode(); @@ -2626,7 +2632,7 @@ void Edit::SetSelection( const Selection& rSelection ) // ----------------------------------------------------------------------- -void Edit::ImplSetSelection( const Selection& rSelection, BOOL bPaint ) +void Edit::ImplSetSelection( const Selection& rSelection, sal_Bool bPaint ) { if ( mpSubEdit ) mpSubEdit->ImplSetSelection( rSelection ); @@ -2797,9 +2803,9 @@ XubString Edit::GetText() const void Edit::SetModifyFlag() { if ( mpSubEdit ) - mpSubEdit->mbModified = TRUE; + mpSubEdit->mbModified = sal_True; else - mbModified = TRUE; + mbModified = sal_True; } // ----------------------------------------------------------------------- @@ -2807,9 +2813,9 @@ void Edit::SetModifyFlag() void Edit::ClearModifyFlag() { if ( mpSubEdit ) - mpSubEdit->mbModified = FALSE; + mpSubEdit->mbModified = sal_False; else - mbModified = FALSE; + mbModified = sal_False; } // ----------------------------------------------------------------------- @@ -2820,7 +2826,7 @@ void Edit::SetSubEdit( Edit* pEdit ) if ( mpSubEdit ) { SetPointer( POINTER_ARROW ); // Nur das SubEdit hat den BEAM... - mpSubEdit->mbIsSubEdit = TRUE; + mpSubEdit->mbIsSubEdit = sal_True; mpSubEdit->SetReadOnly( mbReadOnly ); } @@ -2855,6 +2861,14 @@ Size Edit::CalcMinimumSize() const return aSize; } +Size Edit::GetMinimumEditSize() +{ + Window* pDefWin = ImplGetDefaultWindow(); + Edit aEdit( pDefWin, WB_BORDER ); + Size aSize( aEdit.CalcMinimumSize() ); + return aSize; +} + // ----------------------------------------------------------------------- Size Edit::GetOptimalSize(WindowSizeType eType) const @@ -2924,8 +2938,8 @@ PopupMenu* Edit::CreatePopupMenu() pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) ); pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) ); pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) ); - pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, FALSE, TRUE, FALSE, FALSE ) ); - pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, TRUE, TRUE, FALSE, FALSE ) ); + pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, sal_False, sal_True, sal_False, sal_False ) ); + pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, sal_True, sal_True, sal_False, sal_False ) ); return pPopup; } @@ -2942,7 +2956,7 @@ void Edit::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::Dra SolarMutexGuard aVclGuard; if ( !IsTracking() && maSelection.Len() && - !(GetStyle() & WB_PASSWORD) && (!mpDDInfo || mpDDInfo->bStarterOfDD == FALSE) ) // Kein Mehrfach D&D + !(GetStyle() & WB_PASSWORD) && (!mpDDInfo || mpDDInfo->bStarterOfDD == sal_False) ) // Kein Mehrfach D&D { Selection aSel( maSelection ); aSel.Justify(); @@ -2955,7 +2969,7 @@ void Edit::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::Dra if ( !mpDDInfo ) mpDDInfo = new DDInfo; - mpDDInfo->bStarterOfDD = TRUE; + mpDDInfo->bStarterOfDD = sal_True; mpDDInfo->aDndStartSel = aSel; @@ -3005,7 +3019,7 @@ void Edit::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& { SolarMutexGuard aVclGuard; - BOOL bChanges = FALSE; + sal_Bool bChanges = sal_False; if ( !mbReadOnly && mpDDInfo ) { ImplHideDDCursor(); @@ -3016,7 +3030,7 @@ void Edit::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& if ( aSel.Len() && !mpDDInfo->bStarterOfDD ) ImplDelete( aSel, EDIT_DEL_RIGHT, EDIT_DELMODE_SIMPLE ); - mpDDInfo->bDroppedInMe = TRUE; + mpDDInfo->bDroppedInMe = sal_True; aSel.Min() = mpDDInfo->nDropPos; aSel.Max() = mpDDInfo->nDropPos; @@ -3033,7 +3047,7 @@ void Edit::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& ::rtl::OUString aText; aData >>= aText; ImplInsertText( aText ); - bChanges = TRUE; + bChanges = sal_True; ImplModified(); } } @@ -3048,17 +3062,26 @@ void Edit::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDTDE.Context->dropComplete( bChanges ); } -void Edit::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& ) throw (::com::sun::star::uno::RuntimeException) +void Edit::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException) { if ( !mpDDInfo ) { mpDDInfo = new DDInfo; } -// sal_Bool bTextContent = mbReadOnly ? sal_False : sal_True; // quiery from rDTDEE.SupportedDataFlavors() -// if ( bTextContent ) -// rDTDEE.Context->acceptDrop(datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE); -// else -// rDTDEE.Context->rejectDrop(); + // search for string data type + const Sequence< com::sun::star::datatransfer::DataFlavor >& rFlavors( rDTDE.SupportedDataFlavors ); + sal_Int32 nEle = rFlavors.getLength(); + mpDDInfo->bIsStringSupported = sal_False; + for( sal_Int32 i = 0; i < nEle; i++ ) + { + sal_Int32 nIndex = 0; + rtl::OUString aMimetype = rFlavors[i].MimeType.getToken( 0, ';', nIndex ); + if( aMimetype.equalsAscii( "text/plain" ) ) + { + mpDDInfo->bIsStringSupported = sal_True; + break; + } + } } void Edit::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& ) throw (::com::sun::star::uno::RuntimeException) @@ -3090,7 +3113,7 @@ void Edit::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEv aSel.Justify(); // Don't accept drop in selection or read-only field... - if ( IsReadOnly() || aSel.IsInside( mpDDInfo->nDropPos ) ) + if ( IsReadOnly() || aSel.IsInside( mpDDInfo->nDropPos ) || ! mpDDInfo->bIsStringSupported ) { ImplHideDDCursor(); rDTDE.Context->rejectDrag(); diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 4fffe2f277ca..1d5b0c66b400 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -52,8 +52,6 @@ using namespace ::com::sun::star; -static ResStringArray *strAllUnits = NULL; - // ----------------------------------------------------------------------- #define FORMAT_NUMERIC 1 @@ -62,9 +60,9 @@ static ResStringArray *strAllUnits = NULL; // ----------------------------------------------------------------------- -static sal_Int64 ImplPower10( USHORT n ) +static sal_Int64 ImplPower10( sal_uInt16 n ) { - USHORT i; + sal_uInt16 i; sal_Int64 nValue = 1; for ( i=0; i < n; i++ ) @@ -75,16 +73,16 @@ static sal_Int64 ImplPower10( USHORT n ) // ----------------------------------------------------------------------- -static BOOL ImplNumericProcessKeyInput( Edit*, const KeyEvent& rKEvt, - BOOL bStrictFormat, BOOL bThousandSep, +static sal_Bool ImplNumericProcessKeyInput( Edit*, const KeyEvent& rKEvt, + sal_Bool bStrictFormat, sal_Bool bThousandSep, const LocaleDataWrapper& rLocaleDataWrappper ) { if ( !bStrictFormat ) - return FALSE; + return sal_False; else { xub_Unicode cChar = rKEvt.GetCharCode(); - USHORT nGroup = rKEvt.GetKeyCode().GetGroup(); + sal_uInt16 nGroup = rKEvt.GetKeyCode().GetGroup(); if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) || (nGroup == KEYGROUP_MISC) || @@ -92,28 +90,28 @@ static BOOL ImplNumericProcessKeyInput( Edit*, const KeyEvent& rKEvt, (cChar == rLocaleDataWrappper.getNumDecimalSep() ) || (bThousandSep && (cChar == rLocaleDataWrappper.getNumThousandSep())) || (cChar == '-') ) - return FALSE; + return sal_False; else - return TRUE; + return sal_True; } } // ----------------------------------------------------------------------- -static BOOL ImplNumericGetValue( const XubString& rStr, double& rValue, - USHORT nDecDigits, const LocaleDataWrapper& rLocaleDataWrappper, - BOOL bCurrency = FALSE ) +static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue, + sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrappper, + sal_Bool bCurrency = sal_False ) { XubString aStr = rStr; XubString aStr1; XubString aStr2; - BOOL bNegative = FALSE; + sal_Bool bNegative = sal_False; xub_StrLen nDecPos; xub_StrLen i; // Reaktion auf leeren String if ( !rStr.Len() ) - return FALSE; + return sal_False; // Fuehrende und nachfolgende Leerzeichen entfernen aStr.EraseLeadingAndTrailingChars( ' ' ); @@ -132,7 +130,7 @@ static BOOL ImplNumericGetValue( const XubString& rStr, double& rValue, if ( bCurrency ) { if ( (aStr.GetChar( 0 ) == '(') && (aStr.GetChar( aStr.Len()-1 ) == ')') ) - bNegative = TRUE; + bNegative = sal_True; if ( !bNegative ) { for ( i=0; i < aStr.Len(); i++ ) @@ -141,14 +139,14 @@ static BOOL ImplNumericGetValue( const XubString& rStr, double& rValue, break; else if ( aStr.GetChar( i ) == '-' ) { - bNegative = TRUE; + bNegative = sal_True; break; } } } if ( !bNegative && bCurrency && aStr.Len() ) { - USHORT nFormat = rLocaleDataWrappper.getCurrNegativeFormat(); + sal_uInt16 nFormat = rLocaleDataWrappper.getCurrNegativeFormat(); if ( (nFormat == 3) || (nFormat == 6) || (nFormat == 7) || (nFormat == 10) ) { @@ -158,7 +156,7 @@ static BOOL ImplNumericGetValue( const XubString& rStr, double& rValue, break; else if ( aStr.GetChar( i ) == '-' ) { - bNegative = TRUE; + bNegative = sal_True; break; } } @@ -168,7 +166,7 @@ static BOOL ImplNumericGetValue( const XubString& rStr, double& rValue, else { if ( aStr1.GetChar( 0 ) == '-' ) - bNegative = TRUE; + bNegative = sal_True; } // Alle unerwuenschten Zeichen rauswerfen @@ -188,7 +186,7 @@ static BOOL ImplNumericGetValue( const XubString& rStr, double& rValue, } if ( !aStr1.Len() && !aStr2.Len() ) - return FALSE; + return sal_False; if ( !aStr1.Len() ) aStr1.Insert( '0' ); @@ -196,11 +194,11 @@ static BOOL ImplNumericGetValue( const XubString& rStr, double& rValue, aStr1.Insert( '-', 0 ); // Nachkommateil zurechtstutzen und dabei runden - BOOL bRound = FALSE; + sal_Bool bRound = sal_False; if ( aStr2.Len() > nDecDigits ) { if ( aStr2.GetChar( nDecDigits ) >= '5' ) - bRound = TRUE; + bRound = sal_True; aStr2.Erase( nDecDigits ); } if ( aStr2.Len() < nDecDigits ) @@ -221,7 +219,43 @@ static BOOL ImplNumericGetValue( const XubString& rStr, double& rValue, rValue = nValue; - return TRUE; + return sal_True; +} + +static void ImplUpdateSeparatorString( String& io_rText, + const String& rOldDecSep, const String& rNewDecSep, + const String& rOldThSep, const String& rNewThSep ) +{ + rtl::OUStringBuffer aBuf( io_rText.Len() ); + xub_StrLen nIndexDec = 0, nIndexTh = 0, nIndex = 0; + + const sal_Unicode* pBuffer = io_rText.GetBuffer(); + while( nIndex != STRING_NOTFOUND ) + { + nIndexDec = io_rText.Search( rOldDecSep, nIndex ); + nIndexTh = io_rText.Search( rOldThSep, nIndex ); + if( (nIndexTh != STRING_NOTFOUND && nIndexDec != STRING_NOTFOUND && nIndexTh < nIndexDec ) + || (nIndexTh != STRING_NOTFOUND && nIndexDec == STRING_NOTFOUND) + ) + { + aBuf.append( pBuffer + nIndex, nIndexTh - nIndex ); + aBuf.append( rNewThSep ); + nIndex = nIndexTh + rOldThSep.Len(); + } + else if( nIndexDec != STRING_NOTFOUND ) + { + aBuf.append( pBuffer + nIndex, nIndexDec - nIndex ); + aBuf.append( rNewDecSep ); + nIndex = nIndexDec + rOldDecSep.Len(); + } + else + { + aBuf.append( pBuffer + nIndex ); + nIndex = STRING_NOTFOUND; + } + } + + io_rText = aBuf.makeStringAndClear(); } static void ImplUpdateSeparators( const String& rOldDecSep, const String& rNewDecSep, @@ -233,29 +267,25 @@ static void ImplUpdateSeparators( const String& rOldDecSep, const String& rNewDe if( bChangeDec || bChangeTh ) { - BOOL bUpdateMode = pEdit->IsUpdateMode(); - pEdit->SetUpdateMode( FALSE ); + sal_Bool bUpdateMode = pEdit->IsUpdateMode(); + pEdit->SetUpdateMode( sal_False ); String aText = pEdit->GetText(); - if( bChangeDec ) - aText.SearchAndReplaceAll( rNewDecSep, rOldDecSep ); - if( bChangeTh ) - aText.SearchAndReplaceAll( rNewThSep, rOldThSep ); + ImplUpdateSeparatorString( aText, rOldDecSep, rNewDecSep, rOldThSep, rNewThSep ); pEdit->SetText( aText ); ComboBox* pCombo = dynamic_cast<ComboBox*>(pEdit); if( pCombo ) { // update box entries - USHORT nEntryCount = pCombo->GetEntryCount(); - for ( USHORT i=0; i < nEntryCount; i++ ) + sal_uInt16 nEntryCount = pCombo->GetEntryCount(); + for ( sal_uInt16 i=0; i < nEntryCount; i++ ) { aText = pCombo->GetEntry( i ); - if( bChangeDec ) - aText.SearchAndReplaceAll( rNewDecSep, rOldDecSep ); - if( bChangeTh ) - aText.SearchAndReplaceAll( rNewThSep, rOldThSep ); + void* pEntryData = pCombo->GetEntryData( i ); + ImplUpdateSeparatorString( aText, rOldDecSep, rNewDecSep, rOldThSep, rNewThSep ); pCombo->RemoveEntry( i ); pCombo->InsertEntry( aText, i ); + pCombo->SetEntryData( i, pEntryData ); } } if( bUpdateMode ) @@ -269,11 +299,11 @@ FormatterBase::FormatterBase( Edit* pField ) { mpField = pField; mpLocaleDataWrapper = NULL; - mbReformat = FALSE; - mbStrictFormat = FALSE; - mbEmptyFieldValue = FALSE; - mbEmptyFieldValueEnabled = FALSE; - mbDefaultLocale = TRUE; + mbReformat = sal_False; + mbStrictFormat = sal_False; + mbEmptyFieldValue = sal_False; + mbEmptyFieldValueEnabled = sal_False; + mbDefaultLocale = sal_True; } // ----------------------------------------------------------------------- @@ -314,7 +344,7 @@ void FormatterBase::ReformatAll() // ----------------------------------------------------------------------- -void FormatterBase::SetStrictFormat( BOOL bStrict ) +void FormatterBase::SetStrictFormat( sal_Bool bStrict ) { if ( bStrict != mbStrictFormat ) { @@ -329,7 +359,7 @@ void FormatterBase::SetStrictFormat( BOOL bStrict ) void FormatterBase::SetLocale( const lang::Locale& rLocale ) { ImplGetLocaleDataWrapper().setLocale( rLocale ); - mbDefaultLocale = FALSE; + mbDefaultLocale = sal_False; ReformatAll(); } @@ -360,7 +390,7 @@ const AllSettings& FormatterBase::GetFieldSettings() const // ----------------------------------------------------------------------- -void FormatterBase::SetFieldText( const XubString& rText, BOOL bKeepSelection ) +void FormatterBase::SetFieldText( const XubString& rText, sal_Bool bKeepSelection ) { if ( mpField ) { @@ -387,7 +417,7 @@ void FormatterBase::ImplSetText( const XubString& rText, Selection* pNewSelectio mpField->SetText( rText, aSel ); } - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); } } @@ -397,23 +427,23 @@ void FormatterBase::SetEmptyFieldValue() { if ( mpField ) mpField->SetText( ImplGetSVEmptyStr() ); - mbEmptyFieldValue = TRUE; + mbEmptyFieldValue = sal_True; } // ----------------------------------------------------------------------- -BOOL FormatterBase::IsEmptyFieldValue() const +sal_Bool FormatterBase::IsEmptyFieldValue() const { return (!mpField || !mpField->GetText().Len()); } // ----------------------------------------------------------------------- -BOOL NumericFormatter::ImplNumericReformat( const XubString& rStr, double& rValue, +sal_Bool NumericFormatter::ImplNumericReformat( const XubString& rStr, double& rValue, XubString& rOutStr ) { if ( !ImplNumericGetValue( rStr, rValue, GetDecimalDigits(), ImplGetLocaleDataWrapper() ) ) - return TRUE; + return sal_True; else { double nTempVal = rValue; @@ -429,14 +459,14 @@ BOOL NumericFormatter::ImplNumericReformat( const XubString& rStr, double& rValu if ( !GetErrorHdl().Call( this ) ) { mnCorrectedValue = 0; - return FALSE; + return sal_False; } else mnCorrectedValue = 0; } rOutStr = CreateFieldText( (sal_Int64)nTempVal ); - return TRUE; + return sal_True; } } @@ -451,8 +481,8 @@ void NumericFormatter::ImplInit() mnCorrectedValue = 0; mnDecimalDigits = 2; mnType = FORMAT_NUMERIC; - mbThousandSep = TRUE; - mbShowTrailingZeros = TRUE; + mbThousandSep = sal_True; + mbShowTrailingZeros = sal_True; // for fields mnSpinSize = 1; @@ -477,7 +507,7 @@ void NumericFormatter::ImplLoadRes( const ResId& rResId ) if( pMgr ) { - ULONG nMask = pMgr->ReadLong(); + sal_uLong nMask = pMgr->ReadLong(); if ( NUMERICFORMATTER_MIN & nMask ) mnMin = pMgr->ReadLong(); @@ -486,7 +516,7 @@ void NumericFormatter::ImplLoadRes( const ResId& rResId ) mnMax = pMgr->ReadLong(); if ( NUMERICFORMATTER_STRICTFORMAT & nMask ) - SetStrictFormat( (BOOL)pMgr->ReadShort() ); + SetStrictFormat( (sal_Bool)pMgr->ReadShort() ); if ( NUMERICFORMATTER_DECIMALDIGITS & nMask ) SetDecimalDigits( pMgr->ReadShort() ); @@ -502,7 +532,7 @@ void NumericFormatter::ImplLoadRes( const ResId& rResId ) } if ( NUMERICFORMATTER_NOTHOUSANDSEP & nMask ) - SetUseThousandSep( !(BOOL)pMgr->ReadShort() ); + SetUseThousandSep( !(sal_Bool)pMgr->ReadShort() ); } } @@ -532,7 +562,7 @@ void NumericFormatter::SetMax( sal_Int64 nNewMax ) // ----------------------------------------------------------------------- -void NumericFormatter::SetUseThousandSep( BOOL b ) +void NumericFormatter::SetUseThousandSep( sal_Bool b ) { mbThousandSep = b; ReformatAll(); @@ -540,7 +570,7 @@ void NumericFormatter::SetUseThousandSep( BOOL b ) // ----------------------------------------------------------------------- -void NumericFormatter::SetDecimalDigits( USHORT nDigits ) +void NumericFormatter::SetDecimalDigits( sal_uInt16 nDigits ) { mnDecimalDigits = nDigits; ReformatAll(); @@ -548,7 +578,7 @@ void NumericFormatter::SetDecimalDigits( USHORT nDigits ) // ----------------------------------------------------------------------- -void NumericFormatter::SetShowTrailingZeros( BOOL bShowTrailingZeros ) +void NumericFormatter::SetShowTrailingZeros( sal_Bool bShowTrailingZeros ) { if ( mbShowTrailingZeros != bShowTrailingZeros ) { @@ -559,7 +589,7 @@ void NumericFormatter::SetShowTrailingZeros( BOOL bShowTrailingZeros ) // ----------------------------------------------------------------------- -USHORT NumericFormatter::GetDecimalDigits() const +sal_uInt16 NumericFormatter::GetDecimalDigits() const { return mnDecimalDigits; } @@ -570,7 +600,7 @@ void NumericFormatter::SetValue( sal_Int64 nNewValue ) { SetUserValue( nNewValue ); mnFieldValue = mnLastValue; - SetEmptyFieldValueData( FALSE ); + SetEmptyFieldValueData( sal_False ); } // ----------------------------------------------------------------------- @@ -626,14 +656,14 @@ sal_Int64 NumericFormatter::GetValue() const // ----------------------------------------------------------------------- -BOOL NumericFormatter::IsValueModified() const +sal_Bool NumericFormatter::IsValueModified() const { if ( ImplGetEmptyFieldValue() ) return !IsEmptyFieldValue(); else if ( GetValue() != mnFieldValue ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -690,7 +720,7 @@ void NumericFormatter::Reformat() XubString aStr; // caution: precision loss in double cast double nTemp = (double)mnLastValue; - BOOL bOK = ImplNumericReformat( GetField()->GetText(), nTemp, aStr ); + sal_Bool bOK = ImplNumericReformat( GetField()->GetText(), nTemp, aStr ); mnLastValue = (sal_Int64)nTemp; if ( !bOK ) return; @@ -810,7 +840,7 @@ void NumericField::ImplLoadRes( const ResId& rResId ) SpinField::ImplLoadRes( rResId ); NumericFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr() ) ); - ULONG nMask = ReadLongRes(); + sal_uLong nMask = ReadLongRes(); if ( NUMERICFIELD_FIRST & nMask ) mnFirst = ReadLongRes(); @@ -846,7 +876,7 @@ long NumericField::PreNotify( NotifyEvent& rNEvt ) long NumericField::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) ) @@ -879,7 +909,7 @@ void NumericField::DataChanged( const DataChangedEvent& rDCEvt ) void NumericField::Modify() { - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); SpinField::Modify(); } @@ -965,7 +995,7 @@ long NumericBox::PreNotify( NotifyEvent& rNEvt ) long NumericBox::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) ) @@ -998,7 +1028,7 @@ void NumericBox::DataChanged( const DataChangedEvent& rDCEvt ) void NumericBox::Modify() { - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); ComboBox::Modify(); } @@ -1008,21 +1038,21 @@ void NumericBox::ReformatAll() { double nValue; XubString aStr; - SetUpdateMode( FALSE ); - USHORT nEntryCount = GetEntryCount(); - for ( USHORT i=0; i < nEntryCount; i++ ) + SetUpdateMode( sal_False ); + sal_uInt16 nEntryCount = GetEntryCount(); + for ( sal_uInt16 i=0; i < nEntryCount; i++ ) { ImplNumericReformat( GetEntry( i ), nValue, aStr ); RemoveEntry( i ); InsertEntry( aStr, i ); } NumericFormatter::Reformat(); - SetUpdateMode( TRUE ); + SetUpdateMode( sal_True ); } // ----------------------------------------------------------------------- -void NumericBox::InsertValue( sal_Int64 nValue, USHORT nPos ) +void NumericBox::InsertValue( sal_Int64 nValue, sal_uInt16 nPos ) { ComboBox::InsertEntry( CreateFieldText( nValue ), nPos ); } @@ -1036,7 +1066,7 @@ void NumericBox::RemoveValue( sal_Int64 nValue ) // ----------------------------------------------------------------------- -sal_Int64 NumericBox::GetValue( USHORT nPos ) const +sal_Int64 NumericBox::GetValue( sal_uInt16 nPos ) const { double nValue = 0; ImplNumericGetValue( ComboBox::GetEntry( nPos ), nValue, GetDecimalDigits(), ImplGetLocaleDataWrapper() ); @@ -1045,19 +1075,19 @@ sal_Int64 NumericBox::GetValue( USHORT nPos ) const // ----------------------------------------------------------------------- -USHORT NumericBox::GetValuePos( sal_Int64 nValue ) const +sal_uInt16 NumericBox::GetValuePos( sal_Int64 nValue ) const { return ComboBox::GetEntryPos( CreateFieldText( nValue ) ); } // ----------------------------------------------------------------------- -static BOOL ImplMetricProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, - BOOL, BOOL bUseThousandSep, const LocaleDataWrapper& rWrapper ) +static sal_Bool ImplMetricProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, + sal_Bool, sal_Bool bUseThousandSep, const LocaleDataWrapper& rWrapper ) { // Es gibt hier kein sinnvolles StrictFormat, also alle // Zeichen erlauben - return ImplNumericProcessKeyInput( pEdit, rKEvt, FALSE, bUseThousandSep, rWrapper ); + return ImplNumericProcessKeyInput( pEdit, rKEvt, sal_False, bUseThousandSep, rWrapper ); } // ----------------------------------------------------------------------- @@ -1083,7 +1113,7 @@ static XubString ImplMetricGetUnitText( const XubString& rStr ) /* // MT: #90545# Preparation for translated strings... String aMetricText; - for ( USHORT n = rStr.Len(); n; ) + for ( sal_uInt16 n = rStr.Len(); n; ) { sal_Unicode c = rStr.GetChar( --n ); sal_Int32 nType = xCharClass->getStringType( rStr, n, 1, rLocale ); @@ -1105,38 +1135,37 @@ static XubString ImplMetricGetUnitText( const XubString& rStr ) // #104355# support localized mesaurements -static String ImplMetricToString( FieldUnit rUnit ) +static const String& ImplMetricToString( FieldUnit rUnit ) { - if( !strAllUnits ) + FieldUnitStringList* pList = ImplGetFieldUnits(); + if( pList ) { - ResMgr* pResMgr = ImplGetResMgr(); - strAllUnits = new ResStringArray( ResId (SV_FUNIT_STRINGS, *pResMgr) ); + // return unit's default string (ie, the first one ) + for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it ) + { + if ( it->second == rUnit ) + return it->first; + } } - // return unit's default string (ie, the first one ) - for( USHORT i=0; i < strAllUnits->Count(); i++ ) - if( (FieldUnit) strAllUnits->GetValue( i ) == rUnit ) - return strAllUnits->GetString( i ); - return String(); + return String::EmptyString(); } static FieldUnit ImplStringToMetric( const String &rMetricString ) { - if( !strAllUnits ) + FieldUnitStringList* pList = ImplGetCleanedFieldUnits(); + if( pList ) { - ResMgr* pResMgr = ImplGetResMgr(); - strAllUnits = new ResStringArray( ResId (SV_FUNIT_STRINGS, *pResMgr) ); + // return FieldUnit + String aStr( rMetricString ); + aStr.ToLowerAscii(); + aStr.EraseAllChars( sal_Unicode( ' ' ) ); + for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it ) + { + if ( it->first.Equals( aStr ) ) + return it->second; + } } - // return FieldUnit - String aStr( rMetricString ); - aStr.ToLowerAscii(); - for( USHORT i=0; i < strAllUnits->Count(); i++ ) - if ( strAllUnits->GetString( i ).Equals( aStr ) ) - return (FieldUnit) strAllUnits->GetValue( i ); - - // Amelia : about character unit - if (aStr.EqualsIgnoreCaseAscii("cm")) - return FUNIT_CM; return FUNIT_NONE; } @@ -1225,7 +1254,7 @@ static double nonValueDoubleToValueDouble( double nValue ) return rtl::math::isFinite( nValue ) ? nValue : 0.0; } -sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, USHORT nDecDigits, +sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, FieldUnit eOutUnit ) { double nDouble = nonValueDoubleToValueDouble( ConvertDoubleValue( @@ -1244,7 +1273,7 @@ sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, US // ----------------------------------------------------------------------- -sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, USHORT nDigits, +sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_uInt16 nDigits, MapUnit eInUnit, FieldUnit eOutUnit ) { return static_cast<sal_Int64>( @@ -1254,7 +1283,7 @@ sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, USHORT nDigits, // ----------------------------------------------------------------------- -sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, USHORT nDigits, +sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_uInt16 nDigits, FieldUnit eInUnit, MapUnit eOutUnit ) { return static_cast<sal_Int64>( @@ -1264,7 +1293,7 @@ sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, USHORT nDigits, // ----------------------------------------------------------------------- -double MetricField::ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, USHORT nDecDigits, +double MetricField::ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, FieldUnit eOutUnit ) { if ( eInUnit != eOutUnit ) @@ -1276,7 +1305,7 @@ double MetricField::ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, US if ( (mnBaseValue <= 0) || (nValue <= 0) ) return nValue; nDiv = 100; - for ( USHORT i=0; i < nDecDigits; i++ ) + for ( sal_uInt16 i=0; i < nDecDigits; i++ ) nDiv *= 10; nMult = mnBaseValue; @@ -1315,7 +1344,7 @@ double MetricField::ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, US // ----------------------------------------------------------------------- -double MetricField::ConvertDoubleValue( double nValue, USHORT nDigits, +double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, MapUnit eInUnit, FieldUnit eOutUnit ) { if ( eOutUnit == FUNIT_PERCENT || @@ -1372,7 +1401,7 @@ double MetricField::ConvertDoubleValue( double nValue, USHORT nDigits, // ----------------------------------------------------------------------- -double MetricField::ConvertDoubleValue( double nValue, USHORT nDigits, +double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, FieldUnit eInUnit, MapUnit eOutUnit ) { if ( eInUnit == FUNIT_PERCENT || @@ -1429,12 +1458,12 @@ double MetricField::ConvertDoubleValue( double nValue, USHORT nDigits, // ----------------------------------------------------------------------- -static BOOL ImplMetricGetValue( const XubString& rStr, double& rValue, sal_Int64 nBaseValue, - USHORT nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper, FieldUnit eUnit ) +static sal_Bool ImplMetricGetValue( const XubString& rStr, double& rValue, sal_Int64 nBaseValue, + sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper, FieldUnit eUnit ) { // Zahlenwert holen if ( !ImplNumericGetValue( rStr, rValue, nDecDigits, rLocaleDataWrapper ) ) - return FALSE; + return sal_False; // Einheit rausfinden FieldUnit eEntryUnit = ImplMetricGetUnit( rStr ); @@ -1442,15 +1471,15 @@ static BOOL ImplMetricGetValue( const XubString& rStr, double& rValue, sal_Int64 // Einheiten umrechnen rValue = MetricField::ConvertDoubleValue( rValue, nBaseValue, nDecDigits, eEntryUnit, eUnit ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL MetricFormatter::ImplMetricReformat( const XubString& rStr, double& rValue, XubString& rOutStr ) +sal_Bool MetricFormatter::ImplMetricReformat( const XubString& rStr, double& rValue, XubString& rOutStr ) { if ( !ImplMetricGetValue( rStr, rValue, mnBaseValue, GetDecimalDigits(), ImplGetLocaleDataWrapper(), meUnit ) ) - return TRUE; + return sal_True; else { double nTempVal = rValue; @@ -1466,14 +1495,14 @@ BOOL MetricFormatter::ImplMetricReformat( const XubString& rStr, double& rValue, if ( !GetErrorHdl().Call( this ) ) { mnCorrectedValue = 0; - return FALSE; + return sal_False; } else mnCorrectedValue = 0; } rOutStr = CreateFieldText( (sal_Int64)nTempVal ); - return TRUE; + return sal_True; } } @@ -1502,7 +1531,7 @@ void MetricFormatter::ImplLoadRes( const ResId& rResId ) ResMgr* pMgr = rResId.GetResMgr(); if( pMgr ) { - ULONG nMask = pMgr->ReadLong(); + sal_uLong nMask = pMgr->ReadLong(); if ( METRICFORMATTER_UNIT & nMask ) meUnit = (FieldUnit)pMgr->ReadLong(); @@ -1676,7 +1705,7 @@ void MetricFormatter::Reformat() XubString aStr; // caution: precision loss in double cast double nTemp = (double)mnLastValue; - BOOL bOK = ImplMetricReformat( aText, nTemp, aStr ); + sal_Bool bOK = ImplMetricReformat( aText, nTemp, aStr ); mnLastValue = (sal_Int64)nTemp; if ( !bOK ) @@ -1733,7 +1762,7 @@ void MetricField::ImplLoadRes( const ResId& rResId ) SpinField::ImplLoadRes( rResId ); MetricFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr() ) ); - ULONG nMask = ReadLongRes(); + sal_uLong nMask = ReadLongRes(); if ( METRICFIELD_FIRST & nMask ) mnFirst = ReadLongRes(); @@ -1825,7 +1854,7 @@ long MetricField::PreNotify( NotifyEvent& rNEvt ) long MetricField::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) ) @@ -1858,7 +1887,7 @@ void MetricField::DataChanged( const DataChangedEvent& rDCEvt ) void MetricField::Modify() { - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); SpinField::Modify(); } @@ -1951,7 +1980,7 @@ long MetricBox::PreNotify( NotifyEvent& rNEvt ) long MetricBox::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) ) @@ -1984,7 +2013,7 @@ void MetricBox::DataChanged( const DataChangedEvent& rDCEvt ) void MetricBox::Modify() { - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); ComboBox::Modify(); } @@ -1994,16 +2023,16 @@ void MetricBox::ReformatAll() { double nValue; XubString aStr; - SetUpdateMode( FALSE ); - USHORT nEntryCount = GetEntryCount(); - for ( USHORT i=0; i < nEntryCount; i++ ) + SetUpdateMode( sal_False ); + sal_uInt16 nEntryCount = GetEntryCount(); + for ( sal_uInt16 i=0; i < nEntryCount; i++ ) { ImplMetricReformat( GetEntry( i ), nValue, aStr ); RemoveEntry( i ); InsertEntry( aStr, i ); } MetricFormatter::Reformat(); - SetUpdateMode( TRUE ); + SetUpdateMode( sal_True ); } // ----------------------------------------------------------------------- @@ -2015,7 +2044,7 @@ void MetricBox::CustomConvert() // ----------------------------------------------------------------------- -void MetricBox::InsertValue( sal_Int64 nValue, FieldUnit eInUnit, USHORT nPos ) +void MetricBox::InsertValue( sal_Int64 nValue, FieldUnit eInUnit, sal_uInt16 nPos ) { // Umrechnen auf eingestellte Einheiten nValue = MetricField::ConvertValue( nValue, mnBaseValue, GetDecimalDigits(), @@ -2035,7 +2064,7 @@ void MetricBox::RemoveValue( sal_Int64 nValue, FieldUnit eInUnit ) // ----------------------------------------------------------------------- -sal_Int64 MetricBox::GetValue( USHORT nPos, FieldUnit eOutUnit ) const +sal_Int64 MetricBox::GetValue( sal_uInt16 nPos, FieldUnit eOutUnit ) const { double nValue = 0; ImplMetricGetValue( ComboBox::GetEntry( nPos ), nValue, mnBaseValue, @@ -2050,7 +2079,7 @@ sal_Int64 MetricBox::GetValue( USHORT nPos, FieldUnit eOutUnit ) const // ----------------------------------------------------------------------- -USHORT MetricBox::GetValuePos( sal_Int64 nValue, FieldUnit eInUnit ) const +sal_uInt16 MetricBox::GetValuePos( sal_Int64 nValue, FieldUnit eInUnit ) const { // Umrechnen auf eingestellte Einheiten nValue = MetricField::ConvertValue( nValue, mnBaseValue, GetDecimalDigits(), @@ -2076,31 +2105,31 @@ sal_Int64 MetricBox::GetValue() const // ----------------------------------------------------------------------- -static BOOL ImplCurrencyProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, - BOOL, BOOL bUseThousandSep, const LocaleDataWrapper& rWrapper ) +static sal_Bool ImplCurrencyProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, + sal_Bool, sal_Bool bUseThousandSep, const LocaleDataWrapper& rWrapper ) { // Es gibt hier kein sinnvolles StrictFormat, also alle // Zeichen erlauben - return ImplNumericProcessKeyInput( pEdit, rKEvt, FALSE, bUseThousandSep, rWrapper ); + return ImplNumericProcessKeyInput( pEdit, rKEvt, sal_False, bUseThousandSep, rWrapper ); } // ----------------------------------------------------------------------- -inline BOOL ImplCurrencyGetValue( const XubString& rStr, double& rValue, - USHORT nDecDigits, const LocaleDataWrapper& rWrapper ) +inline sal_Bool ImplCurrencyGetValue( const XubString& rStr, double& rValue, + sal_uInt16 nDecDigits, const LocaleDataWrapper& rWrapper ) { // Zahlenwert holen - return ImplNumericGetValue( rStr, rValue, nDecDigits, rWrapper, TRUE ); + return ImplNumericGetValue( rStr, rValue, nDecDigits, rWrapper, sal_True ); } // ----------------------------------------------------------------------- -BOOL CurrencyFormatter::ImplCurrencyReformat( const XubString& rStr, +sal_Bool CurrencyFormatter::ImplCurrencyReformat( const XubString& rStr, XubString& rOutStr ) { double nValue; - if ( !ImplNumericGetValue( rStr, nValue, GetDecimalDigits(), ImplGetLocaleDataWrapper(), TRUE ) ) - return TRUE; + if ( !ImplNumericGetValue( rStr, nValue, GetDecimalDigits(), ImplGetLocaleDataWrapper(), sal_True ) ) + return sal_True; else { double nTempVal = nValue; @@ -2116,14 +2145,14 @@ BOOL CurrencyFormatter::ImplCurrencyReformat( const XubString& rStr, if ( !GetErrorHdl().Call( this ) ) { mnCorrectedValue = 0; - return FALSE; + return sal_False; } else mnCorrectedValue = 0; } rOutStr = CreateFieldText( (long)nTempVal ); - return TRUE; + return sal_True; } } @@ -2168,7 +2197,7 @@ void CurrencyFormatter::SetValue( sal_Int64 nNewValue ) { SetUserValue( nNewValue ); mnFieldValue = mnLastValue; - SetEmptyFieldValueData( FALSE ); + SetEmptyFieldValueData( sal_False ); } // ----------------------------------------------------------------------- @@ -2207,7 +2236,7 @@ void CurrencyFormatter::Reformat() return; XubString aStr; - BOOL bOK = ImplCurrencyReformat( GetField()->GetText(), aStr ); + sal_Bool bOK = ImplCurrencyReformat( GetField()->GetText(), aStr ); if ( !bOK ) return; @@ -2254,7 +2283,7 @@ void CurrencyField::ImplLoadRes( const ResId& rResId ) SpinField::ImplLoadRes( rResId ); CurrencyFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr() ) ); - ULONG nMask = ReadLongRes(); + sal_uLong nMask = ReadLongRes(); if ( CURRENCYFIELD_FIRST & nMask ) mnFirst = ReadLongRes(); @@ -2292,7 +2321,7 @@ long CurrencyField::PreNotify( NotifyEvent& rNEvt ) long CurrencyField::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) ) @@ -2325,7 +2354,7 @@ void CurrencyField::DataChanged( const DataChangedEvent& rDCEvt ) void CurrencyField::Modify() { - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); SpinField::Modify(); } @@ -2411,7 +2440,7 @@ long CurrencyBox::PreNotify( NotifyEvent& rNEvt ) long CurrencyBox::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) ) @@ -2444,7 +2473,7 @@ void CurrencyBox::DataChanged( const DataChangedEvent& rDCEvt ) void CurrencyBox::Modify() { - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); ComboBox::Modify(); } @@ -2453,21 +2482,21 @@ void CurrencyBox::Modify() void CurrencyBox::ReformatAll() { XubString aStr; - SetUpdateMode( FALSE ); - USHORT nEntryCount = GetEntryCount(); - for ( USHORT i=0; i < nEntryCount; i++ ) + SetUpdateMode( sal_False ); + sal_uInt16 nEntryCount = GetEntryCount(); + for ( sal_uInt16 i=0; i < nEntryCount; i++ ) { ImplCurrencyReformat( GetEntry( i ), aStr ); RemoveEntry( i ); InsertEntry( aStr, i ); } CurrencyFormatter::Reformat(); - SetUpdateMode( TRUE ); + SetUpdateMode( sal_True ); } // ----------------------------------------------------------------------- -void CurrencyBox::InsertValue( sal_Int64 nValue, USHORT nPos ) +void CurrencyBox::InsertValue( sal_Int64 nValue, sal_uInt16 nPos ) { ComboBox::InsertEntry( CreateFieldText( nValue ), nPos ); } @@ -2481,7 +2510,7 @@ void CurrencyBox::RemoveValue( sal_Int64 nValue ) // ----------------------------------------------------------------------- -sal_Int64 CurrencyBox::GetValue( USHORT nPos ) const +sal_Int64 CurrencyBox::GetValue( sal_uInt16 nPos ) const { double nValue = 0; ImplCurrencyGetValue( ComboBox::GetEntry( nPos ), nValue, GetDecimalDigits(), ImplGetLocaleDataWrapper() ); @@ -2490,7 +2519,7 @@ sal_Int64 CurrencyBox::GetValue( USHORT nPos ) const // ----------------------------------------------------------------------- -USHORT CurrencyBox::GetValuePos( sal_Int64 nValue ) const +sal_uInt16 CurrencyBox::GetValuePos( sal_Int64 nValue ) const { return ComboBox::GetEntryPos( CreateFieldText( nValue ) ); } diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index bd6eec0029e8..65e8c8d91f82 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -92,7 +92,7 @@ static sal_Unicode* ImplAddString( sal_Unicode* pBuf, const String& rStr ) // ----------------------------------------------------------------------- -static sal_Unicode* ImplAddNum( sal_Unicode* pBuf, ULONG nNumber, int nMinLen ) +static sal_Unicode* ImplAddNum( sal_Unicode* pBuf, sal_uLong nNumber, int nMinLen ) { // fill temp buffer with digits sal_Unicode aTempBuf[30]; @@ -129,15 +129,15 @@ static sal_Unicode* ImplAddNum( sal_Unicode* pBuf, ULONG nNumber, int nMinLen ) // ----------------------------------------------------------------------- -static USHORT ImplGetNum( const sal_Unicode*& rpBuf, BOOL& rbError ) +static sal_uInt16 ImplGetNum( const sal_Unicode*& rpBuf, sal_Bool& rbError ) { if ( !*rpBuf ) { - rbError = TRUE; + rbError = sal_True; return 0; } - USHORT nNumber = 0; + sal_uInt16 nNumber = 0; while( ( *rpBuf >= '0' ) && ( *rpBuf <= '9' ) ) { nNumber *= 10; @@ -173,38 +173,38 @@ static int ImplIsPatternChar( xub_Unicode cChar, sal_Char cEditMask ) catch ( ::com::sun::star::uno::Exception& ) { DBG_ERRORFILE( "ImplIsPatternChar: Exception caught!" ); - return FALSE; + return sal_False; } if ( (cEditMask == EDITMASK_ALPHA) || (cEditMask == EDITMASK_UPPERALPHA) ) { if( !CharClass::isLetterType( nType ) ) - return FALSE; + return sal_False; } else if ( cEditMask == EDITMASK_NUM ) { if( !CharClass::isNumericType( nType ) ) - return FALSE; + return sal_False; } else if ( (cEditMask == EDITMASK_ALPHANUM) || (cEditMask == EDITMASK_UPPERALPHANUM) ) { if( !CharClass::isLetterNumericType( nType ) ) - return FALSE; + return sal_False; } else if ( (cEditMask == EDITMASK_ALLCHAR) || (cEditMask == EDITMASK_UPPERALLCHAR) ) { if ( cChar < 32 ) - return FALSE; + return sal_False; } else if ( cEditMask == EDITMASK_NUMSPACE ) { if ( !CharClass::isNumericType( nType ) && ( cChar != ' ' ) ) - return FALSE; + return sal_False; } else - return FALSE; + return sal_False; - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -230,12 +230,12 @@ static xub_Unicode ImplPatternChar( xub_Unicode cChar, sal_Char cEditMask ) static int ImplKommaPointCharEqual( xub_Unicode c1, xub_Unicode c2 ) { if ( c1 == c2 ) - return TRUE; + return sal_True; else if ( ((c1 == '.') || (c1 == ',')) && ((c2 == '.') || (c2 == ',')) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -243,7 +243,7 @@ static int ImplKommaPointCharEqual( xub_Unicode c1, xub_Unicode c2 ) static XubString ImplPatternReformat( const XubString& rStr, const ByteString& rEditMask, const XubString& rLiteralMask, - USHORT nFormatFlags ) + sal_uInt16 nFormatFlags ) { if ( !rEditMask.Len() ) return rStr; @@ -347,8 +347,8 @@ static XubString ImplPatternReformat( const XubString& rStr, // ----------------------------------------------------------------------- static void ImplPatternMaxPos( const XubString rStr, const ByteString& rEditMask, - USHORT nFormatFlags, BOOL bSameMask, - USHORT nCursorPos, USHORT& rPos ) + sal_uInt16 nFormatFlags, sal_Bool bSameMask, + sal_uInt16 nCursorPos, sal_uInt16& rPos ) { // Letzte Position darf nicht groesser als der enthaltene String sein @@ -392,7 +392,7 @@ static void ImplPatternMaxPos( const XubString rStr, const ByteString& rEditMask static void ImplPatternProcessStrictModify( Edit* pEdit, const ByteString& rEditMask, const XubString& rLiteralMask, - USHORT nFormatFlags, BOOL bSameMask ) + sal_uInt16 nFormatFlags, sal_Bool bSameMask ) { XubString aText = pEdit->GetText(); @@ -421,7 +421,7 @@ static void ImplPatternProcessStrictModify( Edit* pEdit, // Selection so anpassen, das diese wenn sie vorher am Ende // stand, immer noch am Ende steht Selection aSel = pEdit->GetSelection(); - ULONG nMaxSel = Max( aSel.Min(), aSel.Max() ); + sal_uLong nMaxSel = Max( aSel.Min(), aSel.Max() ); if ( nMaxSel >= aText.Len() ) { xub_StrLen nMaxPos = aNewText.Len(); @@ -462,7 +462,7 @@ static xub_StrLen ImplPatternLeftPos( const ByteString& rEditMask, xub_StrLen nC // ----------------------------------------------------------------------- static xub_StrLen ImplPatternRightPos( const XubString& rStr, const ByteString& rEditMask, - USHORT nFormatFlags, BOOL bSameMask, + sal_uInt16 nFormatFlags, sal_Bool bSameMask, xub_StrLen nCursorPos ) { // Naechstes Zeichen suchen, was kein Literal ist @@ -483,22 +483,22 @@ static xub_StrLen ImplPatternRightPos( const XubString& rStr, const ByteString& // ----------------------------------------------------------------------- -static BOOL ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, +static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, const ByteString& rEditMask, const XubString& rLiteralMask, - BOOL bStrictFormat, - USHORT nFormatFlags, - BOOL bSameMask, - BOOL& rbInKeyInput ) + sal_Bool bStrictFormat, + sal_uInt16 nFormatFlags, + sal_Bool bSameMask, + sal_Bool& rbInKeyInput ) { if ( !rEditMask.Len() || !bStrictFormat ) - return FALSE; + return sal_False; Selection aOldSel = pEdit->GetSelection(); KeyCode aCode = rKEvt.GetKeyCode(); xub_Unicode cChar = rKEvt.GetCharCode(); - USHORT nKeyCode = aCode.GetCode(); - BOOL bShift = aCode.IsShift(); + sal_uInt16 nKeyCode = aCode.GetCode(); + sal_Bool bShift = aCode.IsShift(); xub_StrLen nCursorPos = (xub_StrLen)aOldSel.Max(); xub_StrLen nNewPos; xub_StrLen nTempPos; @@ -511,7 +511,7 @@ static BOOL ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, if ( bShift ) aSel.Min() = aOldSel.Min(); pEdit->SetSelection( aSel ); - return TRUE; + return sal_True; } else if ( nKeyCode == KEY_RIGHT ) { @@ -527,7 +527,7 @@ static BOOL ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, else aSel.Min() = aSel.Max(); pEdit->SetSelection( aSel ); - return TRUE; + return sal_True; } else if ( nKeyCode == KEY_HOME ) { @@ -543,7 +543,7 @@ static BOOL ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, if ( bShift ) aSel.Min() = aOldSel.Min(); pEdit->SetSelection( aSel ); - return TRUE; + return sal_True; } else if ( nKeyCode == KEY_END ) { @@ -565,7 +565,7 @@ static BOOL ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, else aSel.Min() = aSel.Max(); pEdit->SetSelection( aSel ); - return TRUE; + return sal_True; } else if ( (nKeyCode == KEY_BACKSPACE) || (nKeyCode == KEY_DELETE) ) { @@ -616,16 +616,16 @@ static BOOL ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, { if ( bSameMask ) aStr = ImplPatternReformat( aStr, rEditMask, rLiteralMask, nFormatFlags ); - rbInKeyInput = TRUE; + rbInKeyInput = sal_True; pEdit->SetText( aStr, Selection( nNewPos ) ); pEdit->SetModifyFlag(); pEdit->Modify(); - rbInKeyInput = FALSE; + rbInKeyInput = sal_False; } else pEdit->SetSelection( Selection( nNewPos ) ); - return TRUE; + return sal_True; } else if ( nKeyCode == KEY_INSERT ) { @@ -635,13 +635,13 @@ static BOOL ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, if ( !bSameMask ) { Sound::Beep(); - return TRUE; + return sal_True; } } } if ( rKEvt.GetKeyCode().IsMod2() || (cChar < 32) || (cChar == 127) ) - return FALSE; + return sal_False; Selection aSel = aOldSel; aSel.Justify(); @@ -679,7 +679,7 @@ static BOOL ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, if ( nTempPos > nNewPos ) { pEdit->SetSelection( Selection( nTempPos ) ); - return TRUE; + return sal_True; } } break; @@ -696,7 +696,7 @@ static BOOL ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, if ( cChar ) { XubString aStr = pEdit->GetText(); - BOOL bError = FALSE; + sal_Bool bError = sal_False; if ( bSameMask && pEdit->IsInsertMode() ) { // Text um Spacezeichen und Literale am Ende kuerzen, bis zur @@ -727,7 +727,7 @@ static BOOL ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, aStr = ImplPatternReformat( aStr, rEditMask, rLiteralMask, nFormatFlags ); } else - bError = TRUE; + bError = sal_True; } else { @@ -748,18 +748,18 @@ static BOOL ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, Sound::Beep(); else { - rbInKeyInput = TRUE; + rbInKeyInput = sal_True; Selection aNewSel( ImplPatternRightPos( aStr, rEditMask, nFormatFlags, bSameMask, nNewPos ) ); pEdit->SetText( aStr, aNewSel ); pEdit->SetModifyFlag(); pEdit->Modify(); - rbInKeyInput = FALSE; + rbInKeyInput = sal_False; } } else Sound::Beep(); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -769,7 +769,7 @@ void PatternFormatter::ImplSetMask( const ByteString& rEditMask, { maEditMask = rEditMask; maLiteralMask = rLiteralMask; - mbSameMask = TRUE; + mbSameMask = sal_True; if ( maEditMask.Len() != maLiteralMask.Len() ) { @@ -794,14 +794,14 @@ void PatternFormatter::ImplSetMask( const ByteString& rEditMask, (cTemp == EDITMASK_UPPERALLCHAR) || (cTemp == EDITMASK_NUMSPACE) ) { - mbSameMask = FALSE; + mbSameMask = sal_False; break; } if ( i < rLiteralMask.Len() ) { if ( rLiteralMask.GetChar( i ) != ' ' ) { - mbSameMask = FALSE; + mbSameMask = sal_False; break; } } @@ -809,7 +809,7 @@ void PatternFormatter::ImplSetMask( const ByteString& rEditMask, c = cTemp; if ( cTemp != c ) { - mbSameMask = FALSE; + mbSameMask = sal_False; break; } } @@ -822,8 +822,8 @@ void PatternFormatter::ImplSetMask( const ByteString& rEditMask, PatternFormatter::PatternFormatter() { mnFormatFlags = 0; - mbSameMask = TRUE; - mbInPattKeyInput = FALSE; + mbSameMask = sal_True; + mbInPattKeyInput = sal_False; } // ----------------------------------------------------------------------- @@ -835,10 +835,10 @@ void PatternFormatter::ImplLoadRes( const ResId& rResId ) ResMgr* pMgr = rResId.GetResMgr(); if( pMgr ) { - ULONG nMask = pMgr->ReadLong(); + sal_uLong nMask = pMgr->ReadLong(); if ( PATTERNFORMATTER_STRICTFORMAT & nMask ) - SetStrictFormat( (BOOL)pMgr->ReadShort() ); + SetStrictFormat( (sal_Bool)pMgr->ReadShort() ); if ( PATTERNFORMATTER_EDITMASK & nMask ) aEditMask = ByteString( pMgr->ReadString(), RTL_TEXTENCODING_ASCII_US ); @@ -874,7 +874,7 @@ void PatternFormatter::SetString( const XubString& rStr ) if ( GetField() ) { GetField()->SetText( rStr ); - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); } } @@ -896,7 +896,7 @@ void PatternFormatter::Reformat() { ImplSetText( ImplPatternReformat( GetField()->GetText(), maEditMask, maLiteralMask, mnFormatFlags ) ); if ( !mbSameMask && IsStrictFormat() && !GetField()->IsReadOnly() ) - GetField()->SetInsertMode( FALSE ); + GetField()->SetInsertMode( sal_False ); } } @@ -967,7 +967,7 @@ long PatternField::PreNotify( NotifyEvent& rNEvt ) long PatternField::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) ) @@ -986,7 +986,7 @@ void PatternField::Modify() if ( IsStrictFormat() ) ImplPatternProcessStrictModify( GetField(), GetEditMask(), GetLiteralMask(), GetFormatFlags(), ImplIsSameMask() ); else - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); } SpinField::Modify(); @@ -1045,7 +1045,7 @@ long PatternBox::PreNotify( NotifyEvent& rNEvt ) long PatternBox::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) ) @@ -1064,7 +1064,7 @@ void PatternBox::Modify() if ( IsStrictFormat() ) ImplPatternProcessStrictModify( GetField(), GetEditMask(), GetLiteralMask(), GetFormatFlags(), ImplIsSameMask() ); else - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); } ComboBox::Modify(); @@ -1075,21 +1075,21 @@ void PatternBox::Modify() void PatternBox::ReformatAll() { XubString aStr; - SetUpdateMode( FALSE ); - USHORT nEntryCount = GetEntryCount(); - for ( USHORT i=0; i < nEntryCount; i++ ) + SetUpdateMode( sal_False ); + sal_uInt16 nEntryCount = GetEntryCount(); + for ( sal_uInt16 i=0; i < nEntryCount; i++ ) { aStr = ImplPatternReformat( GetEntry( i ), GetEditMask(), GetLiteralMask(), GetFormatFlags() ); RemoveEntry( i ); InsertEntry( aStr, i ); } PatternFormatter::Reformat(); - SetUpdateMode( TRUE ); + SetUpdateMode( sal_True ); } // ----------------------------------------------------------------------- -void PatternBox::InsertString( const XubString& rStr, USHORT nPos ) +void PatternBox::InsertString( const XubString& rStr, sal_uInt16 nPos ) { ComboBox::InsertEntry( ImplPatternReformat( rStr, GetEditMask(), GetLiteralMask(), GetFormatFlags() ), nPos ); } @@ -1103,14 +1103,14 @@ void PatternBox::RemoveString( const XubString& rStr ) // ----------------------------------------------------------------------- -XubString PatternBox::GetString( USHORT nPos ) const +XubString PatternBox::GetString( sal_uInt16 nPos ) const { return ImplPatternReformat( ComboBox::GetEntry( nPos ), GetEditMask(), GetLiteralMask(), GetFormatFlags() ); } // ----------------------------------------------------------------------- -USHORT PatternBox::GetStringPos( const XubString& rStr ) const +sal_uInt16 PatternBox::GetStringPos( const XubString& rStr ) const { return ComboBox::GetEntryPos( ImplPatternReformat( rStr, GetEditMask(), GetLiteralMask(), GetFormatFlags() ) ); } @@ -1129,7 +1129,7 @@ static ExtDateFieldFormat ImplGetExtFormat( DateFormat eOld ) // ----------------------------------------------------------------------- -static USHORT ImplCutNumberFromString( XubString& rStr ) +static sal_uInt16 ImplCutNumberFromString( XubString& rStr ) { // Nach Zahl suchen while ( rStr.Len() && !(rStr.GetChar( 0 ) >= '0' && rStr.GetChar( 0 ) <= '9') ) @@ -1142,28 +1142,28 @@ static USHORT ImplCutNumberFromString( XubString& rStr ) aNumStr.Insert( rStr.GetChar( 0 ) ); rStr.Erase( 0, 1 ); } - return (USHORT)aNumStr.ToInt32(); + return (sal_uInt16)aNumStr.ToInt32(); } // ----------------------------------------------------------------------- -static BOOL ImplCutMonthName( XubString& rStr, const XubString& _rLookupMonthName ) +static sal_Bool ImplCutMonthName( XubString& rStr, const XubString& _rLookupMonthName ) { - USHORT nPos = rStr.Search( _rLookupMonthName ); + sal_uInt16 nPos = rStr.Search( _rLookupMonthName ); if ( nPos != STRING_NOTFOUND ) { rStr.Erase( 0, nPos + _rLookupMonthName.Len() ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -static USHORT ImplCutMonthFromString( XubString& rStr, const CalendarWrapper& rCalendarWrapper ) +static sal_uInt16 ImplCutMonthFromString( XubString& rStr, const CalendarWrapper& rCalendarWrapper ) { // search for a month' name - for ( USHORT i=1; i <= 12; i++ ) + for ( sal_uInt16 i=1; i <= 12; i++ ) { String aMonthName = rCalendarWrapper.getMonths()[i-1].FullName; // long month name? @@ -1191,31 +1191,31 @@ static String ImplGetDateSep( const LocaleDataWrapper& rLocaleDataWrapper, ExtDa return aDateSep; } -static BOOL ImplDateProcessKeyInput( Edit*, const KeyEvent& rKEvt, ExtDateFieldFormat eFormat, +static sal_Bool ImplDateProcessKeyInput( Edit*, const KeyEvent& rKEvt, ExtDateFieldFormat eFormat, const LocaleDataWrapper& rLocaleDataWrapper ) { xub_Unicode cChar = rKEvt.GetCharCode(); - USHORT nGroup = rKEvt.GetKeyCode().GetGroup(); + sal_uInt16 nGroup = rKEvt.GetKeyCode().GetGroup(); if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) || (nGroup == KEYGROUP_MISC)|| ((cChar >= '0') && (cChar <= '9')) || (cChar == ImplGetDateSep( rLocaleDataWrapper, eFormat ).GetChar(0) ) ) - return FALSE; + return sal_False; else - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFormat eDateFormat, +static sal_Bool ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFormat eDateFormat, const LocaleDataWrapper& rLocaleDataWrapper, const CalendarWrapper& rCalendarWrapper, const AllSettings& ) { - USHORT nDay = 0; - USHORT nMonth = 0; - USHORT nYear = 0; - BOOL bYear = TRUE; - BOOL bError = FALSE; + sal_uInt16 nDay = 0; + sal_uInt16 nMonth = 0; + sal_uInt16 nYear = 0; + sal_Bool bYear = sal_True; + sal_Bool bError = sal_False; String aStr( rStr ); if ( eDateFormat == XTDATEF_SYSTEM_LONG ) @@ -1245,13 +1245,13 @@ static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFo { // Check if year is present: String aDateSep = ImplGetDateSep( rLocaleDataWrapper, eDateFormat ); - USHORT nSepPos = aStr.Search( aDateSep ); + sal_uInt16 nSepPos = aStr.Search( aDateSep ); if ( nSepPos == STRING_NOTFOUND ) - return FALSE; + return sal_False; nSepPos = aStr.Search( aDateSep, nSepPos+1 ); if ( ( nSepPos == STRING_NOTFOUND ) || ( nSepPos == (aStr.Len()-1) ) ) { - bYear = FALSE; + bYear = sal_False; nYear = Date().GetYear(); } @@ -1304,25 +1304,25 @@ static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFo } if ( bError || !nDay || !nMonth ) - return FALSE; + return sal_False; Date aNewDate( nDay, nMonth, nYear ); DateFormatter::ExpandCentury( aNewDate, utl::MiscCfg().GetYear2000() ); if ( aNewDate.IsValid() ) { rDate = aNewDate; - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL DateFormatter::ImplDateReformat( const XubString& rStr, XubString& rOutStr, const AllSettings& rSettings ) +sal_Bool DateFormatter::ImplDateReformat( const XubString& rStr, XubString& rOutStr, const AllSettings& rSettings ) { Date aDate( 0, 0, 0 ); - if ( !ImplDateGetValue( rStr, aDate, GetExtDateFormat(TRUE), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetFieldSettings() ) ) - return TRUE; + if ( !ImplDateGetValue( rStr, aDate, GetExtDateFormat(sal_True), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetFieldSettings() ) ) + return sal_True; Date aTempDate = aDate; if ( aTempDate > GetMax() ) @@ -1336,7 +1336,7 @@ BOOL DateFormatter::ImplDateReformat( const XubString& rStr, XubString& rOutStr, if( !GetErrorHdl().Call( this ) ) { maCorrectedDate = Date(); - return FALSE; + return sal_False; } else maCorrectedDate = Date(); @@ -1344,7 +1344,7 @@ BOOL DateFormatter::ImplDateReformat( const XubString& rStr, XubString& rOutStr, rOutStr = ImplGetDateAsText( aTempDate, rSettings ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -1352,7 +1352,7 @@ BOOL DateFormatter::ImplDateReformat( const XubString& rStr, XubString& rOutStr, XubString DateFormatter::ImplGetDateAsText( const Date& rDate, const AllSettings& ) const { - BOOL bShowCentury = FALSE; + sal_Bool bShowCentury = sal_False; switch ( GetExtDateFormat() ) { case XTDATEF_SYSTEM_SHORT_YYYY: @@ -1362,43 +1362,43 @@ XubString DateFormatter::ImplGetDateAsText( const Date& rDate, case XTDATEF_SHORT_YYYYMMDD: case XTDATEF_SHORT_YYYYMMDD_DIN5008: { - bShowCentury = TRUE; + bShowCentury = sal_True; } break; default: { - bShowCentury = FALSE; + bShowCentury = sal_False; } } if ( !bShowCentury ) { // Check if I have to use force showing the century - USHORT nTwoDigitYearStart = utl::MiscCfg().GetYear2000(); - USHORT nYear = rDate.GetYear(); + sal_uInt16 nTwoDigitYearStart = utl::MiscCfg().GetYear2000(); + sal_uInt16 nYear = rDate.GetYear(); // Wenn Jahr nicht im 2stelligen Grenzbereich liegt, if ( (nYear < nTwoDigitYearStart) || (nYear >= nTwoDigitYearStart+100) ) - bShowCentury = TRUE; + bShowCentury = sal_True; } sal_Unicode aBuf[128]; sal_Unicode* pBuf = aBuf; - String aDateSep = ImplGetDateSep( ImplGetLocaleDataWrapper(), GetExtDateFormat( TRUE ) ); - USHORT nDay = rDate.GetDay(); - USHORT nMonth = rDate.GetMonth(); - USHORT nYear = rDate.GetYear(); - USHORT nYearLen = bShowCentury ? 4 : 2; + String aDateSep = ImplGetDateSep( ImplGetLocaleDataWrapper(), GetExtDateFormat( sal_True ) ); + sal_uInt16 nDay = rDate.GetDay(); + sal_uInt16 nMonth = rDate.GetMonth(); + sal_uInt16 nYear = rDate.GetYear(); + sal_uInt16 nYearLen = bShowCentury ? 4 : 2; if ( !bShowCentury ) nYear %= 100; - switch ( GetExtDateFormat( TRUE ) ) + switch ( GetExtDateFormat( sal_True ) ) { case XTDATEF_SYSTEM_LONG: { - return ImplGetLocaleDataWrapper().getLongDate( rDate, GetCalendarWrapper(), 1, FALSE, 1, !bShowCentury ); + return ImplGetLocaleDataWrapper().getLongDate( rDate, GetCalendarWrapper(), 1, sal_False, 1, !bShowCentury ); } case XTDATEF_SHORT_DDMMYY: case XTDATEF_SHORT_DDMMYYYY: @@ -1438,12 +1438,12 @@ XubString DateFormatter::ImplGetDateAsText( const Date& rDate, } } - return String( aBuf, (xub_StrLen)(ULONG)(pBuf-aBuf) ); + return String( aBuf, (xub_StrLen)(sal_uLong)(pBuf-aBuf) ); } // ----------------------------------------------------------------------- -static void ImplDateIncrementDay( Date& rDate, BOOL bUp ) +static void ImplDateIncrementDay( Date& rDate, sal_Bool bUp ) { DateFormatter::ExpandCentury( rDate ); @@ -1461,12 +1461,12 @@ static void ImplDateIncrementDay( Date& rDate, BOOL bUp ) // ----------------------------------------------------------------------- -static void ImplDateIncrementMonth( Date& rDate, BOOL bUp ) +static void ImplDateIncrementMonth( Date& rDate, sal_Bool bUp ) { DateFormatter::ExpandCentury( rDate ); - USHORT nMonth = rDate.GetMonth(); - USHORT nYear = rDate.GetYear(); + sal_uInt16 nMonth = rDate.GetMonth(); + sal_uInt16 nYear = rDate.GetYear(); if ( bUp ) { if ( (nMonth == 12) && (nYear < 9999) ) @@ -1494,18 +1494,18 @@ static void ImplDateIncrementMonth( Date& rDate, BOOL bUp ) } } - USHORT nDaysInMonth = rDate.GetDaysInMonth(); + sal_uInt16 nDaysInMonth = rDate.GetDaysInMonth(); if ( rDate.GetDay() > nDaysInMonth ) rDate.SetDay( nDaysInMonth ); } // ----------------------------------------------------------------------- -static void ImplDateIncrementYear( Date& rDate, BOOL bUp ) +static void ImplDateIncrementYear( Date& rDate, sal_Bool bUp ) { DateFormatter::ExpandCentury( rDate ); - USHORT nYear = rDate.GetYear(); + sal_uInt16 nYear = rDate.GetYear(); if ( bUp ) { if ( nYear < 9999 ) @@ -1519,14 +1519,14 @@ static void ImplDateIncrementYear( Date& rDate, BOOL bUp ) } // ----------------------------------------------------------------------- -BOOL DateFormatter::ImplAllowMalformedInput() const +sal_Bool DateFormatter::ImplAllowMalformedInput() const { return !IsEnforceValidValue(); } // ----------------------------------------------------------------------- -void DateField::ImplDateSpinArea( BOOL bUp ) +void DateField::ImplDateSpinArea( sal_Bool bUp ) { // Wenn alles selektiert ist, Tage hochzaehlen if ( GetField() ) @@ -1541,7 +1541,7 @@ void DateField::ImplDateSpinArea( BOOL bUp ) { xub_StrLen nDateArea = 0; - ExtDateFieldFormat eFormat = GetExtDateFormat( TRUE ); + ExtDateFieldFormat eFormat = GetExtDateFormat( sal_True ); if ( eFormat == XTDATEF_SYSTEM_LONG ) { eFormat = ImplGetExtFormat( ImplGetLocaleDataWrapper().getLongDateFormat() ); @@ -1555,7 +1555,7 @@ void DateField::ImplDateSpinArea( BOOL bUp ) for ( xub_StrLen i = 1; i <= 3; i++ ) { nPos = aText.Search( aDateSep, nPos ); - if ( nPos >= (USHORT)aSelection.Max() ) + if ( nPos >= (sal_uInt16)aSelection.Max() ) { nDateArea = i; break; @@ -1620,8 +1620,8 @@ void DateField::ImplDateSpinArea( BOOL bUp ) void DateFormatter::ImplInit() { - mbLongFormat = FALSE; - mbShowDateCentury = TRUE; + mbLongFormat = sal_False; + mbShowDateCentury = sal_True; mpCalendarWrapper = NULL; mnDateFormat = 0xFFFF; mnExtDateFormat = XTDATEF_SYSTEM_SHORT; @@ -1634,7 +1634,7 @@ DateFormatter::DateFormatter() : maLastDate( 0 ), maMin( 1, 1, 1900 ), maMax( 31, 12, 2200 ), - mbEnforceValidValue( TRUE ) + mbEnforceValidValue( sal_True ) { ImplInit(); } @@ -1646,7 +1646,7 @@ void DateFormatter::ImplLoadRes( const ResId& rResId ) ResMgr* pMgr = rResId.GetResMgr(); if( pMgr ) { - ULONG nMask = pMgr->ReadLong(); + sal_uLong nMask = pMgr->ReadLong(); if ( DATEFORMATTER_MIN & nMask ) { @@ -1659,10 +1659,10 @@ void DateFormatter::ImplLoadRes( const ResId& rResId ) pMgr->Increment( pMgr->GetObjSize( (RSHEADER_TYPE*)pMgr->GetClass() ) ); } if ( DATEFORMATTER_LONGFORMAT & nMask ) - mbLongFormat = (BOOL)pMgr->ReadShort(); + mbLongFormat = (sal_Bool)pMgr->ReadShort(); if ( DATEFORMATTER_STRICTFORMAT & nMask ) - SetStrictFormat( (BOOL)pMgr->ReadShort() ); + SetStrictFormat( (sal_Bool)pMgr->ReadShort() ); if ( DATEFORMATTER_VALUE & nMask ) { @@ -1718,13 +1718,13 @@ void DateFormatter::SetExtDateFormat( ExtDateFieldFormat eFormat ) // ----------------------------------------------------------------------- -ExtDateFieldFormat DateFormatter::GetExtDateFormat( BOOL bResolveSystemFormat ) const +ExtDateFieldFormat DateFormatter::GetExtDateFormat( sal_Bool bResolveSystemFormat ) const { ExtDateFieldFormat eDateFormat = (ExtDateFieldFormat)mnExtDateFormat; if ( bResolveSystemFormat && ( eDateFormat <= XTDATEF_SYSTEM_SHORT_YYYY ) ) { - BOOL bShowCentury = (eDateFormat == XTDATEF_SYSTEM_SHORT_YYYY); + sal_Bool bShowCentury = (eDateFormat == XTDATEF_SYSTEM_SHORT_YYYY); switch ( ImplGetLocaleDataWrapper().getDateFormat() ) { case DMY: eDateFormat = bShowCentury ? XTDATEF_SHORT_DDMMYYYY : XTDATEF_SHORT_DDMMYY; @@ -1766,7 +1766,7 @@ void DateFormatter::SetMax( const Date& rNewMax ) // ----------------------------------------------------------------------- -void DateFormatter::SetLongFormat( BOOL bLong ) +void DateFormatter::SetLongFormat( sal_Bool bLong ) { mbLongFormat = bLong; @@ -1786,7 +1786,7 @@ void DateFormatter::SetLongFormat( BOOL bLong ) // ----------------------------------------------------------------------- -void DateFormatter::SetShowDateCentury( BOOL bShowDateCentury ) +void DateFormatter::SetShowDateCentury( sal_Bool bShowDateCentury ) { mbShowDateCentury = bShowDateCentury; @@ -1902,7 +1902,7 @@ Date DateFormatter::GetDate() const if ( GetField() ) { - if ( ImplDateGetValue( GetField()->GetText(), aDate, GetExtDateFormat(TRUE), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetFieldSettings() ) ) + if ( ImplDateGetValue( GetField()->GetText(), aDate, GetExtDateFormat(sal_True), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetFieldSettings() ) ) { if ( aDate > maMax ) aDate = maMax; @@ -1942,7 +1942,7 @@ Date DateFormatter::GetRealDate() const if ( GetField() ) { - if ( !ImplDateGetValue( GetField()->GetText(), aDate, GetExtDateFormat(TRUE), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetFieldSettings() ) ) + if ( !ImplDateGetValue( GetField()->GetText(), aDate, GetExtDateFormat(sal_True), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetFieldSettings() ) ) if ( ImplAllowMalformedInput() ) aDate = GetInvalidDate(); } @@ -1959,20 +1959,20 @@ void DateFormatter::SetEmptyDate() // ----------------------------------------------------------------------- -BOOL DateFormatter::IsEmptyDate() const +sal_Bool DateFormatter::IsEmptyDate() const { - BOOL bEmpty = FormatterBase::IsEmptyFieldValue(); + sal_Bool bEmpty = FormatterBase::IsEmptyFieldValue(); if ( GetField() && MustBeReformatted() && IsEmptyFieldValueEnabled() ) { if ( !GetField()->GetText().Len() ) { - bEmpty = TRUE; + bEmpty = sal_True; } else if ( !maLastDate.GetDate() ) { Date aDate; - bEmpty = !ImplDateGetValue( GetField()->GetText(), aDate, GetExtDateFormat(TRUE), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetFieldSettings() ); + bEmpty = !ImplDateGetValue( GetField()->GetText(), aDate, GetExtDateFormat(sal_True), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetFieldSettings() ); } } return bEmpty; @@ -1980,14 +1980,14 @@ BOOL DateFormatter::IsEmptyDate() const // ----------------------------------------------------------------------- -BOOL DateFormatter::IsDateModified() const +sal_Bool DateFormatter::IsDateModified() const { if ( ImplGetEmptyFieldValue() ) return !IsEmptyDate(); else if ( GetDate() != maFieldDate ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -2001,14 +2001,14 @@ void DateFormatter::Reformat() return; XubString aStr; - BOOL bOK = ImplDateReformat( GetField()->GetText(), aStr, GetFieldSettings() ); + sal_Bool bOK = ImplDateReformat( GetField()->GetText(), aStr, GetFieldSettings() ); if( !bOK ) return; if ( aStr.Len() ) { ImplSetText( aStr ); - ImplDateGetValue( aStr, maLastDate, GetExtDateFormat(TRUE), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetFieldSettings() ); + ImplDateGetValue( aStr, maLastDate, GetExtDateFormat(sal_True), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetFieldSettings() ); } else { @@ -2019,7 +2019,7 @@ void DateFormatter::Reformat() else { ImplSetText( ImplGetSVEmptyStr() ); - SetEmptyFieldValueData( TRUE ); + SetEmptyFieldValueData( sal_True ); } } } @@ -2033,12 +2033,12 @@ void DateFormatter::ExpandCentury( Date& rDate ) // ----------------------------------------------------------------------- -void DateFormatter::ExpandCentury( Date& rDate, USHORT nTwoDigitYearStart ) +void DateFormatter::ExpandCentury( Date& rDate, sal_uInt16 nTwoDigitYearStart ) { - USHORT nDateYear = rDate.GetYear(); + sal_uInt16 nDateYear = rDate.GetYear(); if ( nDateYear < 100 ) { - USHORT nCentury = nTwoDigitYearStart / 100; + sal_uInt16 nCentury = nTwoDigitYearStart / 100; if ( nDateYear < (nTwoDigitYearStart % 100) ) nCentury++; rDate.SetYear( nDateYear + (nCentury*100) ); @@ -2089,7 +2089,7 @@ void DateField::ImplLoadRes( const ResId& rResId ) { DateFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes(), *pMgr ) ); - ULONG nMask = ReadLongRes(); + sal_uLong nMask = ReadLongRes(); if ( DATEFIELD_FIRST & nMask ) { maFirst = Date( ResId( (RSHEADER_TYPE *)GetClassRes(), *pMgr ) ); @@ -2119,7 +2119,7 @@ long DateField::PreNotify( NotifyEvent& rNEvt ) ( GetExtDateFormat() != XTDATEF_SYSTEM_LONG ) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) { - if ( ImplDateProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetExtDateFormat( TRUE ), ImplGetLocaleDataWrapper() ) ) + if ( ImplDateProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetExtDateFormat( sal_True ), ImplGetLocaleDataWrapper() ) ) return 1; } @@ -2131,7 +2131,7 @@ long DateField::PreNotify( NotifyEvent& rNEvt ) long DateField::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { if ( MustBeReformatted() ) @@ -2141,7 +2141,7 @@ long DateField::Notify( NotifyEvent& rNEvt ) // !!! allen anderen Feldern anders behandelt wird. // !!! Siehe dazu Bug: 52304 - BOOL bTextLen = GetText().Len() != 0; + sal_Bool bTextLen = GetText().Len() != 0; if ( bTextLen || !IsEmptyFieldValueEnabled() ) { if ( !ImplAllowMalformedInput() ) @@ -2149,7 +2149,7 @@ long DateField::Notify( NotifyEvent& rNEvt ) else { Date aDate( 0, 0, 0 ); - if ( ImplDateGetValue( GetText(), aDate, GetExtDateFormat(TRUE), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetFieldSettings() ) ) + if ( ImplDateGetValue( GetText(), aDate, GetExtDateFormat(sal_True), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetFieldSettings() ) ) // even with strict text analysis, our text is a valid date -> do a complete // reformat Reformat(); @@ -2158,7 +2158,7 @@ long DateField::Notify( NotifyEvent& rNEvt ) else if ( !bTextLen && IsEmptyFieldValueEnabled() ) { ResetLastDate(); - SetEmptyFieldValueData( TRUE ); + SetEmptyFieldValueData( sal_True ); } } } @@ -2184,7 +2184,7 @@ void DateField::DataChanged( const DataChangedEvent& rDCEvt ) void DateField::Modify() { - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); SpinField::Modify(); } @@ -2192,7 +2192,7 @@ void DateField::Modify() void DateField::Up() { - ImplDateSpinArea( TRUE ); + ImplDateSpinArea( sal_True ); SpinField::Up(); } @@ -2200,7 +2200,7 @@ void DateField::Up() void DateField::Down() { - ImplDateSpinArea( FALSE ); + ImplDateSpinArea( sal_False ); SpinField::Down(); } @@ -2264,7 +2264,7 @@ long DateBox::PreNotify( NotifyEvent& rNEvt ) ( GetExtDateFormat() != XTDATEF_SYSTEM_LONG ) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) { - if ( ImplDateProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetExtDateFormat( TRUE ), ImplGetLocaleDataWrapper() ) ) + if ( ImplDateProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetExtDateFormat( sal_True ), ImplGetLocaleDataWrapper() ) ) return 1; } @@ -2290,18 +2290,18 @@ void DateBox::DataChanged( const DataChangedEvent& rDCEvt ) long DateBox::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { if ( MustBeReformatted() ) { - BOOL bTextLen = GetText().Len() != 0; + sal_Bool bTextLen = GetText().Len() != 0; if ( bTextLen || !IsEmptyFieldValueEnabled() ) Reformat(); else if ( !bTextLen && IsEmptyFieldValueEnabled() ) { ResetLastDate(); - SetEmptyFieldValueData( TRUE ); + SetEmptyFieldValueData( sal_True ); } } } @@ -2313,7 +2313,7 @@ long DateBox::Notify( NotifyEvent& rNEvt ) void DateBox::Modify() { - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); ComboBox::Modify(); } @@ -2322,21 +2322,21 @@ void DateBox::Modify() void DateBox::ReformatAll() { XubString aStr; - SetUpdateMode( FALSE ); - USHORT nEntryCount = GetEntryCount(); - for ( USHORT i=0; i < nEntryCount; i++ ) + SetUpdateMode( sal_False ); + sal_uInt16 nEntryCount = GetEntryCount(); + for ( sal_uInt16 i=0; i < nEntryCount; i++ ) { ImplDateReformat( GetEntry( i ), aStr, GetFieldSettings() ); RemoveEntry( i ); InsertEntry( aStr, i ); } DateFormatter::Reformat(); - SetUpdateMode( TRUE ); + SetUpdateMode( sal_True ); } // ----------------------------------------------------------------------- -void DateBox::InsertDate( const Date& rDate, USHORT nPos ) +void DateBox::InsertDate( const Date& rDate, sal_uInt16 nPos ) { Date aDate = rDate; if ( aDate > GetMax() ) @@ -2356,20 +2356,20 @@ void DateBox::RemoveDate( const Date& rDate ) // ----------------------------------------------------------------------- -Date DateBox::GetDate( USHORT nPos ) const +Date DateBox::GetDate( sal_uInt16 nPos ) const { Date aDate( 0, 0, 0 ); - ImplDateGetValue( ComboBox::GetEntry( nPos ), aDate, GetExtDateFormat(TRUE), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetSettings() ); + ImplDateGetValue( ComboBox::GetEntry( nPos ), aDate, GetExtDateFormat(sal_True), ImplGetLocaleDataWrapper(), GetCalendarWrapper(), GetSettings() ); return aDate; } // ----------------------------------------------------------------------- -USHORT DateBox::GetDatePos( const Date& rDate ) const +sal_uInt16 DateBox::GetDatePos( const Date& rDate ) const { XubString aStr; if ( IsLongFormat() ) - aStr = ImplGetLocaleDataWrapper().getLongDate( rDate, GetCalendarWrapper(), 1, FALSE, 1, !IsShowDateCentury() ); + aStr = ImplGetLocaleDataWrapper().getLongDate( rDate, GetCalendarWrapper(), 1, sal_False, 1, !IsShowDateCentury() ); else aStr = ImplGetLocaleDataWrapper().getDate( rDate ); return ComboBox::GetEntryPos( aStr ); @@ -2377,18 +2377,18 @@ USHORT DateBox::GetDatePos( const Date& rDate ) const // ----------------------------------------------------------------------- -static BOOL ImplTimeProcessKeyInput( Edit*, const KeyEvent& rKEvt, - BOOL bStrictFormat, BOOL bDuration, +static sal_Bool ImplTimeProcessKeyInput( Edit*, const KeyEvent& rKEvt, + sal_Bool bStrictFormat, sal_Bool bDuration, TimeFieldFormat eFormat, const LocaleDataWrapper& rLocaleDataWrapper ) { xub_Unicode cChar = rKEvt.GetCharCode(); if ( !bStrictFormat ) - return FALSE; + return sal_False; else { - USHORT nGroup = rKEvt.GetKeyCode().GetGroup(); + sal_uInt16 nGroup = rKEvt.GetKeyCode().GetGroup(); if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) || (nGroup == KEYGROUP_MISC) || ((cChar >= '0') && (cChar <= '9')) || @@ -2400,55 +2400,55 @@ static BOOL ImplTimeProcessKeyInput( Edit*, const KeyEvent& rKEvt, ((eFormat == TIMEF_100TH_SEC) && (cChar == rLocaleDataWrapper.getTime100SecSep())) || ((eFormat == TIMEF_SEC_CS) && (cChar == rLocaleDataWrapper.getTime100SecSep())) || (bDuration && (cChar == '-')) ) - return FALSE; + return sal_False; else - return TRUE; + return sal_True; } } // ----------------------------------------------------------------------- -static BOOL ImplIsOnlyDigits( const String& _rStr ) +static sal_Bool ImplIsOnlyDigits( const String& _rStr ) { const sal_Unicode* _pChr = _rStr.GetBuffer(); for ( xub_StrLen i = 0; i < _rStr.Len(); ++i, ++_pChr ) { if ( *_pChr < '0' || *_pChr > '9' ) - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -static BOOL ImplIsValidTimePortion( BOOL _bSkipInvalidCharacters, const String& _rStr ) +static sal_Bool ImplIsValidTimePortion( sal_Bool _bSkipInvalidCharacters, const String& _rStr ) { if ( !_bSkipInvalidCharacters ) { if ( ( _rStr.Len() > 2 ) || ( _rStr.Len() < 1 ) || !ImplIsOnlyDigits( _rStr ) ) - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -static BOOL ImplCutTimePortion( String& _rStr, xub_StrLen _nSepPos, BOOL _bSkipInvalidCharacters, short* _pPortion ) +static sal_Bool ImplCutTimePortion( String& _rStr, xub_StrLen _nSepPos, sal_Bool _bSkipInvalidCharacters, short* _pPortion ) { String sPortion = _rStr.Copy( 0, _nSepPos ); _rStr.Erase( 0, _nSepPos + 1 ); if ( !ImplIsValidTimePortion( _bSkipInvalidCharacters, sPortion ) ) - return FALSE; + return sal_False; *_pPortion = (short)sPortion.ToInt32(); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -static BOOL ImplTimeGetValue( const XubString& rStr, Time& rTime, - TimeFieldFormat eFormat, BOOL bDuration, - const LocaleDataWrapper& rLocaleDataWrapper, BOOL _bSkipInvalidCharacters = TRUE ) +static sal_Bool ImplTimeGetValue( const XubString& rStr, Time& rTime, + TimeFieldFormat eFormat, sal_Bool bDuration, + const LocaleDataWrapper& rLocaleDataWrapper, sal_Bool _bSkipInvalidCharacters = sal_True ) { XubString aStr = rStr; short nHour = 0; @@ -2458,7 +2458,7 @@ static BOOL ImplTimeGetValue( const XubString& rStr, Time& rTime, Time aTime( 0, 0, 0 ); if ( !rStr.Len() ) - return FALSE; + return sal_False; // Nach Separatoren suchen if ( rLocaleDataWrapper.getTimeSep().Len() ) @@ -2480,34 +2480,34 @@ static BOOL ImplTimeGetValue( const XubString& rStr, Time& rTime, } } - BOOL bNegative = FALSE; + sal_Bool bNegative = sal_False; xub_StrLen nSepPos = aStr.Search( rLocaleDataWrapper.getTimeSep() ); if ( aStr.GetChar( 0 ) == '-' ) - bNegative = TRUE; + bNegative = sal_True; if ( eFormat != TIMEF_SEC_CS ) { if ( nSepPos == STRING_NOTFOUND ) nSepPos = aStr.Len(); if ( !ImplCutTimePortion( aStr, nSepPos, _bSkipInvalidCharacters, &nHour ) ) - return FALSE; + return sal_False; nSepPos = aStr.Search( rLocaleDataWrapper.getTimeSep() ); if ( aStr.GetChar( 0 ) == '-' ) - bNegative = TRUE; + bNegative = sal_True; if ( nSepPos != STRING_NOTFOUND ) { if ( !ImplCutTimePortion( aStr, nSepPos, _bSkipInvalidCharacters, &nMinute ) ) - return FALSE; + return sal_False; nSepPos = aStr.Search( rLocaleDataWrapper.getTimeSep() ); if ( aStr.GetChar( 0 ) == '-' ) - bNegative = TRUE; + bNegative = sal_True; if ( nSepPos != STRING_NOTFOUND ) { if ( !ImplCutTimePortion( aStr, nSepPos, _bSkipInvalidCharacters, &nSecond ) ) - return FALSE; + return sal_False; if ( aStr.GetChar( 0 ) == '-' ) - bNegative = TRUE; + bNegative = sal_True; n100Sec = (short)aStr.ToInt32(); } else @@ -2531,7 +2531,7 @@ static BOOL ImplTimeGetValue( const XubString& rStr, Time& rTime, nSepPos = aStr.Search( rLocaleDataWrapper.getTimeSep() ); if ( aStr.GetChar( 0 ) == '-' ) - bNegative = TRUE; + bNegative = sal_True; if ( nSepPos != STRING_NOTFOUND ) { nMinute = nSecond; @@ -2540,7 +2540,7 @@ static BOOL ImplTimeGetValue( const XubString& rStr, Time& rTime, nSepPos = aStr.Search( rLocaleDataWrapper.getTimeSep() ); if ( aStr.GetChar( 0 ) == '-' ) - bNegative = TRUE; + bNegative = sal_True; if ( nSepPos != STRING_NOTFOUND ) { nHour = nMinute; @@ -2592,7 +2592,7 @@ static BOOL ImplTimeGetValue( const XubString& rStr, Time& rTime, } if ( (nMinute > 59) || (nSecond > 59) || (n100Sec > 100) ) - return FALSE; + return sal_False; if ( eFormat == TIMEF_NONE ) nSecond = n100Sec = 0; @@ -2603,7 +2603,7 @@ static BOOL ImplTimeGetValue( const XubString& rStr, Time& rTime, { if ( bNegative || (nHour < 0) || (nMinute < 0) || (nSecond < 0) || (n100Sec < 0) ) - return FALSE; + return sal_False; aStr.ToUpperAscii(); XubString aAM( rLocaleDataWrapper.getTimeAM() ); @@ -2619,39 +2619,39 @@ static BOOL ImplTimeGetValue( const XubString& rStr, Time& rTime, if ( (nHour == 12) && ( ( aStr.Search( aAM ) != STRING_NOTFOUND ) || ( aStr.Search( aAM2 ) != STRING_NOTFOUND ) ) ) nHour = 0; - aTime = Time( (USHORT)nHour, (USHORT)nMinute, (USHORT)nSecond, - (USHORT)n100Sec ); + aTime = Time( (sal_uInt16)nHour, (sal_uInt16)nMinute, (sal_uInt16)nSecond, + (sal_uInt16)n100Sec ); } else { if ( bNegative || (nHour < 0) || (nMinute < 0) || (nSecond < 0) || (n100Sec < 0) ) { - bNegative = TRUE; + bNegative = sal_True; nHour = nHour < 0 ? -nHour : nHour; nMinute = nMinute < 0 ? -nMinute : nMinute; nSecond = nSecond < 0 ? -nSecond : nSecond; n100Sec = n100Sec < 0 ? -n100Sec : n100Sec; } - aTime = Time( (USHORT)nHour, (USHORT)nMinute, (USHORT)nSecond, - (USHORT)n100Sec ); + aTime = Time( (sal_uInt16)nHour, (sal_uInt16)nMinute, (sal_uInt16)nSecond, + (sal_uInt16)n100Sec ); if ( bNegative ) aTime = -aTime; } rTime = aTime; - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL TimeFormatter::ImplTimeReformat( const XubString& rStr, XubString& rOutStr ) +sal_Bool TimeFormatter::ImplTimeReformat( const XubString& rStr, XubString& rOutStr ) { Time aTime( 0, 0, 0 ); if ( !ImplTimeGetValue( rStr, aTime, GetFormat(), IsDuration(), ImplGetLocaleDataWrapper() ) ) - return TRUE; + return sal_True; Time aTempTime = aTime; if ( aTempTime > GetMax() ) @@ -2665,22 +2665,22 @@ BOOL TimeFormatter::ImplTimeReformat( const XubString& rStr, XubString& rOutStr if ( !GetErrorHdl().Call( this ) ) { maCorrectedTime = Time(); - return FALSE; + return sal_False; } else maCorrectedTime = Time(); } - BOOL bSecond = FALSE; - BOOL b100Sec = FALSE; + sal_Bool bSecond = sal_False; + sal_Bool b100Sec = sal_False; if ( meFormat != TIMEF_NONE ) - bSecond = TRUE; + bSecond = sal_True; if ( meFormat == TIMEF_100TH_SEC ) - b100Sec = TRUE; + b100Sec = sal_True; if ( meFormat == TIMEF_SEC_CS ) { - ULONG n = aTempTime.GetHour() * 3600L; + sal_uLong n = aTempTime.GetHour() * 3600L; n += aTempTime.GetMin() * 60L; n += aTempTime.GetSec(); rOutStr = String::CreateFromInt32( n ); @@ -2710,18 +2710,18 @@ BOOL TimeFormatter::ImplTimeReformat( const XubString& rStr, XubString& rOutStr } } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL TimeFormatter::ImplAllowMalformedInput() const +sal_Bool TimeFormatter::ImplAllowMalformedInput() const { return !IsEnforceValidValue(); } // ----------------------------------------------------------------------- -void TimeField::ImplTimeSpinArea( BOOL bUp ) +void TimeField::ImplTimeSpinArea( sal_Bool bUp ) { if ( GetField() ) { @@ -2792,7 +2792,7 @@ void TimeField::ImplTimeSpinArea( BOOL bUp ) void TimeFormatter::ImplInit() { meFormat = TIMEF_NONE; - mbDuration = FALSE; + mbDuration = sal_False; mnTimeFormat = HOUR_24; // Should become a ExtTimeFieldFormat in next implementation, merge with mbDuration and meFormat } @@ -2802,7 +2802,7 @@ TimeFormatter::TimeFormatter() : maLastTime( 0, 0 ), maMin( 0, 0 ), maMax( 23, 59, 59, 99 ), - mbEnforceValidValue( TRUE ), + mbEnforceValidValue( sal_True ), maFieldTime( 0, 0 ) { ImplInit(); @@ -2815,7 +2815,7 @@ void TimeFormatter::ImplLoadRes( const ResId& rResId ) ResMgr* pMgr = rResId.GetResMgr(); if( pMgr ) { - ULONG nMask = pMgr->ReadLong(); + sal_uLong nMask = pMgr->ReadLong(); if ( TIMEFORMATTER_MIN & nMask ) { @@ -2833,10 +2833,10 @@ void TimeFormatter::ImplLoadRes( const ResId& rResId ) meFormat = (TimeFieldFormat)pMgr->ReadLong(); if ( TIMEFORMATTER_DURATION & nMask ) - mbDuration = (BOOL)pMgr->ReadShort(); + mbDuration = (sal_Bool)pMgr->ReadShort(); if ( TIMEFORMATTER_STRICTFORMAT & nMask ) - SetStrictFormat( (BOOL)pMgr->ReadShort() ); + SetStrictFormat( (sal_Bool)pMgr->ReadShort() ); if ( TIMEFORMATTER_VALUE & nMask ) { @@ -2887,7 +2887,7 @@ void TimeFormatter::SetMax( const Time& rNewMax ) void TimeFormatter::SetTimeFormat( TimeFormatter::TimeFormat eNewFormat ) { - mnTimeFormat = sal::static_int_cast<USHORT>(eNewFormat); + mnTimeFormat = sal::static_int_cast<sal_uInt16>(eNewFormat); } // ----------------------------------------------------------------------- @@ -2907,7 +2907,7 @@ void TimeFormatter::SetFormat( TimeFieldFormat eNewFormat ) // ----------------------------------------------------------------------- -void TimeFormatter::SetDuration( BOOL bNewDuration ) +void TimeFormatter::SetDuration( sal_Bool bNewDuration ) { mbDuration = bNewDuration; ReformatAll(); @@ -2919,7 +2919,7 @@ void TimeFormatter::SetTime( const Time& rNewTime ) { SetUserTime( rNewTime ); maFieldTime = maLastTime; - SetEmptyFieldValueData( FALSE ); + SetEmptyFieldValueData( sal_False ); } // ----------------------------------------------------------------------- @@ -2966,15 +2966,15 @@ void TimeFormatter::ImplSetUserTime( const Time& rNewTime, Selection* pNewSelect if ( GetField() ) { XubString aStr; - BOOL bSec = FALSE; - BOOL b100Sec = FALSE; + sal_Bool bSec = sal_False; + sal_Bool b100Sec = sal_False; if ( meFormat != TIMEF_NONE ) - bSec = TRUE; + bSec = sal_True; if ( meFormat == TIMEF_100TH_SEC || meFormat == TIMEF_SEC_CS ) - b100Sec = TRUE; + b100Sec = sal_True; if ( meFormat == TIMEF_SEC_CS ) { - ULONG n = aNewTime.GetHour() * 3600L; + sal_uLong n = aNewTime.GetHour() * 3600L; n += aNewTime.GetMin() * 60L; n += aNewTime.GetSec(); aStr = String::CreateFromInt32( n ); @@ -3025,7 +3025,7 @@ Time TimeFormatter::GetTime() const if ( GetField() ) { - BOOL bAllowMailformed = ImplAllowMalformedInput(); + sal_Bool bAllowMailformed = ImplAllowMalformedInput(); if ( ImplTimeGetValue( GetField()->GetText(), aTime, GetFormat(), IsDuration(), ImplGetLocaleDataWrapper(), !bAllowMailformed ) ) { if ( aTime > GetMax() ) @@ -3053,7 +3053,7 @@ Time TimeFormatter::GetRealTime() const if ( GetField() ) { - BOOL bAllowMailformed = ImplAllowMalformedInput(); + sal_Bool bAllowMailformed = ImplAllowMalformedInput(); if ( !ImplTimeGetValue( GetField()->GetText(), aTime, GetFormat(), IsDuration(), ImplGetLocaleDataWrapper(), !bAllowMailformed ) ) if ( bAllowMailformed ) aTime = GetInvalidTime(); @@ -3064,14 +3064,14 @@ Time TimeFormatter::GetRealTime() const // ----------------------------------------------------------------------- -BOOL TimeFormatter::IsTimeModified() const +sal_Bool TimeFormatter::IsTimeModified() const { if ( ImplGetEmptyFieldValue() ) return !IsEmptyTime(); else if ( GetTime() != maFieldTime ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -3085,7 +3085,7 @@ void TimeFormatter::Reformat() return; XubString aStr; - BOOL bOK = ImplTimeReformat( GetField()->GetText(), aStr ); + sal_Bool bOK = ImplTimeReformat( GetField()->GetText(), aStr ); if ( !bOK ) return; @@ -3106,7 +3106,7 @@ TimeField::TimeField( Window* pParent, WinBits nWinStyle ) : maLast( GetMax() ) { SetField( this ); - SetText( ImplGetLocaleDataWrapper().getTime( maFieldTime, FALSE, FALSE ) ); + SetText( ImplGetLocaleDataWrapper().getTime( maFieldTime, sal_False, sal_False ) ); Reformat(); } @@ -3121,7 +3121,7 @@ TimeField::TimeField( Window* pParent, const ResId& rResId ) : WinBits nStyle = ImplInitRes( rResId ); SpinField::ImplInit( pParent, nStyle ); SetField( this ); - SetText( ImplGetLocaleDataWrapper().getTime( maFieldTime, FALSE, FALSE ) ); + SetText( ImplGetLocaleDataWrapper().getTime( maFieldTime, sal_False, sal_False ) ); ImplLoadRes( rResId ); if ( !(nStyle & WB_HIDE ) ) @@ -3138,7 +3138,7 @@ void TimeField::ImplLoadRes( const ResId& rResId ) { TimeFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes(), *pMgr ) ); - ULONG nMask = ReadLongRes(); + sal_uLong nMask = ReadLongRes(); if ( TIMEFIELD_FIRST & nMask ) { @@ -3179,7 +3179,7 @@ long TimeField::PreNotify( NotifyEvent& rNEvt ) long TimeField::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) ) @@ -3189,7 +3189,7 @@ long TimeField::Notify( NotifyEvent& rNEvt ) else { Time aTime( 0, 0, 0 ); - if ( ImplTimeGetValue( GetText(), aTime, GetFormat(), IsDuration(), ImplGetLocaleDataWrapper(), FALSE ) ) + if ( ImplTimeGetValue( GetText(), aTime, GetFormat(), IsDuration(), ImplGetLocaleDataWrapper(), sal_False ) ) // even with strict text analysis, our text is a valid time -> do a complete // reformat Reformat(); @@ -3218,7 +3218,7 @@ void TimeField::DataChanged( const DataChangedEvent& rDCEvt ) void TimeField::Modify() { - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); SpinField::Modify(); } @@ -3226,7 +3226,7 @@ void TimeField::Modify() void TimeField::Up() { - ImplTimeSpinArea( TRUE ); + ImplTimeSpinArea( sal_True ); SpinField::Up(); } @@ -3234,7 +3234,7 @@ void TimeField::Up() void TimeField::Down() { - ImplTimeSpinArea( FALSE ); + ImplTimeSpinArea( sal_False ); SpinField::Down(); } @@ -3263,40 +3263,40 @@ void TimeField::SetExtFormat( ExtTimeFieldFormat eFormat ) case EXTTIMEF_24H_SHORT: { SetTimeFormat( HOUR_24 ); - SetDuration( FALSE ); + SetDuration( sal_False ); SetFormat( TIMEF_NONE ); } break; case EXTTIMEF_24H_LONG: { SetTimeFormat( HOUR_24 ); - SetDuration( FALSE ); + SetDuration( sal_False ); SetFormat( TIMEF_SEC ); } break; case EXTTIMEF_12H_SHORT: { SetTimeFormat( HOUR_12 ); - SetDuration( FALSE ); + SetDuration( sal_False ); SetFormat( TIMEF_NONE ); } break; case EXTTIMEF_12H_LONG: { SetTimeFormat( HOUR_12 ); - SetDuration( FALSE ); + SetDuration( sal_False ); SetFormat( TIMEF_SEC ); } break; case EXTTIMEF_DURATION_SHORT: { - SetDuration( TRUE ); + SetDuration( sal_True ); SetFormat( TIMEF_NONE ); } break; case EXTTIMEF_DURATION_LONG: { - SetDuration( TRUE ); + SetDuration( sal_True ); SetFormat( TIMEF_SEC ); } break; @@ -3314,7 +3314,7 @@ TimeBox::TimeBox( Window* pParent, WinBits nWinStyle ) : ComboBox( pParent, nWinStyle ) { SetField( this ); - SetText( ImplGetLocaleDataWrapper().getTime( maFieldTime, FALSE, FALSE ) ); + SetText( ImplGetLocaleDataWrapper().getTime( maFieldTime, sal_False, sal_False ) ); Reformat(); } @@ -3327,7 +3327,7 @@ TimeBox::TimeBox( Window* pParent, const ResId& rResId ) : WinBits nStyle = ImplInitRes( rResId ); ComboBox::ImplInit( pParent, nStyle ); SetField( this ); - SetText( ImplGetLocaleDataWrapper().getTime( maFieldTime, FALSE, FALSE ) ); + SetText( ImplGetLocaleDataWrapper().getTime( maFieldTime, sal_False, sal_False ) ); ComboBox::ImplLoadRes( rResId ); ResMgr* pMgr = rResId.GetResMgr(); if( pMgr ) @@ -3362,7 +3362,7 @@ long TimeBox::PreNotify( NotifyEvent& rNEvt ) long TimeBox::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) ) @@ -3390,7 +3390,7 @@ void TimeBox::DataChanged( const DataChangedEvent& rDCEvt ) void TimeBox::Modify() { - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); ComboBox::Modify(); } @@ -3399,21 +3399,21 @@ void TimeBox::Modify() void TimeBox::ReformatAll() { XubString aStr; - SetUpdateMode( FALSE ); - USHORT nEntryCount = GetEntryCount(); - for ( USHORT i=0; i < nEntryCount; i++ ) + SetUpdateMode( sal_False ); + sal_uInt16 nEntryCount = GetEntryCount(); + for ( sal_uInt16 i=0; i < nEntryCount; i++ ) { ImplTimeReformat( GetEntry( i ), aStr ); RemoveEntry( i ); InsertEntry( aStr, i ); } TimeFormatter::Reformat(); - SetUpdateMode( TRUE ); + SetUpdateMode( sal_True ); } // ----------------------------------------------------------------------- -void TimeBox::InsertTime( const Time& rTime, USHORT nPos ) +void TimeBox::InsertTime( const Time& rTime, sal_uInt16 nPos ) { Time aTime = rTime; if ( aTime > GetMax() ) @@ -3421,12 +3421,12 @@ void TimeBox::InsertTime( const Time& rTime, USHORT nPos ) else if ( aTime < GetMin() ) aTime = GetMin(); - BOOL bSec = FALSE; - BOOL b100Sec = FALSE; + sal_Bool bSec = sal_False; + sal_Bool b100Sec = sal_False; if ( GetFormat() == TIMEF_SEC ) - bSec = TRUE; + bSec = sal_True; if ( GetFormat() == TIMEF_100TH_SEC || GetFormat() == TIMEF_SEC_CS ) - bSec = b100Sec = TRUE; + bSec = b100Sec = sal_True; ComboBox::InsertEntry( ImplGetLocaleDataWrapper().getTime( aTime, bSec, b100Sec ), nPos ); } @@ -3434,18 +3434,18 @@ void TimeBox::InsertTime( const Time& rTime, USHORT nPos ) void TimeBox::RemoveTime( const Time& rTime ) { - BOOL bSec = FALSE; - BOOL b100Sec = FALSE; + sal_Bool bSec = sal_False; + sal_Bool b100Sec = sal_False; if ( GetFormat() == TIMEF_SEC ) - bSec = TRUE; + bSec = sal_True; if ( GetFormat() == TIMEF_100TH_SEC || TIMEF_SEC_CS ) - bSec = b100Sec = TRUE; + bSec = b100Sec = sal_True; ComboBox::RemoveEntry( ImplGetLocaleDataWrapper().getTime( rTime, bSec, b100Sec ) ); } // ----------------------------------------------------------------------- -Time TimeBox::GetTime( USHORT nPos ) const +Time TimeBox::GetTime( sal_uInt16 nPos ) const { Time aTime( 0, 0, 0 ); ImplTimeGetValue( ComboBox::GetEntry( nPos ), aTime, GetFormat(), IsDuration(), ImplGetLocaleDataWrapper() ); @@ -3454,14 +3454,14 @@ Time TimeBox::GetTime( USHORT nPos ) const // ----------------------------------------------------------------------- -USHORT TimeBox::GetTimePos( const Time& rTime ) const +sal_uInt16 TimeBox::GetTimePos( const Time& rTime ) const { - BOOL bSec = FALSE; - BOOL b100Sec = FALSE; + sal_Bool bSec = sal_False; + sal_Bool b100Sec = sal_False; if ( GetFormat() == TIMEF_SEC ) - bSec = TRUE; + bSec = sal_True; if ( GetFormat() == TIMEF_100TH_SEC || TIMEF_SEC_CS ) - bSec = b100Sec = TRUE; + bSec = b100Sec = sal_True; return ComboBox::GetEntryPos( ImplGetLocaleDataWrapper().getTime( rTime, bSec, b100Sec ) ); } diff --git a/vcl/source/control/fixbrd.cxx b/vcl/source/control/fixbrd.cxx index 374d15f599f8..4efbbe2deee1 100644 --- a/vcl/source/control/fixbrd.cxx +++ b/vcl/source/control/fixbrd.cxx @@ -40,7 +40,7 @@ void FixedBorder::ImplInit( Window* pParent, WinBits nStyle ) { mnType = FIXEDBORDER_TYPE_DOUBLEOUT; - mbTransparent = TRUE; + mbTransparent = sal_True; nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); @@ -65,18 +65,18 @@ void FixedBorder::ImplInitSettings() !(pParent->GetStyle() & WB_CLIPCHILDREN) ) && !IsControlBackground() && mbTransparent ) { - SetMouseTransparent( TRUE ); - EnableChildTransparentMode( TRUE ); + SetMouseTransparent( sal_True ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - SetMouseTransparent( FALSE ); - EnableChildTransparentMode( FALSE ); + SetMouseTransparent( sal_False ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -115,12 +115,12 @@ FixedBorder::~FixedBorder() // ----------------------------------------------------------------------- -void FixedBorder::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, +void FixedBorder::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); Rectangle aRect( rPos, rSize ); - USHORT nBorderStyle = mnType; + sal_uInt16 nBorderStyle = mnType; if ( (nDrawFlags & WINDOW_DRAW_MONO) || (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ) @@ -158,7 +158,7 @@ void FixedBorder::Paint( const Rectangle& ) // ----------------------------------------------------------------------- void FixedBorder::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - ULONG nFlags ) + sal_uLong nFlags ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -213,7 +213,7 @@ void FixedBorder::DataChanged( const DataChangedEvent& rDCEvt ) // ----------------------------------------------------------------------- -void FixedBorder::SetTransparent( BOOL bTransparent ) +void FixedBorder::SetTransparent( sal_Bool bTransparent ) { if ( mbTransparent != bTransparent ) { @@ -225,7 +225,7 @@ void FixedBorder::SetTransparent( BOOL bTransparent ) // ----------------------------------------------------------------------- -void FixedBorder::SetBorderType( USHORT nType ) +void FixedBorder::SetBorderType( sal_uInt16 nType ) { if ( mnType != nType ) { diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index eed47fb59741..1828ded64a14 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -28,13 +28,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <vcl/decoview.hxx> -#include <vcl/event.hxx> -#include <vcl/fixed.hxx> -#include <vcl/controldata.hxx> -#include <vcl/window.h> +#include "vcl/decoview.hxx" +#include "vcl/event.hxx" +#include "vcl/fixed.hxx" +#include "vcl/controldata.hxx" +#include "vcl/window.h" -#include <tools/rc.h> +#include "tools/rc.h" // ======================================================================= @@ -95,7 +95,7 @@ void FixedText::ImplInit( Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); } // ----------------------------------------------------------------------- @@ -122,8 +122,8 @@ const Color& FixedText::GetCanonicalTextColor( const StyleSettings& _rStyle ) co // ----------------------------------------------------------------------- -void FixedText::ImplInitSettings( BOOL bFont, - BOOL bForeground, BOOL bBackground ) +void FixedText::ImplInitSettings( sal_Bool bFont, + sal_Bool bForeground, sal_Bool bBackground ) { Control::ImplInitSettings( bFont, bForeground ); @@ -132,16 +132,16 @@ void FixedText::ImplInitSettings( BOOL bFont, Window* pParent = GetParent(); if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -183,7 +183,7 @@ FixedText::FixedText( Window* pParent, const ResId& rResId, bool bDisableAccessi ImplInit( pParent, nStyle ); ImplLoadRes( rResId ); if ( bDisableAccessibleLabelForRelation ) - ImplGetWindowImpl()->mbDisableAccessibleLabelForRelation = TRUE; + ImplGetWindowImpl()->mbDisableAccessibleLabelForRelation = sal_True; if ( !(nStyle & WB_HIDE) ) Show(); @@ -191,9 +191,9 @@ FixedText::FixedText( Window* pParent, const ResId& rResId, bool bDisableAccessi // ----------------------------------------------------------------------- -USHORT FixedText::ImplGetTextStyle( WinBits nWinStyle ) +sal_uInt16 FixedText::ImplGetTextStyle( WinBits nWinStyle ) { - USHORT nTextStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_ENDELLIPSIS; + sal_uInt16 nTextStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_ENDELLIPSIS; if( ! (nWinStyle & WB_NOMULTILINE) ) nTextStyle |= TEXT_DRAW_MULTILINE; @@ -224,7 +224,7 @@ USHORT FixedText::ImplGetTextStyle( WinBits nWinStyle ) // ----------------------------------------------------------------------- -void FixedText::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, +void FixedText::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize, bool bFillLayout ) const @@ -232,7 +232,7 @@ void FixedText::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); WinBits nWinStyle = GetStyle(); XubString aText( GetText() ); - USHORT nTextStyle = FixedText::ImplGetTextStyle( nWinStyle ); + sal_uInt16 nTextStyle = FixedText::ImplGetTextStyle( nWinStyle ); Point aPos = rPos; if ( nWinStyle & WB_EXTRAOFFSET ) @@ -280,9 +280,9 @@ void FixedText::Paint( const Rectangle& ) // ----------------------------------------------------------------------- void FixedText::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - ULONG nFlags ) + sal_uLong nFlags ) { - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -297,8 +297,8 @@ void FixedText::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, pDev->SetTextColor( GetTextColor() ); pDev->SetTextFillColor(); - BOOL bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER); - BOOL bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground(); + sal_Bool bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER); + sal_Bool bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground(); if ( bBorder || bBackground ) { Rectangle aRect( aPos, aSize ); @@ -344,24 +344,24 @@ void FixedText::StateChanged( StateChangedType nType ) if ( (GetPrevStyle() & FIXEDTEXT_VIEW_STYLE) != (GetStyle() & FIXEDTEXT_VIEW_STYLE) ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } } else if ( (nType == STATE_CHANGE_ZOOM) || (nType == STATE_CHANGE_CONTROLFONT) ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } } @@ -377,7 +377,7 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); Invalidate(); } } @@ -386,7 +386,7 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt ) Size FixedText::CalcMinimumTextSize( Control const *pControl, long nMaxWidth ) { - USHORT nStyle = ImplGetTextStyle( pControl->GetStyle() ); + sal_uInt16 nStyle = ImplGetTextStyle( pControl->GetStyle() ); if ( !( pControl->GetStyle() & WB_NOLABEL ) ) nStyle |= TEXT_DRAW_MNEMONIC; @@ -435,7 +435,7 @@ void FixedLine::ImplInit( Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); } // ----------------------------------------------------------------------- @@ -462,8 +462,8 @@ const Color& FixedLine::GetCanonicalTextColor( const StyleSettings& _rStyle ) co // ----------------------------------------------------------------------- -void FixedLine::ImplInitSettings( BOOL bFont, - BOOL bForeground, BOOL bBackground ) +void FixedLine::ImplInitSettings( sal_Bool bFont, + sal_Bool bForeground, sal_Bool bBackground ) { Control::ImplInitSettings( bFont, bForeground ); @@ -472,16 +472,16 @@ void FixedLine::ImplInitSettings( BOOL bFont, Window* pParent = GetParent(); if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -502,7 +502,7 @@ void FixedLine::ImplDraw( bool bLayout ) String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; DecorationView aDecoView( this ); - if ( !aText.Len() || (nWinStyle & WB_VERT) ) + if ( !aText.Len() ) { if( !pVector ) { @@ -518,11 +518,34 @@ void FixedLine::ImplDraw( bool bLayout ) } } } + else if( (nWinStyle & WB_VERT) ) + { + long nWidth = GetTextWidth( aText ); + Push( PUSH_FONT ); + Font aFont( GetFont() ); + aFont.SetOrientation( 900 ); + SetFont( aFont ); + Point aStartPt( aOutSize.Width()/2, aOutSize.Height()-1 ); + if( (nWinStyle & WB_VCENTER) ) + aStartPt.Y() -= (aOutSize.Height() - nWidth)/2; + Point aTextPt( aStartPt ); + aTextPt.X() -= GetTextHeight()/2; + DrawText( aTextPt, aText, 0, STRING_LEN, pVector, pDisplayText ); + Pop(); + if( aOutSize.Height() - aStartPt.Y() > FIXEDLINE_TEXT_BORDER ) + aDecoView.DrawSeparator( Point( aStartPt.X(), aOutSize.Height()-1 ), + Point( aStartPt.X(), aStartPt.Y() + FIXEDLINE_TEXT_BORDER ) ); + if( aStartPt.Y() - nWidth - FIXEDLINE_TEXT_BORDER > 0 ) + aDecoView.DrawSeparator( Point( aStartPt.X(), aStartPt.Y() - nWidth - FIXEDLINE_TEXT_BORDER ), + Point( aStartPt.X(), 0 ) ); + } else { - USHORT nStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS; + sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS; Rectangle aRect( 0, 0, aOutSize.Width(), aOutSize.Height() ); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + if( (nWinStyle & WB_CENTER) ) + nStyle |= TEXT_DRAW_CENTER; if ( !IsEnabled() ) nStyle |= TEXT_DRAW_DISABLE; @@ -537,6 +560,8 @@ void FixedLine::ImplDraw( bool bLayout ) { long nTop = aRect.Top() + ((aRect.GetHeight()-1)/2); aDecoView.DrawSeparator( Point( aRect.Right()+FIXEDLINE_TEXT_BORDER, nTop ), Point( aOutSize.Width()-1, nTop ), false ); + if( aRect.Left() > FIXEDLINE_TEXT_BORDER ) + aDecoView.DrawSeparator( Point( 0, nTop ), Point( aRect.Left()-FIXEDLINE_TEXT_BORDER, nTop ), false ); } } } @@ -582,7 +607,7 @@ void FixedLine::Paint( const Rectangle& ) // ----------------------------------------------------------------------- -void FixedLine::Draw( OutputDevice*, const Point&, const Size&, ULONG ) +void FixedLine::Draw( OutputDevice*, const Point&, const Size&, sal_uLong ) { } @@ -618,17 +643,17 @@ void FixedLine::StateChanged( StateChangedType nType ) (nType == STATE_CHANGE_STYLE) || (nType == STATE_CHANGE_CONTROLFONT) ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } } @@ -644,7 +669,7 @@ void FixedLine::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); Invalidate(); } } @@ -686,16 +711,16 @@ void FixedBitmap::ImplInitSettings() Window* pParent = GetParent(); if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -710,7 +735,7 @@ void FixedBitmap::ImplLoadRes( const ResId& rResId ) { Control::ImplLoadRes( rResId ); - ULONG nObjMask = ReadLongRes(); + sal_uLong nObjMask = ReadLongRes(); if ( RSC_FIXEDBITMAP_BITMAP & nObjMask ) { @@ -749,10 +774,10 @@ FixedBitmap::~FixedBitmap() // ----------------------------------------------------------------------- -void FixedBitmap::ImplDraw( OutputDevice* pDev, ULONG /* nDrawFlags */, +void FixedBitmap::ImplDraw( OutputDevice* pDev, sal_uLong /* nDrawFlags */, const Point& rPos, const Size& rSize ) { - USHORT nStyle = 0; + sal_uInt16 nStyle = 0; Bitmap* pBitmap = &maBitmap; Color aCol; @@ -797,7 +822,7 @@ void FixedBitmap::Paint( const Rectangle& ) // ----------------------------------------------------------------------- void FixedBitmap::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - ULONG nFlags ) + sal_uLong nFlags ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -876,10 +901,10 @@ void FixedBitmap::SetBitmap( const Bitmap& rBitmap ) // ----------------------------------------------------------------------- -BOOL FixedBitmap::SetModeBitmap( const Bitmap& rBitmap ) +sal_Bool FixedBitmap::SetModeBitmap( const Bitmap& rBitmap ) { SetBitmap( rBitmap ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -894,7 +919,7 @@ const Bitmap& FixedBitmap::GetModeBitmap( ) const void FixedImage::ImplInit( Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); - mbInUserDraw = FALSE; + mbInUserDraw = sal_False; Control::ImplInit( pParent, nStyle, NULL ); ImplInitSettings(); } @@ -915,16 +940,16 @@ void FixedImage::ImplInitSettings() Window* pParent = GetParent(); if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -939,7 +964,7 @@ void FixedImage::ImplLoadRes( const ResId& rResId ) { Control::ImplLoadRes( rResId ); - ULONG nObjMask = ReadLongRes(); + sal_uLong nObjMask = ReadLongRes(); if ( RSC_FIXEDIMAGE_IMAGE & nObjMask ) { @@ -978,10 +1003,10 @@ FixedImage::~FixedImage() // ----------------------------------------------------------------------- -void FixedImage::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, +void FixedImage::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize ) { - USHORT nStyle = 0; + sal_uInt16 nStyle = 0; if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) ) { if ( !IsEnabled() ) @@ -1003,10 +1028,10 @@ void FixedImage::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, } } - mbInUserDraw = TRUE; + mbInUserDraw = sal_True; UserDrawEvent aUDEvt( pDev, Rectangle( rPos, rSize ), 0, nStyle ); UserDraw( aUDEvt ); - mbInUserDraw = FALSE; + mbInUserDraw = sal_False; } // ----------------------------------------------------------------------- @@ -1033,7 +1058,7 @@ void FixedImage::UserDraw( const UserDrawEvent& ) // ----------------------------------------------------------------------- void FixedImage::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - ULONG nFlags ) + sal_uLong nFlags ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -1115,10 +1140,10 @@ void FixedImage::SetImage( const Image& rImage ) // ----------------------------------------------------------------------- -BOOL FixedImage::SetModeImage( const Image& rImage ) +sal_Bool FixedImage::SetModeImage( const Image& rImage ) { SetImage( rImage ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/group.cxx b/vcl/source/control/group.cxx index 5b062d6ea8ef..52dd061e317e 100644 --- a/vcl/source/control/group.cxx +++ b/vcl/source/control/group.cxx @@ -49,8 +49,8 @@ void GroupBox::ImplInit( Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - SetMouseTransparent( TRUE ); - ImplInitSettings( TRUE, TRUE, TRUE ); + SetMouseTransparent( sal_True ); + ImplInitSettings( sal_True, sal_True, sal_True ); } // ----------------------------------------------------------------------- @@ -77,8 +77,8 @@ const Color& GroupBox::GetCanonicalTextColor( const StyleSettings& _rStyle ) con // ----------------------------------------------------------------------- -void GroupBox::ImplInitSettings( BOOL bFont, - BOOL bForeground, BOOL bBackground ) +void GroupBox::ImplInitSettings( sal_Bool bFont, + sal_Bool bForeground, sal_Bool bBackground ) { Control::ImplInitSettings( bFont, bForeground ); @@ -89,16 +89,16 @@ void GroupBox::ImplInitSettings( BOOL bFont, !(pParent->GetStyle() & WB_CLIPCHILDREN) ) && !IsControlBackground() ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -132,7 +132,7 @@ GroupBox::GroupBox( Window* pParent, const ResId& rResId ) : // ----------------------------------------------------------------------- -void GroupBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, +void GroupBox::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize, bool bLayout ) { OSL_TRACE("GroupBox::ImplDraw Y %d, X %d", rPos.Y(), rPos.X() ); @@ -141,7 +141,7 @@ void GroupBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); XubString aText( GetText() ); Rectangle aRect( rPos, rSize ); - USHORT nTextStyle = TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_MNEMONIC; + sal_uInt16 nTextStyle = TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_MNEMONIC; if ( GetStyle() & WB_NOLABEL ) nTextStyle &= ~TEXT_DRAW_MNEMONIC; @@ -241,7 +241,7 @@ void GroupBox::Paint( const Rectangle& ) // ----------------------------------------------------------------------- void GroupBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - ULONG nFlags ) + sal_uLong nFlags ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -291,17 +291,17 @@ void GroupBox::StateChanged( StateChangedType nType ) else if ( (nType == STATE_CHANGE_ZOOM) || (nType == STATE_CHANGE_CONTROLFONT) ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } } @@ -317,7 +317,7 @@ void GroupBox::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); Invalidate(); } } diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index 0a0d4b8829c2..a288c3656317 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -55,7 +55,7 @@ using namespace ::com::sun::star; // ======================================================================= -void ImplInitFieldSettings( Window* pWin, BOOL bFont, BOOL bForeground, BOOL bBackground ) +void ImplInitFieldSettings( Window* pWin, sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ) { const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings(); @@ -106,7 +106,7 @@ ImplEntryList::ImplEntryList( Window* pWindow ) mnLastSelected = LISTBOX_ENTRY_NOTFOUND; mnSelectionAnchor = LISTBOX_ENTRY_NOTFOUND; mnImages = 0; - mbCallSelectionChangedHdl = TRUE; + mbCallSelectionChangedHdl = sal_True; mnMRUCount = 0; mnMaxMRUCount = 0; @@ -124,7 +124,7 @@ ImplEntryList::~ImplEntryList() void ImplEntryList::Clear() { mnImages = 0; - for ( USHORT n = GetEntryCount(); n; ) + for ( sal_uInt16 n = GetEntryCount(); n; ) { ImplEntryType* pImplEntry = GetEntry( --n ); delete pImplEntry; @@ -134,7 +134,7 @@ void ImplEntryList::Clear() // ----------------------------------------------------------------------- -void ImplEntryList::SelectEntry( USHORT nPos, BOOL bSelect ) +void ImplEntryList::SelectEntry( sal_uInt16 nPos, sal_Bool bSelect ) { ImplEntryType* pImplEntry = GetEntry( nPos ); if ( pImplEntry && @@ -172,7 +172,7 @@ namespace vcl } } -USHORT ImplEntryList::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry, BOOL bSort ) +sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry, sal_Bool bSort ) { if ( !!pNewEntry->maImage ) mnImages++; @@ -186,11 +186,11 @@ USHORT ImplEntryList::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry, BOOL b const comphelper::string::NaturalStringSorter &rSorter = theSorter::get(); const XubString& rStr = pNewEntry->maStr; - ULONG nLow, nHigh, nMid; + sal_uLong nLow, nHigh, nMid; nHigh = Count(); - ImplEntryType* pTemp = GetEntry( (USHORT)(nHigh-1) ); + ImplEntryType* pTemp = GetEntry( (sal_uInt16)(nHigh-1) ); try { @@ -206,12 +206,12 @@ USHORT ImplEntryList::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry, BOOL b else { nLow = mnMRUCount; - pTemp = (ImplEntryType*)GetEntry( (USHORT)nLow ); + pTemp = (ImplEntryType*)GetEntry( (sal_uInt16)nLow ); eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr); if ( eComp != COMPARE_GREATER ) { - Insert( pNewEntry, (ULONG)0 ); + Insert( pNewEntry, (sal_uLong)0 ); } else { @@ -249,17 +249,17 @@ USHORT ImplEntryList::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry, BOOL b // garbage you wouldn't insert it. If the exception occurred because the // Collator implementation is garbage then give the user a chance to see // his stuff - Insert( pNewEntry, (ULONG)0 ); + Insert( pNewEntry, (sal_uLong)0 ); } } - return (USHORT)GetPos( pNewEntry ); + return (sal_uInt16)GetPos( pNewEntry ); } // ----------------------------------------------------------------------- -void ImplEntryList::RemoveEntry( USHORT nPos ) +void ImplEntryList::RemoveEntry( sal_uInt16 nPos ) { ImplEntryType* pImplEntry = (ImplEntryType*)List::Remove( nPos ); if ( pImplEntry ) @@ -273,10 +273,10 @@ void ImplEntryList::RemoveEntry( USHORT nPos ) // ----------------------------------------------------------------------- -USHORT ImplEntryList::FindEntry( const XubString& rString, BOOL bSearchMRUArea ) const +sal_uInt16 ImplEntryList::FindEntry( const XubString& rString, sal_Bool bSearchMRUArea ) const { - USHORT nEntries = GetEntryCount(); - for ( USHORT n = bSearchMRUArea ? 0 : GetMRUCount(); n < nEntries; n++ ) + sal_uInt16 nEntries = GetEntryCount(); + for ( sal_uInt16 n = bSearchMRUArea ? 0 : GetMRUCount(); n < nEntries; n++ ) { ImplEntryType* pImplEntry = GetEntry( n ); String aComp( vcl::I18nHelper::filterFormattingChars( pImplEntry->maStr ) ); @@ -288,21 +288,21 @@ USHORT ImplEntryList::FindEntry( const XubString& rString, BOOL bSearchMRUArea ) // ----------------------------------------------------------------------- -USHORT ImplEntryList::FindMatchingEntry( const XubString& rStr, USHORT nStart, BOOL bForward, BOOL bLazy ) const +sal_uInt16 ImplEntryList::FindMatchingEntry( const XubString& rStr, sal_uInt16 nStart, sal_Bool bForward, sal_Bool bLazy ) const { - USHORT nPos = LISTBOX_ENTRY_NOTFOUND; - USHORT nEntryCount = GetEntryCount(); + sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND; + sal_uInt16 nEntryCount = GetEntryCount(); if ( !bForward ) nStart++; // wird sofort dekrementiert const vcl::I18nHelper& rI18nHelper = mpWindow->GetSettings().GetLocaleI18nHelper(); - for ( USHORT n = nStart; bForward ? ( n < nEntryCount ) : n; ) + for ( sal_uInt16 n = nStart; bForward ? ( n < nEntryCount ) : n; ) { if ( !bForward ) n--; ImplEntryType* pImplEntry = GetEntry( n ); - BOOL bMatch = bLazy ? rI18nHelper.MatchString( rStr, pImplEntry->maStr ) != 0 : ( rStr.Match( pImplEntry->maStr ) == STRING_MATCH ); + sal_Bool bMatch = bLazy ? rI18nHelper.MatchString( rStr, pImplEntry->maStr ) != 0 : ( rStr.Match( pImplEntry->maStr ) == STRING_MATCH ); if ( bMatch ) { nPos = n; @@ -318,10 +318,10 @@ USHORT ImplEntryList::FindMatchingEntry( const XubString& rStr, USHORT nStart, B // ----------------------------------------------------------------------- -USHORT ImplEntryList::FindEntry( const void* pData ) const +sal_uInt16 ImplEntryList::FindEntry( const void* pData ) const { - USHORT nPos = LISTBOX_ENTRY_NOTFOUND; - for ( USHORT n = GetEntryCount(); n; ) + sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND; + for ( sal_uInt16 n = GetEntryCount(); n; ) { ImplEntryType* pImplEntry = GetEntry( --n ); if ( pImplEntry->mpUserData == pData ) @@ -335,12 +335,12 @@ USHORT ImplEntryList::FindEntry( const void* pData ) const // ----------------------------------------------------------------------- -long ImplEntryList::GetAddedHeight( USHORT i_nEndIndex, USHORT i_nBeginIndex, long i_nBeginHeight ) const +long ImplEntryList::GetAddedHeight( sal_uInt16 i_nEndIndex, sal_uInt16 i_nBeginIndex, long i_nBeginHeight ) const { long nHeight = i_nBeginHeight; - USHORT nStart = i_nEndIndex > i_nBeginIndex ? i_nBeginIndex : i_nEndIndex; - USHORT nStop = i_nEndIndex > i_nBeginIndex ? i_nEndIndex : i_nBeginIndex; - USHORT nEntryCount = GetEntryCount(); + sal_uInt16 nStart = i_nEndIndex > i_nBeginIndex ? i_nBeginIndex : i_nEndIndex; + sal_uInt16 nStop = i_nEndIndex > i_nBeginIndex ? i_nEndIndex : i_nBeginIndex; + sal_uInt16 nEntryCount = GetEntryCount(); if( nStop != LISTBOX_ENTRY_NOTFOUND && nEntryCount != 0 ) { // sanity check @@ -349,7 +349,7 @@ long ImplEntryList::GetAddedHeight( USHORT i_nEndIndex, USHORT i_nBeginIndex, lo if( nStart > nEntryCount-1 ) nStart = nEntryCount-1; - USHORT nIndex = nStart; + sal_uInt16 nIndex = nStart; while( nIndex != LISTBOX_ENTRY_NOTFOUND && nIndex < nStop ) { nHeight += GetEntryPtr( nIndex )-> mnHeight; @@ -363,7 +363,7 @@ long ImplEntryList::GetAddedHeight( USHORT i_nEndIndex, USHORT i_nBeginIndex, lo // ----------------------------------------------------------------------- -long ImplEntryList::GetEntryHeight( USHORT nPos ) const +long ImplEntryList::GetEntryHeight( sal_uInt16 nPos ) const { ImplEntryType* pImplEntry = GetEntry( nPos ); return pImplEntry ? pImplEntry->mnHeight : 0; @@ -371,7 +371,7 @@ long ImplEntryList::GetEntryHeight( USHORT nPos ) const // ----------------------------------------------------------------------- -XubString ImplEntryList::GetEntryText( USHORT nPos ) const +XubString ImplEntryList::GetEntryText( sal_uInt16 nPos ) const { XubString aEntryText; ImplEntryType* pImplEntry = GetEntry( nPos ); @@ -382,9 +382,9 @@ XubString ImplEntryList::GetEntryText( USHORT nPos ) const // ----------------------------------------------------------------------- -BOOL ImplEntryList::HasEntryImage( USHORT nPos ) const +sal_Bool ImplEntryList::HasEntryImage( sal_uInt16 nPos ) const { - BOOL bImage = FALSE; + sal_Bool bImage = sal_False; ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); if ( pImplEntry ) bImage = !!pImplEntry->maImage; @@ -393,7 +393,7 @@ BOOL ImplEntryList::HasEntryImage( USHORT nPos ) const // ----------------------------------------------------------------------- -Image ImplEntryList::GetEntryImage( USHORT nPos ) const +Image ImplEntryList::GetEntryImage( sal_uInt16 nPos ) const { Image aImage; ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); @@ -404,7 +404,7 @@ Image ImplEntryList::GetEntryImage( USHORT nPos ) const // ----------------------------------------------------------------------- -void ImplEntryList::SetEntryData( USHORT nPos, void* pNewData ) +void ImplEntryList::SetEntryData( sal_uInt16 nPos, void* pNewData ) { ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); if ( pImplEntry ) @@ -413,7 +413,7 @@ void ImplEntryList::SetEntryData( USHORT nPos, void* pNewData ) // ----------------------------------------------------------------------- -void* ImplEntryList::GetEntryData( USHORT nPos ) const +void* ImplEntryList::GetEntryData( sal_uInt16 nPos ) const { ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); return pImplEntry ? pImplEntry->mpUserData : NULL; @@ -421,7 +421,7 @@ void* ImplEntryList::GetEntryData( USHORT nPos ) const // ----------------------------------------------------------------------- -void ImplEntryList::SetEntryFlags( USHORT nPos, long nFlags ) +void ImplEntryList::SetEntryFlags( sal_uInt16 nPos, long nFlags ) { ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); if ( pImplEntry ) @@ -430,7 +430,7 @@ void ImplEntryList::SetEntryFlags( USHORT nPos, long nFlags ) // ----------------------------------------------------------------------- -long ImplEntryList::GetEntryFlags( USHORT nPos ) const +long ImplEntryList::GetEntryFlags( sal_uInt16 nPos ) const { ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); return pImplEntry ? pImplEntry->mnFlags : 0; @@ -438,10 +438,10 @@ long ImplEntryList::GetEntryFlags( USHORT nPos ) const // ----------------------------------------------------------------------- -USHORT ImplEntryList::GetSelectEntryCount() const +sal_uInt16 ImplEntryList::GetSelectEntryCount() const { - USHORT nSelCount = 0; - for ( USHORT n = GetEntryCount(); n; ) + sal_uInt16 nSelCount = 0; + for ( sal_uInt16 n = GetEntryCount(); n; ) { ImplEntryType* pImplEntry = GetEntry( --n ); if ( pImplEntry->mbIsSelected ) @@ -452,20 +452,20 @@ USHORT ImplEntryList::GetSelectEntryCount() const // ----------------------------------------------------------------------- -XubString ImplEntryList::GetSelectEntry( USHORT nIndex ) const +XubString ImplEntryList::GetSelectEntry( sal_uInt16 nIndex ) const { return GetEntryText( GetSelectEntryPos( nIndex ) ); } // ----------------------------------------------------------------------- -USHORT ImplEntryList::GetSelectEntryPos( USHORT nIndex ) const +sal_uInt16 ImplEntryList::GetSelectEntryPos( sal_uInt16 nIndex ) const { - USHORT nSelEntryPos = LISTBOX_ENTRY_NOTFOUND; - USHORT nSel = 0; - USHORT nEntryCount = GetEntryCount(); + sal_uInt16 nSelEntryPos = LISTBOX_ENTRY_NOTFOUND; + sal_uInt16 nSel = 0; + sal_uInt16 nEntryCount = GetEntryCount(); - for ( USHORT n = 0; n < nEntryCount; n++ ) + for ( sal_uInt16 n = 0; n < nEntryCount; n++ ) { ImplEntryType* pImplEntry = GetEntry( n ); if ( pImplEntry->mbIsSelected ) @@ -484,22 +484,22 @@ USHORT ImplEntryList::GetSelectEntryPos( USHORT nIndex ) const // ----------------------------------------------------------------------- -BOOL ImplEntryList::IsEntrySelected( const XubString& rStr ) const +sal_Bool ImplEntryList::IsEntrySelected( const XubString& rStr ) const { return IsEntryPosSelected( FindEntry( rStr ) ); } // ----------------------------------------------------------------------- -BOOL ImplEntryList::IsEntryPosSelected( USHORT nIndex ) const +sal_Bool ImplEntryList::IsEntryPosSelected( sal_uInt16 nIndex ) const { ImplEntryType* pImplEntry = GetEntry( nIndex ); - return pImplEntry ? pImplEntry->mbIsSelected : FALSE; + return pImplEntry ? pImplEntry->mbIsSelected : sal_False; } // ----------------------------------------------------------------------- -bool ImplEntryList::IsEntrySelectable( USHORT nPos ) const +bool ImplEntryList::IsEntrySelectable( sal_uInt16 nPos ) const { ImplEntryType* pImplEntry = GetEntry( nPos ); return pImplEntry ? ((pImplEntry->mnFlags & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION) == 0) : true; @@ -507,7 +507,7 @@ bool ImplEntryList::IsEntrySelectable( USHORT nPos ) const // ----------------------------------------------------------------------- -USHORT ImplEntryList::FindFirstSelectable( USHORT nPos, bool bForward /* = true */ ) +sal_uInt16 ImplEntryList::FindFirstSelectable( sal_uInt16 nPos, bool bForward /* = true */ ) { if( IsEntrySelectable( nPos ) ) return nPos; @@ -536,7 +536,8 @@ USHORT ImplEntryList::FindFirstSelectable( USHORT nPos, bool bForward /* = true // ======================================================================= ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) : - Control( pParent, 0 ) + Control( pParent, 0 ), + maQuickSelectionEngine( *this ) { mpEntryList = new ImplEntryList( this ); @@ -545,26 +546,26 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) : mnBorder = 1; mnSelectModifier = 0; mnUserDrawEntry = LISTBOX_ENTRY_NOTFOUND; - mbTrack = FALSE; - mbImgsDiffSz = FALSE; - mbTravelSelect = FALSE; - mbTrackingSelect = FALSE; - mbSelectionChanged = FALSE; - mbMouseMoveSelect = FALSE; - mbMulti = FALSE; - mbStackMode = FALSE; - mbGrabFocus = FALSE; - mbUserDrawEnabled = FALSE; - mbInUserDraw = FALSE; - mbReadOnly = FALSE; - mbHasFocusRect = FALSE; - mbRight = ( nWinStyle & WB_RIGHT ) ? TRUE : FALSE; - mbCenter = ( nWinStyle & WB_CENTER ) ? TRUE : FALSE; - mbSimpleMode = ( nWinStyle & WB_SIMPLEMODE ) ? TRUE : FALSE; - mbSort = ( nWinStyle & WB_SORT ) ? TRUE : FALSE; + mbTrack = sal_False; + mbImgsDiffSz = sal_False; + mbTravelSelect = sal_False; + mbTrackingSelect = sal_False; + mbSelectionChanged = sal_False; + mbMouseMoveSelect = sal_False; + mbMulti = sal_False; + mbStackMode = sal_False; + mbGrabFocus = sal_False; + mbUserDrawEnabled = sal_False; + mbInUserDraw = sal_False; + mbReadOnly = sal_False; + mbHasFocusRect = sal_False; + mbRight = ( nWinStyle & WB_RIGHT ) ? sal_True : sal_False; + mbCenter = ( nWinStyle & WB_CENTER ) ? sal_True : sal_False; + mbSimpleMode = ( nWinStyle & WB_SIMPLEMODE ) ? sal_True : sal_False; + mbSort = ( nWinStyle & WB_SORT ) ? sal_True : sal_False; // pb: #106948# explicit mirroring for calc - mbMirroring = FALSE; + mbMirroring = sal_False; mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND; @@ -575,10 +576,7 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) : SetTextFillColor(); SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) ); - maSearchTimeout.SetTimeout( 2500 ); - maSearchTimeout.SetTimeoutHdl( LINK( this, ImplListBoxWindow, SearchStringTimeout ) ); - - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); ImplCalcMetrics(); } @@ -586,13 +584,12 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) : ImplListBoxWindow::~ImplListBoxWindow() { - maSearchTimeout.Stop(); delete mpEntryList; } // ----------------------------------------------------------------------- -void ImplListBoxWindow::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) +void ImplListBoxWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ) { ImplInitFieldSettings( this, bFont, bForeground, bBackground ); } @@ -607,16 +604,16 @@ void ImplListBoxWindow::ImplCalcMetrics() mnMaxImgTxtWidth= 0; mnMaxImgHeight = 0; - mnTextHeight = (USHORT)GetTextHeight(); + mnTextHeight = (sal_uInt16)GetTextHeight(); mnMaxTxtHeight = mnTextHeight + mnBorder; mnMaxHeight = mnMaxTxtHeight; if ( maUserItemSize.Height() > mnMaxHeight ) - mnMaxHeight = (USHORT) maUserItemSize.Height(); + mnMaxHeight = (sal_uInt16) maUserItemSize.Height(); if ( maUserItemSize.Width() > mnMaxWidth ) - mnMaxWidth= (USHORT) maUserItemSize.Width(); + mnMaxWidth= (sal_uInt16) maUserItemSize.Width(); - for ( USHORT n = mpEntryList->GetEntryCount(); n; ) + for ( sal_uInt16 n = mpEntryList->GetEntryCount(); n; ) { ImplEntryType* pEntry = mpEntryList->GetMutableEntryPtr( --n ); ImplUpdateEntryMetrics( *pEntry ); @@ -631,14 +628,6 @@ void ImplListBoxWindow::ImplCalcMetrics() // ----------------------------------------------------------------------- -IMPL_LINK( ImplListBoxWindow, SearchStringTimeout, Timer*, EMPTYARG ) -{ - maSearchStr.Erase(); - return 1; -} - -// ----------------------------------------------------------------------- - void ImplListBoxWindow::Clear() { mpEntryList->Clear(); @@ -651,10 +640,11 @@ void ImplListBoxWindow::Clear() mnMaxImgHeight = 0; mnTop = 0; mnLeft = 0; - mbImgsDiffSz = FALSE; + mbImgsDiffSz = sal_False; ImplClearLayoutData(); mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; + maQuickSelectionEngine.Reset(); Invalidate(); } @@ -670,8 +660,8 @@ void ImplListBoxWindow::SetUserItemSize( const Size& rSz ) struct ImplEntryMetrics { - BOOL bText; - BOOL bImage; + sal_Bool bText; + sal_Bool bImage; long nEntryWidth; long nEntryHeight; long nTextWidth; @@ -684,7 +674,7 @@ struct ImplEntryMetrics void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) { ImplEntryMetrics aMetrics; - aMetrics.bText = rEntry.maStr.Len() ? TRUE : FALSE; + aMetrics.bText = rEntry.maStr.Len() ? sal_True : sal_False; aMetrics.bImage = !!rEntry.maImage; aMetrics.nEntryWidth = 0; aMetrics.nEntryHeight = 0; @@ -712,7 +702,7 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) else { // normal single line case - aMetrics.nTextWidth = (USHORT)GetTextWidth( rEntry.maStr ); + aMetrics.nTextWidth = (sal_uInt16)GetTextWidth( rEntry.maStr ); if( aMetrics.nTextWidth > mnMaxTxtWidth ) mnMaxTxtWidth = aMetrics.nTextWidth; aMetrics.nEntryWidth = mnMaxTxtWidth; @@ -722,13 +712,13 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) if ( aMetrics.bImage ) { Size aImgSz = rEntry.maImage.GetSizePixel(); - aMetrics.nImgWidth = (USHORT) CalcZoom( aImgSz.Width() ); - aMetrics.nImgHeight = (USHORT) CalcZoom( aImgSz.Height() ); + aMetrics.nImgWidth = (sal_uInt16) CalcZoom( aImgSz.Width() ); + aMetrics.nImgHeight = (sal_uInt16) CalcZoom( aImgSz.Height() ); if( mnMaxImgWidth && ( aMetrics.nImgWidth != mnMaxImgWidth ) ) - mbImgsDiffSz = TRUE; + mbImgsDiffSz = sal_True; else if ( mnMaxImgHeight && ( aMetrics.nImgHeight != mnMaxImgHeight ) ) - mbImgsDiffSz = TRUE; + mbImgsDiffSz = sal_True; if( aMetrics.nImgWidth > mnMaxImgWidth ) mnMaxImgWidth = aMetrics.nImgWidth; @@ -770,19 +760,19 @@ void ImplListBoxWindow::ImplCallSelect() if ( !IsTravelSelect() && GetEntryList()->GetMaxMRUCount() ) { // Insert the selected entry as MRU, if not allready first MRU - USHORT nSelected = GetEntryList()->GetSelectEntryPos( 0 ); - USHORT nMRUCount = GetEntryList()->GetMRUCount(); + sal_uInt16 nSelected = GetEntryList()->GetSelectEntryPos( 0 ); + sal_uInt16 nMRUCount = GetEntryList()->GetMRUCount(); String aSelected = GetEntryList()->GetEntryText( nSelected ); - USHORT nFirstMatchingEntryPos = GetEntryList()->FindEntry( aSelected, TRUE ); + sal_uInt16 nFirstMatchingEntryPos = GetEntryList()->FindEntry( aSelected, sal_True ); if ( nFirstMatchingEntryPos || !nMRUCount ) { - BOOL bSelectNewEntry = FALSE; + sal_Bool bSelectNewEntry = sal_False; if ( nFirstMatchingEntryPos < nMRUCount ) { RemoveEntry( nFirstMatchingEntryPos ); nMRUCount--; if ( nFirstMatchingEntryPos == nSelected ) - bSelectNewEntry = TRUE; + bSelectNewEntry = sal_True; } else if ( nMRUCount == GetEntryList()->GetMaxMRUCount() ) { @@ -794,7 +784,7 @@ void ImplListBoxWindow::ImplCallSelect() ImplEntryType* pNewEntry = new ImplEntryType( aSelected ); pNewEntry->mbIsSelected = bSelectNewEntry; - GetEntryList()->InsertEntry( 0, pNewEntry, FALSE ); + GetEntryList()->InsertEntry( 0, pNewEntry, sal_False ); ImplUpdateEntryMetrics( *pNewEntry ); GetEntryList()->SetMRUCount( ++nMRUCount ); SetSeparatorPos( nMRUCount ? nMRUCount-1 : 0 ); @@ -803,15 +793,15 @@ void ImplListBoxWindow::ImplCallSelect() } maSelectHdl.Call( NULL ); - mbSelectionChanged = FALSE; + mbSelectionChanged = sal_False; } // ----------------------------------------------------------------------- -USHORT ImplListBoxWindow::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry ) +sal_uInt16 ImplListBoxWindow::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry ) { ImplClearLayoutData(); - USHORT nNewPos = mpEntryList->InsertEntry( nPos, pNewEntry, mbSort ); + sal_uInt16 nNewPos = mpEntryList->InsertEntry( nPos, pNewEntry, mbSort ); if( (GetStyle() & WB_WORDBREAK) ) pNewEntry->mnFlags |= LISTBOX_ENTRY_FLAG_MULTILINE; @@ -822,7 +812,7 @@ USHORT ImplListBoxWindow::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry ) // ----------------------------------------------------------------------- -void ImplListBoxWindow::RemoveEntry( USHORT nPos ) +void ImplListBoxWindow::RemoveEntry( sal_uInt16 nPos ) { ImplClearLayoutData(); mpEntryList->RemoveEntry( nPos ); @@ -833,7 +823,7 @@ void ImplListBoxWindow::RemoveEntry( USHORT nPos ) // ----------------------------------------------------------------------- -void ImplListBoxWindow::SetEntryFlags( USHORT nPos, long nFlags ) +void ImplListBoxWindow::SetEntryFlags( sal_uInt16 nPos, long nFlags ) { mpEntryList->SetEntryFlags( nPos, nFlags ); ImplEntryType* pEntry = mpEntryList->GetMutableEntryPtr( nPos ); @@ -848,7 +838,7 @@ void ImplListBoxWindow::ImplShowFocusRect() if ( mbHasFocusRect ) HideFocus(); ShowFocus( maFocusRect ); - mbHasFocusRect = TRUE; + mbHasFocusRect = sal_True; } // ----------------------------------------------------------------------- @@ -858,18 +848,18 @@ void ImplListBoxWindow::ImplHideFocusRect() if ( mbHasFocusRect ) { HideFocus(); - mbHasFocusRect = FALSE; + mbHasFocusRect = sal_False; } } // ----------------------------------------------------------------------- -USHORT ImplListBoxWindow::GetEntryPosForPoint( const Point& rPoint ) const +sal_uInt16 ImplListBoxWindow::GetEntryPosForPoint( const Point& rPoint ) const { long nY = mnBorder; - USHORT nSelect = mnTop; + sal_uInt16 nSelect = mnTop; const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( nSelect ); while( pEntry && rPoint.Y() > pEntry->mnHeight + nY ) { @@ -884,16 +874,16 @@ USHORT ImplListBoxWindow::GetEntryPosForPoint( const Point& rPoint ) const // ----------------------------------------------------------------------- -BOOL ImplListBoxWindow::IsVisible( USHORT i_nEntry ) const +sal_Bool ImplListBoxWindow::IsVisible( sal_uInt16 i_nEntry ) const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( i_nEntry >= mnTop ) { if( mpEntryList->GetAddedHeight( i_nEntry, mnTop ) < PixelToLogic( GetSizePixel() ).Height() ) { - bRet = TRUE; + bRet = sal_True; } } @@ -902,11 +892,11 @@ BOOL ImplListBoxWindow::IsVisible( USHORT i_nEntry ) const // ----------------------------------------------------------------------- -USHORT ImplListBoxWindow::GetLastVisibleEntry() const +sal_uInt16 ImplListBoxWindow::GetLastVisibleEntry() const { - USHORT nPos = mnTop; + sal_uInt16 nPos = mnTop; long nWindowHeight = GetSizePixel().Height(); - USHORT nCount = mpEntryList->GetEntryCount(); + sal_uInt16 nCount = mpEntryList->GetEntryCount(); long nDiff; for( nDiff = 0; nDiff < nWindowHeight && nPos < nCount; nDiff = mpEntryList->GetAddedHeight( nPos, mnTop ) ) nPos++; @@ -924,14 +914,14 @@ USHORT ImplListBoxWindow::GetLastVisibleEntry() const void ImplListBoxWindow::MouseButtonDown( const MouseEvent& rMEvt ) { - mbMouseMoveSelect = FALSE; // Nur bis zum ersten MouseButtonDown - maSearchStr.Erase(); + mbMouseMoveSelect = sal_False; // Nur bis zum ersten MouseButtonDown + maQuickSelectionEngine.Reset(); if ( !IsReadOnly() ) { if( rMEvt.GetClicks() == 1 ) { - USHORT nSelect = GetEntryPosForPoint( rMEvt.GetPosPixel() ); + sal_uInt16 nSelect = GetEntryPosForPoint( rMEvt.GetPosPixel() ); if( nSelect != LISTBOX_ENTRY_NOTFOUND ) { if ( !mbMulti && GetEntryList()->GetSelectEntryCount() ) @@ -940,9 +930,9 @@ void ImplListBoxWindow::MouseButtonDown( const MouseEvent& rMEvt ) mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND; mnCurrentPos = nSelect; - mbTrackingSelect = TRUE; + mbTrackingSelect = sal_True; SelectEntries( nSelect, LET_MBDOWN, rMEvt.IsShift(), rMEvt.IsMod1() ); - mbTrackingSelect = FALSE; + mbTrackingSelect = sal_False; if ( mbGrabFocus ) GrabFocus(); @@ -975,10 +965,10 @@ void ImplListBoxWindow::MouseMove( const MouseEvent& rMEvt ) SetTopEntry( 0 ); if ( mbStackMode ) // #87072#, #92323# { - mbTravelSelect = TRUE; + mbTravelSelect = sal_True; mnSelectModifier = rMEvt.GetModifier(); ImplCallSelect(); - mbTravelSelect = FALSE; + mbTravelSelect = sal_False; } } @@ -992,28 +982,28 @@ void ImplListBoxWindow::MouseMove( const MouseEvent& rMEvt ) { if ( IsMouseMoveSelect() ) { - USHORT nSelect = GetEntryPosForPoint( rMEvt.GetPosPixel() ); + sal_uInt16 nSelect = GetEntryPosForPoint( rMEvt.GetPosPixel() ); if( nSelect == LISTBOX_ENTRY_NOTFOUND ) nSelect = mpEntryList->GetEntryCount() - 1; nSelect = Min( nSelect, GetLastVisibleEntry() ); - nSelect = Min( nSelect, (USHORT) ( mpEntryList->GetEntryCount() - 1 ) ); + nSelect = Min( nSelect, (sal_uInt16) ( mpEntryList->GetEntryCount() - 1 ) ); // Select only visible Entries with MouseMove, otherwise Tracking... if ( IsVisible( nSelect ) && mpEntryList->IsEntrySelectable( nSelect ) && ( ( nSelect != mnCurrentPos ) || !GetEntryList()->GetSelectEntryCount() || ( nSelect != GetEntryList()->GetSelectEntryPos( 0 ) ) ) ) { - mbTrackingSelect = TRUE; - if ( SelectEntries( nSelect, LET_TRACKING, FALSE, FALSE ) ) + mbTrackingSelect = sal_True; + if ( SelectEntries( nSelect, LET_TRACKING, sal_False, sal_False ) ) { if ( mbStackMode ) // #87072# { - mbTravelSelect = TRUE; + mbTravelSelect = sal_True; mnSelectModifier = rMEvt.GetModifier(); ImplCallSelect(); - mbTravelSelect = FALSE; + mbTravelSelect = sal_False; } } - mbTrackingSelect = FALSE; + mbTrackingSelect = sal_False; } } @@ -1041,14 +1031,14 @@ void ImplListBoxWindow::DeselectAll() { while ( GetEntryList()->GetSelectEntryCount() ) { - USHORT nS = GetEntryList()->GetSelectEntryPos( 0 ); - SelectEntry( nS, FALSE ); + sal_uInt16 nS = GetEntryList()->GetSelectEntryPos( 0 ); + SelectEntry( nS, sal_False ); } } // ----------------------------------------------------------------------- -void ImplListBoxWindow::SelectEntry( USHORT nPos, BOOL bSelect ) +void ImplListBoxWindow::SelectEntry( sal_uInt16 nPos, sal_Bool bSelect ) { if( (mpEntryList->IsEntryPosSelected( nPos ) != bSelect) && mpEntryList->IsEntrySelectable( nPos ) ) { @@ -1058,16 +1048,16 @@ void ImplListBoxWindow::SelectEntry( USHORT nPos, BOOL bSelect ) if( !mbMulti ) { // Selektierten Eintrag deselektieren - USHORT nDeselect = GetEntryList()->GetSelectEntryPos( 0 ); + sal_uInt16 nDeselect = GetEntryList()->GetSelectEntryPos( 0 ); if( nDeselect != LISTBOX_ENTRY_NOTFOUND ) { - //SelectEntryPos( nDeselect, FALSE ); - GetEntryList()->SelectEntry( nDeselect, FALSE ); + //SelectEntryPos( nDeselect, sal_False ); + GetEntryList()->SelectEntry( nDeselect, sal_False ); if ( IsUpdateMode() && IsReallyVisible() ) - ImplPaint( nDeselect, TRUE ); + ImplPaint( nDeselect, sal_True ); } } - mpEntryList->SelectEntry( nPos, TRUE ); + mpEntryList->SelectEntry( nPos, sal_True ); mnCurrentPos = nPos; if ( ( nPos != LISTBOX_ENTRY_NOTFOUND ) && IsUpdateMode() ) { @@ -1075,7 +1065,7 @@ void ImplListBoxWindow::SelectEntry( USHORT nPos, BOOL bSelect ) if ( !IsVisible( nPos ) ) { ImplClearLayoutData(); - USHORT nVisibleEntries = GetLastVisibleEntry()-mnTop; + sal_uInt16 nVisibleEntries = GetLastVisibleEntry()-mnTop; if ( !nVisibleEntries || !IsReallyVisible() || ( nPos < GetTopEntry() ) ) { Resize(); @@ -1090,46 +1080,46 @@ void ImplListBoxWindow::SelectEntry( USHORT nPos, BOOL bSelect ) } else { - mpEntryList->SelectEntry( nPos, FALSE ); - ImplPaint( nPos, TRUE ); + mpEntryList->SelectEntry( nPos, sal_False ); + ImplPaint( nPos, sal_True ); } - mbSelectionChanged = TRUE; + mbSelectionChanged = sal_True; } } // ----------------------------------------------------------------------- -BOOL ImplListBoxWindow::SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL bShift, BOOL bCtrl ) +sal_Bool ImplListBoxWindow::SelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLET, sal_Bool bShift, sal_Bool bCtrl ) { - BOOL bFocusChanged = FALSE; - BOOL bSelectionChanged = FALSE; + sal_Bool bFocusChanged = sal_False; + sal_Bool bSelectionChanged = sal_False; if( IsEnabled() && mpEntryList->IsEntrySelectable( nSelect ) ) { // Hier (Single-ListBox) kann nur ein Eintrag deselektiert werden if( !mbMulti ) { - USHORT nDeselect = mpEntryList->GetSelectEntryPos( 0 ); + sal_uInt16 nDeselect = mpEntryList->GetSelectEntryPos( 0 ); if( nSelect != nDeselect ) { - SelectEntry( nSelect, TRUE ); + SelectEntry( nSelect, sal_True ); mpEntryList->SetLastSelected( nSelect ); - bFocusChanged = TRUE; - bSelectionChanged = TRUE; + bFocusChanged = sal_True; + bSelectionChanged = sal_True; } } // MultiListBox ohne Modifier else if( mbSimpleMode && !bCtrl && !bShift ) { - USHORT nEntryCount = mpEntryList->GetEntryCount(); - for ( USHORT nPos = 0; nPos < nEntryCount; nPos++ ) + sal_uInt16 nEntryCount = mpEntryList->GetEntryCount(); + for ( sal_uInt16 nPos = 0; nPos < nEntryCount; nPos++ ) { - BOOL bSelect = nPos == nSelect; + sal_Bool bSelect = nPos == nSelect; if ( mpEntryList->IsEntryPosSelected( nPos ) != bSelect ) { SelectEntry( nPos, bSelect ); - bFocusChanged = TRUE; - bSelectionChanged = TRUE; + bFocusChanged = sal_True; + bSelectionChanged = sal_True; } } mpEntryList->SetLastSelected( nSelect ); @@ -1141,20 +1131,20 @@ BOOL ImplListBoxWindow::SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL // Space fuer Selektionswechsel if( !bShift && ( ( eLET == LET_KEYSPACE ) || ( eLET == LET_MBDOWN ) ) ) { - BOOL bSelect = ( mbStackMode && IsMouseMoveSelect() ) ? TRUE : !mpEntryList->IsEntryPosSelected( nSelect ); + sal_Bool bSelect = ( mbStackMode && IsMouseMoveSelect() ) ? sal_True : !mpEntryList->IsEntryPosSelected( nSelect ); if ( mbStackMode ) { - USHORT n; + sal_uInt16 n; if ( bSelect ) { // All entries before nSelect must be selected... for ( n = 0; n < nSelect; n++ ) - SelectEntry( n, TRUE ); + SelectEntry( n, sal_True ); } if ( !bSelect ) { for ( n = nSelect+1; n < mpEntryList->GetEntryCount(); n++ ) - SelectEntry( n, FALSE ); + SelectEntry( n, sal_False ); } } SelectEntry( nSelect, bSelect ); @@ -1162,16 +1152,16 @@ BOOL ImplListBoxWindow::SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL mpEntryList->SetSelectionAnchor( mbStackMode ? 0 : nSelect ); if ( !mpEntryList->IsEntryPosSelected( nSelect ) ) mpEntryList->SetSelectionAnchor( LISTBOX_ENTRY_NOTFOUND ); - bFocusChanged = TRUE; - bSelectionChanged = TRUE; + bFocusChanged = sal_True; + bSelectionChanged = sal_True; } else if( ( ( eLET == LET_TRACKING ) && ( nSelect != mnCurrentPos ) ) || ( (bShift||mbStackMode) && ( ( eLET == LET_KEYMOVE ) || ( eLET == LET_MBDOWN ) ) ) ) { mnCurrentPos = nSelect; - bFocusChanged = TRUE; + bFocusChanged = sal_True; - USHORT nAnchor = mpEntryList->GetSelectionAnchor(); + sal_uInt16 nAnchor = mpEntryList->GetSelectionAnchor(); if( ( nAnchor == LISTBOX_ENTRY_NOTFOUND ) && ( mpEntryList->GetSelectEntryCount() || mbStackMode ) ) { nAnchor = mbStackMode ? 0 : mpEntryList->GetSelectEntryPos( mpEntryList->GetSelectEntryCount() - 1 ); @@ -1179,40 +1169,40 @@ BOOL ImplListBoxWindow::SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL if( nAnchor != LISTBOX_ENTRY_NOTFOUND ) { // Alle Eintraege vom Anchor bis nSelect muessen selektiert sein - USHORT nStart = Min( nSelect, nAnchor ); - USHORT nEnd = Max( nSelect, nAnchor ); - for ( USHORT n = nStart; n <= nEnd; n++ ) + sal_uInt16 nStart = Min( nSelect, nAnchor ); + sal_uInt16 nEnd = Max( nSelect, nAnchor ); + for ( sal_uInt16 n = nStart; n <= nEnd; n++ ) { if ( !mpEntryList->IsEntryPosSelected( n ) ) { - SelectEntry( n, TRUE ); - bSelectionChanged = TRUE; + SelectEntry( n, sal_True ); + bSelectionChanged = sal_True; } } // Ggf. muss noch was deselektiert werden... - USHORT nLast = mpEntryList->GetLastSelected(); + sal_uInt16 nLast = mpEntryList->GetLastSelected(); if ( nLast != LISTBOX_ENTRY_NOTFOUND ) { if ( ( nLast > nSelect ) && ( nLast > nAnchor ) ) { - for ( USHORT n = nSelect+1; n <= nLast; n++ ) + for ( sal_uInt16 n = nSelect+1; n <= nLast; n++ ) { if ( mpEntryList->IsEntryPosSelected( n ) ) { - SelectEntry( n, FALSE ); - bSelectionChanged = TRUE; + SelectEntry( n, sal_False ); + bSelectionChanged = sal_True; } } } else if ( ( nLast < nSelect ) && ( nLast < nAnchor ) ) { - for ( USHORT n = nLast; n < nSelect; n++ ) + for ( sal_uInt16 n = nLast; n < nSelect; n++ ) { if ( mpEntryList->IsEntryPosSelected( n ) ) { - SelectEntry( n, FALSE ); - bSelectionChanged = TRUE; + SelectEntry( n, sal_False ); + bSelectionChanged = sal_True; } } } @@ -1223,17 +1213,17 @@ BOOL ImplListBoxWindow::SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL else if( eLET != LET_TRACKING ) { ImplHideFocusRect(); - ImplPaint( nSelect, TRUE ); - bFocusChanged = TRUE; + ImplPaint( nSelect, sal_True ); + bFocusChanged = sal_True; } } else if( bShift ) { - bFocusChanged = TRUE; + bFocusChanged = sal_True; } if( bSelectionChanged ) - mbSelectionChanged = TRUE; + mbSelectionChanged = sal_True; if( bFocusChanged ) { @@ -1256,7 +1246,7 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) { Point aPoint; Rectangle aRect( aPoint, GetOutputSizePixel() ); - BOOL bInside = aRect.IsInside( rTEvt.GetMouseEvent().GetPosPixel() ); + sal_Bool bInside = aRect.IsInside( rTEvt.GetMouseEvent().GetPosPixel() ); if( rTEvt.IsTrackingCanceled() || rTEvt.IsTrackingEnded() ) // MouseButtonUp { @@ -1270,9 +1260,9 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) maCancelHdl.Call( NULL ); if ( !mbMulti ) { - mbTrackingSelect = TRUE; - SelectEntry( mnTrackingSaveSelection, TRUE ); - mbTrackingSelect = FALSE; + mbTrackingSelect = sal_True; + SelectEntry( mnTrackingSaveSelection, sal_True ); + mbTrackingSelect = sal_False; if ( mnTrackingSaveSelection != LISTBOX_ENTRY_NOTFOUND ) { long nHeightDiff = mpEntryList->GetAddedHeight( mnCurrentPos, mnTop, 0 ); @@ -1285,23 +1275,23 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) } } - mbTrack = FALSE; + mbTrack = sal_False; } else { - BOOL bTrackOrQuickClick = mbTrack; + sal_Bool bTrackOrQuickClick = mbTrack; if( !mbTrack ) { if ( bInside ) { - mbTrack = TRUE; + mbTrack = sal_True; } // Folgender Fall tritt nur auf, wenn man ganz kurz die Maustaste drueckt if( rTEvt.IsTrackingEnded() && mbTrack ) { - bTrackOrQuickClick = TRUE; - mbTrack = FALSE; + bTrackOrQuickClick = sal_True; + mbTrack = sal_False; } } @@ -1309,10 +1299,10 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) { MouseEvent aMEvt = rTEvt.GetMouseEvent(); Point aPt( aMEvt.GetPosPixel() ); - BOOL bShift = aMEvt.IsShift(); - BOOL bCtrl = aMEvt.IsMod1(); + sal_Bool bShift = aMEvt.IsShift(); + sal_Bool bCtrl = aMEvt.IsMod1(); - USHORT nSelect = LISTBOX_ENTRY_NOTFOUND; + sal_uInt16 nSelect = LISTBOX_ENTRY_NOTFOUND; if( aPt.Y() < 0 ) { if ( mnCurrentPos != LISTBOX_ENTRY_NOTFOUND ) @@ -1326,43 +1316,43 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) { if ( mnCurrentPos != LISTBOX_ENTRY_NOTFOUND ) { - nSelect = Min( (USHORT)(mnCurrentPos+1), (USHORT)(mpEntryList->GetEntryCount()-1) ); + nSelect = Min( (sal_uInt16)(mnCurrentPos+1), (sal_uInt16)(mpEntryList->GetEntryCount()-1) ); if( nSelect >= GetLastVisibleEntry() ) SetTopEntry( mnTop+1 ); } } else { - nSelect = (USHORT) ( ( aPt.Y() + mnBorder ) / mnMaxHeight ) + (USHORT) mnTop; + nSelect = (sal_uInt16) ( ( aPt.Y() + mnBorder ) / mnMaxHeight ) + (sal_uInt16) mnTop; nSelect = Min( nSelect, GetLastVisibleEntry() ); - nSelect = Min( nSelect, (USHORT) ( mpEntryList->GetEntryCount() - 1 ) ); + nSelect = Min( nSelect, (sal_uInt16) ( mpEntryList->GetEntryCount() - 1 ) ); } if ( bInside ) { if ( ( nSelect != mnCurrentPos ) || !GetEntryList()->GetSelectEntryCount() ) { - mbTrackingSelect = TRUE; + mbTrackingSelect = sal_True; if ( SelectEntries( nSelect, LET_TRACKING, bShift, bCtrl ) ) { if ( mbStackMode ) // #87734# (#87072#) { - mbTravelSelect = TRUE; + mbTravelSelect = sal_True; mnSelectModifier = rTEvt.GetMouseEvent().GetModifier(); ImplCallSelect(); - mbTravelSelect = FALSE; + mbTravelSelect = sal_False; } } - mbTrackingSelect = FALSE; + mbTrackingSelect = sal_False; } } else { if ( !mbMulti && GetEntryList()->GetSelectEntryCount() ) { - mbTrackingSelect = TRUE; - SelectEntry( GetEntryList()->GetSelectEntryPos( 0 ), FALSE ); - mbTrackingSelect = FALSE; + mbTrackingSelect = sal_True; + SelectEntry( GetEntryList()->GetSelectEntryPos( 0 ), sal_False ); + mbTrackingSelect = sal_False; } else if ( mbStackMode ) { @@ -1370,32 +1360,32 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) { if ( ( rTEvt.GetMouseEvent().GetPosPixel().Y() < 0 ) || ( rTEvt.GetMouseEvent().GetPosPixel().Y() > GetOutputSizePixel().Height() ) ) { - BOOL bSelectionChanged = FALSE; + sal_Bool bSelectionChanged = sal_False; if ( ( rTEvt.GetMouseEvent().GetPosPixel().Y() < 0 ) && !mnCurrentPos ) { if ( mpEntryList->IsEntryPosSelected( 0 ) ) { - SelectEntry( 0, FALSE ); - bSelectionChanged = TRUE; + SelectEntry( 0, sal_False ); + bSelectionChanged = sal_True; nSelect = LISTBOX_ENTRY_NOTFOUND; } } else { - mbTrackingSelect = TRUE; + mbTrackingSelect = sal_True; bSelectionChanged = SelectEntries( nSelect, LET_TRACKING, bShift, bCtrl ); - mbTrackingSelect = FALSE; + mbTrackingSelect = sal_False; } if ( bSelectionChanged ) { - mbSelectionChanged = TRUE; - mbTravelSelect = TRUE; + mbSelectionChanged = sal_True; + mbTravelSelect = sal_True; mnSelectModifier = rTEvt.GetMouseEvent().GetModifier(); ImplCallSelect(); - mbTravelSelect = FALSE; + mbTravelSelect = sal_False; } } } @@ -1433,18 +1423,18 @@ void ImplListBoxWindow::KeyInput( const KeyEvent& rKEvt ) #define IMPL_SELECT_UP 1 #define IMPL_SELECT_DOWN 2 -BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) +sal_Bool ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) { // zu selektierender Eintrag - USHORT nSelect = LISTBOX_ENTRY_NOTFOUND; + sal_uInt16 nSelect = LISTBOX_ENTRY_NOTFOUND; LB_EVENT_TYPE eLET = LET_KEYMOVE; KeyCode aKeyCode = rKEvt.GetKeyCode(); - BOOL bShift = aKeyCode.IsShift(); - BOOL bCtrl = aKeyCode.IsMod1() || aKeyCode.IsMod3(); - BOOL bMod2 = aKeyCode.IsMod2(); - BOOL bDone = FALSE; + sal_Bool bShift = aKeyCode.IsShift(); + sal_Bool bCtrl = aKeyCode.IsMod1() || aKeyCode.IsMod3(); + sal_Bool bMod2 = aKeyCode.IsMod2(); + sal_Bool bDone = sal_False; switch( aKeyCode.GetCode() ) { @@ -1470,9 +1460,9 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) if( ( nSelect != LISTBOX_ENTRY_NOTFOUND ) && ( nSelect < mnTop ) ) SetTopEntry( mnTop-1 ); - bDone = TRUE; + bDone = sal_True; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1497,9 +1487,9 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) if( ( nSelect != LISTBOX_ENTRY_NOTFOUND ) && ( nSelect >= GetLastVisibleEntry() ) ) SetTopEntry( mnTop+1 ); - bDone = TRUE; + bDone = sal_True; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1507,7 +1497,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) { if ( IsReadOnly() ) { - USHORT nCurVis = GetLastVisibleEntry() - mnTop +1; + sal_uInt16 nCurVis = GetLastVisibleEntry() - mnTop +1; SetTopEntry( ( mnTop > nCurVis ) ? (mnTop-nCurVis) : 0 ); } @@ -1521,16 +1511,16 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) { if( mnCurrentPos == mnTop ) { - USHORT nCurVis = GetLastVisibleEntry() - mnTop +1; + sal_uInt16 nCurVis = GetLastVisibleEntry() - mnTop +1; SetTopEntry( ( mnTop > nCurVis ) ? ( mnTop-nCurVis+1 ) : 0 ); } // find first selectable starting from mnTop looking foreward nSelect = mpEntryList->FindFirstSelectable( mnTop, true ); } - bDone = TRUE; + bDone = sal_True; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1548,23 +1538,23 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) } else if ( (mnCurrentPos+1) < mpEntryList->GetEntryCount() ) { - USHORT nCount = mpEntryList->GetEntryCount(); - USHORT nCurVis = GetLastVisibleEntry() - mnTop; - USHORT nTmp = Min( nCurVis, nCount ); + sal_uInt16 nCount = mpEntryList->GetEntryCount(); + sal_uInt16 nCurVis = GetLastVisibleEntry() - mnTop; + sal_uInt16 nTmp = Min( nCurVis, nCount ); nTmp += mnTop - 1; if( mnCurrentPos == nTmp && mnCurrentPos != nCount - 1 ) { long nTmp2 = Min( (long)(nCount-nCurVis), (long)((long)mnTop+(long)nCurVis-1) ); nTmp2 = Max( (long)0 , nTmp2 ); - nTmp = (USHORT)(nTmp2+(nCurVis-1) ); - SetTopEntry( (USHORT)nTmp2 ); + nTmp = (sal_uInt16)(nTmp2+(nCurVis-1) ); + SetTopEntry( (sal_uInt16)nTmp2 ); } // find first selectable starting from nTmp looking backwards nSelect = mpEntryList->FindFirstSelectable( nTmp, false ); } - bDone = TRUE; + bDone = sal_True; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1582,10 +1572,10 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) if( mnTop != 0 ) SetTopEntry( 0 ); - bDone = TRUE; + bDone = sal_True; } } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1603,15 +1593,15 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) } else if ( (mnCurrentPos+1) < mpEntryList->GetEntryCount() ) { - USHORT nCount = mpEntryList->GetEntryCount(); + sal_uInt16 nCount = mpEntryList->GetEntryCount(); nSelect = mpEntryList->FindFirstSelectable( nCount - 1, false ); - USHORT nCurVis = GetLastVisibleEntry() - mnTop + 1; + sal_uInt16 nCurVis = GetLastVisibleEntry() - mnTop + 1; if( nCount > nCurVis ) SetTopEntry( nCount - nCurVis ); } - bDone = TRUE; + bDone = sal_True; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1620,9 +1610,9 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) if ( !bCtrl && !bMod2 ) { ScrollHorz( -HORZ_SCROLL ); - bDone = TRUE; + bDone = sal_True; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1631,9 +1621,9 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) if ( !bCtrl && !bMod2 ) { ScrollHorz( HORZ_SCROLL ); - bDone = TRUE; + bDone = sal_True; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1643,9 +1633,9 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) { mnSelectModifier = rKEvt.GetKeyCode().GetModifier(); ImplCallSelect(); - bDone = FALSE; // RETURN nicht abfangen. + bDone = sal_False; // RETURN nicht abfangen. } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1658,9 +1648,9 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) nSelect = mnCurrentPos; eLET = LET_KEYSPACE; } - bDone = TRUE; + bDone = sal_True; } - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); } break; @@ -1669,63 +1659,32 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) if( bCtrl && mbMulti ) { // paint only once - BOOL bUpdates = IsUpdateMode(); - SetUpdateMode( FALSE ); + sal_Bool bUpdates = IsUpdateMode(); + SetUpdateMode( sal_False ); - USHORT nEntryCount = mpEntryList->GetEntryCount(); - for( USHORT i = 0; i < nEntryCount; i++ ) - SelectEntry( i, TRUE ); + sal_uInt16 nEntryCount = mpEntryList->GetEntryCount(); + for( sal_uInt16 i = 0; i < nEntryCount; i++ ) + SelectEntry( i, sal_True ); // restore update mode SetUpdateMode( bUpdates ); Invalidate(); - maSearchStr.Erase(); + maQuickSelectionEngine.Reset(); - bDone = TRUE; + bDone = sal_True; break; } } // fall through intentional default: { - xub_Unicode c = rKEvt.GetCharCode(); - - if ( !IsReadOnly() && (c >= 32) && (c != 127) && !rKEvt.GetKeyCode().IsMod2() ) + if ( !IsReadOnly() ) { - maSearchStr += c; - XubString aTmpSearch( maSearchStr ); - - nSelect = mpEntryList->FindMatchingEntry( aTmpSearch, mnCurrentPos ); - if ( (nSelect == LISTBOX_ENTRY_NOTFOUND) && (aTmpSearch.Len() > 1) ) - { - // Wenn alles die gleichen Buchstaben, dann anderer Such-Modus - BOOL bAllEqual = TRUE; - for ( USHORT n = aTmpSearch.Len(); n && bAllEqual; ) - bAllEqual = aTmpSearch.GetChar( --n ) == c; - if ( bAllEqual ) - { - aTmpSearch = c; - nSelect = mpEntryList->FindMatchingEntry( aTmpSearch, mnCurrentPos+1 ); - } - } - if ( nSelect == LISTBOX_ENTRY_NOTFOUND ) - nSelect = mpEntryList->FindMatchingEntry( aTmpSearch, 0 ); - - if ( nSelect != LISTBOX_ENTRY_NOTFOUND ) - { - ShowProminentEntry( nSelect ); - - if ( mpEntryList->IsEntryPosSelected( nSelect ) ) - nSelect = LISTBOX_ENTRY_NOTFOUND; - - maSearchTimeout.Start(); - } - else - maSearchStr.Erase(); - bDone = TRUE; + bDone = maQuickSelectionEngine.HandleKeyEvent( rKEvt ); } - } + } + break; } if ( ( nSelect != LISTBOX_ENTRY_NOTFOUND ) @@ -1740,10 +1699,10 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) mnCurrentPos = nSelect; if ( SelectEntries( nSelect, eLET, bShift, bCtrl ) ) { - mbTravelSelect = TRUE; + mbTravelSelect = sal_True; mnSelectModifier = rKEvt.GetKeyCode().GetModifier(); ImplCallSelect(); - mbTravelSelect = FALSE; + mbTravelSelect = sal_False; } } @@ -1751,8 +1710,74 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) } // ----------------------------------------------------------------------- +namespace +{ + static ::vcl::StringEntryIdentifier lcl_getEntry( const ImplEntryList& _rList, sal_uInt16 _nPos, String& _out_entryText ) + { + OSL_PRECOND( ( _nPos != LISTBOX_ENTRY_NOTFOUND ), "lcl_getEntry: invalid position!" ); + sal_uInt16 nEntryCount( _rList.GetEntryCount() ); + if ( _nPos >= nEntryCount ) + _nPos = 0; + _out_entryText = _rList.GetEntryText( _nPos ); -void ImplListBoxWindow::ImplPaint( USHORT nPos, BOOL bErase, bool bLayout ) + // ::vcl::StringEntryIdentifier does not allow for 0 values, but our position is 0-based + // => normalize + return reinterpret_cast< ::vcl::StringEntryIdentifier >( _nPos + 1 ); + } + + static sal_uInt16 lcl_getEntryPos( ::vcl::StringEntryIdentifier _entry ) + { + // our pos is 0-based, but StringEntryIdentifier does not allow for a NULL + return static_cast< sal_uInt16 >( reinterpret_cast< sal_Int64 >( _entry ) ) - 1; + } +} + +// ----------------------------------------------------------------------- +::vcl::StringEntryIdentifier ImplListBoxWindow::CurrentEntry( String& _out_entryText ) const +{ + return lcl_getEntry( *GetEntryList(), ( mnCurrentPos == LISTBOX_ENTRY_NOTFOUND ) ? 0 : mnCurrentPos + 1, _out_entryText ); +} + +// ----------------------------------------------------------------------- +::vcl::StringEntryIdentifier ImplListBoxWindow::NextEntry( ::vcl::StringEntryIdentifier _currentEntry, String& _out_entryText ) const +{ + sal_uInt16 nNextPos = lcl_getEntryPos( _currentEntry ) + 1; + return lcl_getEntry( *GetEntryList(), nNextPos, _out_entryText ); +} + +// ----------------------------------------------------------------------- +void ImplListBoxWindow::SelectEntry( ::vcl::StringEntryIdentifier _entry ) +{ + sal_uInt16 nSelect = lcl_getEntryPos( _entry ); + if ( mpEntryList->IsEntryPosSelected( nSelect ) ) + { + // ignore that. This method is a callback from the QuickSelectionEngine, which means the user attempted + // to select the given entry by typing its starting letters. No need to act. + return; + } + + // normalize + OSL_ENSURE( nSelect < mpEntryList->GetEntryCount(), "ImplListBoxWindow::SelectEntry: how that?" ); + if( nSelect >= mpEntryList->GetEntryCount() ) + nSelect = mpEntryList->GetEntryCount()-1; + + // make visible + ShowProminentEntry( nSelect ); + + // actually select + mnCurrentPos = nSelect; + if ( SelectEntries( nSelect, LET_KEYMOVE, sal_False, sal_False ) ) + { + mbTravelSelect = sal_True; + mnSelectModifier = 0; + ImplCallSelect(); + mbTravelSelect = sal_False; + } +} + +// ----------------------------------------------------------------------- + +void ImplListBoxWindow::ImplPaint( sal_uInt16 nPos, sal_Bool bErase, bool bLayout ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -1775,7 +1800,7 @@ void ImplListBoxWindow::ImplPaint( USHORT nPos, BOOL bErase, bool bLayout ) } else { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); if( !IsEnabled() ) SetTextColor( rStyleSettings.GetDisableColor() ); SetTextFillColor(); @@ -1786,25 +1811,25 @@ void ImplListBoxWindow::ImplPaint( USHORT nPos, BOOL bErase, bool bLayout ) if ( IsUserDrawEnabled() ) { - mbInUserDraw = TRUE; + mbInUserDraw = sal_True; mnUserDrawEntry = nPos; aRect.Left() -= mnLeft; if ( nPos < GetEntryList()->GetMRUCount() ) nPos = GetEntryList()->FindEntry( GetEntryList()->GetEntryText( nPos ) ); - nPos = sal::static_int_cast<USHORT>(nPos - GetEntryList()->GetMRUCount()); + nPos = sal::static_int_cast<sal_uInt16>(nPos - GetEntryList()->GetMRUCount()); UserDrawEvent aUDEvt( this, aRect, nPos, 0 ); maUserDrawHdl.Call( &aUDEvt ); - mbInUserDraw = FALSE; + mbInUserDraw = sal_False; } else { - DrawEntry( nPos, TRUE, TRUE, FALSE, bLayout ); + DrawEntry( nPos, sal_True, sal_True, sal_False, bLayout ); } } // ----------------------------------------------------------------------- -void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos, bool bLayout ) +void ImplListBoxWindow::DrawEntry( sal_uInt16 nPos, sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos, bool bLayout ) { const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( nPos ); if( ! pEntry ) @@ -1878,7 +1903,7 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, aTextRect.Left() -= ( aImgSz.Width() + IMG_TXT_DISTANCE ); } - USHORT nDrawStyle = ImplGetTextStyle(); + sal_uInt16 nDrawStyle = ImplGetTextStyle(); if( (pEntry->mnFlags & LISTBOX_ENTRY_FLAG_MULTILINE) ) nDrawStyle |= MULTILINE_ENTRY_DRAW_FLAGS; if( (pEntry->mnFlags & LISTBOX_ENTRY_FLAG_DRAW_DISABLED) ) @@ -1919,22 +1944,22 @@ void ImplListBoxWindow::FillLayoutData() const void ImplListBoxWindow::ImplDoPaint( const Rectangle& rRect, bool bLayout ) { - USHORT nCount = mpEntryList->GetEntryCount(); + sal_uInt16 nCount = mpEntryList->GetEntryCount(); - BOOL bShowFocusRect = mbHasFocusRect; + sal_Bool bShowFocusRect = mbHasFocusRect; if ( mbHasFocusRect && ! bLayout ) ImplHideFocusRect(); long nY = 0; // + mnBorder; long nHeight = GetOutputSizePixel().Height();// - mnMaxHeight + mnBorder; - for( USHORT i = (USHORT)mnTop; i < nCount && nY < nHeight + mnMaxHeight; i++ ) + for( sal_uInt16 i = (sal_uInt16)mnTop; i < nCount && nY < nHeight + mnMaxHeight; i++ ) { const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( i ); if( nY + pEntry->mnHeight >= rRect.Top() && nY <= rRect.Bottom() + mnMaxHeight ) { - ImplPaint( i, FALSE, bLayout ); + ImplPaint( i, sal_False, bLayout ); } nY += pEntry->mnHeight; } @@ -1956,13 +1981,13 @@ void ImplListBoxWindow::Paint( const Rectangle& rRect ) // ----------------------------------------------------------------------- -USHORT ImplListBoxWindow::GetDisplayLineCount() const +sal_uInt16 ImplListBoxWindow::GetDisplayLineCount() const { // FIXME: LISTBOX_ENTRY_FLAG_MULTILINE - USHORT nCount = mpEntryList->GetEntryCount(); + sal_uInt16 nCount = mpEntryList->GetEntryCount(); long nHeight = GetOutputSizePixel().Height();// - mnMaxHeight + mnBorder; - USHORT nEntries = static_cast< USHORT >( ( nHeight + mnMaxHeight - 1 ) / mnMaxHeight ); + sal_uInt16 nEntries = static_cast< sal_uInt16 >( ( nHeight + mnMaxHeight - 1 ) / mnMaxHeight ); if( nEntries > nCount-mnTop ) nEntries = nCount-mnTop; @@ -1975,7 +2000,7 @@ void ImplListBoxWindow::Resize() { Control::Resize(); - BOOL bShowFocusRect = mbHasFocusRect; + sal_Bool bShowFocusRect = mbHasFocusRect; if ( bShowFocusRect ) ImplHideFocusRect(); @@ -1995,7 +2020,7 @@ void ImplListBoxWindow::Resize() void ImplListBoxWindow::GetFocus() { - USHORT nPos = mnCurrentPos; + sal_uInt16 nPos = mnCurrentPos; if ( nPos == LISTBOX_ENTRY_NOTFOUND ) nPos = 0; long nHeightDiff = mpEntryList->GetAddedHeight( nPos, mnTop, 0 ); @@ -2028,14 +2053,14 @@ void ImplListBoxWindow::RequestHelp( const HelpEvent& rHEvt ) // ----------------------------------------------------------------------- -void ImplListBoxWindow::SetTopEntry( USHORT nTop ) +void ImplListBoxWindow::SetTopEntry( sal_uInt16 nTop ) { if( mpEntryList->GetEntryCount() == 0 ) return; long nWHeight = PixelToLogic( GetSizePixel() ).Height(); - USHORT nLastEntry = mpEntryList->GetEntryCount()-1; + sal_uInt16 nLastEntry = mpEntryList->GetEntryCount()-1; if( nTop > nLastEntry ) nTop = nLastEntry; const ImplEntryType* pLast = mpEntryList->GetEntryPtr( nLastEntry ); @@ -2061,11 +2086,11 @@ void ImplListBoxWindow::SetTopEntry( USHORT nTop ) // ----------------------------------------------------------------------- -void ImplListBoxWindow::ShowProminentEntry( USHORT nEntryPos ) +void ImplListBoxWindow::ShowProminentEntry( sal_uInt16 nEntryPos ) { if( meProminentType == PROMINENT_MIDDLE ) { - USHORT nPos = nEntryPos; + sal_uInt16 nPos = nEntryPos; long nWHeight = PixelToLogic( GetSizePixel() ).Height(); while( nEntryPos > 0 && mpEntryList->GetAddedHeight( nPos+1, nEntryPos ) < nWHeight/2 ) nEntryPos--; @@ -2103,7 +2128,7 @@ void ImplListBoxWindow::ScrollHorz( long n ) if ( nDiff ) { ImplClearLayoutData(); - mnLeft = sal::static_int_cast<USHORT>(mnLeft + nDiff); + mnLeft = sal::static_int_cast<sal_uInt16>(mnLeft + nDiff); Update(); ImplHideFocusRect(); Scroll( -nDiff, 0 ); @@ -2116,12 +2141,12 @@ void ImplListBoxWindow::ScrollHorz( long n ) // ----------------------------------------------------------------------- -Size ImplListBoxWindow::CalcSize( USHORT nMaxLines ) const +Size ImplListBoxWindow::CalcSize( sal_uInt16 nMaxLines ) const { // FIXME: LISTBOX_ENTRY_FLAG_MULTILINE Size aSz; -// USHORT nL = Min( nMaxLines, mpEntryList->GetEntryCount() ); +// sal_uInt16 nL = Min( nMaxLines, mpEntryList->GetEntryCount() ); aSz.Height() = nMaxLines * mnMaxHeight; aSz.Width() = mnMaxWidth + 2*mnBorder; return aSz; @@ -2129,7 +2154,7 @@ Size ImplListBoxWindow::CalcSize( USHORT nMaxLines ) const // ----------------------------------------------------------------------- -Rectangle ImplListBoxWindow::GetBoundingRectangle( USHORT nItem ) const +Rectangle ImplListBoxWindow::GetBoundingRectangle( sal_uInt16 nItem ) const { const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( nItem ); Size aSz( GetSizePixel().Width(), pEntry ? pEntry->mnHeight : GetEntryHeight() ); @@ -2147,7 +2172,7 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType ) if ( nType == STATE_CHANGE_ZOOM ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); ImplCalcMetrics(); Invalidate(); } @@ -2158,18 +2183,18 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType ) } else if ( nType == STATE_CHANGE_CONTROLFONT ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); ImplCalcMetrics(); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } ImplClearLayoutData(); @@ -2187,7 +2212,7 @@ void ImplListBoxWindow::DataChanged( const DataChangedEvent& rDCEvt ) (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { ImplClearLayoutData(); - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); ImplCalcMetrics(); Invalidate(); } @@ -2195,9 +2220,9 @@ void ImplListBoxWindow::DataChanged( const DataChangedEvent& rDCEvt ) // ----------------------------------------------------------------------- -USHORT ImplListBoxWindow::ImplGetTextStyle() const +sal_uInt16 ImplListBoxWindow::ImplGetTextStyle() const { - USHORT nTextStyle = TEXT_DRAW_VCENTER; + sal_uInt16 nTextStyle = TEXT_DRAW_VCENTER; if ( mpEntryList->HasImages() ) nTextStyle |= TEXT_DRAW_LEFT; @@ -2228,9 +2253,9 @@ ImplListBox::ImplListBox( Window* pParent, WinBits nWinStyle ) : mpVScrollBar->SetScrollHdl( aLink ); mpHScrollBar->SetScrollHdl( aLink ); - mbVScroll = FALSE; - mbHScroll = FALSE; - mbAutoHScroll = ( nWinStyle & WB_AUTOHSCROLL ) ? TRUE : FALSE; + mbVScroll = sal_False; + mbHScroll = sal_False; + mbAutoHScroll = ( nWinStyle & WB_AUTOHSCROLL ) ? sal_True : sal_False; maLBWindow.SetScrollHdl( LINK( this, ImplListBox, LBWindowScrolled ) ); maLBWindow.SetMRUChangedHdl( LINK( this, ImplListBox, MRUChanged ) ); @@ -2263,37 +2288,37 @@ void ImplListBox::Clear() // ----------------------------------------------------------------------- -USHORT ImplListBox::InsertEntry( USHORT nPos, const XubString& rStr ) +sal_uInt16 ImplListBox::InsertEntry( sal_uInt16 nPos, const XubString& rStr ) { ImplEntryType* pNewEntry = new ImplEntryType( rStr ); - USHORT nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry ); + sal_uInt16 nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry ); StateChanged( STATE_CHANGE_DATA ); return nNewPos; } // ----------------------------------------------------------------------- -USHORT ImplListBox::InsertEntry( USHORT nPos, const Image& rImage ) +sal_uInt16 ImplListBox::InsertEntry( sal_uInt16 nPos, const Image& rImage ) { ImplEntryType* pNewEntry = new ImplEntryType( rImage ); - USHORT nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry ); + sal_uInt16 nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry ); StateChanged( STATE_CHANGE_DATA ); return nNewPos; } // ----------------------------------------------------------------------- -USHORT ImplListBox::InsertEntry( USHORT nPos, const XubString& rStr, const Image& rImage ) +sal_uInt16 ImplListBox::InsertEntry( sal_uInt16 nPos, const XubString& rStr, const Image& rImage ) { ImplEntryType* pNewEntry = new ImplEntryType( rStr, rImage ); - USHORT nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry ); + sal_uInt16 nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry ); StateChanged( STATE_CHANGE_DATA ); return nNewPos; } // ----------------------------------------------------------------------- -void ImplListBox::RemoveEntry( USHORT nPos ) +void ImplListBox::RemoveEntry( sal_uInt16 nPos ) { maLBWindow.RemoveEntry( nPos ); StateChanged( STATE_CHANGE_DATA ); @@ -2301,21 +2326,21 @@ void ImplListBox::RemoveEntry( USHORT nPos ) // ----------------------------------------------------------------------- -void ImplListBox::SetEntryFlags( USHORT nPos, long nFlags ) +void ImplListBox::SetEntryFlags( sal_uInt16 nPos, long nFlags ) { maLBWindow.SetEntryFlags( nPos, nFlags ); } // ----------------------------------------------------------------------- -long ImplListBox::GetEntryFlags( USHORT nPos ) const +long ImplListBox::GetEntryFlags( sal_uInt16 nPos ) const { return maLBWindow.GetEntryList()->GetEntryFlags( nPos ); } // ----------------------------------------------------------------------- -void ImplListBox::SelectEntry( USHORT nPos, BOOL bSelect ) +void ImplListBox::SelectEntry( sal_uInt16 nPos, sal_Bool bSelect ) { maLBWindow.SelectEntry( nPos, bSelect ); } @@ -2363,7 +2388,11 @@ IMPL_LINK( ImplListBox, MRUChanged, void*, EMPTYARG ) IMPL_LINK( ImplListBox, LBWindowScrolled, void*, EMPTYARG ) { + long nSet = GetTopEntry(); + if( nSet > mpVScrollBar->GetRangeMax() ) + mpVScrollBar->SetRangeMax( GetEntryList()->GetEntryCount() ); mpVScrollBar->SetThumbPos( GetTopEntry() ); + mpHScrollBar->SetThumbPos( GetLeftIndent() ); maScrollHdl.Call( this ); @@ -2375,7 +2404,7 @@ IMPL_LINK( ImplListBox, LBWindowScrolled, void*, EMPTYARG ) IMPL_LINK( ImplListBox, ScrollBarHdl, ScrollBar*, pSB ) { - USHORT nPos = (USHORT) pSB->GetThumbPos(); + sal_uInt16 nPos = (sal_uInt16) pSB->GetThumbPos(); if( pSB == mpVScrollBar ) SetTopEntry( nPos ); else if( pSB == mpHScrollBar ) @@ -2388,34 +2417,38 @@ IMPL_LINK( ImplListBox, ScrollBarHdl, ScrollBar*, pSB ) void ImplListBox::ImplCheckScrollBars() { - BOOL bArrange = FALSE; + sal_Bool bArrange = sal_False; Size aOutSz = GetOutputSizePixel(); - USHORT nEntries = GetEntryList()->GetEntryCount(); - USHORT nMaxVisEntries = (USHORT) (aOutSz.Height() / GetEntryHeight()); + sal_uInt16 nEntries = GetEntryList()->GetEntryCount(); + sal_uInt16 nMaxVisEntries = (sal_uInt16) (aOutSz.Height() / GetEntryHeight()); // vert. ScrollBar if( nEntries > nMaxVisEntries ) { if( !mbVScroll ) - bArrange = TRUE; - mbVScroll = TRUE; + bArrange = sal_True; + mbVScroll = sal_True; // Ueberpruefung des rausgescrollten Bereichs - SetTopEntry( GetTopEntry() ); // MaxTop wird geprueft... + if( GetEntryList()->GetSelectEntryCount() == 1 && + GetEntryList()->GetSelectEntryPos( 0 ) != LISTBOX_ENTRY_NOTFOUND ) + ShowProminentEntry( GetEntryList()->GetSelectEntryPos( 0 ) ); + else + SetTopEntry( GetTopEntry() ); // MaxTop wird geprueft... } else { if( mbVScroll ) - bArrange = TRUE; - mbVScroll = FALSE; + bArrange = sal_True; + mbVScroll = sal_False; SetTopEntry( 0 ); } // horz. ScrollBar if( mbAutoHScroll ) { - long nWidth = (USHORT) aOutSz.Width(); + long nWidth = (sal_uInt16) aOutSz.Width(); if ( mbVScroll ) nWidth -= mpVScrollBar->GetSizePixel().Width(); @@ -2423,32 +2456,36 @@ void ImplListBox::ImplCheckScrollBars() if( nWidth < nMaxWidth ) { if( !mbHScroll ) - bArrange = TRUE; - mbHScroll = TRUE; + bArrange = sal_True; + mbHScroll = sal_True; if ( !mbVScroll ) // ggf. brauchen wir jetzt doch einen { - nMaxVisEntries = (USHORT) ( ( aOutSz.Height() - mpHScrollBar->GetSizePixel().Height() ) / GetEntryHeight() ); + nMaxVisEntries = (sal_uInt16) ( ( aOutSz.Height() - mpHScrollBar->GetSizePixel().Height() ) / GetEntryHeight() ); if( nEntries > nMaxVisEntries ) { - bArrange = TRUE; - mbVScroll = TRUE; + bArrange = sal_True; + mbVScroll = sal_True; // Ueberpruefung des rausgescrollten Bereichs - SetTopEntry( GetTopEntry() ); // MaxTop wird geprueft... + if( GetEntryList()->GetSelectEntryCount() == 1 && + GetEntryList()->GetSelectEntryPos( 0 ) != LISTBOX_ENTRY_NOTFOUND ) + ShowProminentEntry( GetEntryList()->GetSelectEntryPos( 0 ) ); + else + SetTopEntry( GetTopEntry() ); // MaxTop wird geprueft... } } // Ueberpruefung des rausgescrollten Bereichs - USHORT nMaxLI = (USHORT) (nMaxWidth - nWidth); + sal_uInt16 nMaxLI = (sal_uInt16) (nMaxWidth - nWidth); if ( nMaxLI < GetLeftIndent() ) SetLeftIndent( nMaxLI ); } else { if( mbHScroll ) - bArrange = TRUE; - mbHScroll = FALSE; + bArrange = sal_True; + mbHScroll = sal_False; SetLeftIndent( 0 ); } } @@ -2467,8 +2504,8 @@ void ImplListBox::ImplInitScrollBars() if ( mbVScroll ) { - USHORT nEntries = GetEntryList()->GetEntryCount(); - USHORT nVisEntries = (USHORT) (aOutSz.Height() / GetEntryHeight()); + sal_uInt16 nEntries = GetEntryList()->GetEntryCount(); + sal_uInt16 nVisEntries = (sal_uInt16) (aOutSz.Height() / GetEntryHeight()); mpVScrollBar->SetRangeMax( nEntries ); mpVScrollBar->SetVisibleSize( nVisEntries ); mpVScrollBar->SetPageSize( nVisEntries - 1 ); @@ -2477,7 +2514,7 @@ void ImplListBox::ImplInitScrollBars() if ( mbHScroll ) { mpHScrollBar->SetRangeMax( GetMaxEntryWidth() + HORZ_SCROLL ); - mpHScrollBar->SetVisibleSize( (USHORT)aOutSz.Width() ); + mpHScrollBar->SetVisibleSize( (sal_uInt16)aOutSz.Width() ); mpHScrollBar->SetLineSize( HORZ_SCROLL ); mpHScrollBar->SetPageSize( aOutSz.Width() - HORZ_SCROLL ); } @@ -2502,7 +2539,7 @@ void ImplListBox::ImplResizeControls() // pb: #106948# explicit mirroring for calc // Scrollbar on left or right side? - BOOL bMirroring = maLBWindow.IsMirroring(); + sal_Bool bMirroring = maLBWindow.IsMirroring(); Point aWinPos( bMirroring && mbVScroll ? nSBWidth : 0, 0 ); maLBWindow.SetPosSizePixel( aWinPos, aInnerSz ); @@ -2557,7 +2594,7 @@ void ImplListBox::StateChanged( StateChangedType nType ) } else if ( ( nType == STATE_CHANGE_UPDATEMODE ) || ( nType == STATE_CHANGE_DATA ) ) { - BOOL bUpdate = IsUpdateMode(); + sal_Bool bUpdate = IsUpdateMode(); maLBWindow.SetUpdateMode( bUpdate ); // mpHScrollBar->SetUpdateMode( bUpdate ); // mpVScrollBar->SetUpdateMode( bUpdate ); @@ -2643,15 +2680,15 @@ const Wallpaper& ImplListBox::GetDisplayBackground() const // ----------------------------------------------------------------------- -BOOL ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt ) +sal_Bool ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt ) { - BOOL bDone = FALSE; + sal_Bool bDone = sal_False; if ( rCEvt.GetCommand() == COMMAND_WHEEL ) { const CommandWheelData* pData = rCEvt.GetWheelData(); if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) ) { - USHORT nKey = ( pData->GetDelta() < 0 ) ? KEY_DOWN : KEY_UP; + sal_uInt16 nKey = ( pData->GetDelta() < 0 ) ? KEY_DOWN : KEY_UP; KeyEvent aKeyEvent( 0, KeyCode( nKey ) ); bDone = ProcessKeyInput( aKeyEvent ); } @@ -2663,23 +2700,23 @@ BOOL ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt ) void ImplListBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep ) { - BOOL bChanges = GetEntryList()->GetMRUCount() ? TRUE : FALSE; + sal_Bool bChanges = GetEntryList()->GetMRUCount() ? sal_True : sal_False; // Remove old MRU entries - for ( USHORT n = GetEntryList()->GetMRUCount();n; ) + for ( sal_uInt16 n = GetEntryList()->GetMRUCount();n; ) maLBWindow.RemoveEntry( --n ); - USHORT nMRUCount = 0; - USHORT nEntries = rEntries.GetTokenCount( cSep ); - for ( USHORT nEntry = 0; nEntry < nEntries; nEntry++ ) + sal_uInt16 nMRUCount = 0; + sal_uInt16 nEntries = rEntries.GetTokenCount( cSep ); + for ( sal_uInt16 nEntry = 0; nEntry < nEntries; nEntry++ ) { XubString aEntry = rEntries.GetToken( nEntry, cSep ); // Accept only existing entries if ( GetEntryList()->FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND ) { ImplEntryType* pNewEntry = new ImplEntryType( aEntry ); - maLBWindow.GetEntryList()->InsertEntry( nMRUCount++, pNewEntry, FALSE ); - bChanges = TRUE; + maLBWindow.GetEntryList()->InsertEntry( nMRUCount++, pNewEntry, sal_False ); + bChanges = sal_True; } } @@ -2696,7 +2733,7 @@ void ImplListBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep ) XubString ImplListBox::GetMRUEntries( xub_Unicode cSep ) const { String aEntries; - for ( USHORT n = 0; n < GetEntryList()->GetMRUCount(); n++ ) + for ( sal_uInt16 n = 0; n < GetEntryList()->GetMRUCount(); n++ ) { aEntries += GetEntryList()->GetEntryText( n ); if( n < ( GetEntryList()->GetMRUCount() - 1 ) ) @@ -2716,17 +2753,17 @@ ImplWin::ImplWin( Window* pParent, WinBits nWinStyle ) : else SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) ); - mbInUserDraw = FALSE; - mbUserDrawEnabled = FALSE; + mbInUserDraw = sal_False; + mbUserDrawEnabled = sal_False; mnItemPos = LISTBOX_ENTRY_NOTFOUND; } // ----------------------------------------------------------------------- -BOOL ImplWin::SetModeImage( const Image& rImage ) +sal_Bool ImplWin::SetModeImage( const Image& rImage ) { SetImage( rImage ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -2792,7 +2829,7 @@ void ImplWin::ImplDraw( bool bLayout ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - BOOL bNativeOK = FALSE; + sal_Bool bNativeOK = sal_False; if( ! bLayout ) { @@ -2819,11 +2856,11 @@ void ImplWin::ImplDraw( bool bLayout ) Point aPoint( -nLeft, -nTop ); Rectangle aCtrlRegion( aPoint - GetPosPixel(), pWin->GetSizePixel() ); - BOOL bMouseOver = FALSE; + sal_Bool bMouseOver = sal_False; if( GetParent() ) { Window *pChild = GetParent()->GetWindow( WINDOW_FIRSTCHILD ); - while( pChild && (bMouseOver = pChild->IsMouseOver()) == FALSE ) + while( pChild && (bMouseOver = pChild->IsMouseOver()) == sal_False ) pChild = pChild->GetWindow( WINDOW_NEXT ); } @@ -2876,14 +2913,14 @@ void ImplWin::ImplDraw( bool bLayout ) if ( IsUserDrawEnabled() ) { - mbInUserDraw = TRUE; + mbInUserDraw = sal_True; UserDrawEvent aUDEvt( this, maFocusRect, mnItemPos, 0 ); maUserDrawHdl.Call( &aUDEvt ); - mbInUserDraw = FALSE; + mbInUserDraw = sal_False; } else { - DrawEntry( TRUE, TRUE, FALSE, bLayout ); + DrawEntry( sal_True, sal_True, sal_False, bLayout ); } } @@ -2896,15 +2933,15 @@ void ImplWin::Paint( const Rectangle& ) // ----------------------------------------------------------------------- -void ImplWin::DrawEntry( BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos, bool bLayout ) +void ImplWin::DrawEntry( sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos, bool bLayout ) { long nBorder = 1; Size aOutSz = GetOutputSizePixel(); - BOOL bImage = !!maImage; + sal_Bool bImage = !!maImage; if( bDrawImage && bImage && !bLayout ) { - USHORT nStyle = 0; + sal_uInt16 nStyle = 0; Size aImgSz = maImage.GetSizePixel(); Point aPtImg( nBorder, ( ( aOutSz.Height() - aImgSz.Height() ) / 2 ) ); @@ -2925,7 +2962,7 @@ void ImplWin::DrawEntry( BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImageP if( bDrawText && maString.Len() ) { - USHORT nTextStyle = TEXT_DRAW_VCENTER; + sal_uInt16 nTextStyle = TEXT_DRAW_VCENTER; if ( bDrawImage && bImage && !bLayout ) nTextStyle |= TEXT_DRAW_LEFT; @@ -3004,7 +3041,7 @@ void ImplWin::LoseFocus() ImplBtn::ImplBtn( Window* pParent, WinBits nWinStyle ) : PushButton( pParent, nWinStyle ), - mbDown ( FALSE ) + mbDown ( sal_False ) { } @@ -3024,7 +3061,7 @@ void ImplBtn::MouseButtonDown( const MouseEvent& ) if( IsEnabled() ) { MBDown(); - mbDown = TRUE; + mbDown = sal_True; } } @@ -3035,7 +3072,7 @@ ImplListBoxFloatingWindow::ImplListBoxFloatingWindow( Window* pParent ) : { mpImplLB = NULL; mnDDLineCount = 0; - mbAutoWidth = FALSE; + mbAutoWidth = sal_False; mnPopupModeStartSaveSelection = LISTBOX_ENTRY_NOTFOUND; @@ -3060,7 +3097,7 @@ long ImplListBoxFloatingWindow::PreNotify( NotifyEvent& rNEvt ) { if( rNEvt.GetType() == EVENT_LOSEFOCUS ) { - if( !GetParent()->HasChildPathFocus( TRUE ) ) + if( !GetParent()->HasChildPathFocus( sal_True ) ) EndPopupMode(); } @@ -3069,7 +3106,7 @@ long ImplListBoxFloatingWindow::PreNotify( NotifyEvent& rNEvt ) // ----------------------------------------------------------------------- -void ImplListBoxFloatingWindow::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ) +void ImplListBoxFloatingWindow::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) { FloatingWindow::SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags ); @@ -3086,7 +3123,7 @@ void ImplListBoxFloatingWindow::SetPosSizePixel( long nX, long nY, long nWidth, if ( nFlags & WINDOW_POSSIZE_Y ) aPos.Y() = nY; - USHORT nIndex; + sal_uInt16 nIndex; SetPosPixel( ImplCalcPos( this, Rectangle( aPos, GetParent()->GetSizePixel() ), FLOATWIN_POPUPMODE_DOWN, nIndex ) ); } @@ -3121,7 +3158,7 @@ Size ImplListBoxFloatingWindow::CalcFloatSize() sal_Int32 nLeft, nTop, nRight, nBottom; GetBorder( nLeft, nTop, nRight, nBottom ); - USHORT nLines = mpImplLB->GetEntryList()->GetEntryCount(); + sal_uInt16 nLines = mpImplLB->GetEntryList()->GetEntryCount(); if ( mnDDLineCount && ( nLines > mnDDLineCount ) ) nLines = mnDDLineCount; @@ -3187,7 +3224,7 @@ Size ImplListBoxFloatingWindow::CalcFloatSize() // ----------------------------------------------------------------------- -void ImplListBoxFloatingWindow::StartFloat( BOOL bStartTracking ) +void ImplListBoxFloatingWindow::StartFloat( sal_Bool bStartTracking ) { if( !IsInPopupMode() ) { @@ -3196,7 +3233,7 @@ void ImplListBoxFloatingWindow::StartFloat( BOOL bStartTracking ) SetSizePixel( aFloatSz ); mpImplLB->SetSizePixel( GetOutputSizePixel() ); - USHORT nPos = mpImplLB->GetEntryList()->GetSelectEntryPos( 0 ); + sal_uInt16 nPos = mpImplLB->GetEntryList()->GetSelectEntryPos( 0 ); mnPopupModeStartSaveSelection = nPos; Size aSz = GetParent()->GetSizePixel(); @@ -3227,7 +3264,7 @@ void ImplListBoxFloatingWindow::StartFloat( BOOL bStartTracking ) mpImplLB->ShowProminentEntry( nPos ); if( bStartTracking ) - mpImplLB->GetMainWindow()->EnableMouseMoveSelect( TRUE ); + mpImplLB->GetMainWindow()->EnableMouseMoveSelect( sal_True ); if ( mpImplLB->GetMainWindow()->IsGrabFocusAllowed() ) mpImplLB->GetMainWindow()->GrabFocus(); diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx index c5ae529f9b26..7f304e335f54 100644 --- a/vcl/source/control/imgctrl.cxx +++ b/vcl/source/control/imgctrl.cxx @@ -31,6 +31,7 @@ #include <vcl/event.hxx> #include <vcl/imgctrl.hxx> +#include <tools/rcid.h> #include <com/sun/star/awt/ImageScaleMode.hdl> @@ -38,10 +39,18 @@ namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode; // ----------------------------------------------------------------------- -ImageControl::ImageControl( Window* pParent, WinBits nStyle ) : - FixedImage( pParent, nStyle ) +ImageControl::ImageControl( Window* pParent, WinBits nStyle ) + :FixedImage( pParent, nStyle ) + ,mnScaleMode( ImageScaleMode::Anisotropic ) +{ +} + +// ----------------------------------------------------------------------- + +ImageControl::ImageControl( Window* pParent, const ResId& rResId ) + :FixedImage( pParent, rResId ) + ,mnScaleMode( ImageScaleMode::Anisotropic ) { - mnScaleMode = ImageScaleMode::Anisotropic; } // ----------------------------------------------------------------------- @@ -87,137 +96,81 @@ namespace // ----------------------------------------------------------------------- -void ImageControl::UserDraw( const UserDrawEvent& rUDEvt ) +void ImageControl::ImplDraw( OutputDevice& rDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize ) const { - USHORT nStyle = 0; - BitmapEx* pBitmap = &maBmp; - if ( !*pBitmap ) + sal_uInt16 nStyle = 0; + if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) ) + { + if ( !IsEnabled() ) + nStyle |= IMAGE_DRAW_DISABLE; + } + + const Image& rImage( GetModeImage() ); + const Image* pImage = &rImage; + const Rectangle aDrawRect( rPos, rSize ); + if ( !*pImage ) { String sText( GetText() ); if ( !sText.Len() ) return; WinBits nWinStyle = GetStyle(); - USHORT nTextStyle = FixedText::ImplGetTextStyle( nWinStyle ); - if ( !IsEnabled() ) - nTextStyle |= TEXT_DRAW_DISABLE; + sal_uInt16 nTextStyle = FixedText::ImplGetTextStyle( nWinStyle ); + if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) ) + if ( !IsEnabled() ) + nTextStyle |= TEXT_DRAW_DISABLE; - DrawText( rUDEvt.GetRect(), sText, nTextStyle ); + rDev.DrawText( aDrawRect, sText, nTextStyle ); return; } - const Rectangle& rPaintRect = rUDEvt.GetRect(); - const Size& rBitmapSize = maBmp.GetSizePixel(); + const Size& rBitmapSize = pImage->GetSizePixel(); - if( nStyle & IMAGE_DRAW_COLORTRANSFORM ) + switch ( mnScaleMode ) { - // only images support IMAGE_DRAW_COLORTRANSFORM - Image aImage( *pBitmap ); - if ( !!aImage ) - { - switch ( mnScaleMode ) - { - case ImageScaleMode::None: - { - rUDEvt.GetDevice()->DrawImage( - lcl_centerWithin( rPaintRect, rBitmapSize ), aImage, nStyle ); - } - break; - - case ImageScaleMode::Isotropic: - { - const Size aPaintSize = lcl_calcPaintSize( rPaintRect, rBitmapSize ); - rUDEvt.GetDevice()->DrawImage( - lcl_centerWithin( rPaintRect, aPaintSize ), - aPaintSize, - aImage, nStyle ); - } - break; - - case ImageScaleMode::Anisotropic: - { - rUDEvt.GetDevice()->DrawImage( - rPaintRect.TopLeft(), - rPaintRect.GetSize(), - aImage, nStyle ); - } - break; - - default: - OSL_ENSURE( false, "ImageControl::UserDraw: unhandled scale mode!" ); - break; - - } // switch ( mnScaleMode ) - } - } - else + case ImageScaleMode::None: { - switch ( mnScaleMode ) - { - case ImageScaleMode::None: - { - pBitmap->Draw( rUDEvt.GetDevice(), lcl_centerWithin( rPaintRect, rBitmapSize ) ); - } - break; - - case ImageScaleMode::Isotropic: - { - const Size aPaintSize = lcl_calcPaintSize( rPaintRect, rBitmapSize ); - pBitmap->Draw( rUDEvt.GetDevice(), - lcl_centerWithin( rPaintRect, aPaintSize ), - aPaintSize ); - } - break; - - case ImageScaleMode::Anisotropic: - { - pBitmap->Draw( rUDEvt.GetDevice(), - rPaintRect.TopLeft(), - rPaintRect.GetSize() ); - } - break; - - default: - OSL_ENSURE( false, "ImageControl::UserDraw: unhandled scale mode!" ); - break; - - } // switch ( mnScaleMode ) + rDev.DrawImage( lcl_centerWithin( aDrawRect, rBitmapSize ), *pImage, nStyle ); } -} + break; -// ----------------------------------------------------------------------- + case ImageScaleMode::Isotropic: + { + const Size aPaintSize = lcl_calcPaintSize( aDrawRect, rBitmapSize ); + rDev.DrawImage( + lcl_centerWithin( aDrawRect, aPaintSize ), + aPaintSize, + *pImage, nStyle ); + } + break; -void ImageControl::SetBitmap( const BitmapEx& rBmp ) -{ - maBmp = rBmp; - StateChanged( STATE_CHANGE_DATA ); -} + case ImageScaleMode::Anisotropic: + { + rDev.DrawImage( + aDrawRect.TopLeft(), + aDrawRect.GetSize(), + *pImage, nStyle ); + } + break; -// ----------------------------------------------------------------------- + default: + OSL_ENSURE( false, "ImageControl::ImplDraw: unhandled scale mode!" ); + break; -BOOL ImageControl::SetModeBitmap( const BitmapEx& rBitmap ) -{ - SetBitmap( rBitmap ); - return TRUE; + } // switch ( mnScaleMode ) } // ----------------------------------------------------------------------- -const BitmapEx& ImageControl::GetModeBitmap( ) const +void ImageControl::Paint( const Rectangle& /*rRect*/ ) { - return maBmp; -} - -// ----------------------------------------------------------------------- + ImplDraw( *this, 0, Point(), GetOutputSizePixel() ); -void ImageControl::Paint( const Rectangle& rRect ) -{ - FixedImage::Paint( rRect ); if( HasFocus() ) { Window *pWin = GetWindow( WINDOW_BORDER ); - BOOL bFlat = (GetBorderStyle() == 2); + sal_Bool bFlat = (GetBorderStyle() == 2); Rectangle aRect( Point(0,0), pWin->GetOutputSizePixel() ); Color oldLineCol = pWin->GetLineColor(); Color oldFillCol = pWin->GetFillColor(); @@ -236,6 +189,27 @@ void ImageControl::Paint( const Rectangle& rRect ) } // ----------------------------------------------------------------------- +void ImageControl::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) +{ + const Point aPos = pDev->LogicToPixel( rPos ); + const Size aSize = pDev->LogicToPixel( rSize ); + Rectangle aRect( aPos, aSize ); + + pDev->Push(); + pDev->SetMapMode(); + + // Border + if ( !(nFlags & WINDOW_DRAW_NOBORDER) && (GetStyle() & WB_BORDER) ) + { + ImplDrawFrame( pDev, aRect ); + } + pDev->IntersectClipRegion( aRect ); + ImplDraw( *pDev, nFlags, aRect.TopLeft(), aRect.GetSize() ); + + pDev->Pop(); +} + +// ----------------------------------------------------------------------- void ImageControl::GetFocus() { diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx index e072b406faae..e2d502026203 100644 --- a/vcl/source/control/longcurr.cxx +++ b/vcl/source/control/longcurr.cxx @@ -52,9 +52,9 @@ // ======================================================================= -static BigInt ImplPower10( USHORT n ) +static BigInt ImplPower10( sal_uInt16 n ) { - USHORT i; + sal_uInt16 i; BigInt nValue = 1; for ( i=0; i < n; i++ ) @@ -65,7 +65,7 @@ static BigInt ImplPower10( USHORT n ) // ----------------------------------------------------------------------- -static XubString ImplGetCurr( const LocaleDataWrapper& rLocaleDataWrapper, const BigInt &rNumber, USHORT nDigits, const String& rCurrSymbol, BOOL bShowThousandSep ) +static XubString ImplGetCurr( const LocaleDataWrapper& rLocaleDataWrapper, const BigInt &rNumber, sal_uInt16 nDigits, const String& rCurrSymbol, sal_Bool bShowThousandSep ) { DBG_ASSERT( nDigits < 10, "LongCurrency duerfen nur maximal 9 Nachkommastellen haben" ); @@ -113,16 +113,16 @@ static XubString ImplGetCurr( const LocaleDataWrapper& rLocaleDataWrapper, const // ----------------------------------------------------------------------- -static BOOL ImplNumericProcessKeyInput( Edit*, const KeyEvent& rKEvt, - BOOL bStrictFormat, BOOL bThousandSep, +static sal_Bool ImplNumericProcessKeyInput( Edit*, const KeyEvent& rKEvt, + sal_Bool bStrictFormat, sal_Bool bThousandSep, const LocaleDataWrapper& rLocaleDataWrapper ) { if ( !bStrictFormat ) - return FALSE; + return sal_False; else { sal_Unicode cChar = rKEvt.GetCharCode(); - USHORT nGroup = rKEvt.GetKeyCode().GetGroup(); + sal_uInt16 nGroup = rKEvt.GetKeyCode().GetGroup(); if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) || (nGroup == KEYGROUP_MISC) || @@ -130,28 +130,28 @@ static BOOL ImplNumericProcessKeyInput( Edit*, const KeyEvent& rKEvt, (bThousandSep && (cChar == rLocaleDataWrapper.getNumThousandSep())) || (cChar == rLocaleDataWrapper.getNumDecimalSep() ) || (cChar == '-') ) - return FALSE; + return sal_False; else - return TRUE; + return sal_True; } } // ----------------------------------------------------------------------- -static BOOL ImplNumericGetValue( const XubString& rStr, BigInt& rValue, - USHORT nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper, - BOOL bCurrency = FALSE ) +static sal_Bool ImplNumericGetValue( const XubString& rStr, BigInt& rValue, + sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper, + sal_Bool bCurrency = sal_False ) { XubString aStr = rStr; XubString aStr1; XubString aStr2; - USHORT nDecPos; - BOOL bNegative = FALSE; + sal_uInt16 nDecPos; + sal_Bool bNegative = sal_False; xub_StrLen i; // Reaktion auf leeren String if ( !rStr.Len() ) - return FALSE; + return sal_False; // Fuehrende und nachfolgende Leerzeichen entfernen aStr.EraseLeadingAndTrailingChars( ' ' ); @@ -171,7 +171,7 @@ static BOOL ImplNumericGetValue( const XubString& rStr, BigInt& rValue, if ( bCurrency ) { if ( (aStr.GetChar( 0 ) == '(') && (aStr.GetChar( aStr.Len()-1 ) == ')') ) - bNegative = TRUE; + bNegative = sal_True; if ( !bNegative ) { for ( i=0; i < aStr.Len(); i++ ) @@ -180,24 +180,24 @@ static BOOL ImplNumericGetValue( const XubString& rStr, BigInt& rValue, break; else if ( aStr.GetChar( i ) == '-' ) { - bNegative = TRUE; + bNegative = sal_True; break; } } } if ( !bNegative && bCurrency && aStr.Len() ) { - USHORT nFormat = rLocaleDataWrapper.getCurrNegativeFormat(); + sal_uInt16 nFormat = rLocaleDataWrapper.getCurrNegativeFormat(); if ( (nFormat == 3) || (nFormat == 6) || (nFormat == 7) || (nFormat == 10) ) { - for ( i = (USHORT)(aStr.Len()-1); i > 0; i++ ) + for ( i = (sal_uInt16)(aStr.Len()-1); i > 0; i++ ) { if ( (aStr.GetChar( i ) >= '0') && (aStr.GetChar( i ) <= '9') ) break; else if ( aStr.GetChar( i ) == '-' ) { - bNegative = TRUE; + bNegative = sal_True; break; } } @@ -207,7 +207,7 @@ static BOOL ImplNumericGetValue( const XubString& rStr, BigInt& rValue, else { if ( aStr1.GetChar( 0 ) == '-' ) - bNegative = TRUE; + bNegative = sal_True; } // Alle unerwuenschten Zeichen rauswerfen @@ -227,7 +227,7 @@ static BOOL ImplNumericGetValue( const XubString& rStr, BigInt& rValue, } if ( !aStr1.Len() && !aStr2.Len() ) - return FALSE; + return sal_False; if ( !aStr1.Len() ) aStr1.Insert( '0' ); @@ -235,11 +235,11 @@ static BOOL ImplNumericGetValue( const XubString& rStr, BigInt& rValue, aStr1.Insert( '-', 0 ); // Nachkommateil zurechtstutzen und dabei runden - BOOL bRound = FALSE; + sal_Bool bRound = sal_False; if ( aStr2.Len() > nDecDigits ) { if ( aStr2.GetChar( nDecDigits ) >= '5' ) - bRound = TRUE; + bRound = sal_True; aStr2.Erase( nDecDigits ); } if ( aStr2.Len() < nDecDigits ) @@ -260,38 +260,38 @@ static BOOL ImplNumericGetValue( const XubString& rStr, BigInt& rValue, rValue = nValue; - return TRUE; + return sal_True; } // ======================================================================= -static BOOL ImplLongCurrencyProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, - BOOL, BOOL bUseThousandSep, const LocaleDataWrapper& rLocaleDataWrapper ) +static sal_Bool ImplLongCurrencyProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, + sal_Bool, sal_Bool bUseThousandSep, const LocaleDataWrapper& rLocaleDataWrapper ) { // Es gibt hier kein sinnvolles StrictFormat, also alle // Zeichen erlauben - return ImplNumericProcessKeyInput( pEdit, rKEvt, FALSE, bUseThousandSep, rLocaleDataWrapper ); + return ImplNumericProcessKeyInput( pEdit, rKEvt, sal_False, bUseThousandSep, rLocaleDataWrapper ); } // ----------------------------------------------------------------------- -inline BOOL ImplLongCurrencyGetValue( const XubString& rStr, BigInt& rValue, - USHORT nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper ) +inline sal_Bool ImplLongCurrencyGetValue( const XubString& rStr, BigInt& rValue, + sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper ) { // Zahlenwert holen - return ImplNumericGetValue( rStr, rValue, nDecDigits, rLocaleDataWrapper, TRUE ); + return ImplNumericGetValue( rStr, rValue, nDecDigits, rLocaleDataWrapper, sal_True ); } // ----------------------------------------------------------------------- -BOOL ImplLongCurrencyReformat( const XubString& rStr, BigInt nMin, BigInt nMax, - USHORT nDecDigits, +sal_Bool ImplLongCurrencyReformat( const XubString& rStr, BigInt nMin, BigInt nMax, + sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper, String& rOutStr, LongCurrencyFormatter& rFormatter ) { BigInt nValue; - if ( !ImplNumericGetValue( rStr, nValue, nDecDigits, rLocaleDataWrapper, TRUE ) ) - return TRUE; + if ( !ImplNumericGetValue( rStr, nValue, nDecDigits, rLocaleDataWrapper, sal_True ) ) + return sal_True; else { BigInt nTempVal = nValue; @@ -306,7 +306,7 @@ BOOL ImplLongCurrencyReformat( const XubString& rStr, BigInt nMin, BigInt nMax, if ( !rFormatter.GetErrorHdl().Call( &rFormatter ) ) { rFormatter.mnCorrectedValue = 0; - return FALSE; + return sal_False; } else { @@ -315,7 +315,7 @@ BOOL ImplLongCurrencyReformat( const XubString& rStr, BigInt nMin, BigInt nMax, } rOutStr = ImplGetCurr( rLocaleDataWrapper, nTempVal, nDecDigits, rFormatter.GetCurrencySymbol(), rFormatter.IsUseThousandSep() ); - return TRUE; + return sal_True; } } @@ -332,7 +332,7 @@ void LongCurrencyFormatter::ImpInit() mnCorrectedValue = 0; mnDecimalDigits = 0; mnType = FORMAT_LONGCURRENCY; - mbThousandSep = TRUE; + mbThousandSep = sal_True; SetDecimalDigits( 0 ); } @@ -352,7 +352,7 @@ void LongCurrencyFormatter::ImplLoadRes( const ResId& rResId ) ResMgr* pMgr = rResId.GetResMgr(); if( pMgr ) { - ULONG nMask = pMgr->ReadLong(); + sal_uLong nMask = pMgr->ReadLong(); if ( NUMERICFORMATTER_MIN & nMask ) mnMin = pMgr->ReadLong(); @@ -361,7 +361,7 @@ void LongCurrencyFormatter::ImplLoadRes( const ResId& rResId ) mnMax = pMgr->ReadLong(); if ( NUMERICFORMATTER_STRICTFORMAT & nMask ) - SetStrictFormat( (BOOL)pMgr->ReadShort() ); + SetStrictFormat( (sal_Bool)pMgr->ReadShort() ); if ( NUMERICFORMATTER_DECIMALDIGITS & nMask ) SetDecimalDigits( pMgr->ReadShort() ); @@ -405,7 +405,7 @@ void LongCurrencyFormatter::SetValue( BigInt nNewValue ) { SetUserValue( nNewValue ); mnFieldValue = mnLastValue; - SetEmptyFieldValueData( FALSE ); + SetEmptyFieldValueData( sal_False ); } // ----------------------------------------------------------------------- @@ -430,7 +430,7 @@ void LongCurrencyFormatter::SetUserValue( BigInt nNewValue ) } else GetField()->SetText( aStr ); - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); } // ----------------------------------------------------------------------- @@ -464,7 +464,7 @@ void LongCurrencyFormatter::Reformat() return; XubString aStr; - BOOL bOK = ImplLongCurrencyReformat( GetField()->GetText(), mnMin, mnMax, + sal_Bool bOK = ImplLongCurrencyReformat( GetField()->GetText(), mnMin, mnMax, GetDecimalDigits(), GetLocaleDataWrapper(), aStr, *this ); if ( !bOK ) return; @@ -472,7 +472,7 @@ void LongCurrencyFormatter::Reformat() if ( aStr.Len() ) { GetField()->SetText( aStr ); - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); ImplLongCurrencyGetValue( aStr, mnLastValue, GetDecimalDigits(), GetLocaleDataWrapper() ); } else @@ -504,7 +504,7 @@ void LongCurrencyFormatter::SetMax( BigInt nNewMax ) // ----------------------------------------------------------------------- -void LongCurrencyFormatter::SetUseThousandSep( BOOL b ) +void LongCurrencyFormatter::SetUseThousandSep( sal_Bool b ) { mbThousandSep = b; ReformatAll(); @@ -513,7 +513,7 @@ void LongCurrencyFormatter::SetUseThousandSep( BOOL b ) // ----------------------------------------------------------------------- -void LongCurrencyFormatter::SetDecimalDigits( USHORT nDigits ) +void LongCurrencyFormatter::SetDecimalDigits( sal_uInt16 nDigits ) { // DBG_ASSERT( nDigits < 10, "LongCurrency duerfen nur maximal 9 Nachkommastellen haben" ); @@ -526,21 +526,21 @@ void LongCurrencyFormatter::SetDecimalDigits( USHORT nDigits ) // ----------------------------------------------------------------------- -USHORT LongCurrencyFormatter::GetDecimalDigits() const +sal_uInt16 LongCurrencyFormatter::GetDecimalDigits() const { return mnDecimalDigits; } // ----------------------------------------------------------------------- -BOOL LongCurrencyFormatter::IsValueModified() const +sal_Bool LongCurrencyFormatter::IsValueModified() const { if ( ImplGetEmptyFieldValue() ) return !IsEmptyValue(); else if ( GetValue() != mnFieldValue ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -548,7 +548,7 @@ BOOL LongCurrencyFormatter::IsValueModified() const void LongCurrencyFormatter::SetEmptyValue() { GetField()->SetText( ImplGetSVEmptyStr() ); - SetEmptyFieldValueData( TRUE ); + SetEmptyFieldValueData( sal_True ); } // ----------------------------------------------------------------------- @@ -577,7 +577,7 @@ void ImplNewLongCurrencyFieldValue( LongCurrencyField* pField, BigInt nNewValue Selection aSelect = pField->GetSelection(); aSelect.Justify(); XubString aText = pField->GetText(); - BOOL bLastSelected = ((xub_StrLen)aSelect.Max() == aText.Len()) ? TRUE : FALSE; + sal_Bool bLastSelected = ((xub_StrLen)aSelect.Max() == aText.Len()) ? sal_True : sal_False; BigInt nOldLastValue = pField->mnLastValue; pField->SetUserValue( nNewValue ); @@ -634,7 +634,7 @@ void LongCurrencyField::ImplLoadRes( const ResId& rResId ) SpinField::ImplLoadRes( rResId ); LongCurrencyFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr() ) ); - ULONG nMask = ReadLongRes(); + sal_uLong nMask = ReadLongRes(); if ( CURRENCYFIELD_FIRST & nMask ) mnFirst = ReadLongRes(); @@ -669,7 +669,7 @@ long LongCurrencyField::Notify( NotifyEvent& rNEvt ) { if( rNEvt.GetType() == EVENT_GETFOCUS ) { - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); } else if( rNEvt.GetType() == EVENT_LOSEFOCUS ) { @@ -686,7 +686,7 @@ long LongCurrencyField::Notify( NotifyEvent& rNEvt ) void LongCurrencyField::Modify() { - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); SpinField::Modify(); } @@ -781,7 +781,7 @@ long LongCurrencyBox::Notify( NotifyEvent& rNEvt ) { if( rNEvt.GetType() == EVENT_GETFOCUS ) { - MarkToBeReformatted( FALSE ); + MarkToBeReformatted( sal_False ); } else if( rNEvt.GetType() == EVENT_LOSEFOCUS ) { @@ -798,7 +798,7 @@ long LongCurrencyBox::Notify( NotifyEvent& rNEvt ) void LongCurrencyBox::Modify() { - MarkToBeReformatted( TRUE ); + MarkToBeReformatted( sal_True ); ComboBox::Modify(); } @@ -807,9 +807,9 @@ void LongCurrencyBox::Modify() void LongCurrencyBox::ReformatAll() { XubString aStr; - SetUpdateMode( FALSE ); - USHORT nEntryCount = GetEntryCount(); - for ( USHORT i=0; i < nEntryCount; i++ ) + SetUpdateMode( sal_False ); + sal_uInt16 nEntryCount = GetEntryCount(); + for ( sal_uInt16 i=0; i < nEntryCount; i++ ) { ImplLongCurrencyReformat( GetEntry( i ), mnMin, mnMax, GetDecimalDigits(), GetLocaleDataWrapper(), @@ -818,12 +818,12 @@ void LongCurrencyBox::ReformatAll() InsertEntry( aStr, i ); } LongCurrencyFormatter::Reformat(); - SetUpdateMode( TRUE ); + SetUpdateMode( sal_True ); } // ----------------------------------------------------------------------- -void LongCurrencyBox::InsertValue( BigInt nValue, USHORT nPos ) +void LongCurrencyBox::InsertValue( BigInt nValue, sal_uInt16 nPos ) { XubString aStr = ImplGetCurr( GetLocaleDataWrapper(), nValue, GetDecimalDigits(), GetCurrencySymbol(), IsUseThousandSep() ); ComboBox::InsertEntry( aStr, nPos ); @@ -839,7 +839,7 @@ void LongCurrencyBox::RemoveValue( BigInt nValue ) // ----------------------------------------------------------------------- -BigInt LongCurrencyBox::GetValue( USHORT nPos ) const +BigInt LongCurrencyBox::GetValue( sal_uInt16 nPos ) const { BigInt nValue = 0; ImplLongCurrencyGetValue( ComboBox::GetEntry( nPos ), nValue, @@ -849,7 +849,7 @@ BigInt LongCurrencyBox::GetValue( USHORT nPos ) const // ----------------------------------------------------------------------- -USHORT LongCurrencyBox::GetValuePos( BigInt nValue ) const +sal_uInt16 LongCurrencyBox::GetValuePos( BigInt nValue ) const { XubString aStr = ImplGetCurr( GetLocaleDataWrapper(), nValue, GetDecimalDigits(), GetCurrencySymbol(), IsUseThousandSep() ); return ComboBox::GetEntryPos( aStr ); diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 3ae3c47c0428..88b583a3240d 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -105,7 +105,7 @@ void ListBox::ImplInitListBoxData() mpBtn = NULL; mnDDHeight = 0; - mbDDAutoSize = TRUE; + mbDDAutoSize = sal_True; mnSaveValue = LISTBOX_ENTRY_NOTFOUND; mnLineCount = 0; } @@ -127,7 +127,7 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle ) { sal_Int32 nLeft, nTop, nRight, nBottom; GetBorder( nLeft, nTop, nRight, nBottom ); - mnDDHeight = (USHORT)(GetTextHeight() + nTop + nBottom + 4); + mnDDHeight = (sal_uInt16)(GetTextHeight() + nTop + nBottom + 4); if( IsNativeWidgetEnabled() && IsNativeControlSupported( CTRL_LISTBOX, PART_ENTIRE_CONTROL ) ) @@ -142,12 +142,12 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle ) { sal_Int32 nHeight = aBoundingRgn.GetHeight(); if( nHeight > mnDDHeight ) - mnDDHeight = static_cast<USHORT>(nHeight); + mnDDHeight = static_cast<sal_uInt16>(nHeight); } } mpFloatWin = new ImplListBoxFloatingWindow( this ); - mpFloatWin->SetAutoWidth( TRUE ); + mpFloatWin->SetAutoWidth( sal_True ); mpFloatWin->SetPopupModeEndHdl( LINK( this, ListBox, ImplPopupModeEndHdl ) ); mpFloatWin->GetDropTarget()->addDropTargetListener(xDrop); @@ -186,9 +186,9 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle ) mpImplLB->SetSelectionChangedHdl( LINK( this, ListBox, ImplSelectionChangedHdl ) ); } else - mpImplLB->GetMainWindow()->AllowGrabFocus( TRUE ); + mpImplLB->GetMainWindow()->AllowGrabFocus( sal_True ); - SetCompoundControl( TRUE ); + SetCompoundControl( sal_True ); } // ----------------------------------------------------------------------- @@ -208,12 +208,12 @@ void ListBox::ImplLoadRes( const ResId& rResId ) { Control::ImplLoadRes( rResId ); - USHORT nSelPos = ReadShortRes(); - USHORT nNumber = sal::static_int_cast<USHORT>(ReadLongRes()); + sal_uInt16 nSelPos = ReadShortRes(); + sal_uInt16 nNumber = sal::static_int_cast<sal_uInt16>(ReadLongRes()); - for( USHORT i = 0; i < nNumber; i++ ) + for( sal_uInt16 i = 0; i < nNumber; i++ ) { - USHORT nPos = InsertEntry( ReadStringRes(), LISTBOX_APPEND ); + sal_uInt16 nPos = InsertEntry( ReadStringRes(), LISTBOX_APPEND ); long nId = ReadLongRes(); if( nId ) @@ -228,7 +228,7 @@ void ListBox::ImplLoadRes( const ResId& rResId ) IMPL_LINK( ListBox, ImplSelectHdl, void*, EMPTYARG ) { - BOOL bPopup = IsInDropDown(); + sal_Bool bPopup = IsInDropDown(); if( IsDropDownBox() ) { if( !mpImplLB->IsTravelSelect() ) @@ -277,7 +277,7 @@ IMPL_LINK( ListBox, ImplSelectionChangedHdl, void*, n ) { if ( !mpImplLB->IsTrackingSelect() ) { - USHORT nChanged = (USHORT)(ULONG)n; + sal_uInt16 nChanged = (sal_uInt16)(sal_uLong)n; const ImplEntryList* pEntryList = mpImplLB->GetEntryList(); if ( pEntryList->IsEntryPosSelected( nChanged ) ) { @@ -313,8 +313,8 @@ IMPL_LINK( ListBox, ImplClickBtnHdl, void*, EMPTYARG ) { ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN ); mpImplWin->GrabFocus(); - mpBtn->SetPressed( TRUE ); - mpFloatWin->StartFloat( TRUE ); + mpBtn->SetPressed( sal_True ); + mpFloatWin->StartFloat( sal_True ); ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); ImplClearLayoutData(); @@ -336,9 +336,9 @@ IMPL_LINK( ListBox, ImplPopupModeEndHdl, void*, EMPTYARG ) if ( ( mpFloatWin->GetPopupModeStartSaveSelection() != LISTBOX_ENTRY_NOTFOUND ) && !IsEntryPosSelected( mpFloatWin->GetPopupModeStartSaveSelection() ) ) { - mpImplLB->SelectEntry( mpFloatWin->GetPopupModeStartSaveSelection(), TRUE ); - BOOL bTravelSelect = mpImplLB->IsTravelSelect(); - mpImplLB->SetTravelSelect( TRUE ); + mpImplLB->SelectEntry( mpFloatWin->GetPopupModeStartSaveSelection(), sal_True ); + sal_Bool bTravelSelect = mpImplLB->IsTravelSelect(); + mpImplLB->SetTravelSelect( sal_True ); ImplDelData aCheckDelete; ImplAddDel( &aCheckDelete ); @@ -357,7 +357,7 @@ IMPL_LINK( ListBox, ImplPopupModeEndHdl, void*, EMPTYARG ) if( mpImplWin ) mpImplWin->ImplClearLayoutData(); - mpBtn->SetPressed( FALSE ); + mpBtn->SetPressed( sal_False ); ImplCallEventListeners( VCLEVENT_DROPDOWN_CLOSE ); return 0; } @@ -374,8 +374,8 @@ void ListBox::ToggleDropDown() { ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN ); mpImplWin->GrabFocus(); - mpBtn->SetPressed( TRUE ); - mpFloatWin->StartFloat( TRUE ); + mpBtn->SetPressed( sal_True ); + mpFloatWin->StartFloat( sal_True ); ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); } } @@ -383,9 +383,9 @@ void ListBox::ToggleDropDown() // ----------------------------------------------------------------------- -void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ) +void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { - mpImplLB->GetMainWindow()->ImplInitSettings( TRUE, TRUE, TRUE ); + mpImplLB->GetMainWindow()->ImplInitSettings( sal_True, sal_True, sal_True ); Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -400,8 +400,8 @@ void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, UL // Border/Background pDev->SetLineColor(); pDev->SetFillColor(); - BOOL bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER); - BOOL bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground(); + sal_Bool bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER); + sal_Bool bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground(); if ( bBorder || bBackground ) { Rectangle aRect( aPos, aSize ); @@ -435,7 +435,7 @@ void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, UL } long nOnePixel = GetDrawPixel( pDev, 1 ); - USHORT nTextStyle = TEXT_DRAW_VCENTER; + sal_uInt16 nTextStyle = TEXT_DRAW_VCENTER; Rectangle aTextRect( aPos, aSize ); if ( GetStyle() & WB_CENTER ) @@ -472,7 +472,7 @@ void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, UL else { long nTextHeight = pDev->GetTextHeight(); - USHORT nLines = (USHORT)(aSize.Height() / nTextHeight); + sal_uInt16 nLines = (sal_uInt16)(aSize.Height() / nTextHeight); Rectangle aClip( aPos, aSize ); pDev->IntersectClipRegion( aClip ); @@ -480,10 +480,10 @@ void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, UL if ( !nLines ) nLines = 1; - for ( USHORT n = 0; n < nLines; n++ ) + for ( sal_uInt16 n = 0; n < nLines; n++ ) { - USHORT nEntry = n+mpImplLB->GetTopEntry(); - BOOL bSelected = mpImplLB->GetEntryList()->IsEntryPosSelected( nEntry ); + sal_uInt16 nEntry = n+mpImplLB->GetTopEntry(); + sal_Bool bSelected = mpImplLB->GetEntryList()->IsEntryPosSelected( nEntry ); if ( bSelected ) { pDev->SetFillColor( COL_BLACK ); @@ -567,7 +567,7 @@ void ListBox::DataChanged( const DataChangedEvent& rDCEvt ) if ( mpImplWin ) { mpImplWin->SetSettings( GetSettings() ); // Falls noch nicht eingestellt... - ImplInitFieldSettings( mpImplWin, TRUE, TRUE, TRUE ); + ImplInitFieldSettings( mpImplWin, sal_True, sal_True, sal_True ); mpBtn->SetSettings( GetSettings() ); ImplInitDropDownButton( mpBtn ); @@ -581,7 +581,7 @@ void ListBox::DataChanged( const DataChangedEvent& rDCEvt ) // ----------------------------------------------------------------------- -void ListBox::EnableAutoSize( BOOL bAuto ) +void ListBox::EnableAutoSize( sal_Bool bAuto ) { mbDDAutoSize = bAuto; if ( mpFloatWin ) @@ -595,7 +595,7 @@ void ListBox::EnableAutoSize( BOOL bAuto ) // ----------------------------------------------------------------------- -void ListBox::EnableDDAutoWidth( BOOL b ) +void ListBox::EnableDDAutoWidth( sal_Bool b ) { if ( mpFloatWin ) mpFloatWin->SetAutoWidth( b ); @@ -603,14 +603,14 @@ void ListBox::EnableDDAutoWidth( BOOL b ) // ----------------------------------------------------------------------- -BOOL ListBox::IsDDAutoWidthEnabled() const +sal_Bool ListBox::IsDDAutoWidthEnabled() const { - return mpFloatWin ? mpFloatWin->IsAutoWidth() : FALSE; + return mpFloatWin ? mpFloatWin->IsAutoWidth() : sal_False; } // ----------------------------------------------------------------------- -void ListBox::SetDropDownLineCount( USHORT nLines ) +void ListBox::SetDropDownLineCount( sal_uInt16 nLines ) { mnLineCount = nLines; if ( mpFloatWin ) @@ -619,7 +619,7 @@ void ListBox::SetDropDownLineCount( USHORT nLines ) // ----------------------------------------------------------------------- -USHORT ListBox::GetDropDownLineCount() const +sal_uInt16 ListBox::GetDropDownLineCount() const { if ( mpFloatWin ) return mpFloatWin->GetDropDownLineCount(); @@ -628,7 +628,7 @@ USHORT ListBox::GetDropDownLineCount() const // ----------------------------------------------------------------------- -void ListBox::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ) +void ListBox::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) { if( IsDropDownBox() && ( nFlags & WINDOW_POSSIZE_SIZE ) ) { @@ -748,7 +748,7 @@ void ListBox::FillLayoutData() const // ----------------------------------------------------------------------- -long ListBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const +long ListBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rPos ) const { if( !HasLayoutData() ) FillLayoutData(); @@ -768,7 +768,7 @@ long ListBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const aConvPoint = pMain->PixelToLogic( aConvPoint ); // try to find entry - USHORT nEntry = pMain->GetEntryPosForPoint( aConvPoint ); + sal_uInt16 nEntry = pMain->GetEntryPosForPoint( aConvPoint ); if( nEntry == LISTBOX_ENTRY_NOTFOUND ) { // not found, maybe dropdown case @@ -893,8 +893,8 @@ void ListBox::StateChanged( StateChangedType nType ) else if ( nType == STATE_CHANGE_STYLE ) { SetStyle( ImplInitStyle( GetStyle() ) ); - mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE ); - BOOL bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? TRUE : FALSE; + mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? sal_True : sal_False ); + sal_Bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? sal_True : sal_False; mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode ); } else if( nType == STATE_CHANGE_MIRRORING ) @@ -931,8 +931,8 @@ long ListBox::PreNotify( NotifyEvent& rNEvt ) aKeyEvt.GetKeyCode().IsMod2() ) { ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN ); - mpBtn->SetPressed( TRUE ); - mpFloatWin->StartFloat( FALSE ); + mpBtn->SetPressed( sal_True ); + mpFloatWin->StartFloat( sal_False ); ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); nDone = 1; } @@ -974,14 +974,14 @@ long ListBox::PreNotify( NotifyEvent& rNEvt ) } else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { - if ( IsInDropDown() && !HasChildPathFocus( TRUE ) ) + if ( IsInDropDown() && !HasChildPathFocus( sal_True ) ) mpFloatWin->EndPopupMode(); } else if ( (rNEvt.GetType() == EVENT_COMMAND) && (rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL) && (rNEvt.GetWindow() == mpImplWin) ) { - USHORT nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() ); + sal_uInt16 nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() ); if ( ( nWheelBehavior == MOUSE_WHEEL_ALWAYS ) || ( ( nWheelBehavior == MOUSE_WHEEL_FOCUS_ONLY ) && HasChildPathFocus() @@ -1047,30 +1047,30 @@ void ListBox::SetNoSelection() // ----------------------------------------------------------------------- -USHORT ListBox::InsertEntry( const XubString& rStr, USHORT nPos ) +sal_uInt16 ListBox::InsertEntry( const XubString& rStr, sal_uInt16 nPos ) { - USHORT nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr ); - nRealPos = sal::static_int_cast<USHORT>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount()); + sal_uInt16 nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr ); + nRealPos = sal::static_int_cast<sal_uInt16>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount()); CallEventListeners( VCLEVENT_LISTBOX_ITEMADDED, (void*) sal_IntPtr(nRealPos) ); return nRealPos; } // ----------------------------------------------------------------------- -USHORT ListBox::InsertEntry( const Image& rImage, USHORT nPos ) +sal_uInt16 ListBox::InsertEntry( const Image& rImage, sal_uInt16 nPos ) { - USHORT nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rImage ); - nRealPos = sal::static_int_cast<USHORT>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount()); + sal_uInt16 nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rImage ); + nRealPos = sal::static_int_cast<sal_uInt16>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount()); CallEventListeners( VCLEVENT_LISTBOX_ITEMADDED, (void*) sal_IntPtr(nRealPos) ); return nRealPos; } // ----------------------------------------------------------------------- -USHORT ListBox::InsertEntry( const XubString& rStr, const Image& rImage, USHORT nPos ) +sal_uInt16 ListBox::InsertEntry( const XubString& rStr, const Image& rImage, sal_uInt16 nPos ) { - USHORT nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr, rImage ); - nRealPos = sal::static_int_cast<USHORT>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount()); + sal_uInt16 nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr, rImage ); + nRealPos = sal::static_int_cast<sal_uInt16>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount()); CallEventListeners( VCLEVENT_LISTBOX_ITEMADDED, (void*) sal_IntPtr(nRealPos) ); return nRealPos; } @@ -1084,7 +1084,7 @@ void ListBox::RemoveEntry( const XubString& rStr ) // ----------------------------------------------------------------------- -void ListBox::RemoveEntry( USHORT nPos ) +void ListBox::RemoveEntry( sal_uInt16 nPos ) { mpImplLB->RemoveEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); CallEventListeners( VCLEVENT_LISTBOX_ITEMREMOVED, (void*) sal_IntPtr(nPos) ); @@ -1092,7 +1092,7 @@ void ListBox::RemoveEntry( USHORT nPos ) // ----------------------------------------------------------------------- -Image ListBox::GetEntryImage( USHORT nPos ) const +Image ListBox::GetEntryImage( sal_uInt16 nPos ) const { if ( mpImplLB->GetEntryList()->HasEntryImage( nPos ) ) return mpImplLB->GetEntryList()->GetEntryImage( nPos ); @@ -1101,90 +1101,90 @@ Image ListBox::GetEntryImage( USHORT nPos ) const // ----------------------------------------------------------------------- -USHORT ListBox::GetEntryPos( const XubString& rStr ) const +sal_uInt16 ListBox::GetEntryPos( const XubString& rStr ) const { - USHORT nPos = mpImplLB->GetEntryList()->FindEntry( rStr ); + sal_uInt16 nPos = mpImplLB->GetEntryList()->FindEntry( rStr ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - nPos = sal::static_int_cast<USHORT>(nPos - mpImplLB->GetEntryList()->GetMRUCount()); + nPos = sal::static_int_cast<sal_uInt16>(nPos - mpImplLB->GetEntryList()->GetMRUCount()); return nPos; } // ----------------------------------------------------------------------- -USHORT ListBox::GetEntryPos( const void* pData ) const +sal_uInt16 ListBox::GetEntryPos( const void* pData ) const { - USHORT nPos = mpImplLB->GetEntryList()->FindEntry( pData ); + sal_uInt16 nPos = mpImplLB->GetEntryList()->FindEntry( pData ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - nPos = sal::static_int_cast<USHORT>(nPos - mpImplLB->GetEntryList()->GetMRUCount()); + nPos = sal::static_int_cast<sal_uInt16>(nPos - mpImplLB->GetEntryList()->GetMRUCount()); return nPos; } // ----------------------------------------------------------------------- -XubString ListBox::GetEntry( USHORT nPos ) const +XubString ListBox::GetEntry( sal_uInt16 nPos ) const { return mpImplLB->GetEntryList()->GetEntryText( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); } // ----------------------------------------------------------------------- -USHORT ListBox::GetEntryCount() const +sal_uInt16 ListBox::GetEntryCount() const { return mpImplLB->GetEntryList()->GetEntryCount() - mpImplLB->GetEntryList()->GetMRUCount(); } // ----------------------------------------------------------------------- -XubString ListBox::GetSelectEntry( USHORT nIndex ) const +XubString ListBox::GetSelectEntry( sal_uInt16 nIndex ) const { return GetEntry( GetSelectEntryPos( nIndex ) ); } // ----------------------------------------------------------------------- -USHORT ListBox::GetSelectEntryCount() const +sal_uInt16 ListBox::GetSelectEntryCount() const { return mpImplLB->GetEntryList()->GetSelectEntryCount(); } // ----------------------------------------------------------------------- -USHORT ListBox::GetSelectEntryPos( USHORT nIndex ) const +sal_uInt16 ListBox::GetSelectEntryPos( sal_uInt16 nIndex ) const { - USHORT nPos = mpImplLB->GetEntryList()->GetSelectEntryPos( nIndex ); + sal_uInt16 nPos = mpImplLB->GetEntryList()->GetSelectEntryPos( nIndex ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) { if ( nPos < mpImplLB->GetEntryList()->GetMRUCount() ) nPos = mpImplLB->GetEntryList()->FindEntry( mpImplLB->GetEntryList()->GetEntryText( nPos ) ); - nPos = sal::static_int_cast<USHORT>(nPos - mpImplLB->GetEntryList()->GetMRUCount()); + nPos = sal::static_int_cast<sal_uInt16>(nPos - mpImplLB->GetEntryList()->GetMRUCount()); } return nPos; } // ----------------------------------------------------------------------- -BOOL ListBox::IsEntrySelected( const XubString& rStr ) const +sal_Bool ListBox::IsEntrySelected( const XubString& rStr ) const { return IsEntryPosSelected( GetEntryPos( rStr ) ); } // ----------------------------------------------------------------------- -BOOL ListBox::IsEntryPosSelected( USHORT nPos ) const +sal_Bool ListBox::IsEntryPosSelected( sal_uInt16 nPos ) const { return mpImplLB->GetEntryList()->IsEntryPosSelected( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); } // ----------------------------------------------------------------------- -void ListBox::SelectEntry( const XubString& rStr, BOOL bSelect ) +void ListBox::SelectEntry( const XubString& rStr, sal_Bool bSelect ) { SelectEntryPos( GetEntryPos( rStr ), bSelect ); } // ----------------------------------------------------------------------- -void ListBox::SelectEntryPos( USHORT nPos, BOOL bSelect ) +void ListBox::SelectEntryPos( sal_uInt16 nPos, sal_Bool bSelect ) { if ( nPos < mpImplLB->GetEntryList()->GetEntryCount() ) mpImplLB->SelectEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), bSelect ); @@ -1192,51 +1192,51 @@ void ListBox::SelectEntryPos( USHORT nPos, BOOL bSelect ) // ----------------------------------------------------------------------- -void ListBox::SetEntryData( USHORT nPos, void* pNewData ) +void ListBox::SetEntryData( sal_uInt16 nPos, void* pNewData ) { mpImplLB->SetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount(), pNewData ); } // ----------------------------------------------------------------------- -void* ListBox::GetEntryData( USHORT nPos ) const +void* ListBox::GetEntryData( sal_uInt16 nPos ) const { return mpImplLB->GetEntryList()->GetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); } // ----------------------------------------------------------------------- -void ListBox::SetEntryFlags( USHORT nPos, long nFlags ) +void ListBox::SetEntryFlags( sal_uInt16 nPos, long nFlags ) { mpImplLB->SetEntryFlags( nPos + mpImplLB->GetEntryList()->GetMRUCount(), nFlags ); } // ----------------------------------------------------------------------- -long ListBox::GetEntryFlags( USHORT nPos ) const +long ListBox::GetEntryFlags( sal_uInt16 nPos ) const { return mpImplLB->GetEntryList()->GetEntryFlags( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); } // ----------------------------------------------------------------------- -void ListBox::SetTopEntry( USHORT nPos ) +void ListBox::SetTopEntry( sal_uInt16 nPos ) { mpImplLB->SetTopEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); } // ----------------------------------------------------------------------- -void ListBox::ShowProminentEntry( USHORT nPos ) +void ListBox::ShowProminentEntry( sal_uInt16 nPos ) { mpImplLB->ShowProminentEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); } // ----------------------------------------------------------------------- -USHORT ListBox::GetTopEntry() const +sal_uInt16 ListBox::GetTopEntry() const { - USHORT nPos = GetEntryCount() ? mpImplLB->GetTopEntry() : LISTBOX_ENTRY_NOTFOUND; + sal_uInt16 nPos = GetEntryCount() ? mpImplLB->GetTopEntry() : LISTBOX_ENTRY_NOTFOUND; if ( nPos < mpImplLB->GetEntryList()->GetMRUCount() ) nPos = 0; return nPos; @@ -1258,26 +1258,26 @@ ProminentEntry ListBox::GetProminentEntryType() const // ----------------------------------------------------------------------- -BOOL ListBox::IsTravelSelect() const +sal_Bool ListBox::IsTravelSelect() const { return mpImplLB->IsTravelSelect(); } // ----------------------------------------------------------------------- -BOOL ListBox::IsInDropDown() const +sal_Bool ListBox::IsInDropDown() const { return mpFloatWin && mpFloatWin->IsInPopupMode(); } // ----------------------------------------------------------------------- -long ListBox::CalcWindowSizePixel( USHORT nLines ) const +long ListBox::CalcWindowSizePixel( sal_uInt16 nLines ) const { return mpImplLB->GetEntryHeight() * nLines; } -Rectangle ListBox::GetBoundingRectangle( USHORT nItem ) const +Rectangle ListBox::GetBoundingRectangle( sal_uInt16 nItem ) const { Rectangle aRect = mpImplLB->GetMainWindow()->GetBoundingRectangle( nItem ); Rectangle aOffset = mpImplLB->GetMainWindow()->GetWindowExtentsRelative( (Window*)this ); @@ -1287,12 +1287,12 @@ Rectangle ListBox::GetBoundingRectangle( USHORT nItem ) const // ----------------------------------------------------------------------- -void ListBox::EnableMultiSelection( BOOL bMulti ) +void ListBox::EnableMultiSelection( sal_Bool bMulti ) { - EnableMultiSelection( bMulti, FALSE ); + EnableMultiSelection( bMulti, sal_False ); } -void ListBox::EnableMultiSelection( BOOL bMulti, BOOL bStackSelection ) +void ListBox::EnableMultiSelection( sal_Bool bMulti, sal_Bool bStackSelection ) { mpImplLB->EnableMultiSelection( bMulti, bStackSelection ); @@ -1300,7 +1300,7 @@ void ListBox::EnableMultiSelection( BOOL bMulti, BOOL bStackSelection ) // Die MultiListBox verh�lt sich wie eine normale ListBox. // Die Mehrfachselektion kann nur �ber entsprechende Zusatztasten erfolgen. - BOOL bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? TRUE : FALSE; + sal_Bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? sal_True : sal_False; mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode ); // ohne Focus ist das Traveln in einer MultiSelection nicht zu sehen: @@ -1310,7 +1310,7 @@ void ListBox::EnableMultiSelection( BOOL bMulti, BOOL bStackSelection ) // ----------------------------------------------------------------------- -BOOL ListBox::IsMultiSelectionEnabled() const +sal_Bool ListBox::IsMultiSelectionEnabled() const { return mpImplLB->IsMultiSelectionEnabled(); } @@ -1407,7 +1407,7 @@ Size ListBox::CalcAdjustedSize( const Size& rPrefSize ) const // ----------------------------------------------------------------------- -Size ListBox::CalcSize( USHORT nColumns, USHORT nLines ) const +Size ListBox::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const { // ggf. werden ScrollBars eingeblendet Size aMinSz = CalcMinimumSize(); @@ -1449,19 +1449,19 @@ Size ListBox::CalcSize( USHORT nColumns, USHORT nLines ) const // ----------------------------------------------------------------------- -void ListBox::GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const +void ListBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const { long nCharWidth = GetTextWidth( UniString( 'x' ) ); if ( !IsDropDownBox() ) { Size aOutSz = mpImplLB->GetMainWindow()->GetOutputSizePixel(); - rnCols = (USHORT) (aOutSz.Width()/nCharWidth); - rnLines = (USHORT) (aOutSz.Height()/mpImplLB->GetEntryHeight()); + rnCols = (sal_uInt16) (aOutSz.Width()/nCharWidth); + rnLines = (sal_uInt16) (aOutSz.Height()/mpImplLB->GetEntryHeight()); } else { Size aOutSz = mpImplWin->GetOutputSizePixel(); - rnCols = (USHORT) (aOutSz.Width()/nCharWidth); + rnCols = (sal_uInt16) (aOutSz.Width()/nCharWidth); rnLines = 1; } } @@ -1482,7 +1482,7 @@ void ListBox::UserDraw( const UserDrawEvent& ) // ----------------------------------------------------------------------- -void ListBox::DrawEntry( const UserDrawEvent& rEvt, BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos ) +void ListBox::DrawEntry( const UserDrawEvent& rEvt, sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos ) { if ( rEvt.GetDevice() == mpImplLB->GetMainWindow() ) mpImplLB->GetMainWindow()->DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos ); @@ -1508,7 +1508,7 @@ const Size& ListBox::GetUserItemSize() const // ----------------------------------------------------------------------- -void ListBox::EnableUserDraw( BOOL bUserDraw ) +void ListBox::EnableUserDraw( sal_Bool bUserDraw ) { mpImplLB->GetMainWindow()->EnableUserDraw( bUserDraw ); if ( mpImplWin ) @@ -1517,14 +1517,14 @@ void ListBox::EnableUserDraw( BOOL bUserDraw ) // ----------------------------------------------------------------------- -BOOL ListBox::IsUserDrawEnabled() const +sal_Bool ListBox::IsUserDrawEnabled() const { return mpImplLB->GetMainWindow()->IsUserDrawEnabled(); } // ----------------------------------------------------------------------- -void ListBox::SetReadOnly( BOOL bReadOnly ) +void ListBox::SetReadOnly( sal_Bool bReadOnly ) { if ( mpImplLB->IsReadOnly() != bReadOnly ) { @@ -1535,14 +1535,14 @@ void ListBox::SetReadOnly( BOOL bReadOnly ) // ----------------------------------------------------------------------- -BOOL ListBox::IsReadOnly() const +sal_Bool ListBox::IsReadOnly() const { return mpImplLB->IsReadOnly(); } // ----------------------------------------------------------------------- -void ListBox::SetSeparatorPos( USHORT n ) +void ListBox::SetSeparatorPos( sal_uInt16 n ) { mpImplLB->SetSeparatorPos( n ); } @@ -1556,7 +1556,7 @@ void ListBox::SetSeparatorPos() // ----------------------------------------------------------------------- -USHORT ListBox::GetSeparatorPos() const +sal_uInt16 ListBox::GetSeparatorPos() const { return mpImplLB->GetSeparatorPos(); } @@ -1577,21 +1577,21 @@ XubString ListBox::GetMRUEntries( xub_Unicode cSep ) const // ----------------------------------------------------------------------- -void ListBox::SetMaxMRUCount( USHORT n ) +void ListBox::SetMaxMRUCount( sal_uInt16 n ) { mpImplLB->SetMaxMRUCount( n ); } // ----------------------------------------------------------------------- -USHORT ListBox::GetMaxMRUCount() const +sal_uInt16 ListBox::GetMaxMRUCount() const { return mpImplLB->GetMaxMRUCount(); } // ----------------------------------------------------------------------- -USHORT ListBox::GetDisplayLineCount() const +sal_uInt16 ListBox::GetDisplayLineCount() const { return mpImplLB->GetDisplayLineCount(); } @@ -1626,7 +1626,7 @@ MultiListBox::MultiListBox( Window* pParent, WinBits nStyle ) : ListBox( WINDOW_MULTILISTBOX ) { ImplInit( pParent, nStyle ); - EnableMultiSelection( TRUE ); + EnableMultiSelection( sal_True ); } // ----------------------------------------------------------------------- @@ -1641,7 +1641,7 @@ MultiListBox::MultiListBox( Window* pParent, const ResId& rResId ) : if ( !(nStyle & WB_HIDE ) ) Show(); - EnableMultiSelection( TRUE ); + EnableMultiSelection( sal_True ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/makefile.mk b/vcl/source/control/makefile.mk index f9e994e0a66c..de2613b1084f 100644 --- a/vcl/source/control/makefile.mk +++ b/vcl/source/control/makefile.mk @@ -43,51 +43,36 @@ CDEFS+=-D_STD_NO_NAMESPACE -D_VOS_NO_NAMESPACE -D_UNO_NO_NAMESPACE # --- Files -------------------------------------------------------- -SLOFILES= $(SLO)$/button.obj \ - $(SLO)$/combobox.obj \ +EXCEPTIONSFILES= \ + $(SLO)$/button.obj \ $(SLO)$/ctrl.obj \ $(SLO)$/edit.obj \ - $(SLO)$/field.obj \ $(SLO)$/field2.obj \ - $(SLO)$/fixbrd.obj \ - $(SLO)$/fixed.obj \ - $(SLO)$/group.obj \ - $(SLO)$/ilstbox.obj \ - $(SLO)$/imgctrl.obj \ - $(SLO)$/longcurr.obj \ - $(SLO)$/lstbox.obj \ - $(SLO)$/menubtn.obj \ - $(SLO)$/morebtn.obj \ - $(SLO)$/scrbar.obj \ - $(SLO)$/slider.obj \ - $(SLO)$/spinbtn.obj \ - $(SLO)$/spinfld.obj \ - $(SLO)$/tabctrl.obj + $(SLO)$/ilstbox.obj \ + $(SLO)$/tabctrl.obj \ + $(SLO)$/throbber.obj -EXCEPTIONSFILES= \ - $(SLO)$/button.obj \ +SLOFILES= $(EXCEPTIONSFILES) \ $(SLO)$/combobox.obj \ - $(SLO)$/ctrl.obj \ - $(SLO)$/edit.obj \ $(SLO)$/field.obj \ - $(SLO)$/field2.obj \ $(SLO)$/fixbrd.obj \ $(SLO)$/fixed.obj \ $(SLO)$/group.obj \ - $(SLO)$/ilstbox.obj \ $(SLO)$/imgctrl.obj \ $(SLO)$/longcurr.obj \ $(SLO)$/lstbox.obj \ - $(SLO)$/menubtn.obj \ $(SLO)$/morebtn.obj \ + $(SLO)$/menubtn.obj \ $(SLO)$/scrbar.obj \ $(SLO)$/slider.obj \ - $(SLO)$/spinbtn.obj \ $(SLO)$/spinfld.obj \ - $(SLO)$/tabctrl.obj + $(SLO)$/spinbtn.obj \ + $(SLO)$/quickselectionengine.obj + # --- Targets ------------------------------------------------------ .INCLUDE : target.mk .INCLUDE : $(PRJ)$/util$/target.pmk + diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx index 74780c805cac..13513f62b719 100644 --- a/vcl/source/control/menubtn.cxx +++ b/vcl/source/control/menubtn.cxx @@ -77,19 +77,10 @@ void MenuButton::ImplExecuteMenu() Point aPos( 0, 1 ); Size aSize = GetSizePixel(); Rectangle aRect( aPos, aSize ); - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( !((GetStyle() & (WB_RECTSTYLE | WB_SMALLSTYLE)) || - !(rStyleSettings.GetOptions() & STYLE_OPTION_MACSTYLE)) ) - { - aRect.Left() += 2; - aRect.Top() += 2; - aRect.Right() -= 2; - aRect.Bottom() -= 2; - } - SetPressed( TRUE ); + SetPressed( sal_True ); EndSelection(); mnCurItemId = mpMenu->Execute( this, aRect, POPUPMENU_EXECUTE_DOWN ); - SetPressed( FALSE ); + SetPressed( sal_False ); if ( mnCurItemId ) { Select(); @@ -128,7 +119,7 @@ void MenuButton::ImplLoadRes( const ResId& rResId ) { Control::ImplLoadRes( rResId ); - ULONG nObjMask = ReadLongRes(); + sal_uLong nObjMask = ReadLongRes(); if ( RSCMENUBUTTON_MENU & nObjMask ) { @@ -204,7 +195,7 @@ void MenuButton::MouseButtonDown( const MouseEvent& rMEvt ) void MenuButton::KeyInput( const KeyEvent& rKEvt ) { KeyCode aKeyCode = rKEvt.GetKeyCode(); - USHORT nCode = aKeyCode.GetCode(); + sal_uInt16 nCode = aKeyCode.GetCode(); if ( (nCode == KEY_DOWN) && aKeyCode.IsMod2() ) ImplExecuteMenu(); else if ( !(mnMenuMode & MENUBUTTON_MENUMODE_TIMED) && @@ -231,7 +222,7 @@ void MenuButton::Select() // ----------------------------------------------------------------------- -void MenuButton::SetMenuMode( USHORT nMode ) +void MenuButton::SetMenuMode( sal_uInt16 nMode ) { // Fuer die 5.1-Auslieferung besser noch nicht inline, ansonsten kann // diese Funktion zur 6.0 inline werden diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx index 5d1fbc9c466b..f40bc376d5e0 100644 --- a/vcl/source/control/morebtn.cxx +++ b/vcl/source/control/morebtn.cxx @@ -51,7 +51,7 @@ void MoreButton::ImplInit( Window* pParent, WinBits nStyle ) mpMBData = new ImplMoreButtonData; mnDelta = 0; meUnit = MAP_PIXEL; - mbState = FALSE; + mbState = sal_False; mpMBData->mpItemList = NULL; @@ -65,7 +65,7 @@ void MoreButton::ImplInit( Window* pParent, WinBits nStyle ) ShowState(); SetSymbolAlign( SYMBOLALIGN_RIGHT ); - ImplSetSmallSymbol( TRUE ); + ImplSetSmallSymbol( sal_True ); if ( ! ( nStyle & ( WB_RIGHT | WB_LEFT ) ) ) { @@ -117,12 +117,12 @@ void MoreButton::ImplLoadRes( const ResId& rResId ) { PushButton::ImplLoadRes( rResId ); - ULONG nObjMask = ReadLongRes(); + sal_uLong nObjMask = ReadLongRes(); if ( nObjMask & RSC_MOREBUTTON_STATE ) { // Nicht Methode rufen, da Dialog nicht umgeschaltet werden soll - mbState = (BOOL)ReadShortRes(); + mbState = (sal_Bool)ReadShortRes(); // SetText( GetText() ); ShowState(); } diff --git a/vcl/source/control/quickselectionengine.cxx b/vcl/source/control/quickselectionengine.cxx new file mode 100644 index 000000000000..2d32393bf79a --- /dev/null +++ b/vcl/source/control/quickselectionengine.cxx @@ -0,0 +1,183 @@ +/************************************************************************* +* 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_vcl.hxx" + +#include "vcl/quickselectionengine.hxx" +#include "vcl/event.hxx" +#include "vcl/timer.hxx" +#include "vcl/i18nhelp.hxx" +#include "vcl/svapp.hxx" + +#include <boost/optional.hpp> + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= QuickSelectionEngine_Data + //==================================================================== + struct QuickSelectionEngine_Data + { + ISearchableStringList& rEntryList; + String sCurrentSearchString; + ::boost::optional< sal_Unicode > aSingleSearchChar; + Timer aSearchTimeout; + + QuickSelectionEngine_Data( ISearchableStringList& _entryList ) + :rEntryList( _entryList ) + ,sCurrentSearchString() + ,aSingleSearchChar() + ,aSearchTimeout() + { + aSearchTimeout.SetTimeout( 2500 ); + aSearchTimeout.SetTimeoutHdl( LINK( this, QuickSelectionEngine_Data, SearchStringTimeout ) ); + } + + ~QuickSelectionEngine_Data() + { + aSearchTimeout.Stop(); + } + + DECL_LINK( SearchStringTimeout, Timer* ); + }; + + //-------------------------------------------------------------------- + namespace + { + static void lcl_reset( QuickSelectionEngine_Data& _data ) + { + _data.sCurrentSearchString.Erase(); + _data.aSingleSearchChar.reset(); + _data.aSearchTimeout.Stop(); + } + } + + //-------------------------------------------------------------------- + IMPL_LINK( QuickSelectionEngine_Data, SearchStringTimeout, Timer*, /*EMPTYARG*/ ) + { + lcl_reset( *this ); + return 1; + } + + //-------------------------------------------------------------------- + static StringEntryIdentifier findMatchingEntry( const String& _searchString, QuickSelectionEngine_Data& _engineData ) + { + const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetLocaleI18nHelper(); + // TODO: do we really need the Window's settings here? The original code used it ... + + String sEntryText; + // get the "current + 1" entry + StringEntryIdentifier pSearchEntry = _engineData.rEntryList.CurrentEntry( sEntryText ); + if ( pSearchEntry ) + pSearchEntry = _engineData.rEntryList.NextEntry( pSearchEntry, sEntryText ); + // loop 'til we find another matching entry + StringEntryIdentifier pStartedWith = pSearchEntry; + while ( pSearchEntry ) + { + if ( rI18nHelper.MatchString( _searchString, sEntryText ) != 0 ) + break; + + pSearchEntry = _engineData.rEntryList.NextEntry( pSearchEntry, sEntryText ); + if ( pSearchEntry == pStartedWith ) + pSearchEntry = NULL; + } + + return pSearchEntry; + } + + //==================================================================== + //= QuickSelectionEngine + //==================================================================== + //-------------------------------------------------------------------- + QuickSelectionEngine::QuickSelectionEngine( ISearchableStringList& _entryList ) + :m_pData( new QuickSelectionEngine_Data( _entryList ) ) + { + } + + //-------------------------------------------------------------------- + QuickSelectionEngine::~QuickSelectionEngine() + { + } + + //-------------------------------------------------------------------- + bool QuickSelectionEngine::HandleKeyEvent( const KeyEvent& _keyEvent ) + { + xub_Unicode c = _keyEvent.GetCharCode(); + + if ( ( c >= 32 ) && ( c != 127 ) && !_keyEvent.GetKeyCode().IsMod2() ) + { + m_pData->sCurrentSearchString += c; + OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: searching for %s", ByteString( m_pData->sCurrentSearchString, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); + + if ( m_pData->sCurrentSearchString.Len() == 1 ) + { // first character in the search -> remmeber + m_pData->aSingleSearchChar.reset( c ); + } + else if ( m_pData->sCurrentSearchString.Len() > 1 ) + { + if ( !!m_pData->aSingleSearchChar && ( *m_pData->aSingleSearchChar != c ) ) + // we already have a "single char", but the current one is different -> reset + m_pData->aSingleSearchChar.reset(); + } + + XubString aSearchTemp( m_pData->sCurrentSearchString ); + + StringEntryIdentifier pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData ); + OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: found %p", pMatchingEntry ); + if ( !pMatchingEntry && ( aSearchTemp.Len() > 1 ) && !!m_pData->aSingleSearchChar ) + { + // if there's only one letter in the search string, use a different search mode + aSearchTemp = *m_pData->aSingleSearchChar; + pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData ); + } + + if ( pMatchingEntry ) + { + m_pData->rEntryList.SelectEntry( pMatchingEntry ); + m_pData->aSearchTimeout.Start(); + } + else + { + lcl_reset( *m_pData ); + } + + return true; + } + return false; + } + + //-------------------------------------------------------------------- + void QuickSelectionEngine::Reset() + { + lcl_reset( *m_pData ); + } + +//........................................................................ +} // namespace vcl +//........................................................................ diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 6ce752d35c4b..938b7831985c 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -70,30 +70,30 @@ static long ImplMulDiv( long nNumber, long nNumerator, long nDenominator ) // ======================================================================= -#define SCRBAR_DRAW_BTN1 ((USHORT)0x0001) -#define SCRBAR_DRAW_BTN2 ((USHORT)0x0002) -#define SCRBAR_DRAW_PAGE1 ((USHORT)0x0004) -#define SCRBAR_DRAW_PAGE2 ((USHORT)0x0008) -#define SCRBAR_DRAW_THUMB ((USHORT)0x0010) -#define SCRBAR_DRAW_BACKGROUND ((USHORT)0x0020) +#define SCRBAR_DRAW_BTN1 ((sal_uInt16)0x0001) +#define SCRBAR_DRAW_BTN2 ((sal_uInt16)0x0002) +#define SCRBAR_DRAW_PAGE1 ((sal_uInt16)0x0004) +#define SCRBAR_DRAW_PAGE2 ((sal_uInt16)0x0008) +#define SCRBAR_DRAW_THUMB ((sal_uInt16)0x0010) +#define SCRBAR_DRAW_BACKGROUND ((sal_uInt16)0x0020) #define SCRBAR_DRAW_ALL (SCRBAR_DRAW_BTN1 | SCRBAR_DRAW_BTN2 | \ SCRBAR_DRAW_PAGE1 | SCRBAR_DRAW_PAGE2 |\ SCRBAR_DRAW_THUMB | SCRBAR_DRAW_BACKGROUND ) -#define SCRBAR_STATE_BTN1_DOWN ((USHORT)0x0001) -#define SCRBAR_STATE_BTN1_DISABLE ((USHORT)0x0002) -#define SCRBAR_STATE_BTN2_DOWN ((USHORT)0x0004) -#define SCRBAR_STATE_BTN2_DISABLE ((USHORT)0x0008) -#define SCRBAR_STATE_PAGE1_DOWN ((USHORT)0x0010) -#define SCRBAR_STATE_PAGE2_DOWN ((USHORT)0x0020) -#define SCRBAR_STATE_THUMB_DOWN ((USHORT)0x0040) +#define SCRBAR_STATE_BTN1_DOWN ((sal_uInt16)0x0001) +#define SCRBAR_STATE_BTN1_DISABLE ((sal_uInt16)0x0002) +#define SCRBAR_STATE_BTN2_DOWN ((sal_uInt16)0x0004) +#define SCRBAR_STATE_BTN2_DISABLE ((sal_uInt16)0x0008) +#define SCRBAR_STATE_PAGE1_DOWN ((sal_uInt16)0x0010) +#define SCRBAR_STATE_PAGE2_DOWN ((sal_uInt16)0x0020) +#define SCRBAR_STATE_THUMB_DOWN ((sal_uInt16)0x0040) #define SCRBAR_VIEW_STYLE (WB_3DLOOK | WB_HORZ | WB_VERT) struct ImplScrollBarData { AutoTimer maTimer; // Timer - BOOL mbHide; + sal_Bool mbHide; Rectangle maTrackRect; // TODO: move to ScrollBar class when binary incompatibility of ScrollBar class is no longer problematic }; @@ -116,14 +116,14 @@ void ScrollBar::ImplInit( Window* pParent, WinBits nStyle ) mnStateFlags = 0; meScrollType = SCROLL_DONTKNOW; meDDScrollType = SCROLL_DONTKNOW; - mbCalcSize = TRUE; + mbCalcSize = sal_True; mbFullDrag = 0; if( !mpData ) // TODO: remove when maTrackRect is no longer in mpData { mpData = new ImplScrollBarData; mpData->maTimer.SetTimeoutHdl( LINK( this, ScrollBar, ImplAutoTimerHdl ) ); - mpData->mbHide = FALSE; + mpData->mbHide = sal_False; } ImplInitStyle( nStyle ); @@ -139,7 +139,7 @@ void ScrollBar::ImplInit( Window* pParent, WinBits nStyle ) void ScrollBar::ImplInitStyle( WinBits nStyle ) { if ( nStyle & WB_DRAG ) - mbFullDrag = TRUE; + mbFullDrag = sal_True; else mbFullDrag = (GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SCROLL) != 0; } @@ -180,12 +180,12 @@ void ScrollBar::ImplLoadRes( const ResId& rResId ) { Control::ImplLoadRes( rResId ); - INT16 nMin = ReadShortRes(); - INT16 nMax = ReadShortRes(); - INT16 nThumbPos = ReadShortRes(); - INT16 nPage = ReadShortRes(); - INT16 nStep = ReadShortRes(); - INT16 nVisibleSize = ReadShortRes(); + sal_Int16 nMin = ReadShortRes(); + sal_Int16 nMax = ReadShortRes(); + sal_Int16 nThumbPos = ReadShortRes(); + sal_Int16 nPage = ReadShortRes(); + sal_Int16 nStep = ReadShortRes(); + sal_Int16 nVisibleSize = ReadShortRes(); SetRange( Range( nMin, nMax ) ); SetLineSize( nStep ); @@ -196,9 +196,9 @@ void ScrollBar::ImplLoadRes( const ResId& rResId ) // ----------------------------------------------------------------------- -void ScrollBar::ImplUpdateRects( BOOL bUpdate ) +void ScrollBar::ImplUpdateRects( sal_Bool bUpdate ) { - USHORT nOldStateFlags = mnStateFlags; + sal_uInt16 nOldStateFlags = mnStateFlags; Rectangle aOldPage1Rect = maPage1Rect; Rectangle aOldPage2Rect = maPage2Rect; Rectangle aOldThumbRect = maThumbRect; @@ -280,7 +280,7 @@ void ScrollBar::ImplUpdateRects( BOOL bUpdate ) if ( bUpdate ) { - USHORT nDraw = 0; + sal_uInt16 nDraw = 0; if ( (nOldStateFlags & SCRBAR_STATE_BTN1_DISABLE) != (mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) ) nDraw |= SCRBAR_DRAW_BTN1; @@ -333,7 +333,7 @@ long ScrollBar::ImplCalcThumbPosPix( long nPos ) // ----------------------------------------------------------------------- -void ScrollBar::ImplCalc( BOOL bUpdate ) +void ScrollBar::ImplCalc( sal_Bool bUpdate ) { const Size aSize = GetOutputSizePixel(); const long nMinThumbSize = GetSettings().GetStyleSettings().GetMinThumbSize();; @@ -430,7 +430,7 @@ void ScrollBar::ImplCalc( BOOL bUpdate ) if ( !mnThumbPixRange ) maThumbRect.SetEmpty(); - mbCalcSize = FALSE; + mbCalcSize = sal_False; } if ( mnThumbPixRange ) @@ -468,14 +468,14 @@ void ScrollBar::ImplCalc( BOOL bUpdate ) if ( bUpdate && HasPaintEvent() ) { Invalidate(); - bUpdate = FALSE; + bUpdate = sal_False; } ImplUpdateRects( bUpdate ); } // ----------------------------------------------------------------------- -void ScrollBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ) +void ScrollBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -504,7 +504,7 @@ void ScrollBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, // -force recalculate if ( mbCalcSize ) - ImplCalc( FALSE ); + ImplCalc( sal_False ); maBtn1Rect+=aPos; maBtn2Rect+=aPos; @@ -516,19 +516,19 @@ void ScrollBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ImplDraw( SCRBAR_DRAW_ALL, pDev ); pDev->Pop(); - mbCalcSize = TRUE; + mbCalcSize = sal_True; } // ----------------------------------------------------------------------- -BOOL ScrollBar::ImplDrawNative( USHORT nDrawFlags ) +sal_Bool ScrollBar::ImplDrawNative( sal_uInt16 nDrawFlags ) { ScrollbarValue scrValue; - BOOL bNativeOK = IsNativeControlSupported(CTRL_SCROLLBAR, PART_ENTIRE_CONTROL); + sal_Bool bNativeOK = IsNativeControlSupported(CTRL_SCROLLBAR, PART_ENTIRE_CONTROL); if( bNativeOK ) { - BOOL bHorz = (GetStyle() & WB_HORZ ? true : false); + sal_Bool bHorz = (GetStyle() & WB_HORZ ? true : false); // Draw the entire background if the control supports it if( IsNativeControlSupported(CTRL_SCROLLBAR, bHorz ? PART_DRAW_BACKGROUND_HORZ : PART_DRAW_BACKGROUND_VERT) ) @@ -682,18 +682,18 @@ BOOL ScrollBar::ImplDrawNative( USHORT nDrawFlags ) return bNativeOK; } -void ScrollBar::ImplDraw( USHORT nDrawFlags, OutputDevice* pOutDev ) +void ScrollBar::ImplDraw( sal_uInt16 nDrawFlags, OutputDevice* pOutDev ) { DecorationView aDecoView( pOutDev ); Rectangle aTempRect; - USHORT nStyle; + sal_uInt16 nStyle; const StyleSettings& rStyleSettings = pOutDev->GetSettings().GetStyleSettings(); SymbolType eSymbolType; - BOOL bEnabled = IsEnabled(); + sal_Bool bEnabled = IsEnabled(); // Evt. noch offene Berechnungen nachholen if ( mbCalcSize ) - ImplCalc( FALSE ); + ImplCalc( sal_False ); Window *pWin = NULL; if( pOutDev->GetOutDevType() == OUTDEV_WINDOW ) @@ -769,64 +769,7 @@ void ScrollBar::ImplDraw( USHORT nDrawFlags, OutputDevice* pOutDev ) if ( bEnabled ) { nStyle = BUTTON_DRAW_NOLIGHTBORDER; - // pressed thumbs only in OS2 style - if ( rStyleSettings.GetOptions() & STYLE_OPTION_OS2STYLE ) - if ( mnStateFlags & SCRBAR_STATE_THUMB_DOWN ) - nStyle |= BUTTON_DRAW_PRESSED; aTempRect = aDecoView.DrawButton( maThumbRect, nStyle ); - // OS2 style requires pattern on the thumb - if ( rStyleSettings.GetOptions() & STYLE_OPTION_OS2STYLE ) - { - if ( GetStyle() & WB_HORZ ) - { - if ( aTempRect.GetWidth() > 6 ) - { - long nX = aTempRect.Center().X(); - nX -= 6; - if ( nX < aTempRect.Left() ) - nX = aTempRect.Left(); - for ( int i = 0; i < 6; i++ ) - { - if ( nX > aTempRect.Right()-1 ) - break; - - pOutDev->SetLineColor( rStyleSettings.GetButtonTextColor() ); - pOutDev->DrawLine( Point( nX, aTempRect.Top()+1 ), - Point( nX, aTempRect.Bottom()-1 ) ); - nX++; - pOutDev->SetLineColor( rStyleSettings.GetLightColor() ); - pOutDev->DrawLine( Point( nX, aTempRect.Top()+1 ), - Point( nX, aTempRect.Bottom()-1 ) ); - nX++; - } - } - } - else - { - if ( aTempRect.GetHeight() > 6 ) - { - long nY = aTempRect.Center().Y(); - nY -= 6; - if ( nY < aTempRect.Top() ) - nY = aTempRect.Top(); - for ( int i = 0; i < 6; i++ ) - { - if ( nY > aTempRect.Bottom()-1 ) - break; - - pOutDev->SetLineColor( rStyleSettings.GetButtonTextColor() ); - pOutDev->DrawLine( Point( aTempRect.Left()+1, nY ), - Point( aTempRect.Right()-1, nY ) ); - nY++; - pOutDev->SetLineColor( rStyleSettings.GetLightColor() ); - pOutDev->DrawLine( Point( aTempRect.Left()+1, nY ), - Point( aTempRect.Right()-1, nY ) ); - nY++; - } - } - } - pOutDev->SetLineColor(); - } } else { @@ -856,7 +799,7 @@ void ScrollBar::ImplDraw( USHORT nDrawFlags, OutputDevice* pOutDev ) // ----------------------------------------------------------------------- -long ScrollBar::ImplScroll( long nNewPos, BOOL bCallEndScroll ) +long ScrollBar::ImplScroll( long nNewPos, sal_Bool bCallEndScroll ) { long nOldPos = mnThumbPos; SetThumbPos( nNewPos ); @@ -874,7 +817,7 @@ long ScrollBar::ImplScroll( long nNewPos, BOOL bCallEndScroll ) // ----------------------------------------------------------------------- -long ScrollBar::ImplDoAction( BOOL bCallEndScroll ) +long ScrollBar::ImplDoAction( sal_Bool bCallEndScroll ) { long nDelta = 0; @@ -904,12 +847,12 @@ long ScrollBar::ImplDoAction( BOOL bCallEndScroll ) // ----------------------------------------------------------------------- -void ScrollBar::ImplDoMouseAction( const Point& rMousePos, BOOL bCallAction ) +void ScrollBar::ImplDoMouseAction( const Point& rMousePos, sal_Bool bCallAction ) { - USHORT nOldStateFlags = mnStateFlags; - BOOL bAction = FALSE; - BOOL bHorizontal = ( GetStyle() & WB_HORZ )? TRUE: FALSE; - BOOL bIsInside = FALSE; + sal_uInt16 nOldStateFlags = mnStateFlags; + sal_Bool bAction = sal_False; + sal_Bool bHorizontal = ( GetStyle() & WB_HORZ )? sal_True: sal_False; + sal_Bool bIsInside = sal_False; Point aPoint( 0, 0 ); Rectangle aControlRegion( aPoint, GetOutputSizePixel() ); @@ -976,7 +919,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, BOOL bCallAction ) if ( nOldStateFlags != mnStateFlags ) ImplDraw( mnDragDraw, this ); if ( bAction ) - ImplDoAction( FALSE ); + ImplDoAction( sal_False ); } // ----------------------------------------------------------------------- @@ -1016,10 +959,10 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) if ( rMEvt.IsLeft() || rMEvt.IsMiddle() ) { const Point& rMousePos = rMEvt.GetPosPixel(); - USHORT nTrackFlags = 0; - BOOL bHorizontal = ( GetStyle() & WB_HORZ )? TRUE: FALSE; - BOOL bIsInside = FALSE; - BOOL bDragToMouse = FALSE; + sal_uInt16 nTrackFlags = 0; + sal_Bool bHorizontal = ( GetStyle() & WB_HORZ )? sal_True: sal_False; + sal_Bool bIsInside = sal_False; + sal_Bool bDragToMouse = sal_False; Point aPoint( 0, 0 ); Rectangle aControlRegion( aPoint, GetOutputSizePixel() ); @@ -1062,7 +1005,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) { if( mpData ) { - mpData->mbHide = TRUE; // disable focus blinking + mpData->mbHide = sal_True; // disable focus blinking if( HasFocus() ) ImplDraw( SCRBAR_DRAW_THUMB, this ); // paint without focus } @@ -1076,7 +1019,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) // calculate mouse offset if( rMEvt.IsMiddle() || (ImplGetSVData()->maNWFData.mbScrollbarJumpPage && !bThumbHit) ) { - bDragToMouse = TRUE; + bDragToMouse = sal_True; if ( GetStyle() & WB_HORZ ) mnMouseOff = maThumbRect.GetWidth()/2; else @@ -1098,7 +1041,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) } else if( HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_TRACK_HORZ_AREA : PART_TRACK_VERT_AREA, aControlRegion, rMousePos, bIsInside )? - bIsInside : TRUE ) + bIsInside : sal_True ) { nTrackFlags = STARTTRACK_BUTTONREPEAT; @@ -1143,7 +1086,7 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt ) if ( rTEvt.IsTrackingEnded() ) { // Button und PageRect-Status wieder herstellen - USHORT nOldStateFlags = mnStateFlags; + sal_uInt16 nOldStateFlags = mnStateFlags; mnStateFlags &= ~(SCRBAR_STATE_BTN1_DOWN | SCRBAR_STATE_BTN2_DOWN | SCRBAR_STATE_PAGE1_DOWN | SCRBAR_STATE_PAGE2_DOWN | SCRBAR_STATE_THUMB_DOWN); @@ -1180,7 +1123,7 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt ) meScrollType = SCROLL_DONTKNOW; if( mpData ) - mpData->mbHide = FALSE; // re-enable focus blinking + mpData->mbHide = sal_False; // re-enable focus blinking } else { @@ -1254,9 +1197,9 @@ void ScrollBar::Paint( const Rectangle& ) void ScrollBar::Resize() { Control::Resize(); - mbCalcSize = TRUE; + mbCalcSize = sal_True; if ( IsReallyVisible() ) - ImplCalc( FALSE ); + ImplCalc( sal_False ); Invalidate(); } @@ -1295,7 +1238,7 @@ void ScrollBar::GetFocus() { mpData = new ImplScrollBarData; mpData->maTimer.SetTimeoutHdl( LINK( this, ScrollBar, ImplAutoTimerHdl ) ); - mpData->mbHide = FALSE; + mpData->mbHide = sal_False; } ImplInvert(); // react immediately mpData->maTimer.SetTimeout( GetSettings().GetStyleSettings().GetCursorBlinkTime() ); @@ -1321,17 +1264,17 @@ void ScrollBar::StateChanged( StateChangedType nType ) Control::StateChanged( nType ); if ( nType == STATE_CHANGE_INITSHOW ) - ImplCalc( FALSE ); + ImplCalc( sal_False ); else if ( nType == STATE_CHANGE_DATA ) { if ( IsReallyVisible() && IsUpdateMode() ) - ImplCalc( TRUE ); + ImplCalc( sal_True ); } else if ( nType == STATE_CHANGE_UPDATEMODE ) { if ( IsReallyVisible() && IsUpdateMode() ) { - ImplCalc( FALSE ); + ImplCalc( sal_False ); Invalidate(); } } @@ -1348,8 +1291,8 @@ void ScrollBar::StateChanged( StateChangedType nType ) if ( (GetPrevStyle() & SCRBAR_VIEW_STYLE) != (GetStyle() & SCRBAR_VIEW_STYLE) ) { - mbCalcSize = TRUE; - ImplCalc( FALSE ); + mbCalcSize = sal_True; + ImplCalc( sal_False ); Invalidate(); } } @@ -1365,8 +1308,8 @@ void ScrollBar::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) { - mbCalcSize = TRUE; - ImplCalc( FALSE ); + mbCalcSize = sal_True; + ImplCalc( sal_False ); Invalidate(); } } @@ -1375,8 +1318,8 @@ void ScrollBar::DataChanged( const DataChangedEvent& rDCEvt ) Rectangle* ScrollBar::ImplFindPartRect( const Point& rPt ) { - BOOL bHorizontal = ( GetStyle() & WB_HORZ )? TRUE: FALSE; - BOOL bIsInside = FALSE; + sal_Bool bHorizontal = ( GetStyle() & WB_HORZ )? sal_True: sal_False; + sal_Bool bIsInside = sal_False; Point aPoint( 0, 0 ); Rectangle aControlRegion( aPoint, GetOutputSizePixel() ); @@ -1438,7 +1381,7 @@ long ScrollBar::PreNotify( NotifyEvent& rNEvt ) aClipRegion.Union( *pLastRect ); // Support for 3-button scroll bars - BOOL bHas3Buttons = IsNativeControlSupported( CTRL_SCROLLBAR, HAS_THREE_BUTTONS ); + sal_Bool bHas3Buttons = IsNativeControlSupported( CTRL_SCROLLBAR, HAS_THREE_BUTTONS ); if ( bHas3Buttons && ( pRect == &maBtn1Rect || pLastRect == &maBtn1Rect ) ) { aClipRegion.Union( maBtn2Rect ); @@ -1478,7 +1421,7 @@ long ScrollBar::DoScroll( long nNewPos ) return 0; meScrollType = SCROLL_DRAG; - long nDelta = ImplScroll( nNewPos, TRUE ); + long nDelta = ImplScroll( nNewPos, sal_True ); meScrollType = SCROLL_DONTKNOW; return nDelta; } @@ -1493,7 +1436,7 @@ long ScrollBar::DoScrollAction( ScrollType eScrollType ) return 0; meScrollType = eScrollType; - long nDelta = ImplDoAction( TRUE ); + long nDelta = ImplDoAction( sal_True ); meScrollType = SCROLL_DONTKNOW; return nDelta; } diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx index 6d3c813dbe59..71eeeae665d4 100644 --- a/vcl/source/control/slider.cxx +++ b/vcl/source/control/slider.cxx @@ -46,15 +46,15 @@ static long ImplMulDiv( long nNumber, long nNumerator, long nDenominator ) // ======================================================================= -#define SLIDER_DRAW_THUMB ((USHORT)0x0001) -#define SLIDER_DRAW_CHANNEL1 ((USHORT)0x0002) -#define SLIDER_DRAW_CHANNEL2 ((USHORT)0x0004) +#define SLIDER_DRAW_THUMB ((sal_uInt16)0x0001) +#define SLIDER_DRAW_CHANNEL1 ((sal_uInt16)0x0002) +#define SLIDER_DRAW_CHANNEL2 ((sal_uInt16)0x0004) #define SLIDER_DRAW_CHANNEL (SLIDER_DRAW_CHANNEL1 | SLIDER_DRAW_CHANNEL2) #define SLIDER_DRAW_ALL (SLIDER_DRAW_THUMB | SLIDER_DRAW_CHANNEL) -#define SLIDER_STATE_CHANNEL1_DOWN ((USHORT)0x0001) -#define SLIDER_STATE_CHANNEL2_DOWN ((USHORT)0x0002) -#define SLIDER_STATE_THUMB_DOWN ((USHORT)0x0004) +#define SLIDER_STATE_CHANNEL1_DOWN ((sal_uInt16)0x0001) +#define SLIDER_STATE_CHANNEL2_DOWN ((sal_uInt16)0x0002) +#define SLIDER_STATE_THUMB_DOWN ((sal_uInt16)0x0004) #define SLIDER_THUMB_SIZE 9 #define SLIDER_THUMB_HALFSIZE 4 @@ -87,8 +87,8 @@ void Slider::ImplInit( Window* pParent, WinBits nStyle ) mnDragDraw = 0; mnStateFlags = 0; meScrollType = SCROLL_DONTKNOW; - mbCalcSize = TRUE; - mbFullDrag = TRUE; + mbCalcSize = sal_True; + mbFullDrag = sal_True; Control::ImplInit( pParent, nStyle, NULL ); @@ -124,12 +124,12 @@ void Slider::ImplLoadRes( const ResId& rResId ) { Control::ImplLoadRes( rResId ); - INT16 nMin = ReadShortRes(); - INT16 nMax = ReadShortRes(); - INT16 nThumbPos = ReadShortRes(); - INT16 nPage = ReadShortRes(); - INT16 nStep = ReadShortRes(); - /* INT16 nVisibleSize = */ ReadShortRes(); + sal_Int16 nMin = ReadShortRes(); + sal_Int16 nMax = ReadShortRes(); + sal_Int16 nThumbPos = ReadShortRes(); + sal_Int16 nPage = ReadShortRes(); + sal_Int16 nStep = ReadShortRes(); + /* sal_Int16 nVisibleSize = */ ReadShortRes(); SetRange( Range( nMin, nMax ) ); SetLineSize( nStep ); @@ -144,16 +144,16 @@ void Slider::ImplInitSettings() Window* pParent = GetParent(); if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -164,7 +164,7 @@ void Slider::ImplInitSettings() // ----------------------------------------------------------------------- -void Slider::ImplUpdateRects( BOOL bUpdate ) +void Slider::ImplUpdateRects( sal_Bool bUpdate ) { Rectangle aOldThumbRect = maThumbRect; bool bInvalidateAll = false; @@ -302,9 +302,9 @@ long Slider::ImplCalcThumbPosPix( long nPos ) // ----------------------------------------------------------------------- -void Slider::ImplCalc( BOOL bUpdate ) +void Slider::ImplCalc( sal_Bool bUpdate ) { - BOOL bInvalidateAll = FALSE; + sal_Bool bInvalidateAll = sal_False; if ( mbCalcSize ) { @@ -355,9 +355,9 @@ void Slider::ImplCalc( BOOL bUpdate ) (nOldChannelPixRange != mnChannelPixRange) || (nOldChannelPixTop != mnChannelPixTop) || (nOldChannelPixBottom != mnChannelPixBottom) ) - bInvalidateAll = TRUE; + bInvalidateAll = sal_True; - mbCalcSize = FALSE; + mbCalcSize = sal_False; } if ( mnThumbPixRange ) @@ -366,23 +366,23 @@ void Slider::ImplCalc( BOOL bUpdate ) if ( bUpdate && bInvalidateAll ) { Invalidate(); - bUpdate = FALSE; + bUpdate = sal_False; } ImplUpdateRects( bUpdate ); } // ----------------------------------------------------------------------- -void Slider::ImplDraw( USHORT nDrawFlags ) +void Slider::ImplDraw( sal_uInt16 nDrawFlags ) { DecorationView aDecoView( this ); - USHORT nStyle; + sal_uInt16 nStyle; const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - BOOL bEnabled = IsEnabled(); + sal_Bool bEnabled = IsEnabled(); // Evt. noch offene Berechnungen nachholen if ( mbCalcSize ) - ImplCalc( FALSE ); + ImplCalc( sal_False ); ControlPart nPart = (GetStyle() & WB_HORZ) ? PART_TRACK_HORZ_AREA : PART_TRACK_VERT_AREA; ControlState nState = ( IsEnabled() ? CTRL_STATE_ENABLED : 0 ) | ( HasFocus() ? CTRL_STATE_FOCUSED : 0 ); @@ -513,7 +513,7 @@ void Slider::ImplDraw( USHORT nDrawFlags ) // ----------------------------------------------------------------------- -BOOL Slider::ImplIsPageUp( const Point& rPos ) +sal_Bool Slider::ImplIsPageUp( const Point& rPos ) { Size aSize = GetOutputSizePixel(); Rectangle aRect = maChannel1Rect; @@ -532,7 +532,7 @@ BOOL Slider::ImplIsPageUp( const Point& rPos ) // ----------------------------------------------------------------------- -BOOL Slider::ImplIsPageDown( const Point& rPos ) +sal_Bool Slider::ImplIsPageDown( const Point& rPos ) { Size aSize = GetOutputSizePixel(); Rectangle aRect = maChannel2Rect; @@ -551,7 +551,7 @@ BOOL Slider::ImplIsPageDown( const Point& rPos ) // ----------------------------------------------------------------------- -long Slider::ImplSlide( long nNewPos, BOOL bCallEndSlide ) +long Slider::ImplSlide( long nNewPos, sal_Bool bCallEndSlide ) { long nOldPos = mnThumbPos; SetThumbPos( nNewPos ); @@ -569,7 +569,7 @@ long Slider::ImplSlide( long nNewPos, BOOL bCallEndSlide ) // ----------------------------------------------------------------------- -long Slider::ImplDoAction( BOOL bCallEndSlide ) +long Slider::ImplDoAction( sal_Bool bCallEndSlide ) { long nDelta = 0; @@ -603,10 +603,10 @@ long Slider::ImplDoAction( BOOL bCallEndSlide ) // ----------------------------------------------------------------------- -void Slider::ImplDoMouseAction( const Point& rMousePos, BOOL bCallAction ) +void Slider::ImplDoMouseAction( const Point& rMousePos, sal_Bool bCallAction ) { - USHORT nOldStateFlags = mnStateFlags; - BOOL bAction = FALSE; + sal_uInt16 nOldStateFlags = mnStateFlags; + sal_Bool bAction = sal_False; switch ( meScrollType ) { @@ -649,7 +649,7 @@ void Slider::ImplDoMouseAction( const Point& rMousePos, BOOL bCallAction ) if ( bAction ) { - if ( ImplDoAction( FALSE ) ) + if ( ImplDoAction( sal_False ) ) { // Update the channel complete if ( mnDragDraw & SLIDER_DRAW_CHANNEL ) @@ -671,7 +671,7 @@ long Slider::ImplDoSlide( long nNewPos ) return 0; meScrollType = SCROLL_DRAG; - long nDelta = ImplSlide( nNewPos, TRUE ); + long nDelta = ImplSlide( nNewPos, sal_True ); meScrollType = SCROLL_DONTKNOW; return nDelta; } @@ -686,7 +686,7 @@ long Slider::ImplDoSlideAction( ScrollType eScrollType ) return 0; meScrollType = eScrollType; - long nDelta = ImplDoAction( TRUE ); + long nDelta = ImplDoAction( sal_True ); meScrollType = SCROLL_DONTKNOW; return nDelta; } @@ -698,7 +698,7 @@ void Slider::MouseButtonDown( const MouseEvent& rMEvt ) if ( rMEvt.IsLeft() ) { const Point& rMousePos = rMEvt.GetPosPixel(); - USHORT nTrackFlags = 0; + sal_uInt16 nTrackFlags = 0; if ( maThumbRect.IsInside( rMousePos ) ) { @@ -712,13 +712,6 @@ void Slider::MouseButtonDown( const MouseEvent& rMEvt ) mnMouseOff = rMousePos.X()-aCenterPos.X(); else mnMouseOff = rMousePos.Y()-aCenterPos.Y(); - - // Im OS2-Look geben wir den Thumb gedrueckt aus - if ( GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_OS2STYLE ) - { - mnStateFlags |= SLIDER_STATE_THUMB_DOWN; - ImplDraw( SLIDER_DRAW_THUMB ); - } } else if ( ImplIsPageUp( rMousePos ) ) { @@ -766,7 +759,7 @@ void Slider::MouseButtonUp( const MouseEvent& ) if( SCROLL_SET == meScrollType ) { // Button und PageRect-Status wieder herstellen - const USHORT nOldStateFlags = mnStateFlags; + const sal_uInt16 nOldStateFlags = mnStateFlags; mnStateFlags &= ~( SLIDER_STATE_CHANNEL1_DOWN | SLIDER_STATE_CHANNEL2_DOWN | SLIDER_STATE_THUMB_DOWN ); @@ -774,7 +767,7 @@ void Slider::MouseButtonUp( const MouseEvent& ) ImplDraw( mnDragDraw ); mnDragDraw = 0; - ImplDoAction( TRUE ); + ImplDoAction( sal_True ); meScrollType = SCROLL_DONTKNOW; } } @@ -786,7 +779,7 @@ void Slider::Tracking( const TrackingEvent& rTEvt ) if ( rTEvt.IsTrackingEnded() ) { // Button und PageRect-Status wieder herstellen - USHORT nOldStateFlags = mnStateFlags; + sal_uInt16 nOldStateFlags = mnStateFlags; mnStateFlags &= ~(SLIDER_STATE_CHANNEL1_DOWN | SLIDER_STATE_CHANNEL2_DOWN | SLIDER_STATE_THUMB_DOWN); if ( nOldStateFlags != mnStateFlags ) @@ -923,9 +916,9 @@ void Slider::Paint( const Rectangle& ) void Slider::Resize() { Control::Resize(); - mbCalcSize = TRUE; + mbCalcSize = sal_True; if ( IsReallyVisible() ) - ImplCalc( FALSE ); + ImplCalc( sal_False ); Invalidate(); } @@ -943,17 +936,17 @@ void Slider::StateChanged( StateChangedType nType ) Control::StateChanged( nType ); if ( nType == STATE_CHANGE_INITSHOW ) - ImplCalc( FALSE ); + ImplCalc( sal_False ); else if ( nType == STATE_CHANGE_DATA ) { if ( IsReallyVisible() && IsUpdateMode() ) - ImplCalc( TRUE ); + ImplCalc( sal_True ); } else if ( nType == STATE_CHANGE_UPDATEMODE ) { if ( IsReallyVisible() && IsUpdateMode() ) { - ImplCalc( FALSE ); + ImplCalc( sal_False ); Invalidate(); } } @@ -969,8 +962,8 @@ void Slider::StateChanged( StateChangedType nType ) if ( (GetPrevStyle() & SLIDER_VIEW_STYLE) != (GetStyle() & SLIDER_VIEW_STYLE) ) { - mbCalcSize = TRUE; - ImplCalc( FALSE ); + mbCalcSize = sal_True; + ImplCalc( sal_False ); Invalidate(); } } diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx index 21938dfad0e5..50265e911f80 100644 --- a/vcl/source/control/spinbtn.cxx +++ b/vcl/source/control/spinbtn.cxx @@ -37,10 +37,10 @@ void SpinButton::ImplInit( Window* pParent, WinBits nStyle ) { - mbUpperIn = FALSE; - mbLowerIn = FALSE; - mbInitialUp = FALSE; - mbInitialDown = FALSE; + mbUpperIn = sal_False; + mbLowerIn = sal_False; + mbInitialUp = sal_False; + mbInitialDown = sal_False; mnMinRange = 0; mnMaxRange = 100; @@ -53,9 +53,9 @@ void SpinButton::ImplInit( Window* pParent, WinBits nStyle ) mbRepeat = 0 != ( nStyle & WB_REPEAT ); if ( nStyle & WB_HSCROLL ) - mbHorz = TRUE; + mbHorz = sal_True; else - mbHorz = FALSE; + mbHorz = sal_False; Control::ImplInit( pParent, nStyle, NULL ); } @@ -64,7 +64,7 @@ void SpinButton::ImplInit( Window* pParent, WinBits nStyle ) SpinButton::SpinButton( Window* pParent, WinBits nStyle ) :Control( WINDOW_SPINBUTTON ) - ,mbUpperIsFocused( FALSE ) + ,mbUpperIsFocused( sal_False ) { ImplInit( pParent, nStyle ); } @@ -73,7 +73,7 @@ SpinButton::SpinButton( Window* pParent, WinBits nStyle ) SpinButton::SpinButton( Window* pParent, const ResId& rResId ) :Control( WINDOW_SPINBUTTON ) - ,mbUpperIsFocused( FALSE ) + ,mbUpperIsFocused( sal_False ) { rResId.SetRT( RSC_SPINBUTTON ); ImplInit( pParent, ImplInitRes( rResId ) ); @@ -116,7 +116,7 @@ void SpinButton::Up() mnValue += mnValueStep; StateChanged( STATE_CHANGE_DATA ); - ImplMoveFocus( TRUE ); + ImplMoveFocus( sal_True ); } ImplCallEventListenersAndHandler( VCLEVENT_SPINBUTTON_UP, maUpHdlLink, this ); @@ -131,7 +131,7 @@ void SpinButton::Down() mnValue -= mnValueStep; StateChanged( STATE_CHANGE_DATA ); - ImplMoveFocus( FALSE ); + ImplMoveFocus( sal_False ); } ImplCallEventListenersAndHandler( VCLEVENT_SPINBUTTON_DOWN, maDownHdlLink, this ); @@ -164,7 +164,7 @@ void SpinButton::Resize() // ----------------------------------------------------------------------- -void SpinButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ) +void SpinButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -201,9 +201,9 @@ void SpinButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, aUpperRect += aPos; aLowerRect += aPos; - ImplDrawSpinButton( pDev, aUpperRect, aLowerRect, FALSE, FALSE, + ImplDrawSpinButton( pDev, aUpperRect, aLowerRect, sal_False, sal_False, IsEnabled() && ImplIsUpperEnabled(), - IsEnabled() && ImplIsLowerEnabled(), mbHorz, TRUE ); + IsEnabled() && ImplIsLowerEnabled(), mbHorz, sal_True ); pDev->Pop(); } @@ -212,10 +212,10 @@ void SpinButton::Paint( const Rectangle& ) { HideFocus(); - BOOL bEnable = IsEnabled(); + sal_Bool bEnable = IsEnabled(); ImplDrawSpinButton( this, maUpperRect, maLowerRect, mbUpperIn, mbLowerIn, bEnable && ImplIsUpperEnabled(), - bEnable && ImplIsLowerEnabled(), mbHorz, TRUE ); + bEnable && ImplIsLowerEnabled(), mbHorz, sal_True ); if ( HasFocus() ) ShowFocus( maFocusRect ); @@ -227,14 +227,14 @@ void SpinButton::MouseButtonDown( const MouseEvent& rMEvt ) { if ( maUpperRect.IsInside( rMEvt.GetPosPixel() ) && ( ImplIsUpperEnabled() ) ) { - mbUpperIn = TRUE; - mbInitialUp = TRUE; + mbUpperIn = sal_True; + mbInitialUp = sal_True; Invalidate( maUpperRect ); } else if ( maLowerRect.IsInside( rMEvt.GetPosPixel() ) && ( ImplIsLowerEnabled() ) ) { - mbLowerIn = TRUE; - mbInitialDown = TRUE; + mbLowerIn = sal_True; + mbInitialDown = sal_True; Invalidate( maLowerRect ); } @@ -260,20 +260,20 @@ void SpinButton::MouseButtonUp( const MouseEvent& ) if ( mbUpperIn ) { - mbUpperIn = FALSE; + mbUpperIn = sal_False; Invalidate( maUpperRect ); Update(); Up(); } else if ( mbLowerIn ) { - mbLowerIn = FALSE; + mbLowerIn = sal_False; Invalidate( maLowerRect ); Update(); Down(); } - mbInitialUp = mbInitialDown = FALSE; + mbInitialUp = mbInitialDown = sal_False; } // ----------------------------------------------------------------------- @@ -286,7 +286,7 @@ void SpinButton::MouseMove( const MouseEvent& rMEvt ) if ( !maUpperRect.IsInside( rMEvt.GetPosPixel() ) && mbUpperIn && mbInitialUp ) { - mbUpperIn = FALSE; + mbUpperIn = sal_False; maRepeatTimer.Stop(); Invalidate( maUpperRect ); Update(); @@ -294,7 +294,7 @@ void SpinButton::MouseMove( const MouseEvent& rMEvt ) else if ( !maLowerRect.IsInside( rMEvt.GetPosPixel() ) && mbLowerIn & mbInitialDown ) { - mbLowerIn = FALSE; + mbLowerIn = sal_False; maRepeatTimer.Stop(); Invalidate( maLowerRect ); Update(); @@ -302,7 +302,7 @@ void SpinButton::MouseMove( const MouseEvent& rMEvt ) else if ( maUpperRect.IsInside( rMEvt.GetPosPixel() ) && !mbUpperIn && mbInitialUp ) { - mbUpperIn = TRUE; + mbUpperIn = sal_True; if ( mbRepeat ) maRepeatTimer.Start(); Invalidate( maUpperRect ); @@ -311,7 +311,7 @@ void SpinButton::MouseMove( const MouseEvent& rMEvt ) else if ( maLowerRect.IsInside( rMEvt.GetPosPixel() ) && !mbLowerIn && mbInitialDown ) { - mbLowerIn = TRUE; + mbLowerIn = sal_True; if ( mbRepeat ) maRepeatTimer.Start(); Invalidate( maLowerRect ); @@ -330,7 +330,7 @@ void SpinButton::KeyInput( const KeyEvent& rKEvt ) case KEY_LEFT: case KEY_RIGHT: { - BOOL bUp = KEY_RIGHT == rKEvt.GetKeyCode().GetCode(); + sal_Bool bUp = KEY_RIGHT == rKEvt.GetKeyCode().GetCode(); if ( mbHorz && !ImplMoveFocus( bUp ) ) bUp ? Up() : Down(); } @@ -339,7 +339,7 @@ void SpinButton::KeyInput( const KeyEvent& rKEvt ) case KEY_UP: case KEY_DOWN: { - BOOL bUp = KEY_UP == rKEvt.GetKeyCode().GetCode(); + sal_Bool bUp = KEY_UP == rKEvt.GetKeyCode().GetCode(); if ( !mbHorz && !ImplMoveFocus( KEY_UP == rKEvt.GetKeyCode().GetCode() ) ) bUp ? Up() : Down(); } @@ -371,7 +371,7 @@ void SpinButton::StateChanged( StateChangedType nType ) case STATE_CHANGE_STYLE: { - BOOL bNewRepeat = 0 != ( GetStyle() & WB_REPEAT ); + sal_Bool bNewRepeat = 0 != ( GetStyle() & WB_REPEAT ); if ( bNewRepeat != mbRepeat ) { if ( maRepeatTimer.IsActive() ) @@ -382,7 +382,7 @@ void SpinButton::StateChanged( StateChangedType nType ) mbRepeat = bNewRepeat; } - BOOL bNewHorz = 0 != ( GetStyle() & WB_HSCROLL ); + sal_Bool bNewHorz = 0 != ( GetStyle() & WB_HSCROLL ); if ( bNewHorz != mbHorz ) { mbHorz = bNewHorz; @@ -471,21 +471,21 @@ void SpinButton::LoseFocus() // ----------------------------------------------------------------------- -BOOL SpinButton::ImplMoveFocus( BOOL _bUpper ) +sal_Bool SpinButton::ImplMoveFocus( sal_Bool _bUpper ) { if ( _bUpper == mbUpperIsFocused ) - return FALSE; + return sal_False; HideFocus(); ImplCalcFocusRect( _bUpper ); if ( HasFocus() ) ShowFocus( maFocusRect ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -void SpinButton::ImplCalcFocusRect( BOOL _bUpper ) +void SpinButton::ImplCalcFocusRect( sal_Bool _bUpper ) { maFocusRect = _bUpper ? maUpperRect : maLowerRect; // inflate by some pixels diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 1124819af8ab..f9215ab90835 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -41,8 +41,8 @@ void ImplGetSpinbuttonValue( Window *pWin, const Rectangle& rUpperRect, const Rectangle& rLowerRect, - BOOL bUpperIn, BOOL bLowerIn, - BOOL bUpperEnabled, BOOL bLowerEnabled, BOOL bHorz, + sal_Bool bUpperIn, sal_Bool bLowerIn, + sal_Bool bUpperEnabled, sal_Bool bLowerEnabled, sal_Bool bHorz, SpinbuttonValue& rValue ) { // convert spinbutton data to a SpinbuttonValue structure for native painting @@ -81,9 +81,9 @@ void ImplGetSpinbuttonValue( Window *pWin, const Rectangle& rUpperRect, } -BOOL ImplDrawNativeSpinfield( Window *pWin, const SpinbuttonValue& rSpinbuttonValue ) +sal_Bool ImplDrawNativeSpinfield( Window *pWin, const SpinbuttonValue& rSpinbuttonValue ) { - BOOL bNativeOK = FALSE; + sal_Bool bNativeOK = sal_False; if( pWin->IsNativeControlSupported(CTRL_SPINBOX, PART_ENTIRE_CONTROL) && // there is just no useful native support for spinfields with dropdown @@ -132,9 +132,9 @@ BOOL ImplDrawNativeSpinfield( Window *pWin, const SpinbuttonValue& rSpinbuttonVa return bNativeOK; } -BOOL ImplDrawNativeSpinbuttons( Window *pWin, const SpinbuttonValue& rSpinbuttonValue ) +sal_Bool ImplDrawNativeSpinbuttons( Window *pWin, const SpinbuttonValue& rSpinbuttonValue ) { - BOOL bNativeOK = FALSE; + sal_Bool bNativeOK = sal_False; if( pWin->IsNativeControlSupported(CTRL_SPINBUTTONS, PART_ENTIRE_CONTROL) ) { @@ -148,13 +148,13 @@ BOOL ImplDrawNativeSpinbuttons( Window *pWin, const SpinbuttonValue& rSpinbutton void ImplDrawSpinButton( OutputDevice* pOutDev, const Rectangle& rUpperRect, const Rectangle& rLowerRect, - BOOL bUpperIn, BOOL bLowerIn, - BOOL bUpperEnabled, BOOL bLowerEnabled, BOOL bHorz, BOOL bMirrorHorz ) + sal_Bool bUpperIn, sal_Bool bLowerIn, + sal_Bool bUpperEnabled, sal_Bool bLowerEnabled, sal_Bool bHorz, sal_Bool bMirrorHorz ) { DecorationView aDecoView( pOutDev ); - USHORT nStyle = BUTTON_DRAW_NOLEFTLIGHTBORDER; - USHORT nSymStyle = 0; + sal_uInt16 nStyle = BUTTON_DRAW_NOLEFTLIGHTBORDER; + sal_uInt16 nSymStyle = 0; SymbolType eType1, eType2; @@ -188,11 +188,11 @@ void ImplDrawSpinButton( OutputDevice* pOutDev, } // Oberen/linken Button malen - USHORT nTempStyle = nStyle; + sal_uInt16 nTempStyle = nStyle; if ( bUpperIn ) nTempStyle |= BUTTON_DRAW_PRESSED; - BOOL bNativeOK = FALSE; + sal_Bool bNativeOK = sal_False; Rectangle aUpRect; if( pOutDev->GetOutDevType() == OUTDEV_WINDOW ) @@ -298,14 +298,14 @@ void ImplDrawSpinButton( OutputDevice* pOutDev, void SpinField::ImplInitSpinFieldData() { mpEdit = NULL; - mbSpin = FALSE; - mbRepeat = FALSE; - mbUpperIn = FALSE; - mbLowerIn = FALSE; - mbInitialUp = FALSE; - mbInitialDown = FALSE; - mbNoSelect = FALSE; - mbInDropDown = FALSE; + mbSpin = sal_False; + mbRepeat = sal_False; + mbUpperIn = sal_False; + mbLowerIn = sal_False; + mbInitialUp = sal_False; + mbInitialDown = sal_False; + mbNoSelect = sal_False; + mbInDropDown = sal_False; } // -------------------------------------------------------------------- @@ -316,7 +316,7 @@ void SpinField::ImplInit( Window* pParent, WinBits nWinStyle ) if ( nWinStyle & (WB_SPIN|WB_DROPDOWN) ) { - mbSpin = TRUE; + mbSpin = sal_True; // Some themes want external spin buttons, therefore the main // spinfield should not overdraw the border between its encapsulated @@ -330,7 +330,7 @@ void SpinField::ImplInit( Window* pParent, WinBits nWinStyle ) else mpEdit = new Edit( this, WB_NOBORDER ); - mpEdit->EnableRTL( FALSE ); + mpEdit->EnableRTL( sal_False ); mpEdit->SetPosPixel( Point() ); mpEdit->Show(); SetSubEdit( mpEdit ); @@ -338,9 +338,9 @@ void SpinField::ImplInit( Window* pParent, WinBits nWinStyle ) maRepeatTimer.SetTimeoutHdl( LINK( this, SpinField, ImplTimeout ) ); maRepeatTimer.SetTimeout( GetSettings().GetMouseSettings().GetButtonStartRepeat() ); if ( nWinStyle & WB_REPEAT ) - mbRepeat = TRUE; + mbRepeat = sal_True; - SetCompoundControl( TRUE ); + SetCompoundControl( sal_True ); } } @@ -417,7 +417,7 @@ void SpinField::MouseButtonDown( const MouseEvent& rMEvt ) { if ( !HasFocus() && ( !mpEdit || !mpEdit->HasFocus() ) ) { - mbNoSelect = TRUE; + mbNoSelect = sal_True; GrabFocus(); } @@ -425,20 +425,20 @@ void SpinField::MouseButtonDown( const MouseEvent& rMEvt ) { if ( maUpperRect.IsInside( rMEvt.GetPosPixel() ) ) { - mbUpperIn = TRUE; - mbInitialUp = TRUE; + mbUpperIn = sal_True; + mbInitialUp = sal_True; Invalidate( maUpperRect ); } else if ( maLowerRect.IsInside( rMEvt.GetPosPixel() ) ) { - mbLowerIn = TRUE; - mbInitialDown = TRUE; + mbLowerIn = sal_True; + mbInitialDown = sal_True; Invalidate( maLowerRect ); } else if ( maDropDownRect.IsInside( rMEvt.GetPosPixel() ) ) { // Rechts daneben liegt der DropDownButton: - mbInDropDown = ShowDropDown( mbInDropDown ? FALSE : TRUE ); + mbInDropDown = ShowDropDown( mbInDropDown ? sal_False : sal_True ); Paint( Rectangle( Point(), GetOutputSizePixel() ) ); } @@ -460,20 +460,20 @@ void SpinField::MouseButtonDown( const MouseEvent& rMEvt ) void SpinField::MouseButtonUp( const MouseEvent& rMEvt ) { ReleaseMouse(); - mbInitialUp = mbInitialDown = FALSE; + mbInitialUp = mbInitialDown = sal_False; maRepeatTimer.Stop(); maRepeatTimer.SetTimeout( GetSettings().GetMouseSettings().GetButtonStartRepeat() ); if ( mbUpperIn ) { - mbUpperIn = FALSE; + mbUpperIn = sal_False; Invalidate( maUpperRect ); Update(); Up(); } else if ( mbLowerIn ) { - mbLowerIn = FALSE; + mbLowerIn = sal_False; Invalidate( maLowerRect ); Update(); Down(); @@ -490,7 +490,7 @@ void SpinField::MouseMove( const MouseEvent& rMEvt ) { if ( mbInitialUp ) { - BOOL bNewUpperIn = maUpperRect.IsInside( rMEvt.GetPosPixel() ); + sal_Bool bNewUpperIn = maUpperRect.IsInside( rMEvt.GetPosPixel() ); if ( bNewUpperIn != mbUpperIn ) { if ( bNewUpperIn ) @@ -508,7 +508,7 @@ void SpinField::MouseMove( const MouseEvent& rMEvt ) } else if ( mbInitialDown ) { - BOOL bNewLowerIn = maLowerRect.IsInside( rMEvt.GetPosPixel() ); + sal_Bool bNewLowerIn = maLowerRect.IsInside( rMEvt.GetPosPixel() ); if ( bNewLowerIn != mbLowerIn ) { if ( bNewLowerIn ) @@ -539,7 +539,7 @@ long SpinField::Notify( NotifyEvent& rNEvt ) const KeyEvent& rKEvt = *rNEvt.GetKeyEvent(); if ( !IsReadOnly() ) { - USHORT nMod = rKEvt.GetKeyCode().GetModifier(); + sal_uInt16 nMod = rKEvt.GetKeyCode().GetModifier(); switch ( rKEvt.GetKeyCode().GetCode() ) { case KEY_UP: @@ -560,7 +560,7 @@ long SpinField::Notify( NotifyEvent& rNEvt ) } else if ( ( nMod == KEY_MOD2 ) && !mbInDropDown && ( GetStyle() & WB_DROPDOWN ) ) { - mbInDropDown = ShowDropDown( TRUE ); + mbInDropDown = ShowDropDown( sal_True ); Paint( Rectangle( Point(), GetOutputSizePixel() ) ); nDone = 1; } @@ -592,7 +592,7 @@ long SpinField::Notify( NotifyEvent& rNEvt ) { if ( ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL ) && !IsReadOnly() ) { - USHORT nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() ); + sal_uInt16 nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() ); if ( ( nWheelBehavior == MOUSE_WHEEL_ALWAYS ) || ( ( nWheelBehavior == MOUSE_WHEEL_FOCUS_ONLY ) && HasChildPathFocus() @@ -644,7 +644,7 @@ void SpinField::Paint( const Rectangle& rRect ) { if ( mbSpin ) { - BOOL bEnable = IsEnabled(); + sal_Bool bEnable = IsEnabled(); ImplDrawSpinButton( this, maUpperRect, maLowerRect, mbUpperIn, mbLowerIn, bEnable, bEnable ); } @@ -653,7 +653,7 @@ void SpinField::Paint( const Rectangle& rRect ) { DecorationView aView( this ); - USHORT nStyle = BUTTON_DRAW_NOLIGHTBORDER; + sal_uInt16 nStyle = BUTTON_DRAW_NOLIGHTBORDER; if ( mbInDropDown ) nStyle |= BUTTON_DRAW_PRESSED; Rectangle aInnerRect = aView.DrawButton( maDropDownRect, nStyle ); @@ -700,7 +700,7 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec if ( !(aSize.Height() & 0x01) ) nBottom1--; - BOOL bNativeRegionOK = FALSE; + sal_Bool bNativeRegionOK = sal_False; Rectangle aContentUp, aContentDown; if ( (pDev->GetOutDevType() == OUTDEV_WINDOW) && @@ -839,9 +839,9 @@ void SpinField::StateChanged( StateChangedType nType ) else if ( nType == STATE_CHANGE_STYLE ) { if ( GetStyle() & WB_REPEAT ) - mbRepeat = TRUE; + mbRepeat = sal_True; else - mbRepeat = FALSE; + mbRepeat = sal_False; } else if ( nType == STATE_CHANGE_ZOOM ) { @@ -854,21 +854,21 @@ void SpinField::StateChanged( StateChangedType nType ) { if ( mpEdit ) mpEdit->SetControlFont( GetControlFont() ); - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { if ( mpEdit ) mpEdit->SetControlForeground( GetControlForeground() ); - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { if ( mpEdit ) mpEdit->SetControlBackground( GetControlBackground() ); - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } else if( nType == STATE_CHANGE_MIRRORING ) @@ -959,15 +959,15 @@ long SpinField::PreNotify( NotifyEvent& rNEvt ) void SpinField::EndDropDown() { - mbInDropDown = FALSE; + mbInDropDown = sal_False; Paint( Rectangle( Point(), GetOutputSizePixel() ) ); } // ----------------------------------------------------------------------- -BOOL SpinField::ShowDropDown( BOOL ) +sal_Bool SpinField::ShowDropDown( sal_Bool ) { - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -998,7 +998,7 @@ Size SpinField::GetOptimalSize(WindowSizeType eType) const // ----------------------------------------------------------------------- -Size SpinField::CalcSize( USHORT nChars ) const +Size SpinField::CalcSize( sal_uInt16 nChars ) const { Size aSz = Edit::CalcSize( nChars ); @@ -1031,7 +1031,7 @@ IMPL_LINK( SpinField, ImplTimeout, Timer*, pTimer ) // ----------------------------------------------------------------------- -void SpinField::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ) +void SpinField::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { Edit::Draw( pDev, rPos, rSize, nFlags ); @@ -1072,7 +1072,7 @@ void SpinField::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, if ( GetStyle() & WB_DROPDOWN ) { DecorationView aView( pDev ); - USHORT nStyle = BUTTON_DRAW_NOLIGHTBORDER; + sal_uInt16 nStyle = BUTTON_DRAW_NOLIGHTBORDER; Rectangle aInnerRect = aView.DrawButton( aDD, nStyle ); SymbolType eSymbol = SYMBOL_SPIN_DOWN; if ( GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_SPINUPDOWN ) @@ -1084,7 +1084,7 @@ void SpinField::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, if ( GetStyle() & WB_SPIN ) { - ImplDrawSpinButton( pDev, aUp, aDown, FALSE, FALSE, TRUE, TRUE ); + ImplDrawSpinButton( pDev, aUp, aDown, sal_False, sal_False, sal_True, sal_True ); } pDev->Pop(); diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 5658d39cd3eb..bb60e7e5eea9 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -43,7 +43,6 @@ #include "vcl/controldata.hxx" #include "vcl/sound.hxx" #include "vcl/lstbox.hxx" -#include "vcl/smartid.hxx" #include "vcl/window.h" @@ -54,22 +53,22 @@ struct ImplTabItem { - USHORT mnId; - USHORT mnTabPageResId; + sal_uInt16 mnId; + sal_uInt16 mnTabPageResId; TabPage* mpTabPage; String maText; String maFormatText; String maHelpText; - ULONG mnHelpId; + rtl::OString maHelpId; Rectangle maRect; - USHORT mnLine; + sal_uInt16 mnLine; bool mbFullVisible; bool mbEnabled; Image maTabImage; ImplTabItem() - : mnId( 0 ), mnTabPageResId( 0 ), mpTabPage( NULL ), mnHelpId( 0 ), - mnLine( 0 ), mbFullVisible( FALSE ), mbEnabled( true ) + : mnId( 0 ), mnTabPageResId( 0 ), mpTabPage( NULL ), + mnLine( 0 ), mbFullVisible( sal_False ), mbEnabled( true ) {} }; @@ -77,8 +76,6 @@ struct ImplTabItem struct ImplTabCtrlData { - PushButton* mpLeftBtn; - PushButton* mpRightBtn; boost::unordered_map< int, int > maLayoutPageIdToLine; boost::unordered_map< int, int > maLayoutLineToPageId; std::vector< Rectangle > maTabRectangles; @@ -113,9 +110,6 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle ) if ( !(nStyle & WB_NODIALOGCONTROL) ) nStyle |= WB_DIALOGCONTROL; - // no single line tabs since NWF - nStyle &= ~WB_SINGLELINE; - Control::ImplInit( pParent, nStyle, NULL ); mnLastWidth = 0; @@ -124,23 +118,16 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle ) mnMaxPageWidth = 0; mnActPageId = 0; mnCurPageId = 0; - mnFirstPagePos = 0; - mnLastFirstPagePos = 0; - mbFormat = TRUE; - mbRestoreHelpId = FALSE; - mbRestoreUnqId = FALSE; - mbSingleLine = FALSE; - mbScroll = FALSE; - mbRestoreSmartId = FALSE; - mbSmallInvalidate = FALSE; - mbExtraSpace = FALSE; + mbFormat = sal_True; + mbRestoreHelpId = sal_False; + mbRestoreUnqId = sal_False; + mbSmallInvalidate = sal_False; + mbExtraSpace = sal_False; mpTabCtrlData = new ImplTabCtrlData; - mpTabCtrlData->mpLeftBtn = NULL; - mpTabCtrlData->mpRightBtn = NULL; mpTabCtrlData->mpListBox = NULL; - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); if( (nStyle & WB_DROPDOWN) ) { @@ -153,7 +140,7 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle ) // if the tabcontrol is drawn (ie filled) by a native widget, make sure all contols will have transparent background // otherwise they will paint with a wrong background if( IsNativeControlSupported(CTRL_TAB_PANE, PART_ENTIRE_CONTROL) ) - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); if ( pParent->IsDialog() ) pParent->AddChildEventListener( LINK( this, TabControl, ImplWindowEventListener ) ); @@ -186,8 +173,8 @@ WinBits TabControl::ImplInitStyle( WinBits nStyle ) // ----------------------------------------------------------------------- -void TabControl::ImplInitSettings( BOOL bFont, - BOOL bForeground, BOOL bBackground ) +void TabControl::ImplInitSettings( sal_Bool bFont, + sal_Bool bForeground, sal_Bool bBackground ) { Control::ImplInitSettings( bFont, bForeground ); @@ -202,17 +189,17 @@ void TabControl::ImplInitSettings( BOOL bFont, { // set transparent mode for NWF tabcontrols to have // the background always cleared properly - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); ImplGetWindowImpl()->mbUseNativeFocus = ImplGetSVData()->maNWFData.mbNoFocusRects; } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -220,8 +207,6 @@ void TabControl::ImplInitSettings( BOOL bFont, SetBackground( pParent->GetBackground() ); } } - - ImplScrollBtnsColor(); } // ----------------------------------------------------------------------- @@ -265,14 +250,14 @@ void TabControl::ImplLoadRes( const ResId& rResId ) { Control::ImplLoadRes( rResId ); - ULONG nObjMask = ReadLongRes(); + sal_uLong nObjMask = ReadLongRes(); if ( nObjMask & RSC_TABCONTROL_ITEMLIST ) { - ULONG nEle = ReadLongRes(); + sal_uLong nEle = ReadLongRes(); // Item hinzufuegen - for( ULONG i = 0; i < nEle; i++ ) + for( sal_uLong i = 0; i < nEle; i++ ) { InsertPage( ResId( (RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr() ) ); IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) ); @@ -294,17 +279,13 @@ TabControl::~TabControl() { if( mpTabCtrlData->mpListBox ) delete mpTabCtrlData->mpListBox; - if ( mpTabCtrlData->mpLeftBtn ) - delete mpTabCtrlData->mpLeftBtn; - if ( mpTabCtrlData->mpRightBtn ) - delete mpTabCtrlData->mpRightBtn; delete mpTabCtrlData; } } // ----------------------------------------------------------------------- -ImplTabItem* TabControl::ImplGetItem( USHORT nId ) const +ImplTabItem* TabControl::ImplGetItem( sal_uInt16 nId ) const { for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); it != mpTabCtrlData->maItemList.end(); ++it ) @@ -318,74 +299,6 @@ ImplTabItem* TabControl::ImplGetItem( USHORT nId ) const // ----------------------------------------------------------------------- -void TabControl::ImplScrollBtnsColor() -{ - if ( mpTabCtrlData && mpTabCtrlData->mpLeftBtn ) - { - mpTabCtrlData->mpLeftBtn->SetControlForeground(); - mpTabCtrlData->mpRightBtn->SetControlForeground(); - } -} - -// ----------------------------------------------------------------------- - -void TabControl::ImplSetScrollBtnsState() -{ - if ( mbScroll ) - { - mpTabCtrlData->mpLeftBtn->Enable( mnFirstPagePos != 0 ); - mpTabCtrlData->mpRightBtn->Enable( mnFirstPagePos < mnLastFirstPagePos ); - } -} - -// ----------------------------------------------------------------------- - -void TabControl::ImplPosScrollBtns() -{ - if ( mbScroll ) - { - if ( !mpTabCtrlData->mpLeftBtn ) - { - mpTabCtrlData->mpLeftBtn = new PushButton( this, WB_RECTSTYLE | WB_SMALLSTYLE | WB_NOPOINTERFOCUS | WB_REPEAT ); - mpTabCtrlData->mpLeftBtn->SetSymbol( SYMBOL_PREV ); - mpTabCtrlData->mpLeftBtn->SetClickHdl( LINK( this, TabControl, ImplScrollBtnHdl ) ); - } - if ( !mpTabCtrlData->mpRightBtn ) - { - mpTabCtrlData->mpRightBtn = new PushButton( this, WB_RECTSTYLE | WB_SMALLSTYLE | WB_NOPOINTERFOCUS | WB_REPEAT ); - mpTabCtrlData->mpRightBtn->SetSymbol( SYMBOL_NEXT ); - mpTabCtrlData->mpRightBtn->SetClickHdl( LINK( this, TabControl, ImplScrollBtnHdl ) ); - } - - Rectangle aRect = ImplGetTabRect( TAB_PAGERECT ); - aRect.Left() -= TAB_OFFSET; - aRect.Top() -= TAB_OFFSET; - aRect.Right() += TAB_OFFSET; - aRect.Bottom() += TAB_OFFSET; - long nX = aRect.Right()-mnBtnSize+1; - long nY = aRect.Top()-mnBtnSize; - mpTabCtrlData->mpRightBtn->SetPosSizePixel( nX, nY, mnBtnSize, mnBtnSize ); - nX -= mnBtnSize; - mpTabCtrlData->mpLeftBtn->SetPosSizePixel( nX, nY, mnBtnSize, mnBtnSize ); - ImplScrollBtnsColor(); - ImplSetScrollBtnsState(); - mpTabCtrlData->mpLeftBtn->Show(); - mpTabCtrlData->mpRightBtn->Show(); - } - else - { - if ( mpTabCtrlData ) - { - if ( mpTabCtrlData->mpLeftBtn ) - mpTabCtrlData->mpLeftBtn->Hide(); - if ( mpTabCtrlData->mpRightBtn ) - mpTabCtrlData->mpRightBtn->Hide(); - } - } -} - -// ----------------------------------------------------------------------- - Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) { pItem->maFormatText = pItem->maText; @@ -453,7 +366,7 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) // ----------------------------------------------------------------------- -Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight ) +Rectangle TabControl::ImplGetTabRect( sal_uInt16 nItemPos, long nWidth, long nHeight ) { Size aWinSize = Control::GetOutputSizePixel(); if ( nWidth < 0 ) @@ -472,7 +385,7 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight if ( nItemPos == TAB_PAGERECT ) { - USHORT nLastPos; + sal_uInt16 nLastPos; if ( mnCurPageId ) nLastPos = GetPagePos( mnCurPageId ); else @@ -496,9 +409,9 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight { Font aFont( GetFont() ); Font aLightFont = aFont; - aFont.SetTransparent( TRUE ); + aFont.SetTransparent( sal_True ); aFont.SetWeight( (!ImplGetSVData()->maNWFData.mbNoBoldTabFocus) ? WEIGHT_BOLD : WEIGHT_LIGHT ); - aLightFont.SetTransparent( TRUE ); + aLightFont.SetTransparent( sal_True ); aLightFont.SetWeight( WEIGHT_LIGHT ); // If Bold and none Bold strings have the same width, we @@ -518,18 +431,16 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight long nX = nOffsetX; long nY = nOffsetY; long nMaxWidth = nWidth; - USHORT nPos = 0; + sal_uInt16 nPos = 0; if ( (mnMaxPageWidth > 0) && (mnMaxPageWidth < nMaxWidth) ) nMaxWidth = mnMaxPageWidth; nMaxWidth -= GetItemsOffset().X(); - mbScroll = FALSE; - - USHORT nLines = 0; - USHORT nCurLine = 0; + sal_uInt16 nLines = 0; + sal_uInt16 nCurLine = 0; long nLineWidthAry[100]; - USHORT nLinePosAry[101]; + sal_uInt16 nLinePosAry[101]; nLineWidthAry[0] = 0; nLinePosAry[0] = 0; @@ -552,10 +463,10 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight Rectangle aNewRect( Point( nX, nY ), aSize ); if ( mbSmallInvalidate && (it->maRect != aNewRect) ) - mbSmallInvalidate = FALSE; + mbSmallInvalidate = sal_False; it->maRect = aNewRect; it->mnLine = nLines; - it->mbFullVisible = TRUE; + it->mbFullVisible = sal_True; nLineWidthAry[nLines] += aSize.Width(); nX += aSize.Width(); @@ -571,8 +482,8 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight long nDX = 0; long nModDX = 0; long nIDX = 0; - USHORT i; - USHORT n; + sal_uInt16 i; + sal_uInt16 n; long nLineHeightAry[100]; long nIH = mpTabCtrlData->maItemList[0].maRect.Bottom()-2; @@ -588,7 +499,7 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight i = 0; n = 0; - nLinePosAry[nLines+1] = (USHORT)mpTabCtrlData->maItemList.size(); + nLinePosAry[nLines+1] = (sal_uInt16)mpTabCtrlData->maItemList.size(); for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); it != mpTabCtrlData->maItemList.end(); ++it ) { @@ -649,9 +560,7 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight mnLastWidth = nWidth; mnLastHeight = nHeight; - mbFormat = FALSE; - - ImplPosScrollBtns(); + mbFormat = sal_False; } return size_t(nItemPos) < mpTabCtrlData->maItemList.size() ? mpTabCtrlData->maItemList[nItemPos].maRect : Rectangle(); @@ -659,7 +568,7 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight // ----------------------------------------------------------------------- -void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId ) +void TabControl::ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId ) { ImplFreeLayoutData(); @@ -671,7 +580,7 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId ) if ( IsReallyVisible() && IsUpdateMode() ) { - USHORT nPos = GetPagePos( nId ); + sal_uInt16 nPos = GetPagePos( nId ); Rectangle aRect = ImplGetTabRect( nPos ); if ( !pOldItem || (pOldItem->mnLine != pItem->mnLine) ) @@ -703,11 +612,9 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId ) if ( pOldPage ) { if ( mbRestoreHelpId ) - pCtrlParent->SetHelpId( 0 ); + pCtrlParent->SetHelpId( rtl::OString() ); if ( mbRestoreUnqId ) - pCtrlParent->SetUniqueId( 0 ); - if( mbRestoreSmartId ) - pCtrlParent->SetSmartHelpId( SmartId() ); + pCtrlParent->SetUniqueId( rtl::OString() ); pOldPage->DeactivatePage(); } @@ -723,27 +630,22 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId ) // activate page here so the conbtrols can be switched // also set the help id of the parent window to that of the tab page - if ( !GetHelpId() ) + if ( !GetHelpId().getLength() ) { - mbRestoreHelpId = TRUE; + mbRestoreHelpId = sal_True; pCtrlParent->SetHelpId( pPage->GetHelpId() ); } - if ( !pCtrlParent->GetUniqueId() ) + if ( !pCtrlParent->GetUniqueId().getLength() ) { - mbRestoreUnqId = TRUE; + mbRestoreUnqId = sal_True; pCtrlParent->SetUniqueId( pPage->GetUniqueId() ); } - if( ! GetSmartHelpId().HasAny() ) - { - mbRestoreSmartId = TRUE; - pCtrlParent->SetSmartHelpId( pPage->GetSmartHelpId() ); - } pPage->ActivatePage(); if ( pOldPage && pOldPage->HasChildPathFocus() ) { - USHORT n = 0; + sal_uInt16 n = 0; Window* pFirstChild = pPage->ImplGetDlgWindow( n, DLGWINDOW_FIRST ); if ( pFirstChild ) pFirstChild->ImplControlFocus( GETFOCUS_INIT ); @@ -773,7 +675,7 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId ) // ----------------------------------------------------------------------- -BOOL TabControl::ImplPosCurTabPage() +sal_Bool TabControl::ImplPosCurTabPage() { // Aktuelle TabPage resizen/positionieren ImplTabItem* pItem = ImplGetItem( GetCurPageId() ); @@ -783,21 +685,21 @@ BOOL TabControl::ImplPosCurTabPage() { Rectangle aRectNoTab( (const Point&)Point( 0, 0 ), GetSizePixel() ); pItem->mpTabPage->SetPosSizePixel( aRectNoTab.TopLeft(), aRectNoTab.GetSize() ); - return TRUE; + return sal_True; } Rectangle aRect = ImplGetTabRect( TAB_PAGERECT ); pItem->mpTabPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void TabControl::ImplActivateTabPage( BOOL bNext ) +void TabControl::ImplActivateTabPage( sal_Bool bNext ) { - USHORT nCurPos = GetPagePos( GetCurPageId() ); + sal_uInt16 nCurPos = GetPagePos( GetCurPageId() ); if ( bNext ) nCurPos = (nCurPos + 1) % GetPageCount(); @@ -814,13 +716,6 @@ void TabControl::ImplActivateTabPage( BOOL bNext ) // ----------------------------------------------------------------------- -void TabControl::ImplSetFirstPagePos( USHORT ) -{ - return; // was only required for single line -} - -// ----------------------------------------------------------------------- - void TabControl::ImplShowFocus() { if ( !GetPageCount() || mpTabCtrlData->mpListBox ) @@ -834,14 +729,14 @@ void TabControl::ImplShowFocus() aFont.SetWeight( (!ImplGetSVData()->maNWFData.mbNoBoldTabFocus) ? WEIGHT_BOLD : WEIGHT_LIGHT ); SetFont( aFont ); - USHORT nCurPos = GetPagePos( mnCurPageId ); + sal_uInt16 nCurPos = GetPagePos( mnCurPageId ); Rectangle aRect = ImplGetTabRect( nCurPos ); const ImplTabItem& rItem = mpTabCtrlData->maItemList[ nCurPos ]; Size aTabSize = aRect.GetSize(); Size aImageSize( 0, 0 ); long nTextHeight = GetTextHeight(); long nTextWidth = GetCtrlTextWidth( rItem.maFormatText ); - USHORT nOff; + sal_uInt16 nOff; if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_MONO) ) nOff = 1; @@ -903,13 +798,13 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo Rectangle aRect = pItem->maRect; long nLeftBottom = aRect.Bottom(); long nRightBottom = aRect.Bottom(); - BOOL bLeftBorder = TRUE; - BOOL bRightBorder = TRUE; - USHORT nOff; - BOOL bNativeOK = FALSE; + sal_Bool bLeftBorder = sal_True; + sal_Bool bRightBorder = sal_True; + sal_uInt16 nOff; + sal_Bool bNativeOK = sal_False; - USHORT nOff2 = 0; - USHORT nOff3 = 0; + sal_uInt16 nOff2 = 0; + sal_uInt16 nOff3 = 0; if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ) nOff = 1; @@ -931,10 +826,10 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo { aLeftTestPos.X() -= 2; if ( rCurRect.IsInside( aLeftTestPos ) ) - bLeftBorder = FALSE; + bLeftBorder = sal_False; aRightTestPos.X() += 2; if ( rCurRect.IsInside( aRightTestPos ) ) - bRightBorder = FALSE; + bRightBorder = sal_False; } else { @@ -945,7 +840,7 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo } } - if( !bLayout && (bNativeOK = IsNativeControlSupported(CTRL_TAB_ITEM, PART_ENTIRE_CONTROL)) == TRUE ) + if( !bLayout && (bNativeOK = IsNativeControlSupported(CTRL_TAB_ITEM, PART_ENTIRE_CONTROL)) == sal_True ) { Rectangle aCtrlRegion( pItem->maRect ); ControlState nState = 0; @@ -1044,7 +939,7 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo // set font accordingly, current item is painted bold // we set the font attributes always before drawing to be re-entrant (DrawNativeControl may trigger additional paints) Font aFont( GetFont() ); - aFont.SetTransparent( TRUE ); + aFont.SetTransparent( sal_True ); aFont.SetWeight( ((bIsCurrentItem) && (!ImplGetSVData()->maNWFData.mbNoBoldTabFocus)) ? WEIGHT_BOLD : WEIGHT_LIGHT ); SetFont( aFont ); @@ -1062,7 +957,7 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo long nYPos = aRect.Top()+((aTabSize.Height()-nTextHeight)/2)-nOff3; if( pItem->maFormatText.Len() ) { - USHORT nStyle = TEXT_DRAW_MNEMONIC; + sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC; if( ! pItem->mbEnabled ) nStyle |= TEXT_DRAW_DISABLE; DrawCtrlText( Point( nXPos + aImageSize.Width(), nYPos ), @@ -1091,7 +986,7 @@ long TabControl::ImplHandleKeyEvent( const KeyEvent& rKeyEvent ) if ( GetPageCount() > 1 ) { KeyCode aKeyCode = rKeyEvent.GetKeyCode(); - USHORT nKeyCode = aKeyCode.GetCode(); + sal_uInt16 nKeyCode = aKeyCode.GetCode(); if ( aKeyCode.IsMod1() ) { @@ -1099,7 +994,7 @@ long TabControl::ImplHandleKeyEvent( const KeyEvent& rKeyEvent ) { if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEUP) ) { - ImplActivateTabPage( FALSE ); + ImplActivateTabPage( sal_False ); nRet = 1; } } @@ -1107,7 +1002,7 @@ long TabControl::ImplHandleKeyEvent( const KeyEvent& rKeyEvent ) { if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEDOWN) ) { - ImplActivateTabPage( TRUE ); + ImplActivateTabPage( sal_True ); nRet = 1; } } @@ -1120,14 +1015,6 @@ long TabControl::ImplHandleKeyEvent( const KeyEvent& rKeyEvent ) // ----------------------------------------------------------------------- -IMPL_LINK( TabControl, ImplScrollBtnHdl, PushButton*, EMPTYARG ) -{ - ImplSetScrollBtnsState(); - return 0; -} - -// ----------------------------------------------------------------------- - IMPL_LINK( TabControl, ImplListBoxSelectHdl, ListBox*, EMPTYARG ) { SelectTabPage( GetPageId( mpTabCtrlData->mpListBox->GetSelectEntryPos() ) ); @@ -1160,7 +1047,7 @@ void TabControl::MouseButtonDown( const MouseEvent& rMEvt ) { if( rMEvt.IsLeft() ) { - USHORT nPageId = GetPageId( rMEvt.GetPosPixel() ); + sal_uInt16 nPageId = GetPageId( rMEvt.GetPosPixel() ); ImplTabItem* pItem = ImplGetItem( nPageId ); if( pItem && pItem->mbEnabled ) SelectTabPage( nPageId ); @@ -1177,11 +1064,11 @@ void TabControl::KeyInput( const KeyEvent& rKEvt ) else if ( GetPageCount() > 1 ) { KeyCode aKeyCode = rKEvt.GetKeyCode(); - USHORT nKeyCode = aKeyCode.GetCode(); + sal_uInt16 nKeyCode = aKeyCode.GetCode(); if ( (nKeyCode == KEY_LEFT) || (nKeyCode == KEY_RIGHT) ) { - BOOL bNext = (nKeyCode == KEY_RIGHT); + sal_Bool bNext = (nKeyCode == KEY_RIGHT); ImplActivateTabPage( bNext ); } } @@ -1231,17 +1118,17 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) // increased to avoid round corners that might be drawn by a theme // in this case we're only interested in the top border of the tabpage because the tabitems are used // standalone (eg impress) - BOOL bNoTabPage = FALSE; + sal_Bool bNoTabPage = sal_False; TabPage* pCurPage = (pCurItem) ? pCurItem->mpTabPage : NULL; if( !pCurPage || !pCurPage->IsVisible() ) { - bNoTabPage = TRUE; + bNoTabPage = sal_True; aRect.Left()-=10; aRect.Right()+=10; } - BOOL bNativeOK = FALSE; - if( ! bLayout && (bNativeOK = IsNativeControlSupported( CTRL_TAB_PANE, PART_ENTIRE_CONTROL) ) == TRUE ) + sal_Bool bNativeOK = sal_False; + if( ! bLayout && (bNativeOK = IsNativeControlSupported( CTRL_TAB_PANE, PART_ENTIRE_CONTROL) ) == sal_True ) { const ImplControlValue aControlValue; @@ -1352,7 +1239,7 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) if( !rRect.IsEmpty() ) aClipRgn.Intersect( rRect ); if( bLayout || !aClipRgn.IsEmpty() ) - ImplDrawItem( pItem, aCurRect, bLayout, (pItem==pFirstTab), (pItem==pLastTab), FALSE ); + ImplDrawItem( pItem, aCurRect, bLayout, (pItem==pFirstTab), (pItem==pLastTab), sal_False ); } if ( bDrawTabsRTL ) @@ -1368,7 +1255,7 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) if( !rRect.IsEmpty() ) aClipRgn.Intersect( rRect ); if( bLayout || !aClipRgn.IsEmpty() ) - ImplDrawItem( pCurItem, aCurRect, bLayout, (pCurItem==pFirstTab), (pCurItem==pLastTab), TRUE ); + ImplDrawItem( pCurItem, aCurRect, bLayout, (pCurItem==pFirstTab), (pCurItem==pLastTab), sal_True ); } } @@ -1376,7 +1263,7 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) ImplShowFocus(); if( ! bLayout ) - mbSmallInvalidate = TRUE; + mbSmallInvalidate = sal_True; } // ----------------------------------------------------------------------- @@ -1400,26 +1287,21 @@ void TabControl::Resize() mpTabCtrlData->mpListBox->SetPosSizePixel( aNewPos, aNewSize ); } - mbFormat = TRUE; + mbFormat = sal_True; // Aktuelle TabPage resizen/positionieren - BOOL bTabPage = ImplPosCurTabPage(); + sal_Bool bTabPage = ImplPosCurTabPage(); // Feststellen, was invalidiert werden muss Size aNewSize = Control::GetOutputSizePixel(); long nNewWidth = aNewSize.Width(); - if ( mbScroll ) - mbSmallInvalidate = FALSE; - else + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) { - for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); - it != mpTabCtrlData->maItemList.end(); ++it ) + if ( !it->mbFullVisible || + (it->maRect.Right()-2 >= nNewWidth) ) { - if ( !it->mbFullVisible || - (it->maRect.Right()-2 >= nNewWidth) ) - { - mbSmallInvalidate = FALSE; - break; - } + mbSmallInvalidate = sal_False; + break; } } @@ -1475,7 +1357,7 @@ void TabControl::LoseFocus() void TabControl::RequestHelp( const HelpEvent& rHEvt ) { - USHORT nItemId = rHEvt.KeyboardActivated() ? mnCurPageId : GetPageId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) ); + sal_uInt16 nItemId = rHEvt.KeyboardActivated() ? mnCurPageId : GetPageId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) ); if ( nItemId ) { @@ -1497,13 +1379,13 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt ) } else if ( rHEvt.GetMode() & HELPMODE_EXTENDED ) { - ULONG nHelpId = GetHelpId( nItemId ); - if ( nHelpId ) + rtl::OUString aHelpId( rtl::OStringToOUString( GetHelpId( nItemId ), RTL_TEXTENCODING_UTF8 ) ); + if ( aHelpId.getLength() ) { // Wenn eine Hilfe existiert, dann ausloesen Help* pHelp = Application::GetHelp(); if ( pHelp ) - pHelp->Start( nHelpId, this ); + pHelp->Start( aHelpId, this ); return; } } @@ -1564,7 +1446,7 @@ void TabControl::Command( const CommandEvent& rCEvt ) if( (mpTabCtrlData->mpListBox == NULL) && (rCEvt.GetCommand() == COMMAND_CONTEXTMENU) && (GetPageCount() > 1) ) { Point aMenuPos; - BOOL bMenu; + sal_Bool bMenu; if ( rCEvt.IsMouseEvent() ) { aMenuPos = rCEvt.GetMousePosPixel(); @@ -1573,7 +1455,7 @@ void TabControl::Command( const CommandEvent& rCEvt ) else { aMenuPos = ImplGetTabRect( GetPagePos( mnCurPageId ) ).Center(); - bMenu = TRUE; + bMenu = sal_True; } if ( bMenu ) @@ -1585,10 +1467,10 @@ void TabControl::Command( const CommandEvent& rCEvt ) aMenu.InsertItem( it->mnId, it->maText, MIB_CHECKABLE | MIB_RADIOCHECK ); if ( it->mnId == mnCurPageId ) aMenu.CheckItem( it->mnId ); - aMenu.SetHelpId( it->mnId, it->mnHelpId ); + aMenu.SetHelpId( it->mnId, it->maHelpId ); } - USHORT nId = aMenu.Execute( this, aMenuPos ); + sal_uInt16 nId = aMenu.Execute( this, aMenuPos ); if ( nId && (nId != mnCurPageId) ) SelectTabPage( nId ); return; @@ -1618,17 +1500,17 @@ void TabControl::StateChanged( StateChangedType nType ) else if ( (nType == STATE_CHANGE_ZOOM) || (nType == STATE_CHANGE_CONTROLFONT) ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } else if ( nType == STATE_CHANGE_STYLE ) @@ -1648,7 +1530,7 @@ void TabControl::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); Invalidate(); } } @@ -1748,7 +1630,7 @@ long TabControl::DeactivatePage() if ( maDeactivateHdl.IsSet() ) return maDeactivateHdl.Call( this ); else - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -1775,16 +1657,16 @@ Size TabControl::GetTabPageSizePixel() const // ----------------------------------------------------------------------- -void TabControl::InsertPage( const ResId& rResId, USHORT nPos ) +void TabControl::InsertPage( const ResId& rResId, sal_uInt16 nPos ) { GetRes( rResId.SetRT( RSC_TABCONTROLITEM ) ); - ULONG nObjMask = ReadLongRes(); - USHORT nItemId = 1; + sal_uLong nObjMask = ReadLongRes(); + sal_uInt16 nItemId = 1; // ID if ( nObjMask & RSC_TABCONTROLITEM_ID ) - nItemId = sal::static_int_cast<USHORT>(ReadLongRes()); + nItemId = sal::static_int_cast<sal_uInt16>(ReadLongRes()); // Text XubString aTmpStr; @@ -1796,14 +1678,14 @@ void TabControl::InsertPage( const ResId& rResId, USHORT nPos ) if ( nObjMask & RSC_TABCONTROLITEM_PAGERESID ) { ImplTabItem& rItem = mpTabCtrlData->maItemList[ GetPagePos( nItemId ) ]; - rItem.mnTabPageResId = sal::static_int_cast<USHORT>(ReadLongRes()); + rItem.mnTabPageResId = sal::static_int_cast<sal_uInt16>(ReadLongRes()); } } // ----------------------------------------------------------------------- -void TabControl::InsertPage( USHORT nPageId, const XubString& rText, - USHORT nPos ) +void TabControl::InsertPage( sal_uInt16 nPageId, const XubString& rText, + sal_uInt16 nPos ) { DBG_ASSERT( nPageId, "TabControl::InsertPage(): PageId == 0" ); DBG_ASSERT( GetPagePos( nPageId ) == TAB_PAGE_NOTFOUND, @@ -1841,11 +1723,10 @@ void TabControl::InsertPage( USHORT nPageId, const XubString& rText, pItem->mnId = nPageId; pItem->mpTabPage = NULL; pItem->mnTabPageResId = 0; - pItem->mnHelpId = 0; pItem->maText = rText; - pItem->mbFullVisible = FALSE; + pItem->mbFullVisible = sal_False; - mbFormat = TRUE; + mbFormat = sal_True; if ( IsUpdateMode() ) Invalidate(); @@ -1853,14 +1734,14 @@ void TabControl::InsertPage( USHORT nPageId, const XubString& rText, if( mpTabCtrlData->mpListBox ) // reposition/resize listbox Resize(); - ImplCallEventListeners( VCLEVENT_TABPAGE_INSERTED, (void*) (ULONG)nPageId ); + ImplCallEventListeners( VCLEVENT_TABPAGE_INSERTED, (void*) (sal_uLong)nPageId ); } // ----------------------------------------------------------------------- -void TabControl::RemovePage( USHORT nPageId ) +void TabControl::RemovePage( sal_uInt16 nPageId ) { - USHORT nPos = GetPagePos( nPageId ); + sal_uInt16 nPos = GetPagePos( nPageId ); // does the item exist ? if ( nPos != TAB_PAGE_NOTFOUND ) @@ -1894,13 +1775,13 @@ void TabControl::RemovePage( USHORT nPageId ) } } - mbFormat = TRUE; + mbFormat = sal_True; if ( IsUpdateMode() ) Invalidate(); ImplFreeLayoutData(); - ImplCallEventListeners( VCLEVENT_TABPAGE_REMOVED, (void*) (ULONG) nPageId ); + ImplCallEventListeners( VCLEVENT_TABPAGE_REMOVED, (void*) (sal_uLong) nPageId ); } } @@ -1916,7 +1797,7 @@ void TabControl::Clear() ImplFreeLayoutData(); - mbFormat = TRUE; + mbFormat = sal_True; if ( IsUpdateMode() ) Invalidate(); @@ -1925,14 +1806,14 @@ void TabControl::Clear() // ----------------------------------------------------------------------- -void TabControl::EnablePage( USHORT i_nPageId, bool i_bEnable ) +void TabControl::EnablePage( sal_uInt16 i_nPageId, bool i_bEnable ) { ImplTabItem* pItem = ImplGetItem( i_nPageId ); if ( pItem && pItem->mbEnabled != i_bEnable ) { pItem->mbEnabled = i_bEnable; - mbFormat = TRUE; + mbFormat = sal_True; if( mpTabCtrlData->mpListBox ) mpTabCtrlData->mpListBox->SetEntryFlags( GetPagePos( i_nPageId ), i_bEnable ? 0 : (LISTBOX_ENTRY_FLAG_DISABLE_SELECTION | LISTBOX_ENTRY_FLAG_DRAW_DISABLED) ); @@ -1948,14 +1829,14 @@ void TabControl::EnablePage( USHORT i_nPageId, bool i_bEnable ) // ----------------------------------------------------------------------- -USHORT TabControl::GetPageCount() const +sal_uInt16 TabControl::GetPageCount() const { - return (USHORT)mpTabCtrlData->maItemList.size(); + return (sal_uInt16)mpTabCtrlData->maItemList.size(); } // ----------------------------------------------------------------------- -USHORT TabControl::GetPageId( USHORT nPos ) const +sal_uInt16 TabControl::GetPageId( sal_uInt16 nPos ) const { if( size_t(nPos) < mpTabCtrlData->maItemList.size() ) return mpTabCtrlData->maItemList[ nPos ].mnId; @@ -1964,13 +1845,13 @@ USHORT TabControl::GetPageId( USHORT nPos ) const // ----------------------------------------------------------------------- -USHORT TabControl::GetPagePos( USHORT nPageId ) const +sal_uInt16 TabControl::GetPagePos( sal_uInt16 nPageId ) const { for( std::vector< ImplTabItem >::const_iterator it = mpTabCtrlData->maItemList.begin(); it != mpTabCtrlData->maItemList.end(); ++it ) { if ( it->mnId == nPageId ) - return (USHORT)(it - mpTabCtrlData->maItemList.begin()); + return (sal_uInt16)(it - mpTabCtrlData->maItemList.begin()); } return TAB_PAGE_NOTFOUND; @@ -1978,11 +1859,11 @@ USHORT TabControl::GetPagePos( USHORT nPageId ) const // ----------------------------------------------------------------------- -USHORT TabControl::GetPageId( const Point& rPos ) const +sal_uInt16 TabControl::GetPageId( const Point& rPos ) const { for( size_t i = 0; i < mpTabCtrlData->maItemList.size(); ++i ) { - if ( ((TabControl*)this)->ImplGetTabRect( static_cast<USHORT>(i) ).IsInside( rPos ) ) + if ( ((TabControl*)this)->ImplGetTabRect( static_cast<sal_uInt16>(i) ).IsInside( rPos ) ) return mpTabCtrlData->maItemList[ i ].mnId; } @@ -1991,9 +1872,9 @@ USHORT TabControl::GetPageId( const Point& rPos ) const // ----------------------------------------------------------------------- -void TabControl::SetCurPageId( USHORT nPageId ) +void TabControl::SetCurPageId( sal_uInt16 nPageId ) { - USHORT nPos = GetPagePos( nPageId ); + sal_uInt16 nPos = GetPagePos( nPageId ); while( nPos != TAB_PAGE_NOTFOUND && ! mpTabCtrlData->maItemList[nPos].mbEnabled ) { @@ -2018,8 +1899,8 @@ void TabControl::SetCurPageId( USHORT nPageId ) mnActPageId = nPageId; else { - mbFormat = TRUE; - USHORT nOldId = mnCurPageId; + mbFormat = sal_True; + sal_uInt16 nOldId = mnCurPageId; mnCurPageId = nPageId; ImplChangeTabPage( nPageId, nOldId ); } @@ -2028,7 +1909,7 @@ void TabControl::SetCurPageId( USHORT nPageId ) // ----------------------------------------------------------------------- -USHORT TabControl::GetCurPageId() const +sal_uInt16 TabControl::GetCurPageId() const { if ( mnActPageId ) return mnActPageId; @@ -2038,20 +1919,13 @@ USHORT TabControl::GetCurPageId() const // ----------------------------------------------------------------------- -void TabControl::SetFirstPageId( USHORT ) -{ - return; // was only required for single line -} - -// ----------------------------------------------------------------------- - -void TabControl::SelectTabPage( USHORT nPageId ) +void TabControl::SelectTabPage( sal_uInt16 nPageId ) { if ( nPageId && (nPageId != mnCurPageId) ) { ImplFreeLayoutData(); - ImplCallEventListeners( VCLEVENT_TABPAGE_DEACTIVATE, (void*) (ULONG) mnCurPageId ); + ImplCallEventListeners( VCLEVENT_TABPAGE_DEACTIVATE, (void*) (sal_uLong) mnCurPageId ); if ( DeactivatePage() ) { mnActPageId = nPageId; @@ -2062,14 +1936,14 @@ void TabControl::SelectTabPage( USHORT nPageId ) SetCurPageId( nPageId ); if( mpTabCtrlData->mpListBox ) mpTabCtrlData->mpListBox->SelectEntryPos( GetPagePos( nPageId ) ); - ImplCallEventListeners( VCLEVENT_TABPAGE_ACTIVATE, (void*) (ULONG) nPageId ); + ImplCallEventListeners( VCLEVENT_TABPAGE_ACTIVATE, (void*) (sal_uLong) nPageId ); } } } // ----------------------------------------------------------------------- -void TabControl::SetTabPage( USHORT nPageId, TabPage* pTabPage ) +void TabControl::SetTabPage( sal_uInt16 nPageId, TabPage* pTabPage ) { ImplTabItem* pItem = ImplGetItem( nPageId ); @@ -2094,7 +1968,7 @@ void TabControl::SetTabPage( USHORT nPageId, TabPage* pTabPage ) // ----------------------------------------------------------------------- -TabPage* TabControl::GetTabPage( USHORT nPageId ) const +TabPage* TabControl::GetTabPage( sal_uInt16 nPageId ) const { ImplTabItem* pItem = ImplGetItem( nPageId ); @@ -2106,7 +1980,7 @@ TabPage* TabControl::GetTabPage( USHORT nPageId ) const // ----------------------------------------------------------------------- -USHORT TabControl::GetTabPageResId( USHORT nPageId ) const +sal_uInt16 TabControl::GetTabPageResId( sal_uInt16 nPageId ) const { ImplTabItem* pItem = ImplGetItem( nPageId ); @@ -2118,30 +1992,30 @@ USHORT TabControl::GetTabPageResId( USHORT nPageId ) const // ----------------------------------------------------------------------- -void TabControl::SetPageText( USHORT nPageId, const XubString& rText ) +void TabControl::SetPageText( sal_uInt16 nPageId, const XubString& rText ) { ImplTabItem* pItem = ImplGetItem( nPageId ); if ( pItem && pItem->maText != rText ) { pItem->maText = rText; - mbFormat = TRUE; + mbFormat = sal_True; if( mpTabCtrlData->mpListBox ) { - USHORT nPos = GetPagePos( nPageId ); + sal_uInt16 nPos = GetPagePos( nPageId ); mpTabCtrlData->mpListBox->RemoveEntry( nPos ); mpTabCtrlData->mpListBox->InsertEntry( rText, nPos ); } if ( IsUpdateMode() ) Invalidate(); ImplFreeLayoutData(); - ImplCallEventListeners( VCLEVENT_TABPAGE_PAGETEXTCHANGED, (void*) (ULONG) nPageId ); + ImplCallEventListeners( VCLEVENT_TABPAGE_PAGETEXTCHANGED, (void*) (sal_uLong) nPageId ); } } // ----------------------------------------------------------------------- -XubString TabControl::GetPageText( USHORT nPageId ) const +XubString TabControl::GetPageText( sal_uInt16 nPageId ) const { ImplTabItem* pItem = ImplGetItem( nPageId ); @@ -2153,7 +2027,7 @@ XubString TabControl::GetPageText( USHORT nPageId ) const // ----------------------------------------------------------------------- -void TabControl::SetHelpText( USHORT nPageId, const XubString& rText ) +void TabControl::SetHelpText( sal_uInt16 nPageId, const XubString& rText ) { ImplTabItem* pItem = ImplGetItem( nPageId ); @@ -2163,17 +2037,17 @@ void TabControl::SetHelpText( USHORT nPageId, const XubString& rText ) // ----------------------------------------------------------------------- -const XubString& TabControl::GetHelpText( USHORT nPageId ) const +const XubString& TabControl::GetHelpText( sal_uInt16 nPageId ) const { ImplTabItem* pItem = ImplGetItem( nPageId ); if ( pItem ) { - if ( !pItem->maHelpText.Len() && pItem->mnHelpId ) + if ( !pItem->maHelpText.Len() && pItem->maHelpId.getLength() ) { Help* pHelp = Application::GetHelp(); if ( pHelp ) - pItem->maHelpText = pHelp->GetHelpText( pItem->mnHelpId, this ); + pItem->maHelpText = pHelp->GetHelpText( rtl::OStringToOUString( pItem->maHelpId, RTL_TEXTENCODING_UTF8 ), this ); } return pItem->maHelpText; @@ -2184,36 +2058,37 @@ const XubString& TabControl::GetHelpText( USHORT nPageId ) const // ----------------------------------------------------------------------- -void TabControl::SetHelpId( USHORT nPageId, ULONG nHelpId ) +void TabControl::SetHelpId( sal_uInt16 nPageId, const rtl::OString& rHelpId ) { ImplTabItem* pItem = ImplGetItem( nPageId ); if ( pItem ) - pItem->mnHelpId = nHelpId; + pItem->maHelpId = rHelpId; } // ----------------------------------------------------------------------- -ULONG TabControl::GetHelpId( USHORT nPageId ) const +rtl::OString TabControl::GetHelpId( sal_uInt16 nPageId ) const { + rtl::OString aRet; ImplTabItem* pItem = ImplGetItem( nPageId ); if ( pItem ) - return pItem->mnHelpId; - else - return 0; + aRet = pItem->maHelpId; + + return aRet; } // ----------------------------------------------------------------------- -void TabControl::SetPageImage( USHORT i_nPageId, const Image& i_rImage ) +void TabControl::SetPageImage( sal_uInt16 i_nPageId, const Image& i_rImage ) { ImplTabItem* pItem = ImplGetItem( i_nPageId ); if ( pItem ) { pItem->maTabImage = i_rImage; - mbFormat = TRUE; + mbFormat = sal_True; if ( IsUpdateMode() ) Invalidate(); } @@ -2221,7 +2096,7 @@ void TabControl::SetPageImage( USHORT i_nPageId, const Image& i_rImage ) // ----------------------------------------------------------------------- -const Image* TabControl::GetPageImage( USHORT i_nPageId ) const +const Image* TabControl::GetPageImage( sal_uInt16 i_nPageId ) const { const ImplTabItem* pItem = ImplGetItem( i_nPageId ); return pItem ? &pItem->maTabImage : NULL; @@ -2229,7 +2104,7 @@ const Image* TabControl::GetPageImage( USHORT i_nPageId ) const // ----------------------------------------------------------------------- -Rectangle TabControl::GetCharacterBounds( USHORT nPageId, long nIndex ) const +Rectangle TabControl::GetCharacterBounds( sal_uInt16 nPageId, long nIndex ) const { Rectangle aRet; @@ -2252,7 +2127,7 @@ Rectangle TabControl::GetCharacterBounds( USHORT nPageId, long nIndex ) const // ----------------------------------------------------------------------- -long TabControl::GetIndexForPoint( const Point& rPoint, USHORT& rPageId ) const +long TabControl::GetIndexForPoint( const Point& rPoint, sal_uInt16& rPageId ) const { long nRet = -1; @@ -2273,7 +2148,7 @@ long TabControl::GetIndexForPoint( const Point& rPoint, USHORT& rPageId ) const if( aPair.A() <= nIndex && aPair.B() >= nIndex ) { nRet = nIndex - aPair.A(); - rPageId = (USHORT)mpTabCtrlData->maLayoutLineToPageId[ nLine ]; + rPageId = (sal_uInt16)mpTabCtrlData->maLayoutLineToPageId[ nLine ]; break; } } @@ -2294,7 +2169,7 @@ void TabControl::FillLayoutData() const // ----------------------------------------------------------------------- -Rectangle TabControl::GetTabPageBounds( USHORT nPage ) const +Rectangle TabControl::GetTabPageBounds( sal_uInt16 nPage ) const { Rectangle aRet; @@ -2319,7 +2194,7 @@ Rectangle TabControl::GetTabPageBounds( USHORT nPage ) const // ----------------------------------------------------------------------- -Rectangle TabControl::GetTabBounds( USHORT nPageId ) const +Rectangle TabControl::GetTabBounds( sal_uInt16 nPageId ) const { Rectangle aRet; diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx new file mode 100644 index 000000000000..a55fdb3eb379 --- /dev/null +++ b/vcl/source/control/throbber.cxx @@ -0,0 +1,325 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public 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_vcl.hxx" + +#include "vcl/throbber.hxx" +#include "vcl/svapp.hxx" + +#include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/awt/ImageScaleMode.hpp> + +#include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/processfactory.hxx> +#include <rtl/ustrbuf.hxx> +#include <tools/diagnose_ex.h> +#include <tools/urlobj.hxx> + +#include <limits> + +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::graphic::XGraphic; +using ::com::sun::star::graphic::XGraphicProvider; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::Exception; +namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode; + +//---------------------------------------------------------------------------------------------------------------------- +Throbber::Throbber( Window* i_parentWindow, WinBits i_style, const ImageSet i_imageSet ) + :ImageControl( i_parentWindow, i_style ) + ,mbRepeat( sal_True ) + ,mnStepTime( 100 ) + ,mnCurStep( 0 ) + ,mnStepCount( 0 ) + ,meImageSet( i_imageSet ) +{ + maWaitTimer.SetTimeout( mnStepTime ); + maWaitTimer.SetTimeoutHdl( LINK( this, Throbber, TimeOutHdl ) ); + + SetScaleMode( ImageScaleMode::None ); + initImages(); +} + +//-------------------------------------------------------------------- +Throbber::Throbber( Window* i_parentWindow, const ResId& i_resId, const ImageSet i_imageSet ) + :ImageControl( i_parentWindow, i_resId ) + ,mbRepeat( sal_True ) + ,mnStepTime( 100 ) + ,mnCurStep( 0 ) + ,mnStepCount( 0 ) + ,meImageSet( i_imageSet ) +{ + maWaitTimer.SetTimeout( mnStepTime ); + maWaitTimer.SetTimeoutHdl( LINK( this, Throbber, TimeOutHdl ) ); + + SetScaleMode( ImageScaleMode::None ); + initImages(); +} + +//---------------------------------------------------------------------------------------------------------------------- +Throbber::~Throbber() +{ + maWaitTimer.Stop(); +} + +//---------------------------------------------------------------------------------------------------------------------- +namespace +{ + //.................................................................................................................. + ::rtl::OUString lcl_getHighContrastURL( ::rtl::OUString const& i_imageURL ) + { + INetURLObject aURL( i_imageURL ); + if ( aURL.GetProtocol() != INET_PROT_PRIV_SOFFICE ) + { + OSL_VERIFY( aURL.insertName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hicontrast" ) ), false, 0 ) ); + return aURL.GetMainURL( INetURLObject::NO_DECODE ); + } + // the private: scheme is not considered to be hierarchical by INetURLObject, so manually insert the + // segment + const sal_Int32 separatorPos = i_imageURL.indexOf( '/' ); + ENSURE_OR_RETURN( separatorPos != -1, "lcl_getHighContrastURL: unsipported URL scheme - cannot automatically determine HC version!", i_imageURL ); + + ::rtl::OUStringBuffer composer; + composer.append( i_imageURL.copy( 0, separatorPos ) ); + composer.appendAscii( "/hicontrast" ); + composer.append( i_imageURL.copy( separatorPos ) ); + return composer.makeStringAndClear(); + } + + //.................................................................................................................. + ::std::vector< Image > lcl_loadImageSet( const Throbber::ImageSet i_imageSet, const bool i_isHiContrast ) + { + ::std::vector< Image > aImages; + ENSURE_OR_RETURN( i_imageSet != Throbber::IMAGES_NONE, "lcl_loadImageSet: illegal image set", aImages ); + + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); + + ::std::vector< ::rtl::OUString > aImageURLs( Throbber::getDefaultImageURLs( i_imageSet ) ); + aImages.reserve( aImageURLs.size() ); + + ::comphelper::NamedValueCollection aMediaProperties; + for ( ::std::vector< ::rtl::OUString >::const_iterator imageURL = aImageURLs.begin(); + imageURL != aImageURLs.end(); + ++imageURL + ) + { + Reference< XGraphic > xGraphic; + if ( i_isHiContrast ) + { + aMediaProperties.put( "URL", lcl_getHighContrastURL( *imageURL ) ); + xGraphic.set( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY ); + } + if ( !xGraphic.is() ) + { + aMediaProperties.put( "URL", *imageURL ); + xGraphic.set( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY ); + } + aImages.push_back( Image( xGraphic ) ); + } + + return aImages; + } +} + +//---------------------------------------------------------------------------------------------------------------------- +void Throbber::Resize() +{ + ImageControl::Resize(); + + if ( meImageSet == IMAGES_AUTO ) + initImages(); +} + +//---------------------------------------------------------------------------------------------------------------------- +void Throbber::initImages() +{ + if ( meImageSet == IMAGES_NONE ) + return; + + try + { + ::std::vector< ::std::vector< Image > > aImageSets; + const bool isHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); + if ( meImageSet == IMAGES_AUTO ) + { + aImageSets.push_back( lcl_loadImageSet( IMAGES_16_PX, isHiContrast ) ); + aImageSets.push_back( lcl_loadImageSet( IMAGES_32_PX, isHiContrast ) ); + aImageSets.push_back( lcl_loadImageSet( IMAGES_64_PX, isHiContrast ) ); + } + else + { + aImageSets.push_back( lcl_loadImageSet( meImageSet, isHiContrast ) ); + } + + // find the best matching image set (size-wise) + const ::Size aWindowSizePixel = GetSizePixel(); + size_t nPreferredSet = 0; + if ( aImageSets.size() > 1 ) + { + long nMinimalDistance = ::std::numeric_limits< long >::max(); + for ( ::std::vector< ::std::vector< Image > >::const_iterator check = aImageSets.begin(); + check != aImageSets.end(); + ++check + ) + { + ENSURE_OR_CONTINUE( !check->empty(), "Throbber::initImages: illegal image!" ); + const Size aImageSize = (*check)[0].GetSizePixel(); + + if ( ( aImageSize.Width() > aWindowSizePixel.Width() ) + || ( aImageSize.Height() > aWindowSizePixel.Height() ) + ) + // do not use an image set which doesn't fit into the window + continue; + + const sal_Int64 distance = + ( aWindowSizePixel.Width() - aImageSize.Width() ) * ( aWindowSizePixel.Width() - aImageSize.Width() ) + + ( aWindowSizePixel.Height() - aImageSize.Height() ) * ( aWindowSizePixel.Height() - aImageSize.Height() ); + if ( distance < nMinimalDistance ) + { + nMinimalDistance = distance; + nPreferredSet = check - aImageSets.begin(); + } + } + } + + if ( nPreferredSet < aImageSets.size() ) + setImageList( aImageSets[nPreferredSet] ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//---------------------------------------------------------------------------------------------------------------------- +void Throbber::start() +{ + maWaitTimer.Start(); +} + +//---------------------------------------------------------------------------------------------------------------------- +void Throbber::stop() +{ + maWaitTimer.Stop(); +} + +//---------------------------------------------------------------------------------------------------------------------- +bool Throbber::isRunning() const +{ + return maWaitTimer.IsActive(); +} + +//---------------------------------------------------------------------------------------------------------------------- +void Throbber::setImageList( ::std::vector< Image > const& i_images ) +{ + maImageList = i_images; + + mnStepCount = maImageList.size(); + const Image aInitialImage( mnStepCount ? maImageList[ 0 ] : Image() ); + SetImage( aInitialImage ); +} + +//---------------------------------------------------------------------------------------------------------------------- +void Throbber::setImageList( const Sequence< Reference< XGraphic > >& rImageList ) +{ + ::std::vector< Image > aImages( rImageList.getLength() ); + ::std::copy( + rImageList.getConstArray(), + rImageList.getConstArray() + rImageList.getLength(), + aImages.begin() + ); + setImageList( aImages ); +} + +//---------------------------------------------------------------------------------------------------------------------- +::std::vector< ::rtl::OUString > Throbber::getDefaultImageURLs( const ImageSet i_imageSet ) +{ + ::std::vector< ::rtl::OUString > aImageURLs; + + sal_Char const* const pResolutions[] = { "16", "32", "64" }; + size_t const nImageCounts[] = { 6, 12, 12 }; + + size_t index = 0; + switch ( i_imageSet ) + { + case IMAGES_16_PX: index = 0; break; + case IMAGES_32_PX: index = 1; break; + case IMAGES_64_PX: index = 2; break; + case IMAGES_NONE: + case IMAGES_AUTO: + OSL_ENSURE( false, "Throbber::getDefaultImageURLs: illegal image set!" ); + return aImageURLs; + } + + aImageURLs.reserve( nImageCounts[index] ); + for ( size_t i=0; i<nImageCounts[index]; ++i ) + { + ::rtl::OUStringBuffer aURL; + aURL.appendAscii( "private:graphicrepository/shared/spinner-" ); + aURL.appendAscii( pResolutions[index] ); + aURL.appendAscii( "-" ); + if ( i < 9 ) + aURL.appendAscii( "0" ); + aURL.append ( sal_Int32( i + 1 ) ); + aURL.appendAscii( ".png" ); + + aImageURLs.push_back( aURL.makeStringAndClear() ); + } + + return aImageURLs; +} + +//---------------------------------------------------------------------------------------------------------------------- +IMPL_LINK( Throbber, TimeOutHdl, void*, EMPTYARG ) +{ + SolarMutexGuard aGuard; + if ( maImageList.empty() ) + return 0; + + if ( mnCurStep < mnStepCount - 1 ) + mnCurStep += 1; + else + { + if ( mbRepeat ) + { + // start over + mnCurStep = 0; + } + else + { + stop(); + } + } + + SetImage( maImageList[ mnCurStep ] ); + + return 0; +} diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index c2b0310c7ca9..da0d84cec089 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -42,12 +42,10 @@ namespace vcl { -typedef sal_uInt32 ULONG; -typedef sal_uInt32 UINT32; -typedef sal_uInt16 USHORT; +typedef sal_uIntPtr sal_uLong; typedef sal_uInt8 FT_Byte; -typedef std::map<USHORT,USHORT> GlyphSubstitution; +typedef std::map<sal_uInt16,sal_uInt16> GlyphSubstitution; inline sal_uInt32 NEXT_Long( const unsigned char* &p ) @@ -57,9 +55,9 @@ inline sal_uInt32 NEXT_Long( const unsigned char* &p ) return nVal; } -inline USHORT NEXT_UShort( const unsigned char* &p ) +inline sal_uInt16 NEXT_UShort( const unsigned char* &p ) { - USHORT nVal = (p[0]<<8) + p[1]; + sal_uInt16 nVal = (p[0]<<8) + p[1]; p += 2; return nVal; } @@ -78,50 +76,50 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, // parse GSUB header const FT_Byte* pGsubHeader = pGsubBase; - const ULONG nVersion = NEXT_Long( pGsubHeader ); - const USHORT nOfsScriptList = NEXT_UShort( pGsubHeader ); - const USHORT nOfsFeatureTable = NEXT_UShort( pGsubHeader ); - const USHORT nOfsLookupList = NEXT_UShort( pGsubHeader ); + const sal_uLong nVersion = NEXT_Long( pGsubHeader ); + const sal_uInt16 nOfsScriptList = NEXT_UShort( pGsubHeader ); + const sal_uInt16 nOfsFeatureTable = NEXT_UShort( pGsubHeader ); + const sal_uInt16 nOfsLookupList = NEXT_UShort( pGsubHeader ); // sanity check the GSUB header if( nVersion != 0x00010000 ) if( nVersion != 0x00001000 ) // workaround for SunBatang etc. return -1; // unknown format or broken - typedef std::vector<ULONG> ReqFeatureTagList; + typedef std::vector<sal_uLong> ReqFeatureTagList; ReqFeatureTagList aReqFeatureTagList; aReqFeatureTagList.push_back( MKTAG("vert") ); - typedef std::vector<USHORT> UshortList; + typedef std::vector<sal_uInt16> UshortList; UshortList aFeatureIndexList; UshortList aFeatureOffsetList; // parse Script Table const FT_Byte* pScriptHeader = pGsubBase + nOfsScriptList; - const USHORT nCntScript = NEXT_UShort( pScriptHeader ); + const sal_uInt16 nCntScript = NEXT_UShort( pScriptHeader ); if( pGsubLimit < pScriptHeader + 6 * nCntScript ) return false; - for( USHORT nScriptIndex = 0; nScriptIndex < nCntScript; ++nScriptIndex ) + for( sal_uInt16 nScriptIndex = 0; nScriptIndex < nCntScript; ++nScriptIndex ) { - const ULONG nTag = NEXT_Long( pScriptHeader ); // e.g. hani/arab/kana/hang - const USHORT nOfsScriptTable= NEXT_UShort( pScriptHeader ); - if( (nTag != (USHORT)nRequestedScript) && (nRequestedScript != 0) ) + const sal_uLong nTag = NEXT_Long( pScriptHeader ); // e.g. hani/arab/kana/hang + const sal_uInt16 nOfsScriptTable= NEXT_UShort( pScriptHeader ); + if( (nTag != (sal_uInt16)nRequestedScript) && (nRequestedScript != 0) ) continue; const FT_Byte* pScriptTable = pGsubBase + nOfsScriptList + nOfsScriptTable; if( pGsubLimit < pScriptTable + 4 ) return false; - const USHORT nDefaultLangsysOfs = NEXT_UShort( pScriptTable ); - const USHORT nCntLangSystem = NEXT_UShort( pScriptTable ); - USHORT nLangsysOffset = 0; + const sal_uInt16 nDefaultLangsysOfs = NEXT_UShort( pScriptTable ); + const sal_uInt16 nCntLangSystem = NEXT_UShort( pScriptTable ); + sal_uInt16 nLangsysOffset = 0; if( pGsubLimit < pScriptTable + 6 * nCntLangSystem ) return false; - for( USHORT nLangsysIndex = 0; nLangsysIndex < nCntLangSystem; ++nLangsysIndex ) + for( sal_uInt16 nLangsysIndex = 0; nLangsysIndex < nCntLangSystem; ++nLangsysIndex ) { - const ULONG nInnerTag = NEXT_Long( pScriptTable ); // e.g. KOR/ZHS/ZHT/JAN - const USHORT nOffset= NEXT_UShort( pScriptTable ); - if( (nInnerTag != (USHORT)nRequestedLangsys) && (nRequestedLangsys != 0) ) + const sal_uLong nInnerTag = NEXT_Long( pScriptTable ); // e.g. KOR/ZHS/ZHT/JAN + const sal_uInt16 nOffset= NEXT_UShort( pScriptTable ); + if( (nInnerTag != (sal_uInt16)nRequestedLangsys) && (nRequestedLangsys != 0) ) continue; nLangsysOffset = nOffset; break; @@ -132,15 +130,15 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, const FT_Byte* pLangSys = pGsubBase + nOfsScriptList + nOfsScriptTable + nDefaultLangsysOfs; if( pGsubLimit < pLangSys + 6 ) return false; - /*const USHORT nLookupOrder =*/ NEXT_UShort( pLangSys ); - const USHORT nReqFeatureIdx = NEXT_UShort( pLangSys ); - const USHORT nCntFeature = NEXT_UShort( pLangSys ); + /*const sal_uInt16 nLookupOrder =*/ NEXT_UShort( pLangSys ); + const sal_uInt16 nReqFeatureIdx = NEXT_UShort( pLangSys ); + const sal_uInt16 nCntFeature = NEXT_UShort( pLangSys ); if( pGsubLimit < pLangSys + 2 * nCntFeature ) return false; aFeatureIndexList.push_back( nReqFeatureIdx ); - for( USHORT i = 0; i < nCntFeature; ++i ) + for( sal_uInt16 i = 0; i < nCntFeature; ++i ) { - const USHORT nFeatureIndex = NEXT_UShort( pLangSys ); + const sal_uInt16 nFeatureIndex = NEXT_UShort( pLangSys ); aFeatureIndexList.push_back( nFeatureIndex ); } } @@ -150,15 +148,15 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, const FT_Byte* pLangSys = pGsubBase + nOfsScriptList + nOfsScriptTable + nLangsysOffset; if( pGsubLimit < pLangSys + 6 ) return false; - /*const USHORT nLookupOrder =*/ NEXT_UShort( pLangSys ); - const USHORT nReqFeatureIdx = NEXT_UShort( pLangSys ); - const USHORT nCntFeature = NEXT_UShort( pLangSys ); + /*const sal_uInt16 nLookupOrder =*/ NEXT_UShort( pLangSys ); + const sal_uInt16 nReqFeatureIdx = NEXT_UShort( pLangSys ); + const sal_uInt16 nCntFeature = NEXT_UShort( pLangSys ); if( pGsubLimit < pLangSys + 2 * nCntFeature ) return false; aFeatureIndexList.push_back( nReqFeatureIdx ); - for( USHORT i = 0; i < nCntFeature; ++i ) + for( sal_uInt16 i = 0; i < nCntFeature; ++i ) { - const USHORT nFeatureIndex = NEXT_UShort( pLangSys ); + const sal_uInt16 nFeatureIndex = NEXT_UShort( pLangSys ); aFeatureIndexList.push_back( nFeatureIndex ); } } @@ -174,13 +172,13 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, const FT_Byte* pFeatureHeader = pGsubBase + nOfsFeatureTable; if( pGsubLimit < pFeatureHeader + 2 ) return false; - const USHORT nCntFeature = NEXT_UShort( pFeatureHeader ); + const sal_uInt16 nCntFeature = NEXT_UShort( pFeatureHeader ); if( pGsubLimit < pFeatureHeader + 6 * nCntFeature ) return false; - for( USHORT nFeatureIndex = 0; nFeatureIndex < nCntFeature; ++nFeatureIndex ) + for( sal_uInt16 nFeatureIndex = 0; nFeatureIndex < nCntFeature; ++nFeatureIndex ) { - const ULONG nTag = NEXT_Long( pFeatureHeader ); // e.g. locl/vert/trad/smpl/liga/fina/... - const USHORT nOffset= NEXT_UShort( pFeatureHeader ); + const sal_uLong nTag = NEXT_Long( pFeatureHeader ); // e.g. locl/vert/trad/smpl/liga/fina/... + const sal_uInt16 nOffset= NEXT_UShort( pFeatureHeader ); // ignore unneeded feature lookups if( aFeatureIndexList[0] != nFeatureIndex ) // do not ignore the required feature @@ -196,12 +194,12 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, const FT_Byte* pFeatureTable = pGsubBase + nOfsFeatureTable + nOffset; if( pGsubLimit < pFeatureTable + 2 ) return false; - const USHORT nCntLookups = NEXT_UShort( pFeatureTable ); + const sal_uInt16 nCntLookups = NEXT_UShort( pFeatureTable ); if( pGsubLimit < pFeatureTable + 2 * nCntLookups ) return false; - for( USHORT i = 0; i < nCntLookups; ++i ) + for( sal_uInt16 i = 0; i < nCntLookups; ++i ) { - const USHORT nLookupIndex = NEXT_UShort( pFeatureTable ); + const sal_uInt16 nLookupIndex = NEXT_UShort( pFeatureTable ); aLookupIndexList.push_back( nLookupIndex ); } if( nCntLookups == 0 ) //### hack needed by Mincho/Gothic/Mingliu/Simsun/... @@ -212,12 +210,12 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, const FT_Byte* pLookupHeader = pGsubBase + nOfsLookupList; if( pGsubLimit < pLookupHeader + 2 ) return false; - const USHORT nCntLookupTable = NEXT_UShort( pLookupHeader ); + const sal_uInt16 nCntLookupTable = NEXT_UShort( pLookupHeader ); if( pGsubLimit < pLookupHeader + 2 * nCntLookupTable ) return false; - for( USHORT nLookupIdx = 0; nLookupIdx < nCntLookupTable; ++nLookupIdx ) + for( sal_uInt16 nLookupIdx = 0; nLookupIdx < nCntLookupTable; ++nLookupIdx ) { - const USHORT nOffset = NEXT_UShort( pLookupHeader ); + const sal_uInt16 nOffset = NEXT_UShort( pLookupHeader ); if( std::count( aLookupIndexList.begin(), aLookupIndexList.end(), nLookupIdx ) ) aLookupOffsetList.push_back( nOffset ); } @@ -225,13 +223,13 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, UshortList::const_iterator it = aLookupOffsetList.begin(); for(; it != aLookupOffsetList.end(); ++it ) { - const USHORT nOfsLookupTable = *it; + const sal_uInt16 nOfsLookupTable = *it; const FT_Byte* pLookupTable = pGsubBase + nOfsLookupList + nOfsLookupTable; if( pGsubLimit < pLookupTable + 6 ) return false; - const USHORT eLookupType = NEXT_UShort( pLookupTable ); - /*const USHORT eLookupFlag =*/ NEXT_UShort( pLookupTable ); - const USHORT nCntLookupSubtable = NEXT_UShort( pLookupTable ); + const sal_uInt16 eLookupType = NEXT_UShort( pLookupTable ); + /*const sal_uInt16 eLookupFlag =*/ NEXT_UShort( pLookupTable ); + const sal_uInt16 nCntLookupSubtable = NEXT_UShort( pLookupTable ); // TODO: switch( eLookupType ) if( eLookupType != 1 ) // TODO: once we go beyond SingleSubst @@ -239,16 +237,16 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, if( pGsubLimit < pLookupTable + 2 * nCntLookupSubtable ) return false; - for( USHORT nSubTableIdx = 0; nSubTableIdx < nCntLookupSubtable; ++nSubTableIdx ) + for( sal_uInt16 nSubTableIdx = 0; nSubTableIdx < nCntLookupSubtable; ++nSubTableIdx ) { - const USHORT nOfsSubLookupTable = NEXT_UShort( pLookupTable ); + const sal_uInt16 nOfsSubLookupTable = NEXT_UShort( pLookupTable ); const FT_Byte* pSubLookup = pGsubBase + nOfsLookupList + nOfsLookupTable + nOfsSubLookupTable; if( pGsubLimit < pSubLookup + 6 ) return false; - const USHORT nFmtSubstitution = NEXT_UShort( pSubLookup ); - const USHORT nOfsCoverage = NEXT_UShort( pSubLookup ); + const sal_uInt16 nFmtSubstitution = NEXT_UShort( pSubLookup ); + const sal_uInt16 nOfsCoverage = NEXT_UShort( pSubLookup ); - typedef std::pair<USHORT,USHORT> GlyphSubst; + typedef std::pair<sal_uInt16,sal_uInt16> GlyphSubst; typedef std::vector<GlyphSubst> SubstVector; SubstVector aSubstVector; @@ -256,19 +254,19 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, + nOfsLookupList + nOfsLookupTable + nOfsSubLookupTable + nOfsCoverage; if( pGsubLimit < pCoverage + 4 ) return false; - const USHORT nFmtCoverage = NEXT_UShort( pCoverage ); + const sal_uInt16 nFmtCoverage = NEXT_UShort( pCoverage ); switch( nFmtCoverage ) { case 1: // Coverage Format 1 { - const USHORT nCntGlyph = NEXT_UShort( pCoverage ); + const sal_uInt16 nCntGlyph = NEXT_UShort( pCoverage ); if( pGsubLimit < pCoverage + 2 * nCntGlyph ) // TODO? nCntGlyph = (pGsubLimit - pCoverage) / 2; return false; aSubstVector.reserve( nCntGlyph ); - for( USHORT i = 0; i < nCntGlyph; ++i ) + for( sal_uInt16 i = 0; i < nCntGlyph; ++i ) { - const USHORT nGlyphId = NEXT_UShort( pCoverage ); + const sal_uInt16 nGlyphId = NEXT_UShort( pCoverage ); aSubstVector.push_back( GlyphSubst( nGlyphId, 0 ) ); } } @@ -276,17 +274,17 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, case 2: // Coverage Format 2 { - const USHORT nCntRange = NEXT_UShort( pCoverage ); + const sal_uInt16 nCntRange = NEXT_UShort( pCoverage ); if( pGsubLimit < pCoverage + 6 * nCntRange ) // TODO? nCntGlyph = (pGsubLimit - pCoverage) / 6; return false; for( int i = nCntRange; --i >= 0; ) { - const UINT32 nGlyph0 = NEXT_UShort( pCoverage ); - const UINT32 nGlyph1 = NEXT_UShort( pCoverage ); - const USHORT nCovIdx = NEXT_UShort( pCoverage ); - for( UINT32 j = nGlyph0; j <= nGlyph1; ++j ) - aSubstVector.push_back( GlyphSubst( static_cast<USHORT>(j + nCovIdx), 0 ) ); + const sal_uInt32 nGlyph0 = NEXT_UShort( pCoverage ); + const sal_uInt32 nGlyph1 = NEXT_UShort( pCoverage ); + const sal_uInt16 nCovIdx = NEXT_UShort( pCoverage ); + for( sal_uInt32 j = nGlyph0; j <= nGlyph1; ++j ) + aSubstVector.push_back( GlyphSubst( static_cast<sal_uInt16>(j + nCovIdx), 0 ) ); } } break; @@ -298,7 +296,7 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, { case 1: // Single Substitution Format 1 { - const USHORT nDeltaGlyphId = NEXT_UShort( pSubLookup ); + const sal_uInt16 nDeltaGlyphId = NEXT_UShort( pSubLookup ); for(; subst_it != aSubstVector.end(); ++subst_it ) (*subst_it).second = (*subst_it).first + nDeltaGlyphId; @@ -307,12 +305,12 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, case 2: // Single Substitution Format 2 { - const USHORT nCntGlyph = NEXT_UShort( pSubLookup ); + const sal_uInt16 nCntGlyph = NEXT_UShort( pSubLookup ); for( int i = nCntGlyph; (subst_it != aSubstVector.end()) && (--i>=0); ++subst_it ) { if( pGsubLimit < pSubLookup + 2 ) return false; - const USHORT nGlyphId = NEXT_UShort( pSubLookup ); + const sal_uInt16 nGlyphId = NEXT_UShort( pSubLookup ); (*subst_it).second = nGlyphId; } } @@ -344,7 +342,7 @@ int UseGSUB( struct _TrueTypeFont* pTTFile, int nGlyph, int /*wmode*/ ) GlyphSubstitution* pGlyphSubstitution = (GlyphSubstitution*)pTTFile->pGSubstitution; if( pGlyphSubstitution != 0 ) { - GlyphSubstitution::const_iterator it( pGlyphSubstitution->find( sal::static_int_cast<USHORT>(nGlyph) ) ); + GlyphSubstitution::const_iterator it( pGlyphSubstitution->find( sal::static_int_cast<sal_uInt16>(nGlyph) ) ); if( it != pGlyphSubstitution->end() ) nGlyph = (*it).second; } diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 1bf8d638d9d5..dd7d7f7ba375 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1434,7 +1434,7 @@ static void GetKern(TrueTypeFont *ttf) if( !table ) goto badtable; - if (GetUInt16(table, 0, 1) == 0) { /* Traditional Microsoft style table with USHORT version and nTables fields */ + if (GetUInt16(table, 0, 1) == 0) { /* Traditional Microsoft style table with sal_uInt16 version and nTables fields */ ttf->nkern = GetUInt16(table, 2, 1); ttf->kerntables = (const sal_uInt8**)calloc(ttf->nkern, sizeof(sal_uInt8 *)); assert(ttf->kerntables != 0); diff --git a/vcl/source/gdi/alpha.cxx b/vcl/source/gdi/alpha.cxx index d144fe550882..6107affaf4e9 100644 --- a/vcl/source/gdi/alpha.cxx +++ b/vcl/source/gdi/alpha.cxx @@ -59,7 +59,7 @@ AlphaMask::AlphaMask( const AlphaMask& rAlphaMask ) : // ----------------------------------------------------------------------------- -AlphaMask::AlphaMask( const Size& rSizePixel, BYTE* pEraseTransparency ) : +AlphaMask::AlphaMask( const Size& rSizePixel, sal_uInt8* pEraseTransparency ) : Bitmap( rSizePixel, 8, &Bitmap::GetGreyPalette( 256 ) ) { if( pEraseTransparency ) @@ -108,14 +108,14 @@ Bitmap AlphaMask::GetBitmap() const // ----------------------------------------------------------------------------- -BOOL AlphaMask::Crop( const Rectangle& rRectPixel ) +sal_Bool AlphaMask::Crop( const Rectangle& rRectPixel ) { return Bitmap::Crop( rRectPixel ); } // ----------------------------------------------------------------------------- -BOOL AlphaMask::Expand( ULONG nDX, ULONG nDY, BYTE* pInitTransparency ) +sal_Bool AlphaMask::Expand( sal_uLong nDX, sal_uLong nDY, sal_uInt8* pInitTransparency ) { Color aColor; @@ -127,7 +127,7 @@ BOOL AlphaMask::Expand( ULONG nDX, ULONG nDY, BYTE* pInitTransparency ) // ----------------------------------------------------------------------------- -BOOL AlphaMask::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, +sal_Bool AlphaMask::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, const AlphaMask* pAlphaSrc ) { // Note: this code is copied from Bitmap::CopyPixel but avoids any palette lookups @@ -135,7 +135,7 @@ BOOL AlphaMask::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, const Size aSizePix( GetSizePixel() ); Rectangle aRectDst( rRectDst ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; aRectDst.Intersection( Rectangle( Point(), aSizePix ) ); @@ -226,7 +226,7 @@ BOOL AlphaMask::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, } ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } } } @@ -238,26 +238,26 @@ BOOL AlphaMask::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, // ----------------------------------------------------------------------------- -BOOL AlphaMask::Erase( BYTE cTransparency ) +sal_Bool AlphaMask::Erase( sal_uInt8 cTransparency ) { return Bitmap::Erase( Color( cTransparency, cTransparency, cTransparency ) ); } // ----------------------------------------------------------------------------- -BOOL AlphaMask::Invert() +sal_Bool AlphaMask::Invert() { BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pAcc && pAcc->GetBitCount() == 8 ) { BitmapColor aCol( 0 ); const long nWidth = pAcc->Width(), nHeight = pAcc->Height(); - BYTE* pMap = new BYTE[ 256 ]; + sal_uInt8* pMap = new sal_uInt8[ 256 ]; for( long i = 0; i < 256; i++ ) - pMap[ i ] = ~(BYTE) i; + pMap[ i ] = ~(sal_uInt8) i; for( long nY = 0L; nY < nHeight; nY++ ) { @@ -269,7 +269,7 @@ BOOL AlphaMask::Invert() } delete[] pMap; - bRet = TRUE; + bRet = sal_True; } if( pAcc ) @@ -280,16 +280,16 @@ BOOL AlphaMask::Invert() // ----------------------------------------------------------------------------- -BOOL AlphaMask::Mirror( ULONG nMirrorFlags ) +sal_Bool AlphaMask::Mirror( sal_uLong nMirrorFlags ) { return Bitmap::Mirror( nMirrorFlags ); } // ----------------------------------------------------------------------------- -BOOL AlphaMask::Scale( const Size& rNewSize, ULONG nScaleFlag ) +sal_Bool AlphaMask::Scale( const Size& rNewSize, sal_uLong nScaleFlag ) { - BOOL bRet = Bitmap::Scale( rNewSize, nScaleFlag ); + sal_Bool bRet = Bitmap::Scale( rNewSize, nScaleFlag ); if( bRet && ( nScaleFlag == BMP_SCALE_INTERPOLATE ) ) Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS ); @@ -299,9 +299,9 @@ BOOL AlphaMask::Scale( const Size& rNewSize, ULONG nScaleFlag ) // ----------------------------------------------------------------------------- -BOOL AlphaMask::Scale( const double& rScaleX, const double& rScaleY, ULONG nScaleFlag ) +sal_Bool AlphaMask::Scale( const double& rScaleX, const double& rScaleY, sal_uLong nScaleFlag ) { - BOOL bRet = Bitmap::Scale( rScaleX, rScaleY, nScaleFlag ); + sal_Bool bRet = Bitmap::Scale( rScaleX, rScaleY, nScaleFlag ); if( bRet && ( nScaleFlag == BMP_SCALE_INTERPOLATE ) ) Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS ); @@ -311,18 +311,18 @@ BOOL AlphaMask::Scale( const double& rScaleX, const double& rScaleY, ULONG nScal // ----------------------------------------------------------------------------- -BOOL AlphaMask::Rotate( long nAngle10, BYTE cFillTransparency ) +sal_Bool AlphaMask::Rotate( long nAngle10, sal_uInt8 cFillTransparency ) { return Bitmap::Rotate( nAngle10, Color( cFillTransparency, cFillTransparency, cFillTransparency ) ); } // ----------------------------------------------------------------------------- -BOOL AlphaMask::Replace( const Bitmap& rMask, BYTE cReplaceTransparency ) +sal_Bool AlphaMask::Replace( const Bitmap& rMask, sal_uInt8 cReplaceTransparency ) { BitmapReadAccess* pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess(); BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pMaskAcc && pAcc ) { @@ -345,14 +345,14 @@ BOOL AlphaMask::Replace( const Bitmap& rMask, BYTE cReplaceTransparency ) // ----------------------------------------------------------------------------- -BOOL AlphaMask::Replace( BYTE cSearchTransparency, BYTE cReplaceTransparency, ULONG +sal_Bool AlphaMask::Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency, sal_uLong #ifdef DBG_UTIL nTol #endif ) { BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; DBG_ASSERT( !nTol, "AlphaMask::Replace: nTol not used yet" ); @@ -387,7 +387,7 @@ nTol } } - bRet = TRUE; + bRet = sal_True; } if( pAcc ) @@ -398,17 +398,17 @@ nTol // ----------------------------------------------------------------------------- -BOOL AlphaMask::Replace( BYTE* pSearchTransparencies, BYTE* pReplaceTransparencies, - ULONG nColorCount, ULONG* pTols ) +sal_Bool AlphaMask::Replace( sal_uInt8* pSearchTransparencies, sal_uInt8* pReplaceTransparencies, + sal_uLong nColorCount, sal_uLong* pTols ) { Color* pSearchColors = new Color[ nColorCount ]; Color* pReplaceColors = new Color[ nColorCount ]; - BOOL bRet; + sal_Bool bRet; - for( ULONG i = 0; i < nColorCount; i++ ) + for( sal_uLong i = 0; i < nColorCount; i++ ) { - const BYTE cSearchTransparency = pSearchTransparencies[ i ]; - const BYTE cReplaceTransparency = pReplaceTransparencies[ i ]; + const sal_uInt8 cSearchTransparency = pSearchTransparencies[ i ]; + const sal_uInt8 cReplaceTransparency = pReplaceTransparencies[ i ]; pSearchColors[ i ] = Color( cSearchTransparency, cSearchTransparency, cSearchTransparency ); pReplaceColors[ i ] = Color( cReplaceTransparency, cReplaceTransparency, cReplaceTransparency ); diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx index 0da492c1fecb..63d0010bd5d2 100644 --- a/vcl/source/gdi/animate.cxx +++ b/vcl/source/gdi/animate.cxx @@ -50,13 +50,13 @@ DBG_NAME( Animation ) // - statics - // ----------- -ULONG Animation::mnAnimCount = 0UL; +sal_uLong Animation::mnAnimCount = 0UL; // ------------------- // - AnimationBitmap - // ------------------- -ULONG AnimationBitmap::GetChecksum() const +sal_uLong AnimationBitmap::GetChecksum() const { sal_uInt32 nCrc = aBmpEx.GetChecksum(); SVBT32 aBT32; @@ -94,9 +94,9 @@ Animation::Animation() : mnLoops ( 0 ), mnPos ( 0 ), meCycleMode ( CYCLE_NORMAL ), - mbIsInAnimation ( FALSE ), - mbLoopTerminated ( FALSE ), - mbIsWaiting ( FALSE ) + mbIsInAnimation ( sal_False ), + mbLoopTerminated ( sal_False ), + mbIsWaiting ( sal_False ) { DBG_CTOR( Animation, NULL ); maTimer.SetTimeoutHdl( LINK( this, Animation, ImplTimeoutHdl ) ); @@ -111,7 +111,7 @@ Animation::Animation( const Animation& rAnimation ) : mnLoopCount ( rAnimation.mnLoopCount ), mnPos ( rAnimation.mnPos ), meCycleMode ( rAnimation.meCycleMode ), - mbIsInAnimation ( FALSE ), + mbIsInAnimation ( sal_False ), mbLoopTerminated ( rAnimation.mbLoopTerminated ), mbIsWaiting ( rAnimation.mbIsWaiting ) { @@ -166,24 +166,24 @@ Animation& Animation::operator=( const Animation& rAnimation ) // ----------------------------------------------------------------------- -BOOL Animation::operator==( const Animation& rAnimation ) const +sal_Bool Animation::operator==( const Animation& rAnimation ) const { - const ULONG nCount = maList.Count(); - BOOL bRet = FALSE; + const sal_uLong nCount = maList.Count(); + sal_Bool bRet = sal_False; if( rAnimation.maList.Count() == nCount && rAnimation.maBitmapEx == maBitmapEx && rAnimation.maGlobalSize == maGlobalSize && rAnimation.meCycleMode == meCycleMode ) { - bRet = TRUE; + bRet = sal_True; - for( ULONG n = 0; n < nCount; n++ ) + for( sal_uLong n = 0; n < nCount; n++ ) { if( ( *(AnimationBitmap*) maList.GetObject( n ) ) != ( *(AnimationBitmap*) rAnimation.maList.GetObject( n ) ) ) { - bRet = FALSE; + bRet = sal_False; break; } } @@ -194,19 +194,19 @@ BOOL Animation::operator==( const Animation& rAnimation ) const // ------------------------------------------------------------------ -BOOL Animation::IsEqual( const Animation& rAnimation ) const +sal_Bool Animation::IsEqual( const Animation& rAnimation ) const { - const ULONG nCount = maList.Count(); - BOOL bRet = FALSE; + const sal_uLong nCount = maList.Count(); + sal_Bool bRet = sal_False; if( rAnimation.maList.Count() == nCount && rAnimation.maBitmapEx.IsEqual( maBitmapEx ) && rAnimation.maGlobalSize == maGlobalSize && rAnimation.meCycleMode == meCycleMode ) { - for( ULONG n = 0; ( n < nCount ) && !bRet; n++ ) + for( sal_uLong n = 0; ( n < nCount ) && !bRet; n++ ) if( ( (AnimationBitmap*) maList.GetObject( n ) )->IsEqual( *(AnimationBitmap*) rAnimation.maList.GetObject( n ) ) ) - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -214,7 +214,7 @@ BOOL Animation::IsEqual( const Animation& rAnimation ) const // ------------------------------------------------------------------ -BOOL Animation::IsEmpty() const +sal_Bool Animation::IsEmpty() const { return( maBitmapEx.IsEmpty() && !maList.Count() ); } @@ -224,7 +224,7 @@ BOOL Animation::IsEmpty() const void Animation::SetEmpty() { maTimer.Stop(); - mbIsInAnimation = FALSE; + mbIsInAnimation = sal_False; maGlobalSize = Size(); maBitmapEx.SetEmpty(); @@ -246,11 +246,11 @@ void Animation::Clear() // ----------------------------------------------------------------------- -BOOL Animation::IsTransparent() const +sal_Bool Animation::IsTransparent() const { Point aPoint; Rectangle aRect( aPoint, maGlobalSize ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; // Falls irgendein 'kleines' Bildchen durch den Hintergrund // ersetzt werden soll, muessen wir 'transparent' sein, um @@ -262,7 +262,7 @@ BOOL Animation::IsTransparent() const if( DISPOSE_BACK == pAnimBmp->eDisposal && Rectangle( pAnimBmp->aPosPix, pAnimBmp->aSizePix ) != aRect ) { - bRet = TRUE; + bRet = sal_True; break; } } @@ -275,9 +275,9 @@ BOOL Animation::IsTransparent() const // ----------------------------------------------------------------------- -ULONG Animation::GetSizeBytes() const +sal_uLong Animation::GetSizeBytes() const { - ULONG nSizeBytes = GetBitmapEx().GetSizeBytes(); + sal_uLong nSizeBytes = GetBitmapEx().GetSizeBytes(); for( long i = 0, nCount = maList.Count(); i < nCount; i++ ) { @@ -290,7 +290,7 @@ ULONG Animation::GetSizeBytes() const // ----------------------------------------------------------------------- -ULONG Animation::GetChecksum() const +sal_uLong Animation::GetChecksum() const { SVBT32 aBT32; sal_uInt32 nCrc = GetBitmapEx().GetChecksum(); @@ -318,7 +318,7 @@ ULONG Animation::GetChecksum() const // ----------------------------------------------------------------------- -BOOL Animation::Start( OutputDevice* pOut, const Point& rDestPt, long nExtraData, +sal_Bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, long nExtraData, OutputDevice* pFirstFrameOutDev ) { return Start( pOut, rDestPt, pOut->PixelToLogic( maGlobalSize ), nExtraData, pFirstFrameOutDev ); @@ -326,10 +326,10 @@ BOOL Animation::Start( OutputDevice* pOut, const Point& rDestPt, long nExtraData // ----------------------------------------------------------------------- -BOOL Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& rDestSz, long nExtraData, +sal_Bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& rDestSz, long nExtraData, OutputDevice* pFirstFrameOutDev ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( maList.Count() ) { @@ -362,7 +362,7 @@ BOOL Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& rDe if( !mpViewList->Count() ) { maTimer.Stop(); - mbIsInAnimation = FALSE; + mbIsInAnimation = sal_False; mnPos = 0UL; } @@ -372,13 +372,13 @@ BOOL Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& rDe if( !mbIsInAnimation ) { ImplRestartTimer( ( (AnimationBitmap*) maList.GetObject( mnPos ) )->nWait ); - mbIsInAnimation = TRUE; + mbIsInAnimation = sal_True; } } else Draw( pOut, rDestPt, rDestSz ); - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -404,7 +404,7 @@ void Animation::Stop( OutputDevice* pOut, long nExtraData ) if( !mpViewList->Count() ) { maTimer.Stop(); - mbIsInAnimation = FALSE; + mbIsInAnimation = sal_False; } } @@ -419,7 +419,7 @@ void Animation::Draw( OutputDevice* pOut, const Point& rDestPt ) const void Animation::Draw( OutputDevice* pOut, const Point& rDestPt, const Size& rDestSz ) const { - const ULONG nCount = maList.Count(); + const sal_uLong nCount = maList.Count(); if( nCount ) { @@ -431,7 +431,7 @@ void Animation::Draw( OutputDevice* pOut, const Point& rDestPt, const Size& rDes pObj->aBmpEx.Draw( pOut, rDestPt, rDestSz ); else { - const ULONG nOldPos = mnPos; + const sal_uLong nOldPos = mnPos; ( (Animation*) this )->mnPos = mbLoopTerminated ? ( nCount - 1UL ) : mnPos; delete new ImplAnimView( (Animation*) this, pOut, rDestPt, rDestSz, 0 ); ( (Animation*) this )->mnPos = nOldPos; @@ -441,9 +441,9 @@ void Animation::Draw( OutputDevice* pOut, const Point& rDestPt, const Size& rDes // ----------------------------------------------------------------------- -void Animation::ImplRestartTimer( ULONG nTimeout ) +void Animation::ImplRestartTimer( sal_uLong nTimeout ) { - maTimer.SetTimeout( Max( nTimeout, (ULONG)(MIN_TIMEOUT + ( mnAnimCount - 1 ) * INC_TIMEOUT) ) * 10L ); + maTimer.SetTimeout( Max( nTimeout, (sal_uLong)(MIN_TIMEOUT + ( mnAnimCount - 1 ) * INC_TIMEOUT) ) * 10L ); maTimer.Start(); } @@ -451,12 +451,12 @@ void Animation::ImplRestartTimer( ULONG nTimeout ) IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) { - const ULONG nAnimCount = maList.Count(); + const sal_uLong nAnimCount = maList.Count(); if( nAnimCount ) { ImplAnimView* pView; - BOOL bGlobalPause = TRUE; + sal_Bool bGlobalPause = sal_True; if( maNotifyLink.IsSet() ) { @@ -482,7 +482,7 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) pView = (ImplAnimView*) pAInfo->pViewData; pView->ImplPause( pAInfo->bPause ); - pView->ImplSetMarked( TRUE ); + pView->ImplSetMarked( sal_True ); } // delete AInfo structures @@ -502,15 +502,15 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) else { if( !pView->ImplIsPause() ) - bGlobalPause = FALSE; + bGlobalPause = sal_False; - pView->ImplSetMarked( FALSE ); + pView->ImplSetMarked( sal_False ); pView = (ImplAnimView*) mpViewList->Next(); } } } else - bGlobalPause = FALSE; + bGlobalPause = sal_False; if( !mpViewList->Count() ) Stop(); @@ -525,7 +525,7 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) if( mnLoops == 1 ) { Stop(); - mbLoopTerminated = TRUE; + mbLoopTerminated = sal_True; mnPos = nAnimCount - 1UL; maBitmapEx = ( (AnimationBitmap*) maList.GetObject( mnPos ) )->aBmpEx; return 0L; @@ -573,9 +573,9 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) // ----------------------------------------------------------------------- -BOOL Animation::Insert( const AnimationBitmap& rStepBmp ) +sal_Bool Animation::Insert( const AnimationBitmap& rStepBmp ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !IsInAnimation() ) { @@ -589,7 +589,7 @@ BOOL Animation::Insert( const AnimationBitmap& rStepBmp ) if( maList.Count() == 1 ) maBitmapEx = rStepBmp.aBmpEx; - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -597,7 +597,7 @@ BOOL Animation::Insert( const AnimationBitmap& rStepBmp ) // ----------------------------------------------------------------------- -const AnimationBitmap& Animation::Get( USHORT nAnimation ) const +const AnimationBitmap& Animation::Get( sal_uInt16 nAnimation ) const { DBG_ASSERT( ( nAnimation < maList.Count() ), "No object at this position" ); return *(AnimationBitmap*) maList.GetObject( nAnimation ); @@ -605,7 +605,7 @@ const AnimationBitmap& Animation::Get( USHORT nAnimation ) const // ----------------------------------------------------------------------- -void Animation::Replace( const AnimationBitmap& rNewAnimationBitmap, USHORT nAnimation ) +void Animation::Replace( const AnimationBitmap& rNewAnimationBitmap, sal_uInt16 nAnimation ) { DBG_ASSERT( ( nAnimation < maList.Count() ), "No object at this position" ); @@ -624,7 +624,7 @@ void Animation::Replace( const AnimationBitmap& rNewAnimationBitmap, USHORT nAni // ----------------------------------------------------------------------- -void Animation::SetLoopCount( const ULONG nLoopCount ) +void Animation::SetLoopCount( const sal_uLong nLoopCount ) { mnLoopCount = nLoopCount; ResetLoopCount(); @@ -635,20 +635,20 @@ void Animation::SetLoopCount( const ULONG nLoopCount ) void Animation::ResetLoopCount() { mnLoops = mnLoopCount; - mbLoopTerminated = FALSE; + mbLoopTerminated = sal_False; } // ----------------------------------------------------------------------- -BOOL Animation::Convert( BmpConversion eConversion ) +sal_Bool Animation::Convert( BmpConversion eConversion ) { DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); - BOOL bRet; + sal_Bool bRet; if( !IsInAnimation() && maList.Count() ) { - bRet = TRUE; + bRet = sal_True; for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Convert( eConversion ); @@ -656,22 +656,22 @@ BOOL Animation::Convert( BmpConversion eConversion ) maBitmapEx.Convert( eConversion ); } else - bRet = FALSE; + bRet = sal_False; return bRet; } // ----------------------------------------------------------------------- -BOOL Animation::ReduceColors( USHORT nNewColorCount, BmpReduce eReduce ) +sal_Bool Animation::ReduceColors( sal_uInt16 nNewColorCount, BmpReduce eReduce ) { DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); - BOOL bRet; + sal_Bool bRet; if( !IsInAnimation() && maList.Count() ) { - bRet = TRUE; + bRet = sal_True; for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.ReduceColors( nNewColorCount, eReduce ); @@ -679,22 +679,22 @@ BOOL Animation::ReduceColors( USHORT nNewColorCount, BmpReduce eReduce ) maBitmapEx.ReduceColors( nNewColorCount, eReduce ); } else - bRet = FALSE; + bRet = sal_False; return bRet; } // ----------------------------------------------------------------------- -BOOL Animation::Invert() +sal_Bool Animation::Invert() { DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); - BOOL bRet; + sal_Bool bRet; if( !IsInAnimation() && maList.Count() ) { - bRet = TRUE; + bRet = sal_True; for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Invert(); @@ -702,22 +702,22 @@ BOOL Animation::Invert() maBitmapEx.Invert(); } else - bRet = FALSE; + bRet = sal_False; return bRet; } // ----------------------------------------------------------------------- -BOOL Animation::Mirror( ULONG nMirrorFlags ) +sal_Bool Animation::Mirror( sal_uLong nMirrorFlags ) { DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); - BOOL bRet; + sal_Bool bRet; if( !IsInAnimation() && maList.Count() ) { - bRet = TRUE; + bRet = sal_True; if( nMirrorFlags ) { @@ -725,7 +725,7 @@ BOOL Animation::Mirror( ULONG nMirrorFlags ) pStepBmp && bRet; pStepBmp = (AnimationBitmap*) maList.Next() ) { - if( ( bRet = pStepBmp->aBmpEx.Mirror( nMirrorFlags ) ) == TRUE ) + if( ( bRet = pStepBmp->aBmpEx.Mirror( nMirrorFlags ) ) == sal_True ) { if( nMirrorFlags & BMP_MIRROR_HORZ ) pStepBmp->aPosPix.X() = maGlobalSize.Width() - pStepBmp->aPosPix.X() - pStepBmp->aSizePix.Width(); @@ -739,22 +739,22 @@ BOOL Animation::Mirror( ULONG nMirrorFlags ) } } else - bRet = FALSE; + bRet = sal_False; return bRet; } // ----------------------------------------------------------------------- -BOOL Animation::Dither( ULONG nDitherFlags ) +sal_Bool Animation::Dither( sal_uLong nDitherFlags ) { DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); - BOOL bRet; + sal_Bool bRet; if( !IsInAnimation() && maList.Count() ) { - bRet = TRUE; + bRet = sal_True; for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Dither( nDitherFlags ); @@ -762,24 +762,24 @@ BOOL Animation::Dither( ULONG nDitherFlags ) maBitmapEx.Dither( nDitherFlags ); } else - bRet = FALSE; + bRet = sal_False; return bRet; } // ----------------------------------------------------------------------- -BOOL Animation::Adjust( short nLuminancePercent, short nContrastPercent, +sal_Bool Animation::Adjust( short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, short nChannelBPercent, - double fGamma, BOOL bInvert ) + double fGamma, sal_Bool bInvert ) { DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); - BOOL bRet; + sal_Bool bRet; if( !IsInAnimation() && maList.Count() ) { - bRet = TRUE; + bRet = sal_True; for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) { @@ -793,22 +793,22 @@ BOOL Animation::Adjust( short nLuminancePercent, short nContrastPercent, fGamma, bInvert ); } else - bRet = FALSE; + bRet = sal_False; return bRet; } // ----------------------------------------------------------------------- -BOOL Animation::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, const Link* pProgress ) +sal_Bool Animation::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, const Link* pProgress ) { DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); - BOOL bRet; + sal_Bool bRet; if( !IsInAnimation() && maList.Count() ) { - bRet = TRUE; + bRet = sal_True; for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Filter( eFilter, pFilterParam, pProgress ); @@ -816,7 +816,7 @@ BOOL Animation::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, c maBitmapEx.Filter( eFilter, pFilterParam, pProgress ); } else - bRet = FALSE; + bRet = sal_False; return bRet; } @@ -825,12 +825,12 @@ BOOL Animation::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, c SvStream& operator<<( SvStream& rOStm, const Animation& rAnimation ) { - const USHORT nCount = rAnimation.Count(); + const sal_uInt16 nCount = rAnimation.Count(); if( nCount ) { const ByteString aDummyStr; - const UINT32 nDummy32 = 0UL; + const sal_uInt32 nDummy32 = 0UL; // Falls keine BitmapEx gesetzt wurde, schreiben wir // einfach die erste Bitmap der Animation @@ -840,22 +840,22 @@ SvStream& operator<<( SvStream& rOStm, const Animation& rAnimation ) rOStm << rAnimation.GetBitmapEx(); // Kennung schreiben ( SDANIMA1 ) - rOStm << (UINT32) 0x5344414e << (UINT32) 0x494d4931; + rOStm << (sal_uInt32) 0x5344414e << (sal_uInt32) 0x494d4931; - for( USHORT i = 0; i < nCount; i++ ) + for( sal_uInt16 i = 0; i < nCount; i++ ) { const AnimationBitmap& rAnimBmp = rAnimation.Get( i ); - const UINT16 nRest = nCount - i - 1; + const sal_uInt16 nRest = nCount - i - 1; // AnimationBitmap schreiben rOStm << rAnimBmp.aBmpEx; rOStm << rAnimBmp.aPosPix; rOStm << rAnimBmp.aSizePix; rOStm << rAnimation.maGlobalSize; - rOStm << (UINT16) ( ( ANIMATION_TIMEOUT_ON_CLICK == rAnimBmp.nWait ) ? 65535 : rAnimBmp.nWait ); - rOStm << (UINT16) rAnimBmp.eDisposal; - rOStm << (BYTE) rAnimBmp.bUserInput; - rOStm << (UINT32) rAnimation.mnLoopCount; + rOStm << (sal_uInt16) ( ( ANIMATION_TIMEOUT_ON_CLICK == rAnimBmp.nWait ) ? 65535 : rAnimBmp.nWait ); + rOStm << (sal_uInt16) rAnimBmp.eDisposal; + rOStm << (sal_uInt8) rAnimBmp.bUserInput; + rOStm << (sal_uInt32) rAnimation.mnLoopCount; rOStm << nDummy32; // unbenutzt rOStm << nDummy32; // unbenutzt rOStm << nDummy32; // unbenutzt @@ -872,10 +872,10 @@ SvStream& operator<<( SvStream& rOStm, const Animation& rAnimation ) SvStream& operator>>( SvStream& rIStm, Animation& rAnimation ) { Bitmap aBmp; - ULONG nStmPos = rIStm.Tell(); - UINT32 nAnimMagic1, nAnimMagic2; - USHORT nOldFormat = rIStm.GetNumberFormatInt(); - BOOL bReadAnimations = FALSE; + sal_uLong nStmPos = rIStm.Tell(); + sal_uInt32 nAnimMagic1, nAnimMagic2; + sal_uInt16 nOldFormat = rIStm.GetNumberFormatInt(); + sal_Bool bReadAnimations = sal_False; rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); nStmPos = rIStm.Tell(); @@ -886,7 +886,7 @@ SvStream& operator>>( SvStream& rIStm, Animation& rAnimation ) // Wenn die BitmapEx am Anfang schon gelesen // wurde ( von Graphic ), koennen wir direkt die Animationsbitmaps einlesen if( ( nAnimMagic1 == 0x5344414e ) && ( nAnimMagic2 == 0x494d4931 ) && !rIStm.GetError() ) - bReadAnimations = TRUE; + bReadAnimations = sal_True; // ansonsten versuchen wir erstmal die Bitmap(-Ex) zu lesen else { @@ -896,7 +896,7 @@ SvStream& operator>>( SvStream& rIStm, Animation& rAnimation ) rIStm >> nAnimMagic1 >> nAnimMagic2; if( ( nAnimMagic1 == 0x5344414e ) && ( nAnimMagic2 == 0x494d4931 ) && !rIStm.GetError() ) - bReadAnimations = TRUE; + bReadAnimations = sal_True; else rIStm.Seek( nStmPos ); } @@ -907,9 +907,9 @@ SvStream& operator>>( SvStream& rIStm, Animation& rAnimation ) AnimationBitmap aAnimBmp; BitmapEx aBmpEx; ByteString aDummyStr; - UINT32 nTmp32; - UINT16 nTmp16; - BYTE cTmp; + sal_uInt32 nTmp32; + sal_uInt16 nTmp16; + sal_uInt8 cTmp; do { @@ -919,8 +919,8 @@ SvStream& operator>>( SvStream& rIStm, Animation& rAnimation ) rIStm >> rAnimation.maGlobalSize; rIStm >> nTmp16; aAnimBmp.nWait = ( ( 65535 == nTmp16 ) ? ANIMATION_TIMEOUT_ON_CLICK : nTmp16 ); rIStm >> nTmp16; aAnimBmp.eDisposal = ( Disposal) nTmp16; - rIStm >> cTmp; aAnimBmp.bUserInput = (BOOL) cTmp; - rIStm >> nTmp32; rAnimation.mnLoopCount = (USHORT) nTmp32; + rIStm >> cTmp; aAnimBmp.bUserInput = (sal_Bool) cTmp; + rIStm >> nTmp32; rAnimation.mnLoopCount = (sal_uInt16) nTmp32; rIStm >> nTmp32; // unbenutzt rIStm >> nTmp32; // unbenutzt rIStm >> nTmp32; // unbenutzt diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index 8d13cdb41a0f..a0b48f4ee124 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -86,7 +86,7 @@ Bitmap::Bitmap( SalBitmap* pSalBitmap ) // ------------------------------------------------------------------ -Bitmap::Bitmap( const Size& rSizePixel, USHORT nBitCount, const BitmapPalette* pPal ) +Bitmap::Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalette* pPal ) { if( rSizePixel.Width() && rSizePixel.Height() ) { @@ -126,12 +126,12 @@ Bitmap::Bitmap( const Size& rSizePixel, USHORT nBitCount, const BitmapPalette* p // Dither-Palette erzeugen if( 8 == nBitCount ) { - USHORT nActCol = 16; + sal_uInt16 nActCol = 16; - for( USHORT nB = 0; nB < 256; nB += 51 ) - for( USHORT nG = 0; nG < 256; nG += 51 ) - for( USHORT nR = 0; nR < 256; nR += 51 ) - aPal[ nActCol++ ] = BitmapColor( (BYTE) nR, (BYTE) nG, (BYTE) nB ); + for( sal_uInt16 nB = 0; nB < 256; nB += 51 ) + for( sal_uInt16 nG = 0; nG < 256; nG += 51 ) + for( sal_uInt16 nR = 0; nR < 256; nR += 51 ) + aPal[ nActCol++ ] = BitmapColor( (sal_uInt8) nR, (sal_uInt8) nG, (sal_uInt8) nB ); // Standard-Office-Farbe setzen aPal[ nActCol++ ] = BitmapColor( 0, 184, 255 ); @@ -196,11 +196,11 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries ) { if( !aGreyPalette16.GetEntryCount() ) { - BYTE cGrey = 0, cGreyInc = 17; + sal_uInt8 cGrey = 0, cGreyInc = 17; aGreyPalette16.SetEntryCount( 16 ); - for( USHORT i = 0; i < 16; i++, cGrey = sal::static_int_cast<BYTE>(cGrey + cGreyInc) ) + for( sal_uInt16 i = 0; i < 16; i++, cGrey = sal::static_int_cast<sal_uInt8>(cGrey + cGreyInc) ) aGreyPalette16[ i ] = BitmapColor( cGrey, cGrey, cGrey ); } @@ -212,8 +212,8 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries ) { aGreyPalette256.SetEntryCount( 256 ); - for( USHORT i = 0; i < 256; i++ ) - aGreyPalette256[ i ] = BitmapColor( (BYTE) i, (BYTE) i, (BYTE) i ); + for( sal_uInt16 i = 0; i < 256; i++ ) + aGreyPalette256[ i ] = BitmapColor( (sal_uInt8) i, (sal_uInt8) i, (sal_uInt8) i ); } return aGreyPalette256; @@ -235,9 +235,13 @@ bool BitmapPalette::IsGreyPalette() const const int nEntryCount = GetEntryCount(); if( !nEntryCount ) // NOTE: an empty palette means 1:1 mapping return true; - const BitmapPalette& rGreyPalette = Bitmap::GetGreyPalette( nEntryCount ); - if( rGreyPalette == *this ) - return true; + // see above: only certain entry values will result in a valid call to GetGreyPalette + if( nEntryCount == 2 || nEntryCount == 4 || nEntryCount == 16 || nEntryCount == 256 ) + { + const BitmapPalette& rGreyPalette = Bitmap::GetGreyPalette( nEntryCount ); + if( rGreyPalette == *this ) + return true; + } // TODO: is it worth to compare the entries? return false; } @@ -260,7 +264,7 @@ Bitmap& Bitmap::operator=( const Bitmap& rBitmap ) // ------------------------------------------------------------------ -BOOL Bitmap::IsEqual( const Bitmap& rBmp ) const +sal_Bool Bitmap::IsEqual( const Bitmap& rBmp ) const { return( IsSameInstance( rBmp ) || ( rBmp.GetSizePixel() == GetSizePixel() && @@ -309,17 +313,17 @@ void Bitmap::SetSourceSizePixel( const Size& rSize) // ------------------------------------------------------------------ -USHORT Bitmap::GetBitCount() const +sal_uInt16 Bitmap::GetBitCount() const { return( mpImpBmp ? mpImpBmp->ImplGetBitCount() : 0 ); } // ------------------------------------------------------------------ -BOOL Bitmap::HasGreyPalette() const +sal_Bool Bitmap::HasGreyPalette() const { - const USHORT nBitCount = GetBitCount(); - BOOL bRet = FALSE; + const sal_uInt16 nBitCount = GetBitCount(); + sal_Bool bRet = sal_False; if( 1 == nBitCount ) { @@ -332,12 +336,12 @@ BOOL Bitmap::HasGreyPalette() const if( rCol0.GetRed() == rCol0.GetGreen() && rCol0.GetRed() == rCol0.GetBlue() && rCol1.GetRed() == rCol1.GetGreen() && rCol1.GetRed() == rCol1.GetBlue() ) { - bRet = TRUE; + bRet = sal_True; } ( (Bitmap*) this )->ReleaseAccess( pRAcc ); } else - bRet = TRUE; + bRet = sal_True; } else if( 4 == nBitCount || 8 == nBitCount ) { @@ -346,7 +350,7 @@ BOOL Bitmap::HasGreyPalette() const if( pRAcc ) { if( pRAcc->HasPalette() && ( (BitmapPalette&) pRAcc->GetPalette() == GetGreyPalette( 1 << nBitCount ) ) ) - bRet = TRUE; + bRet = sal_True; ( (Bitmap*) this )->ReleaseAccess( pRAcc ); } @@ -357,9 +361,9 @@ BOOL Bitmap::HasGreyPalette() const // ------------------------------------------------------------------ -ULONG Bitmap::GetChecksum() const +sal_uLong Bitmap::GetChecksum() const { - ULONG nRet = 0UL; + sal_uLong nRet = 0UL; if( mpImpBmp ) { @@ -523,44 +527,44 @@ void Bitmap::ReleaseAccess( BitmapReadAccess* pBitmapAccess ) // ------------------------------------------------------------------ -BOOL Bitmap::Erase( const Color& rFillColor ) +sal_Bool Bitmap::Erase( const Color& rFillColor ) { if( !(*this) ) - return TRUE; + return sal_True; BitmapWriteAccess* pWriteAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pWriteAcc ) { - const ULONG nFormat = pWriteAcc->GetScanlineFormat(); - BYTE cIndex = 0; - BOOL bFast = FALSE; + const sal_uLong nFormat = pWriteAcc->GetScanlineFormat(); + sal_uInt8 cIndex = 0; + sal_Bool bFast = sal_False; switch( nFormat ) { case( BMP_FORMAT_1BIT_MSB_PAL ): case( BMP_FORMAT_1BIT_LSB_PAL ): { - cIndex = (BYTE) pWriteAcc->GetBestPaletteIndex( rFillColor ); + cIndex = (sal_uInt8) pWriteAcc->GetBestPaletteIndex( rFillColor ); cIndex = ( cIndex ? 255 : 0 ); - bFast = TRUE; + bFast = sal_True; } break; case( BMP_FORMAT_4BIT_MSN_PAL ): case( BMP_FORMAT_4BIT_LSN_PAL ): { - cIndex = (BYTE) pWriteAcc->GetBestPaletteIndex( rFillColor ); + cIndex = (sal_uInt8) pWriteAcc->GetBestPaletteIndex( rFillColor ); cIndex = cIndex | ( cIndex << 4 ); - bFast = TRUE; + bFast = sal_True; } break; case( BMP_FORMAT_8BIT_PAL ): { - cIndex = (BYTE) pWriteAcc->GetBestPaletteIndex( rFillColor ); - bFast = TRUE; + cIndex = (sal_uInt8) pWriteAcc->GetBestPaletteIndex( rFillColor ); + bFast = sal_True; } break; @@ -571,21 +575,21 @@ BOOL Bitmap::Erase( const Color& rFillColor ) ( rFillColor.GetRed() == rFillColor.GetBlue() ) ) { cIndex = rFillColor.GetRed(); - bFast = TRUE; + bFast = sal_True; } else - bFast = FALSE; + bFast = sal_False; } break; default: - bFast = FALSE; + bFast = sal_False; break; } if( bFast ) { - const ULONG nBufSize = pWriteAcc->GetScanlineSize() * pWriteAcc->Height(); + const sal_uLong nBufSize = pWriteAcc->GetScanlineSize() * pWriteAcc->Height(); memset( pWriteAcc->GetBuffer(), cIndex, nBufSize ); } else @@ -597,7 +601,7 @@ BOOL Bitmap::Erase( const Color& rFillColor ) } ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -605,19 +609,19 @@ BOOL Bitmap::Erase( const Color& rFillColor ) // ------------------------------------------------------------------ -BOOL Bitmap::Invert() +sal_Bool Bitmap::Invert() { BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pAcc ) { if( pAcc->HasPalette() ) { BitmapPalette aBmpPal( pAcc->GetPalette() ); - const USHORT nCount = aBmpPal.GetEntryCount(); + const sal_uInt16 nCount = aBmpPal.GetEntryCount(); - for( USHORT i = 0; i < nCount; i++ ) + for( sal_uInt16 i = 0; i < nCount; i++ ) aBmpPal[ i ].Invert(); pAcc->SetPalette( aBmpPal ); @@ -633,7 +637,7 @@ BOOL Bitmap::Invert() } ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -641,11 +645,11 @@ BOOL Bitmap::Invert() // ------------------------------------------------------------------ -BOOL Bitmap::Mirror( ULONG nMirrorFlags ) +sal_Bool Bitmap::Mirror( sal_uLong nMirrorFlags ) { - BOOL bHorz = ( ( nMirrorFlags & BMP_MIRROR_HORZ ) == BMP_MIRROR_HORZ ); - BOOL bVert = ( ( nMirrorFlags & BMP_MIRROR_VERT ) == BMP_MIRROR_VERT ); - BOOL bRet = FALSE; + sal_Bool bHorz = ( ( nMirrorFlags & BMP_MIRROR_HORZ ) == BMP_MIRROR_HORZ ); + sal_Bool bVert = ( ( nMirrorFlags & BMP_MIRROR_VERT ) == BMP_MIRROR_VERT ); + sal_Bool bRet = sal_False; if( bHorz && !bVert ) { @@ -670,7 +674,7 @@ BOOL Bitmap::Mirror( ULONG nMirrorFlags ) } ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } } else if( bVert && !bHorz ) @@ -680,7 +684,7 @@ BOOL Bitmap::Mirror( ULONG nMirrorFlags ) if( pAcc ) { const long nScanSize = pAcc->GetScanlineSize(); - BYTE* pBuffer = new BYTE[ nScanSize ]; + sal_uInt8* pBuffer = new sal_uInt8[ nScanSize ]; const long nHeight = pAcc->Height(); const long nHeight1 = nHeight - 1L; const long nHeight_2 = nHeight >> 1L; @@ -694,7 +698,7 @@ BOOL Bitmap::Mirror( ULONG nMirrorFlags ) delete[] pBuffer; ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } } else if( bHorz && bVert ) @@ -731,26 +735,26 @@ BOOL Bitmap::Mirror( ULONG nMirrorFlags ) } ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } } else - bRet = TRUE; + bRet = sal_True; return bRet; } // ------------------------------------------------------------------ -BOOL Bitmap::Rotate( long nAngle10, const Color& rFillColor ) +sal_Bool Bitmap::Rotate( long nAngle10, const Color& rFillColor ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; nAngle10 %= 3600L; nAngle10 = ( nAngle10 < 0L ) ? ( 3599L + nAngle10 ) : nAngle10; if( !nAngle10 ) - bRet = TRUE; + bRet = sal_True; else if( 1800L == nAngle10 ) bRet = Mirror( BMP_MIRROR_HORZ | BMP_MIRROR_VERT ); else @@ -800,7 +804,7 @@ BOOL Bitmap::Rotate( long nAngle10, const Color& rFillColor ) Point aTmpPoint; Rectangle aTmpRectangle( aTmpPoint, aSizePix ); Polygon aPoly( aTmpRectangle ); - aPoly.Rotate( aTmpPoint, (USHORT) nAngle10 ); + aPoly.Rotate( aTmpPoint, (sal_uInt16) nAngle10 ); Rectangle aNewBound( aPoly.GetBoundRect() ); const Size aNewSizePix( aNewBound.GetSize() ); @@ -876,7 +880,7 @@ BOOL Bitmap::Rotate( long nAngle10, const Color& rFillColor ) ReleaseAccess( pReadAcc ); } - if( ( bRet = !!aRotatedBmp ) == TRUE ) + if( ( bRet = !!aRotatedBmp ) == sal_True ) ImplAssignWithSize( aRotatedBmp ); } @@ -885,11 +889,11 @@ BOOL Bitmap::Rotate( long nAngle10, const Color& rFillColor ) // ------------------------------------------------------------------ -BOOL Bitmap::Crop( const Rectangle& rRectPixel ) +sal_Bool Bitmap::Crop( const Rectangle& rRectPixel ) { const Size aSizePix( GetSizePixel() ); Rectangle aRect( rRectPixel ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; aRect.Intersection( Rectangle( Point(), aSizePix ) ); @@ -916,7 +920,7 @@ BOOL Bitmap::Crop( const Rectangle& rRectPixel ) pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPixel( nY2, nX2 ) ); aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -931,12 +935,12 @@ BOOL Bitmap::Crop( const Rectangle& rRectPixel ) // ------------------------------------------------------------------ -BOOL Bitmap::CopyPixel( const Rectangle& rRectDst, +sal_Bool Bitmap::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, const Bitmap* pBmpSrc ) { const Size aSizePix( GetSizePixel() ); Rectangle aRectDst( rRectDst ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; aRectDst.Intersection( Rectangle( Point(), aSizePix ) ); @@ -947,8 +951,8 @@ BOOL Bitmap::CopyPixel( const Rectangle& rRectDst, Bitmap* pSrc = (Bitmap*) pBmpSrc; const Size aCopySizePix( pSrc->GetSizePixel() ); Rectangle aRectSrc( rRectSrc ); - const USHORT nSrcBitCount = pBmpSrc->GetBitCount(); - const USHORT nDstBitCount = GetBitCount(); + const sal_uInt16 nSrcBitCount = pBmpSrc->GetBitCount(); + const sal_uInt16 nDstBitCount = GetBitCount(); if( nSrcBitCount > nDstBitCount ) { @@ -976,25 +980,25 @@ BOOL Bitmap::CopyPixel( const Rectangle& rRectDst, { const long nSrcCount = pDstAcc->GetPaletteEntryCount(); const long nDstCount = 1 << nDstBitCount; - BOOL bFound; + sal_Bool bFound; for( long i = 0L; ( i < nSrcCount ) && ( nNextIndex < nSrcCount ); i++ ) { - const BitmapColor& rSrcCol = pSrcAcc->GetPaletteColor( (USHORT) i ); + const BitmapColor& rSrcCol = pSrcAcc->GetPaletteColor( (sal_uInt16) i ); - bFound = FALSE; + bFound = sal_False; for( long j = 0L; j < nDstCount; j++ ) { - if( rSrcCol == pDstAcc->GetPaletteColor( (USHORT) j ) ) + if( rSrcCol == pDstAcc->GetPaletteColor( (sal_uInt16) j ) ) { - bFound = TRUE; + bFound = sal_True; break; } } if( !bFound ) - pDstAcc->SetPaletteColor( (USHORT) nNextIndex++, rSrcCol ); + pDstAcc->SetPaletteColor( (sal_uInt16) nNextIndex++, rSrcCol ); } } @@ -1026,14 +1030,14 @@ BOOL Bitmap::CopyPixel( const Rectangle& rRectDst, if( pReadAcc->HasPalette() && pWriteAcc->HasPalette() ) { - const USHORT nCount = pReadAcc->GetPaletteEntryCount(); - BYTE* pMap = new BYTE[ nCount ]; + const sal_uInt16 nCount = pReadAcc->GetPaletteEntryCount(); + sal_uInt8* pMap = new sal_uInt8[ nCount ]; // Index-Map fuer Farbtabelle // aufbauen, da das Bild ja (relativ) farbgenau // kopiert werden soll - for( USHORT i = 0; i < nCount; i++ ) - pMap[ i ] = (BYTE) pWriteAcc->GetBestPaletteIndex( pReadAcc->GetPaletteColor( i ) ); + for( sal_uInt16 i = 0; i < nCount; i++ ) + pMap[ i ] = (sal_uInt8) pWriteAcc->GetBestPaletteIndex( pReadAcc->GetPaletteColor( i ) ); for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ ) for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ ) @@ -1109,7 +1113,7 @@ BOOL Bitmap::CopyPixel( const Rectangle& rRectDst, } ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } } } @@ -1120,9 +1124,9 @@ BOOL Bitmap::CopyPixel( const Rectangle& rRectDst, // ------------------------------------------------------------------ -BOOL Bitmap::Expand( ULONG nDX, ULONG nDY, const Color* pInitColor ) +sal_Bool Bitmap::Expand( sal_uLong nDX, sal_uLong nDY, const Color* pInitColor ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( nDX || nDY ) { @@ -1166,7 +1170,7 @@ BOOL Bitmap::Expand( ULONG nDX, ULONG nDY, const Color* pInitColor ) pWriteAcc->SetPixel( nY, nX, aColor ); aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -1181,11 +1185,11 @@ BOOL Bitmap::Expand( ULONG nDX, ULONG nDY, const Color* pInitColor ) // ------------------------------------------------------------------ -Bitmap Bitmap::CreateMask( const Color& rTransColor, ULONG nTol ) const +Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uLong nTol ) const { Bitmap aNewBmp( GetSizePixel(), 1 ); BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pWriteAcc ) { @@ -1207,7 +1211,7 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, ULONG nTol ) const pReadAcc->GetScanlineFormat() == BMP_FORMAT_4BIT_LSN_PAL ) { // optimized for 4Bit-MSN/LSN source palette - const BYTE cTest = aTest.GetIndex(); + const sal_uInt8 cTest = aTest.GetIndex(); const long nShiftInit = ( ( pReadAcc->GetScanlineFormat() == BMP_FORMAT_4BIT_MSN_PAL ) ? 4 : 0 ); if( pWriteAcc->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL && @@ -1245,7 +1249,7 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, ULONG nTol ) const else if( pReadAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) { // optimized for 8Bit source palette - const BYTE cTest = aTest.GetIndex(); + const sal_uInt8 cTest = aTest.GetIndex(); if( pWriteAcc->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL && aWhite.GetIndex() == 1 ) @@ -1352,7 +1356,7 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, ULONG nTol ) const } ( (Bitmap*) this )->ReleaseAccess( pReadAcc ); - bRet = TRUE; + bRet = sal_True; } aNewBmp.ReleaseAccess( pWriteAcc ); @@ -1424,11 +1428,11 @@ Region Bitmap::CreateRegion( const Color& rColor, const Rectangle& rRect ) const // ------------------------------------------------------------------ -BOOL Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) +sal_Bool Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) { BitmapReadAccess* pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess(); BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pMaskAcc && pAcc ) { @@ -1439,15 +1443,15 @@ BOOL Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) if( pAcc->HasPalette() ) { - const USHORT nActColors = pAcc->GetPaletteEntryCount(); - const USHORT nMaxColors = 1 << pAcc->GetBitCount(); + const sal_uInt16 nActColors = pAcc->GetPaletteEntryCount(); + const sal_uInt16 nMaxColors = 1 << pAcc->GetBitCount(); // erst einmal naechste Farbe nehmen aReplace = pAcc->GetBestMatchingColor( rReplaceColor ); // falls Palettenbild, und die zu setzende Farbe ist nicht // in der Palette, suchen wir nach freien Eintraegen (teuer) - if( pAcc->GetPaletteColor( (BYTE) aReplace ) != BitmapColor( rReplaceColor ) ) + if( pAcc->GetPaletteColor( (sal_uInt8) aReplace ) != BitmapColor( rReplaceColor ) ) { // erst einmal nachsehen, ob wir unsere ReplaceColor // nicht auf einen freien Platz am Ende der Palette @@ -1456,26 +1460,26 @@ BOOL Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) { pAcc->SetPaletteEntryCount( nActColors + 1 ); pAcc->SetPaletteColor( nActColors, rReplaceColor ); - aReplace = BitmapColor( (BYTE) nActColors ); + aReplace = BitmapColor( (sal_uInt8) nActColors ); } else { - BOOL* pFlags = new BOOL[ nMaxColors ]; + sal_Bool* pFlags = new sal_Bool[ nMaxColors ]; // alle Eintraege auf 0 setzen memset( pFlags, 0, nMaxColors ); for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ ) - pFlags[ (BYTE) pAcc->GetPixel( nY, nX ) ] = TRUE; + pFlags[ (sal_uInt8) pAcc->GetPixel( nY, nX ) ] = sal_True; - for( USHORT i = 0UL; i < nMaxColors; i++ ) + for( sal_uInt16 i = 0UL; i < nMaxColors; i++ ) { // Hurra, wir haben einen unbenutzten Eintrag if( !pFlags[ i ] ) { - pAcc->SetPaletteColor( (USHORT) i, rReplaceColor ); - aReplace = BitmapColor( (BYTE) i ); + pAcc->SetPaletteColor( (sal_uInt16) i, rReplaceColor ); + aReplace = BitmapColor( (sal_uInt8) i ); } } @@ -1491,7 +1495,7 @@ BOOL Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) if( pMaskAcc->GetPixel( nY, nX ) == aMaskWhite ) pAcc->SetPixel( nY, nX, aReplace ); - bRet = TRUE; + bRet = sal_True; } ( (Bitmap&) rMask ).ReleaseAccess( pMaskAcc ); @@ -1502,13 +1506,13 @@ BOOL Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) // ------------------------------------------------------------------ -BOOL Bitmap::Replace( const AlphaMask& rAlpha, const Color& rMergeColor ) +sal_Bool Bitmap::Replace( const AlphaMask& rAlpha, const Color& rMergeColor ) { Bitmap aNewBmp( GetSizePixel(), 24 ); BitmapReadAccess* pAcc = AcquireReadAccess(); BitmapReadAccess* pAlphaAcc = ( (AlphaMask&) rAlpha ).AcquireReadAccess(); BitmapWriteAccess* pNewAcc = aNewBmp.AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pAcc && pAlphaAcc && pNewAcc ) { @@ -1521,11 +1525,11 @@ BOOL Bitmap::Replace( const AlphaMask& rAlpha, const Color& rMergeColor ) for( long nX = 0L; nX < nWidth; nX++ ) { aCol = pAcc->GetColor( nY, nX ); - pNewAcc->SetPixel( nY, nX, aCol.Merge( rMergeColor, 255 - (BYTE) pAlphaAcc->GetPixel( nY, nX ) ) ); + pNewAcc->SetPixel( nY, nX, aCol.Merge( rMergeColor, 255 - (sal_uInt8) pAlphaAcc->GetPixel( nY, nX ) ) ); } } - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pAcc ); @@ -1548,7 +1552,7 @@ BOOL Bitmap::Replace( const AlphaMask& rAlpha, const Color& rMergeColor ) // ------------------------------------------------------------------ -BOOL Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULONG nTol ) +sal_Bool Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol ) { // Bitmaps with 1 bit color depth can cause problems // if they have other entries than black/white in their palette @@ -1556,7 +1560,7 @@ BOOL Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULO Convert( BMP_CONVERSION_4BIT_COLORS ); BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pAcc ) { @@ -1569,7 +1573,7 @@ BOOL Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULO if( pAcc->HasPalette() ) { - for( USHORT i = 0, nPalCount = pAcc->GetPaletteEntryCount(); i < nPalCount; i++ ) + for( sal_uInt16 i = 0, nPalCount = pAcc->GetPaletteEntryCount(); i < nPalCount; i++ ) { const BitmapColor& rCol = pAcc->GetPaletteColor( i ); @@ -1603,7 +1607,7 @@ BOOL Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULO } ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -1611,8 +1615,8 @@ BOOL Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULO // ------------------------------------------------------------------ -BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, - ULONG nColorCount, ULONG* _pTols ) +sal_Bool Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, + sal_uLong nColorCount, sal_uLong* _pTols ) { // Bitmaps with 1 bit color depth can cause problems // if they have other entries than black/white in their palette @@ -1620,7 +1624,7 @@ BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, Convert( BMP_CONVERSION_4BIT_COLORS ); BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pAcc ) { @@ -1631,7 +1635,7 @@ BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, long* pMinB = new long[ nColorCount ]; long* pMaxB = new long[ nColorCount ]; long* pTols; - ULONG i; + sal_uLong i; if( !_pTols ) { @@ -1656,7 +1660,7 @@ BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, if( pAcc->HasPalette() ) { - for( USHORT nEntry = 0, nPalCount = pAcc->GetPaletteEntryCount(); nEntry < nPalCount; nEntry++ ) + for( sal_uInt16 nEntry = 0, nPalCount = pAcc->GetPaletteEntryCount(); nEntry < nPalCount; nEntry++ ) { const BitmapColor& rCol = pAcc->GetPaletteColor( nEntry ); @@ -1666,7 +1670,7 @@ BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, pMinG[ i ] <= rCol.GetGreen() && pMaxG[ i ] >= rCol.GetGreen() && pMinB[ i ] <= rCol.GetBlue() && pMaxB[ i ] >= rCol.GetBlue() ) { - pAcc->SetPaletteColor( (USHORT)nEntry, pReplaceColors[ i ] ); + pAcc->SetPaletteColor( (sal_uInt16)nEntry, pReplaceColors[ i ] ); break; } } @@ -1712,7 +1716,7 @@ BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, delete[] pMinB; delete[] pMaxB; ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -1739,11 +1743,11 @@ Bitmap Bitmap::CreateDisplayBitmap( OutputDevice* pDisplay ) // ------------------------------------------------------------------ -BOOL Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine ) +sal_Bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine ) { BitmapReadAccess* pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess(); BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pMaskAcc && pAcc ) { @@ -1867,7 +1871,7 @@ BOOL Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine ) break; } - bRet = TRUE; + bRet = sal_True; } ( (Bitmap&) rMask ).ReleaseAccess( pMaskAcc ); @@ -1878,7 +1882,7 @@ BOOL Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine ) // ------------------------------------------------------------------ -BOOL Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor ) +sal_Bool Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor ) { // TODO: Have a look at OutputDevice::ImplDrawAlpha() for some // optimizations. Might even consolidate the code here and there. @@ -1890,7 +1894,7 @@ BOOL Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor ) BitmapReadAccess* pAlphaAcc = const_cast<AlphaMask&>(rAlpha).AcquireReadAccess(); BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pAlphaAcc && pAcc ) { @@ -1903,7 +1907,7 @@ BOOL Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor ) pAcc->GetPixel( nY, nX ).Merge( rBackgroundColor, 255 - pAlphaAcc->GetPixel( nY, nX ) ) ); - bRet = TRUE; + bRet = sal_True; } const_cast<AlphaMask&>(rAlpha).ReleaseAccess( pAlphaAcc ); @@ -1914,7 +1918,7 @@ BOOL Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor ) // ------------------------------------------------------------------ -BOOL Bitmap::MakeMono( BYTE cThreshold ) +sal_Bool Bitmap::MakeMono( sal_uInt8 cThreshold ) { return ImplMakeMono( cThreshold ); } diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx index 7c0d565445c5..9db334395e23 100644 --- a/vcl/source/gdi/bitmap2.cxx +++ b/vcl/source/gdi/bitmap2.cxx @@ -96,14 +96,14 @@ struct DIBInfoHeader namespace { - inline USHORT discretizeBitcount( UINT16 nInputCount ) + inline sal_uInt16 discretizeBitcount( sal_uInt16 nInputCount ) { return ( nInputCount <= 1 ) ? 1 : ( nInputCount <= 4 ) ? 4 : ( nInputCount <= 8 ) ? 8 : 24; } - inline bool isBitfieldCompression( ULONG nScanlineFormat ) + inline bool isBitfieldCompression( sal_uLong nScanlineFormat ) { return nScanlineFormat == BMP_FORMAT_16BIT_TC_LSB_MASK || nScanlineFormat == BMP_FORMAT_32BIT_TC_MASK; @@ -116,7 +116,7 @@ namespace SvStream& operator>>( SvStream& rIStm, Bitmap& rBitmap ) { - rBitmap.Read( rIStm, TRUE ); + rBitmap.Read( rIStm, sal_True ); return rIStm; } @@ -124,18 +124,18 @@ SvStream& operator>>( SvStream& rIStm, Bitmap& rBitmap ) SvStream& operator<<( SvStream& rOStm, const Bitmap& rBitmap ) { - rBitmap.Write( rOStm, FALSE, TRUE ); + rBitmap.Write( rOStm, sal_False, sal_True ); return rOStm; } // ------------------------------------------------------------------ -BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader, BOOL bIsMSOFormat ) +sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader, sal_Bool bIsMSOFormat ) { - const USHORT nOldFormat = rIStm.GetNumberFormatInt(); - const ULONG nOldPos = rIStm.Tell(); - ULONG nOffset = 0UL; - BOOL bRet = FALSE; + const sal_uInt16 nOldFormat = rIStm.GetNumberFormatInt(); + const sal_uLong nOldPos = rIStm.Tell(); + sal_uLong nOffset = 0UL; + sal_Bool bRet = sal_False; rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); @@ -162,16 +162,16 @@ BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader, BOOL bIsMSOFormat ) // ------------------------------------------------------------------ -BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bIsMSOFormat ) +sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset, sal_Bool bIsMSOFormat ) { DIBInfoHeader aHeader; - const ULONG nStmPos = rIStm.Tell(); - BOOL bRet = FALSE; + const sal_uLong nStmPos = rIStm.Tell(); + sal_Bool bRet = sal_False; sal_Bool bTopDown = sal_False; if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown, bIsMSOFormat ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount ) { - const USHORT nBitCount( discretizeBitcount(aHeader.nBitCount) ); + const sal_uInt16 nBitCount( discretizeBitcount(aHeader.nBitCount) ); const Size aSizePixel( aHeader.nWidth, abs(aHeader.nHeight) ); BitmapPalette aDummyPal; @@ -180,15 +180,15 @@ BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bIs if( pAcc ) { - USHORT nColors; + sal_uInt16 nColors; SvStream* pIStm; SvMemoryStream* pMemStm = NULL; - BYTE* pData = NULL; + sal_uInt8* pData = NULL; if( nBitCount <= 8 ) { if( aHeader.nColsUsed ) - nColors = (USHORT) aHeader.nColsUsed; + nColors = (sal_uInt16) aHeader.nColsUsed; else nColors = ( 1 << aHeader.nBitCount ); } @@ -199,11 +199,11 @@ BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bIs { ZCodec aCodec; sal_uInt32 nCodedSize, nUncodedSize; - ULONG nCodedPos; + sal_uLong nCodedPos; // read coding information rIStm >> nCodedSize >> nUncodedSize >> aHeader.nCompression; - pData = (BYTE*) rtl_allocateMemory( nUncodedSize ); + pData = (sal_uInt8*) rtl_allocateMemory( nUncodedSize ); // decode buffer nCodedPos = rIStm.Tell(); @@ -218,7 +218,7 @@ BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bIs // from which we will read the bitmap data pMemStm = new SvMemoryStream; pIStm = pMemStm; - pMemStm->SetBuffer( (char*) pData, nUncodedSize, FALSE, nUncodedSize ); + pMemStm->SetBuffer( (char*) pData, nUncodedSize, sal_False, nUncodedSize ); nOffset = 0; } else @@ -266,11 +266,11 @@ BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bIs // ------------------------------------------------------------------ -BOOL Bitmap::ImplReadDIBFileHeader( SvStream& rIStm, ULONG& rOffset ) +sal_Bool Bitmap::ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset ) { - UINT32 nTmp32; - UINT16 nTmp16 = 0; - BOOL bRet = FALSE; + sal_uInt32 nTmp32; + sal_uInt16 nTmp16 = 0; + sal_Bool bRet = sal_False; rIStm >> nTmp16; @@ -301,7 +301,7 @@ BOOL Bitmap::ImplReadDIBFileHeader( SvStream& rIStm, ULONG& rOffset ) // ------------------------------------------------------------------ -BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, sal_Bool bIsMSOFormat ) +sal_Bool Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, sal_Bool bIsMSOFormat ) { // BITMAPINFOHEADER or BITMAPCOREHEADER rIStm >> rHeader.nSize; @@ -337,7 +337,7 @@ BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal // unknown Header if( rHeader.nSize < DIBINFOHEADERSIZE ) { - ULONG nUnknownSize = sizeof( rHeader.nSize ); + sal_uLong nUnknownSize = sizeof( rHeader.nSize ); rIStm >> rHeader.nWidth; nUnknownSize += sizeof( rHeader.nWidth ); rIStm >> rHeader.nHeight; nUnknownSize += sizeof( rHeader.nHeight ); @@ -418,17 +418,17 @@ BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal // ------------------------------------------------------------------ -BOOL Bitmap::ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, BOOL bQuad ) +sal_Bool Bitmap::ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, sal_Bool bQuad ) { - const USHORT nColors = rAcc.GetPaletteEntryCount(); - const ULONG nPalSize = nColors * ( bQuad ? 4UL : 3UL ); + const sal_uInt16 nColors = rAcc.GetPaletteEntryCount(); + const sal_uLong nPalSize = nColors * ( bQuad ? 4UL : 3UL ); BitmapColor aPalColor; - BYTE* pEntries = new BYTE[ nPalSize ]; + sal_uInt8* pEntries = new sal_uInt8[ nPalSize ]; rIStm.Read( pEntries, nPalSize ); - BYTE* pTmpEntry = pEntries; - for( USHORT i = 0; i < nColors; i++ ) + sal_uInt8* pTmpEntry = pEntries; + for( sal_uInt16 i = 0; i < nColors; i++ ) { aPalColor.SetBlue( *pTmpEntry++ ); aPalColor.SetGreen( *pTmpEntry++ ); @@ -447,15 +447,15 @@ BOOL Bitmap::ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, BOOL // ------------------------------------------------------------------ -BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWriteAccess& rAcc, sal_Bool bTopDown ) +sal_Bool Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWriteAccess& rAcc, sal_Bool bTopDown ) { - const ULONG nAlignedWidth = AlignedWidth4Bytes( rHeader.nWidth * rHeader.nBitCount ); - UINT32 nRMask = 0; - UINT32 nGMask = 0; - UINT32 nBMask = 0; - BOOL bNative; - BOOL bTCMask = ( rHeader.nBitCount == 16 ) || ( rHeader.nBitCount == 32 ); - BOOL bRLE = ( RLE_8 == rHeader.nCompression && rHeader.nBitCount == 8 ) || + const sal_uLong nAlignedWidth = AlignedWidth4Bytes( rHeader.nWidth * rHeader.nBitCount ); + sal_uInt32 nRMask = 0; + sal_uInt32 nGMask = 0; + sal_uInt32 nBMask = 0; + sal_Bool bNative; + sal_Bool bTCMask = ( rHeader.nBitCount == 16 ) || ( rHeader.nBitCount == 32 ); + sal_Bool bRLE = ( RLE_8 == rHeader.nCompression && rHeader.nBitCount == 8 ) || ( RLE_4 == rHeader.nCompression && rHeader.nBitCount == 4 ); // Is native format? @@ -469,7 +469,7 @@ BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWri break; default: - bNative = FALSE; + bNative = sal_False; break; } // Read data @@ -511,14 +511,14 @@ BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWri { if ( !rHeader.nSizeImage ) { - const ULONG nOldPos = rIStm.Tell(); + const sal_uLong nOldPos = rIStm.Tell(); rIStm.Seek( STREAM_SEEK_TO_END ); rHeader.nSizeImage = rIStm.Tell() - nOldPos; rIStm.Seek( nOldPos ); } - BYTE* pBuffer = (BYTE*) rtl_allocateMemory( rHeader.nSizeImage ); + sal_uInt8* pBuffer = (sal_uInt8*) rtl_allocateMemory( rHeader.nSizeImage ); rIStm.Read( (char*) pBuffer, rHeader.nSizeImage ); ImplDecodeRLE( pBuffer, rHeader, rAcc, RLE_4 == rHeader.nCompression ); @@ -529,7 +529,7 @@ BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWri { const long nWidth = rHeader.nWidth; const long nHeight = abs(rHeader.nHeight); - BYTE* pBuf = new BYTE[ nAlignedWidth ]; + sal_uInt8* pBuf = new sal_uInt8[ nAlignedWidth ]; // true color DIB's can have a (optimization) palette if( rHeader.nColsUsed && rHeader.nBitCount > 8 ) @@ -543,8 +543,8 @@ BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWri { case( 1 ): { - BYTE* pTmp; - BYTE cTmp; + sal_uInt8* pTmp; + sal_uInt8 cTmp; for( ; nCount--; nY += nI ) { @@ -559,7 +559,7 @@ BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWri cTmp = *pTmp++; } - rAcc.SetPixel( nY, nX, sal::static_int_cast<BYTE>(( cTmp >> --nShift ) & 1) ); + rAcc.SetPixel( nY, nX, sal::static_int_cast<sal_uInt8>(( cTmp >> --nShift ) & 1) ); } } } @@ -567,8 +567,8 @@ BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWri case( 4 ): { - BYTE* pTmp; - BYTE cTmp; + sal_uInt8* pTmp; + sal_uInt8 cTmp; for( ; nCount--; nY += nI ) { @@ -583,7 +583,7 @@ BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWri cTmp = *pTmp++; } - rAcc.SetPixel( nY, nX, sal::static_int_cast<BYTE>(( cTmp >> ( --nShift << 2UL ) ) & 0x0f) ); + rAcc.SetPixel( nY, nX, sal::static_int_cast<sal_uInt8>(( cTmp >> ( --nShift << 2UL ) ) & 0x0f) ); } } } @@ -591,7 +591,7 @@ BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWri case( 8 ): { - BYTE* pTmp; + sal_uInt8* pTmp; for( ; nCount--; nY += nI ) { @@ -607,15 +607,15 @@ BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWri { ColorMask aMask( nRMask, nGMask, nBMask ); BitmapColor aColor; - UINT16* pTmp16; + sal_uInt16* pTmp16; for( ; nCount--; nY += nI ) { - rIStm.Read( (char*)( pTmp16 = (UINT16*) pBuf ), nAlignedWidth ); + rIStm.Read( (char*)( pTmp16 = (sal_uInt16*) pBuf ), nAlignedWidth ); for( long nX = 0L; nX < nWidth; nX++ ) { - aMask.GetColorFor16BitLSB( aColor, (BYTE*) pTmp16++ ); + aMask.GetColorFor16BitLSB( aColor, (sal_uInt8*) pTmp16++ ); rAcc.SetPixel( nY, nX, aColor ); } } @@ -625,7 +625,7 @@ BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWri case( 24 ): { BitmapColor aPixelColor; - BYTE* pTmp; + sal_uInt8* pTmp; for( ; nCount--; nY += nI ) { @@ -646,15 +646,15 @@ BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWri { ColorMask aMask( nRMask, nGMask, nBMask ); BitmapColor aColor; - UINT32* pTmp32; + sal_uInt32* pTmp32; for( ; nCount--; nY += nI ) { - rIStm.Read( (char*)( pTmp32 = (UINT32*) pBuf ), nAlignedWidth ); + rIStm.Read( (char*)( pTmp32 = (sal_uInt32*) pBuf ), nAlignedWidth ); for( long nX = 0L; nX < nWidth; nX++ ) { - aMask.GetColorFor32Bit( aColor, (BYTE*) pTmp32++ ); + aMask.GetColorFor32Bit( aColor, (sal_uInt8*) pTmp32++ ); rAcc.SetPixel( nY, nX, aColor ); } } @@ -670,18 +670,18 @@ BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWri // ------------------------------------------------------------------ -BOOL Bitmap::Write( SvStream& rOStm, BOOL bCompressed, BOOL bFileHeader ) const +sal_Bool Bitmap::Write( SvStream& rOStm, sal_Bool bCompressed, sal_Bool bFileHeader ) const { DBG_ASSERT( mpImpBmp, "Empty Bitmaps can't be saved" ); const Size aSizePix( GetSizePixel() ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( mpImpBmp && aSizePix.Width() && aSizePix.Height() ) { BitmapReadAccess* pAcc = ( (Bitmap*) this)->AcquireReadAccess(); - const USHORT nOldFormat = rOStm.GetNumberFormatInt(); - const ULONG nOldPos = rOStm.Tell(); + const sal_uInt16 nOldFormat = rOStm.GetNumberFormatInt(); + const sal_uLong nOldPos = rOStm.Tell(); rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); @@ -712,14 +712,14 @@ BOOL Bitmap::Write( SvStream& rOStm, BOOL bCompressed, BOOL bFileHeader ) const // ------------------------------------------------------------------ -BOOL Bitmap::ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompressed ) const +sal_Bool Bitmap::ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool bCompressed ) const { const MapMode aMapPixel( MAP_PIXEL ); DIBInfoHeader aHeader; - ULONG nImageSizePos; - ULONG nEndPos; + sal_uLong nImageSizePos; + sal_uLong nEndPos; sal_uInt32 nCompression = 0; - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; aHeader.nSize = DIBINFOHEADERSIZE; aHeader.nWidth = rAcc.Width(); @@ -744,7 +744,7 @@ BOOL Bitmap::ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompre // recent. // #i59239# discretize bitcount to 1,4,8,24 (other cases // are not written below) - const UINT16 nBitCount( sal::static_int_cast<UINT16>(rAcc.GetBitCount()) ); + const sal_uInt16 nBitCount( sal::static_int_cast<sal_uInt16>(rAcc.GetBitCount()) ); aHeader.nBitCount = discretizeBitcount( nBitCount ); aHeader.nSizeImage = rAcc.Height() * @@ -787,8 +787,8 @@ BOOL Bitmap::ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompre if( fabs(fBmpWidthM) > 0.000000001 && fabs(fBmpHeightM) > 0.000000001 ) { - aHeader.nXPelsPerMeter = (UINT32)(rAcc.Width() / fBmpWidthM + .5); - aHeader.nYPelsPerMeter = (UINT32)(rAcc.Height() / fBmpHeightM + .5); + aHeader.nXPelsPerMeter = (sal_uInt32)(rAcc.Width() / fBmpWidthM + .5); + aHeader.nYPelsPerMeter = (sal_uInt32)(rAcc.Height() / fBmpHeightM + .5); } } @@ -814,7 +814,7 @@ BOOL Bitmap::ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompre { ZCodec aCodec; SvMemoryStream aMemStm( aHeader.nSizeImage + 4096, 65535 ); - ULONG nCodedPos = rOStm.Tell(), nLastPos; + sal_uLong nCodedPos = rOStm.Tell(), nLastPos; sal_uInt32 nCodedSize, nUncodedSize; // write uncoded data palette @@ -832,7 +832,7 @@ BOOL Bitmap::ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompre // write compressed data aCodec.BeginCompression( 3 ); - aCodec.Write( rOStm, (BYTE*) aMemStm.GetData(), nUncodedSize ); + aCodec.Write( rOStm, (sal_uInt8*) aMemStm.GetData(), nUncodedSize ); aCodec.EndCompression(); // update compress info ( coded size, uncoded size, uncoded compression ) @@ -862,16 +862,16 @@ BOOL Bitmap::ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompre // ------------------------------------------------------------------ -BOOL Bitmap::ImplWriteDIBFileHeader( SvStream& rOStm, BitmapReadAccess& rAcc ) +sal_Bool Bitmap::ImplWriteDIBFileHeader( SvStream& rOStm, BitmapReadAccess& rAcc ) { - UINT32 nPalCount = ( rAcc.HasPalette() ? rAcc.GetPaletteEntryCount() : + sal_uInt32 nPalCount = ( rAcc.HasPalette() ? rAcc.GetPaletteEntryCount() : isBitfieldCompression( rAcc.GetScanlineFormat() ) ? 3UL : 0UL ); - UINT32 nOffset = 14 + DIBINFOHEADERSIZE + nPalCount * 4UL; + sal_uInt32 nOffset = 14 + DIBINFOHEADERSIZE + nPalCount * 4UL; - rOStm << (UINT16) 0x4D42; - rOStm << (UINT32) ( nOffset + ( rAcc.Height() * rAcc.GetScanlineSize() ) ); - rOStm << (UINT16) 0; - rOStm << (UINT16) 0; + rOStm << (sal_uInt16) 0x4D42; + rOStm << (sal_uInt32) ( nOffset + ( rAcc.Height() * rAcc.GetScanlineSize() ) ); + rOStm << (sal_uInt16) 0; + rOStm << (sal_uInt16) 0; rOStm << nOffset; return( rOStm.GetError() == 0UL ); @@ -879,15 +879,15 @@ BOOL Bitmap::ImplWriteDIBFileHeader( SvStream& rOStm, BitmapReadAccess& rAcc ) // ------------------------------------------------------------------ -BOOL Bitmap::ImplWriteDIBPalette( SvStream& rOStm, BitmapReadAccess& rAcc ) +sal_Bool Bitmap::ImplWriteDIBPalette( SvStream& rOStm, BitmapReadAccess& rAcc ) { - const USHORT nColors = rAcc.GetPaletteEntryCount(); - const ULONG nPalSize = nColors * 4UL; - BYTE* pEntries = new BYTE[ nPalSize ]; - BYTE* pTmpEntry = pEntries; + const sal_uInt16 nColors = rAcc.GetPaletteEntryCount(); + const sal_uLong nPalSize = nColors * 4UL; + sal_uInt8* pEntries = new sal_uInt8[ nPalSize ]; + sal_uInt8* pTmpEntry = pEntries; BitmapColor aPalColor; - for( USHORT i = 0; i < nColors; i++ ) + for( sal_uInt16 i = 0; i < nColors; i++ ) { const BitmapColor& rPalColor = rAcc.GetPaletteColor( i ); @@ -905,8 +905,8 @@ BOOL Bitmap::ImplWriteDIBPalette( SvStream& rOStm, BitmapReadAccess& rAcc ) // ------------------------------------------------------------------ -BOOL Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, - ULONG nCompression, sal_uInt32& rImageSize ) +sal_Bool Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, + sal_uLong nCompression, sal_uInt32& rImageSize ) { if( BITFIELDS == nCompression ) { @@ -914,13 +914,13 @@ BOOL Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, SVBT32 aVal32; UInt32ToSVBT32( rMask.GetRedMask(), aVal32 ); - rOStm.Write( (BYTE*) aVal32, 4UL ); + rOStm.Write( (sal_uInt8*) aVal32, 4UL ); UInt32ToSVBT32( rMask.GetGreenMask(), aVal32 ); - rOStm.Write( (BYTE*) aVal32, 4UL ); + rOStm.Write( (sal_uInt8*) aVal32, 4UL ); UInt32ToSVBT32( rMask.GetBlueMask(), aVal32 ); - rOStm.Write( (BYTE*) aVal32, 4UL ); + rOStm.Write( (sal_uInt8*) aVal32, 4UL ); rImageSize = rOStm.Tell(); @@ -947,10 +947,10 @@ BOOL Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, // bitmaps is relatively recent. // #i59239# discretize bitcount for aligned width to 1,4,8,24 // (other cases are not written below) - const USHORT nBitCount( sal::static_int_cast<USHORT>(rAcc.GetBitCount()) ); - const ULONG nAlignedWidth = AlignedWidth4Bytes( rAcc.Width() * + const sal_uInt16 nBitCount( sal::static_int_cast<sal_uInt16>(rAcc.GetBitCount()) ); + const sal_uLong nAlignedWidth = AlignedWidth4Bytes( rAcc.Width() * discretizeBitcount(nBitCount)); - BOOL bNative = FALSE; + sal_Bool bNative = sal_False; switch( rAcc.GetScanlineFormat() ) { @@ -960,7 +960,7 @@ BOOL Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, case( BMP_FORMAT_24BIT_TC_BGR ): { if( rAcc.IsBottomUp() && ( rAcc.GetScanlineSize() == nAlignedWidth ) ) - bNative = TRUE; + bNative = sal_True; } break; @@ -976,9 +976,9 @@ BOOL Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, { const long nWidth = rAcc.Width(); const long nHeight = rAcc.Height(); - BYTE* pBuf = new BYTE[ nAlignedWidth ]; - BYTE* pTmp; - BYTE cTmp; + sal_uInt8* pBuf = new sal_uInt8[ nAlignedWidth ]; + sal_uInt8* pTmp; + sal_uInt8 cTmp; switch( nBitCount ) { @@ -998,7 +998,7 @@ BOOL Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, cTmp = 0; } - cTmp |= ( (BYTE) rAcc.GetPixel( nY, nX ) << --nShift ); + cTmp |= ( (sal_uInt8) rAcc.GetPixel( nY, nX ) << --nShift ); } *pTmp = cTmp; @@ -1023,7 +1023,7 @@ BOOL Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, cTmp = 0; } - cTmp |= ( (BYTE) rAcc.GetPixel( nY, nX ) << ( --nShift << 2L ) ); + cTmp |= ( (sal_uInt8) rAcc.GetPixel( nY, nX ) << ( --nShift << 2L ) ); } *pTmp = cTmp; rOStm.Write( pBuf, nAlignedWidth ); @@ -1081,17 +1081,17 @@ BOOL Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, // ------------------------------------------------------------------ -void Bitmap::ImplDecodeRLE( BYTE* pBuffer, DIBInfoHeader& rHeader, - BitmapWriteAccess& rAcc, BOOL bRLE4 ) +void Bitmap::ImplDecodeRLE( sal_uInt8* pBuffer, DIBInfoHeader& rHeader, + BitmapWriteAccess& rAcc, sal_Bool bRLE4 ) { Scanline pRLE = pBuffer; long nY = abs(rHeader.nHeight) - 1L; - const ULONG nWidth = rAcc.Width(); - ULONG nCountByte; - ULONG nRunByte; - ULONG nX = 0UL; - BYTE cTmp; - BOOL bEndDecoding = FALSE; + const sal_uLong nWidth = rAcc.Width(); + sal_uLong nCountByte; + sal_uLong nRunByte; + sal_uLong nX = 0UL; + sal_uInt8 cTmp; + sal_Bool bEndDecoding = sal_False; do { @@ -1105,7 +1105,7 @@ void Bitmap::ImplDecodeRLE( BYTE* pBuffer, DIBInfoHeader& rHeader, { nCountByte = nRunByte >> 1; - for( ULONG i = 0UL; i < nCountByte; i++ ) + for( sal_uLong i = 0UL; i < nCountByte; i++ ) { cTmp = *pRLE++; @@ -1129,7 +1129,7 @@ void Bitmap::ImplDecodeRLE( BYTE* pBuffer, DIBInfoHeader& rHeader, } else { - for( ULONG i = 0UL; i < nRunByte; i++ ) + for( sal_uLong i = 0UL; i < nRunByte; i++ ) { if( nX < nWidth ) rAcc.SetPixel( nY, nX++, *pRLE ); @@ -1147,7 +1147,7 @@ void Bitmap::ImplDecodeRLE( BYTE* pBuffer, DIBInfoHeader& rHeader, nX = 0UL; } else if( nRunByte == 1 ) - bEndDecoding = TRUE; + bEndDecoding = sal_True; else { nX += *pRLE++; @@ -1162,7 +1162,7 @@ void Bitmap::ImplDecodeRLE( BYTE* pBuffer, DIBInfoHeader& rHeader, { nRunByte = nCountByte >> 1; - for( ULONG i = 0UL; i < nRunByte; i++ ) + for( sal_uLong i = 0UL; i < nRunByte; i++ ) { if( nX < nWidth ) rAcc.SetPixel( nY, nX++, cTmp >> 4 ); @@ -1176,7 +1176,7 @@ void Bitmap::ImplDecodeRLE( BYTE* pBuffer, DIBInfoHeader& rHeader, } else { - for( ULONG i = 0UL; ( i < nCountByte ) && ( nX < nWidth ); i++ ) + for( sal_uLong i = 0UL; ( i < nCountByte ) && ( nX < nWidth ); i++ ) rAcc.SetPixel( nY, nX++, cTmp ); } } @@ -1186,19 +1186,19 @@ void Bitmap::ImplDecodeRLE( BYTE* pBuffer, DIBInfoHeader& rHeader, // ------------------------------------------------------------------ -BOOL Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bRLE4 ) +sal_Bool Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool bRLE4 ) { - const ULONG nWidth = rAcc.Width(); - const ULONG nHeight = rAcc.Height(); - ULONG nX; - ULONG nSaveIndex; - ULONG nCount; - ULONG nBufCount; - BYTE* pBuf = new BYTE[ ( nWidth << 1 ) + 2 ]; - BYTE* pTmp; - BYTE cPix; - BYTE cLast; - BOOL bFound; + const sal_uLong nWidth = rAcc.Width(); + const sal_uLong nHeight = rAcc.Height(); + sal_uLong nX; + sal_uLong nSaveIndex; + sal_uLong nCount; + sal_uLong nBufCount; + sal_uInt8* pBuf = new sal_uInt8[ ( nWidth << 1 ) + 2 ]; + sal_uInt8* pTmp; + sal_uInt8 cPix; + sal_uInt8 cLast; + sal_Bool bFound; for ( long nY = nHeight - 1L; nY >= 0L; nY-- ) { @@ -1218,7 +1218,7 @@ BOOL Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bRLE4 ) if ( nCount > 1 ) { - *pTmp++ = (BYTE) nCount; + *pTmp++ = (sal_uInt8) nCount; *pTmp++ = ( bRLE4 ? ( ( cPix << 4 ) | cPix ) : cPix ); nBufCount += 2; } @@ -1226,13 +1226,13 @@ BOOL Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bRLE4 ) { cLast = cPix; nSaveIndex = nX - 1UL; - bFound = FALSE; + bFound = sal_False; while( ( nX < nWidth ) && ( nCount < 256L ) && ( cPix = rAcc.GetPixel( nY, nX ) ) != cLast ) { nX++; nCount++; cLast = cPix; - bFound = TRUE; + bFound = sal_True; } if ( bFound ) @@ -1241,13 +1241,13 @@ BOOL Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bRLE4 ) if ( nCount > 3 ) { *pTmp++ = 0; - *pTmp++ = (BYTE) --nCount; + *pTmp++ = (sal_uInt8) --nCount; if( bRLE4 ) { - for ( ULONG i = 0; i < nCount; i++, pTmp++ ) + for ( sal_uLong i = 0; i < nCount; i++, pTmp++ ) { - *pTmp = (BYTE) rAcc.GetPixel( nY, nSaveIndex++ ) << 4; + *pTmp = (sal_uInt8) rAcc.GetPixel( nY, nSaveIndex++ ) << 4; if ( ++i < nCount ) *pTmp |= rAcc.GetPixel( nY, nSaveIndex++ ); @@ -1257,7 +1257,7 @@ BOOL Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bRLE4 ) } else { - for( ULONG i = 0UL; i < nCount; i++ ) + for( sal_uLong i = 0UL; i < nCount; i++ ) *pTmp++ = rAcc.GetPixel( nY, nSaveIndex++ ); } @@ -1272,12 +1272,12 @@ BOOL Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bRLE4 ) else { *pTmp++ = 1; - *pTmp++ = (BYTE) rAcc.GetPixel( nY, nSaveIndex ) << ( bRLE4 ? 4 : 0 ); + *pTmp++ = (sal_uInt8) rAcc.GetPixel( nY, nSaveIndex ) << ( bRLE4 ? 4 : 0 ); if ( nCount == 3 ) { *pTmp++ = 1; - *pTmp++ = (BYTE) rAcc.GetPixel( nY, ++nSaveIndex ) << ( bRLE4 ? 4 : 0 ); + *pTmp++ = (sal_uInt8) rAcc.GetPixel( nY, ++nSaveIndex ) << ( bRLE4 ? 4 : 0 ); nBufCount += 4; } else @@ -1292,8 +1292,8 @@ BOOL Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bRLE4 ) rOStm.Write( pBuf, nBufCount ); } - rOStm << (BYTE) 0; - rOStm << (BYTE) 1; + rOStm << (sal_uInt8) 0; + rOStm << (sal_uInt8) 1; delete[] pBuf; diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index f246ecd31058..c2d929ea4fa0 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -41,8 +41,8 @@ // - Defines - // ----------- -#define RGB15( _def_cR, _def_cG, _def_cB ) (((ULONG)(_def_cR)<<10UL)|((ULONG)(_def_cG)<<5UL)|(ULONG)(_def_cB)) -#define GAMMA( _def_cVal, _def_InvGamma ) ((BYTE)MinMax(FRound(pow( _def_cVal/255.0,_def_InvGamma)*255.0),0L,255L)) +#define RGB15( _def_cR, _def_cG, _def_cB ) (((sal_uLong)(_def_cR)<<10UL)|((sal_uLong)(_def_cG)<<5UL)|(sal_uLong)(_def_cB)) +#define GAMMA( _def_cVal, _def_InvGamma ) ((sal_uInt8)MinMax(FRound(pow( _def_cVal/255.0,_def_InvGamma)*255.0),0L,255L)) #define CALC_ERRORS \ nTemp = p1T[nX++] >> 12; \ @@ -77,13 +77,13 @@ // - Statics - // ----------- -ULONG nVCLRLut[ 6 ] = { 16, 17, 18, 19, 20, 21 }; -ULONG nVCLGLut[ 6 ] = { 0, 6, 12, 18, 24, 30 }; -ULONG nVCLBLut[ 6 ] = { 0, 36, 72, 108, 144, 180 }; +sal_uLong nVCLRLut[ 6 ] = { 16, 17, 18, 19, 20, 21 }; +sal_uLong nVCLGLut[ 6 ] = { 0, 6, 12, 18, 24, 30 }; +sal_uLong nVCLBLut[ 6 ] = { 0, 36, 72, 108, 144, 180 }; // ------------------------------------------------------------------------ -ULONG nVCLDitherLut[ 256 ] = +sal_uLong nVCLDitherLut[ 256 ] = { 0, 49152, 12288, 61440, 3072, 52224, 15360, 64512, 768, 49920, 13056, 62208, 3840, 52992, 16128, 65280, 32768, 16384, 45056, 28672, 35840, 19456, @@ -113,7 +113,7 @@ ULONG nVCLDitherLut[ 256 ] = // ------------------------------------------------------------------------ -ULONG nVCLLut[ 256 ] = +sal_uLong nVCLLut[ 256 ] = { 0, 1286, 2572, 3858, 5144, 6430, 7716, 9002, 10288, 11574, 12860, 14146, 15432, 16718, 18004, 19290, @@ -243,14 +243,14 @@ long FloydIndexMap[6] = // - ImplCreateDitherMatrix - // -------------------------- -void ImplCreateDitherMatrix( BYTE (*pDitherMatrix)[16][16] ) +void ImplCreateDitherMatrix( sal_uInt8 (*pDitherMatrix)[16][16] ) { double fVal = 3.125; const double fVal16 = fVal / 16.; long i, j, k, l; - USHORT pMtx[ 16 ][ 16 ]; - USHORT nMax = 0; - static BYTE pMagic[4][4] = { { 0, 14, 3, 13, }, + sal_uInt16 pMtx[ 16 ][ 16 ]; + sal_uInt16 nMax = 0; + static sal_uInt8 pMagic[4][4] = { { 0, 14, 3, 13, }, {11, 5, 8, 6, }, {12, 2, 15, 1, }, {7, 9, 4, 10 } }; @@ -261,22 +261,22 @@ void ImplCreateDitherMatrix( BYTE (*pDitherMatrix)[16][16] ) for ( k = 0; k < 4; k++ ) for ( l = 0; l < 4; l++ ) nMax = Max ( pMtx[ (k<<2) + i][(l<<2 ) + j] = - (USHORT) ( 0.5 + pMagic[i][j]*fVal + pMagic[k][l]*fVal16 ), nMax ); + (sal_uInt16) ( 0.5 + pMagic[i][j]*fVal + pMagic[k][l]*fVal16 ), nMax ); // auf Intervall [0;254] skalieren for ( i = 0, fVal = 254. / nMax; i < 16; i++ ) for( j = 0; j < 16; j++ ) - (*pDitherMatrix)[i][j] = (BYTE) ( fVal * pMtx[i][j] ); + (*pDitherMatrix)[i][j] = (sal_uInt8) ( fVal * pMtx[i][j] ); } // ---------- // - Bitmap - // ---------- -BOOL Bitmap::Convert( BmpConversion eConversion ) +sal_Bool Bitmap::Convert( BmpConversion eConversion ) { - const USHORT nBitCount = GetBitCount(); - BOOL bRet = FALSE; + const sal_uInt16 nBitCount = GetBitCount(); + sal_Bool bRet = sal_False; switch( eConversion ) { @@ -299,7 +299,7 @@ BOOL Bitmap::Convert( BmpConversion eConversion ) else if( nBitCount > 4 ) bRet = ImplConvertDown( 4, NULL ); else - bRet = TRUE; + bRet = sal_True; } break; @@ -325,7 +325,7 @@ BOOL Bitmap::Convert( BmpConversion eConversion ) else if( nBitCount > 8 ) bRet = ImplConvertDown( 8 ); else - bRet = TRUE; + bRet = sal_True; } break; @@ -343,9 +343,9 @@ BOOL Bitmap::Convert( BmpConversion eConversion ) case( BMP_CONVERSION_24BIT ): { if( nBitCount < 24 ) - bRet = ImplConvertUp( 24, FALSE ); + bRet = ImplConvertUp( 24, sal_False ); else - bRet = TRUE; + bRet = sal_True; } break; @@ -363,10 +363,10 @@ BOOL Bitmap::Convert( BmpConversion eConversion ) // ------------------------------------------------------------------------ -BOOL Bitmap::ImplMakeMono( BYTE cThreshold ) +sal_Bool Bitmap::ImplMakeMono( sal_uInt8 cThreshold ) { BitmapReadAccess* pReadAcc = AcquireReadAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pReadAcc ) { @@ -414,7 +414,7 @@ BOOL Bitmap::ImplMakeMono( BYTE cThreshold ) } aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -436,10 +436,10 @@ BOOL Bitmap::ImplMakeMono( BYTE cThreshold ) // ------------------------------------------------------------------------ -BOOL Bitmap::ImplMakeMonoDither() +sal_Bool Bitmap::ImplMakeMonoDither() { BitmapReadAccess* pReadAcc = AcquireReadAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pReadAcc ) { @@ -452,7 +452,7 @@ BOOL Bitmap::ImplMakeMonoDither() const BitmapColor aWhite( pWriteAcc->GetBestMatchingColor( Color( COL_WHITE ) ) ); const long nWidth = pWriteAcc->Width(); const long nHeight = pWriteAcc->Height(); - BYTE pDitherMatrix[ 16 ][ 16 ]; + sal_uInt8 pDitherMatrix[ 16 ][ 16 ]; ImplCreateDitherMatrix( &pDitherMatrix ); @@ -490,7 +490,7 @@ BOOL Bitmap::ImplMakeMonoDither() } aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -512,18 +512,18 @@ BOOL Bitmap::ImplMakeMonoDither() // ------------------------------------------------------------------------ -BOOL Bitmap::ImplMakeGreyscales( USHORT nGreys ) +sal_Bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys ) { DBG_ASSERT( nGreys == 16 || nGreys == 256, "Only 16 or 256 greyscales are supported!" ); BitmapReadAccess* pReadAcc = AcquireReadAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pReadAcc ) { const BitmapPalette& rPal = GetGreyPalette( nGreys ); - ULONG nShift = ( ( nGreys == 16 ) ? 4UL : 0UL ); - BOOL bPalDiffers = !pReadAcc->HasPalette() || ( rPal.GetEntryCount() != pReadAcc->GetPaletteEntryCount() ); + sal_uLong nShift = ( ( nGreys == 16 ) ? 4UL : 0UL ); + sal_Bool bPalDiffers = !pReadAcc->HasPalette() || ( rPal.GetEntryCount() != pReadAcc->GetPaletteEntryCount() ); if( !bPalDiffers ) bPalDiffers = ( (BitmapPalette&) rPal != pReadAcc->GetPalette() ); @@ -545,7 +545,7 @@ BOOL Bitmap::ImplMakeGreyscales( USHORT nGreys ) for( long nX = 0L; nX < nWidth; nX++ ) { pWriteAcc->SetPixel( nY, nX, - (BYTE) ( pReadAcc->GetPaletteColor( + (sal_uInt8) ( pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nX ) ).GetLuminance() >> nShift ) ); } } @@ -562,11 +562,11 @@ BOOL Bitmap::ImplMakeGreyscales( USHORT nGreys ) for( long nX = 0L; nX < nWidth; nX++ ) { - const ULONG nB = *pReadScan++; - const ULONG nG = *pReadScan++; - const ULONG nR = *pReadScan++; + const sal_uLong nB = *pReadScan++; + const sal_uLong nG = *pReadScan++; + const sal_uLong nR = *pReadScan++; - *pWriteScan++ = (BYTE) ( ( nB * 28UL + nG * 151UL + nR * 77UL ) >> nShift ); + *pWriteScan++ = (sal_uInt8) ( ( nB * 28UL + nG * 151UL + nR * 77UL ) >> nShift ); } } } @@ -582,11 +582,11 @@ BOOL Bitmap::ImplMakeGreyscales( USHORT nGreys ) for( long nX = 0L; nX < nWidth; nX++ ) { - const ULONG nR = *pReadScan++; - const ULONG nG = *pReadScan++; - const ULONG nB = *pReadScan++; + const sal_uLong nR = *pReadScan++; + const sal_uLong nG = *pReadScan++; + const sal_uLong nB = *pReadScan++; - *pWriteScan++ = (BYTE) ( ( nB * 28UL + nG * 151UL + nR * 77UL ) >> nShift ); + *pWriteScan++ = (sal_uInt8) ( ( nB * 28UL + nG * 151UL + nR * 77UL ) >> nShift ); } } } @@ -594,11 +594,11 @@ BOOL Bitmap::ImplMakeGreyscales( USHORT nGreys ) { for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ ) - pWriteAcc->SetPixel( nY, nX, sal::static_int_cast<BYTE>(( pReadAcc->GetPixel( nY, nX ) ).GetLuminance() >> nShift) ); + pWriteAcc->SetPixel( nY, nX, sal::static_int_cast<sal_uInt8>(( pReadAcc->GetPixel( nY, nX ) ).GetLuminance() >> nShift) ); } aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -617,7 +617,7 @@ BOOL Bitmap::ImplMakeGreyscales( USHORT nGreys ) else { ReleaseAccess( pReadAcc ); - bRet = TRUE; + bRet = sal_True; } } @@ -626,12 +626,12 @@ BOOL Bitmap::ImplMakeGreyscales( USHORT nGreys ) // ------------------------------------------------------------------------ -BOOL Bitmap::ImplConvertUp( USHORT nBitCount, Color* pExtColor ) +sal_Bool Bitmap::ImplConvertUp( sal_uInt16 nBitCount, Color* pExtColor ) { DBG_ASSERT( nBitCount > GetBitCount(), "New BitCount must be greater!" ); BitmapReadAccess* pReadAcc = AcquireReadAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pReadAcc ) { @@ -646,12 +646,12 @@ BOOL Bitmap::ImplConvertUp( USHORT nBitCount, Color* pExtColor ) if( pWriteAcc->HasPalette() ) { - const USHORT nOldCount = 1 << GetBitCount(); + const sal_uInt16 nOldCount = 1 << GetBitCount(); const BitmapPalette& rOldPal = pReadAcc->GetPalette(); aPal.SetEntryCount( 1 << nBitCount ); - for( USHORT i = 0; i < nOldCount; i++ ) + for( sal_uInt16 i = 0; i < nOldCount; i++ ) aPal[ i ] = rOldPal[ i ]; if( pExtColor ) @@ -680,7 +680,7 @@ BOOL Bitmap::ImplConvertUp( USHORT nBitCount, Color* pExtColor ) } aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -702,12 +702,12 @@ BOOL Bitmap::ImplConvertUp( USHORT nBitCount, Color* pExtColor ) // ------------------------------------------------------------------------ -BOOL Bitmap::ImplConvertDown( USHORT nBitCount, Color* pExtColor ) +sal_Bool Bitmap::ImplConvertDown( sal_uInt16 nBitCount, Color* pExtColor ) { DBG_ASSERT( nBitCount <= GetBitCount(), "New BitCount must be lower ( or equal when pExtColor is set )!" ); BitmapReadAccess* pReadAcc = AcquireReadAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pReadAcc ) { @@ -717,7 +717,7 @@ BOOL Bitmap::ImplConvertDown( USHORT nBitCount, Color* pExtColor ) if( pWriteAcc ) { - const USHORT nCount = 1 << nBitCount; + const sal_uInt16 nCount = 1 << nBitCount; const long nWidth = pWriteAcc->Width(); const long nWidth1 = nWidth - 1L; const long nHeight = pWriteAcc->Height(); @@ -731,8 +731,8 @@ BOOL Bitmap::ImplConvertDown( USHORT nBitCount, Color* pExtColor ) ImpErrorQuad* pQLine2 = 0; long nX, nY; long nYTmp = 0L; - BYTE cIndex; - BOOL bQ1 = TRUE; + sal_uInt8 cIndex; + sal_Bool bQ1 = sal_True; if( pExtColor ) { @@ -764,12 +764,12 @@ BOOL Bitmap::ImplConvertDown( USHORT nBitCount, Color* pExtColor ) for( nY = 0L; nY < nHeight; nY++, nYTmp++ ) { // erstes ZeilenPixel - cIndex = (BYTE) aColorMap.GetBestPaletteIndex( pQLine1[ 0 ].ImplGetColor() ); + cIndex = (sal_uInt8) aColorMap.GetBestPaletteIndex( pQLine1[ 0 ].ImplGetColor() ); pWriteAcc->SetPixel( nY, 0, cIndex ); for( nX = 1L; nX < nWidth1; nX++ ) { - cIndex = (BYTE) aColorMap.GetBestPaletteIndex( aColor = pQLine1[ nX ].ImplGetColor() ); + cIndex = (sal_uInt8) aColorMap.GetBestPaletteIndex( aColor = pQLine1[ nX ].ImplGetColor() ); aErrQuad = ( ImpErrorQuad( aColor ) -= pWriteAcc->GetPaletteColor( cIndex ) ); pQLine1[ ++nX ].ImplAddColorError7( aErrQuad ); pQLine2[ nX-- ].ImplAddColorError1( aErrQuad ); @@ -781,13 +781,13 @@ BOOL Bitmap::ImplConvertDown( USHORT nBitCount, Color* pExtColor ) // letztes ZeilenPixel if( nX < nWidth ) { - cIndex = (BYTE) aColorMap.GetBestPaletteIndex( pQLine1[ nWidth1 ].ImplGetColor() ); + cIndex = (sal_uInt8) aColorMap.GetBestPaletteIndex( pQLine1[ nWidth1 ].ImplGetColor() ); pWriteAcc->SetPixel( nY, nX, cIndex ); } // Zeilenpuffer neu fuellen/kopieren pQLine1 = pQLine2; - pQLine2 = ( bQ1 = !bQ1 ) != FALSE ? pErrQuad2 : pErrQuad1; + pQLine2 = ( bQ1 = !bQ1 ) != sal_False ? pErrQuad2 : pErrQuad1; if( nYTmp < nHeight ) { @@ -806,7 +806,7 @@ BOOL Bitmap::ImplConvertDown( USHORT nBitCount, Color* pExtColor ) delete[] pErrQuad2; aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -828,11 +828,11 @@ BOOL Bitmap::ImplConvertDown( USHORT nBitCount, Color* pExtColor ) // ------------------------------------------------------------------------ -BOOL Bitmap::ImplConvertGhosted() +sal_Bool Bitmap::ImplConvertGhosted() { Bitmap aNewBmp; BitmapReadAccess* pR = AcquireReadAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pR ) { @@ -842,8 +842,8 @@ BOOL Bitmap::ImplConvertGhosted() for( long i = 0, nCount = aNewPal.GetEntryCount(); i < nCount; i++ ) { - const BitmapColor& rOld = pR->GetPaletteColor( (USHORT) i ); - aNewPal[ (USHORT) i ] = BitmapColor( ( rOld.GetRed() >> 1 ) | 0x80, + const BitmapColor& rOld = pR->GetPaletteColor( (sal_uInt16) i ); + aNewPal[ (sal_uInt16) i ] = BitmapColor( ( rOld.GetRed() >> 1 ) | 0x80, ( rOld.GetGreen() >> 1 ) | 0x80, ( rOld.GetBlue() >> 1 ) | 0x80 ); } @@ -855,7 +855,7 @@ BOOL Bitmap::ImplConvertGhosted() { pW->CopyBuffer( *pR ); aNewBmp.ReleaseAccess( pW ); - bRet = TRUE; + bRet = sal_True; } } else @@ -881,7 +881,7 @@ BOOL Bitmap::ImplConvertGhosted() } aNewBmp.ReleaseAccess( pW ); - bRet = TRUE; + bRet = sal_True; } } @@ -904,9 +904,9 @@ BOOL Bitmap::ImplConvertGhosted() // ------------------------------------------------------------------------ -BOOL Bitmap::Scale( const double& rScaleX, const double& rScaleY, ULONG nScaleFlag ) +sal_Bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, sal_uLong nScaleFlag ) { - BOOL bRet; + sal_Bool bRet; if( ( rScaleX != 1.0 ) || ( rScaleY != 1.0 ) ) { @@ -915,20 +915,20 @@ BOOL Bitmap::Scale( const double& rScaleX, const double& rScaleY, ULONG nScaleFl else if( BMP_SCALE_INTERPOLATE == nScaleFlag ) bRet = ImplScaleInterpolate( rScaleX, rScaleY ); else - bRet = FALSE; + bRet = sal_False; } else - bRet = TRUE; + bRet = sal_True; return bRet; } // ------------------------------------------------------------------------ -BOOL Bitmap::Scale( const Size& rNewSize, ULONG nScaleFlag ) +sal_Bool Bitmap::Scale( const Size& rNewSize, sal_uLong nScaleFlag ) { const Size aSize( GetSizePixel() ); - BOOL bRet; + sal_Bool bRet; if( aSize.Width() && aSize.Height() ) { @@ -937,19 +937,19 @@ BOOL Bitmap::Scale( const Size& rNewSize, ULONG nScaleFlag ) nScaleFlag ); } else - bRet = TRUE; + bRet = sal_True; return bRet; } // ------------------------------------------------------------------------ -BOOL Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY ) +sal_Bool Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY ) { const Size aSizePix( GetSizePixel() ); const long nNewWidth = FRound( aSizePix.Width() * rScaleX ); const long nNewHeight = FRound( aSizePix.Height() * rScaleY ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( nNewWidth && nNewHeight ) { @@ -962,8 +962,8 @@ BOOL Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY ) const long nScanlineSize = pWriteAcc->GetScanlineSize(); const long nNewWidth1 = nNewWidth - 1L; const long nNewHeight1 = nNewHeight - 1L; - const long nWidth1 = pReadAcc->Width() - 1L; - const long nHeight1 = pReadAcc->Height() - 1L; + const long nWidth = pReadAcc->Width(); + const long nHeight = pReadAcc->Height(); long* pLutX = new long[ nNewWidth ]; long* pLutY = new long[ nNewHeight ]; @@ -972,10 +972,10 @@ BOOL Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY ) long nX, nY, nMapY, nActY = 0L; for( nX = 0L; nX < nNewWidth; nX++ ) - pLutX[ nX ] = nX * nWidth1 / nNewWidth1; + pLutX[ nX ] = nX * nWidth / nNewWidth; for( nY = 0L; nY < nNewHeight; nY++ ) - pLutY[ nY ] = nY * nHeight1 / nNewHeight1; + pLutY[ nY ] = nY * nHeight / nNewHeight; while( nActY < nNewHeight ) { @@ -994,7 +994,7 @@ BOOL Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY ) nActY++; } - bRet = TRUE; + bRet = sal_True; } delete[] pLutX; @@ -1013,12 +1013,12 @@ BOOL Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY ) // ------------------------------------------------------------------------ -BOOL Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY ) +sal_Bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY ) { const Size aSizePix( GetSizePixel() ); const long nNewWidth = FRound( aSizePix.Width() * rScaleX ); const long nNewHeight = FRound( aSizePix.Height() * rScaleY ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( ( nNewWidth > 1L ) && ( nNewHeight > 1L ) ) { @@ -1079,9 +1079,9 @@ BOOL Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY lXG1 = aCol1.GetGreen() - ( lXG0 = aCol0.GetGreen() ); lXB1 = aCol1.GetBlue() - ( lXB0 = aCol0.GetBlue() ); - aCol0.SetRed( (BYTE) ( ( lXR1 * nTemp + ( lXR0 << 10 ) ) >> 10 ) ); - aCol0.SetGreen( (BYTE) ( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) ); - aCol0.SetBlue( (BYTE) ( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) ); + aCol0.SetRed( (sal_uInt8) ( ( lXR1 * nTemp + ( lXR0 << 10 ) ) >> 10 ) ); + aCol0.SetGreen( (sal_uInt8) ( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) ); + aCol0.SetBlue( (sal_uInt8) ( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) ); pWriteAcc->SetPixel( nY, nX, aCol0 ); } @@ -1114,9 +1114,9 @@ BOOL Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY lXG1 = aCol1.GetGreen() - ( lXG0 = aCol0.GetGreen() ); lXB1 = aCol1.GetBlue() - ( lXB0 = aCol0.GetBlue() ); - aCol0.SetRed( (BYTE) ( ( lXR1 * nTemp + ( lXR0 << 10 ) ) >> 10 ) ); - aCol0.SetGreen( (BYTE) ( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) ); - aCol0.SetBlue( (BYTE) ( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) ); + aCol0.SetRed( (sal_uInt8) ( ( lXR1 * nTemp + ( lXR0 << 10 ) ) >> 10 ) ); + aCol0.SetGreen( (sal_uInt8) ( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) ); + aCol0.SetBlue( (sal_uInt8) ( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) ); pWriteAcc->SetPixel( nY, nX, aCol0 ); } @@ -1126,7 +1126,7 @@ BOOL Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY delete[] pLutInt; delete[] pLutFrac; - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -1134,7 +1134,7 @@ BOOL Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY if( bRet ) { - bRet = FALSE; + bRet = sal_False; ImplAssignWithSize( aNewBmp ); pReadAcc = AcquireReadAccess(); aNewBmp = Bitmap( Size( nNewWidth, nNewHeight ), 24 ); @@ -1183,9 +1183,9 @@ BOOL Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY lXG1 = aCol1.GetGreen() - ( lXG0 = aCol0.GetGreen() ); lXB1 = aCol1.GetBlue() - ( lXB0 = aCol0.GetBlue() ); - aCol0.SetRed( (BYTE) ( ( lXR1 * nTemp + ( lXR0 << 10 ) ) >> 10 ) ); - aCol0.SetGreen( (BYTE) ( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) ); - aCol0.SetBlue( (BYTE) ( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) ); + aCol0.SetRed( (sal_uInt8) ( ( lXR1 * nTemp + ( lXR0 << 10 ) ) >> 10 ) ); + aCol0.SetGreen( (sal_uInt8) ( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) ); + aCol0.SetBlue( (sal_uInt8) ( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) ); pWriteAcc->SetPixel( nY, nX, aCol0 ); } @@ -1218,9 +1218,9 @@ BOOL Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY lXG1 = aCol1.GetGreen() - ( lXG0 = aCol0.GetGreen() ); lXB1 = aCol1.GetBlue() - ( lXB0 = aCol0.GetBlue() ); - aCol0.SetRed( (BYTE) ( ( lXR1 * nTemp + ( lXR0 << 10 ) ) >> 10 ) ); - aCol0.SetGreen( (BYTE) ( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) ); - aCol0.SetBlue( (BYTE) ( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) ); + aCol0.SetRed( (sal_uInt8) ( ( lXR1 * nTemp + ( lXR0 << 10 ) ) >> 10 ) ); + aCol0.SetGreen( (sal_uInt8) ( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) ); + aCol0.SetBlue( (sal_uInt8) ( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) ); pWriteAcc->SetPixel( nY, nX, aCol0 ); } @@ -1230,7 +1230,7 @@ BOOL Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY delete[] pLutInt; delete[] pLutFrac; - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -1249,14 +1249,14 @@ BOOL Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY // ------------------------------------------------------------------------ -BOOL Bitmap::Dither( ULONG nDitherFlags ) +sal_Bool Bitmap::Dither( sal_uLong nDitherFlags ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; const Size aSizePix( GetSizePixel() ); if( aSizePix.Width() == 1 || aSizePix.Height() == 1 ) - bRet = TRUE; + bRet = sal_True; else if( nDitherFlags & BMP_DITHER_MATRIX ) bRet = ImplDitherMatrix(); else if( nDitherFlags & BMP_DITHER_FLOYD ) @@ -1269,55 +1269,55 @@ BOOL Bitmap::Dither( ULONG nDitherFlags ) // ------------------------------------------------------------------------ -BOOL Bitmap::ImplDitherMatrix() +sal_Bool Bitmap::ImplDitherMatrix() { BitmapReadAccess* pReadAcc = AcquireReadAccess(); Bitmap aNewBmp( GetSizePixel(), 8 ); BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pReadAcc && pWriteAcc ) { - const ULONG nWidth = pReadAcc->Width(); - const ULONG nHeight = pReadAcc->Height(); - BitmapColor aIndex( (BYTE) 0 ); + const sal_uLong nWidth = pReadAcc->Width(); + const sal_uLong nHeight = pReadAcc->Height(); + BitmapColor aIndex( (sal_uInt8) 0 ); if( pReadAcc->HasPalette() ) { - for( ULONG nY = 0UL; nY < nHeight; nY++ ) + for( sal_uLong nY = 0UL; nY < nHeight; nY++ ) { - for( ULONG nX = 0UL, nModY = ( nY & 0x0FUL ) << 4UL; nX < nWidth; nX++ ) + for( sal_uLong nX = 0UL, nModY = ( nY & 0x0FUL ) << 4UL; nX < nWidth; nX++ ) { const BitmapColor aCol( pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nX ) ) ); - const ULONG nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ]; - const ULONG nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16UL; - const ULONG nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16UL; - const ULONG nB = ( nVCLLut[ aCol.GetBlue() ] + nD ) >> 16UL; + const sal_uLong nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ]; + const sal_uLong nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16UL; + const sal_uLong nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16UL; + const sal_uLong nB = ( nVCLLut[ aCol.GetBlue() ] + nD ) >> 16UL; - aIndex.SetIndex( (BYTE) ( nVCLRLut[ nR ] + nVCLGLut[ nG ] + nVCLBLut[ nB ] ) ); + aIndex.SetIndex( (sal_uInt8) ( nVCLRLut[ nR ] + nVCLGLut[ nG ] + nVCLBLut[ nB ] ) ); pWriteAcc->SetPixel( nY, nX, aIndex ); } } } else { - for( ULONG nY = 0UL; nY < nHeight; nY++ ) + for( sal_uLong nY = 0UL; nY < nHeight; nY++ ) { - for( ULONG nX = 0UL, nModY = ( nY & 0x0FUL ) << 4UL; nX < nWidth; nX++ ) + for( sal_uLong nX = 0UL, nModY = ( nY & 0x0FUL ) << 4UL; nX < nWidth; nX++ ) { const BitmapColor aCol( pReadAcc->GetPixel( nY, nX ) ); - const ULONG nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ]; - const ULONG nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16UL; - const ULONG nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16UL; - const ULONG nB = ( nVCLLut[ aCol.GetBlue() ] + nD ) >> 16UL; + const sal_uLong nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ]; + const sal_uLong nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16UL; + const sal_uLong nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16UL; + const sal_uLong nB = ( nVCLLut[ aCol.GetBlue() ] + nD ) >> 16UL; - aIndex.SetIndex( (BYTE) ( nVCLRLut[ nR ] + nVCLGLut[ nG ] + nVCLBLut[ nB ] ) ); + aIndex.SetIndex( (sal_uInt8) ( nVCLRLut[ nR ] + nVCLGLut[ nG ] + nVCLBLut[ nB ] ) ); pWriteAcc->SetPixel( nY, nX, aIndex ); } } } - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -1339,10 +1339,10 @@ BOOL Bitmap::ImplDitherMatrix() // ------------------------------------------------------------------------ -BOOL Bitmap::ImplDitherFloyd() +sal_Bool Bitmap::ImplDitherFloyd() { const Size aSize( GetSizePixel() ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( ( aSize.Width() > 3 ) && ( aSize.Height() > 2 ) ) { @@ -1368,7 +1368,7 @@ BOOL Bitmap::ImplDitherFloyd() long* p1T = p1; long* p2T = p2; long* pTmp; - BOOL bPal = pReadAcc->HasPalette(); + sal_Bool bPal = pReadAcc->HasPalette(); pTmp = p2T; @@ -1433,7 +1433,7 @@ BOOL Bitmap::ImplDitherFloyd() CALC_TABLES7; nX -= 5; CALC_TABLES5; - pWriteAcc->SetPixel( nYAcc, 0, BitmapColor( (BYTE) ( nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ] ) ) ); + pWriteAcc->SetPixel( nYAcc, 0, BitmapColor( (sal_uInt8) ( nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ] ) ) ); // mittlere Pixel ueber Schleife long nXAcc; @@ -1444,7 +1444,7 @@ BOOL Bitmap::ImplDitherFloyd() nX -= 8; CALC_TABLES3; CALC_TABLES5; - pWriteAcc->SetPixel( nYAcc, nXAcc, BitmapColor( (BYTE) ( nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ] ) ) ); + pWriteAcc->SetPixel( nYAcc, nXAcc, BitmapColor( (sal_uInt8) ( nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ] ) ) ); } // letztes Pixel gesondert betrachten @@ -1452,12 +1452,12 @@ BOOL Bitmap::ImplDitherFloyd() nX -= 5; CALC_TABLES3; CALC_TABLES5; - pWriteAcc->SetPixel( nYAcc, nWidth1, BitmapColor( (BYTE) ( nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ] ) ) ); + pWriteAcc->SetPixel( nYAcc, nWidth1, BitmapColor( (sal_uInt8) ( nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ] ) ) ); } delete[] p1; delete[] p2; - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -1480,12 +1480,12 @@ BOOL Bitmap::ImplDitherFloyd() // ------------------------------------------------------------------------ -BOOL Bitmap::ImplDitherFloyd16() +sal_Bool Bitmap::ImplDitherFloyd16() { BitmapReadAccess* pReadAcc = AcquireReadAccess(); Bitmap aNewBmp( GetSizePixel(), 24 ); BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pReadAcc && pWriteAcc ) { @@ -1501,7 +1501,7 @@ BOOL Bitmap::ImplDitherFloyd16() ImpErrorQuad* pQLine2 = 0; long nX, nY; long nYTmp = 0L; - BOOL bQ1 = TRUE; + sal_Bool bQ1 = sal_True; for( nY = 0L; nY < Min( nHeight, 2L ); nY++, nYTmp++ ) for( nX = 0L, pQLine2 = !nY ? pErrQuad1 : pErrQuad2; nX < nWidth; nX++ ) @@ -1539,7 +1539,7 @@ BOOL Bitmap::ImplDitherFloyd16() // Zeilenpuffer neu fuellen/kopieren pQLine1 = pQLine2; - pQLine2 = ( bQ1 = !bQ1 ) != FALSE ? pErrQuad2 : pErrQuad1; + pQLine2 = ( bQ1 = !bQ1 ) != sal_False ? pErrQuad2 : pErrQuad1; if( nYTmp < nHeight ) for( nX = 0L; nX < nWidth; nX++ ) @@ -1549,7 +1549,7 @@ BOOL Bitmap::ImplDitherFloyd16() // Zeilenpuffer zerstoeren delete[] pErrQuad1; delete[] pErrQuad2; - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -1571,12 +1571,12 @@ BOOL Bitmap::ImplDitherFloyd16() // ------------------------------------------------------------------------ -BOOL Bitmap::ReduceColors( USHORT nColorCount, BmpReduce eReduce ) +sal_Bool Bitmap::ReduceColors( sal_uInt16 nColorCount, BmpReduce eReduce ) { - BOOL bRet; + sal_Bool bRet; - if( GetColorCount() <= (ULONG) nColorCount ) - bRet = TRUE; + if( GetColorCount() <= (sal_uLong) nColorCount ) + bRet = sal_True; else if( nColorCount ) { if( BMP_REDUCE_SIMPLE == eReduce ) @@ -1587,20 +1587,20 @@ BOOL Bitmap::ReduceColors( USHORT nColorCount, BmpReduce eReduce ) bRet = ImplReduceMedian( nColorCount ); } else - bRet = FALSE; + bRet = sal_False; return bRet; } // ------------------------------------------------------------------------ -BOOL Bitmap::ImplReduceSimple( USHORT nColorCount ) +sal_Bool Bitmap::ImplReduceSimple( sal_uInt16 nColorCount ) { Bitmap aNewBmp; BitmapReadAccess* pRAcc = AcquireReadAccess(); - const USHORT nColCount = Min( nColorCount, (USHORT) 256 ); - USHORT nBitCount; - BOOL bRet = FALSE; + const sal_uInt16 nColCount = Min( nColorCount, (sal_uInt16) 256 ); + sal_uInt16 nBitCount; + sal_Bool bRet = sal_False; if( nColCount <= 2 ) nBitCount = 1; @@ -1627,17 +1627,17 @@ BOOL Bitmap::ImplReduceSimple( USHORT nColorCount ) { for( long nY = 0L; nY < nHeight; nY++ ) for( long nX =0L; nX < nWidth; nX++ ) - pWAcc->SetPixel( nY, nX, (BYTE) aOct.GetBestPaletteIndex( pRAcc->GetPaletteColor( pRAcc->GetPixel( nY, nX ) ) ) ); + pWAcc->SetPixel( nY, nX, (sal_uInt8) aOct.GetBestPaletteIndex( pRAcc->GetPaletteColor( pRAcc->GetPixel( nY, nX ) ) ) ); } else { for( long nY = 0L; nY < nHeight; nY++ ) for( long nX =0L; nX < nWidth; nX++ ) - pWAcc->SetPixel( nY, nX, (BYTE) aOct.GetBestPaletteIndex( pRAcc->GetPixel( nY, nX ) ) ); + pWAcc->SetPixel( nY, nX, (sal_uInt8) aOct.GetBestPaletteIndex( pRAcc->GetPixel( nY, nX ) ) ); } aNewBmp.ReleaseAccess( pWAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pRAcc ); @@ -1682,11 +1682,11 @@ extern "C" int __LOADONCALLAPI ImplPopularCmpFnc( const void* p1, const void* p2 // ------------------------------------------------------------------------ -BOOL Bitmap::ImplReducePopular( USHORT nColCount ) +sal_Bool Bitmap::ImplReducePopular( sal_uInt16 nColCount ) { BitmapReadAccess* pRAcc = AcquireReadAccess(); - USHORT nBitCount; - BOOL bRet = FALSE; + sal_uInt16 nBitCount; + sal_Bool bRet = sal_False; if( nColCount > 256 ) nColCount = 256; @@ -1755,12 +1755,12 @@ BOOL Bitmap::ImplReducePopular( USHORT nColCount ) qsort( pCountTable, nTotalColors, sizeof( PopularColorCount ), ImplPopularCmpFnc ); - for( USHORT n = 0; n < nColCount; n++ ) + for( sal_uInt16 n = 0; n < nColCount; n++ ) { const PopularColorCount& rPop = pCountTable[ n ]; - aNewPal[ n ] = BitmapColor( (BYTE) ( ( rPop.mnIndex >> nLeftShiftBits2 ) << nRightShiftBits ), - (BYTE) ( ( ( rPop.mnIndex >> nLeftShiftBits1 ) & ( nColorsPerComponent - 1 ) ) << nRightShiftBits ), - (BYTE) ( ( rPop.mnIndex & ( nColorsPerComponent - 1 ) ) << nRightShiftBits ) ); + aNewPal[ n ] = BitmapColor( (sal_uInt8) ( ( rPop.mnIndex >> nLeftShiftBits2 ) << nRightShiftBits ), + (sal_uInt8) ( ( ( rPop.mnIndex >> nLeftShiftBits1 ) & ( nColorsPerComponent - 1 ) ) << nRightShiftBits ), + (sal_uInt8) ( ( rPop.mnIndex & ( nColorsPerComponent - 1 ) ) << nRightShiftBits ) ); } Bitmap aNewBmp( GetSizePixel(), nBitCount, &aNewPal ); @@ -1768,13 +1768,13 @@ BOOL Bitmap::ImplReducePopular( USHORT nColCount ) if( pWAcc ) { - BitmapColor aDstCol( (BYTE) 0 ); - BYTE* pIndexMap = new BYTE[ nTotalColors ]; + BitmapColor aDstCol( (sal_uInt8) 0 ); + sal_uInt8* pIndexMap = new sal_uInt8[ nTotalColors ]; for( nR = 0, nIndex = 0; nR < 256; nR += nColorOffset ) for( nG = 0; nG < 256; nG += nColorOffset ) for( nB = 0; nB < 256; nB += nColorOffset ) - pIndexMap[ nIndex++ ] = (BYTE) aNewPal.GetBestIndex( BitmapColor( (BYTE) nR, (BYTE) nG, (BYTE) nB ) ); + pIndexMap[ nIndex++ ] = (sal_uInt8) aNewPal.GetBestIndex( BitmapColor( (sal_uInt8) nR, (sal_uInt8) nG, (sal_uInt8) nB ) ); if( pRAcc->HasPalette() ) { @@ -1807,7 +1807,7 @@ BOOL Bitmap::ImplReducePopular( USHORT nColCount ) delete[] pIndexMap; aNewBmp.ReleaseAccess( pWAcc ); - bRet = TRUE; + bRet = sal_True; } delete[] pCountTable; @@ -1829,11 +1829,11 @@ BOOL Bitmap::ImplReducePopular( USHORT nColCount ) // ------------------------------------------------------------------------ -BOOL Bitmap::ImplReduceMedian( USHORT nColCount ) +sal_Bool Bitmap::ImplReduceMedian( sal_uInt16 nColCount ) { BitmapReadAccess* pRAcc = AcquireReadAccess(); - USHORT nBitCount; - BOOL bRet = FALSE; + sal_uInt16 nBitCount; + sal_Bool bRet = sal_False; if( nColCount < 17 ) nBitCount = 4; @@ -1853,8 +1853,8 @@ BOOL Bitmap::ImplReduceMedian( USHORT nColCount ) if( pWAcc ) { - const ULONG nSize = 32768UL * sizeof( ULONG ); - ULONG* pColBuf = (ULONG*) rtl_allocateMemory( nSize ); + const sal_uLong nSize = 32768UL * sizeof( sal_uLong ); + sal_uLong* pColBuf = (sal_uLong*) rtl_allocateMemory( nSize ); const long nWidth = pWAcc->Width(); const long nHeight = pWAcc->Height(); long nIndex = 0L; @@ -1895,11 +1895,11 @@ BOOL Bitmap::ImplReduceMedian( USHORT nColCount ) pWAcc->SetPalette( aPal ); for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ ) - pWAcc->SetPixel( nY, nX, (BYTE) aMap.GetBestPaletteIndex( pRAcc->GetColor( nY, nX ) ) ); + pWAcc->SetPixel( nY, nX, (sal_uInt8) aMap.GetBestPaletteIndex( pRAcc->GetColor( nY, nX ) ) ); rtl_freeMemory( pColBuf ); aNewBmp.ReleaseAccess( pWAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pRAcc ); @@ -1920,7 +1920,7 @@ BOOL Bitmap::ImplReduceMedian( USHORT nColCount ) // ------------------------------------------------------------------------ -void Bitmap::ImplMedianCut( ULONG* pColBuf, BitmapPalette& rPal, +void Bitmap::ImplMedianCut( sal_uLong* pColBuf, BitmapPalette& rPal, long nR1, long nR2, long nG1, long nG2, long nB1, long nB2, long nColors, long nPixels, long& rIndex ) { @@ -1932,16 +1932,16 @@ void Bitmap::ImplMedianCut( ULONG* pColBuf, BitmapPalette& rPal, const long nGLen = nG2 - nG1; const long nBLen = nB2 - nB1; long nR, nG, nB; - ULONG* pBuf = pColBuf; + sal_uLong* pBuf = pColBuf; if( !nRLen && !nGLen && !nBLen ) { if( pBuf[ RGB15( nR1, nG1, nB1 ) ] ) { - aCol.SetRed( (BYTE) ( nR1 << 3 ) ); - aCol.SetGreen( (BYTE) ( nG1 << 3 ) ); - aCol.SetBlue( (BYTE) ( nB1 << 3 ) ); - rPal[ (USHORT) rIndex++ ] = aCol; + aCol.SetRed( (sal_uInt8) ( nR1 << 3 ) ); + aCol.SetGreen( (sal_uInt8) ( nG1 << 3 ) ); + aCol.SetBlue( (sal_uInt8) ( nB1 << 3 ) ); + rPal[ (sal_uInt16) rIndex++ ] = aCol; } } else @@ -1968,10 +1968,10 @@ void Bitmap::ImplMedianCut( ULONG* pColBuf, BitmapPalette& rPal, } } - aCol.SetRed( (BYTE) ( ( nRSum / nPixels ) << 3 ) ); - aCol.SetGreen( (BYTE) ( ( nGSum / nPixels ) << 3 ) ); - aCol.SetBlue( (BYTE) ( ( nBSum / nPixels ) << 3 ) ); - rPal[ (USHORT) rIndex++ ] = aCol; + aCol.SetRed( (sal_uInt8) ( ( nRSum / nPixels ) << 3 ) ); + aCol.SetGreen( (sal_uInt8) ( ( nGSum / nPixels ) << 3 ) ); + aCol.SetBlue( (sal_uInt8) ( ( nBSum / nPixels ) << 3 ) ); + rPal[ (sal_uInt16) rIndex++ ] = aCol; } else { @@ -2054,32 +2054,32 @@ void Bitmap::ImplMedianCut( ULONG* pColBuf, BitmapPalette& rPal, // ------------------------------------------------------------------------ -BOOL Bitmap::Vectorize( PolyPolygon& rPolyPoly, ULONG nFlags, const Link* pProgress ) +sal_Bool Bitmap::Vectorize( PolyPolygon& rPolyPoly, sal_uLong nFlags, const Link* pProgress ) { return ImplVectorizer().ImplVectorize( *this, rPolyPoly, nFlags, pProgress ); } // ------------------------------------------------------------------------ -BOOL Bitmap::Vectorize( GDIMetaFile& rMtf, BYTE cReduce, ULONG nFlags, const Link* pProgress ) +sal_Bool Bitmap::Vectorize( GDIMetaFile& rMtf, sal_uInt8 cReduce, sal_uLong nFlags, const Link* pProgress ) { return ImplVectorizer().ImplVectorize( *this, rMtf, cReduce, nFlags, pProgress ); } // ------------------------------------------------------------------------ -BOOL Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, +sal_Bool Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, short nChannelBPercent, - double fGamma, BOOL bInvert ) + double fGamma, sal_Bool bInvert ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; // nothing to do => return quickly if( !nLuminancePercent && !nContrastPercent && !nChannelRPercent && !nChannelGPercent && !nChannelBPercent && ( fGamma == 1.0 ) && !bInvert ) { - bRet = TRUE; + bRet = sal_True; } else { @@ -2090,9 +2090,9 @@ BOOL Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, BitmapColor aCol; const long nW = pAcc->Width(); const long nH = pAcc->Height(); - BYTE* cMapR = new BYTE[ 256 ]; - BYTE* cMapG = new BYTE[ 256 ]; - BYTE* cMapB = new BYTE[ 256 ]; + sal_uInt8* cMapR = new sal_uInt8[ 256 ]; + sal_uInt8* cMapG = new sal_uInt8[ 256 ]; + sal_uInt8* cMapB = new sal_uInt8[ 256 ]; long nX, nY; double fM, fROff, fGOff, fBOff, fOff; @@ -2112,14 +2112,14 @@ BOOL Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, // calculate gamma value fGamma = ( fGamma <= 0.0 || fGamma > 10.0 ) ? 1.0 : ( 1.0 / fGamma ); - const BOOL bGamma = ( fGamma != 1.0 ); + const sal_Bool bGamma = ( fGamma != 1.0 ); // create mapping table for( nX = 0L; nX < 256L; nX++ ) { - cMapR[ nX ] = (BYTE) MinMax( FRound( nX * fM + fROff ), 0L, 255L ); - cMapG[ nX ] = (BYTE) MinMax( FRound( nX * fM + fGOff ), 0L, 255L ); - cMapB[ nX ] = (BYTE) MinMax( FRound( nX * fM + fBOff ), 0L, 255L ); + cMapR[ nX ] = (sal_uInt8) MinMax( FRound( nX * fM + fROff ), 0L, 255L ); + cMapG[ nX ] = (sal_uInt8) MinMax( FRound( nX * fM + fGOff ), 0L, 255L ); + cMapB[ nX ] = (sal_uInt8) MinMax( FRound( nX * fM + fBOff ), 0L, 255L ); if( bGamma ) { @@ -2141,7 +2141,7 @@ BOOL Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, { BitmapColor aNewCol; - for( USHORT i = 0, nCount = pAcc->GetPaletteEntryCount(); i < nCount; i++ ) + for( sal_uInt16 i = 0, nCount = pAcc->GetPaletteEntryCount(); i < nCount; i++ ) { const BitmapColor& rCol = pAcc->GetPaletteColor( i ); aNewCol.SetRed( cMapR[ rCol.GetRed() ] ); @@ -2197,7 +2197,7 @@ BOOL Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, delete[] cMapG; delete[] cMapB; ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } } diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx index 4411b5def4ce..1166f6cc0931 100644 --- a/vcl/source/gdi/bitmap4.cxx +++ b/vcl/source/gdi/bitmap4.cxx @@ -49,9 +49,9 @@ // - Bitmap - // ---------- -BOOL Bitmap::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, const Link* pProgress ) +sal_Bool Bitmap::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, const Link* pProgress ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; switch( eFilter ) { @@ -107,11 +107,11 @@ BOOL Bitmap::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, cons // ----------------------------------------------------------------------------- -BOOL Bitmap::ImplConvolute3( const long* pMatrix, long nDivisor, +sal_Bool Bitmap::ImplConvolute3( const long* pMatrix, long nDivisor, const BmpFilterParam* /*pFilterParam*/, const Link* /*pProgress*/ ) { BitmapReadAccess* pReadAcc = AcquireReadAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pReadAcc ) { @@ -124,9 +124,9 @@ BOOL Bitmap::ImplConvolute3( const long* pMatrix, long nDivisor, const long nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2; long* pColm = new long[ nWidth2 ]; long* pRows = new long[ nHeight2 ]; - BitmapColor* pColRow1 = (BitmapColor*) new BYTE[ sizeof( BitmapColor ) * nWidth2 ]; - BitmapColor* pColRow2 = (BitmapColor*) new BYTE[ sizeof( BitmapColor ) * nWidth2 ]; - BitmapColor* pColRow3 = (BitmapColor*) new BYTE[ sizeof( BitmapColor ) * nWidth2 ]; + BitmapColor* pColRow1 = (BitmapColor*) new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]; + BitmapColor* pColRow2 = (BitmapColor*) new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]; + BitmapColor* pColRow3 = (BitmapColor*) new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]; BitmapColor* pRowTmp1 = pColRow1; BitmapColor* pRowTmp2 = pColRow2; BitmapColor* pRowTmp3 = pColRow3; @@ -205,9 +205,9 @@ BOOL Bitmap::ImplConvolute3( const long* pMatrix, long nDivisor, nSumB += pTmp[ pColor->GetBlue() ]; // calculate destination color - pWriteAcc->SetPixel( nY, nX, BitmapColor( (BYTE) MinMax( nSumR / nDivisor, 0, 255 ), - (BYTE) MinMax( nSumG / nDivisor, 0, 255 ), - (BYTE) MinMax( nSumB / nDivisor, 0, 255 ) ) ); + pWriteAcc->SetPixel( nY, nX, BitmapColor( (sal_uInt8) MinMax( nSumR / nDivisor, 0, 255 ), + (sal_uInt8) MinMax( nSumG / nDivisor, 0, 255 ), + (sal_uInt8) MinMax( nSumB / nDivisor, 0, 255 ) ) ); } if( ++nY < nHeight ) @@ -225,15 +225,15 @@ BOOL Bitmap::ImplConvolute3( const long* pMatrix, long nDivisor, } delete[] pKoeff; - delete[] (BYTE*) pColRow1; - delete[] (BYTE*) pColRow2; - delete[] (BYTE*) pColRow3; + delete[] (sal_uInt8*) pColRow1; + delete[] (sal_uInt8*) pColRow2; + delete[] (sal_uInt8*) pColRow3; delete[] pColm; delete[] pRows; aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -255,10 +255,10 @@ BOOL Bitmap::ImplConvolute3( const long* pMatrix, long nDivisor, // ----------------------------------------------------------------------------- -BOOL Bitmap::ImplMedianFilter( const BmpFilterParam* /*pFilterParam*/, const Link* /*pProgress*/ ) +sal_Bool Bitmap::ImplMedianFilter( const BmpFilterParam* /*pFilterParam*/, const Link* /*pProgress*/ ) { BitmapReadAccess* pReadAcc = AcquireReadAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pReadAcc ) { @@ -271,9 +271,9 @@ BOOL Bitmap::ImplMedianFilter( const BmpFilterParam* /*pFilterParam*/, const Lin const long nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2; long* pColm = new long[ nWidth2 ]; long* pRows = new long[ nHeight2 ]; - BitmapColor* pColRow1 = (BitmapColor*) new BYTE[ sizeof( BitmapColor ) * nWidth2 ]; - BitmapColor* pColRow2 = (BitmapColor*) new BYTE[ sizeof( BitmapColor ) * nWidth2 ]; - BitmapColor* pColRow3 = (BitmapColor*) new BYTE[ sizeof( BitmapColor ) * nWidth2 ]; + BitmapColor* pColRow1 = (BitmapColor*) new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]; + BitmapColor* pColRow2 = (BitmapColor*) new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]; + BitmapColor* pColRow3 = (BitmapColor*) new sal_uInt8[ sizeof( BitmapColor ) * nWidth2 ]; BitmapColor* pRowTmp1 = pColRow1; BitmapColor* pRowTmp2 = pColRow2; BitmapColor* pRowTmp3 = pColRow3; @@ -339,7 +339,7 @@ BOOL Bitmap::ImplMedianFilter( const BmpFilterParam* /*pFilterParam*/, const Lin MNMX3( nB9, nB2, nB3 ); // set destination color - pWriteAcc->SetPixel( nY, nX, BitmapColor( (BYTE) nR2, (BYTE) nG2, (BYTE) nB2 ) ); + pWriteAcc->SetPixel( nY, nX, BitmapColor( (sal_uInt8) nR2, (sal_uInt8) nG2, (sal_uInt8) nB2 ) ); } if( ++nY < nHeight ) @@ -356,15 +356,15 @@ BOOL Bitmap::ImplMedianFilter( const BmpFilterParam* /*pFilterParam*/, const Lin } } - delete[] (BYTE*) pColRow1; - delete[] (BYTE*) pColRow2; - delete[] (BYTE*) pColRow3; + delete[] (sal_uInt8*) pColRow1; + delete[] (sal_uInt8*) pColRow2; + delete[] (sal_uInt8*) pColRow3; delete[] pColm; delete[] pRows; aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -386,13 +386,13 @@ BOOL Bitmap::ImplMedianFilter( const BmpFilterParam* /*pFilterParam*/, const Lin // ----------------------------------------------------------------------------- -BOOL Bitmap::ImplSobelGrey( const BmpFilterParam* /*pFilterParam*/, const Link* /*pProgress*/ ) +sal_Bool Bitmap::ImplSobelGrey( const BmpFilterParam* /*pFilterParam*/, const Link* /*pProgress*/ ) { - BOOL bRet = ImplMakeGreyscales( 256 ); + sal_Bool bRet = ImplMakeGreyscales( 256 ); if( bRet ) { - bRet = FALSE; + bRet = sal_False; BitmapReadAccess* pReadAcc = AcquireReadAccess(); @@ -403,7 +403,7 @@ BOOL Bitmap::ImplSobelGrey( const BmpFilterParam* /*pFilterParam*/, const Link* if( pWriteAcc ) { - BitmapColor aGrey( (BYTE) 0 ); + BitmapColor aGrey( (sal_uInt8) 0 ); const long nWidth = pWriteAcc->Width(); const long nHeight = pWriteAcc->Height(); const long nMask111 = -1, nMask121 = 0, nMask131 = 1; @@ -474,7 +474,7 @@ BOOL Bitmap::ImplSobelGrey( const BmpFilterParam* /*pFilterParam*/, const Link* nSum2 += nMask332 * nGrey33; nSum1 = (long) sqrt( (double)( nSum1 * nSum1 + nSum2 * nSum2 ) ); - aGrey.SetIndex( ~(BYTE) SAL_BOUND( nSum1, 0, 255 ) ); + aGrey.SetIndex( ~(sal_uInt8) SAL_BOUND( nSum1, 0, 255 ) ); pWriteAcc->SetPixel( nY, nX, aGrey ); if( nX < ( nWidth - 1 ) ) @@ -491,7 +491,7 @@ BOOL Bitmap::ImplSobelGrey( const BmpFilterParam* /*pFilterParam*/, const Link* delete[] pHMap; delete[] pVMap; aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -514,13 +514,13 @@ BOOL Bitmap::ImplSobelGrey( const BmpFilterParam* /*pFilterParam*/, const Link* // ----------------------------------------------------------------------------- -BOOL Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* /*pProgress*/ ) +sal_Bool Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* /*pProgress*/ ) { - BOOL bRet = ImplMakeGreyscales( 256 ); + sal_Bool bRet = ImplMakeGreyscales( 256 ); if( bRet ) { - bRet = FALSE; + bRet = sal_False; BitmapReadAccess* pReadAcc = AcquireReadAccess(); @@ -531,7 +531,7 @@ BOOL Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* /*p if( pWriteAcc ) { - BitmapColor aGrey( (BYTE) 0 ); + BitmapColor aGrey( (sal_uInt8) 0 ); const long nWidth = pWriteAcc->Width(); const long nHeight = pWriteAcc->Height(); long nGrey11, nGrey12, nGrey13; @@ -549,7 +549,7 @@ BOOL Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* /*p const long nLz = FRound( sin( fElev ) * 255.0 ); const long nZ2 = ( ( 6 * 255 ) / 4 ) * ( ( 6 * 255 ) / 4 ); const long nNzLz = ( ( 6 * 255 ) / 4 ) * nLz; - const BYTE cLz = (BYTE) SAL_BOUND( nLz, 0, 255 ); + const sal_uInt8 cLz = (sal_uInt8) SAL_BOUND( nLz, 0, 255 ); // fill mapping tables pHMap[ 0 ] = 0; @@ -586,7 +586,7 @@ BOOL Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* /*p else { const double fGrey = nDotL / sqrt( (double)(nNx * nNx + nNy * nNy + nZ2) ); - aGrey.SetIndex( (BYTE) SAL_BOUND( fGrey, 0, 255 ) ); + aGrey.SetIndex( (sal_uInt8) SAL_BOUND( fGrey, 0, 255 ) ); } pWriteAcc->SetPixel( nY, nX, aGrey ); @@ -605,7 +605,7 @@ BOOL Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* /*p delete[] pHMap; delete[] pVMap; aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -628,21 +628,21 @@ BOOL Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* /*p // ----------------------------------------------------------------------------- -BOOL Bitmap::ImplSolarize( const BmpFilterParam* pFilterParam, const Link* /*pProgress*/ ) +sal_Bool Bitmap::ImplSolarize( const BmpFilterParam* pFilterParam, const Link* /*pProgress*/ ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; BitmapWriteAccess* pWriteAcc = AcquireWriteAccess(); if( pWriteAcc ) { - const BYTE cThreshold = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_SOLARIZE ) ? + const sal_uInt8 cThreshold = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_SOLARIZE ) ? pFilterParam->mcSolarGreyThreshold : 128; if( pWriteAcc->HasPalette() ) { const BitmapPalette& rPal = pWriteAcc->GetPalette(); - for( USHORT i = 0, nCount = rPal.GetEntryCount(); i < nCount; i++ ) + for( sal_uInt16 i = 0, nCount = rPal.GetEntryCount(); i < nCount; i++ ) { if( rPal[ i ].GetLuminance() >= cThreshold ) { @@ -670,7 +670,7 @@ BOOL Bitmap::ImplSolarize( const BmpFilterParam* pFilterParam, const Link* /*pPr } ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -678,10 +678,10 @@ BOOL Bitmap::ImplSolarize( const BmpFilterParam* pFilterParam, const Link* /*pPr // ----------------------------------------------------------------------------- -BOOL Bitmap::ImplSepia( const BmpFilterParam* pFilterParam, const Link* /*pProgress*/ ) +sal_Bool Bitmap::ImplSepia( const BmpFilterParam* pFilterParam, const Link* /*pProgress*/ ) { BitmapReadAccess* pReadAcc = AcquireReadAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pReadAcc ) { @@ -692,12 +692,12 @@ BOOL Bitmap::ImplSepia( const BmpFilterParam* pFilterParam, const Link* /*pProgr DBG_ASSERT( nSepiaPercent <= 100, "Bitmap::ImplSepia(): sepia value out of range; defaulting to 100%" ); - for( USHORT i = 0; i < 256; i++ ) + for( sal_uInt16 i = 0; i < 256; i++ ) { BitmapColor& rCol = aSepiaPal[ i ]; - const BYTE cSepiaValue = (BYTE) ( ( nSepia * i ) / 10000 ); + const sal_uInt8 cSepiaValue = (sal_uInt8) ( ( nSepia * i ) / 10000 ); - rCol.SetRed( (BYTE) i ); + rCol.SetRed( (sal_uInt8) i ); rCol.SetGreen( cSepiaValue ); rCol.SetBlue( cSepiaValue ); } @@ -707,7 +707,7 @@ BOOL Bitmap::ImplSepia( const BmpFilterParam* pFilterParam, const Link* /*pProgr if( pWriteAcc ) { - BitmapColor aCol( (BYTE) 0 ); + BitmapColor aCol( (sal_uInt8) 0 ); const long nWidth = pWriteAcc->Width(); const long nHeight = pWriteAcc->Height(); @@ -715,10 +715,10 @@ BOOL Bitmap::ImplSepia( const BmpFilterParam* pFilterParam, const Link* /*pProgr { for( long nY = 0; nY < nHeight ; nY++ ) { - const USHORT nPalCount = pReadAcc->GetPaletteEntryCount(); - BYTE* pIndexMap = new BYTE[ nPalCount ]; + const sal_uInt16 nPalCount = pReadAcc->GetPaletteEntryCount(); + sal_uInt8* pIndexMap = new sal_uInt8[ nPalCount ]; - for( USHORT i = 0; i < nPalCount; i++ ) + for( sal_uInt16 i = 0; i < nPalCount; i++ ) pIndexMap[ i ] = pReadAcc->GetPaletteColor( i ).GetLuminance(); for( long nX = 0; nX < nWidth; nX++ ) @@ -743,7 +743,7 @@ BOOL Bitmap::ImplSepia( const BmpFilterParam* pFilterParam, const Link* /*pProgr } aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -765,13 +765,13 @@ BOOL Bitmap::ImplSepia( const BmpFilterParam* pFilterParam, const Link* /*pProgr // ----------------------------------------------------------------------------- -BOOL Bitmap::ImplMosaic( const BmpFilterParam* pFilterParam, const Link* /*pProgress*/ ) +sal_Bool Bitmap::ImplMosaic( const BmpFilterParam* pFilterParam, const Link* /*pProgress*/ ) { - ULONG nTileWidth = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_MOSAIC ) ? + sal_uLong nTileWidth = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_MOSAIC ) ? pFilterParam->maMosaicTileSize.mnTileWidth : 4; - ULONG nTileHeight = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_MOSAIC ) ? + sal_uLong nTileHeight = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_MOSAIC ) ? pFilterParam->maMosaicTileSize.mnTileHeight : 4; - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !nTileWidth ) nTileWidth = 1; @@ -834,9 +834,9 @@ BOOL Bitmap::ImplMosaic( const BmpFilterParam* pFilterParam, const Link* /*pProg } } - aCol.SetRed( (BYTE) ( nSumR * fArea_1 ) ); - aCol.SetGreen( (BYTE) ( nSumG * fArea_1 ) ); - aCol.SetBlue( (BYTE) ( nSumB * fArea_1 ) ); + aCol.SetRed( (sal_uInt8) ( nSumR * fArea_1 ) ); + aCol.SetGreen( (sal_uInt8) ( nSumG * fArea_1 ) ); + aCol.SetBlue( (sal_uInt8) ( nSumB * fArea_1 ) ); for( nY = nY1; nY <= nY2; nY++ ) for( nX = nX1; nX <= nX2; nX++ ) @@ -860,16 +860,16 @@ BOOL Bitmap::ImplMosaic( const BmpFilterParam* pFilterParam, const Link* /*pProg { for( nX = nX1; nX <= nX2; nX++ ) { - const BitmapColor& rCol = pReadAcc->GetPaletteColor( (BYTE) pReadAcc->GetPixel( nY, nX ) ); + const BitmapColor& rCol = pReadAcc->GetPaletteColor( (sal_uInt8) pReadAcc->GetPixel( nY, nX ) ); nSumR += rCol.GetRed(); nSumG += rCol.GetGreen(); nSumB += rCol.GetBlue(); } } - aCol.SetRed( (BYTE) ( nSumR * fArea_1 ) ); - aCol.SetGreen( (BYTE) ( nSumG * fArea_1 ) ); - aCol.SetBlue( (BYTE) ( nSumB * fArea_1 ) ); + aCol.SetRed( (sal_uInt8) ( nSumR * fArea_1 ) ); + aCol.SetGreen( (sal_uInt8) ( nSumG * fArea_1 ) ); + aCol.SetBlue( (sal_uInt8) ( nSumB * fArea_1 ) ); for( nY = nY1; nY <= nY2; nY++ ) for( nX = nX1; nX <= nX2; nX++ ) @@ -893,7 +893,7 @@ BOOL Bitmap::ImplMosaic( const BmpFilterParam* pFilterParam, const Link* /*pProg } while( nY1 < nHeight ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -917,7 +917,7 @@ BOOL Bitmap::ImplMosaic( const BmpFilterParam* pFilterParam, const Link* /*pProg } } else - bRet = TRUE; + bRet = sal_True; return bRet; } @@ -948,13 +948,13 @@ extern "C" int __LOADONCALLAPI ImplPopArtCmpFnc( const void* p1, const void* p2 // ------------------------------------------------------------------------ -BOOL Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link* /*pProgress*/ ) +sal_Bool Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link* /*pProgress*/ ) { - BOOL bRet = ( GetBitCount() > 8 ) ? Convert( BMP_CONVERSION_8BIT_COLORS ) : TRUE; + sal_Bool bRet = ( GetBitCount() > 8 ) ? Convert( BMP_CONVERSION_8BIT_COLORS ) : sal_True; if( bRet ) { - bRet = FALSE; + bRet = sal_False; BitmapWriteAccess* pWriteAcc = AcquireWriteAccess(); @@ -962,8 +962,8 @@ BOOL Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link* /*p { const long nWidth = pWriteAcc->Width(); const long nHeight = pWriteAcc->Height(); - const ULONG nEntryCount = 1 << pWriteAcc->GetBitCount(); - ULONG n; + const sal_uLong nEntryCount = 1 << pWriteAcc->GetBitCount(); + sal_uLong n; PopArtEntry* pPopArtTable = new PopArtEntry[ nEntryCount ]; for( n = 0; n < nEntryCount; n++ ) @@ -982,26 +982,26 @@ BOOL Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link* /*p qsort( pPopArtTable, nEntryCount, sizeof( PopArtEntry ), ImplPopArtCmpFnc ); // get last used entry - ULONG nFirstEntry; - ULONG nLastEntry = 0; + sal_uLong nFirstEntry; + sal_uLong nLastEntry = 0; for( n = 0; n < nEntryCount; n++ ) if( pPopArtTable[ n ].mnCount ) nLastEntry = n; // rotate palette (one entry) - const BitmapColor aFirstCol( pWriteAcc->GetPaletteColor( sal::static_int_cast<USHORT>(pPopArtTable[ 0 ].mnIndex) ) ); + const BitmapColor aFirstCol( pWriteAcc->GetPaletteColor( sal::static_int_cast<sal_uInt16>(pPopArtTable[ 0 ].mnIndex) ) ); for( nFirstEntry = 0; nFirstEntry < nLastEntry; nFirstEntry++ ) { - pWriteAcc->SetPaletteColor( sal::static_int_cast<USHORT>(pPopArtTable[ nFirstEntry ].mnIndex), - pWriteAcc->GetPaletteColor( sal::static_int_cast<USHORT>(pPopArtTable[ nFirstEntry + 1 ].mnIndex) ) ); + pWriteAcc->SetPaletteColor( sal::static_int_cast<sal_uInt16>(pPopArtTable[ nFirstEntry ].mnIndex), + pWriteAcc->GetPaletteColor( sal::static_int_cast<sal_uInt16>(pPopArtTable[ nFirstEntry + 1 ].mnIndex) ) ); } - pWriteAcc->SetPaletteColor( sal::static_int_cast<USHORT>(pPopArtTable[ nLastEntry ].mnIndex), aFirstCol ); + pWriteAcc->SetPaletteColor( sal::static_int_cast<sal_uInt16>(pPopArtTable[ nLastEntry ].mnIndex), aFirstCol ); // cleanup delete[] pPopArtTable; ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } } diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 043e878fd693..dd7b64f1abd6 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -50,7 +50,7 @@ BitmapEx::BitmapEx() : eTransparent( TRANSPARENT_NONE ), - bAlpha ( FALSE ) + bAlpha ( sal_False ) { } @@ -68,7 +68,7 @@ BitmapEx::BitmapEx( const BitmapEx& rBitmapEx ) : BitmapEx::BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize ) : eTransparent( TRANSPARENT_NONE ), - bAlpha ( FALSE ) + bAlpha ( sal_False ) { if( rBitmapEx.IsEmpty() ) return; @@ -77,7 +77,7 @@ BitmapEx::BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize ) : aBitmapSize = aSize; if( rBitmapEx.IsAlpha() ) { - bAlpha = TRUE; + bAlpha = sal_True; aMask = AlphaMask( aSize ).ImplGetBitmap(); } else if( rBitmapEx.IsTransparent() ) @@ -92,7 +92,7 @@ BitmapEx::BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize ) : BitmapEx::BitmapEx( const ResId& rResId ) : eTransparent( TRANSPARENT_NONE ), - bAlpha ( FALSE ) + bAlpha ( sal_False ) { static ImplImageTreeSingletonRef aImageTree; ResMgr* pResMgr = NULL; @@ -119,7 +119,7 @@ BitmapEx::BitmapEx( const Bitmap& rBmp ) : aBitmap ( rBmp ), aBitmapSize ( aBitmap.GetSizePixel() ), eTransparent( TRANSPARENT_NONE ), - bAlpha ( FALSE ) + bAlpha ( sal_False ) { } @@ -130,7 +130,7 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, const Bitmap& rMask ) : aMask ( rMask ), aBitmapSize ( aBitmap.GetSizePixel() ), eTransparent ( !rMask ? TRANSPARENT_NONE : TRANSPARENT_BITMAP ), - bAlpha ( FALSE ) + bAlpha ( sal_False ) { DBG_ASSERT( !rMask || rBmp.GetSizePixel() == rMask.GetSizePixel(), "BitmapEx::BitmapEx(): size mismatch for bitmap and mask." ); @@ -150,7 +150,7 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, const AlphaMask& rAlphaMask ) : aMask ( rAlphaMask.ImplGetBitmap() ), aBitmapSize ( aBitmap.GetSizePixel() ), eTransparent ( !rAlphaMask ? TRANSPARENT_NONE : TRANSPARENT_BITMAP ), - bAlpha ( !rAlphaMask ? FALSE : TRUE ) + bAlpha ( !rAlphaMask ? sal_False : sal_True ) { DBG_ASSERT( !rAlphaMask || rBmp.GetSizePixel() == rAlphaMask.GetSizePixel(), "BitmapEx::BitmapEx(): size mismatch for bitmap and alpha mask." ); @@ -169,7 +169,7 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, const Color& rTransparentColor ) : aBitmapSize ( aBitmap.GetSizePixel() ), aTransparentColor ( rTransparentColor ), eTransparent ( TRANSPARENT_BITMAP ), - bAlpha ( FALSE ) + bAlpha ( sal_False ) { aMask = aBitmap.CreateMask( aTransparentColor ); @@ -204,19 +204,19 @@ BitmapEx& BitmapEx::operator=( const BitmapEx& rBitmapEx ) // ------------------------------------------------------------------ -BOOL BitmapEx::operator==( const BitmapEx& rBitmapEx ) const +sal_Bool BitmapEx::operator==( const BitmapEx& rBitmapEx ) const { if( eTransparent != rBitmapEx.eTransparent ) - return FALSE; + return sal_False; if( aBitmap != rBitmapEx.aBitmap ) - return FALSE; + return sal_False; if( aBitmapSize != rBitmapEx.aBitmapSize ) - return FALSE; + return sal_False; if( eTransparent == TRANSPARENT_NONE ) - return TRUE; + return sal_True; if( eTransparent == TRANSPARENT_COLOR ) return aTransparentColor == rBitmapEx.aTransparentColor; @@ -226,7 +226,7 @@ BOOL BitmapEx::operator==( const BitmapEx& rBitmapEx ) const // ------------------------------------------------------------------ -BOOL BitmapEx::IsEqual( const BitmapEx& rBmpEx ) const +sal_Bool BitmapEx::IsEqual( const BitmapEx& rBmpEx ) const { return( rBmpEx.eTransparent == eTransparent && rBmpEx.bAlpha == bAlpha && @@ -236,7 +236,7 @@ BOOL BitmapEx::IsEqual( const BitmapEx& rBmpEx ) const // ------------------------------------------------------------------ -BOOL BitmapEx::IsEmpty() const +sal_Bool BitmapEx::IsEmpty() const { return( aBitmap.IsEmpty() && aMask.IsEmpty() ); } @@ -248,7 +248,7 @@ void BitmapEx::SetEmpty() aBitmap.SetEmpty(); aMask.SetEmpty(); eTransparent = TRANSPARENT_NONE; - bAlpha = FALSE; + bAlpha = sal_False; } // ------------------------------------------------------------------ @@ -260,14 +260,14 @@ void BitmapEx::Clear() // ------------------------------------------------------------------ -BOOL BitmapEx::IsTransparent() const +sal_Bool BitmapEx::IsTransparent() const { return( eTransparent != TRANSPARENT_NONE ); } // ------------------------------------------------------------------ -BOOL BitmapEx::IsAlpha() const +sal_Bool BitmapEx::IsAlpha() const { return( IsTransparent() && bAlpha ); } @@ -324,9 +324,9 @@ AlphaMask BitmapEx::GetAlpha() const // ------------------------------------------------------------------ -ULONG BitmapEx::GetSizeBytes() const +sal_uLong BitmapEx::GetSizeBytes() const { - ULONG nSizeBytes = aBitmap.GetSizeBytes(); + sal_uLong nSizeBytes = aBitmap.GetSizeBytes(); if( eTransparent == TRANSPARENT_BITMAP ) nSizeBytes += aMask.GetSizeBytes(); @@ -336,7 +336,7 @@ ULONG BitmapEx::GetSizeBytes() const // ------------------------------------------------------------------ -ULONG BitmapEx::GetChecksum() const +sal_uLong BitmapEx::GetChecksum() const { sal_uInt32 nCrc = aBitmap.GetChecksum(); SVBT32 aBT32; @@ -365,9 +365,9 @@ void BitmapEx::SetSizePixel( const Size& rNewSize ) // ------------------------------------------------------------------ -BOOL BitmapEx::Invert() +sal_Bool BitmapEx::Invert() { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !!aBitmap ) { @@ -382,9 +382,9 @@ BOOL BitmapEx::Invert() // ------------------------------------------------------------------ -BOOL BitmapEx::Mirror( ULONG nMirrorFlags ) +sal_Bool BitmapEx::Mirror( sal_uLong nMirrorFlags ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !!aBitmap ) { @@ -399,9 +399,9 @@ BOOL BitmapEx::Mirror( ULONG nMirrorFlags ) // ------------------------------------------------------------------ -BOOL BitmapEx::Scale( const double& rScaleX, const double& rScaleY, ULONG nScaleFlag ) +sal_Bool BitmapEx::Scale( const double& rScaleX, const double& rScaleY, sal_uLong nScaleFlag ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !!aBitmap ) { @@ -421,9 +421,9 @@ BOOL BitmapEx::Scale( const double& rScaleX, const double& rScaleY, ULONG nScale // ------------------------------------------------------------------------ -BOOL BitmapEx::Scale( const Size& rNewSize, ULONG nScaleFlag ) +sal_Bool BitmapEx::Scale( const Size& rNewSize, sal_uLong nScaleFlag ) { - BOOL bRet; + sal_Bool bRet; if( aBitmapSize.Width() && aBitmapSize.Height() ) { @@ -432,20 +432,20 @@ BOOL BitmapEx::Scale( const Size& rNewSize, ULONG nScaleFlag ) nScaleFlag ); } else - bRet = TRUE; + bRet = sal_True; return bRet; } // ------------------------------------------------------------------ -BOOL BitmapEx::Rotate( long nAngle10, const Color& rFillColor ) +sal_Bool BitmapEx::Rotate( long nAngle10, const Color& rFillColor ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !!aBitmap ) { - const BOOL bTransRotate = ( Color( COL_TRANSPARENT ) == rFillColor ); + const sal_Bool bTransRotate = ( Color( COL_TRANSPARENT ) == rFillColor ); if( bTransRotate ) { @@ -485,9 +485,9 @@ BOOL BitmapEx::Rotate( long nAngle10, const Color& rFillColor ) // ------------------------------------------------------------------ -BOOL BitmapEx::Crop( const Rectangle& rRectPixel ) +sal_Bool BitmapEx::Crop( const Rectangle& rRectPixel ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !!aBitmap ) { @@ -507,23 +507,23 @@ BOOL BitmapEx::Crop( const Rectangle& rRectPixel ) // ------------------------------------------------------------------ -BOOL BitmapEx::Convert( BmpConversion eConversion ) +sal_Bool BitmapEx::Convert( BmpConversion eConversion ) { - return( !!aBitmap ? aBitmap.Convert( eConversion ) : FALSE ); + return( !!aBitmap ? aBitmap.Convert( eConversion ) : sal_False ); } // ------------------------------------------------------------------ -BOOL BitmapEx::ReduceColors( USHORT nNewColorCount, BmpReduce eReduce ) +sal_Bool BitmapEx::ReduceColors( sal_uInt16 nNewColorCount, BmpReduce eReduce ) { - return( !!aBitmap ? aBitmap.ReduceColors( nNewColorCount, eReduce ) : FALSE ); + return( !!aBitmap ? aBitmap.ReduceColors( nNewColorCount, eReduce ) : sal_False ); } // ------------------------------------------------------------------ -BOOL BitmapEx::Expand( ULONG nDX, ULONG nDY, const Color* pInitColor, BOOL bExpandTransparent ) +sal_Bool BitmapEx::Expand( sal_uLong nDX, sal_uLong nDY, const Color* pInitColor, sal_Bool bExpandTransparent ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !!aBitmap ) { @@ -546,10 +546,10 @@ BOOL BitmapEx::Expand( ULONG nDX, ULONG nDY, const Color* pInitColor, BOOL bExpa // ------------------------------------------------------------------ -BOOL BitmapEx::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, +sal_Bool BitmapEx::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, const BitmapEx* pBmpExSrc ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !pBmpExSrc || pBmpExSrc->IsEmpty() ) { @@ -580,7 +580,7 @@ BOOL BitmapEx::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, aMask = pAlpha->ImplGetBitmap(); delete pAlpha; - bAlpha = TRUE; + bAlpha = sal_True; aMask.CopyPixel( rRectDst, rRectSrc, &pBmpExSrc->aMask ); } else @@ -591,7 +591,7 @@ BOOL BitmapEx::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, aMask = pAlpha->ImplGetBitmap(); delete pAlpha; eTransparent = TRANSPARENT_BITMAP; - bAlpha = TRUE; + bAlpha = sal_True; aMask.CopyPixel( rRectDst, rRectSrc, &pBmpExSrc->aMask ); } } @@ -635,9 +635,9 @@ BOOL BitmapEx::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, // ------------------------------------------------------------------ -BOOL BitmapEx::Erase( const Color& rFillColor ) +sal_Bool BitmapEx::Erase( const Color& rFillColor ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !!aBitmap ) { @@ -664,41 +664,41 @@ BOOL BitmapEx::Erase( const Color& rFillColor ) // ------------------------------------------------------------------ -BOOL BitmapEx::Dither( ULONG nDitherFlags ) +sal_Bool BitmapEx::Dither( sal_uLong nDitherFlags ) { - return( !!aBitmap ? aBitmap.Dither( nDitherFlags ) : FALSE ); + return( !!aBitmap ? aBitmap.Dither( nDitherFlags ) : sal_False ); } // ------------------------------------------------------------------ -BOOL BitmapEx::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULONG nTol ) +sal_Bool BitmapEx::Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol ) { - return( !!aBitmap ? aBitmap.Replace( rSearchColor, rReplaceColor, nTol ) : FALSE ); + return( !!aBitmap ? aBitmap.Replace( rSearchColor, rReplaceColor, nTol ) : sal_False ); } // ------------------------------------------------------------------ -BOOL BitmapEx::Replace( const Color* pSearchColors, const Color* pReplaceColors, ULONG nColorCount, const ULONG* pTols ) +sal_Bool BitmapEx::Replace( const Color* pSearchColors, const Color* pReplaceColors, sal_uLong nColorCount, const sal_uLong* pTols ) { - return( !!aBitmap ? aBitmap.Replace( pSearchColors, pReplaceColors, nColorCount, (ULONG*) pTols ) : FALSE ); + return( !!aBitmap ? aBitmap.Replace( pSearchColors, pReplaceColors, nColorCount, (sal_uLong*) pTols ) : sal_False ); } // ------------------------------------------------------------------ -BOOL BitmapEx::Adjust( short nLuminancePercent, short nContrastPercent, +sal_Bool BitmapEx::Adjust( short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, short nChannelBPercent, - double fGamma, BOOL bInvert ) + double fGamma, sal_Bool bInvert ) { return( !!aBitmap ? aBitmap.Adjust( nLuminancePercent, nContrastPercent, nChannelRPercent, nChannelGPercent, nChannelBPercent, - fGamma, bInvert ) : FALSE ); + fGamma, bInvert ) : sal_False ); } // ------------------------------------------------------------------ -BOOL BitmapEx::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, const Link* pProgress ) +sal_Bool BitmapEx::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, const Link* pProgress ) { - return( !!aBitmap ? aBitmap.Filter( eFilter, pFilterParam, pProgress ) : FALSE ); + return( !!aBitmap ? aBitmap.Filter( eFilter, pFilterParam, pProgress ) : sal_False ); } // ------------------------------------------------------------------ @@ -857,9 +857,9 @@ SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ) { rBitmapEx.aBitmap.Write( rOStm ); - rOStm << (UINT32) 0x25091962; - rOStm << (UINT32) 0xACB20201; - rOStm << (BYTE) rBitmapEx.eTransparent; + rOStm << (sal_uInt32) 0x25091962; + rOStm << (sal_uInt32) 0xACB20201; + rOStm << (sal_uInt8) rBitmapEx.eTransparent; if( rBitmapEx.eTransparent == TRANSPARENT_BITMAP ) rBitmapEx.aMask.Write( rOStm ); @@ -879,9 +879,9 @@ SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx ) if( !rIStm.GetError() ) { - const ULONG nStmPos = rIStm.Tell(); - UINT32 nMagic1 = 0; - UINT32 nMagic2 = 0; + const sal_uLong nStmPos = rIStm.Tell(); + sal_uInt32 nMagic1 = 0; + sal_uInt32 nMagic2 = 0; rIStm >> nMagic1 >> nMagic2; @@ -893,11 +893,11 @@ SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx ) } else { - BYTE bTransparent = false; + sal_uInt8 bTransparent = false; rIStm >> bTransparent; - if( bTransparent == (BYTE) TRANSPARENT_BITMAP ) + if( bTransparent == (sal_uInt8) TRANSPARENT_BITMAP ) { Bitmap aMask; @@ -920,7 +920,7 @@ SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx ) else rBitmapEx = aBmp; } - else if( bTransparent == (BYTE) TRANSPARENT_COLOR ) + else if( bTransparent == (sal_uInt8) TRANSPARENT_COLOR ) { Color aTransparentColor; diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx index e3a1eb37fa98..0762821c3267 100644 --- a/vcl/source/gdi/bmpacc.cxx +++ b/vcl/source/gdi/bmpacc.cxx @@ -38,7 +38,7 @@ // - BitmapReadAccess - // -------------------- -BitmapReadAccess::BitmapReadAccess( Bitmap& rBitmap, BOOL bModify ) : +BitmapReadAccess::BitmapReadAccess( Bitmap& rBitmap, sal_Bool bModify ) : mpBuffer ( NULL ), mpScanBuf ( NULL ), mFncGetPixel ( NULL ), @@ -55,7 +55,7 @@ BitmapReadAccess::BitmapReadAccess( Bitmap& rBitmap ) : mpScanBuf ( NULL ), mFncGetPixel ( NULL ), mFncSetPixel ( NULL ), - mbModify ( FALSE ) + mbModify ( sal_False ) { ImplCreate( rBitmap ); } @@ -155,9 +155,9 @@ void BitmapReadAccess::ImplDestroy() // ------------------------------------------------------------------ -BOOL BitmapReadAccess::ImplSetAccessPointers( ULONG nFormat ) +sal_Bool BitmapReadAccess::ImplSetAccessPointers( sal_uLong nFormat ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; switch( nFormat ) { @@ -179,7 +179,7 @@ BOOL BitmapReadAccess::ImplSetAccessPointers( ULONG nFormat ) CASE_FORMAT( _32BIT_TC_MASK ) default: - bRet = FALSE; + bRet = sal_False; break; } @@ -197,7 +197,7 @@ void BitmapReadAccess::ImplZeroInitUnusedBits() sal_uInt32 nBits; bool bMsb; - const ULONG nScanlineFormat = GetScanlineFormat(); + const sal_uLong nScanlineFormat = GetScanlineFormat(); switch( nScanlineFormat ) { case( BMP_FORMAT_1BIT_MSB_PAL ): @@ -273,7 +273,7 @@ void BitmapReadAccess::ImplZeroInitUnusedBits() else nMask = static_cast<sal_uInt8>(0xffU >> (nLeftOverBits & 3UL)); - BYTE* pLastBytes = (BYTE*)GetBuffer() + ( nScanSize - nBytes ); + sal_uInt8* pLastBytes = (sal_uInt8*)GetBuffer() + ( nScanSize - nBytes ); for( sal_uInt32 i = 0; i < nHeight; i++, pLastBytes += nScanSize ) { *pLastBytes &= nMask; @@ -285,7 +285,7 @@ void BitmapReadAccess::ImplZeroInitUnusedBits() else if( nBits & 0x1f ) { sal_uInt32 nMask = 0xffffffff << ( ( nScanSize << 3 ) - nBits ); - BYTE* pLast4Bytes = (BYTE*) GetBuffer() + ( nScanSize - 4 ); + sal_uInt8* pLast4Bytes = (sal_uInt8*) GetBuffer() + ( nScanSize - 4 ); #ifdef OSL_LITENDIAN nMask = SWAPLONG( nMask ); @@ -305,7 +305,7 @@ void BitmapReadAccess::Flush() // ------------------------------------------------------------------ -void BitmapReadAccess::ReAccess( BOOL bModify ) +void BitmapReadAccess::ReAccess( sal_Bool bModify ) { const ImpBitmap* pImpBmp = maBitmap.ImplGetImpBitmap(); @@ -321,7 +321,7 @@ void BitmapReadAccess::ReAccess( BOOL bModify ) // ------------------------------------------------------------------ -USHORT BitmapReadAccess::GetBestPaletteIndex( const BitmapColor& rBitmapColor ) const +sal_uInt16 BitmapReadAccess::GetBestPaletteIndex( const BitmapColor& rBitmapColor ) const { return( HasPalette() ? mpBuffer->maPalette.GetBestIndex( rBitmapColor ) : 0 ); } @@ -331,7 +331,7 @@ USHORT BitmapReadAccess::GetBestPaletteIndex( const BitmapColor& rBitmapColor ) // --------------------- BitmapWriteAccess::BitmapWriteAccess( Bitmap& rBitmap ) : - BitmapReadAccess( rBitmap, TRUE ), + BitmapReadAccess( rBitmap, sal_True ), mpLineColor ( NULL ), mpFillColor ( NULL ) { @@ -367,16 +367,16 @@ void BitmapWriteAccess::CopyScanline( long nY, const BitmapReadAccess& rReadAcc // ------------------------------------------------------------------ void BitmapWriteAccess::CopyScanline( long nY, ConstScanline aSrcScanline, - ULONG nSrcScanlineFormat, ULONG nSrcScanlineSize ) + sal_uLong nSrcScanlineFormat, sal_uLong nSrcScanlineSize ) { - const ULONG nFormat = BMP_SCANLINE_FORMAT( nSrcScanlineFormat ); + const sal_uLong nFormat = BMP_SCANLINE_FORMAT( nSrcScanlineFormat ); DBG_ASSERT( ( nY >= 0 ) && ( nY < mpBuffer->mnHeight ), "y-coordinate in destination out of range!" ); DBG_ASSERT( ( HasPalette() && nFormat <= BMP_FORMAT_8BIT_PAL ) || ( !HasPalette() && nFormat > BMP_FORMAT_8BIT_PAL ), "No copying possible between palette and non palette scanlines!" ); - const ULONG nCount = Min( GetScanlineSize(), nSrcScanlineSize ); + const sal_uLong nCount = Min( GetScanlineSize(), nSrcScanlineSize ); if( nCount ) { @@ -438,7 +438,7 @@ void BitmapWriteAccess::CopyBuffer( const BitmapReadAccess& rReadAcc ) ( GetScanlineSize() == rReadAcc.GetScanlineSize() ) ) { const long nHeight = Min( mpBuffer->mnHeight, rReadAcc.Height() ); - const ULONG nCount = nHeight * mpBuffer->mnScanlineSize; + const sal_uLong nCount = nHeight * mpBuffer->mnScanlineSize; memcpy( mpBuffer->mpBits, rReadAcc.GetBuffer(), nCount ); } diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx index 6cff281556ab..718bd56cdb0c 100644 --- a/vcl/source/gdi/bmpacc2.cxx +++ b/vcl/source/gdi/bmpacc2.cxx @@ -44,7 +44,7 @@ IMPL_FORMAT_GETPIXEL_NOMASK( _1BIT_MSB_PAL ) IMPL_FORMAT_SETPIXEL_NOMASK( _1BIT_MSB_PAL ) { - BYTE& rByte = pScanline[ nX >> 3 ]; + sal_uInt8& rByte = pScanline[ nX >> 3 ]; ( rBitmapColor.GetIndex() & 1 ) ? ( rByte |= 1 << ( 7 - ( nX & 7 ) ) ) : ( rByte &= ~( 1 << ( 7 - ( nX & 7 ) ) ) ); @@ -61,7 +61,7 @@ IMPL_FORMAT_GETPIXEL_NOMASK( _1BIT_LSB_PAL ) IMPL_FORMAT_SETPIXEL_NOMASK( _1BIT_LSB_PAL ) { - BYTE& rByte = pScanline[ nX >> 3 ]; + sal_uInt8& rByte = pScanline[ nX >> 3 ]; ( rBitmapColor.GetIndex() & 1 ) ? ( rByte |= 1 << ( nX & 7 ) ) : ( rByte &= ~( 1 << ( nX & 7 ) ) ); @@ -78,7 +78,7 @@ IMPL_FORMAT_GETPIXEL_NOMASK( _4BIT_MSN_PAL ) IMPL_FORMAT_SETPIXEL_NOMASK( _4BIT_MSN_PAL ) { - BYTE& rByte = pScanline[ nX >> 1 ]; + sal_uInt8& rByte = pScanline[ nX >> 1 ]; ( nX & 1 ) ? ( rByte &= 0xf0, rByte |= ( rBitmapColor.GetIndex() & 0x0f ) ) : ( rByte &= 0x0f, rByte |= ( rBitmapColor.GetIndex() << 4 ) ); @@ -95,7 +95,7 @@ IMPL_FORMAT_GETPIXEL_NOMASK( _4BIT_LSN_PAL ) IMPL_FORMAT_SETPIXEL_NOMASK( _4BIT_LSN_PAL ) { - BYTE& rByte = pScanline[ nX >> 1 ]; + sal_uInt8& rByte = pScanline[ nX >> 1 ]; ( nX & 1 ) ? ( rByte &= 0x0f, rByte |= ( rBitmapColor.GetIndex() << 4 ) ) : ( rByte &= 0xf0, rByte |= ( rBitmapColor.GetIndex() & 0x0f ) ); diff --git a/vcl/source/gdi/bmpacc3.cxx b/vcl/source/gdi/bmpacc3.cxx index 55f4a8b412a6..5e87d680e9c0 100644 --- a/vcl/source/gdi/bmpacc3.cxx +++ b/vcl/source/gdi/bmpacc3.cxx @@ -54,7 +54,7 @@ void BitmapWriteAccess::SetLineColor( const Color& rColor ) if( rColor.GetTransparency() == 255 ) mpLineColor = NULL; else - mpLineColor = ( HasPalette() ? new BitmapColor( (BYTE) GetBestPaletteIndex( rColor ) ) : new BitmapColor( rColor ) ); + mpLineColor = ( HasPalette() ? new BitmapColor( (sal_uInt8) GetBestPaletteIndex( rColor ) ) : new BitmapColor( rColor ) ); } // ------------------------------------------------------------------ @@ -88,7 +88,7 @@ void BitmapWriteAccess::SetFillColor( const Color& rColor ) if( rColor.GetTransparency() == 255 ) mpFillColor = NULL; else - mpFillColor = ( HasPalette() ? new BitmapColor( (BYTE) GetBestPaletteIndex( rColor ) ) : new BitmapColor( rColor ) ); + mpFillColor = ( HasPalette() ? new BitmapColor( (sal_uInt8) GetBestPaletteIndex( rColor ) ) : new BitmapColor( rColor ) ); } // ------------------------------------------------------------------ @@ -113,7 +113,7 @@ void BitmapWriteAccess::Erase( const Color& rColor ) // TODO: provide and use Erase( BitmapColor& method) BitmapColor aColor = rColor; if( HasPalette() ) - aColor = BitmapColor( (BYTE)GetBestPaletteIndex( rColor) ); + aColor = BitmapColor( (sal_uInt8)GetBestPaletteIndex( rColor) ); // try fast bitmap method first if( ImplFastEraseBitmap( *mpBuffer, aColor ) ) return; @@ -205,7 +205,7 @@ void BitmapWriteAccess::DrawLine( const Point& rStart, const Point& rEnd ) const long nDYX = ( nDY - nDX ) << 1; const long nDY2 = nDY << 1; long nD = nDY2 - nDX; - BOOL bPos = nY1 < nY2; + sal_Bool bPos = nY1 < nY2; for ( nX = nX1, nY = nY1; nX <= nX2; nX++ ) { @@ -244,7 +244,7 @@ void BitmapWriteAccess::DrawLine( const Point& rStart, const Point& rEnd ) const long nDYX = ( nDX - nDY ) << 1; const long nDY2 = nDX << 1; long nD = nDY2 - nDY; - BOOL bPos = nX1 < nX2; + sal_Bool bPos = nX1 < nX2; for ( nX = nX1, nY = nY1; nY <= nY2; nY++ ) { @@ -313,7 +313,7 @@ void BitmapWriteAccess::DrawRect( const Rectangle& rRect ) void BitmapWriteAccess::FillPolygon( const Polygon& rPoly ) { - const USHORT nSize = rPoly.GetSize(); + const sal_uInt16 nSize = rPoly.GetSize(); if( nSize && mpFillColor ) { @@ -346,9 +346,9 @@ void BitmapWriteAccess::DrawPolygon( const Polygon& rPoly ) if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) ) { - const USHORT nSize = rPoly.GetSize(); + const sal_uInt16 nSize = rPoly.GetSize(); - for( USHORT i = 0, nSize1 = nSize - 1; i < nSize1; i++ ) + for( sal_uInt16 i = 0, nSize1 = nSize - 1; i < nSize1; i++ ) DrawLine( rPoly[ i ], rPoly[ i + 1 ] ); if( rPoly[ nSize - 1 ] != rPoly[ 0 ] ) @@ -360,7 +360,7 @@ void BitmapWriteAccess::DrawPolygon( const Polygon& rPoly ) void BitmapWriteAccess::FillPolyPolygon( const PolyPolygon& rPolyPoly ) { - const USHORT nCount = rPolyPoly.Count(); + const sal_uInt16 nCount = rPolyPoly.Count(); if( nCount && mpFillColor ) { @@ -393,14 +393,14 @@ void BitmapWriteAccess::DrawPolyPolygon( const PolyPolygon& rPolyPoly ) if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) ) { - for( USHORT n = 0, nCount = rPolyPoly.Count(); n < nCount; ) + for( sal_uInt16 n = 0, nCount = rPolyPoly.Count(); n < nCount; ) { const Polygon& rPoly = rPolyPoly[ n++ ]; - const USHORT nSize = rPoly.GetSize(); + const sal_uInt16 nSize = rPoly.GetSize(); if( nSize ) { - for( USHORT i = 0, nSize1 = nSize - 1; i < nSize1; i++ ) + for( sal_uInt16 i = 0, nSize1 = nSize - 1; i < nSize1; i++ ) DrawLine( rPoly[ i ], rPoly[ i + 1 ] ); if( rPoly[ nSize - 1 ] != rPoly[ 0 ] ) diff --git a/vcl/source/gdi/bmpconv.cxx b/vcl/source/gdi/bmpconv.cxx index f71827fc7413..886055817312 100644 --- a/vcl/source/gdi/bmpconv.cxx +++ b/vcl/source/gdi/bmpconv.cxx @@ -29,14 +29,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <vcl/bitmap.hxx> -#include <vcl/impbmpconv.hxx> -#include <vcl/svapp.hxx> +#include "vcl/bitmap.hxx" +#include "vcl/svapp.hxx" +#include "vcl/salctype.hxx" #include <osl/mutex.hxx> -#include <tools/stream.hxx> -#include <com/sun/star/script/XInvocation.hpp> -#include <com/sun/star/awt/XBitmap.hpp> -#include <cppuhelper/compbase1.hxx> +#include "tools/stream.hxx" +#include "com/sun/star/script/XInvocation.hpp" +#include "com/sun/star/awt/XBitmap.hpp" +#include "cppuhelper/compbase1.hxx" using namespace com::sun::star::uno; @@ -155,7 +155,7 @@ Any SAL_CALL BmpConverter::invoke( SvMemoryStream aStream( aDIB.getArray(), aDIB.getLength(), STREAM_READ | STREAM_WRITE ); Bitmap aBM; - aBM.Read( aStream, TRUE ); + aBM.Read( aStream, sal_True ); if( nTargetDepth < 4 ) nTargetDepth = 1; else if( nTargetDepth < 8 ) @@ -190,7 +190,7 @@ BmpTransporter::BmpTransporter( const Bitmap& rBM ) m_aSize.Width = rBM.GetSizePixel().Width(); m_aSize.Height = rBM.GetSizePixel().Height(); SvMemoryStream aStream; - rBM.Write( aStream, FALSE, TRUE ); + rBM.Write( aStream, sal_False, sal_True ); m_aBM = Sequence<sal_Int8>(static_cast<const sal_Int8*>(aStream.GetData()), aStream.GetEndOfData()); } diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx index 4c9ab03ea9c1..8fc5188c9204 100644 --- a/vcl/source/gdi/bmpfast.cxx +++ b/vcl/source/gdi/bmpfast.cxx @@ -56,7 +56,7 @@ protected: PIXBYTE* mpPixel; }; -template <ULONG PIXFMT> +template <sal_uLong PIXFMT> class TrueColorPixelPtr : public BasePixelPtr { public: @@ -255,7 +255,7 @@ class TrueColorPixelPtr<BMP_FORMAT_8BIT_PAL> // ======================================================================= // converting truecolor formats -template <ULONG SRCFMT, ULONG DSTFMT> +template <sal_uLong SRCFMT, sal_uLong DSTFMT> inline void ImplConvertPixel( const TrueColorPixelPtr<DSTFMT>& rDst, const TrueColorPixelPtr<SRCFMT>& rSrc ) { @@ -279,7 +279,7 @@ inline void ImplConvertPixel<BMP_FORMAT_16BIT_TC_LSB_MASK, BMP_FORMAT_16BIT_TC_M // ----------------------------------------------------------------------- -template <ULONG SRCFMT, ULONG DSTFMT> +template <sal_uLong SRCFMT, sal_uLong DSTFMT> inline void ImplConvertLine( const TrueColorPixelPtr<DSTFMT>& rDst, const TrueColorPixelPtr<SRCFMT>& rSrc, int nPixelCount ) { @@ -296,7 +296,7 @@ inline void ImplConvertLine( const TrueColorPixelPtr<DSTFMT>& rDst, // ======================================================================= // alpha blending truecolor pixels -template <unsigned ALPHABITS, ULONG SRCFMT, ULONG DSTFMT> +template <unsigned ALPHABITS, sal_uLong SRCFMT, sal_uLong DSTFMT> inline void ImplBlendPixels( const TrueColorPixelPtr<DSTFMT>& rDst, const TrueColorPixelPtr<SRCFMT>& rSrc, unsigned nAlphaVal ) { @@ -328,7 +328,7 @@ inline void ImplBlendPixels( const TrueColorPixelPtr<DSTFMT>& rDst, // ----------------------------------------------------------------------- -template <unsigned ALPHABITS, ULONG MASKFMT, ULONG SRCFMT, ULONG DSTFMT> +template <unsigned ALPHABITS, sal_uLong MASKFMT, sal_uLong SRCFMT, sal_uLong DSTFMT> inline void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst, const TrueColorPixelPtr<SRCFMT>& rSrc, const TrueColorPixelPtr<MASKFMT>& rMsk, int nPixelCount ) @@ -347,7 +347,7 @@ inline void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst, // ----------------------------------------------------------------------- -template <unsigned ALPHABITS, ULONG SRCFMT, ULONG DSTFMT> +template <unsigned ALPHABITS, sal_uLong SRCFMT, sal_uLong DSTFMT> inline void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst, const TrueColorPixelPtr<SRCFMT>& rSrc, unsigned nAlphaVal, int nPixelCount ) @@ -405,7 +405,7 @@ static bool ImplCopyImage( BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuf // ----------------------------------------------------------------------- -template <ULONG DSTFMT,ULONG SRCFMT> +template <sal_uLong DSTFMT,sal_uLong SRCFMT> bool ImplConvertToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine, BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer ) { @@ -438,7 +438,7 @@ bool ImplConvertToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine, // ----------------------------------------------------------------------- -template <ULONG SRCFMT> +template <sal_uLong SRCFMT> inline bool ImplConvertFromBitmap( BitmapBuffer& rDst, const BitmapBuffer& rSrc ) { TrueColorPixelPtr<SRCFMT> aSrcType; aSrcType.SetRawPtr( rSrc.mpBits ); @@ -539,8 +539,8 @@ bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc, if( rDst.mnHeight < rTR.mnDestY + rTR.mnDestHeight ) return false; - const ULONG nSrcFormat = rSrc.mnFormat & ~BMP_FORMAT_TOP_DOWN; - const ULONG nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN; + const sal_uLong nSrcFormat = rSrc.mnFormat & ~BMP_FORMAT_TOP_DOWN; + const sal_uLong nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN; // TODO: also implement conversions for 16bit colormasks with non-565 format if( nSrcFormat & (BMP_FORMAT_16BIT_TC_LSB_MASK | BMP_FORMAT_16BIT_TC_MSB_MASK) ) @@ -620,7 +620,7 @@ bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc, // ======================================================================= -template <ULONG DSTFMT,ULONG SRCFMT> //,ULONG MSKFMT> +template <sal_uLong DSTFMT,sal_uLong SRCFMT> //,sal_uLong MSKFMT> bool ImplBlendToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine, BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer, const BitmapBuffer& rMskBuffer ) @@ -697,7 +697,7 @@ inline bool ImplBlendToBitmap<BMP_FORMAT_32BIT_TC_BGRA,BMP_FORMAT_32BIT_TC_BGRA> // ----------------------------------------------------------------------- -template <ULONG SRCFMT> +template <sal_uLong SRCFMT> bool ImplBlendFromBitmap( BitmapBuffer& rDst, const BitmapBuffer& rSrc, const BitmapBuffer& rMsk ) { TrueColorPixelPtr<SRCFMT> aSrcType; aSrcType.SetRawPtr( rSrc.mpBits ); @@ -815,8 +815,8 @@ bool ImplFastBitmapBlending( BitmapWriteAccess& rDstWA, const BitmapBuffer& rSrc = *rSrcRA.ImplGetBitmapBuffer(); const BitmapBuffer& rMsk = *rMskRA.ImplGetBitmapBuffer(); - const ULONG nSrcFormat = rSrc.mnFormat & ~BMP_FORMAT_TOP_DOWN; - const ULONG nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN; + const sal_uLong nSrcFormat = rSrc.mnFormat & ~BMP_FORMAT_TOP_DOWN; + const sal_uLong nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN; // accelerated conversions for 16bit colormasks with non-565 format are not yet implemented if( nSrcFormat & (BMP_FORMAT_16BIT_TC_LSB_MASK | BMP_FORMAT_16BIT_TC_MSB_MASK) ) @@ -889,18 +889,18 @@ bool ImplFastEraseBitmap( BitmapBuffer& rDst, const BitmapColor& rColor ) if( bDisableFastBitops ) return false; - const ULONG nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN; + const sal_uLong nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN; // erasing a bitmap is often just a byte-wise memory fill bool bByteFill = true; - BYTE nFillByte; + sal_uInt8 nFillByte; switch( nDstFormat ) { case BMP_FORMAT_1BIT_MSB_PAL: case BMP_FORMAT_1BIT_LSB_PAL: nFillByte = rColor.GetIndex(); - nFillByte = static_cast<BYTE>( -(nFillByte & 1) ); // 0x00 or 0xFF + nFillByte = static_cast<sal_uInt8>( -(nFillByte & 1) ); // 0x00 or 0xFF break; case BMP_FORMAT_4BIT_MSN_PAL: case BMP_FORMAT_4BIT_LSN_PAL: diff --git a/vcl/source/gdi/cvtgrf.cxx b/vcl/source/gdi/cvtgrf.cxx index 4b2522601c7b..261781ebcf50 100644 --- a/vcl/source/gdi/cvtgrf.cxx +++ b/vcl/source/gdi/cvtgrf.cxx @@ -56,10 +56,10 @@ GraphicConverter::~GraphicConverter() // ------------------------------------------------------------------------ -ULONG GraphicConverter::ImplConvert( ULONG nInFormat, void* pInBuffer, ULONG nInBufSize, - void** ppOutBuffer, ULONG nOutFormat ) +sal_uLong GraphicConverter::ImplConvert( sal_uLong nInFormat, void* pInBuffer, sal_uLong nInBufSize, + void** ppOutBuffer, sal_uLong nOutFormat ) { - ULONG nRetBufSize = 0UL; + sal_uLong nRetBufSize = 0UL; if( ( nInFormat != nOutFormat ) && pInBuffer ) { @@ -68,7 +68,7 @@ ULONG GraphicConverter::ImplConvert( ULONG nInFormat, void* pInBuffer, ULONG nIn SvMemoryStream aIStm; Graphic aGraphic; - aIStm.SetBuffer( (char*) pInBuffer, nInBufSize, FALSE, nInBufSize ); + aIStm.SetBuffer( (char*) pInBuffer, nInBufSize, sal_False, nInBufSize ); aIStm >> aGraphic; if( !aIStm.GetError() ) @@ -81,7 +81,7 @@ ULONG GraphicConverter::ImplConvert( ULONG nInFormat, void* pInBuffer, ULONG nIn { nRetBufSize = aOStm.Seek( STREAM_SEEK_TO_END ); *ppOutBuffer = (void*) aOStm.GetData(); - aOStm.ObjectOwnsMemory( FALSE ); + aOStm.ObjectOwnsMemory( sal_False ); } delete mpConvertData; @@ -92,7 +92,7 @@ ULONG GraphicConverter::ImplConvert( ULONG nInFormat, void* pInBuffer, ULONG nIn { SvMemoryStream aIStm; - aIStm.SetBuffer( (char*) pInBuffer, nInBufSize, FALSE, nInBufSize ); + aIStm.SetBuffer( (char*) pInBuffer, nInBufSize, sal_False, nInBufSize ); mpConvertData = new ConvertData( Graphic(), aIStm, nInFormat ); if( maFilterHdl.IsSet() && maFilterHdl.Call( mpConvertData ) ) @@ -118,7 +118,7 @@ ULONG GraphicConverter::ImplConvert( ULONG nInFormat, void* pInBuffer, ULONG nIn { nRetBufSize = aOStm.Seek( STREAM_SEEK_TO_END ); *ppOutBuffer = (void*) aOStm.GetData(); - aOStm.ObjectOwnsMemory( FALSE ); + aOStm.ObjectOwnsMemory( sal_False ); } } @@ -132,10 +132,10 @@ ULONG GraphicConverter::ImplConvert( ULONG nInFormat, void* pInBuffer, ULONG nIn // ------------------------------------------------------------------------ -ULONG GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, ULONG nFormat ) +sal_uLong GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, sal_uLong nFormat ) { GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mpGrfConverter; - ULONG nRet = ERRCODE_IO_GENERAL; + sal_uLong nRet = ERRCODE_IO_GENERAL; if( pCvt && pCvt->GetFilterHdl().IsSet() ) { @@ -155,10 +155,10 @@ ULONG GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, ULONG nForma // ------------------------------------------------------------------------ -ULONG GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, ULONG nFormat ) +sal_uLong GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, sal_uLong nFormat ) { GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mpGrfConverter; - ULONG nRet = ERRCODE_IO_GENERAL; + sal_uLong nRet = ERRCODE_IO_GENERAL; if( pCvt && pCvt->GetFilterHdl().IsSet() ) { diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index df6dcd58545f..2329a9673d23 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -75,12 +75,12 @@ void ImplWriteRect( SvStream& rOStm, const Rectangle& rRect ) void ImplReadPoly( SvStream& rIStm, Polygon& rPoly ) { - INT32 nSize; + sal_Int32 nSize; rIStm >> nSize; - rPoly = Polygon( (USHORT) nSize ); + rPoly = Polygon( (sal_uInt16) nSize ); - for( USHORT i = 0; i < (USHORT) nSize; i++ ) + for( sal_uInt16 i = 0; i < (sal_uInt16) nSize; i++ ) rIStm >> rPoly[ i ]; } @@ -89,11 +89,11 @@ void ImplReadPoly( SvStream& rIStm, Polygon& rPoly ) void ImplReadPolyPoly( SvStream& rIStm, PolyPolygon& rPolyPoly ) { Polygon aPoly; - INT32 nPolyCount; + sal_Int32 nPolyCount; rIStm >> nPolyCount; - for( USHORT i = 0; i < (USHORT) nPolyCount; i++ ) + for( sal_uInt16 i = 0; i < (sal_uInt16) nPolyCount; i++ ) { ImplReadPoly( rIStm, aPoly ); rPolyPoly.Insert( aPoly ); @@ -104,16 +104,16 @@ void ImplReadPolyPoly( SvStream& rIStm, PolyPolygon& rPolyPoly ) void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly ) { - const USHORT nPoly = rPolyPoly.Count(); - USHORT nPoints = 0; - USHORT n; + const sal_uInt16 nPoly = rPolyPoly.Count(); + sal_uInt16 nPoints = 0; + sal_uInt16 n; for( n = 0; n < nPoly; n++ ) - nPoints = sal::static_int_cast<USHORT>(nPoints + rPolyPoly[ n ].GetSize()); + nPoints = sal::static_int_cast<sal_uInt16>(nPoints + rPolyPoly[ n ].GetSize()); - rOStm << (INT16) GDI_POLYPOLYGON_ACTION; - rOStm << (INT32) ( 8 + ( nPoly << 2 ) + ( nPoints << 3 ) ); - rOStm << (INT32) nPoly; + rOStm << (sal_Int16) GDI_POLYPOLYGON_ACTION; + rOStm << (sal_Int32) ( 8 + ( nPoly << 2 ) + ( nPoints << 3 ) ); + rOStm << (sal_Int32) nPoly; for( n = 0; n < nPoly; n++ ) { @@ -122,11 +122,11 @@ void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly ) // a polygon representing the curve as good as possible Polygon aSimplePoly; rPolyPoly[n].AdaptiveSubdivide(aSimplePoly); - const USHORT nSize(aSimplePoly.GetSize()); + const sal_uInt16 nSize(aSimplePoly.GetSize()); - rOStm << (INT32) nSize; + rOStm << (sal_Int32) nSize; - for( USHORT j = 0; j < nSize; j++ ) + for( sal_uInt16 j = 0; j < nSize; j++ ) rOStm << aSimplePoly[ j ]; } } @@ -135,26 +135,26 @@ void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly ) void ImplReadColor( SvStream& rIStm, Color& rColor ) { - INT16 nVal; + sal_Int16 nVal; - rIStm >> nVal; rColor.SetRed( sal::static_int_cast<UINT8>((USHORT)nVal >> 8) ); - rIStm >> nVal; rColor.SetGreen( sal::static_int_cast<UINT8>((USHORT)nVal >> 8) ); - rIStm >> nVal; rColor.SetBlue( sal::static_int_cast<UINT8>((USHORT)nVal >> 8) ); + rIStm >> nVal; rColor.SetRed( sal::static_int_cast<sal_uInt8>((sal_uInt16)nVal >> 8) ); + rIStm >> nVal; rColor.SetGreen( sal::static_int_cast<sal_uInt8>((sal_uInt16)nVal >> 8) ); + rIStm >> nVal; rColor.SetBlue( sal::static_int_cast<sal_uInt8>((sal_uInt16)nVal >> 8) ); } // ------------------------------------------------------------------------ void ImplWriteColor( SvStream& rOStm, const Color& rColor ) { - INT16 nVal; + sal_Int16 nVal; - nVal = ( (INT16) rColor.GetRed() << 8 ) | rColor.GetRed(); + nVal = ( (sal_Int16) rColor.GetRed() << 8 ) | rColor.GetRed(); rOStm << nVal; - nVal = ( (INT16) rColor.GetGreen() << 8 ) | rColor.GetGreen(); + nVal = ( (sal_Int16) rColor.GetGreen() << 8 ) | rColor.GetGreen(); rOStm << nVal; - nVal = ( (INT16) rColor.GetBlue() << 8 ) | rColor.GetBlue(); + nVal = ( (sal_Int16) rColor.GetBlue() << 8 ) | rColor.GetBlue(); rOStm << nVal; } @@ -163,11 +163,11 @@ void ImplWriteColor( SvStream& rOStm, const Color& rColor ) void ImplReadMapMode( SvStream& rIStm, MapMode& rMapMode ) { Point aOrg; - INT32 nXNum; - INT32 nXDenom; - INT32 nYNum; - INT32 nYDenom; - INT16 nUnit; + sal_Int32 nXNum; + sal_Int32 nXDenom; + sal_Int32 nYNum; + sal_Int32 nYDenom; + sal_Int16 nUnit; rIStm >> nUnit >> aOrg >> nXNum >> nXDenom >> nYNum >> nYDenom; rMapMode = MapMode( (MapUnit) nUnit, aOrg, Fraction( nXNum, nXDenom ), Fraction( nYNum, nYDenom ) ); @@ -177,39 +177,39 @@ void ImplReadMapMode( SvStream& rIStm, MapMode& rMapMode ) void ImplWriteMapMode( SvStream& rOStm, const MapMode& rMapMode ) { - rOStm << (INT16) rMapMode.GetMapUnit(); + rOStm << (sal_Int16) rMapMode.GetMapUnit(); rOStm << rMapMode.GetOrigin(); - rOStm << (INT32) rMapMode.GetScaleX().GetNumerator(); - rOStm << (INT32) rMapMode.GetScaleX().GetDenominator(); - rOStm << (INT32) rMapMode.GetScaleY().GetNumerator(); - rOStm << (INT32) rMapMode.GetScaleY().GetDenominator(); + rOStm << (sal_Int32) rMapMode.GetScaleX().GetNumerator(); + rOStm << (sal_Int32) rMapMode.GetScaleX().GetDenominator(); + rOStm << (sal_Int32) rMapMode.GetScaleY().GetNumerator(); + rOStm << (sal_Int32) rMapMode.GetScaleY().GetDenominator(); } // ------------------------------------------------------------------------ void ImplWritePushAction( SvStream& rOStm ) { - rOStm << (INT16) GDI_PUSH_ACTION; - rOStm << (INT32) 4; + rOStm << (sal_Int16) GDI_PUSH_ACTION; + rOStm << (sal_Int32) 4; } // ------------------------------------------------------------------------ void ImplWritePopAction( SvStream& rOStm ) { - rOStm << (INT16) GDI_POP_ACTION; - rOStm << (INT32) 4; + rOStm << (sal_Int16) GDI_POP_ACTION; + rOStm << (sal_Int32) 4; } // ------------------------------------------------------------------------ -void ImplWriteLineColor( SvStream& rOStm, const Color& rColor, INT16 nStyle, INT32 nWidth = 0L ) +void ImplWriteLineColor( SvStream& rOStm, const Color& rColor, sal_Int16 nStyle, sal_Int32 nWidth = 0L ) { if( rColor.GetTransparency() > 127 ) nStyle = 0; - rOStm << (INT16) GDI_PEN_ACTION; - rOStm << (INT32) 16; + rOStm << (sal_Int16) GDI_PEN_ACTION; + rOStm << (sal_Int32) 16; ImplWriteColor( rOStm, rColor ); rOStm << nWidth; rOStm << nStyle; @@ -217,10 +217,10 @@ void ImplWriteLineColor( SvStream& rOStm, const Color& rColor, INT16 nStyle, INT // ------------------------------------------------------------------------ -void ImplWriteFillColor( SvStream& rOStm, const Color& rColor, INT16 nStyle ) +void ImplWriteFillColor( SvStream& rOStm, const Color& rColor, sal_Int16 nStyle ) { - rOStm << (INT16) GDI_FILLBRUSH_ACTION; - rOStm << (INT32) 20; + rOStm << (sal_Int16) GDI_FILLBRUSH_ACTION; + rOStm << (sal_Int32) 20; ImplWriteColor( rOStm, rColor ); if( rColor.GetTransparency() > 127 ) @@ -230,13 +230,13 @@ void ImplWriteFillColor( SvStream& rOStm, const Color& rColor, INT16 nStyle ) { ImplWriteColor( rOStm, COL_WHITE ); rOStm << nStyle; - rOStm << (INT16) 1; + rOStm << (sal_Int16) 1; } else { ImplWriteColor( rOStm, COL_BLACK ); rOStm << nStyle; - rOStm << (INT16) 0; + rOStm << (sal_Int16) 0; } } @@ -275,24 +275,24 @@ void ImplWriteFont( SvStream& rOStm, const Font& rFont, break; } - rOStm << (INT16) GDI_FONT_ACTION; - rOStm << (INT32) 78; + rOStm << (sal_Int16) GDI_FONT_ACTION; + rOStm << (sal_Int32) 78; rActualCharSet = GetStoreCharSet( rFont.GetCharSet() ); ImplWriteColor( rOStm, rFont.GetColor() ); ImplWriteColor( rOStm, rFont.GetFillColor() ); rOStm.Write( aName, 32 ); rOStm << rFont.GetSize(); - rOStm << (INT16) 0; // no character orientation anymore - rOStm << (INT16) rFont.GetOrientation(); - rOStm << (INT16) rActualCharSet; - rOStm << (INT16) rFont.GetFamily(); - rOStm << (INT16) rFont.GetPitch(); - rOStm << (INT16) rFont.GetAlign(); - rOStm << (INT16) nWeight; - rOStm << (INT16) rFont.GetUnderline(); - rOStm << (INT16) rFont.GetStrikeout(); - rOStm << (BOOL) ( rFont.GetItalic() != ITALIC_NONE ); + rOStm << (sal_Int16) 0; // no character orientation anymore + rOStm << (sal_Int16) rFont.GetOrientation(); + rOStm << (sal_Int16) rActualCharSet; + rOStm << (sal_Int16) rFont.GetFamily(); + rOStm << (sal_Int16) rFont.GetPitch(); + rOStm << (sal_Int16) rFont.GetAlign(); + rOStm << (sal_Int16) nWeight; + rOStm << (sal_Int16) rFont.GetUnderline(); + rOStm << (sal_Int16) rFont.GetStrikeout(); + rOStm << (sal_Bool) ( rFont.GetItalic() != ITALIC_NONE ); rOStm << rFont.IsOutline(); rOStm << rFont.IsShadow(); rOStm << rFont.IsTransparent(); @@ -302,9 +302,9 @@ void ImplWriteFont( SvStream& rOStm, const Font& rFont, // ------------------------------------------------------------------------ -void ImplWriteRasterOpAction( SvStream& rOStm, INT16 nRasterOp ) +void ImplWriteRasterOpAction( SvStream& rOStm, sal_Int16 nRasterOp ) { - rOStm << (INT16) GDI_RASTEROP_ACTION << (INT32) 6 << nRasterOp; + rOStm << (sal_Int16) GDI_RASTEROP_ACTION << (sal_Int32) 6 << nRasterOp; } // ------------------------------------------------------------------------ @@ -356,12 +356,12 @@ void ImplReadUnicodeComment( sal_uInt32 nStrmPos, SvStream& rIStm, String& rStri // ------------------------------------------------------------------------ -void ImplSkipActions( SvStream& rIStm, ULONG nSkipCount ) +void ImplSkipActions( SvStream& rIStm, sal_uLong nSkipCount ) { - INT32 nActionSize; - INT16 nType; + sal_Int32 nActionSize; + sal_Int16 nType; - for( ULONG i = 0UL; i < nSkipCount; i++ ) + for( sal_uLong i = 0UL; i < nSkipCount; i++ ) { rIStm >> nType >> nActionSize; rIStm.SeekRel( nActionSize - 4L ); @@ -400,7 +400,7 @@ bool ImplWriteExtendedPolyPolygonAction(SvStream& rOStm, const PolyPolygon& rPol if((bOnlyWhenCurve && nAllFlagCount) || (!bOnlyWhenCurve && nAllPointCount)) { - rOStm << (INT16) GDI_EXTENDEDPOLYGON_ACTION; + rOStm << (sal_Int16) GDI_EXTENDEDPOLYGON_ACTION; const sal_Int32 nActionSize( 4 + // Action size @@ -429,16 +429,16 @@ bool ImplWriteExtendedPolyPolygonAction(SvStream& rOStm, const PolyPolygon& rPol if(rCandidate.HasFlags()) { - rOStm << (BYTE)true; + rOStm << (sal_uInt8)true; for(sal_uInt16 c(0); c < nPointCount; c++) { - rOStm << (BYTE)rCandidate.GetFlags(c); + rOStm << (sal_uInt8)rCandidate.GetFlags(c); } } else { - rOStm << (BYTE)false; + rOStm << (sal_uInt8)false; } } } @@ -471,12 +471,12 @@ void ImplReadExtendedPolyPolygonAction(SvStream& rIStm, PolyPolygon& rPolyPoly) rIStm >> aCandidate[b]; } - BYTE bHasFlags(false); + sal_uInt8 bHasFlags(false); rIStm >> bHasFlags; if(bHasFlags) { - BYTE aPolyFlags(0); + sal_uInt8 aPolyFlags(0); for(sal_uInt16 c(0); c < nPointCount; c++) { @@ -494,7 +494,7 @@ void ImplReadExtendedPolyPolygonAction(SvStream& rIStm, PolyPolygon& rPolyPoly) // - SVMConverter - // ---------------- -SVMConverter::SVMConverter( SvStream& rStm, GDIMetaFile& rMtf, ULONG nConvertMode ) +SVMConverter::SVMConverter( SvStream& rStm, GDIMetaFile& rMtf, sal_uLong nConvertMode ) { if( !rStm.GetError() ) { @@ -509,15 +509,15 @@ SVMConverter::SVMConverter( SvStream& rStm, GDIMetaFile& rMtf, ULONG nConvertMod void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) { - const ULONG nPos = rIStm.Tell(); - const USHORT nOldFormat = rIStm.GetNumberFormatInt(); + const sal_uLong nPos = rIStm.Tell(); + const sal_uInt16 nOldFormat = rIStm.GetNumberFormatInt(); rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); char aCode[ 5 ]; Size aPrefSz; - INT16 nSize; - INT16 nVersion; + sal_Int16 nSize; + sal_Int16 nVersion; // read header rIStm.Read( (char*) &aCode, sizeof( aCode ) ); // Kennung @@ -541,7 +541,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) Stack aLIStack; VirtualDevice aFontVDev; rtl_TextEncoding eActualCharSet = gsl_getSystemTextEncoding(); - BOOL bFatLine = FALSE; + sal_Bool bFatLine = sal_False; // TODO: fix reindentation below if you can accept being blamed by the SCM MapMode aMapMode; @@ -550,12 +550,12 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) Point aPt, aPt1; Size aSz; Color aActionColor; - INT32 nTmp, nTmp1, nActionSize; - INT32 nActions; - INT16 nType; + sal_Int32 nTmp, nTmp1, nActionSize; + sal_Int32 nActions; + sal_Int16 nType; sal_uInt32 nUnicodeCommentStreamPos = 0; - INT32 nUnicodeCommentActionNumber = 0; + sal_Int32 nUnicodeCommentActionNumber = 0; ImplReadMapMode( rIStm, aMapMode ); // MapMode rIStm >> nActions; // Action count @@ -564,7 +564,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.SetPrefMapMode( aMapMode ); sal_uInt32 nLastPolygonAction(0); - for( INT32 i = 0L; i < nActions; i++ ) + for( sal_Int32 i = 0L; i < nActions; i++ ) { rIStm >> nType; sal_Int32 nActBegin = rIStm.Tell(); @@ -598,7 +598,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case (GDI_LINEJOIN_ACTION) : { - INT16 nLineJoin(0); + sal_Int16 nLineJoin(0); rIStm >> nLineJoin; aLineInfo.SetLineJoin((basegfx::B2DLineJoin)nLineJoin); } @@ -606,8 +606,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case (GDI_LINEDASHDOT_ACTION) : { - INT16 a(0); - INT32 b(0); + sal_Int16 a(0); + sal_Int32 b(0); rIStm >> a; aLineInfo.SetDashCount(a); rIStm >> b; aLineInfo.SetDashLen(b); @@ -715,7 +715,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) const Polygon aPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 ); rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) ); - rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, FALSE ) ); + rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) ); rMtf.AddAction( new MetaPolygonAction( aPoly ) ); rMtf.AddAction( new MetaPopAction() ); rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) ); @@ -735,7 +735,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) const Polygon aPoly( aRect, aPt, aPt1, POLY_ARC ); rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) ); - rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, FALSE ) ); + rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) ); rMtf.AddAction( new MetaPolygonAction( aPoly ) ); rMtf.AddAction( new MetaPopAction() ); rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) ); @@ -755,7 +755,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) const Polygon aPoly( aRect, aPt, aPt1, POLY_PIE ); rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) ); - rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, FALSE ) ); + rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) ); rMtf.AddAction( new MetaPolygonAction( aPoly ) ); rMtf.AddAction( new MetaPopAction() ); rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) ); @@ -795,7 +795,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) if( bFatLine ) { rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) ); - rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, FALSE ) ); + rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) ); rMtf.AddAction( new MetaPolygonAction( aActionPoly ) ); rMtf.AddAction( new MetaPopAction() ); rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) ); @@ -817,11 +817,11 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) if( bFatLine ) { rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) ); - rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, FALSE ) ); + rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) ); rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) ); rMtf.AddAction( new MetaPopAction() ); - for( USHORT nPoly = 0, nCount = aPolyPoly.Count(); nPoly < nCount; nPoly++ ) + for( sal_uInt16 nPoly = 0, nCount = aPolyPoly.Count(); nPoly < nCount; nPoly++ ) rMtf.AddAction( new MetaPolyLineAction( aPolyPoly[ nPoly ], aLineInfo ) ); } else @@ -836,10 +836,10 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) { Font aFont; char aName[ 32 ]; - INT32 nWidth, nHeight; - INT16 nCharSet, nFamily, nPitch, nAlign, nWeight, nUnderline, nStrikeout; - INT16 nCharOrient, nLineOrient; - BOOL bItalic, bOutline, bShadow, bTransparent; + sal_Int32 nWidth, nHeight; + sal_Int16 nCharSet, nFamily, nPitch, nAlign, nWeight, nUnderline, nStrikeout; + sal_Int16 nCharOrient, nLineOrient; + sal_Bool bItalic, bOutline, bShadow, bTransparent; ImplReadColor( rIStm, aActionColor ); aFont.SetColor( aActionColor ); ImplReadColor( rIStm, aActionColor ); aFont.SetFillColor( aActionColor ); @@ -882,16 +882,16 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_TEXT_ACTION ): { ByteString aByteStr; - INT32 nIndex, nLen; + sal_Int32 nIndex, nLen; rIStm >> aPt >> nIndex >> nLen >> nTmp; if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) ) { - rIStm.Read( aByteStr.AllocBuffer( (USHORT)nTmp ), nTmp + 1 ); + rIStm.Read( aByteStr.AllocBuffer( (sal_uInt16)nTmp ), nTmp + 1 ); UniString aStr( aByteStr, eActualCharSet ); if ( nUnicodeCommentActionNumber == i ) ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr ); - rMtf.AddAction( new MetaTextAction( aPt, aStr, (USHORT) nIndex, (USHORT) nLen ) ); + rMtf.AddAction( new MetaTextAction( aPt, aStr, (sal_uInt16) nIndex, (sal_uInt16) nLen ) ); } rIStm.Seek( nActBegin + nActionSize ); } @@ -901,17 +901,17 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) { ByteString aByteStr; sal_Int32* pDXAry = NULL; - INT32 nIndex, nLen, nAryLen; + sal_Int32 nIndex, nLen, nAryLen; rIStm >> aPt >> nIndex >> nLen >> nTmp >> nAryLen; if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) ) { - rIStm.Read( aByteStr.AllocBuffer( (USHORT)nTmp ), nTmp + 1 ); + rIStm.Read( aByteStr.AllocBuffer( (sal_uInt16)nTmp ), nTmp + 1 ); UniString aStr( aByteStr, eActualCharSet ); if( nAryLen > 0L ) { - INT32 nStrLen( aStr.Len() ); + sal_Int32 nStrLen( aStr.Len() ); pDXAry = new sal_Int32[ Max( nAryLen, nStrLen ) ]; @@ -925,7 +925,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) { sal_Int32* pTmpAry = new sal_Int32[nStrLen]; - aFontVDev.GetTextArray( aStr, pTmpAry, (USHORT) nIndex, (USHORT) nLen ); + aFontVDev.GetTextArray( aStr, pTmpAry, (sal_uInt16) nIndex, (sal_uInt16) nLen ); // now, the difference between the // last and the second last DX array @@ -949,7 +949,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } if ( nUnicodeCommentActionNumber == i ) ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr ); - rMtf.AddAction( new MetaTextArrayAction( aPt, aStr, pDXAry, (USHORT) nIndex, (USHORT) nLen ) ); + rMtf.AddAction( new MetaTextArrayAction( aPt, aStr, pDXAry, (sal_uInt16) nIndex, (sal_uInt16) nLen ) ); if( pDXAry ) delete[] pDXAry; @@ -961,16 +961,16 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_STRETCHTEXT_ACTION ): { ByteString aByteStr; - INT32 nIndex, nLen, nWidth; + sal_Int32 nIndex, nLen, nWidth; rIStm >> aPt >> nIndex >> nLen >> nTmp >> nWidth; if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_INT16 - 1 ) ) ) { - rIStm.Read( aByteStr.AllocBuffer( (USHORT)nTmp ), nTmp + 1 ); + rIStm.Read( aByteStr.AllocBuffer( (sal_uInt16)nTmp ), nTmp + 1 ); UniString aStr( aByteStr, eActualCharSet ); if ( nUnicodeCommentActionNumber == i ) ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr ); - rMtf.AddAction( new MetaStretchTextAction( aPt, nWidth, aStr, (USHORT) nIndex, (USHORT) nLen ) ); + rMtf.AddAction( new MetaStretchTextAction( aPt, nWidth, aStr, (sal_uInt16) nIndex, (sal_uInt16) nLen ) ); } rIStm.Seek( nActBegin + nActionSize ); } @@ -1006,8 +1006,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_PEN_ACTION ): { - INT32 nPenWidth; - INT16 nPenStyle; + sal_Int32 nPenWidth; + sal_Int16 nPenStyle; ImplReadColor( rIStm, aActionColor ); rIStm >> nPenWidth >> nPenStyle; @@ -1022,7 +1022,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_FILLBRUSH_ACTION ): { - INT16 nBrushStyle; + sal_Int16 nBrushStyle; ImplReadColor( rIStm, aActionColor ); rIStm.SeekRel( 6L ); @@ -1045,9 +1045,9 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_CLIPREGION_ACTION ): { Region aRegion; - INT16 nRegType; - INT16 bIntersect; - BOOL bClip = FALSE; + sal_Int16 nRegType; + sal_Int16 bIntersect; + sal_Bool bClip = sal_False; rIStm >> nRegType >> bIntersect; ImplReadRect( rIStm, aRect ); @@ -1063,7 +1063,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) ImplReadRect( rIStm, aRegRect ); aRegion = Region( aRegRect ); - bClip = TRUE; + bClip = sal_True; } break; @@ -1071,25 +1071,25 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) { ImplReadPoly( rIStm, aActionPoly ); aRegion = Region( aActionPoly ); - bClip = TRUE; + bClip = sal_True; } break; case( 3 ): { PolyPolygon aPolyPoly; - INT32 nPolyCount; + sal_Int32 nPolyCount; rIStm >> nPolyCount; - for( USHORT j = 0; j < (USHORT) nPolyCount; j++ ) + for( sal_uInt16 j = 0; j < (sal_uInt16) nPolyCount; j++ ) { ImplReadPoly( rIStm, aActionPoly ); aPolyPoly.Insert( aActionPoly ); } aRegion = Region( aPolyPoly ); - bClip = TRUE; + bClip = sal_True; } break; } @@ -1118,7 +1118,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_RASTEROP_ACTION ): { RasterOp eRasterOp; - INT16 nRasterOp; + sal_Int16 nRasterOp; rIStm >> nRasterOp; @@ -1176,13 +1176,13 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) { Color aStartCol; Color aEndCol; - INT16 nStyle; - INT16 nAngle; - INT16 nBorder; - INT16 nOfsX; - INT16 nOfsY; - INT16 nIntensityStart; - INT16 nIntensityEnd; + sal_Int16 nStyle; + sal_Int16 nAngle; + sal_Int16 nBorder; + sal_Int16 nOfsX; + sal_Int16 nOfsY; + sal_Int16 nIntensityStart; + sal_Int16 nIntensityEnd; ImplReadRect( rIStm, aRect ); rIStm >> nStyle; @@ -1205,8 +1205,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_TRANSPARENT_COMMENT ): { PolyPolygon aPolyPoly; - INT32 nFollowingActionCount; - INT16 nTrans; + sal_Int32 nFollowingActionCount; + sal_Int16 nTrans; rIStm >> aPolyPoly >> nTrans >> nFollowingActionCount; ImplSkipActions( rIStm, nFollowingActionCount ); @@ -1224,7 +1224,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) Point aPos; Size aSize; Gradient aGradient; - INT32 nFollowingActionCount; + sal_Int32 nFollowingActionCount; rIStm >> aMtf >> aPos >> aSize >> aGradient >> nFollowingActionCount; ImplSkipActions( rIStm, nFollowingActionCount ); @@ -1240,7 +1240,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) { PolyPolygon aPolyPoly; Hatch aHatch; - INT32 nFollowingActionCount; + sal_Int32 nFollowingActionCount; rIStm >> aPolyPoly >> aHatch >> nFollowingActionCount; ImplSkipActions( rIStm, nFollowingActionCount ); @@ -1255,8 +1255,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_REFPOINT_COMMENT ): { Point aRefPoint; - BOOL bSet; - INT32 nFollowingActionCount; + sal_Bool bSet; + sal_Int32 nFollowingActionCount; rIStm >> aRefPoint >> bSet >> nFollowingActionCount; ImplSkipActions( rIStm, nFollowingActionCount ); @@ -1277,8 +1277,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_TEXTLINECOLOR_COMMENT ): { Color aColor; - BOOL bSet; - INT32 nFollowingActionCount; + sal_Bool bSet; + sal_Int32 nFollowingActionCount; rIStm >> aColor >> bSet >> nFollowingActionCount; ImplSkipActions( rIStm, nFollowingActionCount ); @@ -1296,7 +1296,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) long nWidth; sal_uInt32 nStrikeout; sal_uInt32 nUnderline; - INT32 nFollowingActionCount; + sal_Int32 nFollowingActionCount; rIStm >> aStartPt >> nWidth >> nStrikeout >> nUnderline >> nFollowingActionCount; ImplSkipActions( rIStm, nFollowingActionCount ); @@ -1315,7 +1315,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) { PolyPolygon aPolyPoly; Gradient aGradient; - INT32 nFollowingActionCount; + sal_Int32 nFollowingActionCount; rIStm >> aPolyPoly >> aGradient >> nFollowingActionCount; ImplSkipActions( rIStm, nFollowingActionCount ); @@ -1332,14 +1332,14 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) ByteString aComment; sal_Int32 nValue; sal_uInt32 nDataSize; - BYTE* pData; - INT32 nFollowingActionCount; + sal_uInt8* pData; + sal_Int32 nFollowingActionCount; rIStm >> aComment >> nValue >> nDataSize; if( nDataSize ) { - pData = new BYTE[ nDataSize ]; + pData = new sal_uInt8[ nDataSize ]; rIStm.Read( pData, nDataSize ); } else @@ -1380,12 +1380,12 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf ) { - ULONG nCountPos; + sal_uLong nCountPos; Font aSaveFont; - const USHORT nOldFormat = rOStm.GetNumberFormatInt(); + const sal_uInt16 nOldFormat = rOStm.GetNumberFormatInt(); rtl_TextEncoding eActualCharSet = gsl_getSystemTextEncoding(); const Size aPrefSize( rMtf.GetPrefSize() ); - BOOL bRop_0_1 = FALSE; + sal_Bool bRop_0_1 = sal_False; VirtualDevice aSaveVDev; Color aLineCol( COL_BLACK ); Stack aLineColStack; @@ -1394,18 +1394,18 @@ void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf ) //MagicCode schreiben rOStm << "SVGDI"; // Kennung - rOStm << (INT16) 42; // HeaderSize - rOStm << (INT16) 200; // VERSION - rOStm << (INT32) aPrefSize.Width(); - rOStm << (INT32) aPrefSize.Height(); + rOStm << (sal_Int16) 42; // HeaderSize + rOStm << (sal_Int16) 200; // VERSION + rOStm << (sal_Int32) aPrefSize.Width(); + rOStm << (sal_Int32) aPrefSize.Height(); ImplWriteMapMode( rOStm, rMtf.GetPrefMapMode() ); // ActionCount wird spaeter geschrieben nCountPos = rOStm.Tell(); rOStm.SeekRel( 4L ); - const INT32 nActCount = ImplWriteActions( rOStm, rMtf, aSaveVDev, bRop_0_1, aLineCol, aLineColStack, eActualCharSet ); - const ULONG nActPos = rOStm.Tell(); + const sal_Int32 nActCount = ImplWriteActions( rOStm, rMtf, aSaveVDev, bRop_0_1, aLineCol, aLineColStack, eActualCharSet ); + const sal_uLong nActPos = rOStm.Tell(); rOStm.Seek( nCountPos ); rOStm << nActCount; @@ -1419,13 +1419,13 @@ void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf ) // ------------------------------------------------------------------------ -ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, - VirtualDevice& rSaveVDev, BOOL& rRop_0_1, +sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, + VirtualDevice& rSaveVDev, sal_Bool& rRop_0_1, Color& rLineCol, Stack& rLineColStack, rtl_TextEncoding& rActualCharSet ) { - ULONG nCount = 0; - for( ULONG i = 0, nActionCount = rMtf.GetActionCount(); i < nActionCount; i++ ) + sal_uLong nCount = 0; + for( sal_uLong i = 0, nActionCount = rMtf.GetActionCount(); i < nActionCount; i++ ) { const MetaAction* pAction = rMtf.GetAction( i ); @@ -1435,8 +1435,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaPixelAction* pAct = (MetaPixelAction*) pAction; - rOStm << (INT16) GDI_PIXEL_ACTION; - rOStm << (INT32) 18; + rOStm << (sal_Int16) GDI_PIXEL_ACTION; + rOStm << (sal_Int32) 18; rOStm << pAct->GetPoint(); ImplWriteColor( rOStm, pAct->GetColor() ); nCount++; @@ -1447,8 +1447,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaPointAction* pAct = (MetaPointAction*) pAction; - rOStm << (INT16) GDI_POINT_ACTION; - rOStm << (INT32) 12; + rOStm << (sal_Int16) GDI_POINT_ACTION; + rOStm << (sal_Int32) 12; rOStm << pAct->GetPoint(); nCount++; } @@ -1469,25 +1469,25 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, if(bLineJoin) { - rOStm << (INT16) GDI_LINEJOIN_ACTION; - rOStm << (INT32) 6; - rOStm << (INT16) rInfo.GetLineJoin(); + rOStm << (sal_Int16) GDI_LINEJOIN_ACTION; + rOStm << (sal_Int32) 6; + rOStm << (sal_Int16) rInfo.GetLineJoin(); } if(bLineDashDot) { - rOStm << (INT16) GDI_LINEDASHDOT_ACTION; - rOStm << (INT32) 4 + 16; - rOStm << (INT16)rInfo.GetDashCount(); - rOStm << (INT32)rInfo.GetDashLen(); - rOStm << (INT16)rInfo.GetDotCount(); - rOStm << (INT32)rInfo.GetDotLen(); - rOStm << (INT32)rInfo.GetDistance(); + rOStm << (sal_Int16) GDI_LINEDASHDOT_ACTION; + rOStm << (sal_Int32) 4 + 16; + rOStm << (sal_Int16)rInfo.GetDashCount(); + rOStm << (sal_Int32)rInfo.GetDashLen(); + rOStm << (sal_Int16)rInfo.GetDotCount(); + rOStm << (sal_Int32)rInfo.GetDotLen(); + rOStm << (sal_Int32)rInfo.GetDistance(); } } - rOStm << (INT16) GDI_LINE_ACTION; - rOStm << (INT32) 20; + rOStm << (sal_Int16) GDI_LINE_ACTION; + rOStm << (sal_Int32) 20; rOStm << pAct->GetStartPoint(); rOStm << pAct->GetEndPoint(); nCount++; @@ -1514,11 +1514,11 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaRectAction* pAct = (MetaRectAction*) pAction; - rOStm << (INT16) GDI_RECT_ACTION; - rOStm << (INT32) 28; + rOStm << (sal_Int16) GDI_RECT_ACTION; + rOStm << (sal_Int32) 28; ImplWriteRect( rOStm, pAct->GetRect() ); - rOStm << (INT32) 0; - rOStm << (INT32) 0; + rOStm << (sal_Int32) 0; + rOStm << (sal_Int32) 0; nCount++; } break; @@ -1527,11 +1527,11 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaRoundRectAction* pAct = (MetaRoundRectAction*) pAction; - rOStm << (INT16) GDI_RECT_ACTION; - rOStm << (INT32) 28; + rOStm << (sal_Int16) GDI_RECT_ACTION; + rOStm << (sal_Int32) 28; ImplWriteRect( rOStm, pAct->GetRect() ); - rOStm << (INT32) pAct->GetHorzRound(); - rOStm << (INT32) pAct->GetVertRound(); + rOStm << (sal_Int32) pAct->GetHorzRound(); + rOStm << (sal_Int32) pAct->GetVertRound(); nCount++; } break; @@ -1540,8 +1540,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaEllipseAction* pAct = (MetaEllipseAction*) pAction; - rOStm << (INT16) GDI_ELLIPSE_ACTION; - rOStm << (INT32) 20; + rOStm << (sal_Int16) GDI_ELLIPSE_ACTION; + rOStm << (sal_Int32) 20; ImplWriteRect( rOStm, pAct->GetRect() ); nCount++; } @@ -1551,8 +1551,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaArcAction* pAct = (MetaArcAction*) pAction; - rOStm << (INT16) GDI_ARC_ACTION; - rOStm << (INT32) 36; + rOStm << (sal_Int16) GDI_ARC_ACTION; + rOStm << (sal_Int32) 36; ImplWriteRect( rOStm, pAct->GetRect() ); rOStm << pAct->GetStartPoint(); rOStm << pAct->GetEndPoint(); @@ -1564,8 +1564,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaPieAction* pAct = (MetaPieAction*) pAction; - rOStm << (INT16) GDI_PIE_ACTION; - rOStm << (INT32) 36; + rOStm << (sal_Int16) GDI_PIE_ACTION; + rOStm << (sal_Int32) 36; ImplWriteRect( rOStm, pAct->GetRect() ); rOStm << pAct->GetStartPoint(); rOStm << pAct->GetEndPoint(); @@ -1578,13 +1578,13 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, MetaChordAction* pAct = (MetaChordAction*) pAction; Polygon aChordPoly( pAct->GetRect(), pAct->GetStartPoint(), pAct->GetEndPoint(), POLY_CHORD ); - const USHORT nPoints = aChordPoly.GetSize(); + const sal_uInt16 nPoints = aChordPoly.GetSize(); - rOStm << (INT16) GDI_POLYGON_ACTION; - rOStm << (INT32) ( 8 + ( nPoints << 3 ) ); - rOStm << (INT32) nPoints; + rOStm << (sal_Int16) GDI_POLYGON_ACTION; + rOStm << (sal_Int32) ( 8 + ( nPoints << 3 ) ); + rOStm << (sal_Int32) nPoints; - for( USHORT n = 0; n < nPoints; n++ ) + for( sal_uInt16 n = 0; n < nPoints; n++ ) rOStm << aChordPoly[ n ]; nCount++; } @@ -1600,7 +1600,7 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, Polygon aSimplePoly; pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly); const LineInfo& rInfo = pAct->GetLineInfo(); - const USHORT nPoints(aSimplePoly.GetSize()); + const sal_uInt16 nPoints(aSimplePoly.GetSize()); const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle())); const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin()); const bool bLineDashDot(LINE_DASH == rInfo.GetStyle()); @@ -1612,28 +1612,28 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, if(bLineJoin) { - rOStm << (INT16) GDI_LINEJOIN_ACTION; - rOStm << (INT32) 6; - rOStm << (INT16) rInfo.GetLineJoin(); + rOStm << (sal_Int16) GDI_LINEJOIN_ACTION; + rOStm << (sal_Int32) 6; + rOStm << (sal_Int16) rInfo.GetLineJoin(); } } if(bLineDashDot) { - rOStm << (INT16) GDI_LINEDASHDOT_ACTION; - rOStm << (INT32) 4 + 16; - rOStm << (INT16)rInfo.GetDashCount(); - rOStm << (INT32)rInfo.GetDashLen(); - rOStm << (INT16)rInfo.GetDotCount(); - rOStm << (INT32)rInfo.GetDotLen(); - rOStm << (INT32)rInfo.GetDistance(); + rOStm << (sal_Int16) GDI_LINEDASHDOT_ACTION; + rOStm << (sal_Int32) 4 + 16; + rOStm << (sal_Int16)rInfo.GetDashCount(); + rOStm << (sal_Int32)rInfo.GetDashLen(); + rOStm << (sal_Int16)rInfo.GetDotCount(); + rOStm << (sal_Int32)rInfo.GetDotLen(); + rOStm << (sal_Int32)rInfo.GetDistance(); } - rOStm << (INT16) GDI_POLYLINE_ACTION; - rOStm << (INT32) ( 8 + ( nPoints << 3 ) ); - rOStm << (INT32) nPoints; + rOStm << (sal_Int16) GDI_POLYLINE_ACTION; + rOStm << (sal_Int32) ( 8 + ( nPoints << 3 ) ); + rOStm << (sal_Int32) nPoints; - for( USHORT n = 0; n < nPoints; n++ ) + for( sal_uInt16 n = 0; n < nPoints; n++ ) { rOStm << aSimplePoly[ n ]; } @@ -1672,13 +1672,13 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, // a polygon representing the curve as good as possible Polygon aSimplePoly; pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly); - const USHORT nPoints(aSimplePoly.GetSize()); + const sal_uInt16 nPoints(aSimplePoly.GetSize()); - rOStm << (INT16) GDI_POLYGON_ACTION; - rOStm << (INT32) ( 8 + ( nPoints << 3 ) ); - rOStm << (INT32) nPoints; + rOStm << (sal_Int16) GDI_POLYGON_ACTION; + rOStm << (sal_Int32) ( 8 + ( nPoints << 3 ) ); + rOStm << (sal_Int32) nPoints; - for( USHORT n = 0; n < nPoints; n++ ) + for( sal_uInt16 n = 0; n < nPoints; n++ ) rOStm << aSimplePoly[ n ]; nCount++; @@ -1709,17 +1709,17 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, MetaTextAction* pAct = (MetaTextAction*) pAction; String aUniText( pAct->GetText() ); ByteString aText( aUniText, rActualCharSet ); - const ULONG nStrLen = aText.Len(); + const sal_uLong nStrLen = aText.Len(); if ( ImplWriteUnicodeComment( rOStm, aUniText ) ) nCount++; - rOStm << (INT16) GDI_TEXT_ACTION; - rOStm << (INT32) ( 24 + ( nStrLen + 1 ) ); + rOStm << (sal_Int16) GDI_TEXT_ACTION; + rOStm << (sal_Int32) ( 24 + ( nStrLen + 1 ) ); rOStm << pAct->GetPoint(); - rOStm << (INT32) pAct->GetIndex(); - rOStm << (INT32) pAct->GetLen(); - rOStm << (INT32) nStrLen; + rOStm << (sal_Int32) pAct->GetIndex(); + rOStm << (sal_Int32) pAct->GetLen(); + rOStm << (sal_Int32) nStrLen; rOStm.Write( aText.GetBuffer(), nStrLen + 1 ); nCount++; } @@ -1730,9 +1730,9 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, MetaTextArrayAction* pAct = (MetaTextArrayAction*)pAction; ByteString aText( pAct->GetText(), rActualCharSet ); String aUniText( pAct->GetText(), pAct->GetIndex(), pAct->GetLen() ); - ULONG nAryLen; - ULONG nLen = pAct->GetLen(); - const ULONG nTextLen = aText.Len(); + sal_uLong nAryLen; + sal_uLong nLen = pAct->GetLen(); + const sal_uLong nTextLen = aText.Len(); sal_Int32* pDXArray = pAct->GetDXArray(); if ( ImplWriteUnicodeComment( rOStm, aUniText ) ) @@ -1751,17 +1751,17 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, else nAryLen = nLen; // #105987# Write out all of DX array - rOStm << (INT16) GDI_TEXTARRAY_ACTION; - rOStm << (INT32) ( 28 + ( nLen + 1 ) + ( nAryLen * 4 ) ); + rOStm << (sal_Int16) GDI_TEXTARRAY_ACTION; + rOStm << (sal_Int32) ( 28 + ( nLen + 1 ) + ( nAryLen * 4 ) ); rOStm << pAct->GetPoint(); - rOStm << (INT32) 0; - rOStm << (INT32) nLen; - rOStm << (INT32) nLen; - rOStm << (INT32) nAryLen; + rOStm << (sal_Int32) 0; + rOStm << (sal_Int32) nLen; + rOStm << (sal_Int32) nLen; + rOStm << (sal_Int32) nAryLen; rOStm.Write( aText.GetBuffer()+pAct->GetIndex(), nLen + 1 ); - for( ULONG n = 0UL ; n < nAryLen; n++ ) - rOStm << (INT32) pDXArray[ n ]; + for( sal_uLong n = 0UL ; n < nAryLen; n++ ) + rOStm << (sal_Int32) pDXArray[ n ]; nCount++; } @@ -1772,18 +1772,18 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, MetaStretchTextAction* pAct = (MetaStretchTextAction*) pAction; String aUniText( pAct->GetText() ); ByteString aText( aUniText, rActualCharSet ); - const ULONG nStrLen = aText.Len(); + const sal_uLong nStrLen = aText.Len(); if ( ImplWriteUnicodeComment( rOStm, aUniText ) ) nCount++; - rOStm << (INT16) GDI_STRETCHTEXT_ACTION; - rOStm << (INT32) ( 28 + ( nStrLen + 1 ) ); + rOStm << (sal_Int16) GDI_STRETCHTEXT_ACTION; + rOStm << (sal_Int32) ( 28 + ( nStrLen + 1 ) ); rOStm << pAct->GetPoint(); - rOStm << (INT32) pAct->GetIndex(); - rOStm << (INT32) pAct->GetLen(); - rOStm << (INT32) nStrLen; - rOStm << (INT32) pAct->GetWidth(); + rOStm << (sal_Int32) pAct->GetIndex(); + rOStm << (sal_Int32) pAct->GetLen(); + rOStm << (sal_Int32) nStrLen; + rOStm << (sal_Int32) pAct->GetWidth(); rOStm.Write( aText.GetBuffer(), nStrLen + 1 ); nCount++; } @@ -1793,8 +1793,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaBmpAction* pAct = (MetaBmpAction*) pAction; - rOStm << (INT16) GDI_BITMAP_ACTION; - rOStm << (INT32) 12; + rOStm << (sal_Int16) GDI_BITMAP_ACTION; + rOStm << (sal_Int32) 12; rOStm << pAct->GetPoint(); rOStm << pAct->GetBitmap(); nCount++; @@ -1805,8 +1805,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction; - rOStm << (INT16) GDI_BITMAPSCALE_ACTION; - rOStm << (INT32) 20; + rOStm << (sal_Int16) GDI_BITMAPSCALE_ACTION; + rOStm << (sal_Int32) 20; rOStm << pAct->GetPoint(); rOStm << pAct->GetSize(); rOStm << pAct->GetBitmap(); @@ -1818,8 +1818,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction; - rOStm << (INT16) GDI_BITMAPSCALEPART_ACTION; - rOStm << (INT32) 36; + rOStm << (sal_Int16) GDI_BITMAPSCALEPART_ACTION; + rOStm << (sal_Int32) 36; rOStm << pAct->GetDestPoint(); rOStm << pAct->GetDestSize(); rOStm << pAct->GetSrcPoint(); @@ -1834,8 +1834,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, MetaBmpExAction* pAct = (MetaBmpExAction*) pAction; const Bitmap aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() ); - rOStm << (INT16) GDI_BITMAP_ACTION; - rOStm << (INT32) 12; + rOStm << (sal_Int16) GDI_BITMAP_ACTION; + rOStm << (sal_Int32) 12; rOStm << pAct->GetPoint(); rOStm << aBmp; nCount++; @@ -1847,8 +1847,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, MetaBmpExScaleAction* pAct = (MetaBmpExScaleAction*) pAction; const Bitmap aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() ); - rOStm << (INT16) GDI_BITMAPSCALE_ACTION; - rOStm << (INT32) 20; + rOStm << (sal_Int16) GDI_BITMAPSCALE_ACTION; + rOStm << (sal_Int32) 20; rOStm << pAct->GetPoint(); rOStm << pAct->GetSize(); rOStm << aBmp; @@ -1861,8 +1861,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction; const Bitmap aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() ); - rOStm << (INT16) GDI_BITMAPSCALEPART_ACTION; - rOStm << (INT32) 36; + rOStm << (sal_Int16) GDI_BITMAPSCALEPART_ACTION; + rOStm << (sal_Int32) 36; rOStm << pAct->GetDestPoint(); rOStm << pAct->GetDestSize(); rOStm << pAct->GetSrcPoint(); @@ -1877,18 +1877,18 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, MetaGradientAction* pAct = (MetaGradientAction*) pAction; const Gradient& rGrad = pAct->GetGradient(); - rOStm << (INT16) GDI_GRADIENT_ACTION; - rOStm << (INT32) 46; + rOStm << (sal_Int16) GDI_GRADIENT_ACTION; + rOStm << (sal_Int32) 46; ImplWriteRect( rOStm, pAct->GetRect() ); - rOStm << (INT16) rGrad.GetStyle(); + rOStm << (sal_Int16) rGrad.GetStyle(); ImplWriteColor( rOStm, rGrad.GetStartColor() ); ImplWriteColor( rOStm, rGrad.GetEndColor() ); - rOStm << (INT16) rGrad.GetAngle(); - rOStm << (INT16) rGrad.GetBorder(); - rOStm << (INT16) rGrad.GetOfsX(); - rOStm << (INT16) rGrad.GetOfsY(); - rOStm << (INT16) rGrad.GetStartIntensity(); - rOStm << (INT16) rGrad.GetEndIntensity(); + rOStm << (sal_Int16) rGrad.GetAngle(); + rOStm << (sal_Int16) rGrad.GetBorder(); + rOStm << (sal_Int16) rGrad.GetOfsX(); + rOStm << (sal_Int16) rGrad.GetOfsY(); + rOStm << (sal_Int16) rGrad.GetStartIntensity(); + rOStm << (sal_Int16) rGrad.GetEndIntensity(); nCount++; } break; @@ -1896,10 +1896,10 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, case( META_GRADIENTEX_ACTION ): { const MetaGradientExAction* pA = (MetaGradientExAction*) pAction; - ULONG nOldPos, nNewPos; + sal_uLong nOldPos, nNewPos; // write RefPoint comment - rOStm << (INT16) GDI_GRADIENTEX_COMMENT; + rOStm << (sal_Int16) GDI_GRADIENTEX_COMMENT; // we'll write the ActionSize later nOldPos = rOStm.Tell(); @@ -1907,12 +1907,12 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, // write data rOStm << pA->GetPolyPolygon() << pA->GetGradient(); - rOStm << (INT32) 0; // number of actions that follow this comment + rOStm << (sal_Int32) 0; // number of actions that follow this comment // calculate and write ActionSize of comment nNewPos = rOStm.Tell(); rOStm.Seek( nOldPos ); - rOStm << (INT32) ( nNewPos - nOldPos ); + rOStm << (sal_Int32) ( nNewPos - nOldPos ); rOStm.Seek( nNewPos ); nCount++; @@ -1928,11 +1928,11 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, ImplWriteLineColor( rOStm, rColor, 1 ); ImplWriteFillColor( rOStm, rColor, 1 ); - rOStm << (INT16) GDI_RECT_ACTION; - rOStm << (INT32) 28; + rOStm << (sal_Int16) GDI_RECT_ACTION; + rOStm << (sal_Int32) 28; ImplWriteRect( rOStm, pAct->GetRect() ); - rOStm << (INT32) 0; - rOStm << (INT32) 0; + rOStm << (sal_Int32) 0; + rOStm << (sal_Int32) 0; ImplWritePopAction( rOStm ); nCount += 5; @@ -1945,18 +1945,18 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, const Region& rRegion = pAct->GetRegion(); Rectangle aClipRect; - rOStm << (INT16) GDI_CLIPREGION_ACTION; - rOStm << (INT32) 24; + rOStm << (sal_Int16) GDI_CLIPREGION_ACTION; + rOStm << (sal_Int32) 24; if( pAct->IsClipping() ) { aClipRect = rRegion.GetBoundRect(); - rOStm << (INT16) 1; + rOStm << (sal_Int16) 1; } else - rOStm << (INT16) 0; + rOStm << (sal_Int16) 0; - rOStm << (INT16) 0; + rOStm << (sal_Int16) 0; ImplWriteRect( rOStm, aClipRect ); if( pAct->IsClipping() ) @@ -1970,8 +1970,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaISectRectClipRegionAction* pAct = (MetaISectRectClipRegionAction*) pAction; - rOStm << (INT16) GDI_ISECTCLIPREGION_ACTION; - rOStm << (INT32) 20; + rOStm << (sal_Int16) GDI_ISECTCLIPREGION_ACTION; + rOStm << (sal_Int32) 20; rOStm << pAct->GetRect(); nCount++; } @@ -1981,10 +1981,10 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaMoveClipRegionAction* pAct = (MetaMoveClipRegionAction*) pAction; - rOStm << (INT16) GDI_MOVECLIPREGION_ACTION; - rOStm << (INT32) 12; - rOStm << (INT32) pAct->GetHorzMove(); - rOStm << (INT32) pAct->GetVertMove(); + rOStm << (sal_Int16) GDI_MOVECLIPREGION_ACTION; + rOStm << (sal_Int32) 12; + rOStm << (sal_Int32) pAct->GetHorzMove(); + rOStm << (sal_Int32) pAct->GetVertMove(); nCount++; } break; @@ -2055,8 +2055,8 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaMapModeAction* pAct = (MetaMapModeAction*) pAction; - rOStm << (INT16) GDI_MAPMODE_ACTION; - rOStm << (INT32) 30; + rOStm << (sal_Int16) GDI_MAPMODE_ACTION; + rOStm << (sal_Int32) 30; ImplWriteMapMode( rOStm, pAct->GetMapMode() ); nCount++; } @@ -2093,7 +2093,7 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, if( ( pAct->GetRasterOp() != ROP_0 ) && ( pAct->GetRasterOp() != ROP_1 ) ) { - INT16 nRasterOp; + sal_Int16 nRasterOp; // Falls vorher ROP_0/1 gesetzt war, alten // Zustand durch Pop erst wieder herstellen @@ -2101,7 +2101,7 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { ImplWritePopAction( rOStm ); rSaveVDev.Pop(); - rRop_0_1 = FALSE; + rRop_0_1 = sal_False; nCount++; } @@ -2133,7 +2133,7 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, } ImplWriteRasterOpAction( rOStm, 0 ); - rRop_0_1 = TRUE; + rRop_0_1 = sal_True; nCount += 4; } } @@ -2142,12 +2142,12 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, case( META_TRANSPARENT_ACTION ): { const PolyPolygon& rPolyPoly = ( (MetaTransparentAction*) pAction )->GetPolyPolygon(); - const INT16 nTrans = ( (MetaTransparentAction*) pAction )->GetTransparence(); - const INT16 nBrushStyle = ( nTrans < 38 ) ? 8 : ( nTrans < 63 ) ? 9 : 10; - ULONG nOldPos, nNewPos; + const sal_Int16 nTrans = ( (MetaTransparentAction*) pAction )->GetTransparence(); + const sal_Int16 nBrushStyle = ( nTrans < 38 ) ? 8 : ( nTrans < 63 ) ? 9 : 10; + sal_uLong nOldPos, nNewPos; // write transparence comment - rOStm << (INT16) GDI_TRANSPARENT_COMMENT; + rOStm << (sal_Int16) GDI_TRANSPARENT_COMMENT; // we'll write the ActionSize later nOldPos = rOStm.Tell(); @@ -2156,12 +2156,12 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, // write comment data rOStm << rPolyPoly; rOStm << nTrans; - rOStm << (INT32) 15; // number of actions that follow this comment + rOStm << (sal_Int32) 15; // number of actions that follow this comment // calculate and write ActionSize of comment nNewPos = rOStm.Tell(); rOStm.Seek( nOldPos ); - rOStm << (INT32) ( nNewPos - nOldPos ); + rOStm << (sal_Int32) ( nNewPos - nOldPos ); rOStm.Seek( nNewPos ); { @@ -2207,10 +2207,10 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, const Point& rPos = pA->GetPoint(); const Size& rSize = pA->GetSize(); const Gradient& rGradient = pA->GetGradient(); - ULONG nOldPos, nNewPos; + sal_uLong nOldPos, nNewPos; // write RefPoint comment - rOStm << (INT16) GDI_FLOATTRANSPARENT_COMMENT; + rOStm << (sal_Int16) GDI_FLOATTRANSPARENT_COMMENT; // we'll write the ActionSize later nOldPos = rOStm.Tell(); @@ -2222,12 +2222,12 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, // calculate and write ActionSize of comment nNewPos = rOStm.Tell(); rOStm.Seek( nOldPos ); - rOStm << (INT32) ( nNewPos - nOldPos + 4 ); + rOStm << (sal_Int32) ( nNewPos - nOldPos + 4 ); rOStm.Seek( ( nOldPos = nNewPos ) + 4 ); { // write actions for float transparence - ULONG nAddCount; + sal_uLong nAddCount; GDIMetaFile aMtf( rTransMtf ); const Size aSrcSize( rTransMtf.GetPrefSize() ); Point aSrcPt( rTransMtf.GetPrefMapMode().GetOrigin() ); @@ -2249,7 +2249,7 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, nAddCount = ImplWriteActions( rOStm, aMtf, rSaveVDev, rRop_0_1, rLineCol, rLineColStack, rActualCharSet ); nNewPos = rOStm.Tell(); rOStm.Seek( nOldPos ); - rOStm << (INT32) nAddCount; + rOStm << (sal_Int32) nAddCount; rOStm.Seek( nNewPos ); #ifdef CVTSVM_WRITE_SUBACTIONCOUNT @@ -2266,10 +2266,10 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, const MetaHatchAction* pA = (MetaHatchAction*) pAction; const PolyPolygon& rPolyPoly = pA->GetPolyPolygon(); const Hatch& rHatch = pA->GetHatch(); - ULONG nOldPos, nNewPos, nAddCount; + sal_uLong nOldPos, nNewPos, nAddCount; // write hatch comment - rOStm << (INT16) GDI_HATCH_COMMENT; + rOStm << (sal_Int16) GDI_HATCH_COMMENT; // we'll write the ActionSize later nOldPos = rOStm.Tell(); @@ -2282,7 +2282,7 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, // calculate and write ActionSize of comment nNewPos = rOStm.Tell(); rOStm.Seek( nOldPos ); - rOStm << (INT32) ( nNewPos - nOldPos + 4 ); + rOStm << (sal_Int32) ( nNewPos - nOldPos + 4 ); rOStm.Seek( ( nOldPos = nNewPos ) + 4 ); { @@ -2294,7 +2294,7 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, nAddCount = ImplWriteActions( rOStm, aTmpMtf, rSaveVDev, rRop_0_1, rLineCol, rLineColStack, rActualCharSet ); nNewPos = rOStm.Tell(); rOStm.Seek( nOldPos ); - rOStm << (INT32) nAddCount; + rOStm << (sal_Int32) nAddCount; rOStm.Seek( nNewPos ); #ifdef CVTSVM_WRITE_SUBACTIONCOUNT @@ -2310,11 +2310,11 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { const MetaRefPointAction* pA = (MetaRefPointAction*) pAction; const Point& rRefPoint = pA->GetRefPoint(); - const BOOL bSet = pA->IsSetting(); - ULONG nOldPos, nNewPos; + const sal_Bool bSet = pA->IsSetting(); + sal_uLong nOldPos, nNewPos; // write RefPoint comment - rOStm << (INT16) GDI_REFPOINT_COMMENT; + rOStm << (sal_Int16) GDI_REFPOINT_COMMENT; // we'll write the ActionSize later nOldPos = rOStm.Tell(); @@ -2322,12 +2322,12 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, // write data rOStm << rRefPoint << bSet; - rOStm << (INT32) 0; // number of actions that follow this comment + rOStm << (sal_Int32) 0; // number of actions that follow this comment // calculate and write ActionSize of comment nNewPos = rOStm.Tell(); rOStm.Seek( nOldPos ); - rOStm << (INT32) ( nNewPos - nOldPos ); + rOStm << (sal_Int32) ( nNewPos - nOldPos ); rOStm.Seek( nNewPos ); nCount++; @@ -2338,11 +2338,11 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { const MetaTextLineColorAction* pA = (MetaTextLineColorAction*) pAction; const Color& rColor = pA->GetColor(); - const BOOL bSet = pA->IsSetting(); - ULONG nOldPos, nNewPos; + const sal_Bool bSet = pA->IsSetting(); + sal_uLong nOldPos, nNewPos; // write RefPoint comment - rOStm << (INT16) GDI_TEXTLINECOLOR_COMMENT; + rOStm << (sal_Int16) GDI_TEXTLINECOLOR_COMMENT; // we'll write the ActionSize later nOldPos = rOStm.Tell(); @@ -2350,12 +2350,12 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, // write data rOStm << rColor << bSet; - rOStm << (INT32) 0; // number of actions that follow this comment + rOStm << (sal_Int32) 0; // number of actions that follow this comment // calculate and write ActionSize of comment nNewPos = rOStm.Tell(); rOStm.Seek( nOldPos ); - rOStm << (INT32) ( nNewPos - nOldPos ); + rOStm << (sal_Int32) ( nNewPos - nOldPos ); rOStm.Seek( nNewPos ); nCount++; @@ -2369,10 +2369,10 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, const long nWidth = pA->GetWidth(); const FontStrikeout eStrikeout = pA->GetStrikeout(); const FontUnderline eUnderline = pA->GetUnderline(); - ULONG nOldPos, nNewPos; + sal_uLong nOldPos, nNewPos; // write RefPoint comment - rOStm << (INT16) GDI_TEXTLINE_COMMENT; + rOStm << (sal_Int16) GDI_TEXTLINE_COMMENT; // we'll write the ActionSize later nOldPos = rOStm.Tell(); @@ -2382,12 +2382,12 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm << rStartPt << nWidth << static_cast<sal_uInt32>(eStrikeout) << static_cast<sal_uInt32>(eUnderline); - rOStm << (INT32) 0; // number of actions that follow this comment + rOStm << (sal_Int32) 0; // number of actions that follow this comment // calculate and write ActionSize of comment nNewPos = rOStm.Tell(); rOStm.Seek( nOldPos ); - rOStm << (INT32) ( nNewPos - nOldPos ); + rOStm << (sal_Int32) ( nNewPos - nOldPos ); rOStm.Seek( nNewPos ); nCount++; @@ -2401,10 +2401,10 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { const MetaCommentAction* pA = (MetaCommentAction*) pAction; const sal_uInt32 nDataSize = pA->GetDataSize(); - ULONG nOldPos, nNewPos; + sal_uLong nOldPos, nNewPos; // write RefPoint comment - rOStm << (INT16) GDI_COMMENT_COMMENT; + rOStm << (sal_Int16) GDI_COMMENT_COMMENT; // we'll write the ActionSize later nOldPos = rOStm.Tell(); @@ -2416,12 +2416,12 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, if( nDataSize ) rOStm.Write( pA->GetData(), nDataSize ); - rOStm << (INT32) 0; // number of actions that follow this comment + rOStm << (sal_Int32) 0; // number of actions that follow this comment // calculate and write ActionSize of comment nNewPos = rOStm.Tell(); rOStm.Seek( nOldPos ); - rOStm << (INT32) ( nNewPos - nOldPos ); + rOStm << (sal_Int32) ( nNewPos - nOldPos ); rOStm.Seek( nNewPos ); nCount++; diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx index 61db9f110a9e..2a10563441fa 100644 --- a/vcl/source/gdi/font.cxx +++ b/vcl/source/gdi/font.cxx @@ -172,7 +172,7 @@ void Impl_Font::AskConfig() String aShortName; String aFamilyName; - ULONG nType = 0; + sal_uLong nType = 0; FontWeight eWeight = WEIGHT_DONTKNOW; FontWidth eWidthType = WIDTH_DONTKNOW; String aMapName = maFamilyName; @@ -349,7 +349,7 @@ void Font::SetFillColor( const Color& rColor ) // ----------------------------------------------------------------------- -void Font::SetTransparent( BOOL bTransparent ) +void Font::SetTransparent( sal_Bool bTransparent ) { DBG_CHKTHIS( Font, NULL ); @@ -486,7 +486,7 @@ void Font::SetOrientation( short nOrientation ) // ----------------------------------------------------------------------- -void Font::SetVertical( BOOL bVertical ) +void Font::SetVertical( sal_Bool bVertical ) { DBG_CHKTHIS( Font, NULL ); @@ -512,7 +512,7 @@ void Font::SetKerning( FontKerning nKerning ) // ----------------------------------------------------------------------- -BOOL Font::IsKerning() const +sal_Bool Font::IsKerning() const { return (mpImplFont->mnKerning & KERNING_FONTSPECIFIC) != 0; } @@ -558,7 +558,7 @@ void Font::SetItalic( FontItalic eItalic ) // ----------------------------------------------------------------------- -void Font::SetOutline( BOOL bOutline ) +void Font::SetOutline( sal_Bool bOutline ) { DBG_CHKTHIS( Font, NULL ); @@ -571,7 +571,7 @@ void Font::SetOutline( BOOL bOutline ) // ----------------------------------------------------------------------- -void Font::SetShadow( BOOL bShadow ) +void Font::SetShadow( sal_Bool bShadow ) { DBG_CHKTHIS( Font, NULL ); @@ -649,7 +649,7 @@ void Font::SetEmphasisMark( FontEmphasisMark eEmphasisMark ) // ----------------------------------------------------------------------- -void Font::SetWordLineMode( BOOL bWordLine ) +void Font::SetWordLineMode( sal_Bool bWordLine ) { DBG_CHKTHIS( Font, NULL ); @@ -690,17 +690,17 @@ Font& Font::operator=( const Font& rFont ) // ----------------------------------------------------------------------- -BOOL Font::operator==( const Font& rFont ) const +sal_Bool Font::operator==( const Font& rFont ) const { DBG_CHKTHIS( Font, NULL ); DBG_CHKOBJ( &rFont, Font, NULL ); if( mpImplFont == rFont.mpImplFont ) - return TRUE; + return sal_True; if( *mpImplFont == *rFont.mpImplFont ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -775,9 +775,9 @@ void Font::GetFontAttributes( ImplFontAttributes& rAttrs ) const SvStream& operator>>( SvStream& rIStm, Impl_Font& rImpl_Font ) { VersionCompat aCompat( rIStm, STREAM_READ ); - UINT16 nTmp16; - BOOL bTmp; - BYTE nTmp8; + sal_uInt16 nTmp16; + sal_Bool bTmp; + sal_uInt8 nTmp8; rIStm.ReadByteString( rImpl_Font.maFamilyName, rIStm.GetStreamCharSet() ); rIStm.ReadByteString( rImpl_Font.maStyleName, rIStm.GetStreamCharSet() ); @@ -826,31 +826,31 @@ SvStream& operator<<( SvStream& rOStm, const Impl_Font& rImpl_Font ) rOStm.WriteByteString( rImpl_Font.maStyleName, rOStm.GetStreamCharSet() ); rOStm << rImpl_Font.maSize; - rOStm << (UINT16) GetStoreCharSet( rImpl_Font.meCharSet ); - rOStm << (UINT16) rImpl_Font.meFamily; - rOStm << (UINT16) rImpl_Font.mePitch; - rOStm << (UINT16) rImpl_Font.meWeight; - rOStm << (UINT16) rImpl_Font.meUnderline; - rOStm << (UINT16) rImpl_Font.meStrikeout; - rOStm << (UINT16) rImpl_Font.meItalic; - rOStm << (UINT16) rImpl_Font.meLanguage; - rOStm << (UINT16) rImpl_Font.meWidthType; + rOStm << (sal_uInt16) GetStoreCharSet( rImpl_Font.meCharSet ); + rOStm << (sal_uInt16) rImpl_Font.meFamily; + rOStm << (sal_uInt16) rImpl_Font.mePitch; + rOStm << (sal_uInt16) rImpl_Font.meWeight; + rOStm << (sal_uInt16) rImpl_Font.meUnderline; + rOStm << (sal_uInt16) rImpl_Font.meStrikeout; + rOStm << (sal_uInt16) rImpl_Font.meItalic; + rOStm << (sal_uInt16) rImpl_Font.meLanguage; + rOStm << (sal_uInt16) rImpl_Font.meWidthType; rOStm << rImpl_Font.mnOrientation; - rOStm << (BOOL) rImpl_Font.mbWordLine; - rOStm << (BOOL) rImpl_Font.mbOutline; - rOStm << (BOOL) rImpl_Font.mbShadow; - rOStm << (BYTE) rImpl_Font.mnKerning; + rOStm << (sal_Bool) rImpl_Font.mbWordLine; + rOStm << (sal_Bool) rImpl_Font.mbOutline; + rOStm << (sal_Bool) rImpl_Font.mbShadow; + rOStm << (sal_uInt8) rImpl_Font.mnKerning; // new in version 2 - rOStm << (BYTE) rImpl_Font.meRelief; - rOStm << (UINT16) rImpl_Font.meCJKLanguage; - rOStm << (BOOL) rImpl_Font.mbVertical; - rOStm << (UINT16) rImpl_Font.meEmphasisMark; + rOStm << (sal_uInt8) rImpl_Font.meRelief; + rOStm << (sal_uInt16) rImpl_Font.meCJKLanguage; + rOStm << (sal_Bool) rImpl_Font.mbVertical; + rOStm << (sal_uInt16) rImpl_Font.meEmphasisMark; // new in version 3 - rOStm << (UINT16) rImpl_Font.meOverline; + rOStm << (sal_uInt16) rImpl_Font.meOverline; return rOStm; } @@ -1087,7 +1087,7 @@ Font Font::identifyFont( const void* i_pBuffer, sal_uInt32 i_nSize ) // TODO: reformat const Color& Font::GetColor() const { return mpImplFont->maColor; } const Color& Font::GetFillColor() const { return mpImplFont->maFillColor; } -BOOL Font::IsTransparent() const { return mpImplFont->mbTransparent; } +sal_Bool Font::IsTransparent() const { return mpImplFont->mbTransparent; } FontAlign Font::GetAlign() const { return mpImplFont->meAlign; } const String& Font::GetName() const { return mpImplFont->maFamilyName; } const String& Font::GetStyleName() const { return mpImplFont->maStyleName; } @@ -1100,21 +1100,21 @@ rtl_TextEncoding Font::GetCharSet() const { return mpImplFont->meCharSet; } LanguageType Font::GetLanguage() const { return mpImplFont->meLanguage; } LanguageType Font::GetCJKContextLanguage() const { return mpImplFont->meCJKLanguage; } short Font::GetOrientation() const { return mpImplFont->mnOrientation; } -BOOL Font::IsVertical() const { return mpImplFont->mbVertical; } +sal_Bool Font::IsVertical() const { return mpImplFont->mbVertical; } FontKerning Font::GetKerning() const { return mpImplFont->mnKerning; } FontPitch Font::GetPitch() const { return mpImplFont->GetPitch(); } FontWeight Font::GetWeight() const { return mpImplFont->GetWeight(); } FontWidth Font::GetWidthType() const { return mpImplFont->GetWidthType(); } FontItalic Font::GetItalic() const { return mpImplFont->GetItalic(); } FontFamily Font::GetFamily() const { return mpImplFont->GetFamily(); } -BOOL Font::IsOutline() const { return mpImplFont->mbOutline; } -BOOL Font::IsShadow() const { return mpImplFont->mbShadow; } +sal_Bool Font::IsOutline() const { return mpImplFont->mbOutline; } +sal_Bool Font::IsShadow() const { return mpImplFont->mbShadow; } FontRelief Font::GetRelief() const { return mpImplFont->meRelief; } FontUnderline Font::GetUnderline() const { return mpImplFont->meUnderline; } FontUnderline Font::GetOverline() const { return mpImplFont->meOverline; } FontStrikeout Font::GetStrikeout() const { return mpImplFont->meStrikeout; } FontEmphasisMark Font::GetEmphasisMark() const { return mpImplFont->meEmphasisMark; } -BOOL Font::IsWordLineMode() const { return mpImplFont->mbWordLine; } -BOOL Font::IsSameInstance( const Font& rFont ) const { return (mpImplFont == rFont.mpImplFont); } +sal_Bool Font::IsWordLineMode() const { return mpImplFont->mbWordLine; } +sal_Bool Font::IsSameInstance( const Font& rFont ) const { return (mpImplFont == rFont.mpImplFont); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index f476fa8e8452..79b8f417891b 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -62,7 +62,7 @@ using namespace com::sun::star; // - Defines - // ----------- -#define GAMMA( _def_cVal, _def_InvGamma ) ((BYTE)MinMax(FRound(pow( _def_cVal/255.0,_def_InvGamma)*255.0),0L,255L)) +#define GAMMA( _def_cVal, _def_InvGamma ) ((sal_uInt8)MinMax(FRound(pow( _def_cVal/255.0,_def_InvGamma)*255.0),0L,255L)) // -------------------------- // - Color exchange structs - @@ -70,9 +70,9 @@ using namespace com::sun::star; struct ImplColAdjustParam { - BYTE* pMapR; - BYTE* pMapG; - BYTE* pMapB; + sal_uInt8* pMapR; + sal_uInt8* pMapG; + sal_uInt8* pMapB; }; struct ImplBmpAdjustParam @@ -83,7 +83,7 @@ struct ImplBmpAdjustParam short nChannelGPercent; short nChannelBPercent; double fGamma; - BOOL bInvert; + sal_Bool bInvert; }; // ----------------------------------------------------------------------------- @@ -114,22 +114,22 @@ struct ImplBmpMonoParam struct ImplColReplaceParam { - ULONG* pMinR; - ULONG* pMaxR; - ULONG* pMinG; - ULONG* pMaxG; - ULONG* pMinB; - ULONG* pMaxB; + sal_uLong* pMinR; + sal_uLong* pMaxR; + sal_uLong* pMinG; + sal_uLong* pMaxG; + sal_uLong* pMinB; + sal_uLong* pMaxB; const Color* pDstCols; - ULONG nCount; + sal_uLong nCount; }; struct ImplBmpReplaceParam { const Color* pSrcCols; const Color* pDstCols; - ULONG nCount; - const ULONG* pTols; + sal_uLong nCount; + const sal_uLong* pTols; }; @@ -140,9 +140,9 @@ struct ImplBmpReplaceParam struct ImpLabel { String aLabelName; - ULONG nActionPos; + sal_uLong nActionPos; - ImpLabel( const String& rLabelName, ULONG _nActionPos ) : + ImpLabel( const String& rLabelName, sal_uLong _nActionPos ) : aLabelName( rLabelName ), nActionPos( _nActionPos ) {} }; @@ -160,13 +160,13 @@ public: ~ImpLabelList(); void ImplInsert( ImpLabel* p ) { Insert( p, LIST_APPEND ); } - ImpLabel* ImplRemove( ULONG nPos ) { return (ImpLabel*) Remove( nPos ); } + ImpLabel* ImplRemove( sal_uLong nPos ) { return (ImpLabel*) Remove( nPos ); } void ImplReplace( ImpLabel* p ) { Replace( (void*)p ); } ImpLabel* ImplFirst() { return (ImpLabel*) First(); } ImpLabel* ImplNext() { return (ImpLabel*) Next(); } - ImpLabel* ImplGetLabel( ULONG nPos ) const { return (ImpLabel*) GetObject( nPos ); } - ULONG ImplGetLabelPos( const String& rLabelName ); - ULONG ImplCount() const { return Count(); } + ImpLabel* ImplGetLabel( sal_uLong nPos ) const { return (ImpLabel*) GetObject( nPos ); } + sal_uLong ImplGetLabelPos( const String& rLabelName ); + sal_uLong ImplCount() const { return Count(); } }; // ------------------------------------------------------------------------ @@ -188,9 +188,9 @@ ImpLabelList::~ImpLabelList() // ------------------------------------------------------------------------ -ULONG ImpLabelList::ImplGetLabelPos( const String& rLabelName ) +sal_uLong ImpLabelList::ImplGetLabelPos( const String& rLabelName ) { - ULONG nLabelPos = METAFILE_LABEL_NOTFOUND; + sal_uLong nLabelPos = METAFILE_LABEL_NOTFOUND; for( ImpLabel* pLabel = ImplFirst(); pLabel; pLabel = ImplNext() ) { @@ -215,9 +215,9 @@ GDIMetaFile::GDIMetaFile() : pNext ( NULL ), pOutDev ( NULL ), pLabelList ( NULL ), - bPause ( FALSE ), - bRecord ( FALSE ), - bUseCanvas ( FALSE ) + bPause ( sal_False ), + bRecord ( sal_False ), + bUseCanvas ( sal_False ) { } @@ -231,8 +231,8 @@ GDIMetaFile::GDIMetaFile( const GDIMetaFile& rMtf ) : pPrev ( rMtf.pPrev ), pNext ( rMtf.pNext ), pOutDev ( NULL ), - bPause ( FALSE ), - bRecord ( FALSE ), + bPause ( sal_False ), + bRecord ( sal_False ), bUseCanvas ( rMtf.bUseCanvas ) { // RefCount der MetaActions erhoehen @@ -249,7 +249,7 @@ GDIMetaFile::GDIMetaFile( const GDIMetaFile& rMtf ) : Record( rMtf.pOutDev ); if ( rMtf.bPause ) - Pause( TRUE ); + Pause( sal_True ); } } @@ -285,8 +285,8 @@ GDIMetaFile& GDIMetaFile::operator=( const GDIMetaFile& rMtf ) pPrev = rMtf.pPrev; pNext = rMtf.pNext; pOutDev = NULL; - bPause = FALSE; - bRecord = FALSE; + bPause = sal_False; + bRecord = sal_False; bUseCanvas = rMtf.bUseCanvas; if( rMtf.bRecord ) @@ -294,7 +294,7 @@ GDIMetaFile& GDIMetaFile::operator=( const GDIMetaFile& rMtf ) Record( rMtf.pOutDev ); if( rMtf.bPause ) - Pause( TRUE ); + Pause( sal_True ); } } @@ -303,24 +303,24 @@ GDIMetaFile& GDIMetaFile::operator=( const GDIMetaFile& rMtf ) // ------------------------------------------------------------------------ -BOOL GDIMetaFile::operator==( const GDIMetaFile& rMtf ) const +sal_Bool GDIMetaFile::operator==( const GDIMetaFile& rMtf ) const { - const ULONG nObjCount = Count(); - BOOL bRet = FALSE; + const sal_uLong nObjCount = Count(); + sal_Bool bRet = sal_False; if( this == &rMtf ) - bRet = TRUE; + bRet = sal_True; else if( rMtf.GetActionCount() == nObjCount && rMtf.GetPrefSize() == aPrefSize && rMtf.GetPrefMapMode() == aPrefMapMode ) { - bRet = TRUE; + bRet = sal_True; - for( ULONG n = 0UL; n < nObjCount; n++ ) + for( sal_uLong n = 0UL; n < nObjCount; n++ ) { if( GetObject( n ) != rMtf.GetObject( n ) ) { - bRet = FALSE; + bRet = sal_False; break; } } @@ -333,22 +333,22 @@ BOOL GDIMetaFile::operator==( const GDIMetaFile& rMtf ) const sal_Bool GDIMetaFile::IsEqual( const GDIMetaFile& rMtf ) const { - const ULONG nObjCount = Count(); - BOOL bRet = FALSE; + const sal_uLong nObjCount = Count(); + sal_Bool bRet = sal_False; if( this == &rMtf ) - bRet = TRUE; + bRet = sal_True; else if( rMtf.GetActionCount() == nObjCount && rMtf.GetPrefSize() == aPrefSize && rMtf.GetPrefMapMode() == aPrefMapMode ) { - bRet = TRUE; + bRet = sal_True; - for( ULONG n = 0UL; n < nObjCount; n++ ) + for( sal_uLong n = 0UL; n < nObjCount; n++ ) { if(!((MetaAction*)GetObject( n ))->IsEqual(*((MetaAction*)rMtf.GetObject( n )))) { - bRet = FALSE; + bRet = sal_False; break; } } @@ -375,7 +375,7 @@ void GDIMetaFile::Clear() // ------------------------------------------------------------------------ -void GDIMetaFile::Linker( OutputDevice* pOut, BOOL bLink ) +void GDIMetaFile::Linker( OutputDevice* pOut, sal_Bool bLink ) { if( bLink ) { @@ -424,25 +424,25 @@ void GDIMetaFile::Record( OutputDevice* pOut ) Last(); pOutDev = pOut; - bRecord = TRUE; - Linker( pOut, TRUE ); + bRecord = sal_True; + Linker( pOut, sal_True ); } // ------------------------------------------------------------------------ -void GDIMetaFile::Play( GDIMetaFile& rMtf, ULONG nPos ) +void GDIMetaFile::Play( GDIMetaFile& rMtf, sal_uLong nPos ) { if ( !bRecord && !rMtf.bRecord ) { MetaAction* pAction = GetCurAction(); - const ULONG nObjCount = Count(); + const sal_uLong nObjCount = Count(); rMtf.UseCanvas( rMtf.GetUseCanvas() || bUseCanvas ); if( nPos > nObjCount ) nPos = nObjCount; - for( ULONG nCurPos = GetCurPos(); nCurPos < nPos; nCurPos++ ) + for( sal_uLong nCurPos = GetCurPos(); nCurPos < nPos; nCurPos++ ) { if( !Hook() ) { @@ -457,13 +457,13 @@ void GDIMetaFile::Play( GDIMetaFile& rMtf, ULONG nPos ) // ------------------------------------------------------------------------ -void GDIMetaFile::Play( OutputDevice* pOut, ULONG nPos ) +void GDIMetaFile::Play( OutputDevice* pOut, sal_uLong nPos ) { if( !bRecord ) { MetaAction* pAction = GetCurAction(); - const ULONG nObjCount = Count(); - ULONG i = 0, nSyncCount = ( pOut->GetOutDevType() == OUTDEV_WINDOW ) ? 0x000000ff : 0xffffffff; + const sal_uLong nObjCount = Count(); + sal_uLong i = 0, nSyncCount = ( pOut->GetOutDevType() == OUTDEV_WINDOW ) ? 0x000000ff : 0xffffffff; if( nPos > nObjCount ) nPos = nObjCount; @@ -476,7 +476,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, ULONG nPos ) pOut->SetLayoutMode( 0 ); pOut->SetDigitLanguage( 0 ); - for( ULONG nCurPos = GetCurPos(); nCurPos < nPos; nCurPos++ ) + for( sal_uLong nCurPos = GetCurPos(); nCurPos < nPos; nCurPos++ ) { if( !Hook() ) { @@ -587,8 +587,8 @@ void GDIMetaFile::ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, OSL_ASSERT( pAct->GetComment().Equals("DELEGATE_PLUGGABLE_RENDERER") ); // read payload - string of service name, followed by raw render input - const BYTE* pData = pAct->GetData(); - const BYTE* const pEndData = pData + pAct->GetDataSize(); + const sal_uInt8* pData = pAct->GetData(); + const sal_uInt8* const pEndData = pData + pAct->GetDataSize(); if( !pData ) return; @@ -654,7 +654,7 @@ void GDIMetaFile::ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, // ------------------------------------------------------------------------ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos, - const Size& rSize, ULONG nPos ) + const Size& rSize, sal_uLong nPos ) { Region aDrawClipRegion; MapMode aDrawMap( GetPrefMapMode() ); @@ -719,19 +719,19 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos, // ------------------------------------------------------------------------ -void GDIMetaFile::Pause( BOOL _bPause ) +void GDIMetaFile::Pause( sal_Bool _bPause ) { if( bRecord ) { if( _bPause ) { if( !bPause ) - Linker( pOutDev, FALSE ); + Linker( pOutDev, sal_False ); } else { if( bPause ) - Linker( pOutDev, TRUE ); + Linker( pOutDev, sal_True ); } bPause = _bPause; @@ -744,12 +744,12 @@ void GDIMetaFile::Stop() { if( bRecord ) { - bRecord = FALSE; + bRecord = sal_False; if( !bPause ) - Linker( pOutDev, FALSE ); + Linker( pOutDev, sal_False ); else - bPause = FALSE; + bPause = sal_False; } } @@ -771,7 +771,7 @@ void GDIMetaFile::WindEnd() // ------------------------------------------------------------------------ -void GDIMetaFile::Wind( ULONG nActionPos ) +void GDIMetaFile::Wind( sal_uLong nActionPos ) { if( !bRecord ) Seek( nActionPos ); @@ -808,7 +808,7 @@ void GDIMetaFile::AddAction( MetaAction* pAction ) // ------------------------------------------------------------------------ -void GDIMetaFile::AddAction( MetaAction* pAction, ULONG nPos ) +void GDIMetaFile::AddAction( MetaAction* pAction, sal_uLong nPos ) { Insert( pAction, nPos ); @@ -822,7 +822,7 @@ void GDIMetaFile::AddAction( MetaAction* pAction, ULONG nPos ) // ------------------------------------------------------------------------ // @since #110496# -void GDIMetaFile::RemoveAction( ULONG nPos ) +void GDIMetaFile::RemoveAction( sal_uLong nPos ) { Remove( nPos ); @@ -832,14 +832,14 @@ void GDIMetaFile::RemoveAction( ULONG nPos ) // ------------------------------------------------------------------------ -MetaAction* GDIMetaFile::CopyAction( ULONG nPos ) const +MetaAction* GDIMetaFile::CopyAction( sal_uLong nPos ) const { return ( (MetaAction*) GetObject( nPos ) )->Clone(); } // ------------------------------------------------------------------------ -ULONG GDIMetaFile::GetActionPos( const String& rLabel ) +sal_uLong GDIMetaFile::GetActionPos( const String& rLabel ) { ImpLabel* pLabel = NULL; @@ -853,9 +853,9 @@ ULONG GDIMetaFile::GetActionPos( const String& rLabel ) // ------------------------------------------------------------------------ -BOOL GDIMetaFile::InsertLabel( const String& rLabel, ULONG nActionPos ) +sal_Bool GDIMetaFile::InsertLabel( const String& rLabel, sal_uLong nActionPos ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !pLabelList ) pLabelList = new ImpLabelList; @@ -863,7 +863,7 @@ BOOL GDIMetaFile::InsertLabel( const String& rLabel, ULONG nActionPos ) if( pLabelList->ImplGetLabelPos( rLabel ) == METAFILE_LABEL_NOTFOUND ) { pLabelList->ImplInsert( new ImpLabel( rLabel, nActionPos ) ); - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -875,7 +875,7 @@ void GDIMetaFile::RemoveLabel( const String& rLabel ) { if( pLabelList ) { - const ULONG nLabelPos = pLabelList->ImplGetLabelPos( rLabel ); + const sal_uLong nLabelPos = pLabelList->ImplGetLabelPos( rLabel ); if( nLabelPos != METAFILE_LABEL_NOTFOUND ) delete pLabelList->ImplRemove( nLabelPos ); @@ -888,7 +888,7 @@ void GDIMetaFile::RenameLabel( const String& rLabel, const String& rNewLabel ) { if( pLabelList ) { - const ULONG nLabelPos = pLabelList->ImplGetLabelPos( rLabel ); + const sal_uLong nLabelPos = pLabelList->ImplGetLabelPos( rLabel ); if ( nLabelPos != METAFILE_LABEL_NOTFOUND ) pLabelList->ImplGetLabel( nLabelPos )->aLabelName = rNewLabel; @@ -897,14 +897,14 @@ void GDIMetaFile::RenameLabel( const String& rLabel, const String& rNewLabel ) // ------------------------------------------------------------------------ -ULONG GDIMetaFile::GetLabelCount() const +sal_uLong GDIMetaFile::GetLabelCount() const { return( pLabelList ? pLabelList->ImplCount() : 0UL ); } // ------------------------------------------------------------------------ -String GDIMetaFile::GetLabel( ULONG nLabel ) +String GDIMetaFile::GetLabel( sal_uLong nLabel ) { String aString; @@ -921,12 +921,12 @@ String GDIMetaFile::GetLabel( ULONG nLabel ) // ------------------------------------------------------------------------ -BOOL GDIMetaFile::SaveStatus() +sal_Bool GDIMetaFile::SaveStatus() { if ( bRecord ) { if ( bPause ) - Linker( pOutDev, TRUE ); + Linker( pOutDev, sal_True ); AddAction( new MetaLineColorAction( pOutDev->GetLineColor(), pOutDev->IsLineColor() ) ); @@ -947,22 +947,22 @@ BOOL GDIMetaFile::SaveStatus() pOutDev->IsClipRegion() ) ); if ( bPause ) - Linker( pOutDev, FALSE ); + Linker( pOutDev, sal_False ); - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } // ------------------------------------------------------------------------ -BOOL GDIMetaFile::Mirror( ULONG nMirrorFlags ) +sal_Bool GDIMetaFile::Mirror( sal_uLong nMirrorFlags ) { const Size aOldPrefSize( GetPrefSize() ); long nMoveX, nMoveY; double fScaleX, fScaleY; - BOOL bRet; + sal_Bool bRet; if( nMirrorFlags & MTF_MIRROR_HORZ ) nMoveX = SAL_ABS( aOldPrefSize.Width() ) - 1, fScaleX = -1.0; @@ -979,10 +979,10 @@ BOOL GDIMetaFile::Mirror( ULONG nMirrorFlags ) Scale( fScaleX, fScaleY ); Move( nMoveX, nMoveY ); SetPrefSize( aOldPrefSize ); - bRet = TRUE; + bRet = sal_True; } else - bRet = FALSE; + bRet = sal_False; return bRet; } @@ -995,7 +995,7 @@ void GDIMetaFile::Move( long nX, long nY ) Size aOffset( aBaseOffset ); VirtualDevice aMapVDev; - aMapVDev.EnableOutput( FALSE ); + aMapVDev.EnableOutput( sal_False ); aMapVDev.SetMapMode( GetPrefMapMode() ); for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() ) @@ -1029,7 +1029,7 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY ) Size aOffset( aBaseOffset ); VirtualDevice aMapVDev; - aMapVDev.EnableOutput( FALSE ); + aMapVDev.EnableOutput( sal_False ); aMapVDev.SetReferenceDevice( nDPIX, nDPIY ); aMapVDev.SetMapMode( GetPrefMapMode() ); @@ -1103,7 +1103,7 @@ void GDIMetaFile::Clip( const Rectangle& i_rClipRect ) Rectangle aCurRect( i_rClipRect ); VirtualDevice aMapVDev; - aMapVDev.EnableOutput( FALSE ); + aMapVDev.EnableOutput( sal_False ); aMapVDev.SetMapMode( GetPrefMapMode() ); for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() ) @@ -1123,7 +1123,7 @@ void GDIMetaFile::Clip( const Rectangle& i_rClipRect ) Region aNewReg( aCurRect ); if( pOldAct->IsClipping() ) aNewReg.Intersect( pOldAct->GetRegion() ); - MetaClipRegionAction* pNewAct = new MetaClipRegionAction( aNewReg, TRUE ); + MetaClipRegionAction* pNewAct = new MetaClipRegionAction( aNewReg, sal_True ); Replace( pNewAct, GetCurPos() ); pOldAct->Delete(); } @@ -1178,7 +1178,7 @@ void GDIMetaFile::ImplAddGradientEx( GDIMetaFile& rMtf, // #105055# Generate comment, GradientEx and Gradient actions // (within DrawGradient) VirtualDevice aVDev( rMapDev, 0 ); - aVDev.EnableOutput( FALSE ); + aVDev.EnableOutput( sal_False ); GDIMetaFile aGradMtf; aGradMtf.Record( &aVDev ); @@ -1213,7 +1213,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) aPoly.Rotate( Point(), fSin, fCos ); - aMapVDev.EnableOutput( FALSE ); + aMapVDev.EnableOutput( sal_False ); aMapVDev.SetMapMode( GetPrefMapMode() ); const Rectangle aNewBound( aPoly.GetBoundRect() ); @@ -1226,7 +1226,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) for( MetaAction* pAction = (MetaAction*) First(); pAction; pAction = (MetaAction*) Next() ) { - const USHORT nActionType = pAction->GetType(); + const sal_uInt16 nActionType = pAction->GetType(); switch( nActionType ) { @@ -1443,7 +1443,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) // skip everything, except gradientex action while( pAction ) { - const USHORT nType = pAction->GetType(); + const sal_uInt16 nType = pAction->GetType(); if( META_GRADIENTEX_ACTION == nType ) { @@ -1494,7 +1494,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) aStroke.setPath( ImplGetRotatedPolygon( aPath, aRotAnchor, aRotOffset, fSin, fCos ) ); aDest << aStroke; aMtf.AddAction( new MetaCommentAction( "XPATHSTROKE_SEQ_BEGIN", 0, - static_cast<const BYTE*>( aDest.GetData()), aDest.Tell() ) ); + static_cast<const sal_uInt8*>( aDest.GetData()), aDest.Tell() ) ); } else { @@ -1505,7 +1505,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) aFill.setPath( ImplGetRotatedPolyPolygon( aPath, aRotAnchor, aRotOffset, fSin, fCos ) ); aDest << aFill; aMtf.AddAction( new MetaCommentAction( "XPATHFILL_SEQ_BEGIN", 0, - static_cast<const BYTE*>( aDest.GetData()), aDest.Tell() ) ); + static_cast<const sal_uInt8*>( aDest.GetData()), aDest.Tell() ) ); } } } @@ -1525,7 +1525,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) MetaHatchAction* pAct = (MetaHatchAction*) pAction; Hatch aHatch( pAct->GetHatch() ); - aHatch.SetAngle( aHatch.GetAngle() + (USHORT) nAngle10 ); + aHatch.SetAngle( aHatch.GetAngle() + (sal_uInt16) nAngle10 ); aMtf.AddAction( new MetaHatchAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ), aHatch ) ); } @@ -1570,7 +1570,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) MetaClipRegionAction* pAct = (MetaClipRegionAction*) pAction; if( pAct->IsClipping() && pAct->GetRegion().HasPolyPolygon() ) - aMtf.AddAction( new MetaClipRegionAction( Region( ImplGetRotatedPolyPolygon( pAct->GetRegion().GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ), TRUE ) ); + aMtf.AddAction( new MetaClipRegionAction( Region( ImplGetRotatedPolyPolygon( pAct->GetRegion().GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ), sal_True ) ); else { pAction->Duplicate(); @@ -1613,7 +1613,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) MetaFontAction* pAct = (MetaFontAction*) pAction; Font aFont( pAct->GetFont() ); - aFont.SetOrientation( aFont.GetOrientation() + (USHORT) nAngle10 ); + aFont.SetOrientation( aFont.GetOrientation() + (sal_uInt16) nAngle10 ); aMtf.AddAction( new MetaFontAction( aFont ) ); } break; @@ -1680,17 +1680,17 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference ) GDIMetaFile aMtf; VirtualDevice aMapVDev( i_rReference ); - aMapVDev.EnableOutput( FALSE ); + aMapVDev.EnableOutput( sal_False ); aMapVDev.SetMapMode( GetPrefMapMode() ); std::vector<Rectangle> aClipStack( 1, Rectangle() ); - std::vector<USHORT> aPushFlagStack; + std::vector<sal_uInt16> aPushFlagStack; Rectangle aBound; for( MetaAction* pAction = (MetaAction*) First(); pAction; pAction = (MetaAction*) Next() ) { - const USHORT nActionType = pAction->GetType(); + const sal_uInt16 nActionType = pAction->GetType(); switch( nActionType ) { @@ -2116,7 +2116,7 @@ BitmapEx GDIMetaFile::ImplBmpAdjustFnc( const BitmapEx& rBmpEx, const void* pBmp Color GDIMetaFile::ImplColConvertFnc( const Color& rColor, const void* pColParam ) { - BYTE cLum = rColor.GetLuminance(); + sal_uInt8 cLum = rColor.GetLuminance(); if( MTF_CONVERSION_1BIT_THRESHOLD == ( (const ImplColConvertParam*) pColParam )->eConversion ) cLum = ( cLum < 128 ) ? 0 : 255; @@ -2167,9 +2167,9 @@ BitmapEx GDIMetaFile::ImplBmpMonoFnc( const BitmapEx& rBmpEx, const void* pBmpPa Color GDIMetaFile::ImplColReplaceFnc( const Color& rColor, const void* pColParam ) { - const ULONG nR = rColor.GetRed(), nG = rColor.GetGreen(), nB = rColor.GetBlue(); + const sal_uLong nR = rColor.GetRed(), nG = rColor.GetGreen(), nB = rColor.GetBlue(); - for( ULONG i = 0; i < ( (const ImplColReplaceParam*) pColParam )->nCount; i++ ) + for( sal_uLong i = 0; i < ( (const ImplColReplaceParam*) pColParam )->nCount; i++ ) { if( ( ( (const ImplColReplaceParam*) pColParam )->pMinR[ i ] <= nR ) && ( ( (const ImplColReplaceParam*) pColParam )->pMaxR[ i ] >= nR ) && @@ -2209,7 +2209,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol for( MetaAction* pAction = (MetaAction*) First(); pAction; pAction = (MetaAction*) Next() ) { - const USHORT nType = pAction->GetType(); + const sal_uInt16 nType = pAction->GetType(); switch( nType ) { @@ -2227,7 +2227,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol if( !pAct->IsSetting() ) pAct->Duplicate(); else - pAct = new MetaLineColorAction( pFncCol( pAct->GetColor(), pColParam ), TRUE ); + pAct = new MetaLineColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); aMtf.Insert( pAct, LIST_APPEND ); } @@ -2240,7 +2240,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol if( !pAct->IsSetting() ) pAct->Duplicate(); else - pAct = new MetaFillColorAction( pFncCol( pAct->GetColor(), pColParam ), TRUE ); + pAct = new MetaFillColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); aMtf.Insert( pAct, LIST_APPEND ); } @@ -2260,7 +2260,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol if( !pAct->IsSetting() ) pAct->Duplicate(); else - pAct = new MetaTextFillColorAction( pFncCol( pAct->GetColor(), pColParam ), TRUE ); + pAct = new MetaTextFillColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); aMtf.Insert( pAct, LIST_APPEND ); } @@ -2273,7 +2273,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol if( !pAct->IsSetting() ) pAct->Duplicate(); else - pAct = new MetaTextLineColorAction( pFncCol( pAct->GetColor(), pColParam ), TRUE ); + pAct = new MetaTextLineColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); aMtf.Insert( pAct, LIST_APPEND ); } @@ -2286,7 +2286,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol if( !pAct->IsSetting() ) pAct->Duplicate(); else - pAct = new MetaOverlineColorAction( pFncCol( pAct->GetColor(), pColParam ), TRUE ); + pAct = new MetaOverlineColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); aMtf.Insert( pAct, LIST_APPEND ); } @@ -2467,7 +2467,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, - short nChannelBPercent, double fGamma, BOOL bInvert ) + short nChannelBPercent, double fGamma, sal_Bool bInvert ) { // nothing to do? => return quickly if( nLuminancePercent || nContrastPercent || @@ -2478,9 +2478,9 @@ void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent, ImplColAdjustParam aColParam; ImplBmpAdjustParam aBmpParam; - aColParam.pMapR = new BYTE[ 256 ]; - aColParam.pMapG = new BYTE[ 256 ]; - aColParam.pMapB = new BYTE[ 256 ]; + aColParam.pMapR = new sal_uInt8[ 256 ]; + aColParam.pMapG = new sal_uInt8[ 256 ]; + aColParam.pMapB = new sal_uInt8[ 256 ]; // calculate slope if( nContrastPercent >= 0 ) @@ -2498,14 +2498,14 @@ void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent, // calculate gamma value fGamma = ( fGamma <= 0.0 || fGamma > 10.0 ) ? 1.0 : ( 1.0 / fGamma ); - const BOOL bGamma = ( fGamma != 1.0 ); + const sal_Bool bGamma = ( fGamma != 1.0 ); // create mapping table for( long nX = 0L; nX < 256L; nX++ ) { - aColParam.pMapR[ nX ] = (BYTE) MinMax( FRound( nX * fM + fROff ), 0L, 255L ); - aColParam.pMapG[ nX ] = (BYTE) MinMax( FRound( nX * fM + fGOff ), 0L, 255L ); - aColParam.pMapB[ nX ] = (BYTE) MinMax( FRound( nX * fM + fBOff ), 0L, 255L ); + aColParam.pMapR[ nX ] = (sal_uInt8) MinMax( FRound( nX * fM + fROff ), 0L, 255L ); + aColParam.pMapG[ nX ] = (sal_uInt8) MinMax( FRound( nX * fM + fGOff ), 0L, 255L ); + aColParam.pMapB[ nX ] = (sal_uInt8) MinMax( FRound( nX * fM + fBOff ), 0L, 255L ); if( bGamma ) { @@ -2558,41 +2558,41 @@ void GDIMetaFile::Convert( MtfConversion eConversion ) // ------------------------------------------------------------------------ -void GDIMetaFile::ReplaceColors( const Color& rSearchColor, const Color& rReplaceColor, ULONG nTol ) +void GDIMetaFile::ReplaceColors( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol ) { ReplaceColors( &rSearchColor, &rReplaceColor, 1, &nTol ); } // ------------------------------------------------------------------------ -void GDIMetaFile::ReplaceColors( const Color* pSearchColors, const Color* pReplaceColors, ULONG nColorCount, ULONG* pTols ) +void GDIMetaFile::ReplaceColors( const Color* pSearchColors, const Color* pReplaceColors, sal_uLong nColorCount, sal_uLong* pTols ) { ImplColReplaceParam aColParam; ImplBmpReplaceParam aBmpParam; - aColParam.pMinR = new ULONG[ nColorCount ]; - aColParam.pMaxR = new ULONG[ nColorCount ]; - aColParam.pMinG = new ULONG[ nColorCount ]; - aColParam.pMaxG = new ULONG[ nColorCount ]; - aColParam.pMinB = new ULONG[ nColorCount ]; - aColParam.pMaxB = new ULONG[ nColorCount ]; + aColParam.pMinR = new sal_uLong[ nColorCount ]; + aColParam.pMaxR = new sal_uLong[ nColorCount ]; + aColParam.pMinG = new sal_uLong[ nColorCount ]; + aColParam.pMaxG = new sal_uLong[ nColorCount ]; + aColParam.pMinB = new sal_uLong[ nColorCount ]; + aColParam.pMaxB = new sal_uLong[ nColorCount ]; - for( ULONG i = 0; i < nColorCount; i++ ) + for( sal_uLong i = 0; i < nColorCount; i++ ) { const long nTol = pTols ? ( pTols[ i ] * 255 ) / 100 : 0; long nVal; nVal = pSearchColors[ i ].GetRed(); - aColParam.pMinR[ i ] = (ULONG) Max( nVal - nTol, 0L ); - aColParam.pMaxR[ i ] = (ULONG) Min( nVal + nTol, 255L ); + aColParam.pMinR[ i ] = (sal_uLong) Max( nVal - nTol, 0L ); + aColParam.pMaxR[ i ] = (sal_uLong) Min( nVal + nTol, 255L ); nVal = pSearchColors[ i ].GetGreen(); - aColParam.pMinG[ i ] = (ULONG) Max( nVal - nTol, 0L ); - aColParam.pMaxG[ i ] = (ULONG) Min( nVal + nTol, 255L ); + aColParam.pMinG[ i ] = (sal_uLong) Max( nVal - nTol, 0L ); + aColParam.pMaxG[ i ] = (sal_uLong) Min( nVal + nTol, 255L ); nVal = pSearchColors[ i ].GetBlue(); - aColParam.pMinB[ i ] = (ULONG) Max( nVal - nTol, 0L ); - aColParam.pMaxB[ i ] = (ULONG) Min( nVal + nTol, 255L ); + aColParam.pMinB[ i ] = (sal_uLong) Max( nVal - nTol, 0L ); + aColParam.pMaxB[ i ] = (sal_uLong) Min( nVal + nTol, 255L ); } aColParam.pDstCols = pReplaceColors; @@ -2632,16 +2632,16 @@ GDIMetaFile GDIMetaFile::GetMonochromeMtf( const Color& rColor ) const // ------------------------------------------------------------------------ -ULONG GDIMetaFile::GetChecksum() const +sal_uLong GDIMetaFile::GetChecksum() const { GDIMetaFile aMtf; SvMemoryStream aMemStm( 65535, 65535 ); ImplMetaWriteData aWriteData; aWriteData.meActualCharSet = aMemStm.GetStreamCharSet(); SVBT16 aBT16; SVBT32 aBT32; - ULONG nCrc = 0; + sal_uLong nCrc = 0; - for( ULONG i = 0, nObjCount = GetActionCount(); i < nObjCount; i++ ) + for( sal_uLong i = 0, nObjCount = GetActionCount(); i < nObjCount; i++ ) { MetaAction* pAction = GetAction( i ); @@ -2912,11 +2912,11 @@ ULONG GDIMetaFile::GetChecksum() const // ------------------------------------------------------------------------ -ULONG GDIMetaFile::GetSizeBytes() const +sal_uLong GDIMetaFile::GetSizeBytes() const { - ULONG nSizeBytes = 0; + sal_uLong nSizeBytes = 0; - for( ULONG i = 0, nObjCount = GetActionCount(); i < nObjCount; ++i ) + for( sal_uLong i = 0, nObjCount = GetActionCount(); i < nObjCount; ++i ) { MetaAction* pAction = GetAction( i ); @@ -2944,7 +2944,7 @@ ULONG GDIMetaFile::GetSizeBytes() const { const PolyPolygon& rPolyPoly = ( (MetaPolyPolygonAction*) pAction )->GetPolyPolygon(); - for( USHORT n = 0; n < rPolyPoly.Count(); ++n ) + for( sal_uInt16 n = 0; n < rPolyPoly.Count(); ++n ) nSizeBytes += ( rPolyPoly[ n ].GetSize() * sizeof( Point ) ); } break; @@ -2978,8 +2978,8 @@ SvStream& operator>>( SvStream& rIStm, GDIMetaFile& rGDIMetaFile ) if( !rIStm.GetError() ) { char aId[ 7 ]; - ULONG nStmPos = rIStm.Tell(); - USHORT nOldFormat = rIStm.GetNumberFormatInt(); + sal_uLong nStmPos = rIStm.Tell(); + sal_uInt16 nOldFormat = rIStm.GetNumberFormatInt(); rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); @@ -2992,8 +2992,8 @@ SvStream& operator>>( SvStream& rIStm, GDIMetaFile& rGDIMetaFile ) // new format VersionCompat* pCompat; MetaAction* pAction; - UINT32 nStmCompressMode = 0; - UINT32 nCount = 0; + sal_uInt32 nStmCompressMode = 0; + sal_uInt32 nCount = 0; pCompat = new VersionCompat( rIStm, STREAM_READ ); @@ -3007,7 +3007,7 @@ SvStream& operator>>( SvStream& rIStm, GDIMetaFile& rGDIMetaFile ) ImplMetaReadData aReadData; aReadData.meActualCharSet = rIStm.GetStreamCharSet(); - for( UINT32 nAction = 0UL; ( nAction < nCount ) && !rIStm.IsEof(); nAction++ ) + for( sal_uInt32 nAction = 0UL; ( nAction < nCount ) && !rIStm.IsEof(); nAction++ ) { pAction = MetaAction::ReadMetaAction( rIStm, &aReadData ); @@ -3065,8 +3065,8 @@ SvStream& GDIMetaFile::Read( SvStream& rIStm ) SvStream& GDIMetaFile::Write( SvStream& rOStm ) { VersionCompat* pCompat; - const UINT32 nStmCompressMode = rOStm.GetCompressMode(); - USHORT nOldFormat = rOStm.GetNumberFormatInt(); + const sal_uInt32 nStmCompressMode = rOStm.GetCompressMode(); + sal_uInt16 nOldFormat = rOStm.GetNumberFormatInt(); rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); rOStm.Write( "VCLMTF", 6 ); @@ -3076,7 +3076,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm ) rOStm << nStmCompressMode; rOStm << aPrefMapMode; rOStm << aPrefSize; - rOStm << (UINT32) GetActionCount(); + rOStm << (sal_uInt32) GetActionCount(); delete pCompat; @@ -3097,7 +3097,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm ) // ------------------------------------------------------------------------ -BOOL GDIMetaFile::CreateThumbnail( sal_uInt32 nMaximumExtent, +sal_Bool GDIMetaFile::CreateThumbnail( sal_uInt32 nMaximumExtent, BitmapEx& rBmpEx, const BitmapEx* pOverlay, const Rectangle* pOverlayRect ) const @@ -3214,7 +3214,7 @@ BOOL GDIMetaFile::CreateThumbnail( sal_uInt32 nMaximumExtent, return !rBmpEx.IsEmpty(); } -void GDIMetaFile::UseCanvas( BOOL _bUseCanvas ) +void GDIMetaFile::UseCanvas( sal_Bool _bUseCanvas ) { bUseCanvas = _bUseCanvas; } @@ -3226,7 +3226,7 @@ MetaCommentAction* makePluggableRendererAction( const rtl::OUString& rRendererSe const void* _pData, sal_uInt32 nDataSize ) { - const BYTE* pData=(BYTE*)_pData; + const sal_uInt8* pData=(sal_uInt8*)_pData; // data gets copied twice, unfortunately rtl::OString aRendererServiceName( diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx index 3a5b48ad2a0d..29b6a62253a6 100644 --- a/vcl/source/gdi/gfxlink.cxx +++ b/vcl/source/gdi/gfxlink.cxx @@ -65,7 +65,7 @@ GfxLink::GfxLink( const GfxLink& rGfxLink ) : // ------------------------------------------------------------------------ -GfxLink::GfxLink( BYTE* pBuf, sal_uInt32 nSize, GfxLinkType nType, BOOL bOwns ) : +GfxLink::GfxLink( sal_uInt8* pBuf, sal_uInt32 nSize, GfxLinkType nType, sal_Bool bOwns ) : mpImpData( new ImpGfxLink ) { DBG_ASSERT( (pBuf != NULL && nSize) || (!bOwns && nSize == 0), @@ -167,7 +167,7 @@ GfxLinkType GfxLink::GetType() const // ------------------------------------------------------------------------ -BOOL GfxLink::IsNative() const +sal_Bool GfxLink::IsNative() const { return( meType >= GFX_LINK_FIRST_NATIVE_ID && meType <= GFX_LINK_LAST_NATIVE_ID ); } @@ -181,7 +181,7 @@ sal_uInt32 GfxLink::GetDataSize() const // ------------------------------------------------------------------------ -const BYTE* GfxLink::GetData() const +const sal_uInt8* GfxLink::GetData() const { if( IsSwappedOut() ) ( (GfxLink*) this )->SwapIn(); @@ -235,20 +235,20 @@ bool GfxLink::IsPrefMapModeValid() // ------------------------------------------------------------------------ -BOOL GfxLink::LoadNative( Graphic& rGraphic ) +sal_Bool GfxLink::LoadNative( Graphic& rGraphic ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( IsNative() && mnBufSize ) { - const BYTE* pData = GetData(); + const sal_uInt8* pData = GetData(); if( pData ) { SvMemoryStream aMemStm; - ULONG nCvtType; + sal_uLong nCvtType; - aMemStm.SetBuffer( (char*) pData, mnBufSize, FALSE, mnBufSize ); + aMemStm.SetBuffer( (char*) pData, mnBufSize, sal_False, mnBufSize ); switch( meType ) { @@ -264,7 +264,7 @@ BOOL GfxLink::LoadNative( Graphic& rGraphic ) } if( nCvtType && ( GraphicConverter::Import( aMemStm, rGraphic, nCvtType ) == ERRCODE_NONE ) ) - bRet = TRUE; + bRet = sal_True; } } @@ -311,7 +311,7 @@ void GfxLink::SwapIn() // ------------------------------------------------------------------------ -BOOL GfxLink::ExportNative( SvStream& rOStream ) const +sal_Bool GfxLink::ExportNative( SvStream& rOStream ) const { if( GetDataSize() ) { @@ -331,7 +331,7 @@ SvStream& operator<<( SvStream& rOStream, const GfxLink& rGfxLink ) VersionCompat* pCompat = new VersionCompat( rOStream, STREAM_WRITE, 2 ); // Version 1 - rOStream << (UINT16) rGfxLink.GetType() << rGfxLink.GetDataSize() << rGfxLink.GetUserId(); + rOStream << (sal_uInt16) rGfxLink.GetType() << rGfxLink.GetDataSize() << rGfxLink.GetUserId(); // Version 2 rOStream << rGfxLink.GetPrefSize() << rGfxLink.GetPrefMapMode(); @@ -357,8 +357,8 @@ SvStream& operator>>( SvStream& rIStream, GfxLink& rGfxLink) MapMode aMapMode; sal_uInt32 nSize; sal_uInt32 nUserId; - UINT16 nType; - BYTE* pBuf; + sal_uInt16 nType; + sal_uInt8* pBuf; bool bMapAndSizeValid( false ); VersionCompat* pCompat = new VersionCompat( rIStream, STREAM_READ ); @@ -373,10 +373,10 @@ SvStream& operator>>( SvStream& rIStream, GfxLink& rGfxLink) delete pCompat; - pBuf = new BYTE[ nSize ]; + pBuf = new sal_uInt8[ nSize ]; rIStream.Read( pBuf, nSize ); - rGfxLink = GfxLink( pBuf, nSize, (GfxLinkType) nType, TRUE ); + rGfxLink = GfxLink( pBuf, nSize, (GfxLinkType) nType, sal_True ); rGfxLink.SetUserId( nUserId ); if( bMapAndSizeValid ) @@ -392,7 +392,7 @@ SvStream& operator>>( SvStream& rIStream, GfxLink& rGfxLink) // - ImpSwap - // ----------- -ImpSwap::ImpSwap( BYTE* pData, ULONG nDataSize ) : +ImpSwap::ImpSwap( sal_uInt8* pData, sal_uLong nDataSize ) : mnDataSize( nDataSize ), mnRefCount( 1UL ) { @@ -430,16 +430,16 @@ ImpSwap::~ImpSwap() // ------------------------------------------------------------------------ -BYTE* ImpSwap::GetData() const +sal_uInt8* ImpSwap::GetData() const { - BYTE* pData; + sal_uInt8* pData; if( IsSwapped() ) { SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( maURL, STREAM_READWRITE ); if( pIStm ) { - pData = new BYTE[ mnDataSize ]; + pData = new sal_uInt8[ mnDataSize ]; pIStm->Read( pData, mnDataSize ); sal_Bool bError = ( ERRCODE_NONE != pIStm->GetError() ); delete pIStm; @@ -460,7 +460,7 @@ BYTE* ImpSwap::GetData() const void ImpSwap::WriteTo( SvStream& rOStm ) const { - BYTE* pData = GetData(); + sal_uInt8* pData = GetData(); if( pData ) { diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx index 9c0d8ee07043..38d8ba4567a2 100644 --- a/vcl/source/gdi/gradient.cxx +++ b/vcl/source/gdi/gradient.cxx @@ -175,7 +175,7 @@ void Gradient::SetEndColor( const Color& rColor ) // ----------------------------------------------------------------------- -void Gradient::SetAngle( USHORT nAngle ) +void Gradient::SetAngle( sal_uInt16 nAngle ) { DBG_CHKTHIS( Gradient, NULL ); @@ -185,7 +185,7 @@ void Gradient::SetAngle( USHORT nAngle ) // ----------------------------------------------------------------------- -void Gradient::SetBorder( USHORT nBorder ) +void Gradient::SetBorder( sal_uInt16 nBorder ) { DBG_CHKTHIS( Gradient, NULL ); @@ -195,7 +195,7 @@ void Gradient::SetBorder( USHORT nBorder ) // ----------------------------------------------------------------------- -void Gradient::SetOfsX( USHORT nOfsX ) +void Gradient::SetOfsX( sal_uInt16 nOfsX ) { DBG_CHKTHIS( Gradient, NULL ); @@ -205,7 +205,7 @@ void Gradient::SetOfsX( USHORT nOfsX ) // ----------------------------------------------------------------------- -void Gradient::SetOfsY( USHORT nOfsY ) +void Gradient::SetOfsY( sal_uInt16 nOfsY ) { DBG_CHKTHIS( Gradient, NULL ); @@ -215,7 +215,7 @@ void Gradient::SetOfsY( USHORT nOfsY ) // ----------------------------------------------------------------------- -void Gradient::SetStartIntensity( USHORT nIntens ) +void Gradient::SetStartIntensity( sal_uInt16 nIntens ) { DBG_CHKTHIS( Gradient, NULL ); @@ -225,7 +225,7 @@ void Gradient::SetStartIntensity( USHORT nIntens ) // ----------------------------------------------------------------------- -void Gradient::SetEndIntensity( USHORT nIntens ) +void Gradient::SetEndIntensity( sal_uInt16 nIntens ) { DBG_CHKTHIS( Gradient, NULL ); @@ -235,7 +235,7 @@ void Gradient::SetEndIntensity( USHORT nIntens ) // ----------------------------------------------------------------------- -void Gradient::SetSteps( USHORT nSteps ) +void Gradient::SetSteps( sal_uInt16 nSteps ) { DBG_CHKTHIS( Gradient, NULL ); @@ -248,7 +248,7 @@ void Gradient::SetSteps( USHORT nSteps ) void Gradient::GetBoundRect( const Rectangle& rRect, Rectangle& rBoundRect, Point& rCenter ) const { Rectangle aRect( rRect ); - USHORT nAngle = GetAngle() % 3600; + sal_uInt16 nAngle = GetAngle() % 3600; if( GetStyle() == GRADIENT_LINEAR || GetStyle() == GRADIENT_AXIAL ) { @@ -359,13 +359,13 @@ Gradient& Gradient::operator=( const Gradient& rGradient ) // ----------------------------------------------------------------------- -BOOL Gradient::operator==( const Gradient& rGradient ) const +sal_Bool Gradient::operator==( const Gradient& rGradient ) const { DBG_CHKTHIS( Gradient, NULL ); DBG_CHKOBJ( &rGradient, Gradient, NULL ); if ( mpImplGradient == rGradient.mpImplGradient ) - return TRUE; + return sal_True; if ( (mpImplGradient->meStyle == rGradient.mpImplGradient->meStyle) || (mpImplGradient->mnAngle == rGradient.mpImplGradient->mnAngle) || @@ -377,15 +377,15 @@ BOOL Gradient::operator==( const Gradient& rGradient ) const (mpImplGradient->mnIntensityEnd == rGradient.mpImplGradient->mnIntensityEnd) || (mpImplGradient->maStartColor == rGradient.mpImplGradient->maStartColor) || (mpImplGradient->maEndColor == rGradient.mpImplGradient->maEndColor) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } SvStream& operator>>( SvStream& rIStm, Impl_Gradient& rImpl_Gradient ) { VersionCompat aCompat( rIStm, STREAM_READ ); - UINT16 nTmp16; + sal_uInt16 nTmp16; rIStm >> nTmp16; rImpl_Gradient.meStyle = (GradientStyle) nTmp16; @@ -408,7 +408,7 @@ SvStream& operator<<( SvStream& rOStm, const Impl_Gradient& rImpl_Gradient ) { VersionCompat aCompat( rOStm, STREAM_WRITE, 1 ); - rOStm << (UINT16) rImpl_Gradient.meStyle << + rOStm << (sal_uInt16) rImpl_Gradient.meStyle << rImpl_Gradient.maStartColor << rImpl_Gradient.maEndColor << rImpl_Gradient.mnAngle << diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index e6bb0b1e3e8a..f61bbf8dc041 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -60,11 +60,11 @@ static void ImplDrawDefault( OutputDevice* pOutDev, const UniString* pText, Font* pFont, const Bitmap* pBitmap, const BitmapEx* pBitmapEx, const Point& rDestPt, const Size& rDestSize ) { - USHORT nPixel = (USHORT) pOutDev->PixelToLogic( Size( 1, 1 ) ).Width(); - USHORT nPixelWidth = nPixel; + sal_uInt16 nPixel = (sal_uInt16) pOutDev->PixelToLogic( Size( 1, 1 ) ).Width(); + sal_uInt16 nPixelWidth = nPixel; Point aPoint( rDestPt.X() + nPixelWidth, rDestPt.Y() + nPixelWidth ); Size aSize( rDestSize.Width() - ( nPixelWidth << 1 ), rDestSize.Height() - ( nPixelWidth << 1 ) ); - BOOL bFilled = ( pBitmap != NULL || pBitmapEx != NULL || pFont != NULL ); + sal_Bool bFilled = ( pBitmap != NULL || pBitmapEx != NULL || pFont != NULL ); Rectangle aBorderRect( aPoint, aSize ); pOutDev->Push(); @@ -139,8 +139,8 @@ static void ImplDrawDefault( OutputDevice* pOutDev, const UniString* pText, if ( nTextWidth <= nWidth || aSz.Height() <= nThreshold ) { - USHORT nStart = 0; - USHORT nLen = 0; + sal_uInt16 nStart = 0; + sal_uInt16 nLen = 0; while( nStart < pText->Len() && pText->GetChar( nStart ) == ' ' ) nStart++; @@ -148,7 +148,7 @@ static void ImplDrawDefault( OutputDevice* pOutDev, const UniString* pText, nLen++; while( nStart < pText->Len() && nLines-- ) { - USHORT nNext = nLen; + sal_uInt16 nNext = nLen; do { while ( nStart+nNext < pText->Len() && pText->GetChar( nStart+nNext ) == ' ' ) @@ -162,14 +162,14 @@ static void ImplDrawDefault( OutputDevice* pOutDev, const UniString* pText, } while ( nStart+nNext < pText->Len() ); - USHORT n = nLen; + sal_uInt16 n = nLen; nTextWidth = pOutDev->GetTextWidth( *pText, nStart, n ); while( nTextWidth > aSize.Width() ) nTextWidth = pOutDev->GetTextWidth( *pText, nStart, --n ); pOutDev->DrawText( aPoint, *pText, nStart, n ); aPoint.Y() += nTextHeight; - nStart = sal::static_int_cast<USHORT>(nStart + nLen); + nStart = sal::static_int_cast<sal_uInt16>(nStart + nLen); nLen = nNext-nLen; while( nStart < pText->Len() && pText->GetChar( nStart ) == ' ' ) { @@ -335,21 +335,21 @@ Graphic& Graphic::operator=( const Graphic& rGraphic ) // ------------------------------------------------------------------------ -BOOL Graphic::operator==( const Graphic& rGraphic ) const +sal_Bool Graphic::operator==( const Graphic& rGraphic ) const { return( *mpImpGraphic == *rGraphic.mpImpGraphic ); } // ------------------------------------------------------------------------ -BOOL Graphic::operator!=( const Graphic& rGraphic ) const +sal_Bool Graphic::operator!=( const Graphic& rGraphic ) const { return( *mpImpGraphic != *rGraphic.mpImpGraphic ); } // ------------------------------------------------------------------------ -BOOL Graphic::operator!() const +sal_Bool Graphic::operator!() const { return( GRAPHIC_NONE == mpImpGraphic->ImplGetType() ); } @@ -400,28 +400,28 @@ void Graphic::SetDefaultType() // ------------------------------------------------------------------------ -BOOL Graphic::IsSupportedGraphic() const +sal_Bool Graphic::IsSupportedGraphic() const { return mpImpGraphic->ImplIsSupportedGraphic(); } // ------------------------------------------------------------------------ -BOOL Graphic::IsTransparent() const +sal_Bool Graphic::IsTransparent() const { return mpImpGraphic->ImplIsTransparent(); } // ------------------------------------------------------------------------ -BOOL Graphic::IsAlpha() const +sal_Bool Graphic::IsAlpha() const { return mpImpGraphic->ImplIsAlpha(); } // ------------------------------------------------------------------------ -BOOL Graphic::IsAnimated() const +sal_Bool Graphic::IsAnimated() const { return mpImpGraphic->ImplIsAnimated(); } @@ -532,7 +532,7 @@ Size Graphic::GetSizePixel( const OutputDevice* pRefDevice ) const // ------------------------------------------------------------------ -ULONG Graphic::GetSizeBytes() const +sal_uLong Graphic::GetSizeBytes() const { return mpImpGraphic->ImplGetSizeBytes(); } @@ -616,7 +616,7 @@ Link Graphic::GetAnimationNotifyHdl() const // ------------------------------------------------------------------------ -ULONG Graphic::GetAnimationLoopCount() const +sal_uLong Graphic::GetAnimationLoopCount() const { return mpImpGraphic->ImplGetAnimationLoopCount(); } @@ -651,20 +651,20 @@ void Graphic::SetContext( GraphicReader* pReader ) // ------------------------------------------------------------------------ -USHORT Graphic::GetGraphicsCompressMode( SvStream& rIStm ) +sal_uInt16 Graphic::GetGraphicsCompressMode( SvStream& rIStm ) { - const ULONG nPos = rIStm.Tell(); - const USHORT nOldFormat = rIStm.GetNumberFormatInt(); - UINT32 nTmp32; - UINT16 nTmp16; - USHORT nCompressMode = COMPRESSMODE_NONE; + const sal_uLong nPos = rIStm.Tell(); + const sal_uInt16 nOldFormat = rIStm.GetNumberFormatInt(); + sal_uInt32 nTmp32; + sal_uInt16 nTmp16; + sal_uInt16 nCompressMode = COMPRESSMODE_NONE; rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); rIStm >> nTmp32; // is it a swapped graphic with a bitmap? - rIStm.SeekRel( (nTmp32 == (UINT32) GRAPHIC_BITMAP ) ? 40 : -4 ); + rIStm.SeekRel( (nTmp32 == (sal_uInt32) GRAPHIC_BITMAP ) ? 40 : -4 ); // try to read bitmap id rIStm >> nTmp16; @@ -689,7 +689,7 @@ USHORT Graphic::GetGraphicsCompressMode( SvStream& rIStm ) // ------------------------------------------------------------------------ -void Graphic::SetDocFileName( const String& rName, ULONG nFilePos ) +void Graphic::SetDocFileName( const String& rName, sal_uLong nFilePos ) { mpImpGraphic->ImplSetDocFileName( rName, nFilePos ); } @@ -703,14 +703,14 @@ const String& Graphic::GetDocFileName() const // ------------------------------------------------------------------------ -ULONG Graphic::GetDocFilePos() const +sal_uLong Graphic::GetDocFilePos() const { return mpImpGraphic->ImplGetDocFilePos(); } // ------------------------------------------------------------------------ -BOOL Graphic::ReadEmbedded( SvStream& rIStream, BOOL bSwap ) +sal_Bool Graphic::ReadEmbedded( SvStream& rIStream, sal_Bool bSwap ) { ImplTestRefCount(); return mpImpGraphic->ImplReadEmbedded( rIStream, bSwap ); @@ -718,7 +718,7 @@ BOOL Graphic::ReadEmbedded( SvStream& rIStream, BOOL bSwap ) // ------------------------------------------------------------------------ -BOOL Graphic::WriteEmbedded( SvStream& rOStream ) +sal_Bool Graphic::WriteEmbedded( SvStream& rOStream ) { ImplTestRefCount(); return mpImpGraphic->ImplWriteEmbedded( rOStream ); @@ -726,7 +726,7 @@ BOOL Graphic::WriteEmbedded( SvStream& rOStream ) // ------------------------------------------------------------------------ -BOOL Graphic::SwapOut() +sal_Bool Graphic::SwapOut() { ImplTestRefCount(); return mpImpGraphic->ImplSwapOut(); @@ -734,7 +734,7 @@ BOOL Graphic::SwapOut() // ------------------------------------------------------------------------ -BOOL Graphic::SwapOut( SvStream* pOStream ) +sal_Bool Graphic::SwapOut( SvStream* pOStream ) { ImplTestRefCount(); return mpImpGraphic->ImplSwapOut( pOStream ); @@ -742,7 +742,7 @@ BOOL Graphic::SwapOut( SvStream* pOStream ) // ------------------------------------------------------------------------ -BOOL Graphic::SwapIn() +sal_Bool Graphic::SwapIn() { ImplTestRefCount(); return mpImpGraphic->ImplSwapIn(); @@ -750,7 +750,7 @@ BOOL Graphic::SwapIn() // ------------------------------------------------------------------------ -BOOL Graphic::SwapIn( SvStream* pStrm ) +sal_Bool Graphic::SwapIn( SvStream* pStrm ) { ImplTestRefCount(); return mpImpGraphic->ImplSwapIn( pStrm ); @@ -758,7 +758,7 @@ BOOL Graphic::SwapIn( SvStream* pStrm ) // ------------------------------------------------------------------------ -BOOL Graphic::IsSwapOut() const +sal_Bool Graphic::IsSwapOut() const { return mpImpGraphic->ImplIsSwapOut(); } @@ -780,21 +780,21 @@ GfxLink Graphic::GetLink() const // ------------------------------------------------------------------------ -BOOL Graphic::IsLink() const +sal_Bool Graphic::IsLink() const { return mpImpGraphic->ImplIsLink(); } // ------------------------------------------------------------------------ -ULONG Graphic::GetChecksum() const +sal_uLong Graphic::GetChecksum() const { return mpImpGraphic->ImplGetChecksum(); } // ------------------------------------------------------------------------ -BOOL Graphic::ExportNative( SvStream& rOStream ) const +sal_Bool Graphic::ExportNative( SvStream& rOStream ) const { return mpImpGraphic->ImplExportNative( rOStream ); } diff --git a/vcl/source/gdi/graphictools.cxx b/vcl/source/gdi/graphictools.cxx index 08533663c562..2e20a3639790 100644 --- a/vcl/source/gdi/graphictools.cxx +++ b/vcl/source/gdi/graphictools.cxx @@ -35,7 +35,7 @@ static ::rtl::OString polyToString( const Polygon& rPoly ) { ::rtl::OString aStr; - USHORT nVertex; + sal_uInt16 nVertex; for(nVertex=0; nVertex<rPoly.GetSize(); ++nVertex) { aStr += "("; @@ -67,7 +67,7 @@ static ::rtl::OString polyToString( const Polygon& rPoly ) static ::rtl::OString polyPolyToString( const PolyPolygon& rPolyPoly ) { ::rtl::OString aStr; - USHORT nPoly; + sal_uInt16 nPoly; for(nPoly=0; nPoly<rPolyPoly.Count(); ++nPoly) { const Polygon& rPoly = rPolyPoly[nPoly]; @@ -328,9 +328,9 @@ SvStream& operator<<( SvStream& rOStm, const SvtGraphicStroke& rClass ) rClass.maEndArrow.Write( rOStm ); rOStm << rClass.mfTransparency; rOStm << rClass.mfStrokeWidth; - UINT16 nTmp = sal::static_int_cast<UINT16>( rClass.maCapType ); + sal_uInt16 nTmp = sal::static_int_cast<sal_uInt16>( rClass.maCapType ); rOStm << nTmp; - nTmp = sal::static_int_cast<UINT16>( rClass.maJoinType ); + nTmp = sal::static_int_cast<sal_uInt16>( rClass.maJoinType ); rOStm << nTmp; rOStm << rClass.mfMiterLimit; @@ -351,7 +351,7 @@ SvStream& operator>>( SvStream& rIStm, SvtGraphicStroke& rClass ) rClass.maEndArrow.Read( rIStm ); rIStm >> rClass.mfTransparency; rIStm >> rClass.mfStrokeWidth; - UINT16 nTmp; + sal_uInt16 nTmp; rIStm >> nTmp; rClass.maCapType = SvtGraphicStroke::CapType(nTmp); rIStm >> nTmp; @@ -707,19 +707,19 @@ SvStream& operator<<( SvStream& rOStm, const SvtGraphicFill& rClass ) rClass.maPath.Write( rOStm ); rOStm << rClass.maFillColor; rOStm << rClass.mfTransparency; - UINT16 nTmp = sal::static_int_cast<UINT16>( rClass.maFillRule ); + sal_uInt16 nTmp = sal::static_int_cast<sal_uInt16>( rClass.maFillRule ); rOStm << nTmp; - nTmp = sal::static_int_cast<UINT16>( rClass.maFillType ); + nTmp = sal::static_int_cast<sal_uInt16>( rClass.maFillType ); rOStm << nTmp; int i; for(i=0; i<SvtGraphicFill::Transform::MatrixSize; ++i) rOStm << rClass.maFillTransform.matrix[i]; nTmp = rClass.mbTiling; rOStm << nTmp; - nTmp = sal::static_int_cast<UINT16>( rClass.maHatchType ); + nTmp = sal::static_int_cast<sal_uInt16>( rClass.maHatchType ); rOStm << nTmp; rOStm << rClass.maHatchColor; - nTmp = sal::static_int_cast<UINT16>( rClass.maGradientType ); + nTmp = sal::static_int_cast<sal_uInt16>( rClass.maGradientType ); rOStm << nTmp; rOStm << rClass.maGradient1stColor; rOStm << rClass.maGradient2ndColor; @@ -736,7 +736,7 @@ SvStream& operator>>( SvStream& rIStm, SvtGraphicFill& rClass ) rClass.maPath.Read( rIStm ); rIStm >> rClass.maFillColor; rIStm >> rClass.mfTransparency; - UINT16 nTmp; + sal_uInt16 nTmp; rIStm >> nTmp; rClass.maFillRule = SvtGraphicFill::FillRule( nTmp ); rIStm >> nTmp; diff --git a/vcl/source/gdi/hatch.cxx b/vcl/source/gdi/hatch.cxx index 00b3d13991fd..9836b2e6e4b4 100644 --- a/vcl/source/gdi/hatch.cxx +++ b/vcl/source/gdi/hatch.cxx @@ -82,7 +82,7 @@ Hatch::Hatch( const Hatch& rHatch ) // ----------------------------------------------------------------------- Hatch::Hatch( HatchStyle eStyle, const Color& rColor, - long nDistance, USHORT nAngle10 ) + long nDistance, sal_uInt16 nAngle10 ) { DBG_CTOR( Hatch, NULL ); mpImplHatch = new ImplHatch; @@ -119,7 +119,7 @@ Hatch& Hatch::operator=( const Hatch& rHatch ) // ----------------------------------------------------------------------- -BOOL Hatch::operator==( const Hatch& rHatch ) const +sal_Bool Hatch::operator==( const Hatch& rHatch ) const { DBG_CHKTHIS( Hatch, NULL ); DBG_CHKOBJ( &rHatch, Hatch, NULL ); @@ -173,7 +173,7 @@ void Hatch::SetDistance( long nDistance ) // ----------------------------------------------------------------------- -void Hatch::SetAngle( USHORT nAngle10 ) +void Hatch::SetAngle( sal_uInt16 nAngle10 ) { DBG_CHKTHIS( Hatch, NULL ); ImplMakeUnique(); @@ -185,7 +185,7 @@ void Hatch::SetAngle( USHORT nAngle10 ) SvStream& operator>>( SvStream& rIStm, ImplHatch& rImplHatch ) { VersionCompat aCompat( rIStm, STREAM_READ ); - UINT16 nTmp16; + sal_uInt16 nTmp16; rIStm >> nTmp16; rImplHatch.meStyle = (HatchStyle) nTmp16; rIStm >> rImplHatch.maColor >> rImplHatch.mnDistance >> rImplHatch.mnAngle; @@ -199,7 +199,7 @@ SvStream& operator<<( SvStream& rOStm, const ImplHatch& rImplHatch ) { VersionCompat aCompat( rOStm, STREAM_WRITE, 1 ); - rOStm << (UINT16) rImplHatch.meStyle << rImplHatch.maColor; + rOStm << (sal_uInt16) rImplHatch.meStyle << rImplHatch.maColor; rOStm << rImplHatch.mnDistance << rImplHatch.mnAngle; return rOStm; diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index d22f24575a06..e212efc00e23 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -82,7 +82,7 @@ Image::Image( const ResId& rResId ) : pResMgr->Increment( sizeof( RSHEADER_TYPE ) ); BitmapEx aBmpEx; - ULONG nObjMask = pResMgr->ReadLong(); + sal_uLong nObjMask = pResMgr->ReadLong(); if( nObjMask & RSC_IMAGE_IMAGEBITMAP ) { @@ -285,7 +285,7 @@ void Image::Invert() // ----------------------------------------------------------------------- void Image::GetColorTransformArrays( ImageColorTransform eColorTransform, - Color*& rpSrcColor, Color*& rpDstColor, ULONG& rColorCount ) + Color*& rpSrcColor, Color*& rpDstColor, sal_uLong& rColorCount ) { if( IMAGECOLORTRANSFORM_HIGHCONTRAST == eColorTransform ) { @@ -332,7 +332,7 @@ Image& Image::operator=( const Image& rImage ) // ----------------------------------------------------------------------- -BOOL Image::operator==( const Image& rImage ) const +sal_Bool Image::operator==( const Image& rImage ) const { DBG_CHKTHIS( Image, NULL ); DBG_CHKOBJ( &rImage, Image, NULL ); @@ -370,7 +370,7 @@ BOOL Image::operator==( const Image& rImage ) const // - ImageList - // ------------- -ImageList::ImageList( USHORT nInit, USHORT nGrow ) : +ImageList::ImageList( sal_uInt16 nInit, sal_uInt16 nGrow ) : mpImplData( NULL ), mnInitSize( nInit ), mnGrowSize( nGrow ) @@ -397,7 +397,7 @@ ImageList::ImageList( const ResId& rResId ) : { pResMgr->Increment( sizeof( RSHEADER_TYPE ) ); - ULONG nObjMask = pResMgr->ReadLong(); + sal_uLong nObjMask = pResMgr->ReadLong(); const String aPrefix( pResMgr->ReadString() ); ::boost::scoped_ptr< Color > spMaskColor; @@ -413,13 +413,13 @@ ImageList::ImageList( const ResId& rResId ) : } sal_Int32 nCount = pResMgr->ReadLong(); - ImplInit( static_cast< USHORT >( nCount ), Size() ); + ImplInit( static_cast< sal_uInt16 >( nCount ), Size() ); BitmapEx aEmpty; for( sal_Int32 i = 0; i < nCount; ++i ) { rtl::OUString aName = pResMgr->ReadString(); - USHORT nId = static_cast< USHORT >( pResMgr->ReadLong() ); + sal_uInt16 nId = static_cast< sal_uInt16 >( pResMgr->ReadLong() ); mpImplData->AddImage( aName, nId, aEmpty ); } @@ -441,12 +441,12 @@ ImageList::ImageList( const ::std::vector< ::rtl::OUString >& rNameVector, DBG_CTOR( ImageList, NULL ); - ImplInit( sal::static_int_cast< USHORT >( rNameVector.size() ), Size() ); + ImplInit( sal::static_int_cast< sal_uInt16 >( rNameVector.size() ), Size() ); mpImplData->maPrefix = rPrefix; for( sal_uInt32 i = 0; i < rNameVector.size(); ++i ) { - mpImplData->AddImage( rNameVector[ i ], static_cast< USHORT >( i ) + 1, BitmapEx() ); + mpImplData->AddImage( rNameVector[ i ], static_cast< sal_uInt16 >( i ) + 1, BitmapEx() ); } } @@ -473,7 +473,7 @@ ImageList::~ImageList() delete mpImplData; } -void ImageList::ImplInit( USHORT nItems, const Size &rSize ) +void ImageList::ImplInit( sal_uInt16 nItems, const Size &rSize ) { mpImplData = new ImplImageList; mpImplData->mnRefCount = 1; @@ -525,13 +525,13 @@ void ImageList::ImplMakeUnique() BitmapEx ImageList::GetAsHorizontalStrip() const { Size aSize( mpImplData->maImageSize ); - USHORT nCount = GetImageCount(); + sal_uInt16 nCount = GetImageCount(); if( !nCount ) return BitmapEx(); aSize.Width() *= nCount; // Load any stragglers - for (USHORT nIdx = 0; nIdx < nCount; nIdx++) + for (sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++) { ImageAryData *pData = mpImplData->maImages[ nIdx ]; if( pData->IsLoadable() ) @@ -549,7 +549,7 @@ BitmapEx ImageList::GetAsHorizontalStrip() const aResult = BitmapEx( aPixels ); Rectangle aSrcRect( Point( 0, 0 ), mpImplData->maImageSize ); - for (USHORT nIdx = 0; nIdx < nCount; nIdx++) + for (sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++) { Rectangle aDestRect( Point( nIdx * mpImplData->maImageSize.Width(), 0 ), mpImplData->maImageSize ); @@ -565,7 +565,7 @@ BitmapEx ImageList::GetAsHorizontalStrip() const void ImageList::InsertFromHorizontalStrip( const BitmapEx &rBitmapEx, const std::vector< rtl::OUString > &rNameVector ) { - USHORT nItems = sal::static_int_cast< USHORT >( rNameVector.size() ); + sal_uInt16 nItems = sal::static_int_cast< sal_uInt16 >( rNameVector.size() ); if (!nItems) return; @@ -576,7 +576,7 @@ void ImageList::InsertFromHorizontalStrip( const BitmapEx &rBitmapEx, aSize.Width() /= nItems; ImplInit( nItems, aSize ); - for (USHORT nIdx = 0; nIdx < nItems; nIdx++) + for (sal_uInt16 nIdx = 0; nIdx < nItems; nIdx++) { BitmapEx aBitmap( rBitmapEx, Point( nIdx * aSize.Width(), 0 ), aSize ); mpImplData->AddImage( rNameVector[ nIdx ], nIdx + 1, aBitmap ); @@ -586,11 +586,11 @@ void ImageList::InsertFromHorizontalStrip( const BitmapEx &rBitmapEx, // ----------------------------------------------------------------------- void ImageList::InsertFromHorizontalBitmap( const ResId& rResId, - USHORT nCount, + sal_uInt16 nCount, const Color *pMaskColor, const Color *pSearchColors, const Color *pReplaceColors, - ULONG nColorCount) + sal_uLong nColorCount) { BitmapEx aBmpEx( rResId ); if (!aBmpEx.IsTransparent()) @@ -609,7 +609,7 @@ void ImageList::InsertFromHorizontalBitmap( const ResId& rResId, // ----------------------------------------------------------------------- -USHORT ImageList::ImplGetImageId( const ::rtl::OUString& rImageName ) const +sal_uInt16 ImageList::ImplGetImageId( const ::rtl::OUString& rImageName ) const { DBG_CHKTHIS( ImageList, NULL ); @@ -622,7 +622,7 @@ USHORT ImageList::ImplGetImageId( const ::rtl::OUString& rImageName ) const // ----------------------------------------------------------------------- -void ImageList::AddImage( USHORT nId, const Image& rImage ) +void ImageList::AddImage( sal_uInt16 nId, const Image& rImage ) { DBG_CHKTHIS( ImageList, NULL ); DBG_CHKOBJ( &rImage, Image, NULL ); @@ -652,7 +652,7 @@ void ImageList::AddImage( const ::rtl::OUString& rImageName, const Image& rImage // ----------------------------------------------------------------------- -void ImageList::ReplaceImage( USHORT nId, const Image& rImage ) +void ImageList::ReplaceImage( sal_uInt16 nId, const Image& rImage ) { DBG_CHKTHIS( ImageList, NULL ); DBG_CHKOBJ( &rImage, Image, NULL ); @@ -666,7 +666,7 @@ void ImageList::ReplaceImage( USHORT nId, const Image& rImage ) void ImageList::ReplaceImage( const ::rtl::OUString& rImageName, const Image& rImage ) { - const USHORT nId = ImplGetImageId( rImageName ); + const sal_uInt16 nId = ImplGetImageId( rImageName ); if( nId ) { @@ -680,14 +680,14 @@ void ImageList::ReplaceImage( const ::rtl::OUString& rImageName, const Image& rI // ----------------------------------------------------------------------- -void ImageList::ReplaceImage( USHORT nId, USHORT nReplaceId ) +void ImageList::ReplaceImage( sal_uInt16 nId, sal_uInt16 nReplaceId ) { DBG_CHKTHIS( ImageList, NULL ); DBG_ASSERT( GetImagePos( nId ) != IMAGELIST_IMAGE_NOTFOUND, "ImageList::ReplaceImage(): Unknown nId" ); DBG_ASSERT( GetImagePos( nReplaceId ) != IMAGELIST_IMAGE_NOTFOUND, "ImageList::ReplaceImage(): Unknown nReplaceId" ); - ULONG nPosDest = GetImagePos( nId ); - ULONG nPosSrc = GetImagePos( nReplaceId ); + sal_uLong nPosDest = GetImagePos( nId ); + sal_uLong nPosSrc = GetImagePos( nReplaceId ); if( nPosDest != IMAGELIST_IMAGE_NOTFOUND && nPosSrc != IMAGELIST_IMAGE_NOTFOUND ) { @@ -700,7 +700,7 @@ void ImageList::ReplaceImage( USHORT nId, USHORT nReplaceId ) void ImageList::ReplaceImage( const ::rtl::OUString& rImageName, const ::rtl::OUString& rReplaceName ) { - const USHORT nId1 = ImplGetImageId( rImageName ), nId2 = ImplGetImageId( rReplaceName ); + const sal_uInt16 nId1 = ImplGetImageId( rImageName ), nId2 = ImplGetImageId( rReplaceName ); if( nId1 && nId2 ) ReplaceImage( nId1, nId2 ); @@ -708,7 +708,7 @@ void ImageList::ReplaceImage( const ::rtl::OUString& rImageName, const ::rtl::OU // ----------------------------------------------------------------------- -void ImageList::RemoveImage( USHORT nId ) +void ImageList::RemoveImage( sal_uInt16 nId ) { DBG_CHKTHIS( ImageList, NULL ); @@ -716,7 +716,7 @@ void ImageList::RemoveImage( USHORT nId ) { if( mpImplData->maImages[ i ]->mnId == nId ) { - mpImplData->RemoveImage( static_cast< USHORT >( i ) ); + mpImplData->RemoveImage( static_cast< sal_uInt16 >( i ) ); break; } } @@ -726,7 +726,7 @@ void ImageList::RemoveImage( USHORT nId ) void ImageList::RemoveImage( const ::rtl::OUString& rImageName ) { - const USHORT nId = ImplGetImageId( rImageName ); + const sal_uInt16 nId = ImplGetImageId( rImageName ); if( nId ) RemoveImage( nId ); @@ -734,7 +734,7 @@ void ImageList::RemoveImage( const ::rtl::OUString& rImageName ) // ----------------------------------------------------------------------- -Image ImageList::GetImage( USHORT nId ) const +Image ImageList::GetImage( sal_uInt16 nId ) const { DBG_CHKTHIS( ImageList, NULL ); @@ -800,16 +800,16 @@ void ImageList::Clear() // ----------------------------------------------------------------------- -USHORT ImageList::GetImageCount() const +sal_uInt16 ImageList::GetImageCount() const { DBG_CHKTHIS( ImageList, NULL ); - return mpImplData ? static_cast< USHORT >( mpImplData->maImages.size() ) : 0; + return mpImplData ? static_cast< sal_uInt16 >( mpImplData->maImages.size() ) : 0; } // ----------------------------------------------------------------------- -USHORT ImageList::GetImagePos( USHORT nId ) const +sal_uInt16 ImageList::GetImagePos( sal_uInt16 nId ) const { DBG_CHKTHIS( ImageList, NULL ); @@ -818,21 +818,21 @@ USHORT ImageList::GetImagePos( USHORT nId ) const for( sal_uInt32 i = 0; i < mpImplData->maImages.size(); ++i ) { if (mpImplData->maImages[ i ]->mnId == nId) - return static_cast< USHORT >( i ); + return static_cast< sal_uInt16 >( i ); } } return IMAGELIST_IMAGE_NOTFOUND; } -bool ImageList::HasImageAtPos( USHORT nId ) const +bool ImageList::HasImageAtPos( sal_uInt16 nId ) const { return GetImagePos( nId ) != IMAGELIST_IMAGE_NOTFOUND; } // ----------------------------------------------------------------------- -USHORT ImageList::GetImagePos( const ::rtl::OUString& rImageName ) const +sal_uInt16 ImageList::GetImagePos( const ::rtl::OUString& rImageName ) const { DBG_CHKTHIS( ImageList, NULL ); @@ -841,7 +841,7 @@ USHORT ImageList::GetImagePos( const ::rtl::OUString& rImageName ) const for( sal_uInt32 i = 0; i < mpImplData->maImages.size(); i++ ) { if (mpImplData->maImages[i]->maName == rImageName) - return static_cast< USHORT >( i ); + return static_cast< sal_uInt16 >( i ); } } @@ -850,7 +850,7 @@ USHORT ImageList::GetImagePos( const ::rtl::OUString& rImageName ) const // ----------------------------------------------------------------------- -USHORT ImageList::GetImageId( USHORT nPos ) const +sal_uInt16 ImageList::GetImageId( sal_uInt16 nPos ) const { DBG_CHKTHIS( ImageList, NULL ); @@ -862,13 +862,13 @@ USHORT ImageList::GetImageId( USHORT nPos ) const // ----------------------------------------------------------------------- -void ImageList::GetImageIds( ::std::vector< USHORT >& rIds ) const +void ImageList::GetImageIds( ::std::vector< sal_uInt16 >& rIds ) const { RTL_LOGFILE_CONTEXT( aLog, "vcl: ImageList::GetImageIds" ); DBG_CHKTHIS( ImageList, NULL ); - rIds = ::std::vector< USHORT >(); + rIds = ::std::vector< sal_uInt16 >(); if( mpImplData ) { @@ -879,7 +879,7 @@ void ImageList::GetImageIds( ::std::vector< USHORT >& rIds ) const // ----------------------------------------------------------------------- -::rtl::OUString ImageList::GetImageName( USHORT nPos ) const +::rtl::OUString ImageList::GetImageName( sal_uInt16 nPos ) const { DBG_CHKTHIS( ImageList, NULL ); @@ -953,7 +953,7 @@ ImageList& ImageList::operator=( const ImageList& rImageList ) // ----------------------------------------------------------------------- -BOOL ImageList::operator==( const ImageList& rImageList ) const +sal_Bool ImageList::operator==( const ImageList& rImageList ) const { DBG_CHKTHIS( ImageList, NULL ); DBG_CHKOBJ( &rImageList, ImageList, NULL ); diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx index bafb5ea8c490..59ee15fa558a 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -40,7 +40,7 @@ ImplAnimView::ImplAnimView( Animation* pParent, OutputDevice* pOut, const Point& rPt, const Size& rSz, - ULONG nExtraData, + sal_uLong nExtraData, OutputDevice* pFirstFrameOutDev ) : mpParent ( pParent ), mpOut ( pFirstFrameOutDev ? pFirstFrameOutDev : pOut ), @@ -52,8 +52,8 @@ ImplAnimView::ImplAnimView( Animation* pParent, OutputDevice* pOut, mpBackground ( new VirtualDevice ), mpRestore ( new VirtualDevice ), meLastDisposal ( DISPOSE_BACK ), - mbPause ( FALSE ), - mbMarked ( FALSE ), + mbPause ( sal_False ), + mbMarked ( sal_False ), mbHMirr ( maSz.Width() < 0L ), mbVMirr ( maSz.Height() < 0L ) { @@ -119,17 +119,17 @@ ImplAnimView::~ImplAnimView() // ------------------------------------------------------------------------ -BOOL ImplAnimView::ImplMatches( OutputDevice* pOut, long nExtraData ) const +sal_Bool ImplAnimView::ImplMatches( OutputDevice* pOut, long nExtraData ) const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( nExtraData ) { if( ( mnExtraData == nExtraData ) && ( !pOut || ( pOut == mpOut ) ) ) - bRet = TRUE; + bRet = sal_True; } else if( !pOut || ( pOut == mpOut ) ) - bRet = TRUE; + bRet = sal_True; return bRet; } @@ -175,15 +175,15 @@ void ImplAnimView::ImplGetPosSize( const AnimationBitmap& rAnm, Point& rPosPix, // ------------------------------------------------------------------------ -void ImplAnimView::ImplDrawToPos( ULONG nPos ) +void ImplAnimView::ImplDrawToPos( sal_uLong nPos ) { VirtualDevice aVDev; Region* pOldClip = !maClip.IsNull() ? new Region( mpOut->GetClipRegion() ) : NULL; - aVDev.SetOutputSizePixel( maSzPix, FALSE ); - nPos = Min( nPos, (ULONG) mpParent->Count() - 1UL ); + aVDev.SetOutputSizePixel( maSzPix, sal_False ); + nPos = Min( nPos, (sal_uLong) mpParent->Count() - 1UL ); - for( ULONG i = 0UL; i <= nPos; i++ ) + for( sal_uLong i = 0UL; i <= nPos; i++ ) ImplDraw( i, &aVDev ); if( pOldClip ) @@ -200,20 +200,20 @@ void ImplAnimView::ImplDrawToPos( ULONG nPos ) // ------------------------------------------------------------------------ -void ImplAnimView::ImplDraw( ULONG nPos ) +void ImplAnimView::ImplDraw( sal_uLong nPos ) { ImplDraw( nPos, NULL ); } // ------------------------------------------------------------------------ -void ImplAnimView::ImplDraw( ULONG nPos, VirtualDevice* pVDev ) +void ImplAnimView::ImplDraw( sal_uLong nPos, VirtualDevice* pVDev ) { Rectangle aOutRect( mpOut->PixelToLogic( Point() ), mpOut->GetOutputSize() ); // check, if output lies out of display if( aOutRect.Intersection( Rectangle( maDispPt, maDispSz ) ).IsEmpty() ) - ImplSetMarked( TRUE ); + ImplSetMarked( sal_True ); else if( !mbPause ) { VirtualDevice* pDev; @@ -221,8 +221,8 @@ void ImplAnimView::ImplDraw( ULONG nPos, VirtualDevice* pVDev ) Point aBmpPosPix; Size aSizePix; Size aBmpSizePix; - const ULONG nLastPos = mpParent->Count() - 1; - const AnimationBitmap& rAnm = mpParent->Get( (USHORT) ( mnActPos = Min( nPos, nLastPos ) ) ); + const sal_uLong nLastPos = mpParent->Count() - 1; + const AnimationBitmap& rAnm = mpParent->Get( (sal_uInt16) ( mnActPos = Min( nPos, nLastPos ) ) ); ImplGetPosSize( rAnm, aPosPix, aSizePix ); @@ -254,7 +254,7 @@ void ImplAnimView::ImplDraw( ULONG nPos, VirtualDevice* pVDev ) if( !pVDev ) { pDev = new VirtualDevice; - pDev->SetOutputSizePixel( maSzPix, FALSE ); + pDev->SetOutputSizePixel( maSzPix, sal_False ); pDev->DrawOutDev( Point(), maSzPix, maDispPt, maDispSz, *mpOut ); } else @@ -285,10 +285,10 @@ void ImplAnimView::ImplDraw( ULONG nPos, VirtualDevice* pVDev ) // ==> ggf. in eine Bitmap stecken, ansonsten SaveBitmap // aus Speichergruenden loeschen if( ( meLastDisposal == DISPOSE_BACK ) || ( meLastDisposal == DISPOSE_NOT ) ) - mpRestore->SetOutputSizePixel( Size( 1, 1 ), FALSE ); + mpRestore->SetOutputSizePixel( Size( 1, 1 ), sal_False ); else { - mpRestore->SetOutputSizePixel( maRestSz, FALSE ); + mpRestore->SetOutputSizePixel( maRestSz, sal_False ); mpRestore->DrawOutDev( Point(), maRestSz, aPosPix, aSizePix, *pDev ); } @@ -321,7 +321,7 @@ void ImplAnimView::ImplDraw( ULONG nPos, VirtualDevice* pVDev ) void ImplAnimView::ImplRepaint() { - const BOOL bOldPause = mbPause; + const sal_Bool bOldPause = mbPause; if( mpOut->GetOutDevType() == OUTDEV_WINDOW ) { @@ -334,7 +334,7 @@ void ImplAnimView::ImplRepaint() else mpBackground->DrawOutDev( Point(), maSzPix, maDispPt, maDispSz, *mpOut ); - mbPause = FALSE; + mbPause = sal_False; ImplDrawToPos( mnActPos ); mbPause = bOldPause; } diff --git a/vcl/source/gdi/impanmvw.hxx b/vcl/source/gdi/impanmvw.hxx index 84e3273fc8c5..4e96ecbd9b64 100644 --- a/vcl/source/gdi/impanmvw.hxx +++ b/vcl/source/gdi/impanmvw.hxx @@ -58,27 +58,27 @@ private: Region maClip; VirtualDevice* mpBackground; VirtualDevice* mpRestore; - ULONG mnActPos; + sal_uLong mnActPos; Disposal meLastDisposal; - BOOL mbPause; - BOOL mbFirst; - BOOL mbMarked; - BOOL mbHMirr; - BOOL mbVMirr; + sal_Bool mbPause; + sal_Bool mbFirst; + sal_Bool mbMarked; + sal_Bool mbHMirr; + sal_Bool mbVMirr; void ImplGetPosSize( const AnimationBitmap& rAnm, Point& rPosPix, Size& rSizePix ); - void ImplDraw( ULONG nPos, VirtualDevice* pVDev ); + void ImplDraw( sal_uLong nPos, VirtualDevice* pVDev ); public: ImplAnimView( Animation* pParent, OutputDevice* pOut, - const Point& rPt, const Size& rSz, ULONG nExtraData, + const Point& rPt, const Size& rSz, sal_uLong nExtraData, OutputDevice* pFirstFrameOutDev = NULL ); ~ImplAnimView(); - BOOL ImplMatches( OutputDevice* pOut, long nExtraData ) const; - void ImplDrawToPos( ULONG nPos ); - void ImplDraw( ULONG nPos ); + sal_Bool ImplMatches( OutputDevice* pOut, long nExtraData ) const; + void ImplDrawToPos( sal_uLong nPos ); + void ImplDraw( sal_uLong nPos ); void ImplRepaint(); AInfo* ImplCreateAInfo() const; @@ -87,11 +87,11 @@ public: const Size& ImplGetOutSize() const { return maSz; } const Size& ImplGetOutSizePix() const { return maSzPix; } - void ImplPause( BOOL bPause ) { mbPause = bPause; } - BOOL ImplIsPause() const { return mbPause; } + void ImplPause( sal_Bool bPause ) { mbPause = bPause; } + sal_Bool ImplIsPause() const { return mbPause; } - void ImplSetMarked( BOOL bMarked ) { mbMarked = bMarked; } - BOOL ImplIsMarked() const { return mbMarked; } + void ImplSetMarked( sal_Bool bMarked ) { mbMarked = bMarked; } + sal_Bool ImplIsMarked() const { return mbMarked; } }; #endif diff --git a/vcl/source/gdi/impbmp.cxx b/vcl/source/gdi/impbmp.cxx index 4b4b1f4289b6..6957e32b3e25 100644 --- a/vcl/source/gdi/impbmp.cxx +++ b/vcl/source/gdi/impbmp.cxx @@ -64,7 +64,7 @@ void ImpBitmap::ImplSetSalBitmap( SalBitmap* pBitmap ) // ----------------------------------------------------------------------- -BOOL ImpBitmap::ImplCreate( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ) +sal_Bool ImpBitmap::ImplCreate( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) { maSourceSize = rSize; return mpSalBitmap->Create( rSize, nBitCount, rPal ); @@ -72,7 +72,7 @@ BOOL ImpBitmap::ImplCreate( const Size& rSize, USHORT nBitCount, const BitmapPal // ----------------------------------------------------------------------- -BOOL ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap ) +sal_Bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap ) { maSourceSize = rImpBitmap.maSourceSize; mnChecksum = rImpBitmap.mnChecksum; @@ -81,14 +81,14 @@ BOOL ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap ) // ----------------------------------------------------------------------- -BOOL ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, SalGraphics* pGraphics ) +sal_Bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, SalGraphics* pGraphics ) { return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, pGraphics ); } // ----------------------------------------------------------------------- -BOOL ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, USHORT nNewBitCount ) +sal_Bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, sal_uInt16 nNewBitCount ) { return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, nNewBitCount ); } @@ -109,22 +109,22 @@ Size ImpBitmap::ImplGetSize() const // ----------------------------------------------------------------------- -USHORT ImpBitmap::ImplGetBitCount() const +sal_uInt16 ImpBitmap::ImplGetBitCount() const { - USHORT nBitCount = mpSalBitmap->GetBitCount(); + sal_uInt16 nBitCount = mpSalBitmap->GetBitCount(); return( ( nBitCount <= 1 ) ? 1 : ( nBitCount <= 4 ) ? 4 : ( nBitCount <= 8 ) ? 8 : 24 ); } // ----------------------------------------------------------------------- -BitmapBuffer* ImpBitmap::ImplAcquireBuffer( BOOL bReadOnly ) +BitmapBuffer* ImpBitmap::ImplAcquireBuffer( sal_Bool bReadOnly ) { return mpSalBitmap->AcquireBuffer( bReadOnly ); } // ----------------------------------------------------------------------- -void ImpBitmap::ImplReleaseBuffer( BitmapBuffer* pBuffer, BOOL bReadOnly ) +void ImpBitmap::ImplReleaseBuffer( BitmapBuffer* pBuffer, sal_Bool bReadOnly ) { mpSalBitmap->ReleaseBuffer( pBuffer, bReadOnly ); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index cbd53dc1b201..bf99364a0f64 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -69,7 +69,7 @@ struct ImpSwapFile { INetURLObject aSwapURL; - ULONG nRefCount; + sal_uLong nRefCount; }; // ----------------- @@ -89,15 +89,15 @@ GraphicReader::~GraphicReader() // ------------------------------------------------------------------------ -BOOL GraphicReader::IsPreviewModeEnabled() const +sal_Bool GraphicReader::IsPreviewModeEnabled() const { if( !mpReaderData ) - return FALSE; + return sal_False; if( mpReaderData->maPreviewSize.Width() ) - return TRUE; + return sal_True; if( mpReaderData->maPreviewSize.Height() ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } // ------------------------------------------------------------------------ @@ -140,8 +140,8 @@ ImpGraphic::ImpGraphic() : mnDocFilePos ( 0UL ), mnSizeBytes ( 0UL ), mnRefCount ( 1UL ), - mbSwapOut ( FALSE ), - mbSwapUnderway ( FALSE ) + mbSwapOut ( sal_False ), + mbSwapUnderway ( sal_False ) { } @@ -158,7 +158,7 @@ ImpGraphic::ImpGraphic( const ImpGraphic& rImpGraphic ) : mnSizeBytes ( rImpGraphic.mnSizeBytes ), mnRefCount ( 1UL ), mbSwapOut ( rImpGraphic.mbSwapOut ), - mbSwapUnderway ( FALSE ) + mbSwapUnderway ( sal_False ) { if( mpSwapFile ) mpSwapFile->nRefCount++; @@ -189,8 +189,8 @@ ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) : mnDocFilePos ( 0UL ), mnSizeBytes ( 0UL ), mnRefCount ( 1UL ), - mbSwapOut ( FALSE ), - mbSwapUnderway ( FALSE ) + mbSwapOut ( sal_False ), + mbSwapUnderway ( sal_False ) { } @@ -206,8 +206,8 @@ ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) : mnDocFilePos ( 0UL ), mnSizeBytes ( 0UL ), mnRefCount ( 1UL ), - mbSwapOut ( FALSE ), - mbSwapUnderway ( FALSE ) + mbSwapOut ( sal_False ), + mbSwapUnderway ( sal_False ) { } @@ -223,8 +223,8 @@ ImpGraphic::ImpGraphic( const Animation& rAnimation ) : mnDocFilePos ( 0UL ), mnSizeBytes ( 0UL ), mnRefCount ( 1UL ), - mbSwapOut ( FALSE ), - mbSwapUnderway ( FALSE ) + mbSwapOut ( sal_False ), + mbSwapUnderway ( sal_False ) { } @@ -240,8 +240,8 @@ ImpGraphic::ImpGraphic( const GDIMetaFile& rMtf ) : mnDocFilePos ( 0UL ), mnSizeBytes ( 0UL ), mnRefCount ( 1UL ), - mbSwapOut ( FALSE ), - mbSwapUnderway ( FALSE ) + mbSwapOut ( sal_False ), + mbSwapUnderway ( sal_False ) { } @@ -251,7 +251,7 @@ ImpGraphic::~ImpGraphic() { ImplClear(); - if( (ULONG) mpContext > 1UL ) + if( (sal_uLong) mpContext > 1UL ) delete mpContext; } @@ -305,24 +305,24 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic ) // ------------------------------------------------------------------------ -BOOL ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const +sal_Bool ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( this == &rImpGraphic ) - bRet = TRUE; + bRet = sal_True; else if( !ImplIsSwapOut() && ( rImpGraphic.meType == meType ) ) { switch( meType ) { case( GRAPHIC_NONE ): - bRet = TRUE; + bRet = sal_True; break; case( GRAPHIC_GDIMETAFILE ): { if( rImpGraphic.maMetaFile == maMetaFile ) - bRet = TRUE; + bRet = sal_True; } break; @@ -331,10 +331,10 @@ BOOL ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const if( mpAnimation ) { if( rImpGraphic.mpAnimation && ( *rImpGraphic.mpAnimation == *mpAnimation ) ) - bRet = TRUE; + bRet = sal_True; } else if( !rImpGraphic.mpAnimation && ( rImpGraphic.maEx == maEx ) ) - bRet = TRUE; + bRet = sal_True; } break; @@ -348,7 +348,7 @@ BOOL ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const // ------------------------------------------------------------------------ -void ImpGraphic::ImplClearGraphics( BOOL bCreateSwapInfo ) +void ImpGraphic::ImplClearGraphics( sal_Bool bCreateSwapInfo ) { if( bCreateSwapInfo && !ImplIsSwapOut() ) { @@ -410,12 +410,12 @@ void ImpGraphic::ImplClear() mpSwapFile = NULL; } - mbSwapOut = FALSE; + mbSwapOut = sal_False; mnDocFilePos = 0UL; maDocFileURLStr.Erase(); // cleanup - ImplClearGraphics( FALSE ); + ImplClearGraphics( sal_False ); meType = GRAPHIC_NONE; mnSizeBytes = 0; } @@ -437,42 +437,42 @@ void ImpGraphic::ImplSetDefaultType() // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplIsSupportedGraphic() const +sal_Bool ImpGraphic::ImplIsSupportedGraphic() const { return( meType != GRAPHIC_NONE ); } // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplIsTransparent() const +sal_Bool ImpGraphic::ImplIsTransparent() const { - BOOL bRet; + sal_Bool bRet; if( meType == GRAPHIC_BITMAP ) bRet = ( mpAnimation ? mpAnimation->IsTransparent() : maEx.IsTransparent() ); else - bRet = TRUE; + bRet = sal_True; return bRet; } // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplIsAlpha() const +sal_Bool ImpGraphic::ImplIsAlpha() const { - BOOL bRet; + sal_Bool bRet; if( meType == GRAPHIC_BITMAP ) bRet = ( NULL == mpAnimation ) && maEx.IsAlpha(); else - bRet = FALSE; + bRet = sal_False; return bRet; } // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplIsAnimated() const +sal_Bool ImpGraphic::ImplIsAnimated() const { return( mpAnimation != NULL ); } @@ -728,7 +728,7 @@ void ImpGraphic::ImplSetPrefMapMode( const MapMode& rPrefMapMode ) // ------------------------------------------------------------------------ -ULONG ImpGraphic::ImplGetSizeBytes() const +sal_uLong ImpGraphic::ImplGetSizeBytes() const { if( 0 == mnSizeBytes ) { @@ -855,7 +855,7 @@ Link ImpGraphic::ImplGetAnimationNotifyHdl() const // ------------------------------------------------------------------------ -ULONG ImpGraphic::ImplGetAnimationLoopCount() const +sal_uLong ImpGraphic::ImplGetAnimationLoopCount() const { return( mpAnimation ? mpAnimation->GetLoopCount() : 0UL ); } @@ -891,7 +891,7 @@ void ImpGraphic::ImplSetContext( GraphicReader* pReader ) // ------------------------------------------------------------------------ -void ImpGraphic::ImplSetDocFileName( const String& rName, ULONG nFilePos ) +void ImpGraphic::ImplSetDocFileName( const String& rName, sal_uLong nFilePos ) { const INetURLObject aURL( rName ); @@ -910,29 +910,29 @@ const String& ImpGraphic::ImplGetDocFileName() const // ------------------------------------------------------------------------ -ULONG ImpGraphic::ImplGetDocFilePos() const +sal_uLong ImpGraphic::ImplGetDocFilePos() const { return mnDocFilePos; } // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplReadEmbedded( SvStream& rIStm, BOOL bSwap ) +sal_Bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm, sal_Bool bSwap ) { MapMode aMapMode; Size aSize; - const ULONG nStartPos = rIStm.Tell(); + const sal_uLong nStartPos = rIStm.Tell(); sal_uInt32 nId; - ULONG nHeaderLen; + sal_uLong nHeaderLen; long nType; long nLen; - const USHORT nOldFormat = rIStm.GetNumberFormatInt(); - BOOL bRet = FALSE; + const sal_uInt16 nOldFormat = rIStm.GetNumberFormatInt(); + sal_Bool bRet = sal_False; if( !mbSwapUnderway ) { const String aTempURLStr( maDocFileURLStr ); - const ULONG nTempPos = mnDocFilePos; + const sal_uLong nTempPos = mnDocFilePos; ImplClear(); @@ -1017,7 +1017,7 @@ BOOL ImpGraphic::ImplReadEmbedded( SvStream& rIStm, BOOL bSwap ) if( maDocFileURLStr.Len() ) { rIStm.Seek( nStartPos + nHeaderLen + nLen ); - bRet = mbSwapOut = TRUE; + bRet = mbSwapOut = sal_True; } else { @@ -1030,9 +1030,9 @@ BOOL ImpGraphic::ImplReadEmbedded( SvStream& rIStm, BOOL bSwap ) if( pOStm ) { - ULONG nFullLen = nHeaderLen + nLen; - ULONG nPartLen = Min( nFullLen, (ULONG) GRAPHIC_MAXPARTLEN ); - BYTE* pBuffer = (BYTE*) rtl_allocateMemory( nPartLen ); + sal_uLong nFullLen = nHeaderLen + nLen; + sal_uLong nPartLen = Min( nFullLen, (sal_uLong) GRAPHIC_MAXPARTLEN ); + sal_uInt8* pBuffer = (sal_uInt8*) rtl_allocateMemory( nPartLen ); pOStm->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); @@ -1052,12 +1052,12 @@ BOOL ImpGraphic::ImplReadEmbedded( SvStream& rIStm, BOOL bSwap ) } rtl_freeMemory( pBuffer ); - ULONG nReadErr = rIStm.GetError(), nWriteErr = pOStm->GetError(); + sal_uLong nReadErr = rIStm.GetError(), nWriteErr = pOStm->GetError(); delete pOStm, pOStm = NULL; if( !nReadErr && !nWriteErr ) { - bRet = mbSwapOut = TRUE; + bRet = mbSwapOut = sal_True; mpSwapFile = new ImpSwapFile; mpSwapFile->nRefCount = 1; mpSwapFile->aSwapURL = aTmpURL; @@ -1100,9 +1100,9 @@ BOOL ImpGraphic::ImplReadEmbedded( SvStream& rIStm, BOOL bSwap ) else if( meType >= SYS_WINMETAFILE && meType <= SYS_MACMETAFILE ) { Graphic aSysGraphic; - ULONG nCvtType; + sal_uLong nCvtType; - switch( sal::static_int_cast<ULONG>(meType) ) + switch( sal::static_int_cast<sal_uLong>(meType) ) { case( SYS_WINMETAFILE ): case( SYS_WNTMETAFILE ): nCvtType = CVT_WMF; break; @@ -1130,7 +1130,7 @@ BOOL ImpGraphic::ImplReadEmbedded( SvStream& rIStm, BOOL bSwap ) } } else - bRet = TRUE; + bRet = sal_True; rIStm.SetNumberFormatInt( nOldFormat ); @@ -1139,16 +1139,16 @@ BOOL ImpGraphic::ImplReadEmbedded( SvStream& rIStm, BOOL bSwap ) // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplWriteEmbedded( SvStream& rOStm ) +sal_Bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( ( meType != GRAPHIC_NONE ) && ( meType != GRAPHIC_DEFAULT ) && !ImplIsSwapOut() ) { const MapMode aMapMode( ImplGetPrefMapMode() ); const Size aSize( ImplGetPrefSize() ); - const USHORT nOldFormat = rOStm.GetNumberFormatInt(); - ULONG nDataFieldPos; + const sal_uInt16 nOldFormat = rOStm.GetNumberFormatInt(); + sal_uLong nDataFieldPos; rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); @@ -1195,18 +1195,18 @@ BOOL ImpGraphic::ImplWriteEmbedded( SvStream& rOStm ) // write data block if( !rOStm.GetError() ) { - const ULONG nDataStart = rOStm.Tell(); + const sal_uLong nDataStart = rOStm.Tell(); if( ImplIsSupportedGraphic() ) rOStm << *this; if( !rOStm.GetError() ) { - const ULONG nStmPos2 = rOStm.Tell(); + const sal_uLong nStmPos2 = rOStm.Tell(); rOStm.Seek( nDataFieldPos ); rOStm << (long) ( nStmPos2 - nDataStart ); rOStm.Seek( nStmPos2 ); - bRet = TRUE; + bRet = sal_True; } } @@ -1218,9 +1218,9 @@ BOOL ImpGraphic::ImplWriteEmbedded( SvStream& rOStm ) // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplSwapOut() +sal_Bool ImpGraphic::ImplSwapOut() { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !ImplIsSwapOut() ) { @@ -1238,7 +1238,7 @@ BOOL ImpGraphic::ImplSwapOut() pOStm->SetVersion( SOFFICE_FILEFORMAT_50 ); pOStm->SetCompressMode( COMPRESSMODE_NATIVE ); - if( ( bRet = ImplSwapOut( pOStm ) ) == TRUE ) + if( ( bRet = ImplSwapOut( pOStm ) ) == sal_True ) { mpSwapFile = new ImpSwapFile; mpSwapFile->nRefCount = 1; @@ -1276,8 +1276,8 @@ BOOL ImpGraphic::ImplSwapOut() } else { - ImplClearGraphics( TRUE ); - bRet = mbSwapOut = TRUE; + ImplClearGraphics( sal_True ); + bRet = mbSwapOut = sal_True; } } @@ -1286,9 +1286,9 @@ BOOL ImpGraphic::ImplSwapOut() // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplSwapOut( SvStream* pOStm ) +sal_Bool ImpGraphic::ImplSwapOut( SvStream* pOStm ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pOStm ) { @@ -1300,15 +1300,15 @@ BOOL ImpGraphic::ImplSwapOut( SvStream* pOStm ) if( !pOStm->GetError() ) { - ImplClearGraphics( TRUE ); - bRet = mbSwapOut = TRUE; + ImplClearGraphics( sal_True ); + bRet = mbSwapOut = sal_True; } } } else { - ImplClearGraphics( TRUE ); - bRet = mbSwapOut = TRUE; + ImplClearGraphics( sal_True ); + bRet = mbSwapOut = sal_True; } return bRet; @@ -1316,9 +1316,9 @@ BOOL ImpGraphic::ImplSwapOut( SvStream* pOStm ) // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplSwapIn() +sal_Bool ImpGraphic::ImplSwapIn() { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( ImplIsSwapOut() ) { @@ -1385,9 +1385,9 @@ BOOL ImpGraphic::ImplSwapIn() // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplSwapIn( SvStream* pIStm ) +sal_Bool ImpGraphic::ImplSwapIn( SvStream* pIStm ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pIStm ) { @@ -1395,14 +1395,14 @@ BOOL ImpGraphic::ImplSwapIn( SvStream* pIStm ) if( !pIStm->GetError() ) { - mbSwapUnderway = TRUE; + mbSwapUnderway = sal_True; bRet = ImplReadEmbedded( *pIStm ); - mbSwapUnderway = FALSE; + mbSwapUnderway = sal_False; if( !bRet ) ImplClear(); else - mbSwapOut = FALSE; + mbSwapOut = sal_False; } } @@ -1411,7 +1411,7 @@ BOOL ImpGraphic::ImplSwapIn( SvStream* pIStm ) // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplIsSwapOut() const +sal_Bool ImpGraphic::ImplIsSwapOut() const { return mbSwapOut; } @@ -1436,16 +1436,16 @@ GfxLink ImpGraphic::ImplGetLink() // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplIsLink() const +sal_Bool ImpGraphic::ImplIsLink() const { - return ( mpGfxLink != NULL ) ? TRUE : FALSE; + return ( mpGfxLink != NULL ) ? sal_True : sal_False; } // ------------------------------------------------------------------------ -ULONG ImpGraphic::ImplGetChecksum() const +sal_uLong ImpGraphic::ImplGetChecksum() const { - ULONG nRet = 0; + sal_uLong nRet = 0; if( ImplIsSupportedGraphic() && !ImplIsSwapOut() ) { @@ -1474,9 +1474,9 @@ ULONG ImpGraphic::ImplGetChecksum() const // ------------------------------------------------------------------------ -BOOL ImpGraphic::ImplExportNative( SvStream& rOStm ) const +sal_Bool ImpGraphic::ImplExportNative( SvStream& rOStm ) const { - BOOL bResult = FALSE; + sal_Bool bResult = sal_False; if( !rOStm.GetError() ) { @@ -1503,7 +1503,7 @@ SvStream& operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic ) { if( !rIStm.GetError() ) { - const ULONG nStmPos1 = rIStm.Tell(); + const sal_uLong nStmPos1 = rIStm.Tell(); sal_uInt32 nTmp; if ( !rImpGraphic.mbSwapUnderway ) @@ -1537,7 +1537,7 @@ SvStream& operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic ) if( !rIStm.GetError() && aLink.LoadNative( aGraphic ) ) { // set link only, if no other link was set - const BOOL bSetLink = ( rImpGraphic.mpGfxLink == NULL ); + const sal_Bool bSetLink = ( rImpGraphic.mpGfxLink == NULL ); // assign graphic rImpGraphic = *aGraphic.ImplGetImpGraphic(); @@ -1560,7 +1560,7 @@ SvStream& operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic ) else { BitmapEx aBmpEx; - const USHORT nOldFormat = rIStm.GetNumberFormatInt(); + const sal_uInt16 nOldFormat = rIStm.GetNumberFormatInt(); rIStm.SeekRel( -4 ); rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); @@ -1568,8 +1568,8 @@ SvStream& operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic ) if( !rIStm.GetError() ) { - UINT32 nMagic1(0), nMagic2(0); - ULONG nActPos = rIStm.Tell(); + sal_uInt32 nMagic1(0), nMagic2(0); + sal_uLong nActPos = rIStm.Tell(); rIStm >> nMagic1 >> nMagic2; rIStm.Seek( nActPos ); @@ -1639,7 +1639,7 @@ SvStream& operator<<( SvStream& rOStm, const ImpGraphic& rImpGraphic ) else { // own format - const USHORT nOldFormat = rOStm.GetNumberFormatInt(); + const sal_uInt16 nOldFormat = rOStm.GetNumberFormatInt(); rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); switch( rImpGraphic.ImplGetType() ) diff --git a/vcl/source/gdi/impimage.cxx b/vcl/source/gdi/impimage.cxx index 09bf08e05730..d2e479e1edb5 100644 --- a/vcl/source/gdi/impimage.cxx +++ b/vcl/source/gdi/impimage.cxx @@ -66,7 +66,7 @@ ImageAryData::ImageAryData( const ImageAryData& rData ) : } ImageAryData::ImageAryData( const rtl::OUString &aName, - USHORT nId, const BitmapEx &aBitmap ) + sal_uInt16 nId, const BitmapEx &aBitmap ) : maName( aName ), mnId( nId ), maBitmapEx( aBitmap ) { } @@ -118,7 +118,7 @@ ImplImageList::~ImplImageList() } void ImplImageList::AddImage( const ::rtl::OUString &aName, - USHORT nId, const BitmapEx &aBitmapEx ) + sal_uInt16 nId, const BitmapEx &aBitmapEx ) { ImageAryData *pImg = new ImageAryData( aName, nId, aBitmapEx ); maImages.push_back( pImg ); @@ -126,7 +126,7 @@ void ImplImageList::AddImage( const ::rtl::OUString &aName, maNameHash [ aName ] = pImg; } -void ImplImageList::RemoveImage( USHORT nPos ) +void ImplImageList::RemoveImage( sal_uInt16 nPos ) { ImageAryData *pImg = maImages[ nPos ]; if( pImg->maName.getLength() ) @@ -134,9 +134,9 @@ void ImplImageList::RemoveImage( USHORT nPos ) maImages.erase( maImages.begin() + nPos ); } -USHORT ImplImageList::GetImageCount() const +sal_uInt16 ImplImageList::GetImageCount() const { - return sal::static_int_cast< USHORT >( maImages.size() ); + return sal::static_int_cast< sal_uInt16 >( maImages.size() ); } // ----------------- @@ -160,7 +160,7 @@ ImplImageData::~ImplImageData() // - ImplImageData - // ----------------- -BOOL ImplImageData::IsEqual( const ImplImageData& rData ) +sal_Bool ImplImageData::IsEqual( const ImplImageData& rData ) { return( maBmpEx == rData.maBmpEx ); } @@ -212,7 +212,7 @@ ImplImageBmp::~ImplImageBmp() // ----------------------------------------------------------------------- -void ImplImageBmp::Create( long nItemWidth, long nItemHeight, USHORT nInitSize ) +void ImplImageBmp::Create( long nItemWidth, long nItemHeight, sal_uInt16 nInitSize ) { const Size aTotalSize( nInitSize * nItemWidth, nItemHeight ); @@ -226,13 +226,13 @@ void ImplImageBmp::Create( long nItemWidth, long nItemHeight, USHORT nInitSize ) mnSize = nInitSize; delete[] mpInfoAry; - mpInfoAry = new BYTE[ mnSize ]; + mpInfoAry = new sal_uInt8[ mnSize ]; memset( mpInfoAry, 0, mnSize ); } // ----------------------------------------------------------------------- -void ImplImageBmp::Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHeight, USHORT nInitSize ) +void ImplImageBmp::Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHeight, sal_uInt16 nInitSize ) { maBmpEx = rBmpEx; maDisabledBmpEx.SetEmpty(); @@ -244,7 +244,7 @@ void ImplImageBmp::Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHe mnSize = nInitSize; delete[] mpInfoAry; - mpInfoAry = new BYTE[ mnSize ]; + mpInfoAry = new sal_uInt8[ mnSize ]; memset( mpInfoAry, rBmpEx.IsAlpha() ? IMPSYSIMAGEITEM_ALPHA : ( rBmpEx.IsTransparent() ? IMPSYSIMAGEITEM_MASK : 0 ), mnSize ); @@ -252,11 +252,11 @@ void ImplImageBmp::Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHe // ----------------------------------------------------------------------- -void ImplImageBmp::Expand( USHORT nGrowSize ) +void ImplImageBmp::Expand( sal_uInt16 nGrowSize ) { - const ULONG nDX = nGrowSize * maSize.Width(); - const USHORT nOldSize = mnSize; - BYTE* pNewAry = new BYTE[ mnSize = sal::static_int_cast<USHORT>(mnSize+nGrowSize) ]; + const sal_uLong nDX = nGrowSize * maSize.Width(); + const sal_uInt16 nOldSize = mnSize; + sal_uInt8* pNewAry = new sal_uInt8[ mnSize = sal::static_int_cast<sal_uInt16>(mnSize+nGrowSize) ]; maBmpEx.Expand( nDX, 0UL ); @@ -284,7 +284,7 @@ void ImplImageBmp::Invert() // ----------------------------------------------------------------------- -void ImplImageBmp::Replace( USHORT nPos, USHORT nSrcPos ) +void ImplImageBmp::Replace( sal_uInt16 nPos, sal_uInt16 nSrcPos ) { const Point aSrcPos( nSrcPos * maSize.Width(), 0L ), aPos( nPos * maSize.Width(), 0L ); const Rectangle aSrcRect( aSrcPos, maSize ); @@ -303,7 +303,7 @@ void ImplImageBmp::Replace( USHORT nPos, USHORT nSrcPos ) // ----------------------------------------------------------------------- -void ImplImageBmp::Replace( USHORT nPos, const ImplImageBmp& rImageBmp, USHORT nSrcPos ) +void ImplImageBmp::Replace( sal_uInt16 nPos, const ImplImageBmp& rImageBmp, sal_uInt16 nSrcPos ) { const Point aSrcPos( nSrcPos * maSize.Width(), 0L ), aPos( nPos * maSize.Width(), 0L ); const Rectangle aSrcRect( aSrcPos, maSize ); @@ -320,7 +320,7 @@ void ImplImageBmp::Replace( USHORT nPos, const ImplImageBmp& rImageBmp, USHORT n // ----------------------------------------------------------------------- -void ImplImageBmp::Replace( USHORT nPos, const BitmapEx& rBmpEx ) +void ImplImageBmp::Replace( sal_uInt16 nPos, const BitmapEx& rBmpEx ) { const Point aNullPos, aPos( nPos * maSize.Width(), 0L ); const Rectangle aSrcRect( aNullPos, maSize ); @@ -338,7 +338,7 @@ void ImplImageBmp::Replace( USHORT nPos, const BitmapEx& rBmpEx ) // ----------------------------------------------------------------------- -void ImplImageBmp::ReplaceColors( const Color* pSrcColors, const Color* pDstColors, ULONG nColorCount ) +void ImplImageBmp::ReplaceColors( const Color* pSrcColors, const Color* pDstColors, sal_uLong nColorCount ) { maBmpEx.Replace( pSrcColors, pDstColors, nColorCount ); delete mpDisplayBmp; @@ -347,7 +347,7 @@ void ImplImageBmp::ReplaceColors( const Color* pSrcColors, const Color* pDstColo // ----------------------------------------------------------------------- -BitmapEx ImplImageBmp::GetBitmapEx( USHORT nPosCount, USHORT* pPosAry ) const +BitmapEx ImplImageBmp::GetBitmapEx( sal_uInt16 nPosCount, sal_uInt16* pPosAry ) const { const Bitmap aNewBmp( Size( nPosCount * maSize.Width(), maSize.Height() ), maBmpEx.GetBitmap().GetBitCount() ); BitmapEx aRet; @@ -362,7 +362,7 @@ BitmapEx ImplImageBmp::GetBitmapEx( USHORT nPosCount, USHORT* pPosAry ) const else aRet = BitmapEx( aNewBmp ); - for( USHORT i = 0; i < nPosCount; i++ ) + for( sal_uInt16 i = 0; i < nPosCount; i++ ) { const Point aSrcPos( pPosAry[ i ] * maSize.Width(), 0L ); const Point aPos( i * maSize.Width(), 0L ); @@ -377,8 +377,8 @@ BitmapEx ImplImageBmp::GetBitmapEx( USHORT nPosCount, USHORT* pPosAry ) const // ----------------------------------------------------------------------- -void ImplImageBmp::Draw( USHORT nPos, OutputDevice* pOutDev, - const Point& rPos, USHORT nStyle, +void ImplImageBmp::Draw( sal_uInt16 nPos, OutputDevice* pOutDev, + const Point& rPos, sal_uInt16 nStyle, const Size* pSize ) { if( pOutDev->IsDeviceOutputNecessary() ) @@ -421,9 +421,9 @@ void ImplImageBmp::Draw( USHORT nPos, OutputDevice* pOutDev, BitmapColor aCol; const long nW = pAcc->Width(); const long nH = pAcc->Height(); - BYTE* pMapR = new BYTE[ 256 ]; - BYTE* pMapG = new BYTE[ 256 ]; - BYTE* pMapB = new BYTE[ 256 ]; + sal_uInt8* pMapR = new sal_uInt8[ 256 ]; + sal_uInt8* pMapG = new sal_uInt8[ 256 ]; + sal_uInt8* pMapB = new sal_uInt8[ 256 ]; long nX, nY; if( nStyle & IMAGE_DRAW_HIGHLIGHT ) @@ -431,20 +431,20 @@ void ImplImageBmp::Draw( USHORT nPos, OutputDevice* pOutDev, else aColor = rSettings.GetDeactiveColor(); - const BYTE cR = aColor.GetRed(); - const BYTE cG = aColor.GetGreen(); - const BYTE cB = aColor.GetBlue(); + const sal_uInt8 cR = aColor.GetRed(); + const sal_uInt8 cG = aColor.GetGreen(); + const sal_uInt8 cB = aColor.GetBlue(); for( nX = 0L; nX < 256L; nX++ ) { - pMapR[ nX ] = (BYTE) ( ( ( nY = ( nX + cR ) >> 1 ) > 255 ) ? 255 : nY ); - pMapG[ nX ] = (BYTE) ( ( ( nY = ( nX + cG ) >> 1 ) > 255 ) ? 255 : nY ); - pMapB[ nX ] = (BYTE) ( ( ( nY = ( nX + cB ) >> 1 ) > 255 ) ? 255 : nY ); + pMapR[ nX ] = (sal_uInt8) ( ( ( nY = ( nX + cR ) >> 1 ) > 255 ) ? 255 : nY ); + pMapG[ nX ] = (sal_uInt8) ( ( ( nY = ( nX + cG ) >> 1 ) > 255 ) ? 255 : nY ); + pMapB[ nX ] = (sal_uInt8) ( ( ( nY = ( nX + cB ) >> 1 ) > 255 ) ? 255 : nY ); } if( pAcc->HasPalette() ) { - for( USHORT i = 0, nCount = pAcc->GetPaletteEntryCount(); i < nCount; i++ ) + for( sal_uInt16 i = 0, nCount = pAcc->GetPaletteEntryCount(); i < nCount; i++ ) { const BitmapColor& rCol = pAcc->GetPaletteColor( i ); aCol.SetRed( pMapR[ rCol.GetRed() ] ); @@ -500,7 +500,7 @@ void ImplImageBmp::Draw( USHORT nPos, OutputDevice* pOutDev, } else { - BYTE cErase = 128; + sal_uInt8 cErase = 128; aTmpBmpEx = BitmapEx( aTmpBmp, AlphaMask( aTmpBmp.GetSizePixel(), &cErase ) ); } } @@ -536,14 +536,14 @@ void ImplImageBmp::Draw( USHORT nPos, OutputDevice* pOutDev, // ----------------------------------------------------------------------- void ImplImageBmp::ImplUpdateDisplayBmp( OutputDevice* -#if defined WIN || defined WNT +#if defined WNT pOutDev #endif ) { if( !mpDisplayBmp && !maBmpEx.IsEmpty() ) { -#if defined WIN || defined WNT +#if defined WNT if( maBmpEx.IsAlpha() ) mpDisplayBmp = new BitmapEx( maBmpEx ); else diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index dba961c5556f..df0e3adddb1d 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -110,23 +110,23 @@ static ChainMove aImplMoveOuter[ 8 ] = { struct ImplColorSet { BitmapColor maColor; - USHORT mnIndex; - BOOL mbSet; + sal_uInt16 mnIndex; + sal_Bool mbSet; - BOOL operator<( const ImplColorSet& rSet ) const; - BOOL operator>( const ImplColorSet& rSet ) const; + sal_Bool operator<( const ImplColorSet& rSet ) const; + sal_Bool operator>( const ImplColorSet& rSet ) const; }; // ---------------------------------------------------------------------------- -inline BOOL ImplColorSet::operator<( const ImplColorSet& rSet ) const +inline sal_Bool ImplColorSet::operator<( const ImplColorSet& rSet ) const { return( mbSet && ( !rSet.mbSet || ( maColor.GetLuminance() > rSet.maColor.GetLuminance() ) ) ); } // ---------------------------------------------------------------------------- -inline BOOL ImplColorSet::operator>( const ImplColorSet& rSet ) const +inline sal_Bool ImplColorSet::operator>( const ImplColorSet& rSet ) const { return( !mbSet || ( rSet.mbSet && maColor.GetLuminance() < rSet.maColor.GetLuminance() ) ); } @@ -141,8 +141,8 @@ extern "C" int __LOADONCALLAPI ImplColorSetCmpFnc( const void* p1, const void* p if( pSet1->mbSet && pSet2->mbSet ) { - const BYTE cLum1 = pSet1->maColor.GetLuminance(); - const BYTE cLum2 = pSet2->maColor.GetLuminance(); + const sal_uInt8 cLum1 = pSet1->maColor.GetLuminance(); + const sal_uInt8 cLum2 = pSet2->maColor.GetLuminance(); nRet = ( ( cLum1 > cLum2 ) ? -1 : ( ( cLum1 == cLum2 ) ? 0 : 1 ) ); } else if( pSet1->mbSet ) @@ -162,21 +162,21 @@ extern "C" int __LOADONCALLAPI ImplColorSetCmpFnc( const void* p1, const void* p class ImplPointArray { Point* mpArray; - ULONG mnSize; - ULONG mnRealSize; + sal_uLong mnSize; + sal_uLong mnRealSize; public: ImplPointArray(); ~ImplPointArray(); - void ImplSetSize( ULONG nSize ); + void ImplSetSize( sal_uLong nSize ); - ULONG ImplGetRealSize() const { return mnRealSize; } - void ImplSetRealSize( ULONG nRealSize ) { mnRealSize = nRealSize; } + sal_uLong ImplGetRealSize() const { return mnRealSize; } + void ImplSetRealSize( sal_uLong nRealSize ) { mnRealSize = nRealSize; } - inline Point& operator[]( ULONG nPos ); - inline const Point& operator[]( ULONG nPos ) const; + inline Point& operator[]( sal_uLong nPos ); + inline const Point& operator[]( sal_uLong nPos ) const; void ImplCreatePoly( Polygon& rPoly ) const; }; @@ -201,9 +201,9 @@ ImplPointArray::~ImplPointArray() // ----------------------------------------------------------------------------- -void ImplPointArray::ImplSetSize( ULONG nSize ) +void ImplPointArray::ImplSetSize( sal_uLong nSize ) { - const ULONG nTotal = nSize * sizeof( Point ); + const sal_uLong nTotal = nSize * sizeof( Point ); mnSize = nSize; mnRealSize = 0UL; @@ -217,7 +217,7 @@ void ImplPointArray::ImplSetSize( ULONG nSize ) // ----------------------------------------------------------------------------- -inline Point& ImplPointArray::operator[]( ULONG nPos ) +inline Point& ImplPointArray::operator[]( sal_uLong nPos ) { DBG_ASSERT( nPos < mnSize, "ImplPointArray::operator[]: nPos out of range!" ); return mpArray[ nPos ]; @@ -225,7 +225,7 @@ inline Point& ImplPointArray::operator[]( ULONG nPos ) // ----------------------------------------------------------------------------- -inline const Point& ImplPointArray::operator[]( ULONG nPos ) const +inline const Point& ImplPointArray::operator[]( sal_uLong nPos ) const { DBG_ASSERT( nPos < mnSize, "ImplPointArray::operator[]: nPos out of range!" ); return mpArray[ nPos ]; @@ -235,7 +235,7 @@ inline const Point& ImplPointArray::operator[]( ULONG nPos ) const void ImplPointArray::ImplCreatePoly( Polygon& rPoly ) const { - rPoly = Polygon( sal::static_int_cast<USHORT>(mnRealSize), mpArray ); + rPoly = Polygon( sal::static_int_cast<sal_uInt16>(mnRealSize), mpArray ); } // --------------- @@ -261,12 +261,12 @@ public: inline long Width() const { return mnWidth; } inline long Height() const { return mnHeight; } - inline void Set( long nY, long nX, BYTE cVal ); - inline BYTE Get( long nY, long nX ) const; + inline void Set( long nY, long nX, sal_uInt8 cVal ); + inline sal_uInt8 Get( long nY, long nX ) const; - inline BOOL IsFree( long nY, long nX ) const; - inline BOOL IsCont( long nY, long nX ) const; - inline BOOL IsDone( long nY, long nX ) const; + inline sal_Bool IsFree( long nY, long nX ) const; + inline sal_Bool IsCont( long nY, long nX ) const; + inline sal_Bool IsDone( long nY, long nX ) const; }; @@ -298,36 +298,36 @@ ImplVectMap::~ImplVectMap() // ----------------------------------------------------------------------------- -inline void ImplVectMap::Set( long nY, long nX, BYTE cVal ) +inline void ImplVectMap::Set( long nY, long nX, sal_uInt8 cVal ) { - const BYTE cShift = sal::static_int_cast<BYTE>(6 - ( ( nX & 3 ) << 1 )); + const sal_uInt8 cShift = sal::static_int_cast<sal_uInt8>(6 - ( ( nX & 3 ) << 1 )); ( ( mpScan[ nY ][ nX >> 2 ] ) &= ~( 3 << cShift ) ) |= ( cVal << cShift ); } // ----------------------------------------------------------------------------- -inline BYTE ImplVectMap::Get( long nY, long nX ) const +inline sal_uInt8 ImplVectMap::Get( long nY, long nX ) const { - return sal::static_int_cast<BYTE>( ( ( mpScan[ nY ][ nX >> 2 ] ) >> ( 6 - ( ( nX & 3 ) << 1 ) ) ) & 3 ); + return sal::static_int_cast<sal_uInt8>( ( ( mpScan[ nY ][ nX >> 2 ] ) >> ( 6 - ( ( nX & 3 ) << 1 ) ) ) & 3 ); } // ----------------------------------------------------------------------------- -inline BOOL ImplVectMap::IsFree( long nY, long nX ) const +inline sal_Bool ImplVectMap::IsFree( long nY, long nX ) const { return( VECT_FREE_INDEX == Get( nY, nX ) ); } // ----------------------------------------------------------------------------- -inline BOOL ImplVectMap::IsCont( long nY, long nX ) const +inline sal_Bool ImplVectMap::IsCont( long nY, long nX ) const { return( VECT_CONT_INDEX == Get( nY, nX ) ); } // ----------------------------------------------------------------------------- -inline BOOL ImplVectMap::IsDone( long nY, long nX ) const +inline sal_Bool ImplVectMap::IsDone( long nY, long nX ) const { return( VECT_DONE_INDEX == Get( nY, nX ) ); } @@ -342,10 +342,10 @@ private: Polygon maPoly; Point maStartPt; - ULONG mnArraySize; - ULONG mnCount; + sal_uLong mnArraySize; + sal_uLong mnCount; long mnResize; - BYTE* mpCodes; + sal_uInt8* mpCodes; void ImplGetSpace(); @@ -356,25 +356,25 @@ private: public: - ImplChain( ULONG nInitCount = 1024UL, long nResize = -1L ); + ImplChain( sal_uLong nInitCount = 1024UL, long nResize = -1L ); ~ImplChain(); void ImplBeginAdd( const Point& rStartPt ); - inline void ImplAdd( BYTE nCode ); - void ImplEndAdd( ULONG nTypeFlag ); + inline void ImplAdd( sal_uInt8 nCode ); + void ImplEndAdd( sal_uLong nTypeFlag ); const Polygon& ImplGetPoly() { return maPoly; } }; // ----------------------------------------------------------------------------- -ImplChain::ImplChain( ULONG nInitCount, long nResize ) : +ImplChain::ImplChain( sal_uLong nInitCount, long nResize ) : mnArraySize ( nInitCount ), mnCount ( 0UL ), mnResize ( nResize ) { DBG_ASSERT( nInitCount && nResize, "ImplChain::ImplChain(): invalid parameters!" ); - mpCodes = new BYTE[ mnArraySize ]; + mpCodes = new sal_uInt8[ mnArraySize ]; } // ----------------------------------------------------------------------------- @@ -388,11 +388,11 @@ ImplChain::~ImplChain() void ImplChain::ImplGetSpace() { - const ULONG nOldArraySize = mnArraySize; - BYTE* pNewCodes; + const sal_uLong nOldArraySize = mnArraySize; + sal_uInt8* pNewCodes; - mnArraySize = ( mnResize < 0L ) ? ( mnArraySize << 1UL ) : ( mnArraySize + (ULONG) mnResize ); - pNewCodes = new BYTE[ mnArraySize ]; + mnArraySize = ( mnResize < 0L ) ? ( mnArraySize << 1UL ) : ( mnArraySize + (sal_uLong) mnResize ); + pNewCodes = new sal_uInt8[ mnArraySize ]; memcpy( pNewCodes, mpCodes, nOldArraySize ); delete[] mpCodes; mpCodes = pNewCodes; @@ -409,7 +409,7 @@ void ImplChain::ImplBeginAdd( const Point& rStartPt ) // ----------------------------------------------------------------------------- -inline void ImplChain::ImplAdd( BYTE nCode ) +inline void ImplChain::ImplAdd( sal_uInt8 nCode ) { if( mnCount == mnArraySize ) ImplGetSpace(); @@ -419,7 +419,7 @@ inline void ImplChain::ImplAdd( BYTE nCode ) // ----------------------------------------------------------------------------- -void ImplChain::ImplEndAdd( ULONG nFlag ) +void ImplChain::ImplEndAdd( sal_uLong nFlag ) { if( mnCount ) { @@ -434,15 +434,15 @@ void ImplChain::ImplEndAdd( ULONG nFlag ) nFirstY = nLastY = maStartPt.Y(); aArr.ImplSetSize( mnCount << 1 ); - USHORT i, nPolyPos; + sal_uInt16 i, nPolyPos; for( i = 0, nPolyPos = 0; i < ( mnCount - 1 ); i++ ) { - const BYTE cMove = mpCodes[ i ]; - const BYTE cNextMove = mpCodes[ i + 1 ]; + const sal_uInt8 cMove = mpCodes[ i ]; + const sal_uInt8 cNextMove = mpCodes[ i + 1 ]; const ChainMove& rMove = aImplMove[ cMove ]; const ChainMove& rMoveInner = aImplMoveInner[ cMove ]; // Point& rPt = aArr[ nPolyPos ]; - BOOL bDone = TRUE; + sal_Bool bDone = sal_True; nLastX += rMove.nDX; nLastY += rMove.nDY; @@ -500,7 +500,7 @@ void ImplChain::ImplEndAdd( ULONG nFlag ) aArr[ nPolyPos++ ].Y() = nLastY - 1; } else - bDone = FALSE; + bDone = sal_False; } else if( cMove == 7 && cNextMove == 0 ) { @@ -519,7 +519,7 @@ void ImplChain::ImplEndAdd( ULONG nFlag ) aArr[ nPolyPos++ ].Y() = nLastY; } else - bDone = FALSE; + bDone = sal_False; if( !bDone ) { @@ -541,15 +541,15 @@ void ImplChain::ImplEndAdd( ULONG nFlag ) nFirstY = nLastY = maStartPt.Y(); aArr.ImplSetSize( mnCount << 1 ); - USHORT i, nPolyPos; + sal_uInt16 i, nPolyPos; for( i = 0, nPolyPos = 0; i < ( mnCount - 1 ); i++ ) { - const BYTE cMove = mpCodes[ i ]; - const BYTE cNextMove = mpCodes[ i + 1 ]; + const sal_uInt8 cMove = mpCodes[ i ]; + const sal_uInt8 cNextMove = mpCodes[ i + 1 ]; const ChainMove& rMove = aImplMove[ cMove ]; const ChainMove& rMoveOuter = aImplMoveOuter[ cMove ]; // Point& rPt = aArr[ nPolyPos ]; - BOOL bDone = TRUE; + sal_Bool bDone = sal_True; nLastX += rMove.nDX; nLastY += rMove.nDY; @@ -607,7 +607,7 @@ void ImplChain::ImplEndAdd( ULONG nFlag ) aArr[ nPolyPos++ ].Y() = nLastY - 1; } else - bDone = FALSE; + bDone = sal_False; } else if( cMove == 7 && cNextMove == 3 ) { @@ -626,7 +626,7 @@ void ImplChain::ImplEndAdd( ULONG nFlag ) aArr[ nPolyPos++ ].Y() = nLastY + 1; } else - bDone = FALSE; + bDone = sal_False; if( !bDone ) { @@ -646,7 +646,7 @@ void ImplChain::ImplEndAdd( ULONG nFlag ) aArr.ImplSetSize( mnCount + 1 ); aArr[ 0 ] = Point( nLastX, nLastY ); - for( ULONG i = 0; i < mnCount; ) + for( sal_uLong i = 0; i < mnCount; ) { const ChainMove& rMove = aImplMove[ mpCodes[ i ] ]; aArr[ ++i ] = Point( nLastX += rMove.nDX, nLastY += rMove.nDY ); @@ -669,9 +669,9 @@ void ImplChain::ImplPostProcess( const ImplPointArray& rArr ) ImplPointArray aNewArr2; Point* pLast; Point* pLeast; - ULONG nNewPos; - ULONG nCount = rArr.ImplGetRealSize(); - ULONG n; + sal_uLong nNewPos; + sal_uLong nCount = rArr.ImplGetRealSize(); + sal_uLong n; // pass 1 aNewArr1.ImplSetSize( nCount ); @@ -738,10 +738,10 @@ ImplVectorizer::~ImplVectorizer() // ----------------------------------------------------------------------------- -BOOL ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, - BYTE cReduce, ULONG nFlags, const Link* pProgress ) +sal_Bool ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, + sal_uInt8 cReduce, sal_uLong nFlags, const Link* pProgress ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; VECT_PROGRESS( pProgress, 0 ); @@ -755,9 +755,9 @@ BOOL ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, double fPercentStep_2 = 0.0; const long nWidth = pRAcc->Width(); const long nHeight = pRAcc->Height(); - const USHORT nColorCount = pRAcc->GetPaletteEntryCount(); - USHORT n; - ImplColorSet* pColorSet = (ImplColorSet*) new BYTE[ 256 * sizeof( ImplColorSet ) ]; + const sal_uInt16 nColorCount = pRAcc->GetPaletteEntryCount(); + sal_uInt16 n; + ImplColorSet* pColorSet = (ImplColorSet*) new sal_uInt8[ 256 * sizeof( ImplColorSet ) ]; memset( pColorSet, 0, 256 * sizeof( ImplColorSet ) ); rMtf.Clear(); @@ -784,11 +784,11 @@ BOOL ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, VECT_PROGRESS( pProgress, FRound( fPercent += 10.0 ) ); - for( USHORT i = 0; i < n; i++ ) + for( sal_uInt16 i = 0; i < n; i++ ) { const BitmapColor aBmpCol( pRAcc->GetPaletteColor( pColorSet[ i ].mnIndex ) ); const Color aFindColor( aBmpCol.GetRed(), aBmpCol.GetGreen(), aBmpCol.GetBlue() ); -// const BYTE cLum = aFindColor.GetLuminance(); +// const sal_uInt8 cLum = aFindColor.GetLuminance(); ImplVectMap* pMap = ImplExpand( pRAcc, aFindColor ); VECT_PROGRESS( pProgress, FRound( fPercent += fPercentStep_2 ) ); @@ -808,8 +808,8 @@ BOOL ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, if( aPolyPoly.Count() ) { - rMtf.AddAction( new MetaLineColorAction( aFindColor, TRUE ) ); - rMtf.AddAction( new MetaFillColorAction( aFindColor, TRUE ) ); + rMtf.AddAction( new MetaLineColorAction( aFindColor, sal_True ) ); + rMtf.AddAction( new MetaFillColorAction( aFindColor, sal_True ) ); rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) ); } } @@ -818,7 +818,7 @@ BOOL ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, VECT_PROGRESS( pProgress, FRound( fPercent += fPercentStep_2 ) ); } - delete[] (BYTE*) pColorSet; + delete[] (sal_uInt8*) pColorSet; if( rMtf.GetActionCount() ) { @@ -830,7 +830,7 @@ BOOL ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, rMtf.SetPrefSize( Size( nWidth + 2, nHeight + 2 ) ); rMtf.Move( 1, 1 ); rMtf.Scale( aLogSize1.Width(), aLogSize1.Height() ); - bRet = TRUE; + bRet = sal_True; } } @@ -843,14 +843,14 @@ BOOL ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, // ----------------------------------------------------------------------------- -BOOL ImplVectorizer::ImplVectorize( const Bitmap& rMonoBmp, +sal_Bool ImplVectorizer::ImplVectorize( const Bitmap& rMonoBmp, PolyPolygon& rPolyPoly, - ULONG nFlags, const Link* pProgress ) + sal_uLong nFlags, const Link* pProgress ) { Bitmap* pBmp = new Bitmap( rMonoBmp ); BitmapReadAccess* pRAcc; ImplVectMap* pMap; - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; VECT_PROGRESS( pProgress, 10 ); @@ -924,13 +924,13 @@ BOOL ImplVectorizer::ImplVectorize( const Bitmap& rMonoBmp, // put outmost polygon to the front if( nFirstPoly > 0 ) { - const Polygon aFirst( rPolyPoly.GetObject( static_cast< USHORT >( nFirstPoly ) ) ); + const Polygon aFirst( rPolyPoly.GetObject( static_cast< sal_uInt16 >( nFirstPoly ) ) ); - rPolyPoly.Remove( static_cast< USHORT >( nFirstPoly ) ); + rPolyPoly.Remove( static_cast< sal_uInt16 >( nFirstPoly ) ); rPolyPoly.Insert( aFirst, 0 ); } - bRet = TRUE; + bRet = sal_True; } VECT_PROGRESS( pProgress, 100 ); @@ -946,14 +946,14 @@ void ImplVectorizer::ImplLimitPolyPoly( PolyPolygon& rPolyPoly ) { PolyPolygon aNewPolyPoly; long nReduce = 0; - USHORT nNewCount; + sal_uInt16 nNewCount; do { aNewPolyPoly.Clear(); nReduce++; - for( USHORT i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ ) + for( sal_uInt16 i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ ) { const Rectangle aBound( rPolyPoly[ i ].GetBoundRect() ); @@ -1067,14 +1067,14 @@ ImplVectMap* ImplVectorizer::ImplExpand( BitmapReadAccess* pRAcc, const Color& r // ----------------------------------------------------------------------------- -void ImplVectorizer::ImplCalculate( ImplVectMap* pMap, PolyPolygon& rPolyPoly, BYTE cReduce, ULONG nFlags ) +void ImplVectorizer::ImplCalculate( ImplVectMap* pMap, PolyPolygon& rPolyPoly, sal_uInt8 cReduce, sal_uLong nFlags ) { const long nWidth = pMap->Width(), nHeight= pMap->Height(); for( long nY = 0L; nY < nHeight; nY++ ) { long nX = 0L; - BOOL bInner = TRUE; + sal_Bool bInner = sal_True; while( nX < nWidth ) { @@ -1136,15 +1136,15 @@ void ImplVectorizer::ImplCalculate( ImplVectMap* pMap, PolyPolygon& rPolyPoly, B // ----------------------------------------------------------------------------- -BOOL ImplVectorizer::ImplGetChain( ImplVectMap* pMap, const Point& rStartPt, ImplChain& rChain ) +sal_Bool ImplVectorizer::ImplGetChain( ImplVectMap* pMap, const Point& rStartPt, ImplChain& rChain ) { long nActX = rStartPt.X(); long nActY = rStartPt.Y(); long nTryX; long nTryY; - ULONG nFound; - ULONG nLastDir = 0UL; - ULONG nDir; + sal_uLong nFound; + sal_uLong nLastDir = 0UL; + sal_uLong nDir; do { @@ -1156,7 +1156,7 @@ BOOL ImplVectorizer::ImplGetChain( ImplVectMap* pMap, const Point& rStartPt, Im if( pMap->IsCont( nTryY, nTryX ) ) { - rChain.ImplAdd( (BYTE) nLastDir ); + rChain.ImplAdd( (sal_uInt8) nLastDir ); pMap->Set( nActY = nTryY, nActX = nTryX, VECT_DONE_INDEX ); nFound = 1UL; } @@ -1173,7 +1173,7 @@ BOOL ImplVectorizer::ImplGetChain( ImplVectMap* pMap, const Point& rStartPt, Im if( pMap->IsCont( nTryY, nTryX ) ) { - rChain.ImplAdd( (BYTE) nDir ); + rChain.ImplAdd( (sal_uInt8) nDir ); pMap->Set( nActY = nTryY, nActX = nTryX, VECT_DONE_INDEX ); nFound = 1UL; nLastDir = nDir; @@ -1185,21 +1185,21 @@ BOOL ImplVectorizer::ImplGetChain( ImplVectMap* pMap, const Point& rStartPt, Im } while( nFound ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------------- -BOOL ImplVectorizer::ImplIsUp( ImplVectMap* pMap, long nY, long nX ) const +sal_Bool ImplVectorizer::ImplIsUp( ImplVectMap* pMap, long nY, long nX ) const { if( pMap->IsDone( nY - 1L, nX ) ) - return TRUE; + return sal_True; else if( pMap->IsDone( nY + 1L, nX ) ) - return FALSE; + return sal_False; else if( pMap->IsDone( nY - 1L, nX - 1L ) || pMap->IsDone( nY - 1L, nX + 1L ) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/impvect.hxx b/vcl/source/gdi/impvect.hxx index cf81e1799494..56591e969b8b 100644 --- a/vcl/source/gdi/impvect.hxx +++ b/vcl/source/gdi/impvect.hxx @@ -45,9 +45,9 @@ class ImplVectorizer private: ImplVectMap* ImplExpand( BitmapReadAccess* pRAcc, const Color& rColor ); - void ImplCalculate( ImplVectMap* pMap, PolyPolygon& rPolyPoly, BYTE cReduce, ULONG nFlags ); - BOOL ImplGetChain( ImplVectMap* pMap, const Point& rStartPt, ImplChain& rChain ); - BOOL ImplIsUp( ImplVectMap* pMap, long nY, long nX ) const; + void ImplCalculate( ImplVectMap* pMap, PolyPolygon& rPolyPoly, sal_uInt8 cReduce, sal_uLong nFlags ); + sal_Bool ImplGetChain( ImplVectMap* pMap, const Point& rStartPt, ImplChain& rChain ); + sal_Bool ImplIsUp( ImplVectMap* pMap, long nY, long nX ) const; void ImplLimitPolyPoly( PolyPolygon& rPolyPoly ); public: @@ -55,10 +55,10 @@ public: ImplVectorizer(); ~ImplVectorizer(); - BOOL ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, - BYTE cReduce, ULONG nFlags, const Link* pProgress ); - BOOL ImplVectorize( const Bitmap& rMonoBmp, PolyPolygon& rPolyPoly, - ULONG nFlags, const Link* pProgress ); + sal_Bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, + sal_uInt8 cReduce, sal_uLong nFlags, const Link* pProgress ); + sal_Bool ImplVectorize( const Bitmap& rMonoBmp, PolyPolygon& rPolyPoly, + sal_uLong nFlags, const Link* pProgress ); }; #endif diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index 56b9c27b7048..34cd27b270cd 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -39,8 +39,8 @@ DBG_NAME( JobSetup ) #define JOBSET_FILEFORMAT2 3780 -#define JOBSET_FILE364_SYSTEM ((USHORT)0xFFFF) -#define JOBSET_FILE605_SYSTEM ((USHORT)0xFFFE) +#define JOBSET_FILE364_SYSTEM ((sal_uInt16)0xFFFF) +#define JOBSET_FILE605_SYSTEM ((sal_uInt16)0xFFFE) struct ImplOldJobSetupData { @@ -95,7 +95,7 @@ ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) : mnDriverDataLen = rJobSetup.mnDriverDataLen; if ( rJobSetup.mpDriverData ) { - mpDriverData = (BYTE*)rtl_allocateMemory( mnDriverDataLen ); + mpDriverData = (sal_uInt8*)rtl_allocateMemory( mnDriverDataLen ); memcpy( mpDriverData, rJobSetup.mpDriverData, mnDriverDataLen ); } else @@ -258,16 +258,16 @@ JobSetup& JobSetup::operator=( const JobSetup& rJobSetup ) // ----------------------------------------------------------------------- -BOOL JobSetup::operator==( const JobSetup& rJobSetup ) const +sal_Bool JobSetup::operator==( const JobSetup& rJobSetup ) const { DBG_CHKTHIS( JobSetup, NULL ); DBG_CHKOBJ( &rJobSetup, JobSetup, NULL ); if ( mpData == rJobSetup.mpData ) - return TRUE; + return sal_True; if ( !mpData || !rJobSetup.mpData ) - return FALSE; + return sal_False; ImplJobSetup* pData1 = mpData; ImplJobSetup* pData2 = rJobSetup.mpData; @@ -284,9 +284,9 @@ BOOL JobSetup::operator==( const JobSetup& rJobSetup ) const (memcmp( pData1->mpDriverData, pData2->mpDriverData, pData1->mnDriverDataLen ) == 0) && (pData1->maValueMap == pData2->maValueMap) ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -296,8 +296,8 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup ) DBG_ASSERTWARNING( rIStream.GetVersion(), "JobSetup::>> - Solar-Version not set on rOStream" ); { - USHORT nLen(0); - USHORT nSystem; + sal_uInt16 nLen(0); + sal_uInt16 nSystem; sal_Size nFirstPos = rIStream.Tell(); rIStream >> nLen; if ( !nLen ) @@ -330,7 +330,7 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup ) nSystem == JOBSET_FILE605_SYSTEM ) { Impl364JobSetupData* pOldJobData = (Impl364JobSetupData*)(pTempBuf + sizeof( ImplOldJobSetupData )); - USHORT nOldJobDataSize = SVBT16ToShort( pOldJobData->nSize ); + sal_uInt16 nOldJobDataSize = SVBT16ToShort( pOldJobData->nSize ); pJobData->mnSystem = SVBT16ToShort( pOldJobData->nSystem ); pJobData->mnDriverDataLen = SVBT32ToUInt32( pOldJobData->nDriverDataLen ); pJobData->meOrientation = (Orientation)SVBT16ToShort( pOldJobData->nOrientation ); @@ -341,8 +341,8 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup ) pJobData->mnPaperHeight = (long)SVBT32ToUInt32( pOldJobData->nPaperHeight ); if ( pJobData->mnDriverDataLen ) { - BYTE* pDriverData = ((BYTE*)pOldJobData) + nOldJobDataSize; - pJobData->mpDriverData = (BYTE*)rtl_allocateMemory( pJobData->mnDriverDataLen ); + sal_uInt8* pDriverData = ((sal_uInt8*)pOldJobData) + nOldJobDataSize; + pJobData->mpDriverData = (sal_uInt8*)rtl_allocateMemory( pJobData->mnDriverDataLen ); memcpy( pJobData->mpDriverData, pDriverData, pJobData->mnDriverDataLen ); } if( nSystem == JOBSET_FILE605_SYSTEM ) @@ -388,24 +388,24 @@ SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup ) // Zur Zeit haben wir noch kein neues FileFormat // if ( rOStream.GetVersion() < JOBSET_FILEFORMAT2 ) { - USHORT nLen = 0; + sal_uInt16 nLen = 0; if ( !rJobSetup.mpData ) rOStream << nLen; else { - USHORT nSystem = JOBSET_FILE605_SYSTEM; + sal_uInt16 nSystem = JOBSET_FILE605_SYSTEM; const ImplJobSetup* pJobData = rJobSetup.ImplGetConstData(); Impl364JobSetupData aOldJobData; - USHORT nOldJobDataSize = sizeof( aOldJobData ); + sal_uInt16 nOldJobDataSize = sizeof( aOldJobData ); ShortToSVBT16( nOldJobDataSize, aOldJobData.nSize ); ShortToSVBT16( pJobData->mnSystem, aOldJobData.nSystem ); UInt32ToSVBT32( pJobData->mnDriverDataLen, aOldJobData.nDriverDataLen ); - ShortToSVBT16( (USHORT)(pJobData->meOrientation), aOldJobData.nOrientation ); + ShortToSVBT16( (sal_uInt16)(pJobData->meOrientation), aOldJobData.nOrientation ); ShortToSVBT16( pJobData->mnPaperBin, aOldJobData.nPaperBin ); - ShortToSVBT16( (USHORT)(pJobData->mePaperFormat), aOldJobData.nPaperFormat ); - UInt32ToSVBT32( (ULONG)(pJobData->mnPaperWidth), aOldJobData.nPaperWidth ); - UInt32ToSVBT32( (ULONG)(pJobData->mnPaperHeight), aOldJobData.nPaperHeight ); + ShortToSVBT16( (sal_uInt16)(pJobData->mePaperFormat), aOldJobData.nPaperFormat ); + UInt32ToSVBT32( (sal_uLong)(pJobData->mnPaperWidth), aOldJobData.nPaperWidth ); + UInt32ToSVBT32( (sal_uLong)(pJobData->mnPaperHeight), aOldJobData.nPaperHeight ); ImplOldJobSetupData aOldData; memset( &aOldData, 0, sizeof( aOldData ) ); @@ -434,7 +434,7 @@ SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup ) case DUPLEX_SHORTEDGE: rOStream.WriteByteString( "DUPLEX_SHORTEDGE" );break; case DUPLEX_LONGEDGE: rOStream.WriteByteString( "DUPLEX_LONGEDGE" );break; } - nLen = sal::static_int_cast<USHORT>(rOStream.Tell() - nPos); + nLen = sal::static_int_cast<sal_uInt16>(rOStream.Tell() - nPos); rOStream.Seek( nPos ); rOStream << nLen; rOStream.Seek( nPos + nLen ); diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx index 8b97c2ecdbff..542c3103eb27 100644 --- a/vcl/source/gdi/lineinfo.cxx +++ b/vcl/source/gdi/lineinfo.cxx @@ -71,6 +71,20 @@ ImplLineInfo::ImplLineInfo( const ImplLineInfo& rImplLineInfo ) : { } +// ----------------------------------------------------------------------- + +inline bool ImplLineInfo::operator==( const ImplLineInfo& rB ) const +{ + return(meStyle == rB.meStyle + && mnWidth == rB.mnWidth + && mnDashCount == rB.mnDashCount + && mnDashLen == rB.mnDashLen + && mnDotCount == rB.mnDotCount + && mnDotLen == rB.mnDotLen + && mnDistance == rB.mnDistance + && meLineJoin == rB.meLineJoin); +} + // ------------ // - LineInfo - // ------------ @@ -120,19 +134,13 @@ LineInfo& LineInfo::operator=( const LineInfo& rLineInfo ) // ----------------------------------------------------------------------- -BOOL LineInfo::operator==( const LineInfo& rLineInfo ) const +sal_Bool LineInfo::operator==( const LineInfo& rLineInfo ) const { DBG_CHKTHIS( LineInfo, NULL ); DBG_CHKOBJ( &rLineInfo, LineInfo, NULL ); return( mpImplLineInfo == rLineInfo.mpImplLineInfo || - ( mpImplLineInfo->meStyle == rLineInfo.mpImplLineInfo->meStyle && - mpImplLineInfo->mnWidth == rLineInfo.mpImplLineInfo->mnWidth && - mpImplLineInfo->mnDashCount == rLineInfo.mpImplLineInfo->mnDashCount && - mpImplLineInfo->mnDashLen == rLineInfo.mpImplLineInfo->mnDashLen && - mpImplLineInfo->mnDotCount == rLineInfo.mpImplLineInfo->mnDotCount && - mpImplLineInfo->mnDotLen == rLineInfo.mpImplLineInfo->mnDotLen && - mpImplLineInfo->mnDistance == rLineInfo.mpImplLineInfo->mnDistance ) ); + *mpImplLineInfo == *rLineInfo.mpImplLineInfo ); } // ----------------------------------------------------------------------- @@ -168,7 +176,7 @@ void LineInfo::SetWidth( long nWidth ) // ----------------------------------------------------------------------- -void LineInfo::SetDashCount( USHORT nDashCount ) +void LineInfo::SetDashCount( sal_uInt16 nDashCount ) { DBG_CHKTHIS( LineInfo, NULL ); ImplMakeUnique(); @@ -186,7 +194,7 @@ void LineInfo::SetDashLen( long nDashLen ) // ----------------------------------------------------------------------- -void LineInfo::SetDotCount( USHORT nDotCount ) +void LineInfo::SetDotCount( sal_uInt16 nDotCount ) { DBG_CHKTHIS( LineInfo, NULL ); ImplMakeUnique(); @@ -229,7 +237,7 @@ void LineInfo::SetLineJoin(basegfx::B2DLineJoin eLineJoin) SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo ) { VersionCompat aCompat( rIStm, STREAM_READ ); - UINT16 nTmp16; + sal_uInt16 nTmp16; rIStm >> nTmp16; rImplLineInfo.meStyle = (LineStyle) nTmp16; rIStm >> rImplLineInfo.mnWidth; @@ -258,7 +266,7 @@ SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo ) VersionCompat aCompat( rOStm, STREAM_WRITE, 3 ); // version 1 - rOStm << (UINT16) rImplLineInfo.meStyle << rImplLineInfo.mnWidth; + rOStm << (sal_uInt16) rImplLineInfo.meStyle << rImplLineInfo.mnWidth; // since version2 rOStm << rImplLineInfo.mnDashCount << rImplLineInfo.mnDashLen; @@ -266,7 +274,7 @@ SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo ) rOStm << rImplLineInfo.mnDistance; // since version3 - rOStm << (UINT16) rImplLineInfo.meLineJoin; + rOStm << (sal_uInt16) rImplLineInfo.meLineJoin; return rOStm; } diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index 451d446a86b7..c530c0148783 100644..100755 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -85,6 +85,7 @@ EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ $(SLO)$/pdffontcache.obj\ $(SLO)$/pdfwriter.obj \ $(SLO)$/pdfwriter_impl.obj \ + $(SLO)$/pdfwriter_impl2.obj \ $(SLO)$/pngread.obj \ $(SLO)$/pngwrite.obj \ $(SLO)$/print.obj \ diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx index 31486c1aad05..ae7b13ca25b7 100644 --- a/vcl/source/gdi/mapmod.cxx +++ b/vcl/source/gdi/mapmod.cxx @@ -46,7 +46,7 @@ ImplMapMode::ImplMapMode() : { mnRefCount = 1; meUnit = MAP_PIXEL; - mbSimple = FALSE; + mbSimple = sal_False; } // ----------------------------------------------------------------------- @@ -58,7 +58,7 @@ ImplMapMode::ImplMapMode( const ImplMapMode& rImplMapMode ) : { mnRefCount = 1; meUnit = rImplMapMode.meUnit; - mbSimple = FALSE; + mbSimple = sal_False; } // ----------------------------------------------------------------------- @@ -66,7 +66,7 @@ ImplMapMode::ImplMapMode( const ImplMapMode& rImplMapMode ) : SvStream& operator>>( SvStream& rIStm, ImplMapMode& rImplMapMode ) { VersionCompat aCompat( rIStm, STREAM_READ ); - UINT16 nTmp16; + sal_uInt16 nTmp16; rIStm >> nTmp16; rImplMapMode.meUnit = (MapUnit) nTmp16; rIStm >> rImplMapMode.maOrigin >> rImplMapMode.maScaleX >> @@ -81,7 +81,7 @@ SvStream& operator<<( SvStream& rOStm, const ImplMapMode& rImplMapMode ) { VersionCompat aCompat( rOStm, STREAM_WRITE, 1 ); - rOStm << (UINT16) rImplMapMode.meUnit << + rOStm << (sal_uInt16) rImplMapMode.meUnit << rImplMapMode.maOrigin << rImplMapMode.maScaleX << rImplMapMode.maScaleY << @@ -107,7 +107,7 @@ ImplMapMode* ImplMapMode::ImplGetStaticMapMode( MapUnit eUnit ) pImplMapMode->maScaleX = aDefFraction; pImplMapMode->maScaleY = aDefFraction; pImplMapMode->meUnit = eUnit; - pImplMapMode->mbSimple = TRUE; + pImplMapMode->mbSimple = sal_True; } return pImplMapMode; @@ -260,40 +260,40 @@ MapMode& MapMode::operator=( const MapMode& rMapMode ) // ----------------------------------------------------------------------- -BOOL MapMode::operator==( const MapMode& rMapMode ) const +sal_Bool MapMode::operator==( const MapMode& rMapMode ) const { DBG_CHKTHIS( MapMode, NULL ); DBG_CHKOBJ( &rMapMode, MapMode, NULL ); if ( mpImplMapMode == rMapMode.mpImplMapMode ) - return TRUE; + return sal_True; if ( (mpImplMapMode->meUnit == rMapMode.mpImplMapMode->meUnit) && (mpImplMapMode->maOrigin == rMapMode.mpImplMapMode->maOrigin) && (mpImplMapMode->maScaleX == rMapMode.mpImplMapMode->maScaleX) && (mpImplMapMode->maScaleY == rMapMode.mpImplMapMode->maScaleY) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL MapMode::IsDefault() const +sal_Bool MapMode::IsDefault() const { DBG_CHKTHIS( MapMode, NULL ); ImplMapMode* pDefMapMode = ImplMapMode::ImplGetStaticMapMode( MAP_PIXEL ); if ( mpImplMapMode == pDefMapMode ) - return TRUE; + return sal_True; if ( (mpImplMapMode->meUnit == pDefMapMode->meUnit) && (mpImplMapMode->maOrigin == pDefMapMode->maOrigin) && (mpImplMapMode->maScaleX == pDefMapMode->maScaleX) && (mpImplMapMode->maScaleY == pDefMapMode->maScaleY) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 6f9d1a85e510..feba437c7c2f 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -66,7 +66,7 @@ inline void ImplScaleRect( Rectangle& rRect, double fScaleX, double fScaleY ) inline void ImplScalePoly( Polygon& rPoly, double fScaleX, double fScaleY ) { - for( USHORT i = 0, nCount = rPoly.GetSize(); i < nCount; i++ ) + for( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ ) ImplScalePoint( rPoly[ i ], fScaleX, fScaleY ); } @@ -103,7 +103,7 @@ MetaAction::MetaAction() : // ------------------------------------------------------------------------ -MetaAction::MetaAction( USHORT nType ) : +MetaAction::MetaAction( sal_uInt16 nType ) : mnRefCount( 1 ), mnType( nType ) { @@ -176,7 +176,7 @@ void MetaAction::Read( SvStream& rIStm, ImplMetaReadData* ) MetaAction* MetaAction::ReadMetaAction( SvStream& rIStm, ImplMetaReadData* pData ) { MetaAction* pAction = NULL; - UINT16 nType; + sal_uInt16 nType; rIStm >> nType; @@ -309,7 +309,7 @@ void MetaPixelAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); rOStm << maPt; - maColor.Write( rOStm, TRUE ); + maColor.Write( rOStm, sal_True ); } // ------------------------------------------------------------------------ @@ -318,7 +318,7 @@ void MetaPixelAction::Read( SvStream& rIStm, ImplMetaReadData* ) { COMPAT( rIStm ); rIStm >> maPt; - maColor.Read( rIStm, TRUE ); + maColor.Read( rIStm, sal_True ); } // ======================================================================== @@ -1133,7 +1133,7 @@ void MetaPolyPolygonAction::Move( long nHorzMove, long nVertMove ) void MetaPolyPolygonAction::Scale( double fScaleX, double fScaleY ) { - for( USHORT i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ ) + for( sal_uInt16 i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ ) ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY ); } @@ -1206,7 +1206,7 @@ IMPL_META_ACTION( Text, META_TEXT_ACTION ) // ------------------------------------------------------------------------ MetaTextAction::MetaTextAction( const Point& rPt, const XubString& rStr, - USHORT nIndex, USHORT nLen ) : + sal_uInt16 nIndex, sal_uInt16 nLen ) : MetaAction ( META_TEXT_ACTION ), maPt ( rPt ), maStr ( rStr ), @@ -1315,7 +1315,7 @@ MetaTextArrayAction::MetaTextArrayAction( const MetaTextArrayAction& rAction ) : { if( rAction.mpDXAry ) { - const ULONG nAryLen = mnLen; + const sal_uLong nAryLen = mnLen; mpDXAry = new sal_Int32[ nAryLen ]; memcpy( mpDXAry, rAction.mpDXAry, nAryLen * sizeof( sal_Int32 ) ); @@ -1329,15 +1329,15 @@ MetaTextArrayAction::MetaTextArrayAction( const MetaTextArrayAction& rAction ) : MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt, const XubString& rStr, const sal_Int32* pDXAry, - USHORT nIndex, - USHORT nLen ) : + sal_uInt16 nIndex, + sal_uInt16 nLen ) : MetaAction ( META_TEXTARRAY_ACTION ), maStartPt ( rStartPt ), maStr ( rStr ), mnIndex ( nIndex ), mnLen ( ( nLen == STRING_LEN ) ? rStr.Len() : nLen ) { - const ULONG nAryLen = pDXAry ? mnLen : 0; + const sal_uLong nAryLen = pDXAry ? mnLen : 0; if( nAryLen ) { @@ -1386,7 +1386,7 @@ void MetaTextArrayAction::Scale( double fScaleX, double fScaleY ) if ( mpDXAry && mnLen ) { - for ( USHORT i = 0, nCount = mnLen; i < nCount; i++ ) + for ( sal_uInt16 i = 0, nCount = mnLen; i < nCount; i++ ) mpDXAry[ i ] = FRound( mpDXAry[ i ] * fabs(fScaleX) ); } } @@ -1415,7 +1415,7 @@ void MetaTextArrayAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) rOStm << mnLen; rOStm << nAryLen; - for( ULONG i = 0UL; i < nAryLen; i++ ) + for( sal_uLong i = 0UL; i < nAryLen; i++ ) rOStm << mpDXAry[ i ]; sal_uInt16 j, nLen = maStr.Len(); // version 2 @@ -1457,7 +1457,7 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) mpDXAry = new (std::nothrow)sal_Int32[ mnLen ]; if ( mpDXAry ) { - ULONG i; + sal_uLong i; for( i = 0UL; i < nAryLen; i++ ) rIStm >> mpDXAry[ i ]; @@ -1499,7 +1499,7 @@ IMPL_META_ACTION( StretchText, META_STRETCHTEXT_ACTION ) MetaStretchTextAction::MetaStretchTextAction( const Point& rPt, sal_uInt32 nWidth, const XubString& rStr, - USHORT nIndex, USHORT nLen ) : + sal_uInt16 nIndex, sal_uInt16 nLen ) : MetaAction ( META_STRETCHTEXT_ACTION ), maPt ( rPt ), maStr ( rStr ), @@ -1537,7 +1537,7 @@ void MetaStretchTextAction::Move( long nHorzMove, long nVertMove ) void MetaStretchTextAction::Scale( double fScaleX, double fScaleY ) { ImplScalePoint( maPt, fScaleX, fScaleY ); - mnWidth = (ULONG)FRound( mnWidth * fabs(fScaleX) ); + mnWidth = (sal_uLong)FRound( mnWidth * fabs(fScaleX) ); } // ------------------------------------------------------------------------ @@ -1599,7 +1599,7 @@ IMPL_META_ACTION( TextRect, META_TEXTRECT_ACTION ) // ------------------------------------------------------------------------ MetaTextRectAction::MetaTextRectAction( const Rectangle& rRect, - const XubString& rStr, USHORT nStyle ) : + const XubString& rStr, sal_uInt16 nStyle ) : MetaAction ( META_TEXTRECT_ACTION ), maRect ( rRect ), maStr ( rStr ), @@ -2457,7 +2457,7 @@ void MetaMaskScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); rOStm << maBmp; - maColor.Write( rOStm, TRUE ); + maColor.Write( rOStm, sal_True ); rOStm << maDstPt << maDstSz << maSrcPt << maSrcSz; } } @@ -2468,7 +2468,7 @@ void MetaMaskScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* ) { COMPAT( rIStm ); rIStm >> maBmp; - maColor.Read( rIStm, TRUE ); + maColor.Read( rIStm, sal_True ); rIStm >> maDstPt >> maDstSz >> maSrcPt >> maSrcSz; } @@ -2589,7 +2589,7 @@ void MetaGradientExAction::Move( long nHorzMove, long nVertMove ) void MetaGradientExAction::Scale( double fScaleX, double fScaleY ) { - for( USHORT i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ ) + for( sal_uInt16 i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ ) ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY ); } @@ -2663,7 +2663,7 @@ void MetaHatchAction::Move( long nHorzMove, long nVertMove ) void MetaHatchAction::Scale( double fScaleX, double fScaleY ) { - for( USHORT i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ ) + for( sal_uInt16 i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ ) ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY ); } @@ -2771,7 +2771,7 @@ IMPL_META_ACTION( ClipRegion, META_CLIPREGION_ACTION ) // ------------------------------------------------------------------------ -MetaClipRegionAction::MetaClipRegionAction( const Region& rRegion, BOOL bClip ) : +MetaClipRegionAction::MetaClipRegionAction( const Region& rRegion, sal_Bool bClip ) : MetaAction ( META_CLIPREGION_ACTION ), maRegion ( rRegion ), mbClip ( bClip ) @@ -3032,7 +3032,7 @@ IMPL_META_ACTION( LineColor, META_LINECOLOR_ACTION ) // ------------------------------------------------------------------------ -MetaLineColorAction::MetaLineColorAction( const Color& rColor, BOOL bSet ) : +MetaLineColorAction::MetaLineColorAction( const Color& rColor, sal_Bool bSet ) : MetaAction ( META_LINECOLOR_ACTION ), maColor ( rColor ), mbSet ( bSet ) @@ -3071,7 +3071,7 @@ sal_Bool MetaLineColorAction::Compare( const MetaAction& rMetaAction ) const void MetaLineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - maColor.Write( rOStm, TRUE ); + maColor.Write( rOStm, sal_True ); rOStm << mbSet; } @@ -3080,7 +3080,7 @@ void MetaLineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) void MetaLineColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) { COMPAT( rIStm ); - maColor.Read( rIStm, TRUE ); + maColor.Read( rIStm, sal_True ); rIStm >> mbSet; } @@ -3090,7 +3090,7 @@ IMPL_META_ACTION( FillColor, META_FILLCOLOR_ACTION ) // ------------------------------------------------------------------------ -MetaFillColorAction::MetaFillColorAction( const Color& rColor, BOOL bSet ) : +MetaFillColorAction::MetaFillColorAction( const Color& rColor, sal_Bool bSet ) : MetaAction ( META_FILLCOLOR_ACTION ), maColor ( rColor ), mbSet ( bSet ) @@ -3129,7 +3129,7 @@ sal_Bool MetaFillColorAction::Compare( const MetaAction& rMetaAction ) const void MetaFillColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - maColor.Write( rOStm, TRUE ); + maColor.Write( rOStm, sal_True ); rOStm << mbSet; } @@ -3138,7 +3138,7 @@ void MetaFillColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) void MetaFillColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) { COMPAT( rIStm ); - maColor.Read( rIStm, TRUE ); + maColor.Read( rIStm, sal_True ); rIStm >> mbSet; } @@ -3182,7 +3182,7 @@ sal_Bool MetaTextColorAction::Compare( const MetaAction& rMetaAction ) const void MetaTextColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - maColor.Write( rOStm, TRUE ); + maColor.Write( rOStm, sal_True ); } // ------------------------------------------------------------------------ @@ -3190,7 +3190,7 @@ void MetaTextColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) void MetaTextColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) { COMPAT( rIStm ); - maColor.Read( rIStm, TRUE ); + maColor.Read( rIStm, sal_True ); } // ======================================================================== @@ -3199,7 +3199,7 @@ IMPL_META_ACTION( TextFillColor, META_TEXTFILLCOLOR_ACTION ) // ------------------------------------------------------------------------ -MetaTextFillColorAction::MetaTextFillColorAction( const Color& rColor, BOOL bSet ) : +MetaTextFillColorAction::MetaTextFillColorAction( const Color& rColor, sal_Bool bSet ) : MetaAction ( META_TEXTFILLCOLOR_ACTION ), maColor ( rColor ), mbSet ( bSet ) @@ -3238,7 +3238,7 @@ sal_Bool MetaTextFillColorAction::Compare( const MetaAction& rMetaAction ) const void MetaTextFillColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - maColor.Write( rOStm, TRUE ); + maColor.Write( rOStm, sal_True ); rOStm << mbSet; } @@ -3247,7 +3247,7 @@ void MetaTextFillColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) void MetaTextFillColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) { COMPAT( rIStm ); - maColor.Read( rIStm, TRUE ); + maColor.Read( rIStm, sal_True ); rIStm >> mbSet; } @@ -3257,7 +3257,7 @@ IMPL_META_ACTION( TextLineColor, META_TEXTLINECOLOR_ACTION ) // ------------------------------------------------------------------------ -MetaTextLineColorAction::MetaTextLineColorAction( const Color& rColor, BOOL bSet ) : +MetaTextLineColorAction::MetaTextLineColorAction( const Color& rColor, sal_Bool bSet ) : MetaAction ( META_TEXTLINECOLOR_ACTION ), maColor ( rColor ), mbSet ( bSet ) @@ -3296,7 +3296,7 @@ sal_Bool MetaTextLineColorAction::Compare( const MetaAction& rMetaAction ) const void MetaTextLineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - maColor.Write( rOStm, TRUE ); + maColor.Write( rOStm, sal_True ); rOStm << mbSet; } @@ -3305,7 +3305,7 @@ void MetaTextLineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) void MetaTextLineColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) { COMPAT( rIStm ); - maColor.Read( rIStm, TRUE ); + maColor.Read( rIStm, sal_True ); rIStm >> mbSet; } @@ -3315,7 +3315,7 @@ IMPL_META_ACTION( OverlineColor, META_OVERLINECOLOR_ACTION ) // ------------------------------------------------------------------------ -MetaOverlineColorAction::MetaOverlineColorAction( const Color& rColor, BOOL bSet ) : +MetaOverlineColorAction::MetaOverlineColorAction( const Color& rColor, sal_Bool bSet ) : MetaAction ( META_OVERLINECOLOR_ACTION ), maColor ( rColor ), mbSet ( bSet ) @@ -3354,7 +3354,7 @@ sal_Bool MetaOverlineColorAction::Compare( const MetaAction& rMetaAction ) const void MetaOverlineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - maColor.Write( rOStm, TRUE ); + maColor.Write( rOStm, sal_True ); rOStm << mbSet; } @@ -3363,7 +3363,7 @@ void MetaOverlineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) void MetaOverlineColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) { COMPAT( rIStm ); - maColor.Read( rIStm, TRUE ); + maColor.Read( rIStm, sal_True ); rIStm >> mbSet; } @@ -3407,14 +3407,14 @@ sal_Bool MetaTextAlignAction::Compare( const MetaAction& rMetaAction ) const void MetaTextAlignAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << (UINT16) maAlign; + rOStm << (sal_uInt16) maAlign; } // ------------------------------------------------------------------------ void MetaTextAlignAction::Read( SvStream& rIStm, ImplMetaReadData* ) { - UINT16 nTmp16; + sal_uInt16 nTmp16; COMPAT( rIStm ); rIStm >> nTmp16; maAlign = (TextAlign) nTmp16; @@ -3564,7 +3564,7 @@ IMPL_META_ACTION( Push, META_PUSH_ACTION ) // ------------------------------------------------------------------------ -MetaPushAction::MetaPushAction( USHORT nFlags ) : +MetaPushAction::MetaPushAction( sal_uInt16 nFlags ) : MetaAction ( META_PUSH_ACTION ), mnFlags ( nFlags ) { @@ -3683,14 +3683,14 @@ sal_Bool MetaRasterOpAction::Compare( const MetaAction& rMetaAction ) const void MetaRasterOpAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << (UINT16) meRasterOp; + rOStm << (sal_uInt16) meRasterOp; } // ------------------------------------------------------------------------ void MetaRasterOpAction::Read( SvStream& rIStm, ImplMetaReadData* ) { - UINT16 nTmp16; + sal_uInt16 nTmp16; COMPAT( rIStm ); rIStm >> nTmp16; meRasterOp = (RasterOp) nTmp16; @@ -3702,7 +3702,7 @@ IMPL_META_ACTION( Transparent, META_TRANSPARENT_ACTION ) // ------------------------------------------------------------------------ -MetaTransparentAction::MetaTransparentAction( const PolyPolygon& rPolyPoly, USHORT nTransPercent ) : +MetaTransparentAction::MetaTransparentAction( const PolyPolygon& rPolyPoly, sal_uInt16 nTransPercent ) : MetaAction ( META_TRANSPARENT_ACTION ), maPolyPoly ( rPolyPoly ), mnTransPercent ( nTransPercent ) @@ -3736,7 +3736,7 @@ void MetaTransparentAction::Move( long nHorzMove, long nVertMove ) void MetaTransparentAction::Scale( double fScaleX, double fScaleY ) { - for( USHORT i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ ) + for( sal_uInt16 i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ ) ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY ); } @@ -3943,7 +3943,7 @@ IMPL_META_ACTION( RefPoint, META_REFPOINT_ACTION ) // ------------------------------------------------------------------------ -MetaRefPointAction::MetaRefPointAction( const Point& rRefPoint, BOOL bSet ) : +MetaRefPointAction::MetaRefPointAction( const Point& rRefPoint, sal_Bool bSet ) : MetaAction ( META_REFPOINT_ACTION ), maRefPoint ( rRefPoint ), mbSet ( bSet ) @@ -4014,7 +4014,7 @@ MetaCommentAction::MetaCommentAction( const MetaCommentAction& rAct ) : // ------------------------------------------------------------------------ -MetaCommentAction::MetaCommentAction( const ByteString& rComment, sal_Int32 nValue, const BYTE* pData, sal_uInt32 nDataSize ) : +MetaCommentAction::MetaCommentAction( const ByteString& rComment, sal_Int32 nValue, const sal_uInt8* pData, sal_uInt32 nDataSize ) : MetaAction ( META_COMMENT_ACTION ), maComment ( rComment ), mnValue ( nValue ) @@ -4024,7 +4024,7 @@ MetaCommentAction::MetaCommentAction( const ByteString& rComment, sal_Int32 nVal // ------------------------------------------------------------------------ -MetaCommentAction::MetaCommentAction( const BYTE* pData, sal_uInt32 nDataSize ) : +MetaCommentAction::MetaCommentAction( const sal_uInt8* pData, sal_uInt32 nDataSize ) : MetaAction ( META_COMMENT_ACTION ), mnValue ( 0L ) { @@ -4041,11 +4041,11 @@ MetaCommentAction::~MetaCommentAction() // ------------------------------------------------------------------------ -void MetaCommentAction::ImplInitDynamicData( const BYTE* pData, sal_uInt32 nDataSize ) +void MetaCommentAction::ImplInitDynamicData( const sal_uInt8* pData, sal_uInt32 nDataSize ) { if ( nDataSize && pData ) { - mnDataSize = nDataSize, mpData = new BYTE[ mnDataSize ]; + mnDataSize = nDataSize, mpData = new sal_uInt8[ mnDataSize ]; memcpy( mpData, pData, mnDataSize ); } else @@ -4104,7 +4104,7 @@ void MetaCommentAction::Move( long nXMove, long nYMove ) aDest << aFill; } delete[] mpData; - ImplInitDynamicData( static_cast<const BYTE*>( aDest.GetData() ), aDest.Tell() ); + ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() ); } } } @@ -4147,7 +4147,7 @@ void MetaCommentAction::Scale( double fXScale, double fYScale ) aDest << aFill; } delete[] mpData; - ImplInitDynamicData( static_cast<const BYTE*>( aDest.GetData() ), aDest.Tell() ); + ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() ); } else if( maComment.Equals( "EMF_PLUS_HEADER_INFO" ) ) { SvMemoryStream aMemStm( (void*)mpData, mnDataSize, STREAM_READ ); SvMemoryStream aDest; @@ -4173,7 +4173,7 @@ void MetaCommentAction::Scale( double fXScale, double fYScale ) aDest << m11 << m12 << m21 << m22 << mdx << mdy; // save them - ImplInitDynamicData( static_cast<const BYTE*>( aDest.GetData() ), aDest.Tell() ); + ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() ); } } } @@ -4212,7 +4212,7 @@ void MetaCommentAction::Read( SvStream& rIStm, ImplMetaReadData* ) if( mnDataSize ) { - mpData = new BYTE[ mnDataSize ]; + mpData = new sal_uInt8[ mnDataSize ]; rIStm.Read( mpData, mnDataSize ); } else diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index 5a65b04391f0..4814d6e3114e 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -35,6 +35,8 @@ #include <vector> #include <set> +#include <cstdio> + // ======================================================================= ImplFontMetric::ImplFontMetric() @@ -52,6 +54,7 @@ ImplFontMetric::ImplFontMetric() inline void ImplFontMetric::AddReference() { + // TODO: disable refcounting on the default maps? ++mnRefCount; } @@ -59,6 +62,7 @@ inline void ImplFontMetric::AddReference() inline void ImplFontMetric::DeReference() { + // TODO: disable refcounting on the default maps? if( --mnRefCount <= 0 ) delete this; } @@ -123,15 +127,15 @@ FontInfo& FontInfo::operator=( const FontInfo& rInfo ) // ----------------------------------------------------------------------- -BOOL FontInfo::operator==( const FontInfo& rInfo ) const +sal_Bool FontInfo::operator==( const FontInfo& rInfo ) const { if( !Font::operator==( rInfo ) ) - return FALSE; + return sal_False; if( mpImplMetric == rInfo.mpImplMetric ) - return TRUE; + return sal_True; if( *mpImplMetric == *rInfo.mpImplMetric ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } // ----------------------------------------------------------------------- @@ -143,28 +147,28 @@ FontType FontInfo::GetType() const // ----------------------------------------------------------------------- -BOOL FontInfo::IsDeviceFont() const +sal_Bool FontInfo::IsDeviceFont() const { return mpImplMetric->IsDeviceFont(); } // ----------------------------------------------------------------------- -BOOL FontInfo::SupportsLatin() const +sal_Bool FontInfo::SupportsLatin() const { return mpImplMetric->SupportsLatin(); } // ----------------------------------------------------------------------- -BOOL FontInfo::SupportsCJK() const +sal_Bool FontInfo::SupportsCJK() const { return mpImplMetric->SupportsCJK(); } // ----------------------------------------------------------------------- -BOOL FontInfo::SupportsCTL() const +sal_Bool FontInfo::SupportsCTL() const { return mpImplMetric->SupportsCTL(); } @@ -227,7 +231,7 @@ FontMetric& FontMetric::operator =( const FontMetric& rMetric ) // ----------------------------------------------------------------------- -BOOL FontMetric::operator==( const FontMetric& rMetric ) const +sal_Bool FontMetric::operator==( const FontMetric& rMetric ) const { return FontInfo::operator==( rMetric ); } @@ -236,7 +240,7 @@ BOOL FontMetric::operator==( const FontMetric& rMetric ) const CmapResult::CmapResult( bool bSymbolic, const sal_uInt32* pRangeCodes, int nRangeCount, - const int* pStartGlyphs, const USHORT* pExtraGlyphIds ) + const int* pStartGlyphs, const sal_uInt16* pExtraGlyphIds ) : mpRangeCodes( pRangeCodes) , mpStartGlyphs( pStartGlyphs) , mpGlyphIds( pExtraGlyphIds) @@ -253,7 +257,7 @@ ImplFontCharMap::ImplFontCharMap( const CmapResult& rCR ) , mpGlyphIds( rCR.mpGlyphIds ) , mnRangeCount( rCR.mnRangeCount ) , mnCharCount( 0 ) -, mnRefCount( 1 ) +, mnRefCount( 0 ) { const sal_uInt32* pRangePtr = mpRangeCodes; for( int i = mnRangeCount; --i >= 0; pRangePtr += 2 ) @@ -264,7 +268,8 @@ ImplFontCharMap::ImplFontCharMap( const CmapResult& rCR ) } } -static ImplFontCharMap* pDefaultImplFontCharMap = NULL; +static ImplFontCharMap* pDefaultUnicodeImplFontCharMap = NULL; +static ImplFontCharMap* pDefaultSymbolImplFontCharMap = NULL; static const sal_uInt32 aDefaultUnicodeRanges[] = {0x0020,0xD800, 0xE000,0xFFF0}; static const sal_uInt32 aDefaultSymbolRanges[] = {0x0020,0x0100, 0xF020,0xF100}; @@ -285,44 +290,60 @@ ImplFontCharMap::~ImplFontCharMap() delete[] mpRangeCodes; delete[] mpStartGlyphs; delete[] mpGlyphIds; -} + } // ----------------------------------------------------------------------- -ImplFontCharMap* ImplFontCharMap::GetDefaultMap( bool bSymbols) +namespace { - if( pDefaultImplFontCharMap ) - pDefaultImplFontCharMap->AddReference(); - else + ImplFontCharMap *GetDefaultUnicodeMap() { - const sal_uInt32* pRangeCodes = aDefaultUnicodeRanges; - int nCodesCount = sizeof(aDefaultUnicodeRanges) / sizeof(*pRangeCodes); - if( bSymbols ) + if( !pDefaultUnicodeImplFontCharMap ) { - pRangeCodes = aDefaultSymbolRanges; - nCodesCount = sizeof(aDefaultSymbolRanges) / sizeof(*pRangeCodes); + const sal_uInt32* pRangeCodes = aDefaultUnicodeRanges; + int nCodesCount = sizeof(aDefaultUnicodeRanges) / sizeof(*pRangeCodes); + CmapResult aDefaultCR( false, pRangeCodes, nCodesCount/2 ); + pDefaultUnicodeImplFontCharMap = new ImplFontCharMap( aDefaultCR ); + pDefaultUnicodeImplFontCharMap->AddReference(); } - CmapResult aDefaultCR( bSymbols, pRangeCodes, nCodesCount/2 ); - pDefaultImplFontCharMap = new ImplFontCharMap( aDefaultCR ); + return pDefaultUnicodeImplFontCharMap; } - return pDefaultImplFontCharMap; + ImplFontCharMap *GetDefaultSymbolMap() + { + if( !pDefaultSymbolImplFontCharMap ) + { + const sal_uInt32* pRangeCodes = aDefaultSymbolRanges; + int nCodesCount = sizeof(aDefaultSymbolRanges) / sizeof(*pRangeCodes); + CmapResult aDefaultCR( true, pRangeCodes, nCodesCount/2 ); + pDefaultSymbolImplFontCharMap = new ImplFontCharMap( aDefaultCR ); + pDefaultSymbolImplFontCharMap->AddReference(); + } + + return pDefaultSymbolImplFontCharMap; + } +} + +ImplFontCharMap* ImplFontCharMap::GetDefaultMap( bool bSymbols) +{ + return bSymbols ? GetDefaultSymbolMap() : GetDefaultUnicodeMap(); } // ----------------------------------------------------------------------- -void ImplFontCharMap::AddReference() +void ImplFontCharMap::AddReference( void ) const { + // TODO: disable refcounting on the default maps? ++mnRefCount; } // ----------------------------------------------------------------------- -void ImplFontCharMap::DeReference() +void ImplFontCharMap::DeReference( void ) const { if( --mnRefCount <= 0 ) - if( this != pDefaultImplFontCharMap ) + if( (this != pDefaultUnicodeImplFontCharMap) && (this != pDefaultSymbolImplFontCharMap) ) delete this; } @@ -607,7 +628,7 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) sal_uInt32* pCodePairs = NULL; int* pStartGlyphs = NULL; - typedef std::vector<USHORT> U16Vector; + typedef std::vector<sal_uInt16> U16Vector; U16Vector aGlyphIdArray; aGlyphIdArray.reserve( 0x1000 ); aGlyphIdArray.push_back( 0 ); @@ -645,7 +666,7 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) const unsigned char* pGlyphIdPtr = pOffsetBase + 2*i + nRangeOffset; for( sal_uInt32 c = cMinChar; c <= cMaxChar; ++c, pGlyphIdPtr+=2 ) { const int nGlyphIndex = GetUShort( pGlyphIdPtr ) + nGlyphDelta; - aGlyphIdArray.push_back( static_cast<USHORT>(nGlyphIndex) ); + aGlyphIdArray.push_back( static_cast<sal_uInt16>(nGlyphIndex) ); } } } @@ -787,11 +808,11 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) // prepare the glyphid-array if needed // TODO: merge ranges if they are close enough? - USHORT* pGlyphIds = NULL; + sal_uInt16* pGlyphIds = NULL; if( !aGlyphIdArray.empty()) { - pGlyphIds = new USHORT[ aGlyphIdArray.size() ]; - USHORT* pOut = pGlyphIds; + pGlyphIds = new sal_uInt16[ aGlyphIdArray.size() ]; + sal_uInt16* pOut = pGlyphIds; U16Vector::const_iterator it = aGlyphIdArray.begin(); while( it != aGlyphIdArray.end() ) *(pOut++) = *(it++); @@ -809,7 +830,9 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) FontCharMap::FontCharMap() : mpImpl( ImplFontCharMap::GetDefaultMap() ) -{} +{ + mpImpl->AddReference(); +} // ----------------------------------------------------------------------- @@ -835,31 +858,26 @@ int FontCharMap::CountCharsInRange( sal_uInt32 cMin, sal_uInt32 cMax ) const // ----------------------------------------------------------------------- -void FontCharMap::Reset( ImplFontCharMap* pNewMap ) +void FontCharMap::Reset( const ImplFontCharMap* pNewMap ) { + mpImpl->DeReference(); if( pNewMap == NULL ) - { - mpImpl->DeReference(); mpImpl = ImplFontCharMap::GetDefaultMap(); - } else if( pNewMap != mpImpl ) - { - mpImpl->DeReference(); mpImpl = pNewMap; - mpImpl->AddReference(); - } + mpImpl->AddReference(); } // ----------------------------------------------------------------------- -BOOL FontCharMap::IsDefaultMap() const +sal_Bool FontCharMap::IsDefaultMap() const { return mpImpl->IsDefaultMap(); } // ----------------------------------------------------------------------- -BOOL FontCharMap::HasChar( sal_uInt32 cChar ) const +sal_Bool FontCharMap::HasChar( sal_uInt32 cChar ) const { return mpImpl->HasChar( cChar ); } diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx index 4e5f50124277..c2f0d92f03c3 100644 --- a/vcl/source/gdi/octree.cxx +++ b/vcl/source/gdi/octree.cxx @@ -37,18 +37,18 @@ // - pMask - // --------- -static BYTE pImplMask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; +static sal_uInt8 pImplMask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; // ------------- // - NodeCache - // ------------- -ImpNodeCache::ImpNodeCache( const ULONG nInitSize ) : +ImpNodeCache::ImpNodeCache( const sal_uLong nInitSize ) : pActNode( NULL ) { - const ULONG nSize = nInitSize + 4; + const sal_uLong nSize = nInitSize + 4; - for( ULONG i = 0; i < nSize; i++ ) + for( sal_uLong i = 0; i < nSize; i++ ) { OctreeNode* pNewNode = new NODE; @@ -74,7 +74,7 @@ ImpNodeCache::~ImpNodeCache() // - Octree - // ---------- -Octree::Octree( ULONG nColors ) : +Octree::Octree( sal_uLong nColors ) : nMax ( nColors ), nLeafCount ( 0L ), pTree ( NULL ), @@ -86,7 +86,7 @@ Octree::Octree( ULONG nColors ) : // ------------------------------------------------------------------------ -Octree::Octree( const BitmapReadAccess& rReadAcc, ULONG nColors ) : +Octree::Octree( const BitmapReadAccess& rReadAcc, sal_uLong nColors ) : nMax ( nColors ), nLeafCount ( 0L ), pTree ( NULL ), @@ -167,7 +167,7 @@ void Octree::ImplCreateOctree() void Octree::ImplDeleteOctree( PPNODE ppNode ) { - for ( ULONG i = 0UL; i < 8UL; i++ ) + for ( sal_uLong i = 0UL; i < 8UL; i++ ) { if ( (*ppNode)->pChild[ i ] ) ImplDeleteOctree( &(*ppNode)->pChild[ i ] ); @@ -205,9 +205,9 @@ void Octree::ImplAdd( PPNODE ppNode ) } else { - const ULONG nShift = 7 - nLevel; - const BYTE cMask = pImplMask[ nLevel ]; - const ULONG nIndex = ( ( ( pColor->GetRed() & cMask ) >> nShift ) << 2 ) | + const sal_uLong nShift = 7 - nLevel; + const sal_uInt8 cMask = pImplMask[ nLevel ]; + const sal_uLong nIndex = ( ( ( pColor->GetRed() & cMask ) >> nShift ) << 2 ) | ( ( ( pColor->GetGreen() & cMask ) >> nShift ) << 1 ) | ( ( pColor->GetBlue() & cMask ) >> nShift ); @@ -220,12 +220,12 @@ void Octree::ImplAdd( PPNODE ppNode ) void Octree::ImplReduce() { - ULONG i; + sal_uLong i; PNODE pNode; - ULONG nRedSum = 0L; - ULONG nGreenSum = 0L; - ULONG nBlueSum = 0L; - ULONG nChilds = 0L; + sal_uLong nRedSum = 0L; + sal_uLong nGreenSum = 0L; + sal_uLong nBlueSum = 0L; + sal_uLong nChilds = 0L; for ( i = OCTREE_BITS - 1; i && !pReduce[i]; i-- ) {} @@ -249,7 +249,7 @@ void Octree::ImplReduce() } } - pNode->bLeaf = TRUE; + pNode->bLeaf = sal_True; pNode->nRed = nRedSum; pNode->nGreen = nGreenSum; pNode->nBlue = nBlueSum; @@ -263,11 +263,11 @@ void Octree::CreatePalette( PNODE pNode ) if( pNode->bLeaf ) { pNode->nPalIndex = nPalIndex; - aPal[ nPalIndex++ ] = BitmapColor( (BYTE) ( (double) pNode->nRed / pNode->nCount ), - (BYTE) ( (double) pNode->nGreen / pNode->nCount ), - (BYTE) ( (double) pNode->nBlue / pNode->nCount ) ); + aPal[ nPalIndex++ ] = BitmapColor( (sal_uInt8) ( (double) pNode->nRed / pNode->nCount ), + (sal_uInt8) ( (double) pNode->nGreen / pNode->nCount ), + (sal_uInt8) ( (double) pNode->nBlue / pNode->nCount ) ); } - else for( ULONG i = 0UL; i < 8UL; i++ ) + else for( sal_uLong i = 0UL; i < 8UL; i++ ) if( pNode->pChild[ i ] ) CreatePalette( pNode->pChild[ i ] ); @@ -281,9 +281,9 @@ void Octree::GetPalIndex( PNODE pNode ) nPalIndex = pNode->nPalIndex; else { - const ULONG nShift = 7 - nLevel; - const BYTE cMask = pImplMask[ nLevel++ ]; - const ULONG nIndex = ( ( ( pColor->GetRed() & cMask ) >> nShift ) << 2 ) | + const sal_uLong nShift = 7 - nLevel; + const sal_uInt8 cMask = pImplMask[ nLevel++ ]; + const sal_uLong nIndex = ( ( ( pColor->GetRed() & cMask ) >> nShift ) << 2 ) | ( ( ( pColor->GetGreen() & cMask ) >> nShift ) << 1 ) | ( ( pColor->GetBlue() & cMask ) >> nShift ); @@ -298,27 +298,27 @@ void Octree::GetPalIndex( PNODE pNode ) InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) : nBits( 8 - OCTREE_BITS ) { - ULONG* cdp; - BYTE* crgbp; - const ULONG nColorMax = 1 << OCTREE_BITS; - const ULONG xsqr = 1 << ( nBits << 1 ); - const ULONG xsqr2 = xsqr << 1; - const ULONG nColors = rPal.GetEntryCount(); + sal_uLong* cdp; + sal_uInt8* crgbp; + const sal_uLong nColorMax = 1 << OCTREE_BITS; + const sal_uLong xsqr = 1 << ( nBits << 1 ); + const sal_uLong xsqr2 = xsqr << 1; + const sal_uLong nColors = rPal.GetEntryCount(); const long x = 1L << nBits; const long x2 = x >> 1L; - ULONG r, g, b; + sal_uLong r, g, b; long rxx, gxx, bxx; long rdist, gdist, bdist; long crinc, cginc, cbinc; ImplCreateBuffers( nColorMax ); - for( ULONG nIndex = 0; nIndex < nColors; nIndex++ ) + for( sal_uLong nIndex = 0; nIndex < nColors; nIndex++ ) { - const BitmapColor& rColor = rPal[ (USHORT) nIndex ]; - const BYTE cRed = rColor.GetRed(); - const BYTE cGreen = rColor.GetGreen(); - const BYTE cBlue = rColor.GetBlue(); + const BitmapColor& rColor = rPal[ (sal_uInt16) nIndex ]; + const sal_uInt8 cRed = rColor.GetRed(); + const sal_uInt8 cGreen = rColor.GetGreen(); + const sal_uInt8 cBlue = rColor.GetBlue(); rdist = cRed - x2; gdist = cGreen - x2; @@ -329,7 +329,7 @@ InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) : cginc = ( xsqr - ( cGreen << nBits ) ) << 1L; cbinc = ( xsqr - ( cBlue << nBits ) ) << 1L; - cdp = (ULONG*) pBuffer; + cdp = (sal_uLong*) pBuffer; crgbp = pMap; for( r = 0, rxx = crinc; r < nColorMax; rdist += rxx, r++, rxx += xsqr2 ) @@ -340,7 +340,7 @@ InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) : if ( !nIndex || ( (long) *cdp ) > bdist ) { *cdp = bdist; - *crgbp = (BYTE) nIndex; + *crgbp = (sal_uInt8) nIndex; } } } @@ -357,15 +357,15 @@ InverseColorMap::~InverseColorMap() // ------------------------------------------------------------------------ -void InverseColorMap::ImplCreateBuffers( const ULONG nMax ) +void InverseColorMap::ImplCreateBuffers( const sal_uLong nMax ) { - const ULONG nCount = nMax * nMax * nMax; - const ULONG nSize = nCount * sizeof( ULONG ); + const sal_uLong nCount = nMax * nMax * nMax; + const sal_uLong nSize = nCount * sizeof( sal_uLong ); - pMap = (BYTE*) rtl_allocateMemory( nCount ); + pMap = (sal_uInt8*) rtl_allocateMemory( nCount ); memset( pMap, 0x00, nCount ); - pBuffer = (BYTE*) rtl_allocateMemory( nSize ); + pBuffer = (sal_uInt8*) rtl_allocateMemory( nSize ); memset( pBuffer, 0xff, nSize ); } diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 3af14f1c9dcf..ffc71df7b98f 100644..100755 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -119,9 +119,9 @@ struct ImplObjStack Point* mpRefPoint; TextAlign meTextAlign; RasterOp meRasterOp; - ULONG mnTextLayoutMode; + sal_uLong mnTextLayoutMode; LanguageType meTextLanguage; - USHORT mnFlags; + sal_uInt16 mnFlags; }; // ----------------------------------------------------------------------- @@ -199,10 +199,6 @@ bool OutputDevice::ImplSelectClipRegion( const Region& rRegion, SalGraphics* pGr { DBG_TESTSOLARMUTEX(); - // TODO(Q3): Change from static to plain method - everybody's - // calling it with pOutDev=this! - // => done, but only with minimal changes for now => TODO - OutputDevice* const pOutDev = this; if( !pGraphics ) { if( !mpGraphics ) @@ -211,91 +207,8 @@ bool OutputDevice::ImplSelectClipRegion( const Region& rRegion, SalGraphics* pGr pGraphics = mpGraphics; } - if( rRegion.HasPolyPolygon() - && pGraphics->supportsOperation( OutDevSupport_B2DClip ) ) - { - const ::basegfx::B2DPolyPolygon& rB2DPolyPolygon = rRegion.GetB2DPolyPolygon(); - pGraphics->BeginSetClipRegion( 0 ); - pGraphics->UnionClipRegion( rB2DPolyPolygon, pOutDev ); - pGraphics->EndSetClipRegion(); - return true; - } - - long nX; - long nY; - long nWidth; - long nHeight; - ULONG nRectCount; - ImplRegionInfo aInfo; - BOOL bRegionRect; - BOOL bClipRegion = TRUE; - const BOOL bClipDeviceBounds( !pOutDev->GetPDFWriter() - && pOutDev->GetOutDevType() != OUTDEV_PRINTER ); - - nRectCount = rRegion.GetRectCount(); - pGraphics->BeginSetClipRegion( nRectCount ); - bRegionRect = rRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight ); - if( bClipDeviceBounds ) - { - // #b6520266# Perform actual rect clip against outdev - // dimensions, to generate empty clips whenever one of the - // values is completely off the device. - const long nOffX( pOutDev->mnOutOffX ); - const long nOffY( pOutDev->mnOutOffY ); - const long nDeviceWidth( pOutDev->GetOutputWidthPixel() ); - const long nDeviceHeight( pOutDev->GetOutputHeightPixel() ); - Rectangle aDeviceBounds( nOffX, nOffY, - nOffX+nDeviceWidth-1, - nOffY+nDeviceHeight-1 ); - while ( bRegionRect ) - { - // #i59315# Limit coordinates passed to sal layer to actual - // outdev dimensions - everything else bears the risk of - // overflowing internal coordinates (e.g. the 16 bit wire - // format of X11). - Rectangle aTmpRect(nX,nY,nX+nWidth-1,nY+nHeight-1); - aTmpRect.Intersection(aDeviceBounds); - - if( !aTmpRect.IsEmpty() ) - { - if ( !pGraphics->UnionClipRegion( aTmpRect.Left(), - aTmpRect.Top(), - aTmpRect.GetWidth(), - aTmpRect.GetHeight(), - pOutDev ) ) - { - bClipRegion = FALSE; - } - } - else - { - // #i79850# Fake off-screen clip - if ( !pGraphics->UnionClipRegion( nDeviceWidth+1, - nDeviceHeight+1, - 1, 1, - pOutDev ) ) - { - bClipRegion = FALSE; - } - } - DBG_ASSERT( bClipRegion, "OutputDevice::ImplSelectClipRegion() - can't create region" ); - bRegionRect = rRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight ); - } - } - else - { - // #i65720# Actually, _don't_ clip anything on printer or PDF - // export, since output might be visible outside the specified - // device boundaries. - while ( bRegionRect ) - { - if ( !pGraphics->UnionClipRegion( nX, nY, nWidth, nHeight, pOutDev ) ) - bClipRegion = FALSE; - DBG_ASSERT( bClipRegion, "OutputDevice::ImplSelectClipRegion() - can't cerate region" ); - bRegionRect = rRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight ); - } - } - pGraphics->EndSetClipRegion(); + bool bClipRegion = pGraphics->SetClipRegion( rRegion, this ); + OSL_ENSURE( bClipRegion, "OutputDevice::ImplSelectClipRegion() - can't cerate region" ); return bClipRegion; } @@ -316,7 +229,7 @@ Polygon ImplSubdivideBezier( const Polygon& rPoly ) PolyPolygon ImplSubdivideBezier( const PolyPolygon& rPolyPoly ) { - USHORT i, nPolys = rPolyPoly.Count(); + sal_uInt16 i, nPolys = rPolyPoly.Count(); PolyPolygon aPolyPoly( nPolys ); for( i=0; i<nPolys; ++i ) aPolyPoly.Insert( ImplSubdivideBezier( rPolyPoly.GetObject(i) ) ); @@ -327,7 +240,7 @@ PolyPolygon ImplSubdivideBezier( const PolyPolygon& rPolyPoly ) // ======================================================================= // #100127# Extracted from OutputDevice::DrawPolyPolygon() -void OutputDevice::ImplDrawPolyPolygon( USHORT nPoly, const PolyPolygon& rPolyPoly ) +void OutputDevice::ImplDrawPolyPolygon( sal_uInt16 nPoly, const PolyPolygon& rPolyPoly ) { // AW: This crashes on empty PolyPolygons, avoid that if(!nPoly) @@ -335,28 +248,28 @@ void OutputDevice::ImplDrawPolyPolygon( USHORT nPoly, const PolyPolygon& rPolyPo sal_uInt32 aStackAry1[OUTDEV_POLYPOLY_STACKBUF]; PCONSTSALPOINT aStackAry2[OUTDEV_POLYPOLY_STACKBUF]; - BYTE* aStackAry3[OUTDEV_POLYPOLY_STACKBUF]; + sal_uInt8* aStackAry3[OUTDEV_POLYPOLY_STACKBUF]; sal_uInt32* pPointAry; PCONSTSALPOINT* pPointAryAry; - const BYTE** pFlagAryAry; - USHORT i = 0, j = 0, last = 0; - BOOL bHaveBezier = sal_False; + const sal_uInt8** pFlagAryAry; + sal_uInt16 i = 0, j = 0, last = 0; + sal_Bool bHaveBezier = sal_False; if ( nPoly > OUTDEV_POLYPOLY_STACKBUF ) { pPointAry = new sal_uInt32[nPoly]; pPointAryAry = new PCONSTSALPOINT[nPoly]; - pFlagAryAry = new const BYTE*[nPoly]; + pFlagAryAry = new const sal_uInt8*[nPoly]; } else { pPointAry = aStackAry1; pPointAryAry = aStackAry2; - pFlagAryAry = (const BYTE**)aStackAry3; + pFlagAryAry = (const sal_uInt8**)aStackAry3; } do { const Polygon& rPoly = rPolyPoly.GetObject( i ); - USHORT nSize = rPoly.GetSize(); + sal_uInt16 nSize = rPoly.GetSize(); if ( nSize ) { pPointAry[j] = nSize; @@ -460,33 +373,33 @@ OutputDevice::OutputDevice() : mnTextLayoutMode = TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT; meOutDevType = OUTDEV_DONTKNOW; meOutDevViewType = OUTDEV_VIEWTYPE_DONTKNOW; - mbMap = FALSE; - mbMapIsDefault = TRUE; - mbClipRegion = FALSE; - mbBackground = FALSE; - mbOutput = TRUE; - mbDevOutput = FALSE; - mbOutputClipped = FALSE; + mbMap = sal_False; + mbMapIsDefault = sal_True; + mbClipRegion = sal_False; + mbBackground = sal_False; + mbOutput = sal_True; + mbDevOutput = sal_False; + mbOutputClipped = sal_False; maTextColor = Color( COL_BLACK ); maOverlineColor = Color( COL_TRANSPARENT ); meTextAlign = maFont.GetAlign(); meRasterOp = ROP_OVERPAINT; mnAntialiasing = 0; meTextLanguage = 0; // TODO: get default from configuration? - mbLineColor = TRUE; - mbFillColor = TRUE; - mbInitLineColor = TRUE; - mbInitFillColor = TRUE; - mbInitFont = TRUE; - mbInitTextColor = TRUE; - mbInitClipRegion = TRUE; - mbClipRegionSet = FALSE; - mbKerning = FALSE; - mbNewFont = TRUE; - mbTextLines = FALSE; - mbTextSpecial = FALSE; - mbRefPoint = FALSE; - mbEnableRTL = FALSE; // mirroring must be explicitly allowed (typically for windows only) + mbLineColor = sal_True; + mbFillColor = sal_True; + mbInitLineColor = sal_True; + mbInitFillColor = sal_True; + mbInitFont = sal_True; + mbInitTextColor = sal_True; + mbInitClipRegion = sal_True; + mbClipRegionSet = sal_False; + mbKerning = sal_False; + mbNewFont = sal_True; + mbTextLines = sal_False; + mbTextSpecial = sal_False; + mbRefPoint = sal_False; + mbEnableRTL = sal_False; // mirroring must be explicitly allowed (typically for windows only) // struct ImplMapRes maMapRes.mnMapOfsX = 0; @@ -510,7 +423,7 @@ OutputDevice::~OutputDevice() if ( GetUnoGraphicsList() ) { - UnoWrapperBase* pWrapper = Application::GetUnoWrapper( FALSE ); + UnoWrapperBase* pWrapper = Application::GetUnoWrapper( sal_False ); if ( pWrapper ) pWrapper->ReleaseAllGraphics( this ); delete mpUnoGraphicsList; @@ -577,7 +490,7 @@ bool OutputDevice::supportsOperation( OutDevSupportType eType ) const // ----------------------------------------------------------------------- -void OutputDevice::EnableRTL( BOOL bEnable ) +void OutputDevice::EnableRTL( sal_Bool bEnable ) { mbEnableRTL = (bEnable != 0); if( meOutDevType == OUTDEV_VIRDEV ) @@ -602,11 +515,11 @@ void OutputDevice::EnableRTL( BOOL bEnable ) mpAlphaVDev->EnableRTL( bEnable ); } -BOOL OutputDevice::ImplHasMirroredGraphics() +sal_Bool OutputDevice::ImplHasMirroredGraphics() { // HOTFIX for #i55719# if( meOutDevType == OUTDEV_PRINTER ) - return FALSE; + return sal_False; return ( ImplGetGraphics() && (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) ); } @@ -635,7 +548,7 @@ void OutputDevice::ImplReMirror( Region &rRegion ) const long nWidth; long nHeight; ImplRegionInfo aInfo; - BOOL bRegionRect; + sal_Bool bRegionRect; Region aMirroredRegion; bRegionRect = rRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight ); @@ -657,13 +570,13 @@ int OutputDevice::ImplGetGraphics() const DBG_TESTSOLARMUTEX(); if ( mpGraphics ) - return TRUE; + return sal_True; - mbInitLineColor = TRUE; - mbInitFillColor = TRUE; - mbInitFont = TRUE; - mbInitTextColor = TRUE; - mbInitClipRegion = TRUE; + mbInitLineColor = sal_True; + mbInitFillColor = sal_True; + mbInitFont = sal_True; + mbInitTextColor = sal_True; + mbInitClipRegion = sal_True; ImplSVData* pSVData = ImplGetSVData(); if ( meOutDevType == OUTDEV_WINDOW ) @@ -687,7 +600,7 @@ int OutputDevice::ImplGetGraphics() const { // steal the wingraphics from the other outdev mpGraphics = pReleaseOutDev->mpGraphics; - pReleaseOutDev->ImplReleaseGraphics( FALSE ); + pReleaseOutDev->ImplReleaseGraphics( sal_False ); } else { @@ -797,15 +710,15 @@ int OutputDevice::ImplGetGraphics() const { mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp), ROP_INVERT == meRasterOp ); mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void OutputDevice::ImplReleaseGraphics( BOOL bRelease ) +void OutputDevice::ImplReleaseGraphics( sal_Bool bRelease ) { DBG_TESTSOLARMUTEX(); @@ -961,7 +874,7 @@ void OutputDevice::ImplInvalidateViewTransform() // ----------------------------------------------------------------------- -BOOL OutputDevice::ImplIsRecordLayout() const +sal_Bool OutputDevice::ImplIsRecordLayout() const { return mpOutDevData && mpOutDevData->mpRecordLayout; } @@ -1002,7 +915,7 @@ void OutputDevice::ImplInitLineColor() else mpGraphics->SetLineColor(); - mbInitLineColor = FALSE; + mbInitLineColor = sal_False; } // ----------------------------------------------------------------------- @@ -1025,7 +938,7 @@ void OutputDevice::ImplInitFillColor() else mpGraphics->SetFillColor(); - mbInitFillColor = FALSE; + mbInitFillColor = sal_False; } // ----------------------------------------------------------------------- @@ -1055,43 +968,56 @@ void OutputDevice::ImplInitClipRegion() if ( mbClipRegion ) aRegion.Intersect( ImplPixelToDevicePixel( maRegion ) ); if ( aRegion.IsEmpty() ) - mbOutputClipped = TRUE; + mbOutputClipped = sal_True; else { - mbOutputClipped = FALSE; + mbOutputClipped = sal_False; ImplSelectClipRegion( aRegion ); } - mbClipRegionSet = TRUE; + mbClipRegionSet = sal_True; } else { if ( mbClipRegion ) { if ( maRegion.IsEmpty() ) - mbOutputClipped = TRUE; + mbOutputClipped = sal_True; else { - mbOutputClipped = FALSE; - ImplSelectClipRegion( - // #102532# Respect output offset also for clip region - ImplPixelToDevicePixel( maRegion ) ); + mbOutputClipped = sal_False; + + // #102532# Respect output offset also for clip region + Region aRegion( ImplPixelToDevicePixel( maRegion ) ); + const bool bClipDeviceBounds( ! GetPDFWriter() + && GetOutDevType() != OUTDEV_PRINTER ); + if( bClipDeviceBounds ) + { + // #b6520266# Perform actual rect clip against outdev + // dimensions, to generate empty clips whenever one of the + // values is completely off the device. + Rectangle aDeviceBounds( mnOutOffX, mnOutOffY, + mnOutOffX+GetOutputWidthPixel()-1, + mnOutOffY+GetOutputHeightPixel()-1 ); + aRegion.Intersect( aDeviceBounds ); + } + ImplSelectClipRegion( aRegion ); } - mbClipRegionSet = TRUE; + mbClipRegionSet = sal_True; } else { if ( mbClipRegionSet ) { mpGraphics->ResetClipRegion(); - mbClipRegionSet = FALSE; + mbClipRegionSet = sal_False; } - mbOutputClipped = FALSE; + mbOutputClipped = sal_False; } } - mbInitClipRegion = FALSE; + mbInitClipRegion = sal_False; } // ----------------------------------------------------------------------- @@ -1105,710 +1031,27 @@ void OutputDevice::ImplSetClipRegion( const Region* pRegion ) if ( mbClipRegion ) { maRegion = Region( REGION_NULL ); - mbClipRegion = FALSE; - mbInitClipRegion = TRUE; + mbClipRegion = sal_False; + mbInitClipRegion = sal_True; } } else { maRegion = *pRegion; - mbClipRegion = TRUE; - mbInitClipRegion = TRUE; + mbClipRegion = sal_True; + mbInitClipRegion = sal_True; } } // ----------------------------------------------------------------------- -namespace -{ - inline int iround( float x ) - { - union - { - float f; - sal_Int32 i; - }; - f = x; - sal_Int32 exponent = (127 + 31) - ((i >> 23) & 0xFF); - sal_Int32 r = ((sal_Int32(i) << 8) | (1U << 31)) >> exponent; - r &= ((exponent - 32) >> 31); - sal_Int32 sign = i >> 31; - return r = (r ^ sign) - sign; - } - - inline int floorDiv(int a, int b) - { - if(b == 0) - return 0x80000000; - if(a >= 0) - return a / b; - int q = -(-a / b); // quotient - int r = -a % b; // remainder - if(r) - q--; - return q; - } - - inline int floorMod( int a, int b ) - { - if(b == 0) - return 0x80000000; - if(a >= 0) - return a % b; - int r = -a % b; // remainder - if(r) - r = b - r; - return r; - } - - inline int ceilDiv( int a, int b ) - { - if(b == 0) - return 0x80000000; - a += - 1 + b; - if(a >= 0) - return a / b; - int q = -(-a / b); // quotient - int r = -a % b; // remainder - if(r) - q--; - return q; - } - - inline int ceilMod( int a, int b ) - { - if(b == 0) - return 0x80000000; - a += - 1 + b; - if(a >= 0) - return (a % b) + 1 - b; - int r = -a % b; - if(r) - r = b - r; - return r + 1 - b; - } - - inline int ceilFix4(int x) { return (x + 0xF) & 0xFFFFFFF0; } - - struct vertex - { - float x,y; - inline vertex( const Point &p ) - : x((float)p.getX()),y((float)p.getY()) {} - }; - - template<class T> inline void swap(T &a, T &b) { T t=a; a=b; b=t; } - - class SpanIterator - { - public: - - SpanIterator( sal_Int32 *pTable, size_t dwPitch, sal_Int32 dwNumScanlines ); - std::pair<sal_Int32,sal_Int32> GetNextSpan( void ); - sal_Int32 GetNumRemainingScanlines( void ); - sal_Int32 GetNumEqualScanlines( void ); - SpanIterator &operator++ (); - SpanIterator &Skip( sal_Int32 dwNumScanlines ); - sal_Int32 GetRemainingSpans( void ) const { return maNumSpans; } - - private: - - sal_Int32 *mpTable; - sal_Int32 *mpSpanArray; - sal_Int32 maNumSpans; - sal_Int32 maRemainingScanlines; - size_t maPitch; - }; - - inline SpanIterator::SpanIterator( sal_Int32 *pTable, size_t dwPitch, sal_Int32 dwNumScanlines ) - : mpTable(pTable),maRemainingScanlines(dwNumScanlines),maPitch(dwPitch) - { - sal_Int32 *pNumSpans = mpTable; - mpSpanArray = reinterpret_cast<sal_Int32 *>(pNumSpans+2); - maNumSpans = *pNumSpans; - } - - inline SpanIterator &SpanIterator::operator++ () - { - --maRemainingScanlines; - mpTable += maPitch; - sal_Int32 *pNumSpans = mpTable; - mpSpanArray = reinterpret_cast<sal_Int32 *>(pNumSpans+2); - maNumSpans = *pNumSpans; - return (*this); - } - - inline SpanIterator &SpanIterator::Skip( sal_Int32 dwNumScanlines ) - { - // don't skip more scanlines than there are... - if(dwNumScanlines > maRemainingScanlines) - dwNumScanlines = maRemainingScanlines; - - // skip in one fellow swoop... - maRemainingScanlines -= dwNumScanlines; - mpTable += maPitch * dwNumScanlines; - - // initialize necessary query fields... - sal_Int32 *pNumSpans = mpTable; - mpSpanArray = reinterpret_cast<sal_Int32 *>(pNumSpans+2); - maNumSpans = *pNumSpans; - return (*this); - } - - inline std::pair<sal_Int32,sal_Int32> SpanIterator::GetNextSpan( void ) - { - sal_Int32 x(0); - sal_Int32 w(0); - if(maNumSpans) - { - x = *mpSpanArray++; - w = *mpSpanArray++; - --maNumSpans; - } - return std::pair<sal_Int32,sal_Int32>(x,w); - } - - inline sal_Int32 SpanIterator::GetNumEqualScanlines( void ) - { - return mpTable[1]; - } - - inline sal_Int32 SpanIterator::GetNumRemainingScanlines( void ) - { - return maRemainingScanlines; - } - - class ScanlineContainer - { - - public: - - ScanlineContainer( sal_uInt32 dwNumScanlines, - sal_uInt32 dwNumSpansPerScanline ); - - ~ScanlineContainer( void ); - - void InsertSpan( sal_Int32 y, sal_Int32 lx, sal_Int32 rx ); - - SpanIterator Iterate( void ) const { return SpanIterator(mpTable,maPitch,maNumScanlines); } - - inline sal_uInt32 GetNumSpans( void ) const { return maNumberOfSpans; } - - void Consolidate( void ); - - private: - - // the span table will assist in determinate exactly how many clipping - // regions [that is *spans*] we will end up with. - // the counter for this purpose is right ahead. - sal_uInt32 maNumberOfSpans; - - struct span - { - sal_Int32 x; - sal_Int32 w; - }; - - sal_uInt32 maNumScanlines; - sal_uInt32 maNumSpansPerScanline; - sal_Int32 *mpTable; - size_t maPitch; - }; - - ScanlineContainer::ScanlineContainer( sal_uInt32 dwNumScanlines, - sal_uInt32 dwNumSpansPerScanline ) : maNumScanlines(dwNumScanlines), - maNumSpansPerScanline(dwNumSpansPerScanline) - { - // #128002# add one scanline buffer at the end, as - // SpanIterator::Skip reads two bytes past the end. - ++dwNumScanlines; - - // since each triangle could possibly add another span - // we can calculate the upper limit by [num scanlines * num triangles]. - const sal_uInt32 dwNumPossibleRegions = dwNumScanlines*dwNumSpansPerScanline; - - // calculate the number of bytes the span table will consume - const size_t dwTableSize = dwNumPossibleRegions*sizeof(span)+dwNumScanlines*(sizeof(sal_Int32)<<1); - - // allocate the span table [on the stack] - mpTable = static_cast<sal_Int32 *>(rtl_allocateMemory(dwTableSize)); - - // calculate the table pitch, that is how many int's do i need to get from a scanline to the next. - maPitch = (dwNumSpansPerScanline*sizeof(span)/sizeof(sal_Int32))+2; - - // we need to initialize the table here. - // the first *int* on each scanline tells us how many spans are on it. - sal_Int32 *pNumSpans = mpTable; - for(unsigned int i=0; i<dwNumScanlines; ++i) - { - pNumSpans[0] = 0; - pNumSpans[1] = 0; - pNumSpans += maPitch; - } - - maNumberOfSpans = 0; - } - - ScanlineContainer::~ScanlineContainer( void ) - { - rtl_freeMemory(mpTable); - } - - void ScanlineContainer::InsertSpan( sal_Int32 y, sal_Int32 lx, sal_Int32 rx ) - { - // there's new incoming span which we need to store in the table. - // first see if its width contributes a valid span. - if(sal_Int32 dwSpanWidth = rx-lx) - { - // first select the appropriate scanline the new span. - sal_Int32 *pNumSpans = mpTable+(y*maPitch); - span *pSpanArray = reinterpret_cast<span *>(pNumSpans+2); - - // retrieve the number of already contained spans. - sal_Int32 dwNumSpan = *pNumSpans; - - // since we need to sort the spans from top to bottom - // and left to right, we need to find the correct location - // in the table. - sal_Int32 dwIndex = 0; - while(dwIndex<dwNumSpan) - { - // since we would like to avoid unnecessary spans - // we try to consolidate them if possible. - // consolidate with right neighbour - if(pSpanArray[dwIndex].x == rx) - { - pSpanArray[dwIndex].x = lx; - pSpanArray[dwIndex].w += dwSpanWidth; - return; - } - - // consolidate with left neighbour - if((pSpanArray[dwIndex].x+pSpanArray[dwIndex].w) == lx) - { - pSpanArray[dwIndex].w += rx-lx; - return; - } - - // no consolidation possible, either this is a completely - // seperate span or it is the first in the list. - if(pSpanArray[dwIndex].x > lx) - break; - - // forward to next element in the list. - ++dwIndex; - } - - // if we reach here, the new span needs to be stored - // in the table, increase the number of spans in the - // current scanline. - *pNumSpans = dwNumSpan+1; - - // keep the list of spans in sorted order. 'dwIndex' - // is where we want to store the new span. 'dwNumSpan' - // is the number of spans already there. now we need - // to move the offending spans out of the way. - while(dwIndex != dwNumSpan) - { - pSpanArray[dwNumSpan].x = pSpanArray[dwNumSpan-1].x; - pSpanArray[dwNumSpan].w = pSpanArray[dwNumSpan-1].w; - --dwNumSpan; - } - - // insert the new span - pSpanArray[dwIndex].x = lx; - pSpanArray[dwIndex].w = rx-lx; - - // remember the total number of spans in the table. - ++maNumberOfSpans; - } - } - - void ScanlineContainer::Consolidate( void ) - { - sal_Int32 *pScanline = mpTable; - - sal_Int32 dwRemaining = maNumScanlines; - while(dwRemaining) - { - sal_Int32 dwNumSpans = pScanline[0]; - sal_Int32 *pSpanArray = pScanline+2; - - sal_Int32 dwRest = dwRemaining-1; - sal_Int32 *pNext = pScanline; - while(dwRest) - { - pNext += maPitch; - sal_Int32 dwNumNextSpans = pNext[0]; - sal_Int32 *pSpanArrayNext = pNext+2; - if(dwNumSpans != dwNumNextSpans) - break; - - sal_Int32 dwCompare = dwNumSpans<<1; - while(dwCompare) - { - if(pSpanArray[dwCompare-1] != pSpanArrayNext[dwCompare-1]) - break; - --dwCompare; - } - if(dwCompare) - break; - - --dwRest; - } - - const sal_Int32 dwNumEqualScanlines(dwRemaining-dwRest); - pScanline[1] = dwNumEqualScanlines; - pScanline += maPitch*dwNumEqualScanlines; - dwRemaining -= dwNumEqualScanlines; - - // since we track the total number of spans to generate, - // we need to account for consolidated scanlines here. - if(dwNumEqualScanlines > 1) - maNumberOfSpans -= dwNumSpans * (dwNumEqualScanlines-1); - } - } -} - -// TODO: we should consider passing a basegfx b2dpolypolygon here to -// ensure that the signature isn't misleading. -// if we could pass a b2dpolypolygon here, we could easily triangulate it. -void OutputDevice::ImplSetTriangleClipRegion( const PolyPolygon &rPolyPolygon ) -{ - DBG_TESTSOLARMUTEX(); - - if(!(IsDeviceOutputNecessary())) - return; - if(!(mpGraphics)) - if(!(ImplGetGraphics())) - return; - - if( mpGraphics->supportsOperation( OutDevSupport_B2DClip ) ) - { - // getB2DPolyPolygon() "optimizes away" some points - // which prevents reliable undoing of the "triangle thingy" parameter - // so the toolspoly -> b2dpoly conversion has to be done manually - ::basegfx::B2DPolyPolygon aB2DPolyPolygon; - for( USHORT nPolyIdx = 0; nPolyIdx < rPolyPolygon.Count(); ++nPolyIdx ) - { - const Polygon& rPolygon = rPolyPolygon[ nPolyIdx ]; - ::basegfx::B2DPolygon aB2DPoly; - for( USHORT nPointIdx = 0; nPointIdx < rPolygon.GetSize(); ++nPointIdx ) - { - const Point& rPoint = rPolygon[ nPointIdx ]; - const ::basegfx::B2DPoint aB2DPoint( rPoint.X(), rPoint.Y() ); - aB2DPoly.append( aB2DPoint ); - } - aB2DPolyPolygon.append( aB2DPoly ); - } - - const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation(); - aB2DPolyPolygon.transform( aTransform ); - - // the rPolyPolygon argument is a "triangle thingy" - // so convert it to a normal polypolyon first - ::basegfx::B2DPolyPolygon aPolyTriangle; - const int nPolyCount = aB2DPolyPolygon.count(); - for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx ) - { - const ::basegfx::B2DPolygon rPolygon = aB2DPolyPolygon.getB2DPolygon( nPolyIdx ); - const int nPointCount = rPolygon.count(); - for( int nPointIdx = 0; nPointIdx+2 < nPointCount; nPointIdx +=3 ) - { - ::basegfx::B2DPolygon aTriangle; - aTriangle.append( rPolygon.getB2DPoint( nPointIdx+0 ) ); - aTriangle.append( rPolygon.getB2DPoint( nPointIdx+1 ) ); - aTriangle.append( rPolygon.getB2DPoint( nPointIdx+2 ) ); - aPolyTriangle.append( aTriangle ); - } - } - - // now set the clip region with the real polypolygon - mpGraphics->BeginSetClipRegion( 0 ); - mpGraphics->UnionClipRegion( aPolyTriangle, this ); - mpGraphics->EndSetClipRegion(); - - // and mark the clip status as ready - mbOutputClipped = FALSE; - mbClipRegion = TRUE; - mbClipRegionSet = TRUE; - mbInitClipRegion = FALSE; - return; - } - - sal_Int32 offset_x = 0; - sal_Int32 offset_y = 0; - if ( GetOutDevType() == OUTDEV_WINDOW ) - { - offset_x = mnOutOffX+mnOutOffOrigX; - offset_y = mnOutOffY+mnOutOffOrigY; - } - - // first of all we need to know the upper limit - // of the amount of possible clipping regions. - sal_Int32 maxy = SAL_MIN_INT32; - sal_Int32 miny = SAL_MAX_INT32; - sal_uInt32 dwNumTriangles = 0; - for(USHORT i=0; i<rPolyPolygon.Count(); ++i) - { - const Polygon &rPoly = rPolyPolygon.GetObject(i); - const sal_Int32 dwNumVertices = rPoly.GetSize(); - if(!(dwNumVertices % 3)) - { - for(USHORT j=0; j<rPoly.GetSize(); ++j) - { - const Point &p = rPoly.GetPoint(j); - if(p.Y() < miny) - miny = p.Y(); - if(p.Y() > maxy) - maxy = p.Y(); - } - dwNumTriangles += dwNumVertices / 3; - } - } - - const sal_uInt32 dwNumScanlines = (maxy-miny); - if(!(dwNumScanlines)) - { - // indicates that no output needs to be produced - // since the clipping region did not provide any - // visible areas. - mbOutputClipped = TRUE; - - // indicates that a clip region has been - // presented to the output device. - mbClipRegion = TRUE; - - // indicates that the set clipping region - // has been processed. - mbClipRegionSet = TRUE; - - // under 'normal' circumstances a new clipping region - // needs to be processed by ImplInitClipRegion(), - // which we need to circumvent. - mbInitClipRegion = FALSE; - return; - } - - // this container provides all services we need to - // efficiently store/retrieve spans from the table. - const sal_uInt32 dwNumSpansPerScanline = dwNumTriangles; - ScanlineContainer container(dwNumScanlines,dwNumSpansPerScanline); - - // convert the incoming polypolygon to spans, we assume that - // the polypolygon has already been triangulated since we don't - // want to use the basegfx-types here. this could be leveraged - // after the tools-types had been removed. - for(USHORT i=0; i<rPolyPolygon.Count(); ++i) - { - const Polygon &rPoly = rPolyPolygon.GetObject(i); - const USHORT dwNumVertices = rPoly.GetSize(); - if(!(dwNumVertices % 3)) - { - for(USHORT j=0; j<dwNumVertices; j+=3) - { - const Point &p0 = rPoly.GetPoint(j+0); - const Point &p1 = rPoly.GetPoint(j+1); - const Point &p2 = rPoly.GetPoint(j+2); - - // what now follows is an extremely fast triangle - // rasterizer from which all tricky and interesting - // parts were forcibly amputated. - // note: top.left fill-convention - vertex v0(p0); - vertex v1(p1); - vertex v2(p2); - - //sprintf(string,"[%f,%f] [%f,%f] [%f,%f]\n",v0.x,v0.y,v1.x,v1.y,v2.x,v2.y); - //OSL_TRACE(string); - - if(v0.y > v2.y) ::swap(v0, v2); - if(v1.y > v2.y) ::swap(v1, v2); - if(v0.y > v1.y) ::swap(v0, v1); - - const float float2fixed(16.0f); - - // vertex coordinates of the triangle [28.4 fixed-point] - const int i4x0 = iround(float2fixed * (v0.x - 0.5f)); - const int i4y0 = iround(float2fixed * (v0.y - 0.5f)); - const int i4x1 = iround(float2fixed * (v1.x - 0.5f)); - const int i4y1 = iround(float2fixed * (v1.y - 0.5f)); - const int i4x2 = iround(float2fixed * (v2.x - 0.5f)); - const int i4y2 = iround(float2fixed * (v2.y - 0.5f)); - - // vertex coordinate deltas [28.4 fixed-point] - const int i4dx12 = i4x1-i4x0; - const int i4dy12 = i4y1-i4y0; - const int i4dx13 = i4x2-i4x0; - const int i4dy13 = i4y2-i4y0; - const int i4dx23 = i4x2-i4x1; - const int i4dy23 = i4y2-i4y1; - - // slope of edges [quotient,remainder] - const int mq12 = floorDiv(i4dx12 << 4, i4dy12 << 4); - const int mq13 = floorDiv(i4dx13 << 4, i4dy13 << 4); - const int mq23 = floorDiv(i4dx23 << 4, i4dy23 << 4); - const int mr12 = floorMod(i4dx12 << 4, i4dy12 << 4); - const int mr13 = floorMod(i4dx13 << 4, i4dy13 << 4); - const int mr23 = floorMod(i4dx23 << 4, i4dy23 << 4); - - // convert the vertical coordinates back to integers. - // according to the top-left fillrule we need to step - // the coordinates to the ceiling. - const int y0 = (i4y0+15)>>4; - const int y1 = (i4y1+15)>>4; - const int y2 = (i4y2+15)>>4; - - // calculate the value of the horizontal coordinate - // from the edge that 'spans' the triangle. - const int x = ceilDiv(i4dx13*i4dy12 + i4x0*i4dy13, i4dy13); - - // this will hold the horizontal coordinates - // of the seperate spans during the rasterization process. - int lx,rx; - - // this pair will serve as the error accumulator while - // we step along the edges. - int ld,rd,lD,rD; - - // these are the edge and error stepping values that - // will be used while stepping. - int lQ,rQ,lR,rR; - - if(i4x1 < x) - { - lx = ceilDiv(i4dx12 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy12, i4dy12 << 4); - ld = ceilMod(i4dx12 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy12, i4dy12 << 4); - rx = ceilDiv(i4dx13 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy13, i4dy13 << 4); - rd = ceilMod(i4dx13 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy13, i4dy13 << 4); - lQ = mq12; - rQ = mq13; - lR = mr12; - rR = mr13; - lD = i4dy12 << 4; - rD = i4dy13 << 4; - } - else - { - lx = ceilDiv(i4dx13 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy13, i4dy13 << 4); - ld = ceilMod(i4dx13 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy13, i4dy13 << 4); - rx = ceilDiv(i4dx12 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy12, i4dy12 << 4); - rd = ceilMod(i4dx12 * (ceilFix4(i4y0) - i4y0) + i4x0 * i4dy12, i4dy12 << 4); - lQ = mq13; - rQ = mq12; - lR = mr13; - rR = mr12; - lD = i4dy13 << 4; - rD = i4dy12 << 4; - } - - for(signed int y=y0; y<y1; y++) - { - container.InsertSpan(y-miny,lx,rx); - - lx += lQ; ld += lR; - if(ld > 0) { ld -= lD; lx += 1; } - rx += rQ; rd += rR; - if(rd > 0) { rd -= rD; rx += 1; } - } - - if(i4x1 < x) - { - lx = ceilDiv(i4dx23 * (ceilFix4(i4y1) - i4y1) + i4x1 * i4dy23, i4dy23 << 4); - ld = ceilMod(i4dx23 * (ceilFix4(i4y1) - i4y1) + i4x1 * i4dy23, i4dy23 << 4); - rx = ceilDiv(i4dx13 * (ceilFix4(i4y1) - i4y0) + i4x0 * i4dy13, i4dy13 << 4); - rd = ceilMod(i4dx13 * (ceilFix4(i4y1) - i4y0) + i4x0 * i4dy13, i4dy13 << 4); - lQ = mq23; - lR = mr23; - lD = i4dy23 << 4; - } - else - { - rx = ceilDiv(i4dx23 * (ceilFix4(i4y1) - i4y1) + i4x1 * i4dy23, i4dy23 << 4); - rd = ceilMod(i4dx23 * (ceilFix4(i4y1) - i4y1) + i4x1 * i4dy23, i4dy23 << 4); - rQ = mq23; - rR = mr23; - rD = i4dy23 << 4; - } - - for(signed int y=y1; y<y2; y++) - { - container.InsertSpan(y-miny,lx,rx); - - lx += lQ; ld += lR; - if(ld > 0) { ld -= lD; lx += 1; } - rx += rQ; rd += rR; - if(rd > 0) { rd -= rD; rx += 1; } - } - } - } - } - - // now try to consolidate as many scanlines as possible. - // please note that this will probably change the number - // of spans [at least this is why we do all this hassle]. - // so, if you use 'consolidate' you should *use* this - // information during iteration, because the 'graphics' - // object we tell all those regions about is a bit, - // hm, how to say, *picky* if you supply not correctly - // the amount of regions. - container.Consolidate(); - - // now forward the spantable to the graphics handler. - SpanIterator it(container.Iterate()); - mpGraphics->BeginSetClipRegion( container.GetNumSpans() ); - while(miny < maxy) - { - const sal_Int32 dwNumEqual(it.GetNumEqualScanlines()); - while(it.GetRemainingSpans()) - { - // retrieve the next span [x-coordinate, width] from the current scanline. - std::pair<sal_Int32,sal_Int32> span(it.GetNextSpan()); - - // now forward this to the graphics object. - // the only part that is worth noting is that we use - // the number of equal spanlines [the current is always the - // first one of the equal bunch] as the height of the region. - mpGraphics->UnionClipRegion( offset_x+span.first, - offset_y+miny, - span.second, - dwNumEqual, - this ); - } - it.Skip(dwNumEqual); - miny += dwNumEqual; - } - mpGraphics->EndSetClipRegion(); - - // indicates that no output needs to be produced - // since the clipping region did not provide any - // visible areas. the clip covers the whole area - // if there's not a single region. - mbOutputClipped = (container.GetNumSpans() == 0); - - // indicates that a clip region has been - // presented to the output device. - mbClipRegion = TRUE; - - // indicates that the set clipping region - // has been processed. - mbClipRegionSet = TRUE; - - // under 'normal' circumstances a new clipping region - // needs to be processed by ImplInitClipRegion(), - // which we need to circumvent. - mbInitClipRegion = FALSE; -} - -// ----------------------------------------------------------------------- - void OutputDevice::SetClipRegion() { DBG_TRACE( "OutputDevice::SetClipRegion()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaClipRegionAction( Region(), FALSE ) ); + mpMetaFile->AddAction( new MetaClipRegionAction( Region(), sal_False ) ); ImplSetClipRegion( NULL ); @@ -1825,7 +1068,7 @@ void OutputDevice::SetClipRegion( const Region& rRegion ) DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion ); if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaClipRegionAction( rRegion, TRUE ) ); + mpMetaFile->AddAction( new MetaClipRegionAction( rRegion, sal_True ) ); if ( rRegion.GetType() == REGION_NULL ) ImplSetClipRegion( NULL ); @@ -1841,42 +1084,6 @@ void OutputDevice::SetClipRegion( const Region& rRegion ) // ----------------------------------------------------------------------- -void OutputDevice::SetTriangleClipRegion( const PolyPolygon &rPolyPolygon ) -{ - DBG_TRACE( "OutputDevice::SetTriangleClipRegion( rPolyPolygon )" ); - DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); - - // in case the passed polypolygon is empty, use the - // existing SetClipRegion() method which gracefully - // unsets any previously set clipping region. - if(!(rPolyPolygon.Count())) - SetClipRegion(); - - sal_Int32 offset_x = 0; - sal_Int32 offset_y = 0; - if ( GetOutDevType() == OUTDEV_WINDOW ) - { - offset_x = mnOutOffX+mnOutOffOrigX; - offset_y = mnOutOffY+mnOutOffOrigY; - } - - // play nice with the rest of the system and provide an old-style region. - // the rest of this method does not rely on this. - maRegion = Region::GetRegionFromPolyPolygon( LogicToPixel(rPolyPolygon) ); - maRegion.Move(offset_x,offset_y); - - // feed region to metafile - if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaClipRegionAction( maRegion, TRUE ) ); - - ImplSetTriangleClipRegion( rPolyPolygon ); - - if( mpAlphaVDev ) - mpAlphaVDev->SetTriangleClipRegion( rPolyPolygon ); -} - -// ----------------------------------------------------------------------- - Region OutputDevice::GetClipRegion() const { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -1921,7 +1128,7 @@ void OutputDevice::MoveClipRegion( long nHorzMove, long nVertMove ) maRegion.Move( ImplLogicWidthToDevicePixel( nHorzMove ), ImplLogicHeightToDevicePixel( nVertMove ) ); - mbInitClipRegion = TRUE; + mbInitClipRegion = sal_True; } if( mpAlphaVDev ) @@ -1940,8 +1147,8 @@ void OutputDevice::IntersectClipRegion( const Rectangle& rRect ) Rectangle aRect = LogicToPixel( rRect ); maRegion.Intersect( aRect ); - mbClipRegion = TRUE; - mbInitClipRegion = TRUE; + mbClipRegion = sal_True; + mbInitClipRegion = sal_True; if( mpAlphaVDev ) mpAlphaVDev->IntersectClipRegion( rRect ); @@ -1964,8 +1171,8 @@ void OutputDevice::IntersectClipRegion( const Region& rRegion ) Region aRegion = LogicToPixel( rRegion ); maRegion.Intersect( aRegion ); - mbClipRegion = TRUE; - mbInitClipRegion = TRUE; + mbClipRegion = sal_True; + mbInitClipRegion = sal_True; } if( mpAlphaVDev ) @@ -1974,7 +1181,7 @@ void OutputDevice::IntersectClipRegion( const Region& rRegion ) // ----------------------------------------------------------------------- -void OutputDevice::SetDrawMode( ULONG nDrawMode ) +void OutputDevice::SetDrawMode( sal_uLong nDrawMode ) { DBG_TRACE1( "OutputDevice::SetDrawMode( %lx )", nDrawMode ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -1998,7 +1205,7 @@ void OutputDevice::SetRasterOp( RasterOp eRasterOp ) if ( meRasterOp != eRasterOp ) { meRasterOp = eRasterOp; - mbInitLineColor = mbInitFillColor = TRUE; + mbInitLineColor = mbInitFillColor = sal_True; if( mpGraphics || ImplGetGraphics() ) mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp), ROP_INVERT == meRasterOp ); @@ -2016,12 +1223,12 @@ void OutputDevice::SetLineColor() DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaLineColorAction( Color(), FALSE ) ); + mpMetaFile->AddAction( new MetaLineColorAction( Color(), sal_False ) ); if ( mbLineColor ) { - mbInitLineColor = TRUE; - mbLineColor = FALSE; + mbInitLineColor = sal_True; + mbLineColor = sal_False; maLineColor = Color( COL_TRANSPARENT ); } @@ -2054,7 +1261,7 @@ void OutputDevice::SetLineColor( const Color& rColor ) } else if( mnDrawMode & DRAWMODE_GRAYLINE ) { - const UINT8 cLum = aColor.GetLuminance(); + const sal_uInt8 cLum = aColor.GetLuminance(); aColor = Color( cLum, cLum, cLum ); } else if( mnDrawMode & DRAWMODE_SETTINGSLINE ) @@ -2072,14 +1279,14 @@ void OutputDevice::SetLineColor( const Color& rColor ) } if( mpMetaFile ) - mpMetaFile->AddAction( new MetaLineColorAction( aColor, TRUE ) ); + mpMetaFile->AddAction( new MetaLineColorAction( aColor, sal_True ) ); if( ImplIsColorTransparent( aColor ) ) { if ( mbLineColor ) { - mbInitLineColor = TRUE; - mbLineColor = FALSE; + mbInitLineColor = sal_True; + mbLineColor = sal_False; maLineColor = Color( COL_TRANSPARENT ); } } @@ -2087,8 +1294,8 @@ void OutputDevice::SetLineColor( const Color& rColor ) { if( maLineColor != aColor ) { - mbInitLineColor = TRUE; - mbLineColor = TRUE; + mbInitLineColor = sal_True; + mbLineColor = sal_True; maLineColor = aColor; } } @@ -2105,12 +1312,12 @@ void OutputDevice::SetFillColor() DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaFillColorAction( Color(), FALSE ) ); + mpMetaFile->AddAction( new MetaFillColorAction( Color(), sal_False ) ); if ( mbFillColor ) { - mbInitFillColor = TRUE; - mbFillColor = FALSE; + mbInitFillColor = sal_True; + mbFillColor = sal_False; maFillColor = Color( COL_TRANSPARENT ); } @@ -2143,7 +1350,7 @@ void OutputDevice::SetFillColor( const Color& rColor ) } else if( mnDrawMode & DRAWMODE_GRAYFILL ) { - const UINT8 cLum = aColor.GetLuminance(); + const sal_uInt8 cLum = aColor.GetLuminance(); aColor = Color( cLum, cLum, cLum ); } else if( mnDrawMode & DRAWMODE_NOFILL ) @@ -2165,14 +1372,14 @@ void OutputDevice::SetFillColor( const Color& rColor ) } if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaFillColorAction( aColor, TRUE ) ); + mpMetaFile->AddAction( new MetaFillColorAction( aColor, sal_True ) ); if ( ImplIsColorTransparent( aColor ) ) { if ( mbFillColor ) { - mbInitFillColor = TRUE; - mbFillColor = FALSE; + mbInitFillColor = sal_True; + mbFillColor = sal_False; maFillColor = Color( COL_TRANSPARENT ); } } @@ -2180,8 +1387,8 @@ void OutputDevice::SetFillColor( const Color& rColor ) { if ( maFillColor != aColor ) { - mbInitFillColor = TRUE; - mbFillColor = TRUE; + mbInitFillColor = sal_True; + mbFillColor = sal_True; maFillColor = aColor; } } @@ -2198,7 +1405,7 @@ void OutputDevice::SetBackground() DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); maBackground = Wallpaper(); - mbBackground = FALSE; + mbBackground = sal_False; if( mpAlphaVDev ) mpAlphaVDev->SetBackground(); @@ -2214,9 +1421,9 @@ void OutputDevice::SetBackground( const Wallpaper& rBackground ) maBackground = rBackground; if( rBackground.GetStyle() == WALLPAPER_NULL ) - mbBackground = FALSE; + mbBackground = sal_False; else - mbBackground = TRUE; + mbBackground = sal_True; if( mpAlphaVDev ) mpAlphaVDev->SetBackground( rBackground ); @@ -2230,9 +1437,9 @@ void OutputDevice::SetRefPoint() DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaRefPointAction( Point(), FALSE ) ); + mpMetaFile->AddAction( new MetaRefPointAction( Point(), sal_False ) ); - mbRefPoint = FALSE; + mbRefPoint = sal_False; maRefPoint.X() = maRefPoint.Y() = 0L; if( mpAlphaVDev ) @@ -2247,9 +1454,9 @@ void OutputDevice::SetRefPoint( const Point& rRefPoint ) DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaRefPointAction( rRefPoint, TRUE ) ); + mpMetaFile->AddAction( new MetaRefPointAction( rRefPoint, sal_True ) ); - mbRefPoint = TRUE; + mbRefPoint = sal_True; maRefPoint = rRefPoint; if( mpAlphaVDev ) @@ -2560,7 +1767,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly ) if( mpMetaFile ) mpMetaFile->AddAction( new MetaPolyLineAction( rPoly ) ); - USHORT nPoints = rPoly.GetSize(); + sal_uInt16 nPoints = rPoly.GetSize(); if ( !IsDeviceOutputNecessary() || !mbLineColor || (nPoints < 2) || ImplIsRecordLayout() ) return; @@ -2610,7 +1817,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly ) // #100127# Forward beziers to sal, if any if( aPoly.HasFlags() ) { - const BYTE* pFlgAry = aPoly.GetConstFlagAry(); + const sal_uInt8* pFlgAry = aPoly.GetConstFlagAry(); if( !mpGraphics->DrawPolyLineBezier( nPoints, pPtAry, pFlgAry, this ) ) { aPoly = ImplSubdivideBezier(aPoly); @@ -2658,7 +1865,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineInfo& rLineInfo) { - USHORT nPoints(rPoly.GetSize()); + sal_uInt16 nPoints(rPoly.GetSize()); if ( !IsDeviceOutputNecessary() || !mbLineColor || ( nPoints < 2 ) || ( LINE_NONE == rLineInfo.GetStyle() ) || ImplIsRecordLayout() ) return; @@ -2730,7 +1937,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly ) if( mpMetaFile ) mpMetaFile->AddAction( new MetaPolygonAction( rPoly ) ); - USHORT nPoints = rPoly.GetSize(); + sal_uInt16 nPoints = rPoly.GetSize(); if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || (nPoints < 2) || ImplIsRecordLayout() ) return; @@ -2793,7 +2000,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly ) // #100127# Forward beziers to sal, if any if( aPoly.HasFlags() ) { - const BYTE* pFlgAry = aPoly.GetConstFlagAry(); + const sal_uInt8* pFlgAry = aPoly.GetConstFlagAry(); if( !mpGraphics->DrawPolygonBezier( nPoints, pPtAry, pFlgAry, this ) ) { aPoly = ImplSubdivideBezier(aPoly); @@ -2820,7 +2027,7 @@ void OutputDevice::DrawPolyPolygon( const PolyPolygon& rPolyPoly ) if( mpMetaFile ) mpMetaFile->AddAction( new MetaPolyPolygonAction( rPolyPoly ) ); - USHORT nPoly = rPolyPoly.Count(); + sal_uInt16 nPoly = rPolyPoly.Count(); if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || !nPoly || ImplIsRecordLayout() ) return; @@ -3137,7 +2344,21 @@ void OutputDevice::DrawPolyLine( // ----------------------------------------------------------------------- -void OutputDevice::Push( USHORT nFlags ) +sal_uInt32 OutputDevice::GetGCStackDepth() const +{ + const ImplObjStack* pData = mpObjStack; + sal_uInt32 nDepth = 0; + while( pData ) + { + nDepth++; + pData = pData->mpPrev; + } + return nDepth; +} + +// ----------------------------------------------------------------------- + +void OutputDevice::Push( sal_uInt16 nFlags ) { DBG_TRACE( "OutputDevice::Push()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -3327,7 +2548,7 @@ void OutputDevice::SetConnectMetaFile( GDIMetaFile* pMtf ) // ----------------------------------------------------------------------- -void OutputDevice::EnableOutput( BOOL bEnable ) +void OutputDevice::EnableOutput( sal_Bool bEnable ) { mbOutput = (bEnable != 0); @@ -3347,7 +2568,7 @@ void OutputDevice::SetSettings( const AllSettings& rSettings ) // ----------------------------------------------------------------------- -USHORT OutputDevice::GetBitCount() const +sal_uInt16 OutputDevice::GetBitCount() const { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -3361,12 +2582,12 @@ USHORT OutputDevice::GetBitCount() const return 0; } - return (USHORT)mpGraphics->GetBitCount(); + return (sal_uInt16)mpGraphics->GetBitCount(); } // ----------------------------------------------------------------------- -USHORT OutputDevice::GetAlphaBitCount() const +sal_uInt16 OutputDevice::GetAlphaBitCount() const { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -3381,17 +2602,17 @@ USHORT OutputDevice::GetAlphaBitCount() const // ----------------------------------------------------------------------- -ULONG OutputDevice::GetColorCount() const +sal_uLong OutputDevice::GetColorCount() const { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); - const USHORT nBitCount = GetBitCount(); - return( ( nBitCount > 31 ) ? ULONG_MAX : ( ( (ULONG) 1 ) << nBitCount) ); + const sal_uInt16 nBitCount = GetBitCount(); + return( ( nBitCount > 31 ) ? ULONG_MAX : ( ( (sal_uLong) 1 ) << nBitCount) ); } // ----------------------------------------------------------------------- -BOOL OutputDevice::HasAlpha() +sal_Bool OutputDevice::HasAlpha() { return mpAlphaVDev != NULL; } diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx index 4cae28705edf..f00ca53b400d 100644 --- a/vcl/source/gdi/outdev2.cxx +++ b/vcl/source/gdi/outdev2.cxx @@ -86,17 +86,17 @@ DBG_NAMEEX( OutputDevice ) // - externals - // ------------- -extern ULONG nVCLRLut[ 6 ]; -extern ULONG nVCLGLut[ 6 ]; -extern ULONG nVCLBLut[ 6 ]; -extern ULONG nVCLDitherLut[ 256 ]; -extern ULONG nVCLLut[ 256 ]; +extern sal_uLong nVCLRLut[ 6 ]; +extern sal_uLong nVCLGLut[ 6 ]; +extern sal_uLong nVCLBLut[ 6 ]; +extern sal_uLong nVCLDitherLut[ 256 ]; +extern sal_uLong nVCLLut[ 256 ]; // ======================================================================= -ULONG ImplAdjustTwoRect( TwoRect& rTwoRect, const Size& rSizePix ) +sal_uLong ImplAdjustTwoRect( TwoRect& rTwoRect, const Size& rSizePix ) { - ULONG nMirrFlags = 0; + sal_uLong nMirrFlags = 0; if ( rTwoRect.mnDestWidth < 0 ) { @@ -388,7 +388,7 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, void OutputDevice::CopyArea( const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize, - USHORT nFlags ) + sal_uInt16 nFlags ) { DBG_TRACE( "OutputDevice::CopyArea()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -433,7 +433,7 @@ void OutputDevice::CopyArea( const Point& rDestPt, ((Window*)this)->ImplMoveAllInvalidateRegions( aSrcRect, aPosAry.mnDestX-aPosAry.mnSrcX, aPosAry.mnDestY-aPosAry.mnSrcY, - FALSE ); + sal_False ); mpGraphics->CopyArea( aPosAry.mnDestX, aPosAry.mnDestY, aPosAry.mnSrcX, aPosAry.mnSrcY, @@ -463,10 +463,10 @@ void OutputDevice::ImplDrawFrameDev( const Point& rPt, const Point& rDevPt, cons DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); GDIMetaFile* pOldMetaFile = mpMetaFile; - BOOL bOldMap = mbMap; + sal_Bool bOldMap = mbMap; RasterOp eOldROP = GetRasterOp(); mpMetaFile = NULL; - mbMap = FALSE; + mbMap = sal_False; SetRasterOp( ROP_OVERPAINT ); if ( !IsDeviceOutputNecessary() ) @@ -496,7 +496,7 @@ void OutputDevice::ImplDrawFrameDev( const Point& rPt, const Point& rDevPt, cons ImplDrawOutDevDirect( &rOutDev, &aPosAry ); // Dafuer sorgen, das ClipRegion neu berechnet und gesetzt wird - mbInitClipRegion = TRUE; + mbInitClipRegion = sal_True; SetRasterOp( eOldROP ); mbMap = bOldMap; @@ -510,8 +510,8 @@ void OutputDevice::ImplGetFrameDev( const Point& rPt, const Point& rDevPt, const { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); - BOOL bOldMap = mbMap; - mbMap = FALSE; + sal_Bool bOldMap = mbMap; + mbMap = sal_False; rDev.DrawOutDev( rDevPt, rDevSize, rPt, rDevSize, *this ); mbMap = bOldMap; } @@ -577,7 +577,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize, void OutputDevice::ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, - const Bitmap& rBitmap, const ULONG nAction ) + const Bitmap& rBitmap, const sal_uLong nAction ) { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -595,7 +595,7 @@ void OutputDevice::ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize, { if ( mnDrawMode & ( DRAWMODE_BLACKBITMAP | DRAWMODE_WHITEBITMAP ) ) { - BYTE cCmpVal; + sal_uInt8 cCmpVal; if ( mnDrawMode & DRAWMODE_BLACKBITMAP ) cCmpVal = ( mnDrawMode & DRAWMODE_GHOSTEDBITMAP ) ? 0x80 : 0; @@ -654,7 +654,7 @@ void OutputDevice::ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize, aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() ); aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() ); - const ULONG nMirrFlags = ImplAdjustTwoRect( aPosAry, aBmp.GetSizePixel() ); + const sal_uLong nMirrFlags = ImplAdjustTwoRect( aPosAry, aBmp.GetSizePixel() ); if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight ) { @@ -788,7 +788,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, void OutputDevice::ImplDrawBitmapEx( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, - const BitmapEx& rBitmapEx, const ULONG nAction ) + const BitmapEx& rBitmapEx, const sal_uLong nAction ) { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -807,7 +807,7 @@ void OutputDevice::ImplDrawBitmapEx( const Point& rDestPt, const Size& rDestSize if ( mnDrawMode & ( DRAWMODE_BLACKBITMAP | DRAWMODE_WHITEBITMAP ) ) { Bitmap aColorBmp( aBmpEx.GetSizePixel(), ( mnDrawMode & DRAWMODE_GHOSTEDBITMAP ) ? 4 : 1 ); - BYTE cCmpVal; + sal_uInt8 cCmpVal; if ( mnDrawMode & DRAWMODE_BLACKBITMAP ) cCmpVal = ( mnDrawMode & DRAWMODE_GHOSTEDBITMAP ) ? 0x80 : 0; @@ -901,7 +901,7 @@ void OutputDevice::ImplDrawBitmapEx( const Point& rDestPt, const Size& rDestSize aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() ); aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() ); - const ULONG nMirrFlags = ImplAdjustTwoRect( aPosAry, aBmpEx.GetSizePixel() ); + const sal_uLong nMirrFlags = ImplAdjustTwoRect( aPosAry, aBmpEx.GetSizePixel() ); if( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight ) { @@ -1095,7 +1095,7 @@ void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize, void OutputDevice::ImplDrawMask( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, const Bitmap& rBitmap, const Color& rMaskColor, - const ULONG nAction ) + const sal_uLong nAction ) { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -1149,7 +1149,7 @@ void OutputDevice::ImplDrawMask( const Point& rDestPt, const Size& rDestSize, aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() ); // spiegeln via Koordinaten wollen wir nicht - const ULONG nMirrFlags = ImplAdjustTwoRect( aPosAry, pImpBmp->ImplGetSize() ); + const sal_uLong nMirrFlags = ImplAdjustTwoRect( aPosAry, pImpBmp->ImplGetSize() ); // check if output is necessary if( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight ) @@ -1172,7 +1172,7 @@ void OutputDevice::ImplDrawMask( const Point& rDestPt, const Size& rDestSize, // ------------------------------------------------------------------ -void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, USHORT nStyle ) +void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, sal_uInt16 nStyle ) { DBG_ASSERT( GetOutDevType() != OUTDEV_PRINTER, "DrawImage(): Images can't be drawn on any mprinter" ); @@ -1209,7 +1209,7 @@ void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, USHORT nSt // ------------------------------------------------------------------ void OutputDevice::DrawImage( const Point& rPos, const Size& rSize, - const Image& rImage, USHORT nStyle ) + const Image& rImage, sal_uInt16 nStyle ) { DBG_ASSERT( GetOutDevType() != OUTDEV_PRINTER, "DrawImage(): Images can't be drawn on any mprinter" ); @@ -1260,14 +1260,14 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const if ( nWidth && nHeight ) { Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) ); - BOOL bClipped = FALSE; + sal_Bool bClipped = sal_False; // X-Koordinate ausserhalb des Bereichs? if ( nX < mnOutOffX ) { nWidth -= ( mnOutOffX - nX ); nX = mnOutOffX; - bClipped = TRUE; + bClipped = sal_True; } // Y-Koordinate ausserhalb des Bereichs? @@ -1275,21 +1275,21 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const { nHeight -= ( mnOutOffY - nY ); nY = mnOutOffY; - bClipped = TRUE; + bClipped = sal_True; } // Breite ausserhalb des Bereichs? if ( (nWidth + nX) > (mnOutWidth + mnOutOffX) ) { nWidth = mnOutOffX + mnOutWidth - nX; - bClipped = TRUE; + bClipped = sal_True; } // Hoehe ausserhalb des Bereichs? if ( (nHeight + nY) > (mnOutHeight + mnOutOffY) ) { nHeight = mnOutOffY + mnOutHeight - nY; - bClipped = TRUE; + bClipped = sal_True; } if ( bClipped ) @@ -1321,10 +1321,10 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const aBmp = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() ); } else - bClipped = FALSE; + bClipped = sal_False; } else - bClipped = FALSE; + bClipped = sal_False; } if ( !bClipped ) @@ -1372,8 +1372,8 @@ void OutputDevice::ImplGetFrameBitmap( const Point& rDestPt, const Size& rSize, { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); - BOOL bOldMap = mbMap; - ((OutputDevice*)this)->mbMap = FALSE; + sal_Bool bOldMap = mbMap; + ((OutputDevice*)this)->mbMap = sal_False; rBitmap = GetBitmap( rDestPt, rSize ); ((OutputDevice*)this)->mbMap = bOldMap; } @@ -1411,7 +1411,7 @@ Color* OutputDevice::GetPixel( const Polygon& rPts ) const DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color* pColors = NULL; - const USHORT nSize = rPts.GetSize(); + const sal_uInt16 nSize = rPts.GetSize(); if( nSize ) { @@ -1424,7 +1424,7 @@ Color* OutputDevice::GetPixel( const Polygon& rPts ) const { pColors = new Color[ nSize ]; - for( USHORT i = 0; i < nSize; i++ ) + for( sal_uInt16 i = 0; i < nSize; i++ ) { Color& rCol = pColors[ i ]; const Point& rPt = rPts[ i ]; @@ -1503,7 +1503,7 @@ void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor ) } else if( mnDrawMode & DRAWMODE_GRAYLINE ) { - const UINT8 cLum = aColor.GetLuminance(); + const sal_uInt8 cLum = aColor.GetLuminance(); aColor = Color( cLum, cLum, cLum ); } else if( mnDrawMode & DRAWMODE_SETTINGSLINE ) @@ -1558,12 +1558,12 @@ void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors ) DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_ASSERT( pColors, "OutputDevice::DrawPixel: No color array specified" ); - const USHORT nSize = rPts.GetSize(); + const sal_uInt16 nSize = rPts.GetSize(); if ( nSize ) { if ( mpMetaFile ) - for ( USHORT i = 0; i < nSize; i++ ) + for ( sal_uInt16 i = 0; i < nSize; i++ ) mpMetaFile->AddAction( new MetaPixelAction( rPts[ i ], pColors[ i ] ) ); if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() ) @@ -1578,7 +1578,7 @@ void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors ) if ( mbOutputClipped ) return; - for ( USHORT i = 0; i < nSize; i++ ) + for ( sal_uInt16 i = 0; i < nSize; i++ ) { const Point aPt( ImplLogicToDevicePixel( rPts[ i ] ) ); mpGraphics->DrawPixel( aPt.X(), aPt.Y(), ImplColorToSal( pColors[ i ] ), this ); @@ -1597,10 +1597,10 @@ void OutputDevice::DrawPixel( const Polygon& rPts, const Color& rColor ) { if( rColor != COL_TRANSPARENT && ! ImplIsRecordLayout() ) { - const USHORT nSize = rPts.GetSize(); + const sal_uInt16 nSize = rPts.GetSize(); Color* pColArray = new Color[ nSize ]; - for( USHORT i = 0; i < nSize; i++ ) + for( sal_uInt16 i = 0; i < nSize; i++ ) pColArray[ i ] = rColor; DrawPixel( rPts, pColArray ); @@ -1615,11 +1615,11 @@ void OutputDevice::DrawPixel( const Polygon& rPts, const Color& rColor ) namespace { - BYTE lcl_calcColor( const BYTE nSourceColor, const BYTE nSourceOpaq, const BYTE nDestColor ) + sal_uInt8 lcl_calcColor( const sal_uInt8 nSourceColor, const sal_uInt8 nSourceOpaq, const sal_uInt8 nDestColor ) { int c = ( (int)nDestColor * ( 255 - nSourceOpaq ) ) + (int)nSourceOpaq * (int)nSourceColor; - return BYTE( c / 255 ); + return sal_uInt8( c / 255 ); } } @@ -1643,8 +1643,8 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap aBmp, OSL_ENSURE(mpAlphaVDev, "ImplBlendWithAlpha(): call me only with valid alpha VDev!" ); - BOOL bOldMapMode( mpAlphaVDev->IsMapModeEnabled() ); - mpAlphaVDev->EnableMapMode(FALSE); + sal_Bool bOldMapMode( mpAlphaVDev->IsMapModeEnabled() ); + mpAlphaVDev->EnableMapMode(sal_False); Bitmap aAlphaBitmap( mpAlphaVDev->GetBitmap( aDstRect.TopLeft(), aDstRect.GetSize() ) ); BitmapWriteAccess* pAlphaW = aAlphaBitmap.AcquireWriteAccess(); @@ -1666,18 +1666,18 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap aBmp, for( nX = 0, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ ) { const long nMapX = pMapX[ nX ]; - const ULONG nD = nVCLDitherLut[ nModY | ( nOutX & 0x0FL ) ]; + const sal_uLong nD = nVCLDitherLut[ nModY | ( nOutX & 0x0FL ) ]; aSrcCol = pP->GetColor( nMapY, nMapX ); aDstCol = pB->GetColor( nY, nX ); - const BYTE nSrcOpaq = 255 - pA->GetPixel( nMapY, nMapX ).GetBlueOrIndex(); - const BYTE nDstOpaq = 255 - pAlphaW->GetPixel( nY, nX ).GetBlueOrIndex(); + const sal_uInt8 nSrcOpaq = 255 - pA->GetPixel( nMapY, nMapX ).GetBlueOrIndex(); + const sal_uInt8 nDstOpaq = 255 - pAlphaW->GetPixel( nY, nX ).GetBlueOrIndex(); aDstCol.SetRed( lcl_calcColor( aSrcCol.GetRed(), nSrcOpaq, aDstCol.GetRed() ) ); aDstCol.SetBlue( lcl_calcColor( aSrcCol.GetBlue(), nSrcOpaq, aDstCol.GetBlue() ) ); aDstCol.SetGreen( lcl_calcColor( aSrcCol.GetGreen(), nSrcOpaq, aDstCol.GetGreen() ) ); - aIndex.SetIndex( (BYTE) ( nVCLRLut[ ( nVCLLut[ aDstCol.GetRed() ] + nD ) >> 16UL ] + + aIndex.SetIndex( (sal_uInt8) ( nVCLRLut[ ( nVCLLut[ aDstCol.GetRed() ] + nD ) >> 16UL ] + nVCLGLut[ ( nVCLLut[ aDstCol.GetGreen() ] + nD ) >> 16UL ] + nVCLBLut[ ( nVCLLut[ aDstCol.GetBlue() ] + nD ) >> 16UL ] ) ); pW->SetPixel( nY, nX, aIndex ); @@ -1686,9 +1686,9 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap aBmp, // the inverse alpha space (with 255 meaning // opaque), otherwise, transitivity is not // achieved. - const BYTE nSrcAlpha = 255-COLOR_CHANNEL_MERGE( 255, (BYTE)nDstOpaq, nSrcOpaq ); + const sal_uInt8 nSrcAlpha = 255-COLOR_CHANNEL_MERGE( 255, (sal_uInt8)nDstOpaq, nSrcOpaq ); - aIndex.SetIndex( (BYTE) ( nVCLRLut[ ( nVCLLut[ nSrcAlpha ] + nD ) >> 16UL ] + + aIndex.SetIndex( (sal_uInt8) ( nVCLRLut[ ( nVCLLut[ nSrcAlpha ] + nD ) >> 16UL ] + nVCLGLut[ ( nVCLLut[ nSrcAlpha ] + nD ) >> 16UL ] + nVCLBLut[ ( nVCLLut[ nSrcAlpha ] + nD ) >> 16UL ] ) ); pAlphaW->SetPixel( nY, nX, aIndex ); @@ -1715,8 +1715,8 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap aBmp, aSrcCol = pP->GetColor( nMapY, nMapX ); aDstCol = pB->GetColor( nY, nX ); - const BYTE nSrcOpaq = 255 - pA->GetPixel( nMapY, nMapX ).GetBlueOrIndex(); - const BYTE nDstOpaq = 255 - pAlphaW->GetPixel( nY, nX ).GetBlueOrIndex(); + const sal_uInt8 nSrcOpaq = 255 - pA->GetPixel( nMapY, nMapX ).GetBlueOrIndex(); + const sal_uInt8 nDstOpaq = 255 - pAlphaW->GetPixel( nY, nX ).GetBlueOrIndex(); aDstCol.SetRed( lcl_calcColor( aSrcCol.GetRed(), nSrcOpaq, aDstCol.GetRed() ) ); aDstCol.SetBlue( lcl_calcColor( aSrcCol.GetBlue(), nSrcOpaq, aDstCol.GetBlue() ) ); @@ -1728,7 +1728,7 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap aBmp, // the inverse alpha space (with 255 meaning // opaque), otherwise, transitivity is not // achieved. - const BYTE nSrcAlpha = 255-COLOR_CHANNEL_MERGE( 255, (BYTE)nDstOpaq, nSrcOpaq ); + const sal_uInt8 nSrcAlpha = 255-COLOR_CHANNEL_MERGE( 255, (sal_uInt8)nDstOpaq, nSrcOpaq ); pAlphaW->SetPixel( nY, nX, Color(nSrcAlpha, nSrcAlpha, nSrcAlpha) ); } @@ -1783,11 +1783,11 @@ Bitmap OutputDevice::ImplBlend( Bitmap aBmp, for( nX = 0, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ ) { const long nMapX = pMapX[ nX ]; - const ULONG nD = nVCLDitherLut[ nModY | ( nOutX & 0x0FL ) ]; + const sal_uLong nD = nVCLDitherLut[ nModY | ( nOutX & 0x0FL ) ]; aDstCol = pB->GetColor( nY, nX ); - aDstCol.Merge( pP->GetColor( nMapY, nMapX ), (BYTE) pA->GetPixel( nMapY, nMapX ) ); - aIndex.SetIndex( (BYTE) ( nVCLRLut[ ( nVCLLut[ aDstCol.GetRed() ] + nD ) >> 16UL ] + + aDstCol.Merge( pP->GetColor( nMapY, nMapX ), (sal_uInt8) pA->GetPixel( nMapY, nMapX ) ); + aIndex.SetIndex( (sal_uInt8) ( nVCLRLut[ ( nVCLLut[ aDstCol.GetRed() ] + nD ) >> 16UL ] + nVCLGLut[ ( nVCLLut[ aDstCol.GetGreen() ] + nD ) >> 16UL ] + nVCLBLut[ ( nVCLLut[ aDstCol.GetBlue() ] + nD ) >> 16UL ] ) ); pW->SetPixel( nY, nX, aIndex ); @@ -1922,7 +1922,7 @@ void OutputDevice::ImplDrawAlpha( const Bitmap& rBmp, const AlphaMask& rAlpha, Point aOutPt( LogicToPixel( rDestPt ) ); Size aOutSz( LogicToPixel( rDestSize ) ); Rectangle aDstRect( aNullPt, GetOutputSizePixel() ); - const BOOL bHMirr = aOutSz.Width() < 0, bVMirr = aOutSz.Height() < 0; + const sal_Bool bHMirr = aOutSz.Width() < 0, bVMirr = aOutSz.Height() < 0; if( OUTDEV_WINDOW == meOutDevType ) { @@ -1971,7 +1971,7 @@ void OutputDevice::ImplDrawAlpha( const Bitmap& rBmp, const AlphaMask& rAlpha, && !aBmpRect.Intersection( Rectangle( rSrcPtPixel, rSrcSizePixel ) ).IsEmpty() ) { GDIMetaFile* pOldMetaFile = mpMetaFile; mpMetaFile = NULL; - const BOOL bOldMap = mbMap; mbMap = FALSE; + const sal_Bool bOldMap = mbMap; mbMap = sal_False; Bitmap aBmp( GetBitmap( aDstRect.TopLeft(), aDstRect.GetSize() ) ); // #109044# The generated bitmap need not necessarily be @@ -2096,7 +2096,7 @@ void OutputDevice::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask if( !rBmp.IsEmpty() && aSrcRect.GetWidth() && aSrcRect.GetHeight() && aDestSz.Width() && aDestSz.Height() ) { Bitmap aPaint( rBmp ), aMask( rMask ); - ULONG nMirrFlags = 0UL; + sal_uLong nMirrFlags = 0UL; if( aMask.GetBitCount() > 1 ) aMask.Convert( BMP_CONVERSION_1BIT_THRESHOLD ); @@ -2143,9 +2143,9 @@ void OutputDevice::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask long nX, nY, nWorkX, nWorkY, nWorkWidth, nWorkHeight; long* pMapX = new long[ nSrcWidth + 1 ]; long* pMapY = new long[ nSrcHeight + 1 ]; - const BOOL bOldMap = mbMap; + const sal_Bool bOldMap = mbMap; - mbMap = FALSE; + mbMap = sal_False; // create forward mapping tables for( nX = 0L; nX <= nSrcWidth; nX++ ) @@ -2157,7 +2157,7 @@ void OutputDevice::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask // walk through all rectangles of mask Region aWorkRgn( aMask.CreateRegion( COL_BLACK, Rectangle( Point(), aMask.GetSizePixel() ) ) ); ImplRegionInfo aInfo; - BOOL bRgnRect = aWorkRgn.ImplGetFirstRect( aInfo, nWorkX, nWorkY, nWorkWidth, nWorkHeight ); + sal_Bool bRgnRect = aWorkRgn.ImplGetFirstRect( aInfo, nWorkX, nWorkY, nWorkWidth, nWorkHeight ); while( bRgnRect ) { @@ -2194,7 +2194,7 @@ void OutputDevice::ImplPrintMask( const Bitmap& rMask, const Color& rMaskColor, if( !rMask.IsEmpty() && aSrcRect.GetWidth() && aSrcRect.GetHeight() && aDestSz.Width() && aDestSz.Height() ) { Bitmap aMask( rMask ); - ULONG nMirrFlags = 0UL; + sal_uLong nMirrFlags = 0UL; if( aMask.GetBitCount() > 1 ) aMask.Convert( BMP_CONVERSION_1BIT_THRESHOLD ); @@ -2229,10 +2229,10 @@ void OutputDevice::ImplPrintMask( const Bitmap& rMask, const Color& rMaskColor, long* pMapX = new long[ nSrcWidth + 1 ]; long* pMapY = new long[ nSrcHeight + 1 ]; GDIMetaFile* pOldMetaFile = mpMetaFile; - const BOOL bOldMap = mbMap; + const sal_Bool bOldMap = mbMap; mpMetaFile = NULL; - mbMap = FALSE; + mbMap = sal_False; Push( PUSH_FILLCOLOR | PUSH_LINECOLOR ); SetLineColor( rMaskColor ); SetFillColor( rMaskColor ); @@ -2249,7 +2249,7 @@ void OutputDevice::ImplPrintMask( const Bitmap& rMask, const Color& rMaskColor, // walk through all rectangles of mask Region aWorkRgn( aMask.CreateRegion( COL_BLACK, Rectangle( Point(), aMask.GetSizePixel() ) ) ); ImplRegionInfo aInfo; - BOOL bRgnRect = aWorkRgn.ImplGetFirstRect( aInfo, nWorkX, nWorkY, nWorkWidth, nWorkHeight ); + sal_Bool bRgnRect = aWorkRgn.ImplGetFirstRect( aInfo, nWorkX, nWorkY, nWorkWidth, nWorkHeight ); while( bRgnRect ) { diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index b41fa00c95ff..fd399c6c0a11 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -28,56 +28,57 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <cstring> -#include <i18npool/mslangid.hxx> - -#include <svsys.h> -#include <vcl/salgdi.hxx> -#include <vcl/sallayout.hxx> -#include <rtl/tencinfo.h> -#include <tools/debug.hxx> -#include <vcl/svdata.hxx> -#include <vcl/metric.hxx> -#include <vcl/impfont.hxx> -#include <vcl/metaact.hxx> -#include <vcl/gdimtf.hxx> -#include <vcl/outdata.hxx> -#include <vcl/outfont.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/polygon/b2dpolypolygon.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <tools/poly.hxx> -#include <vcl/outdev.h> -#include <vcl/virdev.hxx> -#include <vcl/print.hxx> -#include <vcl/event.hxx> -#include <vcl/window.h> -#include <vcl/window.hxx> -#include <vcl/svapp.hxx> -#include <vcl/bmpacc.hxx> -#include <unotools/fontcvt.hxx> -#include <vcl/outdev.hxx> -#include <vcl/edit.hxx> -#include <unotools/fontcfg.hxx> -#include <vcl/sysdata.hxx> -#include <vcl/textlayout.hxx> -#include <osl/file.h> + +#include "i18npool/mslangid.hxx" + +#include "svsys.h" +#include "vcl/salgdi.hxx" +#include "vcl/sallayout.hxx" +#include "rtl/tencinfo.h" +#include "tools/debug.hxx" +#include "vcl/svdata.hxx" +#include "vcl/metric.hxx" +#include "vcl/impfont.hxx" +#include "vcl/metaact.hxx" +#include "vcl/gdimtf.hxx" +#include "vcl/outdata.hxx" +#include "vcl/outfont.hxx" +#include "basegfx/polygon/b2dpolygon.hxx" +#include "basegfx/polygon/b2dpolypolygon.hxx" +#include "basegfx/matrix/b2dhommatrix.hxx" +#include "tools/poly.hxx" +#include "vcl/outdev.h" +#include "vcl/virdev.hxx" +#include "vcl/print.hxx" +#include "vcl/event.hxx" +#include "vcl/window.h" +#include "vcl/window.hxx" +#include "vcl/svapp.hxx" +#include "vcl/bmpacc.hxx" +#include "unotools/fontcvt.hxx" +#include "vcl/outdev.hxx" +#include "vcl/edit.hxx" +#include "unotools/fontcfg.hxx" +#include "vcl/sysdata.hxx" +#include "vcl/textlayout.hxx" +#include "vcl/svids.hrc" +#include "osl/file.h" #ifdef ENABLE_GRAPHITE -#include <vcl/graphite_features.hxx> +#include "vcl/graphite_features.hxx" #endif #ifdef USE_BUILTIN_RASTERIZER -#include <vcl/glyphcache.hxx> +#include "vcl/glyphcache.hxx" #endif -#include <vcl/unohelp.hxx> -#include <pdfwriter_impl.hxx> -#include <vcl/controllayout.hxx> -#include <rtl/logfile.hxx> +#include "vcl/unohelp.hxx" +#include "pdfwriter_impl.hxx" +#include "vcl/controllayout.hxx" +#include "rtl/logfile.hxx" -#include <com/sun/star/beans/PropertyValues.hdl> -#include <com/sun/star/i18n/XBreakIterator.hpp> -#include <com/sun/star/i18n/WordType.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> +#include "com/sun/star/beans/PropertyValues.hpp" +#include "com/sun/star/i18n/XBreakIterator.hpp" +#include "com/sun/star/i18n/WordType.hpp" +#include "com/sun/star/linguistic2/XLinguServiceManager.hpp" #if defined UNX #define GLYPH_FONT_HEIGHT 128 @@ -87,7 +88,7 @@ #define GLYPH_FONT_HEIGHT 256 #endif -#include <sal/alloca.h> +#include "sal/alloca.h" #include <cmath> #include <cstring> @@ -225,7 +226,7 @@ void OutputDevice::ImplUpdateFontData( bool bNewFontLists ) if( mpFontCache && mpFontCache != pSVData->maGDIData.mpScreenFontCache ) delete mpFontCache; mpFontList = mpPDFWriter->filterDevFontList( pSVData->maGDIData.mpScreenFontList ); - mpFontCache = new ImplFontCache( FALSE ); + mpFontCache = new ImplFontCache( sal_False ); } else { @@ -317,7 +318,7 @@ void ImplFreeOutDevFontData() void OutputDevice::BeginFontSubstitution() { ImplSVData* pSVData = ImplGetSVData(); - pSVData->maGDIData.mbFontSubChanged = FALSE; + pSVData->maGDIData.mbFontSubChanged = sal_False; } // ----------------------------------------------------------------------- @@ -333,7 +334,7 @@ void OutputDevice::EndFontSubstitution() DataChangedEvent aDCEvt( DATACHANGED_FONTSUBSTITUTION ); pApp->DataChanged( aDCEvt ); pApp->NotifyAllWindows( aDCEvt ); - pSVData->maGDIData.mbFontSubChanged = FALSE; + pSVData->maGDIData.mbFontSubChanged = sal_False; } } @@ -341,19 +342,19 @@ void OutputDevice::EndFontSubstitution() void OutputDevice::AddFontSubstitute( const XubString& rFontName, const XubString& rReplaceFontName, - USHORT nFlags ) + sal_uInt16 nFlags ) { ImplDirectFontSubstitution*& rpSubst = ImplGetSVData()->maGDIData.mpDirectFontSubst; if( !rpSubst ) rpSubst = new ImplDirectFontSubstitution(); rpSubst->AddFontSubstitute( rFontName, rReplaceFontName, nFlags ); - ImplGetSVData()->maGDIData.mbFontSubChanged = TRUE; + ImplGetSVData()->maGDIData.mbFontSubChanged = sal_True; } // ----------------------------------------------------------------------- void ImplDirectFontSubstitution::AddFontSubstitute( const String& rFontName, - const String& rSubstFontName, USHORT nFlags ) + const String& rSubstFontName, sal_uInt16 nFlags ) { maFontSubstList.push_back( ImplFontSubstEntry( rFontName, rSubstFontName, nFlags ) ); } @@ -361,7 +362,7 @@ void ImplDirectFontSubstitution::AddFontSubstitute( const String& rFontName, // ----------------------------------------------------------------------- ImplFontSubstEntry::ImplFontSubstEntry( const String& rFontName, - const String& rSubstFontName, USHORT nSubstFlags ) + const String& rSubstFontName, sal_uInt16 nSubstFlags ) : maName( rFontName ) , maReplaceName( rSubstFontName ) , mnFlags( nSubstFlags ) @@ -376,7 +377,7 @@ ImplFontSubstEntry::ImplFontSubstEntry( const String& rFontName, void OutputDevice::ImplAddDevFontSubstitute( const XubString& rFontName, const XubString& rReplaceFontName, - USHORT nFlags ) + sal_uInt16 nFlags ) { ImplInitOutDevData(); mpOutDevData->maDevFontSubst.AddFontSubstitute( rFontName, rReplaceFontName, nFlags ); @@ -384,7 +385,7 @@ void OutputDevice::ImplAddDevFontSubstitute( const XubString& rFontName, // ----------------------------------------------------------------------- -void OutputDevice::RemoveFontSubstitute( USHORT n ) +void OutputDevice::RemoveFontSubstitute( sal_uInt16 n ) { ImplDirectFontSubstitution* pSubst = ImplGetSVData()->maGDIData.mpDirectFontSubst; if( pSubst ) @@ -403,21 +404,21 @@ void ImplDirectFontSubstitution::RemoveFontSubstitute( int nIndex ) // ----------------------------------------------------------------------- -USHORT OutputDevice::GetFontSubstituteCount() +sal_uInt16 OutputDevice::GetFontSubstituteCount() { const ImplDirectFontSubstitution* pSubst = ImplGetSVData()->maGDIData.mpDirectFontSubst; if( !pSubst ) return 0; int nCount = pSubst->GetFontSubstituteCount(); - return (USHORT)nCount; + return (sal_uInt16)nCount; } // ----------------------------------------------------------------------- -void OutputDevice::GetFontSubstitute( USHORT n, +void OutputDevice::GetFontSubstitute( sal_uInt16 n, XubString& rFontName, XubString& rReplaceFontName, - USHORT& rFlags ) + sal_uInt16& rFlags ) { const ImplDirectFontSubstitution* pSubst = ImplGetSVData()->maGDIData.mpDirectFontSubst; if( pSubst ) @@ -427,7 +428,7 @@ void OutputDevice::GetFontSubstitute( USHORT n, // ----------------------------------------------------------------------- bool ImplDirectFontSubstitution::GetFontSubstitute( int nIndex, - String& rFontName, String& rSubstFontName, USHORT& rFlags ) const + String& rFontName, String& rSubstFontName, sal_uInt16& rFlags ) const { FontSubstList::const_iterator it = maFontSubstList.begin(); for( int nCount = 0; (it != maFontSubstList.end()) && (nCount++ != nIndex); ++it ) ; @@ -444,7 +445,7 @@ bool ImplDirectFontSubstitution::GetFontSubstitute( int nIndex, // ----------------------------------------------------------------------- bool ImplDirectFontSubstitution::FindFontSubstitute( String& rSubstName, - const String& rSearchName, USHORT nFlags ) const + const String& rSearchName, sal_uInt16 nFlags ) const { // TODO: get rid of O(N) searches FontSubstList::const_iterator it = maFontSubstList.begin(); @@ -465,7 +466,7 @@ bool ImplDirectFontSubstitution::FindFontSubstitute( String& rSubstName, // ----------------------------------------------------------------------- static void ImplFontSubstitute( String& rFontName, - USHORT nFlags, ImplDirectFontSubstitution* pDevSpecific ) + sal_uInt16 nFlags, ImplDirectFontSubstitution* pDevSpecific ) { #ifdef DBG_UTIL String aTempName = rFontName; @@ -496,8 +497,8 @@ static void ImplFontSubstitute( String& rFontName, // ----------------------------------------------------------------------- -Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, - ULONG nFlags, const OutputDevice* pOutDev ) +Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang, + sal_uLong nFlags, const OutputDevice* pOutDev ) { DBG_TRACE( "OutputDevice::GetDefaultFont()" ); @@ -730,7 +731,7 @@ static unsigned ImplIsCJKFont( const String& rFontName ) // ----------------------------------------------------------------------- -static void ImplCalcType( ULONG& rType, FontWeight& rWeight, FontWidth& rWidth, +static void ImplCalcType( sal_uLong& rType, FontWeight& rWeight, FontWidth& rWidth, FontFamily eFamily, const FontNameAttr* pFontAttr ) { if ( eFamily != FAMILY_DONTKNOW ) @@ -1322,11 +1323,11 @@ void ImplDevFontList::InitGenericGlyphFallback( void ) const "msmincho", "fzmingti", "fzheiti", "ipamincho", "sazanamimincho", "kochimincho", "", "sunbatang", "sundotum", "baekmukdotum", "gulim", "batang", "dotum", "", "hgmincholightj", "msunglightsc", "msunglighttc", "hymyeongjolightk", "", - "tahoma", "dejavusans", "timesnewroman", "lucidatypewriter", "lucidasans", "nimbussansl", "", + "tahoma", "dejavusans", "timesnewroman", "liberationsans", "", "shree", "mangal", "", "raavi", "shruti", "tunga", "", "latha", "gautami", "kartika", "vrinda", "", - "shayyalmt", "naskmt", "", + "shayyalmt", "naskmt", "scheherazade", "", "david", "nachlieli", "lucidagrande", "", "norasi", "angsanaupc", "", "khmerossystem", "", @@ -1376,6 +1377,7 @@ void ImplDevFontList::InitGenericGlyphFallback( void ) const } } +#ifdef SAL_FONTENUM_STABLE_ON_PLATFORM // #i113472# // sort the list of fonts for glyph fallback by quality (highest first) // #i33947# keep the EUDC font at the front of the list // an insertion sort is good enough for this short list @@ -1391,6 +1393,7 @@ void ImplDevFontList::InitGenericGlyphFallback( void ) const break; pFallbackList[ j+1 ] = pTestFont; } +#endif mnFallbackCount = nMaxLevel; mpFallbackList = pFallbackList; @@ -1631,10 +1634,25 @@ ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const utl::FontNa pFoundData = ImplFindBySearchName( aSearchName ); if( pFoundData ) - break; + return pFoundData; } - return pFoundData; + // use known attributes from the configuration to find a matching substitute + const sal_uLong nSearchType = rFontAttr.Type; + if( nSearchType != 0 ) + { + const FontWeight eSearchWeight = rFontAttr.Weight; + const FontWidth eSearchWidth = rFontAttr.Width; + const FontItalic eSearchSlant = ITALIC_DONTKNOW; + const FontFamily eSearchFamily = FAMILY_DONTKNOW; + const String aSearchName; + pFoundData = ImplFindByAttributes( nSearchType, + eSearchWeight, eSearchWidth, eSearchFamily, eSearchSlant, aSearchName ); + if( pFoundData ) + return pFoundData; + } + + return NULL; } // ----------------------------------------------------------------------- @@ -1660,20 +1678,20 @@ void ImplDevFontList::InitMatchData() const } //---------------------------------------------------------------------------- -ImplDevFontListData* ImplDevFontList::ImplFindByLocale(com::sun::star::lang::Locale lc) const +ImplDevFontListData* ImplDevFontList::ImplFindByLocale( com::sun::star::lang::Locale& rLocale ) const { // get the default font for a specified locale const DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get(); - String aDefault = rDefaults.getUserInterfaceFont( lc ); + const String aDefault = rDefaults.getUserInterfaceFont( rLocale ); ImplDevFontListData* pFontData = ImplFindByTokenNames( aDefault ); if( pFontData ) return pFontData; - return 0; + return NULL; } // ----------------------------------------------------------------------- -ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( ULONG nSearchType, +ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( sal_uLong nSearchType, FontWeight eSearchWeight, FontWidth eSearchWidth, FontFamily /*eSearchFamily*/, FontItalic eSearchItalic, const String& rSearchFamilyName ) const { @@ -1691,7 +1709,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( ULONG nSearchType, long nTestMatch; long nBestMatch = 40000; - ULONG nBestType = 0; + sal_uLong nBestType = 0; DevFontList::const_iterator it = maDevFontList.begin(); for(; it != maDevFontList.end(); ++it ) @@ -1699,7 +1717,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( ULONG nSearchType, ImplDevFontListData* pData = (*it).second; // Get all information about the matching font - ULONG nMatchType = pData->mnMatchType; + sal_uLong nMatchType = pData->mnMatchType; FontWeight eMatchWeight= pData->meMatchWeight; FontWidth eMatchWidth = pData->meMatchWidth; @@ -2410,7 +2428,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, // test if a font in the token list is available // substitute the font if this was requested - USHORT nSubstFlags = FONT_SUBSTITUTE_ALWAYS; + sal_uInt16 nSubstFlags = FONT_SUBSTITUTE_ALWAYS; if ( bPrinter ) nSubstFlags |= FONT_SUBSTITUTE_SCREENONLY; @@ -2539,7 +2557,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, String aSearchFamilyName; FontWeight eSearchWeight = rFSD.meWeight; FontWidth eSearchWidth = rFSD.meWidthType; - ULONG nSearchType = 0; + sal_uLong nSearchType = 0; FontSubstConfiguration::getMapName( aSearchName, aSearchShortName, aSearchFamilyName, eSearchWeight, eSearchWidth, nSearchType ); @@ -2611,7 +2629,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, String aTempShortName; String aTempFamilyName; - ULONG nTempType = 0; + sal_uLong nTempType = 0; FontWeight eTempWeight = rFSD.meWeight; FontWidth eTempWidth = WIDTH_DONTKNOW; FontSubstConfiguration::getMapName( aSearchName, aTempShortName, aTempFamilyName, @@ -2883,17 +2901,17 @@ FontEmphasisMark OutputDevice::ImplGetEmphasisMarkStyle( const Font& rFont ) // ----------------------------------------------------------------------- -BOOL OutputDevice::ImplIsUnderlineAbove( const Font& rFont ) +sal_Bool OutputDevice::ImplIsUnderlineAbove( const Font& rFont ) { if ( !rFont.IsVertical() ) - return FALSE; + return sal_False; if( (LANGUAGE_JAPANESE == rFont.GetLanguage()) || (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage()) ) // the underline is right for Japanese only - return TRUE; + return sal_True; - return FALSE; + return sal_False; } // ======================================================================= @@ -2908,6 +2926,18 @@ void OutputDevice::ImplInitFontList() const mpGraphics->GetDevFontList( mpFontList ); } } + if( meOutDevType == OUTDEV_WINDOW && ! mpFontList->Count() ) + { + String aError( RTL_CONSTASCII_USTRINGPARAM( "Application error: no fonts and no vcl resource found on your system" ) ); + ResMgr* pMgr = ImplGetResMgr(); + if( pMgr ) + { + String aResStr( ResId( SV_ACCESSERROR_NO_FONTS, *pMgr ) ); + if( aResStr.Len() ) + aError = aResStr; + } + Application::Abort( aError ); + } } // ======================================================================= @@ -2946,7 +2976,7 @@ void OutputDevice::ImplInitTextColor() if ( mbInitTextColor ) { mpGraphics->SetTextColor( ImplColorToSal( GetTextColor() ) ); - mbInitTextColor = FALSE; + mbInitTextColor = sal_False; } } @@ -3003,9 +3033,9 @@ bool OutputDevice::ImplNewFont() const ImplFontEntry* pFontEntry = mpFontEntry; // mark when lower layers need to get involved - mbNewFont = FALSE; + mbNewFont = sal_False; if( pFontEntry != pOldEntry ) - mbInitFont = TRUE; + mbInitFont = sal_True; // select font when it has not been initialized yet if ( !pFontEntry->mbInit ) @@ -3106,10 +3136,10 @@ bool OutputDevice::ImplNewFont() const { Size aOrigSize = maFont.GetSize(); const_cast<Font&>(maFont).SetSize( Size( nNewWidth, aSize.Height() ) ); - mbMap = FALSE; - mbNewFont = TRUE; + mbMap = sal_False; + mbNewFont = sal_True; ImplNewFont(); // recurse once using stretched width - mbMap = TRUE; + mbMap = sal_True; const_cast<Font&>(maFont).SetSize( aOrigSize ); } } @@ -3129,17 +3159,17 @@ long OutputDevice::ImplGetTextWidth( const SalLayout& rSalLayout ) const // ----------------------------------------------------------------------- void OutputDevice::ImplDrawTextRect( long nBaseX, long nBaseY, - long nX, long nY, long nWidth, long nHeight ) + long nDistX, long nDistY, long nWidth, long nHeight ) { + long nX = nDistX; + long nY = nDistY; + short nOrientation = mpFontEntry->mnOrientation; if ( nOrientation ) { // Rotate rect without rounding problems for 90 degree rotations if ( !(nOrientation % 900) ) { - nX -= nBaseX; - nY -= nBaseY; - if ( nOrientation == 900 ) { long nTemp = nX; @@ -3167,12 +3197,11 @@ void OutputDevice::ImplDrawTextRect( long nBaseX, long nBaseY, nHeight = nTemp; nX -= nWidth; } - - nX += nBaseX; - nY += nBaseY; } else { + nX += nBaseX; + nY += nBaseY; // inflate because polygons are drawn smaller Rectangle aRect( Point( nX, nY ), Size( nWidth+1, nHeight+1 ) ); Polygon aPoly( aRect ); @@ -3182,6 +3211,8 @@ void OutputDevice::ImplDrawTextRect( long nBaseX, long nBaseY, } } + nX += nBaseX; + nY += nBaseY; mpGraphics->DrawRect( nX, nY, nWidth, nHeight, this ); } @@ -3197,12 +3228,12 @@ void OutputDevice::ImplDrawTextBackground( const SalLayout& rSalLayout ) if ( mbLineColor || mbInitLineColor ) { mpGraphics->SetLineColor(); - mbInitLineColor = TRUE; + mbInitLineColor = sal_True; } mpGraphics->SetFillColor( ImplColorToSal( GetTextFillColor() ) ); - mbInitFillColor = TRUE; + mbInitFillColor = sal_True; - ImplDrawTextRect( nX, nY, nX, nY-mpFontEntry->maMetric.mnAscent-mnEmphasisAscent, + ImplDrawTextRect( nX, nY, 0, -(mpFontEntry->maMetric.mnAscent + mnEmphasisAscent), nWidth, mpFontEntry->mnLineHeight+mnEmphasisAscent+mnEmphasisDescent ); } @@ -3466,7 +3497,7 @@ static void ImplDrawWavePixel( long nOriginX, long nOriginY, short nOrientation, SalGraphics* pGraphics, OutputDevice* pOutDev, - BOOL bDrawPixAsRect, + sal_Bool bDrawPixAsRect, long nPixWidth, long nPixHeight ) { @@ -3487,7 +3518,7 @@ static void ImplDrawWavePixel( long nOriginX, long nOriginY, // ----------------------------------------------------------------------- void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, - long nStartX, long nStartY, + long nDistX, long nDistY, long nWidth, long nHeight, long nLineWidth, short nOrientation, const Color& rColor ) @@ -3495,11 +3526,14 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, if ( !nHeight ) return; + long nStartX = nBaseX + nDistX; + long nStartY = nBaseY + nDistY; + // Bei Hoehe von 1 Pixel reicht es, eine Linie auszugeben if ( (nLineWidth == 1) && (nHeight == 1) ) { mpGraphics->SetLineColor( ImplColorToSal( rColor ) ); - mbInitLineColor = TRUE; + mbInitLineColor = sal_True; long nEndX = nStartX+nWidth; long nEndY = nStartY; @@ -3509,7 +3543,6 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, ImplRotatePos( nBaseX, nBaseY, nEndX, nEndY, nOrientation ); } mpGraphics->DrawLine( nStartX, nStartY, nEndX, nEndY, this ); - } else { @@ -3523,28 +3556,28 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, long i; long nPixWidth; long nPixHeight; - BOOL bDrawPixAsRect; + sal_Bool bDrawPixAsRect; // Auf Druckern die Pixel per DrawRect() ausgeben if ( (GetOutDevType() == OUTDEV_PRINTER) || (nLineWidth > 1) ) { if ( mbLineColor || mbInitLineColor ) { mpGraphics->SetLineColor(); - mbInitLineColor = TRUE; + mbInitLineColor = sal_True; } mpGraphics->SetFillColor( ImplColorToSal( rColor ) ); - mbInitFillColor = TRUE; - bDrawPixAsRect = TRUE; + mbInitFillColor = sal_True; + bDrawPixAsRect = sal_True; nPixWidth = nLineWidth; nPixHeight = ((nLineWidth*mnDPIX)+(mnDPIY/2))/mnDPIY; } else { mpGraphics->SetLineColor( ImplColorToSal( rColor ) ); - mbInitLineColor = TRUE; + mbInitLineColor = sal_True; nPixWidth = 1; nPixHeight = 1; - bDrawPixAsRect = FALSE; + bDrawPixAsRect = sal_False; } if ( !nDiffY ) @@ -3609,10 +3642,10 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, // ----------------------------------------------------------------------- void OutputDevice::ImplDrawWaveTextLine( long nBaseX, long nBaseY, - long nX, long nY, long nWidth, + long nDistX, long nDistY, long nWidth, FontUnderline eTextLine, Color aColor, - BOOL bIsAbove ) + sal_Bool bIsAbove ) { ImplFontEntry* pFontEntry = mpFontEntry; long nLineHeight; @@ -3635,7 +3668,7 @@ void OutputDevice::ImplDrawWaveTextLine( long nBaseX, long nBaseY, nLineWidth = 1; if ( eTextLine == UNDERLINE_BOLDWAVE ) nLineWidth *= 2; - nLinePos += nY - (nLineHeight / 2); + nLinePos += nDistY - (nLineHeight / 2); long nLineWidthHeight = ((nLineWidth*mnDPIX)+(mnDPIY/2))/mnDPIY; if ( eTextLine == UNDERLINE_DOUBLEWAVE ) { @@ -3656,16 +3689,16 @@ void OutputDevice::ImplDrawWaveTextLine( long nBaseX, long nBaseY, nLineDY2 = 1; nLinePos -= nLineWidthHeight-nLineDY2; - ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight, + ImplDrawWaveLine( nBaseX, nBaseY, nDistX, nLinePos, nWidth, nLineHeight, nLineWidth, mpFontEntry->mnOrientation, aColor ); nLinePos += nLineWidthHeight+nLineDY; - ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight, + ImplDrawWaveLine( nBaseX, nBaseY, nDistX, nLinePos, nWidth, nLineHeight, nLineWidth, mpFontEntry->mnOrientation, aColor ); } else { nLinePos -= nLineWidthHeight/2; - ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight, + ImplDrawWaveLine( nBaseX, nBaseY, nDistX, nLinePos, nWidth, nLineHeight, nLineWidth, mpFontEntry->mnOrientation, aColor ); } } @@ -3673,16 +3706,18 @@ void OutputDevice::ImplDrawWaveTextLine( long nBaseX, long nBaseY, // ----------------------------------------------------------------------- void OutputDevice::ImplDrawStraightTextLine( long nBaseX, long nBaseY, - long nX, long nY, long nWidth, + long nDistX, long nDistY, long nWidth, FontUnderline eTextLine, Color aColor, - BOOL bIsAbove ) + sal_Bool bIsAbove ) { ImplFontEntry* pFontEntry = mpFontEntry; long nLineHeight = 0; long nLinePos = 0; long nLinePos2 = 0; + const long nY = nDistY; + if ( eTextLine > UNDERLINE_LAST ) eTextLine = UNDERLINE_SINGLE; @@ -3745,12 +3780,12 @@ void OutputDevice::ImplDrawStraightTextLine( long nBaseX, long nBaseY, if ( mbLineColor || mbInitLineColor ) { mpGraphics->SetLineColor(); - mbInitLineColor = TRUE; + mbInitLineColor = sal_True; } mpGraphics->SetFillColor( ImplColorToSal( aColor ) ); - mbInitFillColor = TRUE; + mbInitFillColor = sal_True; - long nLeft = nX; + long nLeft = nDistX; switch ( eTextLine ) { @@ -3903,7 +3938,7 @@ void OutputDevice::ImplDrawStraightTextLine( long nBaseX, long nBaseY, // ----------------------------------------------------------------------- void OutputDevice::ImplDrawStrikeoutLine( long nBaseX, long nBaseY, - long nX, long nY, long nWidth, + long nDistX, long nDistY, long nWidth, FontStrikeout eStrikeout, Color aColor ) { @@ -3912,6 +3947,8 @@ void OutputDevice::ImplDrawStrikeoutLine( long nBaseX, long nBaseY, long nLinePos = 0; long nLinePos2 = 0; + long nY = nDistY; + if ( eStrikeout > STRIKEOUT_LAST ) eStrikeout = STRIKEOUT_SINGLE; @@ -3939,12 +3976,12 @@ void OutputDevice::ImplDrawStrikeoutLine( long nBaseX, long nBaseY, if ( mbLineColor || mbInitLineColor ) { mpGraphics->SetLineColor(); - mbInitLineColor = TRUE; + mbInitLineColor = sal_True; } mpGraphics->SetFillColor( ImplColorToSal( aColor ) ); - mbInitFillColor = TRUE; + mbInitFillColor = sal_True; - long nLeft = nX; + const long& nLeft = nDistX; switch ( eStrikeout ) { @@ -3965,7 +4002,7 @@ void OutputDevice::ImplDrawStrikeoutLine( long nBaseX, long nBaseY, // ----------------------------------------------------------------------- void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, - long nX, long nY, long nWidth, + long nDistX, long nDistY, long nWidth, FontStrikeout eStrikeout, Color aColor ) { @@ -3999,12 +4036,12 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, // calculate acceptable strikeout length // allow the strikeout to be one pixel larger than the text it strikes out - long nMaxWidth = nStrikeoutWidth / 2; + long nMaxWidth = nStrikeoutWidth * 3 / 4; if ( nMaxWidth < 2 ) nMaxWidth = 2; nMaxWidth += nWidth + 1; - int nStrikeStrLen = (nMaxWidth + nStrikeoutWidth - 1) / nStrikeoutWidth; + int nStrikeStrLen = (nMaxWidth - 1) / nStrikeoutWidth; // if the text width is smaller than the strikeout text, then do not // strike out at all. This case requires user interaction, e.g. adding // a space to the text @@ -4019,10 +4056,12 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, const String aStrikeoutText( aChars, xub_StrLen(nStrikeStrLen) ); if( mpFontEntry->mnOrientation ) - ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation ); + ImplRotatePos( 0, 0, nDistX, nDistY, mpFontEntry->mnOrientation ); + nBaseX += nDistX; + nBaseY += nDistY; // strikeout text has to be left aligned - ULONG nOrigTLM = mnTextLayoutMode; + sal_uLong nOrigTLM = mnTextLayoutMode; mnTextLayoutMode = TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_COMPLEX_DISABLED; pLayout = ImplLayout( aStrikeoutText, 0, STRING_LEN ); mnTextLayoutMode = nOrigTLM; @@ -4035,7 +4074,7 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, SetTextColor( aColor ); ImplInitTextColor(); - pLayout->DrawBase() = Point( nX+mnTextOffX, nY+mnTextOffY ); + pLayout->DrawBase() = Point( nBaseX+mnTextOffX, nBaseY+mnTextOffY ); pLayout->DrawText( *mpGraphics ); pLayout->Release(); @@ -4045,12 +4084,12 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, // ----------------------------------------------------------------------- -void OutputDevice::ImplDrawTextLine( long nBaseX, - long nX, long nY, long nWidth, +void OutputDevice::ImplDrawTextLine( long nX, long nY, + long nDistX, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, - BOOL bUnderlineAbove ) + sal_Bool bUnderlineAbove ) { if ( !nWidth ) return; @@ -4058,14 +4097,18 @@ void OutputDevice::ImplDrawTextLine( long nBaseX, Color aStrikeoutColor = GetTextColor(); Color aUnderlineColor = GetTextLineColor(); Color aOverlineColor = GetOverlineColor(); - BOOL bStrikeoutDone = FALSE; - BOOL bUnderlineDone = FALSE; - BOOL bOverlineDone = FALSE; + sal_Bool bStrikeoutDone = sal_False; + sal_Bool bUnderlineDone = sal_False; + sal_Bool bOverlineDone = sal_False; - // TODO: fix rotated text if ( IsRTLEnabled() ) + { // --- RTL --- mirror at basex - nX = nBaseX - nWidth - (nX - nBaseX - 1); + long nXAdd = nWidth - nDistX; + if( mpFontEntry->mnOrientation ) + nXAdd = FRound( nXAdd * cos( mpFontEntry->mnOrientation * F_PI1800 ) ); + nX += nXAdd - 1; + } if ( !IsTextLineColor() ) aUnderlineColor = GetTextColor(); @@ -4078,70 +4121,85 @@ void OutputDevice::ImplDrawTextLine( long nBaseX, (eUnderline == UNDERLINE_DOUBLEWAVE) || (eUnderline == UNDERLINE_BOLDWAVE) ) { - ImplDrawWaveTextLine( nBaseX, nY, nX, nY, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove ); - bUnderlineDone = TRUE; + ImplDrawWaveTextLine( nX, nY, nDistX, 0, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove ); + bUnderlineDone = sal_True; } if ( (eOverline == UNDERLINE_SMALLWAVE) || (eOverline == UNDERLINE_WAVE) || (eOverline == UNDERLINE_DOUBLEWAVE) || (eOverline == UNDERLINE_BOLDWAVE) ) { - ImplDrawWaveTextLine( nBaseX, nY, nX, nY, nWidth, eOverline, aOverlineColor, TRUE ); - bOverlineDone = TRUE; + ImplDrawWaveTextLine( nX, nY, nDistX, 0, nWidth, eOverline, aOverlineColor, sal_True ); + bOverlineDone = sal_True; } if ( (eStrikeout == STRIKEOUT_SLASH) || (eStrikeout == STRIKEOUT_X) ) { - ImplDrawStrikeoutChar( nBaseX, nY, nX, nY, nWidth, eStrikeout, aStrikeoutColor ); - bStrikeoutDone = TRUE; + ImplDrawStrikeoutChar( nX, nY, nDistX, 0, nWidth, eStrikeout, aStrikeoutColor ); + bStrikeoutDone = sal_True; } if ( !bUnderlineDone ) - ImplDrawStraightTextLine( nBaseX, nY, nX, nY, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove ); + ImplDrawStraightTextLine( nX, nY, nDistX, 0, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove ); if ( !bOverlineDone ) - ImplDrawStraightTextLine( nBaseX, nY, nX, nY, nWidth, eOverline, aOverlineColor, TRUE ); + ImplDrawStraightTextLine( nX, nY, nDistX, 0, nWidth, eOverline, aOverlineColor, sal_True ); if ( !bStrikeoutDone ) - ImplDrawStrikeoutLine( nBaseX, nY, nX, nY, nWidth, eStrikeout, aStrikeoutColor ); + ImplDrawStrikeoutLine( nX, nY, nDistX, 0, nWidth, eStrikeout, aStrikeoutColor ); } // ----------------------------------------------------------------------- void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, - FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bWordLine, BOOL bUnderlineAbove ) + FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, sal_Bool bWordLine, sal_Bool bUnderlineAbove ) { if( bWordLine ) { - Point aPos, aStartPt; - sal_Int32 nWidth = 0, nAdvance=0; + // draw everything relative to the layout base point + const Point aStartPt = rSalLayout.DrawBase(); + // calculate distance of each word from the base point + Point aPos; + sal_Int32 nDist = 0, nWidth = 0, nAdvance=0; for( int nStart = 0;;) { + // iterate through the layouted glyphs sal_GlyphId nGlyphIndex; if( !rSalLayout.GetNextGlyphs( 1, &nGlyphIndex, aPos, nStart, &nAdvance ) ) break; + // calculate the boundaries of each word if( !rSalLayout.IsSpacingGlyph( nGlyphIndex ) ) { if( !nWidth ) { - aStartPt = aPos;//rSalLayout.DrawBase() - (aPos - rSalLayout.DrawOffset()); + // get the distance to the base point (as projected to baseline) + nDist = aPos.X() - aStartPt.X(); + if( mpFontEntry->mnOrientation ) + { + const long nDY = aPos.Y() - aStartPt.Y(); + const double fRad = mpFontEntry->mnOrientation * F_PI1800; + nDist = FRound( nDist*cos(fRad) - nDY*sin(fRad) ); + } } + // update the length of the textline nWidth += nAdvance; } else if( nWidth > 0 ) { - ImplDrawTextLine( rSalLayout.DrawBase().X(), aStartPt.X(), aStartPt.Y(), nWidth, + // draw the textline for each word + ImplDrawTextLine( aStartPt.X(), aStartPt.Y(), nDist, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove ); nWidth = 0; } } + // draw textline for the last word if( nWidth > 0 ) { - ImplDrawTextLine( rSalLayout.DrawBase().X(), aStartPt.X(), aStartPt.Y(), nWidth, + ImplDrawTextLine( aStartPt.X(), aStartPt.Y(), nDist, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove ); } } @@ -4149,7 +4207,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, { Point aStartPt = rSalLayout.GetDrawPosition(); int nWidth = rSalLayout.GetTextWidth() / rSalLayout.GetUnitsPerPixel(); - ImplDrawTextLine( rSalLayout.DrawBase().X(), aStartPt.X(), aStartPt.Y(), nWidth, + ImplDrawTextLine( aStartPt.X(), aStartPt.Y(), 0, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove ); } } @@ -4168,18 +4226,18 @@ void OutputDevice::ImplDrawMnemonicLine( long nX, long nY, long nWidth ) nX = nBaseX - nWidth - (nX - nBaseX - 1); } - ImplDrawTextLine( nBaseX, nX, nY, nWidth, STRIKEOUT_NONE, UNDERLINE_SINGLE, UNDERLINE_NONE, FALSE ); + ImplDrawTextLine( nX, nY, 0, nWidth, STRIKEOUT_NONE, UNDERLINE_SINGLE, UNDERLINE_NONE, sal_False ); } // ----------------------------------------------------------------------- -void OutputDevice::ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, +void OutputDevice::ImplGetEmphasisMark( PolyPolygon& rPolyPoly, sal_Bool& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short /*nOrient*/ ) { - static const BYTE aAccentPolyFlags[24] = + static const sal_uInt8 aAccentPolyFlags[24] = { 0, 2, 2, 0, 2, 2, 0, 2, 2, 0, 2, 2, 0, 2, 2, 0, 2, 2, 0, 0, 2, 0, 2, 2 }; @@ -4214,7 +4272,7 @@ void OutputDevice::ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, rWidth = 0; rYOff = 0; - rPolyLine = FALSE; + rPolyLine = sal_False; if ( !nHeight ) return; @@ -4255,7 +4313,7 @@ void OutputDevice::ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, // BorderWidth is 15% long nBorder = (nDotSize*150)/1000; if ( nBorder <= 1 ) - rPolyLine = TRUE; + rPolyLine = sal_True; else { Polygon aPoly2( Point( nRad, nRad ), @@ -4329,7 +4387,7 @@ void OutputDevice::ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, // ----------------------------------------------------------------------- void OutputDevice::ImplDrawEmphasisMark( long nBaseX, long nX, long nY, - const PolyPolygon& rPolyPoly, BOOL bPolyLine, + const PolyPolygon& rPolyPoly, sal_Bool bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ) { // TODO: pass nWidth as width of this mark @@ -4380,10 +4438,10 @@ void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout ) { Color aOldLineColor = GetLineColor(); Color aOldFillColor = GetFillColor(); - BOOL bOldMap = mbMap; + sal_Bool bOldMap = mbMap; GDIMetaFile* pOldMetaFile = mpMetaFile; mpMetaFile = NULL; - EnableMapMode( FALSE ); + EnableMapMode( sal_False ); FontEmphasisMark nEmphasisMark = ImplGetEmphasisMarkStyle( maFont ); PolyPolygon aPolyPoly; @@ -4392,7 +4450,7 @@ void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout ) long nEmphasisYOff; long nEmphasisWidth; long nEmphasisHeight; - BOOL bPolyLine; + sal_Bool bPolyLine; if ( nEmphasisMark & EMPHASISMARK_POS_BELOW ) nEmphasisHeight = mnEmphasisDescent; @@ -4516,12 +4574,12 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout ) GDIMetaFile* pOldMetaFile = mpMetaFile; long nOldOffX = mnOutOffX; long nOldOffY = mnOutOffY; - BOOL bOldMap = mbMap; + sal_Bool bOldMap = mbMap; mnOutOffX = 0L; mnOutOffY = 0L; mpMetaFile = NULL; - EnableMapMode( FALSE ); + EnableMapMode( sal_False ); DrawMask( aPoint, aBmp, GetTextColor() ); @@ -4535,7 +4593,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout ) // ----------------------------------------------------------------------- -void OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, BOOL bTextLines ) +void OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, sal_Bool bTextLines ) { if( mpFontEntry->mnOwnOrientation ) if( ImplDrawRotateText( rSalLayout ) ) @@ -4729,7 +4787,7 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout ) long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, - USHORT nStyle, const ::vcl::ITextLayout& _rLayout ) + sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout ) { DBG_ASSERTWARNING( nWidth >= 0, "ImplGetTextLines: nWidth <= 0!" ); @@ -4798,10 +4856,10 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, // sal_uInt16 nWordStart = nBreakPos; // sal_uInt16 nBreakPos_OLD = nBreakPos; sal_uInt16 nWordStart = nPos; - sal_uInt16 nWordEnd = (USHORT) aBoundary.endPos; + sal_uInt16 nWordEnd = (sal_uInt16) aBoundary.endPos; DBG_ASSERT( nWordEnd > nWordStart, "ImpBreakLine: Start >= End?" ); - USHORT nWordLen = nWordEnd - nWordStart; + sal_uInt16 nWordLen = nWordEnd - nWordStart; if ( ( nWordEnd >= nSoftBreak ) && ( nWordLen > 3 ) ) { // #104415# May happen, because getLineBreak may differ from getWordBoudary with DICTIONARY_WORD @@ -4882,7 +4940,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, else { // fallback to something really simple - USHORT nSpacePos = STRING_LEN; + sal_uInt16 nSpacePos = STRING_LEN; long nW = 0; do { @@ -4924,7 +4982,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, } } #ifdef DBG_UTIL - for ( USHORT nL = 0; nL < rLineInfo.Count(); nL++ ) + for ( sal_uInt16 nL = 0; nL < rLineInfo.Count(); nL++ ) { ImplTextLineInfo* pLine = rLineInfo.GetLine( nL ); String aLine( rStr, pLine->GetIndex(), pLine->GetLen() ); @@ -4938,12 +4996,12 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, // ======================================================================= -void OutputDevice::SetAntialiasing( USHORT nMode ) +void OutputDevice::SetAntialiasing( sal_uInt16 nMode ) { if ( mnAntialiasing != nMode ) { mnAntialiasing = nMode; - mbInitFont = TRUE; + mbInitFont = sal_True; if(mpGraphics) { @@ -4977,7 +5035,7 @@ void OutputDevice::SetFont( const Font& rNewFont ) aTextColor = Color( COL_WHITE ); else if ( mnDrawMode & DRAWMODE_GRAYTEXT ) { - const UINT8 cLum = aTextColor.GetLuminance(); + const sal_uInt8 cLum = aTextColor.GetLuminance(); aTextColor = Color( cLum, cLum, cLum ); } else if ( mnDrawMode & DRAWMODE_SETTINGSTEXT ) @@ -4992,7 +5050,7 @@ void OutputDevice::SetFont( const Font& rNewFont ) aFont.SetColor( aTextColor ); - BOOL bTransFill = aFont.IsTransparent(); + sal_Bool bTransFill = aFont.IsTransparent(); if ( !bTransFill ) { Color aTextFillColor( aFont.GetFillColor() ); @@ -5003,7 +5061,7 @@ void OutputDevice::SetFont( const Font& rNewFont ) aTextFillColor = Color( COL_WHITE ); else if ( mnDrawMode & DRAWMODE_GRAYFILL ) { - const UINT8 cLum = aTextFillColor.GetLuminance(); + const sal_uInt8 cLum = aTextFillColor.GetLuminance(); aTextFillColor = Color( cLum, cLum, cLum ); } else if( mnDrawMode & DRAWMODE_SETTINGSFILL ) @@ -5011,7 +5069,7 @@ void OutputDevice::SetFont( const Font& rNewFont ) else if ( mnDrawMode & DRAWMODE_NOFILL ) { aTextFillColor = Color( COL_TRANSPARENT ); - bTransFill = TRUE; + bTransFill = sal_True; } if ( !bTransFill && (mnDrawMode & DRAWMODE_GHOSTEDFILL) ) @@ -5043,12 +5101,12 @@ void OutputDevice::SetFont( const Font& rNewFont ) && (aFont.GetColor() != maFont.GetColor() || aFont.GetColor() != maTextColor ) ) { maTextColor = aFont.GetColor(); - mbInitTextColor = TRUE; + mbInitTextColor = sal_True; if( mpMetaFile ) mpMetaFile->AddAction( new MetaTextColorAction( aFont.GetColor() ) ); } maFont = aFont; - mbNewFont = TRUE; + mbNewFont = sal_True; if( mpAlphaVDev ) { @@ -5069,7 +5127,7 @@ void OutputDevice::SetFont( const Font& rNewFont ) // ----------------------------------------------------------------------- -void OutputDevice::SetLayoutMode( ULONG nTextLayoutMode ) +void OutputDevice::SetLayoutMode( sal_uLong nTextLayoutMode ) { DBG_TRACE( "OutputDevice::SetTextLayoutMode()" ); @@ -5116,7 +5174,7 @@ void OutputDevice::SetTextColor( const Color& rColor ) aColor = Color( COL_WHITE ); else if ( mnDrawMode & DRAWMODE_GRAYTEXT ) { - const UINT8 cLum = aColor.GetLuminance(); + const sal_uInt8 cLum = aColor.GetLuminance(); aColor = Color( cLum, cLum, cLum ); } else if ( mnDrawMode & DRAWMODE_SETTINGSTEXT ) @@ -5136,7 +5194,7 @@ void OutputDevice::SetTextColor( const Color& rColor ) if ( maTextColor != aColor ) { maTextColor = aColor; - mbInitTextColor = TRUE; + mbInitTextColor = sal_True; } if( mpAlphaVDev ) @@ -5151,12 +5209,12 @@ void OutputDevice::SetTextFillColor() DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaTextFillColorAction( Color(), FALSE ) ); + mpMetaFile->AddAction( new MetaTextFillColorAction( Color(), sal_False ) ); if ( maFont.GetColor() != Color( COL_TRANSPARENT ) ) maFont.SetFillColor( Color( COL_TRANSPARENT ) ); if ( !maFont.IsTransparent() ) - maFont.SetTransparent( TRUE ); + maFont.SetTransparent( sal_True ); if( mpAlphaVDev ) mpAlphaVDev->SetTextFillColor(); @@ -5170,7 +5228,7 @@ void OutputDevice::SetTextFillColor( const Color& rColor ) DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); Color aColor( rColor ); - BOOL bTransFill = ImplIsColorTransparent( aColor ) ? TRUE : FALSE; + sal_Bool bTransFill = ImplIsColorTransparent( aColor ) ? sal_True : sal_False; if ( !bTransFill ) { @@ -5184,7 +5242,7 @@ void OutputDevice::SetTextFillColor( const Color& rColor ) aColor = Color( COL_WHITE ); else if ( mnDrawMode & DRAWMODE_GRAYFILL ) { - const UINT8 cLum = aColor.GetLuminance(); + const sal_uInt8 cLum = aColor.GetLuminance(); aColor = Color( cLum, cLum, cLum ); } else if( mnDrawMode & DRAWMODE_SETTINGSFILL ) @@ -5192,7 +5250,7 @@ void OutputDevice::SetTextFillColor( const Color& rColor ) else if ( mnDrawMode & DRAWMODE_NOFILL ) { aColor = Color( COL_TRANSPARENT ); - bTransFill = TRUE; + bTransFill = sal_True; } if ( !bTransFill && (mnDrawMode & DRAWMODE_GHOSTEDFILL) ) @@ -5205,7 +5263,7 @@ void OutputDevice::SetTextFillColor( const Color& rColor ) } if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaTextFillColorAction( aColor, TRUE ) ); + mpMetaFile->AddAction( new MetaTextFillColorAction( aColor, sal_True ) ); if ( maFont.GetFillColor() != aColor ) maFont.SetFillColor( aColor ); @@ -5234,7 +5292,7 @@ void OutputDevice::SetTextLineColor() DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaTextLineColorAction( Color(), FALSE ) ); + mpMetaFile->AddAction( new MetaTextLineColorAction( Color(), sal_False ) ); maTextLineColor = Color( COL_TRANSPARENT ); @@ -5261,7 +5319,7 @@ void OutputDevice::SetTextLineColor( const Color& rColor ) aColor = Color( COL_WHITE ); else if ( mnDrawMode & DRAWMODE_GRAYTEXT ) { - const UINT8 cLum = aColor.GetLuminance(); + const sal_uInt8 cLum = aColor.GetLuminance(); aColor = Color( cLum, cLum, cLum ); } else if ( mnDrawMode & DRAWMODE_SETTINGSTEXT ) @@ -5277,7 +5335,7 @@ void OutputDevice::SetTextLineColor( const Color& rColor ) } if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaTextLineColorAction( aColor, TRUE ) ); + mpMetaFile->AddAction( new MetaTextLineColorAction( aColor, sal_True ) ); maTextLineColor = aColor; @@ -5293,7 +5351,7 @@ void OutputDevice::SetOverlineColor() DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaOverlineColorAction( Color(), FALSE ) ); + mpMetaFile->AddAction( new MetaOverlineColorAction( Color(), sal_False ) ); maOverlineColor = Color( COL_TRANSPARENT ); @@ -5320,7 +5378,7 @@ void OutputDevice::SetOverlineColor( const Color& rColor ) aColor = Color( COL_WHITE ); else if ( mnDrawMode & DRAWMODE_GRAYTEXT ) { - const UINT8 cLum = aColor.GetLuminance(); + const sal_uInt8 cLum = aColor.GetLuminance(); aColor = Color( cLum, cLum, cLum ); } else if ( mnDrawMode & DRAWMODE_SETTINGSTEXT ) @@ -5336,7 +5394,7 @@ void OutputDevice::SetOverlineColor( const Color& rColor ) } if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaOverlineColorAction( aColor, TRUE ) ); + mpMetaFile->AddAction( new MetaOverlineColorAction( aColor, sal_True ) ); maOverlineColor = aColor; @@ -5358,7 +5416,7 @@ void OutputDevice::SetTextAlign( TextAlign eAlign ) if ( maFont.GetAlign() != eAlign ) { maFont.SetAlign( eAlign ); - mbNewFont = TRUE; + mbNewFont = sal_True; } if( mpAlphaVDev ) @@ -5371,7 +5429,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, - BOOL bUnderlineAbove ) + sal_Bool bUnderlineAbove ) { DBG_TRACE( "OutputDevice::DrawTextLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -5406,7 +5464,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth, Point aPos = ImplLogicToDevicePixel( rPos ); nWidth = ImplLogicWidthToDevicePixel( nWidth ); aPos += Point( mnTextOffX, mnTextOffY ); - ImplDrawTextLine( aPos.X(), aPos.X(), aPos.Y(), nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove ); + ImplDrawTextLine( aPos.X(), aPos.X(), 0, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove ); if( mpAlphaVDev ) mpAlphaVDev->DrawTextLine( rPos, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove ); @@ -5414,7 +5472,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth, // ------------------------------------------------------------------------ -BOOL OutputDevice::IsTextUnderlineAbove( const Font& rFont ) +sal_Bool OutputDevice::IsTextUnderlineAbove( const Font& rFont ) { return ImplIsUnderlineAbove( rFont ); } @@ -5422,7 +5480,7 @@ BOOL OutputDevice::IsTextUnderlineAbove( const Font& rFont ) // ------------------------------------------------------------------------ void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos, - USHORT nStyle ) + sal_uInt16 nStyle ) { DBG_TRACE( "OutputDevice::DrawWaveLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -5483,7 +5541,7 @@ void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos, if( nWaveHeight > pFontEntry->maMetric.mnWUnderlineSize ) nWaveHeight = pFontEntry->maMetric.mnWUnderlineSize; - ImplDrawWaveLine( nStartX, nStartY, nStartX, nStartY, + ImplDrawWaveLine( nStartX, nStartY, 0, 0, nEndX-nStartX, nWaveHeight, 1, nOrientation, GetLineColor() ); if( mpAlphaVDev ) @@ -5650,7 +5708,7 @@ long OutputDevice::GetTextArray( const String& rStr, sal_Int32* pDXAry, if( nIndex >= rStr.Len() ) return 0; - if( (ULONG)nIndex+nLen >= rStr.Len() ) + if( (sal_uLong)nIndex+nLen >= rStr.Len() ) nLen = rStr.Len() - nIndex; // do layout @@ -5692,14 +5750,14 @@ long OutputDevice::GetTextArray( const String& rStr, sal_Int32* pDXAry, bool OutputDevice::GetCaretPositions( const XubString& rStr, sal_Int32* pCaretXArray, xub_StrLen nIndex, xub_StrLen nLen, sal_Int32* pDXAry, long nLayoutWidth, - BOOL bCellBreaking ) const + sal_Bool bCellBreaking ) const { DBG_TRACE( "OutputDevice::GetCaretPositions()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if( nIndex >= rStr.Len() ) return false; - if( (ULONG)nIndex+nLen >= rStr.Len() ) + if( (sal_uLong)nIndex+nLen >= rStr.Len() ) nLen = rStr.Len() - nIndex; // layout complex text @@ -5758,7 +5816,7 @@ bool OutputDevice::GetCaretPositions( const XubString& rStr, sal_Int32* pCaretXA // ----------------------------------------------------------------------- -void OutputDevice::DrawStretchText( const Point& rStartPt, ULONG nWidth, +void OutputDevice::DrawStretchText( const Point& rStartPt, sal_uLong nWidth, const String& rStr, xub_StrLen nIndex, xub_StrLen nLen ) { @@ -5790,7 +5848,7 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( String& rStr, { // get string length for calculating extents xub_StrLen nEndIndex = rStr.Len(); - if( (ULONG)nMinIndex + nLen < nEndIndex ) + if( (sal_uLong)nMinIndex + nLen < nEndIndex ) nEndIndex = nMinIndex + nLen; // don't bother if there is nothing to do @@ -5859,7 +5917,7 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( String& rStr, sal_UCS4 cChar = GetLocalizedChar( *pStr, meTextLanguage ); if( cChar != *pStr ) // TODO: are the localized digit surrogates? - rStr.SetChar( static_cast<USHORT>(pStr - pBase), + rStr.SetChar( static_cast<sal_uInt16>(pStr - pBase), static_cast<sal_Unicode>(cChar) ); } } @@ -6036,8 +6094,9 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay ImplFontSelectData aFontSelData = mpFontEntry->maFontSelData; - ImplFontMetricData aOrigMetric(aFontSelData); - mpGraphics->GetFontMetric(&aOrigMetric); + ImplFontMetricData aOrigMetric( aFontSelData ); + // TODO: use cached metric in fontentry + mpGraphics->GetFontMetric( &aOrigMetric ); // when device specific font substitution may have been performed for // the originally selected font then make sure that a fallback to that @@ -6072,21 +6131,27 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay } } - ImplFontMetricData aSubstituteMetric(aFontSelData); - pFallbackFont->mnSetFontFlags = mpGraphics->SetFont( &aFontSelData, nFallbackLevel ); - mpGraphics->GetFontMetric(&aSubstituteMetric, nFallbackLevel); - long nOriginalHeight = aOrigMetric.mnAscent + aOrigMetric.mnDescent; - long nSubstituteHeight = aSubstituteMetric.mnAscent + aSubstituteMetric.mnDescent; - //Too tall, shrink it a bit. Need a better calculation to include extra - //factors and any extra wriggle room we might have available ? - if (nSubstituteHeight > nOriginalHeight) - { - float fScale = nOriginalHeight/(float)nSubstituteHeight; - long nOrigHeight = aFontSelData.mnHeight; - aFontSelData.mnHeight *= fScale; + // TODO: try to get the metric data from the GFB's mpFontEntry + ImplFontMetricData aSubstituteMetric( aFontSelData ); + pFallbackFont->mnSetFontFlags = mpGraphics->SetFont( &aFontSelData, nFallbackLevel ); + mpGraphics->GetFontMetric( &aSubstituteMetric, nFallbackLevel ); + + const long nOriginalHeight = aOrigMetric.mnAscent + aOrigMetric.mnDescent; + const long nSubstituteHeight = aSubstituteMetric.mnAscent + aSubstituteMetric.mnDescent; + // Too tall, shrink it a bit. Need a better calculation to include extra + // factors and any extra wriggle room we might have available? + // TODO: should we scale by max-ascent/max-descent instead of design height? + if( nSubstituteHeight > nOriginalHeight ) + { + const float fScale = nOriginalHeight / (float)nSubstituteHeight; + const float fOrigHeight = aFontSelData.mfExactHeight; + const int nOrigHeight = aFontSelData.mnHeight; + aFontSelData.mfExactHeight *= fScale; + aFontSelData.mnHeight = static_cast<int>(aFontSelData.mfExactHeight); pFallbackFont->mnSetFontFlags = mpGraphics->SetFont( &aFontSelData, nFallbackLevel ); aFontSelData.mnHeight = nOrigHeight; + aFontSelData.mfExactHeight = fOrigHeight; } // create and add glyph fallback layout to multilayout @@ -6129,7 +6194,7 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay // ----------------------------------------------------------------------- -BOOL OutputDevice::GetTextIsRTL( +sal_Bool OutputDevice::GetTextIsRTL( const String& rString, xub_StrLen nIndex, xub_StrLen nLen ) const { @@ -6138,14 +6203,14 @@ BOOL OutputDevice::GetTextIsRTL( bool bRTL = false; int nCharPos = -1; aArgs.GetNextPos( &nCharPos, &bRTL ); - return (nCharPos != nIndex) ? TRUE : FALSE; + return (nCharPos != nIndex) ? sal_True : sal_False; } // ----------------------------------------------------------------------- xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth, xub_StrLen nIndex, xub_StrLen nLen, - long nCharExtra, BOOL /*TODO: bCellBreaking*/ ) const + long nCharExtra, sal_Bool /*TODO: bCellBreaking*/ ) const { DBG_TRACE( "OutputDevice::GetTextBreak()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -6239,17 +6304,17 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth, // ----------------------------------------------------------------------- void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect, - const String& rOrigStr, USHORT nStyle, + const String& rOrigStr, sal_uInt16 nStyle, MetricVector* pVector, String* pDisplayText, ::vcl::ITextLayout& _rLayout ) { Color aOldTextColor; Color aOldTextFillColor; - BOOL bRestoreFillColor = false; + sal_Bool bRestoreFillColor = false; if ( (nStyle & TEXT_DRAW_DISABLE) && ! pVector ) { - BOOL bHighContrastBlack = FALSE; - BOOL bHighContrastWhite = FALSE; + sal_Bool bHighContrastBlack = sal_False; + sal_Bool bHighContrastWhite = sal_False; const StyleSettings& rStyleSettings( rTargetDevice.GetSettings().GetStyleSettings() ); if( rStyleSettings.GetHighContrastMode() ) { @@ -6269,7 +6334,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r aOldTextColor = rTargetDevice.GetTextColor(); if ( rTargetDevice.IsTextFillColor() ) { - bRestoreFillColor = TRUE; + bRestoreFillColor = sal_True; aOldTextFillColor = rTargetDevice.GetTextFillColor(); } if( bHighContrastBlack ) @@ -6398,7 +6463,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r long nMnemonicWidth; sal_Int32* pCaretXArray = (sal_Int32*) alloca( 2 * sizeof(sal_Int32) * nLineLen ); - /*BOOL bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, + /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, nIndex, nLineLen ); long lc_x1 = pCaretXArray[2*(nMnemonicPos - nIndex)]; long lc_x2 = pCaretXArray[2*(nMnemonicPos - nIndex)+1]; @@ -6469,7 +6534,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r if ( nMnemonicPos != STRING_NOTFOUND ) { sal_Int32* pCaretXArray = (sal_Int32*) alloca( 2 * sizeof(sal_Int32) * aStr.Len() ); - /*BOOL bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, 0, aStr.Len() ); + /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, 0, aStr.Len() ); long lc_x1 = pCaretXArray[2*(nMnemonicPos)]; long lc_x2 = pCaretXArray[2*(nMnemonicPos)+1]; nMnemonicWidth = rTargetDevice.ImplLogicWidthToDevicePixel( ::abs((int)(lc_x1 - lc_x2)) ); @@ -6514,7 +6579,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r void OutputDevice::AddTextRectActions( const Rectangle& rRect, const String& rOrigStr, - USHORT nStyle, + sal_uInt16 nStyle, GDIMetaFile& rMtf ) { DBG_TRACE( "OutputDevice::AddTextRectActions( const Rectangle& )" ); @@ -6531,11 +6596,11 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, // temporarily swap in passed mtf for action generation, and // disable output generation. - const BOOL bOutputEnabled( IsOutputEnabled() ); + const sal_Bool bOutputEnabled( IsOutputEnabled() ); GDIMetaFile* pMtf = mpMetaFile; mpMetaFile = &rMtf; - EnableOutput( FALSE ); + EnableOutput( sal_False ); // #i47157# Factored out to ImplDrawTextRect(), to be shared // between us and DrawText() @@ -6549,7 +6614,7 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, // ----------------------------------------------------------------------- -void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, +void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, sal_uInt16 nStyle, MetricVector* pVector, String* pDisplayText, ::vcl::ITextLayout* _pTextLayout ) { @@ -6598,7 +6663,7 @@ void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, USH // ----------------------------------------------------------------------- Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, - const XubString& rStr, USHORT nStyle, + const XubString& rStr, sal_uInt16 nStyle, TextRectInfo* pInfo, const ::vcl::ITextLayout* _pTextLayout ) const { @@ -6628,7 +6693,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, nFormatLines = aMultiLineInfo.Count(); if ( !nTextHeight ) nTextHeight = 1; - nLines = (USHORT)(aRect.GetHeight()/nTextHeight); + nLines = (sal_uInt16)(aRect.GetHeight()/nTextHeight); if ( pInfo ) pInfo->mnLineCount = nFormatLines; if ( !nLines ) @@ -6642,13 +6707,13 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, else { if ( pInfo ) - pInfo->mbEllipsis = TRUE; + pInfo->mbEllipsis = sal_True; nMaxWidth = nWidth; } } if ( pInfo ) { - BOOL bMaxWidth = nMaxWidth == 0; + sal_Bool bMaxWidth = nMaxWidth == 0; pInfo->mnMaxWidth = 0; for ( i = 0; i < nLines; i++ ) { @@ -6683,7 +6748,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, if ( (nMaxWidth > nWidth) && (nStyle & TEXT_DRAW_ELLIPSIS) ) { if ( pInfo ) - pInfo->mbEllipsis = TRUE; + pInfo->mbEllipsis = sal_True; nMaxWidth = nWidth; } } @@ -6714,22 +6779,22 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, // ----------------------------------------------------------------------- -static BOOL ImplIsCharIn( xub_Unicode c, const sal_Char* pStr ) +static sal_Bool ImplIsCharIn( xub_Unicode c, const sal_Char* pStr ) { while ( *pStr ) { if ( *pStr == c ) - return TRUE; + return sal_True; pStr++; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, - USHORT nStyle ) const + sal_uInt16 nStyle ) const { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DefaultTextLayout aTextLayout( *const_cast< OutputDevice* >( this ) ); @@ -6739,7 +6804,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, // ----------------------------------------------------------------------- String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& rOrigStr, long nMaxWidth, - USHORT nStyle, const ::vcl::ITextLayout& _rLayout ) + sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout ) { DBG_TRACE( "OutputDevice::ImplGetEllipsisString()" ); @@ -6749,7 +6814,20 @@ String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, c if ( nIndex != STRING_LEN ) { - if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) + if( (nStyle & TEXT_DRAW_CENTERELLIPSIS) == TEXT_DRAW_CENTERELLIPSIS ) + { + String aTmpStr( aStr ); + xub_StrLen nEraseChars = 4; + while( nEraseChars < aStr.Len() && _rLayout.GetTextWidth( aTmpStr, 0, aTmpStr.Len() ) > nMaxWidth ) + { + aTmpStr = aStr; + xub_StrLen i = (aTmpStr.Len() - nEraseChars)/2; + aTmpStr.Erase( i, nEraseChars++ ); + aTmpStr.InsertAscii( "...", i ); + } + aStr = aTmpStr; + } + else if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) { aStr.Erase( nIndex ); if ( nIndex > 1 ) @@ -6795,7 +6873,7 @@ String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, c aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); else { - USHORT nFirstContent = 0; + sal_uInt16 nFirstContent = 0; while ( nFirstContent < nLastContent ) { nFirstContent++; @@ -6859,7 +6937,7 @@ String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, c void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen, - USHORT nStyle, MetricVector* pVector, String* pDisplayText ) + sal_uInt16 nStyle, MetricVector* pVector, String* pDisplayText ) { DBG_TRACE( "OutputDevice::DrawCtrlText()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -6878,7 +6956,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, if( nIndex >= rStr.Len() ) return; - if( (ULONG)nIndex+nLen >= rStr.Len() ) + if( (sal_uLong)nIndex+nLen >= rStr.Len() ) nLen = rStr.Len() - nIndex; XubString aStr = rStr; @@ -6900,7 +6978,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, --nLen; DBG_ASSERT( nMnemonicPos < (nIndex+nLen), "Mnemonic underline marker after last character" ); } - BOOL bInvalidPos = FALSE; + sal_Bool bInvalidPos = sal_False; if( nMnemonicPos >= nLen ) { @@ -6908,12 +6986,12 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, // may occur in BiDi-Strings: the '~' is sometimes found behind the last char // due to some strange BiDi text editors // ->place the underline behind the string to indicate a failure - bInvalidPos = TRUE; + bInvalidPos = sal_True; nMnemonicPos = nLen-1; } sal_Int32* pCaretXArray = (sal_Int32*)alloca( 2 * sizeof(sal_Int32) * nLen ); - /*BOOL bRet =*/ GetCaretPositions( aStr, pCaretXArray, nIndex, nLen ); + /*sal_Bool bRet =*/ GetCaretPositions( aStr, pCaretXArray, nIndex, nLen ); long lc_x1 = pCaretXArray[ 2*(nMnemonicPos - nIndex) ]; long lc_x2 = pCaretXArray[ 2*(nMnemonicPos - nIndex)+1 ]; nMnemonicWidth = ::abs((int)(lc_x1 - lc_x2)); @@ -6933,9 +7011,9 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, { Color aOldTextColor; Color aOldTextFillColor; - BOOL bRestoreFillColor; - BOOL bHighContrastBlack = FALSE; - BOOL bHighContrastWhite = FALSE; + sal_Bool bRestoreFillColor; + sal_Bool bHighContrastBlack = sal_False; + sal_Bool bHighContrastWhite = sal_False; const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() ); if( rStyleSettings.GetHighContrastMode() ) { @@ -6951,11 +7029,11 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, aOldTextColor = GetTextColor(); if ( IsTextFillColor() ) { - bRestoreFillColor = TRUE; + bRestoreFillColor = sal_True; aOldTextFillColor = GetTextFillColor(); } else - bRestoreFillColor = FALSE; + bRestoreFillColor = sal_False; if( bHighContrastBlack ) SetTextColor( COL_GREEN ); @@ -6992,7 +7070,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, long OutputDevice::GetCtrlTextWidth( const String& rStr, xub_StrLen nIndex, xub_StrLen nLen, - USHORT nStyle ) const + sal_uInt16 nStyle ) const { DBG_TRACE( "OutputDevice::GetCtrlTextSize()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -7006,7 +7084,7 @@ long OutputDevice::GetCtrlTextWidth( const String& rStr, if ( nMnemonicPos < nIndex ) nIndex--; else if ( (nLen < STRING_LEN) && - (nMnemonicPos >= nIndex) && (nMnemonicPos < (ULONG)(nIndex+nLen)) ) + (nMnemonicPos >= nIndex) && (nMnemonicPos < (sal_uLong)(nIndex+nLen)) ) nLen--; } return GetTextWidth( aStr, nIndex, nLen ); @@ -7095,7 +7173,7 @@ FontInfo OutputDevice::GetDevFont( int nDevFontIndex ) const // ----------------------------------------------------------------------- -BOOL OutputDevice::AddTempDevFont( const String& rFileURL, const String& rFontName ) +sal_Bool OutputDevice::AddTempDevFont( const String& rFileURL, const String& rFontName ) { DBG_TRACE( "OutputDevice::AddTempDevFont()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -7103,17 +7181,17 @@ BOOL OutputDevice::AddTempDevFont( const String& rFileURL, const String& rFontNa ImplInitFontList(); if( !mpGraphics && !ImplGetGraphics() ) - return FALSE; + return sal_False; bool bRC = mpGraphics->AddTempDevFont( mpFontList, rFileURL, rFontName ); if( !bRC ) - return FALSE; + return sal_False; if( mpAlphaVDev ) mpAlphaVDev->AddTempDevFont( rFileURL, rFontName ); mpFontCache->Invalidate(); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -7167,7 +7245,7 @@ Size OutputDevice::GetDevFontSize( const Font& rFont, int nSizeIndex ) const // ----------------------------------------------------------------------- -BOOL OutputDevice::IsFontAvailable( const String& rFontName ) const +sal_Bool OutputDevice::IsFontAvailable( const String& rFontName ) const { DBG_TRACE( "OutputDevice::IsFontAvailable()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -7387,7 +7465,7 @@ xub_StrLen OutputDevice::ValidateKashidas ( const String& rTxt, // TODO: best is to get rid of this method completely -ULONG OutputDevice::GetKerningPairCount() const +sal_uLong OutputDevice::GetKerningPairCount() const { DBG_TRACE( "OutputDevice::GetKerningPairCount()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -7413,7 +7491,7 @@ inline bool CmpKernData( const KerningPair& a, const KerningPair& b ) } // TODO: best is to get rid of this method completely -void OutputDevice::GetKerningPairs( ULONG nRequestedPairs, KerningPair* pKernPairs ) const +void OutputDevice::GetKerningPairs( sal_uLong nRequestedPairs, KerningPair* pKernPairs ) const { DBG_TRACE( "OutputDevice::GetKerningPairs()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -7435,7 +7513,7 @@ void OutputDevice::GetKerningPairs( ULONG nRequestedPairs, KerningPair* pKernPai // ----------------------------------------------------------------------- -BOOL OutputDevice::GetGlyphBoundRects( const Point& rOrigin, const String& rStr, +sal_Bool OutputDevice::GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) { DBG_TRACE( "OutputDevice::GetGlyphBoundRect_CTL()" ); @@ -7460,14 +7538,14 @@ BOOL OutputDevice::GetGlyphBoundRects( const Point& rOrigin, const String& rStr, // ----------------------------------------------------------------------- -BOOL OutputDevice::GetTextBoundRect( Rectangle& rRect, +sal_Bool OutputDevice::GetTextBoundRect( Rectangle& rRect, const String& rStr, xub_StrLen nBase, xub_StrLen nIndex, xub_StrLen nLen, - ULONG nLayoutWidth, const sal_Int32* pDXAry ) const + sal_uLong nLayoutWidth, const sal_Int32* pDXAry ) const { DBG_TRACE( "OutputDevice::GetTextBoundRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; rRect.SetEmpty(); SalLayout* pSalLayout = NULL; @@ -7531,8 +7609,8 @@ BOOL OutputDevice::GetTextBoundRect( Rectangle& rRect, // so we need a monochrome virtual device with matching font VirtualDevice aVDev( 1 ); Font aFont( GetFont() ); - aFont.SetShadow( FALSE ); - aFont.SetOutline( FALSE ); + aFont.SetShadow( sal_False ); + aFont.SetOutline( sal_False ); aFont.SetRelief( RELIEF_NONE ); aFont.SetOrientation( 0 ); aFont.SetSize( Size( mpFontEntry->maFontSelData.mnWidth, mpFontEntry->maFontSelData.mnHeight ) ); @@ -7565,7 +7643,7 @@ BOOL OutputDevice::GetTextBoundRect( Rectangle& rRect, Bitmap aBmp = aVDev.GetBitmap( Point(), aOutSize ); BitmapReadAccess* pAcc = aBmp.AcquireReadAccess(); if( !pAcc ) - return FALSE; + return sal_False; const BitmapColor aBlack( pAcc->GetBestMatchingColor( Color( COL_BLACK ) ) ); const long nW = pAcc->Width(); const long nH = pAcc->Height(); @@ -7630,17 +7708,17 @@ BOOL OutputDevice::GetTextBoundRect( Rectangle& rRect, aTopLeft.X() = ImplDevicePixelToLogicWidth( aTopLeft.X() ); aTopLeft.Y() = ImplDevicePixelToLogicHeight( aTopLeft.Y() ); rRect = Rectangle( aTopLeft, aSize ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector, +sal_Bool OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector, const String& rStr, xub_StrLen nBase, xub_StrLen nIndex, xub_StrLen nLen, - BOOL bOptimize, ULONG nTWidth, const sal_Int32* pDXArray ) const + sal_Bool bOptimize, sal_uLong nTWidth, const sal_Int32* pDXArray ) const { // the fonts need to be initialized if( mbNewFont ) @@ -7648,9 +7726,9 @@ BOOL OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector, if( mbInitFont ) ImplInitFont(); if( !mpFontEntry ) - return FALSE; + return sal_False; - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; rVector.clear(); if( nLen == STRING_LEN ) nLen = rStr.Len() - nIndex; @@ -7658,11 +7736,11 @@ BOOL OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector, // we want to get the Rectangle in logical units, so to // avoid rounding errors we just size the font in logical units - BOOL bOldMap = mbMap; + sal_Bool bOldMap = mbMap; if( bOldMap ) { - const_cast<OutputDevice&>(*this).mbMap = FALSE; - const_cast<OutputDevice&>(*this).mbNewFont = TRUE; + const_cast<OutputDevice&>(*this).mbMap = sal_False; + const_cast<OutputDevice&>(*this).mbNewFont = sal_True; } SalLayout* pSalLayout = NULL; @@ -7722,7 +7800,7 @@ BOOL OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector, { // restore original font size and map mode const_cast<OutputDevice&>(*this).mbMap = bOldMap; - const_cast<OutputDevice&>(*this).mbNewFont = TRUE; + const_cast<OutputDevice&>(*this).mbNewFont = sal_True; } if( bRet || (OUTDEV_PRINTER == meOutDevType) || !mpFontEntry ) @@ -7769,7 +7847,7 @@ BOOL OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector, pSalLayout->Release(); if( !nWidth || !nHeight ) - return TRUE; + return sal_True; double fScaleX = static_cast< double >(nOrgWidth) / nWidth; double fScaleY = static_cast< double >(nOrgHeight) / nHeight; @@ -7826,10 +7904,10 @@ BOOL OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector, else { // convert units to logical width - for (USHORT j = 0; j < aPolyPoly.Count(); ++j) + for (sal_uInt16 j = 0; j < aPolyPoly.Count(); ++j) { Polygon& rPoly = aPolyPoly[j]; - for (USHORT k = 0; k < rPoly.GetSize(); ++k) + for (sal_uInt16 k = 0; k < rPoly.GetSize(); ++k) { Point& rPt = rPoly[k]; rPt -= aOffset; @@ -7867,9 +7945,9 @@ BOOL OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector, // ----------------------------------------------------------------------- -BOOL OutputDevice::GetTextOutlines( PolyPolyVector& rResultVector, +sal_Bool OutputDevice::GetTextOutlines( PolyPolyVector& rResultVector, const String& rStr, xub_StrLen nBase, xub_StrLen nIndex, - xub_StrLen nLen, BOOL bOptimize, ULONG nTWidth, const sal_Int32* pDXArray ) const + xub_StrLen nLen, sal_Bool bOptimize, sal_uLong nTWidth, const sal_Int32* pDXArray ) const { rResultVector.clear(); @@ -7877,7 +7955,7 @@ BOOL OutputDevice::GetTextOutlines( PolyPolyVector& rResultVector, ::basegfx::B2DPolyPolygonVector aB2DPolyPolyVector; if( !GetTextOutlines( aB2DPolyPolyVector, rStr, nBase, nIndex, nLen, bOptimize, nTWidth, pDXArray ) ) - return FALSE; + return sal_False; // convert to a tool polypolygon vector rResultVector.reserve( aB2DPolyPolyVector.size() ); @@ -7885,14 +7963,14 @@ BOOL OutputDevice::GetTextOutlines( PolyPolyVector& rResultVector, for(; aIt != aB2DPolyPolyVector.end(); ++aIt ) rResultVector.push_back(PolyPolygon(*aIt)); // #i76339# - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL OutputDevice::GetTextOutline( PolyPolygon& rPolyPoly, +sal_Bool OutputDevice::GetTextOutline( PolyPolygon& rPolyPoly, const String& rStr, xub_StrLen nBase, xub_StrLen nIndex, xub_StrLen nLen, - BOOL bOptimize, ULONG nTWidth, const sal_Int32* pDXArray ) const + sal_Bool bOptimize, sal_uLong nTWidth, const sal_Int32* pDXArray ) const { rPolyPoly.Clear(); @@ -7900,7 +7978,7 @@ BOOL OutputDevice::GetTextOutline( PolyPolygon& rPolyPoly, ::basegfx::B2DPolyPolygonVector aB2DPolyPolyVector; if( !GetTextOutlines( aB2DPolyPolyVector, rStr, nBase, nIndex, nLen, bOptimize, nTWidth, pDXArray ) ) - return FALSE; + return sal_False; // convert and merge into a tool polypolygon ::basegfx::B2DPolyPolygonVector::const_iterator aIt = aB2DPolyPolyVector.begin(); @@ -7908,7 +7986,7 @@ BOOL OutputDevice::GetTextOutline( PolyPolygon& rPolyPoly, for( unsigned int i = 0; i < aIt->count(); ++i ) rPolyPoly.Insert(Polygon((*aIt).getB2DPolygon( i ))); // #i76339# - return TRUE; + return sal_True; } bool OutputDevice::GetFontCapabilities( FontCapabilities& rFontCapabilities ) const @@ -7929,22 +8007,22 @@ bool OutputDevice::GetFontCapabilities( FontCapabilities& rFontCapabilities ) co // ----------------------------------------------------------------------- -BOOL OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const +sal_Bool OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const { rFontCharMap.Reset(); // we need a graphics if( !mpGraphics && !ImplGetGraphics() ) - return FALSE; + return sal_False; if( mbNewFont ) ImplNewFont(); if( mbInitFont ) ImplInitFont(); if( !mpFontEntry ) - return FALSE; + return sal_False; - // a little font charmap cache helps considerably +#ifdef ENABLE_IFC_CACHE // a little font charmap cache helps considerably static const int NMAXITEMS = 16; static int nUsedItems = 0, nCurItem = 0; @@ -7962,10 +8040,12 @@ BOOL OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const rFontCharMap.Reset( aCache[i].maCharMap.mpImpl ); } else // need to cache +#endif // ENABLE_IFC_CACHE { - ImplFontCharMap* pNewMap = mpGraphics->GetImplFontCharMap(); + const ImplFontCharMap* pNewMap = mpGraphics->GetImplFontCharMap(); rFontCharMap.Reset( pNewMap ); +#ifdef ENABLE_IFC_CACHE // manage cache round-robin and insert data CharMapCacheItem& rItem = aCache[ nCurItem ]; rItem.mpFontData = pFontData; @@ -7976,11 +8056,12 @@ BOOL OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const if( ++nUsedItems >= NMAXITEMS ) nUsedItems = NMAXITEMS; +#endif // ENABLE_IFC_CACHE } if( rFontCharMap.IsDefaultMap() ) - return FALSE; - return TRUE; + return sal_False; + return sal_True; } // ----------------------------------------------------------------------- @@ -7991,7 +8072,7 @@ xub_StrLen OutputDevice::HasGlyphs( const Font& rTempFont, const String& rStr, if( nIndex >= rStr.Len() ) return nIndex; xub_StrLen nEnd = nIndex + nLen; - if( (ULONG)nIndex+nLen > rStr.Len() ) + if( (sal_uLong)nIndex+nLen > rStr.Len() ) nEnd = rStr.Len(); DBG_ASSERT( nIndex < nEnd, "StartPos >= EndPos?" ); @@ -8001,11 +8082,11 @@ xub_StrLen OutputDevice::HasGlyphs( const Font& rTempFont, const String& rStr, const Font aOrigFont = GetFont(); const_cast<OutputDevice&>(*this).SetFont( rTempFont ); FontCharMap aFontCharMap; - BOOL bRet = GetFontCharMap( aFontCharMap ); + sal_Bool bRet = GetFontCharMap( aFontCharMap ); const_cast<OutputDevice&>(*this).SetFont( aOrigFont ); // if fontmap is unknown assume it doesn't have the glyphs - if( bRet == FALSE ) + if( bRet == sal_False ) return nIndex; const sal_Unicode* pStr = rStr.GetBuffer(); diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx index 2fd02378c9b0..91d8845c7788 100644 --- a/vcl/source/gdi/outdev4.cxx +++ b/vcl/source/gdi/outdev4.cxx @@ -87,7 +87,7 @@ void OutputDevice::ImplDrawPolygon( const Polygon& rPoly, const PolyPolygon* pCl ImplDrawPolyPolygon( rPoly, pClipPolyPoly ); else { - USHORT nPoints = rPoly.GetSize(); + sal_uInt16 nPoints = rPoly.GetSize(); if ( nPoints < 2 ) return; @@ -114,7 +114,7 @@ void OutputDevice::ImplDrawPolyPolygon( const PolyPolygon& rPolyPoly, const Poly if( pPolyPoly->Count() == 1 ) { const Polygon rPoly = pPolyPoly->GetObject( 0 ); - USHORT nSize = rPoly.GetSize(); + sal_uInt16 nSize = rPoly.GetSize(); if( nSize >= 2 ) { @@ -124,14 +124,14 @@ void OutputDevice::ImplDrawPolyPolygon( const PolyPolygon& rPolyPoly, const Poly } else if( pPolyPoly->Count() ) { - USHORT nCount = pPolyPoly->Count(); + sal_uInt16 nCount = pPolyPoly->Count(); sal_uInt32* pPointAry = new sal_uInt32[nCount]; PCONSTSALPOINT* pPointAryAry = new PCONSTSALPOINT[nCount]; - USHORT i = 0; + sal_uInt16 i = 0; do { const Polygon& rPoly = pPolyPoly->GetObject( i ); - USHORT nSize = rPoly.GetSize(); + sal_uInt16 nSize = rPoly.GetSize(); if ( nSize ) { pPointAry[i] = nSize; @@ -158,26 +158,26 @@ void OutputDevice::ImplDrawPolyPolygon( const PolyPolygon& rPolyPoly, const Poly // ----------------------------------------------------------------------- -inline UINT8 ImplGetGradientColorValue( long nValue ) +inline sal_uInt8 ImplGetGradientColorValue( long nValue ) { if ( nValue < 0 ) return 0; else if ( nValue > 0xFF ) return 0xFF; else - return (UINT8)nValue; + return (sal_uInt8)nValue; } // ----------------------------------------------------------------------- void OutputDevice::ImplDrawLinearGradient( const Rectangle& rRect, const Gradient& rGradient, - BOOL bMtf, const PolyPolygon* pClipPolyPoly ) + sal_Bool bMtf, const PolyPolygon* pClipPolyPoly ) { // rotiertes BoundRect ausrechnen Rectangle aRect; Point aCenter; - USHORT nAngle = rGradient.GetAngle() % 3600; + sal_uInt16 nAngle = rGradient.GetAngle() % 3600; rGradient.GetBoundRect( rRect, aRect, aCenter ); @@ -281,9 +281,9 @@ void OutputDevice::ImplDrawLinearGradient( const Rectangle& rRect, double fScanInc = (double)aRect.GetHeight() / (double)nSteps; // Startfarbe berechnen und setzen - UINT8 nRed; - UINT8 nGreen; - UINT8 nBlue; + sal_uInt8 nRed; + sal_uInt8 nGreen; + sal_uInt8 nBlue; long nSteps2; long nStepsHalf = 0; if ( bLinear ) @@ -291,23 +291,23 @@ void OutputDevice::ImplDrawLinearGradient( const Rectangle& rRect, // Um 1 erhoeht, um die Border innerhalb der Schleife // zeichnen zu koennen nSteps2 = nSteps + 1; - nRed = (UINT8)nStartRed; - nGreen = (UINT8)nStartGreen; - nBlue = (UINT8)nStartBlue; + nRed = (sal_uInt8)nStartRed; + nGreen = (sal_uInt8)nStartGreen; + nBlue = (sal_uInt8)nStartBlue; } else { // Um 2 erhoeht, um die Border innerhalb der Schleife // zeichnen zu koennen nSteps2 = nSteps + 2; - nRed = (UINT8)nEndRed; - nGreen = (UINT8)nEndGreen; - nBlue = (UINT8)nEndBlue; + nRed = (sal_uInt8)nEndRed; + nGreen = (sal_uInt8)nEndGreen; + nBlue = (sal_uInt8)nEndBlue; nStepsHalf = nSteps >> 1; } if ( bMtf ) - mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), TRUE ) ); + mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), sal_True ) ); else mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) ); @@ -368,9 +368,9 @@ void OutputDevice::ImplDrawLinearGradient( const Rectangle& rRect, // on. if ( i >= nSteps ) { - nRed = (UINT8)nEndRed; - nGreen = (UINT8)nEndGreen; - nBlue = (UINT8)nEndBlue; + nRed = (sal_uInt8)nEndRed; + nGreen = (sal_uInt8)nEndGreen; + nBlue = (sal_uInt8)nEndBlue; } else { @@ -392,7 +392,7 @@ void OutputDevice::ImplDrawLinearGradient( const Rectangle& rRect, } if ( bMtf ) - mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), TRUE ) ); + mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), sal_True ) ); else mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) ); } @@ -402,7 +402,7 @@ void OutputDevice::ImplDrawLinearGradient( const Rectangle& rRect, void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, const Gradient& rGradient, - BOOL bMtf, const PolyPolygon* pClipPolyPoly ) + sal_Bool bMtf, const PolyPolygon* pClipPolyPoly ) { // Feststellen ob Ausgabe ueber Polygon oder PolyPolygon // Bei Rasteroperationen ungleich Overpaint immer PolyPolygone, @@ -427,7 +427,7 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, long nGreenSteps = nEndGreen - nStartGreen; long nBlueSteps = nEndBlue - nStartBlue; long nStepCount = rGradient.GetSteps(); - USHORT nAngle = rGradient.GetAngle() % 3600; + sal_uInt16 nAngle = rGradient.GetAngle() % 3600; rGradient.GetBoundRect( rRect, aRect, aCenter ); @@ -480,11 +480,11 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, double fScanRight = aRect.Right(); double fScanBottom = aRect.Bottom(); double fScanInc = (double) nMinRect / (double) nSteps * 0.5; - UINT8 nRed = (UINT8) nStartRed, nGreen = (UINT8) nStartGreen, nBlue = (UINT8) nStartBlue; + sal_uInt8 nRed = (sal_uInt8) nStartRed, nGreen = (sal_uInt8) nStartGreen, nBlue = (sal_uInt8) nStartBlue; bool bPaintLastPolygon( false ); // #107349# Paint last polygon only if loop has generated any output if( bMtf ) - mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), TRUE ) ); + mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), sal_True ) ); else mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) ); @@ -552,7 +552,7 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, // the one painted in the window outdev path below. To get // matching colors, have to delay color setting here. if( bMtf ) - mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), TRUE ) ); + mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), sal_True ) ); else mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) ); } @@ -560,7 +560,7 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, { // #107349# Set fill color _before_ geometry painting if( bMtf ) - mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), TRUE ) ); + mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), sal_True ) ); else mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) ); @@ -587,7 +587,7 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, if( bMtf ) { - mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), TRUE ) ); + mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), sal_True ) ); mpMetaFile->AddAction( new MetaPolygonAction( rPoly ) ); } else @@ -647,7 +647,7 @@ void OutputDevice::DrawGradient( const Rectangle& rRect, if ( mnDrawMode & DRAWMODE_GRAYGRADIENT ) { - BYTE cStartLum = aStartCol.GetLuminance(), cEndLum = aEndCol.GetLuminance(); + sal_uInt8 cStartLum = aStartCol.GetLuminance(), cEndLum = aEndCol.GetLuminance(); aStartCol = Color( cStartLum, cStartLum, cStartLum ); aEndCol = Color( cEndLum, cEndLum, cEndLum ); } @@ -707,19 +707,19 @@ void OutputDevice::DrawGradient( const Rectangle& rRect, if ( mbLineColor || mbInitLineColor ) { mpGraphics->SetLineColor(); - mbInitLineColor = TRUE; + mbInitLineColor = sal_True; } - mbInitFillColor = TRUE; + mbInitFillColor = sal_True; // calculate step count if neccessary if ( !aGradient.GetSteps() ) aGradient.SetSteps( GRADIENT_DEFAULT_STEPCOUNT ); if( aGradient.GetStyle() == GRADIENT_LINEAR || aGradient.GetStyle() == GRADIENT_AXIAL ) - ImplDrawLinearGradient( aRect, aGradient, FALSE, NULL ); + ImplDrawLinearGradient( aRect, aGradient, sal_False, NULL ); else - ImplDrawComplexGradient( aRect, aGradient, FALSE, NULL ); + ImplDrawComplexGradient( aRect, aGradient, sal_False, NULL ); } Pop(); @@ -795,9 +795,9 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly, } else { - const BOOL bOldOutput = IsOutputEnabled(); + const sal_Bool bOldOutput = IsOutputEnabled(); - EnableOutput( FALSE ); + EnableOutput( sal_False ); Push( PUSH_RASTEROP ); SetRasterOp( ROP_XOR ); DrawGradient( aRect, rGradient ); @@ -825,7 +825,7 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly, if ( mnDrawMode & DRAWMODE_GRAYGRADIENT ) { - BYTE cStartLum = aStartCol.GetLuminance(), cEndLum = aEndCol.GetLuminance(); + sal_uInt8 cStartLum = aStartCol.GetLuminance(), cEndLum = aEndCol.GetLuminance(); aStartCol = Color( cStartLum, cStartLum, cStartLum ); aEndCol = Color( cEndLum, cEndLum, cEndLum ); } @@ -872,19 +872,19 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly, if( mbLineColor || mbInitLineColor ) { mpGraphics->SetLineColor(); - mbInitLineColor = TRUE; + mbInitLineColor = sal_True; } - mbInitFillColor = TRUE; + mbInitFillColor = sal_True; // calculate step count if neccessary if ( !aGradient.GetSteps() ) aGradient.SetSteps( GRADIENT_DEFAULT_STEPCOUNT ); if( aGradient.GetStyle() == GRADIENT_LINEAR || aGradient.GetStyle() == GRADIENT_AXIAL ) - ImplDrawLinearGradient( aRect, aGradient, FALSE, &aClipPolyPoly ); + ImplDrawLinearGradient( aRect, aGradient, sal_False, &aClipPolyPoly ); else - ImplDrawComplexGradient( aRect, aGradient, FALSE, &aClipPolyPoly ); + ImplDrawComplexGradient( aRect, aGradient, sal_False, &aClipPolyPoly ); } } } @@ -926,9 +926,9 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly, if( pVDev->SetOutputSizePixel( aDstSize) ) { MapMode aVDevMap; - const BOOL bOldMap = mbMap; + const sal_Bool bOldMap = mbMap; - EnableMapMode( FALSE ); + EnableMapMode( sal_False ); pVDev->DrawOutDev( Point(), aDstSize, aDstRect.TopLeft(), aDstSize, *this ); pVDev->SetRasterOp( ROP_XOR ); @@ -977,7 +977,7 @@ void OutputDevice::AddGradientActions( const Rectangle& rRect, const Gradient& r mpMetaFile = &rMtf; mpMetaFile->AddAction( new MetaPushAction( PUSH_ALL ) ); mpMetaFile->AddAction( new MetaISectRectClipRegionAction( aRect ) ); - mpMetaFile->AddAction( new MetaLineColorAction( Color(), FALSE ) ); + mpMetaFile->AddAction( new MetaLineColorAction( Color(), sal_False ) ); // because we draw with no border line, we have to expand gradient // rect to avoid missing lines on the right and bottom edge @@ -991,9 +991,9 @@ void OutputDevice::AddGradientActions( const Rectangle& rRect, const Gradient& r aGradient.SetSteps( GRADIENT_DEFAULT_STEPCOUNT ); if( aGradient.GetStyle() == GRADIENT_LINEAR || aGradient.GetStyle() == GRADIENT_AXIAL ) - ImplDrawLinearGradient( aRect, aGradient, TRUE, NULL ); + ImplDrawLinearGradient( aRect, aGradient, sal_True, NULL ); else - ImplDrawComplexGradient( aRect, aGradient, TRUE, NULL ); + ImplDrawComplexGradient( aRect, aGradient, sal_True, NULL ); mpMetaFile->AddAction( new MetaPopAction() ); mpMetaFile = pOldMtf; @@ -1021,7 +1021,7 @@ void OutputDevice::DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch aColor = Color( COL_WHITE ); else if ( mnDrawMode & DRAWMODE_GRAYLINE ) { - const UINT8 cLum = aColor.GetLuminance(); + const sal_uInt8 cLum = aColor.GetLuminance(); aColor = Color( cLum, cLum, cLum ); } else if( mnDrawMode & DRAWMODE_SETTINGSLINE ) @@ -1058,17 +1058,17 @@ void OutputDevice::DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch { PolyPolygon aPolyPoly( LogicToPixel( rPolyPoly ) ); GDIMetaFile* pOldMetaFile = mpMetaFile; - BOOL bOldMap = mbMap; + sal_Bool bOldMap = mbMap; aPolyPoly.Optimize( POLY_OPTIMIZE_NO_SAME ); aHatch.SetDistance( ImplLogicWidthToDevicePixel( aHatch.GetDistance() ) ); mpMetaFile = NULL; - EnableMapMode( FALSE ); + EnableMapMode( sal_False ); Push( PUSH_LINECOLOR ); SetLineColor( aHatch.GetColor() ); ImplInitLineColor(); - ImplDrawHatch( aPolyPoly, aHatch, FALSE ); + ImplDrawHatch( aPolyPoly, aHatch, sal_False ); Pop(); EnableMapMode( bOldMap ); mpMetaFile = pOldMetaFile; @@ -1094,8 +1094,8 @@ void OutputDevice::AddHatchActions( const PolyPolygon& rPolyPoly, const Hatch& r mpMetaFile = &rMtf; mpMetaFile->AddAction( new MetaPushAction( PUSH_ALL ) ); - mpMetaFile->AddAction( new MetaLineColorAction( rHatch.GetColor(), TRUE ) ); - ImplDrawHatch( aPolyPoly, rHatch, TRUE ); + mpMetaFile->AddAction( new MetaLineColorAction( rHatch.GetColor(), sal_True ) ); + ImplDrawHatch( aPolyPoly, rHatch, sal_True ); mpMetaFile->AddAction( new MetaPopAction() ); mpMetaFile = pOldMtf; } @@ -1103,7 +1103,7 @@ void OutputDevice::AddHatchActions( const PolyPolygon& rPolyPoly, const Hatch& r // ----------------------------------------------------------------------- -void OutputDevice::ImplDrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch, BOOL bMtf ) +void OutputDevice::ImplDrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch, sal_Bool bMtf ) { Rectangle aRect( rPolyPoly.GetBoundRect() ); const long nLogPixelWidth = ImplDevicePixelToLogicWidth( 1 ); @@ -1154,7 +1154,7 @@ void OutputDevice::ImplDrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHa // ----------------------------------------------------------------------- -void OutputDevice::ImplCalcHatchValues( const Rectangle& rRect, long nDist, USHORT nAngle10, +void OutputDevice::ImplCalcHatchValues( const Rectangle& rRect, long nDist, sal_uInt16 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 ) { Point aRef; @@ -1265,14 +1265,14 @@ void OutputDevice::ImplCalcHatchValues( const Rectangle& rRect, long nDist, USHO // ------------------------------------------------------------------------ void OutputDevice::ImplDrawHatchLine( const Line& rLine, const PolyPolygon& rPolyPoly, - Point* pPtBuffer, BOOL bMtf ) + Point* pPtBuffer, sal_Bool bMtf ) { double fX, fY; long nAdd, nPCounter = 0; for( long nPoly = 0, nPolyCount = rPolyPoly.Count(); nPoly < nPolyCount; nPoly++ ) { - const Polygon& rPoly = rPolyPoly[ (USHORT) nPoly ]; + const Polygon& rPoly = rPolyPoly[ (sal_uInt16) nPoly ]; if( rPoly.GetSize() > 1 ) { @@ -1280,7 +1280,7 @@ void OutputDevice::ImplDrawHatchLine( const Line& rLine, const PolyPolygon& rPol for( long i = 1, nCount = rPoly.GetSize(); i <= nCount; i++ ) { - aCurSegment.SetEnd( rPoly[ (USHORT)( i % nCount ) ] ); + aCurSegment.SetEnd( rPoly[ (sal_uInt16)( i % nCount ) ] ); nAdd = 0; if( rLine.Intersection( aCurSegment, fX, fY ) ) @@ -1288,7 +1288,7 @@ void OutputDevice::ImplDrawHatchLine( const Line& rLine, const PolyPolygon& rPol if( ( fabs( fX - aCurSegment.GetStart().X() ) <= 0.0000001 ) && ( fabs( fY - aCurSegment.GetStart().Y() ) <= 0.0000001 ) ) { - const Line aPrevSegment( rPoly[ (USHORT)( ( i > 1 ) ? ( i - 2 ) : ( nCount - 1 ) ) ], aCurSegment.GetStart() ); + const Line aPrevSegment( rPoly[ (sal_uInt16)( ( i > 1 ) ? ( i - 2 ) : ( nCount - 1 ) ) ], aCurSegment.GetStart() ); const double fPrevDistance = rLine.GetDistance( aPrevSegment.GetStart() ); const double fCurDistance = rLine.GetDistance( aCurSegment.GetEnd() ); @@ -1301,7 +1301,7 @@ void OutputDevice::ImplDrawHatchLine( const Line& rLine, const PolyPolygon& rPol else if( ( fabs( fX - aCurSegment.GetEnd().X() ) <= 0.0000001 ) && ( fabs( fY - aCurSegment.GetEnd().Y() ) <= 0.0000001 ) ) { - const Line aNextSegment( aCurSegment.GetEnd(), rPoly[ (USHORT)( ( i + 1 ) % nCount ) ] ); + const Line aNextSegment( aCurSegment.GetEnd(), rPoly[ (sal_uInt16)( ( i + 1 ) % nCount ) ] ); if( ( fabs( rLine.GetDistance( aNextSegment.GetEnd() ) ) <= 0.0000001 ) && ( rLine.GetDistance( aCurSegment.GetStart() ) > 0.0 ) ) diff --git a/vcl/source/gdi/outdev5.cxx b/vcl/source/gdi/outdev5.cxx index 108945bf9160..539ecc0fa091 100644 --- a/vcl/source/gdi/outdev5.cxx +++ b/vcl/source/gdi/outdev5.cxx @@ -49,7 +49,7 @@ DBG_NAMEEX( OutputDevice ) // ======================================================================= void OutputDevice::DrawRect( const Rectangle& rRect, - ULONG nHorzRound, ULONG nVertRound ) + sal_uLong nHorzRound, sal_uLong nVertRound ) { DBG_TRACE( "OutputDevice::DrawRoundRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index 0b3f89d7805b..4b63c47eca83 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -58,7 +58,7 @@ DBG_NAMEEX( OutputDevice ) // ------------------------------------------------------------------------ -void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, ULONG nFlags ) +void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags ) { DBG_TRACE( "OutputDevice::DrawGrid()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -116,8 +116,8 @@ void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, ULONG nF if( mbInitFillColor ) ImplInitFillColor(); - const BOOL bOldMap = mbMap; - EnableMapMode( FALSE ); + const sal_Bool bOldMap = mbMap; + EnableMapMode( sal_False ); if( nFlags & GRID_DOTS ) { @@ -223,7 +223,7 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, // ------------------------------------------------------------------------ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, - USHORT nTransparencePercent ) + sal_uInt16 nTransparencePercent ) { DBG_TRACE( "OutputDevice::DrawTransparent()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -345,7 +345,7 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, const Size aDPISize( LogicToPixel( Size( 1, 1 ), MAP_INCH ) ); const long nBaseExtent = Max( FRound( aDPISize.Width() / 300. ), 1L ); long nMove; - const USHORT nTrans = ( nTransparencePercent < 13 ) ? 0 : + const sal_uInt16 nTrans = ( nTransparencePercent < 13 ) ? 0 : ( nTransparencePercent < 38 ) ? 25 : ( nTransparencePercent < 63 ) ? 50 : ( nTransparencePercent < 88 ) ? 75 : 100; @@ -366,8 +366,8 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, Push( PUSH_CLIPREGION | PUSH_LINECOLOR ); IntersectClipRegion( rPolyPoly ); SetLineColor( GetFillColor() ); - const BOOL bOldMap = mbMap; - EnableMapMode( FALSE ); + const sal_Bool bOldMap = mbMap; + EnableMapMode( sal_False ); if(nMove) { @@ -454,16 +454,16 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, { VirtualDevice aVDev( *this, 1 ); const Size aDstSz( aDstRect.GetSize() ); - const BYTE cTrans = (BYTE) MinMax( FRound( nTransparencePercent * 2.55 ), 0, 255 ); + const sal_uInt8 cTrans = (sal_uInt8) MinMax( FRound( nTransparencePercent * 2.55 ), 0, 255 ); if( aDstRect.Left() || aDstRect.Top() ) aPolyPoly.Move( -aDstRect.Left(), -aDstRect.Top() ); if( aVDev.SetOutputSizePixel( aDstSz ) ) { - const BOOL bOldMap = mbMap; + const sal_Bool bOldMap = mbMap; - EnableMapMode( FALSE ); + EnableMapMode( sal_False ); aVDev.SetLineColor( COL_BLACK ); aVDev.SetFillColor( COL_BLACK ); @@ -491,25 +491,25 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, if( aPaint.GetBitCount() <= 8 ) { const BitmapPalette& rPal = pW->GetPalette(); - const USHORT nCount = rPal.GetEntryCount(); - BitmapColor* pMap = (BitmapColor*) new BYTE[ nCount * sizeof( BitmapColor ) ]; + const sal_uInt16 nCount = rPal.GetEntryCount(); + BitmapColor* pMap = (BitmapColor*) new sal_uInt8[ nCount * sizeof( BitmapColor ) ]; - for( USHORT i = 0; i < nCount; i++ ) + for( sal_uInt16 i = 0; i < nCount; i++ ) { BitmapColor aCol( rPal[ i ] ); - pMap[ i ] = BitmapColor( (BYTE) rPal.GetBestIndex( aCol.Merge( aFillCol, cTrans ) ) ); + pMap[ i ] = BitmapColor( (sal_uInt8) rPal.GetBestIndex( aCol.Merge( aFillCol, cTrans ) ) ); } if( pR->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL && pW->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) { - const BYTE cBlack = aBlack.GetIndex(); + const sal_uInt8 cBlack = aBlack.GetIndex(); for( nY = 0; nY < nHeight; nY++ ) { Scanline pWScan = pW->GetScanline( nY ); Scanline pRScan = pR->GetScanline( nY ); - BYTE cBit = 128; + sal_uInt8 cBit = 128; for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan++ ) { @@ -517,7 +517,7 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, cBit = 128, pRScan++; if( ( *pRScan & cBit ) == cBlack ) - *pWScan = (BYTE) pMap[ *pWScan ].GetIndex(); + *pWScan = (sal_uInt8) pMap[ *pWScan ].GetIndex(); } } } @@ -529,20 +529,20 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, pW->SetPixel( nY, nX, pMap[ pW->GetPixel( nY, nX ).GetIndex() ] ); } - delete[] (BYTE*) pMap; + delete[] (sal_uInt8*) pMap; } else { if( pR->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL && pW->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR ) { - const BYTE cBlack = aBlack.GetIndex(); + const sal_uInt8 cBlack = aBlack.GetIndex(); for( nY = 0; nY < nHeight; nY++ ) { Scanline pWScan = pW->GetScanline( nY ); Scanline pRScan = pR->GetScanline( nY ); - BYTE cBit = 128; + sal_uInt8 cBit = 128; for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan += 3 ) { @@ -606,9 +606,9 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, if( mpAlphaVDev ) { const Color aFillCol( mpAlphaVDev->GetFillColor() ); - mpAlphaVDev->SetFillColor( Color(sal::static_int_cast<UINT8>(255*nTransparencePercent/100), - sal::static_int_cast<UINT8>(255*nTransparencePercent/100), - sal::static_int_cast<UINT8>(255*nTransparencePercent/100)) ); + mpAlphaVDev->SetFillColor( Color(sal::static_int_cast<sal_uInt8>(255*nTransparencePercent/100), + sal::static_int_cast<sal_uInt8>(255*nTransparencePercent/100), + sal::static_int_cast<sal_uInt8>(255*nTransparencePercent/100)) ); mpAlphaVDev->DrawTransparent( rPolyPoly, nTransparencePercent ); @@ -723,19 +723,19 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, AlphaMask aAlpha; MapMode aMap( GetMapMode() ); Point aOutPos( PixelToLogic( aDstRect.TopLeft() ) ); - const BOOL bOldMap = mbMap; + const sal_Bool bOldMap = mbMap; aMap.SetOrigin( Point( -aOutPos.X(), -aOutPos.Y() ) ); pVDev->SetMapMode( aMap ); - const BOOL bVDevOldMap = pVDev->IsMapModeEnabled(); + const sal_Bool bVDevOldMap = pVDev->IsMapModeEnabled(); // create paint bitmap ( (GDIMetaFile&) rMtf ).WindStart(); ( (GDIMetaFile&) rMtf ).Play( pVDev, rPos, rSize ); ( (GDIMetaFile&) rMtf ).WindStart(); - pVDev->EnableMapMode( FALSE ); + pVDev->EnableMapMode( sal_False ); aPaint = pVDev->GetBitmap( Point(), pVDev->GetOutputSizePixel() ); - pVDev->EnableMapMode( bVDevOldMap ); // #i35331#: MUST NOT use EnableMapMode( TRUE ) here! + pVDev->EnableMapMode( bVDevOldMap ); // #i35331#: MUST NOT use EnableMapMode( sal_True ) here! // create mask bitmap pVDev->SetLineColor( COL_BLACK ); @@ -746,22 +746,22 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, ( (GDIMetaFile&) rMtf ).WindStart(); ( (GDIMetaFile&) rMtf ).Play( pVDev, rPos, rSize ); ( (GDIMetaFile&) rMtf ).WindStart(); - pVDev->EnableMapMode( FALSE ); + pVDev->EnableMapMode( sal_False ); aMask = pVDev->GetBitmap( Point(), pVDev->GetOutputSizePixel() ); - pVDev->EnableMapMode( bVDevOldMap ); // #i35331#: MUST NOT use EnableMapMode( TRUE ) here! + pVDev->EnableMapMode( bVDevOldMap ); // #i35331#: MUST NOT use EnableMapMode( sal_True ) here! // create alpha mask from gradient pVDev->SetDrawMode( DRAWMODE_GRAYGRADIENT ); pVDev->DrawGradient( Rectangle( rPos, rSize ), rTransparenceGradient ); pVDev->SetDrawMode( DRAWMODE_DEFAULT ); - pVDev->EnableMapMode( FALSE ); + pVDev->EnableMapMode( sal_False ); pVDev->DrawMask( Point(), pVDev->GetOutputSizePixel(), aMask, Color( COL_WHITE ) ); aAlpha = pVDev->GetBitmap( Point(), pVDev->GetOutputSizePixel() ); delete pVDev; - EnableMapMode( FALSE ); + EnableMapMode( sal_False ); DrawBitmapEx( aDstRect.TopLeft(), BitmapEx( aPaint, aAlpha ) ); EnableMapMode( bOldMap ); } @@ -785,8 +785,8 @@ void OutputDevice::ImplDrawColorWallpaper( long nX, long nY, Color aOldFillColor = GetFillColor(); SetLineColor(); SetFillColor( rWallpaper.GetColor() ); - BOOL bMap = mbMap; - EnableMapMode( FALSE ); + sal_Bool bMap = mbMap; + EnableMapMode( sal_False ); DrawRect( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ) ); SetLineColor( aOldLineColor ); SetFillColor( aOldFillColor ); @@ -805,10 +805,10 @@ void OutputDevice::ImplDrawBitmapWallpaper( long nX, long nY, Size aSize; GDIMetaFile* pOldMetaFile = mpMetaFile; const WallpaperStyle eStyle = rWallpaper.GetStyle(); - const BOOL bOldMap = mbMap; - BOOL bDrawn = FALSE; - BOOL bDrawGradientBackground = FALSE; - BOOL bDrawColorBackground = FALSE; + const sal_Bool bOldMap = mbMap; + sal_Bool bDrawn = sal_False; + sal_Bool bDrawGradientBackground = sal_False; + sal_Bool bDrawColorBackground = sal_False; if( pCached ) aBmpEx = *pCached; @@ -817,13 +817,13 @@ void OutputDevice::ImplDrawBitmapWallpaper( long nX, long nY, const long nBmpWidth = aBmpEx.GetSizePixel().Width(); const long nBmpHeight = aBmpEx.GetSizePixel().Height(); - const BOOL bTransparent = aBmpEx.IsTransparent(); + const sal_Bool bTransparent = aBmpEx.IsTransparent(); // draw background if( bTransparent ) { if( rWallpaper.IsGradient() ) - bDrawGradientBackground = TRUE; + bDrawGradientBackground = sal_True; else { if( !pCached && !rWallpaper.GetColor().GetTransparency() ) @@ -835,15 +835,15 @@ void OutputDevice::ImplDrawBitmapWallpaper( long nX, long nY, aBmpEx = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() ); } - bDrawColorBackground = TRUE; + bDrawColorBackground = sal_True; } } else if( eStyle != WALLPAPER_TILE && eStyle != WALLPAPER_SCALE ) { if( rWallpaper.IsGradient() ) - bDrawGradientBackground = TRUE; + bDrawGradientBackground = sal_True; else - bDrawColorBackground = TRUE; + bDrawColorBackground = sal_True; } // background of bitmap? @@ -852,7 +852,7 @@ void OutputDevice::ImplDrawBitmapWallpaper( long nX, long nY, else if( bDrawColorBackground && bTransparent ) { ImplDrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper ); - bDrawColorBackground = FALSE; + bDrawColorBackground = sal_False; } // calc pos and size @@ -869,7 +869,7 @@ void OutputDevice::ImplDrawBitmapWallpaper( long nX, long nY, } mpMetaFile = NULL; - EnableMapMode( FALSE ); + EnableMapMode( sal_False ); Push( PUSH_CLIPREGION ); IntersectClipRegion( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ) ); @@ -969,7 +969,7 @@ void OutputDevice::ImplDrawBitmapWallpaper( long nX, long nY, for( long nBmpX = nStartX; nBmpX <= nRight; nBmpX += nBmpWidth ) DrawBitmapEx( Point( nBmpX, nBmpY ), aBmpEx ); - bDrawn = TRUE; + bDrawn = sal_True; } break; } @@ -1044,8 +1044,8 @@ void OutputDevice::ImplDrawGradientWallpaper( long nX, long nY, { Rectangle aBound; GDIMetaFile* pOldMetaFile = mpMetaFile; - const BOOL bOldMap = mbMap; - BOOL bNeedGradient = TRUE; + const sal_Bool bOldMap = mbMap; + sal_Bool bNeedGradient = sal_True; /* if ( rWallpaper.IsRect() ) @@ -1055,7 +1055,7 @@ void OutputDevice::ImplDrawGradientWallpaper( long nX, long nY, aBound = Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ); mpMetaFile = NULL; - EnableMapMode( FALSE ); + EnableMapMode( sal_False ); Push( PUSH_CLIPREGION ); IntersectClipRegion( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ) ); @@ -1072,7 +1072,7 @@ void OutputDevice::ImplDrawGradientWallpaper( long nX, long nY, if( mnOutOffX+nWidth > gradientWidth ) ImplDrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper.GetGradient().GetEndColor() ); if( mnOutOffX > gradientWidth ) - bNeedGradient = FALSE; + bNeedGradient = sal_False; else aBound = Rectangle( Point( -mnOutOffX, nY ), Size( gradientWidth, nHeight ) ); } @@ -1134,7 +1134,7 @@ void OutputDevice::Erase() if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() ) return; - BOOL bNativeOK = FALSE; + sal_Bool bNativeOK = sal_False; if( meOutDevType == OUTDEV_WINDOW ) { Window* pWindow = static_cast<Window*>(this); @@ -1218,7 +1218,7 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, aRect.Justify(); bDrawn = mpGraphics->DrawEPS( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), - (BYTE*) rGfxLink.GetData(), rGfxLink.GetDataSize(), this ); + (sal_uInt8*) rGfxLink.GetData(), rGfxLink.GetDataSize(), this ); } // else draw the substitution graphics diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx index 1cf138e351e3..8c2fa869378e 100644..100755 --- a/vcl/source/gdi/outdevnative.cxx +++ b/vcl/source/gdi/outdevnative.cxx @@ -88,6 +88,10 @@ MenubarValue::~MenubarValue() { } +MenupopupValue::~MenupopupValue() +{ +} + PushButtonValue::~PushButtonValue() { } @@ -99,14 +103,14 @@ PushButtonValue::~PushButtonValue() // ----------------------------------------------------------------------- -BOOL OutputDevice::IsNativeControlSupported( ControlType nType, ControlPart nPart ) +sal_Bool OutputDevice::IsNativeControlSupported( ControlType nType, ControlPart nPart ) { if( !lcl_enableNativeWidget( *this ) ) - return FALSE; + return sal_False; if ( !mpGraphics ) if ( !ImplGetGraphics() ) - return FALSE; + return sal_False; return( mpGraphics->IsNativeControlSupported(nType, nPart) ); } @@ -114,18 +118,18 @@ BOOL OutputDevice::IsNativeControlSupported( ControlType nType, ControlPart nPar // ----------------------------------------------------------------------- -BOOL OutputDevice::HitTestNativeControl( ControlType nType, +sal_Bool OutputDevice::HitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& aPos, - BOOL& rIsInside ) + sal_Bool& rIsInside ) { if( !lcl_enableNativeWidget( *this ) ) - return FALSE; + return sal_False; if ( !mpGraphics ) if ( !ImplGetGraphics() ) - return FALSE; + return sal_False; Point aWinOffs( mnOutOffX, mnOutOffY ); Rectangle screenRegion( rControlRegion ); @@ -201,14 +205,21 @@ static boost::shared_ptr< ImplControlValue > lcl_transformControlValue( const Im case CTRL_GENERIC: aResult.reset( new ImplControlValue( rVal ) ); break; + case CTRL_MENU_POPUP: + { + const MenupopupValue* pMVal = static_cast<const MenupopupValue*>(&rVal); + MenupopupValue* pNew = new MenupopupValue( *pMVal ); + pNew->maItemRect = rDev.ImplLogicToDevicePixel( pMVal->maItemRect ); + aResult.reset( pNew ); + } + break; default: OSL_ENSURE( 0, "unknown ImplControlValue type !" ); break; } return aResult; } - -BOOL OutputDevice::DrawNativeControl( ControlType nType, +sal_Bool OutputDevice::DrawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, @@ -216,17 +227,17 @@ BOOL OutputDevice::DrawNativeControl( ControlType nType, ::rtl::OUString aCaption ) { if( !lcl_enableNativeWidget( *this ) ) - return FALSE; + return sal_False; // make sure the current clip region is initialized correctly if ( !mpGraphics ) if ( !ImplGetGraphics() ) - return FALSE; + return sal_False; if ( mbInitClipRegion ) ImplInitClipRegion(); if ( mbOutputClipped ) - return TRUE; + return sal_True; if ( mbInitLineColor ) ImplInitLineColor(); @@ -243,7 +254,7 @@ BOOL OutputDevice::DrawNativeControl( ControlType nType, if( aTestRegion == rControlRegion ) nState |= CTRL_CACHING_ALLOWED; // control is not clipped, caching allowed - BOOL bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, *aScreenCtrlValue, aCaption, this ); + sal_Bool bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, *aScreenCtrlValue, aCaption, this ); return bRet; } @@ -251,7 +262,7 @@ BOOL OutputDevice::DrawNativeControl( ControlType nType, // ----------------------------------------------------------------------- -BOOL OutputDevice::DrawNativeControlText(ControlType nType, +sal_Bool OutputDevice::DrawNativeControlText(ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, @@ -259,7 +270,7 @@ BOOL OutputDevice::DrawNativeControlText(ControlType nType, ::rtl::OUString aCaption ) { if( !lcl_enableNativeWidget( *this ) ) - return FALSE; + return sal_False; // make sure the current clip region is initialized correctly if ( !mpGraphics ) @@ -281,7 +292,7 @@ BOOL OutputDevice::DrawNativeControlText(ControlType nType, boost::shared_ptr< ImplControlValue > aScreenCtrlValue( lcl_transformControlValue( aValue, *this ) ); Rectangle screenRegion( ImplLogicToDevicePixel( rControlRegion ) ); - BOOL bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, *aScreenCtrlValue, aCaption, this ); + sal_Bool bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, *aScreenCtrlValue, aCaption, this ); return bRet; } @@ -289,7 +300,7 @@ BOOL OutputDevice::DrawNativeControlText(ControlType nType, // ----------------------------------------------------------------------- -BOOL OutputDevice::GetNativeControlRegion( ControlType nType, +sal_Bool OutputDevice::GetNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, @@ -299,18 +310,18 @@ BOOL OutputDevice::GetNativeControlRegion( ControlType nType, Rectangle &rNativeContentRegion ) { if( !lcl_enableNativeWidget( *this ) ) - return FALSE; + return sal_False; if ( !mpGraphics ) if ( !ImplGetGraphics() ) - return FALSE; + return sal_False; // Convert the coordinates from relative to Window-absolute, so we draw // in the correct place in platform code boost::shared_ptr< ImplControlValue > aScreenCtrlValue( lcl_transformControlValue( aValue, *this ) ); Rectangle screenRegion( ImplLogicToDevicePixel( rControlRegion ) ); - BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, *aScreenCtrlValue, + sal_Bool bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, *aScreenCtrlValue, aCaption, rNativeBoundingRegion, rNativeContentRegion, this ); if( bRet ) diff --git a/vcl/source/gdi/outmap.cxx b/vcl/source/gdi/outmap.cxx index d33f58d3ef14..a0b2c6521aac 100644 --- a/vcl/source/gdi/outmap.cxx +++ b/vcl/source/gdi/outmap.cxx @@ -131,7 +131,7 @@ static void ImplCalcBigIntThreshold( long nDPIX, long nDPIY, { // Schwellenwerte fuer BigInt Arithmetik berechnen long nDenomHalfX = rMapRes.mnMapScDenomX / 2; - ULONG nDenomX = rMapRes.mnMapScDenomX; + sal_uLong nDenomX = rMapRes.mnMapScDenomX; long nProductX = nDPIX * rMapRes.mnMapScNumX; if ( !nProductX ) @@ -142,9 +142,9 @@ static void ImplCalcBigIntThreshold( long nDPIX, long nDPIY, if ( !nDenomX ) rThresRes.mnThresPixToLogX = LONG_MAX; else if ( nProductX >= 0 ) - rThresRes.mnThresPixToLogX = (long)(((ULONG)LONG_MAX - (ULONG)( nProductX/2)) / nDenomX); + rThresRes.mnThresPixToLogX = (long)(((sal_uLong)LONG_MAX - (sal_uLong)( nProductX/2)) / nDenomX); else - rThresRes.mnThresPixToLogX = (long)(((ULONG)LONG_MAX + (ULONG)(-nProductX/2)) / nDenomX); + rThresRes.mnThresPixToLogX = (long)(((sal_uLong)LONG_MAX + (sal_uLong)(-nProductX/2)) / nDenomX); } if ( nDPIY && (LONG_MAX / nDPIY < Abs( rMapRes.mnMapScNumY ) ) ) // #111139# avoid div by zero @@ -156,7 +156,7 @@ static void ImplCalcBigIntThreshold( long nDPIX, long nDPIY, { // Schwellenwerte fuer BigInt Arithmetik berechnen long nDenomHalfY = rMapRes.mnMapScDenomY / 2; - ULONG nDenomY = rMapRes.mnMapScDenomY; + sal_uLong nDenomY = rMapRes.mnMapScDenomY; long nProductY = nDPIY * rMapRes.mnMapScNumY; if ( !nProductY ) @@ -167,9 +167,9 @@ static void ImplCalcBigIntThreshold( long nDPIX, long nDPIY, if ( !nDenomY ) rThresRes.mnThresPixToLogY = LONG_MAX; else if ( nProductY >= 0 ) - rThresRes.mnThresPixToLogY = (long)(((ULONG)LONG_MAX - (ULONG)( nProductY/2)) / nDenomY); + rThresRes.mnThresPixToLogY = (long)(((sal_uLong)LONG_MAX - (sal_uLong)( nProductY/2)) / nDenomY); else - rThresRes.mnThresPixToLogY = (long)(((ULONG)LONG_MAX + (ULONG)(-nProductY/2)) / nDenomY); + rThresRes.mnThresPixToLogY = (long)(((sal_uLong)LONG_MAX + (sal_uLong)(-nProductY/2)) / nDenomY); } rThresRes.mnThresLogToPixX /= 2; @@ -600,8 +600,8 @@ Polygon OutputDevice::ImplLogicToDevicePixel( const Polygon& rLogicPoly ) const if ( !mbMap && !mnOutOffX && !mnOutOffY ) return rLogicPoly; - USHORT i; - USHORT nPoints = rLogicPoly.GetSize(); + sal_uInt16 i; + sal_uInt16 nPoints = rLogicPoly.GetSize(); Polygon aPoly( rLogicPoly ); // Pointer auf das Point-Array holen (Daten werden kopiert) @@ -644,8 +644,8 @@ PolyPolygon OutputDevice::ImplLogicToDevicePixel( const PolyPolygon& rLogicPolyP return rLogicPolyPoly; PolyPolygon aPolyPoly( rLogicPolyPoly ); - USHORT nPoly = aPolyPoly.Count(); - for( USHORT i = 0; i < nPoly; i++ ) + sal_uInt16 nPoly = aPolyPoly.Count(); + for( sal_uInt16 i = 0; i < nPoly; i++ ) { Polygon& rPoly = aPolyPoly[i]; rPoly = ImplLogicToDevicePixel( rPoly ); @@ -725,7 +725,7 @@ Region OutputDevice::ImplPixelToDevicePixel( const Region& rRegion ) const // ----------------------------------------------------------------------- -void OutputDevice::EnableMapMode( BOOL bEnable ) +void OutputDevice::EnableMapMode( sal_Bool bEnable ) { mbMap = (bEnable != 0); @@ -744,12 +744,12 @@ void OutputDevice::SetMapMode() if ( mbMap || !maMapMode.IsDefault() ) { - mbMap = FALSE; + mbMap = sal_False; maMapMode = MapMode(); // create new objects (clip region werden nicht neu skaliert) - mbNewFont = TRUE; - mbInitFont = TRUE; + mbNewFont = sal_True; + mbInitFont = sal_True; if ( GetOutDevType() == OUTDEV_WINDOW ) { if ( ((Window*)this)->mpWindowImpl->mpCursor ) @@ -774,7 +774,7 @@ void OutputDevice::SetMapMode( const MapMode& rNewMapMode ) { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); - BOOL bRelMap = (rNewMapMode.GetMapUnit() == MAP_RELATIVE); + sal_Bool bRelMap = (rNewMapMode.GetMapUnit() == MAP_RELATIVE); if ( mpMetaFile ) { @@ -793,7 +793,7 @@ void OutputDevice::SetMapMode( const MapMode& rNewMapMode ) mpAlphaVDev->SetMapMode( rNewMapMode ); // Ist Default-MapMode, dann bereche nichts - BOOL bOldMap = mbMap; + sal_Bool bOldMap = mbMap; mbMap = !rNewMapMode.IsDefault(); if ( mbMap ) { @@ -849,8 +849,8 @@ void OutputDevice::SetMapMode( const MapMode& rNewMapMode ) maMapMode = rNewMapMode; // create new objects (clip region werden nicht neu skaliert) - mbNewFont = TRUE; - mbInitFont = TRUE; + mbNewFont = sal_True; + mbInitFont = sal_True; if ( GetOutDevType() == OUTDEV_WINDOW ) { if ( ((Window*)this)->mpWindowImpl->mpCursor ) @@ -1121,8 +1121,8 @@ Polygon OutputDevice::LogicToPixel( const Polygon& rLogicPoly ) const if ( !mbMap ) return rLogicPoly; - USHORT i; - USHORT nPoints = rLogicPoly.GetSize(); + sal_uInt16 i; + sal_uInt16 nPoints = rLogicPoly.GetSize(); Polygon aPoly( rLogicPoly ); // Pointer auf das Point-Array holen (Daten werden kopiert) @@ -1155,8 +1155,8 @@ PolyPolygon OutputDevice::LogicToPixel( const PolyPolygon& rLogicPolyPoly ) cons return rLogicPolyPoly; PolyPolygon aPolyPoly( rLogicPolyPoly ); - USHORT nPoly = aPolyPoly.Count(); - for( USHORT i = 0; i < nPoly; i++ ) + sal_uInt16 nPoly = aPolyPoly.Count(); + for( sal_uInt16 i = 0; i < nPoly; i++ ) { Polygon& rPoly = aPolyPoly[i]; rPoly = LogicToPixel( rPoly ); @@ -1217,7 +1217,7 @@ Region OutputDevice::LogicToPixel( const Region& rLogicRegion ) const long nWidth; long nHeight; ImplRegionInfo aInfo; - BOOL bRegionRect; + sal_Bool bRegionRect; aRegion.ImplBeginAddRect(); bRegionRect = rLogicRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight ); @@ -1324,8 +1324,8 @@ Polygon OutputDevice::LogicToPixel( const Polygon& rLogicPoly, ImplThresholdRes aThresRes; ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes ); - USHORT i; - USHORT nPoints = rLogicPoly.GetSize(); + sal_uInt16 i; + sal_uInt16 nPoints = rLogicPoly.GetSize(); Polygon aPoly( rLogicPoly ); // Pointer auf das Point-Array holen (Daten werden kopiert) @@ -1359,8 +1359,8 @@ PolyPolygon OutputDevice::LogicToPixel( const PolyPolygon& rLogicPolyPoly, return rLogicPolyPoly; PolyPolygon aPolyPoly( rLogicPolyPoly ); - USHORT nPoly = aPolyPoly.Count(); - for( USHORT i = 0; i < nPoly; i++ ) + sal_uInt16 nPoly = aPolyPoly.Count(); + for( sal_uInt16 i = 0; i < nPoly; i++ ) { Polygon& rPoly = aPolyPoly[i]; rPoly = LogicToPixel( rPoly, rMapMode ); @@ -1415,7 +1415,7 @@ Region OutputDevice::LogicToPixel( const Region& rLogicRegion, long nWidth; long nHeight; ImplRegionInfo aInfo; - BOOL bRegionRect; + sal_Bool bRegionRect; aRegion.ImplBeginAddRect(); bRegionRect = rLogicRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight ); @@ -1498,8 +1498,8 @@ Polygon OutputDevice::PixelToLogic( const Polygon& rDevicePoly ) const if ( !mbMap ) return rDevicePoly; - USHORT i; - USHORT nPoints = rDevicePoly.GetSize(); + sal_uInt16 i; + sal_uInt16 nPoints = rDevicePoly.GetSize(); Polygon aPoly( rDevicePoly ); // Pointer auf das Point-Array holen (Daten werden kopiert) @@ -1532,8 +1532,8 @@ PolyPolygon OutputDevice::PixelToLogic( const PolyPolygon& rDevicePolyPoly ) con return rDevicePolyPoly; PolyPolygon aPolyPoly( rDevicePolyPoly ); - USHORT nPoly = aPolyPoly.Count(); - for( USHORT i = 0; i < nPoly; i++ ) + sal_uInt16 nPoly = aPolyPoly.Count(); + for( sal_uInt16 i = 0; i < nPoly; i++ ) { Polygon& rPoly = aPolyPoly[i]; rPoly = PixelToLogic( rPoly ); @@ -1585,7 +1585,7 @@ Region OutputDevice::PixelToLogic( const Region& rDeviceRegion ) const long nWidth; long nHeight; ImplRegionInfo aInfo; - BOOL bRegionRect; + sal_Bool bRegionRect; aRegion.ImplBeginAddRect(); bRegionRect = rDeviceRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight ); @@ -1696,8 +1696,8 @@ Polygon OutputDevice::PixelToLogic( const Polygon& rDevicePoly, ImplThresholdRes aThresRes; ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes ); - USHORT i; - USHORT nPoints = rDevicePoly.GetSize(); + sal_uInt16 i; + sal_uInt16 nPoints = rDevicePoly.GetSize(); Polygon aPoly( rDevicePoly ); // Pointer auf das Point-Array holen (Daten werden kopiert) @@ -1731,8 +1731,8 @@ PolyPolygon OutputDevice::PixelToLogic( const PolyPolygon& rDevicePolyPoly, return rDevicePolyPoly; PolyPolygon aPolyPoly( rDevicePolyPoly ); - USHORT nPoly = aPolyPoly.Count(); - for( USHORT i = 0; i < nPoly; i++ ) + sal_uInt16 nPoly = aPolyPoly.Count(); + for( sal_uInt16 i = 0; i < nPoly; i++ ) { Polygon& rPoly = aPolyPoly[i]; rPoly = PixelToLogic( rPoly, rMapMode ); @@ -1787,7 +1787,7 @@ Region OutputDevice::PixelToLogic( const Region& rDeviceRegion, long nWidth; long nHeight; ImplRegionInfo aInfo; - BOOL bRegionRect; + sal_Bool bRegionRect; aRegion.ImplBeginAddRect(); bRegionRect = rDeviceRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight ); @@ -2103,7 +2103,7 @@ Rectangle OutputDevice::LogicToLogic( const Rectangle& rRectSource, // ----------------------------------------------------------------------- -long* OutputDevice::LogicToLogic( long* pX, USHORT nCount, +long* OutputDevice::LogicToLogic( long* pX, sal_uInt16 nCount, const MapMode* pMapModeSource, const MapMode* pMapModeDest ) const { diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 0119350063e0..2b3173c4b128 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -783,7 +783,7 @@ void PDFExtOutDevData::EndGroup() mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::EndGroup ); } void PDFExtOutDevData::EndGroup( const Graphic& rGraphic, - BYTE nTransparency, + sal_uInt8 nTransparency, const Rectangle& rOutputRect, const Rectangle& rVisibleOutputRect ) { diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index fd527fb94e55..881205e0af77 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -39,9 +39,9 @@ PDFWriter::AnyWidget::~AnyWidget() { } -PDFWriter::PDFWriter( const PDFWriter::PDFWriterContext& rContext ) +PDFWriter::PDFWriter( const PDFWriter::PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& xEnc ) : - pImplementation( new PDFWriterImpl( rContext ) ) + pImplementation( new PDFWriterImpl( rContext, xEnc, *this ) ) { } @@ -70,16 +70,6 @@ PDFWriter::PDFVersion PDFWriter::GetVersion() const return ((PDFWriterImpl*)pImplementation)->getVersion(); } -void PDFWriter::SetDocInfo( const PDFDocInfo& rInfo ) -{ - ((PDFWriterImpl*)pImplementation)->setDocInfo( rInfo ); -} - -const PDFDocInfo& PDFWriter::GetDocInfo() const -{ - return ((PDFWriterImpl*)pImplementation)->getDocInfo(); -} - void PDFWriter::SetDocumentLocale( const com::sun::star::lang::Locale& rLoc ) { ((PDFWriterImpl*)pImplementation)->setDocumentLocale( rLoc ); @@ -101,7 +91,7 @@ void PDFWriter::DrawTextLine( FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, - BOOL bUnderlineAbove ) + sal_Bool bUnderlineAbove ) { ((PDFWriterImpl*)pImplementation)->drawTextLine( rPos, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove ); } @@ -118,7 +108,7 @@ void PDFWriter::DrawTextArray( void PDFWriter::DrawStretchText( const Point& rStartPt, - ULONG nWidth, + sal_uLong nWidth, const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen ) @@ -129,7 +119,7 @@ void PDFWriter::DrawStretchText( void PDFWriter::DrawText( const Rectangle& rRect, const XubString& rStr, - USHORT nStyle ) + sal_uInt16 nStyle ) { ((PDFWriterImpl*)pImplementation)->drawText( rRect, rStr, nStyle ); } @@ -159,7 +149,7 @@ void PDFWriter::DrawRect( const Rectangle& rRect ) ((PDFWriterImpl*)pImplementation)->drawRectangle( rRect ); } -void PDFWriter::DrawRect( const Rectangle& rRect, ULONG nHorzRound, ULONG nVertRound ) +void PDFWriter::DrawRect( const Rectangle& rRect, sal_uLong nHorzRound, sal_uLong nVertRound ) { ((PDFWriterImpl*)pImplementation)->drawRectangle( rRect, nHorzRound, nVertRound ); } @@ -292,7 +282,7 @@ void PDFWriter::DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpap ((PDFWriterImpl*)pImplementation)->drawWallpaper( rRect, rWallpaper ); } -void PDFWriter::DrawTransparent( const PolyPolygon& rPolyPoly, USHORT nTransparencePercent ) +void PDFWriter::DrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent ) { ((PDFWriterImpl*)pImplementation)->drawTransparent( rPolyPoly, nTransparencePercent ); } @@ -302,7 +292,7 @@ void PDFWriter::BeginTransparencyGroup() ((PDFWriterImpl*)pImplementation)->beginTransparencyGroup(); } -void PDFWriter::EndTransparencyGroup( const Rectangle& rRect, USHORT nTransparentPercent ) +void PDFWriter::EndTransparencyGroup( const Rectangle& rRect, sal_uInt16 nTransparentPercent ) { ((PDFWriterImpl*)pImplementation)->endTransparencyGroup( rRect, nTransparentPercent ); } @@ -312,7 +302,7 @@ void PDFWriter::EndTransparencyGroup( const Rectangle& rRect, const Bitmap& rAlp ((PDFWriterImpl*)pImplementation)->endTransparencyGroup( rRect, rAlphaMask ); } -void PDFWriter::Push( USHORT nFlags ) +void PDFWriter::Push( sal_uInt16 nFlags ) { ((PDFWriterImpl*)pImplementation)->push( nFlags ); } @@ -367,12 +357,12 @@ void PDFWriter::IntersectClipRegion( const Rectangle& rRect ) ((PDFWriterImpl*)pImplementation)->intersectClipRegion( rRect ); } -void PDFWriter::SetAntialiasing( USHORT nMode ) +void PDFWriter::SetAntialiasing( sal_uInt16 nMode ) { ((PDFWriterImpl*)pImplementation)->setAntiAlias( (sal_Int32)nMode ); } -void PDFWriter::SetLayoutMode( ULONG nMode ) +void PDFWriter::SetLayoutMode( sal_uLong nMode ) { ((PDFWriterImpl*)pImplementation)->setLayoutMode( (sal_Int32)nMode ); } @@ -571,4 +561,18 @@ std::set< PDFWriter::ErrorCode > PDFWriter::GetErrors() return ((PDFWriterImpl*)pImplementation)->getErrors(); } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > +PDFWriter::InitEncryption( const rtl::OUString& i_rOwnerPassword, + const rtl::OUString& i_rUserPassword, + bool b128Bit + ) +{ + return PDFWriterImpl::initEncryption( i_rOwnerPassword, i_rUserPassword, b128Bit ); +} + +void PDFWriter::PlayMetafile( const GDIMetaFile& i_rMTF, const vcl::PDFWriter::PlayMetafileContext& i_rPlayContext, PDFExtOutDevData* i_pData ) +{ + ((PDFWriterImpl*)pImplementation)->playMetafile( i_rMTF, i_pData, i_rPlayContext, NULL); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 6afa91f16c73..1373d0f9b280 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -55,6 +55,7 @@ #include <vcl/metric.hxx> #include <vcl/fontsubset.hxx> #include <vcl/textlayout.hxx> +#include <vcl/cvtgrf.hxx> #include <svsys.h> #include <vcl/salgdi.hxx> #include <vcl/svapp.hxx> @@ -68,6 +69,7 @@ #include "cppuhelper/implbase1.hxx" #include <icc/sRGB-IEC61966-2.1.hxx> #include <vcl/lineinfo.hxx> +#include "vcl/strhelper.hxx" using namespace vcl; @@ -120,12 +122,10 @@ void doTestCode() aContext.Version = PDFWriter::PDF_1_4; aContext.Tagged = true; aContext.InitialPage = 2; + aContext.DocumentInfo.Title = OUString( RTL_CONSTASCII_USTRINGPARAM( "PDF export test document" ) ); + aContext.DocumentInfo.Producer = OUString( RTL_CONSTASCII_USTRINGPARAM( "VCL" ) ); PDFWriter aWriter( aContext ); - PDFDocInfo aDocInfo; - aDocInfo.Title = OUString( RTL_CONSTASCII_USTRINGPARAM( "PDF export test document" ) ); - aDocInfo.Producer = OUString( RTL_CONSTASCII_USTRINGPARAM( "VCL" ) ); - aWriter.SetDocInfo( aDocInfo ); aWriter.NewPage( 595, 842 ); aWriter.BeginStructureElement( PDFWriter::Document ); // set duration of 3 sec for first page @@ -259,7 +259,7 @@ void doTestCode() BitmapWriteAccess* pAcc = aTransMask.AcquireWriteAccess(); for( int nX = 0; nX < 256; nX++ ) for( int nY = 0; nY < 256; nY++ ) - pAcc->SetPixel( nX, nY, BitmapColor( (BYTE)((nX+nY)/2) ) ); + pAcc->SetPixel( nX, nY, BitmapColor( (sal_uInt8)((nX+nY)/2) ) ); aTransMask.ReleaseAccess( pAcc ); aTransMask.SetPrefMapMode( MAP_MM ); aTransMask.SetPrefSize( Size( 10, 10 ) ); @@ -503,6 +503,12 @@ static inline double pixelToPoint( sal_Int32 px ) { return double(px)/fDivisor; static inline double pixelToPoint( double px ) { return px/fDivisor; } static inline sal_Int32 pointToPixel( double pt ) { return sal_Int32(pt*fDivisor); } +const sal_uInt8 PDFWriterImpl::s_nPadString[32] = +{ + 0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, + 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A +}; + static void appendHex( sal_Int8 nInt, OStringBuffer& rBuffer ) { static const sal_Char pHexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', @@ -890,34 +896,44 @@ static void appendDouble( double fValue, OStringBuffer& rBuffer, sal_Int32 nPrec } -static void appendColor( const Color& rColor, OStringBuffer& rBuffer ) +static void appendColor( const Color& rColor, OStringBuffer& rBuffer, bool bConvertToGrey = false ) { if( rColor != Color( COL_TRANSPARENT ) ) { - appendDouble( (double)rColor.GetRed() / 255.0, rBuffer ); - rBuffer.append( ' ' ); - appendDouble( (double)rColor.GetGreen() / 255.0, rBuffer ); - rBuffer.append( ' ' ); - appendDouble( (double)rColor.GetBlue() / 255.0, rBuffer ); + if( bConvertToGrey ) + { + sal_uInt8 cByte = rColor.GetLuminance(); + appendDouble( (double)cByte / 255.0, rBuffer ); + } + else + { + appendDouble( (double)rColor.GetRed() / 255.0, rBuffer ); + rBuffer.append( ' ' ); + appendDouble( (double)rColor.GetGreen() / 255.0, rBuffer ); + rBuffer.append( ' ' ); + appendDouble( (double)rColor.GetBlue() / 255.0, rBuffer ); + } } } -static void appendStrokingColor( const Color& rColor, OStringBuffer& rBuffer ) +void PDFWriterImpl::appendStrokingColor( const Color& rColor, OStringBuffer& rBuffer ) { if( rColor != Color( COL_TRANSPARENT ) ) { - appendColor( rColor, rBuffer ); - rBuffer.append( " RG" ); + bool bGrey = m_aContext.ColorMode == PDFWriter::DrawGreyscale; + appendColor( rColor, rBuffer, bGrey ); + rBuffer.append( bGrey ? " G" : " RG" ); } } -static void appendNonStrokingColor( const Color& rColor, OStringBuffer& rBuffer ) +void PDFWriterImpl::appendNonStrokingColor( const Color& rColor, OStringBuffer& rBuffer ) { if( rColor != Color( COL_TRANSPARENT ) ) { - appendColor( rColor, rBuffer ); - rBuffer.append( " rg" ); + bool bGrey = m_aContext.ColorMode == PDFWriter::DrawGreyscale; + appendColor( rColor, rBuffer, bGrey ); + rBuffer.append( bGrey ? " g" : " rg" ); } } @@ -1438,17 +1454,17 @@ void PDFWriterImpl::PDFPage::convertRect( Rectangle& rRect ) const void PDFWriterImpl::PDFPage::appendPolygon( const Polygon& rPoly, OStringBuffer& rBuffer, bool bClose ) const { - USHORT nPoints = rPoly.GetSize(); + sal_uInt16 nPoints = rPoly.GetSize(); /* * #108582# applications do weird things */ sal_uInt32 nBufLen = rBuffer.getLength(); if( nPoints > 0 ) { - const BYTE* pFlagArray = rPoly.GetConstFlagAry(); + const sal_uInt8* pFlagArray = rPoly.GetConstFlagAry(); appendPoint( rPoly[0], rBuffer ); rBuffer.append( " m\n" ); - for( USHORT i = 1; i < nPoints; i++ ) + for( sal_uInt16 i = 1; i < nPoints; i++ ) { if( pFlagArray && pFlagArray[i] == POLY_CONTROL && nPoints-i > 2 ) { @@ -1559,8 +1575,8 @@ void PDFWriterImpl::PDFPage::appendPolygon( const basegfx::B2DPolygon& rPoly, OS void PDFWriterImpl::PDFPage::appendPolyPolygon( const PolyPolygon& rPolyPoly, OStringBuffer& rBuffer, bool bClose ) const { - USHORT nPolygons = rPolyPoly.Count(); - for( USHORT n = 0; n < nPolygons; n++ ) + sal_uInt16 nPolygons = rPolyPoly.Count(); + for( sal_uInt16 n = 0; n < nPolygons; n++ ) appendPolygon( rPolyPoly[n], rBuffer, bClose ); } @@ -1695,7 +1711,9 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal * class PDFWriterImpl */ -PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext ) + PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, + const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& xEnc, + PDFWriter& i_rOuterFace) : m_pReferenceDevice( NULL ), m_aMapMode( MAP_POINT, Point(), Fraction( 1L, pointToPixel(1) ), Fraction( 1L, pointToPixel(1) ) ), @@ -1716,12 +1734,10 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext ) m_aCipher( (rtlCipher)NULL ), m_aDigest( NULL ), m_bEncryptThisStream( false ), - m_aDocID( 32 ), - m_aCreationDateString( 64 ), - m_aCreationMetaDateString( 64 ), m_pEncryptionBuffer( NULL ), m_nEncryptionBufferSize( 0 ), - m_bIsPDF_A1( false ) + m_bIsPDF_A1( false ), + m_rOuterFace( i_rOuterFace ) { #ifdef DO_TEST_PDF static bool bOnce = true; @@ -1760,14 +1776,37 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext ) m_bOpen = true; -/* prepare the cypher engine, can be done in CTOR, free in DTOR */ + // setup DocInfo + setupDocInfo(); + /* prepare the cypher engine, can be done in CTOR, free in DTOR */ m_aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream ); m_aDigest = rtl_digest_createMD5(); -/* the size of the Codec default maximum */ + /* the size of the Codec default maximum */ checkEncryptionBufferSize( 0x4000 ); + if( xEnc.is() ) + prepareEncryption( xEnc ); + + if( m_aContext.Encryption.Encrypt() ) + { + // sanity check + if( m_aContext.Encryption.OValue.size() != ENCRYPTED_PWD_SIZE || + m_aContext.Encryption.UValue.size() != ENCRYPTED_PWD_SIZE || + m_aContext.Encryption.EncryptionKey.size() != MAXIMUM_RC4_KEY_LENGTH + ) + { + // the field lengths are invalid ? This was not setup by initEncryption. + // do not encrypt after all + m_aContext.Encryption.OValue.clear(); + m_aContext.Encryption.UValue.clear(); + OSL_ENSURE( 0, "encryption data failed sanity check, encryption disabled" ); + } + else // setup key lengths + m_nAccessPermissions = computeAccessPermissions( m_aContext.Encryption, m_nKeyLength, m_nRC4KeyLength ); + } + // write header OStringBuffer aBuffer( 20 ); aBuffer.append( "%PDF-" ); @@ -1813,139 +1852,138 @@ PDFWriterImpl::~PDFWriterImpl() rtl_freeMemory( m_pEncryptionBuffer ); } -void PDFWriterImpl::setDocInfo( const PDFDocInfo& rInfo ) +void PDFWriterImpl::setupDocInfo() { - m_aDocInfo.Title = rInfo.Title; - m_aDocInfo.Author = rInfo.Author; - m_aDocInfo.Subject = rInfo.Subject; - m_aDocInfo.Keywords = rInfo.Keywords; - m_aDocInfo.Creator = rInfo.Creator; - m_aDocInfo.Producer = rInfo.Producer; + std::vector< sal_uInt8 > aId; + computeDocumentIdentifier( aId, m_aContext.DocumentInfo, m_aCreationDateString, m_aCreationMetaDateString ); + if( m_aContext.Encryption.DocumentIdentifier.empty() ) + m_aContext.Encryption.DocumentIdentifier = aId; +} -//build the document id +void PDFWriterImpl::computeDocumentIdentifier( std::vector< sal_uInt8 >& o_rIdentifier, + const vcl::PDFWriter::PDFDocInfo& i_rDocInfo, + rtl::OString& o_rCString1, + rtl::OString& o_rCString2 + ) +{ + o_rIdentifier.clear(); + + //build the document id rtl::OString aInfoValuesOut; OStringBuffer aID( 1024 ); - if( m_aDocInfo.Title.Len() ) - appendUnicodeTextString( m_aDocInfo.Title, aID ); - if( m_aDocInfo.Author.Len() ) - appendUnicodeTextString( m_aDocInfo.Author, aID ); - if( m_aDocInfo.Subject.Len() ) - appendUnicodeTextString( m_aDocInfo.Subject, aID ); - if( m_aDocInfo.Keywords.Len() ) - appendUnicodeTextString( m_aDocInfo.Keywords, aID ); - if( m_aDocInfo.Creator.Len() ) - appendUnicodeTextString( m_aDocInfo.Creator, aID ); - if( m_aDocInfo.Producer.Len() ) - appendUnicodeTextString( m_aDocInfo.Producer, aID ); + if( i_rDocInfo.Title.Len() ) + appendUnicodeTextString( i_rDocInfo.Title, aID ); + if( i_rDocInfo.Author.Len() ) + appendUnicodeTextString( i_rDocInfo.Author, aID ); + if( i_rDocInfo.Subject.Len() ) + appendUnicodeTextString( i_rDocInfo.Subject, aID ); + if( i_rDocInfo.Keywords.Len() ) + appendUnicodeTextString( i_rDocInfo.Keywords, aID ); + if( i_rDocInfo.Creator.Len() ) + appendUnicodeTextString( i_rDocInfo.Creator, aID ); + if( i_rDocInfo.Producer.Len() ) + appendUnicodeTextString( i_rDocInfo.Producer, aID ); TimeValue aTVal, aGMT; oslDateTime aDT; osl_getSystemTime( &aGMT ); osl_getLocalTimeFromSystemTime( &aGMT, &aTVal ); osl_getDateTimeFromTimeValue( &aTVal, &aDT ); - m_aCreationDateString.append( "D:" ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/1000)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/100)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/10)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Year)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Month/10)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Month)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Day/10)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Day)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Hours/10)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Hours)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Minutes/10)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Minutes)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Seconds/10)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Seconds)%10)) ); -//--> i59651, we fill the Metadata date string as well, if PDF/A is requested - if( m_bIsPDF_A1 ) - { -// according to ISO 19005-1:2005 6.7.3 the date is corrected for -// local time zone offset UTC only, whereas Acrobat 8 seems -// to use the localtime notation only -// according to a raccomandation in XMP Specification (Jan 2004, page 75) -// the Acrobat way seems the right approach - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/1000)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/100)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/10)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year)%10)) ); - m_aCreationMetaDateString.append( "-" ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Month/10)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Month)%10)) ); - m_aCreationMetaDateString.append( "-" ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Day/10)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Day)%10)) ); - m_aCreationMetaDateString.append( "T" ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Hours/10)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Hours)%10)) ); - m_aCreationMetaDateString.append( ":" ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Minutes/10)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Minutes)%10)) ); - m_aCreationMetaDateString.append( ":" ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Seconds/10)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Seconds)%10)) ); - } + rtl::OStringBuffer aCreationDateString(64), aCreationMetaDateString(64); + aCreationDateString.append( "D:" ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/1000)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/100)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/10)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Year)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Month/10)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Month)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Day/10)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Day)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Hours/10)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Hours)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Minutes/10)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Minutes)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Seconds/10)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Seconds)%10)) ); + + //--> i59651, we fill the Metadata date string as well, if PDF/A is requested + // according to ISO 19005-1:2005 6.7.3 the date is corrected for + // local time zone offset UTC only, whereas Acrobat 8 seems + // to use the localtime notation only + // according to a raccomandation in XMP Specification (Jan 2004, page 75) + // the Acrobat way seems the right approach + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/1000)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/100)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/10)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year)%10)) ); + aCreationMetaDateString.append( "-" ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Month/10)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Month)%10)) ); + aCreationMetaDateString.append( "-" ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Day/10)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Day)%10)) ); + aCreationMetaDateString.append( "T" ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Hours/10)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Hours)%10)) ); + aCreationMetaDateString.append( ":" ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Minutes/10)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Minutes)%10)) ); + aCreationMetaDateString.append( ":" ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Seconds/10)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Seconds)%10)) ); + sal_uInt32 nDelta = 0; if( aGMT.Seconds > aTVal.Seconds ) { - m_aCreationDateString.append( "-" ); + aCreationDateString.append( "-" ); nDelta = aGMT.Seconds-aTVal.Seconds; - if( m_bIsPDF_A1 ) - m_aCreationMetaDateString.append( "-" ); + aCreationMetaDateString.append( "-" ); } else if( aGMT.Seconds < aTVal.Seconds ) { - m_aCreationDateString.append( "+" ); + aCreationDateString.append( "+" ); nDelta = aTVal.Seconds-aGMT.Seconds; - if( m_bIsPDF_A1 ) - m_aCreationMetaDateString.append( "+" ); + aCreationMetaDateString.append( "+" ); } else { - m_aCreationDateString.append( "Z" ); - if( m_bIsPDF_A1 ) - m_aCreationMetaDateString.append( "Z" ); + aCreationDateString.append( "Z" ); + aCreationMetaDateString.append( "Z" ); } if( nDelta ) { - m_aCreationDateString.append( (sal_Char)('0' + ((nDelta/36000)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((nDelta/3600)%10)) ); - m_aCreationDateString.append( "'" ); - m_aCreationDateString.append( (sal_Char)('0' + ((nDelta/600)%6)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((nDelta/60)%10)) ); - if( m_bIsPDF_A1 ) - { - m_aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/36000)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/3600)%10)) ); - m_aCreationMetaDateString.append( ":" ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/600)%6)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/60)%10)) ); - } + aCreationDateString.append( (sal_Char)('0' + ((nDelta/36000)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((nDelta/3600)%10)) ); + aCreationDateString.append( "'" ); + aCreationDateString.append( (sal_Char)('0' + ((nDelta/600)%6)) ); + aCreationDateString.append( (sal_Char)('0' + ((nDelta/60)%10)) ); + + aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/36000)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/3600)%10)) ); + aCreationMetaDateString.append( ":" ); + aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/600)%6)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/60)%10)) ); } - m_aCreationDateString.append( "'" ); - aID.append( m_aCreationDateString.getStr(), m_aCreationDateString.getLength() ); + aCreationDateString.append( "'" ); + aID.append( aCreationDateString.getStr(), aCreationDateString.getLength() ); aInfoValuesOut = aID.makeStringAndClear(); + o_rCString1 = aCreationDateString.makeStringAndClear(); + o_rCString2 = aCreationMetaDateString.makeStringAndClear(); - DBG_ASSERT( m_aDigest != NULL, "PDFWrite_Impl::setDocInfo: cannot obtain a digest object !" ); - - m_aDocID.setLength( 0 ); - if( m_aDigest ) + rtlDigest aDigest = rtl_digest_createMD5(); + OSL_ENSURE( aDigest != NULL, "PDFWriterImpl::computeDocumentIdentifier: cannot obtain a digest object !" ); + if( aDigest ) { - osl_getSystemTime( &aGMT ); - rtlDigestError nError = rtl_digest_updateMD5( m_aDigest, &aGMT, sizeof( aGMT ) ); - if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( m_aDigest, m_aContext.URL.getStr(), m_aContext.URL.getLength()*sizeof(sal_Unicode) ); + rtlDigestError nError = rtl_digest_updateMD5( aDigest, &aGMT, sizeof( aGMT ) ); if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( m_aDigest, aInfoValuesOut.getStr(), aInfoValuesOut.getLength() ); + nError = rtl_digest_updateMD5( aDigest, aInfoValuesOut.getStr(), aInfoValuesOut.getLength() ); if( nError == rtl_Digest_E_None ) { -//the binary form of the doc id is needed for encryption stuff - rtl_digest_getMD5( m_aDigest, m_nDocID, 16 ); - for( unsigned int i = 0; i < 16; i++ ) - appendHex( m_nDocID[i], m_aDocID ); + o_rIdentifier = std::vector< sal_uInt8 >( 16, 0 ); + //the binary form of the doc id is needed for encryption stuff + rtl_digest_getMD5( aDigest, &o_rIdentifier[0], 16 ); } } } @@ -1958,7 +1996,7 @@ append the string as unicode hex, encrypted if needed inline void PDFWriterImpl::appendUnicodeTextStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer ) { rOutBuffer.append( "<" ); - if( m_aContext.Encrypt ) + if( m_aContext.Encryption.Encrypt() ) { const sal_Unicode* pStr = rInString.getStr(); sal_Int32 nLen = rInString.getLength(); @@ -1995,7 +2033,7 @@ inline void PDFWriterImpl::appendLiteralStringEncrypt( rtl::OStringBuffer& rInSt rOutBuffer.append( "(" ); sal_Int32 nChars = rInString.getLength(); //check for encryption, if ok, encrypt the string, then convert with appndLiteralString - if( m_aContext.Encrypt && checkEncryptionBufferSize( nChars ) ) + if( m_aContext.Encryption.Encrypt() && checkEncryptionBufferSize( nChars ) ) { //encrypt the string in a buffer, then append it enableStringEncryption( nInObjectNumber ); @@ -2016,22 +2054,22 @@ inline void PDFWriterImpl::appendLiteralStringEncrypt( const rtl::OString& rInSt void PDFWriterImpl::appendLiteralStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer, rtl_TextEncoding nEnc ) { rtl::OString aBufferString( rtl::OUStringToOString( rInString, nEnc ) ); - sal_Int32 nLen = aBufferString.getLength(); - rtl::OStringBuffer aBuf( nLen ); - const sal_Char* pT = aBufferString.getStr(); + sal_Int32 nLen = aBufferString.getLength(); + rtl::OStringBuffer aBuf( nLen ); + const sal_Char* pT = aBufferString.getStr(); - for( sal_Int32 i = 0; i < nLen; i++, pT++ ) + for( sal_Int32 i = 0; i < nLen; i++, pT++ ) + { + if( (*pT & 0x80) == 0 ) + aBuf.append( *pT ); + else { - if( (*pT & 0x80) == 0 ) - aBuf.append( *pT ); - else - { - aBuf.append( '<' ); - appendHex( *pT, aBuf ); - aBuf.append( '>' ); - } + aBuf.append( '<' ); + appendHex( *pT, aBuf ); + aBuf.append( '>' ); } - aBufferString = aBuf.makeStringAndClear(); + } + aBufferString = aBuf.makeStringAndClear(); appendLiteralStringEncrypt( aBufferString, nInObjectNumber, rOutBuffer); } @@ -2050,12 +2088,12 @@ bool PDFWriterImpl::compressStream( SvMemoryStream* pStream ) { #ifndef DEBUG_DISABLE_PDFCOMPRESSION pStream->Seek( STREAM_SEEK_TO_END ); - ULONG nEndPos = pStream->Tell(); + sal_uLong nEndPos = pStream->Tell(); pStream->Seek( STREAM_SEEK_TO_BEGIN ); ZCodec* pCodec = new ZCodec( 0x4000, 0x4000 ); SvMemoryStream aStream; pCodec->BeginCompression(); - pCodec->Write( aStream, (const BYTE*)pStream->GetData(), nEndPos ); + pCodec->Write( aStream, (const sal_uInt8*)pStream->GetData(), nEndPos ); pCodec->EndCompression(); delete pCodec; nEndPos = aStream.Tell(); @@ -2114,7 +2152,7 @@ bool PDFWriterImpl::writeBuffer( const void* pBuffer, sal_uInt64 nBytes ) sal_uInt64 nWritten; if( m_pCodec ) { - m_pCodec->Write( *m_pMemStream, static_cast<const BYTE*>(pBuffer), (ULONG)nBytes ); + m_pCodec->Write( *m_pMemStream, static_cast<const sal_uInt8*>(pBuffer), (sal_uLong)nBytes ); nWritten = nBytes; } else @@ -2156,13 +2194,16 @@ OutputDevice* PDFWriterImpl::getReferenceDevice() m_pReferenceDevice = pVDev; - pVDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_PDF1 ); + if( m_aContext.DPIx == 0 || m_aContext.DPIy == 0 ) + pVDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_PDF1 ); + else + pVDev->SetReferenceDevice( m_aContext.DPIx, m_aContext.DPIy ); pVDev->SetOutputSizePixel( Size( 640, 480 ) ); pVDev->SetMapMode( MAP_MM ); m_pReferenceDevice->mpPDFWriter = this; - m_pReferenceDevice->ImplUpdateFontData( TRUE ); + m_pReferenceDevice->ImplUpdateFontData( sal_True ); } return m_pReferenceDevice; } @@ -2398,9 +2439,6 @@ SalLayout* PDFWriterImpl::GetTextLayout( ImplLayoutArgs& rArgs, ImplFontSelectDa sal_Int32 PDFWriterImpl::newPage( sal_Int32 nPageWidth, sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation ) { - if( m_aContext.Encrypt && m_aPages.empty() ) - initEncryption(); - endPage(); m_nCurrentPage = m_aPages.size(); m_aPages.push_back( PDFPage(this, nPageWidth, nPageHeight, eOrientation ) ); @@ -2938,12 +2976,9 @@ bool PDFWriterImpl::emitTilings() aTilingObj.setLength( 0 ); -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( "PDFWriterImpl::emitTilings" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::emitTilings" ); + #endif sal_Int32 nX = (sal_Int32)it->m_aRectangle.Left(); sal_Int32 nY = (sal_Int32)it->m_aRectangle.Top(); @@ -3428,10 +3463,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont // now we can actually write the font stream ! #if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::emitEmbeddedFont" ); - emitComment( aLine.getStr() ); - } + emitComment( " PDFWriterImpl::emitEmbeddedFont" ); #endif OStringBuffer aLine( 512 ); nStreamObject = createObject(); @@ -3850,17 +3882,14 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding, ZCodec* pCodec = new ZCodec( 0x4000, 0x4000 ); SvMemoryStream aStream; pCodec->BeginCompression(); - pCodec->Write( aStream, (const BYTE*)aContents.getStr(), aContents.getLength() ); + pCodec->Write( aStream, (const sal_uInt8*)aContents.getStr(), aContents.getLength() ); pCodec->EndCompression(); delete pCodec; #endif -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::createToUnicodeCMap" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::createToUnicodeCMap" ); + #endif OStringBuffer aLine( 40 ); aLine.append( nStream ); @@ -4047,10 +4076,7 @@ bool PDFWriterImpl::emitFonts() CHECK_RETURN( (osl_File_E_None == osl_setFilePos( aFontFile, osl_Pos_Absolut, 0 ) ) ); #if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine1( " PDFWriterImpl::emitFonts" ); - emitComment( aLine1.getStr() ); - } + emitComment( "PDFWriterImpl::emitFonts" ); #endif sal_Int32 nFontStream = createObject(); sal_Int32 nStreamLengthObject = createObject(); @@ -4674,7 +4700,7 @@ we check in the following sequence: appendLiteralStringEncrypt( bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURLNoMark, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_WITH_CHARSET ) : - aURLNoMark, rLink.m_nObject, aLine, osl_getThreadTextEncoding() ); + aURLNoMark, rLink.m_nObject, aLine, osl_getThreadTextEncoding() ); if( aFragment.getLength() > 0 ) { aLine.append("/D/"); @@ -5326,12 +5352,9 @@ bool PDFWriterImpl::emitAppearances( PDFWidget& rWidget, OStringBuffer& rAnnotDi pApppearanceStream->Seek( STREAM_SEEK_TO_BEGIN ); sal_Int32 nObject = createObject(); CHECK_RETURN( updateObject( nObject ) ); -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::emitAppearances" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::emitAppearances" ); + #endif OStringBuffer aLine; aLine.append( nObject ); @@ -5871,7 +5894,7 @@ bool PDFWriterImpl::emitCatalog() } // viewer preferences, if we had some, then emit if( m_aContext.HideViewerToolbar || - ( m_aContext.Version > PDFWriter::PDF_1_3 && m_aDocInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) || + ( m_aContext.Version > PDFWriter::PDF_1_3 && m_aContext.DocumentInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) || m_aContext.HideViewerMenubar || m_aContext.HideViewerWindowControls || m_aContext.FitWindow || m_aContext.CenterWindow || (m_aContext.FirstPageLeft && m_aContext.PageLayout == PDFWriter::ContinuousFacing ) || @@ -5888,7 +5911,7 @@ bool PDFWriterImpl::emitCatalog() aLine.append( "/FitWindow true\n" ); if( m_aContext.CenterWindow ) aLine.append( "/CenterWindow true\n" ); - if( m_aContext.Version > PDFWriter::PDF_1_3 && m_aDocInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) + if( m_aContext.Version > PDFWriter::PDF_1_3 && m_aContext.DocumentInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) aLine.append( "/DisplayDocTitle true\n" ); if( m_aContext.FirstPageLeft && m_aContext.PageLayout == PDFWriter::ContinuousFacing ) aLine.append( "/Direction/R2L\n" ); @@ -5992,40 +6015,40 @@ sal_Int32 PDFWriterImpl::emitInfoDict( ) aLine.append( nObject ); aLine.append( " 0 obj\n" "<<" ); - if( m_aDocInfo.Title.Len() ) + if( m_aContext.DocumentInfo.Title.Len() ) { aLine.append( "/Title" ); - appendUnicodeTextStringEncrypt( m_aDocInfo.Title, nObject, aLine ); + appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Title, nObject, aLine ); aLine.append( "\n" ); } - if( m_aDocInfo.Author.Len() ) + if( m_aContext.DocumentInfo.Author.Len() ) { aLine.append( "/Author" ); - appendUnicodeTextStringEncrypt( m_aDocInfo.Author, nObject, aLine ); + appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Author, nObject, aLine ); aLine.append( "\n" ); } - if( m_aDocInfo.Subject.Len() ) + if( m_aContext.DocumentInfo.Subject.Len() ) { aLine.append( "/Subject" ); - appendUnicodeTextStringEncrypt( m_aDocInfo.Subject, nObject, aLine ); + appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Subject, nObject, aLine ); aLine.append( "\n" ); } - if( m_aDocInfo.Keywords.Len() ) + if( m_aContext.DocumentInfo.Keywords.Len() ) { aLine.append( "/Keywords" ); - appendUnicodeTextStringEncrypt( m_aDocInfo.Keywords, nObject, aLine ); + appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Keywords, nObject, aLine ); aLine.append( "\n" ); } - if( m_aDocInfo.Creator.Len() ) + if( m_aContext.DocumentInfo.Creator.Len() ) { aLine.append( "/Creator" ); - appendUnicodeTextStringEncrypt( m_aDocInfo.Creator, nObject, aLine ); + appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Creator, nObject, aLine ); aLine.append( "\n" ); } - if( m_aDocInfo.Producer.Len() ) + if( m_aContext.DocumentInfo.Producer.Len() ) { aLine.append( "/Producer" ); - appendUnicodeTextStringEncrypt( m_aDocInfo.Producer, nObject, aLine ); + appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Producer, nObject, aLine ); aLine.append( "\n" ); } @@ -6271,45 +6294,45 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata() aMetadataStream.append( " <pdfaid:conformance>A</pdfaid:conformance>\n" ); aMetadataStream.append( " </rdf:Description>\n" ); //... Dublin Core properties go here - if( m_aDocInfo.Title.Len() || - m_aDocInfo.Author.Len() || - m_aDocInfo.Subject.Len() ) + if( m_aContext.DocumentInfo.Title.Len() || + m_aContext.DocumentInfo.Author.Len() || + m_aContext.DocumentInfo.Subject.Len() ) { aMetadataStream.append( " <rdf:Description rdf:about=\"\"\n" ); aMetadataStream.append( " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n" ); - if( m_aDocInfo.Title.Len() ) + if( m_aContext.DocumentInfo.Title.Len() ) { // this is according to PDF/A-1, technical corrigendum 1 (2007-04-01) aMetadataStream.append( " <dc:title>\n" ); aMetadataStream.append( " <rdf:Alt>\n" ); aMetadataStream.append( " <rdf:li xml:lang=\"x-default\">" ); rtl::OUString aTitle; - escapeStringXML( m_aDocInfo.Title, aTitle ); + escapeStringXML( m_aContext.DocumentInfo.Title, aTitle ); aMetadataStream.append( OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ) ); aMetadataStream.append( "</rdf:li>\n" ); aMetadataStream.append( " </rdf:Alt>\n" ); aMetadataStream.append( " </dc:title>\n" ); } - if( m_aDocInfo.Author.Len() ) + if( m_aContext.DocumentInfo.Author.Len() ) { aMetadataStream.append( " <dc:creator>\n" ); aMetadataStream.append( " <rdf:Seq>\n" ); aMetadataStream.append( " <rdf:li>" ); rtl::OUString aAuthor; - escapeStringXML( m_aDocInfo.Author, aAuthor ); + escapeStringXML( m_aContext.DocumentInfo.Author, aAuthor ); aMetadataStream.append( OUStringToOString( aAuthor , RTL_TEXTENCODING_UTF8 ) ); aMetadataStream.append( "</rdf:li>\n" ); aMetadataStream.append( " </rdf:Seq>\n" ); aMetadataStream.append( " </dc:creator>\n" ); } - if( m_aDocInfo.Subject.Len() ) + if( m_aContext.DocumentInfo.Subject.Len() ) { // this is according to PDF/A-1, technical corrigendum 1 (2007-04-01) aMetadataStream.append( " <dc:description>\n" ); aMetadataStream.append( " <rdf:Alt>\n" ); aMetadataStream.append( " <rdf:li xml:lang=\"x-default\">" ); rtl::OUString aSubject; - escapeStringXML( m_aDocInfo.Subject, aSubject ); + escapeStringXML( m_aContext.DocumentInfo.Subject, aSubject ); aMetadataStream.append( OUStringToOString( aSubject , RTL_TEXTENCODING_UTF8 ) ); aMetadataStream.append( "</rdf:li>\n" ); aMetadataStream.append( " </rdf:Alt>\n" ); @@ -6319,24 +6342,24 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata() } //... PDF properties go here - if( m_aDocInfo.Producer.Len() || - m_aDocInfo.Keywords.Len() ) + if( m_aContext.DocumentInfo.Producer.Len() || + m_aContext.DocumentInfo.Keywords.Len() ) { aMetadataStream.append( " <rdf:Description rdf:about=\"\"\n" ); aMetadataStream.append( " xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\">\n" ); - if( m_aDocInfo.Producer.Len() ) + if( m_aContext.DocumentInfo.Producer.Len() ) { aMetadataStream.append( " <pdf:Producer>" ); rtl::OUString aProducer; - escapeStringXML( m_aDocInfo.Producer, aProducer ); + escapeStringXML( m_aContext.DocumentInfo.Producer, aProducer ); aMetadataStream.append( OUStringToOString( aProducer , RTL_TEXTENCODING_UTF8 ) ); aMetadataStream.append( "</pdf:Producer>\n" ); } - if( m_aDocInfo.Keywords.Len() ) + if( m_aContext.DocumentInfo.Keywords.Len() ) { aMetadataStream.append( " <pdf:Keywords>" ); rtl::OUString aKeywords; - escapeStringXML( m_aDocInfo.Keywords, aKeywords ); + escapeStringXML( m_aContext.DocumentInfo.Keywords, aKeywords ); aMetadataStream.append( OUStringToOString( aKeywords , RTL_TEXTENCODING_UTF8 ) ); aMetadataStream.append( "</pdf:Keywords>\n" ); } @@ -6345,11 +6368,11 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata() aMetadataStream.append( " <rdf:Description rdf:about=\"\"\n" ); aMetadataStream.append( " xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\">\n" ); - if( m_aDocInfo.Creator.Len() ) + if( m_aContext.DocumentInfo.Creator.Len() ) { aMetadataStream.append( " <xmp:CreatorTool>" ); rtl::OUString aCreator; - escapeStringXML( m_aDocInfo.Creator, aCreator ); + escapeStringXML( m_aContext.DocumentInfo.Creator, aCreator ); aMetadataStream.append( OUStringToOString( aCreator , RTL_TEXTENCODING_UTF8 ) ); aMetadataStream.append( "</xmp:CreatorTool>\n" ); } @@ -6405,7 +6428,7 @@ bool PDFWriterImpl::emitTrailer() sal_Int32 nSecObject = 0; - if( m_aContext.Encrypt == true ) + if( m_aContext.Encryption.Encrypt() ) { //emit the security information //must be emitted as indirect dictionary object, since @@ -6419,16 +6442,16 @@ bool PDFWriterImpl::emitTrailer() aLineS.append( " 0 obj\n" "<</Filter/Standard/V " ); // check the version - if( m_aContext.Security128bit == true ) + if( m_aContext.Encryption.Security128bit ) aLineS.append( "2/Length 128/R 3" ); else aLineS.append( "1/R 2" ); // emit the owner password, must not be encrypted aLineS.append( "/O(" ); - appendLiteralString( (const sal_Char*)m_nEncryptedOwnerPassword, 32, aLineS ); + appendLiteralString( (const sal_Char*)&m_aContext.Encryption.OValue[0], sal_Int32(m_aContext.Encryption.OValue.size()), aLineS ); aLineS.append( ")/U(" ); - appendLiteralString( (const sal_Char*)m_nEncryptedUserPassword, 32, aLineS ); + appendLiteralString( (const sal_Char*)&m_aContext.Encryption.UValue[0], sal_Int32(m_aContext.Encryption.UValue.size()), aLineS ); aLineS.append( ")/P " );// the permission set aLineS.append( m_nAccessPermissions ); aLineS.append( ">>\nendobj\n\n" ); @@ -6494,13 +6517,21 @@ bool PDFWriterImpl::emitTrailer() aLine.append( nDocInfoObject ); aLine.append( " 0 R\n" ); } - if( m_aDocID.getLength() ) + if( ! m_aContext.Encryption.DocumentIdentifier.empty() ) { aLine.append( "/ID [ <" ); - aLine.append( m_aDocID.getStr(), m_aDocID.getLength() ); + for( std::vector< sal_uInt8 >::const_iterator it = m_aContext.Encryption.DocumentIdentifier.begin(); + it != m_aContext.Encryption.DocumentIdentifier.end(); ++it ) + { + appendHex( sal_Int8(*it), aLine ); + } aLine.append( ">\n" "<" ); - aLine.append( m_aDocID.getStr(), m_aDocID.getLength() ); + for( std::vector< sal_uInt8 >::const_iterator it = m_aContext.Encryption.DocumentIdentifier.begin(); + it != m_aContext.Encryption.DocumentIdentifier.end(); ++it ) + { + appendHex( sal_Int8(*it), aLine ); + } aLine.append( "> ]\n" ); } if( aDocChecksum.getLength() ) @@ -6987,7 +7018,7 @@ void PDFWriterImpl::drawRelief( SalLayout& rLayout, const String& rText, bool bT Font aSetFont = m_aCurrentPDFState.m_aFont; aSetFont.SetRelief( RELIEF_NONE ); - aSetFont.SetShadow( FALSE ); + aSetFont.SetShadow( sal_False ); aSetFont.SetColor( aReliefColor ); setTextLineColor( aReliefColor ); @@ -7024,8 +7055,8 @@ void PDFWriterImpl::drawShadow( SalLayout& rLayout, const String& rText, bool bT rFont.SetColor( Color( COL_LIGHTGRAY ) ); else rFont.SetColor( Color( COL_BLACK ) ); - rFont.SetShadow( FALSE ); - rFont.SetOutline( FALSE ); + rFont.SetShadow( sal_False ); + rFont.SetOutline( sal_False ); setFont( rFont ); setTextLineColor( rFont.GetColor() ); setOverlineColor( rFont.GetColor() ); @@ -7479,7 +7510,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT ) ) { - BOOL bUnderlineAbove = OutputDevice::ImplIsUnderlineAbove( m_aCurrentPDFState.m_aFont ); + sal_Bool bUnderlineAbove = OutputDevice::ImplIsUnderlineAbove( m_aCurrentPDFState.m_aFont ); if( m_aCurrentPDFState.m_aFont.IsWordLineMode() ) { Point aPos, aStartPt; @@ -7532,7 +7563,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT long nEmphYOff; long nEmphWidth; long nEmphHeight; - BOOL bEmphPolyLine; + sal_Bool bEmphPolyLine; FontEmphasisMark nEmphMark; push( PUSH_ALL ); @@ -7613,7 +7644,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT } void PDFWriterImpl::drawEmphasisMark( long nX, long nY, - const PolyPolygon& rPolyPoly, BOOL bPolyLine, + const PolyPolygon& rPolyPoly, sal_Bool bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ) { // TODO: pass nWidth as width of this mark @@ -7683,7 +7714,7 @@ void PDFWriterImpl::drawTextArray( const Point& rPos, const String& rText, const } } -void PDFWriterImpl::drawStretchText( const Point& rPos, ULONG nWidth, const String& rText, xub_StrLen nIndex, xub_StrLen nLen, bool bTextLines ) +void PDFWriterImpl::drawStretchText( const Point& rPos, sal_uLong nWidth, const String& rText, xub_StrLen nIndex, xub_StrLen nLen, bool bTextLines ) { MARK( "drawStretchText" ); @@ -7699,7 +7730,7 @@ void PDFWriterImpl::drawStretchText( const Point& rPos, ULONG nWidth, const Stri } } -void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, bool bTextLines ) +void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, sal_uInt16 nStyle, bool bTextLines ) { long nWidth = rRect.GetWidth(); long nHeight = rRect.GetHeight(); @@ -8242,17 +8273,17 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrik while( m_pReferenceDevice->GetTextWidth( aStrikeout ) >= nWidth ) aStrikeout.Erase( 0, 1 ); aStrikeout.Append( aStrikeoutChar ); - BOOL bShadow = m_aCurrentPDFState.m_aFont.IsShadow(); + sal_Bool bShadow = m_aCurrentPDFState.m_aFont.IsShadow(); if ( bShadow ) { Font aFont = m_aCurrentPDFState.m_aFont; - aFont.SetShadow( FALSE ); + aFont.SetShadow( sal_False ); setFont( aFont ); updateGraphicsState(); } // strikeout string is left aligned non-CTL text - ULONG nOrigTLM = m_pReferenceDevice->GetLayoutMode(); + sal_uLong nOrigTLM = m_pReferenceDevice->GetLayoutMode(); m_pReferenceDevice->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_COMPLEX_DISABLED ); drawText( rPos, aStrikeout, 0, aStrikeout.Len(), false ); m_pReferenceDevice->SetLayoutMode( nOrigTLM ); @@ -8260,7 +8291,7 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrik if ( bShadow ) { Font aFont = m_aCurrentPDFState.m_aFont; - aFont.SetShadow( TRUE ); + aFont.SetShadow( sal_True ); setFont( aFont ); updateGraphicsState(); } @@ -8927,7 +8958,7 @@ void PDFWriterImpl::drawPolyLine( const Polygon& rPoly ) { MARK( "drawPolyLine" ); - USHORT nPoints = rPoly.GetSize(); + sal_uInt16 nPoints = rPoly.GetSize(); if( nPoints < 2 ) return; @@ -9120,7 +9151,7 @@ void PDFWriterImpl::drawPolyLine( const Polygon& rPoly, const PDFWriter::ExtLine aBoundRect.Right() += nLW; aBoundRect.Bottom() += nLW; } - endTransparencyGroup( aBoundRect, (USHORT)(100.0*rInfo.m_fTransparency) ); + endTransparencyGroup( aBoundRect, (sal_uInt16)(100.0*rInfo.m_fTransparency) ); } } @@ -9161,7 +9192,7 @@ void PDFWriterImpl::drawPixel( const Polygon& rPoints, const Color* pColors ) if( m_aGraphicsStack.front().m_aLineColor == Color( COL_TRANSPARENT ) && ! pColors ) return; - USHORT nPoints = rPoints.GetSize(); + sal_uInt16 nPoints = rPoints.GetSize(); OStringBuffer aLine( nPoints*40 ); aLine.append( "q " ); if( ! pColors ) @@ -9176,7 +9207,7 @@ void PDFWriterImpl::drawPixel( const Polygon& rPoints, const Color* pColors ) aPixel.append( ' ' ); appendDouble( 1.0/double(getReferenceDevice()->ImplGetDPIY()), aPixel ); OString aPixelStr = aPixel.makeStringAndClear(); - for( USHORT i = 0; i < nPoints; i++ ) + for( sal_uInt16 i = 0; i < nPoints; i++ ) { if( pColors ) { @@ -9208,14 +9239,11 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject ) bool bFlateFilter = compressStream( rObject.m_pContentStream ); rObject.m_pContentStream->Seek( STREAM_SEEK_TO_END ); - ULONG nSize = rObject.m_pContentStream->Tell(); + sal_uLong nSize = rObject.m_pContentStream->Tell(); rObject.m_pContentStream->Seek( STREAM_SEEK_TO_BEGIN ); -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::writeTransparentObject" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::writeTransparentObject" ); + #endif OStringBuffer aLine( 512 ); CHECK_RETURN( updateObject( rObject.m_nObject ) ); aLine.append( rObject.m_nObject ); @@ -9348,28 +9376,25 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) sal_Int32 nFunctionObject = createObject(); CHECK_RETURN( updateObject( nFunctionObject ) ); - OutputDevice* pRefDevice = getReferenceDevice(); - pRefDevice->Push( PUSH_ALL ); - if( rObject.m_aSize.Width() > pRefDevice->GetOutputSizePixel().Width() ) - rObject.m_aSize.Width() = pRefDevice->GetOutputSizePixel().Width(); - if( rObject.m_aSize.Height() > pRefDevice->GetOutputSizePixel().Height() ) - rObject.m_aSize.Height() = pRefDevice->GetOutputSizePixel().Height(); - pRefDevice->SetMapMode( MapMode( MAP_PIXEL ) ); - pRefDevice->DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient ); + VirtualDevice aDev; + aDev.SetOutputSizePixel( rObject.m_aSize ); + aDev.SetMapMode( MapMode( MAP_PIXEL ) ); + if( m_aContext.ColorMode == PDFWriter::DrawGreyscale ) + aDev.SetDrawMode( aDev.GetDrawMode() | + ( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT | + DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) ); + aDev.DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient ); - Bitmap aSample = pRefDevice->GetBitmap( Point( 0, 0 ), rObject.m_aSize ); + Bitmap aSample = aDev.GetBitmap( Point( 0, 0 ), rObject.m_aSize ); BitmapReadAccess* pAccess = aSample.AcquireReadAccess(); AccessReleaser aReleaser( pAccess ); Size aSize = aSample.GetSizePixel(); sal_Int32 nStreamLengthObject = createObject(); -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::writeGradientFunction" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::writeGradientFunction" ); + #endif OStringBuffer aLine( 120 ); aLine.append( nFunctionObject ); aLine.append( " 0 obj\n" @@ -9382,6 +9407,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) aLine.append( " ]\n" "/BitsPerSample 8\n" "/Range[ 0 1 0 1 0 1 ]\n" + "/Order 3\n" "/Length " ); aLine.append( nStreamLengthObject ); aLine.append( " 0 R\n" @@ -9397,7 +9423,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) checkAndEnableStreamEncryption( nFunctionObject ); beginCompression(); - for( int y = 0; y < aSize.Height(); y++ ) + for( int y = aSize.Height()-1; y >= 0; y-- ) { for( int x = 0; x < aSize.Width(); x++ ) { @@ -9448,8 +9474,6 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) "endobj\n\n" ); CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) ); - pRefDevice->Pop(); - return true; } @@ -9478,12 +9502,9 @@ bool PDFWriterImpl::writeJPG( JPGEmit& rObject ) m_aErrors.insert( PDFWriter::Warning_Transparency_Omitted_PDF13 ); } -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::writeJPG" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::writeJPG" ); + #endif OStringBuffer aLine(200); aLine.append( rObject.m_nObject ); @@ -9603,26 +9624,32 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) sal_Int32 nStreamLengthObject = createObject(); sal_Int32 nMaskObject = 0; -#if OSL_DEBUG_LEVEL > 1 - { - OStringBuffer aLine( " PDFWriterImpl::writeBitmapObject" ); - emitComment( aLine.getStr() ); - } -#endif + #if OSL_DEBUG_LEVEL > 1 + emitComment( "PDFWriterImpl::writeBitmapObject" ); + #endif OStringBuffer aLine(1024); aLine.append( rObject.m_nObject ); aLine.append( " 0 obj\n" "<</Type/XObject/Subtype/Image/Width " ); aLine.append( (sal_Int32)aBitmap.GetSizePixel().Width() ); - aLine.append( " /Height " ); + aLine.append( "/Height " ); aLine.append( (sal_Int32)aBitmap.GetSizePixel().Height() ); - aLine.append( " /BitsPerComponent " ); + aLine.append( "/BitsPerComponent " ); aLine.append( nBitsPerComponent ); - aLine.append( " /Length " ); + aLine.append( "/Length " ); aLine.append( nStreamLengthObject ); aLine.append( " 0 R\n" ); #ifndef DEBUG_DISABLE_PDFCOMPRESSION - aLine.append( "/Filter/FlateDecode" ); + if( nBitsPerComponent != 1 ) + { + aLine.append( "/Filter/FlateDecode" ); + } + else + { + aLine.append( "/Filter/CCITTFaxDecode/DecodeParms<</K -1/BlackIs1 true/Columns " ); + aLine.append( (sal_Int32)aBitmap.GetSizePixel().Width() ); + aLine.append( ">>\n" ); + } #endif if( ! bMask ) { @@ -9646,7 +9673,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) aLine.append( "[ /Indexed/DeviceRGB " ); aLine.append( (sal_Int32)(pAccess->GetPaletteEntryCount()-1) ); aLine.append( "\n<" ); - if( m_aContext.Encrypt ) + if( m_aContext.Encryption.Encrypt() ) { enableStringEncryption( rObject.m_nObject ); //check encryption buffer size @@ -9654,7 +9681,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) { int nChar = 0; //fill the encryption buffer - for( USHORT i = 0; i < pAccess->GetPaletteEntryCount(); i++ ) + for( sal_uInt16 i = 0; i < pAccess->GetPaletteEntryCount(); i++ ) { const BitmapColor& rColor = pAccess->GetPaletteColor( i ); m_pEncryptionBuffer[nChar++] = rColor.GetRed(); @@ -9665,7 +9692,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) rtl_cipher_encodeARCFOUR( m_aCipher, m_pEncryptionBuffer, nChar, m_pEncryptionBuffer, nChar ); //now queue the data for output nChar = 0; - for( USHORT i = 0; i < pAccess->GetPaletteEntryCount(); i++ ) + for( sal_uInt16 i = 0; i < pAccess->GetPaletteEntryCount(); i++ ) { appendHex(m_pEncryptionBuffer[nChar++], aLine ); appendHex(m_pEncryptionBuffer[nChar++], aLine ); @@ -9675,7 +9702,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) } else //no encryption requested (PDF/A-1a program flow drops here) { - for( USHORT i = 0; i < pAccess->GetPaletteEntryCount(); i++ ) + for( sal_uInt16 i = 0; i < pAccess->GetPaletteEntryCount(); i++ ) { const BitmapColor& rColor = pAccess->GetPaletteColor( i ); appendHex( rColor.GetRed(), aLine ); @@ -9690,7 +9717,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) { if( aBitmap.GetBitCount() == 1 ) { - aLine.append( " /ImageMask true\n" ); + aLine.append( "/ImageMask true\n" ); sal_Int32 nBlackIndex = pAccess->GetBestPaletteIndex( BitmapColor( Color( COL_BLACK ) ) ); DBG_ASSERT( nBlackIndex == 0 || nBlackIndex == 1, "wrong black index" ); if( nBlackIndex ) @@ -9752,33 +9779,42 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) CHECK_RETURN( (osl_File_E_None == osl_getFilePos( m_aFile, &nStartPos )) ); checkAndEnableStreamEncryption( rObject.m_nObject ); - beginCompression(); - if( ! bTrueColor || pAccess->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ) +#ifndef DEBUG_DISABLE_PDFCOMPRESSION + if( nBitsPerComponent == 1 ) { - const int nScanLineBytes = 1 + ( pAccess->GetBitCount() * ( pAccess->Width() - 1 ) / 8U ); - - for( int i = 0; i < pAccess->Height(); i++ ) - { - CHECK_RETURN( writeBuffer( pAccess->GetScanline( i ), nScanLineBytes ) ); - } + writeG4Stream( pAccess ); } else +#endif { - const int nScanLineBytes = pAccess->Width()*3; - boost::shared_array<sal_uInt8> pCol( new sal_uInt8[ nScanLineBytes ] ); - for( int y = 0; y < pAccess->Height(); y++ ) + beginCompression(); + if( ! bTrueColor || pAccess->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ) { - for( int x = 0; x < pAccess->Width(); x++ ) + const int nScanLineBytes = 1 + ( pAccess->GetBitCount() * ( pAccess->Width() - 1 ) / 8U ); + + for( int i = 0; i < pAccess->Height(); i++ ) { - BitmapColor aColor = pAccess->GetColor( y, x ); - pCol[3*x+0] = aColor.GetRed(); - pCol[3*x+1] = aColor.GetGreen(); - pCol[3*x+2] = aColor.GetBlue(); + CHECK_RETURN( writeBuffer( pAccess->GetScanline( i ), nScanLineBytes ) ); } - CHECK_RETURN( writeBuffer( pCol.get(), nScanLineBytes ) ); } + else + { + const int nScanLineBytes = pAccess->Width()*3; + boost::shared_array<sal_uInt8> pCol( new sal_uInt8[ nScanLineBytes ] ); + for( int y = 0; y < pAccess->Height(); y++ ) + { + for( int x = 0; x < pAccess->Width(); x++ ) + { + BitmapColor aColor = pAccess->GetColor( y, x ); + pCol[3*x+0] = aColor.GetRed(); + pCol[3*x+1] = aColor.GetGreen(); + pCol[3*x+2] = aColor.GetBlue(); + } + CHECK_RETURN( writeBuffer( pCol.get(), nScanLineBytes ) ); + } + } + endCompression(); } - endCompression(); disableStreamEncryption(); sal_uInt64 nEndPos = 0; @@ -9818,8 +9854,25 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const if( ! (rSizePixel.Width() && rSizePixel.Height()) ) return; - SvMemoryStream* pStream = new SvMemoryStream; rDCTData.Seek( 0 ); + if( bIsTrueColor && m_aContext.ColorMode == PDFWriter::DrawGreyscale ) + { + // need to convert to grayscale; + // load stream to bitmap and draw the bitmap instead + Graphic aGraphic; + GraphicConverter::Import( rDCTData, aGraphic, CVT_JPG ); + Bitmap aBmp( aGraphic.GetBitmap() ); + if( !!rMask && rMask.GetSizePixel() == aBmp.GetSizePixel() ) + { + BitmapEx aBmpEx( aBmp, rMask ); + drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), aBmpEx ); + } + else + drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), aBmp ); + return; + } + + SvMemoryStream* pStream = new SvMemoryStream; *pStream << rDCTData; pStream->Seek( STREAM_SEEK_TO_END ); @@ -9910,18 +9963,28 @@ void PDFWriterImpl::drawBitmap( const Point& rDestPoint, const Size& rDestSize, writeBuffer( aLine.getStr(), aLine.getLength() ); } -const PDFWriterImpl::BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx& rBitmap, bool bDrawMask ) +const PDFWriterImpl::BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx& i_rBitmap, bool bDrawMask ) { + BitmapEx aBitmap( i_rBitmap ); + if( m_aContext.ColorMode == PDFWriter::DrawGreyscale ) + { + BmpConversion eConv = BMP_CONVERSION_8BIT_GREYS; + int nDepth = aBitmap.GetBitmap().GetBitCount(); + if( nDepth <= 4 ) + eConv = BMP_CONVERSION_4BIT_GREYS; + if( nDepth > 1 ) + aBitmap.Convert( eConv ); + } BitmapID aID; - aID.m_aPixelSize = rBitmap.GetSizePixel(); - aID.m_nSize = rBitmap.GetBitCount(); - aID.m_nChecksum = rBitmap.GetBitmap().GetChecksum(); + aID.m_aPixelSize = aBitmap.GetSizePixel(); + aID.m_nSize = aBitmap.GetBitCount(); + aID.m_nChecksum = aBitmap.GetBitmap().GetChecksum(); aID.m_nMaskChecksum = 0; - if( rBitmap.IsAlpha() ) - aID.m_nMaskChecksum = rBitmap.GetAlpha().GetChecksum(); + if( aBitmap.IsAlpha() ) + aID.m_nMaskChecksum = aBitmap.GetAlpha().GetChecksum(); else { - Bitmap aMask = rBitmap.GetMask(); + Bitmap aMask = aBitmap.GetMask(); if( ! aMask.IsEmpty() ) aID.m_nMaskChecksum = aMask.GetChecksum(); } @@ -9935,7 +9998,7 @@ const PDFWriterImpl::BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx { m_aBitmaps.push_front( BitmapEmit() ); m_aBitmaps.front().m_aID = aID; - m_aBitmaps.front().m_aBitmap = rBitmap; + m_aBitmaps.front().m_aBitmap = aBitmap; m_aBitmaps.front().m_nObject = createObject(); m_aBitmaps.front().m_bDrawMask = bDrawMask; it = m_aBitmaps.begin(); @@ -9998,15 +10061,16 @@ sal_Int32 PDFWriterImpl::createGradient( const Gradient& rGradient, const Size& rSize ) ); // check if we already have this gradient std::list<GradientEmit>::iterator it; + // rounding to point will generally lose some pixels + // round up to point boundary + aPtSize.Width()++; + aPtSize.Height()++; for( it = m_aGradients.begin(); it != m_aGradients.end(); ++it ) { if( it->m_aGradient == rGradient ) { - if( it->m_aSize.Width() < aPtSize.Width() ) - it->m_aSize.Width() = aPtSize.Width(); - if( it->m_aSize.Height() <= aPtSize.Height() ) - it->m_aSize.Height() = aPtSize.Height(); - break; + if( it->m_aSize == aPtSize ) + break; } } if( it == m_aGradients.end() ) @@ -10081,12 +10145,12 @@ void PDFWriterImpl::drawGradient( const PolyPolygon& rPolyPoly, const Gradient& return; } - sal_Int32 nGradient = createGradient( rGradient, rPolyPoly.GetBoundRect().GetSize() ); + Rectangle aBoundRect = rPolyPoly.GetBoundRect(); + sal_Int32 nGradient = createGradient( rGradient, aBoundRect.GetSize() ); updateGraphicsState(); - Rectangle aBoundRect = rPolyPoly.GetBoundRect(); - Point aTranslate = aBoundRect.BottomLeft() + Point( 0, 1 ); + Point aTranslate = aBoundRect.BottomLeft(); int nPolygons = rPolyPoly.Count(); OStringBuffer aLine( 80*nPolygons ); @@ -10125,7 +10189,7 @@ void PDFWriterImpl::drawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch aPolyPoly.Optimize( POLY_OPTIMIZE_NO_SAME ); push( PUSH_LINECOLOR ); setLineColor( rHatch.GetColor() ); - getReferenceDevice()->ImplDrawHatch( aPolyPoly, rHatch, FALSE ); + getReferenceDevice()->ImplDrawHatch( aPolyPoly, rHatch, sal_False ); pop(); } } @@ -10833,7 +10897,7 @@ sal_Int32 PDFWriterImpl::setOutlineItemText( sal_Int32 nItem, const OUString& rT if( nItem < 1 || nItem >= (sal_Int32)m_aOutline.size() ) return -1; - m_aOutline[ nItem ].m_aTitle = rText; + m_aOutline[ nItem ].m_aTitle = psp::WhitespaceToSpace( rText ); return 0; } @@ -12032,269 +12096,6 @@ void PDFWriterImpl::addStream( const String& rMimeType, PDFOutputStream* pStream } } -/************************************************************* -begin i12626 methods - -Implements Algorithm 3.2, step 1 only -*/ -void PDFWriterImpl::padPassword( rtl::OUString aPassword, sal_uInt8 *paPasswordTarget ) -{ -// get ansi-1252 version of the password string CHECKIT ! i12626 - rtl::OString aString = rtl::OUStringToOString( aPassword, RTL_TEXTENCODING_MS_1252 ); - -//copy the string to the target - sal_Int32 nToCopy = ( aString.getLength() < 32 ) ? aString.getLength() : 32; - sal_Int32 nCurrentChar; - - for( nCurrentChar = 0; nCurrentChar < nToCopy; nCurrentChar++ ) - paPasswordTarget[nCurrentChar] = (sal_uInt8)( aString.getStr()[nCurrentChar] ); - -//pad it - if( nCurrentChar < 32 ) - {//fill with standard byte string - sal_Int32 i,y; - for( i = nCurrentChar, y = 0 ; i < 32; i++, y++ ) - paPasswordTarget[i] = m_nPadString[y]; - } -} - -/********************************** -Algorithm 3.2 Compute the encryption key used - -step 1 should already be done before calling, the paThePaddedPassword parameter should contain -the padded password and must be 32 byte long, the encryption key is returned into the paEncryptionKey parameter, -it will be 16 byte long for 128 bit security; for 40 bit security only the first 5 bytes are used - -TODO: in pdf ver 1.5 and 1.6 the step 6 is different, should be implemented. See spec. - -*/ -void PDFWriterImpl::computeEncryptionKey(sal_uInt8 *paThePaddedPassword, sal_uInt8 *paEncryptionKey ) -{ -//step 2 - if( m_aDigest ) - { - rtlDigestError nError = rtl_digest_updateMD5( m_aDigest, paThePaddedPassword, ENCRYPTED_PWD_SIZE ); -//step 3 - if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( m_aDigest, m_nEncryptedOwnerPassword , sizeof( m_nEncryptedOwnerPassword ) ); -//Step 4 - sal_uInt8 nPerm[4]; - - nPerm[0] = (sal_uInt8)m_nAccessPermissions; - nPerm[1] = (sal_uInt8)( m_nAccessPermissions >> 8 ); - nPerm[2] = (sal_uInt8)( m_nAccessPermissions >> 16 ); - nPerm[3] = (sal_uInt8)( m_nAccessPermissions >> 24 ); - - if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( m_aDigest, nPerm , sizeof( nPerm ) ); - -//step 5, get the document ID, binary form - if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( m_aDigest, m_nDocID , sizeof( m_nDocID ) ); -//get the digest - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ] = {0}; - if( nError == rtl_Digest_E_None ) - { - rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof( nMD5Sum ) ); - -//step 6, only if 128 bit - if( m_aContext.Security128bit ) - { - for( sal_Int32 i = 0; i < 50; i++ ) - { - nError = rtl_digest_updateMD5( m_aDigest, &nMD5Sum, sizeof( nMD5Sum ) ); - if( nError != rtl_Digest_E_None ) - break; - rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof( nMD5Sum ) ); - } - } - } -//Step 7 - for( sal_Int32 i = 0; i < MD5_DIGEST_SIZE; i++ ) - paEncryptionKey[i] = nMD5Sum[i]; - } -} - -/********************************** -Algorithm 3.3 Compute the encryption dictionary /O value, save into the class data member -the step numbers down here correspond to the ones in PDF v.1.4 specfication -*/ -void PDFWriterImpl::computeODictionaryValue() -{ -//step 1 already done, data is in m_nPaddedOwnerPassword -//step 2 - if( m_aDigest ) - { - rtlDigestError nError = rtl_digest_updateMD5( m_aDigest, &m_nPaddedOwnerPassword, sizeof( m_nPaddedOwnerPassword ) ); - if( nError == rtl_Digest_E_None ) - { - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - - rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof(nMD5Sum) ); -//step 3, only if 128 bit - if( m_aContext.Security128bit ) - { - sal_Int32 i; - for( i = 0; i < 50; i++ ) - { - nError = rtl_digest_updateMD5( m_aDigest, nMD5Sum, sizeof( nMD5Sum ) ); - if( nError != rtl_Digest_E_None ) - break; - rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof( nMD5Sum ) ); - } - } -//Step 4, the key is in nMD5Sum -//step 5 already done, data is in m_nPaddedUserPassword -//step 6 - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, - nMD5Sum, m_nKeyLength , NULL, 0 ); -// encrypt the user password using the key set above - rtl_cipher_encodeARCFOUR( m_aCipher, m_nPaddedUserPassword, sizeof( m_nPaddedUserPassword ), // the data to be encrypted - m_nEncryptedOwnerPassword, sizeof( m_nEncryptedOwnerPassword ) ); //encrypted data, stored in class data member -//Step 7, only if 128 bit - if( m_aContext.Security128bit ) - { - sal_uInt32 i, y; - sal_uInt8 nLocalKey[ SECUR_128BIT_KEY ]; // 16 = 128 bit key - for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1 - { - for( y = 0; y < sizeof( nLocalKey ); y++ ) - nLocalKey[y] = (sal_uInt8)( nMD5Sum[y] ^ i ); - - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, - nLocalKey, SECUR_128BIT_KEY, NULL, 0 ); //destination data area, on init can be NULL - rtl_cipher_encodeARCFOUR( m_aCipher, m_nEncryptedOwnerPassword, sizeof( m_nEncryptedOwnerPassword ), // the data to be encrypted - m_nEncryptedOwnerPassword, sizeof( m_nEncryptedOwnerPassword ) ); // encrypted data, can be the same as the input, encrypt "in place" -//step 8, store in class data member - } - } - } - } -} - -/********************************** -Algorithms 3.4 and 3.5 Compute the encryption dictionary /U value, save into the class data member, revision 2 (40 bit) or 3 (128 bit) -*/ -void PDFWriterImpl::computeUDictionaryValue() -{ -//step 1, common to both 3.4 and 3.5 - computeEncryptionKey( m_nPaddedUserPassword , m_nEncryptionKey ); - - if( m_aContext.Security128bit == false ) - { -//3.4 -//step 2 and 3 - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, - m_nEncryptionKey, 5 , // key and key length - NULL, 0 ); //destination data area -// encrypt the user password using the key set above, save for later use - rtl_cipher_encodeARCFOUR( m_aCipher, m_nPadString, sizeof( m_nPadString ), // the data to be encrypted - m_nEncryptedUserPassword, sizeof( m_nEncryptedUserPassword ) ); //encrypted data, stored in class data member - } - else - { -//or 3.5, for 128 bit security -//step6, initilize the last 16 bytes of the encrypted user password to 0 - for(sal_uInt32 i = MD5_DIGEST_SIZE; i < sizeof( m_nEncryptedUserPassword ); i++) - m_nEncryptedUserPassword[i] = 0; -//step 2 - if( m_aDigest ) - { - rtlDigestError nError = rtl_digest_updateMD5( m_aDigest, m_nPadString, sizeof( m_nPadString ) ); -//step 3 - if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( m_aDigest, m_nDocID , sizeof(m_nDocID) ); - - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof(nMD5Sum) ); -//Step 4 - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, - m_nEncryptionKey, SECUR_128BIT_KEY, NULL, 0 ); //destination data area - rtl_cipher_encodeARCFOUR( m_aCipher, nMD5Sum, sizeof( nMD5Sum ), // the data to be encrypted - m_nEncryptedUserPassword, sizeof( nMD5Sum ) ); //encrypted data, stored in class data member -//step 5 - sal_uInt32 i, y; - sal_uInt8 nLocalKey[SECUR_128BIT_KEY]; - - for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1 - { - for( y = 0; y < sizeof( nLocalKey ) ; y++ ) - nLocalKey[y] = (sal_uInt8)( m_nEncryptionKey[y] ^ i ); - - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, - nLocalKey, SECUR_128BIT_KEY, // key and key length - NULL, 0 ); //destination data area, on init can be NULL - rtl_cipher_encodeARCFOUR( m_aCipher, m_nEncryptedUserPassword, SECUR_128BIT_KEY, // the data to be encrypted - m_nEncryptedUserPassword, SECUR_128BIT_KEY ); // encrypted data, can be the same as the input, encrypt "in place" - } - } - } -} - -/* init the encryption engine -1. init the document id, used both for building the document id and for building the encryption key(s) -2. build the encryption key following algorithms described in the PDF specification - */ -void PDFWriterImpl::initEncryption() -{ - m_aOwnerPassword = m_aContext.OwnerPassword; - m_aUserPassword = m_aContext.UserPassword; -/* password stuff computing, before sending out anything */ - DBG_ASSERT( m_aCipher != NULL, "PDFWriterImpl::initEncryption: a cipher (ARCFOUR) object is not available !" ); - DBG_ASSERT( m_aDigest != NULL, "PDFWriterImpl::initEncryption: a digest (MD5) object is not available !" ); - - if( m_aCipher && m_aDigest ) - { -//if there is no owner password, force it to the user password - if( m_aOwnerPassword.getLength() == 0 ) - m_aOwnerPassword = m_aUserPassword; - - initPadString(); -/* -1) pad passwords -*/ - padPassword( m_aOwnerPassword, m_nPaddedOwnerPassword ); - padPassword( m_aUserPassword, m_nPaddedUserPassword ); -/* -2) compute the access permissions, in numerical form - -the default value depends on the revision 2 (40 bit) or 3 (128 bit security): -- for 40 bit security the unused bit must be set to 1, since they are not used -- for 128 bit security the same bit must be preset to 0 and set later if needed -according to the table 3.15, pdf v 1.4 */ - m_nAccessPermissions = ( m_aContext.Security128bit ) ? 0xfffff0c0 : 0xffffffc0 ; - -/* check permissions for 40 bit security case */ - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanPrintTheDocument ) ? 1 << 2 : 0; - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanModifyTheContent ) ? 1 << 3 : 0; - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanCopyOrExtract ) ? 1 << 4 : 0; - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanAddOrModify ) ? 1 << 5 : 0; - m_nKeyLength = SECUR_40BIT_KEY; - m_nRC4KeyLength = SECUR_40BIT_KEY+5; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 5 - - if( m_aContext.Security128bit ) - { - m_nKeyLength = SECUR_128BIT_KEY; - m_nRC4KeyLength = 16; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 16, thus maximum - // permitted value is 16 - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanFillInteractive ) ? 1 << 8 : 0; - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanExtractForAccessibility ) ? 1 << 9 : 0; - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanAssemble ) ? 1 << 10 : 0; - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanPrintFull ) ? 1 << 11 : 0; - } - computeODictionaryValue(); - computeUDictionaryValue(); - -//clear out exceding key values, prepares for generation number default to 0 as well -// see checkAndEnableStreamEncryption in pdfwriter_impl.hxx - sal_Int32 i, y; - for( i = m_nKeyLength, y = 0; y < 5 ; y++ ) - m_nEncryptionKey[i++] = 0; - } - else //either no cipher or no digest or both, something is wrong with memory or something else - m_aContext.Encrypt = false; //then turn the encryption off -} -/* end i12626 methods */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 8aacf749942e..09459e40a896 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -60,6 +60,8 @@ class ImplFontSelectData; class ImplFontMetricData; class FontSubsetInfo; class ZCodec; +class EncHashTransporter; +struct BitStreamState; // the maximum password length #define ENCRYPTED_PWD_SIZE 32 @@ -448,7 +450,7 @@ public: rtl::OString m_aName; rtl::OUString m_aDescription; rtl::OUString m_aText; - USHORT m_nTextStyle; + sal_uInt16 m_nTextStyle; rtl::OUString m_aValue; rtl::OString m_aDAString; rtl::OString m_aDRDict; @@ -597,7 +599,6 @@ private: MapMode m_aMapMode; // PDFWriterImpl scaled units std::vector< PDFPage > m_aPages; - PDFDocInfo m_aDocInfo; /* maps object numbers to file offsets (needed for xref) */ std::vector< sal_uInt64 > m_aObjects; /* contains Bitmaps until they are written to the @@ -798,116 +799,37 @@ i12626 /* used to cipher the stream data and for password management */ rtlCipher m_aCipher; rtlDigest m_aDigest; -/* pad string used for password in Standard security handler */ - sal_uInt8 m_nPadString[ENCRYPTED_PWD_SIZE]; -/* the owner password, in clear text */ - rtl::OUString m_aOwnerPassword; -/* the padded owner password */ - sal_uInt8 m_nPaddedOwnerPassword[ENCRYPTED_PWD_SIZE]; -/* the encryption dictionary owner password, according to algorithm 3.3 */ - sal_uInt8 m_nEncryptedOwnerPassword[ENCRYPTED_PWD_SIZE]; -/* the user password, in clear text */ - rtl::OUString m_aUserPassword; -/* the padded user password */ - sal_uInt8 m_nPaddedUserPassword[ENCRYPTED_PWD_SIZE]; -/* the encryption dictionary user password, according to algorithm 3.4 or 3.5 depending on the - security handler revision */ - sal_uInt8 m_nEncryptedUserPassword[ENCRYPTED_PWD_SIZE]; - -/* the encryption key, formed with the user password according to algorithm 3.2, maximum length is 16 bytes + 3 + 2 - for 128 bit security */ - sal_uInt8 m_nEncryptionKey[MAXIMUM_RC4_KEY_LENGTH]; + /* pad string used for password in Standard security handler */ + static const sal_uInt8 s_nPadString[ENCRYPTED_PWD_SIZE]; + + /* the encryption key, formed with the user password according to algorithm 3.2, maximum length is 16 bytes + 3 + 2 + for 128 bit security */ sal_Int32 m_nKeyLength; // key length, 16 or 5 sal_Int32 m_nRC4KeyLength; // key length, 16 or 10, to be input to the algorith 3.1 -/* set to true if the following stream must be encrypted, used inside writeBuffer() */ + /* set to true if the following stream must be encrypted, used inside writeBuffer() */ sal_Bool m_bEncryptThisStream; -/* the numerical value of the access permissions, according to PDF spec, must be signed */ + /* the numerical value of the access permissions, according to PDF spec, must be signed */ sal_Int32 m_nAccessPermissions; -/* the document ID, the raw MD5 hash */ - sal_uInt8 m_nDocID[MD5_DIGEST_SIZE]; -/* string buffer to hold document ID, this is the output string */ - rtl::OStringBuffer m_aDocID; -/* string to hold the PDF creation date */ - rtl::OStringBuffer m_aCreationDateString; -/* string to hold the PDF creation date, for PDF/A metadata */ - rtl::OStringBuffer m_aCreationMetaDateString; -/* the buffer where the data are encrypted, dynamically allocated */ + /* string to hold the PDF creation date */ + rtl::OString m_aCreationDateString; + /* string to hold the PDF creation date, for PDF/A metadata */ + rtl::OString m_aCreationMetaDateString; + /* the buffer where the data are encrypted, dynamically allocated */ sal_uInt8 *m_pEncryptionBuffer; -/* size of the buffer */ + /* size of the buffer */ sal_Int32 m_nEncryptionBufferSize; -/* check and reallocate the buffer for encryption */ - sal_Bool checkEncryptionBufferSize( register sal_Int32 newSize ) - { - if( m_nEncryptionBufferSize < newSize ) - { -/* reallocate the buffer, the used function allocate as rtl_allocateMemory - if the pointer parameter is NULL */ - m_pEncryptionBuffer = (sal_uInt8*)rtl_reallocateMemory( m_pEncryptionBuffer, newSize ); - if( m_pEncryptionBuffer ) - m_nEncryptionBufferSize = newSize; - else - m_nEncryptionBufferSize = 0; - } - return ( m_nEncryptionBufferSize != 0 ); - } -/* init the internal pad string */ - void initPadString() - { - static const sal_uInt8 nPadString[32] = - { - 0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, - 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A - }; - - for(sal_uInt32 i = 0; i < sizeof( nPadString ); i++ ) - m_nPadString[i] = nPadString[i]; - - }; -/* initialize the encryption engine */ - void initEncryption(); - -/* this function implements part of the PDF spec algorithm 3.1 in encryption, the rest (the actual encryption) is in PDFWriterImpl::writeBuffer */ - void checkAndEnableStreamEncryption( register sal_Int32 nObject ) - { - if( m_aContext.Encrypt ) - { - m_bEncryptThisStream = true; - register sal_Int32 i = m_nKeyLength; - m_nEncryptionKey[i++] = (sal_uInt8)nObject; - m_nEncryptionKey[i++] = (sal_uInt8)( nObject >> 8 ); - m_nEncryptionKey[i++] = (sal_uInt8)( nObject >> 16 ); -//the other location of m_nEncryptionKey are already set to 0, our fixed generation number -// do the MD5 hash - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - // the i+2 to take into account the generation number, always zero - rtl_digest_MD5( &m_nEncryptionKey, i+2, nMD5Sum, sizeof(nMD5Sum) ); -// initialize the RC4 with the key -// key legth: see algoritm 3.1, step 4: (N+5) max 16 - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 ); - } - }; + /* check and reallocate the buffer for encryption */ + sal_Bool checkEncryptionBufferSize( register sal_Int32 newSize ); + /* this function implements part of the PDF spec algorithm 3.1 in encryption, the rest (the actual encryption) is in PDFWriterImpl::writeBuffer */ + void checkAndEnableStreamEncryption( register sal_Int32 nObject ); void disableStreamEncryption() { m_bEncryptThisStream = false; }; -/* */ - void enableStringEncryption( register sal_Int32 nObject ) - { - register sal_Int32 i = m_nKeyLength; - m_nEncryptionKey[i++] = (sal_uInt8)nObject; - m_nEncryptionKey[i++] = (sal_uInt8)( nObject >> 8 ); - m_nEncryptionKey[i++] = (sal_uInt8)( nObject >> 16 ); -//the other location of m_nEncryptionKey are already set to 0, our fixed generation number -// do the MD5 hash - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - // the i+2 to take into account the generation number, always zero - rtl_digest_MD5( &m_nEncryptionKey, i+2, nMD5Sum, sizeof(nMD5Sum) ); -// initialize the RC4 with the key -// key legth: see algoritm 3.1, step 4: (N+5) max 16 - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 ); - }; + /* */ + void enableStringEncryption( register sal_Int32 nObject ); // test if the encryption is active, if yes than encrypt the unicode string and add to the OStringBuffer parameter void appendUnicodeTextStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer ); @@ -1093,28 +1015,68 @@ i12626 bool checkEmitStructure(); /* draws an emphasis mark */ - void drawEmphasisMark( long nX, long nY, const PolyPolygon& rPolyPoly, BOOL bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ); + void drawEmphasisMark( long nX, long nY, const PolyPolygon& rPolyPoly, sal_Bool bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ); /* true if PDF/A-1a or PDF/A-1b is output */ sal_Bool m_bIsPDF_A1; - -/* -i12626 -methods for PDF security - - pad a password according algorithm 3.2, step 1 */ - void padPassword( const rtl::OUString aPassword, sal_uInt8 *paPasswordTarget ); -/* algorithm 3.2: compute an encryption key */ - void computeEncryptionKey( sal_uInt8 *paThePaddedPassword, sal_uInt8 *paEncryptionKey ); -/* algorithm 3.3: computing the encryption dictionary'ss owner password value ( /O ) */ - void computeODictionaryValue(); -/* algorithm 3.4 or 3.5: computing the encryption dictionary's user password value ( /U ) revision 2 or 3 of the standard security handler */ - void computeUDictionaryValue(); - + PDFWriter& m_rOuterFace; + + /* + i12626 + methods for PDF security + + pad a password according algorithm 3.2, step 1 */ + static void padPassword( const rtl::OUString& i_rPassword, sal_uInt8* o_pPaddedPW ); + /* algorithm 3.2: compute an encryption key */ + static bool computeEncryptionKey( EncHashTransporter*, + vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + sal_Int32 i_nAccessPermissions + ); + /* algorithm 3.3: computing the encryption dictionary'ss owner password value ( /O ) */ + static bool computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, const sal_uInt8* i_pPaddedUserPassword, + std::vector< sal_uInt8 >& io_rOValue, + sal_Int32 i_nKeyLength + ); + /* algorithm 3.4 or 3.5: computing the encryption dictionary's user password value ( /U ) revision 2 or 3 of the standard security handler */ + static bool computeUDictionaryValue( EncHashTransporter* i_pTransporter, + vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + sal_Int32 i_nKeyLength, + sal_Int32 i_nAccessPermissions + ); + + static void computeDocumentIdentifier( std::vector< sal_uInt8 >& o_rIdentifier, + const vcl::PDFWriter::PDFDocInfo& i_rDocInfo, + rtl::OString& o_rCString1, + rtl::OString& o_rCString2 + ); + static sal_Int32 computeAccessPermissions( const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties, + sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength ); + void setupDocInfo(); + bool prepareEncryption( const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& ); + + // helper for playMetafile + void implWriteGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient, + VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& ); + void implWriteBitmapEx( const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx, + VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& ); + + // helpers for CCITT 1bit bitmap stream + void putG4Bits( sal_uInt32 i_nLength, sal_uInt32 i_nCode, BitStreamState& io_rState ); + void putG4Span( long i_nSpan, bool i_bWhitePixel, BitStreamState& io_rState ); + void writeG4Stream( BitmapReadAccess* i_pBitmap ); + + // color helper functions + void appendStrokingColor( const Color& rColor, rtl::OStringBuffer& rBuffer ); + void appendNonStrokingColor( const Color& rColor, rtl::OStringBuffer& rBuffer ); public: - PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext ); + PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >&, PDFWriter& ); ~PDFWriterImpl(); + static com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > + initEncryption( const rtl::OUString& i_rOwnerPassword, + const rtl::OUString& i_rUserPassword, + bool b128Bit ); + /* for OutputDevice so the reference device can have a list * that contains only suitable fonts (subsettable or builtin) * produces a new font list @@ -1136,6 +1098,7 @@ public: bool emit(); std::set< PDFWriter::ErrorCode > getErrors(); void insertError( PDFWriter::ErrorCode eErr ) { m_aErrors.insert( eErr ); } + void playMetafile( const GDIMetaFile&, vcl::PDFExtOutDevData*, const vcl::PDFWriter::PlayMetafileContext&, VirtualDevice* pDummyDev = NULL ); Size getCurPageSize() const { @@ -1146,8 +1109,6 @@ public: } PDFWriter::PDFVersion getVersion() const { return m_aContext.Version; } - void setDocInfo( const PDFDocInfo& rInfo ); - const PDFDocInfo& getDocInfo() const { return m_aDocInfo; } void setDocumentLocale( const com::sun::star::lang::Locale& rLoc ) { m_aContext.DocumentLocale = rLoc; } @@ -1204,13 +1165,13 @@ public: void setTextFillColor( const Color& rColor ) { m_aGraphicsStack.front().m_aFont.SetFillColor( rColor ); - m_aGraphicsStack.front().m_aFont.SetTransparent( ImplIsColorTransparent( rColor ) ? TRUE : FALSE ); + m_aGraphicsStack.front().m_aFont.SetTransparent( ImplIsColorTransparent( rColor ) ? sal_True : sal_False ); m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont; } void setTextFillColor() { m_aGraphicsStack.front().m_aFont.SetFillColor( Color( COL_TRANSPARENT ) ); - m_aGraphicsStack.front().m_aFont.SetTransparent( TRUE ); + m_aGraphicsStack.front().m_aFont.SetTransparent( sal_True ); m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont; } void setTextColor( const Color& rColor ) @@ -1261,10 +1222,10 @@ public: /* actual drawing functions */ void drawText( const Point& rPos, const String& rText, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true ); void drawTextArray( const Point& rPos, const String& rText, const sal_Int32* pDXArray = NULL, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true ); - void drawStretchText( const Point& rPos, ULONG nWidth, const String& rText, + void drawStretchText( const Point& rPos, sal_uLong nWidth, const String& rText, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true ); - void drawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, bool bTextLines = true ); + void drawText( const Rectangle& rRect, const String& rOrigStr, sal_uInt16 nStyle, bool bTextLines = true ); void drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, bool bUnderlineAbove ); void drawWaveTextLine( rtl::OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove ); void drawStraightTextLine( rtl::OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove ); diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx new file mode 100644 index 000000000000..143c55a83ab1 --- /dev/null +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -0,0 +1,2037 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public 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_vcl.hxx" + +#include "pdfwriter_impl.hxx" + +#include "vcl/pdfextoutdevdata.hxx" +#include "vcl/virdev.hxx" +#include "vcl/gdimtf.hxx" +#include "vcl/metaact.hxx" +#include "vcl/bmpacc.hxx" +#include "vcl/graph.hxx" +#include "vcl/svdata.hxx" +#include "unotools/streamwrap.hxx" +#include "unotools/processfactory.hxx" +#include "comphelper/processfactory.hxx" + +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/io/XSeekable.hpp" +#include "com/sun/star/graphic/XGraphicProvider.hpp" + +#include "cppuhelper/implbase1.hxx" + +#include <rtl/digest.h> + +#undef USE_PDFGRADIENTS + +using namespace vcl; +using namespace rtl; +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; + +// ----------------------------------------------------------------------------- + +void PDFWriterImpl::implWriteGradient( const PolyPolygon& i_rPolyPoly, const Gradient& i_rGradient, + VirtualDevice* i_pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& i_rContext ) +{ + GDIMetaFile aTmpMtf; + + i_pDummyVDev->AddGradientActions( i_rPolyPoly.GetBoundRect(), i_rGradient, aTmpMtf ); + + m_rOuterFace.Push(); + m_rOuterFace.IntersectClipRegion( i_rPolyPoly.getB2DPolyPolygon() ); + playMetafile( aTmpMtf, NULL, i_rContext, i_pDummyVDev ); + m_rOuterFace.Pop(); +} + +// ----------------------------------------------------------------------------- + +void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSize, const BitmapEx& i_rBitmapEx, + VirtualDevice* i_pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& i_rContext ) +{ + if ( !i_rBitmapEx.IsEmpty() && i_rSize.Width() && i_rSize.Height() ) + { + BitmapEx aBitmapEx( i_rBitmapEx ); + Point aPoint( i_rPoint ); + Size aSize( i_rSize ); + + // #i19065# Negative sizes have mirror semantics on + // OutputDevice. BitmapEx and co. have no idea about that, so + // perform that _before_ doing anything with aBitmapEx. + sal_uLong nMirrorFlags(BMP_MIRROR_NONE); + if( aSize.Width() < 0 ) + { + aSize.Width() *= -1; + aPoint.X() -= aSize.Width(); + nMirrorFlags |= BMP_MIRROR_HORZ; + } + if( aSize.Height() < 0 ) + { + aSize.Height() *= -1; + aPoint.Y() -= aSize.Height(); + nMirrorFlags |= BMP_MIRROR_VERT; + } + + if( nMirrorFlags != BMP_MIRROR_NONE ) + { + aBitmapEx.Mirror( nMirrorFlags ); + } + if( i_rContext.m_nMaxImageResolution > 50 ) + { + // do downsampling if neccessary + const Size aDstSizeTwip( i_pDummyVDev->PixelToLogic( i_pDummyVDev->LogicToPixel( aSize ), MAP_TWIP ) ); + const Size aBmpSize( aBitmapEx.GetSizePixel() ); + const double fBmpPixelX = aBmpSize.Width(); + const double fBmpPixelY = aBmpSize.Height(); + const double fMaxPixelX = aDstSizeTwip.Width() * i_rContext.m_nMaxImageResolution / 1440.0; + const double fMaxPixelY = aDstSizeTwip.Height() * i_rContext.m_nMaxImageResolution / 1440.0; + + // check, if the bitmap DPI exceeds the maximum DPI (allow 4 pixel rounding tolerance) + if( ( ( fBmpPixelX > ( fMaxPixelX + 4 ) ) || + ( fBmpPixelY > ( fMaxPixelY + 4 ) ) ) && + ( fBmpPixelY > 0.0 ) && ( fMaxPixelY > 0.0 ) ) + { + // do scaling + Size aNewBmpSize; + const double fBmpWH = fBmpPixelX / fBmpPixelY; + const double fMaxWH = fMaxPixelX / fMaxPixelY; + + if( fBmpWH < fMaxWH ) + { + aNewBmpSize.Width() = FRound( fMaxPixelY * fBmpWH ); + aNewBmpSize.Height() = FRound( fMaxPixelY ); + } + else if( fBmpWH > 0.0 ) + { + aNewBmpSize.Width() = FRound( fMaxPixelX ); + aNewBmpSize.Height() = FRound( fMaxPixelX / fBmpWH); + } + if( aNewBmpSize.Width() && aNewBmpSize.Height() ) + aBitmapEx.Scale( aNewBmpSize ); + else + aBitmapEx.SetEmpty(); + } + } + + const Size aSizePixel( aBitmapEx.GetSizePixel() ); + if ( aSizePixel.Width() && aSizePixel.Height() ) + { + if( m_aContext.ColorMode == PDFWriter::DrawGreyscale ) + { + BmpConversion eConv = BMP_CONVERSION_8BIT_GREYS; + int nDepth = aBitmapEx.GetBitmap().GetBitCount(); + if( nDepth <= 4 ) + eConv = BMP_CONVERSION_4BIT_GREYS; + if( nDepth > 1 ) + aBitmapEx.Convert( eConv ); + } + sal_Bool bUseJPGCompression = !i_rContext.m_bOnlyLosslessCompression; + if ( ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) ) + bUseJPGCompression = sal_False; + + SvMemoryStream aStrm; + Bitmap aMask; + + bool bTrueColorJPG = true; + if ( bUseJPGCompression ) + { + sal_uInt32 nZippedFileSize; // sj: we will calculate the filesize of a zipped bitmap + { // to determine if jpeg compression is usefull + SvMemoryStream aTemp; + aTemp.SetCompressMode( aTemp.GetCompressMode() | COMPRESSMODE_ZBITMAP ); + aTemp.SetVersion( SOFFICE_FILEFORMAT_40 ); // sj: up from version 40 our bitmap stream operator + aTemp << aBitmapEx; // is capable of zlib stream compression + aTemp.Seek( STREAM_SEEK_TO_END ); + nZippedFileSize = aTemp.Tell(); + } + if ( aBitmapEx.IsTransparent() ) + { + if ( aBitmapEx.IsAlpha() ) + aMask = aBitmapEx.GetAlpha().GetBitmap(); + else + aMask = aBitmapEx.GetMask(); + } + Graphic aGraphic( aBitmapEx.GetBitmap() ); + sal_Int32 nColorMode = 0; + + Sequence< PropertyValue > aFilterData( 2 ); + aFilterData[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ); + aFilterData[ 0 ].Value <<= sal_Int32(i_rContext.m_nJPEGQuality); + aFilterData[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ); + aFilterData[ 1 ].Value <<= nColorMode; + + try + { + uno::Reference < io::XStream > xStream = new utl::OStreamWrapper( aStrm ); + uno::Reference< io::XSeekable > xSeekable( xStream, UNO_QUERY_THROW ); + uno::Reference< graphic::XGraphicProvider > xGraphicProvider( ImplGetSVData()->maAppData.mxMSF->createInstance( + OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY ); + if ( xGraphicProvider.is() ) + { + uno::Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() ); + uno::Reference < io::XOutputStream > xOut( xStream->getOutputStream() ); + rtl::OUString aMimeType( ::rtl::OUString::createFromAscii( "image/jpeg" ) ); + uno::Sequence< beans::PropertyValue > aOutMediaProperties( 3 ); + aOutMediaProperties[0].Name = ::rtl::OUString::createFromAscii( "OutputStream" ); + aOutMediaProperties[0].Value <<= xOut; + aOutMediaProperties[1].Name = ::rtl::OUString::createFromAscii( "MimeType" ); + aOutMediaProperties[1].Value <<= aMimeType; + aOutMediaProperties[2].Name = ::rtl::OUString::createFromAscii( "FilterData" ); + aOutMediaProperties[2].Value <<= aFilterData; + xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties ); + xOut->flush(); + if ( xSeekable->getLength() > nZippedFileSize ) + { + bUseJPGCompression = sal_False; + } + else + { + aStrm.Seek( STREAM_SEEK_TO_END ); + + xSeekable->seek( 0 ); + Sequence< PropertyValue > aArgs( 1 ); + aArgs[ 0 ].Name = ::rtl::OUString::createFromAscii( "InputStream" ); + aArgs[ 0 ].Value <<= xStream; + uno::Reference< XPropertySet > xPropSet( xGraphicProvider->queryGraphicDescriptor( aArgs ) ); + if ( xPropSet.is() ) + { + sal_Int16 nBitsPerPixel = 24; + if ( xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii( "BitsPerPixel" ) ) >>= nBitsPerPixel ) + { + bTrueColorJPG = nBitsPerPixel != 8; + } + } + } + } + else + bUseJPGCompression = sal_False; + } + catch( uno::Exception& ) + { + bUseJPGCompression = sal_False; + } + } + if ( bUseJPGCompression ) + m_rOuterFace.DrawJPGBitmap( aStrm, bTrueColorJPG, aSizePixel, Rectangle( aPoint, aSize ), aMask ); + else if ( aBitmapEx.IsTransparent() ) + m_rOuterFace.DrawBitmapEx( aPoint, aSize, aBitmapEx ); + else + m_rOuterFace.DrawBitmap( aPoint, aSize, aBitmapEx.GetBitmap() ); + } + } +} + + +// ----------------------------------------------------------------------------- + +void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevData* i_pOutDevData, const vcl::PDFWriter::PlayMetafileContext& i_rContext, VirtualDevice* pDummyVDev ) +{ + bool bAssertionFired( false ); + + VirtualDevice* pPrivateDevice = NULL; + if( ! pDummyVDev ) + { + pPrivateDevice = pDummyVDev = new VirtualDevice(); + pDummyVDev->EnableOutput( sal_False ); + pDummyVDev->SetMapMode( i_rMtf.GetPrefMapMode() ); + } + GDIMetaFile aMtf( i_rMtf ); + + for( sal_uInt32 i = 0, nCount = aMtf.GetActionCount(); i < nCount; ) + { + if ( !i_pOutDevData || !i_pOutDevData->PlaySyncPageAct( m_rOuterFace, i ) ) + { + const MetaAction* pAction = aMtf.GetAction( i ); + const sal_uInt16 nType = pAction->GetType(); + + switch( nType ) + { + case( META_PIXEL_ACTION ): + { + const MetaPixelAction* pA = (const MetaPixelAction*) pAction; + m_rOuterFace.DrawPixel( pA->GetPoint(), pA->GetColor() ); + } + break; + + case( META_POINT_ACTION ): + { + const MetaPointAction* pA = (const MetaPointAction*) pAction; + m_rOuterFace.DrawPixel( pA->GetPoint() ); + } + break; + + case( META_LINE_ACTION ): + { + const MetaLineAction* pA = (const MetaLineAction*) pAction; + if ( pA->GetLineInfo().IsDefault() ) + m_rOuterFace.DrawLine( pA->GetStartPoint(), pA->GetEndPoint() ); + else + m_rOuterFace.DrawLine( pA->GetStartPoint(), pA->GetEndPoint(), pA->GetLineInfo() ); + } + break; + + case( META_RECT_ACTION ): + { + const MetaRectAction* pA = (const MetaRectAction*) pAction; + m_rOuterFace.DrawRect( pA->GetRect() ); + } + break; + + case( META_ROUNDRECT_ACTION ): + { + const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pAction; + m_rOuterFace.DrawRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() ); + } + break; + + case( META_ELLIPSE_ACTION ): + { + const MetaEllipseAction* pA = (const MetaEllipseAction*) pAction; + m_rOuterFace.DrawEllipse( pA->GetRect() ); + } + break; + + case( META_ARC_ACTION ): + { + const MetaArcAction* pA = (const MetaArcAction*) pAction; + m_rOuterFace.DrawArc( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() ); + } + break; + + case( META_PIE_ACTION ): + { + const MetaArcAction* pA = (const MetaArcAction*) pAction; + m_rOuterFace.DrawPie( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() ); + } + break; + + case( META_CHORD_ACTION ): + { + const MetaChordAction* pA = (const MetaChordAction*) pAction; + m_rOuterFace.DrawChord( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() ); + } + break; + + case( META_POLYGON_ACTION ): + { + const MetaPolygonAction* pA = (const MetaPolygonAction*) pAction; + m_rOuterFace.DrawPolygon( pA->GetPolygon() ); + } + break; + + case( META_POLYLINE_ACTION ): + { + const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction; + if ( pA->GetLineInfo().IsDefault() ) + m_rOuterFace.DrawPolyLine( pA->GetPolygon() ); + else + m_rOuterFace.DrawPolyLine( pA->GetPolygon(), pA->GetLineInfo() ); + } + break; + + case( META_POLYPOLYGON_ACTION ): + { + const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pAction; + m_rOuterFace.DrawPolyPolygon( pA->GetPolyPolygon() ); + } + break; + + case( META_GRADIENT_ACTION ): + { + const MetaGradientAction* pA = (const MetaGradientAction*) pAction; + #ifdef USE_PDFGRADIENTS + m_rOuterFace.DrawGradient( pA->GetRect(), pA->GetGradient() ); + #else + const PolyPolygon aPolyPoly( pA->GetRect() ); + implWriteGradient( aPolyPoly, pA->GetGradient(), pDummyVDev, i_rContext ); + #endif + } + break; + + case( META_GRADIENTEX_ACTION ): + { + const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction; + #ifdef USE_PDFGRADIENTS + m_rOuterFace.DrawGradient( pA->GetPolyPolygon(), pA->GetGradient() ); + #else + implWriteGradient( pA->GetPolyPolygon(), pA->GetGradient(), pDummyVDev, i_rContext ); + #endif + } + break; + + case META_HATCH_ACTION: + { + const MetaHatchAction* pA = (const MetaHatchAction*) pAction; + m_rOuterFace.DrawHatch( pA->GetPolyPolygon(), pA->GetHatch() ); + } + break; + + case( META_TRANSPARENT_ACTION ): + { + const MetaTransparentAction* pA = (const MetaTransparentAction*) pAction; + m_rOuterFace.DrawTransparent( pA->GetPolyPolygon(), pA->GetTransparence() ); + } + break; + + case( META_FLOATTRANSPARENT_ACTION ): + { + const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pAction; + + GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() ); + const Point& rPos = pA->GetPoint(); + const Size& rSize= pA->GetSize(); + const Gradient& rTransparenceGradient = pA->GetGradient(); + + // special case constant alpha value + if( rTransparenceGradient.GetStartColor() == rTransparenceGradient.GetEndColor() ) + { + const Color aTransCol( rTransparenceGradient.GetStartColor() ); + const sal_uInt16 nTransPercent = aTransCol.GetLuminance() * 100 / 255; + m_rOuterFace.BeginTransparencyGroup(); + playMetafile( aTmpMtf, NULL, i_rContext, pDummyVDev ); + m_rOuterFace.EndTransparencyGroup( Rectangle( rPos, rSize ), nTransPercent ); + } + else + { + const Size aDstSizeTwip( pDummyVDev->PixelToLogic( pDummyVDev->LogicToPixel( rSize ), MAP_TWIP ) ); + sal_Int32 nMaxBmpDPI = i_rContext.m_bOnlyLosslessCompression ? 300 : 72; + if( i_rContext.m_nMaxImageResolution > 50 ) + { + if ( nMaxBmpDPI > i_rContext.m_nMaxImageResolution ) + nMaxBmpDPI = i_rContext.m_nMaxImageResolution; + } + const sal_Int32 nPixelX = (sal_Int32)((double)aDstSizeTwip.Width() * (double)nMaxBmpDPI / 1440.0); + const sal_Int32 nPixelY = (sal_Int32)((double)aDstSizeTwip.Height() * (double)nMaxBmpDPI / 1440.0); + if ( nPixelX && nPixelY ) + { + Size aDstSizePixel( nPixelX, nPixelY ); + VirtualDevice* pVDev = new VirtualDevice; + if( pVDev->SetOutputSizePixel( aDstSizePixel ) ) + { + Bitmap aPaint, aMask; + AlphaMask aAlpha; + Point aPoint; + + MapMode aMapMode( pDummyVDev->GetMapMode() ); + aMapMode.SetOrigin( aPoint ); + pVDev->SetMapMode( aMapMode ); + Size aDstSize( pVDev->PixelToLogic( aDstSizePixel ) ); + + Point aMtfOrigin( aTmpMtf.GetPrefMapMode().GetOrigin() ); + if ( aMtfOrigin.X() || aMtfOrigin.Y() ) + aTmpMtf.Move( -aMtfOrigin.X(), -aMtfOrigin.Y() ); + double fScaleX = (double)aDstSize.Width() / (double)aTmpMtf.GetPrefSize().Width(); + double fScaleY = (double)aDstSize.Height() / (double)aTmpMtf.GetPrefSize().Height(); + if( fScaleX != 1.0 || fScaleY != 1.0 ) + aTmpMtf.Scale( fScaleX, fScaleY ); + aTmpMtf.SetPrefMapMode( aMapMode ); + + // create paint bitmap + aTmpMtf.WindStart(); + aTmpMtf.Play( pVDev, aPoint, aDstSize ); + aTmpMtf.WindStart(); + + pVDev->EnableMapMode( sal_False ); + aPaint = pVDev->GetBitmap( aPoint, aDstSizePixel ); + pVDev->EnableMapMode( sal_True ); + + // create mask bitmap + pVDev->SetLineColor( COL_BLACK ); + pVDev->SetFillColor( COL_BLACK ); + pVDev->DrawRect( Rectangle( aPoint, aDstSize ) ); + pVDev->SetDrawMode( DRAWMODE_WHITELINE | DRAWMODE_WHITEFILL | DRAWMODE_WHITETEXT | + DRAWMODE_WHITEBITMAP | DRAWMODE_WHITEGRADIENT ); + aTmpMtf.WindStart(); + aTmpMtf.Play( pVDev, aPoint, aDstSize ); + aTmpMtf.WindStart(); + pVDev->EnableMapMode( sal_False ); + aMask = pVDev->GetBitmap( aPoint, aDstSizePixel ); + pVDev->EnableMapMode( sal_True ); + + // create alpha mask from gradient + pVDev->SetDrawMode( DRAWMODE_GRAYGRADIENT ); + pVDev->DrawGradient( Rectangle( aPoint, aDstSize ), rTransparenceGradient ); + pVDev->SetDrawMode( DRAWMODE_DEFAULT ); + pVDev->EnableMapMode( sal_False ); + pVDev->DrawMask( aPoint, aDstSizePixel, aMask, Color( COL_WHITE ) ); + aAlpha = pVDev->GetBitmap( aPoint, aDstSizePixel ); + implWriteBitmapEx( rPos, rSize, BitmapEx( aPaint, aAlpha ), pDummyVDev, i_rContext ); + } + delete pVDev; + } + } + } + break; + + case( META_EPS_ACTION ): + { + const MetaEPSAction* pA = (const MetaEPSAction*) pAction; + const GDIMetaFile aSubstitute( pA->GetSubstitute() ); + + m_rOuterFace.Push(); + pDummyVDev->Push(); + + MapMode aMapMode( aSubstitute.GetPrefMapMode() ); + Size aOutSize( pDummyVDev->LogicToLogic( pA->GetSize(), pDummyVDev->GetMapMode(), aMapMode ) ); + aMapMode.SetScaleX( Fraction( aOutSize.Width(), aSubstitute.GetPrefSize().Width() ) ); + aMapMode.SetScaleY( Fraction( aOutSize.Height(), aSubstitute.GetPrefSize().Height() ) ); + aMapMode.SetOrigin( pDummyVDev->LogicToLogic( pA->GetPoint(), pDummyVDev->GetMapMode(), aMapMode ) ); + + m_rOuterFace.SetMapMode( aMapMode ); + pDummyVDev->SetMapMode( aMapMode ); + playMetafile( aSubstitute, NULL, i_rContext, pDummyVDev ); + pDummyVDev->Pop(); + m_rOuterFace.Pop(); + } + break; + + case( META_COMMENT_ACTION ): + if( ! i_rContext.m_bTransparenciesWereRemoved ) + { + const MetaCommentAction* pA = (const MetaCommentAction*) pAction; + String aSkipComment; + + if( pA->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL ) + { + const MetaGradientExAction* pGradAction = NULL; + sal_Bool bDone = sal_False; + + while( !bDone && ( ++i < nCount ) ) + { + pAction = aMtf.GetAction( i ); + + if( pAction->GetType() == META_GRADIENTEX_ACTION ) + pGradAction = (const MetaGradientExAction*) pAction; + else if( ( pAction->GetType() == META_COMMENT_ACTION ) && + ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) ) + { + bDone = sal_True; + } + } + + if( pGradAction ) + { + #if USE_PDFGRADIENTS + m_rOuterFace.DrawGradient( pGradAction->GetPolyPolygon(), pGradAction->GetGradient() ); + #else + implWriteGradient( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), pDummyVDev, i_rContext ); + #endif + } + } + else + { + const sal_uInt8* pData = pA->GetData(); + if ( pData ) + { + SvMemoryStream aMemStm( (void*)pData, pA->GetDataSize(), STREAM_READ ); + sal_Bool bSkipSequence = sal_False; + ByteString sSeqEnd; + + if( pA->GetComment().Equals( "XPATHSTROKE_SEQ_BEGIN" ) ) + { + sSeqEnd = ByteString( "XPATHSTROKE_SEQ_END" ); + SvtGraphicStroke aStroke; + aMemStm >> aStroke; + + Polygon aPath; + aStroke.getPath( aPath ); + + PolyPolygon aStartArrow; + PolyPolygon aEndArrow; + double fTransparency( aStroke.getTransparency() ); + double fStrokeWidth( aStroke.getStrokeWidth() ); + SvtGraphicStroke::DashArray aDashArray; + + aStroke.getStartArrow( aStartArrow ); + aStroke.getEndArrow( aEndArrow ); + aStroke.getDashArray( aDashArray ); + + bSkipSequence = sal_True; + if ( aStartArrow.Count() || aEndArrow.Count() ) + bSkipSequence = sal_False; + if ( aDashArray.size() && ( fStrokeWidth != 0.0 ) && ( fTransparency == 0.0 ) ) + bSkipSequence = sal_False; + if ( bSkipSequence ) + { + PDFWriter::ExtLineInfo aInfo; + aInfo.m_fLineWidth = fStrokeWidth; + aInfo.m_fTransparency = fTransparency; + aInfo.m_fMiterLimit = aStroke.getMiterLimit(); + switch( aStroke.getCapType() ) + { + default: + case SvtGraphicStroke::capButt: aInfo.m_eCap = PDFWriter::capButt;break; + case SvtGraphicStroke::capRound: aInfo.m_eCap = PDFWriter::capRound;break; + case SvtGraphicStroke::capSquare: aInfo.m_eCap = PDFWriter::capSquare;break; + } + switch( aStroke.getJoinType() ) + { + default: + case SvtGraphicStroke::joinMiter: aInfo.m_eJoin = PDFWriter::joinMiter;break; + case SvtGraphicStroke::joinRound: aInfo.m_eJoin = PDFWriter::joinRound;break; + case SvtGraphicStroke::joinBevel: aInfo.m_eJoin = PDFWriter::joinBevel;break; + case SvtGraphicStroke::joinNone: + aInfo.m_eJoin = PDFWriter::joinMiter; + aInfo.m_fMiterLimit = 0.0; + break; + } + aInfo.m_aDashArray = aDashArray; + + if(SvtGraphicStroke::joinNone == aStroke.getJoinType() + && fStrokeWidth > 0.0) + { + // emulate no edge rounding by handling single edges + const sal_uInt16 nPoints(aPath.GetSize()); + const bool bCurve(aPath.HasFlags()); + + for(sal_uInt16 a(0); a + 1 < nPoints; a++) + { + if(bCurve + && POLY_NORMAL != aPath.GetFlags(a + 1) + && a + 2 < nPoints + && POLY_NORMAL != aPath.GetFlags(a + 2) + && a + 3 < nPoints) + { + const Polygon aSnippet(4, + aPath.GetConstPointAry() + a, + aPath.GetConstFlagAry() + a); + m_rOuterFace.DrawPolyLine( aSnippet, aInfo ); + a += 2; + } + else + { + const Polygon aSnippet(2, + aPath.GetConstPointAry() + a); + m_rOuterFace.DrawPolyLine( aSnippet, aInfo ); + } + } + } + else + { + m_rOuterFace.DrawPolyLine( aPath, aInfo ); + } + } + } + else if ( pA->GetComment().Equals( "XPATHFILL_SEQ_BEGIN" ) ) + { + sSeqEnd = ByteString( "XPATHFILL_SEQ_END" ); + SvtGraphicFill aFill; + aMemStm >> aFill; + + if ( ( aFill.getFillType() == SvtGraphicFill::fillSolid ) && ( aFill.getFillRule() == SvtGraphicFill::fillEvenOdd ) ) + { + double fTransparency = aFill.getTransparency(); + if ( fTransparency == 0.0 ) + { + PolyPolygon aPath; + aFill.getPath( aPath ); + + bSkipSequence = sal_True; + m_rOuterFace.DrawPolyPolygon( aPath ); + } + else if ( fTransparency == 1.0 ) + bSkipSequence = sal_True; + } +/* #i81548# removing optimization for fill textures, because most of the texture settings are not + exported properly. In OpenOffice 3.1 the drawing layer will support graphic primitives, then it + will not be a problem to optimize the filltexture export. But for wysiwyg is more important than + filesize. + else if( aFill.getFillType() == SvtGraphicFill::fillTexture && aFill.isTiling() ) + { + sal_Int32 nPattern = mnCachePatternId; + Graphic aPatternGraphic; + aFill.getGraphic( aPatternGraphic ); + bool bUseCache = false; + SvtGraphicFill::Transform aPatTransform; + aFill.getTransform( aPatTransform ); + + if( mnCachePatternId >= 0 ) + { + SvtGraphicFill::Transform aCacheTransform; + maCacheFill.getTransform( aCacheTransform ); + if( aCacheTransform.matrix[0] == aPatTransform.matrix[0] && + aCacheTransform.matrix[1] == aPatTransform.matrix[1] && + aCacheTransform.matrix[2] == aPatTransform.matrix[2] && + aCacheTransform.matrix[3] == aPatTransform.matrix[3] && + aCacheTransform.matrix[4] == aPatTransform.matrix[4] && + aCacheTransform.matrix[5] == aPatTransform.matrix[5] + ) + { + Graphic aCacheGraphic; + maCacheFill.getGraphic( aCacheGraphic ); + if( aCacheGraphic == aPatternGraphic ) + bUseCache = true; + } + } + + if( ! bUseCache ) + { + + // paint graphic to metafile + GDIMetaFile aPattern; + pDummyVDev->SetConnectMetaFile( &aPattern ); + pDummyVDev->Push(); + pDummyVDev->SetMapMode( aPatternGraphic.GetPrefMapMode() ); + + aPatternGraphic.Draw( &rDummyVDev, Point( 0, 0 ) ); + pDummyVDev->Pop(); + pDummyVDev->SetConnectMetaFile( NULL ); + aPattern.WindStart(); + + MapMode aPatternMapMode( aPatternGraphic.GetPrefMapMode() ); + // prepare pattern from metafile + Size aPrefSize( aPatternGraphic.GetPrefSize() ); + // FIXME: this magic -1 shouldn't be necessary + aPrefSize.Width() -= 1; + aPrefSize.Height() -= 1; + aPrefSize = m_rOuterFace.GetReferenceDevice()-> + LogicToLogic( aPrefSize, + &aPatternMapMode, + &m_rOuterFace.GetReferenceDevice()->GetMapMode() ); + // build bounding rectangle of pattern + Rectangle aBound( Point( 0, 0 ), aPrefSize ); + m_rOuterFace.BeginPattern( aBound ); + m_rOuterFace.Push(); + pDummyVDev->Push(); + m_rOuterFace.SetMapMode( aPatternMapMode ); + pDummyVDev->SetMapMode( aPatternMapMode ); + ImplWriteActions( m_rOuterFace, NULL, aPattern, rDummyVDev ); + pDummyVDev->Pop(); + m_rOuterFace.Pop(); + + nPattern = m_rOuterFace.EndPattern( aPatTransform ); + + // try some caching and reuse pattern + mnCachePatternId = nPattern; + maCacheFill = aFill; + } + + // draw polypolygon with pattern fill + PolyPolygon aPath; + aFill.getPath( aPath ); + m_rOuterFace.DrawPolyPolygon( aPath, nPattern, aFill.getFillRule() == SvtGraphicFill::fillEvenOdd ); + + bSkipSequence = sal_True; + } +*/ + } + if ( bSkipSequence ) + { + while( ++i < nCount ) + { + pAction = aMtf.GetAction( i ); + if ( pAction->GetType() == META_COMMENT_ACTION ) + { + ByteString sComment( ((MetaCommentAction*)pAction)->GetComment() ); + if ( sComment.Equals( sSeqEnd ) ) + break; + } + // #i44496# + // the replacement action for stroke is a filled rectangle + // the set fillcolor of the replacement is part of the graphics + // state and must not be skipped + else if( pAction->GetType() == META_FILLCOLOR_ACTION ) + { + const MetaFillColorAction* pMA = (const MetaFillColorAction*) pAction; + if( pMA->IsSetting() ) + m_rOuterFace.SetFillColor( pMA->GetColor() ); + else + m_rOuterFace.SetFillColor(); + } + } + } + } + } + } + break; + + case( META_BMP_ACTION ): + { + const MetaBmpAction* pA = (const MetaBmpAction*) pAction; + BitmapEx aBitmapEx( pA->GetBitmap() ); + Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(), + aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) ); + if( ! ( aSize.Width() && aSize.Height() ) ) + aSize = pDummyVDev->PixelToLogic( aBitmapEx.GetSizePixel() ); + implWriteBitmapEx( pA->GetPoint(), aSize, aBitmapEx, pDummyVDev, i_rContext ); + } + break; + + case( META_BMPSCALE_ACTION ): + { + const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction; + implWriteBitmapEx( pA->GetPoint(), pA->GetSize(), BitmapEx( pA->GetBitmap() ), pDummyVDev, i_rContext ); + } + break; + + case( META_BMPSCALEPART_ACTION ): + { + const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction; + BitmapEx aBitmapEx( pA->GetBitmap() ); + aBitmapEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ); + implWriteBitmapEx( pA->GetDestPoint(), pA->GetDestSize(), aBitmapEx, pDummyVDev, i_rContext ); + } + break; + + case( META_BMPEX_ACTION ): + { + const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction; + BitmapEx aBitmapEx( pA->GetBitmapEx() ); + Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(), + aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) ); + implWriteBitmapEx( pA->GetPoint(), aSize, aBitmapEx, pDummyVDev, i_rContext ); + } + break; + + case( META_BMPEXSCALE_ACTION ): + { + const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction; + implWriteBitmapEx( pA->GetPoint(), pA->GetSize(), pA->GetBitmapEx(), pDummyVDev, i_rContext ); + } + break; + + case( META_BMPEXSCALEPART_ACTION ): + { + const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction; + BitmapEx aBitmapEx( pA->GetBitmapEx() ); + aBitmapEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ); + implWriteBitmapEx( pA->GetDestPoint(), pA->GetDestSize(), aBitmapEx, pDummyVDev, i_rContext ); + } + break; + + case( META_MASK_ACTION ): + case( META_MASKSCALE_ACTION ): + case( META_MASKSCALEPART_ACTION ): + { + DBG_ERROR( "MetaMask...Action not supported yet" ); + } + break; + + case( META_TEXT_ACTION ): + { + const MetaTextAction* pA = (const MetaTextAction*) pAction; + m_rOuterFace.DrawText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ) ); + } + break; + + case( META_TEXTRECT_ACTION ): + { + const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction; + m_rOuterFace.DrawText( pA->GetRect(), String( pA->GetText() ), pA->GetStyle() ); + } + break; + + case( META_TEXTARRAY_ACTION ): + { + const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction; + m_rOuterFace.DrawTextArray( pA->GetPoint(), pA->GetText(), pA->GetDXArray(), pA->GetIndex(), pA->GetLen() ); + } + break; + + case( META_STRETCHTEXT_ACTION ): + { + const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction; + m_rOuterFace.DrawStretchText( pA->GetPoint(), pA->GetWidth(), pA->GetText(), pA->GetIndex(), pA->GetLen() ); + } + break; + + + case( META_TEXTLINE_ACTION ): + { + const MetaTextLineAction* pA = (const MetaTextLineAction*) pAction; + m_rOuterFace.DrawTextLine( pA->GetStartPoint(), pA->GetWidth(), pA->GetStrikeout(), pA->GetUnderline(), pA->GetOverline() ); + + } + break; + + case( META_CLIPREGION_ACTION ): + { + const MetaClipRegionAction* pA = (const MetaClipRegionAction*) pAction; + + if( pA->IsClipping() ) + { + if( pA->GetRegion().IsEmpty() ) + m_rOuterFace.SetClipRegion( basegfx::B2DPolyPolygon() ); + else + { + Region aReg( pA->GetRegion() ); + m_rOuterFace.SetClipRegion( aReg.ConvertToB2DPolyPolygon() ); + } + } + else + m_rOuterFace.SetClipRegion(); + } + break; + + case( META_ISECTRECTCLIPREGION_ACTION ): + { + const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pAction; + m_rOuterFace.IntersectClipRegion( pA->GetRect() ); + } + break; + + case( META_ISECTREGIONCLIPREGION_ACTION ): + { + const MetaISectRegionClipRegionAction* pA = (const MetaISectRegionClipRegionAction*) pAction; + Region aReg( pA->GetRegion() ); + m_rOuterFace.IntersectClipRegion( aReg.ConvertToB2DPolyPolygon() ); + } + break; + + case( META_MOVECLIPREGION_ACTION ): + { + const MetaMoveClipRegionAction* pA = (const MetaMoveClipRegionAction*) pAction; + m_rOuterFace.MoveClipRegion( pA->GetHorzMove(), pA->GetVertMove() ); + } + break; + + case( META_MAPMODE_ACTION ): + { + const_cast< MetaAction* >( pAction )->Execute( pDummyVDev ); + m_rOuterFace.SetMapMode( pDummyVDev->GetMapMode() ); + } + break; + + case( META_LINECOLOR_ACTION ): + { + const MetaLineColorAction* pA = (const MetaLineColorAction*) pAction; + + if( pA->IsSetting() ) + m_rOuterFace.SetLineColor( pA->GetColor() ); + else + m_rOuterFace.SetLineColor(); + } + break; + + case( META_FILLCOLOR_ACTION ): + { + const MetaFillColorAction* pA = (const MetaFillColorAction*) pAction; + + if( pA->IsSetting() ) + m_rOuterFace.SetFillColor( pA->GetColor() ); + else + m_rOuterFace.SetFillColor(); + } + break; + + case( META_TEXTLINECOLOR_ACTION ): + { + const MetaTextLineColorAction* pA = (const MetaTextLineColorAction*) pAction; + + if( pA->IsSetting() ) + m_rOuterFace.SetTextLineColor( pA->GetColor() ); + else + m_rOuterFace.SetTextLineColor(); + } + break; + + case( META_OVERLINECOLOR_ACTION ): + { + const MetaOverlineColorAction* pA = (const MetaOverlineColorAction*) pAction; + + if( pA->IsSetting() ) + m_rOuterFace.SetOverlineColor( pA->GetColor() ); + else + m_rOuterFace.SetOverlineColor(); + } + break; + + case( META_TEXTFILLCOLOR_ACTION ): + { + const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*) pAction; + + if( pA->IsSetting() ) + m_rOuterFace.SetTextFillColor( pA->GetColor() ); + else + m_rOuterFace.SetTextFillColor(); + } + break; + + case( META_TEXTCOLOR_ACTION ): + { + const MetaTextColorAction* pA = (const MetaTextColorAction*) pAction; + m_rOuterFace.SetTextColor( pA->GetColor() ); + } + break; + + case( META_TEXTALIGN_ACTION ): + { + const MetaTextAlignAction* pA = (const MetaTextAlignAction*) pAction; + m_rOuterFace.SetTextAlign( pA->GetTextAlign() ); + } + break; + + case( META_FONT_ACTION ): + { + const MetaFontAction* pA = (const MetaFontAction*) pAction; + m_rOuterFace.SetFont( pA->GetFont() ); + } + break; + + case( META_PUSH_ACTION ): + { + const MetaPushAction* pA = (const MetaPushAction*) pAction; + + pDummyVDev->Push( pA->GetFlags() ); + m_rOuterFace.Push( pA->GetFlags() ); + } + break; + + case( META_POP_ACTION ): + { + pDummyVDev->Pop(); + m_rOuterFace.Pop(); + } + break; + + case( META_LAYOUTMODE_ACTION ): + { + const MetaLayoutModeAction* pA = (const MetaLayoutModeAction*) pAction; + m_rOuterFace.SetLayoutMode( pA->GetLayoutMode() ); + } + break; + + case META_TEXTLANGUAGE_ACTION: + { + const MetaTextLanguageAction* pA = (const MetaTextLanguageAction*) pAction; + m_rOuterFace.SetDigitLanguage( pA->GetTextLanguage() ); + } + break; + + case( META_WALLPAPER_ACTION ): + { + const MetaWallpaperAction* pA = (const MetaWallpaperAction*) pAction; + m_rOuterFace.DrawWallpaper( pA->GetRect(), pA->GetWallpaper() ); + } + break; + + case( META_RASTEROP_ACTION ): + { + // !!! >>> we don't want to support this actions + } + break; + + case( META_REFPOINT_ACTION ): + { + // !!! >>> we don't want to support this actions + } + break; + + default: + // #i24604# Made assertion fire only once per + // metafile. The asserted actions here are all + // deprecated + if( !bAssertionFired ) + { + bAssertionFired = true; + DBG_ERROR( "PDFExport::ImplWriteActions: deprecated and unsupported MetaAction encountered" ); + } + break; + } + i++; + } + } + + delete pPrivateDevice; +} + +// Encryption methods + +/* a crutch to transport an rtlDigest safely though UNO API + this is needed for the PDF export dialog, which otherwise would have to pass + clear text passwords down till they can be used in PDFWriter. Unfortunately + the MD5 sum of the password (which is needed to create the PDF encryption key) + is not sufficient, since an rtl MD5 digest cannot be created in an arbitrary state + which would be needed in PDFWriterImpl::computeEncryptionKey. +*/ +class EncHashTransporter : public cppu::WeakImplHelper1 < com::sun::star::beans::XMaterialHolder > +{ + rtlDigest maUDigest; + sal_IntPtr maID; + std::vector< sal_uInt8 > maOValue; + + static std::map< sal_IntPtr, EncHashTransporter* > sTransporters; +public: + EncHashTransporter() + : maUDigest( rtl_digest_createMD5() ) + { + maID = reinterpret_cast< sal_IntPtr >(this); + while( sTransporters.find( maID ) != sTransporters.end() ) // paranoia mode + maID++; + sTransporters[ maID ] = this; + } + + virtual ~EncHashTransporter() + { + sTransporters.erase( maID ); + if( maUDigest ) + rtl_digest_destroyMD5( maUDigest ); + OSL_TRACE( "EncHashTransporter freed\n" ); + } + + rtlDigest getUDigest() const { return maUDigest; }; + std::vector< sal_uInt8 >& getOValue() { return maOValue; } + void invalidate() + { + if( maUDigest ) + { + rtl_digest_destroyMD5( maUDigest ); + maUDigest = NULL; + } + } + + // XMaterialHolder + virtual uno::Any SAL_CALL getMaterial() throw() + { + return uno::makeAny( sal_Int64(maID) ); + } + + static EncHashTransporter* getEncHashTransporter( const uno::Reference< beans::XMaterialHolder >& ); + +}; + +std::map< sal_IntPtr, EncHashTransporter* > EncHashTransporter::sTransporters; + +EncHashTransporter* EncHashTransporter::getEncHashTransporter( const uno::Reference< beans::XMaterialHolder >& xRef ) +{ + EncHashTransporter* pResult = NULL; + if( xRef.is() ) + { + uno::Any aMat( xRef->getMaterial() ); + sal_Int64 nMat = 0; + if( aMat >>= nMat ) + { + std::map< sal_IntPtr, EncHashTransporter* >::iterator it = sTransporters.find( static_cast<sal_IntPtr>(nMat) ); + if( it != sTransporters.end() ) + pResult = it->second; + } + } + return pResult; +} + +sal_Bool PDFWriterImpl::checkEncryptionBufferSize( register sal_Int32 newSize ) +{ + if( m_nEncryptionBufferSize < newSize ) + { + /* reallocate the buffer, the used function allocate as rtl_allocateMemory + if the pointer parameter is NULL */ + m_pEncryptionBuffer = (sal_uInt8*)rtl_reallocateMemory( m_pEncryptionBuffer, newSize ); + if( m_pEncryptionBuffer ) + m_nEncryptionBufferSize = newSize; + else + m_nEncryptionBufferSize = 0; + } + return ( m_nEncryptionBufferSize != 0 ); +} + +void PDFWriterImpl::checkAndEnableStreamEncryption( register sal_Int32 nObject ) +{ + if( m_aContext.Encryption.Encrypt() ) + { + m_bEncryptThisStream = true; + sal_Int32 i = m_nKeyLength; + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)nObject; + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 8 ); + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 16 ); + //the other location of m_nEncryptionKey are already set to 0, our fixed generation number + // do the MD5 hash + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + // the i+2 to take into account the generation number, always zero + rtl_digest_MD5( &m_aContext.Encryption.EncryptionKey[0], i+2, nMD5Sum, sizeof(nMD5Sum) ); + // initialize the RC4 with the key + // key legth: see algoritm 3.1, step 4: (N+5) max 16 + rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 ); + } +} + +void PDFWriterImpl::enableStringEncryption( register sal_Int32 nObject ) +{ + if( m_aContext.Encryption.Encrypt() ) + { + sal_Int32 i = m_nKeyLength; + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)nObject; + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 8 ); + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 16 ); + //the other location of m_nEncryptionKey are already set to 0, our fixed generation number + // do the MD5 hash + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + // the i+2 to take into account the generation number, always zero + rtl_digest_MD5( &m_aContext.Encryption.EncryptionKey[0], i+2, nMD5Sum, sizeof(nMD5Sum) ); + // initialize the RC4 with the key + // key legth: see algoritm 3.1, step 4: (N+5) max 16 + rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 ); + } +} + +/* init the encryption engine +1. init the document id, used both for building the document id and for building the encryption key(s) +2. build the encryption key following algorithms described in the PDF specification + */ +uno::Reference< beans::XMaterialHolder > PDFWriterImpl::initEncryption( const rtl::OUString& i_rOwnerPassword, + const rtl::OUString& i_rUserPassword, + bool b128Bit + ) +{ + uno::Reference< beans::XMaterialHolder > xResult; + if( i_rOwnerPassword.getLength() || i_rUserPassword.getLength() ) + { + EncHashTransporter* pTransporter = new EncHashTransporter; + xResult = pTransporter; + + // get padded passwords + sal_uInt8 aPadUPW[ENCRYPTED_PWD_SIZE], aPadOPW[ENCRYPTED_PWD_SIZE]; + padPassword( i_rOwnerPassword.getLength() ? i_rOwnerPassword : i_rUserPassword, aPadOPW ); + padPassword( i_rUserPassword, aPadUPW ); + sal_Int32 nKeyLength = SECUR_40BIT_KEY; + if( b128Bit ) + nKeyLength = SECUR_128BIT_KEY; + + if( computeODictionaryValue( aPadOPW, aPadUPW, pTransporter->getOValue(), nKeyLength ) ) + { + rtlDigest aDig = pTransporter->getUDigest(); + if( rtl_digest_updateMD5( aDig, aPadUPW, ENCRYPTED_PWD_SIZE ) != rtl_Digest_E_None ) + xResult.clear(); + } + else + xResult.clear(); + + // trash temporary padded cleartext PWDs + rtl_zeroMemory( aPadOPW, sizeof(aPadOPW) ); + rtl_zeroMemory( aPadUPW, sizeof(aPadUPW) ); + + } + return xResult; +} + +bool PDFWriterImpl::prepareEncryption( const uno::Reference< beans::XMaterialHolder >& xEnc ) +{ + bool bSuccess = false; + EncHashTransporter* pTransporter = EncHashTransporter::getEncHashTransporter( xEnc ); + if( pTransporter ) + { + sal_Int32 nKeyLength = 0, nRC4KeyLength = 0; + sal_Int32 nAccessPermissions = computeAccessPermissions( m_aContext.Encryption, nKeyLength, nRC4KeyLength ); + m_aContext.Encryption.OValue = pTransporter->getOValue(); + bSuccess = computeUDictionaryValue( pTransporter, m_aContext.Encryption, nKeyLength, nAccessPermissions ); + } + if( ! bSuccess ) + { + m_aContext.Encryption.OValue.clear(); + m_aContext.Encryption.UValue.clear(); + m_aContext.Encryption.EncryptionKey.clear(); + } + return bSuccess; +} + +sal_Int32 PDFWriterImpl::computeAccessPermissions( const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties, + sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength ) +{ + /* + 2) compute the access permissions, in numerical form + + the default value depends on the revision 2 (40 bit) or 3 (128 bit security): + - for 40 bit security the unused bit must be set to 1, since they are not used + - for 128 bit security the same bit must be preset to 0 and set later if needed + according to the table 3.15, pdf v 1.4 */ + sal_Int32 nAccessPermissions = ( i_rProperties.Security128bit ) ? 0xfffff0c0 : 0xffffffc0 ; + + /* check permissions for 40 bit security case */ + nAccessPermissions |= ( i_rProperties.CanPrintTheDocument ) ? 1 << 2 : 0; + nAccessPermissions |= ( i_rProperties.CanModifyTheContent ) ? 1 << 3 : 0; + nAccessPermissions |= ( i_rProperties.CanCopyOrExtract ) ? 1 << 4 : 0; + nAccessPermissions |= ( i_rProperties.CanAddOrModify ) ? 1 << 5 : 0; + o_rKeyLength = SECUR_40BIT_KEY; + o_rRC4KeyLength = SECUR_40BIT_KEY+5; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 5 + + if( i_rProperties.Security128bit ) + { + o_rKeyLength = SECUR_128BIT_KEY; + o_rRC4KeyLength = 16; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 16, thus maximum + // permitted value is 16 + nAccessPermissions |= ( i_rProperties.CanFillInteractive ) ? 1 << 8 : 0; + nAccessPermissions |= ( i_rProperties.CanExtractForAccessibility ) ? 1 << 9 : 0; + nAccessPermissions |= ( i_rProperties.CanAssemble ) ? 1 << 10 : 0; + nAccessPermissions |= ( i_rProperties.CanPrintFull ) ? 1 << 11 : 0; + } + return nAccessPermissions; +} + +/************************************************************* +begin i12626 methods + +Implements Algorithm 3.2, step 1 only +*/ +void PDFWriterImpl::padPassword( const rtl::OUString& i_rPassword, sal_uInt8* o_pPaddedPW ) +{ + // get ansi-1252 version of the password string CHECKIT ! i12626 + rtl::OString aString( rtl::OUStringToOString( i_rPassword, RTL_TEXTENCODING_MS_1252 ) ); + + //copy the string to the target + sal_Int32 nToCopy = ( aString.getLength() < ENCRYPTED_PWD_SIZE ) ? aString.getLength() : ENCRYPTED_PWD_SIZE; + sal_Int32 nCurrentChar; + + for( nCurrentChar = 0; nCurrentChar < nToCopy; nCurrentChar++ ) + o_pPaddedPW[nCurrentChar] = (sal_uInt8)( aString.getStr()[nCurrentChar] ); + + //pad it with standard byte string + sal_Int32 i,y; + for( i = nCurrentChar, y = 0 ; i < ENCRYPTED_PWD_SIZE; i++, y++ ) + o_pPaddedPW[i] = s_nPadString[y]; + + // trash memory of temporary clear text password + rtl_zeroMemory( (sal_Char*)aString.getStr(), aString.getLength() ); +} + +/********************************** +Algorithm 3.2 Compute the encryption key used + +step 1 should already be done before calling, the paThePaddedPassword parameter should contain +the padded password and must be 32 byte long, the encryption key is returned into the paEncryptionKey parameter, +it will be 16 byte long for 128 bit security; for 40 bit security only the first 5 bytes are used + +TODO: in pdf ver 1.5 and 1.6 the step 6 is different, should be implemented. See spec. + +*/ +bool PDFWriterImpl::computeEncryptionKey( EncHashTransporter* i_pTransporter, vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, sal_Int32 i_nAccessPermissions ) +{ + bool bSuccess = true; + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + + // transporter contains an MD5 digest with the padded user password already + rtlDigest aDigest = i_pTransporter->getUDigest(); + rtlDigestError nError = rtl_Digest_E_None; + if( aDigest ) + { + //step 3 + if( ! io_rProperties.OValue.empty() ) + nError = rtl_digest_updateMD5( aDigest, &io_rProperties.OValue[0] , sal_Int32(io_rProperties.OValue.size()) ); + else + bSuccess = false; + //Step 4 + sal_uInt8 nPerm[4]; + + nPerm[0] = (sal_uInt8)i_nAccessPermissions; + nPerm[1] = (sal_uInt8)( i_nAccessPermissions >> 8 ); + nPerm[2] = (sal_uInt8)( i_nAccessPermissions >> 16 ); + nPerm[3] = (sal_uInt8)( i_nAccessPermissions >> 24 ); + + if( nError == rtl_Digest_E_None ) + nError = rtl_digest_updateMD5( aDigest, nPerm , sizeof( nPerm ) ); + + //step 5, get the document ID, binary form + if( nError == rtl_Digest_E_None ) + nError = rtl_digest_updateMD5( aDigest, &io_rProperties.DocumentIdentifier[0], sal_Int32(io_rProperties.DocumentIdentifier.size()) ); + //get the digest + if( nError == rtl_Digest_E_None ) + { + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); + + //step 6, only if 128 bit + if( io_rProperties.Security128bit ) + { + for( sal_Int32 i = 0; i < 50; i++ ) + { + nError = rtl_digest_updateMD5( aDigest, &nMD5Sum, sizeof( nMD5Sum ) ); + if( nError != rtl_Digest_E_None ) + { + bSuccess = false; + break; + } + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); + } + } + } + } + else + bSuccess = false; + + i_pTransporter->invalidate(); + + //Step 7 + if( bSuccess ) + { + io_rProperties.EncryptionKey.resize( MAXIMUM_RC4_KEY_LENGTH ); + for( sal_Int32 i = 0; i < MD5_DIGEST_SIZE; i++ ) + io_rProperties.EncryptionKey[i] = nMD5Sum[i]; + } + else + io_rProperties.EncryptionKey.clear(); + + return bSuccess; +} + +/********************************** +Algorithm 3.3 Compute the encryption dictionary /O value, save into the class data member +the step numbers down here correspond to the ones in PDF v.1.4 specfication +*/ +bool PDFWriterImpl::computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, + const sal_uInt8* i_pPaddedUserPassword, + std::vector< sal_uInt8 >& io_rOValue, + sal_Int32 i_nKeyLength + ) +{ + bool bSuccess = true; + + io_rOValue.resize( ENCRYPTED_PWD_SIZE ); + + rtlDigest aDigest = rtl_digest_createMD5(); + rtlCipher aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream ); + if( aDigest && aCipher) + { + //step 1 already done, data is in i_pPaddedOwnerPassword + //step 2 + + rtlDigestError nError = rtl_digest_updateMD5( aDigest, i_pPaddedOwnerPassword, ENCRYPTED_PWD_SIZE ); + if( nError == rtl_Digest_E_None ) + { + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof(nMD5Sum) ); +//step 3, only if 128 bit + if( i_nKeyLength == SECUR_128BIT_KEY ) + { + sal_Int32 i; + for( i = 0; i < 50; i++ ) + { + nError = rtl_digest_updateMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); + if( nError != rtl_Digest_E_None ) + { + bSuccess = false; + break; + } + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); + } + } + //Step 4, the key is in nMD5Sum + //step 5 already done, data is in i_pPaddedUserPassword + //step 6 + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + nMD5Sum, i_nKeyLength , NULL, 0 ); + // encrypt the user password using the key set above + rtl_cipher_encodeARCFOUR( aCipher, i_pPaddedUserPassword, ENCRYPTED_PWD_SIZE, // the data to be encrypted + &io_rOValue[0], sal_Int32(io_rOValue.size()) ); //encrypted data + //Step 7, only if 128 bit + if( i_nKeyLength == SECUR_128BIT_KEY ) + { + sal_uInt32 i, y; + sal_uInt8 nLocalKey[ SECUR_128BIT_KEY ]; // 16 = 128 bit key + + for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1 + { + for( y = 0; y < sizeof( nLocalKey ); y++ ) + nLocalKey[y] = (sal_uInt8)( nMD5Sum[y] ^ i ); + + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + nLocalKey, SECUR_128BIT_KEY, NULL, 0 ); //destination data area, on init can be NULL + rtl_cipher_encodeARCFOUR( aCipher, &io_rOValue[0], sal_Int32(io_rOValue.size()), // the data to be encrypted + &io_rOValue[0], sal_Int32(io_rOValue.size()) ); // encrypted data, can be the same as the input, encrypt "in place" + //step 8, store in class data member + } + } + } + else + bSuccess = false; + } + else + bSuccess = false; + + if( aDigest ) + rtl_digest_destroyMD5( aDigest ); + if( aCipher ) + rtl_cipher_destroyARCFOUR( aCipher ); + + if( ! bSuccess ) + io_rOValue.clear(); + return bSuccess; +} + +/********************************** +Algorithms 3.4 and 3.5 Compute the encryption dictionary /U value, save into the class data member, revision 2 (40 bit) or 3 (128 bit) +*/ +bool PDFWriterImpl::computeUDictionaryValue( EncHashTransporter* i_pTransporter, + vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + sal_Int32 i_nKeyLength, + sal_Int32 i_nAccessPermissions + ) +{ + bool bSuccess = true; + + io_rProperties.UValue.resize( ENCRYPTED_PWD_SIZE ); + + rtlDigest aDigest = rtl_digest_createMD5(); + rtlCipher aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream ); + if( aDigest && aCipher ) + { + //step 1, common to both 3.4 and 3.5 + if( computeEncryptionKey( i_pTransporter, io_rProperties, i_nAccessPermissions ) ) + { + // prepare encryption key for object + for( sal_Int32 i = i_nKeyLength, y = 0; y < 5 ; y++ ) + io_rProperties.EncryptionKey[i++] = 0; + + if( io_rProperties.Security128bit == false ) + { + //3.4 + //step 2 and 3 + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + &io_rProperties.EncryptionKey[0], 5 , // key and key length + NULL, 0 ); //destination data area + // encrypt the user password using the key set above, save for later use + rtl_cipher_encodeARCFOUR( aCipher, s_nPadString, sizeof( s_nPadString ), // the data to be encrypted + &io_rProperties.UValue[0], sal_Int32(io_rProperties.UValue.size()) ); //encrypted data, stored in class data member + } + else + { + //or 3.5, for 128 bit security + //step6, initilize the last 16 bytes of the encrypted user password to 0 + for(sal_uInt32 i = MD5_DIGEST_SIZE; i < sal_uInt32(io_rProperties.UValue.size()); i++) + io_rProperties.UValue[i] = 0; + //step 2 + rtlDigestError nError = rtl_digest_updateMD5( aDigest, s_nPadString, sizeof( s_nPadString ) ); + //step 3 + if( nError == rtl_Digest_E_None ) + nError = rtl_digest_updateMD5( aDigest, &io_rProperties.DocumentIdentifier[0], sal_Int32(io_rProperties.DocumentIdentifier.size()) ); + else + bSuccess = false; + + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof(nMD5Sum) ); + //Step 4 + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + &io_rProperties.EncryptionKey[0], SECUR_128BIT_KEY, NULL, 0 ); //destination data area + rtl_cipher_encodeARCFOUR( aCipher, nMD5Sum, sizeof( nMD5Sum ), // the data to be encrypted + &io_rProperties.UValue[0], sizeof( nMD5Sum ) ); //encrypted data, stored in class data member + //step 5 + sal_uInt32 i, y; + sal_uInt8 nLocalKey[SECUR_128BIT_KEY]; + + for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1 + { + for( y = 0; y < sizeof( nLocalKey ) ; y++ ) + nLocalKey[y] = (sal_uInt8)( io_rProperties.EncryptionKey[y] ^ i ); + + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + nLocalKey, SECUR_128BIT_KEY, // key and key length + NULL, 0 ); //destination data area, on init can be NULL + rtl_cipher_encodeARCFOUR( aCipher, &io_rProperties.UValue[0], SECUR_128BIT_KEY, // the data to be encrypted + &io_rProperties.UValue[0], SECUR_128BIT_KEY ); // encrypted data, can be the same as the input, encrypt "in place" + } + } + } + else + bSuccess = false; + } + else + bSuccess = false; + + if( aDigest ) + rtl_digest_destroyMD5( aDigest ); + if( aCipher ) + rtl_cipher_destroyARCFOUR( aCipher ); + + if( ! bSuccess ) + io_rProperties.UValue.clear(); + return bSuccess; +} + +/* end i12626 methods */ + +static const long unsetRun[256] = +{ + 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0x00 - 0x0f */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1f */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x20 - 0x2f */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x30 - 0x3f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x50 - 0x5f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x70 - 0x7f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0 - 0xaf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0 - 0xbf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0 - 0xcf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0 - 0xdf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0 - 0xef */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xf0 - 0xff */ +}; + +static const long setRun[256] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x0f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 - 0x2f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 - 0x3f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x4f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 - 0x5f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x6f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x7f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x80 - 0x8f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x90 - 0x9f */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xa0 - 0xaf */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xb0 - 0xbf */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xc0 - 0xcf */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xd0 - 0xdf */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xe0 - 0xef */ + 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, /* 0xf0 - 0xff */ +}; + +inline bool isSet( const Scanline i_pLine, long i_nIndex ) +{ + return (i_pLine[ i_nIndex/8 ] & (0x80 >> (i_nIndex&7))) != 0; +} + +long findBitRun( const Scanline i_pLine, long i_nStartIndex, long i_nW, bool i_bSet ) +{ + if( i_nStartIndex < 0 ) + return i_nW; + + long nIndex = i_nStartIndex; + if( nIndex < i_nW ) + { + const sal_uInt8 * pByte = static_cast<sal_uInt8*>(i_pLine) + (nIndex/8); + sal_uInt8 nByte = *pByte; + + // run up to byte boundary + long nBitInByte = (nIndex & 7); + if( nBitInByte ) + { + sal_uInt8 nMask = 0x80 >> nBitInByte; + while( nBitInByte != 8 ) + { + if( (nByte & nMask) != (i_bSet ? nMask : 0) ) + return nIndex < i_nW ? nIndex : i_nW; + nMask = nMask >> 1; + nBitInByte++; + nIndex++; + } + if( nIndex < i_nW ) + { + pByte++; + nByte = *pByte; + } + } + + sal_uInt8 nRunByte; + const long* pRunTable; + if( i_bSet ) + { + nRunByte = 0xff; + pRunTable = setRun; + } + else + { + nRunByte = 0; + pRunTable = unsetRun; + } + + while( nByte == nRunByte && nIndex < i_nW ) + { + nIndex += 8; + pByte++; + nByte = *pByte; + } + if( nIndex < i_nW ) + { + nIndex += pRunTable[nByte]; + } + } + return nIndex < i_nW ? nIndex : i_nW; +} + +struct BitStreamState +{ + sal_uInt8 mnBuffer; + sal_uInt32 mnNextBitPos; + + BitStreamState() + : mnBuffer( 0 ) + , mnNextBitPos( 8 ) + { + } + + const sal_uInt8* getByte() const { return &mnBuffer; } + void flush() { mnNextBitPos = 8; mnBuffer = 0; } +}; + +void PDFWriterImpl::putG4Bits( sal_uInt32 i_nLength, sal_uInt32 i_nCode, BitStreamState& io_rState ) +{ + while( i_nLength > io_rState.mnNextBitPos ) + { + io_rState.mnBuffer |= static_cast<sal_uInt8>( i_nCode >> (i_nLength - io_rState.mnNextBitPos) ); + i_nLength -= io_rState.mnNextBitPos; + writeBuffer( io_rState.getByte(), 1 ); + io_rState.flush(); + } + OSL_ASSERT( i_nLength < 9 ); + static const unsigned int msbmask[9] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; + io_rState.mnBuffer |= static_cast<sal_uInt8>( (i_nCode & msbmask[i_nLength]) << (io_rState.mnNextBitPos - i_nLength) ); + io_rState.mnNextBitPos -= i_nLength; + if( io_rState.mnNextBitPos == 0 ) + { + writeBuffer( io_rState.getByte(), 1 ); + io_rState.flush(); + } +} + +struct PixelCode +{ + sal_uInt32 mnEncodedPixels; + sal_uInt32 mnCodeBits; + sal_uInt32 mnCode; +}; + +static const PixelCode WhitePixelCodes[] = +{ + { 0, 8, 0x35 }, // 0011 0101 + { 1, 6, 0x7 }, // 0001 11 + { 2, 4, 0x7 }, // 0111 + { 3, 4, 0x8 }, // 1000 + { 4, 4, 0xB }, // 1011 + { 5, 4, 0xC }, // 1100 + { 6, 4, 0xE }, // 1110 + { 7, 4, 0xF }, // 1111 + { 8, 5, 0x13 }, // 1001 1 + { 9, 5, 0x14 }, // 1010 0 + { 10, 5, 0x7 }, // 0011 1 + { 11, 5, 0x8 }, // 0100 0 + { 12, 6, 0x8 }, // 0010 00 + { 13, 6, 0x3 }, // 0000 11 + { 14, 6, 0x34 }, // 1101 00 + { 15, 6, 0x35 }, // 1101 01 + { 16, 6, 0x2A }, // 1010 10 + { 17, 6, 0x2B }, // 1010 11 + { 18, 7, 0x27 }, // 0100 111 + { 19, 7, 0xC }, // 0001 100 + { 20, 7, 0x8 }, // 0001 000 + { 21, 7, 0x17 }, // 0010 111 + { 22, 7, 0x3 }, // 0000 011 + { 23, 7, 0x4 }, // 0000 100 + { 24, 7, 0x28 }, // 0101 000 + { 25, 7, 0x2B }, // 0101 011 + { 26, 7, 0x13 }, // 0010 011 + { 27, 7, 0x24 }, // 0100 100 + { 28, 7, 0x18 }, // 0011 000 + { 29, 8, 0x2 }, // 0000 0010 + { 30, 8, 0x3 }, // 0000 0011 + { 31, 8, 0x1A }, // 0001 1010 + { 32, 8, 0x1B }, // 0001 1011 + { 33, 8, 0x12 }, // 0001 0010 + { 34, 8, 0x13 }, // 0001 0011 + { 35, 8, 0x14 }, // 0001 0100 + { 36, 8, 0x15 }, // 0001 0101 + { 37, 8, 0x16 }, // 0001 0110 + { 38, 8, 0x17 }, // 0001 0111 + { 39, 8, 0x28 }, // 0010 1000 + { 40, 8, 0x29 }, // 0010 1001 + { 41, 8, 0x2A }, // 0010 1010 + { 42, 8, 0x2B }, // 0010 1011 + { 43, 8, 0x2C }, // 0010 1100 + { 44, 8, 0x2D }, // 0010 1101 + { 45, 8, 0x4 }, // 0000 0100 + { 46, 8, 0x5 }, // 0000 0101 + { 47, 8, 0xA }, // 0000 1010 + { 48, 8, 0xB }, // 0000 1011 + { 49, 8, 0x52 }, // 0101 0010 + { 50, 8, 0x53 }, // 0101 0011 + { 51, 8, 0x54 }, // 0101 0100 + { 52, 8, 0x55 }, // 0101 0101 + { 53, 8, 0x24 }, // 0010 0100 + { 54, 8, 0x25 }, // 0010 0101 + { 55, 8, 0x58 }, // 0101 1000 + { 56, 8, 0x59 }, // 0101 1001 + { 57, 8, 0x5A }, // 0101 1010 + { 58, 8, 0x5B }, // 0101 1011 + { 59, 8, 0x4A }, // 0100 1010 + { 60, 8, 0x4B }, // 0100 1011 + { 61, 8, 0x32 }, // 0011 0010 + { 62, 8, 0x33 }, // 0011 0011 + { 63, 8, 0x34 }, // 0011 0100 + { 64, 5, 0x1B }, // 1101 1 + { 128, 5, 0x12 }, // 1001 0 + { 192, 6, 0x17 }, // 0101 11 + { 256, 7, 0x37 }, // 0110 111 + { 320, 8, 0x36 }, // 0011 0110 + { 384, 8, 0x37 }, // 0011 0111 + { 448, 8, 0x64 }, // 0110 0100 + { 512, 8, 0x65 }, // 0110 0101 + { 576, 8, 0x68 }, // 0110 1000 + { 640, 8, 0x67 }, // 0110 0111 + { 704, 9, 0xCC }, // 0110 0110 0 + { 768, 9, 0xCD }, // 0110 0110 1 + { 832, 9, 0xD2 }, // 0110 1001 0 + { 896, 9, 0xD3 }, // 0110 1001 1 + { 960, 9, 0xD4 }, // 0110 1010 0 + { 1024, 9, 0xD5 }, // 0110 1010 1 + { 1088, 9, 0xD6 }, // 0110 1011 0 + { 1152, 9, 0xD7 }, // 0110 1011 1 + { 1216, 9, 0xD8 }, // 0110 1100 0 + { 1280, 9, 0xD9 }, // 0110 1100 1 + { 1344, 9, 0xDA }, // 0110 1101 0 + { 1408, 9, 0xDB }, // 0110 1101 1 + { 1472, 9, 0x98 }, // 0100 1100 0 + { 1536, 9, 0x99 }, // 0100 1100 1 + { 1600, 9, 0x9A }, // 0100 1101 0 + { 1664, 6, 0x18 }, // 0110 00 + { 1728, 9, 0x9B }, // 0100 1101 1 + { 1792, 11, 0x8 }, // 0000 0001 000 + { 1856, 11, 0xC }, // 0000 0001 100 + { 1920, 11, 0xD }, // 0000 0001 101 + { 1984, 12, 0x12 }, // 0000 0001 0010 + { 2048, 12, 0x13 }, // 0000 0001 0011 + { 2112, 12, 0x14 }, // 0000 0001 0100 + { 2176, 12, 0x15 }, // 0000 0001 0101 + { 2240, 12, 0x16 }, // 0000 0001 0110 + { 2304, 12, 0x17 }, // 0000 0001 0111 + { 2368, 12, 0x1C }, // 0000 0001 1100 + { 2432, 12, 0x1D }, // 0000 0001 1101 + { 2496, 12, 0x1E }, // 0000 0001 1110 + { 2560, 12, 0x1F } // 0000 0001 1111 +}; + +static const PixelCode BlackPixelCodes[] = +{ + { 0, 10, 0x37 }, // 0000 1101 11 + { 1, 3, 0x2 }, // 010 + { 2, 2, 0x3 }, // 11 + { 3, 2, 0x2 }, // 10 + { 4, 3, 0x3 }, // 011 + { 5, 4, 0x3 }, // 0011 + { 6, 4, 0x2 }, // 0010 + { 7, 5, 0x3 }, // 0001 1 + { 8, 6, 0x5 }, // 0001 01 + { 9, 6, 0x4 }, // 0001 00 + { 10, 7, 0x4 }, // 0000 100 + { 11, 7, 0x5 }, // 0000 101 + { 12, 7, 0x7 }, // 0000 111 + { 13, 8, 0x4 }, // 0000 0100 + { 14, 8, 0x7 }, // 0000 0111 + { 15, 9, 0x18 }, // 0000 1100 0 + { 16, 10, 0x17 }, // 0000 0101 11 + { 17, 10, 0x18 }, // 0000 0110 00 + { 18, 10, 0x8 }, // 0000 0010 00 + { 19, 11, 0x67 }, // 0000 1100 111 + { 20, 11, 0x68 }, // 0000 1101 000 + { 21, 11, 0x6C }, // 0000 1101 100 + { 22, 11, 0x37 }, // 0000 0110 111 + { 23, 11, 0x28 }, // 0000 0101 000 + { 24, 11, 0x17 }, // 0000 0010 111 + { 25, 11, 0x18 }, // 0000 0011 000 + { 26, 12, 0xCA }, // 0000 1100 1010 + { 27, 12, 0xCB }, // 0000 1100 1011 + { 28, 12, 0xCC }, // 0000 1100 1100 + { 29, 12, 0xCD }, // 0000 1100 1101 + { 30, 12, 0x68 }, // 0000 0110 1000 + { 31, 12, 0x69 }, // 0000 0110 1001 + { 32, 12, 0x6A }, // 0000 0110 1010 + { 33, 12, 0x6B }, // 0000 0110 1011 + { 34, 12, 0xD2 }, // 0000 1101 0010 + { 35, 12, 0xD3 }, // 0000 1101 0011 + { 36, 12, 0xD4 }, // 0000 1101 0100 + { 37, 12, 0xD5 }, // 0000 1101 0101 + { 38, 12, 0xD6 }, // 0000 1101 0110 + { 39, 12, 0xD7 }, // 0000 1101 0111 + { 40, 12, 0x6C }, // 0000 0110 1100 + { 41, 12, 0x6D }, // 0000 0110 1101 + { 42, 12, 0xDA }, // 0000 1101 1010 + { 43, 12, 0xDB }, // 0000 1101 1011 + { 44, 12, 0x54 }, // 0000 0101 0100 + { 45, 12, 0x55 }, // 0000 0101 0101 + { 46, 12, 0x56 }, // 0000 0101 0110 + { 47, 12, 0x57 }, // 0000 0101 0111 + { 48, 12, 0x64 }, // 0000 0110 0100 + { 49, 12, 0x65 }, // 0000 0110 0101 + { 50, 12, 0x52 }, // 0000 0101 0010 + { 51, 12, 0x53 }, // 0000 0101 0011 + { 52, 12, 0x24 }, // 0000 0010 0100 + { 53, 12, 0x37 }, // 0000 0011 0111 + { 54, 12, 0x38 }, // 0000 0011 1000 + { 55, 12, 0x27 }, // 0000 0010 0111 + { 56, 12, 0x28 }, // 0000 0010 1000 + { 57, 12, 0x58 }, // 0000 0101 1000 + { 58, 12, 0x59 }, // 0000 0101 1001 + { 59, 12, 0x2B }, // 0000 0010 1011 + { 60, 12, 0x2C }, // 0000 0010 1100 + { 61, 12, 0x5A }, // 0000 0101 1010 + { 62, 12, 0x66 }, // 0000 0110 0110 + { 63, 12, 0x67 }, // 0000 0110 0111 + { 64, 10, 0xF }, // 0000 0011 11 + { 128, 12, 0xC8 }, // 0000 1100 1000 + { 192, 12, 0xC9 }, // 0000 1100 1001 + { 256, 12, 0x5B }, // 0000 0101 1011 + { 320, 12, 0x33 }, // 0000 0011 0011 + { 384, 12, 0x34 }, // 0000 0011 0100 + { 448, 12, 0x35 }, // 0000 0011 0101 + { 512, 13, 0x6C }, // 0000 0011 0110 0 + { 576, 13, 0x6D }, // 0000 0011 0110 1 + { 640, 13, 0x4A }, // 0000 0010 0101 0 + { 704, 13, 0x4B }, // 0000 0010 0101 1 + { 768, 13, 0x4C }, // 0000 0010 0110 0 + { 832, 13, 0x4D }, // 0000 0010 0110 1 + { 896, 13, 0x72 }, // 0000 0011 1001 0 + { 960, 13, 0x73 }, // 0000 0011 1001 1 + { 1024, 13, 0x74 }, // 0000 0011 1010 0 + { 1088, 13, 0x75 }, // 0000 0011 1010 1 + { 1152, 13, 0x76 }, // 0000 0011 1011 0 + { 1216, 13, 0x77 }, // 0000 0011 1011 1 + { 1280, 13, 0x52 }, // 0000 0010 1001 0 + { 1344, 13, 0x53 }, // 0000 0010 1001 1 + { 1408, 13, 0x54 }, // 0000 0010 1010 0 + { 1472, 13, 0x55 }, // 0000 0010 1010 1 + { 1536, 13, 0x5A }, // 0000 0010 1101 0 + { 1600, 13, 0x5B }, // 0000 0010 1101 1 + { 1664, 13, 0x64 }, // 0000 0011 0010 0 + { 1728, 13, 0x65 }, // 0000 0011 0010 1 + { 1792, 11, 0x8 }, // 0000 0001 000 + { 1856, 11, 0xC }, // 0000 0001 100 + { 1920, 11, 0xD }, // 0000 0001 101 + { 1984, 12, 0x12 }, // 0000 0001 0010 + { 2048, 12, 0x13 }, // 0000 0001 0011 + { 2112, 12, 0x14 }, // 0000 0001 0100 + { 2176, 12, 0x15 }, // 0000 0001 0101 + { 2240, 12, 0x16 }, // 0000 0001 0110 + { 2304, 12, 0x17 }, // 0000 0001 0111 + { 2368, 12, 0x1C }, // 0000 0001 1100 + { 2432, 12, 0x1D }, // 0000 0001 1101 + { 2496, 12, 0x1E }, // 0000 0001 1110 + { 2560, 12, 0x1F } // 0000 0001 1111 +}; + + +void PDFWriterImpl::putG4Span( long i_nSpan, bool i_bWhitePixel, BitStreamState& io_rState ) +{ + const PixelCode* pTable = i_bWhitePixel ? WhitePixelCodes : BlackPixelCodes; + // maximum encoded span is 2560 consecutive pixels + while( i_nSpan > 2623 ) + { + // write 2560 bits, that is entry (63 + (2560 >> 6)) == 103 in the appropriate table + putG4Bits( pTable[103].mnCodeBits, pTable[103].mnCode, io_rState ); + i_nSpan -= pTable[103].mnEncodedPixels; + } + // write multiples of 64 pixels up to 2560 + if( i_nSpan > 63 ) + { + sal_uInt32 nTabIndex = 63 + (i_nSpan >> 6); + OSL_ASSERT( pTable[nTabIndex].mnEncodedPixels == static_cast<sal_uInt32>(64*(i_nSpan >> 6)) ); + putG4Bits( pTable[nTabIndex].mnCodeBits, pTable[nTabIndex].mnCode, io_rState ); + i_nSpan -= pTable[nTabIndex].mnEncodedPixels; + } + putG4Bits( pTable[i_nSpan].mnCodeBits, pTable[i_nSpan].mnCode, io_rState ); +} + +void PDFWriterImpl::writeG4Stream( BitmapReadAccess* i_pBitmap ) +{ + long nW = i_pBitmap->Width(); + long nH = i_pBitmap->Height(); + if( nW <= 0 || nH <= 0 ) + return; + if( i_pBitmap->GetBitCount() != 1 ) + return; + + BitStreamState aBitState; + + // the first reference line is virtual and completely empty + const Scanline pFirstRefLine = (Scanline)rtl_allocateZeroMemory( nW/8 + 1 ); + Scanline pRefLine = pFirstRefLine; + for( long nY = 0; nY < nH; nY++ ) + { + const Scanline pCurLine = i_pBitmap->GetScanline( nY ); + long nLineIndex = 0; + bool bRunSet = (*pCurLine & 0x80) ? true : false; + bool bRefSet = (*pRefLine & 0x80) ? true : false; + long nRunIndex1 = bRunSet ? 0 : findBitRun( pCurLine, 0, nW, bRunSet ); + long nRefIndex1 = bRefSet ? 0 : findBitRun( pRefLine, 0, nW, bRefSet ); + for( ; nLineIndex < nW; ) + { + long nRefIndex2 = findBitRun( pRefLine, nRefIndex1, nW, isSet( pRefLine, nRefIndex1 ) ); + if( nRefIndex2 >= nRunIndex1 ) + { + long nDiff = nRefIndex1 - nRunIndex1; + if( -3 <= nDiff && nDiff <= 3 ) + { // vertical coding + static const struct + { + sal_uInt32 mnCodeBits; + sal_uInt32 mnCode; + } VerticalCodes[7] = { + { 7, 0x03 }, // 0000 011 + { 6, 0x03 }, // 0000 11 + { 3, 0x03 }, // 011 + { 1, 0x1 }, // 1 + { 3, 0x2 }, // 010 + { 6, 0x02 }, // 0000 10 + { 7, 0x02 } // 0000 010 + }; + // convert to index + nDiff += 3; + + // emit diff code + putG4Bits( VerticalCodes[nDiff].mnCodeBits, VerticalCodes[nDiff].mnCode, aBitState ); + nLineIndex = nRunIndex1; + } + else + { // difference too large, horizontal coding + // emit horz code 001 + putG4Bits( 3, 0x1, aBitState ); + long nRunIndex2 = findBitRun( pCurLine, nRunIndex1, nW, isSet( pCurLine, nRunIndex1 ) ); + bool bWhiteFirst = ( nLineIndex + nRunIndex1 == 0 || ! isSet( pCurLine, nLineIndex ) ); + putG4Span( nRunIndex1 - nLineIndex, bWhiteFirst, aBitState ); + putG4Span( nRunIndex2 - nRunIndex1, ! bWhiteFirst, aBitState ); + nLineIndex = nRunIndex2; + } + } + else + { // emit pass code 0001 + putG4Bits( 4, 0x1, aBitState ); + nLineIndex = nRefIndex2; + } + if( nLineIndex < nW ) + { + bool bSet = isSet( pCurLine, nLineIndex ); + nRunIndex1 = findBitRun( pCurLine, nLineIndex, nW, bSet ); + nRefIndex1 = findBitRun( pRefLine, nLineIndex, nW, ! bSet ); + nRefIndex1 = findBitRun( pRefLine, nRefIndex1, nW, bSet ); + } + } + + // the current line is the reference for the next line + pRefLine = pCurLine; + } + // terminate strip with EOFB + putG4Bits( 12, 1, aBitState ); + putG4Bits( 12, 1, aBitState ); + if( aBitState.mnNextBitPos != 8 ) + { + writeBuffer( aBitState.getByte(), 1 ); + aBitState.flush(); + } + + rtl_freeMemory( pFirstRefLine ); +} diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index 94605be2686d..66e3cd1bea1a 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -73,7 +73,7 @@ namespace vcl // ------------------------------------------------------------------------------ -static const BYTE mpDefaultColorTable[ 256 ] = +static const sal_uInt8 mpDefaultColorTable[ 256 ] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, @@ -112,11 +112,11 @@ private: AlphaMask* mpAlphaMask; BitmapWriteAccess* mpMaskAcc; ZCodec* mpZCodec; - BYTE* mpInflateInBuf; // as big as the size of a scanline + alphachannel + 1 - BYTE* mpScanPrior; // pointer to the latest scanline - BYTE* mpTransTab; // for transparency in images with palette colortype - BYTE* mpScanCurrent; // pointer into the current scanline - BYTE* mpColorTable; // + sal_uInt8* mpInflateInBuf; // as big as the size of a scanline + alphachannel + 1 + sal_uInt8* mpScanPrior; // pointer to the latest scanline + sal_uInt8* mpTransTab; // for transparency in images with palette colortype + sal_uInt8* mpScanCurrent; // pointer into the current scanline + sal_uInt8* mpColorTable; // sal_Size mnStreamSize; // estimate of PNG file size sal_uInt32 mnChunkType; // Type of current PNG chunk sal_Int32 mnChunkLen; // Length of current PNG chunk @@ -132,48 +132,48 @@ private: sal_uInt32 mnYAdd; // the increment for input images Y coords for the current pass int mnPreviewShift; // shift to convert orig image coords into preview image coords int mnPreviewMask; // == ((1 << mnPreviewShift) - 1) - USHORT mnIStmOldMode; - USHORT mnTargetDepth; // pixel depth of target bitmap - BYTE mnTransRed; - BYTE mnTransGreen; - BYTE mnTransBlue; - BYTE mnPngDepth; // pixel depth of PNG data - BYTE mnColorType; - BYTE mnCompressionType; - BYTE mnFilterType; - BYTE mnInterlaceType; + sal_uInt16 mnIStmOldMode; + sal_uInt16 mnTargetDepth; // pixel depth of target bitmap + sal_uInt8 mnTransRed; + sal_uInt8 mnTransGreen; + sal_uInt8 mnTransBlue; + sal_uInt8 mnPngDepth; // pixel depth of PNG data + sal_uInt8 mnColorType; + sal_uInt8 mnCompressionType; + sal_uInt8 mnFilterType; + sal_uInt8 mnInterlaceType; BitmapColor mcTranspColor; // transparency mask's transparency "color" BitmapColor mcOpaqueColor; // transparency mask's opaque "color" - BOOL mbTransparent; // graphic includes an tRNS Chunk or an alpha Channel - BOOL mbAlphaChannel; // is true for ColorType 4 and 6 - BOOL mbRGBTriple; - BOOL mbPalette; // FALSE if we need a Palette - BOOL mbGrayScale; - BOOL mbzCodecInUse; - BOOL mbStatus; - BOOL mbIDAT; // TRUE if finished with enough IDAT chunks - BOOL mbGamma; // TRUE if Gamma Correction available - BOOL mbpHYs; // TRUE if pysical size of pixel available + sal_Bool mbTransparent; // graphic includes an tRNS Chunk or an alpha Channel + sal_Bool mbAlphaChannel; // is true for ColorType 4 and 6 + sal_Bool mbRGBTriple; + sal_Bool mbPalette; // sal_False if we need a Palette + sal_Bool mbGrayScale; + sal_Bool mbzCodecInUse; + sal_Bool mbStatus; + sal_Bool mbIDAT; // sal_True if finished with enough IDAT chunks + sal_Bool mbGamma; // sal_True if Gamma Correction available + sal_Bool mbpHYs; // sal_True if pysical size of pixel available sal_Bool mbIgnoreGammaChunk; bool ReadNextChunk(); void ReadRemainingChunks(); void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, const BitmapColor & ); - void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, BYTE nPalIndex ); - void ImplSetTranspPixel( sal_uInt32 y, sal_uInt32 x, const BitmapColor &, BOOL bTrans ); - void ImplSetAlphaPixel( sal_uInt32 y, sal_uInt32 x, BYTE nPalIndex, BYTE nAlpha ); - void ImplSetAlphaPixel( sal_uInt32 y, sal_uInt32 x, const BitmapColor&, BYTE nAlpha ); + void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, sal_uInt8 nPalIndex ); + void ImplSetTranspPixel( sal_uInt32 y, sal_uInt32 x, const BitmapColor &, sal_Bool bTrans ); + void ImplSetAlphaPixel( sal_uInt32 y, sal_uInt32 x, sal_uInt8 nPalIndex, sal_uInt8 nAlpha ); + void ImplSetAlphaPixel( sal_uInt32 y, sal_uInt32 x, const BitmapColor&, sal_uInt8 nAlpha ); void ImplReadIDAT(); bool ImplPreparePass(); void ImplApplyFilter(); void ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ); - BOOL ImplReadTransparent(); + sal_Bool ImplReadTransparent(); void ImplGetGamma(); void ImplGetBackground(); - BYTE ImplScaleColor(); - BOOL ImplReadHeader( const Size& rPreviewSizeHint ); - BOOL ImplReadPalette(); + sal_uInt8 ImplScaleColor(); + sal_Bool ImplReadHeader( const Size& rPreviewSizeHint ); + sal_Bool ImplReadPalette(); void ImplGetGrayPalette( sal_uInt16 ); sal_uInt32 ImplReadsal_uInt32(); @@ -204,8 +204,8 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream ) mpColorTable ( (sal_uInt8*) mpDefaultColorTable ), mnPass ( 0 ), mbzCodecInUse ( sal_False ), - mbStatus( TRUE), - mbIDAT( FALSE ), + mbStatus( sal_True), + mbIDAT( sal_False ), mbGamma ( sal_False ), mbpHYs ( sal_False ), mbIgnoreGammaChunk ( sal_False ) @@ -361,7 +361,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint ) case PNGCHUNK_gAMA : // the gamma chunk must precede { // the 'IDAT' and also the 'PLTE'(if available ) - if ( !mbIgnoreGammaChunk && ( mbIDAT == FALSE ) ) + if ( !mbIgnoreGammaChunk && ( mbIDAT == sal_False ) ) ImplGetGamma(); } break; @@ -382,7 +382,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint ) case PNGCHUNK_bKGD : // the background chunk must appear { - if ( ( mbIDAT == FALSE ) && mbPalette ) // before the 'IDAT' and after the + if ( ( mbIDAT == sal_False ) && mbPalette ) // before the 'IDAT' and after the ImplGetBackground(); // PLTE(if available ) chunk. } break; @@ -390,7 +390,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint ) case PNGCHUNK_IDAT : { if ( !mpInflateInBuf ) // taking care that the header has properly been read - mbStatus = FALSE; + mbStatus = sal_False; else if ( !mbIDAT ) // the gfx is finished, but there may be left a zlibCRC of about 4Bytes ImplReadIDAT(); } @@ -463,27 +463,27 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint ) // ------------------------------------------------------------------------ -BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) +sal_Bool PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) { if( mnChunkLen < 13 ) - return FALSE; + return sal_False; maOrigSize.Width() = ImplReadsal_uInt32(); maOrigSize.Height() = ImplReadsal_uInt32(); if ( !maOrigSize.Width() || !maOrigSize.Height() ) - return FALSE; + return sal_False; mnPngDepth = *(maDataIter++); mnColorType = *(maDataIter++); mnCompressionType = *(maDataIter++); if( mnCompressionType != 0 ) // unknown compression type - return FALSE; + return sal_False; mnFilterType = *(maDataIter++); if( mnFilterType != 0 ) // unknown filter type - return FALSE; + return sal_False; mnInterlaceType = *(maDataIter++); switch ( mnInterlaceType ) // filter type valid ? @@ -495,12 +495,12 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) mnPass = 0; break; default: - return FALSE; + return sal_False; } - mbPalette = TRUE; - mbIDAT = mbAlphaChannel = mbTransparent = FALSE; - mbGrayScale = mbRGBTriple = FALSE; + mbPalette = sal_True; + mbIDAT = mbAlphaChannel = mbTransparent = sal_False; + mbGrayScale = mbRGBTriple = sal_False; mnTargetDepth = mnPngDepth; sal_uInt64 nScansize64 = ( ( static_cast< sal_uInt64 >( maOrigSize.Width() ) * mnPngDepth ) + 7 ) >> 3; @@ -513,7 +513,7 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) { case 2 : // 2bit target not available -> use four bits mnTargetDepth = 4; // we have to expand the bitmap - mbGrayScale = TRUE; + mbGrayScale = sal_True; break; case 16 : mnTargetDepth = 8; // we have to reduce the bitmap @@ -521,17 +521,17 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) case 1 : case 4 : case 8 : - mbGrayScale = TRUE; + mbGrayScale = sal_True; break; default : - return FALSE; + return sal_False; } } break; case 2 : // each pixel is an RGB triple { - mbRGBTriple = TRUE; + mbRGBTriple = sal_True; nScansize64 *= 3; switch ( mnPngDepth ) { @@ -540,7 +540,7 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) mnTargetDepth = 24; break; default : - return FALSE; + return sal_False; } } break; @@ -555,10 +555,10 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) case 1 : case 4 : case 8 : - mbPalette = FALSE; + mbPalette = sal_False; break; default : - return FALSE; + return sal_False; } } break; @@ -566,25 +566,25 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) case 4 : // each pixel is a grayscale sample followed by an alpha sample { nScansize64 *= 2; - mbAlphaChannel = TRUE; + mbAlphaChannel = sal_True; switch ( mnPngDepth ) { case 16 : mnTargetDepth = 8; // we have to reduce the bitmap case 8 : - mbGrayScale = TRUE; + mbGrayScale = sal_True; break; default : - return FALSE; + return sal_False; } } break; case 6 : // each pixel is an RGB triple followed by an alpha sample { - mbRGBTriple = TRUE; + mbRGBTriple = sal_True; nScansize64 *= 4; - mbAlphaChannel = TRUE; + mbAlphaChannel = sal_True; switch (mnPngDepth ) { case 16 : // we have to reduce the bitmap @@ -592,13 +592,13 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) mnTargetDepth = 24; break; default : - return FALSE; + return sal_False; } } break; default : - return FALSE; + return sal_False; } mnBPP = static_cast< sal_uInt32 >( nScansize64 / maOrigSize.Width() ); @@ -608,17 +608,17 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) nScansize64++; // each scanline includes one filterbyte if ( nScansize64 > SAL_MAX_UINT32 ) - return FALSE; + return sal_False; mnScansize = static_cast< sal_uInt32 >( nScansize64 ); // TODO: switch between both scanlines instead of copying - mpInflateInBuf = new (std::nothrow) BYTE[ mnScansize ]; + mpInflateInBuf = new (std::nothrow) sal_uInt8[ mnScansize ]; mpScanCurrent = mpInflateInBuf; - mpScanPrior = new (std::nothrow) BYTE[ mnScansize ]; + mpScanPrior = new (std::nothrow) sal_uInt8[ mnScansize ]; if ( !mpInflateInBuf || !mpScanPrior ) - return FALSE; + return sal_False; // calculate target size from original size and the preview hint if( rPreviewSizeHint.Width() || rPreviewSizeHint.Height() ) @@ -657,7 +657,7 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) mpBmp = new Bitmap( maTargetSize, mnTargetDepth ); mpAcc = mpBmp->AcquireWriteAccess(); if( !mpAcc ) - return FALSE; + return sal_False; mpBmp->SetSourceSizePixel( maOrigSize ); @@ -667,7 +667,7 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) mpAlphaMask->Erase( 128 ); mpMaskAcc = mpAlphaMask->AcquireWriteAccess(); if( !mpMaskAcc ) - return FALSE; + return sal_False; } if ( mbGrayScale ) @@ -675,7 +675,7 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) ImplPreparePass(); - return TRUE; + return sal_True; } // ------------------------------------------------------------------------ @@ -695,38 +695,38 @@ void PNGReaderImpl::ImplGetGrayPalette( sal_uInt16 nBitDepth ) mpAcc->SetPaletteEntryCount( nPaletteEntryCount ); for ( sal_uInt32 i = 0, nStart = 0; nStart < 256; i++, nStart += nAdd ) - mpAcc->SetPaletteColor( (USHORT)i, BitmapColor( mpColorTable[ nStart ], + mpAcc->SetPaletteColor( (sal_uInt16)i, BitmapColor( mpColorTable[ nStart ], mpColorTable[ nStart ], mpColorTable[ nStart ] ) ); } // ------------------------------------------------------------------------ -BOOL PNGReaderImpl::ImplReadPalette() +sal_Bool PNGReaderImpl::ImplReadPalette() { sal_uInt16 nCount = static_cast<sal_uInt16>( mnChunkLen / 3 ); if ( ( ( mnChunkLen % 3 ) == 0 ) && ( ( 0 < nCount ) && ( nCount <= 256 ) ) && mpAcc ) { - mbPalette = TRUE; - mpAcc->SetPaletteEntryCount( (USHORT) nCount ); + mbPalette = sal_True; + mpAcc->SetPaletteEntryCount( (sal_uInt16) nCount ); for ( sal_uInt16 i = 0; i < nCount; i++ ) { - BYTE nRed = mpColorTable[ *maDataIter++ ]; - BYTE nGreen = mpColorTable[ *maDataIter++ ]; - BYTE nBlue = mpColorTable[ *maDataIter++ ]; + sal_uInt8 nRed = mpColorTable[ *maDataIter++ ]; + sal_uInt8 nGreen = mpColorTable[ *maDataIter++ ]; + sal_uInt8 nBlue = mpColorTable[ *maDataIter++ ]; mpAcc->SetPaletteColor( i, Color( nRed, nGreen, nBlue ) ); } } else - mbStatus = FALSE; + mbStatus = sal_False; return mbStatus; } // ------------------------------------------------------------------------ -BOOL PNGReaderImpl::ImplReadTransparent() +sal_Bool PNGReaderImpl::ImplReadTransparent() { bool bNeedAlpha = false; @@ -765,7 +765,7 @@ BOOL PNGReaderImpl::ImplReadTransparent() { if ( mnChunkLen <= 256 ) { - mpTransTab = new BYTE [ 256 ]; + mpTransTab = new sal_uInt8 [ 256 ]; rtl_fillMemory( mpTransTab, 256, 0xff ); rtl_copyMemory( mpTransTab, &(*maDataIter), mnChunkLen ); maDataIter += mnChunkLen; @@ -793,13 +793,13 @@ BOOL PNGReaderImpl::ImplReadTransparent() } mbTransparent = (mpMaskAcc != NULL); if( !mbTransparent ) - return FALSE; + return sal_False; mcOpaqueColor = BitmapColor( 0x00 ); mcTranspColor = BitmapColor( 0xFF ); mpMaskAcc->Erase( 0x00 ); } - return TRUE; + return sal_True; } // ------------------------------------------------------------------------ @@ -815,7 +815,7 @@ void PNGReaderImpl::ImplGetGamma() if ( fInvGamma != 1.0 ) { - mbGamma = TRUE; + mbGamma = sal_True; if ( mpColorTable == mpDefaultColorTable ) mpColorTable = new sal_uInt8[ 256 ]; @@ -838,10 +838,10 @@ void PNGReaderImpl::ImplGetBackground() { if ( mnChunkLen == 1 ) { - UINT16 nCol = *maDataIter++; + sal_uInt16 nCol = *maDataIter++; if ( nCol < mpAcc->GetPaletteEntryCount() ) { - mpAcc->Erase( mpAcc->GetPaletteColor( (BYTE)nCol ) ); + mpAcc->Erase( mpAcc->GetPaletteColor( (sal_uInt8)nCol ) ); break; } } @@ -900,9 +900,9 @@ void PNGReaderImpl::ImplReadIDAT() { if( mnChunkLen > 0 ) { - if ( mbzCodecInUse == FALSE ) + if ( mbzCodecInUse == sal_False ) { - mbzCodecInUse = TRUE; + mbzCodecInUse = sal_True; mpZCodec->BeginCompression( ZCODEC_PNG_DEFAULT ); } mpZCodec->SetBreak( mnChunkLen ); @@ -915,7 +915,7 @@ void PNGReaderImpl::ImplReadIDAT() sal_Int32 nRead = mpZCodec->ReadAsynchron( aIStrm, mpScanCurrent, nToRead ); if ( nRead < 0 ) { - mbStatus = FALSE; + mbStatus = sal_False; break; } if ( nRead < nToRead ) @@ -946,7 +946,7 @@ void PNGReaderImpl::ImplReadIDAT() if( mbIDAT ) { mpZCodec->EndCompression(); - mbzCodecInUse = FALSE; + mbzCodecInUse = sal_False; } } @@ -1021,9 +1021,9 @@ bool PNGReaderImpl::ImplPreparePass() void PNGReaderImpl::ImplApplyFilter() { OSL_ASSERT( mnScansize >= mnBPP + 1 ); - const BYTE* const pScanEnd = mpInflateInBuf + mnScansize; + const sal_uInt8* const pScanEnd = mpInflateInBuf + mnScansize; - BYTE nFilterType = *mpInflateInBuf; // the filter type may change each scanline + sal_uInt8 nFilterType = *mpInflateInBuf; // the filter type may change each scanline switch ( nFilterType ) { default: // unknown Scanline Filter Type @@ -1033,26 +1033,26 @@ void PNGReaderImpl::ImplApplyFilter() case 1: // Scanline Filter Type "Sub" { - BYTE* p1 = mpInflateInBuf + 1; - const BYTE* p2 = p1; + sal_uInt8* p1 = mpInflateInBuf + 1; + const sal_uInt8* p2 = p1; p1 += mnBPP; // use left pixels do - *p1 = static_cast<BYTE>( *p1 + *(p2++) ); + *p1 = static_cast<sal_uInt8>( *p1 + *(p2++) ); while( ++p1 < pScanEnd ); } break; case 2: // Scanline Filter Type "Up" { - BYTE* p1 = mpInflateInBuf + 1; - const BYTE* p2 = mpScanPrior + 1; + sal_uInt8* p1 = mpInflateInBuf + 1; + const sal_uInt8* p2 = mpScanPrior + 1; // use pixels from prior line while( p1 < pScanEnd ) { - *p1 = static_cast<BYTE>( *p1 + *(p2++) ); + *p1 = static_cast<sal_uInt8>( *p1 + *(p2++) ); ++p1; } } @@ -1060,18 +1060,18 @@ void PNGReaderImpl::ImplApplyFilter() case 3: // Scanline Filter Type "Average" { - BYTE* p1 = mpInflateInBuf + 1; - const BYTE* p2 = mpScanPrior + 1; - const BYTE* p3 = p1; + sal_uInt8* p1 = mpInflateInBuf + 1; + const sal_uInt8* p2 = mpScanPrior + 1; + const sal_uInt8* p3 = p1; // use one pixel from prior line for( int n = mnBPP; --n >= 0; ++p1, ++p2) - *p1 = static_cast<BYTE>( *p1 + (*p2 >> 1) ); + *p1 = static_cast<sal_uInt8>( *p1 + (*p2 >> 1) ); // predict by averaging the left and prior line pixels while( p1 < pScanEnd ) { - *p1 = static_cast<BYTE>( *p1 + ((*(p2++) + *(p3++)) >> 1) ); + *p1 = static_cast<sal_uInt8>( *p1 + ((*(p2++) + *(p3++)) >> 1) ); ++p1; } } @@ -1079,14 +1079,14 @@ void PNGReaderImpl::ImplApplyFilter() case 4: // Scanline Filter Type "PaethPredictor" { - BYTE* p1 = mpInflateInBuf + 1; - const BYTE* p2 = mpScanPrior + 1; - const BYTE* p3 = p1; - const BYTE* p4 = p2; + sal_uInt8* p1 = mpInflateInBuf + 1; + const sal_uInt8* p2 = mpScanPrior + 1; + const sal_uInt8* p3 = p1; + const sal_uInt8* p4 = p2; // use one pixel from prior line for( int n = mnBPP; --n >= 0; ++p1) - *p1 = static_cast<BYTE>( *p1 + *(p2++) ); + *p1 = static_cast<sal_uInt8>( *p1 + *(p2++) ); // predict by using the left and the prior line pixels while( p1 < pScanEnd ) @@ -1111,7 +1111,7 @@ void PNGReaderImpl::ImplApplyFilter() if( npa > npc ) na = nc; - *p1 = static_cast<BYTE>( *p1 + na ); + *p1 = static_cast<sal_uInt8>( *p1 + na ); ++p1; } } @@ -1137,7 +1137,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) // => TODO; also do this for nX here instead of in the ImplSet*Pixel() methods const sal_uInt32 nY = mnYpos >> mnPreviewShift; - const BYTE* pTmp = mpInflateInBuf + 1; + const sal_uInt8* pTmp = mpInflateInBuf + 1; if ( mpAcc->HasPalette() ) // alphachannel is not allowed by pictures including palette entries { switch ( mpAcc->GetBitCount() ) @@ -1148,12 +1148,12 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) { for ( sal_Int32 nX = nXStart, nShift = 0; nX < maOrigSize.Width(); nX += nXAdd ) { - BYTE nCol; + sal_uInt8 nCol; nShift = (nShift - 1) & 7; if ( nShift == 0 ) nCol = *(pTmp++); else - nCol = static_cast<BYTE>( *pTmp >> nShift ); + nCol = static_cast<sal_uInt8>( *pTmp >> nShift ); nCol &= 1; ImplSetAlphaPixel( nY, nX, nCol, mpTransTab[ nCol ] ); @@ -1165,11 +1165,11 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) { nShift = (nShift - 1) & 7; - BYTE nCol; + sal_uInt8 nCol; if ( nShift == 0 ) nCol = *(pTmp++); else - nCol = static_cast<BYTE>( *pTmp >> nShift ); + nCol = static_cast<sal_uInt8>( *pTmp >> nShift ); nCol &= 1; ImplSetPixel( nY, nX, nCol ); @@ -1201,7 +1201,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) { for ( sal_Int32 nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, nXIndex++ ) { - BYTE nCol; + sal_uInt8 nCol; switch( nXIndex & 3 ) { case 0 : @@ -1323,7 +1323,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) break; default : - mbStatus = FALSE; + mbStatus = sal_False; break; } } @@ -1449,7 +1449,7 @@ void PNGReaderImpl::ImplSetPixel( sal_uInt32 nY, sal_uInt32 nX, const BitmapColo // ------------------------------------------------------------------------ -void PNGReaderImpl::ImplSetPixel( sal_uInt32 nY, sal_uInt32 nX, BYTE nPalIndex ) +void PNGReaderImpl::ImplSetPixel( sal_uInt32 nY, sal_uInt32 nX, sal_uInt8 nPalIndex ) { // TODO: get preview mode checks out of inner loop if( nX & mnPreviewMask ) @@ -1461,7 +1461,7 @@ void PNGReaderImpl::ImplSetPixel( sal_uInt32 nY, sal_uInt32 nX, BYTE nPalIndex ) // ------------------------------------------------------------------------ -void PNGReaderImpl::ImplSetTranspPixel( sal_uInt32 nY, sal_uInt32 nX, const BitmapColor& rBitmapColor, BOOL bTrans ) +void PNGReaderImpl::ImplSetTranspPixel( sal_uInt32 nY, sal_uInt32 nX, const BitmapColor& rBitmapColor, sal_Bool bTrans ) { // TODO: get preview mode checks out of inner loop if( nX & mnPreviewMask ) @@ -1479,7 +1479,7 @@ void PNGReaderImpl::ImplSetTranspPixel( sal_uInt32 nY, sal_uInt32 nX, const Bitm // ------------------------------------------------------------------------ void PNGReaderImpl::ImplSetAlphaPixel( sal_uInt32 nY, sal_uInt32 nX, - BYTE nPalIndex, BYTE nAlpha ) + sal_uInt8 nPalIndex, sal_uInt8 nAlpha ) { // TODO: get preview mode checks out of inner loop if( nX & mnPreviewMask ) @@ -1493,7 +1493,7 @@ void PNGReaderImpl::ImplSetAlphaPixel( sal_uInt32 nY, sal_uInt32 nX, // ------------------------------------------------------------------------ void PNGReaderImpl::ImplSetAlphaPixel( sal_uInt32 nY, sal_uInt32 nX, - const BitmapColor& rBitmapColor, BYTE nAlpha ) + const BitmapColor& rBitmapColor, sal_uInt8 nAlpha ) { // TODO: get preview mode checks out of inner loop if( nX & mnPreviewMask ) diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx index 6cacfe51aed2..b87457c35054 100644 --- a/vcl/source/gdi/pngwrite.cxx +++ b/vcl/source/gdi/pngwrite.cxx @@ -89,35 +89,35 @@ private: sal_Int32 mnCompLevel; sal_Int32 mnInterlaced; sal_uInt32 mnMaxChunkSize; - BOOL mbStatus; + sal_Bool mbStatus; BitmapReadAccess* mpAccess; BitmapReadAccess* mpMaskAccess; ZCodec* mpZCodec; - BYTE* mpDeflateInBuf; // as big as the size of a scanline + alphachannel + 1 - BYTE* mpPreviousScan; // as big as mpDeflateInBuf - BYTE* mpCurrentScan; - ULONG mnDeflateInSize; - - ULONG mnWidth, mnHeight; - BYTE mnBitsPerPixel; - BYTE mnFilterType; // 0 oder 4; - ULONG mnBBP; // bytes per pixel ( needed for filtering ) - BOOL mbTrueAlpha; - ULONG mnCRC; + sal_uInt8* mpDeflateInBuf; // as big as the size of a scanline + alphachannel + 1 + sal_uInt8* mpPreviousScan; // as big as mpDeflateInBuf + sal_uInt8* mpCurrentScan; + sal_uLong mnDeflateInSize; + + sal_uLong mnWidth, mnHeight; + sal_uInt8 mnBitsPerPixel; + sal_uInt8 mnFilterType; // 0 oder 4; + sal_uLong mnBBP; // bytes per pixel ( needed for filtering ) + sal_Bool mbTrueAlpha; + sal_uLong mnCRC; long mnChunkDatSize; - ULONG mnLastPercent; + sal_uLong mnLastPercent; void ImplWritepHYs( const BitmapEx& rBitmapEx ); void ImplWriteIDAT(); - ULONG ImplGetFilter( ULONG nY, ULONG nXStart=0, ULONG nXAdd=1 ); + sal_uLong ImplGetFilter( sal_uLong nY, sal_uLong nXStart=0, sal_uLong nXAdd=1 ); void ImplClearFirstScanline(); void ImplWriteTransparent(); - BOOL ImplWriteHeader(); + sal_Bool ImplWriteHeader(); void ImplWritePalette(); - void ImplOpenChunk( ULONG nChunkType ); - void ImplWriteChunk( BYTE nNumb ); + void ImplOpenChunk( sal_uLong nChunkType ); + void ImplWriteChunk( sal_uInt8 nNumb ); void ImplWriteChunk( sal_uInt32 nNumb ); void ImplWriteChunk( unsigned char* pSource, sal_uInt32 nDatSize ); void ImplCloseChunk( void ) const; @@ -128,7 +128,7 @@ private: PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ) : mnCompLevel ( PNG_DEF_COMPRESSION ), - mbStatus ( TRUE ), + mbStatus ( sal_True ), mpAccess ( NULL ), mpMaskAccess ( NULL ), mpZCodec ( new ZCodec( DEFAULT_IN_BUFSIZE, DEFAULT_OUT_BUFSIZE, MAX_MEM_USAGE ) ), @@ -161,7 +161,7 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, } } } - mnBitsPerPixel = (BYTE)aBmp.GetBitCount(); + mnBitsPerPixel = (sal_uInt8)aBmp.GetBitCount(); if( rBmpEx.IsTransparent() ) { @@ -189,14 +189,14 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, aBmp.ReleaseAccess( mpAccess ); } else - mbStatus = FALSE; + mbStatus = sal_False; } else { - mpAccess = aBmp.AcquireReadAccess(); // TRUE RGB with alphachannel + mpAccess = aBmp.AcquireReadAccess(); // sal_True RGB with alphachannel if( mpAccess ) { - if ( ( mbTrueAlpha = rBmpEx.IsAlpha() ) != FALSE ) + if ( ( mbTrueAlpha = rBmpEx.IsAlpha() ) != sal_False ) { AlphaMask aMask( rBmpEx.GetAlpha() ); mpMaskAccess = aMask.AcquireReadAccess(); @@ -210,7 +210,7 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, aMask.ReleaseAccess( mpMaskAccess ); } else - mbStatus = FALSE; + mbStatus = sal_False; } else { @@ -226,12 +226,12 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, aMask.ReleaseAccess( mpMaskAccess ); } else - mbStatus = FALSE; + mbStatus = sal_False; } aBmp.ReleaseAccess( mpAccess ); } else - mbStatus = FALSE; + mbStatus = sal_False; } } else @@ -250,7 +250,7 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, aBmp.ReleaseAccess( mpAccess ); } else - mbStatus = FALSE; + mbStatus = sal_False; } if ( mbStatus ) { @@ -309,7 +309,7 @@ std::vector< vcl::PNGWriter::ChunkData >& PNGWriterImpl::GetChunks() // ------------------------------------------------------------------------ -BOOL PNGWriterImpl::ImplWriteHeader() +sal_Bool PNGWriterImpl::ImplWriteHeader() { ImplOpenChunk(PNGCHUNK_IHDR); ImplWriteChunk( sal_uInt32( mnWidth = mpAccess->Width() ) ); @@ -317,13 +317,13 @@ BOOL PNGWriterImpl::ImplWriteHeader() if ( mnWidth && mnHeight && mnBitsPerPixel && mbStatus ) { - BYTE nBitDepth = mnBitsPerPixel; + sal_uInt8 nBitDepth = mnBitsPerPixel; if ( mnBitsPerPixel <= 8 ) mnFilterType = 0; else mnFilterType = 4; - BYTE nColorType = 2; // colortype: + sal_uInt8 nColorType = 2; // colortype: // bit 0 -> palette is used if ( mpAccess->HasPalette() ) // bit 1 -> color is used nColorType |= 1; // bit 2 -> alpha channel is used @@ -335,13 +335,13 @@ BOOL PNGWriterImpl::ImplWriteHeader() ImplWriteChunk( nBitDepth ); ImplWriteChunk( nColorType ); // colortype - ImplWriteChunk((BYTE) 0 ); // compression type - ImplWriteChunk((BYTE) 0 ); // filter type - is not supported in this version - ImplWriteChunk((BYTE) mnInterlaced ); // interlace type + ImplWriteChunk((sal_uInt8) 0 ); // compression type + ImplWriteChunk((sal_uInt8) 0 ); // filter type - is not supported in this version + ImplWriteChunk((sal_uInt8) mnInterlaced ); // interlace type ImplCloseChunk(); } else - mbStatus = FALSE; + mbStatus = sal_False; return mbStatus; } @@ -349,13 +349,13 @@ BOOL PNGWriterImpl::ImplWriteHeader() void PNGWriterImpl::ImplWritePalette() { - const ULONG nCount = mpAccess->GetPaletteEntryCount(); - BYTE* pTempBuf = new BYTE[ nCount*3 ]; - BYTE* pTmp = pTempBuf; + const sal_uLong nCount = mpAccess->GetPaletteEntryCount(); + sal_uInt8* pTempBuf = new sal_uInt8[ nCount*3 ]; + sal_uInt8* pTmp = pTempBuf; ImplOpenChunk( PNGCHUNK_PLTE ); - for ( USHORT i = 0; i < nCount; i++ ) + for ( sal_uInt16 i = 0; i < nCount; i++ ) { const BitmapColor& rColor = mpAccess->GetPaletteColor( i ); *pTmp++ = rColor.GetRed(); @@ -371,12 +371,12 @@ void PNGWriterImpl::ImplWritePalette() void PNGWriterImpl::ImplWriteTransparent () { - const ULONG nTransIndex = mpAccess->GetBestMatchingColor( BMP_COL_TRANS ); + const sal_uLong nTransIndex = mpAccess->GetBestMatchingColor( BMP_COL_TRANS ); ImplOpenChunk( PNGCHUNK_tRNS ); - for ( ULONG n = 0UL; n <= nTransIndex; n++ ) - ImplWriteChunk( ( nTransIndex == n ) ? (BYTE) 0x0 : (BYTE) 0xff ); + for ( sal_uLong n = 0UL; n <= nTransIndex; n++ ) + ImplWriteChunk( ( nTransIndex == n ) ? (sal_uInt8) 0x0 : (sal_uInt8) 0xff ); ImplCloseChunk(); } @@ -415,12 +415,12 @@ void PNGWriterImpl::ImplWriteIDAT () mnDeflateInSize = mnBBP * mnWidth + 1; - mpDeflateInBuf = new BYTE[ mnDeflateInSize ]; + mpDeflateInBuf = new sal_uInt8[ mnDeflateInSize ]; if ( mnFilterType ) // using filter type 4 we need memory for the scanline 3 times { - mpPreviousScan = new BYTE[ mnDeflateInSize ]; - mpCurrentScan = new BYTE[ mnDeflateInSize ]; + mpPreviousScan = new sal_uInt8[ mnDeflateInSize ]; + mpCurrentScan = new sal_uInt8[ mnDeflateInSize ]; ImplClearFirstScanline(); } mpZCodec->BeginCompression( ZCODEC_PNG_DEFAULT + mnCompLevel ); @@ -428,13 +428,13 @@ void PNGWriterImpl::ImplWriteIDAT () SvMemoryStream aOStm; if ( mnInterlaced == 0 ) { - for ( ULONG nY = 0; nY < mnHeight; nY++ ) + for ( sal_uLong nY = 0; nY < mnHeight; nY++ ) mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter( nY ) ); } else { // interlace mode - ULONG nY; + sal_uLong nY; for ( nY = 0; nY < mnHeight; nY+=8 ) // pass 1 mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 8 ) ); ImplClearFirstScanline(); @@ -498,9 +498,9 @@ void PNGWriterImpl::ImplWriteIDAT () // appends to the currently used pass // the complete size of scanline will be returned - in interlace mode zero is possible! -ULONG PNGWriterImpl::ImplGetFilter ( ULONG nY, ULONG nXStart, ULONG nXAdd ) +sal_uLong PNGWriterImpl::ImplGetFilter ( sal_uLong nY, sal_uLong nXStart, sal_uLong nXAdd ) { - BYTE* pDest; + sal_uInt8* pDest; if ( mnFilterType ) pDest = mpCurrentScan; @@ -517,16 +517,16 @@ ULONG PNGWriterImpl::ImplGetFilter ( ULONG nY, ULONG nXStart, ULONG nXAdd ) { case( 1 ): { - ULONG nX, nXIndex; + sal_uLong nX, nXIndex; for ( nX = nXStart, nXIndex = 0; nX < mnWidth; nX+=nXAdd, nXIndex++ ) { - ULONG nShift = ( nXIndex & 7 ) ^ 7; + sal_uLong nShift = ( nXIndex & 7 ) ^ 7; if ( nShift == 7) - *pDest = (BYTE)(mpAccess->GetPixel( nY, nX ) << nShift); + *pDest = (sal_uInt8)(mpAccess->GetPixel( nY, nX ) << nShift); else if ( nShift == 0 ) - *pDest++ |= (BYTE) mpAccess->GetPixel( nY, nX ) << nShift; + *pDest++ |= (sal_uInt8) mpAccess->GetPixel( nY, nX ) << nShift; else - *pDest |= (BYTE) mpAccess->GetPixel( nY, nX ) << nShift; + *pDest |= (sal_uInt8) mpAccess->GetPixel( nY, nX ) << nShift; } if ( ( nXIndex & 7 ) != 0 ) pDest++; // byte is not completely used, so the } // bufferpointer is to correct @@ -534,13 +534,13 @@ ULONG PNGWriterImpl::ImplGetFilter ( ULONG nY, ULONG nXStart, ULONG nXAdd ) case( 4 ): { - ULONG nX, nXIndex; + sal_uLong nX, nXIndex; for ( nX = nXStart, nXIndex = 0; nX < mnWidth; nX+= nXAdd, nXIndex++ ) { if( nXIndex & 1 ) - *pDest++ |= (BYTE) mpAccess->GetPixel( nY, nX ); + *pDest++ |= (sal_uInt8) mpAccess->GetPixel( nY, nX ); else - *pDest = (BYTE) mpAccess->GetPixel( nY, nX ) << 4; + *pDest = (sal_uInt8) mpAccess->GetPixel( nY, nX ) << 4; } if ( nXIndex & 1 ) pDest++; } @@ -548,13 +548,13 @@ ULONG PNGWriterImpl::ImplGetFilter ( ULONG nY, ULONG nXStart, ULONG nXAdd ) case( 8 ): { - for ( ULONG nX = nXStart; nX < mnWidth; nX+=nXAdd ) + for ( sal_uLong nX = nXStart; nX < mnWidth; nX+=nXAdd ) *pDest++ = mpAccess->GetPixel( nY, nX ); } break; default : - mbStatus = FALSE; + mbStatus = sal_False; break; } } @@ -564,7 +564,7 @@ ULONG PNGWriterImpl::ImplGetFilter ( ULONG nY, ULONG nXStart, ULONG nXAdd ) { if ( mbTrueAlpha ) { - for ( ULONG nX = nXStart; nX < mnWidth; nX += nXAdd ) + for ( sal_uLong nX = nXStart; nX < mnWidth; nX += nXAdd ) { const BitmapColor& rColor = mpAccess->GetPixel( nY, nX ); *pDest++ = rColor.GetRed(); @@ -577,7 +577,7 @@ ULONG PNGWriterImpl::ImplGetFilter ( ULONG nY, ULONG nXStart, ULONG nXAdd ) { const BitmapColor aTrans( mpMaskAccess->GetBestMatchingColor( Color( COL_WHITE ) ) ); - for ( ULONG nX = nXStart; nX < mnWidth; nX+=nXAdd ) + for ( sal_uLong nX = nXStart; nX < mnWidth; nX+=nXAdd ) { const BitmapColor& rColor = mpAccess->GetPixel( nY, nX ); *pDest++ = rColor.GetRed(); @@ -593,7 +593,7 @@ ULONG PNGWriterImpl::ImplGetFilter ( ULONG nY, ULONG nXStart, ULONG nXAdd ) } else { - for ( ULONG nX = nXStart; nX < mnWidth; nX+=nXAdd ) + for ( sal_uLong nX = nXStart; nX < mnWidth; nX+=nXAdd ) { const BitmapColor& rColor = mpAccess->GetPixel( nY, nX ); *pDest++ = rColor.GetRed(); @@ -610,13 +610,13 @@ ULONG PNGWriterImpl::ImplGetFilter ( ULONG nY, ULONG nXStart, ULONG nXAdd ) pDest = mpDeflateInBuf; *pDest++ = 4; // filter type - ULONG na, nb, nc; + sal_uLong na, nb, nc; long np, npa, npb, npc; - BYTE* p1 = mpCurrentScan + 1; // Current Pixel - BYTE* p2 = p1 - mnBBP; // left pixel - BYTE* p3 = mpPreviousScan; // upper pixel - BYTE* p4 = p3 - mnBBP; // upperleft Pixel; + sal_uInt8* p1 = mpCurrentScan + 1; // Current Pixel + sal_uInt8* p2 = p1 - mnBBP; // left pixel + sal_uInt8* p3 = mpPreviousScan; // upper pixel + sal_uInt8* p4 = p3 - mnBBP; // upperleft Pixel; while ( pDest < mpDeflateInBuf + mnDeflateInSize ) { @@ -640,9 +640,9 @@ ULONG PNGWriterImpl::ImplGetFilter ( ULONG nY, ULONG nXStart, ULONG nXAdd ) npb =-npb; if ( npc < 0 ) npc =-npc; - if ( ( npa <= npb ) && ( npa <= npc ) ) *pDest++ = *p1++ - (BYTE)na; - else if ( npb <= npc ) *pDest++ = *p1++ - (BYTE)nb; - else *pDest++ = *p1++ - (BYTE)nc; + if ( ( npa <= npb ) && ( npa <= npc ) ) *pDest++ = *p1++ - (sal_uInt8)na; + else if ( npb <= npc ) *pDest++ = *p1++ - (sal_uInt8)nb; + else *pDest++ = *p1++ - (sal_uInt8)nc; p4++; p2++; } @@ -664,7 +664,7 @@ void PNGWriterImpl::ImplClearFirstScanline() // ------------------------------------------------------------------------ -void PNGWriterImpl::ImplOpenChunk ( ULONG nChunkType ) +void PNGWriterImpl::ImplOpenChunk ( sal_uLong nChunkType ) { maChunkSeq.resize( maChunkSeq.size() + 1 ); maChunkSeq.back().nType = nChunkType; @@ -672,7 +672,7 @@ void PNGWriterImpl::ImplOpenChunk ( ULONG nChunkType ) // ------------------------------------------------------------------------ -void PNGWriterImpl::ImplWriteChunk ( BYTE nSource ) +void PNGWriterImpl::ImplWriteChunk ( sal_uInt8 nSource ) { maChunkSeq.back().aData.push_back( nSource ); } diff --git a/vcl/source/gdi/polyscan.cxx b/vcl/source/gdi/polyscan.cxx index b96591b6aa40..81d05bf33354 100644 --- a/vcl/source/gdi/polyscan.cxx +++ b/vcl/source/gdi/polyscan.cxx @@ -122,9 +122,9 @@ void PolyScanline::Set( long nStart, long nEnd ) // ------------------------------------------------------------------------ -BOOL PolyScanline::GetFirstSegment( PolyScanSegment& rSegment ) +sal_Bool PolyScanline::GetFirstSegment( PolyScanSegment& rSegment ) { - BOOL bRet = GetFirstX( rSegment.mnStart ); + sal_Bool bRet = GetFirstX( rSegment.mnStart ); if( bRet && !GetNextX( rSegment.mnEnd ) ) rSegment.mnEnd = rSegment.mnStart; @@ -134,9 +134,9 @@ BOOL PolyScanline::GetFirstSegment( PolyScanSegment& rSegment ) // ------------------------------------------------------------------------ -BOOL PolyScanline::GetNextSegment( PolyScanSegment& rSegment ) +sal_Bool PolyScanline::GetNextSegment( PolyScanSegment& rSegment ) { - BOOL bRet = GetNextX( rSegment.mnStart ); + sal_Bool bRet = GetNextX( rSegment.mnStart ); if( bRet && !GetNextX( rSegment.mnEnd ) ) rSegment.mnEnd = rSegment.mnStart; @@ -153,7 +153,7 @@ PolyScanner::PolyScanner( const Rectangle& rRect ) if( !rRect.IsEmpty() ) { Rectangle aRect( rRect ); - ULONG nHeight; + sal_uLong nHeight; aRect.Justify(); mnLeft = aRect.Left(); @@ -162,7 +162,7 @@ PolyScanner::PolyScanner( const Rectangle& rRect ) mnBottom = aRect.Bottom(); mpArray = new PolyScanline[ nHeight = Height() ]; - for( ULONG i = 0UL; i < nHeight; i++ ) + for( sal_uLong i = 0UL; i < nHeight; i++ ) mpArray[ i ].Set( mnLeft, mnRight ); } else @@ -182,10 +182,10 @@ PolyScanner::PolyScanner( const Polygon& rPoly ) { long nLast = nCount - 1; Point aFirst( rPoly[ 0 ] ); - Point aLast( rPoly[ (USHORT) nLast ] ); + Point aLast( rPoly[ (sal_uInt16) nLast ] ); while( nLast && ( aLast == aFirst ) ) - aLast = rPoly[ (USHORT) --nLast ]; + aLast = rPoly[ (sal_uInt16) --nLast ]; if( !nLast ) { @@ -198,7 +198,7 @@ PolyScanner::PolyScanner( const Polygon& rPoly ) else { const Rectangle aRect( rPoly.GetBoundRect() ); - ULONG nHeight; + sal_uLong nHeight; mnLeft = aRect.Left(); mnTop = aRect.Top(); @@ -209,7 +209,7 @@ PolyScanner::PolyScanner( const Polygon& rPoly ) for( long i = 1L; i <= nLast; i++ ) { - const Point& rPt = rPoly[ (USHORT) i ]; + const Point& rPt = rPoly[ (sal_uInt16) i ]; if( rPt != aLast ) { @@ -241,7 +241,7 @@ PolyScanner::~PolyScanner() // ------------------------------------------------------------------------ -PolyScanline* PolyScanner::operator[]( ULONG nPos ) const +PolyScanline* PolyScanner::operator[]( sal_uLong nPos ) const { DBG_ASSERT( nPos < Count(), "nPos out of range!" ); return( mpArray ? ( mpArray + nPos ) : NULL ); @@ -282,7 +282,7 @@ void PolyScanner::InsertLine( const Point& rStart, const Point& rEnd ) const long nYInc = ( nStartY < nEndY ) ? 1L : -1L; long nLastX = nStartX; long nLastY = nStartY; - BOOL bLast = FALSE; + sal_Bool bLast = sal_False; mpArray[ nStartY - mnTop ].Insert( nStartX ); @@ -300,10 +300,10 @@ void PolyScanner::InsertLine( const Point& rStart, const Point& rEnd ) mpArray[ nLastY - mnTop ].Insert( nLastX ); mpArray[ nY - mnTop ].Insert( nX ); - bLast = FALSE; + bLast = sal_False; } else - bLast = TRUE; + bLast = sal_True; nLastX = nX; nLastY = nY; @@ -333,10 +333,10 @@ void PolyScanner::InsertLine( const Point& rStart, const Point& rEnd ) mpArray[ nLastY - mnTop ].Insert( nLastX ); mpArray[ nY - mnTop ].Insert( nX ); - bLast = FALSE; + bLast = sal_False; } else - bLast = TRUE; + bLast = sal_True; nLastX = nX; nLastY = nY; diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 774673de0a04..15964d9da09f 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -40,6 +40,7 @@ #include <vcl/unohelp.hxx> #include <tools/debug.hxx> +#include <tools/resary.hxx> #include <tools/stream.hxx> #include <tools/vcompat.hxx> #include <vcl/svdata.hxx> @@ -53,11 +54,18 @@ #include <vcl/gdimtf.hxx> #include <vcl/metaact.hxx> #include <vcl/print.hxx> +#include <vcl/svids.hrc> #include <comphelper/processfactory.hxx> +#include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/container/XNameAccess.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" + using namespace com::sun::star::uno; using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::container; int nImplSysDialog = 0; @@ -110,16 +118,16 @@ void ImplUpdateJobSetupPaper( JobSetup& rJobSetup ) // ------------------ PrinterOptions::PrinterOptions() : - mbReduceTransparency( FALSE ), + mbReduceTransparency( sal_False ), meReducedTransparencyMode( PRINTER_TRANSPARENCY_AUTO ), - mbReduceGradients( FALSE ), + mbReduceGradients( sal_False ), meReducedGradientsMode( PRINTER_GRADIENT_STRIPES ), mnReducedGradientStepCount( 64 ), - mbReduceBitmaps( FALSE ), + mbReduceBitmaps( sal_False ), meReducedBitmapMode( PRINTER_BITMAP_NORMAL ), mnReducedBitmapResolution( 200 ), - mbReducedBitmapsIncludeTransparency( TRUE ), - mbConvertToGreyscales( FALSE ) + mbReducedBitmapsIncludeTransparency( sal_True ), + mbConvertToGreyscales( sal_False ) { } @@ -129,6 +137,105 @@ PrinterOptions::~PrinterOptions() { } +#define PROPERTYNAME_REDUCETRANSPARENCY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceTransparency")) +#define PROPERTYNAME_REDUCEDTRANSPARENCYMODE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedTransparencyMode")) +#define PROPERTYNAME_REDUCEGRADIENTS rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceGradients")) +#define PROPERTYNAME_REDUCEDGRADIENTMODE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedGradientMode")) +#define PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedGradientStepCount")) +#define PROPERTYNAME_REDUCEBITMAPS rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceBitmaps")) +#define PROPERTYNAME_REDUCEDBITMAPMODE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapMode")) +#define PROPERTYNAME_REDUCEDBITMAPRESOLUTION rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapResolution")) +#define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapIncludesTransparency")) +#define PROPERTYNAME_CONVERTTOGREYSCALES rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ConvertToGreyscales")) + +bool PrinterOptions::ReadFromConfig( bool i_bFile ) +{ + bool bSuccess = false; + // save old state in case something goes wrong + PrinterOptions aOldValues( *this ); + + // get the configuration service + Reference< XMultiServiceFactory > xConfigProvider; + Reference< XNameAccess > xConfigAccess; + try + { + // get service provider + Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() ); + // create configuration hierachical access name + if( xSMgr.is() ) + { + try + { + xConfigProvider = Reference< XMultiServiceFactory >( + xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider" ))), + UNO_QUERY ); + if( xConfigProvider.is() ) + { + Sequence< Any > aArgs(1); + PropertyValue aVal; + aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); + if( i_bFile ) + aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Print/Option/File" ) ); + else + aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Print/Option/Printer" ) ); + aArgs.getArray()[0] <<= aVal; + xConfigAccess = Reference< XNameAccess >( + xConfigProvider->createInstanceWithArguments( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" )), aArgs ), + UNO_QUERY ); + if( xConfigAccess.is() ) + { + Reference< XPropertySet > xSet( xConfigAccess, UNO_QUERY ); + if( xSet.is() ) + { + sal_Int32 nValue = 0; + sal_Bool bValue = 0; + if( xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bValue ) + SetReduceTransparency( bValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nValue ) + SetReducedTransparencyMode( (PrinterTransparencyMode)nValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bValue ) + SetReduceGradients( bValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nValue ) + SetReducedGradientMode( (PrinterGradientMode)nValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nValue ) + SetReducedGradientStepCount( (sal_uInt16)nValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bValue ) + SetReduceBitmaps( bValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nValue ) + SetReducedBitmapMode( (PrinterBitmapMode)nValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nValue ) + SetReducedBitmapResolution( (sal_uInt16)nValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bValue ) + SetReducedBitmapIncludesTransparency( bValue ); + if( xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bValue ) + SetConvertToGreyscales( bValue ); + + bSuccess = true; + } + } + } + } + catch( Exception& ) + { + } + } + } + catch( WrappedTargetException& ) + { + } + + if( ! bSuccess ) + *this = aOldValues; + return bSuccess; +} + +void Printer::SetPrinterOptions( const PrinterOptions& i_rOptions ) +{ + *mpPrinterOptions = i_rOptions; +} + // ------------- // - QueueInfo - // ------------- @@ -348,24 +455,24 @@ XubString Printer::GetDefaultPrinterName() void Printer::ImplInitData() { - mbDevOutput = FALSE; + mbDevOutput = sal_False; meOutDevType = OUTDEV_PRINTER; - mbDefPrinter = FALSE; + mbDefPrinter = sal_False; mnError = 0; mnCurPage = 0; mnCurPrintPage = 0; mnPageQueueSize = 0; mnCopyCount = 1; - mbCollateCopy = FALSE; - mbPrinting = FALSE; - mbJobActive = FALSE; - mbPrintFile = FALSE; - mbInPrintPage = FALSE; - mbNewJobSetup = FALSE; + mbCollateCopy = sal_False; + mbPrinting = sal_False; + mbJobActive = sal_False; + mbPrintFile = sal_False; + mbInPrintPage = sal_False; + mbNewJobSetup = sal_False; mpInfoPrinter = NULL; mpPrinter = NULL; mpDisplayDev = NULL; - mbIsQueuePrinter = FALSE; + mbIsQueuePrinter = sal_False; mpPrinterOptions = new PrinterOptions; // Printer in die Liste eintragen @@ -430,7 +537,7 @@ void Printer::ImplInit( SalPrinterQueueInfo* pInfo ) // Daten initialisieren ImplUpdatePageData(); mpFontList = new ImplDevFontList(); - mpFontCache = new ImplFontCache( TRUE ); + mpFontCache = new ImplFontCache( sal_True ); mpGraphics->GetDevFontList( mpFontList ); } @@ -539,7 +646,7 @@ void Printer::ImplUpdatePageData() void Printer::ImplUpdateFontList() { - ImplUpdateFontData( TRUE ); + ImplUpdateFontData( sal_True ); } // ----------------------------------------------------------------------- @@ -552,7 +659,7 @@ Printer::Printer() { ImplInit( pInfo ); if ( !IsDisplayPrinter() ) - mbDefPrinter = TRUE; + mbDefPrinter = sal_True; } else ImplInitDisplay( NULL ); @@ -670,57 +777,57 @@ void Printer::Compat_OldPrinterMetrics( bool bSet ) mpInfoPrinter->m_bCompatMetrics = bSet; // get new font data - ImplUpdateFontData( TRUE ); + ImplUpdateFontData( sal_True ); } // ----------------------------------------------------------------------- -ULONG Printer::GetCapabilities( USHORT nType ) const +sal_uLong Printer::GetCapabilities( sal_uInt16 nType ) const { if ( IsDisplayPrinter() ) - return FALSE; + return sal_False; if( mpInfoPrinter ) return mpInfoPrinter->GetCapabilities( maJobSetup.ImplGetConstData(), nType ); else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL Printer::HasSupport( PrinterSupport eFeature ) const +sal_Bool Printer::HasSupport( PrinterSupport eFeature ) const { switch ( eFeature ) { case SUPPORT_SET_ORIENTATION: - return (BOOL)GetCapabilities( PRINTER_CAPABILITIES_SETORIENTATION ); + return (sal_Bool)GetCapabilities( PRINTER_CAPABILITIES_SETORIENTATION ); case SUPPORT_SET_PAPERBIN: - return (BOOL)GetCapabilities( PRINTER_CAPABILITIES_SETPAPERBIN ); + return (sal_Bool)GetCapabilities( PRINTER_CAPABILITIES_SETPAPERBIN ); case SUPPORT_SET_PAPERSIZE: - return (BOOL)GetCapabilities( PRINTER_CAPABILITIES_SETPAPERSIZE ); + return (sal_Bool)GetCapabilities( PRINTER_CAPABILITIES_SETPAPERSIZE ); case SUPPORT_SET_PAPER: - return (BOOL)GetCapabilities( PRINTER_CAPABILITIES_SETPAPER ); + return (sal_Bool)GetCapabilities( PRINTER_CAPABILITIES_SETPAPER ); case SUPPORT_COPY: return (GetCapabilities( PRINTER_CAPABILITIES_COPIES ) != 0); case SUPPORT_COLLATECOPY: return (GetCapabilities( PRINTER_CAPABILITIES_COLLATECOPIES ) != 0); case SUPPORT_SETUPDIALOG: - return (BOOL)GetCapabilities( PRINTER_CAPABILITIES_SUPPORTDIALOG ); + return (sal_Bool)GetCapabilities( PRINTER_CAPABILITIES_SUPPORTDIALOG ); case SUPPORT_FAX: - return (BOOL) GetCapabilities( PRINTER_CAPABILITIES_FAX ); + return (sal_Bool) GetCapabilities( PRINTER_CAPABILITIES_FAX ); case SUPPORT_PDF: - return (BOOL) GetCapabilities( PRINTER_CAPABILITIES_PDF ); + return (sal_Bool) GetCapabilities( PRINTER_CAPABILITIES_PDF ); } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL Printer::SetJobSetup( const JobSetup& rSetup ) +sal_Bool Printer::SetJobSetup( const JobSetup& rSetup ) { if ( IsDisplayPrinter() || mbInPrintPage ) - return FALSE; + return sal_False; JobSetup aJobSetup = rSetup; @@ -728,60 +835,60 @@ BOOL Printer::SetJobSetup( const JobSetup& rSetup ) if ( mpInfoPrinter->SetPrinterData( aJobSetup.ImplGetData() ) ) { ImplUpdateJobSetupPaper( aJobSetup ); - mbNewJobSetup = TRUE; + mbNewJobSetup = sal_True; maJobSetup = aJobSetup; ImplUpdatePageData(); ImplUpdateFontList(); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL Printer::Setup( Window* pWindow ) +sal_Bool Printer::Setup( Window* pWindow ) { if ( IsDisplayPrinter() ) - return FALSE; + return sal_False; if ( IsJobActive() || IsPrinting() ) - return FALSE; + return sal_False; JobSetup aJobSetup = maJobSetup; SalFrame* pFrame; if ( !pWindow ) pWindow = ImplGetDefaultWindow(); if( !pWindow ) - return FALSE; + return sal_False; pFrame = pWindow->ImplGetFrame(); ImplReleaseGraphics(); ImplSVData* pSVData = ImplGetSVData(); pSVData->maAppData.mnModalMode++; nImplSysDialog++; - BOOL bSetup = mpInfoPrinter->Setup( pFrame, aJobSetup.ImplGetData() ); + sal_Bool bSetup = mpInfoPrinter->Setup( pFrame, aJobSetup.ImplGetData() ); pSVData->maAppData.mnModalMode--; nImplSysDialog--; if ( bSetup ) { ImplUpdateJobSetupPaper( aJobSetup ); - mbNewJobSetup = TRUE; + mbNewJobSetup = sal_True; maJobSetup = aJobSetup; ImplUpdatePageData(); ImplUpdateFontList(); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL Printer::SetPrinterProps( const Printer* pPrinter ) +sal_Bool Printer::SetPrinterProps( const Printer* pPrinter ) { if ( IsJobActive() || IsPrinting() ) - return FALSE; + return sal_False; ImplSVData* pSVData = ImplGetSVData(); @@ -821,14 +928,14 @@ BOOL Printer::SetPrinterProps( const Printer* pPrinter ) mpFontCache = NULL; mpFontList = NULL; - mbInitFont = TRUE; - mbNewFont = TRUE; + mbInitFont = sal_True; + mbNewFont = sal_True; mpInfoPrinter = NULL; } // Neuen Printer bauen ImplInitDisplay( NULL ); - return TRUE; + return sal_True; } // Alten Printer zerstoeren? @@ -863,8 +970,8 @@ BOOL Printer::SetPrinterProps( const Printer* pPrinter ) delete mpFontList; mpFontCache = NULL; mpFontList = NULL; - mbInitFont = TRUE; - mbNewFont = TRUE; + mbInitFont = sal_True; + mbNewFont = sal_True; mpInfoPrinter = NULL; } @@ -882,15 +989,15 @@ BOOL Printer::SetPrinterProps( const Printer* pPrinter ) else SetJobSetup( pPrinter->GetJobSetup() ); - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL Printer::SetOrientation( Orientation eOrientation ) +sal_Bool Printer::SetOrientation( Orientation eOrientation ) { if ( mbInPrintPage ) - return FALSE; + return sal_False; if ( maJobSetup.ImplGetConstData()->meOrientation != eOrientation ) { @@ -900,26 +1007,26 @@ BOOL Printer::SetOrientation( Orientation eOrientation ) if ( IsDisplayPrinter() ) { - mbNewJobSetup = TRUE; + mbNewJobSetup = sal_True; maJobSetup = aJobSetup; - return TRUE; + return sal_True; } ImplReleaseGraphics(); if ( mpInfoPrinter->SetData( SAL_JOBSET_ORIENTATION, pSetupData ) ) { ImplUpdateJobSetupPaper( aJobSetup ); - mbNewJobSetup = TRUE; + mbNewJobSetup = sal_True; maJobSetup = aJobSetup; ImplUpdatePageData(); ImplUpdateFontList(); - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -931,10 +1038,10 @@ Orientation Printer::GetOrientation() const // ----------------------------------------------------------------------- -BOOL Printer::SetPaperBin( USHORT nPaperBin ) +sal_Bool Printer::SetPaperBin( sal_uInt16 nPaperBin ) { if ( mbInPrintPage ) - return FALSE; + return sal_False; if ( (maJobSetup.ImplGetConstData()->mnPaperBin != nPaperBin) && (nPaperBin < GetPaperBinCount()) ) @@ -945,31 +1052,31 @@ BOOL Printer::SetPaperBin( USHORT nPaperBin ) if ( IsDisplayPrinter() ) { - mbNewJobSetup = TRUE; + mbNewJobSetup = sal_True; maJobSetup = aJobSetup; - return TRUE; + return sal_True; } ImplReleaseGraphics(); if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERBIN, pSetupData ) ) { ImplUpdateJobSetupPaper( aJobSetup ); - mbNewJobSetup = TRUE; + mbNewJobSetup = sal_True; maJobSetup = aJobSetup; ImplUpdatePageData(); ImplUpdateFontList(); - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -USHORT Printer::GetPaperBin() const +sal_uInt16 Printer::GetPaperBin() const { return maJobSetup.ImplGetConstData()->mnPaperBin; } @@ -1067,10 +1174,10 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe // ----------------------------------------------------------------------- -BOOL Printer::SetPaper( Paper ePaper ) +sal_Bool Printer::SetPaper( Paper ePaper ) { if ( mbInPrintPage ) - return FALSE; + return sal_False; if ( maJobSetup.ImplGetConstData()->mePaperFormat != ePaper ) { @@ -1086,9 +1193,9 @@ BOOL Printer::SetPaper( Paper ePaper ) if ( IsDisplayPrinter() ) { - mbNewJobSetup = TRUE; + mbNewJobSetup = sal_True; maJobSetup = aJobSetup; - return TRUE; + return sal_True; } ImplReleaseGraphics(); @@ -1097,30 +1204,30 @@ BOOL Printer::SetPaper( Paper ePaper ) if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERSIZE|SAL_JOBSET_ORIENTATION, pSetupData ) ) { ImplUpdateJobSetupPaper( aJobSetup ); - mbNewJobSetup = TRUE; + mbNewJobSetup = sal_True; maJobSetup = aJobSetup; ImplUpdatePageData(); ImplUpdateFontList(); - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL Printer::SetPaperSizeUser( const Size& rSize ) +sal_Bool Printer::SetPaperSizeUser( const Size& rSize ) { return SetPaperSizeUser( rSize, false ); } -BOOL Printer::SetPaperSizeUser( const Size& rSize, bool bMatchNearest ) +sal_Bool Printer::SetPaperSizeUser( const Size& rSize, bool bMatchNearest ) { if ( mbInPrintPage ) - return FALSE; + return sal_False; Size aPixSize = LogicToPixel( rSize ); Size aPageSize = PixelToLogic( aPixSize, MAP_100TH_MM ); @@ -1136,9 +1243,9 @@ BOOL Printer::SetPaperSizeUser( const Size& rSize, bool bMatchNearest ) if ( IsDisplayPrinter() ) { - mbNewJobSetup = TRUE; + mbNewJobSetup = sal_True; maJobSetup = aJobSetup; - return TRUE; + return sal_True; } ImplReleaseGraphics(); @@ -1148,17 +1255,17 @@ BOOL Printer::SetPaperSizeUser( const Size& rSize, bool bMatchNearest ) if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERSIZE|SAL_JOBSET_ORIENTATION, pSetupData ) ) { ImplUpdateJobSetupPaper( aJobSetup ); - mbNewJobSetup = TRUE; + mbNewJobSetup = sal_True; maJobSetup = aJobSetup; ImplUpdatePageData(); ImplUpdateFontList(); - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -1174,6 +1281,48 @@ int Printer::GetPaperInfoCount() const // ----------------------------------------------------------------------- +rtl::OUString Printer::GetPaperName( Paper ePaper ) +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->mpPaperNames ) + { + pSVData->mpPaperNames = new boost::unordered_map< int, rtl::OUString >(); + if( ImplGetResMgr() ) + { + ResStringArray aPaperStrings( VclResId( RID_STR_PAPERNAMES ) ); + static const int PaperIndex[] = + { + PAPER_A0, PAPER_A1, PAPER_A2, PAPER_A3, PAPER_A4, PAPER_A5, + PAPER_B4_ISO, PAPER_B5_ISO, PAPER_LETTER, PAPER_LEGAL, PAPER_TABLOID, + PAPER_USER, PAPER_B6_ISO, PAPER_ENV_C4, PAPER_ENV_C5, PAPER_ENV_C6, PAPER_ENV_C65, + PAPER_ENV_DL, PAPER_SLIDE_DIA, PAPER_SCREEN, PAPER_C, PAPER_D, PAPER_E, + PAPER_EXECUTIVE, PAPER_FANFOLD_LEGAL_DE, PAPER_ENV_MONARCH, PAPER_ENV_PERSONAL, + PAPER_ENV_9, PAPER_ENV_10, PAPER_ENV_11, PAPER_ENV_12, PAPER_KAI16, + PAPER_KAI32, PAPER_KAI32BIG, PAPER_B4_JIS, PAPER_B5_JIS, PAPER_B6_JIS + }; + OSL_ENSURE( sal_uInt32(sizeof(PaperIndex)/sizeof(PaperIndex[0])) == aPaperStrings.Count(), "localized paper name count wrong" ); + for( int i = 0; i < int(sizeof(PaperIndex)/sizeof(PaperIndex[0])); i++ ) + (*pSVData->mpPaperNames)[PaperIndex[i]] = aPaperStrings.GetString(i); + } + } + + boost::unordered_map<int,rtl::OUString>::const_iterator it = pSVData->mpPaperNames->find( (int)ePaper ); + return (it != pSVData->mpPaperNames->end()) ? it->second : rtl::OUString(); +} + +// ----------------------------------------------------------------------- + +rtl::OUString Printer::GetPaperName( bool i_bPaperUser ) const +{ + Size aPageSize = PixelToLogic( GetPaperSizePixel(), MAP_100TH_MM ); + Paper ePaper = ImplGetPaperFormat( aPageSize.Width(), aPageSize.Height() ); + if( ePaper == PAPER_USER ) + ePaper = ImplGetPaperFormat( aPageSize.Height(), aPageSize.Width() ); + return (ePaper != PAPER_USER || i_bPaperUser ) ? GetPaperName( ePaper ) : rtl::OUString(); +} + +// ----------------------------------------------------------------------- + const PaperInfo& Printer::GetPaperInfo( int nPaper ) const { if( ! mpInfoPrinter ) @@ -1194,10 +1343,10 @@ DuplexMode Printer::GetDuplexMode() const // ----------------------------------------------------------------------- -BOOL Printer::SetDuplexMode( DuplexMode eDuplex ) +sal_Bool Printer::SetDuplexMode( DuplexMode eDuplex ) { if ( mbInPrintPage ) - return FALSE; + return sal_False; if ( maJobSetup.ImplGetConstData()->meDuplexMode != eDuplex ) { @@ -1207,26 +1356,26 @@ BOOL Printer::SetDuplexMode( DuplexMode eDuplex ) if ( IsDisplayPrinter() ) { - mbNewJobSetup = TRUE; + mbNewJobSetup = sal_True; maJobSetup = aJobSetup; - return TRUE; + return sal_True; } ImplReleaseGraphics(); if ( mpInfoPrinter->SetData( SAL_JOBSET_DUPLEXMODE, pSetupData ) ) { ImplUpdateJobSetupPaper( aJobSetup ); - mbNewJobSetup = TRUE; + mbNewJobSetup = sal_True; maJobSetup = aJobSetup; ImplUpdatePageData(); ImplUpdateFontList(); - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -1245,17 +1394,17 @@ Paper Printer::GetPaper() const // ----------------------------------------------------------------------- -USHORT Printer::GetPaperBinCount() const +sal_uInt16 Printer::GetPaperBinCount() const { if ( IsDisplayPrinter() ) return 0; - return (USHORT)mpInfoPrinter->GetPaperBinCount( maJobSetup.ImplGetConstData() ); + return (sal_uInt16)mpInfoPrinter->GetPaperBinCount( maJobSetup.ImplGetConstData() ); } // ----------------------------------------------------------------------- -XubString Printer::GetPaperBinName( USHORT nPaperBin ) const +XubString Printer::GetPaperBinName( sal_uInt16 nPaperBin ) const { if ( IsDisplayPrinter() ) return ImplGetSVEmptyStr(); @@ -1268,11 +1417,11 @@ XubString Printer::GetPaperBinName( USHORT nPaperBin ) const // ----------------------------------------------------------------------- -BOOL Printer::SetCopyCount( USHORT nCopy, BOOL bCollate ) +sal_Bool Printer::SetCopyCount( sal_uInt16 nCopy, sal_Bool bCollate ) { mnCopyCount = nCopy; mbCollateCopy = bCollate; - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -1285,9 +1434,9 @@ void Printer::Error() // ----------------------------------------------------------------------- -ULONG Printer::ImplSalPrinterErrorCodeToVCL( ULONG nError ) +sal_uLong Printer::ImplSalPrinterErrorCodeToVCL( sal_uLong nError ) { - ULONG nVCLError; + sal_uLong nVCLError; switch ( nError ) { case 0: @@ -1308,7 +1457,7 @@ ULONG Printer::ImplSalPrinterErrorCodeToVCL( ULONG nError ) void Printer::ImplEndPrint() { - mbPrinting = FALSE; + mbPrinting = sal_False; mnCurPrintPage = 0; maJobName.Erase(); } @@ -1325,15 +1474,15 @@ IMPL_LINK( Printer, ImplDestroyPrinterAsync, void*, pSalPrinter ) // ----------------------------------------------------------------------- -BOOL Printer::EndJob() +sal_Bool Printer::EndJob() { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if ( !IsJobActive() ) return bRet; DBG_ASSERT( !mbInPrintPage, "Printer::EndJob() - StartPage() without EndPage() called" ); - mbJobActive = FALSE; + mbJobActive = sal_False; if ( mpPrinter ) { @@ -1341,13 +1490,13 @@ BOOL Printer::EndJob() mnCurPage = 0; - bRet = TRUE; + bRet = sal_True; - mbPrinting = FALSE; + mbPrinting = sal_False; mnCurPrintPage = 0; maJobName.Erase(); - mbDevOutput = FALSE; + mbDevOutput = sal_False; bRet = mpPrinter->EndJob(); // Hier den Drucker nicht asyncron zerstoeren, da es // W95 nicht verkraftet, wenn gleichzeitig gedruckt wird @@ -1361,34 +1510,34 @@ BOOL Printer::EndJob() // ----------------------------------------------------------------------- -BOOL Printer::AbortJob() +sal_Bool Printer::AbortJob() { // Wenn wir einen Queue-Printer haben, kann man diesen noch mit // AbortJob() abbrechen, solange dieser noch am Drucken ist if ( !IsJobActive() && !IsPrinting() ) - return FALSE; + return sal_False; - mbJobActive = FALSE; - mbInPrintPage = FALSE; + mbJobActive = sal_False; + mbInPrintPage = sal_False; mpJobGraphics = NULL; if ( mpPrinter ) { - mbPrinting = FALSE; + mbPrinting = sal_False; mnCurPage = 0; mnCurPrintPage = 0; maJobName.Erase(); ImplReleaseGraphics(); - mbDevOutput = FALSE; + mbDevOutput = sal_False; mpPrinter->AbortJob(); Application::PostUserEvent( LINK( this, Printer, ImplDestroyPrinterAsync ), mpPrinter ); mpPrinter = NULL; - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -1406,12 +1555,12 @@ void Printer::ImplStartPage() ImplReleaseGraphics(); mpJobGraphics = pGraphics; } - mbDevOutput = TRUE; + mbDevOutput = sal_True; // PrintJob not aborted ??? if ( IsJobActive() ) { - mbInPrintPage = TRUE; + mbInPrintPage = sal_True; mnCurPage++; mnCurPrintPage++; } @@ -1425,16 +1574,16 @@ void Printer::ImplEndPage() if ( !IsJobActive() ) return; - mbInPrintPage = FALSE; + mbInPrintPage = sal_False; if ( mpPrinter ) { mpPrinter->EndPage(); ImplReleaseGraphics(); - mbDevOutput = FALSE; + mbDevOutput = sal_False; mpJobGraphics = NULL; - mbNewJobSetup = FALSE; + mbNewJobSetup = sal_False; } } diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index c8be71b70a45..38c589eb12b2 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -155,7 +155,7 @@ static void ImplConvertTransparentAction( GDIMetaFile& o_rMtf, if( rAct.GetType() == META_TRANSPARENT_ACTION ) { const MetaTransparentAction* pTransAct = static_cast<const MetaTransparentAction*>(&rAct); - USHORT nTransparency( pTransAct->GetTransparence() ); + sal_uInt16 nTransparency( pTransAct->GetTransparence() ); // #i10613# Respect transparency for draw color if( nTransparency ) @@ -164,16 +164,16 @@ static void ImplConvertTransparentAction( GDIMetaFile& o_rMtf, // assume white background for alpha blending Color aLineColor( rStateOutDev.GetLineColor() ); - aLineColor.SetRed( static_cast<UINT8>( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetRed()) / 100L ) ); - aLineColor.SetGreen( static_cast<UINT8>( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetGreen()) / 100L ) ); - aLineColor.SetBlue( static_cast<UINT8>( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetBlue()) / 100L ) ); - o_rMtf.AddAction( new MetaLineColorAction(aLineColor, TRUE) ); + aLineColor.SetRed( static_cast<sal_uInt8>( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetRed()) / 100L ) ); + aLineColor.SetGreen( static_cast<sal_uInt8>( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetGreen()) / 100L ) ); + aLineColor.SetBlue( static_cast<sal_uInt8>( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetBlue()) / 100L ) ); + o_rMtf.AddAction( new MetaLineColorAction(aLineColor, sal_True) ); Color aFillColor( rStateOutDev.GetFillColor() ); - aFillColor.SetRed( static_cast<UINT8>( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetRed()) / 100L ) ); - aFillColor.SetGreen( static_cast<UINT8>( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetGreen()) / 100L ) ); - aFillColor.SetBlue( static_cast<UINT8>( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetBlue()) / 100L ) ); - o_rMtf.AddAction( new MetaFillColorAction(aFillColor, TRUE) ); + aFillColor.SetRed( static_cast<sal_uInt8>( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetRed()) / 100L ) ); + aFillColor.SetGreen( static_cast<sal_uInt8>( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetGreen()) / 100L ) ); + aFillColor.SetBlue( static_cast<sal_uInt8>( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetBlue()) / 100L ) ); + o_rMtf.AddAction( new MetaFillColorAction(aFillColor, sal_True) ); } o_rMtf.AddAction( new MetaPolyPolygonAction(pTransAct->GetPolyPolygon()) ); @@ -405,9 +405,21 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic break; case META_LINE_ACTION: - aActionBounds = Rectangle( static_cast<const MetaLineAction&>(rAct).GetStartPoint(), - static_cast<const MetaLineAction&>(rAct).GetEndPoint() ); + { + const MetaLineAction& rMetaLineAction = static_cast<const MetaLineAction&>(rAct); + aActionBounds = Rectangle( rMetaLineAction.GetStartPoint(), rMetaLineAction.GetEndPoint() ); + aActionBounds.Justify(); + const long nLineWidth(rMetaLineAction.GetLineInfo().GetWidth()); + if(nLineWidth) + { + const long nHalfLineWidth((nLineWidth + 1) / 2); + aActionBounds.Left() -= nHalfLineWidth; + aActionBounds.Top() -= nHalfLineWidth; + aActionBounds.Right() += nHalfLineWidth; + aActionBounds.Bottom() += nHalfLineWidth; + } break; + } case META_RECT_ACTION: aActionBounds = static_cast<const MetaRectAction&>(rAct).GetRect(); @@ -447,8 +459,20 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic break; case META_POLYLINE_ACTION: - aActionBounds = static_cast<const MetaPolyLineAction&>(rAct).GetPolygon().GetBoundRect(); + { + const MetaPolyLineAction& rMetaPolyLineAction = static_cast<const MetaPolyLineAction&>(rAct); + aActionBounds = rMetaPolyLineAction.GetPolygon().GetBoundRect(); + const long nLineWidth(rMetaPolyLineAction.GetLineInfo().GetWidth()); + if(nLineWidth) + { + const long nHalfLineWidth((nLineWidth + 1) / 2); + aActionBounds.Left() -= nHalfLineWidth; + aActionBounds.Top() -= nHalfLineWidth; + aActionBounds.Right() += nHalfLineWidth; + aActionBounds.Bottom() += nHalfLineWidth; + } break; + } case META_POLYGON_ACTION: aActionBounds = static_cast<const MetaPolygonAction&>(rAct).GetPolygon().GetBoundRect(); @@ -724,7 +748,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, VirtualDevice aMapModeVDev; aMapModeVDev.mnDPIX = mnDPIX; aMapModeVDev.mnDPIY = mnDPIY; - aMapModeVDev.EnableOutput(FALSE); + aMapModeVDev.EnableOutput(sal_False); int nLastBgAction, nActionNum; @@ -832,13 +856,12 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, ++nActionNum; } - ConnectedComponentsList aCCList; // list containing distinct sets of connected components as elements. + // clean up aMapModeVDev + sal_uInt32 nCount = aMapModeVDev.GetGCStackDepth(); + while( nCount-- ) + aMapModeVDev.Pop(); - // create an OutputDevice to record mapmode changes and the like - VirtualDevice aMapModeVDev2; - aMapModeVDev2.mnDPIX = mnDPIX; - aMapModeVDev2.mnDPIY = mnDPIY; - aMapModeVDev2.EnableOutput(FALSE); + ConnectedComponentsList aCCList; // list containing distinct sets of connected components as elements. // fast-forward until one after the last background action // (need to reconstruct map mode vdev state) @@ -853,7 +876,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, pCurrAct, nActionNum) ); // execute action to get correct MapModes etc. - pCurrAct->Execute( &aMapModeVDev2 ); + pCurrAct->Execute( &aMapModeVDev ); pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction(); ++nActionNum; } @@ -870,10 +893,10 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction(), ++nActionNum ) { // execute action to get correct MapModes etc. - pCurrAct->Execute( &aMapModeVDev2 ); + pCurrAct->Execute( &aMapModeVDev ); // cache bounds of current action - const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, aMapModeVDev2) ); + const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, aMapModeVDev) ); // accumulate collected bounds here, initialize with current action Rectangle aTotalBounds( aBBCurrAct ); // thus, @@ -902,7 +925,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // not be considered for connected components, // too. Just put each of them into a separate // component. - aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, aMapModeVDev2); + aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, aMapModeVDev); if( !aBBCurrAct.IsEmpty() && !aTotalComponents.bIsFullyTransparent ) @@ -1170,7 +1193,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, Size aDstSzPix; VirtualDevice aMapVDev; // here, we record only mapmode information - aMapVDev.EnableOutput(FALSE); + aMapVDev.EnableOutput(sal_False); VirtualDevice aPaintVDev; // into this one, we render. @@ -1201,7 +1224,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, aMapVDev.mnDPIX = aPaintVDev.mnDPIX = mnDPIX; aMapVDev.mnDPIY = aPaintVDev.mnDPIY = mnDPIY; - aPaintVDev.EnableOutput(FALSE); + aPaintVDev.EnableOutput(sal_False); // iterate over all actions for( pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction(), nActionNum=0; @@ -1213,10 +1236,10 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // the current aCCList element // (aCurr) if( aCCList_MemberMap[nActionNum] == &(*aCurr) ) - aPaintVDev.EnableOutput(TRUE); + aPaintVDev.EnableOutput(sal_True); // but process every action - const USHORT nType( pCurrAct->GetType() ); + const sal_uInt16 nType( pCurrAct->GetType() ); if( META_MAPMODE_ACTION == nType ) { @@ -1251,8 +1274,8 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, Application::Reschedule(); } - const BOOL bOldMap = mbMap; - mbMap = aPaintVDev.mbMap = FALSE; + const sal_Bool bOldMap = mbMap; + mbMap = aPaintVDev.mbMap = sal_False; Bitmap aBandBmp( aPaintVDev.GetBitmap( Point(), aDstSzPix ) ); @@ -1268,7 +1291,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, rOutMtf.AddAction( new MetaBmpScaleAction( aDstPtPix, aDstSzPix, aBandBmp ) ); rOutMtf.AddAction( new MetaCommentAction( "PRNSPOOL_TRANSPARENTBITMAP_END" ) ); - aPaintVDev.mbMap = TRUE; + aPaintVDev.mbMap = sal_True; mbMap = bOldMap; aMapVDev.Pop(); aPaintVDev.Pop(); @@ -1288,18 +1311,16 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, } } + // clean up aMapModeVDev + nCount = aMapModeVDev.GetGCStackDepth(); + while( nCount-- ) + aMapModeVDev.Pop(); + // // STAGE 4: Copy actions to output metafile // ======================================== // - // create an OutputDevice to record color settings, mapmode - // changes and the like - VirtualDevice aMapModeVDev3; - aMapModeVDev3.mnDPIX = mnDPIX; - aMapModeVDev3.mnDPIY = mnDPIY; - aMapModeVDev3.EnableOutput(FALSE); - // iterate over all actions and duplicate the ones not in a // special aCCList member into rOutMtf for( pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction(), nActionNum=0; @@ -1327,7 +1348,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // given background color ImplConvertTransparentAction(rOutMtf, *pCurrAct, - aMapModeVDev3, + aMapModeVDev, aBackgroundComponent.aBgColor); } else @@ -1336,7 +1357,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, rOutMtf.AddAction( ( pCurrAct->Duplicate(), pCurrAct ) ); } - pCurrAct->Execute(&aMapModeVDev3); + pCurrAct->Execute(&aMapModeVDev); } } @@ -1514,7 +1535,7 @@ void Printer::DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const ( (long) rEndColor.GetGreen() * rGradient.GetEndIntensity() ) / 100L ) >> 1; const long nB = ( ( (long) rStartColor.GetBlue() * rGradient.GetStartIntensity() ) / 100L + ( (long) rEndColor.GetBlue() * rGradient.GetEndIntensity() ) / 100L ) >> 1; - const Color aColor( (BYTE) nR, (BYTE) nG, (BYTE) nB ); + const Color aColor( (sal_uInt8) nR, (sal_uInt8) nG, (sal_uInt8) nB ); pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); pOut->SetLineColor( aColor ); @@ -1557,7 +1578,7 @@ void Printer::DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly, ( (long) rEndColor.GetGreen() * rGradient.GetEndIntensity() ) / 100L ) >> 1; const long nB = ( ( (long) rStartColor.GetBlue() * rGradient.GetStartIntensity() ) / 100L + ( (long) rEndColor.GetBlue() * rGradient.GetEndIntensity() ) / 100L ) >> 1; - const Color aColor( (BYTE) nR, (BYTE) nG, (BYTE) nB ); + const Color aColor( (sal_uInt8) nR, (sal_uInt8) nG, (sal_uInt8) nB ); pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); pOut->SetLineColor( aColor ); diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 1b820057092c..b1eb2a268f5c 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -146,6 +146,7 @@ public: typedef boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash > PropertyToIndexMap; typedef boost::unordered_map< rtl::OUString, ControlDependency, rtl::OUStringHash > ControlDependencyMap; + typedef boost::unordered_map< rtl::OUString, Sequence< sal_Bool >, rtl::OUStringHash > ChoiceDisableMap; boost::shared_ptr<Printer> mpPrinter; Sequence< PropertyValue > maUIOptions; @@ -154,6 +155,7 @@ public: PropertyToIndexMap maPropertyToIndex; Link maOptionChangeHdl; ControlDependencyMap maControlDependencies; + ChoiceDisableMap maChoiceDisableMap; sal_Bool mbFirstPage; sal_Bool mbLastPage; sal_Bool mbReversePageOrder; @@ -182,17 +184,17 @@ public: {} ~ImplPrinterControllerData() { delete mpProgress; } - Size getRealPaperSize( const Size& i_rPageSize ) const + Size getRealPaperSize( const Size& i_rPageSize, bool bNoNUP ) const { if( maFixedPageSize.Width() > 0 && maFixedPageSize.Height() > 0 ) return maFixedPageSize; - if( maMultiPage.nRows * maMultiPage.nColumns > 1 ) + if( maMultiPage.nRows * maMultiPage.nColumns > 1 && ! bNoNUP ) return maMultiPage.aPaperSize; return i_rPageSize; } bool isFixedPageSize() const { return maFixedPageSize.Width() != 0 && maFixedPageSize.Height() != 0; } - PrinterController::PageSize modifyJobSetup( const Sequence< PropertyValue >& i_rProps ); + PrinterController::PageSize modifyJobSetup( const Sequence< PropertyValue >& i_rProps, bool bNoNUP ); }; PrinterController::PrinterController() @@ -484,18 +486,18 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: mnError = PRINTER_OK; if ( IsDisplayPrinter() ) - return FALSE; + return sal_False; if ( IsJobActive() || IsPrinting() ) - return FALSE; + return sal_False; - ULONG nCopies = mnCopyCount; + sal_uLong nCopies = mnCopyCount; bool bCollateCopy = mbCollateCopy; - bool bUserCopy = FALSE; + bool bUserCopy = sal_False; if ( nCopies > 1 ) { - ULONG nDevCopy; + sal_uLong nDevCopy; if ( bCollateCopy ) nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COLLATECOPIES ); @@ -505,20 +507,20 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: // need to do copies by hand ? if ( nCopies > nDevCopy ) { - bUserCopy = TRUE; + bUserCopy = sal_True; nCopies = 1; - bCollateCopy = FALSE; + bCollateCopy = sal_False; } } else - bCollateCopy = FALSE; + bCollateCopy = sal_False; ImplSVData* pSVData = ImplGetSVData(); mpPrinter = pSVData->mpDefInst->CreatePrinter( mpInfoPrinter ); if ( !mpPrinter ) - return FALSE; + return sal_False; sal_Bool bSinglePrintJobs = sal_False; beans::PropertyValue* pSingleValue = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintCollateAsSingleJobs" ) ) ); @@ -527,10 +529,6 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: pSingleValue->Value >>= bSinglePrintJobs; } - // remark: currently it is still possible to use EnablePrintFile and - // SetPrintFileName to redirect printout into file - // it can be argued that those methods should be removed in favor - // of only using the LocalFileName property beans::PropertyValue* pFileValue = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalFileName" ) ) ); if( pFileValue ) { @@ -538,7 +536,7 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: pFileValue->Value >>= aFile; if( aFile.getLength() ) { - mbPrintFile = TRUE; + mbPrintFile = sal_True; maPrintFile = aFile; bSinglePrintJobs = sal_False; } @@ -547,14 +545,15 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: XubString* pPrintFile = NULL; if ( mbPrintFile ) pPrintFile = &maPrintFile; + mpPrinterOptions->ReadFromConfig( mbPrintFile ); maJobName = i_rJobName; mnCurPage = 1; mnCurPrintPage = 1; - mbPrinting = TRUE; - if( ImplGetSVData()->maGDIData.mbPrinterPullModel ) + mbPrinting = sal_True; + if( GetCapabilities( PRINTER_CAPABILITIES_USEPULLMODEL ) ) { - mbJobActive = TRUE; + mbJobActive = sal_True; // sallayer does all necessary page printing // and also handles showing a dialog // that also means it must call jobStarted when the dialog is finished @@ -575,7 +574,7 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: pSVData->mpDefInst->DestroyPrinter( mpPrinter ); mnCurPage = 0; mnCurPrintPage = 0; - mbPrinting = FALSE; + mbPrinting = sal_False; mpPrinter = NULL; return false; @@ -616,7 +615,7 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: i_pController->isDirectPrint(), maJobSetup.ImplGetConstData() ) ) { - mbJobActive = TRUE; + mbJobActive = sal_True; i_pController->createProgressDialog(); int nPages = i_pController->getFilteredPageCount(); for( int nOuterIteration = 0; nOuterIteration < nOuterRepeatCount && ! bAborted; nOuterIteration++ ) @@ -653,7 +652,7 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: maJobName = i_rJobName; mnCurPage = 1; mnCurPrintPage = 1; - mbPrinting = TRUE; + mbPrinting = sal_True; } else bError = true; @@ -674,7 +673,7 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: pSVData->mpDefInst->DestroyPrinter( mpPrinter ); mnCurPage = 0; mnCurPrintPage = 0; - mbPrinting = FALSE; + mbPrinting = sal_False; mpPrinter = NULL; return false; @@ -727,6 +726,13 @@ void PrinterController::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter mpImplData->mnFixedPaperBin = -1; } +void PrinterController:: resetPrinterOptions( bool i_bFileOutput ) +{ + PrinterOptions aOpt; + aOpt.ReadFromConfig( i_bFileOutput ); + mpImplData->mpPrinter->SetPrinterOptions( aOpt ); +} + bool PrinterController::setupPrinter( Window* i_pParent ) { bool bRet = false; @@ -735,7 +741,7 @@ bool PrinterController::setupPrinter( Window* i_pParent ) // get old data Size aPaperSize( mpImplData->mpPrinter->PixelToLogic( mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); - USHORT nPaperBin = mpImplData->mpPrinter->GetPaperBin(); + sal_uInt16 nPaperBin = mpImplData->mpPrinter->GetPaperBin(); // call driver setup bRet = mpImplData->mpPrinter->Setup( i_pParent ); @@ -744,7 +750,7 @@ bool PrinterController::setupPrinter( Window* i_pParent ) // was papersize or bin overridden ? if so we need to take action Size aNewPaperSize( mpImplData->mpPrinter->PixelToLogic( mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); - USHORT nNewPaperBin = mpImplData->mpPrinter->GetPaperBin(); + sal_uInt16 nNewPaperBin = mpImplData->mpPrinter->GetPaperBin(); if( aNewPaperSize != aPaperSize || nNewPaperBin != nPaperBin ) { mpImplData->maFixedPageSize = aNewPaperSize; @@ -761,7 +767,7 @@ bool PrinterController::setupPrinter( Window* i_pParent ) return bRet; } -PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( const Sequence< PropertyValue >& i_rProps ) +PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( const Sequence< PropertyValue >& i_rProps, bool bNoNUP ) { PrinterController::PageSize aPageSize; aPageSize.aSize = mpPrinter->GetPaperSize(); @@ -796,7 +802,7 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons if( aSetSize.Width && aSetSize.Height ) { Size aSetPaperSize( aSetSize.Width, aSetSize.Height ); - Size aRealPaperSize( getRealPaperSize( aSetPaperSize ) ); + Size aRealPaperSize( getRealPaperSize( aSetPaperSize, bNoNUP ) ); if( aRealPaperSize != aCurSize ) aIsSize = aSetSize; } @@ -806,7 +812,7 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons aPageSize.aSize.Width() = aIsSize.Width; aPageSize.aSize.Height() = aIsSize.Height; - Size aRealPaperSize( getRealPaperSize( aPageSize.aSize ) ); + Size aRealPaperSize( getRealPaperSize( aPageSize.aSize, bNoNUP ) ); if( aRealPaperSize != aCurSize ) mpPrinter->SetPaperSizeUser( aRealPaperSize, ! isFixedPageSize() ); } @@ -872,12 +878,12 @@ PrinterController::PageSize PrinterController::getPageFile( int i_nUnfilteredPag mpImplData->mpPrinter->SetMapMode( aMapMode ); // modify job setup if necessary - PrinterController::PageSize aPageSize = mpImplData->modifyJobSetup( aPageParm ); + PrinterController::PageSize aPageSize = mpImplData->modifyJobSetup( aPageParm, true ); o_rMtf.SetPrefSize( aPageSize.aSize ); o_rMtf.SetPrefMapMode( aMapMode ); - mpImplData->mpPrinter->EnableOutput( FALSE ); + mpImplData->mpPrinter->EnableOutput( sal_False ); o_rMtf.Record( mpImplData->mpPrinter.get() ); @@ -906,7 +912,7 @@ static void appendSubPage( GDIMetaFile& o_rMtf, const Rectangle& i_rClipRect, GD o_rMtf.AddAction( new MetaPushAction( PUSH_ALL ) ); // clip to page rect - o_rMtf.AddAction( new MetaClipRegionAction( Region( i_rClipRect ), TRUE ) ); + o_rMtf.AddAction( new MetaClipRegionAction( Region( i_rClipRect ), sal_True ) ); // append the subpage io_rSubPage.WindStart(); @@ -923,8 +929,8 @@ static void appendSubPage( GDIMetaFile& o_rMtf, const Rectangle& i_rClipRect, GD o_rMtf.AddAction( new MetaMapModeAction( MapMode( MAP_100TH_MM ) ) ); Rectangle aBorderRect( i_rClipRect ); - o_rMtf.AddAction( new MetaLineColorAction( Color( COL_BLACK ), TRUE ) ); - o_rMtf.AddAction( new MetaFillColorAction( Color( COL_TRANSPARENT ), FALSE ) ); + o_rMtf.AddAction( new MetaLineColorAction( Color( COL_BLACK ), sal_True ) ); + o_rMtf.AddAction( new MetaFillColorAction( Color( COL_TRANSPARENT ), sal_False ) ); o_rMtf.AddAction( new MetaRectAction( aBorderRect ) ); // restore gstate @@ -954,7 +960,7 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte rMPS.nTopMargin == 0 && rMPS.nBottomMargin == 0 ) { PrinterController::PageSize aPageSize = getPageFile( i_nFilteredPage, o_rMtf, i_bMayUseCache ); - Size aPaperSize = mpImplData->getRealPaperSize( aPageSize.aSize ); + Size aPaperSize = mpImplData->getRealPaperSize( aPageSize.aSize, true ); mpImplData->mpPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); mpImplData->mpPrinter->SetPaperSizeUser( aPaperSize, ! mpImplData->isFixedPageSize() ); if( aPaperSize != aPageSize.aSize ) @@ -976,7 +982,7 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte sal_Bool bIsLastPage = mpImplData->mbLastPage; mpImplData->mbLastPage = sal_False; - Size aPaperSize( mpImplData->getRealPaperSize( mpImplData->maMultiPage.aPaperSize ) ); + Size aPaperSize( mpImplData->getRealPaperSize( mpImplData->maMultiPage.aPaperSize, false ) ); // multi page area: page size minus margins + one time spacing right and down // the added spacing is so each subpage can be calculated including its spacing @@ -1025,6 +1031,14 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte nCellX = (nSubPage / rMPS.nRows); nCellY = (nSubPage % rMPS.nRows); break; + case PrinterController::RLTB: + nCellX = rMPS.nColumns - 1 - (nSubPage % rMPS.nColumns); + nCellY = (nSubPage / rMPS.nColumns); + break; + case PrinterController::TBRL: + nCellX = rMPS.nColumns - 1 - (nSubPage / rMPS.nRows); + nCellY = (nSubPage % rMPS.nRows); + break; } // scale the metafile down to a sub page size double fScaleX = double(aSubPageSize.Width())/double(aPageSize.aSize.Width()); @@ -1067,9 +1081,9 @@ int PrinterController::getFilteredPageCount() return (getPageCountProtected() * mpImplData->maMultiPage.nRepeat + (nDiv-1)) / nDiv; } -ULONG PrinterController::removeTransparencies( GDIMetaFile& i_rIn, GDIMetaFile& o_rOut ) +sal_uLong PrinterController::removeTransparencies( GDIMetaFile& i_rIn, GDIMetaFile& o_rOut ) { - ULONG nRestoreDrawMode = mpImplData->mpPrinter->GetDrawMode(); + sal_uLong nRestoreDrawMode = mpImplData->mpPrinter->GetDrawMode(); sal_Int32 nMaxBmpDPIX = mpImplData->mpPrinter->ImplGetDPIX(); sal_Int32 nMaxBmpDPIY = mpImplData->mpPrinter->ImplGetDPIY(); @@ -1167,9 +1181,9 @@ void PrinterController::printFilteredPage( int i_nPage ) } GDIMetaFile aCleanedFile; - ULONG nRestoreDrawMode = removeTransparencies( aPageFile, aCleanedFile ); + sal_uLong nRestoreDrawMode = removeTransparencies( aPageFile, aCleanedFile ); - mpImplData->mpPrinter->EnableOutput( TRUE ); + mpImplData->mpPrinter->EnableOutput( sal_True ); // actually print the page mpImplData->mpPrinter->ImplStartPage(); @@ -1334,6 +1348,7 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_ bool bHaveProperty = false; rtl::OUString aPropName; vcl::ImplPrinterControllerData::ControlDependency aDep; + Sequence< sal_Bool > aChoicesDisabled; for( int n = 0; n < aOptProp.getLength(); n++ ) { const beans::PropertyValue& rEntry( aOptProp[ n ] ); @@ -1361,6 +1376,10 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_ { rEntry.Value >>= aDep.mnDependsOnEntry; } + else if( rEntry.Name.equalsAscii( "ChoicesDisabled" ) ) + { + rEntry.Value >>= aChoicesDisabled; + } } if( bHaveProperty ) { @@ -1373,6 +1392,8 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_ } if( aDep.maDependsOnName.getLength() > 0 ) mpImplData->maControlDependencies[ aPropName ] = aDep; + if( aChoicesDisabled.getLength() > 0 ) + mpImplData->maChoiceDisableMap[ aPropName ] = aChoicesDisabled; } } } @@ -1448,6 +1469,20 @@ bool PrinterController::isUIOptionEnabled( const rtl::OUString& i_rProperty ) co return bEnabled; } +bool PrinterController::isUIChoiceEnabled( const rtl::OUString& i_rProperty, sal_Int32 i_nValue ) const +{ + bool bEnabled = true; + ImplPrinterControllerData::ChoiceDisableMap::const_iterator it = + mpImplData->maChoiceDisableMap.find( i_rProperty ); + if(it != mpImplData->maChoiceDisableMap.end() ) + { + const Sequence< sal_Bool >& rDisabled( it->second ); + if( i_nValue >= 0 && i_nValue < rDisabled.getLength() ) + bEnabled = ! rDisabled[i_nValue]; + } + return bEnabled; +} + rtl::OUString PrinterController::getDependency( const rtl::OUString& i_rProperty ) const { rtl::OUString aDependency; @@ -1560,7 +1595,7 @@ void PrinterController::pushPropertiesToPrinter() pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) ); if( pVal ) pVal->Value >>= bCollate; - mpImplData->mpPrinter->SetCopyCount( static_cast<USHORT>(nCopyCount), bCollate ); + mpImplData->mpPrinter->SetCopyCount( static_cast<sal_uInt16>(nCopyCount), bCollate ); // duplex mode pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DuplexMode" ) ) ); @@ -1694,7 +1729,7 @@ void PrinterOptionsHelper::appendPrintUIOptions( uno::Sequence< beans::PropertyV } Any PrinterOptionsHelper::getUIControlOpt( const rtl::OUString& i_rTitle, - const Sequence< rtl::OUString >& i_rHelpTexts, + const Sequence< rtl::OUString >& i_rHelpIds, const rtl::OUString& i_rType, const PropertyValue* i_pVal, const PrinterOptionsHelper::UIControlOptions& i_rControlOptions @@ -1703,7 +1738,7 @@ Any PrinterOptionsHelper::getUIControlOpt( const rtl::OUString& i_rTitle, sal_Int32 nElements = 1 // ControlType + (i_rTitle.getLength() ? 1 : 0) // Text - + (i_rHelpTexts.getLength() ? 1 : 0) // HelpText + + (i_rHelpIds.getLength() ? 1 : 0) // HelpId + (i_pVal ? 1 : 0) // Property + i_rControlOptions.maAddProps.getLength() // additional props + (i_rControlOptions.maGroupHint.getLength() ? 1 : 0) // grouping @@ -1726,10 +1761,10 @@ Any PrinterOptionsHelper::getUIControlOpt( const rtl::OUString& i_rTitle, aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ); aCtrl[nUsed++].Value = makeAny( i_rTitle ); } - if( i_rHelpTexts.getLength() ) + if( i_rHelpIds.getLength() ) { - aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ); - aCtrl[nUsed++].Value = makeAny( i_rHelpTexts ); + aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpId" ) ); + aCtrl[nUsed++].Value = makeAny( i_rHelpIds ); } aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlType" ) ); aCtrl[nUsed++].Value = makeAny( i_rType ); @@ -1778,74 +1813,80 @@ Any PrinterOptionsHelper::getUIControlOpt( const rtl::OUString& i_rTitle, return makeAny( aCtrl ); } -Any PrinterOptionsHelper::getGroupControlOpt( const rtl::OUString& i_rTitle, const rtl::OUString& i_rHelpText ) +Any PrinterOptionsHelper::getGroupControlOpt( const rtl::OUString& i_rTitle, const rtl::OUString& i_rHelpId ) { - Sequence< rtl::OUString > aHelpText; - if( i_rHelpText.getLength() > 0 ) + Sequence< rtl::OUString > aHelpId; + if( i_rHelpId.getLength() > 0 ) { - aHelpText.realloc( 1 ); - *aHelpText.getArray() = i_rHelpText; + aHelpId.realloc( 1 ); + *aHelpId.getArray() = i_rHelpId; } - return getUIControlOpt( i_rTitle, aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); + return getUIControlOpt( i_rTitle, aHelpId, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); } Any PrinterOptionsHelper::getSubgroupControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rHelpId, const PrinterOptionsHelper::UIControlOptions& i_rControlOptions ) { - Sequence< rtl::OUString > aHelpText; - if( i_rHelpText.getLength() > 0 ) + Sequence< rtl::OUString > aHelpId; + if( i_rHelpId.getLength() > 0 ) { - aHelpText.realloc( 1 ); - *aHelpText.getArray() = i_rHelpText; + aHelpId.realloc( 1 ); + *aHelpId.getArray() = i_rHelpId; } - return getUIControlOpt( i_rTitle, aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ), + return getUIControlOpt( i_rTitle, aHelpId, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ), NULL, i_rControlOptions ); } Any PrinterOptionsHelper::getBoolControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rHelpId, const rtl::OUString& i_rProperty, sal_Bool i_bValue, const PrinterOptionsHelper::UIControlOptions& i_rControlOptions ) { - Sequence< rtl::OUString > aHelpText; - if( i_rHelpText.getLength() > 0 ) + Sequence< rtl::OUString > aHelpId; + if( i_rHelpId.getLength() > 0 ) { - aHelpText.realloc( 1 ); - *aHelpText.getArray() = i_rHelpText; + aHelpId.realloc( 1 ); + *aHelpId.getArray() = i_rHelpId; } PropertyValue aVal; aVal.Name = i_rProperty; aVal.Value = makeAny( i_bValue ); - return getUIControlOpt( i_rTitle, aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bool" ) ), &aVal, i_rControlOptions ); + return getUIControlOpt( i_rTitle, aHelpId, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bool" ) ), &aVal, i_rControlOptions ); } Any PrinterOptionsHelper::getChoiceControlOpt( const rtl::OUString& i_rTitle, - const Sequence< rtl::OUString >& i_rHelpText, + const Sequence< rtl::OUString >& i_rHelpId, const rtl::OUString& i_rProperty, const Sequence< rtl::OUString >& i_rChoices, sal_Int32 i_nValue, const rtl::OUString& i_rType, + const Sequence< sal_Bool >& i_rDisabledChoices, const PrinterOptionsHelper::UIControlOptions& i_rControlOptions ) { UIControlOptions aOpt( i_rControlOptions ); sal_Int32 nUsed = aOpt.maAddProps.getLength(); - aOpt.maAddProps.realloc( nUsed + 1 ); + aOpt.maAddProps.realloc( nUsed + 1 + (i_rDisabledChoices.getLength() ? 1 : 0) ); aOpt.maAddProps[nUsed].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Choices" ) ); aOpt.maAddProps[nUsed].Value = makeAny( i_rChoices ); + if( i_rDisabledChoices.getLength() ) + { + aOpt.maAddProps[nUsed+1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ChoicesDisabled" ) ); + aOpt.maAddProps[nUsed+1].Value = makeAny( i_rDisabledChoices ); + } PropertyValue aVal; aVal.Name = i_rProperty; aVal.Value = makeAny( i_nValue ); - return getUIControlOpt( i_rTitle, i_rHelpText, i_rType, &aVal, aOpt ); + return getUIControlOpt( i_rTitle, i_rHelpId, i_rType, &aVal, aOpt ); } Any PrinterOptionsHelper::getRangeControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rHelpId, const rtl::OUString& i_rProperty, sal_Int32 i_nValue, sal_Int32 i_nMinValue, @@ -1864,17 +1905,17 @@ Any PrinterOptionsHelper::getRangeControlOpt( const rtl::OUString& i_rTitle, aOpt.maAddProps[nUsed++].Value = makeAny( i_nMaxValue ); } - Sequence< rtl::OUString > aHelpText; - if( i_rHelpText.getLength() > 0 ) + Sequence< rtl::OUString > aHelpId; + if( i_rHelpId.getLength() > 0 ) { - aHelpText.realloc( 1 ); - *aHelpText.getArray() = i_rHelpText; + aHelpId.realloc( 1 ); + *aHelpId.getArray() = i_rHelpId; } PropertyValue aVal; aVal.Name = i_rProperty; aVal.Value = makeAny( i_nValue ); return getUIControlOpt( i_rTitle, - aHelpText, + aHelpId, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Range" ) ), &aVal, aOpt @@ -1882,23 +1923,23 @@ Any PrinterOptionsHelper::getRangeControlOpt( const rtl::OUString& i_rTitle, } Any PrinterOptionsHelper::getEditControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rHelpId, const rtl::OUString& i_rProperty, const rtl::OUString& i_rValue, const PrinterOptionsHelper::UIControlOptions& i_rControlOptions ) { - Sequence< rtl::OUString > aHelpText; - if( i_rHelpText.getLength() > 0 ) + Sequence< rtl::OUString > aHelpId; + if( i_rHelpId.getLength() > 0 ) { - aHelpText.realloc( 1 ); - *aHelpText.getArray() = i_rHelpText; + aHelpId.realloc( 1 ); + *aHelpId.getArray() = i_rHelpId; } PropertyValue aVal; aVal.Name = i_rProperty; aVal.Value = makeAny( i_rValue ); return getUIControlOpt( i_rTitle, - aHelpText, + aHelpId, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Edit" ) ), &aVal, i_rControlOptions diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx index e22b37c0970c..21c82cd51f3a 100644 --- a/vcl/source/gdi/regband.cxx +++ b/vcl/source/gdi/regband.cxx @@ -64,7 +64,7 @@ ImplRegionBand::ImplRegionBand( long nTop, long nBottom ) mpPrevBand = NULL; mpFirstSep = NULL; mpFirstBandPoint = NULL; - mbTouched = FALSE; + mbTouched = sal_False; } // ----------------------------------------------------------------------- @@ -213,8 +213,8 @@ void ImplRegionBand::ProcessPoints() // generate separations from lines and process union with existing // separations -BOOL ImplRegionBand::InsertPoint( long nX, long nLineId, - BOOL bEndPoint, LineType eLineType ) +sal_Bool ImplRegionBand::InsertPoint( long nX, long nLineId, + sal_Bool bEndPoint, LineType eLineType ) { if ( !mpFirstBandPoint ) { @@ -224,7 +224,7 @@ BOOL ImplRegionBand::InsertPoint( long nX, long nLineId, mpFirstBandPoint->mbEndPoint = bEndPoint; mpFirstBandPoint->meLineType = eLineType; mpFirstBandPoint->mpNextBandPoint = NULL; - return TRUE; + return sal_True; } // look if line allready touched the band @@ -243,8 +243,8 @@ BOOL ImplRegionBand::InsertPoint( long nX, long nLineId, { // if we've only got one point => replace first point pRegionBandPoint->mnX = nX; - pRegionBandPoint->mbEndPoint = TRUE; - return TRUE; + pRegionBandPoint->mbEndPoint = sal_True; + return sal_True; } else { @@ -268,7 +268,7 @@ BOOL ImplRegionBand::InsertPoint( long nX, long nLineId, } } else - return FALSE; + return sal_False; } // use next element @@ -299,7 +299,7 @@ BOOL ImplRegionBand::InsertPoint( long nX, long nLineId, else pLastTestedRegionBandPoint->mpNextBandPoint = pNewRegionBandPoint; - return TRUE; + return sal_True; } // use next element @@ -318,7 +318,7 @@ BOOL ImplRegionBand::InsertPoint( long nX, long nLineId, // connections to the new point pLastTestedRegionBandPoint->mpNextBandPoint = pNewRegionBandPoint; - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -352,7 +352,7 @@ void ImplRegionBand::ScaleX( double fHorzScale ) // // combine overlaping sparations -BOOL ImplRegionBand::OptimizeBand() +sal_Bool ImplRegionBand::OptimizeBand() { ImplRegionBandSep* pPrevSep = 0; ImplRegionBandSep* pSep = mpFirstSep; @@ -390,7 +390,7 @@ BOOL ImplRegionBand::OptimizeBand() pSep = pSep->mpNextSep; } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -405,7 +405,7 @@ void ImplRegionBand::Union( long nXLeft, long nXRight ) mpFirstSep = new ImplRegionBandSep; mpFirstSep->mnXLeft = nXLeft; mpFirstSep->mnXRight = nXRight; - mpFirstSep->mbRemoved = FALSE; + mpFirstSep->mbRemoved = sal_False; mpFirstSep->mpNextSep = NULL; return; } @@ -426,7 +426,7 @@ void ImplRegionBand::Union( long nXLeft, long nXRight ) pNewSep = new ImplRegionBandSep; pNewSep->mnXLeft = nXLeft; pNewSep->mnXRight = nXRight; - pNewSep->mbRemoved = FALSE; + pNewSep->mbRemoved = sal_False; pNewSep->mpNextSep = pSep; if ( pSep == mpFirstSep ) @@ -453,7 +453,7 @@ void ImplRegionBand::Union( long nXLeft, long nXRight ) pNewSep = new ImplRegionBandSep; pNewSep->mnXLeft = nXLeft; pNewSep->mnXRight = nXRight; - pNewSep->mbRemoved = FALSE; + pNewSep->mbRemoved = sal_False; pSep->mpNextSep = pNewSep; pNewSep->mpNextSep = NULL; @@ -474,7 +474,7 @@ void ImplRegionBand::Intersect( long nXLeft, long nXRight ) DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Intersect(): nxLeft > nXRight" ); // band has been touched - mbTouched = TRUE; + mbTouched = sal_True; // band empty? -> nothing to do if ( !mpFirstSep ) @@ -487,7 +487,7 @@ void ImplRegionBand::Intersect( long nXLeft, long nXRight ) // new separation completly outside? -> remove separation if ( (nXRight < pSep->mnXLeft) || (nXLeft > pSep->mnXRight) ) // will be removed from the optimizer - pSep->mbRemoved = TRUE; + pSep->mbRemoved = sal_True; // new separation overlaping from left? -> reduce right boundary if ( (nXLeft <= pSep->mnXLeft) && @@ -521,7 +521,7 @@ void ImplRegionBand::Exclude( long nXLeft, long nXRight ) DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Exclude(): nxLeft > nXRight" ); // band has been touched - mbTouched = TRUE; + mbTouched = sal_True; // band empty? -> nothing to do if ( !mpFirstSep ) @@ -533,14 +533,14 @@ void ImplRegionBand::Exclude( long nXLeft, long nXRight ) ImplRegionBandSep* pSep = mpFirstSep; while ( pSep ) { - BOOL bSepProcessed = FALSE; + sal_Bool bSepProcessed = sal_False; // new separation completely overlapping? -> remove separation if ( (nXLeft <= pSep->mnXLeft) && (nXRight >= pSep->mnXRight) ) { // will be removed from the optimizer - pSep->mbRemoved = TRUE; - bSepProcessed = TRUE; + pSep->mbRemoved = sal_True; + bSepProcessed = sal_True; } // new separation overlaping from left? -> reduce boundary @@ -549,7 +549,7 @@ void ImplRegionBand::Exclude( long nXLeft, long nXRight ) if ( (nXRight >= pSep->mnXLeft) && (nXLeft <= pSep->mnXLeft) ) { pSep->mnXLeft = nXRight+1; - bSepProcessed = TRUE; + bSepProcessed = sal_True; } } @@ -559,7 +559,7 @@ void ImplRegionBand::Exclude( long nXLeft, long nXRight ) if ( (nXLeft <= pSep->mnXRight) && (nXRight > pSep->mnXRight) ) { pSep->mnXRight = nXLeft-1; - bSepProcessed = TRUE; + bSepProcessed = sal_True; } } @@ -572,7 +572,7 @@ void ImplRegionBand::Exclude( long nXLeft, long nXRight ) pNewSep = new ImplRegionBandSep; pNewSep->mnXLeft = pSep->mnXLeft; pNewSep->mnXRight = nXLeft-1; - pNewSep->mbRemoved = FALSE; + pNewSep->mbRemoved = sal_False; pSep->mnXLeft = nXRight+1; @@ -652,7 +652,7 @@ void ImplRegionBand::XOr( long nXLeft, long nXRight ) mpFirstSep = new ImplRegionBandSep; mpFirstSep->mnXLeft = nXLeft; mpFirstSep->mnXRight = nXRight; - mpFirstSep->mbRemoved = FALSE; + mpFirstSep->mbRemoved = sal_False; mpFirstSep->mpNextSep = NULL; return; } @@ -681,7 +681,7 @@ void ImplRegionBand::XOr( long nXLeft, long nXRight ) pNewSep->mnXLeft = nXLeft; pNewSep->mnXRight = nXRight; pNewSep->mpNextSep = pSep; - pNewSep->mbRemoved = FALSE; + pNewSep->mbRemoved = sal_False; // connections from the new separation pNewSep->mpNextSep = pSep; @@ -697,7 +697,7 @@ void ImplRegionBand::XOr( long nXLeft, long nXRight ) else if( nXLeft == nOldLeft && nXRight == nOldRight ) { // #3 - pSep->mbRemoved = TRUE; + pSep->mbRemoved = sal_True; pPrevSep = NULL; // do not run accidentally into the "right" case when breaking the loop break; } @@ -730,7 +730,7 @@ void ImplRegionBand::XOr( long nXLeft, long nXRight ) // cannot break here, simply mark segment as removed, // and go on with adapted nXLeft/nXRight - pSep->mbRemoved = TRUE; + pSep->mbRemoved = sal_True; } else { @@ -810,7 +810,7 @@ void ImplRegionBand::XOr( long nXLeft, long nXRight ) pNewSep->mnXLeft = nXLeft; pNewSep->mnXRight = nXRight; pNewSep->mpNextSep = pSep->mpNextSep; - pNewSep->mbRemoved = FALSE; + pNewSep->mbRemoved = sal_False; // connections from the new separation pSep->mpNextSep = pNewSep; @@ -832,7 +832,7 @@ void ImplRegionBand::XOr( long nXLeft, long nXRight ) pNewSep->mnXLeft = nXLeft; pNewSep->mnXRight = nXRight; pNewSep->mpNextSep = NULL; - pNewSep->mbRemoved = FALSE; + pNewSep->mbRemoved = sal_False; // connections from the new separation pPrevSep->mpNextSep = pNewSep; @@ -843,50 +843,50 @@ void ImplRegionBand::XOr( long nXLeft, long nXRight ) // ----------------------------------------------------------------------- -BOOL ImplRegionBand::IsInside( long nX ) +sal_Bool ImplRegionBand::IsInside( long nX ) { ImplRegionBandSep* pSep = mpFirstSep; while ( pSep ) { if ( (pSep->mnXLeft <= nX) && (pSep->mnXRight >= nX) ) - return TRUE; + return sal_True; pSep = pSep->mpNextSep; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL ImplRegionBand::IsOver( long nLeft, long nRight ) +sal_Bool ImplRegionBand::IsOver( long nLeft, long nRight ) { ImplRegionBandSep* pSep = mpFirstSep; while ( pSep ) { if ( (pSep->mnXLeft < nRight) && (pSep->mnXRight > nLeft) ) - return TRUE; + return sal_True; pSep = pSep->mpNextSep; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL ImplRegionBand::IsInside( long nLeft, long nRight ) +sal_Bool ImplRegionBand::IsInside( long nLeft, long nRight ) { ImplRegionBandSep* pSep = mpFirstSep; while ( pSep ) { if ( (pSep->mnXLeft >= nLeft) && (nRight <= pSep->mnXRight) ) - return TRUE; + return sal_True; pSep = pSep->mpNextSep; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -913,7 +913,7 @@ long ImplRegionBand::GetXRightBoundary() const // ----------------------------------------------------------------------- -BOOL ImplRegionBand::operator==( const ImplRegionBand& rRegionBand ) const +sal_Bool ImplRegionBand::operator==( const ImplRegionBand& rRegionBand ) const { ImplRegionBandSep* pOwnRectBandSep = mpFirstSep; ImplRegionBandSep* pSecondRectBandSep = rRegionBand.mpFirstSep; @@ -923,12 +923,12 @@ BOOL ImplRegionBand::operator==( const ImplRegionBand& rRegionBand ) const long nOwnXLeft = pOwnRectBandSep->mnXLeft; long nSecondXLeft = pSecondRectBandSep->mnXLeft; if ( nOwnXLeft != nSecondXLeft ) - return FALSE; + return sal_False; long nOwnXRight = pOwnRectBandSep->mnXRight; long nSecondXRight = pSecondRectBandSep->mnXRight; if ( nOwnXRight != nSecondXRight ) - return FALSE; + return sal_False; // get next separation from current band pOwnRectBandSep = pOwnRectBandSep->mpNextSep; @@ -939,9 +939,9 @@ BOOL ImplRegionBand::operator==( const ImplRegionBand& rRegionBand ) const // differnt number of separations? if ( pOwnRectBandSep || pSecondRectBandSep ) - return FALSE; + return sal_False; - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index a00795e2e2ce..480a17a9f88b 100644..100755 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -41,6 +41,8 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolygonclipper.hxx> +#include <basegfx/polygon/b2dpolypolygoncutter.hxx> #include <basegfx/range/b2drange.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> @@ -79,19 +81,19 @@ namespace { bool ImplIsPolygonRectilinear (const PolyPolygon& rPolyPoly) { // Iterate over all polygons. - const USHORT nPolyCount = rPolyPoly.Count(); - for (USHORT nPoly = 0; nPoly < nPolyCount; ++nPoly) + const sal_uInt16 nPolyCount = rPolyPoly.Count(); + for (sal_uInt16 nPoly = 0; nPoly < nPolyCount; ++nPoly) { const Polygon& aPoly = rPolyPoly.GetObject(nPoly); // Iterate over all edges of the current polygon. - const USHORT nSize = aPoly.GetSize(); + const sal_uInt16 nSize = aPoly.GetSize(); if (nSize < 2) continue; Point aPoint (aPoly.GetPoint(0)); const Point aLastPoint (aPoint); - for (USHORT nPoint = 1; nPoint < nSize; ++nPoint) + for (sal_uInt16 nPoint = 1; nPoint < nSize; ++nPoint) { const Point aNextPoint (aPoly.GetPoint(nPoint)); // When there is at least one edge that is neither vertical nor @@ -183,20 +185,20 @@ ImplRegion* ImplRectilinearPolygonToBands (const PolyPolygon& rPolyPoly) long nLineId = 0L; // Iterate over all polygons. - const USHORT nPolyCount = rPolyPoly.Count(); - for (USHORT nPoly = 0; nPoly < nPolyCount; ++nPoly) + const sal_uInt16 nPolyCount = rPolyPoly.Count(); + for (sal_uInt16 nPoly = 0; nPoly < nPolyCount; ++nPoly) { const Polygon& aPoly = rPolyPoly.GetObject(nPoly); // Iterate over all edges of the current polygon. - const USHORT nSize = aPoly.GetSize(); + const sal_uInt16 nSize = aPoly.GetSize(); if (nSize < 2) continue; // Avoid fetching every point twice (each point is the start point // of one and the end point of another edge.) Point aStart (aPoly.GetPoint(0)); Point aEnd; - for (USHORT nPoint = 1; nPoint <= nSize; ++nPoint, aStart=aEnd) + for (sal_uInt16 nPoint = 1; nPoint <= nSize; ++nPoint, aStart=aEnd) { // We take the implicit closing edge into account by mapping // index nSize to 0. @@ -262,7 +264,7 @@ ImplRegion* ImplRectilinearPolygonToBands (const PolyPolygon& rPolyPoly) // Add the x-value as point to all bands in the nTop->nBottom range. for (pBand=pTopBand; pBand!=NULL&&pBand->mnYTop<=nBottom; pBand=pBand->mpNextBand) - pBand->InsertPoint(aStart.X(), nLineId++, TRUE, eLineType); + pBand->InsertPoint(aStart.X(), nLineId++, sal_True, eLineType); } } @@ -286,19 +288,19 @@ ImplRegion* ImplGeneralPolygonToBands ( pImplRegion->CreateBandRange( rPolygonBoundingBox.Top(), rPolygonBoundingBox.Bottom() ); // insert polygons - const USHORT nPolyCount = rPolyPoly.Count(); - for ( USHORT nPoly = 0; nPoly < nPolyCount; nPoly++ ) + const sal_uInt16 nPolyCount = rPolyPoly.Count(); + for ( sal_uInt16 nPoly = 0; nPoly < nPolyCount; nPoly++ ) { // get reference to current polygon const Polygon& aPoly = rPolyPoly.GetObject( nPoly ); - const USHORT nSize = aPoly.GetSize(); + const sal_uInt16 nSize = aPoly.GetSize(); // not enough points ( <= 2 )? -> nothing to do! if ( nSize <= 2 ) continue; // band the polygon - for ( USHORT nPoint = 1; nPoint < nSize; nPoint++ ) + for ( sal_uInt16 nPoint = 1; nPoint < nSize; nPoint++ ) pImplRegion->InsertLine( aPoly.GetPoint(nPoint-1), aPoly.GetPoint(nPoint), nLineID++ ); // close polygon with line from first point to last point, if neccesary @@ -338,7 +340,7 @@ const char* ImplDbgTestRegion( const void* pObj ) if ( (pImplRegion != &aImplEmptyRegion) && (pImplRegion != &aImplNullRegion) ) { - ULONG nCount = 0; + sal_uLong nCount = 0; const ImplRegionBand* pBand = pImplRegion->ImplGetFirstRegionBand(); while ( pBand ) { @@ -536,14 +538,14 @@ void ImplRegion::CreateBandRange( long nYTop, long nYBottom ) // ----------------------------------------------------------------------- -BOOL ImplRegion::InsertLine( const Point& rStartPt, const Point& rEndPt, +sal_Bool ImplRegion::InsertLine( const Point& rStartPt, const Point& rEndPt, long nLineId ) { long nX, nY; // lines consisting of a single point do not interest here if ( rStartPt == rEndPt ) - return TRUE; + return sal_True; LineType eLineType = (rStartPt.Y() > rEndPt.Y()) ? LINE_DESCENDING : LINE_ASCENDING; if ( rStartPt.X() == rEndPt.X() ) @@ -620,25 +622,25 @@ BOOL ImplRegion::InsertLine( const Point& rStartPt, const Point& rEndPt, } // last point - InsertPoint( Point( nEndX, nEndY ), nLineId, TRUE, eLineType ); + InsertPoint( Point( nEndX, nEndY ), nLineId, sal_True, eLineType ); } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- // // search for appropriate place for the new point -BOOL ImplRegion::InsertPoint( const Point &rPoint, long nLineID, - BOOL bEndPoint, LineType eLineType ) +sal_Bool ImplRegion::InsertPoint( const Point &rPoint, long nLineID, + sal_Bool bEndPoint, LineType eLineType ) { DBG_ASSERT( mpFirstBand != NULL, "ImplRegion::InsertPoint - no bands available!" ); if ( rPoint.Y() == mpLastCheckedBand->mnYTop ) { mpLastCheckedBand->InsertPoint( rPoint.X(), nLineID, bEndPoint, eLineType ); - return TRUE; + return sal_True; } if ( rPoint.Y() > mpLastCheckedBand->mnYTop ) @@ -650,7 +652,7 @@ BOOL ImplRegion::InsertPoint( const Point &rPoint, long nLineID, if ( rPoint.Y() == mpLastCheckedBand->mnYTop ) { mpLastCheckedBand->InsertPoint( rPoint.X(), nLineID, bEndPoint, eLineType ); - return TRUE; + return sal_True; } mpLastCheckedBand = mpLastCheckedBand->mpNextBand; @@ -667,7 +669,7 @@ BOOL ImplRegion::InsertPoint( const Point &rPoint, long nLineID, if ( rPoint.Y() == mpLastCheckedBand->mnYTop ) { mpLastCheckedBand->InsertPoint( rPoint.X(), nLineID, bEndPoint, eLineType ); - return TRUE; + return sal_True; } mpLastCheckedBand = mpLastCheckedBand->mpPrevBand; @@ -681,7 +683,7 @@ BOOL ImplRegion::InsertPoint( const Point &rPoint, long nLineID, // reinitialize pointer (should never be reached!) mpLastCheckedBand = mpFirstBand; - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -699,9 +701,9 @@ void ImplRegion::InsertBands( long nTop, long nBottom ) } // find/insert bands for the boundaries of the rectangle - BOOL bTopBoundaryInserted = FALSE; - BOOL bTop2BoundaryInserted = FALSE; - BOOL bBottomBoundaryInserted = FALSE; + sal_Bool bTopBoundaryInserted = sal_False; + sal_Bool bTop2BoundaryInserted = sal_False; + sal_Bool bBottomBoundaryInserted = sal_False; // special case: top boundary is above the first band ImplRegionBand* pNewBand; @@ -716,7 +718,7 @@ void ImplRegion::InsertBands( long nTop, long nBottom ) pNewBand->mpNextBand = mpFirstBand; mpFirstBand = pNewBand; - bTopBoundaryInserted = TRUE; + bTopBoundaryInserted = sal_True; } // insert band(s) into the list @@ -760,13 +762,13 @@ void ImplRegion::InsertBands( long nTop, long nBottom ) // // create new band and insert it into the list -BOOL ImplRegion::InsertSingleBand( ImplRegionBand* pBand, +sal_Bool ImplRegion::InsertSingleBand( ImplRegionBand* pBand, long nYBandPosition ) { // boundary already included in band with height 1? -> nothing to do! if ( (pBand->mnYTop == pBand->mnYBottom) && (nYBandPosition == pBand->mnYTop) ) - return TRUE; + return sal_True; // insert single height band on top? ImplRegionBand* pNewBand; @@ -781,7 +783,7 @@ BOOL ImplRegion::InsertSingleBand( ImplRegionBand* pBand, pBand->mnYBottom = nYBandPosition; pBand->mpNextBand = pNewBand; - return TRUE; + return sal_True; } // top of new rectangle within the current band? -> insert new band and copy data @@ -808,7 +810,7 @@ BOOL ImplRegion::InsertSingleBand( ImplRegionBand* pBand, pBand->mnYBottom = nYBandPosition - 1; pBand->mpNextBand = pNewBand; - return TRUE; + return sal_True; } // create new band behind the current in the list @@ -825,7 +827,7 @@ BOOL ImplRegion::InsertSingleBand( ImplRegionBand* pBand, // append band to the list pBand->mpNextBand = pNewBand; - return TRUE; + return sal_True; } if ( nYBandPosition > pBand->mnYBottom ) @@ -835,11 +837,11 @@ BOOL ImplRegion::InsertSingleBand( ImplRegionBand* pBand, // append band to the list pBand->mpNextBand = pNewBand; - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } // ------------------------------------------------------------------------ @@ -980,7 +982,7 @@ void ImplRegion::XOr( long nLeft, long nTop, long nRight, long nBottom ) // // remove empty bands -BOOL ImplRegion::OptimizeBandList() +sal_Bool ImplRegion::OptimizeBandList() { DBG_ASSERT( (this != &aImplNullRegion) && (this != &aImplEmptyRegion), "ImplRegion::OptimizeBandList() - Empty oder NULL-Region" ); @@ -991,7 +993,7 @@ BOOL ImplRegion::OptimizeBandList() ImplRegionBand* pBand = mpFirstBand; while ( pBand ) { - const BOOL bBTEqual = pBand->mpNextBand && + const sal_Bool bBTEqual = pBand->mpNextBand && (pBand->mnYBottom == pBand->mpNextBand->mnYTop); // no separation? -> remove! @@ -1199,7 +1201,7 @@ void Region::ImplCreateRectRegion( const Rectangle& rRect ) void Region::ImplCreatePolyPolyRegion( const PolyPolygon& rPolyPoly ) { - const USHORT nPolyCount = rPolyPoly.Count(); + const sal_uInt16 nPolyCount = rPolyPoly.Count(); if ( nPolyCount ) { // polypolygon empty? -> empty region @@ -1363,13 +1365,35 @@ void Region::Scale( double fScaleX, double fScaleY ) // ----------------------------------------------------------------------- -BOOL Region::Union( const Rectangle& rRect ) +sal_Bool Region::Union( const Rectangle& rRect ) { DBG_CHKTHIS( Region, ImplDbgTestRegion ); // is rectangle empty? -> nothing to do if ( rRect.IsEmpty() ) - return TRUE; + return sal_True; + + if( HasPolyPolygon() ) + { + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); + + if( aThisPolyPoly.count() == 0 ) + { + *this = rRect; + return true; + } + + // get the other B2DPolyPolygon + basegfx::B2DPolygon aRectPoly( basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) ); + basegfx::B2DPolyPolygon aOtherPolyPoly( aRectPoly ); + + basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationOr( aThisPolyPoly, aOtherPolyPoly ); + *this = Region( aClip ); + + return sal_True; + } ImplPolyPolyRegionToBandRegion(); @@ -1400,12 +1424,12 @@ BOOL Region::Union( const Rectangle& rRect ) mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL Region::Intersect( const Rectangle& rRect ) +sal_Bool Region::Intersect( const Rectangle& rRect ) { DBG_CHKTHIS( Region, ImplDbgTestRegion ); @@ -1421,7 +1445,7 @@ BOOL Region::Intersect( const Rectangle& rRect ) delete mpImplRegion; } mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); - return TRUE; + return sal_True; } // #103137# Avoid banding for special cases @@ -1439,14 +1463,30 @@ BOOL Region::Intersect( const Rectangle& rRect ) // unnecessary banding mpImplRegion->mpPolyPoly->Clip( rRect ); - return TRUE; + return sal_True; + } + else if( mpImplRegion->mpB2DPolyPoly ) + { + // #127431# make ImplRegion unique, if not already. + if( mpImplRegion->mnRefCount > 1 ) + { + mpImplRegion->mnRefCount--; + mpImplRegion = new ImplRegion( *mpImplRegion->mpB2DPolyPoly ); + } + + *mpImplRegion->mpB2DPolyPoly = + basegfx::tools::clipPolyPolygonOnRange( *mpImplRegion->mpB2DPolyPoly, + basegfx::B2DRange( rRect.Left(), rRect.Top(), + rRect.Right(), rRect.Bottom() ), + true, false ); + return sal_True; } else ImplPolyPolyRegionToBandRegion(); // is region empty? -> nothing to do! if ( mpImplRegion == &aImplEmptyRegion ) - return TRUE; + return sal_True; // get justified rectangle long nLeft = Min( rRect.Left(), rRect.Right() ); @@ -1467,7 +1507,7 @@ BOOL Region::Intersect( const Rectangle& rRect ) mpImplRegion->mpFirstBand->Union( nLeft, nRight ); mpImplRegion->mnRectCount = 1; - return TRUE; + return sal_True; } // no own instance data? -> make own copy! @@ -1511,24 +1551,43 @@ BOOL Region::Intersect( const Rectangle& rRect ) mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL Region::Exclude( const Rectangle& rRect ) +sal_Bool Region::Exclude( const Rectangle& rRect ) { DBG_CHKTHIS( Region, ImplDbgTestRegion ); // is rectangle empty? -> nothing to do if ( rRect.IsEmpty() ) - return TRUE; + return sal_True; + + if( HasPolyPolygon() ) + { + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); + + if( aThisPolyPoly.count() == 0 ) + return sal_True; + + // get the other B2DPolyPolygon + basegfx::B2DPolygon aRectPoly( basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) ); + basegfx::B2DPolyPolygon aOtherPolyPoly( aRectPoly ); + + basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationDiff( aThisPolyPoly, aOtherPolyPoly ); + *this = Region( aClip ); + + return sal_True; + } ImplPolyPolyRegionToBandRegion(); // no instance data? -> create! if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) - return TRUE; + return sal_True; // no own instance data? -> make own copy! if ( mpImplRegion->mnRefCount > 1 ) @@ -1553,18 +1612,40 @@ BOOL Region::Exclude( const Rectangle& rRect ) mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL Region::XOr( const Rectangle& rRect ) +sal_Bool Region::XOr( const Rectangle& rRect ) { DBG_CHKTHIS( Region, ImplDbgTestRegion ); // is rectangle empty? -> nothing to do if ( rRect.IsEmpty() ) - return TRUE; + return sal_True; + + if( HasPolyPolygon() ) + { + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); + + if( aThisPolyPoly.count() == 0 ) + { + *this = rRect; + return sal_True; + } + + // get the other B2DPolyPolygon + basegfx::B2DPolygon aRectPoly( basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) ); + basegfx::B2DPolyPolygon aOtherPolyPoly( aRectPoly ); + + basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationXor( aThisPolyPoly, aOtherPolyPoly ); + *this = Region( aClip ); + + return sal_True; + } ImplPolyPolyRegionToBandRegion(); @@ -1595,21 +1676,48 @@ BOOL Region::XOr( const Rectangle& rRect ) mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- +void Region::ImplUnionPolyPolygon( const Region& i_rRegion ) +{ + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); + + if( aThisPolyPoly.count() == 0 ) + { + *this = i_rRegion; + return; + } + + // get the other B2DPolyPolygon + basegfx::B2DPolyPolygon aOtherPolyPoly( const_cast<Region&>(i_rRegion).ConvertToB2DPolyPolygon() ); + aOtherPolyPoly = basegfx::tools::prepareForPolygonOperation( aOtherPolyPoly ); -BOOL Region::Union( const Region& rRegion ) + + basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationOr( aThisPolyPoly, aOtherPolyPoly ); + + *this = Region( aClip ); +} + +sal_Bool Region::Union( const Region& rRegion ) { DBG_CHKTHIS( Region, ImplDbgTestRegion ); + if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) + { + ImplUnionPolyPolygon( rRegion ); + return sal_True; + } + ImplPolyPolyRegionToBandRegion(); ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion(); // is region empty or null? -> nothing to do if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) ) - return TRUE; + return sal_True; // no instance data? -> create! if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) @@ -1645,28 +1753,50 @@ BOOL Region::Union( const Region& rRegion ) mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- +void Region::ImplIntersectWithPolyPolygon( const Region& i_rRegion ) +{ + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + if( aThisPolyPoly.count() == 0 ) + { + *this = i_rRegion; + return; + } -BOOL Region::Intersect( const Region& rRegion ) + // get the other B2DPolyPolygon + basegfx::B2DPolyPolygon aOtherPolyPoly( const_cast<Region&>(i_rRegion).ConvertToB2DPolyPolygon() ); + + basegfx::B2DPolyPolygon aClip = basegfx::tools::clipPolyPolygonOnPolyPolygon( aOtherPolyPoly, aThisPolyPoly, true, false ); + *this = Region( aClip ); +} + +sal_Bool Region::Intersect( const Region& rRegion ) { DBG_CHKTHIS( Region, ImplDbgTestRegion ); // same instance data? -> nothing to do! if ( mpImplRegion == rRegion.mpImplRegion ) - return TRUE; + return sal_True; + + if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) + { + ImplIntersectWithPolyPolygon( rRegion ); + return sal_True; + } ImplPolyPolyRegionToBandRegion(); ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion(); if ( mpImplRegion == &aImplEmptyRegion ) - return TRUE; + return sal_True; // is region null? -> nothing to do if ( rRegion.mpImplRegion == &aImplNullRegion ) - return TRUE; + return sal_True; // is rectangle empty? -> nothing to do if ( rRegion.mpImplRegion == &aImplEmptyRegion ) @@ -1680,7 +1810,7 @@ BOOL Region::Intersect( const Region& rRegion ) delete mpImplRegion; } mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); - return TRUE; + return sal_True; } // is own region NULL-region? -> copy data! @@ -1688,7 +1818,7 @@ BOOL Region::Intersect( const Region& rRegion ) { mpImplRegion = rRegion.mpImplRegion; rRegion.mpImplRegion->mnRefCount++; - return TRUE; + return sal_True; } // Wenn wir weniger Rechtecke haben, drehen wir den Intersect-Aufruf um @@ -1708,7 +1838,7 @@ BOOL Region::Intersect( const Region& rRegion ) ImplRegionBand* pBand = mpImplRegion->mpFirstBand; while ( pBand ) { - pBand->mbTouched = FALSE; + pBand->mbTouched = sal_False; pBand = pBand->mpNextBand; } @@ -1784,25 +1914,46 @@ BOOL Region::Intersect( const Region& rRegion ) } } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- +void Region::ImplExcludePolyPolygon( const Region& i_rRegion ) +{ + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + if( aThisPolyPoly.count() == 0 ) + return; + aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); + + // get the other B2DPolyPolygon + basegfx::B2DPolyPolygon aOtherPolyPoly( const_cast<Region&>(i_rRegion).ConvertToB2DPolyPolygon() ); + aOtherPolyPoly = basegfx::tools::prepareForPolygonOperation( aOtherPolyPoly ); + + basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationDiff( aThisPolyPoly, aOtherPolyPoly ); + *this = Region( aClip ); +} -BOOL Region::Exclude( const Region& rRegion ) +sal_Bool Region::Exclude( const Region& rRegion ) { DBG_CHKTHIS( Region, ImplDbgTestRegion ); + if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) + { + ImplExcludePolyPolygon( rRegion ); + return sal_True; + } + ImplPolyPolyRegionToBandRegion(); ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion(); // is region empty or null? -> nothing to do if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) ) - return TRUE; + return sal_True; // no instance data? -> nothing to do if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) - return TRUE; + return sal_True; // no own instance data? -> make own copy! if ( mpImplRegion->mnRefCount > 1 ) @@ -1837,27 +1988,51 @@ BOOL Region::Exclude( const Region& rRegion ) pBand = pBand->mpNextBand; } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- +void Region::ImplXOrPolyPolygon( const Region& i_rRegion ) +{ + // get this B2DPolyPolygon + basegfx::B2DPolyPolygon aThisPolyPoly( ConvertToB2DPolyPolygon() ); + if( aThisPolyPoly.count() == 0 ) + { + *this = i_rRegion; + return; + } + aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); + + // get the other B2DPolyPolygon + basegfx::B2DPolyPolygon aOtherPolyPoly( const_cast<Region&>(i_rRegion).ConvertToB2DPolyPolygon() ); + aOtherPolyPoly = basegfx::tools::prepareForPolygonOperation( aOtherPolyPoly ); + + basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationXor( aThisPolyPoly, aOtherPolyPoly ); + *this = Region( aClip ); +} -BOOL Region::XOr( const Region& rRegion ) +sal_Bool Region::XOr( const Region& rRegion ) { DBG_CHKTHIS( Region, ImplDbgTestRegion ); + if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) + { + ImplXOrPolyPolygon( rRegion ); + return sal_True; + } + ImplPolyPolyRegionToBandRegion(); ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion(); // is region empty or null? -> nothing to do if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) ) - return TRUE; + return sal_True; // no own instance data? -> XOr = copy if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) { *this = rRegion; - return TRUE; + return sal_True; } // no own instance data? -> make own copy! @@ -1890,7 +2065,7 @@ BOOL Region::XOr( const Region& rRegion ) mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -1944,7 +2119,7 @@ Rectangle Region::GetBoundRect() const // ----------------------------------------------------------------------- -BOOL Region::HasPolyPolygon() const +sal_Bool Region::HasPolyPolygon() const { DBG_CHKTHIS( Region, ImplDbgTestRegion ); if( !mpImplRegion ) @@ -2026,7 +2201,7 @@ basegfx::B2DPolyPolygon Region::ConvertToB2DPolyPolygon() // ----------------------------------------------------------------------- -BOOL Region::ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo, +bool Region::ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo, long& rX, long& rY, long& rWidth, long& rHeight ) const { @@ -2036,11 +2211,11 @@ BOOL Region::ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo, // no internal data? -> region is empty! if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) - return FALSE; + return false; // no band in the list? -> region is empty! if ( mpImplRegion->mpFirstBand == NULL ) - return FALSE; + return false; // initialise pointer for first access ImplRegionBand* pCurrRectBand = mpImplRegion->mpFirstBand; @@ -2048,7 +2223,7 @@ BOOL Region::ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo, DBG_ASSERT( pCurrRectBandSep != NULL, "Erstes Band wurde nicht optimiert." ); if ( !pCurrRectBandSep ) - return FALSE; + return false; // get boundaries of current rectangle rX = pCurrRectBandSep->mnXLeft; @@ -2060,12 +2235,12 @@ BOOL Region::ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo, rImplRegionInfo.mpVoidCurrRectBand = (void*)pCurrRectBand; rImplRegionInfo.mpVoidCurrRectBandSep = (void*)pCurrRectBandSep; - return TRUE; + return true; } // ----------------------------------------------------------------------- -BOOL Region::ImplGetNextRect( ImplRegionInfo& rImplRegionInfo, +bool Region::ImplGetNextRect( ImplRegionInfo& rImplRegionInfo, long& rX, long& rY, long& rWidth, long& rHeight ) const { @@ -2073,7 +2248,7 @@ BOOL Region::ImplGetNextRect( ImplRegionInfo& rImplRegionInfo, // no internal data? -> region is empty! if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) - return FALSE; + return false; // get last pointers ImplRegionBand* pCurrRectBand = (ImplRegionBand*)rImplRegionInfo.mpVoidCurrRectBand; @@ -2090,7 +2265,7 @@ BOOL Region::ImplGetNextRect( ImplRegionInfo& rImplRegionInfo, // no band found? -> not further rectangles! if( !pCurrRectBand ) - return FALSE; + return false; // get first separation in current band pCurrRectBandSep = pCurrRectBand->mpFirstSep; @@ -2106,7 +2281,7 @@ BOOL Region::ImplGetNextRect( ImplRegionInfo& rImplRegionInfo, rImplRegionInfo.mpVoidCurrRectBand = (void*)pCurrRectBand; rImplRegionInfo.mpVoidCurrRectBandSep = (void*)pCurrRectBandSep; - return TRUE; + return true; } // ----------------------------------------------------------------------- @@ -2125,7 +2300,7 @@ RegionType Region::GetType() const // ----------------------------------------------------------------------- -BOOL Region::IsInside( const Point& rPoint ) const +sal_Bool Region::IsInside( const Point& rPoint ) const { DBG_CHKTHIS( Region, ImplDbgTestRegion ); @@ -2138,7 +2313,7 @@ BOOL Region::IsInside( const Point& rPoint ) const // no instance data? -> not inside if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) - return FALSE; + return sal_False; // search band list ImplRegionBand* pBand = mpImplRegion->mpFirstBand; @@ -2150,30 +2325,30 @@ BOOL Region::IsInside( const Point& rPoint ) const { // is point within separation of the band? if ( pBand->IsInside( rPoint.X() ) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } pBand = pBand->mpNextBand; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL Region::IsInside( const Rectangle& rRect ) const +sal_Bool Region::IsInside( const Rectangle& rRect ) const { DBG_CHKTHIS( Region, ImplDbgTestRegion ); // is rectangle empty? -> not inside if ( rRect.IsEmpty() ) - return FALSE; + return sal_False; // no instance data? -> not inside if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) - return FALSE; + return sal_False; // create region from rectangle and intersect own region Region aRegion = rRect; @@ -2185,12 +2360,12 @@ BOOL Region::IsInside( const Rectangle& rRect ) const // ----------------------------------------------------------------------- -BOOL Region::IsOver( const Rectangle& rRect ) const +sal_Bool Region::IsOver( const Rectangle& rRect ) const { DBG_CHKTHIS( Region, ImplDbgTestRegion ); if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) - return FALSE; + return sal_False; // Can we optimize this ??? - is used in StarDraw for brushes pointers // Why we have no IsOver for Regions ??? @@ -2287,20 +2462,20 @@ Region& Region::operator=( const Rectangle& rRect ) // ----------------------------------------------------------------------- -BOOL Region::operator==( const Region& rRegion ) const +sal_Bool Region::operator==( const Region& rRegion ) const { DBG_CHKTHIS( Region, ImplDbgTestRegion ); DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion ); // reference to same object? -> equal! if ( mpImplRegion == rRegion.mpImplRegion ) - return TRUE; + return sal_True; if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) - return FALSE; + return sal_False; if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) ) - return FALSE; + return sal_False; if ( rRegion.mpImplRegion->mpPolyPoly && mpImplRegion->mpPolyPoly ) return *rRegion.mpImplRegion->mpPolyPoly == *mpImplRegion->mpPolyPoly; @@ -2311,13 +2486,13 @@ BOOL Region::operator==( const Region& rRegion ) const // Eine der beiden Regions kann jetzt Empty sein if ( mpImplRegion == rRegion.mpImplRegion ) - return TRUE; + return sal_True; if ( mpImplRegion == &aImplEmptyRegion ) - return FALSE; + return sal_False; if ( rRegion.mpImplRegion == &aImplEmptyRegion ) - return FALSE; + return sal_False; } // initialise pointers @@ -2331,22 +2506,22 @@ BOOL Region::operator==( const Region& rRegion ) const long nOwnXLeft = pOwnRectBandSep->mnXLeft; long nSecondXLeft = pSecondRectBandSep->mnXLeft; if ( nOwnXLeft != nSecondXLeft ) - return FALSE; + return sal_False; long nOwnYTop = pOwnRectBand->mnYTop; long nSecondYTop = pSecondRectBand->mnYTop; if ( nOwnYTop != nSecondYTop ) - return FALSE; + return sal_False; long nOwnXRight = pOwnRectBandSep->mnXRight; long nSecondXRight = pSecondRectBandSep->mnXRight; if ( nOwnXRight != nSecondXRight ) - return FALSE; + return sal_False; long nOwnYBottom = pOwnRectBand->mnYBottom; long nSecondYBottom = pSecondRectBand->mnYBottom; if ( nOwnYBottom != nSecondYBottom ) - return FALSE; + return sal_False; // get next separation from current band pOwnRectBandSep = pOwnRectBandSep->mpNextSep; @@ -2377,13 +2552,13 @@ BOOL Region::operator==( const Region& rRegion ) const } if ( pOwnRectBandSep && !pSecondRectBandSep ) - return FALSE; + return sal_False; if ( !pOwnRectBandSep && pSecondRectBandSep ) - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -2395,8 +2570,8 @@ SvStream& operator>>( SvStream& rIStrm, Region& rRegion ) DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion ); VersionCompat aCompat( rIStrm, STREAM_READ ); - UINT16 nVersion; - UINT16 nTmp16; + sal_uInt16 nVersion; + sal_uInt16 nTmp16; // statische Object haben RefCount von 0 if ( rRegion.mpImplRegion->mnRefCount ) @@ -2489,7 +2664,7 @@ SvStream& operator>>( SvStream& rIStrm, Region& rRegion ) if( aCompat.GetVersion() >= 2 ) { - BOOL bHasPolyPolygon; + sal_Bool bHasPolyPolygon; rIStrm >> bHasPolyPolygon; @@ -2513,7 +2688,7 @@ SvStream& operator<<( SvStream& rOStrm, const Region& rRegion ) { DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion ); - UINT16 nVersion = 2; + sal_uInt16 nVersion = 2; VersionCompat aCompat( rOStrm, STREAM_WRITE, nVersion ); Region aTmpRegion( rRegion ); @@ -2524,7 +2699,7 @@ SvStream& operator<<( SvStream& rOStrm, const Region& rRegion ) rOStrm << nVersion; // put type - rOStrm << (UINT16)aTmpRegion.GetType(); + rOStrm << (sal_uInt16)aTmpRegion.GetType(); // put all bands if not null or empty if ( (aTmpRegion.mpImplRegion != &aImplEmptyRegion) && (aTmpRegion.mpImplRegion != &aImplNullRegion) ) @@ -2533,7 +2708,7 @@ SvStream& operator<<( SvStream& rOStrm, const Region& rRegion ) while ( pBand ) { // put boundaries - rOStrm << (UINT16) STREAMENTRY_BANDHEADER; + rOStrm << (sal_uInt16) STREAMENTRY_BANDHEADER; rOStrm << pBand->mnYTop; rOStrm << pBand->mnYBottom; @@ -2542,7 +2717,7 @@ SvStream& operator<<( SvStream& rOStrm, const Region& rRegion ) while ( pSep ) { // put separation - rOStrm << (UINT16) STREAMENTRY_SEPARATION; + rOStrm << (sal_uInt16) STREAMENTRY_SEPARATION; rOStrm << pSep->mnXLeft; rOStrm << pSep->mnXRight; @@ -2554,10 +2729,10 @@ SvStream& operator<<( SvStream& rOStrm, const Region& rRegion ) } // put endmarker - rOStrm << (UINT16) STREAMENTRY_END; + rOStrm << (sal_uInt16) STREAMENTRY_END; // write polypolygon if available - const BOOL bHasPolyPolygon = rRegion.HasPolyPolygon(); + const sal_Bool bHasPolyPolygon = rRegion.HasPolyPolygon(); rOStrm << bHasPolyPolygon; if( bHasPolyPolygon ) @@ -2594,12 +2769,12 @@ void Region::ImplBeginAddRect() // ----------------------------------------------------------------------- -BOOL Region::ImplAddRect( const Rectangle& rRect ) +sal_Bool Region::ImplAddRect( const Rectangle& rRect ) { // Hier kein CheckThis, da nicht alle Daten auf Stand if ( rRect.IsEmpty() ) - return TRUE; + return sal_True; // get justified rectangle long nTop; @@ -2659,7 +2834,7 @@ BOOL Region::ImplAddRect( const Rectangle& rRect ) mpImplRegion->mpLastCheckedBand->Union( nLeft, nRight ); } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -2728,14 +2903,14 @@ void Region::ImplEndAddRect() // ----------------------------------------------------------------------- -ULONG Region::GetRectCount() const +sal_uLong Region::GetRectCount() const { DBG_CHKTHIS( Region, ImplDbgTestRegion ); ((Region*)this)->ImplPolyPolyRegionToBandRegion(); #ifdef DBG_UTIL - ULONG nCount = 0; + sal_uLong nCount = 0; // all bands if not null or empty if ( (mpImplRegion != &aImplEmptyRegion) && (mpImplRegion != &aImplNullRegion) ) @@ -2781,7 +2956,7 @@ RegionHandle Region::BeginEnumRects() ImplRegionHandle* pData = new ImplRegionHandle; pData->mpRegion = new Region( *this ); - pData->mbFirst = TRUE; + pData->mbFirst = sal_True; // save pointers pData->mpCurrRectBand = pData->mpRegion->mpImplRegion->mpFirstBand; @@ -2792,16 +2967,16 @@ RegionHandle Region::BeginEnumRects() // ----------------------------------------------------------------------- -BOOL Region::GetEnumRects( RegionHandle pVoidData, Rectangle& rRect ) +sal_Bool Region::GetEnumRects( RegionHandle pVoidData, Rectangle& rRect ) { DBG_CHKTHIS( Region, ImplDbgTestRegion ); ImplRegionHandle* pData = (ImplRegionHandle*)pVoidData; if ( !pData ) - return FALSE; + return sal_False; if ( pData->mbFirst ) - pData->mbFirst = FALSE; + pData->mbFirst = sal_False; else { // get next separation from current band @@ -2815,7 +2990,7 @@ BOOL Region::GetEnumRects( RegionHandle pVoidData, Rectangle& rRect ) // no band found? -> not further rectangles! if ( !pData->mpCurrRectBand ) - return FALSE; + return sal_False; // get first separation in current band pData->mpCurrRectBandSep = pData->mpCurrRectBand->mpFirstSep; @@ -2827,7 +3002,7 @@ BOOL Region::GetEnumRects( RegionHandle pVoidData, Rectangle& rRect ) rRect.Bottom() = pData->mpCurrRectBand->mnYBottom; rRect.Left() = pData->mpCurrRectBandSep->mnXLeft; rRect.Right() = pData->mpCurrRectBandSep->mnXRight; - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -2851,7 +3026,7 @@ static inline bool ImplPolygonRectTest( const Polygon& rPoly, Rectangle* pRectOu { bool bIsRect = false; const Point* pPoints = rPoly.GetConstPointAry(); - USHORT nPoints = rPoly.GetSize(); + sal_uInt16 nPoints = rPoly.GetSize(); if( nPoints == 4 || (nPoints == 5 && pPoints[0] == pPoints[4]) ) { long nX1 = pPoints[0].X(), nX2 = pPoints[2].X(), @@ -2902,7 +3077,7 @@ Region Region::GetRegionFromPolyPolygon( const PolyPolygon& rPolyPoly ) int nPolygonRects = 0, nPolygonPolygons = 0; int nPolygons = rPolyPoly.Count(); - for( USHORT i = 0; i < nPolygons; i++ ) + for( sal_uInt16 i = 0; i < nPolygons; i++ ) { const Polygon& rPoly = rPolyPoly[i]; if( ImplPolygonRectTest( rPoly ) ) @@ -2915,7 +3090,7 @@ Region Region::GetRegionFromPolyPolygon( const PolyPolygon& rPolyPoly ) Region aResult; Rectangle aRect; - for( USHORT i = 0; i < nPolygons; i++ ) + for( sal_uInt16 i = 0; i < nPolygons; i++ ) { const Polygon& rPoly = rPolyPoly[i]; if( ImplPolygonRectTest( rPoly, &aRect ) ) diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index ea8d10377e61..9fa4d813b2b7 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -171,7 +171,7 @@ void SalGraphics::mirror( long& x, long& nWidth, const OutputDevice *pOutDev, bo } } -BOOL SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint *pPtAry2, const OutputDevice *pOutDev, bool bBack ) const +sal_Bool SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint *pPtAry2, const OutputDevice *pOutDev, bool bBack ) const { long w; if( pOutDev && pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) @@ -244,22 +244,37 @@ BOOL SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint * pPtAry2[j].mnY = pPtAry[i].mnY; } } - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } void SalGraphics::mirror( Region& rRgn, const OutputDevice *pOutDev, bool bBack ) const { - // mirror the bounding rect and move Region by resulting offset - Rectangle aRect( rRgn.GetBoundRect() ); - long nWidth = aRect.GetWidth(); - long x = aRect.Left(); - long x_org = x; + if( rRgn.HasPolyPolygon() ) + { + basegfx::B2DPolyPolygon aPolyPoly( rRgn.ConvertToB2DPolyPolygon() ); + aPolyPoly = mirror( aPolyPoly, pOutDev, bBack ); + rRgn = Region( aPolyPoly ); + } + else + { + ImplRegionInfo aInfo; + bool bRegionRect; + Region aMirroredRegion; + long nX, nY, nWidth, nHeight; - mirror( x, nWidth, pOutDev, bBack ); - rRgn.Move( x - x_org, 0 ); + bRegionRect = rRgn.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight ); + while ( bRegionRect ) + { + Rectangle aRect( Point(nX, nY), Size(nWidth, nHeight) ); + mirror( aRect, pOutDev, bBack ); + aMirroredRegion.Union( aRect ); + bRegionRect = rRgn.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight ); + } + rRgn = aMirroredRegion; + } } void SalGraphics::mirror( Rectangle& rRect, const OutputDevice *pOutDev, bool bBack ) const @@ -357,22 +372,15 @@ basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rP // ---------------------------------------------------------------------------- -BOOL SalGraphics::UnionClipRegion( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) +bool SalGraphics::SetClipRegion( const Region& i_rClip, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) - mirror( nX, nWidth, pOutDev ); - return unionClipRegion( nX, nY, nWidth, nHeight ); -} - -bool SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - return false; -} - -BOOL SalGraphics::UnionClipRegion( const ::basegfx::B2DPolyPolygon& rPoly, const OutputDevice* pOutDev ) -{ - (void)pOutDev;// TODO: SAL_LAYOUT_BIDI_RTL - return unionClipRegion( rPoly ); + { + Region aMirror( i_rClip ); + mirror( aMirror, pOutDev ); + return setClipRegion( aMirror ); + } + return setClipRegion( i_rClip ); } void SalGraphics::DrawPixel( long nX, long nY, const OutputDevice *pOutDev ) @@ -411,12 +419,12 @@ bool SalGraphics::drawPolyLine( return false; } -void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) +void SalGraphics::DrawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; - BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); + sal_Bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); drawPolyLine( nPoints, bCopied ? pPtAry2 : pPtAry ); delete [] pPtAry2; } @@ -424,12 +432,12 @@ void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry, const Out drawPolyLine( nPoints, pPtAry ); } -void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) +void SalGraphics::DrawPolygon( sal_uLong nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; - BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); + sal_Bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); drawPolygon( nPoints, bCopied ? pPtAry2 : pPtAry ); delete [] pPtAry2; } @@ -443,10 +451,10 @@ void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, { // TODO: optimize, reduce new/delete calls SalPoint **pPtAry2 = new SalPoint*[nPoly]; - ULONG i; + sal_uLong i; for(i=0; i<nPoly; i++) { - ULONG nPoints = pPoints[i]; + sal_uLong nPoints = pPoints[i]; pPtAry2[i] = new SalPoint[ nPoints ]; mirror( nPoints, pPtAry[i], pPtAry2[i], pOutDev ); } @@ -464,7 +472,7 @@ void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, bool SalGraphics::DrawPolyPolygon( const ::basegfx::B2DPolyPolygon& i_rPolyPolygon, double i_fTransparency, const OutputDevice* i_pOutDev ) { bool bRet = false; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) { basegfx::B2DPolyPolygon aMirror( mirror( i_rPolyPolygon, i_pOutDev ) ); bRet = drawPolyPolygon( aMirror, i_fTransparency ); @@ -479,13 +487,13 @@ bool SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fT return false; } -sal_Bool SalGraphics::DrawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry, const OutputDevice* pOutDev ) +sal_Bool SalGraphics::DrawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry, const OutputDevice* pOutDev ) { sal_Bool bResult = sal_False; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; - BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); + sal_Bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); bResult = drawPolyLineBezier( nPoints, bCopied ? pPtAry2 : pPtAry, pFlgAry ); delete [] pPtAry2; } @@ -494,13 +502,13 @@ sal_Bool SalGraphics::DrawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, return bResult; } -sal_Bool SalGraphics::DrawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry, const OutputDevice* pOutDev ) +sal_Bool SalGraphics::DrawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry, const OutputDevice* pOutDev ) { sal_Bool bResult = sal_False; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; - BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); + sal_Bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); bResult = drawPolygonBezier( nPoints, bCopied ? pPtAry2 : pPtAry, pFlgAry ); delete [] pPtAry2; } @@ -510,17 +518,17 @@ sal_Bool SalGraphics::DrawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, } sal_Bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt32* i_pPoints, - const SalPoint* const* i_pPtAry, const BYTE* const* i_pFlgAry, const OutputDevice* i_pOutDev ) + const SalPoint* const* i_pPtAry, const sal_uInt8* const* i_pFlgAry, const OutputDevice* i_pOutDev ) { sal_Bool bRet = sal_False; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) { // TODO: optimize, reduce new/delete calls SalPoint **pPtAry2 = new SalPoint*[i_nPoly]; - ULONG i; + sal_uLong i; for(i=0; i<i_nPoly; i++) { - ULONG nPoints = i_pPoints[i]; + sal_uLong nPoints = i_pPoints[i]; pPtAry2[i] = new SalPoint[ nPoints ]; mirror( nPoints, i_pPtAry[i], pPtAry2[i], i_pOutDev ); } @@ -541,7 +549,7 @@ bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon, double const OutputDevice* i_pOutDev ) { bool bRet = false; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) { basegfx::B2DPolygon aMirror( mirror( i_rPolygon, i_pOutDev ) ); bRet = drawPolyLine( aMirror, fTransparency, i_rLineWidth, i_eLineJoin ); @@ -554,7 +562,7 @@ bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon, double void SalGraphics::CopyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, - USHORT nFlags, const OutputDevice *pOutDev ) + sal_uInt16 nFlags, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { @@ -648,12 +656,12 @@ void SalGraphics::Invert( long nX, long nY, long nWidth, long nHeight, SalInv mirror( nX, nWidth, pOutDev ); invert( nX, nY, nWidth, nHeight, nFlags ); } -void SalGraphics::Invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags, const OutputDevice *pOutDev ) +void SalGraphics::Invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; - BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); + sal_Bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); invert( nPoints, bCopied ? pPtAry2 : pPtAry, nFlags ); delete [] pPtAry2; } @@ -661,15 +669,15 @@ void SalGraphics::Invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nF invert( nPoints, pPtAry, nFlags ); } -BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize, const OutputDevice *pOutDev ) +sal_Bool SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return drawEPS( nX, nY, nWidth, nHeight, pPtr, nSize ); } -BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, - const Point& aPos, BOOL& rIsInside, const OutputDevice *pOutDev ) +sal_Bool SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + const Point& aPos, sal_Bool& rIsInside, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { @@ -718,7 +726,7 @@ void SalGraphics::mirror( ControlType , const ImplControlValue& rVal, const Outp } } -BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, +sal_Bool SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, const OutputDevice *pOutDev ) { @@ -727,7 +735,7 @@ BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Rectangle rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); - BOOL bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, aCaption ); + sal_Bool bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, aCaption ); mirror( nType, aValue, pOutDev, true ); return bRet; } @@ -735,7 +743,7 @@ BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, aCaption ); } -BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, +sal_Bool SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, const OutputDevice *pOutDev ) { @@ -744,7 +752,7 @@ BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, c Rectangle rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); - BOOL bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, aCaption ); + sal_Bool bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, aCaption ); mirror( nType, aValue, pOutDev, true ); return bRet; } @@ -752,7 +760,7 @@ BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, c return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, aCaption ); } -BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, +sal_Bool SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion, const OutputDevice *pOutDev ) { @@ -767,12 +775,12 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, mirror( rNativeBoundingRegion, pOutDev, true ); mirror( rNativeContentRegion, pOutDev, true ); mirror( nType, aValue, pOutDev, true ); - return TRUE; + return sal_True; } else { mirror( nType, aValue, pOutDev, true ); - return FALSE; + return sal_False; } } else @@ -812,7 +820,7 @@ bool SalGraphics::filterText( const String&, String&, xub_StrLen, xub_StrLen&, x void SalGraphics::AddDevFontSubstitute( OutputDevice* pOutDev, const String& rFontName, const String& rReplaceFontName, - USHORT nFlags ) + sal_uInt16 nFlags ) { pOutDev->ImplAddDevFontSubstitute( rFontName, rReplaceFontName, nFlags ); } diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx index 293098496d15..3a9bd669f54f 100644 --- a/vcl/source/gdi/salmisc.cxx +++ b/vcl/source/gdi/salmisc.cxx @@ -102,12 +102,12 @@ static void ImplPALToPAL( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuff BitmapColor* pColMapBuf = aColMap.ImplGetColorBuffer(); BitmapColor aIndex( 0 ); - for( USHORT i = 0, nSrcCount = aColMap.GetEntryCount(), nDstCount = rDstBuffer.maPalette.GetEntryCount(); i < nSrcCount; i++ ) + for( sal_uInt16 i = 0, nSrcCount = aColMap.GetEntryCount(), nDstCount = rDstBuffer.maPalette.GetEntryCount(); i < nSrcCount; i++ ) { if( ( i < nDstCount ) && ( rSrcBuffer.maPalette[ i ] == rDstBuffer.maPalette[ i ] ) ) - aIndex.SetIndex( sal::static_int_cast<BYTE>(i) ); + aIndex.SetIndex( sal::static_int_cast<sal_uInt8>(i) ); else - aIndex.SetIndex( sal::static_int_cast<BYTE>(rDstBuffer.maPalette.GetBestIndex( rSrcBuffer.maPalette[ i ] )) ); + aIndex.SetIndex( sal::static_int_cast<sal_uInt8>(rDstBuffer.maPalette.GetBestIndex( rSrcBuffer.maPalette[ i ] )) ); pColMapBuf[ i ] = aIndex; } @@ -213,7 +213,7 @@ static void ImplTCToTC( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffer if( BMP_SCANLINE_FORMAT( rSrcBuffer.mnFormat ) == BMP_FORMAT_24BIT_TC_BGR ) { BitmapColor aCol; - BYTE* pPixel = NULL; + sal_uInt8* pPixel = NULL; for( long nActY = 0, nMapY; nActY < nHeight; nActY++ ) { @@ -254,7 +254,7 @@ static void ImplTCToPAL( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffe const ColorMask& rSrcMask = rSrcBuffer.maColorMask; const ColorMask& rDstMask = rDstBuffer.maColorMask; BitmapPalette aColMap( rSrcBuffer.maPalette.GetEntryCount() ); - BYTE* pColToPalMap = new BYTE[ TC_TO_PAL_COLORS ]; + sal_uInt8* pColToPalMap = new sal_uInt8[ TC_TO_PAL_COLORS ]; BitmapColor aIndex( 0 ); for( long nR = 0; nR < 16; nR++ ) @@ -263,10 +263,10 @@ static void ImplTCToPAL( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffe { for( long nB = 0; nB < 16; nB++ ) { - BitmapColor aCol( sal::static_int_cast<BYTE>(nR << 4), - sal::static_int_cast<BYTE>(nG << 4), - sal::static_int_cast<BYTE>(nB << 4) ); - pColToPalMap[ ImplIndexFromColor( aCol ) ] = (BYTE) rDstBuffer.maPalette.GetBestIndex( aCol ); + BitmapColor aCol( sal::static_int_cast<sal_uInt8>(nR << 4), + sal::static_int_cast<sal_uInt8>(nG << 4), + sal::static_int_cast<sal_uInt8>(nB << 4) ); + pColToPalMap[ ImplIndexFromColor( aCol ) ] = (sal_uInt8) rDstBuffer.maPalette.GetBestIndex( aCol ); } } } @@ -294,7 +294,7 @@ static void ImplTCToPAL( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffe // --------------------- BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRect& rTwoRect, - ULONG nDstBitmapFormat, BitmapPalette* pDstPal, ColorMask* pDstMask ) + sal_uLong nDstBitmapFormat, BitmapPalette* pDstPal, ColorMask* pDstMask ) { FncGetPixel pFncGetPixel; FncSetPixel pFncSetPixel; @@ -331,7 +331,7 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec } // set function for setting pixels - const ULONG nDstScanlineFormat = BMP_SCANLINE_FORMAT( nDstBitmapFormat ); + const sal_uLong nDstScanlineFormat = BMP_SCANLINE_FORMAT( nDstBitmapFormat ); switch( nDstScanlineFormat ) { IMPL_CASE_SET_FORMAT( _1BIT_MSB_PAL, 1 ); @@ -368,7 +368,7 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec pDstBuffer->mnScanlineSize = AlignedWidth4Bytes( pDstBuffer->mnBitCount * pDstBuffer->mnWidth ); try { - pDstBuffer->mpBits = new BYTE[ pDstBuffer->mnScanlineSize * pDstBuffer->mnHeight ]; + pDstBuffer->mpBits = new sal_uInt8[ pDstBuffer->mnScanlineSize * pDstBuffer->mnHeight ]; } catch( const std::bad_alloc& ) { diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx index 0bf74e46d3fd..cc204069c2c4 100644 --- a/vcl/source/gdi/salnativewidgets-none.cxx +++ b/vcl/source/gdi/salnativewidgets-none.cxx @@ -41,29 +41,29 @@ using ::rtl::OUString; /* * IsNativeControlSupported() * - * Returns TRUE if the platform supports native + * Returns sal_True if the platform supports native * drawing of the control defined by nPart */ -BOOL SalGraphics::IsNativeControlSupported( ControlType, ControlPart ) +sal_Bool SalGraphics::IsNativeControlSupported( ControlType, ControlPart ) { - return( FALSE ); + return( sal_False ); } /* * HitTestNativeControl() * - * If the return value is TRUE, bIsInside contains information whether + * If the return value is sal_True, bIsInside contains information whether * aPos was or was not inside the native widget specified by the * nType/nPart combination. */ -BOOL SalGraphics::hitTestNativeControl( ControlType, +sal_Bool SalGraphics::hitTestNativeControl( ControlType, ControlPart, const Rectangle&, const Point&, - BOOL& ) + sal_Bool& ) { - return( FALSE ); + return( sal_False ); } @@ -76,14 +76,14 @@ BOOL SalGraphics::hitTestNativeControl( ControlType, * aValue: An optional value (tristate/numerical/string) * aCaption: A caption or title string (like button text etc) */ -BOOL SalGraphics::drawNativeControl( ControlType, +sal_Bool SalGraphics::drawNativeControl( ControlType, ControlPart, const Rectangle&, ControlState, const ImplControlValue&, const OUString& ) { - return( FALSE ); + return( sal_False ); } @@ -97,22 +97,22 @@ BOOL SalGraphics::drawNativeControl( ControlType, * aValue: An optional value (tristate/numerical/string) * aCaption: A caption or title string (like button text etc) */ -BOOL SalGraphics::drawNativeControlText( ControlType, +sal_Bool SalGraphics::drawNativeControlText( ControlType, ControlPart, const Rectangle&, ControlState, const ImplControlValue&, const OUString& ) { - return( FALSE ); + return( sal_False ); } /* * GetNativeControlRegion() * - * If the return value is TRUE, rNativeBoundingRegion - * contains the TRUE bounding region covered by the control + * If the return value is sal_True, rNativeBoundingRegion + * contains the sal_True bounding region covered by the control * including any adornment, while rNativeContentRegion contains the area * within the control that can be safely drawn into without drawing over * the borders of the control. @@ -121,7 +121,7 @@ BOOL SalGraphics::drawNativeControlText( ControlType, * aValue: An optional value (tristate/numerical/string) * aCaption: A caption or title string (like button text etc) */ -BOOL SalGraphics::getNativeControlRegion( ControlType, +sal_Bool SalGraphics::getNativeControlRegion( ControlType, ControlPart, const Rectangle&, ControlState, @@ -130,7 +130,7 @@ BOOL SalGraphics::getNativeControlRegion( ControlType, Rectangle &, Rectangle & ) { - return( FALSE ); + return( sal_False ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/svcompat.cxx b/vcl/source/gdi/svcompat.cxx index 8415d5bbfc39..c594dd1f93d7 100644 --- a/vcl/source/gdi/svcompat.cxx +++ b/vcl/source/gdi/svcompat.cxx @@ -35,7 +35,7 @@ // - ImplCompat - // -------------- -ImplCompat::ImplCompat( SvStream& rStm, USHORT nStreamMode, USHORT nVersion ) : +ImplCompat::ImplCompat( SvStream& rStm, sal_uInt16 nStreamMode, sal_uInt16 nVersion ) : mpRWStm ( &rStm ), mnStmMode ( nStreamMode ), mnVersion ( nVersion ) @@ -63,7 +63,7 @@ ImplCompat::~ImplCompat() { if( STREAM_WRITE == mnStmMode ) { - const UINT32 nEndPos = mpRWStm->Tell(); + const sal_uInt32 nEndPos = mpRWStm->Tell(); mpRWStm->Seek( mnCompatPos ); *mpRWStm << ( nEndPos - mnTotalSize ); @@ -71,7 +71,7 @@ ImplCompat::~ImplCompat() } else { - const UINT32 nReadSize = mpRWStm->Tell() - mnCompatPos; + const sal_uInt32 nReadSize = mpRWStm->Tell() - mnCompatPos; if( mnTotalSize > nReadSize ) mpRWStm->SeekRel( mnTotalSize - nReadSize ); diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index 6a9470abe251..421cd6a33f0a 100644..100755 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -110,7 +110,7 @@ namespace vcl public: // equivalents to the respective OutputDevice methods, which take the reference device into account long GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; - Rectangle DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ); + Rectangle DrawText( const Rectangle& _rRect, const XubString& _rText, sal_uInt16 _nStyle, MetricVector* _pVector, String* _pDisplayText ); protected: void onBeginDrawText() @@ -310,13 +310,13 @@ namespace vcl } //-------------------------------------------------------------------- - Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) + Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const XubString& _rText, sal_uInt16 _nStyle, MetricVector* _pVector, String* _pDisplayText ) { if ( !_rText.Len() ) return Rectangle(); // determine text layout mode from the RTL-ness of the control whose text we render - ULONG nTextLayoutMode = m_bRTLEnabled ? TEXT_LAYOUT_BIDI_RTL : TEXT_LAYOUT_BIDI_LTR; + sal_uLong nTextLayoutMode = m_bRTLEnabled ? TEXT_LAYOUT_BIDI_RTL : TEXT_LAYOUT_BIDI_LTR; m_rReferenceDevice.SetLayoutMode( nTextLayoutMode ); m_rTargetDevice.SetLayoutMode( nTextLayoutMode | TEXT_LAYOUT_TEXTORIGIN_LEFT ); // TEXT_LAYOUT_TEXTORIGIN_LEFT is because when we do actually draw the text (in DrawText( Point, ... )), then @@ -376,7 +376,7 @@ namespace vcl } //-------------------------------------------------------------------- - Rectangle ControlTextRenderer::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, + Rectangle ControlTextRenderer::DrawText( const Rectangle& _rRect, const XubString& _rText, sal_uInt16 _nStyle, MetricVector* _pVector, String* _pDisplayText ) { return m_pImpl->DrawText( _rRect, _rText, _nStyle, _pVector, _pDisplayText ); diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index e3aac410b300..e7ec24ca87d2 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -47,7 +47,7 @@ using namespace ::com::sun::star::uno; // ======================================================================= void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev, - long nDX, long nDY, USHORT nBitCount, const SystemGraphicsData *pData ) + long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) { DBG_ASSERT( nBitCount <= 1, "VirtualDevice::VirtualDevice(): Only 0 or 1 is for BitCount allowed" ); @@ -85,7 +85,7 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev, mnBitCount = ( nBitCount ? nBitCount : pOutDev->GetBitCount() ); mnOutWidth = nDX; mnOutHeight = nDY; - mbScreenComp = TRUE; + mbScreenComp = sal_True; mnAlphaDepth = -1; // #i59315# init vdev size from system object, when passed a @@ -98,12 +98,12 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev, SetAntialiasing( ANTIALIASING_DISABLE_TEXT ); if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER ) - mbScreenComp = FALSE; + mbScreenComp = sal_False; else if ( pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) mbScreenComp = ((VirtualDevice*)pOutDev)->mbScreenComp; meOutDevType = OUTDEV_VIRDEV; - mbDevOutput = TRUE; + mbDevOutput = sal_True; mpFontList = pSVData->maGDIData.mpScreenFontList; mpFontCache = pSVData->maGDIData.mpScreenFontCache; mnDPIX = pOutDev->mnDPIX; @@ -135,7 +135,7 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev, // ----------------------------------------------------------------------- -VirtualDevice::VirtualDevice( USHORT nBitCount ) +VirtualDevice::VirtualDevice( sal_uInt16 nBitCount ) : mpVirDev( NULL ), meRefDevMode( REFDEV_NONE ) { @@ -146,7 +146,7 @@ VirtualDevice::VirtualDevice( USHORT nBitCount ) // ----------------------------------------------------------------------- -VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, USHORT nBitCount ) +VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount ) : mpVirDev( NULL ), meRefDevMode( REFDEV_NONE ) { @@ -157,7 +157,7 @@ VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, USHORT nBitCount ) // ----------------------------------------------------------------------- -VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, USHORT nBitCount, USHORT nAlphaBitCount ) +VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount, sal_uInt16 nAlphaBitCount ) : mpVirDev( NULL ), meRefDevMode( REFDEV_NONE ) { @@ -171,7 +171,7 @@ VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, USHORT nBitCount, US // ----------------------------------------------------------------------- -VirtualDevice::VirtualDevice( const SystemGraphicsData *pData, USHORT nBitCount ) +VirtualDevice::VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCount ) : mpVirDev( NULL ), meRefDevMode( REFDEV_NONE ) { @@ -207,20 +207,20 @@ VirtualDevice::~VirtualDevice() // ----------------------------------------------------------------------- -BOOL VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, BOOL bErase ) +sal_Bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, sal_Bool bErase ) { DBG_TRACE3( "VirtualDevice::ImplSetOutputSizePixel( %ld, %ld, %d )", rNewSize.Width(), rNewSize.Height(), (int)bErase ); if ( !mpVirDev ) - return FALSE; + return sal_False; else if ( rNewSize == GetOutputSizePixel() ) { if ( bErase ) Erase(); - return TRUE; + return sal_True; } - BOOL bRet; + sal_Bool bRet; long nNewWidth = rNewSize.Width(), nNewHeight = rNewSize.Height(); if ( nNewWidth < 1 ) @@ -249,7 +249,7 @@ BOOL VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, BOOL bErase ) if ( !mpGraphics ) { if ( !ImplGetGraphics() ) - return FALSE; + return sal_False; } pNewVirDev = pSVData->mpDefInst->CreateVirtualDevice( mpGraphics, nNewWidth, nNewHeight, mnBitCount ); @@ -285,16 +285,16 @@ BOOL VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, BOOL bErase ) mpVirDev = pNewVirDev; mnOutWidth = rNewSize.Width(); mnOutHeight = rNewSize.Height(); - bRet = TRUE; + bRet = sal_True; } else { - bRet = FALSE; + bRet = sal_False; pSVData->mpDefInst->DestroyVirtualDevice( pNewVirDev ); } } else - bRet = FALSE; + bRet = sal_False; } return bRet; @@ -318,7 +318,7 @@ void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect ) // ----------------------------------------------------------------------- -BOOL VirtualDevice::SetOutputSizePixel( const Size& rNewSize, BOOL bErase ) +sal_Bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, sal_Bool bErase ) { if( ImplSetOutputSizePixel(rNewSize, bErase) ) { @@ -347,10 +347,10 @@ BOOL VirtualDevice::SetOutputSizePixel( const Size& rNewSize, BOOL bErase ) mpAlphaVDev->SetMapMode( GetMapMode() ); } - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -362,7 +362,7 @@ void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode ) { case REFDEV_NONE: default: - DBG_ASSERT( FALSE, "VDev::SetRefDev illegal argument!" ); + DBG_ASSERT( sal_False, "VDev::SetRefDev illegal argument!" ); break; case REFDEV_MODE06: nDPIX = nDPIY = 600; @@ -390,17 +390,17 @@ void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32 mnDPIX = i_nDPIX; mnDPIY = i_nDPIY; - EnableOutput( FALSE ); // prevent output on reference device - mbScreenComp = FALSE; + EnableOutput( sal_False ); // prevent output on reference device + mbScreenComp = sal_False; // invalidate currently selected fonts - mbInitFont = TRUE; - mbNewFont = TRUE; + mbInitFont = sal_True; + mbNewFont = sal_True; // avoid adjusting font lists when already in refdev mode - BYTE nOldRefDevMode = meRefDevMode; - BYTE nOldCompatFlag = (BYTE)meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD; - meRefDevMode = (BYTE)(i_eRefDevMode | nOldCompatFlag); + sal_uInt8 nOldRefDevMode = meRefDevMode; + sal_uInt8 nOldCompatFlag = (sal_uInt8)meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD; + meRefDevMode = (sal_uInt8)(i_eRefDevMode | nOldCompatFlag); if( (nOldRefDevMode ^ nOldCompatFlag) != REFDEV_NONE ) return; @@ -441,7 +441,7 @@ void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32 void VirtualDevice::Compat_ZeroExtleadBug() { - meRefDevMode = (BYTE)meRefDevMode | REFDEV_FORCE_ZERO_EXTLEAD; + meRefDevMode = (sal_uInt8)meRefDevMode | REFDEV_FORCE_ZERO_EXTLEAD; } // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx index 2feff9a9f5ef..600f78941cbe 100644 --- a/vcl/source/gdi/wall.cxx +++ b/vcl/source/gdi/wall.cxx @@ -112,7 +112,7 @@ void ImplWallpaper::ImplReleaseCachedBitmap() SvStream& operator>>( SvStream& rIStm, ImplWallpaper& rImplWallpaper ) { VersionCompat aCompat( rIStm, STREAM_READ ); - UINT16 nTmp16; + sal_uInt16 nTmp16; delete rImplWallpaper.mpRect; rImplWallpaper.mpRect = NULL; @@ -130,7 +130,7 @@ SvStream& operator>>( SvStream& rIStm, ImplWallpaper& rImplWallpaper ) // version 2 if( aCompat.GetVersion() >= 2 ) { - BOOL bRect, bGrad, bBmp, bDummy; + sal_Bool bRect, bGrad, bBmp, bDummy; rIStm >> bRect >> bGrad >> bBmp >> bDummy >> bDummy >> bDummy; @@ -155,7 +155,7 @@ SvStream& operator>>( SvStream& rIStm, ImplWallpaper& rImplWallpaper ) // version 3 (new color format) if( aCompat.GetVersion() >= 3 ) { - rImplWallpaper.maColor.Read( rIStm, TRUE ); + rImplWallpaper.maColor.Read( rIStm, sal_True ); } } @@ -167,13 +167,13 @@ SvStream& operator>>( SvStream& rIStm, ImplWallpaper& rImplWallpaper ) SvStream& operator<<( SvStream& rOStm, const ImplWallpaper& rImplWallpaper ) { VersionCompat aCompat( rOStm, STREAM_WRITE, 3 ); - BOOL bRect = ( rImplWallpaper.mpRect != NULL ); - BOOL bGrad = ( rImplWallpaper.mpGradient != NULL ); - BOOL bBmp = ( rImplWallpaper.mpBitmap != NULL ); - BOOL bDummy = FALSE; + sal_Bool bRect = ( rImplWallpaper.mpRect != NULL ); + sal_Bool bGrad = ( rImplWallpaper.mpGradient != NULL ); + sal_Bool bBmp = ( rImplWallpaper.mpBitmap != NULL ); + sal_Bool bDummy = sal_False; // version 1 - rOStm << rImplWallpaper.maColor << (UINT16) rImplWallpaper.meStyle; + rOStm << rImplWallpaper.maColor << (sal_uInt16) rImplWallpaper.meStyle; // version 2 rOStm << bRect << bGrad << bBmp << bDummy << bDummy << bDummy; @@ -188,14 +188,14 @@ SvStream& operator<<( SvStream& rOStm, const ImplWallpaper& rImplWallpaper ) rOStm << *rImplWallpaper.mpBitmap; // version 3 (new color format) - ( (Color&) rImplWallpaper.maColor ).Write( rOStm, TRUE ); + ( (Color&) rImplWallpaper.maColor ).Write( rOStm, sal_True ); return rOStm; } // ----------------------------------------------------------------------- -inline void Wallpaper::ImplMakeUnique( BOOL bReleaseCache ) +inline void Wallpaper::ImplMakeUnique( sal_Bool bReleaseCache ) { // Falls noch andere Referenzen bestehen, dann kopieren if ( mpImplWallpaper->mnRefCount != 1 ) @@ -314,7 +314,7 @@ void Wallpaper::SetStyle( WallpaperStyle eStyle ) { DBG_CHKTHIS( Wallpaper, NULL ); - ImplMakeUnique( FALSE ); + ImplMakeUnique( sal_False ); if( eStyle == WALLPAPER_APPLICATIONGRADIENT ) // set a dummy gradient, the correct gradient @@ -392,7 +392,7 @@ BitmapEx Wallpaper::GetBitmap() const // ----------------------------------------------------------------------- -BOOL Wallpaper::IsBitmap() const +sal_Bool Wallpaper::IsBitmap() const { DBG_CHKTHIS( Wallpaper, NULL ); @@ -450,7 +450,7 @@ Gradient Wallpaper::GetGradient() const // ----------------------------------------------------------------------- -BOOL Wallpaper::IsGradient() const +sal_Bool Wallpaper::IsGradient() const { DBG_CHKTHIS( Wallpaper, NULL ); @@ -480,7 +480,7 @@ void Wallpaper::SetRect( const Rectangle& rRect ) { DBG_CHKTHIS( Wallpaper, NULL ); - ImplMakeUnique( FALSE ); + ImplMakeUnique( sal_False ); if ( rRect.IsEmpty() ) { @@ -507,7 +507,7 @@ void Wallpaper::SetRect() if ( mpImplWallpaper->mpRect ) { - ImplMakeUnique( FALSE ); + ImplMakeUnique( sal_False ); delete mpImplWallpaper->mpRect; mpImplWallpaper->mpRect = NULL; } @@ -530,7 +530,7 @@ Rectangle Wallpaper::GetRect() const // ----------------------------------------------------------------------- -BOOL Wallpaper::IsRect() const +sal_Bool Wallpaper::IsRect() const { DBG_CHKTHIS( Wallpaper, NULL ); @@ -540,26 +540,26 @@ BOOL Wallpaper::IsRect() const // ----------------------------------------------------------------------- -BOOL Wallpaper::IsFixed() const +sal_Bool Wallpaper::IsFixed() const { if ( mpImplWallpaper->meStyle == WALLPAPER_NULL ) - return FALSE; + return sal_False; else return (!mpImplWallpaper->mpBitmap && !mpImplWallpaper->mpGradient); } // ----------------------------------------------------------------------- -BOOL Wallpaper::IsScrollable() const +sal_Bool Wallpaper::IsScrollable() const { if ( mpImplWallpaper->meStyle == WALLPAPER_NULL ) - return FALSE; + return sal_False; else if ( !mpImplWallpaper->mpBitmap && !mpImplWallpaper->mpGradient ) - return TRUE; + return sal_True; else if ( mpImplWallpaper->mpBitmap ) return (mpImplWallpaper->meStyle == WALLPAPER_TILE); else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -591,37 +591,37 @@ Wallpaper& Wallpaper::operator=( const Wallpaper& rWallpaper ) // ----------------------------------------------------------------------- -BOOL Wallpaper::operator==( const Wallpaper& rWallpaper ) const +sal_Bool Wallpaper::operator==( const Wallpaper& rWallpaper ) const { DBG_CHKTHIS( Wallpaper, NULL ); DBG_CHKOBJ( &rWallpaper, Wallpaper, NULL ); if ( mpImplWallpaper == rWallpaper.mpImplWallpaper ) - return TRUE; + return sal_True; if ( ( mpImplWallpaper->meStyle != rWallpaper.mpImplWallpaper->meStyle ) || ( mpImplWallpaper->maColor != rWallpaper.mpImplWallpaper->maColor ) ) - return FALSE; + return sal_False; if ( mpImplWallpaper->mpRect != rWallpaper.mpImplWallpaper->mpRect && ( !mpImplWallpaper->mpRect || !rWallpaper.mpImplWallpaper->mpRect || *(mpImplWallpaper->mpRect) != *(rWallpaper.mpImplWallpaper->mpRect) ) ) - return FALSE; + return sal_False; if ( mpImplWallpaper->mpBitmap != rWallpaper.mpImplWallpaper->mpBitmap && ( !mpImplWallpaper->mpBitmap || !rWallpaper.mpImplWallpaper->mpBitmap || *(mpImplWallpaper->mpBitmap) != *(rWallpaper.mpImplWallpaper->mpBitmap) ) ) - return FALSE; + return sal_False; if ( mpImplWallpaper->mpGradient != rWallpaper.mpImplWallpaper->mpGradient && ( !mpImplWallpaper->mpGradient || !rWallpaper.mpImplWallpaper->mpGradient || *(mpImplWallpaper->mpGradient) != *(rWallpaper.mpImplWallpaper->mpGradient) ) ) - return FALSE; + return sal_False; - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx index cc798549b48c..6a27dac4330f 100644 --- a/vcl/source/glyphs/gcach_ftyp.cxx +++ b/vcl/source/glyphs/gcach_ftyp.cxx @@ -303,6 +303,7 @@ FtFontInfo::FtFontInfo( const ImplDevFontAttributes& rDevFontAttributes, mnSynthetic( nSynthetic ), mnFontId( nFontId ), maDevFontAttributes( rDevFontAttributes ), + mpFontCharMap( NULL ), mpChar2Glyph( NULL ), mpGlyph2Char( NULL ), mpExtraKernInfo( pExtraKernInfo ) @@ -320,6 +321,8 @@ FtFontInfo::FtFontInfo( const ImplDevFontAttributes& rDevFontAttributes, FtFontInfo::~FtFontInfo() { + if( mpFontCharMap ) + mpFontCharMap->DeReference(); delete mpExtraKernInfo; delete mpChar2Glyph; delete mpGlyph2Char; @@ -406,7 +409,7 @@ static unsigned GetUShort( const unsigned char* p ){ return((p[0]<<8)+p[1]);} // ----------------------------------------------------------------------- -const unsigned char* FtFontInfo::GetTable( const char* pTag, ULONG* pLength ) const +const unsigned char* FtFontInfo::GetTable( const char* pTag, sal_uLong* pLength ) const { const unsigned char* pBuffer = mpFontFile->GetBuffer(); int nFileSize = mpFontFile->GetFileSize(); @@ -429,7 +432,7 @@ const unsigned char* FtFontInfo::GetTable( const char* pTag, ULONG* pLength ) co { if( p[0]==pTag[0] && p[1]==pTag[1] && p[2]==pTag[2] && p[3]==pTag[3] ) { - ULONG nLength = GetUInt( p + 12 ); + sal_uLong nLength = GetUInt( p + 12 ); if( pLength != NULL ) *pLength = nLength; const unsigned char* pTable = pBuffer + GetUInt( p + 8 ); @@ -522,10 +525,25 @@ void* FreetypeServerFont::GetFtFace() const FreetypeManager::~FreetypeManager() { -// This crashes on Solaris 10 -// TODO: check which versions have this problem -// -// FT_Error rcFT = FT_Done_FreeType( aLibFT ); + // an application about to exit can omit garbage collecting the heap + // since it makes things slower and introduces risks if the heap was not perfect + // for debugging, for memory grinding or leak checking the env allows to force GC + const char* pEnv = getenv( "SAL_FORCE_GC_ON_EXIT" ); + if( pEnv && (*pEnv != '0') ) + { + // cleanup container of fontinfos + for( FontList::const_iterator it = maFontList.begin(); it != maFontList.end(); ++it ) + { + FtFontInfo* pInfo = (*it).second; + delete pInfo; + } + maFontList.clear(); + +#if 0 // FT_Done_FreeType crashes on Solaris 10 + // TODO: check which versions have this problem + FT_Error rcFT = FT_Done_FreeType( aLibFT ); +#endif + } } // ----------------------------------------------------------------------- @@ -1022,7 +1040,7 @@ void FreetypeServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor // Check for CJK capabilities of the current font // #107888# workaround for Asian... // TODO: remove when ExtLeading fully implemented - BOOL bCJKCapable = ((pOS2->ulUnicodeRange2 & 0x2DF00000) != 0); + sal_Bool bCJKCapable = ((pOS2->ulUnicodeRange2 & 0x2DF00000) != 0); if ( bCJKCapable && (pOS2->usWinAscent || pOS2->usWinDescent) ) { @@ -1449,7 +1467,7 @@ bool FreetypeServerFont::GetGlyphBitmap1( int nGlyphIndex, RawBitmap& rRawBitmap // #i15743# freetype API 2.1.3 changed the FT_RENDER_MODE_MONO constant FT_Render_Mode nRenderMode = (FT_Render_Mode)((nFTVERSION<2103) ? 1 : FT_RENDER_MODE_MONO); - rc = FT_Glyph_To_Bitmap( &pGlyphFT, nRenderMode, NULL, TRUE ); + rc = FT_Glyph_To_Bitmap( &pGlyphFT, nRenderMode, NULL, sal_True ); if( rc != FT_Err_Ok ) { FT_Done_Glyph( pGlyphFT ); @@ -1477,7 +1495,7 @@ bool FreetypeServerFont::GetGlyphBitmap1( int nGlyphIndex, RawBitmap& rRawBitmap rRawBitmap.mnScanlineSize = rBitmapFT.pitch; } - const ULONG nNeededSize = rRawBitmap.mnScanlineSize * rRawBitmap.mnHeight; + const sal_uLong nNeededSize = rRawBitmap.mnScanlineSize * rRawBitmap.mnHeight; if( rRawBitmap.mnAllocated < nNeededSize ) { @@ -1503,10 +1521,10 @@ bool FreetypeServerFont::GetGlyphBitmap1( int nGlyphIndex, RawBitmap& rRawBitmap } unsigned char* p = rRawBitmap.mpBits; - for( ULONG y=0; y < rRawBitmap.mnHeight; y++ ) + for( sal_uLong y=0; y < rRawBitmap.mnHeight; y++ ) { unsigned char nLastByte = 0; - for( ULONG x=0; x < rRawBitmap.mnScanlineSize; x++ ) + for( sal_uLong x=0; x < rRawBitmap.mnScanlineSize; x++ ) { unsigned char nTmp = p[x] << 7; p[x] |= (p[x] >> 1) | nLastByte; @@ -1604,7 +1622,7 @@ bool FreetypeServerFont::GetGlyphBitmap8( int nGlyphIndex, RawBitmap& rRawBitmap bool bEmbedded = (pGlyphFT->format == FT_GLYPH_FORMAT_BITMAP); if( !bEmbedded ) { - rc = FT_Glyph_To_Bitmap( &pGlyphFT, FT_RENDER_MODE_NORMAL, NULL, TRUE ); + rc = FT_Glyph_To_Bitmap( &pGlyphFT, FT_RENDER_MODE_NORMAL, NULL, sal_True ); if( rc != FT_Err_Ok ) { FT_Done_Glyph( pGlyphFT ); @@ -1628,7 +1646,7 @@ bool FreetypeServerFont::GetGlyphBitmap8( int nGlyphIndex, RawBitmap& rRawBitmap } rRawBitmap.mnScanlineSize = (rRawBitmap.mnScanlineSize + 3) & -4; - const ULONG nNeededSize = rRawBitmap.mnScanlineSize * rRawBitmap.mnHeight; + const sal_uLong nNeededSize = rRawBitmap.mnScanlineSize * rRawBitmap.mnHeight; if( rRawBitmap.mnAllocated < nNeededSize ) { delete[] rRawBitmap.mpBits; @@ -1668,10 +1686,10 @@ bool FreetypeServerFont::GetGlyphBitmap8( int nGlyphIndex, RawBitmap& rRawBitmap { // overlay with glyph image shifted by one left pixel unsigned char* p = rRawBitmap.mpBits; - for( ULONG y=0; y < rRawBitmap.mnHeight; y++ ) + for( sal_uLong y=0; y < rRawBitmap.mnHeight; y++ ) { unsigned char nLastByte = 0; - for( ULONG x=0; x < rRawBitmap.mnWidth; x++ ) + for( sal_uLong x=0; x < rRawBitmap.mnWidth; x++ ) { unsigned char nTmp = p[x]; p[x] |= p[x] | nLastByte; @@ -1684,9 +1702,9 @@ bool FreetypeServerFont::GetGlyphBitmap8( int nGlyphIndex, RawBitmap& rRawBitmap if( !bEmbedded && mbUseGamma ) { unsigned char* p = rRawBitmap.mpBits; - for( ULONG y=0; y < rRawBitmap.mnHeight; y++ ) + for( sal_uLong y=0; y < rRawBitmap.mnHeight; y++ ) { - for( ULONG x=0; x < rRawBitmap.mnWidth; x++ ) + for( sal_uLong x=0; x < rRawBitmap.mnWidth; x++ ) { p[x] = aGammaTable[ p[x] ]; } @@ -1714,16 +1732,39 @@ bool FreetypeServerFont::GetGlyphBitmap8( int nGlyphIndex, RawBitmap& rRawBitmap // determine unicode ranges in font // ----------------------------------------------------------------------- -// TODO: replace with GetFontCharMap() -bool FreetypeServerFont::GetFontCodeRanges( CmapResult& rResult ) const +const ImplFontCharMap* FreetypeServerFont::GetImplFontCharMap( void ) const +{ + const ImplFontCharMap* pIFCMap = mpFontInfo->GetImplFontCharMap(); + return pIFCMap; +} + +const ImplFontCharMap* FtFontInfo::GetImplFontCharMap( void ) +{ + // check if the charmap is already cached + if( mpFontCharMap ) + return mpFontCharMap; + + // get the charmap and cache it + CmapResult aCmapResult; + bool bOK = GetFontCodeRanges( aCmapResult ); + if( bOK ) + mpFontCharMap = new ImplFontCharMap( aCmapResult ); + else + mpFontCharMap = ImplFontCharMap::GetDefaultMap(); + mpFontCharMap->AddReference(); + return mpFontCharMap; +} + +// TODO: merge into method GetFontCharMap() +bool FtFontInfo::GetFontCodeRanges( CmapResult& rResult ) const { - rResult.mbSymbolic = mpFontInfo->IsSymbolFont(); + rResult.mbSymbolic = IsSymbolFont(); // TODO: is the full CmapResult needed on platforms calling this? if( FT_IS_SFNT( maFaceFT ) ) { - ULONG nLength = 0; - const unsigned char* pCmap = mpFontInfo->GetTable( "cmap", &nLength ); + sal_uLong nLength = 0; + const unsigned char* pCmap = GetTable( "cmap", &nLength ); if( pCmap && (nLength > 0) ) if( ParseCMAP( pCmap, nLength, rResult ) ) return true; @@ -1768,7 +1809,7 @@ bool FreetypeServerFont::GetFontCapabilities(vcl::FontCapabilities &rFontCapabil { bool bRet = false; - ULONG nLength = 0; + sal_uLong nLength = 0; // load GSUB table const FT_Byte* pGSUB = mpFontInfo->GetTable("GSUB", &nLength); if (pGSUB) @@ -1821,7 +1862,7 @@ int FreetypeServerFont::GetGlyphKernValue( int nGlyphLeft, int nGlyphRight ) con // ----------------------------------------------------------------------- -ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const +sal_uLong FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const { // if no kerning info is available in the font file *ppKernPairs = NULL; @@ -1847,7 +1888,7 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const pFTActivateSize( maSizeFT ); // first figure out which glyph pairs are involved in kerning - ULONG nKernLength = 0; + sal_uLong nKernLength = 0; const FT_Byte* const pKern = mpFontInfo->GetTable( "kern", &nKernLength ); if( !pKern ) return 0; @@ -1865,19 +1906,19 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const aKernPair.mnKern = 0; // To prevent "is used uninitialized" warning... const FT_Byte* pBuffer = pKern; - ULONG nVersion = GetUShort( pBuffer+0 ); - USHORT nTableCnt = GetUShort( pBuffer+2 ); + sal_uLong nVersion = GetUShort( pBuffer+0 ); + sal_uInt16 nTableCnt = GetUShort( pBuffer+2 ); // Microsoft/Old TrueType style kern table if ( nVersion == 0 ) { pBuffer += 4; - for( USHORT nTableIdx = 0; nTableIdx < nTableCnt; ++nTableIdx ) + for( sal_uInt16 nTableIdx = 0; nTableIdx < nTableCnt; ++nTableIdx ) { - // USHORT nSubVersion = GetUShort( pBuffer+0 ); - // USHORT nSubLength = GetUShort( pBuffer+2 ); - USHORT nSubCoverage = GetUShort( pBuffer+4 ); + // sal_uInt16 nSubVersion = GetUShort( pBuffer+0 ); + // sal_uInt16 nSubLength = GetUShort( pBuffer+2 ); + sal_uInt16 nSubCoverage = GetUShort( pBuffer+4 ); pBuffer += 6; if( (nSubCoverage&0x03) != 0x01 ) // no interest in minimum info here continue; @@ -1885,7 +1926,7 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const { case 0: // version 0, kerning format 0 { - USHORT nPairs = GetUShort( pBuffer ); + sal_uInt16 nPairs = GetUShort( pBuffer ); pBuffer += 8; // skip search hints aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs ); for( int i = 0; i < nPairs; ++i ) @@ -1902,21 +1943,21 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const case 2: // version 0, kerning format 2 { const FT_Byte* pSubTable = pBuffer; - //USHORT nRowWidth = GetUShort( pBuffer+0 ); - USHORT nOfsLeft = GetUShort( pBuffer+2 ); - USHORT nOfsRight = GetUShort( pBuffer+4 ); - USHORT nOfsArray = GetUShort( pBuffer+6 ); + //sal_uInt16 nRowWidth = GetUShort( pBuffer+0 ); + sal_uInt16 nOfsLeft = GetUShort( pBuffer+2 ); + sal_uInt16 nOfsRight = GetUShort( pBuffer+4 ); + sal_uInt16 nOfsArray = GetUShort( pBuffer+6 ); pBuffer += 8; const FT_Byte* pTmp = pSubTable + nOfsLeft; - USHORT nFirstLeft = GetUShort( pTmp+0 ); - USHORT nLastLeft = GetUShort( pTmp+2 ) + nFirstLeft - 1; + sal_uInt16 nFirstLeft = GetUShort( pTmp+0 ); + sal_uInt16 nLastLeft = GetUShort( pTmp+2 ) + nFirstLeft - 1; pTmp = pSubTable + nOfsRight; - USHORT nFirstRight = GetUShort( pTmp+0 ); - USHORT nLastRight = GetUShort( pTmp+2 ) + nFirstRight - 1; + sal_uInt16 nFirstRight = GetUShort( pTmp+0 ); + sal_uInt16 nLastRight = GetUShort( pTmp+2 ) + nFirstRight - 1; - ULONG nPairs = (ULONG)(nLastLeft - nFirstLeft + 1) * (nLastRight - nFirstRight + 1); + sal_uLong nPairs = (sal_uLong)(nLastLeft - nFirstLeft + 1) * (nLastRight - nFirstRight + 1); aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs ); pTmp = pSubTable + nOfsArray; @@ -1945,11 +1986,11 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const nTableCnt = NEXT_U32( pBuffer ); if ( nVersion == 0x00010000 ) { - for( USHORT nTableIdx = 0; nTableIdx < nTableCnt; ++nTableIdx ) + for( sal_uInt16 nTableIdx = 0; nTableIdx < nTableCnt; ++nTableIdx ) { - /*ULONG nLength =*/ NEXT_U32( pBuffer ); - USHORT nCoverage = NEXT_U16( pBuffer ); - /*USHORT nTupleIndex =*/ NEXT_U16( pBuffer ); + /*sal_uLong nLength =*/ NEXT_U32( pBuffer ); + sal_uInt16 nCoverage = NEXT_U16( pBuffer ); + /*sal_uInt16 nTupleIndex =*/ NEXT_U16( pBuffer ); // Kerning sub-table format, 0 through 3 sal_uInt8 nSubTableFormat = nCoverage & 0x00FF; @@ -1958,7 +1999,7 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const { case 0: // version 0, kerning format 0 { - USHORT nPairs = NEXT_U16( pBuffer ); + sal_uInt16 nPairs = NEXT_U16( pBuffer ); pBuffer += 6; // skip search hints aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs ); for( int i = 0; i < nPairs; ++i ) @@ -1974,20 +2015,20 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const case 2: // version 0, kerning format 2 { const FT_Byte* pSubTable = pBuffer; - /*USHORT nRowWidth =*/ NEXT_U16( pBuffer ); - USHORT nOfsLeft = NEXT_U16( pBuffer ); - USHORT nOfsRight = NEXT_U16( pBuffer ); - USHORT nOfsArray = NEXT_U16( pBuffer ); + /*sal_uInt16 nRowWidth =*/ NEXT_U16( pBuffer ); + sal_uInt16 nOfsLeft = NEXT_U16( pBuffer ); + sal_uInt16 nOfsRight = NEXT_U16( pBuffer ); + sal_uInt16 nOfsArray = NEXT_U16( pBuffer ); const FT_Byte* pTmp = pSubTable + nOfsLeft; - USHORT nFirstLeft = NEXT_U16( pTmp ); - USHORT nLastLeft = NEXT_U16( pTmp ) + nFirstLeft - 1; + sal_uInt16 nFirstLeft = NEXT_U16( pTmp ); + sal_uInt16 nLastLeft = NEXT_U16( pTmp ) + nFirstLeft - 1; pTmp = pSubTable + nOfsRight; - USHORT nFirstRight = NEXT_U16( pTmp ); - USHORT nLastRight = NEXT_U16( pTmp ) + nFirstRight - 1; + sal_uInt16 nFirstRight = NEXT_U16( pTmp ); + sal_uInt16 nLastRight = NEXT_U16( pTmp ) + nFirstRight - 1; - ULONG nPairs = (ULONG)(nLastLeft - nFirstLeft + 1) * (nLastRight - nFirstRight + 1); + sal_uLong nPairs = (sal_uLong)(nLastLeft - nFirstLeft + 1) * (nLastRight - nFirstRight + 1); aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs ); pTmp = pSubTable + nOfsArray; @@ -2014,17 +2055,17 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const } // now create VCL's ImplKernPairData[] format for all glyph pairs - ULONG nKernCount = aKernGlyphVector.size(); + sal_uLong nKernCount = aKernGlyphVector.size(); if( nKernCount ) { // prepare glyphindex to character mapping // TODO: this is needed to support VCL's existing kerning infrastructure, // eliminate it up by redesigning kerning infrastructure to work with glyph indizes - typedef boost::unordered_multimap<USHORT,sal_Unicode> Cmap; + typedef boost::unordered_multimap<sal_uInt16,sal_Unicode> Cmap; Cmap aCmap; for( sal_Unicode aChar = 0x0020; aChar < 0xFFFE; ++aChar ) { - USHORT nGlyphIndex = GetGlyphIndex( aChar ); + sal_uInt16 nGlyphIndex = GetGlyphIndex( aChar ); if( nGlyphIndex ) aCmap.insert( Cmap::value_type( nGlyphIndex, aChar ) ); } @@ -2079,7 +2120,7 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const class PolyArgs { public: - PolyArgs( PolyPolygon& rPolyPoly, USHORT nMaxPoints ); + PolyArgs( PolyPolygon& rPolyPoly, sal_uInt16 nMaxPoints ); ~PolyArgs(); void AddPoint( long nX, long nY, PolyFlags); @@ -2092,19 +2133,19 @@ private: PolyPolygon& mrPolyPoly; Point* mpPointAry; - BYTE* mpFlagAry; + sal_uInt8* mpFlagAry; FT_Vector maPosition; - USHORT mnMaxPoints; - USHORT mnPoints; - USHORT mnPoly; + sal_uInt16 mnMaxPoints; + sal_uInt16 mnPoints; + sal_uInt16 mnPoly; long mnHeight; bool bHasOffline; }; // ----------------------------------------------------------------------- -PolyArgs::PolyArgs( PolyPolygon& rPolyPoly, USHORT nMaxPoints ) +PolyArgs::PolyArgs( PolyPolygon& rPolyPoly, sal_uInt16 nMaxPoints ) : mrPolyPoly(rPolyPoly), mnMaxPoints(nMaxPoints), mnPoints(0), @@ -2113,7 +2154,7 @@ PolyArgs::PolyArgs( PolyPolygon& rPolyPoly, USHORT nMaxPoints ) bHasOffline(false) { mpPointAry = new Point[ mnMaxPoints ]; - mpFlagAry = new BYTE [ mnMaxPoints ]; + mpFlagAry = new sal_uInt8 [ mnMaxPoints ]; } // ----------------------------------------------------------------------- @@ -2321,56 +2362,56 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) { #define MKTAG(s) ((((((s[0]<<8)+s[1])<<8)+s[2])<<8)+s[3]) - typedef std::vector<ULONG> ReqFeatureTagList; + typedef std::vector<sal_uLong> ReqFeatureTagList; ReqFeatureTagList aReqFeatureTagList; if( rFSD.mbVertical ) aReqFeatureTagList.push_back( MKTAG("vert") ); - ULONG nRequestedScript = 0; //MKTAG("hani");//### TODO: where to get script? - ULONG nRequestedLangsys = 0; //MKTAG("ZHT"); //### TODO: where to get langsys? + sal_uLong nRequestedScript = 0; //MKTAG("hani");//### TODO: where to get script? + sal_uLong nRequestedLangsys = 0; //MKTAG("ZHT"); //### TODO: where to get langsys? // TODO: request more features depending on script and language system if( aReqFeatureTagList.size() == 0) // nothing to do return true; // load GSUB table into memory - ULONG nLength = 0; + sal_uLong nLength = 0; const FT_Byte* const pGsubBase = mpFontInfo->GetTable( "GSUB", &nLength ); if( !pGsubBase ) return false; // parse GSUB header const FT_Byte* pGsubHeader = pGsubBase; - const USHORT nOfsScriptList = GetUShort( pGsubHeader+4 ); - const USHORT nOfsFeatureTable = GetUShort( pGsubHeader+6 ); - const USHORT nOfsLookupList = GetUShort( pGsubHeader+8 ); + const sal_uInt16 nOfsScriptList = GetUShort( pGsubHeader+4 ); + const sal_uInt16 nOfsFeatureTable = GetUShort( pGsubHeader+6 ); + const sal_uInt16 nOfsLookupList = GetUShort( pGsubHeader+8 ); pGsubHeader += 10; - typedef std::vector<USHORT> UshortList; + typedef std::vector<sal_uInt16> UshortList; UshortList aFeatureIndexList; UshortList aFeatureOffsetList; // parse Script Table const FT_Byte* pScriptHeader = pGsubBase + nOfsScriptList; - const USHORT nCntScript = GetUShort( pScriptHeader+0 ); + const sal_uInt16 nCntScript = GetUShort( pScriptHeader+0 ); pScriptHeader += 2; - for( USHORT nScriptIndex = 0; nScriptIndex < nCntScript; ++nScriptIndex ) + for( sal_uInt16 nScriptIndex = 0; nScriptIndex < nCntScript; ++nScriptIndex ) { - const ULONG nScriptTag = GetUInt( pScriptHeader+0 ); // e.g. hani/arab/kana/hang - const USHORT nOfsScriptTable= GetUShort( pScriptHeader+4 ); + const sal_uLong nScriptTag = GetUInt( pScriptHeader+0 ); // e.g. hani/arab/kana/hang + const sal_uInt16 nOfsScriptTable= GetUShort( pScriptHeader+4 ); pScriptHeader += 6; //### if( (nScriptTag != nRequestedScript) && (nRequestedScript != 0) ) continue; const FT_Byte* pScriptTable = pGsubBase + nOfsScriptList + nOfsScriptTable; - const USHORT nDefaultLangsysOfs = GetUShort( pScriptTable+0 ); - const USHORT nCntLangSystem = GetUShort( pScriptTable+2 ); + const sal_uInt16 nDefaultLangsysOfs = GetUShort( pScriptTable+0 ); + const sal_uInt16 nCntLangSystem = GetUShort( pScriptTable+2 ); pScriptTable += 4; - USHORT nLangsysOffset = 0; + sal_uInt16 nLangsysOffset = 0; - for( USHORT nLangsysIndex = 0; nLangsysIndex < nCntLangSystem; ++nLangsysIndex ) + for( sal_uInt16 nLangsysIndex = 0; nLangsysIndex < nCntLangSystem; ++nLangsysIndex ) { - const ULONG nTag = GetUInt( pScriptTable+0 ); // e.g. KOR/ZHS/ZHT/JAN - const USHORT nOffset= GetUShort( pScriptTable+4 ); + const sal_uLong nTag = GetUInt( pScriptTable+0 ); // e.g. KOR/ZHS/ZHT/JAN + const sal_uInt16 nOffset= GetUShort( pScriptTable+4 ); pScriptTable += 6; if( (nTag != nRequestedLangsys) && (nRequestedLangsys != 0) ) continue; @@ -2381,13 +2422,13 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) if( (nDefaultLangsysOfs != 0) && (nDefaultLangsysOfs != nLangsysOffset) ) { const FT_Byte* pLangSys = pGsubBase + nOfsScriptList + nOfsScriptTable + nDefaultLangsysOfs; - const USHORT nReqFeatureIdx = GetUShort( pLangSys+2 ); - const USHORT nCntFeature = GetUShort( pLangSys+4 ); + const sal_uInt16 nReqFeatureIdx = GetUShort( pLangSys+2 ); + const sal_uInt16 nCntFeature = GetUShort( pLangSys+4 ); pLangSys += 6; aFeatureIndexList.push_back( nReqFeatureIdx ); - for( USHORT i = 0; i < nCntFeature; ++i ) + for( sal_uInt16 i = 0; i < nCntFeature; ++i ) { - const USHORT nFeatureIndex = GetUShort( pLangSys ); + const sal_uInt16 nFeatureIndex = GetUShort( pLangSys ); pLangSys += 2; aFeatureIndexList.push_back( nFeatureIndex ); } @@ -2396,13 +2437,13 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) if( nLangsysOffset != 0 ) { const FT_Byte* pLangSys = pGsubBase + nOfsScriptList + nOfsScriptTable + nLangsysOffset; - const USHORT nReqFeatureIdx = GetUShort( pLangSys+2 ); - const USHORT nCntFeature = GetUShort( pLangSys+4 ); + const sal_uInt16 nReqFeatureIdx = GetUShort( pLangSys+2 ); + const sal_uInt16 nCntFeature = GetUShort( pLangSys+4 ); pLangSys += 6; aFeatureIndexList.push_back( nReqFeatureIdx ); - for( USHORT i = 0; i < nCntFeature; ++i ) + for( sal_uInt16 i = 0; i < nCntFeature; ++i ) { - const USHORT nFeatureIndex = GetUShort( pLangSys ); + const sal_uInt16 nFeatureIndex = GetUShort( pLangSys ); pLangSys += 2; aFeatureIndexList.push_back( nFeatureIndex ); } @@ -2417,12 +2458,12 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) // parse Feature Table const FT_Byte* pFeatureHeader = pGsubBase + nOfsFeatureTable; - const USHORT nCntFeature = GetUShort( pFeatureHeader ); + const sal_uInt16 nCntFeature = GetUShort( pFeatureHeader ); pFeatureHeader += 2; - for( USHORT nFeatureIndex = 0; nFeatureIndex < nCntFeature; ++nFeatureIndex ) + for( sal_uInt16 nFeatureIndex = 0; nFeatureIndex < nCntFeature; ++nFeatureIndex ) { - const ULONG nTag = GetUInt( pFeatureHeader+0 ); // e.g. locl/vert/trad/smpl/liga/fina/... - const USHORT nOffset= GetUShort( pFeatureHeader+4 ); + const sal_uLong nTag = GetUInt( pFeatureHeader+0 ); // e.g. locl/vert/trad/smpl/liga/fina/... + const sal_uInt16 nOffset= GetUShort( pFeatureHeader+4 ); pFeatureHeader += 6; // short circuit some feature lookups @@ -2437,11 +2478,11 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) } const FT_Byte* pFeatureTable = pGsubBase + nOfsFeatureTable + nOffset; - const USHORT nCntLookups = GetUShort( pFeatureTable+0 ); + const sal_uInt16 nCntLookups = GetUShort( pFeatureTable+0 ); pFeatureTable += 2; - for( USHORT i = 0; i < nCntLookups; ++i ) + for( sal_uInt16 i = 0; i < nCntLookups; ++i ) { - const USHORT nLookupIndex = GetUShort( pFeatureTable ); + const sal_uInt16 nLookupIndex = GetUShort( pFeatureTable ); pFeatureTable += 2; aLookupIndexList.push_back( nLookupIndex ); } @@ -2451,11 +2492,11 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) // parse Lookup List const FT_Byte* pLookupHeader = pGsubBase + nOfsLookupList; - const USHORT nCntLookupTable = GetUShort( pLookupHeader ); + const sal_uInt16 nCntLookupTable = GetUShort( pLookupHeader ); pLookupHeader += 2; - for( USHORT nLookupIdx = 0; nLookupIdx < nCntLookupTable; ++nLookupIdx ) + for( sal_uInt16 nLookupIdx = 0; nLookupIdx < nCntLookupTable; ++nLookupIdx ) { - const USHORT nOffset = GetUShort( pLookupHeader ); + const sal_uInt16 nOffset = GetUShort( pLookupHeader ); pLookupHeader += 2; if( std::count( aLookupIndexList.begin(), aLookupIndexList.end(), nLookupIdx ) ) aLookupOffsetList.push_back( nOffset ); @@ -2464,43 +2505,43 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) UshortList::const_iterator lookup_it = aLookupOffsetList.begin(); for(; lookup_it != aLookupOffsetList.end(); ++lookup_it ) { - const USHORT nOfsLookupTable = *lookup_it; + const sal_uInt16 nOfsLookupTable = *lookup_it; const FT_Byte* pLookupTable = pGsubBase + nOfsLookupList + nOfsLookupTable; - const USHORT eLookupType = GetUShort( pLookupTable+0 ); - const USHORT nCntLookupSubtable = GetUShort( pLookupTable+4 ); + const sal_uInt16 eLookupType = GetUShort( pLookupTable+0 ); + const sal_uInt16 nCntLookupSubtable = GetUShort( pLookupTable+4 ); pLookupTable += 6; // TODO: switch( eLookupType ) if( eLookupType != 1 ) // TODO: once we go beyond SingleSubst continue; - for( USHORT nSubTableIdx = 0; nSubTableIdx < nCntLookupSubtable; ++nSubTableIdx ) + for( sal_uInt16 nSubTableIdx = 0; nSubTableIdx < nCntLookupSubtable; ++nSubTableIdx ) { - const USHORT nOfsSubLookupTable = GetUShort( pLookupTable ); + const sal_uInt16 nOfsSubLookupTable = GetUShort( pLookupTable ); pLookupTable += 2; const FT_Byte* pSubLookup = pGsubBase + nOfsLookupList + nOfsLookupTable + nOfsSubLookupTable; - const USHORT nFmtSubstitution = GetUShort( pSubLookup+0 ); - const USHORT nOfsCoverage = GetUShort( pSubLookup+2 ); + const sal_uInt16 nFmtSubstitution = GetUShort( pSubLookup+0 ); + const sal_uInt16 nOfsCoverage = GetUShort( pSubLookup+2 ); pSubLookup += 4; - typedef std::pair<USHORT,USHORT> GlyphSubst; + typedef std::pair<sal_uInt16,sal_uInt16> GlyphSubst; typedef std::vector<GlyphSubst> SubstVector; SubstVector aSubstVector; const FT_Byte* pCoverage = pGsubBase + nOfsLookupList + nOfsLookupTable + nOfsSubLookupTable + nOfsCoverage; - const USHORT nFmtCoverage = GetUShort( pCoverage+0 ); + const sal_uInt16 nFmtCoverage = GetUShort( pCoverage+0 ); pCoverage += 2; switch( nFmtCoverage ) { case 1: // Coverage Format 1 { - const USHORT nCntGlyph = GetUShort( pCoverage ); + const sal_uInt16 nCntGlyph = GetUShort( pCoverage ); pCoverage += 2; aSubstVector.reserve( nCntGlyph ); - for( USHORT i = 0; i < nCntGlyph; ++i ) + for( sal_uInt16 i = 0; i < nCntGlyph; ++i ) { - const USHORT nGlyphId = GetUShort( pCoverage ); + const sal_uInt16 nGlyphId = GetUShort( pCoverage ); pCoverage += 2; aSubstVector.push_back( GlyphSubst( nGlyphId, 0 ) ); } @@ -2509,16 +2550,16 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) case 2: // Coverage Format 2 { - const USHORT nCntRange = GetUShort( pCoverage ); + const sal_uInt16 nCntRange = GetUShort( pCoverage ); pCoverage += 2; for( int i = nCntRange; --i >= 0; ) { - const UINT32 nGlyph0 = GetUShort( pCoverage+0 ); - const UINT32 nGlyph1 = GetUShort( pCoverage+2 ); - const USHORT nCovIdx = GetUShort( pCoverage+4 ); + const sal_uInt32 nGlyph0 = GetUShort( pCoverage+0 ); + const sal_uInt32 nGlyph1 = GetUShort( pCoverage+2 ); + const sal_uInt16 nCovIdx = GetUShort( pCoverage+4 ); pCoverage += 6; - for( UINT32 j = nGlyph0; j <= nGlyph1; ++j ) - aSubstVector.push_back( GlyphSubst( static_cast<USHORT>(j + nCovIdx), 0 ) ); + for( sal_uInt32 j = nGlyph0; j <= nGlyph1; ++j ) + aSubstVector.push_back( GlyphSubst( static_cast<sal_uInt16>(j + nCovIdx), 0 ) ); } } break; @@ -2530,7 +2571,7 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) { case 1: // Single Substitution Format 1 { - const USHORT nDeltaGlyphId = GetUShort( pSubLookup ); + const sal_uInt16 nDeltaGlyphId = GetUShort( pSubLookup ); pSubLookup += 2; for(; it != aSubstVector.end(); ++it ) (*it).second = (*it).first + nDeltaGlyphId; @@ -2539,11 +2580,11 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) case 2: // Single Substitution Format 2 { - const USHORT nCntGlyph = GetUShort( pSubLookup ); + const sal_uInt16 nCntGlyph = GetUShort( pSubLookup ); pSubLookup += 2; for( int i = nCntGlyph; (it != aSubstVector.end()) && (--i>=0); ++it ) { - const USHORT nGlyphId = GetUShort( pSubLookup ); + const sal_uInt16 nGlyphId = GetUShort( pSubLookup ); pSubLookup += 2; (*it).second = nGlyphId; } diff --git a/vcl/source/glyphs/gcach_ftyp.hxx b/vcl/source/glyphs/gcach_ftyp.hxx index f37404033611..b644fbace2da 100644 --- a/vcl/source/glyphs/gcach_ftyp.hxx +++ b/vcl/source/glyphs/gcach_ftyp.hxx @@ -78,7 +78,7 @@ public: const ExtraKernInfo* ); ~FtFontInfo(); - const unsigned char* GetTable( const char*, ULONG* pLength=0 ) const; + const unsigned char* GetTable( const char*, sal_uLong* pLength=0 ) const; FT_FaceRec_* GetFaceFT(); void ReleaseFaceFT( FT_FaceRec_* ); @@ -95,6 +95,9 @@ public: int GetGlyphIndex( sal_UCS4 cChar ) const; void CacheGlyphIndex( sal_UCS4 cChar, int nGI ) const; + bool GetFontCodeRanges( CmapResult& ) const; + const ImplFontCharMap* GetImplFontCharMap( void ); + bool HasExtraKerning() const; int GetExtraKernPairs( ImplKernPairData** ) const; int GetExtraGlyphKernValue( int nLeftGlyph, int nRightGlyph ) const; @@ -109,6 +112,8 @@ private: sal_IntPtr mnFontId; ImplDevFontAttributes maDevFontAttributes; + const ImplFontCharMap* mpFontCharMap; + // cache unicode->glyphid mapping because looking it up is expensive // TODO: change to boost::unordered_multimap when a use case requires a m:n mapping typedef ::boost::unordered_map<int,int> Int2IntMap; @@ -182,6 +187,7 @@ public: virtual bool NeedsArtificialItalic() const { return mbArtItalic; } virtual void FetchFontMetric( ImplFontMetricData&, long& rFactor ) const; + virtual const ImplFontCharMap* GetImplFontCharMap( void ) const; virtual int GetGlyphIndex( sal_UCS4 ) const; int GetRawGlyphIndex( sal_UCS4 ) const; @@ -192,9 +198,9 @@ public: virtual bool GetGlyphBitmap8( int nGlyphIndex, RawBitmap& ) const; virtual bool GetGlyphOutline( int nGlyphIndex, ::basegfx::B2DPolyPolygon& ) const; virtual int GetGlyphKernValue( int nLeftGlyph, int nRightGlyph ) const; - virtual ULONG GetKernPairs( ImplKernPairData** ) const; + virtual sal_uLong GetKernPairs( ImplKernPairData** ) const; - const unsigned char* GetTable( const char* pName, ULONG* pLength ) + const unsigned char* GetTable( const char* pName, sal_uLong* pLength ) { return mpFontInfo->GetTable( pName, pLength ); } int GetEmUnits() const; const FT_Size_Metrics& GetMetricsFT() const { return maSizeFT->metrics; } @@ -204,7 +210,6 @@ protected: int ApplyGlyphTransform( int nGlyphFlags, FT_GlyphRec_*, bool ) const; virtual void InitGlyphData( int nGlyphIndex, GlyphData& ) const; - virtual bool GetFontCodeRanges( CmapResult& ) const; virtual bool GetFontCapabilities(vcl::FontCapabilities &) const; bool ApplyGSUB( const ImplFontSelectData& ); virtual ServerFontLayoutEngine* GetLayoutEngine(); diff --git a/vcl/source/glyphs/gcach_layout.cxx b/vcl/source/glyphs/gcach_layout.cxx index d1b99bcd85e1..63a332869664 100644..100755 --- a/vcl/source/glyphs/gcach_layout.cxx +++ b/vcl/source/glyphs/gcach_layout.cxx @@ -229,7 +229,7 @@ const void* IcuFontFromServerFont::getFontTable( LETag nICUTableTag ) const pTagName[3] = (char)(nICUTableTag); pTagName[4] = 0; - ULONG nLength; + sal_uLong nLength; const unsigned char* pBuffer = mrServerFont.GetTable( pTagName, &nLength ); #ifdef VERBOSE_DEBUG fprintf(stderr,"IcuGetTable(\"%s\") => %p\n", pTagName, pBuffer); diff --git a/vcl/source/glyphs/gcach_rbmp.cxx b/vcl/source/glyphs/gcach_rbmp.cxx index f951590b4b45..161e4c6314e7 100644..100755 --- a/vcl/source/glyphs/gcach_rbmp.cxx +++ b/vcl/source/glyphs/gcach_rbmp.cxx @@ -172,9 +172,9 @@ static void ImplRotate1_180( unsigned char* p1, const unsigned char* p2, bool RawBitmap::Rotate( int nAngle ) { - ULONG nNewScanlineSize = 0; - ULONG nNewHeight = 0; - ULONG nNewWidth = 0; + sal_uLong nNewScanlineSize = 0; + sal_uLong nNewHeight = 0; + sal_uLong nNewWidth = 0; // do inplace rotation or prepare double buffered rotation switch( nAngle ) diff --git a/vcl/source/glyphs/gcach_vdev.cxx b/vcl/source/glyphs/gcach_vdev.cxx index 7a090de30128..944d9aee16a3 100644 --- a/vcl/source/glyphs/gcach_vdev.cxx +++ b/vcl/source/glyphs/gcach_vdev.cxx @@ -138,7 +138,7 @@ void VirtDevServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor rTo.meWeight = aFSD.meWeight; rTo.meItalic = aFSD.meItalic; rTo.mePitch = aFSD.mePitch; - rTo.mbDevice = FALSE; + rTo.mbDevice = sal_False; } // ----------------------------------------------------------------------- @@ -195,7 +195,7 @@ bool VirtDevServerFont::GetGlyphBitmap1( int nGlyphIndex, RawBitmap& ) const String aGlyphStr( &aChar, 1 ); // draw bitmap - vdev.SetOutputSizePixel( aSize, TRUE ); + vdev.SetOutputSizePixel( aSize, sal_True ); vdev.DrawText( Point(0,0)-rGD.GetMetric().GetOffset(), aGlyphStr ); // create new glyph item @@ -223,7 +223,7 @@ int VirtDevServerFont::GetGlyphKernValue( int, int ) const // ----------------------------------------------------------------------- -ULONG VirtDevServerFont::GetKernPairs( ImplKernPairData** ppImplKernPairs ) const +sal_uLong VirtDevServerFont::GetKernPairs( ImplKernPairData** ppImplKernPairs ) const { Font aFont; aFont.SetName ( GetFontSelData().maName ); @@ -236,7 +236,7 @@ ULONG VirtDevServerFont::GetKernPairs( ImplKernPairData** ppImplKernPairs ) cons VirtualDevice vdev( 1 ); vdev.SetFont( aFont ); - ULONG nPairs = vdev.GetKerningPairCount(); + sal_uLong nPairs = vdev.GetKerningPairCount(); if( nPairs > 0 ) { KerningPair* const pKernPairs = new KerningPair[ nPairs ]; @@ -245,7 +245,7 @@ ULONG VirtDevServerFont::GetKernPairs( ImplKernPairData** ppImplKernPairs ) cons *ppImplKernPairs = new ImplKernPairData[ nPairs ]; ImplKernPairData* pTo = *ppImplKernPairs; KerningPair* pFrom = pKernPairs; - for ( ULONG n = 0; n < nPairs; n++ ) + for ( sal_uLong n = 0; n < nPairs; n++ ) { pTo->mnChar1 = pFrom->nChar1; pTo->mnChar2 = pFrom->nChar2; diff --git a/vcl/source/glyphs/gcach_vdev.hxx b/vcl/source/glyphs/gcach_vdev.hxx index 48d602677c16..61cd02b1f9cc 100644 --- a/vcl/source/glyphs/gcach_vdev.hxx +++ b/vcl/source/glyphs/gcach_vdev.hxx @@ -45,7 +45,7 @@ protected: static VirtDevServerFont* CreateFont( const ImplFontSelectData& ); virtual void FetchFontMetric( ImplFontMetricData&, long& rFactor ) const; - virtual ULONG GetKernPairs( ImplKernPairData** ) const; + virtual sal_uLong GetKernPairs( ImplKernPairData** ) const; virtual int GetGlyphKernValue( int, int ) const; virtual int GetGlyphIndex( sal_Unicode ) const; diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx index 159639ccdd05..4374ad2f6b1b 100644 --- a/vcl/source/glyphs/glyphcache.cxx +++ b/vcl/source/glyphs/glyphcache.cxx @@ -79,6 +79,18 @@ GlyphCache::~GlyphCache() void GlyphCache::InvalidateAllGlyphs() { + // an application about to exit can omit garbage collecting the heap + // since it makes things slower and introduces risks if the heap was not perfect + // for debugging, for memory grinding or leak checking the env allows to force GC + const char* pEnv = getenv( "SAL_FORCE_GC_ON_EXIT" ); + if( pEnv && (*pEnv != '0') ) + { + // uncache of all glyph shapes and metrics + for( FontList::iterator it = maFontList.begin(); it != maFontList.end(); ++it ) + delete const_cast<ServerFont*>( it->second ); + maFontList.clear(); + mpCurrentGCFont = NULL; + } } // ----------------------------------------------------------------------- @@ -283,9 +295,9 @@ void GlyphCache::UncacheFont( ServerFont& rServerFont ) // ----------------------------------------------------------------------- -ULONG GlyphCache::CalcByteCount() const +sal_uLong GlyphCache::CalcByteCount() const { - ULONG nCacheSize = sizeof(*this); + sal_uLong nCacheSize = sizeof(*this); for( FontList::const_iterator it = maFontList.begin(); it != maFontList.end(); ++it ) { const ServerFont* pSF = it->second; diff --git a/vcl/source/glyphs/graphite_adaptors.cxx b/vcl/source/glyphs/graphite_adaptors.cxx index a4f1860d9bfb..c1b9794927fc 100644 --- a/vcl/source/glyphs/graphite_adaptors.cxx +++ b/vcl/source/glyphs/graphite_adaptors.cxx @@ -253,7 +253,7 @@ void GraphiteFontAdaptor::getFontMetrics(float * ascent_out, float * descent_out const void * GraphiteFontAdaptor::getTable(gr::fontTableId32 table_id, size_t * buffer_sz) { char tag_name[5] = {char(table_id >> 24), char(table_id >> 16), char(table_id >> 8), char(table_id), 0}; - ULONG temp = *buffer_sz; + sal_uLong temp = *buffer_sz; const void * const tbl_buf = static_cast<FreetypeServerFont &>(mrFont).GetTable(tag_name, &temp); *buffer_sz = temp; diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index 01c671ef17ec..0fb1d824a17f 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -1046,13 +1046,13 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs) { if (mvGlyphs[i].IsClusterStart()) { - nOffset = fExtraPerCluster * nCluster; + nOffset = FRound( 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; + int nChar2Base = (mvChar2BaseGlyph[nCharIndex] == -1)? -1 : (int)(mvChar2BaseGlyph[nCharIndex] & GLYPH_INDEX_MASK); if (nChar2Base == -1 || nChar2Base == static_cast<int>(i)) mvCharDxs[nCharIndex] += nOffset; } @@ -1075,12 +1075,12 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs) Glyphs::iterator iGlyph = mvGlyphs.begin(); while (iGlyph != iLastGlyph) { - iGlyph->maLinearPos.X() = static_cast<float>(iGlyph->maLinearPos.X()) * fXFactor; + iGlyph->maLinearPos.X() = FRound( fXFactor * iGlyph->maLinearPos.X() ); ++iGlyph; } for (size_t i = 0; i < mvCharDxs.size(); i++) { - mvCharDxs[i] = fXFactor * static_cast<float>(mvCharDxs[i]); + mvCharDxs[i] = FRound( fXFactor * mvCharDxs[i] ); } } mnWidth = rArgs.mnLayoutWidth; @@ -1106,7 +1106,7 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt int nPrevClusterLastChar = -1; for (size_t i = 0; i < nChars; i++) { - int nChar2Base = (mvChar2BaseGlyph[i] == -1)? -1 : mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK; + int nChar2Base = (mvChar2BaseGlyph[i] == -1)? -1 : (int)(mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK); if ((nChar2Base > -1) && (nChar2Base != nPrevClusterGlyph)) { assert((nChar2Base > -1) && (nChar2Base < (signed)mvGlyphs.size())); @@ -1120,11 +1120,11 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt int nLastGlyph = nChar2Base; for (; j < nChars; j++) { - int nChar2BaseJ = (mvChar2BaseGlyph[j] == -1)? -1 : mvChar2BaseGlyph[j] & GLYPH_INDEX_MASK; + int nChar2BaseJ = (mvChar2BaseGlyph[j] == -1)? -1 : (int)(mvChar2BaseGlyph[j] & GLYPH_INDEX_MASK); assert((nChar2BaseJ >= -1) && (nChar2BaseJ < (signed)mvGlyphs.size())); if (nChar2BaseJ != -1 && mvGlyphs[nChar2BaseJ].IsClusterStart()) { - nLastGlyph = nChar2BaseJ + ((bRtl)? 1 : -1); + nLastGlyph = nChar2BaseJ + ((bRtl)? +1 : -1); nLastChar = j - 1; break; } diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx index fc15cc77dcce..3138c55b2bb5 100644 --- a/vcl/source/helper/canvasbitmap.cxx +++ b/vcl/source/helper/canvasbitmap.cxx @@ -66,7 +66,7 @@ namespace } } -void VclCanvasBitmap::setComponentInfo( ULONG redShift, ULONG greenShift, ULONG blueShift ) +void VclCanvasBitmap::setComponentInfo( sal_uLong redShift, sal_uLong greenShift, sal_uLong blueShift ) { // sort channels in increasing order of appearance in the pixel // (starting with the least significant bits) @@ -683,14 +683,14 @@ sal_Bool SAL_CALL VclCanvasBitmap::getIndex( uno::Sequence< double >& o_entry, s { SolarMutexGuard aGuard; - const USHORT nCount( m_pBmpAcc ? + const sal_uInt16 nCount( m_pBmpAcc ? (m_pBmpAcc->HasPalette() ? m_pBmpAcc->GetPaletteEntryCount() : 0 ) : 0 ); OSL_ENSURE(nIndex >= 0 && nIndex < nCount,"Palette index out of range"); if( nIndex < 0 || nIndex >= nCount ) throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Palette index out of range")), static_cast<rendering::XBitmapPalette*>(this)); - const BitmapColor aCol = m_pBmpAcc->GetPaletteColor(sal::static_int_cast<USHORT>(nIndex)); + const BitmapColor aCol = m_pBmpAcc->GetPaletteColor(sal::static_int_cast<sal_uInt16>(nIndex)); o_entry.realloc(3); double* pColor=o_entry.getArray(); pColor[0] = aCol.GetRed(); @@ -704,7 +704,7 @@ sal_Bool SAL_CALL VclCanvasBitmap::setIndex( const uno::Sequence< double >&, sal { SolarMutexGuard aGuard; - const USHORT nCount( m_pBmpAcc ? + const sal_uInt16 nCount( m_pBmpAcc ? (m_pBmpAcc->HasPalette() ? m_pBmpAcc->GetPaletteEntryCount() : 0 ) : 0 ); OSL_ENSURE(nIndex >= 0 && nIndex < nCount,"Palette index out of range"); @@ -788,7 +788,7 @@ uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertToRGB( const for( sal_Size i=0; i<nLen; i+=nComponentsPerPixel ) { const BitmapColor aCol = m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>(deviceColor[i+m_nIndexIndex])); + sal::static_int_cast<sal_uInt16>(deviceColor[i+m_nIndexIndex])); // TODO(F3): Convert result to sRGB color space *pOut++ = rendering::RGBColor(toDoubleColor(aCol.GetRed()), @@ -837,7 +837,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToARGB( con for( sal_Size i=0; i<nLen; i+=nComponentsPerPixel ) { const BitmapColor aCol = m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>(deviceColor[i+m_nIndexIndex])); + sal::static_int_cast<sal_uInt16>(deviceColor[i+m_nIndexIndex])); // TODO(F3): Convert result to sRGB color space const double nAlpha( m_nAlphaIndex != -1 ? 1.0 - deviceColor[i+m_nAlphaIndex] : 1.0 ); @@ -890,7 +890,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToPARGB( co for( sal_Size i=0; i<nLen; i+=nComponentsPerPixel ) { const BitmapColor aCol = m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>(deviceColor[i+m_nIndexIndex])); + sal::static_int_cast<sal_uInt16>(deviceColor[i+m_nIndexIndex])); // TODO(F3): Convert result to sRGB color space const double nAlpha( m_nAlphaIndex != -1 ? 1.0 - deviceColor[i+m_nAlphaIndex] : 1.0 ); @@ -1086,7 +1086,7 @@ uno::Sequence<double> SAL_CALL VclCanvasBitmap::convertFromIntegerColorSpace( co for( sal_Size i=0; i<nLen; i+=nComponentsPerPixel ) { const BitmapColor aCol = m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>(deviceColor[i+m_nIndexIndex])); + sal::static_int_cast<sal_uInt16>(deviceColor[i+m_nIndexIndex])); // TODO(F3): Convert result to sRGB color space const double nAlpha( m_nAlphaIndex != -1 ? 1.0 - deviceColor[i+m_nAlphaIndex] : 1.0 ); @@ -1146,7 +1146,7 @@ uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToRGB { SolarMutexGuard aGuard; - const BYTE* pIn( reinterpret_cast<const BYTE*>(deviceColor.getConstArray()) ); + const sal_uInt8* pIn( reinterpret_cast<const sal_uInt8*>(deviceColor.getConstArray()) ); const sal_Size nLen( deviceColor.getLength() ); const sal_Int32 nNumColors((nLen*8 + m_nBitsPerOutputPixel-1)/m_nBitsPerOutputPixel); @@ -1182,7 +1182,7 @@ uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToRGB const BitmapColor aCol = m_bPalette ? m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>( + sal::static_int_cast<sal_uInt16>( m_pBmpAcc->GetPixelFromData( pIn, i ))) : m_pBmpAcc->GetPixelFromData(pIn, i); @@ -1201,7 +1201,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToAR { SolarMutexGuard aGuard; - const BYTE* pIn( reinterpret_cast<const BYTE*>(deviceColor.getConstArray()) ); + const sal_uInt8* pIn( reinterpret_cast<const sal_uInt8*>(deviceColor.getConstArray()) ); const sal_Size nLen( deviceColor.getLength() ); const sal_Int32 nNumColors((nLen*8 + m_nBitsPerOutputPixel-1)/m_nBitsPerOutputPixel); @@ -1239,7 +1239,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToAR const BitmapColor aCol = m_bPalette ? m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>( + sal::static_int_cast<sal_uInt16>( m_pBmpAcc->GetPixelFromData( pIn, i ))) : m_pBmpAcc->GetPixelFromData(pIn, i); @@ -1259,7 +1259,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToPA { SolarMutexGuard aGuard; - const BYTE* pIn( reinterpret_cast<const BYTE*>(deviceColor.getConstArray()) ); + const sal_uInt8* pIn( reinterpret_cast<const sal_uInt8*>(deviceColor.getConstArray()) ); const sal_Size nLen( deviceColor.getLength() ); const sal_Int32 nNumColors((nLen*8 + m_nBitsPerOutputPixel-1)/m_nBitsPerOutputPixel); @@ -1298,7 +1298,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToPA const BitmapColor aCol = m_bPalette ? m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>( + sal::static_int_cast<sal_uInt16>( m_pBmpAcc->GetPixelFromData( pIn, i ))) : m_pBmpAcc->GetPixelFromData(pIn, i); @@ -1322,7 +1322,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromRGB( con const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8); uno::Sequence< sal_Int8 > aRes(nNumBytes); - BYTE* pColors=reinterpret_cast<BYTE*>(aRes.getArray()); + sal_uInt8* pColors=reinterpret_cast<sal_uInt8*>(aRes.getArray()); if( m_aBmpEx.IsTransparent() ) { @@ -1335,12 +1335,12 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromRGB( con const BitmapColor aCol2 = m_bPalette ? BitmapColor( - sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + sal::static_int_cast<sal_uInt8>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : aCol; m_pBmpAcc->SetPixelOnData(pColors,0,aCol2); pColors += nNonAlphaBytes; - *pColors++ = BYTE(255); + *pColors++ = sal_uInt8(255); } } else @@ -1353,7 +1353,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromRGB( con const BitmapColor aCol2 = m_bPalette ? BitmapColor( - sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + sal::static_int_cast<sal_uInt8>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : aCol; m_pBmpAcc->SetPixelOnData(pColors,i,aCol2); @@ -1371,7 +1371,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( co const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8); uno::Sequence< sal_Int8 > aRes(nNumBytes); - BYTE* pColors=reinterpret_cast<BYTE*>(aRes.getArray()); + sal_uInt8* pColors=reinterpret_cast<sal_uInt8*>(aRes.getArray()); if( m_aBmpEx.IsTransparent() ) { @@ -1384,7 +1384,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( co const BitmapColor aCol2 = m_bPalette ? BitmapColor( - sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + sal::static_int_cast<sal_uInt8>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : aCol; m_pBmpAcc->SetPixelOnData(pColors,0,aCol2); @@ -1402,7 +1402,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( co const BitmapColor aCol2 = m_bPalette ? BitmapColor( - sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + sal::static_int_cast<sal_uInt8>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : aCol; m_pBmpAcc->SetPixelOnData(pColors,i,aCol2); @@ -1420,7 +1420,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromPARGB( c const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8); uno::Sequence< sal_Int8 > aRes(nNumBytes); - BYTE* pColors=reinterpret_cast<BYTE*>(aRes.getArray()); + sal_uInt8* pColors=reinterpret_cast<sal_uInt8*>(aRes.getArray()); if( m_aBmpEx.IsTransparent() ) { @@ -1434,7 +1434,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromPARGB( c const BitmapColor aCol2 = m_bPalette ? BitmapColor( - sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + sal::static_int_cast<sal_uInt8>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : aCol; m_pBmpAcc->SetPixelOnData(pColors,0,aCol2); @@ -1452,7 +1452,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromPARGB( c const BitmapColor aCol2 = m_bPalette ? BitmapColor( - sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + sal::static_int_cast<sal_uInt8>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : aCol; m_pBmpAcc->SetPixelOnData(pColors,i,aCol2); diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx index 005d544b9e02..3bf73ca7588d 100644 --- a/vcl/source/helper/canvastools.cxx +++ b/vcl/source/helper/canvastools.cxx @@ -117,11 +117,11 @@ namespace vcl { RTL_LOGFILE_CONTEXT( aLog, "::vcl::unotools::polygonFromPoint2DSequence()" ); - const USHORT nCurrSize( sal::static_int_cast<USHORT>(points.getLength()) ); + const sal_uInt16 nCurrSize( sal::static_int_cast<sal_uInt16>(points.getLength()) ); ::Polygon aPoly( nCurrSize ); - USHORT nCurrPoint; + sal_uInt16 nCurrPoint; for( nCurrPoint=0; nCurrPoint<nCurrSize; ++nCurrPoint ) aPoly[nCurrPoint] = pointFromRealPoint2D( points[nCurrPoint] ); @@ -255,7 +255,7 @@ namespace vcl { const rendering::ARGBColor& rColor=aARGBColors[x]; rWriteAcc->SetPixel( aRect.Y1, x, - (BYTE)rWriteAcc->GetBestPaletteIndex( + (sal_uInt8)rWriteAcc->GetBestPaletteIndex( BitmapColor( toByteColor(rColor.Red), toByteColor(rColor.Green), toByteColor(rColor.Blue))) ); @@ -287,7 +287,7 @@ namespace vcl { const rendering::RGBColor& rColor=aRGBColors[x]; rWriteAcc->SetPixel( aRect.Y1, x, - (BYTE)rWriteAcc->GetBestPaletteIndex( + (sal_uInt8)rWriteAcc->GetBestPaletteIndex( BitmapColor( toByteColor(rColor.Red), toByteColor(rColor.Green), toByteColor(rColor.Blue))) ); @@ -385,8 +385,8 @@ namespace vcl else nDepth = 8; - const USHORT nPaletteEntries( - sal::static_int_cast<USHORT>( + const sal_uInt16 nPaletteEntries( + sal::static_int_cast<sal_uInt16>( std::min(sal_Int32(255), nEntryCount))); // copy palette entries @@ -395,7 +395,7 @@ namespace vcl uno::Reference<rendering::XColorSpace> xPalColorSpace( xPalette->getColorSpace() ); uno::Sequence<double> aPaletteEntry; - for( USHORT j=0; j<nPaletteEntries; ++j ) + for( sal_uInt16 j=0; j<nPaletteEntries; ++j ) { if( !xPalette->getIndex(aPaletteEntry,j) && nAlphaDepth == 0 ) @@ -423,14 +423,14 @@ namespace vcl ( nDepth <= 8 ) ? 8 : 24; ::Bitmap aBitmap( aPixelSize, - sal::static_int_cast<USHORT>(nDepth), + sal::static_int_cast<sal_uInt16>(nDepth), aLayout.Palette.is() ? &aPalette : NULL ); ::Bitmap aAlpha; if( nAlphaDepth ) aAlpha = ::Bitmap( aPixelSize, - sal::static_int_cast<USHORT>(nAlphaDepth), + sal::static_int_cast<sal_uInt16>(nAlphaDepth), &::Bitmap::GetGreyPalette( - sal::static_int_cast<USHORT>(1L << nAlphaDepth)) ); + sal::static_int_cast<sal_uInt16>(1L << nAlphaDepth)) ); { // limit scoped access ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(), diff --git a/vcl/source/helper/lazydelete.cxx b/vcl/source/helper/lazydelete.cxx index 398b8338884d..9173474af759 100644 --- a/vcl/source/helper/lazydelete.cxx +++ b/vcl/source/helper/lazydelete.cxx @@ -69,7 +69,7 @@ void LazyDelete::flush() // specialized is_less function for Window template<> bool LazyDeletor<Window>::is_less( Window* left, Window* right ) { - return (left != right && right->IsChild( left, TRUE )) ? true : false; + return (left != right && right->IsChild( left, sal_True )) ? true : false; } // specialized is_less function for Menu diff --git a/vcl/source/helper/makefile.mk b/vcl/source/helper/makefile.mk index e708bdec9eaa..1a417417dbe4 100644 --- a/vcl/source/helper/makefile.mk +++ b/vcl/source/helper/makefile.mk @@ -46,7 +46,6 @@ SLOFILES=\ $(SLO)$/canvastools.obj \ $(SLO)$/xconnection.obj \ $(SLO)$/threadex.obj \ - $(SLO)$/smartid.obj \ $(SLO)$/lazydelete.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/source/helper/smartid.cxx b/vcl/source/helper/smartid.cxx deleted file mode 100644 index 41a4cbe814ea..000000000000 --- a/vcl/source/helper/smartid.cxx +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://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/smartid.hxx> - -struct ImplSmartIdData -{ - String aUId; - ULONG nUId; - BOOL bHasStringId; - BOOL bHasNumericId; -}; - - -ImplSmartIdData* SmartId::GetSmartIdData() -{ - if ( !mpData ) - { - mpData = new ImplSmartIdData; -// mpData->aUId = ""; - mpData->nUId = 0; - mpData->bHasStringId = FALSE; - mpData->bHasNumericId = FALSE; - } - return mpData; -} - - -SmartId::SmartId( const String& rId ) -: mpData( NULL ) -{ - GetSmartIdData()->aUId = rId; - GetSmartIdData()->bHasStringId = TRUE; -} - -SmartId::SmartId( ULONG nId ) -: mpData( NULL ) -{ - GetSmartIdData()->nUId = nId; - GetSmartIdData()->bHasNumericId = TRUE; -} - -SmartId::SmartId( const String& rId, ULONG nId ) -: mpData( NULL ) -{ - GetSmartIdData()->aUId = rId; - GetSmartIdData()->bHasStringId = TRUE; - GetSmartIdData()->nUId = nId; - GetSmartIdData()->bHasNumericId = TRUE; -} - -SmartId::SmartId() -: mpData( NULL ) -{} - -SmartId::SmartId( const SmartId& rId ) -: mpData( NULL ) -{ - if ( rId.mpData ) - { - GetSmartIdData(); - mpData->aUId = rId.mpData->aUId; - mpData->bHasStringId = rId.mpData->bHasStringId; - mpData->nUId = rId.mpData->nUId; - mpData->bHasNumericId = rId.mpData->bHasNumericId; - } -} - -SmartId& SmartId::operator = ( const SmartId& rId ) -{ - if ( rId.mpData ) - GetSmartIdData(); - else - { - delete mpData; - mpData = NULL; - } - if ( mpData && rId.mpData ) - { - mpData->aUId = rId.mpData->aUId; - mpData->bHasStringId = rId.mpData->bHasStringId; - mpData->nUId = rId.mpData->nUId; - mpData->bHasNumericId = rId.mpData->bHasNumericId; - } - return *this; -} - -SmartId::~SmartId() -{ - if ( mpData ) - delete mpData; -#ifdef DBG_UTIL - if ( mpData ) - mpData = (ImplSmartIdData*)0xDeadBeef; -#endif -} - -void SmartId::UpdateId( const SmartId& rId, SmartIdUpdateMode aMode ) -{ - // Check if ImplData is needed - if ( aMode != SMART_SET_SMART || ( rId.HasString() || rId.HasNumeric() ) ) - GetSmartIdData(); - - if ( aMode == SMART_SET_STR || aMode == SMART_SET_ALL || ( aMode == SMART_SET_SMART && rId.HasString() ) ) - { - GetSmartIdData()->aUId = rId.GetStr(); - GetSmartIdData()->bHasStringId = rId.HasString(); - } - if ( aMode == SMART_SET_NUM || aMode == SMART_SET_ALL || ( aMode == SMART_SET_SMART && rId.HasNumeric() ) ) - { - GetSmartIdData()->nUId = rId.GetNum(); - GetSmartIdData()->bHasNumericId = rId.HasNumeric(); - } - - // remove ImplData when no IDs are set. This is Important because Implementation of Equals() Matches and HasAny relies on it - if ( mpData && !mpData->bHasStringId && !mpData->bHasNumericId ) - { - delete mpData; - mpData = NULL; - } -} - -BOOL SmartId::HasNumeric() const -{ - if ( !mpData ) - return FALSE; - else - return mpData->bHasNumericId; -} - -BOOL SmartId::HasString() const -{ - if ( !mpData ) - return FALSE; - else - return mpData->bHasStringId; -} - -BOOL SmartId::HasAny() const -{ - return mpData != NULL; -} - -ULONG SmartId::GetNum() const -{ - if ( !mpData ) - return 0; - else - return mpData->nUId; -} - -String SmartId::GetStr() const -{ - if ( !mpData ) - return String(); - else - return mpData->aUId; -} - - -String SmartId::GetText() const // return String for UI usage -{ - String aRes; - if ( HasNumeric() ) - aRes = String::CreateFromInt64( GetNum() ); - if ( HasString() ) - { - if ( HasNumeric() ) - aRes.AppendAscii( "/" ); - aRes.Append( GetStr() ); - } - return aRes; -} - -BOOL SmartId::Matches( const String &rId )const -{ - if ( HasString() ) - return GetStr().EqualsIgnoreCaseAscii( rId ); - else - return FALSE; -} - -BOOL SmartId::Matches( const ULONG nId ) const -{ - if ( HasNumeric() ) - return GetNum() == nId; - else - return FALSE; -} - -/****************************************************************************** -If Both Ids have nither Strings nor Numbers they don't match -If both Ids have Strings the result of Matching these is returned. -Numbers are then Ignored. -Else Matching Numbers is attempted. -******************************************************************************/ -BOOL SmartId::Matches( const SmartId &rId ) const -{ - if ( !mpData || !rId.mpData ) - return FALSE; - else if ( HasString() && rId.HasString() ) - return Matches( rId.GetStr() ); - else - return rId.HasNumeric() && Matches( rId.GetNum() ); -} - -BOOL SmartId::Equals( const SmartId &rId ) const -{ - if ( mpData && rId.mpData ) - return mpData->aUId.EqualsIgnoreCaseAscii( rId.mpData->aUId ) - && mpData->bHasStringId == rId.mpData->bHasStringId - && mpData->nUId == rId.mpData->nUId - && mpData->bHasNumericId == rId.mpData->bHasNumericId; - else if ( !mpData && !rId.mpData ) - return TRUE; - else - return FALSE; -} - -BOOL SmartId::operator == ( const SmartId& rRight ) const -{ - return Equals( rRight ); -} - -BOOL SmartId::operator < ( const SmartId& rRight ) const -{ - if ( HasString() && rRight.HasString() && GetStr() != rRight.GetStr() ) - return GetStr() < rRight.GetStr(); - else if ( HasNumeric() && rRight.HasNumeric() && GetNum() != rRight.GetNum() ) - return GetNum() < rRight.GetNum(); - else - { // Sort Strings to Front - if ( HasString() ) - return rRight.HasString() && rRight.HasNumeric(); - else - return rRight.HasString() || (!HasNumeric() && rRight.HasNumeric()); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx index 7009468a02ec..c8b5cc7fbf22 100644 --- a/vcl/source/helper/strhelper.cxx +++ b/vcl/source/helper/strhelper.cxx @@ -326,7 +326,7 @@ int GetCommandLineTokenCount( const ByteString& rLine ) return nTokenCount; } -String WhitespaceToSpace( const String& rLine, BOOL bProtect ) +String WhitespaceToSpace( const String& rLine, sal_Bool bProtect ) { int nLen = rLine.Len(); if( ! nLen ) @@ -358,11 +358,11 @@ String WhitespaceToSpace( const String& rLine, BOOL bProtect ) pRun++; } else if( bProtect && *pRun == '`' ) - CopyUntil( pLeap, pRun, '`', TRUE ); + CopyUntil( pLeap, pRun, '`', sal_True ); else if( bProtect && *pRun == '\'' ) - CopyUntil( pLeap, pRun, '\'', TRUE ); + CopyUntil( pLeap, pRun, '\'', sal_True ); else if( bProtect && *pRun == '"' ) - CopyUntil( pLeap, pRun, '"', TRUE ); + CopyUntil( pLeap, pRun, '"', sal_True ); else { *pLeap = *pRun; @@ -383,7 +383,7 @@ String WhitespaceToSpace( const String& rLine, BOOL bProtect ) return aRet; } -ByteString WhitespaceToSpace( const ByteString& rLine, BOOL bProtect ) +ByteString WhitespaceToSpace( const ByteString& rLine, sal_Bool bProtect ) { int nLen = rLine.Len(); if( ! nLen ) @@ -415,11 +415,11 @@ ByteString WhitespaceToSpace( const ByteString& rLine, BOOL bProtect ) pRun++; } else if( bProtect && *pRun == '`' ) - CopyUntil( pLeap, pRun, '`', TRUE ); + CopyUntil( pLeap, pRun, '`', sal_True ); else if( bProtect && *pRun == '\'' ) - CopyUntil( pLeap, pRun, '\'', TRUE ); + CopyUntil( pLeap, pRun, '\'', sal_True ); else if( bProtect && *pRun == '"' ) - CopyUntil( pLeap, pRun, '"', TRUE ); + CopyUntil( pLeap, pRun, '"', sal_True ); else { *pLeap = *pRun; diff --git a/vcl/source/helper/threadex.cxx b/vcl/source/helper/threadex.cxx index 85ccffd34b6c..ad351410e2c2 100644 --- a/vcl/source/helper/threadex.cxx +++ b/vcl/source/helper/threadex.cxx @@ -112,8 +112,8 @@ long SolarThreadExecutor::impl_execute( const TimeValue* _pTimeout ) { osl_resetCondition( m_aStart ); osl_resetCondition( m_aFinish ); - ULONG nSolarMutexCount = Application::ReleaseSolarMutex(); - ULONG nEvent = Application::PostUserEvent( LINK( this, SolarThreadExecutor, worker ) ); + sal_uLong nSolarMutexCount = Application::ReleaseSolarMutex(); + sal_uLong nEvent = Application::PostUserEvent( LINK( this, SolarThreadExecutor, worker ) ); if ( osl_cond_result_timeout == osl_waitCondition( m_aStart, _pTimeout ) ) { m_bTimeout = true; diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx index 0d03348e7712..d6aa0429bcf3 100644 --- a/vcl/source/helper/xconnection.cxx +++ b/vcl/source/helper/xconnection.cxx @@ -30,11 +30,18 @@ #include "precompiled_vcl.hxx" #include "svsys.h" +#include "rtl/ref.hxx" #include "vcl/xconnection.hxx" #include "vcl/svdata.hxx" #include "vcl/salinst.hxx" #include "vcl/svapp.hxx" +namespace { + +namespace css = com::sun::star; + +} + using namespace osl; using namespace vcl; using namespace com::sun::star::uno; @@ -44,13 +51,9 @@ using ::rtl::OUString; DisplayConnection::DisplayConnection() { - ImplSVData* pSVData = ImplGetSVData(); - pSVData->mpDefInst->SetEventCallback( this, dispatchEvent ); - pSVData->mpDefInst->SetErrorEventCallback( this, dispatchErrorEvent ); - SalInstance::ConnectionIdentifierType eType; int nBytes; - void* pBytes = pSVData->mpDefInst->GetConnectionIdentifier( eType, nBytes ); + void* pBytes = ImplGetSVData()->mpDefInst->GetConnectionIdentifier( eType, nBytes ); switch( eType ) { case SalInstance::AsciiCString: @@ -63,39 +66,54 @@ DisplayConnection::DisplayConnection() } DisplayConnection::~DisplayConnection() +{} + +void DisplayConnection::start() +{ + ImplSVData* pSVData = ImplGetSVData(); + pSVData->mpDefInst->SetEventCallback( this ); +} + +void DisplayConnection::terminate() { ImplSVData* pSVData = ImplGetSVData(); if( pSVData ) { - pSVData->mpDefInst->SetEventCallback( NULL, NULL ); - pSVData->mpDefInst->SetErrorEventCallback( NULL, NULL ); + pSVData->mpDefInst->SetEventCallback( NULL ); } -} + SolarMutexReleaser aRel; + + MutexGuard aGuard( m_aMutex ); + Any aEvent; + std::list< css::uno::Reference< XEventHandler > > aLocalList( m_aHandlers ); + for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = aLocalList.begin(); it != aLocalList.end(); ++it ) + (*it)->handleEvent( aEvent ); +} -void SAL_CALL DisplayConnection::addEventHandler( const Any& /*window*/, const Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw() +void SAL_CALL DisplayConnection::addEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw() { MutexGuard aGuard( m_aMutex ); m_aHandlers.push_back( handler ); } -void SAL_CALL DisplayConnection::removeEventHandler( const Any& /*window*/, const Reference< XEventHandler >& handler ) throw() +void SAL_CALL DisplayConnection::removeEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler ) throw() { MutexGuard aGuard( m_aMutex ); m_aHandlers.remove( handler ); } -void SAL_CALL DisplayConnection::addErrorHandler( const Reference< XEventHandler >& handler ) throw() +void SAL_CALL DisplayConnection::addErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw() { MutexGuard aGuard( m_aMutex ); m_aErrorHandlers.push_back( handler ); } -void SAL_CALL DisplayConnection::removeErrorHandler( const Reference< XEventHandler >& handler ) throw() +void SAL_CALL DisplayConnection::removeErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw() { MutexGuard aGuard( m_aMutex ); @@ -107,52 +125,37 @@ Any SAL_CALL DisplayConnection::getIdentifier() throw() return m_aAny; } -void DisplayConnection::dispatchDowningEvent() -{ - SolarMutexReleaser aRel; - - MutexGuard aGuard( m_aMutex ); - Any aEvent; - std::list< Reference< XEventHandler > > aLocalList( m_aHandlers ); - for( ::std::list< Reference< XEventHandler > >::const_iterator it = aLocalList.begin(); it != aLocalList.end(); ++it ) - (*it)->handleEvent( aEvent ); -} - -bool DisplayConnection::dispatchEvent( void* pThis, void* pData, int nBytes ) +bool DisplayConnection::dispatchEvent( void* pData, int nBytes ) { SolarMutexReleaser aRel; - DisplayConnection* This = (DisplayConnection*)pThis; - Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); Any aEvent; aEvent <<= aSeq; - ::std::list< Reference< XEventHandler > > handlers; + ::std::list< css::uno::Reference< XEventHandler > > handlers; { - MutexGuard aGuard( This->m_aMutex ); - handlers = This->m_aHandlers; + MutexGuard aGuard( m_aMutex ); + handlers = m_aHandlers; } - for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) + for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) if( (*it)->handleEvent( aEvent ) ) return true; return false; } -bool DisplayConnection::dispatchErrorEvent( void* pThis, void* pData, int nBytes ) +bool DisplayConnection::dispatchErrorEvent( void* pData, int nBytes ) { SolarMutexReleaser aRel; - DisplayConnection* This = (DisplayConnection*)pThis; - Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); Any aEvent; aEvent <<= aSeq; - ::std::list< Reference< XEventHandler > > handlers; + ::std::list< css::uno::Reference< XEventHandler > > handlers; { - MutexGuard aGuard( This->m_aMutex ); - handlers = This->m_aErrorHandlers; + MutexGuard aGuard( m_aMutex ); + handlers = m_aErrorHandlers; } - for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) + for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) if( (*it)->handleEvent( aEvent ) ) return true; diff --git a/vcl/source/salmain/makefile.mk b/vcl/source/salmain/makefile.mk index de085b482c4d..9c790bf28d75 100644 --- a/vcl/source/salmain/makefile.mk +++ b/vcl/source/salmain/makefile.mk @@ -28,11 +28,14 @@ PRJ = ..$/.. PRJNAME = vcl TARGET = salmain -LIBTARGET = NO ENABLE_EXCEPTIONS = TRUE .INCLUDE: settings.mk OBJFILES = $(OBJ)$/salmain.obj +LIB1TARGET=$(LB)$/vclmain.lib +LIB1ARCHIV=$(LB)$/libvclmain.a +LIB1FILES=$(LB)$/salmain.lib + .INCLUDE: target.mk diff --git a/vcl/source/src/images.src b/vcl/source/src/images.src index 871cd6af2b29..541ac34c29e7 100644 --- a/vcl/source/src/images.src +++ b/vcl/source/src/images.src @@ -38,25 +38,6 @@ Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_STDOFFSET) File = "check.png"; }; -Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_WINOFFSET) -{ - File = "checkwin.png"; -}; - -Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_OS2OFFSET) -{ - File = "checkos2.png"; -}; - -Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_MACOFFSET) -{ - File = "checkmac.png"; -}; - -Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_UNIXOFFSET) -{ - File = "checkunx.png"; -}; Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_MONOOFFSET) { @@ -80,26 +61,6 @@ Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_STDOFFSET) File = "radio.png"; }; -Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_WINOFFSET) -{ - File = "radiowin.png"; -}; - -Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_OS2OFFSET) -{ - File = "radioos2.png"; -}; - -Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_MACOFFSET) -{ - File = "radiomac.png"; -}; - -Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_UNIXOFFSET) -{ - File = "radiounx.png"; -}; - Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_MONOOFFSET) { File = "radiomono.bmp"; diff --git a/vcl/source/src/makefile.mk b/vcl/source/src/makefile.mk index 40b7d4e75dfe..2db77b7ffc74 100644 --- a/vcl/source/src/makefile.mk +++ b/vcl/source/src/makefile.mk @@ -44,7 +44,7 @@ SRC1FILES= images.src \ helptext.src \ units.src \ btntext.src \ - print.src + print.src \ RESLIB1NAME= $(RESTARGET) RESLIB1IMAGES= $(PRJ)$/source/src diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 01d3c64f7fdb..b4f4d56029e1 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -29,6 +29,7 @@ ModalDialog SV_DLG_PRINT { + HelpID = ".HelpID:vcl:PrintDialog:Dialog"; Text [en-US] = "Print"; Closeable = TRUE; Sizeable = TRUE; @@ -44,16 +45,19 @@ ModalDialog SV_DLG_PRINT Pos = MAP_APPFONT( 240, 195 ); Size = MAP_APPFONT( 50, 15 ); Text [en-US] = "~Print"; + HelpID = ".HelpID:vcl:PrintDialog:OK"; }; CancelButton SV_PRINT_CANCEL { Pos = MAP_APPFONT( 295, 195 ); Size = MAP_APPFONT( 50, 15 ); + HelpID = ".HelpID:vcl:PrintDialog:Cancel"; }; HelpButton SV_PRINT_HELP { Pos = MAP_APPFONT( 5, 5 ); Size = MAP_APPFONT( 50, 15 ); + HelpID = ".HelpID:vcl:PrintDialog:Help"; }; Window SV_PRINT_PAGE_PREVIEW @@ -61,6 +65,7 @@ ModalDialog SV_DLG_PRINT Pos = MAP_APPFONT( 5, 5 ); Size = MAP_APPFONT( 130, 130 ); Border = FALSE; + HelpID = ".HelpID:vcl:PrintDialog:Preview"; }; NumericField SV_PRINT_PAGE_EDIT { @@ -69,7 +74,7 @@ ModalDialog SV_DLG_PRINT SVLook = TRUE; Spin = FALSE; Border = TRUE; - HelpText [en-US] = "Select page to display in preview."; + HelpID = ".HelpID:vcl:PrintDialog:PageEdit"; }; FixedText SV_PRINT_PAGE_TXT { @@ -77,23 +82,25 @@ ModalDialog SV_DLG_PRINT Size = MAP_APPFONT( 30, 12 ); Text [ en-US ] = "/ %n"; VCenter = TRUE; + HelpID = ".HelpID:vcl:PrintDialog:NumPagesText"; }; PushButton SV_PRINT_PAGE_FORWARD { Pos = MAP_APPFONT( 95, 140 ); Size = MAP_APPFONT( 15, 12 ); - HelpText [en-US] = "Scroll one page forward."; + HelpID = ".HelpID:vcl:PrintDialog:ForwardBtn"; }; PushButton SV_PRINT_PAGE_BACKWARD { Pos = MAP_APPFONT( 80, 140 ); Size = MAP_APPFONT( 15, 12 ); - HelpText [en-US] = "Scroll one page backward."; + HelpID = ".HelpID:vcl:PrintDialog:BackwardBtn"; }; TabControl SV_PRINT_TABCTRL { Pos = MAP_APPFONT( 140, 5 ); Size = MAP_APPFONT( 205, 175 ); + HelpID = ".HelpID:vcl:PrintDialog:TabPages"; }; FixedLine SV_PRINT_BUTTONLINE { @@ -123,6 +130,7 @@ ModalDialog SV_DLG_PRINT TabPage SV_PRINT_TAB_NUP { + HelpID = ".HelpID:vcl:PrintDialog:NUpPage"; Text [en-US] = "Page Layout"; Hide = TRUE; @@ -132,34 +140,28 @@ ModalDialog SV_DLG_PRINT Size = MAP_APPFONT( 150, 10 ); Text [en-US] = "Layout"; }; - RadioButton SV_PRINT_PRT_NUP_DEFAULT_BTN - { - Pos = MAP_APPFONT( 0, 0 ); - Size = MAP_APPFONT( 10, 10 ); - Text [en-US] = "~Default"; - HelpText [en-US] = "Print one page per sheet of paper."; - }; RadioButton SV_PRINT_PRT_NUP_BROCHURE_BTN { + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:Brochure"; Pos = MAP_APPFONT( 0, 0 ); Size = MAP_APPFONT( 10, 10 ); Text = ""; }; RadioButton SV_PRINT_PRT_NUP_PAGES_BTN { + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:PagesPerSheet"; Pos = MAP_APPFONT( 0, 0 ); Size = MAP_APPFONT( 10, 10 ); Text [en-US] = "Pa~ges per sheet"; - HelpText [en-US] = "Print multiple pages per sheet of paper."; }; ListBox SV_PRINT_PRT_NUP_PAGES_BOX { + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:PagesPerSheetBox"; Pos = MAP_APPFONT( 0, 0 ); Size = MAP_APPFONT( 10, 80 ); Border = TRUE; DropDown = TRUE; CurPos = 0; - HelpText [en-US] = "Select how many pages to print per sheet of paper."; StringList [en-US] = { < "1"; 1; >; @@ -180,6 +182,7 @@ ModalDialog SV_DLG_PRINT }; NumericField SV_PRINT_PRT_NUP_COLS_EDT { + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:ColumnsBox"; Pos = MAP_APPFONT( 55, 20 ); Size = MAP_APPFONT( 40, 12 ); Border = TRUE; @@ -187,7 +190,6 @@ ModalDialog SV_DLG_PRINT Minimum = 1; Maximum = 32; Value = 1; - HelpText [en-US] = "Select number of columns."; }; FixedText SV_PRINT_PRT_NUP_TIMES_TXT { @@ -198,6 +200,7 @@ ModalDialog SV_DLG_PRINT }; NumericField SV_PRINT_PRT_NUP_ROWS_EDT { + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:RowsBox"; Pos = MAP_APPFONT( 55, 35 ); Size = MAP_APPFONT( 40, 12 ); Border = TRUE; @@ -205,7 +208,6 @@ ModalDialog SV_DLG_PRINT Minimum = 1; Maximum = 32; Value = 1; - HelpText [en-US] = "Select number of rows."; }; FixedText SV_PRINT_PRT_NUP_MARGINS_PAGES_1_TXT { @@ -215,13 +217,13 @@ ModalDialog SV_DLG_PRINT }; MetricField SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT { + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:PageMarginBox"; Pos = MAP_APPFONT( 55, 95 ); Size = MAP_APPFONT( 40, 12 ); Spin = TRUE; Border = TRUE; Value = 0; Unit = FUNIT_MM; - HelpText [en-US] = "Select margin between individual pages on each sheet of paper."; }; FixedText SV_PRINT_PRT_NUP_MARGINS_PAGES_2_TXT { @@ -237,13 +239,13 @@ ModalDialog SV_DLG_PRINT }; MetricField SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT { + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:SheetMarginBox"; Pos = MAP_APPFONT( 155, 95 ); Size = MAP_APPFONT( 40, 12 ); Spin = TRUE; Border = TRUE; Value = 0; Unit = FUNIT_MM; - HelpText [en-US] = "Select margin between the printed pages and paper edge."; }; FixedText SV_PRINT_PRT_NUP_MARGINS_SHEET_2_TXT { @@ -259,6 +261,7 @@ ModalDialog SV_DLG_PRINT }; ListBox SV_PRINT_PRT_NUP_ORIENTATION_BOX { + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:OrientationBox"; Pos = MAP_APPFONT( 0, 0 ); Size = MAP_APPFONT( 10, 40 ); Border = TRUE; @@ -270,7 +273,6 @@ ModalDialog SV_DLG_PRINT < "Portrait"; SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT; >; < "Landscape"; SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE; >; }; - HelpText [en-US] = "Select the orientation of the paper."; }; FixedText SV_PRINT_PRT_NUP_ORDER_TXT { @@ -280,29 +282,32 @@ ModalDialog SV_DLG_PRINT }; ListBox SV_PRINT_PRT_NUP_ORDER_BOX { + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:OrderBox"; Pos = MAP_APPFONT( 0, 0 ); - Size = MAP_APPFONT( 10, 20 ); + Size = MAP_APPFONT( 10, 50 ); DropDown = TRUE; Border = TRUE; CurPos = 0; StringList [en-US] = { - < "left to right, then down"; SV_PRINT_PRT_NUP_ORDER_LRTD; >; - < "top to bottom, then right"; SV_PRINT_PRT_NUP_ORDER_TDLR; >; + < "left to right, then down"; SV_PRINT_PRT_NUP_ORDER_LRTB; >; + < "top to bottom, then right"; SV_PRINT_PRT_NUP_ORDER_TBLR; >; + < "top to bottom, then left"; SV_PRINT_PRT_NUP_ORDER_TBRL; >; + < "right to left, then down"; SV_PRINT_PRT_NUP_ORDER_RLTB; >; }; - HelpText [en-US] = "Select order in which pages are to be printed."; }; CheckBox SV_PRINT_PRT_NUP_BORDER_CB { + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:BorderBox"; Pos = MAP_APPFONT( 10, 65 ); Size = MAP_APPFONT( 150, 12 ); Text [en-US] = "Draw a border around each page"; - HelpText [en-US] = "Check to draw a border around each page."; }; }; TabPage SV_PRINT_TAB_JOB { + HelpID = ".HelpID:vcl:PrintDialog:JobPage"; Text [en-US] = "General"; Hide = TRUE; @@ -314,18 +319,18 @@ ModalDialog SV_DLG_PRINT }; ListBox SV_PRINT_PRINTERS { + HelpID = ".HelpID:vcl:PrintDialog:JobPage:PrinterList"; Pos = MAP_APPFONT( 5, 5 ); Size = MAP_APPFONT( 100, 80 ); Border = TRUE; Sort = TRUE; - HelpText [en-US] = "Select the printer to print on."; }; CheckBox SV_PRINT_DETAILS_BTN { + HelpID = ".HelpID:vcl:PrintDialog:JobPage:DetailsBtn"; Pos = MAP_APPFONT( 5, 5 ); Size = MAP_APPFONT( 5, 5 ); Text [en-US] = "Details"; - HelpText [en-US] = "Show/Hide detailed information of the selected printer."; }; FixedText SV_PRINT_STATUS_TXT { @@ -347,10 +352,10 @@ ModalDialog SV_DLG_PRINT }; PushButton SV_PRINT_PRT_SETUP { + HelpID = ".HelpID:vcl:PrintDialog:JobPage:Properties"; Pos = MAP_APPFONT( 115, 5 ); Size = MAP_APPFONT( 50, 15 ); Text [en-US] = "Properties..."; - HelpText [en-US] = "Call the setup dialog of the selected printer."; }; FixedLine SV_PRINT_COPIES { @@ -366,6 +371,7 @@ ModalDialog SV_DLG_PRINT }; NumericField SV_PRINT_COPYCOUNT_FIELD { + HelpID = ".HelpID:vcl:PrintDialog:JobPage:Copies"; Pos = MAP_APPFONT( 10, 56 ); Size = MAP_APPFONT( 40, 12 ); Border = TRUE; @@ -373,7 +379,6 @@ ModalDialog SV_DLG_PRINT Minimum = 1; Maximum = 16384; Value = 1; - HelpText [en-US] = "Select the number of copies to be produced."; }; FixedImage SV_PRINT_COLLATE_IMAGE { @@ -382,10 +387,10 @@ ModalDialog SV_DLG_PRINT }; CheckBox SV_PRINT_COLLATE { + HelpID = ".HelpID:vcl:PrintDialog:JobPage:Collate"; Pos = MAP_APPFONT( 95, 45 ); Size = MAP_APPFONT( 70, 10 ); Text [en-US] = "Collate"; - HelpText [en-US] = "Select whether copies should be collated or not."; }; Image SV_PRINT_COLLATE_IMG @@ -397,12 +402,21 @@ ModalDialog SV_DLG_PRINT { ImageBitmap = Bitmap { File = "ncollate.png" ; }; }; + + CheckBox SV_PRINT_OPT_REVERSE + { + HelpID = ".HelpID:vcl:PrintDialog:OptPage:ToReverse"; + Pos = MAP_APPFONT( 10, 50 ); + Size = MAP_APPFONT( 200, 12 ); + Text [en-US] = "Print in ~reverse page order"; + }; }; TabPage SV_PRINT_TAB_OPT { Text [en-US] = "Options"; Hide = TRUE; + HelpID = ".HelpID:vcl:PrintDialog:OptPage"; FixedLine SV_PRINT_OPT_PRINT_FL { @@ -412,30 +426,24 @@ ModalDialog SV_DLG_PRINT }; CheckBox SV_PRINT_OPT_TOFILE { + HelpID = ".HelpID:vcl:PrintDialog:OptPage:ToFile"; Pos = MAP_APPFONT( 10, 20 ); Size = MAP_APPFONT( 200, 12 ); Text [en-US] = "Print to ~file"; - HelpText [en-US] = "Check to send output to a file instead of the actual printer."; }; CheckBox SV_PRINT_OPT_SINGLEJOBS { + HelpID = ".HelpID:vcl:PrintDialog:OptPage:SingleJobs"; Pos = MAP_APPFONT( 10, 35 ); Size = MAP_APPFONT( 200, 12 ); Text [en-US] = "~Create single print jobs for collated output"; - HelpText [en-US] = "Check to not rely on the printer to create collated copies but create a print job for each copy instead."; - }; - CheckBox SV_PRINT_OPT_REVERSE - { - Pos = MAP_APPFONT( 10, 50 ); - Size = MAP_APPFONT( 200, 12 ); - Text [en-US] = "Print in ~reverse page order"; - HelpText [en-US] = "Check to print pages in reverse order."; }; }; }; ModelessDialog SV_DLG_PRINT_PROGRESS { + HelpID = "vcl:ModelessDialog:SV_DLG_PRINT_PROGRESS"; Text [en-US] = "Printing"; Closeable = FALSE; Sizeable = FALSE; @@ -478,5 +486,51 @@ StringArray SV_PRINT_NATIVE_STRINGS < "Page number"; >; < "Number of pages"; >; < "More"; >; + < "Print selection only"; >; + }; +}; + +StringArray RID_STR_PAPERNAMES +{ + ItemList [en-US] = + { + < "A0"; >; + < "A1"; >; + < "A2"; >; + < "A3"; >; + < "A4"; >; + < "A5"; >; + < "B4 (ISO)"; >; + < "B5 (ISO)"; >; + < "Letter"; >; + < "Legal"; >; + < "Tabloid"; >; + < "User Defined"; >; + < "B6 (ISO)"; >; + < "C4 Envelope"; >; + < "C5 Envelope"; >; + < "C6 Envelope"; >; + < "C6/5 Envelope"; >; + < "DL Envelope"; >; + < "Dia Slide"; >; + < "Screen"; >; + < "C"; >; + < "D"; >; + < "E"; >; + < "Executive"; >; + < "Long Bond"; >; + < "#8 (Monarch) Envelope"; >; + < "#6 3/4 (Personal) Envelope"; >; + < "#9 Envelope"; >; + < "#10 Envelope"; >; + < "#11 Envelope"; >; + < "#12 Envelope"; >; + < "16 Kai"; >; + < "32 Kai"; >; + < "Big 32 Kai"; >; + < "B4 (JIS)"; >; + < "B5 (JIS)"; >; + < "B6 (JIS)"; >; }; }; + diff --git a/vcl/source/src/stdtext.src b/vcl/source/src/stdtext.src index 2c6574220a5f..1b95f7bb1d72 100644 --- a/vcl/source/src/stdtext.src +++ b/vcl/source/src/stdtext.src @@ -101,6 +101,11 @@ String SV_ACCESSERROR_TURNAROUND_MSG Text [ en-US ] = "The Java Access Bridge could not be started."; }; +String SV_ACCESSERROR_NO_FONTS +{ + Text [ en-US ] = "No fonts could be found on the system."; +}; + String SV_STDTEXT_ABOUT { Text [ en-US ] = "About %PRODUCTNAME"; diff --git a/vcl/source/src/throbber.src b/vcl/source/src/throbber.src new file mode 100755 index 000000000000..d3c5ea44035c --- /dev/null +++ b/vcl/source/src/throbber.src @@ -0,0 +1,114 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// TODO: we need a mechanism to add images to images.zip, *without* +// referring them in resource files. The below resources are never loaded +// at runtime, instead, the images in images.zip are accessed via +// private:graphicrepository/* URLs. + +Resource 1000 +{ + Image 1 { ImageBitmap = Bitmap{ file = "shared/spinner-16-01.png"; }; }; + Image 2 { ImageBitmap = Bitmap{ file = "shared/spinner-16-02.png"; }; }; + Image 3 { ImageBitmap = Bitmap{ file = "shared/spinner-16-03.png"; }; }; + Image 4 { ImageBitmap = Bitmap{ file = "shared/spinner-16-04.png"; }; }; + Image 5 { ImageBitmap = Bitmap{ file = "shared/spinner-16-05.png"; }; }; + Image 6 { ImageBitmap = Bitmap{ file = "shared/spinner-16-06.png"; }; }; +}; + +Resource 1001 +{ + Image 1 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-16-01.png"; }; }; + Image 2 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-16-02.png"; }; }; + Image 3 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-16-03.png"; }; }; + Image 4 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-16-04.png"; }; }; + Image 5 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-16-05.png"; }; }; + Image 6 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-16-06.png"; }; }; +}; + +Resource 1002 +{ + Image 1 { ImageBitmap = Bitmap{ file = "shared/spinner-32-01.png"; }; }; + Image 2 { ImageBitmap = Bitmap{ file = "shared/spinner-32-02.png"; }; }; + Image 3 { ImageBitmap = Bitmap{ file = "shared/spinner-32-03.png"; }; }; + Image 4 { ImageBitmap = Bitmap{ file = "shared/spinner-32-04.png"; }; }; + Image 5 { ImageBitmap = Bitmap{ file = "shared/spinner-32-05.png"; }; }; + Image 6 { ImageBitmap = Bitmap{ file = "shared/spinner-32-06.png"; }; }; + Image 7 { ImageBitmap = Bitmap{ file = "shared/spinner-32-07.png"; }; }; + Image 8 { ImageBitmap = Bitmap{ file = "shared/spinner-32-08.png"; }; }; + Image 9 { ImageBitmap = Bitmap{ file = "shared/spinner-32-09.png"; }; }; + Image 10 { ImageBitmap = Bitmap{ file = "shared/spinner-32-10.png"; }; }; + Image 11 { ImageBitmap = Bitmap{ file = "shared/spinner-32-11.png"; }; }; + Image 12 { ImageBitmap = Bitmap{ file = "shared/spinner-32-12.png"; }; }; +}; + +Resource 1003 +{ + Image 1 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-01.png"; }; }; + Image 2 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-02.png"; }; }; + Image 3 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-03.png"; }; }; + Image 4 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-04.png"; }; }; + Image 5 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-05.png"; }; }; + Image 6 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-06.png"; }; }; + Image 7 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-07.png"; }; }; + Image 8 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-08.png"; }; }; + Image 9 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-09.png"; }; }; + Image 10 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-10.png"; }; }; + Image 11 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-11.png"; }; }; + Image 12 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-12.png"; }; }; +}; + +Resource 1004 +{ + Image 1 { ImageBitmap = Bitmap{ file = "shared/spinner-64-01.png"; }; }; + Image 2 { ImageBitmap = Bitmap{ file = "shared/spinner-64-02.png"; }; }; + Image 3 { ImageBitmap = Bitmap{ file = "shared/spinner-64-03.png"; }; }; + Image 4 { ImageBitmap = Bitmap{ file = "shared/spinner-64-04.png"; }; }; + Image 5 { ImageBitmap = Bitmap{ file = "shared/spinner-64-05.png"; }; }; + Image 6 { ImageBitmap = Bitmap{ file = "shared/spinner-64-06.png"; }; }; + Image 7 { ImageBitmap = Bitmap{ file = "shared/spinner-64-07.png"; }; }; + Image 8 { ImageBitmap = Bitmap{ file = "shared/spinner-64-08.png"; }; }; + Image 9 { ImageBitmap = Bitmap{ file = "shared/spinner-64-09.png"; }; }; + Image 10 { ImageBitmap = Bitmap{ file = "shared/spinner-64-10.png"; }; }; + Image 11 { ImageBitmap = Bitmap{ file = "shared/spinner-64-11.png"; }; }; + Image 12 { ImageBitmap = Bitmap{ file = "shared/spinner-64-12.png"; }; }; +}; + +Resource 1005 +{ + Image 1 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-01.png"; }; }; + Image 2 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-02.png"; }; }; + Image 3 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-03.png"; }; }; + Image 4 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-04.png"; }; }; + Image 5 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-05.png"; }; }; + Image 6 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-06.png"; }; }; + Image 7 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-07.png"; }; }; + Image 8 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-08.png"; }; }; + Image 9 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-09.png"; }; }; + Image 10 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-10.png"; }; }; + Image 11 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-11.png"; }; }; + Image 12 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-12.png"; }; }; +}; diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx index c78a1eb13f6a..0f0caecfe856 100644 --- a/vcl/source/window/accel.cxx +++ b/vcl/source/window/accel.cxx @@ -42,7 +42,7 @@ DECLARE_TABLE( ImplAccelTable, ImplAccelEntry* ) typedef ::std::vector< ImplAccelEntry* > ImplAccelList; -#define ACCELENTRY_NOTFOUND ((USHORT)0xFFFF) +#define ACCELENTRY_NOTFOUND ((sal_uInt16)0xFFFF) // ======================================================================= @@ -59,14 +59,14 @@ DBG_NAME( Accelerator ) // ======================================================================= -USHORT ImplAccelEntryGetIndex( ImplAccelList* pList, USHORT nId, - USHORT* pIndex = NULL ) +sal_uInt16 ImplAccelEntryGetIndex( ImplAccelList* pList, sal_uInt16 nId, + sal_uInt16* pIndex = NULL ) { size_t nLow; size_t nHigh; size_t nMid; size_t nCount = pList->size(); - USHORT nCompareId; + sal_uInt16 nCompareId; // Abpruefen, ob der erste Key groesser als der Vergleichskey ist if ( !nCount || (nId < (*pList)[ 0 ]->mnId) ) @@ -90,7 +90,7 @@ USHORT ImplAccelEntryGetIndex( ImplAccelList* pList, USHORT nId, if ( nId > nCompareId ) nLow = nMid + 1; else - return (USHORT)nMid; + return (sal_uInt16)nMid; } } while ( nLow <= nHigh ); @@ -98,9 +98,9 @@ USHORT ImplAccelEntryGetIndex( ImplAccelList* pList, USHORT nId, if ( pIndex ) { if ( nId > nCompareId ) - *pIndex = (USHORT)(nMid+1); + *pIndex = (sal_uInt16)(nMid+1); else - *pIndex = (USHORT)nMid; + *pIndex = (sal_uInt16)nMid; } return ACCELENTRY_NOTFOUND; @@ -110,8 +110,8 @@ USHORT ImplAccelEntryGetIndex( ImplAccelList* pList, USHORT nId, static void ImplAccelEntryInsert( ImplAccelList* pList, ImplAccelEntry* pEntry ) { - USHORT nInsIndex; - USHORT nIndex = ImplAccelEntryGetIndex( pList, pEntry->mnId, &nInsIndex ); + sal_uInt16 nInsIndex; + sal_uInt16 nIndex = ImplAccelEntryGetIndex( pList, pEntry->mnId, &nInsIndex ); if ( nIndex != ACCELENTRY_NOTFOUND ) { @@ -145,9 +145,9 @@ static void ImplAccelEntryInsert( ImplAccelList* pList, ImplAccelEntry* pEntry ) // ----------------------------------------------------------------------- -static USHORT ImplAccelEntryGetFirstPos( ImplAccelList* pList, USHORT nId ) +static sal_uInt16 ImplAccelEntryGetFirstPos( ImplAccelList* pList, sal_uInt16 nId ) { - USHORT nIndex = ImplAccelEntryGetIndex( pList, nId ); + sal_uInt16 nIndex = ImplAccelEntryGetIndex( pList, nId ); if ( nIndex != ACCELENTRY_NOTFOUND ) { while ( nIndex ) @@ -170,7 +170,7 @@ void Accelerator::ImplInit() { mnCurId = 0; mnCurRepeat = 0; - mbIsCancel = FALSE; + mbIsCancel = sal_False; mpDel = NULL; } @@ -199,7 +199,7 @@ void Accelerator::ImplCopyData( ImplAccelData& rAccelData ) else pEntry->mpAutoAccel = NULL; - mpData->maKeyTable.Insert( (ULONG)pEntry->maKeyCode.GetFullKeyCode(), pEntry ); + mpData->maKeyTable.Insert( (sal_uLong)pEntry->maKeyCode.GetFullKeyCode(), pEntry ); mpData->maIdList.push_back( pEntry ); } } @@ -221,18 +221,18 @@ void Accelerator::ImplDeleteData() // ----------------------------------------------------------------------- -void Accelerator::ImplInsertAccel( USHORT nItemId, const KeyCode& rKeyCode, - BOOL bEnable, Accelerator* pAutoAccel ) +void Accelerator::ImplInsertAccel( sal_uInt16 nItemId, const KeyCode& rKeyCode, + sal_Bool bEnable, Accelerator* pAutoAccel ) { DBG_CHKTHIS( Accelerator, NULL ); DBG_ASSERT( nItemId, "Accelerator::InsertItem(): ItemId == 0" ); if ( rKeyCode.IsFunction() ) { - USHORT nCode1; - USHORT nCode2; - USHORT nCode3; - USHORT nCode4; + sal_uInt16 nCode1; + sal_uInt16 nCode2; + sal_uInt16 nCode3; + sal_uInt16 nCode4; ImplGetKeyCode( rKeyCode.GetFunction(), nCode1, nCode2, nCode3, nCode4 ); if ( nCode1 ) ImplInsertAccel( nItemId, KeyCode( nCode1, nCode1 ), bEnable, pAutoAccel ); @@ -260,7 +260,7 @@ void Accelerator::ImplInsertAccel( USHORT nItemId, const KeyCode& rKeyCode, pEntry->mbEnabled = bEnable; // Ab in die Tabellen - ULONG nCode = rKeyCode.GetFullKeyCode(); + sal_uLong nCode = rKeyCode.GetFullKeyCode(); if ( !nCode ) { OSL_FAIL( "Accelerator::InsertItem(): KeyCode with KeyCode 0 not allowed" ); @@ -319,9 +319,9 @@ void Accelerator::ImplLoadRes( const ResId& rResId ) GetRes( rResId ); maHelpStr = ReadStringRes(); - ULONG nObjFollows = ReadLongRes(); + sal_uLong nObjFollows = ReadLongRes(); - for( ULONG i = 0; i < nObjFollows; i++ ) + for( sal_uLong i = 0; i < nObjFollows; i++ ) { InsertItem( ResId( (RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr() ) ); IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) ); @@ -336,7 +336,7 @@ Accelerator::~Accelerator() // AccelManager benachrichtigen, das Accelrator geloescht wurde if ( mpDel ) - *mpDel = TRUE; + *mpDel = sal_True; ImplDeleteData(); delete mpData; @@ -365,9 +365,9 @@ void Accelerator::Select() // ----------------------------------------------------------------------- -void Accelerator::InsertItem( USHORT nItemId, const KeyCode& rKeyCode ) +void Accelerator::InsertItem( sal_uInt16 nItemId, const KeyCode& rKeyCode ) { - ImplInsertAccel( nItemId, rKeyCode, TRUE, NULL ); + ImplInsertAccel( nItemId, rKeyCode, sal_True, NULL ); } // ----------------------------------------------------------------------- @@ -376,15 +376,15 @@ void Accelerator::InsertItem( const ResId& rResId ) { DBG_CHKTHIS( Accelerator, NULL ); - ULONG nObjMask; - USHORT nAccelKeyId; - USHORT bDisable; + sal_uLong nObjMask; + sal_uInt16 nAccelKeyId; + sal_uInt16 bDisable; KeyCode aKeyCode; Accelerator* pAutoAccel = NULL; GetRes( rResId.SetRT( RSC_ACCELITEM ) ); nObjMask = ReadLongRes(); - nAccelKeyId = sal::static_int_cast<USHORT>(ReadLongRes()); + nAccelKeyId = sal::static_int_cast<sal_uInt16>(ReadLongRes()); bDisable = ReadShortRes(); if ( nObjMask & ACCELITEM_KEY ) @@ -407,15 +407,15 @@ void Accelerator::InsertItem( const ResId& rResId ) // ----------------------------------------------------------------------- -void Accelerator::RemoveItem( USHORT nItemId ) +void Accelerator::RemoveItem( sal_uInt16 nItemId ) { DBG_CHKTHIS( Accelerator, NULL ); // Aus der Id-Liste entfernen - USHORT nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); + sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); if ( nIndex != ACCELENTRY_NOTFOUND ) { - USHORT nItemCount = GetItemCount(); + sal_uInt16 nItemCount = GetItemCount(); do { ImplAccelEntry* pEntry = ( nIndex < mpData->maIdList.size() ) ? mpData->maIdList[ nIndex ] : NULL; @@ -450,8 +450,8 @@ void Accelerator::RemoveItem( const KeyCode rKeyCode ) if ( pEntry ) { // Aus der Id-Liste entfernen - USHORT nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), pEntry->mnId ); - USHORT nItemCount = GetItemCount(); + sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), pEntry->mnId ); + sal_uInt16 nItemCount = GetItemCount(); do { if ( mpData->maIdList[ nIndex ] == pEntry ) @@ -486,16 +486,16 @@ void Accelerator::Clear() // ----------------------------------------------------------------------- -USHORT Accelerator::GetItemCount() const +sal_uInt16 Accelerator::GetItemCount() const { DBG_CHKTHIS( Accelerator, NULL ); - return (USHORT)mpData->maIdList.size(); + return (sal_uInt16)mpData->maIdList.size(); } // ----------------------------------------------------------------------- -USHORT Accelerator::GetItemId( USHORT nPos ) const +sal_uInt16 Accelerator::GetItemId( sal_uInt16 nPos ) const { DBG_CHKTHIS( Accelerator, NULL ); @@ -508,7 +508,7 @@ USHORT Accelerator::GetItemId( USHORT nPos ) const // ----------------------------------------------------------------------- -KeyCode Accelerator::GetItemKeyCode( USHORT nPos ) const +KeyCode Accelerator::GetItemKeyCode( sal_uInt16 nPos ) const { DBG_CHKTHIS( Accelerator, NULL ); @@ -521,7 +521,7 @@ KeyCode Accelerator::GetItemKeyCode( USHORT nPos ) const // ----------------------------------------------------------------------- -USHORT Accelerator::GetItemId( const KeyCode& rKeyCode ) const +sal_uInt16 Accelerator::GetItemId( const KeyCode& rKeyCode ) const { DBG_CHKTHIS( Accelerator, NULL ); @@ -534,11 +534,11 @@ USHORT Accelerator::GetItemId( const KeyCode& rKeyCode ) const // ----------------------------------------------------------------------- -KeyCode Accelerator::GetKeyCode( USHORT nItemId ) const +KeyCode Accelerator::GetKeyCode( sal_uInt16 nItemId ) const { DBG_CHKTHIS( Accelerator, NULL ); - USHORT nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); + sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); if ( nIndex != ACCELENTRY_NOTFOUND ) return mpData->maIdList[ nIndex ]->maKeyCode; else @@ -547,17 +547,17 @@ KeyCode Accelerator::GetKeyCode( USHORT nItemId ) const // ----------------------------------------------------------------------- -BOOL Accelerator::IsIdValid( USHORT nItemId ) const +sal_Bool Accelerator::IsIdValid( sal_uInt16 nItemId ) const { DBG_CHKTHIS( Accelerator, NULL ); - USHORT nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId ); + sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId ); return (nIndex != ACCELENTRY_NOTFOUND); } // ----------------------------------------------------------------------- -BOOL Accelerator::IsKeyCodeValid( const KeyCode rKeyCode ) const +sal_Bool Accelerator::IsKeyCodeValid( const KeyCode rKeyCode ) const { DBG_CHKTHIS( Accelerator, NULL ); @@ -567,7 +567,7 @@ BOOL Accelerator::IsKeyCodeValid( const KeyCode rKeyCode ) const // ----------------------------------------------------------------------- -BOOL Accelerator::Call( const KeyCode& rKeyCode, USHORT nRepeat ) +sal_Bool Accelerator::Call( const KeyCode& rKeyCode, sal_uInt16 nRepeat ) { DBG_CHKTHIS( Accelerator, NULL ); @@ -576,7 +576,7 @@ BOOL Accelerator::Call( const KeyCode& rKeyCode, USHORT nRepeat ) { if ( pEntry->mbEnabled ) { - BOOL bDel = FALSE; + sal_Bool bDel = sal_False; mnCurId = pEntry->mnId; maCurKeyCode = rKeyCode; mnCurRepeat = nRepeat; @@ -589,23 +589,23 @@ BOOL Accelerator::Call( const KeyCode& rKeyCode, USHORT nRepeat ) mnCurRepeat = 0; } - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void Accelerator::SetAccel( USHORT nItemId, Accelerator* pAccel ) +void Accelerator::SetAccel( sal_uInt16 nItemId, Accelerator* pAccel ) { DBG_CHKTHIS( Accelerator, NULL ); - USHORT nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); + sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); if ( nIndex != ACCELENTRY_NOTFOUND ) { - USHORT nItemCount = GetItemCount(); + sal_uInt16 nItemCount = GetItemCount(); do { ImplAccelEntry* pEntry = mpData->maIdList[ nIndex ]; @@ -621,11 +621,11 @@ void Accelerator::SetAccel( USHORT nItemId, Accelerator* pAccel ) // ----------------------------------------------------------------------- -Accelerator* Accelerator::GetAccel( USHORT nItemId ) const +Accelerator* Accelerator::GetAccel( sal_uInt16 nItemId ) const { DBG_CHKTHIS( Accelerator, NULL ); - USHORT nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId ); + sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId ); if ( nIndex != ACCELENTRY_NOTFOUND ) return mpData->maIdList[ nIndex ]->mpAccel; else @@ -653,19 +653,19 @@ Accelerator* Accelerator::GetAccel( const KeyCode rKeyCode ) const if ( pEntry ) return pEntry->mpAccel; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void Accelerator::EnableItem( USHORT nItemId, BOOL bEnable ) +void Accelerator::EnableItem( sal_uInt16 nItemId, sal_Bool bEnable ) { DBG_CHKTHIS( Accelerator, NULL ); - USHORT nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); + sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); if ( nIndex != ACCELENTRY_NOTFOUND ) { - USHORT nItemCount = GetItemCount(); + sal_uInt16 nItemCount = GetItemCount(); do { ImplAccelEntry* pEntry = mpData->maIdList[ nIndex ]; @@ -681,20 +681,20 @@ void Accelerator::EnableItem( USHORT nItemId, BOOL bEnable ) // ----------------------------------------------------------------------- -BOOL Accelerator::IsItemEnabled( USHORT nItemId ) const +sal_Bool Accelerator::IsItemEnabled( sal_uInt16 nItemId ) const { DBG_CHKTHIS( Accelerator, NULL ); - USHORT nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId ); + sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId ); if ( nIndex != ACCELENTRY_NOTFOUND ) return mpData->maIdList[ nIndex ]->mbEnabled; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void Accelerator::EnableItem( const KeyCode rKeyCode, BOOL bEnable ) +void Accelerator::EnableItem( const KeyCode rKeyCode, sal_Bool bEnable ) { DBG_CHKTHIS( Accelerator, NULL ); @@ -705,7 +705,7 @@ void Accelerator::EnableItem( const KeyCode rKeyCode, BOOL bEnable ) // ----------------------------------------------------------------------- -BOOL Accelerator::IsItemEnabled( const KeyCode rKeyCode ) const +sal_Bool Accelerator::IsItemEnabled( const KeyCode rKeyCode ) const { DBG_CHKTHIS( Accelerator, NULL ); @@ -713,7 +713,7 @@ BOOL Accelerator::IsItemEnabled( const KeyCode rKeyCode ) const if ( pEntry ) return pEntry->mbEnabled; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -728,7 +728,7 @@ Accelerator& Accelerator::operator=( const Accelerator& rAccel ) maCurKeyCode = KeyCode(); mnCurId = 0; mnCurRepeat = 0; - mbIsCancel = FALSE; + mbIsCancel = sal_False; // Tabellen loeschen und kopieren ImplDeleteData(); diff --git a/vcl/source/window/accmgr.cxx b/vcl/source/window/accmgr.cxx index b45020460c08..c8b1e42c5ed1 100644 --- a/vcl/source/window/accmgr.cxx +++ b/vcl/source/window/accmgr.cxx @@ -50,20 +50,20 @@ ImplAccelManager::~ImplAccelManager() // ----------------------------------------------------------------------- -BOOL ImplAccelManager::InsertAccel( Accelerator* pAccel ) +sal_Bool ImplAccelManager::InsertAccel( Accelerator* pAccel ) { if ( !mpAccelList ) { mpAccelList = new ImplAccelList; } else { for ( size_t i = 0, n = mpAccelList->size(); i < n; ++i ) { if ( (*mpAccelList)[ i ] == pAccel ) { - return FALSE; + return sal_False; } } } mpAccelList->insert( mpAccelList->begin(), pAccel ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -79,7 +79,7 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel ) //we're removing an accelerator that a sub-accelerator which is in the //sequence list, throw away the entire sequence if ( mpSequenceList ) { - for (USHORT i = 0; i < pAccel->GetItemCount(); ++i) { + for (sal_uInt16 i = 0; i < pAccel->GetItemCount(); ++i) { Accelerator* pSubAccel = pAccel->GetAccel( pAccel->GetItemId(i) ); for ( size_t j = 0, n = mpSequenceList->size(); j < n; ++j ) { if ( (*mpSequenceList)[ j ] == pSubAccel ) { @@ -105,7 +105,7 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel ) // ----------------------------------------------------------------------- -void ImplAccelManager::EndSequence( BOOL bCancel ) +void ImplAccelManager::EndSequence( sal_Bool bCancel ) { // Sind wir ueberhaupt in einer Sequenz ? if ( !mpSequenceList ) @@ -115,13 +115,13 @@ void ImplAccelManager::EndSequence( BOOL bCancel ) for ( size_t i = 0, n = mpSequenceList->size(); i < n; ++i ) { Accelerator* pTempAccel = (*mpSequenceList)[ i ]; - BOOL bDel = FALSE; + sal_Bool bDel = sal_False; pTempAccel->mbIsCancel = bCancel; pTempAccel->mpDel = &bDel; pTempAccel->Deactivate(); if ( !bDel ) { - pTempAccel->mbIsCancel = FALSE; + pTempAccel->mbIsCancel = sal_False; pTempAccel->mpDel = NULL; } } @@ -133,15 +133,15 @@ void ImplAccelManager::EndSequence( BOOL bCancel ) // ----------------------------------------------------------------------- -BOOL ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, USHORT nRepeat ) +sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepeat ) { Accelerator* pAccel; // Haben wir ueberhaupt Acceleratoren ?? if ( !mpAccelList ) - return FALSE; + return sal_False; if ( mpAccelList->empty() ) - return FALSE; + return sal_False; // Sind wir in einer Sequenz ? if ( mpSequenceList ) @@ -154,7 +154,7 @@ BOOL ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, USHORT nRepeat ) { // Sequenz abbrechen FlushAccel(); - return FALSE; + return sal_False; } // Ist der Eintrag da drin ? @@ -172,7 +172,7 @@ BOOL ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, USHORT nRepeat ) // Activate-Handler vom Neuen rufen pNextAccel->Activate(); - return TRUE; + return sal_True; } else { @@ -184,7 +184,7 @@ BOOL ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, USHORT nRepeat ) // Dem Accelerator das aktuelle Item setzen // und Handler rufen - BOOL bDel = FALSE; + sal_Bool bDel = sal_False; pAccel->maCurKeyCode = rKeyCode; pAccel->mnCurId = pEntry->mnId; pAccel->mnCurRepeat = nRepeat; @@ -201,14 +201,14 @@ BOOL ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, USHORT nRepeat ) pAccel->mpDel = NULL; } - return TRUE; + return sal_True; } else { // Sequenz abbrechen, weil Acceleraor disabled // Taste wird weitergeleitet (ans System) FlushAccel(); - return FALSE; + return sal_False; } } } @@ -216,7 +216,7 @@ BOOL ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, USHORT nRepeat ) { // Sequenz abbrechen wegen falscher Taste FlushAccel(); - return FALSE; + return sal_False; } } @@ -245,7 +245,7 @@ BOOL ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, USHORT nRepeat ) // Activate-Handler vom Neuen rufen pNextAccel->Activate(); - return TRUE; + return sal_True; } else { @@ -258,7 +258,7 @@ BOOL ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, USHORT nRepeat ) // Dem Accelerator das aktuelle Item setzen // und Handler rufen - BOOL bDel = FALSE; + sal_Bool bDel = sal_False; pAccel->maCurKeyCode = rKeyCode; pAccel->mnCurId = pEntry->mnId; pAccel->mnCurRepeat = nRepeat; @@ -275,15 +275,15 @@ BOOL ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, USHORT nRepeat ) pAccel->mpDel = NULL; } - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } } } - return FALSE; + return sal_False; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/arrange.cxx b/vcl/source/window/arrange.cxx index 88e9af2b9f1c..28e0d8ae65fe 100644 --- a/vcl/source/window/arrange.cxx +++ b/vcl/source/window/arrange.cxx @@ -30,15 +30,37 @@ #include "vcl/arrange.hxx" #include "vcl/edit.hxx" +#include "vcl/svdata.hxx" +#include "vcl/svapp.hxx" + +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/awt/Rectangle.hpp" #include "osl/diagnose.h" using namespace vcl; +using namespace com::sun::star; // ---------------------------------------- // vcl::WindowArranger //----------------------------------------- +long WindowArranger::getDefaultBorder() +{ + ImplSVData* pSVData = ImplGetSVData(); + long nResult = pSVData->maAppData.mnDefaultLayoutBorder; + if( nResult < 0 ) + { + OutputDevice* pDefDev = Application::GetDefaultDevice(); + if( pDefDev ) + { + Size aBorder( pDefDev->LogicToPixel( Size( 3, 3 ), MapMode( MAP_APPFONT ) ) ); + nResult = pSVData->maAppData.mnDefaultLayoutBorder = aBorder.Height(); + } + } + return nResult > 0 ? nResult : 0; +} + WindowArranger::~WindowArranger() {} @@ -157,16 +179,26 @@ Size WindowArranger::Element::getOptimalSize( WindowSizeType i_eType ) const Size aResult; if( ! m_bHidden ) { + bool bVisible = false; if( m_pElement && m_pElement->IsVisible() ) + { aResult = m_pElement->GetOptimalSize( i_eType ); - else if( m_pChild ) + bVisible = true; + } + else if( m_pChild && m_pChild->isVisible() ) + { aResult = m_pChild->getOptimalSize( i_eType ); - if( aResult.Width() < m_aMinSize.Width() ) - aResult.Width() = m_aMinSize.Width(); - if( aResult.Height() < m_aMinSize.Height() ) - aResult.Height() = m_aMinSize.Height(); - aResult.Width() += m_nLeftBorder + m_nRightBorder; - aResult.Height() += m_nTopBorder + m_nBottomBorder; + bVisible = true; + } + if( bVisible ) + { + if( aResult.Width() < m_aMinSize.Width() ) + aResult.Width() = m_aMinSize.Width(); + if( aResult.Height() < m_aMinSize.Height() ) + aResult.Height() = m_aMinSize.Height(); + aResult.Width() += getBorderValue( m_nLeftBorder ) + getBorderValue( m_nRightBorder ); + aResult.Height() += getBorderValue( m_nTopBorder ) + getBorderValue( m_nBottomBorder ); + } } return aResult; @@ -176,16 +208,74 @@ void WindowArranger::Element::setPosSize( const Point& i_rPos, const Size& i_rSi { Point aPoint( i_rPos ); Size aSize( i_rSize ); - aPoint.X() += m_nLeftBorder; - aPoint.Y() += m_nTopBorder; - aSize.Width() -= m_nLeftBorder + m_nRightBorder; - aSize.Height() -= m_nTopBorder + m_nBottomBorder; + aPoint.X() += getBorderValue( m_nLeftBorder ); + aPoint.Y() += getBorderValue( m_nTopBorder ); + aSize.Width() -= getBorderValue( m_nLeftBorder ) + getBorderValue( m_nRightBorder ); + aSize.Height() -= getBorderValue( m_nTopBorder ) + getBorderValue( m_nBottomBorder ); if( m_pElement ) m_pElement->SetPosSizePixel( aPoint, aSize ); else if( m_pChild ) m_pChild->setManagedArea( Rectangle( aPoint, aSize ) ); } +uno::Sequence< beans::PropertyValue > WindowArranger::getProperties() const +{ + uno::Sequence< beans::PropertyValue > aRet( 3 ); + aRet[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OuterBorder" ) ); + aRet[0].Value = uno::makeAny( sal_Int32( getBorderValue( m_nOuterBorder ) ) ); + aRet[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ManagedArea" ) ); + awt::Rectangle aArea( m_aManagedArea.getX(), m_aManagedArea.getY(), m_aManagedArea.getWidth(), m_aManagedArea.getHeight() ); + aRet[1].Value = uno::makeAny( aArea ); + aRet[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ); + aRet[2].Value = uno::makeAny( sal_Bool( isVisible() ) ); + return aRet; +} + +void WindowArranger::setProperties( const uno::Sequence< beans::PropertyValue >& i_rProps ) +{ + const beans::PropertyValue* pProps = i_rProps.getConstArray(); + bool bResize = false; + for( sal_Int32 i = 0; i < i_rProps.getLength(); i++ ) + { + if( pProps[i].Name.equalsAscii( "OuterBorder" ) ) + { + sal_Int32 nVal = 0; + if( pProps[i].Value >>= nVal ) + { + if( getBorderValue( m_nOuterBorder ) != nVal ) + { + m_nOuterBorder = nVal; + bResize = true; + } + } + } + else if( pProps[i].Name.equalsAscii( "ManagedArea" ) ) + { + awt::Rectangle aArea( 0, 0, 0, 0 ); + if( pProps[i].Value >>= aArea ) + { + m_aManagedArea.setX( aArea.X ); + m_aManagedArea.setY( aArea.Y ); + m_aManagedArea.setWidth( aArea.Width ); + m_aManagedArea.setHeight( aArea.Height ); + bResize = true; + } + } + else if( pProps[i].Name.equalsAscii( "Visible" ) ) + { + sal_Bool bVal = sal_False; + if( pProps[i].Value >>= bVal ) + { + show( bVal, false ); + bResize = true; + } + } + } + if( bResize ) + resize(); +} + + // ---------------------------------------- // vcl::RowOrColumn //----------------------------------------- @@ -202,6 +292,7 @@ RowOrColumn::~RowOrColumn() Size RowOrColumn::getOptimalSize( WindowSizeType i_eType ) const { Size aRet( 0, 0 ); + long nDistance = getBorderValue( m_nBorderWidth ); for( std::vector< WindowArranger::Element >::const_iterator it = m_aElements.begin(); it != m_aElements.end(); ++it ) { @@ -212,7 +303,7 @@ Size RowOrColumn::getOptimalSize( WindowSizeType i_eType ) const if( m_bColumn ) { // add the distance between elements - aRet.Height() += m_nBorderWidth; + aRet.Height() += nDistance; // check if the width needs adjustment if( aRet.Width() < aElementSize.Width() ) aRet.Width() = aElementSize.Width(); @@ -221,7 +312,7 @@ Size RowOrColumn::getOptimalSize( WindowSizeType i_eType ) const else { // add the distance between elements - aRet.Width() += m_nBorderWidth; + aRet.Width() += nDistance; // check if the height needs adjustment if( aRet.Height() < aElementSize.Height() ) aRet.Height() = aElementSize.Height(); @@ -234,13 +325,14 @@ Size RowOrColumn::getOptimalSize( WindowSizeType i_eType ) const { // subtract the border for the first element if( m_bColumn ) - aRet.Height() -= m_nBorderWidth; + aRet.Height() -= nDistance; else - aRet.Width() -= m_nBorderWidth; + aRet.Width() -= nDistance; // add the outer border - aRet.Width() += 2*m_nOuterBorder; - aRet.Height() += 2*m_nOuterBorder; + long nOuterBorder = getBorderValue( m_nOuterBorder ); + aRet.Width() += 2*nOuterBorder; + aRet.Height() += 2*nOuterBorder; } return aRet; @@ -345,7 +437,9 @@ void RowOrColumn::resize() size_t nElements = m_aElements.size(); // get all element sizes for sizing std::vector<Size> aElementSizes( nElements ); - long nUsedWidth = 2*m_nOuterBorder - (nElements ? m_nBorderWidth : 0); + long nDistance = getBorderValue( m_nBorderWidth ); + long nOuterBorder = getBorderValue( m_nOuterBorder ); + long nUsedWidth = 2*nOuterBorder - (nElements ? nDistance : 0); for( size_t i = 0; i < nElements; i++ ) { if( m_aElements[i].isVisible() ) @@ -353,13 +447,13 @@ void RowOrColumn::resize() aElementSizes[i] = m_aElements[i].getOptimalSize( eType ); if( m_bColumn ) { - aElementSizes[i].Width() = m_aManagedArea.GetWidth() - 2* m_nOuterBorder; - nUsedWidth += aElementSizes[i].Height() + m_nBorderWidth; + aElementSizes[i].Width() = m_aManagedArea.GetWidth() - 2 * nOuterBorder; + nUsedWidth += aElementSizes[i].Height() + nDistance; } else { - aElementSizes[i].Height() = m_aManagedArea.GetHeight() - 2* m_nOuterBorder; - nUsedWidth += aElementSizes[i].Width() + m_nBorderWidth; + aElementSizes[i].Height() = m_aManagedArea.GetHeight() - 2 * nOuterBorder; + nUsedWidth += aElementSizes[i].Width() + nDistance; } } } @@ -376,8 +470,8 @@ void RowOrColumn::resize() // get starting position Point aElementPos( m_aManagedArea.TopLeft() ); // outer border - aElementPos.X() += m_nOuterBorder; - aElementPos.Y() += m_nOuterBorder; + aElementPos.X() += nOuterBorder; + aElementPos.Y() += nOuterBorder; // position managed windows for( size_t i = 0; i < nElements; i++ ) @@ -387,27 +481,27 @@ void RowOrColumn::resize() { m_aElements[i].setPosSize( aElementPos, aElementSizes[i] ); if( m_bColumn ) - aElementPos.Y() += m_nBorderWidth + aElementSizes[i].Height(); + aElementPos.Y() += nDistance + aElementSizes[i].Height(); else - aElementPos.X() += m_nBorderWidth + aElementSizes[i].Width(); + aElementPos.X() += nDistance + aElementSizes[i].Width(); } } } -size_t RowOrColumn::addWindow( Window* i_pWindow, sal_Int32 i_nExpandPrio, size_t i_nIndex ) +size_t RowOrColumn::addWindow( Window* i_pWindow, sal_Int32 i_nExpandPrio, const Size& i_rMinSize, size_t i_nIndex ) { size_t nIndex = i_nIndex; if( i_nIndex >= m_aElements.size() ) { nIndex = m_aElements.size(); - m_aElements.push_back( WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio ) ); + m_aElements.push_back( WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio, i_rMinSize ) ); } else { std::vector< WindowArranger::Element >::iterator it = m_aElements.begin(); while( i_nIndex-- ) ++it; - m_aElements.insert( it, WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio ) ); + m_aElements.insert( it, WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio, i_rMinSize ) ); } return nIndex; } @@ -480,14 +574,14 @@ Size LabeledElement::getOptimalSize( WindowSizeType i_eType ) const if( m_nLabelColumnWidth != 0 ) aRet.Width() = m_nLabelColumnWidth; else - aRet.Width() += m_nDistance; + aRet.Width() += getBorderValue( m_nDistance ); } Size aElementSize( m_aElement.getOptimalSize( i_eType ) ); aRet.Width() += aElementSize.Width(); if( aElementSize.Height() > aRet.Height() ) aRet.Height() = aElementSize.Height(); if( aRet.Height() != 0 ) - aRet.Height() += 2*m_nOuterBorder; + aRet.Height() += 2 * getBorderValue( m_nOuterBorder ); return aRet; } @@ -496,23 +590,25 @@ void LabeledElement::resize() { Size aLabelSize( m_aLabel.getOptimalSize( WINDOWSIZE_MINIMUM ) ); Size aElementSize( m_aElement.getOptimalSize( WINDOWSIZE_PREFERRED ) ); - if( m_nDistance + aLabelSize.Width() + aElementSize.Width() > m_aManagedArea.GetWidth() ) + long nDistance = getBorderValue( m_nDistance ); + long nOuterBorder = getBorderValue( m_nOuterBorder ); + if( nDistance + aLabelSize.Width() + aElementSize.Width() > m_aManagedArea.GetWidth() ) aElementSize = m_aElement.getOptimalSize( WINDOWSIZE_MINIMUM ); // align label and element vertically in LabeledElement - long nYOff = (m_aManagedArea.GetHeight() - 2*m_nOuterBorder - aLabelSize.Height()) / 2; + long nYOff = (m_aManagedArea.GetHeight() - 2*nOuterBorder - aLabelSize.Height()) / 2; Point aPos( m_aManagedArea.Left(), - m_aManagedArea.Top() + m_nOuterBorder + nYOff ); + m_aManagedArea.Top() + nOuterBorder + nYOff ); Size aSize( aLabelSize ); if( m_nLabelColumnWidth != 0 ) aSize.Width() = m_nLabelColumnWidth; m_aLabel.setPosSize( aPos, aSize ); - aPos.X() += aSize.Width() + m_nDistance; - nYOff = (m_aManagedArea.GetHeight() - 2*m_nOuterBorder - aElementSize.Height()) / 2; - aPos.Y() = m_aManagedArea.Top() + m_nOuterBorder + nYOff; + aPos.X() += aSize.Width() + nDistance; + nYOff = (m_aManagedArea.GetHeight() - 2*nOuterBorder - aElementSize.Height()) / 2; + aPos.Y() = m_aManagedArea.Top() + nOuterBorder + nYOff; aSize.Width() = aElementSize.Width(); - aSize.Height() = m_aManagedArea.GetHeight() - 2*m_nOuterBorder; + aSize.Height() = m_aManagedArea.GetHeight() - 2*nOuterBorder; // label style // 0: position left and right @@ -579,18 +675,22 @@ long LabelColumn::getLabelWidth() const if( pLW ) { Size aLabSize( pLW->GetOptimalSize( WINDOWSIZE_MINIMUM ) ); + long nLB = 0; + pLabel->getBorders(0, &nLB); + aLabSize.Width() += getBorderValue( nLB ); if( aLabSize.Width() > nWidth ) nWidth = aLabSize.Width(); } } } } - return nWidth + getBorderWidth(); + return nWidth + getBorderValue( getBorderWidth() ); } Size LabelColumn::getOptimalSize( WindowSizeType i_eType ) const { long nWidth = getLabelWidth(); + long nOuterBorder = getBorderValue( m_nOuterBorder ); Size aColumnSize; // every child is a LabeledElement @@ -623,19 +723,19 @@ Size LabelColumn::getOptimalSize( WindowSizeType i_eType ) const } if( aElementSize.Width() ) { - aElementSize.Width() += 2*m_nOuterBorder; + aElementSize.Width() += 2*nOuterBorder; if( aElementSize.Width() > aColumnSize.Width() ) aColumnSize.Width() = aElementSize.Width(); } if( aElementSize.Height() ) { - aColumnSize.Height() += getBorderWidth() + aElementSize.Height(); + aColumnSize.Height() += getBorderValue( getBorderWidth() ) + aElementSize.Height(); } } if( nEle > 0 && aColumnSize.Height() ) { - aColumnSize.Height() -= getBorderWidth(); // for the first element - aColumnSize.Height() += 2*m_nOuterBorder; + aColumnSize.Height() -= getBorderValue( getBorderWidth() ); // for the first element + aColumnSize.Height() += 2*nOuterBorder; } return aColumnSize; } @@ -668,12 +768,13 @@ size_t LabelColumn::addRow( Window* i_pLabel, boost::shared_ptr<WindowArranger> return nIndex; } -size_t LabelColumn::addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent ) +size_t LabelColumn::addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent, const Size& i_rElementMinSize ) { boost::shared_ptr< LabeledElement > xLabel( new LabeledElement( this, 1 ) ); xLabel->setLabel( i_pLabel ); xLabel->setBorders( 0, i_nIndent, 0, 0, 0 ); xLabel->setElement( i_pElement ); + xLabel->setMinimumSize( 1, i_rElementMinSize ); size_t nIndex = addChild( xLabel ); resize(); return nIndex; @@ -691,19 +792,23 @@ Indenter::~Indenter() Size Indenter::getOptimalSize( WindowSizeType i_eType ) const { Size aSize( m_aElement.getOptimalSize( i_eType ) ); - aSize.Width() += 2*m_nOuterBorder + m_nIndent; - aSize.Height() += 2*m_nOuterBorder; + long nOuterBorder = getBorderValue( m_nOuterBorder ); + long nIndent = getBorderValue( m_nIndent ); + aSize.Width() += 2*nOuterBorder + nIndent; + aSize.Height() += 2*nOuterBorder; return aSize; } void Indenter::resize() { + long nOuterBorder = getBorderValue( m_nOuterBorder ); + long nIndent = getBorderValue( m_nIndent ); Point aPt( m_aManagedArea.TopLeft() ); - aPt.X() += m_nOuterBorder + m_nIndent; - aPt.Y() += m_nOuterBorder; + aPt.X() += nOuterBorder + nIndent; + aPt.Y() += nOuterBorder; Size aSz( m_aManagedArea.GetSize() ); - aSz.Width() -= 2*m_nOuterBorder + m_nIndent; - aSz.Height() -= 2*m_nOuterBorder; + aSz.Width() -= 2*nOuterBorder + nIndent; + aSz.Height() -= 2*nOuterBorder; m_aElement.setPosSize( aPt, aSz ); } @@ -729,9 +834,13 @@ MatrixArranger::~MatrixArranger() { } -Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights ) const +Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, + std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights, + std::vector<sal_Int32>& o_rColumnPrio, std::vector<sal_Int32>& o_rRowPrio + ) const { - Size aMatrixSize( 2*m_nOuterBorder, 2*m_nOuterBorder ); + long nOuterBorder = getBorderValue( m_nOuterBorder ); + Size aMatrixSize( 2*nOuterBorder, 2*nOuterBorder ); // first find out the current number of rows and columns sal_uInt32 nRows = 0, nColumns = 0; @@ -747,6 +856,8 @@ Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>& // now allocate row and column depth vectors o_rColumnWidths = std::vector< long >( nColumns, 0 ); o_rRowHeights = std::vector< long >( nRows, 0 ); + o_rColumnPrio = std::vector< sal_Int32 >( nColumns, 0 ); + o_rRowPrio = std::vector< sal_Int32 >( nRows, 0 ); // get sizes an allocate them into rows/columns for( std::vector< MatrixElement >::const_iterator it = m_aElements.begin(); @@ -757,18 +868,24 @@ Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>& o_rColumnWidths[ it->m_nX ] = aSize.Width(); if( aSize.Height() > o_rRowHeights[ it->m_nY ] ) o_rRowHeights[ it->m_nY ] = aSize.Height(); + if( it->m_nExpandPriority > o_rColumnPrio[ it->m_nX ] ) + o_rColumnPrio[ it->m_nX ] = it->m_nExpandPriority; + if( it->m_nExpandPriority > o_rRowPrio[ it->m_nY ] ) + o_rRowPrio[ it->m_nY ] = it->m_nExpandPriority; } // add up sizes + long nDistanceX = getBorderValue( m_nBorderX ); + long nDistanceY = getBorderValue( m_nBorderY ); for( sal_uInt32 i = 0; i < nColumns; i++ ) - aMatrixSize.Width() += o_rColumnWidths[i] + m_nBorderX; + aMatrixSize.Width() += o_rColumnWidths[i] + nDistanceX; if( nColumns > 0 ) - aMatrixSize.Width() -= m_nBorderX; + aMatrixSize.Width() -= nDistanceX; for( sal_uInt32 i = 0; i < nRows; i++ ) - aMatrixSize.Height() += o_rRowHeights[i] + m_nBorderY; + aMatrixSize.Height() += o_rRowHeights[i] + nDistanceY; if( nRows > 0 ) - aMatrixSize.Height() -= m_nBorderY; + aMatrixSize.Height() -= nDistanceY; return aMatrixSize; } @@ -776,9 +893,48 @@ Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>& Size MatrixArranger::getOptimalSize( WindowSizeType i_eType ) const { std::vector<long> aColumnWidths, aRowHeights; - return getOptimalSize( i_eType, aColumnWidths, aRowHeights ); + std::vector<sal_Int32> aColumnPrio, aRowPrio; + return getOptimalSize( i_eType, aColumnWidths, aRowHeights, aColumnPrio, aRowPrio ); } +void MatrixArranger::distributeExtraSize( std::vector<long>& io_rSizes, const std::vector<sal_Int32>& i_rPrios, long i_nExtraWidth ) +{ + if( ! io_rSizes.empty() && io_rSizes.size() == i_rPrios.size() ) // sanity check + { + // find all elements with the highest expand priority + size_t nElements = io_rSizes.size(); + std::vector< size_t > aIndices; + sal_Int32 nHighPrio = 0; + for( size_t i = 0; i < nElements; i++ ) + { + sal_Int32 nCurPrio = i_rPrios[ i ]; + if( nCurPrio > nHighPrio ) + { + aIndices.clear(); + nHighPrio = nCurPrio; + } + if( nCurPrio == nHighPrio ) + aIndices.push_back( i ); + } + + // distribute extra space evenly among collected elements + nElements = aIndices.size(); + if( nElements > 0 ) + { + long nDelta = i_nExtraWidth / nElements; + for( size_t i = 0; i < nElements; i++ ) + { + io_rSizes[ aIndices[i] ] += nDelta; + i_nExtraWidth -= nDelta; + } + // add the last pixels to the last row element + if( i_nExtraWidth > 0 && nElements > 0 ) + io_rSizes[aIndices.back()] += i_nExtraWidth; + } + } +} + + void MatrixArranger::resize() { // assure that we have at least one row and column @@ -787,30 +943,44 @@ void MatrixArranger::resize() // check if we can get optimal size, else fallback to minimal size std::vector<long> aColumnWidths, aRowHeights; - Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED, aColumnWidths, aRowHeights ) ); + std::vector<sal_Int32> aColumnPrio, aRowPrio; + Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED, aColumnWidths, aRowHeights, aColumnPrio, aRowPrio ) ); if( aOptSize.Height() > m_aManagedArea.GetHeight() || aOptSize.Width() > m_aManagedArea.GetWidth() ) { std::vector<long> aMinColumnWidths, aMinRowHeights; - getOptimalSize( WINDOWSIZE_MINIMUM, aMinColumnWidths, aMinRowHeights ); + getOptimalSize( WINDOWSIZE_MINIMUM, aMinColumnWidths, aMinRowHeights, aColumnPrio, aRowPrio ); if( aOptSize.Height() > m_aManagedArea.GetHeight() ) aRowHeights = aMinRowHeights; if( aOptSize.Width() > m_aManagedArea.GetWidth() ) aColumnWidths = aMinColumnWidths; } - // FIXME: distribute extra space available + // distribute extra space available + long nExtraSize = m_aManagedArea.GetWidth(); + for( size_t i = 0; i < aColumnWidths.size(); ++i ) + nExtraSize -= aColumnWidths[i] + m_nBorderX; + if( nExtraSize > 0 ) + distributeExtraSize( aColumnWidths, aColumnPrio, nExtraSize ); + nExtraSize = m_aManagedArea.GetHeight(); + for( size_t i = 0; i < aRowHeights.size(); ++i ) + nExtraSize -= aRowHeights[i] + m_nBorderY; + if( nExtraSize > 0 ) + distributeExtraSize( aRowHeights, aRowPrio, nExtraSize ); // prepare offsets + long nDistanceX = getBorderValue( m_nBorderX ); + long nDistanceY = getBorderValue( m_nBorderY ); + long nOuterBorder = getBorderValue( m_nOuterBorder ); std::vector<long> aColumnX( aColumnWidths.size() ); - aColumnX[0] = m_aManagedArea.Left() + m_nOuterBorder; + aColumnX[0] = m_aManagedArea.Left() + nOuterBorder; for( size_t i = 1; i < aColumnX.size(); i++ ) - aColumnX[i] = aColumnX[i-1] + aColumnWidths[i-1] + m_nBorderX; + aColumnX[i] = aColumnX[i-1] + aColumnWidths[i-1] + nDistanceX; std::vector<long> aRowY( aRowHeights.size() ); - aRowY[0] = m_aManagedArea.Top() + m_nOuterBorder; + aRowY[0] = m_aManagedArea.Top() + nOuterBorder; for( size_t i = 1; i < aRowY.size(); i++ ) - aRowY[i] = aRowY[i-1] + aRowHeights[i-1] + m_nBorderY; + aRowY[i] = aRowY[i-1] + aRowHeights[i-1] + nDistanceY; // now iterate over the elements and assign their positions for( std::vector< MatrixElement >::iterator it = m_aElements.begin(); @@ -822,7 +992,7 @@ void MatrixArranger::resize() } } -size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio ) +size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio, const Size& i_rMinSize ) { sal_uInt64 nMapValue = getMap( i_nX, i_nY ); std::map< sal_uInt64, size_t >::const_iterator it = m_aMatrixMap.find( nMapValue ); @@ -830,7 +1000,7 @@ size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32 if( it == m_aMatrixMap.end() ) { m_aMatrixMap[ nMapValue ] = nIndex = m_aElements.size(); - m_aElements.push_back( MatrixElement( i_pWindow, i_nX, i_nY, boost::shared_ptr<WindowArranger>(), i_nExpandPrio ) ); + m_aElements.push_back( MatrixElement( i_pWindow, i_nX, i_nY, boost::shared_ptr<WindowArranger>(), i_nExpandPrio, i_rMinSize ) ); } else { @@ -838,6 +1008,7 @@ size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32 rEle.m_pElement = i_pWindow; rEle.m_pChild.reset(); rEle.m_nExpandPriority = i_nExpandPrio; + rEle.m_aMinSize = i_rMinSize; rEle.m_nX = i_nX; rEle.m_nY = i_nY; nIndex = it->second; diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index ebb63f07b11b..a71aadc3cdad 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -53,7 +53,7 @@ using namespace ::com::sun::star::uno; // ======================================================================= -static void ImplGetPinImage( USHORT nStyle, BOOL bPinIn, Image& rImage ) +static void ImplGetPinImage( sal_uInt16 nStyle, sal_Bool bPinIn, Image& rImage ) { // ImageListe laden, wenn noch nicht vorhanden ImplSVData* pSVData = ImplGetSVData(); @@ -71,7 +71,7 @@ static void ImplGetPinImage( USHORT nStyle, BOOL bPinIn, Image& rImage ) } // Image ermitteln und zurueckgeben - USHORT nId; + sal_uInt16 nId; if ( nStyle & BUTTON_DRAW_PRESSED ) { if ( bPinIn ) @@ -126,9 +126,9 @@ static void ImplDrawBrdWinSymbol( OutputDevice* pDev, static void ImplDrawBrdWinSymbolButton( OutputDevice* pDev, const Rectangle& rRect, - SymbolType eSymbol, USHORT nState ) + SymbolType eSymbol, sal_uInt16 nState ) { - BOOL bMouseOver = (nState & BUTTON_DRAW_HIGHLIGHT) != 0; + sal_Bool bMouseOver = (nState & BUTTON_DRAW_HIGHLIGHT) != 0; nState &= ~BUTTON_DRAW_HIGHLIGHT; Rectangle aTempRect; @@ -141,8 +141,8 @@ static void ImplDrawBrdWinSymbolButton( OutputDevice* pDev, pWin->SetFillColor( pDev->GetSettings().GetStyleSettings().GetWindowColor() ); pWin->SetLineColor(); pWin->DrawRect( rRect ); - pWin->DrawSelectionBackground( rRect, 2, (nState & BUTTON_DRAW_PRESSED) ? TRUE : FALSE, - TRUE, FALSE ); + pWin->DrawSelectionBackground( rRect, 2, (nState & BUTTON_DRAW_PRESSED) ? sal_True : sal_False, + sal_True, sal_False ); } aTempRect = rRect; aTempRect.nLeft+=3; @@ -171,23 +171,23 @@ ImplBorderWindowView::~ImplBorderWindowView() // ----------------------------------------------------------------------- -BOOL ImplBorderWindowView::MouseMove( const MouseEvent& ) +sal_Bool ImplBorderWindowView::MouseMove( const MouseEvent& ) { - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL ImplBorderWindowView::MouseButtonDown( const MouseEvent& ) +sal_Bool ImplBorderWindowView::MouseButtonDown( const MouseEvent& ) { - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL ImplBorderWindowView::Tracking( const TrackingEvent& ) +sal_Bool ImplBorderWindowView::Tracking( const TrackingEvent& ) { - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -242,7 +242,7 @@ void ImplBorderWindowView::ImplInitTitle( ImplBorderFrameData* pData ) // ----------------------------------------------------------------------- -USHORT ImplBorderWindowView::ImplHitTest( ImplBorderFrameData* pData, const Point& rPos ) +sal_uInt16 ImplBorderWindowView::ImplHitTest( ImplBorderFrameData* pData, const Point& rPos ) { ImplBorderWindow* pBorderWindow = pData->mpBorderWindow; @@ -321,15 +321,15 @@ USHORT ImplBorderWindowView::ImplHitTest( ImplBorderFrameData* pData, const Poin // ----------------------------------------------------------------------- -BOOL ImplBorderWindowView::ImplMouseMove( ImplBorderFrameData* pData, const MouseEvent& rMEvt ) +sal_Bool ImplBorderWindowView::ImplMouseMove( ImplBorderFrameData* pData, const MouseEvent& rMEvt ) { - USHORT oldCloseState = pData->mnCloseState; - USHORT oldMenuState = pData->mnMenuState; + sal_uInt16 oldCloseState = pData->mnCloseState; + sal_uInt16 oldMenuState = pData->mnMenuState; pData->mnCloseState &= ~BUTTON_DRAW_HIGHLIGHT; pData->mnMenuState &= ~BUTTON_DRAW_HIGHLIGHT; Point aMousePos = rMEvt.GetPosPixel(); - USHORT nHitTest = ImplHitTest( pData, aMousePos ); + sal_uInt16 nHitTest = ImplHitTest( pData, aMousePos ); PointerStyle ePtrStyle = POINTER_ARROW; if ( nHitTest & BORDERWINDOW_HITTEST_LEFT ) ePtrStyle = POINTER_WINDOW_WSIZE; @@ -358,12 +358,12 @@ BOOL ImplBorderWindowView::ImplMouseMove( ImplBorderFrameData* pData, const Mous if( pData->mnMenuState != oldMenuState ) pData->mpBorderWindow->Invalidate( pData->maMenuRect ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL ImplBorderWindowView::ImplMouseButtonDown( ImplBorderFrameData* pData, const MouseEvent& rMEvt ) +sal_Bool ImplBorderWindowView::ImplMouseButtonDown( ImplBorderFrameData* pData, const MouseEvent& rMEvt ) { ImplBorderWindow* pBorderWindow = pData->mpBorderWindow; @@ -371,11 +371,11 @@ BOOL ImplBorderWindowView::ImplMouseButtonDown( ImplBorderFrameData* pData, cons { pData->maMouseOff = rMEvt.GetPosPixel(); pData->mnHitTest = ImplHitTest( pData, pData->maMouseOff ); - USHORT nDragFullTest = 0; + sal_uInt16 nDragFullTest = 0; if ( pData->mnHitTest ) { - BOOL bTracking = TRUE; - BOOL bHitTest = TRUE; + sal_Bool bTracking = sal_True; + sal_Bool bHitTest = sal_True; if ( pData->mnHitTest & BORDERWINDOW_HITTEST_CLOSE ) { @@ -440,18 +440,18 @@ BOOL ImplBorderWindowView::ImplMouseButtonDown( ImplBorderFrameData* pData, cons } else { - bTracking = FALSE; + bTracking = sal_False; if ( (pData->mnHitTest & BORDERWINDOW_DRAW_TITLE) && ((rMEvt.GetClicks() % 2) == 0) ) { pData->mnHitTest = 0; - bHitTest = FALSE; + bHitTest = sal_False; if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() ) { SystemWindow* pClientWindow = (SystemWindow*)(pBorderWindow->ImplGetClientWindow()); - if ( TRUE /*pBorderWindow->mbDockBtn*/ ) // always perform docking on double click, no button required + if ( sal_True /*pBorderWindow->mbDockBtn*/ ) // always perform docking on double click, no button required pClientWindow->TitleButtonClick( TITLE_BUTTON_DOCKING ); else if ( pBorderWindow->GetStyle() & WB_ROLLABLE ) { @@ -468,9 +468,9 @@ BOOL ImplBorderWindowView::ImplMouseButtonDown( ImplBorderFrameData* pData, cons if ( bTracking ) { - pData->mbDragFull = FALSE; + pData->mbDragFull = sal_False; if ( nDragFullTest ) - pData->mbDragFull = TRUE; // always fulldrag for proper docking, ignore system settings + pData->mbDragFull = sal_True; // always fulldrag for proper docking, ignore system settings pBorderWindow->StartTracking(); } else if ( bHitTest ) @@ -478,18 +478,18 @@ BOOL ImplBorderWindowView::ImplMouseButtonDown( ImplBorderFrameData* pData, cons } } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL ImplBorderWindowView::ImplTracking( ImplBorderFrameData* pData, const TrackingEvent& rTEvt ) +sal_Bool ImplBorderWindowView::ImplTracking( ImplBorderFrameData* pData, const TrackingEvent& rTEvt ) { ImplBorderWindow* pBorderWindow = pData->mpBorderWindow; if ( rTEvt.IsTrackingEnded() ) { - USHORT nHitTest = pData->mnHitTest; + sal_uInt16 nHitTest = pData->mnHitTest; pData->mnHitTest = 0; if ( nHitTest & BORDERWINDOW_HITTEST_CLOSE ) @@ -931,7 +931,7 @@ BOOL ImplBorderWindowView::ImplTracking( ImplBorderFrameData* pData, const Track } } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -940,9 +940,9 @@ String ImplBorderWindowView::ImplRequestHelp( ImplBorderFrameData* pData, const Point& rPos, Rectangle& rHelpRect ) { - USHORT nHelpId = 0; + sal_uInt16 nHelpId = 0; String aHelpStr; - USHORT nHitTest = ImplHitTest( pData, rPos ); + sal_uInt16 nHitTest = ImplHitTest( pData, rPos ); if ( nHitTest ) { if ( nHitTest & BORDERWINDOW_HITTEST_CLOSE ) @@ -1062,7 +1062,7 @@ long ImplNoBorderWindowView::CalcTitleWidth() const // ----------------------------------------------------------------------- -void ImplNoBorderWindowView::DrawWindow( USHORT, OutputDevice*, const Point* ) +void ImplNoBorderWindowView::DrawWindow( sal_uInt16, OutputDevice*, const Point* ) { } @@ -1088,7 +1088,7 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei mnHeight = nHeight; mbNWFBorder = false; - USHORT nBorderStyle = mpBorderWindow->GetBorderStyle(); + sal_uInt16 nBorderStyle = mpBorderWindow->GetBorderStyle(); if ( nBorderStyle & WINDOW_BORDER_NOBORDER ) { mnLeftBorder = 0; @@ -1164,16 +1164,16 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei if( mnWidth && mnHeight ) { - mpBorderWindow->SetPaintTransparent( TRUE ); + mpBorderWindow->SetPaintTransparent( sal_True ); mpBorderWindow->SetBackground(); - pCtrl->SetPaintTransparent( TRUE ); + pCtrl->SetPaintTransparent( sal_True ); Window* pCompoundParent = NULL; if( pWin->GetParent() && pWin->GetParent()->IsCompoundControl() ) pCompoundParent = pWin->GetParent(); if( pCompoundParent ) - pCompoundParent->SetPaintTransparent( TRUE ); + pCompoundParent->SetPaintTransparent( sal_True ); if( mnWidth < aBounds.GetWidth() || mnHeight < aBounds.GetHeight() ) { @@ -1196,7 +1196,7 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei if( ! mbNWFBorder ) { - USHORT nStyle = FRAME_DRAW_NODRAW; + sal_uInt16 nStyle = FRAME_DRAW_NODRAW; // Wenn Border umgesetzt wurde oder BorderWindow ein Frame-Fenster // ist, dann Border nach aussen if ( (nBorderStyle & WINDOW_BORDER_DOUBLEOUT) || mpBorderWindow->mbSmallOutBorder ) @@ -1237,13 +1237,13 @@ long ImplSmallBorderWindowView::CalcTitleWidth() const // ----------------------------------------------------------------------- -void ImplSmallBorderWindowView::DrawWindow( USHORT nDrawFlags, OutputDevice*, const Point* ) +void ImplSmallBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice*, const Point* ) { - USHORT nBorderStyle = mpBorderWindow->GetBorderStyle(); + sal_uInt16 nBorderStyle = mpBorderWindow->GetBorderStyle(); if ( nBorderStyle & WINDOW_BORDER_NOBORDER ) return; - BOOL bNativeOK = FALSE; + sal_Bool bNativeOK = sal_False; // for native widget drawing we must find out what // control this border belongs to Window *pWin = NULL, *pCtrl = NULL; @@ -1334,9 +1334,9 @@ void ImplSmallBorderWindowView::DrawWindow( USHORT nDrawFlags, OutputDevice*, co nState |= CTRL_STATE_FOCUSED; } - BOOL bMouseOver = FALSE; + sal_Bool bMouseOver = sal_False; Window *pCtrlChild = pCtrl->GetWindow( WINDOW_FIRSTCHILD ); - while( pCtrlChild && (bMouseOver = pCtrlChild->IsMouseOver()) == FALSE ) + while( pCtrlChild && (bMouseOver = pCtrlChild->IsMouseOver()) == sal_False ) pCtrlChild = pCtrlChild->GetWindow( WINDOW_NEXT ); if( bMouseOver ) @@ -1385,7 +1385,7 @@ void ImplSmallBorderWindowView::DrawWindow( USHORT nDrawFlags, OutputDevice*, co } else { - USHORT nStyle = 0; + sal_uInt16 nStyle = 0; // Wenn Border umgesetzt wurde oder BorderWindow ein Frame-Fenster // ist, dann Border nach aussen if ( (nBorderStyle & WINDOW_BORDER_DOUBLEOUT) || mpBorderWindow->mbSmallOutBorder ) @@ -1417,7 +1417,7 @@ void ImplSmallBorderWindowView::DrawWindow( USHORT nDrawFlags, OutputDevice*, co ImplStdBorderWindowView::ImplStdBorderWindowView( ImplBorderWindow* pBorderWindow ) { maFrameData.mpBorderWindow = pBorderWindow; - maFrameData.mbDragFull = FALSE; + maFrameData.mbDragFull = sal_False; maFrameData.mnHitTest = 0; maFrameData.mnPinState = 0; maFrameData.mnCloseState = 0; @@ -1444,21 +1444,21 @@ ImplStdBorderWindowView::~ImplStdBorderWindowView() // ----------------------------------------------------------------------- -BOOL ImplStdBorderWindowView::MouseMove( const MouseEvent& rMEvt ) +sal_Bool ImplStdBorderWindowView::MouseMove( const MouseEvent& rMEvt ) { return ImplMouseMove( &maFrameData, rMEvt ); } // ----------------------------------------------------------------------- -BOOL ImplStdBorderWindowView::MouseButtonDown( const MouseEvent& rMEvt ) +sal_Bool ImplStdBorderWindowView::MouseButtonDown( const MouseEvent& rMEvt ) { return ImplMouseButtonDown( &maFrameData, rMEvt ); } // ----------------------------------------------------------------------- -BOOL ImplStdBorderWindowView::Tracking( const TrackingEvent& rTEvt ) +sal_Bool ImplStdBorderWindowView::Tracking( const TrackingEvent& rTEvt ) { return ImplTracking( &maFrameData, rTEvt ); } @@ -1654,7 +1654,7 @@ long ImplStdBorderWindowView::CalcTitleWidth() const // ----------------------------------------------------------------------- -void ImplStdBorderWindowView::DrawWindow( USHORT nDrawFlags, OutputDevice* pOutDev, const Point* pOffset ) +void ImplStdBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev, const Point* pOffset ) { ImplBorderFrameData* pData = &maFrameData; OutputDevice* pDev = pOutDev ? pOutDev : pData->mpOutDev; @@ -1666,7 +1666,7 @@ void ImplStdBorderWindowView::DrawWindow( USHORT nDrawFlags, OutputDevice* pOutD Color aFaceColor( rStyleSettings.GetFaceColor() ); Color aFrameColor( aFaceColor ); - aFrameColor.DecreaseContrast( (UINT8) (0.50 * 255)); + aFrameColor.DecreaseContrast( (sal_uInt8) (0.50 * 255)); // Draw Frame if ( nDrawFlags & BORDERWINDOW_DRAW_FRAME ) @@ -1762,7 +1762,7 @@ void ImplStdBorderWindowView::DrawWindow( USHORT nDrawFlags, OutputDevice* pOutD if ( pOffset ) aInRect.Move( pOffset->X(), pOffset->Y() ); - USHORT nTextStyle = TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_CLIP; + sal_uInt16 nTextStyle = TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_CLIP; // must show tooltip ? TextRectInfo aInfo; @@ -1852,14 +1852,14 @@ void ImplStdBorderWindowView::DrawWindow( USHORT nDrawFlags, OutputDevice* pOutD // ======================================================================= void ImplBorderWindow::ImplInit( Window* pParent, - WinBits nStyle, USHORT nTypeStyle, + WinBits nStyle, sal_uInt16 nTypeStyle, const ::com::sun::star::uno::Any& ) { ImplInit( pParent, nStyle, nTypeStyle, NULL ); } void ImplBorderWindow::ImplInit( Window* pParent, - WinBits nStyle, USHORT nTypeStyle, + WinBits nStyle, sal_uInt16 nTypeStyle, SystemParentData* pSystemParentData ) { @@ -1870,44 +1870,44 @@ void ImplBorderWindow::ImplInit( Window* pParent, nTestStyle |= WB_APP; nStyle &= nTestStyle; - mpWindowImpl->mbBorderWin = TRUE; - mbSmallOutBorder = FALSE; + mpWindowImpl->mbBorderWin = sal_True; + mbSmallOutBorder = sal_False; if ( nTypeStyle & BORDERWINDOW_STYLE_FRAME ) { if( (nStyle & WB_SYSTEMCHILDWINDOW) ) { - mpWindowImpl->mbOverlapWin = TRUE; - mpWindowImpl->mbFrame = TRUE; - mbFrameBorder = FALSE; + mpWindowImpl->mbOverlapWin = sal_True; + mpWindowImpl->mbFrame = sal_True; + mbFrameBorder = sal_False; } else if( (nStyle & (WB_OWNERDRAWDECORATION | WB_POPUP)) ) { - mpWindowImpl->mbOverlapWin = TRUE; - mpWindowImpl->mbFrame = TRUE; - mbFrameBorder = (nOrgStyle & WB_NOBORDER) ? FALSE : TRUE; + mpWindowImpl->mbOverlapWin = sal_True; + mpWindowImpl->mbFrame = sal_True; + mbFrameBorder = (nOrgStyle & WB_NOBORDER) ? sal_False : sal_True; } else { - mpWindowImpl->mbOverlapWin = TRUE; - mpWindowImpl->mbFrame = TRUE; - mbFrameBorder = FALSE; + mpWindowImpl->mbOverlapWin = sal_True; + mpWindowImpl->mbFrame = sal_True; + mbFrameBorder = sal_False; // closeable windows may have a border as well, eg. system floating windows without caption if ( (nOrgStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE/* | WB_CLOSEABLE*/)) == WB_BORDER ) - mbSmallOutBorder = TRUE; + mbSmallOutBorder = sal_True; } } else if ( nTypeStyle & BORDERWINDOW_STYLE_OVERLAP ) { - mpWindowImpl->mbOverlapWin = TRUE; - mbFrameBorder = TRUE; + mpWindowImpl->mbOverlapWin = sal_True; + mbFrameBorder = sal_True; } else - mbFrameBorder = FALSE; + mbFrameBorder = sal_False; if ( nTypeStyle & BORDERWINDOW_STYLE_FLOAT ) - mbFloatWindow = TRUE; + mbFloatWindow = sal_True; else - mbFloatWindow = FALSE; + mbFloatWindow = sal_False; Window::ImplInit( pParent, nStyle, pSystemParentData ); SetBackground(); @@ -1920,13 +1920,13 @@ void ImplBorderWindow::ImplInit( Window* pParent, mnMaxHeight = SHRT_MAX; mnRollHeight = 0; mnOrgMenuHeight = 0; - mbPined = FALSE; - mbRollUp = FALSE; - mbMenuHide = FALSE; - mbDockBtn = FALSE; - mbMenuBtn = FALSE; - mbHideBtn = FALSE; - mbHelpBtn = FALSE; + mbPined = sal_False; + mbRollUp = sal_False; + mbMenuHide = sal_False; + mbDockBtn = sal_False; + mbMenuBtn = sal_False; + mbHideBtn = sal_False; + mbHelpBtn = sal_False; mbDisplayActive = IsActive(); if ( nTypeStyle & BORDERWINDOW_STYLE_FLOAT ) @@ -1941,7 +1941,7 @@ void ImplBorderWindow::ImplInit( Window* pParent, ImplBorderWindow::ImplBorderWindow( Window* pParent, SystemParentData* pSystemParentData, - WinBits nStyle, USHORT nTypeStyle + WinBits nStyle, sal_uInt16 nTypeStyle ) : Window( WINDOW_BORDERWINDOW ) { ImplInit( pParent, nStyle, nTypeStyle, pSystemParentData ); @@ -1950,14 +1950,14 @@ ImplBorderWindow::ImplBorderWindow( Window* pParent, // ----------------------------------------------------------------------- ImplBorderWindow::ImplBorderWindow( Window* pParent, WinBits nStyle , - USHORT nTypeStyle ) : + sal_uInt16 nTypeStyle ) : Window( WINDOW_BORDERWINDOW ) { ImplInit( pParent, nStyle, nTypeStyle, ::com::sun::star::uno::Any() ); } ImplBorderWindow::ImplBorderWindow( Window* pParent, - WinBits nStyle, USHORT nTypeStyle, + WinBits nStyle, sal_uInt16 nTypeStyle, const ::com::sun::star::uno::Any& aSystemToken ) : Window( WINDOW_BORDERWINDOW ) { @@ -2008,7 +2008,7 @@ void ImplBorderWindow::Draw( const Rectangle&, OutputDevice* pOutDev, const Poin void ImplBorderWindow::Activate() { - SetDisplayActive( TRUE ); + SetDisplayActive( sal_True ); Window::Activate(); } @@ -2019,7 +2019,7 @@ void ImplBorderWindow::Deactivate() // Fenster die immer Active sind, nehmen wir von dieser Regel aus, // genauso, wenn ein Menu aktiv wird, ignorieren wir das Deactivate if ( GetActivateMode() && !ImplGetSVData()->maWinData.mbNoDeactivate ) - SetDisplayActive( FALSE ); + SetDisplayActive( sal_False ); Window::Deactivate(); } @@ -2133,7 +2133,7 @@ void ImplBorderWindow::DataChanged( const DataChangedEvent& rDCEvt ) (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { if ( !mpWindowImpl->mbFrame || (GetStyle() & (WB_OWNERDRAWDECORATION | WB_POPUP)) ) - UpdateView( TRUE, ImplGetWindow()->GetOutputSizePixel() ); + UpdateView( sal_True, ImplGetWindow()->GetOutputSizePixel() ); } Window::DataChanged( rDCEvt ); @@ -2162,7 +2162,7 @@ void ImplBorderWindow::InitView() // ----------------------------------------------------------------------- -void ImplBorderWindow::UpdateView( BOOL bNewView, const Size& rNewOutSize ) +void ImplBorderWindow::UpdateView( sal_Bool bNewView, const Size& rNewOutSize ) { sal_Int32 nLeftBorder; sal_Int32 nTopBorder; @@ -2238,7 +2238,7 @@ void ImplBorderWindow::InvalidateBorder() // ----------------------------------------------------------------------- -void ImplBorderWindow::SetDisplayActive( BOOL bActive ) +void ImplBorderWindow::SetDisplayActive( sal_Bool bActive ) { if ( mbDisplayActive != bActive ) { @@ -2250,26 +2250,26 @@ void ImplBorderWindow::SetDisplayActive( BOOL bActive ) // ----------------------------------------------------------------------- -void ImplBorderWindow::SetTitleType( USHORT nTitleType, const Size& rSize ) +void ImplBorderWindow::SetTitleType( sal_uInt16 nTitleType, const Size& rSize ) { mnTitleType = nTitleType; - UpdateView( FALSE, rSize ); + UpdateView( sal_False, rSize ); } // ----------------------------------------------------------------------- -void ImplBorderWindow::SetBorderStyle( USHORT nStyle ) +void ImplBorderWindow::SetBorderStyle( sal_uInt16 nStyle ) { if ( !mbFrameBorder && (mnBorderStyle != nStyle) ) { mnBorderStyle = nStyle; - UpdateView( FALSE, ImplGetWindow()->GetOutputSizePixel() ); + UpdateView( sal_False, ImplGetWindow()->GetOutputSizePixel() ); } } // ----------------------------------------------------------------------- -void ImplBorderWindow::SetPin( BOOL bPin ) +void ImplBorderWindow::SetPin( sal_Bool bPin ) { mbPined = bPin; InvalidateBorder(); @@ -2277,11 +2277,11 @@ void ImplBorderWindow::SetPin( BOOL bPin ) // ----------------------------------------------------------------------- -void ImplBorderWindow::SetRollUp( BOOL bRollUp, const Size& rSize ) +void ImplBorderWindow::SetRollUp( sal_Bool bRollUp, const Size& rSize ) { mbRollUp = bRollUp; mnRollHeight = rSize.Height(); - UpdateView( FALSE, rSize ); + UpdateView( sal_False, rSize ); } // ----------------------------------------------------------------------- @@ -2296,7 +2296,7 @@ void ImplBorderWindow::SetCloser() // ----------------------------------------------------------------------- -void ImplBorderWindow::SetDockButton( BOOL bDockButton ) +void ImplBorderWindow::SetDockButton( sal_Bool bDockButton ) { mbDockBtn = bDockButton; Size aSize = GetOutputSizePixel(); @@ -2306,7 +2306,7 @@ void ImplBorderWindow::SetDockButton( BOOL bDockButton ) // ----------------------------------------------------------------------- -void ImplBorderWindow::SetHideButton( BOOL bHideButton ) +void ImplBorderWindow::SetHideButton( sal_Bool bHideButton ) { mbHideBtn = bHideButton; Size aSize = GetOutputSizePixel(); @@ -2316,7 +2316,7 @@ void ImplBorderWindow::SetHideButton( BOOL bHideButton ) // ----------------------------------------------------------------------- -void ImplBorderWindow::SetHelpButton( BOOL bHelpButton ) +void ImplBorderWindow::SetHelpButton( sal_Bool bHelpButton ) { mbHelpBtn = bHelpButton; Size aSize = GetOutputSizePixel(); @@ -2326,7 +2326,7 @@ void ImplBorderWindow::SetHelpButton( BOOL bHelpButton ) // ----------------------------------------------------------------------- -void ImplBorderWindow::SetMenuButton( BOOL bMenuButton ) +void ImplBorderWindow::SetMenuButton( sal_Bool bMenuButton ) { mbMenuBtn = bMenuButton; Size aSize = GetOutputSizePixel(); @@ -2353,7 +2353,7 @@ void ImplBorderWindow::SetMenuBarWindow( Window* pWindow ) // ----------------------------------------------------------------------- -void ImplBorderWindow::SetMenuBarMode( BOOL bHide ) +void ImplBorderWindow::SetMenuBarMode( sal_Bool bHide ) { mbMenuHide = bHide; UpdateMenuHeight(); diff --git a/vcl/source/window/btndlg.cxx b/vcl/source/window/btndlg.cxx index c5f329f11c38..cf9697b4f602 100644 --- a/vcl/source/window/btndlg.cxx +++ b/vcl/source/window/btndlg.cxx @@ -40,7 +40,7 @@ typedef boost::ptr_vector<ImplBtnDlgItem>::const_iterator btn_const_iterator; struct ImplBtnDlgItem { - USHORT mnId; + sal_uInt16 mnId; bool mbOwnButton; bool mbDummyAlign; long mnSepSize; @@ -52,7 +52,7 @@ void ButtonDialog::ImplInitButtonDialogData() mnButtonSize = 0; mnCurButtonId = 0; mnFocusButtonId = BUTTONDIALOG_BUTTON_NOTFOUND; - mbFormat = TRUE; + mbFormat = sal_True; } ButtonDialog::ButtonDialog( WindowType nType ) : @@ -86,7 +86,7 @@ ButtonDialog::~ButtonDialog() } } -PushButton* ButtonDialog::ImplCreatePushButton( USHORT nBtnFlags ) +PushButton* ButtonDialog::ImplCreatePushButton( sal_uInt16 nBtnFlags ) { PushButton* pBtn; WinBits nStyle = 0; @@ -108,7 +108,7 @@ PushButton* ButtonDialog::ImplCreatePushButton( USHORT nBtnFlags ) return pBtn; } -ImplBtnDlgItem* ButtonDialog::ImplGetItem( USHORT nId ) const +ImplBtnDlgItem* ButtonDialog::ImplGetItem( sal_uInt16 nId ) const { for ( btn_const_iterator it = maItemList.begin(); it != maItemList.end(); ++it) { @@ -223,7 +223,7 @@ void ButtonDialog::ImplPosControls() SetOutputSizePixel( aDlgSize ); - mbFormat = FALSE; + mbFormat = sal_False; } IMPL_LINK( ButtonDialog, ImplClickHdl, PushButton*, pBtn ) @@ -281,13 +281,13 @@ void ButtonDialog::Click() maClickHdl.Call( this ); } -void ButtonDialog::AddButton( const XubString& rText, USHORT nId, - USHORT nBtnFlags, long nSepPixel ) +void ButtonDialog::AddButton( const XubString& rText, sal_uInt16 nId, + sal_uInt16 nBtnFlags, long nSepPixel ) { // PageItem anlegen ImplBtnDlgItem* pItem = new ImplBtnDlgItem; pItem->mnId = nId; - pItem->mbOwnButton = TRUE; + pItem->mbOwnButton = sal_True; pItem->mnSepSize = nSepPixel; pItem->mpPushButton = ImplCreatePushButton( nBtnFlags ); @@ -299,16 +299,16 @@ void ButtonDialog::AddButton( const XubString& rText, USHORT nId, if ( nBtnFlags & BUTTONDIALOG_FOCUSBUTTON ) mnFocusButtonId = nId; - mbFormat = TRUE; + mbFormat = sal_True; } -void ButtonDialog::AddButton( StandardButtonType eType, USHORT nId, - USHORT nBtnFlags, long nSepPixel ) +void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId, + sal_uInt16 nBtnFlags, long nSepPixel ) { // PageItem anlegen ImplBtnDlgItem* pItem = new ImplBtnDlgItem; pItem->mnId = nId; - pItem->mbOwnButton = TRUE; + pItem->mbOwnButton = sal_True; pItem->mnSepSize = nSepPixel; if ( eType == BUTTON_OK ) @@ -333,16 +333,16 @@ void ButtonDialog::AddButton( StandardButtonType eType, USHORT nId, maItemList.push_back(pItem); - mbFormat = TRUE; + mbFormat = sal_True; } -void ButtonDialog::AddButton( PushButton* pBtn, USHORT nId, - USHORT nBtnFlags, long nSepPixel ) +void ButtonDialog::AddButton( PushButton* pBtn, sal_uInt16 nId, + sal_uInt16 nBtnFlags, long nSepPixel ) { // PageItem anlegen ImplBtnDlgItem* pItem = new ImplBtnDlgItem; pItem->mnId = nId; - pItem->mbOwnButton = FALSE; + pItem->mbOwnButton = sal_False; pItem->mnSepSize = nSepPixel; pItem->mpPushButton = pBtn; @@ -351,10 +351,10 @@ void ButtonDialog::AddButton( PushButton* pBtn, USHORT nId, maItemList.push_back(pItem); - mbFormat = TRUE; + mbFormat = sal_True; } -void ButtonDialog::RemoveButton( USHORT nId ) +void ButtonDialog::RemoveButton( sal_uInt16 nId ) { btn_iterator it; for (it = maItemList.begin(); it != maItemList.end(); ++it) @@ -367,7 +367,6 @@ void ButtonDialog::RemoveButton( USHORT nId ) delete it->mpPushButton; maItemList.erase(it); - mbFormat = TRUE; break; } } @@ -387,15 +386,15 @@ void ButtonDialog::Clear() } maItemList.clear(); - mbFormat = TRUE; + mbFormat = sal_True; } -USHORT ButtonDialog::GetButtonCount() const +sal_uInt16 ButtonDialog::GetButtonCount() const { - return (USHORT)maItemList.size(); + return (sal_uInt16)maItemList.size(); } -USHORT ButtonDialog::GetButtonId( USHORT nButton ) const +sal_uInt16 ButtonDialog::GetButtonId( sal_uInt16 nButton ) const { if ( nButton < maItemList.size() ) return maItemList[nButton].mnId; @@ -403,7 +402,7 @@ USHORT ButtonDialog::GetButtonId( USHORT nButton ) const return BUTTONDIALOG_BUTTON_NOTFOUND; } -PushButton* ButtonDialog::GetPushButton( USHORT nId ) const +PushButton* ButtonDialog::GetPushButton( sal_uInt16 nId ) const { ImplBtnDlgItem* pItem = ImplGetItem( nId ); @@ -413,18 +412,18 @@ PushButton* ButtonDialog::GetPushButton( USHORT nId ) const return NULL; } -void ButtonDialog::SetButtonText( USHORT nId, const XubString& rText ) +void ButtonDialog::SetButtonText( sal_uInt16 nId, const XubString& rText ) { ImplBtnDlgItem* pItem = ImplGetItem( nId ); if ( pItem ) { pItem->mpPushButton->SetText( rText ); - mbFormat = TRUE; + mbFormat = sal_True; } } -XubString ButtonDialog::GetButtonText( USHORT nId ) const +XubString ButtonDialog::GetButtonText( sal_uInt16 nId ) const { ImplBtnDlgItem* pItem = ImplGetItem( nId ); @@ -434,7 +433,7 @@ XubString ButtonDialog::GetButtonText( USHORT nId ) const return ImplGetSVEmptyStr(); } -void ButtonDialog::SetButtonHelpText( USHORT nId, const XubString& rText ) +void ButtonDialog::SetButtonHelpText( sal_uInt16 nId, const XubString& rText ) { ImplBtnDlgItem* pItem = ImplGetItem( nId ); @@ -442,7 +441,7 @@ void ButtonDialog::SetButtonHelpText( USHORT nId, const XubString& rText ) pItem->mpPushButton->SetHelpText( rText ); } -XubString ButtonDialog::GetButtonHelpText( USHORT nId ) const +XubString ButtonDialog::GetButtonHelpText( sal_uInt16 nId ) const { ImplBtnDlgItem* pItem = ImplGetItem( nId ); @@ -452,22 +451,19 @@ XubString ButtonDialog::GetButtonHelpText( USHORT nId ) const return ImplGetSVEmptyStr(); } -void ButtonDialog::SetButtonHelpId( USHORT nId, ULONG nHelpId ) +void ButtonDialog::SetButtonHelpId( sal_uInt16 nId, const rtl::OString& rHelpId ) { ImplBtnDlgItem* pItem = ImplGetItem( nId ); if ( pItem ) - pItem->mpPushButton->SetHelpId( nHelpId ); + pItem->mpPushButton->SetHelpId( rHelpId ); } -ULONG ButtonDialog::GetButtonHelpId( USHORT nId ) const +rtl::OString ButtonDialog::GetButtonHelpId( sal_uInt16 nId ) const { ImplBtnDlgItem* pItem = ImplGetItem( nId ); - if ( pItem ) - return pItem->mpPushButton->GetHelpId(); - else - return 0; + return pItem ? rtl::OString( pItem->mpPushButton->GetHelpId() ) : rtl::OString(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/cmdevt.cxx b/vcl/source/window/cmdevt.cxx index ae5b765909ba..1fa77a3621cd 100644 --- a/vcl/source/window/cmdevt.cxx +++ b/vcl/source/window/cmdevt.cxx @@ -42,24 +42,24 @@ CommandExtTextInputData::CommandExtTextInputData() mnDeltaStart = 0; mnOldTextLen = 0; mnCursorFlags = 0; - mbOnlyCursor = FALSE; + mbOnlyCursor = sal_False; } // ----------------------------------------------------------------------- CommandExtTextInputData::CommandExtTextInputData( const XubString& rText, - const USHORT* pTextAttr, + const sal_uInt16* pTextAttr, xub_StrLen nCursorPos, - USHORT nCursorFlags, + sal_uInt16 nCursorFlags, xub_StrLen nDeltaStart, xub_StrLen nOldTextLen, - BOOL bOnlyCursor ) : + sal_Bool bOnlyCursor ) : maText( rText ) { if ( pTextAttr && maText.Len() ) { - mpTextAttr = new USHORT[maText.Len()]; - memcpy( mpTextAttr, pTextAttr, maText.Len()*sizeof(USHORT) ); + mpTextAttr = new sal_uInt16[maText.Len()]; + memcpy( mpTextAttr, pTextAttr, maText.Len()*sizeof(sal_uInt16) ); } else mpTextAttr = NULL; @@ -77,8 +77,8 @@ CommandExtTextInputData::CommandExtTextInputData( const CommandExtTextInputData& { if ( rData.mpTextAttr && maText.Len() ) { - mpTextAttr = new USHORT[maText.Len()]; - memcpy( mpTextAttr, rData.mpTextAttr, maText.Len()*sizeof(USHORT) ); + mpTextAttr = new sal_uInt16[maText.Len()]; + memcpy( mpTextAttr, rData.mpTextAttr, maText.Len()*sizeof(sal_uInt16) ); } else mpTextAttr = NULL; diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx index 21ef136ad663..318529dcc7d9 100644 --- a/vcl/source/window/cursor.cxx +++ b/vcl/source/window/cursor.cxx @@ -48,8 +48,8 @@ struct ImplCursorData long mnPixSlant; // Pixel-Slant short mnOrientation; // Pixel-Orientation unsigned char mnDirection; // indicates writing direction - USHORT mnStyle; // Cursor-Style - BOOL mbCurVisible; // Ist Cursor aktuell sichtbar + sal_uInt16 mnStyle; // Cursor-Style + sal_Bool mbCurVisible; // Ist Cursor aktuell sichtbar Window* mpWindow; // Zugeordnetes Windows }; @@ -58,9 +58,9 @@ struct ImplCursorData static void ImplCursorInvert( ImplCursorData* pData ) { Window* pWindow = pData->mpWindow; - BOOL bMapMode = pWindow->IsMapModeEnabled(); - pWindow->EnableMapMode( FALSE ); - USHORT nInvertStyle; + sal_Bool bMapMode = pWindow->IsMapModeEnabled(); + pWindow->EnableMapMode( sal_False ); + sal_uInt16 nInvertStyle; if ( pData->mnStyle & CURSOR_SHADOW ) nInvertStyle = INVERT_50; else @@ -155,7 +155,7 @@ void Cursor::ImplDraw() // Ausgabeflaeche berechnen und ausgeben ImplCursorInvert( mpData ); - mpData->mbCurVisible = TRUE; + mpData->mbCurVisible = sal_True; } } @@ -166,13 +166,13 @@ void Cursor::ImplRestore() if ( mpData && mpData->mbCurVisible ) { ImplCursorInvert( mpData ); - mpData->mbCurVisible = FALSE; + mpData->mbCurVisible = sal_False; } } // ----------------------------------------------------------------------- -void Cursor::ImplShow( BOOL bDrawDirect ) +void Cursor::ImplShow( sal_Bool bDrawDirect ) { if ( mbVisible ) { @@ -194,7 +194,7 @@ void Cursor::ImplShow( BOOL bDrawDirect ) if ( !mpData ) { mpData = new ImplCursorData; - mpData->mbCurVisible = FALSE; + mpData->mbCurVisible = sal_False; mpData->maTimer.SetTimeoutHdl( LINK( this, Cursor, ImplTimerHdl ) ); } @@ -269,7 +269,7 @@ Cursor::Cursor() mnOrientation = 0; mnDirection = 0; mnStyle = 0; - mbVisible = FALSE; + mbVisible = sal_False; } // ----------------------------------------------------------------------- @@ -302,7 +302,7 @@ Cursor::~Cursor() // ----------------------------------------------------------------------- -void Cursor::SetStyle( USHORT nStyle ) +void Cursor::SetStyle( sal_uInt16 nStyle ) { if ( mnStyle != nStyle ) { @@ -317,7 +317,7 @@ void Cursor::Show() { if ( !mbVisible ) { - mbVisible = TRUE; + mbVisible = sal_True; ImplShow(); } } @@ -328,7 +328,7 @@ void Cursor::Hide() { if ( mbVisible ) { - mbVisible = FALSE; + mbVisible = sal_False; ImplHide(); } } @@ -449,7 +449,7 @@ Cursor& Cursor::operator=( const Cursor& rCursor ) // ----------------------------------------------------------------------- -BOOL Cursor::operator==( const Cursor& rCursor ) const +sal_Bool Cursor::operator==( const Cursor& rCursor ) const { if ( (maPos == rCursor.maPos) && (maSize == rCursor.maSize) && @@ -457,9 +457,9 @@ BOOL Cursor::operator==( const Cursor& rCursor ) const (mnOrientation == rCursor.mnOrientation) && (mnDirection == rCursor.mnDirection) && (mbVisible == rCursor.mbVisible) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index 0cb89a025f5d..125c927bf673 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -45,71 +45,6 @@ // ======================================================================= -void ImplDrawOS2Symbol( OutputDevice* pDev, const Rectangle& rRect, - USHORT nStyle, BOOL bClose ) -{ - DecorationView aView( pDev ); - const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings(); - Rectangle aRect = rRect; - Color aColor1; - Color aColor2; - - pDev->SetFillColor(); - - if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) ) - { - aColor1 = rStyleSettings.GetShadowColor(); - aColor2 = rStyleSettings.GetLightColor(); - } - else - { - aColor1 = rStyleSettings.GetLightColor(); - aColor2 = rStyleSettings.GetShadowColor(); - } - aView.DrawFrame( aRect, aColor1, aColor2 ); - - aRect.Left() += 2; - aRect.Top() += 2; - aRect.Right() -= 2; - aRect.Bottom() -= 2; - - if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) ) - pDev->SetLineColor( rStyleSettings.GetLightColor() ); - else - pDev->SetLineColor( rStyleSettings.GetShadowColor() ); - if ( bClose ) - { - pDev->DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom()-2 ) ); - pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right()-2, aRect.Top() ) ); - pDev->DrawLine( Point( aRect.Left()+2, aRect.Bottom()-1 ), - Point( aRect.Right()-1, aRect.Top()+2 ) ); - } - else - { - pDev->DrawLine( aRect.TopLeft(), aRect.BottomLeft() ); - pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right()-1, aRect.Top() ) ); - } - - if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) ) - pDev->SetLineColor( rStyleSettings.GetShadowColor() ); - else - pDev->SetLineColor( rStyleSettings.GetLightColor() ); - if ( bClose ) - { - pDev->DrawLine( Point( aRect.Right(), aRect.Top()+2 ), aRect.BottomRight() ); - pDev->DrawLine( Point( aRect.Left()+2, aRect.Bottom() ), aRect.BottomRight() ); - pDev->DrawLine( Point( aRect.Right()-2, aRect.Top()+1 ), - Point( aRect.Left()+1, aRect.Bottom()-2 ) ); - } - else - { - pDev->DrawLine( aRect.TopRight(), aRect.BottomRight() ); - pDev->DrawLine( Point( aRect.Left()+1, aRect.Bottom() ), aRect.BottomRight() ); - } -} - -// ======================================================================= - static void ImplDrawSymbol( OutputDevice* pDev, const Rectangle& rRect, SymbolType eType ) { @@ -509,7 +444,7 @@ static void ImplDrawSymbol( OutputDevice* pDev, const Rectangle& rRect, case SYMBOL_CHECKMARK: { // #106953# never mirror checkmarks - BOOL bRTL = pDev->ImplHasMirroredGraphics() && pDev->IsRTLEnabled(); + sal_Bool bRTL = pDev->ImplHasMirroredGraphics() && pDev->IsRTLEnabled(); Point aPos1( bRTL ? rRect.Right() : rRect.Left(), rRect.Bottom() - rRect.GetHeight() / 3 ); Point aPos2( bRTL ? rRect.Right() - rRect.GetWidth()/3 : rRect.Left() + rRect.GetWidth()/3, @@ -631,57 +566,22 @@ static void ImplDrawSymbol( OutputDevice* pDev, const Rectangle& rRect, pDev->DrawRect( aRect ); } break; - - case SYMBOL_OS2CLOSE: - { - Rectangle aRect( nCenterX-n2, nCenterY-n2, - nCenterX+n2, nCenterY+n2 ); - ImplDrawOS2Symbol( pDev, aRect, 0, TRUE ); - } - break; - - case SYMBOL_OS2FLOAT: - { - Rectangle aRect( nCenterX-n2+4, nCenterY-n2+4, - nCenterX+n2-4, nCenterY+n2-3 ); - ImplDrawOS2Symbol( pDev, aRect, 0, FALSE ); - DecorationView aDecoView( pDev ); - Rectangle aRect2( nCenterX-n2, nCenterY-n2, - nCenterX-n2+2, nCenterY+n2 ); - aDecoView.DrawFrame( aRect2, - pDev->GetSettings().GetStyleSettings().GetLightColor(), - pDev->GetSettings().GetStyleSettings().GetShadowColor() ); - Rectangle aRect3( nCenterX+n2-2, nCenterY-n2, - nCenterX+n2, nCenterY+n2 ); - aDecoView.DrawFrame( aRect3, - pDev->GetSettings().GetStyleSettings().GetLightColor(), - pDev->GetSettings().GetStyleSettings().GetShadowColor() ); - } - break; - - case SYMBOL_OS2HIDE: - { - Rectangle aRect( nCenterX-n2+3, nCenterY-n2+3, - nCenterX+n2-3, nCenterY+n2-3 ); - ImplDrawOS2Symbol( pDev, aRect, 0, FALSE ); - } - break; } } // ----------------------------------------------------------------------- void DecorationView::DrawSymbol( const Rectangle& rRect, SymbolType eType, - const Color& rColor, USHORT nStyle ) + const Color& rColor, sal_uInt16 nStyle ) { const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings(); Rectangle aRect = mpOutDev->LogicToPixel( rRect ); Color aOldLineColor = mpOutDev->GetLineColor(); Color aOldFillColor = mpOutDev->GetFillColor(); - BOOL bOldMapMode = mpOutDev->IsMapModeEnabled(); + sal_Bool bOldMapMode = mpOutDev->IsMapModeEnabled(); mpOutDev->SetLineColor(); mpOutDev->SetFillColor( rColor ); - mpOutDev->EnableMapMode( FALSE ); + mpOutDev->EnableMapMode( sal_False ); if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) || (mpOutDev->GetOutDevType() == OUTDEV_PRINTER) ) @@ -725,8 +625,8 @@ void DecorationView::DrawFrame( const Rectangle& rRect, Rectangle aRect = mpOutDev->LogicToPixel( rRect ); Color aOldLineColor = mpOutDev->GetLineColor(); Color aOldFillColor = mpOutDev->GetFillColor(); - BOOL bOldMapMode = mpOutDev->IsMapModeEnabled(); - mpOutDev->EnableMapMode( FALSE ); + sal_Bool bOldMapMode = mpOutDev->IsMapModeEnabled(); + mpOutDev->EnableMapMode( sal_False ); mpOutDev->SetLineColor(); mpOutDev->ImplDraw2ColorFrame( aRect, rLeftTopColor, rRightBottomColor ); mpOutDev->SetLineColor( aOldLineColor ); @@ -737,7 +637,7 @@ void DecorationView::DrawFrame( const Rectangle& rRect, // ======================================================================= void DecorationView::DrawHighlightFrame( const Rectangle& rRect, - USHORT nStyle ) + sal_uInt16 nStyle ) { const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings(); Color aLightColor = rStyleSettings.GetLightColor(); @@ -787,7 +687,7 @@ void DecorationView::DrawHighlightFrame( const Rectangle& rRect, // ======================================================================= static void ImplDrawDPILineRect( OutputDevice* pDev, Rectangle& rRect, - const Color* pColor, BOOL bRound = FALSE ) + const Color* pColor, sal_Bool bRound = sal_False ) { long nLineWidth = pDev->ImplGetDPIX()/300; long nLineHeight = pDev->ImplGetDPIY()/300; @@ -836,10 +736,10 @@ static void ImplDrawDPILineRect( OutputDevice* pDev, Rectangle& rRect, // ======================================================================= static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, - const StyleSettings& rStyleSettings, USHORT nStyle ) + const StyleSettings& rStyleSettings, sal_uInt16 nStyle ) { // mask menu style - BOOL bMenuStyle = (nStyle & FRAME_DRAW_MENU) ? TRUE : FALSE; + sal_Bool bMenuStyle = (nStyle & FRAME_DRAW_MENU) ? sal_True : sal_False; nStyle &= ~FRAME_DRAW_MENU; Window *pWin = NULL; @@ -850,7 +750,7 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, // menus may use different border colors (eg on XP) // normal frames will be drawn using the shadow color // whereas window frame borders will use black - BOOL bFlatBorders = ( !bMenuStyle && rStyleSettings.GetUseFlatBorders() ); + sal_Bool bFlatBorders = ( !bMenuStyle && rStyleSettings.GetUseFlatBorders() ); // no flat borders for standard VCL controls (ie formcontrols that keep their classic look) // will not affect frame windows (like dropdowns) @@ -859,13 +759,13 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, // check for formcontrol, i.e., a control without NWF enabled Control *pControl = dynamic_cast< Control* >( pWin->GetWindow( WINDOW_CLIENT ) ); if( pControl && pControl->IsNativeWidgetEnabled() ) - bFlatBorders = TRUE; + bFlatBorders = sal_True; else - bFlatBorders = FALSE; + bFlatBorders = sal_False; } // no round corners for window frame borders - BOOL bRound = (bFlatBorders && !(nStyle & FRAME_DRAW_WINDOWBORDER)); + sal_Bool bRound = (bFlatBorders && !(nStyle & FRAME_DRAW_WINDOWBORDER)); if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) || (pDev->GetOutDevType() == OUTDEV_PRINTER) || @@ -874,7 +774,7 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, if ( nStyle & FRAME_DRAW_NODRAW ) { - USHORT nValueStyle = bMenuStyle ? nStyle | FRAME_DRAW_MENU : nStyle; + sal_uInt16 nValueStyle = bMenuStyle ? nStyle | FRAME_DRAW_MENU : nStyle; if( pWin->GetType() == WINDOW_BORDERWINDOW ) nValueStyle |= FRAME_DRAW_BORDERWINDOWBORDER; ImplControlValue aControlValue( nValueStyle ); @@ -889,7 +789,7 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, ImplDrawDPILineRect( pDev, rRect, NULL, bRound ); else { - USHORT nFrameStyle = nStyle & FRAME_DRAW_STYLE; + sal_uInt16 nFrameStyle = nStyle & FRAME_DRAW_STYLE; if ( nFrameStyle == FRAME_DRAW_GROUP ) { @@ -919,7 +819,7 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, { if( pWin && pWin->IsNativeControlSupported(CTRL_FRAME, PART_BORDER) ) { - USHORT nValueStyle = bMenuStyle ? nStyle | FRAME_DRAW_MENU : nStyle; + sal_uInt16 nValueStyle = bMenuStyle ? nStyle | FRAME_DRAW_MENU : nStyle; if( pWin->GetType() == WINDOW_BORDERWINDOW ) nValueStyle |= FRAME_DRAW_BORDERWINDOWBORDER; ImplControlValue aControlValue( nValueStyle ); @@ -956,7 +856,7 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, } else { - USHORT nFrameStyle = nStyle & FRAME_DRAW_STYLE; + sal_uInt16 nFrameStyle = nStyle & FRAME_DRAW_STYLE; if ( nFrameStyle == FRAME_DRAW_GROUP ) { pDev->SetFillColor(); @@ -1031,7 +931,7 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, rRect.Right()--; rRect.Bottom()--; - BOOL bDrawn = TRUE; + sal_Bool bDrawn = sal_True; if ( nFrameStyle == FRAME_DRAW_DOUBLEIN ) { if( bFlatBorders ) // no 3d effect @@ -1051,7 +951,7 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, rStyleSettings.GetLightColor(), rStyleSettings.GetShadowColor() ); else - bDrawn = FALSE; + bDrawn = sal_False; } if( bDrawn ) { @@ -1068,14 +968,14 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, // ----------------------------------------------------------------------- -Rectangle DecorationView::DrawFrame( const Rectangle& rRect, USHORT nStyle ) +Rectangle DecorationView::DrawFrame( const Rectangle& rRect, sal_uInt16 nStyle ) { Rectangle aRect = rRect; - BOOL bOldMap = mpOutDev->IsMapModeEnabled(); + sal_Bool bOldMap = mpOutDev->IsMapModeEnabled(); if ( bOldMap ) { aRect = mpOutDev->LogicToPixel( aRect ); - mpOutDev->EnableMapMode( FALSE ); + mpOutDev->EnableMapMode( sal_False ); } if ( !rRect.IsEmpty() ) @@ -1104,7 +1004,7 @@ Rectangle DecorationView::DrawFrame( const Rectangle& rRect, USHORT nStyle ) // ======================================================================= static void ImplDrawButton( OutputDevice* pDev, Rectangle& rRect, - const StyleSettings& rStyleSettings, USHORT nStyle ) + const StyleSettings& rStyleSettings, sal_uInt16 nStyle ) { Rectangle aFillRect = rRect; @@ -1317,14 +1217,14 @@ static void ImplDrawButton( OutputDevice* pDev, Rectangle& rRect, // ----------------------------------------------------------------------- -Rectangle DecorationView::DrawButton( const Rectangle& rRect, USHORT nStyle ) +Rectangle DecorationView::DrawButton( const Rectangle& rRect, sal_uInt16 nStyle ) { Rectangle aRect = rRect; - BOOL bOldMap = mpOutDev->IsMapModeEnabled(); + sal_Bool bOldMap = mpOutDev->IsMapModeEnabled(); if ( bOldMap ) { aRect = mpOutDev->LogicToPixel( aRect ); - mpOutDev->EnableMapMode( FALSE ); + mpOutDev->EnableMapMode( sal_False ); } if ( !rRect.IsEmpty() ) diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index b50fd4f17a9a..4db82d23b0e5 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -73,24 +73,24 @@ static ByteString ImplGetDialogText( Dialog* pDialog ) // ======================================================================= -static BOOL ImplIsMnemonicCtrl( Window* pWindow ) +static sal_Bool ImplIsMnemonicCtrl( Window* pWindow ) { if( ! pWindow->GetSettings().GetStyleSettings().GetAutoMnemonic() ) - return FALSE; + return sal_False; if ( (pWindow->GetType() == WINDOW_RADIOBUTTON) || (pWindow->GetType() == WINDOW_CHECKBOX) || (pWindow->GetType() == WINDOW_TRISTATEBOX) || (pWindow->GetType() == WINDOW_PUSHBUTTON) ) - return TRUE; + return sal_True; if ( pWindow->GetType() == WINDOW_FIXEDTEXT ) { if ( pWindow->GetStyle() & (WB_INFO | WB_NOLABEL) ) - return FALSE; + return sal_False; Window* pNextWindow = pWindow->GetWindow( WINDOW_NEXT ); if ( !pNextWindow ) - return FALSE; + return sal_False; pNextWindow = pNextWindow->GetWindow( WINDOW_CLIENT ); if ( !(pNextWindow->GetStyle() & WB_TABSTOP) || (pNextWindow->GetType() == WINDOW_FIXEDTEXT) || @@ -99,12 +99,12 @@ static BOOL ImplIsMnemonicCtrl( Window* pWindow ) (pNextWindow->GetType() == WINDOW_CHECKBOX) || (pNextWindow->GetType() == WINDOW_TRISTATEBOX) || (pNextWindow->GetType() == WINDOW_PUSHBUTTON) ) - return FALSE; + return sal_False; - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -215,7 +215,7 @@ static PushButton* ImplGetCancelButton( Dialog* pDialog ) static void ImplMouseAutoPos( Dialog* pDialog ) { - ULONG nMouseOptions = pDialog->GetSettings().GetMouseSettings().GetOptions(); + sal_uLong nMouseOptions = pDialog->GetSettings().GetMouseSettings().GetOptions(); if ( nMouseOptions & MOUSE_OPTION_AUTOCENTERPOS ) { Size aSize = pDialog->GetOutputSizePixel(); @@ -250,13 +250,13 @@ struct DialogImpl void Dialog::ImplInitDialogData() { - mpWindowImpl->mbDialog = TRUE; + mpWindowImpl->mbDialog = sal_True; mpDialogParent = NULL; mpPrevExecuteDlg = NULL; - mbInExecute = FALSE; - mbOldSaveBack = FALSE; - mbInClose = FALSE; - mbModalMode = FALSE; + mbInExecute = sal_False; + mbOldSaveBack = sal_False; + mbInClose = sal_False; + mbModalMode = sal_False; mnMousePositioned = 0; mpDialogImpl = new DialogImpl; } @@ -265,7 +265,7 @@ void Dialog::ImplInitDialogData() void Dialog::ImplInit( Window* pParent, WinBits nStyle ) { - USHORT nSysWinMode = Application::GetSystemWindowMode(); + sal_uInt16 nSysWinMode = Application::GetSystemWindowMode(); if ( !(nStyle & WB_NODIALOGCONTROL) ) nStyle |= WB_DIALOGCONTROL; @@ -291,7 +291,7 @@ void Dialog::ImplInit( Window* pParent, WinBits nStyle ) while ( pExeDlg ) { // Nur wenn er sichtbar und enabled ist - if ( pParent->ImplGetFirstOverlapWindow()->IsWindowOrChild( pExeDlg, TRUE ) && + if ( pParent->ImplGetFirstOverlapWindow()->IsWindowOrChild( pExeDlg, sal_True ) && pExeDlg->IsReallyVisible() && pExeDlg->IsEnabled() && pExeDlg->IsInputEnabled() && !pExeDlg->IsInModalMode() ) { @@ -341,8 +341,8 @@ void Dialog::ImplInit( Window* pParent, WinBits nStyle ) } else { - mpWindowImpl->mbFrame = TRUE; - mpWindowImpl->mbOverlapWin = TRUE; + mpWindowImpl->mbFrame = sal_True; + mpWindowImpl->mbOverlapWin = sal_True; SystemWindow::ImplInit( pParent, (nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_CLOSEABLE | WB_STANDALONE)) | WB_CLOSEABLE, NULL ); // Now set all style bits mpWindowImpl->mnStyle = nStyle; @@ -374,7 +374,7 @@ void Dialog::ImplInitSettings() else if( IsNativeControlSupported( CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_DIALOG ) ) { mpWindowImpl->mnNativeBackground = PART_BACKGROUND_DIALOG; - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); } // fallback to settings color else @@ -467,7 +467,7 @@ long Dialog::Notify( NotifyEvent& rNEvt ) { const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); KeyCode aKeyCode = pKEvt->GetKeyCode(); - USHORT nKeyCode = aKeyCode.GetCode(); + sal_uInt16 nKeyCode = aKeyCode.GetCode(); if ( (nKeyCode == KEY_ESCAPE) && ((GetStyle() & WB_CLOSEABLE) || ImplGetCancelButton( this ) || ImplGetOKButton( this )) ) @@ -477,7 +477,7 @@ long Dialog::Notify( NotifyEvent& rNEvt ) // post this Close asynchronous so we can leave our key handler before // we get destroyed PostUserEvent( LINK( this, Dialog, ImplAsyncCloseHdl ), this ); - return TRUE; + return sal_True; } } else if ( rNEvt.GetType() == EVENT_GETFOCUS ) @@ -488,8 +488,8 @@ long Dialog::Notify( NotifyEvent& rNEvt ) if( mbInExecute && mbModalMode ) { // do not change modal counter (pSVData->maAppData.mnModalDialog) - SetModalInputMode( FALSE ); - SetModalInputMode( TRUE ); + SetModalInputMode( sal_False ); + SetModalInputMode( sal_True ); // #93022# def-button might have changed after show if( !mnMousePositioned ) @@ -554,7 +554,7 @@ void Dialog::DataChanged( const DataChangedEvent& rDCEvt ) // ----------------------------------------------------------------------- -BOOL Dialog::Close() +sal_Bool Dialog::Close() { ImplDelData aDelData; ImplAddDel( &aDelData ); @@ -567,21 +567,21 @@ BOOL Dialog::Close() // ( Note: ) this used to work ( something changes somewhere ) if (mnCancelClose != 0) { - return FALSE; + return sal_False; } //liuchen 2009-7-22 if ( aDelData.IsDelete() ) - return FALSE; + return sal_False; ImplRemoveDel( &aDelData ); if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() && !IsInExecute() ) - return FALSE; + return sal_False; - mbInClose = TRUE; + mbInClose = sal_True; if ( !(GetStyle() & WB_CLOSEABLE) ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; ImplAddDel( &aDelData ); PushButton* pButton = ImplGetCancelButton( this ); if ( pButton ) @@ -592,30 +592,30 @@ BOOL Dialog::Close() if ( pButton ) pButton->Click(); else - bRet = FALSE; + bRet = sal_False; } if ( aDelData.IsDelete() ) - return TRUE; + return sal_True; ImplRemoveDel( &aDelData ); return bRet; } if ( IsInExecute() ) { - EndDialog( FALSE ); - mbInClose = FALSE; - return TRUE; + EndDialog( sal_False ); + mbInClose = sal_False; + return sal_True; } else { - mbInClose = FALSE; + mbInClose = sal_False; return SystemWindow::Close(); } } // ----------------------------------------------------------------------- -BOOL Dialog::ImplStartExecuteModal() +sal_Bool Dialog::ImplStartExecuteModal() { if ( mbInExecute ) { @@ -624,7 +624,7 @@ BOOL Dialog::ImplStartExecuteModal() aErrorStr += ImplGetDialogText( this ); DBG_ERROR( aErrorStr.GetBuffer() ); #endif - return FALSE; + return sal_False; } if ( Application::IsDialogCancelEnabled() ) @@ -634,7 +634,7 @@ BOOL Dialog::ImplStartExecuteModal() aErrorStr += ImplGetDialogText( this ); DBG_ERROR( aErrorStr.GetBuffer() ); #endif - return FALSE; + return sal_False; } #ifdef DBG_UTIL @@ -663,15 +663,15 @@ BOOL Dialog::ImplStartExecuteModal() pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL ); if ( pSVData->maWinData.mpCaptureWin ) pSVData->maWinData.mpCaptureWin->ReleaseMouse(); - EnableInput( TRUE, TRUE ); + EnableInput( sal_True, sal_True ); if ( GetParent() ) { NotifyEvent aNEvt( EVENT_EXECUTEDIALOG, this ); GetParent()->Notify( aNEvt ); } - mbInExecute = TRUE; - SetModalInputMode( TRUE ); + mbInExecute = sal_True; + SetModalInputMode( sal_True ); mbOldSaveBack = IsSaveBackgroundEnabled(); EnableSaveBackground(); @@ -681,7 +681,7 @@ BOOL Dialog::ImplStartExecuteModal() Show(); pSVData->maAppData.mnModalMode++; - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -753,7 +753,7 @@ void Dialog::StartExecuteModal( const Link& rEndDialogHdl ) // ----------------------------------------------------------------------- -BOOL Dialog::IsStartedModal() const +sal_Bool Dialog::IsStartedModal() const { return mpDialogImpl->mbStartedModal; } @@ -764,7 +764,7 @@ void Dialog::EndDialog( long nResult ) { if ( mbInExecute ) { - SetModalInputMode( FALSE ); + SetModalInputMode( sal_False ); // Dialog aus der Kette der Dialoge die in Execute stehen entfernen ImplSVData* pSVData = ImplGetSVData(); @@ -812,7 +812,7 @@ void Dialog::EndDialog( long nResult ) mpDialogImpl->mbStartedModal = false; mpDialogImpl->mnResult = -1; } - mbInExecute = FALSE; + mbInExecute = sal_False; } } @@ -833,9 +833,9 @@ void Dialog::EndAllDialogs( Window* pParent ) while ( pModDialog ) { pTempModDialog = pModDialog->mpPrevExecuteDlg; - if( !pParent || ( pParent && pParent->IsWindowOrChild( pModDialog, TRUE ) ) ) + if( !pParent || ( pParent && pParent->IsWindowOrChild( pModDialog, sal_True ) ) ) { - pModDialog->EndDialog( FALSE ); + pModDialog->EndDialog( sal_False ); pModDialog->PostUserEvent( Link() ); } pModDialog = pTempModDialog; @@ -844,7 +844,7 @@ void Dialog::EndAllDialogs( Window* pParent ) // ----------------------------------------------------------------------- -void Dialog::SetModalInputMode( BOOL bModal ) +void Dialog::SetModalInputMode( sal_Bool bModal ) { if ( bModal == mbModalMode ) return; @@ -858,8 +858,8 @@ void Dialog::SetModalInputMode( BOOL bModal ) // Diable the prev Modal Dialog, because our dialog must close at first, // before the other dialog can be closed (because the other dialog // is on stack since our dialog returns) - if ( mpPrevExecuteDlg && !mpPrevExecuteDlg->IsWindowOrChild( this, TRUE ) ) - mpPrevExecuteDlg->EnableInput( FALSE, TRUE, TRUE, this ); + if ( mpPrevExecuteDlg && !mpPrevExecuteDlg->IsWindowOrChild( this, sal_True ) ) + mpPrevExecuteDlg->EnableInput( sal_False, sal_True, sal_True, this ); // determine next overlap dialog parent Window* pParent = GetParent(); @@ -886,20 +886,20 @@ void Dialog::SetModalInputMode( BOOL bModal ) } // Enable the prev Modal Dialog - if ( mpPrevExecuteDlg && !mpPrevExecuteDlg->IsWindowOrChild( this, TRUE ) ) + if ( mpPrevExecuteDlg && !mpPrevExecuteDlg->IsWindowOrChild( this, sal_True ) ) { - mpPrevExecuteDlg->EnableInput( TRUE, TRUE, TRUE, this ); + mpPrevExecuteDlg->EnableInput( sal_True, sal_True, sal_True, this ); // ensure continued modality of prev dialog // do not change modality counter - mpPrevExecuteDlg->SetModalInputMode( FALSE ); - mpPrevExecuteDlg->SetModalInputMode( TRUE ); + mpPrevExecuteDlg->SetModalInputMode( sal_False ); + mpPrevExecuteDlg->SetModalInputMode( sal_True ); } } } // ----------------------------------------------------------------------- -void Dialog::SetModalInputMode( BOOL bModal, BOOL bSubModalDialogs ) +void Dialog::SetModalInputMode( sal_Bool bModal, sal_Bool bSubModalDialogs ) { if ( bSubModalDialogs ) { @@ -908,7 +908,7 @@ void Dialog::SetModalInputMode( BOOL bModal, BOOL bSubModalDialogs ) while ( pOverlap ) { if ( pOverlap->IsDialog() ) - ((Dialog*)pOverlap)->SetModalInputMode( bModal, TRUE ); + ((Dialog*)pOverlap)->SetModalInputMode( bModal, sal_True ); pOverlap = pOverlap->mpWindowImpl->mpNext; } } @@ -943,7 +943,7 @@ void Dialog::GrabFocusToFirstControl() !pFocusControl->IsVisible() || !pFocusControl->IsEnabled() || !pFocusControl->IsInputEnabled() ) { - USHORT n = 0; + sal_uInt16 n = 0; pFocusControl = ImplGetDlgWindow( n, DLGWINDOW_FIRST ); } if ( pFocusControl ) @@ -955,13 +955,13 @@ void Dialog::GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, ImplBorderWindow aImplWin( (Window*)this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP ); // aImplWin.SetText( GetText() ); // aImplWin.SetPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() ); -// aImplWin.SetDisplayActive( TRUE ); +// aImplWin.SetDisplayActive( sal_True ); // aImplWin.InitView(); aImplWin.GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder ); } -void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG ) +void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -987,7 +987,7 @@ void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULO ImplBorderWindow aImplWin( this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP ); aImplWin.SetText( GetText() ); aImplWin.SetPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() ); - aImplWin.SetDisplayActive( TRUE ); + aImplWin.SetDisplayActive( sal_True ); aImplWin.InitView(); aImplWin.Draw( Rectangle( aPos, aSize ), pDev, aPos ); diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index a1e8d3219d33..ce7b6dca8119 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -45,7 +45,7 @@ using namespace ::com::sun::star; // ======================================================================= -static BOOL ImplHasIndirectTabParent( Window* pWindow ) +static sal_Bool ImplHasIndirectTabParent( Window* pWindow ) { // The window has inderect tab parent if it is included in tab hierarchy // of the indirect parent window @@ -75,7 +75,7 @@ static Window* ImplGetTopParentOfTabHierarchy( Window* pParent ) // ----------------------------------------------------------------------- -static Window* ImplGetSubChildWindow( Window* pParent, USHORT n, USHORT& nIndex ) +static Window* ImplGetSubChildWindow( Window* pParent, sal_uInt16 n, sal_uInt16& nIndex ) { Window* pTabPage = NULL; Window* pFoundWindow = NULL; @@ -151,7 +151,7 @@ static Window* ImplGetSubChildWindow( Window* pParent, USHORT n, USHORT& nIndex // ----------------------------------------------------------------------- -static Window* ImplGetChildWindow( Window* pParent, USHORT n, USHORT& nIndex, BOOL bTestEnable ) +static Window* ImplGetChildWindow( Window* pParent, sal_uInt16 n, sal_uInt16& nIndex, sal_Bool bTestEnable ) { pParent = ImplGetTopParentOfTabHierarchy( pParent ); @@ -159,7 +159,7 @@ static Window* ImplGetChildWindow( Window* pParent, USHORT n, USHORT& nIndex, BO Window* pWindow = ImplGetSubChildWindow( pParent, n, nIndex ); if ( bTestEnable ) { - USHORT n2 = nIndex; + sal_uInt16 n2 = nIndex; while ( pWindow && (!pWindow->IsEnabled() || !pWindow->IsInputEnabled()) ) { n2 = nIndex+1; @@ -185,7 +185,7 @@ static Window* ImplGetChildWindow( Window* pParent, USHORT n, USHORT& nIndex, BO // ----------------------------------------------------------------------- -static Window* ImplGetNextWindow( Window* pParent, USHORT n, USHORT& nIndex, BOOL bTestEnable ) +static Window* ImplGetNextWindow( Window* pParent, sal_uInt16 n, sal_uInt16& nIndex, sal_Bool bTestEnable ) { Window* pWindow = ImplGetChildWindow( pParent, n+1, nIndex, bTestEnable ); if ( n == nIndex ) @@ -198,17 +198,17 @@ static Window* ImplGetNextWindow( Window* pParent, USHORT n, USHORT& nIndex, BOO // ----------------------------------------------------------------------- -Window* Window::ImplGetDlgWindow( USHORT nIndex, USHORT nType, - USHORT nFormStart, USHORT nFormEnd, - USHORT* pIndex ) +Window* Window::ImplGetDlgWindow( sal_uInt16 nIndex, sal_uInt16 nType, + sal_uInt16 nFormStart, sal_uInt16 nFormEnd, + sal_uInt16* pIndex ) { DBG_ASSERT( (nIndex >= nFormStart) && (nIndex <= nFormEnd), "Window::ImplGetDlgWindow() - nIndex not in Form" ); Window* pWindow = NULL; - USHORT i; - USHORT nTemp; - USHORT nStartIndex; + sal_uInt16 i; + sal_uInt16 nTemp; + sal_uInt16 nStartIndex; if ( nType == DLGWINDOW_PREV ) { @@ -219,7 +219,7 @@ Window* Window::ImplGetDlgWindow( USHORT nIndex, USHORT nType, i--; else i = nFormEnd; - pWindow = ImplGetChildWindow( this, i, nTemp, TRUE ); + pWindow = ImplGetChildWindow( this, i, nTemp, sal_True ); if ( !pWindow ) break; if ( (i == nTemp) && (pWindow->GetStyle() & WB_TABSTOP) ) @@ -239,19 +239,19 @@ Window* Window::ImplGetDlgWindow( USHORT nIndex, USHORT nType, { if ( i < nFormEnd ) { - pWindow = ImplGetNextWindow( this, i, i, TRUE ); + pWindow = ImplGetNextWindow( this, i, i, sal_True ); if ( (i > nFormEnd) || (i < nFormStart) ) - pWindow = ImplGetChildWindow( this, nFormStart, i, TRUE ); + pWindow = ImplGetChildWindow( this, nFormStart, i, sal_True ); } else - pWindow = ImplGetChildWindow( this, nFormStart, i, TRUE ); + pWindow = ImplGetChildWindow( this, nFormStart, i, sal_True ); } if ( i <= nFormEnd ) { // 2ten Index mitfuehren, falls alle Controls disablte - USHORT nStartIndex2 = i; - USHORT nOldIndex = i+1; + sal_uInt16 nStartIndex2 = i; + sal_uInt16 nOldIndex = i+1; do { @@ -264,9 +264,9 @@ Window* Window::ImplGetDlgWindow( USHORT nIndex, USHORT nType, } nOldIndex = i; if ( (i > nFormEnd) || (i < nFormStart) ) - pWindow = ImplGetChildWindow( this, nFormStart, i, TRUE ); + pWindow = ImplGetChildWindow( this, nFormStart, i, sal_True ); else - pWindow = ImplGetNextWindow( this, i, i, TRUE ); + pWindow = ImplGetNextWindow( this, i, i, sal_True ); } while ( (i != nStartIndex) && (i != nStartIndex2) ); @@ -304,20 +304,20 @@ Window* Window::ImplGetDlgWindow( USHORT nIndex, USHORT nType, // ----------------------------------------------------------------------- -static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, USHORT& rIndex, - USHORT& rFormStart, USHORT& rFormEnd ) +static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, sal_uInt16& rIndex, + sal_uInt16& rFormStart, sal_uInt16& rFormEnd ) { Window* pSWindow; Window* pSecondWindow = NULL; Window* pTempWindow = NULL; - USHORT i; - USHORT nSecond_i = 0; - USHORT nFormStart = 0; - USHORT nSecondFormStart = 0; - USHORT nFormEnd; + sal_uInt16 i; + sal_uInt16 nSecond_i = 0; + sal_uInt16 nFormStart = 0; + sal_uInt16 nSecondFormStart = 0; + sal_uInt16 nFormEnd; // Focus-Fenster in der Child-Liste suchen - Window* pFirstChildWindow = pSWindow = ImplGetChildWindow( pParent, 0, i, FALSE ); + Window* pFirstChildWindow = pSWindow = ImplGetChildWindow( pParent, 0, i, sal_False ); if( pWindow == NULL ) pWindow = pSWindow; @@ -340,7 +340,7 @@ static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, USHORT& break; } - pSWindow = ImplGetNextWindow( pParent, i, i, FALSE ); + pSWindow = ImplGetNextWindow( pParent, i, i, sal_False ); if ( !i ) pSWindow = NULL; } @@ -370,7 +370,7 @@ static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, USHORT& do { nFormEnd = i; - pTempWindow = ImplGetNextWindow( pParent, i, i, FALSE ); + pTempWindow = ImplGetNextWindow( pParent, i, i, sal_False ); // the DialogControlStart mark is only accepted for the direct children if ( !i @@ -388,7 +388,7 @@ static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, USHORT& if ( nIteration >= 2 ) { // this is an unexpected scenario - DBG_ASSERT( FALSE, "It seems to be an endless loop!" ); + DBG_ASSERT( sal_False, "It seems to be an endless loop!" ); rFormStart = 0; break; } @@ -402,16 +402,16 @@ static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, USHORT& // ----------------------------------------------------------------------- -static Window* ImplFindAccelWindow( Window* pParent, USHORT& rIndex, xub_Unicode cCharCode, - USHORT nFormStart, USHORT nFormEnd, BOOL bCheckEnable = TRUE ) +static Window* ImplFindAccelWindow( Window* pParent, sal_uInt16& rIndex, xub_Unicode cCharCode, + sal_uInt16 nFormStart, sal_uInt16 nFormEnd, sal_Bool bCheckEnable = sal_True ) { DBG_ASSERT( (rIndex >= nFormStart) && (rIndex <= nFormEnd), "Window::ImplFindAccelWindow() - rIndex not in Form" ); xub_Unicode cCompareChar; - USHORT nStart = rIndex; - USHORT i = rIndex; - int bSearch = TRUE; + sal_uInt16 nStart = rIndex; + sal_uInt16 i = rIndex; + int bSearch = sal_True; Window* pWindow; // MT: Where can we keep the CharClass?! @@ -423,13 +423,13 @@ static Window* ImplFindAccelWindow( Window* pParent, USHORT& rIndex, xub_Unicode cCharCode = xCharClass->toUpper( String(cCharCode), 0, 1, rLocale )[0]; if ( i < nFormEnd ) - pWindow = ImplGetNextWindow( pParent, i, i, TRUE ); + pWindow = ImplGetNextWindow( pParent, i, i, sal_True ); else - pWindow = ImplGetChildWindow( pParent, nFormStart, i, TRUE ); + pWindow = ImplGetChildWindow( pParent, nFormStart, i, sal_True ); while( bSearch && pWindow ) { const XubString aStr = pWindow->GetText(); - USHORT nPos = aStr.Search( '~' ); + sal_uInt16 nPos = aStr.Search( '~' ); while ( nPos != STRING_NOTFOUND ) { cCompareChar = aStr.GetChar( nPos+1 ); @@ -453,9 +453,9 @@ static Window* ImplFindAccelWindow( Window* pParent, USHORT& rIndex, xub_Unicode // children checked for accelerators if( (pWindow->GetStyle() & WB_CHILDDLGCTRL) != 0 ) { - USHORT nChildIndex; - USHORT nChildFormStart; - USHORT nChildFormEnd; + sal_uInt16 nChildIndex; + sal_uInt16 nChildFormStart; + sal_uInt16 nChildFormEnd; // get form start and end ::ImplFindDlgCtrlWindow( pWindow, NULL, @@ -485,14 +485,14 @@ static Window* ImplFindAccelWindow( Window* pParent, USHORT& rIndex, xub_Unicode // ----------------------------------------------------------------------- -void Window::ImplControlFocus( USHORT nFlags ) +void Window::ImplControlFocus( sal_uInt16 nFlags ) { if ( nFlags & GETFOCUS_MNEMONIC ) { if ( GetType() == WINDOW_RADIOBUTTON ) { if ( !((RadioButton*)this)->IsChecked() ) - ((RadioButton*)this)->ImplCallClick( TRUE, nFlags ); + ((RadioButton*)this)->ImplCallClick( sal_True, nFlags ); else ImplGrabFocus( nFlags ); } @@ -505,8 +505,8 @@ void Window::ImplControlFocus( USHORT nFlags ) ((CheckBox*)this)->ImplCheck(); else if ( mpWindowImpl->mbPushButton ) { - ((PushButton*)this)->SetPressed( TRUE ); - ((PushButton*)this)->SetPressed( FALSE ); + ((PushButton*)this)->SetPressed( sal_True ); + ((PushButton*)this)->SetPressed( sal_False ); ((PushButton*)this)->Click(); } } @@ -517,7 +517,7 @@ void Window::ImplControlFocus( USHORT nFlags ) if ( GetType() == WINDOW_RADIOBUTTON ) { if ( !((RadioButton*)this)->IsChecked() ) - ((RadioButton*)this)->ImplCallClick( TRUE, nFlags ); + ((RadioButton*)this)->ImplCallClick( sal_True, nFlags ); else ImplGrabFocus( nFlags ); } @@ -528,32 +528,32 @@ void Window::ImplControlFocus( USHORT nFlags ) // ----------------------------------------------------------------------- -BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) +sal_Bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, sal_Bool bKeyInput ) { KeyCode aKeyCode = rKEvt.GetKeyCode(); - USHORT nKeyCode = aKeyCode.GetCode(); + sal_uInt16 nKeyCode = aKeyCode.GetCode(); Window* pSWindow; Window* pTempWindow; Window* pButtonWindow; - USHORT i; - USHORT iButton; - USHORT iButtonStart; - USHORT iTemp; - USHORT nIndex; - USHORT nFormStart; - USHORT nFormEnd; - USHORT nDlgCtrlFlags; + sal_uInt16 i; + sal_uInt16 iButton; + sal_uInt16 iButtonStart; + sal_uInt16 iTemp; + sal_uInt16 nIndex; + sal_uInt16 nFormStart; + sal_uInt16 nFormEnd; + sal_uInt16 nDlgCtrlFlags; // Ohne Focus-Window koennen wir auch keine Steuerung uebernehmen Window* pFocusWindow = Application::GetFocusWindow(); if ( !pFocusWindow || !ImplIsWindowOrChild( pFocusWindow ) ) - return FALSE; + return sal_False; // Focus-Fenster in der Child-Liste suchen pSWindow = ::ImplFindDlgCtrlWindow( this, pFocusWindow, nIndex, nFormStart, nFormEnd ); if ( !pSWindow ) - return FALSE; + return sal_False; i = nIndex; nDlgCtrlFlags = 0; @@ -572,7 +572,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) if ( nKeyCode == KEY_RETURN ) { // Wir suchen zuerst nach einem DefPushButton/CancelButton - pButtonWindow = ImplGetChildWindow( this, nFormStart, iButton, TRUE ); + pButtonWindow = ImplGetChildWindow( this, nFormStart, iButton, sal_True ); iButtonStart = iButton; while ( pButtonWindow ) { @@ -580,17 +580,17 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) pButtonWindow->mpWindowImpl->mbPushButton ) break; - pButtonWindow = ImplGetNextWindow( this, iButton, iButton, TRUE ); + pButtonWindow = ImplGetNextWindow( this, iButton, iButton, sal_True ); if ( (iButton <= iButtonStart) || (iButton > nFormEnd) ) pButtonWindow = NULL; } if ( bKeyInput && !pButtonWindow && (nDlgCtrlFlags & WINDOW_DLGCTRL_RETURN) ) { - USHORT nType; - USHORT nGetFocusFlags = GETFOCUS_TAB; - USHORT nNewIndex; - USHORT iStart; + sal_uInt16 nType; + sal_uInt16 nGetFocusFlags = GETFOCUS_TAB; + sal_uInt16 nNewIndex; + sal_uInt16 iStart; if ( aKeyCode.IsShift() ) { nType = DLGWINDOW_PREV; @@ -619,7 +619,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) nGetFocusFlags |= GETFOCUS_AROUND; } pTempWindow->ImplControlFocus( nGetFocusFlags ); - return TRUE; + return sal_True; } else { @@ -641,21 +641,21 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) if ( !ImplCallPreNotify( aNEvt2 ) ) pSWindow->GetFocus(); pSWindow->mpWindowImpl->mnGetFocusFlags = 0; - return TRUE; + return sal_True; } } } else if ( nKeyCode == KEY_ESCAPE ) { // Wir suchen zuerst nach einem DefPushButton/CancelButton - pButtonWindow = ImplGetChildWindow( this, nFormStart, iButton, TRUE ); + pButtonWindow = ImplGetChildWindow( this, nFormStart, iButton, sal_True ); iButtonStart = iButton; while ( pButtonWindow ) { if ( pButtonWindow->GetType() == WINDOW_CANCELBUTTON ) break; - pButtonWindow = ImplGetNextWindow( this, iButton, iButton, TRUE ); + pButtonWindow = ImplGetNextWindow( this, iButton, iButton, sal_True ); if ( (iButton <= iButtonStart) || (iButton > nFormEnd) ) pButtonWindow = NULL; } @@ -664,9 +664,9 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) { if ( mpWindowImpl->mpDlgCtrlDownWindow != pButtonWindow ) { - ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( FALSE ); + ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( sal_False ); mpWindowImpl->mpDlgCtrlDownWindow = NULL; - return TRUE; + return sal_True; } } } @@ -677,10 +677,10 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) // keine Alt-Taste abfangen, wegen Windows if ( !aKeyCode.IsMod2() ) { - USHORT nType; - USHORT nGetFocusFlags = GETFOCUS_TAB; - USHORT nNewIndex; - BOOL bFormular = FALSE; + sal_uInt16 nType; + sal_uInt16 nGetFocusFlags = GETFOCUS_TAB; + sal_uInt16 nNewIndex; + sal_Bool bFormular = sal_False; // Bei Ctrl-Tab erstmal testen, ob zwischen Formularen // gesprungen werden soll @@ -689,7 +689,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) // Gruppe suchen Window* pFormularFirstWindow = NULL; Window* pLastFormularFirstWindow = NULL; - pTempWindow = ImplGetChildWindow( this, 0, iTemp, FALSE ); + pTempWindow = ImplGetChildWindow( this, 0, iTemp, sal_False ); Window* pPrevFirstFormularFirstWindow = NULL; Window* pFirstFormularFirstWindow = pTempWindow; while ( pTempWindow ) @@ -697,7 +697,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) if ( pTempWindow->ImplGetWindow()->IsDialogControlStart() ) { if ( iTemp != 0 ) - bFormular = TRUE; + bFormular = sal_True; if ( aKeyCode.IsShift() ) { if ( iTemp <= nIndex ) @@ -712,7 +712,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) pLastFormularFirstWindow = pTempWindow; } - pTempWindow = ImplGetNextWindow( this, iTemp, iTemp, FALSE ); + pTempWindow = ImplGetNextWindow( this, iTemp, iTemp, sal_False ); if ( !iTemp ) pTempWindow = NULL; } @@ -727,9 +727,9 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) pFormularFirstWindow = pFirstFormularFirstWindow; } - USHORT nFoundFormStart = 0; - USHORT nFoundFormEnd = 0; - USHORT nTempIndex = 0; + sal_uInt16 nFoundFormStart = 0; + sal_uInt16 nFoundFormEnd = 0; + sal_uInt16 nTempIndex = 0; if ( ::ImplFindDlgCtrlWindow( this, pFormularFirstWindow, nTempIndex, nFoundFormStart, nFoundFormEnd ) ) { @@ -738,7 +738,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) if ( pFormularFirstWindow ) { pFormularFirstWindow->ImplControlFocus(); - return TRUE; + return sal_True; } } } @@ -774,7 +774,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) if ( !ImplCallPreNotify( aNEvt2 ) ) pSWindow->GetFocus(); pSWindow->mpWindowImpl->mnGetFocusFlags = 0; - return TRUE; + return sal_True; } else if ( pWindow ) { @@ -790,7 +790,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) nGetFocusFlags |= GETFOCUS_AROUND; } pWindow->ImplControlFocus( nGetFocusFlags ); - return TRUE; + return sal_True; } } } @@ -813,7 +813,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) { if ( pWindow != pSWindow ) pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); - return TRUE; + return sal_True; } if ( nStyle & WB_GROUP ) @@ -840,7 +840,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) if ( pWindow->IsVisible() && pWindow->IsEnabled() && pWindow->IsInputEnabled() ) { pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); - return TRUE; + return sal_True; } pWindow = pWindow->GetWindow( WINDOW_NEXT ); @@ -854,11 +854,11 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) pSWindow = ::ImplFindAccelWindow( this, i, c, nFormStart, nFormEnd ); if ( pSWindow ) { - USHORT nGetFocusFlags = GETFOCUS_MNEMONIC; + sal_uInt16 nGetFocusFlags = GETFOCUS_MNEMONIC; if ( pSWindow == ::ImplFindAccelWindow( this, i, c, nFormStart, nFormEnd ) ) nGetFocusFlags |= GETFOCUS_UNIQUEMNEMONIC; pSWindow->ImplControlFocus( nGetFocusFlags ); - return TRUE; + return sal_True; } } } @@ -870,30 +870,30 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) { if ( mpWindowImpl->mpDlgCtrlDownWindow && (mpWindowImpl->mpDlgCtrlDownWindow != pButtonWindow) ) { - ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( FALSE ); + ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( sal_False ); mpWindowImpl->mpDlgCtrlDownWindow = NULL; } - ((PushButton*)pButtonWindow)->SetPressed( TRUE ); + ((PushButton*)pButtonWindow)->SetPressed( sal_True ); mpWindowImpl->mpDlgCtrlDownWindow = pButtonWindow; } else if ( mpWindowImpl->mpDlgCtrlDownWindow == pButtonWindow ) { mpWindowImpl->mpDlgCtrlDownWindow = NULL; - ((PushButton*)pButtonWindow)->SetPressed( FALSE ); + ((PushButton*)pButtonWindow)->SetPressed( sal_False ); ((PushButton*)pButtonWindow)->Click(); } - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- // checks if this window has dialog control -BOOL Window::ImplHasDlgCtrl() +sal_Bool Window::ImplHasDlgCtrl() { Window* pDlgCtrlParent; @@ -905,9 +905,9 @@ BOOL Window::ImplHasDlgCtrl() pDlgCtrlParent = pDlgCtrlParent->ImplGetParent(); if ( !pDlgCtrlParent || ((pDlgCtrlParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) ) - return FALSE; + return sal_False; else - return TRUE; + return sal_True; } void Window::ImplDlgCtrlNextWindow() @@ -915,9 +915,9 @@ void Window::ImplDlgCtrlNextWindow() Window* pDlgCtrlParent; Window* pDlgCtrl; Window* pSWindow; - USHORT nIndex; - USHORT nFormStart; - USHORT nFormEnd; + sal_uInt16 nIndex; + sal_uInt16 nFormStart; + sal_uInt16 nFormEnd; // lookup window for dialog control pDlgCtrl = this; @@ -944,14 +944,14 @@ if ( !pDlgCtrlParent || (GetStyle() & WB_NODIALOGCONTROL) || ((pDlgCtrlParent->G // ----------------------------------------------------------------------- static void ImplDlgCtrlUpdateDefButton( Window* pParent, Window* pFocusWindow, - BOOL bGetFocus ) + sal_Bool bGetFocus ) { PushButton* pOldDefButton = NULL; PushButton* pNewDefButton = NULL; Window* pSWindow; - USHORT i; - USHORT nFormStart; - USHORT nFormEnd; + sal_uInt16 i; + sal_uInt16 nFormStart; + sal_uInt16 nFormEnd; // Formular suchen pSWindow = ::ImplFindDlgCtrlWindow( pParent, pFocusWindow, i, nFormStart, nFormEnd ); @@ -961,7 +961,7 @@ static void ImplDlgCtrlUpdateDefButton( Window* pParent, Window* pFocusWindow, nFormEnd = 0xFFFF; } - pSWindow = ImplGetChildWindow( pParent, nFormStart, i, FALSE ); + pSWindow = ImplGetChildWindow( pParent, nFormStart, i, sal_False ); while ( pSWindow ) { if ( pSWindow->ImplIsPushButton() ) @@ -975,14 +975,14 @@ static void ImplDlgCtrlUpdateDefButton( Window* pParent, Window* pFocusWindow, pNewDefButton = pPushButton; } - pSWindow = ImplGetNextWindow( pParent, i, i, FALSE ); + pSWindow = ImplGetNextWindow( pParent, i, i, sal_False ); if ( !i || (i > nFormEnd) ) pSWindow = NULL; } if ( !bGetFocus ) { - USHORT nDummy; + sal_uInt16 nDummy; Window* pNewFocusWindow = Application::GetFocusWindow(); if ( !pNewFocusWindow || !pParent->ImplIsWindowOrChild( pNewFocusWindow ) ) pNewDefButton = NULL; @@ -994,19 +994,19 @@ static void ImplDlgCtrlUpdateDefButton( Window* pParent, Window* pFocusWindow, if ( pOldDefButton != pNewDefButton ) { if ( pOldDefButton ) - pOldDefButton->ImplSetDefButton( FALSE ); + pOldDefButton->ImplSetDefButton( sal_False ); if ( pNewDefButton ) - pNewDefButton->ImplSetDefButton( TRUE ); + pNewDefButton->ImplSetDefButton( sal_True ); } } // ----------------------------------------------------------------------- -void Window::ImplDlgCtrlFocusChanged( Window* pWindow, BOOL bGetFocus ) +void Window::ImplDlgCtrlFocusChanged( Window* pWindow, sal_Bool bGetFocus ) { if ( mpWindowImpl->mpDlgCtrlDownWindow && !bGetFocus ) { - ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( FALSE ); + ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( sal_False ); mpWindowImpl->mpDlgCtrlDownWindow = NULL; } @@ -1017,9 +1017,9 @@ void Window::ImplDlgCtrlFocusChanged( Window* pWindow, BOOL bGetFocus ) Window* Window::ImplFindDlgCtrlWindow( Window* pWindow ) { - USHORT nIndex; - USHORT nFormStart; - USHORT nFormEnd; + sal_uInt16 nIndex; + sal_uInt16 nFormStart; + sal_uInt16 nFormEnd; // Focus-Fenster in der Child-Liste suchen und zurueckgeben return ::ImplFindDlgCtrlWindow( this, pWindow, nIndex, nFormStart, nFormEnd ); @@ -1045,7 +1045,7 @@ Window* Window::GetParentLabeledBy( const Window* ) const static sal_Unicode getAccel( const String& rStr ) { sal_Unicode nChar = 0; - USHORT nPos = 0; + sal_uInt16 nPos = 0; do { nPos = rStr.Search( '~', nPos ); @@ -1067,10 +1067,10 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window { // #i100833# MT 2010/02: Group box and fixed lines can also lable a fixed text. // See tools/options/print for example. - BOOL bThisIsAGroupControl = (nMyType == WINDOW_GROUPBOX) || (nMyType == WINDOW_FIXEDLINE); + sal_Bool bThisIsAGroupControl = (nMyType == WINDOW_GROUPBOX) || (nMyType == WINDOW_FIXEDLINE); Window* pSWindow = NULL; // get index, form start and form end - USHORT nIndex=0, nFormStart=0, nFormEnd=0; + sal_uInt16 nIndex=0, nFormStart=0, nFormEnd=0; pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow, pLabel, nIndex, @@ -1084,7 +1084,7 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window nAccel, nFormStart, nFormEnd, - FALSE ); + sal_False ); } else { @@ -1096,7 +1096,7 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window pSWindow = ::ImplGetChildWindow( pFrameWindow, nIndex, nIndex, - FALSE ); + sal_False ); if( pSWindow && pSWindow->IsVisible() && ! (pSWindow->GetStyle() & WB_NOLABEL) ) { WindowType nType = pSWindow->GetType(); @@ -1119,11 +1119,15 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window return pWindow; } -Window* Window::GetLabelFor() const +Window* Window::GetAccessibleRelationLabelFor() const { if ( mpWindowImpl->mbDisableAccessibleLabelForRelation ) return NULL; + if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabelForWindow ) + return mpWindowImpl->mpAccessibleInfos->pLabelForWindow; + + Window* pWindow = NULL; Window* pFrameWindow = ImplGetFrameWindow(); @@ -1161,7 +1165,7 @@ static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Windo // is directly before the control // get form start and form end and index of this control - USHORT nIndex, nFormStart, nFormEnd; + sal_uInt16 nIndex, nFormStart, nFormEnd; Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow, pLabeled, nIndex, @@ -1176,13 +1180,13 @@ static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Windo { nFormStart = nIndex-1; } - for( USHORT nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- ) + for( sal_uInt16 nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- ) { - USHORT nFoundIndex = 0; + sal_uInt16 nFoundIndex = 0; pSWindow = ::ImplGetChildWindow( pFrameWindow, nSearchIndex, nFoundIndex, - FALSE ); + sal_False ); if( pSWindow && pSWindow->IsVisible() && !(pSWindow->GetStyle() & WB_NOLABEL) ) { WindowType nType = pSWindow->GetType(); @@ -1204,11 +1208,14 @@ static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Windo return pWindow; } -Window* Window::GetLabeledBy() const +Window* Window::GetAccessibleRelationLabeledBy() const { if ( mpWindowImpl->mbDisableAccessibleLabeledByRelation ) return NULL; + if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabeledByWindow ) + return mpWindowImpl->mpAccessibleInfos->pLabeledByWindow; + Window* pWindow = NULL; Window* pFrameWindow = ImplGetFrameWindow(); @@ -1237,6 +1244,62 @@ Window* Window::GetLabeledBy() const return pWindow; } +Window* Window::GetAccessibleRelationMemberOf() const +{ + Window* pWindow = NULL; + Window* pFrameWindow = GetParent(); + if ( !pFrameWindow ) + { + pFrameWindow = ImplGetFrameWindow(); + } + // if( ! ( GetType() == WINDOW_FIXEDTEXT || + if( !( GetType() == WINDOW_FIXEDLINE || + GetType() == WINDOW_GROUPBOX ) ) + { + // search for a control that makes member of this window + // it is considered the last fixed line or group box + // that comes before this control; with the exception of push buttons + // which are labeled only if the fixed line or group box + // is directly before the control + // get form start and form end and index of this control + sal_uInt16 nIndex, nFormStart, nFormEnd; + Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow, + const_cast<Window*>(this), + nIndex, + nFormStart, + nFormEnd ); + if( pSWindow && nIndex != nFormStart ) + { + if( GetType() == WINDOW_PUSHBUTTON || + GetType() == WINDOW_HELPBUTTON || + GetType() == WINDOW_OKBUTTON || + GetType() == WINDOW_CANCELBUTTON ) + { + nFormStart = nIndex-1; + } + for( sal_uInt16 nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- ) + { + sal_uInt16 nFoundIndex = 0; + pSWindow = ::ImplGetChildWindow( pFrameWindow, + nSearchIndex, + nFoundIndex, + sal_False ); + if( pSWindow && pSWindow->IsVisible() && + ( pSWindow->GetType() == WINDOW_FIXEDLINE || + pSWindow->GetType() == WINDOW_GROUPBOX ) ) + { + pWindow = pSWindow; + break; + } + if( nFoundIndex > nSearchIndex || nSearchIndex == 0 ) + break; + } + } + } + return pWindow; +} +//-----IAccessibility2 Implementation 2009 + // ----------------------------------------------------------------------- KeyEvent Window::GetActivationKey() const @@ -1246,20 +1309,24 @@ KeyEvent Window::GetActivationKey() const sal_Unicode nAccel = getAccel( GetText() ); if( ! nAccel ) { - Window* pWindow = GetLabeledBy(); + Window* pWindow = GetAccessibleRelationLabeledBy(); if( pWindow ) nAccel = getAccel( pWindow->GetText() ); } if( nAccel ) { - USHORT nCode = 0; + sal_uInt16 nCode = 0; if( nAccel >= 'a' && nAccel <= 'z' ) nCode = KEY_A + (nAccel-'a'); else if( nAccel >= 'A' && nAccel <= 'Z' ) nCode = KEY_A + (nAccel-'A'); else if( nAccel >= '0' && nAccel <= '9' ) nCode = KEY_0 + (nAccel-'0'); - KeyCode aKeyCode( nCode, FALSE, FALSE, TRUE, FALSE ); + else if( nAccel == '.' ) + nCode = KEY_POINT; + else if( nAccel == '-' ) + nCode = KEY_SUBTRACT; + KeyCode aKeyCode( nCode, sal_False, sal_False, sal_True, sal_False ); aKeyEvent = KeyEvent( nAccel, aKeyCode ); } return aKeyEvent; diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx index 231f17759b86..ded887c59933 100644 --- a/vcl/source/window/dockingarea.cxx +++ b/vcl/source/window/dockingarea.cxx @@ -127,7 +127,7 @@ void DockingAreaWindow::StateChanged( StateChangedType nType ) // ----------------------------------------------------------------------- -BOOL DockingAreaWindow::IsHorizontal() const +sal_Bool DockingAreaWindow::IsHorizontal() const { return ( mpImplData->meAlign == WINDOWALIGN_TOP || mpImplData->meAlign == WINDOWALIGN_BOTTOM ); } @@ -150,7 +150,7 @@ WindowAlign DockingAreaWindow::GetAlign() const void DockingAreaWindow::Paint( const Rectangle& ) { - EnableNativeWidget( TRUE ); // only required because the toolkit curently switches this flag off + EnableNativeWidget( sal_True ); // only required because the toolkit curently switches this flag off if( IsNativeControlSupported( CTRL_TOOLBAR, PART_ENTIRE_CONTROL ) ) { ToolbarValue aControlValue; @@ -159,7 +159,7 @@ void DockingAreaWindow::Paint( const Rectangle& ) { // give NWF a hint that this dockingarea is adjacent to the menubar // useful for special gradient effects that should cover both windows - aControlValue.mbIsTopDockingArea = TRUE; + aControlValue.mbIsTopDockingArea = sal_True; } ControlState nState = CTRL_STATE_ENABLED; @@ -173,8 +173,8 @@ void DockingAreaWindow::Paint( const Rectangle& ) aCtrlRegion, nState, aControlValue, rtl::OUString() ); // each toolbar gets a thin border to better recognize its borders on the homogeneous docking area - USHORT nChildren = GetChildCount(); - for( USHORT n = 0; n < nChildren; n++ ) + sal_uInt16 nChildren = GetChildCount(); + for( sal_uInt16 n = 0; n < nChildren; n++ ) { Window* pChild = GetChild( n ); if ( pChild->IsVisible() ) @@ -198,8 +198,8 @@ void DockingAreaWindow::Paint( const Rectangle& ) // create map to find toolbar lines Size aOutSz = GetOutputSizePixel(); std::map< int, int > ranges; - USHORT nChildren = GetChildCount(); - for( USHORT n = 0; n < nChildren; n++ ) + sal_uInt16 nChildren = GetChildCount(); + for( sal_uInt16 n = 0; n < nChildren; n++ ) { Window* pChild = GetChild( n ); Point aPos = pChild->GetPosPixel(); diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index ee8e584ac234..017fdc5390db 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -59,13 +59,13 @@ class ImplDockFloatWin2 : public FloatingWindow { private: ImplDockingWindowWrapper* mpDockWin; - ULONG mnLastTicks; + sal_uLong mnLastTicks; Timer maDockTimer; Timer maEndDockTimer; Point maDockPos; Rectangle maDockRect; - BOOL mbInMove; - ULONG mnLastUserEvent; + sal_Bool mbInMove; + sal_uLong mnLastUserEvent; DECL_LINK( DockingHdl, ImplDockFloatWin2* ); DECL_LINK( DockTimerHdl, ImplDockFloatWin2* ); @@ -77,18 +77,18 @@ public: virtual void Move(); virtual void Resize(); - virtual void TitleButtonClick( USHORT nButton ); + virtual void TitleButtonClick( sal_uInt16 nButton ); virtual void Pin(); virtual void Roll(); virtual void PopupModeEnd(); virtual void Resizing( Size& rSize ); - virtual BOOL Close(); + virtual sal_Bool Close(); using Window::SetPosSizePixel; virtual void SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, - USHORT nFlags = WINDOW_POSSIZE_ALL ); + sal_uInt16 nFlags = WINDOW_POSSIZE_ALL ); - ULONG GetLastTicks() const { return mnLastTicks; } + sal_uLong GetLastTicks() const { return mnLastTicks; } }; // ======================================================================= @@ -98,16 +98,16 @@ ImplDockFloatWin2::ImplDockFloatWin2( Window* pParent, WinBits nWinBits, FloatingWindow( pParent, nWinBits ), mpDockWin( pDockingWin ), mnLastTicks( Time::GetSystemTicks() ), - mbInMove( FALSE ), + mbInMove( sal_False ), mnLastUserEvent( 0 ) { // Daten vom DockingWindow uebernehmen if ( pDockingWin ) { SetSettings( pDockingWin->GetWindow()->GetSettings() ); - Enable( pDockingWin->GetWindow()->IsEnabled(), FALSE ); - EnableInput( pDockingWin->GetWindow()->IsInputEnabled(), FALSE ); - AlwaysEnableInput( pDockingWin->GetWindow()->IsAlwaysEnableInput(), FALSE ); + Enable( pDockingWin->GetWindow()->IsEnabled(), sal_False ); + EnableInput( pDockingWin->GetWindow()->IsInputEnabled(), sal_False ); + AlwaysEnableInput( pDockingWin->GetWindow()->IsAlwaysEnableInput(), sal_False ); EnableAlwaysOnTop( pDockingWin->GetWindow()->IsAlwaysOnTopEnabled() ); SetActivateMode( pDockingWin->GetWindow()->GetActivateMode() ); } @@ -147,7 +147,7 @@ IMPL_LINK( ImplDockFloatWin2, DockTimerHdl, ImplDockFloatWin2*, EMPTYARG ) else if( ! ( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) ) { mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking(); - mpDockWin->EndDocking( maDockRect, FALSE ); + mpDockWin->EndDocking( maDockRect, sal_False ); } else { @@ -167,7 +167,7 @@ IMPL_LINK( ImplDockFloatWin2, EndDockTimerHdl, ImplDockFloatWin2*, EMPTYARG ) if( ! ( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) ) { mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking(); - mpDockWin->EndDocking( maDockRect, TRUE ); + mpDockWin->EndDocking( maDockRect, sal_True ); } else { @@ -186,7 +186,7 @@ IMPL_LINK( ImplDockFloatWin2, DockingHdl, ImplDockFloatWin2*, EMPTYARG ) Window *pDockingArea = mpDockWin->GetWindow()->GetParent(); PointerState aState = pDockingArea->GetPointerState(); - BOOL bRealMove = TRUE; + sal_Bool bRealMove = sal_True; if( GetStyle() & WB_OWNERDRAWDECORATION ) { // for windows with ownerdraw decoration @@ -207,9 +207,9 @@ IMPL_LINK( ImplDockFloatWin2, DockingHdl, ImplDockFloatWin2*, EMPTYARG ) PointerState aBorderState = pBorder->GetPointerState(); if( aBorderRect.IsInside( aBorderState.maPos ) ) - bRealMove = TRUE; + bRealMove = sal_True; else - bRealMove = FALSE; + bRealMove = sal_False; } } @@ -229,7 +229,7 @@ IMPL_LINK( ImplDockFloatWin2, DockingHdl, ImplDockFloatWin2*, EMPTYARG ) if( ! mpDockWin->IsDocking() ) mpDockWin->StartDocking( aMousePos, maDockRect ); - BOOL bFloatMode = mpDockWin->Docking( aMousePos, maDockRect ); + sal_Bool bFloatMode = mpDockWin->Docking( aMousePos, maDockRect ); if( ! bFloatMode ) { @@ -247,7 +247,7 @@ IMPL_LINK( ImplDockFloatWin2, DockingHdl, ImplDockFloatWin2*, EMPTYARG ) EndDockTimerHdl( this ); } } - mbInMove = FALSE; + mbInMove = sal_False; return 0; } // ----------------------------------------------------------------------- @@ -257,7 +257,7 @@ void ImplDockFloatWin2::Move() if( mbInMove ) return; - mbInMove = TRUE; + mbInMove = sal_True; FloatingWindow::Move(); mpDockWin->GetWindow()->Move(); @@ -289,7 +289,7 @@ void ImplDockFloatWin2::Resize() void ImplDockFloatWin2::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, - USHORT nFlags ) + sal_uInt16 nFlags ) { FloatingWindow::SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags ); } @@ -297,7 +297,7 @@ void ImplDockFloatWin2::SetPosSizePixel( long nX, long nY, // ----------------------------------------------------------------------- -void ImplDockFloatWin2::TitleButtonClick( USHORT nButton ) +void ImplDockFloatWin2::TitleButtonClick( sal_uInt16 nButton ) { FloatingWindow::TitleButtonClick( nButton ); mpDockWin->TitleButtonClick( nButton ); @@ -337,7 +337,7 @@ void ImplDockFloatWin2::Resizing( Size& rSize ) // ----------------------------------------------------------------------- -BOOL ImplDockFloatWin2::Close() +sal_Bool ImplDockFloatWin2::Close() { return mpDockWin->Close(); } @@ -373,33 +373,33 @@ ImplDockingWindowWrapper* DockingManager::GetDockingWindowWrapper( const Window return NULL; } -BOOL DockingManager::IsDockable( const Window *pWindow ) +sal_Bool DockingManager::IsDockable( const Window *pWindow ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); /* if( pWindow->HasDockingHandler() ) - return TRUE; + return sal_True; */ return (pWrapper != NULL); } -BOOL DockingManager::IsFloating( const Window *pWindow ) +sal_Bool DockingManager::IsFloating( const Window *pWindow ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); if( pWrapper ) return pWrapper->IsFloatingMode(); else - return FALSE; + return sal_False; } -BOOL DockingManager::IsLocked( const Window *pWindow ) +sal_Bool DockingManager::IsLocked( const Window *pWindow ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); if( pWrapper && pWrapper->IsLocked() ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } void DockingManager::Lock( const Window *pWindow ) @@ -416,14 +416,14 @@ void DockingManager::Unlock( const Window *pWindow ) pWrapper->Unlock(); } -void DockingManager::SetFloatingMode( const Window *pWindow, BOOL bFloating ) +void DockingManager::SetFloatingMode( const Window *pWindow, sal_Bool bFloating ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); if( pWrapper ) pWrapper->SetFloatingMode( bFloating ); } -void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow, ULONG nFlags ) +void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow, sal_uLong nFlags ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); if( pWrapper ) @@ -438,13 +438,13 @@ void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWin FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ); } -BOOL DockingManager::IsInPopupMode( const Window *pWindow ) +sal_Bool DockingManager::IsInPopupMode( const Window *pWindow ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); if( pWrapper && pWrapper->IsInPopupMode() ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -488,7 +488,7 @@ void DockingManager::RemoveWindow( const Window *pWindow ) void DockingManager::SetPosSizePixel( Window *pWindow, long nX, long nY, long nWidth, long nHeight, - USHORT nFlags ) + sal_uInt16 nFlags ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); if( pWrapper ) @@ -529,8 +529,8 @@ class ImplPopupFloatWin : public FloatingWindow { private: ImplDockingWindowWrapper* mpDockingWin; - BOOL mbHighlight; - BOOL mbMoving; + sal_Bool mbHighlight; + sal_Bool mbMoving; bool mbTrackingEnabled; Point maDelta; Point maTearOffPosition; @@ -563,13 +563,13 @@ public: 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 + mpWindowImpl->mbToolbarFloatingWindow = sal_True; // indicate window type, required for accessibility // which should not see this window as a toplevel window mpDockingWin = pDockingWin; - mbHighlight = FALSE; - mbMoving = FALSE; - mbTrackingEnabled = FALSE; - mbGripAtBottom = TRUE; + mbHighlight = sal_False; + mbMoving = sal_False; + mbTrackingEnabled = sal_False; + mbGripAtBottom = sal_True; mbHasGrip = bHasGrip; ImplSetBorder(); @@ -679,9 +679,9 @@ void ImplPopupFloatWin::DrawBorder() void ImplPopupFloatWin::DrawGrip() { - BOOL bLinecolor = IsLineColor(); + sal_Bool bLinecolor = IsLineColor(); Color aLinecolor = GetLineColor(); - BOOL bFillcolor = IsFillColor(); + sal_Bool bFillcolor = IsFillColor(); Color aFillcolor = GetFillColor(); // draw background @@ -694,7 +694,7 @@ void ImplPopupFloatWin::DrawGrip() if( mbHighlight ) { Erase( aRect ); - DrawSelectionBackground( aRect, 2, FALSE, TRUE, FALSE ); + DrawSelectionBackground( aRect, 2, sal_False, sal_True, sal_False ); } else { @@ -781,18 +781,18 @@ void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt ) if( mbTrackingEnabled && rMEvt.IsLeft() && GetDragRect().IsInside( aMousePos ) ) { // start window move - mbMoving = TRUE; + mbMoving = sal_True; StartTracking( STARTTRACK_NOKEYCANCEL ); return; } if( !mbHighlight && GetDragRect().IsInside( aMousePos ) ) { - mbHighlight = TRUE; + mbHighlight = sal_True; DrawGrip(); } if( mbHighlight && ( rMEvt.IsLeaveWindow() || !GetDragRect().IsInside( aMousePos ) ) ) { - mbHighlight = FALSE; + mbHighlight = sal_False; DrawGrip(); } } @@ -829,7 +829,7 @@ void ImplPopupFloatWin::Tracking( const TrackingEvent& rTEvt ) { if ( rTEvt.IsTrackingEnded() ) { - mbMoving = FALSE; + mbMoving = sal_False; EndPopupMode( FLOATWIN_POPUPMODEEND_TEAROFF ); } else if ( !rTEvt.GetMouseEvent().IsSynthetic() ) @@ -853,39 +853,39 @@ ImplDockingWindowWrapper::ImplDockingWindowWrapper( const Window *pWindow ) mpDockingWindow = (Window*) pWindow; mpParent = pWindow->GetParent(); - mbDockable = TRUE; - mbLocked = FALSE; + mbDockable = sal_True; + mbLocked = sal_False; mnFloatBits = WB_BORDER | WB_CLOSEABLE | WB_SIZEABLE | (pWindow->GetStyle() & DOCKWIN_FLOATSTYLES); DockingWindow *pDockWin = dynamic_cast< DockingWindow* > ( mpDockingWindow ); if( pDockWin ) mnFloatBits = pDockWin->GetFloatStyle(); // must be enabled in Window::Notify to prevent permanent docking during mouse move - mbStartDockingEnabled = FALSE; + mbStartDockingEnabled = sal_False; } ImplDockingWindowWrapper::~ImplDockingWindowWrapper() { if ( IsFloatingMode() ) { - GetWindow()->Show( FALSE, SHOW_NOFOCUSCHANGE ); - SetFloatingMode( FALSE ); + GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); + SetFloatingMode( sal_False ); } } // ----------------------------------------------------------------------- -BOOL ImplDockingWindowWrapper::ImplStartDocking( const Point& rPos ) +sal_Bool ImplDockingWindowWrapper::ImplStartDocking( const Point& rPos ) { if ( !mbDockable ) - return FALSE; + return sal_False; if( !mbStartDockingEnabled ) - return FALSE; + return sal_False; maMouseOff = rPos; maMouseStart = maMouseOff; - mbDocking = TRUE; + mbDocking = sal_True; mbLastFloatMode = IsFloatingMode(); mbStartFloat = mbLastFloatMode; @@ -929,7 +929,7 @@ BOOL ImplDockingWindowWrapper::ImplStartDocking( const Point& rPos ) GetWindow()->ImplGetFrameWindow()->ImplUpdateAll(); GetWindow()->StartTracking( STARTTRACK_KEYMOD ); - return TRUE; + return sal_True; } // ======================================================================= @@ -938,15 +938,15 @@ void ImplDockingWindowWrapper::ImplInitData() { mpDockingWindow = NULL; - //GetWindow()->mpWindowImpl->mbDockWin = TRUE; // TODO: must be eliminated + //GetWindow()->mpWindowImpl->mbDockWin = sal_True; // TODO: must be eliminated mpFloatWin = NULL; - mbDockCanceled = FALSE; - mbFloatPrevented = FALSE; - mbDocking = FALSE; - mbPined = FALSE; - mbRollUp = FALSE; - mbDockBtn = FALSE; - mbHideBtn = FALSE; + mbDockCanceled = sal_False; + mbFloatPrevented = sal_False; + mbDocking = sal_False; + mbPined = sal_False; + mbRollUp = sal_False; + mbDockBtn = sal_False; + mbHideBtn = sal_False; maMaxOutSize = Size( SHRT_MAX, SHRT_MAX ); } @@ -959,13 +959,13 @@ void ImplDockingWindowWrapper::Tracking( const TrackingEvent& rTEvt ) { if ( rTEvt.IsTrackingEnded() ) { - mbDocking = FALSE; + mbDocking = sal_False; GetWindow()->HideTracking(); if ( rTEvt.IsTrackingCanceled() ) { - mbDockCanceled = TRUE; + mbDockCanceled = sal_True; EndDocking( Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode ); - mbDockCanceled = FALSE; + mbDockCanceled = sal_False; } else EndDocking( Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode ); @@ -993,9 +993,9 @@ void ImplDockingWindowWrapper::Tracking( const TrackingEvent& rTEvt ) aPos.X() += maMouseOff.X(); aPos.Y() += maMouseOff.Y(); - BOOL bFloatMode = Docking( aPos, aTrackRect ); + sal_Bool bFloatMode = Docking( aPos, aTrackRect ); - mbFloatPrevented = FALSE; + mbFloatPrevented = sal_False; if ( mbLastFloatMode != bFloatMode ) { if ( bFloatMode ) @@ -1018,7 +1018,7 @@ void ImplDockingWindowWrapper::Tracking( const TrackingEvent& rTEvt ) mbLastFloatMode = bFloatMode; } - USHORT nTrackStyle; + sal_uInt16 nTrackStyle; if ( bFloatMode ) nTrackStyle = SHOWTRACK_OBJECT; else @@ -1055,12 +1055,12 @@ void ImplDockingWindowWrapper::StartDocking( const Point& rPoint, Rectangle& rRe DockingData data( rPoint, rRect, IsFloatingMode() ); GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_STARTDOCKING, &data ); - mbDocking = TRUE; + mbDocking = sal_True; } // ----------------------------------------------------------------------- -BOOL ImplDockingWindowWrapper::Docking( const Point& rPoint, Rectangle& rRect ) +sal_Bool ImplDockingWindowWrapper::Docking( const Point& rPoint, Rectangle& rRect ) { DockingData data( rPoint, rRect, IsFloatingMode() ); @@ -1071,18 +1071,18 @@ BOOL ImplDockingWindowWrapper::Docking( const Point& rPoint, Rectangle& rRect ) // ----------------------------------------------------------------------- -void ImplDockingWindowWrapper::EndDocking( const Rectangle& rRect, BOOL bFloatMode ) +void ImplDockingWindowWrapper::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) { Rectangle aRect( rRect ); if ( !IsDockingCanceled() ) { - BOOL bShow = FALSE; + sal_Bool bShow = sal_False; if ( bFloatMode != IsFloatingMode() ) { - GetWindow()->Show( FALSE, SHOW_NOFOCUSCHANGE ); + GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); SetFloatingMode( bFloatMode ); - bShow = TRUE; + bShow = sal_True; if ( bFloatMode ) { // #i44800# always use outputsize - as in all other places @@ -1098,30 +1098,30 @@ void ImplDockingWindowWrapper::EndDocking( const Rectangle& rRect, BOOL bFloatMo } if ( bShow ) - GetWindow()->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + GetWindow()->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); } EndDockingData data( aRect, IsFloatingMode(), IsDockingCanceled() ); GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_ENDDOCKING, &data ); - mbDocking = FALSE; + mbDocking = sal_False; // must be enabled in Window::Notify to prevent permanent docking during mouse move - mbStartDockingEnabled = FALSE; + mbStartDockingEnabled = sal_False; } // ----------------------------------------------------------------------- -BOOL ImplDockingWindowWrapper::PrepareToggleFloatingMode() +sal_Bool ImplDockingWindowWrapper::PrepareToggleFloatingMode() { - BOOL bFloating = TRUE; + sal_Bool bFloating = sal_True; GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_PREPARETOGGLEFLOATING, &bFloating ); return bFloating; } // ----------------------------------------------------------------------- -BOOL ImplDockingWindowWrapper::Close() +sal_Bool ImplDockingWindowWrapper::Close() { // TODO: send event /* @@ -1129,15 +1129,15 @@ BOOL ImplDockingWindowWrapper::Close() ImplAddDel( &aDelData ); GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE ); if ( aDelData.IsDelete() ) - return FALSE; + return sal_False; ImplRemoveDel( &aDelData ); if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() ) - return FALSE; + return sal_False; - GetWindow()->Show( FALSE, SHOW_NOFOCUSCHANGE ); + GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); */ - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -1154,12 +1154,12 @@ void ImplDockingWindowWrapper::ToggleFloatingMode() GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_TOGGLEFLOATING ); // must be enabled in Window::Notify to prevent permanent docking during mouse move - mbStartDockingEnabled = FALSE; + mbStartDockingEnabled = sal_False; } // ----------------------------------------------------------------------- -void ImplDockingWindowWrapper::TitleButtonClick( USHORT nType ) +void ImplDockingWindowWrapper::TitleButtonClick( sal_uInt16 nType ) { if( nType == TITLE_BUTTON_MENU ) { @@ -1208,7 +1208,7 @@ void ImplDockingWindowWrapper::Resizing( Size& rSize ) // ----------------------------------------------------------------------- -void ImplDockingWindowWrapper::ShowTitleButton( USHORT nButton, BOOL bVisible ) +void ImplDockingWindowWrapper::ShowTitleButton( sal_uInt16 nButton, sal_Bool bVisible ) { if ( mpFloatWin ) mpFloatWin->ShowTitleButton( nButton, bVisible ); @@ -1223,7 +1223,7 @@ void ImplDockingWindowWrapper::ShowTitleButton( USHORT nButton, BOOL bVisible ) // ----------------------------------------------------------------------- -BOOL ImplDockingWindowWrapper::IsTitleButtonVisible( USHORT nButton ) const +sal_Bool ImplDockingWindowWrapper::IsTitleButtonVisible( sal_uInt16 nButton ) const { if ( mpFloatWin ) return mpFloatWin->IsTitleButtonVisible( nButton ); @@ -1238,13 +1238,13 @@ BOOL ImplDockingWindowWrapper::IsTitleButtonVisible( USHORT nButton ) const // ----------------------------------------------------------------------- -void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, ULONG nFlags ) +void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, sal_uLong nFlags ) { // do nothing if window is floating if( IsFloatingMode() ) return; - GetWindow()->Show( FALSE, SHOW_NOFOCUSCHANGE ); + GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); // prepare reparenting Window* pRealParent = GetWindow()->GetWindow( WINDOW_PARENT ); @@ -1301,7 +1301,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, ULONG nF IMPL_LINK( ImplDockingWindowWrapper, PopupModeEnd, void*, EMPTYARG ) { - GetWindow()->Show( FALSE, SHOW_NOFOCUSCHANGE ); + GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); // set parameter for handler before destroying floating window ImplPopupFloatWin *pPopupFloatWin = (ImplPopupFloatWin*) mpFloatWin; @@ -1332,17 +1332,17 @@ IMPL_LINK( ImplDockingWindowWrapper, PopupModeEnd, void*, EMPTYARG ) } -BOOL ImplDockingWindowWrapper::IsInPopupMode() const +sal_Bool ImplDockingWindowWrapper::IsInPopupMode() const { if( GetFloatingWindow() ) return GetFloatingWindow()->IsInPopupMode(); else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void ImplDockingWindowWrapper::SetFloatingMode( BOOL bFloatMode ) +void ImplDockingWindowWrapper::SetFloatingMode( sal_Bool bFloatMode ) { // do nothing if window is docked and locked if( !IsFloatingMode() && IsLocked() ) @@ -1352,11 +1352,11 @@ void ImplDockingWindowWrapper::SetFloatingMode( BOOL bFloatMode ) { if ( PrepareToggleFloatingMode() ) { - BOOL bVisible = GetWindow()->IsVisible(); + sal_Bool bVisible = GetWindow()->IsVisible(); if ( bFloatMode ) { - GetWindow()->Show( FALSE, SHOW_NOFOCUSCHANGE ); + GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); maDockPos = GetWindow()->GetPosPixel(); @@ -1422,13 +1422,13 @@ void ImplDockingWindowWrapper::SetFloatingMode( BOOL bFloatMode ) mpFloatWin = pWin; if ( bVisible ) - GetWindow()->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + GetWindow()->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); ToggleFloatingMode(); } else { - GetWindow()->Show( FALSE, SHOW_NOFOCUSCHANGE ); + GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); // FloatingDaten wird im FloatingWindow speichern maFloatPos = mpFloatWin->GetPosPixel(); @@ -1493,7 +1493,7 @@ void ImplDockingWindowWrapper::SetTabStop() void ImplDockingWindowWrapper::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, - USHORT nFlags ) + sal_uInt16 nFlags ) { if ( mpFloatWin ) mpFloatWin->SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags ); @@ -1561,14 +1561,14 @@ Point ImplDockingWindowWrapper::GetFloatingPos() const // old inlines from DockingWindow // ----------------------------------------------------------------------- -void ImplDockingWindowWrapper::SetPin( BOOL bPin ) +void ImplDockingWindowWrapper::SetPin( sal_Bool bPin ) { if ( mpFloatWin ) mpFloatWin->SetPin( bPin ); mbPined = bPin; } -BOOL ImplDockingWindowWrapper::IsPined() const +sal_Bool ImplDockingWindowWrapper::IsPined() const { if ( mpFloatWin ) return mpFloatWin->IsPined(); @@ -1579,17 +1579,17 @@ void ImplDockingWindowWrapper::RollUp() { if ( mpFloatWin ) mpFloatWin->RollUp(); - mbRollUp = TRUE; + mbRollUp = sal_True; } void ImplDockingWindowWrapper::RollDown() { if ( mpFloatWin ) mpFloatWin->RollDown(); - mbRollUp = FALSE; + mbRollUp = sal_False; } -BOOL ImplDockingWindowWrapper::IsRollUp() const +sal_Bool ImplDockingWindowWrapper::IsRollUp() const { if ( mpFloatWin ) return mpFloatWin->IsRollUp(); @@ -1646,7 +1646,7 @@ void ImplDockingWindowWrapper::SetFloatingPos( const Point& rNewPos ) maFloatPos = rNewPos; } -BOOL ImplDockingWindowWrapper::IsFloatingMode() const +sal_Bool ImplDockingWindowWrapper::IsFloatingMode() const { return (mpFloatWin != NULL); } @@ -1664,7 +1664,7 @@ Rectangle ImplDockingWindowWrapper::GetDragArea() const void ImplDockingWindowWrapper::Lock() { - mbLocked = TRUE; + mbLocked = sal_True; // only toolbars support locking ToolBox *pToolBox = dynamic_cast< ToolBox * >( GetWindow() ); if( pToolBox ) @@ -1673,14 +1673,14 @@ void ImplDockingWindowWrapper::Lock() void ImplDockingWindowWrapper::Unlock() { - mbLocked = FALSE; + mbLocked = sal_False; // only toolbars support locking ToolBox *pToolBox = dynamic_cast< ToolBox * >( GetWindow() ); if( pToolBox ) pToolBox->Lock( mbLocked ); } -BOOL ImplDockingWindowWrapper::IsLocked() const +sal_Bool ImplDockingWindowWrapper::IsLocked() const { return mbLocked; } diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index a176f97d88d5..c9b71b01f78e 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -79,12 +79,12 @@ class ImplDockFloatWin : public FloatingWindow { private: DockingWindow* mpDockWin; - ULONG mnLastTicks; + sal_uLong mnLastTicks; Timer maDockTimer; Point maDockPos; Rectangle maDockRect; - BOOL mbInMove; - ULONG mnLastUserEvent; + sal_Bool mbInMove; + sal_uLong mnLastUserEvent; DECL_LINK( DockingHdl, ImplDockFloatWin* ); DECL_LINK( DockTimerHdl, ImplDockFloatWin* ); @@ -95,14 +95,14 @@ public: virtual void Move(); virtual void Resize(); - virtual void TitleButtonClick( USHORT nButton ); + virtual void TitleButtonClick( sal_uInt16 nButton ); virtual void Pin(); virtual void Roll(); virtual void PopupModeEnd(); virtual void Resizing( Size& rSize ); - virtual BOOL Close(); + virtual sal_Bool Close(); - ULONG GetLastTicks() const { return mnLastTicks; } + sal_uLong GetLastTicks() const { return mnLastTicks; } }; @@ -111,16 +111,16 @@ ImplDockFloatWin::ImplDockFloatWin( Window* pParent, WinBits nWinBits, FloatingWindow( pParent, nWinBits ), mpDockWin( pDockingWin ), mnLastTicks( Time::GetSystemTicks() ), - mbInMove( FALSE ), + mbInMove( sal_False ), mnLastUserEvent( 0 ) { // Daten vom DockingWindow uebernehmen if ( pDockingWin ) { SetSettings( pDockingWin->GetSettings() ); - Enable( pDockingWin->IsEnabled(), FALSE ); - EnableInput( pDockingWin->IsInputEnabled(), FALSE ); - AlwaysEnableInput( pDockingWin->IsAlwaysEnableInput(), FALSE ); + Enable( pDockingWin->IsEnabled(), sal_False ); + EnableInput( pDockingWin->IsInputEnabled(), sal_False ); + AlwaysEnableInput( pDockingWin->IsAlwaysEnableInput(), sal_False ); EnableAlwaysOnTop( pDockingWin->IsAlwaysOnTopEnabled() ); SetActivateMode( pDockingWin->GetActivateMode() ); } @@ -152,14 +152,14 @@ IMPL_LINK( ImplDockFloatWin, DockTimerHdl, ImplDockFloatWin*, EMPTYARG ) { // i43499 CTRL disables docking now mpDockWin->GetParent()->ImplGetFrameWindow()->HideTracking(); - mpDockWin->EndDocking( maDockRect, TRUE ); + mpDockWin->EndDocking( maDockRect, sal_True ); if( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) maDockTimer.Start(); } else if( ! ( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) ) { mpDockWin->GetParent()->ImplGetFrameWindow()->HideTracking(); - mpDockWin->EndDocking( maDockRect, FALSE ); + mpDockWin->EndDocking( maDockRect, sal_False ); } else { @@ -190,7 +190,7 @@ IMPL_LINK( ImplDockFloatWin, DockingHdl, ImplDockFloatWin*, EMPTYARG ) // mouse pos also in screen pixels Point aMousePos = mpDockWin->GetParent()->OutputToScreenPixel( aState.maPos ); - BOOL bFloatMode = mpDockWin->Docking( aMousePos, maDockRect ); + sal_Bool bFloatMode = mpDockWin->Docking( aMousePos, maDockRect ); if( ! bFloatMode ) { mpDockWin->GetParent()->ImplGetFrameWindow()->ShowTracking( maDockRect, SHOWTRACK_OBJECT | SHOWTRACK_WINDOW ); @@ -200,10 +200,10 @@ IMPL_LINK( ImplDockFloatWin, DockingHdl, ImplDockFloatWin*, EMPTYARG ) { mpDockWin->GetParent()->ImplGetFrameWindow()->HideTracking(); maDockTimer.Stop(); - mpDockWin->EndDocking( maDockRect, TRUE ); + mpDockWin->EndDocking( maDockRect, sal_True ); } } - mbInMove = FALSE; + mbInMove = sal_False; return 0; } // ----------------------------------------------------------------------- @@ -213,7 +213,7 @@ void ImplDockFloatWin::Move() if( mbInMove ) return; - mbInMove = TRUE; + mbInMove = sal_True; FloatingWindow::Move(); mpDockWin->Move(); @@ -241,7 +241,7 @@ void ImplDockFloatWin::Resize() // ----------------------------------------------------------------------- -void ImplDockFloatWin::TitleButtonClick( USHORT nButton ) +void ImplDockFloatWin::TitleButtonClick( sal_uInt16 nButton ) { FloatingWindow::TitleButtonClick( nButton ); mpDockWin->TitleButtonClick( nButton ); @@ -281,21 +281,21 @@ void ImplDockFloatWin::Resizing( Size& rSize ) // ----------------------------------------------------------------------- -BOOL ImplDockFloatWin::Close() +sal_Bool ImplDockFloatWin::Close() { return mpDockWin->Close(); } // ======================================================================= -BOOL DockingWindow::ImplStartDocking( const Point& rPos ) +sal_Bool DockingWindow::ImplStartDocking( const Point& rPos ) { if ( !mbDockable ) - return FALSE; + return sal_False; maMouseOff = rPos; maMouseStart = maMouseOff; - mbDocking = TRUE; + mbDocking = sal_True; mbLastFloatMode = IsFloatingMode(); mbStartFloat = mbLastFloatMode; @@ -328,17 +328,17 @@ BOOL DockingWindow::ImplStartDocking( const Point& rPos ) if ( GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_DOCKING && !( mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ) ) // no full drag when migrating to system window - mbDragFull = TRUE; + mbDragFull = sal_True; else { StartDocking(); - mbDragFull = FALSE; + mbDragFull = sal_False; ImplUpdateAll(); ImplGetFrameWindow()->ImplUpdateAll(); } StartTracking( STARTTRACK_KEYMOD ); - return TRUE; + return sal_True; } // ======================================================================= @@ -346,17 +346,17 @@ BOOL DockingWindow::ImplStartDocking( const Point& rPos ) void DockingWindow::ImplInitDockingWindowData() { mpImplData = new ImplData; - mpWindowImpl->mbDockWin = TRUE; + mpWindowImpl->mbDockWin = sal_True; mpFloatWin = NULL; - mbDockCanceled = FALSE; - mbDockPrevented = FALSE; - mbFloatPrevented = FALSE; - mbDocking = FALSE; - mbPined = FALSE; - mbRollUp = FALSE; - mbDockBtn = FALSE; - mbHideBtn = FALSE; + mbDockCanceled = sal_False; + mbDockPrevented = sal_False; + mbFloatPrevented = sal_False; + mbDocking = sal_False; + mbPined = sal_False; + mbRollUp = sal_False; + mbDockBtn = sal_False; + mbHideBtn = sal_False; } // ----------------------------------------------------------------------- @@ -405,7 +405,7 @@ void DockingWindow::ImplLoadRes( const ResId& rResId ) { Window::ImplLoadRes( rResId ); - ULONG nMask = ReadLongRes(); + sal_uLong nMask = ReadLongRes(); if ( (RSC_DOCKINGWINDOW_XYMAPMODE | RSC_DOCKINGWINDOW_X | RSC_DOCKINGWINDOW_Y) & nMask ) @@ -434,8 +434,8 @@ void DockingWindow::ImplLoadRes( const ResId& rResId ) if ( nMask & RSC_DOCKINGWINDOW_FLOATING ) { - if ( (BOOL)ReadShortRes() ) - SetFloatingMode( TRUE ); + if ( (sal_Bool)ReadShortRes() ) + SetFloatingMode( sal_True ); } } @@ -477,8 +477,8 @@ DockingWindow::~DockingWindow() { if ( IsFloatingMode() ) { - Show( FALSE, SHOW_NOFOCUSCHANGE ); - SetFloatingMode( FALSE ); + Show( sal_False, SHOW_NOFOCUSCHANGE ); + SetFloatingMode( sal_False ); } delete mpImplData; } @@ -494,7 +494,7 @@ void DockingWindow::Tracking( const TrackingEvent& rTEvt ) { if ( rTEvt.IsTrackingEnded() ) { - mbDocking = FALSE; + mbDocking = sal_False; if ( mbDragFull ) { // Bei Abbruch alten Zustand wieder herstellen @@ -510,9 +510,9 @@ void DockingWindow::Tracking( const TrackingEvent& rTEvt ) HideTracking(); if ( rTEvt.IsTrackingCanceled() ) { - mbDockCanceled = TRUE; + mbDockCanceled = sal_True; EndDocking( Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode ); - mbDockCanceled = FALSE; + mbDockCanceled = sal_False; } else EndDocking( Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode ); @@ -542,9 +542,9 @@ void DockingWindow::Tracking( const TrackingEvent& rTEvt ) aFramePos.Y() += maMouseOff.Y(); if ( mbDragFull ) StartDocking(); - BOOL bFloatMode = Docking( aFramePos, aTrackRect ); - mbDockPrevented = FALSE; - mbFloatPrevented = FALSE; + sal_Bool bFloatMode = Docking( aFramePos, aTrackRect ); + mbDockPrevented = sal_False; + mbFloatPrevented = sal_False; if ( mbLastFloatMode != bFloatMode ) { if ( bFloatMode ) @@ -582,7 +582,7 @@ void DockingWindow::Tracking( const TrackingEvent& rTEvt ) } else { - USHORT nTrackStyle; + sal_uInt16 nTrackStyle; if ( bFloatMode ) nTrackStyle = SHOWTRACK_BIG; else @@ -622,7 +622,7 @@ long DockingWindow::Notify( NotifyEvent& rNEvt ) if ( pMEvt->IsMod1() && (pMEvt->GetClicks() == 2) ) { SetFloatingMode( !IsFloatingMode() ); - return TRUE; + return sal_True; } else if ( pMEvt->GetClicks() == 1 ) { @@ -640,7 +640,7 @@ long DockingWindow::Notify( NotifyEvent& rNEvt ) } ImplStartDocking( aPos ); } - return TRUE; + return sal_True; } } } @@ -651,7 +651,7 @@ long DockingWindow::Notify( NotifyEvent& rNEvt ) rKey.IsShift() && rKey.IsMod1() ) { SetFloatingMode( !IsFloatingMode() ); - return TRUE; + return sal_True; } } } @@ -663,28 +663,28 @@ long DockingWindow::Notify( NotifyEvent& rNEvt ) void DockingWindow::StartDocking() { - mbDocking = TRUE; + mbDocking = sal_True; } // ----------------------------------------------------------------------- -BOOL DockingWindow::Docking( const Point&, Rectangle& ) +sal_Bool DockingWindow::Docking( const Point&, Rectangle& ) { return IsFloatingMode(); } // ----------------------------------------------------------------------- -void DockingWindow::EndDocking( const Rectangle& rRect, BOOL bFloatMode ) +void DockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) { if ( !IsDockingCanceled() ) { - BOOL bShow = FALSE; + sal_Bool bShow = sal_False; if ( bFloatMode != IsFloatingMode() ) { - Show( FALSE, SHOW_NOFOCUSCHANGE ); + Show( sal_False, SHOW_NOFOCUSCHANGE ); SetFloatingMode( bFloatMode ); - bShow = TRUE; + bShow = sal_True; if ( bFloatMode && mpFloatWin ) mpFloatWin->SetPosSizePixel( rRect.TopLeft(), rRect.GetSize() ); } @@ -698,32 +698,32 @@ void DockingWindow::EndDocking( const Rectangle& rRect, BOOL bFloatMode ) if ( bShow ) Show(); } - mbDocking = FALSE; + mbDocking = sal_False; } // ----------------------------------------------------------------------- -BOOL DockingWindow::PrepareToggleFloatingMode() +sal_Bool DockingWindow::PrepareToggleFloatingMode() { - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL DockingWindow::Close() +sal_Bool DockingWindow::Close() { ImplDelData aDelData; ImplAddDel( &aDelData ); ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE ); if ( aDelData.IsDelete() ) - return FALSE; + return sal_False; ImplRemoveDel( &aDelData ); if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() ) - return FALSE; + return sal_False; - Show( FALSE, SHOW_NOFOCUSCHANGE ); - return TRUE; + Show( sal_False, SHOW_NOFOCUSCHANGE ); + return sal_True; } // ----------------------------------------------------------------------- @@ -734,7 +734,7 @@ void DockingWindow::ToggleFloatingMode() // ----------------------------------------------------------------------- -void DockingWindow::TitleButtonClick( USHORT ) +void DockingWindow::TitleButtonClick( sal_uInt16 ) { } @@ -791,7 +791,7 @@ void DockingWindow::DataChanged( const DataChangedEvent& rDCEvt ) // ----------------------------------------------------------------------- -void DockingWindow::ShowTitleButton( USHORT nButton, BOOL bVisible ) +void DockingWindow::ShowTitleButton( sal_uInt16 nButton, sal_Bool bVisible ) { if ( mpFloatWin ) mpFloatWin->ShowTitleButton( nButton, bVisible ); @@ -806,7 +806,7 @@ void DockingWindow::ShowTitleButton( USHORT nButton, BOOL bVisible ) // ----------------------------------------------------------------------- -BOOL DockingWindow::IsTitleButtonVisible( USHORT nButton ) const +sal_Bool DockingWindow::IsTitleButtonVisible( sal_uInt16 nButton ) const { if ( mpFloatWin ) return mpFloatWin->IsTitleButtonVisible( nButton ); @@ -821,7 +821,7 @@ BOOL DockingWindow::IsTitleButtonVisible( USHORT nButton ) const // ----------------------------------------------------------------------- -void DockingWindow::SetFloatingMode( BOOL bFloatMode ) +void DockingWindow::SetFloatingMode( sal_Bool bFloatMode ) { ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); if( pWrapper ) @@ -833,11 +833,11 @@ void DockingWindow::SetFloatingMode( BOOL bFloatMode ) { if ( PrepareToggleFloatingMode() ) // changes to floating mode can be vetoed { - BOOL bVisible = IsVisible(); + sal_Bool bVisible = IsVisible(); if ( bFloatMode ) { - Show( FALSE, SHOW_NOFOCUSCHANGE ); + Show( sal_False, SHOW_NOFOCUSCHANGE ); maDockPos = Window::GetPosPixel(); @@ -886,7 +886,7 @@ void DockingWindow::SetFloatingMode( BOOL bFloatMode ) } else { - Show( FALSE, SHOW_NOFOCUSCHANGE ); + Show( sal_False, SHOW_NOFOCUSCHANGE ); // FloatingDaten wird im FloatingWindow speichern maFloatPos = mpFloatWin->GetPosPixel(); @@ -967,7 +967,7 @@ void DockingWindow::SetTabStop() void DockingWindow::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, - USHORT nFlags ) + sal_uInt16 nFlags ) { ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); if( pWrapper ) @@ -1093,7 +1093,7 @@ Point DockingWindow::GetFloatingPos() const return maFloatPos; } -BOOL DockingWindow::IsFloatingMode() const +sal_Bool DockingWindow::IsFloatingMode() const { ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); if( pWrapper ) diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 9896333174ce..2c21ec7a83d1 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -75,9 +75,9 @@ void FloatingWindow::ImplInit( Window* pParent, WinBits nStyle ) { mpImplData = new ImplData; - mpWindowImpl->mbFloatWin = TRUE; - mbInCleanUp = FALSE; - mbGrabFocus = FALSE; + mpWindowImpl->mbFloatWin = sal_True; + mbInCleanUp = sal_False; + mbGrabFocus = sal_False; DBG_ASSERT( pParent, "FloatWindow::FloatingWindow(): - pParent == NULL!" ); @@ -89,7 +89,7 @@ void FloatingWindow::ImplInit( Window* pParent, WinBits nStyle ) // no Border, then we dont need a border window if ( !nStyle ) { - mpWindowImpl->mbOverlapWin = TRUE; + mpWindowImpl->mbOverlapWin = sal_True; nStyle |= WB_DIALOGCONTROL; SystemWindow::ImplInit( pParent, nStyle, NULL ); } @@ -104,14 +104,14 @@ void FloatingWindow::ImplInit( Window* pParent, WinBits nStyle ) WinBits nFloatWinStyle = nStyle; // #99154# floaters are not closeable by default anymore, eg fullscreen floater // nFloatWinStyle |= WB_CLOSEABLE; - mpWindowImpl->mbFrame = TRUE; - mpWindowImpl->mbOverlapWin = TRUE; + mpWindowImpl->mbFrame = sal_True; + mpWindowImpl->mbOverlapWin = sal_True; SystemWindow::ImplInit( pParent, nFloatWinStyle & ~WB_BORDER, NULL ); } else { ImplBorderWindow* pBorderWin; - USHORT nBorderStyle = BORDERWINDOW_STYLE_BORDER | BORDERWINDOW_STYLE_FLOAT; + sal_uInt16 nBorderStyle = BORDERWINDOW_STYLE_BORDER | BORDERWINDOW_STYLE_FLOAT; if( nStyle & WB_OWNERDRAWDECORATION ) nBorderStyle |= BORDERWINDOW_STYLE_FRAME; else nBorderStyle |= BORDERWINDOW_STYLE_OVERLAP; @@ -125,7 +125,7 @@ void FloatingWindow::ImplInit( Window* pParent, WinBits nStyle ) SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL ); pBorderWin->mpWindowImpl->mpClientWindow = this; pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); - pBorderWin->SetDisplayActive( TRUE ); + pBorderWin->SetDisplayActive( sal_True ); mpWindowImpl->mpBorderWindow = pBorderWin; mpWindowImpl->mpRealParent = pParent; } @@ -138,11 +138,11 @@ void FloatingWindow::ImplInit( Window* pParent, WinBits nStyle ) mnTitle = (nStyle & (WB_MOVEABLE | WB_POPUP)) ? FLOATWIN_TITLE_NORMAL : FLOATWIN_TITLE_NONE; mnOldTitle = mnTitle; mnPopupModeFlags = 0; - mbInPopupMode = FALSE; - mbPopupMode = FALSE; - mbPopupModeCanceled = FALSE; - mbPopupModeTearOff = FALSE; - mbMouseDown = FALSE; + mbInPopupMode = sal_False; + mbPopupMode = sal_False; + mbPopupModeCanceled = sal_False; + mbPopupModeTearOff = sal_False; + mbMouseDown = sal_False; ImplInitSettings(); } @@ -191,7 +191,7 @@ void FloatingWindow::ImplLoadRes( const ResId& rResId ) { SystemWindow::ImplLoadRes( rResId ); - ULONG nObjMask = ReadLongRes(); + sal_uLong nObjMask = ReadLongRes(); if ( (RSC_FLOATINGWINDOW_WHMAPMODE | RSC_FLOATINGWINDOW_WIDTH | RSC_FLOATINGWINDOW_HEIGHT) & nObjMask ) @@ -237,7 +237,7 @@ FloatingWindow::~FloatingWindow() // ----------------------------------------------------------------------- -Point FloatingWindow::CalcFloatingPosition( Window* pWindow, const Rectangle& rRect, ULONG nFlags, USHORT& rArrangeIndex ) +Point FloatingWindow::CalcFloatingPosition( Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex ) { return ImplCalcPos( pWindow, rRect, nFlags, rArrangeIndex ); } @@ -245,8 +245,8 @@ Point FloatingWindow::CalcFloatingPosition( Window* pWindow, const Rectangle& rR // ----------------------------------------------------------------------- Point FloatingWindow::ImplCalcPos( Window* pWindow, - const Rectangle& rRect, ULONG nFlags, - USHORT& rArrangeIndex ) + const Rectangle& rRect, sal_uLong nFlags, + sal_uInt16& rArrangeIndex ) { // Fenster-Position ermitteln Point aPos; @@ -262,7 +262,7 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow, Rectangle normRect( rRect ); // rRect is already relative to top-level window normRect.SetPos( pW->ScreenToOutputPixel( normRect.TopLeft() ) ); - BOOL bRTL = Application::GetSettings().GetLayoutRTL(); + sal_Bool bRTL = Application::GetSettings().GetLayoutRTL(); Rectangle devRect( pW->OutputToAbsoluteScreenPixel( normRect.TopLeft() ), pW->OutputToAbsoluteScreenPixel( normRect.BottomRight() ) ); @@ -276,9 +276,9 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow, Application::GetBestScreen( bRTL ? devRectRTL : devRect ) ); - USHORT nArrangeAry[5]; - USHORT nArrangeIndex; - BOOL bBreak; + sal_uInt16 nArrangeAry[5]; + sal_uInt16 nArrangeIndex; + sal_Bool bBreak; Point e1,e2; // the common edge between the item rect and the floating window if ( nFlags & FLOATWIN_POPUPMODE_LEFT ) @@ -320,7 +320,7 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow, for ( ; nArrangeIndex < 5; nArrangeIndex++ ) { - bBreak = TRUE; + bBreak = sal_True; switch ( nArrangeAry[nArrangeIndex] ) { @@ -331,12 +331,12 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow, if( bRTL ) // --- RTL --- we're comparing screen coordinates here { if( (devRectRTL.Right()+aSize.Width()) > aScreenRect.Right() ) - bBreak = FALSE; + bBreak = sal_False; } else { if ( aPos.X() < aScreenRect.Left() ) - bBreak = FALSE; + bBreak = sal_False; } if( bBreak ) { @@ -355,12 +355,12 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow, if( bRTL ) // --- RTL --- we're comparing screen coordinates here { if( (devRectRTL.Left() - aSize.Width()) < aScreenRect.Left() ) - bBreak = FALSE; + bBreak = sal_False; } else { if ( aPos.X()+aSize.Width() > aScreenRect.Right() ) - bBreak = FALSE; + bBreak = sal_False; } if( bBreak ) { @@ -377,7 +377,7 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow, aPos.X() = devRect.Left(); aPos.Y() = devRect.Top()-aSize.Height()+1; if ( aPos.Y() < aScreenRect.Top() ) - bBreak = FALSE; + bBreak = sal_False; if( bBreak ) { e1 = devRect.TopLeft(); @@ -392,7 +392,7 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow, case FLOATWIN_POPUPMODE_DOWN: aPos = devRect.BottomLeft(); if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() ) - bBreak = FALSE; + bBreak = sal_False; if( bBreak ) { e1 = devRect.BottomLeft(); @@ -463,7 +463,7 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow, // ----------------------------------------------------------------------- -FloatingWindow* FloatingWindow::ImplFloatHitTest( Window* pReference, const Point& rPos, USHORT& rHitTest ) +FloatingWindow* FloatingWindow::ImplFloatHitTest( Window* pReference, const Point& rPos, sal_uInt16& rHitTest ) { FloatingWindow* pWin = this; @@ -538,20 +538,20 @@ FloatingWindow* FloatingWindow::ImplFindLastLevelFloat() // ----------------------------------------------------------------------- -BOOL FloatingWindow::ImplIsFloatPopupModeWindow( const Window* pWindow ) +sal_Bool FloatingWindow::ImplIsFloatPopupModeWindow( const Window* pWindow ) { FloatingWindow* pWin = this; do { if ( pWin->mpFirstPopupModeWin == pWindow ) - return TRUE; + return sal_True; pWin = pWin->mpNextFloat; } while ( pWin ); - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -560,7 +560,7 @@ IMPL_LINK( FloatingWindow, ImplEndPopupModeHdl, void*, EMPTYARG ) { mnPostId = 0; mnPopupModeFlags = 0; - mbPopupMode = FALSE; + mbPopupMode = sal_False; PopupModeEnd(); return 0; } @@ -577,12 +577,12 @@ long FloatingWindow::Notify( NotifyEvent& rNEvt ) { const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); KeyCode aKeyCode = pKEvt->GetKeyCode(); - USHORT nKeyCode = aKeyCode.GetCode(); + sal_uInt16 nKeyCode = aKeyCode.GetCode(); if ( (nKeyCode == KEY_ESCAPE) && (GetStyle() & WB_CLOSEABLE) ) { Close(); - return TRUE; + return sal_True; } } } @@ -622,7 +622,7 @@ void FloatingWindow::DataChanged( const DataChangedEvent& rDCEvt ) void FloatingWindow::ImplCallPopupModeEnd() { // PopupMode wurde beendet - mbInPopupMode = FALSE; + mbInPopupMode = sal_False; // Handler asyncron rufen if ( !mnPostId ) @@ -638,13 +638,13 @@ void FloatingWindow::PopupModeEnd() // ----------------------------------------------------------------------- -void FloatingWindow::SetTitleType( USHORT nTitle ) +void FloatingWindow::SetTitleType( sal_uInt16 nTitle ) { if ( (mnTitle != nTitle) && mpWindowImpl->mpBorderWindow ) { mnTitle = nTitle; Size aOutSize = GetOutputSizePixel(); - USHORT nTitleStyle; + sal_uInt16 nTitleStyle; if ( nTitle == FLOATWIN_TITLE_NORMAL ) nTitleStyle = BORDERWINDOW_TITLE_SMALL; else if ( nTitle == FLOATWIN_TITLE_TEAROFF ) @@ -660,11 +660,11 @@ void FloatingWindow::SetTitleType( USHORT nTitle ) // ----------------------------------------------------------------------- -void FloatingWindow::StartPopupMode( const Rectangle& rRect, ULONG nFlags ) +void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags ) { // avoid flickering if ( IsVisible() ) - Show( FALSE, SHOW_NOFOCUSCHANGE ); + Show( sal_False, SHOW_NOFOCUSCHANGE ); if ( IsRollUp() ) RollDown(); @@ -688,7 +688,7 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, ULONG nFlags ) nFlags |= FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE; // compute window position according to flags and arrangement - USHORT nArrangeIndex; + sal_uInt16 nArrangeIndex; SetPosPixel( ImplCalcPos( this, rRect, nFlags, nArrangeIndex ) ); // set data and display window @@ -709,11 +709,11 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, ULONG nFlags ) maFloatRect.Right() += 2; maFloatRect.Bottom() += 2; mnPopupModeFlags = nFlags; - mbInPopupMode = TRUE; - mbPopupMode = TRUE; - mbPopupModeCanceled = FALSE; - mbPopupModeTearOff = FALSE; - mbMouseDown = FALSE; + mbInPopupMode = sal_True; + mbPopupMode = sal_True; + mbPopupModeCanceled = sal_False; + mbPopupModeTearOff = sal_False; + mbMouseDown = sal_False; mbOldSaveBackMode = IsSaveBackgroundEnabled(); EnableSaveBackground(); @@ -725,22 +725,22 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, ULONG nFlags ) if( nFlags & FLOATWIN_POPUPMODE_GRABFOCUS ) { // force key input even without focus (useful for menues) - mbGrabFocus = TRUE; + mbGrabFocus = sal_True; } - Show( TRUE, SHOW_NOACTIVATE ); + Show( sal_True, SHOW_NOACTIVATE ); } // ----------------------------------------------------------------------- -void FloatingWindow::StartPopupMode( ToolBox* pBox, ULONG nFlags ) +void FloatingWindow::StartPopupMode( ToolBox* pBox, sal_uLong nFlags ) { // get selected button - USHORT nItemId = pBox->GetDownItemId(); + sal_uInt16 nItemId = pBox->GetDownItemId(); if ( !nItemId ) return; mpImplData->mpBox = pBox; - pBox->ImplFloatControl( TRUE, this ); + pBox->ImplFloatControl( sal_True, this ); // retrieve some data from the ToolBox Rectangle aRect = pBox->GetItemRect( nItemId ); @@ -779,14 +779,14 @@ void FloatingWindow::StartPopupMode( ToolBox* pBox, ULONG nFlags ) // ----------------------------------------------------------------------- -void FloatingWindow::ImplEndPopupMode( USHORT nFlags, ULONG nFocusId ) +void FloatingWindow::ImplEndPopupMode( sal_uInt16 nFlags, sal_uLong nFocusId ) { if ( !mbInPopupMode ) return; ImplSVData* pSVData = ImplGetSVData(); - mbInCleanUp = TRUE; // prevent killing this window due to focus change while working with it + mbInCleanUp = sal_True; // prevent killing this window due to focus change while working with it // Bei allen nachfolgenden PopupMode-Fenster den Modus auch beenden while ( pSVData->maWinData.mpFirstFloat && pSVData->maWinData.mpFirstFloat != this ) @@ -797,13 +797,13 @@ void FloatingWindow::ImplEndPopupMode( USHORT nFlags, ULONG nFocusId ) pSVData->maWinData.mpFirstFloat = mpNextFloat; mpNextFloat = NULL; - ULONG nPopupModeFlags = mnPopupModeFlags; + sal_uLong nPopupModeFlags = mnPopupModeFlags; // Wenn nicht abgerissen wurde, dann Fenster wieder Hiden if ( !(nFlags & FLOATWIN_POPUPMODEEND_TEAROFF) || !(nPopupModeFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) ) { - Show( FALSE, SHOW_NOFOCUSCHANGE ); + Show( sal_False, SHOW_NOFOCUSCHANGE ); // Focus evt. auf ein entsprechendes FloatingWindow weiterschalten if ( nFocusId ) @@ -811,13 +811,13 @@ void FloatingWindow::ImplEndPopupMode( USHORT nFlags, ULONG nFocusId ) else if ( pSVData->maWinData.mpFocusWin && pSVData->maWinData.mpFirstFloat && ImplIsWindowOrChild( pSVData->maWinData.mpFocusWin ) ) pSVData->maWinData.mpFirstFloat->GrabFocus(); - mbPopupModeTearOff = FALSE; + mbPopupModeTearOff = sal_False; } else { - mbPopupModeTearOff = TRUE; + mbPopupModeTearOff = sal_True; if ( nFocusId ) - Window::EndSaveFocus( nFocusId, FALSE ); + Window::EndSaveFocus( nFocusId, sal_False ); } EnableSaveBackground( mbOldSaveBackMode ); @@ -829,7 +829,7 @@ void FloatingWindow::ImplEndPopupMode( USHORT nFlags, ULONG nFocusId ) // ToolBox wieder auf normal schalten if ( mpImplData->mpBox ) { - mpImplData->mpBox->ImplFloatControl( FALSE, this ); + mpImplData->mpBox->ImplFloatControl( sal_False, this ); mpImplData->mpBox = NULL; } @@ -850,12 +850,12 @@ void FloatingWindow::ImplEndPopupMode( USHORT nFlags, ULONG nFocusId ) } } - mbInCleanUp = FALSE; + mbInCleanUp = sal_False; } // ----------------------------------------------------------------------- -void FloatingWindow::EndPopupMode( USHORT nFlags ) +void FloatingWindow::EndPopupMode( sal_uInt16 nFlags ) { ImplEndPopupMode( nFlags ); } diff --git a/vcl/source/window/javachild.cxx b/vcl/source/window/javachild.cxx index 3b26e92829a7..1f15019999e5 100644 --- a/vcl/source/window/javachild.cxx +++ b/vcl/source/window/javachild.cxx @@ -3,10 +3,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: javachild.cxx,v $ + * $Revision: 1.12 $ + * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,30 +32,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" - -#ifdef SOLAR_JAVA -#include <jni.h> -#endif -#include <comphelper/processfactory.hxx> - -#include <vcl/unohelp.hxx> -#include <rtl/process.h> -#include <rtl/ref.hxx> -#include <jvmaccess/virtualmachine.hxx> -#include <com/sun/star/java/XJavaVM.hpp> -#include <com/sun/star/java/XJavaThreadRegister_11.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -#include <svsys.h> -#include <vcl/salinst.hxx> -#include <vcl/salframe.hxx> -#include <vcl/window.hxx> -#include <vcl/salobj.hxx> #include <vcl/javachild.hxx> -#include <vcl/svdata.hxx> -#include <vcl/sysdata.hxx> - -using namespace ::com::sun::star; // ------------------- // - JavaChildWindow - @@ -78,131 +58,9 @@ JavaChildWindow::~JavaChildWindow() // ----------------------------------------------------------------------- -void JavaChildWindow::implTestJavaException( void* pEnv ) -{ -#ifdef SOLAR_JAVA - JNIEnv* pJavaEnv = reinterpret_cast< JNIEnv* >( pEnv ); - jthrowable jtThrowable = pJavaEnv->ExceptionOccurred(); - - if( jtThrowable ) - { // is it a java exception ? -#if OSL_DEBUG_LEVEL > 1 - pJavaEnv->ExceptionDescribe(); -#endif // OSL_DEBUG_LEVEL > 1 - pJavaEnv->ExceptionClear(); - - jclass jcThrowable = pJavaEnv->FindClass("java/lang/Throwable"); - jmethodID jmThrowable_getMessage = pJavaEnv->GetMethodID(jcThrowable, "getMessage", "()Ljava/lang/String;"); - jstring jsMessage = (jstring) pJavaEnv->CallObjectMethod(jtThrowable, jmThrowable_getMessage); - ::rtl::OUString ouMessage; - - if(jsMessage) - { - const jchar * jcMessage = pJavaEnv->GetStringChars(jsMessage, NULL); - ouMessage = ::rtl::OUString(jcMessage); - pJavaEnv->ReleaseStringChars(jsMessage, jcMessage); - } - - throw uno::RuntimeException(ouMessage, uno::Reference<uno::XInterface>()); - } -#endif // SOLAR_JAVA -} - -// ----------------------------------------------------------------------- - sal_IntPtr JavaChildWindow::getParentWindowHandleForJava() { - sal_IntPtr nRet = 0; - -#if defined WNT - nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->hWnd ); -#elif defined QUARTZ - // FIXME: this is wrong - nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView ); -#elif defined UNX -#ifdef SOLAR_JAVA - uno::Reference< lang::XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); - - if( xFactory.is() && ( GetSystemData()->aWindow > 0 ) ) - { - try - { - ::rtl::Reference< ::jvmaccess::VirtualMachine > xVM; - uno::Reference< java::XJavaVM > xJavaVM( xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine") ) ), uno::UNO_QUERY ); - uno::Sequence< sal_Int8 > aProcessID( 17 ); - - rtl_getGlobalProcessId( (sal_uInt8*) aProcessID.getArray() ); - aProcessID[ 16 ] = 0; - OSL_ENSURE(sizeof (sal_Int64) >= sizeof (jvmaccess::VirtualMachine *), "Pointer cannot be represented as sal_Int64"); - sal_Int64 nPointer = reinterpret_cast< sal_Int64 >( static_cast< jvmaccess::VirtualMachine * >(0)); - xJavaVM->getJavaVM(aProcessID) >>= nPointer; - xVM = reinterpret_cast< jvmaccess::VirtualMachine * >(nPointer); - - if( xVM.is() ) - { - try - { - ::jvmaccess::VirtualMachine::AttachGuard aVMAttachGuard( xVM ); - JNIEnv* pEnv = aVMAttachGuard.getEnvironment(); - - jclass jcToolkit = pEnv->FindClass("java/awt/Toolkit"); - implTestJavaException(pEnv); - - jmethodID jmToolkit_getDefaultToolkit = pEnv->GetStaticMethodID( jcToolkit, "getDefaultToolkit", "()Ljava/awt/Toolkit;" ); - implTestJavaException(pEnv); - - pEnv->CallStaticObjectMethod(jcToolkit, jmToolkit_getDefaultToolkit); - implTestJavaException(pEnv); - - jclass jcMotifAppletViewer = pEnv->FindClass("sun/plugin/navig/motif/MotifAppletViewer"); - if( pEnv->ExceptionOccurred() ) - { - pEnv->ExceptionClear(); - - jcMotifAppletViewer = pEnv->FindClass( "sun/plugin/viewer/MNetscapePluginContext"); - implTestJavaException(pEnv); - } - - jclass jcClassLoader = pEnv->FindClass("java/lang/ClassLoader"); - implTestJavaException(pEnv); - - jmethodID jmClassLoader_loadLibrary = pEnv->GetStaticMethodID( jcClassLoader, "loadLibrary", "(Ljava/lang/Class;Ljava/lang/String;Z)V"); - implTestJavaException(pEnv); - - jstring jsplugin = pEnv->NewStringUTF("javaplugin_jni"); - implTestJavaException(pEnv); - - pEnv->CallStaticVoidMethod(jcClassLoader, jmClassLoader_loadLibrary, jcMotifAppletViewer, jsplugin, JNI_FALSE); - implTestJavaException(pEnv); - - jmethodID jmMotifAppletViewer_getWidget = pEnv->GetStaticMethodID( jcMotifAppletViewer, "getWidget", "(IIIII)I" ); - implTestJavaException(pEnv); - - const Size aSize( GetOutputSizePixel() ); - jint ji_widget = pEnv->CallStaticIntMethod( jcMotifAppletViewer, jmMotifAppletViewer_getWidget, - GetSystemData()->aWindow, 0, 0, aSize.Width(), aSize.Height() ); - implTestJavaException(pEnv); - - nRet = static_cast< sal_IntPtr >( ji_widget ); - } - catch( uno::RuntimeException& ) - { - } - - if( !nRet ) - nRet = static_cast< sal_IntPtr >( GetSystemData()->aWindow ); - } - } - catch( ... ) - { - } - } -#endif // SOLAR_JAVA -#else // WNT || QUARTZ || UNX - // TBD -#endif - - return nRet; + return SystemChildWindow::GetParentWindowHandle( sal_True ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/keycod.cxx b/vcl/source/window/keycod.cxx index 575b8022b739..05370f3a029f 100644 --- a/vcl/source/window/keycod.cxx +++ b/vcl/source/window/keycod.cxx @@ -41,7 +41,7 @@ // ======================================================================= -static USHORT aImplKeyFuncTab[(KEYFUNC_FRONT+1)*4] = +static sal_uInt16 aImplKeyFuncTab[(KEYFUNC_FRONT+1)*4] = { 0, 0, 0, 0, // KEYFUNC_DONTKNOW KEY_N | KEY_MOD1, 0, 0, 0, // KEYFUNC_NEW @@ -66,9 +66,9 @@ static USHORT aImplKeyFuncTab[(KEYFUNC_FRONT+1)*4] = // ----------------------------------------------------------------------- -void ImplGetKeyCode( KeyFuncType eFunc, USHORT& rCode1, USHORT& rCode2, USHORT& rCode3, USHORT& rCode4 ) +void ImplGetKeyCode( KeyFuncType eFunc, sal_uInt16& rCode1, sal_uInt16& rCode2, sal_uInt16& rCode3, sal_uInt16& rCode4 ) { - USHORT nIndex = (USHORT)eFunc; + sal_uInt16 nIndex = (sal_uInt16)eFunc; nIndex *= 4; rCode1 = aImplKeyFuncTab[nIndex]; rCode2 = aImplKeyFuncTab[nIndex+1]; @@ -80,7 +80,7 @@ void ImplGetKeyCode( KeyFuncType eFunc, USHORT& rCode1, USHORT& rCode2, USHORT& KeyCode::KeyCode( KeyFuncType eFunction ) { - USHORT nDummy; + sal_uInt16 nDummy; ImplGetKeyCode( eFunction, nCode, nDummy, nDummy, nDummy ); eFunc = eFunction; } @@ -96,18 +96,18 @@ KeyCode::KeyCode( const ResId& rResId ) { pResMgr->Increment( sizeof( RSHEADER_TYPE ) ); - ULONG nKeyCode = pResMgr->ReadLong(); - ULONG nModifier = pResMgr->ReadLong(); - ULONG nKeyFunc = pResMgr->ReadLong(); + sal_uLong nKeyCode = pResMgr->ReadLong(); + sal_uLong nModifier = pResMgr->ReadLong(); + sal_uLong nKeyFunc = pResMgr->ReadLong(); eFunc = (KeyFuncType)nKeyFunc; if ( eFunc != KEYFUNC_DONTKNOW ) { - USHORT nDummy; + sal_uInt16 nDummy; ImplGetKeyCode( eFunc, nCode, nDummy, nDummy, nDummy ); } else - nCode = sal::static_int_cast<USHORT>(nKeyCode | nModifier); + nCode = sal::static_int_cast<sal_uInt16>(nKeyCode | nModifier); } } @@ -136,15 +136,15 @@ KeyFuncType KeyCode::GetFunction() const if ( eFunc != KEYFUNC_DONTKNOW ) return eFunc; - USHORT nCompCode = GetModifier() | GetCode(); + sal_uInt16 nCompCode = GetModifier() | GetCode(); if ( nCompCode ) { - for ( USHORT i = (USHORT)KEYFUNC_NEW; i < (USHORT)KEYFUNC_FRONT; i++ ) + for ( sal_uInt16 i = (sal_uInt16)KEYFUNC_NEW; i < (sal_uInt16)KEYFUNC_FRONT; i++ ) { - USHORT nKeyCode1; - USHORT nKeyCode2; - USHORT nKeyCode3; - USHORT nKeyCode4; + sal_uInt16 nKeyCode1; + sal_uInt16 nKeyCode2; + sal_uInt16 nKeyCode3; + sal_uInt16 nKeyCode4; ImplGetKeyCode( (KeyFuncType)i, nKeyCode1, nKeyCode2, nKeyCode3, nKeyCode4 ); if ( (nCompCode == nKeyCode1) || (nCompCode == nKeyCode2) || (nCompCode == nKeyCode3) || (nCompCode == nKeyCode4) ) return (KeyFuncType)i; diff --git a/vcl/source/window/keyevent.cxx b/vcl/source/window/keyevent.cxx index 2677c31cc100..db8144c3d648 100644 --- a/vcl/source/window/keyevent.cxx +++ b/vcl/source/window/keyevent.cxx @@ -75,8 +75,8 @@ KeyEvent KeyEvent::LogicalTextDirectionality (TextDirectionality eMode) const { KeyEvent aClone(*this); - USHORT nCode = maKeyCode.GetCode(); - USHORT nMod = maKeyCode.GetAllModifier(); + sal_uInt16 nCode = maKeyCode.GetCode(); + sal_uInt16 nMod = maKeyCode.GetAllModifier(); switch (eMode) { diff --git a/vcl/source/window/makefile.mk b/vcl/source/window/makefile.mk index 82ce26f8e78e..1c63376dfda5 100644 --- a/vcl/source/window/makefile.mk +++ b/vcl/source/window/makefile.mk @@ -85,6 +85,8 @@ SLOFILES= \ $(SLO)$/winproc.obj \ $(SLO)$/window2.obj \ $(SLO)$/window3.obj \ + $(SLO)$/window4.obj \ + $(SLO)$/wpropset.obj \ $(SLO)$/wrkwin.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 6d76050623cd..6ab9dda55fc2 100644..100755 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1,3 +1,4 @@ + /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * @@ -80,9 +81,9 @@ namespace vcl struct MenuLayoutData : public ControlLayoutData { - std::vector< USHORT > m_aLineItemIds; - std::vector< USHORT > m_aLineItemPositions; - std::map< USHORT, Rectangle > m_aVisibleItemBoundRects; + std::vector< sal_uInt16 > m_aLineItemIds; + std::vector< sal_uInt16 > m_aLineItemPositions; + std::map< sal_uInt16, Rectangle > m_aVisibleItemBoundRects; }; } @@ -96,6 +97,7 @@ DBG_NAME( Menu ) #define EXTRASPACEY 2 #define EXTRAITEMHEIGHT 4 +#define GUTTERBORDER 8 // document closer #define IID_DOCUMENTCLOSE 1 @@ -104,32 +106,32 @@ DBG_NAME( Menu ) #include <xwphook.h> -// return TRUE if hilite should be executed: left mouse button down +// return sal_True if hilite should be executed: left mouse button down // or xwp mouse hook enabled -static BOOL ImplHilite( const MouseEvent& rMEvt ) +static sal_Bool ImplHilite( const MouseEvent& rMEvt ) { - static BOOL init = FALSE; + static sal_Bool init = sal_False; static HOOKCONFIG hc; // read XWP settings at program startup - if (init == FALSE) { - BOOL rc; - ULONG cb = sizeof(HOOKCONFIG); + if (init == sal_False) { + sal_Bool rc; + sal_uLong cb = sizeof(HOOKCONFIG); memset(&hc, 0, sizeof(HOOKCONFIG)); rc = PrfQueryProfileData( HINI_USER, INIAPP_XWPHOOK, INIKEY_HOOK_CONFIG, &hc, &cb); - init = TRUE; + init = sal_True; } // check mouse left button if (rMEvt.GetButtons() == MOUSE_LEFT) - return TRUE; + return sal_True; // return xwp flag return hc.fSlidingMenus; } #endif -static BOOL ImplAccelDisabled() +static sal_Bool ImplAccelDisabled() { // display of accelerator strings may be suppressed via configuration static int nAccelDisabled = -1; @@ -142,12 +144,12 @@ static BOOL ImplAccelDisabled() rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SuppressAccelerators" ) ) ); nAccelDisabled = aStr.equalsIgnoreAsciiCaseAscii( "true" ) ? 1 : 0; } - return (nAccelDisabled == 1) ? TRUE : FALSE; + return (nAccelDisabled == 1) ? sal_True : sal_False; } struct MenuItemData { - USHORT nId; // SV Id + sal_uInt16 nId; // SV Id MenuItemType eType; // MenuItem-Type MenuItemBits nBits; // MenuItem-Bits Menu* pSubMenu; // Pointer auf das SubMenu @@ -157,15 +159,15 @@ struct MenuItemData XubString aTipHelpText; // TipHelp-String (eg, expanded filenames) XubString aCommandStr; // CommandString XubString aHelpCommandStr; // Help command string (to reference external help) - ULONG nHelpId; // Help-Id - ULONG nUserValue; // User value + rtl::OString aHelpId; // Help-Id + sal_uLong nUserValue; // User value Image aImage; // Image KeyCode aAccelKey; // Accelerator-Key - BOOL bChecked; // Checked - BOOL bEnabled; // Enabled - BOOL bVisible; // Visible (note: this flag will not override MENU_FLAG_HIDEDISABLEDENTRIES when true) - BOOL bIsTemporary; // Temporary inserted ('No selection possible') - BOOL bMirrorMode; + sal_Bool bChecked; // Checked + sal_Bool bEnabled; // Enabled + sal_Bool bVisible; // Visible (note: this flag will not override MENU_FLAG_HIDEDISABLEDENTRIES when true) + sal_Bool bIsTemporary; // Temporary inserted ('No selection possible') + sal_Bool bMirrorMode; long nItemImageAngle; Size aSz; // nur temporaer gueltig XubString aAccessibleName; // accessible name @@ -210,22 +212,22 @@ public: MenuItemList() : List( 16, 4 ) {} ~MenuItemList(); - MenuItemData* Insert( USHORT nId, MenuItemType eType, MenuItemBits nBits, + MenuItemData* Insert( sal_uInt16 nId, MenuItemType eType, MenuItemBits nBits, const XubString& rStr, const Image& rImage, - Menu* pMenu, USHORT nPos ); - void InsertSeparator( USHORT nPos ); - void Remove( USHORT nPos ); + Menu* pMenu, sal_uInt16 nPos ); + void InsertSeparator( sal_uInt16 nPos ); + void Remove( sal_uInt16 nPos ); - MenuItemData* GetData( USHORT nSVId, USHORT& rPos ) const; - MenuItemData* GetData( USHORT nSVId ) const - { USHORT nTemp; return GetData( nSVId, nTemp ); } - MenuItemData* GetDataFromPos( ULONG nPos ) const + MenuItemData* GetData( sal_uInt16 nSVId, sal_uInt16& rPos ) const; + MenuItemData* GetData( sal_uInt16 nSVId ) const + { sal_uInt16 nTemp; return GetData( nSVId, nTemp ); } + MenuItemData* GetDataFromPos( sal_uLong nPos ) const { return (MenuItemData*)List::GetObject( nPos ); } - MenuItemData* SearchItem( xub_Unicode cSelectChar, KeyCode aKeyCode, USHORT& rPos, USHORT& nDuplicates, USHORT nCurrentPos ) const; - USHORT GetItemCount( xub_Unicode cSelectChar ) const; - USHORT GetItemCount( KeyCode aKeyCode ) const; + MenuItemData* SearchItem( xub_Unicode cSelectChar, KeyCode aKeyCode, sal_uInt16& rPos, sal_uInt16& nDuplicates, sal_uInt16 nCurrentPos ) const; + sal_uInt16 GetItemCount( xub_Unicode cSelectChar ) const; + sal_uInt16 GetItemCount( KeyCode aKeyCode ) const; uno::Reference< i18n::XCharacterClassification > GetCharClass() const; }; @@ -234,17 +236,17 @@ public: MenuItemList::~MenuItemList() { - for ( ULONG n = Count(); n; ) + for ( sal_uLong n = Count(); n; ) { MenuItemData* pData = GetDataFromPos( --n ); delete pData; } } -MenuItemData* MenuItemList::Insert( USHORT nId, MenuItemType eType, +MenuItemData* MenuItemList::Insert( sal_uInt16 nId, MenuItemType eType, MenuItemBits nBits, const XubString& rStr, const Image& rImage, - Menu* pMenu, USHORT nPos ) + Menu* pMenu, sal_uInt16 nPos ) { MenuItemData* pData = new MenuItemData( rStr, rImage ); pData->nId = nId; @@ -252,13 +254,12 @@ MenuItemData* MenuItemList::Insert( USHORT nId, MenuItemType eType, pData->nBits = nBits; pData->pSubMenu = NULL; pData->pAutoSubMenu = NULL; - pData->nHelpId = 0; pData->nUserValue = 0; - pData->bChecked = FALSE; - pData->bEnabled = TRUE; - pData->bVisible = TRUE; - pData->bIsTemporary = FALSE; - pData->bMirrorMode = FALSE; + pData->bChecked = sal_False; + pData->bEnabled = sal_True; + pData->bVisible = sal_True; + pData->bIsTemporary = sal_False; + pData->bMirrorMode = sal_False; pData->nItemImageAngle = 0; SalItemParams aSalMIData; @@ -276,7 +277,7 @@ MenuItemData* MenuItemList::Insert( USHORT nId, MenuItemType eType, return pData; } -void MenuItemList::InsertSeparator( USHORT nPos ) +void MenuItemList::InsertSeparator( sal_uInt16 nPos ) { MenuItemData* pData = new MenuItemData; pData->nId = 0; @@ -284,13 +285,12 @@ void MenuItemList::InsertSeparator( USHORT nPos ) pData->nBits = 0; pData->pSubMenu = NULL; pData->pAutoSubMenu = NULL; - pData->nHelpId = 0; pData->nUserValue = 0; - pData->bChecked = FALSE; - pData->bEnabled = TRUE; - pData->bVisible = TRUE; - pData->bIsTemporary = FALSE; - pData->bMirrorMode = FALSE; + pData->bChecked = sal_False; + pData->bEnabled = sal_True; + pData->bVisible = sal_True; + pData->bIsTemporary = sal_False; + pData->bMirrorMode = sal_False; pData->nItemImageAngle = 0; SalItemParams aSalMIData; @@ -307,14 +307,14 @@ void MenuItemList::InsertSeparator( USHORT nPos ) List::Insert( (void*)pData, nPos ); } -void MenuItemList::Remove( USHORT nPos ) +void MenuItemList::Remove( sal_uInt16 nPos ) { - MenuItemData* pData = (MenuItemData*)List::Remove( (ULONG)nPos ); + MenuItemData* pData = (MenuItemData*)List::Remove( (sal_uLong)nPos ); if ( pData ) delete pData; } -MenuItemData* MenuItemList::GetData( USHORT nSVId, USHORT& rPos ) const +MenuItemData* MenuItemList::GetData( sal_uInt16 nSVId, sal_uInt16& rPos ) const { rPos = 0; MenuItemData* pData = (MenuItemData*)GetObject( rPos ); @@ -330,11 +330,11 @@ MenuItemData* MenuItemList::GetData( USHORT nSVId, USHORT& rPos ) const return NULL; } -MenuItemData* MenuItemList::SearchItem( xub_Unicode cSelectChar, KeyCode aKeyCode, USHORT& rPos, USHORT& nDuplicates, USHORT nCurrentPos ) const +MenuItemData* MenuItemList::SearchItem( xub_Unicode cSelectChar, KeyCode aKeyCode, sal_uInt16& rPos, sal_uInt16& nDuplicates, sal_uInt16 nCurrentPos ) const { const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); - USHORT nListCount = (USHORT)Count(); + sal_uInt16 nListCount = (sal_uInt16)Count(); // try character code first nDuplicates = GetItemCount( cSelectChar ); // return number of duplicates @@ -367,7 +367,7 @@ MenuItemData* MenuItemList::SearchItem( xub_Unicode cSelectChar, KeyCode aKeyCod MenuItemData* pData = GetDataFromPos( rPos ); if ( pData->bEnabled ) { - USHORT n = pData->aText.Search( '~' ); + sal_uInt16 n = pData->aText.Search( '~' ); if ( n != STRING_NOTFOUND ) { KeyCode mnKeyCode; @@ -391,13 +391,13 @@ MenuItemData* MenuItemList::SearchItem( xub_Unicode cSelectChar, KeyCode aKeyCod return NULL; } -USHORT MenuItemList::GetItemCount( xub_Unicode cSelectChar ) const +sal_uInt16 MenuItemList::GetItemCount( xub_Unicode cSelectChar ) const { // returns number of entries with same mnemonic const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); - USHORT nItems = 0, nPos; - for ( nPos = (USHORT)Count(); nPos; ) + sal_uInt16 nItems = 0, nPos; + for ( nPos = (sal_uInt16)Count(); nPos; ) { MenuItemData* pData = GetDataFromPos( --nPos ); if ( pData->bEnabled && rI18nHelper.MatchMnemonic( pData->aText, cSelectChar ) ) @@ -407,7 +407,7 @@ USHORT MenuItemList::GetItemCount( xub_Unicode cSelectChar ) const return nItems; } -USHORT MenuItemList::GetItemCount( KeyCode aKeyCode ) const +sal_uInt16 MenuItemList::GetItemCount( KeyCode aKeyCode ) const { // returns number of entries with same mnemonic // uses key codes instead of character codes @@ -416,13 +416,13 @@ USHORT MenuItemList::GetItemCount( KeyCode aKeyCode ) const if( aKeyCode.GetCode() >= KEY_A && aKeyCode.GetCode() <= KEY_Z ) ascii = sal::static_int_cast<char>('A' + (aKeyCode.GetCode() - KEY_A)); - USHORT nItems = 0, nPos; - for ( nPos = (USHORT)Count(); nPos; ) + sal_uInt16 nItems = 0, nPos; + for ( nPos = (sal_uInt16)Count(); nPos; ) { MenuItemData* pData = GetDataFromPos( --nPos ); if ( pData->bEnabled ) { - USHORT n = pData->aText.Search( '~' ); + sal_uInt16 n = pData->aText.Search( '~' ); if ( n != STRING_NOTFOUND ) { KeyCode mnKeyCode; @@ -464,21 +464,21 @@ private: Timer aHighlightChangedTimer; Timer aSubmenuCloseTimer; Timer aScrollTimer; - ULONG nSaveFocusId; + sal_uLong nSaveFocusId; // long nStartY; - USHORT nHighlightedItem; // gehighlightetes/selektiertes Item - USHORT nMBDownPos; - USHORT nScrollerHeight; - USHORT nFirstEntry; - USHORT nBorder; - USHORT nPosInParent; - BOOL bInExecute; - - BOOL bScrollMenu; - BOOL bScrollUp; - BOOL bScrollDown; - BOOL bIgnoreFirstMove; - BOOL bKeyInput; + sal_uInt16 nHighlightedItem; // gehighlightetes/selektiertes Item + sal_uInt16 nMBDownPos; + sal_uInt16 nScrollerHeight; + sal_uInt16 nFirstEntry; + sal_uInt16 nBorder; + sal_uInt16 nPosInParent; + sal_Bool bInExecute; + + sal_Bool bScrollMenu; + sal_Bool bScrollUp; + sal_Bool bScrollDown; + sal_Bool bIgnoreFirstMove; + sal_Bool bKeyInput; DECL_LINK( PopupEnd, FloatingWindow* ); DECL_LINK( HighlightChanged, Timer* ); @@ -489,16 +489,16 @@ private: void StateChanged( StateChangedType nType ); void DataChanged( const DataChangedEvent& rDCEvt ); protected: - Region ImplCalcClipRegion( BOOL bIncludeLogo = TRUE ) const; + Region ImplCalcClipRegion( sal_Bool bIncludeLogo = sal_True ) const; void ImplInitClipRegion(); - void ImplDrawScroller( BOOL bUp ); + void ImplDrawScroller( sal_Bool bUp ); using Window::ImplScroll; void ImplScroll( const Point& rMousePos ); - void ImplScroll( BOOL bUp ); - void ImplCursorUpDown( BOOL bUp, BOOL bHomeEnd = FALSE ); - void ImplHighlightItem( const MouseEvent& rMEvt, BOOL bMBDown ); + void ImplScroll( sal_Bool bUp ); + void ImplCursorUpDown( sal_Bool bUp, sal_Bool bHomeEnd = sal_False ); + void ImplHighlightItem( const MouseEvent& rMEvt, sal_Bool bMBDown ); long ImplGetStartY() const; - Rectangle ImplGetItemRect( USHORT nPos ); + Rectangle ImplGetItemRect( sal_uInt16 nPos ); public: MenuFloatingWindow( Menu* pMenu, Window* pParent, WinBits nStyle ); @@ -515,27 +515,27 @@ public: virtual void RequestHelp( const HelpEvent& rHEvt ); virtual void Resize(); - void SetFocusId( ULONG nId ) { nSaveFocusId = nId; } - ULONG GetFocusId() const { return nSaveFocusId; } + void SetFocusId( sal_uLong nId ) { nSaveFocusId = nId; } + sal_uLong GetFocusId() const { return nSaveFocusId; } - void EnableScrollMenu( BOOL b ); - BOOL IsScrollMenu() const { return bScrollMenu; } - USHORT GetScrollerHeight() const { return nScrollerHeight; } + void EnableScrollMenu( sal_Bool b ); + sal_Bool IsScrollMenu() const { return bScrollMenu; } + sal_uInt16 GetScrollerHeight() const { return nScrollerHeight; } void Execute(); - void StopExecute( ULONG nFocusId = 0 ); + void StopExecute( sal_uLong nFocusId = 0 ); void EndExecute(); - void EndExecute( USHORT nSelectId ); + void EndExecute( sal_uInt16 nSelectId ); PopupMenu* GetActivePopup() const { return pActivePopup; } void KillActivePopup( PopupMenu* pThisOnly = NULL ); - void HighlightItem( USHORT nPos, BOOL bHighlight ); - void ChangeHighlightItem( USHORT n, BOOL bStartPopupTimer ); - USHORT GetHighlightedItem() const { return nHighlightedItem; } + void HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight ); + void ChangeHighlightItem( sal_uInt16 n, sal_Bool bStartPopupTimer ); + sal_uInt16 GetHighlightedItem() const { return nHighlightedItem; } - void SetPosInParent( USHORT nPos ) { nPosInParent = nPos; } - USHORT GetPosInParent() const { return nPosInParent; } + void SetPosInParent( sal_uInt16 nPos ) { nPosInParent = nPos; } + sal_uInt16 GetPosInParent() const { return nPosInParent; } virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); }; @@ -606,10 +606,10 @@ void DecoToolBox::calcMinSize() } else { - USHORT nItems = GetItemCount(); - for( USHORT i = 0; i < nItems; i++ ) + sal_uInt16 nItems = GetItemCount(); + for( sal_uInt16 i = 0; i < nItems; i++ ) { - USHORT nId = GetItemId( i ); + sal_uInt16 nId = GetItemId( i ); aTbx.InsertItem( nId, GetItemImage( nId ) ); } } @@ -670,7 +670,7 @@ class MenuBarWindow : public Window private: struct AddButtonEntry { - USHORT m_nId; + sal_uInt16 m_nId; Link m_aSelectLink; Link m_aHighlightLink; @@ -679,25 +679,25 @@ private: Menu* pMenu; PopupMenu* pActivePopup; - USHORT nHighlightedItem; - ULONG nSaveFocusId; - BOOL mbAutoPopup; - BOOL bIgnoreFirstMove; - BOOL bStayActive; + sal_uInt16 nHighlightedItem; + sal_uLong nSaveFocusId; + sal_Bool mbAutoPopup; + sal_Bool bIgnoreFirstMove; + sal_Bool bStayActive; DecoToolBox aCloser; PushButton aFloatBtn; PushButton aHideBtn; - std::map< USHORT, AddButtonEntry > m_aAddButtons; + std::map< sal_uInt16, AddButtonEntry > m_aAddButtons; - void HighlightItem( USHORT nPos, BOOL bHighlight ); - void ChangeHighlightItem( USHORT n, BOOL bSelectPopupEntry, BOOL bAllowRestoreFocus = TRUE, BOOL bDefaultToDocument = TRUE ); + void HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight ); + void ChangeHighlightItem( sal_uInt16 n, sal_Bool bSelectPopupEntry, sal_Bool bAllowRestoreFocus = sal_True, sal_Bool bDefaultToDocument = sal_True ); - USHORT ImplFindEntry( const Point& rMousePos ) const; - void ImplCreatePopup( BOOL bPreSelectFirst ); - BOOL ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu = TRUE ); - Rectangle ImplGetItemRect( USHORT nPos ); + sal_uInt16 ImplFindEntry( const Point& rMousePos ) const; + void ImplCreatePopup( sal_Bool bPreSelectFirst ); + sal_Bool ImplHandleKeyEvent( const KeyEvent& rKEvent, sal_Bool bFromMenu = sal_True ); + Rectangle ImplGetItemRect( sal_uInt16 nPos ); void ImplInitStyleSettings(); @@ -716,7 +716,7 @@ public: MenuBarWindow( Window* pParent ); ~MenuBarWindow(); - void ShowButtons( BOOL bClose, BOOL bFloat, BOOL bHide ); + void ShowButtons( sal_Bool bClose, sal_Bool bFloat, sal_Bool bHide ); virtual void MouseMove( const MouseEvent& rMEvt ); virtual void MouseButtonDown( const MouseEvent& rMEvt ); @@ -726,26 +726,26 @@ public: virtual void Resize(); virtual void RequestHelp( const HelpEvent& rHEvt ); - void SetFocusId( ULONG nId ) { nSaveFocusId = nId; } - ULONG GetFocusId() const { return nSaveFocusId; } + void SetFocusId( sal_uLong nId ) { nSaveFocusId = nId; } + sal_uLong GetFocusId() const { return nSaveFocusId; } void SetMenu( MenuBar* pMenu ); void KillActivePopup(); PopupMenu* GetActivePopup() const { return pActivePopup; } void PopupClosed( Menu* pMenu ); - USHORT GetHighlightedItem() const { return nHighlightedItem; } + sal_uInt16 GetHighlightedItem() const { return nHighlightedItem; } virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); - void SetAutoPopup( BOOL bAuto ) { mbAutoPopup = bAuto; } + void SetAutoPopup( sal_Bool bAuto ) { mbAutoPopup = bAuto; } void ImplLayoutChanged(); Size MinCloseButtonSize(); // add an arbitrary button to the menubar (will appear next to closer) - USHORT AddMenuBarButton( const Image&, const Link&, const String&, USHORT nPos ); - void SetMenuBarButtonHighlightHdl( USHORT nId, const Link& ); - Rectangle GetMenuBarButtonRectPixel( USHORT nId ); - void RemoveMenuBarButton( USHORT nId ); - bool HandleMenuButtonEvent( USHORT i_nButtonId ); + sal_uInt16 AddMenuBarButton( const Image&, const Link&, const String&, sal_uInt16 nPos ); + void SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link& ); + Rectangle GetMenuBarButtonRectPixel( sal_uInt16 nId ); + void RemoveMenuBarButton( sal_uInt16 nId ); + bool HandleMenuButtonEvent( sal_uInt16 i_nButtonId ); }; static void ImplAddNWFSeparator( Window *pThis, const MenubarValue& rMenubarValue ) @@ -775,24 +775,24 @@ static void ImplSetMenuItemData( MenuItemData* pData ) pData->eType = MENUITEM_STRINGIMAGE; } -static ULONG ImplChangeTipTimeout( ULONG nTimeout, Window *pWindow ) +static sal_uLong ImplChangeTipTimeout( sal_uLong nTimeout, Window *pWindow ) { AllSettings aAllSettings( pWindow->GetSettings() ); HelpSettings aHelpSettings( aAllSettings.GetHelpSettings() ); - ULONG nRet = aHelpSettings.GetTipTimeout(); + sal_uLong nRet = aHelpSettings.GetTipTimeout(); aHelpSettings.SetTipTimeout( nTimeout ); aAllSettings.SetHelpSettings( aHelpSettings ); pWindow->SetSettings( aAllSettings ); return nRet; } -static BOOL ImplHandleHelpEvent( Window* pMenuWindow, Menu* pMenu, USHORT nHighlightedItem, const HelpEvent& rHEvt, const Rectangle &rHighlightRect ) +static sal_Bool ImplHandleHelpEvent( Window* pMenuWindow, Menu* pMenu, sal_uInt16 nHighlightedItem, const HelpEvent& rHEvt, const Rectangle &rHighlightRect ) { if( ! pMenu ) - return FALSE; + return sal_False; - BOOL bDone = FALSE; - USHORT nId = 0; + sal_Bool bDone = sal_False; + sal_uInt16 nId = 0; if ( nHighlightedItem != ITEMPOS_INVALID ) { @@ -815,23 +815,23 @@ static BOOL ImplHandleHelpEvent( Window* pMenuWindow, Menu* pMenu, USHORT nHighl else { // give user a chance to read the full filename - ULONG oldTimeout=ImplChangeTipTimeout( 60000, pMenuWindow ); + sal_uLong oldTimeout=ImplChangeTipTimeout( 60000, pMenuWindow ); // call always, even when strlen==0 to correctly remove tip Help::ShowQuickHelp( pMenuWindow, aRect, pMenu->GetTipHelpText( nId ) ); ImplChangeTipTimeout( oldTimeout, pMenuWindow ); } - bDone = TRUE; + bDone = sal_True; } else if ( ( rHEvt.GetMode() & HELPMODE_QUICK ) && pMenuWindow ) { Point aPos = rHEvt.GetMousePosPixel(); Rectangle aRect( aPos, Size() ); // give user a chance to read the full filename - ULONG oldTimeout=ImplChangeTipTimeout( 60000, pMenuWindow ); + sal_uLong oldTimeout=ImplChangeTipTimeout( 60000, pMenuWindow ); // call always, even when strlen==0 to correctly remove tip Help::ShowQuickHelp( pMenuWindow, aRect, pMenu->GetTipHelpText( nId ) ); ImplChangeTipTimeout( oldTimeout, pMenuWindow ); - bDone = TRUE; + bDone = sal_True; } else if ( rHEvt.GetMode() & (HELPMODE_CONTEXT | HELPMODE_EXTENDED) ) { @@ -842,16 +842,16 @@ static BOOL ImplHandleHelpEvent( Window* pMenuWindow, Menu* pMenu, USHORT nHighl // Ist eine ID vorhanden, dann Hilfe mit der ID aufrufen, sonst // den Hilfe-Index String aCommand = pMenu->GetItemCommand( nId ); - ULONG nHelpId = pMenu->GetHelpId( nId ); + rtl::OString aHelpId( pMenu->GetHelpId( nId ) ); + if( ! aHelpId.getLength() ) + aHelpId = OOO_HELP_INDEX; if ( aCommand.Len() ) pHelp->Start( aCommand, NULL ); - else if ( nHelpId ) - pHelp->Start( nHelpId, NULL ); else - pHelp->Start( OOO_HELP_INDEX, NULL ); + pHelp->Start( rtl::OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ), NULL ); } - bDone = TRUE; + bDone = sal_True; } return bDone; } @@ -861,7 +861,7 @@ static int ImplGetTopDockingAreaHeight( Window *pWindow ) // find docking area that is top aligned and return its height // note: dockingareas are direct children of the SystemWindow int height=0; - BOOL bDone = FALSE; + sal_Bool bDone = sal_False; if( pWindow->ImplGetFrameWindow() ) { Window *pWin = pWindow->ImplGetFrameWindow()->GetWindow( WINDOW_FIRSTCHILD); //mpWindowImpl->mpFirstChild; @@ -875,7 +875,7 @@ static int ImplGetTopDockingAreaHeight( Window *pWindow ) DockingAreaWindow *pDockingArea = dynamic_cast< DockingAreaWindow* >( pWin ); if( pDockingArea && pDockingArea->GetAlign() == WINDOWALIGN_TOP ) { - bDone = TRUE; + bDone = sal_True; if( pDockingArea->IsVisible() ) height = pDockingArea->GetOutputSizePixel().Height(); } @@ -894,13 +894,13 @@ static int ImplGetTopDockingAreaHeight( Window *pWindow ) Menu::Menu() { DBG_CTOR( Menu, NULL ); - bIsMenuBar = FALSE; + bIsMenuBar = sal_False; ImplInit(); } // this constructor makes sure we're creating the native menu // with the correct type (ie, MenuBar vs. PopupMenu) -Menu::Menu( BOOL bMenubar ) +Menu::Menu( sal_Bool bMenubar ) { DBG_CTOR( Menu, NULL ); bIsMenuBar = bMenubar; @@ -944,7 +944,7 @@ Menu::~Menu() pDelData = pDelData->mpNext; } - bKilled = TRUE; + bKilled = sal_True; delete pItemList; delete pLogo; @@ -965,20 +965,20 @@ void Menu::ImplInit() mpSalMenu = NULL; nMenuFlags = 0; nDefaultItem = 0; - //bIsMenuBar = FALSE; // this is now set in the ctor, must not be changed here!!! + //bIsMenuBar = sal_False; // this is now set in the ctor, must not be changed here!!! nSelectedId = 0; pItemList = new MenuItemList; pLogo = NULL; pStartedFrom = NULL; pWindow = NULL; nEventId = 0; - bCanceled = FALSE; - bInCallback = FALSE; - bKilled = FALSE; + bCanceled = sal_False; + bInCallback = sal_False; + bKilled = sal_False; mpLayoutData = NULL; mpFirstDel = NULL; // Dtor notification list // Native-support: returns NULL if not supported - mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu( bIsMenuBar ); + mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu( bIsMenuBar, this ); } Menu* Menu::ImplGetStartedFrom() const @@ -995,13 +995,13 @@ void Menu::ImplLoadRes( const ResId& rResId ) rResId.SetRT( RSC_MENU ); GetRes( rResId ); - ULONG nObjMask = ReadLongRes(); + sal_uLong nObjMask = ReadLongRes(); if( nObjMask & RSC_MENU_ITEMS ) { - ULONG nObjFollows = ReadLongRes(); + sal_uLong nObjFollows = ReadLongRes(); // MenuItems einfuegen - for( ULONG i = 0; i < nObjFollows; i++ ) + for( sal_uLong i = 0; i < nObjFollows; i++ ) { InsertItem( ResId( (RSHEADER_TYPE*)GetClassRes(), *pMgr ) ); IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); @@ -1016,13 +1016,13 @@ void Menu::ImplLoadRes( const ResId& rResId ) aTitleText = ReadStringRes(); } if( nObjMask & RSC_MENU_DEFAULTITEMID ) - SetDefaultItem( sal::static_int_cast<USHORT>(ReadLongRes()) ); + SetDefaultItem( sal::static_int_cast<sal_uInt16>(ReadLongRes()) ); } void Menu::CreateAutoMnemonics() { MnemonicGenerator aMnemonicGenerator; - ULONG n; + sal_uLong n; for ( n = 0; n < pItemList->Count(); n++ ) { MenuItemData* pData = pItemList->GetDataFromPos(n); @@ -1039,7 +1039,7 @@ void Menu::CreateAutoMnemonics() void Menu::Activate() { - bInCallback = TRUE; + bInCallback = sal_True; ImplMenuDelData aDelData( this ); @@ -1054,27 +1054,27 @@ void Menu::Activate() Menu* pStartMenu = ImplGetStartMenu(); if ( pStartMenu && ( pStartMenu != this ) ) { - pStartMenu->bInCallback = TRUE; + pStartMenu->bInCallback = sal_True; // MT 11/01: Call EventListener here? I don't know... pStartMenu->aActivateHdl.Call( this ); - pStartMenu->bInCallback = FALSE; + pStartMenu->bInCallback = sal_False; } } } - bInCallback = FALSE; + bInCallback = sal_False; } } void Menu::Deactivate() { - for ( USHORT n = (USHORT)pItemList->Count(); n; ) + for ( sal_uInt16 n = (sal_uInt16)pItemList->Count(); n; ) { MenuItemData* pData = pItemList->GetDataFromPos( --n ); if ( pData->bIsTemporary ) pItemList->Remove( n ); } - bInCallback = TRUE; + bInCallback = sal_True; ImplMenuDelData aDelData( this ); @@ -1089,9 +1089,9 @@ void Menu::Deactivate() { if ( pStartMenu && ( pStartMenu != this ) ) { - pStartMenu->bInCallback = TRUE; + pStartMenu->bInCallback = sal_True; pStartMenu->aDeactivateHdl.Call( this ); - pStartMenu->bInCallback = FALSE; + pStartMenu->bInCallback = sal_False; } } } @@ -1099,7 +1099,7 @@ void Menu::Deactivate() if( !aDelData.isDeleted() ) { - bInCallback = FALSE; + bInCallback = sal_False; } } @@ -1120,11 +1120,11 @@ void Menu::ImplSelect() MenuItemData* pData = GetItemList()->GetData( nSelectedId ); if ( pData && (pData->nBits & MIB_AUTOCHECK) ) { - BOOL bChecked = IsItemChecked( nSelectedId ); + sal_Bool bChecked = IsItemChecked( nSelectedId ); if ( pData->nBits & MIB_RADIOCHECK ) { if ( !bChecked ) - CheckItem( nSelectedId, TRUE ); + CheckItem( nSelectedId, sal_True ); } else CheckItem( nSelectedId, !bChecked ); @@ -1170,7 +1170,7 @@ void Menu::RequestHelp( const HelpEvent& ) { } -void Menu::ImplCallEventListeners( ULONG nEvent, USHORT nPos ) +void Menu::ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos ) { ImplMenuDelData aDelData( this ); @@ -1224,14 +1224,14 @@ void Menu::RemoveEventListener( const Link& rEventListener ) // mpDummy4_WindowChildEventListeners->remove( rEventListener ); //} -void Menu::InsertItem( USHORT nItemId, const XubString& rStr, MenuItemBits nItemBits, USHORT nPos ) +void Menu::InsertItem( sal_uInt16 nItemId, const XubString& rStr, MenuItemBits nItemBits, sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "Menu::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == MENU_ITEM_NOTFOUND, "Menu::InsertItem(): ItemId already exists" ); // if Position > ItemCount, append - if ( nPos >= (USHORT)pItemList->Count() ) + if ( nPos >= (sal_uInt16)pItemList->Count() ) nPos = MENU_APPEND; // put Item in MenuItemList @@ -1253,39 +1253,39 @@ void Menu::InsertItem( USHORT nItemId, const XubString& rStr, MenuItemBits nItem ImplCallEventListeners( VCLEVENT_MENU_INSERTITEM, nPos ); } -void Menu::InsertItem( USHORT nItemId, const Image& rImage, - MenuItemBits nItemBits, USHORT nPos ) +void Menu::InsertItem( sal_uInt16 nItemId, const Image& rImage, + MenuItemBits nItemBits, sal_uInt16 nPos ) { InsertItem( nItemId, ImplGetSVEmptyStr(), nItemBits, nPos ); SetItemImage( nItemId, rImage ); } -void Menu::InsertItem( USHORT nItemId, +void Menu::InsertItem( sal_uInt16 nItemId, const XubString& rStr, const Image& rImage, - MenuItemBits nItemBits, USHORT nPos ) + MenuItemBits nItemBits, sal_uInt16 nPos ) { InsertItem( nItemId, rStr, nItemBits, nPos ); SetItemImage( nItemId, rImage ); } -void Menu::InsertItem( const ResId& rResId, USHORT nPos ) +void Menu::InsertItem( const ResId& rResId, sal_uInt16 nPos ) { ResMgr* pMgr = rResId.GetResMgr(); if( ! pMgr ) return; - ULONG nObjMask; + sal_uLong nObjMask; GetRes( rResId.SetRT( RSC_MENUITEM ) ); nObjMask = ReadLongRes(); - BOOL bSep = FALSE; + sal_Bool bSep = sal_False; if ( nObjMask & RSC_MENUITEM_SEPARATOR ) - bSep = (BOOL)ReadShortRes(); + bSep = (sal_Bool)ReadShortRes(); - USHORT nItemId = 1; + sal_uInt16 nItemId = 1; if ( nObjMask & RSC_MENUITEM_ID ) - nItemId = sal::static_int_cast<USHORT>(ReadLongRes()); + nItemId = sal::static_int_cast<sal_uInt16>(ReadLongRes()); MenuItemBits nStatus = 0; if ( nObjMask & RSC_MENUITEM_STATUS ) @@ -1321,15 +1321,14 @@ void Menu::InsertItem( const ResId& rResId, USHORT nPos ) SetHelpText( nItemId, aHelpText ); } - ULONG nHelpId = 0; if ( nObjMask & RSC_MENUITEM_HELPID ) { - nHelpId = ReadLongRes(); + rtl::OString aHelpId( ReadByteStringRes() ); if ( !bSep ) - SetHelpId( nItemId, nHelpId ); + SetHelpId( nItemId, aHelpId ); } - if( !bSep /* && SvHelpSettings::HelpText( aHelpText, nHelpId ) */ ) + if( !bSep ) SetHelpText( nItemId, aHelpText ); if ( nObjMask & RSC_MENUITEM_KEYCODE ) @@ -1341,12 +1340,12 @@ void Menu::InsertItem( const ResId& rResId, USHORT nPos ) if( nObjMask & RSC_MENUITEM_CHECKED ) { if ( !bSep ) - CheckItem( nItemId, (BOOL)ReadShortRes() ); + CheckItem( nItemId, (sal_Bool)ReadShortRes() ); } if ( nObjMask & RSC_MENUITEM_DISABLE ) { if ( !bSep ) - EnableItem( nItemId, !(BOOL)ReadShortRes() ); + EnableItem( nItemId, !(sal_Bool)ReadShortRes() ); } if ( nObjMask & RSC_MENUITEM_COMMAND ) { @@ -1373,21 +1372,21 @@ void Menu::InsertItem( const ResId& rResId, USHORT nPos ) delete mpLayoutData, mpLayoutData = NULL; } -void Menu::InsertSeparator( USHORT nPos ) +void Menu::InsertSeparator( sal_uInt16 nPos ) { // do nothing if its a menu bar if ( bIsMenuBar ) return; // if position > ItemCount, append - if ( nPos >= (USHORT)pItemList->Count() ) + if ( nPos >= (sal_uInt16)pItemList->Count() ) nPos = MENU_APPEND; // put separator in item list pItemList->InsertSeparator( nPos ); // update native menu - USHORT itemPos = nPos != MENU_APPEND ? nPos : (USHORT)pItemList->Count() - 1; + sal_uInt16 itemPos = nPos != MENU_APPEND ? nPos : (sal_uInt16)pItemList->Count() - 1; MenuItemData *pData = pItemList->GetDataFromPos( itemPos ); if( ImplGetSalMenu() && pData && pData->pSalMenuItem ) ImplGetSalMenu()->InsertItem( pData->pSalMenuItem, nPos ); @@ -1397,9 +1396,9 @@ void Menu::InsertSeparator( USHORT nPos ) ImplCallEventListeners( VCLEVENT_MENU_INSERTITEM, nPos ); } -void Menu::RemoveItem( USHORT nPos ) +void Menu::RemoveItem( sal_uInt16 nPos ) { - BOOL bRemove = FALSE; + sal_Bool bRemove = sal_False; if ( nPos < GetItemCount() ) { @@ -1408,7 +1407,7 @@ void Menu::RemoveItem( USHORT nPos ) ImplGetSalMenu()->RemoveItem( nPos ); pItemList->Remove( nPos ); - bRemove = TRUE; + bRemove = sal_True; } Window* pWin = ImplGetWindow(); @@ -1424,8 +1423,8 @@ void Menu::RemoveItem( USHORT nPos ) ImplCallEventListeners( VCLEVENT_MENU_REMOVEITEM, nPos ); } -void ImplCopyItem( Menu* pThis, const Menu& rMenu, USHORT nPos, USHORT nNewPos, - USHORT nMode = 0 ) +void ImplCopyItem( Menu* pThis, const Menu& rMenu, sal_uInt16 nPos, sal_uInt16 nNewPos, + sal_uInt16 nMode = 0 ) { MenuItemType eType = rMenu.GetItemType( nPos ); @@ -1436,7 +1435,7 @@ void ImplCopyItem( Menu* pThis, const Menu& rMenu, USHORT nPos, USHORT nNewPos, pThis->InsertSeparator( nNewPos ); else { - USHORT nId = rMenu.GetItemId( nPos ); + sal_uInt16 nId = rMenu.GetItemId( nPos ); DBG_ASSERT( pThis->GetItemPos( nId ) == MENU_ITEM_NOTFOUND, "Menu::CopyItem(): ItemId already exists" ); @@ -1451,10 +1450,10 @@ void ImplCopyItem( Menu* pThis, const Menu& rMenu, USHORT nPos, USHORT nNewPos, pThis->InsertItem( nId, pData->aImage, pData->nBits, nNewPos ); if ( rMenu.IsItemChecked( nId ) ) - pThis->CheckItem( nId, TRUE ); + pThis->CheckItem( nId, sal_True ); if ( !rMenu.IsItemEnabled( nId ) ) - pThis->EnableItem( nId, FALSE ); - pThis->SetHelpId( nId, pData->nHelpId ); + pThis->EnableItem( nId, sal_False ); + pThis->SetHelpId( nId, pData->aHelpId ); pThis->SetHelpText( nId, pData->aHelpText ); pThis->SetAccelKey( nId, pData->aAccelKey ); pThis->SetItemCommand( nId, pData->aCommandStr ); @@ -1476,26 +1475,26 @@ void ImplCopyItem( Menu* pThis, const Menu& rMenu, USHORT nPos, USHORT nNewPos, } } -void Menu::CopyItem( const Menu& rMenu, USHORT nPos, USHORT nNewPos ) +void Menu::CopyItem( const Menu& rMenu, sal_uInt16 nPos, sal_uInt16 nNewPos ) { ImplCopyItem( this, rMenu, nPos, nNewPos ); } void Menu::Clear() { - for ( USHORT i = GetItemCount(); i; i-- ) + for ( sal_uInt16 i = GetItemCount(); i; i-- ) RemoveItem( 0 ); } -USHORT Menu::GetItemCount() const +sal_uInt16 Menu::GetItemCount() const { - return (USHORT)pItemList->Count(); + return (sal_uInt16)pItemList->Count(); } -USHORT Menu::ImplGetVisibleItemCount() const +sal_uInt16 Menu::ImplGetVisibleItemCount() const { - USHORT nItems = 0; - for ( USHORT n = (USHORT)pItemList->Count(); n; ) + sal_uInt16 nItems = 0; + for ( sal_uInt16 n = (sal_uInt16)pItemList->Count(); n; ) { if ( ImplIsVisible( --n ) ) nItems++; @@ -1503,9 +1502,9 @@ USHORT Menu::ImplGetVisibleItemCount() const return nItems; } -USHORT Menu::ImplGetFirstVisible() const +sal_uInt16 Menu::ImplGetFirstVisible() const { - for ( USHORT n = 0; n < pItemList->Count(); n++ ) + for ( sal_uInt16 n = 0; n < pItemList->Count(); n++ ) { if ( ImplIsVisible( n ) ) return n; @@ -1513,9 +1512,9 @@ USHORT Menu::ImplGetFirstVisible() const return ITEMPOS_INVALID; } -USHORT Menu::ImplGetPrevVisible( USHORT nPos ) const +sal_uInt16 Menu::ImplGetPrevVisible( sal_uInt16 nPos ) const { - for ( USHORT n = nPos; n; ) + for ( sal_uInt16 n = nPos; n; ) { if ( n && ImplIsVisible( --n ) ) return n; @@ -1523,9 +1522,9 @@ USHORT Menu::ImplGetPrevVisible( USHORT nPos ) const return ITEMPOS_INVALID; } -USHORT Menu::ImplGetNextVisible( USHORT nPos ) const +sal_uInt16 Menu::ImplGetNextVisible( sal_uInt16 nPos ) const { - for ( USHORT n = nPos+1; n < pItemList->Count(); n++ ) + for ( sal_uInt16 n = nPos+1; n < pItemList->Count(); n++ ) { if ( ImplIsVisible( n ) ) return n; @@ -1533,7 +1532,7 @@ USHORT Menu::ImplGetNextVisible( USHORT nPos ) const return ITEMPOS_INVALID; } -USHORT Menu::GetItemId( USHORT nPos ) const +sal_uInt16 Menu::GetItemId( sal_uInt16 nPos ) const { MenuItemData* pData = pItemList->GetDataFromPos( nPos ); @@ -1543,9 +1542,9 @@ USHORT Menu::GetItemId( USHORT nPos ) const return 0; } -USHORT Menu::GetItemPos( USHORT nItemId ) const +sal_uInt16 Menu::GetItemPos( sal_uInt16 nItemId ) const { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); if ( pData ) @@ -1554,7 +1553,7 @@ USHORT Menu::GetItemPos( USHORT nItemId ) const return MENU_ITEM_NOTFOUND; } -MenuItemType Menu::GetItemType( USHORT nPos ) const +MenuItemType Menu::GetItemType( sal_uInt16 nPos ) const { MenuItemData* pData = pItemList->GetDataFromPos( nPos ); @@ -1564,19 +1563,19 @@ MenuItemType Menu::GetItemType( USHORT nPos ) const return MENUITEM_DONTKNOW; } -USHORT Menu::GetCurItemId() const +sal_uInt16 Menu::GetCurItemId() const { return nSelectedId; } -void Menu::SetItemBits( USHORT nItemId, MenuItemBits nBits ) +void Menu::SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits ) { MenuItemData* pData = pItemList->GetData( nItemId ); if ( pData ) pData->nBits = nBits; } -MenuItemBits Menu::GetItemBits( USHORT nItemId ) const +MenuItemBits Menu::GetItemBits( sal_uInt16 nItemId ) const { MenuItemBits nBits = 0; MenuItemData* pData = pItemList->GetData( nItemId ); @@ -1585,22 +1584,22 @@ MenuItemBits Menu::GetItemBits( USHORT nItemId ) const return nBits; } -void Menu::SetUserValue( USHORT nItemId, ULONG nValue ) +void Menu::SetUserValue( sal_uInt16 nItemId, sal_uLong nValue ) { MenuItemData* pData = pItemList->GetData( nItemId ); if ( pData ) pData->nUserValue = nValue; } -ULONG Menu::GetUserValue( USHORT nItemId ) const +sal_uLong Menu::GetUserValue( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); return pData ? pData->nUserValue : 0; } -void Menu::SetPopupMenu( USHORT nItemId, PopupMenu* pMenu ) +void Menu::SetPopupMenu( sal_uInt16 nItemId, PopupMenu* pMenu ) { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); // Item does not exist -> return NULL @@ -1630,7 +1629,7 @@ void Menu::SetPopupMenu( USHORT nItemId, PopupMenu* pMenu ) ImplCallEventListeners( VCLEVENT_MENU_SUBMENUCHANGED, nPos ); } -PopupMenu* Menu::GetPopupMenu( USHORT nItemId ) const +PopupMenu* Menu::GetPopupMenu( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -1640,9 +1639,9 @@ PopupMenu* Menu::GetPopupMenu( USHORT nItemId ) const return NULL; } -void Menu::SetAccelKey( USHORT nItemId, const KeyCode& rKeyCode ) +void Menu::SetAccelKey( sal_uInt16 nItemId, const KeyCode& rKeyCode ) { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); if ( !pData ) @@ -1658,7 +1657,7 @@ void Menu::SetAccelKey( USHORT nItemId, const KeyCode& rKeyCode ) ImplGetSalMenu()->SetAccelerator( nPos, pData->pSalMenuItem, rKeyCode, rKeyCode.GetName() ); } -KeyCode Menu::GetAccelKey( USHORT nItemId ) const +KeyCode Menu::GetAccelKey( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -1668,16 +1667,16 @@ KeyCode Menu::GetAccelKey( USHORT nItemId ) const return KeyCode(); } -KeyEvent Menu::GetActivationKey( USHORT nItemId ) const +KeyEvent Menu::GetActivationKey( sal_uInt16 nItemId ) const { KeyEvent aRet; MenuItemData* pData = pItemList->GetData( nItemId ); if( pData ) { - USHORT nPos = pData->aText.Search( '~' ); + sal_uInt16 nPos = pData->aText.Search( '~' ); if( nPos != STRING_NOTFOUND && nPos < pData->aText.Len()-1 ) { - USHORT nCode = 0; + sal_uInt16 nCode = 0; sal_Unicode cAccel = pData->aText.GetChar( nPos+1 ); if( cAccel >= 'a' && cAccel <= 'z' ) nCode = KEY_A + (cAccel-'a'); @@ -1693,9 +1692,9 @@ KeyEvent Menu::GetActivationKey( USHORT nItemId ) const return aRet; } -void Menu::CheckItem( USHORT nItemId, BOOL bCheck ) +void Menu::CheckItem( sal_uInt16 nItemId, sal_Bool bCheck ) { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); if ( !pData || pData->bChecked == bCheck ) @@ -1706,9 +1705,9 @@ void Menu::CheckItem( USHORT nItemId, BOOL bCheck ) (pData->nBits & MIB_RADIOCHECK) ) { MenuItemData* pGroupData; - USHORT nGroupPos; - USHORT nItemCount = GetItemCount(); - BOOL bFound = FALSE; + sal_uInt16 nGroupPos; + sal_uInt16 nItemCount = GetItemCount(); + sal_Bool bFound = sal_False; nGroupPos = nPos; while ( nGroupPos ) @@ -1718,8 +1717,8 @@ void Menu::CheckItem( USHORT nItemId, BOOL bCheck ) { if ( IsItemChecked( pGroupData->nId ) ) { - CheckItem( pGroupData->nId, FALSE ); - bFound = TRUE; + CheckItem( pGroupData->nId, sal_False ); + bFound = sal_True; break; } } @@ -1738,7 +1737,7 @@ void Menu::CheckItem( USHORT nItemId, BOOL bCheck ) { if ( IsItemChecked( pGroupData->nId ) ) { - CheckItem( pGroupData->nId, FALSE ); + CheckItem( pGroupData->nId, sal_False ); break; } } @@ -1758,20 +1757,20 @@ void Menu::CheckItem( USHORT nItemId, BOOL bCheck ) ImplCallEventListeners( bCheck ? VCLEVENT_MENU_ITEMCHECKED : VCLEVENT_MENU_ITEMUNCHECKED, nPos ); } -BOOL Menu::IsItemChecked( USHORT nItemId ) const +sal_Bool Menu::IsItemChecked( sal_uInt16 nItemId ) const { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); if ( !pData ) - return FALSE; + return sal_False; return pData->bChecked; } -void Menu::EnableItem( USHORT nItemId, BOOL bEnable ) +void Menu::EnableItem( sal_uInt16 nItemId, sal_Bool bEnable ) { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pItemData = pItemList->GetData( nItemId, nPos ); if ( pItemData && ( pItemData->bEnabled != bEnable ) ) @@ -1783,8 +1782,8 @@ void Menu::EnableItem( USHORT nItemId, BOOL bEnable ) { DBG_ASSERT( bIsMenuBar, "Menu::EnableItem - Popup visible!" ); long nX = 0; - ULONG nCount = pItemList->Count(); - for ( ULONG n = 0; n < nCount; n++ ) + sal_uLong nCount = pItemList->Count(); + for ( sal_uLong n = 0; n < nCount; n++ ) { MenuItemData* pData = pItemList->GetDataFromPos( n ); if ( n == nPos ) @@ -1803,20 +1802,20 @@ void Menu::EnableItem( USHORT nItemId, BOOL bEnable ) } } -BOOL Menu::IsItemEnabled( USHORT nItemId ) const +sal_Bool Menu::IsItemEnabled( sal_uInt16 nItemId ) const { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); if ( !pData ) - return FALSE; + return sal_False; return pData->bEnabled; } -void Menu::ShowItem( USHORT nItemId, BOOL bVisible ) +void Menu::ShowItem( sal_uInt16 nItemId, sal_Bool bVisible ) { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); DBG_ASSERT( !bIsMenuBar, "Menu::ShowItem - ignored for menu bar entries!" ); @@ -1838,9 +1837,9 @@ void Menu::ShowItem( USHORT nItemId, BOOL bVisible ) } } -void Menu::SetItemText( USHORT nItemId, const XubString& rStr ) +void Menu::SetItemText( sal_uInt16 nItemId, const XubString& rStr ) { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); if ( !pData ) @@ -1867,9 +1866,9 @@ void Menu::SetItemText( USHORT nItemId, const XubString& rStr ) } } -XubString Menu::GetItemText( USHORT nItemId ) const +XubString Menu::GetItemText( sal_uInt16 nItemId ) const { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); if ( pData ) @@ -1878,9 +1877,9 @@ XubString Menu::GetItemText( USHORT nItemId ) const return ImplGetSVEmptyStr(); } -void Menu::SetItemImage( USHORT nItemId, const Image& rImage ) +void Menu::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); if ( !pData ) @@ -1904,9 +1903,9 @@ static inline Image ImplRotImage( const Image& rImage, long nAngle10 ) return Image( aBmpEx ); } -void Menu::SetItemImageAngle( USHORT nItemId, long nAngle10 ) +void Menu::SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 ) { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); if ( pData ) @@ -1931,9 +1930,9 @@ static inline Image ImplMirrorImage( const Image& rImage ) return Image( aBmpEx ); } -void Menu::SetItemImageMirrorMode( USHORT nItemId, BOOL bMirror ) +void Menu::SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror ) { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); if ( pData ) @@ -1949,7 +1948,7 @@ void Menu::SetItemImageMirrorMode( USHORT nItemId, BOOL bMirror ) } } -Image Menu::GetItemImage( USHORT nItemId ) const +Image Menu::GetItemImage( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -1959,7 +1958,7 @@ Image Menu::GetItemImage( USHORT nItemId ) const return Image(); } -long Menu::GetItemImageAngle( USHORT nItemId ) const +long Menu::GetItemImageAngle( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -1969,17 +1968,17 @@ long Menu::GetItemImageAngle( USHORT nItemId ) const return 0; } -BOOL Menu::GetItemImageMirrorMode( USHORT nItemId ) const +sal_Bool Menu::GetItemImageMirrorMode( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); if ( pData ) return pData->bMirrorMode; else - return FALSE; + return sal_False; } -void Menu::SetItemCommand( USHORT nItemId, const String& rCommand ) +void Menu::SetItemCommand( sal_uInt16 nItemId, const String& rCommand ) { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -1987,7 +1986,7 @@ void Menu::SetItemCommand( USHORT nItemId, const String& rCommand ) pData->aCommandStr = rCommand; } -const XubString& Menu::GetItemCommand( USHORT nItemId ) const +const XubString& Menu::GetItemCommand( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -1997,7 +1996,7 @@ const XubString& Menu::GetItemCommand( USHORT nItemId ) const return ImplGetSVEmptyStr(); } -void Menu::SetHelpCommand( USHORT nItemId, const XubString& rStr ) +void Menu::SetHelpCommand( sal_uInt16 nItemId, const XubString& rStr ) { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -2005,7 +2004,7 @@ void Menu::SetHelpCommand( USHORT nItemId, const XubString& rStr ) pData->aHelpCommandStr = rStr; } -const XubString& Menu::GetHelpCommand( USHORT nItemId ) const +const XubString& Menu::GetHelpCommand( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -2015,7 +2014,7 @@ const XubString& Menu::GetHelpCommand( USHORT nItemId ) const return ImplGetSVEmptyStr(); } -void Menu::SetHelpText( USHORT nItemId, const XubString& rStr ) +void Menu::SetHelpText( sal_uInt16 nItemId, const XubString& rStr ) { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -2023,14 +2022,14 @@ void Menu::SetHelpText( USHORT nItemId, const XubString& rStr ) pData->aHelpText = rStr; } -const XubString& Menu::ImplGetHelpText( USHORT nItemId ) const +const XubString& Menu::ImplGetHelpText( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); if ( pData ) { if ( !pData->aHelpText.Len() && - (( pData->nHelpId ) || ( pData->aCommandStr.Len() ))) + (( pData->aHelpId.getLength() ) || ( pData->aCommandStr.Len() ))) { Help* pHelp = Application::GetHelp(); if ( pHelp ) @@ -2038,8 +2037,8 @@ const XubString& Menu::ImplGetHelpText( USHORT nItemId ) const if ( pData->aCommandStr.Len() ) pData->aHelpText = pHelp->GetHelpText( pData->aCommandStr, NULL ); - if( !pData->aHelpText.Len() && pData->nHelpId ) - pData->aHelpText = pHelp->GetHelpText( pData->nHelpId, NULL ); + if( !pData->aHelpText.Len() && pData->aHelpId.getLength() ) + pData->aHelpText = pHelp->GetHelpText( rtl::OStringToOUString( pData->aHelpId, RTL_TEXTENCODING_UTF8 ), NULL ); } } @@ -2049,12 +2048,12 @@ const XubString& Menu::ImplGetHelpText( USHORT nItemId ) const return ImplGetSVEmptyStr(); } -const XubString& Menu::GetHelpText( USHORT nItemId ) const +const XubString& Menu::GetHelpText( sal_uInt16 nItemId ) const { return ImplGetHelpText( nItemId ); } -void Menu::SetTipHelpText( USHORT nItemId, const XubString& rStr ) +void Menu::SetTipHelpText( sal_uInt16 nItemId, const XubString& rStr ) { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -2062,7 +2061,7 @@ void Menu::SetTipHelpText( USHORT nItemId, const XubString& rStr ) pData->aTipHelpText = rStr; } -const XubString& Menu::GetTipHelpText( USHORT nItemId ) const +const XubString& Menu::GetTipHelpText( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -2072,22 +2071,29 @@ const XubString& Menu::GetTipHelpText( USHORT nItemId ) const return ImplGetSVEmptyStr(); } -void Menu::SetHelpId( USHORT nItemId, ULONG nHelpId ) +void Menu::SetHelpId( sal_uInt16 nItemId, const rtl::OString& rHelpId ) { MenuItemData* pData = pItemList->GetData( nItemId ); if ( pData ) - pData->nHelpId = nHelpId; + pData->aHelpId = rHelpId; } -ULONG Menu::GetHelpId( USHORT nItemId ) const +rtl::OString Menu::GetHelpId( sal_uInt16 nItemId ) const { + rtl::OString aRet; + MenuItemData* pData = pItemList->GetData( nItemId ); if ( pData ) - return pData->nHelpId; - else - return 0; + { + if ( pData->aHelpId.getLength() ) + aRet = pData->aHelpId; + else + aRet = ::rtl::OUStringToOString( pData->aCommandStr, RTL_TEXTENCODING_UTF8 ); + } + + return aRet; } Menu& Menu::operator=( const Menu& rMenu ) @@ -2096,8 +2102,8 @@ Menu& Menu::operator=( const Menu& rMenu ) Clear(); // Items kopieren - USHORT nCount = rMenu.GetItemCount(); - for ( USHORT i = 0; i < nCount; i++ ) + sal_uInt16 nCount = rMenu.GetItemCount(); + for ( sal_uInt16 i = 0; i < nCount; i++ ) ImplCopyItem( this, rMenu, i, MENU_APPEND, 1 ); nDefaultItem = rMenu.nDefaultItem; @@ -2111,24 +2117,24 @@ Menu& Menu::operator=( const Menu& rMenu ) return *this; } -BOOL Menu::ImplIsVisible( USHORT nPos ) const +sal_Bool Menu::ImplIsVisible( sal_uInt16 nPos ) const { - BOOL bVisible = TRUE; + sal_Bool bVisible = sal_True; MenuItemData* pData = pItemList->GetDataFromPos( nPos ); // check general visibility first if( pData && !pData->bVisible ) - bVisible = FALSE; + bVisible = sal_False; if ( bVisible && pData && pData->eType == MENUITEM_SEPARATOR ) { if( nPos == 0 ) // no separator should be shown at the very beginning - bVisible = FALSE; + bVisible = sal_False; else { // always avoid adjacent separators - USHORT nCount = (USHORT) pItemList->Count(); - USHORT n; + sal_uInt16 nCount = (sal_uInt16) pItemList->Count(); + sal_uInt16 n; MenuItemData* pNextData = NULL; // search next visible item for( n = nPos + 1; n < nCount; n++ ) @@ -2141,10 +2147,10 @@ BOOL Menu::ImplIsVisible( USHORT nPos ) const } } if( n == nCount ) // no next visible item - bVisible = FALSE; + bVisible = sal_False; // check for separator if( pNextData && pNextData->bVisible && pNextData->eType == MENUITEM_SEPARATOR ) - bVisible = FALSE; + bVisible = sal_False; if( bVisible ) { @@ -2158,7 +2164,7 @@ BOOL Menu::ImplIsVisible( USHORT nPos ) const } } if( n == 0 ) // no previous visible item - bVisible = FALSE; + bVisible = sal_False; } } } @@ -2169,10 +2175,10 @@ BOOL Menu::ImplIsVisible( USHORT nPos ) const !( nMenuFlags & MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES ) ) { if( !pData ) // e.g. nPos == ITEMPOS_INVALID - bVisible = FALSE; + bVisible = sal_False; else if ( pData->eType != MENUITEM_SEPARATOR ) // separators handled above { - // bVisible = pData->bEnabled && ( !pData->pSubMenu || pData->pSubMenu->HasValidEntries( TRUE ) ); + // bVisible = pData->bEnabled && ( !pData->pSubMenu || pData->pSubMenu->HasValidEntries( sal_True ) ); bVisible = pData->bEnabled; // SubMenus nicht pruefen, weil sie ggf. erst im Activate() gefuellt werden. } } @@ -2180,34 +2186,34 @@ BOOL Menu::ImplIsVisible( USHORT nPos ) const return bVisible; } -BOOL Menu::IsItemVisible( USHORT nItemId ) const +sal_Bool Menu::IsItemVisible( sal_uInt16 nItemId ) const { return IsMenuVisible() && ImplIsVisible( GetItemPos( nItemId ) ); } -BOOL Menu::IsItemPosVisible( USHORT nItemPos ) const +sal_Bool Menu::IsItemPosVisible( sal_uInt16 nItemPos ) const { return IsMenuVisible() && ImplIsVisible( nItemPos ); } -BOOL Menu::IsMenuVisible() const +sal_Bool Menu::IsMenuVisible() const { return pWindow && pWindow->IsReallyVisible(); } -BOOL Menu::ImplIsSelectable( USHORT nPos ) const +sal_Bool Menu::ImplIsSelectable( sal_uInt16 nPos ) const { - BOOL bSelectable = TRUE; + sal_Bool bSelectable = sal_True; MenuItemData* pData = pItemList->GetDataFromPos( nPos ); // check general visibility first if ( pData && ( pData->nBits & MIB_NOSELECT ) ) - bSelectable = FALSE; + bSelectable = sal_False; return bSelectable; } -void Menu::SelectItem( USHORT nItemId ) +void Menu::SelectItem( sal_uInt16 nItemId ) { if( bIsMenuBar ) static_cast<MenuBar*>(this)->SelectEntry( nItemId ); @@ -2362,7 +2368,7 @@ Size Menu::ImplCalcSize( Window* pWin ) if ( rSettings.GetUseImagesInMenus() ) { nMinMenuItemHeight = 16; - for ( USHORT i = (USHORT)pItemList->Count(); i; ) + for ( sal_uInt16 i = (sal_uInt16)pItemList->Count(); i; ) { MenuItemData* pData = pItemList->GetDataFromPos( --i ); if ( ImplIsVisible( i ) && (( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ))) @@ -2380,7 +2386,7 @@ Size Menu::ImplCalcSize( Window* pWin ) } } - for ( USHORT n = (USHORT)pItemList->Count(); n; ) + for ( sal_uInt16 n = (sal_uInt16)pItemList->Count(); n; ) { MenuItemData* pData = pItemList->GetDataFromPos( --n ); @@ -2478,8 +2484,18 @@ Size Menu::ImplCalcSize( Window* pWin ) if ( !bIsMenuBar ) { - USHORT gfxExtra = (USHORT) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text - nCheckPos = (USHORT)nExtra; + // popup menus should not be wider than half the screen + // except on rather small screens + // TODO: move GetScreenNumber from SystemWindow to Window ? + // currently we rely on internal privileges + unsigned int nScreenNumber = pWin->ImplGetWindowImpl()->mpFrame->maGeometry.nScreenNumber; + Rectangle aDispRect( Application::GetScreenPosSizePixel( nScreenNumber ) ); + long nScreenWidth = aDispRect.GetWidth() >= 800 ? aDispRect.GetWidth() : 800; + if( nMaxWidth > nScreenWidth/2 ) + nMaxWidth = nScreenWidth/2; + + sal_uInt16 gfxExtra = (sal_uInt16) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text + nCheckPos = (sal_uInt16)nExtra; if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox ) { long nImgOrChkWidth = 0; @@ -2489,12 +2505,12 @@ Size Menu::ImplCalcSize( Window* pWin ) else // non NWF case nImgOrChkWidth = nFontHeight/2 + gfxExtra; nImgOrChkWidth = Max( nImgOrChkWidth, aMaxImgSz.Width() + gfxExtra ); - nTextPos = (USHORT)(nImagePos + nImgOrChkWidth); + nTextPos = (sal_uInt16)(nImagePos + nImgOrChkWidth); } else { nImagePos = nCheckPos; - nTextPos = (USHORT)(nImagePos + Max( aMaxImgSz.Width(), nCheckWidth )); + nTextPos = (sal_uInt16)(nImagePos + Max( aMaxImgSz.Width(), nCheckWidth )); } nTextPos = nTextPos + gfxExtra; @@ -2507,7 +2523,7 @@ Size Menu::ImplCalcSize( Window* pWin ) } else { - nTextPos = (USHORT)(2*nExtra); + nTextPos = (sal_uInt16)(2*nExtra); aSz.Height() = nFontHeight+6; // get menubar height from native methods if supported @@ -2549,7 +2565,7 @@ Size Menu::ImplCalcSize( Window* pWin ) static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRect, bool i_bHighlight ) { - BOOL bNativeOk = FALSE; + sal_Bool bNativeOk = sal_False; if( i_pWindow->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) { ImplControlValue aControlValue; @@ -2567,11 +2583,31 @@ static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRec { 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 ); + i_pWindow->DrawSelectionBackground( i_rRect, 0, i_bHighlight, sal_True, sal_False, 2, NULL, &aColor ); + } +} + +static String getShortenedString( const String& i_rLong, Window* i_pWin, long i_nMaxWidth ) +{ + xub_StrLen nPos = STRING_NOTFOUND; + String aNonMnem( OutputDevice::GetNonMnemonicString( i_rLong, nPos ) ); + aNonMnem = i_pWin->GetEllipsisString( aNonMnem, i_nMaxWidth, TEXT_DRAW_CENTERELLIPSIS ); + // re-insert mnemonic + if( nPos != STRING_NOTFOUND ) + { + if( nPos < aNonMnem.Len() && i_rLong.GetChar(nPos+1) == aNonMnem.GetChar(nPos) ) + { + rtl::OUStringBuffer aBuf( i_rLong.Len() ); + aBuf.append( aNonMnem.GetBuffer(), nPos ); + aBuf.append( sal_Unicode('~') ); + aBuf.append( aNonMnem.GetBuffer()+nPos ); + aNonMnem = aBuf.makeStringAndClear(); + } } + return aNonMnem; } -void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* pThisItemOnly, BOOL bHighlighted, bool bLayout ) const +void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemData* pThisItemOnly, sal_Bool bHighlighted, bool bLayout ) const { // Fuer Symbole: nFontHeight x nFontHeight long nFontHeight = pWin->GetTextHeight(); @@ -2597,10 +2633,10 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* } Size aOutSz = pWin->GetOutputSizePixel(); - USHORT nCount = (USHORT)pItemList->Count(); + sal_uInt16 nCount = (sal_uInt16)pItemList->Count(); if( bLayout ) mpLayoutData->m_aVisibleItemBoundRects.clear(); - for ( USHORT n = 0; n < nCount; n++ ) + for ( sal_uInt16 n = 0; n < nCount; n++ ) { MenuItemData* pData = pItemList->GetDataFromPos( n ); if ( ImplIsVisible( n ) && ( !pThisItemOnly || ( pData == pThisItemOnly ) ) ) @@ -2617,9 +2653,9 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* long nTextOffsetY = ((pData->aSz.Height()-nFontHeight)/2); if( bIsMenuBar ) nTextOffsetY += (aOutSz.Height()-pData->aSz.Height()) / 2; - USHORT nTextStyle = 0; - USHORT nSymbolStyle = 0; - USHORT nImageStyle = 0; + sal_uInt16 nTextStyle = 0; + sal_uInt16 nSymbolStyle = 0; + sal_uInt16 nImageStyle = 0; // SubMenus ohne Items werden nicht mehr disablte dargestellt, // wenn keine Items enthalten sind, da die Anwendung selber // darauf achten muss. Ansonsten gibt es Faelle, wo beim @@ -2634,14 +2670,36 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* // Separator if ( !bLayout && !bIsMenuBar && ( pData->eType == MENUITEM_SEPARATOR ) ) { - aTmpPos.Y() = aPos.Y() + ((pData->aSz.Height()-2)/2); - aTmpPos.X() = aPos.X() + 2 + nOuterSpace; - pWin->SetLineColor( rSettings.GetShadowColor() ); - pWin->DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) ); - aTmpPos.Y()++; - pWin->SetLineColor( rSettings.GetLightColor() ); - pWin->DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) ); - pWin->SetLineColor(); + bool bNativeOk = false; + if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, + PART_MENU_SEPARATOR ) ) + { + ControlState nState = 0; + if ( pData->bEnabled ) + nState |= CTRL_STATE_ENABLED; + if ( bHighlighted ) + nState |= CTRL_STATE_SELECTED; + Size aSz( pData->aSz ); + aSz.Width() = aOutSz.Width() - 2*nOuterSpace; + Rectangle aItemRect( aPos, aSz ); + MenupopupValue aVal( nTextPos-GUTTERBORDER, aItemRect ); + bNativeOk = pWin->DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_SEPARATOR, + aItemRect, + nState, + aVal, + OUString() ); + } + if( ! bNativeOk ) + { + aTmpPos.Y() = aPos.Y() + ((pData->aSz.Height()-2)/2); + aTmpPos.X() = aPos.X() + 2 + nOuterSpace; + pWin->SetLineColor( rSettings.GetShadowColor() ); + pWin->DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) ); + aTmpPos.Y()++; + pWin->SetLineColor( rSettings.GetLightColor() ); + pWin->DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) ); + pWin->SetLineColor(); + } } Rectangle aOuterCheckRect( Point( aPos.X()+nCheckPos, aPos.Y() ), Size( pData->aSz.Height(), pData->aSz.Height() ) ); @@ -2686,10 +2744,11 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - nCtrlHeight)/2; Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) ); + MenupopupValue aVal( nTextPos-GUTTERBORDER, Rectangle( aPos, pData->aSz ) ); pWin->DrawNativeControl( CTRL_MENU_POPUP, nPart, aCheckRect, nState, - ImplControlValue(), + aVal, OUString() ); } else if ( pData->bChecked ) // by default do nothing for unchecked items @@ -2737,7 +2796,7 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* aTmpPos.X() = aPos.X() + nTextPos; aTmpPos.Y() = aPos.Y(); aTmpPos.Y() += nTextOffsetY; - USHORT nStyle = nTextStyle|TEXT_DRAW_MNEMONIC; + sal_uInt16 nStyle = nTextStyle|TEXT_DRAW_MNEMONIC; if ( pData->bIsTemporary ) nStyle |= TEXT_DRAW_DISABLE; MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; @@ -2761,7 +2820,19 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* pWin->GetSettings().GetStyleSettings().GetMenuColor(); pWin->SetBackground( Wallpaper( aBg ) ); } - pWin->DrawCtrlText( aTmpPos, pData->aText, 0, pData->aText.Len(), nStyle, pVector, pDisplayText ); + // how much space is there for the text ? + long nMaxItemTextWidth = aOutSz.Width() - aTmpPos.X() - nExtra - nOuterSpace; + if( !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled() ) + { + XubString aAccText = pData->aAccelKey.GetName(); + nMaxItemTextWidth -= pWin->GetTextWidth( aAccText ) + 3*nExtra; + } + if( !bIsMenuBar && pData->pSubMenu ) + { + nMaxItemTextWidth -= nFontHeight - nExtra; + } + String aItemText( getShortenedString( pData->aText, pWin, nMaxItemTextWidth ) ); + pWin->DrawCtrlText( aTmpPos, aItemText, 0, aItemText.Len(), nStyle, pVector, pDisplayText ); if( bSetTmpBackground ) pWin->SetBackground(); } @@ -2797,16 +2868,6 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* aDecoView.DrawSymbol( Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ), SYMBOL_SPIN_RIGHT, pWin->GetTextColor(), nSymbolStyle ); -// if ( pData->nBits & MIB_POPUPSELECT ) -// { -// aTmpPos.Y() += nFontHeight/2 ; -// pWin->SetLineColor( rSettings.GetShadowColor() ); -// pWin->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) ); -// pWin->SetLineColor( rSettings.GetLightColor() ); -// aTmpPos.Y()++; -// pWin->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) ); -// pWin->SetLineColor(); -// } } if ( pThisItemOnly && bHighlighted ) @@ -2869,7 +2930,7 @@ Menu* Menu::ImplGetStartMenu() return pStart; } -void Menu::ImplCallHighlight( USHORT nHighlightedItem ) +void Menu::ImplCallHighlight( sal_uInt16 nHighlightedItem ) { ImplMenuDelData aDelData( this ); @@ -2897,7 +2958,7 @@ Menu* Menu::ImplFindSelectMenu() { Menu* pSelMenu = nEventId ? this : NULL; - for ( ULONG n = GetItemList()->Count(); n && !pSelMenu; ) + for ( sal_uLong n = GetItemList()->Count(); n && !pSelMenu; ) { MenuItemData* pData = GetItemList()->GetDataFromPos( --n ); @@ -2908,11 +2969,11 @@ Menu* Menu::ImplFindSelectMenu() return pSelMenu; } -Menu* Menu::ImplFindMenu( USHORT nItemId ) +Menu* Menu::ImplFindMenu( sal_uInt16 nItemId ) { Menu* pSelMenu = NULL; - for ( ULONG n = GetItemList()->Count(); n && !pSelMenu; ) + for ( sal_uLong n = GetItemList()->Count(); n && !pSelMenu; ) { MenuItemData* pData = GetItemList()->GetDataFromPos( --n ); @@ -2925,25 +2986,25 @@ Menu* Menu::ImplFindMenu( USHORT nItemId ) return pSelMenu; } -void Menu::RemoveDisabledEntries( BOOL bCheckPopups, BOOL bRemoveEmptyPopups ) +void Menu::RemoveDisabledEntries( sal_Bool bCheckPopups, sal_Bool bRemoveEmptyPopups ) { - for ( USHORT n = 0; n < GetItemCount(); n++ ) + for ( sal_uInt16 n = 0; n < GetItemCount(); n++ ) { - BOOL bRemove = FALSE; + sal_Bool bRemove = sal_False; MenuItemData* pItem = pItemList->GetDataFromPos( n ); if ( pItem->eType == MENUITEM_SEPARATOR ) { if ( !n || ( GetItemType( n-1 ) == MENUITEM_SEPARATOR ) ) - bRemove = TRUE; + bRemove = sal_True; } else bRemove = !pItem->bEnabled; if ( bCheckPopups && pItem->pSubMenu ) { - pItem->pSubMenu->RemoveDisabledEntries( TRUE ); + pItem->pSubMenu->RemoveDisabledEntries( sal_True ); if ( bRemoveEmptyPopups && !pItem->pSubMenu->GetItemCount() ) - bRemove = TRUE; + bRemove = sal_True; } if ( bRemove ) @@ -2952,7 +3013,7 @@ void Menu::RemoveDisabledEntries( BOOL bCheckPopups, BOOL bRemoveEmptyPopups ) if ( GetItemCount() ) { - USHORT nLast = GetItemCount() - 1; + sal_uInt16 nLast = GetItemCount() - 1; MenuItemData* pItem = pItemList->GetDataFromPos( nLast ); if ( pItem->eType == MENUITEM_SEPARATOR ) RemoveItem( nLast ); @@ -2960,19 +3021,19 @@ void Menu::RemoveDisabledEntries( BOOL bCheckPopups, BOOL bRemoveEmptyPopups ) delete mpLayoutData, mpLayoutData = NULL; } -BOOL Menu::HasValidEntries( BOOL bCheckPopups ) +sal_Bool Menu::HasValidEntries( sal_Bool bCheckPopups ) { - BOOL bValidEntries = FALSE; - USHORT nCount = GetItemCount(); - for ( USHORT n = 0; !bValidEntries && ( n < nCount ); n++ ) + sal_Bool bValidEntries = sal_False; + sal_uInt16 nCount = GetItemCount(); + for ( sal_uInt16 n = 0; !bValidEntries && ( n < nCount ); n++ ) { MenuItemData* pItem = pItemList->GetDataFromPos( n ); if ( pItem->bEnabled && ( pItem->eType != MENUITEM_SEPARATOR ) ) { if ( bCheckPopups && pItem->pSubMenu ) - bValidEntries = pItem->pSubMenu->HasValidEntries( TRUE ); + bValidEntries = pItem->pSubMenu->HasValidEntries( sal_True ); else - bValidEntries = TRUE; + bValidEntries = sal_True; } } return bValidEntries; @@ -3010,12 +3071,12 @@ void Menu::ImplFillLayoutData() const mpLayoutData = new MenuLayoutData(); if( bIsMenuBar ) { - ImplPaint( pWindow, 0, 0, 0, FALSE, true ); + ImplPaint( pWindow, 0, 0, 0, sal_False, true ); } else { MenuFloatingWindow* pFloat = (MenuFloatingWindow*)pWindow; - ImplPaint( pWindow, pFloat->nScrollerHeight, pFloat->ImplGetStartY(), 0, FALSE, true ); + ImplPaint( pWindow, pFloat->nScrollerHeight, pFloat->ImplGetStartY(), 0, sal_False, true ); } } } @@ -3027,7 +3088,7 @@ String Menu::GetDisplayText() const return mpLayoutData ? mpLayoutData->m_aDisplayText : String(); } -Rectangle Menu::GetCharacterBounds( USHORT nItemID, long nIndex ) const +Rectangle Menu::GetCharacterBounds( sal_uInt16 nItemID, long nIndex ) const { long nItemIndex = -1; if( ! mpLayoutData ) @@ -3047,7 +3108,7 @@ Rectangle Menu::GetCharacterBounds( USHORT nItemID, long nIndex ) const } -long Menu::GetIndexForPoint( const Point& rPoint, USHORT& rItemID ) const +long Menu::GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const { long nIndex = -1; rItemID = 0; @@ -3085,7 +3146,7 @@ Pair Menu::GetLineStartEnd( long nLine ) const return mpLayoutData ? mpLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 ); } -Pair Menu::GetItemStartEnd( USHORT nItem ) const +Pair Menu::GetItemStartEnd( sal_uInt16 nItem ) const { if( ! mpLayoutData ) ImplFillLayoutData(); @@ -3097,9 +3158,9 @@ Pair Menu::GetItemStartEnd( USHORT nItem ) const return Pair( -1, -1 ); } -USHORT Menu::GetDisplayItemId( long nLine ) const +sal_uInt16 Menu::GetDisplayItemId( long nLine ) const { - USHORT nItemId = 0; + sal_uInt16 nItemId = 0; if( ! mpLayoutData ) ImplFillLayoutData(); if( mpLayoutData && ( nLine >= 0 ) && ( nLine < (long)mpLayoutData->m_aLineItemIds.size() ) ) @@ -3107,19 +3168,19 @@ USHORT Menu::GetDisplayItemId( long nLine ) const return nItemId; } -BOOL Menu::ConvertPoint( Point& rPoint, Window* pReferenceWindow ) const +sal_Bool Menu::ConvertPoint( Point& rPoint, Window* pReferenceWindow ) const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pWindow && pReferenceWindow ) { rPoint = pReferenceWindow->OutputToAbsoluteScreenPixel( rPoint ); rPoint = pWindow->AbsoluteScreenToOutputPixel( rPoint ); - bRet = TRUE; + bRet = sal_True; } return bRet; } -Rectangle Menu::GetBoundingRectangle( USHORT nPos ) const +Rectangle Menu::GetBoundingRectangle( sal_uInt16 nPos ) const { Rectangle aRet; @@ -3127,16 +3188,16 @@ Rectangle Menu::GetBoundingRectangle( USHORT nPos ) const ImplFillLayoutData(); if( mpLayoutData ) { - std::map< USHORT, Rectangle >::const_iterator it = mpLayoutData->m_aVisibleItemBoundRects.find( nPos ); + std::map< sal_uInt16, Rectangle >::const_iterator it = mpLayoutData->m_aVisibleItemBoundRects.find( nPos ); if( it != mpLayoutData->m_aVisibleItemBoundRects.end() ) aRet = it->second; } return aRet; } -void Menu::SetAccessibleName( USHORT nItemId, const XubString& rStr ) +void Menu::SetAccessibleName( sal_uInt16 nItemId, const XubString& rStr ) { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); if ( pData && !rStr.Equals( pData->aAccessibleName ) ) @@ -3146,7 +3207,7 @@ void Menu::SetAccessibleName( USHORT nItemId, const XubString& rStr ) } } -XubString Menu::GetAccessibleName( USHORT nItemId ) const +XubString Menu::GetAccessibleName( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -3156,7 +3217,7 @@ XubString Menu::GetAccessibleName( USHORT nItemId ) const return ImplGetSVEmptyStr(); } -void Menu::SetAccessibleDescription( USHORT nItemId, const XubString& rStr ) +void Menu::SetAccessibleDescription( sal_uInt16 nItemId, const XubString& rStr ) { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -3164,7 +3225,7 @@ void Menu::SetAccessibleDescription( USHORT nItemId, const XubString& rStr ) pData->aAccessibleDescription = rStr; } -XubString Menu::GetAccessibleDescription( USHORT nItemId ) const +XubString Menu::GetAccessibleDescription( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); @@ -3181,19 +3242,19 @@ void Menu::ImplSetSalMenu( SalMenu *pSalMenu ) mpSalMenu = pSalMenu; } -BOOL Menu::GetSystemMenuData( SystemMenuData* pData ) const +sal_Bool Menu::GetSystemMenuData( SystemMenuData* pData ) const { Menu* pMenu = (Menu*)this; if( pData && pMenu->ImplGetSalMenu() ) { pMenu->ImplGetSalMenu()->GetSystemMenuData( pData ); - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } -bool Menu::IsHighlighted( USHORT nItemPos ) const +bool Menu::IsHighlighted( sal_uInt16 nItemPos ) const { bool bRet = false; @@ -3208,19 +3269,19 @@ bool Menu::IsHighlighted( USHORT nItemPos ) const return bRet; } -void Menu::HighlightItem( USHORT nItemPos ) +void Menu::HighlightItem( sal_uInt16 nItemPos ) { if ( pWindow ) { if ( bIsMenuBar ) { MenuBarWindow* pMenuWin = static_cast< MenuBarWindow* >( pWindow ); - pMenuWin->SetAutoPopup( FALSE ); - pMenuWin->ChangeHighlightItem( nItemPos, FALSE ); + pMenuWin->SetAutoPopup( sal_False ); + pMenuWin->ChangeHighlightItem( nItemPos, sal_False ); } else { - static_cast< MenuFloatingWindow* >( pWindow )->ChangeHighlightItem( nItemPos, FALSE ); + static_cast< MenuFloatingWindow* >( pWindow )->ChangeHighlightItem( nItemPos, sal_False ); } } } @@ -3229,54 +3290,54 @@ void Menu::HighlightItem( USHORT nItemPos ) // - MenuBar - // ----------- -MenuBar::MenuBar() : Menu( TRUE ) +MenuBar::MenuBar() : Menu( sal_True ) { - mbDisplayable = TRUE; - mbCloserVisible = FALSE; - mbFloatBtnVisible = FALSE; - mbHideBtnVisible = FALSE; + mbDisplayable = sal_True; + mbCloserVisible = sal_False; + mbFloatBtnVisible = sal_False; + mbHideBtnVisible = sal_False; } -MenuBar::MenuBar( const MenuBar& rMenu ) : Menu( TRUE ) +MenuBar::MenuBar( const MenuBar& rMenu ) : Menu( sal_True ) { - mbDisplayable = TRUE; - mbCloserVisible = FALSE; - mbFloatBtnVisible = FALSE; - mbHideBtnVisible = FALSE; + mbDisplayable = sal_True; + mbCloserVisible = sal_False; + mbFloatBtnVisible = sal_False; + mbHideBtnVisible = sal_False; *this = rMenu; - bIsMenuBar = TRUE; + bIsMenuBar = sal_True; } -MenuBar::MenuBar( const ResId& rResId ) : Menu ( TRUE ) +MenuBar::MenuBar( const ResId& rResId ) : Menu ( sal_True ) { - mbDisplayable = TRUE; - mbCloserVisible = FALSE; - mbFloatBtnVisible = FALSE; - mbHideBtnVisible = FALSE; + mbDisplayable = sal_True; + mbCloserVisible = sal_False; + mbFloatBtnVisible = sal_False; + mbHideBtnVisible = sal_False; ImplLoadRes( rResId ); } MenuBar::~MenuBar() { - ImplDestroy( this, TRUE ); + ImplDestroy( this, sal_True ); } -void MenuBar::ShowCloser( BOOL bShow ) +void MenuBar::ShowCloser( sal_Bool bShow ) { ShowButtons( bShow, mbFloatBtnVisible, mbHideBtnVisible ); } -void MenuBar::ShowFloatButton( BOOL bShow ) +void MenuBar::ShowFloatButton( sal_Bool bShow ) { ShowButtons( mbCloserVisible, bShow, mbHideBtnVisible ); } -void MenuBar::ShowHideButton( BOOL bShow ) +void MenuBar::ShowHideButton( sal_Bool bShow ) { ShowButtons( mbCloserVisible, mbFloatBtnVisible, bShow ); } -void MenuBar::ShowButtons( BOOL bClose, BOOL bFloat, BOOL bHide ) +void MenuBar::ShowButtons( sal_Bool bClose, sal_Bool bFloat, sal_Bool bHide ) { if ( (bClose != mbCloserVisible) || (bFloat != mbFloatBtnVisible) || @@ -3290,7 +3351,7 @@ void MenuBar::ShowButtons( BOOL bClose, BOOL bFloat, BOOL bHide ) } } -void MenuBar::SetDisplayable( BOOL bDisplayable ) +void MenuBar::SetDisplayable( sal_Bool bDisplayable ) { if( bDisplayable != mbDisplayable ) { @@ -3321,7 +3382,7 @@ Window* MenuBar::ImplCreate( Window* pParent, Window* pWindow, MenuBar* pMenu ) return pWindow; } -void MenuBar::ImplDestroy( MenuBar* pMenu, BOOL bDelete ) +void MenuBar::ImplDestroy( MenuBar* pMenu, sal_Bool bDelete ) { MenuBarWindow* pWindow = (MenuBarWindow*) pMenu->ImplGetWindow(); if ( pWindow && bDelete ) @@ -3332,9 +3393,9 @@ void MenuBar::ImplDestroy( MenuBar* pMenu, BOOL bDelete ) pMenu->pWindow = NULL; } -BOOL MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu ) +sal_Bool MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent, sal_Bool bFromMenu ) { - BOOL bDone = FALSE; + sal_Bool bDone = sal_False; // No keyboard processing when system handles the menu or our menubar is invisible if( !IsDisplayable() || @@ -3350,7 +3411,7 @@ BOOL MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu ) // ----------------------------------------------------------------------- -void MenuBar::SelectEntry( USHORT nId ) +void MenuBar::SelectEntry( sal_uInt16 nId ) { MenuBarWindow* pMenuWin = (MenuBarWindow*) ImplGetWindow(); @@ -3360,14 +3421,14 @@ void MenuBar::SelectEntry( USHORT nId ) nId = GetItemPos( nId ); // #99705# popup the selected menu - pMenuWin->SetAutoPopup( TRUE ); + pMenuWin->SetAutoPopup( sal_True ); if( ITEMPOS_INVALID != pMenuWin->nHighlightedItem ) { pMenuWin->KillActivePopup(); - pMenuWin->ChangeHighlightItem( ITEMPOS_INVALID, FALSE ); + pMenuWin->ChangeHighlightItem( ITEMPOS_INVALID, sal_False ); } if( nId != ITEMPOS_INVALID ) - pMenuWin->ChangeHighlightItem( nId, FALSE ); + pMenuWin->ChangeHighlightItem( nId, sal_False ); } } @@ -3375,38 +3436,38 @@ void MenuBar::SelectEntry( USHORT nId ) // handler for native menu selection and command events -BOOL MenuBar::HandleMenuActivateEvent( Menu *pMenu ) const +sal_Bool MenuBar::HandleMenuActivateEvent( Menu *pMenu ) const { if( pMenu ) { ImplMenuDelData aDelData( this ); pMenu->pStartedFrom = (Menu*)this; - pMenu->bInCallback = TRUE; + pMenu->bInCallback = sal_True; pMenu->Activate(); if( !aDelData.isDeleted() ) - pMenu->bInCallback = FALSE; + pMenu->bInCallback = sal_False; } - return TRUE; + return sal_True; } -BOOL MenuBar::HandleMenuDeActivateEvent( Menu *pMenu ) const +sal_Bool MenuBar::HandleMenuDeActivateEvent( Menu *pMenu ) const { if( pMenu ) { ImplMenuDelData aDelData( this ); pMenu->pStartedFrom = (Menu*)this; - pMenu->bInCallback = TRUE; + pMenu->bInCallback = sal_True; pMenu->Deactivate(); if( !aDelData.isDeleted() ) - pMenu->bInCallback = FALSE; + pMenu->bInCallback = sal_False; } - return TRUE; + return sal_True; } -BOOL MenuBar::HandleMenuHighlightEvent( Menu *pMenu, USHORT nHighlightEventId ) const +sal_Bool MenuBar::HandleMenuHighlightEvent( Menu *pMenu, sal_uInt16 nHighlightEventId ) const { if( !pMenu ) pMenu = ((Menu*) this)->ImplFindMenu( nHighlightEventId ); @@ -3424,13 +3485,13 @@ BOOL MenuBar::HandleMenuHighlightEvent( Menu *pMenu, USHORT nHighlightEventId ) pMenu->pStartedFrom = (Menu*)this; pMenu->ImplCallHighlight( pMenu->mnHighlightedItemPos ); } - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } -BOOL MenuBar::HandleMenuCommandEvent( Menu *pMenu, USHORT nCommandEventId ) const +sal_Bool MenuBar::HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nCommandEventId ) const { if( !pMenu ) pMenu = ((Menu*) this)->ImplFindMenu( nCommandEventId ); @@ -3439,47 +3500,47 @@ BOOL MenuBar::HandleMenuCommandEvent( Menu *pMenu, USHORT nCommandEventId ) cons pMenu->nSelectedId = nCommandEventId; pMenu->pStartedFrom = (Menu*)this; pMenu->ImplSelect(); - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } -USHORT MenuBar::AddMenuBarButton( const Image& i_rImage, const Link& i_rLink, USHORT i_nPos ) +sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const Link& i_rLink, sal_uInt16 i_nPos ) { return AddMenuBarButton( i_rImage, i_rLink, String(), i_nPos ); } -USHORT MenuBar::AddMenuBarButton( const Image& i_rImage, const Link& i_rLink, const String& i_rToolTip, USHORT i_nPos ) +sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const Link& i_rLink, const String& i_rToolTip, sal_uInt16 i_nPos ) { return pWindow ? static_cast<MenuBarWindow*>(pWindow)->AddMenuBarButton( i_rImage, i_rLink, i_rToolTip, i_nPos ) : 0; } -void MenuBar::SetMenuBarButtonHighlightHdl( USHORT nId, const Link& rLink ) +void MenuBar::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link& rLink ) { if( pWindow ) static_cast<MenuBarWindow*>(pWindow)->SetMenuBarButtonHighlightHdl( nId, rLink ); } -Rectangle MenuBar::GetMenuBarButtonRectPixel( USHORT nId ) +Rectangle MenuBar::GetMenuBarButtonRectPixel( sal_uInt16 nId ) { return pWindow ? static_cast<MenuBarWindow*>(pWindow)->GetMenuBarButtonRectPixel( nId ) : Rectangle(); } -void MenuBar::RemoveMenuBarButton( USHORT nId ) +void MenuBar::RemoveMenuBarButton( sal_uInt16 nId ) { if( pWindow ) static_cast<MenuBarWindow*>(pWindow)->RemoveMenuBarButton( nId ); } -BOOL MenuBar::HandleMenuButtonEvent( Menu *, USHORT i_nButtonId ) const +sal_Bool MenuBar::HandleMenuButtonEvent( Menu *, sal_uInt16 i_nButtonId ) const { return static_cast<MenuBarWindow*>(pWindow)->HandleMenuButtonEvent( i_nButtonId ); } // ----------------------------------------------------------------------- -// BOOL PopupMenu::bAnyPopupInExecute = FALSE; +// sal_Bool PopupMenu::bAnyPopupInExecute = sal_False; PopupMenu::PopupMenu() { @@ -3504,9 +3565,9 @@ PopupMenu::~PopupMenu() *pRefAutoSubMenu = NULL; // #111060# avoid second delete in ~MenuItemData } -BOOL PopupMenu::IsInExecute() +sal_Bool PopupMenu::IsInExecute() { - return GetActivePopupMenu() ? TRUE : FALSE; + return GetActivePopupMenu() ? sal_True : sal_False; } PopupMenu* PopupMenu::GetActivePopupMenu() @@ -3515,22 +3576,22 @@ PopupMenu* PopupMenu::GetActivePopupMenu() return pSVData->maAppData.mpActivePopupMenu; } -void PopupMenu::EndExecute( USHORT nSelectId ) +void PopupMenu::EndExecute( sal_uInt16 nSelectId ) { if ( ImplGetWindow() ) ImplGetFloatingWindow()->EndExecute( nSelectId ); } -void PopupMenu::SelectEntry( USHORT nId ) +void PopupMenu::SelectEntry( sal_uInt16 nId ) { if ( ImplGetWindow() ) { if( nId != ITEMPOS_INVALID ) { - USHORT nPos; + sal_uInt16 nPos; MenuItemData* pData = GetItemList()->GetData( nId, nPos ); if ( pData->pSubMenu ) - ImplGetFloatingWindow()->ChangeHighlightItem( nPos, TRUE ); + ImplGetFloatingWindow()->ChangeHighlightItem( nPos, sal_True ); else ImplGetFloatingWindow()->EndExecute( nId ); } @@ -3538,7 +3599,7 @@ void PopupMenu::SelectEntry( USHORT nId ) { MenuFloatingWindow* pFloat = ImplGetFloatingWindow(); pFloat->GrabFocus(); - USHORT nPos; + sal_uInt16 nPos; for( nPos = 0; nPos < GetItemList()->Count(); nPos++ ) { MenuItemData* pData = (MenuItemData*)GetItemList()->GetObject( nPos ); @@ -3547,27 +3608,27 @@ void PopupMenu::SelectEntry( USHORT nId ) pFloat->KillActivePopup(); } } - pFloat->ChangeHighlightItem( ITEMPOS_INVALID, FALSE ); + pFloat->ChangeHighlightItem( ITEMPOS_INVALID, sal_False ); } } } -void PopupMenu::SetSelectedEntry( USHORT nId ) +void PopupMenu::SetSelectedEntry( sal_uInt16 nId ) { nSelectedId = nId; } -USHORT PopupMenu::Execute( Window* pExecWindow, const Point& rPopupPos ) +sal_uInt16 PopupMenu::Execute( Window* pExecWindow, const Point& rPopupPos ) { return Execute( pExecWindow, Rectangle( rPopupPos, rPopupPos ), POPUPMENU_EXECUTE_DOWN ); } -USHORT PopupMenu::Execute( Window* pExecWindow, const Rectangle& rRect, USHORT nFlags ) +sal_uInt16 PopupMenu::Execute( Window* pExecWindow, const Rectangle& rRect, sal_uInt16 nFlags ) { ENSURE_OR_RETURN( pExecWindow, "PopupMenu::Execute: need a non-NULL window!", 0 ); - ULONG nPopupModeFlags = 0; + sal_uLong nPopupModeFlags = 0; if ( nFlags & POPUPMENU_EXECUTE_DOWN ) nPopupModeFlags = FLOATWIN_POPUPMODE_DOWN; else if ( nFlags & POPUPMENU_EXECUTE_UP ) @@ -3582,10 +3643,10 @@ USHORT PopupMenu::Execute( Window* pExecWindow, const Rectangle& rRect, USHORT n if (nFlags & POPUPMENU_NOMOUSEUPCLOSE ) // allow popup menus to stay open on mouse button up nPopupModeFlags |= FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE; // useful if the menu was opened on mousebutton down (eg toolbox configuration) - return ImplExecute( pExecWindow, rRect, nPopupModeFlags, 0, FALSE ); + return ImplExecute( pExecWindow, rRect, nPopupModeFlags, 0, sal_False ); } -USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupModeFlags, Menu* pSFrom, BOOL bPreSelectFirst ) +sal_uInt16 PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, sal_uLong nPopupModeFlags, Menu* pSFrom, sal_Bool bPreSelectFirst ) { if ( !pSFrom && ( PopupMenu::IsInExecute() || !GetItemCount() ) ) return 0; @@ -3596,15 +3657,15 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM pStartedFrom = pSFrom; nSelectedId = 0; - bCanceled = FALSE; + bCanceled = sal_False; - ULONG nFocusId = 0; - BOOL bRealExecute = FALSE; + sal_uLong nFocusId = 0; + sal_Bool bRealExecute = sal_False; if ( !pStartedFrom ) { - pSVData->maWinData.mbNoDeactivate = TRUE; + pSVData->maWinData.mbNoDeactivate = sal_True; nFocusId = Window::SaveFocus(); - bRealExecute = TRUE; + bRealExecute = sal_True; } else { @@ -3631,9 +3692,9 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM ImplDelData aDelData; pW->ImplAddDel( &aDelData ); - bInCallback = TRUE; // hier schon setzen, falls Activate ueberladen + bInCallback = sal_True; // hier schon setzen, falls Activate ueberladen Activate(); - bInCallback = FALSE; + bInCallback = sal_False; if ( aDelData.IsDelete() ) return 0; // Error @@ -3659,7 +3720,7 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM nMenuFlags |= MENU_FLAG_HIDEDISABLEDENTRIES; - USHORT nVisibleEntries = ImplGetVisibleItemCount(); + sal_uInt16 nVisibleEntries = ImplGetVisibleItemCount(); if ( !nVisibleEntries ) { ResMgr* pResMgr = ImplGetResMgr(); @@ -3668,7 +3729,7 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM String aTmpEntryText( ResId( SV_RESID_STRING_NOSELECTIONPOSSIBLE, *pResMgr ) ); MenuItemData* pData = pItemList->Insert( 0xFFFF, MENUITEM_STRING, 0, aTmpEntryText, Image(), NULL, 0xFFFF ); - pData->bIsTemporary = TRUE; + pData->bIsTemporary = sal_True; } } else if ( Application::GetSettings().GetStyleSettings().GetAutoMnemonic() && !( nMenuFlags & MENU_FLAG_NOAUTOMNEMONICS ) ) @@ -3703,9 +3764,9 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM nMaxHeight -= nTop+nBottom; if ( aSz.Height() > nMaxHeight ) { - pWin->EnableScrollMenu( TRUE ); - USHORT nStart = ImplGetFirstVisible(); - USHORT nEntries = ImplCalcVisEntries( nMaxHeight, nStart ); + pWin->EnableScrollMenu( sal_True ); + sal_uInt16 nStart = ImplGetFirstVisible(); + sal_uInt16 nEntries = ImplCalcVisEntries( nMaxHeight, nStart ); aSz.Height() = ImplCalcHeight( nEntries ); } @@ -3720,7 +3781,7 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM if ( GetItemCount() ) { SalMenu* pMenu = ImplGetSalMenu(); - if( pMenu && pMenu->ShowNativePopupMenu( pWin, aRect, nPopupModeFlags | FLOATWIN_POPUPMODE_GRABFOCUS ) ) + if( pMenu && bRealExecute && pMenu->ShowNativePopupMenu( pWin, aRect, nPopupModeFlags | FLOATWIN_POPUPMODE_GRABFOCUS ) ) { pWin->StopExecute(0); pWin->doShutdown(); @@ -3734,7 +3795,7 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM } if( pSFrom ) { - USHORT aPos; + sal_uInt16 aPos; if( pSFrom->bIsMenuBar ) aPos = ((MenuBarWindow *) pSFrom->pWindow)->GetHighlightedItem(); else @@ -3746,14 +3807,14 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM } if ( bPreSelectFirst ) { - USHORT nCount = (USHORT)pItemList->Count(); - for ( USHORT n = 0; n < nCount; n++ ) + sal_uInt16 nCount = (sal_uInt16)pItemList->Count(); + for ( sal_uInt16 n = 0; n < nCount; n++ ) { MenuItemData* pData = pItemList->GetDataFromPos( n ); if ( ( pData->bEnabled || !Application::GetSettings().GetStyleSettings().GetSkipDisabledInMenus() ) && ( pData->eType != MENUITEM_SEPARATOR ) && ImplIsVisible( n ) && ImplIsSelectable( n ) ) { - pWin->ChangeHighlightItem( n, FALSE ); + pWin->ChangeHighlightItem( n, sal_False ); break; } } @@ -3783,7 +3844,7 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM if ( nFocusId ) { pWin->SetFocusId( 0 ); - pSVData->maWinData.mbNoDeactivate = FALSE; + pSVData->maWinData.mbNoDeactivate = sal_False; } pWin->ImplEndPopupMode( 0, nFocusId ); @@ -3814,18 +3875,18 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM return bRealExecute ? nSelectedId : 0; } -USHORT PopupMenu::ImplCalcVisEntries( long nMaxHeight, USHORT nStartEntry, USHORT* pLastVisible ) const +sal_uInt16 PopupMenu::ImplCalcVisEntries( long nMaxHeight, sal_uInt16 nStartEntry, sal_uInt16* pLastVisible ) const { nMaxHeight -= 2 * ImplGetFloatingWindow()->GetScrollerHeight(); long nHeight = 0; - USHORT nEntries = (USHORT) pItemList->Count(); - USHORT nVisEntries = 0; + sal_uInt16 nEntries = (sal_uInt16) pItemList->Count(); + sal_uInt16 nVisEntries = 0; if ( pLastVisible ) *pLastVisible = 0; - for ( USHORT n = nStartEntry; n < nEntries; n++ ) + for ( sal_uInt16 n = nStartEntry; n < nEntries; n++ ) { if ( ImplIsVisible( n ) ) { @@ -3842,14 +3903,14 @@ USHORT PopupMenu::ImplCalcVisEntries( long nMaxHeight, USHORT nStartEntry, USHOR return nVisEntries; } -long PopupMenu::ImplCalcHeight( USHORT nEntries ) const +long PopupMenu::ImplCalcHeight( sal_uInt16 nEntries ) const { long nHeight = 0; - USHORT nFound = 0; - for ( USHORT n = 0; ( nFound < nEntries ) && ( n < pItemList->Count() ); n++ ) + sal_uInt16 nFound = 0; + for ( sal_uInt16 n = 0; ( nFound < nEntries ) && ( n < pItemList->Count() ); n++ ) { - if ( ImplIsVisible( (USHORT) n ) ) + if ( ImplIsVisible( (sal_uInt16) n ) ) { MenuItemData* pData = pItemList->GetDataFromPos( n ); nHeight += pData->aSz.Height(); @@ -3863,7 +3924,7 @@ long PopupMenu::ImplCalcHeight( USHORT nEntries ) const } -static void ImplInitMenuWindow( Window* pWin, BOOL bFont, BOOL bMenuBar ) +static void ImplInitMenuWindow( Window* pWin, sal_Bool bFont, sal_Bool bMenuBar ) { const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings(); @@ -3880,7 +3941,7 @@ static void ImplInitMenuWindow( Window* pWin, BOOL bFont, BOOL bMenuBar ) Wallpaper aWallpaper; aWallpaper.SetStyle( WALLPAPER_APPLICATIONGRADIENT ); pWin->SetBackground( aWallpaper ); - pWin->SetPaintTransparent( FALSE ); + pWin->SetPaintTransparent( sal_False ); pWin->SetParentClipMode( 0 ); } } @@ -3905,12 +3966,12 @@ static void ImplInitMenuWindow( Window* pWin, BOOL bFont, BOOL bMenuBar ) MenuFloatingWindow::MenuFloatingWindow( Menu* pMen, Window* pParent, WinBits nStyle ) : FloatingWindow( pParent, nStyle ) { - mpWindowImpl->mbMenuFloatingWindow= TRUE; + mpWindowImpl->mbMenuFloatingWindow= sal_True; pMenu = pMen; pActivePopup = 0; nSaveFocusId = 0; - bInExecute = FALSE; - bScrollMenu = FALSE; + bInExecute = sal_False; + bScrollMenu = sal_False; nHighlightedItem = ITEMPOS_INVALID; nMBDownPos = ITEMPOS_INVALID; nPosInParent = ITEMPOS_INVALID; @@ -3918,13 +3979,13 @@ MenuFloatingWindow::MenuFloatingWindow( Menu* pMen, Window* pParent, WinBits nSt // nStartY = 0; nBorder = EXTRASPACEY; nFirstEntry = 0; - bScrollUp = FALSE; - bScrollDown = FALSE; - bIgnoreFirstMove = TRUE; - bKeyInput = FALSE; + bScrollUp = sal_False; + bScrollDown = sal_False; + bIgnoreFirstMove = sal_True; + bKeyInput = sal_False; EnableSaveBackground(); - ImplInitMenuWindow( this, TRUE, FALSE ); + ImplInitMenuWindow( this, sal_True, sal_False ); SetPopupModeEndHdl( LINK( this, MenuFloatingWindow, PopupEnd ) ); @@ -3950,7 +4011,7 @@ void MenuFloatingWindow::doShutdown() { // #102461# remove highlight in parent MenuItemData* pData; - USHORT i, nCount = (USHORT)pMenu->pStartedFrom->pItemList->Count(); + sal_uInt16 i, nCount = (sal_uInt16)pMenu->pStartedFrom->pItemList->Count(); for(i = 0; i < nCount; i++) { pData = pMenu->pStartedFrom->pItemList->GetDataFromPos( i ); @@ -3961,7 +4022,7 @@ void MenuFloatingWindow::doShutdown() { MenuFloatingWindow* pPWin = (MenuFloatingWindow*)pMenu->pStartedFrom->ImplGetWindow(); if( pPWin ) - pPWin->HighlightItem( i, FALSE ); + pPWin->HighlightItem( i, sal_False ); } } @@ -3997,13 +4058,13 @@ long MenuFloatingWindow::ImplGetStartY() const long nY = 0; if( pMenu ) { - for ( USHORT n = 0; n < nFirstEntry; n++ ) + for ( sal_uInt16 n = 0; n < nFirstEntry; n++ ) nY += pMenu->GetItemList()->GetDataFromPos( n )->aSz.Height(); } return -nY; } -Region MenuFloatingWindow::ImplCalcClipRegion( BOOL bIncludeLogo ) const +Region MenuFloatingWindow::ImplCalcClipRegion( sal_Bool bIncludeLogo ) const { Size aOutSz = GetOutputSizePixel(); Point aPos; @@ -4033,7 +4094,7 @@ void MenuFloatingWindow::ImplInitClipRegion() } } -void MenuFloatingWindow::ImplHighlightItem( const MouseEvent& rMEvt, BOOL bMBDown ) +void MenuFloatingWindow::ImplHighlightItem( const MouseEvent& rMEvt, sal_Bool bMBDown ) { if( ! pMenu ) return; @@ -4043,10 +4104,10 @@ void MenuFloatingWindow::ImplHighlightItem( const MouseEvent& rMEvt, BOOL bMBDow Size aOutSz = GetOutputSizePixel(); if ( ( nMouseY >= nY ) && ( nMouseY < ( aOutSz.Height() - nY ) ) ) { - BOOL bHighlighted = FALSE; - USHORT nCount = (USHORT)pMenu->pItemList->Count(); + sal_Bool bHighlighted = sal_False; + sal_uInt16 nCount = (sal_uInt16)pMenu->pItemList->Count(); nY += ImplGetStartY(); // ggf. gescrollt. - for ( USHORT n = 0; !bHighlighted && ( n < nCount ); n++ ) + for ( sal_uInt16 n = 0; !bHighlighted && ( n < nCount ); n++ ) { if ( pMenu->ImplIsVisible( n ) ) { @@ -4055,7 +4116,7 @@ void MenuFloatingWindow::ImplHighlightItem( const MouseEvent& rMEvt, BOOL bMBDow nY += pItemData->aSz.Height(); if ( ( nOldY <= nMouseY ) && ( nY > nMouseY ) && pMenu->ImplIsSelectable( n ) ) { - BOOL bPopupArea = TRUE; + sal_Bool bPopupArea = sal_True; if ( pItemData->nBits & MIB_POPUPSELECT ) { // Nur wenn ueber dem Pfeil geklickt wurde... @@ -4068,10 +4129,10 @@ void MenuFloatingWindow::ImplHighlightItem( const MouseEvent& rMEvt, BOOL bMBDow { if ( n != nHighlightedItem ) { - ChangeHighlightItem( (USHORT)n, FALSE ); + ChangeHighlightItem( (sal_uInt16)n, sal_False ); } - BOOL bAllowNewPopup = TRUE; + sal_Bool bAllowNewPopup = sal_True; if ( pActivePopup ) { MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n ); @@ -4089,7 +4150,7 @@ void MenuFloatingWindow::ImplHighlightItem( const MouseEvent& rMEvt, BOOL bMBDow { if ( n != nHighlightedItem ) { - ChangeHighlightItem( (USHORT)n, TRUE ); + ChangeHighlightItem( (sal_uInt16)n, sal_True ); } else if ( pItemData->nBits & MIB_POPUPSELECT ) { @@ -4097,17 +4158,17 @@ void MenuFloatingWindow::ImplHighlightItem( const MouseEvent& rMEvt, BOOL bMBDow HighlightChanged( NULL ); } } - bHighlighted = TRUE; + bHighlighted = sal_True; } } } if ( !bHighlighted ) - ChangeHighlightItem( ITEMPOS_INVALID, TRUE ); + ChangeHighlightItem( ITEMPOS_INVALID, sal_True ); } else { ImplScroll( rMEvt.GetPosPixel() ); - ChangeHighlightItem( ITEMPOS_INVALID, TRUE ); + ChangeHighlightItem( ITEMPOS_INVALID, sal_True ); } } @@ -4121,12 +4182,12 @@ IMPL_LINK( MenuFloatingWindow, PopupEnd, FloatingWindow*, EMPTYARG ) { //DBG_ASSERT( !pActivePopup->ImplGetWindow(), "PopupEnd, obwohl pActivePopup MIT Window!" ); KillActivePopup(); // should be ok to just remove it - //pActivePopup->bCanceled = TRUE; + //pActivePopup->bCanceled = sal_True; } - bInExecute = FALSE; - pMenu->bInCallback = TRUE; + bInExecute = sal_False; + pMenu->bInCallback = sal_True; pMenu->Deactivate(); - pMenu->bInCallback = FALSE; + pMenu->bInCallback = sal_False; } else { @@ -4176,7 +4237,7 @@ IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer ) { if ( pActivePopup && ( pActivePopup != pItemData->pSubMenu ) ) { - ULONG nOldFlags = GetPopupModeFlags(); + sal_uLong nOldFlags = GetPopupModeFlags(); SetPopupModeFlags( GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); KillActivePopup(); SetPopupModeFlags( nOldFlags ); @@ -4186,7 +4247,7 @@ IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer ) pActivePopup = (PopupMenu*)pItemData->pSubMenu; long nY = nScrollerHeight+ImplGetStartY(); MenuItemData* pData = 0; - for ( ULONG n = 0; n < nHighlightedItem; n++ ) + for ( sal_uLong n = 0; n < nHighlightedItem; n++ ) { pData = pMenu->pItemList->GetDataFromPos( n ); nY += pData->aSz.Height(); @@ -4217,9 +4278,9 @@ IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer ) // die lange im Activate Rescheduled haben und jetzt schon nicht mehr // angezeigt werden sollen. Menu* pTest = pActivePopup; - ULONG nOldFlags = GetPopupModeFlags(); + sal_uLong nOldFlags = GetPopupModeFlags(); SetPopupModeFlags( GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); - USHORT nRet = pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FLOATWIN_POPUPMODE_RIGHT, pMenu, pTimer ? FALSE : TRUE ); + sal_uInt16 nRet = pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FLOATWIN_POPUPMODE_RIGHT, pMenu, pTimer ? sal_False : sal_True ); SetPopupModeFlags( nOldFlags ); // nRet != 0, wenn es waerend Activate() abgeschossen wurde... @@ -4254,11 +4315,11 @@ IMPL_LINK( MenuFloatingWindow, ShowHideListener, VclWindowEvent*, pEvent ) return 0; } -void MenuFloatingWindow::EnableScrollMenu( BOOL b ) +void MenuFloatingWindow::EnableScrollMenu( sal_Bool b ) { bScrollMenu = b; - nScrollerHeight = b ? (USHORT) GetSettings().GetStyleSettings().GetScrollBarSize() /2 : 0; - bScrollDown = TRUE; + nScrollerHeight = b ? (sal_uInt16) GetSettings().GetStyleSettings().GetScrollBarSize() /2 : 0; + bScrollDown = sal_True; ImplInitClipRegion(); } @@ -4268,8 +4329,8 @@ void MenuFloatingWindow::Execute() pSVData->maAppData.mpActivePopupMenu = (PopupMenu*)pMenu; - bInExecute = TRUE; -// bCallingSelect = FALSE; + bInExecute = sal_True; +// bCallingSelect = sal_False; while ( bInExecute ) Application::Yield(); @@ -4280,24 +4341,24 @@ void MenuFloatingWindow::Execute() // Application::Yield(); } -void MenuFloatingWindow::StopExecute( ULONG nFocusId ) +void MenuFloatingWindow::StopExecute( sal_uLong nFocusId ) { // Focus wieder herstellen // (kann schon im Select wieder hergestellt wurden sein) if ( nSaveFocusId ) { - Window::EndSaveFocus( nFocusId, FALSE ); + Window::EndSaveFocus( nFocusId, sal_False ); nFocusId = nSaveFocusId; if ( nFocusId ) { nSaveFocusId = 0; - ImplGetSVData()->maWinData.mbNoDeactivate = FALSE; + ImplGetSVData()->maWinData.mbNoDeactivate = sal_False; } } ImplEndPopupMode( 0, nFocusId ); aHighlightChangedTimer.Stop(); - bInExecute = FALSE; + bInExecute = sal_False; if ( pActivePopup ) { KillActivePopup(); @@ -4315,15 +4376,15 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly ) if( ((FloatingWindow *) pActivePopup->pWindow)->IsInCleanUp() ) return; // kill it later if ( pActivePopup->bInCallback ) - pActivePopup->bCanceled = TRUE; + pActivePopup->bCanceled = sal_True; // Vor allen Aktionen schon pActivePopup = 0, falls z.B. // PopupModeEndHdl des zu zerstoerenden Popups mal synchron gerufen wird. PopupMenu* pPopup = pActivePopup; pActivePopup = NULL; - pPopup->bInCallback = TRUE; + pPopup->bInCallback = sal_True; pPopup->Deactivate(); - pPopup->bInCallback = FALSE; + pPopup->bInCallback = sal_False; if ( pPopup->ImplGetWindow() ) { pPopup->ImplGetFloatingWindow()->StopExecute(); @@ -4339,14 +4400,14 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly ) void MenuFloatingWindow::EndExecute() { Menu* pStart = pMenu ? pMenu->ImplGetStartMenu() : NULL; - ULONG nFocusId = 0; + sal_uLong nFocusId = 0; if ( pStart && pStart->bIsMenuBar ) { nFocusId = ((MenuBarWindow*)((MenuBar*)pStart)->ImplGetWindow())->GetFocusId(); if ( nFocusId ) { ((MenuBarWindow*)((MenuBar*)pStart)->ImplGetWindow())->SetFocusId( 0 ); - ImplGetSVData()->maWinData.mbNoDeactivate = FALSE; + ImplGetSVData()->maWinData.mbNoDeactivate = sal_False; } } @@ -4363,7 +4424,7 @@ void MenuFloatingWindow::EndExecute() // Dies Fenster wird gleich zerstoert => Daten lokal merken... Menu* pM = pMenu; - USHORT nItem = nHighlightedItem; + sal_uInt16 nItem = nHighlightedItem; pCleanUpFrom->StopExecute( nFocusId ); @@ -4381,9 +4442,9 @@ void MenuFloatingWindow::EndExecute() } } -void MenuFloatingWindow::EndExecute( USHORT nId ) +void MenuFloatingWindow::EndExecute( sal_uInt16 nId ) { - USHORT nPos; + sal_uInt16 nPos; if ( pMenu && pMenu->GetItemList()->GetData( nId, nPos ) ) nHighlightedItem = nPos; else @@ -4400,7 +4461,7 @@ void MenuFloatingWindow::MouseButtonDown( const MouseEvent& rMEvt ) //if ( pActivePopup && pActivePopup->ImplGetWindow() && !pActivePopup->ImplGetFloatingWindow()->pActivePopup ) // pActivePopup->ImplGetFloatingWindow()->ToTop( TOTOP_NOGRABFOCUS ); - ImplHighlightItem( rMEvt, TRUE ); + ImplHighlightItem( rMEvt, sal_True ); nMBDownPos = nHighlightedItem; } @@ -4410,7 +4471,7 @@ void MenuFloatingWindow::MouseButtonUp( const MouseEvent& rMEvt ) MenuItemData* pData = pMenu ? pMenu->GetItemList()->GetDataFromPos( nHighlightedItem ) : NULL; // nMBDownPos in lokaler Variable merken und gleich zuruecksetzen, // weil nach EndExecute zu spaet - USHORT _nMBDownPos = nMBDownPos; + sal_uInt16 _nMBDownPos = nMBDownPos; nMBDownPos = ITEMPOS_INVALID; if ( pData && pData->bEnabled && ( pData->eType != MENUITEM_SEPARATOR ) ) { @@ -4448,7 +4509,7 @@ void MenuFloatingWindow::MouseMove( const MouseEvent& rMEvt ) pActivePopup->ImplGetFloatingWindow()->aSubmenuCloseTimer.Start(); if( !pActivePopup || (pData && pData->pSubMenu != pActivePopup ) ) - ChangeHighlightItem( ITEMPOS_INVALID, FALSE ); + ChangeHighlightItem( ITEMPOS_INVALID, sal_False ); #ifdef OS2 } #endif @@ -4463,13 +4524,13 @@ void MenuFloatingWindow::MouseMove( const MouseEvent& rMEvt ) { aSubmenuCloseTimer.Stop(); if( bIgnoreFirstMove ) - bIgnoreFirstMove = FALSE; + bIgnoreFirstMove = sal_False; else - ImplHighlightItem( rMEvt, FALSE ); + ImplHighlightItem( rMEvt, sal_False ); } } -void MenuFloatingWindow::ImplScroll( BOOL bUp ) +void MenuFloatingWindow::ImplScroll( sal_Bool bUp ) { KillActivePopup(); Update(); @@ -4477,7 +4538,7 @@ void MenuFloatingWindow::ImplScroll( BOOL bUp ) if( ! pMenu ) return; - HighlightItem( nHighlightedItem, FALSE ); + HighlightItem( nHighlightedItem, sal_False ); pMenu->ImplKillLayoutData(); @@ -4492,17 +4553,17 @@ void MenuFloatingWindow::ImplScroll( BOOL bUp ) if ( !bScrollDown ) { - bScrollDown = TRUE; - ImplDrawScroller( FALSE ); + bScrollDown = sal_True; + ImplDrawScroller( sal_False ); } if ( pMenu->ImplGetPrevVisible( nFirstEntry ) == ITEMPOS_INVALID ) { - bScrollUp = FALSE; - ImplDrawScroller( TRUE ); + bScrollUp = sal_False; + ImplDrawScroller( sal_True ); } - Scroll( 0, nScrollEntryHeight, ImplCalcClipRegion( FALSE ).GetBoundRect(), SCROLL_CLIP ); + Scroll( 0, nScrollEntryHeight, ImplCalcClipRegion( sal_False ).GetBoundRect(), SCROLL_CLIP ); } else if ( bScrollDown && !bUp ) { @@ -4514,24 +4575,24 @@ void MenuFloatingWindow::ImplScroll( BOOL bUp ) if ( !bScrollUp ) { - bScrollUp = TRUE; - ImplDrawScroller( TRUE ); + bScrollUp = sal_True; + ImplDrawScroller( sal_True ); } long nHeight = GetOutputSizePixel().Height(); - USHORT nLastVisible; + sal_uInt16 nLastVisible; ((PopupMenu*)pMenu)->ImplCalcVisEntries( nHeight, nFirstEntry, &nLastVisible ); if ( pMenu->ImplGetNextVisible( nLastVisible ) == ITEMPOS_INVALID ) { - bScrollDown = FALSE; - ImplDrawScroller( FALSE ); + bScrollDown = sal_False; + ImplDrawScroller( sal_False ); } // nStartY -= nEntryHeight; - Scroll( 0, -nScrollEntryHeight, ImplCalcClipRegion( FALSE ).GetBoundRect(), SCROLL_CLIP ); + Scroll( 0, -nScrollEntryHeight, ImplCalcClipRegion( sal_False ).GetBoundRect(), SCROLL_CLIP ); } - HighlightItem( nHighlightedItem, TRUE ); + HighlightItem( nHighlightedItem, sal_True ); } void MenuFloatingWindow::ImplScroll( const Point& rMousePos ) @@ -4544,12 +4605,12 @@ void MenuFloatingWindow::ImplScroll( const Point& rMousePos ) if ( bScrollUp && ( nMouseY < nY ) ) { - ImplScroll( TRUE ); + ImplScroll( sal_True ); nDelta = nY - nMouseY; } else if ( bScrollDown && ( nMouseY > ( aOutSz.Height() - nY ) ) ) { - ImplScroll( FALSE ); + ImplScroll( sal_False ); nDelta = nMouseY - ( aOutSz.Height() - nY ); } @@ -4571,7 +4632,7 @@ void MenuFloatingWindow::ImplScroll( const Point& rMousePos ) aScrollTimer.Start(); } } -void MenuFloatingWindow::ChangeHighlightItem( USHORT n, BOOL bStartPopupTimer ) +void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, sal_Bool bStartPopupTimer ) { // #57934# ggf. das aktive Popup sofort schliessen, damit TH's Hintergrundsicherung funktioniert. // #65750# Dann verzichten wir lieber auf den schmalen Streifen Hintergrundsicherung. @@ -4586,11 +4647,11 @@ void MenuFloatingWindow::ChangeHighlightItem( USHORT n, BOOL bStartPopupTimer ) if ( nHighlightedItem != ITEMPOS_INVALID ) { - HighlightItem( nHighlightedItem, FALSE ); + HighlightItem( nHighlightedItem, sal_False ); pMenu->ImplCallEventListeners( VCLEVENT_MENU_DEHIGHLIGHT, nHighlightedItem ); } - nHighlightedItem = (USHORT)n; + nHighlightedItem = (sal_uInt16)n; DBG_ASSERT( pMenu->ImplIsVisible( nHighlightedItem ) || nHighlightedItem == ITEMPOS_INVALID, "ChangeHighlightItem: Not visible!" ); if( nHighlightedItem != ITEMPOS_INVALID ) { @@ -4598,7 +4659,7 @@ void MenuFloatingWindow::ChangeHighlightItem( USHORT n, BOOL bStartPopupTimer ) { // #102461# make sure parent entry is highlighted as well MenuItemData* pData; - USHORT i, nCount = (USHORT)pMenu->pStartedFrom->pItemList->Count(); + sal_uInt16 i, nCount = (sal_uInt16)pMenu->pStartedFrom->pItemList->Count(); for(i = 0; i < nCount; i++) { pData = pMenu->pStartedFrom->pItemList->GetDataFromPos( i ); @@ -4610,12 +4671,12 @@ void MenuFloatingWindow::ChangeHighlightItem( USHORT n, BOOL bStartPopupTimer ) MenuFloatingWindow* pPWin = (MenuFloatingWindow*)pMenu->pStartedFrom->ImplGetWindow(); if( pPWin && pPWin->nHighlightedItem != i ) { - pPWin->HighlightItem( i, TRUE ); + pPWin->HighlightItem( i, sal_True ); pPWin->nHighlightedItem = i; } } } - HighlightItem( nHighlightedItem, TRUE ); + HighlightItem( nHighlightedItem, sal_True ); pMenu->ImplCallHighlight( nHighlightedItem ); } else @@ -4634,7 +4695,7 @@ void MenuFloatingWindow::ChangeHighlightItem( USHORT n, BOOL bStartPopupTimer ) } } -void MenuFloatingWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) +void MenuFloatingWindow::HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight ) { if( ! pMenu ) return; @@ -4650,8 +4711,8 @@ void MenuFloatingWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) int nOuterSpace = ImplGetSVData()->maNWFData.mnMenuFormatExtraBorder; nY += nOuterSpace; - USHORT nCount = (USHORT)pMenu->pItemList->Count(); - for ( USHORT n = 0; n < nCount; n++ ) + sal_uInt16 nCount = (sal_uInt16)pMenu->pItemList->Count(); + for ( sal_uInt16 n = 0; n < nCount; n++ ) { MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n ); if ( n == nPos ) @@ -4659,7 +4720,7 @@ void MenuFloatingWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) DBG_ASSERT( pMenu->ImplIsVisible( n ), "Highlight: Item not visible!" ); if ( pData->eType != MENUITEM_SEPARATOR ) { - BOOL bRestoreLineColor = FALSE; + sal_Bool bRestoreLineColor = sal_False; Color oldLineColor; bool bDrawItemRect = true; @@ -4676,19 +4737,20 @@ void MenuFloatingWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) Push( PUSH_CLIPREGION ); IntersectClipRegion( Rectangle( Point( nX, nY ), Size( aSz.Width(), pData->aSz.Height() ) ) ); Rectangle aCtrlRect( Point( nX, 0 ), Size( aPxSize.Width()-nX, aPxSize.Height() ) ); + MenupopupValue aVal( pMenu->nTextPos-GUTTERBORDER, aItemRect ); DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, aCtrlRect, CTRL_STATE_ENABLED, - ImplControlValue(), + aVal, OUString() ); if( bHighlight && IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM ) ) { bDrawItemRect = false; - if( FALSE == DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_ITEM, + if( sal_False == DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_ITEM, aItemRect, CTRL_STATE_SELECTED | ( pData->bEnabled? CTRL_STATE_ENABLED: 0 ), - ImplControlValue(), + aVal, OUString() ) ) { bDrawItemRect = bHighlight; @@ -4709,7 +4771,7 @@ void MenuFloatingWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) SetFillColor(); oldLineColor = GetLineColor(); SetLineColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() ); - bRestoreLineColor = TRUE; + bRestoreLineColor = sal_True; } } else @@ -4728,7 +4790,7 @@ void MenuFloatingWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) } } -Rectangle MenuFloatingWindow::ImplGetItemRect( USHORT nPos ) +Rectangle MenuFloatingWindow::ImplGetItemRect( sal_uInt16 nPos ) { if( ! pMenu ) return Rectangle(); @@ -4742,8 +4804,8 @@ Rectangle MenuFloatingWindow::ImplGetItemRect( USHORT nPos ) if ( pMenu->pLogo ) nX = pMenu->pLogo->aBitmap.GetSizePixel().Width(); - USHORT nCount = (USHORT)pMenu->pItemList->Count(); - for ( USHORT n = 0; n < nCount; n++ ) + sal_uInt16 nCount = (sal_uInt16)pMenu->pItemList->Count(); + for ( sal_uInt16 n = 0; n < nCount; n++ ) { MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n ); if ( n == nPos ) @@ -4766,14 +4828,14 @@ Rectangle MenuFloatingWindow::ImplGetItemRect( USHORT nPos ) } -void MenuFloatingWindow::ImplCursorUpDown( BOOL bUp, BOOL bHomeEnd ) +void MenuFloatingWindow::ImplCursorUpDown( sal_Bool bUp, sal_Bool bHomeEnd ) { if( ! pMenu ) return; const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - USHORT n = nHighlightedItem; + sal_uInt16 n = nHighlightedItem; if ( n == ITEMPOS_INVALID ) { if ( bUp ) @@ -4782,7 +4844,7 @@ void MenuFloatingWindow::ImplCursorUpDown( BOOL bUp, BOOL bHomeEnd ) n = pMenu->GetItemCount()-1; } - USHORT nLoop = n; + sal_uInt16 nLoop = n; if( bHomeEnd ) { @@ -4794,7 +4856,7 @@ void MenuFloatingWindow::ImplCursorUpDown( BOOL bUp, BOOL bHomeEnd ) } else { - n = (USHORT)-1; + n = (sal_uInt16)-1; nLoop = n+1; } } @@ -4830,21 +4892,21 @@ void MenuFloatingWindow::ImplCursorUpDown( BOOL bUp, BOOL bHomeEnd ) // Selektion noch im sichtbaren Bereich? if ( IsScrollMenu() ) { - ChangeHighlightItem( ITEMPOS_INVALID, FALSE ); + ChangeHighlightItem( ITEMPOS_INVALID, sal_False ); while ( n < nFirstEntry ) - ImplScroll( TRUE ); + ImplScroll( sal_True ); Size aOutSz = GetOutputSizePixel(); - USHORT nLastVisible; + sal_uInt16 nLastVisible; ((PopupMenu*)pMenu)->ImplCalcVisEntries( aOutSz.Height(), nFirstEntry, &nLastVisible ); while ( n > nLastVisible ) { - ImplScroll( FALSE ); + ImplScroll( sal_False ); ((PopupMenu*)pMenu)->ImplCalcVisEntries( aOutSz.Height(), nFirstEntry, &nLastVisible ); } } - ChangeHighlightItem( n, FALSE ); + ChangeHighlightItem( n, sal_False ); break; } } while ( n != nLoop ); @@ -4855,8 +4917,8 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent ) ImplDelData aDelData; ImplAddDel( &aDelData ); - USHORT nCode = rKEvent.GetKeyCode().GetCode(); - bKeyInput = TRUE; + sal_uInt16 nCode = rKEvent.GetKeyCode().GetCode(); + bKeyInput = sal_True; switch ( nCode ) { case KEY_UP: @@ -4868,7 +4930,7 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent ) case KEY_END: case KEY_HOME: { - ImplCursorUpDown( nCode == KEY_END, TRUE ); + ImplCursorUpDown( nCode == KEY_END, sal_True ); } break; case KEY_F6: @@ -4924,14 +4986,14 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent ) { if( pMenu ) { - BOOL bDone = FALSE; + sal_Bool bDone = sal_False; if ( nHighlightedItem != ITEMPOS_INVALID ) { MenuItemData* pData = pMenu->GetItemList()->GetDataFromPos( nHighlightedItem ); if ( pData && pData->pSubMenu ) { HighlightChanged( 0 ); - bDone = TRUE; + bDone = sal_True; } } if ( !bDone ) @@ -4979,14 +5041,14 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent ) default: { xub_Unicode nCharCode = rKEvent.GetCharCode(); - USHORT nPos = 0; - USHORT nDuplicates = 0; + sal_uInt16 nPos = 0; + sal_uInt16 nDuplicates = 0; MenuItemData* pData = (nCharCode && pMenu) ? pMenu->GetItemList()->SearchItem( nCharCode, rKEvent.GetKeyCode(), nPos, nDuplicates, nHighlightedItem ) : NULL; if ( pData ) { if ( pData->pSubMenu || nDuplicates > 1 ) { - ChangeHighlightItem( nPos, FALSE ); + ChangeHighlightItem( nPos, sal_False ); HighlightChanged( 0 ); } else @@ -5008,7 +5070,7 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent ) if ( !aDelData.IsDelete() ) { ImplRemoveDel( &aDelData ); - bKeyInput = FALSE; + bKeyInput = sal_False; } } @@ -5023,25 +5085,26 @@ void MenuFloatingWindow::Paint( const Rectangle& ) long nX = pMenu->pLogo ? pMenu->pLogo->aBitmap.GetSizePixel().Width() : 0; Size aPxSize( GetOutputSizePixel() ); aPxSize.Width() -= nX; + ImplControlValue aVal( pMenu->nTextPos-GUTTERBORDER ); DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, Rectangle( Point( nX, 0 ), aPxSize ), CTRL_STATE_ENABLED, - ImplControlValue(), + aVal, OUString() ); ImplInitClipRegion(); } if ( IsScrollMenu() ) { - ImplDrawScroller( TRUE ); - ImplDrawScroller( FALSE ); + ImplDrawScroller( sal_True ); + ImplDrawScroller( sal_False ); } SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); pMenu->ImplPaint( this, nScrollerHeight, ImplGetStartY() ); if ( nHighlightedItem != ITEMPOS_INVALID ) - HighlightItem( nHighlightedItem, TRUE ); + HighlightItem( nHighlightedItem, sal_True ); } -void MenuFloatingWindow::ImplDrawScroller( BOOL bUp ) +void MenuFloatingWindow::ImplDrawScroller( sal_Bool bUp ) { if( ! pMenu ) return; @@ -5056,7 +5119,7 @@ void MenuFloatingWindow::ImplDrawScroller( BOOL bUp ) DecorationView aDecoView( this ); SymbolType eSymbol = bUp ? SYMBOL_SPIN_UP : SYMBOL_SPIN_DOWN; - USHORT nStyle = 0; + sal_uInt16 nStyle = 0; if ( ( bUp && !bScrollUp ) || ( !bUp && !bScrollDown ) ) nStyle |= SYMBOL_DRAW_DISABLE; @@ -5067,7 +5130,7 @@ void MenuFloatingWindow::ImplDrawScroller( BOOL bUp ) void MenuFloatingWindow::RequestHelp( const HelpEvent& rHEvt ) { - USHORT nId = nHighlightedItem; + sal_uInt16 nId = nHighlightedItem; Menu* pM = pMenu; Window* pW = this; @@ -5091,7 +5154,7 @@ void MenuFloatingWindow::StateChanged( StateChangedType nType ) if ( ( nType == STATE_CHANGE_CONTROLFOREGROUND ) || ( nType == STATE_CHANGE_CONTROLBACKGROUND ) ) { - ImplInitMenuWindow( this, FALSE, FALSE ); + ImplInitMenuWindow( this, sal_False, sal_False ); Invalidate(); } } @@ -5105,7 +5168,7 @@ void MenuFloatingWindow::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - ImplInitMenuWindow( this, FALSE, FALSE ); + ImplInitMenuWindow( this, sal_False, sal_False ); Invalidate(); } } @@ -5145,10 +5208,10 @@ MenuBarWindow::MenuBarWindow( Window* pParent ) : pActivePopup = NULL; nSaveFocusId = 0; nHighlightedItem = ITEMPOS_INVALID; - mbAutoPopup = TRUE; + mbAutoPopup = sal_True; nSaveFocusId = 0; - bIgnoreFirstMove = TRUE; - bStayActive = FALSE; + bIgnoreFirstMove = sal_True; + bStayActive = sal_False; ResMgr* pResMgr = ImplGetResMgr(); @@ -5159,7 +5222,7 @@ MenuBarWindow::MenuBarWindow( Window* pParent ) : aCloser.SetOutStyle( TOOLBOX_STYLE_FLAT ); aCloser.SetBackground(); - aCloser.SetPaintTransparent( TRUE ); + aCloser.SetPaintTransparent( sal_True ); aCloser.SetParentClipMode( PARENTCLIPMODE_NOCLIP ); aCloser.InsertItem( IID_DOCUMENTCLOSE, aCloser.maImage, 0 ); @@ -5192,7 +5255,7 @@ void MenuBarWindow::SetMenu( MenuBar* pMen ) pMenu = pMen; KillActivePopup(); nHighlightedItem = ITEMPOS_INVALID; - ImplInitMenuWindow( this, TRUE, TRUE ); + ImplInitMenuWindow( this, sal_True, sal_True ); if ( pMen ) { aCloser.ShowItem( IID_DOCUMENTCLOSE, pMen->HasCloser() ); @@ -5212,7 +5275,7 @@ void MenuBarWindow::SetMenu( MenuBar* pMen ) } } -void MenuBarWindow::ShowButtons( BOOL bClose, BOOL bFloat, BOOL bHide ) +void MenuBarWindow::ShowButtons( sal_Bool bClose, sal_Bool bFloat, sal_Bool bHide ) { aCloser.ShowItem( IID_DOCUMENTCLOSE, bClose ); aCloser.Show( bClose || ! m_aAddButtons.empty() ); @@ -5240,7 +5303,7 @@ IMPL_LINK( MenuBarWindow, CloserHdl, PushButton*, EMPTYARG ) } else { - std::map<USHORT,AddButtonEntry>::iterator it = m_aAddButtons.find( aCloser.GetCurItemId() ); + std::map<sal_uInt16,AddButtonEntry>::iterator it = m_aAddButtons.find( aCloser.GetCurItemId() ); if( it != m_aAddButtons.end() ) { MenuBar::MenuBarButtonCallbackArg aArg; @@ -5266,10 +5329,10 @@ IMPL_LINK( MenuBarWindow, ToolboxEventHdl, VclWindowEvent*, pEvent ) aArg.nId = aCloser.GetHighlightItemId(); else if( pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHTOFF ) { - USHORT nPos = static_cast< USHORT >(reinterpret_cast<sal_IntPtr>(pEvent->GetData())); + sal_uInt16 nPos = static_cast< sal_uInt16 >(reinterpret_cast<sal_IntPtr>(pEvent->GetData())); aArg.nId = aCloser.GetItemId( nPos ); } - std::map< USHORT, AddButtonEntry >::iterator it = m_aAddButtons.find( aArg.nId ); + std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( aArg.nId ); if( it != m_aAddButtons.end() ) { it->second.m_aHighlightLink.Call( &aArg ); @@ -5299,12 +5362,12 @@ IMPL_LINK( MenuBarWindow, HideHdl, PushButton*, EMPTYARG ) return pMenu ? ((MenuBar*)pMenu)->GetHideButtonClickHdl().Call( pMenu ) : 0; } -void MenuBarWindow::ImplCreatePopup( BOOL bPreSelectFirst ) +void MenuBarWindow::ImplCreatePopup( sal_Bool bPreSelectFirst ) { MenuItemData* pItemData = pMenu ? pMenu->GetItemList()->GetDataFromPos( nHighlightedItem ) : NULL; if ( pItemData ) { - bIgnoreFirstMove = TRUE; + bIgnoreFirstMove = sal_True; if ( pActivePopup && ( pActivePopup != pItemData->pSubMenu ) ) { KillActivePopup(); @@ -5314,7 +5377,7 @@ void MenuBarWindow::ImplCreatePopup( BOOL bPreSelectFirst ) pActivePopup = (PopupMenu*)pItemData->pSubMenu; long nX = 0; MenuItemData* pData = 0; - for ( ULONG n = 0; n < nHighlightedItem; n++ ) + for ( sal_uLong n = 0; n < nHighlightedItem; n++ ) { pData = pMenu->GetItemList()->GetDataFromPos( n ); nX += pData->aSz.Width(); @@ -5361,11 +5424,11 @@ void MenuBarWindow::KillActivePopup() return; // kill it later if ( pActivePopup->bInCallback ) - pActivePopup->bCanceled = TRUE; + pActivePopup->bCanceled = sal_True; - pActivePopup->bInCallback = TRUE; + pActivePopup->bInCallback = sal_True; pActivePopup->Deactivate(); - pActivePopup->bInCallback = FALSE; + pActivePopup->bInCallback = sal_False; // Abfrage auf pActivePopup, falls im Deactivate abgeschossen... if ( pActivePopup && pActivePopup->ImplGetWindow() ) { @@ -5383,22 +5446,22 @@ void MenuBarWindow::PopupClosed( Menu* pPopup ) if ( pPopup == pActivePopup ) { KillActivePopup(); - ChangeHighlightItem( ITEMPOS_INVALID, FALSE, ImplGetFrameWindow()->ImplGetFrameData()->mbHasFocus, FALSE ); + ChangeHighlightItem( ITEMPOS_INVALID, sal_False, ImplGetFrameWindow()->ImplGetFrameData()->mbHasFocus, sal_False ); } } void MenuBarWindow::MouseButtonDown( const MouseEvent& rMEvt ) { - mbAutoPopup = TRUE; - USHORT nEntry = ImplFindEntry( rMEvt.GetPosPixel() ); + mbAutoPopup = sal_True; + sal_uInt16 nEntry = ImplFindEntry( rMEvt.GetPosPixel() ); if ( ( nEntry != ITEMPOS_INVALID ) && ( nEntry != nHighlightedItem ) ) { - ChangeHighlightItem( nEntry, FALSE ); + ChangeHighlightItem( nEntry, sal_False ); } else { KillActivePopup(); - ChangeHighlightItem( ITEMPOS_INVALID, FALSE ); + ChangeHighlightItem( ITEMPOS_INVALID, sal_False ); } } @@ -5414,20 +5477,20 @@ void MenuBarWindow::MouseMove( const MouseEvent& rMEvt ) if( bIgnoreFirstMove ) { - bIgnoreFirstMove = FALSE; + bIgnoreFirstMove = sal_False; return; } - USHORT nEntry = ImplFindEntry( rMEvt.GetPosPixel() ); + sal_uInt16 nEntry = ImplFindEntry( rMEvt.GetPosPixel() ); if ( ( nEntry != ITEMPOS_INVALID ) #ifdef OS2 && ( ImplHilite(rMEvt) ) #endif && ( nEntry != nHighlightedItem ) ) - ChangeHighlightItem( nEntry, FALSE ); + ChangeHighlightItem( nEntry, sal_False ); } -void MenuBarWindow::ChangeHighlightItem( USHORT n, BOOL bSelectEntry, BOOL bAllowRestoreFocus, BOOL bDefaultToDocument) +void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, sal_Bool bSelectEntry, sal_Bool bAllowRestoreFocus, sal_Bool bDefaultToDocument) { if( ! pMenu ) return; @@ -5438,21 +5501,21 @@ void MenuBarWindow::ChangeHighlightItem( USHORT n, BOOL bSelectEntry, BOOL bAllo KillActivePopup(); // pActivePopup ggf. ohne pWin, wenn in Activate() Rescheduled wurde // Activate am MenuBar immer nur einmal pro Vorgang... - BOOL bJustActivated = FALSE; + sal_Bool bJustActivated = sal_False; if ( ( nHighlightedItem == ITEMPOS_INVALID ) && ( n != ITEMPOS_INVALID ) ) { - ImplGetSVData()->maWinData.mbNoDeactivate = TRUE; + ImplGetSVData()->maWinData.mbNoDeactivate = sal_True; if( !bStayActive ) { // #105406# avoid saving the focus when we already have the focus - BOOL bNoSaveFocus = (this == ImplGetSVData()->maWinData.mpFocusWin ); + sal_Bool bNoSaveFocus = (this == ImplGetSVData()->maWinData.mpFocusWin ); if( nSaveFocusId ) { if( !ImplGetSVData()->maWinData.mbNoSaveFocus ) { // we didn't clean up last time - Window::EndSaveFocus( nSaveFocusId, FALSE ); // clean up + Window::EndSaveFocus( nSaveFocusId, sal_False ); // clean up nSaveFocusId = 0; if( !bNoSaveFocus ) nSaveFocusId = Window::SaveFocus(); // only save focus when initially activated @@ -5468,21 +5531,21 @@ void MenuBarWindow::ChangeHighlightItem( USHORT n, BOOL bSelectEntry, BOOL bAllo } } else - bStayActive = FALSE; - pMenu->bInCallback = TRUE; // hier schon setzen, falls Activate ueberladen + bStayActive = sal_False; + pMenu->bInCallback = sal_True; // hier schon setzen, falls Activate ueberladen pMenu->Activate(); - pMenu->bInCallback = FALSE; - bJustActivated = TRUE; + pMenu->bInCallback = sal_False; + bJustActivated = sal_True; } else if ( ( nHighlightedItem != ITEMPOS_INVALID ) && ( n == ITEMPOS_INVALID ) ) { - pMenu->bInCallback = TRUE; + pMenu->bInCallback = sal_True; pMenu->Deactivate(); - pMenu->bInCallback = FALSE; - ImplGetSVData()->maWinData.mbNoDeactivate = FALSE; + pMenu->bInCallback = sal_False; + ImplGetSVData()->maWinData.mbNoDeactivate = sal_False; if( !ImplGetSVData()->maWinData.mbNoSaveFocus ) { - ULONG nTempFocusId = nSaveFocusId; + sal_uLong nTempFocusId = nSaveFocusId; nSaveFocusId = 0; Window::EndSaveFocus( nTempFocusId, bAllowRestoreFocus ); // #105406# restore focus to document if we could not save focus before @@ -5493,13 +5556,13 @@ void MenuBarWindow::ChangeHighlightItem( USHORT n, BOOL bSelectEntry, BOOL bAllo if ( nHighlightedItem != ITEMPOS_INVALID ) { - HighlightItem( nHighlightedItem, FALSE ); + HighlightItem( nHighlightedItem, sal_False ); pMenu->ImplCallEventListeners( VCLEVENT_MENU_DEHIGHLIGHT, nHighlightedItem ); } - nHighlightedItem = (USHORT)n; + nHighlightedItem = (sal_uInt16)n; DBG_ASSERT( ( nHighlightedItem == ITEMPOS_INVALID ) || pMenu->ImplIsVisible( nHighlightedItem ), "ChangeHighlightItem: Not visible!" ); - HighlightItem( nHighlightedItem, TRUE ); + HighlightItem( nHighlightedItem, sal_True ); pMenu->ImplCallHighlight( nHighlightedItem ); if( mbAutoPopup ) @@ -5510,14 +5573,14 @@ void MenuBarWindow::ChangeHighlightItem( USHORT n, BOOL bSelectEntry, BOOL bAllo GrabFocus(); } -void MenuBarWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) +void MenuBarWindow::HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight ) { if( ! pMenu ) return; long nX = 0; - ULONG nCount = pMenu->pItemList->Count(); - for ( ULONG n = 0; n < nCount; n++ ) + sal_uLong nCount = pMenu->pItemList->Count(); + for ( sal_uLong n = 0; n < nCount; n++ ) { MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n ); if ( n == nPos ) @@ -5588,14 +5651,14 @@ void MenuBarWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) } } -Rectangle MenuBarWindow::ImplGetItemRect( USHORT nPos ) +Rectangle MenuBarWindow::ImplGetItemRect( sal_uInt16 nPos ) { Rectangle aRect; if( pMenu ) { long nX = 0; - ULONG nCount = pMenu->pItemList->Count(); - for ( ULONG n = 0; n < nCount; n++ ) + sal_uLong nCount = pMenu->pItemList->Count(); + for ( sal_uLong n = 0; n < nCount; n++ ) { MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n ); if ( n == nPos ) @@ -5618,16 +5681,16 @@ void MenuBarWindow::KeyInput( const KeyEvent& rKEvent ) Window::KeyInput( rKEvent ); } -BOOL MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu ) +sal_Bool MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, sal_Bool bFromMenu ) { if( ! pMenu ) - return FALSE; + return sal_False; if ( pMenu->bInCallback ) - return TRUE; // schlucken + return sal_True; // schlucken - BOOL bDone = FALSE; - USHORT nCode = rKEvent.GetKeyCode().GetCode(); + sal_Bool bDone = sal_False; + sal_uInt16 nCode = rKEvent.GetKeyCode().GetCode(); if( GetParent() ) { @@ -5636,7 +5699,7 @@ BOOL MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu SystemWindow *pSysWin = (SystemWindow*)GetParent()->GetWindow( WINDOW_CLIENT ); if( pSysWin->GetTaskPaneList() ) if( pSysWin->GetTaskPaneList()->HandleKeyEvent( rKEvent ) ) - return TRUE; + return sal_True; } } @@ -5645,22 +5708,22 @@ BOOL MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu mbAutoPopup = ImplGetSVData()->maNWFData.mbOpenMenuOnF10; if ( nHighlightedItem == ITEMPOS_INVALID ) { - ChangeHighlightItem( 0, FALSE ); + ChangeHighlightItem( 0, sal_False ); GrabFocus(); } else { - ChangeHighlightItem( ITEMPOS_INVALID, FALSE ); + ChangeHighlightItem( ITEMPOS_INVALID, sal_False ); nSaveFocusId = 0; } - bDone = TRUE; + bDone = sal_True; } else if ( bFromMenu ) { if ( ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) || ( nCode == KEY_HOME ) || ( nCode == KEY_END ) ) { - USHORT n = nHighlightedItem; + sal_uInt16 n = nHighlightedItem; if ( n == ITEMPOS_INVALID ) { if ( nCode == KEY_LEFT) @@ -5680,10 +5743,10 @@ BOOL MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu bWasHighlight = (pSubWindow->GetHighlightedItem() != ITEMPOS_INVALID); } - USHORT nLoop = n; + sal_uInt16 nLoop = n; if( nCode == KEY_HOME ) - { n = (USHORT)-1; nLoop = n+1; } + { n = (sal_uInt16)-1; nLoop = n+1; } if( nCode == KEY_END ) { n = pMenu->GetItemCount(); nLoop = n-1; } @@ -5706,14 +5769,14 @@ BOOL MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu MenuItemData* pData = (MenuItemData*)pMenu->GetItemList()->GetDataFromPos( n ); if ( ( pData->eType != MENUITEM_SEPARATOR ) && pMenu->ImplIsVisible( n ) ) { - BOOL bDoSelect = TRUE; + sal_Bool bDoSelect = sal_True; if( ImplGetSVData()->maNWFData.mbOpenMenuOnF10 ) bDoSelect = bWasHighlight; ChangeHighlightItem( n, bDoSelect ); break; } } while ( n != nLoop ); - bDone = TRUE; + bDone = sal_True; } else if ( nCode == KEY_RETURN ) { @@ -5721,36 +5784,36 @@ BOOL MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu else if ( !mbAutoPopup ) { - ImplCreatePopup( TRUE ); - mbAutoPopup = TRUE; + ImplCreatePopup( sal_True ); + mbAutoPopup = sal_True; } - bDone = TRUE; + bDone = sal_True; } else if ( ( nCode == KEY_UP ) || ( nCode == KEY_DOWN ) ) { if ( !mbAutoPopup ) { - ImplCreatePopup( TRUE ); - mbAutoPopup = TRUE; + ImplCreatePopup( sal_True ); + mbAutoPopup = sal_True; } - bDone = TRUE; + bDone = sal_True; } else if ( nCode == KEY_ESCAPE || ( nCode == KEY_F6 && rKEvent.GetKeyCode().IsMod1() ) ) { if( pActivePopup ) { // bring focus to menu bar without any open popup - mbAutoPopup = FALSE; - USHORT n = nHighlightedItem; + mbAutoPopup = sal_False; + sal_uInt16 n = nHighlightedItem; nHighlightedItem = ITEMPOS_INVALID; - bStayActive = TRUE; - ChangeHighlightItem( n, FALSE ); - bStayActive = FALSE; + bStayActive = sal_True; + ChangeHighlightItem( n, sal_False ); + bStayActive = sal_False; KillActivePopup(); GrabFocus(); } else - ChangeHighlightItem( ITEMPOS_INVALID, FALSE ); + ChangeHighlightItem( ITEMPOS_INVALID, sal_False ); if( nCode == KEY_F6 && rKEvent.GetKeyCode().IsMod1() ) { @@ -5758,7 +5821,7 @@ BOOL MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu GrabFocusToDocument(); } - bDone = TRUE; + bDone = sal_True; } } @@ -5767,19 +5830,19 @@ BOOL MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu xub_Unicode nCharCode = rKEvent.GetCharCode(); if ( nCharCode ) { - USHORT nEntry, nDuplicates; + sal_uInt16 nEntry, nDuplicates; MenuItemData* pData = pMenu->GetItemList()->SearchItem( nCharCode, rKEvent.GetKeyCode(), nEntry, nDuplicates, nHighlightedItem ); if ( pData && (nEntry != ITEMPOS_INVALID) ) { - mbAutoPopup = TRUE; - ChangeHighlightItem( nEntry, TRUE ); - bDone = TRUE; + mbAutoPopup = sal_True; + ChangeHighlightItem( nEntry, sal_True ); + bDone = sal_True; } else { // Wegen Systemmenu und anderen System-HotKeys, nur // eigenstaendige Character-Kombinationen auswerten - USHORT nKeyCode = rKEvent.GetKeyCode().GetCode(); + sal_uInt16 nKeyCode = rKEvent.GetKeyCode().GetCode(); if ( ((nKeyCode >= KEY_A) && (nKeyCode <= KEY_Z)) ) Sound::Beep(); } @@ -5814,7 +5877,7 @@ void MenuBarWindow::Paint( const Rectangle& ) SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); pMenu->ImplPaint( this, 0 ); if ( nHighlightedItem != ITEMPOS_INVALID ) - HighlightItem( nHighlightedItem, TRUE ); + HighlightItem( nHighlightedItem, sal_True ); // in high contrast mode draw a separating line on the lower edge if( ! IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL) && @@ -5866,20 +5929,20 @@ void MenuBarWindow::Resize() Invalidate(); } -USHORT MenuBarWindow::ImplFindEntry( const Point& rMousePos ) const +sal_uInt16 MenuBarWindow::ImplFindEntry( const Point& rMousePos ) const { if( pMenu ) { long nX = 0; - USHORT nCount = (USHORT)pMenu->pItemList->Count(); - for ( USHORT n = 0; n < nCount; n++ ) + sal_uInt16 nCount = (sal_uInt16)pMenu->pItemList->Count(); + for ( sal_uInt16 n = 0; n < nCount; n++ ) { MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n ); if ( pMenu->ImplIsVisible( n ) ) { nX += pData->aSz.Width(); if ( nX > rMousePos.X() ) - return (USHORT)n; + return (sal_uInt16)n; } } } @@ -5888,9 +5951,9 @@ USHORT MenuBarWindow::ImplFindEntry( const Point& rMousePos ) const void MenuBarWindow::RequestHelp( const HelpEvent& rHEvt ) { - USHORT nId = nHighlightedItem; + sal_uInt16 nId = nHighlightedItem; if ( rHEvt.GetMode() & (HELPMODE_CONTEXT | HELPMODE_EXTENDED) ) - ChangeHighlightItem( ITEMPOS_INVALID, TRUE ); + ChangeHighlightItem( ITEMPOS_INVALID, sal_True ); Rectangle aHighlightRect( ImplGetItemRect( nHighlightedItem ) ); if( !ImplHandleHelpEvent( this, pMenu, nId, rHEvt, aHighlightRect ) ) @@ -5904,7 +5967,7 @@ void MenuBarWindow::StateChanged( StateChangedType nType ) if ( ( nType == STATE_CHANGE_CONTROLFOREGROUND ) || ( nType == STATE_CHANGE_CONTROLBACKGROUND ) ) { - ImplInitMenuWindow( this, FALSE, TRUE ); + ImplInitMenuWindow( this, sal_False, sal_True ); Invalidate(); } else if( pMenu ) @@ -5916,7 +5979,7 @@ void MenuBarWindow::ImplLayoutChanged() { if( pMenu ) { - ImplInitMenuWindow( this, TRUE, TRUE ); + ImplInitMenuWindow( this, sal_True, sal_True ); // Falls sich der Font geaendert hat. long nHeight = pMenu->ImplCalcSize( this ).Height(); @@ -5968,16 +6031,16 @@ void MenuBarWindow::DataChanged( const DataChangedEvent& rDCEvt ) void MenuBarWindow::LoseFocus() { - if ( !HasChildPathFocus( TRUE ) ) - ChangeHighlightItem( ITEMPOS_INVALID, FALSE, FALSE ); + if ( !HasChildPathFocus( sal_True ) ) + ChangeHighlightItem( ITEMPOS_INVALID, sal_False, sal_False ); } void MenuBarWindow::GetFocus() { if ( nHighlightedItem == ITEMPOS_INVALID ) { - mbAutoPopup = FALSE; // do not open menu when activated by focus handling like taskpane cycling - ChangeHighlightItem( 0, FALSE ); + mbAutoPopup = sal_False; // do not open menu when activated by focus handling like taskpane cycling + ChangeHighlightItem( 0, sal_False ); } } @@ -5991,13 +6054,13 @@ void MenuBarWindow::GetFocus() return xAcc; } -USHORT MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link& i_rLink, const String& i_rToolTip, USHORT i_nPos ) +sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link& i_rLink, const String& i_rToolTip, sal_uInt16 i_nPos ) { // find first free button id - USHORT nId = IID_DOCUMENTCLOSE; - std::map< USHORT, AddButtonEntry >::const_iterator it; + sal_uInt16 nId = IID_DOCUMENTCLOSE; + std::map< sal_uInt16, AddButtonEntry >::const_iterator it; if( i_nPos > m_aAddButtons.size() ) - i_nPos = static_cast<USHORT>(m_aAddButtons.size()); + i_nPos = static_cast<sal_uInt16>(m_aAddButtons.size()); do { nId++; @@ -6020,14 +6083,14 @@ USHORT MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link& i_rLi return nId; } -void MenuBarWindow::SetMenuBarButtonHighlightHdl( USHORT nId, const Link& rLink ) +void MenuBarWindow::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link& rLink ) { - std::map< USHORT, AddButtonEntry >::iterator it = m_aAddButtons.find( nId ); + std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( nId ); if( it != m_aAddButtons.end() ) it->second.m_aHighlightLink = rLink; } -Rectangle MenuBarWindow::GetMenuBarButtonRectPixel( USHORT nId ) +Rectangle MenuBarWindow::GetMenuBarButtonRectPixel( sal_uInt16 nId ) { Rectangle aRect; if( m_aAddButtons.find( nId ) != m_aAddButtons.end() ) @@ -6052,9 +6115,9 @@ Rectangle MenuBarWindow::GetMenuBarButtonRectPixel( USHORT nId ) return aRect; } -void MenuBarWindow::RemoveMenuBarButton( USHORT nId ) +void MenuBarWindow::RemoveMenuBarButton( sal_uInt16 nId ) { - USHORT nPos = aCloser.GetItemPos( nId ); + sal_uInt16 nPos = aCloser.GetItemPos( nId ); aCloser.RemoveItem( nPos ); m_aAddButtons.erase( nId ); aCloser.calcMinSize(); @@ -6064,9 +6127,9 @@ void MenuBarWindow::RemoveMenuBarButton( USHORT nId ) pMenu->mpSalMenu->RemoveMenuBarButton( nId ); } -bool MenuBarWindow::HandleMenuButtonEvent( USHORT i_nButtonId ) +bool MenuBarWindow::HandleMenuButtonEvent( sal_uInt16 i_nButtonId ) { - std::map< USHORT, AddButtonEntry >::iterator it = m_aAddButtons.find( i_nButtonId ); + std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( i_nButtonId ); if( it != m_aAddButtons.end() ) { MenuBar::MenuBarButtonCallbackArg aArg; @@ -6075,7 +6138,7 @@ bool MenuBarWindow::HandleMenuButtonEvent( USHORT i_nButtonId ) aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu); return it->second.m_aSelectLink.Call( &aArg ); } - return FALSE; + return sal_False; } ImplMenuDelData::ImplMenuDelData( const Menu* pMenu ) diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx index 3b61abb81bee..ca8bcf3c2917 100644 --- a/vcl/source/window/mnemonic.cxx +++ b/vcl/source/window/mnemonic.cxx @@ -49,9 +49,9 @@ MnemonicGenerator::MnemonicGenerator() // ----------------------------------------------------------------------- -USHORT MnemonicGenerator::ImplGetMnemonicIndex( sal_Unicode c ) +sal_uInt16 MnemonicGenerator::ImplGetMnemonicIndex( sal_Unicode c ) { - static USHORT const aImplMnemonicRangeTab[MNEMONIC_RANGES*2] = + static sal_uInt16 const aImplMnemonicRangeTab[MNEMONIC_RANGES*2] = { MNEMONIC_RANGE_1_START, MNEMONIC_RANGE_1_END, MNEMONIC_RANGE_2_START, MNEMONIC_RANGE_2_END, @@ -59,8 +59,8 @@ USHORT MnemonicGenerator::ImplGetMnemonicIndex( sal_Unicode c ) MNEMONIC_RANGE_4_START, MNEMONIC_RANGE_4_END }; - USHORT nMnemonicIndex = 0; - for ( USHORT i = 0; i < MNEMONIC_RANGES; i++ ) + sal_uInt16 nMnemonicIndex = 0; + for ( sal_uInt16 i = 0; i < MNEMONIC_RANGES; i++ ) { if ( (c >= aImplMnemonicRangeTab[i*2]) && (c <= aImplMnemonicRangeTab[i*2+1]) ) @@ -107,7 +107,7 @@ void MnemonicGenerator::RegisterMnemonic( const XubString& rKey ) sal_Unicode cMnemonic = ImplFindMnemonic( aKey ); if ( cMnemonic ) { - USHORT nMnemonicIndex = ImplGetMnemonicIndex( cMnemonic ); + sal_uInt16 nMnemonicIndex = ImplGetMnemonicIndex( cMnemonic ); if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND ) maMnemonics[nMnemonicIndex] = 0; } @@ -119,7 +119,7 @@ void MnemonicGenerator::RegisterMnemonic( const XubString& rKey ) { sal_Unicode c = aKey.GetChar( nIndex ); - USHORT nMnemonicIndex = ImplGetMnemonicIndex( c ); + sal_uInt16 nMnemonicIndex = ImplGetMnemonicIndex( c ); if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND ) { if ( maMnemonics[nMnemonicIndex] && (maMnemonics[nMnemonicIndex] < 0xFF) ) @@ -133,24 +133,24 @@ void MnemonicGenerator::RegisterMnemonic( const XubString& rKey ) // ----------------------------------------------------------------------- -BOOL MnemonicGenerator::CreateMnemonic( XubString& rKey ) +sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey ) { if ( !rKey.Len() || ImplFindMnemonic( rKey ) ) - return FALSE; + return sal_False; const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetUILocale(); uno::Reference < i18n::XCharacterClassification > xCharClass = GetCharClass(); // Don't crash even when we don't have access to i18n service if ( !xCharClass.is() ) - return FALSE; + return sal_False; XubString aKey = xCharClass->toUpper( rKey, 0, rKey.Len(), rLocale ); - BOOL bChanged = FALSE; + sal_Bool bChanged = sal_False; xub_StrLen nLen = aKey.Len(); - BOOL bCJK = FALSE; + sal_Bool bCJK = sal_False; switch( Application::GetSettings().GetUILanguage() ) { case LANGUAGE_JAPANESE: @@ -161,7 +161,7 @@ BOOL MnemonicGenerator::CreateMnemonic( XubString& rKey ) case LANGUAGE_CHINESE_MACAU: case LANGUAGE_KOREAN: case LANGUAGE_KOREAN_JOHAB: - bCJK = TRUE; + bCJK = sal_True; break; default: break; @@ -173,8 +173,8 @@ BOOL MnemonicGenerator::CreateMnemonic( XubString& rKey ) // #110720#, avoid CJK-style mnemonics for latin-only strings that do not contain useful mnemonic chars if( bCJK ) { - BOOL bLatinOnly = TRUE; - BOOL bMnemonicIndexFound = FALSE; + sal_Bool bLatinOnly = sal_True; + sal_Bool bMnemonicIndexFound = sal_False; sal_Unicode c; xub_StrLen nIndex; @@ -184,19 +184,19 @@ BOOL MnemonicGenerator::CreateMnemonic( XubString& rKey ) if ( ((c >= 0x3000) && (c <= 0xD7FF)) || // cjk ((c >= 0xFF61) && (c <= 0xFFDC)) ) // halfwidth forms { - bLatinOnly = FALSE; + bLatinOnly = sal_False; break; } if( ImplGetMnemonicIndex( c ) != MNEMONIC_INDEX_NOTFOUND ) - bMnemonicIndexFound = TRUE; + bMnemonicIndexFound = sal_True; } if( bLatinOnly && !bMnemonicIndexFound ) - return FALSE; + return sal_False; } int nCJK = 0; - USHORT nMnemonicIndex; + sal_uInt16 nMnemonicIndex; sal_Unicode c; xub_StrLen nIndex = 0; if( !bCJK ) @@ -226,7 +226,7 @@ BOOL MnemonicGenerator::CreateMnemonic( XubString& rKey ) { maMnemonics[nMnemonicIndex] = 0; rKey.Insert( MNEMONIC_CHAR, nIndex ); - bChanged = TRUE; + bChanged = sal_True; break; } } @@ -247,8 +247,8 @@ BOOL MnemonicGenerator::CreateMnemonic( XubString& rKey ) // 2) search for a unique/uncommon character if ( !bChanged ) { - USHORT nBestCount = 0xFFFF; - USHORT nBestMnemonicIndex = 0; + sal_uInt16 nBestCount = 0xFFFF; + sal_uInt16 nBestMnemonicIndex = 0; xub_StrLen nBestIndex = 0; nIndex = 0; do @@ -278,7 +278,7 @@ BOOL MnemonicGenerator::CreateMnemonic( XubString& rKey ) { maMnemonics[nBestMnemonicIndex] = 0; rKey.Insert( MNEMONIC_CHAR, nBestIndex ); - bChanged = TRUE; + bChanged = sal_True; } } } @@ -326,7 +326,7 @@ BOOL MnemonicGenerator::CreateMnemonic( XubString& rKey ) nIndex--; } rKey.Insert( aStr, nIndex ); - bChanged = TRUE; + bChanged = sal_True; break; } } @@ -351,7 +351,7 @@ BOOL MnemonicGenerator::CreateMnemonic( XubString& rKey ) // { // maMnemonics[nMnemonicIndex] = 0; // rKey.Insert( MNEMONIC_CHAR, nIndex ); -// bChanged = TRUE; +// bChanged = sal_True; // break; // } // diff --git a/vcl/source/window/mnemonicengine.cxx b/vcl/source/window/mnemonicengine.cxx index f76c29e5ba9c..1ca9f2c22d57 100644 --- a/vcl/source/window/mnemonicengine.cxx +++ b/vcl/source/window/mnemonicengine.cxx @@ -103,7 +103,7 @@ namespace vcl //-------------------------------------------------------------------- bool MnemonicEngine::HandleKeyEvent( const KeyEvent& _rKEvt ) { - BOOL bAccelKey = _rKEvt.GetKeyCode().IsMod2(); + sal_Bool bAccelKey = _rKEvt.GetKeyCode().IsMod2(); if ( !bAccelKey ) return false; diff --git a/vcl/source/window/mouseevent.cxx b/vcl/source/window/mouseevent.cxx index 4dbb7385f94f..2e76750e1cf5 100644 --- a/vcl/source/window/mouseevent.cxx +++ b/vcl/source/window/mouseevent.cxx @@ -39,7 +39,7 @@ MouseEvent::MouseEvent( const ::com::sun::star::awt::MouseEvent& rEvent ) : maPos( rEvent.X, rEvent.Y ) , mnMode( 0 ) -, mnClicks( static_cast< USHORT >( rEvent.ClickCount ) ) +, mnClicks( static_cast< sal_uInt16 >( rEvent.ClickCount ) ) , mnCode( 0 ) { if( rEvent.Modifiers ) diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index 07eafcac357a..ae4c148d5807 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -70,10 +70,10 @@ void MessBox::ImplInitMessBoxData() mpFixedText = NULL; mpFixedImage = NULL; mnSoundType = 0; - mbHelpBtn = FALSE; - mbSound = TRUE; + mbHelpBtn = sal_False; + mbSound = sal_True; mpCheckBox = NULL; - mbCheck = FALSE; + mbCheck = sal_False; } // ----------------------------------------------------------------------- @@ -81,11 +81,11 @@ void MessBox::ImplInitMessBoxData() void MessBox::ImplInitButtons() { WinBits nStyle = GetStyle(); - USHORT nOKFlags = BUTTONDIALOG_OKBUTTON; - USHORT nCancelFlags = BUTTONDIALOG_CANCELBUTTON; - USHORT nRetryFlags = 0; - USHORT nYesFlags = 0; - USHORT nNoFlags = 0; + sal_uInt16 nOKFlags = BUTTONDIALOG_OKBUTTON; + sal_uInt16 nCancelFlags = BUTTONDIALOG_CANCELBUTTON; + sal_uInt16 nRetryFlags = 0; + sal_uInt16 nYesFlags = 0; + sal_uInt16 nNoFlags = 0; if ( nStyle & WB_OK_CANCEL ) { @@ -133,8 +133,8 @@ void MessBox::ImplInitButtons() } else if ( nStyle & WB_ABORT_RETRY_IGNORE ) { - USHORT nAbortFlags = 0; - USHORT nIgnoreFlags = 0; + sal_uInt16 nAbortFlags = 0; + sal_uInt16 nIgnoreFlags = 0; if ( nStyle & WB_DEF_CANCEL ) nAbortFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON; @@ -186,16 +186,15 @@ MessBox::MessBox( Window* pParent, const ResId& rResId ) : ImplInitMessBoxData(); GetRes( rResId.SetRT( RSC_MESSBOX ) ); - USHORT nHiButtons = ReadShortRes(); - USHORT nLoButtons = ReadShortRes(); - USHORT nHiDefButton = ReadShortRes(); - USHORT nLoDefButton = ReadShortRes(); - USHORT nHiHelpId = ReadShortRes(); - USHORT nLoHelpId = ReadShortRes(); - /* USHORT bSysModal = */ ReadShortRes(); - SetHelpId( ((ULONG)nHiHelpId << 16) + nLoHelpId ); - WinBits nBits = (((ULONG)nHiButtons << 16) + nLoButtons) | - (((ULONG)nHiDefButton << 16) + nLoDefButton); + sal_uInt16 nHiButtons = ReadShortRes(); + sal_uInt16 nLoButtons = ReadShortRes(); + sal_uInt16 nHiDefButton = ReadShortRes(); + sal_uInt16 nLoDefButton = ReadShortRes(); + rtl::OString aHelpId( ReadByteStringRes() ); + /* sal_uInt16 bSysModal = */ ReadShortRes(); + SetHelpId( aHelpId ); + WinBits nBits = (((sal_uLong)nHiButtons << 16) + nLoButtons) | + (((sal_uLong)nHiDefButton << 16) + nLoDefButton); ImplInit( pParent, nBits | WB_MOVEABLE | WB_HORZ | WB_CENTER ); ImplLoadRes( rResId ); @@ -227,12 +226,12 @@ MessBox::~MessBox() void MessBox::ImplPosControls() { - if ( GetHelpId() ) + if ( GetHelpId().getLength() ) { if ( !mbHelpBtn ) { AddButton( BUTTON_HELP, BUTTONID_HELP, BUTTONDIALOG_HELPBUTTON, 3 ); - mbHelpBtn = TRUE; + mbHelpBtn = sal_True; } } else @@ -240,7 +239,7 @@ void MessBox::ImplPosControls() if ( mbHelpBtn ) { RemoveButton( BUTTONID_HELP ); - mbHelpBtn = FALSE; + mbHelpBtn = sal_False; } } @@ -258,7 +257,7 @@ void MessBox::ImplPosControls() long nMaxLineWidth; long nWidth; WinBits nWinStyle = WB_LEFT | WB_WORDBREAK | WB_NOLABEL | WB_INFO; - USHORT nTextStyle = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | TEXT_DRAW_LEFT; + sal_uInt16 nTextStyle = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | TEXT_DRAW_LEFT; if ( mpFixedText ) delete mpFixedText; @@ -277,7 +276,7 @@ void MessBox::ImplPosControls() // Message-Text um Tabs bereinigen XubString aTabStr( RTL_CONSTASCII_USTRINGPARAM( " " ) ); - USHORT nIndex = 0; + sal_uInt16 nIndex = 0; while ( nIndex != STRING_NOTFOUND ) nIndex = aMessText.SearchAndReplace( '\t', aTabStr, nIndex ); @@ -414,6 +413,8 @@ void MessBox::ImplPosControls() } mpFixedText = new FixedText( this, nWinStyle ); + if( mpFixedText->GetStyle() & WB_EXTRAOFFSET ) // TODO: use CalcMinimumSize() instead + aFixedSize.Width() += 2; mpFixedText->SetPosSizePixel( aTextPos, aFixedSize ); mpFixedText->SetText( aMessText ); mpFixedText->Show(); @@ -435,14 +436,14 @@ void MessBox::StateChanged( StateChangedType nType ) // ----------------------------------------------------------------------- -BOOL MessBox::GetCheckBoxState() const +sal_Bool MessBox::GetCheckBoxState() const { return mpCheckBox ? mpCheckBox->IsChecked() : mbCheck; } // ----------------------------------------------------------------------- -void MessBox::SetCheckBoxState( BOOL bCheck ) +void MessBox::SetCheckBoxState( sal_Bool bCheck ) { if( mpCheckBox ) mpCheckBox->Check( bCheck ); mbCheck = bCheck; @@ -459,10 +460,10 @@ void MessBox::SetDefaultCheckBoxText() // ----------------------------------------------------------------------- -BOOL MessBox::SetModeImage( const Image& rImage ) +sal_Bool MessBox::SetModeImage( const Image& rImage ) { SetImage( rImage ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -494,7 +495,7 @@ void InfoBox::ImplInitInfoBoxData() SetText( Application::GetDisplayName() ); SetImage( InfoBox::GetStandardImage() ); - mnSoundType = ((USHORT)SOUND_INFO)+1; + mnSoundType = ((sal_uInt16)SOUND_INFO)+1; } // ----------------------------------------------------------------------- @@ -530,7 +531,7 @@ void WarningBox::ImplInitWarningBoxData() SetText( Application::GetDisplayName() ); SetImage( WarningBox::GetStandardImage() ); - mnSoundType = ((USHORT)SOUND_WARNING)+1; + mnSoundType = ((sal_uInt16)SOUND_WARNING)+1; } // ----------------------------------------------------------------------- @@ -576,7 +577,7 @@ void ErrorBox::ImplInitErrorBoxData() SetText( Application::GetDisplayName() ); SetImage( ErrorBox::GetStandardImage() ); - mnSoundType = ((USHORT)SOUND_ERROR)+1; + mnSoundType = ((sal_uInt16)SOUND_ERROR)+1; } // ----------------------------------------------------------------------- @@ -613,7 +614,7 @@ void QueryBox::ImplInitQueryBoxData() SetText( Application::GetDisplayName() ); SetImage( QueryBox::GetStandardImage() ); - mnSoundType = ((USHORT)SOUND_QUERY)+1; + mnSoundType = ((sal_uInt16)SOUND_QUERY)+1; } // ----------------------------------------------------------------------- diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 4932b689a9c2..40b80e234ff3 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -47,7 +47,7 @@ #include "unotools/localedatawrapper.hxx" -#include "rtl/ustrbuf.hxx" +#include "rtl/strbuf.hxx" #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/container/XNameAccess.hpp" @@ -61,19 +61,23 @@ using namespace com::sun::star::lang; using namespace com::sun::star::container; using namespace com::sun::star::beans; -#define HELPID_PREFIX ".HelpId:vcl:PrintDialog" -#define SMHID2( a, b ) SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( HELPID_PREFIX ":" a ":" b ) ), HID_PRINTDLG ) ) -#define SMHID1( a ) SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( HELPID_PREFIX ":" a ) ), HID_PRINTDLG ) ) - PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const ResId& i_rId ) : Window( i_pParent, i_rId ) , maOrigSize( 10, 10 ) , maPageVDev( *this ) , maToolTipString( String( VclResId( SV_PRINT_PRINTPREVIEW_TXT ) ) ) + , mbGreyscale( false ) + , maHorzDim( this, WB_HORZ | WB_CENTER ) + , maVertDim( this, WB_VERT | WB_VCENTER ) { - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); maPageVDev.SetBackground( Color( COL_WHITE ) ); + maHorzDim.Show(); + maVertDim.Show(); + + maHorzDim.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "2.0in" ) ) ); + maVertDim.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "2.0in" ) ) ); } PrintDialog::PrintPreviewWindow::~PrintPreviewWindow() @@ -93,9 +97,10 @@ void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDC void PrintDialog::PrintPreviewWindow::Resize() { Size aNewSize( GetSizePixel() ); + long nTextHeight = maHorzDim.GetTextHeight(); // leave small space for decoration - aNewSize.Width() -= 2; - aNewSize.Height() -= 2; + aNewSize.Width() -= nTextHeight + 2; + aNewSize.Height() -= nTextHeight + 2; Size aScaledSize; double fScale = 1.0; @@ -136,17 +141,29 @@ void PrintDialog::PrintPreviewWindow::Resize() fZoom /= 2.0; } - maPageVDev.SetOutputSizePixel( aScaledSize, FALSE ); + maPageVDev.SetOutputSizePixel( aScaledSize, sal_False ); + + // position dimension lines + Point aRef( nTextHeight + (aNewSize.Width() - maPreviewSize.Width())/2, + nTextHeight + (aNewSize.Height() - maPreviewSize.Height())/2 ); + maHorzDim.SetPosSizePixel( Point( aRef.X(), aRef.Y() - nTextHeight ), + Size( maPreviewSize.Width(), nTextHeight ) ); + maVertDim.SetPosSizePixel( Point( aRef.X() - nTextHeight, aRef.Y() ), + Size( nTextHeight, maPreviewSize.Height() ) ); + } void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) { + long nTextHeight = maHorzDim.GetTextHeight(); Size aSize( GetSizePixel() ); + aSize.Width() -= nTextHeight; + aSize.Height() -= nTextHeight; if( maReplacementString.getLength() != 0 ) { // replacement is active Push(); - Rectangle aTextRect( Point( 0, 0 ), aSize ); + Rectangle aTextRect( Point( nTextHeight, nTextHeight ), aSize ); DecorationView aVw( this ); aVw.DrawFrame( aTextRect, FRAME_DRAW_GROUP ); aTextRect.Left() += 2; @@ -164,8 +181,8 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) { GDIMetaFile aMtf( maMtf ); - Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2, - (aSize.Height() - maPreviewSize.Height()) / 2 ); + Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2 + nTextHeight, + (aSize.Height() - maPreviewSize.Height()) / 2 + nTextHeight ); Size aVDevSize( maPageVDev.GetOutputSizePixel() ); const Size aLogicSize( maPageVDev.PixelToLogic( aVDevSize, MapMode( MAP_100TH_MM ) ) ); @@ -180,6 +197,11 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) maPageVDev.Erase(); maPageVDev.Push(); maPageVDev.SetMapMode( MAP_100TH_MM ); + sal_uLong nOldDrawMode = maPageVDev.GetDrawMode(); + if( mbGreyscale ) + maPageVDev.SetDrawMode( maPageVDev.GetDrawMode() | + ( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT | + DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) ); aMtf.WindStart(); aMtf.Scale( fScale, fScale ); aMtf.WindStart(); @@ -189,6 +211,7 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) SetMapMode( MAP_PIXEL ); maPageVDev.SetMapMode( MAP_PIXEL ); DrawOutDev( aOffset, maPreviewSize, Point( 0, 0 ), aVDevSize, maPageVDev ); + maPageVDev.SetDrawMode( nOldDrawMode ); DecorationView aVw( this ); Rectangle aFrame( aOffset + Point( -1, -1 ), Size( maPreviewSize.Width() + 2, maPreviewSize.Height() + 2 ) ); @@ -218,27 +241,50 @@ void PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt ) void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPreview, const Size& i_rOrigSize, + const rtl::OUString& i_rPaperName, const rtl::OUString& i_rReplacement, sal_Int32 i_nDPIX, - sal_Int32 i_nDPIY + sal_Int32 i_nDPIY, + bool i_bGreyscale ) { rtl::OUStringBuffer aBuf( 256 ); aBuf.append( maToolTipString ); - #if OSL_DEBUG_LEVEL > 0 - aBuf.appendAscii( "\n---\nPageSize: " ); - aBuf.append( sal_Int32( i_rOrigSize.Width()/100) ); - aBuf.appendAscii( "mm x " ); - aBuf.append( sal_Int32( i_rOrigSize.Height()/100) ); - aBuf.appendAscii( "mm" ); - #endif SetQuickHelpText( aBuf.makeStringAndClear() ); maMtf = i_rNewPreview; maOrigSize = i_rOrigSize; maReplacementString = i_rReplacement; + mbGreyscale = i_bGreyscale; maPageVDev.SetReferenceDevice( i_nDPIX, i_nDPIY ); - maPageVDev.EnableOutput( TRUE ); + maPageVDev.EnableOutput( sal_True ); + + // use correct measurements + const LocaleDataWrapper& rLocWrap( GetSettings().GetLocaleDataWrapper() ); + MapUnit eUnit = MAP_MM; + int nDigits = 0; + if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US ) + { + eUnit = MAP_100TH_INCH; + nDigits = 2; + } + Size aLogicPaperSize( LogicToLogic( i_rOrigSize, MapMode( MAP_100TH_MM ), MapMode( eUnit ) ) ); + String aNumText( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) ); + aBuf.append( aNumText ); + aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" ); + if( i_rPaperName.getLength() ) + { + aBuf.appendAscii( " (" ); + aBuf.append( i_rPaperName ); + aBuf.append( sal_Unicode(')') ); + } + maHorzDim.SetText( aBuf.makeStringAndClear() ); + + aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits ); + aBuf.append( aNumText ); + aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" ); + maVertDim.SetText( aBuf.makeStringAndClear() ); + Resize(); Invalidate(); } @@ -291,12 +337,18 @@ void PrintDialog::ShowNupOrderWindow::Paint( const Rectangle& i_rRect ) int nX = 0, nY = 0; switch( mnOrderMode ) { - case SV_PRINT_PRT_NUP_ORDER_LRTD: + case SV_PRINT_PRT_NUP_ORDER_LRTB: nX = (i % mnColumns); nY = (i / mnColumns); break; - case SV_PRINT_PRT_NUP_ORDER_TDLR: + case SV_PRINT_PRT_NUP_ORDER_TBLR: nX = (i / mnRows); nY = (i % mnRows); break; + case SV_PRINT_PRT_NUP_ORDER_RLTB: + nX = mnColumns - 1 - (i % mnColumns); nY = (i / mnColumns); + break; + case SV_PRINT_PRT_NUP_ORDER_TBRL: + nX = mnColumns - 1 - (i / mnRows); nY = (i % mnRows); + break; } Size aTextSize( GetTextWidth( aPageText ), nTextHeight ); int nDeltaX = (aSubSize.Width() - aTextSize.Width()) / 2; @@ -336,13 +388,13 @@ PrintDialog::NUpTabPage::NUpTabPage( Window* i_pParent, const ResId& rResId ) FreeResource(); maNupOrderWin.Show(); - maPagesBtn.Check( TRUE ); - maBrochureBtn.Show( FALSE ); + maPagesBtn.Check( sal_True ); + maBrochureBtn.Show( sal_False ); // setup field units for metric fields const LocaleDataWrapper& rLocWrap( maPageMarginEdt.GetLocaleDataWrapper() ); FieldUnit eUnit = FUNIT_MM; - USHORT nDigits = 0; + sal_uInt16 nDigits = 0; if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US ) { eUnit = FUNIT_INCH; @@ -356,28 +408,6 @@ PrintDialog::NUpTabPage::NUpTabPage( Window* i_pParent, const ResId& rResId ) maPageMarginEdt.SetDecimalDigits( nDigits ); maSheetMarginEdt.SetDecimalDigits( nDigits ); - SMHID1( "NUpPage" ); - maNupLine.SMHID2("NUpPage", "Layout"); - maBrochureBtn.SMHID2("NUpPage", "Brochure" ); - maPagesBtn.SMHID2( "NUpPage", "PagesPerSheet" ); - maPagesBoxTitleTxt.SMHID2( "NUpPage", "PagesPerSheetLabel" ); - maNupPagesBox.SMHID2( "NUpPage", "PagesPerSheetBox" ); - maNupNumPagesTxt.SMHID2( "NUpPage", "Columns" ); - maNupColEdt.SMHID2( "NUpPage", "ColumnsBox" ); - maNupTimesTxt.SMHID2( "NUpPage", "Rows" ); - maNupRowsEdt.SMHID2( "NUpPage", "RowsBox" ); - maPageMarginTxt1.SMHID2( "NUpPage", "PageMargin" ); - maPageMarginEdt.SMHID2( "NUpPage", "PageMarginBox" ); - maPageMarginTxt2.SMHID2( "NUpPage", "PageMarginCont" ); - maSheetMarginTxt1.SMHID2( "NUpPage", "SheetMargin" ); - maSheetMarginEdt.SMHID2( "NUpPage", "SheetMarginBox" ); - maSheetMarginTxt2.SMHID2( "NUpPage", "SheetMarginCont" ); - maNupOrientationTxt.SMHID2( "NUpPage", "Orientation" ); - maNupOrientationBox.SMHID2( "NUpPage", "OrientationBox" ); - maNupOrderTxt.SMHID2( "NUpPage", "Order" ); - maNupOrderBox.SMHID2( "NUpPage", "OrderBox" ); - maBorderCB.SMHID2( "NUpPage", "BorderBox" ); - setupLayout(); } @@ -387,7 +417,7 @@ PrintDialog::NUpTabPage::~NUpTabPage() void PrintDialog::NUpTabPage::enableNupControls( bool bEnable ) { - maNupPagesBox.Enable( TRUE ); + maNupPagesBox.Enable( sal_True ); maNupNumPagesTxt.Enable( bEnable ); maNupColEdt.Enable( bEnable ); maNupTimesTxt.Enable( bEnable ); @@ -420,22 +450,21 @@ void PrintDialog::NUpTabPage::showAdvancedControls( bool i_bShow ) maSheetMarginTxt2.Show( i_bShow ); maNupOrientationTxt.Show( i_bShow ); maNupOrientationBox.Show( i_bShow ); - maLayout.resize(); + getLayout()->resize(); } void PrintDialog::NUpTabPage::setupLayout() { + boost::shared_ptr<vcl::RowOrColumn> xLayout = + boost::dynamic_pointer_cast<vcl::RowOrColumn>( getLayout() ); Size aBorder( LogicToPixel( Size( 6, 6 ), MapMode( MAP_APPFONT ) ) ); /* According to OOo style guide, the horizontal indentation of child elements to their parent element should always be 6 map units. */ long nIndent = aBorder.Width(); - maLayout.setParentWindow( this ); - maLayout.setOuterBorder( aBorder.Width() ); - - maLayout.addWindow( &maNupLine ); - boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &maLayout, false ) ); - maLayout.addChild( xRow ); + xLayout->addWindow( &maNupLine ); + boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( xLayout.get(), false ) ); + xLayout->addChild( xRow ); boost::shared_ptr< vcl::Indenter > xIndent( new vcl::Indenter( xRow.get() ) ); xRow->addChild( xIndent ); @@ -471,7 +500,7 @@ void PrintDialog::NUpTabPage::setupLayout() xMainCol->addRow( &maNupOrderTxt, &maNupOrderBox, nIndent ); xMainCol->setBorders( xMainCol->addWindow( &maBorderCB ), nIndent, 0, 0, 0 ); - xSpacer.reset( new vcl::Spacer( xMainCol.get(), 0, Size( 10, aBorder.Width() ) ) ); + xSpacer.reset( new vcl::Spacer( xMainCol.get(), 0, Size( 10, WindowArranger::getDefaultBorder() ) ) ); xMainCol->addChild( xSpacer ); xRow.reset( new vcl::RowOrColumn( xMainCol.get(), false ) ); @@ -483,11 +512,6 @@ void PrintDialog::NUpTabPage::setupLayout() showAdvancedControls( false ); } -void PrintDialog::NUpTabPage::Resize() -{ - maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) ); -} - void PrintDialog::NUpTabPage::initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& i_rMPS ) { maSheetMarginEdt.SetValue( maSheetMarginEdt.Normalize( i_rMPS.nLeftMargin ), FUNIT_100TH_MM ); @@ -523,30 +547,13 @@ PrintDialog::JobTabPage::JobTabPage( Window* i_pParent, const ResId& rResId ) , maCopyCountField( this, VclResId( SV_PRINT_COPYCOUNT_FIELD ) ) , maCollateBox( this, VclResId( SV_PRINT_COLLATE ) ) , maCollateImage( this, VclResId( SV_PRINT_COLLATE_IMAGE ) ) + , maReverseOrderBox( this, VclResId( SV_PRINT_OPT_REVERSE ) ) , maCollateImg( VclResId( SV_PRINT_COLLATE_IMG ) ) , maNoCollateImg( VclResId( SV_PRINT_NOCOLLATE_IMG ) ) , mnCollateUIMode( 0 ) - , maLayout( NULL, true ) { FreeResource(); - SMHID1( "JobPage" ); - maPrinterFL.SMHID2( "JobPage", "Printer" ); - maPrinters.SMHID2( "JobPage", "PrinterList" ); - maDetailsBtn.SMHID2( "JobPage", "DetailsBtn" ); - maStatusLabel.SMHID2( "JobPage", "StatusLabel" ); - maStatusTxt.SMHID2( "JobPage", "StatusText" ); - maLocationLabel.SMHID2( "JobPage", "LocationLabel" ); - maLocationTxt.SMHID2( "JobPage", "LocationText" ); - maCommentLabel.SMHID2( "JobPage", "CommentLabel" ); - maCommentTxt.SMHID2( "JobPage", "CommentText" ); - maSetupButton.SMHID2( "JobPage", "Properties" ); - maCopies.SMHID2( "JobPage", "CopiesLine" ); - maCopySpacer.SMHID2( "JobPage", "CopySpacer" ); - maCopyCount.SMHID2( "JobPage", "CopiesText" ); - maCopyCountField.SMHID2( "JobPage", "Copies" ); - maCollateBox.SMHID2( "JobPage", "Collate" ); - maCollateImage.SMHID2( "JobPage", "CollateImage" ); maCopySpacer.Show(); maStatusTxt.Show(); @@ -566,39 +573,37 @@ void PrintDialog::JobTabPage::setupLayout() // sets the results of GetOptimalSize in a normal ListBox maPrinters.SetDropDownLineCount( 4 ); - Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); - - maLayout.setParentWindow( this ); - maLayout.setOuterBorder( aBorder.Width() ); + boost::shared_ptr<vcl::RowOrColumn> xLayout = + boost::dynamic_pointer_cast<vcl::RowOrColumn>( getLayout() ); // add printer fixed line - maLayout.addWindow( &maPrinterFL ); + xLayout->addWindow( &maPrinterFL ); // add print LB - maLayout.addWindow( &maPrinters, 3 ); + xLayout->addWindow( &maPrinters, 3 ); // create a row for details button/text and properties button - boost::shared_ptr< vcl::RowOrColumn > xDetRow( new vcl::RowOrColumn( &maLayout, false ) ); - maLayout.addChild( xDetRow ); + boost::shared_ptr< vcl::RowOrColumn > xDetRow( new vcl::RowOrColumn( xLayout.get(), false ) ); + xLayout->addChild( xDetRow ); xDetRow->addWindow( &maDetailsBtn ); xDetRow->addChild( new vcl::Spacer( xDetRow.get(), 2 ) ); xDetRow->addWindow( &maSetupButton ); // create an indent for details - boost::shared_ptr< vcl::Indenter > xIndent( new vcl::Indenter( &maLayout ) ); - maLayout.addChild( xIndent ); + boost::shared_ptr< vcl::Indenter > xIndent( new vcl::Indenter( xLayout.get() ) ); + xLayout->addChild( xIndent ); // remember details controls mxDetails = xIndent; // create a column for the details - boost::shared_ptr< vcl::LabelColumn > xLabelCol( new vcl::LabelColumn( xIndent.get(), aBorder.Height() ) ); + boost::shared_ptr< vcl::LabelColumn > xLabelCol( new vcl::LabelColumn( xIndent.get() ) ); xIndent->setChild( xLabelCol ); xLabelCol->addRow( &maStatusLabel, &maStatusTxt ); xLabelCol->addRow( &maLocationLabel, &maLocationTxt ); xLabelCol->addRow( &maCommentLabel, &maCommentTxt ); // add print range and copies columns - maLayout.addWindow( &maCopies ); - boost::shared_ptr< vcl::RowOrColumn > xRangeRow( new vcl::RowOrColumn( &maLayout, false, aBorder.Width() ) ); - maLayout.addChild( xRangeRow ); + xLayout->addWindow( &maCopies ); + boost::shared_ptr< vcl::RowOrColumn > xRangeRow( new vcl::RowOrColumn( xLayout.get(), false ) ); + xLayout->addChild( xRangeRow ); // create print range and add to range row mxPrintRange.reset( new vcl::RowOrColumn( xRangeRow.get() ) ); @@ -632,8 +637,8 @@ void PrintDialog::JobTabPage::readFromSettings() if( aValue.equalsIgnoreAsciiCaseAscii( "alwaysoff" ) ) { mnCollateUIMode = 1; - maCollateBox.Check( FALSE ); - maCollateBox.Enable( FALSE ); + maCollateBox.Check( sal_False ); + maCollateBox.Enable( sal_False ); } else { @@ -657,24 +662,13 @@ void PrintDialog::JobTabPage::storeToSettings() rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("false")) ); } -void PrintDialog::JobTabPage::Resize() -{ - maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) ); -} - PrintDialog::OutputOptPage::OutputOptPage( Window* i_pParent, const ResId& i_rResId ) : TabPage( i_pParent, i_rResId ) , maOptionsLine( this, VclResId( SV_PRINT_OPT_PRINT_FL ) ) , maToFileBox( this, VclResId( SV_PRINT_OPT_TOFILE ) ) , maCollateSingleJobsBox( this, VclResId( SV_PRINT_OPT_SINGLEJOBS ) ) - , maReverseOrderBox( this, VclResId( SV_PRINT_OPT_REVERSE ) ) { FreeResource(); - SMHID1( "OptPage" ); - maOptionsLine.SMHID2( "OptPage", "Options" ); - maToFileBox.SMHID2( "OptPage", "ToFile" ); - maCollateSingleJobsBox.SMHID2( "OptPage", "SingleJobs" ); - maReverseOrderBox.SMHID2( "OptPage", "Reverse" ); setupLayout(); } @@ -685,20 +679,17 @@ PrintDialog::OutputOptPage::~OutputOptPage() void PrintDialog::OutputOptPage::setupLayout() { - Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); - - maLayout.setParentWindow( this ); - maLayout.setOuterBorder( aBorder.Width() ); + boost::shared_ptr<vcl::RowOrColumn> xLayout = + boost::dynamic_pointer_cast<vcl::RowOrColumn>( getLayout() ); - maLayout.addWindow( &maOptionsLine ); - boost::shared_ptr<vcl::Indenter> xIndent( new vcl::Indenter( &maLayout, aBorder.Width() ) ); - maLayout.addChild( xIndent ); - boost::shared_ptr<vcl::RowOrColumn> xCol( new vcl::RowOrColumn( xIndent.get(), aBorder.Height() ) ); + xLayout->addWindow( &maOptionsLine ); + boost::shared_ptr<vcl::Indenter> xIndent( new vcl::Indenter( xLayout.get(), -1 ) ); + xLayout->addChild( xIndent ); + boost::shared_ptr<vcl::RowOrColumn> xCol( new vcl::RowOrColumn( xIndent.get() ) ); xIndent->setChild( xCol ); mxOptGroup = xCol; xCol->addWindow( &maToFileBox ); xCol->addWindow( &maCollateSingleJobsBox ); - xCol->addWindow( &maReverseOrderBox ); } void PrintDialog::OutputOptPage::readFromSettings() @@ -714,12 +705,6 @@ void PrintDialog::OutputOptPage::storeToSettings() : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("false")) ); } -void PrintDialog::OutputOptPage::Resize() -{ - maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) ); -} - - PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterController>& i_rController ) : ModalDialog( i_pParent, VclResId( SV_DLG_PRINT ) ) , maOKButton( this, VclResId( SV_PRINT_OK ) ) @@ -759,16 +744,14 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont // set symbols on forward and backward button maBackwardBtn.SetSymbol( SYMBOL_PREV ); maForwardBtn.SetSymbol( SYMBOL_NEXT ); - maBackwardBtn.ImplSetSmallSymbol( TRUE ); - maForwardBtn.ImplSetSmallSymbol( TRUE ); + maBackwardBtn.ImplSetSmallSymbol( sal_True ); + maForwardBtn.ImplSetSmallSymbol( sal_True ); maPageStr = maNumPagesText.GetText(); // init reverse print - maOptionsPage.maReverseOrderBox.Check( maPController->getReversePrint() ); + maJobPage.maReverseOrderBox.Check( maPController->getReversePrint() ); - // get the first page - preparePreview( true, true ); // fill printer listbox const std::vector< rtl::OUString >& rQueues( Printer::GetPrinterQueues() ); @@ -800,6 +783,12 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( Printer::GetDefaultPrinterName() ) ) ); } } + // not printing to file + maPController->resetPrinterOptions( false ); + + // get the first page + preparePreview( true, true ); + // update the text fields for the printer updatePrinterText(); @@ -835,7 +824,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont maJobPage.maDetailsBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); maNUpPage.maBorderCB.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); maOptionsPage.maToFileBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); - maOptionsPage.maReverseOrderBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); + maJobPage.maReverseOrderBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); maOptionsPage.maCollateSingleJobsBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); maNUpPage.maPagesBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); @@ -887,18 +876,6 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont } } - // set HelpIDs - SMHID1( "Dialog" ); - maOKButton.SMHID1( "OK" ); - maCancelButton.SMHID1( "Cancel" ); - maHelpButton.SMHID1( "Help" ); - maPreviewWindow.SMHID1( "Preview" ); - maNumPagesText.SMHID1( "NumPagesText" ); - maPageEdit.SMHID1( "PageEdit" ); - maForwardBtn.SMHID1( "ForwardBtn" ); - maBackwardBtn.SMHID1( "BackwardBtn" ); - maTabCtrl.SMHID1( "TabPages" ); - // append further tab pages if( mbShowLayoutPage ) { @@ -927,13 +904,14 @@ PrintDialog::~PrintDialog() void PrintDialog::setupLayout() { - Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + boost::shared_ptr<vcl::RowOrColumn> xLayout = + boost::dynamic_pointer_cast<vcl::RowOrColumn>( getLayout() ); + xLayout->setOuterBorder( 0 ); - maLayout.setParentWindow( this ); - boost::shared_ptr< vcl::RowOrColumn > xPreviewAndTab( new vcl::RowOrColumn( &maLayout, false ) ); - size_t nIndex = maLayout.addChild( xPreviewAndTab, 5 ); - maLayout.setBorders( nIndex, aBorder.Width(), aBorder.Width(), aBorder.Width(), 0 ); + boost::shared_ptr< vcl::RowOrColumn > xPreviewAndTab( new vcl::RowOrColumn( xLayout.get(), false ) ); + size_t nIndex = xLayout->addChild( xPreviewAndTab, 5 ); + xLayout->setBorders( nIndex, -1, -1, -1, 0 ); // setup column for preview and sub controls boost::shared_ptr< vcl::RowOrColumn > xPreview( new vcl::RowOrColumn( xPreviewAndTab.get() ) ); @@ -957,12 +935,12 @@ void PrintDialog::setupLayout() xPreviewAndTab->addWindow( &maTabCtrl ); // add the button line - maLayout.addWindow( &maButtonLine ); + xLayout->addWindow( &maButtonLine ); // add the row for the buttons - boost::shared_ptr< vcl::RowOrColumn > xButtons( new vcl::RowOrColumn( &maLayout, false ) ); - nIndex = maLayout.addChild( xButtons ); - maLayout.setBorders( nIndex, aBorder.Width(), 0, aBorder.Width(), aBorder.Width() ); + boost::shared_ptr< vcl::RowOrColumn > xButtons( new vcl::RowOrColumn( xLayout.get(), false ) ); + nIndex = xLayout->addChild( xButtons ); + xLayout->setBorders( nIndex, -1, 0, -1, -1 ); Size aMinSize( maCancelButton.GetSizePixel() ); // insert help button @@ -984,10 +962,10 @@ void PrintDialog::readFromSettings() SettingsConfigItem* pItem = SettingsConfigItem::get(); rtl::OUString aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPage" ) ) ); - USHORT nCount = maTabCtrl.GetPageCount(); - for( USHORT i = 0; i < nCount; i++ ) + sal_uInt16 nCount = maTabCtrl.GetPageCount(); + for( sal_uInt16 i = 0; i < nCount; i++ ) { - USHORT nPageId = maTabCtrl.GetPageId( i ); + sal_uInt16 nPageId = maTabCtrl.GetPageId( i ); if( aValue.equals( maTabCtrl.GetPageText( nPageId ) ) ) { maTabCtrl.SelectTabPage( nPageId ); @@ -995,6 +973,11 @@ void PrintDialog::readFromSettings() } } maOKButton.SetText( maOptionsPage.maToFileBox.IsChecked() ? maPrintToFileText : maPrintText ); + if( maOptionsPage.maToFileBox.IsChecked() ) + { + maPController->resetPrinterOptions( true ); + preparePreview( true, true ); + } } void PrintDialog::storeToSettings() @@ -1027,7 +1010,7 @@ int PrintDialog::getCopyCount() bool PrintDialog::isCollate() { - return maJobPage.maCopyCountField.GetValue() > 1 ? maJobPage.maCollateBox.IsChecked() : FALSE; + return maJobPage.maCopyCountField.GetValue() > 1 ? maJobPage.maCollateBox.IsChecked() : sal_False; } bool PrintDialog::isSingleJobs() @@ -1035,35 +1018,18 @@ bool PrintDialog::isSingleJobs() return maOptionsPage.maCollateSingleJobsBox.IsChecked(); } -static void setSmartId( Window* i_pWindow, const char* i_pType, sal_Int32 i_nId = -1, const rtl::OUString& i_rPropName = rtl::OUString() ) +void setHelpId( Window* i_pWindow, const Sequence< rtl::OUString >& i_rHelpIds, sal_Int32 i_nIndex ) { - rtl::OUStringBuffer aBuf( 256 ); - aBuf.appendAscii( HELPID_PREFIX ); - if( i_rPropName.getLength() ) - { - aBuf.append( sal_Unicode( ':' ) ); - aBuf.append( i_rPropName ); - } - if( i_pType ) - { - aBuf.append( sal_Unicode( ':' ) ); - aBuf.appendAscii( i_pType ); - } - if( i_nId >= 0 ) - { - aBuf.append( sal_Unicode( ':' ) ); - aBuf.append( i_nId ); - } - i_pWindow->SetSmartHelpId( SmartId( aBuf.makeStringAndClear(), HID_PRINTDLG ) ); + if( i_nIndex >= 0 && i_nIndex < i_rHelpIds.getLength() ) + i_pWindow->SetHelpId( rtl::OUStringToOString( i_rHelpIds.getConstArray()[i_nIndex], RTL_TEXTENCODING_UTF8 ) ); } -static void setHelpText( Window* /*i_pWindow*/, const Sequence< rtl::OUString >& /*i_rHelpTexts*/, sal_Int32 /*i_nIndex*/ ) +static void setHelpText( Window* i_pWindow, const Sequence< rtl::OUString >& i_rHelpTexts, sal_Int32 i_nIndex ) { // without a help text set and the correct smartID, // help texts will be retrieved from the online help system - - // passed help texts for optional UI is used only for native dialogs which currently - // cannot access the same (rather implicit) mechanism + if( i_nIndex >= 0 && i_nIndex < i_rHelpTexts.getLength() ) + i_pWindow->SetHelpText( i_rHelpTexts.getConstArray()[i_nIndex] ); } void updateMaxSize( const Size& i_rCheckSize, Size& o_rMaxSize ) @@ -1076,17 +1042,15 @@ void updateMaxSize( const Size& i_rCheckSize, Size& o_rMaxSize ) void PrintDialog::setupOptionalUI() { - Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); - - std::vector<vcl::RowOrColumn*> aDynamicColumns; - vcl::RowOrColumn* pCurColumn = 0; + std::vector< boost::shared_ptr<vcl::RowOrColumn> > aDynamicColumns; + boost::shared_ptr< vcl::RowOrColumn > pCurColumn; Window* pCurParent = 0, *pDynamicPageParent = 0; - USHORT nOptPageId = 9, nCurSubGroup = 0; + sal_uInt16 nOptPageId = 9, nCurSubGroup = 0; bool bOnStaticPage = false; bool bSubgroupOnStaticPage = false; - std::multimap< rtl::OUString, vcl::RowOrColumn* > aPropertyToDependencyRowMap; + std::multimap< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> > aPropertyToDependencyRowMap; const Sequence< PropertyValue >& rOptions( maPController->getUIOptions() ); for( int i = 0; i < rOptions.getLength(); i++ ) @@ -1099,7 +1063,9 @@ void PrintDialog::setupOptionalUI() rtl::OUString aText; rtl::OUString aPropertyName; Sequence< rtl::OUString > aChoices; + Sequence< sal_Bool > aChoicesDisabled; Sequence< rtl::OUString > aHelpTexts; + Sequence< rtl::OUString > aHelpIds; sal_Int64 nMinValue = 0, nMaxValue = 0; sal_Int32 nCurHelpText = 0; rtl::OUString aGroupingHint; @@ -1122,6 +1088,10 @@ void PrintDialog::setupOptionalUI() { rEntry.Value >>= aChoices; } + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ChoicesDisabled" ) ) ) + { + rEntry.Value >>= aChoicesDisabled; + } else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Property" ) ) ) { PropertyValue aVal; @@ -1169,6 +1139,18 @@ void PrintDialog::setupOptionalUI() } } } + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HelpId" ) ) ) + { + if( ! (rEntry.Value >>= aHelpIds ) ) + { + rtl::OUString aHelpId; + if( (rEntry.Value >>= aHelpId) ) + { + aHelpIds.realloc( 1 ); + *aHelpIds.getArray() = aHelpId; + } + } + } else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HintNoLayoutPage" ) ) ) { sal_Bool bNoLayoutPage = sal_False; @@ -1190,37 +1172,40 @@ void PrintDialog::setupOptionalUI() { // restore to dynamic pCurParent = pDynamicPageParent; - pCurColumn = aDynamicColumns.empty() ? NULL : aDynamicColumns.back(); + if( ! aDynamicColumns.empty() ) + pCurColumn = aDynamicColumns.back(); + else + pCurColumn.reset(); bOnStaticPage = false; bSubgroupOnStaticPage = false; if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrintRange" ) ) ) { - pCurColumn = maJobPage.mxPrintRange.get(); + pCurColumn = maJobPage.mxPrintRange; pCurParent = &maJobPage; // set job page as current parent bOnStaticPage = true; } else if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OptionsPage" ) ) ) { - pCurColumn = &maOptionsPage.maLayout; + pCurColumn = boost::dynamic_pointer_cast<vcl::RowOrColumn>(maOptionsPage.getLayout()); pCurParent = &maOptionsPage; // set options page as current parent bOnStaticPage = true; } else if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OptionsPageOptGroup" ) ) ) { - pCurColumn = maOptionsPage.mxOptGroup.get(); + pCurColumn = maOptionsPage.mxOptGroup; pCurParent = &maOptionsPage; // set options page as current parent bOnStaticPage = true; } else if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LayoutPage" ) ) ) { - pCurColumn = &maNUpPage.maLayout; + pCurColumn = boost::dynamic_pointer_cast<vcl::RowOrColumn>(maNUpPage.getLayout()); pCurParent = &maNUpPage; // set layout page as current parent bOnStaticPage = true; } else if( aGroupingHint.getLength() ) { - pCurColumn = &maJobPage.maLayout; + pCurColumn = boost::dynamic_pointer_cast<vcl::RowOrColumn>(maJobPage.getLayout()); pCurParent = &maJobPage; // set job page as current parent bOnStaticPage = true; } @@ -1238,17 +1223,16 @@ void PrintDialog::setupOptionalUI() maTabCtrl.SetTabPage( nOptPageId, pNewGroup ); // set help id - setSmartId( pNewGroup, "TabPage", nOptPageId ); + setHelpId( pNewGroup, aHelpIds, 0 ); // set help text setHelpText( pNewGroup, aHelpTexts, 0 ); // reset subgroup counter nCurSubGroup = 0; - aDynamicColumns.push_back( new vcl::RowOrColumn( NULL, true, aBorder.Width() ) ); + aDynamicColumns.push_back( boost::dynamic_pointer_cast<vcl::RowOrColumn>(pNewGroup->getLayout()) ); pCurColumn = aDynamicColumns.back(); pCurColumn->setParentWindow( pNewGroup ); - pCurColumn->setOuterBorder( aBorder.Width() ); bSubgroupOnStaticPage = false; bOnStaticPage = false; } @@ -1270,7 +1254,7 @@ void PrintDialog::setupOptionalUI() pNewSub->Show(); // set help id - setSmartId( pNewSub, "FixedLine", sal_Int32( nCurSubGroup++ ) ); + setHelpId( pNewSub, aHelpIds, 0 ); // set help text setHelpText( pNewSub, aHelpTexts, 0 ); // add group to current column @@ -1278,10 +1262,10 @@ void PrintDialog::setupOptionalUI() } // add an indent to the current column - vcl::Indenter* pIndent = new vcl::Indenter( pCurColumn, aBorder.Width() ); + vcl::Indenter* pIndent = new vcl::Indenter( pCurColumn.get(), -1 ); pCurColumn->addChild( pIndent ); // and create a column inside the indent - pCurColumn = new vcl::RowOrColumn( pIndent ); + pCurColumn.reset( new vcl::RowOrColumn( pIndent ) ); pIndent->setChild( pCurColumn ); } // EVIL @@ -1305,17 +1289,17 @@ void PrintDialog::setupOptionalUI() maPropertyToWindowMap[ aPropertyName ].push_back( &maNUpPage.maBrochureBtn ); maControlToPropertyMap[&maNUpPage.maBrochureBtn] = aPropertyName; - aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, maNUpPage.mxBrochureDep.get() ) ); + aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> >( aPropertyName, maNUpPage.mxBrochureDep ) ); } else { - vcl::RowOrColumn* pSaveCurColumn = pCurColumn; + boost::shared_ptr<vcl::RowOrColumn> pSaveCurColumn( pCurColumn ); if( bUseDependencyRow ) { // find the correct dependency row (if any) - std::pair< std::multimap< rtl::OUString, vcl::RowOrColumn* >::iterator, - std::multimap< rtl::OUString, vcl::RowOrColumn* >::iterator > aDepRange; + std::pair< std::multimap< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> >::iterator, + std::multimap< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> >::iterator > aDepRange; aDepRange = aPropertyToDependencyRowMap.equal_range( aDependsOnName ); if( aDepRange.first != aDepRange.second ) { @@ -1350,20 +1334,20 @@ void PrintDialog::setupOptionalUI() maControlToPropertyMap[pNewBox] = aPropertyName; // set help id - setSmartId( pNewBox, "CheckBox", -1, aPropertyName ); + setHelpId( pNewBox, aHelpIds, 0 ); // set help text setHelpText( pNewBox, aHelpTexts, 0 ); - vcl::RowOrColumn* pDependencyRow = new vcl::RowOrColumn( pCurColumn, false ); + boost::shared_ptr<vcl::RowOrColumn> pDependencyRow( new vcl::RowOrColumn( pCurColumn.get(), false ) ); pCurColumn->addChild( pDependencyRow ); - aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, pDependencyRow ) ); + aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> >( aPropertyName, pDependencyRow ) ); // add checkbox to current column pDependencyRow->addWindow( pNewBox ); } else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Radio" ) ) && pCurParent ) { - vcl::RowOrColumn* pRadioColumn = pCurColumn; + boost::shared_ptr<vcl::RowOrColumn> pRadioColumn( pCurColumn ); if( aText.getLength() ) { // add a FixedText: @@ -1373,16 +1357,17 @@ void PrintDialog::setupOptionalUI() pHeading->Show(); // set help id - setSmartId( pHeading, "FixedText", -1, aPropertyName ); + setHelpId( pHeading, aHelpIds, nCurHelpText ); // set help text - setHelpText( pHeading, aHelpTexts, nCurHelpText++ ); + setHelpText( pHeading, aHelpTexts, nCurHelpText ); + nCurHelpText++; // add fixed text to current column pCurColumn->addWindow( pHeading ); // add an indent to the current column - vcl::Indenter* pIndent = new vcl::Indenter( pCurColumn, 15 ); + vcl::Indenter* pIndent = new vcl::Indenter( pCurColumn.get(), 15 ); pCurColumn->addChild( pIndent ); // and create a column inside the indent - pRadioColumn = new vcl::RowOrColumn( pIndent ); + pRadioColumn.reset( new vcl::RowOrColumn( pIndent ) ); pIndent->setChild( pRadioColumn ); } // iterate options @@ -1392,26 +1377,29 @@ void PrintDialog::setupOptionalUI() pVal->Value >>= nSelectVal; for( sal_Int32 m = 0; m < aChoices.getLength(); m++ ) { - boost::shared_ptr<vcl::LabeledElement> pLabel( new vcl::LabeledElement( pRadioColumn, 1 ) ); + boost::shared_ptr<vcl::LabeledElement> pLabel( new vcl::LabeledElement( pRadioColumn.get(), 1 ) ); pRadioColumn->addChild( pLabel ); boost::shared_ptr<vcl::RowOrColumn> pDependencyRow( new vcl::RowOrColumn( pLabel.get(), false ) ); pLabel->setElement( pDependencyRow ); - aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, pDependencyRow.get() ) ); + aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> >( aPropertyName, pDependencyRow ) ); RadioButton* pBtn = new RadioButton( pCurParent, m == 0 ? WB_GROUP : 0 ); maControls.push_front( pBtn ); pBtn->SetText( aChoices[m] ); pBtn->Check( m == nSelectVal ); pBtn->SetToggleHdl( LINK( this, PrintDialog, UIOption_RadioHdl ) ); + if( aChoicesDisabled.getLength() > m && aChoicesDisabled[m] == sal_True ) + pBtn->Enable( sal_False ); pBtn->Show(); maPropertyToWindowMap[ aPropertyName ].push_back( pBtn ); maControlToPropertyMap[pBtn] = aPropertyName; maControlToNumValMap[pBtn] = m; // set help id - setSmartId( pBtn, "RadioButton", m, aPropertyName ); + setHelpId( pBtn, aHelpIds, nCurHelpText ); // set help text - setHelpText( pBtn, aHelpTexts, nCurHelpText++ ); + setHelpText( pBtn, aHelpTexts, nCurHelpText ); + nCurHelpText++; // add the radio button to the column pLabel->setLabel( pBtn ); } @@ -1422,9 +1410,9 @@ void PrintDialog::setupOptionalUI() ) && pCurParent ) { // create a row in the current column - vcl::RowOrColumn* pFieldColumn = new vcl::RowOrColumn( pCurColumn, false ); + boost::shared_ptr<vcl::RowOrColumn> pFieldColumn( new vcl::RowOrColumn( pCurColumn.get(), false ) ); pCurColumn->addChild( pFieldColumn ); - aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, pFieldColumn ) ); + aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> >( aPropertyName, pFieldColumn ) ); vcl::LabeledElement* pLabel = NULL; if( aText.getLength() ) @@ -1435,11 +1423,9 @@ void PrintDialog::setupOptionalUI() pHeading->SetText( aText ); pHeading->Show(); - // set help id - setSmartId( pHeading, "FixedText", -1, aPropertyName ); // add to row - pLabel = new vcl::LabeledElement( pFieldColumn, 2 ); + pLabel = new vcl::LabeledElement( pFieldColumn.get(), 2 ); pFieldColumn->addChild( pLabel ); pLabel->setLabel( pHeading ); } @@ -1458,13 +1444,13 @@ void PrintDialog::setupOptionalUI() PropertyValue* pVal = maPController->getValue( aPropertyName ); if( pVal && pVal->Value.hasValue() ) pVal->Value >>= nSelectVal; - pList->SelectEntryPos( static_cast<USHORT>(nSelectVal) ); + pList->SelectEntryPos( static_cast<sal_uInt16>(nSelectVal) ); pList->SetSelectHdl( LINK( this, PrintDialog, UIOption_SelectHdl ) ); - pList->SetDropDownLineCount( static_cast<USHORT>(aChoices.getLength()) ); + pList->SetDropDownLineCount( static_cast<sal_uInt16>(aChoices.getLength()) ); pList->Show(); // set help id - setSmartId( pList, "ListBox", -1, aPropertyName ); + setHelpId( pList, aHelpIds, 0 ); // set help text setHelpText( pList, aHelpTexts, 0 ); @@ -1497,7 +1483,7 @@ void PrintDialog::setupOptionalUI() pField->Show(); // set help id - setSmartId( pField, "NumericField", -1, aPropertyName ); + setHelpId( pField, aHelpIds, 0 ); // set help text setHelpText( pField, aHelpTexts, 0 ); @@ -1524,7 +1510,7 @@ void PrintDialog::setupOptionalUI() pField->Show(); // set help id - setSmartId( pField, "Edit", -1, aPropertyName ); + setHelpId( pField, aHelpIds, 0 ); // set help text setHelpText( pField, aHelpTexts, 0 ); @@ -1554,9 +1540,9 @@ void PrintDialog::setupOptionalUI() if( maNUpPage.mxPagesBtnLabel.get() ) { maNUpPage.maPagesBoxTitleTxt.SetText( maNUpPage.maPagesBtn.GetText() ); - maNUpPage.maPagesBoxTitleTxt.Show( TRUE ); + maNUpPage.maPagesBoxTitleTxt.Show( sal_True ); maNUpPage.mxPagesBtnLabel->setLabel( &maNUpPage.maPagesBoxTitleTxt ); - maNUpPage.maPagesBtn.Show( FALSE ); + maNUpPage.maPagesBtn.Show( sal_False ); } } @@ -1567,18 +1553,28 @@ void PrintDialog::setupOptionalUI() if( maJobPage.mxPrintRange->countElements() == 0 ) { maJobPage.mxPrintRange->show( false, false ); - maJobPage.maCopySpacer.Show( FALSE ); + maJobPage.maCopySpacer.Show( sal_False ); + maJobPage.maReverseOrderBox.Show( sal_False ); + } + else + { + // add an indent to the current column + vcl::Indenter* pIndent = new vcl::Indenter( maJobPage.mxPrintRange.get(), -1 ); + maJobPage.mxPrintRange->addChild( pIndent ); + // and create a column inside the indent + pIndent->setWindow( &maJobPage.maReverseOrderBox ); + maJobPage.maReverseOrderBox.Show( sal_True ); } #ifdef WNT // FIXME: the GetNativeControlRegion call on Windows has some issues // (which skew the results of GetOptimalSize()) // however fixing this thoroughly needs to take interaction with paint into - // acoount, making the right fix less simple. Fix this the right way + // account, making the right fix less simple. Fix this the right way // at some point. For now simply add some space at the lowest element - size_t nIndex = maJobPage.maLayout.countElements(); + size_t nIndex = maJobPage.getLayout()->countElements(); if( nIndex > 0 ) // sanity check - maJobPage.maLayout.setBorders( nIndex-1, 0, 0, 0, aBorder.Width() ); + maJobPage.getLayout()->setBorders( nIndex-1, 0, 0, 0, -1 ); #endif // create auto mnemomnics now so they can be calculated in layout @@ -1588,13 +1584,13 @@ void PrintDialog::setupOptionalUI() ImplWindowAutoMnemonic( this ); // calculate job page - Size aMaxSize = maJobPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ); + Size aMaxSize = maJobPage.getLayout()->getOptimalSize( WINDOWSIZE_PREFERRED ); // and layout page - updateMaxSize( maNUpPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ), aMaxSize ); + updateMaxSize( maNUpPage.getLayout()->getOptimalSize( WINDOWSIZE_PREFERRED ), aMaxSize ); // and options page - updateMaxSize( maOptionsPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ), aMaxSize ); + updateMaxSize( maOptionsPage.getLayout()->getOptimalSize( WINDOWSIZE_PREFERRED ), aMaxSize ); - for( std::vector< vcl::RowOrColumn* >::iterator it = aDynamicColumns.begin(); + for( std::vector< boost::shared_ptr<vcl::RowOrColumn> >::iterator it = aDynamicColumns.begin(); it != aDynamicColumns.end(); ++it ) { Size aPageSize( (*it)->getOptimalSize( WINDOWSIZE_PREFERRED ) ); @@ -1622,19 +1618,8 @@ void PrintDialog::setupOptionalUI() maTabCtrl.SetMinimumSizePixel( maTabCtrl.GetSizePixel() ); } - // and finally arrange controls - for( std::vector< vcl::RowOrColumn* >::iterator it = aDynamicColumns.begin(); - it != aDynamicColumns.end(); ++it ) - { - (*it)->setManagedArea( Rectangle( Point(), aTabSize ) ); - delete *it; - *it = NULL; - } - maJobPage.Resize(); - maNUpPage.Resize(); - maOptionsPage.Resize(); + Size aSz = getLayout()->getOptimalSize( WINDOWSIZE_PREFERRED ); - Size aSz = maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ); SetOutputSizePixel( aSz ); } @@ -1651,7 +1636,7 @@ void PrintDialog::checkControlDependencies() if( maJobPage.maCopyCountField.GetValue() > 1 ) maJobPage.maCollateBox.Enable( maJobPage.mnCollateUIMode == 0 ); else - maJobPage.maCollateBox.Enable( FALSE ); + maJobPage.maCollateBox.Enable( sal_False ); Image aImg( maJobPage.maCollateBox.IsChecked() ? maJobPage.maCollateImg : maJobPage.maNoCollateImg ); @@ -1660,7 +1645,7 @@ void PrintDialog::checkControlDependencies() // adjust size of image maJobPage.maCollateImage.SetSizePixel( aImgSize ); maJobPage.maCollateImage.SetImage( aImg ); - maJobPage.maLayout.resize(); + maJobPage.getLayout()->resize(); // enable setup button only for printers that can be setup bool bHaveSetup = maPController->getPrinter()->HasSupport( SUPPORT_SETUPDIALOG ); @@ -1675,7 +1660,7 @@ void PrintDialog::checkControlDependencies() aPrinterSize.Width() = aSetupPos.X() - aPrinterPos.X() - LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ).Width(); maJobPage.maPrinters.SetSizePixel( aPrinterSize ); maJobPage.maSetupButton.Show(); - maLayout.resize(); + getLayout()->resize(); } } else @@ -1689,7 +1674,7 @@ void PrintDialog::checkControlDependencies() aPrinterSize.Width() = aSetupPos.X() + aSetupSize.Width() - aPrinterPos.X(); maJobPage.maPrinters.SetSizePixel( aPrinterSize ); maJobPage.maSetupButton.Hide(); - maLayout.resize(); + getLayout()->resize(); } } } @@ -1718,6 +1703,16 @@ void PrintDialog::checkOptionalControlDependencies() } } + if( bShouldbeEnabled && dynamic_cast<RadioButton*>(it->first) ) + { + std::map< Window*, sal_Int32 >::const_iterator r_it = maControlToNumValMap.find( it->first ); + if( r_it != maControlToNumValMap.end() ) + { + bShouldbeEnabled = maPController->isUIChoiceEnabled( it->second, r_it->second ); + } + } + + bool bIsEnabled = it->first->IsEnabled(); // Enable does not do a change check first, so can be less cheap than expected if( bShouldbeEnabled != bIsEnabled ) @@ -1806,8 +1801,11 @@ void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache ) } Size aCurPageSize = aPrt->PixelToLogic( aPrt->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ); - maPreviewWindow.setPreview( aMtf, aCurPageSize, nPages > 0 ? rtl::OUString() : maNoPageStr, - aPrt->ImplGetDPIX(), aPrt->ImplGetDPIY() + maPreviewWindow.setPreview( aMtf, aCurPageSize, + aPrt->GetPaperName( false ), + nPages > 0 ? rtl::OUString() : maNoPageStr, + aPrt->ImplGetDPIX(), aPrt->ImplGetDPIY(), + aPrt->GetPrinterOptions().IsConvertToGreyscales() ); maForwardBtn.Enable( mnCurPage < nPages-1 ); @@ -1920,7 +1918,7 @@ void PrintDialog::updateNupFromPages() if( bCustom ) { // see if we have to enlarge the dialog to make the tab page fit - Size aCurSize( maNUpPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ) ); + Size aCurSize( maNUpPage.getLayout()->getOptimalSize( WINDOWSIZE_PREFERRED ) ); Size aTabSize( maTabCtrl.GetTabPageSizePixel() ); if( aTabSize.Height() < aCurSize.Height() ) { @@ -1956,10 +1954,14 @@ void PrintDialog::updateNup() int nOrderMode = int(sal_IntPtr(maNUpPage.maNupOrderBox.GetEntryData( maNUpPage.maNupOrderBox.GetSelectEntryPos() ))); - if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_LRTD ) + if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_LRTB ) aMPS.nOrder = PrinterController::LRTB; - else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TDLR ) + else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TBLR ) aMPS.nOrder = PrinterController::TBLR; + else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_RLTB ) + aMPS.nOrder = PrinterController::RLTB; + else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TBRL ) + aMPS.nOrder = PrinterController::TBRL; int nOrientationMode = int(sal_IntPtr(maNUpPage.maNupOrientationBox.GetEntryData( maNUpPage.maNupOrientationBox.GetSelectEntryPos() ))); @@ -1994,6 +1996,7 @@ IMPL_LINK( PrintDialog, SelectHdl, ListBox*, pBox ) String aNewPrinter( pBox->GetSelectEntry() ); // set new printer maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( aNewPrinter ) ) ); + maPController->resetPrinterOptions( maOptionsPage.maToFileBox.IsChecked() ); // update text fields updatePrinterText(); } @@ -2024,8 +2027,7 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) Help* pHelp = Application::GetHelp(); if( pHelp ) { - // FIXME: find out proper help URL and use here - pHelp->Start( HID_PRINTDLG, GetParent() ); + pHelp->Start( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:OK" ) ), &maOKButton ); } } else if( pButton == &maForwardBtn ) @@ -2039,7 +2041,9 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) else if( pButton == &maOptionsPage.maToFileBox ) { maOKButton.SetText( maOptionsPage.maToFileBox.IsChecked() ? maPrintToFileText : maPrintText ); - maLayout.resize(); + maPController->resetPrinterOptions( maOptionsPage.maToFileBox.IsChecked() ); + getLayout()->resize(); + preparePreview( true, true ); } else if( pButton == &maNUpPage.maBrochureBtn ) { @@ -2075,7 +2079,7 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) { maDetailsCollapsedSize = GetOutputSizePixel(); // enlarge dialog if necessary - Size aMinSize( maJobPage.maLayout.getOptimalSize( WINDOWSIZE_MINIMUM ) ); + Size aMinSize( maJobPage.getLayout()->getOptimalSize( WINDOWSIZE_MINIMUM ) ); Size aCurSize( maJobPage.GetSizePixel() ); if( aCurSize.Height() < aMinSize.Height() ) { @@ -2104,9 +2108,9 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) makeAny( sal_Bool(isCollate()) ) ); checkControlDependencies(); } - else if( pButton == &maOptionsPage.maReverseOrderBox ) + else if( pButton == &maJobPage.maReverseOrderBox ) { - sal_Bool bChecked = maOptionsPage.maReverseOrderBox.IsChecked(); + sal_Bool bChecked = maJobPage.maReverseOrderBox.IsChecked(); maPController->setReversePrint( bChecked ); maPController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverse" ) ), makeAny( bChecked ) ); @@ -2212,7 +2216,7 @@ void PrintDialog::updateWindowFromProperty( const rtl::OUString& i_rProperty ) ListBox* pList = dynamic_cast< ListBox* >( rWindows.front() ); if( pList ) { - pList->SelectEntryPos( static_cast< USHORT >(nVal) ); + pList->SelectEntryPos( static_cast< sal_uInt16 >(nVal) ); } else if( nVal >= 0 && nVal < sal_Int32(rWindows.size() ) ) { @@ -2349,7 +2353,7 @@ void PrintDialog::Command( const CommandEvent& rEvt ) void PrintDialog::Resize() { - maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) ); + // maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) ); // and do the preview; however the metafile does not need to be gotten anew preparePreview( false ); @@ -2453,6 +2457,7 @@ void PrintProgressDialog::tick() void PrintProgressDialog::reset() { + mbCanceled = false; setProgress( 0 ); } @@ -2477,9 +2482,9 @@ void PrintProgressDialog::Paint( const Rectangle& ) nOffset, nWidth, mnProgressHeight, - static_cast<USHORT>(0), - static_cast<USHORT>(10000*mnCur/mnMax), - static_cast<USHORT>(10000/nMaxCount), + static_cast<sal_uInt16>(0), + static_cast<sal_uInt16>(10000*mnCur/mnMax), + static_cast<sal_uInt16>(10000/nMaxCount), maProgressRect ); Pop(); diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx index ab4068ac6e3d..588f4d4fa1fa 100644 --- a/vcl/source/window/scrwnd.cxx +++ b/vcl/source/window/scrwnd.cxx @@ -69,12 +69,12 @@ ImplWheelWindow::ImplWheelWindow( Window* pParent ) : DBG_ASSERT( pParent, "ImplWheelWindow::ImplWheelWindow(): Parent not set!" ); const Size aSize( pParent->GetOutputSizePixel() ); - const USHORT nFlags = ImplGetSVData()->maWinData.mnAutoScrollFlags; - const BOOL bHorz = ( nFlags & AUTOSCROLL_HORZ ) != 0; - const BOOL bVert = ( nFlags & AUTOSCROLL_VERT ) != 0; + const sal_uInt16 nFlags = ImplGetSVData()->maWinData.mnAutoScrollFlags; + const sal_Bool bHorz = ( nFlags & AUTOSCROLL_HORZ ) != 0; + const sal_Bool bVert = ( nFlags & AUTOSCROLL_VERT ) != 0; // calculate maximum speed distance - mnMaxWidth = (ULONG) ( 0.4 * hypot( (double) aSize.Width(), aSize.Height() ) ); + mnMaxWidth = (sal_uLong) ( 0.4 * hypot( (double) aSize.Width(), aSize.Height() ) ); // create wheel window SetTitleType( FLOATWIN_TITLE_NONE ); @@ -116,7 +116,7 @@ void ImplWheelWindow::ImplStop() { ReleaseMouse(); mpTimer->Stop(); - Show(FALSE); + Show(sal_False); } // ------------------------------------------------------------------------ @@ -148,7 +148,7 @@ void ImplWheelWindow::ImplCreateImageList() // ------------------------------------------------------------------------ -void ImplWheelWindow::ImplSetWheelMode( ULONG nWheelMode ) +void ImplWheelWindow::ImplSetWheelMode( sal_uLong nWheelMode ) { if( nWheelMode != mnWheelMode ) { @@ -173,7 +173,7 @@ void ImplWheelWindow::ImplSetWheelMode( ULONG nWheelMode ) void ImplWheelWindow::ImplDrawWheel() { - USHORT nId; + sal_uInt16 nId; switch( mnWheelMode ) { @@ -201,13 +201,13 @@ void ImplWheelWindow::ImplRecalcScrollValues() } else { - ULONG nCurTime; + sal_uLong nCurTime; // calc current time if( mnMaxWidth ) { const double fExp = ( (double) mnActDist / mnMaxWidth ) * log10( (double) MAX_TIME / MIN_TIME ); - nCurTime = (ULONG) ( MAX_TIME / pow( 10., fExp ) ); + nCurTime = (sal_uLong) ( MAX_TIME / pow( 10., fExp ) ); } else nCurTime = MAX_TIME; @@ -251,9 +251,9 @@ void ImplWheelWindow::ImplRecalcScrollValues() PointerStyle ImplWheelWindow::ImplGetMousePointer( long nDistX, long nDistY ) { PointerStyle eStyle; - const USHORT nFlags = ImplGetSVData()->maWinData.mnAutoScrollFlags; - const BOOL bHorz = ( nFlags & AUTOSCROLL_HORZ ) != 0; - const BOOL bVert = ( nFlags & AUTOSCROLL_VERT ) != 0; + const sal_uInt16 nFlags = ImplGetSVData()->maWinData.mnAutoScrollFlags; + const sal_Bool bHorz = ( nFlags & AUTOSCROLL_HORZ ) != 0; + const sal_Bool bVert = ( nFlags & AUTOSCROLL_VERT ) != 0; if( bHorz || bVert ) { @@ -331,13 +331,13 @@ void ImplWheelWindow::MouseMove( const MouseEvent& rMEvt ) const long nDistX = aMousePos.X() - maCenter.X(); const long nDistY = aMousePos.Y() - maCenter.Y(); - mnActDist = (ULONG) hypot( (double) nDistX, nDistY ); + mnActDist = (sal_uLong) hypot( (double) nDistX, nDistY ); const PointerStyle eActStyle = ImplGetMousePointer( nDistX, nDistY ); - const USHORT nFlags = ImplGetSVData()->maWinData.mnAutoScrollFlags; - const BOOL bHorz = ( nFlags & AUTOSCROLL_HORZ ) != 0; - const BOOL bVert = ( nFlags & AUTOSCROLL_VERT ) != 0; - const BOOL bOuter = mnActDist > WHEEL_RADIUS; + const sal_uInt16 nFlags = ImplGetSVData()->maWinData.mnAutoScrollFlags; + const sal_Bool bHorz = ( nFlags & AUTOSCROLL_HORZ ) != 0; + const sal_Bool bVert = ( nFlags & AUTOSCROLL_VERT ) != 0; + const sal_Bool bOuter = mnActDist > WHEEL_RADIUS; if( bOuter && ( maLastMousePos != aMousePos ) ) { @@ -389,17 +389,17 @@ IMPL_LINK( ImplWheelWindow, ImplScrollHdl, Timer*, EMPTYARG ) const Point aMousePos( pWindow->OutputToScreenPixel( pWindow->GetPointerPosPixel() ) ); Point aCmdMousePos( pWindow->ImplFrameToOutput( aMousePos ) ); CommandScrollData aScrollData( mnActDeltaX, mnActDeltaY ); - CommandEvent aCEvt( aCmdMousePos, COMMAND_AUTOSCROLL, TRUE, &aScrollData ); + CommandEvent aCEvt( aCmdMousePos, COMMAND_AUTOSCROLL, sal_True, &aScrollData ); NotifyEvent aNCmdEvt( EVENT_COMMAND, pWindow, &aCEvt ); if ( !ImplCallPreNotify( aNCmdEvt ) ) { - const ULONG nTime = Time::GetSystemTicks(); + const sal_uLong nTime = Time::GetSystemTicks(); ImplDelData aDel( this ); pWindow->Command( aCEvt ); if( aDel.IsDead() ) return 0; - mnRepaintTime = Max( Time::GetSystemTicks() - nTime, (ULONG)1 ); + mnRepaintTime = Max( Time::GetSystemTicks() - nTime, (sal_uLong)1 ); ImplRecalcScrollValues(); } } diff --git a/vcl/source/window/scrwnd.hxx b/vcl/source/window/scrwnd.hxx index 0b00d0940059..ccc38c778c99 100644 --- a/vcl/source/window/scrwnd.hxx +++ b/vcl/source/window/scrwnd.hxx @@ -58,12 +58,12 @@ private: Point maLastMousePos; Point maCenter; Timer* mpTimer; - ULONG mnRepaintTime; - ULONG mnTimeout; - ULONG mnWheelMode; - ULONG mnMaxWidth; - ULONG mnActWidth; - ULONG mnActDist; + sal_uLong mnRepaintTime; + sal_uLong mnTimeout; + sal_uLong mnWheelMode; + sal_uLong mnMaxWidth; + sal_uLong mnActWidth; + sal_uLong mnActDist; long mnActDeltaX; long mnActDeltaY; @@ -88,8 +88,8 @@ public: ~ImplWheelWindow(); void ImplStop(); - void ImplSetWheelMode( ULONG nWheelMode ); - ULONG ImplGetWheelMode() const { return mnWheelMode; } + void ImplSetWheelMode( sal_uLong nWheelMode ); + sal_uLong ImplGetWheelMode() const { return mnWheelMode; } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx index 0c0352893a68..b8b6735d81ca 100644 --- a/vcl/source/window/seleng.cxx +++ b/vcl/source/window/seleng.cxx @@ -37,7 +37,7 @@ -inline BOOL SelectionEngine::ShouldDeselect( BOOL bModifierKey1 ) const +inline sal_Bool SelectionEngine::ShouldDeselect( sal_Bool bModifierKey1 ) const { // return !( eSelMode == MULTIPLE_SELECTION && bModifierKey1 ); return eSelMode != MULTIPLE_SELECTION || !bModifierKey1; @@ -53,7 +53,7 @@ inline BOOL SelectionEngine::ShouldDeselect( BOOL bModifierKey1 ) const *************************************************************************/ SelectionEngine::SelectionEngine( Window* pWindow, FunctionSet* pFuncSet, - ULONG nAutoRepeatInterval ) : + sal_uLong nAutoRepeatInterval ) : pWin( pWindow ), nUpdateInterval( nAutoRepeatInterval ) { @@ -118,7 +118,7 @@ void SelectionEngine::ActivateDragMode() |* *************************************************************************/ -void SelectionEngine::CursorPosChanging( BOOL bShift, BOOL bMod1 ) +void SelectionEngine::CursorPosChanging( sal_Bool bShift, sal_Bool bMod1 ) { if ( !pFunctionSet ) return; @@ -172,19 +172,19 @@ void SelectionEngine::CursorPosChanging( BOOL bShift, BOOL bMod1 ) |* *************************************************************************/ -BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) +sal_Bool SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) { nFlags &= (~SELENG_CMDEVT); if ( !pFunctionSet || !pWin ) - return FALSE; + return sal_False; const bool bRightClickCursorPositioning = rMEvt.IsRight() && rMEvt.GetClicks() == 1 && !IsInSelection(); if ( (rMEvt.GetClicks() > 1 || rMEvt.IsRight()) && !bRightClickCursorPositioning ) - return FALSE; + return sal_False; - USHORT nModifier = rMEvt.GetModifier() | nLockedMods; + sal_uInt16 nModifier = rMEvt.GetModifier() | nLockedMods; if ( nModifier & KEY_MOD2 ) - return FALSE; + return sal_False; // in SingleSelection: Control-Taste filtern (damit auch // mit Ctrl-Click ein D&D gestartet werden kann) if ( nModifier == KEY_MOD1 && eSelMode == SINGLE_SELECTION ) @@ -207,14 +207,14 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) { case 0: // KEY_NO_KEY { - BOOL bSelAtPoint = pFunctionSet->IsSelectionAtPoint( aPos ); + sal_Bool bSelAtPoint = pFunctionSet->IsSelectionAtPoint( aPos ); nFlags &= (~SELENG_IN_ADD); if ( (nFlags & SELENG_DRG_ENAB) && bSelAtPoint ) { nFlags |= SELENG_WAIT_UPEVT; nFlags &= ~(SELENG_IN_SEL); pWin->ReleaseMouse(); - return TRUE; //auf STARTDRAG-Command-Event warten + return sal_True; //auf STARTDRAG-Command-Event warten } if ( eSelMode != SINGLE_SELECTION ) { @@ -222,14 +222,14 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) pFunctionSet->DeselectAll(); else pFunctionSet->DestroyAnchor(); - nFlags &= (~SELENG_HAS_ANCH); // bHasAnchor = FALSE; + nFlags &= (~SELENG_HAS_ANCH); // bHasAnchor = sal_False; } pFunctionSet->SetCursorAtPoint( aPos ); // Sonderbehandlung Single-Selection, damit Select+Drag // in einem Zug moeglich ist if (eSelMode == SINGLE_SELECTION && (nFlags & SELENG_DRG_ENAB)) nFlags |= SELENG_WAIT_UPEVT; - return TRUE; + return sal_True; } case KEY_SHIFT: @@ -237,7 +237,7 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) { pWin->ReleaseMouse(); nFlags &= (~SELENG_IN_SEL); - return FALSE; + return sal_False; } if ( nFlags & SELENG_ADD_ALW ) nFlags |= SELENG_IN_ADD; @@ -252,7 +252,7 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) nFlags |= SELENG_HAS_ANCH; } pFunctionSet->SetCursorAtPoint( aPos ); - return TRUE; + return sal_True; case KEY_MOD1: // Control nur bei Mehrfachselektion erlaubt @@ -260,7 +260,7 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) { nFlags &= (~SELENG_IN_SEL); pWin->ReleaseMouse(); - return TRUE; // Mausclick verschlucken + return sal_True; // Mausclick verschlucken } if ( nFlags & SELENG_HAS_ANCH ) { @@ -271,32 +271,32 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) if ( pFunctionSet->IsSelectionAtPoint( aPos ) ) { pFunctionSet->DeselectAtPoint( aPos ); - pFunctionSet->SetCursorAtPoint( aPos, TRUE ); + pFunctionSet->SetCursorAtPoint( aPos, sal_True ); } else { pFunctionSet->SetCursorAtPoint( aPos ); } - return TRUE; + return sal_True; case KEY_SHIFT + KEY_MOD1: if ( eSelMode != MULTIPLE_SELECTION ) { pWin->ReleaseMouse(); nFlags &= (~SELENG_IN_SEL); - return FALSE; + return sal_False; } - nFlags |= SELENG_IN_ADD; //bIsInAddMode = TRUE; + nFlags |= SELENG_IN_ADD; //bIsInAddMode = sal_True; if ( !(nFlags & SELENG_HAS_ANCH) ) { pFunctionSet->CreateAnchor(); nFlags |= SELENG_HAS_ANCH; } pFunctionSet->SetCursorAtPoint( aPos ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } /************************************************************************* @@ -305,14 +305,14 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) |* *************************************************************************/ -BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt ) +sal_Bool SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt ) { aWTimer.Stop(); //DbgOut("Up"); if( !pFunctionSet || !pWin ) { nFlags &= ~(SELENG_CMDEVT | SELENG_WAIT_UPEVT | SELENG_IN_SEL); - return FALSE; + return sal_False; } if( !rMEvt.IsRight() ) @@ -325,7 +325,7 @@ BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt ) { // MouseButtonDown in Sel aber kein CommandEvent eingetrudelt // ==> deselektieren - USHORT nModifier = aLastMove.GetModifier() | nLockedMods; + sal_uInt16 nModifier = aLastMove.GetModifier() | nLockedMods; if( nModifier == KEY_MOD1 || IsAlwaysAdding() ) { if( !(nModifier & KEY_SHIFT) ) @@ -335,7 +335,7 @@ BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt ) } pFunctionSet->DeselectAtPoint( aLastMove.GetPosPixel() ); nFlags &= (~SELENG_HAS_ANCH); // nix Anker - pFunctionSet->SetCursorAtPoint( aLastMove.GetPosPixel(), TRUE ); + pFunctionSet->SetCursorAtPoint( aLastMove.GetPosPixel(), sal_True ); } else { @@ -346,7 +346,7 @@ BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt ) } nFlags &= ~(SELENG_CMDEVT | SELENG_WAIT_UPEVT | SELENG_IN_SEL); - return TRUE; + return sal_True; } /************************************************************************* @@ -355,21 +355,21 @@ BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt ) |* *************************************************************************/ -BOOL SelectionEngine::SelMouseMove( const MouseEvent& rMEvt ) +sal_Bool SelectionEngine::SelMouseMove( const MouseEvent& rMEvt ) { if ( !pFunctionSet || !(nFlags & SELENG_IN_SEL) || (nFlags & (SELENG_CMDEVT | SELENG_WAIT_UPEVT)) ) - return FALSE; + return sal_False; if( !(nFlags & SELENG_EXPANDONMOVE) ) - return FALSE; // auf DragEvent warten! + return sal_False; // auf DragEvent warten! aLastMove = rMEvt; // wenn die Maus ausserhalb der Area steht, dann wird die // Frequenz des SetCursorAtPoint() nur durch den Timer bestimmt if( aWTimer.IsActive() && !aArea.IsInside( rMEvt.GetPosPixel() )) - return TRUE; + return sal_True; aWTimer.SetTimeout( nUpdateInterval ); aWTimer.Start(); @@ -386,7 +386,7 @@ BOOL SelectionEngine::SelMouseMove( const MouseEvent& rMEvt ) //DbgOut("Move:SetCursor"); pFunctionSet->SetCursorAtPoint( rMEvt.GetPosPixel() ); - return TRUE; + return sal_True; } /************************************************************************* @@ -456,7 +456,7 @@ void SelectionEngine::Command( const CommandEvent& rCEvt ) } } -void SelectionEngine::SetUpdateInterval( ULONG nInterval ) +void SelectionEngine::SetUpdateInterval( sal_uLong nInterval ) { if (nInterval < SELENG_AUTOREPEAT_INTERVAL_MIN) // Set a lower threshold. On Windows, setting this value too low diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx index df03cf321ce3..1d4c8bfae815 100644 --- a/vcl/source/window/split.cxx +++ b/vcl/source/window/split.cxx @@ -61,13 +61,13 @@ namespace void Splitter::ImplInitSplitterData() { - ImplGetWindowImpl()->mbSplitter = TRUE; + ImplGetWindowImpl()->mbSplitter = sal_True; mpRefWin = NULL; mnSplitPos = 0; mnLastSplitPos = 0; mnStartSplitPos = 0; - mbDragFull = FALSE; - mbKbdSplitting = FALSE; + mbDragFull = sal_False; + mbKbdSplitting = sal_False; mbInKeyEvent = 0; mnKeyboardStepSize = SPLITTER_DEFAULTSTEPSIZE; } @@ -89,13 +89,13 @@ void Splitter::ImplInit( Window* pParent, WinBits nWinStyle ) if ( nWinStyle & WB_HSCROLL ) { ePointerStyle = POINTER_HSPLIT; - mbHorzSplit = TRUE; + mbHorzSplit = sal_True; SetSizePixel( Size( nB, nA ) ); } else { ePointerStyle = POINTER_VSPLIT; - mbHorzSplit = FALSE; + mbHorzSplit = sal_False; SetSizePixel( Size( nA, nB ) ); } @@ -218,11 +218,11 @@ Splitter* Splitter::ImplFindSibling() // ----------------------------------------------------------------------- -BOOL Splitter::ImplSplitterActive() +sal_Bool Splitter::ImplSplitterActive() { // is splitter in document or at scrollbar handle ? - BOOL bActive = TRUE; + sal_Bool bActive = sal_True; const StyleSettings& rSettings = GetSettings().GetStyleSettings(); long nA = rSettings.GetScrollBarSize(); long nB = rSettings.GetSplitSize(); @@ -231,12 +231,12 @@ BOOL Splitter::ImplSplitterActive() if ( mbHorzSplit ) { if( aSize.Width() == nB && aSize.Height() == nA ) - bActive = FALSE; + bActive = sal_False; } else { if( aSize.Width() == nA && aSize.Height() == nB ) - bActive = FALSE; + bActive = sal_False; } return bActive; } @@ -352,13 +352,13 @@ void Splitter::Tracking( const TrackingEvent& rTEvt ) void Splitter::ImplKbdTracking( KeyCode aKeyCode ) { - USHORT nCode = aKeyCode.GetCode(); + sal_uInt16 nCode = aKeyCode.GetCode(); if ( nCode == KEY_ESCAPE || nCode == KEY_RETURN ) { if( !mbKbdSplitting ) return; else - mbKbdSplitting = FALSE; + mbKbdSplitting = sal_False; if ( nCode != KEY_ESCAPE ) { @@ -553,7 +553,7 @@ void Splitter::ImplStartKbdSplitting() if( mbKbdSplitting ) return; - mbKbdSplitting = TRUE; + mbKbdSplitting = sal_True; StartSplit(); @@ -625,7 +625,7 @@ void Splitter::LoseFocus() { KeyCode aReturnKey( KEY_RETURN ); ImplKbdTracking( aReturnKey ); - mbKbdSplitting = FALSE; + mbKbdSplitting = sal_False; } Invalidate(); } @@ -641,7 +641,7 @@ void Splitter::KeyInput( const KeyEvent& rKEvt ) Splitter *pSibling = ImplFindSibling(); KeyCode aKeyCode = rKEvt.GetKeyCode(); - USHORT nCode = aKeyCode.GetCode(); + sal_uInt16 nCode = aKeyCode.GetCode(); switch ( nCode ) { case KEY_UP: diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index 3cf2af7bacc8..d0bf60b6412c 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -46,7 +46,8 @@ // ======================================================================= -// Achtung: Darf keine Objekte enthalten, da mit memmove/memcpy gearbeitet wird +// Attention: Must not contain non-PODs because array is enlarged/copied +// with the use of memmove/memcpy. struct ImplSplitItem { long mnSize; @@ -64,10 +65,14 @@ struct ImplSplitItem ImplSplitSet* mpSet; Window* mpWindow; Window* mpOrgParent; - USHORT mnId; + sal_uInt16 mnId; SplitWindowItemBits mnBits; - BOOL mbFixed; - BOOL mbSubSize; + sal_Bool mbFixed; + sal_Bool mbSubSize; + /// Minimal width or height of the item. -1 means no restriction. + long mnMinSize; + /// Maximal width or height of the item. -1 means no restriction. + long mnMaxSize; }; struct ImplSplitSet @@ -77,25 +82,47 @@ struct ImplSplitSet Bitmap* mpBitmap; long mnLastSize; long mnSplitSize; - USHORT mnItems; - USHORT mnId; - BOOL mbCalcPix; + sal_uInt16 mnItems; + sal_uInt16 mnId; + sal_Bool mbCalcPix; }; + + +/** Check whether the given size is inside the valid range defined by + [rItem.mnMinSize,rItem.mnMaxSize]. When it is not inside it then return + the upper or lower bound, respectively. Otherwise return the given size + unmodified. + Note that either mnMinSize and/or mnMaxSize can be -1 in which case the + size has not lower or upper bound. +*/ +namespace { + long ValidateSize (const long nSize, const ImplSplitItem rItem) + { + if (rItem.mnMinSize>=0 && nSize<rItem.mnMinSize) + return rItem.mnMinSize; + else if (rItem.mnMaxSize>0 && nSize>rItem.mnMaxSize) + return rItem.mnMaxSize; + else + return nSize; + } +} + + #define SPLITWIN_SPLITSIZE 3 #define SPLITWIN_SPLITSIZEEX 4 #define SPLITWIN_SPLITSIZEEXLN 6 #define SPLITWIN_SPLITSIZEAUTOHIDE 36 #define SPLITWIN_SPLITSIZEFADE 36 -#define SPLIT_HORZ ((USHORT)0x0001) -#define SPLIT_VERT ((USHORT)0x0002) -#define SPLIT_WINDOW ((USHORT)0x0004) -#define SPLIT_NOSPLIT ((USHORT)0x8000) +#define SPLIT_HORZ ((sal_uInt16)0x0001) +#define SPLIT_VERT ((sal_uInt16)0x0002) +#define SPLIT_WINDOW ((sal_uInt16)0x0004) +#define SPLIT_NOSPLIT ((sal_uInt16)0x8000) // ======================================================================= -static void ImplCalcBorder( WindowAlign eAlign, BOOL bNoAlign, +static void ImplCalcBorder( WindowAlign eAlign, sal_Bool bNoAlign, long& rLeft, long& rTop, long& rRight, long& rBottom ) { @@ -250,13 +277,13 @@ void SplitWindow::ImplDrawBorderLine( SplitWindow* pWin ) // ----------------------------------------------------------------------- -static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, USHORT nId ) +static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, sal_uInt16 nId ) { if ( pSet->mnId == nId ) return pSet; - USHORT i; - USHORT nItems = pSet->mnItems; + sal_uInt16 i; + sal_uInt16 nItems = pSet->mnItems; ImplSplitItem* pItems = pSet->mpItems; for ( i = 0; i < nItems; i++ ) @@ -280,10 +307,10 @@ static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, USHORT nId ) // ----------------------------------------------------------------------- -static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, USHORT nId, USHORT& rPos ) +static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, sal_uInt16 nId, sal_uInt16& rPos ) { - USHORT i; - USHORT nItems = pSet->mnItems; + sal_uInt16 i; + sal_uInt16 nItems = pSet->mnItems; ImplSplitItem* pItems = pSet->mpItems; for ( i = 0; i < nItems; i++ ) @@ -310,10 +337,10 @@ static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, USHORT nId, USHORT& rPos // ----------------------------------------------------------------------- -static USHORT ImplFindItem( ImplSplitSet* pSet, Window* pWindow ) +static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, Window* pWindow ) { - USHORT i; - USHORT nItems = pSet->mnItems; + sal_uInt16 i; + sal_uInt16 nItems = pSet->mnItems; ImplSplitItem* pItems = pSet->mpItems; for ( i = 0; i < nItems; i++ ) @@ -324,7 +351,7 @@ static USHORT ImplFindItem( ImplSplitSet* pSet, Window* pWindow ) { if ( pItems[i].mpSet ) { - USHORT nId = ImplFindItem( pItems[i].mpSet, pWindow ); + sal_uInt16 nId = ImplFindItem( pItems[i].mpSet, pWindow ); if ( nId ) return nId; } @@ -336,11 +363,11 @@ static USHORT ImplFindItem( ImplSplitSet* pSet, Window* pWindow ) // ----------------------------------------------------------------------- -static USHORT ImplFindItem( ImplSplitSet* pSet, const Point& rPos, - BOOL bRows, BOOL bDown = TRUE ) +static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, const Point& rPos, + sal_Bool bRows, sal_Bool bDown = sal_True ) { - USHORT i; - USHORT nItems = pSet->mnItems; + sal_uInt16 i; + sal_uInt16 nItems = pSet->mnItems; ImplSplitItem* pItems = pSet->mpItems; for ( i = 0; i < nItems; i++ ) @@ -386,8 +413,8 @@ static USHORT ImplFindItem( ImplSplitSet* pSet, const Point& rPos, static void ImplDeleteSet( ImplSplitSet* pSet ) { - USHORT i; - USHORT nItems = pSet->mnItems; + sal_uInt16 i; + sal_uInt16 nItems = pSet->mnItems; ImplSplitItem* pItems = pSet->mpItems; for ( i = 0; i < nItems; i++ ) @@ -411,7 +438,7 @@ static void ImplDeleteSet( ImplSplitSet* pSet ) static void ImplSetSplitSize( ImplSplitSet* pSet, long nNewSize ) { pSet->mnSplitSize = nNewSize; - for ( USHORT i = 0; i < pSet->mnItems; i++ ) + for ( sal_uInt16 i = 0; i < pSet->mnItems; i++ ) { if ( pSet->mpItems[i].mpSet ) ImplSetSplitSize( pSet->mpItems[i].mpSet, nNewSize ); @@ -423,18 +450,18 @@ static void ImplSetSplitSize( ImplSplitSet* pSet, long nNewSize ) static void ImplCalcSet( ImplSplitSet* pSet, long nSetLeft, long nSetTop, long nSetWidth, long nSetHeight, - BOOL bRows, BOOL bDown = TRUE ) + sal_Bool bRows, sal_Bool bDown = sal_True ) { if ( !pSet->mpItems ) return; - USHORT i; - USHORT j; - USHORT nMins; - USHORT nCalcItems; - USHORT nItems = pSet->mnItems; - USHORT nVisItems; - USHORT nAbsItems; + sal_uInt16 i; + sal_uInt16 j; + sal_uInt16 nMins; + sal_uInt16 nCalcItems; + sal_uInt16 nItems = pSet->mnItems; + sal_uInt16 nVisItems; + sal_uInt16 nAbsItems; long nCalcSize; long nSizeDelta; long nCurSize; @@ -448,7 +475,7 @@ static void ImplCalcSet( ImplSplitSet* pSet, long nMaxPos; long* pSize; ImplSplitItem* pItems = pSet->mpItems; - BOOL bEmpty; + sal_Bool bEmpty; // Anzahl sichtbarer Items ermitteln nVisItems = 0; @@ -528,7 +555,7 @@ static void ImplCalcSet( ImplSplitSet* pSet, nCurSize += pItems[i].mnPixSize; } - pSet->mbCalcPix = FALSE; + pSet->mbCalcPix = sal_False; pSet->mnLastSize = nCalcSize; // Fenster einpassen @@ -552,7 +579,7 @@ static void ImplCalcSet( ImplSplitSet* pSet, } } // Rundungsfehler werden hier nicht ausgelichen - if ( (nAbsItems < (USHORT)(Abs( nSizeDelta ))) && nSizeWinSize ) + if ( (nAbsItems < (sal_uInt16)(Abs( nSizeDelta ))) && nSizeWinSize ) { for ( i = 0; i < nItems; i++ ) { @@ -579,10 +606,10 @@ static void ImplCalcSet( ImplSplitSet* pSet, { for ( i = 0; i < nItems; i++ ) { - pItems[i].mbSubSize = FALSE; + pItems[i].mbSubSize = sal_False; if ( j >= 2 ) - pItems[i].mbSubSize = TRUE; + pItems[i].mbSubSize = sal_True; else { if ( !(pItems[i].mnBits & SWIB_INVISIBLE) ) @@ -590,11 +617,11 @@ static void ImplCalcSet( ImplSplitSet* pSet, if ( (nSizeDelta > 0) || pItems[i].mnPixSize ) { if ( j >= 1 ) - pItems[i].mbSubSize = TRUE; + pItems[i].mbSubSize = sal_True; else { if ( (j == 0) && (pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) ) - pItems[i].mbSubSize = TRUE; + pItems[i].mbSubSize = sal_True; } } } @@ -691,20 +718,20 @@ static void ImplCalcSet( ImplSplitSet* pSet, pItems[i].mnOldHeight = pItems[i].mnHeight; if ( pItems[i].mnBits & SWIB_INVISIBLE ) - bEmpty = TRUE; + bEmpty = sal_True; else { - bEmpty = FALSE; + bEmpty = sal_False; if ( bDown ) { if ( nPos+pItems[i].mnPixSize > nMaxPos ) - bEmpty = TRUE; + bEmpty = sal_True; } else { nPos -= pItems[i].mnPixSize; if ( nPos < nMaxPos ) - bEmpty = TRUE; + bEmpty = sal_True; } } @@ -775,9 +802,9 @@ static void ImplCalcSet( ImplSplitSet* pSet, // Fixed setzen for ( i = 0; i < nItems; i++ ) { - pItems[i].mbFixed = FALSE; + pItems[i].mbFixed = sal_False; if ( pItems[i].mnBits & SWIB_FIXED ) - pItems[i].mbFixed = TRUE; + pItems[i].mbFixed = sal_True; else { // Wenn Child-Set vorhanden, ist dieses Item auch Fixed, wenn @@ -788,7 +815,7 @@ static void ImplCalcSet( ImplSplitSet* pSet, { if ( pItems[i].mpSet->mpItems[j].mbFixed ) { - pItems[i].mbFixed = TRUE; + pItems[i].mbFixed = sal_True; break; } } @@ -799,11 +826,11 @@ static void ImplCalcSet( ImplSplitSet* pSet, // ----------------------------------------------------------------------- -void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, BOOL bHide, - BOOL bRows, BOOL /*bDown*/ ) +void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, sal_Bool bHide, + sal_Bool bRows, sal_Bool /*bDown*/ ) { - USHORT i; - USHORT nItems = pSet->mnItems; + sal_uInt16 i; + sal_uInt16 nItems = pSet->mnItems; ImplSplitItem* pItems = pSet->mpItems; if ( pWindow->IsReallyVisible() && pWindow->IsUpdateMode() && pWindow->mbInvalidate ) @@ -873,9 +900,9 @@ void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, BOOL b { if ( pItems[i].mpSet ) { - BOOL bTempHide = bHide; + sal_Bool bTempHide = bHide; if ( !pItems[i].mnWidth || !pItems[i].mnHeight ) - bTempHide = TRUE; + bTempHide = sal_True; ImplCalcSet2( pWindow, pItems[i].mpSet, bTempHide, ((pItems[i].mnBits & SWIB_COLSET) == 0) ); } @@ -902,10 +929,10 @@ void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, BOOL b // ----------------------------------------------------------------------- -static void ImplCalcLogSize( ImplSplitItem* pItems, USHORT nItems ) +static void ImplCalcLogSize( ImplSplitItem* pItems, sal_uInt16 nItems ) { // Original-Groessen updaten - USHORT i; + sal_uInt16 i; long nRelSize = 0; long nPerSize = 0; for ( i = 0; i < nItems; i++ ) @@ -970,8 +997,8 @@ void SplitWindow::ImplDrawBack( SplitWindow* pWindow, const Rectangle& rRect, void SplitWindow::ImplDrawBack( SplitWindow* pWindow, ImplSplitSet* pSet ) { - USHORT i; - USHORT nItems = pSet->mnItems; + sal_uInt16 i; + sal_uInt16 nItems = pSet->mnItems; ImplSplitItem* pItems = pSet->mpItems; // Beim Mainset auch den Hintergrund zeichnen @@ -1013,20 +1040,20 @@ void SplitWindow::ImplDrawBack( SplitWindow* pWindow, ImplSplitSet* pSet ) // ----------------------------------------------------------------------- static void ImplDrawSplit( SplitWindow* pWindow, ImplSplitSet* pSet, - BOOL bRows, BOOL bDown = TRUE ) + sal_Bool bRows, sal_Bool bDown = sal_True ) { if ( !pSet->mpItems ) return; - USHORT i; - USHORT nItems = pSet->mnItems; + sal_uInt16 i; + sal_uInt16 nItems = pSet->mnItems; long nPos; long nTop; long nBottom; ImplSplitItem* pItems = pSet->mpItems; const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings(); - BOOL bFlat = (pWindow->GetStyle() & WB_FLATSPLITDRAW) == WB_FLATSPLITDRAW; + sal_Bool bFlat = (pWindow->GetStyle() & WB_FLATSPLITDRAW) == WB_FLATSPLITDRAW; for ( i = 0; i < nItems-1; i++ ) { @@ -1107,16 +1134,16 @@ static void ImplDrawSplit( SplitWindow* pWindow, ImplSplitSet* pSet, // ----------------------------------------------------------------------- -USHORT SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos, - long& rMouseOff, ImplSplitSet** ppFoundSet, USHORT& rFoundPos, - BOOL bRows, BOOL /*bDown*/ ) +sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos, + long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos, + sal_Bool bRows, sal_Bool /*bDown*/ ) { if ( !pSet->mpItems ) return 0; - USHORT i; - USHORT nSplitTest; - USHORT nItems = pSet->mnItems; + sal_uInt16 i; + sal_uInt16 nSplitTest; + sal_uInt16 nItems = pSet->mnItems; long nMPos1; long nMPos2; long nPos; @@ -1187,8 +1214,8 @@ USHORT SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos, // ----------------------------------------------------------------------- -USHORT SplitWindow::ImplTestSplit( SplitWindow* pWindow, const Point& rPos, - long& rMouseOff, ImplSplitSet** ppFoundSet, USHORT& rFoundPos ) +sal_uInt16 SplitWindow::ImplTestSplit( SplitWindow* pWindow, const Point& rPos, + long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos ) { // Resizeable SplitWindow muss anders behandelt werden if ( pWindow->mnWinStyle & WB_SIZEABLE ) @@ -1300,7 +1327,7 @@ void SplitWindow::ImplInit( Window* pParent, WinBits nStyle ) pNewSet->mnItems = 0; pNewSet->mnId = 0; pNewSet->mnSplitSize = SPLITWIN_SPLITSIZE; - pNewSet->mbCalcPix = TRUE; + pNewSet->mbCalcPix = sal_True; mpMainSet = pNewSet; mpBaseSet = pNewSet; @@ -1321,29 +1348,29 @@ void SplitWindow::ImplInit( Window* pParent, WinBits nStyle ) mnMouseModifier = 0; mnMStartPos = 0; mnMSplitPos = 0; - mbDragFull = FALSE; - mbHorz = TRUE; - mbBottomRight = FALSE; - mbCalc = FALSE; - mbRecalc = TRUE; - mbInvalidate = TRUE; - mbAutoHide = FALSE; - mbFadeIn = FALSE; - mbFadeOut = FALSE; - mbAutoHideIn = FALSE; - mbAutoHideDown = FALSE; - mbFadeInDown = FALSE; - mbFadeOutDown = FALSE; - mbAutoHidePressed = FALSE; - mbFadeInPressed = FALSE; - mbFadeOutPressed = FALSE; - mbFadeNoButtonMode = FALSE; - mbNoAlign = FALSE; + mbDragFull = sal_False; + mbHorz = sal_True; + mbBottomRight = sal_False; + mbCalc = sal_False; + mbRecalc = sal_True; + mbInvalidate = sal_True; + mbAutoHide = sal_False; + mbFadeIn = sal_False; + mbFadeOut = sal_False; + mbAutoHideIn = sal_False; + mbAutoHideDown = sal_False; + mbFadeInDown = sal_False; + mbFadeOutDown = sal_False; + mbAutoHidePressed = sal_False; + mbFadeInPressed = sal_False; + mbFadeOutPressed = sal_False; + mbFadeNoButtonMode = sal_False; + mbNoAlign = sal_False; if ( nStyle & WB_NOSPLITDRAW ) { pNewSet->mnSplitSize -= 2; - mbInvalidate = FALSE; + mbInvalidate = sal_False; } if ( nStyle & WB_BORDER ) @@ -1476,7 +1503,7 @@ Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize ) { long nCurSize; long nCalcSize = 0; - USHORT i; + sal_uInt16 i; for ( i = 0; i < mpMainSet->mnItems; i++ ) { @@ -1544,7 +1571,7 @@ void SplitWindow::ImplCalcLayout() { long nCurSize; long nCalcSize = 0; - USHORT i; + sal_uInt16 i; for ( i = 0; i < mpMainSet->mnItems; i++ ) { @@ -1563,9 +1590,9 @@ void SplitWindow::ImplCalcLayout() nCurSize -= nSplitSize; nCurSize -= (mpMainSet->mnItems-1)*mpMainSet->mnSplitSize; - mbRecalc = FALSE; + mbRecalc = sal_False; ImplSetWindowSize( nCalcSize-nCurSize ); - mbRecalc = TRUE; + mbRecalc = sal_True; } } @@ -1606,15 +1633,15 @@ void SplitWindow::ImplCalcLayout() // Sets rekursiv berechnen ImplCalcSet( mpMainSet, nL, nT, nW, nH, mbHorz, !mbBottomRight ); - ImplCalcSet2( this, mpMainSet, FALSE, mbHorz, !mbBottomRight ); - mbCalc = FALSE; + ImplCalcSet2( this, mpMainSet, sal_False, mbHorz, !mbBottomRight ); + mbCalc = sal_False; } // ----------------------------------------------------------------------- void SplitWindow::ImplUpdate() { - mbCalc = TRUE; + mbCalc = sal_True; if ( IsReallyShown() && IsUpdateMode() && mbRecalc ) { @@ -1654,7 +1681,7 @@ void SplitWindow::ImplUpdateSet( ImplSplitSet* pSet ) else { ImplSplitItem* pItem; - USHORT nPos; + sal_uInt16 nPos; pSet = ImplFindItem( mpMainSet, pSet->mnId, nPos ); pItem = &(pSet->mpItems[nPos]); @@ -1694,7 +1721,7 @@ void SplitWindow::ImplSplitMousePos( Point& rMousePos ) // ----------------------------------------------------------------------- -void SplitWindow::ImplGetButtonRect( Rectangle& rRect, long nEx, BOOL bTest ) const +void SplitWindow::ImplGetButtonRect( Rectangle& rRect, long nEx, sal_Bool bTest ) const { long nSplitSize = mpMainSet->mnSplitSize-2; if ( mbAutoHide || mbFadeOut || mbFadeIn ) @@ -1767,7 +1794,7 @@ void SplitWindow::ImplGetButtonRect( Rectangle& rRect, long nEx, BOOL bTest ) co // ----------------------------------------------------------------------- -void SplitWindow::ImplGetAutoHideRect( Rectangle& rRect, BOOL bTest ) const +void SplitWindow::ImplGetAutoHideRect( Rectangle& rRect, sal_Bool bTest ) const { Rectangle aRect; @@ -1784,7 +1811,7 @@ void SplitWindow::ImplGetAutoHideRect( Rectangle& rRect, BOOL bTest ) const // ----------------------------------------------------------------------- -void SplitWindow::ImplGetFadeInRect( Rectangle& rRect, BOOL bTest ) const +void SplitWindow::ImplGetFadeInRect( Rectangle& rRect, sal_Bool bTest ) const { Rectangle aRect; @@ -1796,12 +1823,12 @@ void SplitWindow::ImplGetFadeInRect( Rectangle& rRect, BOOL bTest ) const // ----------------------------------------------------------------------- -void SplitWindow::ImplGetFadeOutRect( Rectangle& rRect, BOOL ) const +void SplitWindow::ImplGetFadeOutRect( Rectangle& rRect, sal_Bool ) const { Rectangle aRect; if ( mbFadeOut ) - ImplGetButtonRect( aRect, 0, FALSE ); + ImplGetButtonRect( aRect, 0, sal_False ); rRect = aRect; } @@ -1876,7 +1903,7 @@ void SplitWindow::ImplDrawButtonRect( const Rectangle& rRect, long nSize ) // ----------------------------------------------------------------------- -void SplitWindow::ImplDrawAutoHide( BOOL bInPaint ) +void SplitWindow::ImplDrawAutoHide( sal_Bool bInPaint ) { if ( mbAutoHide ) { @@ -1921,7 +1948,7 @@ void SplitWindow::ImplDrawAutoHide( BOOL bInPaint ) } // Image ermitteln und zurueckgeben - USHORT nId; + sal_uInt16 nId; if ( mbAutoHidePressed ) { if ( mbAutoHideIn ) @@ -1953,7 +1980,7 @@ void SplitWindow::ImplDrawAutoHide( BOOL bInPaint ) // ----------------------------------------------------------------------- -void SplitWindow::ImplDrawFadeArrow( const Point& rPt, BOOL bHorz, BOOL bLeft ) +void SplitWindow::ImplDrawFadeArrow( const Point& rPt, sal_Bool bHorz, sal_Bool bLeft ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -2009,14 +2036,14 @@ void SplitWindow::ImplDrawFadeArrow( const Point& rPt, BOOL bHorz, BOOL bLeft ) } } -void SplitWindow::ImplDrawGrip( const Rectangle& rRect, BOOL bHorz, BOOL bLeft ) +void SplitWindow::ImplDrawGrip( const Rectangle& rRect, sal_Bool bHorz, sal_Bool bLeft ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if( rRect.IsInside( GetPointerPosPixel() ) ) { DrawWallpaper( rRect, Wallpaper( Color( COL_WHITE ) ) ); - DrawSelectionBackground( rRect, 2, FALSE, FALSE, FALSE ); + DrawSelectionBackground( rRect, 2, sal_False, sal_False, sal_False ); } if( bHorz ) @@ -2067,7 +2094,7 @@ void SplitWindow::ImplDrawGrip( const Rectangle& rRect, BOOL bHorz, BOOL bLeft ) } } -void SplitWindow::ImplDrawFadeIn( BOOL bInPaint ) +void SplitWindow::ImplDrawFadeIn( sal_Bool bInPaint ) { if ( mbFadeIn ) { @@ -2075,17 +2102,17 @@ void SplitWindow::ImplDrawFadeIn( BOOL bInPaint ) Image aImage; ImplGetFadeInRect( aTempRect ); - BOOL bLeft; + sal_Bool bLeft; if ( meAlign == WINDOWALIGN_TOP ) - bLeft = FALSE; + bLeft = sal_False; else if ( meAlign == WINDOWALIGN_BOTTOM ) - bLeft = TRUE; + bLeft = sal_True; else if ( meAlign == WINDOWALIGN_LEFT ) - bLeft = FALSE; + bLeft = sal_False; else if ( meAlign == WINDOWALIGN_RIGHT ) - bLeft = TRUE; + bLeft = sal_True; else - bLeft = TRUE; + bLeft = sal_True; if ( !bInPaint ) Erase( aTempRect ); @@ -2096,7 +2123,7 @@ void SplitWindow::ImplDrawFadeIn( BOOL bInPaint ) // ----------------------------------------------------------------------- -void SplitWindow::ImplDrawFadeOut( BOOL bInPaint ) +void SplitWindow::ImplDrawFadeOut( sal_Bool bInPaint ) { if ( mbFadeOut ) { @@ -2104,17 +2131,17 @@ void SplitWindow::ImplDrawFadeOut( BOOL bInPaint ) Image aImage; ImplGetFadeOutRect( aTempRect ); - BOOL bLeft; + sal_Bool bLeft; if ( meAlign == WINDOWALIGN_TOP ) - bLeft = TRUE; + bLeft = sal_True; else if ( meAlign == WINDOWALIGN_BOTTOM ) - bLeft = FALSE; + bLeft = sal_False; else if ( meAlign == WINDOWALIGN_LEFT ) - bLeft = TRUE; + bLeft = sal_True; else if ( meAlign == WINDOWALIGN_RIGHT ) - bLeft = FALSE; + bLeft = sal_False; else - bLeft = TRUE; + bLeft = sal_True; if ( !bInPaint ) Erase( aTempRect ); @@ -2133,15 +2160,15 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt ) { ImplSplitItem* pSplitItem; long nCurMaxSize; - USHORT nTemp; - BOOL bDown; - BOOL bPropSmaller; + sal_uInt16 nTemp; + sal_Bool bDown; + sal_Bool bPropSmaller; mnMouseModifier = rMEvt.GetModifier(); if ( !(mnMouseModifier & KEY_SHIFT) || (mnSplitPos+1 >= mpSplitSet->mnItems) ) - bPropSmaller = FALSE; + bPropSmaller = sal_False; else - bPropSmaller = TRUE; + bPropSmaller = sal_True; // Hier kann noch die maximale Groesse gesetzt werden StartSplit(); @@ -2159,9 +2186,9 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt ) if ( mpSplitSet->mpItems ) { - bDown = TRUE; + bDown = sal_True; if ( (mpSplitSet == mpMainSet) && mbBottomRight ) - bDown = FALSE; + bDown = sal_False; pSplitItem = &(mpSplitSet->mpItems[mnSplitPos]); maDragRect.Left() = pSplitItem->mnLeft; @@ -2292,9 +2319,9 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt ) else { ImplSplitItem* pItems = mpSplitSet->mpItems; - USHORT nItems = mpSplitSet->mnItems; + sal_uInt16 nItems = mpSplitSet->mnItems; mpLastSizes = new long[nItems*2]; - for ( USHORT i = 0; i < nItems; i++ ) + for ( sal_uInt16 i = 0; i < nItems; i++ ) { mpLastSizes[i*2] = pItems[i].mnSize; mpLastSizes[i*2+1] = pItems[i].mnPixSize; @@ -2369,35 +2396,35 @@ void SplitWindow::MouseButtonDown( const MouseEvent& rMEvt ) Point aMousePosPixel = rMEvt.GetPosPixel(); Rectangle aTestRect; - mbFadeNoButtonMode = FALSE; - ImplGetAutoHideRect( aTestRect, TRUE ); + mbFadeNoButtonMode = sal_False; + ImplGetAutoHideRect( aTestRect, sal_True ); if ( aTestRect.IsInside( aMousePosPixel ) ) { - mbAutoHideDown = TRUE; - mbAutoHidePressed = TRUE; - ImplDrawAutoHide( FALSE ); + mbAutoHideDown = sal_True; + mbAutoHidePressed = sal_True; + ImplDrawAutoHide( sal_False ); } else { - ImplGetFadeOutRect( aTestRect, TRUE ); + ImplGetFadeOutRect( aTestRect, sal_True ); if ( aTestRect.IsInside( aMousePosPixel ) ) { - mbFadeOutDown = TRUE; - mbFadeOutPressed = TRUE; - ImplDrawFadeOut( FALSE ); + mbFadeOutDown = sal_True; + mbFadeOutPressed = sal_True; + ImplDrawFadeOut( sal_False ); } else { - ImplGetFadeInRect( aTestRect, TRUE ); + ImplGetFadeInRect( aTestRect, sal_True ); if ( aTestRect.IsInside( aMousePosPixel ) ) { - mbFadeInDown = TRUE; - mbFadeInPressed = TRUE; - ImplDrawFadeIn( FALSE ); + mbFadeInDown = sal_True; + mbFadeInPressed = sal_True; + ImplDrawFadeIn( sal_False ); } else if ( !aTestRect.IsEmpty() && !(mnWinStyle & WB_SIZEABLE) ) { - mbFadeNoButtonMode = TRUE; + mbFadeNoButtonMode = sal_True; FadeIn(); return; } @@ -2419,8 +2446,8 @@ void SplitWindow::MouseMove( const MouseEvent& rMEvt ) Point aPos = rMEvt.GetPosPixel(); long nTemp; ImplSplitSet* pTempSplitSet; - USHORT nTempSplitPos; - USHORT nSplitTest = ImplTestSplit( this, aPos, nTemp, &pTempSplitSet, nTempSplitPos ); + sal_uInt16 nTempSplitPos; + sal_uInt16 nSplitTest = ImplTestSplit( this, aPos, nTemp, &pTempSplitSet, nTempSplitPos ); PointerStyle eStyle = POINTER_ARROW; Rectangle aAutoHideRect; Rectangle aFadeInRect; @@ -2457,30 +2484,30 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) { if ( rTEvt.IsTrackingEnded() ) { - mbAutoHideDown = FALSE; + mbAutoHideDown = sal_False; if ( mbAutoHidePressed ) { - mbAutoHidePressed = FALSE; + mbAutoHidePressed = sal_False; if ( !rTEvt.IsTrackingCanceled() ) { mbAutoHideIn = !mbAutoHideIn; - ImplDrawAutoHide( FALSE ); + ImplDrawAutoHide( sal_False ); AutoHide(); } else - ImplDrawAutoHide( FALSE ); + ImplDrawAutoHide( sal_False ); } } else { Rectangle aTestRect; - ImplGetAutoHideRect( aTestRect, TRUE ); - BOOL bNewPressed = aTestRect.IsInside( aMousePosPixel ); + ImplGetAutoHideRect( aTestRect, sal_True ); + sal_Bool bNewPressed = aTestRect.IsInside( aMousePosPixel ); if ( bNewPressed != mbAutoHidePressed ) { mbAutoHidePressed = bNewPressed; - ImplDrawAutoHide( FALSE ); + ImplDrawAutoHide( sal_False ); } } } @@ -2488,11 +2515,11 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) { if ( rTEvt.IsTrackingEnded() ) { - mbFadeInDown = FALSE; + mbFadeInDown = sal_False; if ( mbFadeInPressed ) { - mbFadeInPressed = FALSE; - ImplDrawFadeIn( FALSE ); + mbFadeInPressed = sal_False; + ImplDrawFadeIn( sal_False ); if ( !rTEvt.IsTrackingCanceled() ) FadeIn(); @@ -2501,12 +2528,12 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) else { Rectangle aTestRect; - ImplGetFadeInRect( aTestRect, TRUE ); - BOOL bNewPressed = aTestRect.IsInside( aMousePosPixel ); + ImplGetFadeInRect( aTestRect, sal_True ); + sal_Bool bNewPressed = aTestRect.IsInside( aMousePosPixel ); if ( bNewPressed != mbFadeInPressed ) { mbFadeInPressed = bNewPressed; - ImplDrawFadeIn( FALSE ); + ImplDrawFadeIn( sal_False ); } } } @@ -2514,11 +2541,11 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) { if ( rTEvt.IsTrackingEnded() ) { - mbFadeOutDown = FALSE; + mbFadeOutDown = sal_False; if ( mbFadeOutPressed ) { - mbFadeOutPressed = FALSE; - ImplDrawFadeOut( FALSE ); + mbFadeOutPressed = sal_False; + ImplDrawFadeOut( sal_False ); if ( !rTEvt.IsTrackingCanceled() ) FadeOut(); @@ -2527,12 +2554,12 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) else { Rectangle aTestRect; - ImplGetFadeOutRect( aTestRect, TRUE ); - BOOL bNewPressed = aTestRect.IsInside( aMousePosPixel ); - if ( bNewPressed == FALSE ) + ImplGetFadeOutRect( aTestRect, sal_True ); + sal_Bool bNewPressed = aTestRect.IsInside( aMousePosPixel ); + if ( bNewPressed == sal_False ) { mbFadeOutPressed = bNewPressed; - ImplDrawFadeOut( FALSE ); + ImplDrawFadeOut( sal_False ); // We need a mouseevent with a position inside the button for the // ImplStartSplit function! @@ -2542,14 +2569,14 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) aOrgMEvt.GetModifier() ); ImplStartSplit( aNewMEvt ); - mbFadeOutDown = FALSE; + mbFadeOutDown = sal_False; } } } else { ImplSplitMousePos( aMousePosPixel ); - BOOL bSplit = TRUE; + sal_Bool bSplit = sal_True; if ( mbDragFull ) { if ( rTEvt.IsTrackingEnded() ) @@ -2557,8 +2584,8 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) if ( rTEvt.IsTrackingCanceled() ) { ImplSplitItem* pItems = mpSplitSet->mpItems; - USHORT nItems = mpSplitSet->mnItems; - for ( USHORT i = 0; i < nItems; i++ ) + sal_uInt16 nItems = mpSplitSet->mnItems; + for ( sal_uInt16 i = 0; i < nItems; i++ ) { pItems[i].mnSize = mpLastSizes[i*2]; pItems[i].mnPixSize = mpLastSizes[i*2+1]; @@ -2566,7 +2593,7 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) ImplUpdate(); Split(); } - bSplit = FALSE; + bSplit = sal_False; } } else @@ -2579,14 +2606,14 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) else { ImplDrawSplitTracking( this, aMousePosPixel ); - bSplit = FALSE; + bSplit = sal_False; } } if ( bSplit ) { - BOOL bPropSmaller = (mnMouseModifier & KEY_SHIFT) ? TRUE : FALSE; - BOOL bPropGreater = (mnMouseModifier & KEY_MOD1) ? TRUE : FALSE; + sal_Bool bPropSmaller = (mnMouseModifier & KEY_SHIFT) ? sal_True : sal_False; + sal_Bool bPropGreater = (mnMouseModifier & KEY_MOD1) ? sal_True : sal_False; long nDelta = mnMSplitPos-mnMStartPos; if ( (mnSplitTest & SPLIT_WINDOW) && !mpMainSet->mpItems ) @@ -2670,9 +2697,9 @@ void SplitWindow::Paint( const Rectangle& ) ImplDrawBorder( this ); ImplDrawBorderLine( this ); - ImplDrawFadeOut( TRUE ); - ImplDrawFadeIn( TRUE ); - ImplDrawAutoHide( TRUE ); + ImplDrawFadeOut( sal_True ); + ImplDrawFadeIn( sal_True ); + ImplDrawAutoHide( sal_True ); // FrameSet-Hintergruende zeichnen ImplDrawBack( this, mpMainSet ); @@ -2710,9 +2737,9 @@ void SplitWindow::RequestHelp( const HelpEvent& rHEvt ) { Point aMousePosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() ); Rectangle aHelpRect; - USHORT nHelpResId = 0; + sal_uInt16 nHelpResId = 0; - ImplGetAutoHideRect( aHelpRect, TRUE ); + ImplGetAutoHideRect( aHelpRect, sal_True ); if ( aHelpRect.IsInside( aMousePosPixel ) ) { if ( mbAutoHideIn ) @@ -2722,12 +2749,12 @@ void SplitWindow::RequestHelp( const HelpEvent& rHEvt ) } else { - ImplGetFadeInRect( aHelpRect, TRUE ); + ImplGetFadeInRect( aHelpRect, sal_True ); if ( aHelpRect.IsInside( aMousePosPixel ) ) nHelpResId = SV_HELPTEXT_FADEIN; else { - ImplGetFadeOutRect( aHelpRect, TRUE ); + ImplGetFadeOutRect( aHelpRect, sal_True ); if ( aHelpRect.IsInside( aMousePosPixel ) ) nHelpResId = SV_HELPTEXT_FADEOUT; } @@ -2798,17 +2825,17 @@ void SplitWindow::DataChanged( const DataChangedEvent& rDCEvt ) // ----------------------------------------------------------------------- -void SplitWindow::InsertItem( USHORT nId, Window* pWindow, long nSize, - USHORT nPos, USHORT nSetId, +void SplitWindow::InsertItem( sal_uInt16 nId, Window* pWindow, long nSize, + sal_uInt16 nPos, sal_uInt16 nSetId, SplitWindowItemBits nBits ) { #ifdef DBG_UTIL - USHORT nDbgDummy; + sal_uInt16 nDbgDummy; DBG_ASSERT( ImplFindSet( mpMainSet, nSetId ), "SplitWindow::InsertItem() - Set not exists" ); DBG_ASSERT( !ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::InsertItem() - Id already exists" ); #endif - // Size muss min. 1 sein + // Size has to be at least 1. if ( nSize < 1 ) nSize = 1; @@ -2816,7 +2843,7 @@ void SplitWindow::InsertItem( USHORT nId, Window* pWindow, long nSize, ImplSplitSet* pNewSet; ImplSplitItem* pItem; - // Platz fuer neues Item schaffen + // Make room for the new item. if ( nPos > pSet->mnItems ) nPos = pSet->mnItems; ImplSplitItem* pNewItems = new ImplSplitItem[pSet->mnItems+1]; @@ -2827,21 +2854,23 @@ void SplitWindow::InsertItem( USHORT nId, Window* pWindow, long nSize, delete[] pSet->mpItems; pSet->mpItems = pNewItems; pSet->mnItems++; - pSet->mbCalcPix = TRUE; + pSet->mbCalcPix = sal_True; - // Item anlegen und erweitern + // Create and initialize item. pItem = &(pSet->mpItems[nPos]); memset( pItem, 0, sizeof( ImplSplitItem ) ); pItem->mnSize = nSize; pItem->mnId = nId; pItem->mnBits = nBits; + pItem->mnMinSize=-1; + pItem->mnMaxSize=-1; if ( pWindow ) { pItem->mpWindow = pWindow; pItem->mpOrgParent = pWindow->GetParent(); - // Window mit SplitWindow verbinden + // Attach window to SplitWindow. pWindow->Hide(); pWindow->SetParent( this ); } @@ -2855,7 +2884,7 @@ void SplitWindow::InsertItem( USHORT nId, Window* pWindow, long nSize, pNewSet->mnItems = 0; pNewSet->mnId = nId; pNewSet->mnSplitSize = pSet->mnSplitSize; - pNewSet->mbCalcPix = TRUE; + pNewSet->mbCalcPix = sal_True; pItem->mpSet = pNewSet; } @@ -2865,8 +2894,8 @@ void SplitWindow::InsertItem( USHORT nId, Window* pWindow, long nSize, // ----------------------------------------------------------------------- -void SplitWindow::InsertItem( USHORT nId, long nSize, - USHORT nPos, USHORT nSetId, +void SplitWindow::InsertItem( sal_uInt16 nId, long nSize, + sal_uInt16 nPos, sal_uInt16 nSetId, SplitWindowItemBits nBits ) { InsertItem( nId, NULL, nSize, nPos, nSetId, nBits ); @@ -2874,15 +2903,15 @@ void SplitWindow::InsertItem( USHORT nId, long nSize, // ----------------------------------------------------------------------- -void SplitWindow::MoveItem( USHORT nId, USHORT nNewPos, USHORT nNewSetId ) +void SplitWindow::MoveItem( sal_uInt16 nId, sal_uInt16 nNewPos, sal_uInt16 nNewSetId ) { #ifdef DBG_UTIL - USHORT nDbgDummy; + sal_uInt16 nDbgDummy; DBG_ASSERT( ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::MoveItem() - Id not found" ); DBG_ASSERT( ImplFindSet( mpMainSet, nNewSetId ), "SplitWindow::MoveItem() - Set not exists" ); #endif - USHORT nPos; + sal_uInt16 nPos; ImplSplitSet* pNewSet = ImplFindSet( mpMainSet, nNewSetId ); ImplSplitSet* pSet = ImplFindItem( mpMainSet, nId, nPos ); ImplSplitItem aTempItem; @@ -2915,7 +2944,7 @@ void SplitWindow::MoveItem( USHORT nId, USHORT nNewPos, USHORT nNewSetId ) nNewPos = pNewSet->mnItems; memcpy( &aTempItem, &(pSet->mpItems[nPos]), sizeof( aTempItem ) ); pSet->mnItems--; - pSet->mbCalcPix = TRUE; + pSet->mbCalcPix = sal_True; if ( pSet->mnItems ) { memmove( pSet->mpItems+nPos, pSet->mpItems+nPos+1, @@ -2937,7 +2966,7 @@ void SplitWindow::MoveItem( USHORT nId, USHORT nNewPos, USHORT nNewSetId ) delete[] pNewSet->mpItems; pNewSet->mpItems = pNewItems; pNewSet->mnItems++; - pNewSet->mbCalcPix = TRUE; + pNewSet->mbCalcPix = sal_True; memcpy( &(pNewSet->mpItems[nNewPos]), &aTempItem, sizeof( aTempItem ) ); ImplUpdate(); } @@ -2945,15 +2974,15 @@ void SplitWindow::MoveItem( USHORT nId, USHORT nNewPos, USHORT nNewSetId ) // ----------------------------------------------------------------------- -void SplitWindow::RemoveItem( USHORT nId, BOOL bHide ) +void SplitWindow::RemoveItem( sal_uInt16 nId, sal_Bool bHide ) { #ifdef DBG_UTIL - USHORT nDbgDummy; + sal_uInt16 nDbgDummy; DBG_ASSERT( ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::RemoveItem() - Id not found" ); #endif // Set suchen - USHORT nPos; + sal_uInt16 nPos; ImplSplitSet* pSet = ImplFindItem( mpMainSet, nId, nPos ); ImplSplitItem* pItem = &(pSet->mpItems[nPos]); Window* pWindow = pItem->mpWindow; @@ -2965,7 +2994,7 @@ void SplitWindow::RemoveItem( USHORT nId, BOOL bHide ) // Item entfernen pSet->mnItems--; - pSet->mbCalcPix = TRUE; + pSet->mbCalcPix = sal_True; if ( pSet->mnItems ) { memmove( pSet->mpItems+nPos, pSet->mpItems+nPos+1, @@ -3007,7 +3036,7 @@ void SplitWindow::Clear() mpMainSet->mnItems = 0; mpMainSet->mnId = 0; mpMainSet->mnSplitSize = SPLITWIN_SPLITSIZE; - mpMainSet->mbCalcPix = TRUE; + mpMainSet->mbCalcPix = sal_True; if ( mnWinStyle & WB_NOSPLITDRAW ) mpMainSet->mnSplitSize -= 2; mpBaseSet = mpMainSet; @@ -3018,22 +3047,22 @@ void SplitWindow::Clear() // ----------------------------------------------------------------------- -void SplitWindow::SetBaseSet( USHORT nSetId ) +void SplitWindow::SetBaseSet( sal_uInt16 nSetId ) { mpBaseSet = ImplFindSet( mpMainSet, nSetId ); } // ----------------------------------------------------------------------- -USHORT SplitWindow::GetBaseSet() const +sal_uInt16 SplitWindow::GetBaseSet() const { return mpBaseSet->mnId; } // ----------------------------------------------------------------------- -void SplitWindow::SetSplitSize( USHORT nSetId, long nSplitSize, - BOOL bWithChilds ) +void SplitWindow::SetSplitSize( sal_uInt16 nSetId, long nSplitSize, + sal_Bool bWithChilds ) { ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId ); if ( pSet ) @@ -3048,7 +3077,7 @@ void SplitWindow::SetSplitSize( USHORT nSetId, long nSplitSize, // ----------------------------------------------------------------------- -long SplitWindow::GetSplitSize( USHORT nSetId ) const +long SplitWindow::GetSplitSize( sal_uInt16 nSetId ) const { ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId ); if ( pSet ) @@ -3059,7 +3088,7 @@ long SplitWindow::GetSplitSize( USHORT nSetId ) const // ----------------------------------------------------------------------- -void SplitWindow::SetItemBackground( USHORT nSetId ) +void SplitWindow::SetItemBackground( sal_uInt16 nSetId ) { Wallpaper aWall; SetItemBackground( nSetId, aWall ); @@ -3067,13 +3096,13 @@ void SplitWindow::SetItemBackground( USHORT nSetId ) // ----------------------------------------------------------------------- -void SplitWindow::SetItemBackground( USHORT nSetId, const Wallpaper& rWallpaper ) +void SplitWindow::SetItemBackground( sal_uInt16 nSetId, const Wallpaper& rWallpaper ) { ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId ); if ( pSet ) { - BOOL bUpdate = TRUE; + sal_Bool bUpdate = sal_True; if ( rWallpaper.GetStyle() == WALLPAPER_NULL ) { @@ -3083,12 +3112,12 @@ void SplitWindow::SetItemBackground( USHORT nSetId, const Wallpaper& rWallpaper pSet->mpWallpaper = NULL; } else - bUpdate = FALSE; + bUpdate = sal_False; } else { // Ab jetzt muss immer invalidiert werden - mbInvalidate = TRUE; + mbInvalidate = sal_True; if ( !pSet->mpWallpaper ) pSet->mpWallpaper = new Wallpaper( rWallpaper ); @@ -3107,7 +3136,7 @@ void SplitWindow::SetItemBackground( USHORT nSetId, const Wallpaper& rWallpaper // ----------------------------------------------------------------------- -Wallpaper SplitWindow::GetItemBackground( USHORT nSetId ) const +Wallpaper SplitWindow::GetItemBackground( sal_uInt16 nSetId ) const { ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId ); @@ -3122,25 +3151,25 @@ Wallpaper SplitWindow::GetItemBackground( USHORT nSetId ) const // ----------------------------------------------------------------------- -BOOL SplitWindow::IsItemBackground( USHORT nSetId ) const +sal_Bool SplitWindow::IsItemBackground( sal_uInt16 nSetId ) const { ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId ); if ( pSet && pSet->mpWallpaper ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void SplitWindow::SetItemBitmap( USHORT nSetId, const Bitmap& rBitmap ) +void SplitWindow::SetItemBitmap( sal_uInt16 nSetId, const Bitmap& rBitmap ) { ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId ); if ( pSet ) { - BOOL bUpdate = TRUE; + sal_Bool bUpdate = sal_True; if ( !rBitmap ) { @@ -3150,12 +3179,12 @@ void SplitWindow::SetItemBitmap( USHORT nSetId, const Bitmap& rBitmap ) pSet->mpBitmap = NULL; } else - bUpdate = FALSE; + bUpdate = sal_False; } else { // Ab jetzt muss immer invalidiert werden - mbInvalidate = TRUE; + mbInvalidate = sal_True; if ( !pSet->mpBitmap ) pSet->mpBitmap = new Bitmap( rBitmap ); @@ -3174,7 +3203,7 @@ void SplitWindow::SetItemBitmap( USHORT nSetId, const Bitmap& rBitmap ) // ----------------------------------------------------------------------- -Bitmap SplitWindow::GetItemBitmap( USHORT nSetId ) const +Bitmap SplitWindow::GetItemBitmap( sal_uInt16 nSetId ) const { ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId ); @@ -3189,15 +3218,15 @@ Bitmap SplitWindow::GetItemBitmap( USHORT nSetId ) const // ----------------------------------------------------------------------- -void SplitWindow::SplitItem( USHORT nId, long nNewSize, - BOOL bPropSmall, BOOL bPropGreat ) +void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, + sal_Bool bPropSmall, sal_Bool bPropGreat ) { - USHORT nItems; - USHORT nPos; - USHORT nMin; - USHORT nMax; - USHORT i; - USHORT n; + sal_uInt16 nItems; + sal_uInt16 nPos; + sal_uInt16 nMin; + sal_uInt16 nMax; + sal_uInt16 i; + sal_uInt16 n; long nDelta; long nTempDelta; ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos ); @@ -3209,6 +3238,10 @@ void SplitWindow::SplitItem( USHORT nId, long nNewSize, nItems = pSet->mnItems; pItems = pSet->mpItems; + // When there is an explicit minimum or maximum size then move nNewSize + // into that range (when it is not yet already in it.) + nNewSize = ValidateSize(nNewSize, pItems[nPos]); + if ( mbCalc ) { pItems[nPos].mnSize = nNewSize; @@ -3234,8 +3267,8 @@ void SplitWindow::SplitItem( USHORT nId, long nNewSize, } // Wenn das Fenster sizeable ist, wird das TopSet anders behandelt - BOOL bSmall = TRUE; - BOOL bGreat = TRUE; + sal_Bool bSmall = sal_True; + sal_Bool bGreat = sal_True; if ( (pSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) ) { if ( nPos < pSet->mnItems-1 ) @@ -3245,29 +3278,29 @@ void SplitWindow::SplitItem( USHORT nId, long nNewSize, ((nDelta < 0) && bPropGreat)) ) { if ( nDelta < 0 ) - bGreat = FALSE; + bGreat = sal_False; else - bSmall = FALSE; + bSmall = sal_False; } } else { if ( nDelta < 0 ) - bGreat = FALSE; + bGreat = sal_False; else - bSmall = FALSE; + bSmall = sal_False; } } else if ( nPos >= nMax ) { - bSmall = FALSE; - bGreat = FALSE; + bSmall = sal_False; + bGreat = sal_False; } else if ( nPos && (nPos >= pSet->mnItems-1) ) { nPos--; nDelta *= -1; - BOOL bTemp = bPropSmall; + sal_Bool bTemp = bPropSmall; bPropSmall = bPropGreat; bPropGreat = bTemp; } @@ -3420,9 +3453,9 @@ void SplitWindow::SplitItem( USHORT nId, long nNewSize, // ----------------------------------------------------------------------- -void SplitWindow::SetItemSize( USHORT nId, long nNewSize ) +void SplitWindow::SetItemSize( sal_uInt16 nId, long nNewSize ) { - USHORT nPos; + sal_uInt16 nPos; ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos ); ImplSplitItem* pItem; @@ -3435,16 +3468,16 @@ void SplitWindow::SetItemSize( USHORT nId, long nNewSize ) { // Neue Groesse setzen und neu durchrechnen pItem->mnSize = nNewSize; - pSet->mbCalcPix = TRUE; + pSet->mbCalcPix = sal_True; ImplUpdate(); } } // ----------------------------------------------------------------------- -long SplitWindow::GetItemSize( USHORT nId ) const +long SplitWindow::GetItemSize( sal_uInt16 nId ) const { - USHORT nPos; + sal_uInt16 nPos; ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos ); if ( pSet ) @@ -3455,9 +3488,9 @@ long SplitWindow::GetItemSize( USHORT nId ) const // ----------------------------------------------------------------------- -long SplitWindow::GetItemSize( USHORT nId, SplitWindowItemBits nBits ) const +long SplitWindow::GetItemSize( sal_uInt16 nId, SplitWindowItemBits nBits ) const { - USHORT nPos; + sal_uInt16 nPos; ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos ); if ( pSet ) @@ -3471,9 +3504,9 @@ long SplitWindow::GetItemSize( USHORT nId, SplitWindowItemBits nBits ) const long nRelSize = 0; long nPerSize = 0; ImplSplitItem* pItems; - USHORT nItems; + sal_uInt16 nItems; SplitWindowItemBits nTempBits; - USHORT i; + sal_uInt16 i; nItems = pSet->mnItems; pItems = pSet->mpItems; for ( i = 0; i < nItems; i++ ) @@ -3510,11 +3543,41 @@ long SplitWindow::GetItemSize( USHORT nId, SplitWindowItemBits nBits ) const return 0; } + + + +void SplitWindow::SetItemSizeRange (sal_uInt16 nId, const Range aRange) +{ + sal_uInt16 nPos; + ImplSplitSet* pSet = ImplFindItem(mpBaseSet, nId, nPos); + + if (pSet != NULL) + { + pSet->mpItems[nPos].mnMinSize = aRange.Min(); + pSet->mpItems[nPos].mnMaxSize = aRange.Max(); + } +} + + + + +Range SplitWindow::GetItemSizeRange (sal_uInt16 nId) const +{ + sal_uInt16 nPos; + ImplSplitSet* pSet = ImplFindItem(mpBaseSet, nId, nPos); + + if (pSet != NULL) + return Range (pSet->mpItems[nPos].mnMinSize, pSet->mpItems[nPos].mnMaxSize); + else + return Range(-1,-1); +} + + // ----------------------------------------------------------------------- -void SplitWindow::SetItemBits( USHORT nId, SplitWindowItemBits nNewBits ) +void SplitWindow::SetItemBits( sal_uInt16 nId, SplitWindowItemBits nNewBits ) { - USHORT nPos; + sal_uInt16 nPos; ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos ); ImplSplitItem* pItem; @@ -3529,16 +3592,16 @@ void SplitWindow::SetItemBits( USHORT nId, SplitWindowItemBits nNewBits ) { // Neue Bits setzen und neu durchrechnen pItem->mnBits = nNewBits; - pSet->mbCalcPix = TRUE; + pSet->mbCalcPix = sal_True; ImplUpdate(); } } // ----------------------------------------------------------------------- -SplitWindowItemBits SplitWindow::GetItemBits( USHORT nId ) const +SplitWindowItemBits SplitWindow::GetItemBits( sal_uInt16 nId ) const { - USHORT nPos; + sal_uInt16 nPos; ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos ); if ( pSet ) @@ -3549,9 +3612,9 @@ SplitWindowItemBits SplitWindow::GetItemBits( USHORT nId ) const // ----------------------------------------------------------------------- -Window* SplitWindow::GetItemWindow( USHORT nId ) const +Window* SplitWindow::GetItemWindow( sal_uInt16 nId ) const { - USHORT nPos; + sal_uInt16 nPos; ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos ); if ( pSet ) @@ -3562,9 +3625,9 @@ Window* SplitWindow::GetItemWindow( USHORT nId ) const // ----------------------------------------------------------------------- -USHORT SplitWindow::GetSet( USHORT nId ) const +sal_uInt16 SplitWindow::GetSet( sal_uInt16 nId ) const { - USHORT nPos; + sal_uInt16 nPos; ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos ); if ( pSet ) @@ -3575,55 +3638,55 @@ USHORT SplitWindow::GetSet( USHORT nId ) const // ----------------------------------------------------------------------- -BOOL SplitWindow::GetSet( USHORT nId, USHORT& rSetId, USHORT& rPos ) const +sal_Bool SplitWindow::GetSet( sal_uInt16 nId, sal_uInt16& rSetId, sal_uInt16& rPos ) const { ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, rPos ); if ( pSet ) { rSetId = pSet->mnId; - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL SplitWindow::IsItemValid( USHORT nId ) const +sal_Bool SplitWindow::IsItemValid( sal_uInt16 nId ) const { - USHORT nPos; + sal_uInt16 nPos; ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos ); if ( pSet ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -USHORT SplitWindow::GetItemId( Window* pWindow ) const +sal_uInt16 SplitWindow::GetItemId( Window* pWindow ) const { return ImplFindItem( mpBaseSet, pWindow ); } // ----------------------------------------------------------------------- -USHORT SplitWindow::GetItemId( const Point& rPos ) const +sal_uInt16 SplitWindow::GetItemId( const Point& rPos ) const { return ImplFindItem( mpBaseSet, rPos, mbHorz, !mbBottomRight ); } // ----------------------------------------------------------------------- -USHORT SplitWindow::GetItemPos( USHORT nId, USHORT nSetId ) const +sal_uInt16 SplitWindow::GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId ) const { ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId ); - USHORT nPos = SPLITWINDOW_ITEM_NOTFOUND; + sal_uInt16 nPos = SPLITWINDOW_ITEM_NOTFOUND; if ( pSet ) { - for ( USHORT i = 0; i < pSet->mnItems; i++ ) + for ( sal_uInt16 i = 0; i < pSet->mnItems; i++ ) { if ( pSet->mpItems[i].mnId == nId ) { @@ -3638,7 +3701,7 @@ USHORT SplitWindow::GetItemPos( USHORT nId, USHORT nSetId ) const // ----------------------------------------------------------------------- -USHORT SplitWindow::GetItemId( USHORT nPos, USHORT nSetId ) const +sal_uInt16 SplitWindow::GetItemId( sal_uInt16 nPos, sal_uInt16 nSetId ) const { ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId ); if ( pSet && (nPos < pSet->mnItems) ) @@ -3649,7 +3712,7 @@ USHORT SplitWindow::GetItemId( USHORT nPos, USHORT nSetId ) const // ----------------------------------------------------------------------- -USHORT SplitWindow::GetItemCount( USHORT nSetId ) const +sal_uInt16 SplitWindow::GetItemCount( sal_uInt16 nSetId ) const { ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId ); if ( pSet ) @@ -3664,28 +3727,28 @@ void SplitWindow::ImplNewAlign() { if ( mbNoAlign ) { - mbHorz = FALSE; - mbBottomRight = FALSE; + mbHorz = sal_False; + mbBottomRight = sal_False; } else if ( meAlign == WINDOWALIGN_TOP ) { - mbHorz = TRUE; - mbBottomRight = FALSE; + mbHorz = sal_True; + mbBottomRight = sal_False; } else if ( meAlign == WINDOWALIGN_BOTTOM ) { - mbHorz = TRUE; - mbBottomRight = TRUE; + mbHorz = sal_True; + mbBottomRight = sal_True; } else if ( meAlign == WINDOWALIGN_LEFT ) { - mbHorz = FALSE; - mbBottomRight = FALSE; + mbHorz = sal_False; + mbBottomRight = sal_False; } else if ( meAlign == WINDOWALIGN_RIGHT ) { - mbHorz = FALSE; - mbBottomRight = TRUE; + mbHorz = sal_False; + mbBottomRight = sal_True; } if ( mnWinStyle & WB_BORDER ) @@ -3701,7 +3764,7 @@ void SplitWindow::ImplNewAlign() // ----------------------------------------------------------------------- -void SplitWindow::SetNoAlign( BOOL bNoAlign ) +void SplitWindow::SetNoAlign( sal_Bool bNoAlign ) { bNoAlign = bNoAlign != 0; if ( mbNoAlign != bNoAlign ) @@ -3725,7 +3788,7 @@ void SplitWindow::SetAlign( WindowAlign eNewAlign ) // ----------------------------------------------------------------------- Size SplitWindow::CalcWindowSizePixel( const Size& rSize, WindowAlign eAlign, - WinBits nWinStyle, BOOL bExtra ) + WinBits nWinStyle, sal_Bool bExtra ) { long nLeft; long nTop; @@ -3733,7 +3796,7 @@ Size SplitWindow::CalcWindowSizePixel( const Size& rSize, WindowAlign eAlign, long nBottom; Size aSize = rSize; - ImplCalcBorder( eAlign, FALSE, nLeft, nTop, nRight, nBottom ); + ImplCalcBorder( eAlign, sal_False, nLeft, nTop, nRight, nBottom ); aSize.Width() += nLeft+nRight; aSize.Height() += nTop+nBottom; @@ -3758,7 +3821,7 @@ Size SplitWindow::CalcWindowSizePixel( const Size& rSize, WindowAlign eAlign, // ----------------------------------------------------------------------- -void SplitWindow::ShowAutoHideButton( BOOL bShow ) +void SplitWindow::ShowAutoHideButton( sal_Bool bShow ) { mbAutoHide = bShow; ImplUpdate(); @@ -3766,7 +3829,7 @@ void SplitWindow::ShowAutoHideButton( BOOL bShow ) // ----------------------------------------------------------------------- -void SplitWindow::ShowFadeInHideButton( BOOL bShow ) +void SplitWindow::ShowFadeInHideButton( sal_Bool bShow ) { mbFadeIn = bShow; ImplUpdate(); @@ -3774,7 +3837,7 @@ void SplitWindow::ShowFadeInHideButton( BOOL bShow ) // ----------------------------------------------------------------------- -void SplitWindow::ShowFadeOutButton( BOOL bShow ) +void SplitWindow::ShowFadeOutButton( sal_Bool bShow ) { mbFadeOut = bShow; ImplUpdate(); @@ -3782,7 +3845,7 @@ void SplitWindow::ShowFadeOutButton( BOOL bShow ) // ----------------------------------------------------------------------- -void SplitWindow::SetAutoHideState( BOOL bAutoHide ) +void SplitWindow::SetAutoHideState( sal_Bool bAutoHide ) { mbAutoHideIn = bAutoHide; if ( IsReallyVisible() ) @@ -3812,7 +3875,7 @@ long SplitWindow::GetFadeInSize() const Rectangle SplitWindow::GetAutoHideRect() const { Rectangle aRect; - ImplGetAutoHideRect( aRect, TRUE ); + ImplGetAutoHideRect( aRect, sal_True ); return aRect; } @@ -3821,7 +3884,7 @@ Rectangle SplitWindow::GetAutoHideRect() const Rectangle SplitWindow::GetFadeInRect() const { Rectangle aRect; - ImplGetFadeInRect( aRect, TRUE ); + ImplGetFadeInRect( aRect, sal_True ); return aRect; } @@ -3830,7 +3893,7 @@ Rectangle SplitWindow::GetFadeInRect() const Rectangle SplitWindow::GetFadeOutRect() const { Rectangle aRect; - ImplGetFadeOutRect( aRect, TRUE ); + ImplGetFadeOutRect( aRect, sal_True ); return aRect; } diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index 924cb837545c..9280bb25b80c 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -78,7 +78,7 @@ StatusBar::ImplData::~ImplData() struct ImplStatusItem { - USHORT mnId; + sal_uInt16 mnId; StatusBarItemBits mnBits; long mnWidth; long mnOffset; @@ -87,16 +87,16 @@ struct ImplStatusItem XubString maText; XubString maHelpText; XubString maQuickHelpText; - ULONG mnHelpId; + rtl::OString maHelpId; void* mpUserData; - BOOL mbVisible; + sal_Bool mbVisible; XubString maAccessibleName; XubString maCommand; }; // ======================================================================= -inline long ImplCalcProgessWidth( USHORT nMax, long nSize ) +inline long ImplCalcProgessWidth( sal_uInt16 nMax, long nSize ) { return ((nMax*(nSize+(nSize/2)))-(nSize/2)+(STATUSBAR_PRGS_OFFSET*2)); } @@ -104,7 +104,7 @@ inline long ImplCalcProgessWidth( USHORT nMax, long nSize ) // ----------------------------------------------------------------------- static Point ImplGetItemTextPos( const Size& rRectSize, const Size& rTextSize, - USHORT nStyle ) + sal_uInt16 nStyle ) { long nX; long nY; @@ -124,12 +124,12 @@ static Point ImplGetItemTextPos( const Size& rRectSize, const Size& rTextSize, // ----------------------------------------------------------------------- -BOOL StatusBar::ImplIsItemUpdate() +sal_Bool StatusBar::ImplIsItemUpdate() { if ( !mbProgressMode && mbVisibleItems && IsReallyVisible() && IsUpdateMode() ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -148,11 +148,11 @@ void StatusBar::ImplInit( Window* pParent, WinBits nStyle ) mpItemList = new ImplStatusItemList; mpImplData->mpVirDev = new VirtualDevice( *this ); mnCurItemId = 0; - mbFormat = TRUE; - mbVisibleItems = TRUE; - mbProgressMode = FALSE; - mbInUserDraw = FALSE; - mbBottomBorder = FALSE; + mbFormat = sal_True; + mbVisibleItems = sal_True; + mbProgressMode = sal_False; + mbInUserDraw = sal_False; + mbBottomBorder = sal_False; mnItemsWidth = STATUSBAR_OFFSET_X; mnDX = 0; mnDY = 0; @@ -160,7 +160,7 @@ void StatusBar::ImplInit( Window* pParent, WinBits nStyle ) mnItemY = STATUSBAR_OFFSET_Y; mnTextY = STATUSBAR_OFFSET_TEXTY; - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); SetLineColor(); SetOutputSizePixel( CalcWindowSizePixel() ); @@ -205,8 +205,8 @@ StatusBar::~StatusBar() // ----------------------------------------------------------------------- -void StatusBar::ImplInitSettings( BOOL bFont, - BOOL bForeground, BOOL bBackground ) +void StatusBar::ImplInitSettings( sal_Bool bFont, + sal_Bool bForeground, sal_Bool bBackground ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -253,7 +253,7 @@ void StatusBar::ImplInitSettings( BOOL bFont, IsNativeControlSupported( CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_WINDOW ) ) { ImplGetWindowImpl()->mnNativeBackground = PART_BACKGROUND_WINDOW; - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); } } } @@ -266,7 +266,7 @@ void StatusBar::ImplFormat() long nExtraWidth; long nExtraWidth2; long nX; - USHORT nAutoSizeItems = 0; + sal_uInt16 nAutoSizeItems = 0; // Breiten zusammenrechnen mnItemsWidth = STATUSBAR_OFFSET_X; @@ -309,6 +309,8 @@ void StatusBar::ImplFormat() nExtraWidth2 = 0; } nX = STATUSBAR_OFFSET_X; + if( ImplHasMirroredGraphics() && IsRTLEnabled() ) + nX += ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset; } for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { @@ -329,12 +331,12 @@ void StatusBar::ImplFormat() } } - mbFormat = FALSE; + mbFormat = sal_False; } // ----------------------------------------------------------------------- -Rectangle StatusBar::ImplGetItemRectPos( USHORT nPos ) const +Rectangle StatusBar::ImplGetItemRectPos( sal_uInt16 nPos ) const { Rectangle aRect; ImplStatusItem* pItem; @@ -357,7 +359,7 @@ Rectangle StatusBar::ImplGetItemRectPos( USHORT nPos ) const // ----------------------------------------------------------------------- -USHORT StatusBar::ImplGetFirstVisiblePos() const +sal_uInt16 StatusBar::ImplGetFirstVisiblePos() const { ImplStatusItem* pItem; @@ -367,7 +369,7 @@ USHORT StatusBar::ImplGetFirstVisiblePos() const if ( pItem ) { if ( pItem->mbVisible ) - return USHORT(nPos); + return sal_uInt16(nPos); } } @@ -376,7 +378,7 @@ USHORT StatusBar::ImplGetFirstVisiblePos() const // ----------------------------------------------------------------------- -void StatusBar::ImplDrawText( BOOL bOffScreen, long nOldTextWidth ) +void StatusBar::ImplDrawText( sal_Bool bOffScreen, long nOldTextWidth ) { // Das ueberschreiben der Item-Box verhindern Rectangle aTextRect; @@ -390,7 +392,7 @@ void StatusBar::ImplDrawText( BOOL bOffScreen, long nOldTextWidth ) { // Position ermitteln XubString aStr = GetText(); - USHORT nPos = aStr.Search( _LF ); + sal_uInt16 nPos = aStr.Search( _LF ); if ( nPos != STRING_NOTFOUND ) aStr.Erase( nPos ); @@ -413,7 +415,7 @@ void StatusBar::ImplDrawText( BOOL bOffScreen, long nOldTextWidth ) // ----------------------------------------------------------------------- -void StatusBar::ImplDrawItem( BOOL bOffScreen, USHORT nPos, BOOL bDrawText, BOOL bDrawFrame ) +void StatusBar::ImplDrawItem( sal_Bool bOffScreen, sal_uInt16 nPos, sal_Bool bDrawText, sal_Bool bDrawFrame ) { Rectangle aRect = ImplGetItemRectPos( nPos ); @@ -455,12 +457,12 @@ void StatusBar::ImplDrawItem( BOOL bOffScreen, USHORT nPos, BOOL bDrawText, BOOL { if ( bOffScreen ) { - mbInUserDraw = TRUE; + mbInUserDraw = sal_True; mpImplData->mpVirDev->EnableRTL( IsRTLEnabled() ); UserDrawEvent aODEvt( mpImplData->mpVirDev, Rectangle( Point(), aTextRectSize ), pItem->mnId ); UserDraw( aODEvt ); - mpImplData->mpVirDev->EnableRTL( FALSE ); - mbInUserDraw = FALSE; + mpImplData->mpVirDev->EnableRTL( sal_False ); + mbInUserDraw = sal_False; } else { @@ -481,7 +483,7 @@ void StatusBar::ImplDrawItem( BOOL bOffScreen, USHORT nPos, BOOL bDrawText, BOOL { if( !(pItem->mnBits & SIB_FLAT) ) { - USHORT nStyle; + sal_uInt16 nStyle; if ( pItem->mnBits & SIB_IN ) nStyle = FRAME_DRAW_IN; @@ -515,7 +517,7 @@ void StatusBar::ImplDrawItem( BOOL bOffScreen, USHORT nPos, BOOL bDrawText, BOOL void DrawProgress( Window* pWindow, const Point& rPos, long nOffset, long nPrgsWidth, long nPrgsHeight, - USHORT nPercent1, USHORT nPercent2, USHORT nPercentCount, + sal_uInt16 nPercent1, sal_uInt16 nPercent2, sal_uInt16 nPercentCount, const Rectangle& rFramePosSize ) { @@ -553,7 +555,7 @@ void DrawProgress( Window* pWindow, const Point& rPos, pWindow->Push( PUSH_CLIPREGION ); pWindow->IntersectClipRegion( rFramePosSize ); } - BOOL bNativeOK = pWindow->DrawNativeControl( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion, + sal_Bool bNativeOK = pWindow->DrawNativeControl( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion, CTRL_STATE_ENABLED, aValue, rtl::OUString() ); if( bNeedErase ) pWindow->Pop(); @@ -565,8 +567,8 @@ void DrawProgress( Window* pWindow, const Point& rPos, } // Werte vorberechnen - USHORT nPerc1 = nPercent1 / nPercentCount; - USHORT nPerc2 = nPercent2 / nPercentCount; + sal_uInt16 nPerc1 = nPercent1 / nPercentCount; + sal_uInt16 nPerc2 = nPercent2 / nPercentCount; if ( nPerc1 > nPerc2 ) { @@ -631,8 +633,8 @@ void DrawProgress( Window* pWindow, const Point& rPos, // ----------------------------------------------------------------------- -void StatusBar::ImplDrawProgress( BOOL bPaint, - USHORT nPercent1, USHORT nPercent2 ) +void StatusBar::ImplDrawProgress( sal_Bool bPaint, + sal_uInt16 nPercent1, sal_uInt16 nPercent2 ) { bool bNative = IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ); // bPaint: draw text also, else only update progress @@ -675,7 +677,7 @@ void StatusBar::ImplCalcProgressRect() // calculate size of progress rects mnPrgsSize = maPrgsFrameRect.Bottom()-maPrgsFrameRect.Top()-(STATUSBAR_PRGS_OFFSET*2); - USHORT nMaxPercent = STATUSBAR_PRGS_COUNT; + sal_uInt16 nMaxPercent = STATUSBAR_PRGS_COUNT; long nMaxWidth = mnDX-STATUSBAR_OFFSET-1; @@ -690,7 +692,7 @@ void StatusBar::ImplCalcProgressRect() // save the divisor for later mnPercentCount = 10000 / nMaxPercent; - BOOL bNativeOK = FALSE; + sal_Bool bNativeOK = sal_False; if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) ) { ImplControlValue aValue; @@ -698,7 +700,7 @@ void StatusBar::ImplCalcProgressRect() Rectangle aNativeControlRegion, aNativeContentRegion; if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion, CTRL_STATE_ENABLED, aValue, rtl::OUString(), - aNativeControlRegion, aNativeContentRegion ) ) != FALSE ) + aNativeControlRegion, aNativeContentRegion ) ) != sal_False ) { long nProgressHeight = aNativeControlRegion.GetHeight(); if( nProgressHeight > maPrgsFrameRect.GetHeight() ) @@ -730,7 +732,7 @@ void StatusBar::MouseButtonDown( const MouseEvent& rMEvt ) { ImplStatusItem* pItem = (*mpItemList)[ i ]; // Ist es dieses Item - if ( ImplGetItemRectPos( USHORT(i) ).IsInside( aMousePos ) ) + if ( ImplGetItemRectPos( sal_uInt16(i) ).IsInside( aMousePos ) ) { mnCurItemId = pItem->mnId; if ( rMEvt.GetClicks() == 2 ) @@ -760,22 +762,22 @@ void StatusBar::Paint( const Rectangle& ) if ( mbFormat ) ImplFormat(); - USHORT nItemCount = USHORT( mpItemList->size() ); + sal_uInt16 nItemCount = sal_uInt16( mpItemList->size() ); if ( mbProgressMode ) - ImplDrawProgress( TRUE, 0, mnPercent ); + ImplDrawProgress( sal_True, 0, mnPercent ); else { // Text zeichen if ( !mbVisibleItems || (GetStyle() & WB_RIGHT) ) - ImplDrawText( FALSE, 0 ); + ImplDrawText( sal_False, 0 ); // Items zeichnen if ( mbVisibleItems ) { // Items zeichnen - for ( USHORT i = 0; i < nItemCount; i++ ) - ImplDrawItem( FALSE, i, TRUE, TRUE ); + for ( sal_uInt16 i = 0; i < nItemCount; i++ ) + ImplDrawItem( sal_False, i, sal_True, sal_True ); } } @@ -812,7 +814,7 @@ void StatusBar::Resize() { // Breite und Hoehe abfragen und merken Size aSize = GetOutputSizePixel(); - mnDX = aSize.Width(); + mnDX = aSize.Width() - ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset; mnDY = aSize.Height(); mnCalcHeight = mnDY; // subtract border @@ -829,7 +831,7 @@ void StatusBar::Resize() mnTextY += 2; // Formatierung neu ausloesen - mbFormat = TRUE; + mbFormat = sal_True; if ( mbProgressMode ) ImplCalcProgressRect(); @@ -845,7 +847,7 @@ void StatusBar::RequestHelp( const HelpEvent& rHEvt ) if( rHEvt.KeyboardActivated() ) return; - USHORT nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) ); + sal_uInt16 nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) ); if ( nItemId ) { @@ -883,9 +885,9 @@ void StatusBar::RequestHelp( const HelpEvent& rHEvt ) else if ( rHEvt.GetMode() & HELPMODE_EXTENDED ) { String aCommand = GetItemCommand( nItemId ); - ULONG nHelpId = GetHelpId( nItemId ); + rtl::OString aHelpId( GetHelpId( nItemId ) ); - if ( aCommand.Len() || nHelpId ) + if ( aCommand.Len() || aHelpId.getLength() ) { // Wenn eine Hilfe existiert, dann ausloesen Help* pHelp = Application::GetHelp(); @@ -893,8 +895,8 @@ void StatusBar::RequestHelp( const HelpEvent& rHEvt ) { if ( aCommand.Len() ) pHelp->Start( aCommand, this ); - else if ( nHelpId ) - pHelp->Start( nHelpId, this ); + else if ( aHelpId.getLength() ) + pHelp->Start( rtl::OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ), this ); } return; } @@ -917,18 +919,18 @@ void StatusBar::StateChanged( StateChangedType nType ) else if ( (nType == STATE_CHANGE_ZOOM) || (nType == STATE_CHANGE_CONTROLFONT) ) { - mbFormat = TRUE; - ImplInitSettings( TRUE, FALSE, FALSE ); + mbFormat = sal_True; + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } } @@ -947,8 +949,8 @@ void StatusBar::DataChanged( const DataChangedEvent& rDCEvt ) ) ) { - mbFormat = TRUE; - ImplInitSettings( TRUE, TRUE, TRUE ); + mbFormat = sal_True; + ImplInitSettings( sal_True, sal_True, sal_True ); long nFudge = GetTextHeight() / 4; for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { @@ -990,9 +992,9 @@ void StatusBar::UserDraw( const UserDrawEvent& ) // ----------------------------------------------------------------------- -void StatusBar::InsertItem( USHORT nItemId, ULONG nWidth, +void StatusBar::InsertItem( sal_uInt16 nItemId, sal_uLong nWidth, StatusBarItemBits nBits, - long nOffset, USHORT nPos ) + long nOffset, sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "StatusBar::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == STATUSBAR_ITEM_NOTFOUND, @@ -1011,9 +1013,8 @@ void StatusBar::InsertItem( USHORT nItemId, ULONG nWidth, pItem->mnBits = nBits; pItem->mnWidth = (long)nWidth+nFudge+STATUSBAR_OFFSET; pItem->mnOffset = nOffset; - pItem->mnHelpId = 0; pItem->mpUserData = 0; - pItem->mbVisible = TRUE; + pItem->mbVisible = sal_True; // Item in die Liste einfuegen if ( nPos < mpItemList->size() ) { @@ -1022,7 +1023,7 @@ void StatusBar::InsertItem( USHORT nItemId, ULONG nWidth, mpItemList->push_back( pItem ); } - mbFormat = TRUE; + mbFormat = sal_True; if ( ImplIsItemUpdate() ) Invalidate(); @@ -1031,15 +1032,15 @@ void StatusBar::InsertItem( USHORT nItemId, ULONG nWidth, // ----------------------------------------------------------------------- -void StatusBar::RemoveItem( USHORT nItemId ) +void StatusBar::RemoveItem( sal_uInt16 nItemId ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { delete (*mpItemList)[ nPos ]; mpItemList->erase( mpItemList->begin() + nPos ); - mbFormat = TRUE; + mbFormat = sal_True; if ( ImplIsItemUpdate() ) Invalidate(); @@ -1049,18 +1050,18 @@ void StatusBar::RemoveItem( USHORT nItemId ) // ----------------------------------------------------------------------- -void StatusBar::ShowItem( USHORT nItemId ) +void StatusBar::ShowItem( sal_uInt16 nItemId ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { ImplStatusItem* pItem = (*mpItemList)[ nPos ]; if ( !pItem->mbVisible ) { - pItem->mbVisible = TRUE; + pItem->mbVisible = sal_True; - mbFormat = TRUE; + mbFormat = sal_True; if ( ImplIsItemUpdate() ) Invalidate(); @@ -1071,18 +1072,18 @@ void StatusBar::ShowItem( USHORT nItemId ) // ----------------------------------------------------------------------- -void StatusBar::HideItem( USHORT nItemId ) +void StatusBar::HideItem( sal_uInt16 nItemId ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { ImplStatusItem* pItem = (*mpItemList)[ nPos ]; if ( pItem->mbVisible ) { - pItem->mbVisible = FALSE; + pItem->mbVisible = sal_False; - mbFormat = TRUE; + mbFormat = sal_True; if ( ImplIsItemUpdate() ) Invalidate(); @@ -1093,14 +1094,14 @@ void StatusBar::HideItem( USHORT nItemId ) // ----------------------------------------------------------------------- -BOOL StatusBar::IsItemVisible( USHORT nItemId ) const +sal_Bool StatusBar::IsItemVisible( sal_uInt16 nItemId ) const { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) return (*mpItemList)[ nPos ]->mbVisible; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -1109,7 +1110,7 @@ void StatusBar::ShowItems() { if ( !mbVisibleItems ) { - mbVisibleItems = TRUE; + mbVisibleItems = sal_True; if ( !mbProgressMode ) Invalidate(); @@ -1123,7 +1124,7 @@ void StatusBar::HideItems() { if ( mbVisibleItems ) { - mbVisibleItems = FALSE; + mbVisibleItems = sal_False; if ( !mbProgressMode ) Invalidate(); @@ -1146,7 +1147,7 @@ void StatusBar::CopyItems( const StatusBar& rStatusBar ) mpItemList->push_back( new ImplStatusItem( *(*rStatusBar.mpItemList)[ i ] ) ); } - mbFormat = TRUE; + mbFormat = sal_True; if ( ImplIsItemUpdate() ) Invalidate(); } @@ -1161,7 +1162,7 @@ void StatusBar::Clear() } mpItemList->clear(); - mbFormat = TRUE; + mbFormat = sal_True; if ( ImplIsItemUpdate() ) Invalidate(); @@ -1170,14 +1171,14 @@ void StatusBar::Clear() // ----------------------------------------------------------------------- -USHORT StatusBar::GetItemCount() const +sal_uInt16 StatusBar::GetItemCount() const { - return (USHORT)mpItemList->size(); + return (sal_uInt16)mpItemList->size(); } // ----------------------------------------------------------------------- -USHORT StatusBar::GetItemId( USHORT nPos ) const +sal_uInt16 StatusBar::GetItemId( sal_uInt16 nPos ) const { if ( nPos < mpItemList->size() ) return (*mpItemList)[ nPos ]->mnId; @@ -1186,11 +1187,11 @@ USHORT StatusBar::GetItemId( USHORT nPos ) const // ----------------------------------------------------------------------- -USHORT StatusBar::GetItemPos( USHORT nItemId ) const +sal_uInt16 StatusBar::GetItemPos( sal_uInt16 nItemId ) const { for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { if ( (*mpItemList)[ i ]->mnId == nItemId ) { - return USHORT( i ); + return sal_uInt16( i ); } } @@ -1199,12 +1200,12 @@ USHORT StatusBar::GetItemPos( USHORT nItemId ) const // ----------------------------------------------------------------------- -USHORT StatusBar::GetItemId( const Point& rPos ) const +sal_uInt16 StatusBar::GetItemId( const Point& rPos ) const { if ( AreItemsVisible() && !mbFormat ) { - USHORT nItemCount = GetItemCount(); - USHORT nPos; + sal_uInt16 nItemCount = GetItemCount(); + sal_uInt16 nPos; for ( nPos = 0; nPos < nItemCount; nPos++ ) { // Rechteck holen @@ -1219,13 +1220,13 @@ USHORT StatusBar::GetItemId( const Point& rPos ) const // ----------------------------------------------------------------------- -Rectangle StatusBar::GetItemRect( USHORT nItemId ) const +Rectangle StatusBar::GetItemRect( sal_uInt16 nItemId ) const { Rectangle aRect; if ( AreItemsVisible() && !mbFormat ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { // Rechteck holen und Rahmen abziehen @@ -1244,11 +1245,11 @@ Rectangle StatusBar::GetItemRect( USHORT nItemId ) const // ----------------------------------------------------------------------- -Point StatusBar::GetItemTextPos( USHORT nItemId ) const +Point StatusBar::GetItemTextPos( sal_uInt16 nItemId ) const { if ( !mbFormat ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { // Rechteck holen @@ -1274,9 +1275,9 @@ Point StatusBar::GetItemTextPos( USHORT nItemId ) const // ----------------------------------------------------------------------- -ULONG StatusBar::GetItemWidth( USHORT nItemId ) const +sal_uLong StatusBar::GetItemWidth( sal_uInt16 nItemId ) const { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) return (*mpItemList)[ nPos ]->mnWidth; @@ -1286,9 +1287,9 @@ ULONG StatusBar::GetItemWidth( USHORT nItemId ) const // ----------------------------------------------------------------------- -StatusBarItemBits StatusBar::GetItemBits( USHORT nItemId ) const +StatusBarItemBits StatusBar::GetItemBits( sal_uInt16 nItemId ) const { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) return (*mpItemList)[ nPos ]->mnBits; @@ -1298,9 +1299,9 @@ StatusBarItemBits StatusBar::GetItemBits( USHORT nItemId ) const // ----------------------------------------------------------------------- -long StatusBar::GetItemOffset( USHORT nItemId ) const +long StatusBar::GetItemOffset( sal_uInt16 nItemId ) const { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) return (*mpItemList)[ nPos ]->mnOffset; @@ -1310,9 +1311,9 @@ long StatusBar::GetItemOffset( USHORT nItemId ) const // ----------------------------------------------------------------------- -void StatusBar::SetItemText( USHORT nItemId, const XubString& rText ) +void StatusBar::SetItemText( sal_uInt16 nItemId, const XubString& rText ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { @@ -1338,7 +1339,7 @@ void StatusBar::SetItemText( USHORT nItemId, const XubString& rText ) if ( pItem->mbVisible && !mbFormat && ImplIsItemUpdate() ) { Update(); - ImplDrawItem( TRUE, nPos, TRUE, FALSE ); + ImplDrawItem( sal_True, nPos, sal_True, sal_False ); Flush(); } } @@ -1347,9 +1348,9 @@ void StatusBar::SetItemText( USHORT nItemId, const XubString& rText ) // ----------------------------------------------------------------------- -const XubString& StatusBar::GetItemText( USHORT nItemId ) const +const XubString& StatusBar::GetItemText( sal_uInt16 nItemId ) const { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) return (*mpItemList)[ nPos ]->maText; @@ -1359,9 +1360,9 @@ const XubString& StatusBar::GetItemText( USHORT nItemId ) const // ----------------------------------------------------------------------- -void StatusBar::SetItemCommand( USHORT nItemId, const XubString& rCommand ) +void StatusBar::SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { @@ -1374,9 +1375,9 @@ void StatusBar::SetItemCommand( USHORT nItemId, const XubString& rCommand ) // ----------------------------------------------------------------------- -const XubString& StatusBar::GetItemCommand( USHORT nItemId ) +const XubString& StatusBar::GetItemCommand( sal_uInt16 nItemId ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) return (*mpItemList)[ nPos ]->maCommand; @@ -1386,9 +1387,9 @@ const XubString& StatusBar::GetItemCommand( USHORT nItemId ) // ----------------------------------------------------------------------- -void StatusBar::SetItemData( USHORT nItemId, void* pNewData ) +void StatusBar::SetItemData( sal_uInt16 nItemId, void* pNewData ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { @@ -1400,7 +1401,7 @@ void StatusBar::SetItemData( USHORT nItemId, void* pNewData ) !mbFormat && ImplIsItemUpdate() ) { Update(); - ImplDrawItem( TRUE, nPos, FALSE, FALSE ); + ImplDrawItem( sal_True, nPos, sal_False, sal_False ); Flush(); } } @@ -1408,9 +1409,9 @@ void StatusBar::SetItemData( USHORT nItemId, void* pNewData ) // ----------------------------------------------------------------------- -void* StatusBar::GetItemData( USHORT nItemId ) const +void* StatusBar::GetItemData( sal_uInt16 nItemId ) const { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) return (*mpItemList)[ nPos ]->mpUserData; @@ -1420,9 +1421,9 @@ void* StatusBar::GetItemData( USHORT nItemId ) const // ----------------------------------------------------------------------- -void StatusBar::SetHelpText( USHORT nItemId, const XubString& rText ) +void StatusBar::SetHelpText( sal_uInt16 nItemId, const XubString& rText ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) (*mpItemList)[ nPos ]->maHelpText = rText; @@ -1430,22 +1431,22 @@ void StatusBar::SetHelpText( USHORT nItemId, const XubString& rText ) // ----------------------------------------------------------------------- -const XubString& StatusBar::GetHelpText( USHORT nItemId ) const +const XubString& StatusBar::GetHelpText( sal_uInt16 nItemId ) const { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { ImplStatusItem* pItem = (*mpItemList)[ nPos ]; - if ( !pItem->maHelpText.Len() && ( pItem->mnHelpId || pItem->maCommand.Len() )) + if ( !pItem->maHelpText.Len() && ( pItem->maHelpId.getLength() || pItem->maCommand.Len() )) { Help* pHelp = Application::GetHelp(); if ( pHelp ) { if ( pItem->maCommand.Len() ) pItem->maHelpText = pHelp->GetHelpText( pItem->maCommand, this ); - if ( !pItem->maHelpText.Len() && pItem->mnHelpId ) - pItem->maHelpText = pHelp->GetHelpText( pItem->mnHelpId, this ); + if ( !pItem->maHelpText.Len() && pItem->maHelpId.getLength() ) + pItem->maHelpText = pHelp->GetHelpText( rtl::OStringToOUString( pItem->maHelpId, RTL_TEXTENCODING_UTF8 ), this ); } } @@ -1457,9 +1458,9 @@ const XubString& StatusBar::GetHelpText( USHORT nItemId ) const // ----------------------------------------------------------------------- -void StatusBar::SetQuickHelpText( USHORT nItemId, const XubString& rText ) +void StatusBar::SetQuickHelpText( sal_uInt16 nItemId, const XubString& rText ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) (*mpItemList)[ nPos ]->maQuickHelpText = rText; @@ -1467,9 +1468,9 @@ void StatusBar::SetQuickHelpText( USHORT nItemId, const XubString& rText ) // ----------------------------------------------------------------------- -const XubString& StatusBar::GetQuickHelpText( USHORT nItemId ) const +const XubString& StatusBar::GetQuickHelpText( sal_uInt16 nItemId ) const { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { @@ -1482,24 +1483,31 @@ const XubString& StatusBar::GetQuickHelpText( USHORT nItemId ) const // ----------------------------------------------------------------------- -void StatusBar::SetHelpId( USHORT nItemId, ULONG nHelpId ) +void StatusBar::SetHelpId( sal_uInt16 nItemId, const rtl::OString& rHelpId ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - (*mpItemList)[ nPos ]->mnHelpId = nHelpId; + (*mpItemList)[ nPos ]->maHelpId = rHelpId; } // ----------------------------------------------------------------------- -ULONG StatusBar::GetHelpId( USHORT nItemId ) const +rtl::OString StatusBar::GetHelpId( sal_uInt16 nItemId ) const { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); + rtl::OString aRet; if ( nPos != STATUSBAR_ITEM_NOTFOUND ) - return (*mpItemList)[ nPos ]->mnHelpId; + { + ImplStatusItem* pItem = (*mpItemList)[ nPos ]; + if ( pItem->maHelpId.getLength() ) + aRet = pItem->maHelpId; + else + aRet = ::rtl::OUStringToOString( pItem->maCommand, RTL_TEXTENCODING_UTF8 ); + } - return 0; + return aRet; } // ----------------------------------------------------------------------- @@ -1516,11 +1524,11 @@ void StatusBar::ImplCalcBorder( ) } if ( IsBottomBorder() ) mnCalcHeight -= 2; - mbFormat = TRUE; + mbFormat = sal_True; Invalidate(); } -void StatusBar::SetBottomBorder( BOOL bBottomBorder ) +void StatusBar::SetBottomBorder( sal_Bool bBottomBorder ) { if ( mbBottomBorder != bBottomBorder ) { @@ -1529,7 +1537,7 @@ void StatusBar::SetBottomBorder( BOOL bBottomBorder ) } } -void StatusBar::SetTopBorder( BOOL bTopBorder ) +void StatusBar::SetTopBorder( sal_Bool bTopBorder ) { if ( mpImplData->mbTopBorder != static_cast<bool>(bTopBorder) ) { @@ -1538,7 +1546,7 @@ void StatusBar::SetTopBorder( BOOL bTopBorder ) } } -BOOL StatusBar::IsTopBorder() const +sal_Bool StatusBar::IsTopBorder() const { return mpImplData->mbTopBorder; } @@ -1549,7 +1557,7 @@ void StatusBar::StartProgressMode( const XubString& rText ) { DBG_ASSERT( !mbProgressMode, "StatusBar::StartProgressMode(): progress mode is active" ); - mbProgressMode = TRUE; + mbProgressMode = sal_True; mnPercent = 0; maPrgsTxt = rText; @@ -1573,7 +1581,7 @@ void StatusBar::StartProgressMode( const XubString& rText ) // ----------------------------------------------------------------------- -void StatusBar::SetProgressValue( USHORT nNewPercent ) +void StatusBar::SetProgressValue( sal_uInt16 nNewPercent ) { DBG_ASSERT( mbProgressMode, "StatusBar::SetProgressValue(): no progrss mode" ); DBG_ASSERTWARNING( nNewPercent <= 100, "StatusBar::SetProgressValue(): nPercent > 100" ); @@ -1584,7 +1592,7 @@ void StatusBar::SetProgressValue( USHORT nNewPercent ) { Update(); SetLineColor(); - ImplDrawProgress( FALSE, mnPercent, nNewPercent ); + ImplDrawProgress( sal_False, mnPercent, nNewPercent ); Flush(); } mnPercent = nNewPercent; @@ -1596,7 +1604,7 @@ void StatusBar::EndProgressMode() { DBG_ASSERT( mbProgressMode, "StatusBar::EndProgressMode(): no progress mode" ); - mbProgressMode = FALSE; + mbProgressMode = sal_False; maPrgsTxt.Erase(); // Paint neu ausloesen um StatusBar wieder herzustellen @@ -1643,7 +1651,7 @@ void StatusBar::SetText( const XubString& rText ) Update(); long nOldTextWidth = GetTextWidth( GetText() ); Window::SetText( rText ); - ImplDrawText( TRUE, nOldTextWidth ); + ImplDrawText( sal_True, nOldTextWidth ); Flush(); } } @@ -1727,9 +1735,9 @@ Size StatusBar::CalcWindowSizePixel() const // ----------------------------------------------------------------------- -void StatusBar::SetAccessibleName( USHORT nItemId, const XubString& rName ) +void StatusBar::SetAccessibleName( sal_uInt16 nItemId, const XubString& rName ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) { @@ -1745,9 +1753,9 @@ void StatusBar::SetAccessibleName( USHORT nItemId, const XubString& rName ) // ----------------------------------------------------------------------- -const XubString& StatusBar::GetAccessibleName( USHORT nItemId ) const +const XubString& StatusBar::GetAccessibleName( sal_uInt16 nItemId ) const { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != STATUSBAR_ITEM_NOTFOUND ) return (*mpItemList)[ nPos ]->maAccessibleName; diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index a1a33b905cdf..002bf4acca6a 100644 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -30,23 +30,38 @@ #include "precompiled_vcl.hxx" #include <svsys.h> +#include <rtl/process.h> +#include <rtl/ref.hxx> +#include <tools/rc.h> +#include <vcl/window.h> #include <vcl/salinst.hxx> #include <vcl/salframe.hxx> #include <vcl/window.hxx> #include <vcl/salobj.hxx> - -#include <tools/rc.h> #include <vcl/svdata.hxx> -#include <vcl/window.h> +#include <vcl/sysdata.hxx> #include <vcl/svapp.hxx> #include <vcl/syschild.hxx> +#include <vcl/unohelp.hxx> + +#ifdef SOLAR_JAVA +#include <jni.h> +#endif +#include <comphelper/processfactory.hxx> +#include <jvmaccess/virtualmachine.hxx> +#include <com/sun/star/java/XJavaVM.hpp> +#include <com/sun/star/java/XJavaThreadRegister_11.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <vcl/syschild.hxx> + +using namespace ::com::sun::star; // ======================================================================= long ImplSysChildProc( void* pInst, SalObject* /* pObject */, - USHORT nEvent, const void* /* pEvent */ ) + sal_uInt16 nEvent, const void* /* pEvent */ ) { SystemChildWindow* pWindow = (SystemChildWindow*)pInst; long nRet = 0; @@ -58,33 +73,33 @@ long ImplSysChildProc( void* pInst, SalObject* /* pObject */, // Focus holen und zwar so, das alle Handler gerufen // werden, als ob dieses Fenster den Focus bekommt, // ohne das der Frame den Focus wieder klaut - pWindow->ImplGetFrameData()->mbSysObjFocus = TRUE; - pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = TRUE; + pWindow->ImplGetFrameData()->mbSysObjFocus = sal_True; + pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = sal_True; pWindow->ToTop( TOTOP_NOGRABFOCUS ); if( aDogTag.IsDead() ) break; - pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = FALSE; - pWindow->ImplGetFrameData()->mbInSysObjFocusHdl = TRUE; + pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = sal_False; + pWindow->ImplGetFrameData()->mbInSysObjFocusHdl = sal_True; pWindow->GrabFocus(); if( aDogTag.IsDead() ) break; - pWindow->ImplGetFrameData()->mbInSysObjFocusHdl = FALSE; + pWindow->ImplGetFrameData()->mbInSysObjFocusHdl = sal_False; break; case SALOBJ_EVENT_LOSEFOCUS: // Hintenrum einen LoseFocus ausloesen, das der Status // der Fenster dem entsprechenden Activate-Status // entspricht - pWindow->ImplGetFrameData()->mbSysObjFocus = FALSE; + pWindow->ImplGetFrameData()->mbSysObjFocus = sal_False; if ( !pWindow->ImplGetFrameData()->mnFocusId ) { - pWindow->ImplGetFrameData()->mbStartFocusState = TRUE; + pWindow->ImplGetFrameData()->mbStartFocusState = sal_True; Application::PostUserEvent( pWindow->ImplGetFrameData()->mnFocusId, LINK( pWindow->ImplGetFrameWindow(), Window, ImplAsyncFocusHdl ) ); } break; case SALOBJ_EVENT_TOTOP: - pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = TRUE; + pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = sal_True; if ( !Application::GetFocusWindow() || pWindow->HasChildPathFocus() ) pWindow->ToTop( TOTOP_NOGRABFOCUS ); else @@ -94,7 +109,7 @@ long ImplSysChildProc( void* pInst, SalObject* /* pObject */, pWindow->GrabFocus(); if( aDogTag.IsDead() ) break; - pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = FALSE; + pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = sal_False; break; } @@ -103,7 +118,7 @@ long ImplSysChildProc( void* pInst, SalObject* /* pObject */, // ======================================================================= -void SystemChildWindow::ImplInitSysChild( Window* pParent, WinBits nStyle, SystemWindowData *pData, BOOL bShow ) +void SystemChildWindow::ImplInitSysChild( Window* pParent, WinBits nStyle, SystemWindowData *pData, sal_Bool bShow ) { mpWindowImpl->mpSysObj = ImplGetSVData()->mpDefInst->CreateObject( pParent->ImplGetFrame(), pData, bShow ); @@ -128,7 +143,7 @@ SystemChildWindow::SystemChildWindow( Window* pParent, WinBits nStyle ) : // ----------------------------------------------------------------------- -SystemChildWindow::SystemChildWindow( Window* pParent, WinBits nStyle, SystemWindowData *pData, BOOL bShow ) : +SystemChildWindow::SystemChildWindow( Window* pParent, WinBits nStyle, SystemWindowData *pData, sal_Bool bShow ) : Window( WINDOW_SYSTEMCHILDWINDOW ) { ImplInitSysChild( pParent, nStyle, pData, bShow ); @@ -172,24 +187,155 @@ const SystemEnvData* SystemChildWindow::GetSystemData() const // ----------------------------------------------------------------------- -void SystemChildWindow::EnableEraseBackground( BOOL bEnable ) +void SystemChildWindow::EnableEraseBackground( sal_Bool bEnable ) { if ( mpWindowImpl->mpSysObj ) mpWindowImpl->mpSysObj->EnableEraseBackground( bEnable ); } -BOOL SystemChildWindow::IsEraseBackgroundEnabled() +// ----------------------------------------------------------------------- + +sal_Bool SystemChildWindow::IsEraseBackgroundEnabled() { if ( mpWindowImpl->mpSysObj ) return mpWindowImpl->mpSysObj->IsEraseBackgroundEnabled(); else - return FALSE; + return sal_False; +} + +// ----------------------------------------------------------------------- + +void SystemChildWindow::ImplTestJavaException( void* pEnv ) +{ +#ifdef SOLAR_JAVA + JNIEnv* pJavaEnv = reinterpret_cast< JNIEnv* >( pEnv ); + jthrowable jtThrowable = pJavaEnv->ExceptionOccurred(); + + if( jtThrowable ) + { // is it a java exception ? +#if OSL_DEBUG_LEVEL > 1 + pJavaEnv->ExceptionDescribe(); +#endif // OSL_DEBUG_LEVEL > 1 + pJavaEnv->ExceptionClear(); + + jclass jcThrowable = pJavaEnv->FindClass("java/lang/Throwable"); + jmethodID jmThrowable_getMessage = pJavaEnv->GetMethodID(jcThrowable, "getMessage", "()Ljava/lang/String;"); + jstring jsMessage = (jstring) pJavaEnv->CallObjectMethod(jtThrowable, jmThrowable_getMessage); + ::rtl::OUString ouMessage; + + if(jsMessage) + { + const jchar * jcMessage = pJavaEnv->GetStringChars(jsMessage, NULL); + ouMessage = ::rtl::OUString(jcMessage); + pJavaEnv->ReleaseStringChars(jsMessage, jcMessage); + } + + throw uno::RuntimeException(ouMessage, uno::Reference<uno::XInterface>()); + } +#endif // SOLAR_JAVA } -void SystemChildWindow::SetForwardKey( BOOL bEnable ) +// ----------------------------------------------------------------------- + +sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava ) { - if ( mpWindowImpl->mpSysObj ) - mpWindowImpl->mpSysObj->SetForwardKey( bEnable ); + sal_IntPtr nRet = 0; + +#if defined WNT + nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->hWnd ); +#elif defined QUARTZ + // FIXME: this is wrong + nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView ); +#elif defined UNX + if( !bUseJava ) + { + nRet = (sal_IntPtr) GetSystemData()->aWindow; + } +#ifdef SOLAR_JAVA + else + { + uno::Reference< lang::XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); + + if( xFactory.is() && ( GetSystemData()->aWindow > 0 ) ) + { + try + { + ::rtl::Reference< ::jvmaccess::VirtualMachine > xVM; + uno::Reference< java::XJavaVM > xJavaVM( xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine") ) ), uno::UNO_QUERY ); + uno::Sequence< sal_Int8 > aProcessID( 17 ); + + rtl_getGlobalProcessId( (sal_uInt8*) aProcessID.getArray() ); + aProcessID[ 16 ] = 0; + OSL_ENSURE(sizeof (sal_Int64) >= sizeof (jvmaccess::VirtualMachine *), "Pointer cannot be represented as sal_Int64"); + sal_Int64 nPointer = reinterpret_cast< sal_Int64 >( static_cast< jvmaccess::VirtualMachine * >(0)); + xJavaVM->getJavaVM(aProcessID) >>= nPointer; + xVM = reinterpret_cast< jvmaccess::VirtualMachine * >(nPointer); + + if( xVM.is() ) + { + try + { + ::jvmaccess::VirtualMachine::AttachGuard aVMAttachGuard( xVM ); + JNIEnv* pEnv = aVMAttachGuard.getEnvironment(); + + jclass jcToolkit = pEnv->FindClass("java/awt/Toolkit"); + ImplTestJavaException(pEnv); + + jmethodID jmToolkit_getDefaultToolkit = pEnv->GetStaticMethodID( jcToolkit, "getDefaultToolkit", "()Ljava/awt/Toolkit;" ); + ImplTestJavaException(pEnv); + + pEnv->CallStaticObjectMethod(jcToolkit, jmToolkit_getDefaultToolkit); + ImplTestJavaException(pEnv); + + jclass jcMotifAppletViewer = pEnv->FindClass("sun/plugin/navig/motif/MotifAppletViewer"); + if( pEnv->ExceptionOccurred() ) + { + pEnv->ExceptionClear(); + + jcMotifAppletViewer = pEnv->FindClass( "sun/plugin/viewer/MNetscapePluginContext"); + ImplTestJavaException(pEnv); + } + + jclass jcClassLoader = pEnv->FindClass("java/lang/ClassLoader"); + ImplTestJavaException(pEnv); + + jmethodID jmClassLoader_loadLibrary = pEnv->GetStaticMethodID( jcClassLoader, "loadLibrary", "(Ljava/lang/Class;Ljava/lang/String;Z)V"); + ImplTestJavaException(pEnv); + + jstring jsplugin = pEnv->NewStringUTF("javaplugin_jni"); + ImplTestJavaException(pEnv); + + pEnv->CallStaticVoidMethod(jcClassLoader, jmClassLoader_loadLibrary, jcMotifAppletViewer, jsplugin, JNI_FALSE); + ImplTestJavaException(pEnv); + + jmethodID jmMotifAppletViewer_getWidget = pEnv->GetStaticMethodID( jcMotifAppletViewer, "getWidget", "(IIIII)I" ); + ImplTestJavaException(pEnv); + + const Size aSize( GetOutputSizePixel() ); + jint ji_widget = pEnv->CallStaticIntMethod( jcMotifAppletViewer, jmMotifAppletViewer_getWidget, + GetSystemData()->aWindow, 0, 0, aSize.Width(), aSize.Height() ); + ImplTestJavaException(pEnv); + + nRet = static_cast< sal_IntPtr >( ji_widget ); + } + catch( uno::RuntimeException& ) + { + } + + if( !nRet ) + nRet = static_cast< sal_IntPtr >( GetSystemData()->aWindow ); + } + } + catch( ... ) + { + } + } + } +#endif // SOLAR_JAVA +#else // WNT || QUARTZ || UNX +#endif + + return nRet; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index fe3b6f5a585b..3343779f632b 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -79,16 +79,16 @@ SystemWindow::SystemWindow( WindowType nType ) : Window( nType ) { mpImplData = new ImplData; - mpWindowImpl->mbSysWin = TRUE; + mpWindowImpl->mbSysWin = sal_True; mpWindowImpl->mnActivateMode = ACTIVATE_MODE_GRABFOCUS; mpMenuBar = NULL; - mbPined = FALSE; - mbRollUp = FALSE; - mbRollFunc = FALSE; - mbDockBtn = FALSE; - mbHideBtn = FALSE; - mbSysChild = FALSE; + mbPined = sal_False; + mbRollUp = sal_False; + mbRollFunc = sal_False; + mbDockBtn = sal_False; + mbHideBtn = sal_False; + mbSysChild = sal_False; mnMenuBarMode = MENUBAR_MODE_NORMAL; mnIcon = 0; } @@ -113,8 +113,8 @@ long SystemWindow::Notify( NotifyEvent& rNEvt ) if( pWin && pWin->IsSystemWindow() ) pMBar = ((SystemWindow*)pWin)->GetMenuBar(); } - if ( pMBar && pMBar->ImplHandleKeyEvent( *rNEvt.GetKeyEvent(), FALSE ) ) - return TRUE; + if ( pMBar && pMBar->ImplHandleKeyEvent( *rNEvt.GetKeyEvent(), sal_False ) ) + return sal_True; } return Window::Notify( rNEvt ); @@ -133,7 +133,7 @@ long SystemWindow::PreNotify( NotifyEvent& rNEvt ) { // Ctrl-F6 goes directly to the document GrabFocusToDocument(); - return TRUE; + return sal_True; } else { @@ -158,7 +158,7 @@ long SystemWindow::PreNotify( NotifyEvent& rNEvt ) pTList = pSysWin->mpImplData->mpTaskPaneList; } if( pTList && pTList->HandleKeyEvent( *rNEvt.GetKeyEvent() ) ) - return TRUE; + return sal_True; } } return Window::PreNotify( rNEvt ); @@ -188,17 +188,17 @@ TaskPaneList* SystemWindow::GetTaskPaneList() // ----------------------------------------------------------------------- -BOOL SystemWindow::Close() +sal_Bool SystemWindow::Close() { ImplDelData aDelData; ImplAddDel( &aDelData ); ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE ); if ( aDelData.IsDelete() ) - return FALSE; + return sal_False; ImplRemoveDel( &aDelData ); if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() ) - return FALSE; + return sal_False; // Is Window not closeable, ignore close Window* pBorderWin = ImplGetBorderWindow(); @@ -210,17 +210,17 @@ BOOL SystemWindow::Close() if ( !(nStyle & WB_CLOSEABLE) ) { Sound::Beep( SOUND_DISABLE, this ); - return FALSE; + return sal_False; } Hide(); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -void SystemWindow::TitleButtonClick( USHORT ) +void SystemWindow::TitleButtonClick( sal_uInt16 ) { } @@ -244,14 +244,14 @@ void SystemWindow::Resizing( Size& ) // ----------------------------------------------------------------------- -void SystemWindow::SetZLevel( BYTE nLevel ) +void SystemWindow::SetZLevel( sal_uInt8 nLevel ) { Window* pWindow = this; while ( pWindow->mpWindowImpl->mpBorderWindow ) pWindow = pWindow->mpWindowImpl->mpBorderWindow; if ( pWindow->mpWindowImpl->mbOverlapWin && !pWindow->mpWindowImpl->mbFrame ) { - BYTE nOldLevel = pWindow->mpWindowImpl->mpOverlapData->mnTopLevel; + sal_uInt8 nOldLevel = pWindow->mpWindowImpl->mpOverlapData->mnTopLevel; pWindow->mpWindowImpl->mpOverlapData->mnTopLevel = nLevel; // Wenn der neue Level groesser als der alte ist, schieben // wir das Fenster nach hinten @@ -297,7 +297,7 @@ const rtl::OUString& SystemWindow::GetRepresentedURL() const // ----------------------------------------------------------------------- -void SystemWindow::SetIcon( USHORT nIcon ) +void SystemWindow::SetIcon( sal_uInt16 nIcon ) { if ( mnIcon == nIcon ) return; @@ -317,7 +317,7 @@ void SystemWindow::SetIcon( USHORT nIcon ) // ----------------------------------------------------------------------- -BYTE SystemWindow::GetZLevel() const +sal_uInt8 SystemWindow::GetZLevel() const { const Window* pWindow = this; while ( pWindow->mpWindowImpl->mpBorderWindow ) @@ -325,12 +325,12 @@ BYTE SystemWindow::GetZLevel() const if ( pWindow->mpWindowImpl->mpOverlapData ) return pWindow->mpWindowImpl->mpOverlapData->mnTopLevel; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void SystemWindow::EnableSaveBackground( BOOL bSave ) +void SystemWindow::EnableSaveBackground( sal_Bool bSave ) { if( ImplGetSVData()->maWinData.mbNoSaveBackground ) bSave = false; @@ -348,7 +348,7 @@ void SystemWindow::EnableSaveBackground( BOOL bSave ) // ----------------------------------------------------------------------- -BOOL SystemWindow::IsSaveBackgroundEnabled() const +sal_Bool SystemWindow::IsSaveBackgroundEnabled() const { const Window* pWindow = this; while ( pWindow->mpWindowImpl->mpBorderWindow ) @@ -356,12 +356,12 @@ BOOL SystemWindow::IsSaveBackgroundEnabled() const if ( pWindow->mpWindowImpl->mpOverlapData ) return pWindow->mpWindowImpl->mpOverlapData->mbSaveBack; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void SystemWindow::ShowTitleButton( USHORT nButton, BOOL bVisible ) +void SystemWindow::ShowTitleButton( sal_uInt16 nButton, sal_Bool bVisible ) { if ( nButton == TITLE_BUTTON_DOCKING ) { @@ -392,7 +392,7 @@ void SystemWindow::ShowTitleButton( USHORT nButton, BOOL bVisible ) // ----------------------------------------------------------------------- -BOOL SystemWindow::IsTitleButtonVisible( USHORT nButton ) const +sal_Bool SystemWindow::IsTitleButtonVisible( sal_uInt16 nButton ) const { if ( nButton == TITLE_BUTTON_DOCKING ) return mbDockBtn; @@ -402,7 +402,7 @@ BOOL SystemWindow::IsTitleButtonVisible( USHORT nButton ) const // ----------------------------------------------------------------------- -void SystemWindow::SetPin( BOOL bPin ) +void SystemWindow::SetPin( sal_Bool bPin ) { if ( bPin != mbPined ) { @@ -419,16 +419,16 @@ void SystemWindow::RollUp() if ( !mbRollUp ) { maOrgSize = GetOutputSizePixel(); - mbRollFunc = TRUE; + mbRollFunc = sal_True; Size aSize = maRollUpOutSize; if ( !aSize.Width() ) aSize.Width() = GetOutputSizePixel().Width(); - mbRollUp = TRUE; + mbRollUp = sal_True; if ( mpWindowImpl->mpBorderWindow ) - ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetRollUp( TRUE, aSize ); + ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetRollUp( sal_True, aSize ); else SetOutputSizePixel( aSize ); - mbRollFunc = FALSE; + mbRollFunc = sal_False; } } @@ -438,9 +438,9 @@ void SystemWindow::RollDown() { if ( mbRollUp ) { - mbRollUp = FALSE; + mbRollUp = sal_False; if ( mpWindowImpl->mpBorderWindow ) - ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetRollUp( FALSE, maOrgSize ); + ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetRollUp( sal_False, maOrgSize ); else SetOutputSizePixel( maOrgSize ); } @@ -502,7 +502,7 @@ Size SystemWindow::GetResizeOutputSizePixel() const static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rStr ) { - ULONG nValidMask = 0; + sal_uLong nValidMask = 0; xub_StrLen nIndex = 0; ByteString aTokenStr; @@ -555,7 +555,7 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS { // #94144# allow Minimize again, should be masked out when read from configuration // 91625 - ignore Minimize - ULONG nState = (ULONG)aTokenStr.ToInt32(); + sal_uLong nState = (sal_uLong)aTokenStr.ToInt32(); //nState &= ~(WINDOWSTATE_STATE_MINIMIZED); rData.SetState( nState ); nValidMask |= WINDOWSTATE_MASK_STATE; @@ -617,7 +617,7 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS static void ImplWindowStateToStr( const WindowStateData& rData, ByteString& rStr ) { - ULONG nValidMask = rData.GetMask(); + sal_uLong nValidMask = rData.GetMask(); if ( !nValidMask ) return; @@ -637,7 +637,7 @@ static void ImplWindowStateToStr( const WindowStateData& rData, ByteString& rStr { // #94144# allow Minimize again, should be masked out when read from configuration // 91625 - ignore Minimize - ULONG nState = rData.GetState(); + sal_uLong nState = rData.GetState(); //nState &= ~(WINDOWSTATE_STATE_MINIMIZED); rStr.Append( ByteString::CreateFromInt32( (long)nState ) ); } @@ -717,7 +717,7 @@ void SystemWindow::ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, lo void SystemWindow::SetWindowStateData( const WindowStateData& rData ) { - ULONG nValidMask = rData.GetMask(); + sal_uLong nValidMask = rData.GetMask(); if ( !nValidMask ) return; @@ -730,7 +730,7 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData ) if ( pWindow->mpWindowImpl->mbFrame ) { - ULONG nState = rData.GetState(); + sal_uLong nState = rData.GetState(); SalFrameState aState; aState.mnMask = rData.GetMask(); aState.mnX = rData.GetX(); @@ -769,7 +769,7 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData ) Rectangle aDesktop = GetDesktopRectPixel(); ImplSVData *pSVData = ImplGetSVData(); Window *pWin = pSVData->maWinData.mpFirstFrame; - BOOL bWrapped = FALSE; + sal_Bool bWrapped = sal_False; while( pWin ) { if( !pWin->ImplIsRealParentPath( this ) && ( pWin != this ) && @@ -790,7 +790,7 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData ) (unsigned long) (aState.mnY + displacement + aState.mnHeight + g.nBottomDecoration) > (unsigned long) aDesktop.nBottom ) break; // further displacement not possible -> break // avoid endless testing - bWrapped = TRUE; + bWrapped = sal_True; } else { @@ -827,7 +827,7 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData ) } else { - USHORT nPosSize = 0; + sal_uInt16 nPosSize = 0; if ( nValidMask & WINDOWSTATE_MASK_X ) nPosSize |= WINDOW_POSSIZE_X; if ( nValidMask & WINDOWSTATE_MASK_Y ) @@ -859,7 +859,7 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData ) // 91625 - ignore Minimize if ( nValidMask & WINDOWSTATE_MASK_STATE ) { - ULONG nState = rData.GetState(); + sal_uLong nState = rData.GetState(); if ( nState & WINDOWSTATE_STATE_ROLLUP ) RollUp(); else @@ -872,7 +872,7 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData ) void SystemWindow::GetWindowStateData( WindowStateData& rData ) const { - ULONG nValidMask = rData.GetMask(); + sal_uLong nValidMask = rData.GetMask(); if ( !nValidMask ) return; @@ -934,7 +934,7 @@ void SystemWindow::GetWindowStateData( WindowStateData& rData ) const { Point aPos = GetPosPixel(); Size aSize = GetSizePixel(); - ULONG nState = 0; + sal_uLong nState = 0; if ( IsRollUp() ) { @@ -969,7 +969,7 @@ void SystemWindow::SetWindowState( const ByteString& rStr ) // ----------------------------------------------------------------------- -ByteString SystemWindow::GetWindowState( ULONG nMask ) const +ByteString SystemWindow::GetWindowState( sal_uLong nMask ) const { WindowStateData aData; aData.SetMask( nMask ); @@ -1013,7 +1013,7 @@ void SystemWindow::SetMenuBar( MenuBar* pMenuBar ) ImplToBottomChild(); if ( pOldMenuBar ) { - BOOL bDelete = (pMenuBar == 0) ? TRUE : FALSE; + sal_Bool bDelete = (pMenuBar == 0) ? sal_True : sal_False; if( bDelete && pOldWindow ) { if( mpImplData->mpTaskPaneList ) @@ -1046,7 +1046,7 @@ void SystemWindow::SetMenuBar( MenuBar* pMenuBar ) // ----------------------------------------------------------------------- -void SystemWindow::SetMenuBarMode( USHORT nMode ) +void SystemWindow::SetMenuBarMode( sal_uInt16 nMode ) { if ( mnMenuBarMode != nMode ) { @@ -1054,20 +1054,20 @@ void SystemWindow::SetMenuBarMode( USHORT nMode ) if ( mpWindowImpl->mpBorderWindow && (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) ) { if ( nMode == MENUBAR_MODE_HIDE ) - ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetMenuBarMode( TRUE ); + ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetMenuBarMode( sal_True ); else - ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetMenuBarMode( FALSE ); + ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetMenuBarMode( sal_False ); } } } // ----------------------------------------------------------------------- -BOOL SystemWindow::ImplIsInTaskPaneList( Window* pWin ) +sal_Bool SystemWindow::ImplIsInTaskPaneList( Window* pWin ) { if( mpImplData && mpImplData->mpTaskPaneList ) return mpImplData->mpTaskPaneList->IsInList( pWin ); - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx index 54985a3a36e2..32e8a0dcec92 100644 --- a/vcl/source/window/tabdlg.cxx +++ b/vcl/source/window/tabdlg.cxx @@ -42,7 +42,7 @@ void TabDialog::ImplInitTabDialogData() mpFixedLine = NULL; mpViewWindow = NULL; meViewAlign = WINDOWALIGN_LEFT; - mbPosControls = TRUE; + mbPosControls = sal_True; } // ----------------------------------------------------------------------- @@ -104,7 +104,7 @@ void TabDialog::ImplPosControls() long nViewOffY = 0; long nViewWidth = 0; long nViewHeight = 0; - USHORT nViewPosFlags = WINDOW_POSSIZE_POS; + sal_uInt16 nViewPosFlags = WINDOW_POSSIZE_POS; Size aViewSize = mpViewWindow->GetSizePixel(); if ( meViewAlign == WINDOWALIGN_TOP ) { @@ -152,7 +152,7 @@ void TabDialog::ImplPosControls() pTabControl->SetPosPixel( aTabOffset ); // Alle anderen Childs positionieren - BOOL bTabCtrl = FALSE; + sal_Bool bTabCtrl = sal_False; int nLines = 0; long nX; long nY = aDlgSize.Height(); @@ -170,7 +170,7 @@ void TabDialog::ImplPosControls() if ( pChild2->IsVisible() && (pChild2 != mpViewWindow) ) { if ( pChild2 == pTabControl ) - bTabCtrl = TRUE; + bTabCtrl = sal_True; else if ( bTabCtrl ) { if ( !nLines ) @@ -212,7 +212,7 @@ void TabDialog::ImplPosControls() mpFixedLine->Show(); } - mbPosControls = FALSE; + mbPosControls = sal_False; } // ----------------------------------------------------------------------- diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx index cccd315d7189..f109f2079a4c 100644 --- a/vcl/source/window/tabpage.cxx +++ b/vcl/source/window/tabpage.cxx @@ -57,7 +57,7 @@ void TabPage::ImplInit( Window* pParent, WinBits nStyle ) // if the tabpage is drawn (ie filled) by a native widget, make sure all contols will have transparent background // otherwise they will paint with a wrong background if( IsNativeControlSupported(CTRL_TAB_BODY, PART_ENTIRE_CONTROL) && GetParent() && (GetParent()->GetType() == WINDOW_TABCONTROL) ) - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); } // ----------------------------------------------------------------------- @@ -67,16 +67,16 @@ void TabPage::ImplInitSettings() Window* pParent = GetParent(); if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -166,7 +166,7 @@ void TabPage::Paint( const Rectangle& ) } // ----------------------------------------------------------------------- -void TabPage::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG ) +void TabPage::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx index f705609306a1..56bd9d799cce 100644 --- a/vcl/source/window/taskpanelist.cxx +++ b/vcl/source/window/taskpanelist.cxx @@ -140,7 +140,7 @@ void TaskPaneList::AddWindow( Window *pWindow ) } mTaskPanes.insert( insertionPos, pWindow ); - pWindow->ImplIsInTaskPaneList( TRUE ); + pWindow->ImplIsInTaskPaneList( sal_True ); } } @@ -153,25 +153,25 @@ void TaskPaneList::RemoveWindow( Window *pWindow ) if( p != mTaskPanes.end() ) { mTaskPanes.erase( p ); - pWindow->ImplIsInTaskPaneList( FALSE ); + pWindow->ImplIsInTaskPaneList( sal_False ); } } // -------------------------------------------------- -BOOL TaskPaneList::IsInList( Window *pWindow ) +sal_Bool TaskPaneList::IsInList( Window *pWindow ) { ::std::vector< Window* >::iterator p; p = ::std::find( mTaskPanes.begin(), mTaskPanes.end(), pWindow ); if( p != mTaskPanes.end() ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // -------------------------------------------------- -BOOL TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent ) +sal_Bool TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent ) { // F6 cycles through everything and works always @@ -183,11 +183,11 @@ BOOL TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent ) // // Since the design of Ctrl-Tab looks to be inconsistent ( non-modal dialogs are not reachable // and the shortcut conflicts with tab-control shortcut ), it is no more supported - BOOL bSplitterOnly = FALSE; - BOOL bFocusInList = FALSE; + sal_Bool bSplitterOnly = sal_False; + sal_Bool bFocusInList = sal_False; KeyCode aKeyCode = aKeyEvent.GetKeyCode(); - BOOL bForward = !aKeyCode.IsShift(); - if( aKeyCode.GetCode() == KEY_F6 ) // F6 + sal_Bool bForward = !aKeyCode.IsShift(); + if( aKeyCode.GetCode() == KEY_F6 && ! aKeyCode.IsMod2() ) // F6 { bSplitterOnly = aKeyCode.IsMod1() && aKeyCode.IsShift(); @@ -196,43 +196,43 @@ BOOL TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent ) while( p != mTaskPanes.end() ) { Window *pWin = *p; - if( pWin->HasChildPathFocus( TRUE ) ) + if( pWin->HasChildPathFocus( sal_True ) ) { - bFocusInList = TRUE; + bFocusInList = sal_True; // Ctrl-F6 goes directly to the document if( !pWin->IsDialog() && aKeyCode.IsMod1() && !aKeyCode.IsShift() ) { pWin->GrabFocusToDocument(); - return TRUE; + return sal_True; } // activate next task pane Window *pNextWin = NULL; if( bSplitterOnly ) - pNextWin = FindNextSplitter( *p, TRUE ); + pNextWin = FindNextSplitter( *p, sal_True ); else pNextWin = FindNextFloat( *p, bForward ); if( pNextWin != pWin ) { - ImplGetSVData()->maWinData.mbNoSaveFocus = TRUE; + ImplGetSVData()->maWinData.mbNoSaveFocus = sal_True; ImplTaskPaneListGrabFocus( pNextWin ); - ImplGetSVData()->maWinData.mbNoSaveFocus = FALSE; + ImplGetSVData()->maWinData.mbNoSaveFocus = sal_False; } else { // forward key if no splitter found if( bSplitterOnly ) - return FALSE; + return sal_False; // we did not find another taskpane, so // put focus back into document pWin->GrabFocusToDocument(); } - return TRUE; + return sal_True; } else p++; @@ -243,24 +243,24 @@ BOOL TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent ) { Window *pWin; if( bSplitterOnly ) - pWin = FindNextSplitter( NULL, TRUE ); + pWin = FindNextSplitter( NULL, sal_True ); else pWin = FindNextFloat( NULL, bForward ); if( pWin ) { ImplTaskPaneListGrabFocus( pWin ); - return TRUE; + return sal_True; } } } - return FALSE; + return sal_False; } // -------------------------------------------------- // returns next valid pane -Window* TaskPaneList::FindNextPane( Window *pWindow, BOOL bForward ) +Window* TaskPaneList::FindNextPane( Window *pWindow, sal_Bool bForward ) { if( bForward ) ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSort() ); @@ -295,7 +295,7 @@ Window* TaskPaneList::FindNextPane( Window *pWindow, BOOL bForward ) // -------------------------------------------------- // returns next splitter -Window* TaskPaneList::FindNextSplitter( Window *pWindow, BOOL bForward ) +Window* TaskPaneList::FindNextSplitter( Window *pWindow, sal_Bool bForward ) { if( bForward ) ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSort() ); @@ -334,7 +334,7 @@ Window* TaskPaneList::FindNextSplitter( Window *pWindow, BOOL bForward ) // -------------------------------------------------- // returns first valid item (regardless of type) if pWindow==0, otherwise returns next valid float -Window* TaskPaneList::FindNextFloat( Window *pWindow, BOOL bForward ) +Window* TaskPaneList::FindNextFloat( Window *pWindow, sal_Bool bForward ) { if( bForward ) ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSort() ); diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index d8698966d14e..0eae498111ab 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -108,24 +108,24 @@ DBG_NAMEEX( Window ) #define TB_MAX_GROUPS 100 -#define DOCK_LINEHSIZE ((USHORT)0x0001) -#define DOCK_LINEVSIZE ((USHORT)0x0002) -#define DOCK_LINERIGHT ((USHORT)0x1000) -#define DOCK_LINEBOTTOM ((USHORT)0x2000) -#define DOCK_LINELEFT ((USHORT)0x4000) -#define DOCK_LINETOP ((USHORT)0x8000) +#define DOCK_LINEHSIZE ((sal_uInt16)0x0001) +#define DOCK_LINEVSIZE ((sal_uInt16)0x0002) +#define DOCK_LINERIGHT ((sal_uInt16)0x1000) +#define DOCK_LINEBOTTOM ((sal_uInt16)0x2000) +#define DOCK_LINELEFT ((sal_uInt16)0x4000) +#define DOCK_LINETOP ((sal_uInt16)0x8000) #define DOCK_LINEOFFSET 3 // ----------------------------------------------------------------------- -static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, USHORT highlight, BOOL bChecked, BOOL bEnabled, BOOL bIsWindow ); +static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bEnabled, sal_Bool bIsWindow ); // ----------------------------------------------------------------------- struct ImplToolSize { long mnWidth; long mnHeight; - USHORT mnLines; + sal_uInt16 mnLines; }; struct ImplToolSizeArray @@ -153,12 +153,12 @@ private: Accelerator maAccel; long mnMinWidth; long mnMaxWidth; - USHORT mnLineMode; - USHORT mnStartLines; + sal_uInt16 mnLineMode; + sal_uInt16 mnStartLines; void* mpCustomizeData; - BOOL mbCustomizeMode; - BOOL mbResizeMode; - BOOL mbShowDragRect; + sal_Bool mbCustomizeMode; + sal_Bool mbResizeMode; + sal_Bool mbShowDragRect; public: ImplTBDragMgr(); @@ -182,18 +182,18 @@ public: void StartDragging( ToolBox* pDragBox, const Point& rPos, const Rectangle& rRect, - USHORT nLineMode, BOOL bResizeItem, + sal_uInt16 nLineMode, sal_Bool bResizeItem, void* pData = NULL ); void Dragging( const Point& rPos ); - void EndDragging( BOOL bOK = TRUE ); + void EndDragging( sal_Bool bOK = sal_True ); void HideDragRect() { if ( mbShowDragRect ) mpDragBox->HideTracking(); } void UpdateDragRect(); DECL_LINK( SelectHdl, Accelerator* ); void StartCustomizeMode(); void EndCustomizeMode(); - BOOL IsCustomizeMode() { return mbCustomizeMode; } - BOOL IsResizeMode() { return mbResizeMode; } + sal_Bool IsCustomizeMode() { return mbCustomizeMode; } + sal_Bool IsResizeMode() { return mbResizeMode; } }; // ----------------------------------------------------------------------- @@ -338,7 +338,7 @@ void ToolBox::ImplDrawGrip( ToolBox* pThis ) // execute pending paint requests ImplCheckUpdate( pThis ); - BOOL bNativeOk = FALSE; + sal_Bool bNativeOk = sal_False; if( pThis->IsNativeControlSupported( CTRL_TOOLBAR, pThis->mbHorz ? PART_THUMB_HORZ : PART_THUMB_VERT ) ) { ToolbarValue aToolbarValue; @@ -422,7 +422,7 @@ void ToolBox::ImplDrawGradientBackground( ToolBox* pThis, ImplDockingWindowWrapp g.SetStartColor( startCol ); g.SetEndColor( endCol ); - BOOL bLineColor = pThis->IsLineColor(); + sal_Bool bLineColor = pThis->IsLineColor(); Color aOldCol = pThis->GetLineColor(); pThis->SetLineColor( pThis->GetSettings().GetStyleSettings().GetShadowColor() ); @@ -512,7 +512,7 @@ void ToolBox::ImplDrawGradientBackground( ToolBox* pThis, ImplDockingWindowWrapp if( pThis->mbHorz ) { long y = 0; - BOOL bDrawSep = FALSE; // pThis->ImplIsFloatingMode() && ( pThis->mnWinStyle & WB_LINESPACING ); + sal_Bool bDrawSep = sal_False; // pThis->ImplIsFloatingMode() && ( pThis->mnWinStyle & WB_LINESPACING ); pThis->DrawGradient( Rectangle( 0, y, aTopLineSz.Width(), y+aTopLineSz.Height()), g ); y += aTopLineSz.Height(); @@ -554,7 +554,7 @@ void ToolBox::ImplDrawGradientBackground( ToolBox* pThis, ImplDockingWindowWrapp } -BOOL ToolBox::ImplDrawNativeBackground( ToolBox* pThis, const Region & ) +sal_Bool ToolBox::ImplDrawNativeBackground( ToolBox* pThis, const Region & ) { // use NWF Point aPt; @@ -578,7 +578,7 @@ void ToolBox::ImplDrawTransparentBackground( ToolBox* pThis, const Region &rRegi pThis->mpData->mbIsPaintLocked = bOldPaintLock; } -void ToolBox::ImplDrawConstantBackground( ToolBox* pThis, const Region &rRegion, BOOL bIsInPopupMode ) +void ToolBox::ImplDrawConstantBackground( ToolBox* pThis, const Region &rRegion, sal_Bool bIsInPopupMode ) { // draw a constant color if( !bIsInPopupMode ) @@ -599,7 +599,7 @@ void ToolBox::ImplDrawBackground( ToolBox* pThis, const Rectangle &rRect ) ImplCheckUpdate( pThis ); ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( pThis ); - BOOL bIsInPopupMode = pThis->ImplIsInPopupMode(); + sal_Bool bIsInPopupMode = pThis->ImplIsInPopupMode(); Region aPaintRegion( rRect ); @@ -624,7 +624,7 @@ void ToolBox::ImplDrawBackground( ToolBox* pThis, const Rectangle &rRect ) // toolbars known to the dockingmanager will be drawn using NWF or a gradient // docked toolbars are transparent and NWF is already used in the docking area which is their common background // so NWF is used here for floating toolbars only - BOOL bNativeOk = FALSE; + sal_Bool bNativeOk = sal_False; if( pThis->ImplIsFloatingMode() && pThis->IsNativeControlSupported( CTRL_TOOLBAR, PART_ENTIRE_CONTROL) ) bNativeOk = ImplDrawNativeBackground( pThis, aPaintRegion ); @@ -644,7 +644,7 @@ void ToolBox::ImplDrawBackground( ToolBox* pThis, const Rectangle &rRect ) pThis->Pop(); } -void ToolBox::ImplErase( ToolBox* pThis, const Rectangle &rRect, BOOL bHighlight, BOOL bHasOpenPopup ) +void ToolBox::ImplErase( ToolBox* pThis, const Rectangle &rRect, sal_Bool bHighlight, sal_Bool bHasOpenPopup ) { // the background of non NWF buttons is painted in a constant color // to have the same highlight color (transparency in DrawSelectionBackground()) @@ -763,7 +763,7 @@ const ImplToolItem *ToolBox::ImplGetFirstClippedItem( const ToolBox* pThis ) // ----------------------------------------------------------------------- -Size ToolBox::ImplCalcSize( const ToolBox* pThis, USHORT nCalcLines, USHORT nCalcMode ) +Size ToolBox::ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uInt16 nCalcMode ) { long nMax; long nLeft = 0; @@ -772,45 +772,45 @@ Size ToolBox::ImplCalcSize( const ToolBox* pThis, USHORT nCalcLines, USHORT nCal long nBottom = 0; Size aSize; WindowAlign eOldAlign = pThis->meAlign; - BOOL bOldHorz = pThis->mbHorz; - BOOL bOldAssumeDocked = pThis->mpData->mbAssumeDocked; - BOOL bOldAssumeFloating = pThis->mpData->mbAssumeFloating; + sal_Bool bOldHorz = pThis->mbHorz; + sal_Bool bOldAssumeDocked = pThis->mpData->mbAssumeDocked; + sal_Bool bOldAssumeFloating = pThis->mpData->mbAssumeFloating; if ( nCalcMode ) { - BOOL bOldFloatingMode = pThis->ImplIsFloatingMode(); + sal_Bool bOldFloatingMode = pThis->ImplIsFloatingMode(); - pThis->mpData->mbAssumeDocked = FALSE; - pThis->mpData->mbAssumeFloating = FALSE; + pThis->mpData->mbAssumeDocked = sal_False; + pThis->mpData->mbAssumeFloating = sal_False; if ( nCalcMode == TB_CALCMODE_HORZ ) { - pThis->mpData->mbAssumeDocked = TRUE; // force non-floating mode during calculation + pThis->mpData->mbAssumeDocked = sal_True; // force non-floating mode during calculation ImplCalcBorder( WINDOWALIGN_TOP, nLeft, nTop, nRight, nBottom, pThis ); - ((ToolBox*)pThis)->mbHorz = TRUE; + ((ToolBox*)pThis)->mbHorz = sal_True; if ( pThis->mbHorz != bOldHorz ) ((ToolBox*)pThis)->meAlign = WINDOWALIGN_TOP; } else if ( nCalcMode == TB_CALCMODE_VERT ) { - pThis->mpData->mbAssumeDocked = TRUE; // force non-floating mode during calculation + pThis->mpData->mbAssumeDocked = sal_True; // force non-floating mode during calculation ImplCalcBorder( WINDOWALIGN_LEFT, nLeft, nTop, nRight, nBottom, pThis ); - ((ToolBox*)pThis)->mbHorz = FALSE; + ((ToolBox*)pThis)->mbHorz = sal_False; if ( pThis->mbHorz != bOldHorz ) ((ToolBox*)pThis)->meAlign = WINDOWALIGN_LEFT; } else if ( nCalcMode == TB_CALCMODE_FLOAT ) { - pThis->mpData->mbAssumeFloating = TRUE; // force non-floating mode during calculation + pThis->mpData->mbAssumeFloating = sal_True; // force non-floating mode during calculation nLeft = nTop = nRight = nBottom = 0; - ((ToolBox*)pThis)->mbHorz = TRUE; + ((ToolBox*)pThis)->mbHorz = sal_True; if ( pThis->mbHorz != bOldHorz ) ((ToolBox*)pThis)->meAlign = WINDOWALIGN_TOP; } if ( (pThis->meAlign != eOldAlign) || (pThis->mbHorz != bOldHorz) || (pThis->ImplIsFloatingMode() != bOldFloatingMode ) ) - ((ToolBox*)pThis)->mbCalc = TRUE; + ((ToolBox*)pThis)->mbCalc = sal_True; } else ImplCalcBorder( pThis->meAlign, nLeft, nTop, nRight, nBottom, pThis ); @@ -872,7 +872,7 @@ Size ToolBox::ImplCalcSize( const ToolBox* pThis, USHORT nCalcLines, USHORT nCal { ((ToolBox*)pThis)->meAlign = eOldAlign; ((ToolBox*)pThis)->mbHorz = bOldHorz; - ((ToolBox*)pThis)->mbCalc = TRUE; + ((ToolBox*)pThis)->mbCalc = sal_True; } } @@ -918,13 +918,13 @@ void ToolBox::ImplCalcFloatSizes( ToolBox* pThis ) // calc an upper bound for ImplCalcBreaks below long upperBoundWidth = nCalcSize * pThis->mpData->m_aItems.size(); - USHORT i; - USHORT nLines; - USHORT nCalcLines; - USHORT nTempLines; + sal_uInt16 i; + sal_uInt16 nLines; + sal_uInt16 nCalcLines; + sal_uInt16 nTempLines; long nHeight; long nMaxLineWidth; - nCalcLines = pThis->ImplCalcBreaks( nCalcSize, &nMaxLineWidth, TRUE ); + nCalcLines = pThis->ImplCalcBreaks( nCalcSize, &nMaxLineWidth, sal_True ); pThis->mpFloatSizeAry = new ImplToolSizeArray; pThis->mpFloatSizeAry->mpSize = new ImplToolSize[nCalcLines]; @@ -946,7 +946,7 @@ void ToolBox::ImplCalcFloatSizes( ToolBox* pThis ) do { nCalcSize += pThis->mnMaxItemWidth; - nTempLines = pThis->ImplCalcBreaks( nCalcSize, &nMaxLineWidth, TRUE ); + nTempLines = pThis->ImplCalcBreaks( nCalcSize, &nMaxLineWidth, sal_True ); } while ( (nCalcSize < upperBoundWidth) && (nLines < nTempLines) && (nTempLines != 1) ); if ( nTempLines < nLines ) @@ -958,7 +958,7 @@ void ToolBox::ImplCalcFloatSizes( ToolBox* pThis ) // ----------------------------------------------------------------------- -Size ToolBox::ImplCalcFloatSize( ToolBox* pThis, USHORT& rLines ) +Size ToolBox::ImplCalcFloatSize( ToolBox* pThis, sal_uInt16& rLines ) { ImplCalcFloatSizes( pThis ); @@ -969,7 +969,7 @@ Size ToolBox::ImplCalcFloatSize( ToolBox* pThis, USHORT& rLines ) rLines = pThis->mnLines; } - USHORT i = 0; + sal_uInt16 i = 0; while ( i < pThis->mpFloatSizeAry->mnLastEntry && rLines < pThis->mpFloatSizeAry->mpSize[i].mnLines ) i++; @@ -988,7 +988,7 @@ void ToolBox::ImplCalcMinMaxFloatSize( ToolBox* pThis, Size& rMinSize, Size& rMa { ImplCalcFloatSizes( pThis ); - USHORT i = 0; + sal_uInt16 i = 0; rMinSize = Size( pThis->mpFloatSizeAry->mpSize[i].mnWidth, pThis->mpFloatSizeAry->mpSize[i].mnHeight ); rMaxSize = Size( pThis->mpFloatSizeAry->mpSize[i].mnWidth, pThis->mpFloatSizeAry->mpSize[i].mnHeight ); while ( ++i <= pThis->mpFloatSizeAry->mnLastEntry ) @@ -1014,7 +1014,7 @@ void ToolBox::ImplSetMinMaxFloatSize( ToolBox *pThis ) { pWrapper->SetMinOutputSizePixel( aMinSize ); pWrapper->SetMaxOutputSizePixel( aMaxSize ); - pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( pThis->GetMenuType() & TOOLBOX_MENUTYPE_CUSTOMIZE) ? TRUE : FALSE ); + pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( pThis->GetMenuType() & TOOLBOX_MENUTYPE_CUSTOMIZE) ? sal_True : sal_False ); } else { @@ -1027,7 +1027,7 @@ void ToolBox::ImplSetMinMaxFloatSize( ToolBox *pThis ) // ----------------------------------------------------------------------- -USHORT ToolBox::ImplCalcLines( ToolBox* pThis, long nToolSize ) +sal_uInt16 ToolBox::ImplCalcLines( ToolBox* pThis, long nToolSize ) { long nLineHeight; @@ -1055,12 +1055,12 @@ USHORT ToolBox::ImplCalcLines( ToolBox* pThis, long nToolSize ) if( nLines < 1 ) nLines = 1; - return static_cast<USHORT>(nLines); + return static_cast<sal_uInt16>(nLines); } // ----------------------------------------------------------------------- -USHORT ToolBox::ImplTestLineSize( ToolBox* pThis, const Point& rPos ) +sal_uInt16 ToolBox::ImplTestLineSize( ToolBox* pThis, const Point& rPos ) { if ( !pThis->ImplIsFloatingMode() && (!pThis->mbScroll || (pThis->mnLines > 1) || (pThis->mnCurLines > pThis->mnVisLines)) ) @@ -1095,9 +1095,9 @@ USHORT ToolBox::ImplTestLineSize( ToolBox* pThis, const Point& rPos ) // ----------------------------------------------------------------------- void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRect, - USHORT nLineMode ) + sal_uInt16 nLineMode ) { - BOOL mbHorz; + sal_Bool mbHorz; long nOneLineSize; long nCurSize; long nMaxSize; @@ -1107,31 +1107,31 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec if ( nLineMode & DOCK_LINERIGHT ) { nCurSize = rPos.X() - rRect.Left(); - mbHorz = FALSE; + mbHorz = sal_False; } else if ( nLineMode & DOCK_LINEBOTTOM ) { nCurSize = rPos.Y() - rRect.Top(); - mbHorz = TRUE; + mbHorz = sal_True; } else if ( nLineMode & DOCK_LINELEFT ) { nCurSize = rRect.Right() - rPos.X(); - mbHorz = FALSE; + mbHorz = sal_False; } else if ( nLineMode & DOCK_LINETOP ) { nCurSize = rRect.Bottom() - rPos.Y(); - mbHorz = TRUE; + mbHorz = sal_True; } else { OSL_FAIL( "ImplLineSizing: Trailing else" ); nCurSize = 0; - mbHorz = FALSE; + mbHorz = sal_False; } Size aWinSize = pThis->GetSizePixel(); - USHORT nMaxLines = (pThis->mnLines > pThis->mnCurLines) ? pThis->mnLines : pThis->mnCurLines; + sal_uInt16 nMaxLines = (pThis->mnLines > pThis->mnCurLines) ? pThis->mnLines : pThis->mnCurLines; if ( nMaxLines > TB_MAXLINES ) nMaxLines = TB_MAXLINES; if ( mbHorz ) @@ -1149,7 +1149,7 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec nMaxSize = aWinSize.Width(); } - USHORT i = 1; + sal_uInt16 i = 1; if ( nCurSize <= nOneLineSize ) nSize = nOneLineSize; else @@ -1190,9 +1190,9 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec // ----------------------------------------------------------------------- -USHORT ToolBox::ImplFindItemPos( ToolBox* pBox, const Point& rPos ) +sal_uInt16 ToolBox::ImplFindItemPos( ToolBox* pBox, const Point& rPos ) { - USHORT nPos = 0; + sal_uInt16 nPos = 0; long nLast = 0; Point aPos = rPos; Size aSize( pBox->mnDX, pBox->mnDY ); @@ -1259,9 +1259,9 @@ ImplTBDragMgr::ImplTBDragMgr() mpBoxList = new ImplTBList(); mnLineMode = 0; mnStartLines = 0; - mbCustomizeMode = FALSE; - mbResizeMode = FALSE; - mbShowDragRect = FALSE; + mbCustomizeMode = sal_False; + mbResizeMode = sal_False; + mbShowDragRect = sal_False; mpDragBox = NULL; maAccel.InsertItem( KEY_RETURN, KeyCode( KEY_RETURN ) ); @@ -1311,12 +1311,12 @@ ToolBox* ImplTBDragMgr::FindToolBox( const Rectangle& rRect ) void ImplTBDragMgr::StartDragging( ToolBox* pToolBox, const Point& rPos, const Rectangle& rRect, - USHORT nDragLineMode, BOOL bResizeItem, + sal_uInt16 nDragLineMode, sal_Bool bResizeItem, void* pData ) { mpDragBox = pToolBox; pToolBox->CaptureMouse(); - pToolBox->mbDragging = TRUE; + pToolBox->mbDragging = sal_True; Application::InsertAccel( &maAccel ); if ( nDragLineMode ) @@ -1348,7 +1348,7 @@ void ImplTBDragMgr::StartDragging( ToolBox* pToolBox, maMouseOff.Y() = rRect.Top() - rPos.Y(); maRect = rRect; maStartRect = rRect; - mbShowDragRect = TRUE; + mbShowDragRect = sal_True; pToolBox->ShowTracking( maRect ); } @@ -1388,12 +1388,12 @@ void ImplTBDragMgr::Dragging( const Point& rPos ) // ----------------------------------------------------------------------- -void ImplTBDragMgr::EndDragging( BOOL bOK ) +void ImplTBDragMgr::EndDragging( sal_Bool bOK ) { mpDragBox->HideTracking(); mpDragBox->ReleaseMouse(); - mpDragBox->mbDragging = FALSE; - mbShowDragRect = FALSE; + mpDragBox->mbDragging = sal_False; + mbShowDragRect = sal_False; Application::RemoveAccel( &maAccel ); if ( mnLineMode ) @@ -1401,16 +1401,16 @@ void ImplTBDragMgr::EndDragging( BOOL bOK ) if ( !bOK ) { mpDragBox->mnDockLines = mnStartLines; - mpDragBox->EndDocking( maStartRect, FALSE ); + mpDragBox->EndDocking( maStartRect, sal_False ); } else - mpDragBox->EndDocking( maRect, FALSE ); + mpDragBox->EndDocking( maRect, sal_False ); mnLineMode = 0; mnStartLines = 0; } else { - USHORT nTempItem = mpDragBox->mnConfigItem; + sal_uInt16 nTempItem = mpDragBox->mnConfigItem; if ( nTempItem ) { mpDragBox->mnConfigItem = 0; @@ -1428,7 +1428,7 @@ void ImplTBDragMgr::EndDragging( BOOL bOK ) pItem->mpWindow->SetSizePixel( aSize ); // ToolBox neu brechnen und neu ausgeben - mpDragBox->ImplInvalidate( TRUE ); + mpDragBox->ImplInvalidate( sal_True ); mpDragBox->Customize( ToolBoxCustomizeEvent( mpDragBox, nTempItem, TOOLBOX_CUSTOMIZE_RESIZE, mpCustomizeData ) ); @@ -1455,7 +1455,7 @@ void ImplTBDragMgr::EndDragging( BOOL bOK ) } aPos = pDropBox->ScreenToOutputPixel( aPos ); - USHORT nPos = ToolBox::ImplFindItemPos( pDropBox, aPos ); + sal_uInt16 nPos = ToolBox::ImplFindItemPos( pDropBox, aPos ); mpDragBox->Customize( ToolBoxCustomizeEvent( pDropBox, nTempItem, nPos, mpCustomizeData ) ); } @@ -1467,7 +1467,7 @@ void ImplTBDragMgr::EndDragging( BOOL bOK ) } } mpCustomizeData = NULL; - mbResizeMode = FALSE; + mbResizeMode = sal_False; mpDragBox->Deactivate(); } @@ -1490,18 +1490,18 @@ void ImplTBDragMgr::UpdateDragRect() IMPL_LINK( ImplTBDragMgr, SelectHdl, Accelerator*, pAccel ) { if ( pAccel->GetCurItemId() == KEY_ESCAPE ) - EndDragging( FALSE ); + EndDragging( sal_False ); else - EndDragging( TRUE ); + EndDragging( sal_True ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- void ImplTBDragMgr::StartCustomizeMode() { - mbCustomizeMode = TRUE; + mbCustomizeMode = sal_True; for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i ) { (*mpBoxList)[ i ]->ImplStartCustomizeMode(); @@ -1512,7 +1512,7 @@ void ImplTBDragMgr::StartCustomizeMode() void ImplTBDragMgr::EndCustomizeMode() { - mbCustomizeMode = FALSE; + mbCustomizeMode = sal_False; for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i ) { (*mpBoxList)[ i ]->ImplEndCustomizeMode(); @@ -1523,7 +1523,7 @@ void ImplTBDragMgr::EndCustomizeMode() static void ImplDrawOutButton( OutputDevice* pOutDev, const Rectangle& rRect, - USHORT nStyle ) + sal_uInt16 nStyle ) { const StyleSettings& rStyleSettings = pOutDev->GetSettings().GetStyleSettings(); Color aShadowColor = rStyleSettings.GetShadowColor(); @@ -1571,7 +1571,7 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle ) { // Variablen initialisieren - ImplGetWindowImpl()->mbToolBox = TRUE; + ImplGetWindowImpl()->mbToolBox = sal_True; mpBtnDev = NULL; mpFloatSizeAry = NULL; mpData = new ImplToolBoxPrivateData; @@ -1602,25 +1602,25 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle ) mnConfigItem = 0; mnMouseClicks = 0; mnMouseModifier = 0; - mbDrag = FALSE; - mbSelection = FALSE; - mbCommandDrag = FALSE; - mbUpper = FALSE; - mbLower = FALSE; - mbNextTool = FALSE; - mbIn = FALSE; - mbCalc = TRUE; - mbFormat = FALSE; - mbFullPaint = FALSE; - mbHorz = TRUE; + mbDrag = sal_False; + mbSelection = sal_False; + mbCommandDrag = sal_False; + mbUpper = sal_False; + mbLower = sal_False; + mbNextTool = sal_False; + mbIn = sal_False; + mbCalc = sal_True; + mbFormat = sal_False; + mbFullPaint = sal_False; + mbHorz = sal_True; mbScroll = (nStyle & WB_SCROLL) != 0; - mbCustomize = FALSE; - mbCustomizeMode = FALSE; - mbDragging = FALSE; - mbMenuStrings = FALSE; - mbIsShift = FALSE; - mbIsKeyEvent = FALSE; - mbChangingHighlight = FALSE; + mbCustomize = sal_False; + mbCustomizeMode = sal_False; + mbDragging = sal_False; + mbMenuStrings = sal_False; + mbIsShift = sal_False; + mbIsKeyEvent = sal_False; + mbChangingHighlight = sal_False; meButtonType = BUTTON_SYMBOL; meAlign = WINDOWALIGN_TOP; meLastStyle = POINTER_ARROW; @@ -1647,13 +1647,13 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle ) ImplGetWindowImpl()->mnStyle &= ~WB_DIALOGCONTROL; } - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); } // ----------------------------------------------------------------------- -void ToolBox::ImplInitSettings( BOOL bFont, - BOOL bForeground, BOOL bBackground ) +void ToolBox::ImplInitSettings( sal_Bool bFont, + sal_Bool bForeground, sal_Bool bBackground ) { mpData->mbNativeButtons = IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ); @@ -1687,7 +1687,7 @@ void ToolBox::ImplInitSettings( BOOL bFont, { aColor = GetControlBackground(); SetBackground( aColor ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); SetParentClipMode( 0 ); } else @@ -1695,7 +1695,7 @@ void ToolBox::ImplInitSettings( BOOL bFont, if( IsNativeControlSupported( CTRL_TOOLBAR, PART_ENTIRE_CONTROL ) ) { SetBackground(); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); mpData->maDisplayBackground = Wallpaper( rStyleSettings.GetFaceColor() ); } @@ -1707,7 +1707,7 @@ void ToolBox::ImplInitSettings( BOOL bFont, aColor = rStyleSettings.GetWindowColor(); SetBackground( aColor ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); SetParentClipMode( 0 ); ImplUpdateImageList(); @@ -1726,7 +1726,7 @@ void ToolBox::ImplLoadRes( const ResId& rResId ) DockingWindow::ImplLoadRes( rResId ); - ULONG nObjMask; + sal_uLong nObjMask; nObjMask = ReadLongRes(); @@ -1737,17 +1737,17 @@ void ToolBox::ImplLoadRes( const ResId& rResId ) SetAlign( (WindowAlign)ReadLongRes() ); if ( nObjMask & RSC_TOOLBOX_LINECOUNT ) - SetLineCount( sal::static_int_cast<USHORT>(ReadLongRes()) ); + SetLineCount( sal::static_int_cast<sal_uInt16>(ReadLongRes()) ); if ( nObjMask & RSC_TOOLBOX_CUSTOMIZE ) { - BOOL bCust = (BOOL)ReadShortRes(); + sal_Bool bCust = (sal_Bool)ReadShortRes(); EnableCustomize( bCust ); } if ( nObjMask & RSC_TOOLBOX_MENUSTRINGS ) { - BOOL bCust = (BOOL)ReadShortRes(); + sal_Bool bCust = (sal_Bool)ReadShortRes(); EnableMenuStrings( bCust ); } @@ -1762,10 +1762,10 @@ void ToolBox::ImplLoadRes( const ResId& rResId ) if ( nObjMask & RSC_TOOLBOX_ITEMLIST ) { - ULONG nEle = ReadLongRes(); + sal_uLong nEle = ReadLongRes(); // Item hinzufuegen - for ( ULONG i = 0; i < nEle; i++ ) + for ( sal_uLong i = 0; i < nEle; i++ ) { InsertItem( ResId( (RSHEADER_TYPE *)GetClassRes(), *pMgr ) ); IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) ); @@ -1796,7 +1796,7 @@ ToolBox::ToolBox( Window* pParent, const ResId& rResId ) : // Groesse des FloatingWindows berechnen und umschalten, wenn die // ToolBox initial im FloatingModus ist if ( ImplIsFloatingMode() ) - mbHorz = TRUE; + mbHorz = sal_True; else Resize(); @@ -1847,7 +1847,7 @@ ToolBox::~ToolBox() // ----------------------------------------------------------------------- -ImplToolItem* ToolBox::ImplGetItem( USHORT nItemId ) const +ImplToolItem* ToolBox::ImplGetItem( sal_uInt16 nItemId ) const { std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); while ( it != mpData->m_aItems.end() ) @@ -1861,7 +1861,7 @@ ImplToolItem* ToolBox::ImplGetItem( USHORT nItemId ) const } // ----------------------------------------------------------------------- -static void ImplAddButtonBorder( long &rWidth, long& rHeight, USHORT aOutStyle, BOOL bNativeButtons ) +static void ImplAddButtonBorder( long &rWidth, long& rHeight, sal_uInt16 aOutStyle, sal_Bool bNativeButtons ) { if ( aOutStyle & TOOLBOX_STYLE_OUTBUTTON ) { @@ -1884,13 +1884,13 @@ static void ImplAddButtonBorder( long &rWidth, long& rHeight, USHORT aOutStyle, // ----------------------------------------------------------------------- -BOOL ToolBox::ImplCalcItem() +sal_Bool ToolBox::ImplCalcItem() { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); // recalc required ? if ( !mbCalc ) - return FALSE; + return sal_False; ImplDisableFlatButtons(); @@ -1982,27 +1982,27 @@ BOOL ToolBox::ImplCalcItem() std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); while ( it != mpData->m_aItems.end() ) { - BOOL bImage; - BOOL bText; + sal_Bool bImage; + sal_Bool bText; - it->mbVisibleText = FALSE; // indicates if text will definitely be drawn, influences dropdown pos + it->mbVisibleText = sal_False; // indicates if text will definitely be drawn, influences dropdown pos if ( it->meType == TOOLBOXITEM_BUTTON ) { // check if image and/or text exists if ( !(it->maImage) ) - bImage = FALSE; + bImage = sal_False; else - bImage = TRUE; + bImage = sal_True; if ( !it->maText.Len() ) - bText = FALSE; + bText = sal_False; else - bText = TRUE; + bText = sal_True; ButtonType tmpButtonType = determineButtonType( &(*it), meButtonType ); // default to toolbox setting if ( bImage || bText ) { - it->mbEmptyBtn = FALSE; + it->mbEmptyBtn = sal_False; if ( tmpButtonType == BUTTON_SYMBOL ) { @@ -2015,7 +2015,7 @@ BOOL ToolBox::ImplCalcItem() { it->maItemSize = Size( GetCtrlTextWidth( it->maText )+TB_TEXTOFFSET, GetTextHeight() ); - it->mbVisibleText = TRUE; + it->mbVisibleText = sal_True; } } else if ( tmpButtonType == BUTTON_TEXT ) @@ -2025,7 +2025,7 @@ BOOL ToolBox::ImplCalcItem() { it->maItemSize = Size( GetCtrlTextWidth( it->maText )+TB_TEXTOFFSET, GetTextHeight() ); - it->mbVisibleText = TRUE; + it->mbVisibleText = sal_True; } else { @@ -2053,7 +2053,7 @@ BOOL ToolBox::ImplCalcItem() else { // no image and no text it->maItemSize = Size( nDefWidth, nDefHeight ); - it->mbEmptyBtn = TRUE; + it->mbEmptyBtn = sal_True; } // Gegebenenfalls die Fensterhoehe mit beruecksichtigen @@ -2133,8 +2133,8 @@ BOOL ToolBox::ImplCalcItem() nMaxWidth = nFixedWidth; } - mbCalc = FALSE; - mbFormat = TRUE; + mbCalc = sal_False; + mbFormat = sal_True; // do we have to recalc the sizes ? if ( (nMaxWidth != mnMaxItemWidth) || (nMaxHeight != mnMaxItemHeight) ) @@ -2142,25 +2142,25 @@ BOOL ToolBox::ImplCalcItem() mnMaxItemWidth = nMaxWidth; mnMaxItemHeight = nMaxHeight; - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -USHORT ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, BOOL bCalcHorz ) +sal_uInt16 ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, sal_Bool bCalcHorz ) { - ULONG nLineStart = 0; - ULONG nGroupStart = 0; + sal_uLong nLineStart = 0; + sal_uLong nGroupStart = 0; long nLineWidth = 0; long nCurWidth; long nLastGroupLineWidth = 0; long nMaxLineWidth = 0; - USHORT nLines = 1; - BOOL bWindow; - BOOL bBreak = FALSE; + sal_uInt16 nLines = 1; + sal_Bool bWindow; + sal_Bool bBreak = sal_False; long nWidthTotal = nWidth; // when docked the menubutton will be in the first line @@ -2172,12 +2172,12 @@ USHORT ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, BOOL bCalcHorz while ( it != mpData->m_aItems.end() ) { it->mbBreak = bBreak; - bBreak = FALSE; + bBreak = sal_False; if ( it->mbVisible ) { - bWindow = FALSE; - bBreak = FALSE; + bWindow = sal_False; + bBreak = sal_False; nCurWidth = 0; if ( it->meType == TOOLBOXITEM_BUTTON || it->meType == TOOLBOXITEM_SPACE ) @@ -2193,7 +2193,7 @@ USHORT ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, BOOL bCalcHorz if ( !mbScroll || (nWinItemWidth <= nWidthTotal) ) { nCurWidth = nWinItemWidth; - bWindow = TRUE; + bWindow = sal_True; } else { @@ -2206,13 +2206,13 @@ USHORT ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, BOOL bCalcHorz // check for line break if ( (nLineWidth+nCurWidth > nWidthTotal) && mbScroll ) - bBreak = TRUE; + bBreak = sal_True; } else if ( it->meType == TOOLBOXITEM_SEPARATOR ) nCurWidth = it->mnSepSize; // treat breaks as separators, except when using old style toolbars (ie. no menu button) else if ( (it->meType == TOOLBOXITEM_BREAK) && !IsMenuEnabled() ) - bBreak = TRUE; + bBreak = sal_True; if ( bBreak ) { @@ -2228,8 +2228,8 @@ USHORT ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, BOOL bCalcHorz nLineWidth = 0; nLineStart = it - mpData->m_aItems.begin(); nGroupStart = nLineStart; - it->mbBreak = TRUE; - bBreak = FALSE; + it->mbBreak = sal_True; + bBreak = sal_False; } else { @@ -2293,7 +2293,7 @@ USHORT ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, BOOL bCalcHorz // ----------------------------------------------------------------------- namespace { - BOOL ImplFollowedByVisibleButton( std::vector< ImplToolItem >::iterator _aSeparator, std::vector< ImplToolItem >::iterator _aEnd ) + sal_Bool ImplFollowedByVisibleButton( std::vector< ImplToolItem >::iterator _aSeparator, std::vector< ImplToolItem >::iterator _aEnd ) { std::vector< ImplToolItem >::iterator aLookup = _aSeparator; while ( ++aLookup != _aEnd ) @@ -2302,9 +2302,9 @@ namespace return ImplFollowedByVisibleButton( aLookup, _aEnd ); if ( ( aLookup->meType == TOOLBOXITEM_BUTTON ) && aLookup->mbVisible ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } } @@ -2324,7 +2324,7 @@ Size ToolBox::ImplGetOptimalFloatingSize( FloatingSizeMode eMode ) if( eMode == FSMODE_AUTO || eMode == FSMODE_FAVOURHEIGHT ) { // calc number of floating lines for current window height - USHORT nFloatLinesHeight = ImplCalcLines( this, mnDY ); + sal_uInt16 nFloatLinesHeight = ImplCalcLines( this, mnDY ); // calc window size according to this number aSize1 = ImplCalcFloatSize( this, nFloatLinesHeight ); @@ -2340,9 +2340,9 @@ Size ToolBox::ImplGetOptimalFloatingSize( FloatingSizeMode eMode ) int nBorderY = 2*TB_BORDER_OFFSET2 + mnTopBorder + mnBottomBorder + 2*mnBorderY; Size aSz( aCurrentSize ); long maxX; - USHORT nLines = ImplCalcBreaks( aSz.Width()-nBorderX, &maxX, mbHorz ); + sal_uInt16 nLines = ImplCalcBreaks( aSz.Width()-nBorderX, &maxX, mbHorz ); - USHORT manyLines = 1000; + sal_uInt16 manyLines = 1000; Size aMinimalFloatSize = ImplCalcFloatSize( this, manyLines ); aSz.Height() = nBorderY + nLineHeight * nLines; @@ -2379,7 +2379,7 @@ Size ToolBox::ImplGetOptimalFloatingSize( FloatingSizeMode eMode ) } -void ToolBox::ImplFormat( BOOL bResize ) +void ToolBox::ImplFormat( sal_Bool bResize ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -2399,15 +2399,15 @@ void ToolBox::ImplFormat( BOOL bResize ) long nMax; // width of layoutarea in pixels long nX; long nY; - USHORT nFormatLine; - BOOL bMustFullPaint; - BOOL bLastSep; + sal_uInt16 nFormatLine; + sal_Bool bMustFullPaint; + sal_Bool bLastSep; std::vector< ImplToolItem >::iterator it; std::vector< ImplToolItem >::iterator temp_it; ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); - BOOL bIsInPopupMode = ImplIsInPopupMode(); + sal_Bool bIsInPopupMode = ImplIsInPopupMode(); // FloatSizeAry gegebenenfalls loeschen if ( mpFloatSizeAry ) @@ -2426,9 +2426,9 @@ void ToolBox::ImplFormat( BOOL bResize ) ImplUpdateDragArea( this ); if ( ImplCalcItem() ) - bMustFullPaint = TRUE; + bMustFullPaint = sal_True; else - bMustFullPaint = FALSE; + bMustFullPaint = sal_False; // calculate new size during interactive resize or @@ -2571,7 +2571,7 @@ void ToolBox::ImplFormat( BOOL bResize ) nX = nLeft; // top-left offset nY = nTop; nFormatLine = 1; - bLastSep = TRUE; + bLastSep = sal_True; // save old scroll rectangles and reset them Rectangle aOldLowerRect = maLowerRect; @@ -2705,7 +2705,7 @@ void ToolBox::ImplFormat( BOOL bResize ) // hide double separators if ( it->meType == TOOLBOXITEM_SEPARATOR ) { - it->mbVisible = FALSE; + it->mbVisible = sal_False; if ( !bLastSep ) { // check if any visible items have to appear behind it @@ -2716,18 +2716,18 @@ void ToolBox::ImplFormat( BOOL bResize ) ((temp_it->meType == TOOLBOXITEM_BUTTON) && temp_it->mbVisible) ) { - it->mbVisible = TRUE; + it->mbVisible = sal_True; break; } ++temp_it; } } - bLastSep = TRUE; + bLastSep = sal_True; } else if ( it->mbVisible ) - bLastSep = FALSE; + bLastSep = sal_False; - it->mbShowWindow = FALSE; + it->mbShowWindow = sal_False; // check for line break and advance nX/nY accordingly if ( it->mbBreak ) @@ -2908,7 +2908,7 @@ void ToolBox::ImplFormat( BOOL bResize ) } // indicate formatting is done - mbFormat = FALSE; + mbFormat = sal_False; } // ----------------------------------------------------------------------- @@ -2919,7 +2919,7 @@ IMPL_LINK( ToolBox, ImplDropdownLongClickHdl, ToolBox*, EMPTYARG ) (mpData->m_aItems[ mnCurPos ].mnBits & TIB_DROPDOWN) ) { - mpData->mbDropDownByKeyboard = FALSE; + mpData->mbDropDownByKeyboard = sal_False; GetDropdownClickHdl().Call( this ); // do not reset data if the dropdown handler opened a floating window @@ -2928,7 +2928,7 @@ IMPL_LINK( ToolBox, ImplDropdownLongClickHdl, ToolBox*, EMPTYARG ) { // no floater was opened Deactivate(); - ImplDrawItem( mnCurPos, FALSE ); + ImplDrawItem( mnCurPos, sal_False ); mnCurPos = TOOLBOX_ITEM_NOTFOUND; mnCurItemId = 0; @@ -2956,7 +2956,7 @@ IMPL_LINK( ToolBox, ImplUpdateHdl, void*, EMPTYARG ) // ----------------------------------------------------------------------- -static void ImplDrawMoreIndicator( ToolBox *pBox, const Rectangle& rRect, BOOL bSetColor, BOOL bRotate ) +static void ImplDrawMoreIndicator( ToolBox *pBox, const Rectangle& rRect, sal_Bool bSetColor, sal_Bool bRotate ) { Color aOldFillColor = pBox->GetFillColor(); Color aOldLineColor = pBox->GetLineColor(); @@ -3011,10 +3011,10 @@ static void ImplDrawMoreIndicator( ToolBox *pBox, const Rectangle& rRect, BOOL b pBox->SetLineColor( aOldLineColor ); } -static void ImplDrawDropdownArrow( ToolBox *pBox, const Rectangle& rDropDownRect, BOOL bSetColor, BOOL bRotate ) +static void ImplDrawDropdownArrow( ToolBox *pBox, const Rectangle& rDropDownRect, sal_Bool bSetColor, sal_Bool bRotate ) { - BOOL bLineColor = pBox->IsLineColor(); - BOOL bFillColor = pBox->IsFillColor(); + sal_Bool bLineColor = pBox->IsLineColor(); + sal_Bool bFillColor = pBox->IsFillColor(); Color aOldFillColor = pBox->GetFillColor(); Color aOldLineColor = pBox->GetLineColor(); pBox->SetLineColor(); @@ -3064,8 +3064,8 @@ static void ImplDrawDropdownArrow( ToolBox *pBox, const Rectangle& rDropDownRect pBox->SetLineColor( ); } -void ToolBox::ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, BOOL bBlack, BOOL bColTransform, - BOOL bLeft, BOOL bTop, long nSize ) +void ToolBox::ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, sal_Bool bBlack, sal_Bool bColTransform, + sal_Bool bLeft, sal_Bool bTop, long nSize ) { Color aOldFillColor = pBox->GetFillColor(); WindowAlign eAlign = pBox->meAlign; @@ -3160,7 +3160,7 @@ void ToolBox::ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, BOOL bBlack, B } void ToolBox::SetToolArrowClipregion( ToolBox* pBox, long nX, long nY, - BOOL bLeft, BOOL bTop, long nSize ) + sal_Bool bLeft, sal_Bool bTop, long nSize ) { WindowAlign eAlign = pBox->meAlign; long nHalfSize; @@ -3215,7 +3215,7 @@ void ToolBox::SetToolArrowClipregion( ToolBox* pBox, long nX, long nY, // ----------------------------------------------------------------------- -void ToolBox::ImplDrawMenubutton( ToolBox *pThis, BOOL bHighlight ) +void ToolBox::ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight ) { if( !pThis->mpData->maMenubuttonItem.maRect.IsEmpty() ) { @@ -3226,11 +3226,11 @@ void ToolBox::ImplDrawMenubutton( ToolBox *pThis, BOOL bHighlight ) // execute pending paint requests ImplCheckUpdate( pThis ); - BOOL bFillColor = pThis->IsFillColor(); - BOOL bLineColor = pThis->IsLineColor(); + sal_Bool bFillColor = pThis->IsFillColor(); + sal_Bool bLineColor = pThis->IsLineColor(); Color aOldFillCol = pThis->GetFillColor(); Color aOldLineCol = pThis->GetLineColor(); - BOOL bNativeButtons = pThis->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ); + sal_Bool bNativeButtons = pThis->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ); Rectangle aInnerRect( pThis->mpData->maMenubuttonItem.maRect ); if( pThis->mpData->mnMenuButtonWidth > TB_MENUBUTTON_SIZE ) @@ -3270,9 +3270,9 @@ void ToolBox::ImplDrawMenubutton( ToolBox *pThis, BOOL bHighlight ) if( bHighlight ) { if( bNativeButtons ) - ImplDrawButton( pThis, pThis->mpData->maMenubuttonItem.maRect, 2, FALSE, TRUE, FALSE ); + ImplDrawButton( pThis, pThis->mpData->maMenubuttonItem.maRect, 2, sal_False, sal_True, sal_False ); else - pThis->DrawSelectionBackground( aInnerRect, 2, FALSE, FALSE, FALSE ); + pThis->DrawSelectionBackground( aInnerRect, 2, sal_False, sal_False, sal_False ); } else { @@ -3294,7 +3294,7 @@ void ToolBox::ImplDrawMenubutton( ToolBox *pThis, BOOL bHighlight ) aRect.Left() = aRect.Right() - aRect.getWidth()/3; if( pThis->mpData->maMenuType & TOOLBOX_MENUTYPE_CUSTOMIZE ) - ImplDrawDropdownArrow( pThis, aRect, TRUE, !pThis->mbHorz ); + ImplDrawDropdownArrow( pThis, aRect, sal_True, !pThis->mbHorz ); if( pThis->ImplHasClippedItems() ) { @@ -3304,7 +3304,7 @@ void ToolBox::ImplDrawMenubutton( ToolBox *pThis, BOOL bHighlight ) else aRect.Right() = aRect.Left() + aRect.getWidth()/3; - ImplDrawMoreIndicator( pThis, aRect, TRUE, !pThis->mbHorz ); + ImplDrawMoreIndicator( pThis, aRect, sal_True, !pThis->mbHorz ); } // store highlight state @@ -3324,30 +3324,30 @@ void ToolBox::ImplDrawMenubutton( ToolBox *pThis, BOOL bHighlight ) // ----------------------------------------------------------------------- -void ToolBox::ImplDrawSpin( BOOL bUpperIn, BOOL bLowerIn ) +void ToolBox::ImplDrawSpin( sal_Bool bUpperIn, sal_Bool bLowerIn ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - BOOL bTmpUpper; - BOOL bTmpLower; + sal_Bool bTmpUpper; + sal_Bool bTmpLower; if ( maUpperRect.IsEmpty() || maLowerRect.IsEmpty() ) return; if ( mnCurLine > 1 ) - bTmpUpper = TRUE; + bTmpUpper = sal_True; else - bTmpUpper = FALSE; + bTmpUpper = sal_False; if ( mnCurLine+mnVisLines-1 < mnCurLines ) - bTmpLower = TRUE; + bTmpLower = sal_True; else - bTmpLower = FALSE; + bTmpLower = sal_False; if ( !IsEnabled() ) { - bTmpUpper = FALSE; - bTmpLower = FALSE; + bTmpUpper = sal_False; + bTmpLower = sal_False; } ImplDrawSpinButton( this, maUpperRect, maLowerRect, @@ -3356,7 +3356,7 @@ void ToolBox::ImplDrawSpin( BOOL bUpperIn, BOOL bLowerIn ) // ----------------------------------------------------------------------- -void ToolBox::ImplDrawNext( BOOL bIn ) +void ToolBox::ImplDrawNext( sal_Bool bIn ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -3368,7 +3368,7 @@ void ToolBox::ImplDrawNext( BOOL bIn ) // Button malen long nX = SMALLBUTTON_OFF_NORMAL_X; long nY = SMALLBUTTON_OFF_NORMAL_Y; - USHORT nStyle = 0; + sal_uInt16 nStyle = 0; if ( bIn == 1 ) { nStyle |= BUTTON_DRAW_PRESSED; @@ -3378,17 +3378,17 @@ void ToolBox::ImplDrawNext( BOOL bIn ) aDecoView.DrawButton( maNextToolRect, nStyle ); // Inhalt ausgeben - BOOL bLeft = FALSE; - BOOL bTop = FALSE; + sal_Bool bLeft = sal_False; + sal_Bool bTop = sal_False; if ( mbHorz ) { - bLeft = TRUE; + bLeft = sal_True; nX += (maNextToolRect.GetWidth()-6)/2-4; nY += (maNextToolRect.GetHeight()-6)/2-6; } else { - bTop = TRUE; + bTop = sal_True; nY += (maNextToolRect.GetHeight()-6)/2-4; nX += (maNextToolRect.GetWidth()-6)/2-6; } @@ -3397,14 +3397,14 @@ void ToolBox::ImplDrawNext( BOOL bIn ) nY += maNextToolRect.Top(); SetLineColor(); SetFillColor( COL_LIGHTBLUE ); - ImplDrawToolArrow( this, nX, nY, TRUE, FALSE, bLeft, bTop, 10 ); + ImplDrawToolArrow( this, nX, nY, sal_True, sal_False, bLeft, bTop, 10 ); } // ----------------------------------------------------------------------- -void ToolBox::ImplDrawSeparator( USHORT nPos, Rectangle rRect ) +void ToolBox::ImplDrawSeparator( sal_uInt16 nPos, Rectangle rRect ) { - BOOL bNativeOk = FALSE; + bool bNativeOk = false; ImplToolItem* pItem = &mpData->m_aItems[nPos]; if( IsNativeControlSupported( CTRL_TOOLBAR, PART_SEPARATOR ) ) @@ -3450,12 +3450,12 @@ void ToolBox::ImplDrawSeparator( USHORT nPos, Rectangle rRect ) // ----------------------------------------------------------------------- -static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, USHORT highlight, BOOL bChecked, BOOL bEnabled, BOOL bIsWindow ) +static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bEnabled, sal_Bool bIsWindow ) { // draws toolbar button background either native or using a coloured selection - // if bIsWindow is TRUE, the corresponding item is a control and only a selection border will be drawn + // if bIsWindow is sal_True, the corresponding item is a control and only a selection border will be drawn - BOOL bNativeOk = FALSE; + sal_Bool bNativeOk = sal_False; if( !bIsWindow && pThis->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) { ImplControlValue aControlValue; @@ -3473,10 +3473,10 @@ static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, USHORT highl } if( !bNativeOk ) - pThis->DrawSelectionBackground( rRect, bIsWindow ? 3 : highlight, bChecked, TRUE, bIsWindow, 2, NULL, NULL ); + pThis->DrawSelectionBackground( rRect, bIsWindow ? 3 : highlight, bChecked, sal_True, bIsWindow, 2, NULL, NULL ); } -void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLayout ) +void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPaint, sal_Bool bLayout ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -3494,6 +3494,8 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay MetricVector* pVector = bLayout ? &mpData->m_pLayoutData->m_aUnicodeBoundRects : NULL; String* pDisplayText = bLayout ? &mpData->m_pLayoutData->m_aDisplayText : NULL; + bHighlight = bHighlight && pItem->mbEnabled; + // Falls Rechteck ausserhalb des sichbaren Bereichs liegt if ( pItem->maRect.IsEmpty() ) return; @@ -3501,13 +3503,13 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); // no gradient background for items that have a popup open - BOOL bHasOpenPopup = (mpFloatWin != NULL) && (mnDownItemId==pItem->mnId); + sal_Bool bHasOpenPopup = (mpFloatWin != NULL) && (mnDownItemId==pItem->mnId); - BOOL bHighContrastWhite = FALSE; + sal_Bool bHighContrastWhite = sal_False; // check the face color as highcontrast indicator // because the toolbox itself might have a gradient if( rStyleSettings.GetFaceColor() == Color( COL_WHITE ) ) - bHighContrastWhite = TRUE; + bHighContrastWhite = sal_True; // Compute buttons area. Size aBtnSize = pItem->maRect.GetSize(); @@ -3534,7 +3536,7 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay long nImageOffY = 0; long nTextOffX = 0; long nTextOffY = 0; - USHORT nStyle = 0; + sal_uInt16 nStyle = 0; // draw separators in flat style only if ( !bLayout && @@ -3577,18 +3579,18 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay Size aSize( GetCtrlTextWidth( pItem->maText ), GetTextHeight() ); Point aPos( pItem->maRect.Left()+2, pItem->maRect.Top() ); aPos.Y() += (pItem->maRect.GetHeight()-aSize.Height())/2; - BOOL bClip; + sal_Bool bClip; if ( (aSize.Width() > pItem->maRect.GetWidth()-2) || (aSize.Height() > pItem->maRect.GetHeight()-2) ) { - bClip = TRUE; + bClip = sal_True; Rectangle aTempRect( pItem->maRect.Left()+1, pItem->maRect.Top()+1, pItem->maRect.Right()-1, pItem->maRect.Bottom()-1 ); Region aTempRegion( aTempRect ); SetClipRegion( aTempRegion ); } else - bClip = FALSE; + bClip = sal_False; if( bLayout ) { mpData->m_pLayoutData->m_aLineIndices.push_back( mpData->m_pLayoutData->m_aDisplayText.Len() ); @@ -3656,8 +3658,8 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay nOffY += pItem->maRect.Top(); // determine what has to be drawn on the button: image, text or both - BOOL bImage; - BOOL bText; + sal_Bool bImage; + sal_Bool bText; ButtonType tmpButtonType = determineButtonType( pItem, meButtonType ); // default to toolbox setting pItem->DetermineButtonDrawStyle( tmpButtonType, bImage, bText ); @@ -3676,7 +3678,7 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay if ( bImage && ! bLayout ) { const Image* pImage; - if ( bHighlight && (!(pItem->maHighImage)) == FALSE ) + if ( bHighlight && (!(pItem->maHighImage)) == sal_False ) pImage = &(pItem->maHighImage); else pImage = &(pItem->maImage); @@ -3684,7 +3686,7 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay aImageSize = pImage->GetSizePixel(); // determine drawing flags - USHORT nImageStyle = 0; + sal_uInt16 nImageStyle = 0; if ( !pItem->mbEnabled || !IsEnabled() ) nImageStyle |= IMAGE_DRAW_DISABLE; @@ -3715,7 +3717,7 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay if( bHasOpenPopup ) ImplDrawFloatwinBorder( pItem ); else - ImplDrawButton( this, aButtonRect, bHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? TRUE : FALSE ); + ImplDrawButton( this, aButtonRect, bHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? sal_True : sal_False ); if( bHighlight ) { @@ -3727,7 +3729,7 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay } // draw the text - BOOL bRotate = FALSE; + sal_Bool bRotate = sal_False; if ( bText ) { nTextOffX = nOffX; @@ -3738,7 +3740,7 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay if( pItem->mbVisibleText && !ImplIsFloatingMode() && ((meAlign == WINDOWALIGN_LEFT) || (meAlign == WINDOWALIGN_RIGHT)) ) { - bRotate = TRUE; + bRotate = sal_True; Font aRotateFont = aOldFont; /* @@ -3781,10 +3783,10 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay if( bHasOpenPopup ) ImplDrawFloatwinBorder( pItem ); else - ImplDrawButton( this, pItem->maRect, bHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? TRUE : FALSE ); + ImplDrawButton( this, pItem->maRect, bHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? sal_True : sal_False ); } - USHORT nTextStyle = 0; + sal_uInt16 nTextStyle = 0; if ( !pItem->mbEnabled ) nTextStyle |= TEXT_DRAW_DISABLE; if( bLayout ) @@ -3806,10 +3808,10 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay if ( pItem->mnBits & TIB_DROPDOWN ) { Rectangle aDropDownRect( pItem->GetDropDownRect( mbHorz ) ); - BOOL bSetColor = TRUE; + sal_Bool bSetColor = sal_True; if ( !pItem->mbEnabled || !IsEnabled() ) { - bSetColor = FALSE; + bSetColor = sal_False; SetFillColor( rStyleSettings.GetShadowColor() ); } @@ -3823,7 +3825,7 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay if( bHasOpenPopup ) ImplDrawFloatwinBorder( pItem ); else - ImplDrawButton( this, aDropDownRect, bHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), FALSE ); + ImplDrawButton( this, aDropDownRect, bHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), sal_False ); } } ImplDrawDropdownArrow( this, aDropDownRect, bSetColor, bRotate ); @@ -3838,7 +3840,7 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay void ToolBox::ImplStartCustomizeMode() { - mbCustomizeMode = TRUE; + mbCustomizeMode = sal_True; mpData->ImplClearLayoutData(); @@ -3857,7 +3859,7 @@ void ToolBox::ImplStartCustomizeMode() } } -void ToolBox::SetCustomizeMode( BOOL bSet ) +void ToolBox::SetCustomizeMode( sal_Bool bSet ) { if ( bSet ) ImplStartCustomizeMode(); @@ -3869,7 +3871,7 @@ void ToolBox::SetCustomizeMode( BOOL bSet ) void ToolBox::ImplEndCustomizeMode() { - mbCustomizeMode = FALSE; + mbCustomizeMode = sal_False; mpData->ImplClearLayoutData(); @@ -3925,7 +3927,7 @@ void ToolBox::ImplDrawFloatwinBorder( ImplToolItem* pItem ) } } -void ToolBox::ImplFloatControl( BOOL bStart, FloatingWindow* pFloatWindow ) +void ToolBox::ImplFloatControl( sal_Bool bStart, FloatingWindow* pFloatWindow ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -3934,9 +3936,9 @@ void ToolBox::ImplFloatControl( BOOL bStart, FloatingWindow* pFloatWindow ) mpFloatWin = pFloatWindow; // redraw item, to trigger drawing of a special border - ImplDrawItem( mnCurPos, TRUE ); + ImplDrawItem( mnCurPos, sal_True ); - mbDrag = FALSE; + mbDrag = sal_False; EndTracking(); ReleaseMouse(); } @@ -3946,7 +3948,7 @@ void ToolBox::ImplFloatControl( BOOL bStart, FloatingWindow* pFloatWindow ) // if focus is still in this toolbox, then the floater was opened by keyboard // draw current item with highlight and keep old state - BOOL bWasKeyboardActivate = mpData->mbDropDownByKeyboard; + sal_Bool bWasKeyboardActivate = mpData->mbDropDownByKeyboard; if ( mnCurPos != TOOLBOX_ITEM_NOTFOUND ) @@ -3966,15 +3968,15 @@ void ToolBox::ImplFloatControl( BOOL bStart, FloatingWindow* pFloatWindow ) // ----------------------------------------------------------------------- -void ToolBox::ShowLine( BOOL bNext ) +void ToolBox::ShowLine( sal_Bool bNext ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - mbFormat = TRUE; + mbFormat = sal_True; if ( mpData->mbPageScroll ) { - USHORT delta = mnVisLines; + sal_uInt16 delta = mnVisLines; if ( bNext ) { mnCurLine = mnCurLine + delta; @@ -4002,7 +4004,7 @@ void ToolBox::ShowLine( BOOL bNext ) // ----------------------------------------------------------------------- -BOOL ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, BOOL bRepeat ) +sal_Bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, sal_Bool bRepeat ) { Point aMousePos = rMEvt.GetPosPixel(); @@ -4015,7 +4017,7 @@ BOOL ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, BOOL bRepeat ) { if ( !mnCurItemId ) { - ImplDrawItem( mnCurPos, TRUE ); + ImplDrawItem( mnCurPos, sal_True ); mnCurItemId = pItem->mnId; Highlight(); } @@ -4034,48 +4036,48 @@ BOOL ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, BOOL bRepeat ) } } - return TRUE; + return sal_True; } if ( mbUpper ) { - BOOL bNewIn = maUpperRect.IsInside( aMousePos ); + sal_Bool bNewIn = maUpperRect.IsInside( aMousePos ); if ( bNewIn != mbIn ) { mbIn = bNewIn; - ImplDrawSpin( mbIn, FALSE ); + ImplDrawSpin( mbIn, sal_False ); } - return TRUE; + return sal_True; } if ( mbLower ) { - BOOL bNewIn = maLowerRect.IsInside( aMousePos ); + sal_Bool bNewIn = maLowerRect.IsInside( aMousePos ); if ( bNewIn != mbIn ) { mbIn = bNewIn; - ImplDrawSpin( FALSE, mbIn ); + ImplDrawSpin( sal_False, mbIn ); } - return TRUE; + return sal_True; } if ( mbNextTool ) { - BOOL bNewIn = maNextToolRect.IsInside( aMousePos ); + sal_Bool bNewIn = maNextToolRect.IsInside( aMousePos ); if ( bNewIn != mbIn ) { mbIn = bNewIn; ImplDrawNext( mbIn ); } - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, BOOL bCancel ) +sal_Bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, sal_Bool bCancel ) { ImplDisableFlatButtons(); @@ -4099,12 +4101,12 @@ BOOL ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, BOOL bCancel ) Deactivate(); if ( mbDrag ) - mbDrag = FALSE; + mbDrag = sal_False; else { - mbSelection = FALSE; + mbSelection = sal_False; if ( mnCurPos == TOOLBOX_ITEM_NOTFOUND ) - return TRUE; + return sal_True; } // Wurde Maus ueber dem Item losgelassen @@ -4142,7 +4144,7 @@ BOOL ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, BOOL bCancel ) ImplAddDel( &aDelData ); Select(); if ( aDelData.IsDelete() ) - return TRUE; + return sal_True; ImplRemoveDel( &aDelData ); } } @@ -4154,11 +4156,11 @@ BOOL ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, BOOL bCancel ) // Items nicht geloescht, im Select-Handler if ( mnCurItemId ) { - BOOL bHighlight; + sal_Bool bHighlight; if ( (mnCurItemId == mnHighItemId) && (mnOutStyle & TOOLBOX_STYLE_FLAT) ) bHighlight = 2; else - bHighlight = FALSE; + bHighlight = sal_False; // Get current pos for the case that items are inserted/removed // in the toolBox mnCurPos = GetItemPos( mnCurItemId ); @@ -4176,28 +4178,28 @@ BOOL ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, BOOL bCancel ) mnDownItemId = 0; mnMouseClicks = 0; mnMouseModifier = 0; - return TRUE; + return sal_True; } else if ( mbUpper || mbLower ) { if ( mbIn ) ShowLine( !mbUpper ); - mbUpper = FALSE; - mbLower = FALSE; - mbIn = FALSE; - ImplDrawSpin( FALSE, FALSE ); - return TRUE; + mbUpper = sal_False; + mbLower = sal_False; + mbIn = sal_False; + ImplDrawSpin( sal_False, sal_False ); + return sal_True; } else if ( mbNextTool ) { - mbNextTool = FALSE; - mbIn = FALSE; - ImplDrawNext( FALSE ); + mbNextTool = sal_False; + mbIn = sal_False; + ImplDrawNext( sal_False ); NextToolBox(); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -4219,10 +4221,10 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) // only highlight when the focus is not inside a child window of a toolbox // eg, in a edit control // and do not hilight when focus is in a different toolbox - BOOL bDrawHotSpot = TRUE; + sal_Bool bDrawHotSpot = sal_True; Window *pWin = Application::GetFocusWindow(); if( pWin && pWin->ImplGetWindowImpl()->mbToolBox && pWin != this ) - bDrawHotSpot = FALSE; + bDrawHotSpot = sal_False; /* else if( pWin && !pWin->ImplGetWindowImpl()->mbToolBox ) @@ -4231,7 +4233,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) pWin = pWin->GetParent(); if( pWin && pWin->ImplGetWindowImpl()->mbToolBox ) { - bDrawHotSpot = FALSE; + bDrawHotSpot = sal_False; break; } } @@ -4239,8 +4241,8 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) if ( mbSelection && bDrawHotSpot ) { - USHORT i = 0; - USHORT nNewPos = TOOLBOX_ITEM_NOTFOUND; + sal_uInt16 i = 0; + sal_uInt16 nNewPos = TOOLBOX_ITEM_NOTFOUND; // Item suchen, das geklickt wurde std::vector< ImplToolItem >::const_iterator it = mpData->m_aItems.begin(); @@ -4283,7 +4285,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) if ( mnCurPos != TOOLBOX_ITEM_NOTFOUND ) { mnCurItemId = mnHighItemId = it->mnId; - ImplDrawItem( mnCurPos, 2 /*TRUE*/ ); // always use shadow effect (2) + ImplDrawItem( mnCurPos, 2 /*sal_True*/ ); // always use shadow effect (2) } else mnCurItemId = mnHighItemId = 0; @@ -4311,7 +4313,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) { if ( rMEvt.GetMode() & MOUSE_SIMPLEMOVE ) { - USHORT nLinePtr = ImplTestLineSize( this, rMEvt.GetPosPixel() ); + sal_uInt16 nLinePtr = ImplTestLineSize( this, rMEvt.GetPosPixel() ); if ( nLinePtr & DOCK_LINEHSIZE ) { if ( meAlign == WINDOWALIGN_LEFT ) @@ -4354,7 +4356,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) if ( bDrawHotSpot && ( ((eStyle == POINTER_ARROW) && (mnOutStyle & TOOLBOX_STYLE_HANDPOINTER)) || (mnOutStyle & TOOLBOX_STYLE_FLAT) || !mnOutStyle ) ) { - BOOL bClearHigh = TRUE; + sal_Bool bClearHigh = sal_True; if ( !rMEvt.IsLeaveWindow() && (mnCurPos == TOOLBOX_ITEM_NOTFOUND) ) { std::vector< ImplToolItem >::const_iterator it = mpData->m_aItems.begin(); @@ -4366,21 +4368,21 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) { if ( !mnOutStyle || (mnOutStyle & TOOLBOX_STYLE_FLAT) ) { - bClearHigh = FALSE; + bClearHigh = sal_False; if ( mnHighItemId != it->mnId ) { - USHORT nTempPos = sal::static_int_cast<USHORT>(it - mpData->m_aItems.begin()); + sal_uInt16 nTempPos = sal::static_int_cast<sal_uInt16>(it - mpData->m_aItems.begin()); if ( mnHighItemId ) { ImplHideFocus(); - USHORT nPos = GetItemPos( mnHighItemId ); + sal_uInt16 nPos = GetItemPos( mnHighItemId ); ImplDrawItem( nPos ); ImplCallEventListeners( VCLEVENT_TOOLBOX_HIGHLIGHTOFF, reinterpret_cast< void* >( nPos ) ); } if ( mpData->mbMenubuttonSelected ) { // remove highlight from menubutton - ImplDrawMenubutton( this, FALSE ); + ImplDrawMenubutton( this, sal_False ); } mnHighItemId = it->mnId; ImplDrawItem( nTempPos, 2 ); @@ -4399,21 +4401,21 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) } // only clear highlight when focus is not in toolbar - BOOL bMenuButtonHit = mpData->maMenubuttonItem.maRect.IsInside( aMousePos ); + sal_Bool bMenuButtonHit = mpData->maMenubuttonItem.maRect.IsInside( aMousePos ); if ( bClearHigh || bMenuButtonHit ) { if ( !bMenuButtonHit && mpData->mbMenubuttonSelected ) { // remove highlight from menubutton - ImplDrawMenubutton( this, FALSE ); + ImplDrawMenubutton( this, sal_False ); } if( mnHighItemId ) { - USHORT nClearPos = GetItemPos( mnHighItemId ); + sal_uInt16 nClearPos = GetItemPos( mnHighItemId ); if ( nClearPos != TOOLBOX_ITEM_NOTFOUND ) { - ImplDrawItem( nClearPos, (nClearPos == mnCurPos) ? TRUE : FALSE ); + ImplDrawItem( nClearPos, (nClearPos == mnCurPos) ? sal_True : sal_False ); if( nClearPos != mnCurPos ) ImplCallEventListeners( VCLEVENT_TOOLBOX_HIGHLIGHTOFF, reinterpret_cast< void* >( nClearPos ) ); } @@ -4423,7 +4425,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) if( bMenuButtonHit ) { - ImplDrawMenubutton( this, TRUE ); + ImplDrawMenubutton( this, sal_True ); } } } @@ -4458,8 +4460,8 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) } Point aMousePos = rMEvt.GetPosPixel(); - USHORT i = 0; - USHORT nNewPos = TOOLBOX_ITEM_NOTFOUND; + sal_uInt16 i = 0; + sal_uInt16 nNewPos = TOOLBOX_ITEM_NOTFOUND; // Item suchen, das geklickt wurde std::vector< ImplToolItem >::const_iterator it = mpData->m_aItems.begin(); @@ -4494,12 +4496,12 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) Rectangle aItemRect = GetItemRect( it->mnId ); mnConfigItem = it->mnId; - BOOL bResizeItem; + sal_Bool bResizeItem; if ( mbCustomizeMode && it->mbShowWindow && (it->maRect.Right()-TB_RESIZE_OFFSET <= aMousePos.X()) ) - bResizeItem = TRUE; + bResizeItem = sal_True; else - bResizeItem = FALSE; + bResizeItem = sal_False; pMgr->StartDragging( this, aMousePos, aItemRect, 0, bResizeItem ); return; } @@ -4513,7 +4515,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) // Aktuelle Daten setzen - USHORT nTrackFlags = 0; + sal_uInt16 nTrackFlags = 0; mnCurPos = i; mnCurItemId = it->mnId; mnDownItemId = mnCurItemId; @@ -4525,13 +4527,13 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) if ( mbSelection ) { - ImplDrawItem( mnCurPos, TRUE ); + ImplDrawItem( mnCurPos, sal_True ); Highlight(); } else { // Hier schon bDrag setzen, da in EndSelection ausgewertet wird - mbDrag = TRUE; + mbDrag = sal_True; // Bei Doppelklick nur den Handler rufen, aber bevor der // Button gehiltet wird, da evt. in diesem Handler der @@ -4542,7 +4544,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) if ( mbDrag ) { - ImplDrawItem( mnCurPos, TRUE ); + ImplDrawItem( mnCurPos, sal_True ); Highlight(); } @@ -4554,7 +4556,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) // dropdownonly always triggers the dropdown handler, over the whole button area // the drop down arrow should not trigger the item action - mpData->mbDropDownByKeyboard = FALSE; + mpData->mbDropDownByKeyboard = sal_False; GetDropdownClickHdl().Call( this ); // do not reset data if the dropdown handler opened a floating window @@ -4563,7 +4565,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) { // no floater was opened Deactivate(); - ImplDrawItem( mnCurPos, FALSE ); + ImplDrawItem( mnCurPos, sal_False ); mnCurPos = TOOLBOX_ITEM_NOTFOUND; mnCurItemId = 0; @@ -4613,9 +4615,9 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) if ( mnCurLine > 1 ) { StartTracking(); - mbUpper = TRUE; - mbIn = TRUE; - ImplDrawSpin( TRUE, FALSE ); + mbUpper = sal_True; + mbIn = sal_True; + ImplDrawSpin( sal_True, sal_False ); } return; } @@ -4624,25 +4626,25 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) if ( mnCurLine+mnVisLines-1 < mnCurLines ) { StartTracking(); - mbLower = TRUE; - mbIn = TRUE; - ImplDrawSpin( FALSE, TRUE ); + mbLower = sal_True; + mbIn = sal_True; + ImplDrawSpin( sal_False, sal_True ); } return; } if ( maNextToolRect.IsInside( aMousePos ) ) { StartTracking(); - mbNextTool = TRUE; - mbIn = TRUE; - ImplDrawNext( TRUE ); + mbNextTool = sal_True; + mbIn = sal_True; + ImplDrawNext( sal_True ); return; } // Linesizing testen if ( (mnWinStyle & TB_WBLINESIZING) == TB_WBLINESIZING ) { - USHORT nLineMode = ImplTestLineSize( this, aMousePos ); + sal_uInt16 nLineMode = ImplTestLineSize( this, aMousePos ); if ( nLineMode ) { ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); @@ -4657,7 +4659,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) // Dragging starten pMgr->StartDragging( this, aMousePos, Rectangle( aPos, aSize ), - nLineMode, FALSE ); + nLineMode, sal_False ); return; } } @@ -4686,7 +4688,7 @@ void ToolBox::MouseButtonUp( const MouseEvent& rMEvt ) pMgr->EndDragging(); return; } - mbCommandDrag = FALSE; + mbCommandDrag = sal_False; DockingWindow::MouseButtonUp( rMEvt ); } @@ -4717,9 +4719,9 @@ void ToolBox::Paint( const Rectangle& rPaintRect ) if( mpData->mbIsPaintLocked ) return; if ( rPaintRect == Rectangle( 0, 0, mnDX-1, mnDY-1 ) ) - mbFullPaint = TRUE; + mbFullPaint = sal_True; ImplFormat(); - mbFullPaint = FALSE; + mbFullPaint = sal_False; ImplDrawBackground( this, rPaintRect ); @@ -4736,28 +4738,28 @@ void ToolBox::Paint( const Rectangle& rPaintRect ) if ( mnWinStyle & WB_SCROLL ) { if ( mnCurLines > mnLines ) - ImplDrawSpin( FALSE, FALSE ); + ImplDrawSpin( sal_False, sal_False ); } // NextButton zeichnen - ImplDrawNext( FALSE ); + ImplDrawNext( sal_False ); // Buttons zeichnen - USHORT nHighPos; + sal_uInt16 nHighPos; if ( mnHighItemId ) nHighPos = GetItemPos( mnHighItemId ); else nHighPos = TOOLBOX_ITEM_NOTFOUND; - USHORT nCount = (USHORT)mpData->m_aItems.size(); - for( USHORT i = 0; i < nCount; i++ ) + sal_uInt16 nCount = (sal_uInt16)mpData->m_aItems.size(); + for( sal_uInt16 i = 0; i < nCount; i++ ) { ImplToolItem* pItem = &mpData->m_aItems[i]; // Nur malen, wenn Rechteck im PaintRectangle liegt if ( !pItem->maRect.IsEmpty() && rPaintRect.IsOver( pItem->maRect ) ) { - BOOL bHighlight = FALSE; + sal_Bool bHighlight = sal_False; if ( i == mnCurPos ) bHighlight = 1; else if ( i == nHighPos ) @@ -4800,9 +4802,9 @@ void ToolBox::Resize() { if ( !mbFormat ) { - mbFormat = TRUE; + mbFormat = sal_True; if( IsReallyVisible() ) - ImplFormat( TRUE ); + ImplFormat( sal_True ); } } @@ -4834,21 +4836,21 @@ void ToolBox::Resize() } // ----------------------------------------------------------------------- -const XubString& ToolBox::ImplGetHelpText( USHORT nItemId ) const +const XubString& ToolBox::ImplGetHelpText( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) { - if ( !pItem->maHelpText.Len() && ( pItem->mnHelpId || pItem->maCommandStr.Len() )) + if ( !pItem->maHelpText.Len() && ( pItem->maHelpId.getLength() || pItem->maCommandStr.Len() )) { Help* pHelp = Application::GetHelp(); if ( pHelp ) { if ( pItem->maCommandStr.Len() ) pItem->maHelpText = pHelp->GetHelpText( pItem->maCommandStr, this ); - if ( !pItem->maHelpText.Len() && pItem->mnHelpId ) - pItem->maHelpText = pHelp->GetHelpText( pItem->mnHelpId, this ); + if ( !pItem->maHelpText.Len() && pItem->maHelpId.getLength() ) + pItem->maHelpText = pHelp->GetHelpText( rtl::OStringToOUString( pItem->maHelpId, RTL_TEXTENCODING_UTF8 ), this ); } } @@ -4862,7 +4864,7 @@ const XubString& ToolBox::ImplGetHelpText( USHORT nItemId ) const void ToolBox::RequestHelp( const HelpEvent& rHEvt ) { - USHORT nItemId; + sal_uInt16 nItemId; Point aHelpPos; if( !rHEvt.KeyboardActivated() ) @@ -4914,9 +4916,9 @@ void ToolBox::RequestHelp( const HelpEvent& rHEvt ) else if ( rHEvt.GetMode() & HELPMODE_EXTENDED ) { String aCommand = GetItemCommand( nItemId ); - ULONG nHelpId = GetHelpId( nItemId ); + rtl::OString aHelpId( GetHelpId( nItemId ) ); - if ( aCommand.Len() || nHelpId ) + if ( aCommand.Len() || aHelpId.getLength() ) { // Wenn eine Hilfe existiert, dann ausloesen Help* pHelp = Application::GetHelp(); @@ -4924,8 +4926,8 @@ void ToolBox::RequestHelp( const HelpEvent& rHEvt ) { if ( aCommand.Len() ) pHelp->Start( aCommand, this ); - else if ( nHelpId ) - pHelp->Start( nHelpId, this ); + else if ( aHelpId.getLength() ) + pHelp->Start( rtl::OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ), this ); } return; } @@ -4963,20 +4965,20 @@ long ToolBox::Notify( NotifyEvent& rNEvt ) { KeyEvent aKEvt = *rNEvt.GetKeyEvent(); KeyCode aKeyCode = aKEvt.GetKeyCode(); - USHORT nKeyCode = aKeyCode.GetCode(); + sal_uInt16 nKeyCode = aKeyCode.GetCode(); switch( nKeyCode ) { case KEY_TAB: { // internal TAB cycling only if parent is not a dialog or if we are the ony child // otherwise the dialog control will take over - BOOL bNoTabCycling = ( ( ImplGetParent()->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL) ) == WB_DIALOGCONTROL && + sal_Bool bNoTabCycling = ( ( ImplGetParent()->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL) ) == WB_DIALOGCONTROL && ImplGetParent()->GetChildCount() != 1 ); if( bNoTabCycling && ! (GetStyle() & WB_FORCETABCYCLE) ) return DockingWindow::Notify( rNEvt ); - else if( ImplChangeHighlightUpDn( aKeyCode.IsShift() ? TRUE : FALSE , bNoTabCycling ) ) - return FALSE; + else if( ImplChangeHighlightUpDn( aKeyCode.IsShift() ? sal_True : sal_False , bNoTabCycling ) ) + return sal_False; else return DockingWindow::Notify( rNEvt ); } @@ -4997,9 +4999,9 @@ long ToolBox::Notify( NotifyEvent& rNEvt ) } else if( (GetGetFocusFlags() & (GETFOCUS_BACKWARD|GETFOCUS_TAB) ) == (GETFOCUS_BACKWARD|GETFOCUS_TAB)) // Shift-TAB was pressed in the parent - ImplChangeHighlightUpDn( FALSE ); + ImplChangeHighlightUpDn( sal_False ); else - ImplChangeHighlightUpDn( TRUE ); + ImplChangeHighlightUpDn( sal_True ); mnLastFocusItemId = 0; @@ -5064,7 +5066,7 @@ void ToolBox::Command( const CommandEvent& rCEvt ) // dann mache nichts if ( (it->meType == TOOLBOXITEM_BUTTON) && !it->mbShowWindow ) - mbCommandDrag = TRUE; + mbCommandDrag = sal_True; break; } @@ -5088,10 +5090,10 @@ void ToolBox::Command( const CommandEvent& rCEvt ) if ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) { if ( (mnCurLine > 1) && (pData->GetDelta() > 0) ) - ShowLine( FALSE ); + ShowLine( sal_False ); else if ( (mnCurLine+mnVisLines-1 < mnCurLines) && (pData->GetDelta() < 0) ) - ShowLine( TRUE ); - ImplDrawSpin( FALSE, FALSE ); + ShowLine( sal_True ); + ImplDrawSpin( sal_False, sal_False ); return; } } @@ -5118,19 +5120,19 @@ void ToolBox::StateChanged( StateChangedType nType ) else if ( (nType == STATE_CHANGE_ZOOM) || (nType == STATE_CHANGE_CONTROLFONT) ) { - mbCalc = TRUE; - mbFormat = TRUE; - ImplInitSettings( TRUE, FALSE, FALSE ); + mbCalc = sal_True; + mbFormat = sal_True; + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { - ImplInitSettings( FALSE, FALSE, TRUE ); // font, foreground, background + ImplInitSettings( sal_False, sal_False, sal_True ); // font, foreground, background Invalidate(); } } @@ -5147,16 +5149,16 @@ void ToolBox::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - mbCalc = TRUE; - mbFormat = TRUE; - ImplInitSettings( TRUE, TRUE, TRUE ); + mbCalc = sal_True; + mbFormat = sal_True; + ImplInitSettings( sal_True, sal_True, sal_True ); Invalidate(); } } // ----------------------------------------------------------------------- -BOOL ToolBox::PrepareToggleFloatingMode() +sal_Bool ToolBox::PrepareToggleFloatingMode() { return DockingWindow::PrepareToggleFloatingMode(); } @@ -5167,27 +5169,27 @@ void ToolBox::ToggleFloatingMode() { DockingWindow::ToggleFloatingMode(); - BOOL mbOldHorz = mbHorz; + sal_Bool mbOldHorz = mbHorz; if ( ImplIsFloatingMode() ) { - mbHorz = TRUE; + mbHorz = sal_True; meAlign = WINDOWALIGN_TOP; - mbScroll = TRUE; + mbScroll = sal_True; if( mbOldHorz != mbHorz ) - mbCalc = TRUE; // orientation was changed ! + mbCalc = sal_True; // orientation was changed ! ImplSetMinMaxFloatSize( this ); SetOutputSizePixel( ImplCalcFloatSize( this, mnFloatLines ) ); } else { - mbScroll = (mnWinStyle & WB_SCROLL) ? TRUE : FALSE; + mbScroll = (mnWinStyle & WB_SCROLL) ? sal_True : sal_False; if ( (meAlign == WINDOWALIGN_TOP) || (meAlign == WINDOWALIGN_BOTTOM) ) - mbHorz = TRUE; + mbHorz = sal_True; else - mbHorz = FALSE; + mbHorz = sal_False; // set focus back to document ImplGetFrameWindow()->GetWindow( WINDOW_CLIENT )->GrabFocus(); @@ -5197,11 +5199,11 @@ void ToolBox::ToggleFloatingMode() { // if orientation changes, the toolbox has to be initialized again // to update the direction of the gradient - mbCalc = TRUE; - ImplInitSettings( TRUE, TRUE, TRUE ); + mbCalc = sal_True; + ImplInitSettings( sal_True, sal_True, sal_True ); } - mbFormat = TRUE; + mbFormat = sal_True; ImplFormat(); } @@ -5217,13 +5219,13 @@ void ToolBox::StartDocking() // ----------------------------------------------------------------------- -BOOL ToolBox::Docking( const Point& rPos, Rectangle& rRect ) +sal_Bool ToolBox::Docking( const Point& rPos, Rectangle& rRect ) { // Wenn Dragging, dann nicht machen, da vorher schon berechnet if ( mbDragging ) - return FALSE; + return sal_False; - BOOL bFloatMode = FALSE; + sal_Bool bFloatMode = sal_False; DockingWindow::Docking( rPos, rRect ); @@ -5236,7 +5238,7 @@ BOOL ToolBox::Docking( const Point& rPos, Rectangle& rRect ) // to get a floating mode as result - switch to floating size // so the calculation only depends on the position of the rectangle, not the current // docking state of the window - USHORT nTemp = 0; + sal_uInt16 nTemp = 0; aDockingRect.SetSize( ImplCalcFloatSize( this, nTemp ) ); // in this mode docking is never done by keyboard, so it's OK to use the mouse position @@ -5271,7 +5273,7 @@ BOOL ToolBox::Docking( const Point& rPos, Rectangle& rRect ) // FloatWindow werden Rectangle aIntersect = aInRect.GetIntersection( aDockingRect ); if ( aIntersect == aDockingRect ) - bFloatMode = TRUE; + bFloatMode = sal_True; else { // docking rectangle is in the "sensible area" @@ -5325,14 +5327,14 @@ BOOL ToolBox::Docking( const Point& rPos, Rectangle& rRect ) } } else - bFloatMode = TRUE; + bFloatMode = sal_True; if ( bFloatMode ) { meDockAlign = meAlign; if ( !mbLastFloatMode ) { - USHORT nTemp = 0; + sal_uInt16 nTemp = 0; aDockingRect.SetSize( ImplCalcFloatSize( this, nTemp ) ); } } @@ -5345,7 +5347,7 @@ BOOL ToolBox::Docking( const Point& rPos, Rectangle& rRect ) // ----------------------------------------------------------------------- -void ToolBox::EndDocking( const Rectangle& rRect, BOOL bFloatMode ) +void ToolBox::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) { if ( !IsDockingCanceled() ) { @@ -5362,8 +5364,8 @@ void ToolBox::EndDocking( const Rectangle& rRect, BOOL bFloatMode ) void ToolBox::Resizing( Size& rSize ) { - USHORT nCalcLines; - USHORT nTemp; + sal_uInt16 nCalcLines; + sal_uInt16 nTemp; // Alle Floatinggroessen berechnen ImplCalcFloatSizes( this ); @@ -5399,20 +5401,20 @@ void ToolBox::Resizing( Size& rSize ) // ----------------------------------------------------------------------- -Size ToolBox::CalcWindowSizePixel( USHORT nCalcLines ) const +Size ToolBox::CalcWindowSizePixel( sal_uInt16 nCalcLines ) const { return ImplCalcSize( this, nCalcLines ); } -Size ToolBox::CalcWindowSizePixel( USHORT nCalcLines, WindowAlign eAlign ) const +Size ToolBox::CalcWindowSizePixel( sal_uInt16 nCalcLines, WindowAlign eAlign ) const { return ImplCalcSize( this, nCalcLines, (eAlign == WINDOWALIGN_TOP || eAlign == WINDOWALIGN_BOTTOM) ? TB_CALCMODE_HORZ : TB_CALCMODE_VERT ); } -USHORT ToolBox::ImplCountLineBreaks( const ToolBox *pThis ) +sal_uInt16 ToolBox::ImplCountLineBreaks( const ToolBox *pThis ) { - USHORT nLines = 0; + sal_uInt16 nLines = 0; std::vector< ImplToolItem >::const_iterator it = ((ToolBox*)pThis)->mpData->m_aItems.begin(); while ( it != ((ToolBox*)pThis)->mpData->m_aItems.end() ) @@ -5427,19 +5429,19 @@ USHORT ToolBox::ImplCountLineBreaks( const ToolBox *pThis ) Size ToolBox::CalcPopupWindowSizePixel() const { // count number of breaks and calc corresponding floating window size - USHORT nLines = ImplCountLineBreaks( this ); + sal_uInt16 nLines = ImplCountLineBreaks( this ); if( nLines ) ++nLines; // add the first line else { // no breaks found: use quadratic layout - nLines = (USHORT) ceil( sqrt( (double) GetItemCount() ) ); + nLines = (sal_uInt16) ceil( sqrt( (double) GetItemCount() ) ); } - BOOL bPopup = mpData->mbAssumePopupMode; + sal_Bool bPopup = mpData->mbAssumePopupMode; ToolBox *pThis = (ToolBox*) this; - pThis->mpData->mbAssumePopupMode = TRUE; + pThis->mpData->mbAssumePopupMode = sal_True; Size aSize = CalcFloatingWindowSizePixel( nLines ); @@ -5449,24 +5451,24 @@ Size ToolBox::CalcPopupWindowSizePixel() const Size ToolBox::CalcFloatingWindowSizePixel() const { - USHORT nLines = ImplCountLineBreaks( this ); + sal_uInt16 nLines = ImplCountLineBreaks( this ); ++nLines; // add the first line return CalcFloatingWindowSizePixel( nLines ); } -Size ToolBox::CalcFloatingWindowSizePixel( USHORT nCalcLines ) const +Size ToolBox::CalcFloatingWindowSizePixel( sal_uInt16 nCalcLines ) const { - BOOL bFloat = mpData->mbAssumeFloating; - BOOL bDocking = mpData->mbAssumeDocked; + sal_Bool bFloat = mpData->mbAssumeFloating; + sal_Bool bDocking = mpData->mbAssumeDocked; // simulate floating mode and force reformat before calculating ToolBox *pThis = (ToolBox*) this; - pThis->mpData->mbAssumeFloating = TRUE; - pThis->mpData->mbAssumeDocked = FALSE; + pThis->mpData->mbAssumeFloating = sal_True; + pThis->mpData->mbAssumeDocked = sal_False; Size aSize = ImplCalcFloatSize( (ToolBox*) this, nCalcLines ); - pThis->mbFormat = TRUE; + pThis->mbFormat = sal_True; pThis->mpData->mbAssumeFloating = bFloat; pThis->mpData->mbAssumeDocked = bDocking; @@ -5518,7 +5520,7 @@ Size ToolBox::CalcMinimumWindowSizePixel() const // ----------------------------------------------------------------------- -void ToolBox::EnableCustomize( BOOL bEnable ) +void ToolBox::EnableCustomize( sal_Bool bEnable ) { if ( bEnable != mbCustomize ) { @@ -5548,7 +5550,7 @@ void ToolBox::StartCustomize( const Rectangle& rRect, void* pData ) aMousePos = ScreenToOutputPixel( aPos ); Pointer aPtr; SetPointer( aPtr ); - pMgr->StartDragging( this, aMousePos, aRect, 0, FALSE, pData ); + pMgr->StartDragging( this, aMousePos, aRect, 0, sal_False, pData ); } // ----------------------------------------------------------------------- @@ -5569,7 +5571,7 @@ void ToolBox::EndCustomizeMode() // ----------------------------------------------------------------------- -BOOL ToolBox::IsCustomizeMode() +sal_Bool ToolBox::IsCustomizeMode() { ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); return pMgr->IsCustomizeMode(); @@ -5586,7 +5588,7 @@ void ToolBox::GetFocus() void ToolBox::LoseFocus() { - ImplChangeHighlight( NULL, TRUE ); + ImplChangeHighlight( NULL, sal_True ); DockingWindow::LoseFocus(); } @@ -5594,10 +5596,10 @@ void ToolBox::LoseFocus() // ----------------------------------------------------------------------- // performs the action associated with an item, ie simulates clicking the item -void ToolBox::TriggerItem( USHORT nItemId, BOOL bShift, BOOL bCtrl ) +void ToolBox::TriggerItem( sal_uInt16 nItemId, sal_Bool bShift, sal_Bool bCtrl ) { mnHighItemId = nItemId; - USHORT nModifier = 0; + sal_uInt16 nModifier = 0; if( bShift ) nModifier |= KEY_SHIFT; if( bCtrl ) @@ -5609,24 +5611,24 @@ void ToolBox::TriggerItem( USHORT nItemId, BOOL bShift, BOOL bCtrl ) // ----------------------------------------------------------------------- // calls the button's action handler -// returns TRUE if action was called -BOOL ToolBox::ImplActivateItem( KeyCode aKeyCode ) +// returns sal_True if action was called +sal_Bool ToolBox::ImplActivateItem( KeyCode aKeyCode ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if( mnHighItemId ) { ImplToolItem *pToolItem = ImplGetItem( mnHighItemId ); // #107712#, activate can also be called for disabled entries if( pToolItem && !pToolItem->mbEnabled ) - return TRUE; + return sal_True; if( pToolItem && pToolItem->mpWindow && HasFocus() ) { ImplHideFocus(); - mbChangingHighlight = TRUE; // avoid focus change due to loose focus + mbChangingHighlight = sal_True; // avoid focus change due to loose focus pToolItem->mpWindow->ImplControlFocus( GETFOCUS_TAB ); - mbChangingHighlight = FALSE; + mbChangingHighlight = sal_False; } else { @@ -5648,7 +5650,7 @@ BOOL ToolBox::ImplActivateItem( KeyCode aKeyCode ) } } mnMouseModifier = aKeyCode.GetModifier(); - mbIsKeyEvent = TRUE; + mbIsKeyEvent = sal_True; Activate(); Click(); @@ -5661,18 +5663,18 @@ BOOL ToolBox::ImplActivateItem( KeyCode aKeyCode ) ImplRemoveDel( &aDelData ); Deactivate(); - mbIsKeyEvent = FALSE; + mbIsKeyEvent = sal_False; mnMouseModifier = 0; } } else - bRet = FALSE; + bRet = sal_False; return bRet; } // ----------------------------------------------------------------------- -BOOL ImplCloseLastPopup( Window *pParent ) +sal_Bool ImplCloseLastPopup( Window *pParent ) { // close last popup toolbox (see also: // ImplHandleMouseFloatMode(...) in winproc.cxx ) @@ -5684,23 +5686,23 @@ BOOL ImplCloseLastPopup( Window *pParent ) if( pLastLevelFloat && pLastLevelFloat != pParent ) { pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } // opens a drop down toolbox item -// returns TRUE if item was opened -BOOL ToolBox::ImplOpenItem( KeyCode aKeyCode ) +// returns sal_True if item was opened +sal_Bool ToolBox::ImplOpenItem( KeyCode aKeyCode ) { - USHORT nCode = aKeyCode.GetCode(); - BOOL bRet = TRUE; + sal_uInt16 nCode = aKeyCode.GetCode(); + sal_Bool bRet = sal_True; // arrow keys should work only in the opposite direction of alignment (to not break cursor travelling) if ( ((nCode == KEY_LEFT || nCode == KEY_RIGHT) && IsHorizontal()) || ((nCode == KEY_UP || nCode == KEY_DOWN) && !IsHorizontal()) ) - return FALSE; + return sal_False; if( IsMenuEnabled() && mpData->mbMenubuttonSelected ) { @@ -5720,19 +5722,19 @@ BOOL ToolBox::ImplOpenItem( KeyCode aKeyCode ) mnCurPos = GetItemPos( mnCurItemId ); mnLastFocusItemId = mnCurItemId; // save item id for possible later focus restore mnMouseModifier = aKeyCode.GetModifier(); - mbIsShift = TRUE; - mbIsKeyEvent = TRUE; + mbIsShift = sal_True; + mbIsKeyEvent = sal_True; Activate(); - mpData->mbDropDownByKeyboard = TRUE; + mpData->mbDropDownByKeyboard = sal_True; GetDropdownClickHdl().Call( this ); - mbIsKeyEvent = FALSE; - mbIsShift = FALSE; + mbIsKeyEvent = sal_False; + mbIsShift = sal_False; mnMouseModifier = 0; } else - bRet = FALSE; + bRet = sal_False; return bRet; } @@ -5743,10 +5745,10 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) { KeyCode aKeyCode = rKEvt.GetKeyCode(); mnKeyModifier = aKeyCode.GetModifier(); - USHORT nCode = aKeyCode.GetCode(); - BOOL bParentIsDialog = ( ( ImplGetParent()->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL) ) == WB_DIALOGCONTROL ); - BOOL bForwardKey = FALSE; - BOOL bGrabFocusToDocument = FALSE; + sal_uInt16 nCode = aKeyCode.GetCode(); + sal_Bool bParentIsDialog = ( ( ImplGetParent()->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL) ) == WB_DIALOGCONTROL ); + sal_Bool bForwardKey = sal_False; + sal_Bool bGrabFocusToDocument = sal_False; // #107776# we might be destroyed in the keyhandler ImplDelData aDelData; @@ -5760,7 +5762,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) if( aKeyCode.GetModifier() ) // allow only pure cursor keys break; if( !IsHorizontal() ) - ImplChangeHighlightUpDn( TRUE ); + ImplChangeHighlightUpDn( sal_True ); else ImplOpenItem( aKeyCode ); } @@ -5770,7 +5772,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) if( aKeyCode.GetModifier() ) // allow only pure cursor keys break; if( IsHorizontal() ) - ImplChangeHighlightUpDn( TRUE ); + ImplChangeHighlightUpDn( sal_True ); else ImplOpenItem( aKeyCode ); } @@ -5780,7 +5782,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) if( aKeyCode.GetModifier() ) // allow only pure cursor keys break; if( !IsHorizontal() ) - ImplChangeHighlightUpDn( FALSE ); + ImplChangeHighlightUpDn( sal_False ); else ImplOpenItem( aKeyCode ); } @@ -5790,7 +5792,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) if( aKeyCode.GetModifier() ) // allow only pure cursor keys break; if( IsHorizontal() ) - ImplChangeHighlightUpDn( FALSE ); + ImplChangeHighlightUpDn( sal_False ); else ImplOpenItem( aKeyCode ); } @@ -5802,9 +5804,9 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) mnCurLine = mnCurLine - mnVisLines; else mnCurLine = 1; - mbFormat = TRUE; + mbFormat = sal_True; ImplFormat(); - ImplDrawSpin( FALSE, FALSE ); + ImplDrawSpin( sal_False, sal_False ); ImplChangeHighlight( ImplGetFirstValidItem( mnCurLine ) ); } break; @@ -5815,22 +5817,22 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) mnCurLine = mnCurLine + mnVisLines; else mnCurLine = mnCurLines; - mbFormat = TRUE; + mbFormat = sal_True; ImplFormat(); - ImplDrawSpin( FALSE, FALSE ); + ImplDrawSpin( sal_False, sal_False ); ImplChangeHighlight( ImplGetFirstValidItem( mnCurLine ) ); } break; case KEY_END: { ImplChangeHighlight( NULL ); - ImplChangeHighlightUpDn( FALSE ); + ImplChangeHighlightUpDn( sal_False ); } break; case KEY_HOME: { ImplChangeHighlight( NULL ); - ImplChangeHighlightUpDn( TRUE ); + ImplChangeHighlightUpDn( sal_True ); } break; case KEY_ESCAPE: @@ -5863,7 +5865,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) if( !pItem->mbEnabled ) { Sound::Beep( SOUND_DISABLE, this ); - bGrabFocusToDocument = TRUE; + bGrabFocusToDocument = sal_True; } } if( !bGrabFocusToDocument ) @@ -5872,7 +5874,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) break; default: { - USHORT aKeyGroup = aKeyCode.GetGroup(); + sal_uInt16 aKeyGroup = aKeyCode.GetGroup(); ImplToolItem *pItem = NULL; if( mnHighItemId ) pItem = ImplGetItem( mnHighItemId ); @@ -5881,9 +5883,9 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) { Window *pFocusWindow = Application::GetFocusWindow(); ImplHideFocus(); - mbChangingHighlight = TRUE; // avoid focus change due to loose focus + mbChangingHighlight = sal_True; // avoid focus change due to loose focus pItem->mpWindow->ImplControlFocus( GETFOCUS_TAB ); - mbChangingHighlight = FALSE; + mbChangingHighlight = sal_False; if( pFocusWindow != Application::GetFocusWindow() ) Application::GetFocusWindow()->KeyInput( rKEvt ); } @@ -5893,7 +5895,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) // while the toolbox has the focus // just forward function and special keys and combinations with Alt-key if( aKeyGroup == KEYGROUP_FKEYS || aKeyGroup == KEYGROUP_MISC || aKeyCode.IsMod2() ) - bForwardKey = TRUE; + bForwardKey = sal_True; } } } @@ -5905,7 +5907,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) // #107251# move focus away if this toolbox was disabled during keyinput if( HasFocus() && mpData->mbKeyInputDisabled && (ImplGetParent()->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL) ) == WB_DIALOGCONTROL) { - USHORT n = 0; + sal_uInt16 n = 0; Window *pFocusControl = ImplGetParent()->ImplGetDlgWindow( n, DLGWINDOW_FIRST ); if ( pFocusControl && pFocusControl != this ) pFocusControl->ImplControlFocus( GETFOCUS_INIT ); @@ -5927,10 +5929,10 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) // ----------------------------------------------------------------------- // returns the current toolbox line of the item -USHORT ToolBox::ImplGetItemLine( ImplToolItem* pCurrentItem ) +sal_uInt16 ToolBox::ImplGetItemLine( ImplToolItem* pCurrentItem ) { std::vector< ImplToolItem >::const_iterator it = mpData->m_aItems.begin(); - USHORT nLine = 1; + sal_uInt16 nLine = 1; while( it != mpData->m_aItems.end() ) { if ( it->mbBreak ) @@ -5943,7 +5945,7 @@ USHORT ToolBox::ImplGetItemLine( ImplToolItem* pCurrentItem ) } // returns the first displayable item in the given line -ImplToolItem* ToolBox::ImplGetFirstValidItem( USHORT nLine ) +ImplToolItem* ToolBox::ImplGetFirstValidItem( sal_uInt16 nLine ) { if( !nLine || nLine > mnCurLines ) return NULL; @@ -5975,7 +5977,7 @@ ImplToolItem* ToolBox::ImplGetFirstValidItem( USHORT nLine ) } // returns the last displayable item in the given line -ImplToolItem* ToolBox::ImplGetLastValidItem( USHORT nLine ) +ImplToolItem* ToolBox::ImplGetLastValidItem( sal_uInt16 nLine ) { if( !nLine || nLine > mnCurLines ) return NULL; @@ -6009,11 +6011,11 @@ ImplToolItem* ToolBox::ImplGetLastValidItem( USHORT nLine ) // ----------------------------------------------------------------------- -USHORT ToolBox::ImplFindItemPos( const ImplToolItem* pItem, const std::vector< ImplToolItem >& rList ) +sal_uInt16 ToolBox::ImplFindItemPos( const ImplToolItem* pItem, const std::vector< ImplToolItem >& rList ) { if( pItem ) { - USHORT nPos; + sal_uInt16 nPos; for( nPos = 0; nPos < rList.size(); ++nPos ) if( &rList[ nPos ] == pItem ) return nPos; @@ -6021,34 +6023,34 @@ USHORT ToolBox::ImplFindItemPos( const ImplToolItem* pItem, const std::vector< I return TOOLBOX_ITEM_NOTFOUND; } -void ToolBox::ChangeHighlight( USHORT nPos ) +void ToolBox::ChangeHighlight( sal_uInt16 nPos ) { if ( nPos < GetItemCount() ) { ImplGrabFocus( 0 ); - ImplChangeHighlight ( ImplGetItem ( GetItemId ( (USHORT) nPos ) ), FALSE ); + ImplChangeHighlight ( ImplGetItem ( GetItemId ( (sal_uInt16) nPos ) ), sal_False ); } } -void ToolBox::ImplChangeHighlight( ImplToolItem* pItem, BOOL bNoGrabFocus ) +void ToolBox::ImplChangeHighlight( ImplToolItem* pItem, sal_Bool bNoGrabFocus ) { // avoid recursion due to focus change if( mbChangingHighlight ) return; - mbChangingHighlight = TRUE; + mbChangingHighlight = sal_True; ImplToolItem* pOldItem = NULL; if ( mnHighItemId ) { ImplHideFocus(); - USHORT nPos = GetItemPos( mnHighItemId ); + sal_uInt16 nPos = GetItemPos( mnHighItemId ); pOldItem = ImplGetItem( mnHighItemId ); // #i89962# ImplDrawItem can cause Invalidate/Update // which will in turn ImplShowFocus again // set mnHighItemId to 0 already to prevent this hen/egg problem mnHighItemId = 0; - ImplDrawItem( nPos, FALSE ); + ImplDrawItem( nPos, sal_False ); ImplCallEventListeners( VCLEVENT_TOOLBOX_HIGHLIGHTOFF, reinterpret_cast< void* >( nPos ) ); } @@ -6060,21 +6062,21 @@ void ToolBox::ImplChangeHighlight( ImplToolItem* pItem, BOOL bNoGrabFocus ) if( pItem ) { - USHORT aPos = ToolBox::ImplFindItemPos( pItem, mpData->m_aItems ); + sal_uInt16 aPos = ToolBox::ImplFindItemPos( pItem, mpData->m_aItems ); if( aPos != TOOLBOX_ITEM_NOTFOUND) { // check for line breaks - USHORT nLine = ImplGetItemLine( pItem ); + sal_uInt16 nLine = ImplGetItemLine( pItem ); if( nLine >= mnCurLine + mnVisLines ) { mnCurLine = nLine - mnVisLines + 1; - mbFormat = TRUE; + mbFormat = sal_True; } else if ( nLine < mnCurLine ) { mnCurLine = nLine; - mbFormat = TRUE; + mbFormat = sal_True; } if( mbFormat ) @@ -6099,23 +6101,23 @@ void ToolBox::ImplChangeHighlight( ImplToolItem* pItem, BOOL bNoGrabFocus ) mnCurPos = TOOLBOX_ITEM_NOTFOUND; } - mbChangingHighlight = FALSE; + mbChangingHighlight = sal_False; } // ----------------------------------------------------------------------- // check for keyboard accessible items -static BOOL ImplIsValidItem( const ImplToolItem* pItem, BOOL bNotClipped ) +static sal_Bool ImplIsValidItem( const ImplToolItem* pItem, sal_Bool bNotClipped ) { - BOOL bValid = (pItem && pItem->meType == TOOLBOXITEM_BUTTON && pItem->mbVisible && !ImplIsFixedControl( pItem )); + sal_Bool bValid = (pItem && pItem->meType == TOOLBOXITEM_BUTTON && pItem->mbVisible && !ImplIsFixedControl( pItem )); if( bValid && bNotClipped && pItem->IsClipped() ) - bValid = FALSE; + bValid = sal_False; return bValid; } // ----------------------------------------------------------------------- -BOOL ToolBox::ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle ) +sal_Bool ToolBox::ImplChangeHighlightUpDn( sal_Bool bUp, sal_Bool bNoCycle ) { ImplToolItem* pToolItem = ImplGetItem( mnHighItemId ); @@ -6132,13 +6134,13 @@ BOOL ToolBox::ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle ) while( it != mpData->m_aItems.begin() ) { --it; - if ( ImplIsValidItem( &(*it), TRUE ) ) + if ( ImplIsValidItem( &(*it), sal_True ) ) { pItem = &(*it); break; } } - ImplDrawMenubutton( this, FALSE ); + ImplDrawMenubutton( this, sal_False ); ImplChangeHighlight( pItem ); } else @@ -6147,17 +6149,17 @@ BOOL ToolBox::ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle ) std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); while( it != mpData->m_aItems.end() ) { - if ( ImplIsValidItem( &(*it), TRUE ) ) + if ( ImplIsValidItem( &(*it), sal_True ) ) break; ++it; } if( it != mpData->m_aItems.end() ) { - ImplDrawMenubutton( this, FALSE ); + ImplDrawMenubutton( this, sal_False ); ImplChangeHighlight( &(*it) ); } } - return TRUE; + return sal_True; } if( bUp ) @@ -6166,7 +6168,7 @@ BOOL ToolBox::ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle ) std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); while( it != mpData->m_aItems.end() ) { - if ( ImplIsValidItem( &(*it), FALSE ) ) + if ( ImplIsValidItem( &(*it), sal_False ) ) break; ++it; } @@ -6175,11 +6177,11 @@ BOOL ToolBox::ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle ) if( (it != mpData->m_aItems.end() && &(*it) == ImplGetFirstClippedItem( this )) && IsMenuEnabled() ) { ImplChangeHighlight( NULL ); - ImplDrawMenubutton( this, TRUE ); + ImplDrawMenubutton( this, sal_True ); } else ImplChangeHighlight( (it != mpData->m_aItems.end()) ? &(*it) : NULL ); - return TRUE; + return sal_True; } else { @@ -6189,7 +6191,7 @@ BOOL ToolBox::ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle ) if( IsMenuEnabled() && !ImplIsFloatingMode() ) { ImplChangeHighlight( NULL ); - ImplDrawMenubutton( this, TRUE ); + ImplDrawMenubutton( this, sal_True ); } else { @@ -6198,7 +6200,7 @@ BOOL ToolBox::ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle ) while( it != mpData->m_aItems.begin() ) { --it; - if ( ImplIsValidItem( &(*it), FALSE ) ) + if ( ImplIsValidItem( &(*it), sal_False ) ) { pItem = &(*it); break; @@ -6206,16 +6208,16 @@ BOOL ToolBox::ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle ) } ImplChangeHighlight( pItem ); } - return TRUE; + return sal_True; } } if( pToolItem ) { - ULONG pos = ToolBox::ImplFindItemPos( pToolItem, mpData->m_aItems ); - ULONG nCount = mpData->m_aItems.size(); + sal_uLong pos = ToolBox::ImplFindItemPos( pToolItem, mpData->m_aItems ); + sal_uLong nCount = mpData->m_aItems.size(); - ULONG i=0; + sal_uLong i=0; do { if( bUp ) @@ -6223,14 +6225,14 @@ BOOL ToolBox::ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle ) if( !pos-- ) { if( bNoCycle ) - return FALSE; + return sal_False; // highlight the menu button if it is the last item if( IsMenuEnabled() && !ImplIsFloatingMode() ) { ImplChangeHighlight( NULL ); - ImplDrawMenubutton( this, TRUE ); - return TRUE; + ImplDrawMenubutton( this, sal_True ); + return sal_True; } else pos = nCount-1; @@ -6241,14 +6243,14 @@ BOOL ToolBox::ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle ) if( ++pos >= nCount ) { if( bNoCycle ) - return FALSE; + return sal_False; // highlight the menu button if it is the last item if( IsMenuEnabled() && !ImplIsFloatingMode() ) { ImplChangeHighlight( NULL ); - ImplDrawMenubutton( this, TRUE ); - return TRUE; + ImplDrawMenubutton( this, sal_True ); + return sal_True; } else pos = 0; @@ -6257,7 +6259,7 @@ BOOL ToolBox::ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle ) pToolItem = &mpData->m_aItems[pos]; - if ( ImplIsValidItem( pToolItem, FALSE ) ) + if ( ImplIsValidItem( pToolItem, sal_False ) ) break; } while( ++i < nCount); @@ -6266,14 +6268,14 @@ BOOL ToolBox::ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle ) { // select the menu button if a clipped item would be selected ImplChangeHighlight( NULL ); - ImplDrawMenubutton( this, TRUE ); + ImplDrawMenubutton( this, sal_True ); } else if( i != nCount ) ImplChangeHighlight( pToolItem ); else - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -6286,7 +6288,7 @@ void ToolBox::ImplShowFocus() if( pItem->mpWindow ) { Window *pWin = pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow ? pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow : pItem->mpWindow; - pWin->ImplGetWindowImpl()->mbDrawSelectionBackground = TRUE; + pWin->ImplGetWindowImpl()->mbDrawSelectionBackground = sal_True; pWin->Invalidate( 0 ); } } @@ -6302,7 +6304,7 @@ void ToolBox::ImplHideFocus() if( pItem->mpWindow ) { Window *pWin = pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow ? pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow : pItem->mpWindow; - pWin->ImplGetWindowImpl()->mbDrawSelectionBackground = FALSE; + pWin->ImplGetWindowImpl()->mbDrawSelectionBackground = sal_False; pWin->Invalidate( 0 ); } } @@ -6310,7 +6312,7 @@ void ToolBox::ImplHideFocus() if ( mpData->mbMenubuttonSelected ) { // remove highlight from menubutton - ImplDrawMenubutton( this, FALSE ); + ImplDrawMenubutton( this, sal_False ); } } @@ -6330,7 +6332,7 @@ void ToolBox::ImplDisableFlatButtons() &hkey) ) { DWORD dwType = 0; - WIN_BYTE Data[6]; // possible values: "true", "false", "1", "0", DWORD + sal_uInt8 Data[6]; // possible values: "true", "false", "1", "0", DWORD DWORD cbData = sizeof(Data); if( ERROR_SUCCESS == RegQueryValueEx(hkey, "DisableFlatToolboxButtons", diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index f17c7d0ef87e..37650232fd7f 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -72,17 +72,17 @@ ImplToolBoxPrivateData::ImplToolBoxPrivateData() : mnMenuButtonWidth = TB_MENUBUTTON_SIZE; - mbIsLocked = FALSE; - mbNativeButtons = FALSE; - mbIsPaintLocked = FALSE; - mbAssumeDocked = FALSE; - mbAssumePopupMode = FALSE; - mbAssumeFloating = FALSE; - mbKeyInputDisabled = FALSE; - mbMenubuttonSelected = FALSE; - mbPageScroll = FALSE; - mbWillUsePopupMode = FALSE; - mbDropDownByKeyboard = FALSE; + mbIsLocked = sal_False; + mbNativeButtons = sal_False; + mbIsPaintLocked = sal_False; + mbAssumeDocked = sal_False; + mbAssumePopupMode = sal_False; + mbAssumeFloating = sal_False; + mbKeyInputDisabled = sal_False; + mbMenubuttonSelected = sal_False; + mbPageScroll = sal_False; + mbWillUsePopupMode = sal_False; + mbDropDownByKeyboard = sal_False; } ImplToolBoxPrivateData::~ImplToolBoxPrivateData() @@ -98,40 +98,38 @@ ImplToolItem::ImplToolItem() mnId = 0; mpWindow = NULL; mpUserData = NULL; - mnHelpId = 0; meType = TOOLBOXITEM_BUTTON; mnBits = 0; meState = STATE_NOCHECK; - mbEnabled = TRUE; - mbVisible = TRUE; - mbEmptyBtn = TRUE; - mbShowWindow = FALSE; - mbBreak = FALSE; + mbEnabled = sal_True; + mbVisible = sal_True; + mbEmptyBtn = sal_True; + mbShowWindow = sal_False; + mbBreak = sal_False; mnSepSize = TB_SEP_SIZE; mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH; mnImageAngle = 0; - mbMirrorMode = FALSE; - mbVisibleText = FALSE; + mbMirrorMode = sal_False; + mbVisibleText = sal_False; } // ----------------------------------------------------------------------- -ImplToolItem::ImplToolItem( USHORT nItemId, const Image& rImage, +ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage, ToolBoxItemBits nItemBits ) : maImage( rImage ) { mnId = nItemId; mpWindow = NULL; mpUserData = NULL; - mnHelpId = 0; meType = TOOLBOXITEM_BUTTON; mnBits = nItemBits; meState = STATE_NOCHECK; - mbEnabled = TRUE; - mbVisible = TRUE; - mbEmptyBtn = FALSE; - mbShowWindow = FALSE; - mbBreak = FALSE; + mbEnabled = sal_True; + mbVisible = sal_True; + mbEmptyBtn = sal_False; + mbShowWindow = sal_False; + mbBreak = sal_False; mnSepSize = TB_SEP_SIZE; mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH; mnImageAngle = 0; @@ -141,22 +139,21 @@ ImplToolItem::ImplToolItem( USHORT nItemId, const Image& rImage, // ----------------------------------------------------------------------- -ImplToolItem::ImplToolItem( USHORT nItemId, const XubString& rText, +ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const XubString& rText, ToolBoxItemBits nItemBits ) : maText( rText ) { mnId = nItemId; mpWindow = NULL; mpUserData = NULL; - mnHelpId = 0; meType = TOOLBOXITEM_BUTTON; mnBits = nItemBits; meState = STATE_NOCHECK; - mbEnabled = TRUE; - mbVisible = TRUE; - mbEmptyBtn = FALSE; - mbShowWindow = FALSE; - mbBreak = FALSE; + mbEnabled = sal_True; + mbVisible = sal_True; + mbEmptyBtn = sal_False; + mbShowWindow = sal_False; + mbBreak = sal_False; mnSepSize = TB_SEP_SIZE; mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH; mnImageAngle = 0; @@ -166,7 +163,7 @@ ImplToolItem::ImplToolItem( USHORT nItemId, const XubString& rText, // ----------------------------------------------------------------------- -ImplToolItem::ImplToolItem( USHORT nItemId, const Image& rImage, +ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage, const XubString& rText, ToolBoxItemBits nItemBits ) : maImage( rImage ), maText( rText ) @@ -174,15 +171,14 @@ ImplToolItem::ImplToolItem( USHORT nItemId, const Image& rImage, mnId = nItemId; mpWindow = NULL; mpUserData = NULL; - mnHelpId = 0; meType = TOOLBOXITEM_BUTTON; mnBits = nItemBits; meState = STATE_NOCHECK; - mbEnabled = TRUE; - mbVisible = TRUE; - mbEmptyBtn = FALSE; - mbShowWindow = FALSE; - mbBreak = FALSE; + mbEnabled = sal_True; + mbVisible = sal_True; + mbEmptyBtn = sal_False; + mbShowWindow = sal_False; + mbBreak = sal_False; mnSepSize = TB_SEP_SIZE; mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH; mnImageAngle = 0; @@ -203,7 +199,7 @@ ImplToolItem::ImplToolItem( const ImplToolItem& rItem ) : maQuickHelpText ( rItem.maQuickHelpText ), maHelpText ( rItem.maHelpText ), maCommandStr ( rItem.maCommandStr ), - mnHelpId ( rItem.mnHelpId ), + maHelpId ( rItem.maHelpId ), maRect ( rItem.maRect ), maCalcRect ( rItem.maCalcRect ), maItemSize ( rItem.maItemSize ), @@ -242,7 +238,7 @@ ImplToolItem& ImplToolItem::operator=( const ImplToolItem& rItem ) maQuickHelpText = rItem.maQuickHelpText; maHelpText = rItem.maHelpText; maCommandStr = rItem.maCommandStr; - mnHelpId = rItem.mnHelpId; + maHelpId = rItem.maHelpId; maRect = rItem.maRect; maCalcRect = rItem.maCalcRect; mnSepSize = rItem.mnSepSize; @@ -263,7 +259,7 @@ ImplToolItem& ImplToolItem::operator=( const ImplToolItem& rItem ) // ----------------------------------------------------------------------- -Size ImplToolItem::GetSize( BOOL bHorz, BOOL bCheckMaxWidth, long maxWidth, const Size& rDefaultSize ) +Size ImplToolItem::GetSize( sal_Bool bHorz, sal_Bool bCheckMaxWidth, long maxWidth, const Size& rDefaultSize ) { Size aSize( rDefaultSize ); // the size of 'standard' toolbox items // non-standard items are eg windows or buttons with text @@ -275,13 +271,13 @@ Size ImplToolItem::GetSize( BOOL bHorz, BOOL bCheckMaxWidth, long maxWidth, cons if ( mpWindow && bHorz ) { // get size of item window and check if it fits - // no windows in vertical toolbars (the default is mbShowWindow=FALSE) + // no windows in vertical toolbars (the default is mbShowWindow=sal_False) Size aWinSize = mpWindow->GetSizePixel(); if ( !bCheckMaxWidth || (aWinSize.Width() <= maxWidth) ) { aSize.Width() = aWinSize.Width(); aSize.Height() = aWinSize.Height(); - mbShowWindow = TRUE; + mbShowWindow = sal_True; } else { @@ -317,27 +313,27 @@ Size ImplToolItem::GetSize( BOOL bHorz, BOOL bCheckMaxWidth, long maxWidth, cons // ----------------------------------------------------------------------- -void ImplToolItem::DetermineButtonDrawStyle( ButtonType eButtonType, BOOL& rbImage, BOOL& rbText ) const +void ImplToolItem::DetermineButtonDrawStyle( ButtonType eButtonType, sal_Bool& rbImage, sal_Bool& rbText ) const { if ( meType != TOOLBOXITEM_BUTTON ) { // no button -> draw nothing - rbImage = rbText = FALSE; + rbImage = rbText = sal_False; return; } - BOOL bHasImage; - BOOL bHasText; + sal_Bool bHasImage; + sal_Bool bHasText; // check for image and/or text if ( !(maImage) ) - bHasImage = FALSE; + bHasImage = sal_False; else - bHasImage = TRUE; + bHasImage = sal_True; if ( !maText.Len() ) - bHasText = FALSE; + bHasText = sal_False; else - bHasText = TRUE; + bHasText = sal_True; // prefer images if symbolonly buttons are drawn // prefer texts if textonly buttons are dreawn @@ -346,38 +342,38 @@ void ImplToolItem::DetermineButtonDrawStyle( ButtonType eButtonType, BOOL& rbIma { if( bHasImage || !bHasText ) { - rbImage = TRUE; - rbText = FALSE; + rbImage = sal_True; + rbText = sal_False; } else { - rbImage = FALSE; - rbText = TRUE; + rbImage = sal_False; + rbText = sal_True; } } else if ( eButtonType == BUTTON_TEXT ) // drawing text only { if( bHasText || !bHasImage ) { - rbImage = FALSE; - rbText = TRUE; + rbImage = sal_False; + rbText = sal_True; } else { - rbImage = TRUE; - rbText = FALSE; + rbImage = sal_True; + rbText = sal_False; } } else // drawing icons and text both { - rbImage = TRUE; - rbText = TRUE; + rbImage = sal_True; + rbText = sal_True; } } // ----------------------------------------------------------------------- -Rectangle ImplToolItem::GetDropDownRect( BOOL bHorz ) const +Rectangle ImplToolItem::GetDropDownRect( sal_Bool bHorz ) const { Rectangle aRect; if( (mnBits & TIB_DROPDOWN) && !maRect.IsEmpty() ) @@ -395,7 +391,7 @@ Rectangle ImplToolItem::GetDropDownRect( BOOL bHorz ) const // ----------------------------------------------------------------------- -BOOL ImplToolItem::IsClipped() const +sal_Bool ImplToolItem::IsClipped() const { return ( meType == TOOLBOXITEM_BUTTON && mbVisible && maRect.IsEmpty() ); } @@ -414,16 +410,16 @@ const XubString& ToolBox::ImplConvertMenuString( const XubString& rStr ) // ----------------------------------------------------------------------- -void ToolBox::ImplInvalidate( BOOL bNewCalc, BOOL bFullPaint ) +void ToolBox::ImplInvalidate( sal_Bool bNewCalc, sal_Bool bFullPaint ) { ImplUpdateInputEnable(); if ( bNewCalc ) - mbCalc = TRUE; + mbCalc = sal_True; if ( bFullPaint ) { - mbFormat = TRUE; + mbFormat = sal_True; // Muss ueberhaupt eine neue Ausgabe erfolgen if ( IsReallyVisible() && IsUpdateMode() ) @@ -437,7 +433,7 @@ void ToolBox::ImplInvalidate( BOOL bNewCalc, BOOL bFullPaint ) { if ( !mbFormat ) { - mbFormat = TRUE; + mbFormat = sal_True; // Muss ueberhaupt eine neue Ausgabe erfolgen if ( IsReallyVisible() && IsUpdateMode() ) @@ -451,7 +447,7 @@ void ToolBox::ImplInvalidate( BOOL bNewCalc, BOOL bFullPaint ) // ----------------------------------------------------------------------- -void ToolBox::ImplUpdateItem( USHORT nIndex ) +void ToolBox::ImplUpdateItem( sal_uInt16 nIndex ) { // Muss ueberhaupt eine neue Ausgabe erfolgen if ( IsReallyVisible() && IsUpdateMode() ) @@ -558,10 +554,10 @@ void ToolBox::UserDraw( const UserDrawEvent& ) // ----------------------------------------------------------------------- -void ToolBox::InsertItem( const ResId& rResId, USHORT nPos ) +void ToolBox::InsertItem( const ResId& rResId, sal_uInt16 nPos ) { - ULONG nObjMask; - BOOL bImage = FALSE; // Wurde Image gesetzt + sal_uLong nObjMask; + sal_Bool bImage = sal_False; // Wurde Image gesetzt // Item anlegen ImplToolItem aItem; @@ -570,7 +566,7 @@ void ToolBox::InsertItem( const ResId& rResId, USHORT nPos ) nObjMask = ReadLongRes(); if ( nObjMask & RSC_TOOLBOXITEM_ID ) - aItem.mnId = sal::static_int_cast<USHORT>(ReadLongRes()); + aItem.mnId = sal::static_int_cast<sal_uInt16>(ReadLongRes()); else aItem.mnId = 1; @@ -581,7 +577,7 @@ void ToolBox::InsertItem( const ResId& rResId, USHORT nPos ) aItem.mnBits = (ToolBoxItemBits)ReadLongRes(); if( nObjMask & RSC_TOOLBOXITEM_HELPID ) - aItem.mnHelpId = ReadLongRes(); + aItem.maHelpId = ReadByteStringRes(); if ( nObjMask & RSC_TOOLBOXITEM_TEXT ) { @@ -596,22 +592,22 @@ void ToolBox::InsertItem( const ResId& rResId, USHORT nPos ) Bitmap aBmp = Bitmap( ResId( (RSHEADER_TYPE*)GetClassRes(), *rResId.GetResMgr() ) ); IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); aItem.maImage = Image( aBmp, IMAGE_STDBTN_COLOR ); - bImage = TRUE; + bImage = sal_True; } if ( nObjMask & RSC_TOOLBOXITEM_IMAGE ) { aItem.maImage = Image( ResId( (RSHEADER_TYPE*)GetClassRes(), *rResId.GetResMgr() ) ); IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); - bImage = TRUE; + bImage = sal_True; } if ( nObjMask & RSC_TOOLBOXITEM_DISABLE ) - aItem.mbEnabled = !(BOOL)ReadShortRes(); + aItem.mbEnabled = !(sal_Bool)ReadShortRes(); if ( nObjMask & RSC_TOOLBOXITEM_STATE ) aItem.meState = (TriState)ReadLongRes(); if ( nObjMask & RSC_TOOLBOXITEM_HIDE ) - aItem.mbVisible = !((BOOL)ReadShortRes()); + aItem.mbVisible = !((sal_Bool)ReadShortRes()); if ( nObjMask & RSC_TOOLBOXITEM_COMMAND ) aItem.maCommandStr = ReadStringRes(); @@ -622,15 +618,15 @@ void ToolBox::InsertItem( const ResId& rResId, USHORT nPos ) aItem.maImage = maImageList.GetImage( aItem.mnId ); // Wenn es sich um ein ButtonItem handelt, die ID ueberpruefen - BOOL bNewCalc; + sal_Bool bNewCalc; if ( aItem.meType != TOOLBOXITEM_BUTTON ) { - bNewCalc = FALSE; + bNewCalc = sal_False; aItem.mnId = 0; } else { - bNewCalc = TRUE; + bNewCalc = sal_True; DBG_ASSERT( aItem.mnId, "ToolBox::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( aItem.mnId ) == TOOLBOX_ITEM_NOTFOUND, @@ -645,14 +641,14 @@ void ToolBox::InsertItem( const ResId& rResId, USHORT nPos ) ImplInvalidate( bNewCalc ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertItem( USHORT nItemId, const Image& rImage, - ToolBoxItemBits nBits, USHORT nPos ) +void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, + ToolBoxItemBits nBits, sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, @@ -662,18 +658,18 @@ void ToolBox::InsertItem( USHORT nItemId, const Image& rImage, mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, nBits ) ); mpData->ImplClearLayoutData(); - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >(nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertItem( USHORT nItemId, const Image& rImage, +void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, const XubString& rText, - ToolBoxItemBits nBits, USHORT nPos ) + ToolBoxItemBits nBits, sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, @@ -683,17 +679,17 @@ void ToolBox::InsertItem( USHORT nItemId, const Image& rImage, mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, ImplConvertMenuString( rText ), nBits ) ); mpData->ImplClearLayoutData(); - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertItem( USHORT nItemId, const XubString& rText, - ToolBoxItemBits nBits, USHORT nPos ) +void ToolBox::InsertItem( sal_uInt16 nItemId, const XubString& rText, + ToolBoxItemBits nBits, sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, @@ -703,17 +699,17 @@ void ToolBox::InsertItem( USHORT nItemId, const XubString& rText, mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, ImplConvertMenuString( rText ), nBits ) ); mpData->ImplClearLayoutData(); - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertWindow( USHORT nItemId, Window* pWindow, - ToolBoxItemBits nBits, USHORT nPos ) +void ToolBox::InsertWindow( sal_uInt16 nItemId, Window* pWindow, + ToolBoxItemBits nBits, sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "ToolBox::InsertWindow(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, @@ -731,80 +727,80 @@ void ToolBox::InsertWindow( USHORT nItemId, Window* pWindow, if ( pWindow ) pWindow->Hide(); - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertSpace( USHORT nPos ) +void ToolBox::InsertSpace( sal_uInt16 nPos ) { // Item anlegen und in die Liste einfuegen ImplToolItem aItem; aItem.meType = TOOLBOXITEM_SPACE; - aItem.mbEnabled = FALSE; + aItem.mbEnabled = sal_False; mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), aItem ); mpData->ImplClearLayoutData(); - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertSeparator( USHORT nPos, USHORT nPixSize ) +void ToolBox::InsertSeparator( sal_uInt16 nPos, sal_uInt16 nPixSize ) { // Item anlegen und in die Liste einfuegen ImplToolItem aItem; aItem.meType = TOOLBOXITEM_SEPARATOR; - aItem.mbEnabled = FALSE; + aItem.mbEnabled = sal_False; if ( nPixSize ) aItem.mnSepSize = nPixSize; mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), aItem ); mpData->ImplClearLayoutData(); - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertBreak( USHORT nPos ) +void ToolBox::InsertBreak( sal_uInt16 nPos ) { // Item anlegen und in die Liste einfuegen ImplToolItem aItem; aItem.meType = TOOLBOXITEM_BREAK; - aItem.mbEnabled = FALSE; + aItem.mbEnabled = sal_False; mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), aItem ); mpData->ImplClearLayoutData(); - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::RemoveItem( USHORT nPos ) +void ToolBox::RemoveItem( sal_uInt16 nPos ) { if( nPos < mpData->m_aItems.size() ) { - BOOL bMustCalc; + sal_Bool bMustCalc; if ( mpData->m_aItems[nPos].meType == TOOLBOXITEM_BUTTON ) - bMustCalc = TRUE; + bMustCalc = sal_True; else - bMustCalc = FALSE; + bMustCalc = sal_False; if ( mpData->m_aItems[nPos].mpWindow ) mpData->m_aItems[nPos].mpWindow->Hide(); @@ -830,9 +826,9 @@ void ToolBox::RemoveItem( USHORT nPos ) // ----------------------------------------------------------------------- -void ToolBox::MoveItem( USHORT nItemId, USHORT nNewPos ) +void ToolBox::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos == nNewPos ) return; @@ -850,14 +846,14 @@ void ToolBox::MoveItem( USHORT nItemId, USHORT nNewPos ) mpData->ImplClearLayoutData(); // ToolBox neu ausgeben - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); // Notify if( nPos < nNewPos ) // only send one event, all indices above this item are invalid anyway ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMREMOVED, reinterpret_cast< void* >( nPos ) ); else { - USHORT nNewPos2 = sal::static_int_cast<USHORT>(( nNewPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nNewPos); + sal_uInt16 nNewPos2 = sal::static_int_cast<sal_uInt16>(( nNewPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nNewPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos2 ) ); } } @@ -865,13 +861,13 @@ void ToolBox::MoveItem( USHORT nItemId, USHORT nNewPos ) // ----------------------------------------------------------------------- -void ToolBox::CopyItem( const ToolBox& rToolBox, USHORT nItemId, - USHORT nNewPos ) +void ToolBox::CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, + sal_uInt16 nNewPos ) { DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, "ToolBox::CopyItem(): ItemId already exists" ); - USHORT nPos = rToolBox.GetItemPos( nItemId ); + sal_uInt16 nPos = rToolBox.GetItemPos( nItemId ); // Existiert Item if ( nPos != TOOLBOX_ITEM_NOTFOUND ) @@ -880,15 +876,15 @@ void ToolBox::CopyItem( const ToolBox& rToolBox, USHORT nItemId, ImplToolItem aNewItem = rToolBox.mpData->m_aItems[nPos]; // Bestimme Daten zuruecksetzen aNewItem.mpWindow = NULL; - aNewItem.mbShowWindow = FALSE; + aNewItem.mbShowWindow = sal_False; mpData->m_aItems.insert( (nNewPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nNewPos : mpData->m_aItems.end(), aNewItem ); mpData->ImplClearLayoutData(); // ToolBox neu ausgeben - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); // Notify - USHORT nNewPos2 = sal::static_int_cast<USHORT>(( nNewPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nNewPos); + sal_uInt16 nNewPos2 = sal::static_int_cast<sal_uInt16>(( nNewPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nNewPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos2 ) ); } } @@ -907,10 +903,10 @@ void ToolBox::CopyItems( const ToolBox& rToolBox ) it != mpData->m_aItems.end(); ++it ) { it->mpWindow = NULL; - it->mbShowWindow = FALSE; + it->mbShowWindow = sal_False; } - ImplInvalidate( TRUE, TRUE ); + ImplInvalidate( sal_True, sal_True ); // Notify ImplCallEventListeners( VCLEVENT_TOOLBOX_ALLITEMSCHANGED ); @@ -927,7 +923,7 @@ void ToolBox::Clear() mnCurItemId = 0; mnHighItemId = 0; - ImplInvalidate( TRUE, TRUE ); + ImplInvalidate( sal_True, sal_True ); // Notify ImplCallEventListeners( VCLEVENT_TOOLBOX_ALLITEMSCHANGED ); @@ -943,7 +939,7 @@ void ToolBox::SetButtonType( ButtonType eNewType ) // Hier besser alles neu ausgeben, da es ansonsten zu Problemen // mit den per CopyBits kopierten Bereichen geben kann - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); } } @@ -954,8 +950,8 @@ void ToolBox::SetToolboxButtonSize( ToolBoxButtonSize eSize ) if( mpData->meButtonSize != eSize ) { mpData->meButtonSize = eSize; - mbCalc = TRUE; - mbFormat = TRUE; + mbCalc = sal_True; + mbFormat = sal_True; } } @@ -970,10 +966,10 @@ const Size& ToolBox::GetDefaultImageSize() const { static Size aSmallButtonSize( TB_SMALLIMAGESIZE, TB_SMALLIMAGESIZE ); - static ULONG s_nSymbolsStyle = STYLE_SYMBOLS_DEFAULT; + static sal_uLong s_nSymbolsStyle = STYLE_SYMBOLS_DEFAULT; static Size aLargeButtonSize( TB_LARGEIMAGESIZE, TB_LARGEIMAGESIZE ); - ULONG nSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyle(); + sal_uLong nSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyle(); if ( s_nSymbolsStyle != nSymbolsStyle ) { s_nSymbolsStyle = nSymbolsStyle; @@ -1008,13 +1004,13 @@ void ToolBox::SetAlign( WindowAlign eNewAlign ) { // Setzen, ob Items horizontal oder vertikal angeordnet werden sollen if ( (eNewAlign == WINDOWALIGN_LEFT) || (eNewAlign == WINDOWALIGN_RIGHT) ) - mbHorz = FALSE; + mbHorz = sal_False; else - mbHorz = TRUE; + mbHorz = sal_True; // Hier alles neu ausgeben, da sich Border auch aendert - mbCalc = TRUE; - mbFormat = TRUE; + mbCalc = sal_True; + mbFormat = sal_True; if ( IsReallyVisible() && IsUpdateMode() ) Invalidate(); } @@ -1023,7 +1019,7 @@ void ToolBox::SetAlign( WindowAlign eNewAlign ) // ----------------------------------------------------------------------- -void ToolBox::SetLineCount( USHORT nNewLines ) +void ToolBox::SetLineCount( sal_uInt16 nNewLines ) { if ( !nNewLines ) nNewLines = 1; @@ -1034,18 +1030,18 @@ void ToolBox::SetLineCount( USHORT nNewLines ) // Hier besser alles neu ausgeben, da es ansonsten zu Problemen // mit den per CopyBits kopierten Bereichen geben kann - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); } } // ----------------------------------------------------------------------- -void ToolBox::SetPageScroll( BOOL b ) +void ToolBox::SetPageScroll( sal_Bool b ) { mpData->mbPageScroll = b; } -BOOL ToolBox::GetPageScroll() +sal_Bool ToolBox::GetPageScroll() { return mpData->mbPageScroll; } @@ -1054,45 +1050,45 @@ BOOL ToolBox::GetPageScroll() void ToolBox::SetNextToolBox( const XubString& rStr ) { - BOOL bCalcNew = (!maNextToolBoxStr.Len() != !rStr.Len()); + sal_Bool bCalcNew = (!maNextToolBoxStr.Len() != !rStr.Len()); maNextToolBoxStr = rStr; if ( bCalcNew ) - ImplInvalidate( TRUE, FALSE ); + ImplInvalidate( sal_True, sal_False ); } // ----------------------------------------------------------------------- -USHORT ToolBox::GetItemCount() const +sal_uInt16 ToolBox::GetItemCount() const { - return (USHORT)mpData->m_aItems.size(); + return (sal_uInt16)mpData->m_aItems.size(); } // ----------------------------------------------------------------------- -ToolBoxItemType ToolBox::GetItemType( USHORT nPos ) const +ToolBoxItemType ToolBox::GetItemType( sal_uInt16 nPos ) const { return (nPos < mpData->m_aItems.size()) ? mpData->m_aItems[nPos].meType : TOOLBOXITEM_DONTKNOW; } // ----------------------------------------------------------------------- -USHORT ToolBox::GetItemPos( USHORT nItemId ) const +sal_uInt16 ToolBox::GetItemPos( sal_uInt16 nItemId ) const { int nCount = mpData->m_aItems.size(); for( int nPos = 0; nPos < nCount; nPos++ ) if( mpData->m_aItems[nPos].mnId == nItemId ) - return (USHORT)nPos; + return (sal_uInt16)nPos; return TOOLBOX_ITEM_NOTFOUND; } // ----------------------------------------------------------------------- -USHORT ToolBox::GetItemPos( const Point& rPos ) const +sal_uInt16 ToolBox::GetItemPos( const Point& rPos ) const { // search the item position on the given point - USHORT nRet = TOOLBOX_ITEM_NOTFOUND; - USHORT nPos = 0; + sal_uInt16 nRet = TOOLBOX_ITEM_NOTFOUND; + sal_uInt16 nPos = 0; std::vector< ImplToolItem >::const_iterator it = mpData->m_aItems.begin(); while( it != mpData->m_aItems.end() ) { @@ -1112,14 +1108,14 @@ USHORT ToolBox::GetItemPos( const Point& rPos ) const // ----------------------------------------------------------------------- -USHORT ToolBox::GetItemId( USHORT nPos ) const +sal_uInt16 ToolBox::GetItemId( sal_uInt16 nPos ) const { return (nPos < mpData->m_aItems.size()) ? mpData->m_aItems[nPos].mnId : 0; } // ----------------------------------------------------------------------- -USHORT ToolBox::GetItemId( const Point& rPos ) const +sal_uInt16 ToolBox::GetItemId( const Point& rPos ) const { // Item suchen, das geklickt wurde std::vector< ImplToolItem >::const_iterator it = mpData->m_aItems.begin(); @@ -1197,25 +1193,25 @@ Point ToolBox::ImplGetPopupPosition( const Rectangle& rRect, const Size& rSize ) } -Point ToolBox::GetItemPopupPosition( USHORT nItemId, const Size& rSize ) const +Point ToolBox::GetItemPopupPosition( sal_uInt16 nItemId, const Size& rSize ) const { return ImplGetPopupPosition( GetItemRect( nItemId ), rSize ); } // ----------------------------------------------------------------------- -Rectangle ToolBox::GetItemRect( USHORT nItemId ) const +Rectangle ToolBox::GetItemRect( sal_uInt16 nItemId ) const { if ( mbCalc || mbFormat ) ((ToolBox*)this)->ImplFormat(); - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); return GetItemPosRect( nPos ); } // ----------------------------------------------------------------------- -Rectangle ToolBox::GetItemPosRect( USHORT nPos ) const +Rectangle ToolBox::GetItemPosRect( sal_uInt16 nPos ) const { if ( mbCalc || mbFormat ) ((ToolBox*)this)->ImplFormat(); @@ -1227,18 +1223,18 @@ Rectangle ToolBox::GetItemPosRect( USHORT nPos ) const } // ----------------------------------------------------------------------- -Rectangle ToolBox::GetItemDropDownRect( USHORT nItemId ) const +Rectangle ToolBox::GetItemDropDownRect( sal_uInt16 nItemId ) const { if ( mbCalc || mbFormat ) ((ToolBox*)this)->ImplFormat(); - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); return GetItemPosDropDownRect( nPos ); } // ----------------------------------------------------------------------- -Rectangle ToolBox::GetItemPosDropDownRect( USHORT nPos ) const +Rectangle ToolBox::GetItemPosDropDownRect( sal_uInt16 nPos ) const { if ( mbCalc || mbFormat ) ((ToolBox*)this)->ImplFormat(); @@ -1256,24 +1252,24 @@ Rectangle ToolBox::GetMenubuttonRect() const return mpData->maMenubuttonItem.maRect; } -BOOL ToolBox::ImplHasExternalMenubutton() +sal_Bool ToolBox::ImplHasExternalMenubutton() { // check if the borderwindow (i.e. the decoration) provides the menu button - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( ImplIsFloatingMode() ) { // custom menu is placed in the decoration ImplBorderWindow *pBorderWin = dynamic_cast<ImplBorderWindow*>( GetWindow( WINDOW_BORDER ) ); if( pBorderWin && !pBorderWin->GetMenuRect().IsEmpty() ) - bRet = TRUE; + bRet = sal_True; } return bRet; } // ----------------------------------------------------------------------- -void ToolBox::SetItemBits( USHORT nItemId, ToolBoxItemBits nBits ) +void ToolBox::SetItemBits( sal_uInt16 nItemId, ToolBoxItemBits nBits ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos < mpData->m_aItems.size() ) { @@ -1282,15 +1278,15 @@ void ToolBox::SetItemBits( USHORT nItemId, ToolBoxItemBits nBits ) nBits &= TIB_LEFT | TIB_AUTOSIZE | TIB_DROPDOWN; nOldBits &= TIB_LEFT | TIB_AUTOSIZE | TIB_DROPDOWN; // trigger reformat when the item width has changed (dropdown arrow) - BOOL bFormat = (nBits & TIB_DROPDOWN) != (nOldBits & TIB_DROPDOWN); + sal_Bool bFormat = (nBits & TIB_DROPDOWN) != (nOldBits & TIB_DROPDOWN); if ( nBits != nOldBits ) - ImplInvalidate( TRUE, bFormat ); + ImplInvalidate( sal_True, bFormat ); } } // ----------------------------------------------------------------------- -ToolBoxItemBits ToolBox::GetItemBits( USHORT nItemId ) const +ToolBoxItemBits ToolBox::GetItemBits( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1302,9 +1298,9 @@ ToolBoxItemBits ToolBox::GetItemBits( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetItemData( USHORT nItemId, void* pNewData ) +void ToolBox::SetItemData( sal_uInt16 nItemId, void* pNewData ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos < mpData->m_aItems.size() ) { @@ -1315,7 +1311,7 @@ void ToolBox::SetItemData( USHORT nItemId, void* pNewData ) // ----------------------------------------------------------------------- -void* ToolBox::GetItemData( USHORT nItemId ) const +void* ToolBox::GetItemData( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1327,9 +1323,9 @@ void* ToolBox::GetItemData( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetItemImage( USHORT nItemId, const Image& rImage ) +void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1340,7 +1336,7 @@ void ToolBox::SetItemImage( USHORT nItemId, const Image& rImage ) Size aOldSize = pItem->maImage.GetSizePixel(); pItem->maImage = rImage; if ( aOldSize != pItem->maImage.GetSizePixel() ) - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); else ImplUpdateItem( nPos ); } @@ -1355,8 +1351,8 @@ void ToolBox::SetImageList( const ImageList& rImageList ) { maImageList = rImageList; - USHORT nCount = (USHORT)mpData->m_aItems.size(); - for( USHORT i = 0; i < nCount; i++ ) + sal_uInt16 nCount = (sal_uInt16)mpData->m_aItems.size(); + for( sal_uInt16 i = 0; i < nCount; i++ ) { Image aImage; if ( mpData->m_aItems[i].mnId ) @@ -1378,9 +1374,9 @@ static Image ImplRotImage( const Image& rImage, long nAngle10 ) return Image( aRotBitmapEx ); } -void ToolBox::SetItemImageAngle( USHORT nItemId, long nAngle10 ) +void ToolBox::SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1402,7 +1398,7 @@ void ToolBox::SetItemImageAngle( USHORT nItemId, long nAngle10 ) if ( !mbCalc ) { if ( aOldSize != pItem->maImage.GetSizePixel() ) - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); else ImplUpdateItem( nPos ); } @@ -1421,9 +1417,9 @@ static Image ImplMirrorImage( const Image& rImage ) return Image( aMirrBitmapEx ); } -void ToolBox::SetItemImageMirrorMode( USHORT nItemId, BOOL bMirror ) +void ToolBox::SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1449,7 +1445,7 @@ void ToolBox::SetItemImageMirrorMode( USHORT nItemId, BOOL bMirror ) // ----------------------------------------------------------------------- -Image ToolBox::GetItemImage( USHORT nItemId ) const +Image ToolBox::GetItemImage( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1461,7 +1457,7 @@ Image ToolBox::GetItemImage( USHORT nItemId ) const // ----------------------------------------------------------------------- -long ToolBox::GetItemImageAngle( USHORT nItemId ) const +long ToolBox::GetItemImageAngle( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1473,32 +1469,32 @@ long ToolBox::GetItemImageAngle( USHORT nItemId ) const // ----------------------------------------------------------------------- -BOOL ToolBox::GetItemImageMirrorMode( USHORT nItemId ) const +sal_Bool ToolBox::GetItemImageMirrorMode( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) return pItem->mbMirrorMode; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void ToolBox::SetItemHighImage( USHORT nItemId, const Image& rImage ) +void ToolBox::SetItemHighImage( sal_uInt16 nItemId, const Image& rImage ) { ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) { DBG_ASSERT( (pItem->maImage.GetSizePixel() == rImage.GetSizePixel()) || - ((!rImage) == TRUE), "ToolBox::SetItemHighImage() - ImageSize != HighImageSize" ); + ((!rImage) == sal_True), "ToolBox::SetItemHighImage() - ImageSize != HighImageSize" ); pItem->maHighImage = rImage; } } // ----------------------------------------------------------------------- -Image ToolBox::GetItemHighImage( USHORT nItemId ) const +Image ToolBox::GetItemHighImage( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1510,9 +1506,9 @@ Image ToolBox::GetItemHighImage( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetItemText( USHORT nItemId, const XubString& rText ) +void ToolBox::SetItemText( sal_uInt16 nItemId, const XubString& rText ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1525,7 +1521,7 @@ void ToolBox::SetItemText( USHORT nItemId, const XubString& rText ) pItem->maText = ImplConvertMenuString( rText ); mpData->ImplClearLayoutData(); if ( nOldWidth != GetCtrlTextWidth( pItem->maText ) ) - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); else ImplUpdateItem( nPos ); } @@ -1542,7 +1538,7 @@ void ToolBox::SetItemText( USHORT nItemId, const XubString& rText ) // ----------------------------------------------------------------------- -const XubString& ToolBox::GetItemText( USHORT nItemId ) const +const XubString& ToolBox::GetItemText( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1554,9 +1550,9 @@ const XubString& ToolBox::GetItemText( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetItemWindow( USHORT nItemId, Window* pNewWindow ) +void ToolBox::SetItemWindow( sal_uInt16 nItemId, Window* pNewWindow ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1564,14 +1560,14 @@ void ToolBox::SetItemWindow( USHORT nItemId, Window* pNewWindow ) pItem->mpWindow = pNewWindow; if ( pNewWindow ) pNewWindow->Hide(); - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED, reinterpret_cast< void* >( nPos ) ); } } // ----------------------------------------------------------------------- -Window* ToolBox::GetItemWindow( USHORT nItemId ) const +Window* ToolBox::GetItemWindow( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1590,7 +1586,7 @@ void ToolBox::StartSelection() if ( !mbSelection ) { - mbSelection = TRUE; + mbSelection = sal_True; mnCurPos = TOOLBOX_ITEM_NOTFOUND; mnCurItemId = 0; Activate(); @@ -1601,13 +1597,13 @@ void ToolBox::StartSelection() void ToolBox::EndSelection() { - mbCommandDrag = FALSE; + mbCommandDrag = sal_False; if ( mbDrag || mbSelection ) { // Daten zuruecksetzen - mbDrag = FALSE; - mbSelection = FALSE; + mbDrag = sal_False; + mbSelection = sal_False; if ( mnCurPos != TOOLBOX_ITEM_NOTFOUND ) ImplDrawItem( mnCurPos ); EndTracking(); @@ -1624,9 +1620,9 @@ void ToolBox::EndSelection() // ----------------------------------------------------------------------- -void ToolBox::SetItemDown( USHORT nItemId, BOOL bDown, BOOL bRelease ) +void ToolBox::SetItemDown( sal_uInt16 nItemId, sal_Bool bDown, sal_Bool bRelease ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1635,7 +1631,7 @@ void ToolBox::SetItemDown( USHORT nItemId, BOOL bDown, BOOL bRelease ) if ( nPos != mnCurPos ) { mnCurPos = nPos; - ImplDrawItem( mnCurPos, TRUE ); + ImplDrawItem( mnCurPos, sal_True ); Flush(); } } @@ -1643,7 +1639,7 @@ void ToolBox::SetItemDown( USHORT nItemId, BOOL bDown, BOOL bRelease ) { if ( nPos == mnCurPos ) { - ImplDrawItem( mnCurPos, FALSE ); + ImplDrawItem( mnCurPos, sal_False ); Flush(); mnCurPos = TOOLBOX_ITEM_NOTFOUND; } @@ -1653,8 +1649,8 @@ void ToolBox::SetItemDown( USHORT nItemId, BOOL bDown, BOOL bRelease ) { if ( mbDrag || mbSelection ) { - mbDrag = FALSE; - mbSelection = FALSE; + mbDrag = sal_False; + mbSelection = sal_False; EndTracking(); ReleaseMouse(); Deactivate(); @@ -1670,21 +1666,21 @@ void ToolBox::SetItemDown( USHORT nItemId, BOOL bDown, BOOL bRelease ) // ----------------------------------------------------------------------- -BOOL ToolBox::IsItemDown( USHORT nItemId ) const +sal_Bool ToolBox::IsItemDown( sal_uInt16 nItemId ) const { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) return (nPos == mnCurPos); else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void ToolBox::SetItemState( USHORT nItemId, TriState eState ) +void ToolBox::SetItemState( sal_uInt16 nItemId, TriState eState ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1698,8 +1694,8 @@ void ToolBox::SetItemState( USHORT nItemId, TriState eState ) (pItem->mnBits & TIB_RADIOCHECK) ) { ImplToolItem* pGroupItem; - USHORT nGroupPos; - USHORT nItemCount = GetItemCount(); + sal_uInt16 nGroupPos; + sal_uInt16 nItemCount = GetItemCount(); nGroupPos = nPos; while ( nGroupPos ) @@ -1744,7 +1740,7 @@ void ToolBox::SetItemState( USHORT nItemId, TriState eState ) // ----------------------------------------------------------------------- -TriState ToolBox::GetItemState( USHORT nItemId ) const +TriState ToolBox::GetItemState( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1756,15 +1752,15 @@ TriState ToolBox::GetItemState( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::EnableItem( USHORT nItemId, BOOL bEnable ) +void ToolBox::EnableItem( sal_uInt16 nItemId, sal_Bool bEnable ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { ImplToolItem* pItem = &mpData->m_aItems[nPos]; if ( bEnable ) - bEnable = TRUE; + bEnable = sal_True; if ( pItem->mbEnabled != bEnable ) { pItem->mbEnabled = bEnable; @@ -1788,21 +1784,21 @@ void ToolBox::EnableItem( USHORT nItemId, BOOL bEnable ) // ----------------------------------------------------------------------- -BOOL ToolBox::IsItemEnabled( USHORT nItemId ) const +sal_Bool ToolBox::IsItemEnabled( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) return pItem->mbEnabled; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void ToolBox::ShowItem( USHORT nItemId, BOOL bVisible ) +void ToolBox::ShowItem( sal_uInt16 nItemId, sal_Bool bVisible ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); mpData->ImplClearLayoutData(); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) @@ -1811,36 +1807,36 @@ void ToolBox::ShowItem( USHORT nItemId, BOOL bVisible ) if ( pItem->mbVisible != bVisible ) { pItem->mbVisible = bVisible; - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); } } } // ----------------------------------------------------------------------- -BOOL ToolBox::IsItemVisible( USHORT nItemId ) const +sal_Bool ToolBox::IsItemVisible( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) return pItem->mbVisible; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL ToolBox::IsItemReallyVisible( USHORT nItemId ) const +sal_Bool ToolBox::IsItemReallyVisible( sal_uInt16 nItemId ) const { // is the item on the visible area of the toolbox? - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; Rectangle aRect( mnLeftBorder, mnTopBorder, mnDX-mnRightBorder, mnDY-mnBottomBorder ); ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem && pItem->mbVisible && !pItem->maRect.IsEmpty() && aRect.IsOver( pItem->maRect ) ) { - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -1848,7 +1844,7 @@ BOOL ToolBox::IsItemReallyVisible( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetItemCommand( USHORT nItemId, const XubString& rCommand ) +void ToolBox::SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand ) { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1858,7 +1854,7 @@ void ToolBox::SetItemCommand( USHORT nItemId, const XubString& rCommand ) // ----------------------------------------------------------------------- -const XubString& ToolBox::GetItemCommand( USHORT nItemId ) const +const XubString& ToolBox::GetItemCommand( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1870,7 +1866,7 @@ const XubString& ToolBox::GetItemCommand( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetQuickHelpText( USHORT nItemId, const XubString& rText ) +void ToolBox::SetQuickHelpText( sal_uInt16 nItemId, const XubString& rText ) { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1880,7 +1876,7 @@ void ToolBox::SetQuickHelpText( USHORT nItemId, const XubString& rText ) // ----------------------------------------------------------------------- -const XubString& ToolBox::GetQuickHelpText( USHORT nItemId ) const +const XubString& ToolBox::GetQuickHelpText( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1892,7 +1888,7 @@ const XubString& ToolBox::GetQuickHelpText( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetHelpText( USHORT nItemId, const XubString& rText ) +void ToolBox::SetHelpText( sal_uInt16 nItemId, const XubString& rText ) { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1902,31 +1898,38 @@ void ToolBox::SetHelpText( USHORT nItemId, const XubString& rText ) // ----------------------------------------------------------------------- -const XubString& ToolBox::GetHelpText( USHORT nItemId ) const +const XubString& ToolBox::GetHelpText( sal_uInt16 nItemId ) const { return ImplGetHelpText( nItemId ); } // ----------------------------------------------------------------------- -void ToolBox::SetHelpId( USHORT nItemId, ULONG nHelpId ) +void ToolBox::SetHelpId( sal_uInt16 nItemId, const rtl::OString& rHelpId ) { ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) - pItem->mnHelpId = nHelpId; + pItem->maHelpId = rHelpId; } // ----------------------------------------------------------------------- -ULONG ToolBox::GetHelpId( USHORT nItemId ) const +rtl::OString ToolBox::GetHelpId( sal_uInt16 nItemId ) const { + rtl::OString aRet; + ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) - return pItem->mnHelpId; - else - return 0; + { + if ( pItem->maHelpId.getLength() ) + aRet = pItem->maHelpId; + else + aRet = ::rtl::OUStringToOString( pItem->maCommandStr, RTL_TEXTENCODING_UTF8 ); + } + + return aRet; } // ----------------------------------------------------------------------- @@ -1936,12 +1939,12 @@ void ToolBox::SetBorder( long nX, long nY ) mnBorderX = nX; mnBorderY = nY; - ImplInvalidate( TRUE, TRUE ); + ImplInvalidate( sal_True, sal_True ); } // ----------------------------------------------------------------------- -void ToolBox::SetOutStyle( USHORT nNewStyle ) +void ToolBox::SetOutStyle( sal_uInt16 nNewStyle ) { // always force flat looking toolbars since NWF nNewStyle |= TOOLBOX_STYLE_FLAT; @@ -1958,7 +1961,7 @@ void ToolBox::SetOutStyle( USHORT nNewStyle ) mnMaxItemHeight = 1; } - ImplInvalidate( TRUE, TRUE ); + ImplInvalidate( sal_True, sal_True ); } } @@ -1966,7 +1969,7 @@ void ToolBox::SetOutStyle( USHORT nNewStyle ) void ToolBox::RecalcItems() { - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); } // ----------------------------------------------------------------------- @@ -1981,11 +1984,11 @@ void ToolBox::ImplUpdateInputEnable() if( it->mbEnabled ) { // at least one useful entry - mpData->mbKeyInputDisabled = FALSE; + mpData->mbKeyInputDisabled = sal_False; return; } } - mpData->mbKeyInputDisabled = TRUE; + mpData->mbKeyInputDisabled = sal_True; } // ----------------------------------------------------------------------- @@ -1994,14 +1997,14 @@ void ToolBox::ImplFillLayoutData() const { mpData->m_pLayoutData = new ToolBoxLayoutData(); - USHORT nCount = (USHORT)mpData->m_aItems.size(); - for( USHORT i = 0; i < nCount; i++ ) + sal_uInt16 nCount = (sal_uInt16)mpData->m_aItems.size(); + for( sal_uInt16 i = 0; i < nCount; i++ ) { ImplToolItem* pItem = &mpData->m_aItems[i]; // Nur malen, wenn Rechteck im PaintRectangle liegt if ( !pItem->maRect.IsEmpty() ) - const_cast<ToolBox*>(this)->ImplDrawItem( i, FALSE, FALSE, TRUE ); + const_cast<ToolBox*>(this)->ImplDrawItem( i, sal_False, sal_False, sal_True ); } } @@ -2016,14 +2019,14 @@ String ToolBox::GetDisplayText() const // ----------------------------------------------------------------------- -Rectangle ToolBox::GetCharacterBounds( USHORT nItemID, long nIndex ) const +Rectangle ToolBox::GetCharacterBounds( sal_uInt16 nItemID, long nIndex ) const { long nItemIndex = -1; if( ! mpData->m_pLayoutData ) ImplFillLayoutData(); if( mpData->m_pLayoutData ) { - for( ULONG i = 0; i < mpData->m_pLayoutData->m_aLineItemIds.size(); i++ ) + for( sal_uLong i = 0; i < mpData->m_pLayoutData->m_aLineItemIds.size(); i++ ) { if( mpData->m_pLayoutData->m_aLineItemIds[i] == nItemID ) { @@ -2037,7 +2040,7 @@ Rectangle ToolBox::GetCharacterBounds( USHORT nItemID, long nIndex ) const // ----------------------------------------------------------------------- -long ToolBox::GetIndexForPoint( const Point& rPoint, USHORT& rItemID ) const +long ToolBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const { long nIndex = -1; rItemID = 0; @@ -2046,7 +2049,7 @@ long ToolBox::GetIndexForPoint( const Point& rPoint, USHORT& rItemID ) const if( mpData->m_pLayoutData ) { nIndex = mpData->m_pLayoutData->GetIndexForPoint( rPoint ); - for( ULONG i = 0; i < mpData->m_pLayoutData->m_aLineIndices.size(); i++ ) + for( sal_uLong i = 0; i < mpData->m_pLayoutData->m_aLineIndices.size(); i++ ) { if( mpData->m_pLayoutData->m_aLineIndices[i] <= nIndex && (i == mpData->m_pLayoutData->m_aLineIndices.size()-1 || mpData->m_pLayoutData->m_aLineIndices[i+1] > nIndex) ) @@ -2079,12 +2082,12 @@ Pair ToolBox::GetTextStartEnd( long nText ) const // ----------------------------------------------------------------------- -USHORT ToolBox::GetDisplayItemId( long nText ) const +sal_uInt16 ToolBox::GetDisplayItemId( long nText ) const { - USHORT nItemId = 0; + sal_uInt16 nItemId = 0; if( ! mpData->m_pLayoutData ) ImplFillLayoutData(); - if( mpData->m_pLayoutData && nText >= 0 && (ULONG)nText < mpData->m_pLayoutData->m_aLineItemIds.size() ) + if( mpData->m_pLayoutData && nText >= 0 && (sal_uLong)nText < mpData->m_pLayoutData->m_aLineItemIds.size() ) nItemId = mpData->m_pLayoutData->m_aLineItemIds[nText]; return nItemId; } @@ -2104,7 +2107,7 @@ const Link& ToolBox::GetDropdownClickHdl() const // ----------------------------------------------------------------------- -void ToolBox::SetMenuType( USHORT aType ) +void ToolBox::SetMenuType( sal_uInt16 aType ) { if( aType != mpData->maMenuType ) { @@ -2114,9 +2117,9 @@ void ToolBox::SetMenuType( USHORT aType ) // the menu button may have to be moved into the decoration which changes the layout ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); if( pWrapper ) - pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( aType & TOOLBOX_MENUTYPE_CUSTOMIZE) ? TRUE : FALSE ); + pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( aType & TOOLBOX_MENUTYPE_CUSTOMIZE) ? sal_True : sal_False ); - mbFormat = TRUE; + mbFormat = sal_True; ImplFormat(); ImplSetMinMaxFloatSize( this ); } @@ -2129,12 +2132,12 @@ void ToolBox::SetMenuType( USHORT aType ) } } -USHORT ToolBox::GetMenuType() const +sal_uInt16 ToolBox::GetMenuType() const { return mpData->maMenuType; } -BOOL ToolBox::IsMenuEnabled() const +sal_Bool ToolBox::IsMenuEnabled() const { return mpData->maMenuType != TOOLBOX_MENUTYPE_NONE; } @@ -2156,7 +2159,7 @@ const Link& ToolBox::GetMenuButtonHdl() const // ----------------------------------------------------------------------- -BOOL ToolBox::ImplHasClippedItems() +sal_Bool ToolBox::ImplHasClippedItems() { // are any items currently clipped ? ImplFormat(); @@ -2164,10 +2167,10 @@ BOOL ToolBox::ImplHasClippedItems() while ( it != mpData->m_aItems.end() ) { if( it->IsClipped() ) - return TRUE; + return sal_True; ++it; } - return FALSE; + return sal_False; } void ToolBox::ImplUpdateCustomMenu() @@ -2178,7 +2181,7 @@ void ToolBox::ImplUpdateCustomMenu() PopupMenu *pMenu = GetMenu(); - USHORT i = 0; + sal_uInt16 i = 0; // remove old entries while( i < pMenu->GetItemCount() ) { @@ -2199,7 +2202,7 @@ void ToolBox::ImplUpdateCustomMenu() { if( it->IsClipped() ) { - USHORT id = it->mnId + TOOLBOX_MENUITEM_START; + sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START; pMenu->InsertItem( id, it->maText, it->maImage, 0, 0 ); pMenu->EnableItem( id, it->mbEnabled ); pMenu->CheckItem( id, it->meState == STATE_CHECK ); @@ -2212,9 +2215,9 @@ IMPL_LINK( ToolBox, ImplCustomMenuListener, VclMenuEvent*, pEvent ) { if( pEvent->GetMenu() == GetMenu() && pEvent->GetId() == VCLEVENT_MENU_SELECT ) { - USHORT id = GetMenu()->GetItemId( pEvent->GetItemPos() ); + sal_uInt16 id = GetMenu()->GetItemId( pEvent->GetItemPos() ); if( id >= TOOLBOX_MENUITEM_START ) - TriggerItem( id - TOOLBOX_MENUITEM_START, FALSE, FALSE ); + TriggerItem( id - TOOLBOX_MENUITEM_START, sal_False, sal_False ); } return 0; } @@ -2262,7 +2265,7 @@ void ToolBox::ImplExecuteCustomMenu() } } - USHORT uId = GetMenu()->Execute( pWin, Rectangle( ImplGetPopupPosition( aMenuRect, Size() ), Size() ), + sal_uInt16 uId = GetMenu()->Execute( pWin, Rectangle( ImplGetPopupPosition( aMenuRect, Size() ), Size() ), POPUPMENU_EXECUTE_DOWN | POPUPMENU_NOMOUSEUPCLOSE ); if ( aDelData.IsDelete() ) @@ -2299,24 +2302,24 @@ void ToolBox::ExecuteCustomMenu() // ----------------------------------------------------------------------- // checks override first, useful during calculation of sizes -BOOL ToolBox::ImplIsFloatingMode() const +sal_Bool ToolBox::ImplIsFloatingMode() const { DBG_ASSERT( !(mpData->mbAssumeDocked && mpData->mbAssumeFloating), "ToolBox::ImplIsFloatingMode(): cannot assume docked and floating" ); if( mpData->mbAssumeDocked ) - return FALSE; + return sal_False; else if( mpData->mbAssumeFloating ) - return TRUE; + return sal_True; else return IsFloatingMode(); } // checks override first, useful during calculation of sizes -BOOL ToolBox::ImplIsInPopupMode() const +sal_Bool ToolBox::ImplIsInPopupMode() const { if( mpData->mbAssumePopupMode ) - return TRUE; + return sal_True; else { ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); @@ -2326,7 +2329,7 @@ BOOL ToolBox::ImplIsInPopupMode() const // ----------------------------------------------------------------------- -void ToolBox::Lock( BOOL bLock ) +void ToolBox::Lock( sal_Bool bLock ) { ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); if( !pWrapper ) @@ -2336,8 +2339,8 @@ void ToolBox::Lock( BOOL bLock ) mpData->mbIsLocked = bLock; if( !ImplIsFloatingMode() ) { - mbCalc = TRUE; - mbFormat = TRUE; + mbCalc = sal_True; + mbFormat = sal_True; SetSizePixel( CalcWindowSizePixel(1) ); Invalidate(); } @@ -2346,7 +2349,7 @@ void ToolBox::Lock( BOOL bLock ) // ----------------------------------------------------------------------- -BOOL ToolBox::AlwaysLocked() +sal_Bool ToolBox::AlwaysLocked() { // read config item to determine toolbox behaviour, used for subtoolbars @@ -2362,35 +2365,35 @@ BOOL ToolBox::AlwaysLocked() if ( aNode.isValid() ) { // feature enabled ? - BOOL bStatesEnabled = BOOL(); + sal_Bool bStatesEnabled = sal_Bool(); ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("StatesEnabled")) ); if( aValue >>= bStatesEnabled ) { - if( bStatesEnabled == TRUE ) + if( bStatesEnabled == sal_True ) { // now read the locking state utl::OConfigurationNode aNode2 = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory( vcl::unohelper::GetMultiServiceFactory(), OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.UI.GlobalSettings/Toolbars/States")) ); // note: case sensisitive ! - BOOL bLocked = BOOL(); + sal_Bool bLocked = sal_Bool(); ::com::sun::star::uno::Any aValue2 = aNode2.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Locked")) ); if( aValue2 >>= bLocked ) - nAlwaysLocked = (bLocked == TRUE) ? 1 : 0; + nAlwaysLocked = (bLocked == sal_True) ? 1 : 0; } } } } - return nAlwaysLocked == 1 ? TRUE : FALSE; + return nAlwaysLocked == 1 ? sal_True : sal_False; } -BOOL ToolBox::WillUsePopupMode() const +sal_Bool ToolBox::WillUsePopupMode() const { return mpData->mbWillUsePopupMode; } -void ToolBox::WillUsePopupMode( BOOL b ) +void ToolBox::WillUsePopupMode( sal_Bool b ) { mpData->mbWillUsePopupMode = b; } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 62607d238367..f8a182206bad 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -34,14 +34,12 @@ #include "vcl/salinst.hxx" #include "vcl/salgtype.hxx" #include "vcl/salgdi.hxx" -#include "vcl/salctrlhandle.hxx" #include "vcl/unohelp.hxx" #include "tools/time.hxx" #include "tools/debug.hxx" #include "tools/rc.h" #include "vcl/svdata.hxx" -#include "vcl/windata.hxx" #include "vcl/dbggui.hxx" #include "vcl/outfont.hxx" #include "vcl/outdev.h" @@ -65,6 +63,7 @@ #include "unotools/fontcfg.hxx" #include "vcl/sysdata.hxx" #include "vcl/sallayout.hxx" +#include "vcl/salctype.hxx" #include "vcl/button.hxx" // Button::GetStandardText #include "vcl/taskpanelist.hxx" #include "com/sun/star/awt/XWindowPeer.hpp" @@ -87,7 +86,6 @@ #include "vcl/unowrap.hxx" #include "vcl/dndlcon.hxx" #include "vcl/dndevdis.hxx" -#include "vcl/impbmpconv.hxx" #include "unotools/confignode.hxx" #include "vcl/gdimtf.hxx" #include <sal/macros.h> @@ -114,12 +112,12 @@ DBG_NAME( Window ) // ======================================================================= -#define IMPL_PAINT_PAINT ((USHORT)0x0001) -#define IMPL_PAINT_PAINTALL ((USHORT)0x0002) -#define IMPL_PAINT_PAINTALLCHILDS ((USHORT)0x0004) -#define IMPL_PAINT_PAINTCHILDS ((USHORT)0x0008) -#define IMPL_PAINT_ERASE ((USHORT)0x0010) -#define IMPL_PAINT_CHECKRTL ((USHORT)0x0020) +#define IMPL_PAINT_PAINT ((sal_uInt16)0x0001) +#define IMPL_PAINT_PAINTALL ((sal_uInt16)0x0002) +#define IMPL_PAINT_PAINTALLCHILDS ((sal_uInt16)0x0004) +#define IMPL_PAINT_PAINTCHILDS ((sal_uInt16)0x0008) +#define IMPL_PAINT_ERASE ((sal_uInt16)0x0010) +#define IMPL_PAINT_CHECKRTL ((sal_uInt16)0x0020) // ----------------------------------------------------------------------- @@ -134,25 +132,21 @@ struct ImplCalcToTopData Region* mpInvalidateRegion; }; -struct ImplAccessibleInfos +ImplAccessibleInfos::ImplAccessibleInfos() { - USHORT nAccessibleRole; - String* pAccessibleName; - String* pAccessibleDescription; - - ImplAccessibleInfos() - { - nAccessibleRole = 0xFFFF; - pAccessibleName = NULL; - pAccessibleDescription = NULL; - } + nAccessibleRole = 0xFFFF; + pAccessibleName = NULL; + pAccessibleDescription = NULL; + pLabeledByWindow = NULL; + pLabelForWindow = NULL; + pMemberOfWindow = NULL; +} - ~ImplAccessibleInfos() - { - delete pAccessibleName; - delete pAccessibleDescription; - } -}; +ImplAccessibleInfos::~ImplAccessibleInfos() +{ + delete pAccessibleName; + delete pAccessibleDescription; +} // ----------------------------------------------------------------------- @@ -268,29 +262,53 @@ bool Window::ImplCheckUIFont( const Font& rFont ) if( ImplGetSVData()->maGDIData.mbNativeFontConfig ) return true; + // create a text string using the localized text of important buttons String aTestText; - aTestText.Append( Button::GetStandardText( BUTTON_OK ) ); - aTestText.Append( Button::GetStandardText( BUTTON_CANCEL ) ); - aTestText.Append( Button::GetStandardText( BUTTON_YES ) ); - aTestText.Append( Button::GetStandardText( BUTTON_NO ) ); - aTestText.Append( Button::GetStandardText( BUTTON_RETRY ) ); - aTestText.Append( Button::GetStandardText( BUTTON_HELP ) ); - aTestText.Append( Button::GetStandardText( BUTTON_CLOSE ) ); - aTestText.Append( Button::GetStandardText( BUTTON_MORE ) ); - aTestText.Append( Button::GetStandardText( BUTTON_LESS ) ); - aTestText.Append( Button::GetStandardText( BUTTON_ABORT ) ); + static const StandardButtonType aTestButtons[] = + { + BUTTON_OK, BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_ABORT, + BUTTON_YES, BUTTON_NO, BUTTON_MORE, BUTTON_IGNORE, + BUTTON_RETRY, BUTTON_HELP + }; + + const int nTestButtonCount = sizeof(aTestButtons)/sizeof(*aTestButtons); + for( int n = 0; n < nTestButtonCount; ++n ) + { + String aButtonStr = Button::GetStandardText( aTestButtons[n] ); + // #i115432# ignore mnemonic+accelerator part of each string + // TODO: use a string filtering method when it becomes available + const int nLen = aButtonStr.Len(); + bool bInside = false; + for( int i = 0; i < nLen; ++i ) { + const sal_Unicode c = aButtonStr.GetChar( i ); + if( (c == '(')) + bInside = true; + if( (c == ')')) + bInside = false; + if( (c == '~') + || (c == '(') || (c == ')') + || ((c >= 'A') && (c <= 'Z') && bInside) ) + aButtonStr.SetChar( i, ' ' ); + } + // append sanitized button text to test string + aTestText.Append( aButtonStr ); + } - return HasGlyphs( rFont, aTestText ) >= aTestText.Len(); + const int nFirstChar = HasGlyphs( rFont, aTestText ); + const bool bUIFontOk = (nFirstChar >= aTestText.Len()); + return bUIFontOk; } // ----------------------------------------------------------------------- -void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl ) +void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl ) { StyleSettings aTmpSt( rSettings.GetStyleSettings() ); - aTmpSt.SetHighContrastMode( FALSE ); + aTmpSt.SetHighContrastMode( sal_False ); rSettings.SetStyleSettings( aTmpSt ); ImplGetFrame()->UpdateSettings( rSettings ); + // reset default border width for layouters + ImplGetSVData()->maAppData.mnDefaultLayoutBorder = -1; // Verify availability of the configured UI font, otherwise choose "Andale Sans UI" String aUserInterfaceFont; @@ -490,7 +508,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl ) || rSettings.GetStyleSettings().GetWindowColor().IsDark() ) { aStyleSettings = rSettings.GetStyleSettings(); - aStyleSettings.SetHighContrastMode( TRUE ); + aStyleSettings.SetHighContrastMode( sal_True ); aStyleSettings.SetSymbolsStyle( STYLE_SYMBOLS_HICONTRAST ); rSettings.SetStyleSettings( aStyleSettings ); } @@ -500,7 +518,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl ) static const char* pEnvHC = getenv( "SAL_FORCE_HC" ); if( pEnvHC && *pEnvHC ) { - aStyleSettings.SetHighContrastMode( TRUE ); + aStyleSettings.SetHighContrastMode( sal_True ); aStyleSettings.SetSymbolsStyle( STYLE_SYMBOLS_HICONTRAST ); rSettings.SetStyleSettings( aStyleSettings ); } @@ -595,6 +613,7 @@ void Window::ImplInitWindowData( WindowType nType ) mpWindowImpl->mpDlgCtrlDownWindow = NULL; // window for dialog control mpWindowImpl->mpFirstDel = NULL; // Dtor notification list mpWindowImpl->mpUserData = NULL; // user data + mpWindowImpl->mpExtImpl = NULL; // extended implementation data mpWindowImpl->mpCursor = NULL; // cursor mpWindowImpl->mpControlFont = NULL; // font propertie mpWindowImpl->mpVCLXWindow = NULL; @@ -608,8 +627,6 @@ void Window::ImplInitWindowData( WindowType nType ) mpWindowImpl->mnX = 0; // X-Position to Parent mpWindowImpl->mnY = 0; // Y-Position to Parent mpWindowImpl->mnAbsScreenX = 0; // absolute X-position on screen, used for RTL window positioning - mpWindowImpl->mnHelpId = 0; // help id - mpWindowImpl->mnUniqId = 0; // unique id mpWindowImpl->mpChildClipRegion = NULL; // Child-Clip-Region when ClipChildren mpWindowImpl->mpPaintRegion = NULL; // Paint-ClipRegion mpWindowImpl->mnStyle = 0; // style (init in ImplInitWindow) @@ -625,83 +642,83 @@ void Window::ImplInitWindowData( WindowType nType ) mpWindowImpl->mnDlgCtrlFlags = 0; // DialogControl-Flags mpWindowImpl->mnLockCount = 0; // LockCount mpWindowImpl->meAlwaysInputMode = AlwaysInputNone; // neither AlwaysEnableInput nor AlwaysDisableInput called - mpWindowImpl->mbFrame = FALSE; // TRUE: Window is a frame window - mpWindowImpl->mbBorderWin = FALSE; // TRUE: Window is a border window - mpWindowImpl->mbOverlapWin = FALSE; // TRUE: Window is a overlap window - mpWindowImpl->mbSysWin = FALSE; // TRUE: SystemWindow is the base class - mpWindowImpl->mbDialog = FALSE; // TRUE: Dialog is the base class - mpWindowImpl->mbDockWin = FALSE; // TRUE: DockingWindow is the base class - mpWindowImpl->mbFloatWin = FALSE; // TRUE: FloatingWindow is the base class - mpWindowImpl->mbPushButton = FALSE; // TRUE: PushButton is the base class - mpWindowImpl->mbToolBox = FALSE; // TRUE: ToolBox is the base class - mpWindowImpl->mbMenuFloatingWindow= FALSE; // TRUE: MenuFloatingWindow is the base class - mpWindowImpl->mbToolbarFloatingWindow= FALSE; // TRUE: ImplPopupFloatWin is the base class, used for subtoolbars - mpWindowImpl->mbSplitter = FALSE; // TRUE: Splitter is the base class - mpWindowImpl->mbVisible = FALSE; // TRUE: Show( true ) called - mpWindowImpl->mbOverlapVisible = FALSE; // TRUE: Hide called for visible window from ImplHideAllOverlapWindow() - mpWindowImpl->mbDisabled = FALSE; // TRUE: Enable( FALSE ) called - mpWindowImpl->mbInputDisabled = FALSE; // TRUE: EnableInput( FALSE ) called - mpWindowImpl->mbDropDisabled = FALSE; // TRUE: Drop is enabled - mpWindowImpl->mbNoUpdate = FALSE; // TRUE: SetUpdateMode( FALSE ) called - mpWindowImpl->mbNoParentUpdate = FALSE; // TRUE: SetParentUpdateMode( FALSE ) called - mpWindowImpl->mbActive = FALSE; // TRUE: Window Active - mpWindowImpl->mbParentActive = FALSE; // TRUE: OverlapActive from Parent - mpWindowImpl->mbReallyVisible = FALSE; // TRUE: this and all parents to an overlaped window are visible - mpWindowImpl->mbReallyShown = FALSE; // TRUE: this and all parents to an overlaped window are shown - mpWindowImpl->mbInInitShow = FALSE; // TRUE: we are in InitShow - mpWindowImpl->mbChildNotify = FALSE; // TRUE: ChildNotify - mpWindowImpl->mbChildPtrOverwrite = FALSE; // TRUE: PointerStyle overwrites Child-Pointer - mpWindowImpl->mbNoPtrVisible = FALSE; // TRUE: ShowPointer( FALSE ) called - mpWindowImpl->mbMouseMove = FALSE; // TRUE: BaseMouseMove called - mpWindowImpl->mbPaintFrame = FALSE; // TRUE: Paint is visible, but not painted - mpWindowImpl->mbInPaint = FALSE; // TRUE: Inside PaintHdl - mpWindowImpl->mbMouseButtonDown = FALSE; // TRUE: BaseMouseButtonDown called - mpWindowImpl->mbMouseButtonUp = FALSE; // TRUE: BaseMouseButtonUp called - mpWindowImpl->mbKeyInput = FALSE; // TRUE: BaseKeyInput called - mpWindowImpl->mbKeyUp = FALSE; // TRUE: BaseKeyUp called - mpWindowImpl->mbCommand = FALSE; // TRUE: BaseCommand called - mpWindowImpl->mbDefPos = TRUE; // TRUE: Position is not Set - mpWindowImpl->mbDefSize = TRUE; // TRUE: Size is not Set - mpWindowImpl->mbCallMove = TRUE; // TRUE: Move must be called by Show - mpWindowImpl->mbCallResize = TRUE; // TRUE: Resize must be called by Show - mpWindowImpl->mbWaitSystemResize = TRUE; // TRUE: Wait for System-Resize - mpWindowImpl->mbInitWinClipRegion = TRUE; // TRUE: Calc Window Clip Region - mpWindowImpl->mbInitChildRegion = FALSE; // TRUE: InitChildClipRegion - mpWindowImpl->mbWinRegion = FALSE; // TRUE: Window Region - mpWindowImpl->mbClipChildren = FALSE; // TRUE: Child-Fenster muessen evt. geclippt werden - mpWindowImpl->mbClipSiblings = FALSE; // TRUE: Nebeneinanderliegende Child-Fenster muessen evt. geclippt werden - mpWindowImpl->mbChildTransparent = FALSE; // TRUE: Child-Fenster duerfen transparent einschalten (inkl. Parent-CLIPCHILDREN) - mpWindowImpl->mbPaintTransparent = FALSE; // TRUE: Paints muessen auf Parent ausgeloest werden - mpWindowImpl->mbMouseTransparent = FALSE; // TRUE: Window is transparent for Mouse - mpWindowImpl->mbDlgCtrlStart = FALSE; // TRUE: Ab hier eigenes Dialog-Control - mpWindowImpl->mbFocusVisible = FALSE; // TRUE: Focus Visible - mpWindowImpl->mbUseNativeFocus = FALSE; - mpWindowImpl->mbNativeFocusVisible= FALSE; // TRUE: native Focus Visible - mpWindowImpl->mbInShowFocus = FALSE; // prevent recursion - mpWindowImpl->mbInHideFocus = FALSE; // prevent recursion - mpWindowImpl->mbTrackVisible = FALSE; // TRUE: Tracking Visible - mpWindowImpl->mbControlForeground = FALSE; // TRUE: Foreground-Property set - mpWindowImpl->mbControlBackground = FALSE; // TRUE: Background-Property set - mpWindowImpl->mbAlwaysOnTop = FALSE; // TRUE: immer vor allen anderen normalen Fenstern sichtbar - mpWindowImpl->mbCompoundControl = FALSE; // TRUE: Zusammengesetztes Control => Listener... - mpWindowImpl->mbCompoundControlHasFocus = FALSE; // TRUE: Zusammengesetztes Control hat irgendwo den Focus - mpWindowImpl->mbPaintDisabled = FALSE; // TRUE: Paint soll nicht ausgefuehrt werden - mpWindowImpl->mbAllResize = FALSE; // TRUE: Auch ResizeEvents mit 0,0 schicken - mpWindowImpl->mbInDtor = FALSE; // TRUE: Wir befinden uns im Window-Dtor - mpWindowImpl->mbExtTextInput = FALSE; // TRUE: ExtTextInput-Mode is active - mpWindowImpl->mbInFocusHdl = FALSE; // TRUE: Innerhalb vom GetFocus-Handler - mpWindowImpl->mbCreatedWithToolkit = FALSE; - mpWindowImpl->mbSuppressAccessibilityEvents = FALSE; // TRUE: do not send any accessibility events - mpWindowImpl->mbDrawSelectionBackground = FALSE; // TRUE: draws transparent window background to indicate (toolbox) selection - mpWindowImpl->mbIsInTaskPaneList = FALSE; // TRUE: window was added to the taskpanelist in the topmost system window + mpWindowImpl->mbFrame = sal_False; // sal_True: Window is a frame window + mpWindowImpl->mbBorderWin = sal_False; // sal_True: Window is a border window + mpWindowImpl->mbOverlapWin = sal_False; // sal_True: Window is a overlap window + mpWindowImpl->mbSysWin = sal_False; // sal_True: SystemWindow is the base class + mpWindowImpl->mbDialog = sal_False; // sal_True: Dialog is the base class + mpWindowImpl->mbDockWin = sal_False; // sal_True: DockingWindow is the base class + mpWindowImpl->mbFloatWin = sal_False; // sal_True: FloatingWindow is the base class + mpWindowImpl->mbPushButton = sal_False; // sal_True: PushButton is the base class + mpWindowImpl->mbToolBox = sal_False; // sal_True: ToolBox is the base class + mpWindowImpl->mbMenuFloatingWindow= sal_False; // sal_True: MenuFloatingWindow is the base class + mpWindowImpl->mbToolbarFloatingWindow= sal_False; // sal_True: ImplPopupFloatWin is the base class, used for subtoolbars + mpWindowImpl->mbSplitter = sal_False; // sal_True: Splitter is the base class + mpWindowImpl->mbVisible = sal_False; // sal_True: Show( sal_True ) called + mpWindowImpl->mbOverlapVisible = sal_False; // sal_True: Hide called for visible window from ImplHideAllOverlapWindow() + mpWindowImpl->mbDisabled = sal_False; // sal_True: Enable( sal_False ) called + mpWindowImpl->mbInputDisabled = sal_False; // sal_True: EnableInput( sal_False ) called + mpWindowImpl->mbDropDisabled = sal_False; // sal_True: Drop is enabled + mpWindowImpl->mbNoUpdate = sal_False; // sal_True: SetUpdateMode( sal_False ) called + mpWindowImpl->mbNoParentUpdate = sal_False; // sal_True: SetParentUpdateMode( sal_False ) called + mpWindowImpl->mbActive = sal_False; // sal_True: Window Active + mpWindowImpl->mbParentActive = sal_False; // sal_True: OverlapActive from Parent + mpWindowImpl->mbReallyVisible = sal_False; // sal_True: this and all parents to an overlaped window are visible + mpWindowImpl->mbReallyShown = sal_False; // sal_True: this and all parents to an overlaped window are shown + mpWindowImpl->mbInInitShow = sal_False; // sal_True: we are in InitShow + mpWindowImpl->mbChildNotify = sal_False; // sal_True: ChildNotify + mpWindowImpl->mbChildPtrOverwrite = sal_False; // sal_True: PointerStyle overwrites Child-Pointer + mpWindowImpl->mbNoPtrVisible = sal_False; // sal_True: ShowPointer( sal_False ) called + mpWindowImpl->mbMouseMove = sal_False; // sal_True: BaseMouseMove called + mpWindowImpl->mbPaintFrame = sal_False; // sal_True: Paint is visible, but not painted + mpWindowImpl->mbInPaint = sal_False; // sal_True: Inside PaintHdl + mpWindowImpl->mbMouseButtonDown = sal_False; // sal_True: BaseMouseButtonDown called + mpWindowImpl->mbMouseButtonUp = sal_False; // sal_True: BaseMouseButtonUp called + mpWindowImpl->mbKeyInput = sal_False; // sal_True: BaseKeyInput called + mpWindowImpl->mbKeyUp = sal_False; // sal_True: BaseKeyUp called + mpWindowImpl->mbCommand = sal_False; // sal_True: BaseCommand called + mpWindowImpl->mbDefPos = sal_True; // sal_True: Position is not Set + mpWindowImpl->mbDefSize = sal_True; // sal_True: Size is not Set + mpWindowImpl->mbCallMove = sal_True; // sal_True: Move must be called by Show + mpWindowImpl->mbCallResize = sal_True; // sal_True: Resize must be called by Show + mpWindowImpl->mbWaitSystemResize = sal_True; // sal_True: Wait for System-Resize + mpWindowImpl->mbInitWinClipRegion = sal_True; // sal_True: Calc Window Clip Region + mpWindowImpl->mbInitChildRegion = sal_False; // sal_True: InitChildClipRegion + mpWindowImpl->mbWinRegion = sal_False; // sal_True: Window Region + mpWindowImpl->mbClipChildren = sal_False; // sal_True: Child-Fenster muessen evt. geclippt werden + mpWindowImpl->mbClipSiblings = sal_False; // sal_True: Nebeneinanderliegende Child-Fenster muessen evt. geclippt werden + mpWindowImpl->mbChildTransparent = sal_False; // sal_True: Child-Fenster duerfen transparent einschalten (inkl. Parent-CLIPCHILDREN) + mpWindowImpl->mbPaintTransparent = sal_False; // sal_True: Paints muessen auf Parent ausgeloest werden + mpWindowImpl->mbMouseTransparent = sal_False; // sal_True: Window is transparent for Mouse + mpWindowImpl->mbDlgCtrlStart = sal_False; // sal_True: Ab hier eigenes Dialog-Control + mpWindowImpl->mbFocusVisible = sal_False; // sal_True: Focus Visible + mpWindowImpl->mbUseNativeFocus = sal_False; + mpWindowImpl->mbNativeFocusVisible= sal_False; // sal_True: native Focus Visible + mpWindowImpl->mbInShowFocus = sal_False; // prevent recursion + mpWindowImpl->mbInHideFocus = sal_False; // prevent recursion + mpWindowImpl->mbTrackVisible = sal_False; // sal_True: Tracking Visible + mpWindowImpl->mbControlForeground = sal_False; // sal_True: Foreground-Property set + mpWindowImpl->mbControlBackground = sal_False; // sal_True: Background-Property set + mpWindowImpl->mbAlwaysOnTop = sal_False; // sal_True: immer vor allen anderen normalen Fenstern sichtbar + mpWindowImpl->mbCompoundControl = sal_False; // sal_True: Zusammengesetztes Control => Listener... + mpWindowImpl->mbCompoundControlHasFocus = sal_False; // sal_True: Zusammengesetztes Control hat irgendwo den Focus + mpWindowImpl->mbPaintDisabled = sal_False; // sal_True: Paint soll nicht ausgefuehrt werden + mpWindowImpl->mbAllResize = sal_False; // sal_True: Auch ResizeEvents mit 0,0 schicken + mpWindowImpl->mbInDtor = sal_False; // sal_True: Wir befinden uns im Window-Dtor + mpWindowImpl->mbExtTextInput = sal_False; // sal_True: ExtTextInput-Mode is active + mpWindowImpl->mbInFocusHdl = sal_False; // sal_True: Innerhalb vom GetFocus-Handler + mpWindowImpl->mbCreatedWithToolkit = sal_False; + mpWindowImpl->mbSuppressAccessibilityEvents = sal_False; // sal_True: do not send any accessibility events + mpWindowImpl->mbDrawSelectionBackground = sal_False; // sal_True: draws transparent window background to indicate (toolbox) selection + mpWindowImpl->mbIsInTaskPaneList = sal_False; // sal_True: window was added to the taskpanelist in the topmost system window mpWindowImpl->mnNativeBackground = 0; // initialize later, depends on type - mpWindowImpl->mbCallHandlersDuringInputDisabled = FALSE; // TRUE: call event handlers even if input is disabled - mpWindowImpl->mbDisableAccessibleLabelForRelation = FALSE; // TRUE: do not set LabelFor relation on accessible objects - mpWindowImpl->mbDisableAccessibleLabeledByRelation = FALSE; // TRUE: do not set LabeledBy relation on accessible objects - mpWindowImpl->mbHelpTextDynamic = FALSE; // TRUE: append help id in HELP_DEBUG case - mpWindowImpl->mbFakeFocusSet = FALSE; // TRUE: pretend as if the window has focus. + mpWindowImpl->mbCallHandlersDuringInputDisabled = sal_False; // sal_True: call event handlers even if input is disabled + mpWindowImpl->mbDisableAccessibleLabelForRelation = sal_False; // sal_True: do not set LabelFor relation on accessible objects + mpWindowImpl->mbDisableAccessibleLabeledByRelation = sal_False; // sal_True: do not set LabeledBy relation on accessible objects + mpWindowImpl->mbHelpTextDynamic = sal_False; // sal_True: append help id in HELP_DEBUG case + mpWindowImpl->mbFakeFocusSet = sal_False; // sal_True: pretend as if the window has focus. - mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // TRUE: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active + mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // sal_True: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active } // ----------------------------------------------------------------------- @@ -728,7 +745,7 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste if ( !mpWindowImpl->mbFrame && !mpWindowImpl->mbBorderWin && !mpWindowImpl->mpBorderWindow && (nStyle & (WB_BORDER | WB_SYSTEMCHILDWINDOW) ) ) { - USHORT nBorderTypeStyle = 0; + sal_uInt16 nBorderTypeStyle = 0; if( (nStyle & WB_SYSTEMCHILDWINDOW) ) { // handle WB_SYSTEMCHILDWINDOW @@ -746,8 +763,8 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste } else if( !mpWindowImpl->mbFrame && ! pParent ) { - mpWindowImpl->mbOverlapWin = TRUE; - mpWindowImpl->mbFrame = TRUE; + mpWindowImpl->mbOverlapWin = sal_True; + mpWindowImpl->mbFrame = sal_True; } // insert window in list @@ -762,7 +779,7 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste mpWindowImpl->mpOverlapData->mpSaveBackRgn = NULL; mpWindowImpl->mpOverlapData->mpNextBackWin = NULL; mpWindowImpl->mpOverlapData->mnSaveBackSize = 0; - mpWindowImpl->mpOverlapData->mbSaveBack = FALSE; + mpWindowImpl->mpOverlapData->mbSaveBack = sal_False; mpWindowImpl->mpOverlapData->mnTopLevel = 1; } @@ -773,7 +790,7 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste if ( mpWindowImpl->mbFrame ) { // create frame - ULONG nFrameStyle = 0; + sal_uLong nFrameStyle = 0; if ( nStyle & WB_MOVEABLE ) nFrameStyle |= SAL_FRAME_STYLE_MOVEABLE; @@ -879,21 +896,21 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste mpWindowImpl->mpFrameData->mnMouseCode = 0; mpWindowImpl->mpFrameData->mnMouseMode = 0; mpWindowImpl->mpFrameData->meMapUnit = MAP_PIXEL; - mpWindowImpl->mpFrameData->mbHasFocus = FALSE; - mpWindowImpl->mpFrameData->mbInMouseMove = FALSE; - mpWindowImpl->mpFrameData->mbMouseIn = FALSE; - mpWindowImpl->mpFrameData->mbStartDragCalled = FALSE; - mpWindowImpl->mpFrameData->mbNeedSysWindow = FALSE; - mpWindowImpl->mpFrameData->mbMinimized = FALSE; - mpWindowImpl->mpFrameData->mbStartFocusState = FALSE; - mpWindowImpl->mpFrameData->mbInSysObjFocusHdl = FALSE; - mpWindowImpl->mpFrameData->mbInSysObjToTopHdl = FALSE; - mpWindowImpl->mpFrameData->mbSysObjFocus = FALSE; + mpWindowImpl->mpFrameData->mbHasFocus = sal_False; + mpWindowImpl->mpFrameData->mbInMouseMove = sal_False; + mpWindowImpl->mpFrameData->mbMouseIn = sal_False; + mpWindowImpl->mpFrameData->mbStartDragCalled = sal_False; + mpWindowImpl->mpFrameData->mbNeedSysWindow = sal_False; + mpWindowImpl->mpFrameData->mbMinimized = sal_False; + mpWindowImpl->mpFrameData->mbStartFocusState = sal_False; + mpWindowImpl->mpFrameData->mbInSysObjFocusHdl = sal_False; + mpWindowImpl->mpFrameData->mbInSysObjToTopHdl = sal_False; + mpWindowImpl->mpFrameData->mbSysObjFocus = sal_False; mpWindowImpl->mpFrameData->maPaintTimer.SetTimeout( 30 ); mpWindowImpl->mpFrameData->maPaintTimer.SetTimeoutHdl( LINK( this, Window, ImplHandlePaintHdl ) ); mpWindowImpl->mpFrameData->maResizeTimer.SetTimeout( 50 ); mpWindowImpl->mpFrameData->maResizeTimer.SetTimeoutHdl( LINK( this, Window, ImplHandleResizeTimerHdl ) ); - mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = FALSE; + mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = sal_False; if ( pRealParent && IsTopWindow() ) { @@ -938,7 +955,7 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings ); OutputDevice::SetSettings( *pSVData->maAppData.mpSettings ); - pSVData->maAppData.mbSettingsInit = TRUE; + pSVData->maAppData.mbSettingsInit = sal_True; } // If we create a Window with default size, query this @@ -964,7 +981,7 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste } const StyleSettings& rStyleSettings = maSettings.GetStyleSettings(); - USHORT nScreenZoom = rStyleSettings.GetScreenZoom(); + sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom(); mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100; mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100; maFont = rStyleSettings.GetAppFont(); @@ -1025,7 +1042,7 @@ void Window::ImplInsertWindow( Window* pParent ) mpWindowImpl->mpFrameData = pFrameParent->mpWindowImpl->mpFrameData; mpWindowImpl->mpFrame = pFrameParent->mpWindowImpl->mpFrame; mpWindowImpl->mpFrameWindow = pFrameParent; - mpWindowImpl->mbFrame = FALSE; + mpWindowImpl->mbFrame = sal_False; // search overlap window and insert window in list if ( ImplIsOverlapWindow() ) @@ -1064,7 +1081,7 @@ void Window::ImplInsertWindow( Window* pParent ) // ----------------------------------------------------------------------- -void Window::ImplRemoveWindow( BOOL bRemoveFrameData ) +void Window::ImplRemoveWindow( sal_Bool bRemoveFrameData ) { // Fenster aus den Listen austragen if ( !mpWindowImpl->mbFrame ) @@ -1117,7 +1134,7 @@ void Window::ImplRemoveWindow( BOOL bRemoveFrameData ) void Window::ImplCallResize() { - mpWindowImpl->mbCallResize = FALSE; + mpWindowImpl->mbCallResize = sal_False; if( GetBackground().IsGradient() ) Invalidate(); @@ -1127,13 +1144,15 @@ void Window::ImplCallResize() // #88419# Most classes don't call the base class in Resize() and Move(), // => Call ImpleResize/Move instead of Resize/Move directly... ImplCallEventListeners( VCLEVENT_WINDOW_RESIZE ); + + ImplExtResize(); } // ----------------------------------------------------------------------- void Window::ImplCallMove() { - mpWindowImpl->mbCallMove = FALSE; + mpWindowImpl->mbCallMove = sal_False; if( mpWindowImpl->mbFrame ) { @@ -1175,20 +1194,14 @@ void Window::ImplCallMove() // ----------------------------------------------------------------------- -static ULONG ImplAutoHelpID( ResMgr* pResMgr ) +static rtl::OString ImplAutoHelpID( ResMgr* pResMgr ) { - if ( !Application::IsAutoHelpIdEnabled() ) - return 0; + rtl::OString aRet; - ULONG nHID = 0; + if( pResMgr && Application::IsAutoHelpIdEnabled() ) + aRet = pResMgr->GetAutoHelpId(); - DBG_ASSERT( pResMgr, "No res mgr for auto help id" ); - if( ! pResMgr ) - return 0; - - nHID = pResMgr->GetAutoHelpId(); - - return nHID; + return aRet; } // ----------------------------------------------------------------------- @@ -1208,25 +1221,26 @@ WinBits Window::ImplInitRes( const ResId& rResId ) void Window::ImplLoadRes( const ResId& rResId ) { - // newer move this line after IncrementRes - char* pRes = (char*)GetClassRes(); - pRes += 12; - sal_uInt32 nHelpId = (sal_uInt32)GetLongRes( (void*)pRes ); - if ( !nHelpId ) - nHelpId = ImplAutoHelpID( rResId.GetResMgr() ); - SetHelpId( nHelpId ); + sal_uLong nObjMask = ReadLongRes(); - ULONG nObjMask = ReadLongRes(); + // we need to calculate auto helpids before the resource gets closed + // if the resource only contains flags, it will be closed before we try to read a help id + // so we always create an auto help id that might be overwritten later + // HelpId + rtl::OString aHelpId = ImplAutoHelpID( rResId.GetResMgr() ); // ResourceStyle - ULONG nRSStyle = ReadLongRes(); + sal_uLong nRSStyle = ReadLongRes(); // WinBits ReadLongRes(); - // HelpId - ReadLongRes(); - BOOL bPos = FALSE; - BOOL bSize = FALSE; + if( nObjMask & WINDOW_HELPID ) + aHelpId = ReadByteStringRes(); + + SetHelpId( aHelpId ); + + sal_Bool bPos = sal_False; + sal_Bool bSize = sal_False; Point aPos; Size aSize; @@ -1235,7 +1249,7 @@ void Window::ImplLoadRes( const ResId& rResId ) // Groessenangabe aus der Resource verwenden MapUnit ePosMap = MAP_PIXEL; - bPos = TRUE; + bPos = sal_True; if ( nObjMask & WINDOW_XYMAPMODE ) ePosMap = (MapUnit)ReadLongRes(); @@ -1250,7 +1264,7 @@ void Window::ImplLoadRes( const ResId& rResId ) // Groessenangabe aus der Resource verwenden MapUnit eSizeMap = MAP_PIXEL; - bSize = TRUE; + bSize = sal_True; if ( nObjMask & WINDOW_WHMAPMODE ) eSizeMap = (MapUnit)ReadLongRes(); @@ -1276,14 +1290,14 @@ void Window::ImplLoadRes( const ResId& rResId ) SetSizePixel( aSize ); if ( nRSStyle & RSWND_DISABLED ) - Enable( FALSE ); + Enable( sal_False ); if ( nObjMask & WINDOW_TEXT ) SetText( ReadStringRes() ); if ( nObjMask & WINDOW_HELPTEXT ) { SetHelpText( ReadStringRes() ); - mpWindowImpl->mbHelpTextDynamic = TRUE; + mpWindowImpl->mbHelpTextDynamic = sal_True; } if ( nObjMask & WINDOW_QUICKTEXT ) SetQuickHelpText( ReadStringRes() ); @@ -1293,11 +1307,11 @@ void Window::ImplLoadRes( const ResId& rResId ) SetData( (void*)nRes ); } if ( nObjMask & WINDOW_UNIQUEID ) - SetUniqueId( (ULONG)ReadLongRes() ); + SetUniqueId( ReadByteStringRes() ); if ( nObjMask & WINDOW_BORDER_STYLE ) { - USHORT nBorderStyle = (USHORT)ReadLongRes(); + sal_uInt16 nBorderStyle = (sal_uInt16)ReadLongRes(); SetBorderStyle( nBorderStyle ); } } @@ -1318,11 +1332,9 @@ ImplWinData* Window::ImplGetWinData() const mpWindowImpl->mpWinData->mpFocusRect = NULL; mpWindowImpl->mpWinData->mpTrackRect = NULL; mpWindowImpl->mpWinData->mnTrackFlags = 0; - 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->mpSmartHelpId = NULL; - mpWindowImpl->mpWinData->mpSmartUniqueId = NULL; + mpWindowImpl->mpWinData->mnIsTopWindow = (sal_uInt16) ~0; // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow()) + mpWindowImpl->mpWinData->mbMouseOver = sal_False; + mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? sal_False : sal_True; // sal_True: try to draw this control with native theme API } return mpWindowImpl->mpWinData; @@ -1333,7 +1345,7 @@ ImplWinData* Window::ImplGetWinData() const SalGraphics* Window::ImplGetFrameGraphics() const { if ( mpWindowImpl->mpFrameWindow->mpGraphics ) - mpWindowImpl->mpFrameWindow->mbInitClipRegion = TRUE; + mpWindowImpl->mpFrameWindow->mbInitClipRegion = sal_True; else mpWindowImpl->mpFrameWindow->ImplGetGraphics(); mpWindowImpl->mpFrameWindow->mpGraphics->ResetClipRegion(); @@ -1363,7 +1375,7 @@ Window* Window::ImplFindWindow( const Point& rFramePos ) if ( !mpWindowImpl->mbVisible ) return NULL; - USHORT nHitTest = ImplHitTest( rFramePos ); + sal_uInt16 nHitTest = ImplHitTest( rFramePos ); if ( nHitTest & WINDOW_HITTEST_INSIDE ) { // und danach gehen wir noch alle Child-Fenster durch @@ -1387,7 +1399,7 @@ Window* Window::ImplFindWindow( const Point& rFramePos ) // ----------------------------------------------------------------------- -USHORT Window::ImplHitTest( const Point& rFramePos ) +sal_uInt16 Window::ImplHitTest( const Point& rFramePos ) { Point aFramePos( rFramePos ); if( ImplIsAntiparallel() ) @@ -1407,7 +1419,7 @@ USHORT Window::ImplHitTest( const Point& rFramePos ) return 0; } - USHORT nHitTest = WINDOW_HITTEST_INSIDE; + sal_uInt16 nHitTest = WINDOW_HITTEST_INSIDE; if ( mpWindowImpl->mbMouseTransparent ) nHitTest |= WINDOW_HITTEST_TRANSPARENT; return nHitTest; @@ -1415,22 +1427,22 @@ USHORT Window::ImplHitTest( const Point& rFramePos ) // ----------------------------------------------------------------------- -BOOL Window::ImplIsRealParentPath( const Window* pWindow ) const +sal_Bool Window::ImplIsRealParentPath( const Window* pWindow ) const { pWindow = pWindow->GetParent(); while ( pWindow ) { if ( pWindow == this ) - return TRUE; + return sal_True; pWindow = pWindow->GetParent(); } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL Window::ImplIsChild( const Window* pWindow, BOOL bSystemWindow ) const +sal_Bool Window::ImplIsChild( const Window* pWindow, sal_Bool bSystemWindow ) const { do { @@ -1440,19 +1452,19 @@ BOOL Window::ImplIsChild( const Window* pWindow, BOOL bSystemWindow ) const pWindow = pWindow->ImplGetParent(); if ( pWindow == this ) - return TRUE; + return sal_True; } while ( pWindow ); - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL Window::ImplIsWindowOrChild( const Window* pWindow, BOOL bSystemWindow ) const +sal_Bool Window::ImplIsWindowOrChild( const Window* pWindow, sal_Bool bSystemWindow ) const { if ( this == pWindow ) - return TRUE; + return sal_True; return ImplIsChild( pWindow, bSystemWindow ); } @@ -1482,15 +1494,15 @@ int Window::ImplTestMousePointerSet() { // Wenn Mouse gecaptured ist, dann soll MousePointer umgeschaltet werden if ( IsMouseCaptured() ) - return TRUE; + return sal_True; // Wenn sich Mouse ueber dem Fenster befindet, dann soll MousePointer // umgeschaltet werden Rectangle aClientRect( Point( 0, 0 ), GetOutputSizePixel() ); if ( aClientRect.IsInside( GetPointerPosPixel() ) ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -1498,7 +1510,7 @@ int Window::ImplTestMousePointerSet() PointerStyle Window::ImplGetMousePointer() const { PointerStyle ePointerStyle; - BOOL bWait = FALSE; + sal_Bool bWait = sal_False; if ( IsEnabled() && IsInputEnabled() && ! IsInModalMode() ) ePointerStyle = GetPointer().GetStyle(); @@ -1518,7 +1530,7 @@ PointerStyle Window::ImplGetMousePointer() const if ( pWindow->mpWindowImpl->mnWaitCount ) { ePointerStyle = POINTER_WAIT; - bWait = TRUE; + bWait = sal_True; } else { @@ -1541,11 +1553,11 @@ PointerStyle Window::ImplGetMousePointer() const void Window::ImplResetReallyVisible() { - BOOL bBecameReallyInvisible = mpWindowImpl->mbReallyVisible; + sal_Bool bBecameReallyInvisible = mpWindowImpl->mbReallyVisible; - mbDevOutput = FALSE; - mpWindowImpl->mbReallyVisible = FALSE; - mpWindowImpl->mbReallyShown = FALSE; + mbDevOutput = sal_False; + mpWindowImpl->mbReallyVisible = sal_False; + mpWindowImpl->mbReallyShown = sal_False; // the SHOW/HIDE events serve as indicators to send child creation/destroy events to the access bridge. // For this, the data member of the event must not be NULL. @@ -1582,11 +1594,11 @@ void Window::ImplSetReallyVisible() if( !mpWindowImpl->mbReallyShown ) ImplCallInitShow(); - BOOL bBecameReallyVisible = !mpWindowImpl->mbReallyVisible; + sal_Bool bBecameReallyVisible = !mpWindowImpl->mbReallyVisible; - mbDevOutput = TRUE; - mpWindowImpl->mbReallyVisible = TRUE; - mpWindowImpl->mbReallyShown = TRUE; + mbDevOutput = sal_True; + mpWindowImpl->mbReallyVisible = sal_True; + mpWindowImpl->mbReallyShown = sal_True; // the SHOW/HIDE events serve as indicators to send child creation/destroy events to the access bridge. // For this, the data member of the event must not be NULL. @@ -1618,10 +1630,10 @@ void Window::ImplSetReallyVisible() void Window::ImplCallInitShow() { - mpWindowImpl->mbReallyShown = TRUE; - mpWindowImpl->mbInInitShow = TRUE; + mpWindowImpl->mbReallyShown = sal_True; + mpWindowImpl->mbInInitShow = sal_True; StateChanged( STATE_CHANGE_INITSHOW ); - mpWindowImpl->mbInInitShow = FALSE; + mpWindowImpl->mbInInitShow = sal_False; Window* pWindow = mpWindowImpl->mpFirstOverlap; while ( pWindow ) @@ -1677,7 +1689,7 @@ void Window::ImplInitResolutionSettings() if ( mpWindowImpl->mbFrame ) { const StyleSettings& rStyleSettings = maSettings.GetStyleSettings(); - USHORT nScreenZoom = rStyleSettings.GetScreenZoom(); + sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom(); mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100; mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100; SetPointFont( rStyleSettings.GetAppFont() ); @@ -1703,7 +1715,7 @@ void Window::ImplInitResolutionSettings() void Window::ImplPointToLogic( Font& rFont ) const { Size aSize = rFont.GetSize(); - USHORT nScreenFontZoom = maSettings.GetStyleSettings().GetScreenFontZoom(); + sal_uInt16 nScreenFontZoom = maSettings.GetStyleSettings().GetScreenFontZoom(); if ( aSize.Width() ) { @@ -1730,7 +1742,7 @@ void Window::ImplPointToLogic( Font& rFont ) const void Window::ImplLogicToPoint( Font& rFont ) const { Size aSize = rFont.GetSize(); - USHORT nScreenFontZoom = maSettings.GetStyleSettings().GetScreenFontZoom(); + sal_uInt16 nScreenFontZoom = maSettings.GetStyleSettings().GetScreenFontZoom(); if ( IsMapModeEnabled() ) aSize = LogicToPixel( aSize ); @@ -1754,9 +1766,9 @@ void Window::ImplLogicToPoint( Font& rFont ) const // ----------------------------------------------------------------------- -BOOL Window::ImplSysObjClip( const Region* pOldRegion ) +sal_Bool Window::ImplSysObjClip( const Region* pOldRegion ) { - BOOL bUpdate = TRUE; + sal_Bool bUpdate = sal_True; if ( mpWindowImpl->mpSysObj ) { @@ -1781,7 +1793,7 @@ BOOL Window::ImplSysObjClip( const Region* pOldRegion ) Region aRegion = *pWinChildClipRegion; Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); Region aWinRectRegion( aWinRect ); - USHORT nClipFlags = mpWindowImpl->mpSysObj->GetClipRegionType(); + sal_uInt16 nClipFlags = mpWindowImpl->mpSysObj->GetClipRegionType(); if ( aRegion == aWinRectRegion ) mpWindowImpl->mpSysObj->ResetClipRegion(); @@ -1800,9 +1812,9 @@ BOOL Window::ImplSysObjClip( const Region* pOldRegion ) long nY; long nWidth; long nHeight; - ULONG nRectCount; + sal_uLong nRectCount; ImplRegionInfo aInfo; - BOOL bRegionRect; + sal_Bool bRegionRect; nRectCount = aRegion.GetRectCount(); mpWindowImpl->mpSysObj->BeginSetClipRegion( nRectCount ); @@ -1816,7 +1828,7 @@ BOOL Window::ImplSysObjClip( const Region* pOldRegion ) } } else - bVisibleState = FALSE; + bVisibleState = sal_False; } // Visible-Status updaten @@ -1880,31 +1892,31 @@ void Window::ImplUpdateSysObjClip() // ----------------------------------------------------------------------- -BOOL Window::ImplSetClipFlagChilds( BOOL bSysObjOnlySmaller ) +sal_Bool Window::ImplSetClipFlagChilds( sal_Bool bSysObjOnlySmaller ) { - BOOL bUpdate = TRUE; + sal_Bool bUpdate = sal_True; if ( mpWindowImpl->mpSysObj ) { Region* pOldRegion = NULL; if ( bSysObjOnlySmaller && !mpWindowImpl->mbInitWinClipRegion ) pOldRegion = new Region( mpWindowImpl->maWinClipRegion ); - mbInitClipRegion = TRUE; - mpWindowImpl->mbInitWinClipRegion = TRUE; + mbInitClipRegion = sal_True; + mpWindowImpl->mbInitWinClipRegion = sal_True; Window* pWindow = mpWindowImpl->mpFirstChild; while ( pWindow ) { if ( !pWindow->ImplSetClipFlagChilds( bSysObjOnlySmaller ) ) - bUpdate = FALSE; + bUpdate = sal_False; pWindow = pWindow->mpWindowImpl->mpNext; } if ( !ImplSysObjClip( pOldRegion ) ) { - mbInitClipRegion = TRUE; - mpWindowImpl->mbInitWinClipRegion = TRUE; - bUpdate = FALSE; + mbInitClipRegion = sal_True; + mpWindowImpl->mbInitWinClipRegion = sal_True; + bUpdate = sal_False; } if ( pOldRegion ) @@ -1912,14 +1924,14 @@ BOOL Window::ImplSetClipFlagChilds( BOOL bSysObjOnlySmaller ) } else { - mbInitClipRegion = TRUE; - mpWindowImpl->mbInitWinClipRegion = TRUE; + mbInitClipRegion = sal_True; + mpWindowImpl->mbInitWinClipRegion = sal_True; Window* pWindow = mpWindowImpl->mpFirstChild; while ( pWindow ) { if ( !pWindow->ImplSetClipFlagChilds( bSysObjOnlySmaller ) ) - bUpdate = FALSE; + bUpdate = sal_False; pWindow = pWindow->mpWindowImpl->mpNext; } } @@ -1928,15 +1940,15 @@ BOOL Window::ImplSetClipFlagChilds( BOOL bSysObjOnlySmaller ) // ----------------------------------------------------------------------- -BOOL Window::ImplSetClipFlagOverlapWindows( BOOL bSysObjOnlySmaller ) +sal_Bool Window::ImplSetClipFlagOverlapWindows( sal_Bool bSysObjOnlySmaller ) { - BOOL bUpdate = ImplSetClipFlagChilds( bSysObjOnlySmaller ); + sal_Bool bUpdate = ImplSetClipFlagChilds( bSysObjOnlySmaller ); Window* pWindow = mpWindowImpl->mpFirstOverlap; while ( pWindow ) { if ( !pWindow->ImplSetClipFlagOverlapWindows( bSysObjOnlySmaller ) ) - bUpdate = FALSE; + bUpdate = sal_False; pWindow = pWindow->mpWindowImpl->mpNext; } @@ -1945,18 +1957,18 @@ BOOL Window::ImplSetClipFlagOverlapWindows( BOOL bSysObjOnlySmaller ) // ----------------------------------------------------------------------- -BOOL Window::ImplSetClipFlag( BOOL bSysObjOnlySmaller ) +sal_Bool Window::ImplSetClipFlag( sal_Bool bSysObjOnlySmaller ) { if ( !ImplIsOverlapWindow() ) { - BOOL bUpdate = ImplSetClipFlagChilds( bSysObjOnlySmaller ); + sal_Bool bUpdate = ImplSetClipFlagChilds( bSysObjOnlySmaller ); Window* pParent = ImplGetParent(); if ( pParent && ((pParent->GetStyle() & WB_CLIPCHILDREN) || (mpWindowImpl->mnParentClipMode & PARENTCLIPMODE_CLIP)) ) { - pParent->mbInitClipRegion = TRUE; - pParent->mpWindowImpl->mbInitChildRegion = TRUE; + pParent->mbInitClipRegion = sal_True; + pParent->mpWindowImpl->mbInitChildRegion = sal_True; } // Schwestern muessen ihre ClipRegion auch neu berechnen @@ -1966,7 +1978,7 @@ BOOL Window::ImplSetClipFlag( BOOL bSysObjOnlySmaller ) while ( pWindow ) { if ( !pWindow->ImplSetClipFlagChilds( bSysObjOnlySmaller ) ) - bUpdate = FALSE; + bUpdate = sal_False; pWindow = pWindow->mpWindowImpl->mpNext; } } @@ -2046,7 +2058,7 @@ void Window::ImplExcludeOverlapWindows2( Region& rRegion ) // ----------------------------------------------------------------------- -void Window::ImplClipBoundaries( Region& rRegion, BOOL bThis, BOOL bOverlaps ) +void Window::ImplClipBoundaries( Region& rRegion, sal_Bool bThis, sal_Bool bOverlaps ) { if ( bThis ) ImplIntersectWindowClipRegion( rRegion ); @@ -2081,21 +2093,21 @@ void Window::ImplClipBoundaries( Region& rRegion, BOOL bThis, BOOL bOverlaps ) // ----------------------------------------------------------------------- -BOOL Window::ImplClipChilds( Region& rRegion ) +sal_Bool Window::ImplClipChilds( Region& rRegion ) { - BOOL bOtherClip = FALSE; + sal_Bool bOtherClip = sal_False; Window* pWindow = mpWindowImpl->mpFirstChild; while ( pWindow ) { if ( pWindow->mpWindowImpl->mbReallyVisible ) { // ParentClipMode-Flags auswerten - USHORT nClipMode = pWindow->GetParentClipMode(); + sal_uInt16 nClipMode = pWindow->GetParentClipMode(); if ( !(nClipMode & PARENTCLIPMODE_NOCLIP) && ((nClipMode & PARENTCLIPMODE_CLIP) || (GetStyle() & WB_CLIPCHILDREN)) ) pWindow->ImplExcludeWindowRegion( rRegion ); else - bOtherClip = TRUE; + bOtherClip = sal_True; } pWindow = pWindow->mpWindowImpl->mpNext; @@ -2149,13 +2161,13 @@ void Window::ImplInitWinClipRegion() ImplClipSiblings( mpWindowImpl->maWinClipRegion ); // Clip Parent Boundaries - ImplClipBoundaries( mpWindowImpl->maWinClipRegion, FALSE, TRUE ); + ImplClipBoundaries( mpWindowImpl->maWinClipRegion, sal_False, sal_True ); // Clip Children if ( (GetStyle() & WB_CLIPCHILDREN) || mpWindowImpl->mbClipChildren ) - mpWindowImpl->mbInitChildRegion = TRUE; + mpWindowImpl->mbInitChildRegion = sal_True; - mpWindowImpl->mbInitWinClipRegion = FALSE; + mpWindowImpl->mbInitWinClipRegion = sal_False; } // ----------------------------------------------------------------------- @@ -2180,7 +2192,7 @@ void Window::ImplInitWinChildClipRegion() ImplClipChilds( *mpWindowImpl->mpChildClipRegion ); } - mpWindowImpl->mbInitChildRegion = FALSE; + mpWindowImpl->mbInitChildRegion = sal_False; } // ----------------------------------------------------------------------- @@ -2261,7 +2273,7 @@ void Window::ImplCalcOverlapRegionOverlaps( const Region& rInterRegion, Region& // ----------------------------------------------------------------------- void Window::ImplCalcOverlapRegion( const Rectangle& rSourceRect, Region& rRegion, - BOOL bChilds, BOOL bParent, BOOL bSiblings ) + sal_Bool bChilds, sal_Bool bParent, sal_Bool bSiblings ) { Region aRegion( rSourceRect ); if ( mpWindowImpl->mbWinRegion ) @@ -2333,13 +2345,13 @@ void Window::ImplCalcOverlapRegion( const Rectangle& rSourceRect, Region& rRegio // ----------------------------------------------------------------------- -void Window::ImplCallPaint( const Region* pRegion, USHORT nPaintFlags ) +void Window::ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags ) { // call PrePaint. PrePaint may add to the invalidate region as well as // other parameters used below. PrePaint(); - mpWindowImpl->mbPaintFrame = FALSE; + mpWindowImpl->mbPaintFrame = sal_False; if ( nPaintFlags & IMPL_PAINT_PAINTALLCHILDS ) mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINT | IMPL_PAINT_PAINTALLCHILDS | (nPaintFlags & IMPL_PAINT_PAINTALL); @@ -2393,8 +2405,8 @@ void Window::ImplCallPaint( const Region* pRegion, USHORT nPaintFlags ) if ( mpWindowImpl->mpCursor ) mpWindowImpl->mpCursor->ImplHide(); - mbInitClipRegion = TRUE; - mpWindowImpl->mbInPaint = TRUE; + mbInitClipRegion = sal_True; + mpWindowImpl->mbInPaint = sal_True; // Paint-Region zuruecksetzen Region aPaintRegion( mpWindowImpl->maInvalidateRegion ); @@ -2434,11 +2446,11 @@ void Window::ImplCallPaint( const Region* pRegion, USHORT nPaintFlags ) if ( mpWindowImpl->mbFocusVisible ) ImplInvertFocus( *(mpWindowImpl->mpWinData->mpFocusRect) ); } - mpWindowImpl->mbInPaint = FALSE; - mbInitClipRegion = TRUE; + mpWindowImpl->mbInPaint = sal_False; + mbInitClipRegion = sal_True; mpWindowImpl->mpPaintRegion = NULL; if ( mpWindowImpl->mpCursor ) - mpWindowImpl->mpCursor->ImplShow( FALSE ); + mpWindowImpl->mpCursor->ImplShow( sal_False ); } } else @@ -2464,7 +2476,7 @@ void Window::ImplCallPaint( const Region* pRegion, USHORT nPaintFlags ) // #98943# draw toolbox selection if( !aSelectionRect.IsEmpty() ) - DrawSelectionBackground( aSelectionRect, 3, FALSE, TRUE, FALSE ); + DrawSelectionBackground( aSelectionRect, 3, sal_False, sal_True, sal_False ); if ( pChildRegion ) delete pChildRegion; @@ -2531,14 +2543,14 @@ IMPL_LINK( Window, ImplHandleResizeTimerHdl, void*, EMPTYARG ) // ----------------------------------------------------------------------- -void Window::ImplInvalidateFrameRegion( const Region* pRegion, USHORT nFlags ) +void Window::ImplInvalidateFrameRegion( const Region* pRegion, sal_uInt16 nFlags ) { // PAINTCHILDS bei allen Parent-Fenster bis zum ersten OverlapWindow // setzen if ( !ImplIsOverlapWindow() ) { Window* pTempWindow = this; - USHORT nTranspPaint = IsPaintTransparent() ? IMPL_PAINT_PAINT : 0; + sal_uInt16 nTranspPaint = IsPaintTransparent() ? IMPL_PAINT_PAINT : 0; do { pTempWindow = pTempWindow->ImplGetParent(); @@ -2596,7 +2608,7 @@ void Window::ImplInvalidateOverlapFrameRegion( const Region& rRegion ) { Region aRegion = rRegion; - ImplClipBoundaries( aRegion, TRUE, TRUE ); + ImplClipBoundaries( aRegion, sal_True, sal_True ); if ( !aRegion.IsEmpty() ) ImplInvalidateFrameRegion( &aRegion, INVALIDATE_CHILDREN ); @@ -2626,7 +2638,7 @@ void Window::ImplInvalidateParentFrameRegion( Region& rRegion ) // ----------------------------------------------------------------------- -void Window::ImplInvalidate( const Region* pRegion, USHORT nFlags ) +void Window::ImplInvalidate( const Region* pRegion, sal_uInt16 nFlags ) { // Hintergrund-Sicherung zuruecksetzen @@ -2634,7 +2646,7 @@ void Window::ImplInvalidate( const Region* pRegion, USHORT nFlags ) ImplInvalidateAllOverlapBackgrounds(); // Feststellen, was neu ausgegeben werden muss - BOOL bInvalidateAll = !pRegion; + sal_Bool bInvalidateAll = !pRegion; // Transparent-Invalidate beruecksichtigen Window* pOpaqueWindow = this; @@ -2647,7 +2659,7 @@ void Window::ImplInvalidate( const Region* pRegion, USHORT nFlags ) { pOpaqueWindow = pTempWindow; nFlags |= INVALIDATE_CHILDREN; - bInvalidateAll = FALSE; + bInvalidateAll = sal_False; break; } @@ -2659,7 +2671,7 @@ void Window::ImplInvalidate( const Region* pRegion, USHORT nFlags ) } // Region zusammenbauen - USHORT nOrgFlags = nFlags; + sal_uInt16 nOrgFlags = nFlags; if ( !(nFlags & (INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN)) ) { if ( GetStyle() & WB_CLIPCHILDREN ) @@ -2668,7 +2680,7 @@ void Window::ImplInvalidate( const Region* pRegion, USHORT nFlags ) nFlags |= INVALIDATE_CHILDREN; } if ( (nFlags & INVALIDATE_NOCHILDREN) && mpWindowImpl->mpFirstChild ) - bInvalidateAll = FALSE; + bInvalidateAll = sal_False; if ( bInvalidateAll ) ImplInvalidateFrameRegion( NULL, nFlags ); else @@ -2687,7 +2699,7 @@ void Window::ImplInvalidate( const Region* pRegion, USHORT nFlags ) else aRegion.Intersect( *pRegion ); } - ImplClipBoundaries( aRegion, TRUE, TRUE ); + ImplClipBoundaries( aRegion, sal_True, sal_True ); if ( nFlags & INVALIDATE_NOCHILDREN ) { nFlags &= ~INVALIDATE_CHILDREN; @@ -2714,7 +2726,7 @@ void Window::ImplInvalidate( const Region* pRegion, USHORT nFlags ) void Window::ImplMoveInvalidateRegion( const Rectangle& rRect, long nHorzScroll, long nVertScroll, - BOOL bChilds ) + sal_Bool bChilds ) { if ( (mpWindowImpl->mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTALL)) == IMPL_PAINT_PAINT ) { @@ -2729,7 +2741,7 @@ void Window::ImplMoveInvalidateRegion( const Rectangle& rRect, Window* pWindow = mpWindowImpl->mpFirstChild; while ( pWindow ) { - pWindow->ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, TRUE ); + pWindow->ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, sal_True ); pWindow = pWindow->mpWindowImpl->mpNext; } } @@ -2739,7 +2751,7 @@ void Window::ImplMoveInvalidateRegion( const Rectangle& rRect, void Window::ImplMoveAllInvalidateRegions( const Rectangle& rRect, long nHorzScroll, long nVertScroll, - BOOL bChilds ) + sal_Bool bChilds ) { // Paint-Region auch verschieben, wenn noch Paints anstehen ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, bChilds ); @@ -2767,7 +2779,7 @@ void Window::ImplMoveAllInvalidateRegions( const Rectangle& rRect, if ( !aPaintAllRegion.IsEmpty() ) { aPaintAllRegion.Move( nHorzScroll, nVertScroll ); - USHORT nPaintFlags = 0; + sal_uInt16 nPaintFlags = 0; if ( bChilds ) mpWindowImpl->mnPaintFlags |= INVALIDATE_CHILDREN; ImplInvalidateFrameRegion( &aPaintAllRegion, nPaintFlags ); @@ -2777,7 +2789,7 @@ void Window::ImplMoveAllInvalidateRegions( const Rectangle& rRect, // ----------------------------------------------------------------------- -void Window::ImplValidateFrameRegion( const Region* pRegion, USHORT nFlags ) +void Window::ImplValidateFrameRegion( const Region* pRegion, sal_uInt16 nFlags ) { if ( !pRegion ) mpWindowImpl->maInvalidateRegion.SetEmpty(); @@ -2822,11 +2834,11 @@ void Window::ImplValidateFrameRegion( const Region* pRegion, USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::ImplValidate( const Region* pRegion, USHORT nFlags ) +void Window::ImplValidate( const Region* pRegion, sal_uInt16 nFlags ) { // Region zusammenbauen - BOOL bValidateAll = !pRegion; - USHORT nOrgFlags = nFlags; + sal_Bool bValidateAll = !pRegion; + sal_uInt16 nOrgFlags = nFlags; if ( !(nFlags & (VALIDATE_CHILDREN | VALIDATE_NOCHILDREN)) ) { if ( GetStyle() & WB_CLIPCHILDREN ) @@ -2835,7 +2847,7 @@ void Window::ImplValidate( const Region* pRegion, USHORT nFlags ) nFlags |= VALIDATE_CHILDREN; } if ( (nFlags & VALIDATE_NOCHILDREN) && mpWindowImpl->mpFirstChild ) - bValidateAll = FALSE; + bValidateAll = sal_False; if ( bValidateAll ) ImplValidateFrameRegion( NULL, nFlags ); else @@ -2844,7 +2856,7 @@ void Window::ImplValidate( const Region* pRegion, USHORT nFlags ) Region aRegion( aRect ); if ( pRegion ) aRegion.Intersect( *pRegion ); - ImplClipBoundaries( aRegion, TRUE, TRUE ); + ImplClipBoundaries( aRegion, sal_True, sal_True ); if ( nFlags & VALIDATE_NOCHILDREN ) { nFlags &= ~VALIDATE_CHILDREN; @@ -2864,7 +2876,7 @@ void Window::ImplValidate( const Region* pRegion, USHORT nFlags ) // ----------------------------------------------------------------------- void Window::ImplScroll( const Rectangle& rRect, - long nHorzScroll, long nVertScroll, USHORT nFlags ) + long nHorzScroll, long nVertScroll, sal_uInt16 nFlags ) { if ( !IsDeviceOutputNecessary() ) return; @@ -2882,7 +2894,7 @@ void Window::ImplScroll( const Rectangle& rRect, if ( mpWindowImpl->mpCursor ) mpWindowImpl->mpCursor->ImplHide(); - USHORT nOrgFlags = nFlags; + sal_uInt16 nOrgFlags = nFlags; if ( !(nFlags & (SCROLL_CHILDREN | SCROLL_NOCHILDREN)) ) { if ( GetStyle() & WB_CLIPCHILDREN ) @@ -2892,14 +2904,14 @@ void Window::ImplScroll( const Rectangle& rRect, } Region aInvalidateRegion; - BOOL bScrollChilds = (nFlags & SCROLL_CHILDREN) != 0; - BOOL bErase = (nFlags & SCROLL_NOERASE) == 0; + sal_Bool bScrollChilds = (nFlags & SCROLL_CHILDREN) != 0; + sal_Bool bErase = (nFlags & SCROLL_NOERASE) == 0; if ( !mpWindowImpl->mpFirstChild ) - bScrollChilds = FALSE; + bScrollChilds = sal_False; // --- RTL --- check if this window requires special action - BOOL bReMirror = ( ImplIsAntiparallel() ); + sal_Bool bReMirror = ( ImplIsAntiparallel() ); Rectangle aRectMirror( rRect ); if( bReMirror ) @@ -2914,7 +2926,7 @@ void Window::ImplScroll( const Rectangle& rRect, if ( !(nFlags & SCROLL_NOINVALIDATE) ) { - ImplCalcOverlapRegion( aRectMirror, aInvalidateRegion, !bScrollChilds, TRUE, FALSE ); + ImplCalcOverlapRegion( aRectMirror, aInvalidateRegion, !bScrollChilds, sal_True, sal_False ); // --- RTL --- // if the scrolling on the device is performed in the opposite direction @@ -2924,7 +2936,7 @@ void Window::ImplScroll( const Rectangle& rRect, if ( !aInvalidateRegion.IsEmpty() ) { aInvalidateRegion.Move( bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll ); - bErase = TRUE; + bErase = sal_True; } if ( !(nFlags & SCROLL_NOWINDOWINVALIDATE) ) { @@ -2946,7 +2958,7 @@ void Window::ImplScroll( const Rectangle& rRect, aRegion.Exclude( aInvalidateRegion ); - ImplClipBoundaries( aRegion, FALSE, TRUE ); + ImplClipBoundaries( aRegion, sal_False, sal_True ); if ( !bScrollChilds ) { if ( nOrgFlags & SCROLL_NOCHILDREN ) @@ -2997,7 +3009,7 @@ void Window::ImplScroll( const Rectangle& rRect, // so it has to be re-mirrored before calling the Paint-handler mpWindowImpl->mnPaintFlags |= IMPL_PAINT_CHECKRTL; - USHORT nPaintFlags = INVALIDATE_CHILDREN; + sal_uInt16 nPaintFlags = INVALIDATE_CHILDREN; if ( !bErase ) nPaintFlags |= INVALIDATE_NOERASE; if ( !bScrollChilds ) @@ -3027,24 +3039,24 @@ void Window::ImplScroll( const Rectangle& rRect, Update(); if ( mpWindowImpl->mpCursor ) - mpWindowImpl->mpCursor->ImplShow( FALSE ); + mpWindowImpl->mpCursor->ImplShow( sal_False ); } // ----------------------------------------------------------------------- -void Window::ImplUpdateAll( BOOL bOverlapWindows ) +void Window::ImplUpdateAll( sal_Bool bOverlapWindows ) { if ( !mpWindowImpl->mbReallyVisible ) return; - BOOL bFlush = FALSE; + sal_Bool bFlush = sal_False; if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame ) { Point aPoint( 0, 0 ); Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) ); ImplInvalidateOverlapFrameRegion( aRegion ); if ( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) ) - bFlush = TRUE; + bFlush = sal_True; } // Ein Update wirkt immer auf das OverlapWindow, damit bei spaeteren @@ -3103,9 +3115,9 @@ void Window::ImplUpdateWindowPtr() // ----------------------------------------------------------------------- -void Window::ImplUpdateOverlapWindowPtr( BOOL bNewFrame ) +void Window::ImplUpdateOverlapWindowPtr( sal_Bool bNewFrame ) { - BOOL bVisible = IsVisible(); + sal_Bool bVisible = IsVisible(); Show( false ); ImplRemoveWindow( bNewFrame ); Window* pRealParent = mpWindowImpl->mpRealParent; @@ -3132,9 +3144,9 @@ void Window::ImplUpdateOverlapWindowPtr( BOOL bNewFrame ) // ----------------------------------------------------------------------- -BOOL Window::ImplUpdatePos() +sal_Bool Window::ImplUpdatePos() { - BOOL bSysChild = FALSE; + sal_Bool bSysChild = sal_False; if ( ImplIsOverlapWindow() ) { @@ -3153,12 +3165,12 @@ BOOL Window::ImplUpdatePos() while ( pChild ) { if ( pChild->ImplUpdatePos() ) - bSysChild = TRUE; + bSysChild = sal_True; pChild = pChild->mpWindowImpl->mpNext; } if ( mpWindowImpl->mpSysObj ) - bSysChild = TRUE; + bSysChild = sal_True; return bSysChild; } @@ -3180,11 +3192,11 @@ void Window::ImplUpdateSysObjPos() // ----------------------------------------------------------------------- void Window::ImplPosSizeWindow( long nX, long nY, - long nWidth, long nHeight, USHORT nFlags ) + long nWidth, long nHeight, sal_uInt16 nFlags ) { - BOOL bNewPos = FALSE; - BOOL bNewSize = FALSE; - BOOL bCopyBits = FALSE; + sal_Bool bNewPos = sal_False; + sal_Bool bNewSize = sal_False; + sal_Bool bCopyBits = sal_False; long nOldOutOffX = mnOutOffX; long nOldOutOffY = mnOutOffY; long nOldOutWidth = mnOutWidth; @@ -3206,17 +3218,17 @@ void Window::ImplPosSizeWindow( long nX, long nY, if ( mnOutWidth && mnOutHeight && !mpWindowImpl->mbPaintTransparent && !mpWindowImpl->mbInitWinClipRegion && !mpWindowImpl->maWinClipRegion.IsEmpty() && !HasPaintEvent() ) - bCopyBits = TRUE; + bCopyBits = sal_True; } - BOOL bnXRecycled = FALSE; // avoid duplicate mirroring in RTL case + sal_Bool bnXRecycled = sal_False; // avoid duplicate mirroring in RTL case if ( nFlags & WINDOW_POSSIZE_WIDTH ) { if(!( nFlags & WINDOW_POSSIZE_X )) { nX = mpWindowImpl->mnX; nFlags |= WINDOW_POSSIZE_X; - bnXRecycled = TRUE; // we're using a mnX which was already mirrored in RTL case + bnXRecycled = sal_True; // we're using a mnX which was already mirrored in RTL case } if ( nWidth < 0 ) @@ -3224,8 +3236,8 @@ void Window::ImplPosSizeWindow( long nX, long nY, if ( nWidth != mnOutWidth ) { mnOutWidth = nWidth; - bNewSize = TRUE; - bCopyBits = FALSE; + bNewSize = sal_True; + bCopyBits = sal_False; } } if ( nFlags & WINDOW_POSSIZE_HEIGHT ) @@ -3235,8 +3247,8 @@ void Window::ImplPosSizeWindow( long nX, long nY, if ( nHeight != mnOutHeight ) { mnOutHeight = nHeight; - bNewSize = TRUE; - bCopyBits = FALSE; + bNewSize = sal_True; + bCopyBits = sal_False; } } @@ -3286,12 +3298,12 @@ void Window::ImplPosSizeWindow( long nX, long nY, pOverlapRegion = new Region(); ImplCalcOverlapRegion( Rectangle( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ), - *pOverlapRegion, FALSE, TRUE, TRUE ); + *pOverlapRegion, sal_False, sal_True, sal_True ); } mpWindowImpl->mnX = nX; mpWindowImpl->maPos.X() = nOrgX; mpWindowImpl->mnAbsScreenX = aPtDev.X(); // --- RTL --- (store real screen pos) - bNewPos = TRUE; + bNewPos = sal_True; } } if ( nFlags & WINDOW_POSSIZE_Y ) @@ -3304,11 +3316,11 @@ void Window::ImplPosSizeWindow( long nX, long nY, pOverlapRegion = new Region(); ImplCalcOverlapRegion( Rectangle( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ), - *pOverlapRegion, FALSE, TRUE, TRUE ); + *pOverlapRegion, sal_False, sal_True, sal_True ); } mpWindowImpl->mnY = nY; mpWindowImpl->maPos.Y() = nY; - bNewPos = TRUE; + bNewPos = sal_True; } } @@ -3324,7 +3336,7 @@ void Window::ImplPosSizeWindow( long nX, long nY, */ if ( bNewPos || bNewSize ) { - BOOL bUpdateSysObjPos = FALSE; + sal_Bool bUpdateSysObjPos = sal_False; if ( bNewPos ) bUpdateSysObjPos = ImplUpdatePos(); @@ -3351,7 +3363,7 @@ void Window::ImplPosSizeWindow( long nX, long nY, } else { - mpWindowImpl->mpClientWindow->mpWindowImpl->mbCallMove = TRUE; + mpWindowImpl->mpClientWindow->mpWindowImpl->mbCallMove = sal_True; } } } @@ -3377,12 +3389,12 @@ void Window::ImplPosSizeWindow( long nX, long nY, else { if ( bNewPos ) - mpWindowImpl->mbCallMove = TRUE; + mpWindowImpl->mbCallMove = sal_True; if ( bNewSize ) - mpWindowImpl->mbCallResize = TRUE; + mpWindowImpl->mbCallResize = sal_True; } - BOOL bUpdateSysObjClip = FALSE; + sal_Bool bUpdateSysObjClip = sal_False; if ( IsReallyVisible() ) { if ( bNewPos || bNewSize ) @@ -3393,7 +3405,7 @@ void Window::ImplPosSizeWindow( long nX, long nY, if ( mpWindowImpl->mpFrameData->mpFirstBackWin ) ImplInvalidateAllOverlapBackgrounds(); // Clip-Flag neu setzen - bUpdateSysObjClip = !ImplSetClipFlag( TRUE ); + bUpdateSysObjClip = !ImplSetClipFlag( sal_True ); } // Fensterinhalt invalidieren ? @@ -3401,8 +3413,8 @@ void Window::ImplPosSizeWindow( long nX, long nY, { if ( bNewPos ) { - BOOL bInvalidate = FALSE; - BOOL bParentPaint = TRUE; + sal_Bool bInvalidate = sal_False; + sal_Bool bParentPaint = sal_True; if ( !ImplIsOverlapWindow() ) bParentPaint = mpWindowImpl->mpParent->IsPaintEnabled(); if ( bCopyBits && bParentPaint && !HasPaintEvent() ) @@ -3412,7 +3424,7 @@ void Window::ImplPosSizeWindow( long nX, long nY, Size( mnOutWidth, mnOutHeight ) ) ); if ( mpWindowImpl->mbWinRegion ) aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); - ImplClipBoundaries( aRegion, FALSE, TRUE ); + ImplClipBoundaries( aRegion, sal_False, sal_True ); if ( !pOverlapRegion->IsEmpty() ) { pOverlapRegion->Move( mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY ); @@ -3424,7 +3436,7 @@ void Window::ImplPosSizeWindow( long nX, long nY, ImplMoveAllInvalidateRegions( Rectangle( Point( nOldOutOffX, nOldOutOffY ), Size( nOldOutWidth, nOldOutHeight ) ), mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY, - TRUE ); + sal_True ); SalGraphics* pGraphics = ImplGetFrameGraphics(); if ( pGraphics ) { @@ -3437,10 +3449,10 @@ void Window::ImplPosSizeWindow( long nX, long nY, SAL_COPYAREA_WINDOWINVALIDATE, this ); } else - bInvalidate = TRUE; + bInvalidate = sal_True; } else - bInvalidate = TRUE; + bInvalidate = sal_True; if ( !bInvalidate ) { if ( !pOverlapRegion->IsEmpty() ) @@ -3448,10 +3460,10 @@ void Window::ImplPosSizeWindow( long nX, long nY, } } else - bInvalidate = TRUE; + bInvalidate = sal_True; } else - bInvalidate = TRUE; + bInvalidate = sal_True; if ( bInvalidate ) ImplInvalidateFrameRegion( NULL, INVALIDATE_CHILDREN ); } @@ -3463,7 +3475,7 @@ void Window::ImplPosSizeWindow( long nX, long nY, aRegion.Exclude( *pOldRegion ); if ( mpWindowImpl->mbWinRegion ) aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); - ImplClipBoundaries( aRegion, FALSE, TRUE ); + ImplClipBoundaries( aRegion, sal_False, sal_True ); if ( !aRegion.IsEmpty() ) ImplInvalidateFrameRegion( &aRegion, INVALIDATE_CHILDREN ); } @@ -3476,7 +3488,7 @@ void Window::ImplPosSizeWindow( long nX, long nY, Region aRegion( *pOldRegion ); if ( !mpWindowImpl->mbPaintTransparent ) ImplExcludeWindowRegion( aRegion ); - ImplClipBoundaries( aRegion, FALSE, TRUE ); + ImplClipBoundaries( aRegion, sal_False, sal_True ); if ( !aRegion.IsEmpty() && !mpWindowImpl->mpBorderWindow ) ImplInvalidateParentFrameRegion( aRegion ); } @@ -3567,7 +3579,7 @@ void Window::ImplCalcChildOverlapToTop( ImplCalcToTopData* pPrevData ) // ----------------------------------------------------------------------- -void Window::ImplToTop( USHORT nFlags ) +void Window::ImplToTop( sal_uInt16 nFlags ) { DBG_ASSERT( ImplIsOverlapWindow(), "Window::ImplToTop(): Is not a OverlapWindow" ); @@ -3584,7 +3596,7 @@ void Window::ImplToTop( USHORT nFlags ) // do not bring floating windows on the client to top if( !ImplGetClientWindow() || !(ImplGetClientWindow()->GetStyle() & WB_SYSTEMFLOATWIN) ) { - USHORT nSysFlags = 0; + sal_uInt16 nSysFlags = 0; if ( nFlags & TOTOP_RESTOREWHENMIN ) nSysFlags |= SAL_FRAME_TOTOP_RESTOREWHENMIN; if ( nFlags & TOTOP_FOREGROUNDTASK ) @@ -3607,7 +3619,7 @@ void Window::ImplToTop( USHORT nFlags ) mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = mpWindowImpl->mpPrev; // AlwaysOnTop beruecksichtigen - BOOL bOnTop = IsAlwaysOnTopEnabled(); + sal_Bool bOnTop = IsAlwaysOnTopEnabled(); Window* pNextWin = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap; if ( !bOnTop ) { @@ -3620,7 +3632,7 @@ void Window::ImplToTop( USHORT nFlags ) } // TopLevel abpruefen - BYTE nTopLevel = mpWindowImpl->mpOverlapData->mnTopLevel; + sal_uInt8 nTopLevel = mpWindowImpl->mpOverlapData->mnTopLevel; while ( pNextWin ) { if ( (bOnTop != pNextWin->IsAlwaysOnTopEnabled()) || @@ -3661,7 +3673,7 @@ void Window::ImplToTop( USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::ImplStartToTop( USHORT nFlags ) +void Window::ImplStartToTop( sal_uInt16 nFlags ) { ImplCalcToTopData aStartData; ImplCalcToTopData* pCurData; @@ -3716,7 +3728,7 @@ void Window::ImplStartToTop( USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::ImplFocusToTop( USHORT nFlags, BOOL bReallyVisible ) +void Window::ImplFocusToTop( sal_uInt16 nFlags, sal_Bool bReallyVisible ) { // Soll Focus auch geholt werden? if ( !(nFlags & TOTOP_NOGRABFOCUS) ) @@ -3735,7 +3747,7 @@ void Window::ImplFocusToTop( USHORT nFlags, BOOL bReallyVisible ) pFocusWindow = pFocusWindow->ImplGetParent(); } if ( (pFocusWindow->mpWindowImpl->mnActivateMode & ACTIVATE_MODE_GRABFOCUS) && - !pFocusWindow->HasChildPathFocus( TRUE ) ) + !pFocusWindow->HasChildPathFocus( sal_True ) ) pFocusWindow->GrabFocus(); } @@ -3753,7 +3765,7 @@ void Window::ImplShowAllOverlaps() if ( pOverlapWindow->mpWindowImpl->mbOverlapVisible ) { pOverlapWindow->Show( true, SHOW_NOACTIVATE ); - pOverlapWindow->mpWindowImpl->mbOverlapVisible = FALSE; + pOverlapWindow->mpWindowImpl->mbOverlapVisible = sal_False; } pOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext; @@ -3769,7 +3781,7 @@ void Window::ImplHideAllOverlaps() { if ( pOverlapWindow->IsVisible() ) { - pOverlapWindow->mpWindowImpl->mbOverlapVisible = TRUE; + pOverlapWindow->mpWindowImpl->mbOverlapVisible = sal_True; pOverlapWindow->Show( false ); } @@ -3779,24 +3791,24 @@ void Window::ImplHideAllOverlaps() // ----------------------------------------------------------------------- -void Window::ImplCallMouseMove( USHORT nMouseCode, BOOL bModChanged ) +void Window::ImplCallMouseMove( sal_uInt16 nMouseCode, sal_Bool bModChanged ) { if ( mpWindowImpl->mpFrameData->mbMouseIn && mpWindowImpl->mpFrameWindow->mpWindowImpl->mbReallyVisible ) { - ULONG nTime = Time::GetSystemTicks(); + sal_uLong nTime = Time::GetSystemTicks(); long nX = mpWindowImpl->mpFrameData->mnLastMouseX; long nY = mpWindowImpl->mpFrameData->mnLastMouseY; - USHORT nCode = nMouseCode; - USHORT nMode = mpWindowImpl->mpFrameData->mnMouseMode; - BOOL bLeave; + sal_uInt16 nCode = nMouseCode; + sal_uInt16 nMode = mpWindowImpl->mpFrameData->mnMouseMode; + sal_Bool bLeave; // Auf MouseLeave testen if ( ((nX < 0) || (nY < 0) || (nX >= mpWindowImpl->mpFrameWindow->mnOutWidth) || (nY >= mpWindowImpl->mpFrameWindow->mnOutHeight)) && !ImplGetSVData()->maWinData.mpCaptureWin ) - bLeave = TRUE; + bLeave = sal_True; else - bLeave = FALSE; + bLeave = sal_False; nMode |= MOUSE_SYNTHETIC; if ( bModChanged ) nMode |= MOUSE_MODIFIERCHANGED; @@ -3843,8 +3855,8 @@ void Window::ImplCallFocusChangeActivate( Window* pNewOverlapWindow, Window* pNewRealWindow; Window* pOldRealWindow; Window* pLastRealWindow; - BOOL bCallActivate = TRUE; - BOOL bCallDeactivate = TRUE; + sal_Bool bCallActivate = sal_True; + sal_Bool bCallDeactivate = sal_True; pOldRealWindow = pOldOverlapWindow->ImplGetWindow(); pNewRealWindow = pNewOverlapWindow->ImplGetWindow(); @@ -3855,7 +3867,7 @@ void Window::ImplCallFocusChangeActivate( Window* pNewOverlapWindow, !pNewRealWindow->GetActivateMode() ) { pSVData->maWinData.mpLastDeacWin = pOldOverlapWindow; - bCallDeactivate = FALSE; + bCallDeactivate = sal_False; } } else if ( (pNewRealWindow->GetType() != WINDOW_FLOATINGWINDOW) || @@ -3864,15 +3876,15 @@ void Window::ImplCallFocusChangeActivate( Window* pNewOverlapWindow, if ( pSVData->maWinData.mpLastDeacWin ) { if ( pSVData->maWinData.mpLastDeacWin == pNewOverlapWindow ) - bCallActivate = FALSE; + bCallActivate = sal_False; else { pLastRealWindow = pSVData->maWinData.mpLastDeacWin->ImplGetWindow(); - pSVData->maWinData.mpLastDeacWin->mpWindowImpl->mbActive = FALSE; + pSVData->maWinData.mpLastDeacWin->mpWindowImpl->mbActive = sal_False; pSVData->maWinData.mpLastDeacWin->Deactivate(); if ( pLastRealWindow != pSVData->maWinData.mpLastDeacWin ) { - pLastRealWindow->mpWindowImpl->mbActive = TRUE; + pLastRealWindow->mpWindowImpl->mbActive = sal_True; pLastRealWindow->Activate(); } } @@ -3884,14 +3896,14 @@ void Window::ImplCallFocusChangeActivate( Window* pNewOverlapWindow, { if( pOldOverlapWindow->mpWindowImpl->mbActive ) { - pOldOverlapWindow->mpWindowImpl->mbActive = FALSE; + pOldOverlapWindow->mpWindowImpl->mbActive = sal_False; pOldOverlapWindow->Deactivate(); } if ( pOldRealWindow != pOldOverlapWindow ) { if( pOldRealWindow->mpWindowImpl->mbActive ) { - pOldRealWindow->mpWindowImpl->mbActive = FALSE; + pOldRealWindow->mpWindowImpl->mbActive = sal_False; pOldRealWindow->Deactivate(); } } @@ -3900,14 +3912,14 @@ void Window::ImplCallFocusChangeActivate( Window* pNewOverlapWindow, { if( ! pNewOverlapWindow->mpWindowImpl->mbActive ) { - pNewOverlapWindow->mpWindowImpl->mbActive = TRUE; + pNewOverlapWindow->mpWindowImpl->mbActive = sal_True; pNewOverlapWindow->Activate(); } if ( pNewRealWindow != pNewOverlapWindow ) { if( ! pNewRealWindow->mpWindowImpl->mbActive ) { - pNewRealWindow->mpWindowImpl->mbActive = TRUE; + pNewRealWindow->mpWindowImpl->mbActive = sal_True; pNewRealWindow->Activate(); } } @@ -3929,7 +3941,7 @@ static bool IsWindowFocused(const WindowImpl& rWinImpl) } // ----------------------------------------------------------------------- -void Window::ImplGrabFocus( USHORT nFlags ) +void Window::ImplGrabFocus( sal_uInt16 nFlags ) { // #143570# no focus for destructing windows if( mpWindowImpl->mbInDtor ) @@ -3987,13 +3999,13 @@ void Window::ImplGrabFocus( USHORT nFlags ) // which is done using ToTop ImplSVData* pSVData = ImplGetSVData(); - BOOL bAsyncFocusWaiting = FALSE; + sal_Bool bAsyncFocusWaiting = sal_False; Window *pFrame = pSVData->maWinData.mpFirstFrame; while( pFrame ) { if( pFrame != mpWindowImpl->mpFrameWindow && pFrame->mpWindowImpl->mpFrameData->mnFocusId ) { - bAsyncFocusWaiting = TRUE; + bAsyncFocusWaiting = sal_True; break; } pFrame = pFrame->mpWindowImpl->mpFrameData->mpNextFrame; @@ -4001,7 +4013,7 @@ void Window::ImplGrabFocus( USHORT nFlags ) bool bHasFocus = IsWindowFocused(*mpWindowImpl); - BOOL bMustNotGrabFocus = FALSE; + sal_Bool bMustNotGrabFocus = sal_False; // #100242#, check parent hierarchy if some floater prohibits grab focus Window *pParent = this; @@ -4011,7 +4023,7 @@ void Window::ImplGrabFocus( USHORT nFlags ) // otherwise we cannot set the focus in a floating toolbox if( ( (pParent->mpWindowImpl->mbFloatWin && ((FloatingWindow*)pParent)->GrabsFocus()) || ( pParent->GetStyle() & WB_SYSTEMFLOATWIN ) ) && !( pParent->GetStyle() & WB_MOVEABLE ) ) { - bMustNotGrabFocus = TRUE; + bMustNotGrabFocus = sal_True; break; } pParent = pParent->mpWindowImpl->mpParent; @@ -4072,11 +4084,11 @@ void Window::ImplGrabFocus( USHORT nFlags ) { Window* pNewOverlapWindow = ImplGetFirstOverlapWindow(); Window* pNewRealWindow = pNewOverlapWindow->ImplGetWindow(); - pNewOverlapWindow->mpWindowImpl->mbActive = TRUE; + pNewOverlapWindow->mpWindowImpl->mbActive = sal_True; pNewOverlapWindow->Activate(); if ( pNewRealWindow != pNewOverlapWindow ) { - pNewRealWindow->mpWindowImpl->mbActive = TRUE; + pNewRealWindow->mpWindowImpl->mbActive = sal_True; pNewRealWindow->Activate(); } } @@ -4106,7 +4118,7 @@ void Window::ImplGrabFocus( USHORT nFlags ) { if ( mpWindowImpl->mpCursor ) mpWindowImpl->mpCursor->ImplShow(); - mpWindowImpl->mbInFocusHdl = TRUE; + mpWindowImpl->mbInFocusHdl = sal_True; mpWindowImpl->mnGetFocusFlags = nFlags; // if we're changing focus due to closing a popup floating window // notify the new focus window so it can restore the inner focus @@ -4123,7 +4135,7 @@ void Window::ImplGrabFocus( USHORT nFlags ) if( !aDogTag.IsDelete() ) { mpWindowImpl->mnGetFocusFlags = 0; - mpWindowImpl->mbInFocusHdl = FALSE; + mpWindowImpl->mbInFocusHdl = sal_False; } } } @@ -4243,6 +4255,8 @@ namespace Window::~Window() { + ImplFreeExtWindowImpl(); + vcl::LazyDeletor<Window>::Undelete( this ); DBG_DTOR( Window, ImplDbgCheckWindow ); @@ -4254,7 +4268,7 @@ Window::~Window() // Dispose of the canvas implementation (which, currently, has an // own wrapper window as a child to this one. - Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas ); + uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas ); if( xCanvas.is() ) { uno::Reference < lang::XComponent > xCanvasComponent( xCanvas, @@ -4263,7 +4277,7 @@ Window::~Window() xCanvasComponent->dispose(); } - mpWindowImpl->mbInDtor = TRUE; + mpWindowImpl->mbInDtor = sal_True; ImplCallEventListeners( VCLEVENT_OBJECT_DYING ); @@ -4299,12 +4313,12 @@ Window::~Window() // deregister drop target listener if( mpWindowImpl->mpFrameData->mxDropTargetListener.is() ) { - Reference< XDragGestureRecognizer > xDragGestureRecognizer = - Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY); + uno::Reference< XDragGestureRecognizer > xDragGestureRecognizer = + uno::Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY); if( xDragGestureRecognizer.is() ) { xDragGestureRecognizer->removeDragGestureListener( - Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY)); + uno::Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY)); } mpWindowImpl->mpFrameData->mxDropTarget->removeDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener ); @@ -4312,7 +4326,7 @@ Window::~Window() } // shutdown drag and drop for this frame window - Reference< XComponent > xComponent( mpWindowImpl->mpFrameData->mxDropTarget, UNO_QUERY ); + uno::Reference< XComponent > xComponent( mpWindowImpl->mpFrameData->mxDropTarget, UNO_QUERY ); // DNDEventDispatcher does not hold a reference of the DropTarget, // so it's ok if it does not support XComponent @@ -4326,7 +4340,7 @@ Window::~Window() } } - UnoWrapperBase* pWrapper = Application::GetUnoWrapper( FALSE ); + UnoWrapperBase* pWrapper = Application::GetUnoWrapper( sal_False ); if ( pWrapper ) pWrapper->WindowDestroyed( this ); @@ -4362,16 +4376,16 @@ Window::~Window() pSVData->maWinData.mpDefDialogParent = NULL; #ifdef DBG_UTIL - if ( TRUE ) // always perform these tests in non-pro versions + if ( sal_True ) // always perform these tests in non-pro versions { ByteString aErrorStr; - BOOL bError = FALSE; + sal_Bool bError = sal_False; Window* pTempWin = mpWindowImpl->mpFrameData->mpFirstOverlap; while ( pTempWin ) { if ( ImplIsRealParentPath( pTempWin ) ) { - bError = TRUE; + bError = sal_True; lcl_appendWindowInfo( aErrorStr, *pTempWin ); } pTempWin = pTempWin->mpWindowImpl->mpNextOverlap; @@ -4386,13 +4400,13 @@ Window::~Window() GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! } - bError = FALSE; + bError = sal_False; pTempWin = pSVData->maWinData.mpFirstFrame; while ( pTempWin ) { if ( ImplIsRealParentPath( pTempWin ) ) { - bError = TRUE; + bError = sal_True; lcl_appendWindowInfo( aErrorStr, *pTempWin ); } pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame; @@ -4499,11 +4513,11 @@ Window::~Window() } // check if the focus window is our child - BOOL bHasFocussedChild = FALSE; + sal_Bool bHasFocussedChild = sal_False; if( pSVData->maWinData.mpFocusWin && ImplIsRealParentPath( pSVData->maWinData.mpFocusWin ) ) { // #122232#, this must not happen and is an application bug ! but we try some cleanup to hopefully avoid crashes, see below - bHasFocussedChild = TRUE; + bHasFocussedChild = sal_True; #ifdef DBG_UTIL ByteString aTempStr( "Window (" ); aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); @@ -4589,18 +4603,18 @@ Window::~Window() ImplDelData* pDelData = mpWindowImpl->mpFirstDel; while ( pDelData ) { - pDelData->mbDel = TRUE; + pDelData->mbDel = sal_True; pDelData->mpWindow = NULL; // #112873# pDel is not associated with a Window anymore pDelData = pDelData->mpNext; } // Fenster aus den Listen austragen - ImplRemoveWindow( TRUE ); + ImplRemoveWindow( sal_True ); // de-register as "top window child" at our parent, if necessary if ( mpWindowImpl->mbFrame ) { - BOOL bIsTopWindow = mpWindowImpl->mpWinData && ( mpWindowImpl->mpWinData->mnIsTopWindow == 1 ); + sal_Bool bIsTopWindow = mpWindowImpl->mpWinData && ( mpWindowImpl->mpWinData->mnIsTopWindow == 1 ); if ( mpWindowImpl->mpRealParent && bIsTopWindow ) { ImplWinData* pParentWinData = mpWindowImpl->mpRealParent->ImplGetWinData(); @@ -4626,10 +4640,6 @@ Window::~Window() delete mpWindowImpl->mpWinData->mpFocusRect; if ( mpWindowImpl->mpWinData->mpTrackRect ) delete mpWindowImpl->mpWinData->mpTrackRect; - if ( mpWindowImpl->mpWinData->mpSmartHelpId ) - delete mpWindowImpl->mpWinData->mpSmartHelpId; - if ( mpWindowImpl->mpWinData->mpSmartUniqueId ) - delete mpWindowImpl->mpWinData->mpSmartUniqueId; delete mpWindowImpl->mpWinData; } @@ -4683,17 +4693,24 @@ void Window::doLazyDelete() vcl::LazyDeletor<Window>::Delete( this ); } -USHORT Window::GetIndicatorState() const +sal_uInt16 Window::GetIndicatorState() const { return mpWindowImpl->mpFrame->GetIndicatorState().mnState; } -void Window::SimulateKeyPress( USHORT nKeyCode ) const +void Window::SimulateKeyPress( sal_uInt16 nKeyCode ) const { mpWindowImpl->mpFrame->SimulateKeyPress(nKeyCode); } // ----------------------------------------------------------------------- +void Window::InterceptChildWindowKeyDown( sal_Bool bIntercept ) +{ + if( mpWindowImpl->mpSysObj ) + mpWindowImpl->mpSysObj->InterceptChildWindowKeyDown( bIntercept ); +} + +// ----------------------------------------------------------------------- void Window::MouseMove( const MouseEvent& rMEvt ) { @@ -4703,7 +4720,7 @@ void Window::MouseMove( const MouseEvent& rMEvt ) NotifyEvent aNEvt( EVENT_MOUSEMOVE, this, &rMEvt ); if ( !Notify( aNEvt ) ) - mpWindowImpl->mbMouseMove = TRUE; + mpWindowImpl->mbMouseMove = sal_True; } // ----------------------------------------------------------------------- @@ -4716,7 +4733,7 @@ void Window::MouseButtonDown( const MouseEvent& rMEvt ) NotifyEvent aNEvt( EVENT_MOUSEBUTTONDOWN, this, &rMEvt ); if ( !Notify( aNEvt ) ) - mpWindowImpl->mbMouseButtonDown = TRUE; + mpWindowImpl->mbMouseButtonDown = sal_True; } // ----------------------------------------------------------------------- @@ -4729,7 +4746,7 @@ void Window::MouseButtonUp( const MouseEvent& rMEvt ) NotifyEvent aNEvt( EVENT_MOUSEBUTTONUP, this, &rMEvt ); if ( !Notify( aNEvt ) ) - mpWindowImpl->mbMouseButtonUp = TRUE; + mpWindowImpl->mbMouseButtonUp = sal_True; } // ----------------------------------------------------------------------- @@ -4742,7 +4759,7 @@ void Window::KeyInput( const KeyEvent& rKEvt ) NotifyEvent aNEvt( EVENT_KEYINPUT, this, &rKEvt ); if ( !Notify( aNEvt ) ) - mpWindowImpl->mbKeyInput = TRUE; + mpWindowImpl->mbKeyInput = sal_True; } // ----------------------------------------------------------------------- @@ -4755,7 +4772,7 @@ void Window::KeyUp( const KeyEvent& rKEvt ) NotifyEvent aNEvt( EVENT_KEYUP, this, &rKEvt ); if ( !Notify( aNEvt ) ) - mpWindowImpl->mbKeyUp = TRUE; + mpWindowImpl->mbKeyUp = sal_True; } // ----------------------------------------------------------------------- @@ -4777,7 +4794,13 @@ void Window::Paint( const Rectangle& rRect ) // ----------------------------------------------------------------------- -void Window::Draw( OutputDevice*, const Point&, const Size&, ULONG ) +void Window::PostPaint() +{ +} + +// ----------------------------------------------------------------------- + +void Window::Draw( OutputDevice*, const Point&, const Size&, sal_uLong ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); } @@ -4881,29 +4904,18 @@ void Window::RequestHelp( const HelpEvent& rHEvt ) } else { - SmartId aSmartId = GetSmartHelpId(); - - ULONG nNumHelpId = 0; - String aStrHelpId; - if( aSmartId.HasString() ) - aStrHelpId = aSmartId.GetStr(); - if( aSmartId.HasNumeric() ) - nNumHelpId = aSmartId.GetNum(); - - if ( !nNumHelpId && aStrHelpId.Len() == 0 && ImplGetParent() ) + String aStrHelpId( rtl::OStringToOUString( GetHelpId(), RTL_TEXTENCODING_UTF8 ) ); + if ( aStrHelpId.Len() == 0 && ImplGetParent() ) ImplGetParent()->RequestHelp( rHEvt ); else { - if ( !nNumHelpId && aStrHelpId.Len() == 0 ) - nNumHelpId = OOO_HELP_INDEX; - Help* pHelp = Application::GetHelp(); if ( pHelp ) { if( aStrHelpId.Len() > 0 ) pHelp->Start( aStrHelpId, this ); else - pHelp->Start( nNumHelpId, this ); + pHelp->Start( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OOO_HELP_INDEX ) ), this ); } } } @@ -4921,7 +4933,7 @@ void Window::Command( const CommandEvent& rCEvt ) NotifyEvent aNEvt( EVENT_COMMAND, this, &rCEvt ); if ( !Notify( aNEvt ) ) - mpWindowImpl->mbCommand = TRUE; + mpWindowImpl->mbCommand = sal_True; } // ----------------------------------------------------------------------- @@ -4937,7 +4949,7 @@ void Window::Tracking( const TrackingEvent& rTEvt ) // ----------------------------------------------------------------------- -void Window::UserEvent( ULONG, void* ) +void Window::UserEvent( sal_uLong, void* ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); } @@ -5065,7 +5077,7 @@ long Window::PreNotify( NotifyEvent& rNEvt ) DBG_CHKTHIS( Window, ImplDbgCheckWindow ); } - long bDone = FALSE; + long bDone = sal_False; if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() ) bDone = mpWindowImpl->mpParent->PreNotify( rNEvt ); @@ -5073,11 +5085,11 @@ long Window::PreNotify( NotifyEvent& rNEvt ) { if( rNEvt.GetType() == EVENT_GETFOCUS ) { - BOOL bCompoundFocusChanged = FALSE; + sal_Bool bCompoundFocusChanged = sal_False; if ( mpWindowImpl->mbCompoundControl && !mpWindowImpl->mbCompoundControlHasFocus && HasChildPathFocus() ) { - mpWindowImpl->mbCompoundControlHasFocus = TRUE; - bCompoundFocusChanged = TRUE; + mpWindowImpl->mbCompoundControlHasFocus = sal_True; + bCompoundFocusChanged = sal_True; } if ( bCompoundFocusChanged || ( rNEvt.GetWindow() == this ) ) @@ -5085,11 +5097,11 @@ long Window::PreNotify( NotifyEvent& rNEvt ) } else if( rNEvt.GetType() == EVENT_LOSEFOCUS ) { - BOOL bCompoundFocusChanged = FALSE; + sal_Bool bCompoundFocusChanged = sal_False; if ( mpWindowImpl->mbCompoundControl && mpWindowImpl->mbCompoundControlHasFocus && !HasChildPathFocus() ) { - mpWindowImpl->mbCompoundControlHasFocus = FALSE ; - bCompoundFocusChanged = TRUE; + mpWindowImpl->mbCompoundControlHasFocus = sal_False ; + bCompoundFocusChanged = sal_True; } if ( bCompoundFocusChanged || ( rNEvt.GetWindow() == this ) ) @@ -5112,7 +5124,7 @@ long Window::Notify( NotifyEvent& rNEvt ) DBG_CHKTHIS( Window, ImplDbgCheckWindow ); } - long nRet = FALSE; + long nRet = sal_False; // check for docking window // but do nothing if window is docked and locked @@ -5122,27 +5134,27 @@ long Window::Notify( NotifyEvent& rNEvt ) if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) { const MouseEvent* pMEvt = rNEvt.GetMouseEvent(); - BOOL bHit = pWrapper->GetDragArea().IsInside( pMEvt->GetPosPixel() ); + sal_Bool bHit = pWrapper->GetDragArea().IsInside( pMEvt->GetPosPixel() ); if ( pMEvt->IsLeft() ) { if ( pMEvt->IsMod1() && (pMEvt->GetClicks() == 2) ) { // ctrl double click toggles floating mode pWrapper->SetFloatingMode( !pWrapper->IsFloatingMode() ); - return TRUE; + return sal_True; } else if ( pMEvt->GetClicks() == 1 && bHit) { // allow start docking during mouse move pWrapper->ImplEnableStartDocking(); - return TRUE; + return sal_True; } } } else if ( rNEvt.GetType() == EVENT_MOUSEMOVE ) { const MouseEvent* pMEvt = rNEvt.GetMouseEvent(); - BOOL bHit = pWrapper->GetDragArea().IsInside( pMEvt->GetPosPixel() ); + sal_Bool bHit = pWrapper->GetDragArea().IsInside( pMEvt->GetPosPixel() ); if ( pMEvt->IsLeft() ) { // check if a single click initiated this sequence ( ImplStartDockingEnabled() ) @@ -5159,7 +5171,7 @@ long Window::Notify( NotifyEvent& rNEvt ) } pWrapper->ImplStartDocking( aPos ); } - return TRUE; + return sal_True; } } else if( rNEvt.GetType() == EVENT_KEYINPUT ) @@ -5177,7 +5189,7 @@ long Window::Notify( NotifyEvent& rNEvt ) */ if( pWrapper->IsFloatingMode() ) ToTop( TOTOP_GRABFOCUSONLY ); - return TRUE; + return sal_True; } } } @@ -5200,7 +5212,7 @@ long Window::Notify( NotifyEvent& rNEvt ) if ( (rNEvt.GetWindow() == this) && (rNEvt.GetType() == EVENT_GETFOCUS) && !(GetStyle() & WB_TABSTOP) && !(mpWindowImpl->mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) ) { - USHORT n = 0; + sal_uInt16 n = 0; Window* pFirstChild = ImplGetDlgWindow( n, DLGWINDOW_FIRST ); if ( pFirstChild ) pFirstChild->ImplControlFocus(); @@ -5219,7 +5231,7 @@ long Window::Notify( NotifyEvent& rNEvt ) // ----------------------------------------------------------------------- -void Window::ImplCallEventListeners( ULONG nEvent, void* pData ) +void Window::ImplCallEventListeners( sal_uLong nEvent, void* pData ) { // The implementation was moved to CallEventListeners(), // because derived classes in svtools must be able to @@ -5232,7 +5244,7 @@ void Window::ImplCallEventListeners( ULONG nEvent, void* pData ) // ----------------------------------------------------------------------- -void Window::CallEventListeners( ULONG nEvent, void* pData ) +void Window::CallEventListeners( sal_uLong nEvent, void* pData ) { VclWindowEvent aEvent( this, nEvent, pData ); @@ -5302,25 +5314,25 @@ void Window::RemoveChildEventListener( const Link& rEventListener ) // ----------------------------------------------------------------------- -ULONG Window::PostUserEvent( ULONG nEvent, void* pEventData ) +sal_uLong Window::PostUserEvent( sal_uLong nEvent, void* pEventData ) { - ULONG nEventId; + sal_uLong nEventId; PostUserEvent( nEventId, nEvent, pEventData ); return nEventId; } // ----------------------------------------------------------------------- -ULONG Window::PostUserEvent( const Link& rLink, void* pCaller ) +sal_uLong Window::PostUserEvent( const Link& rLink, void* pCaller ) { - ULONG nEventId; + sal_uLong nEventId; PostUserEvent( nEventId, rLink, pCaller ); return nEventId; } // ----------------------------------------------------------------------- -BOOL Window::PostUserEvent( ULONG& rEventId, ULONG nEvent, void* pEventData ) +sal_Bool Window::PostUserEvent( sal_uLong& rEventId, sal_uLong nEvent, void* pEventData ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -5329,23 +5341,23 @@ BOOL Window::PostUserEvent( ULONG& rEventId, ULONG nEvent, void* pEventData ) pSVEvent->mpData = pEventData; pSVEvent->mpLink = NULL; pSVEvent->mpWindow = this; - pSVEvent->mbCall = TRUE; + pSVEvent->mbCall = sal_True; ImplAddDel( &(pSVEvent->maDelData) ); - rEventId = (ULONG)pSVEvent; + rEventId = (sal_uLong)pSVEvent; if ( mpWindowImpl->mpFrame->PostEvent( pSVEvent ) ) - return TRUE; + return sal_True; else { rEventId = 0; ImplRemoveDel( &(pSVEvent->maDelData) ); delete pSVEvent; - return FALSE; + return sal_False; } } // ----------------------------------------------------------------------- -BOOL Window::PostUserEvent( ULONG& rEventId, const Link& rLink, void* pCaller ) +sal_Bool Window::PostUserEvent( sal_uLong& rEventId, const Link& rLink, void* pCaller ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -5354,23 +5366,23 @@ BOOL Window::PostUserEvent( ULONG& rEventId, const Link& rLink, void* pCaller ) pSVEvent->mpData = pCaller; pSVEvent->mpLink = new Link( rLink ); pSVEvent->mpWindow = this; - pSVEvent->mbCall = TRUE; + pSVEvent->mbCall = sal_True; ImplAddDel( &(pSVEvent->maDelData) ); - rEventId = (ULONG)pSVEvent; + rEventId = (sal_uLong)pSVEvent; if ( mpWindowImpl->mpFrame->PostEvent( pSVEvent ) ) - return TRUE; + return sal_True; else { rEventId = 0; ImplRemoveDel( &(pSVEvent->maDelData) ); delete pSVEvent; - return FALSE; + return sal_False; } } // ----------------------------------------------------------------------- -void Window::RemoveUserEvent( ULONG nUserEvent ) +void Window::RemoveUserEvent( sal_uLong nUserEvent ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -5387,14 +5399,14 @@ void Window::RemoveUserEvent( ULONG nUserEvent ) pSVEvent->mpWindow = NULL; } - pSVEvent->mbCall = FALSE; + pSVEvent->mbCall = sal_False; } // ----------------------------------------------------------------------- IMPL_LINK( Window, ImplAsyncStateChangedHdl, void*, pState ) { - StateChanged( (StateChangedType)(ULONG)pState ); + StateChanged( (StateChangedType)(sal_uLong)pState ); return 0; } @@ -5404,28 +5416,28 @@ void Window::PostStateChanged( StateChangedType nState ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - PostUserEvent( LINK( this, Window, ImplAsyncStateChangedHdl ), (void*)(ULONG)nState ); + PostUserEvent( LINK( this, Window, ImplAsyncStateChangedHdl ), (void*)(sal_uLong)nState ); } // ----------------------------------------------------------------------- -BOOL Window::IsLocked( BOOL bChilds ) const +sal_Bool Window::IsLocked( sal_Bool bChilds ) const { if ( mpWindowImpl->mnLockCount != 0 ) - return TRUE; + return sal_True; if ( bChilds || mpWindowImpl->mbChildNotify ) { Window* pChild = mpWindowImpl->mpFirstChild; while ( pChild ) { - if ( pChild->IsLocked( TRUE ) ) - return TRUE; + if ( pChild->IsLocked( sal_True ) ) + return sal_True; pChild = pChild->mpWindowImpl->mpNext; } } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -5483,7 +5495,7 @@ SystemWindow* Window::GetSystemWindow() const // ----------------------------------------------------------------------- -void Window::SetBorderStyle( USHORT nBorderStyle ) +void Window::SetBorderStyle( sal_uInt16 nBorderStyle ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -5526,7 +5538,7 @@ void Window::SetBorderStyle( USHORT nBorderStyle ) // ----------------------------------------------------------------------- -USHORT Window::GetBorderStyle() const +sal_uInt16 Window::GetBorderStyle() const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -5574,7 +5586,7 @@ long Window::CalcTitleWidth() const // ----------------------------------------------------------------------- -void Window::EnableClipSiblings( BOOL bClipSiblings ) +void Window::EnableClipSiblings( sal_Bool bClipSiblings ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -5586,7 +5598,7 @@ void Window::EnableClipSiblings( BOOL bClipSiblings ) // ----------------------------------------------------------------------- -void Window::SetMouseTransparent( BOOL bTransparent ) +void Window::SetMouseTransparent( sal_Bool bTransparent ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -5601,7 +5613,7 @@ void Window::SetMouseTransparent( BOOL bTransparent ) // ----------------------------------------------------------------------- -void Window::SetPaintTransparent( BOOL bTransparent ) +void Window::SetPaintTransparent( sal_Bool bTransparent ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -5628,7 +5640,7 @@ void Window::SetInputContext( const InputContext& rInputContext ) // ----------------------------------------------------------------------- -void Window::EndExtTextInput( USHORT nFlags ) +void Window::EndExtTextInput( sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -5686,24 +5698,24 @@ long Window::GetCursorExtTextInputWidth() const // ----------------------------------------------------------------------- void Window::SetSettings( const AllSettings& rSettings ) { - SetSettings( rSettings, FALSE ); + SetSettings( rSettings, sal_False ); } -void Window::SetSettings( const AllSettings& rSettings, BOOL bChild ) +void Window::SetSettings( const AllSettings& rSettings, sal_Bool bChild ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); if ( mpWindowImpl->mpBorderWindow ) { - mpWindowImpl->mpBorderWindow->SetSettings( rSettings, FALSE ); + mpWindowImpl->mpBorderWindow->SetSettings( rSettings, sal_False ); if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow ) - ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->SetSettings( rSettings, TRUE ); + ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->SetSettings( rSettings, sal_True ); } AllSettings aOldSettings = maSettings; OutputDevice::SetSettings( rSettings ); - ULONG nChangeFlags = aOldSettings.GetChangeFlags( rSettings ); + sal_uLong nChangeFlags = aOldSettings.GetChangeFlags( rSettings ); // AppFont-Aufloesung und DPI-Aufloesung neu berechnen ImplInitResolutionSettings(); @@ -5727,20 +5739,20 @@ void Window::SetSettings( const AllSettings& rSettings, BOOL bChild ) // ----------------------------------------------------------------------- -void Window::UpdateSettings( const AllSettings& rSettings, BOOL bChild ) +void Window::UpdateSettings( const AllSettings& rSettings, sal_Bool bChild ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); if ( mpWindowImpl->mpBorderWindow ) { - mpWindowImpl->mpBorderWindow->UpdateSettings( rSettings, FALSE ); + mpWindowImpl->mpBorderWindow->UpdateSettings( rSettings, sal_False ); if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow ) - ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->UpdateSettings( rSettings, TRUE ); + ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->UpdateSettings( rSettings, sal_True ); } AllSettings aOldSettings = maSettings; - ULONG nChangeFlags = maSettings.Update( maSettings.GetWindowUpdate(), rSettings ); + sal_uLong nChangeFlags = maSettings.Update( maSettings.GetWindowUpdate(), rSettings ); nChangeFlags |= SETTINGS_IN_UPDATE_SETTINGS; // Set this flag so the receiver of the data changed // event can distinguish between the changing of global // setting and a local change ( with SetSettings ) @@ -5830,7 +5842,7 @@ Font Window::GetPointFont() const // ----------------------------------------------------------------------- -void Window::SetParentClipMode( USHORT nMode ) +void Window::SetParentClipMode( sal_uInt16 nMode ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -5842,14 +5854,14 @@ void Window::SetParentClipMode( USHORT nMode ) { mpWindowImpl->mnParentClipMode = nMode; if ( nMode & PARENTCLIPMODE_CLIP ) - mpWindowImpl->mpParent->mpWindowImpl->mbClipChildren = TRUE; + mpWindowImpl->mpParent->mpWindowImpl->mbClipChildren = sal_True; } } } // ----------------------------------------------------------------------- -USHORT Window::GetParentClipMode() const +sal_uInt16 Window::GetParentClipMode() const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -5870,7 +5882,7 @@ void Window::SetWindowRegionPixel() else if( mpWindowImpl->mbFrame ) { mpWindowImpl->maWinRegion = Region( REGION_NULL); - mpWindowImpl->mbWinRegion = FALSE; + mpWindowImpl->mbWinRegion = sal_False; mpWindowImpl->mpFrame->ResetClipRegion(); } else @@ -5878,7 +5890,7 @@ void Window::SetWindowRegionPixel() if ( mpWindowImpl->mbWinRegion ) { mpWindowImpl->maWinRegion = Region( REGION_NULL ); - mpWindowImpl->mbWinRegion = FALSE; + mpWindowImpl->mbWinRegion = sal_False; ImplSetClipFlag(); if ( IsReallyVisible() ) @@ -5917,9 +5929,9 @@ void Window::SetWindowRegionPixel( const Region& rRegion ) long nY; long nWidth; long nHeight; - ULONG nRectCount; + sal_uLong nRectCount; ImplRegionInfo aInfo; - BOOL bRegionRect; + sal_Bool bRegionRect; nRectCount = mpWindowImpl->maWinRegion.GetRectCount(); mpWindowImpl->mpFrame->BeginSetClipRegion( nRectCount ); @@ -5944,14 +5956,14 @@ void Window::SetWindowRegionPixel( const Region& rRegion ) if ( mpWindowImpl->mbWinRegion ) { mpWindowImpl->maWinRegion = Region( REGION_NULL ); - mpWindowImpl->mbWinRegion = FALSE; + mpWindowImpl->mbWinRegion = sal_False; ImplSetClipFlag(); } } else { mpWindowImpl->maWinRegion = rRegion; - mpWindowImpl->mbWinRegion = TRUE; + mpWindowImpl->mbWinRegion = sal_True; ImplSetClipFlag(); } @@ -5983,7 +5995,7 @@ const Region& Window::GetWindowRegionPixel() const // ----------------------------------------------------------------------- -BOOL Window::IsWindowRegionPixel() const +sal_Bool Window::IsWindowRegionPixel() const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -5995,7 +6007,7 @@ BOOL Window::IsWindowRegionPixel() const // ----------------------------------------------------------------------- -Region Window::GetWindowClipRegionPixel( USHORT nFlags ) const +Region Window::GetWindowClipRegionPixel( sal_uInt16 nFlags ) const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -6066,7 +6078,7 @@ void Window::ExpandPaintClipRegion( const Region& rRegion ) if( ! aDevPixRegion.IsEmpty() ) { mpWindowImpl->mpPaintRegion->Union( aDevPixRegion ); - mbInitClipRegion = TRUE; + mbInitClipRegion = sal_True; } } } @@ -6101,13 +6113,13 @@ void Window::SetParent( Window* pNewParent ) // check if the taskpanelist would change and move the window pointer accordingly SystemWindow *pSysWin = ImplGetLastSystemWindow(this); SystemWindow *pNewSysWin = NULL; - BOOL bChangeTaskPaneList = FALSE; + sal_Bool bChangeTaskPaneList = sal_False; if( pSysWin && pSysWin->ImplIsInTaskPaneList( this ) ) { pNewSysWin = ImplGetLastSystemWindow( pNewParent ); if( pNewSysWin && pNewSysWin != pSysWin ) { - bChangeTaskPaneList = TRUE; + bChangeTaskPaneList = sal_True; pSysWin->GetTaskPaneList()->RemoveWindow( this ); } } @@ -6136,7 +6148,7 @@ void Window::SetParent( Window* pNewParent ) if ( mpWindowImpl->mbFrame ) mpWindowImpl->mpFrame->SetParent( pNewParent->mpWindowImpl->mpFrame ); - BOOL bVisible = IsVisible(); + sal_Bool bVisible = IsVisible(); Show( false, SHOW_NOFOCUSCHANGE ); // Testen, ob sich das Overlap-Window aendert @@ -6154,9 +6166,9 @@ void Window::SetParent( Window* pNewParent ) } // Fenster in der Hirachie umsetzen - BOOL bFocusOverlapWin = HasChildPathFocus( TRUE ); - BOOL bFocusWin = HasChildPathFocus(); - BOOL bNewFrame = pNewParent->mpWindowImpl->mpFrameWindow != mpWindowImpl->mpFrameWindow; + sal_Bool bFocusOverlapWin = HasChildPathFocus( sal_True ); + sal_Bool bFocusWin = HasChildPathFocus(); + sal_Bool bNewFrame = pNewParent->mpWindowImpl->mpFrameWindow != mpWindowImpl->mpFrameWindow; if ( bNewFrame ) { if ( mpWindowImpl->mpFrameData->mpFocusWin ) @@ -6178,7 +6190,7 @@ void Window::SetParent( Window* pNewParent ) ImplRemoveWindow( bNewFrame ); ImplInsertWindow( pNewParent ); if ( mpWindowImpl->mnParentClipMode & PARENTCLIPMODE_CLIP ) - pNewParent->mpWindowImpl->mbClipChildren = TRUE; + pNewParent->mpWindowImpl->mbClipChildren = sal_True; ImplUpdateWindowPtr(); if ( ImplUpdatePos() ) ImplUpdateSysObjPos(); @@ -6217,7 +6229,7 @@ void Window::SetParent( Window* pNewParent ) } // Activate-Status beim naechsten Overlap-Window updaten - if ( HasChildPathFocus( TRUE ) ) + if ( HasChildPathFocus( sal_True ) ) ImplCallFocusChangeActivate( pNewOverlapWindow, pOldOverlapWindow ); } @@ -6258,7 +6270,7 @@ void Window::SetParent( Window* pNewParent ) // ----------------------------------------------------------------------- -void Window::Show( BOOL bVisible, USHORT nFlags ) +void Window::Show( sal_Bool bVisible, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -6267,7 +6279,7 @@ void Window::Show( BOOL bVisible, USHORT nFlags ) ImplDelData aDogTag( this ); - BOOL bRealVisibilityChanged = FALSE; + sal_Bool bRealVisibilityChanged = sal_False; mpWindowImpl->mbVisible = (bVisible != 0); if ( !bVisible ) @@ -6280,14 +6292,14 @@ void Window::Show( BOOL bVisible, USHORT nFlags ) { bool bOldUpdate = mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate; if ( mpWindowImpl->mbNoParentUpdate ) - mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = TRUE; + mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = sal_True; mpWindowImpl->mpBorderWindow->Show( false, nFlags ); mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = bOldUpdate; } else if ( mpWindowImpl->mbFrame ) { - mpWindowImpl->mbSuppressAccessibilityEvents = TRUE; - mpWindowImpl->mpFrame->Show( FALSE, FALSE ); + mpWindowImpl->mbSuppressAccessibilityEvents = sal_True; + mpWindowImpl->mpFrame->Show( sal_False, sal_False ); } StateChanged( STATE_CHANGE_VISIBLE ); @@ -6295,12 +6307,12 @@ void Window::Show( BOOL bVisible, USHORT nFlags ) if ( mpWindowImpl->mbReallyVisible ) { Region aInvRegion( REGION_EMPTY ); - BOOL bSaveBack = FALSE; + sal_Bool bSaveBack = sal_False; if ( ImplIsOverlapWindow() && !mpWindowImpl->mbFrame ) { if ( ImplRestoreOverlapBackground( aInvRegion ) ) - bSaveBack = TRUE; + bSaveBack = sal_True; } if ( !bSaveBack ) @@ -6395,7 +6407,7 @@ void Window::Show( BOOL bVisible, USHORT nFlags ) if ( ImplIsOverlapWindow() && !(nFlags & SHOW_NOACTIVATE) ) { ImplStartToTop(( nFlags & SHOW_FOREGROUNDTASK ) ? TOTOP_FOREGROUNDTASK : 0 ); - ImplFocusToTop( 0, FALSE ); + ImplFocusToTop( 0, sal_False ); } // Hintergrund sichern @@ -6410,7 +6422,7 @@ void Window::Show( BOOL bVisible, USHORT nFlags ) if ( !mpWindowImpl->mbFrame ) { - USHORT nInvalidateFlags = INVALIDATE_CHILDREN; + sal_uInt16 nInvalidateFlags = INVALIDATE_CHILDREN; if( ! IsPaintTransparent() ) nInvalidateFlags |= INVALIDATE_NOTRANSPARENT; ImplInvalidate( NULL, nInvalidateFlags ); @@ -6437,11 +6449,11 @@ void Window::Show( BOOL bVisible, USHORT nFlags ) } //DBG_ASSERT( !mpWindowImpl->mbSuppressAccessibilityEvents, "Window::Show() - Frame reactivated"); - mpWindowImpl->mbSuppressAccessibilityEvents = FALSE; + mpWindowImpl->mbSuppressAccessibilityEvents = sal_False; - mpWindowImpl->mbPaintFrame = TRUE; - BOOL bNoActivate = (nFlags & (SHOW_NOACTIVATE|SHOW_NOFOCUSCHANGE)) ? TRUE : FALSE; - mpWindowImpl->mpFrame->Show( TRUE, bNoActivate ); + mpWindowImpl->mbPaintFrame = sal_True; + sal_Bool bNoActivate = (nFlags & (SHOW_NOACTIVATE|SHOW_NOFOCUSCHANGE)) ? sal_True : sal_False; + mpWindowImpl->mpFrame->Show( sal_True, bNoActivate ); if( aDogTag.IsDelete() ) return; @@ -6562,10 +6574,10 @@ void Window::Enable( bool bEnable, bool bChild ) if ( mpWindowImpl->mpBorderWindow ) { - mpWindowImpl->mpBorderWindow->Enable( bEnable, FALSE ); + mpWindowImpl->mpBorderWindow->Enable( bEnable, sal_False ); if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow ) - ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->Enable( bEnable, TRUE ); + ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->Enable( bEnable, sal_True ); } // #i56102# restore app focus win in case the @@ -6607,7 +6619,7 @@ void Window::Enable( bool bEnable, bool bChild ) void Window::SetCallHandlersOnInputDisabled( bool bCall ) { - mpWindowImpl->mbCallHandlersDuringInputDisabled = bCall ? TRUE : FALSE; + mpWindowImpl->mbCallHandlersDuringInputDisabled = bCall ? sal_True : sal_False; Window* pChild = mpWindowImpl->mpFirstChild; while ( pChild ) @@ -6626,17 +6638,17 @@ bool Window::IsCallHandlersOnInputDisabled() const // ----------------------------------------------------------------------- -void Window::EnableInput( BOOL bEnable, BOOL bChild ) +void Window::EnableInput( sal_Bool bEnable, sal_Bool bChild ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - BOOL bNotify = (bEnable != mpWindowImpl->mbInputDisabled); + sal_Bool bNotify = (bEnable != mpWindowImpl->mbInputDisabled); if ( mpWindowImpl->mpBorderWindow ) { - mpWindowImpl->mpBorderWindow->EnableInput( bEnable, FALSE ); + mpWindowImpl->mpBorderWindow->EnableInput( bEnable, sal_False ); if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow ) - ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->EnableInput( bEnable, TRUE ); + ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->EnableInput( bEnable, sal_True ); } if ( (! bEnable && mpWindowImpl->meAlwaysInputMode != AlwaysInputEnabled) || @@ -6694,7 +6706,7 @@ void Window::EnableInput( BOOL bEnable, BOOL bChild ) // ----------------------------------------------------------------------- -void Window::EnableInput( BOOL bEnable, BOOL bChild, BOOL bSysWin, +void Window::EnableInput( sal_Bool bEnable, sal_Bool bChild, sal_Bool bSysWin, const Window* pExcludeWindow ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -6710,11 +6722,11 @@ void Window::EnableInput( BOOL bEnable, BOOL bChild, BOOL bSysWin, while ( pSysWin ) { // Is Window in the path from this window - if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pSysWin, TRUE ) ) + if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pSysWin, sal_True ) ) { // Is Window not in the exclude window path or not the // exclude window, than change the status - if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( pSysWin, TRUE ) ) + if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( pSysWin, sal_True ) ) pSysWin->EnableInput( bEnable, bChild ); } pSysWin = pSysWin->mpWindowImpl->mpNextOverlap; @@ -6727,11 +6739,11 @@ void Window::EnableInput( BOOL bEnable, BOOL bChild, BOOL bSysWin, if( pFrameWin->ImplIsFloatingWindow() ) { // Is Window in the path from this window - if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pFrameWin, TRUE ) ) + if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pFrameWin, sal_True ) ) { // Is Window not in the exclude window path or not the // exclude window, than change the status - if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( pFrameWin, TRUE ) ) + if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( pFrameWin, sal_True ) ) pFrameWin->EnableInput( bEnable, bChild ); } } @@ -6746,11 +6758,11 @@ void Window::EnableInput( BOOL bEnable, BOOL bChild, BOOL bSysWin, while( p != rList.end() ) { // Is Window in the path from this window - if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( (*p), TRUE ) ) + if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( (*p), sal_True ) ) { // Is Window not in the exclude window path or not the // exclude window, than change the status - if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( (*p), TRUE ) ) + if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( (*p), sal_True ) ) (*p)->EnableInput( bEnable, bChild ); } p++; @@ -6761,19 +6773,19 @@ void Window::EnableInput( BOOL bEnable, BOOL bChild, BOOL bSysWin, // ----------------------------------------------------------------------- -void Window::AlwaysEnableInput( BOOL bAlways, BOOL bChild ) +void Window::AlwaysEnableInput( sal_Bool bAlways, sal_Bool bChild ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); if ( mpWindowImpl->mpBorderWindow ) - mpWindowImpl->mpBorderWindow->AlwaysEnableInput( bAlways, FALSE ); + mpWindowImpl->mpBorderWindow->AlwaysEnableInput( bAlways, sal_False ); if( bAlways && mpWindowImpl->meAlwaysInputMode != AlwaysInputEnabled ) { mpWindowImpl->meAlwaysInputMode = AlwaysInputEnabled; if ( bAlways ) - EnableInput( TRUE, FALSE ); + EnableInput( sal_True, sal_False ); } else if( ! bAlways && mpWindowImpl->meAlwaysInputMode == AlwaysInputEnabled ) { @@ -6793,19 +6805,19 @@ void Window::AlwaysEnableInput( BOOL bAlways, BOOL bChild ) // ----------------------------------------------------------------------- -void Window::AlwaysDisableInput( BOOL bAlways, BOOL bChild ) +void Window::AlwaysDisableInput( sal_Bool bAlways, sal_Bool bChild ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); if ( mpWindowImpl->mpBorderWindow ) - mpWindowImpl->mpBorderWindow->AlwaysDisableInput( bAlways, FALSE ); + mpWindowImpl->mpBorderWindow->AlwaysDisableInput( bAlways, sal_False ); if( bAlways && mpWindowImpl->meAlwaysInputMode != AlwaysInputDisabled ) { mpWindowImpl->meAlwaysInputMode = AlwaysInputDisabled; if ( bAlways ) - EnableInput( FALSE, FALSE ); + EnableInput( sal_False, sal_False ); } else if( ! bAlways && mpWindowImpl->meAlwaysInputMode == AlwaysInputDisabled ) { @@ -6825,7 +6837,7 @@ void Window::AlwaysDisableInput( BOOL bAlways, BOOL bChild ) // ----------------------------------------------------------------------- -void Window::SetActivateMode( USHORT nMode ) +void Window::SetActivateMode( sal_uInt16 nMode ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -6840,9 +6852,9 @@ void Window::SetActivateMode( USHORT nMode ) if ( mpWindowImpl->mnActivateMode ) { if ( (mpWindowImpl->mbActive || (GetType() == WINDOW_BORDERWINDOW)) && - !HasChildPathFocus( TRUE ) ) + !HasChildPathFocus( sal_True ) ) { - mpWindowImpl->mbActive = FALSE; + mpWindowImpl->mbActive = sal_False; Deactivate(); } } @@ -6850,7 +6862,7 @@ void Window::SetActivateMode( USHORT nMode ) { if ( !mpWindowImpl->mbActive || (GetType() == WINDOW_BORDERWINDOW) ) { - mpWindowImpl->mbActive = TRUE; + mpWindowImpl->mbActive = sal_True; Activate(); } } @@ -6859,7 +6871,7 @@ void Window::SetActivateMode( USHORT nMode ) // ----------------------------------------------------------------------- -void Window::ToTop( USHORT nFlags ) +void Window::ToTop( sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -6869,7 +6881,7 @@ void Window::ToTop( USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::SetZOrder( Window* pRefWindow, USHORT nFlags ) +void Window::SetZOrder( Window* pRefWindow, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -6987,7 +6999,7 @@ void Window::SetZOrder( Window* pRefWindow, USHORT nFlags ) if ( mpWindowImpl->mbInitWinClipRegion || !mpWindowImpl->maWinClipRegion.IsEmpty() ) { - BOOL bInitWinClipRegion = mpWindowImpl->mbInitWinClipRegion; + sal_Bool bInitWinClipRegion = mpWindowImpl->mbInitWinClipRegion; ImplSetClipFlag(); // Wenn ClipRegion noch nicht initalisiert wurde, dann @@ -7046,7 +7058,7 @@ void Window::SetZOrder( Window* pRefWindow, USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::EnableAlwaysOnTop( BOOL bEnable ) +void Window::EnableAlwaysOnTop( sal_Bool bEnable ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7064,16 +7076,16 @@ void Window::EnableAlwaysOnTop( BOOL bEnable ) // ----------------------------------------------------------------------- void Window::SetPosSizePixel( long nX, long nY, - long nWidth, long nHeight, USHORT nFlags ) + long nWidth, long nHeight, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - BOOL bHasValidSize = !mpWindowImpl->mbDefSize; + sal_Bool bHasValidSize = !mpWindowImpl->mbDefSize; if ( nFlags & WINDOW_POSSIZE_POS ) - mpWindowImpl->mbDefPos = FALSE; + mpWindowImpl->mbDefPos = sal_False; if ( nFlags & WINDOW_POSSIZE_SIZE ) - mpWindowImpl->mbDefSize = FALSE; + mpWindowImpl->mbDefSize = sal_False; // Oberstes BorderWindow ist das Window, welches positioniert werden soll Window* pWindow = this; @@ -7093,7 +7105,7 @@ void Window::SetPosSizePixel( long nX, long nY, nHeight = pWindow->mnOutHeight; - USHORT nSysFlags=0; + sal_uInt16 nSysFlags=0; if( nFlags & WINDOW_POSSIZE_WIDTH ) nSysFlags |= SAL_FRAME_POSSIZE_WIDTH; if( nFlags & WINDOW_POSSIZE_HEIGHT ) @@ -7307,18 +7319,18 @@ Rectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle &rR Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow ) const { // with decoration - return ImplGetWindowExtentsRelative( pRelativeWindow, FALSE ); + return ImplGetWindowExtentsRelative( pRelativeWindow, sal_False ); } Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) const { // without decoration - return ImplGetWindowExtentsRelative( pRelativeWindow, TRUE ); + return ImplGetWindowExtentsRelative( pRelativeWindow, sal_True ); } // ----------------------------------------------------------------------- -Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) const +Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, sal_Bool bClientOnly ) const { SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); // make sure we use the extent of our border window, @@ -7348,7 +7360,7 @@ Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bC // ----------------------------------------------------------------------- -void Window::Scroll( long nHorzScroll, long nVertScroll, USHORT nFlags ) +void Window::Scroll( long nHorzScroll, long nVertScroll, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7360,7 +7372,7 @@ void Window::Scroll( long nHorzScroll, long nVertScroll, USHORT nFlags ) // ----------------------------------------------------------------------- void Window::Scroll( long nHorzScroll, long nVertScroll, - const Rectangle& rRect, USHORT nFlags ) + const Rectangle& rRect, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7372,7 +7384,7 @@ void Window::Scroll( long nHorzScroll, long nVertScroll, // ----------------------------------------------------------------------- -void Window::Invalidate( USHORT nFlags ) +void Window::Invalidate( sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7384,7 +7396,7 @@ void Window::Invalidate( USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::Invalidate( const Rectangle& rRect, USHORT nFlags ) +void Window::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7401,7 +7413,7 @@ void Window::Invalidate( const Rectangle& rRect, USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::Invalidate( const Region& rRegion, USHORT nFlags ) +void Window::Invalidate( const Region& rRegion, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7420,7 +7432,7 @@ void Window::Invalidate( const Region& rRegion, USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::Validate( USHORT nFlags ) +void Window::Validate( sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7432,7 +7444,7 @@ void Window::Validate( USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::Validate( const Rectangle& rRect, USHORT nFlags ) +void Window::Validate( const Rectangle& rRect, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7449,7 +7461,7 @@ void Window::Validate( const Rectangle& rRect, USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::Validate( const Region& rRegion, USHORT nFlags ) +void Window::Validate( const Region& rRegion, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7468,18 +7480,18 @@ void Window::Validate( const Region& rRegion, USHORT nFlags ) // ----------------------------------------------------------------------- -BOOL Window::HasPaintEvent() const +sal_Bool Window::HasPaintEvent() const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); if ( !mpWindowImpl->mbReallyVisible ) - return FALSE; + return sal_False; if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame ) - return TRUE; + return sal_True; if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINT ) - return TRUE; + return sal_True; if ( !ImplIsOverlapWindow() ) { @@ -7488,12 +7500,12 @@ BOOL Window::HasPaintEvent() const { pTempWindow = pTempWindow->ImplGetParent(); if ( pTempWindow->mpWindowImpl->mnPaintFlags & (IMPL_PAINT_PAINTCHILDS | IMPL_PAINT_PAINTALLCHILDS) ) - return TRUE; + return sal_True; } while ( !pTempWindow->ImplIsOverlapWindow() ); } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -7511,14 +7523,14 @@ void Window::Update() if ( !mpWindowImpl->mbReallyVisible ) return; - BOOL bFlush = FALSE; + sal_Bool bFlush = sal_False; if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame ) { Point aPoint( 0, 0 ); Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) ); ImplInvalidateOverlapFrameRegion( aRegion ); if ( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) ) - bFlush = TRUE; + bFlush = sal_True; } // Zuerst muessen wir alle Fenster ueberspringen, die Paint-Transparent @@ -7587,7 +7599,7 @@ void Window::Sync() // ----------------------------------------------------------------------- -void Window::SetUpdateMode( BOOL bUpdate ) +void Window::SetUpdateMode( sal_Bool bUpdate ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7606,7 +7618,7 @@ void Window::GrabFocus() // ----------------------------------------------------------------------- -BOOL Window::HasFocus() const +sal_Bool Window::HasFocus() const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7648,7 +7660,7 @@ void Window::SetFakeFocus( bool bFocus ) // ----------------------------------------------------------------------- -BOOL Window::HasChildPathFocus( BOOL bSystemWindow ) const +sal_Bool Window::HasChildPathFocus( sal_Bool bSystemWindow ) const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7664,7 +7676,7 @@ BOOL Window::HasChildPathFocus( BOOL bSystemWindow ) const Window* pFocusWin = ImplGetSVData()->maWinData.mpFocusWin; if ( pFocusWin ) return ImplIsWindowOrChild( pFocusWin, bSystemWindow ); - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -7685,7 +7697,7 @@ void Window::CaptureMouse() if ( pSVData->maWinData.mpCaptureWin != this ) { pSVData->maWinData.mpCaptureWin = this; - mpWindowImpl->mpFrame->CaptureMouse( TRUE ); + mpWindowImpl->mpFrame->CaptureMouse( sal_True ); } } @@ -7703,14 +7715,14 @@ void Window::ReleaseMouse() if ( pSVData->maWinData.mpCaptureWin == this ) { pSVData->maWinData.mpCaptureWin = NULL; - mpWindowImpl->mpFrame->CaptureMouse( FALSE ); + mpWindowImpl->mpFrame->CaptureMouse( sal_False ); ImplGenerateMouseMove(); } } // ----------------------------------------------------------------------- -BOOL Window::IsMouseCaptured() const +sal_Bool Window::IsMouseCaptured() const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7735,7 +7747,7 @@ void Window::SetPointer( const Pointer& rPointer ) // ----------------------------------------------------------------------- -void Window::EnableChildPointerOverwrite( BOOL bOverwrite ) +void Window::EnableChildPointerOverwrite( sal_Bool bOverwrite ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7805,7 +7817,7 @@ Point Window::GetLastPointerPosPixel() // ----------------------------------------------------------------------- -void Window::ShowPointer( BOOL bVisible ) +void Window::ShowPointer( sal_Bool bVisible ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -7844,7 +7856,7 @@ Window::PointerState Window::GetPointerState() // ----------------------------------------------------------------------- -BOOL Window::IsMouseOver() +sal_Bool Window::IsMouseOver() { return ImplGetWinData()->mbMouseOver; } @@ -7922,7 +7934,7 @@ void Window::SetText( const XubString& rStr ) // name change. if ( IsReallyVisible() ) { - Window* pWindow = GetLabelFor(); + Window* pWindow = GetAccessibleRelationLabelFor(); if ( pWindow && pWindow != this ) pWindow->ImplCallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldTitle ); } @@ -7982,32 +7994,22 @@ const XubString& Window::GetHelpText() const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - SmartId aSmartId = GetSmartHelpId(); - - ULONG nNumHelpId = 0; - String aStrHelpId; - if( aSmartId.HasString() ) - aStrHelpId = aSmartId.GetStr(); - if( aSmartId.HasNumeric() ) - nNumHelpId = aSmartId.GetNum(); + String aStrHelpId( rtl::OStringToOUString( GetHelpId(), RTL_TEXTENCODING_UTF8 ) ); bool bStrHelpId = (aStrHelpId.Len() > 0); - if ( !mpWindowImpl->maHelpText.Len() && (nNumHelpId || bStrHelpId) ) + if ( !mpWindowImpl->maHelpText.Len() && bStrHelpId ) { if ( !IsDialog() && (mpWindowImpl->mnType != WINDOW_TABPAGE) && (mpWindowImpl->mnType != WINDOW_FLOATINGWINDOW) ) { Help* pHelp = Application::GetHelp(); if ( pHelp ) { - if( bStrHelpId ) - ((Window*)this)->mpWindowImpl->maHelpText = pHelp->GetHelpText( aStrHelpId, this ); - else - ((Window*)this)->mpWindowImpl->maHelpText = pHelp->GetHelpText( nNumHelpId, this ); - mpWindowImpl->mbHelpTextDynamic = FALSE; + ((Window*)this)->mpWindowImpl->maHelpText = pHelp->GetHelpText( aStrHelpId, this ); + mpWindowImpl->mbHelpTextDynamic = sal_False; } } } - else if( mpWindowImpl->mbHelpTextDynamic && (nNumHelpId || bStrHelpId) ) + else if( mpWindowImpl->mbHelpTextDynamic && bStrHelpId ) { static const char* pEnv = getenv( "HELP_DEBUG" ); if( pEnv && *pEnv ) @@ -8015,13 +8017,10 @@ const XubString& Window::GetHelpText() const rtl::OUStringBuffer aTxt( 64+mpWindowImpl->maHelpText.Len() ); aTxt.append( mpWindowImpl->maHelpText ); aTxt.appendAscii( "\n------------------\n" ); - if( bStrHelpId ) - aTxt.append( rtl::OUString( aStrHelpId ) ); - else - aTxt.append( sal_Int32( nNumHelpId ) ); + aTxt.append( rtl::OUString( aStrHelpId ) ); mpWindowImpl->maHelpText = aTxt.makeStringAndClear(); } - mpWindowImpl->mbHelpTextDynamic = FALSE; + mpWindowImpl->mbHelpTextDynamic = sal_False; } return mpWindowImpl->maHelpText; @@ -8039,11 +8038,11 @@ Window* Window::FindWindow( const Point& rPos ) const // ----------------------------------------------------------------------- -USHORT Window::GetChildCount() const +sal_uInt16 Window::GetChildCount() const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - USHORT nChildCount = 0; + sal_uInt16 nChildCount = 0; Window* pChild = mpWindowImpl->mpFirstChild; while ( pChild ) { @@ -8056,11 +8055,11 @@ USHORT Window::GetChildCount() const // ----------------------------------------------------------------------- -Window* Window::GetChild( USHORT nChild ) const +Window* Window::GetChild( sal_uInt16 nChild ) const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - USHORT nChildCount = 0; + sal_uInt16 nChildCount = 0; Window* pChild = mpWindowImpl->mpFirstChild; while ( pChild ) { @@ -8075,7 +8074,7 @@ Window* Window::GetChild( USHORT nChild ) const // ----------------------------------------------------------------------- -Window* Window::GetWindow( USHORT nType ) const +Window* Window::GetWindow( sal_uInt16 nType ) const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -8167,7 +8166,7 @@ Window* Window::GetWindow( USHORT nType ) const // ----------------------------------------------------------------------- -BOOL Window::IsChild( const Window* pWindow, BOOL bSystemWindow ) const +sal_Bool Window::IsChild( const Window* pWindow, sal_Bool bSystemWindow ) const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); DBG_CHKOBJ( pWindow, Window, ImplDbgCheckWindow ); @@ -8180,22 +8179,22 @@ BOOL Window::IsChild( const Window* pWindow, BOOL bSystemWindow ) const pWindow = pWindow->ImplGetParent(); if ( pWindow == this ) - return TRUE; + return sal_True; } while ( pWindow ); - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL Window::IsWindowOrChild( const Window* pWindow, BOOL bSystemWindow ) const +sal_Bool Window::IsWindowOrChild( const Window* pWindow, sal_Bool bSystemWindow ) const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); DBG_CHKOBJ( pWindow, Window, ImplDbgCheckWindow ); if ( this == pWindow ) - return TRUE; + return sal_True; return ImplIsChild( pWindow, bSystemWindow ); } @@ -8234,7 +8233,7 @@ void Window::SetWindowPeer( ::com::sun::star::uno::Reference< ::com::sun::star:: // ----------------------------------------------------------------------- -::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > Window::GetComponentInterface( BOOL bCreate ) +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > Window::GetComponentInterface( sal_Bool bCreate ) { if ( !mpWindowImpl->mxWindowPeer.is() && bCreate ) { @@ -8331,7 +8330,7 @@ void Window::ImplStartDnd() // ----------------------------------------------------------------------- -Reference< XDropTarget > Window::GetDropTarget() +uno::Reference< XDropTarget > Window::GetDropTarget() { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -8344,7 +8343,7 @@ Reference< XDropTarget > Window::GetDropTarget() if( ! mpWindowImpl->mpFrameData->mxDropTarget.is() ) { // initialization is done in GetDragSource - Reference< XDragSource > xDragSource = GetDragSource(); + uno::Reference< XDragSource > xDragSource = GetDragSource(); } if( mpWindowImpl->mpFrameData->mxDropTarget.is() ) @@ -8360,16 +8359,16 @@ Reference< XDropTarget > Window::GetDropTarget() mpWindowImpl->mpFrameData->mxDropTarget->addDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener ); // register also as drag gesture listener if directly supported by drag source - Reference< XDragGestureRecognizer > xDragGestureRecognizer = - Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY); + uno::Reference< XDragGestureRecognizer > xDragGestureRecognizer = + uno::Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY); if( xDragGestureRecognizer.is() ) { xDragGestureRecognizer->addDragGestureListener( - Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY)); + uno::Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY)); } else - mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = TRUE; + mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = sal_True; } @@ -8388,12 +8387,12 @@ Reference< XDropTarget > Window::GetDropTarget() } // this object is located in the same process, so there will be no runtime exception - return Reference< XDropTarget > ( mpWindowImpl->mxDNDListenerContainer, UNO_QUERY ); + return uno::Reference< XDropTarget > ( mpWindowImpl->mxDNDListenerContainer, UNO_QUERY ); } // ----------------------------------------------------------------------- -Reference< XDragSource > Window::GetDragSource() +uno::Reference< XDragSource > Window::GetDragSource() { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -8403,7 +8402,7 @@ Reference< XDragSource > Window::GetDragSource() { try { - Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); + uno::Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); if ( xFactory.is() ) { const SystemEnvData * pEnvData = GetSystemData(); @@ -8437,10 +8436,10 @@ Reference< XDragSource > Window::GetDragSource() aDropTargetAL[ 2 ] = makeAny( vcl::createBmpConverter() ); #endif if( aDragSourceSN.getLength() ) - mpWindowImpl->mpFrameData->mxDragSource = Reference< XDragSource > ( xFactory->createInstanceWithArguments( aDragSourceSN, aDragSourceAL ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxDragSource = uno::Reference< XDragSource > ( xFactory->createInstanceWithArguments( aDragSourceSN, aDragSourceAL ), UNO_QUERY ); if( aDropTargetSN.getLength() ) - mpWindowImpl->mpFrameData->mxDropTarget = Reference< XDropTarget > ( xFactory->createInstanceWithArguments( aDropTargetSN, aDropTargetAL ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxDropTarget = uno::Reference< XDropTarget > ( xFactory->createInstanceWithArguments( aDropTargetSN, aDropTargetAL ), UNO_QUERY ); } } } @@ -8457,12 +8456,12 @@ Reference< XDragSource > Window::GetDragSource() return mpWindowImpl->mpFrameData->mxDragSource; } - return Reference< XDragSource > (); + return uno::Reference< XDragSource > (); } // ----------------------------------------------------------------------- -void Window::GetDragSourceDropTarget(Reference< XDragSource >& xDragSource, Reference< XDropTarget > &xDropTarget ) +void Window::GetDragSourceDropTarget(uno::Reference< XDragSource >& xDragSource, uno::Reference< XDropTarget > &xDropTarget ) // only for RVP transmission { if( mpWindowImpl->mpFrameData ) @@ -8480,14 +8479,14 @@ void Window::GetDragSourceDropTarget(Reference< XDragSource >& xDragSource, Refe // ----------------------------------------------------------------------- -Reference< XDragGestureRecognizer > Window::GetDragGestureRecognizer() +uno::Reference< XDragGestureRecognizer > Window::GetDragGestureRecognizer() { - return Reference< XDragGestureRecognizer > ( GetDropTarget(), UNO_QUERY ); + return uno::Reference< XDragGestureRecognizer > ( GetDropTarget(), UNO_QUERY ); } // ----------------------------------------------------------------------- -Reference< XClipboard > Window::GetClipboard() +uno::Reference< XClipboard > Window::GetClipboard() { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -8497,19 +8496,19 @@ Reference< XClipboard > Window::GetClipboard() { try { - Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); + uno::Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); if( xFactory.is() ) { - mpWindowImpl->mpFrameData->mxClipboard = Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboardExt")) ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboardExt")) ), UNO_QUERY ); if( !mpWindowImpl->mpFrameData->mxClipboard.is() ) - mpWindowImpl->mpFrameData->mxClipboard = Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard")) ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard")) ), UNO_QUERY ); #if defined(UNX) && !defined(QUARTZ) // unix clipboard needs to be initialized if( mpWindowImpl->mpFrameData->mxClipboard.is() ) { - Reference< XInitialization > xInit = Reference< XInitialization >( mpWindowImpl->mpFrameData->mxClipboard, UNO_QUERY ); + uno::Reference< XInitialization > xInit = uno::Reference< XInitialization >( mpWindowImpl->mpFrameData->mxClipboard, UNO_QUERY ); if( xInit.is() ) { @@ -8541,7 +8540,7 @@ Reference< XClipboard > Window::GetClipboard() // ----------------------------------------------------------------------- -Reference< XClipboard > Window::GetPrimarySelection() +uno::Reference< XClipboard > Window::GetPrimarySelection() { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -8551,7 +8550,7 @@ Reference< XClipboard > Window::GetPrimarySelection() { try { - Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); + uno::Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); if( xFactory.is() ) { @@ -8561,16 +8560,16 @@ Reference< XClipboard > Window::GetPrimarySelection() aArgumentList[ 1 ] = makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("PRIMARY")) ); aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() ); - mpWindowImpl->mpFrameData->mxSelection = Reference< XClipboard >( xFactory->createInstanceWithArguments( + mpWindowImpl->mpFrameData->mxSelection = uno::Reference< XClipboard >( xFactory->createInstanceWithArguments( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard")), aArgumentList ), UNO_QUERY ); # else - static Reference< XClipboard > s_xSelection; + static uno::Reference< XClipboard > s_xSelection; if ( !s_xSelection.is() ) - s_xSelection = Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.GenericClipboardExt")) ), UNO_QUERY ); + s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.GenericClipboardExt")) ), UNO_QUERY ); if ( !s_xSelection.is() ) - s_xSelection = Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.GenericClipboard")) ), UNO_QUERY ); + s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.GenericClipboard")) ), UNO_QUERY ); mpWindowImpl->mpFrameData->mxSelection = s_xSelection; # endif @@ -8595,7 +8594,7 @@ Reference< XClipboard > Window::GetPrimarySelection() // Accessibility // ----------------------------------------------------------------------- -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > Window::GetAccessible( BOOL bCreate ) +::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > Window::GetAccessible( sal_Bool bCreate ) { // do not optimize hierarchy for the top level border win (ie, when there is no parent) /* // do not optimize accessible hierarchy at all to better reflect real VCL hierarchy @@ -8615,7 +8614,7 @@ Reference< XClipboard > Window::GetPrimarySelection() ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > Window::CreateAccessible() { - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc( GetComponentInterface( TRUE ), ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc( GetComponentInterface( sal_True ), ::com::sun::star::uno::UNO_QUERY ); return xAcc; } @@ -8625,46 +8624,46 @@ void Window::SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::star:: } // skip all border windows that are no top level frames -BOOL Window::ImplIsAccessibleCandidate() const +sal_Bool Window::ImplIsAccessibleCandidate() const { if( !mpWindowImpl->mbBorderWin ) - return TRUE; + return sal_True; else // #101741 do not check for WB_CLOSEABLE because undecorated floaters (like menues!) are closeable if( mpWindowImpl->mbFrame && mpWindowImpl->mnStyle & (WB_MOVEABLE | WB_SIZEABLE) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } -BOOL Window::ImplIsAccessibleNativeFrame() const +sal_Bool Window::ImplIsAccessibleNativeFrame() const { if( mpWindowImpl->mbFrame ) // #101741 do not check for WB_CLOSEABLE because undecorated floaters (like menues!) are closeable if( (mpWindowImpl->mnStyle & (WB_MOVEABLE | WB_SIZEABLE)) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; else - return FALSE; + return sal_False; } -USHORT Window::ImplGetAccessibleCandidateChildWindowCount( USHORT nFirstWindowType ) const +sal_uInt16 Window::ImplGetAccessibleCandidateChildWindowCount( sal_uInt16 nFirstWindowType ) const { - USHORT nChildren = 0; + sal_uInt16 nChildren = 0; Window* pChild = GetWindow( nFirstWindowType ); while ( pChild ) { if( pChild->ImplIsAccessibleCandidate() ) nChildren++; else - nChildren = sal::static_int_cast<USHORT>(nChildren + pChild->ImplGetAccessibleCandidateChildWindowCount( WINDOW_FIRSTCHILD )); + nChildren = sal::static_int_cast<sal_uInt16>(nChildren + pChild->ImplGetAccessibleCandidateChildWindowCount( WINDOW_FIRSTCHILD )); pChild = pChild->mpWindowImpl->mpNext; } return nChildren; } -Window* Window::ImplGetAccessibleCandidateChild( USHORT nChild, USHORT& rChildCount, USHORT nFirstWindowType, BOOL bTopLevel ) const +Window* Window::ImplGetAccessibleCandidateChild( sal_uInt16 nChild, sal_uInt16& rChildCount, sal_uInt16 nFirstWindowType, sal_Bool bTopLevel ) const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -8677,7 +8676,7 @@ Window* Window::ImplGetAccessibleCandidateChild( USHORT nChild, USHORT& rChildCo Window *pTmpChild = pChild; if( !pChild->ImplIsAccessibleCandidate() ) - pTmpChild = pChild->ImplGetAccessibleCandidateChild( nChild, rChildCount, WINDOW_FIRSTCHILD, FALSE ); + pTmpChild = pChild->ImplGetAccessibleCandidateChild( nChild, rChildCount, WINDOW_FIRSTCHILD, sal_False ); if ( nChild == rChildCount ) return pTmpChild; @@ -8730,9 +8729,9 @@ Window* Window::GetAccessibleParentWindow() const } /* -USHORT Window::GetAccessibleChildWindowCount() +sal_uInt16 Window::GetAccessibleChildWindowCount() { - USHORT nChildren = ImplGetAccessibleCandidateChildWindowCount( WINDOW_FIRSTCHILD ); + sal_uInt16 nChildren = ImplGetAccessibleCandidateChildWindowCount( WINDOW_FIRSTCHILD ); // Search also for SystemWindows. Window* pOverlap = GetWindow( WINDOW_OVERLAP ); @@ -8742,9 +8741,9 @@ USHORT Window::GetAccessibleChildWindowCount() } */ -USHORT Window::GetAccessibleChildWindowCount() +sal_uInt16 Window::GetAccessibleChildWindowCount() { - USHORT nChildren = 0; + sal_uInt16 nChildren = 0; Window* pChild = mpWindowImpl->mpFirstChild; while( pChild ) { @@ -8790,21 +8789,21 @@ USHORT Window::GetAccessibleChildWindowCount() } /* -Window* Window::GetAccessibleChildWindow( USHORT n ) +Window* Window::GetAccessibleChildWindow( sal_uInt16 n ) { - USHORT nChildCount; // will be set in ImplGetAccessibleCandidateChild(...) - Window* pChild = ImplGetAccessibleCandidateChild( n, nChildCount, WINDOW_FIRSTCHILD, TRUE ); + sal_uInt16 nChildCount; // will be set in ImplGetAccessibleCandidateChild(...) + Window* pChild = ImplGetAccessibleCandidateChild( n, nChildCount, WINDOW_FIRSTCHILD, sal_True ); if ( !pChild && ( n >= nChildCount ) ) { Window* pOverlap = GetWindow( WINDOW_OVERLAP ); - pChild = pOverlap->ImplGetAccessibleCandidateChild( n, nChildCount, WINDOW_FIRSTOVERLAP, FALSE ); + pChild = pOverlap->ImplGetAccessibleCandidateChild( n, nChildCount, WINDOW_FIRSTOVERLAP, sal_False ); } return pChild; } */ -Window* Window::GetAccessibleChildWindow( USHORT n ) +Window* Window::GetAccessibleChildWindow( sal_uInt16 n ) { // report the menubarwindow as a the first child of THE workwindow if( GetType() == WINDOW_WORKWINDOW && ((WorkWindow *) this)->GetMenuBar() ) @@ -8820,7 +8819,7 @@ Window* Window::GetAccessibleChildWindow( USHORT n ) } // transform n to child number including invisible children - USHORT nChildren = n; + sal_uInt16 nChildren = n; Window* pChild = mpWindowImpl->mpFirstChild; while( pChild ) { @@ -8868,7 +8867,7 @@ Window* Window::GetAccessibleChildWindow( USHORT n ) } -void Window::SetAccessibleRole( USHORT nRole ) +void Window::SetAccessibleRole( sal_uInt16 nRole ) { if ( !mpWindowImpl->mpAccessibleInfos ) mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; @@ -8877,11 +8876,11 @@ void Window::SetAccessibleRole( USHORT nRole ) mpWindowImpl->mpAccessibleInfos->nAccessibleRole = nRole; } -USHORT Window::GetAccessibleRole() const +sal_uInt16 Window::GetAccessibleRole() const { using namespace ::com::sun::star; - USHORT nRole = mpWindowImpl->mpAccessibleInfos ? mpWindowImpl->mpAccessibleInfos->nAccessibleRole : 0xFFFF; + sal_uInt16 nRole = mpWindowImpl->mpAccessibleInfos ? mpWindowImpl->mpAccessibleInfos->nAccessibleRole : 0xFFFF; if ( nRole == 0xFFFF ) { switch ( GetType() ) @@ -8983,6 +8982,7 @@ USHORT Window::GetAccessibleRole() const case WINDOW_HELPTEXTWINDOW: nRole = accessibility::AccessibleRole::TOOL_TIP; break; + case WINDOW_RULER: nRole = accessibility::AccessibleRole::RULER; break; case WINDOW_WINDOW: case WINDOW_CONTROL: case WINDOW_BORDERWINDOW: @@ -9009,7 +9009,7 @@ void Window::SetAccessibleName( const String& rName ) if ( !mpWindowImpl->mpAccessibleInfos ) mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; - DBG_ASSERT( !mpWindowImpl->mpAccessibleInfos->pAccessibleName, "AccessibleName already set!" ); + DBG_ASSERT( !mpWindowImpl->mpAccessibleInfos->pAccessibleName || !rName.Len(), "AccessibleName already set!" ); delete mpWindowImpl->mpAccessibleInfos->pAccessibleName; mpWindowImpl->mpAccessibleInfos->pAccessibleName = new String( rName ); } @@ -9050,9 +9050,9 @@ String Window::GetAccessibleName() const case WINDOW_LISTBOX: case WINDOW_MULTILISTBOX: case WINDOW_TREELISTBOX: - + case WINDOW_METRICBOX: { - Window *pLabel = GetLabeledBy(); + Window *pLabel = GetAccessibleRelationLabeledBy(); if ( pLabel && pLabel != this ) aAccessibleName = pLabel->GetText(); } @@ -9111,7 +9111,28 @@ String Window::GetAccessibleDescription() const return aAccessibleDescription; } -BOOL Window::IsAccessibilityEventsSuppressed( BOOL bTraverseParentPath ) +void Window::SetAccessibleRelationLabeledBy( Window* pLabeledBy ) +{ + if ( !mpWindowImpl->mpAccessibleInfos ) + mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; + mpWindowImpl->mpAccessibleInfos->pLabeledByWindow = pLabeledBy; +} + +void Window::SetAccessibleRelationLabelFor( Window* pLabelFor ) +{ + if ( !mpWindowImpl->mpAccessibleInfos ) + mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; + mpWindowImpl->mpAccessibleInfos->pLabelForWindow = pLabelFor; +} + +void Window::SetAccessibleRelationMemberOf( Window* pMemberOfWin ) +{ + if ( !mpWindowImpl->mpAccessibleInfos ) + mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; + mpWindowImpl->mpAccessibleInfos->pMemberOfWindow = pMemberOfWin; +} + +sal_Bool Window::IsAccessibilityEventsSuppressed( sal_Bool bTraverseParentPath ) { if( !bTraverseParentPath ) return mpWindowImpl->mbSuppressAccessibilityEvents; @@ -9121,14 +9142,19 @@ BOOL Window::IsAccessibilityEventsSuppressed( BOOL bTraverseParentPath ) while ( pParent && pParent->mpWindowImpl) { if( pParent->mpWindowImpl->mbSuppressAccessibilityEvents ) - return TRUE; + return sal_True; else pParent = pParent->mpWindowImpl->mpParent; // do not use GetParent() to find borderwindows that are frames } - return FALSE; + return sal_False; } } +void Window::SetAccessibilityEventsSuppressed(sal_Bool bSuppressed) +{ + mpWindowImpl->mbSuppressAccessibilityEvents = bSuppressed; +} + void Window::RecordLayoutData( vcl::ControlLayoutData* pLayout, const Rectangle& rRect ) { if( ! mpOutDevData ) @@ -9145,9 +9171,9 @@ void Window::RecordLayoutData( vcl::ControlLayoutData* pLayout, const Rectangle& // returns background color used in this control // false: could not determine color -BOOL Window::ImplGetCurrentBackgroundColor( Color& rCol ) +sal_Bool Window::ImplGetCurrentBackgroundColor( Color& rCol ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; switch ( GetType() ) { @@ -9165,7 +9191,7 @@ BOOL Window::ImplGetCurrentBackgroundColor( Color& rCol ) if( !aWall.IsGradient() && !aWall.IsBitmap() ) rCol = aWall.GetColor(); else - bRet = FALSE; + bRet = sal_False; } else rCol = GetSettings().GetStyleSettings().GetFaceColor(); @@ -9174,21 +9200,21 @@ BOOL Window::ImplGetCurrentBackgroundColor( Color& rCol ) return bRet; } -void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly ) +void Window::DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bDrawBorder, sal_Bool bDrawExtBorderOnly ) { DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, bDrawExtBorderOnly, 0, NULL, NULL ); } -void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly, Color* pSelectionTextColor ) +void Window::DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bDrawBorder, sal_Bool bDrawExtBorderOnly, Color* pSelectionTextColor ) { DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, bDrawExtBorderOnly, 0, pSelectionTextColor, NULL ); } void Window::DrawSelectionBackground( const Rectangle& rRect, - USHORT highlight, - BOOL bChecked, - BOOL bDrawBorder, - BOOL bDrawExtBorderOnly, + sal_uInt16 highlight, + sal_Bool bChecked, + sal_Bool bDrawBorder, + sal_Bool bDrawExtBorderOnly, long nCornerRadius, Color* pSelectionTextColor, Color* pPaintColor @@ -9206,8 +9232,8 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, Color aSelectionBorderCol( pPaintColor ? *pPaintColor : rStyles.GetHighlightColor() ); Color aSelectionFillCol( aSelectionBorderCol ); - BOOL bDark = rStyles.GetFaceColor().IsDark(); - BOOL bBright = ( rStyles.GetFaceColor() == Color( COL_WHITE ) ); + sal_Bool bDark = rStyles.GetFaceColor().IsDark(); + sal_Bool bBright = ( rStyles.GetFaceColor() == Color( COL_WHITE ) ); int c1 = aSelectionBorderCol.GetLuminance(); int c2 = GetDisplayBackground().GetColor().GetLuminance(); @@ -9215,7 +9241,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, if( !bDark && !bBright && abs( c2-c1 ) < (pPaintColor ? 40 : 75) ) { // constrast too low - USHORT h,s,b; + sal_uInt16 h,s,b; aSelectionFillCol.RGBtoHSB( h, s, b ); if( b > 50 ) b -= 40; else b += 40; @@ -9247,13 +9273,13 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, else SetLineColor(); - USHORT nPercent = 0; + sal_uInt16 nPercent = 0; if( !highlight ) { if( bDark ) aSelectionFillCol = COL_BLACK; else - nPercent = bRoundEdges ? 90 : 80; // just checked (light) + nPercent = 80; // just checked (light) } else { @@ -9268,7 +9294,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, nPercent = 0; } else - nPercent = bRoundEdges ? 50 : 20; // selected, pressed or checked ( very dark ) + nPercent = bRoundEdges ? 40 : 20; // selected, pressed or checked ( very dark ) } else if( bChecked || highlight == 1 ) { @@ -9281,7 +9307,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, nPercent = 0; } else - nPercent = bRoundEdges ? 70 : 35; // selected, pressed or checked ( very dark ) + nPercent = bRoundEdges ? 60 : 35; // selected, pressed or checked ( very dark ) } else { @@ -9297,7 +9323,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, nPercent = 0; } else - nPercent = bRoundEdges ? 80 : 70; // selected ( dark ) + nPercent = 70; // selected ( dark ) } } @@ -9367,7 +9393,7 @@ Window* Window::GetPreferredKeyInputWindow() } -BOOL Window::IsScrollable() const +sal_Bool Window::IsScrollable() const { // check for scrollbars Window *pChild = mpWindowImpl->mpFirstChild; @@ -9381,24 +9407,24 @@ BOOL Window::IsScrollable() const return false; } -BOOL Window::IsTopWindow() const +sal_Bool Window::IsTopWindow() const { if ( mpWindowImpl->mbInDtor ) - return FALSE; + return sal_False; // topwindows must be frames or they must have a borderwindow which is a frame if( !mpWindowImpl->mbFrame && (!mpWindowImpl->mpBorderWindow || (mpWindowImpl->mpBorderWindow && !mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) ) ) - return FALSE; + return sal_False; ImplGetWinData(); - if( mpWindowImpl->mpWinData->mnIsTopWindow == (USHORT)~0) // still uninitialized + if( mpWindowImpl->mpWinData->mnIsTopWindow == (sal_uInt16)~0) // still uninitialized { // #113722#, cache result of expensive queryInterface call Window *pThisWin = (Window*)this; - Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY ); + uno::Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY ); pThisWin->mpWindowImpl->mpWinData->mnIsTopWindow = xTopWindow.is() ? 1 : 0; } - return mpWindowImpl->mpWinData->mnIsTopWindow == 1 ? TRUE : FALSE; + return mpWindowImpl->mpWinData->mnIsTopWindow == 1 ? sal_True : sal_False; } void Window::ImplMirrorFramePos( Point &pt ) const @@ -9407,7 +9433,7 @@ void Window::ImplMirrorFramePos( Point &pt ) const } // frame based modal counter (dialogs are not modal to the whole application anymore) -BOOL Window::IsInModalMode() const +sal_Bool Window::IsInModalMode() const { return (mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrameData->mnModalMode != 0); } @@ -9439,16 +9465,16 @@ void Window::ImplDecModalCount() pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow : NULL; } } -BOOL Window::ImplIsInTaskPaneList() +sal_Bool Window::ImplIsInTaskPaneList() { return mpWindowImpl->mbIsInTaskPaneList; } -void Window::ImplIsInTaskPaneList( BOOL mbIsInTaskList ) +void Window::ImplIsInTaskPaneList( sal_Bool mbIsInTaskList ) { mpWindowImpl->mbIsInTaskPaneList = mbIsInTaskList; } -void Window::ImplNotifyIconifiedState( BOOL bIconified ) +void Window::ImplNotifyIconifiedState( sal_Bool bIconified ) { mpWindowImpl->mpFrameWindow->ImplCallEventListeners( bIconified ? VCLEVENT_WINDOW_MINIMIZE : VCLEVENT_WINDOW_NORMALIZE ); // #109206# notify client window as well to have toolkit topwindow listeners notified @@ -9456,15 +9482,15 @@ void Window::ImplNotifyIconifiedState( BOOL bIconified ) mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow->ImplCallEventListeners( bIconified ? VCLEVENT_WINDOW_MINIMIZE : VCLEVENT_WINDOW_NORMALIZE ); } -BOOL Window::HasActiveChildFrame() +sal_Bool Window::HasActiveChildFrame() { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; Window *pFrameWin = ImplGetSVData()->maWinData.mpFirstFrame; while( pFrameWin ) { if( pFrameWin != mpWindowImpl->mpFrameWindow ) { - BOOL bDecorated = FALSE; + sal_Bool bDecorated = sal_False; Window *pChildFrame = pFrameWin->ImplGetWindow(); // #i15285# unfortunately WB_MOVEABLE is the same as WB_TABSTOP which can // be removed for ToolBoxes to influence the keyboard accessibility @@ -9476,9 +9502,9 @@ BOOL Window::HasActiveChildFrame() if( bDecorated || (pFrameWin->mpWindowImpl->mnStyle & (WB_MOVEABLE | WB_SIZEABLE) ) ) if( pChildFrame && pChildFrame->IsVisible() && pChildFrame->IsActive() ) { - if( ImplIsChild( pChildFrame, TRUE ) ) + if( ImplIsChild( pChildFrame, sal_True ) ) { - bRet = TRUE; + bRet = sal_True; break; } } @@ -9493,11 +9519,11 @@ LanguageType Window::GetInputLanguage() const return mpWindowImpl->mpFrame->GetInputLanguage(); } -void Window::EnableNativeWidget( BOOL bEnable ) +void Window::EnableNativeWidget( sal_Bool bEnable ) { static const char* pNoNWF = getenv( "SAL_NO_NWF" ); if( pNoNWF && *pNoNWF ) - bEnable = FALSE; + bEnable = sal_False; if( bEnable != ImplGetWinData()->mbEnableNativeWidget ) { @@ -9522,7 +9548,7 @@ void Window::EnableNativeWidget( BOOL bEnable ) } } -BOOL Window::IsNativeWidgetEnabled() const +sal_Bool Window::IsNativeWidgetEnabled() const { return ImplGetWinData()->mbEnableNativeWidget; } @@ -9531,12 +9557,12 @@ BOOL Window::IsNativeWidgetEnabled() const #include <salframe.h> #endif -Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSize, +uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSize, bool bFullscreen, bool bSpriteCanvas ) const { // try to retrieve hard reference from weak member - Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas ); + uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas ); // canvas still valid? Then we're done. if( xCanvas.is() ) @@ -9575,21 +9601,24 @@ Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSi aArg[ 2 ] = makeAny( ::com::sun::star::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ) ); aArg[ 3 ] = makeAny( mpWindowImpl->mbAlwaysOnTop ? sal_True : sal_False ); - aArg[ 4 ] = makeAny( Reference< awt::XWindow >( + aArg[ 4 ] = makeAny( uno::Reference< awt::XWindow >( const_cast<Window*>(this)->GetComponentInterface(), uno::UNO_QUERY )); - Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); + uno::Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); // Create canvas instance with window handle // ========================================= if ( xFactory.is() ) { - static Reference<lang::XMultiServiceFactory> xCanvasFactory( - xFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star." - "rendering.CanvasFactory") ) ), UNO_QUERY ); + static ::vcl::DeleteUnoReferenceOnDeinit<lang::XMultiServiceFactory> xStaticCanvasFactory( + uno::Reference<lang::XMultiServiceFactory>( + xFactory->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.rendering.CanvasFactory") ) ), + UNO_QUERY )); + uno::Reference<lang::XMultiServiceFactory> xCanvasFactory(xStaticCanvasFactory.get()); + if(xCanvasFactory.is()) { #ifdef WNT @@ -9635,37 +9664,37 @@ Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSi return xCanvas; } -Reference< rendering::XCanvas > Window::GetCanvas() const +uno::Reference< rendering::XCanvas > Window::GetCanvas() const { return ImplGetCanvas( Size(), false, false ); } -Reference< rendering::XSpriteCanvas > Window::GetSpriteCanvas() const +uno::Reference< rendering::XSpriteCanvas > Window::GetSpriteCanvas() const { - Reference< rendering::XSpriteCanvas > xSpriteCanvas( + uno::Reference< rendering::XSpriteCanvas > xSpriteCanvas( ImplGetCanvas( Size(), false, true ), uno::UNO_QUERY ); return xSpriteCanvas; } -Reference< ::com::sun::star::rendering::XSpriteCanvas > Window::GetFullscreenSpriteCanvas( const Size& rFullscreenSize ) const +uno::Reference< ::com::sun::star::rendering::XSpriteCanvas > Window::GetFullscreenSpriteCanvas( const Size& rFullscreenSize ) const { - Reference< rendering::XSpriteCanvas > xSpriteCanvas( + uno::Reference< rendering::XSpriteCanvas > xSpriteCanvas( ImplGetCanvas( rFullscreenSize, true, true ), uno::UNO_QUERY ); return xSpriteCanvas; } void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rPos ) { - BOOL bRVisible = mpWindowImpl->mbReallyVisible; + sal_Bool bRVisible = mpWindowImpl->mbReallyVisible; mpWindowImpl->mbReallyVisible = mpWindowImpl->mbVisible; - BOOL bDevOutput = mbDevOutput; - mbDevOutput = TRUE; + sal_Bool bDevOutput = mbDevOutput; + mbDevOutput = sal_True; long nOldDPIX = ImplGetDPIX(); long nOldDPIY = ImplGetDPIY(); mnDPIX = i_pTargetOutDev->ImplGetDPIX(); mnDPIY = i_pTargetOutDev->ImplGetDPIY(); - BOOL bOutput = IsOutputEnabled(); + sal_Bool bOutput = IsOutputEnabled(); EnableOutput(); DBG_ASSERT( GetMapMode().GetMapUnit() == MAP_PIXEL, "MapMode must be PIXEL based" ); @@ -9795,8 +9824,8 @@ void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& / Hide(); } - BOOL bVisible = mpWindowImpl->mbVisible; - mpWindowImpl->mbVisible = TRUE; + sal_Bool bVisible = mpWindowImpl->mbVisible; + mpWindowImpl->mbVisible = sal_True; if( mpWindowImpl->mpBorderWindow ) mpWindowImpl->mpBorderWindow->ImplPaintToDevice( pDev, rPos ); diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index e183e54fad83..e98d51d252c9 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -71,7 +71,7 @@ struct ImplFocusDelData : public ImplDelData // ======================================================================= -BOOL Window::ImplIsWindowInFront( const Window* pTestWindow ) const +sal_Bool Window::ImplIsWindowInFront( const Window* pTestWindow ) const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); DBG_CHKOBJ( pTestWindow, Window, ImplDbgCheckWindow ); @@ -81,11 +81,11 @@ BOOL Window::ImplIsWindowInFront( const Window* pTestWindow ) const const Window* pTempWindow = pTestWindow; const Window* pThisWindow = ImplGetFirstOverlapWindow(); if ( pTempWindow == pThisWindow ) - return FALSE; + return sal_False; do { if ( pTempWindow == pThisWindow ) - return TRUE; + return sal_True; if ( pTempWindow->mpWindowImpl->mbFrame ) break; pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow; @@ -95,7 +95,7 @@ BOOL Window::ImplIsWindowInFront( const Window* pTestWindow ) const do { if ( pTempWindow == pTestWindow ) - return FALSE; + return sal_False; if ( pTempWindow->mpWindowImpl->mbFrame ) break; pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow; @@ -105,8 +105,8 @@ BOOL Window::ImplIsWindowInFront( const Window* pTestWindow ) const // Fenster auf gleiche Ebene bringen if ( pThisWindow->mpWindowImpl->mpOverlapWindow != pTestWindow->mpWindowImpl->mpOverlapWindow ) { - USHORT nThisLevel = 0; - USHORT nTestLevel = 0; + sal_uInt16 nThisLevel = 0; + sal_uInt16 nTestLevel = 0; pTempWindow = pThisWindow; do { @@ -153,12 +153,12 @@ BOOL Window::ImplIsWindowInFront( const Window* pTestWindow ) const do { if ( pTempWindow == pThisWindow ) - return TRUE; + return sal_True; pTempWindow = pTempWindow->mpWindowImpl->mpNext; } while ( pTempWindow ); - return FALSE; + return sal_False; } // ======================================================================= @@ -169,7 +169,7 @@ void Window::ImplSaveOverlapBackground() if ( !mpWindowImpl->mbFrame ) { - ULONG nSaveBackSize = mnOutWidth*mnOutHeight; + sal_uLong nSaveBackSize = mnOutWidth*mnOutHeight; if ( nSaveBackSize <= IMPL_MAXSAVEBACKSIZE ) { if ( nSaveBackSize+mpWindowImpl->mpFrameData->mnAllSaveBackSize <= IMPL_MAXALLSAVEBACKSIZE ) @@ -204,7 +204,7 @@ void Window::ImplSaveOverlapBackground() // ----------------------------------------------------------------------- -BOOL Window::ImplRestoreOverlapBackground( Region& rInvRegion ) +sal_Bool Window::ImplRestoreOverlapBackground( Region& rInvRegion ) { if ( mpWindowImpl->mpOverlapData->mpSaveBackDev ) { @@ -234,10 +234,10 @@ BOOL Window::ImplRestoreOverlapBackground( Region& rInvRegion ) ImplDeleteOverlapBackground(); } - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -306,7 +306,7 @@ void Window::ImplInvalidateAllOverlapBackgrounds() // ======================================================================= -Bitmap Window::SnapShot( BOOL bBorder ) const +Bitmap Window::SnapShot( sal_Bool bBorder ) const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -348,7 +348,7 @@ void Window::ShowFocus( const Rectangle& rRect ) if( mpWindowImpl->mbInShowFocus ) return; - mpWindowImpl->mbInShowFocus = TRUE; + mpWindowImpl->mbInShowFocus = sal_True; ImplWinData* pWinData = ImplGetWinData(); @@ -362,7 +362,7 @@ void Window::ShowFocus( const Rectangle& rRect ) { if ( *(pWinData->mpFocusRect) == rRect ) { - mpWindowImpl->mbInShowFocus = FALSE; + mpWindowImpl->mbInShowFocus = sal_False; return; } @@ -375,18 +375,18 @@ void Window::ShowFocus( const Rectangle& rRect ) pWinData->mpFocusRect = new Rectangle( rRect ); else *(pWinData->mpFocusRect) = rRect; - mpWindowImpl->mbFocusVisible = TRUE; + mpWindowImpl->mbFocusVisible = sal_True; } else { if( ! mpWindowImpl->mbNativeFocusVisible ) { - mpWindowImpl->mbNativeFocusVisible = TRUE; + mpWindowImpl->mbNativeFocusVisible = sal_True; if ( !mpWindowImpl->mbInPaint ) Invalidate(); } } - mpWindowImpl->mbInShowFocus = FALSE; + mpWindowImpl->mbInShowFocus = sal_False; } // ----------------------------------------------------------------------- @@ -397,7 +397,7 @@ void Window::HideFocus() if( mpWindowImpl->mbInHideFocus ) return; - mpWindowImpl->mbInHideFocus = TRUE; + mpWindowImpl->mbInHideFocus = sal_True; // native themeing can suggest not to use focus rects if( ! ( mpWindowImpl->mbUseNativeFocus && @@ -405,29 +405,29 @@ void Window::HideFocus() { if ( !mpWindowImpl->mbFocusVisible ) { - mpWindowImpl->mbInHideFocus = FALSE; + mpWindowImpl->mbInHideFocus = sal_False; return; } if ( !mpWindowImpl->mbInPaint ) ImplInvertFocus( *(ImplGetWinData()->mpFocusRect) ); - mpWindowImpl->mbFocusVisible = FALSE; + mpWindowImpl->mbFocusVisible = sal_False; } else { if( mpWindowImpl->mbNativeFocusVisible ) { - mpWindowImpl->mbNativeFocusVisible = FALSE; + mpWindowImpl->mbNativeFocusVisible = sal_False; if ( !mpWindowImpl->mbInPaint ) Invalidate(); } } - mpWindowImpl->mbInHideFocus = FALSE; + mpWindowImpl->mbInHideFocus = sal_False; } // ----------------------------------------------------------------------- -void Window::Invert( const Rectangle& rRect, USHORT nFlags ) +void Window::Invert( const Rectangle& rRect, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -463,14 +463,14 @@ void Window::Invert( const Rectangle& rRect, USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::Invert( const Polygon& rPoly, USHORT nFlags ) +void Window::Invert( const Polygon& rPoly, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); if ( !IsDeviceOutputNecessary() ) return; - USHORT nPoints = rPoly.GetSize(); + sal_uInt16 nPoints = rPoly.GetSize(); if ( nPoints < 2 ) return; @@ -501,7 +501,7 @@ void Window::Invert( const Polygon& rPoly, USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::ShowTracking( const Rectangle& rRect, USHORT nFlags ) +void Window::ShowTracking( const Rectangle& rRect, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -526,7 +526,7 @@ void Window::ShowTracking( const Rectangle& rRect, USHORT nFlags ) else *(pWinData->mpTrackRect) = rRect; pWinData->mnTrackFlags = nFlags; - mpWindowImpl->mbTrackVisible = TRUE; + mpWindowImpl->mbTrackVisible = sal_True; } // ----------------------------------------------------------------------- @@ -540,13 +540,13 @@ void Window::HideTracking() ImplWinData* pWinData = ImplGetWinData(); if ( !mpWindowImpl->mbInPaint || !(pWinData->mnTrackFlags & SHOWTRACK_WINDOW) ) InvertTracking( *(pWinData->mpTrackRect), pWinData->mnTrackFlags ); - mpWindowImpl->mbTrackVisible = FALSE; + mpWindowImpl->mbTrackVisible = sal_False; } } // ----------------------------------------------------------------------- -void Window::InvertTracking( const Rectangle& rRect, USHORT nFlags ) +void Window::InvertTracking( const Rectangle& rRect, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -587,12 +587,12 @@ void Window::InvertTracking( const Rectangle& rRect, USHORT nFlags ) Point aPoint( mnOutOffX, mnOutOffY ); Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) ); - ImplClipBoundaries( aRegion, FALSE, FALSE ); + ImplClipBoundaries( aRegion, sal_False, sal_False ); ImplSelectClipRegion( aRegion, pGraphics ); } } - USHORT nStyle = nFlags & SHOWTRACK_STYLE; + sal_uInt16 nStyle = nFlags & SHOWTRACK_STYLE; if ( nStyle == SHOWTRACK_OBJECT ) pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SAL_INVERT_TRACKFRAME, this ); else if ( nStyle == SHOWTRACK_SPLIT ) @@ -611,11 +611,11 @@ void Window::InvertTracking( const Rectangle& rRect, USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::InvertTracking( const Polygon& rPoly, USHORT nFlags ) +void Window::InvertTracking( const Polygon& rPoly, sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - USHORT nPoints = rPoly.GetSize(); + sal_uInt16 nPoints = rPoly.GetSize(); if ( nPoints < 2 ) return; @@ -653,7 +653,7 @@ void Window::InvertTracking( const Polygon& rPoly, USHORT nFlags ) Point aPoint( mnOutOffX, mnOutOffY ); Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) ); - ImplClipBoundaries( aRegion, FALSE, FALSE ); + ImplClipBoundaries( aRegion, sal_False, sal_False ); ImplSelectClipRegion( aRegion, pGraphics ); } } @@ -690,7 +690,7 @@ IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer ) // ----------------------------------------------------------------------- -void Window::StartTracking( USHORT nFlags ) +void Window::StartTracking( sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -721,7 +721,7 @@ void Window::StartTracking( USHORT nFlags ) // ----------------------------------------------------------------------- -void Window::EndTracking( USHORT nFlags ) +void Window::EndTracking( sal_uInt16 nFlags ) { ImplSVData* pSVData = ImplGetSVData(); @@ -764,7 +764,7 @@ void Window::EndTracking( USHORT nFlags ) // ----------------------------------------------------------------------- -BOOL Window::IsTracking() const +sal_Bool Window::IsTracking() const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -773,7 +773,7 @@ BOOL Window::IsTracking() const // ----------------------------------------------------------------------- -void Window::StartAutoScroll( USHORT nFlags ) +void Window::StartAutoScroll( sal_uInt16 nFlags ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -810,7 +810,7 @@ void Window::EndAutoScroll() // ----------------------------------------------------------------------- -BOOL Window::IsAutoScroll() const +sal_Bool Window::IsAutoScroll() const { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -836,13 +836,13 @@ void Window::SaveBackground( const Point& rPos, const Size& rSize, { const Region aOldClip( rSaveDevice.GetClipRegion() ); const Point aPixOffset( rSaveDevice.LogicToPixel( rDestOff ) ); - const BOOL bMap = rSaveDevice.IsMapModeEnabled(); + const sal_Bool bMap = rSaveDevice.IsMapModeEnabled(); // move clip region to have the same distance to DestOffset aClip.Move( aPixOffset.X() - aPixPos.X(), aPixOffset.Y() - aPixPos.Y() ); // set pixel clip region - rSaveDevice.EnableMapMode( FALSE ); + rSaveDevice.EnableMapMode( sal_False ); rSaveDevice.SetClipRegion( aClip ); rSaveDevice.EnableMapMode( bMap ); rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this ); @@ -871,13 +871,13 @@ sal_uIntPtr Window::SaveFocus() // ----------------------------------------------------------------------- -BOOL Window::EndSaveFocus( sal_uIntPtr nSaveId, BOOL bRestore ) +sal_Bool Window::EndSaveFocus( sal_uIntPtr nSaveId, sal_Bool bRestore ) { if ( !nSaveId ) - return FALSE; + return sal_False; else { - BOOL bOK = TRUE; + sal_Bool bOK = sal_True; ImplFocusDelData* pDelData = (ImplFocusDelData*)(void*)nSaveId; if ( !pDelData->IsDelete() ) { @@ -940,7 +940,7 @@ void Window::SetZoomedPointFont( const Font& rFont ) long nFontDiff = Abs( GetFont().GetSize().Height()-aMetric.GetSize().Height() ); if ( (aMetric.GetType() == TYPE_RASTER) && (nFontDiff >= 2) ) { - USHORT nType; + sal_uInt16 nType; if ( aMetric.GetPitch() == PITCH_FIXED ) nType = DEFAULTFONT_FIXED; else @@ -1033,7 +1033,7 @@ void Window::SetControlForeground() if ( mpWindowImpl->mbControlForeground ) { mpWindowImpl->maControlForeground = Color( COL_TRANSPARENT ); - mpWindowImpl->mbControlForeground = FALSE; + mpWindowImpl->mbControlForeground = sal_False; StateChanged( STATE_CHANGE_CONTROLFOREGROUND ); } } @@ -1049,7 +1049,7 @@ void Window::SetControlForeground( const Color& rColor ) if ( mpWindowImpl->mbControlForeground ) { mpWindowImpl->maControlForeground = Color( COL_TRANSPARENT ); - mpWindowImpl->mbControlForeground = FALSE; + mpWindowImpl->mbControlForeground = sal_False; StateChanged( STATE_CHANGE_CONTROLFOREGROUND ); } } @@ -1058,7 +1058,7 @@ void Window::SetControlForeground( const Color& rColor ) if ( mpWindowImpl->maControlForeground != rColor ) { mpWindowImpl->maControlForeground = rColor; - mpWindowImpl->mbControlForeground = TRUE; + mpWindowImpl->mbControlForeground = sal_True; StateChanged( STATE_CHANGE_CONTROLFOREGROUND ); } } @@ -1073,7 +1073,7 @@ void Window::SetControlBackground() if ( mpWindowImpl->mbControlBackground ) { mpWindowImpl->maControlBackground = Color( COL_TRANSPARENT ); - mpWindowImpl->mbControlBackground = FALSE; + mpWindowImpl->mbControlBackground = sal_False; StateChanged( STATE_CHANGE_CONTROLBACKGROUND ); } } @@ -1089,7 +1089,7 @@ void Window::SetControlBackground( const Color& rColor ) if ( mpWindowImpl->mbControlBackground ) { mpWindowImpl->maControlBackground = Color( COL_TRANSPARENT ); - mpWindowImpl->mbControlBackground = FALSE; + mpWindowImpl->mbControlBackground = sal_False; StateChanged( STATE_CHANGE_CONTROLBACKGROUND ); } } @@ -1098,7 +1098,7 @@ void Window::SetControlBackground( const Color& rColor ) if ( mpWindowImpl->maControlBackground != rColor ) { mpWindowImpl->maControlBackground = rColor; - mpWindowImpl->mbControlBackground = TRUE; + mpWindowImpl->mbControlBackground = sal_True; StateChanged( STATE_CHANGE_CONTROLBACKGROUND ); } } @@ -1162,12 +1162,12 @@ long Window::GetDrawPixel( OutputDevice* pDev, long nPixels ) const // ----------------------------------------------------------------------- -BOOL Window::HandleScrollCommand( const CommandEvent& rCmd, +sal_Bool Window::HandleScrollCommand( const CommandEvent& rCmd, ScrollBar* pHScrl, ScrollBar* pVScrl ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if ( pHScrl || pVScrl ) { @@ -1175,7 +1175,7 @@ BOOL Window::HandleScrollCommand( const CommandEvent& rCmd, { case COMMAND_STARTAUTOSCROLL: { - USHORT nFlags = 0; + sal_uInt16 nFlags = 0; if ( pHScrl ) { if ( (pHScrl->GetVisibleSize() < pHScrl->GetRangeMax()) && @@ -1192,7 +1192,7 @@ BOOL Window::HandleScrollCommand( const CommandEvent& rCmd, if ( nFlags ) { StartAutoScroll( nFlags ); - bRet = TRUE; + bRet = sal_True; } } break; @@ -1203,7 +1203,7 @@ BOOL Window::HandleScrollCommand( const CommandEvent& rCmd, if ( pData && (COMMAND_WHEEL_SCROLL == pData->GetMode()) ) { - ULONG nScrollLines = pData->GetScrollLines(); + sal_uLong nScrollLines = pData->GetScrollLines(); long nLines; if ( nScrollLines == COMMAND_WHEEL_PAGESCROLL ) { @@ -1220,7 +1220,7 @@ BOOL Window::HandleScrollCommand( const CommandEvent& rCmd, 0L, pData->IsHorz() ? pHScrl : pVScrl, nLines ); - bRet = TRUE; + bRet = sal_True; } } } @@ -1233,7 +1233,7 @@ BOOL Window::HandleScrollCommand( const CommandEvent& rCmd, { ImplHandleScroll( pHScrl, pData->GetDeltaX(), pVScrl, pData->GetDeltaY() ); - bRet = TRUE; + bRet = sal_True; } } break; @@ -1303,7 +1303,7 @@ DockingManager* Window::GetDockingManager() return ImplGetDockingManager(); } -void Window::EnableDocking( BOOL bEnable ) +void Window::EnableDocking( sal_Bool bEnable ) { // update list of dockable windows if( bEnable ) @@ -1327,115 +1327,31 @@ Window* Window::ImplGetTopmostFrameWindow() return pTopmostParent->mpWindowImpl->mpFrameWindow; } -// making these Methods out of line to be able to change them lateron without complete rebuild -// TODO: Set the SmartId in here and remove mpWindowImpl->mnHelpId -void Window::SetHelpId( ULONG nHelpId ) +void Window::SetHelpId( const rtl::OString& rHelpId ) { - SetSmartHelpId(SmartId(nHelpId)); + mpWindowImpl->maHelpId = rHelpId; } -ULONG Window::GetHelpId() const +const rtl::OString& Window::GetHelpId() const { - return mpWindowImpl->mnHelpId; + return mpWindowImpl->maHelpId; } -void Window::SetSmartHelpId( const SmartId& aId, SmartIdUpdateMode aMode ) +void Window::SetUniqueId( const rtl::OString& rUniqueId ) { - // create SmartId if required - if ( (aMode == SMART_SET_STR) || (aMode == SMART_SET_ALL) || ( (aMode == SMART_SET_SMART) && aId.HasString() ) ) - { - if ( !ImplGetWinData()->mpSmartHelpId ) - ImplGetWinData()->mpSmartHelpId = new SmartId(); - } - - // if we have a SmartId (eather from earlier call or just created) fill with new values - if ( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mpSmartHelpId ) - ImplGetWinData()->mpSmartHelpId->UpdateId( aId, aMode ); - - if ( (aMode == SMART_SET_NUM) || (aMode == SMART_SET_ALL) || ( (aMode == SMART_SET_SMART) && aId.HasNumeric() ) ) - { - mpWindowImpl->mnHelpId = aId.GetNum(); - } -} - -SmartId Window::GetSmartHelpId() const -{ - if ( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mpSmartHelpId ) - { - if ( mpWindowImpl->mnHelpId || mpWindowImpl->mpWinData->mpSmartHelpId->HasNumeric() ) - mpWindowImpl->mpWinData->mpSmartHelpId->UpdateId( SmartId( mpWindowImpl->mnHelpId ), SMART_SET_NUM ); - return *mpWindowImpl->mpWinData->mpSmartHelpId; - } - else - { - if ( mpWindowImpl->mnHelpId ) - return SmartId( mpWindowImpl->mnHelpId ); - else - return SmartId(); - } -} - - -// making these Methods out of line to be able to change them lateron without complete rebuild -// TODO: Set the SmartId in here and remove mpWindowImpl->mnUniqId -void Window::SetUniqueId( ULONG nUniqueId ) { mpWindowImpl->mnUniqId = nUniqueId; } -ULONG Window::GetUniqueId() const { return mpWindowImpl->mnUniqId; } - - -void Window::SetSmartUniqueId( const SmartId& aId, SmartIdUpdateMode aMode ) -{ - // create SmartId if required - if ( (aMode == SMART_SET_STR) || (aMode == SMART_SET_ALL) || ( (aMode == SMART_SET_SMART) && aId.HasString() ) ) - { - if ( !ImplGetWinData()->mpSmartUniqueId ) - ImplGetWinData()->mpSmartUniqueId = new SmartId(); - } - - // if we have a SmartId (eather from earlier call or just created) fill with new values - if ( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mpSmartUniqueId ) - ImplGetWinData()->mpSmartUniqueId->UpdateId( aId, aMode ); - - if ( (aMode == SMART_SET_NUM) || (aMode == SMART_SET_ALL) || ( (aMode == SMART_SET_SMART) && aId.HasNumeric() ) ) - mpWindowImpl->mnUniqId = aId.GetNum(); + mpWindowImpl->maUniqId = rUniqueId; } -SmartId Window::GetSmartUniqueId() const +const rtl::OString& Window::GetUniqueId() const { - if ( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mpSmartUniqueId ) - { - if ( mpWindowImpl->mnUniqId || mpWindowImpl->mpWinData->mpSmartUniqueId->HasNumeric() ) - mpWindowImpl->mpWinData->mpSmartUniqueId->UpdateId( SmartId( mpWindowImpl->mnUniqId ), SMART_SET_NUM ); - return *mpWindowImpl->mpWinData->mpSmartUniqueId; - } - else - { - if ( mpWindowImpl->mnUniqId ) - return SmartId( mpWindowImpl->mnUniqId ); - else - return SmartId(); - } + return mpWindowImpl->maUniqId; } -SmartId Window::GetSmartUniqueOrHelpId() const +const rtl::OString& Window::GetUniqueOrHelpId() const { - if ( ( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mpSmartHelpId ) || mpWindowImpl->mnHelpId ) - { - if ( ( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mpSmartUniqueId ) || mpWindowImpl->mnUniqId ) - { - SmartId aTemp = GetSmartHelpId(); - aTemp.UpdateId( GetSmartUniqueId() ); - return aTemp; - } - else - return GetSmartHelpId(); - } - else - return GetSmartUniqueId(); + return mpWindowImpl->maUniqId.getLength() ? mpWindowImpl->maUniqId : mpWindowImpl->maHelpId; } - - - // --------- old inline methods --------------- Window* Window::ImplGetWindow() @@ -1492,47 +1408,47 @@ Window* Window::ImplGetFrameWindow() const return mpWindowImpl->mpFrameWindow; } -BOOL Window::ImplIsDockingWindow() const +sal_Bool Window::ImplIsDockingWindow() const { return mpWindowImpl->mbDockWin; } -BOOL Window::ImplIsFloatingWindow() const +sal_Bool Window::ImplIsFloatingWindow() const { return mpWindowImpl->mbFloatWin; } -BOOL Window::ImplIsToolbox() const +sal_Bool Window::ImplIsToolbox() const { return mpWindowImpl->mbToolBox; } -BOOL Window::ImplIsSplitter() const +sal_Bool Window::ImplIsSplitter() const { return mpWindowImpl->mbSplitter; } -BOOL Window::ImplIsPushButton() const +sal_Bool Window::ImplIsPushButton() const { return mpWindowImpl->mbPushButton; } -BOOL Window::ImplIsOverlapWindow() const +sal_Bool Window::ImplIsOverlapWindow() const { return mpWindowImpl->mbOverlapWin; } -void Window::ImplSetActive( BOOL bActive ) +void Window::ImplSetActive( sal_Bool bActive ) { mpWindowImpl->mbActive = bActive; } -BOOL Window::ImplIsMouseTransparent() const +sal_Bool Window::ImplIsMouseTransparent() const { return mpWindowImpl->mbMouseTransparent; } -void Window::ImplSetMouseTransparent( BOOL bTransparent ) +void Window::ImplSetMouseTransparent( sal_Bool bTransparent ) { mpWindowImpl->mbMouseTransparent = bTransparent; } @@ -1563,7 +1479,7 @@ void Window::ImplFrameToOutput( Rectangle& rRect ) rRect.Bottom()-=mnOutOffY; } -void Window::SetCompoundControl( BOOL bCompound ) +void Window::SetCompoundControl( sal_Bool bCompound ) { mpWindowImpl->mbCompoundControl = bCompound; } @@ -1607,77 +1523,77 @@ WindowType Window::GetType() const { return mpWindowImpl->mnType; } -BOOL Window::IsSystemWindow() const +sal_Bool Window::IsSystemWindow() const { return mpWindowImpl->mbSysWin; } -BOOL Window::IsDialog() const +sal_Bool Window::IsDialog() const { return mpWindowImpl->mbDialog; } -BOOL Window::IsMenuFloatingWindow() const +sal_Bool Window::IsMenuFloatingWindow() const { return mpWindowImpl->mbMenuFloatingWindow; } -BOOL Window::IsToolbarFloatingWindow() const +sal_Bool Window::IsToolbarFloatingWindow() const { return mpWindowImpl->mbToolbarFloatingWindow; } -void Window::EnableAllResize( BOOL bEnable ) +void Window::EnableAllResize( sal_Bool bEnable ) { mpWindowImpl->mbAllResize = bEnable; } -BOOL Window::IsAllResizeEnabled() const +sal_Bool Window::IsAllResizeEnabled() const { return mpWindowImpl->mbAllResize; } -BOOL Window::IsClipSiblingsEnabled() const +sal_Bool Window::IsClipSiblingsEnabled() const { return mpWindowImpl->mbClipSiblings; } -void Window::EnableChildTransparentMode( BOOL bEnable ) +void Window::EnableChildTransparentMode( sal_Bool bEnable ) { mpWindowImpl->mbChildTransparent = bEnable; } -BOOL Window::IsChildTransparentModeEnabled() const +sal_Bool Window::IsChildTransparentModeEnabled() const { return mpWindowImpl->mbChildTransparent; } -BOOL Window::IsMouseTransparent() const +sal_Bool Window::IsMouseTransparent() const { return mpWindowImpl->mbMouseTransparent; } -BOOL Window::IsPaintTransparent() const +sal_Bool Window::IsPaintTransparent() const { return mpWindowImpl->mbPaintTransparent; } -void Window::SetDialogControlStart( BOOL bStart ) +void Window::SetDialogControlStart( sal_Bool bStart ) { mpWindowImpl->mbDlgCtrlStart = bStart; } -BOOL Window::IsDialogControlStart() const +sal_Bool Window::IsDialogControlStart() const { return mpWindowImpl->mbDlgCtrlStart; } -void Window::SetDialogControlFlags( USHORT nFlags ) +void Window::SetDialogControlFlags( sal_uInt16 nFlags ) { mpWindowImpl->mnDlgCtrlFlags = nFlags; } -USHORT Window::GetDialogControlFlags() const +sal_uInt16 Window::GetDialogControlFlags() const { return mpWindowImpl->mnDlgCtrlFlags; } @@ -1687,22 +1603,22 @@ const InputContext& Window::GetInputContext() const return mpWindowImpl->maInputContext; } -BOOL Window::IsExtTextInput() const +sal_Bool Window::IsExtTextInput() const { return mpWindowImpl->mbExtTextInput; } -void Window::EnableChildNotify( BOOL bEnable ) +void Window::EnableChildNotify( sal_Bool bEnable ) { mpWindowImpl->mbChildNotify = bEnable; } -BOOL Window::IsChildNotify() const +sal_Bool Window::IsChildNotify() const { return mpWindowImpl->mbChildNotify; } -BOOL Window::IsControlFont() const +sal_Bool Window::IsControlFont() const { return (mpWindowImpl->mpControlFont != 0); } @@ -1712,7 +1628,7 @@ Color Window::GetControlForeground() const return mpWindowImpl->maControlForeground; } -BOOL Window::IsControlForeground() const +sal_Bool Window::IsControlForeground() const { return mpWindowImpl->mbControlForeground; } @@ -1722,12 +1638,12 @@ Color Window::GetControlBackground() const return mpWindowImpl->maControlBackground; } -BOOL Window::IsControlBackground() const +sal_Bool Window::IsControlBackground() const { return mpWindowImpl->mbControlBackground; } -BOOL Window::IsInPaint() const +sal_Bool Window::IsInPaint() const { return mpWindowImpl->mbInPaint; } @@ -1737,128 +1653,128 @@ Window* Window::GetParent() const return mpWindowImpl->mpRealParent; } -BOOL Window::IsVisible() const +sal_Bool Window::IsVisible() const { return mpWindowImpl->mbVisible; } -BOOL Window::IsReallyVisible() const +sal_Bool Window::IsReallyVisible() const { return mpWindowImpl->mbReallyVisible; } -BOOL Window::IsParentPathVisible() const +sal_Bool Window::IsParentPathVisible() const { return mpWindowImpl->mbReallyVisible; } -BOOL Window::IsReallyShown() const +sal_Bool Window::IsReallyShown() const { return mpWindowImpl->mbReallyShown; } -BOOL Window::IsInInitShow() const +sal_Bool Window::IsInInitShow() const { return mpWindowImpl->mbInInitShow; } -BOOL Window::IsEnabled() const +sal_Bool Window::IsEnabled() const { return !mpWindowImpl->mbDisabled; } -BOOL Window::IsInputEnabled() const +sal_Bool Window::IsInputEnabled() const { return !mpWindowImpl->mbInputDisabled; } -BOOL Window::IsAlwaysEnableInput() const +sal_Bool Window::IsAlwaysEnableInput() const { return mpWindowImpl->meAlwaysInputMode == AlwaysInputEnabled; } -BOOL Window::IsAlwaysDisableInput() const +sal_Bool Window::IsAlwaysDisableInput() const { return mpWindowImpl->meAlwaysInputMode == AlwaysInputDisabled; } -USHORT Window::GetActivateMode() const +sal_uInt16 Window::GetActivateMode() const { return mpWindowImpl->mnActivateMode; } -BOOL Window::IsAlwaysOnTopEnabled() const +sal_Bool Window::IsAlwaysOnTopEnabled() const { return mpWindowImpl->mbAlwaysOnTop; } -BOOL Window::IsDefaultPos() const +sal_Bool Window::IsDefaultPos() const { return mpWindowImpl->mbDefPos; } -BOOL Window::IsDefaultSize() const +sal_Bool Window::IsDefaultSize() const { return mpWindowImpl->mbDefSize; } -void Window::EnablePaint( BOOL bEnable ) +void Window::EnablePaint( sal_Bool bEnable ) { mpWindowImpl->mbPaintDisabled = !bEnable; } -BOOL Window::IsPaintEnabled() const +sal_Bool Window::IsPaintEnabled() const { return !mpWindowImpl->mbPaintDisabled; } -BOOL Window::IsUpdateMode() const +sal_Bool Window::IsUpdateMode() const { return !mpWindowImpl->mbNoUpdate; } -void Window::SetParentUpdateMode( BOOL bUpdate ) +void Window::SetParentUpdateMode( sal_Bool bUpdate ) { mpWindowImpl->mbNoParentUpdate = !bUpdate; } -BOOL Window::IsParentUpdateMode() const +sal_Bool Window::IsParentUpdateMode() const { return !mpWindowImpl->mbNoParentUpdate; } -BOOL Window::IsActive() const +sal_Bool Window::IsActive() const { return mpWindowImpl->mbActive; } -USHORT Window::GetGetFocusFlags() const +sal_uInt16 Window::GetGetFocusFlags() const { return mpWindowImpl->mnGetFocusFlags; } -BOOL Window::IsCompoundControl() const +sal_Bool Window::IsCompoundControl() const { return mpWindowImpl->mbCompoundControl; } -BOOL Window::HasCompoundControlFocus() const +sal_Bool Window::HasCompoundControlFocus() const { return mpWindowImpl->mbCompoundControlHasFocus; } -BOOL Window::IsChildPointerOverwrite() const +sal_Bool Window::IsChildPointerOverwrite() const { return mpWindowImpl->mbChildPtrOverwrite; } -BOOL Window::IsPointerVisible() const +sal_Bool Window::IsPointerVisible() const { return !mpWindowImpl->mbNoPtrVisible; } -BOOL Window::IsWait() const +sal_Bool Window::IsWait() const { return (mpWindowImpl->mnWaitCount != 0); } @@ -1873,7 +1789,7 @@ const Fraction& Window::GetZoom() const return mpWindowImpl->maZoom; } -BOOL Window::IsZoom() const +sal_Bool Window::IsZoom() const { return mpWindowImpl->maZoom.GetNumerator() != mpWindowImpl->maZoom.GetDenominator(); } @@ -1881,7 +1797,7 @@ BOOL Window::IsZoom() const void Window::SetHelpText( const XubString& rHelpText ) { mpWindowImpl->maHelpText = rHelpText; - mpWindowImpl->mbHelpTextDynamic = TRUE; + mpWindowImpl->mbHelpTextDynamic = sal_True; } void Window::SetQuickHelpText( const XubString& rHelpText ) @@ -1904,12 +1820,12 @@ void* Window::GetData() const return mpWindowImpl->mpUserData; } -BOOL Window::IsCreatedWithToolkit() const +sal_Bool Window::IsCreatedWithToolkit() const { return mpWindowImpl->mbCreatedWithToolkit; } -void Window::SetCreatedWithToolkit( BOOL b ) +void Window::SetCreatedWithToolkit( sal_Bool b ) { mpWindowImpl->mbCreatedWithToolkit = b; diff --git a/vcl/source/window/window4.cxx b/vcl/source/window/window4.cxx new file mode 100644 index 000000000000..577a573c2015 --- /dev/null +++ b/vcl/source/window/window4.cxx @@ -0,0 +1,224 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_vcl.hxx" + +#include "vcl/window.hxx" +#include "vcl/window.h" +#include "vcl/svdata.hxx" +#include "vcl/arrange.hxx" + +#include "com/sun/star/beans/PropertyValue.hpp" + +#include <map> +#include <vector> + +using namespace com::sun::star; + +namespace vcl +{ + struct ExtWindowImpl + { + ExtWindowImpl() + : mbOwnedByParent( false ) + {} + ~ExtWindowImpl() + {} + + boost::shared_ptr< WindowArranger > mxLayout; + bool mbOwnedByParent; + rtl::OUString maIdentifier; + }; +} + +void Window::ImplDeleteOwnedChildren() +{ + Window* pChild = mpWindowImpl->mpFirstChild; + while ( pChild ) + { + Window* pDeleteCandidate = pChild; + pChild = pChild->mpWindowImpl->mpNext; + vcl::ExtWindowImpl* pDelImpl = pDeleteCandidate->ImplGetExtWindowImpl(); + if( pDelImpl && pDelImpl->mbOwnedByParent ) + delete pDeleteCandidate; + } +} + +void Window::ImplFreeExtWindowImpl() +{ + ImplDeleteOwnedChildren(); + if( mpWindowImpl ) + { + delete mpWindowImpl->mpExtImpl; + mpWindowImpl->mpExtImpl = NULL; + } +} + +vcl::ExtWindowImpl* Window::ImplGetExtWindowImpl() const +{ + vcl::ExtWindowImpl* pImpl = NULL; + if( mpWindowImpl ) + { + if( ! mpWindowImpl->mpExtImpl && ! mpWindowImpl->mbInDtor ) + mpWindowImpl->mpExtImpl = new vcl::ExtWindowImpl(); + pImpl = mpWindowImpl->mpExtImpl; + } + return pImpl; +} + +void Window::ImplExtResize() +{ + if( mpWindowImpl && mpWindowImpl->mpExtImpl ) + { + if( mpWindowImpl->mpExtImpl->mxLayout.get() ) + mpWindowImpl->mpExtImpl->mxLayout->setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) ); + } +} + +boost::shared_ptr< vcl::WindowArranger > Window::getLayout() +{ + boost::shared_ptr< vcl::WindowArranger > xRet; + vcl::ExtWindowImpl* pImpl = ImplGetExtWindowImpl(); + if( pImpl ) + { + if( ! pImpl->mxLayout.get() ) + { + pImpl->mxLayout.reset( new vcl::LabelColumn() ); + pImpl->mxLayout->setParentWindow( this ); + pImpl->mxLayout->setOuterBorder( -1 ); + } + xRet = pImpl->mxLayout; + } + + return xRet; +} + +void Window::addWindow( Window* i_pWin, bool i_bTakeOwnership ) +{ + vcl::ExtWindowImpl* pImpl = ImplGetExtWindowImpl(); + if( pImpl && i_pWin ) + { + vcl::ExtWindowImpl* pChildImpl = i_pWin->ImplGetExtWindowImpl(); + if( pChildImpl ) + { + i_pWin->SetParent( this ); + pChildImpl->mbOwnedByParent = i_bTakeOwnership; + } + } +} + +Window* Window::removeWindow( Window* i_pWin, Window* i_pNewParent ) +{ + Window* pRet = NULL; + if( i_pWin ) + { + vcl::ExtWindowImpl* pImpl = ImplGetExtWindowImpl(); + if( pImpl ) + { + vcl::ExtWindowImpl* pChildImpl = i_pWin->ImplGetExtWindowImpl(); + if( pChildImpl ) + { + if( ! i_pNewParent ) + pChildImpl->mbOwnedByParent = false; + i_pWin->SetParent( i_pNewParent ); + pRet = i_pWin; + } + } + } + return pRet; +} + +Window* Window::findWindow( const rtl::OUString& i_rIdentifier ) const +{ + if( getIdentifier() == i_rIdentifier ) + return const_cast<Window*>(this); + + Window* pChild = mpWindowImpl->mpFirstChild; + while ( pChild ) + { + Window* pResult = pChild->findWindow( i_rIdentifier ); + if( pResult ) + return pResult; + pChild = pChild->mpWindowImpl->mpNext; + } + + return NULL; +} + +const rtl::OUString& Window::getIdentifier() const +{ + static rtl::OUString aEmptyStr; + + return (mpWindowImpl && mpWindowImpl->mpExtImpl) ? mpWindowImpl->mpExtImpl->maIdentifier : aEmptyStr; +} + +void Window::setIdentifier( const rtl::OUString& i_rIdentifier ) +{ + vcl::ExtWindowImpl* pImpl = ImplGetExtWindowImpl(); + if( pImpl ) + pImpl->maIdentifier = i_rIdentifier; +} + +void Window::setProperties( const uno::Sequence< beans::PropertyValue >& i_rProps ) +{ + const beans::PropertyValue* pVals = i_rProps.getConstArray(); + for( sal_Int32 i = 0; i < i_rProps.getLength(); i++ ) + { + if( pVals[i].Name.equalsAscii( "Enabled" ) ) + { + sal_Bool bVal = sal_True; + if( pVals[i].Value >>= bVal ) + Enable( bVal ); + } + else if( pVals[i].Name.equalsAscii( "Visible" ) ) + { + sal_Bool bVal = sal_True; + if( pVals[i].Value >>= bVal ) + Show( bVal ); + } + else if( pVals[i].Name.equalsAscii( "Text" ) ) + { + rtl::OUString aText; + if( pVals[i].Value >>= aText ) + SetText( aText ); + } + } +} + +uno::Sequence< beans::PropertyValue > Window::getProperties() const +{ + uno::Sequence< beans::PropertyValue > aProps( 3 ); + aProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ); + aProps[0].Value = uno::makeAny( sal_Bool( IsEnabled() ) ); + aProps[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ); + aProps[1].Value = uno::makeAny( sal_Bool( IsVisible() ) ); + aProps[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ); + aProps[2].Value = uno::makeAny( rtl::OUString( GetText() ) ); + + return aProps; +} + diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index ca35f12b5ce6..3e4de2648c99 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -38,7 +38,6 @@ #include <unotools/localedatawrapper.hxx> #include <vcl/svdata.hxx> #include <vcl/dbggui.hxx> -#include <vcl/windata.hxx> #include <vcl/timer.hxx> #include <vcl/event.hxx> #include <vcl/sound.hxx> @@ -129,9 +128,9 @@ long ImplCallEvent( NotifyEvent& rEvt ) // ======================================================================= -static BOOL ImplHandleMouseFloatMode( Window* pChild, const Point& rMousePos, - USHORT nCode, USHORT nSVEvent, - BOOL bMouseLeave ) +static sal_Bool ImplHandleMouseFloatMode( Window* pChild, const Point& rMousePos, + sal_uInt16 nCode, sal_uInt16 nSVEvent, + sal_Bool bMouseLeave ) { ImplSVData* pSVData = ImplGetSVData(); @@ -142,21 +141,21 @@ static BOOL ImplHandleMouseFloatMode( Window* pChild, const Point& rMousePos, * #93895# since floats are system windows, coordinates have * to be converted to float relative for the hittest */ - USHORT nHitTest = IMPL_FLOATWIN_HITTEST_OUTSIDE; + sal_uInt16 nHitTest = IMPL_FLOATWIN_HITTEST_OUTSIDE; FloatingWindow* pFloat = pSVData->maWinData.mpFirstFloat->ImplFloatHitTest( pChild, rMousePos, nHitTest ); FloatingWindow* pLastLevelFloat; - ULONG nPopupFlags; + sal_uLong nPopupFlags; if ( nSVEvent == EVENT_MOUSEMOVE ) { if ( bMouseLeave ) - return TRUE; + return sal_True; if ( !pFloat || (nHitTest & IMPL_FLOATWIN_HITTEST_RECT) ) { if ( pSVData->maHelpData.mpHelpWin && !pSVData->maHelpData.mbKeyboardHelp ) ImplDestroyHelpWindow( true ); pChild->ImplGetFrame()->SetPointer( POINTER_ARROW ); - return TRUE; + return sal_True; } } else @@ -172,15 +171,15 @@ static BOOL ImplHandleMouseFloatMode( Window* pChild, const Point& rMousePos, pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); // Erstmal ausgebaut als Hack fuer Bug 53378 // if ( nPopupFlags & FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK ) -// return FALSE; +// return sal_False; // else - return TRUE; + return sal_True; } else if ( nHitTest & IMPL_FLOATWIN_HITTEST_RECT ) { if ( !(pFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE) ) pFloat->ImplSetMouseDown(); - return TRUE; + return sal_True; } } else @@ -191,7 +190,7 @@ static BOOL ImplHandleMouseFloatMode( Window* pChild, const Point& rMousePos, { if ( pFloat->ImplIsMouseDown() ) pFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL ); - return TRUE; + return sal_True; } } else @@ -201,7 +200,7 @@ static BOOL ImplHandleMouseFloatMode( Window* pChild, const Point& rMousePos, if ( !(nPopupFlags & FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE) ) { pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); - return TRUE; + return sal_True; } } } @@ -216,21 +215,21 @@ static BOOL ImplHandleMouseFloatMode( Window* pChild, const Point& rMousePos, { if ( (nPopupFlags & FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE) && (nSVEvent == EVENT_MOUSEBUTTONUP) ) - return TRUE; + return sal_True; pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); if ( nPopupFlags & FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK ) - return FALSE; + return sal_False; else - return TRUE; + return sal_True; } else - return TRUE; + return sal_True; } } } } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -242,7 +241,7 @@ static void ImplHandleMouseHelpRequest( Window* pChild, const Point& rMousePos ) !( pSVData->maHelpData.mpHelpWin->IsWindowOrChild( pChild ) || pChild->IsWindowOrChild( pSVData->maHelpData.mpHelpWin ) ) ) { - USHORT nHelpMode = 0; + sal_uInt16 nHelpMode = 0; if ( pSVData->maHelpData.mbQuickHelp ) nHelpMode = HELPMODE_QUICK; if ( pSVData->maHelpData.mbBalloonHelp ) @@ -252,9 +251,9 @@ static void ImplHandleMouseHelpRequest( Window* pChild, const Point& rMousePos ) if ( pChild->IsInputEnabled() && ! pChild->IsInModalMode() ) { HelpEvent aHelpEvent( rMousePos, nHelpMode ); - pSVData->maHelpData.mbRequestingHelp = TRUE; + pSVData->maHelpData.mbRequestingHelp = sal_True; pChild->RequestHelp( aHelpEvent ); - pSVData->maHelpData.mbRequestingHelp = FALSE; + pSVData->maHelpData.mbRequestingHelp = sal_False; } // #104172# do not kill keyboard activated tooltips else if ( pSVData->maHelpData.mpHelpWin && !pSVData->maHelpData.mbKeyboardHelp) @@ -278,8 +277,8 @@ static void ImplSetMousePointer( Window* pChild ) // ----------------------------------------------------------------------- -static BOOL ImplCallCommand( Window* pChild, USHORT nEvt, void* pData = NULL, - BOOL bMouse = FALSE, Point* pPos = NULL ) +static sal_Bool ImplCallCommand( Window* pChild, sal_uInt16 nEvt, void* pData = NULL, + sal_Bool bMouse = sal_False, Point* pPos = NULL ) { Point aPos; if ( pPos ) @@ -299,24 +298,24 @@ static BOOL ImplCallCommand( Window* pChild, USHORT nEvt, void* pData = NULL, CommandEvent aCEvt( aPos, nEvt, bMouse, pData ); NotifyEvent aNCmdEvt( EVENT_COMMAND, pChild, &aCEvt ); ImplDelData aDelData( pChild ); - BOOL bPreNotify = (ImplCallPreNotify( aNCmdEvt ) != 0); + sal_Bool bPreNotify = (ImplCallPreNotify( aNCmdEvt ) != 0); if ( aDelData.IsDelete() ) - return FALSE; + return sal_False; if ( !bPreNotify ) { - pChild->ImplGetWindowImpl()->mbCommand = FALSE; + pChild->ImplGetWindowImpl()->mbCommand = sal_False; pChild->Command( aCEvt ); if( aDelData.IsDelete() ) - return FALSE; + return sal_False; pChild->ImplNotifyKeyMouseCommandEventListeners( aNCmdEvt ); if ( aDelData.IsDelete() ) - return FALSE; + return sal_False; if ( pChild->ImplGetWindowImpl()->mbCommand ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -339,24 +338,24 @@ static long ContextMenuEventLink( void* pCEvent, void* ) if( ! pEv->aDelData.IsDelete() ) { pEv->pWindow->ImplRemoveDel( &pEv->aDelData ); - ImplCallCommand( pEv->pWindow, COMMAND_CONTEXTMENU, NULL, TRUE, &pEv->aChildPos ); + ImplCallCommand( pEv->pWindow, COMMAND_CONTEXTMENU, NULL, sal_True, &pEv->aChildPos ); } delete pEv; return 0; } -long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, - long nX, long nY, ULONG nMsgTime, - USHORT nCode, USHORT nMode ) +long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouseLeave, + long nX, long nY, sal_uLong nMsgTime, + sal_uInt16 nCode, sal_uInt16 nMode ) { ImplSVData* pSVData = ImplGetSVData(); Point aMousePos( nX, nY ); Window* pChild; long nRet; - USHORT nClicks; + sal_uInt16 nClicks; ImplFrameData* pWinFrameData = pWindow->ImplGetFrameData(); - USHORT nOldCode = pWinFrameData->mnMouseCode; + sal_uInt16 nOldCode = pWinFrameData->mnMouseCode; // we need a mousemove event, befor we get a mousebuttondown or a // mousebuttonup event @@ -379,7 +378,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, if ( (pWinFrameData->mnLastMouseX != nX) || (pWinFrameData->mnLastMouseY != nY) ) { - ImplHandleMouseEvent( pWindow, EVENT_MOUSEMOVE, FALSE, nX, nY, nMsgTime, nCode, nMode ); + ImplHandleMouseEvent( pWindow, EVENT_MOUSEMOVE, sal_False, nX, nY, nMsgTime, nCode, nMode ); } } @@ -392,7 +391,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, pWinFrameData->mnMouseMode = nMode & ~(MOUSE_SYNTHETIC | MOUSE_MODIFIERCHANGED); if ( bMouseLeave ) { - pWinFrameData->mbMouseIn = FALSE; + pWinFrameData->mbMouseIn = sal_False; if ( pSVData->maHelpData.mpHelpWin && !pSVData->maHelpData.mbKeyboardHelp ) { ImplDelData aDelData( pWindow ); @@ -404,7 +403,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, } } else - pWinFrameData->mbMouseIn = TRUE; + pWinFrameData->mbMouseIn = sal_True; DBG_ASSERT( !pSVData->maWinData.mpTrackWin || (pSVData->maWinData.mpTrackWin == pSVData->maWinData.mpCaptureWin), @@ -557,7 +556,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, !(((nMouseY-nDragH) <= pMouseDownWin->ImplGetFrameData()->mnFirstMouseY) && ((nMouseY+nDragH) >= pMouseDownWin->ImplGetFrameData()->mnFirstMouseY)) ) { - pMouseDownWin->ImplGetFrameData()->mbStartDragCalled = TRUE; + pMouseDownWin->ImplGetFrameData()->mbStartDragCalled = sal_True; // Check if drag source provides it's own recognizer if( pMouseDownWin->ImplGetFrameData()->mbInternalDragGestureRecognizer ) @@ -588,7 +587,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, nClicks, sal_False ); - ULONG nCount = Application::ReleaseSolarMutex(); + sal_uLong nCount = Application::ReleaseSolarMutex(); // FIXME: where do I get Action from ? ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > xDragSource = pMouseDownWin->GetDragSource(); @@ -606,7 +605,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, } } else - pMouseDownWin->ImplGetFrameData()->mbStartDragCalled = TRUE; + pMouseDownWin->ImplGetFrameData()->mbStartDragCalled = sal_True; } // test for mouseleave and mouseenter @@ -620,8 +619,8 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, NotifyEvent aNLeaveEvt( EVENT_MOUSEMOVE, pMouseMoveWin, &aMLeaveEvt ); ImplDelData aDelData; ImplDelData aDelData2; - pWinFrameData->mbInMouseMove = TRUE; - pMouseMoveWin->ImplGetWinData()->mbMouseOver = FALSE; + pWinFrameData->mbInMouseMove = sal_True; + pMouseMoveWin->ImplGetWinData()->mbMouseOver = sal_False; pMouseMoveWin->ImplAddDel( &aDelData ); // Durch MouseLeave kann auch dieses Fenster zerstoert // werden @@ -636,7 +635,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, } pWinFrameData->mpMouseMoveWin = NULL; - pWinFrameData->mbInMouseMove = FALSE; + pWinFrameData->mbInMouseMove = sal_False; if ( pChild ) { @@ -654,7 +653,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, } pWinFrameData->mpMouseMoveWin = pChild; if( pChild ) - pChild->ImplGetWinData()->mbMouseOver = TRUE; + pChild->ImplGetWinData()->mbMouseOver = sal_True; // MouseLeave if ( !pChild ) @@ -666,7 +665,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, if ( nSVEvent == EVENT_MOUSEBUTTONDOWN ) { const MouseSettings& rMSettings = pChild->GetSettings().GetMouseSettings(); - ULONG nDblClkTime = rMSettings.GetDoubleClickTime(); + sal_uLong nDblClkTime = rMSettings.GetDoubleClickTime(); long nDblClkW = rMSettings.GetDoubleClickWidth(); long nDblClkH = rMSettings.GetDoubleClickHeight(); //long nMouseX = nX; @@ -683,7 +682,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, ((nMouseY+nDblClkH) >= pChild->ImplGetFrameData()->mnFirstMouseY) ) { pChild->ImplGetFrameData()->mnClickCount++; - pChild->ImplGetFrameData()->mbStartDragCalled = TRUE; + pChild->ImplGetFrameData()->mbStartDragCalled = sal_True; } else { @@ -722,7 +721,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, if ( !aDelData.IsDelete() ) { pChild->ImplRemoveDel( &aDelData ); - pChild->ImplGetFrameData()->mbStartDragCalled = TRUE; + pChild->ImplGetFrameData()->mbStartDragCalled = sal_True; } return 1; } @@ -731,15 +730,15 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, } // call handler - BOOL bDrag = FALSE; - BOOL bCallHelpRequest = TRUE; + sal_Bool bDrag = sal_False; + sal_Bool bCallHelpRequest = sal_True; DBG_ASSERT( pChild, "ImplHandleMouseEvent: pChild is NULL" ); ImplDelData aDelData; NotifyEvent aNEvt( nSVEvent, pChild, &aMEvt ); pChild->ImplAddDel( &aDelData ); if ( nSVEvent == EVENT_MOUSEMOVE ) - pChild->ImplGetFrameData()->mbInMouseMove = TRUE; + pChild->ImplGetFrameData()->mbInMouseMove = sal_True; // bring window into foreground on mouseclick if ( nSVEvent == EVENT_MOUSEBUTTONDOWN ) @@ -769,7 +768,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, (pSVData->maWinData.mnTrackFlags & STARTTRACK_SCROLLREPEAT) ) pSVData->maWinData.mpTrackTimer->Start(); } - bCallHelpRequest = FALSE; + bCallHelpRequest = sal_False; nRet = 1; } else @@ -780,16 +779,16 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, pChild->ToTop( TOTOP_NOGRABFOCUS ); if( aDelData.IsDelete() ) - bCallHelpRequest = FALSE; + bCallHelpRequest = sal_False; else { // if the MouseMove handler changes the help window's visibility // the HelpRequest handler should not be called anymore Window* pOldHelpTextWin = pSVData->maHelpData.mpHelpWin; - pChild->ImplGetWindowImpl()->mbMouseMove = FALSE; + pChild->ImplGetWindowImpl()->mbMouseMove = sal_False; pChild->MouseMove( aMEvt ); if ( pOldHelpTextWin != pSVData->maHelpData.mpHelpWin ) - bCallHelpRequest = FALSE; + bCallHelpRequest = sal_False; } } } @@ -800,7 +799,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, nRet = 1; else { - pChild->ImplGetWindowImpl()->mbMouseButtonDown = FALSE; + pChild->ImplGetWindowImpl()->mbMouseButtonDown = sal_False; pChild->MouseButtonDown( aMEvt ); } } @@ -813,7 +812,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, } else { - pChild->ImplGetWindowImpl()->mbMouseButtonUp = FALSE; + pChild->ImplGetWindowImpl()->mbMouseButtonUp = sal_False; pChild->MouseButtonUp( aMEvt ); } } @@ -828,7 +827,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, if ( nSVEvent == EVENT_MOUSEMOVE ) - pChild->ImplGetWindowImpl()->mpFrameData->mbInMouseMove = FALSE; + pChild->ImplGetWindowImpl()->mpFrameData->mbInMouseMove = sal_False; if ( nSVEvent == EVENT_MOUSEMOVE ) { @@ -866,11 +865,11 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, if ( /*(nRet == 0) &&*/ (nClicks == 1) && (nSVEvent == EVENT_MOUSEBUTTONDOWN) && (nCode == MOUSE_MIDDLE) ) { - USHORT nMiddleAction = pChild->GetSettings().GetMouseSettings().GetMiddleButtonAction(); + sal_uInt16 nMiddleAction = pChild->GetSettings().GetMouseSettings().GetMiddleButtonAction(); if ( nMiddleAction == MOUSE_MIDDLE_AUTOSCROLL ) - nRet = !ImplCallCommand( pChild, COMMAND_STARTAUTOSCROLL, NULL, TRUE, &aChildPos ); + nRet = !ImplCallCommand( pChild, COMMAND_STARTAUTOSCROLL, NULL, sal_True, &aChildPos ); else if ( nMiddleAction == MOUSE_MIDDLE_PASTESELECTION ) - nRet = !ImplCallCommand( pChild, COMMAND_PASTESELECTION, NULL, TRUE, &aChildPos ); + nRet = !ImplCallCommand( pChild, COMMAND_PASTESELECTION, NULL, sal_True, &aChildPos ); } else { @@ -879,7 +878,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, if ( (nCode == rMSettings.GetContextMenuCode()) && (nClicks == rMSettings.GetContextMenuClicks()) ) { - BOOL bContextMenu; + sal_Bool bContextMenu; if ( rMSettings.GetContextMenuDown() ) bContextMenu = (nSVEvent == EVENT_MOUSEBUTTONDOWN); else @@ -903,7 +902,7 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, Application::PostUserEvent( Link( pEv, ContextMenuEventLink ) ); } else - nRet = ! ImplCallCommand( pChild, COMMAND_CONTEXTMENU, NULL, TRUE, &aChildPos ); + nRet = ! ImplCallCommand( pChild, COMMAND_CONTEXTMENU, NULL, sal_True, &aChildPos ); } } } @@ -958,20 +957,20 @@ static Window* ImplGetKeyInputWindow( Window* pWindow ) // ----------------------------------------------------------------------- -static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, - USHORT nKeyCode, USHORT nCharCode, USHORT nRepeat, BOOL bForward ) +static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, + sal_uInt16 nKeyCode, sal_uInt16 nCharCode, sal_uInt16 nRepeat, sal_Bool bForward ) { ImplSVData* pSVData = ImplGetSVData(); KeyCode aKeyCode( nKeyCode, nKeyCode ); - USHORT nEvCode = aKeyCode.GetCode(); + sal_uInt16 nEvCode = aKeyCode.GetCode(); // allow application key listeners to remove the key event - // but make sure we're not forwarding external KeyEvents, (ie where bForward is FALSE) + // but make sure we're not forwarding external KeyEvents, (ie where bForward is sal_False) // becasue those are coming back from the listener itself and MUST be processed KeyEvent aKeyEvent( (xub_Unicode)nCharCode, aKeyCode, nRepeat ); if( bForward ) { - USHORT nVCLEvent; + sal_uInt16 nVCLEvent; switch( nSVEvent ) { case EVENT_KEYINPUT: @@ -994,11 +993,11 @@ static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, if( Application::GetSettings().GetMiscSettings().GetEnableLocalizedDecimalSep() ) { String aSep( pWindow->GetSettings().GetLocaleDataWrapper().getNumDecimalSep() ); - nCharCode = (USHORT) aSep.GetChar(0); + nCharCode = (sal_uInt16) aSep.GetChar(0); } } - BOOL bCtrlF6 = (aKeyCode.GetCode() == KEY_F6) && aKeyCode.IsMod1(); + sal_Bool bCtrlF6 = (aKeyCode.GetCode() == KEY_F6) && aKeyCode.IsMod1(); // determine last input time pSVData->maAppData.mnLastInputTime = Time::GetSystemTicks(); @@ -1034,7 +1033,7 @@ static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, if ( pSVData->maWinData.mpTrackWin ) { - USHORT nOrigCode = aKeyCode.GetCode(); + sal_uInt16 nOrigCode = aKeyCode.GetCode(); if ( (nOrigCode == KEY_ESCAPE) && !(pSVData->maWinData.mnTrackFlags & STARTTRACK_NOKEYCANCEL) ) { @@ -1044,7 +1043,7 @@ static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, FloatingWindow* pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat(); if ( !(pLastLevelFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOKEYCLOSE) ) { - USHORT nEscCode = aKeyCode.GetCode(); + sal_uInt16 nEscCode = aKeyCode.GetCode(); if ( nEscCode == KEY_ESCAPE ) pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); @@ -1067,7 +1066,7 @@ static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, FloatingWindow* pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat(); if ( !(pLastLevelFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOKEYCLOSE) ) { - USHORT nCode = aKeyCode.GetCode(); + sal_uInt16 nCode = aKeyCode.GetCode(); if ( (nCode == KEY_ESCAPE) || bCtrlF6) { @@ -1102,19 +1101,19 @@ static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, KeyEvent aKeyEvt( (xub_Unicode)nCharCode, aKeyCode, nRepeat ); NotifyEvent aNotifyEvt( nSVEvent, pChild, &aKeyEvt ); - BOOL bKeyPreNotify = (ImplCallPreNotify( aNotifyEvt ) != 0); + sal_Bool bKeyPreNotify = (ImplCallPreNotify( aNotifyEvt ) != 0); long nRet = 1; if ( !bKeyPreNotify && !aDelData.IsDelete() ) { if ( nSVEvent == EVENT_KEYINPUT ) { - pChild->ImplGetWindowImpl()->mbKeyInput = FALSE; + pChild->ImplGetWindowImpl()->mbKeyInput = sal_False; pChild->KeyInput( aKeyEvt ); } else { - pChild->ImplGetWindowImpl()->mbKeyUp = FALSE; + pChild->ImplGetWindowImpl()->mbKeyUp = sal_False; pChild->KeyUp( aKeyEvt ); } // #82968# @@ -1131,10 +1130,10 @@ static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, { if ( !bKeyPreNotify && pChild->ImplGetWindowImpl()->mbKeyInput ) { - USHORT nCode = aKeyCode.GetCode(); + sal_uInt16 nCode = aKeyCode.GetCode(); // #101999# is focus in or below toolbox - BOOL bToolboxFocus=FALSE; + sal_Bool bToolboxFocus=sal_False; if( (nCode == KEY_F1) && aKeyCode.IsShift() ) { Window *pWin = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin; @@ -1142,7 +1141,7 @@ static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, { if( pWin->ImplGetWindowImpl()->mbToolBox ) { - bToolboxFocus = TRUE; + bToolboxFocus = sal_True; break; } else @@ -1152,7 +1151,7 @@ static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, // ContextMenu if ( (nCode == KEY_CONTEXTMENU) || ((nCode == KEY_F10) && aKeyCode.IsShift() && !aKeyCode.IsMod1() && !aKeyCode.IsMod2() ) ) - nRet = !ImplCallCommand( pChild, COMMAND_CONTEXTMENU, NULL, FALSE ); + nRet = !ImplCallCommand( pChild, COMMAND_CONTEXTMENU, NULL, sal_False ); else if ( ( (nCode == KEY_F2) && aKeyCode.IsShift() ) || ( (nCode == KEY_F1) && aKeyCode.IsMod1() ) || // #101999# no active help when focus in toolbox, simulate BallonHelp instead ( (nCode == KEY_F1) && aKeyCode.IsShift() && bToolboxFocus ) ) @@ -1165,10 +1164,10 @@ static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, aPos = pChild->OutputToScreenPixel( aPos ); HelpEvent aHelpEvent( aPos, HELPMODE_BALLOON ); - aHelpEvent.SetKeyboardActivated( TRUE ); - pSVData->maHelpData.mbSetKeyboardHelp = TRUE; + aHelpEvent.SetKeyboardActivated( sal_True ); + pSVData->maHelpData.mbSetKeyboardHelp = sal_True; pChild->RequestHelp( aHelpEvent ); - pSVData->maHelpData.mbSetKeyboardHelp = FALSE; + pSVData->maHelpData.mbSetKeyboardHelp = sal_False; } else if ( (nCode == KEY_F1) || (nCode == KEY_HELP) ) { @@ -1215,7 +1214,7 @@ static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, ImplDelData aChildDelData( pChild ); KeyEvent aKEvt( (xub_Unicode)nCharCode, aKeyCode, nRepeat ); NotifyEvent aNEvt( nSVEvent, pChild, &aKEvt ); - BOOL bPreNotify = (ImplCallPreNotify( aNEvt ) != 0); + sal_Bool bPreNotify = (ImplCallPreNotify( aNEvt ) != 0); if ( aChildDelData.IsDelete() ) return 1; @@ -1223,12 +1222,12 @@ static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, { if ( nSVEvent == EVENT_KEYINPUT ) { - pChild->ImplGetWindowImpl()->mbKeyInput = FALSE; + pChild->ImplGetWindowImpl()->mbKeyInput = sal_False; pChild->KeyInput( aKEvt ); } else { - pChild->ImplGetWindowImpl()->mbKeyUp = FALSE; + pChild->ImplGetWindowImpl()->mbKeyUp = sal_False; pChild->KeyUp( aKEvt ); } // #82968# @@ -1249,8 +1248,8 @@ static long ImplHandleKey( Window* pWindow, USHORT nSVEvent, static long ImplHandleExtTextInput( Window* pWindow, const XubString& rText, - const USHORT* pTextAttr, - ULONG nCursorPos, USHORT nCursorFlags ) + const sal_uInt16* pTextAttr, + sal_uLong nCursorPos, sal_uInt16 nCursorFlags ) { ImplSVData* pSVData = ImplGetSVData(); Window* pChild = NULL; @@ -1275,7 +1274,7 @@ static long ImplHandleExtTextInput( Window* pWindow, ImplWinData* pWinData = pChild->ImplGetWinData(); if ( !pChild->ImplGetWindowImpl()->mbExtTextInput ) { - pChild->ImplGetWindowImpl()->mbExtTextInput = TRUE; + pChild->ImplGetWindowImpl()->mbExtTextInput = sal_True; if ( !pWinData->mpExtOldText ) pWinData->mpExtOldText = new UniString; else @@ -1294,7 +1293,7 @@ static long ImplHandleExtTextInput( Window* pWindow, return 0; // Test for changes - BOOL bOnlyCursor = FALSE; + sal_Bool bOnlyCursor = sal_False; xub_StrLen nMinLen = Min( pWinData->mpExtOldText->Len(), rText.Len() ); xub_StrLen nDeltaStart = 0; while ( nDeltaStart < nMinLen ) @@ -1323,7 +1322,7 @@ static long ImplHandleExtTextInput( Window* pWindow, } if ( (nDeltaStart >= nMinLen) && (pWinData->mpExtOldText->Len() == rText.Len()) ) - bOnlyCursor = TRUE; + bOnlyCursor = sal_True; // Call Event and store the information CommandExtTextInputData aData( rText, pTextAttr, @@ -1338,8 +1337,8 @@ static long ImplHandleExtTextInput( Window* pWindow, } if ( pTextAttr ) { - pWinData->mpExtOldAttrAry = new USHORT[rText.Len()]; - memcpy( pWinData->mpExtOldAttrAry, pTextAttr, rText.Len()*sizeof( USHORT ) ); + pWinData->mpExtOldAttrAry = new sal_uInt16[rText.Len()]; + memcpy( pWinData->mpExtOldAttrAry, pTextAttr, rText.Len()*sizeof( sal_uInt16 ) ); } return !ImplCallCommand( pChild, COMMAND_EXTTEXTINPUT, &aData ); } @@ -1354,7 +1353,7 @@ static long ImplHandleEndExtTextInput( Window* /* pWindow */ ) if ( pChild ) { - pChild->ImplGetWindowImpl()->mbExtTextInput = FALSE; + pChild->ImplGetWindowImpl()->mbExtTextInput = sal_False; pSVData->maWinData.mpExtTextInputWin = NULL; ImplWinData* pWinData = pChild->ImplGetWinData(); if ( pWinData->mpExtOldText ) @@ -1431,26 +1430,26 @@ static long ImplHandleInputContextChange( Window* pWindow, LanguageType eNewLang // ----------------------------------------------------------------------- -static BOOL ImplCallWheelCommand( Window* pWindow, const Point& rPos, +static sal_Bool ImplCallWheelCommand( Window* pWindow, const Point& rPos, const CommandWheelData* pWheelData ) { Point aCmdMousePos = pWindow->ImplFrameToOutput( rPos ); - CommandEvent aCEvt( aCmdMousePos, COMMAND_WHEEL, TRUE, pWheelData ); + CommandEvent aCEvt( aCmdMousePos, COMMAND_WHEEL, sal_True, pWheelData ); NotifyEvent aNCmdEvt( EVENT_COMMAND, pWindow, &aCEvt ); ImplDelData aDelData( pWindow ); - BOOL bPreNotify = (ImplCallPreNotify( aNCmdEvt ) != 0); + sal_Bool bPreNotify = (ImplCallPreNotify( aNCmdEvt ) != 0); if ( aDelData.IsDelete() ) - return FALSE; + return sal_False; if ( !bPreNotify ) { - pWindow->ImplGetWindowImpl()->mbCommand = FALSE; + pWindow->ImplGetWindowImpl()->mbCommand = sal_False; pWindow->Command( aCEvt ); if ( aDelData.IsDelete() ) - return FALSE; + return sal_False; if ( pWindow->ImplGetWindowImpl()->mbCommand ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -1467,8 +1466,8 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv if( aDogTag.IsDelete() ) return 0; - USHORT nMode; - USHORT nCode = rEvt.mnCode; + sal_uInt16 nMode; + sal_uInt16 nCode = rEvt.mnCode; bool bHorz = rEvt.mbHorz; bool bPixel = rEvt.mbDeltaIsPixel; if ( nCode & KEY_MOD1 ) @@ -1485,7 +1484,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv CommandWheelData aWheelData( rEvt.mnDelta, rEvt.mnNotchDelta, rEvt.mnScrollLines, nMode, nCode, bHorz, bPixel ); Point aMousePos( rEvt.mnX, rEvt.mnY ); - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; // first check any floating window ( eg. drop down listboxes) bool bIsFloat = false; @@ -1493,7 +1492,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv if ( pSVData->maWinData.mpFirstFloat && !pSVData->maWinData.mpCaptureWin && !pSVData->maWinData.mpFirstFloat->ImplIsFloatPopupModeWindow( pWindow ) ) { - USHORT nHitTest = IMPL_FLOATWIN_HITTEST_OUTSIDE; + sal_uInt16 nHitTest = IMPL_FLOATWIN_HITTEST_OUTSIDE; pMouseWindow = pSVData->maWinData.mpFirstFloat->ImplFloatHitTest( pWindow, aMousePos, nHitTest ); } // then try the window directly beneath the mouse @@ -1547,7 +1546,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv FloatingWindow* pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat(); if( pLastLevelFloat ) { - ULONG nPopupFlags = pLastLevelFloat->GetPopupModeFlags(); + sal_uLong nPopupFlags = pLastLevelFloat->GetPopupModeFlags(); if ( nPopupFlags & FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE ) { pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); @@ -1559,7 +1558,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv } // ----------------------------------------------------------------------- -#define IMPL_PAINT_CHECKRTL ((USHORT)0x0020) +#define IMPL_PAINT_CHECKRTL ((sal_uInt16)0x0020) static void ImplHandlePaint( Window* pWindow, const Rectangle& rBoundRect, bool bImmediateUpdate ) { @@ -1598,7 +1597,7 @@ static void KillOwnPopups( Window* pWindow ) ImplSVData* pSVData = ImplGetSVData(); Window *pParent = pWindow->ImplGetWindowImpl()->mpFrameWindow; Window *pChild = pSVData->maWinData.mpFirstFloat; - if ( pChild && pParent->ImplIsWindowOrChild( pChild, TRUE ) ) + if ( pChild && pParent->ImplIsWindowOrChild( pChild, sal_True ) ) { if ( !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE) ) pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); @@ -1625,7 +1624,7 @@ void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight ) { pWindow->mnOutWidth = nNewWidth; pWindow->mnOutHeight = nNewHeight; - pWindow->ImplGetWindowImpl()->mbWaitSystemResize = FALSE; + pWindow->ImplGetWindowImpl()->mbWaitSystemResize = sal_False; if ( pWindow->IsReallyVisible() ) pWindow->ImplSetClipFlag(); if ( pWindow->IsVisible() || pWindow->ImplGetWindow()->ImplGetWindowImpl()->mbAllResize || @@ -1656,13 +1655,13 @@ void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight ) pWindow->ImplCallResize(); // otherwise menues cannot be positioned } else - pWindow->ImplGetWindowImpl()->mbCallResize = TRUE; + pWindow->ImplGetWindowImpl()->mbCallResize = sal_True; } } pWindow->ImplGetWindowImpl()->mpFrameData->mbNeedSysWindow = (nNewWidth < IMPL_MIN_NEEDSYSWIN) || (nNewHeight < IMPL_MIN_NEEDSYSWIN); - BOOL bMinimized = (nNewWidth <= 0) || (nNewHeight <= 0); + sal_Bool bMinimized = (nNewWidth <= 0) || (nNewHeight <= 0); if( bMinimized != pWindow->ImplGetWindowImpl()->mpFrameData->mbMinimized ) pWindow->ImplGetWindowImpl()->mpFrameWindow->ImplNotifyIconifiedState( bMinimized ); pWindow->ImplGetWindowImpl()->mpFrameData->mbMinimized = bMinimized; @@ -1688,7 +1687,7 @@ static void ImplHandleMove( Window* pWindow ) if ( pWindow->IsVisible() ) pWindow->ImplCallMove(); else - pWindow->ImplGetWindowImpl()->mbCallMove = TRUE; // make sure the framepos will be updated on the next Show() + pWindow->ImplGetWindowImpl()->mbCallMove = sal_True; // make sure the framepos will be updated on the next Show() if ( pWindow->ImplGetWindowImpl()->mbFrame && pWindow->ImplGetWindowImpl()->mpClientWindow ) pWindow->ImplGetWindowImpl()->mpClientWindow->ImplCallMove(); // notify client to update geometry @@ -1705,7 +1704,7 @@ static void ImplHandleMoveResize( Window* pWindow, long nNewWidth, long nNewHeig // ----------------------------------------------------------------------- -static void ImplActivateFloatingWindows( Window* pWindow, BOOL bActive ) +static void ImplActivateFloatingWindows( Window* pWindow, sal_Bool bActive ) { // Zuerst alle ueberlappenden Fenster ueberpruefen Window* pTempWindow = pWindow->ImplGetWindowImpl()->mpFirstOverlap; @@ -1733,7 +1732,7 @@ IMPL_LINK( Window, ImplAsyncFocusHdl, void*, EMPTYARG ) // Wenn Status erhalten geblieben ist, weil wir den Focus in der // zwischenzeit schon wiederbekommen haben, brauchen wir auch // nichts machen - BOOL bHasFocus = ImplGetWindowImpl()->mpFrameData->mbHasFocus || ImplGetWindowImpl()->mpFrameData->mbSysObjFocus; + sal_Bool bHasFocus = ImplGetWindowImpl()->mpFrameData->mbHasFocus || ImplGetWindowImpl()->mpFrameData->mbSysObjFocus; // Dann die zeitverzoegerten Funktionen ausfuehren if ( bHasFocus ) @@ -1744,21 +1743,21 @@ IMPL_LINK( Window, ImplAsyncFocusHdl, void*, EMPTYARG ) if ( ImplGetWindowImpl()->mpFrameData->mpFocusWin ) { - BOOL bHandled = FALSE; + sal_Bool bHandled = sal_False; if ( ImplGetWindowImpl()->mpFrameData->mpFocusWin->IsInputEnabled() && ! ImplGetWindowImpl()->mpFrameData->mpFocusWin->IsInModalMode() ) { if ( ImplGetWindowImpl()->mpFrameData->mpFocusWin->IsEnabled() ) { ImplGetWindowImpl()->mpFrameData->mpFocusWin->GrabFocus(); - bHandled = TRUE; + bHandled = sal_True; } else if( ImplGetWindowImpl()->mpFrameData->mpFocusWin->ImplHasDlgCtrl() ) { // #109094# if the focus is restored to a disabled dialog control (was disabled meanwhile) // try to move it to the next control ImplGetWindowImpl()->mpFrameData->mpFocusWin->ImplDlgCtrlNextWindow(); - bHandled = TRUE; + bHandled = sal_True; } } if ( !bHandled ) @@ -1799,11 +1798,11 @@ IMPL_LINK( Window, ImplAsyncFocusHdl, void*, EMPTYARG ) Window* pOldOverlapWindow = pOldFocusWindow->ImplGetFirstOverlapWindow(); Window* pOldRealWindow = pOldOverlapWindow->ImplGetWindow(); - pOldOverlapWindow->ImplGetWindowImpl()->mbActive = FALSE; + pOldOverlapWindow->ImplGetWindowImpl()->mbActive = sal_False; pOldOverlapWindow->Deactivate(); if ( pOldRealWindow != pOldOverlapWindow ) { - pOldRealWindow->ImplGetWindowImpl()->mbActive = FALSE; + pOldRealWindow->ImplGetWindowImpl()->mbActive = sal_False; pOldRealWindow->Deactivate(); } } @@ -1839,7 +1838,7 @@ IMPL_LINK( Window, ImplAsyncFocusHdl, void*, EMPTYARG ) static void ImplHandleGetFocus( Window* pWindow ) { - pWindow->ImplGetWindowImpl()->mpFrameData->mbHasFocus = TRUE; + pWindow->ImplGetWindowImpl()->mpFrameData->mbHasFocus = sal_True; // Focus-Events zeitverzoegert ausfuehren, damit bei SystemChildFenstern // nicht alles flackert, wenn diese den Focus bekommen @@ -1883,7 +1882,7 @@ static void ImplHandleLoseFocus( Window* pWindow ) pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); } - pWindow->ImplGetWindowImpl()->mpFrameData->mbHasFocus = FALSE; + pWindow->ImplGetWindowImpl()->mpFrameData->mbHasFocus = sal_False; // Focus-Events zeitverzoegert ausfuehren, damit bei SystemChildFenstern // nicht alles flackert, wenn diese den Focus bekommen @@ -2004,9 +2003,9 @@ static void ImplHandleUserEvent( ImplSVEvent* pSVEvent ) // ======================================================================= -static USHORT ImplGetMouseMoveMode( SalMouseEvent* pEvent ) +static sal_uInt16 ImplGetMouseMoveMode( SalMouseEvent* pEvent ) { - USHORT nMode = 0; + sal_uInt16 nMode = 0; if ( !pEvent->mnCode ) nMode |= MOUSE_SIMPLEMOVE; if ( (pEvent->mnCode & MOUSE_LEFT) && !(pEvent->mnCode & KEY_MOD1) ) @@ -2018,9 +2017,9 @@ static USHORT ImplGetMouseMoveMode( SalMouseEvent* pEvent ) // ----------------------------------------------------------------------- -static USHORT ImplGetMouseButtonMode( SalMouseEvent* pEvent ) +static sal_uInt16 ImplGetMouseButtonMode( SalMouseEvent* pEvent ) { - USHORT nMode = 0; + sal_uInt16 nMode = 0; if ( pEvent->mnButton == MOUSE_LEFT ) nMode |= MOUSE_SIMPLECLICK; if ( (pEvent->mnButton == MOUSE_LEFT) && !(pEvent->mnCode & (MOUSE_MIDDLE | MOUSE_RIGHT)) ) @@ -2038,7 +2037,7 @@ static USHORT ImplGetMouseButtonMode( SalMouseEvent* pEvent ) inline long ImplHandleSalMouseLeave( Window* pWindow, SalMouseEvent* pEvent ) { - return ImplHandleMouseEvent( pWindow, EVENT_MOUSEMOVE, TRUE, + return ImplHandleMouseEvent( pWindow, EVENT_MOUSEMOVE, sal_True, pEvent->mnX, pEvent->mnY, pEvent->mnTime, pEvent->mnCode, ImplGetMouseMoveMode( pEvent ) ); @@ -2048,7 +2047,7 @@ inline long ImplHandleSalMouseLeave( Window* pWindow, SalMouseEvent* pEvent ) inline long ImplHandleSalMouseMove( Window* pWindow, SalMouseEvent* pEvent ) { - return ImplHandleMouseEvent( pWindow, EVENT_MOUSEMOVE, FALSE, + return ImplHandleMouseEvent( pWindow, EVENT_MOUSEMOVE, sal_False, pEvent->mnX, pEvent->mnY, pEvent->mnTime, pEvent->mnCode, ImplGetMouseMoveMode( pEvent ) ); @@ -2058,7 +2057,7 @@ inline long ImplHandleSalMouseMove( Window* pWindow, SalMouseEvent* pEvent ) inline long ImplHandleSalMouseButtonDown( Window* pWindow, SalMouseEvent* pEvent ) { - return ImplHandleMouseEvent( pWindow, EVENT_MOUSEBUTTONDOWN, FALSE, + return ImplHandleMouseEvent( pWindow, EVENT_MOUSEBUTTONDOWN, sal_False, pEvent->mnX, pEvent->mnY, pEvent->mnTime, #ifdef MACOSX @@ -2073,7 +2072,7 @@ inline long ImplHandleSalMouseButtonDown( Window* pWindow, SalMouseEvent* pEvent inline long ImplHandleSalMouseButtonUp( Window* pWindow, SalMouseEvent* pEvent ) { - return ImplHandleMouseEvent( pWindow, EVENT_MOUSEBUTTONUP, FALSE, + return ImplHandleMouseEvent( pWindow, EVENT_MOUSEBUTTONUP, sal_False, pEvent->mnX, pEvent->mnY, pEvent->mnTime, #ifdef MACOSX @@ -2088,12 +2087,12 @@ inline long ImplHandleSalMouseButtonUp( Window* pWindow, SalMouseEvent* pEvent ) static long ImplHandleSalMouseActivate( Window* /*pWindow*/, SalMouseActivateEvent* /*pEvent*/ ) { - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -static long ImplHandleMenuEvent( Window* pWindow, SalMenuEvent* pEvent, USHORT nEvent ) +static long ImplHandleMenuEvent( Window* pWindow, SalMenuEvent* pEvent, sal_uInt16 nEvent ) { // Find SystemWindow and its Menubar and let it dispatch the command long nRet = 0; @@ -2143,11 +2142,11 @@ static void ImplHandleSalKeyMod( Window* pWindow, SalKeyModEvent* pEvent ) if ( pTrackWin ) pWindow = pTrackWin; #ifdef MACOSX - USHORT nOldCode = pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3); + sal_uInt16 nOldCode = pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3); #else - USHORT nOldCode = pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2); + sal_uInt16 nOldCode = pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2); #endif - USHORT nNewCode = pEvent->mnCode; + sal_uInt16 nNewCode = pEvent->mnCode; if ( nOldCode != nNewCode ) { #ifdef MACOSX @@ -2155,7 +2154,7 @@ static void ImplHandleSalKeyMod( Window* pWindow, SalKeyModEvent* pEvent ) #else nNewCode |= pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & ~(KEY_SHIFT | KEY_MOD1 | KEY_MOD2); #endif - pWindow->ImplGetWindowImpl()->mpFrameWindow->ImplCallMouseMove( nNewCode, TRUE ); + pWindow->ImplGetWindowImpl()->mpFrameWindow->ImplCallMouseMove( nNewCode, sal_True ); } // #105224# send commandevent to allow special treatment of Ctrl-LeftShift/Ctrl-RightShift etc. @@ -2187,7 +2186,7 @@ static void ImplHandleInputLanguageChange( Window* pWindow ) // ----------------------------------------------------------------------- -static void ImplHandleSalSettings( Window* pWindow, USHORT nEvent ) +static void ImplHandleSalSettings( Window* pWindow, sal_uInt16 nEvent ) { // Application Notification werden nur fuer das erste Window ausgeloest ImplSVData* pSVData = ImplGetSVData(); @@ -2207,7 +2206,7 @@ static void ImplHandleSalSettings( Window* pWindow, USHORT nEvent ) } else { - USHORT nType; + sal_uInt16 nType; switch ( nEvent ) { case SALEVENT_VOLUMECHANGED: @@ -2221,7 +2220,7 @@ static void ImplHandleSalSettings( Window* pWindow, USHORT nEvent ) nType = DATACHANGED_DISPLAY; break; case SALEVENT_FONTCHANGED: - OutputDevice::ImplUpdateAllFontData( TRUE ); + OutputDevice::ImplUpdateAllFontData( sal_True ); nType = DATACHANGED_FONTS; break; case SALEVENT_DATETIMECHANGED: @@ -2271,7 +2270,7 @@ static void ImplHandleSalExtTextInputPos( Window* pWindow, SalExtTextInputPosEve static long ImplHandleShowDialog( Window* pWindow, int nDialogId ) { if( ! pWindow ) - return FALSE; + return sal_False; if( pWindow->GetType() == WINDOW_BORDERWINDOW ) { @@ -2335,8 +2334,8 @@ static void ImplHandleSalSurroundingTextRequest( Window *pWindow, // ----------------------------------------------------------------------- static void ImplHandleSurroundingTextSelectionChange( Window *pWindow, - ULONG nStart, - ULONG nEnd ) + sal_uLong nStart, + sal_uLong nEnd ) { Window* pChild = ImplGetKeyInputWindow( pWindow ); if( pChild ) @@ -2358,7 +2357,7 @@ static void ImplHandleStartReconversion( Window *pWindow ) // ----------------------------------------------------------------------- long ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/, - USHORT nEvent, const void* pEvent ) + sal_uInt16 nEvent, const void* pEvent ) { DBG_TESTSOLARMUTEX(); @@ -2433,28 +2432,28 @@ long ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/, { SalKeyEvent* pKeyEvt = (SalKeyEvent*)pEvent; nRet = ImplHandleKey( pWindow, EVENT_KEYINPUT, - pKeyEvt->mnCode, pKeyEvt->mnCharCode, pKeyEvt->mnRepeat, TRUE ); + pKeyEvt->mnCode, pKeyEvt->mnCharCode, pKeyEvt->mnRepeat, sal_True ); } break; case SALEVENT_EXTERNALKEYINPUT: { KeyEvent* pKeyEvt = (KeyEvent*) pEvent; nRet = ImplHandleKey( pWindow, EVENT_KEYINPUT, - pKeyEvt->GetKeyCode().GetFullCode(), pKeyEvt->GetCharCode(), pKeyEvt->GetRepeat(), FALSE ); + pKeyEvt->GetKeyCode().GetFullCode(), pKeyEvt->GetCharCode(), pKeyEvt->GetRepeat(), sal_False ); } break; case SALEVENT_KEYUP: { SalKeyEvent* pKeyEvt = (SalKeyEvent*)pEvent; nRet = ImplHandleKey( pWindow, EVENT_KEYUP, - pKeyEvt->mnCode, pKeyEvt->mnCharCode, pKeyEvt->mnRepeat, TRUE ); + pKeyEvt->mnCode, pKeyEvt->mnCharCode, pKeyEvt->mnRepeat, sal_True ); } break; case SALEVENT_EXTERNALKEYUP: { KeyEvent* pKeyEvt = (KeyEvent*) pEvent; nRet = ImplHandleKey( pWindow, EVENT_KEYUP, - pKeyEvt->GetKeyCode().GetFullCode(), pKeyEvt->GetCharCode(), pKeyEvt->GetRepeat(), FALSE ); + pKeyEvt->GetKeyCode().GetFullCode(), pKeyEvt->GetCharCode(), pKeyEvt->GetRepeat(), sal_False ); } break; case SALEVENT_KEYMODCHANGE: @@ -2541,15 +2540,15 @@ long ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/, { // Message-Schleife beenden Application::Quit(); - return FALSE; + return sal_False; } else { bInQueryExit = false; - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } case SALEVENT_SETTINGSCHANGED: @@ -2605,7 +2604,7 @@ long ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/, break; #ifdef DBG_UTIL default: - DBG_ERROR1( "ImplWindowFrameProc(): unknown event (%lu)", (ULONG)nEvent ); + DBG_ERROR1( "ImplWindowFrameProc(): unknown event (%lu)", (sal_uLong)nEvent ); break; #endif } diff --git a/vcl/source/window/wpropset.cxx b/vcl/source/window/wpropset.cxx new file mode 100644 index 000000000000..fcb0c560291e --- /dev/null +++ b/vcl/source/window/wpropset.cxx @@ -0,0 +1,346 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_vcl.hxx" + +#include "vcl/wpropset.hxx" +#include "vcl/window.hxx" +#include "vcl/vclevent.hxx" +#include "vcl/svdata.hxx" + +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/beans/PropertyAttribute.hpp" +#include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/beans/XPropertyContainer.hpp" +#include "com/sun/star/beans/XPropertyAccess.hpp" + +#include "cppuhelper/basemutex.hxx" +#include "cppuhelper/compbase1.hxx" + +#include <map> + +using namespace vcl; +using namespace com::sun::star; + +/* + +TODO: +- release solarmutex during outside UNO calls +- in ChildEventListener protect against reentry by using PostUserEvent + +*/ + +class vcl::WindowPropertySetListener : + public cppu::BaseMutex, + public cppu::WeakComponentImplHelper1< com::sun::star::beans::XPropertyChangeListener >, + private boost::noncopyable +{ + WindowPropertySet* mpParent; + bool mbSuspended; +public: + WindowPropertySetListener( WindowPropertySet* pParent ) + : cppu::WeakComponentImplHelper1< com::sun::star::beans::XPropertyChangeListener >( m_aMutex ) + , mpParent( pParent ) + , mbSuspended( false ) + {} + + virtual ~WindowPropertySetListener() + { + } + + using cppu::WeakComponentImplHelperBase::disposing; + virtual void SAL_CALL disposing( const lang::EventObject& ) throw() + { + } + + virtual void SAL_CALL propertyChange( const beans::PropertyChangeEvent& i_rEvent ) throw() + { + if( ! mbSuspended ) + mpParent->propertyChange( i_rEvent ); + } + + void suspend( bool i_bSuspended ) + { + mbSuspended = i_bSuspended; + } +}; + +class vcl::WindowPropertySetData +{ +public: + + struct PropertyMapEntry + { + Window* mpWindow; + boost::shared_ptr<WindowArranger> mpLayout; + uno::Sequence< beans::PropertyValue > maSavedValues; + + PropertyMapEntry( Window* i_pWindow = NULL, + const boost::shared_ptr<WindowArranger>& i_pLayout = boost::shared_ptr<WindowArranger>() ) + : mpWindow( i_pWindow ) + , mpLayout( i_pLayout ) + {} + + uno::Sequence< beans::PropertyValue > getProperties() const + { + if( mpWindow ) + return mpWindow->getProperties(); + else if( mpLayout.get() ) + return mpLayout->getProperties(); + return uno::Sequence< beans::PropertyValue >(); + } + + void setProperties( const uno::Sequence< beans::PropertyValue >& i_rProps ) const + { + if( mpWindow ) + mpWindow->setProperties( i_rProps ); + else if( mpLayout.get() ) + mpLayout->setProperties( i_rProps ); + } + }; + + Window* mpTopWindow; + bool mbOwner; + std::map< rtl::OUString, PropertyMapEntry > maProperties; + uno::Reference< beans::XPropertySet > mxPropSet; + uno::Reference< beans::XPropertyAccess > mxPropSetAccess; + uno::Reference< beans::XPropertyChangeListener > mxListener; + vcl::WindowPropertySetListener* mpListener; + + WindowPropertySetData() + : mpTopWindow( NULL ) + , mbOwner( false ) + , mpListener( NULL ) + {} + + ~WindowPropertySetData() + { + // release layouters, possibly interface properties before destroying + // the involved parent to be on the safe side + maProperties.clear(); + if( mbOwner ) + delete mpTopWindow; + } +}; + +static rtl::OUString getIdentifiedPropertyName( const rtl::OUString& i_rIdentifier, const rtl::OUString& i_rName ) +{ + rtl::OUStringBuffer aBuf( i_rIdentifier.getLength() + 1 + i_rName.getLength() ); + aBuf.append( i_rIdentifier ); + aBuf.append( sal_Unicode( '#' ) ); + aBuf.append( i_rName ); + return aBuf.makeStringAndClear(); +} + +static void spliceIdentifiedPropertyName( const rtl::OUString& i_rIdentifiedPropName, + rtl::OUString& o_rIdentifier, + rtl::OUString& o_rPropName ) +{ + sal_Int32 nIndex = 0; + o_rIdentifier = i_rIdentifiedPropName.getToken( 0, sal_Unicode( '#' ), nIndex ); + if( nIndex != -1 ) + o_rPropName = i_rIdentifiedPropName.copy( nIndex ); + else + o_rPropName = rtl::OUString(); +} + +WindowPropertySet::WindowPropertySet( Window* i_pTopWindow, bool i_bTakeOwnership ) +: mpImpl( new vcl::WindowPropertySetData ) +{ + mpImpl->mpTopWindow = i_pTopWindow; + mpImpl->mbOwner = i_bTakeOwnership; + + mpImpl->mpTopWindow->AddChildEventListener( LINK( this, WindowPropertySet, ChildEventListener ) ); + + mpImpl->mxPropSet = uno::Reference< beans::XPropertySet >( + ImplGetSVData()->maAppData.mxMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.PropertyBag" ) ) ), + uno::UNO_QUERY ); + OSL_ENSURE( mpImpl->mxPropSet.is(), "could not create instance of com.sun.star.beans.PropertyBag" ); + mpImpl->mxPropSetAccess = uno::Reference< beans::XPropertyAccess >( mpImpl->mxPropSet, uno::UNO_QUERY ); + OSL_ENSURE( mpImpl->mxPropSet.is(), "could not query XPropertyAccess interface" ); + if( ! mpImpl->mxPropSetAccess.is() ) + mpImpl->mxPropSet.clear(); + + addWindowToSet( i_pTopWindow ); + + setupProperties(); + + if( mpImpl->mxPropSet.is() ) + { + mpImpl->mxListener.set( mpImpl->mpListener = new WindowPropertySetListener( this ) ); + } +} + +WindowPropertySet::~WindowPropertySet() +{ + mpImpl->mpTopWindow->RemoveChildEventListener( LINK( this, WindowPropertySet, ChildEventListener ) ); + + delete mpImpl; + mpImpl = NULL; +} + +uno::Reference< beans::XPropertySet > WindowPropertySet::getPropertySet() const +{ + return mpImpl->mxPropSet; +} + +void WindowPropertySet::addLayoutToSet( const boost::shared_ptr< WindowArranger >& i_pLayout ) +{ + if( i_pLayout.get() ) + { + if( i_pLayout->getIdentifier().getLength() ) + { + WindowPropertySetData::PropertyMapEntry& rEntry = mpImpl->maProperties[ i_pLayout->getIdentifier() ]; + OSL_ENSURE( rEntry.mpWindow == 0 && rEntry.mpLayout.get() == 0, "inserted layout has duplicate name" ); + rEntry.mpWindow = NULL; + rEntry.mpLayout = i_pLayout; + rEntry.maSavedValues = i_pLayout->getProperties(); + } + // insert child layouts + size_t nChildren = i_pLayout->countElements(); + for( size_t i = 0; i < nChildren; i++ ) + addLayoutToSet( i_pLayout->getChild( i ) ); + } +} + +void WindowPropertySet::addWindowToSet( Window* i_pWindow ) +{ + if( i_pWindow->getIdentifier().getLength() ) // no name, no properties + { + WindowPropertySetData::PropertyMapEntry& rEntry = mpImpl->maProperties[ i_pWindow->getIdentifier() ]; + OSL_ENSURE( rEntry.mpWindow == 0 && rEntry.mpLayout.get() == 0, "inserted window has duplicate name" ); + rEntry.mpWindow = i_pWindow; + rEntry.mpLayout.reset(); + rEntry.maSavedValues = i_pWindow->getProperties(); + } + addLayoutToSet( i_pWindow->getLayout() ); + + Window* pWin = i_pWindow->GetWindow( WINDOW_FIRSTCHILD ); + while( pWin ) + { + addWindowToSet( pWin ); + pWin = pWin->GetWindow( WINDOW_NEXT ); + } +} + +void WindowPropertySet::setupProperties() +{ + uno::Reference< beans::XPropertyContainer > xCont( mpImpl->mxPropSet, uno::UNO_QUERY ); + OSL_ENSURE( xCont.is(), "could not get XPropertyContainer interface" ); + if( ! xCont.is() ) + return; + + for( std::map< rtl::OUString, WindowPropertySetData::PropertyMapEntry >::iterator it + = mpImpl->maProperties.begin(); it != mpImpl->maProperties.end(); ++it ) + { + uno::Sequence< beans::PropertyValue > aOutsideValues( it->second.maSavedValues ); + beans::PropertyValue* pVal = aOutsideValues.getArray(); + for( sal_Int32 i = 0; i < aOutsideValues.getLength(); i++ ) + { + pVal[i].Name = getIdentifiedPropertyName( it->first, pVal[i].Name ); + xCont->addProperty( pVal[i].Name, + beans::PropertyAttribute::BOUND | beans:: PropertyAttribute::CONSTRAINED, + pVal[i].Value + ); + } + } +} + +void WindowPropertySet::propertyChange( const beans::PropertyChangeEvent& i_rEvent ) +{ + rtl::OUString aIdentifier, aProperty; + spliceIdentifiedPropertyName( i_rEvent.PropertyName, aIdentifier, aProperty ); + std::map< rtl::OUString, WindowPropertySetData::PropertyMapEntry >::iterator it = + mpImpl->maProperties.find( aIdentifier ); + if( it != mpImpl->maProperties.end() ) + { + uno::Sequence< beans::PropertyValue > aSet( 1 ); + aSet[0].Name = aProperty; + aSet[0].Value = i_rEvent.NewValue; + it->second.setProperties( aSet ); + } +} + +IMPL_LINK( vcl::WindowPropertySet, ChildEventListener, VclWindowEvent*, pEvent ) +{ + // find window in our properties + std::map< rtl::OUString, WindowPropertySetData::PropertyMapEntry >::iterator it + = mpImpl->maProperties.find( pEvent->GetWindow()->getIdentifier() ); + if( it != mpImpl->maProperties.end() ) // this is valid, some unnamed child may have sent an event + { + sal_uLong nId = pEvent->GetId(); + // check if anything interesting happened + if( + // general windowy things + nId == VCLEVENT_WINDOW_SHOW || + nId == VCLEVENT_WINDOW_HIDE || + nId == VCLEVENT_WINDOW_ENABLED || + nId == VCLEVENT_WINDOW_DISABLED || + // button thingies + nId == VCLEVENT_BUTTON_CLICK || + nId == VCLEVENT_PUSHBUTTON_TOGGLE || + nId == VCLEVENT_RADIOBUTTON_TOGGLE || + nId == VCLEVENT_CHECKBOX_TOGGLE || + // listbox + nId == VCLEVENT_LISTBOX_SELECT || + // edit + nId == VCLEVENT_EDIT_MODIFY + ) + { + WindowPropertySetData::PropertyMapEntry& rEntry = it->second; + // collect changes + uno::Sequence< beans::PropertyValue > aNewProps( rEntry.getProperties() ); + uno::Sequence< beans::PropertyValue > aNewPropsOut( aNewProps ); + + // translate to identified properties + beans::PropertyValue* pValues = aNewPropsOut.getArray(); + for( sal_Int32 i = 0; i < aNewPropsOut.getLength(); i++ ) + pValues[i].Name = getIdentifiedPropertyName( it->first, pValues[i].Name ); + + // broadcast changes + bool bWasVeto = false; + mpImpl->mpListener->suspend( true ); + try + { + mpImpl->mxPropSetAccess->setPropertyValues( aNewPropsOut ); + } + catch( beans::PropertyVetoException& ) + { + bWasVeto = true; + } + mpImpl->mpListener->suspend( false ); + + if( ! bWasVeto ) // changes accepted ? + rEntry.maSavedValues = rEntry.getProperties(); + else // no, reset + rEntry.setProperties( rEntry.maSavedValues ); + } + } + + return 0; +} diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index 72887ce0f577..38d78fbc9723 100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -45,8 +45,8 @@ // ======================================================================= -#define WORKWIN_WINDOWSTATE_FULLSCREEN ((ULONG)0x00010000) -#define WORKWIN_WINDOWSTATE_ALL ((ULONG)0x00FF0000) +#define WORKWIN_WINDOWSTATE_FULLSCREEN ((sal_uLong)0x00010000) +#define WORKWIN_WINDOWSTATE_ALL ((sal_uLong)0x00FF0000) // ======================================================================= @@ -55,17 +55,17 @@ void WorkWindow::ImplInitWorkWindowData() mnIcon = 0; // Should be removed in the next top level update - now in SystemWindow mnPresentationFlags = 0; - mbPresentationMode = FALSE; - mbPresentationVisible = FALSE; - mbPresentationFull = FALSE; - mbFullScreenMode = FALSE; + mbPresentationMode = sal_False; + mbPresentationVisible = sal_False; + mbPresentationFull = sal_False; + mbFullScreenMode = sal_False; } // ----------------------------------------------------------------------- void WorkWindow::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData ) { - USHORT nFrameStyle = BORDERWINDOW_STYLE_FRAME; + sal_uInt16 nFrameStyle = BORDERWINDOW_STYLE_FRAME; if ( nStyle & WB_APP ) nFrameStyle |= BORDERWINDOW_STYLE_APP; @@ -138,7 +138,7 @@ WorkWindow::WorkWindow( Window* pParent, const ::com::sun::star::uno::Any& aSyst SystemWindow( WINDOW_WORKWINDOW ) { ImplInitWorkWindowData(); - mbSysChild = TRUE; + mbSysChild = sal_True; ImplInit( pParent, nStyle, aSystemWorkWindowToken ); } @@ -148,7 +148,7 @@ WorkWindow::WorkWindow( SystemParentData* pParent ) : SystemWindow( WINDOW_WORKWINDOW ) { ImplInitWorkWindowData(); - mbSysChild = TRUE; + mbSysChild = sal_True; ImplInit( NULL, 0, pParent ); } @@ -177,7 +177,7 @@ WorkWindow::~WorkWindow() // ----------------------------------------------------------------------- -void WorkWindow::ShowFullScreenMode( BOOL bFullScreenMode, sal_Int32 nDisplay ) +void WorkWindow::ShowFullScreenMode( sal_Bool bFullScreenMode, sal_Int32 nDisplay ) { if ( !mbFullScreenMode == !bFullScreenMode ) return; @@ -203,34 +203,34 @@ void WorkWindow::ShowFullScreenMode( BOOL bFullScreenMode, sal_Int32 nDisplay ) xCanvasComponent->dispose(); } - mpWindowImpl->mpFrameWindow->mpWindowImpl->mbWaitSystemResize = TRUE; + mpWindowImpl->mpFrameWindow->mpWindowImpl->mbWaitSystemResize = sal_True; ImplGetFrame()->ShowFullScreen( bFullScreenMode, nDisplay ); } } // ----------------------------------------------------------------------- -void WorkWindow::StartPresentationMode( BOOL bPresentation, USHORT nFlags, sal_Int32 nDisplay ) +void WorkWindow::StartPresentationMode( sal_Bool bPresentation, sal_uInt16 nFlags, sal_Int32 nDisplay ) { if ( !bPresentation == !mbPresentationMode ) return; if ( bPresentation ) { - mbPresentationMode = TRUE; + mbPresentationMode = sal_True; mbPresentationVisible = IsVisible(); mbPresentationFull = mbFullScreenMode; mnPresentationFlags = nFlags; if ( !(mnPresentationFlags & PRESENTATION_NOFULLSCREEN) ) - ShowFullScreenMode( TRUE, nDisplay ); + ShowFullScreenMode( sal_True, nDisplay ); if ( !mbSysChild ) { if ( mnPresentationFlags & PRESENTATION_HIDEALLAPPS ) - mpWindowImpl->mpFrame->SetAlwaysOnTop( TRUE ); + mpWindowImpl->mpFrame->SetAlwaysOnTop( sal_True ); if ( !(mnPresentationFlags & PRESENTATION_NOAUTOSHOW) ) ToTop(); - mpWindowImpl->mpFrame->StartPresentation( TRUE ); + mpWindowImpl->mpFrame->StartPresentation( sal_True ); } if ( !(mnPresentationFlags & PRESENTATION_NOAUTOSHOW) ) @@ -241,22 +241,22 @@ void WorkWindow::StartPresentationMode( BOOL bPresentation, USHORT nFlags, sal_I Show( mbPresentationVisible ); if ( !mbSysChild ) { - mpWindowImpl->mpFrame->StartPresentation( FALSE ); + mpWindowImpl->mpFrame->StartPresentation( sal_False ); if ( mnPresentationFlags & PRESENTATION_HIDEALLAPPS ) - mpWindowImpl->mpFrame->SetAlwaysOnTop( FALSE ); + mpWindowImpl->mpFrame->SetAlwaysOnTop( sal_False ); } ShowFullScreenMode( mbPresentationFull, nDisplay ); - mbPresentationMode = FALSE; - mbPresentationVisible = FALSE; - mbPresentationFull = FALSE; + mbPresentationMode = sal_False; + mbPresentationVisible = sal_False; + mbPresentationFull = sal_False; mnPresentationFlags = 0; } } // ----------------------------------------------------------------------- -BOOL WorkWindow::IsMinimized() const +sal_Bool WorkWindow::IsMinimized() const { //return mpWindowImpl->mpFrameData->mbMinimized; SalFrameState aState; @@ -266,15 +266,15 @@ BOOL WorkWindow::IsMinimized() const // ----------------------------------------------------------------------- -BOOL WorkWindow::SetPluginParent( SystemParentData* pParent ) +sal_Bool WorkWindow::SetPluginParent( SystemParentData* pParent ) { DBG_ASSERT( ! mbPresentationMode && ! mbFullScreenMode, "SetPluginParent in fullscreen or presentation mode !" ); bool bWasDnd = Window::ImplStopDnd(); - BOOL bShown = IsVisible(); - Show( FALSE ); - BOOL bRet = mpWindowImpl->mpFrame->SetPluginParent( pParent ); + sal_Bool bShown = IsVisible(); + Show( sal_False ); + sal_Bool bRet = mpWindowImpl->mpFrame->SetPluginParent( pParent ); Show( bShown ); if( bWasDnd ) @@ -283,7 +283,7 @@ BOOL WorkWindow::SetPluginParent( SystemParentData* pParent ) return bRet; } -void WorkWindow::ImplSetFrameState( ULONG aFrameState ) +void WorkWindow::ImplSetFrameState( sal_uLong aFrameState ) { SalFrameState aState; aState.mnMask = SAL_FRAMESTATE_MASK_STATE; @@ -302,9 +302,9 @@ void WorkWindow::Restore() ImplSetFrameState( SAL_FRAMESTATE_NORMAL ); } -BOOL WorkWindow::Close() +sal_Bool WorkWindow::Close() { - BOOL bCanClose = SystemWindow::Close(); + sal_Bool bCanClose = SystemWindow::Close(); // Ist es das Applikationsfenster, dann beende die Applikation if ( bCanClose && ( ImplGetSVData()->maWinData.mpAppWin == this ) ) @@ -313,14 +313,14 @@ BOOL WorkWindow::Close() return bCanClose; } -void WorkWindow::Maximize( BOOL bMaximize ) +void WorkWindow::Maximize( sal_Bool bMaximize ) { ImplSetFrameState( bMaximize ? SAL_FRAMESTATE_MAXIMIZED : SAL_FRAMESTATE_NORMAL ); } -BOOL WorkWindow::IsMaximized() const +sal_Bool WorkWindow::IsMaximized() const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; SalFrameState aState; if( mpWindowImpl->mpFrame->GetWindowState( &aState ) ) @@ -328,7 +328,7 @@ BOOL WorkWindow::IsMaximized() const if( aState.mnState & (SAL_FRAMESTATE_MAXIMIZED | SAL_FRAMESTATE_MAXIMIZED_HORZ | SAL_FRAMESTATE_MAXIMIZED_VERT ) ) - bRet = TRUE; + bRet = sal_True; } return bRet; } |