summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthb <thb@openoffice.org>2010-02-19 12:46:18 +0100
committerthb <thb@openoffice.org>2010-02-19 12:46:18 +0100
commit0755c94f9a36f7ccd23a52a58297033a05b10c80 (patch)
treeb024ba02a0b81f5a59eac8192f211b5a512ea513
parent7ffd813fd3f0c4ec1e6b6f168acf94a6c3246a58 (diff)
parentda2c680d23b67d4721aa29f740475fd6d40e2e08 (diff)
Merged with dev300_m71
-rw-r--r--basegfx/test/basegfx2d.cxx7
-rwxr-xr-xcanvas/source/directx/dx_winstuff.hxx12
-rw-r--r--comphelper/inc/comphelper/weakeventlistener.hxx2
-rw-r--r--comphelper/source/property/opropertybag.cxx9
-rw-r--r--comphelper/source/property/property.cxx25
-rw-r--r--cppcanvas/inc/cppcanvas/color.hxx10
-rw-r--r--goodies/source/filter.vcl/ieps/ieps.cxx68
-rw-r--r--goodies/source/filter.vcl/ipbm/ipbm.cxx11
-rw-r--r--l10ntools/inc/cfgmerge.hxx (renamed from transex3/inc/cfgmerge.hxx)0
-rw-r--r--l10ntools/inc/export.hxx (renamed from transex3/inc/export.hxx)6
-rw-r--r--l10ntools/inc/gsicheck.hxx (renamed from transex3/inc/gsicheck.hxx)0
-rw-r--r--l10ntools/inc/helpmerge.hxx (renamed from transex3/inc/helpmerge.hxx)0
-rw-r--r--l10ntools/inc/inireader.hxx (renamed from transex3/inc/inireader.hxx)0
-rw-r--r--l10ntools/inc/l10ntools/directory.hxx (renamed from transex3/inc/transex3/directory.hxx)6
-rw-r--r--l10ntools/inc/l10ntools/file.hxx (renamed from transex3/inc/transex3/file.hxx)0
-rw-r--r--l10ntools/inc/l10ntools/vosapp.hxx (renamed from transex3/inc/transex3/vosapp.hxx)0
-rw-r--r--l10ntools/inc/lngmerge.hxx (renamed from transex3/inc/lngmerge.hxx)0
-rw-r--r--l10ntools/inc/makefile.mk (renamed from transex3/inc/makefile.mk)2
-rw-r--r--l10ntools/inc/pch/precompiled_l10ntools.cxx (renamed from transex3/inc/pch/precompiled_transex3.cxx)2
-rw-r--r--l10ntools/inc/pch/precompiled_l10ntools.hxx (renamed from transex3/inc/pch/precompiled_transex3.hxx)0
-rw-r--r--l10ntools/inc/srciter.hxx (renamed from transex3/inc/srciter.hxx)6
-rw-r--r--l10ntools/inc/tagtest.hxx (renamed from transex3/inc/tagtest.hxx)0
-rw-r--r--l10ntools/inc/tokens.h (renamed from transex3/inc/tokens.h)0
-rw-r--r--l10ntools/inc/treeconfig.hxx (renamed from transex3/inc/treeconfig.hxx)0
-rw-r--r--l10ntools/inc/utf8conv.hxx (renamed from transex3/inc/utf8conv.hxx)0
-rw-r--r--l10ntools/inc/wrdtrans.hxx (renamed from transex3/inc/wrdtrans.hxx)0
-rw-r--r--l10ntools/inc/wtranode.hxx (renamed from transex3/inc/wtranode.hxx)0
-rw-r--r--l10ntools/inc/wtratree.hxx (renamed from transex3/inc/wtratree.hxx)0
-rw-r--r--l10ntools/inc/xmlparse.hxx (renamed from transex3/inc/xmlparse.hxx)0
-rw-r--r--l10ntools/inc/xmlutil.hxx (renamed from transex3/inc/xmlutil.hxx)0
-rw-r--r--l10ntools/inc/xrmmerge.hxx (renamed from transex3/inc/xrmmerge.hxx)0
-rwxr-xr-xl10ntools/java/l10nconv/build.xml (renamed from transex3/java/l10nconv/build.xml)0
-rwxr-xr-xl10ntools/java/l10nconv/converter.MF (renamed from transex3/java/l10nconv/converter.MF)0
-rwxr-xr-xl10ntools/java/l10nconv/documentation/readmeConverter.sxw (renamed from transex3/java/l10nconv/documentation/readmeConverter.sxw)bin9824 -> 9824 bytes
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapCheck.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapCheck.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/Tag.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/DirtyTags/Tag.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/dtd/xliff.dtd (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/converter/dtd/xliff.dtd)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/LanguageResolver.java (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/languageResolver/LanguageResolver.java)0
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/lang.map (renamed from transex3/java/l10nconv/java/com/sun/star/tooling/languageResolver/lang.map)0
-rwxr-xr-xl10ntools/java/l10nconv/makefile.mk (renamed from transex3/java/l10nconv/makefile.mk)2
-rwxr-xr-xl10ntools/java/receditor/build.xml (renamed from transex3/java/receditor/build.xml)0
-rw-r--r--l10ntools/java/receditor/java/transex3/controller/EditorController.java (renamed from transex3/java/receditor/java/transex3/controller/EditorController.java)0
-rw-r--r--l10ntools/java/receditor/java/transex3/controller/Main.java (renamed from transex3/java/receditor/java/transex3/controller/Main.java)0
-rw-r--r--l10ntools/java/receditor/java/transex3/model/ResourceFile.java (renamed from transex3/java/receditor/java/transex3/model/ResourceFile.java)0
-rw-r--r--l10ntools/java/receditor/java/transex3/model/SdfEntity.java (renamed from transex3/java/receditor/java/transex3/model/SdfEntity.java)0
-rw-r--r--l10ntools/java/receditor/java/transex3/model/SdfString.java (renamed from transex3/java/receditor/java/transex3/model/SdfString.java)0
-rw-r--r--l10ntools/java/receditor/java/transex3/view/Editor.java (renamed from transex3/java/receditor/java/transex3/view/Editor.java)0
-rw-r--r--l10ntools/java/receditor/java/transex3/view/SdfTable.java (renamed from transex3/java/receditor/java/transex3/view/SdfTable.java)0
-rwxr-xr-xl10ntools/java/receditor/makefile.mk (renamed from transex3/java/receditor/makefile.mk)2
-rwxr-xr-xl10ntools/java/receditor/receditor.MF (renamed from transex3/java/receditor/receditor.MF)0
-rw-r--r--l10ntools/layout/README (renamed from transex3/layout/README)0
-rw-r--r--l10ntools/layout/layoutparse.cxx (renamed from transex3/layout/layoutparse.cxx)0
-rw-r--r--l10ntools/layout/layoutparse.hxx (renamed from transex3/layout/layoutparse.hxx)0
-rw-r--r--l10ntools/layout/loc.sdf (renamed from transex3/layout/loc.sdf)0
-rw-r--r--l10ntools/layout/makefile.mk (renamed from transex3/layout/makefile.mk)2
-rw-r--r--l10ntools/layout/tralay.cxx (renamed from transex3/layout/tralay.cxx)2
-rw-r--r--l10ntools/layout/zoom.xml (renamed from transex3/layout/zoom.xml)0
-rw-r--r--l10ntools/prj/build.lst10
-rw-r--r--l10ntools/prj/d.lst (renamed from transex3/prj/d.lst)16
-rw-r--r--l10ntools/scripts/fast_merge.pl (renamed from transex3/scripts/fast_merge.pl)0
-rw-r--r--l10ntools/scripts/keyidGen.pl (renamed from transex3/scripts/keyidGen.pl)0
-rwxr-xr-xl10ntools/scripts/localize.pl (renamed from transex3/scripts/localize.pl)13
-rwxr-xr-xl10ntools/scripts/localize_old.pl (renamed from transex3/scripts/localize_old.pl)0
-rw-r--r--l10ntools/source/cfg_yy_wrapper.c (renamed from transex3/source/cfg_yy_wrapper.c)0
-rw-r--r--l10ntools/source/cfglex.l (renamed from transex3/source/cfglex.l)0
-rw-r--r--l10ntools/source/cfgmerge.cxx (renamed from transex3/source/cfgmerge.cxx)2
-rw-r--r--l10ntools/source/directory.cxx (renamed from transex3/source/directory.cxx)4
-rw-r--r--l10ntools/source/export.cxx (renamed from transex3/source/export.cxx)2
-rw-r--r--l10ntools/source/export2.cxx (renamed from transex3/source/export2.cxx)9
-rw-r--r--l10ntools/source/file.cxx (renamed from transex3/source/file.cxx)4
-rw-r--r--l10ntools/source/filter/merge/FCFGMerge.cfg (renamed from transex3/source/filter/merge/FCFGMerge.cfg)0
-rw-r--r--l10ntools/source/filter/merge/FCFGMerge.java (renamed from transex3/source/filter/merge/FCFGMerge.java)0
-rw-r--r--l10ntools/source/filter/merge/Manifest.mf (renamed from transex3/source/filter/merge/Manifest.mf)0
-rw-r--r--l10ntools/source/filter/merge/Merger.java (renamed from transex3/source/filter/merge/Merger.java)0
-rw-r--r--l10ntools/source/filter/merge/makefile.mk (renamed from transex3/source/filter/merge/makefile.mk)2
-rw-r--r--l10ntools/source/filter/utils/AnalyzeStartupLog.java (renamed from transex3/source/filter/utils/AnalyzeStartupLog.java)0
-rw-r--r--l10ntools/source/filter/utils/Cache.java (renamed from transex3/source/filter/utils/Cache.java)0
-rw-r--r--l10ntools/source/filter/utils/ConfigHelper.java (renamed from transex3/source/filter/utils/ConfigHelper.java)0
-rw-r--r--l10ntools/source/filter/utils/FileHelper.java (renamed from transex3/source/filter/utils/FileHelper.java)0
-rw-r--r--l10ntools/source/filter/utils/Logger.java (renamed from transex3/source/filter/utils/Logger.java)0
-rw-r--r--l10ntools/source/filter/utils/MalformedCommandLineException.java (renamed from transex3/source/filter/utils/MalformedCommandLineException.java)0
-rw-r--r--l10ntools/source/filter/utils/XMLHelper.java (renamed from transex3/source/filter/utils/XMLHelper.java)0
-rw-r--r--l10ntools/source/filter/utils/makefile.mk (renamed from transex3/source/filter/utils/makefile.mk)2
-rw-r--r--l10ntools/source/gsicheck.cxx (renamed from transex3/source/gsicheck.cxx)2
-rw-r--r--l10ntools/source/gsiconv.cxx (renamed from transex3/source/gsiconv.cxx)2
-rw-r--r--l10ntools/source/help/HelpCompiler.cxx (renamed from transex3/source/help/HelpCompiler.cxx)0
-rw-r--r--l10ntools/source/help/HelpCompiler.hxx (renamed from transex3/source/help/HelpCompiler.hxx)0
-rw-r--r--l10ntools/source/help/HelpFileDocument.java (renamed from transex3/source/help/HelpFileDocument.java)0
-rw-r--r--l10ntools/source/help/HelpIndexerTool.java (renamed from transex3/source/help/HelpIndexerTool.java)0
-rw-r--r--l10ntools/source/help/HelpLinker.cxx (renamed from transex3/source/help/HelpLinker.cxx)0
-rw-r--r--l10ntools/source/help/compilehelp.hxx (renamed from transex3/source/help/compilehelp.hxx)0
-rw-r--r--l10ntools/source/help/helplinker.pmk (renamed from transex3/source/help/helplinker.pmk)0
-rw-r--r--l10ntools/source/help/makefile.mk (renamed from transex3/source/help/makefile.mk)2
-rw-r--r--l10ntools/source/helpex.cxx (renamed from transex3/source/helpex.cxx)2
-rw-r--r--l10ntools/source/helpmerge.cxx (renamed from transex3/source/helpmerge.cxx)2
-rw-r--r--l10ntools/source/inireader.cxx (renamed from transex3/source/inireader.cxx)2
-rw-r--r--l10ntools/source/lngex.cxx (renamed from transex3/source/lngex.cxx)2
-rw-r--r--l10ntools/source/lngmerge.cxx (renamed from transex3/source/lngmerge.cxx)2
-rw-r--r--l10ntools/source/localize.cxx (renamed from transex3/source/localize.cxx)25
-rw-r--r--l10ntools/source/makefile.mk (renamed from transex3/source/makefile.mk)2
-rw-r--r--l10ntools/source/merge.cxx (renamed from transex3/source/merge.cxx)2
-rw-r--r--l10ntools/source/src_yy_wrapper.c (renamed from transex3/source/src_yy_wrapper.c)0
-rw-r--r--l10ntools/source/srciter.cxx (renamed from transex3/source/srciter.cxx)2
-rw-r--r--l10ntools/source/srclex.l (renamed from transex3/source/srclex.l)0
-rw-r--r--l10ntools/source/tagtest.cxx (renamed from transex3/source/tagtest.cxx)2
-rw-r--r--l10ntools/source/treeconfig.cxx (renamed from transex3/source/treeconfig.cxx)0
-rw-r--r--l10ntools/source/utf8conv.cxx (renamed from transex3/source/utf8conv.cxx)2
-rw-r--r--l10ntools/source/wrdtrans.cxx (renamed from transex3/source/wrdtrans.cxx)2
-rw-r--r--l10ntools/source/wtranode.cxx (renamed from transex3/source/wtranode.cxx)2
-rw-r--r--l10ntools/source/wtratree.cxx (renamed from transex3/source/wtratree.cxx)2
-rw-r--r--l10ntools/source/xgfconv.cxx (renamed from transex3/source/xgfconv.cxx)2
-rw-r--r--l10ntools/source/xmlparse.cxx (renamed from transex3/source/xmlparse.cxx)2
-rw-r--r--l10ntools/source/xrm_yy_wrapper.c (renamed from transex3/source/xrm_yy_wrapper.c)0
-rw-r--r--l10ntools/source/xrmlex.l (renamed from transex3/source/xrmlex.l)0
-rw-r--r--l10ntools/source/xrmmerge.cxx (renamed from transex3/source/xrmmerge.cxx)2
-rw-r--r--l10ntools/workbench/gsicheck_errors.sdf (renamed from transex3/workbench/gsicheck_errors.sdf)0
-rw-r--r--l10ntools/workbench/gsicheck_errors_err-.sdf (renamed from transex3/workbench/gsicheck_errors_err-.sdf)0
-rw-r--r--l10ntools/workbench/gsicheck_errors_err-l.sdf (renamed from transex3/workbench/gsicheck_errors_err-l.sdf)0
-rw-r--r--l10ntools/workbench/gsicheck_errors_err-s.sdf (renamed from transex3/workbench/gsicheck_errors_err-s.sdf)0
-rw-r--r--l10ntools/workbench/gsicheck_errors_err-t.sdf (renamed from transex3/workbench/gsicheck_errors_err-t.sdf)0
-rw-r--r--l10ntools/workbench/gsicheck_errors_ok-.sdf (renamed from transex3/workbench/gsicheck_errors_ok-.sdf)0
-rw-r--r--l10ntools/workbench/gsicheck_errors_ok-l.sdf (renamed from transex3/workbench/gsicheck_errors_ok-l.sdf)0
-rw-r--r--l10ntools/workbench/gsicheck_errors_ok-s.sdf (renamed from transex3/workbench/gsicheck_errors_ok-s.sdf)0
-rw-r--r--l10ntools/workbench/gsicheck_errors_ok-t.sdf (renamed from transex3/workbench/gsicheck_errors_ok-t.sdf)0
-rw-r--r--l10ntools/workbench/gsicheckcheck.btm (renamed from transex3/workbench/gsicheckcheck.btm)0
-rw-r--r--padmin/source/padialog.cxx149
-rw-r--r--padmin/source/padialog.hxx2
-rw-r--r--padmin/source/prtsetup.cxx23
-rw-r--r--padmin/source/prtsetup.hxx2
-rw-r--r--rsc/source/parser/rscicpx.cxx1
-rw-r--r--sot/source/sdstor/stgstrms.cxx2
-rw-r--r--sot/source/sdstor/stgstrms.hxx3
-rw-r--r--sot/source/sdstor/ucbstorage.cxx59
-rw-r--r--svl/inc/svl/solar.hrc11
-rw-r--r--svl/source/numbers/numhead.cxx2
-rw-r--r--svtools/inc/svtools/imapobj.hxx2
-rw-r--r--svtools/source/control/ctrlbox.cxx1
-rw-r--r--svtools/source/control/filectrl.cxx3
-rw-r--r--svtools/source/dialogs/prnsetup.cxx2
-rw-r--r--svtools/source/filter.vcl/filter/filter2.cxx3
-rw-r--r--svtools/source/filter.vcl/jpeg/jpeg.cxx39
-rw-r--r--svtools/source/filter.vcl/jpeg/jpeg.h2
-rw-r--r--svtools/source/filter.vcl/jpeg/jpegc.c14
-rw-r--r--svtools/source/filter.vcl/wmf/emfwr.cxx103
-rw-r--r--svtools/source/filter.vcl/wmf/emfwr.hxx1
-rw-r--r--svtools/source/filter.vcl/wmf/winmtf.cxx9
-rw-r--r--svtools/source/filter.vcl/wmf/winmtf.hxx15
-rw-r--r--svtools/source/filter.vcl/wmf/winwmf.cxx216
-rw-r--r--svtools/source/filter.vcl/wmf/wmfwr.cxx81
-rw-r--r--svtools/source/filter.vcl/wmf/wmfwr.hxx9
-rw-r--r--svtools/source/misc/ehdl.cxx26
-rw-r--r--svtools/source/misc/imap.cxx7
-rw-r--r--svtools/source/uno/unoiface.cxx80
-rw-r--r--toolkit/inc/toolkit/awt/vclxprinter.hxx15
-rw-r--r--toolkit/source/awt/vclxprinter.cxx36
-rw-r--r--toolkit/source/awt/vclxwindows.cxx6
-rw-r--r--toolkit/source/controls/formattedcontrol.cxx1
-rw-r--r--toolkit/source/controls/unocontrols.cxx2
-rw-r--r--tools/inc/tools/multisel.hxx104
-rw-r--r--tools/inc/tools/stream.hxx5
-rw-r--r--tools/inc/tools/wintypes.hxx6
-rw-r--r--tools/source/fsys/urlobj.cxx18
-rw-r--r--tools/source/memtools/makefile.mk2
-rw-r--r--tools/source/memtools/multisel.cxx298
-rw-r--r--tools/workben/urltest.cxx14
-rw-r--r--transex3/prj/build.lst10
-rw-r--r--ucbhelper/inc/ucbhelper/content.hxx103
-rw-r--r--ucbhelper/source/client/content.cxx171
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.cxx188
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.src11
-rw-r--r--unotools/inc/unotools/confignode.hxx3
-rw-r--r--unotools/source/config/confignode.cxx60
-rw-r--r--unotools/source/ucbhelper/ucbhelper.cxx16
-rwxr-xr-xvcl/aqua/inc/aquaprintview.h26
-rw-r--r--vcl/aqua/inc/salgdi.h4
-rw-r--r--vcl/aqua/inc/salprn.h41
-rw-r--r--vcl/aqua/source/gdi/aquaprintaccessoryview.mm1237
-rwxr-xr-xvcl/aqua/source/gdi/aquaprintview.mm11
-rw-r--r--vcl/aqua/source/gdi/makefile.mk1
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx12
-rwxr-xr-xvcl/aqua/source/gdi/salgdiutils.cxx35
-rw-r--r--vcl/aqua/source/gdi/salnativewidgets.cxx16
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx320
-rw-r--r--vcl/inc/postgraphitestl.h9
-rw-r--r--vcl/inc/pregraphitestl.h30
-rw-r--r--vcl/inc/vcl/arrange.hxx425
-rw-r--r--vcl/inc/vcl/button.hxx16
-rw-r--r--vcl/inc/vcl/combobox.hxx4
-rw-r--r--vcl/inc/vcl/configsettings.hxx3
-rw-r--r--vcl/inc/vcl/edit.hxx1
-rw-r--r--vcl/inc/vcl/fixed.hxx1
-rw-r--r--vcl/inc/vcl/gdimtf.hxx1
-rw-r--r--vcl/inc/vcl/graphite_adaptors.hxx5
-rw-r--r--vcl/inc/vcl/graphite_cache.hxx4
-rw-r--r--vcl/inc/vcl/graphite_features.hxx3
-rw-r--r--vcl/inc/vcl/graphite_layout.hxx2
-rw-r--r--vcl/inc/vcl/ilstbox.hxx10
-rw-r--r--vcl/inc/vcl/impprn.hxx3
-rw-r--r--vcl/inc/vcl/jobdata.hxx2
-rw-r--r--vcl/inc/vcl/jobset.h13
-rw-r--r--vcl/inc/vcl/lstbox.h5
-rw-r--r--vcl/inc/vcl/lstbox.hxx4
-rw-r--r--vcl/inc/vcl/menu.hxx2
-rw-r--r--vcl/inc/vcl/oldprintadaptor.hxx52
-rw-r--r--vcl/inc/vcl/outdev.hxx5
-rw-r--r--vcl/inc/vcl/popupmenuwindow.hxx50
-rw-r--r--vcl/inc/vcl/ppdparser.hxx23
-rw-r--r--vcl/inc/vcl/print.h23
-rw-r--r--vcl/inc/vcl/print.hxx393
-rw-r--r--vcl/inc/vcl/printerinfomanager.hxx2
-rw-r--r--vcl/inc/vcl/printerjob.hxx2
-rw-r--r--vcl/inc/vcl/prndlg.hxx306
-rw-r--r--vcl/inc/vcl/prntypes.hxx3
-rw-r--r--vcl/inc/vcl/salprn.hxx18
-rw-r--r--vcl/inc/vcl/salptype.hxx6
-rw-r--r--vcl/inc/vcl/svdata.hxx8
-rw-r--r--vcl/inc/vcl/svids.hrc100
-rw-r--r--vcl/inc/vcl/tabctrl.hxx17
-rw-r--r--vcl/inc/vcl/tabdlg.hxx3
-rw-r--r--vcl/inc/vcl/toolbox.hxx3
-rw-r--r--vcl/inc/vcl/vclevent.hxx24
-rw-r--r--vcl/inc/vcl/virdev.hxx11
-rw-r--r--vcl/inc/vcl/window.h4
-rw-r--r--vcl/inc/vcl/window.hxx9
-rw-r--r--vcl/os2/inc/salprn.h5
-rw-r--r--vcl/os2/source/gdi/salprn.cxx11
-rw-r--r--vcl/prj/build.lst2
-rw-r--r--vcl/prj/d.lst3
-rw-r--r--vcl/source/app/salvtables.cxx4
-rw-r--r--vcl/source/app/svdata.cxx11
-rw-r--r--vcl/source/app/svmain.cxx20
-rw-r--r--vcl/source/app/vclevent.cxx23
-rw-r--r--vcl/source/control/button.cxx99
-rw-r--r--vcl/source/control/combobox.cxx24
-rw-r--r--vcl/source/control/edit.cxx45
-rw-r--r--vcl/source/control/fixed.cxx8
-rw-r--r--vcl/source/control/ilstbox.cxx29
-rw-r--r--vcl/source/control/lstbox.cxx78
-rw-r--r--vcl/source/control/tabctrl.cxx201
-rw-r--r--vcl/source/fontsubset/gsub.cxx13
-rw-r--r--vcl/source/fontsubset/sft.cxx20
-rw-r--r--vcl/source/gdi/bmpconv.cxx3
-rw-r--r--vcl/source/gdi/gdimtf.cxx34
-rw-r--r--vcl/source/gdi/impprn.cxx2
-rw-r--r--vcl/source/gdi/jobset.cxx26
-rw-r--r--[-rwxr-xr-x]vcl/source/gdi/makefile.mk4
-rw-r--r--vcl/source/gdi/oldprintadaptor.cxx117
-rw-r--r--vcl/source/gdi/outdev3.cxx2
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx1272
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx55
-rw-r--r--vcl/source/gdi/print.cxx484
-rw-r--r--vcl/source/gdi/print2.cxx35
-rw-r--r--vcl/source/gdi/print3.cxx1765
-rw-r--r--vcl/source/gdi/virdev.cxx29
-rw-r--r--vcl/source/glyphs/gcach_ftyp.cxx13
-rw-r--r--vcl/source/glyphs/graphite_adaptors.cxx2
-rw-r--r--vcl/source/glyphs/graphite_cache.cxx2
-rw-r--r--vcl/source/glyphs/graphite_features.cxx6
-rw-r--r--vcl/source/glyphs/graphite_layout.cxx14
-rw-r--r--vcl/source/glyphs/graphite_textsrc.cxx10
-rw-r--r--vcl/source/glyphs/graphite_textsrc.hxx4
-rw-r--r--vcl/source/helper/xconnection.cxx36
-rw-r--r--vcl/source/src/images.src20
-rw-r--r--vcl/source/src/makefile.mk5
-rw-r--r--vcl/source/src/print.src495
-rw-r--r--vcl/source/src/stdtext.src7
-rw-r--r--vcl/source/window/arrange.cxx906
-rw-r--r--vcl/source/window/dlgctrl.cxx15
-rw-r--r--vcl/source/window/makefile.mk5
-rw-r--r--vcl/source/window/menu.cxx16
-rw-r--r--vcl/source/window/popupmenuwindow.cxx82
-rw-r--r--vcl/source/window/printdlg.cxx2489
-rw-r--r--vcl/source/window/status.cxx1
-rw-r--r--vcl/source/window/tabdlg.cxx18
-rw-r--r--vcl/source/window/toolbox.cxx26
-rw-r--r--vcl/source/window/window.cxx53
-rw-r--r--vcl/source/window/window2.cxx2
-rw-r--r--vcl/unx/gtk/a11y/atkutil.cxx11
-rw-r--r--vcl/unx/gtk/a11y/atkwindow.cxx41
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx54
-rw-r--r--vcl/unx/gtk/app/gtkinst.cxx5
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx13
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx2
-rw-r--r--vcl/unx/headless/svpprn.cxx116
-rw-r--r--vcl/unx/headless/svpprn.hxx6
-rw-r--r--vcl/unx/inc/salprn.h6
-rw-r--r--vcl/unx/source/app/randrwrapper.cxx3
-rw-r--r--vcl/unx/source/app/saldisp.cxx6
-rw-r--r--vcl/unx/source/dtrans/X11_dndcontext.cxx12
-rw-r--r--vcl/unx/source/dtrans/X11_dndcontext.hxx20
-rw-r--r--vcl/unx/source/dtrans/X11_selection.cxx192
-rw-r--r--vcl/unx/source/dtrans/X11_selection.hxx100
-rw-r--r--vcl/unx/source/dtrans/bmp.cxx2
-rw-r--r--vcl/unx/source/dtrans/bmp.hxx2
-rw-r--r--vcl/unx/source/gdi/salprnpsp.cxx127
-rw-r--r--vcl/unx/source/plugadapt/salplug.cxx4
-rw-r--r--vcl/unx/source/printer/cupsmgr.cxx4
-rw-r--r--vcl/unx/source/printer/jobdata.cxx22
-rw-r--r--vcl/unx/source/printer/ppdparser.cxx440
-rw-r--r--vcl/unx/source/printer/printerinfomanager.cxx1
-rw-r--r--vcl/unx/source/printergfx/printerjob.cxx48
-rw-r--r--vcl/util/hidother.src34
-rw-r--r--vcl/util/makefile.mk2
-rw-r--r--vcl/util/makefile2.pmk7
-rw-r--r--vcl/win/inc/salprn.h5
-rw-r--r--vcl/win/source/gdi/salnativewidgets-luna.cxx61
-rw-r--r--vcl/win/source/gdi/salprn.cxx72
-rwxr-xr-x[-rw-r--r--]vcl/win/source/window/salframe.cxx5
329 files changed, 13205 insertions, 2414 deletions
diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx
index d8b574769554..24a488ddfbb4 100644
--- a/basegfx/test/basegfx2d.cxx
+++ b/basegfx/test/basegfx2d.cxx
@@ -283,8 +283,11 @@ public:
// depending on float precision and the getContinuity() implemetation using
// fTools::equal, linux and mac produce more 'C' than 'S' statements, while WIN32
// uses more 'S' statements (as it should be for circles)
- CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates",
- nCount==67 || nCount==50);
+#ifdef S390X
+ CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates", nCount==61 );
+#else
+ CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates", nCount==67 || nCount==50 );
+#endif
const B2DPolygon aRect(
tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) ));
diff --git a/canvas/source/directx/dx_winstuff.hxx b/canvas/source/directx/dx_winstuff.hxx
index 1c64506c0f21..47658991e74b 100755
--- a/canvas/source/directx/dx_winstuff.hxx
+++ b/canvas/source/directx/dx_winstuff.hxx
@@ -89,7 +89,7 @@
#include <d3d9.h>
#include <d3dx9.h>
- #include <dxerr9.h>
+// #include <dxerr9.h> #i107614# removing include, it has been changed in the latest sdk fron August2009 from dxerr9.h into dxerr.h
typedef IDirect3DSurface9 surface_type;
@@ -97,11 +97,11 @@
#undef DrawText
-#ifdef __MINGW32__
-using ::std::max;
-using ::std::min;
-#endif
-
+#ifdef __MINGW32__
+using ::std::max;
+using ::std::min;
+#endif
+
#include <gdiplus.h>
#ifdef min
diff --git a/comphelper/inc/comphelper/weakeventlistener.hxx b/comphelper/inc/comphelper/weakeventlistener.hxx
index c6938e2b8423..045dfb169312 100644
--- a/comphelper/inc/comphelper/weakeventlistener.hxx
+++ b/comphelper/inc/comphelper/weakeventlistener.hxx
@@ -76,7 +76,7 @@ namespace comphelper
inline void resetListener( )
{
- m_aListener = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >();
+ m_aListener.clear();
}
diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx
index 8b816e8c1ce9..caa895021103 100644
--- a/comphelper/source/property/opropertybag.cxx
+++ b/comphelper/source/property/opropertybag.cxx
@@ -240,7 +240,7 @@ namespace comphelper
if ( !( _element >>= aProperty ) )
throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::ClearableMutexGuard g( m_aMutex );
// check whether the type is allowed, everything else will be checked
// by m_aDynamicProperties
@@ -254,6 +254,7 @@ namespace comphelper
// our property info is dirty
m_pArrayHelper.reset();
+ g.clear();
setModified(sal_True);
}
@@ -346,7 +347,7 @@ namespace comphelper
//--------------------------------------------------------------------
void SAL_CALL OPropertyBag::addProperty( const ::rtl::OUString& _rName, ::sal_Int16 _nAttributes, const Any& _rInitialValue ) throw (PropertyExistException, IllegalTypeException, IllegalArgumentException, RuntimeException)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::ClearableMutexGuard g( m_aMutex );
// check whether the type is allowed, everything else will be checked
// by m_aDynamicProperties
@@ -362,19 +363,21 @@ namespace comphelper
// our property info is dirty
m_pArrayHelper.reset();
+ g.clear();
setModified(sal_True);
}
//--------------------------------------------------------------------
void SAL_CALL OPropertyBag::removeProperty( const ::rtl::OUString& _rName ) throw (UnknownPropertyException, NotRemoveableException, RuntimeException)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::ClearableMutexGuard g( m_aMutex );
m_aDynamicProperties.removeProperty( _rName );
// our property info is dirty
m_pArrayHelper.reset();
+ g.clear();
setModified(sal_True);
}
diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx
index fe6cbaa9d767..0ccc28d4238b 100644
--- a/comphelper/source/property/property.cxx
+++ b/comphelper/source/property/property.cxx
@@ -38,15 +38,11 @@
#include <osl/diagnose.h>
#if OSL_DEBUG_LEVEL > 0
- #ifndef _RTL_STRBUF_HXX_
#include <rtl/strbuf.hxx>
- #endif
- #ifndef _CPPUHELPER_EXC_HLP_HXX_
#include <cppuhelper/exc_hlp.hxx>
- #endif
- #ifndef _OSL_THREAD_H_
#include <osl/thread.h>
- #endif
+ #include <com/sun/star/lang/XServiceInfo.hpp>
+ #include <typeinfo>
#endif
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
@@ -71,6 +67,10 @@ namespace comphelper
using ::com::sun::star::uno::cpp_queryInterface;
using ::com::sun::star::uno::cpp_acquire;
using ::com::sun::star::uno::cpp_release;
+#if OSL_DEBUG_LEVEL > 0
+ using ::com::sun::star::lang::XServiceInfo;
+#endif
+ using ::com::sun::star::uno::UNO_QUERY;
/** === end UNO using === **/
namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
@@ -110,7 +110,18 @@ void copyProperties(const Reference<XPropertySet>& _rxSource,
::rtl::OStringBuffer aBuffer;
aBuffer.append( "::comphelper::copyProperties: could not copy property '" );
aBuffer.append( ::rtl::OString( pSourceProps->Name.getStr(), pSourceProps->Name.getLength(), RTL_TEXTENCODING_ASCII_US ) );
- aBuffer.append( "' to the destination set.\n" );
+ aBuffer.append( "' to the destination set (a '" );
+
+ Reference< XServiceInfo > xSI( _rxDest, UNO_QUERY );
+ if ( xSI.is() )
+ {
+ aBuffer.append( ::rtl::OUStringToOString( xSI->getImplementationName(), osl_getThreadTextEncoding() ) );
+ }
+ else
+ {
+ aBuffer.append( typeid( *_rxDest.get() ).name() );
+ }
+ aBuffer.append( "' implementation).\n" );
Any aException( ::cppu::getCaughtException() );
aBuffer.append( "Caught an exception of type '" );
diff --git a/cppcanvas/inc/cppcanvas/color.hxx b/cppcanvas/inc/cppcanvas/color.hxx
index 7441f6f2937a..ad0430713ead 100644
--- a/cppcanvas/inc/cppcanvas/color.hxx
+++ b/cppcanvas/inc/cppcanvas/color.hxx
@@ -83,6 +83,16 @@ namespace cppcanvas
return (nRed << 24U)|(nGreen << 16U)|(nBlue << 8U)|(nAlpha);
}
+ inline sal_Int32 unMakeColor( sal_uInt8 nAlpha, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ {
+ return (nAlpha << 24U)|(nRed << 16U)|(nGreen << 8U)|(nBlue);
+ }
+
+ inline sal_Int32 makeColorARGB( sal_uInt8 nAlpha, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ {
+ return (nAlpha << 24U)|(nRed << 16U)|(nGreen << 8U)|(nBlue);
+ }
+
}
#endif /* _CPPCANVAS_COLOR_HXX */
diff --git a/goodies/source/filter.vcl/ieps/ieps.cxx b/goodies/source/filter.vcl/ieps/ieps.cxx
index f315ee864310..7f1ecfc65bd0 100644
--- a/goodies/source/filter.vcl/ieps/ieps.cxx
+++ b/goodies/source/filter.vcl/ieps/ieps.cxx
@@ -164,12 +164,54 @@ static void MakeAsMeta(Graphic &rGraphic)
rGraphic = aMtf;
}
+static oslProcessError runProcessWithPathSearch(const rtl::OUString &rProgName,
+ rtl_uString* pArgs[], sal_uInt32 nArgs, oslProcess *pProcess,
+ oslFileHandle *pIn, oslFileHandle *pOut, oslFileHandle *pErr)
+{
+#ifdef WNT
+ /*
+ * ooo#72096
+ * On Window the underlying SearchPath searches in order of...
+ * The directory from which the application loaded.
+ * The current directory.
+ * The Windows system directory.
+ * The Windows directory.
+ * The directories that are listed in the PATH environment variable.
+ *
+ * Because one of our programs is called "convert" and there is a convert
+ * in the windows system directory, we want to explicitly search the PATH
+ * to avoid picking up on that one if ImageMagick's convert preceeds it in
+ * PATH.
+ *
+ */
+ rtl::OUString url;
+ rtl::OUString path(_wgetenv(L"PATH"));
+
+ oslFileError err = osl_searchFileURL(rProgName.pData, path.pData, &url.pData);
+ if (err != osl_File_E_None)
+ return osl_Process_E_NotFound;
+ return osl_executeProcess_WithRedirectedIO(url.pData,
+ pArgs, nArgs, osl_Process_HIDDEN,
+ osl_getCurrentSecurity(), 0, 0, 0, pProcess, pIn, pOut, pErr);
+#else
+ return osl_executeProcess_WithRedirectedIO(rProgName.pData,
+ pArgs, nArgs, osl_Process_SEARCHPATH | osl_Process_HIDDEN,
+ osl_getCurrentSecurity(), 0, 0, 0, pProcess, pIn, pOut, pErr);
+#endif
+}
+
+#if defined(WNT) || defined(OS2)
+# define EXESUFFIX ".exe"
+#else
+# define EXESUFFIX ""
+#endif
+
static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &rGraphic)
{
TempFile aTemp;
aTemp.EnableKillingFile();
rtl::OUString fileName =
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pstoedit"));
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pstoedit"EXESUFFIX));
rtl::OUString arg1 =
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-f"));
rtl::OUString arg2 =
@@ -186,10 +228,10 @@ static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r
oslFileHandle pIn = NULL;
oslFileHandle pOut = NULL;
oslFileHandle pErr = NULL;
- oslProcessError eErr = osl_executeProcess_WithRedirectedIO(fileName.pData,
- args, sizeof(args)/sizeof(rtl_uString *),
- osl_Process_SEARCHPATH | osl_Process_HIDDEN,
- osl_getCurrentSecurity(), 0, 0, 0, &aProcess, &pIn, &pOut, &pErr);
+ oslProcessError eErr = runProcessWithPathSearch(fileName,
+ args, sizeof(args)/sizeof(rtl_uString *),
+ &aProcess, &pIn, &pOut, &pErr);
+
if (eErr!=osl_Process_E_None)
return false;
@@ -222,15 +264,15 @@ static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r
}
static bool RenderAsPNGThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
- Graphic &rGraphic, rtl::OUString &rProgName, rtl_uString **pArgs, size_t nArgs)
+ Graphic &rGraphic, rtl::OUString &rProgName, rtl_uString *pArgs[], size_t nArgs)
{
oslProcess aProcess;
oslFileHandle pIn = NULL;
oslFileHandle pOut = NULL;
oslFileHandle pErr = NULL;
- oslProcessError eErr = osl_executeProcess_WithRedirectedIO(rProgName.pData,
- pArgs, nArgs, osl_Process_SEARCHPATH | osl_Process_HIDDEN,
- osl_getCurrentSecurity(), 0, 0, 0, &aProcess, &pIn, &pOut, &pErr);
+ oslProcessError eErr = runProcessWithPathSearch(rProgName,
+ pArgs, nArgs,
+ &aProcess, &pIn, &pOut, &pErr);
if (eErr!=osl_Process_E_None)
return false;
@@ -251,7 +293,7 @@ static bool RenderAsPNGThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRea
aMemStm.Seek(0);
if (
- eFileErr == osl_File_E_None &&
+ aMemStm.GetEndOfData() &&
GraphicConverter::Import(aMemStm, rGraphic, CVT_PNG) == ERRCODE_NONE
)
{
@@ -270,7 +312,7 @@ static bool RenderAsPNGThroughConvert(const sal_uInt8* pBuf, sal_uInt32 nBytesRe
Graphic &rGraphic)
{
rtl::OUString fileName =
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("convert"));
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("convert"EXESUFFIX));
// density in pixel/inch
rtl::OUString arg1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-density"));
// since the preview is also used for PDF-Export & printing on non-PS-printers,
@@ -293,10 +335,10 @@ static bool RenderAsPNGThroughGS(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
{
#ifdef WNT
rtl::OUString fileName =
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gswin32c"));
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gswin32c"EXESUFFIX));
#else
rtl::OUString fileName =
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gs"));
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gs"EXESUFFIX));
#endif
rtl::OUString arg1 =
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-q"));
diff --git a/goodies/source/filter.vcl/ipbm/ipbm.cxx b/goodies/source/filter.vcl/ipbm/ipbm.cxx
index 227490fc9d8e..3c30dd0c2ba3 100644
--- a/goodies/source/filter.vcl/ipbm/ipbm.cxx
+++ b/goodies/source/filter.vcl/ipbm/ipbm.cxx
@@ -106,7 +106,7 @@ BOOL PBMReader::ReadPBM( SvStream & rPBM, Graphic & rGraphic )
if ( ( mbStatus = ImplReadHeader() ) == FALSE )
return FALSE;
- if ( mnWidth == 0 || mnHeight == 0 )
+ if ( ( mnMaxVal == 0 ) || ( mnWidth == 0 ) || ( mnHeight == 0 ) )
return FALSE;
// 0->PBM, 1->PGM, 2->PPM
@@ -172,6 +172,7 @@ BOOL PBMReader::ImplReadHeader()
*mpPBM >> nID[ 0 ] >> nID[ 1 ];
if ( nID[ 0 ] != 'P' )
return FALSE;
+ mnMaxVal = mnWidth = mnHeight = 0;
switch ( nID[ 1 ] )
{
case '1' :
@@ -179,6 +180,7 @@ BOOL PBMReader::ImplReadHeader()
case '4' :
mnMode = 0;
nMax = 2; // number of parameters in Header
+ mnMaxVal = 1;
break;
case '2' :
mbRaw = FALSE;
@@ -195,9 +197,6 @@ BOOL PBMReader::ImplReadHeader()
default:
return FALSE;
}
-
- mnMaxVal = mnWidth = mnHeight = 0;
-
while ( bFinished == FALSE )
{
if ( mpPBM->GetError() )
@@ -466,7 +465,9 @@ BOOL PBMReader::ImplReadBody()
if ( nCount == 3 )
{
nCount = 0;
- mpAcc->SetPixel( nHeight, nWidth++, BitmapColor( (BYTE)nRGB[ 0 ], (BYTE)nRGB[ 1 ], (BYTE)nRGB[ 2 ] ) );
+ mpAcc->SetPixel( nHeight, nWidth++, BitmapColor( static_cast< BYTE >( ( nRGB[ 0 ] * 255 ) / mnMaxVal ),
+ static_cast< BYTE >( ( nRGB[ 1 ] * 255 ) / mnMaxVal ),
+ static_cast< BYTE >( ( nRGB[ 2 ] * 255 ) / mnMaxVal ) ) );
nCount = 0;
nRGB[ 0 ] = nRGB[ 1 ] = nRGB[ 2 ] = 0;
if ( nWidth == mnWidth )
diff --git a/transex3/inc/cfgmerge.hxx b/l10ntools/inc/cfgmerge.hxx
index 9f1c97f05af5..9f1c97f05af5 100644
--- a/transex3/inc/cfgmerge.hxx
+++ b/l10ntools/inc/cfgmerge.hxx
diff --git a/transex3/inc/export.hxx b/l10ntools/inc/export.hxx
index ec5195034e91..6d94297c25fb 100644
--- a/transex3/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -31,9 +31,9 @@
#ifndef _EXPORT_HXX
#define _EXPORT_HXX
-#ifndef TRANSEX_DIRECTORY_HXX
-#define TRANSEX_DIRECTORY_HXX
-#include <transex3/directory.hxx>
+#ifndef L10NTOOLS_DIRECTORY_HXX
+#define L10NTOOLS_DIRECTORY_HXX
+#include <l10ntools/directory.hxx>
#endif
diff --git a/transex3/inc/gsicheck.hxx b/l10ntools/inc/gsicheck.hxx
index 13debcfc7106..13debcfc7106 100644
--- a/transex3/inc/gsicheck.hxx
+++ b/l10ntools/inc/gsicheck.hxx
diff --git a/transex3/inc/helpmerge.hxx b/l10ntools/inc/helpmerge.hxx
index 0ebfa7ed62a9..0ebfa7ed62a9 100644
--- a/transex3/inc/helpmerge.hxx
+++ b/l10ntools/inc/helpmerge.hxx
diff --git a/transex3/inc/inireader.hxx b/l10ntools/inc/inireader.hxx
index 0861290adf9f..0861290adf9f 100644
--- a/transex3/inc/inireader.hxx
+++ b/l10ntools/inc/inireader.hxx
diff --git a/transex3/inc/transex3/directory.hxx b/l10ntools/inc/l10ntools/directory.hxx
index 6e507961d3bb..6b71f59435f7 100644
--- a/transex3/inc/transex3/directory.hxx
+++ b/l10ntools/inc/l10ntools/directory.hxx
@@ -12,9 +12,9 @@
#include <stdio.h>
-#ifndef TRANSEX_FILE_HXX
-#define TRANSEX_FILE_HXX
-#include <transex3/file.hxx>
+#ifndef L10NTOOLS_FILE_HXX
+#define L10NTOOLS_FILE_HXX
+#include <l10ntools/file.hxx>
#endif
namespace transex{
diff --git a/transex3/inc/transex3/file.hxx b/l10ntools/inc/l10ntools/file.hxx
index e3a1a46b4ee8..e3a1a46b4ee8 100644
--- a/transex3/inc/transex3/file.hxx
+++ b/l10ntools/inc/l10ntools/file.hxx
diff --git a/transex3/inc/transex3/vosapp.hxx b/l10ntools/inc/l10ntools/vosapp.hxx
index 49e10e15e3d4..49e10e15e3d4 100644
--- a/transex3/inc/transex3/vosapp.hxx
+++ b/l10ntools/inc/l10ntools/vosapp.hxx
diff --git a/transex3/inc/lngmerge.hxx b/l10ntools/inc/lngmerge.hxx
index 502889b27aa9..502889b27aa9 100644
--- a/transex3/inc/lngmerge.hxx
+++ b/l10ntools/inc/lngmerge.hxx
diff --git a/transex3/inc/makefile.mk b/l10ntools/inc/makefile.mk
index 00caed43733a..6a704d63e48f 100644
--- a/transex3/inc/makefile.mk
+++ b/l10ntools/inc/makefile.mk
@@ -30,7 +30,7 @@
#*************************************************************************
PRJ=..
-PRJNAME=transex3
+PRJNAME=l10ntools
TARGET=inc
# --- Settings -----------------------------------------------------
diff --git a/transex3/inc/pch/precompiled_transex3.cxx b/l10ntools/inc/pch/precompiled_l10ntools.cxx
index 5b69c9f2f204..b6cac813375f 100644
--- a/transex3/inc/pch/precompiled_transex3.cxx
+++ b/l10ntools/inc/pch/precompiled_l10ntools.cxx
@@ -28,5 +28,5 @@
*
************************************************************************/
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
diff --git a/transex3/inc/pch/precompiled_transex3.hxx b/l10ntools/inc/pch/precompiled_l10ntools.hxx
index 2ed3c72ad4ee..2ed3c72ad4ee 100644
--- a/transex3/inc/pch/precompiled_transex3.hxx
+++ b/l10ntools/inc/pch/precompiled_l10ntools.hxx
diff --git a/transex3/inc/srciter.hxx b/l10ntools/inc/srciter.hxx
index bcbdf5eb542b..7f80074cd651 100644
--- a/transex3/inc/srciter.hxx
+++ b/l10ntools/inc/srciter.hxx
@@ -28,9 +28,9 @@
*
************************************************************************/
-#ifndef TRANSEX_DIRECTORY_HXX
-#define TRANSEX_DIRECTORY_HXX
-#include <transex3/directory.hxx>
+#ifndef L10NTOOLS_DIRECTORY_HXX
+#define L10NTOOLS_DIRECTORY_HXX
+#include <l10ntools/directory.hxx>
#endif
// class SourceTreeIterator
diff --git a/transex3/inc/tagtest.hxx b/l10ntools/inc/tagtest.hxx
index 811c4bf0e164..811c4bf0e164 100644
--- a/transex3/inc/tagtest.hxx
+++ b/l10ntools/inc/tagtest.hxx
diff --git a/transex3/inc/tokens.h b/l10ntools/inc/tokens.h
index ef285f4c6361..ef285f4c6361 100644
--- a/transex3/inc/tokens.h
+++ b/l10ntools/inc/tokens.h
diff --git a/transex3/inc/treeconfig.hxx b/l10ntools/inc/treeconfig.hxx
index 96d693b0d376..96d693b0d376 100644
--- a/transex3/inc/treeconfig.hxx
+++ b/l10ntools/inc/treeconfig.hxx
diff --git a/transex3/inc/utf8conv.hxx b/l10ntools/inc/utf8conv.hxx
index 32e506edbda8..32e506edbda8 100644
--- a/transex3/inc/utf8conv.hxx
+++ b/l10ntools/inc/utf8conv.hxx
diff --git a/transex3/inc/wrdtrans.hxx b/l10ntools/inc/wrdtrans.hxx
index efcb663204a6..efcb663204a6 100644
--- a/transex3/inc/wrdtrans.hxx
+++ b/l10ntools/inc/wrdtrans.hxx
diff --git a/transex3/inc/wtranode.hxx b/l10ntools/inc/wtranode.hxx
index 4d71fc160fff..4d71fc160fff 100644
--- a/transex3/inc/wtranode.hxx
+++ b/l10ntools/inc/wtranode.hxx
diff --git a/transex3/inc/wtratree.hxx b/l10ntools/inc/wtratree.hxx
index 67d63280449f..67d63280449f 100644
--- a/transex3/inc/wtratree.hxx
+++ b/l10ntools/inc/wtratree.hxx
diff --git a/transex3/inc/xmlparse.hxx b/l10ntools/inc/xmlparse.hxx
index 18b047ef75c1..18b047ef75c1 100644
--- a/transex3/inc/xmlparse.hxx
+++ b/l10ntools/inc/xmlparse.hxx
diff --git a/transex3/inc/xmlutil.hxx b/l10ntools/inc/xmlutil.hxx
index 812f50b85c45..812f50b85c45 100644
--- a/transex3/inc/xmlutil.hxx
+++ b/l10ntools/inc/xmlutil.hxx
diff --git a/transex3/inc/xrmmerge.hxx b/l10ntools/inc/xrmmerge.hxx
index 47be1ea7a038..47be1ea7a038 100644
--- a/transex3/inc/xrmmerge.hxx
+++ b/l10ntools/inc/xrmmerge.hxx
diff --git a/transex3/java/l10nconv/build.xml b/l10ntools/java/l10nconv/build.xml
index 6902227e5122..6902227e5122 100755
--- a/transex3/java/l10nconv/build.xml
+++ b/l10ntools/java/l10nconv/build.xml
diff --git a/transex3/java/l10nconv/converter.MF b/l10ntools/java/l10nconv/converter.MF
index 843d500b7548..843d500b7548 100755
--- a/transex3/java/l10nconv/converter.MF
+++ b/l10ntools/java/l10nconv/converter.MF
diff --git a/transex3/java/l10nconv/documentation/readmeConverter.sxw b/l10ntools/java/l10nconv/documentation/readmeConverter.sxw
index f779e10acb2c..f779e10acb2c 100755
--- a/transex3/java/l10nconv/documentation/readmeConverter.sxw
+++ b/l10ntools/java/l10nconv/documentation/readmeConverter.sxw
Binary files differ
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapCheck.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapCheck.java
index d304c2544bff..d304c2544bff 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapCheck.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapCheck.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java
index 49fc08b69d32..49fc08b69d32 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/DirtyTags/Tag.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/Tag.java
index 7495736ab68c..7495736ab68c 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/DirtyTags/Tag.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/Tag.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java
index 7993fc9cf0a4..7993fc9cf0a4 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java
index 5b1fb6c62b61..5b1fb6c62b61 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java
index 7ec09bcb411a..7ec09bcb411a 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java
index 07a3708d4366..07a3708d4366 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java
index e8b4136f185a..e8b4136f185a 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java
index 59de7ca7e1f4..59de7ca7e1f4 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java
index c5d6765e3840..c5d6765e3840 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java
index b05767e93ae3..b05767e93ae3 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java
index a21b8daa7b1d..a21b8daa7b1d 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java
index adb6e358a74c..adb6e358a74c 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java
index 085e26475e09..085e26475e09 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java
index ff0348f97d3d..ff0348f97d3d 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java
index 6a11360cc472..6a11360cc472 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java
index 997c05a70b4f..997c05a70b4f 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java
index f53fe0101275..f53fe0101275 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java
index 29a9ee2e528a..29a9ee2e528a 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java
index 4c0c234778ec..4c0c234778ec 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java
index 98eb8c856e6a..98eb8c856e6a 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java
index 522dcc18a5bd..522dcc18a5bd 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java
index 42eef42884c1..42eef42884c1 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/dtd/xliff.dtd b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/dtd/xliff.dtd
index 91262ec28204..91262ec28204 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/converter/dtd/xliff.dtd
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/dtd/xliff.dtd
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/languageResolver/LanguageResolver.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/LanguageResolver.java
index 62ff008156ab..62ff008156ab 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/languageResolver/LanguageResolver.java
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/LanguageResolver.java
diff --git a/transex3/java/l10nconv/java/com/sun/star/tooling/languageResolver/lang.map b/l10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/lang.map
index a43e8f5e0218..a43e8f5e0218 100755
--- a/transex3/java/l10nconv/java/com/sun/star/tooling/languageResolver/lang.map
+++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/lang.map
diff --git a/transex3/java/l10nconv/makefile.mk b/l10ntools/java/l10nconv/makefile.mk
index feb869778e80..2be2eb391ced 100755
--- a/transex3/java/l10nconv/makefile.mk
+++ b/l10ntools/java/l10nconv/makefile.mk
@@ -30,7 +30,7 @@
#*************************************************************************
PRJ=../..
-PRJNAME=transex3
+PRJNAME=l10ntools
TARGET=converter
.INCLUDE : ant.mk
diff --git a/transex3/java/receditor/build.xml b/l10ntools/java/receditor/build.xml
index 34f02128f034..34f02128f034 100755
--- a/transex3/java/receditor/build.xml
+++ b/l10ntools/java/receditor/build.xml
diff --git a/transex3/java/receditor/java/transex3/controller/EditorController.java b/l10ntools/java/receditor/java/transex3/controller/EditorController.java
index 38462d665304..38462d665304 100644
--- a/transex3/java/receditor/java/transex3/controller/EditorController.java
+++ b/l10ntools/java/receditor/java/transex3/controller/EditorController.java
diff --git a/transex3/java/receditor/java/transex3/controller/Main.java b/l10ntools/java/receditor/java/transex3/controller/Main.java
index e8dd06ce9f85..e8dd06ce9f85 100644
--- a/transex3/java/receditor/java/transex3/controller/Main.java
+++ b/l10ntools/java/receditor/java/transex3/controller/Main.java
diff --git a/transex3/java/receditor/java/transex3/model/ResourceFile.java b/l10ntools/java/receditor/java/transex3/model/ResourceFile.java
index 51fabb3a4b7a..51fabb3a4b7a 100644
--- a/transex3/java/receditor/java/transex3/model/ResourceFile.java
+++ b/l10ntools/java/receditor/java/transex3/model/ResourceFile.java
diff --git a/transex3/java/receditor/java/transex3/model/SdfEntity.java b/l10ntools/java/receditor/java/transex3/model/SdfEntity.java
index 4b293421fd28..4b293421fd28 100644
--- a/transex3/java/receditor/java/transex3/model/SdfEntity.java
+++ b/l10ntools/java/receditor/java/transex3/model/SdfEntity.java
diff --git a/transex3/java/receditor/java/transex3/model/SdfString.java b/l10ntools/java/receditor/java/transex3/model/SdfString.java
index 7419aeb5578b..7419aeb5578b 100644
--- a/transex3/java/receditor/java/transex3/model/SdfString.java
+++ b/l10ntools/java/receditor/java/transex3/model/SdfString.java
diff --git a/transex3/java/receditor/java/transex3/view/Editor.java b/l10ntools/java/receditor/java/transex3/view/Editor.java
index f46a82a11a2b..f46a82a11a2b 100644
--- a/transex3/java/receditor/java/transex3/view/Editor.java
+++ b/l10ntools/java/receditor/java/transex3/view/Editor.java
diff --git a/transex3/java/receditor/java/transex3/view/SdfTable.java b/l10ntools/java/receditor/java/transex3/view/SdfTable.java
index f0cc7bd84a34..f0cc7bd84a34 100644
--- a/transex3/java/receditor/java/transex3/view/SdfTable.java
+++ b/l10ntools/java/receditor/java/transex3/view/SdfTable.java
diff --git a/transex3/java/receditor/makefile.mk b/l10ntools/java/receditor/makefile.mk
index e5e3921eea6b..dd3f84daccce 100755
--- a/transex3/java/receditor/makefile.mk
+++ b/l10ntools/java/receditor/makefile.mk
@@ -30,7 +30,7 @@
#*************************************************************************
PRJ=../..
-PRJNAME=transex3
+PRJNAME=l10ntools
TARGET=receditor
.INCLUDE : ant.mk
diff --git a/transex3/java/receditor/receditor.MF b/l10ntools/java/receditor/receditor.MF
index dced97882df9..dced97882df9 100755
--- a/transex3/java/receditor/receditor.MF
+++ b/l10ntools/java/receditor/receditor.MF
diff --git a/transex3/layout/README b/l10ntools/layout/README
index 1838e2a94ba0..1838e2a94ba0 100644
--- a/transex3/layout/README
+++ b/l10ntools/layout/README
diff --git a/transex3/layout/layoutparse.cxx b/l10ntools/layout/layoutparse.cxx
index 0f43c9a3053f..0f43c9a3053f 100644
--- a/transex3/layout/layoutparse.cxx
+++ b/l10ntools/layout/layoutparse.cxx
diff --git a/transex3/layout/layoutparse.hxx b/l10ntools/layout/layoutparse.hxx
index b9cd8f6c18b2..b9cd8f6c18b2 100644
--- a/transex3/layout/layoutparse.hxx
+++ b/l10ntools/layout/layoutparse.hxx
diff --git a/transex3/layout/loc.sdf b/l10ntools/layout/loc.sdf
index 023357adc420..023357adc420 100644
--- a/transex3/layout/loc.sdf
+++ b/l10ntools/layout/loc.sdf
diff --git a/transex3/layout/makefile.mk b/l10ntools/layout/makefile.mk
index 9864b46242b2..63dbeae6d9e9 100644
--- a/transex3/layout/makefile.mk
+++ b/l10ntools/layout/makefile.mk
@@ -33,7 +33,7 @@ PRJ=..
INCPRE=$(MISC)
-PRJNAME=transex3
+PRJNAME=l10ntools
TARGET=tralay
#TARGETTYPE=GUI
TARGETTYPE=CUI
diff --git a/transex3/layout/tralay.cxx b/l10ntools/layout/tralay.cxx
index 740981674c50..13a7fdb0c5d9 100644
--- a/transex3/layout/tralay.cxx
+++ b/l10ntools/layout/tralay.cxx
@@ -30,7 +30,7 @@
************************************************************************/
#include <com/sun/star/xml/sax/SAXException.hpp>
-#include <transex3/vosapp.hxx>
+#include <l10ntools/vosapp.hxx>
#include <osl/file.hxx>
diff --git a/transex3/layout/zoom.xml b/l10ntools/layout/zoom.xml
index 0fb3d27343ff..0fb3d27343ff 100644
--- a/transex3/layout/zoom.xml
+++ b/l10ntools/layout/zoom.xml
diff --git a/l10ntools/prj/build.lst b/l10ntools/prj/build.lst
new file mode 100644
index 000000000000..ff961c096cbd
--- /dev/null
+++ b/l10ntools/prj/build.lst
@@ -0,0 +1,10 @@
+tr l10ntools : tools LIBXSLT:libxslt BERKELEYDB:berkeleydb LUCENE:lucene NULL
+tr l10ntools usr1 - all tr_mkout NULL
+tr l10ntools\inc nmake - all tr_inc NULL
+tr l10ntools\source nmake - all tr_src tr_inc NULL
+tr l10ntools\layout nmake - all rt_layout tr_src tr_inc NULL
+#tr l10ntools\java\l10nconv nmake - all tr_conv NULL
+#tr l10ntools\java\receditor nmake - all tr_rece NULL
+tr l10ntools\source\help nmake - all tr_bla_help NULL
+tr l10ntools\source\filter\utils nmake - all tr_bla_utils NULL
+tr l10ntools\source\filter\merge nmake - all tr_bla_merge tr_bla_utils NULL
diff --git a/transex3/prj/d.lst b/l10ntools/prj/d.lst
index a469837275ed..f75c16b43764 100644
--- a/transex3/prj/d.lst
+++ b/l10ntools/prj/d.lst
@@ -1,4 +1,4 @@
-mkdir: %_DEST%\inc%_EXT%\transex3
+mkdir: %_DEST%\inc%_EXT%\l10ntools
mkdir: %_DEST%\bin%_EXT%
mkdir: %_DEST%\bin%_EXT%\help
mkdir: %_DEST%\bin%_EXT%\help\com
@@ -46,16 +46,16 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help
..\scripts\fast_merge.pl %_DEST%\bin%_EXT%\fast_merge.pl
..\scripts\keyidGen.pl %_DEST%\bin%_EXT%\keyidGen.pl
-..\inc\export.hxx %_DEST%\inc%_EXT%\transex3\export.hxx
-..\inc\transex3\directory.hxx %_DEST%\inc%_EXT%\transex3\directory.hxx
-..\inc\transex3\file.hxx %_DEST%\inc%_EXT%\transex3\file.hxx
-..\inc\transex3\vosapp.hxx %_DEST%\inc%_EXT%\transex3\vosapp.hxx
+..\inc\export.hxx %_DEST%\inc%_EXT%\l10ntools\export.hxx
+..\inc\l10ntools\directory.hxx %_DEST%\inc%_EXT%\l10ntools\directory.hxx
+..\inc\l10ntools\file.hxx %_DEST%\inc%_EXT%\l10ntools\file.hxx
+..\inc\l10ntools\vosapp.hxx %_DEST%\inc%_EXT%\l10ntools\vosapp.hxx
-..\inc\utf8conv.hxx %_DEST%\inc%_EXT%\transex3\utf8conv.hxx
+..\inc\utf8conv.hxx %_DEST%\inc%_EXT%\l10ntools\utf8conv.hxx
..\%__SRC%\lib\transex.lib %_DEST%\lib%_EXT%\transex.lib
..\%__SRC%\lib\libtransex.a %_DEST%\lib%_EXT%\libtransex.a
-..\source\help\compilehelp.hxx %_DEST%\inc%_EXT%\transex3\compilehelp.hxx
-#..\source\help\helplinkerdllapi.h %_DEST%\inc%_EXT%\transex3\helplinkerdllapi.h
+..\source\help\compilehelp.hxx %_DEST%\inc%_EXT%\l10ntools\compilehelp.hxx
+#..\source\help\helplinkerdllapi.h %_DEST%\inc%_EXT%\l10ntools\helplinkerdllapi.h
..\%__SRC%\lib\* %_DEST%\lib%_EXT%\*
..\%__SRC%\class\com\sun\star\help\* %_DEST%\bin%_EXT%\help\com\sun\star\help\*
diff --git a/transex3/scripts/fast_merge.pl b/l10ntools/scripts/fast_merge.pl
index 7321a9a42911..7321a9a42911 100644
--- a/transex3/scripts/fast_merge.pl
+++ b/l10ntools/scripts/fast_merge.pl
diff --git a/transex3/scripts/keyidGen.pl b/l10ntools/scripts/keyidGen.pl
index acb5137e3f7c..acb5137e3f7c 100644
--- a/transex3/scripts/keyidGen.pl
+++ b/l10ntools/scripts/keyidGen.pl
diff --git a/transex3/scripts/localize.pl b/l10ntools/scripts/localize.pl
index 10e8124027b1..0f6a19effc38 100755
--- a/transex3/scripts/localize.pl
+++ b/l10ntools/scripts/localize.pl
@@ -78,6 +78,7 @@ my $WIN;
my $languages;
#my %sl_modules; # Contains all modules where en-US and de is source language
my $use_default_date = '0';
+my $force_ooo_module = '0';
my %is_ooo_module;
my %is_so_module;
my $DELIMITER;
@@ -275,7 +276,7 @@ sub check_modules_scm
sub is_openoffice_module
{
my $module = shift;
- return "TRUE", if defined $is_ooo_module{ $module };
+ return "TRUE", if ( $force_ooo_module || defined $is_ooo_module{ $module } );
return "";
}
@@ -1114,7 +1115,7 @@ sub parse_options{
my $extract;
my $success = GetOptions('f=s' => \$sdffile , 'l=s' => \$languages , 's=s' => \$srcpath , 'h' => \$help , 'v' => \$bVerbose ,
'm' => \$merge , 'e' => \$extract , 'x' => \$no_sort , 'd' => \$use_default_date , 'c' => \$create_dirs ,
- 'n' => \$no_gsicheck );
+ 'n' => \$no_gsicheck , 'o' => \$force_ooo_module );
$outputfile = $sdffile;
#print STDOUT "DBG: lang = $languages\n";
@@ -1126,7 +1127,11 @@ sub parse_options{
exit(1);
}
}
- if( $help || !$success || $#ARGV > 1 || ( !$sdffile ) ){
+ if( $help ){
+ usage();
+ exit(0);
+ }
+ if( !$success || $#ARGV > 1 || ( !$sdffile ) ){
usage();
exit(1);
}
@@ -1167,6 +1172,8 @@ sub usage{
print STDERR " -h File with localize.sdf's\n!";
print STDERR " -n No gsicheck\n";
print STDERR " -i Module to merge\n";
+ print STDERR " -o force using ooo localization from the l10n module instead of l10n_so; \n";
+ print STDERR " useful if the type can't be detected by the .svn tags; \n";
print STDERR " -v Verbose\n";
print STDERR "\nExample:\n";
print STDERR "\nlocalize -e -l en-US,pt-BR=en-US -f my.sdf\n( Extract en-US and pt-BR with en-US fallback )\n";
diff --git a/transex3/scripts/localize_old.pl b/l10ntools/scripts/localize_old.pl
index 151399d22002..151399d22002 100755
--- a/transex3/scripts/localize_old.pl
+++ b/l10ntools/scripts/localize_old.pl
diff --git a/transex3/source/cfg_yy_wrapper.c b/l10ntools/source/cfg_yy_wrapper.c
index ac678d17f399..ac678d17f399 100644
--- a/transex3/source/cfg_yy_wrapper.c
+++ b/l10ntools/source/cfg_yy_wrapper.c
diff --git a/transex3/source/cfglex.l b/l10ntools/source/cfglex.l
index dd2d9a45ab59..dd2d9a45ab59 100644
--- a/transex3/source/cfglex.l
+++ b/l10ntools/source/cfglex.l
diff --git a/transex3/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx
index 0607c9e9bb06..5d85a4835843 100644
--- a/transex3/source/cfgmerge.cxx
+++ b/l10ntools/source/cfgmerge.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include <stdio.h>
#include <tools/string.hxx>
#include <tools/fsys.hxx>
diff --git a/transex3/source/directory.cxx b/l10ntools/source/directory.cxx
index ed0fe27d22c2..21d0a5878d66 100644
--- a/transex3/source/directory.cxx
+++ b/l10ntools/source/directory.cxx
@@ -30,8 +30,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
-#include <transex3/directory.hxx>
+#include "precompiled_l10ntools.hxx"
+#include <l10ntools/directory.hxx>
#include "tools/string.hxx"
#include <iostream>
#include <vector>
diff --git a/transex3/source/export.cxx b/l10ntools/source/export.cxx
index 5294d902d2ee..72826d7bf1f2 100644
--- a/transex3/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include <stdio.h>
#include <stdlib.h>
#include <tools/fsys.hxx>
diff --git a/transex3/source/export2.cxx b/l10ntools/source/export2.cxx
index 7815e80e033f..6132b01db644 100644
--- a/transex3/source/export2.cxx
+++ b/l10ntools/source/export2.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include "export.hxx"
#include "utf8conv.hxx"
#include <tools/datetime.hxx>
@@ -354,17 +354,18 @@ bool Export::CopyFile( const ByteString& source , const ByteString& dest )
const int BUFFERSIZE = 8192;
char buf[ BUFFERSIZE ];
- FILE* IN_FILE = fopen( source.GetBuffer() , "r" );
- FILE* OUT_FILE = fopen( dest.GetBuffer() , "w" );
-
+ FILE* IN_FILE = fopen( source.GetBuffer() , "r" );
if( IN_FILE == NULL )
{
cerr << "Export::CopyFile WARNING: Could not open " << source.GetBuffer() << "\n";
return false;
}
+
+ FILE* OUT_FILE = fopen( dest.GetBuffer() , "w" );
if( OUT_FILE == NULL )
{
cerr << "Export::CopyFile WARNING: Could not open/create " << dest.GetBuffer() << " for writing\n";
+ fclose( IN_FILE );
return false;
}
diff --git a/transex3/source/file.cxx b/l10ntools/source/file.cxx
index 4ea9ca55d574..43ce4c757d54 100644
--- a/transex3/source/file.cxx
+++ b/l10ntools/source/file.cxx
@@ -30,8 +30,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
-#include <transex3/file.hxx>
+#include "precompiled_l10ntools.hxx"
+#include <l10ntools/file.hxx>
namespace transex
{
diff --git a/transex3/source/filter/merge/FCFGMerge.cfg b/l10ntools/source/filter/merge/FCFGMerge.cfg
index 46fcccafe7e4..46fcccafe7e4 100644
--- a/transex3/source/filter/merge/FCFGMerge.cfg
+++ b/l10ntools/source/filter/merge/FCFGMerge.cfg
diff --git a/transex3/source/filter/merge/FCFGMerge.java b/l10ntools/source/filter/merge/FCFGMerge.java
index 7fbfa8a0c986..7fbfa8a0c986 100644
--- a/transex3/source/filter/merge/FCFGMerge.java
+++ b/l10ntools/source/filter/merge/FCFGMerge.java
diff --git a/transex3/source/filter/merge/Manifest.mf b/l10ntools/source/filter/merge/Manifest.mf
index 1337eaf4d39a..1337eaf4d39a 100644
--- a/transex3/source/filter/merge/Manifest.mf
+++ b/l10ntools/source/filter/merge/Manifest.mf
diff --git a/transex3/source/filter/merge/Merger.java b/l10ntools/source/filter/merge/Merger.java
index 0bf11fc42fbf..0bf11fc42fbf 100644
--- a/transex3/source/filter/merge/Merger.java
+++ b/l10ntools/source/filter/merge/Merger.java
diff --git a/transex3/source/filter/merge/makefile.mk b/l10ntools/source/filter/merge/makefile.mk
index bf768be851d8..510ec3202bb4 100644
--- a/transex3/source/filter/merge/makefile.mk
+++ b/l10ntools/source/filter/merge/makefile.mk
@@ -31,7 +31,7 @@
PRJ = ..$/..$/..
TARGET = FCFGMerge
-PRJNAME = filter
+PRJNAME = l10ntools
PACKAGE = com$/sun$/star$/filter$/config$/tools$/merge
# --- Settings -----------------------------------------------------
diff --git a/transex3/source/filter/utils/AnalyzeStartupLog.java b/l10ntools/source/filter/utils/AnalyzeStartupLog.java
index 498528850697..498528850697 100644
--- a/transex3/source/filter/utils/AnalyzeStartupLog.java
+++ b/l10ntools/source/filter/utils/AnalyzeStartupLog.java
diff --git a/transex3/source/filter/utils/Cache.java b/l10ntools/source/filter/utils/Cache.java
index 94c26008ed13..94c26008ed13 100644
--- a/transex3/source/filter/utils/Cache.java
+++ b/l10ntools/source/filter/utils/Cache.java
diff --git a/transex3/source/filter/utils/ConfigHelper.java b/l10ntools/source/filter/utils/ConfigHelper.java
index 78cc71cf65b2..78cc71cf65b2 100644
--- a/transex3/source/filter/utils/ConfigHelper.java
+++ b/l10ntools/source/filter/utils/ConfigHelper.java
diff --git a/transex3/source/filter/utils/FileHelper.java b/l10ntools/source/filter/utils/FileHelper.java
index 71f51cf36bf6..71f51cf36bf6 100644
--- a/transex3/source/filter/utils/FileHelper.java
+++ b/l10ntools/source/filter/utils/FileHelper.java
diff --git a/transex3/source/filter/utils/Logger.java b/l10ntools/source/filter/utils/Logger.java
index 7657eba5f426..7657eba5f426 100644
--- a/transex3/source/filter/utils/Logger.java
+++ b/l10ntools/source/filter/utils/Logger.java
diff --git a/transex3/source/filter/utils/MalformedCommandLineException.java b/l10ntools/source/filter/utils/MalformedCommandLineException.java
index e073dcb9adcc..e073dcb9adcc 100644
--- a/transex3/source/filter/utils/MalformedCommandLineException.java
+++ b/l10ntools/source/filter/utils/MalformedCommandLineException.java
diff --git a/transex3/source/filter/utils/XMLHelper.java b/l10ntools/source/filter/utils/XMLHelper.java
index 0f912cac8e25..0f912cac8e25 100644
--- a/transex3/source/filter/utils/XMLHelper.java
+++ b/l10ntools/source/filter/utils/XMLHelper.java
diff --git a/transex3/source/filter/utils/makefile.mk b/l10ntools/source/filter/utils/makefile.mk
index d41d8ba9a825..4025c54b2c38 100644
--- a/transex3/source/filter/utils/makefile.mk
+++ b/l10ntools/source/filter/utils/makefile.mk
@@ -31,7 +31,7 @@
PRJ = ..$/..$/..
TARGET = FCFGUtils
-PRJNAME = filter
+PRJNAME = l10ntools
PACKAGE = com$/sun$/star$/filter$/config$/tools$/utils
# --- Settings -----------------------------------------------------
diff --git a/transex3/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx
index 99183602f951..aa3b8157952d 100644
--- a/transex3/source/gsicheck.cxx
+++ b/l10ntools/source/gsicheck.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include <stdio.h>
#include <tools/fsys.hxx>
#include <tools/stream.hxx>
diff --git a/transex3/source/gsiconv.cxx b/l10ntools/source/gsiconv.cxx
index f6dea76ebb51..e127e55482da 100644
--- a/transex3/source/gsiconv.cxx
+++ b/l10ntools/source/gsiconv.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include <stdio.h>
#include <tools/fsys.hxx>
#include <tools/stream.hxx>
diff --git a/transex3/source/help/HelpCompiler.cxx b/l10ntools/source/help/HelpCompiler.cxx
index 5001d0907972..5001d0907972 100644
--- a/transex3/source/help/HelpCompiler.cxx
+++ b/l10ntools/source/help/HelpCompiler.cxx
diff --git a/transex3/source/help/HelpCompiler.hxx b/l10ntools/source/help/HelpCompiler.hxx
index 7ffb096bd635..7ffb096bd635 100644
--- a/transex3/source/help/HelpCompiler.hxx
+++ b/l10ntools/source/help/HelpCompiler.hxx
diff --git a/transex3/source/help/HelpFileDocument.java b/l10ntools/source/help/HelpFileDocument.java
index 2212db27f251..2212db27f251 100644
--- a/transex3/source/help/HelpFileDocument.java
+++ b/l10ntools/source/help/HelpFileDocument.java
diff --git a/transex3/source/help/HelpIndexerTool.java b/l10ntools/source/help/HelpIndexerTool.java
index 6bf22d1ac344..6bf22d1ac344 100644
--- a/transex3/source/help/HelpIndexerTool.java
+++ b/l10ntools/source/help/HelpIndexerTool.java
diff --git a/transex3/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx
index 7dfe4ee4a2a2..7dfe4ee4a2a2 100644
--- a/transex3/source/help/HelpLinker.cxx
+++ b/l10ntools/source/help/HelpLinker.cxx
diff --git a/transex3/source/help/compilehelp.hxx b/l10ntools/source/help/compilehelp.hxx
index d123d628be27..d123d628be27 100644
--- a/transex3/source/help/compilehelp.hxx
+++ b/l10ntools/source/help/compilehelp.hxx
diff --git a/transex3/source/help/helplinker.pmk b/l10ntools/source/help/helplinker.pmk
index 569c5f4dbdee..569c5f4dbdee 100644
--- a/transex3/source/help/helplinker.pmk
+++ b/l10ntools/source/help/helplinker.pmk
diff --git a/transex3/source/help/makefile.mk b/l10ntools/source/help/makefile.mk
index 6fc823a1b59a..57164004af8b 100644
--- a/transex3/source/help/makefile.mk
+++ b/l10ntools/source/help/makefile.mk
@@ -30,7 +30,7 @@
#*************************************************************************
PRJ = ..$/..
-PRJNAME = xmlhelp
+PRJNAME = l10ntools
TARGET = HelpLinker
LIBBASENAME = helplinker
PACKAGE = com$/sun$/star$/help
diff --git a/transex3/source/helpex.cxx b/l10ntools/source/helpex.cxx
index f4a1589b530e..8f0b6c1d218f 100644
--- a/transex3/source/helpex.cxx
+++ b/l10ntools/source/helpex.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include <stdio.h>
#include <stdlib.h>
diff --git a/transex3/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx
index 8aafc692f14c..84d73e94f312 100644
--- a/transex3/source/helpmerge.cxx
+++ b/l10ntools/source/helpmerge.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include <tools/fsys.hxx>
#include <osl/file.hxx>
// local includes
diff --git a/transex3/source/inireader.cxx b/l10ntools/source/inireader.cxx
index 0985e788452d..63f902a5a1da 100644
--- a/transex3/source/inireader.cxx
+++ b/l10ntools/source/inireader.cxx
@@ -120,7 +120,7 @@ void INIreader::toStlString( const UnicodeString& str , string& stl_str)
char* buffer = new char[ str.length()*3 ];
str.extract( 0 , str.length() , buffer );
stl_str = string( buffer );
- delete buffer;
+ delete [] buffer;
}
void INIreader::trim( string& str )
diff --git a/transex3/source/lngex.cxx b/l10ntools/source/lngex.cxx
index 53c97de6e045..67ee34cbdaab 100644
--- a/transex3/source/lngex.cxx
+++ b/l10ntools/source/lngex.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include <stdio.h>
// local includes
diff --git a/transex3/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index e55fdc83ce37..fcad498128c2 100644
--- a/transex3/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include <tools/fsys.hxx>
// local includes
diff --git a/transex3/source/localize.cxx b/l10ntools/source/localize.cxx
index c82d152cac7e..b617fdb4cf1e 100644
--- a/transex3/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include "srciter.hxx"
#include "export.hxx"
@@ -41,9 +41,9 @@
#include "tools/errcode.hxx"
#include "tools/fsys.hxx"
-#ifndef TRANSEX_FILE_HXX
-#define TRANSEX_FILE_HXX
-#include <transex3/file.hxx>
+#ifndef L10NTOOLS_FILE_HXX
+#define L10NTOOLS_FILE_HXX
+#include <l10ntools/file.hxx>
#endif
namespace transex3
@@ -938,10 +938,25 @@ int _cdecl main( int argc, char *argv[] )
bool hasPwd = treeconfig.getActiveRepositories( repos );
if( hasPwd ) cout << "Found special path!\n";
+ string minor_ext;
+ bool has_minor_ext;
+
+ if( Export::GetEnv("UPDMINOREXT") != NULL )
+ {
+ minor_ext = string( Export::GetEnv("UPDMINOREXT") );
+ has_minor_ext = minor_ext.size();
+ }
+ else
+ has_minor_ext = false;
+
// localize through all repositories
for( vector<string>::iterator iter = repos.begin(); iter != repos.end() ; ++iter )
{
- string curRepository = string( Export::GetEnv("SOURCE_ROOT_DIR") ) + "/" + *iter;
+ string curRepository;
+ if( has_minor_ext )
+ curRepository = string( Export::GetEnv("SOURCE_ROOT_DIR") ) + "/" + *iter + minor_ext;
+ else
+ curRepository = string( Export::GetEnv("SOURCE_ROOT_DIR") ) + "/" + *iter;
cout << "Localizing repository " << curRepository << "\n";
SourceTreeLocalizer aIter( ByteString( curRepository.c_str() ) , sVersion , (sOutput.Len() > 0) , bQuiet2 , bSkipLinks );
aIter.SetLanguageRestriction( sLanguages );
diff --git a/transex3/source/makefile.mk b/l10ntools/source/makefile.mk
index a557b210aad0..fe4ecc919179 100644
--- a/transex3/source/makefile.mk
+++ b/l10ntools/source/makefile.mk
@@ -33,7 +33,7 @@ PRJ=..
INCPRE=$(MISC)
-PRJNAME=transex3
+PRJNAME=l10ntools
TARGET=transex
TARGETTYPE=CUI
LIBTARGET=no
diff --git a/transex3/source/merge.cxx b/l10ntools/source/merge.cxx
index ee0f6f459655..42f539065651 100644
--- a/transex3/source/merge.cxx
+++ b/l10ntools/source/merge.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include <stdio.h>
#include <tools/fsys.hxx>
#include "export.hxx"
diff --git a/transex3/source/src_yy_wrapper.c b/l10ntools/source/src_yy_wrapper.c
index d326b9a94e86..d326b9a94e86 100644
--- a/transex3/source/src_yy_wrapper.c
+++ b/l10ntools/source/src_yy_wrapper.c
diff --git a/transex3/source/srciter.cxx b/l10ntools/source/srciter.cxx
index d2cbb2352570..cf04de4bf3fa 100644
--- a/transex3/source/srciter.cxx
+++ b/l10ntools/source/srciter.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include "srciter.hxx"
#include <stdio.h>
diff --git a/transex3/source/srclex.l b/l10ntools/source/srclex.l
index fef251e47224..fef251e47224 100644
--- a/transex3/source/srclex.l
+++ b/l10ntools/source/srclex.l
diff --git a/transex3/source/tagtest.cxx b/l10ntools/source/tagtest.cxx
index 89c1ecf15488..7896915ede0c 100644
--- a/transex3/source/tagtest.cxx
+++ b/l10ntools/source/tagtest.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include <tools/string.hxx>
#include "tagtest.hxx"
diff --git a/transex3/source/treeconfig.cxx b/l10ntools/source/treeconfig.cxx
index 137492c39a50..137492c39a50 100644
--- a/transex3/source/treeconfig.cxx
+++ b/l10ntools/source/treeconfig.cxx
diff --git a/transex3/source/utf8conv.cxx b/l10ntools/source/utf8conv.cxx
index 8fc61f9bb5cc..ee35eb56befd 100644
--- a/transex3/source/utf8conv.cxx
+++ b/l10ntools/source/utf8conv.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include "utf8conv.hxx"
//
diff --git a/transex3/source/wrdtrans.cxx b/l10ntools/source/wrdtrans.cxx
index 71866cd0e618..c4a9d6ea5570 100644
--- a/transex3/source/wrdtrans.cxx
+++ b/l10ntools/source/wrdtrans.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
/*
#include "wrdtrans.hxx"
diff --git a/transex3/source/wtranode.cxx b/l10ntools/source/wtranode.cxx
index 0383ffa7feac..401c0b20fe1a 100644
--- a/transex3/source/wtranode.cxx
+++ b/l10ntools/source/wtranode.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include "wtranode.hxx"
diff --git a/transex3/source/wtratree.cxx b/l10ntools/source/wtratree.cxx
index fea67215ba51..dbf02a6f22be 100644
--- a/transex3/source/wtratree.cxx
+++ b/l10ntools/source/wtratree.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include "wtratree.hxx"
diff --git a/transex3/source/xgfconv.cxx b/l10ntools/source/xgfconv.cxx
index 76ea1a2906a8..54b92fb3c1c2 100644
--- a/transex3/source/xgfconv.cxx
+++ b/l10ntools/source/xgfconv.cxx
@@ -6,7 +6,7 @@
/*****************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#if defined(UNX) || defined(OS2)
int main( int argc, char *argv[] )
#else
diff --git a/transex3/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx
index 921f1d329f67..f75a0afe9792 100644
--- a/transex3/source/xmlparse.cxx
+++ b/l10ntools/source/xmlparse.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include <iterator> /* std::iterator*/
#include <stdio.h>
diff --git a/transex3/source/xrm_yy_wrapper.c b/l10ntools/source/xrm_yy_wrapper.c
index 6a304d0d09dc..6a304d0d09dc 100644
--- a/transex3/source/xrm_yy_wrapper.c
+++ b/l10ntools/source/xrm_yy_wrapper.c
diff --git a/transex3/source/xrmlex.l b/l10ntools/source/xrmlex.l
index efc8bf1f7d91..efc8bf1f7d91 100644
--- a/transex3/source/xrmlex.l
+++ b/l10ntools/source/xrmlex.l
diff --git a/transex3/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index f1b3d4d6cb5a..3eadd202ef5c 100644
--- a/transex3/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -29,7 +29,7 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
+#include "precompiled_l10ntools.hxx"
#include <stdio.h>
#include <tools/string.hxx>
#include <tools/fsys.hxx>
diff --git a/transex3/workbench/gsicheck_errors.sdf b/l10ntools/workbench/gsicheck_errors.sdf
index 04dde12e13ca..04dde12e13ca 100644
--- a/transex3/workbench/gsicheck_errors.sdf
+++ b/l10ntools/workbench/gsicheck_errors.sdf
diff --git a/transex3/workbench/gsicheck_errors_err-.sdf b/l10ntools/workbench/gsicheck_errors_err-.sdf
index f6b267b1c55b..f6b267b1c55b 100644
--- a/transex3/workbench/gsicheck_errors_err-.sdf
+++ b/l10ntools/workbench/gsicheck_errors_err-.sdf
diff --git a/transex3/workbench/gsicheck_errors_err-l.sdf b/l10ntools/workbench/gsicheck_errors_err-l.sdf
index 6ca7f7065cd2..6ca7f7065cd2 100644
--- a/transex3/workbench/gsicheck_errors_err-l.sdf
+++ b/l10ntools/workbench/gsicheck_errors_err-l.sdf
diff --git a/transex3/workbench/gsicheck_errors_err-s.sdf b/l10ntools/workbench/gsicheck_errors_err-s.sdf
index 523017fcfb35..523017fcfb35 100644
--- a/transex3/workbench/gsicheck_errors_err-s.sdf
+++ b/l10ntools/workbench/gsicheck_errors_err-s.sdf
diff --git a/transex3/workbench/gsicheck_errors_err-t.sdf b/l10ntools/workbench/gsicheck_errors_err-t.sdf
index e9594642113c..e9594642113c 100644
--- a/transex3/workbench/gsicheck_errors_err-t.sdf
+++ b/l10ntools/workbench/gsicheck_errors_err-t.sdf
diff --git a/transex3/workbench/gsicheck_errors_ok-.sdf b/l10ntools/workbench/gsicheck_errors_ok-.sdf
index 4bb4b7bece16..4bb4b7bece16 100644
--- a/transex3/workbench/gsicheck_errors_ok-.sdf
+++ b/l10ntools/workbench/gsicheck_errors_ok-.sdf
diff --git a/transex3/workbench/gsicheck_errors_ok-l.sdf b/l10ntools/workbench/gsicheck_errors_ok-l.sdf
index 9a55e7c95dd3..9a55e7c95dd3 100644
--- a/transex3/workbench/gsicheck_errors_ok-l.sdf
+++ b/l10ntools/workbench/gsicheck_errors_ok-l.sdf
diff --git a/transex3/workbench/gsicheck_errors_ok-s.sdf b/l10ntools/workbench/gsicheck_errors_ok-s.sdf
index 97dd4da6a54b..97dd4da6a54b 100644
--- a/transex3/workbench/gsicheck_errors_ok-s.sdf
+++ b/l10ntools/workbench/gsicheck_errors_ok-s.sdf
diff --git a/transex3/workbench/gsicheck_errors_ok-t.sdf b/l10ntools/workbench/gsicheck_errors_ok-t.sdf
index a6c097e6bd2f..a6c097e6bd2f 100644
--- a/transex3/workbench/gsicheck_errors_ok-t.sdf
+++ b/l10ntools/workbench/gsicheck_errors_ok-t.sdf
diff --git a/transex3/workbench/gsicheckcheck.btm b/l10ntools/workbench/gsicheckcheck.btm
index de71b17da332..de71b17da332 100644
--- a/transex3/workbench/gsicheckcheck.btm
+++ b/l10ntools/workbench/gsicheckcheck.btm
diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx
index f73427526be6..5a6a1d0e319e 100644
--- a/padmin/source/padialog.cxx
+++ b/padmin/source/padialog.cxx
@@ -60,11 +60,16 @@
#include "unotools/localedatawrapper.hxx"
#include "unotools/configitem.hxx"
#include "unotools/configmgr.hxx"
+
+#include "com/sun/star/awt/Size.hpp"
+
using namespace psp;
using namespace rtl;
using namespace padmin;
using namespace osl;
+using namespace com::sun::star;
using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
PADialog* PADialog::Create( Window* pParent, BOOL bAdmin )
{
@@ -96,7 +101,6 @@ PADialog::PADialog( Window* pParent, BOOL /*bAdmin*/ ) :
m_aCancelButton( this, PaResId( RID_PA_BTN_CANCEL ) ),
m_aDefPrt( PaResId( RID_PA_STR_DEFPRT ) ),
m_aRenameStr( PaResId( RID_PA_STR_RENAME ) ),
- m_pPrinter( 0 ),
m_rPIManager( PrinterInfoManager::get() )
{
FreeResource();
@@ -248,18 +252,6 @@ IMPL_LINK( PADialog, SelectHdl, ListBox*, pListBox )
return 0;
}
-IMPL_LINK( PADialog, EndPrintHdl, void*, EMPTYARG )
-{
- String aInfoString( PaResId( RID_PA_TXT_TESTPAGE_PRINTED ) );
- InfoBox aInfoBox( this, aInfoString );
- aInfoBox.SetText( String( PaResId( RID_BXT_TESTPAGE ) ) );
- aInfoBox.Execute();
-
- delete m_pPrinter;
- m_pPrinter = NULL;
- return 0;
-}
-
void PADialog::UpdateDefPrt()
{
m_rPIManager.setDefaultPrinter( getSelectedDevice() );
@@ -369,66 +361,77 @@ static Color approachColor( const Color& rFrom, const Color& rTo )
return aColor;
}
-#define DELTA 5.0
-void PADialog::PrintTestPage()
+class SpaPrinterController : public vcl::PrinterController
{
- if( m_pPrinter ) // already printing; user pressed button twice
- return;
+public:
+ SpaPrinterController( const boost::shared_ptr<Printer>& i_pPrinter )
+ : vcl::PrinterController( i_pPrinter )
+ {}
+ virtual ~SpaPrinterController()
+ {}
+
+ virtual int getPageCount() const { return 1; }
+ virtual Sequence< PropertyValue > getPageParameters( int i_nPage ) const;
+ virtual void printPage( int i_nPage ) const;
+ virtual void jobFinished( com::sun::star::view::PrintableState );
+};
+
+Sequence< PropertyValue > SpaPrinterController::getPageParameters( int ) const
+{
+ Sequence< PropertyValue > aRet( 1 );
- String sPrinter( getSelectedDevice() );
+ Size aPageSize( getPrinter()->GetPaperSizePixel() );
+ aPageSize = getPrinter()->PixelToLogic( aPageSize, MapMode( MAP_100TH_MM ) );
+
+ awt::Size aSize;
+ aSize.Width = aPageSize.Width();
+ aSize.Height = aPageSize.Height();
+ aRet[0].Value = makeAny(aSize);
- m_pPrinter = new Printer( sPrinter );
+ return aRet;
+}
- PrinterInfo aInfo( m_rPIManager.getPrinterInfo( sPrinter ) );
+void SpaPrinterController::printPage( int ) const
+{
+ const double DELTA = 5.0;
+
+ boost::shared_ptr<Printer> pPrinter( getPrinter() );
+
+ PrinterInfo aInfo( psp::PrinterInfoManager::get().getPrinterInfo( pPrinter->GetName() ) );
const PPDParser* pPrintParser = aInfo.m_pParser;
MapMode aMapMode( MAP_100TH_MM );
Bitmap aButterfly( PaResId( RID_BUTTERFLY ) );
- m_pPrinter->SetMapMode( aMapMode );
- m_pPrinter->SetEndPrintHdl( LINK( this, PADialog, EndPrintHdl ) );
+ pPrinter->SetMapMode( aMapMode );
Any aRet = utl::ConfigManager::GetDirectConfigProperty( utl::ConfigManager::PRODUCTNAME );
OUString aJobName;
aRet >>= aJobName;
aJobName = aJobName + OUString( RTL_CONSTASCII_USTRINGPARAM( " Testpage" ) );
- if( m_pPrinter->GetName() != sPrinter || ! m_pPrinter->StartJob( aJobName ) )
- {
- String aString( PaResId( RID_ERR_NOPRINTER ) );
- aString.SearchAndReplaceAscii( "%s", sPrinter );
- ErrorBox aErrorBox( this, WB_OK | WB_DEF_OK, aString );
- aErrorBox.SetText( String( PaResId( RID_BXT_ENVIRONMENT ) ) );
- aErrorBox.Execute();
- delete m_pPrinter;
- m_pPrinter = 0;
- return;
- }
- m_pPrinter->StartPage();
-
- Size aPaperSize=m_pPrinter->GetOutputSize();
+ Size aPaperSize=pPrinter->GetOutputSize();
Point aCenter( aPaperSize.Width()/2-300,
aPaperSize.Height() - aPaperSize.Width()/2 );
Point aP1( aPaperSize.Width()/48, 0), aP2( aPaperSize.Width()/40, 0 ), aPoint;
- m_pPrinter->DrawRect( Rectangle( Point( 0,0 ), aPaperSize ) );
- m_pPrinter->DrawRect( Rectangle( Point( 100,100 ),
+ pPrinter->DrawRect( Rectangle( Point( 0,0 ), aPaperSize ) );
+ pPrinter->DrawRect( Rectangle( Point( 100,100 ),
Size( aPaperSize.Width()-200,
aPaperSize.Height()-200 ) ) );
- m_pPrinter->DrawRect( Rectangle( Point( 200,200 ),
+ pPrinter->DrawRect( Rectangle( Point( 200,200 ),
Size( aPaperSize.Width()-400,
aPaperSize.Height()-400 ) ) );
- m_pPrinter->DrawRect( Rectangle( Point( 300,300 ),
+ pPrinter->DrawRect( Rectangle( Point( 300,300 ),
Size( aPaperSize.Width()-600,
aPaperSize.Height()-600 ) ) );
- Font aFont( m_pPrinter->GetFont() );
- aFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Courier" ) ) );
+ Font aFont( String( RTL_CONSTASCII_USTRINGPARAM( "Courier" ) ), Size( 0, 400 ) );
aFont.SetWeight( WEIGHT_NORMAL );
aFont.SetItalic( ITALIC_NONE );
- m_pPrinter->SetFont( aFont );
+ pPrinter->SetFont( aFont );
OUStringBuffer aPrintText(1024);
long nWidth = 0, nMaxWidth = 0;
@@ -455,12 +458,12 @@ void PADialog::PrintTestPage()
aToken = String::CreateFromAscii( aResIds[i].pDirect );
else
aToken = String( PaResId( aResIds[i].nResId ) );
- nMaxWidth = ( nWidth = m_pPrinter->GetTextWidth( aToken ) ) > nMaxWidth ? nWidth : nMaxWidth;
+ nMaxWidth = ( nWidth = pPrinter->GetTextWidth( aToken ) ) > nMaxWidth ? nWidth : nMaxWidth;
aPrintText.append( aToken );
aPrintText.append( (sal_Unicode)'\n' );
};
- m_pPrinter->DrawText( Rectangle( Point( 1000, 2000 ),
+ pPrinter->DrawText( Rectangle( Point( 1000, 1000 ),
Size( aPaperSize.Width() - 2000,
aPaperSize.Height() - 4000 ) ),
aPrintText.makeStringAndClear(),
@@ -470,7 +473,7 @@ void PADialog::PrintTestPage()
const LocaleDataWrapper& rLocaleWrapper( aSettings.GetLocaleDataWrapper() );
aPrintText.appendAscii( ": " );
- aPrintText.append( sPrinter );
+ aPrintText.append( pPrinter->GetName() );
aPrintText.appendAscii( "\n: " );
if( pPrintParser )
aPrintText.append( pPrintParser->getPrinterName() );
@@ -487,17 +490,17 @@ void PADialog::PrintTestPage()
aPrintText.appendAscii( "\n: " );
aPrintText.append( rLocaleWrapper.getTime( Time() ) );
- m_pPrinter->DrawText( Rectangle( Point( 1100 + nMaxWidth, 2000 ),
+ pPrinter->DrawText( Rectangle( Point( 1100 + nMaxWidth, 1000 ),
Size( aPaperSize.Width() - 2100 - nMaxWidth,
aPaperSize.Height() - 4000 ) ),
aPrintText.makeStringAndClear(),
TEXT_DRAW_MULTILINE );
- m_pPrinter->DrawBitmap( Point( aPaperSize.Width() - 4000, 1000 ),
+ pPrinter->DrawBitmap( Point( aPaperSize.Width() - 4000, 1000 ),
Size( 3000,3000 ),
aButterfly );
- m_pPrinter->SetFillColor();
- m_pPrinter->DrawRect( Rectangle( Point( aPaperSize.Width() - 4000, 1000 ),
+ pPrinter->SetFillColor();
+ pPrinter->DrawRect( Rectangle( Point( aPaperSize.Width() - 4000, 1000 ),
Size( 3000,3000 ) ) );
Color aWhite( 0xff, 0xff, 0xff );
@@ -511,22 +514,22 @@ void PADialog::PrintTestPage()
Gradient aGradient( GRADIENT_LINEAR, aBlack, aWhite );
aGradient.SetAngle( 900 );
- m_pPrinter->DrawGradient( Rectangle( Point( 1000, 5500 ),
+ pPrinter->DrawGradient( Rectangle( Point( 1000, 5500 ),
Size( aPaperSize.Width() - 2000,
500 ) ), aGradient );
aGradient.SetStartColor( aDarkRed );
aGradient.SetEndColor( aLightBlue );
- m_pPrinter->DrawGradient( Rectangle( Point( 1000, 6300 ),
+ pPrinter->DrawGradient( Rectangle( Point( 1000, 6300 ),
Size( aPaperSize.Width() - 2000,
500 ) ), aGradient );
aGradient.SetStartColor( aDarkBlue );
aGradient.SetEndColor( aLightGreen );
- m_pPrinter->DrawGradient( Rectangle( Point( 1000, 7100 ),
+ pPrinter->DrawGradient( Rectangle( Point( 1000, 7100 ),
Size( aPaperSize.Width() - 2000,
500 ) ), aGradient );
aGradient.SetStartColor( aDarkGreen );
aGradient.SetEndColor( aLightRed );
- m_pPrinter->DrawGradient( Rectangle( Point( 1000, 7900 ),
+ pPrinter->DrawGradient( Rectangle( Point( 1000, 7900 ),
Size( aPaperSize.Width() - 2000,
500 ) ), aGradient );
@@ -543,7 +546,7 @@ void PADialog::PrintTestPage()
{
aLineInfo.SetWidth( n/3 );
aLineColor = approachColor( aLineColor, aApproachColor );
- m_pPrinter->SetLineColor( aLineColor );
+ pPrinter->SetLineColor( aLineColor );
// switch aproach color
if( aApproachColor.IsRGBEqual( aLineColor ) )
@@ -556,7 +559,7 @@ void PADialog::PrintTestPage()
aApproachColor = Color( 0, 200, 0 );
}
- m_pPrinter->DrawLine( project( aP1 ) + aCenter,
+ pPrinter->DrawLine( project( aP1 ) + aCenter,
project( aP2 ) + aCenter,
aLineInfo );
aPoint.X() = (int)((((double)aP1.X())*cosd - ((double)aP1.Y())*sind)*factor);
@@ -569,8 +572,38 @@ void PADialog::PrintTestPage()
#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL
fprintf( stderr, "%d lines\n",n );
#endif
- m_pPrinter->EndPage();
- m_pPrinter->EndJob();
+}
+
+void SpaPrinterController::jobFinished( com::sun::star::view::PrintableState )
+{
+ String aInfoString( PaResId( RID_PA_TXT_TESTPAGE_PRINTED ) );
+ InfoBox aInfoBox( NULL, aInfoString );
+ aInfoBox.SetText( String( PaResId( RID_BXT_TESTPAGE ) ) );
+ aInfoBox.Execute();
+}
+
+void PADialog::PrintTestPage()
+{
+ String sPrinter( getSelectedDevice() );
+
+ boost::shared_ptr<Printer> pPrinter( new Printer( sPrinter ) );
+
+ if( pPrinter->GetName() != sPrinter )
+ {
+ String aString( PaResId( RID_ERR_NOPRINTER ) );
+ aString.SearchAndReplaceAscii( "%s", sPrinter );
+
+ ErrorBox aErrorBox( this, WB_OK | WB_DEF_OK, aString );
+ aErrorBox.SetText( String( PaResId( RID_BXT_ENVIRONMENT ) ) );
+ aErrorBox.Execute();
+ return;
+ }
+
+ boost::shared_ptr<vcl::PrinterController> pController( new SpaPrinterController( pPrinter ) );
+ JobSetup aJobSetup( pPrinter->GetJobSetup() );
+ aJobSetup.SetValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ),
+ String( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) );
+ Printer::PrintJob( pController, aJobSetup );
}
void PADialog::AddDevice()
diff --git a/padmin/source/padialog.hxx b/padmin/source/padialog.hxx
index ac6ee8f4279f..0350f66a2905 100644
--- a/padmin/source/padialog.hxx
+++ b/padmin/source/padialog.hxx
@@ -83,7 +83,6 @@ namespace padmin {
String m_aDefPrt;
String m_aRenameStr;
- Printer* m_pPrinter;
::psp::PrinterInfoManager& m_rPIManager;
::std::list< ::rtl::OUString > m_aPrinters;
@@ -94,7 +93,6 @@ namespace padmin {
DECL_LINK( ClickBtnHdl, PushButton* );
DECL_LINK( DoubleClickHdl, ListBox* );
DECL_LINK( SelectHdl, ListBox* );
- DECL_LINK( EndPrintHdl, void* );
DECL_LINK( DelPressedHdl, ListBox* );
PADialog( Window*, BOOL );
diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx
index 6cf4f8b257b1..69217e2d0063 100644
--- a/padmin/source/prtsetup.cxx
+++ b/padmin/source/prtsetup.cxx
@@ -44,9 +44,9 @@ using namespace rtl;
using namespace psp;
using namespace padmin;
-void RTSDialog::insertAllPPDValues( ListBox& rBox, const PPDKey* pKey )
+void RTSDialog::insertAllPPDValues( ListBox& rBox, const PPDParser* pParser, const PPDKey* pKey )
{
- if( ! pKey )
+ if( ! pKey || ! pParser )
return;
const PPDValue* pValue = NULL;
@@ -56,7 +56,7 @@ void RTSDialog::insertAllPPDValues( ListBox& rBox, const PPDKey* pKey )
for( int i = 0; i < pKey->countValues(); i++ )
{
pValue = pKey->getValue( i );
- aOptionText = pValue->m_aOptionTranslation.Len() ? pValue->m_aOptionTranslation : pValue->m_aOption;
+ aOptionText = pParser->translateOption( pKey->getKey(), pValue->m_aOption) ;
if( m_aJobData.m_aContext.checkConstraints( pKey, pValue ) )
{
@@ -282,7 +282,7 @@ void RTSPaperPage::update()
if( m_pParent->m_aJobData.m_pParser &&
(pKey = m_pParent->m_aJobData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) )) )
{
- m_pParent->insertAllPPDValues( m_aDuplexBox, pKey );
+ m_pParent->insertAllPPDValues( m_aDuplexBox, m_pParent->m_aJobData.m_pParser, pKey );
}
else
{
@@ -294,7 +294,7 @@ void RTSPaperPage::update()
if( m_pParent->m_aJobData.m_pParser &&
(pKey = m_pParent->m_aJobData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) )) )
{
- m_pParent->insertAllPPDValues( m_aPaperBox, pKey );
+ m_pParent->insertAllPPDValues( m_aPaperBox, m_pParent->m_aJobData.m_pParser, pKey );
}
else
{
@@ -306,7 +306,7 @@ void RTSPaperPage::update()
if( m_pParent->m_aJobData.m_pParser &&
(pKey = m_pParent->m_aJobData.m_pParser->getKey( String::CreateFromAscii( "InputSlot" ) )) )
{
- m_pParent->insertAllPPDValues( m_aSlotBox, pKey );
+ m_pParent->insertAllPPDValues( m_aSlotBox, m_pParent->m_aJobData.m_pParser, pKey );
}
else
{
@@ -411,8 +411,8 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent ) :
! pKey->getKey().EqualsAscii( "Duplex" )
)
{
- USHORT nPos =
- m_aPPDKeyBox.InsertEntry( pKey->getUITranslation().Len() ? pKey->getUITranslation() : pKey->getKey() );
+ String aEntry( m_pParent->m_aJobData.m_pParser->translateKey( pKey->getKey() ) );
+ USHORT nPos = m_aPPDKeyBox.InsertEntry( aEntry );
m_aPPDKeyBox.SetEntryData( nPos, (void*)pKey );
}
}
@@ -466,10 +466,11 @@ void RTSDevicePage::FillValueBox( const PPDKey* pKey )
for( int i = 0; i < pKey->countValues(); i++ )
{
pValue = pKey->getValue( i );
- if( m_pParent->m_aJobData.m_aContext.checkConstraints( pKey, pValue ) )
+ if( m_pParent->m_aJobData.m_aContext.checkConstraints( pKey, pValue ) &&
+ m_pParent->m_aJobData.m_pParser )
{
- USHORT nPos =
- m_aPPDValueBox.InsertEntry( pValue->m_aOptionTranslation.Len() ? pValue->m_aOptionTranslation : pValue->m_aOption );
+ String aEntry( m_pParent->m_aJobData.m_pParser->translateOption( pKey->getKey(), pValue->m_aOption ) );
+ USHORT nPos = m_aPPDValueBox.InsertEntry( aEntry );
m_aPPDValueBox.SetEntryData( nPos, (void*)pValue );
}
}
diff --git a/padmin/source/prtsetup.hxx b/padmin/source/prtsetup.hxx
index 8487daa158da..1e296fa9ed88 100644
--- a/padmin/source/prtsetup.hxx
+++ b/padmin/source/prtsetup.hxx
@@ -85,7 +85,7 @@ class RTSDialog : public TabDialog
DECL_LINK( ClickButton, Button* );
// helper functions
- void insertAllPPDValues( ListBox&, const ::psp::PPDKey* );
+ void insertAllPPDValues( ListBox&, const psp::PPDParser*, const psp::PPDKey* );
public:
RTSDialog( const ::psp::PrinterInfo& rJobData, const String& rPrinter, bool bAllPages, Window* pParent = NULL );
~RTSDialog();
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
index 9ae58087a335..e59a1e056f4b 100644
--- a/rsc/source/parser/rscicpx.cxx
+++ b/rsc/source/parser/rscicpx.cxx
@@ -2281,6 +2281,7 @@ RscTop * RscTypCont::InitClassTabControl( RscTop * pSuper,
RSC_TABCONTROL_ITEMLIST );
INS_WINBIT( pClassTabControl, SingleLine );
+ INS_WINBIT( pClassTabControl, DropDown );
}
return pClassTabControl;
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 46ae3529439c..0e20af6118af 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -1104,7 +1104,7 @@ StgTmpStrm::~StgTmpStrm()
}
}
-ULONG StgTmpStrm::GetSize()
+ULONG StgTmpStrm::GetSize() const
{
ULONG n;
if( pStrm )
diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx
index 806d562af6d0..fd7971da3aba 100644
--- a/sot/source/sdstor/stgstrms.hxx
+++ b/sot/source/sdstor/stgstrms.hxx
@@ -167,8 +167,7 @@ public:
~StgTmpStrm();
BOOL Copy( StgTmpStrm& );
void SetSize( ULONG );
- using SvMemoryStream::GetSize;
- ULONG GetSize();
+ ULONG GetSize() const;
};
#endif
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index d7e797c681f3..274f7d4a4c1a 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -43,21 +43,17 @@
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
#include <com/sun/star/ucb/ResultSetException.hpp>
#include <com/sun/star/uno/Sequence.h>
-#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HDL_
#include <com/sun/star/sdbc/XResultSet.hdl>
-#endif
#include <com/sun/star/ucb/XContentAccess.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
#include <com/sun/star/datatransfer/DataFlavor.hpp>
-#include <com/sun/star/ucb/XContentCreator.hpp>
+#include <com/sun/star/ucb/ContentInfo.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/packages/manifest/XManifestWriter.hpp>
#include <com/sun/star/packages/manifest/XManifestReader.hpp>
-#ifndef _COM_SUN_STAR_UCB_INTERACTIVEIODEXCEPTION_HPP_
#include <com/sun/star/ucb/InteractiveIOException.hpp>
-#endif
#include <rtl/digest.h>
#include <tools/ref.hxx>
@@ -113,11 +109,11 @@ public:
virtual void SAL_CALL seek( sal_Int64 _nLocation ) throw ( IllegalArgumentException, IOException, RuntimeException);
virtual sal_Int64 SAL_CALL getPosition( ) throw ( IOException, RuntimeException);
virtual sal_Int64 SAL_CALL getLength( ) throw ( IOException, RuntimeException);
- virtual sal_Int32 SAL_CALL readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) throw( NotConnectedException, BufferSizeExceededException, RuntimeException );
- virtual sal_Int32 SAL_CALL readSomeBytes( Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw( NotConnectedException, BufferSizeExceededException, RuntimeException );
- virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) throw( NotConnectedException, BufferSizeExceededException, RuntimeException);
- virtual sal_Int32 SAL_CALL available() throw( NotConnectedException, RuntimeException );
- virtual void SAL_CALL closeInput() throw( NotConnectedException, RuntimeException );
+ virtual sal_Int32 SAL_CALL readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) throw( NotConnectedException, BufferSizeExceededException, RuntimeException );
+ virtual sal_Int32 SAL_CALL readSomeBytes( Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw( NotConnectedException, BufferSizeExceededException, RuntimeException );
+ virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) throw( NotConnectedException, BufferSizeExceededException, RuntimeException);
+ virtual sal_Int32 SAL_CALL available() throw( NotConnectedException, RuntimeException );
+ virtual void SAL_CALL closeInput() throw( NotConnectedException, RuntimeException );
protected:
void checkConnected();
@@ -540,7 +536,7 @@ public:
// this means that the root storage does an autocommit when its external
// reference is destroyed
BOOL m_bIsRoot; // marks this storage as root storages that manages all oommits and reverts
- BOOL m_bDirty; // ???
+ BOOL m_bDirty; // ???
BOOL m_bIsLinked;
BOOL m_bListCreated;
ULONG m_nFormat;
@@ -575,12 +571,12 @@ public:
ReadContent();
if ( m_nMode & STREAM_WRITE )
{
- m_nError = nError;
- if ( m_pAntiImpl )
- {
- m_pAntiImpl->ResetError();
- m_pAntiImpl->SetError( nError );
- }
+ m_nError = nError;
+ if ( m_pAntiImpl )
+ {
+ m_pAntiImpl->ResetError();
+ m_pAntiImpl->SetError( nError );
+ }
}
return m_aChildrenList;
@@ -867,7 +863,7 @@ BOOL UCBStorageStream_Impl::Init()
// usually means that stream could not be opened
}
- if( m_rSource.is() )
+ if( m_rSource.is() )
{
m_pStream->Seek( STREAM_SEEK_TO_END );
@@ -894,7 +890,7 @@ BOOL UCBStorageStream_Impl::Init()
{
// if the new file is edited than no source exist
m_bSourceRead = FALSE;
- //SetError( SVSTREAM_CANNOT_MAKE );
+ //SetError( SVSTREAM_CANNOT_MAKE );
}
}
@@ -1107,7 +1103,7 @@ ULONG UCBStorageStream_Impl::SeekPos( ULONG nPos )
else
{
// the temp stream pointer points to the end now
- aResult = m_pStream->Tell();
+ aResult = m_pStream->Tell();
if( aResult < nPos )
{
@@ -1886,7 +1882,7 @@ void UCBStorage_Impl::Init()
{
if ( !pStream->GetError() )
{
- ::utl::OInputStreamWrapper* pHelper = new ::utl::OInputStreamWrapper( *pStream );
+ ::utl::OInputStreamWrapper* pHelper = new ::utl::OInputStreamWrapper( *pStream );
com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xInputStream( pHelper );
// create a manifest reader object that will read in the manifest from the stream
@@ -2042,8 +2038,8 @@ void UCBStorage_Impl::ReadContent()
if ( m_bRepairPackage )
{
xComEnv = new ::ucbhelper::CommandEnvironment( Reference< ::com::sun::star::task::XInteractionHandler >(),
- m_xProgressHandler );
- aName += String( RTL_CONSTASCII_USTRINGPARAM( "?repairpackage" ) );
+ m_xProgressHandler );
+ aName += String( RTL_CONSTASCII_USTRINGPARAM( "?repairpackage" ) );
}
::ucbhelper::Content aContent( aName, xComEnv );
@@ -2281,13 +2277,10 @@ BOOL UCBStorage_Impl::Insert( ::ucbhelper::Content *pContent )
// a new substorage is inserted into a UCBStorage ( given by the parameter pContent )
// it must be inserted with a title and a type
BOOL bRet = FALSE;
- Reference< XContentCreator > xCreator = Reference< XContentCreator >( pContent->get(), UNO_QUERY );
- if ( !xCreator.is() )
- return sal_False;
try
{
- Sequence< ContentInfo > aInfo = xCreator->queryCreatableContentsInfo();
+ Sequence< ContentInfo > aInfo = pContent->queryCreatableContentsInfo();
sal_Int32 nCount = aInfo.getLength();
if ( nCount == 0 )
return sal_False;
@@ -2639,7 +2632,7 @@ BOOL UCBStorage_Impl::Revert()
}
else if ( pElement->m_xStorage.Is() )
{
- pElement->m_xStorage->m_bCommited = sal_False;
+ pElement->m_xStorage->m_bCommited = sal_False;
pElement->m_xStorage->Revert();
}
@@ -2655,7 +2648,7 @@ BOOL UCBStorage_Impl::Revert()
const String& UCBStorage::GetName() const
{
- return pImp->m_aName; // pImp->m_aURL ?!
+ return pImp->m_aName; // pImp->m_aURL ?!
}
BOOL UCBStorage::IsRoot() const
@@ -2893,7 +2886,7 @@ BOOL UCBStorage::CopyTo( const String& rElemName, BaseStorage* pDest, const Stri
else
{
// for copying no optimization is usefull, because in every case the stream data must be copied
- UCBStorageElement_Impl* pElement = FindElement_Impl( rElemName );
+ UCBStorageElement_Impl* pElement = FindElement_Impl( rElemName );
if ( pElement )
return CopyStorageElement_Impl( *pElement, pDest, rNew );
else
@@ -3256,10 +3249,10 @@ BOOL UCBStorage::MoveTo( const String& rEleName, BaseStorage* pNewSt, const Stri
{
// because the element is moved, not copied, a special optimization is possible :
// first copy the UCBStorageElement; flag old element as "Removed" and new as "Inserted",
- // clear original name/type of the new element
- // if moved element is open: copy content, but change absolute URL ( and those of all children of the element! ),
+ // clear original name/type of the new element
+ // if moved element is open: copy content, but change absolute URL ( and those of all children of the element! ),
// clear original name/type of new content, keep the old original stream/storage, but forget its working streams,
- // close original UCBContent and original stream, only the TempFile and its stream may remain unchanged, but now
+ // close original UCBContent and original stream, only the TempFile and its stream may remain unchanged, but now
// belong to the new content
// if original and editable stream are identical ( readonly element ), it has to be copied to the editable
// stream of the destination object
diff --git a/svl/inc/svl/solar.hrc b/svl/inc/svl/solar.hrc
index 96149b89131c..26ab8a959c5e 100644
--- a/svl/inc/svl/solar.hrc
+++ b/svl/inc/svl/solar.hrc
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2009 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: solar.hrc,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -171,6 +168,9 @@
#define HID_START 32768
+#define HID_VCL_START (HID_START+100)
+#define HID_VCL_END (HID_START+150)
+
#define HID_SVTOOLS_START (HID_START+200)
#define HID_SVTOOLS_END (HID_START+299)
@@ -207,8 +207,10 @@
#define HID_GOODIES_START (HID_LIB_START+2100)
#define HID_GOODIES_END (HID_LIB_START+2199)
+#if 0 // currently unused range
#define HID_SCHEDULE_START (HID_LIB_START+2200)
#define HID_SCHEDULE_END (HID_LIB_START+3399)
+#endif
#define HID_CHANNEL_START (HID_LIB_START+3400)
#define HID_CHANNEL_END (HID_LIB_START+3499)
@@ -300,6 +302,5 @@
#define HID_EXTENSIONS_START (HID_OBJ_START+2281)
#define HID_EXTENSIONS_END (HID_OBJ_START+2800)
-
#endif
diff --git a/svl/source/numbers/numhead.cxx b/svl/source/numbers/numhead.cxx
index 99ff33433de3..3bb650b0c9ae 100644
--- a/svl/source/numbers/numhead.cxx
+++ b/svl/source/numbers/numhead.cxx
@@ -139,7 +139,7 @@ ImpSvNumMultipleReadHeader::ImpSvNumMultipleReadHeader(SvStream& rNewStream) :
ImpSvNumMultipleReadHeader::~ImpSvNumMultipleReadHeader()
{
- DBG_ASSERT( pMemStream->Tell() == pMemStream->GetSize(),
+ DBG_ASSERT( pMemStream->Tell() == pMemStream->GetEndOfData(),
"Sizes nicht vollstaendig gelesen" );
delete pMemStream;
delete [] pBuf;
diff --git a/svtools/inc/svtools/imapobj.hxx b/svtools/inc/svtools/imapobj.hxx
index b8da0e5c3ee8..46b73ee95f2c 100644
--- a/svtools/inc/svtools/imapobj.hxx
+++ b/svtools/inc/svtools/imapobj.hxx
@@ -96,7 +96,7 @@ public:
static rtl_TextEncoding nActualTextEncoding;
- IMapObject() {};
+ IMapObject();
IMapObject( const String& rURL,
const String& rAltText,
const String& rDesc,
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index b0d20bf7ce30..1a6465bd5c5d 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1152,6 +1152,7 @@ void FontSizeBox::ImplInit()
SetDecimalDigits( 1 );
SetMin( 20 );
SetMax( 9999 );
+ SetProminentEntryType( PROMINENT_MIDDLE );
}
// -----------------------------------------------------------------------
diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx
index d820dce097ed..f00cf45be0e6 100644
--- a/svtools/source/control/filectrl.cxx
+++ b/svtools/source/control/filectrl.cxx
@@ -78,6 +78,9 @@ WinBits FileControl::ImplInitStyle( WinBits nStyle )
maButton.SetStyle( (maButton.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
}
+ const WinBits nAlignmentStyle = ( WB_TOP | WB_VCENTER | WB_BOTTOM );
+ maEdit.SetStyle( ( maEdit.GetStyle() & ~nAlignmentStyle ) | ( nStyle & nAlignmentStyle ) );
+
if ( !(nStyle & WB_NOGROUP) )
nStyle |= WB_GROUP;
diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx
index dedb5b2d7143..74cfe7b1286a 100644
--- a/svtools/source/dialogs/prnsetup.cxx
+++ b/svtools/source/dialogs/prnsetup.cxx
@@ -59,7 +59,7 @@ void ImplFillPrnDlgListBox( const Printer* pPrinter,
}
pBox->Enable( nCount != 0 );
- pPropBtn->Enable( pPrinter->HasSupport( SUPPORT_SETUPDIALOG ) );
+ pPropBtn->Show( pPrinter->HasSupport( SUPPORT_SETUPDIALOG ) );
}
// -----------------------------------------------------------------------
diff --git a/svtools/source/filter.vcl/filter/filter2.cxx b/svtools/source/filter.vcl/filter/filter2.cxx
index d570dd34e50f..9e0e3ba43d54 100644
--- a/svtools/source/filter.vcl/filter/filter2.cxx
+++ b/svtools/source/filter.vcl/filter/filter2.cxx
@@ -471,7 +471,8 @@ BOOL GraphicDescriptor::ImpDetectJPG( SvStream& rStm, BOOL bExtendedInfo )
// Groesse des verbleibenden Puffers ermitteln
if ( bLinked )
- nMax = ( (SvMemoryStream&) rStm ).GetSize() - 16;
+ nMax = static_cast< SvMemoryStream& >(rStm).GetEndOfData()
+ - 16;
else
nMax = DATA_SIZE - 16;
diff --git a/svtools/source/filter.vcl/jpeg/jpeg.cxx b/svtools/source/filter.vcl/jpeg/jpeg.cxx
index 81d07ccd5e79..ee2b2baebee0 100644
--- a/svtools/source/filter.vcl/jpeg/jpeg.cxx
+++ b/svtools/source/filter.vcl/jpeg/jpeg.cxx
@@ -656,10 +656,14 @@ void* JPEGWriter::GetScanline( long nY )
aColor = pAcc->GetPaletteColor( (BYTE) pAcc->GetPixel( nY, nX ) );
#ifndef SYSTEM_JPEG
*pTmp++ = aColor.GetBlue();
+ if ( bGreys )
+ continue;
*pTmp++ = aColor.GetGreen();
*pTmp++ = aColor.GetRed();
#else
*pTmp++ = aColor.GetRed();
+ if ( bGreys )
+ continue;
*pTmp++ = aColor.GetGreen();
*pTmp++ = aColor.GetBlue();
#endif
@@ -672,10 +676,14 @@ void* JPEGWriter::GetScanline( long nY )
aColor = pAcc->GetPixel( nY, nX );
#ifndef SYSTEM_JPEG
*pTmp++ = aColor.GetBlue();
+ if ( bGreys )
+ continue;
*pTmp++ = aColor.GetGreen();
*pTmp++ = aColor.GetRed();
#else
*pTmp++ = aColor.GetRed();
+ if ( bGreys )
+ continue;
*pTmp++ = aColor.GetGreen();
*pTmp++ = aColor.GetBlue();
#endif
@@ -711,20 +719,43 @@ BOOL JPEGWriter::Write( const Graphic& rGraphic )
pAcc = aGraphicBmp.AcquireReadAccess();
+ if ( !bGreys ) // bitmap was not explicitely converted into greyscale,
+ { // check if source is greyscale only
+
+ sal_Bool bIsGrey = sal_True;
+
+ long nWidth = pAcc->Width();
+ for ( long nY = 0; bIsGrey && ( nY < pAcc->Height() ); nY++ )
+ {
+ BitmapColor aColor;
+ for( long nX = 0L; bIsGrey && ( nX < nWidth ); nX++ )
+ {
+ aColor = pAcc->HasPalette() ? pAcc->GetPaletteColor( (BYTE) pAcc->GetPixel( nY, nX ) )
+ : pAcc->GetPixel( nY, nX );
+ bIsGrey = ( aColor.GetRed() == aColor.GetGreen() ) && ( aColor.GetRed() == aColor.GetBlue() );
+ }
+ }
+ if ( bIsGrey )
+ bGreys = sal_True;
+ }
+
if( pAcc )
{
+ if ( bGreys )
+ bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL );
+ else
#ifndef SYSTEM_JPEG
- bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR );
+ bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR );
#else
- bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB );
+ bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB );
#endif
if( !bNative )
- pBuffer = new BYTE[ AlignedWidth4Bytes( pAcc->Width() * 24L ) ];
+ pBuffer = new BYTE[ AlignedWidth4Bytes( bGreys ? pAcc->Width() * 8L : pAcc->Width() * 24L ) ];
JPEGCallbackStruct aCallbackData;
aCallbackData.xStatusIndicator = xStatusIndicator;
- bRet = (BOOL) WriteJPEG( this, &rOStm, pAcc->Width(), pAcc->Height(), nQuality, &aCallbackData );
+ bRet = (BOOL) WriteJPEG( this, &rOStm, pAcc->Width(), pAcc->Height(), bGreys, nQuality, &aCallbackData );
delete[] pBuffer;
pBuffer = NULL;
diff --git a/svtools/source/filter.vcl/jpeg/jpeg.h b/svtools/source/filter.vcl/jpeg/jpeg.h
index eaeaa503b5e9..4d5aafe413bb 100644
--- a/svtools/source/filter.vcl/jpeg/jpeg.h
+++ b/svtools/source/filter.vcl/jpeg/jpeg.h
@@ -64,7 +64,7 @@ void* JPEGMalloc( size_t size );
void JPEGFree( void *ptr );
long JPEGCallback( void* pCallbackData, long nPercent );
-long WriteJPEG( void* pJPEGWriter, void* pOStm, long nWidth, long nHeight,
+long WriteJPEG( void* pJPEGWriter, void* pOStm, long nWidth, long nHeight, long bGreyScale,
long nQualityPercent, void* pCallbackData );
void* GetScanline( void* pJPEGWriter, long nY );
diff --git a/svtools/source/filter.vcl/jpeg/jpegc.c b/svtools/source/filter.vcl/jpeg/jpegc.c
index 84394d945f79..0525877f2614 100644
--- a/svtools/source/filter.vcl/jpeg/jpegc.c
+++ b/svtools/source/filter.vcl/jpeg/jpegc.c
@@ -182,7 +182,7 @@ Exit:
}
long WriteJPEG( void* pJPEGWriter, void* pOStm,
- long nWidth, long nHeight,
+ long nWidth, long nHeight, long bGreys,
long nQualityPercent, void* pCallbackData )
{
struct jpeg_compress_struct cinfo;
@@ -208,8 +208,16 @@ long WriteJPEG( void* pJPEGWriter, void* pOStm,
cinfo.image_width = (JDIMENSION) nWidth;
cinfo.image_height = (JDIMENSION) nHeight;
- cinfo.input_components = 3;
- cinfo.in_color_space = JCS_RGB;
+ if ( bGreys )
+ {
+ cinfo.input_components = 1;
+ cinfo.in_color_space = JCS_GRAYSCALE;
+ }
+ else
+ {
+ cinfo.input_components = 3;
+ cinfo.in_color_space = JCS_RGB;
+ }
jpeg_set_defaults( &cinfo );
jpeg_set_quality( &cinfo, (int) nQualityPercent, FALSE );
diff --git a/svtools/source/filter.vcl/wmf/emfwr.cxx b/svtools/source/filter.vcl/wmf/emfwr.cxx
index e011dde1a0e8..1bc5364a191a 100644
--- a/svtools/source/filter.vcl/wmf/emfwr.cxx
+++ b/svtools/source/filter.vcl/wmf/emfwr.cxx
@@ -165,6 +165,8 @@
#define TA_RTLREADING 256
#define TA_MASK (TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING)
+#define MM_ANISOTROPIC 8
+
// -------------
// - EMFWriter -
// -------------
@@ -184,19 +186,37 @@ BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterConfig
maVDev.SetMapMode( rMtf.GetPrefMapMode() );
mpFilterConfigItem = pFilterConfigItem;
+ // don't work with pixel as destination map mode -> higher resolution preferrable
+ maDestMapMode.SetMapUnit( MAP_100TH_MM );
+
const Size aMtfSizePix( maVDev.LogicToPixel( rMtf.GetPrefSize(), rMtf.GetPrefMapMode() ) );
const Size aMtfSizeLog( maVDev.LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_100TH_MM ) );
// seek over header
- rOStm.SeekRel( 100 );
+ // use [MS-EMF 2.2.11] HeaderExtension2 Object, otherwise resulting EMF cannot be converted with GetWinMetaFileBits()
+ rOStm.SeekRel( 108 );
// write initial values
- ImplBeginRecord( WIN_EMR_SETWINDOWORGEX );
- (*mpStm) << (INT32) 0 << (INT32) 0;
+
+ // set 100th mm map mode in EMF
+ ImplBeginRecord( WIN_EMR_SETMAPMODE );
+ (*mpStm) << (INT32) MM_ANISOTROPIC;
+ ImplEndRecord();
+
+ ImplBeginRecord( WIN_EMR_SETVIEWPORTEXTEX );
+ (*mpStm) << (INT32) maVDev.ImplGetDPIX() << (INT32) maVDev.ImplGetDPIY();
ImplEndRecord();
ImplBeginRecord( WIN_EMR_SETWINDOWEXTEX );
- (*mpStm) << (INT32) aMtfSizePix.Width() << (INT32) aMtfSizePix.Height();
+ (*mpStm) << (INT32) 2540 << (INT32) 2540;
+ ImplEndRecord();
+
+ ImplBeginRecord( WIN_EMR_SETVIEWPORTORGEX );
+ (*mpStm) << (INT32) 0 << (INT32) 0;
+ ImplEndRecord();
+
+ ImplBeginRecord( WIN_EMR_SETWINDOWORGEX );
+ (*mpStm) << (INT32) 0 << (INT32) 0;
ImplEndRecord();
ImplWriteRasterOp( ROP_OVERPAINT );
@@ -210,7 +230,7 @@ BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterConfig
ImplBeginRecord( WIN_EMR_EOF );
(*mpStm)<< (sal_uInt32)0 // nPalEntries
- << (sal_uInt32)0x16 // offPalEntries
+ << (sal_uInt32)0x10 // offPalEntries
<< (sal_uInt32)0x14; // nSizeLast
ImplEndRecord();
@@ -218,14 +238,15 @@ BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterConfig
// write header
const ULONG nEndPos = mpStm->Tell(); mpStm->Seek( nHeaderPos );
- (*mpStm) << (UINT32) 0x00000001 << (UINT32) 100;
- (*mpStm) << (INT32) 0 << (INT32) 0 << (INT32) ( aMtfSizePix.Width() - 1 ) << (INT32) ( aMtfSizePix.Height() - 1 );
- (*mpStm) << (INT32) 0 << (INT32) 0 << (INT32) ( aMtfSizeLog.Width() - 1 ) << (INT32) ( aMtfSizeLog.Height() - 1 );
- (*mpStm) << (UINT32) 0x464d4520 << (UINT32) 0x10000 << (UINT32) ( nEndPos - nHeaderPos );
- (*mpStm) << (UINT32) mnRecordCount << (UINT16) ( mnHandleCount + 1 ) << (UINT16) 0 << (UINT32) 0 << (UINT32) 0 << (UINT32) 0;
- (*mpStm) << (INT32) aMtfSizePix.Width() << (INT32) aMtfSizePix.Height();
- (*mpStm) << (INT32) ( aMtfSizeLog.Width() / 100 ) << (INT32) ( aMtfSizeLog.Height() / 100 );
- (*mpStm) << (UINT32) 0 << (UINT32) 0 << (UINT32) 0;
+ (*mpStm) << (UINT32) 0x00000001 << (UINT32) 108 //use [MS-EMF 2.2.11] HeaderExtension2 Object
+ << (INT32) 0 << (INT32) 0 << (INT32) ( aMtfSizePix.Width() - 1 ) << (INT32) ( aMtfSizePix.Height() - 1 )
+ << (INT32) 0 << (INT32) 0 << (INT32) ( aMtfSizeLog.Width() - 1 ) << (INT32) ( aMtfSizeLog.Height() - 1 )
+ << (UINT32) 0x464d4520 << (UINT32) 0x10000 << (UINT32) ( nEndPos - nHeaderPos )
+ << (UINT32) mnRecordCount << (UINT16) ( mnHandleCount + 1 ) << (UINT16) 0 << (UINT32) 0 << (UINT32) 0 << (UINT32) 0
+ << (INT32) aMtfSizePix.Width() << (INT32) aMtfSizePix.Height()
+ << (INT32) ( aMtfSizeLog.Width() / 100 ) << (INT32) ( aMtfSizeLog.Height() / 100 )
+ << (UINT32) 0 << (UINT32) 0 << (UINT32) 0
+ << (INT32) ( aMtfSizeLog.Width() * 10 ) << (INT32) ( aMtfSizeLog.Height() * 10 ); //use [MS-EMF 2.2.11] HeaderExtension2 Object
mpStm->Seek( nEndPos );
delete[] mpHandlesUsed;
@@ -523,35 +544,32 @@ void EMFWriter::ImplWriteRasterOp( RasterOp eRop )
void EMFWriter::ImplWriteExtent( long nExtent )
{
- const Size aSize( maVDev.LogicToPixel( Size( nExtent, nExtent ) ) );
- (*mpStm) << (INT32) aSize.Width();
+ nExtent = maVDev.LogicToLogic( Size( nExtent, 0 ), maVDev.GetMapMode(), maDestMapMode ).Width();
+ (*mpStm) << (INT32) nExtent;
}
// -----------------------------------------------------------------------------
void EMFWriter::ImplWritePoint( const Point& rPoint )
{
- const Point aPoint( maVDev.LogicToPixel( rPoint ) );
-
- (*mpStm) << (INT32) aPoint.X() << (INT32) aPoint.Y();
+ const Point aPoint( maVDev.LogicToLogic( rPoint, maVDev.GetMapMode(), maDestMapMode ));
+ (*mpStm) << (INT32) aPoint.X() << (INT32) aPoint.Y();
}
// -----------------------------------------------------------------------------
void EMFWriter::ImplWriteSize( const Size& rSize)
{
- const Size aSize( maVDev.LogicToPixel( rSize ) );
-
- (*mpStm) << (INT32) aSize.Width() << (INT32) aSize.Height();
+ const Size aSize( maVDev.LogicToLogic( rSize, maVDev.GetMapMode(), maDestMapMode ));
+ (*mpStm) << (INT32) aSize.Width() << (INT32) aSize.Height();
}
// -----------------------------------------------------------------------------
void EMFWriter::ImplWriteRect( const Rectangle& rRect )
{
- const Rectangle aRect( maVDev.LogicToPixel( rRect ) );
-
- (*mpStm) << aRect.Left() << aRect.Top() << aRect.Right() << aRect.Bottom();
+ const Rectangle aRect( maVDev.LogicToLogic ( rRect, maVDev.GetMapMode(), maDestMapMode ));
+ (*mpStm) << aRect.Left() << aRect.Top() << aRect.Right() << aRect.Bottom();
}
// -----------------------------------------------------------------------------
@@ -650,12 +668,20 @@ void EMFWriter::ImplWritePath( const PolyPolygon& rPolyPoly, sal_Bool bClosed )
const Polygon& rPoly = rPolyPoly[ i ];
while ( n < rPoly.GetSize() )
{
- sal_uInt16 nBezPoints = 0;
- if ( n )
+ if( n == 0 )
{
- while ( ( ( nBezPoints + n + 2 ) < rPoly.GetSize() ) && ( rPoly.GetFlags( nBezPoints + n ) == POLY_CONTROL ) )
- nBezPoints += 3;
+ ImplBeginRecord( WIN_EMR_MOVETOEX );
+ ImplWritePoint( rPoly[ 0 ] );
+ ImplEndRecord();
+ n++;
+ continue;
}
+
+ sal_uInt16 nBezPoints = 0;
+
+ while ( ( ( nBezPoints + n + 2 ) < rPoly.GetSize() ) && ( rPoly.GetFlags( nBezPoints + n ) == POLY_CONTROL ) )
+ nBezPoints += 3;
+
if ( nBezPoints )
{
ImplBeginRecord( WIN_EMR_POLYBEZIERTO );
@@ -675,22 +701,26 @@ void EMFWriter::ImplWritePath( const PolyPolygon& rPolyPoly, sal_Bool bClosed )
sal_uInt16 nPoints = 1;
while( ( nPoints + n ) < rPoly.GetSize() && ( rPoly.GetFlags( nPoints + n ) != POLY_CONTROL ) )
nPoints++;
- ImplBeginRecord( WIN_EMR_MOVETOEX );
- ImplWritePoint( rPoly[ n ] );
- ImplEndRecord();
+
if ( nPoints > 1 )
{
ImplBeginRecord( WIN_EMR_POLYLINETO );
- Polygon aNewPoly( nPoints );
- aNewPoly[ 0 ] = rPoly[ n ];
- for ( o = 1; o < nPoints; o++ )
- aNewPoly[ o ] = rPoly[ n + o ];
+ Polygon aNewPoly( nPoints + 1 );
+ aNewPoly[ 0 ] = rPoly[ n - 1];
+ for ( o = 1; o <= nPoints; o++ )
+ aNewPoly[ o ] = rPoly[ n - 1 + o ];
ImplWriteRect( aNewPoly.GetBoundRect() );
- (*mpStm) << (sal_uInt32)( nPoints - 1 );
+ (*mpStm) << (sal_uInt32)( nPoints );
for( o = 1; o < aNewPoly.GetSize(); o++ )
ImplWritePoint( aNewPoly[ o ] );
ImplEndRecord();
}
+ else
+ {
+ ImplBeginRecord( WIN_EMR_LINETO );
+ ImplWritePoint( rPoly[ n ] );
+ ImplEndRecord();
+ }
n = n + nPoints;
}
if ( bClosed && ( n == rPoly.GetSize() ) )
@@ -703,6 +733,7 @@ void EMFWriter::ImplWritePath( const PolyPolygon& rPolyPoly, sal_Bool bClosed )
ImplBeginRecord( WIN_EMR_ENDPATH );
ImplEndRecord();
ImplBeginRecord( bClosed ? WIN_EMR_FILLPATH : WIN_EMR_STROKEPATH );
+ ImplWriteRect( rPolyPoly.GetBoundRect() );
ImplEndRecord();
}
diff --git a/svtools/source/filter.vcl/wmf/emfwr.hxx b/svtools/source/filter.vcl/wmf/emfwr.hxx
index 2d3c8801ba49..29715c59df0f 100644
--- a/svtools/source/filter.vcl/wmf/emfwr.hxx
+++ b/svtools/source/filter.vcl/wmf/emfwr.hxx
@@ -50,6 +50,7 @@ class EMFWriter
private:
VirtualDevice maVDev;
+ MapMode maDestMapMode;
FilterConfigItem* mpFilterConfigItem;
SvStream* mpStm;
BOOL* mpHandlesUsed;
diff --git a/svtools/source/filter.vcl/wmf/winmtf.cxx b/svtools/source/filter.vcl/wmf/winmtf.cxx
index 6f1caae18750..58dfdec45ee1 100644
--- a/svtools/source/filter.vcl/wmf/winmtf.cxx
+++ b/svtools/source/filter.vcl/wmf/winmtf.cxx
@@ -1522,9 +1522,9 @@ void WinMtfOutput::DrawText( Point& rPosition, String& rText, sal_Int32* pDXArry
aTmp.SetFillColor( maBkColor );
if( mnBkMode == TRANSPARENT )
- maFont.SetTransparent( sal_True );
+ aTmp.SetTransparent( sal_True );
else
- maFont.SetTransparent( sal_False );
+ aTmp.SetTransparent( sal_False );
if ( ( mnTextAlign & TA_BASELINE) == TA_BASELINE )
aTmp.SetAlign( ALIGN_BASELINE );
@@ -2195,3 +2195,8 @@ void WinMtfOutput::Pop()
}
}
+void WinMtfOutput::AddFromGDIMetaFile( GDIMetaFile& rGDIMetaFile )
+{
+ rGDIMetaFile.Play( *mpGDIMetaFile, 0xFFFFFFFF );
+}
+
diff --git a/svtools/source/filter.vcl/wmf/winmtf.hxx b/svtools/source/filter.vcl/wmf/winmtf.hxx
index ada590a19675..f3b2482f63bc 100644
--- a/svtools/source/filter.vcl/wmf/winmtf.hxx
+++ b/svtools/source/filter.vcl/wmf/winmtf.hxx
@@ -672,6 +672,7 @@ class WinMtfOutput
void MoveClipRegion( const Size& rSize );
void SetClipPath( const PolyPolygon& rPolyPoly, sal_Int32 nClippingMode, sal_Bool bIsMapped );
void UpdateClipRegion();
+ void AddFromGDIMetaFile( GDIMetaFile& rGDIMetaFile );
WinMtfOutput( GDIMetaFile& rGDIMetaFile );
virtual ~WinMtfOutput();
@@ -734,6 +735,18 @@ private:
UINT16 nUnitsPerInch;
sal_uInt32 nRecSize;
+ // embedded EMF data
+ SvMemoryStream* pEMFStream;
+
+ // total number of comment records containing EMF data
+ sal_uInt32 nEMFRecCount;
+
+ // number of EMF records read
+ sal_uInt32 nEMFRec;
+
+ // total size of embedded EMF data
+ sal_uInt32 nEMFSize;
+
sal_uInt32 nSkipActions;
sal_uInt32 nCurrentAction;
sal_uInt32 nUnicodeEscapeAction;
@@ -755,6 +768,8 @@ public:
WMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL )
: WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ) {};
+ ~WMFReader();
+
// Liesst aus dem Stream eine WMF-Datei und fuellt das GDIMetaFile
void ReadWMF();
};
diff --git a/svtools/source/filter.vcl/wmf/winwmf.cxx b/svtools/source/filter.vcl/wmf/winwmf.cxx
index 0930b0ece8a8..f9ae46e98e12 100644
--- a/svtools/source/filter.vcl/wmf/winwmf.cxx
+++ b/svtools/source/filter.vcl/wmf/winwmf.cxx
@@ -32,6 +32,7 @@
#include "precompiled_svtools.hxx"
#include "winmtf.hxx"
+#include <vcl/gdimtf.hxx>
#include <rtl/crc.h>
#include <rtl/tencinfo.h>
#include <osl/endian.h>
@@ -831,81 +832,136 @@ void WMFReader::ReadRecordParams( USHORT nFunc )
pWMF->SetError( SVSTREAM_FILEFORMAT_ERROR );
break;
}
- if ( nRecSize >= 12 ) // minimal escape lenght
+ if ( nRecSize >= 4 ) // minimal escape lenght
{
- sal_uInt16 nMode, nLen, OO;
- sal_uInt32 Magic, nCheck,nEsc;
+ sal_uInt16 nMode, nLen;
*pWMF >> nMode
- >> nLen
- >> OO
- >> Magic
- >> nCheck
- >> nEsc;
- if ( ( nMode == W_MFCOMMENT ) && ( nLen >= 14 ) && ( OO == 0x4f4f ) && ( Magic == 0xa2c2a ) )
+ >> nLen;
+ if ( ( nMode == W_MFCOMMENT ) && ( nLen >= 4 ) )
{
- sal_uInt32 nEscLen = nLen - 14;
- if ( nEscLen <= ( nRecSize * 2 ) )
+ sal_uInt32 nNewMagic; // we have to read int32 for
+ *pWMF >> nNewMagic; // META_ESCAPE_ENHANCED_METAFILE CommentIdentifier
+
+ if( nNewMagic == 0x2c2a4f4f && nLen >= 14 )
{
+ sal_uInt16 nMagic2;
+ *pWMF >> nMagic2;
+ if( nMagic2 == 0x0a ) // 2nd half of magic
+ { // continue with private escape
+ sal_uInt32 nCheck, nEsc;
+ *pWMF >> nCheck
+ >> nEsc;
+
+ sal_uInt32 nEscLen = nLen - 14;
+ if ( nEscLen <= ( nRecSize * 2 ) )
+ {
#ifdef OSL_BIGENDIAN
- sal_uInt32 nTmp = SWAPLONG( nEsc );
- sal_uInt32 nCheckSum = rtl_crc32( 0, &nTmp, 4 );
+ sal_uInt32 nTmp = SWAPLONG( nEsc );
+ sal_uInt32 nCheckSum = rtl_crc32( 0, &nTmp, 4 );
#else
- sal_uInt32 nCheckSum = rtl_crc32( 0, &nEsc, 4 );
+ sal_uInt32 nCheckSum = rtl_crc32( 0, &nEsc, 4 );
#endif
- sal_Int8* pData = NULL;
+ sal_Int8* pData = NULL;
- if ( ( static_cast< sal_uInt64 >( nEscLen ) + pWMF->Tell() ) > nMetaRecEndPos )
- {
- pWMF->SetError( SVSTREAM_FILEFORMAT_ERROR );
- break;
- }
- if ( nEscLen > 0 )
- {
- pData = new sal_Int8[ nEscLen ];
- pWMF->Read( pData, nEscLen );
- nCheckSum = rtl_crc32( nCheckSum, pData, nEscLen );
- }
- if ( nCheck == nCheckSum )
- {
- switch( nEsc )
- {
- case PRIVATE_ESCAPE_UNICODE :
- { // we will use text instead of polygons only if we have the correct font
- if ( aVDev.IsFontAvailable( pOut->GetFont().GetName() ) )
+ if ( ( static_cast< sal_uInt64 >( nEscLen ) + pWMF->Tell() ) > nMetaRecEndPos )
+ {
+ pWMF->SetError( SVSTREAM_FILEFORMAT_ERROR );
+ break;
+ }
+ if ( nEscLen > 0 )
+ {
+ pData = new sal_Int8[ nEscLen ];
+ pWMF->Read( pData, nEscLen );
+ nCheckSum = rtl_crc32( nCheckSum, pData, nEscLen );
+ }
+ if ( nCheck == nCheckSum )
+ {
+ switch( nEsc )
{
- Point aPt;
- String aString;
- sal_uInt32 i, nStringLen, nDXCount;
- sal_Int32* pDXAry = NULL;
- SvMemoryStream aMemoryStream( nEscLen );
- aMemoryStream.Write( pData, nEscLen );
- aMemoryStream.Seek( STREAM_SEEK_TO_BEGIN );
- aMemoryStream >> aPt.X()
- >> aPt.Y()
- >> nStringLen;
-
- if ( ( static_cast< sal_uInt64 >( nStringLen ) * sizeof( sal_Unicode ) ) < ( nEscLen - aMemoryStream.Tell() ) )
- {
- sal_Unicode* pBuf = aString.AllocBuffer( (xub_StrLen)nStringLen );
- for ( i = 0; i < nStringLen; i++ )
- aMemoryStream >> pBuf[ i ];
- aMemoryStream >> nDXCount;
- if ( ( static_cast< sal_uInt64 >( nDXCount ) * sizeof( sal_Int32 ) ) >= ( nEscLen - aMemoryStream.Tell() ) )
- nDXCount = 0;
- if ( nDXCount )
- pDXAry = new sal_Int32[ nDXCount ];
- for ( i = 0; i < nDXCount; i++ )
- aMemoryStream >> pDXAry[ i ];
- aMemoryStream >> nSkipActions;
- pOut->DrawText( aPt, aString, pDXAry );
- delete[] pDXAry;
+ case PRIVATE_ESCAPE_UNICODE :
+ { // we will use text instead of polygons only if we have the correct font
+ if ( aVDev.IsFontAvailable( pOut->GetFont().GetName() ) )
+ {
+ Point aPt;
+ String aString;
+ sal_uInt32 i, nStringLen, nDXCount;
+ sal_Int32* pDXAry = NULL;
+ SvMemoryStream aMemoryStream( nEscLen );
+ aMemoryStream.Write( pData, nEscLen );
+ aMemoryStream.Seek( STREAM_SEEK_TO_BEGIN );
+ aMemoryStream >> aPt.X()
+ >> aPt.Y()
+ >> nStringLen;
+
+ if ( ( static_cast< sal_uInt64 >( nStringLen ) * sizeof( sal_Unicode ) ) < ( nEscLen - aMemoryStream.Tell() ) )
+ {
+ sal_Unicode* pBuf = aString.AllocBuffer( (xub_StrLen)nStringLen );
+ for ( i = 0; i < nStringLen; i++ )
+ aMemoryStream >> pBuf[ i ];
+ aMemoryStream >> nDXCount;
+ if ( ( static_cast< sal_uInt64 >( nDXCount ) * sizeof( sal_Int32 ) ) >= ( nEscLen - aMemoryStream.Tell() ) )
+ nDXCount = 0;
+ if ( nDXCount )
+ pDXAry = new sal_Int32[ nDXCount ];
+ for ( i = 0; i < nDXCount; i++ )
+ aMemoryStream >> pDXAry[ i ];
+ aMemoryStream >> nSkipActions;
+ pOut->DrawText( aPt, aString, pDXAry );
+ delete[] pDXAry;
+ }
+ }
}
+ break;
}
}
- break;
+ delete[] pData;
+ }
+ }
+ }
+ else if ( (nNewMagic == static_cast< sal_uInt32 >(0x43464D57)) && (nLen >= 34) && ( (sal_Int32)(nLen + 10) <= (sal_Int32)(nRecSize * 2) ))
+ {
+ sal_uInt32 nComType, nVersion, nFlags, nComRecCount,
+ nCurRecSize, nRemainingSize, nEMFTotalSize;
+ sal_uInt16 nCheck;
+
+ *pWMF >> nComType >> nVersion >> nCheck >> nFlags
+ >> nComRecCount >> nCurRecSize
+ >> nRemainingSize >> nEMFTotalSize; // the nRemainingSize is not mentioned in MSDN documentation
+ // but it seems to be required to read in data produced by OLE
+
+ if( nComType == 0x01 && nVersion == 0x10000 && nComRecCount )
+ {
+ if( !nEMFRec )
+ { // first EMF comment
+ nEMFRecCount = nComRecCount;
+ nEMFSize = nEMFTotalSize;
+ pEMFStream = new SvMemoryStream( nEMFSize );
+ }
+ else if( ( nEMFRecCount != nComRecCount ) || ( nEMFSize != nEMFTotalSize ) ) // add additional checks here
+ {
+ // total records should be the same as in previous comments
+ nEMFRecCount = 0xFFFFFFFF;
+ delete pEMFStream;
+ pEMFStream = NULL;
+ }
+ nEMFRec++;
+
+ if( pEMFStream && nCurRecSize + 34 > nLen )
+ {
+ nEMFRecCount = 0xFFFFFFFF;
+ delete pEMFStream;
+ pEMFStream = NULL;
+ }
+
+ if( pEMFStream )
+ {
+ sal_Int8* pBuf = new sal_Int8[ nCurRecSize ];
+ sal_uInt32 nCount = pWMF->Read( pBuf, nCurRecSize );
+ if( nCount == nCurRecSize )
+ pEMFStream->Write( pBuf, nCount );
+ delete[] pBuf;
}
}
- delete[] pData;
}
}
}
@@ -1023,6 +1079,11 @@ void WMFReader::ReadWMF()
nCurrentAction = 0;
nUnicodeEscapeAction = 0;
+ pEMFStream = NULL;
+ nEMFRecCount = 0;
+ nEMFRec = 0;
+ nEMFSize = 0;
+
pOut->SetMapMode( MM_ANISOTROPIC );
pOut->SetWinOrg( Point() );
pOut->SetWinExt( Size( 1, 1 ) );
@@ -1070,6 +1131,33 @@ void WMFReader::ReadWMF()
ReadRecordParams( nFunction );
else
nSkipActions--;
+
+ if( pEMFStream && nEMFRecCount == nEMFRec )
+ {
+ GDIMetaFile aMeta;
+ pEMFStream->Seek( 0 );
+ EnhWMFReader* pEMFReader = new EnhWMFReader ( *pEMFStream, aMeta );
+ BOOL bRead = pEMFReader->ReadEnhWMF();
+ delete pEMFReader; // destroy first!!!
+
+ if( bRead )
+ {
+ pOut->AddFromGDIMetaFile( aMeta );
+ pOut->SetrclFrame( Rectangle(0, 0, aMeta.GetPrefSize().Width(), aMeta.GetPrefSize().Height() ));
+ // we have successfully read the embedded EMF data
+ // no need to process WMF data further
+ break;
+ }
+ else
+ {
+ // something went wrong
+ // continue with WMF, don't try this again
+ delete pEMFStream;
+ pEMFStream = NULL;
+ }
+
+ }
+
nPos += nRecSize * 2;
if ( nPos <= nEndPos )
pWMF->Seek( nPos );
@@ -1333,3 +1421,9 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt
return bRet;
}
+WMFReader::~WMFReader()
+{
+ if( pEMFStream )
+ delete pEMFStream;
+}
+
diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx
index 30d4ff06c0d2..c4f53046c29a 100644
--- a/svtools/source/filter.vcl/wmf/wmfwr.cxx
+++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx
@@ -34,6 +34,7 @@
#include <vcl/salbtype.hxx>
#include "wmfwr.hxx"
#include <unotools/fontcvt.hxx>
+#include "emfwr.hxx"
#include <rtl/crc.h>
#include <rtl/tencinfo.h>
#include <tools/tenccvt.hxx>
@@ -1875,6 +1876,7 @@ BOOL WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream,
{
WMFWriterAttrStackMember * pAt;
+ bEmbedEMF = TRUE;
bStatus=TRUE;
pConvert = 0;
pVirDev = new VirtualDevice;
@@ -1938,6 +1940,8 @@ BOOL WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream,
CountActionsAndBitmaps(rMTF);
WriteHeader(rMTF,bPlaceable);
+ if( bEmbedEMF )
+ WriteEmbeddedEMF( rMTF );
WMFRecord_SetWindowOrg(Point(0,0));
WMFRecord_SetWindowExt(rMTF.GetPrefSize());
WMFRecord_SetBkMode( TRUE );
@@ -2016,3 +2020,80 @@ USHORT WMFWriter::CalcSaveTargetMapMode(MapMode& rMapMode,
return nDivisor;
}
+
+// ------------------------------------------------------------------------
+
+void WMFWriter::WriteEmbeddedEMF( const GDIMetaFile& rMTF )
+{
+ EMFWriter aEMFWriter;
+ SvMemoryStream aStream;
+
+ if( aEMFWriter.WriteEMF( rMTF, aStream ) )
+ {
+ sal_Size nTotalSize = aStream.Tell();
+ if( nTotalSize > SAL_MAX_UINT32 )
+ return;
+ aStream.Seek( 0 );
+ sal_uInt32 nRemainingSize = static_cast< sal_uInt32 >( nTotalSize );
+ sal_uInt32 nRecCounts = ( (nTotalSize - 1) / 0x2000 ) + 1;
+ sal_uInt16 nCheckSum = 0, nWord;
+
+ sal_uInt32 nPos = 0;
+
+ while( nPos + 1 < nTotalSize )
+ {
+ aStream >> nWord;
+ nCheckSum ^= nWord;
+ nPos += 2;
+ }
+
+ nCheckSum = static_cast< sal_uInt16 >( nCheckSum * -1 );
+
+ aStream.Seek( 0 );
+ while( nRemainingSize > 0 )
+ {
+ sal_uInt32 nCurSize;
+ if( nRemainingSize > 0x2000 )
+ {
+ nCurSize = 0x2000;
+ nRemainingSize -= 0x2000;
+ }
+ else
+ {
+ nCurSize = nRemainingSize;
+ nRemainingSize = 0;
+ }
+ WriteEMFRecord( aStream,
+ nCurSize,
+ nRemainingSize,
+ nTotalSize,
+ nRecCounts,
+ nCheckSum );
+ nCheckSum = 0;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void WMFWriter::WriteEMFRecord( SvMemoryStream& rStream, sal_uInt32 nCurSize, sal_uInt32 nRemainingSize,
+ sal_uInt32 nTotalSize, sal_uInt32 nRecCounts, sal_uInt16 nCheckSum )
+{
+ // according to http://msdn.microsoft.com/en-us/library/dd366152%28PROT.13%29.aspx
+ WriteRecordHeader( 0, W_META_ESCAPE );
+ *pWMF << (sal_uInt16)W_MFCOMMENT // same as META_ESCAPE_ENHANCED_METAFILE
+ << (sal_uInt16)( nCurSize + 34 ) // we will always have a 34 byte escape header:
+ << (sal_uInt32) 0x43464D57 // WMFC
+ << (sal_uInt32) 0x00000001 // Comment type
+ << (sal_uInt32) 0x00010000 // version
+ << nCheckSum // check sum
+ << (sal_uInt32) 0 // flags = 0
+ << nRecCounts // total number of records
+ << nCurSize // size of this record's data
+ << nRemainingSize // remaining size of data in following records, missing in MSDN documentation
+ << nTotalSize; // total size of EMF stream
+
+ pWMF->Write( static_cast< const sal_Char* >( rStream.GetData() ) + rStream.Tell(), nCurSize );
+ rStream.SeekRel( nCurSize );
+ UpdateRecordHeader();
+}
diff --git a/svtools/source/filter.vcl/wmf/wmfwr.hxx b/svtools/source/filter.vcl/wmf/wmfwr.hxx
index 03ca14e7633f..6b2ff0b04e0a 100644
--- a/svtools/source/filter.vcl/wmf/wmfwr.hxx
+++ b/svtools/source/filter.vcl/wmf/wmfwr.hxx
@@ -131,6 +131,8 @@ private:
ULONG nWrittenBitmaps; // Anzahl der bereits geschriebenen Bitmaps
ULONG nActBitmapPercent; // Wieviel Prozent die naechste Bitmap schon geschrieben ist.
+ BOOL bEmbedEMF; // optionally embedd EMF data into WMF
+
void MayCallback();
// Berechnet anhand der obigen 5 Parameter eine Prozentzahl
// und macht dann ggf. einen Callback. Setzt bStatus auf FALSE wenn User abbrechen
@@ -211,6 +213,13 @@ private:
void WriteHeader(const GDIMetaFile & rMTF, BOOL bPlaceable);
void UpdateHeader();
+ void WriteEmbeddedEMF( const GDIMetaFile& rMTF );
+ void WriteEMFRecord( SvMemoryStream& rStream, sal_uInt32 nCurSize,
+ sal_uInt32 nRemainingSize,
+ sal_uInt32 nTotalSize,
+ sal_uInt32 nRecCounts,
+ sal_uInt16 nCheckSum );
+
USHORT CalcSaveTargetMapMode(MapMode& rMapMode, const Size& rPrefSize);
public:
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index 4084aa47bc80..3a31c1b812a6 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -321,16 +321,21 @@ BOOL SfxErrorHandler::GetClassString(ULONG lClassId, String &rStr) const
*/
{
-
- ResId aId(RID_ERRHDL, *pMgr);
- ErrorResource_Impl aEr(aId, (USHORT)lClassId);
- if(aEr)
+ BOOL bRet = FALSE;
+ com::sun::star::lang::Locale aLocale( Application::GetSettings().GetUILocale() );
+ ResMgr* pResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(ofa), aLocale );
+ if( pResMgr )
{
- rStr=((ResString)aEr).GetString();
- return TRUE;
+ ResId aId(RID_ERRHDL, *pResMgr );
+ ErrorResource_Impl aEr(aId, (USHORT)lClassId);
+ if(aEr)
+ {
+ rStr=((ResString)aEr).GetString();
+ bRet = TRUE;
+ }
}
- else
- return FALSE;
+ delete pResMgr;
+ return bRet;
}
//-------------------------------------------------------------------------
@@ -379,10 +384,10 @@ BOOL SfxErrorHandler::GetErrorString(
BOOL bRet = FALSE;
rStr=String(SvtResId(RID_ERRHDL_CLASS));
- ResId *pResId = new ResId(nId, *pMgr);
+ ResId aResId(nId, *pMgr);
{
- ErrorResource_Impl aEr(*pResId, (USHORT)lErrId);
+ ErrorResource_Impl aEr(aResId, (USHORT)lErrId);
if(aEr)
{
ResString aErrorString(aEr);
@@ -408,7 +413,6 @@ BOOL SfxErrorHandler::GetErrorString(
rStr.SearchAndReplace(String::CreateFromAscii( "$(CLASS)" ),aErrStr);
}
- delete pResId;
return bRet;
}
diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx
index df7760f7931b..b0aaee113c20 100644
--- a/svtools/source/misc/imap.cxx
+++ b/svtools/source/misc/imap.cxx
@@ -64,6 +64,12 @@ UINT16 IMapObject::nActualTextEncoding = (UINT16) RTL_TEXTENCODING_DONTKNOW;
#pragma optimize ( "", off )
#endif
+IMapObject::IMapObject()
+ : bActive( false )
+ , nReadVersion( 0 )
+{
+}
+
IMapObject::IMapObject( const String& rURL, const String& rAltText, const String& rDesc,
const String& rTarget, const String& rName, BOOL bURLActive )
: aURL( rURL )
@@ -72,6 +78,7 @@ IMapObject::IMapObject( const String& rURL, const String& rAltText, const String
, aTarget( rTarget )
, aName( rName )
, bActive( bURLActive )
+, nReadVersion( 0 )
{
}
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index a1ff1ad2ac3e..9c7c3eec33d1 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -549,86 +549,6 @@ void VCLXMultiLineEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
}
// ----------------------------------------------------
-// class VCLXFileDialog
-// ----------------------------------------------------
-/*
-VCLXFileDialog::VCLXFileDialog()
-{
-}
-
-VCLXFileDialog::~VCLXFileDialog()
-{
-}
-
-::com::sun::star::uno::Any VCLXFileDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::XXX*, this ) );
- return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
-}
-
-// ::com::sun::star::lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( VCLXFileDialog )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XXX>* ) NULL )
-IMPL_XTYPEPROVIDER_END
-
-void VCLXFileDialog::setPath( const ::rtl::OUString& rPath )
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- FileDialog* pDlg = (FileDialog*)GetWindow();
- if ( pDlg )
- pDlg->SetPath( ::rtl::OUStringToOString( rPath, CHARSET_SYSTEM ) );
-}
-
-::rtl::OUString VCLXFileDialog::getPath()
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- ::rtl::OUString aPath;
- FileDialog* pDlg = (FileDialog*)GetWindow();
- if ( pDlg )
- aPath = StringToOUString( pDlg->GetPath(), CHARSET_SYSTEM );
- return aPath;
-}
-
-void VCLXFileDialog::setFilters( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& rFilterNames, const ::com::sun::star::uno::Sequence< ::rtl::OUString>& rMasks )
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- FileDialog* pDlg = (FileDialog*)GetWindow();
- if ( pDlg )
- {
- sal_uInt32 nFlts = rFilterNames.getLength();
- for ( sal_uInt32 n = 0; n < nFlts; n++ )
- pDlg->AddFilter(
- ::rtl::OUStringToOString( rFilterNames.getConstArray()[n], CHARSET_SYSTEM ),
- ::rtl::OUStringToOString( rMasks.getConstArray()[n], CHARSET_SYSTEM ) );
- }
-}
-
-void VCLXFileDialog::setCurrentFilter( const ::rtl::OUString& rFilterName )
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- FileDialog* pDlg = (FileDialog*)GetWindow();
- if ( pDlg )
- pDlg->SetCurFilter( ::rtl::OUStringToOString( rFilterName, CHARSET_SYSTEM ) );
-}
-
-::rtl::OUString VCLXFileDialog::getCurrentFilter()
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- ::rtl::OUString aFilter;
- FileDialog* pDlg = (FileDialog*)GetWindow();
- if ( pDlg )
- aFilter = StringToOUString( pDlg->GetCurFilter(), CHARSET_SYSTEM );
- return aFilter;
-}
-*/
-
-// ----------------------------------------------------
// class VCLXFileControl
// ----------------------------------------------------
VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
diff --git a/toolkit/inc/toolkit/awt/vclxprinter.hxx b/toolkit/inc/toolkit/awt/vclxprinter.hxx
index e94864b51280..4db43a3c5d77 100644
--- a/toolkit/inc/toolkit/awt/vclxprinter.hxx
+++ b/toolkit/inc/toolkit/awt/vclxprinter.hxx
@@ -43,9 +43,7 @@
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
#include <cppuhelper/propshlp.hxx>
-class Printer;
-class String;
-
+#include "vcl/oldprintadaptor.hxx"
// Fuer den Drucker relevante Properties:
/*
@@ -65,20 +63,17 @@ class VCLXPrinterPropertySet : public ::com::sun::star::awt::XPrinterPropertySe
public MutexAndBroadcastHelper,
public ::cppu::OPropertySetHelper
{
-private:
- Printer* mpPrinter;
+protected:
+ boost::shared_ptr<Printer> mpPrinter;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > mxPrnDevice;
sal_Int16 mnOrientation;
sal_Bool mbHorizontal;
-
-protected:
-
public:
VCLXPrinterPropertySet( const String& rPrinterName );
virtual ~VCLXPrinterPropertySet();
- Printer* GetPrinter() const { return mpPrinter; }
+ Printer* GetPrinter() const { return mpPrinter.get(); }
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > GetDevice();
// ::com::sun::star::uno::XInterface
@@ -120,6 +115,8 @@ class VCLXPrinter: public ::com::sun::star::awt::XPrinter,
public VCLXPrinterPropertySet,
public ::cppu::OWeakObject
{
+ boost::shared_ptr<vcl::OldStylePrintAdaptor> mpListener;
+ JobSetup maInitJobSetup;
public:
VCLXPrinter( const String& rPrinterName );
~VCLXPrinter();
diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx
index 69d8dd827497..a8059463a297 100644
--- a/toolkit/source/awt/vclxprinter.cxx
+++ b/toolkit/source/awt/vclxprinter.cxx
@@ -102,10 +102,10 @@ IMPL_XTYPEPROVIDER_END
VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName )
: OPropertySetHelper( BrdcstHelper )
+ , mpPrinter( new Printer( rPrinterName ) )
{
osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
- mpPrinter = new Printer( rPrinterName );
mnOrientation = 0;
mbHorizontal = sal_False;
}
@@ -113,8 +113,7 @@ VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName )
VCLXPrinterPropertySet::~VCLXPrinterPropertySet()
{
osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
-
- delete mpPrinter;
+ mpPrinter.reset();
}
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinterPropertySet::GetDevice()
@@ -326,13 +325,16 @@ IMPL_XTYPEPROVIDER_START( VCLXPrinter )
VCLXPrinterPropertySet::getTypes()
IMPL_XTYPEPROVIDER_END
-sal_Bool VCLXPrinter::start( const ::rtl::OUString& rJobName, sal_Int16 /*nCopies*/, sal_Bool /*bCollate*/ ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+sal_Bool VCLXPrinter::start( const ::rtl::OUString& /*rJobName*/, sal_Int16 /*nCopies*/, sal_Bool /*bCollate*/ ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
sal_Bool bDone = sal_True;
- if ( GetPrinter() )
- bDone = GetPrinter()->StartJob( rJobName );
+ if ( mpListener.get() )
+ {
+ maInitJobSetup = mpPrinter->GetJobSetup();
+ mpListener.reset( new vcl::OldStylePrintAdaptor( mpPrinter ) );
+ }
return bDone;
}
@@ -341,24 +343,28 @@ void VCLXPrinter::end( ) throw(::com::sun::star::awt::PrinterException, ::com::
{
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
- if ( GetPrinter() )
- GetPrinter()->EndJob();
+ if ( mpListener.get() )
+ {
+ Printer::PrintJob( mpListener, maInitJobSetup );
+ mpListener.reset();
+ }
}
void VCLXPrinter::terminate( ) throw(::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
- if ( GetPrinter() )
- GetPrinter()->AbortJob();
+ mpListener.reset();
}
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinter::startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
- if ( GetPrinter() )
- GetPrinter()->StartPage();
+ if ( mpListener.get() )
+ {
+ mpListener->StartPage();
+ }
return GetDevice();
}
@@ -366,8 +372,10 @@ void VCLXPrinter::endPage( ) throw(::com::sun::star::awt::PrinterException, ::c
{
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
- if ( GetPrinter() )
- GetPrinter()->EndPage();
+ if ( mpListener.get() )
+ {
+ mpListener->EndPage();
+ }
}
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 7757d170256a..e41de1e8bd25 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -3390,6 +3390,7 @@ void VCLXEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_PAINTTRANSPARENT,
BASEPROPERTY_AUTOHSCROLL,
BASEPROPERTY_AUTOVSCROLL,
+ BASEPROPERTY_VERTICALALIGN,
BASEPROPERTY_WRITING_MODE,
BASEPROPERTY_CONTEXT_WRITING_MODE,
0);
@@ -4283,6 +4284,7 @@ void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_ENFORCE_FORMAT,
BASEPROPERTY_TEXT,
BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
BASEPROPERTY_WRITING_MODE,
BASEPROPERTY_CONTEXT_WRITING_MODE,
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
@@ -4624,6 +4626,7 @@ void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_ENFORCE_FORMAT,
BASEPROPERTY_TEXT,
BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
BASEPROPERTY_WRITING_MODE,
BASEPROPERTY_CONTEXT_WRITING_MODE,
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
@@ -4927,6 +4930,7 @@ void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_VALUE_DOUBLE,
BASEPROPERTY_ENFORCE_FORMAT,
BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
BASEPROPERTY_WRITING_MODE,
BASEPROPERTY_CONTEXT_WRITING_MODE,
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
@@ -5521,6 +5525,7 @@ void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_VALUE_DOUBLE,
BASEPROPERTY_ENFORCE_FORMAT,
BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
BASEPROPERTY_WRITING_MODE,
BASEPROPERTY_CONTEXT_WRITING_MODE,
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
@@ -5868,6 +5873,7 @@ void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_TABSTOP,
BASEPROPERTY_TEXT,
BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
BASEPROPERTY_WRITING_MODE,
BASEPROPERTY_CONTEXT_WRITING_MODE,
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx
index 6171067f1185..5ac7a0237479 100644
--- a/toolkit/source/controls/formattedcontrol.cxx
+++ b/toolkit/source/controls/formattedcontrol.cxx
@@ -160,6 +160,7 @@ namespace toolkit
ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
ImplRegisterProperty( BASEPROPERTY_ENFORCE_FORMAT );
+ ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR );
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index 3abacef7b67f..9e508c884f59 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -476,6 +476,7 @@ void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) t
// ----------------------------------------------------
UnoControlFileControlModel::UnoControlFileControlModel()
{
+ ImplRegisterProperty( BASEPROPERTY_ALIGN );
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_BORDER );
ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
@@ -489,6 +490,7 @@ UnoControlFileControlModel::UnoControlFileControlModel()
ImplRegisterProperty( BASEPROPERTY_READONLY );
ImplRegisterProperty( BASEPROPERTY_TABSTOP );
ImplRegisterProperty( BASEPROPERTY_TEXT );
+ ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
diff --git a/tools/inc/tools/multisel.hxx b/tools/inc/tools/multisel.hxx
index 46fd8947e21b..9de3cc172e70 100644
--- a/tools/inc/tools/multisel.hxx
+++ b/tools/inc/tools/multisel.hxx
@@ -35,6 +35,9 @@
#include <tools/list.hxx>
#include <tools/string.hxx>
+#include <vector>
+#include <set>
+
//------------------------------------------------------------------
#ifdef _SV_MULTISEL_CXX
@@ -112,4 +115,105 @@ public:
const Range& GetRange( ULONG nRange ) const { return *(const Range*)aSels.GetObject(nRange); }
};
+class TOOLS_DLLPUBLIC StringRangeEnumerator
+{
+ struct Range
+ {
+ sal_Int32 nFirst;
+ sal_Int32 nLast;
+
+ Range() : nFirst( -1 ), nLast( -1 ) {}
+ Range( sal_Int32 i_nFirst, sal_Int32 i_nLast ) : nFirst( i_nFirst ), nLast( i_nLast ) {}
+ };
+ std::vector< StringRangeEnumerator::Range > maSequence;
+ sal_Int32 mnCount;
+ sal_Int32 mnMin;
+ sal_Int32 mnMax;
+ sal_Int32 mnOffset;
+
+ bool insertRange( sal_Int32 nFirst, sal_Int32 nLast, bool bSequence, bool bMayAdjust );
+ bool checkValue( sal_Int32, const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const;
+public:
+ class TOOLS_DLLPUBLIC Iterator
+ {
+ const StringRangeEnumerator* pEnumerator;
+ const std::set< sal_Int32 >* pPossibleValues;
+ sal_Int32 nRangeIndex;
+ sal_Int32 nCurrent;
+
+ friend class StringRangeEnumerator;
+ Iterator( const StringRangeEnumerator* i_pEnum,
+ const std::set< sal_Int32 >* i_pPossibleValues,
+ sal_Int32 i_nRange,
+ sal_Int32 i_nCurrent )
+ : pEnumerator( i_pEnum ), pPossibleValues( i_pPossibleValues )
+ , nRangeIndex( i_nRange ), nCurrent( i_nCurrent ) {}
+ public:
+ Iterator() : pEnumerator( NULL ), pPossibleValues( NULL ), nRangeIndex( -1 ), nCurrent( -1 ) {}
+ Iterator& operator++();
+ sal_Int32 operator*() const;
+ bool operator==(const Iterator&) const;
+ bool operator!=(const Iterator& i_rComp) const
+ { return ! (*this == i_rComp); }
+ };
+
+ friend class StringRangeEnumerator::Iterator;
+
+ StringRangeEnumerator() : mnCount( 0 ), mnMin( -1 ), mnMax( -1 ), mnOffset( -1 ) {}
+ StringRangeEnumerator( const rtl::OUString& i_rInput,
+ sal_Int32 i_nMinNumber = -1,
+ sal_Int32 i_nMaxNumber = -1,
+ sal_Int32 i_nLogicalOffset = -1
+ );
+
+ size_t size() const { return size_t(mnCount); }
+ Iterator begin( const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const;
+ Iterator end( const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const;
+
+ sal_Int32 getMin() const { return mnMin; }
+ void setMin( sal_Int32 i_nMinValue ) { mnMin = i_nMinValue; }
+ sal_Int32 getMax() const { return mnMax; }
+ void setMax( sal_Int32 i_nMaxValue ) { mnMax = i_nMaxValue; }
+ sal_Int32 getLogicalOffset() const { return mnOffset; }
+ void setLogicalOffset( sal_Int32 i_nOffset ) { mnOffset = i_nOffset; }
+
+ bool setRange( const rtl::OUString& i_rNewRange, bool i_bStrict = false );
+ bool hasValue( sal_Int32 nValue, const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const;
+
+
+ /**
+ i_rPageRange: the string to be changed into a sequence of numbers
+ valid format example "5-3,9,9,7-8" ; instead of ',' ';' or ' ' are allowed as well
+ o_rPageVector: the output sequence of numbers
+ i_nLogicalOffset: an offset to be applied to each number in the string before inserting it in the resulting sequence
+ example: a user enters page numbers from 1 to n (since that is logical)
+ of course usable page numbers in code would start from 0 and end at n-1
+ so the logical offset would be -1
+ i_nMinNumber: the minimum allowed number, a negative number means no minimum check
+ i_nMaxNumber: the maximum allowed number, a negative number means no maximum check
+
+ @returns: true if the input string was valid, o_rPageVector will contain the resulting sequence
+ false if the input string was invalid, o_rPageVector will be unchanged
+
+ behavior:
+ - only non-negative sequence numbers are allowed
+ - only non-negative values in the input string are allowed
+ - the string "-3" will be either
+ * an error if no minimum is given
+ * or result in the sequence i_nMinNumber to 3
+ - the string "3-" will be either
+ * an error if no maximum is given
+ * or result in the seqeuence 3 to i_nMaxNumber
+ - an empty string as input is valid and will result in the range [min,max] if given
+ or an empty vector, if not
+ */
+ static bool getRangesFromString( const rtl::OUString& i_rPageRange,
+ std::vector< sal_Int32 >& o_rPageVector,
+ sal_Int32 i_nMinNumber = -1,
+ sal_Int32 i_nMaxNumber = -1,
+ sal_Int32 i_nLogicalOffset = -1,
+ std::set< sal_Int32 >* i_pPossibleValues = NULL
+ );
+};
+
#endif // _SV_MULTISEL_HXX
diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx
index bacaac89fe44..23496322fa4c 100644
--- a/tools/inc/tools/stream.hxx
+++ b/tools/inc/tools/stream.hxx
@@ -776,6 +776,9 @@ class TOOLS_DLLPUBLIC SvMemoryStream : public SvStream
SvMemoryStream (const SvMemoryStream&);
SvMemoryStream & operator= (const SvMemoryStream&);
+ friend class SvCacheStream;
+ sal_Size GetSize() const { return nSize; }
+
protected:
sal_Size nSize;
sal_Size nResize;
@@ -817,7 +820,7 @@ public:
virtual void ResetError();
- sal_Size GetSize() const { return nSize; }
+ sal_Size GetEndOfData() const { return nEndOfData; }
const void* GetData() { Flush(); return pBuf; }
operator const void*() { Flush(); return pBuf; }
virtual sal_uInt16 IsA() const;
diff --git a/tools/inc/tools/wintypes.hxx b/tools/inc/tools/wintypes.hxx
index a9c23de87ddd..e3d0b55ffdca 100644
--- a/tools/inc/tools/wintypes.hxx
+++ b/tools/inc/tools/wintypes.hxx
@@ -333,5 +333,11 @@ typedef USHORT StandardButtonType;
#define BUTTON_LESS ((StandardButtonType)10)
#define BUTTON_COUNT 11
+// --------------------------------------------
+// - prominent place for ListBox window types -
+// --------------------------------------------
+
+enum ProminentEntry { PROMINENT_TOP, PROMINENT_MIDDLE };
+
#endif // _TOOLS_WINTYPES_HXX
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index f7ffed5e4dd1..e0f711bd2883 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -1022,16 +1022,14 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
if (pEnd - pPos >= 2 && pPos[0] == '/' && pPos[1] == '/')
{
sal_Unicode const * p1 = pPos + 2;
- if (
- p1 == pEnd || *p1 == nFragmentDelimiter || *p1 == '/' ||
- (
- (
- scanDomain(p1, pEnd) > 0 ||
- scanIPv6reference(p1, pEnd)
- ) &&
- (p1 == pEnd || *p1 == nFragmentDelimiter || *p1 == '/')
- )
- )
+ while (p1 != pEnd && *p1 != '/' &&
+ *p1 != nFragmentDelimiter)
+ {
+ ++p1;
+ }
+ if (parseHostOrNetBiosName(
+ pPos + 2, p1, bOctets, ENCODE_ALL,
+ RTL_TEXTENCODING_DONTKNOW, true, NULL))
{
aSynAbsURIRef.
appendAscii(RTL_CONSTASCII_STRINGPARAM("//"));
diff --git a/tools/source/memtools/makefile.mk b/tools/source/memtools/makefile.mk
index 037dadbf4a46..51d831ec0fed 100644
--- a/tools/source/memtools/makefile.mk
+++ b/tools/source/memtools/makefile.mk
@@ -47,6 +47,8 @@ SLOFILES= $(SLO)$/contnr.obj \
$(SLO)$/mempool.obj \
$(SLO)$/multisel.obj
+EXCEPTIONSFILES= $(SLO)$/multisel.obj $(OBJ)$/multisel.obj
+
OBJFILES= $(OBJ)$/contnr.obj \
$(OBJ)$/table.obj \
$(OBJ)$/unqidx.obj \
diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx
index 6b32badc283e..5fe920b6998a 100644
--- a/tools/source/memtools/multisel.cxx
+++ b/tools/source/memtools/multisel.cxx
@@ -41,12 +41,16 @@
#include <tools/debug.hxx>
#include <tools/multisel.hxx>
+#include "rtl/ustrbuf.hxx"
+
#ifdef MI_DEBUG
#define DBG(x) x
#else
#define DBG(x)
#endif
+using namespace rtl;
+
//==================================================================
#ifdef MI_DEBUG
@@ -865,3 +869,297 @@ void MultiSelection::SetTotalRange( const Range& rTotRange )
bCurValid = FALSE;
nCurIndex = 0;
}
+
+// -----------------------------------------------------------------------
+//
+// StringRangeEnumerator
+//
+// -----------------------------------------------------------------------
+StringRangeEnumerator::StringRangeEnumerator( const rtl::OUString& i_rInput,
+ sal_Int32 i_nMinNumber,
+ sal_Int32 i_nMaxNumber,
+ sal_Int32 i_nLogicalOffset
+ )
+ : mnCount( 0 )
+ , mnMin( i_nMinNumber )
+ , mnMax( i_nMaxNumber )
+ , mnOffset( i_nLogicalOffset )
+{
+ setRange( i_rInput );
+}
+
+bool StringRangeEnumerator::checkValue( sal_Int32 i_nValue, const std::set< sal_Int32 >* i_pPossibleValues ) const
+{
+ if( mnMin >= 0 && i_nValue < mnMin )
+ return false;
+ if( mnMax >= 0 && i_nValue > mnMax )
+ return false;
+ if( i_nValue < 0 )
+ return false;
+ if( i_pPossibleValues && i_pPossibleValues->find( i_nValue ) == i_pPossibleValues->end() )
+ return false;
+ return true;
+}
+
+bool StringRangeEnumerator::insertRange( sal_Int32 i_nFirst, sal_Int32 i_nLast, bool bSequence, bool bMayAdjust )
+{
+ bool bSuccess = true;
+ if( bSequence )
+ {
+ if( i_nFirst == -1 )
+ i_nFirst = mnMin;
+ if( i_nLast == -1 )
+ i_nLast = mnMax;
+ if( bMayAdjust )
+ {
+ if( i_nFirst < mnMin )
+ i_nFirst = mnMin;
+ if( i_nFirst > mnMax )
+ i_nFirst = mnMax;
+ if( i_nLast < mnMin )
+ i_nLast = mnMin;
+ if( i_nLast > mnMax )
+ i_nLast = mnMax;
+ }
+ if( checkValue( i_nFirst ) && checkValue( i_nLast ) )
+ {
+ maSequence.push_back( Range( i_nFirst, i_nLast ) );
+ sal_Int32 nNumber = i_nLast - i_nFirst;
+ nNumber = nNumber < 0 ? -nNumber : nNumber;
+ mnCount += nNumber + 1;
+ }
+ else
+ bSuccess = false;
+ }
+ else
+ {
+ if( i_nFirst >= 0 )
+ {
+ if( checkValue( i_nFirst ) )
+ {
+ maSequence.push_back( Range( i_nFirst, i_nFirst ) );
+ mnCount++;
+ }
+ else
+ bSuccess = false;
+ }
+ if( i_nLast >= 0 )
+ {
+ if( checkValue( i_nLast ) )
+ {
+ maSequence.push_back( Range( i_nLast, i_nLast ) );
+ mnCount++;
+ }
+ else
+ bSuccess = false;
+ }
+ }
+
+ return bSuccess;
+}
+
+bool StringRangeEnumerator::setRange( const rtl::OUString& i_rNewRange, bool i_bStrict )
+{
+ mnCount = 0;
+ maSequence.clear();
+
+ // we love special cases
+ if( i_rNewRange.getLength() == 0 )
+ {
+ if( mnMin >= 0 && mnMax >= 0 )
+ {
+ insertRange( mnMin, mnMax, mnMin != mnMax, ! i_bStrict );
+ }
+ return true;
+ }
+
+ const sal_Unicode* pInput = i_rNewRange.getStr();
+ rtl::OUStringBuffer aNumberBuf( 16 );
+ sal_Int32 nLastNumber = -1, nNumber = -1;
+ bool bSequence = false;
+ bool bSuccess = true;
+ while( *pInput )
+ {
+ while( *pInput >= sal_Unicode('0') && *pInput <= sal_Unicode('9') )
+ aNumberBuf.append( *pInput++ );
+ if( aNumberBuf.getLength() )
+ {
+ if( nNumber != -1 )
+ {
+ if( bSequence )
+ {
+ if( ! insertRange( nLastNumber, nNumber, true, ! i_bStrict ) && i_bStrict )
+ {
+ bSuccess = false;
+ break;
+ }
+ nLastNumber = -1;
+ }
+ else
+ {
+ if( ! insertRange( nNumber, nNumber, false, ! i_bStrict ) && i_bStrict )
+ {
+ bSuccess = false;
+ break;
+ }
+ }
+ }
+ nNumber = aNumberBuf.makeStringAndClear().toInt32();
+ nNumber += mnOffset;
+ }
+ bool bInsertRange = false;
+ if( *pInput == sal_Unicode('-') )
+ {
+ nLastNumber = nNumber;
+ nNumber = -1;
+ bSequence = true;
+ }
+ else if( *pInput == ' ' )
+ {
+ }
+ else if( *pInput == sal_Unicode(',') || *pInput == sal_Unicode(';') )
+ bInsertRange = true;
+ else if( *pInput )
+ {
+
+ bSuccess = false;
+ break; // parse error
+ }
+
+ if( bInsertRange )
+ {
+ if( ! insertRange( nLastNumber, nNumber, bSequence, ! i_bStrict ) && i_bStrict )
+ {
+ bSuccess = false;
+ break;
+ }
+ nNumber = nLastNumber = -1;
+ bSequence = false;
+ }
+ if( *pInput )
+ pInput++;
+ }
+ // insert last entries
+ insertRange( nLastNumber, nNumber, bSequence, ! i_bStrict );
+
+ return bSuccess;
+}
+
+bool StringRangeEnumerator::hasValue( sal_Int32 i_nValue, const std::set< sal_Int32 >* i_pPossibleValues ) const
+{
+ if( i_pPossibleValues && i_pPossibleValues->find( i_nValue ) == i_pPossibleValues->end() )
+ return false;
+ size_t n = maSequence.size();
+ for( size_t i= 0; i < n; ++i )
+ {
+ const StringRangeEnumerator::Range rRange( maSequence[i] );
+ if( rRange.nFirst < rRange.nLast )
+ {
+ if( i_nValue >= rRange.nFirst && i_nValue <= rRange.nLast )
+ return true;
+ }
+ else
+ {
+ if( i_nValue >= rRange.nLast && i_nValue <= rRange.nFirst )
+ return true;
+ }
+ }
+ return false;
+}
+
+StringRangeEnumerator::Iterator& StringRangeEnumerator::Iterator::operator++()
+{
+ if( nRangeIndex >= 0 && nCurrent >= 0 && pEnumerator )
+ {
+ const StringRangeEnumerator::Range& rRange( pEnumerator->maSequence[nRangeIndex] );
+ bool bRangeChange = false;
+ if( rRange.nLast < rRange.nFirst )
+ {
+ // backward range
+ if( nCurrent > rRange.nLast )
+ nCurrent--;
+ else
+ bRangeChange = true;
+ }
+ else
+ {
+ // forward range
+ if( nCurrent < rRange.nLast )
+ nCurrent++;
+ else
+ bRangeChange = true;
+ }
+ if( bRangeChange )
+ {
+ nRangeIndex++;
+ if( size_t(nRangeIndex) == pEnumerator->maSequence.size() )
+ {
+ // reached the end
+ nRangeIndex = nCurrent = -1;
+ }
+ else
+ nCurrent = pEnumerator->maSequence[nRangeIndex].nFirst;
+ }
+ if( nRangeIndex != -1 && nCurrent != -1 )
+ {
+ if( ! pEnumerator->checkValue( nCurrent, pPossibleValues ) )
+ return ++(*this);
+ }
+ }
+ return *this;
+}
+
+sal_Int32 StringRangeEnumerator::Iterator::operator*() const
+{
+ return nCurrent;
+}
+
+bool StringRangeEnumerator::Iterator::operator==( const Iterator& i_rCompare ) const
+{
+ return i_rCompare.pEnumerator == pEnumerator && i_rCompare.nRangeIndex == nRangeIndex && i_rCompare.nCurrent == nCurrent;
+}
+
+StringRangeEnumerator::Iterator StringRangeEnumerator::begin( const std::set< sal_Int32 >* i_pPossibleValues ) const
+{
+ StringRangeEnumerator::Iterator it( this,
+ i_pPossibleValues,
+ maSequence.empty() ? -1 : 0,
+ maSequence.empty() ? -1 : maSequence[0].nFirst );
+ if( ! checkValue(*it, i_pPossibleValues ) )
+ ++it;
+ return it;
+}
+
+StringRangeEnumerator::Iterator StringRangeEnumerator::end( const std::set< sal_Int32 >* i_pPossibleValues ) const
+{
+ return StringRangeEnumerator::Iterator( this, i_pPossibleValues, -1, -1 );
+}
+
+bool StringRangeEnumerator::getRangesFromString( const OUString& i_rPageRange,
+ std::vector< sal_Int32 >& o_rPageVector,
+ sal_Int32 i_nMinNumber,
+ sal_Int32 i_nMaxNumber,
+ sal_Int32 i_nLogicalOffset,
+ std::set< sal_Int32 >* i_pPossibleValues
+ )
+{
+ StringRangeEnumerator aEnum;
+ aEnum.setMin( i_nMinNumber );
+ aEnum.setMax( i_nMaxNumber );
+ aEnum.setLogicalOffset( i_nLogicalOffset );
+
+ bool bRes = aEnum.setRange( i_rPageRange );
+ if( bRes )
+ {
+ o_rPageVector.clear();
+ o_rPageVector.reserve( aEnum.size() );
+ for( StringRangeEnumerator::Iterator it = aEnum.begin( i_pPossibleValues );
+ it != aEnum.end( i_pPossibleValues ); ++it )
+ {
+ o_rPageVector.push_back( *it );
+ }
+ }
+
+ return bRes;
+}
+
diff --git a/tools/workben/urltest.cxx b/tools/workben/urltest.cxx
index a232f8ebdd93..0e9d22081cb4 100644
--- a/tools/workben/urltest.cxx
+++ b/tools/workben/urltest.cxx
@@ -1629,6 +1629,20 @@ main()
rtl::OUString(urlobj.GetMainURL(INetURLObject::NO_DECODE)));
}
+ if (true) { // #i53184#
+ rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM("file://comp_name/path"));
+ bSuccess &= assertEqual(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("#i53184# smart INET_PROT_FILE")),
+ INetURLObject(url, INET_PROT_FILE).GetMainURL(
+ INetURLObject::NO_DECODE),
+ url);
+ bSuccess &= assertEqual(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("#i53184# strict")),
+ INetURLObject(url).GetMainURL(INetURLObject::NO_DECODE), url);
+ }
+
if (true) {
rtl::OUString path;
path = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/a/b/c"));
diff --git a/transex3/prj/build.lst b/transex3/prj/build.lst
deleted file mode 100644
index 0017471af134..000000000000
--- a/transex3/prj/build.lst
+++ /dev/null
@@ -1,10 +0,0 @@
-tr transex3 : tools libxslt berkeleydb LUCENE:lucene NULL
-tr transex3 usr1 - all tr_mkout NULL
-tr transex3\inc nmake - all tr_inc NULL
-tr transex3\source nmake - all tr_src tr_inc NULL
-tr transex3\layout nmake - all rt_layout tr_src tr_inc NULL
-tr transex3\java\l10nconv nmake - all tr_conv NULL
-tr transex3\java\receditor nmake - all tr_rece NULL
-tr transex3\source\help nmake - all tr_bla_help NULL
-tr transex3\source\filter\utils nmake - all tr_bla_utils NULL
-tr transex3\source\filter\merge nmake - all tr_bla_merge tr_bla_utils NULL
diff --git a/ucbhelper/inc/ucbhelper/content.hxx b/ucbhelper/inc/ucbhelper/content.hxx
index 03cfa0bc8290..fde86609e850 100644
--- a/ucbhelper/inc/ucbhelper/content.hxx
+++ b/ucbhelper/inc/ucbhelper/content.hxx
@@ -60,6 +60,7 @@ namespace com { namespace sun { namespace star { namespace ucb {
class XContentIdentifier;
class XDynamicResultSet;
class XAnyCompareFactory;
+ struct ContentInfo;
struct NumberedSortingInfo;
} } } }
@@ -70,7 +71,7 @@ namespace ucbhelper
/**
* These are the possible values for the parameter eMode of method
- * ucb::Content::createCursor.
+ * ucbhelper::Content::createCursor.
*/
enum ResultSetInclude
{
@@ -81,7 +82,7 @@ enum ResultSetInclude
/**
* These are the possible values for the parameter eOperation of method
- * ucb::Content::insertNewContent.
+ * ucbhelper::Content::insertNewContent.
*/
enum InsertOperation
{
@@ -106,14 +107,14 @@ class UCBHELPER_DLLPUBLIC Content
protected:
::com::sun::star::uno::Any createCursorAny( const ::com::sun::star::uno::Sequence<
rtl::OUString >& rPropertyNames,
- ResultSetInclude eMode )
+ ResultSetInclude eMode )
throw( ::com::sun::star::ucb::CommandAbortedException,
::com::sun::star::uno::RuntimeException,
::com::sun::star::uno::Exception );
::com::sun::star::uno::Any createCursorAny( const ::com::sun::star::uno::Sequence<
sal_Int32 >& rPropertyHandles,
- ResultSetInclude eMode )
+ ResultSetInclude eMode )
throw( ::com::sun::star::ucb::CommandAbortedException,
::com::sun::star::uno::RuntimeException,
::com::sun::star::uno::Exception );
@@ -148,7 +149,7 @@ public:
* errors.
*/
Content( const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContentIdentifier >& rId,
+ ::com::sun::star::ucb::XContentIdentifier >& rId,
const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& rEnv )
throw ( ::com::sun::star::ucb::ContentCreationException,
@@ -163,7 +164,7 @@ public:
* errors.
*/
Content( const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContent >& rContent,
+ ::com::sun::star::ucb::XContent >& rContent,
const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& rEnv )
throw ( ::com::sun::star::ucb::ContentCreationException,
@@ -221,7 +222,7 @@ public:
*/
static sal_Bool
create( const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContentIdentifier >& rId,
+ ::com::sun::star::ucb::XContentIdentifier >& rId,
const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& rEnv,
Content& rContent );
@@ -241,7 +242,7 @@ public:
*/
static sal_Bool
create( const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContent >& xContent,
+ ::com::sun::star::ucb::XContent >& xContent,
const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& rEnv,
Content& rContent );
@@ -501,7 +502,7 @@ public:
setPropertyValues( const ::com::sun::star::uno::Sequence<
rtl::OUString >& rPropertyNames,
const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Any >& rValues )
+ ::com::sun::star::uno::Any >& rValues )
throw( ::com::sun::star::ucb::CommandAbortedException,
::com::sun::star::uno::RuntimeException,
::com::sun::star::uno::Exception );
@@ -539,7 +540,7 @@ public:
setPropertyValues( const ::com::sun::star::uno::Sequence<
sal_Int32 >& nPropertyHandles,
const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Any >& rValues )
+ ::com::sun::star::uno::Any >& rValues )
throw( ::com::sun::star::ucb::CommandAbortedException,
::com::sun::star::uno::RuntimeException,
::com::sun::star::uno::Exception );
@@ -655,8 +656,8 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet >
createDynamicCursor( const ::com::sun::star::uno::Sequence<
rtl::OUString >& rPropertyNames,
- ResultSetInclude eMode
- = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ ResultSetInclude eMode
+ = INCLUDE_FOLDERS_AND_DOCUMENTS )
throw( ::com::sun::star::ucb::CommandAbortedException,
::com::sun::star::uno::RuntimeException,
::com::sun::star::uno::Exception );
@@ -678,8 +679,8 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet >
createDynamicCursor( const ::com::sun::star::uno::Sequence<
sal_Int32 >& rPropertyHandles,
- ResultSetInclude eMode
- = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ ResultSetInclude eMode
+ = INCLUDE_FOLDERS_AND_DOCUMENTS )
throw( ::com::sun::star::ucb::CommandAbortedException,
::com::sun::star::uno::RuntimeException,
::com::sun::star::uno::Exception );
@@ -821,16 +822,31 @@ public:
throw( ::com::sun::star::ucb::CommandAbortedException,
::com::sun::star::uno::RuntimeException,
::com::sun::star::uno::Exception );
+
+ /**
+ * This method returns the different types of contents this content
+ * can create.
+ *
+ * @return the content types or an empty sequence if no contents can be
+ * created by this content.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::ContentInfo >
+ queryCreatableContentsInfo()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
/**
* This method creates, initializes and inserts ( commits ) a new content
* (i.e. it could be used to create a new file system folder).
- * Internally this method does a XContentCreator::createNewContent(...)-
- * XCommandProcessor::execute( "setPropertyValues", ... )-
- * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ * Internally this method does a
+ * XCommandProcessor::execute( "createNewContent", ... );
+ * XCommandProcessor::execute( "setPropertyValues", ... );
+ * XCommandProcessor::execute( "insert", ... ); calling sequence.
*
* @param rContentType is the type for the new UCB content. Each content
- * provider implementation may introduce own types for its contnt
- * objects.
+ * provider implementation may introduce own types for its content
+ * objects (See queryCreatableContentsInfo()).
* @param rPropertyNames is a sequence of names of properties for that
* values are to set at the new content before it will be inserted
* ( commited ).
@@ -846,9 +862,9 @@ public:
sal_Bool
insertNewContent( const ::rtl::OUString& rContentType,
const ::com::sun::star::uno::Sequence<
- rtl::OUString >& rPropertyNames,
+ rtl::OUString >& rPropertyNames,
const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Any >& rPropertyValues,
+ ::com::sun::star::uno::Any >& rPropertyValues,
Content& rNewContent )
throw( ::com::sun::star::ucb::CommandAbortedException,
::com::sun::star::uno::RuntimeException,
@@ -856,13 +872,14 @@ public:
/**
* This method creates, initializes and inserts ( commits ) a new content
* (i.e. it could be used to create a new file system folder).
- * Internally this method does a XContentCreator::createNewContent(...)-
- * XCommandProcessor::execute( "setPropertyValues", ... )-
- * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ * Internally this method does a
+ * XCommandProcessor::execute( "createNewContent", ... );
+ * XCommandProcessor::execute( "setPropertyValues", ... );
+ * XCommandProcessor::execute( "insert", ... ); calling sequence.
*
* @param rContentType is the type for the new UCB content. Each content
- * provider implementation may introduce own types for its contnt
- * objects.
+ * provider implementation may introduce own types for its content
+ * objects (See queryCreatableContentsInfo()).
* @param nPropertyHandes is a sequence of handles of properties for that
* values are to set at the new content before it will be inserted
* ( commited ).
@@ -880,7 +897,7 @@ public:
const ::com::sun::star::uno::Sequence<
sal_Int32 >& nPropertyHandles,
const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Any >& rPropertyValues,
+ ::com::sun::star::uno::Any >& rPropertyValues,
Content& rNewContent )
throw( ::com::sun::star::ucb::CommandAbortedException,
::com::sun::star::uno::RuntimeException,
@@ -888,14 +905,15 @@ public:
/**
* This method creates, initializes and inserts (commits) a new content
* inside this (the target folder) content. For example, it can be used to
- * create a new file system folder.
- * Internally this method does a XContentCreator::createNewContent(...)-
- * XCommandProcessor::execute( "setPropertyValues", ... )-
- * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ * create a new file system file.
+ * Internally this method does a
+ * XCommandProcessor::execute( "createNewContent", ... );
+ * XCommandProcessor::execute( "setPropertyValues", ... );
+ * XCommandProcessor::execute( "insert", ... ); calling sequence.
*
* @param rContentType is the type for the new UCB content. Each content
- * provider implementation may introduce own types for its contnt
- * objects.
+ * provider implementation may introduce own types for its content
+ * objects (See queryCreatableContentsInfo()).
* @param rPropertyNames is a sequence of names of properties for that
* values are to set at the new content before it will be inserted
* ( commited ).
@@ -913,9 +931,9 @@ public:
sal_Bool
insertNewContent( const ::rtl::OUString& rContentType,
const ::com::sun::star::uno::Sequence<
- rtl::OUString >& rPropertyNames,
+ rtl::OUString >& rPropertyNames,
const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Any >& rPropertyValues,
+ ::com::sun::star::uno::Any >& rPropertyValues,
const ::com::sun::star::uno::Reference<
::com::sun::star::io::XInputStream >& rStream,
Content& rNewContent )
@@ -925,14 +943,15 @@ public:
/**
* This method creates, initializes and inserts (commits) a new content
* inside this (the target folder) content. For example, it can be used to
- * create a new file system folder.
- * Internally this method does a XContentCreator::createNewContent(...)-
- * XCommandProcessor::execute( "setPropertyValues", ... )-
- * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ * create a new file system file.
+ * Internally this method does a
+ * XCommandProcessor::execute( "createNewContent", ... );
+ * XCommandProcessor::execute( "setPropertyValues", ... );
+ * XCommandProcessor::execute( "insert", ... ); calling sequence.
*
* @param rContentType is the type for the new UCB content. Each content
- * provider implementation may introduce own types for its contnt
- * objects.
+ * provider implementation may introduce own types for its content
+ * objects (See queryCreatableContentsInfo()).
* @param nPropertyHandes is a sequence of handles of properties for that
* values are to set at the new content before it will be inserted
* ( commited ).
@@ -952,7 +971,7 @@ public:
const ::com::sun::star::uno::Sequence<
sal_Int32 >& nPropertyHandles,
const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Any >& rPropertyValues,
+ ::com::sun::star::uno::Any >& rPropertyValues,
const ::com::sun::star::uno::Reference<
::com::sun::star::io::XInputStream >& rStream,
Content& rNewContent )
diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx
index c82a0bc19b77..28eef297e85f 100644
--- a/ucbhelper/source/client/content.cxx
+++ b/ucbhelper/source/client/content.cxx
@@ -73,9 +73,7 @@
#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/activedatasink.hxx>
#include <ucbhelper/activedatastreamer.hxx>
-#ifndef _UCBHELPER_INTERACTIONREQUEST_HXX
#include <ucbhelper/interactionrequest.hxx>
-#endif
#include <ucbhelper/cancelcommandexecution.hxx>
using namespace com::sun::star::container;
@@ -149,7 +147,7 @@ void EmptyInputStream::closeInput()
//=========================================================================
class ContentEventListener_Impl : public cppu::OWeakObject,
- public XContentEventListener
+ public XContentEventListener
{
Content_Impl& m_rContent;
@@ -157,7 +155,7 @@ public:
ContentEventListener_Impl( Content_Impl& rContent )
: m_rContent( rContent ) {}
- // XInterface
+ // XInterface
XINTERFACE_DECL()
// XContentEventListener
@@ -184,8 +182,8 @@ friend class ContentEventListener_Impl;
mutable rtl::OUString m_aURL;
Reference< XMultiServiceFactory > m_xSMgr;
Reference< XContent > m_xContent;
- Reference< XCommandProcessor > m_xCommandProcessor;
- Reference< XCommandEnvironment > m_xEnv;
+ Reference< XCommandProcessor > m_xCommandProcessor;
+ Reference< XCommandEnvironment > m_xEnv;
Reference< XContentEventListener > m_xContentEventListener;
mutable osl::Mutex m_aMutex;
sal_Int32 m_nCommandId;
@@ -210,6 +208,7 @@ public:
Any executeCommand( const Command& rCommand );
void abortCommand();
+
inline const Reference< XCommandEnvironment >& getEnvironment() const;
inline void setEnvironment(
const Reference< XCommandEnvironment >& xNewEnv );
@@ -587,7 +586,7 @@ Any Content::getPropertyValue( sal_Int32 nPropertyHandle )
//=========================================================================
Any Content::setPropertyValue( const rtl::OUString& rName,
- const Any& rValue )
+ const Any& rValue )
throw( CommandAbortedException, RuntimeException, Exception )
{
Sequence< rtl::OUString > aNames( 1 );
@@ -602,7 +601,7 @@ Any Content::setPropertyValue( const rtl::OUString& rName,
//=========================================================================
Any Content::setPropertyValue( const sal_Int32 nPropertyHandle,
- const Any& rValue )
+ const Any& rValue )
throw( CommandAbortedException, RuntimeException, Exception )
{
Sequence< sal_Int32 > aHandles( 1 );
@@ -674,8 +673,8 @@ Reference< XRow > Content::getPropertyValuesInterface(
rProp.Name = pNames[ n ];
rProp.Handle = -1; // n/a
-// rProp.Type =
-// rProp.Attributes = ;
+// rProp.Type =
+// rProp.Attributes = ;
}
Command aCommand;
@@ -707,8 +706,8 @@ Reference< XRow > Content::getPropertyValuesInterface(
rProp.Name = rtl::OUString(); // n/a
rProp.Handle = pHandles[ n ];
-// rProp.Type =
-// rProp.Attributes = ;
+// rProp.Type =
+// rProp.Attributes = ;
}
Command aCommand;
@@ -726,7 +725,7 @@ Reference< XRow > Content::getPropertyValuesInterface(
//=========================================================================
Sequence< Any > Content::setPropertyValues(
const Sequence< rtl::OUString >& rPropertyNames,
- const Sequence< Any >& rValues )
+ const Sequence< Any >& rValues )
throw( CommandAbortedException, RuntimeException, Exception )
{
if ( rPropertyNames.getLength() != rValues.getLength() )
@@ -756,7 +755,7 @@ Sequence< Any > Content::setPropertyValues(
rProp.Name = pNames[ n ];
rProp.Handle = -1; // n/a
rProp.Value = pValues[ n ];
-// rProp.State = ;
+// rProp.State = ;
}
Command aCommand;
@@ -774,7 +773,7 @@ Sequence< Any > Content::setPropertyValues(
//=========================================================================
Sequence< Any > Content::setPropertyValues(
const Sequence< sal_Int32 >& nPropertyHandles,
- const Sequence< Any >& rValues )
+ const Sequence< Any >& rValues )
throw( CommandAbortedException, RuntimeException, Exception )
{
if ( nPropertyHandles.getLength() != rValues.getLength() )
@@ -804,7 +803,7 @@ Sequence< Any > Content::setPropertyValues(
rProp.Name = rtl::OUString(); // n/a
rProp.Handle = pHandles[ n ];
rProp.Value = pValues[ n ];
-// rProp.State = ;
+// rProp.State = ;
}
Command aCommand;
@@ -934,7 +933,7 @@ Reference< XResultSet > Content::createCursor(
OSL_ENSURE( aResult.is(), "Content::createCursor - no cursor!" );
- if ( !aResult.is() )
+ if ( !aResult.is() )
{
// Former, the open command directly returned a XResultSet.
aCursorAny >>= aResult;
@@ -964,7 +963,7 @@ Reference< XResultSet > Content::createCursor(
OSL_ENSURE( aResult.is(), "Content::createCursor - no cursor!" );
- if ( !aResult.is() )
+ if ( !aResult.is() )
{
// Former, the open command directly returned a XResultSet.
aCursorAny >>= aResult;
@@ -1008,7 +1007,7 @@ Reference< XDynamicResultSet > Content::createDynamicCursor(
//=========================================================================
Reference< XDynamicResultSet > Content::createSortedDynamicCursor(
const Sequence< rtl::OUString >& rPropertyNames,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo,
+ const Sequence< NumberedSortingInfo >& rSortInfo,
Reference< XAnyCompareFactory > rAnyCompareFactory,
ResultSetInclude eMode )
throw( CommandAbortedException, RuntimeException, Exception )
@@ -1043,7 +1042,7 @@ Reference< XDynamicResultSet > Content::createSortedDynamicCursor(
//=========================================================================
Reference< XDynamicResultSet > Content::createSortedDynamicCursor(
const Sequence< sal_Int32 >& rPropertyHandles,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo,
+ const Sequence< NumberedSortingInfo >& rSortInfo,
Reference< XAnyCompareFactory > rAnyCompareFactory,
ResultSetInclude eMode )
throw( CommandAbortedException, RuntimeException, Exception )
@@ -1078,7 +1077,7 @@ Reference< XDynamicResultSet > Content::createSortedDynamicCursor(
//=========================================================================
Reference< XResultSet > Content::createSortedCursor(
const Sequence< rtl::OUString >& rPropertyNames,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo,
+ const Sequence< NumberedSortingInfo >& rSortInfo,
Reference< XAnyCompareFactory > rAnyCompareFactory,
ResultSetInclude eMode )
throw( CommandAbortedException, RuntimeException, Exception )
@@ -1132,7 +1131,7 @@ Reference< XResultSet > Content::createSortedCursor(
//=========================================================================
Reference< XResultSet > Content::createSortedCursor(
const Sequence< sal_Int32 >& rPropertyHandles,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo,
+ const Sequence< NumberedSortingInfo >& rSortInfo,
Reference< XAnyCompareFactory > rAnyCompareFactory,
ResultSetInclude eMode )
throw( CommandAbortedException, RuntimeException, Exception )
@@ -1331,7 +1330,7 @@ sal_Bool Content::openStream( const Reference< XOutputStream >& rStream )
//=========================================================================
void Content::writeStream( const Reference< XInputStream >& rStream,
- sal_Bool bReplaceExisting )
+ sal_Bool bReplaceExisting )
throw( CommandAbortedException, RuntimeException, Exception )
{
InsertCommandArgument aArg;
@@ -1349,11 +1348,31 @@ void Content::writeStream( const Reference< XInputStream >& rStream,
}
//=========================================================================
+Sequence< ContentInfo > Content::queryCreatableContentsInfo()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ // First, try it using "CreatableContentsInfo" property -> the "new" way.
+ Sequence< ContentInfo > aInfo;
+ if ( getPropertyValue(
+ rtl::OUString::createFromAscii( "CreatableContentsInfo" ) )
+ >>= aInfo )
+ return aInfo;
+
+ // Second, try it using XContentCreator interface -> the "old" way (not
+ // providing the chance to supply an XCommandEnvironment.
+ Reference< XContentCreator > xCreator( m_xImpl->getContent(), UNO_QUERY );
+ if ( xCreator.is() )
+ aInfo = xCreator->queryCreatableContentsInfo();
+
+ return aInfo;
+}
+
+//=========================================================================
sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
const Sequence< rtl::OUString >&
rPropertyNames,
- const Sequence< Any >& rPropertyValues,
- Content& rNewContent )
+ const Sequence< Any >& rPropertyValues,
+ Content& rNewContent )
throw( CommandAbortedException, RuntimeException, Exception )
{
return insertNewContent( rContentType,
@@ -1367,8 +1386,8 @@ sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
const Sequence< sal_Int32 >&
nPropertyHandles,
- const Sequence< Any >& rPropertyValues,
- Content& rNewContent )
+ const Sequence< Any >& rPropertyValues,
+ Content& rNewContent )
throw( CommandAbortedException, RuntimeException, Exception )
{
return insertNewContent( rContentType,
@@ -1382,29 +1401,51 @@ sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
const Sequence< rtl::OUString >&
rPropertyNames,
- const Sequence< Any >& rPropertyValues,
+ const Sequence< Any >& rPropertyValues,
const Reference< XInputStream >& rData,
- Content& rNewContent )
+ Content& rNewContent )
throw( CommandAbortedException, RuntimeException, Exception )
{
if ( rContentType.getLength() == 0 )
return sal_False;
- Reference< XContentCreator > xCreator( m_xImpl->getContent(), UNO_QUERY );
-
- OSL_ENSURE( xCreator.is(),
- "Content::insertNewContent - Not a XContentCreator!" );
-
- if ( !xCreator.is() )
- return sal_False;
-
+ // First, try it using "createNewContent" command -> the "new" way.
ContentInfo aInfo;
aInfo.Type = rContentType;
aInfo.Attributes = 0;
- Reference< XContent > xNew = xCreator->createNewContent( aInfo );
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "createNewContent" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aInfo;
+
+ Reference< XContent > xNew;
+ try
+ {
+ m_xImpl->executeCommand( aCommand ) >>= xNew;
+ }
+ catch ( RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( Exception const & )
+ {
+ }
+
if ( !xNew.is() )
- return sal_False;
+ {
+ // Second, try it using XContentCreator interface -> the "old"
+ // way (not providing the chance to supply an XCommandEnvironment.
+ Reference< XContentCreator > xCreator( m_xImpl->getContent(), UNO_QUERY );
+
+ if ( !xCreator.is() )
+ return sal_False;
+
+ xNew = xCreator->createNewContent( aInfo );
+
+ if ( !xNew.is() )
+ return sal_False;
+ }
Content aNewContent( xNew, m_xImpl->getEnvironment() );
aNewContent.setPropertyValues( rPropertyNames, rPropertyValues );
@@ -1423,29 +1464,51 @@ sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
const Sequence< sal_Int32 >&
nPropertyHandles,
- const Sequence< Any >& rPropertyValues,
+ const Sequence< Any >& rPropertyValues,
const Reference< XInputStream >& rData,
- Content& rNewContent )
+ Content& rNewContent )
throw( CommandAbortedException, RuntimeException, Exception )
{
if ( rContentType.getLength() == 0 )
return sal_False;
- Reference< XContentCreator > xCreator( m_xImpl->getContent(), UNO_QUERY );
-
- OSL_ENSURE( xCreator.is(),
- "Content::insertNewContent - Not a XContentCreator!" );
-
- if ( !xCreator.is() )
- return sal_False;
-
+ // First, try it using "createNewContent" command -> the "new" way.
ContentInfo aInfo;
aInfo.Type = rContentType;
aInfo.Attributes = 0;
- Reference< XContent > xNew = xCreator->createNewContent( aInfo );
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "createNewContent" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aInfo;
+
+ Reference< XContent > xNew;
+ try
+ {
+ m_xImpl->executeCommand( aCommand ) >>= xNew;
+ }
+ catch ( RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( Exception const & )
+ {
+ }
+
if ( !xNew.is() )
- return sal_False;
+ {
+ // Second, try it using XContentCreator interface -> the "old"
+ // way (not providing the chance to supply an XCommandEnvironment.
+ Reference< XContentCreator > xCreator( m_xImpl->getContent(), UNO_QUERY );
+
+ if ( !xCreator.is() )
+ return sal_False;
+
+ xNew = xCreator->createNewContent( aInfo );
+
+ if ( !xNew.is() )
+ return sal_False;
+ }
Content aNewContent( xNew, m_xImpl->getEnvironment() );
aNewContent.setPropertyValues( nPropertyHandles, rPropertyValues );
@@ -1464,7 +1527,7 @@ sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
sal_Bool Content::transferContent( const Content& rSourceContent,
InsertOperation eOperation,
const rtl::OUString & rTitle,
- const sal_Int32 nNameClashAction )
+ const sal_Int32 nNameClashAction )
throw( CommandAbortedException, RuntimeException, Exception )
{
ContentBroker* pBroker = ContentBroker::get();
@@ -1578,8 +1641,8 @@ sal_Bool Content::isDocument()
//=========================================================================
Content_Impl::Content_Impl( const Reference< XMultiServiceFactory >& rSMgr,
- const Reference< XContent >& rContent,
- const Reference< XCommandEnvironment >& rEnv )
+ const Reference< XContent >& rContent,
+ const Reference< XCommandEnvironment >& rEnv )
: m_xSMgr( rSMgr ),
m_xContent( rContent ),
m_xEnv( rEnv ),
diff --git a/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx b/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx
index 51490ed40296..9a41c55ccfd8 100644
--- a/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx
+++ b/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx
@@ -38,12 +38,10 @@
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
-#ifndef _COM_SUN_STAR_UCB_XCOMMMANDINFO_HPP_
#include <com/sun/star/ucb/XCommandInfo.hpp>
-#endif
#include <com/sun/star/ucb/XContentAccess.hpp>
-#include <com/sun/star/ucb/XContentCreator.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#include <com/sun/star/ucb/ContentInfo.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include "rtl/ref.hxx"
@@ -57,9 +55,7 @@
#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
#include <vcl/group.hxx>
-#ifndef _SV_BUTTON_HXX
#include <vcl/button.hxx>
-#endif
#include <vcl/msgbox.hxx>
#include <ucbhelper/macros.hxx>
#include <ucbhelper/configurationkeys.hxx>
@@ -89,8 +85,8 @@ class TestDataSink : public cppu::OWeakObject, public XActiveDataSink
uno::Reference< XInputStream > m_xStream;
public:
-// TestDataSink() {}
-// virtual ~TestDataSink();
+// TestDataSink() {}
+// virtual ~TestDataSink();
// XInterface methods
virtual Any SAL_CALL queryInterface( const Type & rType )
@@ -128,7 +124,8 @@ private:
DECL_LINK( NameHdl, Edit * );
public:
- StringInputDialog( const String& rTitle,
+ StringInputDialog( ResMgr& rResMgr,
+ const String& rTitle,
const String& rDefaultText,
String* pGroupName = 0 );
String GetValue() const { return m_aNameEdit.GetText(); }
@@ -147,15 +144,15 @@ class UcbExplorerListBoxEntry : public SvLBoxEntry
enum EntryType { FOLDER, DOCUMENT, LINK };
- ::ucb::Content m_aContent;
- EntryType m_eType;
+ ::ucbhelper::Content m_aContent;
+ EntryType m_eType;
public:
UcbExplorerListBoxEntry();
virtual ~UcbExplorerListBoxEntry();
BOOL createNewContent( const ContentInfo& rInfo,
- ::ucb::Content& rNewContent );
+ ::ucbhelper::Content& rNewContent );
};
//=========================================================================
@@ -176,13 +173,13 @@ private:
virtual void RequestingChilds( SvLBoxEntry* pParent );
public:
- UcbExplorerTreeListBox( Window* pParent, WinBits nWinStyle = 0 );
+ UcbExplorerTreeListBox( ResMgr & rResMgr, Window* pParent, WinBits nWinStyle = 0 );
virtual ~UcbExplorerTreeListBox();
virtual void Command( const CommandEvent& rCEvt );
UcbExplorerListBoxEntry*
- InsertEntry( ::ucb::Content& rContent, SvLBoxEntry* pParent );
+ InsertEntry( ::ucbhelper::Content& rContent, SvLBoxEntry* pParent );
UcbExplorerListBoxEntry*
InsertEntry( const String& rURL, SvLBoxEntry* pParent = 0 );
};
@@ -200,7 +197,7 @@ class UcbExplorerWindow : public WorkWindow
UcbExplorerTreeListBox m_aTree;
public:
- UcbExplorerWindow( Window *pParent, WinBits nWinStyle );
+ UcbExplorerWindow( ResMgr & rResMgr, Window *pParent, WinBits nWinStyle );
virtual ~UcbExplorerWindow();
virtual void Resize();
@@ -230,7 +227,7 @@ Any SAL_CALL TestDataSink::queryInterface( const Type & rType )
{
Any aRet = cppu::queryInterface(
rType,
- static_cast< XActiveDataSink * >( this ) );
+ static_cast< XActiveDataSink * >( this ) );
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
}
@@ -273,16 +270,17 @@ uno::Reference< XInputStream > SAL_CALL TestDataSink::getInputStream()
//
//=========================================================================
-StringInputDialog::StringInputDialog( const String& rTitle,
+StringInputDialog::StringInputDialog( ResMgr& rResMgr,
+ const String& rTitle,
const String& rDefaultText,
String* pGroupName )
-: ModalDialog( 0, ResId( DLG_STRINGINPUT ) ),
- m_aNameText ( this, ResId( FT_STRINGINPUT_DLG_NAME ) ),
- m_aNameEdit ( this, ResId( ED_STRINGINPUT_DLG_NAME ) ),
- m_aNameGroup( this, ResId( GB_STRINGINPUT_DLG_NAME ) ),
- m_aOKBtn ( this, ResId( BT_STRINGINPUT_DLG_OK ) ),
- m_aCancelBtn( this, ResId( BT_STRINGINPUT_DLG_CANCEL ) ),
- m_aHelpBtn ( this, ResId( BT_STRINGINPUT_DLG_HELP ) )
+ : ModalDialog( 0, ResId( DLG_STRINGINPUT, rResMgr ) ),
+ m_aNameText ( this, ResId( FT_STRINGINPUT_DLG_NAME, rResMgr ) ),
+ m_aNameEdit ( this, ResId( ED_STRINGINPUT_DLG_NAME, rResMgr ) ),
+ m_aNameGroup( this, ResId( GB_STRINGINPUT_DLG_NAME, rResMgr ) ),
+ m_aOKBtn ( this, ResId( BT_STRINGINPUT_DLG_OK, rResMgr ) ),
+ m_aCancelBtn( this, ResId( BT_STRINGINPUT_DLG_CANCEL, rResMgr ) ),
+ m_aHelpBtn ( this, ResId( BT_STRINGINPUT_DLG_HELP, rResMgr ) )
{
FreeResource();
SetText( rTitle );
@@ -343,7 +341,7 @@ UcbExplorerListBoxEntry::~UcbExplorerListBoxEntry()
//=========================================================================
BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
- ::ucb::Content& rNewContent )
+ ::ucbhelper::Content& rNewContent )
{
sal_Int32 nCount = rInfo.Properties.getLength();
Sequence< Any > aPropValues( nCount );
@@ -358,7 +356,10 @@ BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
for ( sal_Int32 n = 0; n < nCount; ++n )
{
const OUString& rName = pProps[ n ].Name;
- StringInputDialog* pDlg = new StringInputDialog( rName, rName );
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( ucbexplorer ) ) );
+ StringInputDialog* pDlg = new StringInputDialog( *xManager.get(), rName, rName );
USHORT nRet = pDlg->Execute();
if ( nRet == RET_OK )
{
@@ -444,7 +445,10 @@ BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
// Let the user specify the URL of a content containing the
// data to supply to the new content.
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( ucbexplorer ) ) );
StringInputDialog* pDlg = new StringInputDialog(
+ *xManager.get(),
OUString::createFromAscii(
"Document Data Source URL" ),
OUString() );
@@ -457,7 +461,7 @@ BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
if ( aSourceURL.getLength() == 0 )
{
DBG_ERROR( "UcbExplorerListBoxEntry::createNewContent - "
- "No document data URL!" );
+ "No document data URL!" );
return FALSE;
}
@@ -465,11 +469,11 @@ BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
{
uno::Reference< XCommandEnvironment > xEnv;
- ::ucb::ContentBroker* pBroker = ::ucb::ContentBroker::get();
+ ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
if ( pBroker )
{
uno::Reference< XInteractionHandler > xInteractionHandler(
- pBroker->getServiceManager()->createInstance(
+ pBroker->getServiceManager()->createInstance(
OUString::createFromAscii(
"com.sun.star.task.InteractionHandler" ) ),
UNO_QUERY );
@@ -477,21 +481,21 @@ BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
uno::Reference< XProgressHandler > xProgressHandler
/* = new ProgressHandler( *pBroker ) */ ;
- xEnv = new ::ucb::CommandEnvironment( xInteractionHandler,
- xProgressHandler );
+ xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler,
+ xProgressHandler );
}
- ::ucb::Content aSourceContent( aSourceURL, xEnv );
+ ::ucbhelper::Content aSourceContent( aSourceURL, xEnv );
// Get source data.
rtl::Reference< TestDataSink > xSourceData = new TestDataSink;
- aSourceContent.openStream( xSourceData.getBodyPtr() );
+ aSourceContent.openStream( xSourceData.get() );
xData = xSourceData->getInputStream();
}
catch ( ContentCreationException const & )
{
DBG_ERROR( "UcbExplorerListBoxEntry::createNewContent - "
- "No content for document data!" );
+ "No content for document data!" );
return FALSE;
}
catch ( CommandAbortedException const & )
@@ -516,7 +520,7 @@ BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
// Create new content.
- ULONG n = Application::ReleaseSolarMutex();
+ ULONG n = Application::ReleaseSolarMutex();
BOOL bRet = sal_False;
try
@@ -545,13 +549,14 @@ BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
//
//=========================================================================
-UcbExplorerTreeListBox::UcbExplorerTreeListBox(
- Window* pParent, WinBits nWinStyle )
+UcbExplorerTreeListBox::UcbExplorerTreeListBox( ResMgr & rResMgr,
+ Window* pParent,
+ WinBits nWinStyle )
: SvTreeListBox( pParent, nWinStyle ),
- m_aFolderClosed( ResId( BMP_FOLDER_CLOSED ) ),
- m_aFolderOpened( ResId( BMP_FOLDER_OPENED ) ),
- m_aDocument( ResId( BMP_DOCUMENT ) ),
- m_aLink( ResId( BMP_LINK ) )
+ m_aFolderClosed( ResId( BMP_FOLDER_CLOSED, rResMgr ) ),
+ m_aFolderOpened( ResId( BMP_FOLDER_OPENED, rResMgr ) ),
+ m_aDocument( ResId( BMP_DOCUMENT, rResMgr ) ),
+ m_aLink( ResId( BMP_LINK, rResMgr ) )
{
}
@@ -580,18 +585,18 @@ void UcbExplorerTreeListBox::RequestingChilds( SvLBoxEntry* pParent )
{
case UcbExplorerListBoxEntry::FOLDER:
{
- ULONG n = Application::ReleaseSolarMutex();
+ ULONG n = Application::ReleaseSolarMutex();
try
{
Sequence< OUString > aPropertyNames( 0 );
-// OUString* pNames = aPropertyNames.getArray();
-// pNames[ 0 ] = OUString::createFromAscii( "Title" );
+// OUString* pNames = aPropertyNames.getArray();
+// pNames[ 0 ] = OUString::createFromAscii( "Title" );
uno::Reference< XResultSet > xResultSet
= pEntry->m_aContent.createCursor(
aPropertyNames,
- ::ucb::INCLUDE_FOLDERS_AND_DOCUMENTS );
+ ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS );
uno::Reference< XContentAccess > xContentAccess(
xResultSet, UNO_QUERY );
@@ -648,36 +653,32 @@ void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
GetEntry( rPos, TRUE ) );
if ( pEntry )
{
- PopupMenu* pMenu = new PopupMenu( ResId( MENU_POPUP ) );
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( ucbexplorer ) ) );
+ PopupMenu* pMenu = new PopupMenu( ResId( MENU_POPUP, *xManager.get() ) );
PopupMenu* pNewMenu = 0;
-// pMenu->SetSelectHdl( LINK( this,
-// SfxCommonTemplateDialog_Impl,
-// MenuSelectHdl ) );
+// pMenu->SetSelectHdl( LINK( this,
+// SfxCommonTemplateDialog_Impl,
+// MenuSelectHdl ) );
//////////////////////////////////////////////////////////////
// Configure "New"
//////////////////////////////////////////////////////////////
- uno::Reference< XContentCreator > xCreator(
- pEntry->m_aContent.get(), UNO_QUERY );
- Sequence< ContentInfo > aInfo;
- BOOL bCanCreate = xCreator.is();
- if ( bCanCreate )
- {
- aInfo = xCreator->queryCreatableContentsInfo();
- const ContentInfo* pInfo = aInfo.getConstArray();
- sal_Int32 nCount = aInfo.getLength();
- bCanCreate = ( nCount > 0 );
+ Sequence< ContentInfo > aInfo
+ = pEntry->m_aContent.queryCreatableContentsInfo();
+ const ContentInfo* pInfo = aInfo.getConstArray();
+ sal_Int32 nCount = aInfo.getLength();
+ BOOL bCanCreate = ( nCount > 0 );
- pNewMenu = new PopupMenu;
- pMenu->SetPopupMenu( MENU_NEW, pNewMenu );
+ pNewMenu = new PopupMenu;
+ pMenu->SetPopupMenu( MENU_NEW, pNewMenu );
- for ( sal_Int32 n = 0; n < nCount; ++n )
- {
- const ContentInfo& rInfo = pInfo[ n ];
- pNewMenu->InsertItem( 20000 + n + 1, rInfo.Type );
- }
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const ContentInfo& rInfo = pInfo[ n ];
+ pNewMenu->InsertItem( 20000 + n + 1, rInfo.Type );
}
pMenu->EnableItem( MENU_NEW, bCanCreate );
@@ -721,7 +722,7 @@ void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
{
pMenu->EnableItem( MENU_DELETE,
pEntry->m_aContent
- .getCommands()->hasCommandByName(
+ .getCommands()->hasCommandByName(
OUString::createFromAscii(
"delete" ) ) );
}
@@ -743,8 +744,8 @@ void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
USHORT nSelected = pMenu->Execute( this, rPos );
switch ( nSelected )
{
-// case MENU_NEW:
-// break;
+// case MENU_NEW:
+// break;
case MENU_RENAME:
{
@@ -767,8 +768,11 @@ void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
{
}
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( ucbexplorer ) ) );
StringInputDialog* pDlg
= new StringInputDialog(
+ *xManager.get(),
OUString::createFromAscii( "Title" ),
aNewTitle );
@@ -884,7 +888,7 @@ void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
{
// New-menu entry selected.
- ::ucb::Content aNewContent;
+ ::ucbhelper::Content aNewContent;
if ( pEntry->createNewContent(
aInfo.getConstArray()[ nSelected - 20001 ],
aNewContent ) )
@@ -910,8 +914,8 @@ void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
//=========================================================================
UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
- ::ucb::Content& rContent,
- SvLBoxEntry* pParent )
+ ::ucbhelper::Content& rContent,
+ SvLBoxEntry* pParent )
{
try
{
@@ -921,7 +925,7 @@ UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
if ( !aTitle.getLength() )
aTitle = OUString::createFromAscii( "/" );
- UcbExplorerListBoxEntry* pEntry = 0;
+ UcbExplorerListBoxEntry* pEntry = 0;
if ( rContent.isFolder() )
{
@@ -995,18 +999,18 @@ UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
//=========================================================================
UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
- const String& rURL,
- SvLBoxEntry* pParent )
+ const String& rURL,
+ SvLBoxEntry* pParent )
{
try
{
uno::Reference< XCommandEnvironment > xEnv;
- ::ucb::ContentBroker* pBroker = ::ucb::ContentBroker::get();
+ ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
if ( pBroker )
{
uno::Reference< XInteractionHandler > xInteractionHandler(
- pBroker->getServiceManager()->createInstance(
+ pBroker->getServiceManager()->createInstance(
OUString::createFromAscii(
"com.sun.star.task.InteractionHandler" ) ),
UNO_QUERY );
@@ -1014,11 +1018,11 @@ UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
uno::Reference< XProgressHandler > xProgressHandler
/* = new ProgressHandler( *pBroker ) */ ;
- xEnv = new ::ucb::CommandEnvironment( xInteractionHandler,
- xProgressHandler );
+ xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler,
+ xProgressHandler );
}
- ::ucb::Content aContent( rURL, xEnv );
+ ::ucbhelper::Content aContent( rURL, xEnv );
return InsertEntry( aContent, pParent );
}
catch ( ContentCreationException const & )
@@ -1034,9 +1038,9 @@ UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
//
//=========================================================================
-UcbExplorerWindow::UcbExplorerWindow( Window *pParent, WinBits nWinStyle )
+UcbExplorerWindow::UcbExplorerWindow( ResMgr & rResMgr, Window *pParent, WinBits nWinStyle )
: WorkWindow( pParent, nWinStyle ),
- m_aTree( this, WB_HSCROLL )
+ m_aTree( rResMgr, this, WB_HSCROLL )
{
Font aTreeFont( m_aTree.GetFont() );
aTreeFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM("Courier") ) );
@@ -1105,7 +1109,7 @@ void MyApp::Main()
comphelper::setProcessServiceFactory( xFac );
- unO::Reference< XComponent > xComponent( xFac, UNO_QUERY );
+ uno::Reference< XComponent > xComponent( xFac, UNO_QUERY );
//////////////////////////////////////////////////////////////////////
// Create UCB.
@@ -1116,16 +1120,16 @@ void MyApp::Main()
Sequence< Any > aArgs( 2 );
aArgs[ 0 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
aArgs[ 1 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
- sal_Bool bSuccess = ::ucb::ContentBroker::initialize( xFac, aArgs );
+ sal_Bool bSuccess = ::ucbhelper::ContentBroker::initialize( xFac, aArgs );
#else
// Init UCB (Use provided configuration data)
- ::ucb::ContentProviderDataList aProviders;
+ ::ucbhelper::ContentProviderDataList aProviders;
aProviders.push_back(
- ::ucb::ContentProviderData(
+ ::ucbhelper::ContentProviderData(
OUString::createFromAscii( "com.sun.star.ucb.FileContentProvider" ),
OUString::createFromAscii( "file" ),
OUString() ) );
- sal_Bool bSuccess = ::ucb::ContentBroker::initialize( xFac, aProviders );
+ sal_Bool bSuccess = ::ucbhelper::ContentBroker::initialize( xFac, aProviders );
#endif
if ( !bSuccess )
@@ -1138,12 +1142,12 @@ void MyApp::Main()
// Create/init/show app window.
//////////////////////////////////////////////////////////////////////
- ResMgr* pMgr = ResMgr::CreateResMgr( CREATEVERSIONRESMGR( ucbexplorer ) );
- Resource::SetResManager( pMgr );
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( ucbexplorer ) ) );
- UcbExplorerWindow aAppWin( 0, WB_APP | WB_STDWORK );
+ UcbExplorerWindow aAppWin( *xManager.get(), 0, WB_APP | WB_STDWORK );
- MenuBar aMBMain( ResId( MENU_MAIN ) );
+ MenuBar aMBMain( ResId( MENU_MAIN, *xManager.get() ) );
// Check for command line params
#if 0
@@ -1158,7 +1162,7 @@ void MyApp::Main()
aRootURL = UniString::CreateFromAscii(
RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.hier:/" ) );
- String aTitle( ResId( TEXT_TITLEBAR ) );
+ String aTitle( ResId( TEXT_TITLEBAR, *xManager.get() ) );
aTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ) );
aTitle += aRootURL;
@@ -1183,7 +1187,7 @@ void MyApp::Main()
// m_aTree holds UCB contents!
aAppWin.m_aTree.Clear();
- ::ucb::ContentBroker::deinitialize();
+ ::ucbhelper::ContentBroker::deinitialize();
if ( xComponent.is() )
xComponent->dispose();
diff --git a/ucbhelper/workben/ucbexplorer/ucbexplorer.src b/ucbhelper/workben/ucbexplorer/ucbexplorer.src
index 14d4b8ee8770..1449897341d5 100644
--- a/ucbhelper/workben/ucbexplorer/ucbexplorer.src
+++ b/ucbhelper/workben/ucbexplorer/ucbexplorer.src
@@ -27,15 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-//=========================================================================
-//
-// UCB Explorer ( resources )
-//
-// (C) 2000 StarOffice Entwicklungs GmbH, Hamburg, Germany
-//
-// $Author: rt $ $Date: 2008-04-10 16:20:05 $Revision$
-//
-//=========================================================================
#include "ucbexplorer.hrc"
@@ -91,6 +82,7 @@ Menu MENU_POPUP
};
};
+/*
Bitmap BMP_FOLDER_CLOSED
{
File = "bmp/fldclose.bmp" ;
@@ -107,6 +99,7 @@ Bitmap BMP_LINK
{
File = "bmp/link.bmp" ;
};
+*/
ModalDialog DLG_STRINGINPUT
{
diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx
index 580274004e1a..2e305030fa2b 100644
--- a/unotools/inc/unotools/confignode.hxx
+++ b/unotools/inc/unotools/confignode.hxx
@@ -88,6 +88,9 @@ namespace utl
/// dtor
~OConfigurationNode() {}
+ /// returns the local name of the node
+ ::rtl::OUString getLocalName() const;
+
/** open a sub node
@param _rPath access path of the to-be-opened sub node. May be a hierarchical path.
*/
diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx
index 4b1b9fe272db..c8134137db0c 100644
--- a/unotools/source/config/confignode.cxx
+++ b/unotools/source/config/confignode.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/util/XStringEscape.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNamed.hpp>
#include <comphelper/extract.hxx>
#include <rtl/string.hxx>
#if OSL_DEBUG_LEVEL > 0
@@ -139,6 +140,22 @@ namespace utl
}
//------------------------------------------------------------------------
+ ::rtl::OUString OConfigurationNode::getLocalName() const
+ {
+ ::rtl::OUString sLocalName;
+ try
+ {
+ Reference< XNamed > xNamed( m_xDirectAccess, UNO_QUERY_THROW );
+ sLocalName = xNamed->getName();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return sLocalName;
+ }
+
+ //------------------------------------------------------------------------
::rtl::OUString OConfigurationNode::normalizeName(const ::rtl::OUString& _rName, NAMEORIGIN _eOrigin) const
{
::rtl::OUString sName(_rName);
@@ -155,13 +172,9 @@ namespace utl
else
sName = xEscaper->unescapeString(sName);
}
- catch(IllegalArgumentException&)
- {
- OSL_ENSURE(sal_False, "OConfigurationNode::normalizeName: illegal argument (caught an exception saying so)!");
- }
catch(Exception&)
{
- OSL_ENSURE(sal_False, "OConfigurationNode::normalizeName: caught an exception!");
+ DBG_UNHANDLED_EXCEPTION();
}
}
}
@@ -455,16 +468,9 @@ namespace utl
aReturn = m_xHierarchyAccess->getByHierarchicalName(_rPath);
}
}
- catch(NoSuchElementException& e)
+ catch(const NoSuchElementException&)
{
- #if OSL_DEBUG_LEVEL > 0
- rtl::OStringBuffer aBuf( 256 );
- aBuf.append("OConfigurationNode::getNodeValue: caught a NoSuchElementException while trying to open ");
- aBuf.append( rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ) );
- OSL_ENSURE(sal_False, aBuf.getStr());
- #else
- (void)e;
- #endif
+ DBG_UNHANDLED_EXCEPTION();
}
return aReturn;
}
@@ -487,7 +493,7 @@ namespace utl
}
catch(Exception&)
{
- OSL_ENSURE(sal_False, "OConfigurationNode::cloneAsRoot: could not retrieve the node path!");
+ DBG_UNHANDLED_EXCEPTION();
}
}
@@ -548,13 +554,9 @@ namespace utl
m_xCommitter->commitChanges();
return sal_True;
}
- catch(WrappedTargetException&)
- {
- OSL_ENSURE(sal_False, "OConfigurationTreeRoot::commit: caught a WrappedTargetException!");
- }
- catch(RuntimeException&)
+ catch(const Exception&)
{
- OSL_ENSURE(sal_False, "OConfigurationTreeRoot::commit: caught a RuntimeException!");
+ DBG_UNHANDLED_EXCEPTION();
}
return sal_False;
}
@@ -591,7 +593,7 @@ namespace utl
}
catch(const Exception&)
{
- OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: unable to check the service conformance of the provider given!");
+ DBG_UNHANDLED_EXCEPTION();
}
}
#endif
@@ -635,15 +637,9 @@ namespace utl
try { xComp->dispose(); } catch(Exception&) { }
}
}
- catch(Exception& e)
+ catch(const Exception&)
{
- #if OSL_DEBUG_LEVEL > 0
- ::rtl::OString sMessage( "OConfigurationTreeRoot::createWithProvider: caught an exception while creating the access object!\nmessage:\n" );
- sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US );
- OSL_ENSURE( sal_False, sMessage.getStr() );
- #else
- (void)e;
- #endif
+ DBG_UNHANDLED_EXCEPTION();
}
}
bTryAgain = CM_PREFER_UPDATABLE == _eMode;
@@ -670,9 +666,9 @@ namespace utl
if (xProviderAsFac.is())
return createWithProvider(xProviderAsFac, _rPath, _nDepth, _eMode, _bLazyWrite);
}
- catch(Exception&)
+ catch(const Exception&)
{
- OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithServiceFactory: error while instantiating the provider service!");
+ DBG_UNHANDLED_EXCEPTION();
}
}
return OConfigurationTreeRoot();
diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx
index 2b301efc4e52..a798f485516a 100644
--- a/unotools/source/ucbhelper/ucbhelper.cxx
+++ b/unotools/source/ucbhelper/ucbhelper.cxx
@@ -46,15 +46,13 @@
#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
#include <com/sun/star/ucb/XCommandInfo.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
+#include <com/sun/star/ucb/ContentInfo.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
-#include <com/sun/star/ucb/XContentCreator.hpp>
#include <com/sun/star/ucb/XDynamicResultSet.hpp>
#include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/container/XChild.hpp>
-#ifndef _COM_SUN_STAR_UCB_INTERACTIVEIODEXCEPTION_HPP_
#include <com/sun/star/ucb/InteractiveIOException.hpp>
-#endif
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <ucbhelper/commandenvironment.hxx>
#include <ucbhelper/content.hxx>
@@ -489,11 +487,7 @@ sal_Bool UCBContentHelper::CanMakeFolder( const String& rFolder )
try
{
Content aCnt( rFolder, uno::Reference< XCommandEnvironment > () );
- uno::Reference< XContentCreator > xCreator = uno::Reference< XContentCreator >( aCnt.get(), UNO_QUERY );
- if ( !xCreator.is() )
- return sal_False;
-
- Sequence< ContentInfo > aInfo = xCreator->queryCreatableContentsInfo();
+ Sequence< ContentInfo > aInfo = aCnt.queryCreatableContentsInfo();
sal_Int32 nCount = aInfo.getLength();
if ( nCount == 0 )
return sal_False;
@@ -538,11 +532,7 @@ sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Cont
try
{
- uno::Reference< XContentCreator > xCreator( aCnt.get(), UNO_QUERY );
- if ( !xCreator.is() )
- return sal_False;
-
- Sequence< ContentInfo > aInfo = xCreator->queryCreatableContentsInfo();
+ Sequence< ContentInfo > aInfo = aCnt.queryCreatableContentsInfo();
sal_Int32 nCount = aInfo.getLength();
if ( nCount == 0 )
return sal_False;
diff --git a/vcl/aqua/inc/aquaprintview.h b/vcl/aqua/inc/aquaprintview.h
index c5ce20c17425..55a85678cd50 100755
--- a/vcl/aqua/inc/aquaprintview.h
+++ b/vcl/aqua/inc/aquaprintview.h
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: aquaprintview.h,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.114.1 $
*
* This file is part of OpenOffice.org.
*
@@ -35,20 +35,36 @@
#include <Cocoa/Cocoa.h>
#include "postmac.h"
-class ImplQPrinter;
+#include "vcl/print.hxx"
+
class AquaSalInfoPrinter;
+struct PrintAccessoryViewState
+{
+ bool bNeedRestart;
+ sal_Int32 nLastPage;
+
+ PrintAccessoryViewState()
+ : bNeedRestart( false ), nLastPage( 0 ) {}
+};
+
@interface AquaPrintView : NSView
{
- ImplQPrinter* mpQPrinter;
- AquaSalInfoPrinter* mpInfoPrinter;
+ vcl::PrinterController* mpController;
+ AquaSalInfoPrinter* mpInfoPrinter;
}
--(id)initWithQPrinter: (ImplQPrinter*)pPrinter withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter;
+-(id)initWithController: (vcl::PrinterController*)pController withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter;
-(MacOSBOOL)knowsPageRange: (NSRangePointer)range;
-(NSRect)rectForPage: (int)page;
-(NSPoint)locationOfPrintRect: (NSRect)aRect;
-(void)drawRect: (NSRect)rect;
@end
+@interface AquaPrintAccessoryView : NSObject
+{
+}
++(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp withController: (vcl::PrinterController*)pController withState: (PrintAccessoryViewState*)pState;
+@end
+
#endif
diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h
index 4933dbc48586..f557c4d2e79b 100644
--- a/vcl/aqua/inc/salgdi.h
+++ b/vcl/aqua/inc/salgdi.h
@@ -175,6 +175,9 @@ public:
void RefreshRect(float lX, float lY, float lWidth, float lHeight);
void SetState();
+ void UnsetState();
+ // InvalidateContext does an UnsetState and sets mrContext to 0
+ void InvalidateContext();
virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight );
virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& );
@@ -359,6 +362,7 @@ private:
void ApplyXorContext();
void Pattern50Fill();
UInt32 getState( ControlState nState );
+ UInt32 getTrackState( ControlState nState );
};
class XorEmulation
diff --git a/vcl/aqua/inc/salprn.h b/vcl/aqua/inc/salprn.h
index ec08261e8321..bf9c3c25bc87 100644
--- a/vcl/aqua/inc/salprn.h
+++ b/vcl/aqua/inc/salprn.h
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: salprn.h,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.56.1 $
*
* This file is part of OpenOffice.org.
*
@@ -73,8 +73,8 @@ class AquaSalInfoPrinter : public SalInfoPrinter
int mnStartPageOffsetX;
int mnStartPageOffsetY;
- ULONG mnCurPageRangeStart;
- ULONG mnCurPageRangeCount;
+ sal_Int32 mnCurPageRangeStart;
+ sal_Int32 mnCurPageRangeCount;
public:
AquaSalInfoPrinter( const SalPrinterQueueInfo& pInfo );
@@ -96,19 +96,17 @@ class AquaSalInfoPrinter : public SalInfoPrinter
virtual String GetPaperBinName( const ImplJobSetup* i_pSetupData, ULONG i_nPaperBin );
virtual void InitPaperFormats( const ImplJobSetup* i_pSetupData );
virtual int GetLandscapeAngle( const ImplJobSetup* i_pSetupData );
- virtual DuplexMode GetDuplexMode( const ImplJobSetup* i_pSetupData );
-
// the artificial separation between InfoPrinter and Printer
// is not really useful for us
// so let's make AquaSalPrinter just a forwarder to AquaSalInfoPrinter
// and concentrate the real work in one class
// implement pull model print system
- BOOL StartJob( const String* pFileName,
- const String& rAppName,
- ImplJobSetup* pSetupData,
- ImplQPrinter* pQPrinter,
- bool bIsQuickJob );
+ BOOL StartJob( const String* i_pFileName,
+ const String& rJobName,
+ const String& i_rAppName,
+ ImplJobSetup* i_pSetupData,
+ vcl::PrinterController& i_rController );
BOOL EndJob();
BOOL AbortJob();
SalGraphics* StartPage( ImplJobSetup* i_pSetupData, BOOL i_bNewJobData );
@@ -117,8 +115,12 @@ class AquaSalInfoPrinter : public SalInfoPrinter
NSPrintInfo* getPrintInfo() const { return mpPrintInfo; }
void setStartPageOffset( int nOffsetX, int nOffsetY ) { mnStartPageOffsetX = nOffsetX; mnStartPageOffsetY = nOffsetY; }
- ULONG getCurPageRangeStart() const { return mnCurPageRangeStart; }
- ULONG getCurPageRangeCount() const { return mnCurPageRangeCount; }
+ sal_Int32 getCurPageRangeStart() const { return mnCurPageRangeStart; }
+ sal_Int32 getCurPageRangeCount() const { return mnCurPageRangeCount; }
+
+ // match width/height against known paper formats, possibly switching orientation
+ const PaperInfo* matchPaper( long i_nWidth, long i_nHeight, Orientation& o_rOrientation ) const;
+ void setPaperSize( long i_nWidth, long i_nHeight, Orientation i_eSetOrientation );
private:
AquaSalInfoPrinter( const AquaSalInfoPrinter& );
@@ -139,13 +141,16 @@ class AquaSalPrinter : public SalPrinter
virtual BOOL StartJob( const XubString* i_pFileName,
const XubString& i_rJobName,
const XubString& i_rAppName,
- ULONG i_nCopies, BOOL i_bCollate,
+ ULONG i_nCopies,
+ bool i_bCollate,
+ bool i_bDirect,
ImplJobSetup* i_pSetupData );
// implement pull model print system
- virtual BOOL StartJob( const String* pFileName,
- const String& rAppName,
- ImplJobSetup* pSetupData,
- ImplQPrinter* pQPrinter );
+ virtual BOOL StartJob( const String* i_pFileName,
+ const String& rJobName,
+ const String& i_rAppName,
+ ImplJobSetup* i_pSetupData,
+ vcl::PrinterController& i_rListener );
virtual BOOL EndJob();
virtual BOOL AbortJob();
@@ -162,7 +167,7 @@ const double fPtTo100thMM = 35.27777778;
inline int PtTo10Mu( double nPoints ) { return (int)(((nPoints)*fPtTo100thMM)+0.5); }
-inline double TenMuToPt( double nUnits ) { return (((nUnits)/fPtTo100thMM)+0.5); }
+inline double TenMuToPt( double nUnits ) { return floor(((nUnits)/fPtTo100thMM)+0.5); }
diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
new file mode 100644
index 000000000000..798fefef1b25
--- /dev/null
+++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
@@ -0,0 +1,1237 @@
+/************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: aquaprintview.mm,v $
+ * $Revision: 1.5.56.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "aquaprintview.h"
+#include "salinst.h"
+#include "vcl/print.hxx"
+#include "vcl/image.hxx"
+#include "vcl/virdev.hxx"
+#include "vcl/svdata.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/unohelp.hxx"
+
+#include "vcl/svids.hrc"
+
+#include "tools/resary.hxx"
+
+#include "com/sun/star/i18n/XBreakIterator.hpp"
+#include "com/sun/star/i18n/WordType.hpp"
+
+#include <map>
+
+using namespace vcl;
+using namespace com::sun::star;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::uno;
+
+/* Note: the accesory view as implemented here is already deprecated in Leopard. Unfortunately
+ as long as our baseline is Tiger we cannot gain the advantages over multiple accessory views
+ as well havs having accessory views AND a preview (as long as you are linked vs. 10.4 libraries
+ the preview insists on not being present. This is unfortunate.
+*/
+
+class ControllerProperties;
+
+@interface ControlTarget : NSObject
+{
+ ControllerProperties* mpController;
+}
+-(id)initWithControllerMap: (ControllerProperties*)pController;
+-(void)triggered:(id)pSender;
+-(void)triggeredNumeric:(id)pSender;
+-(void)triggeredPreview:(id)pSender;
+-(void)dealloc;
+@end
+
+
+class ControllerProperties
+{
+ vcl::PrinterController* mpController;
+ std::map< int, rtl::OUString > maTagToPropertyName;
+ std::map< int, sal_Int32 > maTagToValueInt;
+ std::map< NSView*, NSView* > maViewPairMap;
+ std::vector< NSObject* > maViews;
+ int mnNextTag;
+ sal_Int32 mnLastPageCount;
+ PrintAccessoryViewState* mpState;
+ NSPrintOperation* mpOp;
+ NSView* mpAccessoryView;
+ NSTabView* mpTabView;
+ NSBox* mpPreviewBox;
+ NSImageView* mpPreview;
+ NSTextField* mpPageEdit;
+ NSStepper* mpStepper;
+ NSTextView* mpPagesLabel;
+ ResStringArray maLocalizedStrings;
+
+ public:
+ ControllerProperties( vcl::PrinterController* i_pController,
+ NSPrintOperation* i_pOp,
+ NSView* i_pAccessoryView,
+ NSTabView* i_pTabView,
+ PrintAccessoryViewState* i_pState )
+ : mpController( i_pController ),
+ mnNextTag( 0 ),
+ mnLastPageCount( i_pController->getFilteredPageCount() ),
+ mpState( i_pState ),
+ mpOp( i_pOp ),
+ mpAccessoryView( i_pAccessoryView ),
+ mpTabView( i_pTabView ),
+ mpPreviewBox( nil ),
+ mpPreview( nil ),
+ mpPageEdit( nil ),
+ mpStepper( nil ),
+ mpPagesLabel( nil ),
+ maLocalizedStrings( VclResId( SV_PRINT_NATIVE_STRINGS ) )
+ {
+ mpState->bNeedRestart = false;
+ DBG_ASSERT( maLocalizedStrings.Count() >= 4, "resources not found !" );
+ }
+
+ rtl::OUString getMoreString()
+ {
+ return maLocalizedStrings.Count() >= 4
+ ? rtl::OUString( maLocalizedStrings.GetString( 3 ) )
+ : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "More" ) );
+ }
+
+ void updatePrintJob()
+ {
+ // TODO: refresh page count etc from mpController
+
+ // page range may have changed depending on options
+ sal_Int32 nPages = mpController->getFilteredPageCount();
+ #if OSL_DEBUG_LEVEL > 1
+ if( nPages != mnLastPageCount )
+ fprintf( stderr, "trouble: number of pages changed from %ld to %ld !\n", mnLastPageCount, nPages );
+ #endif
+ mpState->bNeedRestart = (nPages != mnLastPageCount);
+ NSTabViewItem* pItem = [mpTabView selectedTabViewItem];
+ if( pItem )
+ mpState->nLastPage = [mpTabView indexOfTabViewItem: pItem];
+ else
+ mpState->nLastPage = 0;
+ mnLastPageCount = nPages;
+ if( mpState->bNeedRestart )
+ {
+ #if 0
+ // Warning: bad hack ahead
+ // Apple does not give us a chance of changing the page count,
+ // and they don't let us cancel the dialog either
+ // hack: send a cancel message to the window displaying our views.
+ // this is ugly.
+ for( std::vector< NSObject* >::iterator it = maViews.begin(); it != maViews.end(); ++it )
+ {
+ if( [*it isKindOfClass: [NSView class]] )
+ {
+ NSView* pView = (NSView*)*it;
+ NSWindow* pWindow = [pView window];
+ if( pWindow )
+ {
+ [pWindow cancelOperation: nil];
+ break;
+ }
+ }
+ }
+ #else
+ NSWindow* pWindow = [NSApp modalWindow];
+ if( pWindow )
+ [pWindow cancelOperation: nil];
+ #endif
+ [[mpOp printInfo] setJobDisposition: NSPrintCancelJob];
+ }
+ else
+ {
+ sal_Int32 nPage = [mpStepper intValue];
+ updatePreviewImage( nPage-1 );
+ }
+ }
+
+ int addNameTag( const rtl::OUString& i_rPropertyName )
+ {
+ int nNewTag = mnNextTag++;
+ maTagToPropertyName[ nNewTag ] = i_rPropertyName;
+ return nNewTag;
+ }
+
+ int addNameAndValueTag( const rtl::OUString& i_rPropertyName, sal_Int32 i_nValue )
+ {
+ int nNewTag = mnNextTag++;
+ maTagToPropertyName[ nNewTag ] = i_rPropertyName;
+ maTagToValueInt[ nNewTag ] = i_nValue;
+ return nNewTag;
+ }
+
+ void addObservedControl( NSObject* i_pView )
+ {
+ maViews.push_back( i_pView );
+ }
+
+ void addViewPair( NSView* i_pLeft, NSView* i_pRight )
+ {
+ maViewPairMap[ i_pLeft ] = i_pRight;
+ maViewPairMap[ i_pRight ] = i_pLeft;
+ }
+
+ NSView* getPair( NSView* i_pLeft ) const
+ {
+ NSView* pRight = nil;
+ std::map< NSView*, NSView* >::const_iterator it = maViewPairMap.find( i_pLeft );
+ if( it != maViewPairMap.end() )
+ pRight = it->second;
+ return pRight;
+ }
+
+ void changePropertyWithIntValue( int i_nTag )
+ {
+ std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( i_nTag );
+ std::map< int, sal_Int32 >::const_iterator value_it = maTagToValueInt.find( i_nTag );
+ if( name_it != maTagToPropertyName.end() && value_it != maTagToValueInt.end() )
+ {
+ PropertyValue* pVal = mpController->getValue( name_it->second );
+ if( pVal )
+ {
+ pVal->Value <<= value_it->second;
+ updatePrintJob();
+ }
+ }
+ }
+
+ void changePropertyWithIntValue( int i_nTag, sal_Int64 i_nValue )
+ {
+ std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( i_nTag );
+ if( name_it != maTagToPropertyName.end() )
+ {
+ PropertyValue* pVal = mpController->getValue( name_it->second );
+ if( pVal )
+ {
+ pVal->Value <<= i_nValue;
+ updatePrintJob();
+ }
+ }
+ }
+
+ void changePropertyWithBoolValue( int i_nTag, sal_Bool i_bValue )
+ {
+ std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( i_nTag );
+ if( name_it != maTagToPropertyName.end() )
+ {
+ PropertyValue* pVal = mpController->getValue( name_it->second );
+ if( pVal )
+ {
+ pVal->Value <<= i_bValue;
+ updatePrintJob();
+ }
+ }
+ }
+
+ void changePropertyWithStringValue( int i_nTag, const rtl::OUString& i_rValue )
+ {
+ std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( i_nTag );
+ if( name_it != maTagToPropertyName.end() )
+ {
+ PropertyValue* pVal = mpController->getValue( name_it->second );
+ if( pVal )
+ {
+ pVal->Value <<= i_rValue;
+ updatePrintJob();
+ }
+ }
+ }
+
+ void updateEnableState()
+ {
+ for( std::vector< NSObject* >::iterator it = maViews.begin(); it != maViews.end(); ++it )
+ {
+ NSObject* pObj = *it;
+ NSControl* pCtrl = nil;
+ NSCell* pCell = nil;
+ if( [pObj isKindOfClass: [NSControl class]] )
+ pCtrl = (NSControl*)pObj;
+ else if( [pObj isKindOfClass: [NSCell class]] )
+ pCell = (NSCell*)pObj;
+
+ int nTag = pCtrl ? [pCtrl tag] :
+ pCell ? [pCell tag] :
+ -1;
+
+ std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( nTag );
+ if( name_it != maTagToPropertyName.end() )
+ {
+ MacOSBOOL bEnabled = mpController->isUIOptionEnabled( name_it->second ) ? YES : NO;
+ if( pCtrl )
+ {
+ [pCtrl setEnabled: bEnabled];
+ NSView* pOther = getPair( pCtrl );
+ if( pOther && [pOther isKindOfClass: [NSControl class]] )
+ [(NSControl*)pOther setEnabled: bEnabled];
+ }
+ else if( pCell )
+ [pCell setEnabled: bEnabled];
+
+ }
+ }
+ }
+
+ void updatePreviewImage( sal_Int32 i_nPage )
+ {
+ sal_Int32 nPages = mpController->getFilteredPageCount();
+ NSRect aViewFrame = [mpPreview frame];
+ Size aPixelSize( static_cast<long>(aViewFrame.size.width),
+ static_cast<long>(aViewFrame.size.height) );
+ if( i_nPage >= 0 && nPages > i_nPage )
+ {
+ GDIMetaFile aMtf;
+ PrinterController::PageSize aPageSize( mpController->getFilteredPageFile( i_nPage, aMtf, false ) );
+ VirtualDevice aDev;
+ // see salprn.cxx, currently we pretend to be a 720dpi device on printers
+ aDev.SetReferenceDevice( 720, 720 );
+ aDev.EnableOutput( TRUE );
+ Size aLogicSize( aDev.PixelToLogic( aPixelSize, MapMode( MAP_100TH_MM ) ) );
+ double fScaleX = double(aLogicSize.Width())/double(aPageSize.aSize.Width());
+ double fScaleY = double(aLogicSize.Height())/double(aPageSize.aSize.Height());
+ double fScale = (fScaleX < fScaleY) ? fScaleX : fScaleY;
+ aMtf.WindStart();
+ aMtf.Scale( fScale, fScale );
+ aMtf.WindStart();
+ aLogicSize.Width() = long(double(aPageSize.aSize.Width()) * fScale);
+ aLogicSize.Height() = long(double(aPageSize.aSize.Height()) * fScale);
+ aPixelSize = aDev.LogicToPixel( aLogicSize, MapMode( MAP_100TH_MM ) );
+ aDev.SetOutputSizePixel( aPixelSize );
+ aMtf.WindStart();
+ aDev.SetMapMode( MapMode( MAP_100TH_MM ) );
+ aMtf.Play( &aDev, Point( 0, 0 ), aLogicSize );
+ aDev.EnableMapMode( FALSE );
+ Image aImage( aDev.GetBitmap( Point( 0, 0 ), aPixelSize ) );
+ NSImage* pImage = CreateNSImage( aImage );
+ [mpPreview setImage: [pImage autorelease]];
+ }
+ else
+ [mpPreview setImage: nil];
+ }
+
+ void setupPreview( ControlTarget* i_pCtrlTarget )
+ {
+ if( maLocalizedStrings.Count() < 3 )
+ return;
+
+ // get the preview control
+ NSRect aPreviewFrame = [mpAccessoryView frame];
+ aPreviewFrame.origin.x = 0;
+ aPreviewFrame.origin.y = 5;
+ aPreviewFrame.size.width = 190;
+ aPreviewFrame.size.height -= 7;
+
+ // create a box to put the preview controls in
+ mpPreviewBox = [[NSBox alloc] initWithFrame: aPreviewFrame];
+ [mpPreviewBox setTitle: [CreateNSString( maLocalizedStrings.GetString( 0 ) ) autorelease]];
+ [mpAccessoryView addSubview: [mpPreviewBox autorelease]];
+
+ // now create the image view of the preview
+ NSSize aMargins = [mpPreviewBox contentViewMargins];
+ aPreviewFrame.origin.x = 0;
+ aPreviewFrame.origin.y = 34;
+ aPreviewFrame.size.height -= 61;
+ mpPreview = [[NSImageView alloc] initWithFrame: aPreviewFrame];
+ [mpPreview setImageScaling: NSScaleNone];
+ [mpPreview setImageAlignment: NSImageAlignCenter];
+ [mpPreview setImageFrameStyle: NSImageFrameNone];
+ [mpPreviewBox addSubview: [mpPreview autorelease]];
+
+ // add a label
+ sal_Int32 nPages = mpController->getFilteredPageCount();
+ rtl::OUStringBuffer aBuf( 16 );
+ aBuf.appendAscii( "/ " );
+ aBuf.append( rtl::OUString::valueOf( nPages ) );
+
+ NSString* pText = CreateNSString( aBuf.makeStringAndClear() );
+ NSRect aTextRect = { { 100, 5 }, { 100, 22 } };
+ mpPagesLabel = [[NSTextView alloc] initWithFrame: aTextRect];
+ [mpPagesLabel setFont: [NSFont controlContentFontOfSize: 0]];
+ [mpPagesLabel setEditable: NO];
+ [mpPagesLabel setSelectable: NO];
+ [mpPagesLabel setDrawsBackground: NO];
+ [mpPagesLabel setString: [pText autorelease]];
+ [mpPagesLabel setToolTip: [CreateNSString( maLocalizedStrings.GetString( 2 ) ) autorelease]];
+ [mpPreviewBox addSubview: [mpPagesLabel autorelease]];
+
+ NSRect aFieldRect = { { 45, 5 }, { 35, 25 } };
+ mpPageEdit = [[NSTextField alloc] initWithFrame: aFieldRect];
+ [mpPageEdit setEditable: YES];
+ [mpPageEdit setSelectable: YES];
+ [mpPageEdit setDrawsBackground: YES];
+ [mpPageEdit setToolTip: [CreateNSString( maLocalizedStrings.GetString( 1 ) ) autorelease]];
+ [mpPreviewBox addSubview: [mpPageEdit autorelease]];
+
+ // add a stepper control
+ NSRect aStepFrame = { { 85, 5 }, { 15, 25 } };
+ mpStepper = [[NSStepper alloc] initWithFrame: aStepFrame];
+ [mpStepper setIncrement: 1];
+ [mpStepper setValueWraps: NO];
+ [mpPreviewBox addSubview: [mpStepper autorelease]];
+
+ // constrain the text field to decimal numbers
+ NSNumberFormatter* pFormatter = [[NSNumberFormatter alloc] init];
+ [pFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4];
+ [pFormatter setMinimum: [[NSNumber numberWithInt: 1] autorelease]];
+ [pFormatter setMaximum: [[NSNumber numberWithInt: nPages] autorelease]];
+ [pFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
+ [pFormatter setAllowsFloats: NO];
+ [pFormatter setMaximumFractionDigits: 0];
+ [mpPageEdit setFormatter: pFormatter];
+ [mpStepper setMinValue: 1];
+ [mpStepper setMaxValue: nPages];
+
+ [mpPageEdit setIntValue: 1];
+ [mpStepper setIntValue: 1];
+
+ // connect target and action
+ [mpStepper setTarget: i_pCtrlTarget];
+ [mpStepper setAction: @selector(triggeredPreview:)];
+ [mpPageEdit setTarget: i_pCtrlTarget];
+ [mpPageEdit setAction: @selector(triggeredPreview:)];
+
+ // set first preview image
+ updatePreviewImage( 0 );
+ }
+
+ void changePreview( NSObject* i_pSender )
+ {
+ if( [i_pSender isMemberOfClass: [NSTextField class]] )
+ {
+ NSTextField* pField = (NSTextField*)i_pSender;
+ if( pField == mpPageEdit ) // sanity check
+ {
+ sal_Int32 nPage = [pField intValue];
+ [mpStepper setIntValue: nPage];
+ updatePreviewImage( nPage-1 );
+ }
+ }
+ else if( [i_pSender isMemberOfClass: [NSStepper class]] )
+ {
+ NSStepper* pStepper = (NSStepper*)i_pSender;
+ if( pStepper == mpStepper ) // sanity check
+ {
+ sal_Int32 nPage = [pStepper intValue];
+ [mpPageEdit setIntValue: nPage];
+ updatePreviewImage( nPage-1 );
+ }
+ }
+ }
+};
+
+static void filterAccelerator( rtl::OUString& io_rText )
+{
+ rtl::OUStringBuffer aBuf( io_rText.getLength() );
+ for( sal_Int32 nIndex = 0; nIndex != -1; )
+ aBuf.append( io_rText.getToken( 0, '~', nIndex ) );
+ io_rText = aBuf.makeStringAndClear();
+}
+
+@implementation ControlTarget
+-(id)initWithControllerMap: (ControllerProperties*)pController
+{
+ if( (self = [super init]) )
+ {
+ mpController = pController;
+ }
+ return self;
+}
+-(void)triggered:(id)pSender;
+{
+ if( [pSender isMemberOfClass: [NSPopUpButton class]] )
+ {
+ NSPopUpButton* pBtn = (NSPopUpButton*)pSender;
+ NSMenuItem* pSelected = [pBtn selectedItem];
+ if( pSelected )
+ {
+ int nTag = [pSelected tag];
+ mpController->changePropertyWithIntValue( nTag );
+ }
+ }
+ else if( [pSender isMemberOfClass: [NSButton class]] )
+ {
+ NSButton* pBtn = (NSButton*)pSender;
+ int nTag = [pBtn tag];
+ mpController->changePropertyWithBoolValue( nTag, [pBtn state] == NSOnState );
+ }
+ else if( [pSender isMemberOfClass: [NSMatrix class]] )
+ {
+ NSObject* pObj = [(NSMatrix*)pSender selectedCell];
+ if( [pObj isMemberOfClass: [NSButtonCell class]] )
+ {
+ NSButtonCell* pCell = (NSButtonCell*)pObj;
+ int nTag = [pCell tag];
+ mpController->changePropertyWithIntValue( nTag );
+ }
+ }
+ else if( [pSender isMemberOfClass: [NSTextField class]] )
+ {
+ NSTextField* pField = (NSTextField*)pSender;
+ int nTag = [pField tag];
+ rtl::OUString aValue = GetOUString( [pSender stringValue] );
+ mpController->changePropertyWithStringValue( nTag, aValue );
+ }
+ else
+ {
+ DBG_ERROR( "unsupported class" );
+ }
+ mpController->updateEnableState();
+}
+-(void)triggeredNumeric:(id)pSender;
+{
+ if( [pSender isMemberOfClass: [NSTextField class]] )
+ {
+ NSTextField* pField = (NSTextField*)pSender;
+ int nTag = [pField tag];
+ sal_Int64 nValue = [pField intValue];
+
+ NSView* pOther = mpController->getPair( pField );
+ if( pOther )
+ [(NSControl*)pOther setIntValue: nValue];
+
+ mpController->changePropertyWithIntValue( nTag, nValue );
+ }
+ else if( [pSender isMemberOfClass: [NSStepper class]] )
+ {
+ NSStepper* pStep = (NSStepper*)pSender;
+ int nTag = [pStep tag];
+ sal_Int64 nValue = [pStep intValue];
+
+ NSView* pOther = mpController->getPair( pStep );
+ if( pOther )
+ [(NSControl*)pOther setIntValue: nValue];
+
+ mpController->changePropertyWithIntValue( nTag, nValue );
+ }
+ else
+ {
+ DBG_ERROR( "unsupported class" );
+ }
+ mpController->updateEnableState();
+}
+-(void)triggeredPreview:(id)pSender
+{
+ mpController->changePreview( pSender );
+}
+-(void)dealloc
+{
+ delete mpController;
+ [super dealloc];
+}
+@end
+
+struct ColumnItem
+{
+ NSControl* pControl;
+ long nOffset;
+ NSControl* pSubControl;
+
+ ColumnItem( NSControl* i_pControl = nil, long i_nOffset = 0, NSControl* i_pSub = nil )
+ : pControl( i_pControl )
+ , nOffset( i_nOffset )
+ , pSubControl( i_pSub )
+ {}
+
+ long getWidth() const
+ {
+ long nWidth = 0;
+ if( pControl )
+ {
+ NSRect aCtrlRect = [pControl frame];
+ nWidth = aCtrlRect.size.width;
+ nWidth += nOffset;
+ if( pSubControl )
+ {
+ NSRect aSubRect = [pSubControl frame];
+ nWidth += aSubRect.size.width;
+ nWidth += aSubRect.origin.x - (aCtrlRect.origin.x + aCtrlRect.size.width);
+ }
+ }
+ return nWidth;
+ }
+};
+
+static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize,
+ std::vector< ColumnItem >& rLeftColumn,
+ std::vector< ColumnItem >& rRightColumn
+ )
+{
+ // balance columns
+
+ // first get overall column widths
+ long nLeftWidth = 0;
+ long nRightWidth = 0;
+ for( size_t i = 0; i < rLeftColumn.size(); i++ )
+ {
+ long nW = rLeftColumn[i].getWidth();
+ if( nW > nLeftWidth )
+ nLeftWidth = nW;
+ }
+ for( size_t i = 0; i < rRightColumn.size(); i++ )
+ {
+ long nW = rRightColumn[i].getWidth();
+ if( nW > nRightWidth )
+ nRightWidth = nW;
+ }
+
+ // right align left column
+ for( size_t i = 0; i < rLeftColumn.size(); i++ )
+ {
+ if( rLeftColumn[i].pControl )
+ {
+ NSRect aCtrlRect = [rLeftColumn[i].pControl frame];
+ long nX = nLeftWidth - aCtrlRect.size.width;
+ if( rLeftColumn[i].pSubControl )
+ {
+ NSRect aSubRect = [rLeftColumn[i].pSubControl frame];
+ nX -= aSubRect.size.width + (aSubRect.origin.x - (aCtrlRect.origin.x + aCtrlRect.size.width));
+ aSubRect.origin.x = nLeftWidth - aSubRect.size.width;
+ [rLeftColumn[i].pSubControl setFrame: aSubRect];
+ }
+ aCtrlRect.origin.x = nX;
+ [rLeftColumn[i].pControl setFrame: aCtrlRect];
+ }
+ }
+
+ // left align right column
+ for( size_t i = 0; i < rRightColumn.size(); i++ )
+ {
+ if( rRightColumn[i].pControl )
+ {
+ NSRect aCtrlRect = [rRightColumn[i].pControl frame];
+ long nX = nLeftWidth + 3;
+ if( rRightColumn[i].pSubControl )
+ {
+ NSRect aSubRect = [rRightColumn[i].pSubControl frame];
+ aSubRect.origin.x = nX + aSubRect.origin.x - aCtrlRect.origin.x;
+ [rRightColumn[i].pSubControl setFrame: aSubRect];
+ }
+ aCtrlRect.origin.x = nX;
+ [rRightColumn[i].pControl setFrame: aCtrlRect];
+ }
+ }
+
+ NSArray* pSubViews = [pView subviews];
+ unsigned int nViews = [pSubViews count];
+ NSRect aUnion = { { 0, 0 }, { 0, 0 } };
+
+ // get the combined frame of all subviews
+ for( unsigned int n = 0; n < nViews; n++ )
+ {
+ aUnion = NSUnionRect( aUnion, [[pSubViews objectAtIndex: n] frame] );
+ }
+
+ // move everything so it will fit
+ for( unsigned int n = 0; n < nViews; n++ )
+ {
+ NSView* pCurSubView = [pSubViews objectAtIndex: n];
+ NSRect aFrame = [pCurSubView frame];
+ aFrame.origin.x -= aUnion.origin.x - 5;
+ aFrame.origin.y -= aUnion.origin.y - 5;
+ [pCurSubView setFrame: aFrame];
+ }
+
+ // resize the view itself
+ aUnion.size.height += 10;
+ aUnion.size.width += 20;
+ [pView setFrameSize: aUnion.size];
+
+ if( aUnion.size.width > rMaxSize.width )
+ rMaxSize.width = aUnion.size.width;
+ if( aUnion.size.height > rMaxSize.height )
+ rMaxSize.height = aUnion.size.height;
+}
+
+static void adjustTabViews( NSTabView* pTabView, NSSize aTabSize )
+{
+ // loop over all contained tab pages
+ NSArray* pTabbedViews = [pTabView tabViewItems];
+ int nViews = [pTabbedViews count];
+ for( int i = 0; i < nViews; i++ )
+ {
+ NSTabViewItem* pItem = (NSTabViewItem*)[pTabbedViews objectAtIndex: i];
+ NSView* pView = [pItem view];
+ if( pView )
+ {
+ NSRect aRect = [pView frame];
+ double nDiff = aTabSize.height - aRect.size.height;
+ aRect.size = aTabSize;
+ [pView setFrame: aRect];
+
+ NSArray* pSubViews = [pView subviews];
+ unsigned int nSubViews = [pSubViews count];
+
+ // move everything up
+ for( unsigned int n = 0; n < nSubViews; n++ )
+ {
+ NSView* pCurSubView = [pSubViews objectAtIndex: n];
+ NSRect aFrame = [pCurSubView frame];
+ aFrame.origin.y += nDiff;
+ // give separators the correct width
+ // separators are currently the only NSBoxes we use
+ if( [pCurSubView isMemberOfClass: [NSBox class]] )
+ {
+ aFrame.size.width = aTabSize.width - aFrame.origin.x - 10;
+ }
+ [pCurSubView setFrame: aFrame];
+ }
+ }
+ }
+}
+
+static NSControl* createLabel( const rtl::OUString& i_rText )
+{
+ NSString* pText = CreateNSString( i_rText );
+ NSRect aTextRect = { { 0, 0 }, {20, 15} };
+ NSTextField* pTextView = [[NSTextField alloc] initWithFrame: aTextRect];
+ [pTextView setFont: [NSFont controlContentFontOfSize: 0]];
+ [pTextView setEditable: NO];
+ [pTextView setSelectable: NO];
+ [pTextView setDrawsBackground: NO];
+ [pTextView setBordered: NO];
+ [pTextView setStringValue: pText];
+ [pTextView sizeToFit];
+ [pText release];
+ return pTextView;
+}
+
+static sal_Int32 findBreak( const rtl::OUString& i_rText, sal_Int32 i_nPos )
+{
+ sal_Int32 nRet = i_rText.getLength();
+ Reference< i18n::XBreakIterator > xBI( vcl::unohelper::CreateBreakIterator() );
+ if( xBI.is() )
+ {
+ i18n::Boundary aBoundary = xBI->getWordBoundary( i_rText, i_nPos,
+ Application::GetSettings().GetLocale(),
+ i18n::WordType::ANYWORD_IGNOREWHITESPACES,
+ sal_True );
+ nRet = aBoundary.endPos;
+ }
+ return nRet;
+}
+
+static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText )
+{
+ NSString* pText = CreateNSString( i_rText );
+ [pBtn setTitle: pText];
+ [pText release];
+ NSSize aSize = [pBtn cellSize];
+ if( aSize.width > 280 )
+ {
+ // need two lines
+ sal_Int32 nLen = i_rText.getLength();
+ sal_Int32 nIndex = nLen / 2;
+ nIndex = findBreak( i_rText, nIndex );
+ if( nIndex < nLen )
+ {
+ rtl::OUStringBuffer aBuf( i_rText );
+ aBuf.setCharAt( nIndex, '\n' );
+ pText = CreateNSString( aBuf.makeStringAndClear() );
+ [pBtn setTitle: pText];
+ [pText release];
+ }
+ }
+}
+
+
+@implementation AquaPrintAccessoryView
++(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp withController: (vcl::PrinterController*)pController withState: (PrintAccessoryViewState*)pState;
+{
+ const Sequence< PropertyValue >& rOptions( pController->getUIOptions() );
+ if( rOptions.getLength() == 0 )
+ return nil;
+
+ NSView* pCurParent = 0;
+ long nCurY = 0;
+ long nCurX = 0;
+ NSRect aViewFrame = { { 0, 0 }, {600, 400 } };
+ NSRect aTabViewFrame = { { 190, 0 }, {410, 400 } };
+ NSSize aMaxTabSize = { 0, 0 };
+ NSView* pAccessoryView = [[NSView alloc] initWithFrame: aViewFrame];
+ NSTabView* pTabView = [[NSTabView alloc] initWithFrame: aTabViewFrame];
+ [pAccessoryView addSubview: [pTabView autorelease]];
+
+ sal_Bool bIgnoreSubgroup = sal_False;
+
+ ControllerProperties* pControllerProperties = new ControllerProperties( pController, pOp, pAccessoryView, pTabView, pState );
+ ControlTarget* pCtrlTarget = [[ControlTarget alloc] initWithControllerMap: pControllerProperties];
+
+ std::vector< ColumnItem > aLeftColumn, aRightColumn;
+
+ for( int i = 0; i < rOptions.getLength(); i++ )
+ {
+ Sequence< beans::PropertyValue > aOptProp;
+ rOptions[i].Value >>= aOptProp;
+
+ // extract ui element
+ bool bEnabled = true;
+ rtl::OUString aCtrlType;
+ rtl::OUString aText;
+ rtl::OUString aPropertyName;
+ Sequence< rtl::OUString > aChoices;
+ sal_Int64 nMinValue = 0, nMaxValue = 0;
+ long nAttachOffset = 0;
+ sal_Bool bIgnore = sal_False;
+
+ for( int n = 0; n < aOptProp.getLength(); n++ )
+ {
+ const beans::PropertyValue& rEntry( aOptProp[ n ] );
+ if( rEntry.Name.equalsAscii( "Text" ) )
+ {
+ rEntry.Value >>= aText;
+ filterAccelerator( aText );
+ }
+ else if( rEntry.Name.equalsAscii( "ControlType" ) )
+ {
+ rEntry.Value >>= aCtrlType;
+ }
+ else if( rEntry.Name.equalsAscii( "Choices" ) )
+ {
+ rEntry.Value >>= aChoices;
+ }
+ else if( rEntry.Name.equalsAscii( "Property" ) )
+ {
+ PropertyValue aVal;
+ rEntry.Value >>= aVal;
+ aPropertyName = aVal.Name;
+ }
+ else if( rEntry.Name.equalsAscii( "Enabled" ) )
+ {
+ sal_Bool bValue = sal_True;
+ rEntry.Value >>= bValue;
+ bEnabled = bValue;
+ }
+ else if( rEntry.Name.equalsAscii( "MinValue" ) )
+ {
+ rEntry.Value >>= nMinValue;
+ }
+ else if( rEntry.Name.equalsAscii( "MaxValue" ) )
+ {
+ rEntry.Value >>= nMaxValue;
+ }
+ else if( rEntry.Name.equalsAscii( "AttachToDependency" ) )
+ {
+ nAttachOffset = 20;
+ }
+ else if( rEntry.Name.equalsAscii( "InternalUIOnly" ) )
+ {
+ rEntry.Value >>= bIgnore;
+ }
+ }
+
+ if( aCtrlType.equalsAscii( "Group" ) ||
+ aCtrlType.equalsAscii( "Subgroup" ) ||
+ aCtrlType.equalsAscii( "Radio" ) ||
+ aCtrlType.equalsAscii( "List" ) ||
+ aCtrlType.equalsAscii( "Edit" ) ||
+ aCtrlType.equalsAscii( "Range" ) ||
+ aCtrlType.equalsAscii( "Bool" ) )
+ {
+ // since our build target is MacOSX 10.4 we can have only one accessory view
+ // so we have a single accessory view that is tabbed for grouping
+ if( aCtrlType.equalsAscii( "Group" )
+ || ! pCurParent
+ || ( aCtrlType.equalsAscii( "Subgroup" ) && nCurY < -250 && ! bIgnore )
+ )
+ {
+ rtl::OUString aGroupTitle( aText );
+ if( aCtrlType.equalsAscii( "Subgroup" ) )
+ aGroupTitle = pControllerProperties->getMoreString();
+ // set size of current parent
+ if( pCurParent )
+ adjustViewAndChildren( pCurParent, aMaxTabSize, aLeftColumn, aRightColumn );
+
+ // new tab item
+ if( ! aText.getLength() )
+ aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OOo" ) );
+ NSString* pLabel = CreateNSString( aGroupTitle );
+ NSTabViewItem* pItem = [[NSTabViewItem alloc] initWithIdentifier: pLabel ];
+ [pItem setLabel: pLabel];
+ [pTabView addTabViewItem: pItem];
+ pCurParent = [[NSView alloc] initWithFrame: aTabViewFrame];
+ [pItem setView: pCurParent];
+ [pLabel release];
+
+ // reset indent
+ nCurX = 20;
+ // reset Y
+ nCurY = 0;
+ // clear columns
+ aLeftColumn.clear();
+ aRightColumn.clear();
+ }
+
+ if( aCtrlType.equalsAscii( "Subgroup" ) && pCurParent )
+ {
+ bIgnoreSubgroup = bIgnore;
+ if( bIgnore )
+ continue;
+
+ NSControl* pTextView = createLabel( aText );
+ [pCurParent addSubview: [pTextView autorelease]];
+ NSRect aTextRect = [pTextView frame];
+ // move to nCurY
+ aTextRect.origin.y = nCurY - aTextRect.size.height;
+ [pTextView setFrame: aTextRect];
+
+ NSRect aSepRect = { { aTextRect.size.width + 1, aTextRect.origin.y }, { 100, 6 } };
+ NSBox* pBox = [[NSBox alloc] initWithFrame: aSepRect];
+ [pBox setBoxType: NSBoxSeparator];
+ [pCurParent addSubview: [pBox autorelease]];
+
+ // update nCurY
+ nCurY = aTextRect.origin.y - 5;
+ }
+ else if( bIgnoreSubgroup || bIgnore )
+ continue;
+ else if( aCtrlType.equalsAscii( "Bool" ) && pCurParent )
+ {
+ NSRect aCheckRect = { { nCurX + nAttachOffset, 0 }, { 0, 15 } };
+ NSButton* pBtn = [[NSButton alloc] initWithFrame: aCheckRect];
+ [pBtn setButtonType: NSSwitchButton];
+ sal_Bool bVal = sal_False;
+ PropertyValue* pVal = pController->getValue( aPropertyName );
+ if( pVal )
+ pVal->Value >>= bVal;
+ [pBtn setState: bVal ? NSOnState : NSOffState];
+ linebreakCell( [pBtn cell], aText );
+ [pBtn sizeToFit];
+ [pCurParent addSubview: [pBtn autorelease]];
+
+ aRightColumn.push_back( ColumnItem( pBtn ) );
+
+ // connect target
+ [pBtn setTarget: pCtrlTarget];
+ [pBtn setAction: @selector(triggered:)];
+ int nTag = pControllerProperties->addNameTag( aPropertyName );
+ pControllerProperties->addObservedControl( pBtn );
+ [pBtn setTag: nTag];
+
+ aCheckRect = [pBtn frame];
+
+ // move to nCurY
+ aCheckRect.origin.y = nCurY - aCheckRect.size.height;
+ [pBtn setFrame: aCheckRect];
+
+ // update nCurY
+ nCurY = aCheckRect.origin.y - 5;
+ }
+ else if( aCtrlType.equalsAscii( "Radio" ) && pCurParent )
+ {
+ sal_Int32 nOff = 0;
+ if( aText.getLength() )
+ {
+ // add a label
+ NSControl* pTextView = createLabel( aText );
+ NSRect aTextRect = [pTextView frame];
+ aTextRect.origin.x = nCurX + nAttachOffset;
+ [pCurParent addSubview: [pTextView autorelease]];
+
+ aLeftColumn.push_back( ColumnItem( pTextView ) );
+
+ // move to nCurY
+ aTextRect.origin.y = nCurY - aTextRect.size.height;
+ [pTextView setFrame: aTextRect];
+
+ // update nCurY
+ nCurY = aTextRect.origin.y - 5;
+
+ // indent the radio group relative to the text
+ // nOff = 20;
+ }
+
+ // setup radio matrix
+ NSButtonCell* pProto = [[NSButtonCell alloc] init];
+
+ NSRect aRadioRect = { { nCurX + nOff, 0 }, { 280 - nCurX, 5*aChoices.getLength() } };
+ [pProto setTitle: @"RadioButtonGroup"];
+ [pProto setButtonType: NSRadioButton];
+ NSMatrix* pMatrix = [[NSMatrix alloc] initWithFrame: aRadioRect
+ mode: NSRadioModeMatrix
+ prototype: (NSCell*)pProto
+ numberOfRows: aChoices.getLength()
+ numberOfColumns: 1];
+ // get currently selected value
+ sal_Int32 nSelectVal = 0;
+ PropertyValue* pVal = pController->getValue( aPropertyName );
+ if( pVal && pVal->Value.hasValue() )
+ pVal->Value >>= nSelectVal;
+ // set individual titles
+ NSArray* pCells = [pMatrix cells];
+ for( sal_Int32 m = 0; m < aChoices.getLength(); m++ )
+ {
+ NSCell* pCell = [pCells objectAtIndex: m];
+ filterAccelerator( aChoices[m] );
+ linebreakCell( pCell, aChoices[m] );
+ //NSString* pTitle = CreateNSString( aChoices[m] );
+ //[pCell setTitle: pTitle];
+ // connect target and action
+ [pCell setTarget: pCtrlTarget];
+ [pCell setAction: @selector(triggered:)];
+ int nTag = pControllerProperties->addNameAndValueTag( aPropertyName, m );
+ pControllerProperties->addObservedControl( pCell );
+ [pCell setTag: nTag];
+ //[pTitle release];
+ // set current selection
+ if( nSelectVal == m )
+ [pMatrix selectCellAtRow: m column: 0];
+ }
+ [pMatrix sizeToFit];
+ aRadioRect = [pMatrix frame];
+
+ // move it down, so it comes to the correct position
+ aRadioRect.origin.y = nCurY - aRadioRect.size.height;
+ [pMatrix setFrame: aRadioRect];
+ [pCurParent addSubview: [pMatrix autorelease]];
+
+ aRightColumn.push_back( ColumnItem( pMatrix ) );
+
+ // update nCurY
+ nCurY = aRadioRect.origin.y - 5;
+
+ [pProto release];
+ }
+ else if( aCtrlType.equalsAscii( "List" ) && pCurParent )
+ {
+ // don't indent attached lists, looks bad in the existing cases
+ NSControl* pTextView = createLabel( aText );
+ [pCurParent addSubview: [pTextView autorelease]];
+ aLeftColumn.push_back( ColumnItem( pTextView ) );
+ NSRect aTextRect = [pTextView frame];
+ aTextRect.origin.x = nCurX /* + nAttachOffset*/;
+
+ // don't indent attached lists, looks bad in the existing cases
+ NSRect aBtnRect = { { nCurX /*+ nAttachOffset*/ + aTextRect.size.width, 0 }, { 0, 15 } };
+ NSPopUpButton* pBtn = [[NSPopUpButton alloc] initWithFrame: aBtnRect pullsDown: NO];
+
+ // iterate options
+ for( sal_Int32 m = 0; m < aChoices.getLength(); m++ )
+ {
+ NSString* pItemText = CreateNSString( aChoices[m] );
+ [pBtn addItemWithTitle: pItemText];
+ NSMenuItem* pItem = [pBtn itemWithTitle: pItemText];
+ int nTag = pControllerProperties->addNameAndValueTag( aPropertyName, m );
+ [pItem setTag: nTag];
+ [pItemText release];
+ }
+
+ PropertyValue* pVal = pController->getValue( aPropertyName );
+ sal_Int32 aSelectVal = 0;
+ if( pVal && pVal->Value.hasValue() )
+ pVal->Value >>= aSelectVal;
+ [pBtn selectItemAtIndex: aSelectVal];
+
+ // add the button to observed controls for enabled state changes
+ // also add a tag just for this purpose
+ pControllerProperties->addObservedControl( pBtn );
+ [pBtn setTag: pControllerProperties->addNameTag( aPropertyName )];
+
+ [pBtn sizeToFit];
+ [pCurParent addSubview: [pBtn autorelease]];
+
+ aRightColumn.push_back( ColumnItem( pBtn ) );
+
+ // connect target and action
+ [pBtn setTarget: pCtrlTarget];
+ [pBtn setAction: @selector(triggered:)];
+
+ // move to nCurY
+ aBtnRect = [pBtn frame];
+ aBtnRect.origin.y = nCurY - aBtnRect.size.height;
+ [pBtn setFrame: aBtnRect];
+
+ // align label
+ aTextRect.origin.y = aBtnRect.origin.y + (aBtnRect.size.height - aTextRect.size.height)/2;
+ [pTextView setFrame: aTextRect];
+
+ // update nCurY
+ nCurY = aBtnRect.origin.y - 5;
+ }
+ else if( (aCtrlType.equalsAscii( "Edit" ) || aCtrlType.equalsAscii( "Range" )) && pCurParent )
+ {
+ sal_Int32 nOff = 0;
+ if( aText.getLength() )
+ {
+ // add a label
+ NSControl* pTextView = createLabel( aText );
+ [pCurParent addSubview: [pTextView autorelease]];
+
+ aLeftColumn.push_back( ColumnItem( pTextView ) );
+
+ // move to nCurY
+ NSRect aTextRect = [pTextView frame];
+ aTextRect.origin.x = nCurX + nAttachOffset;
+ aTextRect.origin.y = nCurY - aTextRect.size.height;
+ [pTextView setFrame: aTextRect];
+
+ // update nCurY
+ nCurY = aTextRect.origin.y - 5;
+
+ // and set the offset for the real edit field
+ nOff = aTextRect.size.width + 5;
+ }
+
+ NSRect aFieldRect = { { nCurX + nOff + nAttachOffset, 0 }, { 100, 25 } };
+ NSTextField* pFieldView = [[NSTextField alloc] initWithFrame: aFieldRect];
+ [pFieldView setEditable: YES];
+ [pFieldView setSelectable: YES];
+ [pFieldView setDrawsBackground: YES];
+ [pFieldView sizeToFit]; // FIXME: this does nothing
+ [pCurParent addSubview: [pFieldView autorelease]];
+
+ aRightColumn.push_back( ColumnItem( pFieldView ) );
+
+ // add the field to observed controls for enabled state changes
+ // also add a tag just for this purpose
+ pControllerProperties->addObservedControl( pFieldView );
+ int nTag = pControllerProperties->addNameTag( aPropertyName );
+ [pFieldView setTag: nTag];
+ // pControllerProperties->addNamedView( pFieldView, aPropertyName );
+
+ // move to nCurY
+ aFieldRect.origin.y = nCurY - aFieldRect.size.height;
+ [pFieldView setFrame: aFieldRect];
+
+ // current value
+ PropertyValue* pVal = pController->getValue( aPropertyName );
+ if( aCtrlType.equalsAscii( "Range" ) )
+ {
+ // add a stepper control
+ NSRect aStepFrame = { { aFieldRect.origin.x + aFieldRect.size.width + 5,
+ aFieldRect.origin.y },
+ { 15, aFieldRect.size.height } };
+ NSStepper* pStep = [[NSStepper alloc] initWithFrame: aStepFrame];
+ [pStep setIncrement: 1];
+ [pStep setValueWraps: NO];
+ [pStep setTag: nTag];
+ [pCurParent addSubview: [pStep autorelease]];
+
+ aRightColumn.back().pSubControl = pStep;
+
+ pControllerProperties->addObservedControl( pStep );
+ [pStep setTarget: pCtrlTarget];
+ [pStep setAction: @selector(triggered:)];
+
+ // constrain the text field to decimal numbers
+ NSNumberFormatter* pFormatter = [[NSNumberFormatter alloc] init];
+ [pFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4];
+ [pFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
+ [pFormatter setAllowsFloats: NO];
+ [pFormatter setMaximumFractionDigits: 0];
+ if( nMinValue != nMaxValue )
+ {
+ [pFormatter setMinimum: [[NSNumber numberWithInt: nMinValue] autorelease]];
+ [pStep setMinValue: nMinValue];
+ [pFormatter setMaximum: [[NSNumber numberWithInt: nMaxValue] autorelease]];
+ [pStep setMaxValue: nMaxValue];
+ }
+ [pFieldView setFormatter: pFormatter];
+
+ sal_Int64 nSelectVal = 0;
+ if( pVal && pVal->Value.hasValue() )
+ pVal->Value >>= nSelectVal;
+
+ [pFieldView setIntValue: nSelectVal];
+ [pStep setIntValue: nSelectVal];
+
+ pControllerProperties->addViewPair( pFieldView, pStep );
+ // connect target and action
+ [pFieldView setTarget: pCtrlTarget];
+ [pFieldView setAction: @selector(triggeredNumeric:)];
+ [pStep setTarget: pCtrlTarget];
+ [pStep setAction: @selector(triggeredNumeric:)];
+ }
+ else
+ {
+ // connect target and action
+ [pFieldView setTarget: pCtrlTarget];
+ [pFieldView setAction: @selector(triggered:)];
+
+ if( pVal && pVal->Value.hasValue() )
+ {
+ rtl::OUString aValue;
+ pVal->Value >>= aValue;
+ if( aValue.getLength() )
+ {
+ NSString* pText = CreateNSString( aValue );
+ [pFieldView setStringValue: pText];
+ [pText release];
+ }
+ }
+ }
+
+ // update nCurY
+ nCurY = aFieldRect.origin.y - 5;
+
+ }
+ }
+ else
+ {
+ DBG_ERROR( "Unsupported UI option" );
+ }
+ }
+
+ pControllerProperties->updateEnableState();
+ adjustViewAndChildren( pCurParent, aMaxTabSize, aLeftColumn, aRightColumn );
+
+ // leave some space for the preview
+ if( aMaxTabSize.height < 200 )
+ aMaxTabSize.height = 200;
+
+ // now reposition everything again so it is upper bound
+ adjustTabViews( pTabView, aMaxTabSize );
+
+ // find the minimum needed tab size
+ NSSize aTabCtrlSize = [pTabView minimumSize];
+ aTabCtrlSize.height += aMaxTabSize.height + 10;
+ if( aTabCtrlSize.width < aMaxTabSize.width + 10 )
+ aTabCtrlSize.width = aMaxTabSize.width + 10;
+ [pTabView setFrameSize: aTabCtrlSize];
+ aViewFrame.size.width = aTabCtrlSize.width + aTabViewFrame.origin.x;
+ aViewFrame.size.height = aTabCtrlSize.height + aTabViewFrame.origin.y;
+ [pAccessoryView setFrameSize: aViewFrame.size];
+
+ pControllerProperties->setupPreview( pCtrlTarget );
+
+ // set the accessory view
+ [pOp setAccessoryView: [pAccessoryView autorelease]];
+
+ // set the current selecte tab item
+ if( pState->nLastPage >= 0 && pState->nLastPage < [pTabView numberOfTabViewItems] )
+ [pTabView selectTabViewItemAtIndex: pState->nLastPage];
+
+ return pCtrlTarget;
+}
+
+@end
diff --git a/vcl/aqua/source/gdi/aquaprintview.mm b/vcl/aqua/source/gdi/aquaprintview.mm
index ba139da5f5a4..870b7cbab6f0 100755
--- a/vcl/aqua/source/gdi/aquaprintview.mm
+++ b/vcl/aqua/source/gdi/aquaprintview.mm
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: aquaprintview.mm,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.56.1 $
*
* This file is part of OpenOffice.org.
*
@@ -33,15 +33,15 @@
#include "aquaprintview.h"
#include "salprn.h"
-#include "vcl/impprn.hxx"
+#include "vcl/print.hxx"
@implementation AquaPrintView
--(id)initWithQPrinter: (ImplQPrinter*)pPrinter withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter
+-(id)initWithController: (vcl::PrinterController*)pController withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter
{
NSRect aRect = { { 0, 0 }, [pInfoPrinter->getPrintInfo() paperSize] };
if( (self = [super initWithFrame: aRect]) != nil )
{
- mpQPrinter = pPrinter;
+ mpController = pController;
mpInfoPrinter = pInfoPrinter;
}
return self;
@@ -79,6 +79,7 @@
int nPage = (int)(aPaperSize.width * rect.origin.y + rect.origin.x);
// page count is 1 based
- mpQPrinter->PrintPage( nPage-1 + mpInfoPrinter->getCurPageRangeStart() );
+ if( nPage - 1 < (mpInfoPrinter->getCurPageRangeStart() + mpInfoPrinter->getCurPageRangeCount() ) )
+ mpController->printFilteredPage( nPage-1 );
}
@end
diff --git a/vcl/aqua/source/gdi/makefile.mk b/vcl/aqua/source/gdi/makefile.mk
index deb6832a5525..90b5e55b82db 100644
--- a/vcl/aqua/source/gdi/makefile.mk
+++ b/vcl/aqua/source/gdi/makefile.mk
@@ -62,6 +62,7 @@ SLOFILES= $(SLO)$/salmathutils.obj \
$(SLO)$/salvd.obj \
$(SLO)$/salprn.obj \
$(SLO)$/aquaprintview.obj \
+ $(SLO)$/aquaprintaccessoryview.obj \
$(SLO)$/salbmp.obj
.IF "$(ENABLE_CAIRO)" == "TRUE"
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index 263a5b6e6803..dedae3ac7cfc 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -604,7 +604,8 @@ void AquaSalGraphics::EndSetClipRegion()
void AquaSalGraphics::SetLineColor()
{
maLineColor.SetAlpha( 0.0 ); // transparent
- CGContextSetStrokeColor( mrContext, maLineColor.AsArray() );
+ if( CheckContext() )
+ CGContextSetStrokeColor( mrContext, maLineColor.AsArray() );
}
// -----------------------------------------------------------------------
@@ -612,7 +613,8 @@ void AquaSalGraphics::SetLineColor()
void AquaSalGraphics::SetLineColor( SalColor nSalColor )
{
maLineColor = RGBAColor( nSalColor );
- CGContextSetStrokeColor( mrContext, maLineColor.AsArray() );
+ if( CheckContext() )
+ CGContextSetStrokeColor( mrContext, maLineColor.AsArray() );
}
// -----------------------------------------------------------------------
@@ -620,7 +622,8 @@ void AquaSalGraphics::SetLineColor( SalColor nSalColor )
void AquaSalGraphics::SetFillColor()
{
maFillColor.SetAlpha( 0.0 ); // transparent
- CGContextSetFillColor( mrContext, maFillColor.AsArray() );
+ if( CheckContext() )
+ CGContextSetFillColor( mrContext, maFillColor.AsArray() );
}
// -----------------------------------------------------------------------
@@ -628,7 +631,8 @@ void AquaSalGraphics::SetFillColor()
void AquaSalGraphics::SetFillColor( SalColor nSalColor )
{
maFillColor = RGBAColor( nSalColor );
- CGContextSetFillColor( mrContext, maFillColor.AsArray() );
+ if( CheckContext() )
+ CGContextSetFillColor( mrContext, maFillColor.AsArray() );
}
// -----------------------------------------------------------------------
diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx
index 99a1629006d2..6df50f79e9d0 100755
--- a/vcl/aqua/source/gdi/salgdiutils.cxx
+++ b/vcl/aqua/source/gdi/salgdiutils.cxx
@@ -68,6 +68,13 @@ void AquaSalGraphics::SetPrinterGraphics( CGContextRef xContext, long nDPIX, lon
mnRealDPIX = nDPIX;
mnRealDPIY = nDPIY;
+ // a previously set clip path is now invalid
+ if( mxClipPath )
+ {
+ CGPathRelease( mxClipPath );
+ mxClipPath = NULL;
+ }
+
if( mrContext )
{
CGContextSetFillColorSpace( mrContext, GetSalData()->mxRGBSpace );
@@ -126,6 +133,28 @@ void AquaSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContex
// ----------------------------------------------------------------------
+void AquaSalGraphics::InvalidateContext()
+{
+ UnsetState();
+ mrContext = 0;
+}
+
+// ----------------------------------------------------------------------
+
+void AquaSalGraphics::UnsetState()
+{
+ if( mrContext )
+ {
+ CGContextRestoreGState( mrContext );
+ mrContext = 0;
+ }
+ if( mxClipPath )
+ {
+ CGPathRelease( mxClipPath );
+ mxClipPath = NULL;
+ }
+}
+
void AquaSalGraphics::SetState()
{
CGContextRestoreGState( mrContext );
@@ -134,9 +163,9 @@ void AquaSalGraphics::SetState()
// setup clipping
if( mxClipPath )
{
- CGContextBeginPath( mrContext ); // discard any existing path
+ CGContextBeginPath( mrContext ); // discard any existing path
CGContextAddPath( mrContext, mxClipPath ); // set the current path to the clipping path
- CGContextClip( mrContext ); // use it for clipping
+ CGContextClip( mrContext ); // use it for clipping
}
// set RGB colorspace and line and fill colors
@@ -205,7 +234,7 @@ bool AquaSalGraphics::CheckContext()
CGContextRelease( rReleaseContext );
}
- DBG_ASSERT( mrContext, "<<<WARNING>>> AquaSalGraphics::CheckContext() FAILED!!!!\n" );
+ DBG_ASSERT( mrContext || mbPrinter, "<<<WARNING>>> AquaSalGraphics::CheckContext() FAILED!!!!\n" );
return (mrContext != NULL);
}
diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx
index 754358823a93..1536299331cb 100644
--- a/vcl/aqua/source/gdi/salnativewidgets.cxx
+++ b/vcl/aqua/source/gdi/salnativewidgets.cxx
@@ -450,6 +450,15 @@ UInt32 AquaSalGraphics::getState( ControlState nState )
return kThemeStateActive;
}
+UInt32 AquaSalGraphics::getTrackState( ControlState nState )
+{
+ bool bDrawActive = mpFrame ? ([mpFrame->getWindow() isKeyWindow] ? true : false) : true;
+ if( (nState & CTRL_STATE_ENABLED) == 0 || ! bDrawActive )
+ return kThemeTrackInactive;
+
+ return kThemeTrackActive;
+}
+
/*
* DrawNativeControl()
*
@@ -767,7 +776,10 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType,
aTrackInfo.attributes = kThemeTrackHorizontal;
if( Application::GetSettings().GetLayoutRTL() )
aTrackInfo.attributes |= kThemeTrackRightToLeft;
- aTrackInfo.enableState = (nState & CTRL_STATE_ENABLED) ? kThemeTrackActive : kThemeTrackInactive;
+ aTrackInfo.enableState = getTrackState( nState );
+ // the intro bitmap never gets key anyway; we want to draw that enabled
+ if( nType == CTRL_INTROPROGRESS )
+ aTrackInfo.enableState = kThemeTrackActive;
aTrackInfo.filler1 = 0;
aTrackInfo.trackInfo.progress.phase = static_cast<UInt8>(CFAbsoluteTimeGetCurrent()*10.0);
@@ -799,7 +811,7 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType,
aTrackDraw.attributes = kThemeTrackShowThumb;
if( nPart == PART_DRAW_BACKGROUND_HORZ )
aTrackDraw.attributes |= kThemeTrackHorizontal;
- aTrackDraw.enableState = kThemeTrackActive;
+ aTrackDraw.enableState = getTrackState( nState );
ScrollBarTrackInfo aScrollInfo;
aScrollInfo.viewsize = pScrollbarVal->mnVisibleSize;
diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx
index b9a1f4ef7748..47c027a033aa 100644
--- a/vcl/aqua/source/gdi/salprn.cxx
+++ b/vcl/aqua/source/gdi/salprn.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: salprn.cxx,v $
- * $Revision: 1.16 $
+ * $Revision: 1.16.56.2 $
*
* This file is part of OpenOffice.org.
*
@@ -38,7 +38,6 @@
#include "saldata.hxx"
#include "vcl/jobset.h"
#include "vcl/salptype.hxx"
-#include "vcl/impprn.hxx"
#include "vcl/print.hxx"
#include "vcl/unohelp.hxx"
@@ -47,11 +46,13 @@
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/container/XNameAccess.hpp"
#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/awt/Size.hpp"
#include <algorithm>
using namespace rtl;
using namespace vcl;
+using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
@@ -67,7 +68,9 @@ AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) :
mpPrintInfo( nil ),
mePageOrientation( ORIENTATION_PORTRAIT ),
mnStartPageOffsetX( 0 ),
- mnStartPageOffsetY( 0 )
+ mnStartPageOffsetY( 0 ),
+ mnCurPageRangeStart( 0 ),
+ mnCurPageRangeCount( 0 )
{
NSString* pStr = CreateNSString( i_rQueue.maPrinterName );
mpPrinter = [NSPrinter printerWithName: pStr];
@@ -87,6 +90,7 @@ AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) :
const int nWidth = 100, nHeight = 100;
maContextMemory.reset( reinterpret_cast<sal_uInt8*>( rtl_allocateMemory( nWidth * 4 * nHeight ) ),
boost::bind( rtl_freeMemory, _1 ) );
+
if( maContextMemory )
{
mrContext = CGBitmapContextCreate( maContextMemory.get(), nWidth, nHeight, 8, nWidth * 4, GetSalData()->mxRGBSpace, kCGImageAlphaNoneSkipFirst );
@@ -134,7 +138,7 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const
dY -= aPaperSize.height - aImageRect.size.height - aImageRect.origin.y;
CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetX, dY - mnStartPageOffsetY );
// scale to be top/down and reflect our "virtual" DPI
- CGContextScaleCTM( i_rContext, 0.1, -0.1 );
+ CGContextScaleCTM( i_rContext, 72.0/double(nDPIX), -(72.0/double(nDPIY)) );
}
else
{
@@ -148,7 +152,7 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const
dY = -aPaperSize.width;
CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetY, dY - mnStartPageOffsetX );
// scale to be top/down and reflect our "virtual" DPI
- CGContextScaleCTM( i_rContext, -0.1, 0.1 );
+ CGContextScaleCTM( i_rContext, -(72.0/double(nDPIY)), (72.0/double(nDPIX)) );
}
mpGraphics->SetPrinterGraphics( i_rContext, nDPIX, nDPIY, 1.0 );
}
@@ -296,6 +300,28 @@ BOOL AquaSalInfoPrinter::SetPrinterData( ImplJobSetup* io_pSetupData )
// -----------------------------------------------------------------------
+void AquaSalInfoPrinter::setPaperSize( long i_nWidth, long i_nHeight, Orientation i_eSetOrientation )
+{
+
+ Orientation ePaperOrientation = ORIENTATION_PORTRAIT;
+ const PaperInfo* pPaper = matchPaper( i_nWidth, i_nHeight, ePaperOrientation );
+
+ if( pPaper )
+ {
+ NSString* pPaperName = [CreateNSString( rtl::OStringToOUString(PaperInfo::toPSName(pPaper->getPaper()), RTL_TEXTENCODING_ASCII_US) ) autorelease];
+ [mpPrintInfo setPaperName: pPaperName];
+ }
+ else if( i_nWidth > 0 && i_nHeight > 0 )
+ {
+ NSSize aPaperSize = { TenMuToPt(i_nWidth), TenMuToPt(i_nHeight) };
+ [mpPrintInfo setPaperSize: aPaperSize];
+ }
+ // this seems counterintuitive
+ mePageOrientation = i_eSetOrientation;
+}
+
+// -----------------------------------------------------------------------
+
BOOL AquaSalInfoPrinter::SetData( ULONG i_nFlags, ImplJobSetup* io_pSetupData )
{
if( ! io_pSetupData || io_pSetupData->mnSystem != JOBSETUP_SYSTEM_MAC )
@@ -304,31 +330,32 @@ BOOL AquaSalInfoPrinter::SetData( ULONG i_nFlags, ImplJobSetup* io_pSetupData )
if( mpPrintInfo )
{
+ if( (i_nFlags & SAL_JOBSET_ORIENTATION) != 0 )
+ mePageOrientation = io_pSetupData->meOrientation;
+
if( (i_nFlags & SAL_JOBSET_PAPERSIZE) != 0)
{
// set paper format
- double width = 0, height = 0;
+ long width = 21000, height = 29700;
if( io_pSetupData->mePaperFormat == PAPER_USER )
{
// #i101108# sanity check
if( io_pSetupData->mnPaperWidth && io_pSetupData->mnPaperHeight )
{
- width = TenMuToPt( io_pSetupData->mnPaperWidth );
- height = TenMuToPt( io_pSetupData->mnPaperHeight );
+ width = io_pSetupData->mnPaperWidth;
+ height = io_pSetupData->mnPaperHeight;
}
}
else
- getPaperSize( width, height, io_pSetupData->mePaperFormat );
-
- if( width > 0 && height > 0 )
{
- NSSize aPaperSize = { width, height };
- [mpPrintInfo setPaperSize: aPaperSize];
+ double w = 595, h = 842;
+ getPaperSize( w, h, io_pSetupData->mePaperFormat );
+ width = static_cast<long>(PtTo10Mu( w ));
+ height = static_cast<long>(PtTo10Mu( h ));
}
- }
- if( (i_nFlags & SAL_JOBSET_ORIENTATION) != 0 )
- mePageOrientation = io_pSetupData->meOrientation;
+ setPaperSize( width, height, mePageOrientation );
+ }
}
return mpPrintInfo != nil;
@@ -424,6 +451,8 @@ ULONG AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* i_pSetupData, USH
return 0;
case PRINTER_CAPABILITIES_SETORIENTATION:
return 1;
+ case PRINTER_CAPABILITIES_SETDUPLEX:
+ return 0;
case PRINTER_CAPABILITIES_SETPAPERBIN:
return 0;
case PRINTER_CAPABILITIES_SETPAPERSIZE:
@@ -432,6 +461,8 @@ ULONG AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* i_pSetupData, USH
return 1;
case PRINTER_CAPABILITIES_EXTERNALDIALOG:
return getUseNativeDialog() ? 1 : 0;
+ case PRINTER_CAPABILITIES_PDF:
+ return 1;
default: break;
};
return 0;
@@ -470,58 +501,129 @@ void AquaSalInfoPrinter::GetPageInfo( const ImplJobSetup*,
}
}
-BOOL AquaSalInfoPrinter::StartJob( const String* pFileName,
- const String& rAppName,
- ImplJobSetup* pSetupData,
- ImplQPrinter* pQPrinter,
- bool bIsQuickJob )
+static Size getPageSize( vcl::PrinterController& i_rController, sal_Int32 i_nPage )
+{
+ Size aPageSize;
+ Sequence< PropertyValue > aPageParms( i_rController.getPageParameters( i_nPage ) );
+ for( sal_Int32 nProperty = 0, nPropertyCount = aPageParms.getLength(); nProperty < nPropertyCount; ++nProperty )
+ {
+ if( aPageParms[ nProperty ].Name.equalsAscii( "PageSize" ) )
+ {
+ awt::Size aSize;
+ aPageParms[ nProperty].Value >>= aSize;
+ aPageSize.Width() = aSize.Width;
+ aPageSize.Height() = aSize.Height;
+ break;
+ }
+ }
+ return aPageSize;
+}
+
+BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName,
+ const String& i_rJobName,
+ const String& i_rAppName,
+ ImplJobSetup* i_pSetupData,
+ vcl::PrinterController& i_rController
+ )
{
if( mbJob )
return FALSE;
BOOL bSuccess = FALSE;
- std::vector<ULONG> aPaperRanges;
- if( ! pQPrinter->GetPaperRanges( aPaperRanges, true ) )
- return FALSE;
-
- size_t nRanges = aPaperRanges.size();
+ bool bWasAborted = false;
AquaSalInstance* pInst = GetSalData()->mpFirstInstance;
-
- for( ULONG nCurRange = 0; nCurRange < nRanges-1; nCurRange++ )
+ PrintAccessoryViewState aAccViewState;
+ sal_Int32 nAllPages = 0;
+
+ aAccViewState.bNeedRestart = true;
+
+ // reset IsLastPage
+ i_rController.setLastPage( sal_False );
+
+ // update job data
+ if( i_pSetupData )
+ SetData( ~0, i_pSetupData );
+
+ // do we want a progress panel ?
+ sal_Bool bShowProgressPanel = sal_True;
+ beans::PropertyValue* pMonitor = i_rController.getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MonitorVisible" ) ) );
+ if( pMonitor )
+ pMonitor->Value >>= bShowProgressPanel;
+ if( ! i_rController.isShowDialogs() )
+ bShowProgressPanel = sal_False;
+
+ // FIXME: jobStarted() should be done after the print dialog has ended (if there is one)
+ // how do I know when that might be ?
+ i_rController.jobStarted();
+ do
{
- mnStartPageOffsetX = mnStartPageOffsetY = 0;
+ if( aAccViewState.bNeedRestart )
+ {
+ mnCurPageRangeStart = 0;
+ mnCurPageRangeCount = 0;
+ nAllPages = i_rController.getFilteredPageCount();
+ }
- // update job data
- ImplJobSetup* pSetup = pQPrinter->GetPageSetup( aPaperRanges[ nCurRange ] );
- if( pSetup )
- SetData( ~0, pSetup );
- DBG_ASSERT( pSetup, "no job setup for range" );
+ aAccViewState.bNeedRestart = false;
+
+ Size aCurSize( 21000, 29700 );
+ if( nAllPages > 0 )
+ {
+ mnCurPageRangeCount = 1;
+ aCurSize = getPageSize( i_rController, mnCurPageRangeStart );
+ Size aNextSize( aCurSize );
+
+ // print pages up to a different size
+ while( mnCurPageRangeCount + mnCurPageRangeStart < nAllPages )
+ {
+ aNextSize = getPageSize( i_rController, mnCurPageRangeStart + mnCurPageRangeCount );
+ if( aCurSize == aNextSize // same page size
+ ||
+ (aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation
+ )
+ {
+ mnCurPageRangeCount++;
+ }
+ else
+ break;
+ }
+ }
+ else
+ mnCurPageRangeCount = 0;
+
+ // now for the current run
+ mnStartPageOffsetX = mnStartPageOffsetY = 0;
+ // setup the paper size and orientation
+ // do this on our associated Printer object, since that is
+ // out interface to the applications which occasionally rely on the paper
+ // information (e.g. brochure printing scales to the found paper size)
+ // also SetPaperSizeUser has the advantage that we can share a
+ // platform independent paper matching algorithm
+ boost::shared_ptr<Printer> pPrinter( i_rController.getPrinter() );
+ pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) );
+ pPrinter->SetPaperSizeUser( aCurSize, true );
- mnCurPageRangeStart = aPaperRanges[nCurRange];
- mnCurPageRangeCount = aPaperRanges[nCurRange+1] - aPaperRanges[nCurRange];
// create view
- NSView* pPrintView = [[AquaPrintView alloc] initWithQPrinter: pQPrinter withInfoPrinter: this];
+ NSView* pPrintView = [[AquaPrintView alloc] initWithController: &i_rController withInfoPrinter: this];
NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary];
// set filename
- if( pFileName )
+ if( i_pFileName )
{
[mpPrintInfo setJobDisposition: NSPrintSaveJob];
- NSString* pPath = CreateNSString( *pFileName );
+ NSString* pPath = CreateNSString( *i_pFileName );
[pPrintDict setObject: pPath forKey: NSPrintSavePath];
[pPath release];
-
- // in this case we can only deliver the print job in one file
- mnCurPageRangeStart = 0;
- mnCurPageRangeCount = aPaperRanges.back();
- nCurRange = nRanges;
}
- [pPrintDict setObject: [[NSNumber numberWithInt: (int)pQPrinter->GetCopyCount()] autorelease] forKey: NSPrintCopies];
+ [pPrintDict setObject: [[NSNumber numberWithInt: (int)i_rController.getPrinter()->GetCopyCount()] autorelease] forKey: NSPrintCopies];
[pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting];
[pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage];
- [pPrintDict setObject: [[NSNumber numberWithInt: (int)mnCurPageRangeCount] autorelease] forKey: NSPrintLastPage];
+ // #i103253# weird: for some reason, autoreleasing the value below like the others above
+ // leads do a double free malloc error. Why this value should behave differently from all the others
+ // is a mystery.
+ [pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage];
// create print operation
@@ -529,17 +631,47 @@ BOOL AquaSalInfoPrinter::StartJob( const String* pFileName,
if( pPrintOperation )
{
- bool bShowPanel = (! bIsQuickJob && getUseNativeDialog() );
+ NSObject* pReleaseAfterUse = nil;
+ bool bShowPanel = (! i_rController.isDirectPrint() && getUseNativeDialog() && i_rController.isShowDialogs() );
[pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ];
- // [pPrintOperation setShowsProgressPanel: NO];
+ [pPrintOperation setShowsProgressPanel: bShowProgressPanel ? YES : NO];
+
+ // set job title (since MacOSX 10.5)
+ if( [pPrintOperation respondsToSelector: @selector(setJobTitle:)] )
+ [pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]];
+
+ if( bShowPanel && mnCurPageRangeStart == 0 ) // only the first range of pages gets the accesory view
+ pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState];
+
bSuccess = TRUE;
mbJob = true;
pInst->startedPrintJob();
[pPrintOperation runOperation];
pInst->endedPrintJob();
+ bWasAborted = [[[pPrintOperation printInfo] jobDisposition] compare: NSPrintCancelJob] == NSOrderedSame;
mbJob = false;
+ if( pReleaseAfterUse )
+ [pReleaseAfterUse release];
}
- }
+
+ mnCurPageRangeStart += mnCurPageRangeCount;
+ mnCurPageRangeCount = 1;
+ } while( aAccViewState.bNeedRestart || mnCurPageRangeStart + mnCurPageRangeCount < nAllPages );
+
+ // inform application that it can release its data
+ // this is awkward, but the XRenderable interface has no method for this,
+ // so we need to call XRenderadble::render one last time with IsLastPage = TRUE
+ i_rController.setLastPage( sal_True );
+ GDIMetaFile aPageFile;
+ if( mrContext )
+ SetupPrinterGraphics( mrContext );
+ i_rController.getFilteredPageFile( 0, aPageFile );
+
+ i_rController.setJobState( bWasAborted
+ ? view::PrintableState_JOB_ABORTED
+ : view::PrintableState_JOB_SPOOLED );
+
+ mnCurPageRangeStart = mnCurPageRangeCount = 0;
return bSuccess;
}
@@ -581,6 +713,7 @@ SalGraphics* AquaSalInfoPrinter::StartPage( ImplJobSetup* i_pSetupData, BOOL i_b
BOOL AquaSalInfoPrinter::EndPage()
{
+ mpGraphics->InvalidateContext();
return TRUE;
}
@@ -606,31 +739,24 @@ AquaSalPrinter::~AquaSalPrinter()
// -----------------------------------------------------------------------
-BOOL AquaSalPrinter::StartJob( const String* pFileName,
- const String& rAppName,
- ImplJobSetup* pSetupData,
- ImplQPrinter* pQPrinter )
+BOOL AquaSalPrinter::StartJob( const String* i_pFileName,
+ const String& i_rJobName,
+ const String& i_rAppName,
+ ImplJobSetup* i_pSetupData,
+ vcl::PrinterController& i_rController )
{
- bool bIsQuickJob = false;
- std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator quick_it =
- pSetupData->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ) );
-
- if( quick_it != pSetupData->maValueMap.end() )
- {
- if( quick_it->second.equalsIgnoreAsciiCaseAscii( "true" ) )
- bIsQuickJob = true;
- }
-
- return mpInfoPrinter->StartJob( pFileName, rAppName, pSetupData, pQPrinter, bIsQuickJob );
+ return mpInfoPrinter->StartJob( i_pFileName, i_rJobName, i_rAppName, i_pSetupData, i_rController );
}
// -----------------------------------------------------------------------
BOOL AquaSalPrinter::StartJob( const XubString* i_pFileName,
- const XubString& i_rJobName,
- const XubString& i_rAppName,
- ULONG i_nCopies, BOOL i_bCollate,
- ImplJobSetup* i_pSetupData )
+ const XubString& i_rJobName,
+ const XubString& i_rAppName,
+ ULONG i_nCopies,
+ bool i_bCollate,
+ bool i_bDirect,
+ ImplJobSetup* i_pSetupData )
{
DBG_ERROR( "should never be called" );
return FALSE;
@@ -671,20 +797,62 @@ ULONG AquaSalPrinter::GetErrorCode()
return mpInfoPrinter->GetErrorCode();
}
-////////////////////////////
-////// IMPLEMENT US /////
-////////////////////////////
-
-DuplexMode AquaSalInfoPrinter::GetDuplexMode( const ImplJobSetup* i_pSetupData )
+void AquaSalInfoPrinter::InitPaperFormats( const ImplJobSetup* i_pSetupData )
{
- return DUPLEX_UNKNOWN;
+ m_aPaperFormats.clear();
+ m_bPapersInit = true;
+
+ if( mpPrinter )
+ {
+ if( [mpPrinter statusForTable: @"PPD"] == NSPrinterTableOK )
+ {
+ NSArray* pPaperNames = [mpPrinter stringListForKey: @"PageSize" inTable: @"PPD"];
+ if( pPaperNames )
+ {
+ unsigned int nPapers = [pPaperNames count];
+ for( unsigned int i = 0; i < nPapers; i++ )
+ {
+ NSString* pPaper = [pPaperNames objectAtIndex: i];
+ NSSize aPaperSize = [mpPrinter pageSizeForPaper: pPaper];
+ if( aPaperSize.width > 0 && aPaperSize.height > 0 )
+ {
+ PaperInfo aInfo( PtTo10Mu( aPaperSize.width ),
+ PtTo10Mu( aPaperSize.height ) );
+ m_aPaperFormats.push_back( aInfo );
+ }
+ }
+ }
+ }
+ }
}
-void AquaSalInfoPrinter::InitPaperFormats( const ImplJobSetup* i_pSetupData )
+const PaperInfo* AquaSalInfoPrinter::matchPaper( long i_nWidth, long i_nHeight, Orientation& o_rOrientation ) const
{
+ if( ! m_bPapersInit )
+ const_cast<AquaSalInfoPrinter*>(this)->InitPaperFormats( NULL );
+
+ const PaperInfo* pMatch = NULL;
+ o_rOrientation = ORIENTATION_PORTRAIT;
+ for( int n = 0; n < 2 ; n++ )
+ {
+ for( size_t i = 0; i < m_aPaperFormats.size(); i++ )
+ {
+ if( abs( m_aPaperFormats[i].getWidth() - i_nWidth ) < 50 &&
+ abs( m_aPaperFormats[i].getHeight() - i_nHeight ) < 50 )
+ {
+ pMatch = &m_aPaperFormats[i];
+ return pMatch;
+ }
+ }
+ o_rOrientation = ORIENTATION_LANDSCAPE;
+ std::swap( i_nWidth, i_nHeight );
+ }
+ return pMatch;
}
int AquaSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* i_pSetupData )
{
- return 0;
+ return 900;
}
+
+
diff --git a/vcl/inc/postgraphitestl.h b/vcl/inc/postgraphitestl.h
new file mode 100644
index 000000000000..736aa248b7ff
--- /dev/null
+++ b/vcl/inc/postgraphitestl.h
@@ -0,0 +1,9 @@
+#ifdef std_was_redefined_as_stlport
+// put things back the way they were
+# define std std_was_redefined_as_stlport
+# undef _STLP_OUTERMOST_HEADER_ID
+// force config to be re-read
+# undef _STLP_NOTHROW_INHERENTLY
+# undef _STLP_CONFIG_H
+# include <stddef.h>
+#endif
diff --git a/vcl/inc/pregraphitestl.h b/vcl/inc/pregraphitestl.h
new file mode 100644
index 000000000000..ece0af477113
--- /dev/null
+++ b/vcl/inc/pregraphitestl.h
@@ -0,0 +1,30 @@
+#if defined(GRAPHITEADAPTSTL) && defined(std)
+# include <ostream>
+# include <istream>
+# include <fstream>
+# include <iostream>
+# include <vector>
+# include <algorithm>
+# define std_was_redefined_as_stlport std
+# undef std
+# define _STLP_OUTERMOST_HEADER_ID 0xdeadbeaf
+# pragma GCC visibility push(default)
+# include _STLP_NATIVE_HEADER(exception_defines.h)
+# include _STLP_NATIVE_HEADER(limits)
+# include _STLP_NATIVE_HEADER(memory)
+# include _STLP_NATIVE_HEADER(exception)
+# include _STLP_NATIVE_HEADER(iosfwd)
+# include _STLP_NATIVE_HEADER(algorithm)
+# include _STLP_NATIVE_HEADER(string)
+# include _STLP_NATIVE_HEADER(streambuf)
+# include _STLP_NATIVE_HEADER(ios)
+# include _STLP_NATIVE_HEADER(locale)
+# include _STLP_NATIVE_HEADER(stdexcept)
+# include _STLP_NATIVE_HEADER(ostream)
+# include _STLP_NATIVE_HEADER(istream)
+# include _STLP_NATIVE_HEADER(iostream)
+# include _STLP_NATIVE_HEADER(vector)
+# pragma GCC visibility pop
+#endif
+//sil_std resolves to the std that Graphite was built with
+namespace sil_std = std;
diff --git a/vcl/inc/vcl/arrange.hxx b/vcl/inc/vcl/arrange.hxx
new file mode 100644
index 000000000000..309d0bf930ea
--- /dev/null
+++ b/vcl/inc/vcl/arrange.hxx
@@ -0,0 +1,425 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: accel.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _VCL_ARRANGE_HXX
+#define _VCL_ARRANGE_HXX
+
+#include "vcl/window.hxx"
+
+#include <vector>
+#include <map>
+#include <boost/shared_ptr.hpp>
+
+namespace vcl
+{
+ /* some helper classes for simple window layouting
+ guidelines:
+ - a WindowArranger is not a Window
+ - a WindowArranger hierarchy manages exactly one level of child windows inside a common parent
+ this is to keep the vcl Window hierarchy flat, as some code like accelerators depend on such behavior
+ - a WindowArranger never becomes owner of a Window, windows need to be destroyed separately
+ - a WindowArranger however always is owner of its child WindowArrangers, that is the
+ WindowArranger hierarchy will keep track of its objects and delete them
+ - a managed element of a WindowArranger can either be a Window (a leaf in the hierarchy)
+ or a child WindowArranger (a node in the hierarchy), but never both
+ */
+
+ class WindowArranger
+ {
+ protected:
+ struct Element
+ {
+ Window* m_pElement;
+ boost::shared_ptr<WindowArranger> m_pChild;
+ sal_Int32 m_nExpandPriority;
+ Size m_aMinSize;
+ bool m_bHidden;
+ long m_nLeftBorder;
+ long m_nTopBorder;
+ long m_nRightBorder;
+ long m_nBottomBorder;
+
+ Element()
+ : m_pElement( NULL )
+ , m_pChild()
+ , m_nExpandPriority( 0 )
+ , m_bHidden( false )
+ , m_nLeftBorder( 0 )
+ , m_nTopBorder( 0 )
+ , m_nRightBorder( 0 )
+ , m_nBottomBorder( 0 )
+ {}
+
+ Element( Window* i_pWin,
+ boost::shared_ptr<WindowArranger> const & i_pChild = boost::shared_ptr<WindowArranger>(),
+ sal_Int32 i_nExpandPriority = 0
+ )
+ : m_pElement( i_pWin )
+ , m_pChild( i_pChild )
+ , m_nExpandPriority( i_nExpandPriority )
+ , m_bHidden( false )
+ , m_nLeftBorder( 0 )
+ , m_nTopBorder( 0 )
+ , m_nRightBorder( 0 )
+ , m_nBottomBorder( 0 )
+ {}
+
+ void deleteChild() { m_pChild.reset(); }
+
+ sal_Int32 getExpandPriority() const;
+ Size getOptimalSize( WindowSizeType ) const;
+ bool isVisible() const;
+ void setPosSize( const Point&, const Size& );
+ };
+
+ Window* m_pParentWindow;
+ WindowArranger* m_pParentArranger;
+ Rectangle m_aManagedArea;
+ long m_nOuterBorder;
+
+ virtual Element* getElement( size_t i_nIndex ) = 0;
+ const Element* getConstElement( size_t i_nIndex ) const
+ { return const_cast<WindowArranger*>(this)->getElement( i_nIndex ); }
+
+
+ public:
+ WindowArranger( WindowArranger* i_pParent = NULL )
+ : m_pParentWindow( i_pParent ? i_pParent->m_pParentWindow : NULL )
+ , m_pParentArranger( i_pParent )
+ , m_nOuterBorder( 0 )
+ {}
+ virtual ~WindowArranger();
+
+ // ask what would be the optimal size
+ virtual Size getOptimalSize( WindowSizeType ) const = 0;
+ // call Resize to trigger layouting inside the managed area
+ // without function while parent window is unset
+ virtual void resize() = 0;
+ // avoid this if possible, using the constructor instead
+ // there can be only one parent window and all managed windows MUST
+ // be direct children of that window
+ // violating that condition will result in undefined behavior
+ virtual void setParentWindow( Window* );
+
+ virtual void setParent( WindowArranger* );
+
+ virtual size_t countElements() const = 0;
+ boost::shared_ptr<WindowArranger> getChild( size_t i_nIndex ) const
+ {
+ const Element* pEle = getConstElement( i_nIndex );
+ return pEle ? pEle->m_pChild : boost::shared_ptr<WindowArranger>();
+ }
+ Window* getWindow( size_t i_nIndex ) const
+ {
+ const Element* pEle = getConstElement( i_nIndex );
+ return pEle ? pEle->m_pElement : NULL;
+ }
+
+ virtual bool isVisible() const; // true if any element is visible
+
+ sal_Int32 getExpandPriority( size_t i_nIndex ) const
+ {
+ const Element* pEle = getConstElement( i_nIndex );
+ return pEle ? pEle->getExpandPriority() : 0;
+ }
+
+ Size getMinimumSize( size_t i_nIndex ) const
+ {
+ const Element* pEle = getConstElement( i_nIndex );
+ return pEle ? pEle->m_aMinSize : Size();
+ }
+
+ bool setMinimumSize( size_t i_nIndex, const Size& i_rMinSize )
+ {
+ Element* pEle = getElement( i_nIndex );
+ if( pEle )
+ pEle->m_aMinSize = i_rMinSize;
+ return pEle != NULL;
+ }
+
+ void setBorders( size_t i_nIndex, long i_nLeft, long i_nTop, long i_nRight, long i_nBottom )
+ {
+ Element* pEle = getElement( i_nIndex );
+ if( pEle )
+ {
+ pEle->m_nLeftBorder = i_nLeft;
+ pEle->m_nRightBorder = i_nRight;
+ pEle->m_nTopBorder = i_nTop;
+ pEle->m_nBottomBorder = i_nBottom;
+ }
+ }
+
+ void show( bool i_bShow = true, bool i_bImmediateUpdate = true );
+
+ void setManagedArea( const Rectangle& i_rArea )
+ {
+ m_aManagedArea = i_rArea;
+ resize();
+ }
+ const Rectangle& getManagedArea() const { return m_aManagedArea; }
+
+ void setOuterBorder( long i_nBorder )
+ {
+ m_nOuterBorder = i_nBorder;
+ resize();
+ }
+ };
+
+ class RowOrColumn : public WindowArranger
+ {
+ long m_nBorderWidth;
+ bool m_bColumn;
+
+ std::vector< WindowArranger::Element > m_aElements;
+
+ void distributeRowWidth( std::vector< Size >& io_rSizes, long i_nUsedWidth, long i_nExtraWidth );
+ void distributeColumnHeight( std::vector< Size >& io_rSizes, long i_nUsedHeight, long i_nExtraHeight );
+ protected:
+ virtual Element* getElement( size_t i_nIndex )
+ { return i_nIndex < m_aElements.size() ? &m_aElements[ i_nIndex ] : 0; }
+
+ public:
+ RowOrColumn( WindowArranger* i_pParent = NULL,
+ bool bColumn = true, long i_nBorderWidth = 5 )
+ : WindowArranger( i_pParent )
+ , m_nBorderWidth( i_nBorderWidth )
+ , m_bColumn( bColumn )
+ {}
+
+ virtual ~RowOrColumn();
+
+ virtual Size getOptimalSize( WindowSizeType ) const;
+ virtual void resize();
+ virtual size_t countElements() const { return m_aElements.size(); }
+
+ // add a managed window at the given index
+ // an index smaller than zero means add the window at the end
+ size_t addWindow( Window*, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 );
+ void remove( Window* );
+
+ size_t addChild( boost::shared_ptr<WindowArranger> const &, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 );
+ // convenience: use for addChild( new WindowArranger( ... ) ) constructs
+ size_t addChild( WindowArranger* i_pNewChild, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 )
+ { return addChild( boost::shared_ptr<WindowArranger>( i_pNewChild ), i_nExpandPrio, i_nIndex ); }
+ void remove( boost::shared_ptr<WindowArranger> const & );
+
+ long getBorderWidth() const { return m_nBorderWidth; }
+ };
+
+ class LabeledElement : public WindowArranger
+ {
+ WindowArranger::Element m_aLabel;
+ WindowArranger::Element m_aElement;
+ long m_nDistance;
+ long m_nLabelColumnWidth;
+ int m_nLabelStyle;
+ protected:
+ virtual Element* getElement( size_t i_nIndex )
+ {
+ if( i_nIndex == 0 )
+ return &m_aLabel;
+ else if( i_nIndex == 1 )
+ return &m_aElement;
+ return 0;
+ }
+
+ public:
+ LabeledElement( WindowArranger* i_pParent = NULL, int i_nLabelStyle = 0, long i_nDistance = 5 )
+ : WindowArranger( i_pParent )
+ , m_nDistance( i_nDistance )
+ , m_nLabelColumnWidth( 0 )
+ , m_nLabelStyle( i_nLabelStyle )
+ {}
+
+ virtual ~LabeledElement();
+
+ virtual Size getOptimalSize( WindowSizeType ) const;
+ virtual void resize();
+ virtual size_t countElements() const { return 2; }
+
+ void setLabel( Window* );
+ void setLabel( boost::shared_ptr<WindowArranger> const & );
+ void setElement( Window* );
+ void setElement( boost::shared_ptr<WindowArranger> const & );
+ void setLabelColumnWidth( long i_nWidth )
+ { m_nLabelColumnWidth = i_nWidth; }
+
+ Size getLabelSize( WindowSizeType i_eType ) const
+ { return m_aLabel.getOptimalSize( i_eType ); }
+ Size getElementSize( WindowSizeType i_eType ) const
+ { return m_aElement.getOptimalSize( i_eType ); }
+ };
+
+ class LabelColumn : public RowOrColumn
+ {
+ long getLabelWidth() const;
+ public:
+ LabelColumn( WindowArranger* i_pParent = NULL, long i_nBorderWidth = 5 )
+ : RowOrColumn( i_pParent, true, i_nBorderWidth )
+ {}
+ virtual ~LabelColumn();
+
+ virtual Size getOptimalSize( WindowSizeType ) const;
+ virtual void resize();
+
+ // returns the index of the added label
+ size_t addRow( Window* i_pLabel, boost::shared_ptr<WindowArranger> const& i_rElement, long i_nIndent = 0 );
+ size_t addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent = 0 );
+ };
+
+ class Indenter : public WindowArranger
+ {
+ long m_nIndent;
+ WindowArranger::Element m_aElement;
+
+ protected:
+ virtual Element* getElement( size_t i_nIndex )
+ { return i_nIndex == 0 ? &m_aElement : NULL; }
+
+ public:
+ Indenter( WindowArranger* i_pParent = NULL, long i_nIndent = 15 )
+ : WindowArranger( i_pParent )
+ , m_nIndent( i_nIndent )
+ {}
+
+ virtual ~Indenter();
+
+ virtual Size getOptimalSize( WindowSizeType ) const;
+ virtual void resize();
+ virtual size_t countElements() const { return (m_aElement.m_pElement != 0 || m_aElement.m_pChild != 0) ? 1 : 0; }
+
+ void setIndent( long i_nIndent )
+ {
+ m_nIndent = i_nIndent;
+ resize();
+ }
+
+ void setWindow( Window*, sal_Int32 i_nExpandPrio = 0 );
+ void setChild( boost::shared_ptr<WindowArranger> const &, sal_Int32 i_nExpandPrio = 0 );
+ // convenience: use for setChild( new WindowArranger( ... ) ) constructs
+ void setChild( WindowArranger* i_pChild, sal_Int32 i_nExpandPrio = 0 )
+ { setChild( boost::shared_ptr<WindowArranger>( i_pChild ), i_nExpandPrio ); }
+ };
+
+ class Spacer : public WindowArranger
+ {
+ WindowArranger::Element m_aElement;
+ Size m_aSize;
+
+ protected:
+ virtual Element* getElement( size_t i_nIndex )
+ { return i_nIndex == 0 ? &m_aElement : NULL; }
+
+ public:
+ Spacer( WindowArranger* i_pParent = NULL, sal_Int32 i_nPrio = 20, const Size& i_rSize = Size( 0, 0 ) )
+ : WindowArranger( i_pParent )
+ , m_aElement( NULL, boost::shared_ptr<WindowArranger>(), i_nPrio )
+ , m_aSize( i_rSize )
+ {}
+
+ virtual ~Spacer() {}
+
+ virtual Size getOptimalSize( WindowSizeType ) const
+ { return m_aSize; }
+ virtual void resize() {}
+ virtual void setParentWindow( Window* ) {}
+ virtual size_t countElements() const { return 1; }
+ virtual bool isVisible() const { return true; }
+ };
+
+ class MatrixArranger : public WindowArranger
+ {
+ long m_nBorderX;
+ long m_nBorderY;
+
+ struct MatrixElement : public WindowArranger::Element
+ {
+ sal_uInt32 m_nX;
+ sal_uInt32 m_nY;
+
+ MatrixElement()
+ : WindowArranger::Element()
+ , m_nX( 0 )
+ , m_nY( 0 )
+ {}
+
+ MatrixElement( Window* i_pWin,
+ sal_uInt32 i_nX, sal_uInt32 i_nY,
+ boost::shared_ptr<WindowArranger> const & i_pChild = boost::shared_ptr<WindowArranger>(),
+ sal_Int32 i_nExpandPriority = 0
+ )
+ : WindowArranger::Element( i_pWin, i_pChild, i_nExpandPriority )
+ , m_nX( i_nX )
+ , m_nY( i_nY )
+ {
+ }
+ };
+
+ std::vector< MatrixElement > m_aElements;
+ std::map< sal_uInt64, size_t > m_aMatrixMap; // maps (x | (y << 32)) to index in m_aElements
+
+ sal_uInt64 getMap( sal_uInt32 i_nX, sal_uInt32 i_nY )
+ { return static_cast< sal_uInt64 >(i_nX) | (static_cast< sal_uInt64>(i_nY) << 32 ); }
+
+ Size getOptimalSize( WindowSizeType, std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights ) const;
+ protected:
+ virtual Element* getElement( size_t i_nIndex )
+ { return i_nIndex < m_aElements.size() ? &m_aElements[ i_nIndex ] : 0; }
+
+ public:
+ MatrixArranger( WindowArranger* i_pParent = NULL,
+ long i_nBorderX = 5,
+ long i_nBorderY = 5 )
+ : WindowArranger( i_pParent )
+ , m_nBorderX( i_nBorderX )
+ , m_nBorderY( i_nBorderY )
+ {}
+
+ virtual ~MatrixArranger();
+
+ virtual Size getOptimalSize( WindowSizeType ) const;
+ virtual void resize();
+ virtual size_t countElements() const { return m_aElements.size(); }
+
+ // add a managed window at the given matrix position
+ size_t addWindow( Window*, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 );
+ void remove( Window* );
+
+ size_t addChild( boost::shared_ptr<WindowArranger> const &, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 );
+ // convenience: use for addChild( new WindowArranger( ... ) ) constructs
+ size_t addChild( WindowArranger* i_pNewChild, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 )
+ { return addChild( boost::shared_ptr<WindowArranger>( i_pNewChild ), i_nX, i_nY, i_nExpandPrio ); }
+ void remove( boost::shared_ptr<WindowArranger> const & );
+ };
+
+}
+
+#endif
+
diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx
index b80edf6712cd..b5f70217e149 100644
--- a/vcl/inc/vcl/button.hxx
+++ b/vcl/inc/vcl/button.hxx
@@ -425,7 +425,6 @@ private:
SAL_DLLPRIVATE void ImplInitCheckBoxData();
SAL_DLLPRIVATE WinBits ImplInitStyle( const Window* pPrevWindow, WinBits nStyle );
SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground );
- SAL_DLLPRIVATE void ImplDrawCheckBoxState();
SAL_DLLPRIVATE void ImplInvalidateOrDrawCheckBoxState();
SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
const Point& rPos, const Size& rSize,
@@ -450,10 +449,12 @@ protected:
SAL_DLLPRIVATE virtual const Color&
GetCanonicalTextColor( const StyleSettings& _rStyle ) const;
+ SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState();
+ SAL_DLLPRIVATE const Rectangle& GetStateRect() const { return maStateRect; }
+ SAL_DLLPRIVATE const Rectangle& GetMouseRect() const { return maMouseRect; }
public:
SAL_DLLPRIVATE void ImplCheck();
SAL_DLLPRIVATE void ImplSetMinimumNWFSize();
-
public:
CheckBox( Window* pParent, WinBits nStyle = 0 );
CheckBox( Window* pParent, const ResId& rResId );
@@ -552,4 +553,15 @@ public:
~TriStateBox();
};
+class VCL_DLLPUBLIC DisclosureButton : public CheckBox
+{
+protected:
+ SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState();
+public:
+ DisclosureButton( Window* pParent, WinBits nStyle = 0 );
+ DisclosureButton( Window* pParent, const ResId& rResId );
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+};
+
#endif // _SV_BUTTON_HXX
diff --git a/vcl/inc/vcl/combobox.hxx b/vcl/inc/vcl/combobox.hxx
index d57d4b8a7372..cbceffaff6c0 100644
--- a/vcl/inc/vcl/combobox.hxx
+++ b/vcl/inc/vcl/combobox.hxx
@@ -192,8 +192,12 @@ public:
void* GetEntryData( USHORT nPos ) const;
void SetTopEntry( USHORT nPos );
+ void ShowProminentEntry( USHORT nPos );
USHORT GetTopEntry() const;
+ void SetProminentEntryType( ProminentEntry eType );
+ ProminentEntry GetProminentEntryType() const;
+
USHORT GetDisplayLineCount() const;
USHORT GetSelectEntryCount() const;
diff --git a/vcl/inc/vcl/configsettings.hxx b/vcl/inc/vcl/configsettings.hxx
index aee684a84ca4..211ea3f0892b 100644
--- a/vcl/inc/vcl/configsettings.hxx
+++ b/vcl/inc/vcl/configsettings.hxx
@@ -54,7 +54,6 @@ namespace vcl
std::hash_map< rtl::OUString, SmallOUStrMap, rtl::OUStringHash > m_aSettings;
virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames );
- virtual void Commit();
void getValues();
SettingsConfigItem();
@@ -65,6 +64,8 @@ namespace vcl
const rtl::OUString& getValue( const rtl::OUString& rGroup, const rtl::OUString& rKey ) const;
void setValue( const rtl::OUString& rGroup, const rtl::OUString& rKey, const rtl::OUString& rValue );
+
+ virtual void Commit();
};
//........................................................................
diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx
index fb99bd028631..ad6a4ee017d9 100644
--- a/vcl/inc/vcl/edit.hxx
+++ b/vcl/inc/vcl/edit.hxx
@@ -120,6 +120,7 @@ private:
SAL_DLLPRIVATE void ImplCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard );
SAL_DLLPRIVATE void ImplPaste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard );
SAL_DLLPRIVATE long ImplGetExtraOffset() const;
+ SAL_DLLPRIVATE long ImplGetTextYPosition() const;
SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XExtendedInputSequenceChecker > ImplGetInputSequenceChecker() const;
SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > ImplGetBreakIterator() const;
diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx
index a5c834fce486..d6ffc1625afe 100644
--- a/vcl/inc/vcl/fixed.hxx
+++ b/vcl/inc/vcl/fixed.hxx
@@ -187,6 +187,7 @@ public:
virtual void StateChanged( StateChangedType nType );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
virtual void UserDraw( const UserDrawEvent& rUDEvt );
+ virtual Size GetOptimalSize(WindowSizeType eType) const;
void SetImage( const Image& rImage );
const Image& GetImage() const { return maImage; }
diff --git a/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx
index c53460d35584..e4acd55439cc 100644
--- a/vcl/inc/vcl/gdimtf.hxx
+++ b/vcl/inc/vcl/gdimtf.hxx
@@ -164,6 +164,7 @@ public:
void Scale( double fScaleX, double fScaleY );
void Scale( const Fraction& rScaleX, const Fraction& rScaleY );
void Rotate( long nAngle10 );
+ void Clip( const Rectangle& );
/* get the bound rect of the contained actions
* caveats:
* - clip actions will limit the contained actions,
diff --git a/vcl/inc/vcl/graphite_adaptors.hxx b/vcl/inc/vcl/graphite_adaptors.hxx
index 41ffa00b0f8f..9a0a42c01ce0 100644
--- a/vcl/inc/vcl/graphite_adaptors.hxx
+++ b/vcl/inc/vcl/graphite_adaptors.hxx
@@ -58,10 +58,11 @@
#include "vcl/dllapi.h"
// Libraries
+#include "pregraphitestl.h"
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/ITextSource.h>
-
+#include "postgraphitestl.h"
// Module type definitions and forward declarations.
//
@@ -121,7 +122,7 @@ public:
const grutils::GrFeatureParser * features() const { return mpFeatures; };
private:
- virtual void UniqueCacheInfo(std::wstring &, bool &, bool &);
+ virtual void UniqueCacheInfo(sil_std::wstring &, bool &, bool &);
FreetypeServerFont& mrFont;
FontProperties maFontProperties;
diff --git a/vcl/inc/vcl/graphite_cache.hxx b/vcl/inc/vcl/graphite_cache.hxx
index 5a537c5f1e48..73e3e2c9f1fe 100644
--- a/vcl/inc/vcl/graphite_cache.hxx
+++ b/vcl/inc/vcl/graphite_cache.hxx
@@ -58,10 +58,11 @@ public:
void clear();
#ifdef GRCACHE_REUSE_VECTORS
void setGlyphVectors(long nWidth, GraphiteLayout::Glyphs & vGlyphs, std::vector<int> vCharDxs,
- std::vector<int> & vChar2Base, std::vector<int> & vGlyph2Char)
+ std::vector<int> & vChar2Base, std::vector<int> & vGlyph2Char, float fScale)
{
clearVectors();
mnWidth = nWidth;
+ m_fontScale = fScale;
mvGlyphs.insert(mvGlyphs.begin(), vGlyphs.begin(), vGlyphs.end());
mvCharDxs.insert(mvCharDxs.begin(),vCharDxs.begin(),vCharDxs.end());
mvChar2BaseGlyph.insert(mvChar2BaseGlyph.begin(),vChar2Base.begin(),vChar2Base.end());
@@ -78,6 +79,7 @@ public:
const std::vector<int> & charDxs() const { return mvCharDxs; }
const std::vector<int> & char2BaseGlyph() const { return mvChar2BaseGlyph; }
const std::vector<int> & glyph2Char() const { return mvGlyph2Char; }
+ float & fontScale() { return m_fontScale; }
#endif
private:
rtl::OUString * m_rope;
diff --git a/vcl/inc/vcl/graphite_features.hxx b/vcl/inc/vcl/graphite_features.hxx
index 6cfe5dfca0fd..d3cfd99e0fe4 100644
--- a/vcl/inc/vcl/graphite_features.hxx
+++ b/vcl/inc/vcl/graphite_features.hxx
@@ -32,10 +32,11 @@
// Parse a string of features specified as ; separated pairs.
// e.g.
// 1001=1&2002=2&fav1=0
-
+#include "pregraphitestl.h"
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/GrFeature.h>
+#include "postgraphitestl.h"
namespace grutils
{
diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx
index 2ec3bc4c2391..325f67e852ce 100644
--- a/vcl/inc/vcl/graphite_layout.hxx
+++ b/vcl/inc/vcl/graphite_layout.hxx
@@ -43,11 +43,13 @@
#include <vector>
#include <utility>
// Libraries
+#include "pregraphitestl.h"
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/GrConstants.h>
#include <graphite/GrAppData.h>
#include <graphite/SegmentAux.h>
+#include "postgraphitestl.h"
// Platform
#include <vcl/sallayout.hxx>
#include <vcl/dllapi.h>
diff --git a/vcl/inc/vcl/ilstbox.hxx b/vcl/inc/vcl/ilstbox.hxx
index 81dd32ef2705..f38825028080 100644
--- a/vcl/inc/vcl/ilstbox.hxx
+++ b/vcl/inc/vcl/ilstbox.hxx
@@ -227,6 +227,7 @@ private:
long mnLeft; // Ausgabe ab Spalte
long mnBorder; // Abstand Rahmen - Text
long mnTextHeight; // Texthoehe
+ ProminentEntry meProminentType; // where is the "prominent" entry
USHORT mnSelectModifier; // Modifiers
@@ -309,6 +310,11 @@ public:
void SetTopEntry( USHORT nTop );
USHORT GetTopEntry() const { return mnTop; }
+ // ShowProminentEntry will set the entry correspoding to nEntryPos
+ // either at top or in the middle depending on the chosen style
+ void ShowProminentEntry( USHORT nEntryPos );
+ void SetProminentEntryType( ProminentEntry eType ) { meProminentType = eType; }
+ ProminentEntry GetProminentEntryType() const { return meProminentType; }
using Window::IsVisible;
BOOL IsVisible( USHORT nEntry ) const;
@@ -443,9 +449,13 @@ public:
void SetTopEntry( USHORT nTop ) { maLBWindow.SetTopEntry( nTop ); }
USHORT GetTopEntry() const { return maLBWindow.GetTopEntry(); }
+ void ShowProminentEntry( USHORT nPos ) { maLBWindow.ShowProminentEntry( nPos ); }
using Window::IsVisible;
BOOL IsVisible( USHORT nEntry ) const { return maLBWindow.IsVisible( nEntry ); }
+ void SetProminentEntryType( ProminentEntry eType ) { maLBWindow.SetProminentEntryType( eType ); }
+ ProminentEntry GetProminentEntryType() const { return maLBWindow.GetProminentEntryType(); }
+
long GetLeftIndent() const { return maLBWindow.GetLeftIndent(); }
void SetLeftIndent( USHORT n ) { maLBWindow.SetLeftIndent( n ); }
void ScrollHorz( short nDiff ) { maLBWindow.ScrollHorz( nDiff ); }
diff --git a/vcl/inc/vcl/impprn.hxx b/vcl/inc/vcl/impprn.hxx
index c86090e8b49f..0cd6e9688201 100644
--- a/vcl/inc/vcl/impprn.hxx
+++ b/vcl/inc/vcl/impprn.hxx
@@ -28,7 +28,7 @@
*
************************************************************************/
-#ifndef _SV_IMPPRN_HXX
+#if 0
#define _SV_IMPPRN_HXX
#include <vcl/print.hxx>
@@ -107,7 +107,6 @@ public:
/**
used by pull implementation to emit the next page
*/
- using Printer::PrintPage;
void PrintPage( unsigned int nPage );
/**
used by pull implementation to get the number of physical pages
diff --git a/vcl/inc/vcl/jobdata.hxx b/vcl/inc/vcl/jobdata.hxx
index 4451c566b5bf..d328f41f5b5b 100644
--- a/vcl/inc/vcl/jobdata.hxx
+++ b/vcl/inc/vcl/jobdata.hxx
@@ -74,6 +74,8 @@ struct JobData
JobData( const JobData& rData ) { *this = rData; }
+ void setCollate( bool bCollate );
+
// creates a new buffer using new
// it is up to the user to delete it again
bool getStreamBuffer( void*& pData, int& bytes );
diff --git a/vcl/inc/vcl/jobset.h b/vcl/inc/vcl/jobset.h
index 9f3eefd507d5..fd15d0c076da 100644
--- a/vcl/inc/vcl/jobset.h
+++ b/vcl/inc/vcl/jobset.h
@@ -60,12 +60,13 @@ struct ImplJobSetup
String maPrinterName; // Printer-Name
String maDriver; // Driver-Name
Orientation meOrientation; // Orientation
- USHORT mnPaperBin; // Papierschacht
- Paper mePaperFormat; // Papierformat
- long mnPaperWidth; // Papierbreite in 100tel mm
- long mnPaperHeight; // Papierhoehe in 100tel mm
- ULONG mnDriverDataLen; // Laenge der systemabhaengigen Daten
- BYTE* mpDriverData; // Systemabhaengige Daten die als Byte-Block rausgeschrieben werden
+ DuplexMode meDuplexMode; // Duplex
+ USHORT mnPaperBin; // paper bin / in tray
+ Paper mePaperFormat; // paper format
+ long mnPaperWidth; // paper width (100th mm)
+ long mnPaperHeight; // paper height (100th mm)
+ ULONG mnDriverDataLen; // length of system specific data
+ BYTE* mpDriverData; // system specific data (will be streamed a byte block)
::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > maValueMap;
ImplJobSetup();
diff --git a/vcl/inc/vcl/lstbox.h b/vcl/inc/vcl/lstbox.h
index 6097422b556b..9b95b9526d58 100644
--- a/vcl/inc/vcl/lstbox.h
+++ b/vcl/inc/vcl/lstbox.h
@@ -60,4 +60,9 @@
*/
#define LISTBOX_ENTRY_FLAG_MULTILINE 0x0000002
+/** this flags lets the item be drawn disabled (e.g. in grey text)
+ usage only guaranteed with LISTBOX_ENTRY_FLAG_DISABLE_SELECTION
+*/
+#define LISTBOX_ENTRY_FLAG_DRAW_DISABLED 0x0000004
+
#endif // _SV_LSTBOX_H
diff --git a/vcl/inc/vcl/lstbox.hxx b/vcl/inc/vcl/lstbox.hxx
index 0bf281798674..806ff9bb3e0f 100644
--- a/vcl/inc/vcl/lstbox.hxx
+++ b/vcl/inc/vcl/lstbox.hxx
@@ -168,9 +168,13 @@ public:
long GetEntryFlags( USHORT nPos ) const;
void SetTopEntry( USHORT nPos );
+ void ShowProminentEntry( USHORT nPos );
void SetTopEntryStr( const XubString& rStr );
USHORT GetTopEntry() const;
+ void SetProminentEntryType( ProminentEntry eType );
+ ProminentEntry GetProminentEntryType() const;
+
void SaveValue() { mnSaveValue = GetSelectEntryPos(); }
USHORT GetSavedValue() const { return mnSaveValue; }
diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx
index 8d3ac4e8b505..66f35823b06a 100644
--- a/vcl/inc/vcl/menu.hxx
+++ b/vcl/inc/vcl/menu.hxx
@@ -93,6 +93,8 @@ typedef USHORT MenuItemBits;
#define MIB_POPUPSELECT ((MenuItemBits)0x0020)
// not in rsc/vclsrc.hxx because only a prelimitary solution
#define MIB_NOSELECT ((MenuItemBits)0x0040)
+#define MIB_ICON ((MenuItemBits)0x0080)
+#define MIB_TEXT ((MenuItemBits)0x0100)
#define MENU_FLAG_NOAUTOMNEMONICS 0x0001
#define MENU_FLAG_HIDEDISABLEDENTRIES 0x0002
diff --git a/vcl/inc/vcl/oldprintadaptor.hxx b/vcl/inc/vcl/oldprintadaptor.hxx
new file mode 100644
index 000000000000..d8b26433af94
--- /dev/null
+++ b/vcl/inc/vcl/oldprintadaptor.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _VCL_OLDPRINTADAPTOR
+#define _VCL_OLDPRINTADAPTOR
+
+#include "vcl/print.hxx"
+
+namespace vcl
+{
+ struct ImplOldStyleAdaptorData;
+ class VCL_DLLPUBLIC OldStylePrintAdaptor : public PrinterController
+ {
+ ImplOldStyleAdaptorData* mpData;
+ public:
+ OldStylePrintAdaptor( const boost::shared_ptr< Printer >& );
+ virtual ~OldStylePrintAdaptor();
+
+ void StartPage();
+ void EndPage();
+
+ virtual int getPageCount() const;
+ virtual com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getPageParameters( int i_nPage ) const;
+ virtual void printPage( int i_nPage ) const;
+ };
+}
+
+#endif
diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx
index 4a5b92444c21..0c03652d9300 100644
--- a/vcl/inc/vcl/outdev.hxx
+++ b/vcl/inc/vcl/outdev.hxx
@@ -1131,12 +1131,15 @@ public:
false: output metafile is unchanged input metafile
@attention this is a member method, so current state can influence the result !
+ @attention the output metafile is prepared in pixel mode for the currentOutputDevice
+ state. It can not be moved or rotated reliably anymore.
*/
bool RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
long nMaxBmpDPIX, long nMaxBmpDPIY,
bool bReduceTransparency,
bool bTransparencyAutoMode,
- bool bDownsampleBitmaps
+ bool bDownsampleBitmaps,
+ const Color& rBackground = Color( COL_TRANSPARENT )
);
/** Retrieve downsampled and cropped bitmap
diff --git a/vcl/inc/vcl/popupmenuwindow.hxx b/vcl/inc/vcl/popupmenuwindow.hxx
new file mode 100644
index 000000000000..af8d1f804598
--- /dev/null
+++ b/vcl/inc/vcl/popupmenuwindow.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: floatwin.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __POPUPMENUWINDOW_HXX__
+#define __POPUPMENUWINDOW_HXX__
+
+#include "vcl/floatwin.hxx"
+
+class VCL_DLLPUBLIC PopupMenuFloatingWindow : public FloatingWindow
+{
+private:
+ struct ImplData;
+ ImplData* mpImplData;
+public:
+ PopupMenuFloatingWindow( Window* pParent, WinBits nStyle = (WB_SYSTEMFLOATWIN|WB_SYSTEMWINDOW|WB_NOBORDER) );
+ ~PopupMenuFloatingWindow();
+
+ sal_uInt16 GetMenuStackLevel() const;
+ void SetMenuStackLevel( sal_uInt16 nLevel );
+ bool IsPopupMenu() const;
+};
+
+#endif
diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx
index ed9f91b97d99..ba5bc5004362 100644
--- a/vcl/inc/vcl/ppdparser.hxx
+++ b/vcl/inc/vcl/ppdparser.hxx
@@ -37,11 +37,14 @@
#include "tools/string.hxx"
#include "tools/stream.hxx"
+#include "com/sun/star/lang/Locale.hpp"
+
#define PRINTER_PPDDIR "driver"
namespace psp {
class PPDParser;
+class PPDTranslator;
enum PPDValueType { eInvocation, eQuoted, eSymbol, eString, eNo };
@@ -49,9 +52,7 @@ struct PPDValue
{
PPDValueType m_eType;
String m_aOption;
- String m_aOptionTranslation;
String m_aValue;
- String m_aValueTranslation;
};
// ----------------------------------------------------------------------
@@ -80,7 +81,6 @@ public:
private:
bool m_bUIOption;
- String m_aUITranslation;
UIType m_eUIType;
int m_nOrderDependency;
SetupType m_eSetupType;
@@ -102,7 +102,6 @@ public:
const String& getKey() const { return m_aKey; }
bool isUIKey() const { return m_bUIOption; }
- const String& getUITranslation() const { return m_aUITranslation; }
UIType getUIType() const { return m_eUIType; }
SetupType getSetupType() const { return m_eSetupType; }
int getOrderDependency() const { return m_nOrderDependency; }
@@ -185,6 +184,9 @@ private:
// fonts
const PPDKey* m_pFontList;
+ // translations
+ PPDTranslator* m_pTranslator;
+
PPDParser( const String& rFile );
~PPDParser();
@@ -193,7 +195,7 @@ private:
void parseConstraint( const ByteString& rLine );
void parse( std::list< ByteString >& rLines );
- String handleTranslation( const ByteString& rString );
+ String handleTranslation( const ByteString& i_rString, bool i_bIsGlobalized );
static void scanPPDDir( const String& rDir );
static void initPPDFiles();
@@ -277,6 +279,17 @@ public:
String& rEncoding,
String& rCharset ) const;
const String& getFont( int ) const;
+
+
+ rtl::OUString translateKey( const rtl::OUString& i_rKey,
+ const com::sun::star::lang::Locale& i_rLocale = com::sun::star::lang::Locale() ) const;
+ rtl::OUString translateOption( const rtl::OUString& i_rKey,
+ const rtl::OUString& i_rOption,
+ const com::sun::star::lang::Locale& i_rLocale = com::sun::star::lang::Locale() ) const;
+ rtl::OUString translateValue( const rtl::OUString& i_rKey,
+ const rtl::OUString& i_rOption,
+ const rtl::OUString& i_rValue,
+ const com::sun::star::lang::Locale& i_rLocale = com::sun::star::lang::Locale() ) const;
};
// ----------------------------------------------------------------------
diff --git a/vcl/inc/vcl/print.h b/vcl/inc/vcl/print.h
index 51cbb5dee0cf..12c7439aa5b3 100644
--- a/vcl/inc/vcl/print.h
+++ b/vcl/inc/vcl/print.h
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: print.h,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.114.2 $
*
* This file is part of OpenOffice.org.
*
@@ -31,27 +31,18 @@
#ifndef _SV_PRINT_H
#define _SV_PRINT_H
-#include <tools/list.hxx>
-#include <vcl/sv.h>
-#include <vcl/dllapi.h>
+#include "vcl/sv.h"
+#include "vcl/dllapi.h"
#include <vector>
#include <hash_map>
struct SalPrinterQueueInfo;
class QueueInfo;
+class JobSetup;
-// ------------------------
-// - private printer data -
-// ------------------------
-struct ImplPrivatePrinterData
-{
- bool mbNextJobIsQuick;
-
- ImplPrivatePrinterData() :
- mbNextJobIsQuick( false )
- {}
-};
+namespace vcl
+{ class PrinterListener; }
// --------------------
// - ImplPrnQueueData -
@@ -87,5 +78,7 @@ public:
// --------------
void ImplDeletePrnQueueList();
+void SAL_DLLPRIVATE ImplUpdateJobSetupPaper( JobSetup& rJobSetup );
+
#endif // _SV_PRINT_H
diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx
index b9176f4106dc..daea0c941dd0 100644
--- a/vcl/inc/vcl/print.hxx
+++ b/vcl/inc/vcl/print.hxx
@@ -31,14 +31,22 @@
#ifndef _SV_PRINT_HXX
#define _SV_PRINT_HXX
-#include <tools/errcode.hxx>
-#include <vcl/sv.h>
-#include <vcl/dllapi.h>
-#include <vcl/outdev.hxx>
-#include <vcl/prntypes.hxx>
-#include <vcl/jobset.hxx>
-#include <vcl/gdimtf.hxx>
-#include <tools/stream.hxx>
+#include "tools/errcode.hxx"
+#include "vcl/sv.h"
+#include "vcl/dllapi.h"
+#include "vcl/outdev.hxx"
+#include "vcl/prntypes.hxx"
+#include "vcl/jobset.hxx"
+#include "vcl/gdimtf.hxx"
+#include "tools/stream.hxx"
+#include "tools/multisel.hxx"
+
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/view/PrintableState.hpp"
+
+#include <boost/shared_ptr.hpp>
+#include <hash_map>
+#include <set>
struct SalPrinterInfoQueue;
class SalInfoPrinter;
@@ -46,12 +54,11 @@ struct SalPrinterQueueInfo;
class SalPrinter;
class VirtualDevice;
class Window;
-class ImplQPrinter;
-struct ImplPrivatePrinterData;
-namespace com { namespace sun { namespace star { namespace uno {
- class Any;
-} } } }
+namespace vcl {
+ class PrinterController;
+ class PrintDialog;
+}
// -----------------
// - Printer-Types -
@@ -216,16 +223,12 @@ class VCL_DLLPUBLIC Printer : public OutputDevice
friend class ImplQPrinter;
private:
- ImplPrivatePrinterData* mpPrinterData;
SalInfoPrinter* mpInfoPrinter;
SalPrinter* mpPrinter;
- Printer* mpJobPrinter;
SalGraphics* mpJobGraphics;
Printer* mpPrev;
Printer* mpNext;
VirtualDevice* mpDisplayDev;
- ImplQPrinter* mpQPrinter;
- GDIMetaFile* mpQMtf;
PrinterOptions* mpPrinterOptions;
XubString maPrinterName;
XubString maDriver;
@@ -250,9 +253,6 @@ private:
BOOL mbUserSetupCompleted;
BOOL mbUserSetupResult;
Link maErrorHdl;
- Link maStartPrintHdl;
- Link maEndPrintHdl;
- Link maPrintPageHdl;
SAL_DLLPRIVATE void ImplInitData();
SAL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo );
@@ -261,22 +261,25 @@ private:
const XubString* pDriver );
SAL_DLLPRIVATE void ImplUpdatePageData();
SAL_DLLPRIVATE void ImplUpdateFontList();
- SAL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup& );
+ SAL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup&, bool bMatchNearest );
DECL_DLLPRIVATE_LINK( ImplDestroyPrinterAsync, void* );
-public:
- SAL_DLLPRIVATE void ImplEndPrint();
- SAL_DLLPRIVATE void ImplUpdateQuickStatus();
+
+ SAL_DLLPRIVATE bool StartJob( const rtl::OUString& rJobName, boost::shared_ptr<vcl::PrinterController>& );
+
+ static SAL_DLLPRIVATE ULONG ImplSalPrinterErrorCodeToVCL( ULONG nError );
+
private:
+ SAL_DLLPRIVATE void ImplEndPrint();
+ SAL_DLLPRIVATE BOOL EndJob();
SAL_DLLPRIVATE Printer( const Printer& rPrinter );
SAL_DLLPRIVATE Printer& operator =( const Printer& rPrinter );
-
-#ifdef _SPOOLPRINTER_EXT
+public:
+ SAL_DLLPRIVATE void ImplStartPage();
+ SAL_DLLPRIVATE void ImplEndPage();
public:
void DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const Gradient& rGradient );
void DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly, const Gradient& rGradient );
-#endif // _SPOOLPRINTER_EXT
-
protected:
void SetSelfAsQueuePrinter( BOOL bQueuePrinter ) { mbIsQueuePrinter = bQueuePrinter; }
@@ -295,9 +298,6 @@ public:
static XubString GetDefaultPrinterName();
virtual void Error();
- virtual void StartPrint();
- virtual void EndPrint();
- virtual void PrintPage();
const XubString& GetName() const { return maPrinterName; }
const XubString& GetDriverName() const { return maDriver; }
@@ -322,6 +322,7 @@ public:
BOOL SetOrientation( Orientation eOrient );
Orientation GetOrientation() const;
DuplexMode GetDuplexMode() const;
+ BOOL SetDuplexMode( DuplexMode );
// returns the angle that a landscape page will be turned counterclockwise
// wrt to portrait. The return value may be only valid for
// the current paper
@@ -330,6 +331,7 @@ public:
USHORT GetPaperBin() const;
BOOL SetPaper( Paper ePaper );
BOOL SetPaperSizeUser( const Size& rSize );
+ BOOL SetPaperSizeUser( const Size& rSize, bool bMatchNearest );
Paper GetPaper() const;
// returns number of available paper formats
@@ -348,58 +350,333 @@ public:
USHORT GetCopyCount() const { return mnCopyCount; }
BOOL IsCollateCopy() const { return mbCollateCopy; }
- USHORT GetCurPrintPage() const { return mnCurPrintPage; }
BOOL IsPrinting() const { return mbPrinting; }
void SetPrintFile( const XubString& rFileName ) { maPrintFile = rFileName; }
const XubString& GetPrintFile() const { return maPrintFile; }
void EnablePrintFile( BOOL bEnable ) { mbPrintFile = bEnable; }
BOOL IsPrintFileEnabled() const { return mbPrintFile; }
- BOOL StartJob( const XubString& rJobName );
- BOOL EndJob();
BOOL AbortJob();
const XubString& GetCurJobName() const { return maJobName; }
USHORT GetCurPage() const { return mnCurPage; }
BOOL IsJobActive() const { return mbJobActive; }
- BOOL StartPage();
- BOOL EndPage();
-
- void SetPageQueueSize( USHORT nPages ) { mnPageQueueSize = nPages; }
- USHORT GetPageQueueSize() const { return mnPageQueueSize; }
ULONG GetError() const { return ERRCODE_TOERROR(mnError); }
ULONG GetErrorCode() const { return mnError; }
void SetErrorHdl( const Link& rLink ) { maErrorHdl = rLink; }
const Link& GetErrorHdl() const { return maErrorHdl; }
- void SetStartPrintHdl( const Link& rLink ) { maStartPrintHdl = rLink; }
- const Link& GetStartPrintHdl() const { return maStartPrintHdl; }
- void SetEndPrintHdl( const Link& rLink ) { maEndPrintHdl = rLink; }
- const Link& GetEndPrintHdl() const { return maEndPrintHdl; }
- void SetPrintPageHdl( const Link& rLink ) { maPrintPageHdl = rLink; }
- const Link& GetPrintPageHdl() const { return maPrintPageHdl; }
void Compat_OldPrinterMetrics( bool bSet );
- /** Notify that the next StartJob belongs to a UI less "direct print" job
- *
- * deprecated: the canonical way to notify a UI less job is to set the
- * JobSetup value "IsQuickJob" to "true". If set at all, the "IsQuickJob" value
- * on JobSetup will be preferred. However if no "IsQuickJob" value is set,
- * setting SetNextJobIsQuick will cause the following StartJob to set this value
- * to "true" in the current JobSetup.
- *
- * the paramter can be set to "false" again in case a job was not started and the
- * printer is to be reused.
- */
- void SetNextJobIsQuick( bool bQuick = true );
-
/** checks the printer list and updates it necessary
*
* sends a DataChanged event of type DATACHANGED_PRINTER
* if the printer list changed
*/
static void updatePrinters();
+
+ /** execute a print job
+
+ starts a print job asynchronously (that is will return
+
+ */
+ static void PrintJob( const boost::shared_ptr<vcl::PrinterController>& i_pController,
+ const JobSetup& i_rInitSetup
+ );
+
+ // implementation detail of PrintJob being asynchronous
+ // not exported, not usable outside vcl
+ static void SAL_DLLPRIVATE ImplPrintJob( const boost::shared_ptr<vcl::PrinterController>& i_pController,
+ const JobSetup& i_rInitSetup
+ );
+};
+
+namespace vcl
+{
+class ImplPrinterControllerData;
+
+class VCL_DLLPUBLIC PrinterController
+{
+ ImplPrinterControllerData* mpImplData;
+protected:
+ PrinterController( const boost::shared_ptr<Printer>& );
+public:
+ enum NupOrderType
+ { LRTB, TBLR };
+ struct MultiPageSetup
+ {
+ // all metrics in 100th mm
+ int nRows;
+ int nColumns;
+ int nRepeat;
+ Size aPaperSize;
+ long nLeftMargin;
+ long nTopMargin;
+ long nRightMargin;
+ long nBottomMargin;
+ long nHorizontalSpacing;
+ long nVerticalSpacing;
+ bool bDrawBorder;
+ PrinterController::NupOrderType nOrder;
+
+ MultiPageSetup()
+ : nRows( 1 ), nColumns( 1 ), nRepeat( 1 ), aPaperSize( 21000, 29700 )
+ , nLeftMargin( 0 ), nTopMargin( 0 )
+ , nRightMargin( 0 ), nBottomMargin( 0 )
+ , nHorizontalSpacing( 0 ), nVerticalSpacing( 0 )
+ , bDrawBorder( false )
+ , nOrder( LRTB )
+ {
+ }
+ };
+
+ struct PageSize
+ {
+ Size aSize; // in 100th mm
+ bool bFullPaper; // full paper, not only imageable area is printed
+
+ PageSize( const Size& i_rSize = Size( 21000, 29700 ),
+ bool i_bFullPaper = false
+ ) : aSize( i_rSize ), bFullPaper( i_bFullPaper ) {}
+ };
+
+ PrinterController();
+ virtual ~PrinterController();
+
+ const boost::shared_ptr<Printer>& getPrinter() const;
+ /* for implementations: get current job properties as changed by e.g. print dialog
+ this gets the current set of properties initially told to Printer::PrintJob
+
+ For convenience a second sequence will be merged in to get a combined sequence.
+ In case of duplicate property names, the value of i_MergeList wins.
+ */
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
+ getJobProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rMergeList ) const;
+
+ /* get the PropertyValue of a Property
+ */
+ com::sun::star::beans::PropertyValue* getValue( const rtl::OUString& i_rPropertyName );
+ const com::sun::star::beans::PropertyValue* getValue( const rtl::OUString& i_rPropertyName ) const;
+ // get a sequence of properties
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getValues( const com::sun::star::uno::Sequence< rtl::OUString >& ) const;
+ /* get a bool property
+ in case the property is unknown or not convertible to bool, i_bFallback is returned
+ */
+ sal_Bool getBoolProperty( const rtl::OUString& i_rPropertyName, sal_Bool i_bFallback ) const;
+
+ /* set a property value - can also be used to add another UI property
+ */
+ void setValue( const rtl::OUString& i_rPropertyName, const com::sun::star::uno::Any& i_rValue );
+ void setValue( const com::sun::star::beans::PropertyValue& i_rValue );
+
+ /* return the currently active UI options. These are the same that were passed to setUIOptions.
+ */
+ const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& getUIOptions() const;
+ /* set possible UI options. should only be done once before passing the PrinterListener
+ to Printer::PrintJob
+ */
+ void setUIOptions( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& );
+ /* enable/disable an option; this can be used to implement dialog logic.
+ */
+ void enableUIOption( const rtl::OUString& rPropName, bool bEnable );
+ bool isUIOptionEnabled( const rtl::OUString& rPropName ) const;
+ /* returns the property name rPropName depends on or an empty string
+ if no dependency exists.
+ */
+ rtl::OUString getDependency( const rtl::OUString& rPropName ) const;
+ /* makeEnabled will chage the property rPropName depends on to the value
+ that makes rPropName enabled. If the dependency itself is also disabled,
+ no action will be performed.
+
+ returns the property name rPropName depends on or an empty string
+ if no change was made.
+ */
+ rtl::OUString makeEnabled( const rtl::OUString& rPropName );
+
+ virtual int getPageCount() const = 0; // must be overloaded by the app
+ /* get the page parameters, namely the jobsetup that should be active for the page
+ (describing among others the physical page size) and the "page size". In writer
+ case this would probably be the same as the JobSetup since writer sets the page size
+ draw/impress for example print their page on the paper set on the printer,
+ possibly adjusting the page size to fit. That means the page size can be different from
+ the paper size.
+ */
+ // must be overloaded by the app, return page size in 1/100th mm
+ virtual com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getPageParameters( int i_nPage ) const = 0;
+ virtual void printPage( int i_nPage ) const = 0; // must be overloaded by the app
+ virtual void jobStarted(); // will be called after a possible dialog has been shown and the real printjob starts
+ virtual void jobFinished( com::sun::star::view::PrintableState );
+
+ com::sun::star::view::PrintableState getJobState() const;
+
+ void abortJob();
+
+ bool isShowDialogs() const;
+ bool isDirectPrint() const;
+
+ // implementation details, not usable outside vcl
+ SAL_DLLPRIVATE int getFilteredPageCount();
+ SAL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false );
+ SAL_DLLPRIVATE PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false );
+ SAL_DLLPRIVATE void printFilteredPage( int i_nPage );
+ SAL_DLLPRIVATE void setPrinter( const boost::shared_ptr<Printer>& );
+ SAL_DLLPRIVATE void setOptionChangeHdl( const Link& );
+ SAL_DLLPRIVATE void createProgressDialog();
+ SAL_DLLPRIVATE void setMultipage( const MultiPageSetup& );
+ SAL_DLLPRIVATE const MultiPageSetup& getMultipage() const;
+ SAL_DLLPRIVATE void setLastPage( sal_Bool i_bLastPage );
+ SAL_DLLPRIVATE void setReversePrint( sal_Bool i_bReverse );
+ SAL_DLLPRIVATE bool getReversePrint() const;
+ SAL_DLLPRIVATE void pushPropertiesToPrinter();
+ SAL_DLLPRIVATE void setJobState( com::sun::star::view::PrintableState );
+ SAL_DLLPRIVATE bool setupPrinter( Window* i_pDlgParent );
+
+ SAL_DLLPRIVATE int getPageCountProtected() const;
+ SAL_DLLPRIVATE com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getPageParametersProtected( int i_nPage ) const;
+
+ SAL_DLLPRIVATE ULONG removeTransparencies( GDIMetaFile& i_rIn, GDIMetaFile& o_rOut );
};
+class VCL_DLLPUBLIC PrinterOptionsHelper
+{
+ protected:
+ std::hash_map< rtl::OUString, com::sun::star::uno::Any, rtl::OUStringHash > m_aPropertyMap;
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > m_aUIProperties;
+
+ public:
+ PrinterOptionsHelper() {} // create without ui properties
+ PrinterOptionsHelper( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rUIProperties )
+ : m_aUIProperties( i_rUIProperties )
+ {}
+ ~PrinterOptionsHelper()
+ {}
+
+ /* process a new set of properties
+ * merges changed properties and returns "true" if any occured
+ * if the optional output set is not NULL then the names of the changed properties are returned
+ **/
+ bool processProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp,
+ std::set< rtl::OUString >* o_pChangeProp = NULL );
+ /* append to a sequence of property values the ui property sequence passed at creation
+ * as the "ExtraPrintUIOptions" property. if that sequence was empty, no "ExtraPrintUIOptions" property
+ * will be appended.
+ **/
+ void appendPrintUIOptions( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& io_rProps ) const;
+
+ // check if a property exists
+ bool hasProperty( const rtl::OUString& i_rPropertyName ) const;
+ bool hasProperty( const char* i_pPropertyName ) const
+ { return hasProperty( rtl::OUString::createFromAscii( i_pPropertyName ) ); }
+
+ // returns an empty Any for not existing properties
+ com::sun::star::uno::Any getValue( const rtl::OUString& i_rPropertyName ) const;
+ // change a value in the property set; this will not have an effect to an eventual PrinterController
+ // the user of setValue must decide whether it is necessary to set the value there also
+ void setValue( const rtl::OUString& i_rPropertyName, const com::sun::star::uno::Any& i_rValue );
+ void setValue( const char* i_pPropertyName, const com::sun::star::uno::Any& i_rValue )
+ { setValue( rtl::OUString::createFromAscii( i_pPropertyName ), i_rValue ); }
+
+ sal_Bool getBoolValue( const rtl::OUString& i_rPropertyName, sal_Bool i_bDefault = sal_False ) const;
+ // convenience for fixed strings
+ sal_Bool getBoolValue( const char* i_pPropName, sal_Bool i_bDefault = sal_False ) const
+ { return getBoolValue( rtl::OUString::createFromAscii( i_pPropName ), i_bDefault ); }
+
+ sal_Int64 getIntValue( const rtl::OUString& i_rPropertyName, sal_Int64 i_nDefault = 0 ) const;
+ // convenience for fixed strings
+ sal_Int64 getIntValue( const char* i_pPropName, sal_Int64 i_nDefault = 0 ) const
+ { return getIntValue( rtl::OUString::createFromAscii( i_pPropName ), i_nDefault ); }
+
+ rtl::OUString getStringValue( const rtl::OUString& i_rPropertyName, const rtl::OUString& i_rDefault = rtl::OUString() ) const;
+ // convenience for fixed strings
+ rtl::OUString getStringValue( const char* i_pPropName, const rtl::OUString& i_rDefault = rtl::OUString() ) const
+ { return getStringValue( rtl::OUString::createFromAscii( i_pPropName ), i_rDefault ); }
+
+ // helper functions for user to create a single control
+ struct UIControlOptions
+ {
+ rtl::OUString maDependsOnName;
+ sal_Int32 mnDependsOnEntry;
+ sal_Bool mbAttachToDependency;
+ rtl::OUString maGroupHint;
+ sal_Bool mbInternalOnly;
+ sal_Bool mbEnabled;
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > maAddProps;
+
+ UIControlOptions( const rtl::OUString& i_rDependsOnName = rtl::OUString(),
+ sal_Int32 i_nDependsOnEntry = -1,
+ sal_Bool i_bAttachToDependency = sal_False,
+ const rtl::OUString& i_rGroupHint = rtl::OUString(),
+ sal_Bool i_bInternalOnly = sal_False,
+ sal_Bool i_bEnabled = sal_True
+ )
+ : maDependsOnName( i_rDependsOnName )
+ , mnDependsOnEntry( i_nDependsOnEntry )
+ , mbAttachToDependency( i_bAttachToDependency )
+ , maGroupHint( i_rGroupHint )
+ , mbInternalOnly( i_bInternalOnly )
+ , mbEnabled( i_bEnabled ) {}
+ };
+
+ // general control
+ static com::sun::star::uno::Any getUIControlOpt( const rtl::OUString& i_rTitle,
+ const com::sun::star::uno::Sequence< rtl::OUString >& i_rHelpText,
+ const rtl::OUString& i_rType,
+ const com::sun::star::beans::PropertyValue* i_pValue = NULL,
+ const UIControlOptions& i_rControlOptions = UIControlOptions()
+ );
+ // create a group (e.g. a TabPage); following controls will be grouped in it until the next
+ // group begins
+ static com::sun::star::uno::Any getGroupControlOpt( const rtl::OUString& i_rTitle, const rtl::OUString& i_rHelpText );
+
+ // create a subgroup (e.g. a FixedLine); following controls will be grouped in it until the next
+ // subgroup or group begins
+ // setting bJobPage = true will make the subgroup appear on the first page of the print dialog
+ static com::sun::star::uno::Any getSubgroupControlOpt( const rtl::OUString& i_rTitle,
+ const rtl::OUString& i_rHelpText,
+ const UIControlOptions& i_rControlOptions = UIControlOptions()
+ );
+
+ // create a bool option (usually a checkbox)
+ static com::sun::star::uno::Any getBoolControlOpt( const rtl::OUString& i_rTitle,
+ const rtl::OUString& i_rHelpText,
+ const rtl::OUString& i_rProperty,
+ sal_Bool i_bValue,
+ const UIControlOptions& i_rControlOptions = UIControlOptions()
+ );
+
+ // create a set of choices (either a radio button group or a list box)
+ static com::sun::star::uno::Any getChoiceControlOpt( const rtl::OUString& i_rTitle,
+ const com::sun::star::uno::Sequence< rtl::OUString >& i_rHelpText,
+ const rtl::OUString& i_rProperty,
+ const com::sun::star::uno::Sequence< rtl::OUString >& i_rChoices,
+ sal_Int32 i_nValue,
+ const rtl::OUString& i_rType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ),
+ const UIControlOptions& i_rControlOptions = UIControlOptions()
+ );
+
+ // create an integer range (e.g. a spin field)
+ // note: max value < min value means do not apply min/max values
+ static com::sun::star::uno::Any getRangeControlOpt( const rtl::OUString& i_rTitle,
+ const rtl::OUString& i_rHelpText,
+ const rtl::OUString& i_rProperty,
+ sal_Int32 i_nValue,
+ sal_Int32 i_nMinValue = -1,
+ sal_Int32 i_nMaxValue = -2,
+ const UIControlOptions& i_rControlOptions = UIControlOptions()
+ );
+
+ // create a string field
+ // note: max value < min value means do not apply min/max values
+ static com::sun::star::uno::Any getEditControlOpt( const rtl::OUString& i_rTitle,
+ const rtl::OUString& i_rHelpText,
+ const rtl::OUString& i_rProperty,
+ const rtl::OUString& i_rValue,
+ const UIControlOptions& i_rControlOptions = UIControlOptions()
+ );
+};
+
+}
+
+
#endif // _SV_PRINT_HXX
diff --git a/vcl/inc/vcl/printerinfomanager.hxx b/vcl/inc/vcl/printerinfomanager.hxx
index 810ad428c9db..2fb6ef1c2413 100644
--- a/vcl/inc/vcl/printerinfomanager.hxx
+++ b/vcl/inc/vcl/printerinfomanager.hxx
@@ -136,6 +136,7 @@ protected:
Type m_eType;
bool m_bUseIncludeFeature;
+ bool m_bUseJobPatch;
rtl::OUString m_aSystemDefaultPaper;
bool m_bDisableCUPS;
@@ -226,6 +227,7 @@ public:
virtual bool addOrRemovePossible() const;
bool getUseIncludeFeature() const { return m_bUseIncludeFeature; }
+ bool getUseJobPatch() const { return m_bUseJobPatch; }
// check whether a printer's feature string contains a subfeature
bool checkFeatureToken( const rtl::OUString& rPrinterName, const char* pToken ) const;
diff --git a/vcl/inc/vcl/printerjob.hxx b/vcl/inc/vcl/printerjob.hxx
index 9880700d4008..e445a81d54c8 100644
--- a/vcl/inc/vcl/printerjob.hxx
+++ b/vcl/inc/vcl/printerjob.hxx
@@ -91,7 +91,7 @@ private: // private methods
bool writeFeatureList( osl::File* pFile, const JobData&, bool bDocumentSetup );
bool writeSetup( osl::File* pFile, const JobData& );
- bool writePageSetup( osl::File* pFile, const JobData& );
+ bool writePageSetup( osl::File* pFile, const JobData&, bool bWriteFeatures = true );
void writeJobPatch( osl::File* File, const JobData& );
bool writeProlog (osl::File* pFile, const JobData& );
diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx
index 4fd6eaa999da..f1b69e1ca3aa 100644
--- a/vcl/inc/vcl/prndlg.hxx
+++ b/vcl/inc/vcl/prndlg.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: prndlg.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.114.5 $
*
* This file is part of OpenOffice.org.
*
@@ -33,19 +33,301 @@
#include <vcl/dllapi.h>
-#include <vcl/dialog.hxx>
+#include "vcl/print.hxx"
+#include "vcl/print.h"
-class Printer;
+#include "vcl/dialog.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/button.hxx"
+#include "vcl/gdimtf.hxx"
+#include "vcl/lstbox.hxx"
+#include "vcl/field.hxx"
+#include "vcl/tabctrl.hxx"
+#include "vcl/tabpage.hxx"
+#include "vcl/arrange.hxx"
+#include "vcl/virdev.hxx"
-class VCL_DLLPUBLIC SystemDialog : public ModalDialog
+#include <boost/shared_ptr.hpp>
+#include <map>
+
+namespace vcl
{
-public:
- SystemDialog( Window* pParent, WinBits nWinStyle ) :
- ModalDialog( pParent, nWinStyle ) {}
- SystemDialog( Window* pParent, const ResId& rResId ) :
- ModalDialog( pParent, rResId ) {}
-
- virtual short Execute() { return 0; }
-};
+ class PrintDialog : public ModalDialog
+ {
+ class PrintPreviewWindow : public Window
+ {
+ GDIMetaFile maMtf;
+ Size maOrigSize;
+ VirtualDevice maPageVDev;
+ rtl::OUString maReplacementString;
+ rtl::OUString maToolTipString;
+ public:
+ PrintPreviewWindow( Window* pParent, const ResId& );
+ virtual ~PrintPreviewWindow();
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Command( const CommandEvent& );
+ virtual void Resize();
+ virtual void DataChanged( const DataChangedEvent& );
+
+ void setPreview( const GDIMetaFile&, const Size&, const rtl::OUString&,
+ sal_Int32 i_nDPIX, sal_Int32 i_nDPIY
+ );
+ };
+
+ class ShowNupOrderWindow : public Window
+ {
+ int mnOrderMode;
+ int mnRows;
+ int mnColumns;
+ void ImplInitSettings();
+ public:
+ ShowNupOrderWindow( Window* pParent );
+ virtual ~ShowNupOrderWindow();
+
+ virtual void Paint( const Rectangle& );
+
+ void setValues( int i_nOrderMode, int i_nColumns, int i_nRows )
+ {
+ mnOrderMode = i_nOrderMode;
+ mnRows = i_nRows;
+ mnColumns = i_nColumns;
+ Invalidate();
+ }
+ };
+
+ class NUpTabPage : public TabPage
+ {
+ public:
+ FixedLine maNupLine;
+ RadioButton maPagesBtn;
+ RadioButton maBrochureBtn;
+ FixedText maPagesBoxTitleTxt;
+ ListBox maNupPagesBox;
+
+ // controls for "Custom" page mode
+ FixedText maNupNumPagesTxt;
+ NumericField maNupColEdt;
+ FixedText maNupTimesTxt;
+ NumericField maNupRowsEdt;
+ FixedText maPageMarginTxt1;
+ MetricField maPageMarginEdt;
+ FixedText maPageMarginTxt2;
+ FixedText maSheetMarginTxt1;
+ MetricField maSheetMarginEdt;
+ FixedText maSheetMarginTxt2;
+ FixedText maNupOrientationTxt;
+ ListBox maNupOrientationBox;
+
+ // page order ("left to right, then down")
+ FixedText maNupOrderTxt;
+ ListBox maNupOrderBox;
+ ShowNupOrderWindow maNupOrderWin;
+ // border around each page
+ CheckBox maBorderCB;
+
+ vcl::RowOrColumn maLayout;
+ boost::shared_ptr< vcl::RowOrColumn > mxBrochureDep;
+ boost::shared_ptr< vcl::LabeledElement >mxPagesBtnLabel;
+
+ void setupLayout();
+
+ NUpTabPage( Window*, const ResId& );
+ virtual ~NUpTabPage();
+
+ void readFromSettings();
+ void storeToSettings();
+ void initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& );
+ void enableNupControls( bool bEnable );
+
+ void showAdvancedControls( bool );
+
+ virtual void Resize();
+ };
+
+ class JobTabPage : public TabPage
+ {
+ public:
+ FixedLine maPrinterFL;
+ ListBox maPrinters;
+ DisclosureButton maDetailsBtn;
+ FixedText maStatusLabel;
+ FixedText maStatusTxt;
+ FixedText maLocationLabel;
+ FixedText maLocationTxt;
+ FixedText maCommentLabel;
+ FixedText maCommentTxt;
+
+ PushButton maSetupButton;
+
+ FixedLine maCopies;
+ FixedLine maCopySpacer;
+ FixedText maCopyCount;
+ NumericField maCopyCountField;
+ CheckBox maCollateBox;
+ FixedImage maCollateImage;
+
+ Image maCollateImg;
+ Image maCollateHCImg;
+ Image maNoCollateImg;
+ Image maNoCollateHCImg;
+
+ long mnCollateUIMode;
+
+ vcl::RowOrColumn maLayout;
+ boost::shared_ptr<vcl::RowOrColumn> mxPrintRange;
+ boost::shared_ptr<vcl::WindowArranger> mxDetails;
+
+ JobTabPage( Window*, const ResId& );
+ virtual ~JobTabPage();
+
+ void readFromSettings();
+ void storeToSettings();
+
+ virtual void Resize();
+
+ void setupLayout();
+ };
+
+ class OutputOptPage : public TabPage
+ {
+ public:
+ FixedLine maOptionsLine;
+ CheckBox maToFileBox;
+ CheckBox maCollateSingleJobsBox;
+ CheckBox maReverseOrderBox;
+
+ vcl::RowOrColumn maLayout;
+ boost::shared_ptr<vcl::RowOrColumn> mxOptGroup;
+
+ OutputOptPage( Window*, const ResId& );
+ virtual ~OutputOptPage();
+
+ void readFromSettings();
+ void storeToSettings();
+
+ virtual void Resize();
+
+ void setupLayout();
+ };
+
+ OKButton maOKButton;
+ CancelButton maCancelButton;
+ HelpButton maHelpButton;
+ PrintPreviewWindow maPreviewWindow;
+ NumericField maPageEdit;
+ FixedText maNumPagesText;
+ PushButton maBackwardBtn;
+ PushButton maForwardBtn;
+
+ TabControl maTabCtrl;
+ NUpTabPage maNUpPage;
+ JobTabPage maJobPage;
+ OutputOptPage maOptionsPage;
+
+ FixedLine maButtonLine;
+
+ boost::shared_ptr< PrinterController > maPController;
+
+ rtl::OUString maPageStr;
+ rtl::OUString maNoPageStr;
+ sal_Int32 mnCurPage;
+ sal_Int32 mnCachedPages;
+
+ std::list< Window* > maControls;
+ std::map< Window*, rtl::OUString > maControlToPropertyMap;
+ std::map< rtl::OUString, std::vector< Window* > >
+ maPropertyToWindowMap;
+ std::map< Window*, sal_Int32 > maControlToNumValMap;
+ std::set< rtl::OUString > maReverseDependencySet;
+
+ Size maNupPortraitSize;
+ Size maNupLandscapeSize;
+
+ // internal, used for automatic Nup-Portrait/landscape
+ Size maFirstPageSize;
+
+ rtl::OUString maPrintToFileText;
+ rtl::OUString maPrintText;
+ rtl::OUString maDefPrtText;
+
+ vcl::RowOrColumn maLayout;
+ boost::shared_ptr<vcl::RowOrColumn> mxPreviewCtrls;
+
+ Size maDetailsCollapsedSize;
+ Size maDetailsExpandedSize;
+
+ sal_Bool mbShowLayoutPage;
+
+ Size getJobPageSize();
+ void updateNup();
+ void updateNupFromPages();
+ void preparePreview( bool i_bPrintChanged = true, bool i_bMayUseCache = false );
+ void setPreviewText( sal_Int32 );
+ void updatePrinterText();
+ void checkControlDependencies();
+ void checkOptionalControlDependencies();
+ void makeEnabled( Window* );
+ void updateWindowFromProperty( const rtl::OUString& );
+ void setupOptionalUI();
+ void readFromSettings();
+ void storeToSettings();
+ com::sun::star::beans::PropertyValue* getValueForWindow( Window* ) const;
+
+ virtual void Resize();
+ virtual void Command( const CommandEvent& );
+ virtual void DataChanged( const DataChangedEvent& );
+
+ DECL_LINK( SelectHdl, ListBox* );
+ DECL_LINK( ClickHdl, Button* );
+ DECL_LINK( ModifyHdl, Edit* );
+ DECL_LINK( UIOptionsChanged, void* );
+
+ DECL_LINK( UIOption_CheckHdl, CheckBox* );
+ DECL_LINK( UIOption_RadioHdl, RadioButton* );
+ DECL_LINK( UIOption_SelectHdl, ListBox* );
+ DECL_LINK( UIOption_ModifyHdl, Edit* );
+
+ void setupLayout();
+ public:
+ PrintDialog( Window*, const boost::shared_ptr< PrinterController >& );
+ virtual ~PrintDialog();
+
+ bool isPrintToFile();
+ int getCopyCount();
+ bool isCollate();
+
+ void previewForward();
+ void previewBackward();
+ };
+
+ class PrintProgressDialog : public ModelessDialog
+ {
+ String maStr;
+ FixedText maText;
+ CancelButton maButton;
+
+ bool mbCanceled;
+ sal_Int32 mnCur;
+ sal_Int32 mnMax;
+ long mnProgressHeight;
+ Rectangle maProgressRect;
+ bool mbNativeProgress;
+
+ DECL_LINK( ClickHdl, Button* );
+
+ void implCalcProgressRect();
+ public:
+ PrintProgressDialog( Window* i_pParent, int i_nMax );
+ ~PrintProgressDialog();
+
+ bool isCanceled() const { return mbCanceled; }
+ void setProgress( int i_nCurrent, int i_nMax = -1 );
+ void tick();
+
+ virtual void Paint( const Rectangle& );
+ };
+}
+
#endif // _SV_PRNDLG_HXX
diff --git a/vcl/inc/vcl/prntypes.hxx b/vcl/inc/vcl/prntypes.hxx
index 681f4f972a7c..a61c1a275474 100644
--- a/vcl/inc/vcl/prntypes.hxx
+++ b/vcl/inc/vcl/prntypes.hxx
@@ -39,7 +39,7 @@
// - Duplex Mode -
// ---------------
-enum DuplexMode { DUPLEX_UNKNOWN, DUPLEX_OFF, DUPLEX_ON };
+enum DuplexMode { DUPLEX_UNKNOWN, DUPLEX_OFF, DUPLEX_LONGEDGE, DUPLEX_SHORTEDGE };
// ---------------
// - Orientation -
@@ -93,5 +93,6 @@ enum Orientation { ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE };
#define PRINTER_CAPABILITIES_FAX ((USHORT)8)
#define PRINTER_CAPABILITIES_PDF ((USHORT)9)
#define PRINTER_CAPABILITIES_EXTERNALDIALOG ((USHORT)10)
+#define PRINTER_CAPABILITIES_SETDUPLEX ((USHORT)11)
#endif // _SV_PRNTYPES_HXX
diff --git a/vcl/inc/vcl/salprn.hxx b/vcl/inc/vcl/salprn.hxx
index 2927215034b5..73f5454457cf 100644
--- a/vcl/inc/vcl/salprn.hxx
+++ b/vcl/inc/vcl/salprn.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: salprn.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.114.1 $
*
* This file is part of OpenOffice.org.
*
@@ -41,7 +41,7 @@
class SalGraphics;
class SalFrame;
struct ImplJobSetup;
-class ImplQPrinter;
+namespace vcl { class PrinterController; }
// -----------------------
// - SalPrinterQueueInfo -
@@ -101,7 +101,6 @@ public:
virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) = 0;
// returns angle that a landscape page will be turned counterclockwise wrt to portrait
virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) = 0;
- virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData ) = 0;
};
// --------------
@@ -114,18 +113,21 @@ public: // public for Sal Implementation
SalPrinter() {}
virtual ~SalPrinter();
- virtual BOOL StartJob( const XubString* pFileName,
- const XubString& rJobName,
- const XubString& rAppName,
- ULONG nCopies, BOOL bCollate,
+ virtual BOOL StartJob( const String* pFileName,
+ const String& rJobName,
+ const String& rAppName,
+ ULONG nCopies,
+ bool bCollate,
+ bool bDirect,
ImplJobSetup* pSetupData ) = 0;
// implement for pull model print systems only,
// default implementations (see salvtables.cxx) just returns FALSE
virtual BOOL StartJob( const String* pFileName,
+ const String& rJobName,
const String& rAppName,
ImplJobSetup* pSetupData,
- ImplQPrinter* pQPrinter );
+ vcl::PrinterController& rController );
virtual BOOL EndJob() = 0;
virtual BOOL AbortJob() = 0;
diff --git a/vcl/inc/vcl/salptype.hxx b/vcl/inc/vcl/salptype.hxx
index 7f1c82079f38..bc9883757432 100644
--- a/vcl/inc/vcl/salptype.hxx
+++ b/vcl/inc/vcl/salptype.hxx
@@ -40,7 +40,11 @@
#define SAL_JOBSET_ORIENTATION ((ULONG)0x00000001)
#define SAL_JOBSET_PAPERBIN ((ULONG)0x00000002)
#define SAL_JOBSET_PAPERSIZE ((ULONG)0x00000004)
-#define SAL_JOBSET_ALL (SAL_JOBSET_ORIENTATION | SAL_JOBSET_PAPERBIN | SAL_JOBSET_PAPERSIZE)
+#define SAL_JOBSET_DUPLEXMODE ((ULONG)0x00000008)
+#define SAL_JOBSET_ALL (SAL_JOBSET_ORIENTATION |\
+ SAL_JOBSET_PAPERBIN |\
+ SAL_JOBSET_PAPERSIZE |\
+ SAL_JOBSET_DUPLEXMODE)
// -------------------
// - SalPrinterError -
diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx
index 17ad1aa28c1a..081b2fffca0b 100644
--- a/vcl/inc/vcl/svdata.hxx
+++ b/vcl/inc/vcl/svdata.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdata.hxx,v $
- * $Revision: 1.13 $
+ * $Revision: 1.13.16.1 $
*
* This file is part of OpenOffice.org.
*
@@ -87,6 +87,7 @@ class Timer;
class AutoTimer;
class Help;
class ImageList;
+class Image;
class PopupMenu;
class Application;
class OutputDevice;
@@ -259,6 +260,10 @@ struct ImplSVCtrlData
ImageList* mpSplitVPinImgList; // ImageList for Vertikale SplitWindows (PIN's)
ImageList* mpSplitHArwImgList; // ImageList for Horizontale SplitWindows (Arrows)
ImageList* mpSplitVArwImgList; // ImageList for Vertikale SplitWindows (Arrows)
+ Image* mpDisclosurePlus;
+ Image* mpDisclosurePlusHC;
+ Image* mpDisclosureMinus;
+ Image* mpDisclosureMinusHC;
ImplTBDragMgr* mpTBDragMgr; // DragMgr for ToolBox
USHORT mnCheckStyle; // CheckBox-Style for ImageList-Update
USHORT mnRadioStyle; // Radio-Style for ImageList-Update
@@ -367,6 +372,7 @@ void ImplDeInitSVData();
void ImplDestroySVData();
Window* ImplGetDefaultWindow();
VCL_DLLPUBLIC ResMgr* ImplGetResMgr();
+VCL_DLLPUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr
DockingManager* ImplGetDockingManager();
void ImplWindowAutoMnemonic( Window* pWindow );
diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc
index 48297a04ea0e..e2a8226ac878 100644
--- a/vcl/inc/vcl/svids.hrc
+++ b/vcl/inc/vcl/svids.hrc
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svids.hrc,v $
- * $Revision: 1.8 $
+ * $Revision: 1.8.84.3 $
*
* This file is part of OpenOffice.org.
*
@@ -31,6 +31,8 @@
#ifndef _SV_SVIDS_HRC
#define _SV_SVIDS_HRC
+#include "svl/solar.hrc"
+
#define SV_RESID_STDOFFSET 0
#define SV_RESID_WINOFFSET 1
#define SV_RESID_OS2OFFSET 2
@@ -58,6 +60,11 @@
#define SV_RESID_BITMAP_CLOSEDOC 1052
#define SV_RESID_BITMAP_CLOSEDOCHC 1053
+#define SV_DISCLOSURE_PLUS 1060
+#define SV_DISCLOSURE_MINUS 1061
+#define SV_DISCLOSURE_PLUS_HC 1062
+#define SV_DISCLOSURE_MINUS_HC 1063
+
#define SV_RESID_MENU_EDIT 2000
#define SV_MENU_EDIT_UNDO 1
#define SV_MENU_EDIT_CUT 2
@@ -74,6 +81,92 @@
#define SV_MENU_MAC_SHOWALL 2005
#define SV_MENU_MAC_QUITAPP 2006
+#define SV_DLG_PRINT 2048
+#define SV_PRINT_OK 1
+#define SV_PRINT_CANCEL 2
+#define SV_PRINT_HELP 3
+#define SV_PRINT_PAGE_PREVIEW 4
+#define SV_PRINT_PAGE_TXT 5
+#define SV_PRINT_PAGE_FORWARD 6
+#define SV_PRINT_PAGE_BACKWARD 7
+#define SV_PRINT_PAGE_EDIT 8
+#define SV_PRINT_TABCTRL 9
+#define SV_PRINT_PRT_TYPE 10
+#define SV_PRINT_PRT_STATUS 11
+#define SV_PRINT_PRT_LOCATION 12
+#define SV_PRINT_PRT_COMMENT 13
+#define SV_PRINT_TOFILE_TXT 14
+#define SV_PRINT_DEFPRT_TXT 15
+#define SV_PRINT_PRINTPREVIEW_TXT 16
+
+#define SV_PRINT_TAB_NUP 1
+#define SV_PRINT_PRT_NUP_LAYOUT_FL 1
+#define SV_PRINT_PRT_NUP_DEFAULT_BTN 2
+#define SV_PRINT_PRT_NUP_BROCHURE_BTN 3
+#define SV_PRINT_PRT_NUP_PAGES_BTN 4
+#define SV_PRINT_PRT_NUP_PAGES_BOX 5
+#define SV_PRINT_PRT_NUP_NUM_PAGES_TXT 6
+#define SV_PRINT_PRT_NUP_COLS_EDT 7
+#define SV_PRINT_PRT_NUP_TIMES_TXT 8
+#define SV_PRINT_PRT_NUP_ROWS_EDT 9
+#define SV_PRINT_PRT_NUP_MARGINS_PAGES_1_TXT 10
+#define SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT 11
+#define SV_PRINT_PRT_NUP_MARGINS_PAGES_2_TXT 12
+#define SV_PRINT_PRT_NUP_MARGINS_SHEET_1_TXT 13
+#define SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT 14
+#define SV_PRINT_PRT_NUP_MARGINS_SHEET_2_TXT 15
+#define SV_PRINT_PRT_NUP_ORIENTATION_TXT 16
+#define SV_PRINT_PRT_NUP_ORIENTATION_BOX 17
+#define SV_PRINT_PRT_NUP_ORDER_TXT 18
+#define SV_PRINT_PRT_NUP_ORDER_BOX 19
+#define SV_PRINT_PRT_NUP_BORDER_CB 20
+
+#define SV_PRINT_PRT_NUP_ORIENTATION_AUTOMATIC 0
+#define SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT 1
+#define SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE 2
+
+#define SV_PRINT_PRT_NUP_ORDER_LRTD 0
+#define SV_PRINT_PRT_NUP_ORDER_TDLR 1
+
+#define SV_PRINT_TAB_JOB 2
+#define SV_PRINT_PRINTERS_FL 1
+#define SV_PRINT_PRINTERS 2
+#define SV_PRINT_PRT_SETUP 3
+#define SV_PRINT_RANGE 4
+#define SV_PRINT_ALL 5
+#define SV_PRINT_PAGERANGE 6
+#define SV_PRINT_SELECTION 7
+#define SV_PRINT_PAGERANGE_EDIT 8
+#define SV_PRINT_COPIES 9
+#define SV_PRINT_COPYCOUNT 10
+#define SV_PRINT_COPYCOUNT_FIELD 11
+#define SV_PRINT_COLLATE 12
+#define SV_PRINT_COLLATE_IMAGE 13
+#define SV_PRINT_BUTTONLINE 14
+#define SV_PRINT_COLLATE_IMG 15
+#define SV_PRINT_NOCOLLATE_IMG 16
+#define SV_PRINT_COLLATE_HC_IMG 17
+#define SV_PRINT_NOCOLLATE_HC_IMG 18
+#define SV_PRINT_NOPAGES 19
+#define SV_PRINT_STATUS_TXT 20
+#define SV_PRINT_LOCATION_TXT 21
+#define SV_PRINT_COMMENT_TXT 22
+#define SV_PRINT_DETAILS_BTN 23
+
+#define SV_PRINT_TAB_OPT 3
+#define SV_PRINT_OPT_PRINT_FL 1
+#define SV_PRINT_OPT_TOFILE 2
+#define SV_PRINT_OPT_SINGLEJOBS 3
+#define SV_PRINT_OPT_REVERSE 4
+
+#define SV_DLG_PRINT_PROGRESS 2049
+#define SV_PRINT_PROGRESS_CANCEL 1
+#define SV_PRINT_PROGRESS_TEXT 2
+
+#define SV_PRINT_NATIVE_STRINGS 2050
+#define SV_PRINT_NOPRINTERWARNING 2051
+#define SV_PRINT_NOCONTENT 2052
+
#define SV_HELPTEXT_CLOSE 10000
#define SV_HELPTEXT_MINIMIZE 10001
#define SV_HELPTEXT_MAXIMIZE 10002
@@ -108,7 +201,8 @@
#define SV_STDTEXT_ABOUT 10204
#define SV_STDTEXT_PREFERENCES 10205
#define SV_MAC_SCREENNNAME 10206
-#define SV_STDTEXT_LAST SV_MAC_SCREENNNAME
+#define SV_STDTEXT_ALLFILETYPES 10207
+#define SV_STDTEXT_LAST SV_STDTEXT_ALLFILETYPES
#define SV_ACCESSERROR_FIRST SV_ACCESSERROR_WRONG_VERSION
#define SV_ACCESSERROR_WRONG_VERSION 10500
@@ -165,4 +259,6 @@
#define SV_ICON_ID_MACRO 17
#define SV_ICON_ID_PRINTERADMIN 501
+#define HID_PRINTDLG HID_VCL_START
+
#endif // _SV_SVIDS_HRC
diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx
index 30edf6227a60..e91dc47690ff 100644
--- a/vcl/inc/vcl/tabctrl.hxx
+++ b/vcl/inc/vcl/tabctrl.hxx
@@ -31,15 +31,16 @@
#ifndef _SV_TABCTRL_HXX
#define _SV_TABCTRL_HXX
-#include <vcl/sv.h>
-#include <vcl/dllapi.h>
-#include <vcl/ctrl.hxx>
+#include "vcl/sv.h"
+#include "vcl/dllapi.h"
+#include "vcl/ctrl.hxx"
struct ImplTabItem;
struct ImplTabCtrlData;
class ImplTabItemList;
class TabPage;
class PushButton;
+class ListBox;
// --------------------
// - TabControl-Types -
@@ -72,7 +73,7 @@ private:
BOOL mbRestoreUnqId;
BOOL mbSingleLine;
BOOL mbScroll;
- BOOL mbColored;
+ BOOL mbRestoreSmartId;
BOOL mbSmallInvalidate;
BOOL mbExtraSpace;
Link maActivateHdl;
@@ -95,6 +96,11 @@ private:
SAL_DLLPRIVATE void ImplPaint( const Rectangle& rRect, bool bLayout = false );
SAL_DLLPRIVATE void ImplFreeLayoutData();
DECL_DLLPRIVATE_LINK( ImplScrollBtnHdl, PushButton* pBtn );
+ DECL_DLLPRIVATE_LINK( ImplListBoxSelectHdl, ListBox* );
+
+public:
+ // just for dialog control
+ SAL_DLLPRIVATE bool ImplHandleNotifyEvent( NotifyEvent& rEvt );
protected:
using Window::ImplInit;
@@ -128,6 +134,9 @@ public:
virtual void ActivatePage();
virtual long DeactivatePage();
+ virtual Size GetOptimalSize(WindowSizeType eType) const;
+ void SetMinimumSizePixel( const Size& );
+
void SetTabPageSizePixel( const Size& rSize );
Size GetTabPageSizePixel() const;
diff --git a/vcl/inc/vcl/tabdlg.hxx b/vcl/inc/vcl/tabdlg.hxx
index 5ec2bcad5225..ad79ebec4549 100644
--- a/vcl/inc/vcl/tabdlg.hxx
+++ b/vcl/inc/vcl/tabdlg.hxx
@@ -36,6 +36,7 @@
#include <vcl/dialog.hxx>
class FixedLine;
+class TabControl;
// ----------------------
// - TabDialog -
@@ -61,6 +62,8 @@ public:
virtual void Resize();
virtual void StateChanged( StateChangedType nStateChange );
+ SAL_DLLPRIVATE TabControl* ImplGetFirstTabControl() const;
+
void AdjustLayout();
void SetViewWindow( Window* pWindow ) { mpViewWindow = pWindow; }
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index 6e4c300ccc40..c2547e4b01ba 100644
--- a/vcl/inc/vcl/toolbox.hxx
+++ b/vcl/inc/vcl/toolbox.hxx
@@ -124,6 +124,9 @@ typedef USHORT ToolBoxItemBits;
#define TIB_DROPDOWN ((ToolBoxItemBits)0x0020)
#define TIB_REPEAT ((ToolBoxItemBits)0x0040)
#define TIB_DROPDOWNONLY ((ToolBoxItemBits)0x0080 | TIB_DROPDOWN) // this button has only drop down functionality
+#define TIB_TEXT_ONLY ((ToolBoxItemBits)0x0100)
+#define TIB_ICON_ONLY ((ToolBoxItemBits)0x0200)
+#define TIB_TEXTICON ((ToolBoxItemBits) TIB_TEXT_ONLY | TIB_ICON_ONLY )
// -----------------
// - ToolBox-Types -
diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx
index 74971f62c5a6..570c8ad0a342 100644
--- a/vcl/inc/vcl/vclevent.hxx
+++ b/vcl/inc/vcl/vclevent.hxx
@@ -36,12 +36,20 @@
#include "vcl/dllapi.h"
#include "vcl/impdel.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+
#include <list>
#include <vector>
class Window;
class Menu;
+namespace com { namespace sun { namespace star {
+ namespace accessibility {
+ class XAccessible;
+ }
+}}}
+
#define VCLEVENT_OBJECT_DYING 1
// VclWindowEvent:
@@ -242,6 +250,17 @@ public:
USHORT GetItemPos() const { return mnPos; }
};
+class VCL_DLLPUBLIC VclAccessibleEvent: public VclSimpleEvent
+{
+public:
+ VclAccessibleEvent( ULONG n, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible );
+ virtual ~VclAccessibleEvent();
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible() const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
+};
+
class VCL_DLLPUBLIC VclEventListeners : public std::list<Link>
{
public:
@@ -262,7 +281,10 @@ class VCL_DLLPUBLIC VclEventListeners2 : public vcl::DeletionNotifier
std::list< Link >::iterator m_aIt;
bool m_bWasInvalidated;
- ListenerIt() : m_bWasInvalidated( false ) {}
+ ListenerIt(const std::list<Link>::iterator& rIt)
+ : m_aIt(rIt)
+ , m_bWasInvalidated( false )
+ {}
};
std::vector< ListenerIt > m_aIterators;
diff --git a/vcl/inc/vcl/virdev.hxx b/vcl/inc/vcl/virdev.hxx
index bc21dde6f4ac..ea2b49eb8290 100644
--- a/vcl/inc/vcl/virdev.hxx
+++ b/vcl/inc/vcl/virdev.hxx
@@ -74,7 +74,6 @@ private:
#define REFDEV_FORCE_ZERO_EXTLEAD 0x80
SAL_DLLPRIVATE bool ForceZeroExtleadBug() const
{ return ((meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD) != 0); }
-
public:
VirtualDevice( USHORT nBitCount = 0 );
VirtualDevice( const OutputDevice& rCompDev,
@@ -115,11 +114,19 @@ public:
REFDEV_MODE06 = 1, // 600 dpi
REFDEV_MODE48 = 2, // 4800 dpi
REFDEV_MODE_MSO1 = 3,
- REFDEV_MODE_PDF1 = 4 };
+ REFDEV_MODE_PDF1 = 4,
+ REFDEV_CUSTOM = 5
+ };
void SetReferenceDevice( RefDevMode );
void Compat_ZeroExtleadBug(); // enable workaround for #i60495#
+
+ void SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
+
+private:
+ SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
+
};
#endif // _SV_VIRDEV_HXX
diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h
index d745f3dcf081..0fec51e2e702 100644
--- a/vcl/inc/vcl/window.h
+++ b/vcl/inc/vcl/window.h
@@ -358,7 +358,9 @@ public:
mbToolbarFloatingWindow:1,
mbCallHandlersDuringInputDisabled:1,
mbDisableAccessibleLabelForRelation:1,
- mbDisableAccessibleLabeledByRelation:1;
+ mbDisableAccessibleLabeledByRelation:1,
+ mbHelpTextDynamic:1,
+ mbFakeFocusSet:1;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer;
};
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index 56fdb22ddc57..c14ee7add4fb 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -582,7 +582,7 @@ protected:
void ImplCallEventListeners( ULONG nEvent, void* pData = NULL );
void CallEventListeners( ULONG nEvent, void* pData = NULL );
-
+ void FireVclEvent( VclSimpleEvent* pEvent );
// FIXME: this is a hack to workaround missing layout functionality
SAL_DLLPRIVATE void ImplAdjustNWFSizes();
@@ -899,6 +899,13 @@ public:
USHORT GetGetFocusFlags() const;
void GrabFocusToDocument();
+ /**
+ * Set this when you need to act as if the window has focus even if it
+ * doesn't. This is necessary for implementing tab stops inside floating
+ * windows, but floating windows don't get focus from the system.
+ */
+ void SetFakeFocus( bool bFocus );
+
BOOL IsCompoundControl() const;
BOOL HasCompoundControlFocus() const;
diff --git a/vcl/os2/inc/salprn.h b/vcl/os2/inc/salprn.h
index 25ecfe87ed89..2c95965bc609 100644
--- a/vcl/os2/inc/salprn.h
+++ b/vcl/os2/inc/salprn.h
@@ -83,7 +83,6 @@ public:
virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin );
virtual void InitPaperFormats( const ImplJobSetup* pSetupData );
virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData );
- virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData );
};
// ------------------
@@ -136,7 +135,9 @@ public:
virtual BOOL StartJob( const XubString* pFileName,
const XubString& rJobName,
const XubString& rAppName,
- ULONG nCopies, BOOL bCollate,
+ ULONG nCopies,
+ bool bCollate,
+ bool bDirect,
ImplJobSetup* pSetupData );
virtual BOOL EndJob();
virtual BOOL AbortJob();
diff --git a/vcl/os2/source/gdi/salprn.cxx b/vcl/os2/source/gdi/salprn.cxx
index 0c254e2f6e62..a31a4bb779f8 100644
--- a/vcl/os2/source/gdi/salprn.cxx
+++ b/vcl/os2/source/gdi/salprn.cxx
@@ -1559,7 +1559,9 @@ Os2SalPrinter::~Os2SalPrinter()
BOOL Os2SalPrinter::StartJob( const XubString* pFileName,
const XubString& rJobName,
const XubString& rAppName,
- ULONG nCopies, BOOL bCollate,
+ ULONG nCopies,
+ bool bCollate,
+ bool bDirect,
ImplJobSetup* pSetupData )
{
DEVOPENSTRUC aDevOpenStruc;
@@ -1831,9 +1833,4 @@ int Os2SalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData )
printf("Os2SalInfoPrinter::GetLandscapeAngle\n");
return 0;
}
-DuplexMode Os2SalInfoPrinter::GetDuplexMode( const ImplJobSetup* pSetupData )
-{
- DuplexMode nRet = DUPLEX_UNKNOWN;
- printf("Os2SalInfoPrinter::GetDuplexMode\n");
- return nRet;
-}
+
diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst
index 5d2aaf90c6f7..e6f636522acb 100644
--- a/vcl/prj/build.lst
+++ b/vcl/prj/build.lst
@@ -1,4 +1,4 @@
-vc vcl : l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc SO:print_header cpputools shell NULL
+vc vcl : l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools l10ntools icc SO:print_header cpputools shell svl NULL
vc vcl usr1 - all vc_mkout NULL
vc vcl\inc nmake - all vc_inc NULL
vc vcl\source\glyphs nmake - all vc_glyphs vc_inc NULL
diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst
index 54af0d2e289d..8345b155ce58 100644
--- a/vcl/prj/d.lst
+++ b/vcl/prj/d.lst
@@ -81,10 +81,11 @@ mkdir: %_DEST%\inc%_EXT%\vcl
..\inc\vcl\morebtn.hxx %_DEST%\inc%_EXT%\vcl\morebtn.hxx
..\inc\vcl\msgbox.hxx %_DEST%\inc%_EXT%\vcl\msgbox.hxx
..\inc\vcl\octree.hxx %_DEST%\inc%_EXT%\vcl\octree.hxx
+..\inc\vcl\oldprintadaptor.hxx %_DEST%\inc%_EXT%\vcl\oldprintadaptor.hxx
..\inc\vcl\outdev.hxx %_DEST%\inc%_EXT%\vcl\outdev.hxx
..\inc\vcl\pointr.hxx %_DEST%\inc%_EXT%\vcl\pointr.hxx
+..\inc\vcl\popupmenuwindow.hxx %_DEST%\inc%_EXT%\vcl\popupmenuwindow.hxx
..\inc\vcl\print.hxx %_DEST%\inc%_EXT%\vcl\print.hxx
-..\inc\vcl\prndlg.hxx %_DEST%\inc%_EXT%\vcl\prndlg.hxx
..\inc\vcl\prntypes.hxx %_DEST%\inc%_EXT%\vcl\prntypes.hxx
..\inc\vcl\ptrstyle.hxx %_DEST%\inc%_EXT%\vcl\ptrstyle.hxx
..\inc\vcl\regband.hxx %_DEST%\inc%_EXT%\vcl\regband.hxx
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 516b23dd76be..31971468d9c6 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -97,8 +97,8 @@ SalPrinter::~SalPrinter()
{
}
-BOOL SalPrinter::StartJob( const String*, const String&,
- ImplJobSetup*, ImplQPrinter* )
+BOOL SalPrinter::StartJob( const String*, const String&, const String&,
+ ImplJobSetup*, vcl::PrinterController& )
{
return FALSE;
}
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 6a61d15db4c0..e8e56c6ee5a8 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdata.cxx,v $
- * $Revision: 1.56 $
+ * $Revision: 1.56.114.1 $
*
* This file is part of OpenOffice.org.
*
@@ -234,6 +234,15 @@ ResMgr* ImplGetResMgr()
return pSVData->mpResMgr;
}
+ResId VclResId( sal_Int32 nId )
+{
+ ResMgr* pMgr = ImplGetResMgr();
+ if( ! pMgr )
+ throw std::bad_alloc();
+
+ return ResId( nId, *pMgr );
+}
+
DockingManager* ImplGetDockingManager()
{
ImplSVData* pSVData = ImplGetSVData();
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 310c01a40673..f1af78662813 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -444,6 +444,26 @@ void DeInitVCL()
delete pSVData->maCtrlData.mpSplitVArwImgList;
pSVData->maCtrlData.mpSplitVArwImgList = NULL;
}
+ if ( pSVData->maCtrlData.mpDisclosurePlus )
+ {
+ delete pSVData->maCtrlData.mpDisclosurePlus;
+ pSVData->maCtrlData.mpDisclosurePlus = NULL;
+ }
+ if ( pSVData->maCtrlData.mpDisclosurePlusHC )
+ {
+ delete pSVData->maCtrlData.mpDisclosurePlusHC;
+ pSVData->maCtrlData.mpDisclosurePlusHC = NULL;
+ }
+ if ( pSVData->maCtrlData.mpDisclosureMinus )
+ {
+ delete pSVData->maCtrlData.mpDisclosureMinus;
+ pSVData->maCtrlData.mpDisclosureMinus = NULL;
+ }
+ if ( pSVData->maCtrlData.mpDisclosureMinusHC )
+ {
+ delete pSVData->maCtrlData.mpDisclosureMinusHC;
+ pSVData->maCtrlData.mpDisclosureMinusHC = NULL;
+ }
if ( pSVData->mpDefaultWin )
{
delete pSVData->mpDefaultWin;
diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx
index 704d68c5bc7f..ffab843ff7bd 100644
--- a/vcl/source/app/vclevent.cxx
+++ b/vcl/source/app/vclevent.cxx
@@ -34,10 +34,30 @@
#include "vcl/vclevent.hxx"
#include "vcl/svdata.hxx"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::accessibility::XAccessible;
+
TYPEINIT0(VclSimpleEvent);
TYPEINIT1(VclWindowEvent, VclSimpleEvent);
TYPEINIT1(VclMenuEvent, VclSimpleEvent);
+VclAccessibleEvent::VclAccessibleEvent( ULONG n, const Reference<XAccessible>& rxAccessible ) :
+ VclSimpleEvent(n),
+ mxAccessible(rxAccessible)
+{
+}
+
+VclAccessibleEvent::~VclAccessibleEvent()
+{
+}
+
+Reference<XAccessible> VclAccessibleEvent::GetAccessible() const
+{
+ return mxAccessible;
+}
+
void VclEventListeners::Call( VclSimpleEvent* pEvent ) const
{
// Copy the list, because this can be destroyed when calling a Link...
@@ -118,9 +138,8 @@ void VclEventListeners2::callListeners( VclSimpleEvent* i_pEvent )
{
vcl::DeletionListener aDel( this );
- m_aIterators.push_back( ListenerIt() );
+ m_aIterators.push_back(ListenerIt(m_aListeners.begin()));
size_t nIndex = m_aIterators.size() - 1;
- m_aIterators[ nIndex ].m_aIt = m_aListeners.begin();
while( ! aDel.isDeleted() && m_aIterators[ nIndex ].m_aIt != m_aListeners.end() )
{
m_aIterators[ nIndex ].m_aIt->Call( i_pEvent );
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 53a060af6bd6..b5915cc35daf 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1983,8 +1983,11 @@ Size PushButton::CalcMinimumSize( long nMaxWidth ) const
}
// cf. ImplDrawPushButton ...
- aSize.Width() += 8;
- aSize.Height() += 8;
+ if( (GetStyle() & WB_SMALLSTYLE) == 0 )
+ {
+ aSize.Width() += 8;
+ aSize.Height() += 8;
+ }
return CalcWindowSize( aSize );
}
@@ -4376,3 +4379,95 @@ TriStateBox::TriStateBox( Window* pParent, const ResId& rResId ) :
TriStateBox::~TriStateBox()
{
}
+
+// =======================================================================
+
+DisclosureButton::DisclosureButton( Window* pParent, WinBits ) :
+ CheckBox( pParent, WB_NOBORDER )
+{
+}
+
+// -----------------------------------------------------------------------
+
+DisclosureButton::DisclosureButton( Window* pParent, const ResId& rResId ) :
+ CheckBox( pParent, rResId.SetRT( RSC_CHECKBOX ) )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void DisclosureButton::ImplDrawCheckBoxState()
+{
+ /* HACK: DisclosureButton is currently assuming, that the disclosure sign
+ will fit into the rectangle occupied by a normal checkbox on all themes.
+ If this does not hold true for some theme, ImplGetCheckImageSize
+ would have to be overloaded for DisclosureButton; also GetNativeControlRegion
+ for CTRL_LISTNODE would have to be implemented and taken into account
+ */
+
+ Rectangle aStateRect( GetStateRect() );
+
+ ImplControlValue aControlValue( GetState() == STATE_CHECK ? BUTTONVALUE_ON : BUTTONVALUE_OFF, rtl::OUString(), 0 );
+ Region aCtrlRegion( aStateRect );
+ ControlState nState = 0;
+
+ if ( HasFocus() ) nState |= CTRL_STATE_FOCUSED;
+ if ( ImplGetButtonState() & BUTTON_DRAW_DEFAULT ) nState |= CTRL_STATE_DEFAULT;
+ if ( Window::IsEnabled() ) nState |= CTRL_STATE_ENABLED;
+ if ( IsMouseOver() && GetMouseRect().IsInside( GetPointerPosPixel() ) )
+ nState |= CTRL_STATE_ROLLOVER;
+
+ if( ! DrawNativeControl( CTRL_LISTNODE, PART_ENTIRE_CONTROL, aCtrlRegion, nState,
+ aControlValue, rtl::OUString() ) )
+ {
+ ImplSVCtrlData& rCtrlData( ImplGetSVData()->maCtrlData );
+ if( ! rCtrlData.mpDisclosurePlus )
+ rCtrlData.mpDisclosurePlus = new Image( BitmapEx( VclResId( SV_DISCLOSURE_PLUS ) ) );
+ if( ! rCtrlData.mpDisclosurePlusHC )
+ rCtrlData.mpDisclosurePlusHC = new Image( BitmapEx( VclResId( SV_DISCLOSURE_PLUS_HC ) ) );
+ if( ! rCtrlData.mpDisclosureMinus )
+ rCtrlData.mpDisclosureMinus = new Image( BitmapEx( VclResId( SV_DISCLOSURE_MINUS ) ) );
+ if( ! rCtrlData.mpDisclosureMinusHC )
+ rCtrlData.mpDisclosureMinusHC = new Image( BitmapEx( VclResId( SV_DISCLOSURE_MINUS_HC ) ) );
+
+ Image* pImg = NULL;
+ if( GetSettings().GetStyleSettings().GetHighContrastMode() )
+ pImg = IsChecked() ? rCtrlData.mpDisclosureMinusHC : rCtrlData.mpDisclosurePlusHC;
+ else
+ pImg = IsChecked() ? rCtrlData.mpDisclosureMinus : rCtrlData.mpDisclosurePlus;
+
+ DBG_ASSERT( pImg, "no disclosure image" );
+ if( ! pImg )
+ return;
+
+ USHORT nStyle = 0;
+ if( ! IsEnabled() )
+ nStyle |= IMAGE_DRAW_DISABLE;
+
+ Size aSize( aStateRect.GetSize() );
+ Size aImgSize( pImg->GetSizePixel() );
+ Point aOff( (aSize.Width() - aImgSize.Width())/2,
+ (aSize.Height() - aImgSize.Height())/2 );
+ aOff += aStateRect.TopLeft();
+ DrawImage( aOff, *pImg, nStyle );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DisclosureButton::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+
+ if( !aKeyCode.GetModifier() &&
+ ( ( aKeyCode.GetCode() == KEY_ADD ) ||
+ ( aKeyCode.GetCode() == KEY_SUBTRACT ) )
+ )
+ {
+ Check( aKeyCode.GetCode() == KEY_ADD );
+ }
+ else
+ Button::KeyInput( rKEvt );
+}
+
+
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 21707d0182f5..1eea72131b86 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -951,7 +951,7 @@ void ComboBox::ImplUpdateFloatSelection()
if( nSelect != LISTBOX_ENTRY_NOTFOUND )
{
if ( !mpImplLB->IsVisible( nSelect ) )
- mpImplLB->SetTopEntry( nSelect );
+ mpImplLB->ShowProminentEntry( nSelect );
mpImplLB->SelectEntry( nSelect, bSelect );
}
else
@@ -959,7 +959,6 @@ void ComboBox::ImplUpdateFloatSelection()
nSelect = mpImplLB->GetEntryList()->GetSelectEntryPos( 0 );
if( nSelect != LISTBOX_ENTRY_NOTFOUND )
mpImplLB->SelectEntry( nSelect, FALSE );
- // mpImplLB->SetTopEntry( 0 ); #92555# Ugly....
mpImplLB->ResetCurrentPos();
}
}
@@ -1440,6 +1439,13 @@ void ComboBox::SetTopEntry( USHORT nPos )
// -----------------------------------------------------------------------
+void ComboBox::ShowProminentEntry( USHORT nPos )
+{
+ mpImplLB->ShowProminentEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
+}
+
+// -----------------------------------------------------------------------
+
USHORT ComboBox::GetTopEntry() const
{
USHORT nPos = GetEntryCount() ? mpImplLB->GetTopEntry() : LISTBOX_ENTRY_NOTFOUND;
@@ -1450,6 +1456,20 @@ USHORT ComboBox::GetTopEntry() const
// -----------------------------------------------------------------------
+void ComboBox::SetProminentEntryType( ProminentEntry eType )
+{
+ mpImplLB->SetProminentEntryType( eType );
+}
+
+// -----------------------------------------------------------------------
+
+ProminentEntry ComboBox::GetProminentEntryType() const
+{
+ return mpImplLB->GetProminentEntryType();
+}
+
+// -----------------------------------------------------------------------
+
Rectangle ComboBox::GetDropDownPosSizePixel() const
{
return mpFloatWin ? mpFloatWin->GetWindowExtentsRelative( const_cast<ComboBox*>(this) ) : Rectangle();
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index b654e034470f..320f235a8c30 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -492,6 +492,17 @@ void Edit::ImplInvalidateOrRepaint( xub_StrLen nStart, xub_StrLen nEnd )
// -----------------------------------------------------------------------
+long Edit::ImplGetTextYPosition() const
+{
+ if ( GetStyle() & WB_TOP )
+ return ImplGetExtraOffset();
+ else if ( GetStyle() & WB_BOTTOM )
+ return GetOutputSizePixel().Height() - GetTextHeight() - ImplGetExtraOffset();
+ return ( GetOutputSizePixel().Height() - GetTextHeight() ) / 2;
+}
+
+// -----------------------------------------------------------------------
+
void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout )
{
if ( !IsReallyVisible() )
@@ -516,10 +527,8 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout )
GetCaretPositions( aText, pDX, nStart, nEnd );
}
- // center vertically
- long nH = GetOutputSize().Height();
long nTH = GetTextHeight();
- Point aPos( mnXOffset, (nH-nTH)/2 );
+ Point aPos( mnXOffset, ImplGetTextYPosition() );
if( bLayout )
{
@@ -1193,7 +1202,7 @@ void Edit::ImplShowCursor( BOOL bOnlyIfVisible )
long nCursorPosX = nTextPos + mnXOffset + ImplGetExtraOffset();
// Cursor muss im sichtbaren Bereich landen:
- Size aOutSize = GetOutputSizePixel();
+ const Size aOutSize = GetOutputSizePixel();
if ( (nCursorPosX < 0) || (nCursorPosX >= aOutSize.Width()) )
{
long nOldXOffset = mnXOffset;
@@ -1227,8 +1236,8 @@ void Edit::ImplShowCursor( BOOL bOnlyIfVisible )
ImplInvalidateOrRepaint();
}
- long nTextHeight = GetTextHeight();
- long nCursorPosY = (aOutSize.Height()-nTextHeight) / 2;
+ const long nTextHeight = GetTextHeight();
+ const long nCursorPosY = ImplGetTextYPosition();
pCursor->SetPos( Point( nCursorPosX, nCursorPosY ) );
pCursor->SetSize( Size( nCursorWidth, nTextHeight ) );
pCursor->Show();
@@ -2831,7 +2840,29 @@ void Edit::SetSubEdit( Edit* pEdit )
Size Edit::CalcMinimumSize() const
{
Size aSize ( GetTextWidth( GetText() ), GetTextHeight() );
- return CalcWindowSize( aSize );
+ // do not create edit fields in which one cannot enter anything
+ // a default minimum width should exist for at least 3 characters
+ Size aMinSize ( CalcSize( 3 ) );
+ if( aSize.Width() < aMinSize.Width() )
+ aSize.Width() = aMinSize.Width();
+ // add some space between text entry an border
+ aSize.Height() += 4;
+
+ aSize = CalcWindowSize( aSize );
+
+ // ask NWF what if it has an opinion, too
+ ImplControlValue aControlValue;
+ Rectangle aRect( Point( 0, 0 ), aSize );
+ Region aContent, aBound;
+ if( const_cast<Edit*>(this)->GetNativeControlRegion(
+ CTRL_EDITBOX, PART_ENTIRE_CONTROL,
+ aRect, 0, aControlValue, rtl::OUString(), aBound, aContent) )
+ {
+ Rectangle aBoundRect( aContent.GetBoundRect() );
+ if( aBoundRect.GetHeight() > aSize.Height() )
+ aSize.Height() = aBoundRect.GetHeight();
+ }
+ return aSize;
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 3d19e288a1ce..df2673ede10c 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -1062,6 +1062,14 @@ void FixedImage::Paint( const Rectangle& )
// -----------------------------------------------------------------------
+Size FixedImage::GetOptimalSize( WindowSizeType ) const
+{
+ const Image* pImage = GetSettings().GetStyleSettings().GetHighContrastMode() ? &maImageHC : &maImage;
+ return pImage->GetSizePixel();
+}
+
+// -----------------------------------------------------------------------
+
void FixedImage::UserDraw( const UserDrawEvent& )
{
}
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index a915d8e6b9e8..ab353a4d4798 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -565,6 +565,7 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) :
mnCurrentPos = LISTBOX_ENTRY_NOTFOUND;
mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND;
mnSeparatorPos = LISTBOX_ENTRY_NOTFOUND;
+ meProminentType = PROMINENT_TOP;
SetLineColor();
SetTextFillColor();
@@ -1067,11 +1068,11 @@ void ImplListBoxWindow::SelectEntry( USHORT nPos, BOOL bSelect )
if ( !nVisibleEntries || !IsReallyVisible() || ( nPos < GetTopEntry() ) )
{
Resize();
- SetTopEntry( nPos );
+ ShowProminentEntry( nPos );
}
else
{
- SetTopEntry( nPos-nVisibleEntries+1 );
+ ShowProminentEntry( nPos );
}
}
}
@@ -1702,11 +1703,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
if ( nSelect != LISTBOX_ENTRY_NOTFOUND )
{
- USHORT nCurVis = GetLastVisibleEntry() - mnTop + 1;
- if( nSelect < mnTop )
- SetTopEntry( nSelect );
- else if( nSelect >= (mnTop + nCurVis) )
- SetTopEntry( nSelect - nCurVis + 1 );
+ ShowProminentEntry( nSelect );
if ( mpEntryList->IsEntryPosSelected( nSelect ) )
nSelect = LISTBOX_ENTRY_NOTFOUND;
@@ -1873,6 +1870,8 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText,
USHORT nDrawStyle = ImplGetTextStyle();
if( (pEntry->mnFlags & LISTBOX_ENTRY_FLAG_MULTILINE) )
nDrawStyle |= MULTILINE_ENTRY_DRAW_FLAGS;
+ if( (pEntry->mnFlags & LISTBOX_ENTRY_FLAG_DRAW_DISABLED) )
+ nDrawStyle |= TEXT_DRAW_DISABLE;
DrawText( aTextRect, aStr, nDrawStyle, pVector, pDisplayText );
}
@@ -2051,6 +2050,20 @@ void ImplListBoxWindow::SetTopEntry( USHORT nTop )
// -----------------------------------------------------------------------
+void ImplListBoxWindow::ShowProminentEntry( USHORT nEntryPos )
+{
+ if( meProminentType == PROMINENT_MIDDLE )
+ {
+ USHORT nPos = nEntryPos;
+ long nWHeight = PixelToLogic( GetSizePixel() ).Height();
+ while( nEntryPos > 0 && mpEntryList->GetAddedHeight( nPos+1, nEntryPos ) < nWHeight/2 )
+ nEntryPos--;
+ }
+ SetTopEntry( nEntryPos );
+}
+
+// -----------------------------------------------------------------------
+
void ImplListBoxWindow::SetLeftIndent( long n )
{
ScrollHorz( n - mnLeft );
@@ -3204,7 +3217,7 @@ void ImplListBoxFloatingWindow::StartFloat( BOOL bStartTracking )
StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN );
if( nPos != LISTBOX_ENTRY_NOTFOUND )
- mpImplLB->SetTopEntry( nPos );
+ mpImplLB->ShowProminentEntry( nPos );
if( bStartTracking )
mpImplLB->GetMainWindow()->EnableMouseMoveSelect( TRUE );
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index ceabbe4ab166..ac51d7593c93 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -108,6 +108,7 @@ void ListBox::ImplInitListBoxData()
mnDDHeight = 0;
mbDDAutoSize = TRUE;
mnSaveValue = LISTBOX_ENTRY_NOTFOUND;
+ mnLineCount = 0;
}
// -----------------------------------------------------------------------
@@ -1209,6 +1210,13 @@ void ListBox::SetTopEntry( USHORT nPos )
// -----------------------------------------------------------------------
+void ListBox::ShowProminentEntry( USHORT nPos )
+{
+ mpImplLB->ShowProminentEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
+}
+
+// -----------------------------------------------------------------------
+
USHORT ListBox::GetTopEntry() const
{
USHORT nPos = GetEntryCount() ? mpImplLB->GetTopEntry() : LISTBOX_ENTRY_NOTFOUND;
@@ -1219,6 +1227,20 @@ USHORT ListBox::GetTopEntry() const
// -----------------------------------------------------------------------
+void ListBox::SetProminentEntryType( ProminentEntry eType )
+{
+ mpImplLB->SetProminentEntryType( eType );
+}
+
+// -----------------------------------------------------------------------
+
+ProminentEntry ListBox::GetProminentEntryType() const
+{
+ return mpImplLB->GetProminentEntryType();
+}
+
+// -----------------------------------------------------------------------
+
BOOL ListBox::IsTravelSelect() const
{
return mpImplLB->IsTravelSelect();
@@ -1286,31 +1308,47 @@ Size ListBox::CalcMinimumSize() const
else
{
aSz.Height() = mpImplLB->CalcSize( 1 ).Height();
- if( aSz.Height() < mnDDHeight )
+ aSz.Height() += 4; // add a space between entry and border
+ // size to maxmimum entry width and add a little breathing space
+ aSz.Width() = mpImplLB->GetMaxEntryWidth() + 4;
+ // do not create ultrathin ListBoxes, it doesn't look good
+ if( aSz.Width() < GetSettings().GetStyleSettings().GetScrollBarSize() )
+ aSz.Width() = GetSettings().GetStyleSettings().GetScrollBarSize();
+
+ // try native borders; scrollbar size may not be a good indicator
+ // see how large the edit area inside is to estimate what is needed for the dropdown
+ ImplControlValue aControlValue;
+ Point aPoint;
+ Region aContent, aBound;
+ Size aTestSize( 100, 20 );
+ Region aArea( Rectangle( aPoint, aTestSize ) );
+ if( const_cast<ListBox*>(this)->GetNativeControlRegion(
+ CTRL_LISTBOX, PART_SUB_EDIT, aArea, 0, aControlValue, rtl::OUString(), aBound, aContent) )
{
- aSz.Height() = mnDDHeight;
- // FIXME: this is currently only on mac/aqua
- if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
- IsNativeWidgetEnabled() &&
- const_cast<ListBox*>(this)->IsNativeControlSupported( CTRL_LISTBOX, PART_ENTIRE_CONTROL ) )
- {
- ImplControlValue aControlValue;
- Region aCtrlRegion( Rectangle( (const Point&)Point(), Size( 20, mnDDHeight ) ) );
- Region aBoundingRgn( aCtrlRegion );
- Region aContentRgn( aCtrlRegion );
- // adjust the size of the edit field
- if( const_cast<ListBox*>(this)->GetNativeControlRegion( CTRL_LISTBOX, PART_ENTIRE_CONTROL,
- aCtrlRegion, 0, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn) )
- {
- aSz.Height() = aContentRgn.GetBoundRect().GetHeight();
- }
- }
+ // use the themes drop down size
+ Rectangle aContentRect = aContent.GetBoundRect();
+ aSz.Width() += aTestSize.Width() - aContentRect.GetWidth();
}
- aSz.Width() = mpImplLB->GetMaxEntryWidth();
- aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
+ else
+ aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
}
aSz = CalcWindowSize( aSz );
+
+ if ( IsDropDownBox() ) // check minimum height of dropdown box
+ {
+ ImplControlValue aControlValue;
+ Rectangle aRect( Point( 0, 0 ), aSz );
+ Region aContent, aBound;
+ if( const_cast<ListBox*>(this)->GetNativeControlRegion(
+ CTRL_LISTBOX, PART_ENTIRE_CONTROL, aRect, 0, aControlValue, rtl::OUString(), aBound, aContent) )
+ {
+ Rectangle aBoundRect( aBound.GetBoundRect() );
+ if( aBoundRect.GetHeight() > aSz.Height() )
+ aSz.Height() = aBoundRect.GetHeight();
+ }
+ }
+
return aSz;
}
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 9a34629ddf8e..43c459b6c52e 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -30,25 +30,24 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include <tools/debug.hxx>
-
-#ifndef _SV_RC_H
-#include <tools/rc.h>
-#endif
-#include <vcl/svdata.hxx>
-#ifndef _SV_APP_HXX
-#include <vcl/svapp.hxx>
-#endif
-#include <vcl/help.hxx>
-#include <vcl/event.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/button.hxx>
-#include <vcl/tabpage.hxx>
-#include <vcl/tabctrl.hxx>
-#include <vcl/controldata.hxx>
-#include <vcl/sound.hxx>
-
-#include <vcl/window.h>
+#include "tools/debug.hxx"
+
+#include "tools/rc.h"
+#include "vcl/svdata.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/help.hxx"
+#include "vcl/event.hxx"
+#include "vcl/menu.hxx"
+#include "vcl/button.hxx"
+#include "vcl/tabpage.hxx"
+#include "vcl/tabctrl.hxx"
+#include "vcl/controllayout.hxx"
+#include "vcl/controldata.hxx"
+#include "vcl/sound.hxx"
+#include "vcl/lstbox.hxx"
+#include "vcl/smartid.hxx"
+
+#include "vcl/window.h"
#include <hash_map>
#include <vector>
@@ -87,6 +86,8 @@ struct ImplTabCtrlData
std::vector< Rectangle > maTabRectangles;
Point maItemsOffset; // offset of the tabitems
std::vector< ImplTabItem > maItemList;
+ ListBox* mpListBox;
+ Size maMinSize;
};
// -----------------------------------------------------------------------
@@ -153,16 +154,25 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle )
mbRestoreUnqId = FALSE;
mbSingleLine = FALSE;
mbScroll = FALSE;
- mbColored = FALSE;
+ mbRestoreSmartId = FALSE;
mbSmallInvalidate = FALSE;
mbExtraSpace = FALSE;
mpTabCtrlData = new ImplTabCtrlData;
mpTabCtrlData->mpLeftBtn = NULL;
mpTabCtrlData->mpRightBtn = NULL;
+ mpTabCtrlData->mpListBox = NULL;
ImplInitSettings( TRUE, TRUE, TRUE );
+ if( (nStyle & WB_DROPDOWN) )
+ {
+ mpTabCtrlData->mpListBox = new ListBox( this, WB_DROPDOWN );
+ mpTabCtrlData->mpListBox->SetPosSizePixel( Point( 0, 0 ), Size( 200, 20 ) );
+ mpTabCtrlData->mpListBox->SetSelectHdl( LINK( this, TabControl, ImplListBoxSelectHdl ) );
+ mpTabCtrlData->mpListBox->Show();
+ }
+
// if the tabcontrol is drawn (ie filled) by a native widget, make sure all contols will have transparent background
// otherwise they will paint with a wrong background
if( IsNativeControlSupported(CTRL_TAB_PANE, PART_ENTIRE_CONTROL) )
@@ -286,6 +296,8 @@ TabControl::~TabControl()
// TabCtrl-Daten loeschen
if ( mpTabCtrlData )
{
+ if( mpTabCtrlData->mpListBox )
+ delete mpTabCtrlData->mpListBox;
if ( mpTabCtrlData->mpLeftBtn )
delete mpTabCtrlData->mpLeftBtn;
if ( mpTabCtrlData->mpRightBtn )
@@ -693,6 +705,8 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId )
pCtrlParent->SetHelpId( 0 );
if ( mbRestoreUnqId )
pCtrlParent->SetUniqueId( 0 );
+ if( mbRestoreSmartId )
+ pCtrlParent->SetSmartHelpId( SmartId() );
pOldPage->DeactivatePage();
}
@@ -700,8 +714,8 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId )
{
pPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
- // Hier Page aktivieren, damit die Controls entsprechend umgeschaltet
- // werden koennen und HilfeId gegebenenfalls beim Parent umsetzen
+ // activate page here so the conbtrols can be switched
+ // also set the help id of the parent window to that of the tab page
if ( !GetHelpId() )
{
mbRestoreHelpId = TRUE;
@@ -712,6 +726,11 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId )
mbRestoreUnqId = TRUE;
pCtrlParent->SetUniqueId( pPage->GetUniqueId() );
}
+ if( ! GetSmartHelpId().HasAny() )
+ {
+ mbRestoreSmartId = TRUE;
+ pCtrlParent->SetSmartHelpId( pPage->GetSmartHelpId() );
+ }
pPage->ActivatePage();
@@ -791,7 +810,7 @@ void TabControl::ImplSetFirstPagePos( USHORT )
void TabControl::ImplShowFocus()
{
- if ( !GetPageCount() )
+ if ( !GetPageCount() || mpTabCtrlData->mpListBox )
return;
// make sure the focussed item rect is computed using a bold font
@@ -1062,16 +1081,27 @@ IMPL_LINK( TabControl, ImplScrollBtnHdl, PushButton*, EMPTYARG )
// -----------------------------------------------------------------------
+IMPL_LINK( TabControl, ImplListBoxSelectHdl, ListBox*, EMPTYARG )
+{
+ SelectTabPage( GetPageId( mpTabCtrlData->mpListBox->GetSelectEntryPos() ) );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
void TabControl::MouseButtonDown( const MouseEvent& rMEvt )
{
- if ( rMEvt.IsLeft() )
+ if( mpTabCtrlData->mpListBox == NULL )
{
- USHORT nPageId = GetPageId( rMEvt.GetPosPixel() );
- ImplTabItem* pItem = ImplGetItem( nPageId );
- if( pItem && pItem->mbEnabled )
- SelectTabPage( nPageId );
- else
- Sound::Beep( SOUND_ERROR, this );
+ if( rMEvt.IsLeft() )
+ {
+ USHORT nPageId = GetPageId( rMEvt.GetPosPixel() );
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+ if( pItem && pItem->mbEnabled )
+ SelectTabPage( nPageId );
+ else
+ Sound::Beep( SOUND_ERROR, this );
+ }
}
}
@@ -1079,7 +1109,9 @@ void TabControl::MouseButtonDown( const MouseEvent& rMEvt )
void TabControl::KeyInput( const KeyEvent& rKEvt )
{
- if ( GetPageCount() > 1 )
+ if( mpTabCtrlData->mpListBox )
+ mpTabCtrlData->mpListBox->KeyInput( rKEvt );
+ else if ( GetPageCount() > 1 )
{
KeyCode aKeyCode = rKEvt.GetKeyCode();
USHORT nKeyCode = aKeyCode.GetCode();
@@ -1224,7 +1256,7 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout )
}
}
- if ( !mpTabCtrlData->maItemList.empty() )
+ if ( !mpTabCtrlData->maItemList.empty() && mpTabCtrlData->mpListBox == NULL )
{
// Some native toolkits (GTK+) draw tabs right-to-left, with an
// overlap between adjacent tabs
@@ -1294,6 +1326,18 @@ void TabControl::Resize()
if ( !IsReallyShown() )
return;
+ if( mpTabCtrlData->mpListBox )
+ {
+ // get the listbox' preferred size
+ Size aTabCtrlSize( GetSizePixel() );
+ long nPrefWidth = mpTabCtrlData->mpListBox->GetOptimalSize( WINDOWSIZE_PREFERRED ).Width();
+ if( nPrefWidth > aTabCtrlSize.Width() )
+ nPrefWidth = aTabCtrlSize.Width();
+ Size aNewSize( nPrefWidth, LogicToPixel( Size( 12, 12 ), MapMode( MAP_APPFONT ) ).Height() );
+ Point aNewPos( (aTabCtrlSize.Width() - nPrefWidth) / 2, 0 );
+ mpTabCtrlData->mpListBox->SetPosSizePixel( aNewPos, aNewSize );
+ }
+
mbFormat = TRUE;
// Aktuelle TabPage resizen/positionieren
@@ -1343,8 +1387,16 @@ void TabControl::Resize()
void TabControl::GetFocus()
{
- ImplShowFocus();
- SetInputContext( InputContext( GetFont() ) );
+ if( ! mpTabCtrlData->mpListBox )
+ {
+ ImplShowFocus();
+ SetInputContext( InputContext( GetFont() ) );
+ }
+ else
+ {
+ if( mpTabCtrlData->mpListBox->IsReallyVisible() )
+ mpTabCtrlData->mpListBox->GrabFocus();
+ }
Control::GetFocus();
}
@@ -1352,7 +1404,8 @@ void TabControl::GetFocus()
void TabControl::LoseFocus()
{
- HideFocus();
+ if( ! mpTabCtrlData->mpListBox )
+ HideFocus();
Control::LoseFocus();
}
@@ -1446,7 +1499,7 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt )
void TabControl::Command( const CommandEvent& rCEvt )
{
- if ( (rCEvt.GetCommand() == COMMAND_CONTEXTMENU) && (GetPageCount() > 1) )
+ if( (mpTabCtrlData->mpListBox == NULL) && (rCEvt.GetCommand() == COMMAND_CONTEXTMENU) && (GetPageCount() > 1) )
{
Point aMenuPos;
BOOL bMenu;
@@ -1490,7 +1543,11 @@ void TabControl::StateChanged( StateChangedType nType )
Control::StateChanged( nType );
if ( nType == STATE_CHANGE_INITSHOW )
+ {
ImplPosCurTabPage();
+ if( mpTabCtrlData->mpListBox )
+ Resize();
+ }
else if ( nType == STATE_CHANGE_UPDATEMODE )
{
if ( IsUpdateMode() )
@@ -1601,7 +1658,7 @@ long TabControl::PreNotify( NotifyEvent& rNEvt )
// -----------------------------------------------------------------------
-long TabControl::Notify( NotifyEvent& rNEvt )
+bool TabControl::ImplHandleNotifyEvent( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == EVENT_KEYINPUT) && (GetPageCount() > 1) )
{
@@ -1629,8 +1686,16 @@ long TabControl::Notify( NotifyEvent& rNEvt )
}
}
}
+ return false;
+}
+
- return Control::Notify( rNEvt );
+// -----------------------------------------------------------------------
+
+long TabControl::Notify( NotifyEvent& rNEvt )
+{
+
+ return ImplHandleNotifyEvent( rNEvt ) ? TRUE : Control::Notify( rNEvt );
}
// -----------------------------------------------------------------------
@@ -1708,23 +1773,33 @@ void TabControl::InsertPage( USHORT nPageId, const XubString& rText,
DBG_ASSERT( GetPagePos( nPageId ) == TAB_PAGE_NOTFOUND,
"TabControl::InsertPage(): PageId already exists" );
- // set current page id
- if ( !mnCurPageId )
- mnCurPageId = nPageId;
-
// insert new page item
ImplTabItem* pItem = NULL;
if( nPos == TAB_APPEND || size_t(nPos) >= mpTabCtrlData->maItemList.size() )
{
mpTabCtrlData->maItemList.push_back( ImplTabItem() );
pItem = &mpTabCtrlData->maItemList.back();
+ if( mpTabCtrlData->mpListBox )
+ mpTabCtrlData->mpListBox->InsertEntry( rText );
}
else
{
std::vector< ImplTabItem >::iterator new_it =
mpTabCtrlData->maItemList.insert( mpTabCtrlData->maItemList.begin() + nPos, ImplTabItem() );
pItem = &(*new_it);
+ if( mpTabCtrlData->mpListBox )
+ mpTabCtrlData->mpListBox->InsertEntry( rText, nPos);
}
+ if( mpTabCtrlData->mpListBox )
+ {
+ if( ! mnCurPageId )
+ mpTabCtrlData->mpListBox->SelectEntryPos( 0 );
+ mpTabCtrlData->mpListBox->SetDropDownLineCount( mpTabCtrlData->mpListBox->GetEntryCount() );
+ }
+
+ // set current page id
+ if ( !mnCurPageId )
+ mnCurPageId = nPageId;
// init new page item
pItem->mnId = nPageId;
@@ -1739,6 +1814,8 @@ void TabControl::InsertPage( USHORT nPageId, const XubString& rText,
Invalidate();
ImplFreeLayoutData();
+ if( mpTabCtrlData->mpListBox ) // reposition/resize listbox
+ Resize();
ImplCallEventListeners( VCLEVENT_TABPAGE_INSERTED, (void*) (ULONG)nPageId );
}
@@ -1756,6 +1833,11 @@ void TabControl::RemovePage( USHORT nPageId )
std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin() + nPos;
bool bIsCurrentPage = (it->mnId == mnCurPageId);
mpTabCtrlData->maItemList.erase( it );
+ if( mpTabCtrlData->mpListBox )
+ {
+ mpTabCtrlData->mpListBox->RemoveEntry( nPos );
+ mpTabCtrlData->mpListBox->SetDropDownLineCount( mpTabCtrlData->mpListBox->GetEntryCount() );
+ }
// If current page is removed, than first page gets the current page
if ( bIsCurrentPage )
@@ -1793,6 +1875,8 @@ void TabControl::Clear()
// clear item list
mpTabCtrlData->maItemList.clear();
mnCurPageId = 0;
+ if( mpTabCtrlData->mpListBox )
+ mpTabCtrlData->mpListBox->Clear();
ImplFreeLayoutData();
@@ -1813,6 +1897,9 @@ void TabControl::EnablePage( USHORT i_nPageId, bool i_bEnable )
{
pItem->mbEnabled = i_bEnable;
mbFormat = TRUE;
+ if( mpTabCtrlData->mpListBox )
+ mpTabCtrlData->mpListBox->SetEntryFlags( GetPagePos( i_nPageId ),
+ i_bEnable ? 0 : (LISTBOX_ENTRY_FLAG_DISABLE_SELECTION | LISTBOX_ENTRY_FLAG_DRAW_DISABLED) );
if( pItem->mnId == mnCurPageId )
{
// SetCurPageId will change to an enabled page
@@ -1937,6 +2024,8 @@ void TabControl::SelectTabPage( USHORT nPageId )
nPageId = mnActPageId;
mnActPageId = 0;
SetCurPageId( nPageId );
+ if( mpTabCtrlData->mpListBox )
+ mpTabCtrlData->mpListBox->SelectEntryPos( GetPagePos( nPageId ) );
ImplCallEventListeners( VCLEVENT_TABPAGE_ACTIVATE, (void*) (ULONG) nPageId );
}
}
@@ -2001,6 +2090,12 @@ void TabControl::SetPageText( USHORT nPageId, const XubString& rText )
{
pItem->maText = rText;
mbFormat = TRUE;
+ if( mpTabCtrlData->mpListBox )
+ {
+ USHORT nPos = GetPagePos( nPageId );
+ mpTabCtrlData->mpListBox->RemoveEntry( nPos );
+ mpTabCtrlData->mpListBox->InsertEntry( rText, nPos );
+ }
if ( IsUpdateMode() )
Invalidate();
ImplFreeLayoutData();
@@ -2216,3 +2311,25 @@ Point TabControl::GetItemsOffset() const
}
// -----------------------------------------------------------------------
+
+Size TabControl::GetOptimalSize(WindowSizeType eType) const
+{
+ switch (eType) {
+ case WINDOWSIZE_MINIMUM:
+ return mpTabCtrlData ? mpTabCtrlData->maMinSize : Size();
+ default:
+ return Control::GetOptimalSize( eType );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::SetMinimumSizePixel( const Size& i_rSize )
+{
+ if( mpTabCtrlData )
+ mpTabCtrlData->maMinSize = i_rSize;
+}
+
+// -----------------------------------------------------------------------
+
+
diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx
index 600c03194210..a1c3344f3e5a 100644
--- a/vcl/source/fontsubset/gsub.cxx
+++ b/vcl/source/fontsubset/gsub.cxx
@@ -42,6 +42,7 @@ namespace vcl
{
typedef sal_uInt32 ULONG;
+typedef sal_uInt32 UINT32;
typedef sal_uInt16 USHORT;
typedef sal_uInt8 FT_Byte;
@@ -280,13 +281,11 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile,
return false;
for( int i = nCntRange; --i >= 0; )
{
- const USHORT nGlyph0 = NEXT_UShort( pCoverage );
- const USHORT nGlyph1 = NEXT_UShort( pCoverage );
- const USHORT nStartCoverageIndex = NEXT_UShort( pCoverage );
- OSL_ENSURE( aSubstVector.size() == nStartCoverageIndex, "coverage index mismatch");
- (void)nStartCoverageIndex;
- for( USHORT j = nGlyph0; j <= nGlyph1; ++j )
- aSubstVector.push_back( GlyphSubst( j, 0 ) );
+ const UINT32 nGlyph0 = NEXT_UShort( pCoverage );
+ const UINT32 nGlyph1 = NEXT_UShort( pCoverage );
+ const USHORT nCovIdx = NEXT_UShort( pCoverage );
+ for( UINT32 j = nGlyph0; j <= nGlyph1; ++j )
+ aSubstVector.push_back( GlyphSubst( static_cast<USHORT>(j + nCovIdx), 0 ) );
}
}
break;
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 0accc42af968..964d6a93ac3c 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1094,6 +1094,14 @@ static void GetNames(TrueTypeFont *t)
const sal_uInt8* table = getTable( t, O_name );
int nTableSize = getTableSize(t, O_name);
+ if (nTableSize < 4)
+ {
+#if OSL_DEBUG_LEVEL > 1
+ fprintf(stderr, "O_name table too small\n");
+#endif
+ return;
+ }
+
sal_uInt16 n = GetUInt16(table, 2, 1);
int i, r;
sal_Bool bPSNameOK = sal_True;
@@ -1681,7 +1689,6 @@ int OpenTTFontFile( const char* fname, sal_uInt32 facenum, TrueTypeFont** ttf )
goto cleanup;
}
-
if (((*ttf)->ptr = (sal_uInt8 *) mmap(0, (*ttf)->fsize, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) {
ret = SF_MEMORY;
goto cleanup;
@@ -2702,7 +2709,7 @@ void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info)
}
table = getTable(ttf, O_post);
- if (table) {
+ if (table && getTableSize(ttf, O_post) >= 12+sizeof(sal_uInt32)) {
info->pitch = GetUInt32(table, 12, 1);
info->italicAngle = GetInt32(table, 4, 1);
}
@@ -2808,6 +2815,15 @@ int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr)
{
const sal_uInt8* table = getTable(ttf, O_name);
int nTableSize = getTableSize(ttf, O_name );
+
+ if (nTableSize < 6)
+ {
+#if OSL_DEBUG_LEVEL > 1
+ fprintf(stderr, "O_name table too small\n");
+#endif
+ return 0;
+ }
+
sal_uInt16 n = GetUInt16(table, 2, 1);
int nStrBase = GetUInt16(table, 4, 1);
int i;
diff --git a/vcl/source/gdi/bmpconv.cxx b/vcl/source/gdi/bmpconv.cxx
index 9d9b81ba50d4..03d85acb0159 100644
--- a/vcl/source/gdi/bmpconv.cxx
+++ b/vcl/source/gdi/bmpconv.cxx
@@ -192,7 +192,8 @@ BmpTransporter::BmpTransporter( const Bitmap& rBM )
m_aSize.Height = rBM.GetSizePixel().Height();
SvMemoryStream aStream;
rBM.Write( aStream, FALSE, TRUE );
- m_aBM = Sequence<sal_Int8>((const sal_Int8*)aStream.GetData(), aStream.GetSize() );
+ m_aBM = Sequence<sal_Int8>(static_cast<const sal_Int8*>(aStream.GetData()),
+ aStream.GetEndOfData());
}
BmpTransporter::~BmpTransporter()
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 6483c8292df7..951d80f9af9d 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -876,6 +876,40 @@ void GDIMetaFile::Scale( const Fraction& rScaleX, const Fraction& rScaleY )
// ------------------------------------------------------------------------
+void GDIMetaFile::Clip( const Rectangle& i_rClipRect )
+{
+ Rectangle aCurRect( i_rClipRect );
+ VirtualDevice aMapVDev;
+
+ aMapVDev.EnableOutput( FALSE );
+ aMapVDev.SetMapMode( GetPrefMapMode() );
+
+ for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() )
+ {
+ const long nType = pAct->GetType();
+
+ if( ( META_MAPMODE_ACTION == nType ) ||
+ ( META_PUSH_ACTION == nType ) ||
+ ( META_POP_ACTION == nType ) )
+ {
+ pAct->Execute( &aMapVDev );
+ aCurRect = aMapVDev.LogicToLogic( i_rClipRect, GetPrefMapMode(), aMapVDev.GetMapMode() );
+ }
+ else if( nType == META_CLIPREGION_ACTION )
+ {
+ MetaClipRegionAction* pOldAct = (MetaClipRegionAction*)pAct;
+ Region aNewReg( aCurRect );
+ if( pOldAct->IsClipping() )
+ aNewReg.Intersect( pOldAct->GetRegion() );
+ MetaClipRegionAction* pNewAct = new MetaClipRegionAction( aNewReg, TRUE );
+ Replace( pNewAct, GetCurPos() );
+ pOldAct->Delete();
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
Point GDIMetaFile::ImplGetRotatedPoint( const Point& rPt, const Point& rRotatePt,
const Size& rOffset, double fSin, double fCos )
{
diff --git a/vcl/source/gdi/impprn.cxx b/vcl/source/gdi/impprn.cxx
index 539c879c89ea..28d92a0b3832 100644
--- a/vcl/source/gdi/impprn.cxx
+++ b/vcl/source/gdi/impprn.cxx
@@ -478,10 +478,12 @@ void ImplQPrinter::EndQueuePrint()
DBG_ASSERT( mpPrinter, "no SalPrinter in ImplQPrinter" );
if( mpPrinter )
{
+ #if 0
mpPrinter->StartJob( mbPrintFile ? &maPrintFile : NULL,
Application::GetDisplayName(),
maJobSetup.ImplGetConstData(),
this );
+ #endif
EndJob();
mpParent->ImplEndPrint();
}
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index 686d33593466..4823a5492ded 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -73,6 +73,7 @@ ImplJobSetup::ImplJobSetup()
mnRefCount = 1;
mnSystem = 0;
meOrientation = ORIENTATION_PORTRAIT;
+ meDuplexMode = DUPLEX_UNKNOWN;
mnPaperBin = 0;
mePaperFormat = PAPER_USER;
mnPaperWidth = 0;
@@ -90,6 +91,7 @@ ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) :
mnRefCount = 1;
mnSystem = rJobSetup.mnSystem;
meOrientation = rJobSetup.meOrientation;
+ meDuplexMode = rJobSetup.meDuplexMode;
mnPaperBin = rJobSetup.mnPaperBin;
mePaperFormat = rJobSetup.mePaperFormat;
mnPaperWidth = rJobSetup.mnPaperWidth;
@@ -277,6 +279,7 @@ BOOL JobSetup::operator==( const JobSetup& rJobSetup ) const
(pData1->maPrinterName == pData2->maPrinterName) &&
(pData1->maDriver == pData2->maDriver) &&
(pData1->meOrientation == pData2->meOrientation) &&
+ (pData1->meDuplexMode == pData2->meDuplexMode) &&
(pData1->mnPaperBin == pData2->mnPaperBin) &&
(pData1->mePaperFormat == pData2->mePaperFormat) &&
(pData1->mnPaperWidth == pData2->mnPaperWidth) &&
@@ -337,6 +340,7 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup )
pJobData->mnSystem = SVBT16ToShort( pOldJobData->nSystem );
pJobData->mnDriverDataLen = SVBT32ToUInt32( pOldJobData->nDriverDataLen );
pJobData->meOrientation = (Orientation)SVBT16ToShort( pOldJobData->nOrientation );
+ pJobData->meDuplexMode = DUPLEX_UNKNOWN;
pJobData->mnPaperBin = SVBT16ToShort( pOldJobData->nPaperBin );
pJobData->mePaperFormat = (Paper)SVBT16ToShort( pOldJobData->nPaperFormat );
pJobData->mnPaperWidth = (long)SVBT32ToUInt32( pOldJobData->nPaperWidth );
@@ -355,7 +359,19 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup )
String aKey, aValue;
rIStream.ReadByteString( aKey, RTL_TEXTENCODING_UTF8 );
rIStream.ReadByteString( aValue, RTL_TEXTENCODING_UTF8 );
- pJobData->maValueMap[ aKey ] = aValue;
+ if( aKey.EqualsAscii( "COMPAT_DUPLEX_MODE" ) )
+ {
+ if( aValue.EqualsAscii( "DUPLEX_UNKNOWN" ) )
+ pJobData->meDuplexMode = DUPLEX_UNKNOWN;
+ else if( aValue.EqualsAscii( "DUPLEX_OFF" ) )
+ pJobData->meDuplexMode = DUPLEX_OFF;
+ else if( aValue.EqualsAscii( "DUPLEX_SHORTEDGE" ) )
+ pJobData->meDuplexMode = DUPLEX_SHORTEDGE;
+ else if( aValue.EqualsAscii( "DUPLEX_LONGEDGE" ) )
+ pJobData->meDuplexMode = DUPLEX_LONGEDGE;
+ }
+ else
+ pJobData->maValueMap[ aKey ] = aValue;
}
DBG_ASSERT( rIStream.Tell() == nFirstPos+nLen, "corrupted job setup" );
// ensure correct stream position
@@ -421,6 +437,14 @@ SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup )
rOStream.WriteByteString( it->first, RTL_TEXTENCODING_UTF8 );
rOStream.WriteByteString( it->second, RTL_TEXTENCODING_UTF8 );
}
+ rOStream.WriteByteString( "COMPAT_DUPLEX_MODE" ) ;
+ switch( pJobData->meDuplexMode )
+ {
+ case DUPLEX_UNKNOWN: rOStream.WriteByteString( "DUPLEX_UNKNOWN" );break;
+ case DUPLEX_OFF: rOStream.WriteByteString( "DUPLEX_OFF" );break;
+ 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);
rOStream.Seek( nPos );
rOStream << nLen;
diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk
index eda537bf629a..ed2a9b2ba1e1 100755..100644
--- a/vcl/source/gdi/makefile.mk
+++ b/vcl/source/gdi/makefile.mk
@@ -57,6 +57,8 @@ EXCEPTIONSFILES= $(SLO)$/salmisc.obj \
$(SLO)$/gfxlink.obj \
$(SLO)$/print.obj \
$(SLO)$/print2.obj \
+ $(SLO)$/print3.obj \
+ $(SLO)$/oldprintadaptor.obj \
$(SLO)$/configsettings.obj \
$(SLO)$/sallayout.obj \
$(SLO)$/image.obj \
@@ -72,7 +74,6 @@ EXCEPTIONSFILES= $(SLO)$/salmisc.obj \
$(SLO)$/pngread.obj \
$(SLO)$/pngwrite.obj \
$(SLO)$/virdev.obj \
- $(SLO)$/impprn.obj \
$(SLO)$/gdimtf.obj \
$(SLO)$/graphictools.obj \
$(SLO)$/textlayout.obj \
@@ -118,6 +119,7 @@ SLOFILES= $(EXCEPTIONSFILES) \
$(SLO)$/extoutdevdata.obj \
$(SLO)$/salnativewidgets-none.obj
+
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx
new file mode 100644
index 000000000000..cffd11daaad6
--- /dev/null
+++ b/vcl/source/gdi/oldprintadaptor.cxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_vcl.hxx"
+
+#include "vcl/oldprintadaptor.hxx"
+#include "vcl/gdimtf.hxx"
+
+#include "com/sun/star/awt/Size.hpp"
+
+#include <vector>
+
+namespace vcl
+{
+ struct AdaptorPage
+ {
+ GDIMetaFile maPage;
+ com::sun::star::awt::Size maPageSize;
+ };
+
+ struct ImplOldStyleAdaptorData
+ {
+ std::vector< AdaptorPage > maPages;
+ };
+}
+
+using namespace vcl;
+using namespace cppu;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+
+OldStylePrintAdaptor::OldStylePrintAdaptor( const boost::shared_ptr< Printer >& i_pPrinter )
+ : PrinterController( i_pPrinter )
+ , mpData( new ImplOldStyleAdaptorData() )
+{
+}
+
+OldStylePrintAdaptor::~OldStylePrintAdaptor()
+{
+}
+
+void OldStylePrintAdaptor::StartPage()
+{
+ Size aPaperSize( getPrinter()->PixelToLogic( getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
+ mpData->maPages.push_back( AdaptorPage() );
+ mpData->maPages.back().maPageSize.Width = aPaperSize.getWidth();
+ mpData->maPages.back().maPageSize.Height = aPaperSize.getHeight();
+ getPrinter()->SetConnectMetaFile( &mpData->maPages.back().maPage );
+
+ // copy state into metafile
+ boost::shared_ptr<Printer> pPrinter( getPrinter() );
+ pPrinter->SetMapMode( pPrinter->GetMapMode() );
+ pPrinter->SetFont( pPrinter->GetFont() );
+ pPrinter->SetDrawMode( pPrinter->GetDrawMode() );
+ pPrinter->SetLineColor( pPrinter->GetLineColor() );
+ pPrinter->SetFillColor( pPrinter->GetFillColor() );
+}
+
+void OldStylePrintAdaptor::EndPage()
+{
+ getPrinter()->SetConnectMetaFile( NULL );
+ mpData->maPages.back().maPage.WindStart();
+}
+
+int OldStylePrintAdaptor::getPageCount() const
+{
+ return int(mpData->maPages.size());
+}
+
+Sequence< PropertyValue > OldStylePrintAdaptor::getPageParameters( int i_nPage ) const
+{
+ Sequence< PropertyValue > aRet( 1 );
+ aRet[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageSize") );
+ if( i_nPage < int(mpData->maPages.size() ) )
+ aRet[0].Value = makeAny( mpData->maPages[i_nPage].maPageSize );
+ else
+ {
+ awt::Size aEmpty( 0, 0 );
+ aRet[0].Value = makeAny( aEmpty );
+ }
+ return aRet;
+}
+
+void OldStylePrintAdaptor::printPage( int i_nPage ) const
+{
+ if( i_nPage < int(mpData->maPages.size()) )
+ {
+ mpData->maPages[ i_nPage ].maPage.WindStart();
+ mpData->maPages[ i_nPage ].maPage.Play( getPrinter().get() );
+ }
+}
+
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 51aad0790a26..28fa4f8f5461 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -5601,6 +5601,8 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const String& rStr,
if ( !IsDeviceOutputNecessary() )
return;
+ if( !mpGraphics && !ImplGetGraphics() )
+ return;
if( mbInitClipRegion )
ImplInitClipRegion();
if( mbOutputClipped )
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index c0205f1f325d..d42e736960d2 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2814,37 +2814,6 @@ sal_Int32 PDFWriterImpl::emitBuiltinFont( const ImplFontData* pFont, sal_Int32 n
return nFontObject;
}
-typedef int ThreeInts[3];
-static bool getPfbSegmentLengths( const unsigned char* pFontBytes, int nByteLen,
- ThreeInts& rSegmentLengths )
-{
- if( !pFontBytes || (nByteLen < 0) )
- return false;
- const unsigned char* pPtr = pFontBytes;
- const unsigned char* pEnd = pFontBytes + nByteLen;
-
- for( int i = 0; i < 3; ++i) {
- // read segment1 header
- if( pPtr+6 >= pEnd )
- return false;
- if( (pPtr[0] != 0x80) || (pPtr[1] >= 0x03) )
- return false;
- const int nLen = (pPtr[5]<<24) + (pPtr[4]<<16) + (pPtr[3]<<8) + pPtr[2];
- if( nLen <= 0)
- return false;
- rSegmentLengths[i] = nLen;
- pPtr += nLen + 6;
- }
-
- // read segment-end header
- if( pPtr+2 >= pEnd )
- return false;
- if( (pPtr[0] != 0x80) || (pPtr[1] != 0x03) )
- return false;
-
- return true;
-}
-
std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontData* pFont, EmbedFont& rEmbed )
{
std::map< sal_Int32, sal_Int32 > aRet;
@@ -2960,6 +2929,41 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontDa
return aRet;
}
+typedef int ThreeInts[3];
+static bool getPfbSegmentLengths( const unsigned char* pFontBytes, int nByteLen,
+ ThreeInts& rSegmentLengths )
+{
+ if( !pFontBytes || (nByteLen < 0) )
+ return false;
+ const unsigned char* pPtr = pFontBytes;
+ const unsigned char* pEnd = pFontBytes + nByteLen;
+
+ for( int i = 0; i < 3; ++i) {
+ // read segment1 header
+ if( pPtr+6 >= pEnd )
+ return false;
+ if( (pPtr[0] != 0x80) || (pPtr[1] >= 0x03) )
+ return false;
+ const int nLen = (pPtr[5]<<24) + (pPtr[4]<<16) + (pPtr[3]<<8) + pPtr[2];
+ if( nLen <= 0)
+ return false;
+ rSegmentLengths[i] = nLen;
+ pPtr += nLen + 6;
+ }
+
+ // read segment-end header
+ if( pPtr+2 >= pEnd )
+ return false;
+ if( (pPtr[0] != 0x80) || (pPtr[1] != 0x03) )
+ return false;
+
+ return true;
+}
+
+struct FontException : public std::exception
+{
+};
+
// TODO: always subset instead of embedding the full font => this method becomes obsolete then
std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFontData* pFont, EmbedFont& rEmbed )
{
@@ -2979,10 +2983,16 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont
sal_Int32 nToUnicodeStream = 0;
sal_uInt8 nEncoding[256];
sal_Ucs nEncodedCodes[256];
+ std::vector<sal_Ucs> aUnicodes;
+ aUnicodes.reserve( 256 );
+ sal_Int32 pUnicodesPerGlyph[256];
+ sal_Int32 pEncToUnicodeIndex[256];
if( pEncoding )
{
- memset( nEncodedCodes, 0, sizeof(nEncodedCodes) );
- memset( nEncoding, 0, sizeof(nEncoding) );
+ rtl_zeroMemory( nEncoding, sizeof(nEncoding) );
+ rtl_zeroMemory( nEncodedCodes, sizeof(nEncodedCodes) );
+ rtl_zeroMemory( pUnicodesPerGlyph, sizeof(pUnicodesPerGlyph) );
+ rtl_zeroMemory( pEncToUnicodeIndex, sizeof(pEncToUnicodeIndex) );
for( Ucs2SIntMap::const_iterator it = pEncoding->begin(); it != pEncoding->end(); ++it )
{
if( it->second != -1 )
@@ -2990,6 +3000,9 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont
sal_Int32 nCode = (sal_Int32)(it->second & 0x000000ff);
nEncoding[ nCode ] = static_cast<sal_uInt8>( nCode );
nEncodedCodes[ nCode ] = it->first;
+ pEncToUnicodeIndex[ nCode ] = static_cast<sal_Int32>(aUnicodes.size());
+ aUnicodes.push_back( it->first );
+ pUnicodesPerGlyph[ nCode ] = 1;
}
}
}
@@ -2999,553 +3012,525 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont
const unsigned char* pFontData = NULL;
long nFontLen = 0;
sal_Int32 nLength1, nLength2;
- if( (pFontData = (const unsigned char*)m_pReferenceDevice->mpGraphics->GetEmbedFontData( pFont, nEncodedCodes, pWidths, aInfo, &nFontLen )) != NULL )
- {
- if( (aInfo.m_nFontType & FontSubsetInfo::ANY_TYPE1) == 0 )
- goto streamend;
- // see whether it is pfb or pfa; if it is a pfb, fill ranges
- // of 6 bytes that are not part of the font program
- std::list< int > aSections;
- std::list< int >::const_iterator it;
- int nIndex = 0;
- while( pFontData[nIndex] == 0x80 && nIndex < nFontLen-1 )
- {
- aSections.push_back( nIndex );
- if( pFontData[nIndex+1] == 0x03 )
- break;
- sal_Int32 nBytes =
+ try
+ {
+ if( (pFontData = (const unsigned char*)m_pReferenceDevice->mpGraphics->GetEmbedFontData( pFont, nEncodedCodes, pWidths, aInfo, &nFontLen )) != NULL )
+ {
+ if( (aInfo.m_nFontType & FontSubsetInfo::ANY_TYPE1) == 0 )
+ throw FontException();
+ // see whether it is pfb or pfa; if it is a pfb, fill ranges
+ // of 6 bytes that are not part of the font program
+ std::list< int > aSections;
+ std::list< int >::const_iterator it;
+ int nIndex = 0;
+ while( pFontData[nIndex] == 0x80 && nIndex < nFontLen-1 )
+ {
+ aSections.push_back( nIndex );
+ if( pFontData[nIndex+1] == 0x03 )
+ break;
+ sal_Int32 nBytes =
((sal_Int32)pFontData[nIndex+2]) |
((sal_Int32)pFontData[nIndex+3]) << 8 |
((sal_Int32)pFontData[nIndex+4]) << 16 |
((sal_Int32)pFontData[nIndex+5]) << 24;
- nIndex += nBytes+6;
- }
-
- // search for eexec
- // TODO: use getPfbSegmentLengths() if possible to skip the search thingies below
- nIndex = 0;
- int nEndAsciiIndex;
- int nBeginBinaryIndex;
- int nEndBinaryIndex;
- do
- {
- while( nIndex < nFontLen-4 &&
- ( pFontData[nIndex] != 'e' ||
- pFontData[nIndex+1] != 'e' ||
- pFontData[nIndex+2] != 'x' ||
- pFontData[nIndex+3] != 'e' ||
- pFontData[nIndex+4] != 'c'
- )
- )
- nIndex++;
- // check whether we are in a excluded section
- for( it = aSections.begin(); it != aSections.end() && (nIndex < *it || nIndex > ((*it) + 5) ); ++it )
- ;
- } while( it != aSections.end() && nIndex < nFontLen-4 );
- // this should end the ascii part
- if( nIndex > nFontLen-5 )
- goto streamend;
-
- nEndAsciiIndex = nIndex+4;
- // now count backwards until we can account for 512 '0'
- // which is the endmarker of the (hopefully) binary data
- // do not count the pfb header sections
- int nFound = 0;
- nIndex = nFontLen-1;
- while( nIndex > 0 && nFound < 512 )
- {
- for( it = aSections.begin(); it != aSections.end() && (nIndex < *it || nIndex > ((*it) + 5) ); ++it )
- ;
- if( it == aSections.end() )
- {
- // inside the 512 '0' block there may only be whitespace
- // according to T1 spec; probably it would be to simple
- // if all fonts complied
- if( pFontData[nIndex] == '0' )
- nFound++;
- else if( nFound > 0 &&
- pFontData[nIndex] != '\r' &&
- pFontData[nIndex] != '\t' &&
- pFontData[nIndex] != '\n' &&
- pFontData[nIndex] != ' ' )
- break;
+ nIndex += nBytes+6;
}
- nIndex--;
- }
-
- if( nIndex < 1 || nIndex <= nEndAsciiIndex )
- goto streamend;
- // there may be whitespace to ignore before the 512 '0'
- while( pFontData[nIndex] == '\r' || pFontData[nIndex] == '\n' )
- {
- nIndex--;
- for( it = aSections.begin(); it != aSections.end() && (nIndex < *it || nIndex > ((*it) + 5) ); ++it )
- ;
- if( it != aSections.end() )
- {
- nIndex = (*it)-1;
- break; // this is surely a binary boundary, in ascii case it wouldn't matter
- }
- }
- nEndBinaryIndex = nIndex;
- // and count forward again to the point where we have nFound '0'
- // to get the corect value for nLength3
- sal_Int32 nLength3 = 0;
- sal_Int32 nL3Index = nIndex;
- while( nFound && nL3Index < nFontLen )
- {
- for( it = aSections.begin(); it != aSections.end() && (nL3Index < *it || nL3Index > ((*it) + 5) ); ++it )
- ;
- if( it == aSections.end() )
+ // search for eexec
+ // TODO: use getPfbSegmentLengths() if possible to skip the search thingies below
+ nIndex = 0;
+ int nEndAsciiIndex;
+ int nBeginBinaryIndex;
+ int nEndBinaryIndex;
+ do
{
- // inside the 512 '0' block there may only be whitespace
- // according to T1 spec; probably it would be to simple
- // if all fonts complied
- if( pFontData[nL3Index] == '0' )
- nFound--;
- nLength3++;
- }
- nL3Index++;
- }
-
- // search for beginning of binary section
- nBeginBinaryIndex = nEndAsciiIndex;
- do
- {
- nBeginBinaryIndex++;
- for( it = aSections.begin(); it != aSections.end() && (nBeginBinaryIndex < *it || nBeginBinaryIndex > ((*it) + 5) ); ++it )
- ;
- } while( nBeginBinaryIndex < nEndBinaryIndex &&
- ( pFontData[nBeginBinaryIndex] == '\r' ||
- pFontData[nBeginBinaryIndex] == '\n' ||
- it != aSections.end() ) );
-
- // it seems to be vital to copy the exact whitespace between binary data
- // and eexec, else a invalid font results. so make nEndAsciiIndex
- // always immediate in front of nBeginBinaryIndex
- nEndAsciiIndex = nBeginBinaryIndex-1;
- for( it = aSections.begin(); it != aSections.end() && (nEndAsciiIndex < *it || nEndAsciiIndex > ((*it)+5)); ++it )
- ;
- if( it != aSections.end() )
- nEndAsciiIndex = (*it)-1;
-
- nLength1 = nEndAsciiIndex+1; // including the last character
- for( it = aSections.begin(); it != aSections.end() && *it < nEndAsciiIndex; ++it )
- nLength1 -= 6; // decrease by pfb section size
-
- // if the first four bytes are all ascii hex characters, then binary data
- // has to be converted to real binary data
- for( nIndex = 0; nIndex < 4 &&
- ( ( pFontData[ nBeginBinaryIndex+nIndex ] >= '0' && pFontData[ nBeginBinaryIndex+nIndex ] <= '9' ) ||
- ( pFontData[ nBeginBinaryIndex+nIndex ] >= 'a' && pFontData[ nBeginBinaryIndex+nIndex ] <= 'f' ) ||
- ( pFontData[ nBeginBinaryIndex+nIndex ] >= 'A' && pFontData[ nBeginBinaryIndex+nIndex ] <= 'F' )
- ); ++nIndex )
- ;
- bool bConvertHexData = true;
- if( nIndex < 4 )
- {
- bConvertHexData = false;
- nLength2 = nEndBinaryIndex - nBeginBinaryIndex + 1; // include the last byte
- for( it = aSections.begin(); it != aSections.end(); ++it )
- if( *it > nBeginBinaryIndex && *it < nEndBinaryIndex )
- nLength2 -= 6;
- }
- else
- {
- // count the hex ascii characters to get nLength2
- nLength2 = 0;
- int nNextSectionIndex = 0;
- for( it = aSections.begin(); it != aSections.end() && *it < nBeginBinaryIndex; ++it )
- ;
- if( it != aSections.end() )
- nNextSectionIndex = *it;
- for( nIndex = nBeginBinaryIndex; nIndex <= nEndBinaryIndex; nIndex++ )
+ while( nIndex < nFontLen-4 &&
+ ( pFontData[nIndex] != 'e' ||
+ pFontData[nIndex+1] != 'e' ||
+ pFontData[nIndex+2] != 'x' ||
+ pFontData[nIndex+3] != 'e' ||
+ pFontData[nIndex+4] != 'c'
+ )
+ )
+ nIndex++;
+ // check whether we are in a excluded section
+ for( it = aSections.begin(); it != aSections.end() && (nIndex < *it || nIndex > ((*it) + 5) ); ++it )
+ ;
+ } while( it != aSections.end() && nIndex < nFontLen-4 );
+ // this should end the ascii part
+ if( nIndex > nFontLen-5 )
+ throw FontException();
+
+ nEndAsciiIndex = nIndex+4;
+ // now count backwards until we can account for 512 '0'
+ // which is the endmarker of the (hopefully) binary data
+ // do not count the pfb header sections
+ int nFound = 0;
+ nIndex = nFontLen-1;
+ while( nIndex > 0 && nFound < 512 )
{
- if( nIndex == nNextSectionIndex )
+ for( it = aSections.begin(); it != aSections.end() && (nIndex < *it || nIndex > ((*it) + 5) ); ++it )
+ ;
+ if( it == aSections.end() )
{
- nIndex += 6;
- ++it;
- nNextSectionIndex = (it == aSections.end() ? 0 : *it );
+ // inside the 512 '0' block there may only be whitespace
+ // according to T1 spec; probably it would be to simple
+ // if all fonts complied
+ if( pFontData[nIndex] == '0' )
+ nFound++;
+ else if( nFound > 0 &&
+ pFontData[nIndex] != '\r' &&
+ pFontData[nIndex] != '\t' &&
+ pFontData[nIndex] != '\n' &&
+ pFontData[nIndex] != ' ' )
+ break;
}
- if( ( pFontData[ nIndex ] >= '0' && pFontData[ nIndex ] <= '9' ) ||
- ( pFontData[ nIndex ] >= 'a' && pFontData[ nIndex ] <= 'f' ) ||
- ( pFontData[ nIndex ] >= 'A' && pFontData[ nIndex ] <= 'F' ) )
- nLength2++;
+ nIndex--;
}
- DBG_ASSERT( !(nLength2 & 1), "uneven number of hex chars in binary pfa section" );
- nLength2 /= 2;
- }
-
- // now we can actually write the font stream !
-#if OSL_DEBUG_LEVEL > 1
- {
- OStringBuffer aLine( " PDFWriterImpl::emitEmbeddedFont" );
- emitComment( aLine.getStr() );
- }
-#endif
- OStringBuffer aLine( 512 );
- nStreamObject = createObject();
- if( !updateObject(nStreamObject))
- goto streamend;
- sal_Int32 nStreamLengthObject = createObject();
- aLine.append( nStreamObject );
- aLine.append( " 0 obj\n"
- "<</Length " );
- aLine.append( nStreamLengthObject );
- aLine.append( " 0 R"
-#ifndef DEBUG_DISABLE_PDFCOMPRESSION
- "/Filter/FlateDecode"
-#endif
- "/Length1 " );
- aLine.append( nLength1 );
- aLine.append( " /Length2 " );
- aLine.append( nLength2 );
- aLine.append( " /Length3 ");
- aLine.append( nLength3 );
- aLine.append( ">>\n"
- "stream\n" );
- if( !writeBuffer( aLine.getStr(), aLine.getLength() ) )
- goto streamend;
- sal_uInt64 nBeginStreamPos = 0;
- osl_getFilePos( m_aFile, &nBeginStreamPos );
+ if( nIndex < 1 || nIndex <= nEndAsciiIndex )
+ throw FontException();
- beginCompression();
- checkAndEnableStreamEncryption( nStreamObject );
-
- // write ascii section
- if( aSections.begin() == aSections.end() )
- {
- if( ! writeBuffer( pFontData, nEndAsciiIndex+1 ) )
- {
- endCompression();
- disableStreamEncryption();
- goto streamend;
- }
- }
- else
- {
- // first section always starts at 0
- it = aSections.begin();
- nIndex = (*it)+6;
- ++it;
- while( *it < nEndAsciiIndex )
+ // nLength3 is the rest of the file - excluding any section headers
+ // nIndex now points to the first of the 512 '0' characters marking the
+ // fixed content portion
+ sal_Int32 nLength3 = nFontLen - nIndex;
+ for( it = aSections.begin(); it != aSections.end(); ++it )
{
- if( ! writeBuffer( pFontData+nIndex, (*it)-nIndex ) )
+ if( *it >= nIndex )
{
- endCompression();
- disableStreamEncryption();
- goto streamend;
+ // special case: nIndex inside a section marker
+ if( nIndex >= (*it) && (*it)+5 > nIndex )
+ nLength3 -= (*it)+5 - nIndex;
+ else
+ {
+ if( *it < nFontLen - 6 )
+ nLength3 -= 6;
+ else // the last section 0x8003 is only 2 bytes after all
+ nLength3 -= (nFontLen - *it);
+ }
}
- nIndex = (*it)+6;
- ++it;
}
- // write partial last section
- if( ! writeBuffer( pFontData+nIndex, nEndAsciiIndex-nIndex+1 ) )
- {
- endCompression();
- disableStreamEncryption();
- goto streamend;
- }
- }
- // write binary section
- if( ! bConvertHexData )
- {
- if( aSections.begin() == aSections.end() )
+ // there may be whitespace to ignore before the 512 '0'
+ while( pFontData[nIndex] == '\r' || pFontData[nIndex] == '\n' )
{
- if( ! writeBuffer( pFontData+nBeginBinaryIndex, nFontLen-nBeginBinaryIndex ) )
+ nIndex--;
+ for( it = aSections.begin(); it != aSections.end() && (nIndex < *it || nIndex > ((*it) + 5) ); ++it )
+ ;
+ if( it != aSections.end() )
{
- endCompression();
- disableStreamEncryption();
- goto streamend;
+ nIndex = (*it)-1;
+ break; // this is surely a binary boundary, in ascii case it wouldn't matter
}
}
- else
+ nEndBinaryIndex = nIndex;
+
+ // search for beginning of binary section
+ nBeginBinaryIndex = nEndAsciiIndex;
+ do
{
- for( it = aSections.begin(); *it < nBeginBinaryIndex; ++it )
+ nBeginBinaryIndex++;
+ for( it = aSections.begin(); it != aSections.end() && (nBeginBinaryIndex < *it || nBeginBinaryIndex > ((*it) + 5) ); ++it )
;
- // write first partial section
- if( ! writeBuffer( pFontData+nBeginBinaryIndex, (*it) - nBeginBinaryIndex ) )
- {
- endCompression();
- disableStreamEncryption();
- goto streamend;
- }
- // write following sections
- while( it != aSections.end() )
- {
- nIndex = (*it)+6;
- ++it;
- if( nIndex < nFontLen ) // last section marker is usually the EOF which has only 2 bytes
+ } while( nBeginBinaryIndex < nEndBinaryIndex &&
+ ( pFontData[nBeginBinaryIndex] == '\r' ||
+ pFontData[nBeginBinaryIndex] == '\n' ||
+ it != aSections.end() ) );
+
+ // it seems to be vital to copy the exact whitespace between binary data
+ // and eexec, else a invalid font results. so make nEndAsciiIndex
+ // always immediate in front of nBeginBinaryIndex
+ nEndAsciiIndex = nBeginBinaryIndex-1;
+ for( it = aSections.begin(); it != aSections.end() && (nEndAsciiIndex < *it || nEndAsciiIndex > ((*it)+5)); ++it )
+ ;
+ if( it != aSections.end() )
+ nEndAsciiIndex = (*it)-1;
+
+ nLength1 = nEndAsciiIndex+1; // including the last character
+ for( it = aSections.begin(); it != aSections.end() && *it < nEndAsciiIndex; ++it )
+ nLength1 -= 6; // decrease by pfb section size
+
+ // if the first four bytes are all ascii hex characters, then binary data
+ // has to be converted to real binary data
+ for( nIndex = 0; nIndex < 4 &&
+ ( ( pFontData[ nBeginBinaryIndex+nIndex ] >= '0' && pFontData[ nBeginBinaryIndex+nIndex ] <= '9' ) ||
+ ( pFontData[ nBeginBinaryIndex+nIndex ] >= 'a' && pFontData[ nBeginBinaryIndex+nIndex ] <= 'f' ) ||
+ ( pFontData[ nBeginBinaryIndex+nIndex ] >= 'A' && pFontData[ nBeginBinaryIndex+nIndex ] <= 'F' )
+ ); ++nIndex )
+ ;
+ bool bConvertHexData = true;
+ if( nIndex < 4 )
+ {
+ bConvertHexData = false;
+ nLength2 = nEndBinaryIndex - nBeginBinaryIndex + 1; // include the last byte
+ for( it = aSections.begin(); it != aSections.end(); ++it )
+ if( *it > nBeginBinaryIndex && *it < nEndBinaryIndex )
+ nLength2 -= 6;
+ }
+ else
{
- sal_Int32 nSectionLen = (it == aSections.end()) ? nFontLen - nIndex : (*it) - nIndex;
- if( ! writeBuffer( pFontData+nIndex, nSectionLen ) )
+ // count the hex ascii characters to get nLength2
+ nLength2 = 0;
+ int nNextSectionIndex = 0;
+ for( it = aSections.begin(); it != aSections.end() && *it < nBeginBinaryIndex; ++it )
+ ;
+ if( it != aSections.end() )
+ nNextSectionIndex = *it;
+ for( nIndex = nBeginBinaryIndex; nIndex <= nEndBinaryIndex; nIndex++ )
{
- endCompression();
- disableStreamEncryption();
- goto streamend;
+ if( nIndex == nNextSectionIndex )
+ {
+ nIndex += 6;
+ ++it;
+ nNextSectionIndex = (it == aSections.end() ? 0 : *it );
+ }
+ if( ( pFontData[ nIndex ] >= '0' && pFontData[ nIndex ] <= '9' ) ||
+ ( pFontData[ nIndex ] >= 'a' && pFontData[ nIndex ] <= 'f' ) ||
+ ( pFontData[ nIndex ] >= 'A' && pFontData[ nIndex ] <= 'F' ) )
+ nLength2++;
}
+ DBG_ASSERT( !(nLength2 & 1), "uneven number of hex chars in binary pfa section" );
+ nLength2 /= 2;
}
- }
- }
- }
- else
- {
- unsigned char* pWriteBuffer = (unsigned char*)rtl_allocateMemory( nLength2 );
- memset( pWriteBuffer, 0, nLength2 );
- int nWriteIndex = 0;
-
- int nNextSectionIndex = 0;
- for( it = aSections.begin(); it != aSections.end() && *it < nBeginBinaryIndex; ++it )
- ;
- if( it != aSections.end() )
- nNextSectionIndex = *it;
- for( nIndex = nBeginBinaryIndex; nIndex <= nEndBinaryIndex; nIndex++ )
- {
- if( nIndex == nNextSectionIndex )
- {
- nIndex += 6;
- ++it;
- nNextSectionIndex = (it == aSections.end() ? nFontLen : *it );
- }
- unsigned char cNibble = 0x80;
- if( pFontData[ nIndex ] >= '0' && pFontData[ nIndex ] <= '9' )
- cNibble = pFontData[nIndex] - '0';
- else if( pFontData[ nIndex ] >= 'a' && pFontData[ nIndex ] <= 'f' )
- cNibble = pFontData[nIndex] - 'a' + 10;
- else if( pFontData[ nIndex ] >= 'A' && pFontData[ nIndex ] <= 'F' )
- cNibble = pFontData[nIndex] - 'A' + 10;
- if( cNibble != 0x80 )
- {
- if( !(nWriteIndex & 1 ) )
- cNibble <<= 4;
- pWriteBuffer[ nWriteIndex/2 ] |= cNibble;
- nWriteIndex++;
- }
- }
- if( ! writeBuffer( pWriteBuffer, nLength2 ) )
- {
- endCompression();
- disableStreamEncryption();
- goto streamend;
- }
- rtl_freeMemory( pWriteBuffer );
- if( aSections.empty() )
- {
- if( ! writeBuffer( pFontData+nIndex, nFontLen-nIndex ) )
- {
- endCompression();
- disableStreamEncryption();
- goto streamend;
- }
- }
- else
- {
- // write rest of this section
- if( nIndex < nNextSectionIndex )
- {
- if( ! writeBuffer( pFontData+nIndex, nNextSectionIndex - nIndex ) )
+ // now we can actually write the font stream !
+ #if OSL_DEBUG_LEVEL > 1
{
- endCompression();
- disableStreamEncryption();
- goto streamend;
+ OStringBuffer aLine( " PDFWriterImpl::emitEmbeddedFont" );
+ emitComment( aLine.getStr() );
}
- }
- // write following sections
- while( it != aSections.end() )
- {
- nIndex = (*it)+6;
- ++it;
- if( nIndex < nFontLen ) // last section marker is usually the EOF which has only 2 bytes
+ #endif
+ OStringBuffer aLine( 512 );
+ nStreamObject = createObject();
+ if( !updateObject(nStreamObject))
+ throw FontException();
+ sal_Int32 nStreamLengthObject = createObject();
+ aLine.append( nStreamObject );
+ aLine.append( " 0 obj\n"
+ "<</Length " );
+ aLine.append( nStreamLengthObject );
+ aLine.append( " 0 R"
+ #ifndef DEBUG_DISABLE_PDFCOMPRESSION
+ "/Filter/FlateDecode"
+ #endif
+ "/Length1 " );
+ aLine.append( nLength1 );
+ aLine.append( " /Length2 " );
+ aLine.append( nLength2 );
+ aLine.append( " /Length3 ");
+ aLine.append( nLength3 );
+ aLine.append( ">>\n"
+ "stream\n" );
+ if( !writeBuffer( aLine.getStr(), aLine.getLength() ) )
+ throw FontException();
+
+ sal_uInt64 nBeginStreamPos = 0;
+ osl_getFilePos( m_aFile, &nBeginStreamPos );
+
+ beginCompression();
+ checkAndEnableStreamEncryption( nStreamObject );
+
+ // write ascii section
+ if( aSections.begin() == aSections.end() )
+ {
+ if( ! writeBuffer( pFontData, nEndAsciiIndex+1 ) )
+ throw FontException();
+ }
+ else
{
- sal_Int32 nSectionLen = (it == aSections.end()) ? nFontLen - nIndex : (*it) - nIndex;
- if( ! writeBuffer( pFontData+nIndex, nSectionLen ) )
+ // first section always starts at 0
+ it = aSections.begin();
+ nIndex = (*it)+6;
+ ++it;
+ while( *it < nEndAsciiIndex )
{
- endCompression();
- disableStreamEncryption();
- goto streamend;
+ if( ! writeBuffer( pFontData+nIndex, (*it)-nIndex ) )
+ throw FontException();
+ nIndex = (*it)+6;
+ ++it;
}
+ // write partial last section
+ if( ! writeBuffer( pFontData+nIndex, nEndAsciiIndex-nIndex+1 ) )
+ throw FontException();
}
- }
- }
- }
- endCompression();
- disableStreamEncryption();
-
-
- sal_uInt64 nEndStreamPos = 0;
- osl_getFilePos( m_aFile, &nEndStreamPos );
- // and finally close the stream
- aLine.setLength( 0 );
- aLine.append( "\nendstream\nendobj\n\n" );
- if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) )
- goto streamend;
+ // write binary section
+ if( ! bConvertHexData )
+ {
+ if( aSections.begin() == aSections.end() )
+ {
+ if( ! writeBuffer( pFontData+nBeginBinaryIndex, nFontLen-nBeginBinaryIndex ) )
+ throw FontException();
+ }
+ else
+ {
+ for( it = aSections.begin(); *it < nBeginBinaryIndex; ++it )
+ ;
+ // write first partial section
+ if( ! writeBuffer( pFontData+nBeginBinaryIndex, (*it) - nBeginBinaryIndex ) )
+ throw FontException();
+ // write following sections
+ while( it != aSections.end() )
+ {
+ nIndex = (*it)+6;
+ ++it;
+ if( nIndex < nFontLen ) // last section marker is usually the EOF which has only 2 bytes
+ {
+ sal_Int32 nSectionLen = (it == aSections.end()) ? nFontLen - nIndex : (*it) - nIndex;
+ if( ! writeBuffer( pFontData+nIndex, nSectionLen ) )
+ throw FontException();
+ }
+ }
+ }
+ }
+ else
+ {
+ boost::shared_array<unsigned char> pWriteBuffer( new unsigned char[ nLength2 ] );
+ rtl_zeroMemory( pWriteBuffer.get(), nLength2 );
+ int nWriteIndex = 0;
+
+ int nNextSectionIndex = 0;
+ for( it = aSections.begin(); it != aSections.end() && *it < nBeginBinaryIndex; ++it )
+ ;
+ if( it != aSections.end() )
+ nNextSectionIndex = *it;
+ for( nIndex = nBeginBinaryIndex; nIndex <= nEndBinaryIndex; nIndex++ )
+ {
+ if( nIndex == nNextSectionIndex )
+ {
+ nIndex += 6;
+ ++it;
+ nNextSectionIndex = (it == aSections.end() ? nFontLen : *it );
+ }
+ unsigned char cNibble = 0x80;
+ if( pFontData[ nIndex ] >= '0' && pFontData[ nIndex ] <= '9' )
+ cNibble = pFontData[nIndex] - '0';
+ else if( pFontData[ nIndex ] >= 'a' && pFontData[ nIndex ] <= 'f' )
+ cNibble = pFontData[nIndex] - 'a' + 10;
+ else if( pFontData[ nIndex ] >= 'A' && pFontData[ nIndex ] <= 'F' )
+ cNibble = pFontData[nIndex] - 'A' + 10;
+ if( cNibble != 0x80 )
+ {
+ if( !(nWriteIndex & 1 ) )
+ cNibble <<= 4;
+ pWriteBuffer.get()[ nWriteIndex/2 ] |= cNibble;
+ nWriteIndex++;
+ }
+ }
+ if( ! writeBuffer( pWriteBuffer.get(), nLength2 ) )
+ throw FontException();
+ if( aSections.empty() )
+ {
+ if( ! writeBuffer( pFontData+nIndex, nFontLen-nIndex ) )
+ throw FontException();
+ }
+ else
+ {
+ // write rest of this section
+ if( nIndex < nNextSectionIndex )
+ {
+ if( ! writeBuffer( pFontData+nIndex, nNextSectionIndex - nIndex ) )
+ throw FontException();
+ }
+ // write following sections
+ while( it != aSections.end() )
+ {
+ nIndex = (*it)+6;
+ ++it;
+ if( nIndex < nFontLen ) // last section marker is usually the EOF which has only 2 bytes
+ {
+ sal_Int32 nSectionLen = (it == aSections.end()) ? nFontLen - nIndex : (*it) - nIndex;
+ if( ! writeBuffer( pFontData+nIndex, nSectionLen ) )
+ throw FontException();
+ }
+ }
+ }
+ }
+ endCompression();
+ disableStreamEncryption();
- // write stream length object
- aLine.setLength( 0 );
- if( ! updateObject( nStreamLengthObject ) )
- goto streamend;
- aLine.append( nStreamLengthObject );
- aLine.append( " 0 obj\n" );
- aLine.append( (sal_Int64)(nEndStreamPos-nBeginStreamPos ) );
- aLine.append( "\nendobj\n\n" );
- if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) )
- goto streamend;
- }
- else
- {
- rtl::OStringBuffer aErrorComment( 256 );
- aErrorComment.append( "GetEmbedFontData failed for font \"" );
- aErrorComment.append( OUStringToOString( pFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 ) );
- aErrorComment.append( '\"' );
- if( pFont->GetSlant() == ITALIC_NORMAL )
- aErrorComment.append( " italic" );
- else if( pFont->GetSlant() == ITALIC_OBLIQUE )
- aErrorComment.append( " oblique" );
- aErrorComment.append( " weight=" );
- aErrorComment.append( sal_Int32(pFont->GetWeight()) );
- emitComment( aErrorComment.getStr() );
- }
-
- if( nStreamObject )
- // write font descriptor
- nFontDescriptor = emitFontDescriptor( pFont, aInfo, 0, nStreamObject );
- if( nFontDescriptor )
- {
- if( pEncoding )
- nToUnicodeStream = createToUnicodeCMap( nEncoding, nEncodedCodes, sizeof(nEncoding)/sizeof(nEncoding[0]) );
+ sal_uInt64 nEndStreamPos = 0;
+ osl_getFilePos( m_aFile, &nEndStreamPos );
- // write font object
- sal_Int32 nObject = createObject();
- if( ! updateObject( nObject ) )
- goto streamend;
+ // and finally close the stream
+ aLine.setLength( 0 );
+ aLine.append( "\nendstream\nendobj\n\n" );
+ if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) )
+ throw FontException();
- OStringBuffer aLine( 1024 );
- aLine.append( nObject );
- aLine.append( " 0 obj\n"
- "<</Type/Font/Subtype/Type1/BaseFont/" );
- appendName( aInfo.m_aPSName, aLine );
- aLine.append( "\n" );
- if( !pFont->mbSymbolFlag && pEncoding == 0 )
- aLine.append( "/Encoding/WinAnsiEncoding\n" );
- if( nToUnicodeStream )
- {
- aLine.append( "/ToUnicode " );
- aLine.append( nToUnicodeStream );
- aLine.append( " 0 R\n" );
+ // write stream length object
+ aLine.setLength( 0 );
+ if( ! updateObject( nStreamLengthObject ) )
+ throw FontException();
+ aLine.append( nStreamLengthObject );
+ aLine.append( " 0 obj\n" );
+ aLine.append( (sal_Int64)(nEndStreamPos-nBeginStreamPos ) );
+ aLine.append( "\nendobj\n\n" );
+ if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) )
+ throw FontException();
}
- aLine.append( "/FirstChar 0 /LastChar 255\n"
- "/Widths[" );
- for( int i = 0; i < 256; i++ )
+ else
{
- aLine.append( pWidths[i] );
- aLine.append( ((i&15) == 15) ? "\n" : " " );
- }
- aLine.append( "]\n"
- "/FontDescriptor " );
- aLine.append( nFontDescriptor );
- aLine.append( " 0 R>>\n"
- "endobj\n\n" );
- if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) )
- goto streamend;
-
- nFontObject = nObject;
-
- aRet[ rEmbed.m_nNormalFontID ] = nObject;
+ rtl::OStringBuffer aErrorComment( 256 );
+ aErrorComment.append( "GetEmbedFontData failed for font \"" );
+ aErrorComment.append( OUStringToOString( pFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 ) );
+ aErrorComment.append( '\"' );
+ if( pFont->GetSlant() == ITALIC_NORMAL )
+ aErrorComment.append( " italic" );
+ else if( pFont->GetSlant() == ITALIC_OBLIQUE )
+ aErrorComment.append( " oblique" );
+ aErrorComment.append( " weight=" );
+ aErrorComment.append( sal_Int32(pFont->GetWeight()) );
+ emitComment( aErrorComment.getStr() );
+ }
+
+ if( nStreamObject )
+ // write font descriptor
+ nFontDescriptor = emitFontDescriptor( pFont, aInfo, 0, nStreamObject );
- // write additional encodings
- for( std::list< EmbedEncoding >::iterator enc_it = rEmbed.m_aExtendedEncodings.begin(); enc_it != rEmbed.m_aExtendedEncodings.end(); ++enc_it )
+ if( nFontDescriptor )
{
- sal_Int32 aEncWidths[ 256 ];
- // emit encoding dict
- sal_Int32 nEncObject = createObject();
- if( ! updateObject( nEncObject ) )
- goto streamend;
-
- OutputDevice* pRef = getReferenceDevice();
- pRef->Push( PUSH_FONT | PUSH_MAPMODE );
- pRef->SetMapMode( MapMode( MAP_PIXEL ) );
- Font aFont( pFont->GetFamilyName(), pFont->GetStyleName(), Size( 0, 1000 ) );
- aFont.SetWeight( pFont->GetWeight() );
- aFont.SetItalic( pFont->GetSlant() );
- aFont.SetPitch( pFont->GetPitch() );
- pRef->SetFont( aFont );
- pRef->ImplNewFont();
-
- aLine.setLength( 0 );
- aLine.append( nEncObject );
- aLine.append( " 0 obj\n"
- "<</Type/Encoding/Differences[ 0\n" );
- int nEncoded = 0;
- for( std::vector< EmbedCode >::iterator str_it = enc_it->m_aEncVector.begin(); str_it != enc_it->m_aEncVector.end(); ++str_it )
- {
- String aStr( str_it->m_aUnicode );
- aEncWidths[nEncoded] = pRef->GetTextWidth( aStr );
- nEncodedCodes[nEncoded] = str_it->m_aUnicode;
- nEncoding[nEncoded] = sal::static_int_cast<sal_uInt8>(nEncoded);
-
- aLine.append( " /" );
- aLine.append( str_it->m_aName );
- if( !((++nEncoded) & 15) )
- aLine.append( "\n" );
- }
- aLine.append( "]>>\n"
- "endobj\n\n" );
-
- pRef->Pop();
-
- if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) )
- goto streamend;
-
- nToUnicodeStream = createToUnicodeCMap( nEncoding, nEncodedCodes, nEncoded );
+ if( pEncoding )
+ nToUnicodeStream = createToUnicodeCMap( nEncoding, &aUnicodes[0], pUnicodesPerGlyph, pEncToUnicodeIndex, sizeof(nEncoding)/sizeof(nEncoding[0]) );
- nObject = createObject();
+ // write font object
+ sal_Int32 nObject = createObject();
if( ! updateObject( nObject ) )
- goto streamend;
+ throw FontException();
- aLine.setLength( 0 );
+ OStringBuffer aLine( 1024 );
aLine.append( nObject );
aLine.append( " 0 obj\n"
- "<</Type/Font/Subtype/Type1/BaseFont/" );
+ "<</Type/Font/Subtype/Type1/BaseFont/" );
appendName( aInfo.m_aPSName, aLine );
aLine.append( "\n" );
- aLine.append( "/Encoding " );
- aLine.append( nEncObject );
- aLine.append( " 0 R\n" );
+ if( !pFont->mbSymbolFlag && pEncoding == 0 )
+ aLine.append( "/Encoding/WinAnsiEncoding\n" );
if( nToUnicodeStream )
{
aLine.append( "/ToUnicode " );
aLine.append( nToUnicodeStream );
aLine.append( " 0 R\n" );
}
- aLine.append( "/FirstChar 0\n"
- "/LastChar " );
- aLine.append( (sal_Int32)(nEncoded-1) );
- aLine.append( "\n"
- "/Widths[" );
- for( int i = 0; i < nEncoded; i++ )
+ aLine.append( "/FirstChar 0 /LastChar 255\n"
+ "/Widths[" );
+ for( int i = 0; i < 256; i++ )
{
- aLine.append( aEncWidths[i] );
+ aLine.append( pWidths[i] );
aLine.append( ((i&15) == 15) ? "\n" : " " );
}
- aLine.append( " ]\n"
- "/FontDescriptor " );
+ aLine.append( "]\n"
+ "/FontDescriptor " );
aLine.append( nFontDescriptor );
aLine.append( " 0 R>>\n"
- "endobj\n\n" );
+ "endobj\n\n" );
if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) )
- goto streamend;
+ throw FontException();
- aRet[ enc_it->m_nFontID ] = nObject;
+ nFontObject = nObject;
+
+ aRet[ rEmbed.m_nNormalFontID ] = nObject;
+
+ // write additional encodings
+ for( std::list< EmbedEncoding >::iterator enc_it = rEmbed.m_aExtendedEncodings.begin(); enc_it != rEmbed.m_aExtendedEncodings.end(); ++enc_it )
+ {
+ sal_Int32 aEncWidths[ 256 ];
+ // emit encoding dict
+ sal_Int32 nEncObject = createObject();
+ if( ! updateObject( nEncObject ) )
+ throw FontException();
+
+ OutputDevice* pRef = getReferenceDevice();
+ pRef->Push( PUSH_FONT | PUSH_MAPMODE );
+ pRef->SetMapMode( MapMode( MAP_PIXEL ) );
+ Font aFont( pFont->GetFamilyName(), pFont->GetStyleName(), Size( 0, 1000 ) );
+ aFont.SetWeight( pFont->GetWeight() );
+ aFont.SetItalic( pFont->GetSlant() );
+ aFont.SetPitch( pFont->GetPitch() );
+ pRef->SetFont( aFont );
+ pRef->ImplNewFont();
+
+ aLine.setLength( 0 );
+ aLine.append( nEncObject );
+ aLine.append( " 0 obj\n"
+ "<</Type/Encoding/Differences[ 0\n" );
+ int nEncoded = 0;
+ aUnicodes.clear();
+ for( std::vector< EmbedCode >::iterator str_it = enc_it->m_aEncVector.begin(); str_it != enc_it->m_aEncVector.end(); ++str_it )
+ {
+ String aStr( str_it->m_aUnicode );
+ aEncWidths[nEncoded] = pRef->GetTextWidth( aStr );
+ nEncodedCodes[nEncoded] = str_it->m_aUnicode;
+ nEncoding[nEncoded] = sal::static_int_cast<sal_uInt8>(nEncoded);
+ pEncToUnicodeIndex[nEncoded] = static_cast<sal_Int32>(aUnicodes.size());
+ aUnicodes.push_back( nEncodedCodes[nEncoded] );
+ pUnicodesPerGlyph[nEncoded] = 1;
+
+ aLine.append( " /" );
+ aLine.append( str_it->m_aName );
+ if( !((++nEncoded) & 15) )
+ aLine.append( "\n" );
+ }
+ aLine.append( "]>>\n"
+ "endobj\n\n" );
+
+ pRef->Pop();
+
+ if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) )
+ throw FontException();
+
+ nToUnicodeStream = createToUnicodeCMap( nEncoding, &aUnicodes[0], pUnicodesPerGlyph, pEncToUnicodeIndex, nEncoded );
+
+ nObject = createObject();
+ if( ! updateObject( nObject ) )
+ throw FontException();
+
+ aLine.setLength( 0 );
+ aLine.append( nObject );
+ aLine.append( " 0 obj\n"
+ "<</Type/Font/Subtype/Type1/BaseFont/" );
+ appendName( aInfo.m_aPSName, aLine );
+ aLine.append( "\n" );
+ aLine.append( "/Encoding " );
+ aLine.append( nEncObject );
+ aLine.append( " 0 R\n" );
+ if( nToUnicodeStream )
+ {
+ aLine.append( "/ToUnicode " );
+ aLine.append( nToUnicodeStream );
+ aLine.append( " 0 R\n" );
+ }
+ aLine.append( "/FirstChar 0\n"
+ "/LastChar " );
+ aLine.append( (sal_Int32)(nEncoded-1) );
+ aLine.append( "\n"
+ "/Widths[" );
+ for( int i = 0; i < nEncoded; i++ )
+ {
+ aLine.append( aEncWidths[i] );
+ aLine.append( ((i&15) == 15) ? "\n" : " " );
+ }
+ aLine.append( " ]\n"
+ "/FontDescriptor " );
+ aLine.append( nFontDescriptor );
+ aLine.append( " 0 R>>\n"
+ "endobj\n\n" );
+ if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) )
+ throw FontException();
+
+ aRet[ enc_it->m_nFontID ] = nObject;
+ }
}
}
+ catch( FontException& )
+ {
+ // these do nothing in case there was no compression or encryption ongoing
+ endCompression();
+ disableStreamEncryption();
+ }
- streamend:
if( pFontData )
m_pReferenceDevice->mpGraphics->FreeEmbedFontData( pFontData, nFontLen );
@@ -3567,11 +3552,15 @@ static void appendSubsetName( int nSubsetID, const OUString& rPSName, OStringBuf
appendName( rPSName, rBuffer );
}
-sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding, sal_Ucs* pUnicodes, int nGlyphs )
+sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding,
+ sal_Ucs* pUnicodes,
+ sal_Int32* pUnicodesPerGlyph,
+ sal_Int32* pEncToUnicodeIndex,
+ int nGlyphs )
{
int nMapped = 0, n = 0;
for( n = 0; n < nGlyphs; n++ )
- if( pUnicodes[n] )
+ if( pUnicodes[pEncToUnicodeIndex[n]] && pUnicodesPerGlyph[n] )
nMapped++;
if( nMapped == 0 )
@@ -3599,7 +3588,7 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding, sal_Ucs* pUn
int nCount = 0;
for( n = 0; n < nGlyphs; n++ )
{
- if( pUnicodes[n] )
+ if( pUnicodes[pEncToUnicodeIndex[n]] && pUnicodesPerGlyph[n] )
{
if( (nCount % 100) == 0 )
{
@@ -3611,9 +3600,13 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding, sal_Ucs* pUn
aContents.append( '<' );
appendHex( (sal_Int8)pEncoding[n], aContents );
aContents.append( "> <" );
- // TODO: handle unicodes>U+FFFF
- appendHex( (sal_Int8)(pUnicodes[n] / 256), aContents );
- appendHex( (sal_Int8)(pUnicodes[n] & 255), aContents );
+ // TODO: handle unicodes>U+FFFF
+ sal_Int32 nIndex = pEncToUnicodeIndex[n];
+ for( sal_Int32 j = 0; j < pUnicodesPerGlyph[n]; j++ )
+ {
+ appendHex( (sal_Int8)(pUnicodes[nIndex + j] / 256), aContents );
+ appendHex( (sal_Int8)(pUnicodes[nIndex + j] & 255), aContents );
+ }
aContents.append( ">\n" );
nCount++;
}
@@ -3777,25 +3770,32 @@ bool PDFWriterImpl::emitFonts()
sal_Int32 pGlyphIDs[ 256 ];
sal_Int32 pWidths[ 256 ];
sal_uInt8 pEncoding[ 256 ];
- sal_Ucs pUnicodes[ 256 ];
+ sal_Int32 pEncToUnicodeIndex[ 256 ];
+ sal_Int32 pUnicodesPerGlyph[ 256 ];
+ std::vector<sal_Ucs> aUnicodes;
+ aUnicodes.reserve( 256 );
int nGlyphs = 1;
// fill arrays and prepare encoding index map
sal_Int32 nToUnicodeStream = 0;
- memset( pGlyphIDs, 0, sizeof( pGlyphIDs ) );
- memset( pEncoding, 0, sizeof( pEncoding ) );
- memset( pUnicodes, 0, sizeof( pUnicodes ) );
+ rtl_zeroMemory( pGlyphIDs, sizeof( pGlyphIDs ) );
+ rtl_zeroMemory( pEncoding, sizeof( pEncoding ) );
+ rtl_zeroMemory( pUnicodesPerGlyph, sizeof( pUnicodesPerGlyph ) );
+ rtl_zeroMemory( pEncToUnicodeIndex, sizeof( pEncToUnicodeIndex ) );
for( FontEmitMapping::iterator fit = lit->m_aMapping.begin(); fit != lit->m_aMapping.end();++fit )
{
- sal_uInt8 nEnc = fit->second.m_nSubsetGlyphID;
+ sal_uInt8 nEnc = fit->second.getGlyphId();
DBG_ASSERT( pGlyphIDs[nEnc] == 0 && pEncoding[nEnc] == 0, "duplicate glyph" );
DBG_ASSERT( nEnc <= lit->m_aMapping.size(), "invalid glyph encoding" );
pGlyphIDs[ nEnc ] = fit->first;
pEncoding[ nEnc ] = nEnc;
- pUnicodes[ nEnc ] = fit->second.m_aUnicode;
- if( pUnicodes[ nEnc ] )
+ pEncToUnicodeIndex[ nEnc ] = static_cast<sal_Int32>(aUnicodes.size());
+ pUnicodesPerGlyph[ nEnc ] = fit->second.countCodes();
+ for( sal_Int32 n = 0; n < pUnicodesPerGlyph[ nEnc ]; n++ )
+ aUnicodes.push_back( fit->second.getCode( n ) );
+ if( fit->second.getCode(0) )
nToUnicodeStream = 1;
if( nGlyphs < 256 )
nGlyphs++;
@@ -3816,92 +3816,92 @@ bool PDFWriterImpl::emitFonts()
CHECK_RETURN( (osl_File_E_None == osl_getFilePos( aFontFile, &nLength1 ) ) );
CHECK_RETURN( (osl_File_E_None == osl_setFilePos( aFontFile, osl_Pos_Absolut, 0 ) ) );
-#if OSL_DEBUG_LEVEL > 1
+ #if OSL_DEBUG_LEVEL > 1
{
OStringBuffer aLine1( " PDFWriterImpl::emitFonts" );
emitComment( aLine1.getStr() );
}
-#endif
+ #endif
sal_Int32 nFontStream = createObject();
sal_Int32 nStreamLengthObject = createObject();
CHECK_RETURN( updateObject( nFontStream ) );
aLine.setLength( 0 );
aLine.append( nFontStream );
aLine.append( " 0 obj\n"
- "<</Length " );
+ "<</Length " );
aLine.append( (sal_Int32)nStreamLengthObject );
aLine.append( " 0 R"
-#ifndef DEBUG_DISABLE_PDFCOMPRESSION
- "/Filter/FlateDecode"
-#endif
- "/Length1 " );
-
- sal_uInt64 nStartPos = 0;
- if( aSubsetInfo.m_nFontType == FontSubsetInfo::SFNT_TTF )
- {
- aLine.append( (sal_Int32)nLength1 );
+ #ifndef DEBUG_DISABLE_PDFCOMPRESSION
+ "/Filter/FlateDecode"
+ #endif
+ "/Length1 " );
- aLine.append( ">>\n"
- "stream\n" );
- CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) );
- CHECK_RETURN( (osl_File_E_None == osl_getFilePos( m_aFile, &nStartPos ) ) );
-
- // copy font file
- beginCompression();
- checkAndEnableStreamEncryption( nFontStream );
- sal_Bool bEOF = sal_False;
- do
+ sal_uInt64 nStartPos = 0;
+ if( aSubsetInfo.m_nFontType == FontSubsetInfo::SFNT_TTF )
{
- char buf[8192];
- sal_uInt64 nRead;
- CHECK_RETURN( (osl_File_E_None == osl_readFile( aFontFile, buf, sizeof( buf ), &nRead ) ) );
- CHECK_RETURN( writeBuffer( buf, nRead ) );
- CHECK_RETURN( (osl_File_E_None == osl_isEndOfFile( aFontFile, &bEOF ) ) );
- } while( ! bEOF );
- }
- else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::CFF_FONT) != 0 )
- {
- // TODO: implement
- DBG_ERROR( "PDFWriterImpl does not support CFF-font subsets yet!" );
- }
- else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::TYPE1_PFB) != 0 ) // TODO: also support PFA?
- {
- unsigned char* pBuffer = new unsigned char[ (int)nLength1 ];
-
- sal_uInt64 nBytesRead = 0;
- CHECK_RETURN( (osl_File_E_None == osl_readFile( aFontFile, pBuffer, nLength1, &nBytesRead ) ) );
- DBG_ASSERT( nBytesRead==nLength1, "PDF-FontSubset read incomplete!" );
- CHECK_RETURN( (osl_File_E_None == osl_setFilePos( aFontFile, osl_Pos_Absolut, 0 ) ) );
- // get the PFB-segment lengths
- ThreeInts aSegmentLengths = {0,0,0};
- getPfbSegmentLengths( pBuffer, (int)nBytesRead, aSegmentLengths );
- // the lengths below are mandatory for PDF-exported Type1 fonts
- // because the PFB segment headers get stripped! WhyOhWhy.
- aLine.append( (sal_Int32)aSegmentLengths[0] );
- aLine.append( "/Length2 " );
- aLine.append( (sal_Int32)aSegmentLengths[1] );
- aLine.append( "/Length3 " );
- aLine.append( (sal_Int32)aSegmentLengths[2] );
-
- aLine.append( ">>\n"
- "stream\n" );
- CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) );
- CHECK_RETURN( (osl_File_E_None == osl_getFilePos( m_aFile, &nStartPos ) ) );
-
- // emit PFB-sections without section headers
- beginCompression();
- checkAndEnableStreamEncryption( nFontStream );
- CHECK_RETURN( writeBuffer( pBuffer+ 6, aSegmentLengths[0] ) );
- CHECK_RETURN( writeBuffer( pBuffer+12 + aSegmentLengths[0], aSegmentLengths[1] ) );
- CHECK_RETURN( writeBuffer( pBuffer+18 + aSegmentLengths[0] + aSegmentLengths[1], aSegmentLengths[2] ) );
-
- delete[] pBuffer;
- }
- else
- {
- fprintf( stderr, "PDF: CreateFontSubset result in not yet supported format=%d\n",aSubsetInfo.m_nFontType);
- aLine.append( "0 >>\nstream\n" );
- }
+ aLine.append( (sal_Int32)nLength1 );
+
+ aLine.append( ">>\n"
+ "stream\n" );
+ CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) );
+ CHECK_RETURN( (osl_File_E_None == osl_getFilePos( m_aFile, &nStartPos ) ) );
+
+ // copy font file
+ beginCompression();
+ checkAndEnableStreamEncryption( nFontStream );
+ sal_Bool bEOF = sal_False;
+ do
+ {
+ char buf[8192];
+ sal_uInt64 nRead;
+ CHECK_RETURN( (osl_File_E_None == osl_readFile( aFontFile, buf, sizeof( buf ), &nRead ) ) );
+ CHECK_RETURN( writeBuffer( buf, nRead ) );
+ CHECK_RETURN( (osl_File_E_None == osl_isEndOfFile( aFontFile, &bEOF ) ) );
+ } while( ! bEOF );
+ }
+ else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::CFF_FONT) != 0 )
+ {
+ // TODO: implement
+ DBG_ERROR( "PDFWriterImpl does not support CFF-font subsets yet!" );
+ }
+ else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::TYPE1_PFB) != 0 ) // TODO: also support PFA?
+ {
+ unsigned char* pBuffer = new unsigned char[ (int)nLength1 ];
+
+ sal_uInt64 nBytesRead = 0;
+ CHECK_RETURN( (osl_File_E_None == osl_readFile( aFontFile, pBuffer, nLength1, &nBytesRead ) ) );
+ DBG_ASSERT( nBytesRead==nLength1, "PDF-FontSubset read incomplete!" );
+ CHECK_RETURN( (osl_File_E_None == osl_setFilePos( aFontFile, osl_Pos_Absolut, 0 ) ) );
+ // get the PFB-segment lengths
+ ThreeInts aSegmentLengths = {0,0,0};
+ getPfbSegmentLengths( pBuffer, (int)nBytesRead, aSegmentLengths );
+ // the lengths below are mandatory for PDF-exported Type1 fonts
+ // because the PFB segment headers get stripped! WhyOhWhy.
+ aLine.append( (sal_Int32)aSegmentLengths[0] );
+ aLine.append( "/Length2 " );
+ aLine.append( (sal_Int32)aSegmentLengths[1] );
+ aLine.append( "/Length3 " );
+ aLine.append( (sal_Int32)aSegmentLengths[2] );
+
+ aLine.append( ">>\n"
+ "stream\n" );
+ CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) );
+ CHECK_RETURN( (osl_File_E_None == osl_getFilePos( m_aFile, &nStartPos ) ) );
+
+ // emit PFB-sections without section headers
+ beginCompression();
+ checkAndEnableStreamEncryption( nFontStream );
+ CHECK_RETURN( writeBuffer( pBuffer+ 6, aSegmentLengths[0] ) );
+ CHECK_RETURN( writeBuffer( pBuffer+12 + aSegmentLengths[0], aSegmentLengths[1] ) );
+ CHECK_RETURN( writeBuffer( pBuffer+18 + aSegmentLengths[0] + aSegmentLengths[1], aSegmentLengths[2] ) );
+
+ delete[] pBuffer;
+ }
+ else
+ {
+ fprintf( stderr, "PDF: CreateFontSubset result in not yet supported format=%d\n",aSubsetInfo.m_nFontType);
+ aLine.append( "0 >>\nstream\n" );
+ }
endCompression();
disableStreamEncryption();
@@ -3928,7 +3928,7 @@ bool PDFWriterImpl::emitFonts()
sal_Int32 nFontDescriptor = emitFontDescriptor( it->first, aSubsetInfo, lit->m_nFontID, nFontStream );
if( nToUnicodeStream )
- nToUnicodeStream = createToUnicodeCMap( pEncoding, pUnicodes, nGlyphs );
+ nToUnicodeStream = createToUnicodeCMap( pEncoding, &aUnicodes[0], pUnicodesPerGlyph, pEncToUnicodeIndex, nGlyphs );
sal_Int32 nFontObject = createObject();
CHECK_RETURN( updateObject( nFontObject ) );
@@ -3937,22 +3937,22 @@ bool PDFWriterImpl::emitFonts()
aLine.append( " 0 obj\n" );
aLine.append( ((aSubsetInfo.m_nFontType & FontSubsetInfo::ANY_TYPE1) != 0) ?
- "<</Type/Font/Subtype/Type1/BaseFont/" :
- "<</Type/Font/Subtype/TrueType/BaseFont/" );
+ "<</Type/Font/Subtype/Type1/BaseFont/" :
+ "<</Type/Font/Subtype/TrueType/BaseFont/" );
appendSubsetName( lit->m_nFontID, aSubsetInfo.m_aPSName, aLine );
aLine.append( "\n"
- "/FirstChar 0\n"
- "/LastChar " );
+ "/FirstChar 0\n"
+ "/LastChar " );
aLine.append( (sal_Int32)(nGlyphs-1) );
aLine.append( "\n"
- "/Widths[" );
+ "/Widths[" );
for( int i = 0; i < nGlyphs; i++ )
{
aLine.append( pWidths[ i ] );
aLine.append( ((i & 15) == 15) ? "\n" : " " );
}
aLine.append( "]\n"
- "/FontDescriptor " );
+ "/FontDescriptor " );
aLine.append( nFontDescriptor );
aLine.append( " 0 R\n" );
if( nToUnicodeStream )
@@ -3962,7 +3962,7 @@ bool PDFWriterImpl::emitFonts()
aLine.append( " 0 R\n" );
}
aLine.append( ">>\n"
- "endobj\n\n" );
+ "endobj\n\n" );
CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) );
aFontIDToObject[ lit->m_nFontID ] = nFontObject;
@@ -4011,7 +4011,7 @@ bool PDFWriterImpl::emitFonts()
OStringBuffer aFontDict( 1024 );
aFontDict.append( getFontDictObject() );
aFontDict.append( " 0 obj\n"
- "<<" );
+ "<<" );
int ni = 0;
for( std::map< sal_Int32, sal_Int32 >::iterator mit = aFontIDToObject.begin(); mit != aFontIDToObject.end(); ++mit )
{
@@ -4020,12 +4020,12 @@ bool PDFWriterImpl::emitFonts()
aFontDict.append( ' ' );
aFontDict.append( mit->second );
aFontDict.append( " 0 R" );
- if( ((++ni) & 7) == 0 )
- aFontDict.append( '\n' );
+ if( ((++ni) & 7) == 0 )
+ aFontDict.append( '\n' );
}
// emit builtin font for widget apperances / variable text
for( std::map< sal_Int32, sal_Int32 >::iterator it = m_aBuiltinFontToObjectMap.begin();
- it != m_aBuiltinFontToObjectMap.end(); ++it )
+ it != m_aBuiltinFontToObjectMap.end(); ++it )
{
ImplPdfBuiltinFontData aData(m_aBuiltinFonts[it->first]);
it->second = emitBuiltinFont( &aData, it->second );
@@ -6580,12 +6580,14 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs,
sal_GlyphId* pGlyphs,
sal_Int32* pGlyphWidths,
sal_Ucs* pUnicodes,
+ sal_Int32* pUnicodesPerGlyph,
sal_uInt8* pMappedGlyphs,
sal_Int32* pMappedFontObjects,
const ImplFontData* pFallbackFonts[] )
{
const ImplFontData* pDevFont = m_pReferenceDevice->mpFontEntry->maFontSelData.mpFontData;
- for( int i = 0; i < nGlyphs; i++ )
+ sal_Ucs* pCurUnicode = pUnicodes;
+ for( int i = 0; i < nGlyphs; pCurUnicode += pUnicodesPerGlyph[i] , i++ )
{
const int nFontGlyphId = pGlyphs[i] & (GF_IDXMASK | GF_ISCHAR | GF_GSUB);
const ImplFontData* pCurrentFont = pFallbackFonts[i] ? pFallbackFonts[i] : pDevFont;
@@ -6640,8 +6642,9 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs,
// add new glyph to emitted font subset
GlyphEmit& rNewGlyphEmit = rSubset.m_aSubsets.back().m_aMapping[ nFontGlyphId ];
- rNewGlyphEmit.m_nSubsetGlyphID = nNewId;
- rNewGlyphEmit.m_aUnicode = (pUnicodes ? pUnicodes[i] : 0);
+ rNewGlyphEmit.setGlyphId( nNewId );
+ for( sal_Int32 n = 0; n < pUnicodesPerGlyph[i]; n++ )
+ rNewGlyphEmit.addCode( pCurUnicode[n] );
// add new glyph to font mapping
Glyph& rNewGlyph = rSubset.m_aMapping[ nFontGlyphId ];
@@ -6678,7 +6681,7 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs,
Ucs2OStrMap::const_iterator nonenc_it;
sal_Int32 nCurFontID = nFontID;
- sal_Ucs cChar = pUnicodes[i];
+ sal_Ucs cChar = *pCurUnicode;
if( pEncoding )
{
enc_it = pEncoding->find( cChar );
@@ -6740,7 +6743,7 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs,
pMappedGlyphs[ i ] = (sal_Int8)cChar;
pMappedFontObjects[ i ] = nCurFontID;
pGlyphWidths[ i ] = m_aFontCache.getGlyphWidth( pCurrentFont,
- (pEncoding ? pUnicodes[i] : cChar) | GF_ISCHAR,
+ (pEncoding ? *pCurUnicode : cChar) | GF_ISCHAR,
false,
m_pReferenceDevice->mpGraphics );
}
@@ -7020,7 +7023,9 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT
sal_Int32 pGlyphWidths[nMaxGlyphs];
sal_uInt8 pMappedGlyphs[nMaxGlyphs];
sal_Int32 pMappedFontObjects[nMaxGlyphs];
- sal_Ucs pUnicodes[nMaxGlyphs];
+ std::vector<sal_Ucs> aUnicodes;
+ aUnicodes.reserve( nMaxGlyphs );
+ sal_Int32 pUnicodesPerGlyph[nMaxGlyphs];
int pCharPosAry[nMaxGlyphs];
sal_Int32 nAdvanceWidths[nMaxGlyphs];
const ImplFontData* pFallbackFonts[nMaxGlyphs];
@@ -7153,15 +7158,29 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT
Point aGNGlyphPos;
while( (nGlyphs = rLayout.GetNextGlyphs( nTmpMaxGlyphs, pGlyphs, aGNGlyphPos, nIndex, nAdvanceWidths, pCharPosAry )) != 0 )
{
+ aUnicodes.clear();
for( int i = 0; i < nGlyphs; i++ )
{
pFallbackFonts[i] = rLayout.GetFallbackFontData( pGlyphs[i] );
+ // default case: 1 glyph is one unicode
+ pUnicodesPerGlyph[i] = 1;
if( (pGlyphs[i] & GF_ISCHAR) )
- pUnicodes[i] = static_cast<sal_Ucs>(pGlyphs[i] & GF_IDXMASK);
+ {
+ aUnicodes.push_back( static_cast<sal_Ucs>(pGlyphs[i] & GF_IDXMASK) );
+ }
else if( pCharPosAry[i] >= nMinCharPos && pCharPosAry[i] <= nMaxCharPos )
{
- pUnicodes[i] = rText.GetChar( sal::static_int_cast<xub_StrLen>(pCharPosAry[i]) );
+ int nChars = 1;
+ aUnicodes.push_back( rText.GetChar( sal::static_int_cast<xub_StrLen>(pCharPosAry[i]) ) );
+ pUnicodesPerGlyph[i] = 1;
+ // try to handle ligatures and such
+ if( i < nGlyphs-1 )
+ {
+ pUnicodesPerGlyph[i] = nChars = pCharPosAry[i+1] - pCharPosAry[i];
+ for( int n = 1; n < nChars; n++ )
+ aUnicodes.push_back( rText.GetChar( sal::static_int_cast<xub_StrLen>(pCharPosAry[i]+n) ) );
+ }
// #i36691# hack that is needed because currently the pGlyphs[]
// argument is ignored for embeddable fonts and so the layout
// engine's glyph work is ignored (i.e. char mirroring)
@@ -7169,17 +7188,21 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT
// glyphid (i.e. FreeType's synthetic glyphid for a Type1 font)
// back to unicode and then to embeddable font's encoding
if( getReferenceDevice()->GetLayoutMode() & TEXT_LAYOUT_BIDI_RTL )
- pUnicodes[i] = static_cast<sal_Ucs>(GetMirroredChar(pUnicodes[i]));
+ {
+ size_t nI = aUnicodes.size()-1;
+ for( int n = 0; n < nChars; n++, nI-- )
+ aUnicodes[nI] = static_cast<sal_Ucs>(GetMirroredChar(aUnicodes[nI]));
+ }
}
else
- pUnicodes[i] = 0;
+ aUnicodes.push_back( 0 );
// note: in case of ctl one character may result
// in multiple glyphs. The current SalLayout
// implementations set -1 then to indicate that no direct
// mapping is possible
}
- registerGlyphs( nGlyphs, pGlyphs, pGlyphWidths, pUnicodes, pMappedGlyphs, pMappedFontObjects, pFallbackFonts );
+ registerGlyphs( nGlyphs, pGlyphs, pGlyphWidths, &aUnicodes[0], pUnicodesPerGlyph, pMappedGlyphs, pMappedFontObjects, pFallbackFonts );
for( int i = 0; i < nGlyphs; i++ )
{
@@ -9513,7 +9536,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
sal_uInt64 nStartPos = 0;
CHECK_RETURN( (osl_File_E_None == osl_getFilePos( m_aFile, &nStartPos )) );
- checkAndEnableStreamEncryption( rObject.m_nObject );
+ checkAndEnableStreamEncryption( rObject.m_nObject );
beginCompression();
if( ! bTrueColor || pAccess->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB )
{
@@ -9527,7 +9550,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
else
{
const int nScanLineBytes = pAccess->Width()*3;
- sal_uInt8 *pCol = (sal_uInt8*)rtl_allocateMemory( nScanLineBytes );
+ 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++ )
@@ -9537,9 +9560,8 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
pCol[3*x+1] = aColor.GetGreen();
pCol[3*x+2] = aColor.GetBlue();
}
- CHECK_RETURN( writeBuffer( pCol, nScanLineBytes ) );
+ CHECK_RETURN( writeBuffer( pCol.get(), nScanLineBytes ) );
}
- rtl_freeMemory( pCol );
}
endCompression();
disableStreamEncryption();
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index e058cfa487db..d54aecf35788 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -52,6 +52,8 @@
#include <hash_map>
#include <list>
+#include <boost/shared_array.hpp>
+
class ImplFontSelectData;
class ImplFontMetricData;
class FontSubsetInfo;
@@ -270,10 +272,53 @@ public:
};
// font subsets
- struct GlyphEmit
+ class GlyphEmit
{
- sal_Ucs m_aUnicode;
- sal_uInt8 m_nSubsetGlyphID;
+ // performance: actually this should probably a vector;
+ sal_Ucs m_aBufferedUnicodes[3];
+ sal_Int32 m_nUnicodes;
+ sal_Int32 m_nMaxUnicodes;
+ boost::shared_array<sal_Ucs> m_pUnicodes;
+ sal_uInt8 m_nSubsetGlyphID;
+
+ public:
+ GlyphEmit() : m_nUnicodes(0), m_nSubsetGlyphID(0)
+ {
+ rtl_zeroMemory( m_aBufferedUnicodes, sizeof( m_aBufferedUnicodes ) );
+ m_nMaxUnicodes = sizeof(m_aBufferedUnicodes)/sizeof(m_aBufferedUnicodes[0]);
+ }
+ ~GlyphEmit()
+ {
+ }
+
+ void setGlyphId( sal_uInt8 i_nId ) { m_nSubsetGlyphID = i_nId; }
+ sal_uInt8 getGlyphId() const { return m_nSubsetGlyphID; }
+
+ void addCode( sal_Ucs i_cCode )
+ {
+ if( m_nUnicodes == m_nMaxUnicodes )
+ {
+ sal_Ucs* pNew = new sal_Ucs[ 2 * m_nMaxUnicodes];
+ if( m_pUnicodes.get() )
+ rtl_copyMemory( pNew, m_pUnicodes.get(), m_nMaxUnicodes * sizeof(sal_Ucs) );
+ else
+ rtl_copyMemory( pNew, m_aBufferedUnicodes, m_nMaxUnicodes * sizeof(sal_Ucs) );
+ m_pUnicodes.reset( pNew );
+ m_nMaxUnicodes *= 2;
+ }
+ if( m_pUnicodes.get() )
+ m_pUnicodes[ m_nUnicodes++ ] = i_cCode;
+ else
+ m_aBufferedUnicodes[ m_nUnicodes++ ] = i_cCode;
+ }
+ sal_Int32 countCodes() const { return m_nUnicodes; }
+ sal_Ucs getCode( sal_Int32 i_nIndex ) const
+ {
+ sal_Ucs nRet = 0;
+ if( i_nIndex < m_nUnicodes )
+ nRet = m_pUnicodes.get() ? m_pUnicodes[ i_nIndex ] : m_aBufferedUnicodes[ i_nIndex ];
+ return nRet;
+ }
};
typedef std::map< sal_GlyphId, GlyphEmit > FontEmitMapping;
struct FontEmit
@@ -860,7 +905,7 @@ i12626
void appendLiteralStringEncrypt( rtl::OStringBuffer& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer );
/* creates fonts and subsets that will be emitted later */
- void registerGlyphs( int nGlyphs, sal_GlyphId* pGlyphs, sal_Int32* pGlpyhWidths, sal_Ucs* pUnicodes, sal_uInt8* pMappedGlyphs, sal_Int32* pMappedFontObjects, const ImplFontData* pFallbackFonts[] );
+ void registerGlyphs( int nGlyphs, sal_GlyphId* pGlyphs, sal_Int32* pGlpyhWidths, sal_Ucs* pUnicodes, sal_Int32* pUnicodesPerGlyph, sal_uInt8* pMappedGlyphs, sal_Int32* pMappedFontObjects, const ImplFontData* pFallbackFonts[] );
/* emits a text object according to the passed layout */
/* TODO: remove rText as soon as SalLayout will change so that rText is not necessary anymore */
@@ -909,7 +954,7 @@ i12626
/* writes a font descriptor and returns its object id (or 0) */
sal_Int32 emitFontDescriptor( const ImplFontData*, FontSubsetInfo&, sal_Int32 nSubsetID, sal_Int32 nStream );
/* writes a ToUnicode cmap, returns the corresponding stream object */
- sal_Int32 createToUnicodeCMap( sal_uInt8* pEncoding, sal_Ucs* pUnicodes, int nGlyphs );
+ sal_Int32 createToUnicodeCMap( sal_uInt8* pEncoding, sal_Ucs* pUnicodes, sal_Int32* pUnicodesPerGlyph, sal_Int32* pEncToUnicodeIndex, int nGlyphs );
/* get resource dict object number */
sal_Int32 getResourceDictObj()
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 937d966b3978..16f6b53af7a8 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: print.cxx,v $
- * $Revision: 1.65 $
+ * $Revision: 1.65.114.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,8 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#define _SPOOLPRINTER_EXT
-#define _RMPRINTER_EXT
#define ENABLE_BYTESTRING_STREAM_OPERATORS
#include <list>
@@ -58,7 +56,6 @@
#include <vcl/print.h>
#include <vcl/gdimtf.hxx>
#include <vcl/metaact.hxx>
-#include <vcl/impprn.hxx>
#include <vcl/print.hxx>
#include <comphelper/processfactory.hxx>
@@ -280,7 +277,9 @@ static void ImplInitPrnQueueList()
pSVData->maGDIData.mpPrinterQueueList = new ImplPrnQueueList;
- pSVData->mpDefInst->GetPrinterQueueInfo( pSVData->maGDIData.mpPrinterQueueList );
+ static const char* pEnv = getenv( "SAL_DISABLE_PRINTERLIST" );
+ if( !pEnv || !*pEnv )
+ pSVData->mpDefInst->GetPrinterQueueInfo( pSVData->maGDIData.mpPrinterQueueList );
}
// -----------------------------------------------------------------------
@@ -339,16 +338,20 @@ const QueueInfo* Printer::GetQueueInfo( const String& rPrinterName, bool bStatus
XubString Printer::GetDefaultPrinterName()
{
- ImplSVData* pSVData = ImplGetSVData();
+ static const char* pEnv = getenv( "SAL_DISABLE_DEFAULTPRINTER" );
+ if( !pEnv || !*pEnv )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
- return pSVData->mpDefInst->GetDefaultPrinter();
+ return pSVData->mpDefInst->GetDefaultPrinter();
+ }
+ return XubString();
}
// =======================================================================
void Printer::ImplInitData()
{
- mpPrinterData = new ImplPrivatePrinterData();
mbDevOutput = FALSE;
meOutDevType = OUTDEV_PRINTER;
mbDefPrinter = FALSE;
@@ -366,8 +369,6 @@ void Printer::ImplInitData()
mpInfoPrinter = NULL;
mpPrinter = NULL;
mpDisplayDev = NULL;
- mpQPrinter = NULL;
- mpQMtf = NULL;
mbIsQueuePrinter = FALSE;
mpPrinterOptions = new PrinterOptions;
@@ -414,7 +415,6 @@ void Printer::ImplInit( SalPrinterQueueInfo* pInfo )
mpInfoPrinter = pSVData->mpDefInst->CreateInfoPrinter( pInfo, pJobSetup );
mpPrinter = NULL;
- mpJobPrinter = NULL;
mpJobGraphics = NULL;
ImplUpdateJobSetupPaper( maJobSetup );
@@ -446,7 +446,6 @@ void Printer::ImplInitDisplay( const Window* pWindow )
mpInfoPrinter = NULL;
mpPrinter = NULL;
- mpJobPrinter = NULL;
mpJobGraphics = NULL;
if ( pWindow )
@@ -518,6 +517,26 @@ void Printer::ImplUpdatePageData()
mnOutWidth, mnOutHeight,
maPageOffset.X(), maPageOffset.Y(),
maPaperSize.Width(), maPaperSize.Height() );
+ static const char* pDebugOffset = getenv( "SAL_DBG_PAGEOFFSET" );
+ if( pDebugOffset )
+ {
+ rtl::OString aLine( pDebugOffset );
+ sal_Int32 nIndex = 0;
+ rtl::OString aToken( aLine.getToken( 0, ',', nIndex ) );
+ sal_Int32 nLeft = aToken.toInt32();
+ sal_Int32 nTop = nLeft;
+ if( nIndex > 0 )
+ {
+ aToken = aLine.getToken( 0, ',', nIndex );
+ nTop = aToken.toInt32();
+ }
+ maPageOffset = LogicToPixel( Point( static_cast<long>(nLeft),
+ static_cast<long>(nTop) ),
+ MapMode( MAP_100TH_MM )
+ );
+ mnOutWidth = maPaperSize.Width() - 2*maPageOffset.X();
+ mnOutWidth = maPaperSize.Width() - 2*maPageOffset.Y();
+ }
}
// -----------------------------------------------------------------------
@@ -602,11 +621,6 @@ Printer::~Printer()
{
DBG_ASSERT( !IsPrinting(), "Printer::~Printer() - Job is printing" );
DBG_ASSERT( !IsJobActive(), "Printer::~Printer() - Job is active" );
- DBG_ASSERT( !mpQPrinter, "Printer::~Printer() - QueuePrinter not destroyed" );
- DBG_ASSERT( !mpQMtf, "Printer::~Printer() - QueueMetafile not destroyed" );
-
- delete mpPrinterData;
- mpPrinterData = NULL;
delete mpPrinterOptions;
@@ -653,21 +667,11 @@ Printer::~Printer()
}
// -----------------------------------------------------------------------
-void Printer::SetNextJobIsQuick( bool bQuick )
-{
- mpPrinterData->mbNextJobIsQuick = bQuick;
- if( mpQPrinter )
- mpQPrinter->SetNextJobIsQuick( bQuick );
-}
-
-// -----------------------------------------------------------------------
void Printer::Compat_OldPrinterMetrics( bool bSet )
{
// propagate flag
if( mpInfoPrinter )
mpInfoPrinter->m_bCompatMetrics = bSet;
- if( mpQPrinter )
- mpQPrinter->Compat_OldPrinterMetrics( bSet );
// get new font data
ImplUpdateFontData( TRUE );
@@ -977,12 +981,13 @@ USHORT Printer::GetPaperBin() const
// -----------------------------------------------------------------------
// Map user paper format to a available printer paper formats
-void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup )
+void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNearest )
{
ImplJobSetup* pSetupData = aJobSetup.ImplGetData();
int nLandscapeAngle = GetLandscapeAngle();
int nPaperCount = GetPaperInfoCount();
+ bool bFound = false;
PaperInfo aInfo(pSetupData->mnPaperWidth, pSetupData->mnPaperHeight);
@@ -995,6 +1000,8 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup )
{
pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(),
rPaperInfo.getHeight() );
+ pSetupData->meOrientation = ORIENTATION_PORTRAIT;
+ bFound = true;
break;
}
}
@@ -1017,10 +1024,49 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup )
{
pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(),
rPaperInfo.getHeight() );
+ pSetupData->meOrientation = ORIENTATION_LANDSCAPE;
+ bFound = true;
break;
}
}
}
+
+ if( ! bFound && bMatchNearest )
+ {
+ sal_Int64 nBestMatch = SAL_MAX_INT64;
+ int nBestIndex = 0;
+ Orientation eBestOrientation = ORIENTATION_PORTRAIT;
+ for( int i = 0; i < nPaperCount; i++ )
+ {
+ const PaperInfo& rPaperInfo = GetPaperInfo( i );
+
+ // check protrait match
+ sal_Int64 nDX = pSetupData->mnPaperWidth - rPaperInfo.getWidth();
+ sal_Int64 nDY = pSetupData->mnPaperHeight - rPaperInfo.getHeight();
+ sal_Int64 nMatch = nDX*nDX + nDY*nDY;
+ if( nMatch < nBestMatch )
+ {
+ nBestMatch = nMatch;
+ nBestIndex = i;
+ eBestOrientation = ORIENTATION_PORTRAIT;
+ }
+
+ // check landscape match
+ nDX = pSetupData->mnPaperWidth - rPaperInfo.getHeight();
+ nDY = pSetupData->mnPaperHeight - rPaperInfo.getWidth();
+ nMatch = nDX*nDX + nDY*nDY;
+ if( nMatch < nBestMatch )
+ {
+ nBestMatch = nMatch;
+ nBestIndex = i;
+ eBestOrientation = ORIENTATION_LANDSCAPE;
+ }
+ }
+ const PaperInfo& rBestInfo = GetPaperInfo( nBestIndex );
+ pSetupData->mePaperFormat = ImplGetPaperFormat( rBestInfo.getWidth(),
+ rBestInfo.getHeight() );
+ pSetupData->meOrientation = eBestOrientation;
+ }
}
// -----------------------------------------------------------------------
@@ -1051,7 +1097,7 @@ BOOL Printer::SetPaper( Paper ePaper )
ImplReleaseGraphics();
if ( ePaper == PAPER_USER )
- ImplFindPaperFormatForUserSize( aJobSetup );
+ ImplFindPaperFormatForUserSize( aJobSetup, false );
if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERSIZE|SAL_JOBSET_ORIENTATION, pSetupData ) )
{
ImplUpdateJobSetupPaper( aJobSetup );
@@ -1072,6 +1118,11 @@ BOOL Printer::SetPaper( Paper ePaper )
BOOL Printer::SetPaperSizeUser( const Size& rSize )
{
+ return SetPaperSizeUser( rSize, false );
+}
+
+BOOL Printer::SetPaperSizeUser( const Size& rSize, bool bMatchNearest )
+{
if ( mbInPrintPage )
return FALSE;
@@ -1095,7 +1146,7 @@ BOOL Printer::SetPaperSizeUser( const Size& rSize )
}
ImplReleaseGraphics();
- ImplFindPaperFormatForUserSize( aJobSetup );
+ ImplFindPaperFormatForUserSize( aJobSetup, bMatchNearest );
// Changing the paper size can also change the orientation!
if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERSIZE|SAL_JOBSET_ORIENTATION, pSetupData ) )
@@ -1142,7 +1193,44 @@ const PaperInfo& Printer::GetPaperInfo( int nPaper ) const
DuplexMode Printer::GetDuplexMode() const
{
- return mpInfoPrinter ? mpInfoPrinter->GetDuplexMode( maJobSetup.ImplGetConstData() ) : DUPLEX_UNKNOWN;
+ return maJobSetup.ImplGetConstData()->meDuplexMode;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::SetDuplexMode( DuplexMode eDuplex )
+{
+ if ( mbInPrintPage )
+ return FALSE;
+
+ if ( maJobSetup.ImplGetConstData()->meDuplexMode != eDuplex )
+ {
+ JobSetup aJobSetup = maJobSetup;
+ ImplJobSetup* pSetupData = aJobSetup.ImplGetData();
+ pSetupData->meDuplexMode = eDuplex;
+
+ if ( IsDisplayPrinter() )
+ {
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ return TRUE;
+ }
+
+ ImplReleaseGraphics();
+ if ( mpInfoPrinter->SetData( SAL_JOBSET_DUPLEXMODE, pSetupData ) )
+ {
+ ImplUpdateJobSetupPaper( aJobSetup );
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ ImplUpdatePageData();
+ ImplUpdateFontList();
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
+
+ return TRUE;
}
// -----------------------------------------------------------------------
@@ -1184,9 +1272,10 @@ XubString Printer::GetPaperBinName( USHORT nPaperBin ) const
// -----------------------------------------------------------------------
-BOOL Printer::SetCopyCount( USHORT nCopy, BOOL /*bCollate*/ )
+BOOL Printer::SetCopyCount( USHORT nCopy, BOOL bCollate )
{
mnCopyCount = nCopy;
+ mbCollateCopy = bCollate;
return TRUE;
}
@@ -1199,29 +1288,8 @@ void Printer::Error()
// -----------------------------------------------------------------------
-void Printer::StartPrint()
-{
- maStartPrintHdl.Call( this );
-}
-
-// -----------------------------------------------------------------------
-
-void Printer::EndPrint()
-{
- maEndPrintHdl.Call( this );
-}
-
-// -----------------------------------------------------------------------
-
-void Printer::PrintPage()
-{
- maPrintPageHdl.Call( this );
-}
-
-// -----------------------------------------------------------------------
-
-ULONG ImplSalPrinterErrorCodeToVCL( ULONG nError )
+ULONG Printer::ImplSalPrinterErrorCodeToVCL( ULONG nError )
{
ULONG nVCLError;
switch ( nError )
@@ -1247,12 +1315,6 @@ void Printer::ImplEndPrint()
mbPrinting = FALSE;
mnCurPrintPage = 0;
maJobName.Erase();
- if( mpQPrinter ) // not necessarily filled e.g. after AbortJob
- {
- mpQPrinter->Destroy();
- mpQPrinter = NULL;
- }
- EndPrint();
}
// -----------------------------------------------------------------------
@@ -1267,180 +1329,6 @@ IMPL_LINK( Printer, ImplDestroyPrinterAsync, void*, pSalPrinter )
// -----------------------------------------------------------------------
-void Printer::ImplUpdateQuickStatus()
-{
- // remove possibly added "IsQuickJob"
- if( mpPrinterData->mbNextJobIsQuick )
- {
- rtl::OUString aKey( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) );
- // const data means not really const, but change all references
- // to refcounted job setup
- ImplJobSetup* pImpSetup = maJobSetup.ImplGetConstData();
- pImpSetup->maValueMap.erase( aKey );
- mpPrinterData->mbNextJobIsQuick = false;
- }
-}
-
-class QuickGuard
-{
- Printer* mpPrinter;
- public:
- QuickGuard( Printer* pPrn ) : mpPrinter( pPrn ) {}
- ~QuickGuard()
- {
- mpPrinter->ImplUpdateQuickStatus();
- }
-};
-
-BOOL Printer::StartJob( const XubString& rJobName )
-{
- mnError = PRINTER_OK;
-
- if ( IsDisplayPrinter() )
- return FALSE;
-
- if ( IsJobActive() || IsPrinting() )
- return FALSE;
-
- if( mpPrinterData->mbNextJobIsQuick )
- {
- String aKey( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) );
- if( maJobSetup.GetValue( aKey ).Len() == 0 )
- maJobSetup.SetValue( aKey, String( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) );
- }
-
- QuickGuard aQGuard( this );
-
- ULONG nCopies = mnCopyCount;
- BOOL bCollateCopy = mbCollateCopy;
- BOOL bUserCopy = FALSE;
- if ( IsQueuePrinter() )
- {
- if ( ((ImplQPrinter*)this)->IsUserCopy() )
- {
- nCopies = 1;
- bCollateCopy = FALSE;
- }
- }
- else
- {
- if ( nCopies > 1 )
- {
- ULONG nDevCopy;
-
- if ( bCollateCopy )
- nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COLLATECOPIES );
- else
- nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COPIES );
-
- // Muessen Kopien selber gemacht werden?
- if ( nCopies > nDevCopy )
- {
- bUserCopy = TRUE;
- nCopies = 1;
- bCollateCopy = FALSE;
- }
- }
- else
- bCollateCopy = FALSE;
-
- // we need queue printing
- if( !mnPageQueueSize )
- mnPageQueueSize = 1;
- }
-
- if ( !mnPageQueueSize )
- {
- ImplSVData* pSVData = ImplGetSVData();
- mpPrinter = pSVData->mpDefInst->CreatePrinter( mpInfoPrinter );
-
- if ( !mpPrinter )
- return FALSE;
-
- XubString* pPrintFile;
- if ( mbPrintFile )
- pPrintFile = &maPrintFile;
- else
- pPrintFile = NULL;
-
- // #125075# StartJob can Reschedule on Windows, sfx
- // depends on IsPrinting() in case of closing a document
- BOOL bSaveNewJobSetup = mbNewJobSetup;
- mbNewJobSetup = FALSE;
- String aSaveJobName = maJobName;
- maJobName = rJobName;
- mnCurPage = 1;
- mnCurPrintPage = 1;
- mbPrinting = TRUE;
-
- if( ! ImplGetSVData()->maGDIData.mbPrinterPullModel )
- {
- // in the pull model the job can only be started when
- // we have collected all pages to be printed
- if ( !mpPrinter->StartJob( pPrintFile, rJobName, Application::GetDisplayName(),
- nCopies, bCollateCopy,
- maJobSetup.ImplGetConstData() ) )
- {
- mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() );
- if ( !mnError )
- mnError = PRINTER_GENERALERROR;
- pSVData->mpDefInst->DestroyPrinter( mpPrinter );
- mbNewJobSetup = bSaveNewJobSetup;
- maJobName = aSaveJobName;
- mnCurPage = 0;
- mnCurPrintPage = 0;
- mbPrinting = FALSE;
- mpPrinter = NULL;
- return FALSE;
- }
- }
-
- mbJobActive = TRUE;
- StartPrint();
- }
- else
- {
- mpQPrinter = new ImplQPrinter( this );
- if( mpInfoPrinter )
- mpQPrinter->Compat_OldPrinterMetrics( mpInfoPrinter->m_bCompatMetrics );
- mpQPrinter->SetDigitLanguage( GetDigitLanguage() );
- mpQPrinter->SetUserCopy( bUserCopy );
- mpQPrinter->SetPrinterOptions( *mpPrinterOptions );
-
- // #125075# StartJob can Reschedule on Windows, sfx
- // depends on IsPrinting() in case of closing a document
- BOOL bSaveNewJobSetup = mbNewJobSetup;
- mbNewJobSetup = FALSE;
- String aSaveJobName = maJobName;
- maJobName = rJobName;
- mnCurPage = 1;
- mbPrinting = TRUE;
-
- if ( mpQPrinter->StartJob( rJobName ) )
- {
- mbJobActive = TRUE;
- StartPrint();
- mpQPrinter->StartQueuePrint();
- }
- else
- {
- mbNewJobSetup = bSaveNewJobSetup;
- maJobName = aSaveJobName;
- mnCurPage = 0;
- mbPrinting = FALSE;
- mnError = mpQPrinter->GetErrorCode();
- mpQPrinter->Destroy();
- mpQPrinter = NULL;
- return FALSE;
- }
- }
-
-
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-
BOOL Printer::EndJob()
{
BOOL bRet = FALSE;
@@ -1451,7 +1339,7 @@ BOOL Printer::EndJob()
mbJobActive = FALSE;
- if ( mpPrinter || mpQPrinter )
+ if ( mpPrinter )
{
ImplReleaseGraphics();
@@ -1459,23 +1347,17 @@ BOOL Printer::EndJob()
bRet = TRUE;
- if ( mpPrinter )
- {
- mbPrinting = FALSE;
- mnCurPrintPage = 0;
- maJobName.Erase();
-
- mbDevOutput = FALSE;
- bRet = mpPrinter->EndJob();
- // Hier den Drucker nicht asyncron zerstoeren, da es
- // W95 nicht verkraftet, wenn gleichzeitig gedruckt wird
- // und ein Druckerobjekt zerstoert wird
- ImplGetSVData()->mpDefInst->DestroyPrinter( mpPrinter );
- mpPrinter = NULL;
- EndPrint();
- }
- else
- mpQPrinter->EndQueuePrint();
+ mbPrinting = FALSE;
+ mnCurPrintPage = 0;
+ maJobName.Erase();
+
+ mbDevOutput = FALSE;
+ bRet = mpPrinter->EndJob();
+ // Hier den Drucker nicht asyncron zerstoeren, da es
+ // W95 nicht verkraftet, wenn gleichzeitig gedruckt wird
+ // und ein Druckerobjekt zerstoert wird
+ ImplGetSVData()->mpDefInst->DestroyPrinter( mpPrinter );
+ mpPrinter = NULL;
}
return bRet;
@@ -1494,35 +1376,18 @@ BOOL Printer::AbortJob()
mbInPrintPage = FALSE;
mpJobGraphics = NULL;
- if ( mpPrinter || mpQPrinter )
+ if ( mpPrinter )
{
mbPrinting = FALSE;
mnCurPage = 0;
mnCurPrintPage = 0;
maJobName.Erase();
- if ( mpPrinter )
- {
- ImplReleaseGraphics();
- mbDevOutput = FALSE;
- mpPrinter->AbortJob();
- Application::PostUserEvent( LINK( this, Printer, ImplDestroyPrinterAsync ), mpPrinter );
- mpPrinter = NULL;
- EndPrint();
- }
- else
- {
- mpQPrinter->AbortQueuePrint();
- mpQPrinter->Destroy();
- mpQPrinter = NULL;
- if ( mpQMtf )
- {
- mpQMtf->Clear();
- delete mpQMtf;
- mpQMtf = NULL;
- }
- EndPrint();
- }
+ ImplReleaseGraphics();
+ mbDevOutput = FALSE;
+ mpPrinter->AbortJob();
+ Application::PostUserEvent( LINK( this, Printer, ImplDestroyPrinterAsync ), mpPrinter );
+ mpPrinter = NULL;
return TRUE;
}
@@ -1532,88 +1397,49 @@ BOOL Printer::AbortJob()
// -----------------------------------------------------------------------
-BOOL Printer::StartPage()
+void Printer::ImplStartPage()
{
if ( !IsJobActive() )
- return FALSE;
+ return;
- if ( mpPrinter || mpQPrinter )
+ if ( mpPrinter )
{
- if ( mpPrinter )
- {
- SalGraphics* pGraphics = mpPrinter->StartPage( maJobSetup.ImplGetConstData(), mbNewJobSetup );
- if ( pGraphics )
- {
- ImplReleaseGraphics();
- mpJobGraphics = pGraphics;
- }
- mbDevOutput = TRUE;
- }
- else
+ SalGraphics* pGraphics = mpPrinter->StartPage( maJobSetup.ImplGetConstData(), mbNewJobSetup );
+ if ( pGraphics )
{
- ImplGetGraphics();
- mpJobGraphics = mpGraphics;
+ ImplReleaseGraphics();
+ mpJobGraphics = pGraphics;
}
+ mbDevOutput = TRUE;
// PrintJob not aborted ???
if ( IsJobActive() )
{
mbInPrintPage = TRUE;
mnCurPage++;
- if ( mpQPrinter )
- {
- mpQPrinter->SetPrinterOptions( *mpPrinterOptions );
- mpQMtf = new GDIMetaFile;
- mpQMtf->Record( this );
- mpQMtf->SaveStatus();
- }
- else
- {
- mnCurPrintPage++;
- PrintPage();
- }
+ mnCurPrintPage++;
}
-
- return TRUE;
}
-
- return FALSE;
}
// -----------------------------------------------------------------------
-BOOL Printer::EndPage()
+void Printer::ImplEndPage()
{
if ( !IsJobActive() )
- return FALSE;
+ return;
mbInPrintPage = FALSE;
- if ( mpPrinter || mpQPrinter )
+ if ( mpPrinter )
{
- if ( mpPrinter )
- {
- mpPrinter->EndPage();
- ImplReleaseGraphics();
- mbDevOutput = FALSE;
- }
- else if ( mpQPrinter )
- {
- // Eigentuemeruebergang an QPrinter
- mpQMtf->Stop();
- mpQMtf->WindStart();
- GDIMetaFile* pPage = mpQMtf;
- mpQMtf = NULL;
- mpQPrinter->AddQueuePage( pPage, mnCurPage, mbNewJobSetup );
- }
+ mpPrinter->EndPage();
+ ImplReleaseGraphics();
+ mbDevOutput = FALSE;
mpJobGraphics = NULL;
mbNewJobSetup = FALSE;
-
- return TRUE;
}
-
- return FALSE;
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 685f68fe7af3..9d435af5f4b1 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -31,8 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#define _SPOOLPRINTER_EXT
-
#include <functional>
#include <algorithm>
#include <utility>
@@ -648,7 +646,9 @@ static bool ImplIsActionHandlingTransparency( const MetaAction& rAct )
bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
long nMaxBmpDPIX, long nMaxBmpDPIY,
bool bReduceTransparency, bool bTransparencyAutoMode,
- bool bDownsampleBitmaps )
+ bool bDownsampleBitmaps,
+ const Color& rBackground
+ )
{
MetaAction* pCurrAct;
bool bTransparent( false );
@@ -737,6 +737,20 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
bool bStillBackground=true; // true until first non-bg action
nActionNum=0; nLastBgAction=-1;
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction();
+ if( rBackground != Color( COL_TRANSPARENT ) )
+ {
+ aBackgroundComponent.aBgColor = rBackground;
+ if( meOutDevType == OUTDEV_PRINTER )
+ {
+ Printer* pThis = dynamic_cast<Printer*>(this);
+ Point aPageOffset = pThis->GetPageOffsetPixel();
+ aPageOffset = Point( 0, 0 ) - aPageOffset;
+ Size aSize = pThis->GetPaperSizePixel();
+ aBackgroundComponent.aBounds = Rectangle( aPageOffset, aSize );
+ }
+ else
+ aBackgroundComponent.aBounds = Rectangle( Point( 0, 0 ), GetOutputSizePixel() );
+ }
while( pCurrAct && bStillBackground )
{
switch( pCurrAct->GetType() )
@@ -880,7 +894,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
//
// if aBBCurrAct is empty, it will intersect with no
- // aCCList member. Thus, we can safe us the check.
+ // aCCList member. Thus, we can save the check.
// Furthermore, this ensures that non-output-generating
// actions get their own aCCList entry, which is necessary
// when copying them to the output metafile (see stage 4
@@ -1110,7 +1124,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
// ====================================================
//
- Point aTmpPoint;
+ Point aPageOffset;
Size aTmpSize( GetOutputSizePixel() );
if( mpPDFWriter )
{
@@ -1120,7 +1134,14 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
// also add error code to PDFWriter
mpPDFWriter->insertError( vcl::PDFWriter::Warning_Transparency_Converted );
}
- const Rectangle aOutputRect( aTmpPoint, aTmpSize );
+ else if( meOutDevType == OUTDEV_PRINTER )
+ {
+ Printer* pThis = dynamic_cast<Printer*>(this);
+ aPageOffset = pThis->GetPageOffsetPixel();
+ aPageOffset = Point( 0, 0 ) - aPageOffset;
+ aTmpSize = pThis->GetPaperSizePixel();
+ }
+ const Rectangle aOutputRect( aPageOffset, aTmpSize );
bool bTiling = dynamic_cast<Printer*>(this) != NULL;
// iterate over all aCCList members and generate bitmaps for the special ones
@@ -1228,7 +1249,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
pCurrAct->Execute( &aPaintVDev );
}
- if( !( nActionNum % 4 ) )
+ if( !( nActionNum % 8 ) )
Application::Reschedule();
}
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
new file mode 100644
index 000000000000..6778cfbc867e
--- /dev/null
+++ b/vcl/source/gdi/print3.cxx
@@ -0,0 +1,1765 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: print3.cxx,v $
+ * $Revision: 1.1.2.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_vcl.hxx"
+
+#include "vcl/print.hxx"
+#include "vcl/prndlg.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/svdata.hxx"
+#include "vcl/salinst.hxx"
+#include "vcl/salprn.hxx"
+#include "vcl/svids.hrc"
+#include "vcl/metaact.hxx"
+#include "vcl/msgbox.hxx"
+
+#include "tools/urlobj.hxx"
+
+#include "com/sun/star/ui/dialogs/XFilePicker.hpp"
+#include "com/sun/star/ui/dialogs/XFilterManager.hpp"
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp"
+#include "com/sun/star/view/DuplexMode.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/awt/Size.hpp"
+#include "comphelper/processfactory.hxx"
+
+#include <hash_map>
+#include <hash_set>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+using namespace vcl;
+
+class ImplPageCache
+{
+ struct CacheEntry
+ {
+ GDIMetaFile aPage;
+ PrinterController::PageSize aSize;
+ };
+
+ std::vector< CacheEntry > maPages;
+ std::vector< sal_Int32 > maPageNumbers;
+ std::vector< sal_Int32 > maCacheRanking;
+
+ static const sal_Int32 nCacheSize = 6;
+
+ void updateRanking( sal_Int32 nLastHit )
+ {
+ if( maCacheRanking[0] != nLastHit )
+ {
+ bool bMove = false;
+ for( sal_Int32 i = nCacheSize-1; i > 0; i-- )
+ {
+ if( maCacheRanking[i] == nLastHit )
+ bMove = true;
+ maCacheRanking[i] = maCacheRanking[i-1];
+ }
+ maCacheRanking[0] = nLastHit;
+ }
+ }
+
+public:
+ ImplPageCache()
+ : maPages( nCacheSize )
+ , maPageNumbers( nCacheSize, -1 )
+ , maCacheRanking( nCacheSize )
+ {
+ for( sal_Int32 i = 0; i < nCacheSize; i++ )
+ maCacheRanking[i] = nCacheSize - i - 1;
+ }
+
+ // caution: does not ensure uniqueness
+ void insert( sal_Int32 i_nPageNo, const GDIMetaFile& i_rPage, const PrinterController::PageSize& i_rSize )
+ {
+ sal_Int32 nReplacePage = maCacheRanking.back();
+ maPages[ nReplacePage ].aPage = i_rPage;
+ maPages[ nReplacePage ].aSize = i_rSize;
+ maPageNumbers[ nReplacePage ] = i_nPageNo;
+ // cache insertion means in our case, the page was just queried
+ // so update the ranking
+ updateRanking( nReplacePage );
+ }
+
+ // caution: bad algorithm; should there ever be reason to increase the cache size beyond 6
+ // this needs to be urgently rewritten. However do NOT increase the cache size lightly,
+ // whole pages can be rather memory intensive
+ bool get( sal_Int32 i_nPageNo, GDIMetaFile& o_rPageFile, PrinterController::PageSize& o_rSize )
+ {
+ for( sal_Int32 i = 0; i < nCacheSize; ++i )
+ {
+ if( maPageNumbers[i] == i_nPageNo )
+ {
+ updateRanking( i );
+ o_rPageFile = maPages[i].aPage;
+ o_rSize = maPages[i].aSize;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ void invalidate()
+ {
+ for( sal_Int32 i = 0; i < nCacheSize; ++i )
+ {
+ maPageNumbers[i] = -1;
+ maPages[i].aPage.Clear();
+ maCacheRanking[i] = nCacheSize - i - 1;
+ }
+ }
+};
+
+class vcl::ImplPrinterControllerData
+{
+public:
+ struct ControlDependency
+ {
+ rtl::OUString maDependsOnName;
+ sal_Int32 mnDependsOnEntry;
+
+ ControlDependency() : mnDependsOnEntry( -1 ) {}
+ };
+
+ typedef std::hash_map< rtl::OUString, size_t, rtl::OUStringHash > PropertyToIndexMap;
+ typedef std::hash_map< rtl::OUString, ControlDependency, rtl::OUStringHash > ControlDependencyMap;
+
+ boost::shared_ptr<Printer> mpPrinter;
+ Sequence< PropertyValue > maUIOptions;
+ std::vector< PropertyValue > maUIProperties;
+ std::vector< bool > maUIPropertyEnabled;
+ PropertyToIndexMap maPropertyToIndex;
+ Link maOptionChangeHdl;
+ ControlDependencyMap maControlDependencies;
+ sal_Bool mbFirstPage;
+ sal_Bool mbLastPage;
+ sal_Bool mbReversePageOrder;
+ view::PrintableState meJobState;
+
+ vcl::PrinterController::MultiPageSetup maMultiPage;
+
+ vcl::PrintProgressDialog* mpProgress;
+
+ ImplPageCache maPageCache;
+
+ // set by user through printer config dialog
+ // if set, pages are centered and trimmed onto the fixed page
+ Size maFixedPageSize;
+
+ ImplPrinterControllerData() :
+ mbFirstPage( sal_True ),
+ mbLastPage( sal_False ),
+ mbReversePageOrder( sal_False ),
+ meJobState( view::PrintableState_JOB_STARTED ),
+ mpProgress( NULL )
+ {}
+ ~ImplPrinterControllerData() { delete mpProgress; }
+
+ Size getRealPaperSize( const Size& i_rPageSize ) const
+ {
+ if( maFixedPageSize.Width() > 0 && maFixedPageSize.Height() > 0 )
+ return maFixedPageSize;
+ if( maMultiPage.nRows * maMultiPage.nColumns > 1 )
+ 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::PrinterController()
+ : mpImplData( new ImplPrinterControllerData )
+{
+}
+
+PrinterController::PrinterController( const boost::shared_ptr<Printer>& i_pPrinter )
+ : mpImplData( new ImplPrinterControllerData )
+{
+ mpImplData->mpPrinter = i_pPrinter;
+}
+
+static rtl::OUString queryFile( Printer* pPrinter )
+{
+ rtl::OUString aResult;
+
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ if( xFactory.is() )
+ {
+ uno::Sequence< uno::Any > aTempl( 1 );
+ aTempl.getArray()[0] <<= ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION;
+ uno::Reference< ui::dialogs::XFilePicker > xFilePicker(
+ xFactory->createInstanceWithArguments(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ),
+ aTempl ), uno::UNO_QUERY );
+ DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" );
+
+ uno::Reference< ui::dialogs::XFilterManager > xFilterMgr( xFilePicker, uno::UNO_QUERY );
+ if( xFilePicker.is() && xFilterMgr.is() )
+ {
+ try
+ {
+#ifdef UNX
+ // add PostScript and PDF
+ bool bPS = true, bPDF = true;
+ if( pPrinter )
+ {
+ if( pPrinter->GetCapabilities( PRINTER_CAPABILITIES_PDF ) )
+ bPS = false;
+ else
+ bPDF = false;
+ }
+ if( bPS )
+ xFilterMgr->appendFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PostScript" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.ps" ) ) );
+ if( bPDF )
+ xFilterMgr->appendFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Portable Document Format" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.pdf" ) ) );
+#elif defined WNT
+ (void)pPrinter;
+ xFilterMgr->appendFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.PRN" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.prn" ) ) );
+#endif
+ // add arbitrary files
+ xFilterMgr->appendFilter( String( VclResId( SV_STDTEXT_ALLFILETYPES ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.*" ) ) );
+ }
+ catch( lang::IllegalArgumentException rExc )
+ {
+ DBG_ERRORFILE( "caught IllegalArgumentException when registering filter\n" );
+ }
+
+ if( xFilePicker->execute() == ui::dialogs::ExecutableDialogResults::OK )
+ {
+ uno::Sequence< ::rtl::OUString > aPathSeq( xFilePicker->getFiles() );
+ INetURLObject aObj( aPathSeq[0] );
+ aResult = aObj.PathToFileName();
+ }
+ }
+ }
+ return aResult;
+}
+
+struct PrintJobAsync
+{
+ boost::shared_ptr<PrinterController> mpController;
+ JobSetup maInitSetup;
+
+ PrintJobAsync( const boost::shared_ptr<PrinterController>& i_pController,
+ const JobSetup& i_rInitSetup
+ )
+ : mpController( i_pController ), maInitSetup( i_rInitSetup )
+ {}
+
+ DECL_LINK( ExecJob, void* );
+};
+
+IMPL_LINK( PrintJobAsync, ExecJob, void*, EMPTYARG )
+{
+ Printer::ImplPrintJob( mpController, maInitSetup );
+
+ // clean up, do not access members after this
+ delete this;
+
+ return 0;
+}
+
+void Printer::PrintJob( const boost::shared_ptr<PrinterController>& i_pController,
+ const JobSetup& i_rInitSetup
+ )
+{
+ sal_Bool bSynchronous = sal_False;
+ beans::PropertyValue* pVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Wait" ) ) );
+ if( pVal )
+ pVal->Value >>= bSynchronous;
+
+ if( bSynchronous )
+ ImplPrintJob( i_pController, i_rInitSetup );
+ else
+ {
+ PrintJobAsync* pAsync = new PrintJobAsync( i_pController, i_rInitSetup );
+ Application::PostUserEvent( LINK( pAsync, PrintJobAsync, ExecJob ) );
+ }
+}
+
+void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pController,
+ const JobSetup& i_rInitSetup
+ )
+{
+ boost::shared_ptr<PrinterController> pController( i_pController );
+
+ // check if there is a default printer; if not, show an error box (if appropriate)
+ if( GetDefaultPrinterName().Len() == 0 )
+ {
+ if( pController->isShowDialogs()
+ // && ! pController->isDirectPrint()
+ )
+ {
+ ErrorBox aBox( NULL, VclResId( SV_PRINT_NOPRINTERWARNING ) );
+ aBox.Execute();
+ }
+ pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDirect" ) ),
+ makeAny( sal_False ) );
+ }
+
+ // setup printer
+
+ // if no specific printer is already set, create one
+ if( ! pController->getPrinter() )
+ {
+ boost::shared_ptr<Printer> pPrinter( new Printer( i_rInitSetup.GetPrinterName() ) );
+ pController->setPrinter( pPrinter );
+ }
+
+ // reset last page property
+ i_pController->setLastPage( sal_False );
+
+ // update "PageRange" property inferring from other properties:
+ // case 1: "Pages" set from UNO API ->
+ // setup "Print Selection" and insert "PageRange" attribute
+ // case 2: "All pages" is selected
+ // update "Page range" attribute to have a sensible default,
+ // but leave "All" as selected
+
+ // "Pages" attribute from API is now equivalent to "PageRange"
+ // AND "PrintContent" = 1 except calc where it is "PrintRange" = 1
+ // Argh ! That sure needs cleaning up
+ beans::PropertyValue* pContentVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ) );
+ if( ! pContentVal )
+ pContentVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ) );
+
+ // case 1: UNO API has set "Pages"
+ beans::PropertyValue* pPagesVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) );
+ if( pPagesVal )
+ {
+ rtl::OUString aPagesVal;
+ pPagesVal->Value >>= aPagesVal;
+ if( aPagesVal.getLength() )
+ {
+ // "Pages" attribute from API is now equivalent to "PageRange"
+ // AND "PrintContent" = 1 except calc where it is "PrintRange" = 1
+ // Argh ! That sure needs cleaning up
+ if( pContentVal )
+ {
+ pContentVal->Value = makeAny( sal_Int32( 1 ) );
+ i_pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), pPagesVal->Value );
+ }
+ }
+ }
+ // case 2: is "All" selected ?
+ else if( pContentVal )
+ {
+ sal_Int32 nContent = -1;
+ if( pContentVal->Value >>= nContent )
+ {
+ if( nContent == 0 )
+ {
+ sal_Int32 nPages = i_pController->getPageCount();
+ if( nPages > 0 )
+ {
+ rtl::OUStringBuffer aBuf( 32 );
+ aBuf.appendAscii( "1" );
+ if( nPages > 1 )
+ {
+ aBuf.appendAscii( "-" );
+ aBuf.append( nPages );
+ }
+ i_pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), makeAny( aBuf.makeStringAndClear() ) );
+ }
+ }
+ }
+ }
+
+ beans::PropertyValue* pReverseVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverse" ) ) );
+ if( pReverseVal )
+ {
+ sal_Bool bReverse = sal_False;
+ pReverseVal->Value >>= bReverse;
+ pController->setReversePrint( bReverse );
+ }
+
+ // in direct print case check whether there is anything to print.
+ // if not, show an errorbox (if appropriate)
+ if( pController->isShowDialogs() && pController->isDirectPrint() )
+ {
+ if( pController->getFilteredPageCount() == 0 )
+ {
+ ErrorBox aBox( NULL, VclResId( SV_PRINT_NOCONTENT ) );
+ aBox.Execute();
+ return;
+ }
+ }
+
+ // check if the printer brings up its own dialog
+ // in that case leave the work to that dialog
+ if( ! pController->getPrinter()->GetCapabilities( PRINTER_CAPABILITIES_EXTERNALDIALOG ) &&
+ ! pController->isDirectPrint() &&
+ pController->isShowDialogs()
+ )
+ {
+ try
+ {
+ PrintDialog aDlg( NULL, i_pController );
+ if( ! aDlg.Execute() )
+ {
+ GDIMetaFile aPageFile;
+ i_pController->setLastPage( sal_True );
+ i_pController->getFilteredPageFile( 0, aPageFile );
+ return;
+ }
+ if( aDlg.isPrintToFile() )
+ {
+ rtl::OUString aFile = queryFile( pController->getPrinter().get() );
+ if( ! aFile.getLength() )
+ {
+ GDIMetaFile aPageFile;
+ i_pController->setLastPage( sal_True );
+ i_pController->getFilteredPageFile( 0, aPageFile );
+ return;
+ }
+ pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalFileName" ) ),
+ makeAny( aFile ) );
+ }
+ }
+ catch( std::bad_alloc& )
+ {
+ }
+ }
+
+ pController->pushPropertiesToPrinter();
+
+ rtl::OUString aJobName;
+ beans::PropertyValue* pJobNameVal = pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ) );
+ if( pJobNameVal )
+ pJobNameVal->Value >>= aJobName;
+
+ pController->getPrinter()->StartJob( String( aJobName ), pController );
+
+ pController->jobFinished( pController->getJobState() );
+}
+
+bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl::PrinterController>& i_pController )
+{
+ mnError = PRINTER_OK;
+
+ if ( IsDisplayPrinter() )
+ return FALSE;
+
+ if ( IsJobActive() || IsPrinting() )
+ return FALSE;
+
+ ULONG nCopies = mnCopyCount;
+ bool bCollateCopy = mbCollateCopy;
+ bool bUserCopy = FALSE;
+
+ if ( nCopies > 1 )
+ {
+ ULONG nDevCopy;
+
+ if ( bCollateCopy )
+ nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COLLATECOPIES );
+ else
+ nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COPIES );
+
+ // need to do copies by hand ?
+ if ( nCopies > nDevCopy )
+ {
+ bUserCopy = TRUE;
+ nCopies = 1;
+ bCollateCopy = FALSE;
+ }
+ }
+ else
+ bCollateCopy = FALSE;
+
+
+ ImplSVData* pSVData = ImplGetSVData();
+ mpPrinter = pSVData->mpDefInst->CreatePrinter( mpInfoPrinter );
+
+ if ( !mpPrinter )
+ return FALSE;
+
+ // 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 )
+ {
+ rtl::OUString aFile;
+ pFileValue->Value >>= aFile;
+ if( aFile.getLength() )
+ {
+ mbPrintFile = TRUE;
+ maPrintFile = aFile;
+ }
+ }
+
+ XubString* pPrintFile = NULL;
+ if ( mbPrintFile )
+ pPrintFile = &maPrintFile;
+
+ maJobName = i_rJobName;
+ mnCurPage = 1;
+ mnCurPrintPage = 1;
+ mbPrinting = TRUE;
+ if( ImplGetSVData()->maGDIData.mbPrinterPullModel )
+ {
+ mbJobActive = 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
+ // it also must set the JobState of the Controller
+ if( mpPrinter->StartJob( pPrintFile,
+ i_rJobName,
+ Application::GetDisplayName(),
+ maJobSetup.ImplGetConstData(),
+ *i_pController ) )
+ {
+ EndJob();
+ }
+ else
+ {
+ mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() );
+ if ( !mnError )
+ mnError = PRINTER_GENERALERROR;
+ pSVData->mpDefInst->DestroyPrinter( mpPrinter );
+ mnCurPage = 0;
+ mnCurPrintPage = 0;
+ mbPrinting = FALSE;
+ mpPrinter = NULL;
+
+ return false;
+ }
+ }
+ else
+ {
+ // possibly a dialog has been shown
+ // now the real job starts
+ i_pController->setJobState( view::PrintableState_JOB_STARTED );
+ i_pController->jobStarted();
+
+ if( mpPrinter->StartJob( pPrintFile,
+ i_rJobName,
+ Application::GetDisplayName(),
+ nCopies,
+ bCollateCopy,
+ i_pController->isDirectPrint(),
+ maJobSetup.ImplGetConstData() ) )
+ {
+ mbJobActive = TRUE;
+ i_pController->createProgressDialog();
+ int nPages = i_pController->getFilteredPageCount();
+ int nRepeatCount = bUserCopy ? mnCopyCount : 1;
+ for( int nIteration = 0; nIteration < nRepeatCount; nIteration++ )
+ {
+ for( int nPage = 0; nPage < nPages; nPage++ )
+ {
+ if( nPage == nPages-1 && nIteration == nRepeatCount-1 )
+ i_pController->setLastPage( sal_True );
+ i_pController->printFilteredPage( nPage );
+ }
+ // FIXME: duplex ?
+ }
+ EndJob();
+
+ if( i_pController->getJobState() == view::PrintableState_JOB_STARTED )
+ i_pController->setJobState( view::PrintableState_JOB_SPOOLED );
+ }
+ else
+ {
+ mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() );
+ if ( !mnError )
+ mnError = PRINTER_GENERALERROR;
+ i_pController->setJobState( mnError == PRINTER_ABORT
+ ? view::PrintableState_JOB_ABORTED
+ : view::PrintableState_JOB_FAILED );
+ pSVData->mpDefInst->DestroyPrinter( mpPrinter );
+ mnCurPage = 0;
+ mnCurPrintPage = 0;
+ mbPrinting = FALSE;
+ mpPrinter = NULL;
+
+ return false;
+ }
+ }
+
+ return true;
+}
+
+PrinterController::~PrinterController()
+{
+ delete mpImplData;
+}
+
+view::PrintableState PrinterController::getJobState() const
+{
+ return mpImplData->meJobState;
+}
+
+void PrinterController::setJobState( view::PrintableState i_eState )
+{
+ mpImplData->meJobState = i_eState;
+}
+
+const boost::shared_ptr<Printer>& PrinterController::getPrinter() const
+{
+ return mpImplData->mpPrinter;
+}
+
+void PrinterController::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter )
+{
+ mpImplData->mpPrinter = i_rPrinter;
+ setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ),
+ makeAny( rtl::OUString( i_rPrinter->GetName() ) ) );
+}
+
+bool PrinterController::setupPrinter( Window* i_pParent )
+{
+ bool bRet = false;
+ if( mpImplData->mpPrinter.get() )
+ {
+ Size aPaperSize( mpImplData->mpPrinter->PixelToLogic(
+ mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
+ bRet = mpImplData->mpPrinter->Setup( i_pParent );
+ if( bRet )
+ {
+ // was the papersize overridden ? if so we need to take action
+ Size aNewPaperSize( mpImplData->mpPrinter->PixelToLogic(
+ mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
+ if( aNewPaperSize != aPaperSize )
+ {
+ mpImplData->maFixedPageSize = aNewPaperSize;
+ mpImplData->maPageCache.invalidate();
+ awt::Size aOverrideSize;
+ aOverrideSize.Width = aNewPaperSize.Width();
+ aOverrideSize.Height = aNewPaperSize.Height();
+ setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OverridePageSize" ) ),
+ makeAny( aOverrideSize ) );
+ }
+ }
+ }
+ return bRet;
+}
+
+PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( const Sequence< PropertyValue >& i_rProps )
+{
+ PrinterController::PageSize aPageSize;
+ aPageSize.aSize = mpPrinter->GetPaperSize();
+ for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty )
+ {
+ if( i_rProps[ nProperty ].Name.equalsAscii( "PageSize" ) )
+ {
+ awt::Size aSize;
+ i_rProps[ nProperty].Value >>= aSize;
+ aPageSize.aSize.Width() = aSize.Width;
+ aPageSize.aSize.Height() = aSize.Height;
+
+ Size aCurSize( mpPrinter->GetPaperSize() );
+ Size aRealPaperSize( getRealPaperSize( aPageSize.aSize ) );
+ if( aRealPaperSize != aCurSize )
+ mpPrinter->SetPaperSizeUser( aRealPaperSize, ! isFixedPageSize() );
+ }
+ if( i_rProps[ nProperty ].Name.equalsAscii( "PageIncludesNonprintableArea" ) )
+ {
+ sal_Bool bVal = sal_False;
+ i_rProps[ nProperty].Value >>= bVal;
+ aPageSize.bFullPaper = static_cast<bool>(bVal);
+ }
+ }
+ return aPageSize;
+}
+
+int PrinterController::getPageCountProtected() const
+{
+ const MapMode aMapMode( MAP_100TH_MM );
+
+ mpImplData->mpPrinter->Push();
+ mpImplData->mpPrinter->SetMapMode( aMapMode );
+ int nPages = getPageCount();
+ mpImplData->mpPrinter->Pop();
+ return nPages;
+}
+
+Sequence< beans::PropertyValue > PrinterController::getPageParametersProtected( int i_nPage ) const
+{
+ const MapMode aMapMode( MAP_100TH_MM );
+
+ mpImplData->mpPrinter->Push();
+ mpImplData->mpPrinter->SetMapMode( aMapMode );
+ Sequence< beans::PropertyValue > aResult( getPageParameters( i_nPage ) );
+ mpImplData->mpPrinter->Pop();
+ return aResult;
+}
+
+PrinterController::PageSize PrinterController::getPageFile( int i_nUnfilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache )
+{
+ // update progress if necessary
+ if( mpImplData->mpProgress )
+ {
+ // do nothing if printing is canceled
+ if( mpImplData->mpProgress->isCanceled() )
+ return PrinterController::PageSize();
+ mpImplData->mpProgress->tick();
+ Application::Reschedule( true );
+ }
+
+ if( i_bMayUseCache )
+ {
+ PrinterController::PageSize aPageSize;
+ if( mpImplData->maPageCache.get( i_nUnfilteredPage, o_rMtf, aPageSize ) )
+ {
+ return aPageSize;
+ }
+ }
+ else
+ mpImplData->maPageCache.invalidate();
+
+ o_rMtf.Clear();
+
+ // get page parameters
+ Sequence< PropertyValue > aPageParm( getPageParametersProtected( i_nUnfilteredPage ) );
+ const MapMode aMapMode( MAP_100TH_MM );
+
+ mpImplData->mpPrinter->Push();
+ mpImplData->mpPrinter->SetMapMode( aMapMode );
+
+ // modify job setup if necessary
+ PrinterController::PageSize aPageSize = mpImplData->modifyJobSetup( aPageParm );
+
+ o_rMtf.SetPrefSize( aPageSize.aSize );
+ o_rMtf.SetPrefMapMode( aMapMode );
+
+ mpImplData->mpPrinter->EnableOutput( FALSE );
+
+ o_rMtf.Record( mpImplData->mpPrinter.get() );
+
+ printPage( i_nUnfilteredPage );
+
+ o_rMtf.Stop();
+ o_rMtf.WindStart();
+ mpImplData->mpPrinter->Pop();
+
+ if( i_bMayUseCache )
+ mpImplData->maPageCache.insert( i_nUnfilteredPage, o_rMtf, aPageSize );
+
+ // reset "FirstPage" property to false now we've gotten at least our first one
+ mpImplData->mbFirstPage = sal_False;
+
+ return aPageSize;
+}
+
+static void appendSubPage( GDIMetaFile& o_rMtf, const Rectangle& i_rClipRect, GDIMetaFile& io_rSubPage, bool i_bDrawBorder )
+{
+ // intersect all clipregion actions with our clip rect
+ io_rSubPage.WindStart();
+ io_rSubPage.Clip( i_rClipRect );
+
+ // save gstate
+ o_rMtf.AddAction( new MetaPushAction( PUSH_ALL ) );
+
+ // clip to page rect
+ o_rMtf.AddAction( new MetaClipRegionAction( Region( i_rClipRect ), TRUE ) );
+
+ // append the subpage
+ io_rSubPage.WindStart();
+ io_rSubPage.Play( o_rMtf );
+
+ // restore gstate
+ o_rMtf.AddAction( new MetaPopAction() );
+
+ // draw a border
+ if( i_bDrawBorder )
+ {
+ // save gstate
+ o_rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_CLIPREGION | PUSH_MAPMODE ) );
+ 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 MetaRectAction( aBorderRect ) );
+
+ // restore gstate
+ o_rMtf.AddAction( new MetaPopAction() );
+ }
+}
+
+PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache )
+{
+ const MultiPageSetup& rMPS( mpImplData->maMultiPage );
+ int nSubPages = rMPS.nRows * rMPS.nColumns;
+ if( nSubPages < 1 )
+ nSubPages = 1;
+
+ // reverse sheet order
+ if( mpImplData->mbReversePageOrder )
+ {
+ int nDocPages = getFilteredPageCount();
+ i_nFilteredPage = nDocPages - 1 - i_nFilteredPage;
+ }
+
+ // there is no filtering to be done (and possibly the page size of the
+ // original page is to be set), when N-Up is "neutral" that is there is
+ // only one subpage and the margins are 0
+ if( nSubPages == 1 &&
+ rMPS.nLeftMargin == 0 && rMPS.nRightMargin == 0 &&
+ rMPS.nTopMargin == 0 && rMPS.nBottomMargin == 0 )
+ {
+ PrinterController::PageSize aPageSize = getPageFile( i_nFilteredPage, o_rMtf, i_bMayUseCache );
+ Size aPaperSize = mpImplData->getRealPaperSize( aPageSize.aSize );
+ mpImplData->mpPrinter->SetMapMode( MapMode( MAP_100TH_MM ) );
+ mpImplData->mpPrinter->SetPaperSizeUser( aPaperSize, ! mpImplData->isFixedPageSize() );
+ if( aPaperSize != aPageSize.aSize )
+ {
+ // user overridden page size, center Metafile
+ o_rMtf.WindStart();
+ long nDX = (aPaperSize.Width() - aPageSize.aSize.Width()) / 2;
+ long nDY = (aPaperSize.Height() - aPageSize.aSize.Height()) / 2;
+ o_rMtf.Move( nDX, nDY );
+ o_rMtf.WindStart();
+ o_rMtf.SetPrefSize( aPaperSize );
+ aPageSize.aSize = aPaperSize;
+ }
+ return aPageSize;
+ }
+
+ // set last page property really only on the very last page to be rendered
+ // that is on the last subpage of a NUp run
+ sal_Bool bIsLastPage = mpImplData->mbLastPage;
+ mpImplData->mbLastPage = sal_False;
+
+ Size aPaperSize( mpImplData->getRealPaperSize( mpImplData->maMultiPage.aPaperSize ) );
+
+ // 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
+ Size aMPArea( aPaperSize );
+ aMPArea.Width() -= rMPS.nLeftMargin + rMPS.nRightMargin;
+ aMPArea.Width() += rMPS.nHorizontalSpacing;
+ aMPArea.Height() -= rMPS.nTopMargin + rMPS.nBottomMargin;
+ aMPArea.Height() += rMPS.nVerticalSpacing;
+
+ // determine offsets
+ long nAdvX = aMPArea.Width() / rMPS.nColumns;
+ long nAdvY = aMPArea.Height() / rMPS.nRows;
+
+ // determine size of a "cell" subpage, leave a little space around pages
+ Size aSubPageSize( nAdvX - rMPS.nHorizontalSpacing, nAdvY - rMPS.nVerticalSpacing );
+
+ o_rMtf.Clear();
+ o_rMtf.SetPrefSize( aPaperSize );
+ o_rMtf.SetPrefMapMode( MapMode( MAP_100TH_MM ) );
+ o_rMtf.AddAction( new MetaMapModeAction( MapMode( MAP_100TH_MM ) ) );
+
+ int nDocPages = getPageCountProtected();
+ for( int nSubPage = 0; nSubPage < nSubPages; nSubPage++ )
+ {
+ // map current sub page to real page
+ int nPage = (i_nFilteredPage * nSubPages + nSubPage) / rMPS.nRepeat;
+ if( nSubPage == nSubPages-1 ||
+ nPage == nDocPages-1 )
+ {
+ mpImplData->mbLastPage = bIsLastPage;
+ }
+ if( nPage >= 0 && nPage < nDocPages )
+ {
+ GDIMetaFile aPageFile;
+ PrinterController::PageSize aPageSize = getPageFile( nPage, aPageFile, i_bMayUseCache );
+ if( aPageSize.aSize.Width() && aPageSize.aSize.Height() )
+ {
+ long nCellX = 0, nCellY = 0;
+ switch( rMPS.nOrder )
+ {
+ case PrinterController::LRTB:
+ nCellX = (nSubPage % rMPS.nColumns);
+ nCellY = (nSubPage / rMPS.nColumns);
+ break;
+ case PrinterController::TBLR:
+ nCellX = (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());
+ double fScaleY = double(aSubPageSize.Height())/double(aPageSize.aSize.Height());
+ double fScale = std::min( fScaleX, fScaleY );
+ aPageFile.Scale( fScale, fScale );
+ aPageFile.WindStart();
+
+ // move the subpage so it is centered in its "cell"
+ long nOffX = (aSubPageSize.Width() - long(double(aPageSize.aSize.Width()) * fScale)) / 2;
+ long nOffY = (aSubPageSize.Height() - long(double(aPageSize.aSize.Height()) * fScale)) / 2;
+ long nX = rMPS.nLeftMargin + nOffX + nAdvX * nCellX;
+ long nY = rMPS.nTopMargin + nOffY + nAdvY * nCellY;
+ aPageFile.Move( nX, nY );
+ aPageFile.WindStart();
+ // calculate border rectangle
+ Rectangle aSubPageRect( Point( nX, nY ),
+ Size( long(double(aPageSize.aSize.Width())*fScale),
+ long(double(aPageSize.aSize.Height())*fScale) ) );
+
+ // append subpage to page
+ appendSubPage( o_rMtf, aSubPageRect, aPageFile, rMPS.bDrawBorder );
+ }
+ }
+ }
+ o_rMtf.WindStart();
+
+ // subsequent getPageFile calls have changed the paper, reset it to current value
+ mpImplData->mpPrinter->SetMapMode( MapMode( MAP_100TH_MM ) );
+ mpImplData->mpPrinter->SetPaperSizeUser( aPaperSize, ! mpImplData->isFixedPageSize() );
+
+ return PrinterController::PageSize( aPaperSize, true );
+}
+
+int PrinterController::getFilteredPageCount()
+{
+ int nDiv = mpImplData->maMultiPage.nRows * mpImplData->maMultiPage.nColumns;
+ if( nDiv < 1 )
+ nDiv = 1;
+ return (getPageCountProtected() * mpImplData->maMultiPage.nRepeat + (nDiv-1)) / nDiv;
+}
+
+ULONG PrinterController::removeTransparencies( GDIMetaFile& i_rIn, GDIMetaFile& o_rOut )
+{
+ ULONG nRestoreDrawMode = mpImplData->mpPrinter->GetDrawMode();
+ sal_Int32 nMaxBmpDPIX = mpImplData->mpPrinter->ImplGetDPIX();
+ sal_Int32 nMaxBmpDPIY = mpImplData->mpPrinter->ImplGetDPIY();
+
+ const PrinterOptions& rPrinterOptions = mpImplData->mpPrinter->GetPrinterOptions();
+
+ static const sal_Int32 OPTIMAL_BMP_RESOLUTION = 300;
+ static const sal_Int32 NORMAL_BMP_RESOLUTION = 200;
+
+
+ if( rPrinterOptions.IsReduceBitmaps() )
+ {
+ // calculate maximum resolution for bitmap graphics
+ if( PRINTER_BITMAP_OPTIMAL == rPrinterOptions.GetReducedBitmapMode() )
+ {
+ nMaxBmpDPIX = std::min( sal_Int32(OPTIMAL_BMP_RESOLUTION), nMaxBmpDPIX );
+ nMaxBmpDPIY = std::min( sal_Int32(OPTIMAL_BMP_RESOLUTION), nMaxBmpDPIY );
+ }
+ else if( PRINTER_BITMAP_NORMAL == rPrinterOptions.GetReducedBitmapMode() )
+ {
+ nMaxBmpDPIX = std::min( sal_Int32(NORMAL_BMP_RESOLUTION), nMaxBmpDPIX );
+ nMaxBmpDPIY = std::min( sal_Int32(NORMAL_BMP_RESOLUTION), nMaxBmpDPIY );
+ }
+ else
+ {
+ nMaxBmpDPIX = std::min( sal_Int32(rPrinterOptions.GetReducedBitmapResolution()), nMaxBmpDPIX );
+ nMaxBmpDPIY = std::min( sal_Int32(rPrinterOptions.GetReducedBitmapResolution()), nMaxBmpDPIY );
+ }
+ }
+
+ // convert to greysacles
+ if( rPrinterOptions.IsConvertToGreyscales() )
+ {
+ mpImplData->mpPrinter->SetDrawMode( mpImplData->mpPrinter->GetDrawMode() |
+ ( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT |
+ DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) );
+ }
+
+ // disable transparency output
+ if( rPrinterOptions.IsReduceTransparency() && ( PRINTER_TRANSPARENCY_NONE == rPrinterOptions.GetReducedTransparencyMode() ) )
+ {
+ mpImplData->mpPrinter->SetDrawMode( mpImplData->mpPrinter->GetDrawMode() | DRAWMODE_NOTRANSPARENCY );
+ }
+
+ Color aBg( COL_TRANSPARENT ); // default: let RemoveTransparenciesFromMetaFile do its own background logic
+ if( mpImplData->maMultiPage.nRows * mpImplData->maMultiPage.nColumns > 1 )
+ {
+ // in N-Up printing we have no "page" background operation
+ // we also have no way to determine the paper color
+ // so let's go for white, which will kill 99.9% of the real cases
+ aBg = Color( COL_WHITE );
+ }
+ mpImplData->mpPrinter->RemoveTransparenciesFromMetaFile( i_rIn, o_rOut, nMaxBmpDPIX, nMaxBmpDPIY,
+ rPrinterOptions.IsReduceTransparency(),
+ rPrinterOptions.GetReducedTransparencyMode() == PRINTER_TRANSPARENCY_AUTO,
+ rPrinterOptions.IsReduceBitmaps() && rPrinterOptions.IsReducedBitmapIncludesTransparency(),
+ aBg
+ );
+ return nRestoreDrawMode;
+}
+
+void PrinterController::printFilteredPage( int i_nPage )
+{
+ if( mpImplData->meJobState != view::PrintableState_JOB_STARTED )
+ return;
+
+ GDIMetaFile aPageFile;
+ PrinterController::PageSize aPageSize = getFilteredPageFile( i_nPage, aPageFile );
+
+ if( mpImplData->mpProgress )
+ {
+ // do nothing if printing is canceled
+ if( mpImplData->mpProgress->isCanceled() )
+ {
+ setJobState( view::PrintableState_JOB_ABORTED );
+ return;
+ }
+ }
+
+ // in N-Up printing set the correct page size
+ mpImplData->mpPrinter->SetMapMode( MAP_100TH_MM );
+ // aPageSize was filtered through mpImplData->getRealPaperSize already by getFilteredPageFile()
+ mpImplData->mpPrinter->SetPaperSizeUser( aPageSize.aSize, ! mpImplData->isFixedPageSize() );
+
+ // if full paper are is meant, move the output to accomodate for pageoffset
+ if( aPageSize.bFullPaper )
+ {
+ Point aPageOffset( mpImplData->mpPrinter->GetPageOffset() );
+ aPageFile.WindStart();
+ aPageFile.Move( -aPageOffset.X(), -aPageOffset.Y() );
+ }
+
+ GDIMetaFile aCleanedFile;
+ ULONG nRestoreDrawMode = removeTransparencies( aPageFile, aCleanedFile );
+
+ mpImplData->mpPrinter->EnableOutput( TRUE );
+
+ // actually print the page
+ mpImplData->mpPrinter->ImplStartPage();
+
+ mpImplData->mpPrinter->Push();
+ aCleanedFile.WindStart();
+ aCleanedFile.Play( mpImplData->mpPrinter.get() );
+ mpImplData->mpPrinter->Pop();
+
+ mpImplData->mpPrinter->ImplEndPage();
+
+ mpImplData->mpPrinter->SetDrawMode( nRestoreDrawMode );
+}
+
+void PrinterController::jobStarted()
+{
+}
+
+void PrinterController::jobFinished( view::PrintableState )
+{
+}
+
+void PrinterController::abortJob()
+{
+ setJobState( view::PrintableState_JOB_ABORTED );
+}
+
+void PrinterController::setLastPage( sal_Bool i_bLastPage )
+{
+ mpImplData->mbLastPage = i_bLastPage;
+}
+
+void PrinterController::setReversePrint( sal_Bool i_bReverse )
+{
+ mpImplData->mbReversePageOrder = i_bReverse;
+}
+
+bool PrinterController::getReversePrint() const
+{
+ return mpImplData->mbReversePageOrder;
+}
+
+Sequence< PropertyValue > PrinterController::getJobProperties( const Sequence< PropertyValue >& i_rMergeList ) const
+{
+ std::hash_set< rtl::OUString, rtl::OUStringHash > aMergeSet;
+ size_t nResultLen = size_t(i_rMergeList.getLength()) + mpImplData->maUIProperties.size() + 3;
+ for( int i = 0; i < i_rMergeList.getLength(); i++ )
+ aMergeSet.insert( i_rMergeList[i].Name );
+
+ Sequence< PropertyValue > aResult( nResultLen );
+ for( int i = 0; i < i_rMergeList.getLength(); i++ )
+ aResult[i] = i_rMergeList[i];
+ int nCur = i_rMergeList.getLength();
+ for( size_t i = 0; i < mpImplData->maUIProperties.size(); i++ )
+ {
+ if( aMergeSet.find( mpImplData->maUIProperties[i].Name ) == aMergeSet.end() )
+ aResult[nCur++] = mpImplData->maUIProperties[i];
+ }
+ // append IsFirstPage
+ if( aMergeSet.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFirstPage" ) ) ) == aMergeSet.end() )
+ {
+ PropertyValue aVal;
+ aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFirstPage" ) );
+ aVal.Value <<= mpImplData->mbFirstPage;
+ aResult[nCur++] = aVal;
+ }
+ // append IsLastPage
+ if( aMergeSet.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsLastPage" ) ) ) == aMergeSet.end() )
+ {
+ PropertyValue aVal;
+ aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsLastPage" ) );
+ aVal.Value <<= mpImplData->mbLastPage;
+ aResult[nCur++] = aVal;
+ }
+ // append IsPrinter
+ if( aMergeSet.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrinter" ) ) ) == aMergeSet.end() )
+ {
+ PropertyValue aVal;
+ aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrinter" ) );
+ aVal.Value <<= sal_True;
+ aResult[nCur++] = aVal;
+ }
+ aResult.realloc( nCur );
+ return aResult;
+}
+
+const Sequence< beans::PropertyValue >& PrinterController::getUIOptions() const
+{
+ return mpImplData->maUIOptions;
+}
+
+beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty )
+{
+ std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it =
+ mpImplData->maPropertyToIndex.find( i_rProperty );
+ return it != mpImplData->maPropertyToIndex.end() ? &mpImplData->maUIProperties[it->second] : NULL;
+}
+
+const beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty ) const
+{
+ std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it =
+ mpImplData->maPropertyToIndex.find( i_rProperty );
+ return it != mpImplData->maPropertyToIndex.end() ? &mpImplData->maUIProperties[it->second] : NULL;
+}
+
+Sequence< beans::PropertyValue > PrinterController::getValues( const Sequence< rtl::OUString >& i_rNames ) const
+{
+ Sequence< beans::PropertyValue > aRet( i_rNames.getLength() );
+ sal_Int32 nFound = 0;
+ for( sal_Int32 i = 0; i < i_rNames.getLength(); i++ )
+ {
+ const beans::PropertyValue* pVal = getValue( i_rNames[i] );
+ if( pVal )
+ aRet[ nFound++ ] = *pVal;
+ }
+ aRet.realloc( nFound );
+ return aRet;
+}
+
+void PrinterController::setValue( const rtl::OUString& i_rName, const Any& i_rValue )
+{
+ beans::PropertyValue aVal;
+ aVal.Name = i_rName;
+ aVal.Value = i_rValue;
+
+ setValue( aVal );
+}
+
+void PrinterController::setValue( const beans::PropertyValue& i_rValue )
+{
+ std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it =
+ mpImplData->maPropertyToIndex.find( i_rValue.Name );
+ if( it != mpImplData->maPropertyToIndex.end() )
+ mpImplData->maUIProperties[ it->second ] = i_rValue;
+ else
+ {
+ // insert correct index into property map
+ mpImplData->maPropertyToIndex[ i_rValue.Name ] = mpImplData->maUIProperties.size();
+ mpImplData->maUIProperties.push_back( i_rValue );
+ mpImplData->maUIPropertyEnabled.push_back( true );
+ }
+}
+
+void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_rOptions )
+{
+ DBG_ASSERT( mpImplData->maUIOptions.getLength() == 0, "setUIOptions called twice !" );
+
+ mpImplData->maUIOptions = i_rOptions;
+
+ for( int i = 0; i < i_rOptions.getLength(); i++ )
+ {
+ Sequence< beans::PropertyValue > aOptProp;
+ i_rOptions[i].Value >>= aOptProp;
+ bool bIsEnabled = true;
+ bool bHaveProperty = false;
+ rtl::OUString aPropName;
+ vcl::ImplPrinterControllerData::ControlDependency aDep;
+ for( int n = 0; n < aOptProp.getLength(); n++ )
+ {
+ const beans::PropertyValue& rEntry( aOptProp[ n ] );
+ if( rEntry.Name.equalsAscii( "Property" ) )
+ {
+ PropertyValue aVal;
+ rEntry.Value >>= aVal;
+ DBG_ASSERT( mpImplData->maPropertyToIndex.find( aVal.Name )
+ == mpImplData->maPropertyToIndex.end(), "duplicate property entry" );
+ setValue( aVal );
+ aPropName = aVal.Name;
+ bHaveProperty = true;
+ }
+ else if( rEntry.Name.equalsAscii( "Enabled" ) )
+ {
+ sal_Bool bValue = sal_True;
+ rEntry.Value >>= bValue;
+ bIsEnabled = bValue;
+ }
+ else if( rEntry.Name.equalsAscii( "DependsOnName" ) )
+ {
+ rEntry.Value >>= aDep.maDependsOnName;
+ }
+ else if( rEntry.Name.equalsAscii( "DependsOnEntry" ) )
+ {
+ rEntry.Value >>= aDep.mnDependsOnEntry;
+ }
+ }
+ if( bHaveProperty )
+ {
+ vcl::ImplPrinterControllerData::PropertyToIndexMap::const_iterator it =
+ mpImplData->maPropertyToIndex.find( aPropName );
+ // sanity check
+ if( it != mpImplData->maPropertyToIndex.end() )
+ {
+ mpImplData->maUIPropertyEnabled[ it->second ] = bIsEnabled;
+ }
+ if( aDep.maDependsOnName.getLength() > 0 )
+ mpImplData->maControlDependencies[ aPropName ] = aDep;
+ }
+ }
+}
+
+void PrinterController::enableUIOption( const rtl::OUString& i_rProperty, bool i_bEnable )
+{
+ std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it =
+ mpImplData->maPropertyToIndex.find( i_rProperty );
+ if( it != mpImplData->maPropertyToIndex.end() )
+ {
+ // call handler only for actual changes
+ if( ( mpImplData->maUIPropertyEnabled[ it->second ] && ! i_bEnable ) ||
+ ( ! mpImplData->maUIPropertyEnabled[ it->second ] && i_bEnable ) )
+ {
+ mpImplData->maUIPropertyEnabled[ it->second ] = i_bEnable;
+ rtl::OUString aPropName( i_rProperty );
+ mpImplData->maOptionChangeHdl.Call( &aPropName );
+ }
+ }
+}
+
+bool PrinterController::isUIOptionEnabled( const rtl::OUString& i_rProperty ) const
+{
+ bool bEnabled = false;
+ std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator prop_it =
+ mpImplData->maPropertyToIndex.find( i_rProperty );
+ if( prop_it != mpImplData->maPropertyToIndex.end() )
+ {
+ bEnabled = mpImplData->maUIPropertyEnabled[prop_it->second];
+
+ if( bEnabled )
+ {
+ // check control dependencies
+ vcl::ImplPrinterControllerData::ControlDependencyMap::const_iterator it =
+ mpImplData->maControlDependencies.find( i_rProperty );
+ if( it != mpImplData->maControlDependencies.end() )
+ {
+ // check if the dependency is enabled
+ // if the dependency is disabled, we are too
+ bEnabled = isUIOptionEnabled( it->second.maDependsOnName );
+
+ if( bEnabled )
+ {
+ // does the dependency have the correct value ?
+ const com::sun::star::beans::PropertyValue* pVal = getValue( it->second.maDependsOnName );
+ OSL_ENSURE( pVal, "unknown property in dependency" );
+ if( pVal )
+ {
+ sal_Int32 nDepVal = 0;
+ sal_Bool bDepVal = sal_False;
+ if( pVal->Value >>= nDepVal )
+ {
+ bEnabled = (nDepVal == it->second.mnDependsOnEntry) || (it->second.mnDependsOnEntry == -1);
+ }
+ else if( pVal->Value >>= bDepVal )
+ {
+ // could be a dependency on a checked boolean
+ // in this case the dependency is on a non zero for checked value
+ bEnabled = ( bDepVal && it->second.mnDependsOnEntry != 0) ||
+ ( ! bDepVal && it->second.mnDependsOnEntry == 0);
+ }
+ else
+ {
+ // if the type does not match something is awry
+ OSL_ENSURE( 0, "strange type in control dependency" );
+ bEnabled = false;
+ }
+ }
+ }
+ }
+ }
+ }
+ return bEnabled;
+}
+
+rtl::OUString PrinterController::getDependency( const rtl::OUString& i_rProperty ) const
+{
+ rtl::OUString aDependency;
+
+ vcl::ImplPrinterControllerData::ControlDependencyMap::const_iterator it =
+ mpImplData->maControlDependencies.find( i_rProperty );
+ if( it != mpImplData->maControlDependencies.end() )
+ aDependency = it->second.maDependsOnName;
+
+ return aDependency;
+}
+
+rtl::OUString PrinterController::makeEnabled( const rtl::OUString& i_rProperty )
+{
+ rtl::OUString aDependency;
+
+ vcl::ImplPrinterControllerData::ControlDependencyMap::const_iterator it =
+ mpImplData->maControlDependencies.find( i_rProperty );
+ if( it != mpImplData->maControlDependencies.end() )
+ {
+ if( isUIOptionEnabled( it->second.maDependsOnName ) )
+ {
+ aDependency = it->second.maDependsOnName;
+ const com::sun::star::beans::PropertyValue* pVal = getValue( aDependency );
+ OSL_ENSURE( pVal, "unknown property in dependency" );
+ if( pVal )
+ {
+ sal_Int32 nDepVal = 0;
+ sal_Bool bDepVal = sal_False;
+ if( pVal->Value >>= nDepVal )
+ {
+ if( it->second.mnDependsOnEntry != -1 )
+ {
+ setValue( aDependency, makeAny( sal_Int32( it->second.mnDependsOnEntry ) ) );
+ }
+ }
+ else if( pVal->Value >>= bDepVal )
+ {
+ setValue( aDependency, makeAny( sal_Bool( it->second.mnDependsOnEntry != 0 ) ) );
+ }
+ else
+ {
+ // if the type does not match something is awry
+ OSL_ENSURE( 0, "strange type in control dependency" );
+ }
+ }
+ }
+ }
+
+ return aDependency;
+}
+
+void PrinterController::setOptionChangeHdl( const Link& i_rHdl )
+{
+ mpImplData->maOptionChangeHdl = i_rHdl;
+}
+
+void PrinterController::createProgressDialog()
+{
+ if( ! mpImplData->mpProgress )
+ {
+ sal_Bool bShow = sal_True;
+ beans::PropertyValue* pMonitor = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MonitorVisible" ) ) );
+ if( pMonitor )
+ pMonitor->Value >>= bShow;
+ else
+ {
+ const com::sun::star::beans::PropertyValue* pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsApi" ) ) );
+ if( pVal )
+ {
+ sal_Bool bApi = sal_False;
+ pVal->Value >>= bApi;
+ bShow = ! bApi;
+ }
+ }
+
+ if( bShow && ! Application::IsHeadlessModeEnabled() )
+ {
+ mpImplData->mpProgress = new PrintProgressDialog( NULL, getPageCountProtected() );
+ mpImplData->mpProgress->Show();
+ }
+ }
+}
+
+void PrinterController::setMultipage( const MultiPageSetup& i_rMPS )
+{
+ mpImplData->maMultiPage = i_rMPS;
+}
+
+const PrinterController::MultiPageSetup& PrinterController::getMultipage() const
+{
+ return mpImplData->maMultiPage;
+}
+
+void PrinterController::pushPropertiesToPrinter()
+{
+ sal_Int32 nCopyCount = 1;
+ // set copycount and collate
+ const beans::PropertyValue* pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ) );
+ if( pVal )
+ pVal->Value >>= nCopyCount;
+ sal_Bool bCollate = sal_False;
+ pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) );
+ if( pVal )
+ pVal->Value >>= bCollate;
+ mpImplData->mpPrinter->SetCopyCount( static_cast<USHORT>(nCopyCount), bCollate );
+
+ // duplex mode
+ pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DuplexMode" ) ) );
+ if( pVal )
+ {
+ sal_Int16 nDuplex = view::DuplexMode::UNKNOWN;
+ pVal->Value >>= nDuplex;
+ switch( nDuplex )
+ {
+ case view::DuplexMode::OFF: mpImplData->mpPrinter->SetDuplexMode( DUPLEX_OFF ); break;
+ case view::DuplexMode::LONGEDGE: mpImplData->mpPrinter->SetDuplexMode( DUPLEX_LONGEDGE ); break;
+ case view::DuplexMode::SHORTEDGE: mpImplData->mpPrinter->SetDuplexMode( DUPLEX_SHORTEDGE ); break;
+ }
+ }
+}
+
+bool PrinterController::isShowDialogs() const
+{
+ sal_Bool bApi = getBoolProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsApi" ) ), sal_False );
+ return ! bApi && ! Application::IsHeadlessModeEnabled();
+}
+
+bool PrinterController::isDirectPrint() const
+{
+ sal_Bool bDirect = getBoolProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDirect" ) ), sal_False );
+ return bDirect == sal_True;
+}
+
+sal_Bool PrinterController::getBoolProperty( const rtl::OUString& i_rProperty, sal_Bool i_bFallback ) const
+{
+ sal_Bool bRet = i_bFallback;
+ const com::sun::star::beans::PropertyValue* pVal = getValue( i_rProperty );
+ if( pVal )
+ pVal->Value >>= bRet;
+ return bRet;
+}
+
+/*
+ * PrinterOptionsHelper
+**/
+Any PrinterOptionsHelper::getValue( const rtl::OUString& i_rPropertyName ) const
+{
+ Any aRet;
+ std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it =
+ m_aPropertyMap.find( i_rPropertyName );
+ if( it != m_aPropertyMap.end() )
+ aRet = it->second;
+ return aRet;
+}
+
+void PrinterOptionsHelper::setValue( const rtl::OUString& i_rPropertyName, const Any& i_rValue )
+{
+ m_aPropertyMap[ i_rPropertyName ] = i_rValue;
+}
+
+bool PrinterOptionsHelper::hasProperty( const rtl::OUString& i_rPropertyName ) const
+{
+ Any aRet;
+ std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it =
+ m_aPropertyMap.find( i_rPropertyName );
+ return it != m_aPropertyMap.end();
+}
+
+sal_Bool PrinterOptionsHelper::getBoolValue( const rtl::OUString& i_rPropertyName, sal_Bool i_bDefault ) const
+{
+ sal_Bool bRet = sal_False;
+ Any aVal( getValue( i_rPropertyName ) );
+ return (aVal >>= bRet) ? bRet : i_bDefault;
+}
+
+sal_Int64 PrinterOptionsHelper::getIntValue( const rtl::OUString& i_rPropertyName, sal_Int64 i_nDefault ) const
+{
+ sal_Int64 nRet = 0;
+ Any aVal( getValue( i_rPropertyName ) );
+ return (aVal >>= nRet) ? nRet : i_nDefault;
+}
+
+rtl::OUString PrinterOptionsHelper::getStringValue( const rtl::OUString& i_rPropertyName, const rtl::OUString& i_rDefault ) const
+{
+ rtl::OUString aRet;
+ Any aVal( getValue( i_rPropertyName ) );
+ return (aVal >>= aRet) ? aRet : i_rDefault;
+}
+
+bool PrinterOptionsHelper::processProperties( const Sequence< PropertyValue >& i_rNewProp,
+ std::set< rtl::OUString >* o_pChangeProp )
+{
+ bool bChanged = false;
+
+ // clear the changed set
+ if( o_pChangeProp )
+ o_pChangeProp->clear();
+
+ sal_Int32 nElements = i_rNewProp.getLength();
+ const PropertyValue* pVals = i_rNewProp.getConstArray();
+ for( sal_Int32 i = 0; i < nElements; i++ )
+ {
+ bool bElementChanged = false;
+ std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::iterator it =
+ m_aPropertyMap.find( pVals[ i ].Name );
+ if( it != m_aPropertyMap.end() )
+ {
+ if( it->second != pVals[ i ].Value )
+ bElementChanged = true;
+ }
+ else
+ bElementChanged = true;
+
+ if( bElementChanged )
+ {
+ if( o_pChangeProp )
+ o_pChangeProp->insert( pVals[ i ].Name );
+ m_aPropertyMap[ pVals[i].Name ] = pVals[i].Value;
+ bChanged = true;
+ }
+ }
+ return bChanged;
+}
+
+void PrinterOptionsHelper::appendPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ) const
+{
+ if( m_aUIProperties.getLength() > 0 )
+ {
+ sal_Int32 nIndex = io_rProps.getLength();
+ io_rProps.realloc( nIndex+1 );
+ PropertyValue aVal;
+ aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExtraPrintUIOptions" ) );
+ aVal.Value = makeAny( m_aUIProperties );
+ io_rProps[ nIndex ] = aVal;
+ }
+}
+
+Any PrinterOptionsHelper::getUIControlOpt( const rtl::OUString& i_rTitle,
+ const Sequence< rtl::OUString >& i_rHelpTexts,
+ const rtl::OUString& i_rType,
+ const PropertyValue* i_pVal,
+ const PrinterOptionsHelper::UIControlOptions& i_rControlOptions
+ )
+{
+ sal_Int32 nElements =
+ 1 // ControlType
+ + (i_rTitle.getLength() ? 1 : 0) // Text
+ + (i_rHelpTexts.getLength() ? 1 : 0) // HelpText
+ + (i_pVal ? 1 : 0) // Property
+ + i_rControlOptions.maAddProps.getLength() // additional props
+ + (i_rControlOptions.maGroupHint.getLength() ? 1 : 0) // grouping
+ + (i_rControlOptions.mbInternalOnly ? 1 : 0) // internal hint
+ + (i_rControlOptions.mbEnabled ? 0 : 1) // enabled
+ ;
+ if( i_rControlOptions.maDependsOnName.getLength() )
+ {
+ nElements += 1;
+ if( i_rControlOptions.mnDependsOnEntry != -1 )
+ nElements += 1;
+ if( i_rControlOptions.mbAttachToDependency )
+ nElements += 1;
+ }
+
+ Sequence< PropertyValue > aCtrl( nElements );
+ sal_Int32 nUsed = 0;
+ if( i_rTitle.getLength() )
+ {
+ aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) );
+ aCtrl[nUsed++].Value = makeAny( i_rTitle );
+ }
+ if( i_rHelpTexts.getLength() )
+ {
+ aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) );
+ aCtrl[nUsed++].Value = makeAny( i_rHelpTexts );
+ }
+ aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlType" ) );
+ aCtrl[nUsed++].Value = makeAny( i_rType );
+ if( i_pVal )
+ {
+ aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Property" ) );
+ aCtrl[nUsed++].Value = makeAny( *i_pVal );
+ }
+ if( i_rControlOptions.maDependsOnName.getLength() )
+ {
+ aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnName" ) );
+ aCtrl[nUsed++].Value = makeAny( i_rControlOptions.maDependsOnName );
+ if( i_rControlOptions.mnDependsOnEntry != -1 )
+ {
+ aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnEntry" ) );
+ aCtrl[nUsed++].Value = makeAny( i_rControlOptions.mnDependsOnEntry );
+ }
+ if( i_rControlOptions.mbAttachToDependency )
+ {
+ aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AttachToDependency" ) );
+ aCtrl[nUsed++].Value = makeAny( i_rControlOptions.mbAttachToDependency );
+ }
+ }
+ if( i_rControlOptions.maGroupHint.getLength() )
+ {
+ aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GroupingHint" ) );
+ aCtrl[nUsed++].Value <<= i_rControlOptions.maGroupHint;
+ }
+ if( i_rControlOptions.mbInternalOnly )
+ {
+ aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InternalUIOnly" ) );
+ aCtrl[nUsed++].Value <<= sal_True;
+ }
+ if( ! i_rControlOptions.mbEnabled )
+ {
+ aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) );
+ aCtrl[nUsed++].Value <<= sal_False;
+ }
+
+ sal_Int32 nAddProps = i_rControlOptions.maAddProps.getLength();
+ for( sal_Int32 i = 0; i < nAddProps; i++ )
+ aCtrl[ nUsed++ ] = i_rControlOptions.maAddProps[i];
+
+ DBG_ASSERT( nUsed == nElements, "nUsed != nElements, probable heap corruption" );
+
+ return makeAny( aCtrl );
+}
+
+Any PrinterOptionsHelper::getGroupControlOpt( const rtl::OUString& i_rTitle, const rtl::OUString& i_rHelpText )
+{
+ Sequence< rtl::OUString > aHelpText;
+ if( i_rHelpText.getLength() > 0 )
+ {
+ aHelpText.realloc( 1 );
+ *aHelpText.getArray() = i_rHelpText;
+ }
+ return getUIControlOpt( i_rTitle, aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) );
+}
+
+Any PrinterOptionsHelper::getSubgroupControlOpt( const rtl::OUString& i_rTitle,
+ const rtl::OUString& i_rHelpText,
+ const PrinterOptionsHelper::UIControlOptions& i_rControlOptions
+ )
+{
+ Sequence< rtl::OUString > aHelpText;
+ if( i_rHelpText.getLength() > 0 )
+ {
+ aHelpText.realloc( 1 );
+ *aHelpText.getArray() = i_rHelpText;
+ }
+ return getUIControlOpt( i_rTitle, aHelpText, 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_rProperty,
+ sal_Bool i_bValue,
+ const PrinterOptionsHelper::UIControlOptions& i_rControlOptions
+ )
+{
+ Sequence< rtl::OUString > aHelpText;
+ if( i_rHelpText.getLength() > 0 )
+ {
+ aHelpText.realloc( 1 );
+ *aHelpText.getArray() = i_rHelpText;
+ }
+ 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 );
+}
+
+Any PrinterOptionsHelper::getChoiceControlOpt( const rtl::OUString& i_rTitle,
+ const Sequence< rtl::OUString >& i_rHelpText,
+ const rtl::OUString& i_rProperty,
+ const Sequence< rtl::OUString >& i_rChoices,
+ sal_Int32 i_nValue,
+ const rtl::OUString& i_rType,
+ const PrinterOptionsHelper::UIControlOptions& i_rControlOptions
+ )
+{
+ UIControlOptions aOpt( i_rControlOptions );
+ sal_Int32 nUsed = aOpt.maAddProps.getLength();
+ aOpt.maAddProps.realloc( nUsed + 1 );
+ aOpt.maAddProps[nUsed].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Choices" ) );
+ aOpt.maAddProps[nUsed].Value = makeAny( i_rChoices );
+
+ PropertyValue aVal;
+ aVal.Name = i_rProperty;
+ aVal.Value = makeAny( i_nValue );
+ return getUIControlOpt( i_rTitle, i_rHelpText, i_rType, &aVal, aOpt );
+}
+
+Any PrinterOptionsHelper::getRangeControlOpt( const rtl::OUString& i_rTitle,
+ const rtl::OUString& i_rHelpText,
+ const rtl::OUString& i_rProperty,
+ sal_Int32 i_nValue,
+ sal_Int32 i_nMinValue,
+ sal_Int32 i_nMaxValue,
+ const PrinterOptionsHelper::UIControlOptions& i_rControlOptions
+ )
+{
+ UIControlOptions aOpt( i_rControlOptions );
+ if( i_nMaxValue >= i_nMinValue )
+ {
+ sal_Int32 nUsed = aOpt.maAddProps.getLength();
+ aOpt.maAddProps.realloc( nUsed + 2 );
+ aOpt.maAddProps[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MinValue" ) );
+ aOpt.maAddProps[nUsed++].Value = makeAny( i_nMinValue );
+ aOpt.maAddProps[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxValue" ) );
+ aOpt.maAddProps[nUsed++].Value = makeAny( i_nMaxValue );
+ }
+
+ Sequence< rtl::OUString > aHelpText;
+ if( i_rHelpText.getLength() > 0 )
+ {
+ aHelpText.realloc( 1 );
+ *aHelpText.getArray() = i_rHelpText;
+ }
+ PropertyValue aVal;
+ aVal.Name = i_rProperty;
+ aVal.Value = makeAny( i_nValue );
+ return getUIControlOpt( i_rTitle,
+ aHelpText,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Range" ) ),
+ &aVal,
+ aOpt
+ );
+}
+
+Any PrinterOptionsHelper::getEditControlOpt( const rtl::OUString& i_rTitle,
+ const rtl::OUString& i_rHelpText,
+ const rtl::OUString& i_rProperty,
+ const rtl::OUString& i_rValue,
+ const PrinterOptionsHelper::UIControlOptions& i_rControlOptions
+ )
+{
+ Sequence< rtl::OUString > aHelpText;
+ if( i_rHelpText.getLength() > 0 )
+ {
+ aHelpText.realloc( 1 );
+ *aHelpText.getArray() = i_rHelpText;
+ }
+ PropertyValue aVal;
+ aVal.Name = i_rProperty;
+ aVal.Value = makeAny( i_rValue );
+ return getUIControlOpt( i_rTitle,
+ aHelpText,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Edit" ) ),
+ &aVal,
+ i_rControlOptions
+ );
+}
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index f1c532a9295f..a13e272e368b 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -359,27 +359,40 @@ BOOL VirtualDevice::SetOutputSizePixel( const Size& rNewSize, BOOL bErase )
// -----------------------------------------------------------------------
-void VirtualDevice::SetReferenceDevice( RefDevMode eRefDevMode )
+void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode )
{
- switch( eRefDevMode )
+ sal_Int32 nDPIX = 600, nDPIY = 600;
+ switch( i_eRefDevMode )
{
case REFDEV_NONE:
default:
DBG_ASSERT( FALSE, "VDev::SetRefDev illegal argument!" );
- // fall through
+ break;
case REFDEV_MODE06:
- mnDPIX = mnDPIY = 600;
+ nDPIX = nDPIY = 600;
break;
case REFDEV_MODE48:
- mnDPIX = mnDPIY = 4800;
+ nDPIX = nDPIY = 4800;
break;
case REFDEV_MODE_MSO1:
- mnDPIX = mnDPIY = 6*1440;
+ nDPIX = nDPIY = 6*1440;
break;
case REFDEV_MODE_PDF1:
- mnDPIX = mnDPIY = 720;
+ nDPIX = nDPIY = 720;
break;
}
+ ImplSetReferenceDevice( i_eRefDevMode, nDPIX, nDPIY );
+}
+
+void VirtualDevice::SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY )
+{
+ ImplSetReferenceDevice( REFDEV_CUSTOM, i_nDPIX, i_nDPIY );
+}
+
+void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY )
+{
+ mnDPIX = i_nDPIX;
+ mnDPIY = i_nDPIY;
EnableOutput( FALSE ); // prevent output on reference device
mbScreenComp = FALSE;
@@ -391,7 +404,7 @@ void VirtualDevice::SetReferenceDevice( RefDevMode eRefDevMode )
// avoid adjusting font lists when already in refdev mode
BYTE nOldRefDevMode = meRefDevMode;
BYTE nOldCompatFlag = (BYTE)meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD;
- meRefDevMode = (BYTE)(eRefDevMode | nOldCompatFlag);
+ meRefDevMode = (BYTE)(i_eRefDevMode | nOldCompatFlag);
if( (nOldRefDevMode ^ nOldCompatFlag) != REFDEV_NONE )
return;
diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx
index b92bea929c51..b25b9cee83fb 100644
--- a/vcl/source/glyphs/gcach_ftyp.cxx
+++ b/vcl/source/glyphs/gcach_ftyp.cxx
@@ -2486,14 +2486,12 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD )
pCoverage += 2;
for( int i = nCntRange; --i >= 0; )
{
- const USHORT nGlyph0 = GetUShort( pCoverage+0 );
- const USHORT nGlyph1 = GetUShort( pCoverage+2 );
- const USHORT nStartCoverageIndex = GetUShort( pCoverage+4 );
- DBG_ASSERT( aSubstVector.size() == nStartCoverageIndex, "coverage index mismatch");
- (void)nStartCoverageIndex;
+ const UINT32 nGlyph0 = GetUShort( pCoverage+0 );
+ const UINT32 nGlyph1 = GetUShort( pCoverage+2 );
+ const USHORT nCovIdx = GetUShort( pCoverage+4 );
pCoverage += 6;
- for( USHORT j = nGlyph0; j <= nGlyph1; ++j )
- aSubstVector.push_back( GlyphSubst( j, 0 ) );
+ for( UINT32 j = nGlyph0; j <= nGlyph1; ++j )
+ aSubstVector.push_back( GlyphSubst( static_cast<USHORT>(j + nCovIdx), 0 ) );
}
}
break;
@@ -2537,3 +2535,4 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD )
}
// =======================================================================
+
diff --git a/vcl/source/glyphs/graphite_adaptors.cxx b/vcl/source/glyphs/graphite_adaptors.cxx
index 34e2f5f5bbe3..6c9d97e356b1 100644
--- a/vcl/source/glyphs/graphite_adaptors.cxx
+++ b/vcl/source/glyphs/graphite_adaptors.cxx
@@ -171,7 +171,7 @@ GraphiteFontAdaptor::~GraphiteFontAdaptor() throw()
mpFeatures = NULL;
}
-void GraphiteFontAdaptor::UniqueCacheInfo(std::wstring & face_name_out, bool & bold_out, bool & italic_out)
+void GraphiteFontAdaptor::UniqueCacheInfo(sil_std::wstring & face_name_out, bool & bold_out, bool & italic_out)
{
face_name_out = maFontProperties.szFaceName;
bold_out = maFontProperties.fBold;
diff --git a/vcl/source/glyphs/graphite_cache.cxx b/vcl/source/glyphs/graphite_cache.cxx
index 8c514c611d2c..a2c245e21774 100644
--- a/vcl/source/glyphs/graphite_cache.cxx
+++ b/vcl/source/glyphs/graphite_cache.cxx
@@ -36,8 +36,10 @@
#include <tools/debug.hxx>
#include <vcl/sallayout.hxx>
+#include "pregraphitestl.h"
#include <graphite/GrClient.h>
#include <graphite/Segment.h>
+#include "postgraphitestl.h"
#include <rtl/ustring.hxx>
#include <vcl/graphite_layout.hxx>
diff --git a/vcl/source/glyphs/graphite_features.cxx b/vcl/source/glyphs/graphite_features.cxx
index dae1bfc2866e..b26397aa43e5 100644
--- a/vcl/source/glyphs/graphite_features.cxx
+++ b/vcl/source/glyphs/graphite_features.cxx
@@ -91,7 +91,7 @@ GrFeatureParser::GrFeatureParser(gr::Font & font, const std::string features, co
gr::isocode aLang = maLang;
for (size_t i = pos; i < nFeatEnd; i++)
aLang.rgch[i-pos] = features[i];
- std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported
+ sil_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported
= font.getSupportedLanguages();
gr::LanguageIterator iL = aSupported.first;
while (iL != aSupported.second)
@@ -142,7 +142,7 @@ void GrFeatureParser::setLang(gr::Font & font, const std::string & lang)
if (lang[i] == '-') break;
aLang.rgch[i] = lang[i];
}
- std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported
+ sil_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported
= font.getSupportedLanguages();
gr::LanguageIterator iL = aSupported.first;
while (iL != aSupported.second)
@@ -189,7 +189,7 @@ bool GrFeatureParser::isValid(gr::Font & font, gr::FeatureSetting & setting)
{
return false;
}
- std::pair< gr::FeatureSettingIterator, gr::FeatureSettingIterator >
+ sil_std::pair< gr::FeatureSettingIterator, gr::FeatureSettingIterator >
validValues = font.getFeatureSettings(i);
gr::FeatureSettingIterator j = validValues.first;
while (j != validValues.second)
diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 86dee2749efa..6f4e13c7985f 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -66,11 +66,13 @@
#include <unicode/uscript.h>
// Graphite Libraries (must be after vcl headers on windows)
+#include "pregraphitestl.h"
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/ITextSource.h>
#include <graphite/Segment.h>
#include <graphite/SegmentPainter.h>
+#include "postgraphitestl.h"
#include <vcl/graphite_layout.hxx>
#include <vcl/graphite_features.hxx>
@@ -105,8 +107,8 @@ FILE * grLog()
namespace
{
- typedef std::pair<gr::GlyphIterator, gr::GlyphIterator> glyph_range_t;
- typedef std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> glyph_set_range_t;
+ typedef sil_std::pair<gr::GlyphIterator, gr::GlyphIterator> glyph_range_t;
+ typedef sil_std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> glyph_set_range_t;
inline long round(const float n) {
return long(n + (n < 0 ? -0.5 : 0.5));
@@ -171,7 +173,7 @@ GraphiteLayout::Glyphs::fill_from(gr::Segment & rSegment, ImplLayoutArgs &rArgs,
bool bRtl, long &rWidth, float fScaling, std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, std::vector<int> & rCharDxs)
{
// Create a glyph item for each of the glyph and append it to the base class glyph list.
- typedef std::pair< gr::GlyphSetIterator, gr::GlyphSetIterator > GrGlyphSet;
+ typedef sil_std::pair< gr::GlyphSetIterator, gr::GlyphSetIterator > GrGlyphSet;
int nChar = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
glyph_range_t iGlyphs = rSegment.glyphs();
int nGlyphs = iGlyphs.second - iGlyphs.first;
@@ -586,7 +588,7 @@ public:
sal_Int32 hashCode(const grutils::GrFeatureParser * mpFeatures)
{
// is this sufficient?
- std::wstring aFace;
+ sil_std::wstring aFace;
bool bBold;
bool bItalic;
UniqueCacheInfo(aFace, bBold, bItalic);
@@ -720,6 +722,7 @@ bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment)
#ifdef GRCACHE_REUSE_VECTORS
// if we have an exact match, then we can reuse the glyph vectors from before
if (pSegRecord && (pSegRecord->glyphs().size() > 0) &&
+ (pSegRecord->fontScale() == mfScaling) &&
!(SAL_LAYOUT_FOR_FALLBACK & rArgs.mnFlags) )
{
mnWidth = pSegRecord->width();
@@ -765,7 +768,8 @@ bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment)
!(SAL_LAYOUT_FOR_FALLBACK & rArgs.mnFlags))
{
pSegRecord->setGlyphVectors(mnWidth, mvGlyphs, mvCharDxs,
- mvChar2BaseGlyph, mvGlyph2Char);
+ mvChar2BaseGlyph, mvGlyph2Char,
+ mfScaling);
}
#endif
#endif
diff --git a/vcl/source/glyphs/graphite_textsrc.cxx b/vcl/source/glyphs/graphite_textsrc.cxx
index adc2ae99c4f8..cbbd386e734a 100644
--- a/vcl/source/glyphs/graphite_textsrc.cxx
+++ b/vcl/source/glyphs/graphite_textsrc.cxx
@@ -138,16 +138,16 @@ gr::isocode TextSourceAdaptor::getLanguage(gr::toffset)
return unknown;
}
-std::pair<gr::toffset, gr::toffset> TextSourceAdaptor::propertyRange(gr::toffset nCharIdx)
+sil_std::pair<gr::toffset, gr::toffset> TextSourceAdaptor::propertyRange(gr::toffset nCharIdx)
{
if (nCharIdx < unsigned(maLayoutArgs.mnMinCharPos))
- return std::make_pair(0, maLayoutArgs.mnMinCharPos);
+ return sil_std::make_pair(0, maLayoutArgs.mnMinCharPos);
if (nCharIdx < mnEnd)
- return std::make_pair(maLayoutArgs.mnMinCharPos, mnEnd);
+ return sil_std::make_pair(maLayoutArgs.mnMinCharPos, mnEnd);
- return std::make_pair(mnEnd, maLayoutArgs.mnLength);
+ return sil_std::make_pair(mnEnd, maLayoutArgs.mnLength);
}
size_t TextSourceAdaptor::getFontFeatures(gr::toffset, gr::FeatureSetting * settings)
@@ -159,7 +159,7 @@ size_t TextSourceAdaptor::getFontFeatures(gr::toffset, gr::FeatureSetting * sett
bool TextSourceAdaptor::sameSegment(gr::toffset char_idx1, gr::toffset char_idx2)
{
- const std::pair<gr::toffset, gr::toffset>
+ const sil_std::pair<gr::toffset, gr::toffset>
range1 = propertyRange(char_idx1),
range2 = propertyRange(char_idx2);
diff --git a/vcl/source/glyphs/graphite_textsrc.hxx b/vcl/source/glyphs/graphite_textsrc.hxx
index 6f701988bb01..62d951c3f950 100644
--- a/vcl/source/glyphs/graphite_textsrc.hxx
+++ b/vcl/source/glyphs/graphite_textsrc.hxx
@@ -62,9 +62,11 @@
#include "vcl/dllapi.h"
// Libraries
+#include "pregraphitestl.h"
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/ITextSource.h>
+#include "postgraphitestl.h"
// Module type definitions and forward declarations.
//
@@ -91,7 +93,7 @@ public:
virtual float getVerticalOffset(gr::toffset ich);
virtual gr::isocode getLanguage(gr::toffset ich);
- virtual std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich);
+ virtual sil_std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich);
virtual size_t getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset);
virtual bool sameSegment(gr::toffset ich1, gr::toffset ich2);
diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx
index 477ff5fb9902..489e3cf9340e 100644
--- a/vcl/source/helper/xconnection.cxx
+++ b/vcl/source/helper/xconnection.cxx
@@ -30,10 +30,31 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include <svsys.h>
-#include <vcl/xconnection.hxx>
-#include <vcl/svdata.hxx>
-#include <vcl/salinst.hxx>
+
+#include "svsys.h"
+#include "vcl/xconnection.hxx"
+#include "vcl/svdata.hxx"
+#include "vcl/salinst.hxx"
+#include "vcl/svapp.hxx"
+
+namespace vcl
+{
+ class SolarMutexReleaser
+ {
+ ULONG mnReleased;
+ public:
+ SolarMutexReleaser()
+ {
+ mnReleased = Application::ReleaseSolarMutex();
+ }
+
+ ~SolarMutexReleaser()
+ {
+ if( mnReleased )
+ Application::AcquireSolarMutex( mnReleased );
+ }
+ };
+}
using namespace rtl;
using namespace osl;
@@ -41,6 +62,7 @@ using namespace vcl;
using namespace com::sun::star::uno;
using namespace com::sun::star::awt;
+
DisplayConnection::DisplayConnection()
{
ImplSVData* pSVData = ImplGetSVData();
@@ -108,6 +130,8 @@ Any SAL_CALL DisplayConnection::getIdentifier() throw()
void DisplayConnection::dispatchDowningEvent()
{
+ SolarMutexReleaser aRel;
+
MutexGuard aGuard( m_aMutex );
Any aEvent;
std::list< Reference< XEventHandler > > aLocalList( m_aHandlers );
@@ -117,6 +141,8 @@ void DisplayConnection::dispatchDowningEvent()
bool DisplayConnection::dispatchEvent( void* pThis, void* pData, int nBytes )
{
+ SolarMutexReleaser aRel;
+
DisplayConnection* This = (DisplayConnection*)pThis;
MutexGuard aGuard( This->m_aMutex );
@@ -131,6 +157,8 @@ bool DisplayConnection::dispatchEvent( void* pThis, void* pData, int nBytes )
bool DisplayConnection::dispatchErrorEvent( void* pThis, void* pData, int nBytes )
{
+ SolarMutexReleaser aRel;
+
DisplayConnection* This = (DisplayConnection*)pThis;
MutexGuard aGuard( This->m_aMutex );
diff --git a/vcl/source/src/images.src b/vcl/source/src/images.src
index a2b057c8d234..5a0e7b412a58 100644
--- a/vcl/source/src/images.src
+++ b/vcl/source/src/images.src
@@ -833,3 +833,23 @@ Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_PRINTERADMIN)
File = "printeradmin_16_h.png" ;
};
+Bitmap SV_DISCLOSURE_PLUS
+{
+ File = "plus.png";
+};
+
+Bitmap SV_DISCLOSURE_PLUS_HC
+{
+ File = "plus_sch.png";
+};
+
+Bitmap SV_DISCLOSURE_MINUS
+{
+ File = "minus.png";
+};
+
+Bitmap SV_DISCLOSURE_MINUS_HC
+{
+ File = "minus_sch.png";
+};
+
diff --git a/vcl/source/src/makefile.mk b/vcl/source/src/makefile.mk
index cf01c74b977d..7772af5a0978 100644
--- a/vcl/source/src/makefile.mk
+++ b/vcl/source/src/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.8 $
+# $Revision: 1.8.114.1 $
#
# This file is part of OpenOffice.org.
#
@@ -47,7 +47,8 @@ SRC1FILES= images.src \
stdtext.src \
helptext.src \
units.src \
- btntext.src
+ btntext.src \
+ print.src
RESLIB1NAME= $(RESTARGET)
RESLIB1IMAGES= $(PRJ)$/source/src
diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src
new file mode 100644
index 000000000000..0125c0dfbeb3
--- /dev/null
+++ b/vcl/source/src/print.src
@@ -0,0 +1,495 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: print.src,v $
+ * $Revision: 1.1.2.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "vcl/svids.hrc"
+
+ModalDialog SV_DLG_PRINT
+{
+ Text [en-US] = "Print";
+ Closeable = TRUE;
+ Sizeable = TRUE;
+ Moveable = TRUE;
+ Maxable = TRUE;
+ SVLook = TRUE;
+
+ Size = MAP_APPFONT( 350, 215 );
+
+ OKButton SV_PRINT_OK
+ {
+ DefButton = TRUE;
+ Pos = MAP_APPFONT( 240, 195 );
+ Size = MAP_APPFONT( 50, 15 );
+ Text [en-US] = "~Print";
+ };
+ CancelButton SV_PRINT_CANCEL
+ {
+ Pos = MAP_APPFONT( 295, 195 );
+ Size = MAP_APPFONT( 50, 15 );
+ };
+ HelpButton SV_PRINT_HELP
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 50, 15 );
+ };
+
+ Window SV_PRINT_PAGE_PREVIEW
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 130, 130 );
+ Border = FALSE;
+ };
+ NumericField SV_PRINT_PAGE_EDIT
+ {
+ Pos = MAP_APPFONT( 5, 140 );
+ Size = MAP_APPFONT( 30, 12 );
+ SVLook = TRUE;
+ Spin = FALSE;
+ Border = TRUE;
+ HelpText [en-US] = "Select page to display in preview.";
+ };
+ FixedText SV_PRINT_PAGE_TXT
+ {
+ Pos = MAP_APPFONT( 40,142 );
+ Size = MAP_APPFONT( 30, 12 );
+ Text [ en-US ] = "/ %n";
+ VCenter = TRUE;
+ };
+ PushButton SV_PRINT_PAGE_FORWARD
+ {
+ Pos = MAP_APPFONT( 95, 140 );
+ Size = MAP_APPFONT( 15, 12 );
+ HelpText [en-US] = "Scroll one page forward.";
+ };
+ PushButton SV_PRINT_PAGE_BACKWARD
+ {
+ Pos = MAP_APPFONT( 80, 140 );
+ Size = MAP_APPFONT( 15, 12 );
+ HelpText [en-US] = "Scroll one page backward.";
+ };
+ TabControl SV_PRINT_TABCTRL
+ {
+ Pos = MAP_APPFONT( 140, 5 );
+ Size = MAP_APPFONT( 205, 175 );
+ };
+ FixedLine SV_PRINT_BUTTONLINE
+ {
+ Pos = MAP_APPFONT( 0, 185 );
+ Size = MAP_APPFONT( 350, 8 );
+ };
+ String SV_PRINT_NOPAGES
+ {
+ Text [en-US] = "No pages";
+ };
+
+ String SV_PRINT_TOFILE_TXT
+ {
+ Text [en-US] = "Print to File...";
+ };
+
+ String SV_PRINT_DEFPRT_TXT
+ {
+ Text [en-US] = "Default printer";
+ };
+
+
+ String SV_PRINT_PRINTPREVIEW_TXT
+ {
+ Text [en-US] = "Print preview";
+ };
+
+ TabPage SV_PRINT_TAB_NUP
+ {
+ Text [en-US] = "Page Layout";
+ Hide = TRUE;
+
+ FixedLine SV_PRINT_PRT_NUP_LAYOUT_FL
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 150, 10 );
+ Text [en-US] = "Layout";
+ };
+ RadioButton SV_PRINT_PRT_NUP_DEFAULT_BTN
+ {
+ Pos = MAP_APPFONT( 0, 0 );
+ Size = MAP_APPFONT( 10, 10 );
+ Text [en-US] = "~Default";
+ HelpText [en-US] = "Print one page per sheet of paper.";
+ };
+ RadioButton SV_PRINT_PRT_NUP_BROCHURE_BTN
+ {
+ Pos = MAP_APPFONT( 0, 0 );
+ Size = MAP_APPFONT( 10, 10 );
+ Text = "";
+ };
+ RadioButton SV_PRINT_PRT_NUP_PAGES_BTN
+ {
+ Pos = MAP_APPFONT( 0, 0 );
+ Size = MAP_APPFONT( 10, 10 );
+ Text [en-US] = "Pa~ges per sheet";
+ HelpText [en-US] = "Print multiple pages per sheet of paper.";
+ };
+ ListBox SV_PRINT_PRT_NUP_PAGES_BOX
+ {
+ Pos = MAP_APPFONT( 0, 0 );
+ Size = MAP_APPFONT( 10, 80 );
+ Border = TRUE;
+ DropDown = TRUE;
+ CurPos = 0;
+ HelpText [en-US] = "Select how many pages to print per sheet of paper.";
+ StringList [en-US] =
+ {
+ < "1"; 1; >;
+ < "2"; 2; >;
+ < "4"; 4; >;
+ < "6"; 6; >;
+ < "9"; 9; >;
+ < "16"; 16; >;
+ < "Custom"; 0xffff; >;
+ };
+ };
+ FixedText SV_PRINT_PRT_NUP_NUM_PAGES_TXT
+ {
+ Pos = MAP_APPFONT( 0, 0 );
+ Size = MAP_APPFONT( 10, 10 );
+ Text [en-US] = "P~ages";
+ VCenter = TRUE;
+ };
+ NumericField SV_PRINT_PRT_NUP_COLS_EDT
+ {
+ Pos = MAP_APPFONT( 55, 20 );
+ Size = MAP_APPFONT( 40, 12 );
+ Border = TRUE;
+ Spin = TRUE;
+ Minimum = 1;
+ Maximum = 32;
+ Value = 1;
+ HelpText [en-US] = "Select number of columns.";
+ };
+ FixedText SV_PRINT_PRT_NUP_TIMES_TXT
+ {
+ Pos = MAP_APPFONT( 10, 35 );
+ Size = MAP_APPFONT( 40, 10 );
+ Text [en-US] = "b~y";
+ VCenter = TRUE;
+ };
+ NumericField SV_PRINT_PRT_NUP_ROWS_EDT
+ {
+ Pos = MAP_APPFONT( 55, 35 );
+ Size = MAP_APPFONT( 40, 12 );
+ Border = TRUE;
+ Spin = TRUE;
+ Minimum = 1;
+ Maximum = 32;
+ Value = 1;
+ HelpText [en-US] = "Select number of rows.";
+ };
+ FixedText SV_PRINT_PRT_NUP_MARGINS_PAGES_1_TXT
+ {
+ Pos = MAP_APPFONT( 10, 95 );
+ Size = MAP_APPFONT( 40, 10 );
+ Text [en-US] = "~Distance";
+ };
+ MetricField SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT
+ {
+ Pos = MAP_APPFONT( 55, 95 );
+ Size = MAP_APPFONT( 40, 12 );
+ Spin = TRUE;
+ Border = TRUE;
+ Value = 0;
+ Unit = FUNIT_MM;
+ HelpText [en-US] = "Select margin between individual pages on each sheet of paper.";
+ };
+ FixedText SV_PRINT_PRT_NUP_MARGINS_PAGES_2_TXT
+ {
+ Pos = MAP_APPFONT( 10, 95 );
+ Size = MAP_APPFONT( 40, 10 );
+ Text [en-US] = "between pages";
+ };
+ FixedText SV_PRINT_PRT_NUP_MARGINS_SHEET_1_TXT
+ {
+ Pos = MAP_APPFONT( 110, 95 );
+ Size = MAP_APPFONT( 40, 10 );
+ Text [en-US] = "~Margin";
+ };
+ MetricField SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT
+ {
+ Pos = MAP_APPFONT( 155, 95 );
+ Size = MAP_APPFONT( 40, 12 );
+ Spin = TRUE;
+ Border = TRUE;
+ Value = 0;
+ Unit = FUNIT_MM;
+ HelpText [en-US] = "Select margin between the printed pages and paper edge.";
+ };
+ FixedText SV_PRINT_PRT_NUP_MARGINS_SHEET_2_TXT
+ {
+ Pos = MAP_APPFONT( 110, 95 );
+ Size = MAP_APPFONT( 40, 10 );
+ Text [en-US] = "to sheet border";
+ };
+ FixedText SV_PRINT_PRT_NUP_ORIENTATION_TXT
+ {
+ Pos = MAP_APPFONT( 0, 0 );
+ Size = MAP_APPFONT( 10, 10 );
+ Text [en-US] = "~Orientation";
+ };
+ ListBox SV_PRINT_PRT_NUP_ORIENTATION_BOX
+ {
+ Pos = MAP_APPFONT( 0, 0 );
+ Size = MAP_APPFONT( 10, 40 );
+ Border = TRUE;
+ DropDown = TRUE;
+ CurPos = 0;
+ StringList [en-US] =
+ {
+ < "Automatic"; SV_PRINT_PRT_NUP_ORIENTATION_AUTOMATIC; >;
+ < "Portrait"; SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT; >;
+ < "Landscape"; SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE; >;
+ };
+ HelpText [en-US] = "Select the orientation of the paper.";
+ };
+ FixedText SV_PRINT_PRT_NUP_ORDER_TXT
+ {
+ Pos = MAP_APPFONT( 0, 0 );
+ Size = MAP_APPFONT( 10, 10 );
+ Text [en-US] = "Order";
+ };
+ ListBox SV_PRINT_PRT_NUP_ORDER_BOX
+ {
+ Pos = MAP_APPFONT( 0, 0 );
+ Size = MAP_APPFONT( 10, 20 );
+ DropDown = TRUE;
+ Border = TRUE;
+ CurPos = 0;
+ StringList [en-US] =
+ {
+ < "left to right, then down"; SV_PRINT_PRT_NUP_ORDER_LRTD; >;
+ < "top to bottom, then right"; SV_PRINT_PRT_NUP_ORDER_TDLR; >;
+ };
+ HelpText [en-US] = "Select order in which pages are to be printed.";
+ };
+ CheckBox SV_PRINT_PRT_NUP_BORDER_CB
+ {
+ Pos = MAP_APPFONT( 10, 65 );
+ Size = MAP_APPFONT( 150, 12 );
+ Text [en-US] = "Draw a border around each page";
+ HelpText [en-US] = "Check to draw a border around each page.";
+ };
+ };
+
+ TabPage SV_PRINT_TAB_JOB
+ {
+ Text [en-US] = "General";
+ Hide = TRUE;
+
+ FixedLine SV_PRINT_PRINTERS_FL
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 100, 10 );
+ Text [ en-US ] = "Prin~ter";
+ };
+ ListBox SV_PRINT_PRINTERS
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 100, 80 );
+ Border = TRUE;
+ Sort = TRUE;
+ HelpText [en-US] = "Select the printer to print on.";
+ };
+ CheckBox SV_PRINT_DETAILS_BTN
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 5, 5 );
+ Text [en-US] = "Details";
+ HelpText [en-US] = "Show/Hide detailed information of the selected printer.";
+ };
+ FixedText SV_PRINT_STATUS_TXT
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 100, 10 );
+ Text [en-US] = "Status:";
+ };
+ FixedText SV_PRINT_LOCATION_TXT
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 100, 10 );
+ Text [en-US] = "Location:";
+ };
+ FixedText SV_PRINT_COMMENT_TXT
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 100, 10 );
+ Text [en-US] = "Comment:";
+ };
+ PushButton SV_PRINT_PRT_SETUP
+ {
+ Pos = MAP_APPFONT( 115, 5 );
+ Size = MAP_APPFONT( 50, 15 );
+ Text [en-US] = "Properties...";
+ HelpText [en-US] = "Call the setup dialog of the selected printer.";
+ };
+ FixedLine SV_PRINT_COPIES
+ {
+ Pos = MAP_APPFONT( 5, 35 );
+ Size = MAP_APPFONT( 150, 10 );
+ Text [en-US] = "Range and Copies";
+ };
+ FixedText SV_PRINT_COPYCOUNT
+ {
+ Pos = MAP_APPFONT( 10, 45 );
+ Size = MAP_APPFONT( 80, 10 );
+ Text [en-US] = "Number of copies";
+ };
+ NumericField SV_PRINT_COPYCOUNT_FIELD
+ {
+ Pos = MAP_APPFONT( 10, 56 );
+ Size = MAP_APPFONT( 40, 12 );
+ Border = TRUE;
+ Spin = TRUE;
+ Minimum = 1;
+ Maximum = 16384;
+ Value = 1;
+ HelpText [en-US] = "Select the number of copies to be produced.";
+ };
+ FixedImage SV_PRINT_COLLATE_IMAGE
+ {
+ Pos = MAP_APPFONT( 95, 60 );
+ Size = MAP_PIXEL( 80, 30 );
+ };
+ CheckBox SV_PRINT_COLLATE
+ {
+ Pos = MAP_APPFONT( 95, 45 );
+ Size = MAP_APPFONT( 70, 10 );
+ Text [en-US] = "Collate";
+ HelpText [en-US] = "Select whether copies should be collated or not.";
+ };
+
+ Image SV_PRINT_COLLATE_IMG
+ {
+ ImageBitmap = Bitmap { File = "collate.png" ; };
+ };
+
+ Image SV_PRINT_NOCOLLATE_IMG
+ {
+ ImageBitmap = Bitmap { File = "ncollate.png" ; };
+ };
+
+ Image SV_PRINT_COLLATE_HC_IMG
+ {
+ ImageBitmap = Bitmap { File = "collate_h.png" ; };
+ };
+
+ Image SV_PRINT_NOCOLLATE_HC_IMG
+ {
+ ImageBitmap = Bitmap { File = "ncollate_h.png" ; };
+ };
+ };
+
+ TabPage SV_PRINT_TAB_OPT
+ {
+ Text [en-US] = "Options";
+ Hide = TRUE;
+
+ FixedLine SV_PRINT_OPT_PRINT_FL
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 150, 10 );
+ Text [en-US] = "Options";
+ };
+ CheckBox SV_PRINT_OPT_TOFILE
+ {
+ Pos = MAP_APPFONT( 10, 20 );
+ Size = MAP_APPFONT( 200, 12 );
+ Text [en-US] = "Print to ~file";
+ HelpText [en-US] = "Check to send output to a file instead of the actual printer.";
+ };
+ CheckBox SV_PRINT_OPT_SINGLEJOBS
+ {
+ Pos = MAP_APPFONT( 10, 35 );
+ Size = MAP_APPFONT( 200, 12 );
+ Text [en-US] = "~Create single print jobs for collated output";
+ HelpText [en-US] = "Check to not rely on the printer to create collated copies but create a print job for each copy instead.";
+ };
+ CheckBox SV_PRINT_OPT_REVERSE
+ {
+ Pos = MAP_APPFONT( 10, 50 );
+ Size = MAP_APPFONT( 200, 12 );
+ Text [en-US] = "Print in ~reverse page order";
+ HelpText [en-US] = "Check to print pages in reverse order.";
+ };
+ };
+};
+
+ModelessDialog SV_DLG_PRINT_PROGRESS
+{
+ Text [en-US] = "Printing";
+ Closeable = FALSE;
+ Sizeable = FALSE;
+ Moveable = TRUE;
+ SVLook = TRUE;
+
+ Size = MAP_APPFONT( 120, 70 );
+
+ CancelButton SV_PRINT_PROGRESS_CANCEL
+ {
+ Pos = MAP_APPFONT( 35, 50 );
+ Size = MAP_APPFONT( 50, 15 );
+ };
+ FixedText SV_PRINT_PROGRESS_TEXT
+ {
+ Pos = MAP_APPFONT( 5,10 );
+ Size = MAP_APPFONT( 110, 10 );
+ Text [ en-US ] = "Page %p of %n";
+ Center = TRUE;
+ };
+};
+
+ErrorBox SV_PRINT_NOPRINTERWARNING
+{
+ Title = "%PRODUCTNAME";
+ Message [en-US] = "No default printer found.\nPlease choose a printer and try again.";
+};
+
+ErrorBox SV_PRINT_NOCONTENT
+{
+ Title = "%PRODUCTNAME";
+ Message [en-US] = "There are no pages to be printed. Please check your document for ranges relevant to printing.";
+};
+
+StringArray SV_PRINT_NATIVE_STRINGS
+{
+ ItemList [en-US] =
+ {
+ < "Preview"; >;
+ < "Page number"; >;
+ < "Number of pages"; >;
+ < "More"; >;
+ };
+};
diff --git a/vcl/source/src/stdtext.src b/vcl/source/src/stdtext.src
index 5ad1cdceeb61..d4dca4915b6b 100644
--- a/vcl/source/src/stdtext.src
+++ b/vcl/source/src/stdtext.src
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: stdtext.src,v $
- * $Revision: 1.53 $
+ * $Revision: 1.53.84.1 $
*
* This file is part of OpenOffice.org.
*
@@ -123,3 +123,8 @@ String SV_MAC_SCREENNNAME
{
Text [en-US] = "Screen %d";
};
+
+String SV_STDTEXT_ALLFILETYPES
+{
+ Text [en-US] = "Any type";
+};
diff --git a/vcl/source/window/arrange.cxx b/vcl/source/window/arrange.cxx
new file mode 100644
index 000000000000..0199af7ed50d
--- /dev/null
+++ b/vcl/source/window/arrange.cxx
@@ -0,0 +1,906 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: accel.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_vcl.hxx"
+
+#include "vcl/arrange.hxx"
+#include "vcl/edit.hxx"
+
+#include "osl/diagnose.h"
+
+using namespace vcl;
+
+// ----------------------------------------
+// vcl::WindowArranger
+//-----------------------------------------
+
+WindowArranger::~WindowArranger()
+{}
+
+void WindowArranger::setParent( WindowArranger* i_pParent )
+{
+ OSL_VERIFY( i_pParent->m_pParentWindow == m_pParentWindow || m_pParentWindow == NULL );
+
+ m_pParentArranger = i_pParent;
+ m_pParentWindow = i_pParent->m_pParentWindow;
+ setParentWindow( m_pParentWindow );
+}
+
+void WindowArranger::setParentWindow( Window* i_pNewParent )
+{
+ m_pParentWindow = i_pNewParent;
+
+ size_t nEle = countElements();
+ for( size_t i = 0; i < nEle; i++ )
+ {
+ Element* pEle = getElement( i );
+ if( pEle ) // sanity check
+ {
+ #if OSL_DEBUG_LEVEL > 0
+ if( pEle->m_pElement )
+ {
+ OSL_VERIFY( pEle->m_pElement->GetParent() == i_pNewParent );
+ }
+ #endif
+ if( pEle->m_pChild )
+ pEle->m_pChild->setParentWindow( i_pNewParent );
+ }
+ }
+}
+
+void WindowArranger::show( bool i_bShow, bool i_bImmediateUpdate )
+{
+ size_t nEle = countElements();
+ for( size_t i = 0; i < nEle; i++ )
+ {
+ Element* pEle = getElement( i );
+ if( pEle ) // sanity check
+ {
+ pEle->m_bHidden = ! i_bShow;
+ if( pEle->m_pElement )
+ pEle->m_pElement->Show( i_bShow );
+ if( pEle->m_pChild.get() )
+ pEle->m_pChild->show( i_bShow, false );
+ }
+ }
+ if( m_pParentArranger )
+ {
+ nEle = m_pParentArranger->countElements();
+ for( size_t i = 0; i < nEle; i++ )
+ {
+ Element* pEle = m_pParentArranger->getElement( i );
+ if( pEle && pEle->m_pChild.get() == this )
+ {
+ pEle->m_bHidden = ! i_bShow;
+ break;
+ }
+ }
+ }
+ if( i_bImmediateUpdate )
+ {
+ // find the topmost parent
+ WindowArranger* pResize = this;
+ while( pResize->m_pParentArranger )
+ pResize = pResize->m_pParentArranger;
+ pResize->resize();
+ }
+}
+
+bool WindowArranger::isVisible() const
+{
+ size_t nEle = countElements();
+ for( size_t i = 0; i < nEle; i++ )
+ {
+ const Element* pEle = getConstElement( i );
+ if( pEle->isVisible() )
+ return true;
+ }
+ return false;
+}
+
+bool WindowArranger::Element::isVisible() const
+{
+ bool bVisible = false;
+ if( ! m_bHidden )
+ {
+ if( m_pElement )
+ bVisible = m_pElement->IsVisible();
+ else if( m_pChild )
+ bVisible = m_pChild->isVisible();
+ }
+ return bVisible;
+}
+
+sal_Int32 WindowArranger::Element::getExpandPriority() const
+{
+ sal_Int32 nPrio = m_nExpandPriority;
+ if( m_pChild && m_nExpandPriority >= 0 )
+ {
+ size_t nElements = m_pChild->countElements();
+ for( size_t i = 0; i < nElements; i++ )
+ {
+ sal_Int32 nCPrio = m_pChild->getExpandPriority( i );
+ if( nCPrio > nPrio )
+ nPrio = nCPrio;
+ }
+ }
+ return nPrio;
+}
+
+Size WindowArranger::Element::getOptimalSize( WindowSizeType i_eType ) const
+{
+ Size aResult;
+ if( ! m_bHidden )
+ {
+ if( m_pElement && m_pElement->IsVisible() )
+ aResult = m_pElement->GetOptimalSize( i_eType );
+ else if( m_pChild )
+ aResult = m_pChild->getOptimalSize( i_eType );
+ if( aResult.Width() < m_aMinSize.Width() )
+ aResult.Width() = m_aMinSize.Width();
+ if( aResult.Height() < m_aMinSize.Height() )
+ aResult.Height() = m_aMinSize.Height();
+ aResult.Width() += m_nLeftBorder + m_nRightBorder;
+ aResult.Height() += m_nTopBorder + m_nBottomBorder;
+ }
+
+ return aResult;
+}
+
+void WindowArranger::Element::setPosSize( const Point& i_rPos, const Size& i_rSize )
+{
+ Point aPoint( i_rPos );
+ Size aSize( i_rSize );
+ aPoint.X() += m_nLeftBorder;
+ aPoint.Y() += m_nTopBorder;
+ aSize.Width() -= m_nLeftBorder + m_nRightBorder;
+ aSize.Height() -= m_nTopBorder + m_nBottomBorder;
+ if( m_pElement )
+ m_pElement->SetPosSizePixel( aPoint, aSize );
+ else if( m_pChild )
+ m_pChild->setManagedArea( Rectangle( aPoint, aSize ) );
+}
+
+// ----------------------------------------
+// vcl::RowOrColumn
+//-----------------------------------------
+
+RowOrColumn::~RowOrColumn()
+{
+ for( std::vector< WindowArranger::Element >::iterator it = m_aElements.begin();
+ it != m_aElements.end(); ++it )
+ {
+ it->deleteChild();
+ }
+}
+
+Size RowOrColumn::getOptimalSize( WindowSizeType i_eType ) const
+{
+ Size aRet( 0, 0 );
+ for( std::vector< WindowArranger::Element >::const_iterator it = m_aElements.begin();
+ it != m_aElements.end(); ++it )
+ {
+ if( it->isVisible() )
+ {
+ // get the size of type of the managed element
+ Size aElementSize( it->getOptimalSize( i_eType ) );
+ if( m_bColumn )
+ {
+ // add the distance between elements
+ aRet.Height() += m_nBorderWidth;
+ // check if the width needs adjustment
+ if( aRet.Width() < aElementSize.Width() )
+ aRet.Width() = aElementSize.Width();
+ aRet.Height() += aElementSize.Height();
+ }
+ else
+ {
+ // add the distance between elements
+ aRet.Width() += m_nBorderWidth;
+ // check if the height needs adjustment
+ if( aRet.Height() < aElementSize.Height() )
+ aRet.Height() = aElementSize.Height();
+ aRet.Width() += aElementSize.Width();
+ }
+ }
+ }
+
+ if( aRet.Width() != 0 || aRet.Height() != 0 )
+ {
+ // subtract the border for the first element
+ if( m_bColumn )
+ aRet.Height() -= m_nBorderWidth;
+ else
+ aRet.Width() -= m_nBorderWidth;
+
+ // add the outer border
+ aRet.Width() += 2*m_nOuterBorder;
+ aRet.Height() += 2*m_nOuterBorder;
+ }
+
+ return aRet;
+}
+
+void RowOrColumn::distributeRowWidth( std::vector<Size>& io_rSizes, long /*i_nUsedWidth*/, long i_nExtraWidth )
+{
+ if( ! io_rSizes.empty() && io_rSizes.size() == m_aElements.size() )
+ {
+ // find all elements with the highest expand priority
+ size_t nElements = m_aElements.size();
+ std::vector< size_t > aIndices;
+ sal_Int32 nHighPrio = 0;
+ for( size_t i = 0; i < nElements; i++ )
+ {
+ if( m_aElements[ i ].isVisible() )
+ {
+ sal_Int32 nCurPrio = m_aElements[ i ].getExpandPriority();
+ if( nCurPrio > nHighPrio )
+ {
+ aIndices.clear();
+ nHighPrio = nCurPrio;
+ }
+ if( nCurPrio == nHighPrio )
+ aIndices.push_back( i );
+ }
+ }
+
+ // distribute extra space evenly among collected elements
+ nElements = aIndices.size();
+ if( nElements > 0 )
+ {
+ long nDelta = i_nExtraWidth / nElements;
+ for( size_t i = 0; i < nElements; i++ )
+ {
+ io_rSizes[ aIndices[i] ].Width() += nDelta;
+ i_nExtraWidth -= nDelta;
+ }
+ // add the last pixels to the last row element
+ if( i_nExtraWidth > 0 && nElements > 0 )
+ io_rSizes[aIndices.back()].Width() += i_nExtraWidth;
+ }
+ }
+}
+
+void RowOrColumn::distributeColumnHeight( std::vector<Size>& io_rSizes, long /*i_nUsedHeight*/, long i_nExtraHeight )
+{
+ if( ! io_rSizes.empty() && io_rSizes.size() == m_aElements.size() )
+ {
+ // find all elements with the highest expand priority
+ size_t nElements = m_aElements.size();
+ std::vector< size_t > aIndices;
+ sal_Int32 nHighPrio = 3;
+ for( size_t i = 0; i < nElements; i++ )
+ {
+ if( m_aElements[ i ].isVisible() )
+ {
+ sal_Int32 nCurPrio = m_aElements[ i ].getExpandPriority();
+ if( nCurPrio > nHighPrio )
+ {
+ aIndices.clear();
+ nHighPrio = nCurPrio;
+ }
+ if( nCurPrio == nHighPrio )
+ aIndices.push_back( i );
+ }
+ }
+
+ // distribute extra space evenly among collected elements
+ nElements = aIndices.size();
+ if( nElements > 0 )
+ {
+ long nDelta = i_nExtraHeight / nElements;
+ for( size_t i = 0; i < nElements; i++ )
+ {
+ io_rSizes[ aIndices[i] ].Height() += nDelta;
+ i_nExtraHeight -= nDelta;
+ }
+ // add the last pixels to the last row element
+ if( i_nExtraHeight > 0 && nElements > 0 )
+ io_rSizes[aIndices.back()].Height() += i_nExtraHeight;
+ }
+ }
+}
+
+void RowOrColumn::resize()
+{
+ // check if we can get optimal size, else fallback to minimal size
+ Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED ) );
+ WindowSizeType eType = WINDOWSIZE_PREFERRED;
+ if( m_bColumn )
+ {
+ if( aOptSize.Height() > m_aManagedArea.GetHeight() )
+ eType = WINDOWSIZE_MINIMUM;
+ }
+ else
+ {
+ if( aOptSize.Width() > m_aManagedArea.GetWidth() )
+ eType = WINDOWSIZE_MINIMUM;
+ }
+
+ size_t nElements = m_aElements.size();
+ // get all element sizes for sizing
+ std::vector<Size> aElementSizes( nElements );
+ long nUsedWidth = 2*m_nOuterBorder - (nElements ? m_nBorderWidth : 0);
+ for( size_t i = 0; i < nElements; i++ )
+ {
+ if( m_aElements[i].isVisible() )
+ {
+ aElementSizes[i] = m_aElements[i].getOptimalSize( eType );
+ if( m_bColumn )
+ {
+ aElementSizes[i].Width() = m_aManagedArea.GetWidth() - 2* m_nOuterBorder;
+ nUsedWidth += aElementSizes[i].Height() + m_nBorderWidth;
+ }
+ else
+ {
+ aElementSizes[i].Height() = m_aManagedArea.GetHeight() - 2* m_nOuterBorder;
+ nUsedWidth += aElementSizes[i].Width() + m_nBorderWidth;
+ }
+ }
+ }
+
+ long nExtraWidth = (m_bColumn ? m_aManagedArea.GetHeight() : m_aManagedArea.GetWidth()) - nUsedWidth;
+ if( nExtraWidth > 0 )
+ {
+ if( m_bColumn )
+ distributeColumnHeight( aElementSizes, nUsedWidth, nExtraWidth );
+ else
+ distributeRowWidth( aElementSizes, nUsedWidth, nExtraWidth );
+ }
+
+ // get starting position
+ Point aElementPos( m_aManagedArea.TopLeft() );
+ // outer border
+ aElementPos.X() += m_nOuterBorder;
+ aElementPos.Y() += m_nOuterBorder;
+
+ // position managed windows
+ for( size_t i = 0; i < nElements; i++ )
+ {
+ // get the size of type of the managed element
+ if( m_aElements[i].isVisible() )
+ {
+ m_aElements[i].setPosSize( aElementPos, aElementSizes[i] );
+ if( m_bColumn )
+ aElementPos.Y() += m_nBorderWidth + aElementSizes[i].Height();
+ else
+ aElementPos.X() += m_nBorderWidth + aElementSizes[i].Width();
+ }
+ }
+}
+
+size_t RowOrColumn::addWindow( Window* i_pWindow, sal_Int32 i_nExpandPrio, size_t i_nIndex )
+{
+ size_t nIndex = i_nIndex;
+ if( i_nIndex >= m_aElements.size() )
+ {
+ nIndex = m_aElements.size();
+ m_aElements.push_back( WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio ) );
+ }
+ else
+ {
+ std::vector< WindowArranger::Element >::iterator it = m_aElements.begin();
+ while( i_nIndex-- )
+ ++it;
+ m_aElements.insert( it, WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio ) );
+ }
+ return nIndex;
+}
+
+size_t RowOrColumn::addChild( boost::shared_ptr<WindowArranger> const & i_pChild, sal_Int32 i_nExpandPrio, size_t i_nIndex )
+{
+ size_t nIndex = i_nIndex;
+ if( i_nIndex >= m_aElements.size() )
+ {
+ nIndex = m_aElements.size();
+ m_aElements.push_back( WindowArranger::Element( NULL, i_pChild, i_nExpandPrio ) );
+ }
+ else
+ {
+ std::vector< WindowArranger::Element >::iterator it = m_aElements.begin();
+ while( i_nIndex-- )
+ ++it;
+ m_aElements.insert( it, WindowArranger::Element( NULL, i_pChild, i_nExpandPrio ) );
+ }
+ return nIndex;
+}
+
+void RowOrColumn::remove( Window* i_pWindow )
+{
+ if( i_pWindow )
+ {
+ for( std::vector< WindowArranger::Element >::iterator it = m_aElements.begin();
+ it != m_aElements.end(); ++it )
+ {
+ if( it->m_pElement == i_pWindow )
+ {
+ m_aElements.erase( it );
+ return;
+ }
+ }
+ }
+}
+
+void RowOrColumn::remove( boost::shared_ptr<WindowArranger> const & i_pChild )
+{
+ if( i_pChild )
+ {
+ for( std::vector< WindowArranger::Element >::iterator it = m_aElements.begin();
+ it != m_aElements.end(); ++it )
+ {
+ if( it->m_pChild == i_pChild )
+ {
+ m_aElements.erase( it );
+ return;
+ }
+ }
+ }
+}
+
+// ----------------------------------------
+// vcl::LabeledElement
+//-----------------------------------------
+
+LabeledElement::~LabeledElement()
+{
+ m_aLabel.deleteChild();
+ m_aElement.deleteChild();
+}
+
+Size LabeledElement::getOptimalSize( WindowSizeType i_eType ) const
+{
+ Size aRet( m_aLabel.getOptimalSize( WINDOWSIZE_MINIMUM ) );
+ if( aRet.Width() != 0 )
+ {
+ if( m_nLabelColumnWidth != 0 )
+ aRet.Width() = m_nLabelColumnWidth;
+ else
+ aRet.Width() += m_nDistance;
+ }
+ Size aElementSize( m_aElement.getOptimalSize( i_eType ) );
+ aRet.Width() += aElementSize.Width();
+ if( aElementSize.Height() > aRet.Height() )
+ aRet.Height() = aElementSize.Height();
+ if( aRet.Height() != 0 )
+ aRet.Height() += 2*m_nOuterBorder;
+
+ return aRet;
+}
+
+void LabeledElement::resize()
+{
+ Size aLabelSize( m_aLabel.getOptimalSize( WINDOWSIZE_MINIMUM ) );
+ Size aElementSize( m_aElement.getOptimalSize( WINDOWSIZE_PREFERRED ) );
+ if( m_nDistance + aLabelSize.Width() + aElementSize.Width() > m_aManagedArea.GetWidth() )
+ aElementSize = m_aElement.getOptimalSize( WINDOWSIZE_MINIMUM );
+
+ // align label and element vertically in LabeledElement
+ long nYOff = (m_aManagedArea.GetHeight() - 2*m_nOuterBorder - aLabelSize.Height()) / 2;
+ Point aPos( m_aManagedArea.Left(),
+ m_aManagedArea.Top() + m_nOuterBorder + nYOff );
+ Size aSize( aLabelSize );
+ if( m_nLabelColumnWidth != 0 )
+ aSize.Width() = m_nLabelColumnWidth;
+ m_aLabel.setPosSize( aPos, aSize );
+
+ aPos.X() += aSize.Width() + m_nDistance;
+ nYOff = (m_aManagedArea.GetHeight() - 2*m_nOuterBorder - aElementSize.Height()) / 2;
+ aPos.Y() = m_aManagedArea.Top() + m_nOuterBorder + nYOff;
+ aSize.Width() = aElementSize.Width();
+ aSize.Height() = m_aManagedArea.GetHeight() - 2*m_nOuterBorder;
+
+ // label style
+ // 0: position left and right
+ // 1: keep the element close to label and grow it
+ // 2: keep the element close and don't grow it
+ if( m_nLabelStyle == 0)
+ {
+ if( aPos.X() + aSize.Width() < m_aManagedArea.Right() )
+ aPos.X() = m_aManagedArea.Right() - aSize.Width();
+ }
+ else if( m_nLabelStyle == 1 )
+ {
+ if( aPos.X() + aSize.Width() < m_aManagedArea.Right() )
+ aSize.Width() = m_aManagedArea.Right() - aPos.X();
+ }
+ m_aElement.setPosSize( aPos, aSize );
+}
+
+void LabeledElement::setLabel( Window* i_pLabel )
+{
+ m_aLabel.m_pElement = i_pLabel;
+ m_aLabel.m_pChild.reset();
+}
+
+void LabeledElement::setLabel( boost::shared_ptr<WindowArranger> const & i_pLabel )
+{
+ m_aLabel.m_pElement = NULL;
+ m_aLabel.m_pChild = i_pLabel;
+}
+
+void LabeledElement::setElement( Window* i_pElement )
+{
+ m_aElement.m_pElement = i_pElement;
+ m_aElement.m_pChild.reset();
+}
+
+void LabeledElement::setElement( boost::shared_ptr<WindowArranger> const & i_pElement )
+{
+ m_aElement.m_pElement = NULL;
+ m_aElement.m_pChild = i_pElement;
+}
+
+// ----------------------------------------
+// vcl::LabelColumn
+//-----------------------------------------
+LabelColumn::~LabelColumn()
+{
+}
+
+long LabelColumn::getLabelWidth() const
+{
+ long nWidth = 0;
+
+ size_t nEle = countElements();
+ for( size_t i = 0; i < nEle; i++ )
+ {
+ const Element* pEle = getConstElement( i );
+ if( pEle && pEle->m_pChild.get() )
+ {
+ const LabeledElement* pLabel = dynamic_cast< const LabeledElement* >(pEle->m_pChild.get());
+ if( pLabel )
+ {
+ Window* pLW = pLabel->getWindow( 0 );
+ if( pLW )
+ {
+ Size aLabSize( pLW->GetOptimalSize( WINDOWSIZE_MINIMUM ) );
+ if( aLabSize.Width() > nWidth )
+ nWidth = aLabSize.Width();
+ }
+ }
+ }
+ }
+ return nWidth + getBorderWidth();
+}
+
+Size LabelColumn::getOptimalSize( WindowSizeType i_eType ) const
+{
+ long nWidth = getLabelWidth();
+ Size aColumnSize;
+
+ // every child is a LabeledElement
+ size_t nEle = countElements();
+ for( size_t i = 0; i < nEle; i++ )
+ {
+ Size aElementSize;
+ const Element* pEle = getConstElement( i );
+ if( pEle && pEle->m_pChild.get() )
+ {
+ const LabeledElement* pLabel = dynamic_cast< const LabeledElement* >(pEle->m_pChild.get());
+ if( pLabel ) // we have a label
+ {
+ aElementSize = pLabel->getLabelSize( WINDOWSIZE_MINIMUM );
+ if( aElementSize.Width() )
+ aElementSize.Width() = nWidth;
+ Size aSize( pLabel->getElementSize( i_eType ) );
+ aElementSize.Width() += aSize.Width();
+ if( aSize.Height() > aElementSize.Height() )
+ aElementSize.Height() = aSize.Height();
+ }
+ else // a non label, just treat it as a row
+ {
+ aElementSize = pEle->getOptimalSize( i_eType );
+ }
+ }
+ else if( pEle && pEle->m_pElement ) // a general window, treat is as a row
+ {
+ aElementSize = pEle->getOptimalSize( i_eType );
+ }
+ if( aElementSize.Width() )
+ {
+ aElementSize.Width() += 2*m_nOuterBorder;
+ if( aElementSize.Width() > aColumnSize.Width() )
+ aColumnSize.Width() = aElementSize.Width();
+ }
+ if( aElementSize.Height() )
+ {
+ aColumnSize.Height() += getBorderWidth() + aElementSize.Height();
+ }
+ }
+ if( nEle > 0 && aColumnSize.Height() )
+ {
+ aColumnSize.Height() -= getBorderWidth(); // for the first element
+ aColumnSize.Height() += 2*m_nOuterBorder;
+ }
+ return aColumnSize;
+}
+
+void LabelColumn::resize()
+{
+ long nWidth = getLabelWidth();
+ size_t nEle = countElements();
+ for( size_t i = 0; i < nEle; i++ )
+ {
+ Element* pEle = getElement( i );
+ if( pEle && pEle->m_pChild.get() )
+ {
+ LabeledElement* pLabel = dynamic_cast< LabeledElement* >(pEle->m_pChild.get());
+ if( pLabel )
+ pLabel->setLabelColumnWidth( nWidth );
+ }
+ }
+ RowOrColumn::resize();
+}
+
+size_t LabelColumn::addRow( Window* i_pLabel, boost::shared_ptr<WindowArranger> const& i_rElement, long i_nIndent )
+{
+ boost::shared_ptr< LabeledElement > xLabel( new LabeledElement( this, 1 ) );
+ xLabel->setLabel( i_pLabel );
+ xLabel->setBorders( 0, i_nIndent, 0, 0, 0 );
+ xLabel->setElement( i_rElement );
+ size_t nIndex = addChild( xLabel );
+ resize();
+ return nIndex;
+}
+
+size_t LabelColumn::addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent )
+{
+ boost::shared_ptr< LabeledElement > xLabel( new LabeledElement( this, 1 ) );
+ xLabel->setLabel( i_pLabel );
+ xLabel->setBorders( 0, i_nIndent, 0, 0, 0 );
+ xLabel->setElement( i_pElement );
+ size_t nIndex = addChild( xLabel );
+ resize();
+ return nIndex;
+}
+
+// ----------------------------------------
+// vcl::Indenter
+//-----------------------------------------
+
+Indenter::~Indenter()
+{
+ m_aElement.deleteChild();
+}
+
+Size Indenter::getOptimalSize( WindowSizeType i_eType ) const
+{
+ Size aSize( m_aElement.getOptimalSize( i_eType ) );
+ aSize.Width() += 2*m_nOuterBorder + m_nIndent;
+ aSize.Height() += 2*m_nOuterBorder;
+ return aSize;
+}
+
+void Indenter::resize()
+{
+ Point aPt( m_aManagedArea.TopLeft() );
+ aPt.X() += m_nOuterBorder + m_nIndent;
+ aPt.Y() += m_nOuterBorder;
+ Size aSz( m_aManagedArea.GetSize() );
+ aSz.Width() -= 2*m_nOuterBorder + m_nIndent;
+ aSz.Height() -= 2*m_nOuterBorder;
+ m_aElement.setPosSize( aPt, aSz );
+}
+
+void Indenter::setWindow( Window* i_pWindow, sal_Int32 i_nExpandPrio )
+{
+ OSL_VERIFY( (m_aElement.m_pElement == 0 && m_aElement.m_pChild == 0) || i_pWindow == 0 );
+ OSL_VERIFY( i_pWindow == 0 || i_pWindow->GetParent() == m_pParentWindow );
+ m_aElement.m_pElement = i_pWindow;
+ m_aElement.m_nExpandPriority = i_nExpandPrio;
+}
+
+void Indenter::setChild( boost::shared_ptr<WindowArranger> const & i_pChild, sal_Int32 i_nExpandPrio )
+{
+ OSL_VERIFY( (m_aElement.m_pElement == 0 && m_aElement.m_pChild == 0 ) || i_pChild == 0 );
+ m_aElement.m_pChild = i_pChild;
+ m_aElement.m_nExpandPriority = i_nExpandPrio;
+}
+
+// ----------------------------------------
+// vcl::MatrixArranger
+//-----------------------------------------
+MatrixArranger::~MatrixArranger()
+{
+}
+
+Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights ) const
+{
+ Size aMatrixSize( 2*m_nOuterBorder, 2*m_nOuterBorder );
+
+ // first find out the current number of rows and columns
+ sal_uInt32 nRows = 0, nColumns = 0;
+ for( std::vector< MatrixElement >::const_iterator it = m_aElements.begin();
+ it != m_aElements.end(); ++it )
+ {
+ if( it->m_nX >= nColumns )
+ nColumns = it->m_nX+1;
+ if( it->m_nY >= nRows )
+ nRows = it->m_nY+1;
+ }
+
+ // now allocate row and column depth vectors
+ o_rColumnWidths = std::vector< long >( nColumns, 0 );
+ o_rRowHeights = std::vector< long >( nRows, 0 );
+
+ // get sizes an allocate them into rows/columns
+ for( std::vector< MatrixElement >::const_iterator it = m_aElements.begin();
+ it != m_aElements.end(); ++it )
+ {
+ Size aSize( it->getOptimalSize( i_eType ) );
+ if( aSize.Width() > o_rColumnWidths[ it->m_nX ] )
+ o_rColumnWidths[ it->m_nX ] = aSize.Width();
+ if( aSize.Height() > o_rRowHeights[ it->m_nY ] )
+ o_rRowHeights[ it->m_nY ] = aSize.Height();
+ }
+
+ // add up sizes
+ for( sal_uInt32 i = 0; i < nColumns; i++ )
+ aMatrixSize.Width() += o_rColumnWidths[i] + m_nBorderX;
+ if( nColumns > 0 )
+ aMatrixSize.Width() -= m_nBorderX;
+
+ for( sal_uInt32 i = 0; i < nRows; i++ )
+ aMatrixSize.Height() += o_rRowHeights[i] + m_nBorderY;
+ if( nRows > 0 )
+ aMatrixSize.Height() -= m_nBorderY;
+
+ return aMatrixSize;
+}
+
+Size MatrixArranger::getOptimalSize( WindowSizeType i_eType ) const
+{
+ std::vector<long> aColumnWidths, aRowHeights;
+ return getOptimalSize( i_eType, aColumnWidths, aRowHeights );
+}
+
+void MatrixArranger::resize()
+{
+ // assure that we have at least one row and column
+ if( m_aElements.empty() )
+ return;
+
+ // check if we can get optimal size, else fallback to minimal size
+ std::vector<long> aColumnWidths, aRowHeights;
+ Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED, aColumnWidths, aRowHeights ) );
+ if( aOptSize.Height() > m_aManagedArea.GetHeight() ||
+ aOptSize.Width() > m_aManagedArea.GetWidth() )
+ {
+ std::vector<long> aMinColumnWidths, aMinRowHeights;
+ getOptimalSize( WINDOWSIZE_MINIMUM, aMinColumnWidths, aMinRowHeights );
+ if( aOptSize.Height() > m_aManagedArea.GetHeight() )
+ aRowHeights = aMinRowHeights;
+ if( aOptSize.Width() > m_aManagedArea.GetWidth() )
+ aColumnWidths = aMinColumnWidths;
+ }
+
+ // FIXME: distribute extra space available
+
+ // prepare offsets
+ std::vector<long> aColumnX( aColumnWidths.size() );
+ aColumnX[0] = m_aManagedArea.Left() + m_nOuterBorder;
+ for( size_t i = 1; i < aColumnX.size(); i++ )
+ aColumnX[i] = aColumnX[i-1] + aColumnWidths[i-1] + m_nBorderX;
+
+ std::vector<long> aRowY( aRowHeights.size() );
+ aRowY[0] = m_aManagedArea.Top() + m_nOuterBorder;
+ for( size_t i = 1; i < aRowY.size(); i++ )
+ aRowY[i] = aRowY[i-1] + aRowHeights[i-1] + m_nBorderY;
+
+ // now iterate over the elements and assign their positions
+ for( std::vector< MatrixElement >::iterator it = m_aElements.begin();
+ it != m_aElements.end(); ++it )
+ {
+ Point aCellPos( aColumnX[it->m_nX], aRowY[it->m_nY] );
+ Size aCellSize( aColumnWidths[it->m_nX], aRowHeights[it->m_nY] );
+ it->setPosSize( aCellPos, aCellSize );
+ }
+}
+
+size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio )
+{
+ sal_uInt64 nMapValue = getMap( i_nX, i_nY );
+ std::map< sal_uInt64, size_t >::const_iterator it = m_aMatrixMap.find( nMapValue );
+ size_t nIndex = 0;
+ if( it == m_aMatrixMap.end() )
+ {
+ m_aMatrixMap[ nMapValue ] = nIndex = m_aElements.size();
+ m_aElements.push_back( MatrixElement( i_pWindow, i_nX, i_nY, boost::shared_ptr<WindowArranger>(), i_nExpandPrio ) );
+ }
+ else
+ {
+ MatrixElement& rEle( m_aElements[ it->second ] );
+ rEle.m_pElement = i_pWindow;
+ rEle.m_pChild.reset();
+ rEle.m_nExpandPriority = i_nExpandPrio;
+ rEle.m_nX = i_nX;
+ rEle.m_nY = i_nY;
+ nIndex = it->second;
+ }
+ return nIndex;
+}
+
+void MatrixArranger::remove( Window* i_pWindow )
+{
+ if( i_pWindow )
+ {
+ for( std::vector< MatrixElement >::iterator it = m_aElements.begin();
+ it != m_aElements.end(); ++it )
+ {
+ if( it->m_pElement == i_pWindow )
+ {
+ m_aMatrixMap.erase( getMap( it->m_nX, it->m_nY ) );
+ m_aElements.erase( it );
+ return;
+ }
+ }
+ }
+}
+
+size_t MatrixArranger::addChild( boost::shared_ptr<WindowArranger> const &i_pChild, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio )
+{
+ sal_uInt64 nMapValue = getMap( i_nX, i_nY );
+ std::map< sal_uInt64, size_t >::const_iterator it = m_aMatrixMap.find( nMapValue );
+ size_t nIndex = 0;
+ if( it == m_aMatrixMap.end() )
+ {
+ m_aMatrixMap[ nMapValue ] = nIndex = m_aElements.size();
+ m_aElements.push_back( MatrixElement( NULL, i_nX, i_nY, i_pChild, i_nExpandPrio ) );
+ }
+ else
+ {
+ MatrixElement& rEle( m_aElements[ it->second ] );
+ rEle.m_pElement = 0;
+ rEle.m_pChild = i_pChild;
+ rEle.m_nExpandPriority = i_nExpandPrio;
+ rEle.m_nX = i_nX;
+ rEle.m_nY = i_nY;
+ nIndex = it->second;
+ }
+ return nIndex;
+}
+
+void MatrixArranger::remove( boost::shared_ptr<WindowArranger> const &i_pChild )
+{
+ if( i_pChild )
+ {
+ for( std::vector< MatrixElement >::iterator it = m_aElements.begin();
+ it != m_aElements.end(); ++it )
+ {
+ if( it->m_pChild == i_pChild )
+ {
+ m_aMatrixMap.erase( getMap( it->m_nX, it->m_nY ) );
+ m_aElements.erase( it );
+ return;
+ }
+ }
+ }
+}
+
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index c6f64d74c5fc..a332c89dc9be 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -36,6 +36,7 @@
#include <vcl/svapp.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/tabctrl.hxx>
+#include <vcl/tabdlg.hxx>
#include <vcl/button.hxx>
#include <vcl/window.h>
@@ -888,6 +889,20 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
return TRUE;
}
+ // if we have come here (and therefore the strange "formular" logic above
+ // turned up no result, then let's try to find a customer for Ctrl-TAB
+ if ( nKeyCode == KEY_TAB && aKeyCode.IsMod1() && ! aKeyCode.IsMod2() )
+ {
+ TabDialog* pDlg = dynamic_cast<TabDialog*>(this);
+ if( pDlg )
+ {
+ TabControl* pTabCtrl = pDlg->ImplGetFirstTabControl();
+ NotifyEvent aEvt( bKeyInput ? EVENT_KEYINPUT : EVENT_KEYUP,
+ pTabCtrl, &rKEvt );
+ return pTabCtrl->ImplHandleNotifyEvent( aEvt );
+ }
+ }
+
return FALSE;
}
diff --git a/vcl/source/window/makefile.mk b/vcl/source/window/makefile.mk
index 169cf44b2b13..8b3c01f5721e 100644
--- a/vcl/source/window/makefile.mk
+++ b/vcl/source/window/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.25 $
+# $Revision: 1.25.114.1 $
#
# This file is part of OpenOffice.org.
#
@@ -45,6 +45,7 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
SLOFILES= \
+ $(SLO)$/arrange.obj \
$(SLO)$/abstdlg.obj \
$(SLO)$/accel.obj \
$(SLO)$/accmgr.obj \
@@ -69,7 +70,9 @@ SLOFILES= \
$(SLO)$/mnemonic.obj \
$(SLO)$/mnemonicengine.obj \
$(SLO)$/msgbox.obj \
+ $(SLO)$/popupmenuwindow.obj \
$(SLO)$/scrwnd.obj \
+ $(SLO)$/printdlg.obj \
$(SLO)$/seleng.obj \
$(SLO)$/split.obj \
$(SLO)$/splitwin.obj \
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index c9e0c23e7f16..5b99cd084360 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -5578,6 +5578,17 @@ BOOL MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu
n = pMenu->GetItemCount()-1;
}
+ // handling gtk like (aka mbOpenMenuOnF10)
+ // do not highlight an item when opening a sub menu
+ // unless there already was a higlighted sub menu item
+ bool bWasHighlight = false;
+ if( pActivePopup )
+ {
+ MenuFloatingWindow* pSubWindow = dynamic_cast<MenuFloatingWindow*>(pActivePopup->ImplGetWindow());
+ if( pSubWindow )
+ bWasHighlight = (pSubWindow->GetHighlightedItem() != ITEMPOS_INVALID);
+ }
+
USHORT nLoop = n;
if( nCode == KEY_HOME )
@@ -5604,7 +5615,10 @@ BOOL MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu
MenuItemData* pData = (MenuItemData*)pMenu->GetItemList()->GetDataFromPos( n );
if ( ( pData->eType != MENUITEM_SEPARATOR ) && pMenu->ImplIsVisible( n ) )
{
- ChangeHighlightItem( n, TRUE );
+ BOOL bDoSelect = TRUE;
+ if( ImplGetSVData()->maNWFData.mbOpenMenuOnF10 )
+ bDoSelect = bWasHighlight;
+ ChangeHighlightItem( n, bDoSelect );
break;
}
} while ( n != nLoop );
diff --git a/vcl/source/window/popupmenuwindow.cxx b/vcl/source/window/popupmenuwindow.cxx
new file mode 100644
index 000000000000..29d60a7cc02d
--- /dev/null
+++ b/vcl/source/window/popupmenuwindow.cxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: floatwin.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "vcl/popupmenuwindow.hxx"
+
+#include <limits>
+
+struct PopupMenuFloatingWindow::ImplData
+{
+ sal_uInt16 mnMenuStackLevel; // Store the stack level of a popup menu. 0 = top-level menu.
+
+ ImplData();
+ ~ImplData();
+};
+
+PopupMenuFloatingWindow::ImplData::ImplData() :
+ mnMenuStackLevel( ::std::numeric_limits<sal_uInt16>::max() )
+{
+}
+
+PopupMenuFloatingWindow::ImplData::~ImplData()
+{
+}
+
+// ============================================================================
+
+PopupMenuFloatingWindow::PopupMenuFloatingWindow( Window* pParent, WinBits nStyle ) :
+ FloatingWindow(pParent, nStyle),
+ mpImplData(new ImplData)
+{
+}
+
+PopupMenuFloatingWindow::~PopupMenuFloatingWindow()
+{
+ delete mpImplData;
+}
+
+sal_uInt16 PopupMenuFloatingWindow::GetMenuStackLevel() const
+{
+ return mpImplData->mnMenuStackLevel;
+}
+
+void PopupMenuFloatingWindow::SetMenuStackLevel( sal_uInt16 nLevel )
+{
+ mpImplData->mnMenuStackLevel = nLevel;
+}
+
+bool PopupMenuFloatingWindow::IsPopupMenu() const
+{
+ return mpImplData->mnMenuStackLevel != ::std::numeric_limits<sal_uInt16>::max();
+}
+
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
new file mode 100644
index 000000000000..649ca21a32b8
--- /dev/null
+++ b/vcl/source/window/printdlg.cxx
@@ -0,0 +1,2489 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: printdlg.cxx,v $
+ * $Revision: 1.1.2.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_vcl.hxx"
+
+#include "vcl/print.hxx"
+#include "vcl/prndlg.hxx"
+#include "vcl/dialog.hxx"
+#include "vcl/button.hxx"
+#include "vcl/svdata.hxx"
+#include "vcl/svids.hrc"
+#include "vcl/wall.hxx"
+#include "vcl/jobset.h"
+#include "vcl/status.hxx"
+#include "vcl/decoview.hxx"
+#include "vcl/arrange.hxx"
+#include "vcl/configsettings.hxx"
+#include "vcl/help.hxx"
+#include "vcl/decoview.hxx"
+#include "vcl/svapp.hxx"
+
+#include "unotools/localedatawrapper.hxx"
+
+#include "rtl/ustrbuf.hxx"
+
+#include "com/sun/star/awt/Size.hpp"
+
+using namespace vcl;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+
+#define HELPID_PREFIX ".HelpId:vcl:PrintDialog"
+#define SMHID2( a, b ) SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( HELPID_PREFIX ":" a ":" b ) ), HID_PRINTDLG ) )
+#define SMHID1( a ) SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( HELPID_PREFIX ":" a ) ), HID_PRINTDLG ) )
+
+PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const ResId& i_rId )
+ : Window( i_pParent, i_rId )
+ , maOrigSize( 10, 10 )
+ , maPageVDev( *this )
+ , maToolTipString( String( VclResId( SV_PRINT_PRINTPREVIEW_TXT ) ) )
+{
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ if( GetSettings().GetStyleSettings().GetHighContrastMode() )
+ maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
+ else
+ maPageVDev.SetBackground( Color( COL_WHITE ) );
+}
+
+PrintDialog::PrintPreviewWindow::~PrintPreviewWindow()
+{
+}
+
+void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDCEvt )
+{
+ // react on settings changed
+ if( i_rDCEvt.GetType() == DATACHANGED_SETTINGS )
+ {
+ if( GetSettings().GetStyleSettings().GetHighContrastMode() )
+ maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
+ else
+ maPageVDev.SetBackground( Color( COL_WHITE ) );
+ }
+ Window::DataChanged( i_rDCEvt );
+}
+
+void PrintDialog::PrintPreviewWindow::Resize()
+{
+ Size aNewSize( GetSizePixel() );
+ // leave small space for decoration
+ aNewSize.Width() -= 2;
+ aNewSize.Height() -= 2;
+ Size aScaledSize;
+ double fScale = 1.0;
+
+ // #i106435# catch corner case of Size(0,0)
+ Size aOrigSize( maOrigSize );
+ if( aOrigSize.Width() < 1 )
+ aOrigSize.Width() = aNewSize.Width();
+ if( aOrigSize.Height() < 1 )
+ aOrigSize.Height() = aNewSize.Height();
+ if( aOrigSize.Width() > aOrigSize.Height() )
+ {
+ aScaledSize = Size( aNewSize.Width(), aNewSize.Width() * aOrigSize.Height() / aOrigSize.Width() );
+ if( aScaledSize.Height() > aNewSize.Height() )
+ fScale = double(aNewSize.Height())/double(aScaledSize.Height());
+ }
+ else
+ {
+ aScaledSize = Size( aNewSize.Height() * aOrigSize.Width() / aOrigSize.Height(), aNewSize.Height() );
+ if( aScaledSize.Width() > aNewSize.Width() )
+ fScale = double(aNewSize.Width())/double(aScaledSize.Width());
+ }
+ aScaledSize.Width() = long(aScaledSize.Width()*fScale);
+ aScaledSize.Height() = long(aScaledSize.Height()*fScale);
+ maPageVDev.SetOutputSizePixel( aScaledSize, FALSE );
+}
+
+void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& )
+{
+ Size aSize( GetSizePixel() );
+ if( maReplacementString.getLength() != 0 )
+ {
+ // replacement is active
+ Push();
+ Rectangle aTextRect( Point( 0, 0 ), aSize );
+ Font aFont( GetSettings().GetStyleSettings().GetFieldFont() );
+ aFont.SetSize( Size( 0, aSize.Height()/12 ) );
+ SetFont( aFont );
+ DrawText( aTextRect, maReplacementString,
+ TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE
+ );
+ Pop();
+ }
+ else
+ {
+ GDIMetaFile aMtf( maMtf );
+
+ Size aPreviewSize = maPageVDev.GetOutputSizePixel();
+ Point aOffset( (aSize.Width() - aPreviewSize.Width()) / 2,
+ (aSize.Height() - aPreviewSize.Height()) / 2 );
+
+ const Size aLogicSize( maPageVDev.PixelToLogic( aPreviewSize, MapMode( MAP_100TH_MM ) ) );
+ Size aOrigSize( maOrigSize );
+ if( aOrigSize.Width() < 1 )
+ aOrigSize.Width() = aLogicSize.Width();
+ if( aOrigSize.Height() < 1 )
+ aOrigSize.Height() = aLogicSize.Height();
+ double fScale = double(aLogicSize.Width())/double(aOrigSize.Width());
+
+
+ maPageVDev.Erase();
+ maPageVDev.Push();
+ maPageVDev.SetMapMode( MAP_100TH_MM );
+ aMtf.WindStart();
+ aMtf.Scale( fScale, fScale );
+ aMtf.WindStart();
+ aMtf.Play( &maPageVDev, Point( 0, 0 ), aLogicSize );
+ maPageVDev.Pop();
+
+ SetMapMode( MAP_PIXEL );
+ maPageVDev.SetMapMode( MAP_PIXEL );
+ DrawOutDev( aOffset, aPreviewSize, Point( 0, 0 ), aPreviewSize, maPageVDev );
+
+ DecorationView aVw( this );
+ aOffset.X() -= 1; aOffset.Y() -=1; aPreviewSize.Width() += 2; aPreviewSize.Height() += 2;
+ aVw.DrawFrame( Rectangle( aOffset, aPreviewSize ), FRAME_DRAW_GROUP );
+ }
+}
+
+void PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt )
+{
+ if( rEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pWheelData = rEvt.GetWheelData();
+ PrintDialog* pDlg = dynamic_cast<PrintDialog*>(GetParent());
+ if( pDlg )
+ {
+ if( pWheelData->GetDelta() > 0 )
+ pDlg->previewForward();
+ else if( pWheelData->GetDelta() < 0 )
+ pDlg->previewBackward();
+ /*
+ else
+ huh ?
+ */
+ }
+ }
+}
+
+void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPreview,
+ const Size& i_rOrigSize,
+ const rtl::OUString& i_rReplacement,
+ sal_Int32 i_nDPIX,
+ sal_Int32 i_nDPIY
+ )
+{
+ rtl::OUStringBuffer aBuf( 256 );
+ aBuf.append( maToolTipString );
+ #if OSL_DEBUG_LEVEL > 0
+ aBuf.appendAscii( "\n---\nPageSize: " );
+ aBuf.append( sal_Int32( i_rOrigSize.Width()/100) );
+ aBuf.appendAscii( "mm x " );
+ aBuf.append( sal_Int32( i_rOrigSize.Height()/100) );
+ aBuf.appendAscii( "mm" );
+ #endif
+ SetQuickHelpText( aBuf.makeStringAndClear() );
+ maMtf = i_rNewPreview;
+ if( GetSettings().GetStyleSettings().GetHighContrastMode() &&
+ GetSettings().GetStyleSettings().GetWindowColor().IsDark()
+ )
+ {
+ maMtf.ReplaceColors( Color( COL_BLACK ), Color( COL_WHITE ), 30 );
+ }
+
+ maOrigSize = i_rOrigSize;
+ maReplacementString = i_rReplacement;
+ maPageVDev.SetReferenceDevice( i_nDPIX, i_nDPIY );
+ maPageVDev.EnableOutput( TRUE );
+ Resize();
+ Invalidate();
+}
+
+PrintDialog::ShowNupOrderWindow::ShowNupOrderWindow( Window* i_pParent )
+ : Window( i_pParent, WB_NOBORDER )
+ , mnOrderMode( 0 )
+ , mnRows( 1 )
+ , mnColumns( 1 )
+{
+ ImplInitSettings();
+}
+
+PrintDialog::ShowNupOrderWindow::~ShowNupOrderWindow()
+{
+}
+
+void PrintDialog::ShowNupOrderWindow::ImplInitSettings()
+{
+ SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) );
+}
+
+void PrintDialog::ShowNupOrderWindow::Paint( const Rectangle& i_rRect )
+{
+ Window::Paint( i_rRect );
+ SetMapMode( MAP_PIXEL );
+ SetTextColor( GetSettings().GetStyleSettings().GetFieldTextColor() );
+
+ int nPages = mnRows * mnColumns;
+ Font aFont( GetSettings().GetStyleSettings().GetFieldFont() );
+ aFont.SetSize( Size( 0, 24 ) );
+ SetFont( aFont );
+ Size aSampleTextSize( GetTextWidth( rtl::OUString::valueOf( sal_Int32(nPages+1) ) ), GetTextHeight() );
+
+ Size aOutSize( GetOutputSizePixel() );
+ Size aSubSize( aOutSize.Width() / mnColumns, aOutSize.Height() / mnRows );
+ // calculate font size: shrink the sample text so it fits
+ double fX = double(aSubSize.Width())/double(aSampleTextSize.Width());
+ double fY = double(aSubSize.Height())/double(aSampleTextSize.Height());
+ double fScale = (fX < fY) ? fX : fY;
+ long nFontHeight = long(24.0*fScale) - 3;
+ if( nFontHeight < 5 )
+ nFontHeight = 5;
+ aFont.SetSize( Size( 0, nFontHeight ) );
+ SetFont( aFont );
+ long nTextHeight = GetTextHeight();
+ for( int i = 0; i < nPages; i++ )
+ {
+ rtl::OUString aPageText( rtl::OUString::valueOf( sal_Int32(i+1) ) );
+ int nX = 0, nY = 0;
+ switch( mnOrderMode )
+ {
+ case SV_PRINT_PRT_NUP_ORDER_LRTD:
+ nX = (i % mnColumns); nY = (i / mnColumns);
+ break;
+ case SV_PRINT_PRT_NUP_ORDER_TDLR:
+ nX = (i / mnRows); nY = (i % mnRows);
+ break;
+ }
+ Size aTextSize( GetTextWidth( aPageText ), nTextHeight );
+ int nDeltaX = (aSubSize.Width() - aTextSize.Width()) / 2;
+ int nDeltaY = (aSubSize.Height() - aTextSize.Height()) / 2;
+ DrawText( Point( nX * aSubSize.Width() + nDeltaX,
+ nY * aSubSize.Height() + nDeltaY ),
+ aPageText );
+ }
+ DecorationView aVw( this );
+ aVw.DrawFrame( Rectangle( Point( 0, 0), aOutSize ), FRAME_DRAW_GROUP );
+}
+
+PrintDialog::NUpTabPage::NUpTabPage( Window* i_pParent, const ResId& rResId )
+ : TabPage( i_pParent, rResId )
+ , maNupLine( this, VclResId( SV_PRINT_PRT_NUP_LAYOUT_FL ) )
+ , maPagesBtn( this, VclResId( SV_PRINT_PRT_NUP_PAGES_BTN ) )
+ , maBrochureBtn( this, VclResId( SV_PRINT_PRT_NUP_BROCHURE_BTN ) )
+ , maPagesBoxTitleTxt( this, 0 )
+ , maNupPagesBox( this, VclResId( SV_PRINT_PRT_NUP_PAGES_BOX ) )
+ , maNupNumPagesTxt( this, VclResId( SV_PRINT_PRT_NUP_NUM_PAGES_TXT ) )
+ , maNupColEdt( this, VclResId( SV_PRINT_PRT_NUP_COLS_EDT ) )
+ , maNupTimesTxt( this, VclResId( SV_PRINT_PRT_NUP_TIMES_TXT ) )
+ , maNupRowsEdt( this, VclResId( SV_PRINT_PRT_NUP_ROWS_EDT ) )
+ , maPageMarginTxt1( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_PAGES_1_TXT ) )
+ , maPageMarginEdt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT ) )
+ , maPageMarginTxt2( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_PAGES_2_TXT ) )
+ , maSheetMarginTxt1( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_SHEET_1_TXT ) )
+ , maSheetMarginEdt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT ) )
+ , maSheetMarginTxt2( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_SHEET_2_TXT ) )
+ , maNupOrientationTxt( this, VclResId( SV_PRINT_PRT_NUP_ORIENTATION_TXT ) )
+ , maNupOrientationBox( this, VclResId( SV_PRINT_PRT_NUP_ORIENTATION_BOX ) )
+ , maNupOrderTxt( this, VclResId( SV_PRINT_PRT_NUP_ORDER_TXT ) )
+ , maNupOrderBox( this, VclResId( SV_PRINT_PRT_NUP_ORDER_BOX ) )
+ , maNupOrderWin( this )
+ , maBorderCB( this, VclResId( SV_PRINT_PRT_NUP_BORDER_CB ) )
+{
+ FreeResource();
+
+ maNupOrderWin.Show();
+ maPagesBtn.Check( TRUE );
+ maBrochureBtn.Show( FALSE );
+
+ // setup field units for metric fields
+ const LocaleDataWrapper& rLocWrap( maPageMarginEdt.GetLocaleDataWrapper() );
+ FieldUnit eUnit = FUNIT_MM;
+ USHORT nDigits = 0;
+ if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US )
+ {
+ eUnit = FUNIT_INCH;
+ nDigits = 2;
+ }
+ // set units
+ maPageMarginEdt.SetUnit( eUnit );
+ maSheetMarginEdt.SetUnit( eUnit );
+
+ // set precision
+ maPageMarginEdt.SetDecimalDigits( nDigits );
+ maSheetMarginEdt.SetDecimalDigits( nDigits );
+
+ SMHID1( "NUpPage" );
+ maNupLine.SMHID2("NUpPage", "Layout");
+ maBrochureBtn.SMHID2("NUpPage", "Brochure" );
+ maPagesBtn.SMHID2( "NUpPage", "PagesPerSheet" );
+ maPagesBoxTitleTxt.SMHID2( "NUpPage", "PagesPerSheetLabel" );
+ maNupPagesBox.SMHID2( "NUpPage", "PagesPerSheetBox" );
+ maNupNumPagesTxt.SMHID2( "NUpPage", "Columns" );
+ maNupColEdt.SMHID2( "NUpPage", "ColumnsBox" );
+ maNupTimesTxt.SMHID2( "NUpPage", "Rows" );
+ maNupRowsEdt.SMHID2( "NUpPage", "RowsBox" );
+ maPageMarginTxt1.SMHID2( "NUpPage", "PageMargin" );
+ maPageMarginEdt.SMHID2( "NUpPage", "PageMarginBox" );
+ maPageMarginTxt2.SMHID2( "NUpPage", "PageMarginCont" );
+ maSheetMarginTxt1.SMHID2( "NUpPage", "SheetMargin" );
+ maSheetMarginEdt.SMHID2( "NUpPage", "SheetMarginBox" );
+ maSheetMarginTxt2.SMHID2( "NUpPage", "SheetMarginCont" );
+ maNupOrientationTxt.SMHID2( "NUpPage", "Orientation" );
+ maNupOrientationBox.SMHID2( "NUpPage", "OrientationBox" );
+ maNupOrderTxt.SMHID2( "NUpPage", "Order" );
+ maNupOrderBox.SMHID2( "NUpPage", "OrderBox" );
+ maBorderCB.SMHID2( "NUpPage", "BorderBox" );
+
+ setupLayout();
+}
+
+PrintDialog::NUpTabPage::~NUpTabPage()
+{
+}
+
+void PrintDialog::NUpTabPage::enableNupControls( bool bEnable )
+{
+ maNupPagesBox.Enable( TRUE );
+ maNupNumPagesTxt.Enable( bEnable );
+ maNupColEdt.Enable( bEnable );
+ maNupTimesTxt.Enable( bEnable );
+ maNupRowsEdt.Enable( bEnable );
+ maPageMarginTxt1.Enable( bEnable );
+ maPageMarginEdt.Enable( bEnable );
+ maPageMarginTxt2.Enable( bEnable );
+ maSheetMarginTxt1.Enable( bEnable );
+ maSheetMarginEdt.Enable( bEnable );
+ maSheetMarginTxt2.Enable( bEnable );
+ maNupOrientationTxt.Enable( bEnable );
+ maNupOrientationBox.Enable( bEnable );
+ maNupOrderTxt.Enable( bEnable );
+ maNupOrderBox.Enable( bEnable );
+ maNupOrderWin.Enable( bEnable );
+ maBorderCB.Enable( bEnable );
+}
+
+void PrintDialog::NUpTabPage::showAdvancedControls( bool i_bShow )
+{
+ maNupNumPagesTxt.Show( i_bShow );
+ maNupColEdt.Show( i_bShow );
+ maNupTimesTxt.Show( i_bShow );
+ maNupRowsEdt.Show( i_bShow );
+ maPageMarginTxt1.Show( i_bShow );
+ maPageMarginEdt.Show( i_bShow );
+ maPageMarginTxt2.Show( i_bShow );
+ maSheetMarginTxt1.Show( i_bShow );
+ maSheetMarginEdt.Show( i_bShow );
+ maSheetMarginTxt2.Show( i_bShow );
+ maNupOrientationTxt.Show( i_bShow );
+ maNupOrientationBox.Show( i_bShow );
+ maLayout.resize();
+}
+
+void PrintDialog::NUpTabPage::setupLayout()
+{
+ Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
+ long nIndent = 3*aBorder.Width();
+
+ maLayout.setParentWindow( this );
+ maLayout.setOuterBorder( aBorder.Width() );
+
+ maLayout.addWindow( &maNupLine );
+ boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &maLayout, false ) );
+ maLayout.addChild( xRow );
+ boost::shared_ptr< vcl::Indenter > xIndent( new vcl::Indenter( xRow.get() ) );
+ xRow->addChild( xIndent );
+
+ boost::shared_ptr< vcl::RowOrColumn > xShowNupCol( new vcl::RowOrColumn( xRow.get() ) );
+ xRow->addChild( xShowNupCol, -1 );
+ xShowNupCol->setMinimumSize( xShowNupCol->addWindow( &maNupOrderWin ), Size( 70, 70 ) );
+ boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( xShowNupCol.get() ) );
+ xShowNupCol->addChild( xSpacer );
+
+ boost::shared_ptr< vcl::LabelColumn > xMainCol( new vcl::LabelColumn( xIndent.get() ) );
+ xIndent->setChild( xMainCol );
+
+ size_t nPagesIndex = xMainCol->addRow( &maPagesBtn, &maNupPagesBox );
+ mxPagesBtnLabel = boost::dynamic_pointer_cast<vcl::LabeledElement>( xMainCol->getChild( nPagesIndex ) );
+
+ xRow.reset( new vcl::RowOrColumn( xMainCol.get(), false ) );
+ xMainCol->addRow( &maNupNumPagesTxt, xRow, nIndent );
+ xRow->addWindow( &maNupColEdt );
+ xRow->addWindow( &maNupTimesTxt );
+ xRow->addWindow( &maNupRowsEdt );
+
+ boost::shared_ptr< vcl::LabeledElement > xLab( new vcl::LabeledElement( xMainCol.get(), 2 ) );
+ xLab->setLabel( &maPageMarginEdt );
+ xLab->setElement( &maPageMarginTxt2 );
+ xMainCol->addRow( &maPageMarginTxt1, xLab, nIndent );
+
+ xLab.reset( new vcl::LabeledElement( xMainCol.get(), 2 ) );
+ xLab->setLabel( &maSheetMarginEdt );
+ xLab->setElement( &maSheetMarginTxt2 );
+ xMainCol->addRow( &maSheetMarginTxt1, xLab, nIndent );
+
+ xMainCol->addRow( &maNupOrientationTxt, &maNupOrientationBox, nIndent );
+ xMainCol->addRow( &maNupOrderTxt, &maNupOrderBox, nIndent );
+ xMainCol->setBorders( xMainCol->addWindow( &maBorderCB ), nIndent, 0, 0, 0 );
+
+ xSpacer.reset( new vcl::Spacer( xMainCol.get(), 0, Size( 10, aBorder.Width() ) ) );
+ xMainCol->addChild( xSpacer );
+
+ xRow.reset( new vcl::RowOrColumn( xMainCol.get(), false ) );
+ xMainCol->addRow( &maBrochureBtn, xRow );
+ // remember brochure row for dependencies
+ mxBrochureDep = xRow;
+
+ // initially advanced controls are not shown, rows=columns=1
+ showAdvancedControls( false );
+}
+
+void PrintDialog::NUpTabPage::Resize()
+{
+ maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) );
+}
+
+void PrintDialog::NUpTabPage::initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& i_rMPS )
+{
+ maSheetMarginEdt.SetValue( maSheetMarginEdt.Normalize( i_rMPS.nLeftMargin ), FUNIT_100TH_MM );
+ maPageMarginEdt.SetValue( maPageMarginEdt.Normalize( i_rMPS.nHorizontalSpacing ), FUNIT_100TH_MM );
+ maBorderCB.Check( i_rMPS.bDrawBorder );
+ maNupRowsEdt.SetValue( i_rMPS.nRows );
+ maNupColEdt.SetValue( i_rMPS.nColumns );
+}
+
+void PrintDialog::NUpTabPage::readFromSettings()
+{
+}
+
+void PrintDialog::NUpTabPage::storeToSettings()
+{
+}
+
+PrintDialog::JobTabPage::JobTabPage( Window* i_pParent, const ResId& rResId )
+ : TabPage( i_pParent, rResId )
+ , maPrinterFL( this, VclResId( SV_PRINT_PRINTERS_FL ) )
+ , maPrinters( this, VclResId( SV_PRINT_PRINTERS ) )
+ , maDetailsBtn( this, VclResId( SV_PRINT_DETAILS_BTN ) )
+ , maStatusLabel( this, VclResId( SV_PRINT_STATUS_TXT ) )
+ , maStatusTxt( this, 0 )
+ , maLocationLabel( this, VclResId( SV_PRINT_LOCATION_TXT ) )
+ , maLocationTxt( this, 0 )
+ , maCommentLabel( this, VclResId( SV_PRINT_COMMENT_TXT ) )
+ , maCommentTxt( this, 0 )
+ , maSetupButton( this, VclResId( SV_PRINT_PRT_SETUP ) )
+ , maCopies( this, VclResId( SV_PRINT_COPIES ) )
+ , maCopySpacer( this, WB_VERT )
+ , maCopyCount( this, VclResId( SV_PRINT_COPYCOUNT ) )
+ , maCopyCountField( this, VclResId( SV_PRINT_COPYCOUNT_FIELD ) )
+ , maCollateBox( this, VclResId( SV_PRINT_COLLATE ) )
+ , maCollateImage( this, VclResId( SV_PRINT_COLLATE_IMAGE ) )
+ , maCollateImg( VclResId( SV_PRINT_COLLATE_IMG ) )
+ , maCollateHCImg( VclResId( SV_PRINT_COLLATE_HC_IMG ) )
+ , maNoCollateImg( VclResId( SV_PRINT_NOCOLLATE_IMG ) )
+ , maNoCollateHCImg( VclResId( SV_PRINT_NOCOLLATE_HC_IMG ) )
+ , mnCollateUIMode( 0 )
+ , maLayout( NULL, true )
+{
+ FreeResource();
+
+ SMHID1( "JobPage" );
+ maPrinterFL.SMHID2( "JobPage", "Printer" );
+ maPrinters.SMHID2( "JobPage", "PrinterList" );
+ maDetailsBtn.SMHID2( "JobPage", "DetailsBtn" );
+ maStatusLabel.SMHID2( "JobPage", "StatusLabel" );
+ maStatusTxt.SMHID2( "JobPage", "StatusText" );
+ maLocationLabel.SMHID2( "JobPage", "LocationLabel" );
+ maLocationTxt.SMHID2( "JobPage", "LocationText" );
+ maCommentLabel.SMHID2( "JobPage", "CommentLabel" );
+ maCommentTxt.SMHID2( "JobPage", "CommentText" );
+ maSetupButton.SMHID2( "JobPage", "Properties" );
+ maCopies.SMHID2( "JobPage", "CopiesLine" );
+ maCopySpacer.SMHID2( "JobPage", "CopySpacer" );
+ maCopyCount.SMHID2( "JobPage", "CopiesText" );
+ maCopyCountField.SMHID2( "JobPage", "Copies" );
+ maCollateBox.SMHID2( "JobPage", "Collate" );
+ maCollateImage.SMHID2( "JobPage", "CollateImage" );
+
+ maCopySpacer.Show();
+ maStatusTxt.Show();
+ maCommentTxt.Show();
+ maLocationTxt.Show();
+
+ setupLayout();
+}
+
+PrintDialog::JobTabPage::~JobTabPage()
+{
+}
+
+void PrintDialog::JobTabPage::setupLayout()
+{
+ // HACK: this is not a dropdown box, but the dropdown line count
+ // sets the results of GetOptimalSize in a normal ListBox
+ maPrinters.SetDropDownLineCount( 4 );
+
+ Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
+
+ maLayout.setParentWindow( this );
+ maLayout.setOuterBorder( aBorder.Width() );
+
+ // add printer fixed line
+ maLayout.addWindow( &maPrinterFL );
+ // add print LB
+ maLayout.addWindow( &maPrinters );
+
+ // create a row for details button/text and properties button
+ boost::shared_ptr< vcl::RowOrColumn > xDetRow( new vcl::RowOrColumn( &maLayout, false ) );
+ maLayout.addChild( xDetRow );
+ xDetRow->addWindow( &maDetailsBtn );
+ xDetRow->addChild( new vcl::Spacer( xDetRow.get(), 2 ) );
+ xDetRow->addWindow( &maSetupButton );
+
+ // create an indent for details
+ boost::shared_ptr< vcl::Indenter > xIndent( new vcl::Indenter( &maLayout ) );
+ maLayout.addChild( xIndent );
+ // remember details controls
+ mxDetails = xIndent;
+ // create a column for the details
+ boost::shared_ptr< vcl::LabelColumn > xLabelCol( new vcl::LabelColumn( xIndent.get(), aBorder.Height() ) );
+ xIndent->setChild( xLabelCol );
+ xLabelCol->addRow( &maStatusLabel, &maStatusTxt );
+ xLabelCol->addRow( &maLocationLabel, &maLocationTxt );
+ xLabelCol->addRow( &maCommentLabel, &maCommentTxt );
+
+ // add print range and copies columns
+ maLayout.addWindow( &maCopies );
+ boost::shared_ptr< vcl::RowOrColumn > xRangeRow( new vcl::RowOrColumn( &maLayout, false, aBorder.Width() ) );
+ maLayout.addChild( xRangeRow );
+
+ // create print range and add to range row
+ mxPrintRange.reset( new vcl::RowOrColumn( xRangeRow.get() ) );
+ xRangeRow->addChild( mxPrintRange );
+ xRangeRow->addWindow( &maCopySpacer );
+
+ boost::shared_ptr< vcl::RowOrColumn > xCopyCollateCol( new vcl::RowOrColumn( xRangeRow.get() ) );
+ xRangeRow->addChild( xCopyCollateCol );
+
+ // add copies row to copy/collate column
+ boost::shared_ptr< vcl::LabeledElement > xCopiesRow( new vcl::LabeledElement( xCopyCollateCol.get(), 2 ) );
+ xCopyCollateCol->addChild( xCopiesRow );
+ xCopiesRow->setLabel( &maCopyCount );
+ xCopiesRow->setElement( &maCopyCountField );
+ boost::shared_ptr< vcl::LabeledElement > xCollateRow( new vcl::LabeledElement( xCopyCollateCol.get(), 2 ) );
+ xCopyCollateCol->addChild( xCollateRow );
+ xCollateRow->setLabel( &maCollateBox );
+ xCollateRow->setElement( &maCollateImage );
+
+ // maDetailsBtn.SetStyle( maDetailsBtn.GetStyle() | (WB_SMALLSTYLE | WB_BEVELBUTTON) );
+ mxDetails->show( false, false );
+}
+
+void PrintDialog::JobTabPage::readFromSettings()
+{
+ SettingsConfigItem* pItem = SettingsConfigItem::get();
+ rtl::OUString aValue;
+
+ #if 0
+ // do not actually make copy count persistent
+ // the assumption is that this would lead to a lot of unwanted copies
+ aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ) );
+ sal_Int32 nVal = aValue.toInt32();
+ maCopyCountField.SetValue( sal_Int64(nVal > 1 ? nVal : 1) );
+ #endif
+
+ aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CollateBox" ) ) );
+ if( aValue.equalsIgnoreAsciiCaseAscii( "alwaysoff" ) )
+ {
+ mnCollateUIMode = 1;
+ maCollateBox.Check( FALSE );
+ maCollateBox.Enable( FALSE );
+ }
+ else
+ {
+ mnCollateUIMode = 0;
+ aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) );
+ maCollateBox.Check( aValue.equalsIgnoreAsciiCaseAscii( "true" ) );
+ }
+ Resize();
+}
+
+void PrintDialog::JobTabPage::storeToSettings()
+{
+ SettingsConfigItem* pItem = SettingsConfigItem::get();
+ pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ),
+ maCopyCountField.GetText() );
+ pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ),
+ rtl::OUString::createFromAscii( maCollateBox.IsChecked() ? "true" : "false" ) );
+}
+
+void PrintDialog::JobTabPage::Resize()
+{
+ maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
+}
+
+PrintDialog::OutputOptPage::OutputOptPage( Window* i_pParent, const ResId& i_rResId )
+ : TabPage( i_pParent, i_rResId )
+ , maOptionsLine( this, VclResId( SV_PRINT_OPT_PRINT_FL ) )
+ , maToFileBox( this, VclResId( SV_PRINT_OPT_TOFILE ) )
+ , maCollateSingleJobsBox( this, VclResId( SV_PRINT_OPT_SINGLEJOBS ) )
+ , maReverseOrderBox( this, VclResId( SV_PRINT_OPT_REVERSE ) )
+{
+ FreeResource();
+ SMHID1( "OptPage" );
+ maOptionsLine.SMHID2( "OptPage", "Options" );
+ maToFileBox.SMHID2( "OptPage", "ToFile" );
+ maCollateSingleJobsBox.SMHID2( "OptPage", "SingleJobs" );
+ maReverseOrderBox.SMHID2( "OptPage", "Reverse" );
+
+ setupLayout();
+}
+
+PrintDialog::OutputOptPage::~OutputOptPage()
+{
+}
+
+void PrintDialog::OutputOptPage::setupLayout()
+{
+ Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
+
+ maLayout.setParentWindow( this );
+ maLayout.setOuterBorder( aBorder.Width() );
+
+ maLayout.addWindow( &maOptionsLine );
+ boost::shared_ptr<vcl::Indenter> xIndent( new vcl::Indenter( &maLayout, aBorder.Width() ) );
+ maLayout.addChild( xIndent );
+ boost::shared_ptr<vcl::RowOrColumn> xCol( new vcl::RowOrColumn( xIndent.get(), aBorder.Height() ) );
+ xIndent->setChild( xCol );
+ mxOptGroup = xCol;
+ xCol->addWindow( &maToFileBox );
+ xCol->addWindow( &maCollateSingleJobsBox );
+ xCol->addWindow( &maReverseOrderBox );
+}
+
+void PrintDialog::OutputOptPage::readFromSettings()
+{
+ #if 0
+ SettingsConfigItem* pItem = SettingsConfigItem::get();
+ rtl::OUString aValue;
+
+ aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ToFile" ) ) );
+ maToFileBox.Check( aValue.equalsIgnoreAsciiCaseAscii( "true" ) );
+ #endif
+}
+
+void PrintDialog::OutputOptPage::storeToSettings()
+{
+ SettingsConfigItem* pItem = SettingsConfigItem::get();
+ pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ToFile" ) ),
+ rtl::OUString::createFromAscii( maToFileBox.IsChecked() ? "true" : "false" ) );
+}
+
+void PrintDialog::OutputOptPage::Resize()
+{
+ maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
+}
+
+
+PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterController>& i_rController )
+ : ModalDialog( i_pParent, VclResId( SV_DLG_PRINT ) )
+ , maOKButton( this, VclResId( SV_PRINT_OK ) )
+ , maCancelButton( this, VclResId( SV_PRINT_CANCEL ) )
+ , maHelpButton( this, VclResId( SV_PRINT_HELP ) )
+ , maPreviewWindow( this, VclResId( SV_PRINT_PAGE_PREVIEW ) )
+ , maPageEdit( this, VclResId( SV_PRINT_PAGE_EDIT ) )
+ , maNumPagesText( this, VclResId( SV_PRINT_PAGE_TXT ) )
+ , maBackwardBtn( this, VclResId( SV_PRINT_PAGE_BACKWARD ) )
+ , maForwardBtn( this, VclResId( SV_PRINT_PAGE_FORWARD ) )
+ , maTabCtrl( this, VclResId( SV_PRINT_TABCTRL ) )
+ , maNUpPage( &maTabCtrl, VclResId( SV_PRINT_TAB_NUP ) )
+ , maJobPage( &maTabCtrl, VclResId( SV_PRINT_TAB_JOB ) )
+ , maOptionsPage( &maTabCtrl, VclResId( SV_PRINT_TAB_OPT ) )
+ , maButtonLine( this, VclResId( SV_PRINT_BUTTONLINE ) )
+ , maPController( i_rController )
+ , maNoPageStr( String( VclResId( SV_PRINT_NOPAGES ) ) )
+ , mnCurPage( 0 )
+ , mnCachedPages( 0 )
+ , maPrintToFileText( String( VclResId( SV_PRINT_TOFILE_TXT ) ) )
+ , maDefPrtText( String( VclResId( SV_PRINT_DEFPRT_TXT ) ) )
+ , mbShowLayoutPage( sal_True )
+{
+ FreeResource();
+
+ // save printbutton text, gets exchanged occasionally with print to file
+ maPrintText = maOKButton.GetText();
+
+ // setup preview controls
+ maForwardBtn.SetStyle( maForwardBtn.GetStyle() | WB_BEVELBUTTON );
+ maBackwardBtn.SetStyle( maBackwardBtn.GetStyle() | WB_BEVELBUTTON );
+
+ // insert the job (general) tab page first
+ maTabCtrl.InsertPage( SV_PRINT_TAB_JOB, maJobPage.GetText() );
+ maTabCtrl.SetTabPage( SV_PRINT_TAB_JOB, &maJobPage );
+
+ // set symbols on forward and backward button
+ maBackwardBtn.SetSymbol( SYMBOL_PREV );
+ maForwardBtn.SetSymbol( SYMBOL_NEXT );
+ maBackwardBtn.ImplSetSmallSymbol( TRUE );
+ maForwardBtn.ImplSetSmallSymbol( TRUE );
+
+ maPageStr = maNumPagesText.GetText();
+
+ // init reverse print
+ maOptionsPage.maReverseOrderBox.Check( maPController->getReversePrint() );
+
+ // get the first page
+ preparePreview( true, true );
+
+ // fill printer listbox
+ const std::vector< rtl::OUString >& rQueues( Printer::GetPrinterQueues() );
+ for( std::vector< rtl::OUString >::const_iterator it = rQueues.begin();
+ it != rQueues.end(); ++it )
+ {
+ maJobPage.maPrinters.InsertEntry( *it );
+ }
+ // select current printer
+ if( maJobPage.maPrinters.GetEntryPos( maPController->getPrinter()->GetName() ) != LISTBOX_ENTRY_NOTFOUND )
+ {
+ maJobPage.maPrinters.SelectEntry( maPController->getPrinter()->GetName() );
+ }
+ else
+ {
+ // fall back to last printer
+ SettingsConfigItem* pItem = SettingsConfigItem::get();
+ String aValue( pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPrinter" ) ) ) );
+ if( maJobPage.maPrinters.GetEntryPos( aValue ) != LISTBOX_ENTRY_NOTFOUND )
+ {
+ maJobPage.maPrinters.SelectEntry( aValue );
+ maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( aValue ) ) );
+ }
+ else
+ {
+ // fall back to default printer
+ maJobPage.maPrinters.SelectEntry( Printer::GetDefaultPrinterName() );
+ maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( Printer::GetDefaultPrinterName() ) ) );
+ }
+ }
+ // update the text fields for the printer
+ updatePrinterText();
+
+ // set a select handler
+ maJobPage.maPrinters.SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
+
+ // setup sizes for N-Up
+ Size aNupSize( maPController->getPrinter()->PixelToLogic(
+ maPController->getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
+ if( maPController->getPrinter()->GetOrientation() == ORIENTATION_LANDSCAPE )
+ {
+ maNupLandscapeSize = aNupSize;
+ maNupPortraitSize = Size( aNupSize.Height(), aNupSize.Width() );
+ }
+ else
+ {
+ maNupPortraitSize = aNupSize;
+ maNupLandscapeSize = Size( aNupSize.Height(), aNupSize.Width() );
+ }
+ maNUpPage.initFromMultiPageSetup( maPController->getMultipage() );
+
+
+ // setup click handler on the various buttons
+ maOKButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
+ #if OSL_DEBUG_LEVEL > 1
+ maCancelButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
+ #endif
+ maHelpButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
+ maForwardBtn.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
+ maBackwardBtn.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
+ maJobPage.maCollateBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
+ maJobPage.maSetupButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
+ maJobPage.maDetailsBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
+ maNUpPage.maBorderCB.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
+ maOptionsPage.maToFileBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
+ maOptionsPage.maReverseOrderBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
+ maNUpPage.maPagesBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
+
+ // setup modify hdl
+ maPageEdit.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
+ maJobPage.maCopyCountField.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
+ maNUpPage.maNupRowsEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
+ maNUpPage.maNupColEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
+ maNUpPage.maPageMarginEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
+ maNUpPage.maSheetMarginEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
+
+ // setup select hdl
+ maNUpPage.maNupPagesBox.SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
+ maNUpPage.maNupOrientationBox.SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
+ maNUpPage.maNupOrderBox.SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
+
+ // setup the layout
+ setupLayout();
+
+ // setup optional UI options set by application
+ setupOptionalUI();
+
+ // set change handler for UI options
+ maPController->setOptionChangeHdl( LINK( this, PrintDialog, UIOptionsChanged ) );
+
+ // set min size pixel to current size
+ Size aOutSize( GetOutputSizePixel() );
+ SetMinOutputSizePixel( aOutSize );
+
+ // if there is space enough, enlarge the preview so it gets roughly as
+ // high as the tab control
+ if( aOutSize.Width() < 768 )
+ {
+ Size aJobPageSize( getJobPageSize() );
+ Size aTabSize( maTabCtrl.GetSizePixel() );
+ if( aJobPageSize.Width() < 1 )
+ aJobPageSize.Width() = aTabSize.Width();
+ if( aJobPageSize.Height() < 1 )
+ aJobPageSize.Height() = aTabSize.Height();
+ long nOptPreviewWidth = aTabSize.Height() * aJobPageSize.Width() / aJobPageSize.Height();
+ // add space for borders
+ nOptPreviewWidth += 15;
+ if( aOutSize.Width() - aTabSize.Width() < nOptPreviewWidth )
+ {
+ aOutSize.Width() = aTabSize.Width() + nOptPreviewWidth;
+ if( aOutSize.Width() > 768 ) // don't enlarge the dialog too much
+ aOutSize.Width() = 768;
+ SetOutputSizePixel( aOutSize );
+ }
+ }
+
+ // set HelpIDs
+ SMHID1( "Dialog" );
+ maOKButton.SMHID1( "OK" );
+ maCancelButton.SMHID1( "Cancel" );
+ maHelpButton.SMHID1( "Help" );
+ maPreviewWindow.SMHID1( "Preview" );
+ maNumPagesText.SMHID1( "NumPagesText" );
+ maPageEdit.SMHID1( "PageEdit" );
+ maForwardBtn.SMHID1( "ForwardBtn" );
+ maBackwardBtn.SMHID1( "BackwardBtn" );
+ maTabCtrl.SMHID1( "TabPages" );
+
+ // append further tab pages
+ if( mbShowLayoutPage )
+ {
+ maTabCtrl.InsertPage( SV_PRINT_TAB_NUP, maNUpPage.GetText() );
+ maTabCtrl.SetTabPage( SV_PRINT_TAB_NUP, &maNUpPage );
+ }
+ maTabCtrl.InsertPage( SV_PRINT_TAB_OPT, maOptionsPage.GetText() );
+ maTabCtrl.SetTabPage( SV_PRINT_TAB_OPT, &maOptionsPage );
+
+ // restore settings from last run
+ readFromSettings();
+
+ // setup dependencies
+ checkControlDependencies();
+
+}
+
+PrintDialog::~PrintDialog()
+{
+ while( ! maControls.empty() )
+ {
+ delete maControls.front();
+ maControls.pop_front();
+ }
+}
+
+void PrintDialog::setupLayout()
+{
+ Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
+
+ maLayout.setParentWindow( this );
+
+ boost::shared_ptr< vcl::RowOrColumn > xPreviewAndTab( new vcl::RowOrColumn( &maLayout, false ) );
+ size_t nIndex = maLayout.addChild( xPreviewAndTab, 5 );
+ maLayout.setBorders( nIndex, aBorder.Width(), aBorder.Width(), aBorder.Width(), 0 );
+
+ // setup column for preview and sub controls
+ boost::shared_ptr< vcl::RowOrColumn > xPreview( new vcl::RowOrColumn( xPreviewAndTab.get() ) );
+ xPreviewAndTab->addChild( xPreview, 5 );
+ xPreview->addWindow( &maPreviewWindow, 5 );
+ // get a row for the preview controls
+ mxPreviewCtrls.reset( new vcl::RowOrColumn( xPreview.get(), false ) );
+ nIndex = xPreview->addChild( mxPreviewCtrls );
+ boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( mxPreviewCtrls.get(), 2 ) );
+ mxPreviewCtrls->addChild( xSpacer );
+ mxPreviewCtrls->addWindow( &maPageEdit );
+ mxPreviewCtrls->addWindow( &maNumPagesText );
+ xSpacer.reset( new vcl::Spacer( mxPreviewCtrls.get(), 2 ) );
+ mxPreviewCtrls->addChild( xSpacer );
+ mxPreviewCtrls->addWindow( &maBackwardBtn );
+ mxPreviewCtrls->addWindow( &maForwardBtn );
+ xSpacer.reset( new vcl::Spacer( mxPreviewCtrls.get(), 2 ) );
+ mxPreviewCtrls->addChild( xSpacer );
+
+ // continue with the tab ctrl
+ xPreviewAndTab->addWindow( &maTabCtrl );
+
+ // add the button line
+ maLayout.addWindow( &maButtonLine );
+
+ // add the row for the buttons
+ boost::shared_ptr< vcl::RowOrColumn > xButtons( new vcl::RowOrColumn( &maLayout, false ) );
+ nIndex = maLayout.addChild( xButtons );
+ maLayout.setBorders( nIndex, aBorder.Width(), 0, aBorder.Width(), aBorder.Width() );
+
+ Size aMinSize( maCancelButton.GetSizePixel() );
+ // insert help button
+ xButtons->setMinimumSize( xButtons->addWindow( &maHelpButton ), aMinSize );
+ // insert a spacer, cancel and OK buttons are right aligned
+ xSpacer.reset( new vcl::Spacer( xButtons.get(), 2 ) );
+ xButtons->addChild( xSpacer );
+ xButtons->setMinimumSize( xButtons->addWindow( &maOKButton ), aMinSize );
+ xButtons->setMinimumSize( xButtons->addWindow( &maCancelButton ), aMinSize );
+}
+
+void PrintDialog::readFromSettings()
+{
+ maJobPage.readFromSettings();
+ maNUpPage.readFromSettings();
+ maOptionsPage.readFromSettings();
+
+ // read last selected tab page; if it exists, actiavte it
+ SettingsConfigItem* pItem = SettingsConfigItem::get();
+ rtl::OUString aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPage" ) ) );
+ USHORT nCount = maTabCtrl.GetPageCount();
+ for( USHORT i = 0; i < nCount; i++ )
+ {
+ USHORT nPageId = maTabCtrl.GetPageId( i );
+ if( aValue.equals( maTabCtrl.GetPageText( nPageId ) ) )
+ {
+ maTabCtrl.SelectTabPage( nPageId );
+ break;
+ }
+ }
+ maOKButton.SetText( maOptionsPage.maToFileBox.IsChecked() ? maPrintToFileText : maPrintText );
+}
+
+void PrintDialog::storeToSettings()
+{
+ maJobPage.storeToSettings();
+ maNUpPage.storeToSettings();
+ maOptionsPage.storeToSettings();
+
+ // store last selected printer
+ SettingsConfigItem* pItem = SettingsConfigItem::get();
+ pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPrinter" ) ),
+ maJobPage.maPrinters.GetSelectEntry() );
+
+ pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPage" ) ),
+ maTabCtrl.GetPageText( maTabCtrl.GetCurPageId() ) );
+ pItem->Commit();
+}
+
+bool PrintDialog::isPrintToFile()
+{
+ return maOptionsPage.maToFileBox.IsChecked();
+}
+
+int PrintDialog::getCopyCount()
+{
+ return static_cast<int>(maJobPage.maCopyCountField.GetValue());
+}
+
+bool PrintDialog::isCollate()
+{
+ return maJobPage.maCopyCountField.GetValue() > 1 ? maJobPage.maCollateBox.IsChecked() : FALSE;
+}
+
+static void setSmartId( Window* i_pWindow, const char* i_pType, sal_Int32 i_nId = -1, const rtl::OUString& i_rPropName = rtl::OUString() )
+{
+ rtl::OUStringBuffer aBuf( 256 );
+ aBuf.appendAscii( HELPID_PREFIX );
+ if( i_rPropName.getLength() )
+ {
+ aBuf.append( sal_Unicode( ':' ) );
+ aBuf.append( i_rPropName );
+ }
+ if( i_pType )
+ {
+ aBuf.append( sal_Unicode( ':' ) );
+ aBuf.appendAscii( i_pType );
+ }
+ if( i_nId >= 0 )
+ {
+ aBuf.append( sal_Unicode( ':' ) );
+ aBuf.append( i_nId );
+ }
+ i_pWindow->SetSmartHelpId( SmartId( aBuf.makeStringAndClear(), HID_PRINTDLG ) );
+}
+
+static void setHelpText( Window* i_pWindow, const Sequence< rtl::OUString >& i_rHelpTexts, sal_Int32 i_nIndex )
+{
+ if( i_nIndex >= 0 && i_nIndex < i_rHelpTexts.getLength() )
+ i_pWindow->SetHelpText( i_rHelpTexts.getConstArray()[i_nIndex] );
+}
+
+void updateMaxSize( const Size& i_rCheckSize, Size& o_rMaxSize )
+{
+ if( i_rCheckSize.Width() > o_rMaxSize.Width() )
+ o_rMaxSize.Width() = i_rCheckSize.Width();
+ if( i_rCheckSize.Height() > o_rMaxSize.Height() )
+ o_rMaxSize.Height() = i_rCheckSize.Height();
+}
+
+void PrintDialog::setupOptionalUI()
+{
+ Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
+
+ std::vector<vcl::RowOrColumn*> aDynamicColumns;
+ vcl::RowOrColumn* pCurColumn = 0;
+
+ Window* pCurParent = 0, *pDynamicPageParent = 0;
+ USHORT nOptPageId = 9, nCurSubGroup = 0;
+ bool bOnStaticPage = false;
+ bool bSubgroupOnStaticPage = false;
+
+ std::multimap< rtl::OUString, vcl::RowOrColumn* > aPropertyToDependencyRowMap;
+
+ const Sequence< PropertyValue >& rOptions( maPController->getUIOptions() );
+ for( int i = 0; i < rOptions.getLength(); i++ )
+ {
+ Sequence< beans::PropertyValue > aOptProp;
+ rOptions[i].Value >>= aOptProp;
+
+ // extract ui element
+ bool bEnabled = true;
+ rtl::OUString aCtrlType;
+ rtl::OUString aText;
+ rtl::OUString aPropertyName;
+ Sequence< rtl::OUString > aChoices;
+ Sequence< rtl::OUString > aHelpTexts;
+ sal_Int64 nMinValue = 0, nMaxValue = 0;
+ sal_Int32 nCurHelpText = 0;
+ rtl::OUString aGroupingHint;
+ rtl::OUString aDependsOnName;
+ sal_Int32 nDependsOnValue = 0;
+ sal_Bool bUseDependencyRow = sal_False;
+
+ for( int n = 0; n < aOptProp.getLength(); n++ )
+ {
+ const beans::PropertyValue& rEntry( aOptProp[ n ] );
+ if( rEntry.Name.equalsAscii( "Text" ) )
+ {
+ rEntry.Value >>= aText;
+ }
+ else if( rEntry.Name.equalsAscii( "ControlType" ) )
+ {
+ rEntry.Value >>= aCtrlType;
+ }
+ else if( rEntry.Name.equalsAscii( "Choices" ) )
+ {
+ rEntry.Value >>= aChoices;
+ }
+ else if( rEntry.Name.equalsAscii( "Property" ) )
+ {
+ PropertyValue aVal;
+ rEntry.Value >>= aVal;
+ aPropertyName = aVal.Name;
+ }
+ else if( rEntry.Name.equalsAscii( "Enabled" ) )
+ {
+ sal_Bool bValue = sal_True;
+ rEntry.Value >>= bValue;
+ bEnabled = bValue;
+ }
+ else if( rEntry.Name.equalsAscii( "GroupingHint" ) )
+ {
+ rEntry.Value >>= aGroupingHint;
+ }
+ else if( rEntry.Name.equalsAscii( "DependsOnName" ) )
+ {
+ rEntry.Value >>= aDependsOnName;
+ }
+ else if( rEntry.Name.equalsAscii( "DependsOnEntry" ) )
+ {
+ rEntry.Value >>= nDependsOnValue;
+ }
+ else if( rEntry.Name.equalsAscii( "AttachToDependency" ) )
+ {
+ rEntry.Value >>= bUseDependencyRow;
+ }
+ else if( rEntry.Name.equalsAscii( "MinValue" ) )
+ {
+ rEntry.Value >>= nMinValue;
+ }
+ else if( rEntry.Name.equalsAscii( "MaxValue" ) )
+ {
+ rEntry.Value >>= nMaxValue;
+ }
+ else if( rEntry.Name.equalsAscii( "HelpText" ) )
+ {
+ if( ! (rEntry.Value >>= aHelpTexts) )
+ {
+ rtl::OUString aHelpText;
+ if( (rEntry.Value >>= aHelpText) )
+ {
+ aHelpTexts.realloc( 1 );
+ *aHelpTexts.getArray() = aHelpText;
+ }
+ }
+ }
+ else if( rEntry.Name.equalsAscii( "HintNoLayoutPage" ) )
+ {
+ sal_Bool bNoLayoutPage = sal_False;
+ rEntry.Value >>= bNoLayoutPage;
+ mbShowLayoutPage = ! bNoLayoutPage;
+ }
+ }
+
+ // bUseDependencyRow should only be true if a dependency exists
+ bUseDependencyRow = bUseDependencyRow && (aDependsOnName.getLength() != 0);
+
+ // is it necessary to switch between static and dynamic pages ?
+ bool bSwitchPage = false;
+ if( aGroupingHint.getLength() )
+ bSwitchPage = true;
+ else if( aCtrlType.equalsAscii( "Subgroup" ) || (bOnStaticPage && ! bSubgroupOnStaticPage ) )
+ bSwitchPage = true;
+ if( bSwitchPage )
+ {
+ // restore to dynamic
+ pCurParent = pDynamicPageParent;
+ pCurColumn = aDynamicColumns.empty() ? NULL : aDynamicColumns.back();
+ bOnStaticPage = false;
+ bSubgroupOnStaticPage = false;
+
+ if( aGroupingHint.equalsAscii( "PrintRange" ) )
+ {
+ pCurColumn = maJobPage.mxPrintRange.get();
+ pCurParent = &maJobPage; // set job page as current parent
+ bOnStaticPage = true;
+ }
+ else if( aGroupingHint.equalsAscii( "OptionsPage" ) )
+ {
+ pCurColumn = &maOptionsPage.maLayout;
+ pCurParent = &maOptionsPage; // set options page as current parent
+ bOnStaticPage = true;
+ }
+ else if( aGroupingHint.equalsAscii( "OptionsPageOptGroup" ) )
+ {
+ pCurColumn = maOptionsPage.mxOptGroup.get();
+ pCurParent = &maOptionsPage; // set options page as current parent
+ bOnStaticPage = true;
+ }
+ else if( aGroupingHint.equalsAscii( "LayoutPage" ) )
+ {
+ pCurColumn = &maNUpPage.maLayout;
+ pCurParent = &maNUpPage; // set layout page as current parent
+ bOnStaticPage = true;
+ }
+ else if( aGroupingHint.getLength() )
+ {
+ pCurColumn = &maJobPage.maLayout;
+ pCurParent = &maJobPage; // set job page as current parent
+ bOnStaticPage = true;
+ }
+ }
+
+ if( aCtrlType.equalsAscii( "Group" ) ||
+ ( ! pCurParent && ! (bOnStaticPage || aGroupingHint.getLength() ) ) )
+ {
+ // add new tab page
+ TabPage* pNewGroup = new TabPage( &maTabCtrl );
+ maControls.push_front( pNewGroup );
+ pDynamicPageParent = pCurParent = pNewGroup;
+ pNewGroup->SetText( aText );
+ maTabCtrl.InsertPage( ++nOptPageId, aText );
+ maTabCtrl.SetTabPage( nOptPageId, pNewGroup );
+
+ // set help id
+ setSmartId( pNewGroup, "TabPage", nOptPageId );
+ // set help text
+ setHelpText( pNewGroup, aHelpTexts, 0 );
+
+ // reset subgroup counter
+ nCurSubGroup = 0;
+
+ aDynamicColumns.push_back( new vcl::RowOrColumn( NULL, true, aBorder.Width() ) );
+ pCurColumn = aDynamicColumns.back();
+ pCurColumn->setParentWindow( pNewGroup );
+ pCurColumn->setOuterBorder( aBorder.Width() );
+ bSubgroupOnStaticPage = false;
+ bOnStaticPage = false;
+ }
+ else if( aCtrlType.equalsAscii( "Subgroup" ) && (pCurParent || aGroupingHint.getLength() ) )
+ {
+ bSubgroupOnStaticPage = (aGroupingHint.getLength() != 0);
+ // create group FixedLine
+ if( ! aGroupingHint.equalsAscii( "PrintRange" ) ||
+ ! pCurColumn->countElements() == 0
+ )
+ {
+ Window* pNewSub = NULL;
+ if( aGroupingHint.equalsAscii( "PrintRange" ) )
+ pNewSub = new FixedText( pCurParent, WB_VCENTER );
+ else
+ pNewSub = new FixedLine( pCurParent );
+ maControls.push_front( pNewSub );
+ pNewSub->SetText( aText );
+ pNewSub->Show();
+
+ // set help id
+ setSmartId( pNewSub, "FixedLine", sal_Int32( nCurSubGroup++ ) );
+ // set help text
+ setHelpText( pNewSub, aHelpTexts, 0 );
+ // add group to current column
+ pCurColumn->addWindow( pNewSub );
+ }
+
+ // add an indent to the current column
+ vcl::Indenter* pIndent = new vcl::Indenter( pCurColumn, aBorder.Width() );
+ pCurColumn->addChild( pIndent );
+ // and create a column inside the indent
+ pCurColumn = new vcl::RowOrColumn( pIndent );
+ pIndent->setChild( pCurColumn );
+ }
+ // EVIL
+ else if( aCtrlType.equalsAscii( "Bool" ) &&
+ aGroupingHint.equalsAscii( "LayoutPage" ) &&
+ aPropertyName.equalsAscii( "PrintProspect" )
+ )
+ {
+ maNUpPage.maBrochureBtn.SetText( aText );
+ maNUpPage.maBrochureBtn.Show();
+ setHelpText( &maNUpPage.maBrochureBtn, aHelpTexts, 0 );
+
+ sal_Bool bVal = sal_False;
+ PropertyValue* pVal = maPController->getValue( aPropertyName );
+ if( pVal )
+ pVal->Value >>= bVal;
+ maNUpPage.maBrochureBtn.Check( bVal );
+ maNUpPage.maBrochureBtn.Enable( maPController->isUIOptionEnabled( aPropertyName ) && pVal != NULL );
+ maNUpPage.maBrochureBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
+
+ maPropertyToWindowMap[ aPropertyName ].push_back( &maNUpPage.maBrochureBtn );
+ maControlToPropertyMap[&maNUpPage.maBrochureBtn] = aPropertyName;
+
+ aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, maNUpPage.mxBrochureDep.get() ) );
+ }
+ else
+ {
+ vcl::RowOrColumn* pSaveCurColumn = pCurColumn;
+
+ if( bUseDependencyRow )
+ {
+ // find the correct dependency row (if any)
+ std::pair< std::multimap< rtl::OUString, vcl::RowOrColumn* >::iterator,
+ std::multimap< rtl::OUString, vcl::RowOrColumn* >::iterator > aDepRange;
+ aDepRange = aPropertyToDependencyRowMap.equal_range( aDependsOnName );
+ if( aDepRange.first != aDepRange.second )
+ {
+ while( nDependsOnValue && aDepRange.first != aDepRange.second )
+ {
+ nDependsOnValue--;
+ ++aDepRange.first;
+ }
+ if( aDepRange.first != aPropertyToDependencyRowMap.end() )
+ {
+ pCurColumn = aDepRange.first->second;
+ maReverseDependencySet.insert( aPropertyName );
+ }
+ }
+ }
+ if( aCtrlType.equalsAscii( "Bool" ) && pCurParent )
+ {
+ // add a check box
+ CheckBox* pNewBox = new CheckBox( pCurParent );
+ maControls.push_front( pNewBox );
+ pNewBox->SetText( aText );
+ pNewBox->Show();
+
+ sal_Bool bVal = sal_False;
+ PropertyValue* pVal = maPController->getValue( aPropertyName );
+ if( pVal )
+ pVal->Value >>= bVal;
+ pNewBox->Check( bVal );
+ pNewBox->SetToggleHdl( LINK( this, PrintDialog, UIOption_CheckHdl ) );
+
+ maPropertyToWindowMap[ aPropertyName ].push_back( pNewBox );
+ maControlToPropertyMap[pNewBox] = aPropertyName;
+
+ // set help id
+ setSmartId( pNewBox, "CheckBox", -1, aPropertyName );
+ // set help text
+ setHelpText( pNewBox, aHelpTexts, 0 );
+
+ vcl::RowOrColumn* pDependencyRow = new vcl::RowOrColumn( pCurColumn, false );
+ pCurColumn->addChild( pDependencyRow );
+ aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, pDependencyRow ) );
+
+ // add checkbox to current column
+ pDependencyRow->addWindow( pNewBox );
+ }
+ else if( aCtrlType.equalsAscii( "Radio" ) && pCurParent )
+ {
+ vcl::RowOrColumn* pRadioColumn = pCurColumn;
+ if( aText.getLength() )
+ {
+ // add a FixedText:
+ FixedText* pHeading = new FixedText( pCurParent );
+ maControls.push_front( pHeading );
+ pHeading->SetText( aText );
+ pHeading->Show();
+
+ // set help id
+ setSmartId( pHeading, "FixedText", -1, aPropertyName );
+ // set help text
+ setHelpText( pHeading, aHelpTexts, nCurHelpText++ );
+ // add fixed text to current column
+ pCurColumn->addWindow( pHeading );
+ // add an indent to the current column
+ vcl::Indenter* pIndent = new vcl::Indenter( pCurColumn, 15 );
+ pCurColumn->addChild( pIndent );
+ // and create a column inside the indent
+ pRadioColumn = new vcl::RowOrColumn( pIndent );
+ pIndent->setChild( pRadioColumn );
+ }
+ // iterate options
+ sal_Int32 nSelectVal = 0;
+ PropertyValue* pVal = maPController->getValue( aPropertyName );
+ if( pVal && pVal->Value.hasValue() )
+ pVal->Value >>= nSelectVal;
+ for( sal_Int32 m = 0; m < aChoices.getLength(); m++ )
+ {
+ boost::shared_ptr<vcl::LabeledElement> pLabel( new vcl::LabeledElement( pRadioColumn, 1 ) );
+ pRadioColumn->addChild( pLabel );
+ boost::shared_ptr<vcl::RowOrColumn> pDependencyRow( new vcl::RowOrColumn( pLabel.get(), false ) );
+ pLabel->setElement( pDependencyRow );
+ aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, pDependencyRow.get() ) );
+
+ RadioButton* pBtn = new RadioButton( pCurParent, m == 0 ? WB_GROUP : 0 );
+ maControls.push_front( pBtn );
+ pBtn->SetText( aChoices[m] );
+ pBtn->Check( m == nSelectVal );
+ pBtn->SetToggleHdl( LINK( this, PrintDialog, UIOption_RadioHdl ) );
+ pBtn->Show();
+ maPropertyToWindowMap[ aPropertyName ].push_back( pBtn );
+ maControlToPropertyMap[pBtn] = aPropertyName;
+ maControlToNumValMap[pBtn] = m;
+
+ // set help id
+ setSmartId( pBtn, "RadioButton", m, aPropertyName );
+ // set help text
+ setHelpText( pBtn, aHelpTexts, nCurHelpText++ );
+ // add the radio button to the column
+ pLabel->setLabel( pBtn );
+ }
+ }
+ else if( ( aCtrlType.equalsAscii( "List" ) ||
+ aCtrlType.equalsAscii( "Range" ) ||
+ aCtrlType.equalsAscii( "Edit" )
+ ) && pCurParent )
+ {
+ // create a row in the current column
+ vcl::RowOrColumn* pFieldColumn = new vcl::RowOrColumn( pCurColumn, false );
+ pCurColumn->addChild( pFieldColumn );
+ aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, pFieldColumn ) );
+
+ vcl::LabeledElement* pLabel = NULL;
+ if( aText.getLength() )
+ {
+ // add a FixedText:
+ FixedText* pHeading = new FixedText( pCurParent, WB_VCENTER );
+ maControls.push_front( pHeading );
+ pHeading->SetText( aText );
+ pHeading->Show();
+
+ // set help id
+ setSmartId( pHeading, "FixedText", -1, aPropertyName );
+
+ // add to row
+ pLabel = new vcl::LabeledElement( pFieldColumn, 2 );
+ pFieldColumn->addChild( pLabel );
+ pLabel->setLabel( pHeading );
+ }
+
+ if( aCtrlType.equalsAscii( "List" ) )
+ {
+ ListBox* pList = new ListBox( pCurParent, WB_DROPDOWN | WB_BORDER );
+ maControls.push_front( pList );
+
+ // iterate options
+ for( sal_Int32 m = 0; m < aChoices.getLength(); m++ )
+ {
+ pList->InsertEntry( aChoices[m] );
+ }
+ sal_Int32 nSelectVal = 0;
+ PropertyValue* pVal = maPController->getValue( aPropertyName );
+ if( pVal && pVal->Value.hasValue() )
+ pVal->Value >>= nSelectVal;
+ pList->SelectEntryPos( static_cast<USHORT>(nSelectVal) );
+ pList->SetSelectHdl( LINK( this, PrintDialog, UIOption_SelectHdl ) );
+ pList->SetDropDownLineCount( static_cast<USHORT>(aChoices.getLength()) );
+ pList->Show();
+
+ // set help id
+ setSmartId( pList, "ListBox", -1, aPropertyName );
+ // set help text
+ setHelpText( pList, aHelpTexts, 0 );
+
+ maPropertyToWindowMap[ aPropertyName ].push_back( pList );
+ maControlToPropertyMap[pList] = aPropertyName;
+
+ // finish the pair
+ if( pLabel )
+ pLabel->setElement( pList );
+ else
+ pFieldColumn->addWindow( pList );
+ }
+ else if( aCtrlType.equalsAscii( "Range" ) )
+ {
+ NumericField* pField = new NumericField( pCurParent, WB_BORDER | WB_SPIN );
+ maControls.push_front( pField );
+
+ // set min/max and current value
+ if( nMinValue != nMaxValue )
+ {
+ pField->SetMin( nMinValue );
+ pField->SetMax( nMaxValue );
+ }
+ sal_Int64 nCurVal = 0;
+ PropertyValue* pVal = maPController->getValue( aPropertyName );
+ if( pVal && pVal->Value.hasValue() )
+ pVal->Value >>= nCurVal;
+ pField->SetValue( nCurVal );
+ pField->SetModifyHdl( LINK( this, PrintDialog, UIOption_ModifyHdl ) );
+ pField->Show();
+
+ // set help id
+ setSmartId( pField, "NumericField", -1, aPropertyName );
+ // set help text
+ setHelpText( pField, aHelpTexts, 0 );
+
+ maPropertyToWindowMap[ aPropertyName ].push_back( pField );
+ maControlToPropertyMap[pField] = aPropertyName;
+
+ // add to row
+ if( pLabel )
+ pLabel->setElement( pField );
+ else
+ pFieldColumn->addWindow( pField );
+ }
+ else if( aCtrlType.equalsAscii( "Edit" ) )
+ {
+ Edit* pField = new Edit( pCurParent, WB_BORDER );
+ maControls.push_front( pField );
+
+ rtl::OUString aCurVal;
+ PropertyValue* pVal = maPController->getValue( aPropertyName );
+ if( pVal && pVal->Value.hasValue() )
+ pVal->Value >>= aCurVal;
+ pField->SetText( aCurVal );
+ pField->SetModifyHdl( LINK( this, PrintDialog, UIOption_ModifyHdl ) );
+ pField->Show();
+
+ // set help id
+ setSmartId( pField, "Edit", -1, aPropertyName );
+ // set help text
+ setHelpText( pField, aHelpTexts, 0 );
+
+ maPropertyToWindowMap[ aPropertyName ].push_back( pField );
+ maControlToPropertyMap[pField] = aPropertyName;
+
+ // add to row
+ if( pLabel )
+ pLabel->setElement( pField );
+ else
+ pFieldColumn->addWindow( pField, 2 );
+ }
+ }
+ else
+ {
+ DBG_ERROR( "Unsupported UI option" );
+ }
+
+ pCurColumn = pSaveCurColumn;
+ }
+ }
+
+ // #i106506# if no brochure button, then the singular Pages radio button
+ // makes no sense, so replace it by a FixedText label
+ if( ! maNUpPage.maBrochureBtn.IsVisible() )
+ {
+ if( maNUpPage.mxPagesBtnLabel.get() )
+ {
+ maNUpPage.maPagesBoxTitleTxt.SetText( maNUpPage.maPagesBtn.GetText() );
+ maNUpPage.maPagesBoxTitleTxt.Show( TRUE );
+ maNUpPage.mxPagesBtnLabel->setLabel( &maNUpPage.maPagesBoxTitleTxt );
+ maNUpPage.maPagesBtn.Show( FALSE );
+ }
+ }
+
+ // update enable states
+ checkOptionalControlDependencies();
+
+ // print range empty (currently math only) -> hide print range and spacer line
+ if( maJobPage.mxPrintRange->countElements() == 0 )
+ {
+ maJobPage.mxPrintRange->show( false, false );
+ maJobPage.maCopySpacer.Show( FALSE );
+ }
+
+#ifdef WNT
+ // FIXME: the GetNativeControlRegion call on Windows has some issues
+ // (which skew the results of GetOptimalSize())
+ // however fixing this thoroughly needs to take interaction with paint into
+ // acoount, making the right fix less simple. Fix this the right way
+ // at some point. For now simply add some space at the lowest element
+ size_t nIndex = maJobPage.maLayout.countElements();
+ if( nIndex > 0 ) // sanity check
+ maJobPage.maLayout.setBorders( nIndex-1, 0, 0, 0, aBorder.Width() );
+#endif
+
+ // calculate job page
+ Size aMaxSize = maJobPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED );
+ // and layout page
+ updateMaxSize( maNUpPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ), aMaxSize );
+ // and options page
+ updateMaxSize( maOptionsPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ), aMaxSize );
+
+ for( std::vector< vcl::RowOrColumn* >::iterator it = aDynamicColumns.begin();
+ it != aDynamicColumns.end(); ++it )
+ {
+ Size aPageSize( (*it)->getOptimalSize( WINDOWSIZE_PREFERRED ) );
+ updateMaxSize( aPageSize, aMaxSize );
+ }
+
+ // resize dialog if necessary
+ Size aTabSize = maTabCtrl.GetTabPageSizePixel();
+ maTabCtrl.SetMinimumSizePixel( maTabCtrl.GetSizePixel() );
+ if( aMaxSize.Height() > aTabSize.Height() || aMaxSize.Width() > aTabSize.Width() )
+ {
+ Size aCurSize( GetOutputSizePixel() );
+ if( aMaxSize.Height() > aTabSize.Height() )
+ {
+ aCurSize.Height() += aMaxSize.Height() - aTabSize.Height();
+ aTabSize.Height() = aMaxSize.Height();
+ }
+ if( aMaxSize.Width() > aTabSize.Width() )
+ {
+ aCurSize.Width() += aMaxSize.Width() - aTabSize.Width();
+ // and the tab ctrl needs more space, too
+ aTabSize.Width() = aMaxSize.Width();
+ }
+ maTabCtrl.SetTabPageSizePixel( aTabSize );
+ maTabCtrl.SetMinimumSizePixel( maTabCtrl.GetSizePixel() );
+ }
+
+ // and finally arrange controls
+ for( std::vector< vcl::RowOrColumn* >::iterator it = aDynamicColumns.begin();
+ it != aDynamicColumns.end(); ++it )
+ {
+ (*it)->setManagedArea( Rectangle( Point(), aTabSize ) );
+ delete *it;
+ *it = NULL;
+ }
+ maJobPage.Resize();
+ maNUpPage.Resize();
+ maOptionsPage.Resize();
+
+ Size aSz = maLayout.getOptimalSize( WINDOWSIZE_PREFERRED );
+ SetOutputSizePixel( aSz );
+}
+
+void PrintDialog::DataChanged( const DataChangedEvent& i_rDCEvt )
+{
+ // react on settings changed
+ if( i_rDCEvt.GetType() == DATACHANGED_SETTINGS )
+ checkControlDependencies();
+ ModalDialog::DataChanged( i_rDCEvt );
+}
+
+void PrintDialog::checkControlDependencies()
+{
+ if( maJobPage.maCopyCountField.GetValue() > 1 )
+ maJobPage.maCollateBox.Enable( maJobPage.mnCollateUIMode == 0 );
+ else
+ maJobPage.maCollateBox.Enable( FALSE );
+
+ Image aImg( maJobPage.maCollateBox.IsChecked() ? maJobPage.maCollateImg : maJobPage.maNoCollateImg );
+ Image aHCImg( maJobPage.maCollateBox.IsChecked() ? maJobPage.maCollateHCImg : maJobPage.maNoCollateHCImg );
+ bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ Size aImgSize( aImg.GetSizePixel() );
+ Size aHCImgSize( aHCImg.GetSizePixel() );
+
+ if( aHCImgSize.Width() > aImgSize.Width() )
+ aImgSize.Width() = aHCImgSize.Width();
+ if( aHCImgSize.Height() > aImgSize.Height() )
+ aImgSize.Height() = aHCImgSize.Height();
+
+ // adjust size of image
+ maJobPage.maCollateImage.SetSizePixel( aImgSize );
+ maJobPage.maCollateImage.SetImage( bHC ? aHCImg : aImg );
+ maJobPage.maCollateImage.SetModeImage( aHCImg, BMP_COLOR_HIGHCONTRAST );
+
+ // enable setup button only for printers that can be setup
+ bool bHaveSetup = maPController->getPrinter()->HasSupport( SUPPORT_SETUPDIALOG );
+ maJobPage.maSetupButton.Enable( bHaveSetup );
+ if( bHaveSetup )
+ {
+ if( ! maJobPage.maSetupButton.IsVisible() )
+ {
+ Point aPrinterPos( maJobPage.maPrinters.GetPosPixel() );
+ Point aSetupPos( maJobPage.maSetupButton.GetPosPixel() );
+ Size aPrinterSize( maJobPage.maPrinters.GetSizePixel() );
+ aPrinterSize.Width() = aSetupPos.X() - aPrinterPos.X() - LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ).Width();
+ maJobPage.maPrinters.SetSizePixel( aPrinterSize );
+ maJobPage.maSetupButton.Show();
+ maLayout.resize();
+ }
+ }
+ else
+ {
+ if( maJobPage.maSetupButton.IsVisible() )
+ {
+ Point aPrinterPos( maJobPage.maPrinters.GetPosPixel() );
+ Point aSetupPos( maJobPage.maSetupButton.GetPosPixel() );
+ Size aPrinterSize( maJobPage.maPrinters.GetSizePixel() );
+ Size aSetupSize( maJobPage.maSetupButton.GetSizePixel() );
+ aPrinterSize.Width() = aSetupPos.X() + aSetupSize.Width() - aPrinterPos.X();
+ maJobPage.maPrinters.SetSizePixel( aPrinterSize );
+ maJobPage.maSetupButton.Hide();
+ maLayout.resize();
+ }
+ }
+}
+
+void PrintDialog::checkOptionalControlDependencies()
+{
+ for( std::map< Window*, rtl::OUString >::iterator it = maControlToPropertyMap.begin();
+ it != maControlToPropertyMap.end(); ++it )
+ {
+ bool bShouldbeEnabled = maPController->isUIOptionEnabled( it->second );
+ if( ! bShouldbeEnabled )
+ {
+ // enable controls that are directly attached to a dependency anyway
+ // if the normally disabled controls get modified, change the dependency
+ // so the control would be enabled
+ // example: in print range "Print All" is selected, "Page Range" is then of course
+ // not selected and the Edit for the Page Range would be disabled
+ // as a convenience we should enable the Edit anyway and automatically select
+ // "Page Range" instead of "Print All" if the Edit gets modified
+ if( maReverseDependencySet.find( it->second ) != maReverseDependencySet.end() )
+ {
+ rtl::OUString aDep( maPController->getDependency( it->second ) );
+ // if the dependency is at least enabled, then enable this control anyway
+ if( aDep.getLength() && maPController->isUIOptionEnabled( aDep ) )
+ bShouldbeEnabled = true;
+ }
+ }
+
+ bool bIsEnabled = it->first->IsEnabled();
+ // Enable does not do a change check first, so can be less cheap than expected
+ if( bShouldbeEnabled != bIsEnabled )
+ it->first->Enable( bShouldbeEnabled );
+ }
+}
+
+static rtl::OUString searchAndReplace( const rtl::OUString& i_rOrig, const char* i_pRepl, sal_Int32 i_nReplLen, const rtl::OUString& i_rRepl )
+{
+ sal_Int32 nPos = i_rOrig.indexOfAsciiL( i_pRepl, i_nReplLen );
+ if( nPos != -1 )
+ {
+ rtl::OUStringBuffer aBuf( i_rOrig.getLength() );
+ aBuf.append( i_rOrig.getStr(), nPos );
+ aBuf.append( i_rRepl );
+ if( nPos + i_nReplLen < i_rOrig.getLength() )
+ aBuf.append( i_rOrig.getStr() + nPos + i_nReplLen );
+ return aBuf.makeStringAndClear();
+ }
+ return i_rOrig;
+}
+
+void PrintDialog::updatePrinterText()
+{
+ String aDefPrt( Printer::GetDefaultPrinterName() );
+ const QueueInfo* pInfo = Printer::GetQueueInfo( maJobPage.maPrinters.GetSelectEntry(), true );
+ if( pInfo )
+ {
+ maJobPage.maLocationTxt.SetText( pInfo->GetLocation() );
+ maJobPage.maCommentTxt.SetText( pInfo->GetComment() );
+ // FIXME: status text
+ rtl::OUString aStatus;
+ if( aDefPrt == pInfo->GetPrinterName() )
+ aStatus = maDefPrtText;
+ maJobPage.maStatusTxt.SetText( aStatus );
+ }
+ else
+ {
+ maJobPage.maLocationTxt.SetText( String() );
+ maJobPage.maCommentTxt.SetText( String() );
+ maJobPage.maStatusTxt.SetText( String() );
+ }
+}
+
+void PrintDialog::setPreviewText( sal_Int32 )
+{
+ rtl::OUString aNewText( searchAndReplace( maPageStr, "%n", 2, rtl::OUString::valueOf( mnCachedPages ) ) );
+ maNumPagesText.SetText( aNewText );
+
+ // if layout is already established the refresh layout of
+ // preview controls since text length may have changes
+ if( mxPreviewCtrls.get() )
+ mxPreviewCtrls->setManagedArea( mxPreviewCtrls->getManagedArea() );
+}
+
+void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache )
+{
+ // page range may have changed depending on options
+ sal_Int32 nPages = maPController->getFilteredPageCount();
+ mnCachedPages = nPages;
+
+ if( mnCurPage >= nPages )
+ mnCurPage = nPages-1;
+ if( mnCurPage < 0 )
+ mnCurPage = 0;
+
+ setPreviewText( mnCurPage );
+
+ maPageEdit.SetMin( 1 );
+ maPageEdit.SetMax( nPages );
+
+ if( i_bNewPage )
+ {
+ const MapMode aMapMode( MAP_100TH_MM );
+ GDIMetaFile aMtf;
+ boost::shared_ptr<Printer> aPrt( maPController->getPrinter() );
+ if( nPages > 0 )
+ {
+ PrinterController::PageSize aPageSize =
+ maPController->getFilteredPageFile( mnCurPage, aMtf, i_bMayUseCache );
+ if( ! aPageSize.bFullPaper )
+ {
+ Point aOff( aPrt->PixelToLogic( aPrt->GetPageOffsetPixel(), aMapMode ) );
+ aMtf.Move( aOff.X(), aOff.Y() );
+ }
+ }
+
+ Size aCurPageSize = aPrt->PixelToLogic( aPrt->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) );
+ maPreviewWindow.setPreview( aMtf, aCurPageSize, nPages > 0 ? rtl::OUString() : maNoPageStr,
+ aPrt->ImplGetDPIX(), aPrt->ImplGetDPIY()
+ );
+
+ maForwardBtn.Enable( mnCurPage < nPages-1 );
+ maBackwardBtn.Enable( mnCurPage != 0 );
+ maPageEdit.Enable( nPages > 1 );
+ }
+}
+
+Size PrintDialog::getJobPageSize()
+{
+ if( maFirstPageSize.Width() == 0 && maFirstPageSize.Height() == 0)
+ {
+ maFirstPageSize = maNupPortraitSize;
+ GDIMetaFile aMtf;
+ if( maPController->getPageCountProtected() > 0 )
+ {
+ PrinterController::PageSize aPageSize = maPController->getPageFile( 0, aMtf, true );
+ maFirstPageSize = aPageSize.aSize;
+ }
+ }
+ return maFirstPageSize;
+}
+
+void PrintDialog::updateNupFromPages()
+{
+ long nPages = long(maNUpPage.maNupPagesBox.GetEntryData(maNUpPage.maNupPagesBox.GetSelectEntryPos()));
+ int nRows = int(maNUpPage.maNupRowsEdt.GetValue());
+ int nCols = int(maNUpPage.maNupColEdt.GetValue());
+ long nPageMargin = long(maNUpPage.maPageMarginEdt.Denormalize(maNUpPage.maPageMarginEdt.GetValue( FUNIT_100TH_MM )));
+ long nSheetMargin = long(maNUpPage.maSheetMarginEdt.Denormalize(maNUpPage.maSheetMarginEdt.GetValue( FUNIT_100TH_MM )));
+ bool bCustom = false;
+
+ if( nPages == 1 )
+ {
+ nRows = nCols = 1;
+ nSheetMargin = 0;
+ nPageMargin = 0;
+ }
+ else if( nPages == 2 || nPages == 4 || nPages == 6 || nPages == 9 || nPages == 16 )
+ {
+ Size aJobPageSize( getJobPageSize() );
+ bool bPortrait = aJobPageSize.Width() < aJobPageSize.Height();
+ if( nPages == 2 )
+ {
+ if( bPortrait )
+ nRows = 1, nCols = 2;
+ else
+ nRows = 2, nCols = 1;
+ }
+ else if( nPages == 4 )
+ nRows = nCols = 2;
+ else if( nPages == 6 )
+ {
+ if( bPortrait )
+ nRows = 2, nCols = 3;
+ else
+ nRows = 3, nCols = 2;
+ }
+ else if( nPages == 9 )
+ nRows = nCols = 3;
+ else if( nPages == 16 )
+ nRows = nCols = 4;
+ nPageMargin = 0;
+ nSheetMargin = 0;
+ }
+ else
+ bCustom = true;
+
+ if( nPages > 1 )
+ {
+ // set upper limits for margins based on job page size and rows/columns
+ Size aSize( getJobPageSize() );
+
+ // maximum sheet distance: 1/2 sheet
+ long nHorzMax = aSize.Width()/2;
+ long nVertMax = aSize.Height()/2;
+ if( nSheetMargin > nHorzMax )
+ nSheetMargin = nHorzMax;
+ if( nSheetMargin > nVertMax )
+ nSheetMargin = nVertMax;
+
+ maNUpPage.maSheetMarginEdt.SetMax(
+ maNUpPage.maSheetMarginEdt.Normalize(
+ nHorzMax > nVertMax ? nVertMax : nHorzMax ), FUNIT_100TH_MM );
+
+ // maximum page distance
+ nHorzMax = (aSize.Width() - 2*nSheetMargin);
+ if( nCols > 1 )
+ nHorzMax /= (nCols-1);
+ nVertMax = (aSize.Height() - 2*nSheetMargin);
+ if( nRows > 1 )
+ nHorzMax /= (nRows-1);
+
+ if( nPageMargin > nHorzMax )
+ nPageMargin = nHorzMax;
+ if( nPageMargin > nVertMax )
+ nPageMargin = nVertMax;
+
+ maNUpPage.maPageMarginEdt.SetMax(
+ maNUpPage.maSheetMarginEdt.Normalize(
+ nHorzMax > nVertMax ? nVertMax : nHorzMax ), FUNIT_100TH_MM );
+ }
+
+ maNUpPage.maNupRowsEdt.SetValue( nRows );
+ maNUpPage.maNupColEdt.SetValue( nCols );
+ maNUpPage.maPageMarginEdt.SetValue( maNUpPage.maPageMarginEdt.Normalize( nPageMargin ), FUNIT_100TH_MM );
+ maNUpPage.maSheetMarginEdt.SetValue( maNUpPage.maSheetMarginEdt.Normalize( nSheetMargin ), FUNIT_100TH_MM );
+
+ maNUpPage.showAdvancedControls( bCustom );
+ if( bCustom )
+ {
+ // see if we have to enlarge the dialog to make the tab page fit
+ Size aCurSize( maNUpPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ) );
+ Size aTabSize( maTabCtrl.GetTabPageSizePixel() );
+ if( aTabSize.Height() < aCurSize.Height() )
+ {
+ Size aDlgSize( GetSizePixel() );
+ aDlgSize.Height() += aCurSize.Height() - aTabSize.Height();
+ SetSizePixel( aDlgSize );
+ }
+ }
+
+ updateNup();
+}
+
+void PrintDialog::updateNup()
+{
+ int nRows = int(maNUpPage.maNupRowsEdt.GetValue());
+ int nCols = int(maNUpPage.maNupColEdt.GetValue());
+ long nPageMargin = long(maNUpPage.maPageMarginEdt.Denormalize(maNUpPage.maPageMarginEdt.GetValue( FUNIT_100TH_MM )));
+ long nSheetMargin = long(maNUpPage.maSheetMarginEdt.Denormalize(maNUpPage.maSheetMarginEdt.GetValue( FUNIT_100TH_MM )));
+
+ PrinterController::MultiPageSetup aMPS;
+ aMPS.nRows = nRows;
+ aMPS.nColumns = nCols;
+ aMPS.nRepeat = 1;
+ aMPS.nLeftMargin =
+ aMPS.nTopMargin =
+ aMPS.nRightMargin =
+ aMPS.nBottomMargin = nSheetMargin;
+
+ aMPS.nHorizontalSpacing =
+ aMPS.nVerticalSpacing = nPageMargin;
+
+ aMPS.bDrawBorder = maNUpPage.maBorderCB.IsChecked();
+
+ int nOrderMode = int(sal_IntPtr(maNUpPage.maNupOrderBox.GetEntryData(
+ maNUpPage.maNupOrderBox.GetSelectEntryPos() )));
+ if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_LRTD )
+ aMPS.nOrder = PrinterController::LRTB;
+ else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TDLR )
+ aMPS.nOrder = PrinterController::TBLR;
+
+ int nOrientationMode = int(sal_IntPtr(maNUpPage.maNupOrientationBox.GetEntryData(
+ maNUpPage.maNupOrientationBox.GetSelectEntryPos() )));
+ if( nOrientationMode == SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE )
+ aMPS.aPaperSize = maNupLandscapeSize;
+ else if( nOrientationMode == SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT )
+ aMPS.aPaperSize = maNupPortraitSize;
+ else // automatic mode
+ {
+ // get size of first real page to see if it is portrait or landscape
+ // we assume same page sizes for all the pages for this
+ Size aPageSize = getJobPageSize();
+
+ Size aMultiSize( aPageSize.Width() * nCols, aPageSize.Height() * nRows );
+ if( aMultiSize.Width() > aMultiSize.Height() ) // fits better on landscape
+ aMPS.aPaperSize = maNupLandscapeSize;
+ else
+ aMPS.aPaperSize = maNupPortraitSize;
+ }
+
+ maPController->setMultipage( aMPS );
+
+ maNUpPage.maNupOrderWin.setValues( nOrderMode, nCols, nRows );
+
+ preparePreview( true, true );
+}
+
+IMPL_LINK( PrintDialog, SelectHdl, ListBox*, pBox )
+{
+ if( pBox == &maJobPage.maPrinters )
+ {
+ String aNewPrinter( pBox->GetSelectEntry() );
+ // set new printer
+ maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( aNewPrinter ) ) );
+ // update text fields
+ updatePrinterText();
+ }
+ else if( pBox == &maNUpPage.maNupOrientationBox || pBox == &maNUpPage.maNupOrderBox )
+ {
+ updateNup();
+ }
+ else if( pBox == &maNUpPage.maNupPagesBox )
+ {
+ if( !maNUpPage.maPagesBtn.IsChecked() )
+ maNUpPage.maPagesBtn.Check();
+ updateNupFromPages();
+ }
+
+ return 0;
+}
+
+IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton )
+{
+ if( pButton == &maOKButton || pButton == &maCancelButton )
+ {
+ storeToSettings();
+ EndDialog( pButton == &maOKButton );
+ }
+ else if( pButton == &maHelpButton )
+ {
+ // start help system
+ Help* pHelp = Application::GetHelp();
+ if( pHelp )
+ {
+ // FIXME: find out proper help URL and use here
+ pHelp->Start( HID_PRINTDLG, GetParent() );
+ }
+ }
+ else if( pButton == &maForwardBtn )
+ {
+ previewForward();
+ }
+ else if( pButton == &maBackwardBtn )
+ {
+ previewBackward();
+ }
+ else if( pButton == &maOptionsPage.maToFileBox )
+ {
+ maOKButton.SetText( maOptionsPage.maToFileBox.IsChecked() ? maPrintToFileText : maPrintText );
+ maLayout.resize();
+ }
+ else if( pButton == &maNUpPage.maBrochureBtn )
+ {
+ PropertyValue* pVal = getValueForWindow( pButton );
+ if( pVal )
+ {
+ sal_Bool bVal = maNUpPage.maBrochureBtn.IsChecked();
+ pVal->Value <<= bVal;
+
+ checkOptionalControlDependencies();
+
+ // update preview and page settings
+ preparePreview();
+ }
+ if( maNUpPage.maBrochureBtn.IsChecked() )
+ {
+ maNUpPage.maNupPagesBox.SelectEntryPos( 0 );
+ updateNupFromPages();
+ maNUpPage.showAdvancedControls( false );
+ maNUpPage.enableNupControls( false );
+ }
+ }
+ else if( pButton == &maNUpPage.maPagesBtn )
+ {
+ maNUpPage.enableNupControls( true );
+ updateNupFromPages();
+ }
+ else if( pButton == &maJobPage.maDetailsBtn )
+ {
+ bool bShow = maJobPage.maDetailsBtn.IsChecked();
+ maJobPage.mxDetails->show( bShow );
+ if( bShow )
+ {
+ maDetailsCollapsedSize = GetOutputSizePixel();
+ // enlarge dialog if necessary
+ Size aMinSize( maJobPage.maLayout.getOptimalSize( WINDOWSIZE_MINIMUM ) );
+ Size aCurSize( maJobPage.GetSizePixel() );
+ if( aCurSize.Height() < aMinSize.Height() )
+ {
+ Size aDlgSize( GetOutputSizePixel() );
+ aDlgSize.Height() += aMinSize.Height() - aCurSize.Height();
+ SetOutputSizePixel( aDlgSize );
+ }
+ maDetailsExpandedSize = GetOutputSizePixel();
+ }
+ else if( maDetailsCollapsedSize.Width() > 0 &&
+ maDetailsCollapsedSize.Height() > 0 )
+ {
+ // if the user did not resize the dialog
+ // make it smaller again on collapsing the details
+ Size aDlgSize( GetOutputSizePixel() );
+ if( aDlgSize == maDetailsExpandedSize &&
+ aDlgSize.Height() > maDetailsCollapsedSize.Height() )
+ {
+ SetOutputSizePixel( maDetailsCollapsedSize );
+ }
+ }
+ }
+ else if( pButton == &maJobPage.maCollateBox )
+ {
+ maPController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ),
+ makeAny( sal_Bool(isCollate()) ) );
+ checkControlDependencies();
+ }
+ else if( pButton == &maOptionsPage.maReverseOrderBox )
+ {
+ sal_Bool bChecked = maOptionsPage.maReverseOrderBox.IsChecked();
+ maPController->setReversePrint( bChecked );
+ maPController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverse" ) ),
+ makeAny( bChecked ) );
+ preparePreview( true, true );
+ }
+ else if( pButton == &maNUpPage.maBorderCB )
+ {
+ updateNup();
+ }
+ else
+ {
+ if( pButton == &maJobPage.maSetupButton )
+ {
+ maPController->setupPrinter( this );
+ preparePreview( true, true );
+ }
+ checkControlDependencies();
+ }
+ return 0;
+}
+
+IMPL_LINK( PrintDialog, ModifyHdl, Edit*, pEdit )
+{
+ checkControlDependencies();
+ if( pEdit == &maNUpPage.maNupRowsEdt || pEdit == &maNUpPage.maNupColEdt ||
+ pEdit == &maNUpPage.maSheetMarginEdt || pEdit == &maNUpPage.maPageMarginEdt
+ )
+ {
+ updateNupFromPages();
+ }
+ else if( pEdit == &maPageEdit )
+ {
+ mnCurPage = sal_Int32( maPageEdit.GetValue() - 1 );
+ preparePreview( true, true );
+ }
+ else if( pEdit == &maJobPage.maCopyCountField )
+ {
+ maPController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ),
+ makeAny( sal_Int32(maJobPage.maCopyCountField.GetValue()) ) );
+ maPController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ),
+ makeAny( sal_Bool(isCollate()) ) );
+ }
+ return 0;
+}
+
+IMPL_LINK( PrintDialog, UIOptionsChanged, void*, EMPTYARG )
+{
+ checkOptionalControlDependencies();
+ return 0;
+}
+
+PropertyValue* PrintDialog::getValueForWindow( Window* i_pWindow ) const
+{
+ PropertyValue* pVal = NULL;
+ std::map< Window*, rtl::OUString >::const_iterator it = maControlToPropertyMap.find( i_pWindow );
+ if( it != maControlToPropertyMap.end() )
+ {
+ pVal = maPController->getValue( it->second );
+ DBG_ASSERT( pVal, "property value not found" );
+ }
+ else
+ {
+ DBG_ERROR( "changed control not in property map" );
+ }
+ return pVal;
+}
+
+void PrintDialog::updateWindowFromProperty( const rtl::OUString& i_rProperty )
+{
+ beans::PropertyValue* pValue = maPController->getValue( i_rProperty );
+ std::map< rtl::OUString, std::vector< Window* > >::const_iterator it = maPropertyToWindowMap.find( i_rProperty );
+ if( pValue && it != maPropertyToWindowMap.end() )
+ {
+ const std::vector< Window* >& rWindows( it->second );
+ if( ! rWindows.empty() )
+ {
+ sal_Bool bVal = sal_False;
+ sal_Int32 nVal = -1;
+ if( pValue->Value >>= bVal )
+ {
+ // we should have a CheckBox for this one
+ CheckBox* pBox = dynamic_cast< CheckBox* >( rWindows.front() );
+ if( pBox )
+ {
+ pBox->Check( bVal );
+ }
+ else if( i_rProperty.equalsAscii( "PrintProspect" ) )
+ {
+ // EVIL special case
+ if( bVal )
+ maNUpPage.maBrochureBtn.Check();
+ else
+ maNUpPage.maPagesBtn.Check();
+ }
+ else
+ {
+ DBG_ASSERT( 0, "missing a checkbox" );
+ }
+ }
+ else if( pValue->Value >>= nVal )
+ {
+ // this could be a ListBox or a RadioButtonGroup
+ ListBox* pList = dynamic_cast< ListBox* >( rWindows.front() );
+ if( pList )
+ {
+ pList->SelectEntryPos( static_cast< USHORT >(nVal) );
+ }
+ else if( nVal >= 0 && nVal < sal_Int32(rWindows.size() ) )
+ {
+ RadioButton* pBtn = dynamic_cast< RadioButton* >( rWindows[nVal] );
+ DBG_ASSERT( pBtn, "unexpected control for property" );
+ if( pBtn )
+ pBtn->Check();
+ }
+ }
+ }
+ }
+}
+
+void PrintDialog::makeEnabled( Window* i_pWindow )
+{
+ std::map< Window*, rtl::OUString >::const_iterator it = maControlToPropertyMap.find( i_pWindow );
+ if( it != maControlToPropertyMap.end() )
+ {
+ rtl::OUString aDependency( maPController->makeEnabled( it->second ) );
+ if( aDependency.getLength() )
+ updateWindowFromProperty( aDependency );
+ }
+}
+
+IMPL_LINK( PrintDialog, UIOption_CheckHdl, CheckBox*, i_pBox )
+{
+ PropertyValue* pVal = getValueForWindow( i_pBox );
+ if( pVal )
+ {
+ makeEnabled( i_pBox );
+
+ sal_Bool bVal = i_pBox->IsChecked();
+ pVal->Value <<= bVal;
+
+ checkOptionalControlDependencies();
+
+ // update preview and page settings
+ preparePreview();
+ }
+ return 0;
+}
+
+IMPL_LINK( PrintDialog, UIOption_RadioHdl, RadioButton*, i_pBtn )
+{
+ // this handler gets called for all radiobuttons that get unchecked, too
+ // however we only want one notificaction for the new value (that is for
+ // the button that gets checked)
+ if( i_pBtn->IsChecked() )
+ {
+ PropertyValue* pVal = getValueForWindow( i_pBtn );
+ std::map< Window*, sal_Int32 >::const_iterator it = maControlToNumValMap.find( i_pBtn );
+ if( pVal && it != maControlToNumValMap.end() )
+ {
+ makeEnabled( i_pBtn );
+
+ sal_Int32 nVal = it->second;
+ pVal->Value <<= nVal;
+
+ checkOptionalControlDependencies();
+
+ // update preview and page settings
+ preparePreview();
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( PrintDialog, UIOption_SelectHdl, ListBox*, i_pBox )
+{
+ PropertyValue* pVal = getValueForWindow( i_pBox );
+ if( pVal )
+ {
+ makeEnabled( i_pBox );
+
+ sal_Int32 nVal( i_pBox->GetSelectEntryPos() );
+ pVal->Value <<= nVal;
+
+ checkOptionalControlDependencies();
+
+ // update preview and page settings
+ preparePreview();
+ }
+ return 0;
+}
+
+IMPL_LINK( PrintDialog, UIOption_ModifyHdl, Edit*, i_pBox )
+{
+ PropertyValue* pVal = getValueForWindow( i_pBox );
+ if( pVal )
+ {
+ makeEnabled( i_pBox );
+
+ NumericField* pNum = dynamic_cast<NumericField*>(i_pBox);
+ MetricField* pMetric = dynamic_cast<MetricField*>(i_pBox);
+ if( pNum )
+ {
+ sal_Int64 nVal = pNum->GetValue();
+ pVal->Value <<= nVal;
+ }
+ else if( pMetric )
+ {
+ sal_Int64 nVal = pMetric->GetValue();
+ pVal->Value <<= nVal;
+ }
+ else
+ {
+ rtl::OUString aVal( i_pBox->GetText() );
+ pVal->Value <<= aVal;
+ }
+
+ checkOptionalControlDependencies();
+
+ // update preview and page settings
+ preparePreview();
+ }
+ return 0;
+}
+
+void PrintDialog::Command( const CommandEvent& rEvt )
+{
+ if( rEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pWheelData = rEvt.GetWheelData();
+ if( pWheelData->GetDelta() > 0 )
+ previewForward();
+ else if( pWheelData->GetDelta() < 0 )
+ previewBackward();
+ /*
+ else
+ huh ?
+ */
+ }
+}
+
+void PrintDialog::Resize()
+{
+ maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
+ // and do the preview; however the metafile does not need to be gotten anew
+ preparePreview( false );
+
+ // do an invalidate for the benefit of the grouping elements
+ Invalidate();
+}
+
+void PrintDialog::previewForward()
+{
+ maPageEdit.Up();
+}
+
+void PrintDialog::previewBackward()
+{
+ maPageEdit.Down();
+}
+
+// -----------------------------------------------------------------------------
+//
+// PrintProgressDialog
+//
+// -----------------------------------------------------------------------------
+
+PrintProgressDialog::PrintProgressDialog( Window* i_pParent, int i_nMax ) :
+ ModelessDialog( i_pParent, VclResId( SV_DLG_PRINT_PROGRESS ) ),
+ maText( this, VclResId( SV_PRINT_PROGRESS_TEXT ) ),
+ maButton( this, VclResId( SV_PRINT_PROGRESS_CANCEL ) ),
+ mbCanceled( false ),
+ mnCur( 0 ),
+ mnMax( i_nMax ),
+ mnProgressHeight( 15 ),
+ mbNativeProgress( false )
+{
+ FreeResource();
+
+ if( mnMax < 1 )
+ mnMax = 1;
+
+ maStr = maText.GetText();
+
+ maButton.SetClickHdl( LINK( this, PrintProgressDialog, ClickHdl ) );
+
+}
+
+PrintProgressDialog::~PrintProgressDialog()
+{
+}
+
+IMPL_LINK( PrintProgressDialog, ClickHdl, Button*, pButton )
+{
+ if( pButton == &maButton )
+ mbCanceled = true;
+
+ return 0;
+}
+
+void PrintProgressDialog::implCalcProgressRect()
+{
+ if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) )
+ {
+ ImplControlValue aValue;
+ Region aControlRegion( Rectangle( Point(), Size( 100, mnProgressHeight ) ) );
+ Region aNativeControlRegion, aNativeContentRegion;
+ if( GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
+ CTRL_STATE_ENABLED, aValue, rtl::OUString(),
+ aNativeControlRegion, aNativeContentRegion ) )
+ {
+ mnProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight();
+ }
+ mbNativeProgress = true;
+ }
+ maProgressRect = Rectangle( Point( 10, maText.GetPosPixel().Y() + maText.GetSizePixel().Height() + 8 ),
+ Size( GetSizePixel().Width() - 20, mnProgressHeight ) );
+}
+
+void PrintProgressDialog::setProgress( int i_nCurrent, int i_nMax )
+{
+ if( maProgressRect.IsEmpty() )
+ implCalcProgressRect();
+
+ mnCur = i_nCurrent;
+ if( i_nMax != -1 )
+ mnMax = i_nMax;
+
+ if( mnMax < 1 )
+ mnMax = 1;
+
+ rtl::OUString aNewText( searchAndReplace( maStr, "%p", 2, rtl::OUString::valueOf( mnCur ) ) );
+ aNewText = searchAndReplace( aNewText, "%n", 2, rtl::OUString::valueOf( mnMax ) );
+ maText.SetText( aNewText );
+
+ // update progress
+ Invalidate( maProgressRect, INVALIDATE_UPDATE );
+}
+
+void PrintProgressDialog::tick()
+{
+ if( mnCur < mnMax )
+ setProgress( ++mnCur );
+}
+
+void PrintProgressDialog::Paint( const Rectangle& )
+{
+ if( maProgressRect.IsEmpty() )
+ implCalcProgressRect();
+
+ Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Color aPrgsColor = rStyleSettings.GetHighlightColor();
+ if ( aPrgsColor == rStyleSettings.GetFaceColor() )
+ aPrgsColor = rStyleSettings.GetDarkShadowColor();
+ SetLineColor();
+ SetFillColor( aPrgsColor );
+
+ const long nOffset = 3;
+ const long nWidth = 3*mnProgressHeight/2;
+ const long nFullWidth = nWidth + nOffset;
+ const long nMaxCount = maProgressRect.GetWidth() / nFullWidth;
+ DrawProgress( this, maProgressRect.TopLeft(),
+ nOffset,
+ nWidth,
+ mnProgressHeight,
+ static_cast<USHORT>(0),
+ static_cast<USHORT>(10000*mnCur/mnMax),
+ static_cast<USHORT>(10000/nMaxCount),
+ maProgressRect
+ );
+ Pop();
+
+ if( ! mbNativeProgress )
+ {
+ DecorationView aDecoView( this );
+ Rectangle aFrameRect( maProgressRect );
+ aFrameRect.Left() -= nOffset;
+ aFrameRect.Right() += nOffset;
+ aFrameRect.Top() -= nOffset;
+ aFrameRect.Bottom() += nOffset;
+ aDecoView.DrawFrame( aFrameRect );
+ }
+}
+
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index ede3bcc107aa..8d986f691963 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -156,6 +156,7 @@ void StatusBar::ImplInit( Window* pParent, WinBits nStyle )
mbProgressMode = FALSE;
mbInUserDraw = FALSE;
mbBottomBorder = FALSE;
+ mnItemsWidth = STATUSBAR_OFFSET_X;
mnDX = 0;
mnDY = 0;
mnCalcHeight = 0;
diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx
index 95fb404d24af..217533c8d6b7 100644
--- a/vcl/source/window/tabdlg.cxx
+++ b/vcl/source/window/tabdlg.cxx
@@ -276,3 +276,21 @@ void TabDialog::AdjustLayout()
{
ImplPosControls();
}
+
+// -----------------------------------------------------------------------
+
+TabControl* TabDialog::ImplGetFirstTabControl() const
+{
+ Window* pChild = GetWindow( WINDOW_FIRSTCHILD );
+ while ( pChild )
+ {
+ if ( pChild->IsVisible() && (pChild != mpViewWindow) )
+ {
+ if ( pChild->GetType() == WINDOW_TABCONTROL )
+ return (TabControl*)pChild;
+ }
+ pChild = pChild->GetWindow( WINDOW_NEXT );
+ }
+ return NULL;
+}
+
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 8aa4926f5e1a..ef58ea9e6bc6 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -229,6 +229,22 @@ int ToolBox::ImplGetDragWidth( ToolBox* pThis )
}
return width;
}
+
+ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType )
+{
+ ButtonType tmpButtonType = defaultType;
+ ToolBoxItemBits nBits( pItem->mnBits & 0x300 );
+ if ( nBits & TIB_TEXTICON ) // item has custom setting
+ {
+ tmpButtonType = BUTTON_SYMBOLTEXT;
+ if ( nBits == TIB_TEXT_ONLY )
+ tmpButtonType = BUTTON_TEXT;
+ else if ( nBits == TIB_ICON_ONLY )
+ tmpButtonType = BUTTON_SYMBOL;
+ }
+ return tmpButtonType;
+}
+
// -----------------------------------------------------------------------
void ToolBox::ImplUpdateDragArea( ToolBox *pThis )
@@ -1992,12 +2008,13 @@ BOOL ToolBox::ImplCalcItem()
bText = FALSE;
else
bText = TRUE;
-
+ ButtonType tmpButtonType = determineButtonType( &(*it), meButtonType ); // default to toolbox setting
if ( bImage || bText )
{
+
it->mbEmptyBtn = FALSE;
- if ( meButtonType == BUTTON_SYMBOL )
+ if ( tmpButtonType == BUTTON_SYMBOL )
{
// we're drawing images only
if ( bImage || !bText )
@@ -2011,7 +2028,7 @@ BOOL ToolBox::ImplCalcItem()
it->mbVisibleText = TRUE;
}
}
- else if ( meButtonType == BUTTON_TEXT )
+ else if ( tmpButtonType == BUTTON_TEXT )
{
// we're drawing text only
if ( bText || !bImage )
@@ -3625,7 +3642,8 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay
// determine what has to be drawn on the button: image, text or both
BOOL bImage;
BOOL bText;
- pItem->DetermineButtonDrawStyle( meButtonType, bImage, bText );
+ ButtonType tmpButtonType = determineButtonType( pItem, meButtonType ); // default to toolbox setting
+ pItem->DetermineButtonDrawStyle( tmpButtonType, bImage, bText );
// compute output values
long nBtnWidth = aBtnSize.Width()-SMALLBUTTON_HSIZE;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index bcf86c749673..5689972e69d6 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -698,6 +698,8 @@ void Window::ImplInitWindowData( WindowType nType )
mpWindowImpl->mbCallHandlersDuringInputDisabled = FALSE; // TRUE: call event handlers even if input is disabled
mpWindowImpl->mbDisableAccessibleLabelForRelation = FALSE; // TRUE: do not set LabelFor relation on accessible objects
mpWindowImpl->mbDisableAccessibleLabeledByRelation = FALSE; // TRUE: do not set LabeledBy relation on accessible objects
+ mpWindowImpl->mbHelpTextDynamic = FALSE; // TRUE: append help id in HELP_DEBUG case
+ mpWindowImpl->mbFakeFocusSet = FALSE; // TRUE: pretend as if the window has focus.
mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // TRUE: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active
}
@@ -1279,7 +1281,10 @@ void Window::ImplLoadRes( const ResId& rResId )
if ( nObjMask & WINDOW_TEXT )
SetText( ReadStringRes() );
if ( nObjMask & WINDOW_HELPTEXT )
+ {
SetHelpText( ReadStringRes() );
+ mpWindowImpl->mbHelpTextDynamic = TRUE;
+ }
if ( nObjMask & WINDOW_QUICKTEXT )
SetQuickHelpText( ReadStringRes() );
if ( nObjMask & WINDOW_EXTRALONG )
@@ -3911,6 +3916,20 @@ void Window::ImplCallFocusChangeActivate( Window* pNewOverlapWindow,
}
}
+static bool IsWindowFocused(const WindowImpl& rWinImpl)
+{
+ if (rWinImpl.mpSysObj)
+ return true;
+
+ if (rWinImpl.mpFrameData->mbHasFocus)
+ return true;
+
+ if (rWinImpl.mbFakeFocusSet)
+ return true;
+
+ return false;
+}
+
// -----------------------------------------------------------------------
void Window::ImplGrabFocus( USHORT nFlags )
{
@@ -3982,9 +4001,7 @@ void Window::ImplGrabFocus( USHORT nFlags )
pFrame = pFrame->mpWindowImpl->mpFrameData->mpNextFrame;
}
- BOOL bHasFocus = TRUE;
- if ( !mpWindowImpl->mpSysObj && !mpWindowImpl->mpFrameData->mbHasFocus )
- bHasFocus = FALSE;
+ bool bHasFocus = IsWindowFocused(*mpWindowImpl);
BOOL bMustNotGrabFocus = FALSE;
// #100242#, check parent hierarchy if some floater prohibits grab focus
@@ -4755,7 +4772,10 @@ void Window::doLazyDelete()
SystemWindow* pSysWin = dynamic_cast<SystemWindow*>(this);
DockingWindow* pDockWin = dynamic_cast<DockingWindow*>(this);
if( pSysWin || ( pDockWin && pDockWin->IsFloatingMode() ) )
+ {
+ Show( FALSE );
SetParent( ImplGetDefaultWindow() );
+ }
vcl::LazyDeletor<Window>::Delete( this );
}
@@ -5377,6 +5397,11 @@ void Window::CallEventListeners( ULONG nEvent, void* pData )
}
}
+void Window::FireVclEvent( VclSimpleEvent* pEvent )
+{
+ ImplGetSVData()->mpApp->ImplCallEventListeners(pEvent);
+}
+
// -----------------------------------------------------------------------
void Window::AddEventListener( const Link& rEventListener )
@@ -7752,6 +7777,11 @@ void Window::GrabFocusToDocument()
}
}
+void Window::SetFakeFocus( bool bFocus )
+{
+ ImplGetWindowImpl()->mbFakeFocusSet = bFocus;
+}
+
// -----------------------------------------------------------------------
BOOL Window::HasChildPathFocus( BOOL bSystemWindow ) const
@@ -8109,9 +8139,26 @@ const XubString& Window::GetHelpText() const
((Window*)this)->mpWindowImpl->maHelpText = pHelp->GetHelpText( aStrHelpId, this );
else
((Window*)this)->mpWindowImpl->maHelpText = pHelp->GetHelpText( nNumHelpId, this );
+ mpWindowImpl->mbHelpTextDynamic = FALSE;
}
}
}
+ else if( mpWindowImpl->mbHelpTextDynamic && (nNumHelpId || bStrHelpId) )
+ {
+ static const char* pEnv = getenv( "HELP_DEBUG" );
+ if( pEnv && *pEnv )
+ {
+ rtl::OUStringBuffer aTxt( 64+mpWindowImpl->maHelpText.Len() );
+ aTxt.append( mpWindowImpl->maHelpText );
+ aTxt.appendAscii( "\n+++++++++++++++\n" );
+ if( bStrHelpId )
+ aTxt.append( rtl::OUString( aStrHelpId ) );
+ else
+ aTxt.append( sal_Int32( nNumHelpId ) );
+ mpWindowImpl->maHelpText = aTxt.makeStringAndClear();
+ }
+ mpWindowImpl->mbHelpTextDynamic = FALSE;
+ }
return mpWindowImpl->maHelpText;
}
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index d70f607a6cc6..a9bc93863829 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1459,7 +1459,6 @@ ULONG Window::GetHelpId() const
void Window::SetSmartHelpId( const SmartId& aId, SmartIdUpdateMode aMode )
{
- mpWindowImpl->maHelpText = String();
// create SmartId if required
if ( (aMode == SMART_SET_STR) || (aMode == SMART_SET_ALL) || ( (aMode == SMART_SET_SMART) && aId.HasString() ) )
{
@@ -2000,6 +1999,7 @@ BOOL Window::IsZoom() const
void Window::SetHelpText( const XubString& rHelpText )
{
mpWindowImpl->maHelpText = rHelpText;
+ mpWindowImpl->mbHelpTextDynamic = TRUE;
}
void Window::SetQuickHelpText( const XubString& rHelpText )
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index c92a69d3fb49..f5db066151d3 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -666,7 +666,16 @@ long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent)
static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
*/
case VCLEVENT_MENU_HIGHLIGHT:
- handle_menu_highlighted(static_cast< ::VclMenuEvent const * >(pEvent));
+ if (const VclMenuEvent* pMenuEvent = dynamic_cast<const VclMenuEvent*>(pEvent))
+ {
+ handle_menu_highlighted(pMenuEvent);
+ }
+ else if (const VclAccessibleEvent* pAccEvent = dynamic_cast<const VclAccessibleEvent*>(pEvent))
+ {
+ uno::Reference< accessibility::XAccessible > xAccessible = pAccEvent->GetAccessible();
+ if (xAccessible.is())
+ atk_wrapper_focus_tracker_notify_when_idle(xAccessible);
+ }
break;
case VCLEVENT_TOOLBOX_HIGHLIGHT:
diff --git a/vcl/unx/gtk/a11y/atkwindow.cxx b/vcl/unx/gtk/a11y/atkwindow.cxx
index 5961556e85d7..1bda4eea774e 100644
--- a/vcl/unx/gtk/a11y/atkwindow.cxx
+++ b/vcl/unx/gtk/a11y/atkwindow.cxx
@@ -33,6 +33,7 @@
#include <plugins/gtk/gtkframe.hxx>
#include <vcl/window.hxx>
+#include "vcl/popupmenuwindow.hxx"
#include "atkwindow.hxx"
#include "atkwrapper.hxx"
@@ -108,6 +109,17 @@ init_from_window( AtkObject *accessible, Window *pWindow )
pChild->SetAccessibleRole( AccessibleRole::LABEL );
accessible->name = g_strdup( rtl::OUStringToOString( pChild->GetText(), RTL_TEXTENCODING_UTF8 ).getStr() );
}
+ else if ( pWindow->GetType() == WINDOW_BORDERWINDOW && pChild->GetType() == WINDOW_FLOATINGWINDOW )
+ {
+ PopupMenuFloatingWindow* p = dynamic_cast<PopupMenuFloatingWindow*>(pChild);
+ if (p && p->IsPopupMenu() && p->GetMenuStackLevel() == 0)
+ {
+ // This is a top-level menu popup. Register it.
+ role = ATK_ROLE_POPUP_MENU;
+ pChild->SetAccessibleRole( AccessibleRole::POPUP_MENU );
+ accessible->name = g_strdup( rtl::OUStringToOString( pChild->GetText(), RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ }
}
break;
}
@@ -136,6 +148,23 @@ ooo_window_wrapper_real_focus_gtk (GtkWidget *, GdkEventFocus *)
/*****************************************************************************/
+static bool
+isChildPopupMenu(Window* pWindow)
+{
+ Window* pChild = pWindow->GetAccessibleChildWindow(0);
+ if (!pChild)
+ return false;
+
+ if (WINDOW_FLOATINGWINDOW != pChild->GetType())
+ return false;
+
+ PopupMenuFloatingWindow* p = dynamic_cast<PopupMenuFloatingWindow*>(pChild);
+ if (!p)
+ return false;
+
+ return p->IsPopupMenu();
+}
+
static void
ooo_window_wrapper_real_initialize(AtkObject *obj, gpointer data)
{
@@ -157,8 +186,16 @@ ooo_window_wrapper_real_initialize(AtkObject *obj, gpointer data)
*/
if( WINDOW_BORDERWINDOW == pWindow->GetType() )
{
- ooo_wrapper_registry_add( xAccessible, obj );
- g_object_set_data( G_OBJECT(obj), "ooo:atk-wrapper-key", xAccessible.get() );
+ if ( isChildPopupMenu(pWindow) )
+ {
+ AtkObject *child = atk_object_wrapper_new( xAccessible, obj );
+ ooo_wrapper_registry_add( xAccessible, child );
+ }
+ else
+ {
+ ooo_wrapper_registry_add( xAccessible, obj );
+ g_object_set_data( G_OBJECT(obj), "ooo:atk-wrapper-key", xAccessible.get() );
+ }
}
else
{
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index 8854083e1509..302c096e5915 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -515,6 +515,60 @@ wrapper_ref_relation_set( AtkObject *atk_obj )
/*****************************************************************************/
+#if 0
+struct {
+ sal_Int16 value;
+ const sal_Char* name;
+} aStateTypeTable[] = {
+ { accessibility::AccessibleStateType::INVALID, "INVALID" },
+ { accessibility::AccessibleStateType::ACTIVE, "ACTIVE" },
+ { accessibility::AccessibleStateType::ARMED, "ARMED" },
+ { accessibility::AccessibleStateType::BUSY, "BUSY" },
+ { accessibility::AccessibleStateType::CHECKED, "CHECKED" },
+ { accessibility::AccessibleStateType::DEFUNC, "DEFUNC" },
+ { accessibility::AccessibleStateType::EDITABLE, "EDITABLE" },
+ { accessibility::AccessibleStateType::ENABLED, "ENABLED" },
+ { accessibility::AccessibleStateType::EXPANDABLE, "EXPANDABLE" },
+ { accessibility::AccessibleStateType::EXPANDED, "EXPANDED" },
+ { accessibility::AccessibleStateType::FOCUSABLE, "FOCUSABLE" },
+ { accessibility::AccessibleStateType::FOCUSED, "FOCUSED" },
+ { accessibility::AccessibleStateType::HORIZONTAL, "HORIZONTAL" },
+ { accessibility::AccessibleStateType::ICONIFIED, "ICONIFIED" },
+ { accessibility::AccessibleStateType::INDETERMINATE, "INDETERMINATE" },
+ { accessibility::AccessibleStateType::MANAGES_DESCENDANTS, "MANAGES_DESCENDANTS" },
+ { accessibility::AccessibleStateType::MODAL, "MODAL" },
+ { accessibility::AccessibleStateType::MULTI_LINE, "MULTI_LINE" },
+ { accessibility::AccessibleStateType::MULTI_SELECTABLE, "MULTI_SELECTABLE" },
+ { accessibility::AccessibleStateType::OPAQUE, "OPAQUE" },
+ { accessibility::AccessibleStateType::PRESSED, "PRESSED" },
+ { accessibility::AccessibleStateType::RESIZABLE, "RESIZABLE" },
+ { accessibility::AccessibleStateType::SELECTABLE, "SELECTABLE" },
+ { accessibility::AccessibleStateType::SELECTED, "SELECTED" },
+ { accessibility::AccessibleStateType::SENSITIVE, "SENSITIVE" },
+ { accessibility::AccessibleStateType::SHOWING, "SHOWING" },
+ { accessibility::AccessibleStateType::SINGLE_LINE, "SINGLE_LINE" },
+ { accessibility::AccessibleStateType::STALE, "STALE" },
+ { accessibility::AccessibleStateType::TRANSIENT, "TRANSIENT" },
+ { accessibility::AccessibleStateType::VERTICAL, "VERTICAL" },
+ { accessibility::AccessibleStateType::VISIBLE, "VISIBLE" }
+};
+
+static void printStates(const uno::Sequence<sal_Int16>& rStates)
+{
+ sal_Int32 n = rStates.getLength();
+ size_t nTypes = sizeof(aStateTypeTable)/sizeof(aStateTypeTable[0]);
+ for (sal_Int32 i = 0; i < n; ++i)
+ {
+ for (size_t j = 0; j < nTypes; ++j)
+ {
+ if (aStateTypeTable[j].value == rStates[i])
+ printf("%s ", aStateTypeTable[j].name);
+ }
+ }
+ printf("\n");
+}
+#endif
+
static AtkStateSet *
wrapper_ref_state_set( AtkObject *atk_obj )
{
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index af3a1df97a8c..92a8ff641a38 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -144,11 +144,6 @@ extern "C"
if( ! ( pNoXInitThreads && *pNoXInitThreads ) )
XInitThreads();
- #if OSL_DEBUG_LEVEL > 1
- int nFd = open( "/home/pl93762/log.txt", O_CREAT | O_TRUNC | O_WRONLY, 0755 );
- dup2( nFd, STDERR_FILENO );
- #endif
-
const gchar* pVersion = gtk_check_version( 2, 2, 0 );
if( pVersion )
{
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index f922552ce923..654f39c51a92 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -1091,6 +1091,19 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
rNativeContentRegion = Region( aIndicatorRect );
returnVal = TRUE;
}
+ if( (nType == CTRL_EDITBOX || nType == CTRL_SPINBOX) && nPart == PART_ENTIRE_CONTROL )
+ {
+ NWEnsureGTKEditBox( m_nScreen );
+ GtkWidget* widget = gWidgetData[m_nScreen].gEditBoxWidget;
+ GtkRequisition aReq;
+ gtk_widget_size_request( widget, &aReq );
+ Rectangle aEditRect = rControlRegion.GetBoundRect();
+ aEditRect = Rectangle( aEditRect.TopLeft(),
+ Size( aEditRect.GetWidth(), aReq.height+1 ) );
+ rNativeBoundingRegion = Region( aEditRect );
+ rNativeContentRegion = rNativeBoundingRegion;
+ returnVal = TRUE;
+ }
return( returnVal );
}
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 92ff2d3b8d8e..69f42637d203 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -1315,7 +1315,7 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate )
setMinMaxSize();
// #i45160# switch to desktop where a dialog with parent will appear
- if( m_pParent && m_pParent->m_nWorkArea != m_nWorkArea )
+ if( m_pParent && m_pParent->m_nWorkArea != m_nWorkArea && GTK_WIDGET_MAPPED(m_pParent->m_pWindow) )
getDisplay()->getWMAdaptor()->switchToWorkArea( m_pParent->m_nWorkArea );
if( isFloatGrabWindow() &&
diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx
index 1882b50e6ad7..2c0ba3dad84c 100644
--- a/vcl/unx/headless/svpprn.cxx
+++ b/vcl/unx/headless/svpprn.cxx
@@ -123,6 +123,32 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
pJobSetup->mnPaperBin = 0xffff;
}
+ // copy duplex
+ pKey = NULL;
+ pValue = NULL;
+
+ pJobSetup->meDuplexMode = DUPLEX_UNKNOWN;
+ if( rData.m_pParser )
+ pKey = rData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
+ if( pKey )
+ pValue = rData.m_aContext.getValue( pKey );
+ if( pKey && pValue )
+ {
+ if( pValue->m_aOption.EqualsIgnoreCaseAscii( "None" ) ||
+ pValue->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 )
+ )
+ {
+ pJobSetup->meDuplexMode = DUPLEX_OFF;
+ }
+ else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexNoTumble" ) )
+ {
+ pJobSetup->meDuplexMode = DUPLEX_LONGEDGE;
+ }
+ else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexTumble" ) )
+ {
+ pJobSetup->meDuplexMode = DUPLEX_SHORTEDGE;
+ }
+ }
// copy the whole context
if( pJobSetup->mpDriverData )
@@ -455,34 +481,6 @@ void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
// -----------------------------------------------------------------------
-DuplexMode PspSalInfoPrinter::GetDuplexMode( const ImplJobSetup* pJobSetup )
-{
- DuplexMode aRet = DUPLEX_UNKNOWN;
- PrinterInfo aInfo( PrinterInfoManager::get().getPrinterInfo( pJobSetup->maPrinterName ) );
- if ( pJobSetup->mpDriverData )
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aInfo );
- if( aInfo.m_pParser )
- {
- const PPDKey * pKey = aInfo.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
- if( pKey )
- {
- const PPDValue* pVal = aInfo.m_aContext.getValue( pKey );
- if( pVal && (
- pVal->m_aOption.EqualsIgnoreCaseAscii( "None" ) ||
- pVal->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 )
- ) )
- {
- aRet = DUPLEX_OFF;
- }
- else
- aRet = DUPLEX_ON;
- }
- }
- return aRet;
-}
-
-// -----------------------------------------------------------------------
-
int PspSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* )
{
return 900;
@@ -624,6 +622,37 @@ BOOL PspSalInfoPrinter::SetData(
if( nSetDataFlags & SAL_JOBSET_ORIENTATION )
aData.m_eOrientation = pJobSetup->meOrientation == ORIENTATION_LANDSCAPE ? orientation::Landscape : orientation::Portrait;
+ // merge duplex if necessary
+ if( nSetDataFlags & SAL_JOBSET_DUPLEXMODE )
+ {
+ pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
+ if( pKey )
+ {
+ pValue = NULL;
+ switch( pJobSetup->meDuplexMode )
+ {
+ case DUPLEX_OFF:
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
+ if( pValue == NULL )
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "SimplexNoTumble" ) ) );
+ break;
+ case DUPLEX_SHORTEDGE:
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexTumble" ) ) );
+ break;
+ case DUPLEX_LONGEDGE:
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexNoTumble" ) ) );
+ break;
+ case DUPLEX_UNKNOWN:
+ default:
+ pValue = 0;
+ break;
+ }
+ if( ! pValue )
+ pValue = pKey->getDefaultValue();
+ aData.m_aContext.setValue( pKey, pValue );
+ }
+ }
+
m_aJobData = aData;
copyJobDataToJobSetup( pJobSetup, aData );
return TRUE;
@@ -707,7 +736,7 @@ String PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, ULONG
{
const PPDValue* pValue = pKey->getValue( nPaperBin );
if( pValue )
- aRet = pValue->m_aOptionTranslation.Len() ? pValue->m_aOptionTranslation : pValue->m_aOption;
+ aRet = aData.m_pParser->translateOption( pKey->getKey(), pValue->m_aOption );
}
}
@@ -725,9 +754,22 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT
case PRINTER_CAPABILITIES_COPIES:
return 0xffff;
case PRINTER_CAPABILITIES_COLLATECOPIES:
- return 0;
+ {
+ // see if the PPD contains a value to set Collate to True
+ JobData aData;
+ JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
+
+ const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) ) : NULL;
+ const PPDValue* pVal = pKey ? pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "True" ) ) ) : NULL;
+
+ // PPDs don't mention the number of possible collated copies.
+ // so let's guess as many as we want ?
+ return pVal ? 0xffff : 0;
+ }
case PRINTER_CAPABILITIES_SETORIENTATION:
return 1;
+ case PRINTER_CAPABILITIES_SETDUPLEX:
+ return 1;
case PRINTER_CAPABILITIES_SETPAPERBIN:
return 1;
case PRINTER_CAPABILITIES_SETPAPERSIZE:
@@ -777,6 +819,7 @@ PspSalPrinter::PspSalPrinter( SalInfoPrinter* pInfoPrinter )
m_bSwallowFaxNo( false ),
m_pGraphics( NULL ),
m_nCopies( 1 ),
+ m_bCollate( false ),
m_pInfoPrinter( pInfoPrinter )
{
}
@@ -802,7 +845,9 @@ BOOL PspSalPrinter::StartJob(
const XubString* pFileName,
const XubString& rJobName,
const XubString& rAppName,
- ULONG nCopies, BOOL /*bCollate*/,
+ ULONG nCopies,
+ bool bCollate,
+ bool /*bDirect*/,
ImplJobSetup* pJobSetup )
{
vcl_sal::PrinterUpdate::jobStarted();
@@ -811,13 +856,17 @@ BOOL PspSalPrinter::StartJob(
m_bPdf = false;
m_aFileName = pFileName ? *pFileName : String();
m_aTmpFile = String();
- m_nCopies = nCopies;
+ m_nCopies = nCopies;
+ m_bCollate = bCollate;
JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData );
if( m_nCopies > 1 )
+ {
// in case user did not do anything (m_nCopies=1)
// take the default from jobsetup
m_aJobData.m_nCopies = m_nCopies;
+ m_aJobData.setCollate( bCollate );
+ }
// check wether this printer is configured as fax
int nMode = 0;
@@ -917,9 +966,12 @@ SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, BOOL )
m_pGraphics = new PspGraphics( &m_aJobData, &m_aPrinterGfx, m_bFax ? &m_aFaxNr : NULL, m_bSwallowFaxNo, m_pInfoPrinter );
m_pGraphics->SetLayout( 0 );
if( m_nCopies > 1 )
+ {
// in case user did not do anything (m_nCopies=1)
// take the default from jobsetup
m_aJobData.m_nCopies = m_nCopies;
+ m_aJobData.setCollate( m_nCopies > 1 && m_bCollate );
+ }
m_aPrintJob.StartPage( m_aJobData );
m_aPrinterGfx.Init( m_aPrintJob );
diff --git a/vcl/unx/headless/svpprn.hxx b/vcl/unx/headless/svpprn.hxx
index c2d85c054fce..8f5a47fed118 100644
--- a/vcl/unx/headless/svpprn.hxx
+++ b/vcl/unx/headless/svpprn.hxx
@@ -63,7 +63,6 @@ public:
virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin );
virtual void InitPaperFormats( const ImplJobSetup* pSetupData );
virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData );
- virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData );
};
class PspSalPrinter : public SalPrinter
@@ -80,6 +79,7 @@ public:
psp::JobData m_aJobData;
psp::PrinterGfx m_aPrinterGfx;
ULONG m_nCopies;
+ bool m_bCollate;
SalInfoPrinter* m_pInfoPrinter;
PspSalPrinter( SalInfoPrinter* );
@@ -90,7 +90,9 @@ public:
virtual BOOL StartJob( const XubString* pFileName,
const XubString& rJobName,
const XubString& rAppName,
- ULONG nCopies, BOOL bCollate,
+ ULONG nCopies,
+ bool bCollate,
+ bool bDirect,
ImplJobSetup* pSetupData );
virtual BOOL EndJob();
virtual BOOL AbortJob();
diff --git a/vcl/unx/inc/salprn.h b/vcl/unx/inc/salprn.h
index 452fa5a89387..59a5c3eef56a 100644
--- a/vcl/unx/inc/salprn.h
+++ b/vcl/unx/inc/salprn.h
@@ -63,7 +63,6 @@ public:
virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin );
virtual void InitPaperFormats( const ImplJobSetup* pSetupData );
virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData );
- virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData );
};
class PspSalPrinter : public SalPrinter
@@ -80,6 +79,7 @@ public:
psp::JobData m_aJobData;
psp::PrinterGfx m_aPrinterGfx;
ULONG m_nCopies;
+ bool m_bCollate;
SalInfoPrinter* m_pInfoPrinter;
PspSalPrinter( SalInfoPrinter* );
@@ -90,7 +90,9 @@ public:
virtual BOOL StartJob( const XubString* pFileName,
const XubString& rJobName,
const XubString& rAppName,
- ULONG nCopies, BOOL bCollate,
+ ULONG nCopies,
+ bool bCollate,
+ bool bDirect,
ImplJobSetup* pSetupData );
virtual BOOL EndJob();
virtual BOOL AbortJob();
diff --git a/vcl/unx/source/app/randrwrapper.cxx b/vcl/unx/source/app/randrwrapper.cxx
index 4fbe5db97ab9..85f60a07903a 100644
--- a/vcl/unx/source/app/randrwrapper.cxx
+++ b/vcl/unx/source/app/randrwrapper.cxx
@@ -288,6 +288,9 @@ void RandRWrapper::releaseWrapper()
#include "saldisp.hxx"
#include "salframe.h"
+#if OSL_DEBUG_LEVEL > 1
+#include <cstdio>
+#endif
void SalDisplay::InitRandR( XLIB_Window aRoot ) const
{
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx
index cfd568ac9b6c..558ae3714358 100644
--- a/vcl/unx/source/app/saldisp.cxx
+++ b/vcl/unx/source/app/saldisp.cxx
@@ -2304,11 +2304,7 @@ long SalX11Display::Dispatch( XEvent *pEvent )
return 0;
SalInstance* pInstance = GetSalData()->m_pInstance;
- if( pInstance->GetEventCallback() )
- {
- YieldMutexReleaser aReleaser;
- pInstance->CallEventCallback( pEvent, sizeof( XEvent ) );
- }
+ pInstance->CallEventCallback( pEvent, sizeof( XEvent ) );
switch( pEvent->type )
{
diff --git a/vcl/unx/source/dtrans/X11_dndcontext.cxx b/vcl/unx/source/dtrans/X11_dndcontext.cxx
index 59832c27c2a7..71aebde5b7af 100644
--- a/vcl/unx/source/dtrans/X11_dndcontext.cxx
+++ b/vcl/unx/source/dtrans/X11_dndcontext.cxx
@@ -42,8 +42,8 @@ using namespace x11;
*/
DropTargetDropContext::DropTargetDropContext(
- Window aDropWindow,
- Time aTimestamp,
+ XLIB_Window aDropWindow,
+ XLIB_Time aTimestamp,
SelectionManager& rManager ) :
m_aDropWindow( aDropWindow ),
m_nTimestamp( aTimestamp ),
@@ -77,8 +77,8 @@ void DropTargetDropContext::dropComplete( sal_Bool success ) throw()
*/
DropTargetDragContext::DropTargetDragContext(
- Window aDropWindow,
- Time aTimestamp,
+ XLIB_Window aDropWindow,
+ XLIB_Time aTimestamp,
SelectionManager& rManager ) :
m_aDropWindow( aDropWindow ),
m_nTimestamp( aTimestamp ),
@@ -106,8 +106,8 @@ void DropTargetDragContext::rejectDrag() throw()
*/
DragSourceContext::DragSourceContext(
- Window aDropWindow,
- Time aTimestamp,
+ XLIB_Window aDropWindow,
+ XLIB_Time aTimestamp,
SelectionManager& rManager ) :
m_aDropWindow( aDropWindow ),
m_nTimestamp( aTimestamp ),
diff --git a/vcl/unx/source/dtrans/X11_dndcontext.hxx b/vcl/unx/source/dtrans/X11_dndcontext.hxx
index f2ecb7b0841b..3626b86d8617 100644
--- a/vcl/unx/source/dtrans/X11_dndcontext.hxx
+++ b/vcl/unx/source/dtrans/X11_dndcontext.hxx
@@ -36,7 +36,9 @@
#include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp>
#include <cppuhelper/implbase1.hxx>
+#include "tools/prex.h"
#include <X11/Xlib.h>
+#include "tools/postx.h"
using namespace com::sun::star::uno;
@@ -49,12 +51,12 @@ namespace x11 {
::com::sun::star::datatransfer::dnd::XDropTargetDropContext
>
{
- Window m_aDropWindow;
- Time m_nTimestamp;
+ XLIB_Window m_aDropWindow;
+ XLIB_Time m_nTimestamp;
SelectionManager& m_rManager;
Reference< XInterface > m_xManagerRef;
public:
- DropTargetDropContext( Window, Time, SelectionManager& );
+ DropTargetDropContext( XLIB_Window, XLIB_Time, SelectionManager& );
virtual ~DropTargetDropContext();
// XDropTargetDropContext
@@ -68,12 +70,12 @@ namespace x11 {
::com::sun::star::datatransfer::dnd::XDropTargetDragContext
>
{
- Window m_aDropWindow;
- Time m_nTimestamp;
+ XLIB_Window m_aDropWindow;
+ XLIB_Time m_nTimestamp;
SelectionManager& m_rManager;
Reference< XInterface > m_xManagerRef;
public:
- DropTargetDragContext( Window, Time, SelectionManager& );
+ DropTargetDragContext( XLIB_Window, XLIB_Time, SelectionManager& );
virtual ~DropTargetDragContext();
// XDropTargetDragContext
@@ -86,12 +88,12 @@ namespace x11 {
::com::sun::star::datatransfer::dnd::XDragSourceContext
>
{
- Window m_aDropWindow;
- Time m_nTimestamp;
+ XLIB_Window m_aDropWindow;
+ XLIB_Time m_nTimestamp;
SelectionManager& m_rManager;
Reference< XInterface > m_xManagerRef;
public:
- DragSourceContext( Window, Time, SelectionManager& );
+ DragSourceContext( XLIB_Window, XLIB_Time, SelectionManager& );
virtual ~DragSourceContext();
// XDragSourceContext
diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx
index c6036ae4f78e..e549d92d9c5f 100644
--- a/vcl/unx/source/dtrans/X11_selection.cxx
+++ b/vcl/unx/source/dtrans/X11_selection.cxx
@@ -35,11 +35,13 @@
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
+#include "tools/prex.h"
#include <X11/Xatom.h>
#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/X.h>
#include <X11/Xutil.h>
+#include "tools/postx.h"
#if defined(LINUX) || defined(NETBSD) || defined (FREEBSD)
#include <sys/poll.h>
#else
@@ -53,6 +55,8 @@
#include <X11_dndcontext.hxx>
#include <bmp.hxx>
+#include "vcl/svapp.hxx"
+
// pointer bitmaps
#include <copydata_curs.h>
#include <copydata_mask.h>
@@ -66,9 +70,9 @@
#include <com/sun/star/awt/MouseEvent.hpp>
#include <com/sun/star/awt/MouseButton.hpp>
#include <rtl/tencinfo.h>
-#ifndef OSL_PROCESS_H
#include <osl/process.h>
-#endif
+
+#include <comphelper/processfactory.hxx>
#define DRAG_EVENT_MASK ButtonPressMask |\
ButtonReleaseMask |\
@@ -81,6 +85,7 @@ using namespace com::sun::star::datatransfer::dnd;
using namespace com::sun::star::lang;
using namespace com::sun::star::awt;
using namespace com::sun::star::uno;
+using namespace com::sun::star::frame;
using namespace cppu;
using namespace osl;
using namespace rtl;
@@ -280,7 +285,7 @@ SelectionManager::SelectionManager() :
m_aDragRunning.reset();
}
-Cursor SelectionManager::createCursor( const char* pPointerData, const char* pMaskData, int width, int height, int hotX, int hotY )
+XLIB_Cursor SelectionManager::createCursor( const char* pPointerData, const char* pMaskData, int width, int height, int hotX, int hotY )
{
Pixmap aPointer;
Pixmap aMask;
@@ -306,7 +311,7 @@ Cursor SelectionManager::createCursor( const char* pPointerData, const char* pMa
pMaskData,
width,
height );
- Cursor aCursor =
+ XLIB_Cursor aCursor =
XCreatePixmapCursor( m_pDisplay, aPointer, aMask,
&aBlack, &aWhite,
hotX,
@@ -928,7 +933,7 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_In
if( it == m_aSelections.end() )
return false;
- Window aSelectionOwner = XGetSelectionOwner( m_pDisplay, selection );
+ XLIB_Window aSelectionOwner = XGetSelectionOwner( m_pDisplay, selection );
if( aSelectionOwner == None )
return false;
if( aSelectionOwner == m_aWindow )
@@ -1480,7 +1485,7 @@ static sal_Size GetTrueFormatSize(int nFormat)
}
bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
- Window requestor,
+ XLIB_Window requestor,
Atom target,
Atom property,
Atom selection )
@@ -1587,7 +1592,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
{
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "using INCR protocol\n" );
- std::hash_map< Window, std::hash_map< Atom, IncrementalTransfer > >::const_iterator win_it = m_aIncrementals.find( requestor );
+ std::hash_map< XLIB_Window, std::hash_map< Atom, IncrementalTransfer > >::const_iterator win_it = m_aIncrementals.find( requestor );
if( win_it != m_aIncrementals.end() )
{
std::hash_map< Atom, IncrementalTransfer >::const_iterator inc_it = win_it->second.find( property );
@@ -1986,7 +1991,7 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent& rNotify )
// feed incrementals
if( rNotify.state == PropertyDelete )
{
- std::hash_map< Window, std::hash_map< Atom, IncrementalTransfer > >::iterator it;
+ std::hash_map< XLIB_Window, std::hash_map< Atom, IncrementalTransfer > >::iterator it;
it = m_aIncrementals.find( rNotify.window );
if( it != m_aIncrementals.end() )
{
@@ -2168,12 +2173,12 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
ResettableMutexGuard aGuard(m_aMutex);
// handle drop related events
- Window aSource = rMessage.data.l[0];
- Window aTarget = rMessage.window;
+ XLIB_Window aSource = rMessage.data.l[0];
+ XLIB_Window aTarget = rMessage.window;
bool bHandled = false;
- ::std::hash_map< Window, DropTargetEntry >::iterator it =
+ ::std::hash_map< XLIB_Window, DropTargetEntry >::iterator it =
m_aDropTargets.find( aTarget );
#if OSL_DEBUG_LEVEL > 1
@@ -2187,7 +2192,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
fprintf( stderr, "but no target found\n" );
else if( ! it->second.m_pTarget->m_bActive )
fprintf( stderr, "but target is inactive\n" );
- else if( m_aDropEnterEvent.data.l[0] != None && (Window)m_aDropEnterEvent.data.l[0] != aSource )
+ else if( m_aDropEnterEvent.data.l[0] != None && (XLIB_Window)m_aDropEnterEvent.data.l[0] != aSource )
fprintf( stderr, "but source 0x%lx is unknown (expected 0x%lx or 0)\n", aSource, m_aDropEnterEvent.data.l[0] );
else
fprintf( stderr, "processing.\n" );
@@ -2208,7 +2213,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
if( it != m_aDropTargets.end() &&
it->second.m_pTarget->m_bActive &&
- ( m_aDropEnterEvent.data.l[0] == None || Window(m_aDropEnterEvent.data.l[0]) == aSource )
+ ( m_aDropEnterEvent.data.l[0] == None || XLIB_Window(m_aDropEnterEvent.data.l[0]) == aSource )
)
{
if( rMessage.message_type == m_nXdndEnter )
@@ -2224,7 +2229,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
}
else if(
rMessage.message_type == m_nXdndPosition &&
- aSource == Window(m_aDropEnterEvent.data.l[0])
+ aSource == XLIB_Window(m_aDropEnterEvent.data.l[0])
)
{
bHandled = true;
@@ -2232,7 +2237,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
if( ! m_bDropEnterSent )
m_nDropTimestamp = m_nDropTime;
- Window aChild;
+ XLIB_Window aChild;
XTranslateCoordinates( m_pDisplay,
it->second.m_aRootWindow,
it->first,
@@ -2280,7 +2285,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
}
else if(
rMessage.message_type == m_nXdndLeave &&
- aSource == Window(m_aDropEnterEvent.data.l[0])
+ aSource == XLIB_Window(m_aDropEnterEvent.data.l[0])
)
{
bHandled = true;
@@ -2298,7 +2303,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
}
else if(
rMessage.message_type == m_nXdndDrop &&
- aSource == Window(m_aDropEnterEvent.data.l[0])
+ aSource == XLIB_Window(m_aDropEnterEvent.data.l[0])
)
{
bHandled = true;
@@ -2345,7 +2350,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
* methods for XDropTargetDropContext
*/
-void SelectionManager::dropComplete( sal_Bool bSuccess, Window aDropWindow, Time )
+void SelectionManager::dropComplete( sal_Bool bSuccess, XLIB_Window aDropWindow, XLIB_Time )
{
ClearableMutexGuard aGuard(m_aMutex);
@@ -2542,21 +2547,21 @@ bool SelectionManager::updateDragAction( int modifierState )
// ------------------------------------------------------------------------
-void SelectionManager::sendDropPosition( bool bForce, Time eventTime )
+void SelectionManager::sendDropPosition( bool bForce, XLIB_Time eventTime )
{
ClearableMutexGuard aGuard(m_aMutex);
if( m_bDropSent )
return;
- ::std::hash_map< Window, DropTargetEntry >::const_iterator it =
+ ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it =
m_aDropTargets.find( m_aDropWindow );
if( it != m_aDropTargets.end() )
{
if( it->second.m_pTarget->m_bActive )
{
int x, y;
- Window aChild;
+ XLIB_Window aChild;
XTranslateCoordinates( m_pDisplay, it->second.m_aRootWindow, m_aDropWindow, m_nLastDragX, m_nLastDragY, &x, &y, &aChild );
DropTargetDragEvent dtde;
dtde.Source = static_cast< OWeakObject* >(it->second.m_pTarget );
@@ -2612,7 +2617,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
bool bHandled = false;
// for shortcut
- ::std::hash_map< Window, DropTargetEntry >::const_iterator it =
+ ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it =
m_aDropTargets.find( m_aDropWindow );
#if OSL_DEBUG_LEVEL > 1
switch( rMessage.type )
@@ -2635,7 +2640,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
case ButtonRelease:
fprintf( stderr, "handleDragEvent: ButtonRelease %d (m_nDragButton = %d)\n", rMessage.xbutton.button, m_nDragButton );
break;
- case KeyPress:
+ case XLIB_KeyPress:
fprintf( stderr, "handleDragEvent: KeyPress\n" );
break;
case KeyRelease:
@@ -2719,7 +2724,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
bool bForce = false;
int root_x = rMessage.type == MotionNotify ? rMessage.xmotion.x_root : rMessage.xcrossing.x_root;
int root_y = rMessage.type == MotionNotify ? rMessage.xmotion.y_root : rMessage.xcrossing.y_root;
- Window root = rMessage.type == MotionNotify ? rMessage.xmotion.root : rMessage.xcrossing.root;
+ XLIB_Window root = rMessage.type == MotionNotify ? rMessage.xmotion.root : rMessage.xcrossing.root;
m_nDragTimestamp = rMessage.type == MotionNotify ? rMessage.xmotion.time : rMessage.xcrossing.time;
aGuard.clear();
@@ -2736,7 +2741,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
sendDropPosition( bForce, rMessage.type == MotionNotify ? rMessage.xmotion.time : rMessage.xcrossing.time );
}
}
- else if( rMessage.type == KeyPress || rMessage.type == KeyRelease )
+ else if( rMessage.type == XLIB_KeyPress || rMessage.type == KeyRelease )
{
bHandled = true;
KeySym aKey = XKeycodeToKeysym( m_pDisplay, rMessage.xkey.keycode, 0 );
@@ -2793,7 +2798,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
case XK_Control_L: nNewState = ControlMask;break;
// just interested in shift and ctrl for dnd
}
- if( rMessage.type == KeyPress )
+ if( rMessage.type == XLIB_KeyPress )
nState |= nNewState;
else
nState &= ~nNewState;
@@ -2815,7 +2820,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
{
bHandled = true;
int x, y;
- Window aChild;
+ XLIB_Window aChild;
XTranslateCoordinates( m_pDisplay, rMessage.xbutton.root, m_aDropWindow, rMessage.xbutton.x_root, rMessage.xbutton.y_root, &x, &y, &aChild );
DropTargetDropEvent dtde;
dtde.Source = static_cast< OWeakObject* >(it->second.m_pTarget );
@@ -2865,7 +2870,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
{
bHandled = true;
- Window aDummy;
+ XLIB_Window aDummy;
XEvent aEvent;
aEvent.type = ButtonPress;
aEvent.xbutton.display = m_pDisplay;
@@ -2924,7 +2929,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
// ------------------------------------------------------------------------
-void SelectionManager::accept( sal_Int8 dragOperation, Window aDropWindow, Time )
+void SelectionManager::accept( sal_Int8 dragOperation, XLIB_Window aDropWindow, XLIB_Time )
{
if( aDropWindow == m_aCurrentDropWindow )
{
@@ -2946,7 +2951,7 @@ void SelectionManager::accept( sal_Int8 dragOperation, Window aDropWindow, Time
// ------------------------------------------------------------------------
-void SelectionManager::reject( Window aDropWindow, Time )
+void SelectionManager::reject( XLIB_Window aDropWindow, XLIB_Time )
{
if( aDropWindow == m_aCurrentDropWindow )
{
@@ -2982,7 +2987,7 @@ sal_Bool SelectionManager::isDragImageSupported() throw()
sal_Int32 SelectionManager::getDefaultCursor( sal_Int8 dragAction ) throw()
{
- Cursor aCursor = m_aNoneCursor;
+ XLIB_Cursor aCursor = m_aNoneCursor;
if( dragAction & DNDConstants::ACTION_MOVE )
aCursor = m_aMoveCursor;
else if( dragAction & DNDConstants::ACTION_COPY )
@@ -2994,7 +2999,7 @@ sal_Int32 SelectionManager::getDefaultCursor( sal_Int8 dragAction ) throw()
// ------------------------------------------------------------------------
-int SelectionManager::getXdndVersion( Window aWindow, Window& rProxy )
+int SelectionManager::getXdndVersion( XLIB_Window aWindow, XLIB_Window& rProxy )
{
Atom* pProperties = NULL;
int nProperties = 0;
@@ -3022,7 +3027,7 @@ int SelectionManager::getXdndVersion( Window aWindow, Window& rProxy )
if( pBytes )
{
if( nType == XA_WINDOW )
- rProxy = *(Window*)pBytes;
+ rProxy = *(XLIB_Window*)pBytes;
XFree( pBytes );
pBytes = NULL;
if( rProxy != None )
@@ -3032,7 +3037,7 @@ int SelectionManager::getXdndVersion( Window aWindow, Window& rProxy )
&nType, &nFormat, &nItems, &nBytes, &pBytes );
if( pBytes )
{
- if( nType == XA_WINDOW && *(Window*)pBytes != rProxy )
+ if( nType == XA_WINDOW && *(XLIB_Window*)pBytes != rProxy )
rProxy = None;
XFree( pBytes );
pBytes = NULL;
@@ -3044,7 +3049,7 @@ int SelectionManager::getXdndVersion( Window aWindow, Window& rProxy )
break;
}
}
- Window aAwareWindow = rProxy != None ? rProxy : aWindow;
+ XLIB_Window aAwareWindow = rProxy != None ? rProxy : aWindow;
XGetWindowProperty( m_pDisplay, aAwareWindow, m_nXdndAware, 0, 1, False, XA_ATOM,
&nType, &nFormat, &nItems, &nBytes, &pBytes );
@@ -3062,7 +3067,7 @@ int SelectionManager::getXdndVersion( Window aWindow, Window& rProxy )
// ------------------------------------------------------------------------
-void SelectionManager::updateDragWindow( int nX, int nY, Window aRoot )
+void SelectionManager::updateDragWindow( int nX, int nY, XLIB_Window aRoot )
{
ResettableMutexGuard aGuard( m_aMutex );
@@ -3071,9 +3076,9 @@ void SelectionManager::updateDragWindow( int nX, int nY, Window aRoot )
m_nLastDragX = nX;
m_nLastDragY = nY;
- Window aParent = aRoot;
- Window aChild;
- Window aNewProxy = None, aNewCurrentWindow = None;
+ XLIB_Window aParent = aRoot;
+ XLIB_Window aChild;
+ XLIB_Window aNewProxy = None, aNewCurrentWindow = None;
int nNewProtocolVersion = -1;
int nWinX, nWinY;
@@ -3114,7 +3119,7 @@ void SelectionManager::updateDragWindow( int nX, int nY, Window aRoot )
dsde.DropAction = nNewProtocolVersion >= 0 ? m_nUserDragAction : DNDConstants::ACTION_COPY;
dsde.UserAction = nNewProtocolVersion >= 0 ? m_nUserDragAction : DNDConstants::ACTION_COPY;
- ::std::hash_map< Window, DropTargetEntry >::const_iterator it;
+ ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it;
if( aNewCurrentWindow != m_aDropWindow )
{
#if OSL_DEBUG_LEVEL > 1
@@ -3263,11 +3268,11 @@ void SelectionManager::startDrag(
// the pointer is located in. since said window should be one
// of our DropTargets at the time of executeDrag we can use
// them for a start
- Window aRoot, aParent, aChild;
+ XLIB_Window aRoot, aParent, aChild;
int root_x, root_y, win_x, win_y;
unsigned int mask;
- ::std::hash_map< Window, DropTargetEntry >::const_iterator it;
+ ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it;
it = m_aDropTargets.begin();
while( it != m_aDropTargets.end() )
{
@@ -3379,10 +3384,9 @@ void SelectionManager::startDrag(
m_bDropSuccess = false;
m_bWaitingForPrimaryConversion = false;
m_nDragButton = Button1; // default to left button
- if( trigger.Event.getValueTypeName().equalsAsciiL( "com.sun.star.awt.MouseEvent", 27 ) )
+ com::sun::star::awt::MouseEvent aEvent;
+ if( trigger.Event >>= aEvent )
{
- MouseEvent aEvent;
- trigger.Event >>= aEvent;
if( aEvent.Buttons & MouseButton::LEFT )
m_nDragButton = Button1;
else if( aEvent.Buttons & MouseButton::RIGHT )
@@ -3519,10 +3523,10 @@ sal_Int32 SelectionManager::getCurrentCursor()
// ------------------------------------------------------------------------
-void SelectionManager::setCursor( sal_Int32 cursor, Window aDropWindow, Time )
+void SelectionManager::setCursor( sal_Int32 cursor, XLIB_Window aDropWindow, XLIB_Time )
{
MutexGuard aGuard( m_aMutex );
- if( aDropWindow == m_aDropWindow && Cursor(cursor) != m_aCurrentCursor )
+ if( aDropWindow == m_aDropWindow && XLIB_Cursor(cursor) != m_aCurrentCursor )
{
if( m_xDragSourceListener.is() && ! m_bDropSent )
{
@@ -3535,7 +3539,7 @@ void SelectionManager::setCursor( sal_Int32 cursor, Window aDropWindow, Time )
// ------------------------------------------------------------------------
-void SelectionManager::setImage( sal_Int32, Window, Time )
+void SelectionManager::setImage( sal_Int32, XLIB_Window, XLIB_Time )
{
}
@@ -3668,7 +3672,7 @@ bool SelectionManager::handleXEvent( XEvent& rEvent )
case MotionNotify:
case ButtonPress:
case ButtonRelease:
- case KeyPress:
+ case XLIB_KeyPress:
case KeyRelease:
bHandled = handleDragEvent( rEvent );
break;
@@ -3734,6 +3738,14 @@ void SelectionManager::run( void* pThis )
timeval aLast;
gettimeofday( &aLast, 0 );
+ Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
+ if( xFact.is() )
+ {
+ Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY );
+ if( xDesktop.is() )
+ xDesktop->addTerminateListener(This);
+ }
+
while( osl_scheduleThread(This->m_aThread) )
{
This->dispatchEvent( 1000 );
@@ -3750,7 +3762,7 @@ void SelectionManager::run( void* pThis )
{
if( it->first != This->m_nXdndSelection && ! it->second->m_bOwner )
{
- Window aOwner = XGetSelectionOwner( This->m_pDisplay, it->first );
+ XLIB_Window aOwner = XGetSelectionOwner( This->m_pDisplay, it->first );
if( aOwner != it->second->m_aLastOwner )
{
it->second->m_aLastOwner = aOwner;
@@ -3774,6 +3786,40 @@ void SelectionManager::run( void* pThis )
#endif
}
+void SelectionManager::shutdown() throw()
+{
+ ResettableMutexGuard aGuard(m_aMutex);
+ // stop dispatching
+ if( m_aThread )
+ {
+ osl_terminateThread( m_aThread );
+ /*
+ * Allow thread to finish before app exits to avoid pulling the carpet
+ * out from under it if pasting is occuring during shutdown
+ *
+ * a) allow it to have the Mutex and
+ * b) reschedule to allow it to complete callbacks to any
+ * Application::GetSolarMutex protected regions, etc. e.g.
+ * TransferableHelper::getTransferDataFlavors (via
+ * SelectionManager::handleSelectionRequest) which it might
+ * currently be trying to enter.
+ *
+ * Otherwise the thread may be left still waiting on a GlobalMutex
+ * when that gets destroyed, letting the thread blow up and die
+ * when enters the section in a now dead OOo instance.
+ */
+ aGuard.clear();
+ while (osl_isThreadRunning(m_aThread))
+ Application::Reschedule();
+ osl_joinWithThread( m_aThread );
+ osl_destroyThread( m_aThread );
+ m_aThread = NULL;
+ aGuard.reset();
+ }
+ m_xDisplayConnection->removeEventHandler( Any(), this );
+ m_xDisplayConnection.clear();
+}
+
// ------------------------------------------------------------------------
sal_Bool SelectionManager::handleEvent( const Any& event ) throw()
@@ -3782,10 +3828,10 @@ sal_Bool SelectionManager::handleEvent( const Any& event ) throw()
if( (event >>= aSeq) )
{
XEvent* pEvent = (XEvent*)aSeq.getArray();
- Time nTimestamp = CurrentTime;
+ XLIB_Time nTimestamp = CurrentTime;
if( pEvent->type == ButtonPress || pEvent->type == ButtonRelease )
nTimestamp = pEvent->xbutton.time;
- else if( pEvent->type == KeyPress || pEvent->type == KeyRelease )
+ else if( pEvent->type == XLIB_KeyPress || pEvent->type == KeyRelease )
nTimestamp = pEvent->xkey.time;
else if( pEvent->type == MotionNotify )
nTimestamp = pEvent->xmotion.time;
@@ -3806,16 +3852,38 @@ sal_Bool SelectionManager::handleEvent( const Any& event ) throw()
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "SelectionManager got downing event\n" );
#endif
- MutexGuard aGuard(m_aMutex);
- // stop dispatching
- if( m_aThread )
- osl_terminateThread( m_aThread );
- m_xDisplayConnection->removeEventHandler( Any(), this );
- m_xDisplayConnection.clear();
+ shutdown();
}
return sal_True;
}
+void SAL_CALL SelectionManager::disposing( const ::com::sun::star::lang::EventObject& )
+ throw( ::com::sun::star::uno::RuntimeException )
+{
+}
+
+void SAL_CALL SelectionManager::queryTermination( const ::com::sun::star::lang::EventObject& )
+ throw( ::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException )
+{
+}
+
+/*
+ * To be safe, shutdown needs to be called before the ~SfxApplication is called, waiting until
+ * the downing event can be too late if paste are requested during shutdown and ~SfxApplication
+ * has been called before vcl is shutdown
+ */
+void SAL_CALL SelectionManager::notifyTermination( const ::com::sun::star::lang::EventObject& rEvent )
+ throw( ::com::sun::star::uno::RuntimeException )
+{
+ Reference< XDesktop > xDesktop( rEvent.Source, UNO_QUERY );
+ if( xDesktop.is() == sal_True )
+ xDesktop->removeTerminateListener( this );
+ #if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "SelectionManager got app termination event\n" );
+ #endif
+ shutdown();
+}
+
// ------------------------------------------------------------------------
void SelectionManager::registerHandler( Atom selection, SelectionAdaptor& rAdaptor )
@@ -3846,12 +3914,12 @@ void SelectionManager::deregisterHandler( Atom selection )
// ------------------------------------------------------------------------
-void SelectionManager::registerDropTarget( Window aWindow, DropTarget* pTarget )
+void SelectionManager::registerDropTarget( XLIB_Window aWindow, DropTarget* pTarget )
{
MutexGuard aGuard(m_aMutex);
// sanity check
- ::std::hash_map< Window, DropTargetEntry >::const_iterator it =
+ ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it =
m_aDropTargets.find( aWindow );
if( it != m_aDropTargets.end() )
OSL_ASSERT( "attempt to register window as drop target twice" );
@@ -3877,7 +3945,7 @@ void SelectionManager::registerDropTarget( Window aWindow, DropTarget* pTarget )
// ------------------------------------------------------------------------
-void SelectionManager::deregisterDropTarget( Window aWindow )
+void SelectionManager::deregisterDropTarget( XLIB_Window aWindow )
{
ClearableMutexGuard aGuard(m_aMutex);
@@ -3885,7 +3953,7 @@ void SelectionManager::deregisterDropTarget( Window aWindow )
if( aWindow == m_aDragSourceWindow && m_aDragRunning.check() )
{
// abort drag
- std::hash_map< Window, DropTargetEntry >::const_iterator it =
+ std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it =
m_aDropTargets.find( m_aDropWindow );
if( it != m_aDropTargets.end() )
{
diff --git a/vcl/unx/source/dtrans/X11_selection.hxx b/vcl/unx/source/dtrans/X11_selection.hxx
index dc6c41247bbd..fa6c310ef8c1 100644
--- a/vcl/unx/source/dtrans/X11_selection.hxx
+++ b/vcl/unx/source/dtrans/X11_selection.hxx
@@ -32,6 +32,7 @@
#define _DTRANS_X11_SELECTION_HXX_
#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/compbase4.hxx>
#include <com/sun/star/datatransfer/XTransferable.hpp>
#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
#include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
@@ -39,6 +40,7 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
#include <osl/thread.h>
#ifndef _OSL_CONDITION_HXX_
@@ -48,7 +50,9 @@
#include <hash_map>
#include <list>
+#include "tools/prex.h"
#include <X11/Xlib.h>
+#include "tools/postx.h"
#define XDND_IMPLEMENTATION_NAME "com.sun.star.datatransfer.dnd.XdndSupport"
#define XDND_DROPTARGET_IMPLEMENTATION_NAME "com.sun.star.datatransfer.dnd.XdndDropTarget"
@@ -84,7 +88,7 @@ namespace x11 {
::osl::Mutex m_aMutex;
bool m_bActive;
sal_Int8 m_nDefaultActions;
- Window m_aTargetWindow;
+ XLIB_Window m_aTargetWindow;
class SelectionManager* m_pSelectionManager;
Reference< ::com::sun::star::datatransfer::dnd::XDragSource >
m_xSelectionManager;
@@ -155,10 +159,11 @@ namespace x11 {
class SelectionManager :
- public ::cppu::WeakImplHelper3<
+ public ::cppu::WeakImplHelper4<
::com::sun::star::datatransfer::dnd::XDragSource,
::com::sun::star::lang::XInitialization,
- ::com::sun::star::awt::XEventHandler
+ ::com::sun::star::awt::XEventHandler,
+ ::com::sun::star::frame::XTerminateListener
>,
public SelectionAdaptor
{
@@ -175,7 +180,7 @@ namespace x11 {
{
Sequence< sal_Int8 > m_aData;
int m_nBufferPos;
- Window m_aRequestor;
+ XLIB_Window m_aRequestor;
Atom m_aProperty;
Atom m_aTarget;
int m_nFormat;
@@ -209,11 +214,11 @@ namespace x11 {
Atom m_aUTF8Type;
bool m_bHaveCompound;
bool m_bOwner;
- Window m_aLastOwner;
+ XLIB_Window m_aLastOwner;
PixmapHolder* m_pPixmap;
- // m_nOrigTimestamp contains the timestamp at which the seclection
- // was acquired; needed for TIMESTAMP target
- Time m_nOrigTimestamp;
+ // m_nOrigXLIB_Timestamp contains the XLIB_Timestamp at which the seclection
+ // was acquired; needed for XLIB_TimeSTAMP target
+ XLIB_Time m_nOrigTimestamp;
Selection() : m_eState( Inactive ),
m_pAdaptor( NULL ),
@@ -234,7 +239,7 @@ namespace x11 {
struct DropTargetEntry
{
DropTarget* m_pTarget;
- Window m_aRootWindow;
+ XLIB_Window m_aRootWindow;
DropTargetEntry() : m_pTarget( NULL ), m_aRootWindow( None ) {}
DropTargetEntry( DropTarget* pTarget ) :
@@ -257,13 +262,13 @@ namespace x11 {
oslThread m_aThread;
oslThread m_aDragExecuteThread;
::osl::Condition m_aDragRunning;
- Window m_aWindow;
+ XLIB_Window m_aWindow;
Reference< ::com::sun::star::awt::XDisplayConnection >
m_xDisplayConnection;
Reference< com::sun::star::script::XInvocation >
m_xBitmapConverter;
sal_Int32 m_nSelectionTimeout;
- Time m_nSelectionTimestamp;
+ XLIB_Time m_nSelectionTimestamp;
// members used for Xdnd
@@ -272,21 +277,21 @@ namespace x11 {
// contains the XdndEnterEvent of a drop action running
// with one of our targets. The data.l[0] member
- // (conatining the drag source window) is set
+ // (conatining the drag source XLIB_Window) is set
// to None while that is not the case
XClientMessageEvent m_aDropEnterEvent;
// set to false on XdndEnter
// set to true on first XdndPosition or XdndLeave
bool m_bDropEnterSent;
- Window m_aCurrentDropWindow;
- // time code of XdndDrop
- Time m_nDropTime;
+ XLIB_Window m_aCurrentDropWindow;
+ // XLIB_Time code of XdndDrop
+ XLIB_Time m_nDropTime;
sal_Int8 m_nLastDropAction;
// XTransferable for Xdnd with foreign drag source
Reference< ::com::sun::star::datatransfer::XTransferable >
m_xDropTransferable;
int m_nLastX, m_nLastY;
- Time m_nDropTimestamp;
+ XLIB_Time m_nDropTimestamp;
// set to true when calling drop()
// if another XdndEnter is received this shows that
// someone forgot to call dropComplete - we should reset
@@ -296,10 +301,10 @@ namespace x11 {
// drag only
// None if no Dnd action is running with us as source
- Window m_aDropWindow;
- // either m_aDropWindow or its XdndProxy
- Window m_aDropProxy;
- Window m_aDragSourceWindow;
+ XLIB_Window m_aDropWindow;
+ // either m_aDropXLIB_Window or its XdndProxy
+ XLIB_Window m_aDropProxy;
+ XLIB_Window m_aDragSourceWindow;
// XTransferable for Xdnd when we are drag source
Reference< ::com::sun::star::datatransfer::XTransferable >
m_xDragSourceTransferable;
@@ -321,20 +326,20 @@ namespace x11 {
bool m_bDropSent;
time_t m_nDropTimeout;
bool m_bWaitingForPrimaryConversion;
- Time m_nDragTimestamp;
+ XLIB_Time m_nDragTimestamp;
// drag cursors
- Cursor m_aMoveCursor;
- Cursor m_aCopyCursor;
- Cursor m_aLinkCursor;
- Cursor m_aNoneCursor;
- Cursor m_aCurrentCursor;
+ XLIB_Cursor m_aMoveCursor;
+ XLIB_Cursor m_aCopyCursor;
+ XLIB_Cursor m_aLinkCursor;
+ XLIB_Cursor m_aNoneCursor;
+ XLIB_Cursor m_aCurrentCursor;
// drag and drop
int m_nCurrentProtocolVersion;
- ::std::hash_map< Window, DropTargetEntry >
+ ::std::hash_map< XLIB_Window, DropTargetEntry >
m_aDropTargets;
@@ -374,7 +379,7 @@ namespace x11 {
::std::hash_map< Atom, Selection* >
m_aSelections;
// IncrementalTransfers in progress
- std::hash_map< Window, std::hash_map< Atom, IncrementalTransfer > >
+ std::hash_map< XLIB_Window, std::hash_map< Atom, IncrementalTransfer > >
m_aIncrementals;
// do not use X11 multithreading capabilities
@@ -398,12 +403,12 @@ namespace x11 {
// dnd helpers
void sendDragStatus( Atom nDropAction );
- void sendDropPosition( bool bForce, Time eventTime );
+ void sendDropPosition( bool bForce, XLIB_Time eventXLIB_Time );
bool updateDragAction( int modifierState );
- int getXdndVersion( Window aWindow, Window& rProxy );
- Cursor createCursor( const char* pPointerData, const char* pMaskData, int width, int height, int hotX, int hotY );
- // coordinates on root window
- void updateDragWindow( int nX, int nY, Window aRoot );
+ int getXdndVersion( XLIB_Window aXLIB_Window, XLIB_Window& rProxy );
+ XLIB_Cursor createCursor( const char* pPointerData, const char* pMaskData, int width, int height, int hotX, int hotY );
+ // coordinates on root XLIB_Window
+ void updateDragWindow( int nX, int nY, XLIB_Window aRoot );
bool getPasteData( Atom selection, Atom type, Sequence< sal_Int8 >& rData );
// returns true if conversion was successful
@@ -412,7 +417,7 @@ namespace x11 {
Atom nSelection,
int & rFormat,
Sequence< sal_Int8 >& rData );
- bool sendData( SelectionAdaptor* pAdaptor, Window requestor, Atom target, Atom property, Atom selection );
+ bool sendData( SelectionAdaptor* pAdaptor, XLIB_Window requestor, Atom target, Atom property, Atom selection );
// thread dispatch loop
public:
@@ -438,7 +443,7 @@ namespace x11 {
static SelectionManager& get( const ::rtl::OUString& rDisplayName = ::rtl::OUString() );
Display * getDisplay() { return m_pDisplay; };
- Window getWindow() { return m_aWindow; };
+ XLIB_Window getWindow() { return m_aWindow; };
void registerHandler( Atom selection, SelectionAdaptor& rAdaptor );
@@ -464,20 +469,22 @@ namespace x11 {
bool getPasteData( Atom selection, const ::rtl::OUString& rType, Sequence< sal_Int8 >& rData );
// for XDropTarget to register/deregister itself
- void registerDropTarget( Window aWindow, DropTarget* pTarget );
- void deregisterDropTarget( Window aWindow );
+ void registerDropTarget( XLIB_Window aXLIB_Window, DropTarget* pTarget );
+ void deregisterDropTarget( XLIB_Window aXLIB_Window );
// for XDropTarget{Drag|Drop}Context
- void accept( sal_Int8 dragOperation, Window aDropWindow, Time aTimestamp );
- void reject( Window aDropWindow, Time aTimestamp );
- void dropComplete( sal_Bool success, Window aDropWindow, Time aTimestamp );
+ void accept( sal_Int8 dragOperation, XLIB_Window aDropXLIB_Window, XLIB_Time aXLIB_Timestamp );
+ void reject( XLIB_Window aDropXLIB_Window, XLIB_Time aXLIB_Timestamp );
+ void dropComplete( sal_Bool success, XLIB_Window aDropXLIB_Window, XLIB_Time aXLIB_Timestamp );
// for XDragSourceContext
sal_Int32 getCurrentCursor();
- void setCursor( sal_Int32 cursor, Window aDropWindow, Time aTimestamp );
- void setImage( sal_Int32 image, Window aDropWindow, Time aTimestamp );
+ void setCursor( sal_Int32 cursor, XLIB_Window aDropXLIB_Window, XLIB_Time aXLIB_Timestamp );
+ void setImage( sal_Int32 image, XLIB_Window aDropXLIB_Window, XLIB_Time aXLIB_Timestamp );
void transferablesFlavorsChanged();
+ void shutdown() throw();
+
// XInitialization
virtual void SAL_CALL initialize( const Sequence< Any >& arguments ) throw( ::com::sun::star::uno::Exception );
@@ -499,6 +506,15 @@ namespace x11 {
virtual void clearTransferable() throw();
virtual void fireContentsChanged() throw();
virtual Reference< XInterface > getReference() throw();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent )
+ throw( ::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent )
+ throw( ::com::sun::star::uno::RuntimeException );
};
// ------------------------------------------------------------------------
diff --git a/vcl/unx/source/dtrans/bmp.cxx b/vcl/unx/source/dtrans/bmp.cxx
index 49219bfb0e2a..f3c7d78617a6 100644
--- a/vcl/unx/source/dtrans/bmp.cxx
+++ b/vcl/unx/source/dtrans/bmp.cxx
@@ -356,7 +356,7 @@ sal_uInt8* x11::X11_getBmpFromPixmap(
)
{
// get geometry of drawable
- Window aRoot;
+ XLIB_Window aRoot;
int x,y;
unsigned int w, h, bw, d;
XGetGeometry( pDisplay, aDrawable, &aRoot, &x, &y, &w, &h, &bw, &d );
diff --git a/vcl/unx/source/dtrans/bmp.hxx b/vcl/unx/source/dtrans/bmp.hxx
index baf04ac31d90..6331122e726d 100644
--- a/vcl/unx/source/dtrans/bmp.hxx
+++ b/vcl/unx/source/dtrans/bmp.hxx
@@ -31,10 +31,12 @@
#ifndef _DTRANS_BMP_HXX_
#define _DTRANS_BMP_HXX_
+#include "tools/prex.h"
#include <X11/Xatom.h>
#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "tools/postx.h"
#include <sal/types.h>
#include <com/sun/star/awt/XBitmap.hpp>
diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx
index 2cf4e3baedd3..4dc9a0b6a455 100644
--- a/vcl/unx/source/gdi/salprnpsp.cxx
+++ b/vcl/unx/source/gdi/salprnpsp.cxx
@@ -177,6 +177,32 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
pJobSetup->mnPaperBin = 0;
}
+ // copy duplex
+ pKey = NULL;
+ pValue = NULL;
+
+ pJobSetup->meDuplexMode = DUPLEX_UNKNOWN;
+ if( rData.m_pParser )
+ pKey = rData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
+ if( pKey )
+ pValue = rData.m_aContext.getValue( pKey );
+ if( pKey && pValue )
+ {
+ if( pValue->m_aOption.EqualsIgnoreCaseAscii( "None" ) ||
+ pValue->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 )
+ )
+ {
+ pJobSetup->meDuplexMode = DUPLEX_OFF;
+ }
+ else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexNoTumble" ) )
+ {
+ pJobSetup->meDuplexMode = DUPLEX_LONGEDGE;
+ }
+ else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexTumble" ) )
+ {
+ pJobSetup->meDuplexMode = DUPLEX_SHORTEDGE;
+ }
+ }
// copy the whole context
if( pJobSetup->mpDriverData )
@@ -525,34 +551,6 @@ void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
// -----------------------------------------------------------------------
-DuplexMode PspSalInfoPrinter::GetDuplexMode( const ImplJobSetup* pJobSetup )
-{
- DuplexMode aRet = DUPLEX_UNKNOWN;
- PrinterInfo aInfo( PrinterInfoManager::get().getPrinterInfo( pJobSetup->maPrinterName ) );
- if ( pJobSetup->mpDriverData )
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aInfo );
- if( aInfo.m_pParser )
- {
- const PPDKey * pKey = aInfo.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
- if( pKey )
- {
- const PPDValue* pVal = aInfo.m_aContext.getValue( pKey );
- if( pVal && (
- pVal->m_aOption.EqualsIgnoreCaseAscii( "None" ) ||
- pVal->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 )
- ) )
- {
- aRet = DUPLEX_OFF;
- }
- else
- aRet = DUPLEX_ON;
- }
- }
- return aRet;
-}
-
-// -----------------------------------------------------------------------
-
int PspSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* )
{
return 900;
@@ -727,6 +725,37 @@ BOOL PspSalInfoPrinter::SetData(
if( nSetDataFlags & SAL_JOBSET_ORIENTATION )
aData.m_eOrientation = pJobSetup->meOrientation == ORIENTATION_LANDSCAPE ? orientation::Landscape : orientation::Portrait;
+ // merge duplex if necessary
+ if( nSetDataFlags & SAL_JOBSET_DUPLEXMODE )
+ {
+ pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
+ if( pKey )
+ {
+ pValue = NULL;
+ switch( pJobSetup->meDuplexMode )
+ {
+ case DUPLEX_OFF:
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
+ if( pValue == NULL )
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "SimplexNoTumble" ) ) );
+ break;
+ case DUPLEX_SHORTEDGE:
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexTumble" ) ) );
+ break;
+ case DUPLEX_LONGEDGE:
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexNoTumble" ) ) );
+ break;
+ case DUPLEX_UNKNOWN:
+ default:
+ pValue = 0;
+ break;
+ }
+ if( ! pValue )
+ pValue = pKey->getDefaultValue();
+ aData.m_aContext.setValue( pKey, pValue );
+ }
+ }
+
m_aJobData = aData;
copyJobDataToJobSetup( pJobSetup, aData );
return TRUE;
@@ -810,7 +839,7 @@ String PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, ULONG
{
const PPDValue* pValue = pKey->getValue( nPaperBin );
if( pValue )
- aRet = pValue->m_aOptionTranslation.Len() ? pValue->m_aOptionTranslation : pValue->m_aOption;
+ aRet = aData.m_pParser->translateOption( pKey->getKey(), pValue->m_aOption );
}
}
@@ -828,9 +857,22 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT
case PRINTER_CAPABILITIES_COPIES:
return 0xffff;
case PRINTER_CAPABILITIES_COLLATECOPIES:
- return 0;
+ {
+ // see if the PPD contains a value to set Collate to True
+ JobData aData;
+ JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
+
+ const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) ) : NULL;
+ const PPDValue* pVal = pKey ? pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "True" ) ) ) : NULL;
+
+ // PPDs don't mention the number of possible collated copies.
+ // so let's guess as many as we want ?
+ return pVal ? 0xffff : 0;
+ }
case PRINTER_CAPABILITIES_SETORIENTATION:
return 1;
+ case PRINTER_CAPABILITIES_SETDUPLEX:
+ return 1;
case PRINTER_CAPABILITIES_SETPAPERBIN:
return 1;
case PRINTER_CAPABILITIES_SETPAPERSIZE:
@@ -860,6 +902,7 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT
m_bSwallowFaxNo( false ),
m_pGraphics( NULL ),
m_nCopies( 1 ),
+ m_bCollate( false ),
m_pInfoPrinter( pInfoPrinter )
{
}
@@ -885,7 +928,9 @@ BOOL PspSalPrinter::StartJob(
const XubString* pFileName,
const XubString& rJobName,
const XubString& rAppName,
- ULONG nCopies, BOOL /*bCollate*/,
+ ULONG nCopies,
+ bool bCollate,
+ bool bDirect,
ImplJobSetup* pJobSetup )
{
vcl_sal::PrinterUpdate::jobStarted();
@@ -894,13 +939,17 @@ BOOL PspSalPrinter::StartJob(
m_bPdf = false;
m_aFileName = pFileName ? *pFileName : String();
m_aTmpFile = String();
- m_nCopies = nCopies;
+ m_nCopies = nCopies;
+ m_bCollate = bCollate;
JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData );
if( m_nCopies > 1 )
+ {
// in case user did not do anything (m_nCopies=1)
// take the default from jobsetup
m_aJobData.m_nCopies = m_nCopies;
+ m_aJobData.setCollate( bCollate );
+ }
// check wether this printer is configured as fax
int nMode = 0;
@@ -943,15 +992,6 @@ BOOL PspSalPrinter::StartJob(
}
m_aPrinterGfx.Init( m_aJobData );
- bool bIsQuickJob = false;
- std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator quick_it =
- pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ) );
- if( quick_it != pJobSetup->maValueMap.end() )
- {
- if( quick_it->second.equalsIgnoreAsciiCaseAscii( "true" ) )
- bIsQuickJob = true;
- }
-
// set/clear backwards compatibility flag
bool bStrictSO52Compatibility = false;
std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
@@ -964,7 +1004,7 @@ BOOL PspSalPrinter::StartJob(
}
m_aPrinterGfx.setStrictSO52Compatibility( bStrictSO52Compatibility );
- return m_aPrintJob.StartJob( m_aTmpFile.Len() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bIsQuickJob ) ? TRUE : FALSE;
+ return m_aPrintJob.StartJob( m_aTmpFile.Len() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bDirect ) ? TRUE : FALSE;
}
// -----------------------------------------------------------------------
@@ -1010,9 +1050,12 @@ SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, BOOL )
m_pGraphics = new PspGraphics( &m_aJobData, &m_aPrinterGfx, m_bFax ? &m_aFaxNr : NULL, m_bSwallowFaxNo, m_pInfoPrinter );
m_pGraphics->SetLayout( 0 );
if( m_nCopies > 1 )
+ {
// in case user did not do anything (m_nCopies=1)
// take the default from jobsetup
m_aJobData.m_nCopies = m_nCopies;
+ m_aJobData.setCollate( m_nCopies > 1 && m_bCollate );
+ }
m_aPrintJob.StartPage( m_aJobData );
m_aPrinterGfx.Init( m_aPrintJob );
diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx
index f1c63b8abee7..08820b2cb7f9 100644
--- a/vcl/unx/source/plugadapt/salplug.cxx
+++ b/vcl/unx/source/plugadapt/salplug.cxx
@@ -219,8 +219,10 @@ SalInstance *CreateSalInstance()
if( !(pUsePlugin && *pUsePlugin) )
pInst = check_headless_plugin();
+ else
+ pInst = tryInstance( OUString::createFromAscii( pUsePlugin ) );
- if( ! pInst && !(pUsePlugin && *pUsePlugin) )
+ if( ! pInst )
pInst = autodetect_plugin();
// fallback to gen
diff --git a/vcl/unx/source/printer/cupsmgr.cxx b/vcl/unx/source/printer/cupsmgr.cxx
index d0c7f184fb06..4c38479f1107 100644
--- a/vcl/unx/source/printer/cupsmgr.cxx
+++ b/vcl/unx/source/printer/cupsmgr.cxx
@@ -533,6 +533,10 @@ void CUPSManager::initialize()
pDest->options );
if( pOpt )
m_bUseIncludeFeature = true;
+ // do not send include JobPatch; CUPS will insert that itself
+ // TODO: currently unknwon which versions of CUPS insert JobPatches
+ // so currently it is assumed CUPS = don't insert JobPatch files
+ m_bUseJobPatch = false;
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
int nPrinter = m_nDests;
diff --git a/vcl/unx/source/printer/jobdata.cxx b/vcl/unx/source/printer/jobdata.cxx
index 51e171d578d9..0410b349c93b 100644
--- a/vcl/unx/source/printer/jobdata.cxx
+++ b/vcl/unx/source/printer/jobdata.cxx
@@ -64,6 +64,28 @@ JobData& JobData::operator=(const JobData& rRight)
return *this;
}
+void JobData::setCollate( bool bCollate )
+{
+ const PPDParser* pParser = m_aContext.getParser();
+ if( pParser )
+ {
+ const PPDKey* pKey = pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) );
+ if( pKey )
+ {
+ const PPDValue* pVal = NULL;
+ if( bCollate )
+ pVal = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "True" ) ) );
+ else
+ {
+ pVal = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "False" ) ) );
+ if( ! pVal )
+ pVal = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
+ }
+ m_aContext.setValue( pKey, pVal );
+ }
+ }
+}
+
bool JobData::getStreamBuffer( void*& pData, int& bytes )
{
// consistency checks
diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx
index 95bc7bca41ca..a70a5ac7f6c8 100644
--- a/vcl/unx/source/printer/ppdparser.cxx
+++ b/vcl/unx/source/printer/ppdparser.cxx
@@ -39,6 +39,7 @@
#include "vcl/ppdparser.hxx"
#include "vcl/strhelper.hxx"
#include "vcl/helper.hxx"
+#include "vcl/svapp.hxx"
#include "cupsmgr.hxx"
#include "tools/debug.hxx"
#include "tools/urlobj.hxx"
@@ -51,6 +52,202 @@
#include "rtl/strbuf.hxx"
#include "rtl/ustrbuf.hxx"
+#include "com/sun/star/lang/Locale.hpp"
+
+namespace psp
+{
+ class PPDTranslator
+ {
+ struct LocaleEqual
+ {
+ bool operator()(const com::sun::star::lang::Locale& i_rLeft,
+ const com::sun::star::lang::Locale& i_rRight) const
+ {
+ return i_rLeft.Language.equals( i_rRight.Language ) &&
+ i_rLeft.Country.equals( i_rRight.Country ) &&
+ i_rLeft.Variant.equals( i_rRight.Variant );
+ }
+ };
+
+ struct LocaleHash
+ {
+ size_t operator()(const com::sun::star::lang::Locale& rLocale) const
+ { return
+ (size_t)rLocale.Language.hashCode()
+ ^ (size_t)rLocale.Country.hashCode()
+ ^ (size_t)rLocale.Variant.hashCode()
+ ;
+ }
+ };
+
+ typedef std::hash_map< com::sun::star::lang::Locale, rtl::OUString, LocaleHash, LocaleEqual > translation_map;
+ typedef std::hash_map< rtl::OUString, translation_map, rtl::OUStringHash > key_translation_map;
+
+ key_translation_map m_aTranslations;
+ public:
+ PPDTranslator() {}
+ ~PPDTranslator() {}
+
+
+ void insertValue(
+ const rtl::OUString& i_rKey,
+ const rtl::OUString& i_rOption,
+ const rtl::OUString& i_rValue,
+ const rtl::OUString& i_rTranslation,
+ const com::sun::star::lang::Locale& i_rLocale = com::sun::star::lang::Locale()
+ );
+
+ void insertOption( const rtl::OUString& i_rKey,
+ const rtl::OUString& i_rOption,
+ const rtl::OUString& i_rTranslation,
+ const com::sun::star::lang::Locale& i_rLocale = com::sun::star::lang::Locale() )
+ {
+ insertValue( i_rKey, i_rOption, rtl::OUString(), i_rTranslation, i_rLocale );
+ }
+
+ void insertKey( const rtl::OUString& i_rKey,
+ const rtl::OUString& i_rTranslation,
+ const com::sun::star::lang::Locale& i_rLocale = com::sun::star::lang::Locale() )
+ {
+ insertValue( i_rKey, rtl::OUString(), rtl::OUString(), i_rTranslation, i_rLocale );
+ }
+
+ rtl::OUString translateValue(
+ const rtl::OUString& i_rKey,
+ const rtl::OUString& i_rOption,
+ const rtl::OUString& i_rValue,
+ const com::sun::star::lang::Locale& i_rLocale = com::sun::star::lang::Locale()
+ ) const;
+
+ rtl::OUString translateOption( const rtl::OUString& i_rKey,
+ const rtl::OUString& i_rOption,
+ const com::sun::star::lang::Locale& i_rLocale = com::sun::star::lang::Locale() ) const
+ {
+ return translateValue( i_rKey, i_rOption, rtl::OUString(), i_rLocale );
+ }
+
+ rtl::OUString translateKey( const rtl::OUString& i_rKey,
+ const com::sun::star::lang::Locale& i_rLocale = com::sun::star::lang::Locale() ) const
+ {
+ return translateValue( i_rKey, rtl::OUString(), rtl::OUString(), i_rLocale );
+ }
+ };
+
+ static com::sun::star::lang::Locale normalizeInputLocale(
+ const com::sun::star::lang::Locale& i_rLocale,
+ bool bInsertDefault = false
+ )
+ {
+ com::sun::star::lang::Locale aLoc( i_rLocale );
+ if( bInsertDefault && aLoc.Language.getLength() == 0 )
+ {
+ // empty locale requested, fill in application UI locale
+ aLoc = Application::GetSettings().GetUILocale();
+
+ #if OSL_DEBUG_LEVEL > 1
+ static const char* pEnvLocale = getenv( "SAL_PPDPARSER_LOCALE" );
+ if( pEnvLocale && *pEnvLocale )
+ {
+ rtl::OString aStr( pEnvLocale );
+ sal_Int32 nLen = aStr.getLength();
+ aLoc.Language = rtl::OStringToOUString( aStr.copy( 0, nLen > 2 ? 2 : nLen ), RTL_TEXTENCODING_MS_1252 );
+ if( nLen >=5 && aStr.getStr()[2] == '_' )
+ aLoc.Country = rtl::OStringToOUString( aStr.copy( 3, 2 ), RTL_TEXTENCODING_MS_1252 );
+ else
+ aLoc.Country = rtl::OUString();
+ aLoc.Variant = rtl::OUString();
+ }
+ #endif
+ }
+ aLoc.Language = aLoc.Language.toAsciiLowerCase();
+ aLoc.Country = aLoc.Country.toAsciiUpperCase();
+ aLoc.Variant = aLoc.Variant.toAsciiUpperCase();
+
+ return aLoc;
+ }
+
+ void PPDTranslator::insertValue(
+ const rtl::OUString& i_rKey,
+ const rtl::OUString& i_rOption,
+ const rtl::OUString& i_rValue,
+ const rtl::OUString& i_rTranslation,
+ const com::sun::star::lang::Locale& i_rLocale
+ )
+ {
+ rtl::OUStringBuffer aKey( i_rKey.getLength() + i_rOption.getLength() + i_rValue.getLength() + 2 );
+ aKey.append( i_rKey );
+ if( i_rOption.getLength() || i_rValue.getLength() )
+ {
+ aKey.append( sal_Unicode( ':' ) );
+ aKey.append( i_rOption );
+ }
+ if( i_rValue.getLength() )
+ {
+ aKey.append( sal_Unicode( ':' ) );
+ aKey.append( i_rValue );
+ }
+ if( aKey.getLength() && i_rTranslation.getLength() )
+ {
+ rtl::OUString aK( aKey.makeStringAndClear() );
+ com::sun::star::lang::Locale aLoc;
+ aLoc.Language = i_rLocale.Language.toAsciiLowerCase();
+ aLoc.Country = i_rLocale.Country.toAsciiUpperCase();
+ aLoc.Variant = i_rLocale.Variant.toAsciiUpperCase();
+ m_aTranslations[ aK ][ aLoc ] = i_rTranslation;
+ }
+ }
+
+ rtl::OUString PPDTranslator::translateValue(
+ const rtl::OUString& i_rKey,
+ const rtl::OUString& i_rOption,
+ const rtl::OUString& i_rValue,
+ const com::sun::star::lang::Locale& i_rLocale
+ ) const
+ {
+ rtl::OUString aResult;
+
+ rtl::OUStringBuffer aKey( i_rKey.getLength() + i_rOption.getLength() + i_rValue.getLength() + 2 );
+ aKey.append( i_rKey );
+ if( i_rOption.getLength() || i_rValue.getLength() )
+ {
+ aKey.append( sal_Unicode( ':' ) );
+ aKey.append( i_rOption );
+ }
+ if( i_rValue.getLength() )
+ {
+ aKey.append( sal_Unicode( ':' ) );
+ aKey.append( i_rValue );
+ }
+ if( aKey.getLength() )
+ {
+ rtl::OUString aK( aKey.makeStringAndClear() );
+ key_translation_map::const_iterator it = m_aTranslations.find( aK );
+ if( it != m_aTranslations.end() )
+ {
+ const translation_map& rMap( it->second );
+
+ com::sun::star::lang::Locale aLoc( normalizeInputLocale( i_rLocale, true ) );
+ for( int nTry = 0; nTry < 4; nTry++ )
+ {
+ translation_map::const_iterator tr = rMap.find( aLoc );
+ if( tr != rMap.end() )
+ {
+ aResult = tr->second;
+ break;
+ }
+ switch( nTry )
+ {
+ case 0: aLoc.Variant = rtl::OUString();break;
+ case 1: aLoc.Country = rtl::OUString();break;
+ case 2: aLoc.Language = rtl::OUString();break;
+ }
+ }
+ }
+ }
+ return aResult;
+ }
+}
+
using namespace psp;
using namespace rtl;
@@ -481,7 +678,8 @@ PPDParser::PPDParser( const String& rFile ) :
m_pResolutions( NULL ),
m_pDefaultDuplexType( NULL ),
m_pDuplexTypes( NULL ),
- m_pFontList( NULL )
+ m_pFontList( NULL ),
+ m_pTranslator( new PPDTranslator() )
{
// read in the file
std::list< ByteString > aLines;
@@ -648,6 +846,7 @@ PPDParser::~PPDParser()
{
for( PPDParser::hash_type::iterator it = m_aKeys.begin(); it != m_aKeys.end(); ++it )
delete it->second;
+ delete m_pTranslator;
}
void PPDParser::insertKey( const String& rKey, PPDKey* pKey )
@@ -687,11 +886,11 @@ static sal_uInt8 getNibble( sal_Char cChar )
return nRet;
}
-String PPDParser::handleTranslation( const ByteString& rString )
+String PPDParser::handleTranslation( const ByteString& i_rString, bool bIsGlobalized )
{
- int nOrigLen = rString.Len();
+ int nOrigLen = i_rString.Len();
OStringBuffer aTrans( nOrigLen );
- const sal_Char* pStr = rString.GetBuffer();
+ const sal_Char* pStr = i_rString.GetBuffer();
const sal_Char* pEnd = pStr + nOrigLen;
while( pStr < pEnd )
{
@@ -710,14 +909,11 @@ String PPDParser::handleTranslation( const ByteString& rString )
else
aTrans.append( *pStr++ );
}
- return OStringToOUString( aTrans.makeStringAndClear(), m_aFileEncoding );
+ return OStringToOUString( aTrans.makeStringAndClear(), bIsGlobalized ? RTL_TEXTENCODING_UTF8 : m_aFileEncoding );
}
void PPDParser::parse( ::std::list< ByteString >& rLines )
{
- PPDValue* pValue = NULL;
- PPDKey* pKey = NULL;
-
std::list< ByteString >::iterator line = rLines.begin();
PPDParser::hash_type::const_iterator keyit;
while( line != rLines.end() )
@@ -765,14 +961,25 @@ void PPDParser::parse( ::std::list< ByteString >& rLines )
}
String aUniKey( aKey, RTL_TEXTENCODING_MS_1252 );
- keyit = m_aKeys.find( aUniKey );
- if( keyit == m_aKeys.end() )
+ // handle CUPS extension for globalized PPDs
+ bool bIsGlobalizedLine = false;
+ com::sun::star::lang::Locale aTransLocale;
+ if( ( aUniKey.Len() > 3 && aUniKey.GetChar( 2 ) == '.' ) ||
+ ( aUniKey.Len() > 5 && aUniKey.GetChar( 2 ) == '_' && aUniKey.GetChar( 5 ) == '.' ) )
{
- pKey = new PPDKey( aUniKey );
- insertKey( aUniKey, pKey );
+ if( aUniKey.GetChar( 2 ) == '.' )
+ {
+ aTransLocale.Language = aUniKey.Copy( 0, 2 );
+ aUniKey = aUniKey.Copy( 3 );
+ }
+ else
+ {
+ aTransLocale.Language = aUniKey.Copy( 0, 2 );
+ aTransLocale.Country = aUniKey.Copy( 3, 2 );
+ aUniKey = aUniKey.Copy( 6 );
+ }
+ bIsGlobalizedLine = true;
}
- else
- pKey = keyit->second;
String aOption;
nPos = aCurrentLine.Search( ':' );
@@ -784,76 +991,125 @@ void PPDParser::parse( ::std::list< ByteString >& rLines )
if( nTransPos != STRING_NOTFOUND )
aOption.Erase( nTransPos );
}
- pValue = pKey->insertValue( aOption );
- if( ! pValue )
- continue;
- if( nPos == STRING_NOTFOUND )
+ PPDValueType eType = eNo;
+ String aValue;
+ rtl::OUString aOptionTranslation;
+ rtl::OUString aValueTranslation;
+ if( nPos != STRING_NOTFOUND )
{
- // have a single main keyword
- pValue->m_eType = eNo;
- if( bQuery )
- pKey->eraseValue( aOption );
- continue;
- }
+ // found a colon, there may be an option
+ ByteString aLine = aCurrentLine.Copy( 1, nPos-1 );
+ aLine = WhitespaceToSpace( aLine );
+ int nTransPos = aLine.Search( '/' );
+ if( nTransPos != STRING_NOTFOUND )
+ aOptionTranslation = handleTranslation( aLine.Copy( nTransPos+1 ), bIsGlobalizedLine );
- // found a colon, there may be an option
- ByteString aLine = aCurrentLine.Copy( 1, nPos-1 );
- aLine = WhitespaceToSpace( aLine );
- int nTransPos = aLine.Search( '/' );
- if( nTransPos != STRING_NOTFOUND )
- pValue->m_aOptionTranslation = handleTranslation( aLine.Copy( nTransPos+1 ) );
-
- // read in more lines if necessary for multiline values
- aLine = aCurrentLine.Copy( nPos+1 );
- while( ! ( aLine.GetTokenCount( '"' ) & 1 ) &&
- line != rLines.end() )
- // while there is an even number of tokens; that m_eans
- // an odd number of doubleqoutes
- {
- // copy the newlines also
- aLine += '\n';
- aLine += *line;
- ++line;
+ // read in more lines if necessary for multiline values
+ aLine = aCurrentLine.Copy( nPos+1 );
+ if( aLine.Len() )
+ {
+ while( ! ( aLine.GetTokenCount( '"' ) & 1 ) &&
+ line != rLines.end() )
+ // while there is an even number of tokens; that means
+ // an odd number of doubleqoutes
+ {
+ // copy the newlines also
+ aLine += '\n';
+ aLine += *line;
+ ++line;
+ }
+ }
+ aLine = WhitespaceToSpace( aLine );
+
+ // #i100644# handle a missing value (actually a broken PPD)
+ if( ! aLine.Len() )
+ {
+ if( aOption.Len() &&
+ aUniKey.CompareToAscii( "JCL", 3 ) != COMPARE_EQUAL )
+ eType = eInvocation;
+ else
+ eType = eQuoted;
+ }
+ // check for invocation or quoted value
+ else if( aLine.GetChar(0) == '"' )
+ {
+ aLine.Erase( 0, 1 );
+ nTransPos = aLine.Search( '"' );
+ aValue = String( aLine.Copy( 0, nTransPos ), RTL_TEXTENCODING_MS_1252 );
+ // after the second doublequote can follow a / and a translation
+ aValueTranslation = handleTranslation( aLine.Copy( nTransPos+2 ), bIsGlobalizedLine );
+ // check for quoted value
+ if( aOption.Len() &&
+ aUniKey.CompareToAscii( "JCL", 3 ) != COMPARE_EQUAL )
+ eType = eInvocation;
+ else
+ eType = eQuoted;
+ }
+ // check for symbol value
+ else if( aLine.GetChar(0) == '^' )
+ {
+ aLine.Erase( 0, 1 );
+ aValue = String( aLine, RTL_TEXTENCODING_MS_1252 );
+ eType = eSymbol;
+ }
+ else
+ {
+ // must be a string value then
+ // strictly this is false because string values
+ // can contain any whitespace which is reduced
+ // to one space by now
+ // who cares ...
+ nTransPos = aLine.Search( '/' );
+ if( nTransPos == STRING_NOTFOUND )
+ nTransPos = aLine.Len();
+ aValue = String( aLine.Copy( 0, nTransPos ), RTL_TEXTENCODING_MS_1252 );
+ aValueTranslation = handleTranslation( aLine.Copy( nTransPos+1 ), bIsGlobalizedLine );
+ eType = eString;
+ }
}
- aLine = WhitespaceToSpace( aLine );
- // check for invocation or quoted value
- if( aLine.GetChar(0) == '"' )
+ // handle globalized PPD entries
+ if( bIsGlobalizedLine )
{
- aLine.Erase( 0, 1 );
- nTransPos = aLine.Search( '"' );
- pValue->m_aValue = String( aLine.Copy( 0, nTransPos ), RTL_TEXTENCODING_MS_1252 );
- // after the second doublequote can follow a / and a translation
- pValue->m_aValueTranslation = handleTranslation( aLine.Copy( nTransPos+2 ) );
- // check for quoted value
- if( pValue->m_aOption.Len() &&
- aKey.CompareTo( "JCL", 3 ) != COMPARE_EQUAL )
- pValue->m_eType = eInvocation;
+ // handle main key translations of form:
+ // *ll_CC.Translation MainKeyword/translated text: ""
+ if( aUniKey.EqualsAscii( "Translation" ) )
+ {
+ m_pTranslator->insertKey( aOption, aOptionTranslation, aTransLocale );
+ }
+ // handle options translations of for:
+ // *ll_CC.MainKeyword OptionKeyword/translated text: ""
else
- pValue->m_eType = eQuoted;
+ {
+ m_pTranslator->insertOption( aUniKey, aOption, aOptionTranslation, aTransLocale );
+ }
+ continue;
}
- // check for symbol value
- else if( aLine.GetChar(0) == '^' )
+
+ PPDKey* pKey = NULL;
+ keyit = m_aKeys.find( aUniKey );
+ if( keyit == m_aKeys.end() )
{
- aLine.Erase( 0, 1 );
- pValue->m_aValue = String( aLine, RTL_TEXTENCODING_MS_1252 );
- pValue->m_eType = eSymbol;
+ pKey = new PPDKey( aUniKey );
+ insertKey( aUniKey, pKey );
}
else
- {
- // must be a string value then
- // strictly this is false because string values
- // can contain any whitespace which is reduced
- // to one space by now
- // who cares ...
- nTransPos = aLine.Search( '/' );
- if( nTransPos == STRING_NOTFOUND )
- nTransPos = aLine.Len();
- pValue->m_aValue = String( aLine.Copy( 0, nTransPos ), RTL_TEXTENCODING_MS_1252 );
- pValue->m_aValueTranslation = handleTranslation( aLine.Copy( nTransPos+1 ) );
- pValue->m_eType = eString;
- }
+ pKey = keyit->second;
+
+ if( eType == eNo && bQuery )
+ continue;
+
+ PPDValue* pValue = pKey->insertValue( aOption );
+ if( ! pValue )
+ continue;
+ pValue->m_eType = eType;
+ pValue->m_aValue = aValue;
+
+ if( aOptionTranslation.getLength() )
+ m_pTranslator->insertOption( aUniKey, aOption, aOptionTranslation, aTransLocale );
+ if( aValueTranslation.getLength() )
+ m_pTranslator->insertValue( aUniKey, aOption, aValue, aValueTranslation, aTransLocale );
// eventually update query and remove from option list
if( bQuery && pKey->m_bQueryValue == FALSE )
@@ -879,7 +1135,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines )
keyit = m_aKeys.find( aKey );
if( keyit != m_aKeys.end() )
{
- pKey = keyit->second;
+ PPDKey* pKey = keyit->second;
const PPDValue* pDefValue = pKey->getValue( aOption );
if( pKey->m_pDefaultValue == NULL )
pKey->m_pDefaultValue = pDefValue;
@@ -890,7 +1146,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines )
// do not exist otherwise
// (example: DefaultResolution)
// so invent that key here and have a default value
- pKey = new PPDKey( aKey );
+ PPDKey* pKey = new PPDKey( aKey );
PPDValue* pNewValue = pKey->insertValue( aOption );
pNewValue->m_eType = eInvocation; // or what ?
insertKey( aKey, pKey );
@@ -915,7 +1171,7 @@ void PPDParser::parseOpenUI( const ByteString& rLine )
nPos = aKey.Search( '/' );
if( nPos != STRING_NOTFOUND )
{
- aTranslation = handleTranslation( aKey.Copy( nPos + 1 ) );
+ aTranslation = handleTranslation( aKey.Copy( nPos + 1 ), false );
aKey.Erase( nPos );
}
aKey = GetCommandLineToken( 1, aKey );
@@ -933,7 +1189,7 @@ void PPDParser::parseOpenUI( const ByteString& rLine )
pKey = keyit->second;
pKey->m_bUIOption = true;
- pKey->m_aUITranslation = aTranslation;
+ m_pTranslator->insertKey( pKey->getKey(), aTranslation );
ByteString aValue = WhitespaceToSpace( rLine.GetToken( 1, ':' ) );
if( aValue.CompareIgnoreCaseToAscii( "boolean" ) == COMPARE_EQUAL )
@@ -1393,6 +1649,36 @@ const String& PPDParser::getFont( int nFont ) const
return aEmptyString;
}
+rtl::OUString PPDParser::translateKey( const rtl::OUString& i_rKey,
+ const com::sun::star::lang::Locale& i_rLocale ) const
+{
+ rtl::OUString aResult( m_pTranslator->translateKey( i_rKey, i_rLocale ) );
+ if( aResult.getLength() == 0 )
+ aResult = i_rKey;
+ return aResult;
+}
+
+rtl::OUString PPDParser::translateOption( const rtl::OUString& i_rKey,
+ const rtl::OUString& i_rOption,
+ const com::sun::star::lang::Locale& i_rLocale ) const
+{
+ rtl::OUString aResult( m_pTranslator->translateOption( i_rKey, i_rOption, i_rLocale ) );
+ if( aResult.getLength() == 0 )
+ aResult = i_rOption;
+ return aResult;
+}
+
+rtl::OUString PPDParser::translateValue( const rtl::OUString& i_rKey,
+ const rtl::OUString& i_rOption,
+ const rtl::OUString& i_rValue,
+ const com::sun::star::lang::Locale& i_rLocale ) const
+{
+ rtl::OUString aResult( m_pTranslator->translateValue( i_rKey, i_rOption, i_rValue, i_rLocale ) );
+ if( aResult.getLength() == 0 )
+ aResult = i_rValue;
+ return aResult;
+}
+
/*
* PPDKey
*/
diff --git a/vcl/unx/source/printer/printerinfomanager.cxx b/vcl/unx/source/printer/printerinfomanager.cxx
index 53cd662db8e0..ef6a67203cd8 100644
--- a/vcl/unx/source/printer/printerinfomanager.cxx
+++ b/vcl/unx/source/printer/printerinfomanager.cxx
@@ -119,6 +119,7 @@ PrinterInfoManager::PrinterInfoManager( Type eType ) :
m_pQueueInfo( NULL ),
m_eType( eType ),
m_bUseIncludeFeature( false ),
+ m_bUseJobPatch( true ),
m_aSystemDefaultPaper( RTL_CONSTASCII_USTRINGPARAM( "A4" ) ),
m_bDisableCUPS( false )
{
diff --git a/vcl/unx/source/printergfx/printerjob.cxx b/vcl/unx/source/printergfx/printerjob.cxx
index 783dd5ff2b47..bc9746c3fe77 100644
--- a/vcl/unx/source/printergfx/printerjob.cxx
+++ b/vcl/unx/source/printergfx/printerjob.cxx
@@ -681,14 +681,6 @@ PrinterJob::StartPage (const JobData& rJobSetup)
if( ! (pPageHeader && pPageBody) )
return sal_False;
- /* #i7262# write setup only before first page
- * don't do this in StartJob since the jobsetup there may be
- * different.
- */
- bool bSuccess = true;
- if( 1 == maPageList.size() )
- m_aDocumentJobData = rJobSetup;
-
// write page header according to Document Structuring Conventions (DSC)
WritePS (pPageHeader, "%%Page: ");
WritePS (pPageHeader, aPageNo);
@@ -722,13 +714,25 @@ PrinterJob::StartPage (const JobData& rJobSetup)
WritePS (pPageHeader, pBBox);
- if (bSuccess)
- bSuccess = writePageSetup ( pPageHeader, rJobSetup );
- if(bSuccess)
- m_aLastJobData = rJobSetup;
+ /* #i7262# #i65491# write setup only before first page
+ * (to %%Begin(End)Setup, instead of %%Begin(End)PageSetup)
+ * don't do this in StartJob since the jobsetup there may be
+ * different.
+ */
+ bool bWriteFeatures = true;
+ if( 1 == maPageList.size() )
+ {
+ m_aDocumentJobData = rJobSetup;
+ bWriteFeatures = false;
+ }
+ if ( writePageSetup( pPageHeader, rJobSetup, bWriteFeatures ) )
+ {
+ m_aLastJobData = rJobSetup;
+ return true;
+ }
- return bSuccess;
+ return false;
}
sal_Bool
@@ -828,12 +832,9 @@ bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool b
if( pKey->getSetupType() == PPDKey::DocumentSetup )
bEmit = true;
}
- else
- {
- if( pKey->getSetupType() == PPDKey::PageSetup ||
- pKey->getSetupType() == PPDKey::AnySetup )
- bEmit = true;
- }
+ if( pKey->getSetupType() == PPDKey::PageSetup ||
+ pKey->getSetupType() == PPDKey::AnySetup )
+ bEmit = true;
if( bEmit )
{
const PPDValue* pValue = rJob.m_aContext.getValue( pKey );
@@ -866,13 +867,13 @@ bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool b
return bSuccess;
}
-bool PrinterJob::writePageSetup( osl::File* pFile, const JobData& rJob )
+bool PrinterJob::writePageSetup( osl::File* pFile, const JobData& rJob, bool bWriteFeatures )
{
bool bSuccess = true;
WritePS (pFile, "%%BeginPageSetup\n%\n");
-
- bSuccess = writeFeatureList( pFile, rJob, false );
+ if ( bWriteFeatures )
+ bSuccess = writeFeatureList( pFile, rJob, false );
WritePS (pFile, "%%EndPageSetup\n");
sal_Char pTranslate [128];
@@ -914,6 +915,9 @@ bool PrinterJob::writePageSetup( osl::File* pFile, const JobData& rJob )
void PrinterJob::writeJobPatch( osl::File* pFile, const JobData& rJobData )
{
+ if( ! PrinterInfoManager::get().getUseJobPatch() )
+ return;
+
const PPDKey* pKey = NULL;
if( rJobData.m_pParser )
diff --git a/vcl/util/hidother.src b/vcl/util/hidother.src
new file mode 100644
index 000000000000..ab10a1e4c4ea
--- /dev/null
+++ b/vcl/util/hidother.src
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hidother.src,v $
+ * $Revision: 1.20 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "vcl/svids.hrc"
+
+hidspecial HID_PRINTDLG { HelpID = HID_PRINTDLG; };
+
diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk
index ef4f13301ecd..72ffd89bd6ed 100644
--- a/vcl/util/makefile.mk
+++ b/vcl/util/makefile.mk
@@ -31,6 +31,7 @@ PRJNAME=vcl
TARGET=vcl
TARGETTYPE=GUI
USE_DEFFILE=TRUE
+GEN_HID_OTHER=TRUE
.IF "$(SNDFILE_LIBS)"!=""
SNDFILELIB=$(SNDFILE_LIBS)
@@ -302,6 +303,7 @@ SHL2STDLIBS=\
$(VOSLIB) \
$(BASEGFXLIB) \
$(UNOTOOLSLIB) \
+ $(COMPHELPERLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB)
diff --git a/vcl/util/makefile2.pmk b/vcl/util/makefile2.pmk
index 63b2889bc15d..cb13e3b42743 100644
--- a/vcl/util/makefile2.pmk
+++ b/vcl/util/makefile2.pmk
@@ -36,3 +36,10 @@ VISIBILITY_HIDDEN=TRUE
.IF "$(GUIBASE)"=="aqua"
CFLAGSCXX+=$(OBJCXXFLAGS)
.ENDIF # "$(GUIBASE)"=="aqua"
+
+#building with stlport, but graphite was not built with stlport
+.IF "$(USE_SYSTEM_STL)"!="YES"
+.IF "$(SYSTEM_GRAPHITE)"=="YES"
+CDEFS += -DGRAPHITEADAPTSTL
+.ENDIF
+.ENDIF
diff --git a/vcl/win/inc/salprn.h b/vcl/win/inc/salprn.h
index 58d721fd043a..890ff70bc3d6 100644
--- a/vcl/win/inc/salprn.h
+++ b/vcl/win/inc/salprn.h
@@ -88,7 +88,6 @@ public:
virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin );
virtual void InitPaperFormats( const ImplJobSetup* pSetupData );
virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData );
- virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData );
};
// -----------------
@@ -117,7 +116,9 @@ public:
virtual BOOL StartJob( const XubString* pFileName,
const XubString& rJobName,
const XubString& rAppName,
- ULONG nCopies, BOOL bCollate,
+ ULONG nCopies,
+ bool bCollate,
+ bool bDirect,
ImplJobSetup* pSetupData );
virtual BOOL EndJob();
virtual BOOL AbortJob();
diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx
index 5a5703e10944..5c85d5d67144 100644
--- a/vcl/win/source/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx
@@ -337,7 +337,7 @@ BOOL ImplDrawTheme( HTHEME hTheme, HDC hDC, int iPart, int iState, RECT rc, cons
}
-Rectangle ImplGetThemeRect( HTHEME hTheme, HDC hDC, int iPart, int iState, const Rectangle& aRect )
+Rectangle ImplGetThemeRect( HTHEME hTheme, HDC hDC, int iPart, int iState, const Rectangle& aRect, THEMESIZE eTS = TS_TRUE )
{
SIZE aSz;
RECT rc;
@@ -345,7 +345,7 @@ Rectangle ImplGetThemeRect( HTHEME hTheme, HDC hDC, int iPart, int iState, const
rc.right = aRect.nRight;
rc.top = aRect.nTop;
rc.bottom = aRect.nBottom;
- HRESULT hr = vsAPI.GetThemePartSize( hTheme, hDC, iPart, iState, NULL, TS_TRUE, &aSz ); // TS_TRUE returns optimal size
+ HRESULT hr = vsAPI.GetThemePartSize( hTheme, hDC, iPart, iState, NULL, eTS, &aSz ); // TS_TRUE returns optimal size
if( hr == S_OK )
return Rectangle( 0, 0, aSz.cx, aSz.cy );
else
@@ -1109,6 +1109,63 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType,
bRet = TRUE;
}
}
+
+ if( (nType == CTRL_LISTBOX || nType == CTRL_COMBOBOX ) && nPart == PART_ENTIRE_CONTROL )
+ {
+ HTHEME hTheme = getThemeHandle( mhWnd, L"Combobox");
+ if( hTheme )
+ {
+ Rectangle aBoxRect( rControlRegion.GetBoundRect() );
+ Rectangle aRect( ImplGetThemeRect( hTheme, hDC, CP_DROPDOWNBUTTON,
+ CBXS_NORMAL, aBoxRect ) );
+ Rectangle aBrdRect( ImplGetThemeRect( hTheme, hDC, CP_BORDER,
+ CBB_HOT, aBoxRect ) );
+ aRect.Top() -= aBrdRect.GetHeight();
+ if( aRect.GetHeight() > aBoxRect.GetHeight() )
+ aBoxRect.Bottom() = aBoxRect.Top() + aRect.GetHeight();
+ if( aRect.GetWidth() > aBoxRect.GetWidth() )
+ aBoxRect.Right() = aBoxRect.Left() + aRect.GetWidth();
+ rNativeContentRegion = aBoxRect;
+ rNativeBoundingRegion = rNativeContentRegion;
+ if( !aRect.IsEmpty() )
+ bRet = TRUE;
+ }
+ }
+
+ if( (nType == CTRL_EDITBOX || nType == CTRL_SPINBOX) && nPart == PART_ENTIRE_CONTROL )
+ {
+ HTHEME hTheme = getThemeHandle( mhWnd, L"Edit");
+ if( hTheme )
+ {
+ // get borderr size
+ Rectangle aBoxRect( rControlRegion.GetBoundRect() );
+ Rectangle aRect( ImplGetThemeRect( hTheme, hDC, EP_BACKGROUNDWITHBORDER,
+ EBWBS_HOT, aBoxRect ) );
+ // ad app font height
+ NONCLIENTMETRICSW aNonClientMetrics;
+ aNonClientMetrics.cbSize = sizeof( aNonClientMetrics );
+ if ( SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, sizeof( aNonClientMetrics ), &aNonClientMetrics, 0 ) )
+ {
+ long nFontHeight = aNonClientMetrics.lfMessageFont.lfHeight;
+ if( nFontHeight < 0 )
+ nFontHeight = -nFontHeight;
+
+ if( aRect.GetHeight() && nFontHeight )
+ {
+ aRect.Bottom() += aRect.GetHeight();
+ aRect.Bottom() += nFontHeight;
+ if( aRect.GetHeight() > aBoxRect.GetHeight() )
+ aBoxRect.Bottom() = aBoxRect.Top() + aRect.GetHeight();
+ if( aRect.GetWidth() > aBoxRect.GetWidth() )
+ aBoxRect.Right() = aBoxRect.Left() + aRect.GetWidth();
+ rNativeContentRegion = aBoxRect;
+ rNativeBoundingRegion = rNativeContentRegion;
+ bRet = TRUE;
+ }
+ }
+ }
+ }
+
ReleaseDC( mhWnd, hDC );
return( bRet );
}
diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx
index ecf91aea7c1b..f4f55dd0adbf 100644
--- a/vcl/win/source/gdi/salprn.cxx
+++ b/vcl/win/source/gdi/salprn.cxx
@@ -1059,6 +1059,21 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
break;
}
}
+
+ if( nFlags & SAL_JOBSET_DUPLEXMODE )
+ {
+ DuplexMode eDuplex = DUPLEX_UNKNOWN;
+ if( (CHOOSE_DEVMODE(dmFields) & DM_DUPLEX) )
+ {
+ if( CHOOSE_DEVMODE(dmDuplex) == DMDUP_SIMPLEX )
+ eDuplex = DUPLEX_OFF;
+ else if( CHOOSE_DEVMODE(dmDuplex) == DMDUP_VERTICAL )
+ eDuplex = DUPLEX_LONGEDGE;
+ else if( CHOOSE_DEVMODE(dmDuplex) == DMDUP_HORIZONTAL )
+ eDuplex = DUPLEX_SHORTEDGE;
+ }
+ pSetupData->meDuplexMode = eDuplex;
+ }
}
// -----------------------------------------------------------------------
@@ -1326,6 +1341,26 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
}
}
}
+ if( (nFlags & SAL_JOBSET_DUPLEXMODE) )
+ {
+ switch( pSetupData->meDuplexMode )
+ {
+ case DUPLEX_OFF:
+ CHOOSE_DEVMODE(dmFields) |= DM_DUPLEX;
+ CHOOSE_DEVMODE(dmDuplex) = DMDUP_SIMPLEX;
+ break;
+ case DUPLEX_SHORTEDGE:
+ CHOOSE_DEVMODE(dmFields) |= DM_DUPLEX;
+ CHOOSE_DEVMODE(dmDuplex) = DMDUP_HORIZONTAL;
+ break;
+ case DUPLEX_LONGEDGE:
+ CHOOSE_DEVMODE(dmFields) |= DM_DUPLEX;
+ CHOOSE_DEVMODE(dmDuplex) = DMDUP_VERTICAL;
+ break;
+ case DUPLEX_UNKNOWN:
+ break;
+ }
+ }
}
// -----------------------------------------------------------------------
@@ -1559,39 +1594,6 @@ void WinSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData )
// -----------------------------------------------------------------------
-DuplexMode WinSalInfoPrinter::GetDuplexMode( const ImplJobSetup* pSetupData )
-{
- DuplexMode nRet = DUPLEX_UNKNOWN;
- if ( pSetupData &&pSetupData->mpDriverData )
- {
- if( aSalShlData.mbWPrinter )
- {
- DEVMODEW* pDevMode = SAL_DEVMODE_W( pSetupData );
- if ( pDevMode && (pDevMode->dmFields & DM_DUPLEX ))
- {
- if ( pDevMode->dmDuplex == DMDUP_SIMPLEX )
- nRet = DUPLEX_OFF;
- else
- nRet = DUPLEX_ON;
- }
- }
- else
- {
- DEVMODEA* pDevMode = SAL_DEVMODE_A( pSetupData );
- if ( pDevMode && (pDevMode->dmFields & DM_DUPLEX ))
- {
- if ( pDevMode->dmDuplex == DMDUP_SIMPLEX )
- nRet = DUPLEX_OFF;
- else
- nRet = DUPLEX_ON;
- }
- }
- }
- return nRet;
-}
-
-// -----------------------------------------------------------------------
-
int WinSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData )
{
int nRet = ImplDeviceCaps( this, DC_ORIENTATION, NULL, pSetupData );
@@ -1964,7 +1966,9 @@ static int lcl_StartDocA( HDC hDC, DOCINFOA* pInfo, WinSalPrinter* pPrt )
BOOL WinSalPrinter::StartJob( const XubString* pFileName,
const XubString& rJobName,
const XubString&,
- ULONG nCopies, BOOL bCollate,
+ ULONG nCopies,
+ bool bCollate,
+ bool /*bDirect*/,
ImplJobSetup* pSetupData )
{
mnError = 0;
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index fc92757e0925..8bbd32994dec 100644..100755
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2978,6 +2978,11 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) );
}
+ // caret width
+ DWORD nCaretWidth = 2;
+ if( SystemParametersInfo( SPI_GETCARETWIDTH, 0, &nCaretWidth, 0 ) )
+ aStyleSettings.SetCursorSize( nCaretWidth );
+
// High contrast
HIGHCONTRAST hc;
hc.cbSize = sizeof( HIGHCONTRAST );