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/gdi | |
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/gdi')
64 files changed, 6354 insertions, 4813 deletions
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; } // ----------------------------------------------------------------------- |